@stackone/malachite 2.135.0 → 2.137.0

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,196 +1,193 @@
1
- import { jsxs as s, Fragment as F, jsx as a } from "react/jsx-runtime";
2
- import O, { useRef as E } from "react";
3
- import D from "./CustomIcons/CheckmarkIcon.js";
1
+ import { jsxs as c, Fragment as j, jsx as o } from "react/jsx-runtime";
2
+ import B, { useRef as z } from "react";
3
+ import $ from "./CustomIcons/CheckmarkIcon.js";
4
4
  import f from "./Typography/Text.js";
5
- import { isFocusDropped as j, focusSection as B, holdsFocus as U } from "./collapseFocus.js";
6
- import { isRenderableNode as b } from "./renderableNode.js";
7
- const i = 24, I = 1, G = {
8
- medium: { padding: { x: 28, y: 16 }, title: "medium", description: "small", childrenGap: 10 },
9
- small: { padding: { x: 20, y: 12 }, title: "small", description: "xsmall", childrenGap: 6 }
10
- }, H = {
5
+ import { isFocusDropped as G, focusSection as U, holdsFocus as H } from "./collapseFocus.js";
6
+ import { isRenderableNode as g } from "./renderableNode.js";
7
+ const s = 24, I = 1, W = {
8
+ medium: { padding: { x: 28, y: 16 }, title: "medium", description: "small", childrenGap: 12 },
9
+ small: { padding: { x: 20, y: 12 }, title: "small", description: "xsmall", childrenGap: 8 }
10
+ }, K = {
11
11
  complete: "Completed",
12
12
  open: void 0,
13
13
  locked: "Locked"
14
- }, W = (t, r) => ({
15
- insetInlineStart: t.x + i / 2 - 1,
16
- top: t.y + i,
17
- height: `calc(100% - ${i - (r ? I : 0)}px)`
18
- }), z = "var(--malachite-card-border, rgb(232, 232, 232))", T = "var(--malachite-accent-background, rgb(0, 175, 102))", K = "var(--malachite-accent-foreground, rgb(2, 122, 66))", g = "var(--malachite-text-secondary, rgb(123, 123, 123))", Z = "var(--malachite-text-dimmed, rgb(161, 161, 161))", A = 0.4, P = (t) => `repeating-linear-gradient(to bottom, ${t} 0px, ${t} 4px, transparent 4px, transparent 8px)`, V = {
14
+ }, Z = (t, r) => ({
15
+ insetInlineStart: t.x + s / 2 - 1,
16
+ top: t.y + s,
17
+ height: `calc(100% - ${s - (r ? I : 0)}px)`
18
+ }), A = "var(--malachite-card-border, rgb(232, 232, 232))", T = "var(--malachite-accent-background, rgb(0, 175, 102))", P = "var(--malachite-accent-foreground, rgb(2, 122, 66))", b = "var(--malachite-text-secondary, rgb(123, 123, 123))", V = "var(--malachite-text-dimmed, rgb(161, 161, 161))", D = 0.4, Y = (t) => `repeating-linear-gradient(to bottom, ${t} 0px, ${t} 4px, transparent 4px, transparent 8px)`, q = {
19
19
  complete: "bg-[var(--malachite-accent-background,rgb(0,175,102))] text-white",
20
20
  open: "border-[1.5px] border-solid border-[var(--malachite-accent-background,rgb(0,175,102))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-accent-foreground,rgb(2,122,66))]",
21
21
  locked: "border-[1.5px] border-solid border-[var(--malachite-text-dimmed,rgb(153,153,153))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-text-dimmed,rgb(153,153,153))]"
22
- }, Y = ({
22
+ }, J = ({
23
23
  status: t,
24
24
  color: r,
25
- opacity: o
26
- }) => /* @__PURE__ */ s(
25
+ opacity: a
26
+ }) => /* @__PURE__ */ c(
27
27
  "span",
28
28
  {
29
29
  "aria-hidden": "true",
30
- className: "relative z-[2] box-border flex shrink-0 items-center justify-center rounded-full border-[1.5px] border-solid bg-[var(--malachite-card-background,rgb(255,255,255))]",
31
- style: { width: i, height: i, borderColor: r, color: r, opacity: o },
30
+ className: "relative z-[2] box-border flex items-center justify-center rounded-full border-[1.5px] border-solid bg-[var(--malachite-card-background,rgb(255,255,255))]",
31
+ style: { width: s, height: s, borderColor: r, color: r, opacity: a },
32
32
  children: [
33
- t === "complete" && /* @__PURE__ */ a(D, { size: 12 }),
34
- t === "open" && /* @__PURE__ */ a("span", { className: "size-[10px] rounded-[3px]", style: { background: r } })
33
+ t === "complete" && /* @__PURE__ */ o($, { size: 12 }),
34
+ t === "open" && /* @__PURE__ */ o("span", { className: "size-[10px] rounded-[3px]", style: { background: r } })
35
35
  ]
36
36
  }
37
- ), q = (t, r) => r ? T : t === "locked" ? Z : g, J = (t) => Array.from(t.children).find(
38
- (r) => r instanceof HTMLElement && U(r, t.getRootNode())
37
+ ), Q = (t, r) => r ? T : t === "locked" ? V : b, X = (t) => Array.from(t.children).find(
38
+ (r) => r instanceof HTMLElement && H(r, t.getRootNode())
39
39
  );
40
- class Q extends O.Component {
40
+ class ee extends B.Component {
41
41
  getSnapshotBeforeUpdate() {
42
- const r = this.props.listRef.current, o = r ? J(r) : void 0;
43
- return o ? { row: o, wasCurrent: o === this.props.currentRef.current } : null;
42
+ const r = this.props.listRef.current, a = r ? X(r) : void 0;
43
+ return a ? { row: a, wasCurrent: a === this.props.currentRef.current } : null;
44
44
  }
45
- componentDidUpdate(r, o, l) {
46
- if (!l || !j(l.row.ownerDocument))
45
+ componentDidUpdate(r, a, d) {
46
+ if (!d || !G(d.row.ownerDocument))
47
47
  return;
48
- const { row: u, wasCurrent: x } = l, h = this.props.currentRef.current, n = [...x ? [h, u] : [u, h], this.props.listRef.current].find(
49
- (d) => d == null ? void 0 : d.isConnected
48
+ const { row: p, wasCurrent: x } = d, h = this.props.currentRef.current, n = [...x ? [h, p] : [p, h], this.props.listRef.current].find(
49
+ (m) => m == null ? void 0 : m.isConnected
50
50
  );
51
- B(null, n ?? null, { preventScroll: !1 });
51
+ U(null, n ?? null, { preventScroll: !1 });
52
52
  }
53
53
  render() {
54
54
  return null;
55
55
  }
56
56
  }
57
- const X = (t, r) => t.key ?? `#${r}`, ce = ({
57
+ const te = (t, r) => t.key ?? `#${r}`, le = ({
58
58
  steps: t,
59
59
  size: r = "medium",
60
- variant: o = "numbered",
61
- dividers: l = !1,
62
- completeLabel: u,
60
+ variant: a = "numbered",
61
+ dividers: d = !1,
62
+ completeLabel: p,
63
63
  "aria-label": x,
64
64
  "aria-labelledby": h,
65
- className: v = ""
65
+ className: k = ""
66
66
  }) => {
67
- const n = G[r], d = E(null), k = E(null), R = t.findIndex((e) => e.status === "open"), c = o === "focused", N = c && R !== -1, _ = c ? g : z, $ = c ? g : T, C = (e) => !!u && e.status === "complete" && !b(e.action), L = /* @__PURE__ */ s("span", { "aria-hidden": "true", className: "flex items-center gap-[6px]", children: [
68
- /* @__PURE__ */ a("span", { className: "size-[8px] shrink-0 rounded-full bg-[var(--malachite-text-success,rgb(2,122,66))]" }),
69
- /* @__PURE__ */ a(f, { size: "small", fontWeight: "semi-bold", color: "success", children: u })
70
- ] }), M = t.some(
71
- (e) => b(e.action) || C(e)
72
- );
73
- return /* @__PURE__ */ s(F, { children: [
74
- /* @__PURE__ */ a(
67
+ const n = W[r], m = z(null), R = z(null), C = t.findIndex((e) => e.status === "open"), i = a === "focused", N = i && C !== -1, _ = i ? b : A, L = i ? b : T, v = (e) => !!p && e.status === "complete" && !g(e.action), F = /* @__PURE__ */ c("span", { "aria-hidden": "true", className: "flex items-center gap-[6px]", children: [
68
+ /* @__PURE__ */ o("span", { className: "size-[8px] shrink-0 rounded-full bg-[var(--malachite-text-success,rgb(2,122,66))]" }),
69
+ /* @__PURE__ */ o(f, { size: "small", fontWeight: "semi-bold", color: "success", children: p })
70
+ ] }), M = (e, l) => e.status === "complete" && !v(e) ? void 0 : l, S = t.some(
71
+ (e) => g(e.action) || v(e)
72
+ ), O = `${s}px minmax(0, 1fr)${S ? " auto" : ""}`;
73
+ return /* @__PURE__ */ c(j, { children: [
74
+ /* @__PURE__ */ o(
75
75
  "ol",
76
76
  {
77
- ref: d,
77
+ ref: m,
78
78
  role: "list",
79
79
  "aria-label": x,
80
80
  "aria-labelledby": h,
81
- className: `isolate m-0 list-none p-0 ${v}`,
82
- children: t.map((e, p) => {
83
- const m = p === R, S = !c && e.status === "locked", w = H[e.status], y = c && (N && !m || e.status === "locked") ? A : void 0;
84
- return /* @__PURE__ */ s(
81
+ className: `isolate m-0 list-none p-0 ${k}`,
82
+ children: t.map((e, l) => {
83
+ const u = l === C, w = !i && e.status === "locked", E = K[e.status], y = i && (N && !u || e.status === "locked") ? D : void 0;
84
+ return /* @__PURE__ */ c(
85
85
  "li",
86
86
  {
87
- ref: m ? k : void 0,
88
- "aria-current": m ? "step" : void 0,
87
+ ref: u ? R : void 0,
88
+ "aria-current": u ? "step" : void 0,
89
89
  style: {
90
90
  padding: `${n.padding.y}px ${n.padding.x}px`,
91
- borderBottom: l ? `${I}px solid ${z}` : void 0
91
+ borderBottom: d ? `${I}px solid ${A}` : void 0,
92
+ gridTemplateColumns: O,
93
+ rowGap: n.childrenGap
92
94
  },
93
- className: "relative flex items-start gap-[12px]",
95
+ className: "relative grid items-start gap-x-[12px]",
94
96
  children: [
95
- p < t.length - 1 && /* @__PURE__ */ a(
97
+ l < t.length - 1 && /* @__PURE__ */ o(
96
98
  "span",
97
99
  {
98
100
  "aria-hidden": "true",
99
101
  className: "absolute z-[1] w-[2px]",
100
102
  style: {
101
- ...W(n.padding, l),
102
- background: e.status === "complete" ? $ : P(_),
103
- opacity: N ? A : void 0
103
+ ...Z(n.padding, d),
104
+ background: e.status === "complete" ? L : Y(_),
105
+ opacity: N ? D : void 0
104
106
  }
105
107
  }
106
108
  ),
107
- c ? /* @__PURE__ */ a(
108
- Y,
109
+ i ? /* @__PURE__ */ o(
110
+ J,
109
111
  {
110
112
  status: e.status,
111
- color: q(e.status, m),
113
+ color: Q(e.status, u),
112
114
  opacity: y
113
115
  }
114
- ) : /* @__PURE__ */ a(
116
+ ) : /* @__PURE__ */ o(
115
117
  "span",
116
118
  {
117
119
  "aria-hidden": "true",
118
- className: `relative z-[2] box-border flex shrink-0 items-center justify-center rounded-full text-[length:var(--malachite-font-size-xsmall,11px)] [font-weight:600] ${V[e.status]}`,
119
- style: { width: i, height: i },
120
- children: e.status === "complete" ? /* @__PURE__ */ a(D, { size: 12 }) : p + 1
120
+ className: `relative z-[2] box-border flex items-center justify-center rounded-full text-[length:var(--malachite-font-size-xsmall,11px)] [font-weight:600] ${q[e.status]}`,
121
+ style: { width: s, height: s },
122
+ children: e.status === "complete" ? /* @__PURE__ */ o($, { size: 12 }) : l + 1
121
123
  }
122
124
  ),
123
- /* @__PURE__ */ s(
125
+ /* @__PURE__ */ c(
124
126
  "div",
125
127
  {
126
- className: "flex min-w-0 flex-1 flex-col gap-[2px] pt-[2px]",
128
+ className: "flex min-w-0 flex-col gap-[2px] pt-[2px]",
127
129
  style: { opacity: y },
128
130
  children: [
129
- c && /* @__PURE__ */ a(
131
+ i && /* @__PURE__ */ o(
130
132
  "div",
131
133
  {
132
134
  "aria-hidden": "true",
133
- style: { color: m ? K : g },
134
- children: /* @__PURE__ */ s(f, { size: "xsmall", fontWeight: "semi-bold", color: "inherit", children: [
135
+ style: { color: u ? P : b },
136
+ children: /* @__PURE__ */ c(f, { size: "xsmall", fontWeight: "semi-bold", color: "inherit", children: [
135
137
  "Step ",
136
- p + 1
138
+ l + 1
137
139
  ] })
138
140
  }
139
141
  ),
140
- /* @__PURE__ */ s(
142
+ /* @__PURE__ */ c(
141
143
  f,
142
144
  {
143
145
  size: n.title,
144
146
  fontWeight: "semi-bold",
145
- color: S ? "dimmed" : "primary",
147
+ color: w ? "dimmed" : "primary",
146
148
  children: [
147
149
  e.title,
148
- w && /* @__PURE__ */ s("span", { className: "sr-only", children: [
150
+ E && /* @__PURE__ */ c("span", { className: "sr-only", children: [
149
151
  ", ",
150
- w
152
+ E
151
153
  ] })
152
154
  ]
153
155
  }
154
156
  ),
155
- b(e.description) && /* @__PURE__ */ a(
157
+ g(e.description) && /* @__PURE__ */ o(
156
158
  f,
157
159
  {
158
160
  size: n.description,
159
- color: S ? "dimmed" : "secondary",
161
+ color: w ? "dimmed" : "secondary",
160
162
  children: e.description
161
163
  }
162
- ),
163
- m && b(e.children) && /* @__PURE__ */ a(
164
- "div",
165
- {
166
- className: "min-w-0",
167
- style: { marginTop: n.childrenGap },
168
- children: e.children
169
- }
170
164
  )
171
165
  ]
172
166
  }
173
167
  ),
174
- M && /* @__PURE__ */ a(
168
+ S && /* @__PURE__ */ o(
175
169
  "span",
176
170
  {
177
171
  className: "ml-[16px] flex min-w-[120px] items-center justify-end",
178
- style: { opacity: y },
179
- children: C(e) ? L : e.action
172
+ style: {
173
+ opacity: M(e, y)
174
+ },
175
+ children: v(e) ? F : e.action
180
176
  }
181
- )
177
+ ),
178
+ u && g(e.children) && /* @__PURE__ */ o("div", { className: "min-w-0", style: { gridColumn: "2 / -1" }, children: e.children })
182
179
  ]
183
180
  },
184
- X(e, p)
181
+ te(e, l)
185
182
  );
186
183
  })
187
184
  }
188
185
  ),
189
- /* @__PURE__ */ a(Q, { listRef: d, currentRef: k })
186
+ /* @__PURE__ */ o(ee, { listRef: m, currentRef: R })
190
187
  ] });
191
188
  };
192
189
  export {
193
- ce as StepList,
194
- ce as default
190
+ le as StepList,
191
+ le as default
195
192
  };
196
193
  //# sourceMappingURL=StepList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StepList.js","sources":["../../src/components/StepList.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport CheckmarkIcon from './CustomIcons/CheckmarkIcon';\nimport Text from './Typography/Text';\nimport { focusSection, holdsFocus, isFocusDropped } from './collapseFocus';\nimport { isRenderableNode } from './renderableNode';\n\nexport type StepListStatus = 'complete' | 'open' | 'locked';\n\nexport type StepListSize = 'medium' | 'small';\n\nexport type StepListVariant = 'numbered' | 'focused';\n\nexport interface StepListItem {\n /** Keys the row; falls back to its position, so pass one when steps come and go. */\n key?: string;\n title: React.ReactNode;\n description?: React.ReactNode;\n /**\n * `complete` fills the marker with a tick, `open` rings it in the accent, and `locked`\n * dims the marker and the text. The first `open` step is the current one.\n */\n status: StepListStatus;\n /** Right of the text, e.g. the step's button. See `completeLabel` for a complete step. */\n action?: React.ReactNode;\n /** Under the description, shown only while this is the current step. */\n children?: React.ReactNode;\n}\n\nexport interface StepListProps {\n steps: StepListItem[];\n /** `small` is the compact list for a sidebar: tighter rows and smaller text. */\n size?: StepListSize;\n /**\n * `focused` marks each step with a ring around a square and a \"Step N\" label, in the accent\n * on the current step only, and fades every other step, any locked one, and the lines.\n */\n variant?: StepListVariant;\n /** Rules a line under each row, for a list that fills its container edge to edge. */\n dividers?: boolean;\n /**\n * Shown, with a dot, in the action column of a complete step that has no `action`, e.g.\n * \"Completed\". Hidden from assistive tech, which already hears the state after the title.\n */\n completeLabel?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** On the list. Each connector runs to the next row's marker, so add no gap between rows. */\n className?: string;\n}\n\nconst MARKER_SIZE = 24;\nconst DIVIDER_WIDTH = 1;\n\nconst SIZES: Record<\n StepListSize,\n {\n padding: { x: number; y: number };\n title: 'medium' | 'small';\n description: 'small' | 'xsmall';\n childrenGap: number;\n }\n> = {\n medium: { padding: { x: 28, y: 16 }, title: 'medium', description: 'small', childrenGap: 10 },\n small: { padding: { x: 20, y: 12 }, title: 'small', description: 'xsmall', childrenGap: 6 },\n};\n\n// Read out after the title: the marker is hidden, and the dimmed text alone says nothing.\nconst STATUS_LABELS: Record<StepListStatus, string | undefined> = {\n complete: 'Completed',\n open: undefined,\n locked: 'Locked',\n};\n\n// From a marker's foot, through the next row's top padding and any rule, to its marker.\nconst connectorStyle = (\n padding: { x: number; y: number },\n divider: boolean,\n): React.CSSProperties => ({\n insetInlineStart: padding.x + MARKER_SIZE / 2 - 1,\n top: padding.y + MARKER_SIZE,\n height: `calc(100% - ${MARKER_SIZE - (divider ? DIVIDER_WIDTH : 0)}px)`,\n});\n\nconst BORDER = 'var(--malachite-card-border, rgb(232, 232, 232))';\nconst ACCENT = 'var(--malachite-accent-background, rgb(0, 175, 102))';\n\nconst ACCENT_FOREGROUND = 'var(--malachite-accent-foreground, rgb(2, 122, 66))';\nconst NEUTRAL = 'var(--malachite-text-secondary, rgb(123, 123, 123))';\nconst DIMMED = 'var(--malachite-text-dimmed, rgb(161, 161, 161))';\nconst FADED_OPACITY = 0.4;\n\nconst dashed = (color: string) =>\n `repeating-linear-gradient(to bottom, ${color} 0px, ${color} 4px, transparent 4px, transparent 8px)`;\n\n// White on the accent fill in both themes, as Checkbox draws its tick.\nconst MARKER_CLASSES: Record<StepListStatus, string> = {\n complete: 'bg-[var(--malachite-accent-background,rgb(0,175,102))] text-white',\n open: 'border-[1.5px] border-solid border-[var(--malachite-accent-background,rgb(0,175,102))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-accent-foreground,rgb(2,122,66))]',\n locked: 'border-[1.5px] border-solid border-[var(--malachite-text-dimmed,rgb(153,153,153))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-text-dimmed,rgb(153,153,153))]',\n};\n\n// A locked step keeps an empty ring, so it reads apart from an open step waiting its turn.\nconst FocusedMarker: React.FC<{ status: StepListStatus; color: string; opacity?: number }> = ({\n status,\n color,\n opacity,\n}) => (\n <span\n aria-hidden=\"true\"\n className=\"relative z-[2] box-border flex shrink-0 items-center justify-center rounded-full border-[1.5px] border-solid bg-[var(--malachite-card-background,rgb(255,255,255))]\"\n style={{ width: MARKER_SIZE, height: MARKER_SIZE, borderColor: color, color, opacity }}\n >\n {status === 'complete' && <CheckmarkIcon size={12} />}\n {status === 'open' && (\n <span className=\"size-[10px] rounded-[3px]\" style={{ background: color }} />\n )}\n </span>\n);\n\nconst focusedMarkerColor = (status: StepListStatus, isCurrent: boolean): string => {\n if (isCurrent) {\n return ACCENT;\n }\n return status === 'locked' ? DIMMED : NEUTRAL;\n};\n\ninterface StepFocusHandOffProps {\n listRef: React.RefObject<HTMLOListElement | null>;\n currentRef: React.RefObject<HTMLLIElement | null>;\n}\n\ninterface RowSnapshot {\n row: HTMLElement;\n wasCurrent: boolean;\n}\n\nconst rowHolding = (list: HTMLOListElement): HTMLElement | undefined =>\n Array.from(list.children).find(\n (row): row is HTMLElement =>\n row instanceof HTMLElement && holdsFocus(row, list.getRootNode()),\n );\n\n/** A class for `getSnapshotBeforeUpdate`, which sees focus before the update drops it. */\nclass StepFocusHandOff extends React.Component<StepFocusHandOffProps> {\n getSnapshotBeforeUpdate(): RowSnapshot | null {\n const list = this.props.listRef.current;\n const row = list ? rowHolding(list) : undefined;\n return row ? { row, wasCurrent: row === this.props.currentRef.current } : null;\n }\n\n componentDidUpdate(\n _previous: StepFocusHandOffProps,\n _state: unknown,\n snapshot: RowSnapshot | null,\n ): void {\n if (!snapshot || !isFocusDropped(snapshot.row.ownerDocument)) {\n return;\n }\n const { row, wasCurrent } = snapshot;\n const current = this.props.currentRef.current;\n // Leaving the current step moves on to the next; any other row keeps the reader in it.\n const nearest = wasCurrent ? [current, row] : [row, current];\n const target = [...nearest, this.props.listRef.current].find(\n (element) => element?.isConnected,\n );\n focusSection(null, target ?? null, { preventScroll: false });\n }\n\n render(): null {\n return null;\n }\n}\n\n// The position, not the title: two steps may share one. `#` keeps it off consumers' keys.\nconst keyOf = (step: StepListItem, index: number): string => step.key ?? `#${index}`;\n\n/**\n * A numbered, vertical list of setup steps: a marker per step joined by a line that turns\n * solid once a step is done, the step's title and description, and an optional action.\n */\nconst StepList: React.FC<StepListProps> = ({\n steps,\n size = 'medium',\n variant = 'numbered',\n dividers = false,\n completeLabel,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n}) => {\n const sizing = SIZES[size];\n const listRef = useRef<HTMLOListElement>(null);\n const currentRef = useRef<HTMLLIElement>(null);\n const current = steps.findIndex((step) => step.status === 'open');\n const focused = variant === 'focused';\n const fadesOthers = focused && current !== -1;\n const lineColor = focused ? NEUTRAL : BORDER;\n const solidLine = focused ? NEUTRAL : ACCENT;\n const showsCompleteLabel = (step: StepListItem) =>\n Boolean(completeLabel) && step.status === 'complete' && !isRenderableNode(step.action);\n const completeMark = (\n <span aria-hidden=\"true\" className=\"flex items-center gap-[6px]\">\n {/* Success, as its text: the label reports a status, not a choice. */}\n <span className=\"size-[8px] shrink-0 rounded-full bg-[var(--malachite-text-success,rgb(2,122,66))]\" />\n <Text size=\"small\" fontWeight=\"semi-bold\" color=\"success\">\n {completeLabel}\n </Text>\n </span>\n );\n // Every row keeps the column once any step has an action or a complete label, so the text\n // wraps alike.\n const hasActions = steps.some(\n (step) => isRenderableNode(step.action) || showsCompleteLabel(step),\n );\n\n return (\n <>\n {/* `role=\"list\"`: Safari drops the list role from a list styled `list-none`. */}\n <ol\n ref={listRef}\n role=\"list\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={`isolate m-0 list-none p-0 ${className}`}\n >\n {steps.map((step, index) => {\n const isCurrent = index === current;\n const locked = !focused && step.status === 'locked';\n const statusLabel = STATUS_LABELS[step.status];\n const faded =\n focused && ((fadesOthers && !isCurrent) || step.status === 'locked');\n const fade = faded ? FADED_OPACITY : undefined;\n return (\n <li\n key={keyOf(step, index)}\n ref={isCurrent ? currentRef : undefined}\n aria-current={isCurrent ? 'step' : undefined}\n style={{\n padding: `${sizing.padding.y}px ${sizing.padding.x}px`,\n borderBottom: dividers\n ? `${DIVIDER_WIDTH}px solid ${BORDER}`\n : undefined,\n }}\n className=\"relative flex items-start gap-[12px]\"\n >\n {index < steps.length - 1 && (\n <span\n aria-hidden=\"true\"\n className=\"absolute z-[1] w-[2px]\"\n style={{\n ...connectorStyle(sizing.padding, dividers),\n background:\n step.status === 'complete'\n ? solidLine\n : dashed(lineColor),\n opacity: fadesOthers ? FADED_OPACITY : undefined,\n }}\n />\n )}\n {focused ? (\n <FocusedMarker\n status={step.status}\n color={focusedMarkerColor(step.status, isCurrent)}\n opacity={fade}\n />\n ) : (\n <span\n aria-hidden=\"true\"\n className={`relative z-[2] box-border flex shrink-0 items-center justify-center rounded-full text-[length:var(--malachite-font-size-xsmall,11px)] [font-weight:600] ${MARKER_CLASSES[step.status]}`}\n style={{ width: MARKER_SIZE, height: MARKER_SIZE }}\n >\n {step.status === 'complete' ? (\n <CheckmarkIcon size={12} />\n ) : (\n index + 1\n )}\n </span>\n )}\n <div\n className=\"flex min-w-0 flex-1 flex-col gap-[2px] pt-[2px]\"\n style={{ opacity: fade }}\n >\n {focused && (\n <div\n aria-hidden=\"true\"\n style={{ color: isCurrent ? ACCENT_FOREGROUND : NEUTRAL }}\n >\n <Text size=\"xsmall\" fontWeight=\"semi-bold\" color=\"inherit\">\n Step {index + 1}\n </Text>\n </div>\n )}\n <Text\n size={sizing.title}\n fontWeight=\"semi-bold\"\n color={locked ? 'dimmed' : 'primary'}\n >\n {step.title}\n {statusLabel && (\n <span className=\"sr-only\">, {statusLabel}</span>\n )}\n </Text>\n {isRenderableNode(step.description) && (\n <Text\n size={sizing.description}\n color={locked ? 'dimmed' : 'secondary'}\n >\n {step.description}\n </Text>\n )}\n {isCurrent && isRenderableNode(step.children) && (\n <div\n className=\"min-w-0\"\n style={{ marginTop: sizing.childrenGap }}\n >\n {step.children}\n </div>\n )}\n </div>\n {hasActions && (\n <span\n className=\"ml-[16px] flex min-w-[120px] items-center justify-end\"\n style={{ opacity: fade }}\n >\n {showsCompleteLabel(step) ? completeMark : step.action}\n </span>\n )}\n </li>\n );\n })}\n </ol>\n {/* After the list, so the hand-off reads the rows this commit rendered. */}\n <StepFocusHandOff listRef={listRef} currentRef={currentRef} />\n </>\n );\n};\n\nexport default StepList;\nexport { StepList };\n"],"names":["MARKER_SIZE","DIVIDER_WIDTH","SIZES","STATUS_LABELS","connectorStyle","padding","divider","BORDER","ACCENT","ACCENT_FOREGROUND","NEUTRAL","DIMMED","FADED_OPACITY","dashed","color","MARKER_CLASSES","FocusedMarker","status","opacity","jsxs","jsx","CheckmarkIcon","focusedMarkerColor","isCurrent","rowHolding","list","row","holdsFocus","StepFocusHandOff","React","_previous","_state","snapshot","isFocusDropped","wasCurrent","current","target","element","focusSection","keyOf","step","index","StepList","steps","size","variant","dividers","completeLabel","ariaLabel","ariaLabelledBy","className","sizing","listRef","useRef","currentRef","focused","fadesOthers","lineColor","solidLine","showsCompleteLabel","isRenderableNode","completeMark","Text","hasActions","Fragment","locked","statusLabel","fade"],"mappings":";;;;;;AAkDA,MAAMA,IAAc,IACdC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+ {"version":3,"file":"StepList.js","sources":["../../src/components/StepList.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport CheckmarkIcon from './CustomIcons/CheckmarkIcon';\nimport Text from './Typography/Text';\nimport { focusSection, holdsFocus, isFocusDropped } from './collapseFocus';\nimport { isRenderableNode } from './renderableNode';\n\nexport type StepListStatus = 'complete' | 'open' | 'locked';\n\nexport type StepListSize = 'medium' | 'small';\n\nexport type StepListVariant = 'numbered' | 'focused';\n\nexport interface StepListItem {\n /** Keys the row; falls back to its position, so pass one when steps come and go. */\n key?: string;\n title: React.ReactNode;\n description?: React.ReactNode;\n /**\n * `complete` fills the marker with a tick, `open` rings it in the accent, and `locked`\n * dims the marker and the text. The first `open` step is the current one.\n */\n status: StepListStatus;\n /** Right of the text, e.g. a button, in place of `completeLabel`; never faded once complete. */\n action?: React.ReactNode;\n /** Under the taller of the text and the action, across both; only while the step is current. */\n children?: React.ReactNode;\n}\n\nexport interface StepListProps {\n steps: StepListItem[];\n /** `small` is the compact list for a sidebar: tighter rows and smaller text. */\n size?: StepListSize;\n /**\n * `focused` marks each step with a ring around a square and a \"Step N\" label, in the accent\n * on the current step only, and fades every other step, any locked one, and the lines. A\n * complete step's own `action` stays at full opacity.\n */\n variant?: StepListVariant;\n /** Rules a line under each row, for a list that fills its container edge to edge. */\n dividers?: boolean;\n /**\n * Shown, with a dot, in the action column of a complete step that has no `action`, e.g.\n * \"Completed\". Hidden from assistive tech, which already hears the state after the title.\n */\n completeLabel?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** On the list. Each connector runs to the next row's marker, so add no gap between rows. */\n className?: string;\n}\n\nconst MARKER_SIZE = 24;\nconst DIVIDER_WIDTH = 1;\n\nconst SIZES: Record<\n StepListSize,\n {\n padding: { x: number; y: number };\n title: 'medium' | 'small';\n description: 'small' | 'xsmall';\n childrenGap: number;\n }\n> = {\n medium: { padding: { x: 28, y: 16 }, title: 'medium', description: 'small', childrenGap: 12 },\n small: { padding: { x: 20, y: 12 }, title: 'small', description: 'xsmall', childrenGap: 8 },\n};\n\n// Read out after the title: the marker is hidden, and the dimmed text alone says nothing.\nconst STATUS_LABELS: Record<StepListStatus, string | undefined> = {\n complete: 'Completed',\n open: undefined,\n locked: 'Locked',\n};\n\n// From a marker's foot, through the next row's top padding and any rule, to its marker.\nconst connectorStyle = (\n padding: { x: number; y: number },\n divider: boolean,\n): React.CSSProperties => ({\n insetInlineStart: padding.x + MARKER_SIZE / 2 - 1,\n top: padding.y + MARKER_SIZE,\n height: `calc(100% - ${MARKER_SIZE - (divider ? DIVIDER_WIDTH : 0)}px)`,\n});\n\nconst BORDER = 'var(--malachite-card-border, rgb(232, 232, 232))';\nconst ACCENT = 'var(--malachite-accent-background, rgb(0, 175, 102))';\n\nconst ACCENT_FOREGROUND = 'var(--malachite-accent-foreground, rgb(2, 122, 66))';\nconst NEUTRAL = 'var(--malachite-text-secondary, rgb(123, 123, 123))';\nconst DIMMED = 'var(--malachite-text-dimmed, rgb(161, 161, 161))';\nconst FADED_OPACITY = 0.4;\n\nconst dashed = (color: string) =>\n `repeating-linear-gradient(to bottom, ${color} 0px, ${color} 4px, transparent 4px, transparent 8px)`;\n\n// White on the accent fill in both themes, as Checkbox draws its tick.\nconst MARKER_CLASSES: Record<StepListStatus, string> = {\n complete: 'bg-[var(--malachite-accent-background,rgb(0,175,102))] text-white',\n open: 'border-[1.5px] border-solid border-[var(--malachite-accent-background,rgb(0,175,102))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-accent-foreground,rgb(2,122,66))]',\n locked: 'border-[1.5px] border-solid border-[var(--malachite-text-dimmed,rgb(153,153,153))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-text-dimmed,rgb(153,153,153))]',\n};\n\n// A locked step keeps an empty ring, so it reads apart from an open step waiting its turn.\nconst FocusedMarker: React.FC<{ status: StepListStatus; color: string; opacity?: number }> = ({\n status,\n color,\n opacity,\n}) => (\n <span\n aria-hidden=\"true\"\n className=\"relative z-[2] box-border flex items-center justify-center rounded-full border-[1.5px] border-solid bg-[var(--malachite-card-background,rgb(255,255,255))]\"\n style={{ width: MARKER_SIZE, height: MARKER_SIZE, borderColor: color, color, opacity }}\n >\n {status === 'complete' && <CheckmarkIcon size={12} />}\n {status === 'open' && (\n <span className=\"size-[10px] rounded-[3px]\" style={{ background: color }} />\n )}\n </span>\n);\n\nconst focusedMarkerColor = (status: StepListStatus, isCurrent: boolean): string => {\n if (isCurrent) {\n return ACCENT;\n }\n return status === 'locked' ? DIMMED : NEUTRAL;\n};\n\ninterface StepFocusHandOffProps {\n listRef: React.RefObject<HTMLOListElement | null>;\n currentRef: React.RefObject<HTMLLIElement | null>;\n}\n\ninterface RowSnapshot {\n row: HTMLElement;\n wasCurrent: boolean;\n}\n\nconst rowHolding = (list: HTMLOListElement): HTMLElement | undefined =>\n Array.from(list.children).find(\n (row): row is HTMLElement =>\n row instanceof HTMLElement && holdsFocus(row, list.getRootNode()),\n );\n\n/** A class for `getSnapshotBeforeUpdate`, which sees focus before the update drops it. */\nclass StepFocusHandOff extends React.Component<StepFocusHandOffProps> {\n getSnapshotBeforeUpdate(): RowSnapshot | null {\n const list = this.props.listRef.current;\n const row = list ? rowHolding(list) : undefined;\n return row ? { row, wasCurrent: row === this.props.currentRef.current } : null;\n }\n\n componentDidUpdate(\n _previous: StepFocusHandOffProps,\n _state: unknown,\n snapshot: RowSnapshot | null,\n ): void {\n if (!snapshot || !isFocusDropped(snapshot.row.ownerDocument)) {\n return;\n }\n const { row, wasCurrent } = snapshot;\n const current = this.props.currentRef.current;\n // Leaving the current step moves on to the next; any other row keeps the reader in it.\n const nearest = wasCurrent ? [current, row] : [row, current];\n const target = [...nearest, this.props.listRef.current].find(\n (element) => element?.isConnected,\n );\n focusSection(null, target ?? null, { preventScroll: false });\n }\n\n render(): null {\n return null;\n }\n}\n\n// The position, not the title: two steps may share one. `#` keeps it off consumers' keys.\nconst keyOf = (step: StepListItem, index: number): string => step.key ?? `#${index}`;\n\n/**\n * A numbered, vertical list of setup steps: a marker per step joined by a line that turns\n * solid once a step is done, the step's title and description, and an optional action.\n */\nconst StepList: React.FC<StepListProps> = ({\n steps,\n size = 'medium',\n variant = 'numbered',\n dividers = false,\n completeLabel,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n}) => {\n const sizing = SIZES[size];\n const listRef = useRef<HTMLOListElement>(null);\n const currentRef = useRef<HTMLLIElement>(null);\n const current = steps.findIndex((step) => step.status === 'open');\n const focused = variant === 'focused';\n const fadesOthers = focused && current !== -1;\n const lineColor = focused ? NEUTRAL : BORDER;\n const solidLine = focused ? NEUTRAL : ACCENT;\n const showsCompleteLabel = (step: StepListItem) =>\n Boolean(completeLabel) && step.status === 'complete' && !isRenderableNode(step.action);\n const completeMark = (\n <span aria-hidden=\"true\" className=\"flex items-center gap-[6px]\">\n {/* Success, as its text: the label reports a status, not a choice. */}\n <span className=\"size-[8px] shrink-0 rounded-full bg-[var(--malachite-text-success,rgb(2,122,66))]\" />\n <Text size=\"small\" fontWeight=\"semi-bold\" color=\"success\">\n {completeLabel}\n </Text>\n </span>\n );\n // Every row keeps the column once any step has an action or a complete label, so the text\n // wraps alike while each action fits its 120px; each row sizes its own column past that.\n // A complete step's own action stays live; its completeLabel fades with the row.\n const actionFade = (step: StepListItem, fade: number | undefined) =>\n step.status === 'complete' && !showsCompleteLabel(step) ? undefined : fade;\n const hasActions = steps.some(\n (step) => isRenderableNode(step.action) || showsCompleteLabel(step),\n );\n const columns = `${MARKER_SIZE}px minmax(0, 1fr)${hasActions ? ' auto' : ''}`;\n\n return (\n <>\n {/* `role=\"list\"`: Safari drops the list role from a list styled `list-none`. */}\n <ol\n ref={listRef}\n role=\"list\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={`isolate m-0 list-none p-0 ${className}`}\n >\n {steps.map((step, index) => {\n const isCurrent = index === current;\n const locked = !focused && step.status === 'locked';\n const statusLabel = STATUS_LABELS[step.status];\n const faded =\n focused && ((fadesOthers && !isCurrent) || step.status === 'locked');\n const fade = faded ? FADED_OPACITY : undefined;\n return (\n <li\n key={keyOf(step, index)}\n ref={isCurrent ? currentRef : undefined}\n aria-current={isCurrent ? 'step' : undefined}\n style={{\n padding: `${sizing.padding.y}px ${sizing.padding.x}px`,\n borderBottom: dividers\n ? `${DIVIDER_WIDTH}px solid ${BORDER}`\n : undefined,\n gridTemplateColumns: columns,\n rowGap: sizing.childrenGap,\n }}\n className=\"relative grid items-start gap-x-[12px]\"\n >\n {index < steps.length - 1 && (\n <span\n aria-hidden=\"true\"\n className=\"absolute z-[1] w-[2px]\"\n style={{\n ...connectorStyle(sizing.padding, dividers),\n background:\n step.status === 'complete'\n ? solidLine\n : dashed(lineColor),\n opacity: fadesOthers ? FADED_OPACITY : undefined,\n }}\n />\n )}\n {focused ? (\n <FocusedMarker\n status={step.status}\n color={focusedMarkerColor(step.status, isCurrent)}\n opacity={fade}\n />\n ) : (\n <span\n aria-hidden=\"true\"\n className={`relative z-[2] box-border flex items-center justify-center rounded-full text-[length:var(--malachite-font-size-xsmall,11px)] [font-weight:600] ${MARKER_CLASSES[step.status]}`}\n style={{ width: MARKER_SIZE, height: MARKER_SIZE }}\n >\n {step.status === 'complete' ? (\n <CheckmarkIcon size={12} />\n ) : (\n index + 1\n )}\n </span>\n )}\n <div\n className=\"flex min-w-0 flex-col gap-[2px] pt-[2px]\"\n style={{ opacity: fade }}\n >\n {focused && (\n <div\n aria-hidden=\"true\"\n style={{ color: isCurrent ? ACCENT_FOREGROUND : NEUTRAL }}\n >\n <Text size=\"xsmall\" fontWeight=\"semi-bold\" color=\"inherit\">\n Step {index + 1}\n </Text>\n </div>\n )}\n <Text\n size={sizing.title}\n fontWeight=\"semi-bold\"\n color={locked ? 'dimmed' : 'primary'}\n >\n {step.title}\n {statusLabel && (\n <span className=\"sr-only\">, {statusLabel}</span>\n )}\n </Text>\n {isRenderableNode(step.description) && (\n <Text\n size={sizing.description}\n color={locked ? 'dimmed' : 'secondary'}\n >\n {step.description}\n </Text>\n )}\n </div>\n {hasActions && (\n <span\n className=\"ml-[16px] flex min-w-[120px] items-center justify-end\"\n style={{\n opacity: actionFade(step, fade),\n }}\n >\n {showsCompleteLabel(step) ? completeMark : step.action}\n </span>\n )}\n {isCurrent && isRenderableNode(step.children) && (\n <div className=\"min-w-0\" style={{ gridColumn: '2 / -1' }}>\n {step.children}\n </div>\n )}\n </li>\n );\n })}\n </ol>\n {/* After the list, so the hand-off reads the rows this commit rendered. */}\n <StepFocusHandOff listRef={listRef} currentRef={currentRef} />\n </>\n );\n};\n\nexport default StepList;\nexport { StepList };\n"],"names":["MARKER_SIZE","DIVIDER_WIDTH","SIZES","STATUS_LABELS","connectorStyle","padding","divider","BORDER","ACCENT","ACCENT_FOREGROUND","NEUTRAL","DIMMED","FADED_OPACITY","dashed","color","MARKER_CLASSES","FocusedMarker","status","opacity","jsxs","jsx","CheckmarkIcon","focusedMarkerColor","isCurrent","rowHolding","list","row","holdsFocus","StepFocusHandOff","React","_previous","_state","snapshot","isFocusDropped","wasCurrent","current","target","element","focusSection","keyOf","step","index","StepList","steps","size","variant","dividers","completeLabel","ariaLabel","ariaLabelledBy","className","sizing","listRef","useRef","currentRef","focused","fadesOthers","lineColor","solidLine","showsCompleteLabel","isRenderableNode","completeMark","Text","actionFade","fade","hasActions","columns","Fragment","locked","statusLabel"],"mappings":";;;;;;AAmDA,MAAMA,IAAc,IACdC,IAAgB,GAEhBC,IAQF;AAAA,EACA,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,MAAM,OAAO,UAAU,aAAa,SAAS,aAAa,GAAA;AAAA,EACzF,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,GAAA,GAAM,OAAO,SAAS,aAAa,UAAU,aAAa,EAAA;AAC5F,GAGMC,IAA4D;AAAA,EAC9D,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AACZ,GAGMC,IAAiB,CACnBC,GAC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