mimir-ui-kit 1.4.1 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/dist/{NavigationButtons-B8tMfqrg.js → NavigationButtons-cTsXB7GS.js} +18 -18
  3. package/dist/assets/Button.css +1 -1
  4. package/dist/assets/OtpInput.css +1 -1
  5. package/dist/assets/RadioGroup.css +1 -1
  6. package/dist/assets/SelectSearch.css +1 -0
  7. package/dist/assets/Slider.css +1 -1
  8. package/dist/assets/index.css +1 -1
  9. package/dist/components/Button/Button.d.ts +1 -0
  10. package/dist/components/Button/Button.js +24 -24
  11. package/dist/components/Input/Input.js +1 -1
  12. package/dist/components/InputPassword/InputPassword.js +2 -2
  13. package/dist/components/InputPhoneNumber/InputPhoneNumber.js +1 -1
  14. package/dist/components/MergedButton/MergedButton.d.ts +1 -1
  15. package/dist/components/MergedButton/MergedButton.js +2 -2
  16. package/dist/components/OtpInput/OtpInput.js +6 -6
  17. package/dist/components/RadioGroup/RadioGroup.js +78 -1019
  18. package/dist/components/SelectSearch/SelectSearch.d.ts +21 -0
  19. package/dist/components/SelectSearch/SelectSearch.js +3989 -0
  20. package/dist/components/SelectSearch/constants.d.ts +4 -0
  21. package/dist/components/SelectSearch/constants.js +8 -0
  22. package/dist/components/SelectSearch/index.d.ts +3 -0
  23. package/dist/components/SelectSearch/index.js +6 -0
  24. package/dist/components/SelectSearch/types.d.ts +17 -0
  25. package/dist/components/SelectSearch/types.js +1 -0
  26. package/dist/components/Slider/NavigationButtons/NavigationButtons.js +1 -1
  27. package/dist/components/Slider/NavigationButtons/index.js +1 -1
  28. package/dist/components/Slider/Slider.js +10 -10
  29. package/dist/components/index.d.ts +2 -2
  30. package/dist/components/index.js +4 -4
  31. package/dist/focus-management-4cCSLNHi.js +1000 -0
  32. package/dist/hooks/index.d.ts +0 -1
  33. package/dist/hooks/index.js +0 -2
  34. package/dist/index.js +4 -6
  35. package/package.json +1 -1
  36. package/dist/assets/Drawer.css +0 -1
  37. package/dist/components/Drawer/Drawer.d.ts +0 -38
  38. package/dist/components/Drawer/Drawer.js +0 -144
  39. package/dist/components/Drawer/constants.d.ts +0 -5
  40. package/dist/components/Drawer/constants.js +0 -9
  41. package/dist/components/Drawer/index.d.ts +0 -2
  42. package/dist/components/Drawer/index.js +0 -6
  43. package/dist/components/Portal/Portal.d.ts +0 -7
  44. package/dist/components/Portal/Portal.js +0 -10
  45. package/dist/components/Portal/index.d.ts +0 -1
  46. package/dist/components/Portal/index.js +0 -4
  47. package/dist/hooks/useLockBodyScroll/index.d.ts +0 -1
  48. package/dist/hooks/useLockBodyScroll/index.js +0 -4
  49. package/dist/hooks/useLockBodyScroll/useLockBodyScroll.d.ts +0 -6
  50. package/dist/hooks/useLockBodyScroll/useLockBodyScroll.js +0 -20
@@ -1,2 +1 @@
1
1
  export { useMediaQuery, EMediaQuery } from './useMediaQuery';
2
- export { useLockBodyScroll } from './useLockBodyScroll';
@@ -1,8 +1,6 @@
1
1
  import { useMediaQuery } from "./useMediaQuery/useMediaQuery.js";
2
2
  import { EMediaQuery } from "./useMediaQuery/constants.js";
3
- import { useLockBodyScroll } from "./useLockBodyScroll/useLockBodyScroll.js";
4
3
  export {
5
4
  EMediaQuery,
6
- useLockBodyScroll,
7
5
  useMediaQuery
8
6
  };
package/dist/index.js CHANGED
@@ -12,28 +12,26 @@ import { EMergedButtonVariantRound } from "./components/MergedButton/constants.j
12
12
  import { AppImage } from "./components/Image/Image.js";
13
13
  import { Loader } from "./components/Loader/Loader.js";
14
14
  import { Slider } from "./components/Slider/Slider.js";
15
- import { Drawer } from "./components/Drawer/Drawer.js";
16
- import { EDrawerPosition } from "./components/Drawer/constants.js";
17
15
  import { Steps } from "./components/Steps/Steps.js";
18
16
  import { EStepsPrimaryColor, EStepsSecondaryColor, EStepsSize } from "./components/Steps/constants.js";
19
17
  import { Vote } from "./components/Vote/Vote.js";
20
18
  import { EVoteSize } from "./components/Vote/constants.js";
19
+ import { SelectSearch } from "./components/SelectSearch/SelectSearch.js";
20
+ import { ESelectSearchSize } from "./components/SelectSearch/constants.js";
21
21
  import { useMediaQuery } from "./hooks/useMediaQuery/useMediaQuery.js";
22
22
  import { EMediaQuery } from "./hooks/useMediaQuery/constants.js";
23
- import { useLockBodyScroll } from "./hooks/useLockBodyScroll/useLockBodyScroll.js";
24
23
  import { Icon } from "./icons/Icon.js";
25
24
  import './assets/index.css';export {
26
25
  Button,
27
- Drawer,
28
26
  EButtonForm,
29
27
  EButtonSize,
30
28
  EButtonVariantDefault,
31
29
  EButtonVariantRound,
32
- EDrawerPosition,
33
30
  EInputSize,
34
31
  EInputVariant,
35
32
  EMediaQuery,
36
33
  EMergedButtonVariantRound,
34
+ ESelectSearchSize,
37
35
  EStepsPrimaryColor,
38
36
  EStepsSecondaryColor,
39
37
  EStepsSize,
@@ -47,11 +45,11 @@ import './assets/index.css';export {
47
45
  MergedButton,
48
46
  OtpInput,
49
47
  RadioGroup,
48
+ SelectSearch,
50
49
  Slider,
51
50
  Steps,
52
51
  Vote,
53
52
  getMaskedInputPhoneValue,
54
53
  getUnmaskedInputValue,
55
- useLockBodyScroll,
56
54
  useMediaQuery
57
55
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.4.1",
4
+ "version": "1.5.1",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -1 +0,0 @@
1
- ._drawer_vy4rv_3{--drawer-width: 808px;--drawer-z-index: 1000;position:fixed;z-index:1000;z-index:var(--drawer-z-index);display:flex;flex-direction:column;width:808px;width:var(--drawer-width);height:100%;overflow:auto;background-color:var(--black-5);transition:all .3s ease;pointer-events:none}._drawer_vy4rv_3 ._content_vy4rv_17{position:relative;z-index:var(--modal-z-index);display:flex;flex:1;flex-direction:column;padding:var(--space-m) var(--space-4xl) var(--space-4xl);transition:all .3s ease}@media (max-width: 600px){._drawer_vy4rv_3 ._content_vy4rv_17{--drawer-width: 100%;padding:var(--space-m)}}._drawer_vy4rv_3 ._header_vy4rv_32{display:flex;gap:var(--space-xs);height:68px}._drawer_vy4rv_3 ._header_vy4rv_32:not(:last-child){margin-bottom:var(--space-2xl)}._drawer_vy4rv_3 ._header_vy4rv_32 ._title_vy4rv_40{flex:1;align-self:flex-end;font-weight:var(--font-weight-text-medium);font-size:var(--size-text-xl3);line-height:var(--line-height-text-s1);letter-spacing:.7px}@media (max-width: 600px){._drawer_vy4rv_3 ._header_vy4rv_32 ._title_vy4rv_40{font-size:var(--size-text-xl2);line-height:var(--line-height-text-xs)}}._drawer_vy4rv_3 ._header_vy4rv_32 ._space_vy4rv_54{flex:0 0 var(--button-height-m)}@media (max-width: 600px){._drawer_vy4rv_3 ._header_vy4rv_32{height:55px}._drawer_vy4rv_3 ._header_vy4rv_32:not(:last-child){margin-bottom:var(--space-m)}}._drawer_vy4rv_3 ._inner_vy4rv_65{flex:1}._drawer_vy4rv_3 ._button_vy4rv_68{position:absolute;top:var(--space-m);right:var(--space-m)}._drawer_vy4rv_3 ._footer_vy4rv_73{display:block;padding-top:var(--space-4xl)}@media (max-width: 600px){._drawer_vy4rv_3 ._footer_vy4rv_73{padding-top:var(--space-m)}}._drawer_vy4rv_3 ._footer-button_vy4rv_82{display:block;margin-left:auto}._drawer_vy4rv_3._left_vy4rv_86{top:0;left:-100%}._drawer_vy4rv_3._right_vy4rv_90{top:0;right:-100%}._drawer_vy4rv_3._bottom_vy4rv_94{right:50%;bottom:-100%;left:50%;max-height:80vh;border-top-left-radius:var(--control-radius);border-top-right-radius:var(--control-radius);transform:translate(-50%)}._drawer_vy4rv_3._opened_vy4rv_103{transition:all .3s ease;pointer-events:auto}._drawer_vy4rv_3._opened_vy4rv_103._left_vy4rv_86{left:0%;transition:left .3s ease}._drawer_vy4rv_3._opened_vy4rv_103._right_vy4rv_90{right:0%;transition:right .3s ease}._drawer_vy4rv_3._opened_vy4rv_103._bottom_vy4rv_94{bottom:0%}._drawer_vy4rv_3._is-closing_vy4rv_118._left_vy4rv_86{left:-100%}._drawer_vy4rv_3._is-closing_vy4rv_118._right_vy4rv_90{right:-100%}._drawer_vy4rv_3._is-closing_vy4rv_118._bottom_vy4rv_94{bottom:-100%}@media (max-width: 1440px){._drawer_vy4rv_3{--drawer-width: 608px}}@media (max-width: 1280px){._drawer_vy4rv_3{--drawer-width: 648px}}@media (max-width: 768px){._drawer_vy4rv_3{--drawer-width: 584px}}@media (max-width: 600px){._drawer_vy4rv_3{--drawer-width: 100%}._drawer_vy4rv_3._bottom_vy4rv_94{max-width:359px}}._overlay_vy4rv_151{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0009;opacity:0;transition:all .3s ease}._overlay_vy4rv_151._opened_vy4rv_103{opacity:1;transition:all .3s ease}._overlay_vy4rv_151._is-closing_vy4rv_118{opacity:0;transition:all .3s ease}
@@ -1,38 +0,0 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
2
- import { EDrawerPosition } from './constants';
3
-
4
- type TProps = {
5
- /**
6
- * Обязательный заголовок.
7
- */
8
- title: string;
9
- /**
10
- * Флаг отвечачающий за показ/скрытие.
11
- */
12
- isOpen?: boolean;
13
- /**
14
- * Настраиваемый паддинг для body, что бы избежать скачка контента при overflow: hidden
15
- */
16
- paddingRight?: number;
17
- /**
18
- * Функция закрытия шторки
19
- */
20
- onClose?: VoidFunction;
21
- /**
22
- * Дополнительный класс для родительской обертки.
23
- */
24
- className?: string;
25
- /**
26
- * Позиция шторки.
27
- */
28
- position?: `${EDrawerPosition}` | EDrawerPosition;
29
- /**
30
- * Кастомный footer. По дефолту в нем расположена кнопка для закрытия.
31
- */
32
- footer?: ReactNode;
33
- };
34
- /**
35
- * Компонент шторки, который может выезжать слева, справа или внизу.
36
- */
37
- export declare const Drawer: ({ isOpen, onClose, title, className, position, paddingRight, footer, children }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element | null;
38
- export {};
@@ -1,144 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { c as classNames } from "../../index-CweZ_OcN.js";
3
- import { useState, useRef, useCallback, useEffect } from "react";
4
- import { EDrawerPosition } from "./constants.js";
5
- import { useMediaQuery } from "../../hooks/useMediaQuery/useMediaQuery.js";
6
- import { EMediaQuery } from "../../hooks/useMediaQuery/constants.js";
7
- import { useLockBodyScroll } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
8
- import { Button } from "../Button/Button.js";
9
- import { EButtonVariantDefault, EButtonSize } from "../Button/constants.js";
10
- import { Portal } from "../Portal/Portal.js";
11
- import '../../assets/Drawer.css';const drawer = "_drawer_vy4rv_3";
12
- const content = "_content_vy4rv_17";
13
- const header = "_header_vy4rv_32";
14
- const title = "_title_vy4rv_40";
15
- const space = "_space_vy4rv_54";
16
- const inner = "_inner_vy4rv_65";
17
- const button = "_button_vy4rv_68";
18
- const footer = "_footer_vy4rv_73";
19
- const left = "_left_vy4rv_86";
20
- const right = "_right_vy4rv_90";
21
- const bottom = "_bottom_vy4rv_94";
22
- const opened = "_opened_vy4rv_103";
23
- const overlay = "_overlay_vy4rv_151";
24
- const cls = {
25
- drawer,
26
- content,
27
- header,
28
- title,
29
- space,
30
- inner,
31
- button,
32
- footer,
33
- "footer-button": "_footer-button_vy4rv_82",
34
- left,
35
- right,
36
- bottom,
37
- opened,
38
- "is-closing": "_is-closing_vy4rv_118",
39
- overlay
40
- };
41
- const ANIMATION_DELAY = 300;
42
- const Drawer = ({
43
- isOpen,
44
- onClose,
45
- title: title2,
46
- className,
47
- position = EDrawerPosition.RIGHT,
48
- paddingRight = 8,
49
- footer: footer2,
50
- children
51
- }) => {
52
- const [isClosing, setIsClosing] = useState(false);
53
- const [isMounted, setIsMounted] = useState(false);
54
- const [isBodyScrollLocked, setIsBodyScrollLocked] = useState(false);
55
- const timerRef = useRef();
56
- const contentRef = useRef(null);
57
- const isBottomPosition = position === EDrawerPosition.BOTTOM;
58
- const isMobile = useMediaQuery(EMediaQuery.XS1);
59
- useLockBodyScroll({
60
- on: isBodyScrollLocked,
61
- paddingRight
62
- });
63
- const handleClose = useCallback(() => {
64
- if (onClose) {
65
- setIsClosing(true);
66
- setIsBodyScrollLocked(false);
67
- timerRef.current = setTimeout(() => {
68
- onClose();
69
- setIsClosing(false);
70
- }, ANIMATION_DELAY);
71
- }
72
- }, [onClose]);
73
- const handleKeyDown = useCallback(
74
- (event) => {
75
- if (event.key === "Escape") {
76
- handleClose();
77
- }
78
- },
79
- [handleClose]
80
- );
81
- useEffect(() => {
82
- if (isOpen) {
83
- setIsBodyScrollLocked(true);
84
- setIsMounted(true);
85
- window.addEventListener("keydown", handleKeyDown);
86
- }
87
- return () => {
88
- setIsMounted(false);
89
- clearTimeout(timerRef.current);
90
- window.removeEventListener("keydown", handleKeyDown);
91
- };
92
- }, [isOpen, handleKeyDown]);
93
- const mods = {
94
- [cls.opened]: isMounted,
95
- [cls["is-closing"]]: isClosing
96
- };
97
- if (!isOpen) {
98
- return null;
99
- }
100
- return /* @__PURE__ */ jsxs(Portal, { children: [
101
- /* @__PURE__ */ jsx(
102
- "div",
103
- {
104
- "aria-hidden": isOpen,
105
- role: "dialog",
106
- style: {
107
- minHeight: isBottomPosition && contentRef.current ? contentRef.current.offsetHeight : void 0
108
- },
109
- className: classNames(cls.drawer, cls[position], mods, className),
110
- children: /* @__PURE__ */ jsxs("section", { className: classNames(cls.content, cls[position]), children: [
111
- /* @__PURE__ */ jsxs("header", { className: cls.header, children: [
112
- /* @__PURE__ */ jsx("h2", { className: cls.title, children: title2 }),
113
- /* @__PURE__ */ jsx("div", { className: cls.space, children: /* @__PURE__ */ jsx(
114
- Button,
115
- {
116
- variant: EButtonVariantDefault.SecondaryWhite,
117
- isIconButton: true,
118
- size: isMobile ? EButtonSize.S : EButtonSize.M,
119
- iconName: "Close16px",
120
- onClick: handleClose,
121
- className: cls.button
122
- }
123
- ) })
124
- ] }),
125
- /* @__PURE__ */ jsx("div", { ref: contentRef, className: cls.inner, children }),
126
- /* @__PURE__ */ jsx("footer", { className: cls.footer, children: footer2 || /* @__PURE__ */ jsx(
127
- Button,
128
- {
129
- size: isMobile ? EButtonSize.M : EButtonSize.XXL,
130
- full: isMobile,
131
- onClick: handleClose,
132
- className: cls["footer-button"],
133
- children: "Закрыть"
134
- }
135
- ) })
136
- ] })
137
- }
138
- ),
139
- /* @__PURE__ */ jsx("div", { className: classNames(cls.overlay, mods), onClick: handleClose })
140
- ] });
141
- };
142
- export {
143
- Drawer
144
- };
@@ -1,5 +0,0 @@
1
- export declare enum EDrawerPosition {
2
- LEFT = "left",
3
- RIGHT = "right",
4
- BOTTOM = "bottom"
5
- }
@@ -1,9 +0,0 @@
1
- var EDrawerPosition = /* @__PURE__ */ ((EDrawerPosition2) => {
2
- EDrawerPosition2["LEFT"] = "left";
3
- EDrawerPosition2["RIGHT"] = "right";
4
- EDrawerPosition2["BOTTOM"] = "bottom";
5
- return EDrawerPosition2;
6
- })(EDrawerPosition || {});
7
- export {
8
- EDrawerPosition
9
- };
@@ -1,2 +0,0 @@
1
- export { Drawer } from './Drawer';
2
- export { EDrawerPosition } from './constants';
@@ -1,6 +0,0 @@
1
- import { Drawer } from "./Drawer.js";
2
- import { EDrawerPosition } from "./constants.js";
3
- export {
4
- Drawer,
5
- EDrawerPosition
6
- };
@@ -1,7 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
-
3
- type TProps = {
4
- element?: HTMLElement;
5
- };
6
- export declare const Portal: ({ element, children }: PropsWithChildren<TProps>) => import('react').ReactPortal;
7
- export {};
@@ -1,10 +0,0 @@
1
- import { createPortal } from "react-dom";
2
- const Portal = ({
3
- element = document.body,
4
- children
5
- }) => {
6
- return createPortal(children, element);
7
- };
8
- export {
9
- Portal
10
- };
@@ -1 +0,0 @@
1
- export { Portal } from './Portal';
@@ -1,4 +0,0 @@
1
- import { Portal } from "./Portal.js";
2
- export {
3
- Portal
4
- };
@@ -1 +0,0 @@
1
- export { useLockBodyScroll } from './useLockBodyScroll';
@@ -1,4 +0,0 @@
1
- import { useLockBodyScroll } from "./useLockBodyScroll.js";
2
- export {
3
- useLockBodyScroll
4
- };
@@ -1,6 +0,0 @@
1
- type TUseLockBodyScroll = {
2
- on?: boolean;
3
- paddingRight?: number;
4
- };
5
- export declare function useLockBodyScroll({ on, paddingRight }: TUseLockBodyScroll): void;
6
- export {};
@@ -1,20 +0,0 @@
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
- };