@situaction/traq-ui-ste 1.2.27 → 1.2.28

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.
@@ -28,6 +28,8 @@ export interface StepperProps {
28
28
  showContent?: boolean;
29
29
  /** Optional accessible label for each dot. */
30
30
  getDotAriaLabel?: (item: StepITem, index: number, status: StepStatus) => string;
31
+ /** Dot button margin-top to align with the content on the right (px or CSS value). */
32
+ dotButtonMarginTop?: string;
31
33
  }
32
34
  /** Stepper layout: dots + absolute connectors between each dot */
33
35
  export declare const Stepper: FC<StepperProps>;
@@ -1,86 +1,87 @@
1
- import { jsx as _, jsxs as E } from "react/jsx-runtime";
2
- import { useMemo as h, useRef as G, useState as W, useLayoutEffect as X } from "react";
3
- import '../../styles/Stepper.css';const Z = "_wrapper_1fl3r_30", L = "_steps_1fl3r_35", tt = "_row_1fl3r_42", et = "_connectorAbs_1fl3r_50", nt = "_connectorProgress_1fl3r_60", ot = "_connectorGradient_1fl3r_64", rt = "_connectorDefault_1fl3r_69", st = "_dotButton_1fl3r_75", ct = "_dotButtonDisabled_1fl3r_90", dt = "_dotOuter_1fl3r_96", it = "_dotInner_1fl3r_103", at = "_rowNoContent_1fl3r_165", lt = "_content_1fl3r_170", o = {
4
- wrapper: Z,
5
- steps: L,
6
- row: tt,
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
7
  connectorAbs: et,
8
- connectorProgress: nt,
9
- connectorGradient: ot,
8
+ connectorProgress: ot,
9
+ connectorGradient: st,
10
10
  connectorDefault: rt,
11
- dotButton: st,
12
- dotButtonDisabled: ct,
13
- dotOuter: dt,
14
- dotInner: it,
15
- "dotButton--upcoming": "_dotButton--upcoming_1fl3r_108",
16
- "dotButton--active": "_dotButton--active_1fl3r_120",
17
- "dotButton--completed": "_dotButton--completed_1fl3r_142",
18
- "dotButton--disabled": "_dotButton--disabled_1fl3r_153",
19
- rowNoContent: at,
20
- content: lt
21
- }, ut = (n, d) => {
22
- if (n === d) return !0;
23
- if (n.length !== d.length) return !1;
24
- for (let u = 0; u < n.length; u++) {
25
- const f = n[u], i = d[u];
26
- if (f.key !== i.key || f.leftPx !== i.leftPx || f.topPx !== i.topPx || f.heightPx !== i.heightPx || f.variant !== i.variant)
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)
27
27
  return !1;
28
28
  }
29
29
  return !0;
30
- }, _t = ({
31
- items: n,
30
+ }, ft = ({
31
+ items: e,
32
32
  onDotClick: d,
33
- dotOffsetPx: u = 18,
34
- dotsClickable: f = !0,
35
- activeId: i,
36
- autoStatusFromActive: P = !0,
37
- disabledIds: m = [],
38
- showContent: y = !0,
39
- getDotAriaLabel: w
33
+ dotOffsetPx: i = 18,
34
+ dotsClickable: p = !0,
35
+ activeId: a,
36
+ autoStatusFromActive: y = !0,
37
+ disabledIds: x = [],
38
+ showContent: P = !0,
39
+ getDotAriaLabel: m,
40
+ dotButtonMarginTop: I = "10px"
40
41
  }) => {
41
- const I = h(
42
- () => ({ "--flowline-dot-offset": `${u}px` }),
43
- [u]
44
- ), C = h(() => m.join("|"), [m]), B = h(() => {
45
- var l, s;
46
- const t = new Set(m), r = i ?? ((l = n.find((e) => e.status !== "disabled" && !t.has(e.id))) == null ? void 0 : l.id) ?? ((s = n[0]) == null ? void 0 : s.id), a = n.findIndex((e) => e.id === r);
47
- return n.map((e, p) => e.status === "disabled" || t.has(e.id) ? "disabled" : P ? p < a ? "completed" : p === a ? "active" : "upcoming" : e.status ?? "upcoming");
48
- }, [n, i, P, C]), Y = h(() => B.join("|"), [B]), z = h(() => n.map((t) => t.id).join("|"), [n]), N = G(null), x = G(/* @__PURE__ */ new Map()), K = h(() => (t) => (r) => {
49
- x.current.set(t, r);
50
- }, []), [q, D] = W([]);
51
- return X(() => {
42
+ const C = f(
43
+ () => ({ "--flowline-dot-offset": `${i}px` }),
44
+ [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(() => {
52
53
  const t = N.current;
53
54
  if (!t) return;
54
- let r = null;
55
- const a = () => {
56
- const e = t.getBoundingClientRect(), p = [], v = n.map((c) => c.id);
55
+ let s = null;
56
+ const l = () => {
57
+ const n = t.getBoundingClientRect(), h = [], v = e.map((c) => c.id);
57
58
  for (let c = 0; c < v.length - 1; c++) {
58
- const R = v[c], j = v[c + 1], O = x.current.get(R), $ = x.current.get(j);
59
- if (!O || !$) continue;
60
- const g = O.getBoundingClientRect(), b = $.getBoundingClientRect(), k = Math.round(g.left + g.width / 2 - e.left), F = g.top + g.height / 2 - e.top, H = b.top + b.height / 2 - e.top, J = g.height / 2, Q = b.height / 2, A = 2, M = Math.round(F + J + A), T = Math.round(H - Q - A), U = Math.max(0, T - M), S = B[c], V = S === "completed" ? "progress" : S === "active" ? "gradient" : "default";
61
- p.push({
62
- key: `${R}__${j}`,
63
- leftPx: k,
64
- topPx: M,
65
- heightPx: U,
66
- variant: V
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
67
68
  });
68
69
  }
69
- D((c) => ut(c, p) ? c : p);
70
- }, l = () => {
71
- r == null && (r = requestAnimationFrame(() => {
72
- r = null, a();
70
+ k((c) => pt(c, h) ? c : h);
71
+ }, u = () => {
72
+ s == null && (s = requestAnimationFrame(() => {
73
+ s = null, l();
73
74
  }));
74
75
  };
75
- l();
76
- const s = new ResizeObserver(l);
77
- return s.observe(t), x.current.forEach((e) => {
78
- e && s.observe(e);
79
- }), window.addEventListener("resize", l), () => {
80
- r != null && cancelAnimationFrame(r), s.disconnect(), window.removeEventListener("resize", l);
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);
81
82
  };
82
- }, [z, Y]), /* @__PURE__ */ _("div", { className: o.wrapper, style: I, children: /* @__PURE__ */ E("div", { ref: N, className: o.steps, children: [
83
- q.map((t) => /* @__PURE__ */ _(
83
+ }, [K, z]), /* @__PURE__ */ _("div", { className: o.wrapper, style: C, children: /* @__PURE__ */ S("div", { ref: N, className: o.steps, children: [
84
+ D.map((t) => /* @__PURE__ */ _(
84
85
  "span",
85
86
  {
86
87
  className: [
@@ -96,15 +97,16 @@ import '../../styles/Stepper.css';const Z = "_wrapper_1fl3r_30", L = "_steps_1fl
96
97
  },
97
98
  t.key
98
99
  )),
99
- n.map((t, r) => {
100
- const a = B[r], s = f && !(a === "disabled") && !!d;
101
- return /* @__PURE__ */ E(
100
+ e.map((t, s) => {
101
+ const l = g[s], r = p && !(l === "disabled") && !!d;
102
+ return /* @__PURE__ */ S(
102
103
  "div",
103
104
  {
104
105
  className: [
105
106
  o.row,
106
- y ? "" : o.rowNoContent
107
+ P ? "" : o.rowNoContent
107
108
  ].filter(Boolean).join(" "),
109
+ style: { columnGap: `${i}px` },
108
110
  children: [
109
111
  /* @__PURE__ */ _(
110
112
  "button",
@@ -112,18 +114,19 @@ import '../../styles/Stepper.css';const Z = "_wrapper_1fl3r_30", L = "_steps_1fl
112
114
  type: "button",
113
115
  className: [
114
116
  o.dotButton,
115
- o[`dotButton--${a}`],
116
- s ? "" : o.dotButtonDisabled
117
+ o[`dotButton--${l}`],
118
+ r ? "" : o.dotButtonDisabled
117
119
  ].filter(Boolean).join(" "),
120
+ style: { marginTop: I ?? "0" },
118
121
  onClick: () => {
119
- s && (d == null || d(t.id));
122
+ r && (d == null || d(t.id));
120
123
  },
121
- "aria-label": (w == null ? void 0 : w(t, r, a)) ?? `Open step ${t.id}`,
122
- disabled: !s,
123
- children: /* @__PURE__ */ _("span", { ref: K(t.id), className: o.dotOuter, children: /* @__PURE__ */ _("span", { className: o.dotInner }) })
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 }) })
124
127
  }
125
128
  ),
126
- y ? /* @__PURE__ */ _("div", { className: o.content, children: t.content }) : null
129
+ P ? /* @__PURE__ */ _("div", { className: o.content, children: t.content }) : null
127
130
  ]
128
131
  },
129
132
  t.id
@@ -132,5 +135,5 @@ import '../../styles/Stepper.css';const Z = "_wrapper_1fl3r_30", L = "_steps_1fl
132
135
  ] }) });
133
136
  };
134
137
  export {
135
- _t as Stepper
138
+ ft as Stepper
136
139
  };
@@ -1 +1 @@
1
- ._wrapper_1fl3r_30{--stepper-left-col: 20px;--stepper-dot-button: 24px}._steps_1fl3r_35{position:relative;display:flex;flex-direction:column;gap:var(--spacing-xs-3)}._row_1fl3r_42{display:grid;grid-template-columns:var(--stepper-left-col) 1fr;column-gap:var(--spacing-xs-3);align-items:start}._connectorAbs_1fl3r_50{position:absolute;width:1px;transform:translate(-50%);border-radius:999px;pointer-events:none;z-index:0}._connectorProgress_1fl3r_60{background:var(--flow-point-line-active)}._connectorGradient_1fl3r_64{background:linear-gradient(to bottom,var(--flow-point-line-active),var(--flow-point-line-inactive))}._connectorDefault_1fl3r_69{background-image:linear-gradient(to bottom,var(--flow-point-line-inactive) 50%,transparent 0);background-size:2px 8px;background-repeat:repeat-y}._dotButton_1fl3r_75{margin-top:.625rem;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;position:relative;z-index:1}._dotButtonDisabled_1fl3r_90{cursor:default;opacity:.5}._dotOuter_1fl3r_96{display:flex;align-items:center;justify-content:center;border-radius:999px}._dotInner_1fl3r_103{border-radius:999px}._dotButton--upcoming_1fl3r_108 ._dotOuter_1fl3r_96{width:10px;height:10px;border:none;background:var(--flow-point-line-inactive)}._dotButton--upcoming_1fl3r_108 ._dotInner_1fl3r_103{display:none}._dotButton--active_1fl3r_120 ._dotOuter_1fl3r_96{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_1fl3r_120 ._dotInner_1fl3r_103{width:10px;height:10px;border-radius:999px;background:var(--flow-point-line-active);display:block}._dotButton--completed_1fl3r_142 ._dotOuter_1fl3r_96{width:10px;height:10px;background:var(--flow-point-line-active)}._dotButton--completed_1fl3r_142 ._dotInner_1fl3r_103{display:none}._dotButton--disabled_1fl3r_153 ._dotOuter_1fl3r_96{width:10px;height:10px;border:none;background:var(--general-border-window);opacity:.6}._dotButton--disabled_1fl3r_153 ._dotInner_1fl3r_103{display:none}._rowNoContent_1fl3r_165{grid-template-columns:var(--stepper-left-col);column-gap:0}._rowNoContent_1fl3r_165 ._content_1fl3r_170{display:none}
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.2.27",
3
+ "version": "1.2.28",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",