@situaction/traq-ui-ste 1.2.29 → 1.2.31
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.
|
@@ -5,18 +5,18 @@ import { Input as G } from "../input/Input.js";
|
|
|
5
5
|
import { IconButton as H } from "../icon-button/IconButton.js";
|
|
6
6
|
import "../accordion/Accordion.js";
|
|
7
7
|
import { Icon as _ } from "../icon/Icon.js";
|
|
8
|
-
import { Modal as
|
|
8
|
+
import { Modal as I } from "../modal/Modal.js";
|
|
9
9
|
import "../carousel/Carousel.js";
|
|
10
10
|
import "../carousel/FadeCarousel.js";
|
|
11
11
|
import "../theme/ThemeContext.js";
|
|
12
12
|
import '../../styles/Size.css';import '../../styles/Select.css';/* empty css */
|
|
13
|
-
const
|
|
14
|
-
selectContainer:
|
|
15
|
-
children:
|
|
16
|
-
active:
|
|
17
|
-
selectList:
|
|
18
|
-
modal:
|
|
19
|
-
itemLabel:
|
|
13
|
+
const J = "_selectContainer_133eb_54", Q = "_children_133eb_61", X = "_active_133eb_78", Y = "_selectList_133eb_82", Z = "_modal_133eb_91", O = "_itemLabel_133eb_98", ee = "_searchWrapper_133eb_103", te = "_noResults_133eb_109", f = {
|
|
14
|
+
selectContainer: J,
|
|
15
|
+
children: Q,
|
|
16
|
+
active: X,
|
|
17
|
+
selectList: Y,
|
|
18
|
+
modal: Z,
|
|
19
|
+
itemLabel: O,
|
|
20
20
|
searchWrapper: ee,
|
|
21
21
|
noResults: te
|
|
22
22
|
}, me = ({
|
|
@@ -27,15 +27,15 @@ const Q = "_selectContainer_133eb_54", X = "_children_133eb_61", Y = "_active_13
|
|
|
27
27
|
onSelect: B,
|
|
28
28
|
positionOverride: b,
|
|
29
29
|
placeholder: x = "Sélectionner",
|
|
30
|
-
searchPlaceholder:
|
|
30
|
+
searchPlaceholder: U,
|
|
31
31
|
autoCloseCondition: w,
|
|
32
|
-
searchable:
|
|
32
|
+
searchable: V = !1,
|
|
33
33
|
fullWidth: T = !1
|
|
34
34
|
}) => {
|
|
35
35
|
const [t, l] = y(!1), [A, K] = y({
|
|
36
36
|
top: "calc(100% + 6px)",
|
|
37
37
|
left: "0px"
|
|
38
|
-
}), [n, S] = y(k ?? null), [$, F] = y(""), u = v(null),
|
|
38
|
+
}), [n, S] = y(k ?? null), [$, F] = y(""), u = v(null), z = v(null), N = v(null), P = v({}), j = v({}), p = v(null);
|
|
39
39
|
d(() => {
|
|
40
40
|
S(k || null);
|
|
41
41
|
}, [k]), d(() => {
|
|
@@ -85,7 +85,7 @@ const Q = "_selectContainer_133eb_54", X = "_children_133eb_61", Y = "_active_13
|
|
|
85
85
|
"aria-haspopup": "listbox"
|
|
86
86
|
}
|
|
87
87
|
);
|
|
88
|
-
},
|
|
88
|
+
}, D = h.filter(
|
|
89
89
|
(e) => String(e.label ?? "").toLowerCase().includes($.toLowerCase())
|
|
90
90
|
), [C, R] = y("");
|
|
91
91
|
return d(() => {
|
|
@@ -137,7 +137,7 @@ const Q = "_selectContainer_133eb_54", X = "_children_133eb_61", Y = "_active_13
|
|
|
137
137
|
return (a = o.label) == null ? void 0 : a.toLowerCase().startsWith(c);
|
|
138
138
|
});
|
|
139
139
|
if (i) {
|
|
140
|
-
const o =
|
|
140
|
+
const o = j.current[i.value];
|
|
141
141
|
o && o.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -151,7 +151,7 @@ const Q = "_selectContainer_133eb_54", X = "_children_133eb_61", Y = "_active_13
|
|
|
151
151
|
}, [t, b]), d(() => {
|
|
152
152
|
if (!t || !w) return;
|
|
153
153
|
const e = (r) => {
|
|
154
|
-
const c = r.target, i = u.current, o =
|
|
154
|
+
const c = r.target, i = u.current, o = z.current;
|
|
155
155
|
i && i.contains(c) || o && o.contains(c) || l(!1);
|
|
156
156
|
};
|
|
157
157
|
return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), () => {
|
|
@@ -166,7 +166,7 @@ const Q = "_selectContainer_133eb_54", X = "_children_133eb_61", Y = "_active_13
|
|
|
166
166
|
}, [t, w]), /* @__PURE__ */ L("div", { className: f.selectContainer, children: [
|
|
167
167
|
q(),
|
|
168
168
|
/* @__PURE__ */ s(
|
|
169
|
-
|
|
169
|
+
I,
|
|
170
170
|
{
|
|
171
171
|
anchorRef: u,
|
|
172
172
|
open: t,
|
|
@@ -175,13 +175,13 @@ const Q = "_selectContainer_133eb_54", X = "_children_133eb_61", Y = "_active_13
|
|
|
175
175
|
disableOverlay: !0,
|
|
176
176
|
className: f.modal,
|
|
177
177
|
autoCloseCondition: w,
|
|
178
|
-
children: /* @__PURE__ */ L("div", { ref:
|
|
179
|
-
|
|
178
|
+
children: /* @__PURE__ */ L("div", { ref: z, children: [
|
|
179
|
+
V && /* @__PURE__ */ L("div", { children: [
|
|
180
180
|
/* @__PURE__ */ s(
|
|
181
181
|
G,
|
|
182
182
|
{
|
|
183
183
|
type: "text",
|
|
184
|
-
placeholder:
|
|
184
|
+
placeholder: U,
|
|
185
185
|
status: "ghost",
|
|
186
186
|
sizeStyle: "s",
|
|
187
187
|
value: $,
|
|
@@ -191,22 +191,22 @@ const Q = "_selectContainer_133eb_54", X = "_children_133eb_61", Y = "_active_13
|
|
|
191
191
|
/* @__PURE__ */ s("div", { className: f.searchWrapper })
|
|
192
192
|
] }),
|
|
193
193
|
/* @__PURE__ */ L("div", { className: f.selectList, ref: N, children: [
|
|
194
|
-
|
|
194
|
+
D.map((e) => /* @__PURE__ */ L(
|
|
195
195
|
"div",
|
|
196
196
|
{
|
|
197
|
-
ref: (r) =>
|
|
197
|
+
ref: (r) => j.current[e.value] = r,
|
|
198
198
|
className: `${f.children} ${(n == null ? void 0 : n.value) === e.value ? f.active : ""}`,
|
|
199
199
|
onClick: () => M(e),
|
|
200
200
|
role: "option",
|
|
201
201
|
"aria-selected": (n == null ? void 0 : n.value) === e.value,
|
|
202
202
|
children: [
|
|
203
|
-
e.icon && /* @__PURE__ */ s(_, { icon: e.icon, size:
|
|
203
|
+
e.icon && /* @__PURE__ */ s(_, { icon: e.icon, size: e.sizeIcon ? e.sizeIcon : 20 }),
|
|
204
204
|
e.label && /* @__PURE__ */ s("div", { className: f.itemLabel, children: e.label })
|
|
205
205
|
]
|
|
206
206
|
},
|
|
207
207
|
e.value
|
|
208
208
|
)),
|
|
209
|
-
|
|
209
|
+
D.length === 0 && /* @__PURE__ */ s("div", { className: `${f.noResults} textSmall`, children: "Aucun résultat" })
|
|
210
210
|
] })
|
|
211
211
|
] })
|
|
212
212
|
}
|
|
@@ -4,8 +4,12 @@ import { Color, Size } from '../interface';
|
|
|
4
4
|
export interface TagProps {
|
|
5
5
|
/** The text label for the tag. This will be displayed if provided. */
|
|
6
6
|
label?: string;
|
|
7
|
-
/** The color
|
|
7
|
+
/** The design-system color name (uses --color-<name>-* tokens). */
|
|
8
8
|
color?: Color;
|
|
9
|
+
/** Custom background color (hex/rgb/hsl/var(...)). Overrides `color` if provided. */
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
/** Custom text color (hex/rgb/hsl/var(...)). If omitted, a default is used. */
|
|
12
|
+
textColor?: string;
|
|
9
13
|
/** Indicates if the tag can be deleted; when true, a delete icon is shown. */
|
|
10
14
|
deletable?: boolean;
|
|
11
15
|
/** The size of the tag, which affects its styling. */
|
|
@@ -15,8 +19,4 @@ export interface TagProps {
|
|
|
15
19
|
/** A callback function to be called when the tag is clicked. */
|
|
16
20
|
onClick?: () => void;
|
|
17
21
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Tag component to display a label with customizable color, size, and content.
|
|
20
|
-
* It can also display a delete icon if `deletable` is true.
|
|
21
|
-
*/
|
|
22
22
|
export declare const Tag: FC<TagProps>;
|
|
@@ -1,67 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import '../../styles/Tag.css';const
|
|
4
|
-
tag:
|
|
5
|
-
icon:
|
|
6
|
-
"tag-children": "_tag-
|
|
7
|
-
"tag-size-xl": "_tag-size-
|
|
8
|
-
"tag-size-xl-round": "_tag-size-xl-
|
|
9
|
-
"tag-size-l": "_tag-size-
|
|
10
|
-
"tag-size-l-round": "_tag-size-l-
|
|
11
|
-
"tag-size-m": "_tag-size-
|
|
12
|
-
"tag-size-m-round": "_tag-size-m-
|
|
13
|
-
"tag-size-s": "_tag-size-
|
|
14
|
-
"tag-size-s-round": "_tag-size-s-
|
|
15
|
-
label:
|
|
16
|
-
flexHorizontalCenter:
|
|
17
|
-
flexHorizontal:
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsxs as z, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as b } from "react";
|
|
3
|
+
import '../../styles/Tag.css';const u = "_tag_1k5bo_6", m = "_icon_1k5bo_15", x = "_label_1k5bo_74", f = "_flexHorizontalCenter_1k5bo_78", k = "_flexHorizontal_1k5bo_78", t = {
|
|
4
|
+
tag: u,
|
|
5
|
+
icon: m,
|
|
6
|
+
"tag-children": "_tag-children_1k5bo_24",
|
|
7
|
+
"tag-size-xl": "_tag-size-xl_1k5bo_34",
|
|
8
|
+
"tag-size-xl-round": "_tag-size-xl-round_1k5bo_38",
|
|
9
|
+
"tag-size-l": "_tag-size-l_1k5bo_44",
|
|
10
|
+
"tag-size-l-round": "_tag-size-l-round_1k5bo_48",
|
|
11
|
+
"tag-size-m": "_tag-size-m_1k5bo_54",
|
|
12
|
+
"tag-size-m-round": "_tag-size-m-round_1k5bo_58",
|
|
13
|
+
"tag-size-s": "_tag-size-s_1k5bo_64",
|
|
14
|
+
"tag-size-s-round": "_tag-size-s-round_1k5bo_68",
|
|
15
|
+
label: x,
|
|
16
|
+
flexHorizontalCenter: f,
|
|
17
|
+
flexHorizontal: k
|
|
18
|
+
}, h = [
|
|
19
|
+
"light",
|
|
20
|
+
"dark",
|
|
21
|
+
"gray",
|
|
22
|
+
"blue-gray",
|
|
23
|
+
"blue",
|
|
24
|
+
"blue-situaction",
|
|
25
|
+
"purple",
|
|
26
|
+
"pink",
|
|
27
|
+
"gold",
|
|
28
|
+
"brown",
|
|
29
|
+
"emerald"
|
|
30
|
+
], p = "blue-situaction", H = ({
|
|
31
|
+
label: s,
|
|
32
|
+
color: o,
|
|
33
|
+
backgroundColor: l,
|
|
34
|
+
textColor: r,
|
|
35
|
+
deletable: g = !1,
|
|
36
|
+
size: _ = "m",
|
|
37
|
+
children: n,
|
|
38
|
+
onClick: i
|
|
25
39
|
}) => {
|
|
26
|
-
c
|
|
27
|
-
e && !s.includes(e) && console.warn(`Warning: The color "${e}" is not a valid option. Expected one of: ${s.join(", ")}.`);
|
|
28
|
-
}, [e]);
|
|
29
|
-
const _ = [
|
|
40
|
+
const c = [
|
|
30
41
|
t.tag,
|
|
31
|
-
|
|
32
|
-
t[`tag-size-${
|
|
42
|
+
n && !s ? t[`tag-size-${_}-round`] : "",
|
|
43
|
+
t[`tag-size-${_}`],
|
|
33
44
|
t.flexHorizontalCenter
|
|
34
|
-
].join(" "),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
);
|
|
45
|
+
].filter(Boolean).join(" "), d = b(() => {
|
|
46
|
+
if (l)
|
|
47
|
+
return {
|
|
48
|
+
"--dynamic-background": l,
|
|
49
|
+
"--dynamic-color-text": r ?? "var(--color-blue-situaction-950)"
|
|
50
|
+
};
|
|
51
|
+
const a = o && h.includes(o) ? o : p;
|
|
52
|
+
return {
|
|
53
|
+
"--dynamic-background": `var(--color-${a}-200)`,
|
|
54
|
+
"--dynamic-color-text": `var(--color-${a}-950)`
|
|
55
|
+
};
|
|
56
|
+
}, [l, r, o]);
|
|
57
|
+
return /* @__PURE__ */ z("div", { className: c, style: d, children: [
|
|
58
|
+
n && /* @__PURE__ */ e("div", { className: `${t.flexHorizontalCenter} ${t["tag-children"]}`, children: n }),
|
|
59
|
+
s && /* @__PURE__ */ e("label", { className: `${t.flexHorizontal} ${t.label}`, children: s }),
|
|
60
|
+
g && /* @__PURE__ */ e(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: t.icon,
|
|
64
|
+
onClick: (a) => {
|
|
65
|
+
a.stopPropagation(), i == null || i();
|
|
66
|
+
},
|
|
67
|
+
role: "button",
|
|
68
|
+
"aria-label": "Delete tag",
|
|
69
|
+
children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10", height: "10", viewBox: "0 0 256 256", children: /* @__PURE__ */ e("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }) })
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
64
73
|
};
|
|
65
74
|
export {
|
|
66
|
-
|
|
75
|
+
H as Tag
|
|
67
76
|
};
|
package/dist/styles/Tag.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._tag_1k5bo_6{color:var(--dynamic-color-text);background-color:var(--dynamic-background);border-radius:50px;line-height:normal;gap:.25rem;font-weight:600;letter-spacing:.84px}._tag_1k5bo_6 ._icon_1k5bo_15{display:flex;cursor:pointer;fill:var(--dynamic-color-text)!important}._tag_1k5bo_6 ._icon_1k5bo_15 svg,._tag_1k5bo_6 ._icon_1k5bo_15 svg path{fill:var(--dynamic-color-text)!important}._tag-children_1k5bo_24{color:var(--dynamic-color-text);border-radius:50px;min-width:16px;min-height:16px;aspect-ratio:1/1}._tag-size-xl_1k5bo_34{padding:.5rem .75rem;font-size:1.125em}._tag-size-xl-round_1k5bo_38{padding:.5rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-l_1k5bo_44{padding:.375rem .625rem;font-size:1em}._tag-size-l-round_1k5bo_48{padding:.375rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-m_1k5bo_54{padding:.25rem .5rem;font-size:.875em}._tag-size-m-round_1k5bo_58{padding:.25rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-s_1k5bo_64{padding:.1875rem .5rem;font-size:.75em}._tag-size-s-round_1k5bo_68{padding:.125rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag_1k5bo_6 ._label_1k5bo_74{white-space:nowrap}._flexHorizontalCenter_1k5bo_78{display:flex;justify-content:center;align-items:center;flex-direction:row}._flexHorizontal_1k5bo_78{display:flex;justify-content:flex-start;align-items:center;flex-direction:row}
|