@situaction/traq-ui-ste 1.2.8 → 1.2.9

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,121 +1,132 @@
1
- import { jsxs as j, jsx as s } from "react/jsx-runtime";
2
- import { useState as R, useRef as $, useEffect as u, useLayoutEffect as k } from "react";
3
- import { Button as q } from "../button/Button.js";
4
- import { IconButton as B } from "../icon-button/IconButton.js";
5
- import '../../styles/Tabs.css';const L = "_underline_6o3gh_70", n = {
6
- "tab-container": "_tab-container_6o3gh_30",
7
- "tab-container-button": "_tab-container-button_6o3gh_34",
8
- "tab-container-icon": "_tab-container-icon_6o3gh_39",
9
- "tab-container-text": "_tab-container-text_6o3gh_39",
10
- "tab-items": "_tab-items_6o3gh_42",
11
- "tab-items-button": "_tab-items-button_6o3gh_46",
12
- "tab-full-width": "_tab-full-width_6o3gh_51",
13
- "selected-button": "_selected-button_6o3gh_57",
14
- "selected-text": "_selected-text_6o3gh_63",
15
- underline: L,
16
- "flexHorizontal-center": "_flexHorizontal-center_6o3gh_78",
17
- "flexHorizontal-left": "_flexHorizontal-left_6o3gh_84",
18
- "flexHorizontal-right": "_flexHorizontal-right_6o3gh_90"
19
- }, C = (o, r) => {
1
+ import { jsxs as p, jsx as i } from "react/jsx-runtime";
2
+ import { useState as R, useRef as C, useEffect as u, useLayoutEffect as y } from "react";
3
+ import { Button as B } from "../button/Button.js";
4
+ import { IconButton as E } from "../icon-button/IconButton.js";
5
+ import '../../styles/Tabs.css';const F = "_underline_1rcir_81", n = {
6
+ "tab-container": "_tab-container_1rcir_30",
7
+ "tab-container-button": "_tab-container-button_1rcir_34",
8
+ "tab-container-icon": "_tab-container-icon_1rcir_39",
9
+ "tab-container-text": "_tab-container-text_1rcir_39",
10
+ "tab-items": "_tab-items_1rcir_42",
11
+ "tab-items-button": "_tab-items-button_1rcir_46",
12
+ "tab-type-button": "_tab-type-button_1rcir_50",
13
+ "tab-full-width": "_tab-full-width_1rcir_56",
14
+ "selected-button": "_selected-button_1rcir_62",
15
+ "noSelect-button": "_noSelect-button_1rcir_69",
16
+ "selected-text": "_selected-text_1rcir_73",
17
+ underline: F,
18
+ "flexHorizontal-center": "_flexHorizontal-center_1rcir_89",
19
+ "flexHorizontal-left": "_flexHorizontal-left_1rcir_95",
20
+ "flexHorizontal-right": "_flexHorizontal-right_1rcir_101"
21
+ }, N = (o, r) => {
20
22
  if (!Number.isFinite(o)) return 0;
21
- const b = Math.max(0, r);
22
- return Math.min(Math.max(o, 0), b);
23
+ const d = Math.max(0, r);
24
+ return Math.min(Math.max(o, 0), d);
23
25
  }, D = ({
24
26
  listItems: o,
25
27
  type: r,
26
- onTabSelect: b,
28
+ onTabSelect: d,
27
29
  activeTab: _,
28
30
  defaultActiveTab: f = 0,
29
- position: m = "left",
30
- fullWidth: H = !1,
31
+ position: x = "left",
32
+ fullWidth: S = !1,
31
33
  disabledTabs: g = []
32
34
  }) => {
33
- const c = _ !== void 0, [N, x] = R(f), h = C(
34
- c ? _ : N,
35
+ const l = _ !== void 0, [$, v] = R(f), m = N(
36
+ l ? _ : $,
35
37
  (o.length || 1) - 1
36
- ), [A, E] = R({}), l = $(null), z = $([]), v = (t) => {
37
- g.includes(t) || (c || x(t), b(o[t], t));
38
+ ), [H, A] = R({}), s = C(null), z = C([]), h = (t) => {
39
+ g.includes(t) || (l || v(t), d(o[t], t));
38
40
  }, w = (t) => {
39
- if (!l.current || !t || r === "button") return;
40
- const e = l.current.getBoundingClientRect();
41
+ if (!s.current || !t || r === "button") return;
42
+ const e = s.current.getBoundingClientRect();
41
43
  if (e.width === 0) {
42
44
  requestAnimationFrame(() => w(t));
43
45
  return;
44
46
  }
45
- const i = t.getBoundingClientRect();
46
- E({
47
- left: `${i.left - e.left}px`,
48
- width: `${i.width}px`
47
+ const c = t.getBoundingClientRect();
48
+ A({
49
+ left: `${c.left - e.left}px`,
50
+ width: `${c.width}px`
49
51
  });
50
52
  }, a = () => {
51
- const t = z.current[h] ?? null;
53
+ const t = z.current[m] ?? null;
52
54
  requestAnimationFrame(
53
55
  () => requestAnimationFrame(() => w(t))
54
56
  );
55
57
  };
56
58
  u(() => {
57
- c && a();
58
- }, [_]), k(() => {
59
+ l && a();
60
+ }, [_]), y(() => {
59
61
  a();
60
- }, [h, m, o.length]), u(() => {
61
- c || x(C(f, (o.length || 1) - 1));
62
- }, [f, o.length, c]), u(() => {
62
+ }, [m, x, o.length]), u(() => {
63
+ l || v(N(f, (o.length || 1) - 1));
64
+ }, [f, o.length, l]), u(() => {
63
65
  var t, e;
64
66
  (e = (t = document.fonts) == null ? void 0 : t.ready) == null || e.then(() => a());
65
67
  }, []), u(() => {
66
68
  const t = () => a();
67
69
  return window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
68
70
  }, []), u(() => {
69
- if (!l.current) return;
71
+ if (!s.current) return;
70
72
  const t = new ResizeObserver(() => a());
71
- return t.observe(l.current), () => t.disconnect();
73
+ return t.observe(s.current), () => t.disconnect();
72
74
  }, []);
73
- const F = [
74
- n[`flexHorizontal-${m}`],
75
+ const j = [
76
+ n[`flexHorizontal-${x}`],
75
77
  r === "button" ? n["tab-items-button"] : n["tab-items"]
76
78
  ].filter(Boolean).join(" ");
77
- return /* @__PURE__ */ j(
79
+ return /* @__PURE__ */ p(
78
80
  "div",
79
81
  {
80
- className: `tab ${n["tab-container"]} ${n[`tab-container-${r}`]} ${H && n["tab-full-width"]}`,
81
- ref: l,
82
+ className: `tab ${n["tab-container"]} ${n[`tab-container-${r}`]} ${S && n["tab-full-width"]}`,
83
+ ref: s,
82
84
  children: [
83
- /* @__PURE__ */ s("div", { className: F, children: o.map((t, e) => {
84
- const i = g.includes(e), d = e === h;
85
- return /* @__PURE__ */ s(
85
+ /* @__PURE__ */ i("div", { className: j, children: o.map((t, e) => {
86
+ const c = g.includes(e), b = e === m;
87
+ return /* @__PURE__ */ i(
86
88
  "div",
87
89
  {
88
- ref: (S) => z.current[e] = S,
89
- className: `
90
- ${r === "button" && d ? n["selected-button"] : ""}
91
- ${i ? n["tab-disabled"] : ""}
92
- `,
93
- children: r === "icon" ? /* @__PURE__ */ s(
94
- B,
90
+ ref: (k) => z.current[e] = k,
91
+ className: [
92
+ r === "button" && b ? n["selected-button"] : n["noSelect-button"],
93
+ typeof t != "string" ? n["noSelect-button"] : "",
94
+ c ? n["tab-disabled"] : ""
95
+ ].filter(Boolean).join(" "),
96
+ children: r === "icon" ? /* @__PURE__ */ i(
97
+ E,
95
98
  {
96
99
  mode: "icon",
97
100
  size: "s",
98
- selected: d,
99
- onClick: () => v(e),
100
- disabled: i,
101
+ selected: b,
102
+ onClick: () => h(e),
103
+ disabled: c,
101
104
  children: t
102
105
  }
103
- ) : /* @__PURE__ */ s("div", { className: d ? n["selected-text"] : void 0, children: /* @__PURE__ */ s(
104
- q,
106
+ ) : r === "button" ? /* @__PURE__ */ i(
107
+ "div",
108
+ {
109
+ className: n["tab-type-button"],
110
+ onClick: () => h(e),
111
+ children: t
112
+ }
113
+ ) : /* @__PURE__ */ i("div", { className: `${b ? n["selected-text"] : void 0}`, children: /* @__PURE__ */ i(
114
+ B,
105
115
  {
106
116
  size: "s",
107
117
  label: t,
108
118
  mode: r === "text" ? "text" : "ghost",
109
- selected: d,
110
- onClick: () => v(e),
111
- disabled: i
119
+ selected: b,
120
+ onClick: () => h(e),
121
+ disabled: c,
122
+ fullWidth: !0
112
123
  }
113
124
  ) })
114
125
  },
115
126
  e
116
127
  );
117
128
  }) }),
118
- r !== "button" && /* @__PURE__ */ s("div", { className: n.underline, style: A })
129
+ r !== "button" && /* @__PURE__ */ i("div", { className: n.underline, style: H })
119
130
  ]
120
131
  }
121
132
  );
@@ -1 +1 @@
1
- ._tab-container_6o3gh_30{position:relative;line-height:1.25rem}._tab-container-button_6o3gh_34{border-radius:.375rem;border:1px solid var(--tabs-button-border);background:var(--tabs-button-background)}._tab-container-icon_6o3gh_39,._tab-container-text_6o3gh_39{border-bottom:1px solid var(--tabs-line-border)}._tab-items_6o3gh_42{gap:2.25rem;padding:.625rem .125rem}._tab-items-button_6o3gh_46{gap:.25rem;padding:.125rem}._tab-full-width_6o3gh_51{width:100%;display:flex;justify-content:center}._selected-button_6o3gh_57{border:1px solid var(--button-tertiary-default-border);background:var(--tabs-button-background-button);border-radius:.25rem}._selected-text_6o3gh_63>button{font-weight:600!important}._selected-text_6o3gh_63>button:hover{background-color:transparent!important}._underline_6o3gh_70{position:absolute;bottom:0;height:2px;background-color:var(--tabs-cell-active-border);transition:all .3s ease}._flexHorizontal-center_6o3gh_78{display:flex;justify-content:center;align-items:center;flex-direction:row}._flexHorizontal-left_6o3gh_84{display:flex;justify-content:flex-start;align-items:center;flex-direction:row}._flexHorizontal-right_6o3gh_90{display:flex;justify-content:flex-end;align-items:center;flex-direction:row}
1
+ ._tab-container_1rcir_30{position:relative;line-height:1.25rem}._tab-container-button_1rcir_34{border-radius:.375rem;border:1px solid var(--tabs-button-border);background:var(--tabs-button-background)}._tab-container-icon_1rcir_39,._tab-container-text_1rcir_39{border-bottom:1px solid var(--tabs-line-border)}._tab-items_1rcir_42{gap:2.25rem;padding:.625rem .125rem}._tab-items-button_1rcir_46{gap:.25rem;padding:.125rem}._tab-type-button_1rcir_50{padding:.375rem .75rem;display:flex;align-items:center}._tab-full-width_1rcir_56{width:100%;display:flex;justify-content:center}._selected-button_1rcir_62{height:100%;border:1px solid var(--button-tertiary-default-border);background:var(--tabs-button-background-button);border-radius:.25rem}._noSelect-button_1rcir_69{padding:1px 0}._selected-text_1rcir_73>button{height:100%;font-weight:600!important}._selected-text_1rcir_73>button:hover{background-color:transparent!important}._underline_1rcir_81{position:absolute;bottom:0;height:2px;background-color:var(--tabs-cell-active-border);transition:all .3s ease}._flexHorizontal-center_1rcir_89{display:flex;justify-content:center;align-items:center;flex-direction:row}._flexHorizontal-left_1rcir_95{display:flex;justify-content:flex-start;align-items:center;flex-direction:row}._flexHorizontal-right_1rcir_101{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.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",