@itcase/ui 1.8.147 → 1.8.149
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/{DatePicker_cjs_BOPN9WVz.js → DatePicker_cjs_YWv3CCNF.js} +4 -10
- package/dist/{DatePicker_es_-aO8EkK8.js → DatePicker_es_CqKPt0Nw.js} +4 -10
- package/dist/cjs/components/DatePeriod.js +13 -6
- package/dist/cjs/components/DatePicker.js +1 -1
- package/dist/cjs/components/Drawer/stories/__mock__.js +2 -2
- package/dist/cjs/components/Drawer.js +47 -2
- package/dist/cjs/components/Notification.js +21 -14
- package/dist/cjs/components/Pagination.js +4 -2
- package/dist/cjs/context/Notifications.js +4 -4
- package/dist/components/DatePeriod.js +13 -6
- package/dist/components/DatePicker.js +1 -1
- package/dist/components/Drawer/stories/__mock__.js +2 -2
- package/dist/components/Drawer.js +48 -3
- package/dist/components/Notification.js +22 -15
- package/dist/components/Pagination.js +4 -2
- package/dist/context/Notifications.js +4 -4
- package/dist/css/components/Loader/Loader.css +36 -0
- package/dist/css/components/Notification/Notification.css +37 -29
- package/dist/css/components/Notification/css/__item/notification__item.css +2 -2
- package/dist/css/components/Notification/css/__item/notification__item_size.css +3 -2
- package/dist/css/components/Notification/css/__item/notification__item_type.css +23 -0
- package/dist/css/components/Select/Select.css +1 -1
- package/dist/types/components/DatePeriod/DatePeriod.interface.d.ts +4 -4
- package/dist/types/components/DatePicker/DatePicker.interface.d.ts +4 -4
- package/dist/types/components/Drawer/Drawer.constants.d.ts +16 -0
- package/dist/types/components/Drawer/Drawer.d.ts +1 -1
- package/dist/types/components/Drawer/Drawer.interface.d.ts +2 -1
- package/dist/types/components/Notification/appearance/notificationDefault.d.ts +3 -1
- package/dist/types/components/Notification/appearance/notificationError.d.ts +1 -0
- package/dist/types/components/Notification/appearance/notificationInfo.d.ts +1 -0
- package/dist/types/components/Notification/appearance/notificationSize.d.ts +2 -0
- package/dist/types/components/Notification/appearance/notificationSuccess.d.ts +1 -0
- package/dist/types/components/Notification/appearance/notificationWarning.d.ts +1 -1
- package/package.json +4 -4
- package/dist/css/components/Notification/css/__item/notification__item_float.css +0 -9
- package/dist/css/components/Notification/css/__item/notification__item_global.css +0 -9
- package/dist/css/components/Notification/css/__item/notification__item_toast.css +0 -9
|
@@ -100,8 +100,8 @@ function DatePickerInput(props) {
|
|
|
100
100
|
const { daySize, dayTextColor, dayTextShape, dayTextSize, iconFill, iconFillHover, iconFillSize, iconItemFill, iconLeft, iconRight, iconShape, monthTextColor, monthTextSize, monthTextWeight, popper, popperPlacement, sizeClass, widthClass, yearTextColor, yearTextSize, yearTextWeight, isClearable, } = propsGenerator;
|
|
101
101
|
const datepickerRef = React.useRef(null);
|
|
102
102
|
const [dateStart, dateEnd] = React.useMemo(() => {
|
|
103
|
-
let dateStart;
|
|
104
|
-
if (value) {
|
|
103
|
+
let dateStart = undefined;
|
|
104
|
+
if (value !== undefined) {
|
|
105
105
|
if (typeof value === 'string') {
|
|
106
106
|
dateStart = new Date(value);
|
|
107
107
|
}
|
|
@@ -109,11 +109,8 @@ function DatePickerInput(props) {
|
|
|
109
109
|
dateStart = value;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
let dateEnd;
|
|
116
|
-
if (endValue) {
|
|
112
|
+
let dateEnd = undefined;
|
|
113
|
+
if (endValue !== undefined) {
|
|
117
114
|
if (typeof endValue === 'string') {
|
|
118
115
|
dateEnd = new Date(endValue);
|
|
119
116
|
}
|
|
@@ -121,9 +118,6 @@ function DatePickerInput(props) {
|
|
|
121
118
|
dateEnd = endValue;
|
|
122
119
|
}
|
|
123
120
|
}
|
|
124
|
-
else {
|
|
125
|
-
dateEnd = undefined;
|
|
126
|
-
}
|
|
127
121
|
return [dateStart, dateEnd];
|
|
128
122
|
}, [value, endValue]);
|
|
129
123
|
const handleChange = React.useCallback((selected) => {
|
|
@@ -98,8 +98,8 @@ function DatePickerInput(props) {
|
|
|
98
98
|
const { daySize, dayTextColor, dayTextShape, dayTextSize, iconFill, iconFillHover, iconFillSize, iconItemFill, iconLeft, iconRight, iconShape, monthTextColor, monthTextSize, monthTextWeight, popper, popperPlacement, sizeClass, widthClass, yearTextColor, yearTextSize, yearTextWeight, isClearable, } = propsGenerator;
|
|
99
99
|
const datepickerRef = useRef(null);
|
|
100
100
|
const [dateStart, dateEnd] = useMemo(() => {
|
|
101
|
-
let dateStart;
|
|
102
|
-
if (value) {
|
|
101
|
+
let dateStart = undefined;
|
|
102
|
+
if (value !== undefined) {
|
|
103
103
|
if (typeof value === 'string') {
|
|
104
104
|
dateStart = new Date(value);
|
|
105
105
|
}
|
|
@@ -107,11 +107,8 @@ function DatePickerInput(props) {
|
|
|
107
107
|
dateStart = value;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
let dateEnd;
|
|
114
|
-
if (endValue) {
|
|
110
|
+
let dateEnd = undefined;
|
|
111
|
+
if (endValue !== undefined) {
|
|
115
112
|
if (typeof endValue === 'string') {
|
|
116
113
|
dateEnd = new Date(endValue);
|
|
117
114
|
}
|
|
@@ -119,9 +116,6 @@ function DatePickerInput(props) {
|
|
|
119
116
|
dateEnd = endValue;
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
|
-
else {
|
|
123
|
-
dateEnd = undefined;
|
|
124
|
-
}
|
|
125
119
|
return [dateStart, dateEnd];
|
|
126
120
|
}, [value, endValue]);
|
|
127
121
|
const handleChange = useCallback((selected) => {
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var clsx = require('clsx');
|
|
6
|
+
var luxon = require('luxon');
|
|
6
7
|
var common = require('@itcase/common');
|
|
7
|
-
var DatePicker = require('../../
|
|
8
|
+
var DatePicker = require('../../DatePicker_cjs_YWv3CCNF.js');
|
|
8
9
|
var useAppearanceConfig = require('../hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
9
10
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
10
11
|
var ChipsGroup = require('../../ChipsGroup_cjs_BNfzAmhc.js');
|
|
@@ -119,8 +120,16 @@ function DatePeriod(props) {
|
|
|
119
120
|
const checkIsChipsActive = React.useCallback((targetPeriodItem) => {
|
|
120
121
|
const dateStartIso = targetPeriodItem.dateIntervalsList[0];
|
|
121
122
|
const dateEndIso = targetPeriodItem.dateIntervalsList[1];
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
let normalizedDatePeriodValueStart = null;
|
|
124
|
+
let normalizedDatePeriodValueEnd = null;
|
|
125
|
+
if (datePeriodValueStart) {
|
|
126
|
+
normalizedDatePeriodValueStart = luxon.DateTime.fromJSDate(new Date(datePeriodValueStart)).toISODate();
|
|
127
|
+
}
|
|
128
|
+
if (datePeriodValueEnd) {
|
|
129
|
+
normalizedDatePeriodValueEnd = luxon.DateTime.fromJSDate(new Date(datePeriodValueEnd)).toISODate();
|
|
130
|
+
}
|
|
131
|
+
return (dateStartIso === normalizedDatePeriodValueStart &&
|
|
132
|
+
dateEndIso === normalizedDatePeriodValueEnd);
|
|
124
133
|
}, [datePeriodValueEnd, datePeriodValueStart]);
|
|
125
134
|
// const onChangeDatePicker = useCallback(
|
|
126
135
|
// (dateStart: Date | null, dateEnd: Date | null) => {
|
|
@@ -151,9 +160,7 @@ function DatePeriod(props) {
|
|
|
151
160
|
fillHover: datePickerInputFillHover,
|
|
152
161
|
textSize: datePickerInputTextSize,
|
|
153
162
|
placeholder: 'Выбрать период',
|
|
154
|
-
}, value: datePeriodValueStart,
|
|
155
|
-
// onChange={onChangeDatePicker}
|
|
156
|
-
onChange: onChangeDatePeriod })] }) }));
|
|
163
|
+
}, value: datePeriodValueStart, onChange: onChangeDatePeriod })] }) }));
|
|
157
164
|
}
|
|
158
165
|
|
|
159
166
|
exports.DatePeriod = DatePeriod;
|
|
@@ -71,6 +71,24 @@ const drawerAppearance = {
|
|
|
71
71
|
...drawerAppearanceSurface,
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
+
// https://github.com/Farzin-Firoozi/react-modern-drawer
|
|
75
|
+
const ANIMATION_DURATION = 300; // default value is 300
|
|
76
|
+
const ANIMATION_STATE_SNAPSHOTS = {
|
|
77
|
+
DEFAULT: {
|
|
78
|
+
isInDOM: true,
|
|
79
|
+
// start from 'false' to trigger 'enter' animation
|
|
80
|
+
isOpen: false,
|
|
81
|
+
},
|
|
82
|
+
ENTER_FINISH: {
|
|
83
|
+
isInDOM: true,
|
|
84
|
+
isOpen: true,
|
|
85
|
+
},
|
|
86
|
+
EXIT_FINISH: {
|
|
87
|
+
isInDOM: false,
|
|
88
|
+
isOpen: false,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
74
92
|
const drawerConfig = {
|
|
75
93
|
appearance: drawerAppearance,
|
|
76
94
|
setAppearance: (appearanceConfig) => {
|
|
@@ -78,12 +96,16 @@ const drawerConfig = {
|
|
|
78
96
|
},
|
|
79
97
|
};
|
|
80
98
|
function Drawer(props) {
|
|
81
|
-
const {
|
|
99
|
+
const { appearance, className, dataTestId, dataTour, type, title, desc, enableOverlay, lockBackgroundScroll = true, stickyButton, before, after, close, isOpen, isOpenModal, onClickClose, onClose, children, } = props;
|
|
82
100
|
const _isOpen = isOpen ?? isOpenModal;
|
|
83
101
|
const isOpenPrevRef = React.useRef(Boolean(_isOpen));
|
|
102
|
+
const isFirstRenderRef = React.useRef(true);
|
|
84
103
|
const appearanceConfig = useAppearanceConfig.useAppearanceConfig(appearance, drawerConfig);
|
|
85
104
|
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
86
105
|
const { direction, size, titleTextColor, titleTextSize, titleTextWeight, descTextColor, descTextSize, divider, dividerSize, zeroPadding, closeIcon, closeIconFill, closeIconFillIcon, closeIconFillSize, closeIconShape, closeIconSize, closeIconSrc, } = propsGenerator;
|
|
106
|
+
const [animationState, setAnimationState] = React.useState(_isOpen
|
|
107
|
+
? ANIMATION_STATE_SNAPSHOTS.ENTER_FINISH
|
|
108
|
+
: ANIMATION_STATE_SNAPSHOTS.EXIT_FINISH);
|
|
87
109
|
React.useEffect(() => {
|
|
88
110
|
const isFromOpenToClose = isOpenPrevRef.current === true && !_isOpen;
|
|
89
111
|
if (isFromOpenToClose && onClose) {
|
|
@@ -95,10 +117,33 @@ function Drawer(props) {
|
|
|
95
117
|
if (isNeedShowWarning) {
|
|
96
118
|
console.warn('@itcase/ui Drawer warning: "isOpenModal" is deprecated, use "isOpen" instead.');
|
|
97
119
|
}
|
|
120
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
121
|
}, [_isOpen, onClose]);
|
|
122
|
+
// manage 'enter' and 'exit' animations
|
|
123
|
+
React.useEffect(() => {
|
|
124
|
+
if (isFirstRenderRef.current) {
|
|
125
|
+
isFirstRenderRef.current = false;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
setAnimationState(ANIMATION_STATE_SNAPSHOTS.DEFAULT);
|
|
129
|
+
// 16ms delay to prevent react from batching updates
|
|
130
|
+
const startTransitionDelay = 16;
|
|
131
|
+
const timeoutDelay = _isOpen ? startTransitionDelay : ANIMATION_DURATION;
|
|
132
|
+
const timeout = setTimeout(() => {
|
|
133
|
+
setAnimationState(_isOpen
|
|
134
|
+
? ANIMATION_STATE_SNAPSHOTS.ENTER_FINISH
|
|
135
|
+
: ANIMATION_STATE_SNAPSHOTS.EXIT_FINISH);
|
|
136
|
+
}, timeoutDelay);
|
|
137
|
+
return () => {
|
|
138
|
+
clearTimeout(timeout);
|
|
139
|
+
};
|
|
140
|
+
}, [_isOpen]);
|
|
141
|
+
if (!animationState.isInDOM) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
99
144
|
return (jsxRuntime.jsxs(ReactDrawer, { className: clsx('drawer', type && `drawer_type_${type}`, className, dataTour && `dataTour-${dataTour}`, stickyButton && 'drawer_sticky-button', zeroPadding && 'drawer_reset-padding'), dataTour: dataTour, direction: direction || 'right', size: size || 600,
|
|
100
145
|
// Drawer set prefix "EZDrawer" for any id
|
|
101
|
-
customIdSuffix: dataTestId ? `_${dataTestId}` : undefined, enableOverlay: enableOverlay, lockBackgroundScroll:
|
|
146
|
+
customIdSuffix: dataTestId ? `_${dataTestId}` : undefined, duration: ANIMATION_DURATION, enableOverlay: enableOverlay, lockBackgroundScroll: lockBackgroundScroll, overlayClassName: "drawer__overlay", open: animationState.isOpen, onClose: onClickClose, children: [before && jsxRuntime.jsx("div", { className: "drawer__before", children: before }), !close && (closeIcon || closeIconSrc) && (jsxRuntime.jsx("div", { className: "drawer__close", children: jsxRuntime.jsx(Icon.Icon, { className: "cursor_type_pointer", fill: closeIconFill, fillSize: closeIconFillSize, iconFill: closeIconFillIcon, iconSize: closeIconSize, imageSrc: closeIconSrc, shape: closeIconShape, SvgImage: closeIcon, onClick: onClickClose }) })), (title || desc) && (jsxRuntime.jsxs("div", { className: "drawer__header", children: [jsxRuntime.jsx(Icon.Title, { className: "drawer__header-title", size: titleTextSize, textColor: titleTextColor, textWeight: titleTextWeight, children: title }), jsxRuntime.jsx(Text.Text, { className: "drawer__header-desc", size: descTextSize, textColor: descTextColor, children: desc })] })), divider && (jsxRuntime.jsx(Divider.Divider, { width: "fill", size: dividerSize, fill: "surfaceTertiary" })), children && jsxRuntime.jsx("div", { className: "drawer__wrapper", children: children }), after && jsxRuntime.jsx("div", { className: "drawer__after", children: after })] }));
|
|
102
147
|
}
|
|
103
148
|
|
|
104
149
|
exports.Drawer = Drawer;
|
|
@@ -37,8 +37,10 @@ const notificationAppearanceDefault = {
|
|
|
37
37
|
descTextColor: 'surfaceTextPrimary',
|
|
38
38
|
borderColor: 'surfaceBorderPrimary',
|
|
39
39
|
textColor: 'surfaceTextPrimary',
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
buttonAppearance: 'accentPrimary sizeXXL solid rounded',
|
|
41
|
+
loaderAppearance: 'accentTertiary sizeS ghost rounded',
|
|
42
|
+
closeIcon: _default.icons24.Action.Close,
|
|
43
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
42
44
|
},
|
|
43
45
|
};
|
|
44
46
|
|
|
@@ -51,8 +53,9 @@ const notificationAppearanceError = {
|
|
|
51
53
|
borderColor: 'errorBorderPrimary',
|
|
52
54
|
textColor: 'errorTextPrimary',
|
|
53
55
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
57
|
+
closeIcon: _default.icons24.Action.Close,
|
|
58
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
56
59
|
},
|
|
57
60
|
};
|
|
58
61
|
|
|
@@ -65,8 +68,9 @@ const notificationAppearanceInfo = {
|
|
|
65
68
|
borderColor: 'infoBorderPrimary',
|
|
66
69
|
textColor: 'infoTextPrimary',
|
|
67
70
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
72
|
+
closeIcon: _default.icons24.Action.Close,
|
|
73
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
70
74
|
},
|
|
71
75
|
};
|
|
72
76
|
|
|
@@ -102,6 +106,7 @@ const notificationAppearanceSize = {
|
|
|
102
106
|
descTextSize: 'm',
|
|
103
107
|
iconSize: 24,
|
|
104
108
|
loaderAppearanceSize: 'sizeS',
|
|
109
|
+
closeIconAppearanceSize: 'size_24_24',
|
|
105
110
|
},
|
|
106
111
|
sizeS: {
|
|
107
112
|
size: 'm',
|
|
@@ -109,6 +114,7 @@ const notificationAppearanceSize = {
|
|
|
109
114
|
descTextSize: 'm',
|
|
110
115
|
iconSize: 24,
|
|
111
116
|
loaderAppearanceSize: 'sizeS',
|
|
117
|
+
closeIconAppearanceSize: 'size_24_24',
|
|
112
118
|
},
|
|
113
119
|
};
|
|
114
120
|
|
|
@@ -135,8 +141,9 @@ const notificationAppearanceSuccess = {
|
|
|
135
141
|
borderColor: 'successBorderPrimary',
|
|
136
142
|
textColor: 'successTextPrimary',
|
|
137
143
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
138
|
-
|
|
139
|
-
|
|
144
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
145
|
+
closeIcon: _default.icons24.Action.Close,
|
|
146
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
140
147
|
},
|
|
141
148
|
};
|
|
142
149
|
|
|
@@ -149,9 +156,9 @@ const notificationAppearanceWarning = {
|
|
|
149
156
|
borderColor: 'surfaceBorderPrimary',
|
|
150
157
|
textColor: 'warningTextPrimary',
|
|
151
158
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
152
|
-
|
|
153
|
-
closeIcon: _default.
|
|
154
|
-
closeIconAppearance: '
|
|
159
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
160
|
+
closeIcon: _default.icons24.Action.Close,
|
|
161
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
155
162
|
},
|
|
156
163
|
};
|
|
157
164
|
|
|
@@ -173,13 +180,13 @@ const notificationConfig = {
|
|
|
173
180
|
},
|
|
174
181
|
};
|
|
175
182
|
function Notification(props) {
|
|
176
|
-
const { id, appearance, className, dataTestId, dataTour, title, text, float, global, toast, before, after, isSkeleton, isLoading, onClickButton, onClickClose, } = props;
|
|
183
|
+
const { id, appearance, className, dataTestId, dataTour, type, title, text, float, global, toast, before, after, isSkeleton, isLoading, onClickButton, onClickClose, } = props;
|
|
177
184
|
const appearanceConfig = useAppearanceConfig.useAppearanceConfig(appearance, notificationConfig);
|
|
178
185
|
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
179
|
-
const { fillClass, fillHoverClass, titleTextColor, titleTextSize, descTextColor, descTextSize, buttonAppearance, buttonLabel, elevationClass, loaderAppearance, loaderAppearanceSize, loaderFill, loaderItemFill, loaderSize, loaderType, shapeClass, shapeStrengthClass, sizeClass, widthClass, closeIcon, closeIconAppearance, closeIconSrc, } = propsGenerator;
|
|
186
|
+
const { fillClass, fillHoverClass, titleTextColor, titleTextSize, descTextColor, descTextSize, buttonAppearance, buttonLabel, elevationClass, loaderAppearance, loaderAppearanceSize, loaderFill, loaderItemFill, loaderSize, loaderType = 'hug', shapeClass, shapeStrengthClass, sizeClass, widthClass, closeIcon, closeIconAppearance, closeIconAppearanceSize, closeIconSrc, } = propsGenerator;
|
|
180
187
|
// @ts-expect-error
|
|
181
188
|
const { styles: notificationStyles } = useStyles.useStyles(props);
|
|
182
|
-
return (jsxRuntime.jsxs("div", { className: clsx('notification__item', float && 'notification__item_float', toast && 'notification__item_toast', global && 'notification__item_global', widthClass && `width_${widthClass}`, elevationClass && `elevation_${elevationClass}`, fillClass && `fill_${fillClass}`, sizeClass && `notification__item_size_${sizeClass}`, fillHoverClass && `fill_${fillHoverClass}`, isSkeleton && `notification__item_skeleton`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`), "data-test-id": dataTestId, "data-tour": dataTour, style: notificationStyles, children: [before, jsxRuntime.jsxs("div", { className: clsx(className, 'notification__item-wrapper'), children: [title && (jsxRuntime.jsx(Text.Text, { className: "notification__item-title", size: titleTextSize, textColor: titleTextColor, children: title })), text && (jsxRuntime.jsx(Text.Text, { className: "notification__item-text", size: descTextSize, textColor: descTextColor, children: text })), isLoading && (jsxRuntime.jsx(Loader.Loader, { appearance: `${loaderAppearance} ${loaderAppearanceSize}`, className: clsx(className, 'button__loader'), type: loaderType, size: loaderSize, fill: loaderFill, itemFill: loaderItemFill })), onClickClose && (jsxRuntime.jsx(Icon.Icon, { appearance: closeIconAppearance
|
|
189
|
+
return (jsxRuntime.jsxs("div", { className: clsx('notification__item', float && 'notification__item_float', toast && 'notification__item_toast', global && 'notification__item_global', widthClass && `width_${widthClass}`, elevationClass && `elevation_${elevationClass}`, fillClass && `fill_${fillClass}`, sizeClass && `notification__item_size_${sizeClass}`, type && `notification__item_type_${type}`, fillHoverClass && `fill_${fillHoverClass}`, isSkeleton && `notification__item_skeleton`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`), "data-test-id": dataTestId, "data-tour": dataTour, style: notificationStyles, children: [before, jsxRuntime.jsxs("div", { className: clsx(className, 'notification__item-wrapper'), children: [title && (jsxRuntime.jsx(Text.Text, { className: "notification__item-title", size: titleTextSize, textColor: titleTextColor, children: title })), text && (jsxRuntime.jsx(Text.Text, { className: "notification__item-text", size: descTextSize, textColor: descTextColor, children: text })), isLoading && (jsxRuntime.jsx(Loader.Loader, { appearance: `${loaderAppearance} ${loaderAppearanceSize}`, className: clsx(className, 'button__loader'), type: loaderType, size: loaderSize, fill: loaderFill, itemFill: loaderItemFill })), onClickClose && (jsxRuntime.jsx(Icon.Icon, { appearance: `${closeIconAppearance} ${closeIconAppearanceSize}`, className: clsx('notification__item-close', 'cursor_type_pointer'), imageSrc: closeIconSrc, SvgImage: closeIcon, onClick: () => onClickClose && onClickClose(id) })), (onClickButton || buttonLabel) && (jsxRuntime.jsx(Button.Button, { appearance: buttonAppearance, className: "notification__item-button", width: "fill", label: buttonLabel, onClick: onClickButton }))] }), after] }));
|
|
183
190
|
}
|
|
184
191
|
|
|
185
192
|
function NotificationWrapper(props) {
|
|
@@ -257,7 +257,6 @@ function Pagination(props) {
|
|
|
257
257
|
* @deprecated The method should not be used
|
|
258
258
|
*/
|
|
259
259
|
onPerPageCountChange, } = props;
|
|
260
|
-
const minPageCount = Math.min(...pageCountList);
|
|
261
260
|
const _onChangePage = React.useMemo(() => {
|
|
262
261
|
if (onPageChange) {
|
|
263
262
|
console.warn('@itcase/ui Pagination warning: "onPageChange" is deprecated, use "onChangePage" instead.');
|
|
@@ -310,7 +309,10 @@ function Pagination(props) {
|
|
|
310
309
|
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
311
310
|
const { justifyContentClass, fillActiveClass, fillActiveHoverClass, fillClass, fillHoverClass, fillInputClass, fillInputHoverClass, fillInputShapeClass, fillInputShapeStrengthClass, textColorActiveClass, textColorActiveHoverClass, textColorClass, textColorHoverClass, textSizeClass, builderIcon, builderIconFill, builderIconFillIcon, builderIconFillSize, builderIconSize, marginPagesDisplayed, nextIcon, nextIconFill, nextIconFillIcon, nextIconFillSize, nextIconSize, pageCountDescTextColor, pageCountDescTextSize, pageCountDropdownAlignment, pageCountDropdownElevation, pageCountDropdownFill, pageCountDropdownFillHover, pageCountDropdownItemDividerFill, pageCountDropdownItemDividerSize, pageCountDropdownItemFill, pageCountDropdownItemFillActive, pageCountDropdownItemFillActiveHover, pageCountDropdownItemFillHover, pageCountDropdownItemLabelAlign, pageCountDropdownItemLabelColor, pageCountDropdownItemLabelColorActive, pageCountDropdownItemLabelColorActiveHover, pageCountDropdownItemLabelColorHover, pageCountDropdownItemLabelSize, pageCountDropdownItemLabelWrap, pageCountDropdownItemShowDivider, pageCountDropdownItemSize, pageCountDropdownItemWidth, pageCountDropdownShape, pageCountDropdownShapeStrength, pageCountInputIcon, pageCountInputIconColor, pageCountInputIconFillSize, pageCountInputIconSrc, pageCountInputTextColor, pageCountInputTextSize, pageRangeDisplayed, previousIcon, previousIconFill, previousIconFillIcon, previousIconFillSize, previousIconSize, sizeClass, } = propsGenerator;
|
|
312
311
|
const { styles: paginationStyles } = useStyles.useStyles(props);
|
|
313
|
-
|
|
312
|
+
const minPageSize = Math.min(perPageCount, ...pageCountList);
|
|
313
|
+
// If there are fewer items than the minimum page size - pagination wont work.
|
|
314
|
+
const isPaginationDisplayed = allItemsCount > minPageSize;
|
|
315
|
+
return (isPaginationDisplayed && (jsxRuntime.jsxs("div", { className: clsx('pagination', sizeClass && `pagination_size_${sizeClass}`, isSkeleton && `pagination_skeleton`), "data-test-id": dataTestId, "data-tour": dataTour, style: paginationStyles, children: [jsxRuntime.jsx(ReactPaginate, { activeClassName: clsx('pagination__item_state_active cursor_type_default', fillActiveClass && `fill fill_active_${fillActiveClass}`, fillActiveHoverClass &&
|
|
314
316
|
`fill fill_active_hover_${fillActiveHoverClass}`), activeLinkClassName: clsx('pagination__item-link_state_active', textColorActiveClass &&
|
|
315
317
|
`text text-color_active_${textColorActiveClass}`, textColorActiveHoverClass &&
|
|
316
318
|
`text text-color_active_hover_${textColorActiveHoverClass}`), breakClassName: "pagination__item pagination__item_break", breakLabel: "...", breakLinkClassName: "pagination__item-link", containerClassName: clsx(className, 'pagination__container', justifyContentClass &&
|
|
@@ -156,16 +156,16 @@ function createNotification(notification, onClose) {
|
|
|
156
156
|
}
|
|
157
157
|
switch (status) {
|
|
158
158
|
case 'success':
|
|
159
|
-
appearance = 'successPrimary';
|
|
159
|
+
appearance = 'successPrimary sizeM solid';
|
|
160
160
|
break;
|
|
161
161
|
case 'info':
|
|
162
|
-
appearance = 'infoPrimary';
|
|
162
|
+
appearance = 'infoPrimary sizeM solid';
|
|
163
163
|
break;
|
|
164
164
|
case 'error':
|
|
165
|
-
appearance = 'errorPrimary';
|
|
165
|
+
appearance = 'errorPrimary sizeM solid';
|
|
166
166
|
break;
|
|
167
167
|
case 'warning':
|
|
168
|
-
appearance = 'warningPrimary';
|
|
168
|
+
appearance = 'warningPrimary sizeM solid';
|
|
169
169
|
break;
|
|
170
170
|
}
|
|
171
171
|
return {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
+
import { DateTime } from 'luxon';
|
|
4
5
|
import { DATE_PERIOD_INTERVALS } from '@itcase/common';
|
|
5
|
-
import { D as DatePickerInput } from '../
|
|
6
|
+
import { D as DatePickerInput } from '../DatePicker_es_CqKPt0Nw.js';
|
|
6
7
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
7
8
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
8
9
|
import { b as ChipsGroup, C as Chips } from '../ChipsGroup_es_UTiUhYs7.js';
|
|
@@ -117,8 +118,16 @@ function DatePeriod(props) {
|
|
|
117
118
|
const checkIsChipsActive = useCallback((targetPeriodItem) => {
|
|
118
119
|
const dateStartIso = targetPeriodItem.dateIntervalsList[0];
|
|
119
120
|
const dateEndIso = targetPeriodItem.dateIntervalsList[1];
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
let normalizedDatePeriodValueStart = null;
|
|
122
|
+
let normalizedDatePeriodValueEnd = null;
|
|
123
|
+
if (datePeriodValueStart) {
|
|
124
|
+
normalizedDatePeriodValueStart = DateTime.fromJSDate(new Date(datePeriodValueStart)).toISODate();
|
|
125
|
+
}
|
|
126
|
+
if (datePeriodValueEnd) {
|
|
127
|
+
normalizedDatePeriodValueEnd = DateTime.fromJSDate(new Date(datePeriodValueEnd)).toISODate();
|
|
128
|
+
}
|
|
129
|
+
return (dateStartIso === normalizedDatePeriodValueStart &&
|
|
130
|
+
dateEndIso === normalizedDatePeriodValueEnd);
|
|
122
131
|
}, [datePeriodValueEnd, datePeriodValueStart]);
|
|
123
132
|
// const onChangeDatePicker = useCallback(
|
|
124
133
|
// (dateStart: Date | null, dateEnd: Date | null) => {
|
|
@@ -149,9 +158,7 @@ function DatePeriod(props) {
|
|
|
149
158
|
fillHover: datePickerInputFillHover,
|
|
150
159
|
textSize: datePickerInputTextSize,
|
|
151
160
|
placeholder: 'Выбрать период',
|
|
152
|
-
}, value: datePeriodValueStart,
|
|
153
|
-
// onChange={onChangeDatePicker}
|
|
154
|
-
onChange: onChangeDatePeriod })] }) }));
|
|
161
|
+
}, value: datePeriodValueStart, onChange: onChangeDatePeriod })] }) }));
|
|
155
162
|
}
|
|
156
163
|
|
|
157
164
|
export { DatePeriod, datePeriodAppearance, datePeriodConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DatePickerInput, a as datePickerAppearance, d as datePickerConfig } from '../
|
|
1
|
+
export { D as DatePickerInput, a as datePickerAppearance, d as datePickerConfig } from '../DatePicker_es_CqKPt0Nw.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'clsx';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef, useEffect } from 'react';
|
|
2
|
+
import { useRef, useState, useEffect } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import ReactDrawer from 'react-modern-drawer';
|
|
5
5
|
import { D as Divider } from '../Divider_es_BiYozVBS.js';
|
|
@@ -69,6 +69,24 @@ const drawerAppearance = {
|
|
|
69
69
|
...drawerAppearanceSurface,
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
+
// https://github.com/Farzin-Firoozi/react-modern-drawer
|
|
73
|
+
const ANIMATION_DURATION = 300; // default value is 300
|
|
74
|
+
const ANIMATION_STATE_SNAPSHOTS = {
|
|
75
|
+
DEFAULT: {
|
|
76
|
+
isInDOM: true,
|
|
77
|
+
// start from 'false' to trigger 'enter' animation
|
|
78
|
+
isOpen: false,
|
|
79
|
+
},
|
|
80
|
+
ENTER_FINISH: {
|
|
81
|
+
isInDOM: true,
|
|
82
|
+
isOpen: true,
|
|
83
|
+
},
|
|
84
|
+
EXIT_FINISH: {
|
|
85
|
+
isInDOM: false,
|
|
86
|
+
isOpen: false,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
72
90
|
const drawerConfig = {
|
|
73
91
|
appearance: drawerAppearance,
|
|
74
92
|
setAppearance: (appearanceConfig) => {
|
|
@@ -76,12 +94,16 @@ const drawerConfig = {
|
|
|
76
94
|
},
|
|
77
95
|
};
|
|
78
96
|
function Drawer(props) {
|
|
79
|
-
const {
|
|
97
|
+
const { appearance, className, dataTestId, dataTour, type, title, desc, enableOverlay, lockBackgroundScroll = true, stickyButton, before, after, close, isOpen, isOpenModal, onClickClose, onClose, children, } = props;
|
|
80
98
|
const _isOpen = isOpen ?? isOpenModal;
|
|
81
99
|
const isOpenPrevRef = useRef(Boolean(_isOpen));
|
|
100
|
+
const isFirstRenderRef = useRef(true);
|
|
82
101
|
const appearanceConfig = useAppearanceConfig(appearance, drawerConfig);
|
|
83
102
|
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
84
103
|
const { direction, size, titleTextColor, titleTextSize, titleTextWeight, descTextColor, descTextSize, divider, dividerSize, zeroPadding, closeIcon, closeIconFill, closeIconFillIcon, closeIconFillSize, closeIconShape, closeIconSize, closeIconSrc, } = propsGenerator;
|
|
104
|
+
const [animationState, setAnimationState] = useState(_isOpen
|
|
105
|
+
? ANIMATION_STATE_SNAPSHOTS.ENTER_FINISH
|
|
106
|
+
: ANIMATION_STATE_SNAPSHOTS.EXIT_FINISH);
|
|
85
107
|
useEffect(() => {
|
|
86
108
|
const isFromOpenToClose = isOpenPrevRef.current === true && !_isOpen;
|
|
87
109
|
if (isFromOpenToClose && onClose) {
|
|
@@ -93,10 +115,33 @@ function Drawer(props) {
|
|
|
93
115
|
if (isNeedShowWarning) {
|
|
94
116
|
console.warn('@itcase/ui Drawer warning: "isOpenModal" is deprecated, use "isOpen" instead.');
|
|
95
117
|
}
|
|
118
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
119
|
}, [_isOpen, onClose]);
|
|
120
|
+
// manage 'enter' and 'exit' animations
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (isFirstRenderRef.current) {
|
|
123
|
+
isFirstRenderRef.current = false;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
setAnimationState(ANIMATION_STATE_SNAPSHOTS.DEFAULT);
|
|
127
|
+
// 16ms delay to prevent react from batching updates
|
|
128
|
+
const startTransitionDelay = 16;
|
|
129
|
+
const timeoutDelay = _isOpen ? startTransitionDelay : ANIMATION_DURATION;
|
|
130
|
+
const timeout = setTimeout(() => {
|
|
131
|
+
setAnimationState(_isOpen
|
|
132
|
+
? ANIMATION_STATE_SNAPSHOTS.ENTER_FINISH
|
|
133
|
+
: ANIMATION_STATE_SNAPSHOTS.EXIT_FINISH);
|
|
134
|
+
}, timeoutDelay);
|
|
135
|
+
return () => {
|
|
136
|
+
clearTimeout(timeout);
|
|
137
|
+
};
|
|
138
|
+
}, [_isOpen]);
|
|
139
|
+
if (!animationState.isInDOM) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
97
142
|
return (jsxs(ReactDrawer, { className: clsx('drawer', type && `drawer_type_${type}`, className, dataTour && `dataTour-${dataTour}`, stickyButton && 'drawer_sticky-button', zeroPadding && 'drawer_reset-padding'), dataTour: dataTour, direction: direction || 'right', size: size || 600,
|
|
98
143
|
// Drawer set prefix "EZDrawer" for any id
|
|
99
|
-
customIdSuffix: dataTestId ? `_${dataTestId}` : undefined, enableOverlay: enableOverlay, lockBackgroundScroll:
|
|
144
|
+
customIdSuffix: dataTestId ? `_${dataTestId}` : undefined, duration: ANIMATION_DURATION, enableOverlay: enableOverlay, lockBackgroundScroll: lockBackgroundScroll, overlayClassName: "drawer__overlay", open: animationState.isOpen, onClose: onClickClose, children: [before && jsx("div", { className: "drawer__before", children: before }), !close && (closeIcon || closeIconSrc) && (jsx("div", { className: "drawer__close", children: jsx(Icon, { className: "cursor_type_pointer", fill: closeIconFill, fillSize: closeIconFillSize, iconFill: closeIconFillIcon, iconSize: closeIconSize, imageSrc: closeIconSrc, shape: closeIconShape, SvgImage: closeIcon, onClick: onClickClose }) })), (title || desc) && (jsxs("div", { className: "drawer__header", children: [jsx(Title, { className: "drawer__header-title", size: titleTextSize, textColor: titleTextColor, textWeight: titleTextWeight, children: title }), jsx(Text, { className: "drawer__header-desc", size: descTextSize, textColor: descTextColor, children: desc })] })), divider && (jsx(Divider, { width: "fill", size: dividerSize, fill: "surfaceTertiary" })), children && jsx("div", { className: "drawer__wrapper", children: children }), after && jsx("div", { className: "drawer__after", children: after })] }));
|
|
100
145
|
}
|
|
101
146
|
|
|
102
147
|
export { Drawer, drawerAppearance, drawerConfig };
|
|
@@ -7,7 +7,7 @@ import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
|
7
7
|
import { B as Button } from '../Button_es_qNbDsXQg.js';
|
|
8
8
|
import { I as Icon } from '../Icon_es_5JUPM7bP.js';
|
|
9
9
|
import { T as Text } from '../Text_es_RDU9GLCV.js';
|
|
10
|
-
import {
|
|
10
|
+
import { icons24 } from '@itcase/icons/default';
|
|
11
11
|
import { useNotifications, useNotificationsAPI } from '../context/Notifications.js';
|
|
12
12
|
import '../context/UIContext.js';
|
|
13
13
|
import 'react';
|
|
@@ -35,8 +35,10 @@ const notificationAppearanceDefault = {
|
|
|
35
35
|
descTextColor: 'surfaceTextPrimary',
|
|
36
36
|
borderColor: 'surfaceBorderPrimary',
|
|
37
37
|
textColor: 'surfaceTextPrimary',
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
buttonAppearance: 'accentPrimary sizeXXL solid rounded',
|
|
39
|
+
loaderAppearance: 'accentTertiary sizeS ghost rounded',
|
|
40
|
+
closeIcon: icons24.Action.Close,
|
|
41
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
40
42
|
},
|
|
41
43
|
};
|
|
42
44
|
|
|
@@ -49,8 +51,9 @@ const notificationAppearanceError = {
|
|
|
49
51
|
borderColor: 'errorBorderPrimary',
|
|
50
52
|
textColor: 'errorTextPrimary',
|
|
51
53
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
55
|
+
closeIcon: icons24.Action.Close,
|
|
56
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
54
57
|
},
|
|
55
58
|
};
|
|
56
59
|
|
|
@@ -63,8 +66,9 @@ const notificationAppearanceInfo = {
|
|
|
63
66
|
borderColor: 'infoBorderPrimary',
|
|
64
67
|
textColor: 'infoTextPrimary',
|
|
65
68
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
70
|
+
closeIcon: icons24.Action.Close,
|
|
71
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
68
72
|
},
|
|
69
73
|
};
|
|
70
74
|
|
|
@@ -100,6 +104,7 @@ const notificationAppearanceSize = {
|
|
|
100
104
|
descTextSize: 'm',
|
|
101
105
|
iconSize: 24,
|
|
102
106
|
loaderAppearanceSize: 'sizeS',
|
|
107
|
+
closeIconAppearanceSize: 'size_24_24',
|
|
103
108
|
},
|
|
104
109
|
sizeS: {
|
|
105
110
|
size: 'm',
|
|
@@ -107,6 +112,7 @@ const notificationAppearanceSize = {
|
|
|
107
112
|
descTextSize: 'm',
|
|
108
113
|
iconSize: 24,
|
|
109
114
|
loaderAppearanceSize: 'sizeS',
|
|
115
|
+
closeIconAppearanceSize: 'size_24_24',
|
|
110
116
|
},
|
|
111
117
|
};
|
|
112
118
|
|
|
@@ -133,8 +139,9 @@ const notificationAppearanceSuccess = {
|
|
|
133
139
|
borderColor: 'successBorderPrimary',
|
|
134
140
|
textColor: 'successTextPrimary',
|
|
135
141
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
143
|
+
closeIcon: icons24.Action.Close,
|
|
144
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
138
145
|
},
|
|
139
146
|
};
|
|
140
147
|
|
|
@@ -147,9 +154,9 @@ const notificationAppearanceWarning = {
|
|
|
147
154
|
borderColor: 'surfaceBorderPrimary',
|
|
148
155
|
textColor: 'warningTextPrimary',
|
|
149
156
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
150
|
-
|
|
151
|
-
closeIcon:
|
|
152
|
-
closeIconAppearance: '
|
|
157
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
158
|
+
closeIcon: icons24.Action.Close,
|
|
159
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
153
160
|
},
|
|
154
161
|
};
|
|
155
162
|
|
|
@@ -171,13 +178,13 @@ const notificationConfig = {
|
|
|
171
178
|
},
|
|
172
179
|
};
|
|
173
180
|
function Notification(props) {
|
|
174
|
-
const { id, appearance, className, dataTestId, dataTour, title, text, float, global, toast, before, after, isSkeleton, isLoading, onClickButton, onClickClose, } = props;
|
|
181
|
+
const { id, appearance, className, dataTestId, dataTour, type, title, text, float, global, toast, before, after, isSkeleton, isLoading, onClickButton, onClickClose, } = props;
|
|
175
182
|
const appearanceConfig = useAppearanceConfig(appearance, notificationConfig);
|
|
176
183
|
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
177
|
-
const { fillClass, fillHoverClass, titleTextColor, titleTextSize, descTextColor, descTextSize, buttonAppearance, buttonLabel, elevationClass, loaderAppearance, loaderAppearanceSize, loaderFill, loaderItemFill, loaderSize, loaderType, shapeClass, shapeStrengthClass, sizeClass, widthClass, closeIcon, closeIconAppearance, closeIconSrc, } = propsGenerator;
|
|
184
|
+
const { fillClass, fillHoverClass, titleTextColor, titleTextSize, descTextColor, descTextSize, buttonAppearance, buttonLabel, elevationClass, loaderAppearance, loaderAppearanceSize, loaderFill, loaderItemFill, loaderSize, loaderType = 'hug', shapeClass, shapeStrengthClass, sizeClass, widthClass, closeIcon, closeIconAppearance, closeIconAppearanceSize, closeIconSrc, } = propsGenerator;
|
|
178
185
|
// @ts-expect-error
|
|
179
186
|
const { styles: notificationStyles } = useStyles(props);
|
|
180
|
-
return (jsxs("div", { className: clsx('notification__item', float && 'notification__item_float', toast && 'notification__item_toast', global && 'notification__item_global', widthClass && `width_${widthClass}`, elevationClass && `elevation_${elevationClass}`, fillClass && `fill_${fillClass}`, sizeClass && `notification__item_size_${sizeClass}`, fillHoverClass && `fill_${fillHoverClass}`, isSkeleton && `notification__item_skeleton`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`), "data-test-id": dataTestId, "data-tour": dataTour, style: notificationStyles, children: [before, jsxs("div", { className: clsx(className, 'notification__item-wrapper'), children: [title && (jsx(Text, { className: "notification__item-title", size: titleTextSize, textColor: titleTextColor, children: title })), text && (jsx(Text, { className: "notification__item-text", size: descTextSize, textColor: descTextColor, children: text })), isLoading && (jsx(Loader, { appearance: `${loaderAppearance} ${loaderAppearanceSize}`, className: clsx(className, 'button__loader'), type: loaderType, size: loaderSize, fill: loaderFill, itemFill: loaderItemFill })), onClickClose && (jsx(Icon, { appearance: closeIconAppearance
|
|
187
|
+
return (jsxs("div", { className: clsx('notification__item', float && 'notification__item_float', toast && 'notification__item_toast', global && 'notification__item_global', widthClass && `width_${widthClass}`, elevationClass && `elevation_${elevationClass}`, fillClass && `fill_${fillClass}`, sizeClass && `notification__item_size_${sizeClass}`, type && `notification__item_type_${type}`, fillHoverClass && `fill_${fillHoverClass}`, isSkeleton && `notification__item_skeleton`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`), "data-test-id": dataTestId, "data-tour": dataTour, style: notificationStyles, children: [before, jsxs("div", { className: clsx(className, 'notification__item-wrapper'), children: [title && (jsx(Text, { className: "notification__item-title", size: titleTextSize, textColor: titleTextColor, children: title })), text && (jsx(Text, { className: "notification__item-text", size: descTextSize, textColor: descTextColor, children: text })), isLoading && (jsx(Loader, { appearance: `${loaderAppearance} ${loaderAppearanceSize}`, className: clsx(className, 'button__loader'), type: loaderType, size: loaderSize, fill: loaderFill, itemFill: loaderItemFill })), onClickClose && (jsx(Icon, { appearance: `${closeIconAppearance} ${closeIconAppearanceSize}`, className: clsx('notification__item-close', 'cursor_type_pointer'), imageSrc: closeIconSrc, SvgImage: closeIcon, onClick: () => onClickClose && onClickClose(id) })), (onClickButton || buttonLabel) && (jsx(Button, { appearance: buttonAppearance, className: "notification__item-button", width: "fill", label: buttonLabel, onClick: onClickButton }))] }), after] }));
|
|
181
188
|
}
|
|
182
189
|
|
|
183
190
|
function NotificationWrapper(props) {
|
|
@@ -255,7 +255,6 @@ function Pagination(props) {
|
|
|
255
255
|
* @deprecated The method should not be used
|
|
256
256
|
*/
|
|
257
257
|
onPerPageCountChange, } = props;
|
|
258
|
-
const minPageCount = Math.min(...pageCountList);
|
|
259
258
|
const _onChangePage = useMemo(() => {
|
|
260
259
|
if (onPageChange) {
|
|
261
260
|
console.warn('@itcase/ui Pagination warning: "onPageChange" is deprecated, use "onChangePage" instead.');
|
|
@@ -308,7 +307,10 @@ function Pagination(props) {
|
|
|
308
307
|
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
309
308
|
const { justifyContentClass, fillActiveClass, fillActiveHoverClass, fillClass, fillHoverClass, fillInputClass, fillInputHoverClass, fillInputShapeClass, fillInputShapeStrengthClass, textColorActiveClass, textColorActiveHoverClass, textColorClass, textColorHoverClass, textSizeClass, builderIcon, builderIconFill, builderIconFillIcon, builderIconFillSize, builderIconSize, marginPagesDisplayed, nextIcon, nextIconFill, nextIconFillIcon, nextIconFillSize, nextIconSize, pageCountDescTextColor, pageCountDescTextSize, pageCountDropdownAlignment, pageCountDropdownElevation, pageCountDropdownFill, pageCountDropdownFillHover, pageCountDropdownItemDividerFill, pageCountDropdownItemDividerSize, pageCountDropdownItemFill, pageCountDropdownItemFillActive, pageCountDropdownItemFillActiveHover, pageCountDropdownItemFillHover, pageCountDropdownItemLabelAlign, pageCountDropdownItemLabelColor, pageCountDropdownItemLabelColorActive, pageCountDropdownItemLabelColorActiveHover, pageCountDropdownItemLabelColorHover, pageCountDropdownItemLabelSize, pageCountDropdownItemLabelWrap, pageCountDropdownItemShowDivider, pageCountDropdownItemSize, pageCountDropdownItemWidth, pageCountDropdownShape, pageCountDropdownShapeStrength, pageCountInputIcon, pageCountInputIconColor, pageCountInputIconFillSize, pageCountInputIconSrc, pageCountInputTextColor, pageCountInputTextSize, pageRangeDisplayed, previousIcon, previousIconFill, previousIconFillIcon, previousIconFillSize, previousIconSize, sizeClass, } = propsGenerator;
|
|
310
309
|
const { styles: paginationStyles } = useStyles(props);
|
|
311
|
-
|
|
310
|
+
const minPageSize = Math.min(perPageCount, ...pageCountList);
|
|
311
|
+
// If there are fewer items than the minimum page size - pagination wont work.
|
|
312
|
+
const isPaginationDisplayed = allItemsCount > minPageSize;
|
|
313
|
+
return (isPaginationDisplayed && (jsxs("div", { className: clsx('pagination', sizeClass && `pagination_size_${sizeClass}`, isSkeleton && `pagination_skeleton`), "data-test-id": dataTestId, "data-tour": dataTour, style: paginationStyles, children: [jsx(ReactPaginate, { activeClassName: clsx('pagination__item_state_active cursor_type_default', fillActiveClass && `fill fill_active_${fillActiveClass}`, fillActiveHoverClass &&
|
|
312
314
|
`fill fill_active_hover_${fillActiveHoverClass}`), activeLinkClassName: clsx('pagination__item-link_state_active', textColorActiveClass &&
|
|
313
315
|
`text text-color_active_${textColorActiveClass}`, textColorActiveHoverClass &&
|
|
314
316
|
`text text-color_active_hover_${textColorActiveHoverClass}`), breakClassName: "pagination__item pagination__item_break", breakLabel: "...", breakLinkClassName: "pagination__item-link", containerClassName: clsx(className, 'pagination__container', justifyContentClass &&
|
|
@@ -154,16 +154,16 @@ function createNotification(notification, onClose) {
|
|
|
154
154
|
}
|
|
155
155
|
switch (status) {
|
|
156
156
|
case 'success':
|
|
157
|
-
appearance = 'successPrimary';
|
|
157
|
+
appearance = 'successPrimary sizeM solid';
|
|
158
158
|
break;
|
|
159
159
|
case 'info':
|
|
160
|
-
appearance = 'infoPrimary';
|
|
160
|
+
appearance = 'infoPrimary sizeM solid';
|
|
161
161
|
break;
|
|
162
162
|
case 'error':
|
|
163
|
-
appearance = 'errorPrimary';
|
|
163
|
+
appearance = 'errorPrimary sizeM solid';
|
|
164
164
|
break;
|
|
165
165
|
case 'warning':
|
|
166
|
-
appearance = 'warningPrimary';
|
|
166
|
+
appearance = 'warningPrimary sizeM solid';
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
return {
|
|
@@ -72,6 +72,42 @@
|
|
|
72
72
|
transform: scale(1);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
.loader {
|
|
76
|
+
&_type {
|
|
77
|
+
&_hug {
|
|
78
|
+
^^&__inner {
|
|
79
|
+
width: auto;
|
|
80
|
+
height: auto;
|
|
81
|
+
position: absolute;
|
|
82
|
+
display: flex;
|
|
83
|
+
left: 12px;
|
|
84
|
+
top: 50%;
|
|
85
|
+
transform: translate(0%, -50%);
|
|
86
|
+
}
|
|
87
|
+
^^&__item {
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
display: inline-block;
|
|
90
|
+
animation: loaderHug 1.4s infinite ease-in-out both;
|
|
91
|
+
&:first-child {
|
|
92
|
+
animation-delay: -0.32s;
|
|
93
|
+
}
|
|
94
|
+
&:nth-child(2) {
|
|
95
|
+
animation-delay: -0.16s;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
@keyframes loaderHug {
|
|
102
|
+
0%,
|
|
103
|
+
80%,
|
|
104
|
+
100% {
|
|
105
|
+
transform: scale(0);
|
|
106
|
+
}
|
|
107
|
+
40% {
|
|
108
|
+
transform: scale(1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
75
111
|
.loader {
|
|
76
112
|
@each $size in xxl, xl, l, m, s, xs, xxs {
|
|
77
113
|
&_size_$(size) {
|
|
@@ -33,33 +33,6 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
.notification__item {
|
|
37
|
-
&&_float {
|
|
38
|
-
^&-wrapper {
|
|
39
|
-
padding: 12px;
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
.notification__item {
|
|
46
|
-
&&_toast {
|
|
47
|
-
width: 100%;
|
|
48
|
-
^&-wrapper {
|
|
49
|
-
display: flex;
|
|
50
|
-
flex-direction: column;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
.notification__item {
|
|
55
|
-
&&_global {
|
|
56
|
-
width: 100%;
|
|
57
|
-
^&-wrapper {
|
|
58
|
-
display: flex;
|
|
59
|
-
flex-direction: column;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
36
|
.notification__item {
|
|
64
37
|
width: 340px;
|
|
65
38
|
&-wrapper {
|
|
@@ -75,8 +48,18 @@
|
|
|
75
48
|
}
|
|
76
49
|
^&-close {
|
|
77
50
|
position: absolute;
|
|
78
|
-
top:
|
|
79
|
-
right:
|
|
51
|
+
top: 0;
|
|
52
|
+
right: 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
.notification__item {
|
|
57
|
+
@each $size in xxl, xl, l, m, s, xs, xxs {
|
|
58
|
+
&_size_$(size) {
|
|
59
|
+
padding: var(--notification-item-$(size)-padding);
|
|
60
|
+
^&-wrapper {
|
|
61
|
+
gap: var(--notification-item-$(size)-gap);
|
|
62
|
+
}
|
|
80
63
|
}
|
|
81
64
|
}
|
|
82
65
|
}
|
|
@@ -104,6 +87,29 @@
|
|
|
104
87
|
background-position: -200%;
|
|
105
88
|
}
|
|
106
89
|
}
|
|
90
|
+
.notification__item {
|
|
91
|
+
&&_type {
|
|
92
|
+
&_float {
|
|
93
|
+
^^&-wrapper {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
&_toast {
|
|
99
|
+
^^&-wrapper {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
&_global {
|
|
105
|
+
width: 100%;
|
|
106
|
+
^^&-wrapper {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
107
113
|
:root {
|
|
108
114
|
--notification-item-set-float-border-radius: 10px;
|
|
109
115
|
--notification-item-set-float-padding: 20px;
|
|
@@ -118,4 +124,6 @@
|
|
|
118
124
|
|
|
119
125
|
--notification-item-m-padding: 12px;
|
|
120
126
|
--notification-item-s-padding: 12px;
|
|
127
|
+
--notification-item-m-gap: 8px;
|
|
128
|
+
--notification-item-s-gap: 8px;
|
|
121
129
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
.notification__item {
|
|
2
2
|
@each $size in xxl, xl, l, m, s, xs, xxs {
|
|
3
3
|
&_size_$(size) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
padding: var(--notification-item-$(size)-padding);
|
|
5
|
+
^&-wrapper {
|
|
6
|
+
gap: var(--notification-item-$(size)-gap);
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.notification__item {
|
|
2
|
+
&&_type {
|
|
3
|
+
&_float {
|
|
4
|
+
^^&-wrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
&_toast {
|
|
10
|
+
^^&-wrapper {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
&_global {
|
|
16
|
+
width: 100%;
|
|
17
|
+
^^&-wrapper {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -20,14 +20,14 @@ type DatePeriodProps = DatePeriodThemeColor & StyleAttributes & {
|
|
|
20
20
|
chipsShape?: ShapeProps;
|
|
21
21
|
className?: string;
|
|
22
22
|
datePeriodIntervalsList: DatePeriodItem[];
|
|
23
|
-
datePeriodValueEnd: DateIso | null;
|
|
24
|
-
datePeriodValueStart: DateIso | null;
|
|
23
|
+
datePeriodValueEnd: Date | DateIso | null;
|
|
24
|
+
datePeriodValueStart: Date | DateIso | null;
|
|
25
25
|
datePickerAppearance?: CompositeAppearanceKey;
|
|
26
26
|
datePickerInputAppearance?: CompositeAppearanceKey;
|
|
27
27
|
datePickerInputFillHover?: FillHoverProps;
|
|
28
28
|
datePickerInputSize?: SizeOptionProps;
|
|
29
29
|
datePickerInputTextSize?: TextSizeProps;
|
|
30
30
|
isSkeleton?: boolean;
|
|
31
|
-
onChangeDatePeriod: (
|
|
31
|
+
onChangeDatePeriod: (dateStart: Date | null, dateEnd: Date | null) => void;
|
|
32
32
|
};
|
|
33
|
-
export type {
|
|
33
|
+
export type { DatePeriodAppearanceType, DatePeriodConfig, DatePeriodProps, DatePeriodThemeColor, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { DatePickerProps } from 'react-datepicker';
|
|
3
|
-
import { AppearanceKeysDefault, FillHoverProps, FillProps, IconFillSizeProps, IconSizeProps, ItemColorProps, ShapeProps, SizeProps, TextColorHoverProps, TextColorProps, TextSizeProps, TextWeightProps } from '@itcase/types';
|
|
3
|
+
import { AppearanceKeysDefault, DateIso, FillHoverProps, FillProps, IconFillSizeProps, IconSizeProps, ItemColorProps, ShapeProps, SizeProps, TextColorHoverProps, TextColorProps, TextSizeProps, TextWeightProps } from '@itcase/types';
|
|
4
4
|
import { InputProps } from '../Input/Input.interface';
|
|
5
5
|
interface DatePickerProps extends DatePickerProps {
|
|
6
6
|
customTimeInput?: ReactNode;
|
|
@@ -64,11 +64,11 @@ export interface DatePickerInputProps extends DatePickerProps {
|
|
|
64
64
|
clearLabelTextColorHover?: TextColorHoverProps;
|
|
65
65
|
clearLabelTextSize?: TextSizeProps;
|
|
66
66
|
datePickerProps: DatePickerProps;
|
|
67
|
-
endValue?: string;
|
|
67
|
+
endValue?: string | Date | DateIso;
|
|
68
68
|
inputProps?: InputProps;
|
|
69
69
|
labelTextSize?: TextSizeProps;
|
|
70
|
-
value?: string;
|
|
71
|
-
onChange
|
|
70
|
+
value?: string | Date | DateIso;
|
|
71
|
+
onChange: (dateStart: Date | null, dateEnd: Date | null) => void;
|
|
72
72
|
}
|
|
73
73
|
export interface DatePickerCustomInput {
|
|
74
74
|
clearIcon?: any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const ANIMATION_DURATION = 300;
|
|
2
|
+
declare const ANIMATION_STATE_SNAPSHOTS: {
|
|
3
|
+
DEFAULT: {
|
|
4
|
+
isInDOM: boolean;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
};
|
|
7
|
+
ENTER_FINISH: {
|
|
8
|
+
isInDOM: boolean;
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
};
|
|
11
|
+
EXIT_FINISH: {
|
|
12
|
+
isInDOM: boolean;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export { ANIMATION_DURATION, ANIMATION_STATE_SNAPSHOTS };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DrawerConfig, DrawerProps } from './Drawer.interface';
|
|
2
2
|
declare const drawerConfig: DrawerConfig;
|
|
3
|
-
declare function Drawer(props: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function Drawer(props: DrawerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
export { Drawer, drawerConfig };
|
|
@@ -23,8 +23,9 @@ interface DrawerProps extends DrawerThemeColor, StyleAttributes {
|
|
|
23
23
|
dataTour?: string;
|
|
24
24
|
direction?: 'bottom' | 'left' | 'right' | 'top';
|
|
25
25
|
enableOverlay?: boolean;
|
|
26
|
+
lockBackgroundScroll?: boolean;
|
|
26
27
|
size?: number | string;
|
|
27
28
|
type?: string;
|
|
28
|
-
|
|
29
|
+
isOpen?: boolean;
|
|
29
30
|
}
|
|
30
31
|
export type { DrawerProps };
|
|
@@ -6,8 +6,10 @@ declare const notificationAppearanceDefault: {
|
|
|
6
6
|
descTextColor: string;
|
|
7
7
|
borderColor: string;
|
|
8
8
|
textColor: string;
|
|
9
|
+
buttonAppearance: string;
|
|
10
|
+
loaderAppearance: string;
|
|
9
11
|
closeIcon: string;
|
|
10
|
-
|
|
12
|
+
closeIconAppearance: string;
|
|
11
13
|
};
|
|
12
14
|
};
|
|
13
15
|
export { notificationAppearanceDefault };
|
|
@@ -5,6 +5,7 @@ declare const notificationAppearanceSize: {
|
|
|
5
5
|
descTextSize: string;
|
|
6
6
|
iconSize: number;
|
|
7
7
|
loaderAppearanceSize: string;
|
|
8
|
+
closeIconAppearanceSize: string;
|
|
8
9
|
};
|
|
9
10
|
sizeS: {
|
|
10
11
|
size: string;
|
|
@@ -12,6 +13,7 @@ declare const notificationAppearanceSize: {
|
|
|
12
13
|
descTextSize: string;
|
|
13
14
|
iconSize: number;
|
|
14
15
|
loaderAppearanceSize: string;
|
|
16
|
+
closeIconAppearanceSize: string;
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
export { notificationAppearanceSize };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.149",
|
|
4
4
|
"description": "UI components (Modal, Loader, Popup, etc)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Modal",
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
"@itcase/tokens-palette": "^1.1.20",
|
|
110
110
|
"clsx": "^2.1.1",
|
|
111
111
|
"date-fns": "^4.1.0",
|
|
112
|
-
"framer-motion": "^12.23.
|
|
112
|
+
"framer-motion": "^12.23.23",
|
|
113
113
|
"js-cookie": "^3.0.5",
|
|
114
114
|
"lodash": "^4.17.21",
|
|
115
115
|
"luxon": "^3.7.2",
|
|
116
|
-
"motion": "^12.23.
|
|
116
|
+
"motion": "^12.23.23",
|
|
117
117
|
"rc-slider": "^11.1.9",
|
|
118
118
|
"react": "^18.3.1",
|
|
119
119
|
"react-dadata": "^2.27.4",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"react-dom": "^18.3.1",
|
|
122
122
|
"react-indiana-drag-scroll": "^3.0.3-alpha",
|
|
123
123
|
"react-inlinesvg": "^4.2.0",
|
|
124
|
-
"react-modal-sheet": "5.
|
|
124
|
+
"react-modal-sheet": "5.2.0",
|
|
125
125
|
"react-modern-drawer": "^1.4.0",
|
|
126
126
|
"react-otp-input": "^3.1.1",
|
|
127
127
|
"react-paginate": "^8.3.0",
|