@true-engineering/true-react-common-ui-kit 4.0.0-alpha2 → 4.0.0-alpha21
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/README.md +11 -567
- package/dist/components/Button/Button.styles.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/components/ControlWrapper/ControlWrapper.d.ts +2 -0
- package/dist/components/ControlWrapper/ControlWrapper.styles.d.ts +2 -1
- package/dist/components/ControlWrapper/index.d.ts +1 -0
- package/dist/components/ControlWrapper/types.d.ts +3 -0
- package/dist/components/DatePicker/DatePicker.d.ts +3 -3
- package/dist/components/DatePicker/DatePicker.styles.d.ts +1 -1
- package/dist/components/DatePicker/components/PopperContainer/PopperContainer.d.ts +2 -4
- package/dist/components/DatePicker/helpers.d.ts +3 -0
- package/dist/components/DatePicker/types.d.ts +5 -3
- package/dist/components/FiltersPane/FiltersPane.d.ts +7 -2
- package/dist/components/FiltersPane/components/Filter/Filter.d.ts +2 -2
- package/dist/components/FiltersPane/components/Filter/helpers.d.ts +4 -0
- package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.d.ts +3 -1
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +2 -2
- package/dist/components/FiltersPane/types.d.ts +15 -5
- package/dist/components/Flag/customFlags/customFlags.d.ts +10 -0
- package/dist/components/Flag/customFlags/index.d.ts +1 -0
- package/dist/components/FlexibleTable/FlexibleTable.d.ts +4 -2
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.d.ts +4 -3
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +6 -6
- package/dist/components/FlexibleTable/constants.d.ts +18 -2
- package/dist/components/FlexibleTable/types.d.ts +8 -8
- package/dist/components/Icon/icons-list.d.ts +1 -1
- package/dist/components/IconButton/IconButton.styles.d.ts +1 -1
- package/dist/components/IncrementInput/IncrementInput.styles.d.ts +1 -3
- package/dist/components/Input/Input.d.ts +3 -2
- package/dist/components/Input/InputBase.d.ts +2 -2
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/List/index.d.ts +2 -1
- package/dist/components/List/types.d.ts +4 -0
- package/dist/components/Modal/Modal.styles.d.ts +1 -1
- package/dist/components/Notification/Notification.styles.d.ts +1 -1
- package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +5 -3
- package/dist/components/Select/Select.styles.d.ts +4 -4
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Status/Status.styles.d.ts +3 -2
- package/dist/components/Status/constants.d.ts +0 -1
- package/dist/components/Status/index.d.ts +1 -0
- package/dist/components/Status/types.d.ts +5 -2
- package/dist/components/TextArea/TextArea.d.ts +2 -5
- package/dist/components/TextArea/TextArea.styles.d.ts +1 -2
- package/dist/components/TextArea/index.d.ts +0 -1
- package/dist/components/TextButton/TextButton.styles.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.styles.d.ts +1 -1
- package/dist/components/WithMessages/WithMessages.styles.d.ts +1 -1
- package/dist/components/WithPopup/WithPopup.d.ts +21 -6
- package/dist/components/WithPopup/WithPopup.styles.d.ts +1 -1
- package/dist/components/WithPopup/helpers.d.ts +2 -0
- package/dist/components/WithPopup/types.d.ts +3 -0
- package/dist/components/WithTooltip/WithTooltip.styles.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-merge.d.ts +1 -0
- package/dist/hooks/use-mixed-styles.d.ts +3 -1
- package/dist/hooks/use-tweak-styles.d.ts +5 -5
- package/dist/style.css +78 -142
- package/dist/theme/Provider.d.ts +6 -3
- package/dist/theme/common.d.ts +4 -2
- package/dist/theme/create-themed-styles.d.ts +2 -0
- package/dist/theme/helpers.d.ts +9 -3
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/true-jss/ThemedStylesManager.d.ts +18 -0
- package/dist/theme/true-jss/TweakStylesManager.d.ts +34 -0
- package/dist/theme/true-jss/index.d.ts +2 -0
- package/dist/theme/true-jss/jss-context.d.ts +9 -0
- package/dist/theme/types.d.ts +5 -3
- package/dist/true-react-common-ui-kit.js +7580 -6523
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +7466 -6410
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +10 -3
- package/package.json +4 -5
- package/src/components/ControlWrapper/ControlWrapper.stories.tsx +1 -1
- package/src/components/ControlWrapper/ControlWrapper.styles.ts +7 -6
- package/src/components/ControlWrapper/ControlWrapper.tsx +8 -2
- package/src/components/ControlWrapper/index.ts +1 -0
- package/src/components/ControlWrapper/types.ts +4 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +2 -1
- package/src/components/DatePicker/DatePicker.styles.ts +3 -1
- package/src/components/DatePicker/DatePicker.tsx +12 -7
- package/src/components/DatePicker/components/PopperContainer/PopperContainer.tsx +4 -4
- package/src/components/DatePicker/helpers.ts +13 -1
- package/src/components/DatePicker/types.ts +9 -4
- package/src/components/FiltersPane/FiltersPane.stories.tsx +4 -2
- package/src/components/FiltersPane/FiltersPane.tsx +19 -13
- package/src/components/FiltersPane/components/Filter/Filter.tsx +24 -17
- package/src/components/FiltersPane/components/Filter/helpers.ts +18 -0
- package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +27 -22
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.ts +1 -0
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +3 -4
- package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +1 -1
- package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.tsx +7 -5
- package/src/components/FiltersPane/types.ts +23 -5
- package/src/components/Flag/Flag.stories.tsx +2 -1
- package/src/components/Flag/Flag.styles.ts +4 -0
- package/src/components/Flag/Flag.tsx +23 -9
- package/src/components/Flag/customFlags/AB.svg +1 -0
- package/src/components/Flag/customFlags/OS.svg +1 -0
- package/src/components/Flag/customFlags/augment.d.ts +1 -0
- package/src/components/Flag/customFlags/customFlags.ts +13 -0
- package/src/components/Flag/customFlags/index.ts +1 -0
- package/src/components/FlexibleTable/FlexibleTable.tsx +13 -12
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +8 -5
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +13 -12
- package/src/components/FlexibleTable/constants.ts +6 -3
- package/src/components/FlexibleTable/types.ts +8 -12
- package/src/components/IncrementInput/IncrementInput.stories.tsx +2 -0
- package/src/components/IncrementInput/IncrementInput.styles.ts +31 -39
- package/src/components/IncrementInput/IncrementInput.tsx +28 -25
- package/src/components/Input/Input.tsx +5 -3
- package/src/components/Input/InputBase.tsx +29 -24
- package/src/components/List/List.tsx +5 -2
- package/src/components/List/index.ts +2 -1
- package/src/components/List/types.ts +5 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +5 -1
- package/src/components/PhoneInput/PhoneInput.stories.tsx +2 -1
- package/src/components/PhoneInput/PhoneInput.tsx +5 -2
- package/src/components/SearchInput/SearchInput.tsx +20 -29
- package/src/components/Select/Select.tsx +12 -2
- package/src/components/Select/components/SelectList/SelectList.tsx +1 -1
- package/src/components/Select/index.ts +1 -1
- package/src/components/Status/Status.stories.tsx +54 -1
- package/src/components/Status/Status.styles.ts +2 -37
- package/src/components/Status/constants.ts +0 -10
- package/src/components/Status/index.ts +1 -1
- package/src/components/Status/types.ts +7 -3
- package/src/components/TextArea/TextArea.styles.ts +2 -6
- package/src/components/TextArea/TextArea.tsx +41 -20
- package/src/components/TextArea/index.ts +0 -1
- package/src/components/TextButton/TextButton.styles.ts +1 -0
- package/src/components/Tooltip/Tooltip.styles.ts +2 -0
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/WithMessages/WithMessages.stories.tsx +1 -1
- package/src/components/WithPopup/WithPopup.stories.tsx +1 -0
- package/src/components/WithPopup/WithPopup.styles.ts +2 -0
- package/src/components/WithPopup/WithPopup.tsx +64 -16
- package/src/components/WithPopup/helpers.ts +9 -0
- package/src/components/WithPopup/types.ts +7 -0
- package/src/components/WithTooltip/WithTooltip.styles.ts +6 -0
- package/src/components/WithTooltip/WithTooltip.tsx +7 -2
- package/src/constants/phone-info.ts +20 -33
- package/src/helpers/phone.ts +19 -15
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-merge.ts +8 -0
- package/src/hooks/use-mixed-styles.ts +9 -11
- package/src/hooks/use-tweak-styles.ts +49 -27
- package/src/theme/Provider.tsx +10 -5
- package/src/theme/common.ts +5 -2
- package/src/theme/create-themed-styles.ts +78 -0
- package/src/theme/helpers.ts +39 -39
- package/src/theme/index.ts +2 -0
- package/src/theme/true-jss/ThemedStylesManager.ts +92 -0
- package/src/theme/true-jss/TweakStylesManager.ts +157 -0
- package/src/theme/true-jss/index.ts +2 -0
- package/src/theme/true-jss/jss-context.tsx +34 -0
- package/src/theme/types.ts +5 -3
- package/src/types.ts +17 -4
- package/dist/components/AccountInfo/AccountInfo.stories.d.ts +0 -6
- package/dist/components/AddButton/AddButton.stories.d.ts +0 -6
- package/dist/components/Button/Button.stories.d.ts +0 -6
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -8
- package/dist/components/CloseButton/CloseButton.stories.d.ts +0 -5
- package/dist/components/Colors/Colors.stories.d.ts +0 -5
- package/dist/components/ControlWrapper/ControlWrapper.stories.d.ts +0 -6
- package/dist/components/DateInput/DateInput.stories.d.ts +0 -7
- package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -7
- package/dist/components/Description/Description.stories.d.ts +0 -16
- package/dist/components/FileInput/FileInput.stories.d.ts +0 -7
- package/dist/components/FileItem/FileItem.stories.d.ts +0 -8
- package/dist/components/FiltersPane/FiltersPane.stories.d.ts +0 -31
- package/dist/components/Flag/Flag.stories.d.ts +0 -12
- package/dist/components/FlexibleTable/FlexibleTable.stories.d.ts +0 -19
- package/dist/components/Icon/Icon.stories.d.ts +0 -6
- package/dist/components/IconButton/IconButton.stories.d.ts +0 -6
- package/dist/components/IncrementInput/IncrementInput.stories.d.ts +0 -6
- package/dist/components/Input/Input.stories.d.ts +0 -25
- package/dist/components/List/List.stories.d.ts +0 -5
- package/dist/components/Modal/Modal.stories.d.ts +0 -29
- package/dist/components/MoreMenu/MoreMenu.stories.d.ts +0 -6
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +0 -13
- package/dist/components/NewMoreMenu/NewMoreMenu.stories.d.ts +0 -12
- package/dist/components/Notification/Notification.stories.d.ts +0 -8
- package/dist/components/NumberInput/NumberInput.stories.d.ts +0 -7
- package/dist/components/PhoneInput/PhoneInput.stories.d.ts +0 -28
- package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.stories.d.ts +0 -5
- package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -7
- package/dist/components/SearchInput/SearchInput.stories.d.ts +0 -6
- package/dist/components/Select/CustomSelect.stories.d.ts +0 -11
- package/dist/components/Select/MultiSelect.stories.d.ts +0 -15
- package/dist/components/Select/Select.stories.d.ts +0 -15
- package/dist/components/Selector/Selector.stories.d.ts +0 -7
- package/dist/components/Skeleton/Skeleton.stories.d.ts +0 -6
- package/dist/components/SmartInput/SmartInput.stories.d.ts +0 -18
- package/dist/components/Status/Status.stories.d.ts +0 -6
- package/dist/components/Switch/Switch.stories.d.ts +0 -16
- package/dist/components/TextArea/TextArea.stories.d.ts +0 -17
- package/dist/components/TextArea/types.d.ts +0 -2
- package/dist/components/TextButton/TextButton.stories.d.ts +0 -6
- package/dist/components/TextWithInfo/TextWithInfo.stories.d.ts +0 -12
- package/dist/components/TextWithTooltip/TextWithTooltip.stories.d.ts +0 -24
- package/dist/components/ThemedPreloader/ThemedPreloader.stories.d.ts +0 -17
- package/dist/components/Toaster/Toaster.stories.d.ts +0 -5
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -5
- package/dist/components/WithMessages/WithMessages.stories.d.ts +0 -7
- package/dist/components/WithPopup/WithPopup.stories.d.ts +0 -16
- package/dist/components/WithTooltip/WithTooltip.stories.d.ts +0 -6
- package/src/components/TextArea/types.ts +0 -6
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { FocusEventHandler,
|
|
2
|
-
import { Modifier, Placement } from 'react-overlays/usePopper';
|
|
1
|
+
import type { FocusEventHandler, KeyboardEvent, KeyboardEventHandler, MouseEvent, MouseEventHandler, PointerEventHandler, ReactNode } from 'react';
|
|
2
|
+
import type { Modifier, Placement } from 'react-overlays/usePopper';
|
|
3
|
+
import type { JssStyle } from 'jss';
|
|
4
|
+
import type { IMaybeArray } from './theme';
|
|
3
5
|
export interface ITestIdProps {
|
|
4
6
|
testId?: string;
|
|
5
7
|
}
|
|
@@ -10,7 +12,7 @@ export interface IDataAttributesProps extends ITestIdProps {
|
|
|
10
12
|
data?: IDataAttributes;
|
|
11
13
|
}
|
|
12
14
|
export interface ITweakStylesProps<TweakStyles> {
|
|
13
|
-
tweakStyles?: TweakStyles
|
|
15
|
+
tweakStyles?: IMaybeArray<TweakStyles>;
|
|
14
16
|
}
|
|
15
17
|
export type ICommonProps<TweakStyles> = IDataAttributesProps & ITweakStylesProps<TweakStyles>;
|
|
16
18
|
export interface IDropdownWithPopperOptions {
|
|
@@ -43,3 +45,8 @@ export interface IDomElementInteractions<T> {
|
|
|
43
45
|
onPointerUp?: PointerEventHandler<T>;
|
|
44
46
|
}
|
|
45
47
|
export type IRenderNode<T> = ReactNode | ((props: T) => ReactNode);
|
|
48
|
+
export type IExtendableProps<T extends string | readonly string[]> = Record<T extends ReadonlyArray<infer P> ? P : T, JssStyle>;
|
|
49
|
+
export type IDefaultExtendableProps = IExtendableProps<'custom'>;
|
|
50
|
+
export type IWithPrefix<T, P extends string> = {
|
|
51
|
+
[K in keyof T as `${P}${K & string}`]: T[K];
|
|
52
|
+
};
|
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-
|
|
3
|
+
"version": "4.0.0-alpha21",
|
|
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.
|
|
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": "
|
|
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.
|
|
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,6 @@
|
|
|
1
1
|
import { animations, createThemedStyles, dimensions, ITweakStyles } from '../../theme';
|
|
2
2
|
import { IThemedPreloaderStyles } from '../ThemedPreloader';
|
|
3
|
+
import { IControlWrapperSizes } from './types';
|
|
3
4
|
|
|
4
5
|
const { CONTROL, Z_INDEX } = dimensions;
|
|
5
6
|
|
|
@@ -20,10 +21,6 @@ export const useStyles = createThemedStyles('ControlWrapper', {
|
|
|
20
21
|
zIndex: 0,
|
|
21
22
|
},
|
|
22
23
|
|
|
23
|
-
invalid: {
|
|
24
|
-
zIndex: Z_INDEX.CONTROL_INVALID,
|
|
25
|
-
},
|
|
26
|
-
|
|
27
24
|
disabled: {},
|
|
28
25
|
|
|
29
26
|
focused: {
|
|
@@ -31,6 +28,10 @@ export const useStyles = createThemedStyles('ControlWrapper', {
|
|
|
31
28
|
zIndex: Z_INDEX.CONTROL_FOCUS,
|
|
32
29
|
},
|
|
33
30
|
|
|
31
|
+
invalid: {
|
|
32
|
+
zIndex: Z_INDEX.CONTROL_INVALID,
|
|
33
|
+
},
|
|
34
|
+
|
|
34
35
|
withValue: {},
|
|
35
36
|
|
|
36
37
|
loading: {},
|
|
@@ -43,7 +44,7 @@ export const useStyles = createThemedStyles('ControlWrapper', {
|
|
|
43
44
|
position: 'absolute',
|
|
44
45
|
pointerEvents: 'none',
|
|
45
46
|
left: 'var(--control-padding)',
|
|
46
|
-
top: '
|
|
47
|
+
top: 'calc(var(--control-height) / 2)',
|
|
47
48
|
transformOrigin: 'top left',
|
|
48
49
|
transform: 'translateY(-50%)',
|
|
49
50
|
transition: animations.defaultTransition,
|
|
@@ -181,5 +182,5 @@ export const useStyles = createThemedStyles('ControlWrapper', {
|
|
|
181
182
|
|
|
182
183
|
export type IControlWrapperStyles = ITweakStyles<
|
|
183
184
|
typeof useStyles,
|
|
184
|
-
{ tweakPreloader: IThemedPreloaderStyles }
|
|
185
|
+
{ tweakPreloader: IThemedPreloaderStyles } & IControlWrapperSizes
|
|
185
186
|
>;
|
|
@@ -12,12 +12,14 @@ import { useTweakStyles } from '../../hooks';
|
|
|
12
12
|
import { IClickHandlerEvent, ICommonProps } from '../../types';
|
|
13
13
|
import { Icon, IIcon, renderIcon } from '../Icon';
|
|
14
14
|
import { ThemedPreloader } from '../ThemedPreloader';
|
|
15
|
+
import { IControlWrapperSize } from './types';
|
|
15
16
|
import { IControlWrapperStyles, useStyles } from './ControlWrapper.styles';
|
|
16
17
|
|
|
17
18
|
export interface IControlWrapperProps extends ICommonProps<IControlWrapperStyles> {
|
|
18
19
|
children: ReactNode;
|
|
19
20
|
label?: ReactNode;
|
|
20
21
|
icon?: IIcon;
|
|
22
|
+
size?: IControlWrapperSize;
|
|
21
23
|
groupPlacement?:
|
|
22
24
|
| 'left'
|
|
23
25
|
| 'right'
|
|
@@ -57,6 +59,7 @@ export const ControlWrapper: FC<IControlWrapperProps> = ({
|
|
|
57
59
|
isFullWidth,
|
|
58
60
|
isDisabled,
|
|
59
61
|
hasValue,
|
|
62
|
+
size,
|
|
60
63
|
testId,
|
|
61
64
|
children,
|
|
62
65
|
tweakStyles,
|
|
@@ -70,6 +73,8 @@ export const ControlWrapper: FC<IControlWrapperProps> = ({
|
|
|
70
73
|
const hasClearButton = !isDisabled && !isLoading && hasValue && isNotEmpty(onClear);
|
|
71
74
|
const hasControls = hasEndIcon || hasClearButton || isLoading;
|
|
72
75
|
|
|
76
|
+
const isActive = isFocused || hasValue;
|
|
77
|
+
|
|
73
78
|
const tweakPreloaderStyles = useTweakStyles({
|
|
74
79
|
tweakStyles,
|
|
75
80
|
className: 'tweakPreloader',
|
|
@@ -80,7 +85,8 @@ export const ControlWrapper: FC<IControlWrapperProps> = ({
|
|
|
80
85
|
<div
|
|
81
86
|
className={clsx(
|
|
82
87
|
classes.controlWrapper,
|
|
83
|
-
isNotEmpty(groupPlacement) &&
|
|
88
|
+
isNotEmpty(groupPlacement) && classes[`placement-${groupPlacement}`],
|
|
89
|
+
isNotEmpty(size) && classes[size],
|
|
84
90
|
{
|
|
85
91
|
[classes.invalid]: isInvalid,
|
|
86
92
|
[classes.focused]: isFocused,
|
|
@@ -97,7 +103,7 @@ export const ControlWrapper: FC<IControlWrapperProps> = ({
|
|
|
97
103
|
className={clsx(classes.label, {
|
|
98
104
|
[classes.requiredLabel]: isRequired,
|
|
99
105
|
[classes.disabledLabel]: isDisabled,
|
|
100
|
-
[classes.activeLabel]:
|
|
106
|
+
[classes.activeLabel]: isActive,
|
|
101
107
|
})}
|
|
102
108
|
>
|
|
103
109
|
{label}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import ru from 'date-fns/locale
|
|
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 {
|
|
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: {
|
|
@@ -14,13 +14,18 @@ import { ICommonProps } from '../../types';
|
|
|
14
14
|
import { DateInput, EMPTY_DATE_INPUT_VALUE, IDateInputProps } from '../DateInput';
|
|
15
15
|
import { DatePickerHeader, PopperContainer } from './components';
|
|
16
16
|
import { DatePickerComponent, DEFAULT_DATE_FORMAT } from './constants';
|
|
17
|
-
import {
|
|
18
|
-
|
|
17
|
+
import {
|
|
18
|
+
areDatesEquals,
|
|
19
|
+
getDateFormatter,
|
|
20
|
+
getDateValueParser,
|
|
21
|
+
preparateDatePickerLocale,
|
|
22
|
+
} from './helpers';
|
|
23
|
+
import { IDatePickerBaseProps, IDatePickerLocale, IRange } from './types';
|
|
19
24
|
import { IDatePickerStyles, useStyles } from './DatePicker.styles';
|
|
20
25
|
|
|
21
26
|
export interface IDatePickerProps extends IDatePickerBaseProps, ICommonProps<IDatePickerStyles> {
|
|
22
27
|
selectedDate?: Date | null;
|
|
23
|
-
locale:
|
|
28
|
+
locale: IDatePickerLocale;
|
|
24
29
|
months?: string[];
|
|
25
30
|
/** @default 'dd.MM.yyyy' */
|
|
26
31
|
dateFormat?: string;
|
|
@@ -58,7 +63,6 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
|
|
|
58
63
|
isClearable,
|
|
59
64
|
strictParsing,
|
|
60
65
|
fixedHeight,
|
|
61
|
-
excludeScrollbar,
|
|
62
66
|
focusSelectedMonth,
|
|
63
67
|
disabledKeyboardNavigation,
|
|
64
68
|
shouldRenderPopperInBody = false,
|
|
@@ -153,6 +157,7 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
|
|
|
153
157
|
}
|
|
154
158
|
};
|
|
155
159
|
|
|
160
|
+
// TODO: кажется это можно улучшить, т.к проблему пофиксили (https://github.com/Hacker0x01/react-datepicker/pull/5060)
|
|
156
161
|
const handleChangeDateRangeInput = (value: string) => {
|
|
157
162
|
const newStartDateValue = value.slice(0, 10);
|
|
158
163
|
let newStart = parseDateValue(newStartDateValue);
|
|
@@ -242,14 +247,13 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
|
|
|
242
247
|
ref={ref}
|
|
243
248
|
minDate={minDate}
|
|
244
249
|
maxDate={maxDate}
|
|
245
|
-
locale={locale}
|
|
250
|
+
locale={preparateDatePickerLocale(locale)}
|
|
246
251
|
dateFormat={dateFormat}
|
|
247
252
|
placeholderText={placeholder}
|
|
248
253
|
calendarStartDay={calendarStartDay}
|
|
249
254
|
inline={isInline}
|
|
250
255
|
disabled={isDisabled}
|
|
251
256
|
fixedHeight={fixedHeight}
|
|
252
|
-
excludeScrollbar={excludeScrollbar}
|
|
253
257
|
showPreviousMonths={showPreviousMonths}
|
|
254
258
|
focusSelectedMonth={focusSelectedMonth}
|
|
255
259
|
monthsShown={monthsShown}
|
|
@@ -262,12 +266,12 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
|
|
|
262
266
|
popperContainer={shouldRenderPopperInBody ? PopperContainer : undefined}
|
|
263
267
|
popperModifiers={popperModifiers}
|
|
264
268
|
popperPlacement={popperPlacement}
|
|
265
|
-
selectsRange={isRange}
|
|
266
269
|
strictParsing={strictParsing}
|
|
267
270
|
preventOpenOnFocus={preventOpenOnFocus}
|
|
268
271
|
shouldCloseOnSelect={shouldCloseOnSelect}
|
|
269
272
|
customInputRef={customInputRef}
|
|
270
273
|
customInput={<CustomInput {...dateInputProps} />}
|
|
274
|
+
renderDayContents={(day) => <div className={classes.dayInner}>{day}</div>}
|
|
271
275
|
renderCustomHeader={
|
|
272
276
|
renderCustomHeader ??
|
|
273
277
|
((baseProps) => <DatePickerHeader {...baseProps} months={months} />)
|
|
@@ -299,6 +303,7 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
|
|
|
299
303
|
startDate: start,
|
|
300
304
|
endDate: end,
|
|
301
305
|
selected: start,
|
|
306
|
+
selectsRange: true,
|
|
302
307
|
onBlur: handleDateRangeInputBlur,
|
|
303
308
|
onChange: handleChangeRange,
|
|
304
309
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FC,
|
|
2
|
-
import {
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { FloatingPortal } from '@floating-ui/react';
|
|
3
3
|
|
|
4
|
-
export const PopperContainer: FC<
|
|
5
|
-
<
|
|
4
|
+
export const PopperContainer: FC<PropsWithChildren> = (props) => (
|
|
5
|
+
<FloatingPortal root={document.body} {...props} />
|
|
6
6
|
);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { parse, format, isSameDay } from 'date-fns';
|
|
1
|
+
import { parse, format, isSameDay, type Locale } from 'date-fns';
|
|
2
|
+
import { ru as ruLocale, enUS as enLocale } from 'date-fns/locale';
|
|
2
3
|
import {
|
|
3
4
|
isEmpty,
|
|
4
5
|
isNotEmpty,
|
|
5
6
|
isStringNotEmpty,
|
|
6
7
|
} from '@true-engineering/true-react-platform-helpers';
|
|
7
8
|
import { EMPTY_DATE_INPUT_VALUE } from '../DateInput';
|
|
9
|
+
import { IDatePickerLocale } from './types';
|
|
8
10
|
|
|
9
11
|
export const getDateFormatter =
|
|
10
12
|
(dateFormat: string) =>
|
|
@@ -21,3 +23,13 @@ export const getDateValueParser =
|
|
|
21
23
|
export const areDatesEquals = (date1?: Date | null, date2?: Date | null): boolean =>
|
|
22
24
|
(isEmpty(date1) && isEmpty(date2)) ||
|
|
23
25
|
(isNotEmpty(date1) && isNotEmpty(date2) && isSameDay(date1, date2));
|
|
26
|
+
|
|
27
|
+
export const preparateDatePickerLocale = (locale: IDatePickerLocale): Locale => {
|
|
28
|
+
if (locale === 'ru') {
|
|
29
|
+
return ruLocale;
|
|
30
|
+
}
|
|
31
|
+
if (locale === 'en') {
|
|
32
|
+
return enLocale;
|
|
33
|
+
}
|
|
34
|
+
return locale;
|
|
35
|
+
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DatePickerProps } from 'react-datepicker';
|
|
2
|
+
import { type Locale } from 'date-fns';
|
|
3
|
+
import { type IDateInputProps } from '../DateInput';
|
|
3
4
|
|
|
4
5
|
export type IRange = [Date | null, Date | null] | null;
|
|
5
6
|
|
|
7
|
+
export type IDatePickerLocale = 'ru' | 'en' | Locale;
|
|
8
|
+
|
|
6
9
|
export type IDatePickerBaseProps = Pick<
|
|
7
|
-
|
|
10
|
+
DatePickerProps,
|
|
8
11
|
| 'startDate'
|
|
9
12
|
| 'endDate'
|
|
10
13
|
| 'minDate'
|
|
@@ -31,7 +34,8 @@ export type IDatePickerBaseProps = Pick<
|
|
|
31
34
|
| 'strictParsing'
|
|
32
35
|
| 'highlightDates'
|
|
33
36
|
| 'fixedHeight'
|
|
34
|
-
| '
|
|
37
|
+
| 'swapRange'
|
|
38
|
+
| 'onKeyDown'
|
|
35
39
|
> &
|
|
36
40
|
Omit<
|
|
37
41
|
IDateInputProps,
|
|
@@ -45,4 +49,5 @@ export type IDatePickerBaseProps = Pick<
|
|
|
45
49
|
| 'onChange'
|
|
46
50
|
| 'onClick'
|
|
47
51
|
| 'tweakStyles'
|
|
52
|
+
| 'onKeyDown'
|
|
48
53
|
>;
|
|
@@ -70,7 +70,8 @@ type ConfigValues = {
|
|
|
70
70
|
custom: string;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
interface IFiltersPaneWithCustomProps<Values
|
|
73
|
+
interface IFiltersPaneWithCustomProps<Values extends Record<string, unknown>, Content>
|
|
74
|
+
extends IFiltersPaneProps<Values, Content> {
|
|
74
75
|
containerWidth: number;
|
|
75
76
|
isSearchDisabled: boolean;
|
|
76
77
|
shouldShowSettingsButton: boolean;
|
|
@@ -80,7 +81,7 @@ interface IFiltersPaneWithCustomProps<Values, Content> extends IFiltersPaneProps
|
|
|
80
81
|
isClearableFields: boolean;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
function FiltersPaneWithCustomProps<Values, Content>({
|
|
84
|
+
function FiltersPaneWithCustomProps<Values extends Record<string, unknown>, Content>({
|
|
84
85
|
containerWidth,
|
|
85
86
|
isSearchDisabled,
|
|
86
87
|
shouldShowSettingsButton,
|
|
@@ -288,6 +289,7 @@ Default.args = {
|
|
|
288
289
|
hasClearButton: true,
|
|
289
290
|
isClearableFields: false,
|
|
290
291
|
isDisabled: false,
|
|
292
|
+
shouldRenderDataId: false,
|
|
291
293
|
containerWidth: 400,
|
|
292
294
|
withFieldNameInLabel: true,
|
|
293
295
|
isGroupingEnabled: true,
|
|
@@ -4,13 +4,13 @@ import { addDataAttributes } from '../../helpers';
|
|
|
4
4
|
import { useTweakStyles } from '../../hooks';
|
|
5
5
|
import { ICommonProps } from '../../types';
|
|
6
6
|
import { Button } from '../Button';
|
|
7
|
-
import {
|
|
7
|
+
import { IIcon, renderIcon } from '../Icon';
|
|
8
8
|
import { FilterWrapper, IFiltersPaneSearchProps, FiltersPaneSearch } from './components';
|
|
9
9
|
import { getLocale } from './helpers';
|
|
10
10
|
import { ConfigType, IFilterLocaleKey, IPartialFilterLocale } from './types';
|
|
11
11
|
import { useStyles, IFiltersPaneStyles, clearButtonStyles } from './FiltersPane.styles';
|
|
12
12
|
|
|
13
|
-
export interface IFiltersPaneProps<Values, Content = Values>
|
|
13
|
+
export interface IFiltersPaneProps<Values extends Record<string, unknown>, Content = Values>
|
|
14
14
|
extends ICommonProps<IFiltersPaneStyles> {
|
|
15
15
|
filtersConfig: ConfigType<Values>;
|
|
16
16
|
enabledFilters?: Array<keyof ConfigType<Values>>;
|
|
@@ -23,6 +23,10 @@ export interface IFiltersPaneProps<Values, Content = Values>
|
|
|
23
23
|
isDisabled?: boolean;
|
|
24
24
|
/** @default true */
|
|
25
25
|
hasClearButton?: boolean;
|
|
26
|
+
/** @default false */
|
|
27
|
+
shouldRenderDataId?: boolean;
|
|
28
|
+
/** @default 'filter' */
|
|
29
|
+
settingsIcon?: IIcon;
|
|
26
30
|
onChangeFilters: (values: Partial<Values>) => void;
|
|
27
31
|
onSettingsButtonClick?: () => void;
|
|
28
32
|
onClear?: () => void;
|
|
@@ -39,6 +43,8 @@ export function FiltersPane<Values extends Record<string, unknown>, Content = Va
|
|
|
39
43
|
search,
|
|
40
44
|
isDisabled = false,
|
|
41
45
|
hasClearButton = true,
|
|
46
|
+
shouldRenderDataId = false,
|
|
47
|
+
settingsIcon = 'filter',
|
|
42
48
|
testId,
|
|
43
49
|
onChangeFilters,
|
|
44
50
|
onSettingsButtonClick,
|
|
@@ -61,7 +67,7 @@ export function FiltersPane<Values extends Record<string, unknown>, Content = Va
|
|
|
61
67
|
|
|
62
68
|
const translates = useMemo(() => getLocale(localeKey, locale), [localeKey, locale]);
|
|
63
69
|
|
|
64
|
-
const filtersKeys = enabledFilters
|
|
70
|
+
const filtersKeys = enabledFilters ?? Object.keys(filtersConfig);
|
|
65
71
|
|
|
66
72
|
const handleClear = () => {
|
|
67
73
|
if (onClear !== undefined) {
|
|
@@ -104,9 +110,7 @@ export function FiltersPane<Values extends Record<string, unknown>, Content = Va
|
|
|
104
110
|
{...addDataTestId(testId, 'settings-button')}
|
|
105
111
|
onClick={!isDisabled ? onSettingsButtonClick : undefined}
|
|
106
112
|
>
|
|
107
|
-
<div className={classes.settingsIcon}>
|
|
108
|
-
<Icon type="filter" />
|
|
109
|
-
</div>
|
|
113
|
+
<div className={classes.settingsIcon}>{renderIcon(settingsIcon)}</div>
|
|
110
114
|
</div>
|
|
111
115
|
)}
|
|
112
116
|
{/* Search */}
|
|
@@ -122,10 +126,11 @@ export function FiltersPane<Values extends Record<string, unknown>, Content = Va
|
|
|
122
126
|
{/* Filters */}
|
|
123
127
|
{filtersKeys.map((key, index) => {
|
|
124
128
|
const isLast = index === filtersKeys.length - 1;
|
|
125
|
-
const
|
|
126
|
-
const
|
|
129
|
+
const filterKey = String(key);
|
|
130
|
+
const currentValue = values[filterKey];
|
|
131
|
+
const filter = filtersConfig[filterKey];
|
|
127
132
|
if (filter === undefined) {
|
|
128
|
-
console.error(`enabledFilters содержит фильтр ${
|
|
133
|
+
console.error(`enabledFilters содержит фильтр ${filterKey}, не описанный в конфиге`);
|
|
129
134
|
if (isLast) {
|
|
130
135
|
return clearButton;
|
|
131
136
|
}
|
|
@@ -137,18 +142,19 @@ export function FiltersPane<Values extends Record<string, unknown>, Content = Va
|
|
|
137
142
|
filter={filter}
|
|
138
143
|
locale={locale}
|
|
139
144
|
localeKey={localeKey}
|
|
140
|
-
onChange={(value) => onChangeFilters({ ...values, [
|
|
145
|
+
onChange={(value) => onChangeFilters({ ...values, [filterKey]: value })}
|
|
141
146
|
value={currentValue}
|
|
142
|
-
key={
|
|
147
|
+
key={filterKey}
|
|
143
148
|
isDisabled={isDisabled || filter?.requiredFilledFilters?.some((item) => !values[item])}
|
|
144
149
|
tweakStyles={tweakFilterWrapperStyles}
|
|
145
|
-
|
|
150
|
+
data={shouldRenderDataId ? { id: filterKey } : undefined}
|
|
151
|
+
testId={getTestId(testId, `filter-${filterKey}`)}
|
|
146
152
|
/>
|
|
147
153
|
);
|
|
148
154
|
|
|
149
155
|
if (isLast) {
|
|
150
156
|
return (
|
|
151
|
-
<div className={classes.filterWithClearButton} key={
|
|
157
|
+
<div className={classes.filterWithClearButton} key={filterKey}>
|
|
152
158
|
{filterWrapper}
|
|
153
159
|
{shouldShowClearButton && <>{clearButton}</>}
|
|
154
160
|
</div>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { getLocale } from '../../helpers';
|
|
3
|
-
import { IFilterMultiSelectValues, IFilterWithDatesValue, IPeriod } from '../../types';
|
|
4
3
|
import { FilterInterval } from '../FilterInterval';
|
|
5
4
|
import { FilterMultiSelect } from '../FilterMultiSelect';
|
|
6
5
|
import { FilterSelect } from '../FilterSelect';
|
|
7
6
|
import { FilterWithDates } from '../FilterWithDates';
|
|
8
7
|
import { FilterWithPeriod } from '../FilterWithPeriod';
|
|
9
8
|
import type { IFilterWrapperProps } from '../FilterWrapper';
|
|
9
|
+
import { isDatePeriodValue, isMultiSelectValue, isPeriodValue } from './helpers';
|
|
10
10
|
|
|
11
|
-
export interface IFilterProps<Values, Key extends keyof Values>
|
|
11
|
+
export interface IFilterProps<Values extends Record<string, unknown>, Key extends keyof Values>
|
|
12
12
|
extends IFilterWrapperProps<Values, Key> {
|
|
13
13
|
onChange: <V>(v: V) => void;
|
|
14
14
|
onClose?: () => void;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export function Filter<Values, Key extends keyof Values>(
|
|
17
|
+
export function Filter<Values extends Record<string, unknown>, Key extends keyof Values>(
|
|
18
18
|
props: IFilterProps<Values, Key>,
|
|
19
19
|
): JSX.Element | null {
|
|
20
20
|
const { filter, value, onChange, onClose, localeKey, locale, testId } = props;
|
|
@@ -39,9 +39,11 @@ export function Filter<Values, Key extends keyof Values>(
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (filter.type === 'dateRange') {
|
|
42
|
+
const preparedValue = isPeriodValue(value) ? { ...value } : undefined;
|
|
43
|
+
|
|
42
44
|
return (
|
|
43
45
|
<FilterWithPeriod
|
|
44
|
-
value={
|
|
46
|
+
value={preparedValue}
|
|
45
47
|
onChange={onChange}
|
|
46
48
|
onClose={onClose}
|
|
47
49
|
localeKey={translatesLocaleKey}
|
|
@@ -53,25 +55,27 @@ export function Filter<Values, Key extends keyof Values>(
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
if (filter.type === 'dateRangeWithoutPeriod') {
|
|
58
|
+
const preparedValue = isDatePeriodValue(value) ? value : undefined;
|
|
59
|
+
|
|
56
60
|
return (
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
61
|
+
<FilterWithDates
|
|
62
|
+
value={preparedValue}
|
|
63
|
+
onChange={(v) => onChange({ ...v, periodType: 'CUSTOM' })}
|
|
64
|
+
onEndBtnSubmit={() => onChange(undefined)}
|
|
65
|
+
localeKey={translatesLocaleKey}
|
|
66
|
+
locale={translates}
|
|
67
|
+
testId={testId !== undefined ? `${testId}-dates` : undefined}
|
|
68
|
+
{...filter}
|
|
69
|
+
/>
|
|
68
70
|
);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
if (filter.type === 'multiSelect') {
|
|
74
|
+
const preparedValue = isMultiSelectValue<any>(value) ? value : undefined;
|
|
75
|
+
|
|
72
76
|
return (
|
|
73
77
|
<FilterMultiSelect
|
|
74
|
-
value={
|
|
78
|
+
value={preparedValue}
|
|
75
79
|
onChange={onChange}
|
|
76
80
|
onClose={onClose}
|
|
77
81
|
localeKey={translatesLocaleKey}
|
|
@@ -83,9 +87,11 @@ export function Filter<Values, Key extends keyof Values>(
|
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
if (filter.type === 'interval') {
|
|
90
|
+
const preparedValue = Array.isArray(value) ? (value as number[]) : undefined;
|
|
91
|
+
|
|
86
92
|
return (
|
|
87
93
|
<FilterInterval
|
|
88
|
-
value={
|
|
94
|
+
value={preparedValue}
|
|
89
95
|
onChange={onChange}
|
|
90
96
|
localeKey={translatesLocaleKey}
|
|
91
97
|
locale={translates}
|
|
@@ -102,6 +108,7 @@ export function Filter<Values, Key extends keyof Values>(
|
|
|
102
108
|
|
|
103
109
|
if (filter.type === 'custom' && filter.component) {
|
|
104
110
|
const Component = filter.component;
|
|
111
|
+
|
|
105
112
|
return <Component {...props} filter={filter} />;
|
|
106
113
|
}
|
|
107
114
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isEmpty, isString } from '@true-engineering/true-react-platform-helpers';
|
|
2
|
+
import { IDatePeriod, IFilterMultiSelectValues, IPeriod } from '../../types';
|
|
3
|
+
|
|
4
|
+
const isDateOrEmpty = (value: unknown): value is Date | null | undefined =>
|
|
5
|
+
isEmpty(value) || value instanceof Date;
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
8
|
+
export const isDatePeriodValue = (value: any): value is IDatePeriod =>
|
|
9
|
+
isDateOrEmpty(value?.from) && isDateOrEmpty(value?.to);
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
12
|
+
export const isPeriodValue = (value: any): value is IPeriod =>
|
|
13
|
+
isString(value?.periodType) && isDatePeriodValue(value);
|
|
14
|
+
|
|
15
|
+
export const isMultiSelectValue = <T extends string>(
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
17
|
+
value: any,
|
|
18
|
+
): value is IFilterMultiSelectValues<T> => Array.isArray(value?.include);
|