@situaction/traq-ui-ste 1.1.22 → 1.1.24

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.
@@ -50,7 +50,7 @@ export interface MenuProps {
50
50
  /** Whether the menu should be open by default */
51
51
  defaultOpen?: boolean;
52
52
  /** ID of the menu item selected by default */
53
- defaultSelectedId?: string;
53
+ selectedId?: string;
54
54
  }
55
55
  /**
56
56
  * Menu component renders a vertical navigation bar with collapsible state,
@@ -1,15 +1,15 @@
1
- import { jsx as n, jsxs as f } from "react/jsx-runtime";
1
+ import { jsx as l, jsxs as f } from "react/jsx-runtime";
2
2
  import { useState as c, useRef as M, useEffect as $ } from "react";
3
3
  import { Button as b } from "../button/Button.js";
4
4
  import '../../styles/Size.css';import '../../styles/index.css';import '../../styles/Menu.css';/* empty css */
5
5
  import { IconButton as u } from "../icon-button/IconButton.js";
6
6
  import { Icon as w } from "../icon/Icon.js";
7
- import { Modal as y } from "../modal/Modal.js";
7
+ import { Modal as W } from "../modal/Modal.js";
8
8
  import "../theme/ThemeContext.js";
9
9
  /* empty css */
10
- const O = "_fullHeight_o2xi7_15", S = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21", D = "_close_o2xi7_25", q = "_menuButton_o2xi7_29", A = "_closeIcon_o2xi7_37", F = "_label_o2xi7_42", G = "_textEllipsis_o2xi7_46", J = "_pointer_o2xi7_51", K = "_fullImg_o2xi7_54", Q = "_menuParams_o2xi7_60", T = "_line_o2xi7_66", U = "_borderRadiusM_o2xi7_73", X = "_menuItem_o2xi7_77", Y = "_flexVerticalBetweenStart_o2xi7_86", Z = "_flexHorizontalBetween_o2xi7_93", ee = "_flexVertical_o2xi7_86", oe = "_flexVerticalBetweenCenter_o2xi7_107", e = {
11
- fullHeight: O,
12
- fullWidth: S,
10
+ const y = "_fullHeight_o2xi7_15", O = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21", D = "_close_o2xi7_25", q = "_menuButton_o2xi7_29", A = "_closeIcon_o2xi7_37", F = "_label_o2xi7_42", G = "_textEllipsis_o2xi7_46", J = "_pointer_o2xi7_51", K = "_fullImg_o2xi7_54", Q = "_menuParams_o2xi7_60", T = "_line_o2xi7_66", U = "_borderRadiusM_o2xi7_73", X = "_menuItem_o2xi7_77", Y = "_flexVerticalBetweenStart_o2xi7_86", Z = "_flexHorizontalBetween_o2xi7_93", ee = "_flexVertical_o2xi7_86", oe = "_flexVerticalBetweenCenter_o2xi7_107", e = {
11
+ fullHeight: y,
12
+ fullWidth: O,
13
13
  open: j,
14
14
  close: D,
15
15
  menuButton: q,
@@ -26,55 +26,55 @@ const O = "_fullHeight_o2xi7_15", S = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
26
26
  flexHorizontalBetween: Z,
27
27
  flexVertical: ee,
28
28
  flexVerticalBetweenCenter: oe
29
- }, fe = ({ menuItems: s = [], menuParams: r = [], shortLogo: x, logo: m, isOpen: h, defaultOpen: N = !1, defaultSelectedId: d }) => {
30
- const [t, p] = c(N ?? !1), [g, B] = c(d ?? (s.length > 0 ? s[0].id : null)), I = M(null), [V, _] = c(!1), [H, C] = c(!1), [k, E] = c(null), [z, R] = c({}), L = M(null);
29
+ }, fe = ({ menuItems: s = [], menuParams: d = [], shortLogo: m, logo: x, isOpen: h, defaultOpen: N = !1, selectedId: a }) => {
30
+ const [t, p] = c(N ?? !1), [g, B] = c(a ?? (s.length > 0 ? s[0].id : null)), V = M(null), [H, _] = c(!1), [I, C] = c(!1), [k, E] = c(null), [z, R] = c({}), L = M(null);
31
31
  $(() => {
32
- d && B(d);
33
- }, [d]);
32
+ console.log("menu selectionné : ", a), a != null && B(a);
33
+ }, [a]);
34
34
  const v = (o, i) => {
35
35
  if (o.stopPropagation(), B(i), s) {
36
- const l = s.find((a) => a.id === i);
37
- l == null || l.onClick();
36
+ const n = s.find((r) => r.id === i);
37
+ n == null || n.onClick();
38
38
  }
39
- }, P = () => {
39
+ }, S = () => {
40
40
  p(!t), _(!1);
41
- }, W = (o) => {
41
+ }, P = (o) => {
42
42
  var i;
43
- if (r) {
44
- const l = r.find((a) => a.id === o);
45
- if (!l) return;
46
- if (l.content) {
47
- const a = t ? "200px" : "40px";
48
- E(l.content), R({ ...l.position, left: a }), C(!0);
43
+ if (d) {
44
+ const n = d.find((r) => r.id === o);
45
+ if (!n) return;
46
+ if (n.content) {
47
+ const r = t ? "200px" : "40px";
48
+ E(n.content), R({ ...n.position, left: r }), C(!0);
49
49
  } else
50
- (i = l.onClick) == null || i.call(l);
50
+ (i = n.onClick) == null || i.call(n);
51
51
  }
52
52
  };
53
53
  return $(() => {
54
54
  h && h(t);
55
- }, [t]), /* @__PURE__ */ n("nav", { ref: I, children: /* @__PURE__ */ f("div", { className: `${e.flexVerticalBetweenStart} ${e.fullHeight} ${t ? e.open : e.close}`, children: [
55
+ }, [t]), /* @__PURE__ */ l("nav", { ref: V, children: /* @__PURE__ */ f("div", { className: `${e.flexVerticalBetweenStart} ${e.fullHeight} ${t ? e.open : e.close}`, children: [
56
56
  /* @__PURE__ */ f("div", { className: e.fullWidth, children: [
57
- /* @__PURE__ */ n(
57
+ /* @__PURE__ */ l(
58
58
  "div",
59
59
  {
60
60
  className: `${e.flexHorizontalBetween} ${e.pointer} ${e.textEllipsis}`,
61
- onClick: () => P(),
61
+ onClick: () => S(),
62
62
  children: t ? /* @__PURE__ */ f("div", { className: e.fullImg, children: [
63
- m && /* @__PURE__ */ n("img", { src: m, alt: "Logo situaction" }),
64
- /* @__PURE__ */ n(u, { mode: "ghost", size: "menu", children: /* @__PURE__ */ n(w, { icon: "CaretDoubleLeft", size: 16, weight: "duotone" }) })
65
- ] }) : /* @__PURE__ */ n(
63
+ x && /* @__PURE__ */ l("img", { src: x, alt: "Logo situaction" }),
64
+ /* @__PURE__ */ l(u, { mode: "ghost", size: "menu", children: /* @__PURE__ */ l(w, { icon: "CaretDoubleLeft", size: 16, weight: "duotone" }) })
65
+ ] }) : /* @__PURE__ */ l(
66
66
  "div",
67
67
  {
68
68
  className: e.closeIcon,
69
69
  onMouseEnter: () => _(!0),
70
70
  onMouseLeave: () => _(!1),
71
71
  onClick: () => p(!t),
72
- children: V || !x ? /* @__PURE__ */ n(u, { mode: "ghost", size: "menu", children: /* @__PURE__ */ n(w, { icon: "CaretDoubleRight", size: 22, weight: "duotone" }) }) : /* @__PURE__ */ n("img", { src: x, alt: "Logo situaction" })
72
+ children: H || !m ? /* @__PURE__ */ l(u, { mode: "ghost", size: "menu", children: /* @__PURE__ */ l(w, { icon: "CaretDoubleRight", size: 22, weight: "duotone" }) }) : /* @__PURE__ */ l("img", { src: m, alt: "Logo situaction" })
73
73
  }
74
74
  )
75
75
  }
76
76
  ),
77
- /* @__PURE__ */ n("div", { className: e.menuItem, children: s && s.map((o) => t ? /* @__PURE__ */ n("div", { className: `${e.textEllipsis} ${e.menuButton}`, children: /* @__PURE__ */ n(
77
+ /* @__PURE__ */ l("div", { className: e.menuItem, children: s && s.map((o) => t ? /* @__PURE__ */ l("div", { className: `${e.textEllipsis} ${e.menuButton}`, children: /* @__PURE__ */ l(
78
78
  b,
79
79
  {
80
80
  mode: g === o.id ? "secondary" : "ghost",
@@ -82,7 +82,7 @@ const O = "_fullHeight_o2xi7_15", S = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
82
82
  onClick: (i) => v(i, o.id),
83
83
  childrenLeft: o.icon
84
84
  }
85
- ) }, `button-${o.id}`) : /* @__PURE__ */ n("div", { className: e.textEllipsis, children: /* @__PURE__ */ n(
85
+ ) }, `button-${o.id}`) : /* @__PURE__ */ l("div", { className: e.textEllipsis, children: /* @__PURE__ */ l(
86
86
  u,
87
87
  {
88
88
  mode: g === o.id ? "secondary" : "ghost",
@@ -90,24 +90,24 @@ const O = "_fullHeight_o2xi7_15", S = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
90
90
  onClick: (i) => v(i, o.id)
91
91
  }
92
92
  ) }, `icon-${o.id}`)) }),
93
- /* @__PURE__ */ n("div", { className: e.line })
93
+ /* @__PURE__ */ l("div", { className: e.line })
94
94
  ] }),
95
95
  /* @__PURE__ */ f("div", { className: `${e.menuParams} ${e.flexVerticalBetweenCenter}`, children: [
96
- r && r.map((o) => /* @__PURE__ */ n(
96
+ d && d.map((o) => /* @__PURE__ */ l(
97
97
  "div",
98
98
  {
99
99
  className: `${e.fullWidth} ${e.textEllipsis}`,
100
- onClick: () => W(o.id),
101
- children: t ? /* @__PURE__ */ n("div", { className: e.menuButton, children: /* @__PURE__ */ n(b, { mode: "ghost", label: o.label, childrenLeft: o.icon }, o.id) }) : /* @__PURE__ */ n(u, { mode: "ghost", children: o.icon })
100
+ onClick: () => P(o.id),
101
+ children: t ? /* @__PURE__ */ l("div", { className: e.menuButton, children: /* @__PURE__ */ l(b, { mode: "ghost", label: o.label, childrenLeft: o.icon }, o.id) }) : /* @__PURE__ */ l(u, { mode: "ghost", children: o.icon })
102
102
  },
103
103
  `param-icon-${o.id}`
104
104
  )),
105
- /* @__PURE__ */ n(
106
- y,
105
+ /* @__PURE__ */ l(
106
+ W,
107
107
  {
108
108
  ref: L,
109
109
  className: e.borderRadiusM,
110
- open: H,
110
+ open: I,
111
111
  onClose: () => C(!1),
112
112
  position: z,
113
113
  children: k
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",