@situaction/traq-ui-ste 1.2.44 → 1.2.46

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,6 +1,6 @@
1
1
  import { jsxs as s, jsx as o } from "react/jsx-runtime";
2
2
  import { useState as _, useRef as h } from "react";
3
- import { n as v, s as C, a as x } from "../../X.es-BEJ-zMPl.mjs";
3
+ import { n as v, s as C, a as x } from "../../X.es-agKqByBO.mjs";
4
4
  import { Button as M } from "../button/Button.js";
5
5
  import "../icon-button/IconButton.js";
6
6
  import { TagCounter as w } from "../tag-counter/TagCounter.js";
@@ -26,6 +26,8 @@ export interface StepperProps {
26
26
  disabledIds?: string[];
27
27
  /** If false, render only the dots/connectors (no item.content). */
28
28
  showContent?: boolean;
29
+ /** If true, completed dots display a check icon instead of a filled dot. */
30
+ showCompletedCheck?: boolean;
29
31
  /** Optional accessible label for each dot. */
30
32
  getDotAriaLabel?: (item: StepITem, index: number, status: StepStatus) => string;
31
33
  /** Dot button margin-top to align with the content on the right (px or CSS value). */
@@ -1,92 +1,95 @@
1
- import { jsx as _, jsxs as S } from "react/jsx-runtime";
2
- import { useMemo as f, useRef as E, useState as X, useLayoutEffect as Z } from "react";
3
- import '../../styles/Stepper.css';const L = "_wrapper_lh0wd_30", tt = "_steps_lh0wd_35", nt = "_row_lh0wd_42", et = "_connectorAbs_lh0wd_49", ot = "_connectorProgress_lh0wd_59", st = "_connectorGradient_lh0wd_63", rt = "_connectorDefault_lh0wd_68", ct = "_dotButton_lh0wd_74", dt = "_dotButtonDisabled_lh0wd_89", it = "_dotOuter_lh0wd_95", at = "_dotInner_lh0wd_103", lt = "_rowNoContent_lh0wd_165", ut = "_content_lh0wd_170", o = {
4
- wrapper: L,
5
- steps: tt,
6
- row: nt,
7
- connectorAbs: et,
8
- connectorProgress: ot,
9
- connectorGradient: st,
10
- connectorDefault: rt,
11
- dotButton: ct,
12
- dotButtonDisabled: dt,
13
- dotOuter: it,
14
- dotInner: at,
15
- "dotButton--upcoming": "_dotButton--upcoming_lh0wd_108",
16
- "dotButton--active": "_dotButton--active_lh0wd_120",
17
- "dotButton--completed": "_dotButton--completed_lh0wd_142",
18
- "dotButton--disabled": "_dotButton--disabled_lh0wd_153",
19
- rowNoContent: lt,
20
- content: ut
21
- }, pt = (e, d) => {
22
- if (e === d) return !0;
23
- if (e.length !== d.length) return !1;
24
- for (let i = 0; i < e.length; i++) {
25
- const p = e[i], a = d[i];
26
- if (p.key !== a.key || p.leftPx !== a.leftPx || p.topPx !== a.topPx || p.heightPx !== a.heightPx || p.variant !== a.variant)
1
+ import { jsx as _, jsxs as C } from "react/jsx-runtime";
2
+ import { useMemo as h, useRef as E, useState as Z, useLayoutEffect as L } from "react";
3
+ import { s as tt } from "../../CheckCircle.es-ILxE75_k.mjs";
4
+ import '../../styles/Stepper.css';const et = "_wrapper_tr5aw_30", nt = "_steps_tr5aw_35", ot = "_row_tr5aw_42", rt = "_connectorAbs_tr5aw_49", st = "_connectorProgress_tr5aw_59", ct = "_connectorGradient_tr5aw_63", at = "_connectorDefault_tr5aw_68", dt = "_dotButton_tr5aw_74", it = "_dotButtonDisabled_tr5aw_89", ut = "_dotOuter_tr5aw_95", lt = "_dotInner_tr5aw_103", pt = "_rowNoContent_tr5aw_172", _t = "_content_tr5aw_177", n = {
5
+ wrapper: et,
6
+ steps: nt,
7
+ row: ot,
8
+ connectorAbs: rt,
9
+ connectorProgress: st,
10
+ connectorGradient: ct,
11
+ connectorDefault: at,
12
+ dotButton: dt,
13
+ dotButtonDisabled: it,
14
+ dotOuter: ut,
15
+ dotInner: lt,
16
+ "dotButton--upcoming": "_dotButton--upcoming_tr5aw_108",
17
+ "dotButton--active": "_dotButton--active_tr5aw_120",
18
+ "dotButton--completed": "_dotButton--completed_tr5aw_142",
19
+ "dotButton--completedCheck": "_dotButton--completedCheck_tr5aw_153",
20
+ "dotButton--disabled": "_dotButton--disabled_tr5aw_160",
21
+ rowNoContent: pt,
22
+ content: _t
23
+ }, ft = (o, d) => {
24
+ if (o === d) return !0;
25
+ if (o.length !== d.length) return !1;
26
+ for (let i = 0; i < o.length; i++) {
27
+ const p = o[i], u = d[i];
28
+ if (p.key !== u.key || p.leftPx !== u.leftPx || p.topPx !== u.topPx || p.heightPx !== u.heightPx || p.variant !== u.variant)
27
29
  return !1;
28
30
  }
29
31
  return !0;
30
- }, ft = ({
31
- items: e,
32
+ }, Bt = ({
33
+ items: o,
32
34
  onDotClick: d,
33
35
  dotOffsetPx: i = 18,
34
36
  dotsClickable: p = !0,
35
- activeId: a,
37
+ activeId: u,
36
38
  autoStatusFromActive: y = !0,
37
- disabledIds: x = [],
39
+ disabledIds: m = [],
38
40
  showContent: P = !0,
39
- getDotAriaLabel: m,
41
+ showCompletedCheck: N = !1,
42
+ getDotAriaLabel: x,
40
43
  dotButtonMarginTop: I = "10px"
41
44
  }) => {
42
- const C = f(
45
+ const z = h(
43
46
  () => ({ "--flowline-dot-offset": `${i}px` }),
44
47
  [i]
45
- ), Y = f(() => x.join("|"), [x]), g = f(() => {
46
- var u, r;
47
- const t = new Set(x), s = a ?? ((u = e.find((n) => n.status !== "disabled" && !t.has(n.id))) == null ? void 0 : u.id) ?? ((r = e[0]) == null ? void 0 : r.id), l = e.findIndex((n) => n.id === s);
48
- return e.map((n, h) => n.status === "disabled" || t.has(n.id) ? "disabled" : y ? h < l ? "completed" : h === l ? "active" : "upcoming" : n.status ?? "upcoming");
49
- }, [e, a, y, Y]), z = f(() => g.join("|"), [g]), K = f(() => e.map((t) => t.id).join("|"), [e]), N = E(null), B = E(/* @__PURE__ */ new Map()), q = f(() => (t) => (s) => {
50
- B.current.set(t, s);
51
- }, []), [D, k] = X([]);
52
- return Z(() => {
53
- const t = N.current;
48
+ ), Y = h(() => m.join("|"), [m]), g = h(() => {
49
+ var l, c;
50
+ const t = new Set(m), r = u ?? ((l = o.find((e) => e.status !== "disabled" && !t.has(e.id))) == null ? void 0 : l.id) ?? ((c = o[0]) == null ? void 0 : c.id), s = o.findIndex((e) => e.id === r);
51
+ return o.map((e, f) => e.status === "disabled" || t.has(e.id) ? "disabled" : y ? f < s ? "completed" : f === s ? "active" : "upcoming" : e.status ?? "upcoming");
52
+ }, [o, u, y, Y]), k = h(() => g.join("|"), [g]), K = h(() => o.map((t) => t.id).join("|"), [o]), R = E(null), B = E(/* @__PURE__ */ new Map()), q = h(() => (t) => (r) => {
53
+ B.current.set(t, r);
54
+ }, []), [D, F] = Z([]);
55
+ return L(() => {
56
+ const t = R.current;
54
57
  if (!t) return;
55
- let s = null;
56
- const l = () => {
57
- const n = t.getBoundingClientRect(), h = [], v = e.map((c) => c.id);
58
- for (let c = 0; c < v.length - 1; c++) {
59
- const R = v[c], $ = v[c + 1], j = B.current.get(R), A = B.current.get($);
60
- if (!j || !A) continue;
61
- const w = j.getBoundingClientRect(), b = A.getBoundingClientRect(), F = Math.round(w.left + w.width / 2 - n.left), T = w.top + w.height / 2 - n.top, H = b.top + b.height / 2 - n.top, J = w.height / 2, Q = b.height / 2, O = 2, G = Math.round(T + J + O), U = Math.round(H - Q - O), V = Math.max(0, U - G), M = g[c], W = M === "completed" ? "progress" : M === "active" ? "gradient" : "default";
62
- h.push({
63
- key: `${R}__${$}`,
64
- leftPx: F,
65
- topPx: G,
66
- heightPx: V,
67
- variant: W
58
+ let r = null;
59
+ const s = () => {
60
+ const e = t.getBoundingClientRect(), f = [], b = o.map((a) => a.id);
61
+ for (let a = 0; a < b.length - 1; a++) {
62
+ const $ = b[a], j = b[a + 1], A = B.current.get($), O = B.current.get(j);
63
+ if (!A || !O) continue;
64
+ const w = A.getBoundingClientRect(), v = O.getBoundingClientRect(), T = Math.round(w.left + w.width / 2 - e.left), H = w.top + w.height / 2 - e.top, J = v.top + v.height / 2 - e.top, Q = w.height / 2, U = v.height / 2, G = 2, M = Math.round(H + Q + G), V = Math.round(J - U - G), W = Math.max(0, V - M), S = g[a], X = S === "completed" ? "progress" : S === "active" ? "gradient" : "default";
65
+ f.push({
66
+ key: `${$}__${j}`,
67
+ leftPx: T,
68
+ topPx: M,
69
+ heightPx: W,
70
+ variant: X
68
71
  });
69
72
  }
70
- k((c) => pt(c, h) ? c : h);
71
- }, u = () => {
72
- s == null && (s = requestAnimationFrame(() => {
73
- s = null, l();
73
+ F((a) => ft(a, f) ? a : f);
74
+ }, l = () => {
75
+ r == null && (r = requestAnimationFrame(() => {
76
+ r = null, s();
74
77
  }));
75
78
  };
76
- u();
77
- const r = new ResizeObserver(u);
78
- return r.observe(t), B.current.forEach((n) => {
79
- n && r.observe(n);
80
- }), window.addEventListener("resize", u), () => {
81
- s != null && cancelAnimationFrame(s), r.disconnect(), window.removeEventListener("resize", u);
79
+ l();
80
+ const c = new ResizeObserver(l);
81
+ return c.observe(t), B.current.forEach((e) => {
82
+ e && c.observe(e);
83
+ }), window.addEventListener("resize", l), () => {
84
+ r != null && cancelAnimationFrame(r), c.disconnect(), window.removeEventListener("resize", l);
82
85
  };
83
- }, [K, z]), /* @__PURE__ */ _("div", { className: o.wrapper, style: C, children: /* @__PURE__ */ S("div", { ref: N, className: o.steps, children: [
86
+ }, [K, k]), /* @__PURE__ */ _("div", { className: n.wrapper, style: z, children: /* @__PURE__ */ C("div", { ref: R, className: n.steps, children: [
84
87
  D.map((t) => /* @__PURE__ */ _(
85
88
  "span",
86
89
  {
87
90
  className: [
88
- o.connectorAbs,
89
- t.variant === "progress" ? o.connectorProgress : t.variant === "gradient" ? o.connectorGradient : o.connectorDefault
91
+ n.connectorAbs,
92
+ t.variant === "progress" ? n.connectorProgress : t.variant === "gradient" ? n.connectorGradient : n.connectorDefault
90
93
  ].join(" "),
91
94
  style: {
92
95
  left: `${t.leftPx}px`,
@@ -97,14 +100,14 @@ import '../../styles/Stepper.css';const L = "_wrapper_lh0wd_30", tt = "_steps_lh
97
100
  },
98
101
  t.key
99
102
  )),
100
- e.map((t, s) => {
101
- const l = g[s], r = p && !(l === "disabled") && !!d;
102
- return /* @__PURE__ */ S(
103
+ o.map((t, r) => {
104
+ const s = g[r], c = p && !(s === "disabled") && !!d;
105
+ return /* @__PURE__ */ C(
103
106
  "div",
104
107
  {
105
108
  className: [
106
- o.row,
107
- P ? "" : o.rowNoContent
109
+ n.row,
110
+ P ? "" : n.rowNoContent
108
111
  ].filter(Boolean).join(" "),
109
112
  style: { columnGap: `${i}px` },
110
113
  children: [
@@ -113,20 +116,21 @@ import '../../styles/Stepper.css';const L = "_wrapper_lh0wd_30", tt = "_steps_lh
113
116
  {
114
117
  type: "button",
115
118
  className: [
116
- o.dotButton,
117
- o[`dotButton--${l}`],
118
- r ? "" : o.dotButtonDisabled
119
+ n.dotButton,
120
+ n[`dotButton--${s}`],
121
+ s === "completed" && N ? n["dotButton--completedCheck"] : "",
122
+ c ? "" : n.dotButtonDisabled
119
123
  ].filter(Boolean).join(" "),
120
124
  style: { marginTop: I ?? "0" },
121
125
  onClick: () => {
122
- r && (d == null || d(t.id));
126
+ c && (d == null || d(t.id));
123
127
  },
124
- "aria-label": (m == null ? void 0 : m(t, s, l)) ?? `Open step ${t.id}`,
125
- disabled: !r,
126
- children: /* @__PURE__ */ _("span", { ref: q(t.id), className: o.dotOuter, children: /* @__PURE__ */ _("span", { className: o.dotInner }) })
128
+ "aria-label": (x == null ? void 0 : x(t, r, s)) ?? `Open step ${t.id}`,
129
+ disabled: !c,
130
+ children: /* @__PURE__ */ _("span", { ref: q(t.id), className: n.dotOuter, children: s === "completed" && N ? /* @__PURE__ */ _(tt, { size: 14, weight: "bold" }) : /* @__PURE__ */ _("span", { className: n.dotInner }) })
127
131
  }
128
132
  ),
129
- P ? /* @__PURE__ */ _("div", { className: o.content, children: t.content }) : null
133
+ P ? /* @__PURE__ */ _("div", { className: n.content, children: t.content }) : null
130
134
  ]
131
135
  },
132
136
  t.id
@@ -135,5 +139,5 @@ import '../../styles/Stepper.css';const L = "_wrapper_lh0wd_30", tt = "_steps_lh
135
139
  ] }) });
136
140
  };
137
141
  export {
138
- ft as Stepper
142
+ Bt as Stepper
139
143
  };
@@ -236,6 +236,7 @@ export declare const variables_dark: {
236
236
  '--gradient-backgroundcard-100': string;
237
237
  '--gradient-backgroundcard-0': string;
238
238
  '--flow-point-line-active': string;
239
+ '--flow-point-line-active-text': string;
239
240
  '--flow-point-line-inactive': string;
240
241
  '--flow-gradient-light': string;
241
242
  '--flow-gradient-dark': string;
@@ -236,6 +236,7 @@ const r = {
236
236
  "--gradient-backgroundcard-100": "var(--color-light-10)",
237
237
  "--gradient-backgroundcard-0": "var(--color-light-0)",
238
238
  "--flow-point-line-active": "var(--color-light-100)",
239
+ "--flow-point-line-active-text": "var(--color-purple-dark-900)",
239
240
  "--flow-point-line-inactive": "var(--color-light-30)",
240
241
  "--flow-gradient-light": "var(--color-light-20)",
241
242
  "--flow-gradient-dark": "var(--color-light-100)"
@@ -236,6 +236,7 @@ export declare const variables_light: {
236
236
  '--gradient-backgroundcard-100': string;
237
237
  '--gradient-backgroundcard-0': string;
238
238
  '--flow-point-line-active': string;
239
+ '--flow-point-line-active-text': string;
239
240
  '--flow-point-line-inactive': string;
240
241
  '--flow-gradient-light': string;
241
242
  '--flow-gradient-dark': string;
@@ -236,6 +236,7 @@ const r = {
236
236
  "--gradient-backgroundcard-100": "var(--color-sable-trans-20)",
237
237
  "--gradient-backgroundcard-0": "var(--color-sable-trans-0)",
238
238
  "--flow-point-line-active": "var(--color-purple-dark-900)",
239
+ "--flow-point-line-active-text": "var(--color-light-100)",
239
240
  "--flow-point-line-inactive": "var(--color-gray-trans-70)",
240
241
  "--flow-gradient-light": "var(--color-gray-trans-70)",
241
242
  "--flow-gradient-dark": "var(--color-purple-dark-900)"
@@ -1 +1 @@
1
- ._wrapper_lh0wd_30{--stepper-left-col: 20px;--stepper-dot-button: 24px}._steps_lh0wd_35{position:relative;display:flex;flex-direction:column;gap:.625rem}._row_lh0wd_42{display:grid;grid-template-columns:var(--stepper-left-col) 1fr;align-items:start}._connectorAbs_lh0wd_49{position:absolute;width:1px;transform:translate(-50%);border-radius:999px;pointer-events:none;z-index:0}._connectorProgress_lh0wd_59{background:var(--flow-point-line-active)}._connectorGradient_lh0wd_63{background:linear-gradient(to bottom,var(--flow-point-line-active),var(--flow-point-line-inactive))}._connectorDefault_lh0wd_68{background-image:linear-gradient(to bottom,var(--flow-point-line-inactive) 50%,transparent 0);background-size:2px 8px;background-repeat:repeat-y}._dotButton_lh0wd_74{width:var(--stepper-dot-button);height:var(--stepper-dot-button);padding:0;border:0;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer;transform:translateY(var(--stepper-dot-offset-y, 0px));position:relative;z-index:1}._dotButtonDisabled_lh0wd_89{cursor:default;opacity:.5}._dotOuter_lh0wd_95{display:flex;align-items:center;justify-content:center;border-radius:999px;transform:translateY(var(--stepper-dot-offset-y, 0px))}._dotInner_lh0wd_103{border-radius:999px}._dotButton--upcoming_lh0wd_108 ._dotOuter_lh0wd_95{width:10px;height:10px;border:none;background:var(--flow-point-line-inactive)}._dotButton--upcoming_lh0wd_108 ._dotInner_lh0wd_103{display:none}._dotButton--active_lh0wd_120 ._dotOuter_lh0wd_95{width:16px;height:16px;border-radius:999px;border:1px solid var(--flow-point-line-active);background:transparent;padding:1px;box-sizing:border-box;display:flex;align-items:center;justify-content:center}._dotButton--active_lh0wd_120 ._dotInner_lh0wd_103{width:10px;height:10px;border-radius:999px;background:var(--flow-point-line-active);display:block}._dotButton--completed_lh0wd_142 ._dotOuter_lh0wd_95{width:10px;height:10px;background:var(--flow-point-line-active)}._dotButton--completed_lh0wd_142 ._dotInner_lh0wd_103{display:none}._dotButton--disabled_lh0wd_153 ._dotOuter_lh0wd_95{width:10px;height:10px;border:none;background:var(--general-border-window);opacity:.6}._dotButton--disabled_lh0wd_153 ._dotInner_lh0wd_103{display:none}._rowNoContent_lh0wd_165{grid-template-columns:var(--stepper-left-col);column-gap:0}._rowNoContent_lh0wd_165 ._content_lh0wd_170{display:none}
1
+ ._wrapper_tr5aw_30{--stepper-left-col: 20px;--stepper-dot-button: 24px}._steps_tr5aw_35{position:relative;display:flex;flex-direction:column;gap:.625rem}._row_tr5aw_42{display:grid;grid-template-columns:var(--stepper-left-col) 1fr;align-items:start}._connectorAbs_tr5aw_49{position:absolute;width:1px;transform:translate(-50%);border-radius:999px;pointer-events:none;z-index:0}._connectorProgress_tr5aw_59{background:var(--flow-point-line-active)}._connectorGradient_tr5aw_63{background:linear-gradient(to bottom,var(--flow-point-line-active),var(--flow-point-line-inactive))}._connectorDefault_tr5aw_68{background-image:linear-gradient(to bottom,var(--flow-point-line-inactive) 50%,transparent 0);background-size:2px 8px;background-repeat:repeat-y}._dotButton_tr5aw_74{width:var(--stepper-dot-button);height:var(--stepper-dot-button);padding:0;border:0;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer;transform:translateY(var(--stepper-dot-offset-y, 0px));position:relative;z-index:1}._dotButtonDisabled_tr5aw_89{cursor:default;opacity:.5}._dotOuter_tr5aw_95{display:flex;align-items:center;justify-content:center;border-radius:999px;transform:translateY(var(--stepper-dot-offset-y, 0px))}._dotInner_tr5aw_103{border-radius:999px}._dotButton--upcoming_tr5aw_108 ._dotOuter_tr5aw_95{width:10px;height:10px;border:none;background:var(--flow-point-line-inactive)}._dotButton--upcoming_tr5aw_108 ._dotInner_tr5aw_103{display:none}._dotButton--active_tr5aw_120 ._dotOuter_tr5aw_95{width:16px;height:16px;border-radius:999px;border:1px solid var(--flow-point-line-active);background:transparent;padding:1px;box-sizing:border-box;display:flex;align-items:center;justify-content:center}._dotButton--active_tr5aw_120 ._dotInner_tr5aw_103{width:10px;height:10px;border-radius:999px;background:var(--flow-point-line-active);display:block}._dotButton--completed_tr5aw_142 ._dotOuter_tr5aw_95{width:10px;height:10px;background:var(--flow-point-line-active)}._dotButton--completed_tr5aw_142 ._dotInner_tr5aw_103{display:none}._dotButton--completedCheck_tr5aw_153 ._dotOuter_tr5aw_95{width:16px;height:16px;color:var(--flow-point-line-active-text)}._dotButton--disabled_tr5aw_160 ._dotOuter_tr5aw_95{width:10px;height:10px;border:none;background:var(--general-border-window);opacity:.6}._dotButton--disabled_tr5aw_160 ._dotInner_tr5aw_103{display:none}._rowNoContent_tr5aw_172{grid-template-columns:var(--stepper-left-col);column-gap:0}._rowNoContent_tr5aw_172 ._content_tr5aw_177{display:none}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.2.44",
3
+ "version": "1.2.46",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",