@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 w, jsx as r } from "react/jsx-runtime";
2
- import { useState as b, useRef as m, useEffect as p } from "react";
3
- import { Button as W } from "../button/Button.js";
4
- import { Input as H } from "../input/Input.js";
5
- import { IconButton as I } from "../icon-button/IconButton.js";
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", u = {
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: s,
24
+ listItem: u,
25
25
  modeDisplay: x = "all",
26
- onSelect: B,
26
+ onSelect: F,
27
27
  positionOverride: y,
28
- placeholder: F = "Sélectionner",
29
- searchPlaceholder: U,
30
- autoCloseCondition: V,
31
- searchable: z = !1,
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] = b(!1), A = m(null), [M, P] = b({
34
+ const [t, f] = p(!1), z = m(null), [A, P] = p({
35
35
  top: "calc(100% + 6px)",
36
36
  left: "0px"
37
- }), [c, k] = b(L ?? null), [$, q] = b("");
38
- p(() => {
39
- L ? k(L) : s.length > 0 ? k(s[0]) : k(null);
40
- }, [L, s]), p(() => {
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 D = (e) => {
44
- k(e), f(!1), B && B(e);
45
- }, G = () => {
46
- const e = c == null ? void 0 : c.icon, o = (c == null ? void 0 : c.label) || F || "Sélectionner";
47
- return x === "icon" && e ? /* @__PURE__ */ r(I, { ref: d, mode: "tertiary", size: C, onClick: () => f(!t), children: /* @__PURE__ */ r(_, { icon: c.icon }) }) : x === "text" ? /* @__PURE__ */ r(
48
- W,
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
- W,
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: c.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
- W,
71
+ B,
72
72
  {
73
73
  ref: d,
74
74
  mode: "tertiary",
75
75
  fullWidth: S,
76
- label: F ?? "Sélectionner",
76
+ label: k ?? "Sélectionner",
77
77
  size: C,
78
78
  onClick: () => f(!t)
79
79
  }
80
80
  );
81
- }, E = m(null), g = m({}), [R, v] = b(""), h = m(null), K = m({}), j = s.filter(
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
- ), N = (e) => {
83
+ ), W = (e) => {
84
84
  if (!t) return;
85
- const o = e.key.length === 1 ? e.key.toLowerCase() : "";
86
- if (!o) return;
87
- const a = R + o;
88
- v(a);
89
- const i = s.find((n) => {
90
- var l;
91
- return (l = n.label) == null ? void 0 : l.toLowerCase().startsWith(a);
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 (i) {
94
- const n = g.current[i.value];
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
- v("");
98
+ w("");
99
99
  }, 500);
100
100
  };
101
- p(() => (t ? window.addEventListener("keydown", N) : (window.removeEventListener("keydown", N), v("")), () => {
102
- window.removeEventListener("keydown", N);
103
- }), [t, R, s]), p(() => {
104
- const e = (o) => {
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 a = o.key.length === 1 ? o.key.toLowerCase() : "";
107
- if (!a) return;
108
- const i = R + a;
109
- v(i);
110
- const n = s.find(
111
- (l) => {
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 = l.label) == null ? void 0 : T.toLowerCase().startsWith(i);
113
+ return (T = c.label) == null ? void 0 : T.toLowerCase().startsWith(a);
114
114
  }
115
115
  );
116
- if (n && E.current && n.value in g.current && g.current[n.value]) {
117
- const l = E.current, T = g.current[n.value];
118
- l.scrollTo({
119
- top: T.offsetTop - l.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
- v("");
124
+ w("");
125
125
  }, 700);
126
126
  };
127
127
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
128
- }, [t, s, R]), p(() => {
128
+ }, [t, u, R]), v(() => {
129
129
  if (!t) return;
130
- const e = (o) => {
131
- const a = o.key.toLowerCase();
132
- if (a.length === 1) {
133
- const i = s.find(
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 l;
136
- return (l = n.label) == null ? void 0 : l.toLowerCase().startsWith(a);
135
+ var c;
136
+ return (c = n.label) == null ? void 0 : c.toLowerCase().startsWith(l);
137
137
  }
138
138
  );
139
- if (i) {
140
- const n = K.current[i.value];
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, s]);
146
+ }, [t, u]);
147
147
  const d = m(null);
148
- return p(() => {
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__ */ w("div", { className: u.selectContainer, children: [
157
- G(),
156
+ }, [t]), /* @__PURE__ */ b("div", { className: i.selectContainer, children: [
157
+ D(),
158
158
  /* @__PURE__ */ r(
159
159
  J,
160
160
  {
161
- ref: A,
161
+ ref: z,
162
162
  anchorRef: d,
163
163
  open: t,
164
164
  onClose: () => f(!1),
165
- position: M,
165
+ position: A,
166
166
  disableOverlay: !0,
167
- className: u.modal,
168
- autoCloseCondition: V,
169
- children: /* @__PURE__ */ w("div", { children: [
170
- z && /* @__PURE__ */ w("div", { children: [
167
+ className: i.modal,
168
+ autoCloseCondition: U,
169
+ children: /* @__PURE__ */ b("div", { children: [
170
+ V && /* @__PURE__ */ b("div", { children: [
171
171
  /* @__PURE__ */ r(
172
- H,
172
+ G,
173
173
  {
174
174
  type: "text",
175
- placeholder: U,
175
+ placeholder: j,
176
176
  status: "ghost",
177
177
  sizeStyle: "s",
178
178
  value: $,
179
- onChange: (e) => q(e.target.value)
179
+ onChange: (e) => M(e.target.value)
180
180
  }
181
181
  ),
182
- /* @__PURE__ */ r("div", { className: u.searchWrapper })
182
+ /* @__PURE__ */ r("div", { className: i.searchWrapper })
183
183
  ] }),
184
- /* @__PURE__ */ w("div", { className: u.selectList, ref: E, children: [
185
- j.map((e) => /* @__PURE__ */ w(
184
+ /* @__PURE__ */ b("div", { className: i.selectList, ref: N, children: [
185
+ K.map((e) => /* @__PURE__ */ b(
186
186
  "div",
187
187
  {
188
- ref: (o) => K.current[e.value] = o,
189
- className: `${u.children} ${(c == null ? void 0 : c.value) === e.value ? u.active : ""}`,
190
- onClick: () => D(e),
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: u.itemLabel, children: e.label })
193
+ e.label && /* @__PURE__ */ r("div", { className: i.itemLabel, children: e.label })
194
194
  ]
195
195
  },
196
196
  e.value
197
197
  )),
198
- j.length === 0 && /* @__PURE__ */ r("div", { className: `${u.noResults} textSmall`, children: "Aucun résultat" })
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 d } from "react/jsx-runtime";
2
- import { useState as h } from "react";
3
- import '../../styles/Tooltip.css';const y = "_tooltip_7qhvn_30", s = {
4
- "tooltip-container": "_tooltip-container_7qhvn_30",
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: n, position: a = "top", gap: i = "xs-5", padding: r = "xs-5" }) => {
7
- const [p, o] = h(!1), c = [
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-${i})`,
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[a] || e.top };
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__ */ d("div", { className: c, style: f(), children: n })
36
+ p && /* @__PURE__ */ b("div", { className: c, style: f(), children: a })
37
37
  ]
38
38
  }
39
39
  );
@@ -1 +1 @@
1
- ._tooltip-container_7qhvn_30{position:relative;width:auto;height:auto;display:flex;justify-content:center;align-items:center;cursor:pointer}._tooltip-container_7qhvn_30 ._tooltip_7qhvn_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_7qhvn_30:hover ._tooltip_7qhvn_30{opacity:1;visibility:visible}
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",