@situaction/traq-ui-ste 1.2.4 → 1.2.6
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,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Input as
|
|
5
|
-
import { IconButton as
|
|
1
|
+
import { jsxs as b, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useRef as m, useEffect as v } from "react";
|
|
3
|
+
import { Button as B } from "../button/Button.js";
|
|
4
|
+
import { Input as G } from "../input/Input.js";
|
|
5
|
+
import { IconButton as H } from "../icon-button/IconButton.js";
|
|
6
6
|
import { Icon as _ } from "../icon/Icon.js";
|
|
7
7
|
import { Modal as J } from "../modal/Modal.js";
|
|
8
8
|
import "../theme/ThemeContext.js";
|
|
9
9
|
import '../../styles/Size.css';import '../../styles/Select.css';/* empty css */
|
|
10
|
-
const O = "_selectContainer_133eb_54", Q = "_selected_133eb_57", X = "_children_133eb_61", Y = "_active_133eb_78", Z = "_selectList_133eb_82", ee = "_modal_133eb_91", te = "_dropdownFadeIn_133eb_1", ne = "_itemLabel_133eb_98", re = "_searchWrapper_133eb_103", oe = "_noResults_133eb_109",
|
|
10
|
+
const O = "_selectContainer_133eb_54", Q = "_selected_133eb_57", X = "_children_133eb_61", Y = "_active_133eb_78", Z = "_selectList_133eb_82", ee = "_modal_133eb_91", te = "_dropdownFadeIn_133eb_1", ne = "_itemLabel_133eb_98", re = "_searchWrapper_133eb_103", oe = "_noResults_133eb_109", i = {
|
|
11
11
|
selectContainer: O,
|
|
12
12
|
selected: Q,
|
|
13
13
|
children: X,
|
|
@@ -21,131 +21,131 @@ const O = "_selectContainer_133eb_54", Q = "_selected_133eb_57", X = "_children_
|
|
|
21
21
|
}, me = ({
|
|
22
22
|
selected: L,
|
|
23
23
|
size: C = "m",
|
|
24
|
-
listItem:
|
|
24
|
+
listItem: u,
|
|
25
25
|
modeDisplay: x = "all",
|
|
26
|
-
onSelect:
|
|
26
|
+
onSelect: F,
|
|
27
27
|
positionOverride: y,
|
|
28
|
-
placeholder:
|
|
29
|
-
searchPlaceholder:
|
|
30
|
-
autoCloseCondition:
|
|
31
|
-
searchable:
|
|
28
|
+
placeholder: k = "Sélectionner",
|
|
29
|
+
searchPlaceholder: j,
|
|
30
|
+
autoCloseCondition: U,
|
|
31
|
+
searchable: V = !1,
|
|
32
32
|
fullWidth: S = !1
|
|
33
33
|
}) => {
|
|
34
|
-
const [t, f] =
|
|
34
|
+
const [t, f] = p(!1), z = m(null), [A, P] = p({
|
|
35
35
|
top: "calc(100% + 6px)",
|
|
36
36
|
left: "0px"
|
|
37
|
-
}), [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}, [L
|
|
37
|
+
}), [o, E] = p(L ?? null), [$, M] = p("");
|
|
38
|
+
v(() => {
|
|
39
|
+
E(L || null);
|
|
40
|
+
}, [L]), v(() => {
|
|
41
41
|
y && P(y);
|
|
42
42
|
}, [y]);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
const e =
|
|
47
|
-
return x === "icon" && e ? /* @__PURE__ */ r(
|
|
48
|
-
|
|
43
|
+
const q = (e) => {
|
|
44
|
+
E(e), f(!1), F && F(e);
|
|
45
|
+
}, D = () => {
|
|
46
|
+
const e = o == null ? void 0 : o.icon, s = (o == null ? void 0 : o.label) ?? k;
|
|
47
|
+
return x === "icon" && e ? /* @__PURE__ */ r(H, { ref: d, mode: "tertiary", size: C, onClick: () => f(!t), children: /* @__PURE__ */ r(_, { icon: o.icon }) }) : x === "text" ? /* @__PURE__ */ r(
|
|
48
|
+
B,
|
|
49
49
|
{
|
|
50
50
|
ref: d,
|
|
51
51
|
mode: "tertiary",
|
|
52
|
-
label: o,
|
|
52
|
+
label: o ? s : k,
|
|
53
53
|
childrenRight: /* @__PURE__ */ r(_, { icon: t ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
|
|
54
54
|
size: C,
|
|
55
55
|
fullWidth: S,
|
|
56
56
|
onClick: () => f(!t)
|
|
57
57
|
}
|
|
58
58
|
) : x === "all" ? /* @__PURE__ */ r(
|
|
59
|
-
|
|
59
|
+
B,
|
|
60
60
|
{
|
|
61
61
|
ref: d,
|
|
62
62
|
mode: "tertiary",
|
|
63
|
-
label: o,
|
|
63
|
+
label: o ? s : k,
|
|
64
64
|
size: C,
|
|
65
65
|
fullWidth: S,
|
|
66
|
-
childrenLeft: e && /* @__PURE__ */ r(_, { icon:
|
|
66
|
+
childrenLeft: e && /* @__PURE__ */ r(_, { icon: o.icon }),
|
|
67
67
|
childrenRight: /* @__PURE__ */ r(_, { icon: t ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
|
|
68
68
|
onClick: () => f(!t)
|
|
69
69
|
}
|
|
70
70
|
) : /* @__PURE__ */ r(
|
|
71
|
-
|
|
71
|
+
B,
|
|
72
72
|
{
|
|
73
73
|
ref: d,
|
|
74
74
|
mode: "tertiary",
|
|
75
75
|
fullWidth: S,
|
|
76
|
-
label:
|
|
76
|
+
label: k ?? "Sélectionner",
|
|
77
77
|
size: C,
|
|
78
78
|
onClick: () => f(!t)
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
|
-
},
|
|
81
|
+
}, N = m(null), g = m({}), [R, w] = p(""), h = m(null), I = m({}), K = u.filter(
|
|
82
82
|
(e) => String(e.label ?? "").toLowerCase().includes($.toLowerCase())
|
|
83
|
-
),
|
|
83
|
+
), W = (e) => {
|
|
84
84
|
if (!t) return;
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
var
|
|
91
|
-
return (
|
|
85
|
+
const s = e.key.length === 1 ? e.key.toLowerCase() : "";
|
|
86
|
+
if (!s) return;
|
|
87
|
+
const l = R + s;
|
|
88
|
+
w(l);
|
|
89
|
+
const a = u.find((n) => {
|
|
90
|
+
var c;
|
|
91
|
+
return (c = n.label) == null ? void 0 : c.toLowerCase().startsWith(l);
|
|
92
92
|
});
|
|
93
|
-
if (
|
|
94
|
-
const n = g.current[
|
|
93
|
+
if (a) {
|
|
94
|
+
const n = g.current[a.value];
|
|
95
95
|
n == null || n.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
96
96
|
}
|
|
97
97
|
h.current && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
98
|
-
|
|
98
|
+
w("");
|
|
99
99
|
}, 500);
|
|
100
100
|
};
|
|
101
|
-
|
|
102
|
-
window.removeEventListener("keydown",
|
|
103
|
-
}), [t, R,
|
|
104
|
-
const e = (
|
|
101
|
+
v(() => (t ? window.addEventListener("keydown", W) : (window.removeEventListener("keydown", W), w("")), () => {
|
|
102
|
+
window.removeEventListener("keydown", W);
|
|
103
|
+
}), [t, R, u]), v(() => {
|
|
104
|
+
const e = (s) => {
|
|
105
105
|
if (!t) return;
|
|
106
|
-
const
|
|
107
|
-
if (!
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
const n =
|
|
111
|
-
(
|
|
106
|
+
const l = s.key.length === 1 ? s.key.toLowerCase() : "";
|
|
107
|
+
if (!l) return;
|
|
108
|
+
const a = R + l;
|
|
109
|
+
w(a);
|
|
110
|
+
const n = u.find(
|
|
111
|
+
(c) => {
|
|
112
112
|
var T;
|
|
113
|
-
return (T =
|
|
113
|
+
return (T = c.label) == null ? void 0 : T.toLowerCase().startsWith(a);
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
|
-
if (n &&
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
top: T.offsetTop -
|
|
116
|
+
if (n && N.current && n.value in g.current && g.current[n.value]) {
|
|
117
|
+
const c = N.current, T = g.current[n.value];
|
|
118
|
+
c.scrollTo({
|
|
119
|
+
top: T.offsetTop - c.offsetTop,
|
|
120
120
|
behavior: "smooth"
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
h.current && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
124
|
-
|
|
124
|
+
w("");
|
|
125
125
|
}, 700);
|
|
126
126
|
};
|
|
127
127
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
128
|
-
}, [t,
|
|
128
|
+
}, [t, u, R]), v(() => {
|
|
129
129
|
if (!t) return;
|
|
130
|
-
const e = (
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
130
|
+
const e = (s) => {
|
|
131
|
+
const l = s.key.toLowerCase();
|
|
132
|
+
if (l.length === 1) {
|
|
133
|
+
const a = u.find(
|
|
134
134
|
(n) => {
|
|
135
|
-
var
|
|
136
|
-
return (
|
|
135
|
+
var c;
|
|
136
|
+
return (c = n.label) == null ? void 0 : c.toLowerCase().startsWith(l);
|
|
137
137
|
}
|
|
138
138
|
);
|
|
139
|
-
if (
|
|
140
|
-
const n =
|
|
139
|
+
if (a) {
|
|
140
|
+
const n = I.current[a.value];
|
|
141
141
|
n && n.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
146
|
-
}, [t,
|
|
146
|
+
}, [t, u]);
|
|
147
147
|
const d = m(null);
|
|
148
|
-
return
|
|
148
|
+
return v(() => {
|
|
149
149
|
if (t && d.current) {
|
|
150
150
|
const e = d.current.getBoundingClientRect().height;
|
|
151
151
|
P(y || {
|
|
@@ -153,49 +153,49 @@ const O = "_selectContainer_133eb_54", Q = "_selected_133eb_57", X = "_children_
|
|
|
153
153
|
left: "0px"
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
-
}, [t]), /* @__PURE__ */
|
|
157
|
-
|
|
156
|
+
}, [t]), /* @__PURE__ */ b("div", { className: i.selectContainer, children: [
|
|
157
|
+
D(),
|
|
158
158
|
/* @__PURE__ */ r(
|
|
159
159
|
J,
|
|
160
160
|
{
|
|
161
|
-
ref:
|
|
161
|
+
ref: z,
|
|
162
162
|
anchorRef: d,
|
|
163
163
|
open: t,
|
|
164
164
|
onClose: () => f(!1),
|
|
165
|
-
position:
|
|
165
|
+
position: A,
|
|
166
166
|
disableOverlay: !0,
|
|
167
|
-
className:
|
|
168
|
-
autoCloseCondition:
|
|
169
|
-
children: /* @__PURE__ */
|
|
170
|
-
|
|
167
|
+
className: i.modal,
|
|
168
|
+
autoCloseCondition: U,
|
|
169
|
+
children: /* @__PURE__ */ b("div", { children: [
|
|
170
|
+
V && /* @__PURE__ */ b("div", { children: [
|
|
171
171
|
/* @__PURE__ */ r(
|
|
172
|
-
|
|
172
|
+
G,
|
|
173
173
|
{
|
|
174
174
|
type: "text",
|
|
175
|
-
placeholder:
|
|
175
|
+
placeholder: j,
|
|
176
176
|
status: "ghost",
|
|
177
177
|
sizeStyle: "s",
|
|
178
178
|
value: $,
|
|
179
|
-
onChange: (e) =>
|
|
179
|
+
onChange: (e) => M(e.target.value)
|
|
180
180
|
}
|
|
181
181
|
),
|
|
182
|
-
/* @__PURE__ */ r("div", { className:
|
|
182
|
+
/* @__PURE__ */ r("div", { className: i.searchWrapper })
|
|
183
183
|
] }),
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
|
|
184
|
+
/* @__PURE__ */ b("div", { className: i.selectList, ref: N, children: [
|
|
185
|
+
K.map((e) => /* @__PURE__ */ b(
|
|
186
186
|
"div",
|
|
187
187
|
{
|
|
188
|
-
ref: (
|
|
189
|
-
className: `${
|
|
190
|
-
onClick: () =>
|
|
188
|
+
ref: (s) => I.current[e.value] = s,
|
|
189
|
+
className: `${i.children} ${(o == null ? void 0 : o.value) === e.value ? i.active : ""}`,
|
|
190
|
+
onClick: () => q(e),
|
|
191
191
|
children: [
|
|
192
192
|
e.icon && /* @__PURE__ */ r(_, { icon: e.icon, size: 16 }),
|
|
193
|
-
e.label && /* @__PURE__ */ r("div", { className:
|
|
193
|
+
e.label && /* @__PURE__ */ r("div", { className: i.itemLabel, children: e.label })
|
|
194
194
|
]
|
|
195
195
|
},
|
|
196
196
|
e.value
|
|
197
197
|
)),
|
|
198
|
-
|
|
198
|
+
K.length === 0 && /* @__PURE__ */ r("div", { className: `${i.noResults} textSmall`, children: "Aucun résultat" })
|
|
199
199
|
] })
|
|
200
200
|
] })
|
|
201
201
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as g, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import '../../styles/Tooltip.css';const y = "
|
|
4
|
-
"tooltip-container": "_tooltip-
|
|
1
|
+
import { jsxs as g, jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d } from "react";
|
|
3
|
+
import '../../styles/Tooltip.css';const y = "_tooltip_19b26_30", s = {
|
|
4
|
+
"tooltip-container": "_tooltip-container_19b26_30",
|
|
5
5
|
tooltip: y
|
|
6
|
-
}, _ = ({ children: l, content:
|
|
7
|
-
const [p, o] =
|
|
6
|
+
}, _ = ({ children: l, content: a, position: i = "top", gap: n = "xs-5", padding: r = "xs-5" }) => {
|
|
7
|
+
const [p, o] = d(!1), c = [
|
|
8
8
|
s.tooltip,
|
|
9
9
|
"labelMedium",
|
|
10
10
|
"fontWeight-600"
|
|
11
11
|
].filter(Boolean).join(" "), m = {
|
|
12
|
-
"--dynamic-gap": `var(--spacing-${
|
|
12
|
+
"--dynamic-gap": `var(--spacing-${n})`,
|
|
13
13
|
"--dynamic-padding": `var(--spacing-${r})`
|
|
14
14
|
}, f = () => {
|
|
15
15
|
const t = "calc(100% + var(--dynamic-gap))", e = {
|
|
@@ -22,7 +22,7 @@ import '../../styles/Tooltip.css';const y = "_tooltip_7qhvn_30", s = {
|
|
|
22
22
|
left: { top: "50%", right: t, transform: "translateY(-50%)" },
|
|
23
23
|
right: { top: "50%", left: t, transform: "translateY(-50%)" }
|
|
24
24
|
};
|
|
25
|
-
return { ...e[
|
|
25
|
+
return { ...e[i] || e.top };
|
|
26
26
|
};
|
|
27
27
|
return /* @__PURE__ */ g(
|
|
28
28
|
"div",
|
|
@@ -33,7 +33,7 @@ import '../../styles/Tooltip.css';const y = "_tooltip_7qhvn_30", s = {
|
|
|
33
33
|
onMouseLeave: () => o(!1),
|
|
34
34
|
children: [
|
|
35
35
|
l,
|
|
36
|
-
p && /* @__PURE__ */
|
|
36
|
+
p && /* @__PURE__ */ b("div", { className: c, style: f(), children: a })
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
);
|
package/dist/styles/Tooltip.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._tooltip-
|
|
1
|
+
._tooltip-container_19b26_30{position:relative;width:100%;height:auto;display:flex;justify-content:center;align-items:center;cursor:pointer}._tooltip-container_19b26_30 ._tooltip_19b26_30{position:absolute;padding:var(--dynamic-padding);border:1px solid var(--general-border-window);border-radius:.5rem;font-size:12px;white-space:nowrap;z-index:10;opacity:0;visibility:hidden;transition:opacity .3s ease-in-out,visibility .3s;background-color:var(--background-tooltip);box-shadow:0 4px 5px 0 var(--shadow-color-minimal);color:var(--general-text-icons)}._tooltip-container_19b26_30:hover ._tooltip_19b26_30{opacity:1;visibility:visible}
|