mimir-ui-kit 1.14.0 → 1.14.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +62 -62
- package/dist/DatePickerModal-BM0BgzTb.js +204 -0
- package/dist/{NavigationButtons-B8tMfqrg.js → NavigationButtons-DuOoqaPo.js} +20 -20
- package/dist/assets/Accordion.css +1 -0
- package/dist/assets/AccordionItem.css +1 -0
- package/dist/assets/Button.css +1 -1
- package/dist/assets/DatePickerModal.css +1 -0
- package/dist/assets/Drawer.css +1 -0
- package/dist/assets/Input.css +1 -1
- package/dist/assets/ListPhotos.css +1 -0
- package/dist/assets/MergedButton.css +1 -1
- package/dist/assets/OtpInput.css +1 -1
- package/dist/assets/Pagination.css +1 -0
- package/dist/assets/RadioGroup.css +1 -1
- package/dist/assets/SelectSearch.css +1 -0
- package/dist/assets/Slider.css +1 -1
- package/dist/assets/Switch.css +1 -0
- package/dist/assets/TabTrail.css +1 -0
- package/dist/assets/Tag.css +1 -0
- package/dist/assets/Timer.css +1 -0
- package/dist/assets/Uploader.css +1 -0
- package/dist/assets/UploaderPhotos.css +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/bugs-CSBdWk0R.js +18 -0
- package/dist/components/Accordion/Accordion.d.ts +10 -0
- package/dist/components/Accordion/Accordion.js +176 -0
- package/dist/components/Accordion/AccordionItem/AccordionItem.d.ts +8 -0
- package/dist/components/Accordion/AccordionItem/AccordionItem.js +16 -0
- package/dist/components/Accordion/AccordionItem/index.d.ts +1 -0
- package/dist/components/Accordion/AccordionItem/index.js +4 -0
- package/dist/components/Accordion/constants.d.ts +8 -0
- package/dist/components/Accordion/constants.js +14 -0
- package/dist/components/Accordion/index.d.ts +3 -0
- package/dist/components/Accordion/index.js +8 -0
- package/dist/components/Button/Button.d.ts +0 -1
- package/dist/components/Button/Button.js +26 -25
- package/dist/components/Button/constants.d.ts +2 -1
- package/dist/components/Button/constants.js +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +44 -0
- package/dist/components/DatePicker/DatePicker.js +69 -0
- package/dist/components/DatePicker/DatePickerModal.d.ts +8 -0
- package/dist/components/DatePicker/DatePickerModal.js +9 -0
- package/dist/components/DatePicker/constants.d.ts +6 -0
- package/dist/components/DatePicker/constants.js +11 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +4 -0
- package/dist/components/Drawer/Drawer.d.ts +42 -0
- package/dist/components/Drawer/Drawer.js +145 -0
- package/dist/components/Drawer/constants.d.ts +5 -0
- package/dist/components/Drawer/constants.js +9 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Drawer/index.js +6 -0
- package/dist/components/Input/Input.d.ts +2 -2
- package/dist/components/Input/Input.js +17 -16
- package/dist/components/InputPassword/InputPassword.js +2 -2
- package/dist/components/InputPhoneNumber/InputPhoneNumber.js +1 -1
- package/dist/components/ListPhotos/ListPhotos.d.ts +23 -0
- package/dist/components/ListPhotos/ListPhotos.js +33 -0
- package/dist/components/ListPhotos/constants.d.ts +3 -0
- package/dist/components/ListPhotos/constants.js +21 -0
- package/dist/components/ListPhotos/index.d.ts +2 -0
- package/dist/components/ListPhotos/index.js +4 -0
- package/dist/components/MergedButton/MergedButton.d.ts +1 -1
- package/dist/components/MergedButton/MergedButton.js +17 -19
- package/dist/components/OtpInput/OtpInput.js +6 -6
- package/dist/components/Pagination/Pagination.d.ts +42 -0
- package/dist/components/Pagination/Pagination.js +220 -0
- package/dist/components/Pagination/constants.d.ts +2 -0
- package/dist/components/Pagination/constants.js +6 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/Pagination/index.js +4 -0
- package/dist/components/Pagination/types.d.ts +0 -0
- package/dist/components/Pagination/types.js +1 -0
- package/dist/components/Portal/Portal.d.ts +7 -0
- package/dist/components/Portal/Portal.js +10 -0
- package/dist/components/Portal/index.d.ts +1 -0
- package/dist/components/Portal/index.js +4 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +18 -2
- package/dist/components/RadioGroup/RadioGroup.js +130 -1061
- package/dist/components/RadioGroup/index.d.ts +1 -1
- package/dist/components/SelectSearch/SelectSearch.d.ts +15 -0
- package/dist/components/SelectSearch/SelectSearch.js +3876 -0
- package/dist/components/SelectSearch/constants.d.ts +4 -0
- package/dist/components/SelectSearch/constants.js +8 -0
- package/dist/components/SelectSearch/index.d.ts +2 -0
- package/dist/components/SelectSearch/index.js +6 -0
- package/dist/components/Slider/NavigationButtons/NavigationButtons.js +1 -1
- package/dist/components/Slider/NavigationButtons/index.js +1 -1
- package/dist/components/Slider/Slider.js +10 -10
- package/dist/components/Switch/Switch.d.ts +294 -0
- package/dist/components/Switch/Switch.js +59 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +4 -0
- package/dist/components/TabTrail/TabButtons/TabButtons.d.ts +8 -0
- package/dist/components/TabTrail/TabButtons/TabButtons.js +29 -0
- package/dist/components/TabTrail/TabButtons/constants.d.ts +8 -0
- package/dist/components/TabTrail/TabButtons/constants.js +14 -0
- package/dist/components/TabTrail/TabButtons/index.d.ts +1 -0
- package/dist/components/TabTrail/TabButtons/index.js +4 -0
- package/dist/components/TabTrail/TabTrail.d.ts +11 -0
- package/dist/components/TabTrail/TabTrail.js +282 -0
- package/dist/components/TabTrail/constants.d.ts +4 -0
- package/dist/components/TabTrail/constants.js +8 -0
- package/dist/components/TabTrail/index.d.ts +2 -0
- package/dist/components/TabTrail/index.js +6 -0
- package/dist/components/Tag/Tag.d.ts +20 -57
- package/dist/components/Tag/Tag.js +39 -84
- package/dist/components/Tag/constants.d.ts +5 -37
- package/dist/components/Tag/constants.js +13 -53
- package/dist/components/Tag/index.d.ts +2 -3
- package/dist/components/Tag/index.js +5 -6
- package/dist/components/Tag/types.d.ts +0 -6
- package/dist/components/Timer/Timer.d.ts +24 -0
- package/dist/components/Timer/Timer.js +29 -0
- package/dist/components/Timer/index.d.ts +1 -0
- package/dist/components/Timer/index.js +4 -0
- package/dist/components/Uploader/Uploader.d.ts +30 -0
- package/dist/components/Uploader/Uploader.js +90 -0
- package/dist/components/Uploader/constants.d.ts +5 -0
- package/dist/components/Uploader/constants.js +16 -0
- package/dist/components/Uploader/index.d.ts +2 -0
- package/dist/components/Uploader/index.js +4 -0
- package/dist/components/UploaderPhotos/UploaderPhotos.d.ts +29 -0
- package/dist/components/UploaderPhotos/UploaderPhotos.js +46 -0
- package/dist/components/UploaderPhotos/index.d.ts +2 -0
- package/dist/components/UploaderPhotos/index.js +4 -0
- package/dist/components/index.d.ts +16 -1
- package/dist/components/index.js +31 -0
- package/dist/focus-management-1rQPII7Z.js +77 -0
- package/dist/hidden-BuVoeHNy.js +13 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +7 -1
- package/dist/hooks/useClickOutside/index.d.ts +1 -0
- package/dist/hooks/useClickOutside/index.js +4 -0
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +7 -0
- package/dist/hooks/useClickOutside/useClickOutside.js +25 -0
- package/dist/hooks/useInterval/index.d.ts +1 -0
- package/dist/hooks/useInterval/index.js +4 -0
- package/dist/hooks/useInterval/useInterval.d.ts +1 -0
- package/dist/hooks/useInterval/useInterval.js +17 -0
- package/dist/hooks/useLockBodyScroll/index.d.ts +1 -0
- package/dist/hooks/useLockBodyScroll/index.js +4 -0
- package/dist/hooks/useLockBodyScroll/useLockBodyScroll.d.ts +6 -0
- package/dist/hooks/useLockBodyScroll/useLockBodyScroll.js +20 -0
- package/dist/hooks/useTimer/index.d.ts +18 -0
- package/dist/hooks/useTimer/index.js +83 -0
- package/dist/hooks/useTimer/useTimer.d.ts +18 -0
- package/dist/hooks/useTimer/useTimer.js +87 -0
- package/dist/hooks/useTimer/utils.d.ts +24 -0
- package/dist/hooks/useTimer/utils.js +88 -0
- package/dist/hooks/useWindowSize/index.d.ts +4 -0
- package/dist/hooks/useWindowSize/index.js +26 -0
- package/dist/icons/Icon.js +1 -1
- package/dist/icons/components/12px/Close12px.d.ts +4 -0
- package/dist/icons/components/12px/Close12px.js +18 -0
- package/dist/icons/components/index.d.ts +1 -0
- package/dist/icons/components/index.js +560 -559
- package/dist/{index-_ACzPKPw.js → index-Cxiikb7g.js} +561 -558
- package/dist/index.d.ts +1 -0
- package/dist/index.js +40 -1
- package/dist/keyboard-B256ZoM-.js +745 -0
- package/dist/label-C_5Syaoj.js +159 -0
- package/dist/open-closed-CbXq00et.js +93 -0
- package/dist/use-active-press-B6yeSopF.js +31 -0
- package/dist/use-by-comparator-BUO78DGe.js +16 -0
- package/dist/use-resolve-button-type-B6LE6gU3.js +19 -0
- package/dist/utils/UUID4.d.ts +1 -0
- package/dist/utils/UUID4.js +9 -0
- package/dist/utils/formating/Date.d.ts +1 -0
- package/dist/utils/formating/Date.js +26 -0
- package/dist/utils/formating/Month.d.ts +8 -0
- package/dist/utils/formating/Month.js +80 -0
- package/dist/utils/formating/Numbers.d.ts +6 -0
- package/dist/utils/formating/Numbers.js +8 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +13 -0
- package/package.json +128 -128
@@ -0,0 +1,220 @@
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
2
|
+
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
|
+
import { forwardRef, useState, useEffect } from "react";
|
4
|
+
import { FIRST_PAGE_NUMBER, DEFAULT_PER_PAGE } from "./constants.js";
|
5
|
+
import { useWindowSize } from "../../hooks/useWindowSize/index.js";
|
6
|
+
import { Icon } from "../../icons/Icon.js";
|
7
|
+
import '../../assets/Pagination.css';const container = "_container_1s8aj_2";
|
8
|
+
const link = "_link_1s8aj_11";
|
9
|
+
const item = "_item_1s8aj_46";
|
10
|
+
const isActive = "_isActive_1s8aj_52";
|
11
|
+
const disabled = "_disabled_1s8aj_58";
|
12
|
+
const cls = {
|
13
|
+
container,
|
14
|
+
link,
|
15
|
+
item,
|
16
|
+
isActive,
|
17
|
+
disabled
|
18
|
+
};
|
19
|
+
const Back = ({
|
20
|
+
currentPageNumber,
|
21
|
+
onClick,
|
22
|
+
setCurrentPage
|
23
|
+
}) => {
|
24
|
+
const handleClick = (event) => {
|
25
|
+
event.preventDefault();
|
26
|
+
if (currentPageNumber === FIRST_PAGE_NUMBER) return;
|
27
|
+
setCurrentPage(currentPageNumber - 1);
|
28
|
+
onClick(currentPageNumber - 1);
|
29
|
+
};
|
30
|
+
return /* @__PURE__ */ jsx(
|
31
|
+
"span",
|
32
|
+
{
|
33
|
+
className: classNames(cls.item, cls.prev, {
|
34
|
+
[cls.disabled]: currentPageNumber === FIRST_PAGE_NUMBER
|
35
|
+
}),
|
36
|
+
children: /* @__PURE__ */ jsx(
|
37
|
+
"a",
|
38
|
+
{
|
39
|
+
className: cls.link,
|
40
|
+
onClick: handleClick,
|
41
|
+
href: "#",
|
42
|
+
"aria-label": "Назад",
|
43
|
+
rel: "prev",
|
44
|
+
children: /* @__PURE__ */ jsx(Icon, { iconName: "ArrowLeft16px" })
|
45
|
+
}
|
46
|
+
)
|
47
|
+
}
|
48
|
+
);
|
49
|
+
};
|
50
|
+
const Next = ({
|
51
|
+
currentPageNumber,
|
52
|
+
lastPageNumber,
|
53
|
+
onClick,
|
54
|
+
setCurrentPage
|
55
|
+
}) => {
|
56
|
+
const isOnLastPage = currentPageNumber >= lastPageNumber;
|
57
|
+
const handleClick = (event) => {
|
58
|
+
event.preventDefault();
|
59
|
+
if (isOnLastPage) return;
|
60
|
+
setCurrentPage(currentPageNumber + 1);
|
61
|
+
onClick == null ? void 0 : onClick(currentPageNumber + 1);
|
62
|
+
};
|
63
|
+
return /* @__PURE__ */ jsx(
|
64
|
+
"span",
|
65
|
+
{
|
66
|
+
className: classNames(cls.item, cls.next, {
|
67
|
+
[cls.disabled]: isOnLastPage
|
68
|
+
}),
|
69
|
+
children: /* @__PURE__ */ jsx(
|
70
|
+
"a",
|
71
|
+
{
|
72
|
+
className: cls.link,
|
73
|
+
onClick: handleClick,
|
74
|
+
href: "#",
|
75
|
+
"aria-label": "Вперед",
|
76
|
+
rel: "next",
|
77
|
+
children: /* @__PURE__ */ jsx(Icon, { iconName: "ArrowRight16px" })
|
78
|
+
}
|
79
|
+
)
|
80
|
+
}
|
81
|
+
);
|
82
|
+
};
|
83
|
+
const Ellipsis = () => {
|
84
|
+
const handleClick = (event) => {
|
85
|
+
event.preventDefault();
|
86
|
+
};
|
87
|
+
return /* @__PURE__ */ jsx("span", { className: cls.item, children: /* @__PURE__ */ jsx("a", { className: cls.link, href: "#", onClick: handleClick, children: /* @__PURE__ */ jsx("span", { children: "..." }) }) });
|
88
|
+
};
|
89
|
+
const Item = ({
|
90
|
+
currentPageNumber,
|
91
|
+
newPageNumber,
|
92
|
+
onClick,
|
93
|
+
setCurrentPage
|
94
|
+
}) => {
|
95
|
+
const isActive2 = currentPageNumber === newPageNumber;
|
96
|
+
const handleClick = (event) => {
|
97
|
+
event.preventDefault();
|
98
|
+
setCurrentPage(newPageNumber);
|
99
|
+
onClick == null ? void 0 : onClick(newPageNumber);
|
100
|
+
};
|
101
|
+
const formattedPageNumber = newPageNumber < 10 ? `0${newPageNumber}` : newPageNumber;
|
102
|
+
return /* @__PURE__ */ jsx("span", { className: classNames(cls.item, { [cls.isActive]: isActive2 }), children: !isActive2 ? /* @__PURE__ */ jsx("a", { href: "#", className: cls.link, onClick: handleClick, children: formattedPageNumber }) : /* @__PURE__ */ jsx("span", { className: cls.link, children: formattedPageNumber }) });
|
103
|
+
};
|
104
|
+
const renderItems = ({
|
105
|
+
start,
|
106
|
+
end,
|
107
|
+
currentPageNumber,
|
108
|
+
onClick,
|
109
|
+
setCurrentPage
|
110
|
+
}) => {
|
111
|
+
const items = [];
|
112
|
+
for (let i = start; i <= end; i++) {
|
113
|
+
items.push(
|
114
|
+
/* @__PURE__ */ jsx(
|
115
|
+
Item,
|
116
|
+
{
|
117
|
+
currentPageNumber,
|
118
|
+
setCurrentPage,
|
119
|
+
newPageNumber: i,
|
120
|
+
onClick
|
121
|
+
},
|
122
|
+
i
|
123
|
+
)
|
124
|
+
);
|
125
|
+
}
|
126
|
+
return items;
|
127
|
+
};
|
128
|
+
const Pagination = forwardRef(
|
129
|
+
(props, ref) => {
|
130
|
+
const {
|
131
|
+
rootClassName,
|
132
|
+
total,
|
133
|
+
perPage = DEFAULT_PER_PAGE,
|
134
|
+
currentPageNumber = FIRST_PAGE_NUMBER,
|
135
|
+
onChange
|
136
|
+
} = props;
|
137
|
+
const [currentPage, setCurrentPage] = useState(currentPageNumber);
|
138
|
+
const lastPageNumber = Math.ceil(total / perPage);
|
139
|
+
const { width } = useWindowSize();
|
140
|
+
const adjacentCount = width <= 650 ? 2 : 4;
|
141
|
+
let firstAdjacentPage = 0;
|
142
|
+
let lastAdjacentPage = 0;
|
143
|
+
useEffect(() => {
|
144
|
+
setCurrentPage(currentPageNumber);
|
145
|
+
}, [currentPageNumber]);
|
146
|
+
if (currentPage <= adjacentCount) {
|
147
|
+
firstAdjacentPage = FIRST_PAGE_NUMBER;
|
148
|
+
lastAdjacentPage = Math.min(
|
149
|
+
FIRST_PAGE_NUMBER + adjacentCount,
|
150
|
+
lastPageNumber
|
151
|
+
);
|
152
|
+
} else if (currentPage > lastPageNumber - adjacentCount) {
|
153
|
+
firstAdjacentPage = lastPageNumber - adjacentCount;
|
154
|
+
lastAdjacentPage = lastPageNumber;
|
155
|
+
} else {
|
156
|
+
firstAdjacentPage = currentPage - adjacentCount / 2;
|
157
|
+
lastAdjacentPage = currentPage + adjacentCount / 2;
|
158
|
+
}
|
159
|
+
if (total <= perPage) {
|
160
|
+
return null;
|
161
|
+
}
|
162
|
+
return /* @__PURE__ */ jsxs(
|
163
|
+
"nav",
|
164
|
+
{
|
165
|
+
"aria-label": "Постраничная навигация",
|
166
|
+
className: classNames(cls.container, rootClassName),
|
167
|
+
ref,
|
168
|
+
children: [
|
169
|
+
/* @__PURE__ */ jsx(
|
170
|
+
Back,
|
171
|
+
{
|
172
|
+
currentPageNumber: currentPage,
|
173
|
+
onClick: onChange,
|
174
|
+
setCurrentPage
|
175
|
+
}
|
176
|
+
),
|
177
|
+
firstAdjacentPage > FIRST_PAGE_NUMBER && /* @__PURE__ */ jsx(
|
178
|
+
Item,
|
179
|
+
{
|
180
|
+
newPageNumber: FIRST_PAGE_NUMBER,
|
181
|
+
currentPageNumber: currentPage,
|
182
|
+
onClick: onChange,
|
183
|
+
setCurrentPage
|
184
|
+
}
|
185
|
+
),
|
186
|
+
firstAdjacentPage > FIRST_PAGE_NUMBER + 1 && /* @__PURE__ */ jsx(Ellipsis, {}),
|
187
|
+
renderItems({
|
188
|
+
start: firstAdjacentPage,
|
189
|
+
end: lastAdjacentPage,
|
190
|
+
currentPageNumber: currentPage,
|
191
|
+
setCurrentPage,
|
192
|
+
onClick: onChange
|
193
|
+
}),
|
194
|
+
lastAdjacentPage < lastPageNumber - 1 && /* @__PURE__ */ jsx(Ellipsis, {}),
|
195
|
+
lastAdjacentPage < lastPageNumber && /* @__PURE__ */ jsx(
|
196
|
+
Item,
|
197
|
+
{
|
198
|
+
newPageNumber: lastPageNumber,
|
199
|
+
currentPageNumber: currentPage,
|
200
|
+
setCurrentPage,
|
201
|
+
onClick: onChange
|
202
|
+
}
|
203
|
+
),
|
204
|
+
/* @__PURE__ */ jsx(
|
205
|
+
Next,
|
206
|
+
{
|
207
|
+
currentPageNumber: currentPage,
|
208
|
+
setCurrentPage,
|
209
|
+
lastPageNumber,
|
210
|
+
onClick: onChange
|
211
|
+
}
|
212
|
+
)
|
213
|
+
]
|
214
|
+
}
|
215
|
+
);
|
216
|
+
}
|
217
|
+
);
|
218
|
+
export {
|
219
|
+
Pagination
|
220
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Pagination } from './Pagination';
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Portal } from './Portal';
|
@@ -7,7 +7,7 @@ export interface TRadioOption {
|
|
7
7
|
/**
|
8
8
|
* Свойства компонента RadioGroup.
|
9
9
|
*/
|
10
|
-
export type
|
10
|
+
export type TRadioGroupProps = Omit<RadioGroupProps, 'value'> & {
|
11
11
|
/**
|
12
12
|
* Массив опций для радиогруппы.
|
13
13
|
* Каждая опция должна содержать значение и метку.
|
@@ -27,4 +27,20 @@ export type TProps = Omit<RadioGroupProps, 'value'> & {
|
|
27
27
|
/**
|
28
28
|
* Компонент RadioGroup для выбора одной опции из нескольких.
|
29
29
|
*/
|
30
|
-
export declare
|
30
|
+
export declare const RadioGroup: import('react').ForwardRefExoticComponent<Omit<RadioGroupProps, "value"> & {
|
31
|
+
/**
|
32
|
+
* Массив опций для радиогруппы.
|
33
|
+
* Каждая опция должна содержать значение и метку.
|
34
|
+
*/
|
35
|
+
options: TRadioOption[];
|
36
|
+
/**
|
37
|
+
* Выбранное значение опции.
|
38
|
+
* Может быть необязательным, если нет выбранного значения.
|
39
|
+
*/
|
40
|
+
value?: TRadioOption["value"];
|
41
|
+
/**
|
42
|
+
* Текст метки, отображаемой над радиогруппой.
|
43
|
+
* Может быть необязательным.
|
44
|
+
*/
|
45
|
+
label?: string;
|
46
|
+
} & import('react').RefAttributes<HTMLElement>>;
|