mimir-ui-kit 1.24.4 → 1.26.0
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.
@@ -2,14 +2,33 @@ import { ReactNode } from 'react';
|
|
2
2
|
import { EAccordionButtonStyle, EAccordionButtonType, EAccordionIconType, EAccordionSize } from './constants';
|
3
3
|
|
4
4
|
export type TAccordionProps = {
|
5
|
+
/** Заголовок аккордеона */
|
5
6
|
title: string;
|
7
|
+
/** Содержимое аккордеона */
|
6
8
|
children: ReactNode;
|
9
|
+
/** Размер аккордеона */
|
7
10
|
size?: EAccordionSize;
|
11
|
+
/** Преобразование заголовка в верхний регистр */
|
8
12
|
titleUppercase?: boolean;
|
13
|
+
/** Тип кнопки аккордеона */
|
9
14
|
buttonType?: EAccordionButtonType | `${EAccordionButtonType}`;
|
15
|
+
/** Стиль кнопки аккордеона */
|
10
16
|
buttonStyle?: EAccordionButtonStyle | `${EAccordionButtonStyle}`;
|
17
|
+
/** Тип иконки аккордеона */
|
11
18
|
iconType?: EAccordionIconType | `${EAccordionIconType}`;
|
19
|
+
/** Дополнительный класс для заголовка */
|
12
20
|
classNameTitle?: string;
|
21
|
+
/** Дополнительный класс для содержимого */
|
13
22
|
classNameContent?: string;
|
23
|
+
/** Дополнительный класс для всего аккордеона */
|
24
|
+
classNameAccordion?: string;
|
25
|
+
/** Дополнительный класс для кнопки с иконкой */
|
26
|
+
classNameIconButton?: string;
|
27
|
+
/** React-нода для отображения под заголовком */
|
28
|
+
subtitleNode?: ReactNode;
|
29
|
+
/** React-нода для отображения под заголовком когда аккордеон открыт */
|
30
|
+
onlyOpenSubtitleNode?: ReactNode;
|
31
|
+
/** Дополнительный класс для контейнера subtitle */
|
32
|
+
classNameSubtitleContainer?: string;
|
14
33
|
};
|
15
34
|
export declare const Accordion: import('react').ForwardRefExoticComponent<TAccordionProps & import('react').RefAttributes<HTMLElement>>;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { jsxs, Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
2
2
|
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
|
-
import React__default, { createContext, useRef, Fragment, useReducer, useMemo, useId, useEffect, useContext, forwardRef } from "react";
|
3
|
+
import React__default, { createContext, useRef, Fragment, useReducer, useMemo, useId, useEffect, useContext, forwardRef, useState } from "react";
|
4
4
|
import { AccordionItem } from "./AccordionItem/AccordionItem.js";
|
5
5
|
import { EAccordionButtonType, EAccordionSize, EAccordionButtonStyle, EAccordionIconType, EAccordionLinkIconSize, EAccordionButtonIconSize } from "./constants.js";
|
6
6
|
import { useMediaQuery } from "../../hooks/useMediaQuery/useMediaQuery.js";
|
@@ -155,8 +155,14 @@ const Accordion = forwardRef(
|
|
155
155
|
buttonStyle = EAccordionButtonStyle.CIRCLE,
|
156
156
|
iconType = EAccordionIconType.ARROW,
|
157
157
|
classNameTitle,
|
158
|
-
classNameContent
|
158
|
+
classNameContent,
|
159
|
+
classNameAccordion,
|
160
|
+
classNameIconButton,
|
161
|
+
subtitleNode,
|
162
|
+
onlyOpenSubtitleNode,
|
163
|
+
classNameSubtitleContainer
|
159
164
|
}, ref) => {
|
165
|
+
const [isOpen, setIsOpen] = useState(false);
|
160
166
|
const isMobile = useMediaQuery(EMediaQuery.XS1);
|
161
167
|
const isLink = buttonType === "link";
|
162
168
|
const linkClasses = {
|
@@ -206,7 +212,8 @@ const Accordion = forwardRef(
|
|
206
212
|
className: classNames(
|
207
213
|
cls["icon-container"],
|
208
214
|
open2 && cls.open,
|
209
|
-
cls[buttonStyle]
|
215
|
+
cls[buttonStyle],
|
216
|
+
classNameIconButton
|
210
217
|
),
|
211
218
|
children: /* @__PURE__ */ jsx(Icon, { iconName: getIconName(), className: cls.icon })
|
212
219
|
}
|
@@ -218,27 +225,51 @@ const Accordion = forwardRef(
|
|
218
225
|
}
|
219
226
|
}
|
220
227
|
};
|
221
|
-
return /* @__PURE__ */
|
228
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
222
229
|
/* @__PURE__ */ jsx(
|
223
|
-
|
224
|
-
{
|
225
|
-
as: isLink ? Fragment : EAccordionButtonType.BUTTON,
|
226
|
-
className: classNames({ [cls.header]: !isLink }),
|
227
|
-
children: renderButton(open2)
|
228
|
-
}
|
229
|
-
),
|
230
|
-
/* @__PURE__ */ jsx(
|
231
|
-
Ie,
|
230
|
+
"div",
|
232
231
|
{
|
233
232
|
className: classNames(
|
234
|
-
cls.
|
235
|
-
|
236
|
-
linkClasses
|
233
|
+
cls.accordion,
|
234
|
+
cls[size],
|
235
|
+
linkClasses,
|
236
|
+
classNameAccordion
|
237
237
|
),
|
238
|
-
children: /* @__PURE__ */ jsx(
|
238
|
+
children: /* @__PURE__ */ jsx(We, { ref, children: ({ open: open2 }) => {
|
239
|
+
if (open2 !== isOpen) {
|
240
|
+
setIsOpen(open2);
|
241
|
+
}
|
242
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
243
|
+
/* @__PURE__ */ jsx(
|
244
|
+
Ce,
|
245
|
+
{
|
246
|
+
as: isLink ? Fragment : EAccordionButtonType.BUTTON,
|
247
|
+
className: classNames({
|
248
|
+
[cls.header]: !isLink
|
249
|
+
}),
|
250
|
+
children: renderButton(open2)
|
251
|
+
}
|
252
|
+
),
|
253
|
+
/* @__PURE__ */ jsx(
|
254
|
+
Ie,
|
255
|
+
{
|
256
|
+
className: classNames(
|
257
|
+
cls.panel,
|
258
|
+
classNameContent,
|
259
|
+
linkClasses
|
260
|
+
),
|
261
|
+
children: /* @__PURE__ */ jsx(AccordionItem, { size, children })
|
262
|
+
}
|
263
|
+
)
|
264
|
+
] });
|
265
|
+
} })
|
239
266
|
}
|
240
|
-
)
|
241
|
-
|
267
|
+
),
|
268
|
+
(subtitleNode || onlyOpenSubtitleNode) && /* @__PURE__ */ jsxs("div", { className: classNameSubtitleContainer, children: [
|
269
|
+
subtitleNode,
|
270
|
+
isOpen && onlyOpenSubtitleNode
|
271
|
+
] })
|
272
|
+
] });
|
242
273
|
}
|
243
274
|
);
|
244
275
|
export {
|
@@ -48,9 +48,13 @@ type TProps = {
|
|
48
48
|
footer?: ReactNode | ((props: {
|
49
49
|
handleClose: VoidFunction;
|
50
50
|
}) => JSX.Element);
|
51
|
+
/**
|
52
|
+
* Дополнительный класс для inner.
|
53
|
+
*/
|
54
|
+
classNameInner?: string;
|
51
55
|
};
|
52
56
|
/**
|
53
57
|
* Компонент шторки, который может выезжать слева, справа или внизу.
|
54
58
|
*/
|
55
|
-
export declare const Drawer: ({ isOpen, onClose, title, className, unmount, isLoading, stickyHeader, fullBottomHeight, position, paddingRight, footer, children }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element | null;
|
59
|
+
export declare const Drawer: ({ isOpen, onClose, title, className, unmount, isLoading, stickyHeader, fullBottomHeight, position, paddingRight, footer, children, classNameInner }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element | null;
|
56
60
|
export {};
|
@@ -60,7 +60,8 @@ const Drawer = ({
|
|
60
60
|
position = EDrawerPosition.RIGHT,
|
61
61
|
paddingRight = 8,
|
62
62
|
footer: footer2,
|
63
|
-
children
|
63
|
+
children,
|
64
|
+
classNameInner
|
64
65
|
}) => {
|
65
66
|
const [isClosing, setIsClosing] = useState(false);
|
66
67
|
const [isMounted, setIsMounted] = useState(false);
|
@@ -150,7 +151,7 @@ const Drawer = ({
|
|
150
151
|
]
|
151
152
|
}
|
152
153
|
),
|
153
|
-
/* @__PURE__ */ jsx("div", { className: cls.inner, children }),
|
154
|
+
/* @__PURE__ */ jsx("div", { className: classNames(cls.inner, classNameInner), children }),
|
154
155
|
/* @__PURE__ */ jsx("footer", { className: cls.footer, children: typeof footer2 === "function" ? footer2({ handleClose }) : footer2 || /* @__PURE__ */ jsx(
|
155
156
|
Button,
|
156
157
|
{
|