@situaction/traq-ui-ste 1.1.33 → 1.1.35

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,6 +1,6 @@
1
1
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
2
  import { InputLabel as c } from "../input-label/InputLabel.js";
3
- import '../../styles/EditableField.css';const m = "_editableField_12vkl_30", o = "_statiqueField_12vkl_40", l = {
3
+ import '../../styles/EditableField.css';const m = "_editableField_13at1_30", o = "_statiqueField_13at1_40", l = {
4
4
  editableField: m,
5
5
  statiqueField: o
6
6
  }, p = ({
@@ -1,54 +1,54 @@
1
- import { jsxs as N, Fragment as S, jsx as v } from "react/jsx-runtime";
2
- import { forwardRef as W, useRef as k, useState as w, useEffect as g, useLayoutEffect as n } from "react";
3
- import '../../styles/Modal.css';const q = "_overlay_lv2n7_2", A = "_modalContent_lv2n7_12", y = {
4
- overlay: q,
5
- modalContent: A
6
- }, D = W(
7
- ({ open: l, onClose: a, children: x, position: e, className: _, disableOverlay: b = !1, autoCloseCondition: m, anchorRef: d }, E) => {
8
- const $ = k(null), c = E || $, [r, h] = w(), [L, j] = w();
9
- return g(() => {
10
- !m && m !== void 0 && l && a();
11
- }, [m, l, a]), n(() => {
12
- if (d != null && d.current && l && !e) {
13
- const t = d.current.getBoundingClientRect();
14
- h({
15
- top: `${t.bottom + window.scrollY}px`,
16
- left: `${t.left + window.scrollX}px`
17
- }), j(`${t.width}px`);
1
+ import { jsxs as j, Fragment as M, jsx as v } from "react/jsx-runtime";
2
+ import { forwardRef as N, useRef as S, useState as k, useEffect as w, useLayoutEffect as q } from "react";
3
+ import '../../styles/Modal.css';const A = "_overlay_lv2n7_2", B = "_modalContent_lv2n7_12", g = {
4
+ overlay: A,
5
+ modalContent: B
6
+ }, O = N(
7
+ ({ open: t, onClose: d, children: y, position: e, className: _, disableOverlay: b = !1, autoCloseCondition: m, anchorRef: a }, x) => {
8
+ const E = S(null), c = x || E, [l, $] = k();
9
+ return w(() => {
10
+ !m && m !== void 0 && t && d();
11
+ }, [m, t, d]), q(() => {
12
+ if (a != null && a.current && t && !e) {
13
+ const r = a.current.getBoundingClientRect();
14
+ $({
15
+ top: `${r.bottom + window.scrollY}px`,
16
+ left: `${r.left + window.scrollX}px`
17
+ });
18
18
  }
19
- }, [d, l, e]), g(() => {
20
- const t = (u) => {
19
+ }, [a, t, e]), w(() => {
20
+ const r = (u) => {
21
21
  const f = c.current;
22
- f && !f.contains(u.target) && l && ![...document.querySelectorAll(".dialog")].some(
23
- (M) => M.contains(u.target)
24
- ) && a();
22
+ f && !f.contains(u.target) && t && ![...document.querySelectorAll(".dialog")].some(
23
+ (L) => L.contains(u.target)
24
+ ) && d();
25
25
  };
26
- return document.addEventListener("mousedown", t), () => {
27
- document.removeEventListener("mousedown", t);
26
+ return document.addEventListener("mousedown", r), () => {
27
+ document.removeEventListener("mousedown", r);
28
28
  };
29
- }, [a, l, c]), l ? /* @__PURE__ */ N(S, { children: [
30
- !b && /* @__PURE__ */ v("div", { className: y.overlay }),
29
+ }, [d, t, c]), t ? /* @__PURE__ */ j(M, { children: [
30
+ !b && /* @__PURE__ */ v("div", { className: g.overlay }),
31
31
  /* @__PURE__ */ v(
32
32
  "div",
33
33
  {
34
34
  ref: c,
35
- className: `${y.modalContent} ${_ || ""}`,
36
- onMouseDown: (t) => t.stopPropagation(),
35
+ className: `${g.modalContent} ${_ || ""}`,
36
+ onMouseDown: (r) => r.stopPropagation(),
37
37
  style: {
38
38
  position: "absolute",
39
- top: (e == null ? void 0 : e.top) ?? (r == null ? void 0 : r.top) ?? "50%",
40
- left: (e == null ? void 0 : e.left) ?? (r == null ? void 0 : r.left) ?? "50%",
39
+ top: (e == null ? void 0 : e.top) ?? (l == null ? void 0 : l.top) ?? "50%",
40
+ left: (e == null ? void 0 : e.left) ?? (l == null ? void 0 : l.left) ?? "50%",
41
41
  right: e == null ? void 0 : e.right,
42
42
  bottom: e == null ? void 0 : e.bottom,
43
- width: (e == null ? void 0 : e.width) ?? L ?? "auto",
44
- transform: !(e != null && e.top) && !(e != null && e.left) && !r ? "translate(-50%, -50%)" : void 0
43
+ width: e == null ? void 0 : e.width,
44
+ transform: !(e != null && e.top) && !(e != null && e.left) && !l ? "translate(-50%, -50%)" : void 0
45
45
  },
46
- children: x
46
+ children: y
47
47
  }
48
48
  )
49
49
  ] }) : null;
50
50
  }
51
51
  );
52
52
  export {
53
- D as Modal
53
+ O as Modal
54
54
  };
@@ -1,13 +1,13 @@
1
1
  import { jsxs as $, jsx as r } from "react/jsx-runtime";
2
- import { useState as k, useRef as h, useEffect as w } from "react";
3
- import { Button as S } from "../button/Button.js";
4
- import { IconButton as O } from "../icon-button/IconButton.js";
2
+ import { useState as x, useRef as h, useEffect as w } from "react";
3
+ import { Button as N } from "../button/Button.js";
4
+ import { IconButton as W } from "../icon-button/IconButton.js";
5
5
  import { Icon as p } from "../icon/Icon.js";
6
- import { Modal as W } from "../modal/Modal.js";
6
+ import { Modal as q } from "../modal/Modal.js";
7
7
  import "../theme/ThemeContext.js";
8
8
  import '../../styles/Size.css';import '../../styles/Select.css';/* empty css */
9
- const q = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_1o5wx_61", G = "_active_1o5wx_78", H = "_selectList_1o5wx_82", J = "_modal_1o5wx_91", Q = "_dropdownFadeIn_1o5wx_1", X = "_itemLabel_1o5wx_98", m = {
10
- selectContainer: q,
9
+ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_1o5wx_61", G = "_active_1o5wx_78", H = "_selectList_1o5wx_82", J = "_modal_1o5wx_91", Q = "_dropdownFadeIn_1o5wx_1", X = "_itemLabel_1o5wx_98", m = {
10
+ selectContainer: z,
11
11
  selected: A,
12
12
  children: D,
13
13
  active: G,
@@ -16,101 +16,100 @@ const q = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
16
16
  dropdownFadeIn: Q,
17
17
  itemLabel: X
18
18
  }, ce = ({
19
- selected: y,
20
- size: _ = "m",
21
- listItem: a,
22
- modeDisplay: x = "all",
23
- onSelect: N,
24
- positionOverride: g,
25
- placeholder: B = "Sélectionner",
19
+ selected: _,
20
+ size: b = "m",
21
+ listItem: c,
22
+ modeDisplay: g = "all",
23
+ onSelect: B,
24
+ positionOverride: R,
25
+ placeholder: P = "Sélectionner",
26
26
  autoCloseCondition: j,
27
- fullWidth: R = !1
27
+ fullWidth: T = !1
28
28
  }) => {
29
- const [t, u] = k(!1), U = h(null), [V, P] = k({
29
+ const [n, u] = x(!1), U = h(null), [V, F] = x({
30
30
  top: "calc(100% + 6px)",
31
- left: "0px",
32
- width: "100%"
33
- }), [c, F] = k(y ?? null);
31
+ left: "0px"
32
+ }), [s, L] = x(_ ?? null);
34
33
  w(() => {
35
- F(y ?? null);
36
- }, [y]), w(() => {
37
- g && P(g);
38
- }, [g]);
39
- const I = (e) => {
40
- F(e), u(!1), N && N(e);
41
- }, M = () => {
42
- const e = c == null ? void 0 : c.icon, o = (c == null ? void 0 : c.label) || B || "Sélectionner";
43
- return x === "icon" && e ? /* @__PURE__ */ r(O, { ref: d, mode: "tertiary", size: _, onClick: () => u(!t), children: /* @__PURE__ */ r(p, { icon: c.icon }) }) : x === "text" ? /* @__PURE__ */ r(
44
- S,
34
+ _ ? L(_) : c.length > 0 ? L(c[0]) : L(null), console.log(c);
35
+ }, [_, c]), w(() => {
36
+ R && F(R);
37
+ }, [R]);
38
+ const M = (e) => {
39
+ L(e), u(!1), B && B(e);
40
+ }, O = () => {
41
+ const e = s == null ? void 0 : s.icon, o = (s == null ? void 0 : s.label) || P || "Sélectionner";
42
+ return g === "icon" && e ? /* @__PURE__ */ r(W, { ref: d, mode: "tertiary", size: b, onClick: () => u(!n), children: /* @__PURE__ */ r(p, { icon: s.icon }) }) : g === "text" ? /* @__PURE__ */ r(
43
+ N,
45
44
  {
46
45
  ref: d,
47
46
  mode: "tertiary",
48
47
  label: o,
49
- childrenRight: /* @__PURE__ */ r(p, { icon: t ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
50
- size: _,
51
- fullWidth: R,
52
- onClick: () => u(!t)
48
+ childrenRight: /* @__PURE__ */ r(p, { icon: n ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
49
+ size: b,
50
+ fullWidth: T,
51
+ onClick: () => u(!n)
53
52
  }
54
- ) : x === "all" ? /* @__PURE__ */ r(
55
- S,
53
+ ) : g === "all" ? /* @__PURE__ */ r(
54
+ N,
56
55
  {
57
56
  ref: d,
58
57
  mode: "tertiary",
59
58
  label: o,
60
- size: _,
61
- fullWidth: R,
62
- childrenLeft: e && /* @__PURE__ */ r(p, { icon: c.icon }),
63
- childrenRight: /* @__PURE__ */ r(p, { icon: t ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
64
- onClick: () => u(!t)
59
+ size: b,
60
+ fullWidth: T,
61
+ childrenLeft: e && /* @__PURE__ */ r(p, { icon: s.icon }),
62
+ childrenRight: /* @__PURE__ */ r(p, { icon: n ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
63
+ onClick: () => u(!n)
65
64
  }
66
65
  ) : /* @__PURE__ */ r(
67
- S,
66
+ N,
68
67
  {
69
68
  ref: d,
70
69
  mode: "tertiary",
71
- fullWidth: R,
72
- label: B ?? "Sélectionner",
73
- size: _,
74
- onClick: () => u(!t)
70
+ fullWidth: T,
71
+ label: P ?? "Sélectionner",
72
+ size: b,
73
+ onClick: () => u(!n)
75
74
  }
76
75
  );
77
- }, T = h(null), b = h({}), [L, v] = k(""), f = h(null), K = h({}), E = (e) => {
78
- if (!t) return;
76
+ }, E = h(null), C = h({}), [k, v] = x(""), f = h(null), K = h({}), S = (e) => {
77
+ if (!n) return;
79
78
  const o = e.key.length === 1 ? e.key.toLowerCase() : "";
80
79
  if (!o) return;
81
- const i = L + o;
80
+ const i = k + o;
82
81
  v(i);
83
- const l = a.find((n) => {
84
- var s;
85
- return (s = n.label) == null ? void 0 : s.toLowerCase().startsWith(i);
82
+ const a = c.find((t) => {
83
+ var l;
84
+ return (l = t.label) == null ? void 0 : l.toLowerCase().startsWith(i);
86
85
  });
87
- if (l) {
88
- const n = b.current[l.value];
89
- n == null || n.scrollIntoView({ behavior: "smooth", block: "nearest" });
86
+ if (a) {
87
+ const t = C.current[a.value];
88
+ t == null || t.scrollIntoView({ behavior: "smooth", block: "nearest" });
90
89
  }
91
90
  f.current && clearTimeout(f.current), f.current = setTimeout(() => {
92
91
  v("");
93
92
  }, 500);
94
93
  };
95
- w(() => (t ? window.addEventListener("keydown", E) : (window.removeEventListener("keydown", E), v("")), () => {
96
- window.removeEventListener("keydown", E);
97
- }), [t, L, a]), w(() => {
94
+ w(() => (n ? window.addEventListener("keydown", S) : (window.removeEventListener("keydown", S), v("")), () => {
95
+ window.removeEventListener("keydown", S);
96
+ }), [n, k, c]), w(() => {
98
97
  const e = (o) => {
99
- if (!t) return;
98
+ if (!n) return;
100
99
  const i = o.key.length === 1 ? o.key.toLowerCase() : "";
101
100
  if (!i) return;
102
- const l = L + i;
103
- v(l);
104
- const n = a.find(
105
- (s) => {
106
- var C;
107
- return (C = s.label) == null ? void 0 : C.toLowerCase().startsWith(l);
101
+ const a = k + i;
102
+ v(a);
103
+ const t = c.find(
104
+ (l) => {
105
+ var y;
106
+ return (y = l.label) == null ? void 0 : y.toLowerCase().startsWith(a);
108
107
  }
109
108
  );
110
- if (n && T.current && n.value in b.current && b.current[n.value]) {
111
- const s = T.current, C = b.current[n.value];
112
- s.scrollTo({
113
- top: C.offsetTop - s.offsetTop,
109
+ if (t && E.current && t.value in C.current && C.current[t.value]) {
110
+ const l = E.current, y = C.current[t.value];
111
+ l.scrollTo({
112
+ top: y.offsetTop - l.offsetTop,
114
113
  behavior: "smooth"
115
114
  });
116
115
  }
@@ -119,56 +118,55 @@ const q = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
119
118
  }, 700);
120
119
  };
121
120
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
122
- }, [t, a, L]), w(() => {
123
- if (!t) return;
121
+ }, [n, c, k]), w(() => {
122
+ if (!n) return;
124
123
  const e = (o) => {
125
124
  const i = o.key.toLowerCase();
126
125
  if (i.length === 1) {
127
- const l = a.find(
128
- (n) => {
129
- var s;
130
- return (s = n.label) == null ? void 0 : s.toLowerCase().startsWith(i);
126
+ const a = c.find(
127
+ (t) => {
128
+ var l;
129
+ return (l = t.label) == null ? void 0 : l.toLowerCase().startsWith(i);
131
130
  }
132
131
  );
133
- if (l) {
134
- const n = K.current[l.value];
135
- n && n.scrollIntoView({ block: "start", behavior: "smooth" });
132
+ if (a) {
133
+ const t = K.current[a.value];
134
+ t && t.scrollIntoView({ block: "start", behavior: "smooth" });
136
135
  }
137
136
  }
138
137
  };
139
138
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
140
- }, [t, a]);
139
+ }, [n, c]);
141
140
  const d = h(null);
142
141
  return w(() => {
143
- if (t && d.current) {
142
+ if (n && d.current) {
144
143
  const e = d.current.getBoundingClientRect().height;
145
- P({
144
+ F({
146
145
  top: `${e + 6}px`,
147
- left: "0px",
148
- width: "100%"
146
+ left: "0px"
149
147
  });
150
148
  }
151
- }, [t]), /* @__PURE__ */ $("div", { className: m.selectContainer, children: [
152
- M(),
149
+ }, [n]), /* @__PURE__ */ $("div", { className: m.selectContainer, children: [
150
+ O(),
153
151
  /* @__PURE__ */ r(
154
- W,
152
+ q,
155
153
  {
156
154
  ref: U,
157
155
  anchorRef: d,
158
- open: t,
156
+ open: n,
159
157
  onClose: () => u(!1),
160
158
  position: V,
161
159
  disableOverlay: !0,
162
160
  className: m.modal,
163
161
  autoCloseCondition: j,
164
- children: /* @__PURE__ */ r("div", { className: m.selectList, ref: T, children: a.map((e) => /* @__PURE__ */ $(
162
+ children: /* @__PURE__ */ r("div", { className: m.selectList, ref: E, children: c.map((e) => /* @__PURE__ */ $(
165
163
  "div",
166
164
  {
167
165
  ref: (o) => K.current[e.value] = o,
168
- className: `${m.children} ${(c == null ? void 0 : c.value) === e.value ? m.active : ""}`,
169
- onClick: () => I(e),
166
+ className: `${m.children} ${(s == null ? void 0 : s.value) === e.value ? m.active : ""}`,
167
+ onClick: () => M(e),
170
168
  children: [
171
- e.icon && /* @__PURE__ */ r(p, { icon: e.icon }),
169
+ e.icon && /* @__PURE__ */ r(p, { icon: e.icon, size: 16 }),
172
170
  e.label && /* @__PURE__ */ r("div", { className: m.itemLabel, children: e.label })
173
171
  ]
174
172
  },
@@ -1 +1 @@
1
- ._editableField_12vkl_30{width:100%;display:flex;justify-content:flex-start;align-items:start;flex-direction:column;gap:.25rem;cursor:default}._statiqueField_12vkl_40{width:100%;border-radius:4px;border:1px solid var(--input-primary-default-border);padding:.5rem}
1
+ ._editableField_13at1_30{width:100%;display:flex;justify-content:flex-start;align-items:start;flex-direction:column;gap:.25rem;cursor:default}._statiqueField_13at1_40{width:100%;border-radius:4px;border:1px solid var(--input-primary-default-border);padding:.5rem;box-sizing:border-box}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.1.33",
3
+ "version": "1.1.35",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",