@situaction/traq-ui-ste 1.1.38 → 1.1.40

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,49 +1,47 @@
1
- import { jsx as _ } from "react/jsx-runtime";
2
- import { useState as y, useRef as L, useEffect as f } from "react";
3
- import '../../../styles/SidePanel.css';const x = "_panel_lk5yy_1", v = "_openPanelBtn_lk5yy_9", b = "_box_lk5yy_18", B = "_panelLeft_lk5yy_29", C = "_panelRight_lk5yy_36", H = "_panelOpenedLeft_lk5yy_43", S = "_panelOpenedRight_lk5yy_47", E = "_panelHidden_lk5yy_51", N = "_displayPanel_lk5yy_55", g = "_hidePanel_lk5yy_59", e = {
4
- panel: x,
5
- openPanelBtn: v,
6
- box: b,
7
- panelLeft: B,
8
- panelRight: C,
9
- panelOpenedLeft: H,
10
- panelOpenedRight: S,
11
- panelHidden: E,
12
- displayPanel: N,
13
- hidePanel: g
14
- }, I = ({
15
- children: u,
16
- width: s,
17
- left: c = !0,
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useState as _, useRef as R, useEffect as y } from "react";
3
+ import '../../../styles/SidePanel.css';const L = "_panel_lk5yy_1", x = "_openPanelBtn_lk5yy_9", v = "_box_lk5yy_18", b = "_panelLeft_lk5yy_29", B = "_panelRight_lk5yy_36", C = "_panelOpenedLeft_lk5yy_43", H = "_panelOpenedRight_lk5yy_47", S = "_panelHidden_lk5yy_51", E = "_displayPanel_lk5yy_55", N = "_hidePanel_lk5yy_59", e = {
4
+ panel: L,
5
+ openPanelBtn: x,
6
+ box: v,
7
+ panelLeft: b,
8
+ panelRight: B,
9
+ panelOpenedLeft: C,
10
+ panelOpenedRight: H,
11
+ panelHidden: S,
12
+ displayPanel: E,
13
+ hidePanel: N
14
+ }, $ = ({
15
+ children: f,
16
+ width: a,
17
+ left: o = !0,
18
18
  opened: n = !1,
19
19
  onToggle: t
20
20
  }) => {
21
- const [l, i] = y(n), [m, p] = y(n), a = L(null), h = {
22
- "--dynamic-left": `-${s}`,
23
- "--dynamic-right": `-${s}`,
24
- width: s
25
- }, P = c ? e.panelLeft : e.panelRight, k = c ? e.panelOpenedLeft : e.panelOpenedRight, O = [
21
+ const [l, s] = _(n), [u, i] = _(n), p = R(null), m = {
22
+ "--dynamic-left": `-${a}`,
23
+ "--dynamic-right": `-${a}`,
24
+ width: a
25
+ }, h = o ? e.panelLeft : e.panelRight, P = o ? e.panelOpenedLeft : e.panelOpenedRight, k = [
26
26
  e.panel,
27
- P,
27
+ h,
28
28
  !l && e.panelHidden,
29
- l && k,
30
- m ? e.displayPanel : e.hidePanel
29
+ l && P,
30
+ u ? e.displayPanel : e.hidePanel
31
31
  ].filter(Boolean).join(" ");
32
- return f(() => {
33
- n ? (p(!0), setTimeout(() => i(!0), 10)) : (i(!1), setTimeout(() => p(!1), 300));
34
- }, [n]), f(() => {
35
- const d = (R) => {
36
- var r;
37
- const o = R.target;
38
- o.closest("[data-ignore-outside-click]") || // déjà présent
39
- (r = a.current) != null && r.contains(o) || a.current && !a.current.contains(o) && (i(!1), t == null || t(!1), setTimeout(() => p(!1), 300));
32
+ return y(() => {
33
+ n ? (i(!0), setTimeout(() => s(!0), 10)) : (s(!1), setTimeout(() => i(!1), 300));
34
+ }, [n]), y(() => {
35
+ const d = (O) => {
36
+ const c = O.target;
37
+ c.closest("[data-ignore-outside-click]") || p.current && !p.current.contains(c) && (s(!1), t == null || t(!1), setTimeout(() => i(!1), 300));
40
38
  };
41
39
  if (l)
42
40
  return document.addEventListener("mousedown", d), () => {
43
41
  document.removeEventListener("mousedown", d);
44
42
  };
45
- }, [l, t]), /* @__PURE__ */ _("div", { style: h, className: O, children: /* @__PURE__ */ _("div", { ref: a, className: e.box, children: u }) });
43
+ }, [l, t]), /* @__PURE__ */ r("div", { style: m, className: k, children: /* @__PURE__ */ r("div", { ref: p, className: e.box, children: f }) });
46
44
  };
47
45
  export {
48
- I as SidePanel
46
+ $ as SidePanel
49
47
  };
@@ -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.38",
3
+ "version": "1.1.40",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",