@situaction/traq-ui-ste 1.1.24 → 1.1.26

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.
@@ -26,33 +26,33 @@ const y = "_fullHeight_o2xi7_15", O = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
26
26
  flexHorizontalBetween: Z,
27
27
  flexVertical: ee,
28
28
  flexVerticalBetweenCenter: oe
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);
29
+ }, fe = ({ menuItems: s = [], menuParams: r = [], shortLogo: x, logo: m, isOpen: h, defaultOpen: N = !1, selectedId: 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);
31
31
  $(() => {
32
- console.log("menu selectionné : ", a), a != null && B(a);
33
- }, [a]);
32
+ d != null && B(d);
33
+ }, [d]);
34
34
  const v = (o, i) => {
35
35
  if (o.stopPropagation(), B(i), s) {
36
- const n = s.find((r) => r.id === i);
36
+ const n = s.find((a) => a.id === i);
37
37
  n == null || n.onClick();
38
38
  }
39
39
  }, S = () => {
40
40
  p(!t), _(!1);
41
41
  }, P = (o) => {
42
42
  var i;
43
- if (d) {
44
- const n = d.find((r) => r.id === o);
43
+ if (r) {
44
+ const n = r.find((a) => a.id === o);
45
45
  if (!n) return;
46
46
  if (n.content) {
47
- const r = t ? "200px" : "40px";
48
- E(n.content), R({ ...n.position, left: r }), C(!0);
47
+ const a = t ? "200px" : "40px";
48
+ E(n.content), R({ ...n.position, left: a }), C(!0);
49
49
  } else
50
50
  (i = n.onClick) == null || i.call(n);
51
51
  }
52
52
  };
53
53
  return $(() => {
54
54
  h && h(t);
55
- }, [t]), /* @__PURE__ */ l("nav", { ref: V, children: /* @__PURE__ */ f("div", { className: `${e.flexVerticalBetweenStart} ${e.fullHeight} ${t ? e.open : e.close}`, children: [
55
+ }, [t]), /* @__PURE__ */ l("nav", { ref: I, 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
57
  /* @__PURE__ */ l(
58
58
  "div",
@@ -60,7 +60,7 @@ const y = "_fullHeight_o2xi7_15", O = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
60
60
  className: `${e.flexHorizontalBetween} ${e.pointer} ${e.textEllipsis}`,
61
61
  onClick: () => S(),
62
62
  children: t ? /* @__PURE__ */ f("div", { className: e.fullImg, children: [
63
- x && /* @__PURE__ */ l("img", { src: x, alt: "Logo situaction" }),
63
+ m && /* @__PURE__ */ l("img", { src: m, alt: "Logo situaction" }),
64
64
  /* @__PURE__ */ l(u, { mode: "ghost", size: "menu", children: /* @__PURE__ */ l(w, { icon: "CaretDoubleLeft", size: 16, weight: "duotone" }) })
65
65
  ] }) : /* @__PURE__ */ l(
66
66
  "div",
@@ -69,7 +69,7 @@ const y = "_fullHeight_o2xi7_15", O = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
69
69
  onMouseEnter: () => _(!0),
70
70
  onMouseLeave: () => _(!1),
71
71
  onClick: () => p(!t),
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" })
72
+ children: V || !x ? /* @__PURE__ */ l(u, { mode: "ghost", size: "menu", children: /* @__PURE__ */ l(w, { icon: "CaretDoubleRight", size: 22, weight: "duotone" }) }) : /* @__PURE__ */ l("img", { src: x, alt: "Logo situaction" })
73
73
  }
74
74
  )
75
75
  }
@@ -93,7 +93,7 @@ const y = "_fullHeight_o2xi7_15", O = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
93
93
  /* @__PURE__ */ l("div", { className: e.line })
94
94
  ] }),
95
95
  /* @__PURE__ */ f("div", { className: `${e.menuParams} ${e.flexVerticalBetweenCenter}`, children: [
96
- d && d.map((o) => /* @__PURE__ */ l(
96
+ r && r.map((o) => /* @__PURE__ */ l(
97
97
  "div",
98
98
  {
99
99
  className: `${e.fullWidth} ${e.textEllipsis}`,
@@ -107,7 +107,7 @@ const y = "_fullHeight_o2xi7_15", O = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
107
107
  {
108
108
  ref: L,
109
109
  className: e.borderRadiusM,
110
- open: I,
110
+ open: H,
111
111
  onClose: () => C(!1),
112
112
  position: z,
113
113
  children: k
@@ -11,6 +11,7 @@ export interface TabsProps {
11
11
  position?: 'center' | 'right' | 'left';
12
12
  /** Callback function to handle tab selection, receiving the selected tab's label */
13
13
  onTabSelect: (selectedItem: string | ReactNode) => void;
14
+ fullWidth?: boolean;
14
15
  }
15
16
  /**
16
17
  * Tabs component that allows tab navigation with text, icons, or buttons.
@@ -1,76 +1,80 @@
1
- import { jsxs as v, jsx as c } from "react/jsx-runtime";
2
- import { useState as m, useRef as _, useEffect as d, useLayoutEffect as C } from "react";
1
+ import { jsxs as H, jsx as a } from "react/jsx-runtime";
2
+ import { useState as u, useRef as s, useLayoutEffect as $ } from "react";
3
3
  import '../../styles/index.css';import '../../styles/Tabs.css';/* empty css */
4
- import { Button as N } from "../button/Button.js";
5
- import { IconButton as $ } from "../icon-button/IconButton.js";
6
- const p = "_underline_12jm7_57", n = {
7
- "tab-container": "_tab-container_12jm7_23",
8
- "tab-container-button": "_tab-container-button_12jm7_27",
9
- "tab-container-icon": "_tab-container-icon_12jm7_32",
10
- "tab-container-text": "_tab-container-text_12jm7_32",
11
- "tab-items": "_tab-items_12jm7_35",
12
- "tab-items-button": "_tab-items-button_12jm7_39",
13
- "selected-button": "_selected-button_12jm7_44",
14
- "selected-text": "_selected-text_12jm7_50",
4
+ import { Button as C } from "../button/Button.js";
5
+ import { IconButton as N } from "../icon-button/IconButton.js";
6
+ const p = "_underline_1twz4_63", n = {
7
+ "tab-container": "_tab-container_1twz4_23",
8
+ "tab-container-button": "_tab-container-button_1twz4_27",
9
+ "tab-container-icon": "_tab-container-icon_1twz4_32",
10
+ "tab-container-text": "_tab-container-text_1twz4_32",
11
+ "tab-items": "_tab-items_1twz4_35",
12
+ "tab-items-button": "_tab-items-button_1twz4_39",
13
+ "tab-full-width": "_tab-full-width_1twz4_44",
14
+ "selected-button": "_selected-button_1twz4_50",
15
+ "selected-text": "_selected-text_1twz4_56",
15
16
  underline: p,
16
- "flexHorizontal-center": "_flexHorizontal-center_12jm7_65",
17
- "flexHorizontal-left": "_flexHorizontal-left_12jm7_71",
18
- "flexHorizontal-right": "_flexHorizontal-right_12jm7_77"
19
- }, E = ({ listItems: o, type: l, onTabSelect: x, defaultActiveTab: a = 0, position: h = "left" }) => {
20
- const [r, b] = m(a), [j, g] = m({}), i = _(null), z = _(null), s = _(new Array(o.length).fill(null));
21
- d(() => {
22
- s.current = new Array(o.length).fill(null);
23
- }, [o.length]);
24
- const f = (t) => {
25
- b(t), x(o[t]);
26
- }, R = (t) => {
27
- if (i.current && t) {
28
- const e = t.getBoundingClientRect(), u = i.current.getBoundingClientRect();
29
- g({
30
- left: `${e.left - u.left}px`,
17
+ "flexHorizontal-center": "_flexHorizontal-center_1twz4_71",
18
+ "flexHorizontal-left": "_flexHorizontal-left_1twz4_77",
19
+ "flexHorizontal-right": "_flexHorizontal-right_1twz4_83"
20
+ }, A = ({
21
+ listItems: i,
22
+ type: o,
23
+ onTabSelect: f,
24
+ defaultActiveTab: d = 0,
25
+ position: m = "left",
26
+ fullWidth: z = !1
27
+ }) => {
28
+ const [l, w] = u(d), [x, h] = u({}), c = s(null), g = s(null), _ = s([]), b = (t) => {
29
+ w(t), f(i[t]);
30
+ }, v = (t) => {
31
+ if (c.current && t) {
32
+ const e = t.getBoundingClientRect(), r = c.current.getBoundingClientRect();
33
+ h({
34
+ left: `${e.left - r.left}px`,
31
35
  width: `${e.width}px`
32
36
  });
33
37
  }
34
- }, H = [
35
- n[`flexHorizontal-${h}`],
36
- l === "button" ? n["tab-items-button"] : n["tab-items"]
38
+ }, R = [
39
+ n[`flexHorizontal-${m}`],
40
+ o === "button" ? n["tab-items-button"] : n["tab-items"]
37
41
  ].filter(Boolean).join(" ");
38
- return C(() => {
39
- const t = s.current[r];
40
- t && R(t);
41
- }, [r, o.length]), d(() => {
42
- b(a);
43
- }, [a]), /* @__PURE__ */ v("div", { className: `tab ${n["tab-container"]} ${n[`tab-container-${l}`]}`, ref: i, children: [
44
- /* @__PURE__ */ c("div", { className: H, children: o.map((t, e) => /* @__PURE__ */ c(
42
+ return $(() => {
43
+ const t = _.current[l];
44
+ t && requestAnimationFrame(() => {
45
+ v(t);
46
+ });
47
+ }, [l, i.length]), /* @__PURE__ */ H("div", { className: `tab ${n["tab-container"]} ${n[`tab-container-${o}`]} ${z && n["tab-full-width"]}`, ref: c, children: [
48
+ /* @__PURE__ */ a("div", { className: R, children: i.map((t, e) => /* @__PURE__ */ a(
45
49
  "div",
46
50
  {
47
- ref: (u) => s.current[e] = u,
48
- className: l === "button" && e === r ? n["selected-button"] : "",
49
- children: l === "icon" ? /* @__PURE__ */ c(
50
- $,
51
+ ref: (r) => _.current[e] = r,
52
+ className: o === "button" && e === l ? n["selected-button"] : "",
53
+ children: o === "icon" ? /* @__PURE__ */ a(
54
+ N,
51
55
  {
52
56
  mode: "icon",
53
57
  size: "s",
54
- selected: e === r,
55
- onClick: () => f(e),
58
+ selected: e === l,
59
+ onClick: () => b(e),
56
60
  children: t
57
61
  }
58
- ) : /* @__PURE__ */ c("div", { className: e === r ? n["selected-text"] : void 0, children: /* @__PURE__ */ c(
59
- N,
62
+ ) : /* @__PURE__ */ a("div", { className: e === l ? n["selected-text"] : void 0, children: /* @__PURE__ */ a(
63
+ C,
60
64
  {
61
65
  size: "s",
62
66
  label: t,
63
- mode: l === "text" ? "text" : "ghost",
64
- selected: e === r,
65
- onClick: () => f(e)
67
+ mode: o === "text" ? "text" : "ghost",
68
+ selected: e === l,
69
+ onClick: () => b(e)
66
70
  }
67
71
  ) })
68
72
  },
69
73
  e
70
74
  )) }),
71
- l !== "button" && /* @__PURE__ */ c("div", { ref: z, className: n.underline, style: j })
75
+ o !== "button" && /* @__PURE__ */ a("div", { ref: g, className: n.underline, style: x })
72
76
  ] });
73
77
  };
74
78
  export {
75
- E as Tabs
79
+ A as Tabs
76
80
  };
@@ -1 +1 @@
1
- ._tab-container_12jm7_23{position:relative;line-height:1.25rem}._tab-container-button_12jm7_27{border-radius:.375rem;border:1px solid var(--tabs-button-border);background:var(--tabs-button-background)}._tab-container-icon_12jm7_32,._tab-container-text_12jm7_32{border-bottom:1px solid var(--tabs-line-border)}._tab-items_12jm7_35{gap:2.25rem;padding:.625rem .125rem}._tab-items-button_12jm7_39{gap:.25rem;padding:.125rem}._selected-button_12jm7_44{border:1px solid var(--button-tertiary-default-border);background:var(--tabs-button-background-button);border-radius:.25rem}._selected-text_12jm7_50>button{font-weight:600!important}._selected-text_12jm7_50>button:hover{background-color:transparent!important}._underline_12jm7_57{position:absolute;bottom:0;height:2px;background-color:var(--tabs-cell-active-border);transition:all .3s ease}._flexHorizontal-center_12jm7_65{display:flex;justify-content:center;align-items:center;flex-direction:row}._flexHorizontal-left_12jm7_71{display:flex;justify-content:flex-start;align-items:center;flex-direction:row}._flexHorizontal-right_12jm7_77{display:flex;justify-content:flex-end;align-items:center;flex-direction:row}
1
+ ._tab-container_1twz4_23{position:relative;line-height:1.25rem}._tab-container-button_1twz4_27{border-radius:.375rem;border:1px solid var(--tabs-button-border);background:var(--tabs-button-background)}._tab-container-icon_1twz4_32,._tab-container-text_1twz4_32{border-bottom:1px solid var(--tabs-line-border)}._tab-items_1twz4_35{gap:2.25rem;padding:.625rem .125rem}._tab-items-button_1twz4_39{gap:.25rem;padding:.125rem}._tab-full-width_1twz4_44{width:100%;display:flex;justify-content:center}._selected-button_1twz4_50{border:1px solid var(--button-tertiary-default-border);background:var(--tabs-button-background-button);border-radius:.25rem}._selected-text_1twz4_56>button{font-weight:600!important}._selected-text_1twz4_56>button:hover{background-color:transparent!important}._underline_1twz4_63{position:absolute;bottom:0;height:2px;background-color:var(--tabs-cell-active-border);transition:all .3s ease}._flexHorizontal-center_1twz4_71{display:flex;justify-content:center;align-items:center;flex-direction:row}._flexHorizontal-left_1twz4_77{display:flex;justify-content:flex-start;align-items:center;flex-direction:row}._flexHorizontal-right_1twz4_83{display:flex;justify-content:flex-end;align-items:center;flex-direction:row}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",