@situaction/traq-ui-ste 1.2.32 → 1.2.33

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.
@@ -1,8 +1,8 @@
1
- import { jsxs as A, jsx as l } from "react/jsx-runtime";
2
- import { useState as z, useRef as w, useCallback as B, useEffect as u, useLayoutEffect as E } from "react";
3
- import { Button as F } from "../button/Button.js";
4
- import { IconButton as p } from "../icon-button/IconButton.js";
5
- import '../../styles/Tabs.css';const q = "_underline_1jy9f_82", n = {
1
+ import { jsxs as p, jsx as c } from "react/jsx-runtime";
2
+ import { useState as N, useRef as j, useCallback as A, useEffect as u, useLayoutEffect as F } from "react";
3
+ import { Button as q } from "../button/Button.js";
4
+ import { IconButton as L } from "../icon-button/IconButton.js";
5
+ import '../../styles/Tabs.css';const M = "_underline_1jy9f_82", n = {
6
6
  "tab-container": "_tab-container_1jy9f_30",
7
7
  "tab-container-button": "_tab-container-button_1jy9f_34",
8
8
  "tab-container-icon": "_tab-container-icon_1jy9f_39",
@@ -14,56 +14,52 @@ import '../../styles/Tabs.css';const q = "_underline_1jy9f_82", n = {
14
14
  "selected-button": "_selected-button_1jy9f_63",
15
15
  "noSelect-button": "_noSelect-button_1jy9f_70",
16
16
  "selected-text": "_selected-text_1jy9f_74",
17
- underline: q,
17
+ underline: M,
18
18
  "flexHorizontal-center": "_flexHorizontal-center_1jy9f_90",
19
19
  "flexHorizontal-left": "_flexHorizontal-left_1jy9f_96",
20
20
  "flexHorizontal-right": "_flexHorizontal-right_1jy9f_102"
21
- }, C = (i, o) => {
21
+ }, S = (i, o) => {
22
22
  if (!Number.isFinite(i)) return 0;
23
- const b = Math.max(0, o);
24
- return Math.min(Math.max(i, 0), b);
25
- }, O = ({
23
+ const d = Math.max(0, o);
24
+ return Math.min(Math.max(i, 0), d);
25
+ }, G = ({
26
26
  listItems: i,
27
27
  type: o,
28
- onTabSelect: b,
29
- activeTab: d,
30
- defaultActiveTab: _ = 0,
31
- position: j = "left",
32
- fullWidth: R = !1,
33
- disabledTabs: x = []
28
+ onTabSelect: d,
29
+ activeTab: _,
30
+ defaultActiveTab: m = 0,
31
+ position: v = "left",
32
+ fullWidth: h = !1,
33
+ disabledTabs: z = []
34
34
  }) => {
35
- const c = d !== void 0, [N, y] = z(_), m = C(
36
- c ? d : N,
35
+ const l = _ !== void 0, [H, g] = N(m), f = S(
36
+ l ? _ : H,
37
37
  (i.length || 1) - 1
38
- ), [S, H] = z({}), a = w(null), g = w([]), h = (t) => {
39
- x.includes(t) || (c || y(t), b(i[t], t));
40
- }, v = (t) => {
38
+ ), [$, B] = N({}), a = j(null), w = j([]), R = j([]), x = (t) => {
39
+ z.includes(t) || (l || g(t), d(i[t], t));
40
+ }, C = (t) => {
41
41
  if (!a.current || !t || o === "button") return;
42
42
  const e = a.current.getBoundingClientRect();
43
43
  if (e.width === 0) {
44
- requestAnimationFrame(() => v(t));
44
+ requestAnimationFrame(() => C(t));
45
45
  return;
46
46
  }
47
47
  const s = t.getBoundingClientRect();
48
- H({
48
+ B({
49
49
  left: `${s.left - e.left}px`,
50
50
  width: `${s.width}px`
51
51
  });
52
- }, r = B(() => {
53
- const t = g.current[m] ?? null;
54
- requestAnimationFrame(
55
- () => requestAnimationFrame(() => v(t))
56
- );
57
- }, [m, o]);
52
+ }, r = A(() => {
53
+ const t = (h ? R.current[f] : null) ?? w.current[f] ?? null;
54
+ requestAnimationFrame(() => requestAnimationFrame(() => C(t)));
55
+ }, [f, o, h]);
58
56
  u(() => {
59
- c && r();
60
- }, [c, r, d]), E(() => {
57
+ l && r();
58
+ }, [l, r, _]), F(() => {
61
59
  r();
62
- }, [r, j, i.length]), u(() => {
63
- c || y(
64
- C(_, (i.length || 1) - 1)
65
- );
66
- }, [_, i.length, c]), u(() => {
60
+ }, [r, v, i.length]), u(() => {
61
+ l || g(S(m, (i.length || 1) - 1));
62
+ }, [m, i.length, l]), u(() => {
67
63
  var t, e;
68
64
  (e = (t = document.fonts) == null ? void 0 : t.ready) == null || e.then(() => r());
69
65
  }, [r]), u(() => {
@@ -74,65 +70,65 @@ import '../../styles/Tabs.css';const q = "_underline_1jy9f_82", n = {
74
70
  const t = new ResizeObserver(() => r());
75
71
  return t.observe(a.current), () => t.disconnect();
76
72
  }, [r]);
77
- const $ = [
78
- n[`flexHorizontal-${j}`],
73
+ const k = [
74
+ n[`flexHorizontal-${v}`],
79
75
  o === "button" ? n["tab-items-button"] : n["tab-items"]
80
76
  ].filter(Boolean).join(" ");
81
- return /* @__PURE__ */ A(
77
+ return /* @__PURE__ */ p(
82
78
  "div",
83
79
  {
84
- className: `tab ${n["tab-container"]} ${n[`tab-container-${o}`]} ${R && n["tab-full-width"]}`,
80
+ className: `tab ${n["tab-container"]} ${n[`tab-container-${o}`]} ${h && n["tab-full-width"]}`,
85
81
  ref: a,
86
82
  children: [
87
- /* @__PURE__ */ l("div", { className: $, children: i.map((t, e) => {
88
- const s = x.includes(e), f = e === m;
89
- return /* @__PURE__ */ l(
83
+ /* @__PURE__ */ c("div", { className: k, children: i.map((t, e) => {
84
+ const s = z.includes(e), b = e === f;
85
+ return /* @__PURE__ */ c(
90
86
  "div",
91
87
  {
92
- ref: (k) => g.current[e] = k,
88
+ ref: (y) => w.current[e] = y,
93
89
  className: [
94
- o === "button" && f ? n["selected-button"] : n["noSelect-button"],
90
+ o === "button" && b ? n["selected-button"] : n["noSelect-button"],
95
91
  typeof t != "string" ? n["noSelect-button"] : "",
96
92
  s ? n["tab-disabled"] : ""
97
93
  ].filter(Boolean).join(" "),
98
- children: o === "icon" ? /* @__PURE__ */ l(
99
- p,
94
+ children: /* @__PURE__ */ c(
95
+ "span",
100
96
  {
101
- mode: "icon",
102
- size: "s",
103
- selected: f,
104
- onClick: () => h(e),
105
- disabled: s,
106
- children: t
97
+ ref: (y) => R.current[e] = y,
98
+ style: { display: "inline-flex" },
99
+ children: o === "icon" ? /* @__PURE__ */ c(
100
+ L,
101
+ {
102
+ mode: "icon",
103
+ size: "s",
104
+ selected: b,
105
+ onClick: () => x(e),
106
+ disabled: s,
107
+ children: t
108
+ }
109
+ ) : o === "button" ? /* @__PURE__ */ c("div", { className: n["tab-type-button"], onClick: () => x(e), children: t }) : /* @__PURE__ */ c("div", { className: b ? n["selected-text"] : void 0, children: /* @__PURE__ */ c(
110
+ q,
111
+ {
112
+ size: "s",
113
+ label: t,
114
+ mode: o === "text" ? "text" : "ghost",
115
+ selected: b,
116
+ onClick: () => x(e),
117
+ disabled: s,
118
+ fullWidth: !0
119
+ }
120
+ ) })
107
121
  }
108
- ) : o === "button" ? /* @__PURE__ */ l(
109
- "div",
110
- {
111
- className: n["tab-type-button"],
112
- onClick: () => h(e),
113
- children: t
114
- }
115
- ) : /* @__PURE__ */ l("div", { className: f ? n["selected-text"] : void 0, children: /* @__PURE__ */ l(
116
- F,
117
- {
118
- size: "s",
119
- label: t,
120
- mode: o === "text" ? "text" : "ghost",
121
- selected: f,
122
- onClick: () => h(e),
123
- disabled: s,
124
- fullWidth: !0
125
- }
126
- ) })
122
+ )
127
123
  },
128
124
  e
129
125
  );
130
126
  }) }),
131
- o !== "button" && /* @__PURE__ */ l("div", { className: n.underline, style: S })
127
+ o !== "button" && /* @__PURE__ */ c("div", { className: n.underline, style: $ })
132
128
  ]
133
129
  }
134
130
  );
135
131
  };
136
132
  export {
137
- O as Tabs
133
+ G as Tabs
138
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.2.32",
3
+ "version": "1.2.33",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",