@itcase/ui 1.8.146 → 1.8.148
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/cjs/components/Drawer/stories/__mock__.js +2 -2
- package/dist/cjs/components/Drawer.js +47 -2
- package/dist/cjs/components/Notification.js +64 -29
- package/dist/cjs/components/Pagination.js +4 -2
- package/dist/components/Drawer/stories/__mock__.js +2 -2
- package/dist/components/Drawer.js +48 -3
- package/dist/components/Notification.js +65 -30
- package/dist/components/Pagination.js +4 -2
- package/dist/css/components/Loader/Loader.css +36 -0
- package/dist/css/components/Notification/Notification.css +40 -32
- package/dist/css/components/Notification/css/__item/notification__item.css +2 -2
- package/dist/css/components/Notification/css/__item/notification__item_size.css +10 -0
- 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/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 -4
- package/dist/types/components/Notification/appearance/notificationError.d.ts +1 -2
- package/dist/types/components/Notification/appearance/notificationInfo.d.ts +1 -3
- package/dist/types/components/Notification/appearance/notificationShape.d.ts +3 -0
- package/dist/types/components/Notification/appearance/notificationSize.d.ts +18 -1
- package/dist/types/components/Notification/appearance/notificationSuccess.d.ts +1 -3
- package/dist/types/components/Notification/appearance/notificationWarning.d.ts +1 -3
- package/package.json +2 -2
- package/dist/css/components/Notification/css/__item/notification__item_float.css +0 -10
- package/dist/css/components/Notification/css/__item/notification__item_global.css +0 -10
- package/dist/css/components/Notification/css/__item/notification__item_toast.css +0 -10
|
@@ -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;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
|
+
var Loader = require('../../Loader_cjs_CRiUlTC3.js');
|
|
5
6
|
var useAppearanceConfig = require('../hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
6
7
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
7
8
|
var useStyles = require('../hooks/useStyles/useStyles.js');
|
|
@@ -24,7 +25,6 @@ require('react-responsive');
|
|
|
24
25
|
require('../utils/setViewportProperty.js');
|
|
25
26
|
require('lodash/maxBy');
|
|
26
27
|
require('../../Link_cjs_qKXVfU8e.js');
|
|
27
|
-
require('../../Loader_cjs_CRiUlTC3.js');
|
|
28
28
|
require('react-inlinesvg');
|
|
29
29
|
require('../hoc/urlWithAssetPrefix.js');
|
|
30
30
|
require('../context/UrlAssetPrefix.js');
|
|
@@ -34,14 +34,13 @@ const notificationAppearanceDefault = {
|
|
|
34
34
|
fill: 'surfacePrimary',
|
|
35
35
|
fillHover: 'surfacePrimaryHover',
|
|
36
36
|
titleTextColor: 'surfaceTextPrimary',
|
|
37
|
-
titleTextSize: 'xxl',
|
|
38
37
|
descTextColor: 'surfaceTextPrimary',
|
|
39
|
-
descTextSize: 'm',
|
|
40
38
|
borderColor: 'surfaceBorderPrimary',
|
|
41
39
|
textColor: 'surfaceTextPrimary',
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
buttonAppearance: 'accentPrimary sizeXXL solid rounded',
|
|
41
|
+
loaderAppearance: 'accentTertiary sizeS ghost rounded',
|
|
42
|
+
closeIcon: _default.icons24.Action.Close,
|
|
43
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
45
44
|
},
|
|
46
45
|
};
|
|
47
46
|
|
|
@@ -50,14 +49,13 @@ const notificationAppearanceError = {
|
|
|
50
49
|
fill: 'errorPrimary',
|
|
51
50
|
fillHover: 'errorPrimaryHover',
|
|
52
51
|
titleTextColor: 'errorTextPrimary',
|
|
53
|
-
titleTextSize: 'l',
|
|
54
52
|
descTextColor: 'errorTextPrimary',
|
|
55
|
-
descTextSize: 'm',
|
|
56
53
|
borderColor: 'errorBorderPrimary',
|
|
57
54
|
textColor: 'errorTextPrimary',
|
|
58
55
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
57
|
+
closeIcon: _default.icons24.Action.Close,
|
|
58
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
61
59
|
},
|
|
62
60
|
};
|
|
63
61
|
|
|
@@ -66,19 +64,59 @@ const notificationAppearanceInfo = {
|
|
|
66
64
|
fill: 'infoPrimary',
|
|
67
65
|
fillHover: 'infoPrimaryHover',
|
|
68
66
|
titleTextColor: 'infoTextPrimary',
|
|
69
|
-
titleTextSize: 'l',
|
|
70
67
|
descTextColor: 'infoTextPrimary',
|
|
71
|
-
descTextSize: 'm',
|
|
72
68
|
borderColor: 'infoBorderPrimary',
|
|
73
69
|
textColor: 'infoTextPrimary',
|
|
74
70
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
75
|
-
|
|
76
|
-
closeIcon: _default.
|
|
77
|
-
closeIconAppearance: '
|
|
71
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
72
|
+
closeIcon: _default.icons24.Action.Close,
|
|
73
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const notificationAppearanceShape = {
|
|
78
|
+
circular: {
|
|
79
|
+
shape: 'circular',
|
|
80
|
+
},
|
|
81
|
+
rounded: {
|
|
82
|
+
shape: 'rounded',
|
|
83
|
+
},
|
|
84
|
+
roundedXL: {
|
|
85
|
+
shape: 'rounded',
|
|
86
|
+
shapeStrength: '2m',
|
|
87
|
+
},
|
|
88
|
+
roundedL: {
|
|
89
|
+
shape: 'rounded',
|
|
90
|
+
shapeStrength: '1_5m',
|
|
91
|
+
},
|
|
92
|
+
roundedM: {
|
|
93
|
+
shape: 'rounded',
|
|
94
|
+
shapeStrength: '1m',
|
|
95
|
+
},
|
|
96
|
+
roundedS: {
|
|
97
|
+
shape: 'rounded',
|
|
98
|
+
shapeStrength: '0_5m',
|
|
78
99
|
},
|
|
79
100
|
};
|
|
80
101
|
|
|
81
|
-
const notificationAppearanceSize = {
|
|
102
|
+
const notificationAppearanceSize = {
|
|
103
|
+
sizeM: {
|
|
104
|
+
size: 'm',
|
|
105
|
+
titleTextSize: 'xxl',
|
|
106
|
+
descTextSize: 'm',
|
|
107
|
+
iconSize: 24,
|
|
108
|
+
loaderAppearanceSize: 'sizeS',
|
|
109
|
+
closeIconAppearanceSize: 'size_24_24',
|
|
110
|
+
},
|
|
111
|
+
sizeS: {
|
|
112
|
+
size: 'm',
|
|
113
|
+
titleTextSize: 'xl',
|
|
114
|
+
descTextSize: 'm',
|
|
115
|
+
iconSize: 24,
|
|
116
|
+
loaderAppearanceSize: 'sizeS',
|
|
117
|
+
closeIconAppearanceSize: 'size_24_24',
|
|
118
|
+
},
|
|
119
|
+
};
|
|
82
120
|
|
|
83
121
|
const notificationAppearanceStyle = {
|
|
84
122
|
solid: {
|
|
@@ -99,15 +137,13 @@ const notificationAppearanceSuccess = {
|
|
|
99
137
|
fill: 'successPrimary',
|
|
100
138
|
fillHover: 'successPrimaryHover',
|
|
101
139
|
titleTextColor: 'successTextPrimary',
|
|
102
|
-
titleTextSize: 'l',
|
|
103
140
|
descTextColor: 'successTextPrimary',
|
|
104
|
-
descTextSize: 'm',
|
|
105
141
|
borderColor: 'successBorderPrimary',
|
|
106
142
|
textColor: 'successTextPrimary',
|
|
107
143
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
108
|
-
|
|
109
|
-
closeIcon: _default.
|
|
110
|
-
closeIconAppearance: '
|
|
144
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
145
|
+
closeIcon: _default.icons24.Action.Close,
|
|
146
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
111
147
|
},
|
|
112
148
|
};
|
|
113
149
|
|
|
@@ -116,20 +152,19 @@ const notificationAppearanceWarning = {
|
|
|
116
152
|
fill: 'warningPrimary',
|
|
117
153
|
fillHover: 'warningPrimaryHover',
|
|
118
154
|
titleTextColor: 'warningTextPrimary',
|
|
119
|
-
titleTextSize: 'l',
|
|
120
155
|
descTextColor: 'warningTextPrimary',
|
|
121
|
-
descTextSize: 'm',
|
|
122
156
|
borderColor: 'surfaceBorderPrimary',
|
|
123
157
|
textColor: 'warningTextPrimary',
|
|
124
158
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
125
|
-
|
|
126
|
-
closeIcon: _default.
|
|
127
|
-
closeIconAppearance: '
|
|
159
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
160
|
+
closeIcon: _default.icons24.Action.Close,
|
|
161
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
128
162
|
},
|
|
129
163
|
};
|
|
130
164
|
|
|
131
165
|
const notificationAppearance = {
|
|
132
166
|
...notificationAppearanceDefault,
|
|
167
|
+
...notificationAppearanceShape,
|
|
133
168
|
...notificationAppearanceSize,
|
|
134
169
|
...notificationAppearanceStyle,
|
|
135
170
|
...notificationAppearanceError,
|
|
@@ -145,13 +180,13 @@ const notificationConfig = {
|
|
|
145
180
|
},
|
|
146
181
|
};
|
|
147
182
|
function Notification(props) {
|
|
148
|
-
const { id, appearance, className, dataTestId, dataTour, title, text, float, global, toast, before, after, isSkeleton, onClickButton, onClickClose, } = props;
|
|
183
|
+
const { id, appearance, className, dataTestId, dataTour, type, title, text, float, global, toast, before, after, isSkeleton, isLoading, onClickButton, onClickClose, } = props;
|
|
149
184
|
const appearanceConfig = useAppearanceConfig.useAppearanceConfig(appearance, notificationConfig);
|
|
150
185
|
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
151
|
-
const { fillClass, fillHoverClass, titleTextColor, titleTextSize, descTextColor, descTextSize, buttonAppearance, buttonLabel, elevationClass, 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;
|
|
152
187
|
// @ts-expect-error
|
|
153
188
|
const { styles: notificationStyles } = useStyles.useStyles(props);
|
|
154
|
-
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}`, fillHoverClass && `fill_${fillHoverClass}`, isSkeleton && `notification__item_skeleton`), "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 })), 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] }));
|
|
155
190
|
}
|
|
156
191
|
|
|
157
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 &&
|
|
@@ -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 };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
+
import { L as Loader } from '../Loader_es_Dq2-7sn2.js';
|
|
3
4
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
4
5
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
5
6
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
6
7
|
import { B as Button } from '../Button_es_qNbDsXQg.js';
|
|
7
8
|
import { I as Icon } from '../Icon_es_5JUPM7bP.js';
|
|
8
9
|
import { T as Text } from '../Text_es_RDU9GLCV.js';
|
|
9
|
-
import {
|
|
10
|
+
import { icons24 } from '@itcase/icons/default';
|
|
10
11
|
import { useNotifications, useNotificationsAPI } from '../context/Notifications.js';
|
|
11
12
|
import '../context/UIContext.js';
|
|
12
13
|
import 'react';
|
|
@@ -22,7 +23,6 @@ import 'react-responsive';
|
|
|
22
23
|
import '../utils/setViewportProperty.js';
|
|
23
24
|
import 'lodash/maxBy';
|
|
24
25
|
import '../Link_es_P2b6ya7P.js';
|
|
25
|
-
import '../Loader_es_Dq2-7sn2.js';
|
|
26
26
|
import 'react-inlinesvg';
|
|
27
27
|
import '../hoc/urlWithAssetPrefix.js';
|
|
28
28
|
import '../context/UrlAssetPrefix.js';
|
|
@@ -32,14 +32,13 @@ const notificationAppearanceDefault = {
|
|
|
32
32
|
fill: 'surfacePrimary',
|
|
33
33
|
fillHover: 'surfacePrimaryHover',
|
|
34
34
|
titleTextColor: 'surfaceTextPrimary',
|
|
35
|
-
titleTextSize: 'xxl',
|
|
36
35
|
descTextColor: 'surfaceTextPrimary',
|
|
37
|
-
descTextSize: 'm',
|
|
38
36
|
borderColor: 'surfaceBorderPrimary',
|
|
39
37
|
textColor: 'surfaceTextPrimary',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
buttonAppearance: 'accentPrimary sizeXXL solid rounded',
|
|
39
|
+
loaderAppearance: 'accentTertiary sizeS ghost rounded',
|
|
40
|
+
closeIcon: icons24.Action.Close,
|
|
41
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
43
42
|
},
|
|
44
43
|
};
|
|
45
44
|
|
|
@@ -48,14 +47,13 @@ const notificationAppearanceError = {
|
|
|
48
47
|
fill: 'errorPrimary',
|
|
49
48
|
fillHover: 'errorPrimaryHover',
|
|
50
49
|
titleTextColor: 'errorTextPrimary',
|
|
51
|
-
titleTextSize: 'l',
|
|
52
50
|
descTextColor: 'errorTextPrimary',
|
|
53
|
-
descTextSize: 'm',
|
|
54
51
|
borderColor: 'errorBorderPrimary',
|
|
55
52
|
textColor: 'errorTextPrimary',
|
|
56
53
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
55
|
+
closeIcon: icons24.Action.Close,
|
|
56
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
59
57
|
},
|
|
60
58
|
};
|
|
61
59
|
|
|
@@ -64,19 +62,59 @@ const notificationAppearanceInfo = {
|
|
|
64
62
|
fill: 'infoPrimary',
|
|
65
63
|
fillHover: 'infoPrimaryHover',
|
|
66
64
|
titleTextColor: 'infoTextPrimary',
|
|
67
|
-
titleTextSize: 'l',
|
|
68
65
|
descTextColor: 'infoTextPrimary',
|
|
69
|
-
descTextSize: 'm',
|
|
70
66
|
borderColor: 'infoBorderPrimary',
|
|
71
67
|
textColor: 'infoTextPrimary',
|
|
72
68
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
73
|
-
|
|
74
|
-
closeIcon:
|
|
75
|
-
closeIconAppearance: '
|
|
69
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
70
|
+
closeIcon: icons24.Action.Close,
|
|
71
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const notificationAppearanceShape = {
|
|
76
|
+
circular: {
|
|
77
|
+
shape: 'circular',
|
|
78
|
+
},
|
|
79
|
+
rounded: {
|
|
80
|
+
shape: 'rounded',
|
|
81
|
+
},
|
|
82
|
+
roundedXL: {
|
|
83
|
+
shape: 'rounded',
|
|
84
|
+
shapeStrength: '2m',
|
|
85
|
+
},
|
|
86
|
+
roundedL: {
|
|
87
|
+
shape: 'rounded',
|
|
88
|
+
shapeStrength: '1_5m',
|
|
89
|
+
},
|
|
90
|
+
roundedM: {
|
|
91
|
+
shape: 'rounded',
|
|
92
|
+
shapeStrength: '1m',
|
|
93
|
+
},
|
|
94
|
+
roundedS: {
|
|
95
|
+
shape: 'rounded',
|
|
96
|
+
shapeStrength: '0_5m',
|
|
76
97
|
},
|
|
77
98
|
};
|
|
78
99
|
|
|
79
|
-
const notificationAppearanceSize = {
|
|
100
|
+
const notificationAppearanceSize = {
|
|
101
|
+
sizeM: {
|
|
102
|
+
size: 'm',
|
|
103
|
+
titleTextSize: 'xxl',
|
|
104
|
+
descTextSize: 'm',
|
|
105
|
+
iconSize: 24,
|
|
106
|
+
loaderAppearanceSize: 'sizeS',
|
|
107
|
+
closeIconAppearanceSize: 'size_24_24',
|
|
108
|
+
},
|
|
109
|
+
sizeS: {
|
|
110
|
+
size: 'm',
|
|
111
|
+
titleTextSize: 'xl',
|
|
112
|
+
descTextSize: 'm',
|
|
113
|
+
iconSize: 24,
|
|
114
|
+
loaderAppearanceSize: 'sizeS',
|
|
115
|
+
closeIconAppearanceSize: 'size_24_24',
|
|
116
|
+
},
|
|
117
|
+
};
|
|
80
118
|
|
|
81
119
|
const notificationAppearanceStyle = {
|
|
82
120
|
solid: {
|
|
@@ -97,15 +135,13 @@ const notificationAppearanceSuccess = {
|
|
|
97
135
|
fill: 'successPrimary',
|
|
98
136
|
fillHover: 'successPrimaryHover',
|
|
99
137
|
titleTextColor: 'successTextPrimary',
|
|
100
|
-
titleTextSize: 'l',
|
|
101
138
|
descTextColor: 'successTextPrimary',
|
|
102
|
-
descTextSize: 'm',
|
|
103
139
|
borderColor: 'successBorderPrimary',
|
|
104
140
|
textColor: 'successTextPrimary',
|
|
105
141
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
106
|
-
|
|
107
|
-
closeIcon:
|
|
108
|
-
closeIconAppearance: '
|
|
142
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
143
|
+
closeIcon: icons24.Action.Close,
|
|
144
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
109
145
|
},
|
|
110
146
|
};
|
|
111
147
|
|
|
@@ -114,20 +150,19 @@ const notificationAppearanceWarning = {
|
|
|
114
150
|
fill: 'warningPrimary',
|
|
115
151
|
fillHover: 'warningPrimaryHover',
|
|
116
152
|
titleTextColor: 'warningTextPrimary',
|
|
117
|
-
titleTextSize: 'l',
|
|
118
153
|
descTextColor: 'warningTextPrimary',
|
|
119
|
-
descTextSize: 'm',
|
|
120
154
|
borderColor: 'surfaceBorderPrimary',
|
|
121
155
|
textColor: 'warningTextPrimary',
|
|
122
156
|
buttonAppearance: 'surfacePrimary sizeXXL solid rounded',
|
|
123
|
-
|
|
124
|
-
closeIcon:
|
|
125
|
-
closeIconAppearance: '
|
|
157
|
+
loaderAppearance: 'accentPrimary sizeS solid rounded',
|
|
158
|
+
closeIcon: icons24.Action.Close,
|
|
159
|
+
closeIconAppearance: 'surfacePrimary solid circular',
|
|
126
160
|
},
|
|
127
161
|
};
|
|
128
162
|
|
|
129
163
|
const notificationAppearance = {
|
|
130
164
|
...notificationAppearanceDefault,
|
|
165
|
+
...notificationAppearanceShape,
|
|
131
166
|
...notificationAppearanceSize,
|
|
132
167
|
...notificationAppearanceStyle,
|
|
133
168
|
...notificationAppearanceError,
|
|
@@ -143,13 +178,13 @@ const notificationConfig = {
|
|
|
143
178
|
},
|
|
144
179
|
};
|
|
145
180
|
function Notification(props) {
|
|
146
|
-
const { id, appearance, className, dataTestId, dataTour, title, text, float, global, toast, before, after, isSkeleton, onClickButton, onClickClose, } = props;
|
|
181
|
+
const { id, appearance, className, dataTestId, dataTour, type, title, text, float, global, toast, before, after, isSkeleton, isLoading, onClickButton, onClickClose, } = props;
|
|
147
182
|
const appearanceConfig = useAppearanceConfig(appearance, notificationConfig);
|
|
148
183
|
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
149
|
-
const { fillClass, fillHoverClass, titleTextColor, titleTextSize, descTextColor, descTextSize, buttonAppearance, buttonLabel, elevationClass, 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;
|
|
150
185
|
// @ts-expect-error
|
|
151
186
|
const { styles: notificationStyles } = useStyles(props);
|
|
152
|
-
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}`, fillHoverClass && `fill_${fillHoverClass}`, isSkeleton && `notification__item_skeleton`), "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 })), 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] }));
|
|
153
188
|
}
|
|
154
189
|
|
|
155
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 &&
|
|
@@ -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,36 +33,6 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
.notification__item {
|
|
37
|
-
&_float {
|
|
38
|
-
@mixin elevation-8;
|
|
39
|
-
^&-wrapper {
|
|
40
|
-
padding: 12px;
|
|
41
|
-
display: flex;
|
|
42
|
-
flex-direction: column;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
.notification__item {
|
|
47
|
-
&_toast {
|
|
48
|
-
width: 100%;
|
|
49
|
-
@mixin elevation-8;
|
|
50
|
-
^&-wrapper {
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
.notification__item {
|
|
57
|
-
&_global {
|
|
58
|
-
width: 100%;
|
|
59
|
-
@mixin elevation-8;
|
|
60
|
-
^&-wrapper {
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
36
|
.notification__item {
|
|
67
37
|
width: 340px;
|
|
68
38
|
&-wrapper {
|
|
@@ -78,8 +48,18 @@
|
|
|
78
48
|
}
|
|
79
49
|
^&-close {
|
|
80
50
|
position: absolute;
|
|
81
|
-
top:
|
|
82
|
-
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
|
+
}
|
|
83
63
|
}
|
|
84
64
|
}
|
|
85
65
|
}
|
|
@@ -107,6 +87,29 @@
|
|
|
107
87
|
background-position: -200%;
|
|
108
88
|
}
|
|
109
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
|
+
}
|
|
110
113
|
:root {
|
|
111
114
|
--notification-item-set-float-border-radius: 10px;
|
|
112
115
|
--notification-item-set-float-padding: 20px;
|
|
@@ -118,4 +121,9 @@
|
|
|
118
121
|
--notification-item-set-top-padding: 10px;
|
|
119
122
|
--notification-item-set-toast-border-radius: 0;
|
|
120
123
|
--notification-item-set-toast-padding: 0;
|
|
124
|
+
|
|
125
|
+
--notification-item-m-padding: 12px;
|
|
126
|
+
--notification-item-s-padding: 12px;
|
|
127
|
+
--notification-item-m-gap: 8px;
|
|
128
|
+
--notification-item-s-gap: 8px;
|
|
121
129
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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 };
|
|
@@ -3,14 +3,13 @@ declare const notificationAppearanceDefault: {
|
|
|
3
3
|
fill: string;
|
|
4
4
|
fillHover: string;
|
|
5
5
|
titleTextColor: string;
|
|
6
|
-
titleTextSize: string;
|
|
7
6
|
descTextColor: string;
|
|
8
|
-
descTextSize: string;
|
|
9
7
|
borderColor: string;
|
|
10
8
|
textColor: string;
|
|
11
|
-
|
|
9
|
+
buttonAppearance: string;
|
|
10
|
+
loaderAppearance: string;
|
|
12
11
|
closeIcon: string;
|
|
13
|
-
|
|
12
|
+
closeIconAppearance: string;
|
|
14
13
|
};
|
|
15
14
|
};
|
|
16
15
|
export { notificationAppearanceDefault };
|
|
@@ -3,12 +3,11 @@ declare const notificationAppearanceError: {
|
|
|
3
3
|
fill: string;
|
|
4
4
|
fillHover: string;
|
|
5
5
|
titleTextColor: string;
|
|
6
|
-
titleTextSize: string;
|
|
7
6
|
descTextColor: string;
|
|
8
|
-
descTextSize: string;
|
|
9
7
|
borderColor: string;
|
|
10
8
|
textColor: string;
|
|
11
9
|
buttonAppearance: string;
|
|
10
|
+
loaderAppearance: string;
|
|
12
11
|
closeIcon: string;
|
|
13
12
|
closeIconAppearance: string;
|
|
14
13
|
};
|
|
@@ -3,13 +3,11 @@ declare const notificationAppearanceInfo: {
|
|
|
3
3
|
fill: string;
|
|
4
4
|
fillHover: string;
|
|
5
5
|
titleTextColor: string;
|
|
6
|
-
titleTextSize: string;
|
|
7
6
|
descTextColor: string;
|
|
8
|
-
descTextSize: string;
|
|
9
7
|
borderColor: string;
|
|
10
8
|
textColor: string;
|
|
11
9
|
buttonAppearance: string;
|
|
12
|
-
|
|
10
|
+
loaderAppearance: string;
|
|
13
11
|
closeIcon: string;
|
|
14
12
|
closeIconAppearance: string;
|
|
15
13
|
};
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
declare const notificationAppearanceSize: {
|
|
1
|
+
declare const notificationAppearanceSize: {
|
|
2
|
+
sizeM: {
|
|
3
|
+
size: string;
|
|
4
|
+
titleTextSize: string;
|
|
5
|
+
descTextSize: string;
|
|
6
|
+
iconSize: number;
|
|
7
|
+
loaderAppearanceSize: string;
|
|
8
|
+
closeIconAppearanceSize: string;
|
|
9
|
+
};
|
|
10
|
+
sizeS: {
|
|
11
|
+
size: string;
|
|
12
|
+
titleTextSize: string;
|
|
13
|
+
descTextSize: string;
|
|
14
|
+
iconSize: number;
|
|
15
|
+
loaderAppearanceSize: string;
|
|
16
|
+
closeIconAppearanceSize: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
2
19
|
export { notificationAppearanceSize };
|
|
@@ -3,13 +3,11 @@ declare const notificationAppearanceSuccess: {
|
|
|
3
3
|
fill: string;
|
|
4
4
|
fillHover: string;
|
|
5
5
|
titleTextColor: string;
|
|
6
|
-
titleTextSize: string;
|
|
7
6
|
descTextColor: string;
|
|
8
|
-
descTextSize: string;
|
|
9
7
|
borderColor: string;
|
|
10
8
|
textColor: string;
|
|
11
9
|
buttonAppearance: string;
|
|
12
|
-
|
|
10
|
+
loaderAppearance: string;
|
|
13
11
|
closeIcon: string;
|
|
14
12
|
closeIconAppearance: string;
|
|
15
13
|
};
|
|
@@ -3,13 +3,11 @@ declare const notificationAppearanceWarning: {
|
|
|
3
3
|
fill: string;
|
|
4
4
|
fillHover: string;
|
|
5
5
|
titleTextColor: string;
|
|
6
|
-
titleTextSize: string;
|
|
7
6
|
descTextColor: string;
|
|
8
|
-
descTextSize: string;
|
|
9
7
|
borderColor: string;
|
|
10
8
|
textColor: string;
|
|
11
9
|
buttonAppearance: string;
|
|
12
|
-
|
|
10
|
+
loaderAppearance: string;
|
|
13
11
|
closeIcon: string;
|
|
14
12
|
closeIconAppearance: string;
|
|
15
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.148",
|
|
4
4
|
"description": "UI components (Modal, Loader, Popup, etc)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Modal",
|
|
@@ -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",
|