mimir-ui-kit 1.24.4 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,14 +2,31 @@ 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
|
+
classNameSubtitleNode?: string;
|
29
|
+
/** React-нода для отображения под заголовком */
|
30
|
+
subtitleNode?: ReactNode;
|
14
31
|
};
|
15
32
|
export declare const Accordion: import('react').ForwardRefExoticComponent<TAccordionProps & import('react').RefAttributes<HTMLElement>>;
|
@@ -1,4 +1,4 @@
|
|
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
3
|
import React__default, { createContext, useRef, Fragment, useReducer, useMemo, useId, useEffect, useContext, forwardRef } from "react";
|
4
4
|
import { AccordionItem } from "./AccordionItem/AccordionItem.js";
|
@@ -155,7 +155,11 @@ 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
|
+
classNameSubtitleNode,
|
162
|
+
subtitleNode
|
159
163
|
}, ref) => {
|
160
164
|
const isMobile = useMediaQuery(EMediaQuery.XS1);
|
161
165
|
const isLink = buttonType === "link";
|
@@ -206,7 +210,8 @@ const Accordion = forwardRef(
|
|
206
210
|
className: classNames(
|
207
211
|
cls["icon-container"],
|
208
212
|
open2 && cls.open,
|
209
|
-
cls[buttonStyle]
|
213
|
+
cls[buttonStyle],
|
214
|
+
classNameIconButton
|
210
215
|
),
|
211
216
|
children: /* @__PURE__ */ jsx(Icon, { iconName: getIconName(), className: cls.icon })
|
212
217
|
}
|
@@ -218,27 +223,43 @@ const Accordion = forwardRef(
|
|
218
223
|
}
|
219
224
|
}
|
220
225
|
};
|
221
|
-
return /* @__PURE__ */
|
226
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
222
227
|
/* @__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,
|
228
|
+
"div",
|
232
229
|
{
|
233
230
|
className: classNames(
|
234
|
-
cls.
|
235
|
-
|
236
|
-
linkClasses
|
231
|
+
cls.accordion,
|
232
|
+
cls[size],
|
233
|
+
linkClasses,
|
234
|
+
classNameAccordion
|
237
235
|
),
|
238
|
-
children: /* @__PURE__ */ jsx(
|
236
|
+
children: /* @__PURE__ */ jsx(We, { ref, children: ({ open: open2 }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
237
|
+
/* @__PURE__ */ jsx(
|
238
|
+
Ce,
|
239
|
+
{
|
240
|
+
as: isLink ? Fragment : EAccordionButtonType.BUTTON,
|
241
|
+
className: classNames({
|
242
|
+
[cls.header]: !isLink
|
243
|
+
}),
|
244
|
+
children: renderButton(open2)
|
245
|
+
}
|
246
|
+
),
|
247
|
+
/* @__PURE__ */ jsx(
|
248
|
+
Ie,
|
249
|
+
{
|
250
|
+
className: classNames(
|
251
|
+
cls.panel,
|
252
|
+
classNameContent,
|
253
|
+
linkClasses
|
254
|
+
),
|
255
|
+
children: /* @__PURE__ */ jsx(AccordionItem, { size, children })
|
256
|
+
}
|
257
|
+
)
|
258
|
+
] }) })
|
239
259
|
}
|
240
|
-
)
|
241
|
-
|
260
|
+
),
|
261
|
+
subtitleNode && /* @__PURE__ */ jsx("div", { className: classNames(cls.subtitle, classNameSubtitleNode), children: subtitleNode })
|
262
|
+
] });
|
242
263
|
}
|
243
264
|
);
|
244
265
|
export {
|