@fluidattacks/design 10.3.1 → 10.4.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ITagProps, TTagVariant } from './types';
|
|
2
|
-
declare const Tag: ({ disabled, dot, icon, iconColor, iconType, id, filterId, filterValues, fontSize, fullWidth, href, linkLabel, onBodyClick, onClose, priority, selected, tagTitle, tagLabel, truncate, variant, }: Readonly<ITagProps>) => JSX.Element;
|
|
2
|
+
declare const Tag: ({ disabled, dot, icon, iconColor, iconType, id, filterId, filterValues, fontSize, fullWidth, href, linkLabel, onBodyClick, onClose, priority, selected, tagTitle, tagLabel, truncate, variant, wrap, }: Readonly<ITagProps>) => JSX.Element;
|
|
3
3
|
export type { ITagProps, TTagVariant };
|
|
4
4
|
export { Tag };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { l as
|
|
3
|
-
import { StyledTag as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { IconButton as
|
|
6
|
-
import { Link as
|
|
2
|
+
import { l as E } from "../../_virtual/lodash.js";
|
|
3
|
+
import { StyledTag as j, StyledTagContent as K, StyledDot as P } from "./styles.js";
|
|
4
|
+
import { Icon as W } from "../icon/index.js";
|
|
5
|
+
import { IconButton as C } from "../icon-button/index.js";
|
|
6
|
+
import { Link as q } from "../link/index.js";
|
|
7
7
|
import "../typography/heading/index.js";
|
|
8
|
-
import { Span as
|
|
8
|
+
import { Span as A } from "../typography/span/index.js";
|
|
9
9
|
import "../typography/text/index.js";
|
|
10
|
-
const
|
|
10
|
+
const X = ({
|
|
11
11
|
disabled: f,
|
|
12
12
|
dot: h = !1,
|
|
13
13
|
icon: d,
|
|
@@ -22,20 +22,21 @@ const U = ({
|
|
|
22
22
|
linkLabel: $,
|
|
23
23
|
onBodyClick: i,
|
|
24
24
|
onClose: n,
|
|
25
|
-
priority:
|
|
25
|
+
priority: w = "default",
|
|
26
26
|
selected: a,
|
|
27
27
|
tagTitle: p = "",
|
|
28
28
|
tagLabel: l,
|
|
29
|
-
truncate:
|
|
30
|
-
variant: z = "default"
|
|
29
|
+
truncate: T = !0,
|
|
30
|
+
variant: z = "default",
|
|
31
|
+
wrap: D = !1
|
|
31
32
|
}) => {
|
|
32
|
-
const
|
|
33
|
+
const I = l.length > 25 && T && E.isEmpty(p + c), N = `${l.slice(0, 25)}...`, b = (t) => {
|
|
33
34
|
t.target === t.currentTarget && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), i?.());
|
|
34
|
-
},
|
|
35
|
+
}, k = (t) => {
|
|
35
36
|
t.stopPropagation(), n?.();
|
|
36
37
|
}, s = i !== void 0, m = s && typeof a == "boolean";
|
|
37
38
|
return /* @__PURE__ */ e(
|
|
38
|
-
|
|
39
|
+
A,
|
|
39
40
|
{
|
|
40
41
|
className: "gap-0.5",
|
|
41
42
|
color: "inherit",
|
|
@@ -43,7 +44,7 @@ const U = ({
|
|
|
43
44
|
size: "md",
|
|
44
45
|
children: [
|
|
45
46
|
/* @__PURE__ */ e(
|
|
46
|
-
|
|
47
|
+
j,
|
|
47
48
|
{
|
|
48
49
|
$fontSize: y,
|
|
49
50
|
$fullWidth: S,
|
|
@@ -51,19 +52,20 @@ const U = ({
|
|
|
51
52
|
$selectable: m,
|
|
52
53
|
$selected: a === !0,
|
|
53
54
|
$variant: z,
|
|
54
|
-
|
|
55
|
+
$wrap: D,
|
|
56
|
+
className: w,
|
|
55
57
|
"data-testid": x,
|
|
56
58
|
...s && {
|
|
57
59
|
...m ? { "aria-pressed": a } : {},
|
|
58
60
|
onClick: i,
|
|
59
|
-
onKeyDown:
|
|
61
|
+
onKeyDown: b,
|
|
60
62
|
role: "button",
|
|
61
63
|
tabIndex: 0
|
|
62
64
|
},
|
|
63
65
|
children: [
|
|
64
|
-
/* @__PURE__ */ e(
|
|
66
|
+
/* @__PURE__ */ e(K, { children: [
|
|
65
67
|
d ? /* @__PURE__ */ o(
|
|
66
|
-
|
|
68
|
+
W,
|
|
67
69
|
{
|
|
68
70
|
icon: d,
|
|
69
71
|
iconColor: u,
|
|
@@ -71,15 +73,15 @@ const U = ({
|
|
|
71
73
|
iconType: v
|
|
72
74
|
}
|
|
73
75
|
) : void 0,
|
|
74
|
-
h ? /* @__PURE__ */ o(
|
|
76
|
+
h ? /* @__PURE__ */ o(P, { "data-testid": "tag-dot" }) : void 0,
|
|
75
77
|
/* @__PURE__ */ e("span", { className: "w-full", children: [
|
|
76
78
|
/* @__PURE__ */ o("strong", { children: p }),
|
|
77
|
-
/* @__PURE__ */ o("span", { children:
|
|
79
|
+
/* @__PURE__ */ o("span", { children: I ? N : l }),
|
|
78
80
|
/* @__PURE__ */ o("strong", { className: "w-full", children: c })
|
|
79
81
|
] })
|
|
80
82
|
] }),
|
|
81
83
|
n ? /* @__PURE__ */ o(
|
|
82
|
-
|
|
84
|
+
C,
|
|
83
85
|
{
|
|
84
86
|
disabled: f,
|
|
85
87
|
icon: "xmark",
|
|
@@ -87,7 +89,7 @@ const U = ({
|
|
|
87
89
|
iconSize: "xs",
|
|
88
90
|
iconType: "fa-light",
|
|
89
91
|
id: g,
|
|
90
|
-
onClick: i !== void 0 ?
|
|
92
|
+
onClick: i !== void 0 ? k : n,
|
|
91
93
|
px: 0.125,
|
|
92
94
|
py: 0.125,
|
|
93
95
|
variant: "ghost"
|
|
@@ -96,11 +98,11 @@ const U = ({
|
|
|
96
98
|
]
|
|
97
99
|
}
|
|
98
100
|
),
|
|
99
|
-
r === void 0 ? void 0 : /* @__PURE__ */ o(
|
|
101
|
+
r === void 0 ? void 0 : /* @__PURE__ */ o(q, { href: r, children: $ })
|
|
100
102
|
]
|
|
101
103
|
}
|
|
102
104
|
);
|
|
103
105
|
};
|
|
104
106
|
export {
|
|
105
|
-
|
|
107
|
+
X as Tag
|
|
106
108
|
};
|
|
@@ -6,6 +6,7 @@ interface IStyledTag {
|
|
|
6
6
|
$selectable?: boolean;
|
|
7
7
|
$selected?: boolean;
|
|
8
8
|
$variant: TTagVariant;
|
|
9
|
+
$wrap?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const StyledTag: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof IStyledTag> & IStyledTag, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof IStyledTag> & IStyledTag, never>>> & string;
|
|
11
12
|
declare const StyledTagContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { styled as a } from "styled-components";
|
|
2
|
-
import { variantBuilder as
|
|
3
|
-
const { getVariant:
|
|
2
|
+
import { variantBuilder as g } from "../@core/variants/utils.js";
|
|
3
|
+
const { getVariant: e } = g(
|
|
4
4
|
(o) => ({
|
|
5
5
|
complementary: `
|
|
6
6
|
background-color: ${o.palette.complementary[300]};
|
|
@@ -125,7 +125,7 @@ const { getVariant: g } = i(
|
|
|
125
125
|
}
|
|
126
126
|
`
|
|
127
127
|
})
|
|
128
|
-
),
|
|
128
|
+
), d = (o, r) => `
|
|
129
129
|
background-color: ${r ? o.palette.gray[800] : o.palette.white};
|
|
130
130
|
border: 1px solid ${o.palette.gray[800]};
|
|
131
131
|
color: ${r ? o.palette.white : o.palette.gray[800]};
|
|
@@ -134,15 +134,16 @@ const { getVariant: g } = i(
|
|
|
134
134
|
&:hover {
|
|
135
135
|
background-color: ${r ? o.palette.gray[800] : o.palette.gray[100]};
|
|
136
136
|
}
|
|
137
|
-
`,
|
|
137
|
+
`, u = a.span`
|
|
138
138
|
${({
|
|
139
139
|
theme: o,
|
|
140
140
|
$fontSize: r = o.typography.text.sm,
|
|
141
|
-
$fullWidth:
|
|
141
|
+
$fullWidth: n = !1,
|
|
142
142
|
$variant: l,
|
|
143
|
-
$interactive:
|
|
143
|
+
$interactive: p = !1,
|
|
144
144
|
$selectable: c = !1,
|
|
145
|
-
$selected:
|
|
145
|
+
$selected: i = !1,
|
|
146
|
+
$wrap: t = !1
|
|
146
147
|
}) => `
|
|
147
148
|
align-items: center;
|
|
148
149
|
border-radius: ${o.spacing[l === "technique" ? 1 : 0.25]};
|
|
@@ -155,9 +156,10 @@ const { getVariant: g } = i(
|
|
|
155
156
|
justify-content: center;
|
|
156
157
|
line-height: 18px;
|
|
157
158
|
padding: var(--tag-padding-y) var(--tag-padding-x);
|
|
158
|
-
white-space: nowrap;
|
|
159
|
-
width: ${
|
|
160
|
-
${
|
|
159
|
+
white-space: ${t ? "normal" : "nowrap"};
|
|
160
|
+
width: ${n ? "100%" : "max-content"};
|
|
161
|
+
${t ? "max-width: 100%; overflow-wrap: anywhere;" : ""}
|
|
162
|
+
${p && !c ? "cursor: pointer;" : ""}
|
|
161
163
|
|
|
162
164
|
~ a {
|
|
163
165
|
font-size: ${o.typography.text.xs};
|
|
@@ -177,17 +179,17 @@ const { getVariant: g } = i(
|
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
|
|
180
|
-
${
|
|
181
|
-
${c ?
|
|
182
|
+
${e(o, l)}
|
|
183
|
+
${c ? d(o, i) : ""}
|
|
182
184
|
`}
|
|
183
|
-
`,
|
|
185
|
+
`, y = a.span`
|
|
184
186
|
${({ theme: o }) => `
|
|
185
187
|
align-items: center;
|
|
186
188
|
display: inline-flex;
|
|
187
189
|
gap: ${o.spacing[0.25]};
|
|
188
190
|
min-width: 0;
|
|
189
191
|
`}
|
|
190
|
-
`,
|
|
192
|
+
`, b = a.span`
|
|
191
193
|
background-color: currentColor;
|
|
192
194
|
border-radius: 50%;
|
|
193
195
|
flex-shrink: 0;
|
|
@@ -195,7 +197,7 @@ const { getVariant: g } = i(
|
|
|
195
197
|
width: 6px;
|
|
196
198
|
`;
|
|
197
199
|
export {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
200
|
+
b as StyledDot,
|
|
201
|
+
u as StyledTag,
|
|
202
|
+
y as StyledTagContent
|
|
201
203
|
};
|
|
@@ -24,6 +24,8 @@ type TTagPriority = "default" | "high" | "low" | "medium";
|
|
|
24
24
|
* @property { boolean } [truncate] - Whether the tag should truncate its content.
|
|
25
25
|
* @property { TTagPriority } [priority] - The priority of the tag.
|
|
26
26
|
* @property { TTagVariant } [variant] - The variant of the tag.
|
|
27
|
+
* @property { boolean } [wrap] - Whether a label wider than its container
|
|
28
|
+
* breaks onto more lines instead of overflowing.
|
|
27
29
|
*/
|
|
28
30
|
interface ITagProps extends Partial<Pick<IIconModifiable, "icon" | "iconColor" | "iconType">>, React.HTMLAttributes<HTMLSpanElement> {
|
|
29
31
|
disabled?: boolean;
|
|
@@ -42,5 +44,6 @@ interface ITagProps extends Partial<Pick<IIconModifiable, "icon" | "iconColor" |
|
|
|
42
44
|
truncate?: boolean;
|
|
43
45
|
priority?: TTagPriority;
|
|
44
46
|
variant?: TTagVariant;
|
|
47
|
+
wrap?: boolean;
|
|
45
48
|
}
|
|
46
49
|
export type { ITagProps, TTagVariant };
|
package/package.json
CHANGED