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