@situaction/traq-ui-ste 1.1.25 → 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.
@@ -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.25",
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",