@situaction/traq-ui-ste 1.2.27 → 1.2.29
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.
|
@@ -27,5 +27,7 @@ export interface ModalProps {
|
|
|
27
27
|
anchorRef?: RefObject<HTMLElement>;
|
|
28
28
|
/** If true, show a background overlay behind the panel */
|
|
29
29
|
overlayBackground?: boolean;
|
|
30
|
+
/** Base z-index for the modal stack */
|
|
31
|
+
zIndex?: number;
|
|
30
32
|
}
|
|
31
33
|
export declare const Modal: import('react').ForwardRefExoticComponent<ModalProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,65 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as D, Fragment as P, jsx as v } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as h, useRef as j, useState as C, useEffect as E, useLayoutEffect as N } from "react";
|
|
3
|
-
import '../../styles/Modal.css';const
|
|
4
|
-
overlay:
|
|
5
|
-
overlayBackground:
|
|
6
|
-
modalContent:
|
|
7
|
-
centered:
|
|
8
|
-
},
|
|
3
|
+
import '../../styles/Modal.css';const Z = "_overlay_1hu8i_1", z = "_overlayBackground_1hu8i_11", F = "_modalContent_1hu8i_15", I = "_centered_1hu8i_22", f = {
|
|
4
|
+
overlay: Z,
|
|
5
|
+
overlayBackground: z,
|
|
6
|
+
modalContent: F,
|
|
7
|
+
centered: I
|
|
8
|
+
}, S = h(
|
|
9
9
|
({
|
|
10
10
|
open: t,
|
|
11
11
|
onClose: d,
|
|
12
|
-
children:
|
|
13
|
-
position:
|
|
14
|
-
centered:
|
|
12
|
+
children: y,
|
|
13
|
+
position: e,
|
|
14
|
+
centered: a = !1,
|
|
15
15
|
className: _,
|
|
16
|
-
disableOverlay:
|
|
16
|
+
disableOverlay: m = !1,
|
|
17
17
|
autoCloseCondition: u,
|
|
18
|
-
anchorRef:
|
|
19
|
-
overlayBackground:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
anchorRef: c,
|
|
19
|
+
overlayBackground: w = !1,
|
|
20
|
+
zIndex: g = 11
|
|
21
|
+
}, $) => {
|
|
22
|
+
const k = j(null), x = $ || k, [r, B] = C();
|
|
23
|
+
if (E(() => {
|
|
23
24
|
!u && u !== void 0 && t && d();
|
|
24
25
|
}, [u, t, d]), N(() => {
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
top: `${
|
|
29
|
-
left: `${
|
|
26
|
+
if (c != null && c.current && t && !e && !a) {
|
|
27
|
+
const l = c.current.getBoundingClientRect();
|
|
28
|
+
B({
|
|
29
|
+
top: `${l.bottom + window.scrollY}px`,
|
|
30
|
+
left: `${l.left + window.scrollX}px`
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
|
-
}, [
|
|
33
|
-
|
|
33
|
+
}, [c, t, e, a]), !t) return null;
|
|
34
|
+
const b = g, n = g + 1;
|
|
35
|
+
return /* @__PURE__ */ D(P, { children: [
|
|
36
|
+
!m && /* @__PURE__ */ v(
|
|
34
37
|
"div",
|
|
35
38
|
{
|
|
36
|
-
className: `${
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
className: `${f.overlay} ${w ? f.overlayBackground : ""}`,
|
|
40
|
+
style: { zIndex: b },
|
|
41
|
+
onPointerDown: (l) => {
|
|
42
|
+
l.preventDefault(), l.stopPropagation(), d();
|
|
43
|
+
},
|
|
44
|
+
onClick: (l) => {
|
|
45
|
+
l.preventDefault(), l.stopPropagation();
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
),
|
|
42
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ v(
|
|
43
50
|
"div",
|
|
44
51
|
{
|
|
45
|
-
ref:
|
|
46
|
-
className: `${
|
|
52
|
+
ref: x,
|
|
53
|
+
className: `${f.modalContent} ${_ || ""} ${a ? f.centered : ""}`,
|
|
47
54
|
style: {
|
|
55
|
+
zIndex: n,
|
|
48
56
|
position: "absolute",
|
|
49
|
-
top:
|
|
50
|
-
left:
|
|
51
|
-
right:
|
|
52
|
-
bottom:
|
|
53
|
-
width:
|
|
54
|
-
transform:
|
|
57
|
+
top: a ? "50%" : (e == null ? void 0 : e.top) ?? (r == null ? void 0 : r.top),
|
|
58
|
+
left: a ? "50%" : (e == null ? void 0 : e.left) ?? (r == null ? void 0 : r.left),
|
|
59
|
+
right: e == null ? void 0 : e.right,
|
|
60
|
+
bottom: e == null ? void 0 : e.bottom,
|
|
61
|
+
width: e == null ? void 0 : e.width,
|
|
62
|
+
transform: a || !(e != null && e.top) && !(e != null && e.left) && !r ? "translate(-50%, -50%)" : void 0
|
|
55
63
|
},
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
role: "dialog",
|
|
65
|
+
"aria-modal": !m,
|
|
66
|
+
onPointerDown: (l) => l.stopPropagation(),
|
|
67
|
+
onClick: (l) => l.stopPropagation(),
|
|
68
|
+
children: y
|
|
58
69
|
}
|
|
59
70
|
)
|
|
60
|
-
] })
|
|
71
|
+
] });
|
|
61
72
|
}
|
|
62
73
|
);
|
|
63
74
|
export {
|
|
64
|
-
|
|
75
|
+
S as Modal
|
|
65
76
|
};
|
|
@@ -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
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import '../../styles/Stepper.css';const
|
|
4
|
-
wrapper:
|
|
5
|
-
steps:
|
|
6
|
-
row:
|
|
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:
|
|
9
|
-
connectorGradient:
|
|
8
|
+
connectorProgress: ot,
|
|
9
|
+
connectorGradient: st,
|
|
10
10
|
connectorDefault: rt,
|
|
11
|
-
dotButton:
|
|
12
|
-
dotButtonDisabled:
|
|
13
|
-
dotOuter:
|
|
14
|
-
dotInner:
|
|
15
|
-
"dotButton--upcoming": "_dotButton--
|
|
16
|
-
"dotButton--active": "_dotButton--
|
|
17
|
-
"dotButton--completed": "_dotButton--
|
|
18
|
-
"dotButton--disabled": "_dotButton--
|
|
19
|
-
rowNoContent:
|
|
20
|
-
content:
|
|
21
|
-
},
|
|
22
|
-
if (
|
|
23
|
-
if (
|
|
24
|
-
for (let
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
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
|
-
},
|
|
31
|
-
items:
|
|
30
|
+
}, ft = ({
|
|
31
|
+
items: e,
|
|
32
32
|
onDotClick: d,
|
|
33
|
-
dotOffsetPx:
|
|
34
|
-
dotsClickable:
|
|
35
|
-
activeId:
|
|
36
|
-
autoStatusFromActive:
|
|
37
|
-
disabledIds:
|
|
38
|
-
showContent:
|
|
39
|
-
getDotAriaLabel:
|
|
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
|
|
42
|
-
() => ({ "--flowline-dot-offset": `${
|
|
43
|
-
[
|
|
44
|
-
),
|
|
45
|
-
var
|
|
46
|
-
const t = new Set(
|
|
47
|
-
return
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
}, []), [
|
|
51
|
-
return
|
|
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
|
|
55
|
-
const
|
|
56
|
-
const
|
|
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],
|
|
59
|
-
if (!
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
key: `${R}__${
|
|
63
|
-
leftPx:
|
|
64
|
-
topPx:
|
|
65
|
-
heightPx:
|
|
66
|
-
variant:
|
|
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
|
-
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
k((c) => pt(c, h) ? c : h);
|
|
71
|
+
}, u = () => {
|
|
72
|
+
s == null && (s = requestAnimationFrame(() => {
|
|
73
|
+
s = null, l();
|
|
73
74
|
}));
|
|
74
75
|
};
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
}), window.addEventListener("resize",
|
|
80
|
-
|
|
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
|
-
}, [
|
|
83
|
-
|
|
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
|
-
|
|
100
|
-
const
|
|
101
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
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--${
|
|
116
|
-
|
|
117
|
+
o[`dotButton--${l}`],
|
|
118
|
+
r ? "" : o.dotButtonDisabled
|
|
117
119
|
].filter(Boolean).join(" "),
|
|
120
|
+
style: { marginTop: I ?? "0" },
|
|
118
121
|
onClick: () => {
|
|
119
|
-
|
|
122
|
+
r && (d == null || d(t.id));
|
|
120
123
|
},
|
|
121
|
-
"aria-label": (
|
|
122
|
-
disabled: !
|
|
123
|
-
children: /* @__PURE__ */ _("span", { ref:
|
|
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
|
-
|
|
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
|
-
|
|
138
|
+
ft as Stepper
|
|
136
139
|
};
|
package/dist/styles/Stepper.css
CHANGED
|
@@ -1 +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}
|