@situaction/traq-ui-ste 1.1.39 → 1.1.41

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.
@@ -15,10 +15,12 @@ interface EditableFieldProps extends Partial<LabelInputProps> {
15
15
  edit: boolean;
16
16
  /** Callback when value is changed (only in edit mode) */
17
17
  onChange?: (val: string) => void;
18
+ /** If true, value is displayed as a clickable link */
19
+ isLink?: boolean;
18
20
  }
19
21
  /**
20
22
  * EditableField displays either a read-only value or an editable input.
21
23
  * It supports all props from InputLabel.
22
24
  */
23
- export declare const EditableField: ({ label, value, placeholder, edit, onChange, ...inputLabelProps }: EditableFieldProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const EditableField: ({ label, value, placeholder, edit, onChange, isLink, ...inputLabelProps }: EditableFieldProps) => import("react/jsx-runtime").JSX.Element;
24
26
  export {};
@@ -1,30 +1,47 @@
1
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
- import { InputLabel as c } from "../input-label/InputLabel.js";
3
- import '../../styles/EditableField.css';const m = "_editableField_13at1_30", o = "_statiqueField_13at1_40", l = {
4
- editableField: m,
5
- statiqueField: o
6
- }, p = ({
7
- label: i,
1
+ import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
+ import { InputLabel as p } from "../input-label/InputLabel.js";
3
+ import '../../styles/EditableField.css';const F = "_editableField_1gd32_30", _ = "_statiqueField_1gd32_40", b = "_link_1gd32_48", i = {
4
+ editableField: F,
5
+ statiqueField: _,
6
+ link: b
7
+ }, k = ({
8
+ label: l,
8
9
  value: e,
9
10
  placeholder: d,
10
- edit: s,
11
- onChange: a,
12
- ...r
11
+ edit: a,
12
+ onChange: n,
13
+ isLink: r = !1,
14
+ ...o
13
15
  // Spread to pass all remaining props to InputLabel
14
- }) => s ? /* @__PURE__ */ t(
15
- c,
16
- {
17
- label: i,
18
- defaultValue: e || "",
19
- placeholder: d || "",
20
- onSubmit: a || (() => {
21
- }),
22
- ...r
23
- }
24
- ) : /* @__PURE__ */ n("div", { className: l.editableField, children: [
25
- /* @__PURE__ */ t("span", { className: "textSmall", children: i }),
26
- /* @__PURE__ */ t("div", { className: `${l.statiqueField} textSmall`, children: (e == null ? void 0 : e.trim()) || " " })
27
- ] });
16
+ }) => {
17
+ if (a)
18
+ return /* @__PURE__ */ t(
19
+ p,
20
+ {
21
+ label: l,
22
+ defaultValue: e || "",
23
+ placeholder: d || "",
24
+ onSubmit: n || (() => {
25
+ }),
26
+ ...o
27
+ }
28
+ );
29
+ const s = (e == null ? void 0 : e.trim()) || " ";
30
+ return /* @__PURE__ */ m("div", { className: i.editableField, children: [
31
+ /* @__PURE__ */ t("span", { className: "textSmall", children: l }),
32
+ r && e ? /* @__PURE__ */ t(
33
+ "a",
34
+ {
35
+ href: e,
36
+ target: "_blank",
37
+ rel: "noopener noreferrer",
38
+ className: `${i.statiqueField} ${i.link} textSmall`,
39
+ onClick: (c) => c.stopPropagation(),
40
+ children: s
41
+ }
42
+ ) : /* @__PURE__ */ t("div", { className: `${i.statiqueField} textSmall`, children: s })
43
+ ] });
44
+ };
28
45
  export {
29
- p as EditableField
46
+ k as EditableField
30
47
  };
@@ -25,5 +25,7 @@ export interface ModalProps {
25
25
  autoCloseCondition?: boolean;
26
26
  /** Optional anchor reference for positioning */
27
27
  anchorRef?: RefObject<HTMLElement>;
28
+ /** If true, show a background overlay behind the panel */
29
+ overlayBackground?: boolean;
28
30
  }
29
31
  export declare const Modal: import('react').ForwardRefExoticComponent<ModalProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,47 +1,49 @@
1
- import { jsxs as $, Fragment as j, jsx as u } from "react/jsx-runtime";
2
- import { forwardRef as k, useRef as C, useState as E, useEffect as N, useLayoutEffect as B } from "react";
3
- import '../../styles/Modal.css';const F = "_overlay_b1r7c_1", L = "_modalContent_b1r7c_12", M = "_centered_b1r7c_19", d = {
1
+ import { jsxs as x, Fragment as B, jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as h, useRef as j, useState as C, useEffect as E, useLayoutEffect as N } from "react";
3
+ import '../../styles/Modal.css';const F = "_overlay_1hu8i_1", L = "_overlayBackground_1hu8i_11", M = "_modalContent_1hu8i_15", S = "_centered_1hu8i_22", c = {
4
4
  overlay: F,
5
- modalContent: L,
6
- centered: M
7
- }, Y = k(
5
+ overlayBackground: L,
6
+ modalContent: M,
7
+ centered: S
8
+ }, q = h(
8
9
  ({
9
- open: a,
10
- onClose: c,
11
- children: _,
10
+ open: t,
11
+ onClose: d,
12
+ children: v,
12
13
  position: l,
13
14
  centered: r = !1,
14
- className: b,
15
- disableOverlay: v = !1,
16
- autoCloseCondition: m,
17
- anchorRef: f
18
- }, g) => {
19
- const w = C(null), y = g || w, [e, x] = E();
20
- return N(() => {
21
- !m && m !== void 0 && a && c();
22
- }, [m, a, c]), B(() => {
23
- if (f != null && f.current && a && !l && !r) {
24
- const t = f.current.getBoundingClientRect();
25
- x({
26
- top: `${t.bottom + window.scrollY}px`,
27
- left: `${t.left + window.scrollX}px`
15
+ className: _,
16
+ disableOverlay: g = !1,
17
+ autoCloseCondition: u,
18
+ anchorRef: f,
19
+ overlayBackground: y = !1
20
+ }, w) => {
21
+ const $ = j(null), k = w || $, [e, b] = C();
22
+ return E(() => {
23
+ !u && u !== void 0 && t && d();
24
+ }, [u, t, d]), N(() => {
25
+ if (f != null && f.current && t && !l && !r) {
26
+ const a = f.current.getBoundingClientRect();
27
+ b({
28
+ top: `${a.bottom + window.scrollY}px`,
29
+ left: `${a.left + window.scrollX}px`
28
30
  });
29
31
  }
30
- }, [f, a, l, r]), a ? /* @__PURE__ */ $(j, { children: [
31
- !v && /* @__PURE__ */ u(
32
+ }, [f, t, l, r]), t ? /* @__PURE__ */ x(B, { children: [
33
+ !g && /* @__PURE__ */ m(
32
34
  "div",
33
35
  {
34
- className: d.overlay,
35
- onClick: (t) => {
36
- t.stopPropagation(), c();
36
+ className: `${c.overlay} ${y ? c.overlayBackground : ""}`,
37
+ onClick: (a) => {
38
+ a.stopPropagation(), d();
37
39
  }
38
40
  }
39
41
  ),
40
- /* @__PURE__ */ u(
42
+ /* @__PURE__ */ m(
41
43
  "div",
42
44
  {
43
- ref: y,
44
- className: `${d.modalContent} ${b || ""} ${r ? d.centered : ""}`,
45
+ ref: k,
46
+ className: `${c.modalContent} ${_ || ""} ${r ? c.centered : ""}`,
45
47
  style: {
46
48
  position: "absolute",
47
49
  top: r ? "50%" : (l == null ? void 0 : l.top) ?? (e == null ? void 0 : e.top),
@@ -51,13 +53,13 @@ import '../../styles/Modal.css';const F = "_overlay_b1r7c_1", L = "_modalContent
51
53
  width: l == null ? void 0 : l.width,
52
54
  transform: r || !(l != null && l.top) && !(l != null && l.left) && !e ? "translate(-50%, -50%)" : void 0
53
55
  },
54
- onClick: (t) => t.stopPropagation(),
55
- children: _
56
+ onClick: (a) => a.stopPropagation(),
57
+ children: v
56
58
  }
57
59
  )
58
60
  ] }) : null;
59
61
  }
60
62
  );
61
63
  export {
62
- Y as Modal
64
+ q as Modal
63
65
  };
@@ -1,65 +1,65 @@
1
1
  import { jsxs as $, jsx as r } from "react/jsx-runtime";
2
- import { useState as x, useRef as h, useEffect as w } from "react";
2
+ import { useState as g, useRef as h, useEffect as w } from "react";
3
3
  import { Button as N } from "../button/Button.js";
4
- import { IconButton as W } from "../icon-button/IconButton.js";
5
- import { Icon as p } from "../icon/Icon.js";
6
- import { Modal as q } from "../modal/Modal.js";
4
+ import { IconButton as q } from "../icon-button/IconButton.js";
5
+ import { Icon as _ } from "../icon/Icon.js";
6
+ import { Modal as z } from "../modal/Modal.js";
7
7
  import "../theme/ThemeContext.js";
8
8
  import '../../styles/Size.css';import '../../styles/Select.css';/* empty css */
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
- selected: A,
12
- children: D,
13
- active: G,
14
- selectList: H,
15
- modal: J,
9
+ const A = "_selectContainer_1o5wx_54", D = "_selected_1o5wx_57", G = "_children_1o5wx_61", H = "_active_1o5wx_78", J = "_selectList_1o5wx_82", O = "_modal_1o5wx_91", Q = "_dropdownFadeIn_1o5wx_1", X = "_itemLabel_1o5wx_98", m = {
10
+ selectContainer: A,
11
+ selected: D,
12
+ children: G,
13
+ active: H,
14
+ selectList: J,
15
+ modal: O,
16
16
  dropdownFadeIn: Q,
17
17
  itemLabel: X
18
18
  }, ce = ({
19
- selected: _,
20
- size: b = "m",
19
+ selected: b,
20
+ size: p = "m",
21
21
  listItem: s,
22
- modeDisplay: g = "all",
22
+ modeDisplay: R = "all",
23
23
  onSelect: B,
24
- positionOverride: R,
24
+ positionOverride: L,
25
25
  placeholder: P = "Sélectionner",
26
26
  autoCloseCondition: j,
27
27
  fullWidth: T = !1
28
28
  }) => {
29
- const [n, u] = x(!1), U = h(null), [V, F] = x({
29
+ const [n, u] = g(!1), U = h(null), [V, F] = g({
30
30
  top: "calc(100% + 6px)",
31
31
  left: "0px"
32
- }), [c, L] = x(_ ?? null);
32
+ }), [c, C] = g(b ?? null);
33
33
  w(() => {
34
- _ ? L(_) : s.length > 0 ? L(s[0]) : L(null);
35
- }, [_, s]), w(() => {
36
- R && F(R);
37
- }, [R]);
34
+ b ? C(b) : s.length > 0 ? C(s[0]) : C(null);
35
+ }, [b, s]), w(() => {
36
+ L && F(L);
37
+ }, [L]);
38
38
  const M = (e) => {
39
- L(e), u(!1), B && B(e);
40
- }, O = () => {
39
+ C(e), u(!1), B && B(e);
40
+ }, W = () => {
41
41
  const e = c == null ? void 0 : c.icon, o = (c == null ? void 0 : c.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: c.icon }) }) : g === "text" ? /* @__PURE__ */ r(
42
+ return R === "icon" && e ? /* @__PURE__ */ r(q, { ref: d, mode: "tertiary", size: p, onClick: () => u(!n), children: /* @__PURE__ */ r(_, { icon: c.icon }) }) : R === "text" ? /* @__PURE__ */ r(
43
43
  N,
44
44
  {
45
45
  ref: d,
46
46
  mode: "tertiary",
47
47
  label: o,
48
- childrenRight: /* @__PURE__ */ r(p, { icon: n ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
49
- size: b,
48
+ childrenRight: /* @__PURE__ */ r(_, { icon: n ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
49
+ size: p,
50
50
  fullWidth: T,
51
51
  onClick: () => u(!n)
52
52
  }
53
- ) : g === "all" ? /* @__PURE__ */ r(
53
+ ) : R === "all" ? /* @__PURE__ */ r(
54
54
  N,
55
55
  {
56
56
  ref: d,
57
57
  mode: "tertiary",
58
58
  label: o,
59
- size: b,
59
+ size: p,
60
60
  fullWidth: T,
61
- childrenLeft: e && /* @__PURE__ */ r(p, { icon: c.icon }),
62
- childrenRight: /* @__PURE__ */ r(p, { icon: n ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
61
+ childrenLeft: e && /* @__PURE__ */ r(_, { icon: c.icon }),
62
+ childrenRight: /* @__PURE__ */ r(_, { icon: n ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
63
63
  onClick: () => u(!n)
64
64
  }
65
65
  ) : /* @__PURE__ */ r(
@@ -69,22 +69,22 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
69
69
  mode: "tertiary",
70
70
  fullWidth: T,
71
71
  label: P ?? "Sélectionner",
72
- size: b,
72
+ size: p,
73
73
  onClick: () => u(!n)
74
74
  }
75
75
  );
76
- }, E = h(null), C = h({}), [k, v] = x(""), f = h(null), K = h({}), S = (e) => {
76
+ }, E = h(null), k = h({}), [y, v] = g(""), f = h(null), K = h({}), S = (e) => {
77
77
  if (!n) return;
78
78
  const o = e.key.length === 1 ? e.key.toLowerCase() : "";
79
79
  if (!o) return;
80
- const l = k + o;
81
- v(l);
82
- const a = s.find((t) => {
83
- var i;
84
- return (i = t.label) == null ? void 0 : i.toLowerCase().startsWith(l);
80
+ const a = y + o;
81
+ v(a);
82
+ const i = s.find((t) => {
83
+ var l;
84
+ return (l = t.label) == null ? void 0 : l.toLowerCase().startsWith(a);
85
85
  });
86
- if (a) {
87
- const t = C.current[a.value];
86
+ if (i) {
87
+ const t = k.current[i.value];
88
88
  t == null || t.scrollIntoView({ behavior: "smooth", block: "nearest" });
89
89
  }
90
90
  f.current && clearTimeout(f.current), f.current = setTimeout(() => {
@@ -93,23 +93,23 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
93
93
  };
94
94
  w(() => (n ? window.addEventListener("keydown", S) : (window.removeEventListener("keydown", S), v("")), () => {
95
95
  window.removeEventListener("keydown", S);
96
- }), [n, k, s]), w(() => {
96
+ }), [n, y, s]), w(() => {
97
97
  const e = (o) => {
98
98
  if (!n) return;
99
- const l = o.key.length === 1 ? o.key.toLowerCase() : "";
100
- if (!l) return;
101
- const a = k + l;
102
- v(a);
99
+ const a = o.key.length === 1 ? o.key.toLowerCase() : "";
100
+ if (!a) return;
101
+ const i = y + a;
102
+ v(i);
103
103
  const t = s.find(
104
- (i) => {
105
- var y;
106
- return (y = i.label) == null ? void 0 : y.toLowerCase().startsWith(a);
104
+ (l) => {
105
+ var x;
106
+ return (x = l.label) == null ? void 0 : x.toLowerCase().startsWith(i);
107
107
  }
108
108
  );
109
- if (t && E.current && t.value in C.current && C.current[t.value]) {
110
- const i = E.current, y = C.current[t.value];
111
- i.scrollTo({
112
- top: y.offsetTop - i.offsetTop,
109
+ if (t && E.current && t.value in k.current && k.current[t.value]) {
110
+ const l = E.current, x = k.current[t.value];
111
+ l.scrollTo({
112
+ top: x.offsetTop - l.offsetTop,
113
113
  behavior: "smooth"
114
114
  });
115
115
  }
@@ -118,19 +118,19 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
118
118
  }, 700);
119
119
  };
120
120
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
121
- }, [n, s, k]), w(() => {
121
+ }, [n, s, y]), w(() => {
122
122
  if (!n) return;
123
123
  const e = (o) => {
124
- const l = o.key.toLowerCase();
125
- if (l.length === 1) {
126
- const a = s.find(
124
+ const a = o.key.toLowerCase();
125
+ if (a.length === 1) {
126
+ const i = s.find(
127
127
  (t) => {
128
- var i;
129
- return (i = t.label) == null ? void 0 : i.toLowerCase().startsWith(l);
128
+ var l;
129
+ return (l = t.label) == null ? void 0 : l.toLowerCase().startsWith(a);
130
130
  }
131
131
  );
132
- if (a) {
133
- const t = K.current[a.value];
132
+ if (i) {
133
+ const t = K.current[i.value];
134
134
  t && t.scrollIntoView({ block: "start", behavior: "smooth" });
135
135
  }
136
136
  }
@@ -141,15 +141,15 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
141
141
  return w(() => {
142
142
  if (n && d.current) {
143
143
  const e = d.current.getBoundingClientRect().height;
144
- F({
144
+ F(L || {
145
145
  top: `${e + 6}px`,
146
146
  left: "0px"
147
147
  });
148
148
  }
149
149
  }, [n]), /* @__PURE__ */ $("div", { className: m.selectContainer, children: [
150
- O(),
150
+ W(),
151
151
  /* @__PURE__ */ r(
152
- q,
152
+ z,
153
153
  {
154
154
  ref: U,
155
155
  anchorRef: d,
@@ -166,7 +166,7 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
166
166
  className: `${m.children} ${(c == null ? void 0 : c.value) === e.value ? m.active : ""}`,
167
167
  onClick: () => M(e),
168
168
  children: [
169
- e.icon && /* @__PURE__ */ r(p, { icon: e.icon, size: 16 }),
169
+ e.icon && /* @__PURE__ */ r(_, { icon: e.icon, size: 16 }),
170
170
  e.label && /* @__PURE__ */ r("div", { className: m.itemLabel, children: e.label })
171
171
  ]
172
172
  },
@@ -1 +1 @@
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}
1
+ ._editableField_1gd32_30{width:100%;display:flex;justify-content:flex-start;align-items:start;flex-direction:column;gap:.25rem;cursor:default}._statiqueField_1gd32_40{width:100%;border-radius:4px;border:1px solid var(--input-primary-default-border);padding:.5rem;box-sizing:border-box}._link_1gd32_48{color:var(--primary-color);text-decoration:underline;cursor:pointer}._link_1gd32_48:hover{text-decoration:none}
@@ -1 +1 @@
1
- ._overlay_b1r7c_1{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#0000004d;z-index:11;pointer-events:auto}._modalContent_b1r7c_12{position:absolute;z-index:12;border:1px solid var(--general-border-window);background-color:var(--background-primary)}._centered_b1r7c_19{max-width:90%;max-height:90%}
1
+ ._overlay_1hu8i_1{position:fixed;top:0;left:0;right:0;bottom:0;z-index:11;pointer-events:auto}._overlayBackground_1hu8i_11{background-color:#0000004d}._modalContent_1hu8i_15{position:absolute;z-index:12;border:1px solid var(--general-border-window);background-color:var(--background-primary)}._centered_1hu8i_22{max-width:90%;max-height:90%}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.1.39",
3
+ "version": "1.1.41",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",