@itcase/ui 1.2.3 → 1.2.5
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/Choice.js +9 -9
- package/dist/cjs/components/DatePicker.js +9 -7
- package/dist/cjs/components/FormField.js +4 -4
- package/dist/cjs/components/Pagination.js +26 -22
- package/dist/cjs/components/Select.js +252 -1220
- package/dist/cjs/context/Notifications.js +3 -2
- package/dist/components/Choice.js +9 -9
- package/dist/components/DatePicker.js +9 -7
- package/dist/components/FormField.js +4 -4
- package/dist/components/Pagination.js +27 -23
- package/dist/components/Select.js +252 -1220
- package/dist/context/Notifications.js +3 -2
- package/dist/css/components/Choice/Choice.css +32 -16
- package/dist/css/components/Choice/css/__item/choice__item.css +5 -5
- package/dist/types/components/Accordion/Accordion.interface.d.ts +3 -3
- package/dist/types/components/Choice/Choice.interface.d.ts +9 -8
- package/dist/types/components/DatePicker/DatePicker.interface.d.ts +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +0 -10
- package/dist/types/components/Select/Select.interface.d.ts +91 -0
- package/dist/types/components/Select/SelectClearIndicator.d.ts +4 -11
- package/dist/types/components/Select/SelectContainer.d.ts +4 -1
- package/dist/types/components/Select/SelectControl.d.ts +4 -11
- package/dist/types/components/Select/SelectDropdownIndicator.d.ts +4 -13
- package/dist/types/components/Select/SelectGroupHeading.d.ts +4 -7
- package/dist/types/components/Select/SelectIndicatorsContainer.d.ts +4 -4
- package/dist/types/components/Select/SelectInput.d.ts +4 -12
- package/dist/types/components/Select/SelectLoadingIndicator.d.ts +5 -7
- package/dist/types/components/Select/SelectMenu.d.ts +4 -11
- package/dist/types/components/Select/SelectMultiValueContainer.d.ts +4 -1
- package/dist/types/components/Select/SelectMultiValueLabel.d.ts +4 -4
- package/dist/types/components/Select/SelectMultiValueRemove.d.ts +4 -4
- package/dist/types/components/Select/SelectNoOptions.d.ts +4 -12
- package/dist/types/components/Select/SelectOption.d.ts +4 -16
- package/dist/types/components/Select/SelectPlaceholder.d.ts +4 -11
- package/dist/types/components/Select/SelectSingleValue.d.ts +4 -12
- package/dist/types/components/Select/SelectValueContainer.d.ts +4 -11
- package/dist/types/components/Select/index.d.ts +3 -5
- package/dist/types/types/componentProps/sizeInterface.d.ts +1 -1
- package/package.json +3 -2
|
@@ -38,8 +38,9 @@ function NotificationsProvider(props) {
|
|
|
38
38
|
// Check on need to hide, if current notification is target for hide
|
|
39
39
|
const isNeedToHide = String(notificationItem.id) === String(targetId);
|
|
40
40
|
// Callback for close if exists
|
|
41
|
-
if (isNeedToHide
|
|
42
|
-
notificationItem.
|
|
41
|
+
if (isNeedToHide) {
|
|
42
|
+
clearTimeout(notificationItem._closeTimeout);
|
|
43
|
+
notificationItem.onClose && notificationItem.onClose();
|
|
43
44
|
}
|
|
44
45
|
// Save in state if no need to hide
|
|
45
46
|
return !isNeedToHide;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as __assign } from '../tslib.es6-S-VPg1Cw.js';
|
|
1
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
import React, { useRef, useMemo, createRef, useCallback } from 'react';
|
|
3
4
|
import clsx from 'clsx';
|
|
@@ -17,7 +18,6 @@ import 'lodash/maxBy';
|
|
|
17
18
|
import 'lodash/upperFirst';
|
|
18
19
|
import '../hooks/styleAttributes.js';
|
|
19
20
|
import '../Link-Bqu5amIb.js';
|
|
20
|
-
import '../tslib.es6-S-VPg1Cw.js';
|
|
21
21
|
import '../Tooltip-DJufHBiQ.js';
|
|
22
22
|
import '../Title-BfSFPJtJ.js';
|
|
23
23
|
|
|
@@ -28,7 +28,7 @@ var choiceConfig = {
|
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
var Choice = React.forwardRef(function Choice(props, ref) {
|
|
31
|
-
var _a = props.isCheckbox, isCheckbox = _a === void 0 ? false : _a, _b = props.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, _d = props.active, active = _d === void 0 ? { value: undefined } : _d, activeIcon = props.activeIcon, activeIconItemFill = props.activeIconItemFill, after = props.after, appearance = props.appearance, before = props.before, className = props.className, icon = props.icon, iconFillDisabled = props.iconFillDisabled, iconItemFill = props.iconItemFill, iconSize = props.iconSize, labelTextActiveColor = props.labelTextActiveColor, labelTextActiveColorDisabled = props.labelTextActiveColorDisabled, labelTextColor = props.labelTextColor, labelTextColorDisabled = props.labelTextColorDisabled, labelTextSize = props.labelTextSize, labelTextWeight = props.labelTextWeight, name = props.name, _e = props.options, options = _e === void 0 ? [] : _e, set = props.set, setActiveSegment = props.setActiveSegment, _f = props.size, size = _f === void 0 ? 'normal' : _f, type = props.type;
|
|
31
|
+
var gap = props.gap, _a = props.isCheckbox, isCheckbox = _a === void 0 ? false : _a, _b = props.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, _d = props.active, active = _d === void 0 ? { value: undefined } : _d, activeIcon = props.activeIcon, activeIconItemFill = props.activeIconItemFill, after = props.after, appearance = props.appearance, before = props.before, className = props.className, icon = props.icon, iconFillDisabled = props.iconFillDisabled, iconItemFill = props.iconItemFill, iconSize = props.iconSize, labelTextActiveColor = props.labelTextActiveColor, labelTextActiveColorDisabled = props.labelTextActiveColorDisabled, labelTextColor = props.labelTextColor, labelTextColorDisabled = props.labelTextColorDisabled, labelTextSize = props.labelTextSize, labelTextWeight = props.labelTextWeight, name = props.name, _e = props.options, options = _e === void 0 ? [] : _e, set = props.set, setActiveSegment = props.setActiveSegment, _f = props.size, size = _f === void 0 ? 'normal' : _f, type = props.type;
|
|
32
32
|
var controlRef = useRef(null);
|
|
33
33
|
var optionsRefs = useMemo(function () { return new Map(options.map(function (item) { return [item.value, createRef()]; })); }, [options]);
|
|
34
34
|
var onChange = useCallback(function (event, item) {
|
|
@@ -75,18 +75,18 @@ var Choice = React.forwardRef(function Choice(props, ref) {
|
|
|
75
75
|
var appearanceConfig = (appearance && choiceConfig.appearance && choiceConfig.appearance[appearance]);
|
|
76
76
|
return (jsx("div", { className: clsx(className, 'choice', shapeClass ||
|
|
77
77
|
((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.shape) &&
|
|
78
|
-
"choice_shape_".concat(appearanceConfig.shape).replace(/([A-Z])/g, '-$1').toLowerCase()),
|
|
79
|
-
? fillClass ||
|
|
80
|
-
((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fill) &&
|
|
81
|
-
"fill_".concat(appearanceConfig.fill).replace(/([A-Z])/g, '-$1').toLowerCase())
|
|
82
|
-
: fillDisabledClass, borderColorClass ||
|
|
78
|
+
"choice_shape_".concat(appearanceConfig.shape).replace(/([A-Z])/g, '-$1').toLowerCase()), borderColorClass ||
|
|
83
79
|
((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.borderColor) &&
|
|
84
80
|
"border-color_".concat(appearanceConfig.borderColor)
|
|
85
81
|
.replace(/([A-Z])/g, '-$1')
|
|
86
|
-
.toLowerCase()), borderWidthClass, borderTypeClass, set && "choice_set_".concat(set), size && "choice_size_".concat(size), type && "choice_type_".concat(type)), ref: controlRef, children: isLoading ? (jsx(Loader, { width: "fill", height: "fill", fill: "surfacePrimary", itemFill: "surfaceItemAccent", set: "simple" })) : (jsx("div", { className: "choice__wrapper", children: options.map(function (item) { return (jsxs("div", { className: clsx('choice__item', !isDisabled
|
|
82
|
+
.toLowerCase()), borderWidthClass, borderTypeClass, set && "choice_set_".concat(set), size && "choice_size_".concat(size), type && "choice_type_".concat(type)), ref: controlRef, children: isLoading ? (jsx(Loader, { width: "fill", height: "fill", fill: "surfacePrimary", itemFill: "surfaceItemAccent", set: "simple" })) : (jsx("div", { className: "choice__wrapper", style: __assign({}, (gap && { gap: gap })), children: options.map(function (item) { return (jsxs("div", { className: clsx('choice__item', !isDisabled
|
|
83
|
+
? fillClass ||
|
|
84
|
+
((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fill) &&
|
|
85
|
+
"fill_".concat(appearanceConfig.fill).replace(/([A-Z])/g, '-$1').toLowerCase())
|
|
86
|
+
: fillDisabledClass, !isDisabled &&
|
|
87
87
|
(fillHoverClass ||
|
|
88
88
|
((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fillHover) &&
|
|
89
|
-
"
|
|
89
|
+
"fill_hover_".concat(appearanceConfig.fillHover)
|
|
90
90
|
.replace(/([A-Z])/g, '-$1')
|
|
91
91
|
.toLowerCase())), item.value !== (active === null || active === void 0 ? void 0 : active.value) && isDisabled && 'choice__item_state_disabled', item.value === (active === null || active === void 0 ? void 0 : active.value)
|
|
92
92
|
? !isDisabled
|
|
@@ -4,6 +4,7 @@ import React, { useMemo, useCallback, useRef, useState, useEffect } from 'react'
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import DatePicker from 'react-datepicker';
|
|
6
6
|
import { useDeviceTargetClass } from '../hooks/useDeviceTargetClass.js';
|
|
7
|
+
import { useStyles } from '../hooks/useStyles.js';
|
|
7
8
|
import { B as Button } from '../Button-BJWuO5uR.js';
|
|
8
9
|
import { I as Icon } from '../Icon-fTLfvlsK.js';
|
|
9
10
|
import { I as Input } from '../Input-UkM-ag48.js';
|
|
@@ -15,7 +16,6 @@ import '../context/UIContext.js';
|
|
|
15
16
|
import 'prop-types';
|
|
16
17
|
import '../hooks/useMediaQueries.js';
|
|
17
18
|
import 'react-responsive';
|
|
18
|
-
import '../hooks/useStyles.js';
|
|
19
19
|
import 'lodash/maxBy';
|
|
20
20
|
import 'lodash/upperFirst';
|
|
21
21
|
import '../hooks/styleAttributes.js';
|
|
@@ -1071,7 +1071,7 @@ const ru = {
|
|
|
1071
1071
|
function DatePickerInput(props) {
|
|
1072
1072
|
var className = props.className, clearIcon = props.clearIcon, clearIconFill = props.clearIconFill, clearIconFillHover = props.clearIconFillHover, clearIconFillSize = props.clearIconFillSize, clearIconItemFill = props.clearIconItemFill, clearIconItemFillHover = props.clearIconItemFillHover, clearIconShape = props.clearIconShape, clearIconSize = props.clearIconSize, clearIconSrc = props.clearIconSrc, clearLabel = props.clearLabel, clearLabelTextColor = props.clearLabelTextColor, clearLabelTextColorHover = props.clearLabelTextColorHover, clearLabelTextSize = props.clearLabelTextSize, datePickerProps = props.datePickerProps, endValue = props.endValue, inputProps = props.inputProps, labelTextSize = props.labelTextSize, value = props.value, onChange = props.onChange;
|
|
1073
1073
|
var widthClass = useDeviceTargetClass(props, {
|
|
1074
|
-
prefix: '
|
|
1074
|
+
prefix: 'datepicker_width_',
|
|
1075
1075
|
propsKey: 'width',
|
|
1076
1076
|
});
|
|
1077
1077
|
var datepickerRef = useRef(null);
|
|
@@ -1105,7 +1105,7 @@ function DatePickerInput(props) {
|
|
|
1105
1105
|
setEndDate(newEndDate);
|
|
1106
1106
|
}, [onChange]);
|
|
1107
1107
|
var renderDayContents = useCallback(function (day, date) {
|
|
1108
|
-
return (jsx(Button, { className: "react-datepicker__day-button",
|
|
1108
|
+
return (jsx(Button, { className: "react-datepicker__day-button", labelTextColor: datePickerProps.dayTextColor, labelTextSize: datePickerProps.dayTextSize, label: date.getDate().toString(), shape: datePickerProps.dayTextShape, size: datePickerProps.daySize }));
|
|
1109
1109
|
}, [
|
|
1110
1110
|
datePickerProps.daySize,
|
|
1111
1111
|
datePickerProps.dayTextColor,
|
|
@@ -1113,7 +1113,7 @@ function DatePickerInput(props) {
|
|
|
1113
1113
|
datePickerProps.dayTextSize,
|
|
1114
1114
|
]);
|
|
1115
1115
|
var renderCustomHeader = useCallback(function (_a) {
|
|
1116
|
-
var
|
|
1116
|
+
var decreaseMonth = _a.decreaseMonth, increaseMonth = _a.increaseMonth, monthDate = _a.monthDate;
|
|
1117
1117
|
return (jsxs("div", { className: "react-datepicker__header--div", children: [datePickerProps.iconLeft && (jsx(Icon, { className: "react-datepicker__icon", fill: datePickerProps.iconFill, fillHover: datePickerProps.iconFillHover, fillSize: datePickerProps.iconFillSize, iconFill: datePickerProps.iconItemFill, shape: datePickerProps.iconShape, size: datePickerProps.iconSize, SvgImage: datePickerProps.iconLeft, onClick: decreaseMonth })), jsxs("div", { className: "react-datepicker__data", children: [jsx(Text, { className: "react-datepicker__month", size: datePickerProps.monthTextSize, textColor: datePickerProps.monthTextColor, textWeight: datePickerProps.monthTextWeight, children: monthDate.toLocaleString('ru-RU', { month: 'long' }) }), jsx(Text, { className: "react-datepicker__year", size: datePickerProps.yearTextSize, textColor: datePickerProps.yearTextColor, textWeight: datePickerProps.yearTextWeight, children: monthDate.toLocaleString('ru-RU', { year: 'numeric' }) })] }), datePickerProps.iconRight && (jsx(Icon, { className: "react-datepicker__icon", fill: datePickerProps.iconFill, fillHover: datePickerProps.iconFillHover, fillSize: datePickerProps.iconFillSize, iconFill: datePickerProps.iconItemFill, shape: datePickerProps.iconShape, size: datePickerProps.iconSize, SvgImage: datePickerProps.iconRight, onClick: increaseMonth }))] }));
|
|
1118
1118
|
}, [
|
|
1119
1119
|
datePickerProps.iconFill,
|
|
@@ -1137,12 +1137,14 @@ function DatePickerInput(props) {
|
|
|
1137
1137
|
useEffect(function () {
|
|
1138
1138
|
setEndDate(end);
|
|
1139
1139
|
}, [end]);
|
|
1140
|
-
|
|
1140
|
+
// @ts-expect-error
|
|
1141
|
+
var datePickerStyles = useStyles(props).styles;
|
|
1142
|
+
return (jsx("div", { className: clsx(className, 'datepicker', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.monthsShown) && 'datepicker_type_multiple-months', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.customTimeInput) && 'datepicker_type_button', widthClass), style: datePickerStyles, children: jsx(DatePicker, __assign({ ref: datepickerRef, endDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? endDate : undefined, locale: ru, minDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.disablePastDays) ? new Date() : undefined, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, customInput: jsx(DatePickerCustomInput, { labelTextSize: labelTextSize, clearIcon: clearIcon, clearIconFill: clearIconFill, clearIconFillHover: clearIconFillHover, clearIconFillSize: clearIconFillSize, clearIconItemFill: clearIconItemFill, clearIconItemFillHover: clearIconItemFillHover, clearIconShape: clearIconShape, clearIconSize: clearIconSize, clearIconSrc: clearIconSrc, clearLabel: clearLabel, clearLabelTextColor: clearLabelTextColor, clearLabelTextColorHover: clearLabelTextColorHover, clearLabelTextSize: clearLabelTextSize, datepickerRef: datepickerRef, inputIcon: datePickerProps.inputIcon, inputIconFill: datePickerProps.inputIconFill, inputIconFillHover: datePickerProps.inputIconFillHover, inputIconFillSize: datePickerProps.inputIconFillSize, inputIconItemFill: datePickerProps.inputIconItemFill, inputIconShape: datePickerProps.inputIconShape, inputIconSize: datePickerProps.inputIconSize, inputIconSrc: datePickerProps.inputIconSrc, inputProps: inputProps, isClearable: datePickerProps.isClearable }), popperClassName: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.popper) && "react-datepicker-popper-".concat(datePickerProps.popper), onChange: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? handleChange : onChange }, datePickerProps, {
|
|
1141
1143
|
// Important for use custom clear button
|
|
1142
1144
|
isClearable: false })) }));
|
|
1143
1145
|
}
|
|
1144
1146
|
var DatePickerCustomInput = React.forwardRef(function (props, ref) {
|
|
1145
|
-
var isClearable = props.isClearable,
|
|
1147
|
+
var isClearable = props.isClearable, inputIcon = props.inputIcon, inputProps = props.inputProps, value = props.value;
|
|
1146
1148
|
var multipleValue = useMemo(function () {
|
|
1147
1149
|
if (value) {
|
|
1148
1150
|
var twoDates = value.split(' - ');
|
|
@@ -1160,7 +1162,7 @@ function DatePickerClearButton(props) {
|
|
|
1160
1162
|
(_a = datepickerRef === null || datepickerRef === void 0 ? void 0 : datepickerRef.current) === null || _a === void 0 ? void 0 : _a.onClearClick(event);
|
|
1161
1163
|
(_b = datepickerRef === null || datepickerRef === void 0 ? void 0 : datepickerRef.current) === null || _b === void 0 ? void 0 : _b.handleFocus(event);
|
|
1162
1164
|
}, []);
|
|
1163
|
-
return (jsxs(React.Fragment, { children: [clearLabel && (jsx(Label, { className: clsx('react-datepicker__clear-label', 'cursor_type_pointer'),
|
|
1165
|
+
return (jsxs(React.Fragment, { children: [clearLabel && (jsx(Label, { className: clsx('react-datepicker__clear-label', 'cursor_type_pointer'), labelTextColor: clearLabelTextColor, labelTextSize: clearLabelTextSize, label: clearLabel, labelTextColorHover: clearLabelTextColorHover, onClick: onClick })), (clearIcon || clearIconSrc) && (jsx(Icon, { className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), fill: clearIconFill, fillHover: clearIconFillHover, fillSize: clearIconFillSize, iconFill: clearIconItemFill, iconFillHover: clearIconItemFillHover, imageSrc: clearIconSrc, shape: clearIconShape, size: clearIconSize, SvgImage: clearIcon, onClick: onClick }))] }));
|
|
1164
1166
|
}
|
|
1165
1167
|
DatePickerClearButton.displayName = 'DatePickerClearButton';
|
|
1166
1168
|
function DatePickerInputIcon(props) {
|
|
@@ -7,9 +7,12 @@ import { I as Icon } from '../Icon-fTLfvlsK.js';
|
|
|
7
7
|
import { useStyles } from '../hooks/useStyles.js';
|
|
8
8
|
import { useDeviceTargetClass } from '../hooks/useDeviceTargetClass.js';
|
|
9
9
|
import { R as Radio } from '../Radio-oMf0vN7T.js';
|
|
10
|
+
import 'react-select';
|
|
10
11
|
import { SelectInput } from './Select.js';
|
|
11
|
-
import { S as Switch } from '../Switch-DEXsrPCo.js';
|
|
12
12
|
import 'react';
|
|
13
|
+
import '../Badge-CrhdvxY6.js';
|
|
14
|
+
import '../Group-BXfLh7AZ.js';
|
|
15
|
+
import { S as Switch } from '../Switch-DEXsrPCo.js';
|
|
13
16
|
import 'react-inlinesvg';
|
|
14
17
|
import '../Link-Bqu5amIb.js';
|
|
15
18
|
import '../Tooltip-DJufHBiQ.js';
|
|
@@ -23,10 +26,7 @@ import 'lodash/maxBy';
|
|
|
23
26
|
import 'lodash/upperFirst';
|
|
24
27
|
import '../hooks/styleAttributes.js';
|
|
25
28
|
import 'lodash/castArray';
|
|
26
|
-
import 'react-select';
|
|
27
29
|
import 'react-select/creatable';
|
|
28
|
-
import '../Badge-CrhdvxY6.js';
|
|
29
|
-
import '../Group-BXfLh7AZ.js';
|
|
30
30
|
|
|
31
31
|
function FormField(props) {
|
|
32
32
|
var id = props.id, children = props.children, afterItem = props.afterItem, dataTestId = props.dataTestId, beforeItem = props.beforeItem, dividerWidth = props.dividerWidth, dividerDirection = props.dividerDirection, set = props.set, className = props.className, dividerSize = props.dividerSize, dividerFill = props.dividerFill, descSize = props.descSize, descTextWeight = props.descTextWeight, descTextColor = props.descTextColor, desc = props.desc, label = props.label, labelTextSize = props.labelTextSize, labelTextWeight = props.labelTextWeight, labelTextColor = props.labelTextColor, clearIconFill = props.clearIconFill, clearIcon = props.clearIcon, clearIconSize = props.clearIconSize, messageSize = props.messageSize, messageTextWeight = props.messageTextWeight, messageTextColor = props.messageTextColor, message = props.message;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useCallback
|
|
2
|
+
import { useMemo, useState, useCallback } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import ceil from 'lodash/ceil';
|
|
5
5
|
import ReactPaginate from 'react-paginate';
|
|
@@ -25,8 +25,8 @@ import '../Tooltip-DJufHBiQ.js';
|
|
|
25
25
|
import '../Title-BfSFPJtJ.js';
|
|
26
26
|
|
|
27
27
|
function Pagination(props) {
|
|
28
|
-
var
|
|
29
|
-
|
|
28
|
+
var isPageCount = props.isPageCount, _a = props.isPageCountDropdownReversed, isPageCountDropdownReversed = _a === void 0 ? false : _a, _b = props.allItemsCount, allItemsCount = _b === void 0 ? 0 : _b, className = props.className, marginPagesDisplayed = props.marginPagesDisplayed, nextLabel = props.nextLabel, _c = props.pageCountArray, pageCountArray = _c === void 0 ? [10, 20, 50, 100] : _c, pageCountDesc = props.pageCountDesc, pageCountDescTextColor = props.pageCountDescTextColor, pageCountDescTextSize = props.pageCountDescTextSize, pageCountDropdownAlignment = props.pageCountDropdownAlignment, pageCountDropdownElevation = props.pageCountDropdownElevation, pageCountDropdownFill = props.pageCountDropdownFill, pageCountDropdownItemDividerDirection = props.pageCountDropdownItemDividerDirection, pageCountDropdownItemDividerFill = props.pageCountDropdownItemDividerFill, pageCountDropdownItemDividerSize = props.pageCountDropdownItemDividerSize, pageCountDropdownItemFill = props.pageCountDropdownItemFill, pageCountDropdownItemFillActive = props.pageCountDropdownItemFillActive, pageCountDropdownItemFillActiveHover = props.pageCountDropdownItemFillActiveHover, pageCountDropdownItemFillHover = props.pageCountDropdownItemFillHover, pageCountDropdownItemLabelAlign = props.pageCountDropdownItemLabelAlign, pageCountDropdownItemLabelColor = props.pageCountDropdownItemLabelColor, _d = props.pageCountDropdownItemLabelColorActive, pageCountDropdownItemLabelColorActive = _d === void 0 ? '' : _d, pageCountDropdownItemLabelSize = props.pageCountDropdownItemLabelSize, pageCountDropdownItemLabelWrap = props.pageCountDropdownItemLabelWrap, pageCountDropdownItemShowDivider = props.pageCountDropdownItemShowDivider, pageCountDropdownItemSize = props.pageCountDropdownItemSize, pageCountDropdownItemWidth = props.pageCountDropdownItemWidth, pageCountDropdownSet = props.pageCountDropdownSet, pageCountDropdownShape = props.pageCountDropdownShape, pageCountInputIcon = props.pageCountInputIcon, pageCountInputIconColor = props.pageCountInputIconColor, pageCountInputIconFillSize = props.pageCountInputIconFillSize, pageCountInputTextColor = props.pageCountInputTextColor, pageCountInputTextSize = props.pageCountInputTextSize, _e = props.pageNumber, pageNumber = _e === void 0 ? 0 : _e, pageRangeDisplayed = props.pageRangeDisplayed, _f = props.perPageCount, perPageCount = _f === void 0 ? 0 : _f, previousLabel = props.previousLabel, onChangePage = props.onChangePage, onChangePerPageCount = props.onChangePerPageCount,
|
|
29
|
+
/**
|
|
30
30
|
* @deprecated The method should not be used
|
|
31
31
|
*/
|
|
32
32
|
onPageChange = props.onPageChange,
|
|
@@ -34,20 +34,35 @@ function Pagination(props) {
|
|
|
34
34
|
* @deprecated The method should not be used
|
|
35
35
|
*/
|
|
36
36
|
onPerPageCountChange = props.onPerPageCountChange;
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
var _onChangePage = useMemo(function () {
|
|
38
|
+
if (onPageChange) {
|
|
39
|
+
console.warn('@itcase/ui Pagination warning: "onPageChange" is deprecated, use "onChangePage" instead.');
|
|
40
|
+
return onPageChange;
|
|
41
|
+
}
|
|
42
|
+
return onChangePage;
|
|
43
|
+
}, [onChangePage, onPageChange]);
|
|
44
|
+
var _onChangePerPageCount = useMemo(function () {
|
|
45
|
+
if (onPerPageCountChange) {
|
|
46
|
+
console.warn('@itcase/ui Pagination warning: "onPerPageCountChange" is deprecated, use "onChangePerPageCount" instead.');
|
|
47
|
+
return onPerPageCountChange;
|
|
48
|
+
}
|
|
49
|
+
return onChangePerPageCount;
|
|
50
|
+
}, [onChangePerPageCount, onPerPageCountChange]);
|
|
51
|
+
var _g = useState(false), isOpenDropdown = _g[0], setIsOpenDropdown = _g[1];
|
|
52
|
+
var _h = useState(10), activeDropdownItem = _h[0], setActiveDropdownItem = _h[1];
|
|
53
|
+
var pageCountDropdownArray = useMemo(function () {
|
|
54
|
+
return isPageCountDropdownReversed ? pageCountArray === null || pageCountArray === void 0 ? void 0 : pageCountArray.reverse() : pageCountArray;
|
|
55
|
+
}, [isPageCountDropdownReversed, pageCountArray]);
|
|
41
56
|
// Toggle command menu
|
|
42
57
|
var onClickCommandMenuButton = useCallback(function () {
|
|
43
58
|
setIsOpenDropdown(function (state) { return !state; });
|
|
44
59
|
}, []);
|
|
45
60
|
var handleDropdownItemClick = useCallback(function (event, item) {
|
|
46
61
|
event.stopPropagation();
|
|
47
|
-
|
|
62
|
+
_onChangePerPageCount && _onChangePerPageCount(item);
|
|
48
63
|
setActiveDropdownItem(item);
|
|
49
64
|
setIsOpenDropdown(false);
|
|
50
|
-
}, [
|
|
65
|
+
}, [_onChangePerPageCount]);
|
|
51
66
|
var justifyContentClass = useDeviceTargetClass(props, {
|
|
52
67
|
prefix: 'pagination_justify-content_',
|
|
53
68
|
propsKey: 'justifyContent',
|
|
@@ -81,10 +96,7 @@ function Pagination(props) {
|
|
|
81
96
|
}
|
|
82
97
|
return 0;
|
|
83
98
|
}, [pageNumber]);
|
|
84
|
-
|
|
85
|
-
setPageCountDropdownArray(isPageCountDropdownReversed ? pageCountArray === null || pageCountArray === void 0 ? void 0 : pageCountArray.reverse() : pageCountArray);
|
|
86
|
-
}, [pageCountArray, isPageCountDropdownReversed]);
|
|
87
|
-
return (jsxs("div", { className: "pagination", children: [showPagination && (jsx(ReactPaginate, { activeClassName: "pagination__item_state_active cursor_type_default", breakClassName: "pagination__item pagination__item_break", disabledClassName: "pagination__item_state_disabled cursor_type_default", disabledLinkClassName: "pagination__item_state_disabled", marginPagesDisplayed: marginPagesDisplayed, nextClassName: "pagination__item pagination__item_next", pageCount: paginationPagesCount, pageLinkClassName: "pagination__item-link", pageRangeDisplayed: pageRangeDisplayed, previousClassName: "pagination__item pagination__item_previous", onPageChange: onPageChange, activeLinkClassName: "pagination__item-link_state_active",
|
|
99
|
+
return (jsxs("div", { className: "pagination", children: [jsx(ReactPaginate, { activeClassName: "pagination__item_state_active cursor_type_default", breakClassName: "pagination__item pagination__item_break", disabledClassName: "pagination__item_state_disabled cursor_type_default", disabledLinkClassName: "pagination__item_state_disabled", marginPagesDisplayed: marginPagesDisplayed, nextClassName: "pagination__item pagination__item_next", pageCount: paginationPagesCount, pageLinkClassName: "pagination__item-link", pageRangeDisplayed: pageRangeDisplayed, previousClassName: "pagination__item pagination__item_previous", activeLinkClassName: "pagination__item-link_state_active",
|
|
88
100
|
// previous button
|
|
89
101
|
previousLabel: previousLabel, breakLinkClassName: "pagination__item-link",
|
|
90
102
|
// pages settings
|
|
@@ -94,17 +106,9 @@ function Pagination(props) {
|
|
|
94
106
|
// break element
|
|
95
107
|
breakLabel: "...", previousLinkClassName: "pagination__item-link",
|
|
96
108
|
// next button
|
|
97
|
-
nextLabel: nextLabel })
|
|
98
|
-
return activeDropdownItem === item ? (jsx(DropdownItem, {
|
|
109
|
+
nextLabel: nextLabel, onPageChange: _onChangePage }), isPageCount && (jsxs("div", { className: clsx(className, 'pagination__count', gapClass), children: [jsx(Text, { size: pageCountDescTextSize, textColor: pageCountDescTextColor, children: pageCountDesc }), jsxs("div", { className: clsx('pagination__input', 'cursor_type_pointer', fillClass, fillHoverClass), onClick: onClickCommandMenuButton, children: [jsx(Text, { size: pageCountInputTextSize, textColor: pageCountInputTextColor, children: activeDropdownItem }), jsx(Icon, { fillSize: pageCountInputIconFillSize, iconFill: pageCountInputIconColor, SvgImage: pageCountInputIcon }), jsx(Dropdown, { fill: pageCountDropdownFill, alignment: pageCountDropdownAlignment, elevation: pageCountDropdownElevation, shape: pageCountDropdownShape, isOpen: isOpenDropdown, set: pageCountDropdownSet, setIsOpen: setIsOpenDropdown, children: pageCountDropdownArray.map(function (item, index) {
|
|
110
|
+
return activeDropdownItem === item ? (jsx(DropdownItem, { width: pageCountDropdownItemWidth, labelTextColor: pageCountDropdownItemLabelColor, labelTextSize: pageCountDropdownItemLabelSize, fill: pageCountDropdownItemFill, fillHover: pageCountDropdownItemFillHover, dividerDirection: pageCountDropdownItemDividerDirection, dividerFill: pageCountDropdownItemDividerFill, dividerSize: pageCountDropdownItemDividerSize, fillActive: pageCountDropdownItemFillActive, fillActiveHover: pageCountDropdownItemFillActiveHover, label: item.toString(), labelTextAlign: pageCountDropdownItemLabelAlign, labelTextColorActive: pageCountDropdownItemLabelColorActive, labelTextWrap: pageCountDropdownItemLabelWrap, size: pageCountDropdownItemSize, showDivider: index < pageCountArray.length - 1 && pageCountDropdownItemShowDivider, isActive: true, onClick: function (event) { return handleDropdownItemClick(event, item); } }, item)) : (jsx(DropdownItem, { width: pageCountDropdownItemWidth, labelTextColor: pageCountDropdownItemLabelColor, labelTextSize: pageCountDropdownItemLabelSize, fill: pageCountDropdownItemFill, fillHover: pageCountDropdownItemFillHover, dividerDirection: pageCountDropdownItemDividerDirection, dividerFill: pageCountDropdownItemDividerFill, dividerSize: pageCountDropdownItemDividerSize, label: item.toString(), labelTextAlign: pageCountDropdownItemLabelAlign, labelTextColorActive: pageCountDropdownItemLabelColorActive, labelTextWrap: pageCountDropdownItemLabelWrap, size: pageCountDropdownItemSize, showDivider: index < pageCountArray.length - 1 && pageCountDropdownItemShowDivider, isActive: false, onClick: function (event) { return handleDropdownItemClick(event, item); } }, item));
|
|
99
111
|
}) })] })] }))] }));
|
|
100
112
|
}
|
|
101
|
-
Pagination.defaultProps = {
|
|
102
|
-
pageNumber: 0,
|
|
103
|
-
perPageCount: 0,
|
|
104
|
-
allItemsCount: 0,
|
|
105
|
-
pageCountArray: [10, 20, 50, 100],
|
|
106
|
-
isPageCountDropdownReversed: false,
|
|
107
|
-
pageCountDropdownItemLabelColorActive: '',
|
|
108
|
-
};
|
|
109
113
|
|
|
110
114
|
export { Pagination };
|