skillgrid 0.0.90 → 0.0.91-dev-68351-trigger-fixes.1802697
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/assets/components/FileUpload/FileUpload.module-CL_LDrLs.css +1 -0
- package/dist/assets/components/Modal/Modal.module-x_YFLlra.css +1 -0
- package/dist/assets/components/Trigger/Trigger.module-Dc9gMp3_.css +1 -0
- package/dist/assets/icons/development/code-browser-outlined.svg.js +1 -1
- package/dist/assets/icons/development/code-close-outlined.svg.js +1 -1
- package/dist/assets/icons/development/code-outlined.svg.js +1 -1
- package/dist/assets/icons/development/cube-outlined.svg.js +1 -1
- package/dist/assets/icons/development/dataflow-outlined.svg.js +1 -1
- package/dist/assets/icons/development/terminal-square-outlined.svg.js +2 -2
- package/dist/assets/icons/general/award-outlined.svg.js +1 -1
- package/dist/assets/icons/general/compass-outlined.svg.js +1 -1
- package/dist/assets/icons/general/ellipsis-horizontal-outlined.svg.js +1 -1
- package/dist/assets/icons/general/ellipsis-vertical-outlined.svg.js +2 -2
- package/dist/assets/icons/general/eye-crossed-outlined.svg.js +2 -2
- package/dist/assets/icons/general/medal-outlined.svg.js +1 -1
- package/dist/assets/icons/general/megaphone-outlined.svg.js +1 -1
- package/dist/assets/icons/general/rating-outlined.svg.js +1 -1
- package/dist/assets/icons/general/send-ios-outlined.svg.js +1 -1
- package/dist/assets/icons/general/shop-outlined.svg.js +1 -1
- package/dist/assets/icons/general/teacher-outlined.svg.js +1 -1
- package/dist/components/Avatar/AvatarGroup/AvatarGroupRoot.js +5 -5
- package/dist/components/FileUpload/FileUpload.js +1 -1
- package/dist/components/FileUpload/FileUpload.module.css.js +62 -62
- package/dist/components/InputBase/Input.js +6 -6
- package/dist/components/Modal/Modal.module.css.js +18 -18
- package/dist/components/Modal/Modal.type.d.ts +1 -1
- package/dist/components/Popover/lib/use-popover.js +1 -1
- package/dist/components/Tabs/ScrollWrapper.js +1 -1
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Trigger/Trigger.d.ts +1 -1
- package/dist/components/Trigger/Trigger.js +97 -91
- package/dist/components/Trigger/Trigger.module.css.js +23 -23
- package/dist/components/Trigger/Trigger.type.d.ts +13 -2
- package/dist/components/Trigger/lib/utils.d.ts +3 -2
- package/dist/components/Trigger/lib/utils.js +9 -5
- package/dist/index.cjs.js +3 -3
- package/dist/index.css +1 -1
- package/package.json +2 -2
- package/dist/assets/components/FileUpload/FileUpload.module-CldF1EqE.css +0 -1
- package/dist/assets/components/Modal/Modal.module-BXeSeTs2.css +0 -1
- package/dist/assets/components/Trigger/Trigger.module-BWzHgDVC.css +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { offset as G, flip as H, shift as V, inline as q, size as J, hide as K, useFloating as Q, autoUpdate as Z, useTransitionStyles as M, useClick as ee, useHover as te, useFocus as oe, useDismiss as ne, useRole as se, useInteractions as re } from "@floating-ui/react";
|
|
2
2
|
import { useState as i, useMemo as v, useCallback as ce, useEffect as ae, useLayoutEffect as ie } from "react";
|
|
3
|
-
import { DEFAULT_FLOATING as le, hasMiddleware as fe } from "./utils.js";
|
|
4
3
|
import { useCompatId as S } from "../../../hooks/useCompatId.js";
|
|
4
|
+
import { DEFAULT_FLOATING as le, hasMiddleware as fe } from "./utils.js";
|
|
5
5
|
const r = 8, ue = (c) => {
|
|
6
6
|
switch (c.split("-")[0]) {
|
|
7
7
|
case "top":
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as N, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as W, useState as g, useEffect as w } from "react";
|
|
3
|
+
import { useBackgroundColor as M } from "../../hooks/useBackgroundColor.js";
|
|
3
4
|
import { clsx as a } from "clsx";
|
|
4
5
|
import e from "./ScrollWrapper.module.css.js";
|
|
5
|
-
import { useBackgroundColor as M } from "../../hooks/useBackgroundColor.js";
|
|
6
6
|
const B = "white", G = ({
|
|
7
7
|
children: b,
|
|
8
8
|
withControls: i = !0,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as l, jsxs as w } from "react/jsx-runtime";
|
|
2
2
|
import F, { useState as U, createContext as V, useContext as M } from "react";
|
|
3
3
|
import { ScrollWrapper as R } from "./ScrollWrapper.js";
|
|
4
|
+
import { useIsMobile as j } from "../../hooks/useIsMobile.js";
|
|
4
5
|
import { clsx as p } from "clsx";
|
|
5
6
|
import f from "../../styles/typography.module.css.js";
|
|
6
7
|
import a from "./Tabs.module.css.js";
|
|
7
|
-
import { useIsMobile as j } from "../../hooks/useIsMobile.js";
|
|
8
8
|
import { Badge as k } from "../Badge/Badge.js";
|
|
9
9
|
const G = "md", W = !1, Y = !1, Z = 8, z = "top-right-inside", P = V(null), h = () => {
|
|
10
10
|
const t = M(P);
|
|
@@ -2,4 +2,4 @@ import { TriggerCommonProps } from './Trigger.type';
|
|
|
2
2
|
/**
|
|
3
3
|
Component Trigger
|
|
4
4
|
*/
|
|
5
|
-
export declare const Trigger: ({ content, size, description, label, stretched, selectionStyle, clearable, error, prefixIcon, postfixTitle, disabled, open, onClear, classNames, styles, }: TriggerCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const Trigger: ({ "data-testid": testId, content, size, description, label, stretched, truncateContent: contentTruncation, selectionStyle, clearable, showClear, showChevron, error, prefixIcon, postfixTitle, disabled, open, onClear, classNames, styles, }: TriggerCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,134 +1,140 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as f, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { clsx as n } from "clsx";
|
|
3
|
-
import { LabelState as
|
|
4
|
-
import
|
|
5
|
-
import { getLabelState as
|
|
6
|
-
import { Typography as
|
|
7
|
-
import { XIcon as
|
|
8
|
-
import { ChevronIcon as
|
|
9
|
-
import { Helper as
|
|
10
|
-
const
|
|
11
|
-
|
|
3
|
+
import { LabelState as H } from "./Trigger.type.js";
|
|
4
|
+
import t from "./Trigger.module.css.js";
|
|
5
|
+
import { getLabelState as V, getLabelTypographySize as Y, truncateContent as Z, getContentTypographySize as E, getIconSize as X } from "./lib/utils.js";
|
|
6
|
+
import { Typography as y } from "../Typography/Typography.js";
|
|
7
|
+
import { XIcon as _ } from "../InputBase/assets/XIcon.js";
|
|
8
|
+
import { ChevronIcon as tt } from "./assets/ChevronIcon.js";
|
|
9
|
+
import { Helper as rt } from "../Helper/Helper.js";
|
|
10
|
+
const pt = ({
|
|
11
|
+
"data-testid": j = "trigger",
|
|
12
|
+
content: p,
|
|
12
13
|
size: i = "XL",
|
|
13
|
-
description:
|
|
14
|
-
label:
|
|
15
|
-
stretched:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
description: I,
|
|
15
|
+
label: v,
|
|
16
|
+
stretched: h = !1,
|
|
17
|
+
truncateContent: z = !0,
|
|
18
|
+
selectionStyle: x = "selected",
|
|
19
|
+
clearable: A = !1,
|
|
20
|
+
showClear: D,
|
|
21
|
+
showChevron: F,
|
|
22
|
+
error: d,
|
|
23
|
+
prefixIcon: u,
|
|
24
|
+
postfixTitle: b,
|
|
21
25
|
disabled: o = !1,
|
|
22
|
-
open:
|
|
23
|
-
onClear:
|
|
24
|
-
classNames:
|
|
26
|
+
open: N,
|
|
27
|
+
onClear: m,
|
|
28
|
+
classNames: r = {},
|
|
25
29
|
styles: e = {}
|
|
26
30
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
{ [
|
|
30
|
-
|
|
31
|
-
),
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const c = !!p, S = !!v, g = !!d, L = x === "applied", w = D ?? (c && (L || A)), W = F ?? !w, k = !!I && (!g || o) || g && !o, G = (g && !o ? d : I) || "", l = g && !o, T = V(i, c), s = S && T === H.FLOATING, O = T === H.HIDDEN, P = n(
|
|
32
|
+
t["trigger-wrapper"],
|
|
33
|
+
{ [t["trigger-stretched"]]: h },
|
|
34
|
+
r.wrapper
|
|
35
|
+
), $ = n(
|
|
36
|
+
t["trigger-container"],
|
|
37
|
+
t[`trigger-container-size-${i}`],
|
|
34
38
|
{
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
39
|
+
[t["trigger-stretched"]]: h,
|
|
40
|
+
[t["trigger-container-applied"]]: L && c,
|
|
41
|
+
[t["trigger-container-error"]]: g && !o,
|
|
42
|
+
[t["trigger-container-open"]]: N,
|
|
43
|
+
[t["trigger-container-floating"]]: s
|
|
40
44
|
},
|
|
41
|
-
|
|
42
|
-
),
|
|
43
|
-
|
|
45
|
+
r.triggerContainer
|
|
46
|
+
), q = n(
|
|
47
|
+
t["trigger-content-container"],
|
|
44
48
|
{
|
|
45
|
-
[
|
|
49
|
+
[t["trigger-content-container-floating"]]: s
|
|
46
50
|
},
|
|
47
|
-
|
|
48
|
-
),
|
|
49
|
-
|
|
51
|
+
r.triggerContent
|
|
52
|
+
), B = n(
|
|
53
|
+
t["trigger-label"],
|
|
50
54
|
{
|
|
51
|
-
[
|
|
52
|
-
[
|
|
55
|
+
[t["trigger-label-floating"]]: s,
|
|
56
|
+
[t["trigger-label-hidden"]]: O
|
|
53
57
|
},
|
|
54
|
-
|
|
55
|
-
),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
),
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
58
|
+
r.label
|
|
59
|
+
), J = n(t["trigger-content"], r.content), K = n(t["trigger-postfix"], r.postfixTitle), M = n(t["trigger-chevron-icon"], r.chevronIcon), Q = n(
|
|
60
|
+
t["trigger-prefix-icon"],
|
|
61
|
+
r.prefixIconContainer
|
|
62
|
+
), R = n(t["trigger-clear-icon"], r.clearIcon), U = (C) => {
|
|
63
|
+
C == null || C.stopPropagation(), m == null || m();
|
|
64
|
+
};
|
|
65
|
+
return /* @__PURE__ */ f("div", { className: P, style: e.wrapper, children: [
|
|
66
|
+
/* @__PURE__ */ f(
|
|
63
67
|
"button",
|
|
64
68
|
{
|
|
65
|
-
"data-testid":
|
|
66
|
-
"aria-invalid":
|
|
69
|
+
"data-testid": j,
|
|
70
|
+
"aria-invalid": g,
|
|
67
71
|
"aria-haspopup": "listbox",
|
|
68
|
-
"aria-expanded":
|
|
72
|
+
"aria-expanded": N,
|
|
69
73
|
role: "combobox",
|
|
70
|
-
className:
|
|
74
|
+
className: $,
|
|
71
75
|
style: e.triggerContainer,
|
|
72
76
|
disabled: o,
|
|
73
77
|
type: "button",
|
|
74
78
|
children: [
|
|
75
|
-
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
u && i !== "XL" && /* @__PURE__ */ a("div", { className: Q, style: e.prefixIconContainer, children: u }),
|
|
80
|
+
/* @__PURE__ */ f("div", { className: q, style: e.triggerContent, children: [
|
|
81
|
+
S && /* @__PURE__ */ a(
|
|
82
|
+
y.Label,
|
|
79
83
|
{
|
|
80
84
|
"data-testid": "trigger-label",
|
|
81
|
-
className:
|
|
85
|
+
className: B,
|
|
82
86
|
style: e.label,
|
|
83
|
-
size:
|
|
87
|
+
size: Y(i, s),
|
|
84
88
|
as: "span",
|
|
85
89
|
disabled: o,
|
|
86
|
-
typographyStyle:
|
|
87
|
-
children:
|
|
90
|
+
typographyStyle: s ? "secondary" : "tertiary",
|
|
91
|
+
children: v
|
|
88
92
|
}
|
|
89
93
|
),
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
c && /* @__PURE__ */ a(
|
|
95
|
+
y.Label,
|
|
92
96
|
{
|
|
93
97
|
"data-testid": "trigger-content-container",
|
|
94
|
-
className:
|
|
98
|
+
className: J,
|
|
95
99
|
style: e.content,
|
|
96
|
-
size:
|
|
100
|
+
size: E(i),
|
|
97
101
|
as: "span",
|
|
98
102
|
disabled: o,
|
|
99
|
-
children:
|
|
103
|
+
children: h ? p : Z(p, z)
|
|
100
104
|
}
|
|
101
105
|
),
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
c && !!b && /* @__PURE__ */ a(
|
|
107
|
+
y.Label,
|
|
104
108
|
{
|
|
105
109
|
"data-testid": "trigger-postfix",
|
|
106
|
-
className:
|
|
110
|
+
className: K,
|
|
107
111
|
style: e.postfixTitle,
|
|
108
|
-
size:
|
|
112
|
+
size: E(i),
|
|
109
113
|
disabled: o,
|
|
110
114
|
typographyStyle: "secondary",
|
|
111
|
-
|
|
115
|
+
fontWeight: "medium",
|
|
116
|
+
children: b
|
|
112
117
|
}
|
|
113
118
|
)
|
|
114
119
|
] }),
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
w && /* @__PURE__ */ a(
|
|
121
|
+
_,
|
|
117
122
|
{
|
|
118
|
-
className:
|
|
123
|
+
className: R,
|
|
119
124
|
"data-testid": "trigger-clear",
|
|
120
|
-
size:
|
|
125
|
+
size: X(i),
|
|
121
126
|
tabIndex: -1,
|
|
122
|
-
onClick:
|
|
127
|
+
onClick: U,
|
|
123
128
|
style: { outline: "none", ...e.clearIcon },
|
|
124
|
-
color:
|
|
129
|
+
color: x === "selected" ? "var(--icon-tertiary)" : void 0
|
|
125
130
|
}
|
|
126
|
-
)
|
|
127
|
-
|
|
131
|
+
),
|
|
132
|
+
W && /* @__PURE__ */ a(
|
|
133
|
+
tt,
|
|
128
134
|
{
|
|
129
135
|
"data-testid": "trigger-chevron",
|
|
130
|
-
size:
|
|
131
|
-
className:
|
|
136
|
+
size: X(i),
|
|
137
|
+
className: M,
|
|
132
138
|
color: "var(--icon-tertiary)",
|
|
133
139
|
style: e.chevronIcon
|
|
134
140
|
}
|
|
@@ -136,19 +142,19 @@ const cr = ({
|
|
|
136
142
|
]
|
|
137
143
|
}
|
|
138
144
|
),
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
k && /* @__PURE__ */ a(
|
|
146
|
+
rt,
|
|
141
147
|
{
|
|
142
|
-
title:
|
|
143
|
-
error:
|
|
144
|
-
className:
|
|
145
|
-
style:
|
|
148
|
+
title: G,
|
|
149
|
+
error: l ? d : void 0,
|
|
150
|
+
className: l ? r.error : r.description,
|
|
151
|
+
style: l ? e.error : e.description,
|
|
146
152
|
disabled: o,
|
|
147
|
-
"data-testid":
|
|
153
|
+
"data-testid": l ? "trigger-error" : "trigger-description"
|
|
148
154
|
}
|
|
149
155
|
)
|
|
150
156
|
] });
|
|
151
157
|
};
|
|
152
158
|
export {
|
|
153
|
-
|
|
159
|
+
pt as Trigger
|
|
154
160
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import '../../assets/components/Trigger/Trigger.module-
|
|
2
|
-
"trigger-wrapper": "_trigger-
|
|
3
|
-
"trigger-container": "_trigger-
|
|
4
|
-
"trigger-container-applied": "_trigger-container-
|
|
5
|
-
"trigger-container-open": "_trigger-container-
|
|
6
|
-
"trigger-container-error": "_trigger-container-
|
|
7
|
-
"trigger-container-size-XS": "_trigger-container-size-
|
|
8
|
-
"trigger-container-size-S": "_trigger-container-size-
|
|
9
|
-
"trigger-container-size-M": "_trigger-container-size-
|
|
10
|
-
"trigger-container-size-L": "_trigger-container-size-
|
|
11
|
-
"trigger-container-size-XL": "_trigger-container-size-
|
|
12
|
-
"trigger-container-floating": "_trigger-container-
|
|
13
|
-
"trigger-stretched": "_trigger-
|
|
14
|
-
"trigger-content-container": "_trigger-content-
|
|
15
|
-
"trigger-content-container-floating": "_trigger-content-container-
|
|
16
|
-
"trigger-label": "_trigger-
|
|
17
|
-
"trigger-label-floating": "_trigger-label-
|
|
18
|
-
"trigger-label-hidden": "_trigger-label-
|
|
19
|
-
"trigger-content": "_trigger-
|
|
20
|
-
"trigger-prefix-icon": "_trigger-prefix-
|
|
21
|
-
"trigger-chevron-icon": "_trigger-chevron-
|
|
22
|
-
"trigger-clear-icon": "_trigger-clear-
|
|
23
|
-
"trigger-postfix": "_trigger-
|
|
1
|
+
import '../../assets/components/Trigger/Trigger.module-Dc9gMp3_.css';const r = {
|
|
2
|
+
"trigger-wrapper": "_trigger-wrapper_zp1ok_74",
|
|
3
|
+
"trigger-container": "_trigger-container_zp1ok_80",
|
|
4
|
+
"trigger-container-applied": "_trigger-container-applied_zp1ok_103",
|
|
5
|
+
"trigger-container-open": "_trigger-container-open_zp1ok_108",
|
|
6
|
+
"trigger-container-error": "_trigger-container-error_zp1ok_119",
|
|
7
|
+
"trigger-container-size-XS": "_trigger-container-size-XS_zp1ok_131",
|
|
8
|
+
"trigger-container-size-S": "_trigger-container-size-S_zp1ok_141",
|
|
9
|
+
"trigger-container-size-M": "_trigger-container-size-M_zp1ok_147",
|
|
10
|
+
"trigger-container-size-L": "_trigger-container-size-L_zp1ok_153",
|
|
11
|
+
"trigger-container-size-XL": "_trigger-container-size-XL_zp1ok_161",
|
|
12
|
+
"trigger-container-floating": "_trigger-container-floating_zp1ok_167",
|
|
13
|
+
"trigger-stretched": "_trigger-stretched_zp1ok_172",
|
|
14
|
+
"trigger-content-container": "_trigger-content-container_zp1ok_176",
|
|
15
|
+
"trigger-content-container-floating": "_trigger-content-container-floating_zp1ok_185",
|
|
16
|
+
"trigger-label": "_trigger-label_zp1ok_190",
|
|
17
|
+
"trigger-label-floating": "_trigger-label-floating_zp1ok_197",
|
|
18
|
+
"trigger-label-hidden": "_trigger-label-hidden_zp1ok_209",
|
|
19
|
+
"trigger-content": "_trigger-content_zp1ok_176",
|
|
20
|
+
"trigger-prefix-icon": "_trigger-prefix-icon_zp1ok_223",
|
|
21
|
+
"trigger-chevron-icon": "_trigger-chevron-icon_zp1ok_228",
|
|
22
|
+
"trigger-clear-icon": "_trigger-clear-icon_zp1ok_244",
|
|
23
|
+
"trigger-postfix": "_trigger-postfix_zp1ok_260"
|
|
24
24
|
};
|
|
25
25
|
export {
|
|
26
26
|
r as default
|
|
@@ -15,6 +15,8 @@ export declare enum LabelState {
|
|
|
15
15
|
* Основные пропсы компонента Trigger
|
|
16
16
|
*/
|
|
17
17
|
export type TriggerCommonProps = {
|
|
18
|
+
/** Идентификатор кнопки триггера для тестов */
|
|
19
|
+
'data-testid'?: string;
|
|
18
20
|
/** Состояние триггера */
|
|
19
21
|
open: boolean;
|
|
20
22
|
/** Контент, отображаемый в триггере */
|
|
@@ -27,10 +29,19 @@ export type TriggerCommonProps = {
|
|
|
27
29
|
description?: string;
|
|
28
30
|
/** Растянуть компонент на всю ширину */
|
|
29
31
|
stretched?: boolean;
|
|
32
|
+
/** Обрезка content: false — отключить, true (по умолчанию) — 30 символов, число — свой лимит.
|
|
33
|
+
* При stretched=true обрезка отключена. Дробный лимит округляется вниз;
|
|
34
|
+
* отрицательный или не конечный лимит заменяется на 30.
|
|
35
|
+
*/
|
|
36
|
+
truncateContent?: number | boolean;
|
|
30
37
|
/** Стиль выделения: 'selected' - обычное состояние, 'applied' - применённое с возможностью очистки */
|
|
31
38
|
selectionStyle?: 'selected' | 'applied';
|
|
32
|
-
/** Показывать
|
|
39
|
+
/** Показывать иконку очистки при наличии контента и selectionStyle = 'selected' */
|
|
33
40
|
clearable?: boolean;
|
|
41
|
+
/** Показывать ли иконку очистки. Если не задано, определяется по content, selectionStyle и clearable. */
|
|
42
|
+
showClear?: boolean;
|
|
43
|
+
/** Показывать ли шеврон. Если не задано, отображается при отсутствии иконки очистки. */
|
|
44
|
+
showChevron?: boolean;
|
|
34
45
|
/** Иконка перед контентом */
|
|
35
46
|
prefixIcon?: ReactNode;
|
|
36
47
|
/** Текст после контента */
|
|
@@ -39,7 +50,7 @@ export type TriggerCommonProps = {
|
|
|
39
50
|
error?: string;
|
|
40
51
|
/** Дизейбл компонент */
|
|
41
52
|
disabled?: boolean;
|
|
42
|
-
/** Обработчик очистки поля (вызывается при клике на
|
|
53
|
+
/** Обработчик очистки поля (вызывается при клике на иконку очистки) */
|
|
43
54
|
onClear?: () => void;
|
|
44
55
|
/**
|
|
45
56
|
* Дополнительные классы для:
|
|
@@ -21,9 +21,10 @@ export declare const getContentTypographySize: (size: TriggerSize) => Typography
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const getIconSize: (size: TriggerSize) => "xs" | "sm";
|
|
23
23
|
/**
|
|
24
|
-
* Обрезает текст content
|
|
24
|
+
* Обрезает текст content по заданному лимиту (по умолчанию 30 символов)
|
|
25
25
|
*
|
|
26
26
|
* @param content - текст для обрезки
|
|
27
|
+
* @param limit - false отключает обрезку, true задаёт лимит 30, число — свой лимит
|
|
27
28
|
* @returns обрезанный текст с многоточием или исходный текст
|
|
28
29
|
*/
|
|
29
|
-
export declare const truncateContent: (content: string) => string;
|
|
30
|
+
export declare const truncateContent: (content: string, limit?: number | boolean) => string;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { LabelState as
|
|
2
|
-
const L = (r,
|
|
1
|
+
import { LabelState as t } from "../Trigger.type.js";
|
|
2
|
+
const L = (r, e) => r === "XL" && e ? t.FLOATING : r !== "XL" && e ? t.HIDDEN : t.NORMAL, o = (r, e) => e ? 3 : r === "XL" || r === "L" ? 2 : 3, f = (r) => r === "XL" || r === "L" ? 2 : 3, a = (r) => r === "XL" || r === "L" ? "sm" : "xs", g = (r, e = !0) => {
|
|
3
|
+
if (e === !1) return r;
|
|
4
|
+
const n = typeof e == "number" && Number.isFinite(e) && e >= 0 ? Math.floor(e) : 30;
|
|
5
|
+
return r.length > n ? r.slice(0, n) + "…" : r;
|
|
6
|
+
};
|
|
3
7
|
export {
|
|
4
|
-
|
|
8
|
+
f as getContentTypographySize,
|
|
5
9
|
a as getIconSize,
|
|
6
10
|
L as getLabelState,
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
o as getLabelTypographySize,
|
|
12
|
+
g as truncateContent
|
|
9
13
|
};
|