@dss-kit/ui-kit 0.3.4 → 0.3.5
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.
- package/dist/components/builders/Modal/Modal.js +12 -11
- package/dist/components/builders/Modal/ModalFooter/ModalFooter.d.ts +33 -1
- package/dist/components/builders/Modal/ModalFooter/ModalFooter.js +1 -7
- package/dist/components/builders/Modal/ModalFooter/index.d.ts +1 -0
- package/dist/components/builders/Modal/ModalHeader/ModalHeader.d.ts +1 -1
- package/dist/components/builders/Modal/ModalHeader/ModalHeader.js +33 -32
- package/dist/components/builders/Modal/ModalHeader/index.d.ts +1 -0
- package/dist/components/builders/Modal/ModalMain/ModalMain.d.ts +1 -1
- package/dist/components/builders/Modal/ModalMain/index.d.ts +1 -1
- package/dist/components/builders/Modal/index.d.ts +19 -3
- package/dist/components/builders/Table/Table.utils.js +1 -1
- package/dist/components/shared/Badge/Badge.d.ts +14 -0
- package/dist/components/shared/Badge/Badge.js +59 -53
- package/dist/ui-kit.cjs +6 -6
- package/package.json +1 -1
|
@@ -2,12 +2,12 @@ import { jsx as t, jsxs as M } from "react/jsx-runtime";
|
|
|
2
2
|
import { cx as i } from "@emotion/css";
|
|
3
3
|
import { forwardRef as B, useEffect as c, useCallback as f, useRef as D } from "react";
|
|
4
4
|
import N from "../../../assets/svg/modal/close.svg.js";
|
|
5
|
-
import { ModalContext as
|
|
5
|
+
import { ModalContext as z } from "./context.js";
|
|
6
6
|
import { styles as n } from "./styles.js";
|
|
7
|
-
import { Portal as
|
|
7
|
+
import { Portal as E } from "../Portal/Portal.js";
|
|
8
8
|
import { Box as s } from "../Box/Box.js";
|
|
9
|
-
import { IconButton as
|
|
10
|
-
import { theme as
|
|
9
|
+
import { IconButton as P } from "../../controls/IconButton/IconButton.js";
|
|
10
|
+
import { theme as j } from "../../../utils/theme/index.js";
|
|
11
11
|
const C = B(
|
|
12
12
|
({
|
|
13
13
|
isOpen: o,
|
|
@@ -21,7 +21,7 @@ const C = B(
|
|
|
21
21
|
disableBodyScroll: l = !0,
|
|
22
22
|
showAbsoluteCloseButton: g,
|
|
23
23
|
children: v
|
|
24
|
-
},
|
|
24
|
+
}, x) => {
|
|
25
25
|
c(() => {
|
|
26
26
|
if (l && o && typeof window < "u" && typeof document < "u") {
|
|
27
27
|
const e = window.getComputedStyle(document.body).overflow;
|
|
@@ -40,7 +40,7 @@ const C = B(
|
|
|
40
40
|
if (typeof window < "u" && typeof document < "u" && u && o)
|
|
41
41
|
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
42
42
|
}, [o, u, d]);
|
|
43
|
-
const a = D(!1),
|
|
43
|
+
const a = D(!1), k = f((e) => {
|
|
44
44
|
a.current = e.target === e.currentTarget;
|
|
45
45
|
}, []), b = f(
|
|
46
46
|
(e) => {
|
|
@@ -48,7 +48,7 @@ const C = B(
|
|
|
48
48
|
},
|
|
49
49
|
[m, r]
|
|
50
50
|
);
|
|
51
|
-
return o ? /* @__PURE__ */ t(
|
|
51
|
+
return o ? /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(z.Provider, { value: { isOpen: o, onClose: r }, children: /* @__PURE__ */ t(
|
|
52
52
|
s,
|
|
53
53
|
{
|
|
54
54
|
position: "fixed",
|
|
@@ -59,15 +59,15 @@ const C = B(
|
|
|
59
59
|
row: !0,
|
|
60
60
|
center: !0,
|
|
61
61
|
flex: 1,
|
|
62
|
-
onMouseDown:
|
|
62
|
+
onMouseDown: k,
|
|
63
63
|
onClick: b,
|
|
64
|
-
backgroundColor:
|
|
64
|
+
backgroundColor: j.color.fill.bgOverlayPrimary,
|
|
65
65
|
className: i(n.overlay, y),
|
|
66
66
|
zIndex: 1,
|
|
67
67
|
children: /* @__PURE__ */ M(
|
|
68
68
|
s,
|
|
69
69
|
{
|
|
70
|
-
ref:
|
|
70
|
+
ref: x,
|
|
71
71
|
className: i(
|
|
72
72
|
n.modal,
|
|
73
73
|
n[`size_${h}`],
|
|
@@ -76,7 +76,7 @@ const C = B(
|
|
|
76
76
|
relative: !0,
|
|
77
77
|
children: [
|
|
78
78
|
g && /* @__PURE__ */ t(
|
|
79
|
-
|
|
79
|
+
P,
|
|
80
80
|
{
|
|
81
81
|
className: i(
|
|
82
82
|
n.closeButton,
|
|
@@ -84,6 +84,7 @@ const C = B(
|
|
|
84
84
|
),
|
|
85
85
|
onClick: r,
|
|
86
86
|
color: "neutral",
|
|
87
|
+
size: "xs",
|
|
87
88
|
children: /* @__PURE__ */ t(N, {})
|
|
88
89
|
}
|
|
89
90
|
),
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
import { BoxProps } from '../../Box';
|
|
2
|
+
/**
|
|
3
|
+
* Пропсы компонента `ModalFooter`.
|
|
4
|
+
*
|
|
5
|
+
* Наследует все пропсы `Box` (см. {@link BoxProps}); ниже переопределены
|
|
6
|
+
* футер-специфичные пропсы с их значениями по умолчанию.
|
|
7
|
+
*/
|
|
8
|
+
export interface ModalFooterProps extends BoxProps {
|
|
9
|
+
/**
|
|
10
|
+
* Дочерние элементы футера (обычно кнопки действий).
|
|
11
|
+
* @default undefined */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Горизонтальное расположение элементов (flex-direction: row).
|
|
15
|
+
* @default true */
|
|
16
|
+
row?: BoxProps["row"];
|
|
17
|
+
/**
|
|
18
|
+
* Включение flexbox layout.
|
|
19
|
+
* @default true */
|
|
20
|
+
flex?: BoxProps["flex"];
|
|
21
|
+
/**
|
|
22
|
+
* Расстояние между дочерними элементами.
|
|
23
|
+
* @default theme.spacing.lg */
|
|
24
|
+
gap?: BoxProps["gap"];
|
|
25
|
+
/**
|
|
26
|
+
* Внутренние отступы футера.
|
|
27
|
+
* @default theme.spacing["2xl"] */
|
|
28
|
+
p?: BoxProps["p"];
|
|
29
|
+
/**
|
|
30
|
+
* Дополнительный CSS-класс для корневого `Box` футера.
|
|
31
|
+
* @default undefined */
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
2
34
|
/**
|
|
3
35
|
* Компонент футера модального окна.
|
|
4
36
|
*
|
|
@@ -27,7 +59,7 @@ import { BoxProps } from '../../Box';
|
|
|
27
59
|
* </ModalFooter>
|
|
28
60
|
* ```
|
|
29
61
|
*/
|
|
30
|
-
declare const ModalFooter: import('react').ForwardRefExoticComponent<Omit<
|
|
62
|
+
declare const ModalFooter: import('react').ForwardRefExoticComponent<Omit<ModalFooterProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
31
63
|
/**
|
|
32
64
|
* Экспорт компонента ModalFooter.
|
|
33
65
|
*
|
|
@@ -7,19 +7,13 @@ const x = f({
|
|
|
7
7
|
borderTop: `1px solid ${o.color.border.neutralAlphaBasic}`
|
|
8
8
|
}), u = d(
|
|
9
9
|
({
|
|
10
|
-
/** Дочерние элементы футера (обычно кнопки) */
|
|
11
10
|
children: r,
|
|
12
|
-
/** Горизонтальное расположение элементов. @default true */
|
|
13
11
|
row: t = !0,
|
|
14
|
-
/** Включение flexbox layout. @default true */
|
|
15
12
|
flex: e = !0,
|
|
16
|
-
/** Расстояние между дочерними элементами. @default spacing.lg */
|
|
17
13
|
gap: m = o.spacing.lg,
|
|
18
|
-
/** Внутренние отступы футера. @default spacing['2xl'] */
|
|
19
14
|
p: s = o.spacing["2xl"],
|
|
20
|
-
/** Дополнительные CSS классы */
|
|
21
15
|
className: a,
|
|
22
|
-
|
|
16
|
+
// Остальные пропсы передаются в компонент Box
|
|
23
17
|
...p
|
|
24
18
|
}, l) => /* @__PURE__ */ i(
|
|
25
19
|
n,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoxProps } from '../../Box';
|
|
2
|
-
interface ModalHeaderProps extends Pick<BoxProps, "p" | "px" | "py" | "pt" | "pb" | "row" | "justifyContent" | "w"> {
|
|
2
|
+
export interface ModalHeaderProps extends Pick<BoxProps, "p" | "px" | "py" | "pt" | "pb" | "row" | "justifyContent" | "w"> {
|
|
3
3
|
/**
|
|
4
4
|
* Основной заголовок, отображаемый в шапке модального окна.
|
|
5
5
|
* Стилизуется как title-3 с полужирным начертанием.
|
|
@@ -1,79 +1,80 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as e, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as B } from "react";
|
|
3
3
|
import W from "../../../../assets/svg/modal/close.svg.js";
|
|
4
4
|
import { useModalContext as v } from "../context.js";
|
|
5
|
-
import { Box as
|
|
6
|
-
import { theme as
|
|
7
|
-
import { Text as
|
|
5
|
+
import { Box as t } from "../../Box/Box.js";
|
|
6
|
+
import { theme as o } from "../../../../utils/theme/index.js";
|
|
7
|
+
import { Text as a } from "../../Text/Text.js";
|
|
8
8
|
import { IconButton as M } from "../../../controls/IconButton/IconButton.js";
|
|
9
9
|
const j = B(
|
|
10
10
|
({
|
|
11
|
-
title:
|
|
12
|
-
subtitle:
|
|
11
|
+
title: i,
|
|
12
|
+
subtitle: l,
|
|
13
13
|
w: m = "full",
|
|
14
|
-
p:
|
|
15
|
-
py:
|
|
16
|
-
px: d =
|
|
17
|
-
pt: c =
|
|
18
|
-
pb: p =
|
|
14
|
+
p: s,
|
|
15
|
+
py: n,
|
|
16
|
+
px: d = o.spacing["2xl"],
|
|
17
|
+
pt: c = o.spacing["2xl"],
|
|
18
|
+
pb: p = o.spacing.lg,
|
|
19
19
|
row: f = !0,
|
|
20
20
|
justifyContent: h = "space-between",
|
|
21
21
|
showCloseButton: g = !1,
|
|
22
|
-
className:
|
|
23
|
-
titleClassName:
|
|
24
|
-
subtitleClassName:
|
|
22
|
+
className: x,
|
|
23
|
+
titleClassName: b,
|
|
24
|
+
subtitleClassName: u,
|
|
25
25
|
closeButtonClassName: N
|
|
26
26
|
}, y) => {
|
|
27
27
|
const { onClose: C } = v();
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
|
|
28
|
+
return /* @__PURE__ */ e(
|
|
29
|
+
t,
|
|
30
30
|
{
|
|
31
31
|
w: m,
|
|
32
|
-
p:
|
|
33
|
-
py:
|
|
32
|
+
p: s,
|
|
33
|
+
py: n,
|
|
34
34
|
px: d,
|
|
35
35
|
pt: c,
|
|
36
36
|
pb: p,
|
|
37
37
|
row: f,
|
|
38
38
|
justifyContent: h,
|
|
39
39
|
ref: y,
|
|
40
|
-
borderColor:
|
|
40
|
+
borderColor: o.color.border.neutralAlphaBasic,
|
|
41
41
|
borderWidth: 0,
|
|
42
42
|
borderBottomWidth: 1,
|
|
43
43
|
borderStyle: "solid",
|
|
44
|
-
className:
|
|
44
|
+
className: x,
|
|
45
45
|
children: [
|
|
46
|
-
/* @__PURE__ */ t
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
46
|
+
/* @__PURE__ */ e(t, { gap: o.spacing.sm, children: [
|
|
47
|
+
/* @__PURE__ */ r(
|
|
48
|
+
a,
|
|
49
49
|
{
|
|
50
50
|
variant: "title-3",
|
|
51
51
|
colorName: "primary",
|
|
52
52
|
fontWeight: "semibold",
|
|
53
|
-
className:
|
|
54
|
-
children:
|
|
53
|
+
className: b,
|
|
54
|
+
children: i
|
|
55
55
|
}
|
|
56
56
|
),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
57
|
+
/* @__PURE__ */ r(
|
|
58
|
+
a,
|
|
59
59
|
{
|
|
60
60
|
variant: "body-1",
|
|
61
61
|
colorName: "tertiary",
|
|
62
62
|
fontWeight: "medium",
|
|
63
|
-
className:
|
|
64
|
-
children:
|
|
63
|
+
className: u,
|
|
64
|
+
children: l
|
|
65
65
|
}
|
|
66
66
|
)
|
|
67
67
|
] }),
|
|
68
|
-
g && /* @__PURE__ */
|
|
68
|
+
g && /* @__PURE__ */ r(
|
|
69
69
|
M,
|
|
70
70
|
{
|
|
71
71
|
onClick: C,
|
|
72
72
|
color: "neutral",
|
|
73
73
|
className: N,
|
|
74
|
-
|
|
74
|
+
size: "xs",
|
|
75
|
+
children: /* @__PURE__ */ r(W, {})
|
|
75
76
|
}
|
|
76
|
-
)
|
|
77
|
+
)
|
|
77
78
|
]
|
|
78
79
|
}
|
|
79
80
|
);
|
|
@@ -24,7 +24,7 @@ interface ModalMainRef {
|
|
|
24
24
|
* @interface ModalMainProps
|
|
25
25
|
* @extends {PropsWithChildren}
|
|
26
26
|
*/
|
|
27
|
-
interface ModalMainProps extends PropsWithChildren {
|
|
27
|
+
export interface ModalMainProps extends PropsWithChildren {
|
|
28
28
|
/**
|
|
29
29
|
* Направление расположения элементов
|
|
30
30
|
* Если true, flex-direction будет row, иначе column
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { ModalMainRef } from './ModalMain';
|
|
1
|
+
export type { ModalMainProps, ModalMainRef } from './ModalMain';
|
|
2
2
|
export { ModalMain } from './ModalMain';
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
+
import { ReactNode, RefAttributes } from 'react';
|
|
1
2
|
import { ModalProps } from './Modal';
|
|
2
3
|
import { ModalFooter } from './ModalFooter';
|
|
3
4
|
import { ModalHeader } from './ModalHeader';
|
|
4
5
|
import { ModalMain } from './ModalMain';
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Тип составного компонента `Modal`.
|
|
8
|
+
*
|
|
9
|
+
* Намеренно НЕ наследует `ForwardRefExoticComponent`: это убирает из
|
|
10
|
+
* автодополнения `<Modal.` служебные React-поля ($$typeof, displayName,
|
|
11
|
+
* propTypes, defaultProps), оставляя `Header` / `Main` / `Footer`.
|
|
12
|
+
* Компонент по-прежнему вызывается как `<Modal>` и принимает `ref`.
|
|
13
|
+
*
|
|
14
|
+
* NB: члены `Function` (apply/bind/call/…) TypeScript всё равно подмешивает
|
|
15
|
+
* к любому вызываемому значению — полностью убрать их без отказа от `<Modal>`
|
|
16
|
+
* нельзя.
|
|
17
|
+
*/
|
|
18
|
+
type ModalComponent = ((props: ModalProps & RefAttributes<HTMLDivElement>) => ReactNode) & {
|
|
6
19
|
Header: typeof ModalHeader;
|
|
7
20
|
Main: typeof ModalMain;
|
|
8
21
|
Footer: typeof ModalFooter;
|
|
9
|
-
}
|
|
10
|
-
declare const ModalWithSubComponents:
|
|
22
|
+
};
|
|
23
|
+
declare const ModalWithSubComponents: ModalComponent;
|
|
11
24
|
export { ModalWithSubComponents as Modal };
|
|
12
25
|
export type { ModalProps };
|
|
26
|
+
export type { ModalFooterProps } from './ModalFooter';
|
|
27
|
+
export type { ModalHeaderProps } from './ModalHeader';
|
|
28
|
+
export type { ModalMainProps } from './ModalMain';
|
|
@@ -17,7 +17,7 @@ const p = (s, f, g) => {
|
|
|
17
17
|
right: e === "right" ? o : void 0,
|
|
18
18
|
zIndex: 1,
|
|
19
19
|
background: g,
|
|
20
|
-
boxShadow: l ? `-
|
|
20
|
+
boxShadow: l ? `-2px 0 2px -2px ${d.color.effect.shadowL} inset` : e === "right" && i === 0 ? `2px 0 2px -2px ${d.color.effect.shadowL} inset` : void 0
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
@@ -3,17 +3,31 @@ import { AccentType, NegativeType, NeutralType, PositiveType, Size, TransferType
|
|
|
3
3
|
export type BadgeVariant = "filled" | "outline" | "clear";
|
|
4
4
|
export type BadgeColor = NeutralType | AccentType | WarningType | PositiveType | NegativeType | TransferType;
|
|
5
5
|
export type BadgeSize = Extract<Size, "sm" | "md" | "lg">;
|
|
6
|
+
export type BadgeTextAlign = "left" | "center" | "right";
|
|
6
7
|
export interface BadgeProps {
|
|
8
|
+
/** Содержимое лейбла бейджа. Текст всегда центрируется по вертикали внутри бейджа. */
|
|
7
9
|
label: ReactNode;
|
|
10
|
+
/** Цветовая схема бейджа (фон, рамка и цвет текста берутся из соответствующего токена). @default "neutral" */
|
|
8
11
|
color?: BadgeColor;
|
|
12
|
+
/** Стиль заливки: "filled" — цветной фон, "outline" — только рамка, "clear" — прозрачный фон без рамки. @default "filled" */
|
|
9
13
|
variant?: BadgeVariant;
|
|
14
|
+
/** Размер бейджа: "sm" (24px), "md" (32px) или "lg" (40px) — определяет высоту, отступы и вариант текста. @default "md" */
|
|
10
15
|
size?: BadgeSize;
|
|
16
|
+
/** Фиксированная ширина бейджа (число в px или CSS-строка). Если не задана, ширина определяется содержимым. */
|
|
11
17
|
width?: number | string;
|
|
18
|
+
/** Расположение текста лейбла по горизонтали внутри бейджа. @default "center" */
|
|
19
|
+
textAlign?: BadgeTextAlign;
|
|
20
|
+
/** Элемент (иконка и т.п.), отображаемый слева от текста лейбла. */
|
|
12
21
|
leftElement?: ReactNode;
|
|
22
|
+
/** Элемент (иконка и т.п.), отображаемый справа от текста лейбла. */
|
|
13
23
|
rightElement?: ReactNode;
|
|
24
|
+
/** Переводит бейдж в неактивное состояние: снижает непрозрачность, отключает клик и скрывает кнопку удаления. @default false */
|
|
14
25
|
disabled?: boolean;
|
|
26
|
+
/** Обработчик клика по бейджу. Если передан (и `disabled` не установлен), бейдж становится кликабельным и получает эффект Ripple. */
|
|
15
27
|
onClick?: (e: MouseEvent) => void;
|
|
28
|
+
/** Обработчик удаления бейджа. Если передан (и `disabled` не установлен), справа отображается кнопка с иконкой закрытия. */
|
|
16
29
|
onDelete?: (e: MouseEvent) => void;
|
|
30
|
+
/** Класс для корневого контейнера бейджа (`Box`). */
|
|
17
31
|
className?: string;
|
|
18
32
|
/** Класс для текста-лейбла (`Text`). */
|
|
19
33
|
labelClassName?: string;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cx as
|
|
3
|
-
import
|
|
4
|
-
import { Box as
|
|
5
|
-
import { theme as
|
|
6
|
-
import { Ripple as
|
|
7
|
-
import { Text as
|
|
8
|
-
const { color:
|
|
1
|
+
import { jsxs as k, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cx as y, css as u } from "@emotion/css";
|
|
3
|
+
import B from "../../../assets/svg/shared/close-outline.svg.js";
|
|
4
|
+
import { Box as L } from "../../builders/Box/Box.js";
|
|
5
|
+
import { theme as $ } from "../../../utils/theme/index.js";
|
|
6
|
+
import { Ripple as j } from "../../builders/Ripple/Ripple.js";
|
|
7
|
+
import { Text as h } from "../../builders/Text/Text.js";
|
|
8
|
+
const { color: e, cornerRadius: g, spacing: l } = $, b = {
|
|
9
9
|
neutral: {
|
|
10
|
-
border:
|
|
11
|
-
bg:
|
|
12
|
-
color:
|
|
10
|
+
border: e.border.neutralAlphaLow,
|
|
11
|
+
bg: e.status.neutralTint,
|
|
12
|
+
color: e.text.secondary,
|
|
13
13
|
colorName: "secondary"
|
|
14
14
|
},
|
|
15
15
|
accent: {
|
|
16
|
-
border:
|
|
17
|
-
bg:
|
|
18
|
-
color:
|
|
16
|
+
border: e.border.accentSecondary,
|
|
17
|
+
bg: e.status.accentTintLow,
|
|
18
|
+
color: e.text.accent,
|
|
19
19
|
colorName: "accent"
|
|
20
20
|
},
|
|
21
21
|
warning: {
|
|
22
|
-
border:
|
|
23
|
-
bg:
|
|
24
|
-
color:
|
|
22
|
+
border: e.border.warningSecondary,
|
|
23
|
+
bg: e.status.warningTintLow,
|
|
24
|
+
color: e.text.warning,
|
|
25
25
|
colorName: "warning"
|
|
26
26
|
},
|
|
27
27
|
positive: {
|
|
28
|
-
border:
|
|
29
|
-
bg:
|
|
30
|
-
color:
|
|
28
|
+
border: e.border.positiveSecondary,
|
|
29
|
+
bg: e.status.positiveTintLow,
|
|
30
|
+
color: e.text.positive,
|
|
31
31
|
colorName: "positive"
|
|
32
32
|
},
|
|
33
33
|
negative: {
|
|
34
|
-
border:
|
|
35
|
-
bg:
|
|
36
|
-
color:
|
|
34
|
+
border: e.border.negativeSecondary,
|
|
35
|
+
bg: e.status.negativeTintLow,
|
|
36
|
+
color: e.text.negative,
|
|
37
37
|
colorName: "negative"
|
|
38
38
|
},
|
|
39
39
|
transfer: {
|
|
@@ -63,17 +63,17 @@ const { color: r, cornerRadius: g, spacing: l } = L, b = {
|
|
|
63
63
|
}
|
|
64
64
|
}, R = (d, n, o, p) => {
|
|
65
65
|
const t = b[n];
|
|
66
|
-
let
|
|
66
|
+
let r = t.bg, s = "none";
|
|
67
67
|
const c = t.color;
|
|
68
68
|
switch (d) {
|
|
69
69
|
case "outline":
|
|
70
|
-
|
|
70
|
+
r = "transparent", s = `1px solid ${t.border}`;
|
|
71
71
|
break;
|
|
72
72
|
case "clear":
|
|
73
|
-
|
|
73
|
+
r = "transparent";
|
|
74
74
|
break;
|
|
75
75
|
default:
|
|
76
|
-
|
|
76
|
+
r = t.bg;
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
return u({
|
|
@@ -82,40 +82,42 @@ const { color: r, cornerRadius: g, spacing: l } = L, b = {
|
|
|
82
82
|
userSelect: "none",
|
|
83
83
|
position: "relative",
|
|
84
84
|
transition: "background-color 0.2s, opacity 0.2s",
|
|
85
|
-
backgroundColor:
|
|
85
|
+
backgroundColor: r,
|
|
86
86
|
color: c,
|
|
87
87
|
border: s
|
|
88
88
|
});
|
|
89
|
-
},
|
|
89
|
+
}, I = u({
|
|
90
90
|
display: "inline-flex",
|
|
91
91
|
cursor: "pointer",
|
|
92
92
|
opacity: 0.6,
|
|
93
93
|
"&:hover": { opacity: 1 }
|
|
94
|
-
}),
|
|
94
|
+
}), w = u({
|
|
95
95
|
display: "inline-flex",
|
|
96
96
|
alignItems: "center",
|
|
97
97
|
color: "inherit"
|
|
98
|
-
}),
|
|
98
|
+
}), O = ({
|
|
99
99
|
label: d,
|
|
100
100
|
color: n = "neutral",
|
|
101
101
|
size: o = "md",
|
|
102
102
|
variant: p = "filled",
|
|
103
103
|
width: t,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
textAlign: r = "center",
|
|
105
|
+
leftElement: s,
|
|
106
|
+
rightElement: c,
|
|
107
|
+
disabled: x,
|
|
107
108
|
onClick: m,
|
|
108
|
-
onDelete:
|
|
109
|
+
onDelete: f,
|
|
109
110
|
className: N,
|
|
110
|
-
labelClassName:
|
|
111
|
+
labelClassName: C,
|
|
111
112
|
deleteButtonClassName: S
|
|
112
113
|
}) => {
|
|
113
|
-
const T = R(p, n,
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
|
|
114
|
+
const T = R(p, n, x, m);
|
|
115
|
+
return /* @__PURE__ */ k(
|
|
116
|
+
L,
|
|
116
117
|
{
|
|
117
118
|
row: !0,
|
|
118
119
|
alignItems: "center",
|
|
120
|
+
justifyContent: "center",
|
|
119
121
|
gap: l.sm,
|
|
120
122
|
p: i[o].p,
|
|
121
123
|
h: i[o].h,
|
|
@@ -123,37 +125,41 @@ const { color: r, cornerRadius: g, spacing: l } = L, b = {
|
|
|
123
125
|
overflow: "hidden",
|
|
124
126
|
borderRadius: i[o].corner,
|
|
125
127
|
onClick: m,
|
|
126
|
-
className:
|
|
128
|
+
className: y(T, N),
|
|
127
129
|
children: [
|
|
128
|
-
m && /* @__PURE__ */ a(
|
|
129
|
-
|
|
130
|
+
m && /* @__PURE__ */ a(j, {}),
|
|
131
|
+
s && /* @__PURE__ */ a("span", { className: w, children: s }),
|
|
130
132
|
/* @__PURE__ */ a(
|
|
131
|
-
|
|
133
|
+
h,
|
|
132
134
|
{
|
|
133
135
|
variant: i[o].text,
|
|
134
136
|
colorName: b[n].colorName,
|
|
135
137
|
textOverflow: "ellipsis",
|
|
136
|
-
|
|
138
|
+
left: r === "left",
|
|
139
|
+
center: r === "center",
|
|
140
|
+
right: r === "right",
|
|
141
|
+
flex: t ? 1 : void 0,
|
|
142
|
+
className: C,
|
|
137
143
|
children: d
|
|
138
144
|
}
|
|
139
145
|
),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
c && /* @__PURE__ */ a("span", { className: w, children: c }),
|
|
147
|
+
f && !x && /* @__PURE__ */ a(
|
|
148
|
+
h,
|
|
143
149
|
{
|
|
144
|
-
className:
|
|
150
|
+
className: y(I, S),
|
|
145
151
|
colorName: b[n].colorName,
|
|
146
|
-
onClick: (
|
|
147
|
-
|
|
152
|
+
onClick: (v) => {
|
|
153
|
+
v.stopPropagation(), f(v);
|
|
148
154
|
},
|
|
149
|
-
children: /* @__PURE__ */ a(
|
|
155
|
+
children: /* @__PURE__ */ a(B, {})
|
|
150
156
|
}
|
|
151
157
|
)
|
|
152
158
|
]
|
|
153
159
|
}
|
|
154
160
|
);
|
|
155
161
|
};
|
|
156
|
-
|
|
162
|
+
O.displayName = "Badge";
|
|
157
163
|
export {
|
|
158
|
-
|
|
164
|
+
O as Badge
|
|
159
165
|
};
|