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
@@ -1,8 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { Tag } from "./Tag.js";
|
2
|
+
import { ETagSize, ETagType } from "./constants.js";
|
3
3
|
export {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Steps
|
4
|
+
ETagSize,
|
5
|
+
ETagType,
|
6
|
+
Tag
|
8
7
|
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
type TProps = {
|
2
|
+
/**
|
3
|
+
* число, которое представляет собой временную метку, указывающую время, когда истекает таймер.
|
4
|
+
* const timer = new Date().getTime() + 60000; => таймер на 1 минуту
|
5
|
+
*/
|
6
|
+
expiryTimestamp: number;
|
7
|
+
/**
|
8
|
+
* необязательное свойство типа boolean, которое указывает, должен ли таймер начинаться автоматически при создании компонента.
|
9
|
+
*/
|
10
|
+
autoStart?: boolean;
|
11
|
+
/**
|
12
|
+
* необязательная функция, которая вызывается, когда таймер истекает.
|
13
|
+
*/
|
14
|
+
onTimerEnd?: () => void;
|
15
|
+
/**
|
16
|
+
* Дополнительный класс.
|
17
|
+
*/
|
18
|
+
className?: string;
|
19
|
+
};
|
20
|
+
/**
|
21
|
+
* Компонент Timer отображает таймер с отсчетом времени в минутах и секундах.
|
22
|
+
*/
|
23
|
+
export declare const Timer: ({ expiryTimestamp, autoStart, onTimerEnd, className }: TProps) => import("react/jsx-runtime").JSX.Element;
|
24
|
+
export {};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { jsxs } from "react/jsx-runtime";
|
2
|
+
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
|
+
import { useTimer } from "../../hooks/useTimer/index.js";
|
4
|
+
import '../../assets/Timer.css';const timer = "_timer_llwad_3";
|
5
|
+
const cls = {
|
6
|
+
timer
|
7
|
+
};
|
8
|
+
const Timer = ({
|
9
|
+
expiryTimestamp,
|
10
|
+
autoStart = false,
|
11
|
+
onTimerEnd,
|
12
|
+
className
|
13
|
+
}) => {
|
14
|
+
const { minutes, seconds } = useTimer({
|
15
|
+
expiryTimestamp,
|
16
|
+
onExpire: onTimerEnd,
|
17
|
+
autoStart
|
18
|
+
});
|
19
|
+
const formattedMinutes = String(minutes).padStart(2, "0");
|
20
|
+
const formattedSeconds = String(seconds).padStart(2, "0");
|
21
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames(cls.timer, className), children: [
|
22
|
+
formattedMinutes,
|
23
|
+
":",
|
24
|
+
formattedSeconds
|
25
|
+
] });
|
26
|
+
};
|
27
|
+
export {
|
28
|
+
Timer
|
29
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Timer } from './Timer';
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { imageTypesArr } from './constants';
|
2
|
+
|
3
|
+
export type TUploader = {
|
4
|
+
/**
|
5
|
+
* Массив разрешенных типов файлов для настройки валидации
|
6
|
+
* 'jpeg' | 'png' | 'tiff'|'gif'|'doc'|'xls'|'pdf'|'docx' |'txt' | 'xlsx'
|
7
|
+
*/
|
8
|
+
filesType: imageTypesArr[];
|
9
|
+
/**
|
10
|
+
* Наименование передаваемого массива файлов
|
11
|
+
*/
|
12
|
+
name: string;
|
13
|
+
/**
|
14
|
+
* Функция - callback, которая вызывается при изменении значения и передает имя и новое значение
|
15
|
+
*/
|
16
|
+
onChangeValue: (e: TUploadValue) => void;
|
17
|
+
/**
|
18
|
+
* Максимальный размер файлов.
|
19
|
+
*/
|
20
|
+
maxSize: number;
|
21
|
+
};
|
22
|
+
export type TUploadValue = {
|
23
|
+
value: TFileItem[];
|
24
|
+
name?: string;
|
25
|
+
};
|
26
|
+
export type TFileItem = {
|
27
|
+
id: number;
|
28
|
+
file: File;
|
29
|
+
};
|
30
|
+
export declare function Uploader({ filesType, onChangeValue, name, maxSize }: TUploader): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
2
|
+
import { useId, useRef } from "react";
|
3
|
+
import { Icon } from "../../icons/Icon.js";
|
4
|
+
import { Button } from "../Button/Button.js";
|
5
|
+
import '../../assets/Uploader.css';const cls = {
|
6
|
+
"upload-file__wrapper": "_upload-file__wrapper_165vi_2",
|
7
|
+
"upload-text": "_upload-text_165vi_25",
|
8
|
+
"upload-file-input": "_upload-file-input_165vi_35"
|
9
|
+
};
|
10
|
+
const MIME = {
|
11
|
+
jpeg: "image/jpeg",
|
12
|
+
png: "image/png",
|
13
|
+
tiff: "image/tiff",
|
14
|
+
gif: "image/gif",
|
15
|
+
webp: "image/webp",
|
16
|
+
doc: "application/msword",
|
17
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
18
|
+
pdf: "application/pdf",
|
19
|
+
xls: "application/excel",
|
20
|
+
txt: "text/plain",
|
21
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
22
|
+
};
|
23
|
+
const filesTyps = ["jpeg", "png", "tiff", "gif"];
|
24
|
+
const generateId = (min, max) => {
|
25
|
+
return Math.random() * (max - min) + min;
|
26
|
+
};
|
27
|
+
function Uploader({
|
28
|
+
filesType = filesTyps,
|
29
|
+
onChangeValue,
|
30
|
+
name,
|
31
|
+
maxSize = 15
|
32
|
+
}) {
|
33
|
+
const idImg = useId();
|
34
|
+
const ref = useRef(null);
|
35
|
+
const onChange = (e) => {
|
36
|
+
if (e.target.files && e.target.files[0]) {
|
37
|
+
const list = [];
|
38
|
+
Array.from(e.target.files).forEach((el) => {
|
39
|
+
if (filesType.map((name2) => MIME[name2]).includes(el.type) && el.size / 1024 ** 2 <= maxSize) {
|
40
|
+
list.push({ file: el, id: generateId(1, 100) });
|
41
|
+
}
|
42
|
+
});
|
43
|
+
onChangeValue({ name, value: list });
|
44
|
+
}
|
45
|
+
};
|
46
|
+
const onOpen = () => {
|
47
|
+
var _a;
|
48
|
+
(_a = ref.current) == null ? void 0 : _a.click();
|
49
|
+
};
|
50
|
+
return /* @__PURE__ */ jsxs("div", { className: cls["upload-file__wrapper"], children: [
|
51
|
+
/* @__PURE__ */ jsx(
|
52
|
+
"input",
|
53
|
+
{
|
54
|
+
type: "file",
|
55
|
+
className: cls["upload-file-input"],
|
56
|
+
"aria-label": "Upload",
|
57
|
+
name: "image[]",
|
58
|
+
multiple: true,
|
59
|
+
onChange,
|
60
|
+
title: "",
|
61
|
+
id: idImg,
|
62
|
+
accept: filesType.map((i) => MIME[i]).join()
|
63
|
+
}
|
64
|
+
),
|
65
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: idImg, ref, children: [
|
66
|
+
/* @__PURE__ */ jsx(
|
67
|
+
Button,
|
68
|
+
{
|
69
|
+
size: "m",
|
70
|
+
variant: "secondary-asphalt",
|
71
|
+
leftIcon: /* @__PURE__ */ jsx(Icon, { iconName: "UnionIcon16px" }),
|
72
|
+
onClick: onOpen,
|
73
|
+
children: "Выберите файлы"
|
74
|
+
}
|
75
|
+
),
|
76
|
+
/* @__PURE__ */ jsx("b", { children: "Или перетащие сюда" }),
|
77
|
+
/* @__PURE__ */ jsxs("span", { className: cls["upload-text"], children: [
|
78
|
+
"Максимальный размер одного файла – ",
|
79
|
+
maxSize,
|
80
|
+
" Мб",
|
81
|
+
/* @__PURE__ */ jsx("br", {}),
|
82
|
+
"Загрузить можно файлы следующих форматов: ",
|
83
|
+
filesType.join(", ")
|
84
|
+
] })
|
85
|
+
] })
|
86
|
+
] });
|
87
|
+
}
|
88
|
+
export {
|
89
|
+
Uploader
|
90
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
const imageFileTypes = ["jpeg", "png", "tiff", "gif"];
|
2
|
+
const docsFileTypes = [
|
3
|
+
"doc",
|
4
|
+
"xls",
|
5
|
+
"pdf",
|
6
|
+
"docx",
|
7
|
+
"txt",
|
8
|
+
"xlsx"
|
9
|
+
];
|
10
|
+
const TypeFilesArray = {
|
11
|
+
images: imageFileTypes,
|
12
|
+
docs: docsFileTypes
|
13
|
+
};
|
14
|
+
export {
|
15
|
+
TypeFilesArray
|
16
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { imageTypesArr } from '../Uploader/constants';
|
2
|
+
import { TFileItem } from '../Uploader/Uploader';
|
3
|
+
|
4
|
+
export type TUploaderPhotos = {
|
5
|
+
/**
|
6
|
+
* Массив разрешенных типов файлов для настройки валидации
|
7
|
+
* 'jpeg' | 'png' | 'tiff' | 'gif' | 'doc' | 'xls' | 'pdf' |'docx' | 'txt'
|
8
|
+
*/
|
9
|
+
filesType: imageTypesArr[];
|
10
|
+
/**
|
11
|
+
* Наименование передаваемого массива файлов
|
12
|
+
*/
|
13
|
+
name: string;
|
14
|
+
/**
|
15
|
+
* Максимальный размер файлов.
|
16
|
+
*/
|
17
|
+
maxSize: number;
|
18
|
+
/**
|
19
|
+
* Функция обратного вызова, передает параметры type и data,
|
20
|
+
* type 'add' в data передает массив файлов,
|
21
|
+
* type:'delete' в data передает id удаленного файла
|
22
|
+
*/
|
23
|
+
onChange: (j: TOnChangePhotosUpdate) => void;
|
24
|
+
};
|
25
|
+
export type TOnChangePhotosUpdate = {
|
26
|
+
type: string;
|
27
|
+
data: TFileItem[] | number;
|
28
|
+
};
|
29
|
+
export declare function UploaderPhotos({ filesType, name, maxSize, onChange }: TUploaderPhotos): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
2
|
+
import { useState } from "react";
|
3
|
+
import { ListPhotos } from "../ListPhotos/ListPhotos.js";
|
4
|
+
import { Uploader } from "../Uploader/Uploader.js";
|
5
|
+
import '../../assets/UploaderPhotos.css';const cls = {
|
6
|
+
"upload-file__wrapper": "_upload-file__wrapper_udscq_2"
|
7
|
+
};
|
8
|
+
function UploaderPhotos({
|
9
|
+
filesType,
|
10
|
+
name,
|
11
|
+
maxSize,
|
12
|
+
onChange
|
13
|
+
}) {
|
14
|
+
const [photos, setPhotos] = useState([]);
|
15
|
+
const onChangeValue = (e) => {
|
16
|
+
setPhotos([
|
17
|
+
...photos,
|
18
|
+
...e.value.map((el) => {
|
19
|
+
return {
|
20
|
+
url: URL.createObjectURL(el.file),
|
21
|
+
id: el.id
|
22
|
+
};
|
23
|
+
})
|
24
|
+
]);
|
25
|
+
onChange == null ? void 0 : onChange({ type: "add", data: e.value });
|
26
|
+
};
|
27
|
+
const onDelete = (j) => {
|
28
|
+
setPhotos(j.list);
|
29
|
+
if (j.deleteId) onChange == null ? void 0 : onChange({ type: "delete", data: j.deleteId });
|
30
|
+
};
|
31
|
+
return /* @__PURE__ */ jsxs("div", { className: cls["upload-file__wrapper"], children: [
|
32
|
+
/* @__PURE__ */ jsx(
|
33
|
+
Uploader,
|
34
|
+
{
|
35
|
+
filesType,
|
36
|
+
name,
|
37
|
+
maxSize,
|
38
|
+
onChangeValue
|
39
|
+
}
|
40
|
+
),
|
41
|
+
/* @__PURE__ */ jsx(ListPhotos, { value: photos, onChange: onDelete })
|
42
|
+
] });
|
43
|
+
}
|
44
|
+
export {
|
45
|
+
UploaderPhotos
|
46
|
+
};
|
@@ -6,12 +6,27 @@ export type { TInputPasswordProps } from './InputPassword';
|
|
6
6
|
export { InputPhoneNumber, getMaskedInputPhoneValue, getUnmaskedInputValue } from './InputPhoneNumber';
|
7
7
|
export { OtpInput } from './OtpInput';
|
8
8
|
export { RadioGroup } from './RadioGroup';
|
9
|
-
export type { TRadioOption } from './RadioGroup';
|
9
|
+
export type { TRadioOption, TRadioGroupProps } from './RadioGroup';
|
10
|
+
export { DatePicker } from './DatePicker';
|
11
|
+
export type { TDatePickerProps, TDatePickerValue } from './DatePicker';
|
10
12
|
export { MergedButton } from './MergedButton';
|
11
13
|
export { EMergedButtonVariantRound } from './MergedButton';
|
12
14
|
export type { TButtonPropsWithoutStyles } from './MergedButton';
|
13
15
|
export { Image } from './Image';
|
14
16
|
export { Loader } from './Loader';
|
15
17
|
export { Slider } from './Slider';
|
18
|
+
export { Drawer } from './Drawer';
|
19
|
+
export { EDrawerPosition } from './Drawer';
|
16
20
|
export { Steps, EStepsPrimaryColor, EStepsSecondaryColor, EStepsSize, type TCommonStepsProps } from './Steps';
|
17
21
|
export { Vote, EVoteSize, type TCommonVoteProps } from './Vote';
|
22
|
+
export { SelectSearch, ESelectSearchSize } from './SelectSearch';
|
23
|
+
export type { TSelectSearchItem, TSelectSearchProps } from './SelectSearch';
|
24
|
+
export { Switch } from './Switch';
|
25
|
+
export type { TSwitchProps } from './Switch';
|
26
|
+
export { Tag, ETagSize, ETagType } from './Tag';
|
27
|
+
export { Timer } from './Timer';
|
28
|
+
export { Accordion, AccordionItem, EAccordionSize } from './Accordion';
|
29
|
+
export type { TAccordionProps, TAccordionItemProps } from './Accordion';
|
30
|
+
export { TabTrail, ETabTrailSize } from './TabTrail';
|
31
|
+
export type { TTabTrailProps, TCategoryTab } from './TabTrail';
|
32
|
+
export { Pagination } from './Pagination';
|
package/dist/components/index.js
CHANGED
@@ -7,27 +7,52 @@ import { InputPhoneNumber } from "./InputPhoneNumber/InputPhoneNumber.js";
|
|
7
7
|
import { getMaskedInputPhoneValue, getUnmaskedInputValue } from "./InputPhoneNumber/utils.js";
|
8
8
|
import { OtpInput } from "./OtpInput/OtpInput.js";
|
9
9
|
import { RadioGroup } from "./RadioGroup/RadioGroup.js";
|
10
|
+
import { DatePicker } from "./DatePicker/DatePicker.js";
|
10
11
|
import { MergedButton } from "./MergedButton/MergedButton.js";
|
11
12
|
import { EMergedButtonVariantRound } from "./MergedButton/constants.js";
|
12
13
|
import { AppImage } from "./Image/Image.js";
|
13
14
|
import { Loader } from "./Loader/Loader.js";
|
14
15
|
import { Slider } from "./Slider/Slider.js";
|
16
|
+
import { Drawer } from "./Drawer/Drawer.js";
|
17
|
+
import { EDrawerPosition } from "./Drawer/constants.js";
|
15
18
|
import { Steps } from "./Steps/Steps.js";
|
16
19
|
import { EStepsPrimaryColor, EStepsSecondaryColor, EStepsSize } from "./Steps/constants.js";
|
17
20
|
import { Vote } from "./Vote/Vote.js";
|
18
21
|
import { EVoteSize } from "./Vote/constants.js";
|
22
|
+
import { SelectSearch } from "./SelectSearch/SelectSearch.js";
|
23
|
+
import { ESelectSearchSize } from "./SelectSearch/constants.js";
|
24
|
+
import { Switch } from "./Switch/Switch.js";
|
25
|
+
import { Tag } from "./Tag/Tag.js";
|
26
|
+
import { ETagSize, ETagType } from "./Tag/constants.js";
|
27
|
+
import { Timer } from "./Timer/Timer.js";
|
28
|
+
import { Accordion } from "./Accordion/Accordion.js";
|
29
|
+
import { EAccordionSize } from "./Accordion/constants.js";
|
30
|
+
import { AccordionItem } from "./Accordion/AccordionItem/AccordionItem.js";
|
31
|
+
import { TabTrail } from "./TabTrail/TabTrail.js";
|
32
|
+
import { ETabTrailSize } from "./TabTrail/constants.js";
|
33
|
+
import { Pagination } from "./Pagination/Pagination.js";
|
19
34
|
export {
|
35
|
+
Accordion,
|
36
|
+
AccordionItem,
|
20
37
|
Button,
|
38
|
+
DatePicker,
|
39
|
+
Drawer,
|
40
|
+
EAccordionSize,
|
21
41
|
EButtonForm,
|
22
42
|
EButtonSize,
|
23
43
|
EButtonVariantDefault,
|
24
44
|
EButtonVariantRound,
|
45
|
+
EDrawerPosition,
|
25
46
|
EInputSize,
|
26
47
|
EInputVariant,
|
27
48
|
EMergedButtonVariantRound,
|
49
|
+
ESelectSearchSize,
|
28
50
|
EStepsPrimaryColor,
|
29
51
|
EStepsSecondaryColor,
|
30
52
|
EStepsSize,
|
53
|
+
ETabTrailSize,
|
54
|
+
ETagSize,
|
55
|
+
ETagType,
|
31
56
|
EVoteSize,
|
32
57
|
AppImage as Image,
|
33
58
|
Input,
|
@@ -36,9 +61,15 @@ export {
|
|
36
61
|
Loader,
|
37
62
|
MergedButton,
|
38
63
|
OtpInput,
|
64
|
+
Pagination,
|
39
65
|
RadioGroup,
|
66
|
+
SelectSearch,
|
40
67
|
Slider,
|
41
68
|
Steps,
|
69
|
+
Switch,
|
70
|
+
TabTrail,
|
71
|
+
Tag,
|
72
|
+
Timer,
|
42
73
|
Vote,
|
43
74
|
getMaskedInputPhoneValue,
|
44
75
|
getUnmaskedInputValue
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import { u, a as u$1 } from "./keyboard-B256ZoM-.js";
|
2
|
+
let f = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","), p = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
|
3
|
+
var F = ((n) => (n[n.First = 1] = "First", n[n.Previous = 2] = "Previous", n[n.Next = 4] = "Next", n[n.Last = 8] = "Last", n[n.WrapAround = 16] = "WrapAround", n[n.NoScroll = 32] = "NoScroll", n[n.AutoFocus = 64] = "AutoFocus", n))(F || {}), T = ((o) => (o[o.Error = 0] = "Error", o[o.Overflow = 1] = "Overflow", o[o.Success = 2] = "Success", o[o.Underflow = 3] = "Underflow", o))(T || {}), y = ((t) => (t[t.Previous = -1] = "Previous", t[t.Next = 1] = "Next", t))(y || {});
|
4
|
+
function b(e = document.body) {
|
5
|
+
return e == null ? [] : Array.from(e.querySelectorAll(f)).sort((r, t) => Math.sign((r.tabIndex || Number.MAX_SAFE_INTEGER) - (t.tabIndex || Number.MAX_SAFE_INTEGER)));
|
6
|
+
}
|
7
|
+
function S(e = document.body) {
|
8
|
+
return e == null ? [] : Array.from(e.querySelectorAll(p)).sort((r, t) => Math.sign((r.tabIndex || Number.MAX_SAFE_INTEGER) - (t.tabIndex || Number.MAX_SAFE_INTEGER)));
|
9
|
+
}
|
10
|
+
var h = ((t) => (t[t.Strict = 0] = "Strict", t[t.Loose = 1] = "Loose", t))(h || {});
|
11
|
+
function A(e, r = 0) {
|
12
|
+
var t;
|
13
|
+
return e === ((t = u(e)) == null ? void 0 : t.body) ? false : u$1(r, { [0]() {
|
14
|
+
return e.matches(f);
|
15
|
+
}, [1]() {
|
16
|
+
let u2 = e;
|
17
|
+
for (; u2 !== null; ) {
|
18
|
+
if (u2.matches(f)) return true;
|
19
|
+
u2 = u2.parentElement;
|
20
|
+
}
|
21
|
+
return false;
|
22
|
+
} });
|
23
|
+
}
|
24
|
+
var H = ((t) => (t[t.Keyboard = 0] = "Keyboard", t[t.Mouse = 1] = "Mouse", t))(H || {});
|
25
|
+
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e) => {
|
26
|
+
e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
27
|
+
}, true), document.addEventListener("click", (e) => {
|
28
|
+
e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
29
|
+
}, true));
|
30
|
+
let w = ["textarea", "input"].join(",");
|
31
|
+
function O(e) {
|
32
|
+
var r, t;
|
33
|
+
return (t = (r = e == null ? void 0 : e.matches) == null ? void 0 : r.call(e, w)) != null ? t : false;
|
34
|
+
}
|
35
|
+
function _(e, r = (t) => t) {
|
36
|
+
return e.slice().sort((t, u2) => {
|
37
|
+
let o = r(t), c = r(u2);
|
38
|
+
if (o === null || c === null) return 0;
|
39
|
+
let l = o.compareDocumentPosition(c);
|
40
|
+
return l & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : l & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
41
|
+
});
|
42
|
+
}
|
43
|
+
function P(e, r, { sorted: t = true, relativeTo: u2 = null, skipElements: o = [] } = {}) {
|
44
|
+
let c = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, l = Array.isArray(e) ? t ? _(e) : e : r & 64 ? S(e) : b(e);
|
45
|
+
o.length > 0 && l.length > 1 && (l = l.filter((s) => !o.some((a) => a != null && "current" in a ? (a == null ? void 0 : a.current) === s : a === s))), u2 = u2 != null ? u2 : c.activeElement;
|
46
|
+
let n = (() => {
|
47
|
+
if (r & 5) return 1;
|
48
|
+
if (r & 10) return -1;
|
49
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
50
|
+
})(), x = (() => {
|
51
|
+
if (r & 1) return 0;
|
52
|
+
if (r & 2) return Math.max(0, l.indexOf(u2)) - 1;
|
53
|
+
if (r & 4) return Math.max(0, l.indexOf(u2)) + 1;
|
54
|
+
if (r & 8) return l.length - 1;
|
55
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
56
|
+
})(), M = r & 32 ? { preventScroll: true } : {}, m = 0, d = l.length, i;
|
57
|
+
do {
|
58
|
+
if (m >= d || m + d <= 0) return 0;
|
59
|
+
let s = x + m;
|
60
|
+
if (r & 16) s = (s + d) % d;
|
61
|
+
else {
|
62
|
+
if (s < 0) return 3;
|
63
|
+
if (s >= d) return 1;
|
64
|
+
}
|
65
|
+
i = l[s], i == null || i.focus(M), m += n;
|
66
|
+
} while (i !== c.activeElement);
|
67
|
+
return r & 6 && O(i) && i.select(), 2;
|
68
|
+
}
|
69
|
+
export {
|
70
|
+
A,
|
71
|
+
F,
|
72
|
+
P,
|
73
|
+
T,
|
74
|
+
_,
|
75
|
+
f,
|
76
|
+
h
|
77
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { W, H } from "./keyboard-B256ZoM-.js";
|
2
|
+
let a = "span";
|
3
|
+
var s = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(s || {});
|
4
|
+
function l(t, r) {
|
5
|
+
var n;
|
6
|
+
let { features: d = 1, ...e } = t, o = { ref: r, "aria-hidden": (d & 2) === 2 ? true : (n = e["aria-hidden"]) != null ? n : void 0, hidden: (d & 4) === 4 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(d & 4) === 4 && (d & 2) !== 2 && { display: "none" } } };
|
7
|
+
return H({ ourProps: o, theirProps: e, slot: {}, defaultTag: a, name: "Hidden" });
|
8
|
+
}
|
9
|
+
let T = W(l);
|
10
|
+
export {
|
11
|
+
T,
|
12
|
+
s
|
13
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
import { useMediaQuery } from "./useMediaQuery/useMediaQuery.js";
|
2
2
|
import { EMediaQuery } from "./useMediaQuery/constants.js";
|
3
|
+
import { useLockBodyScroll } from "./useLockBodyScroll/useLockBodyScroll.js";
|
4
|
+
import { useInterval } from "./useInterval/useInterval.js";
|
5
|
+
import { useTimer } from "./useTimer/index.js";
|
3
6
|
export {
|
4
7
|
EMediaQuery,
|
5
|
-
|
8
|
+
useInterval,
|
9
|
+
useLockBodyScroll,
|
10
|
+
useMediaQuery,
|
11
|
+
useTimer
|
6
12
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { useClickOutside } from './useClickOutside';
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { useEffect } from "react";
|
2
|
+
function useClickOutside({
|
3
|
+
isActive,
|
4
|
+
setActive,
|
5
|
+
className
|
6
|
+
}) {
|
7
|
+
useEffect(() => {
|
8
|
+
const handleClickOtside = (e) => {
|
9
|
+
if (e.target) {
|
10
|
+
if (!e.target.closest("." + className)) {
|
11
|
+
setActive(false);
|
12
|
+
window.removeEventListener("click", handleClickOtside, true);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
};
|
16
|
+
if (isActive) {
|
17
|
+
window.addEventListener("click", handleClickOtside, true);
|
18
|
+
} else {
|
19
|
+
window.removeEventListener("click", handleClickOtside, true);
|
20
|
+
}
|
21
|
+
}, [isActive]);
|
22
|
+
}
|
23
|
+
export {
|
24
|
+
useClickOutside
|
25
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { useInterval } from './useInterval';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function useInterval(callback: VoidFunction, delay: number | null): void;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { useRef, useEffect } from "react";
|
2
|
+
function useInterval(callback, delay) {
|
3
|
+
const callbackRef = useRef();
|
4
|
+
callbackRef.current = callback;
|
5
|
+
useEffect(() => {
|
6
|
+
if (!delay) {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
const interval = setInterval(() => {
|
10
|
+
callbackRef.current && callbackRef.current();
|
11
|
+
}, delay);
|
12
|
+
return () => clearInterval(interval);
|
13
|
+
}, [delay]);
|
14
|
+
}
|
15
|
+
export {
|
16
|
+
useInterval
|
17
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { useLockBodyScroll } from './useLockBodyScroll';
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { useLayoutEffect } from "react";
|
2
|
+
function useLockBodyScroll({ on, paddingRight }) {
|
3
|
+
useLayoutEffect(() => {
|
4
|
+
const hasVerticalScrollbar = document.documentElement.scrollHeight > document.documentElement.clientHeight;
|
5
|
+
if (!on || !hasVerticalScrollbar) return;
|
6
|
+
const originalStyle = window.getComputedStyle(document.body).overflow;
|
7
|
+
const originalPaddingStyle = window.getComputedStyle(
|
8
|
+
document.body
|
9
|
+
).paddingRight;
|
10
|
+
document.body.style.overflow = "hidden";
|
11
|
+
document.body.style.paddingRight = `${paddingRight}px`;
|
12
|
+
return () => {
|
13
|
+
document.body.style.overflow = originalStyle;
|
14
|
+
document.body.style.paddingRight = originalPaddingStyle;
|
15
|
+
};
|
16
|
+
}, [on, paddingRight]);
|
17
|
+
}
|
18
|
+
export {
|
19
|
+
useLockBodyScroll
|
20
|
+
};
|