@stackone/malachite 2.79.0 → 2.81.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.
- package/COMPONENTS.md +3 -2
- package/dist/components/Accordion.js +113 -82
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Surface.js +91 -86
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/ZoomableImage.js +67 -0
- package/dist/components/ZoomableImage.js.map +1 -0
- package/dist/components/accordionBodyInset.js +17 -0
- package/dist/components/accordionBodyInset.js.map +1 -0
- package/dist/index.d.ts +37 -1
- package/dist/index.js +393 -391
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as O } from "react/jsx-runtime";
|
|
2
2
|
import q from "react";
|
|
3
3
|
import { DisclosureArrow as J } from "./DisclosureArrow.js";
|
|
4
4
|
import { paintOnChild as M } from "./asChild.js";
|
|
@@ -7,10 +7,11 @@ import { resolveRel as I } from "./linkRel.js";
|
|
|
7
7
|
import { isRenderableNode as Q } from "./renderableNode.js";
|
|
8
8
|
import { safeHref as Y } from "./safeHref.js";
|
|
9
9
|
import { FOREGROUND_RESET as Z, SELECTED_TEXT_CONTEXT as ee, SELECTED_ROW_ACCENT as ae, SELECTED_ROW_FOREGROUND as re, SELECTED_ROW_BACKGROUND as B } from "./selectedRow.js";
|
|
10
|
-
const
|
|
10
|
+
const te = {
|
|
11
11
|
none: "",
|
|
12
|
+
// The 16px is ROW_INSET_PX in accordionBodyInset.ts too; Accordion's bodyIndent gives it back.
|
|
12
13
|
compact: "px-[16px] py-[8px]"
|
|
13
|
-
},
|
|
14
|
+
}, oe = {
|
|
14
15
|
default: "",
|
|
15
16
|
muted: "bg-[var(--malachite-card-dimmed-background)]",
|
|
16
17
|
success: "bg-[var(--malachite-tag-success-background)]",
|
|
@@ -18,105 +19,105 @@ const oe = {
|
|
|
18
19
|
}, le = {
|
|
19
20
|
success: "var(--malachite-tag-success-foreground)",
|
|
20
21
|
error: "var(--malachite-tag-error-foreground)"
|
|
21
|
-
}, ie = "opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100", ne = "0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)", F = (
|
|
22
|
+
}, ie = "opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100", ne = "0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)", F = (o) => {
|
|
22
23
|
const {
|
|
23
24
|
children: a,
|
|
24
25
|
divider: r = !1,
|
|
25
26
|
disabled: e = !1,
|
|
26
|
-
selected:
|
|
27
|
+
selected: c,
|
|
27
28
|
selection: s,
|
|
28
29
|
tone: d = "default",
|
|
29
30
|
inset: f = "none",
|
|
30
31
|
className: b = "",
|
|
31
|
-
style:
|
|
32
|
-
} =
|
|
33
|
-
onClick:
|
|
32
|
+
style: h
|
|
33
|
+
} = o, l = o.asChild === !0, {
|
|
34
|
+
onClick: i,
|
|
34
35
|
href: u,
|
|
35
36
|
target: m,
|
|
36
37
|
rel: T,
|
|
37
38
|
trailing: $,
|
|
38
|
-
revealTrailing:
|
|
39
|
-
role:
|
|
40
|
-
} =
|
|
39
|
+
revealTrailing: A,
|
|
40
|
+
role: n
|
|
41
|
+
} = l ? {} : o, x = Y(u), g = l ? void 0 : o["aria-label"], v = l ? void 0 : o["aria-labelledby"], C = l ? void 0 : o.tabIndex, S = !!(i || x), U = e && (S || l) ? "" : "transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]", G = d !== "default", W = oe[d], w = !l && Q($), R = te[f], X = R && !w ? "" : "p-0", D = [
|
|
41
42
|
"w-full text-left border-0",
|
|
42
43
|
W,
|
|
43
44
|
r ? "border-b border-solid border-[var(--malachite-card-border)]" : "",
|
|
44
|
-
|
|
45
|
+
U
|
|
45
46
|
].filter(Boolean).join(" "), k = [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
].filter(Boolean).join(" "), N = [
|
|
47
|
+
S ? `appearance-none ${G ? "" : "bg-transparent"} ${X} ${j}` : "",
|
|
48
|
+
S && !e ? "cursor-pointer" : ""
|
|
49
|
+
].filter(Boolean).join(" "), N = [D, k, w ? "" : R, b].filter(Boolean).join(" "), H = s ? s !== "announce" : n !== "checkbox", z = s !== "tint", K = c === !0 && H ? {
|
|
49
50
|
backgroundImage: `linear-gradient(${B}, ${B})`,
|
|
50
51
|
color: re,
|
|
51
52
|
...z ? { boxShadow: `inset 2px 0 0 ${ae}` } : {},
|
|
52
53
|
...ee
|
|
53
|
-
} : {}, _ = le[d],
|
|
54
|
+
} : {}, _ = le[d], E = { ..._ ? {
|
|
54
55
|
color: _,
|
|
55
56
|
"--malachite-ctx-text-primary": _
|
|
56
|
-
} : {}, ...K, ...
|
|
57
|
-
role:
|
|
57
|
+
} : {}, ...K, ...h }, p = n === "checkbox" && c === "mixed" ? "mixed" : n === "radio" || n === "checkbox" ? c === !0 : void 0, y = p === void 0 && c === !0 ? !0 : void 0, L = {
|
|
58
|
+
role: n,
|
|
58
59
|
"aria-checked": p,
|
|
59
|
-
"aria-current":
|
|
60
|
-
"aria-label":
|
|
60
|
+
"aria-current": y,
|
|
61
|
+
"aria-label": g,
|
|
61
62
|
"aria-labelledby": v,
|
|
62
|
-
"aria-disabled":
|
|
63
|
+
"aria-disabled": n && e ? !0 : void 0
|
|
63
64
|
};
|
|
64
|
-
if (
|
|
65
|
-
return M(a, N,
|
|
66
|
-
if (
|
|
67
|
-
const V =
|
|
65
|
+
if (l)
|
|
66
|
+
return M(a, N, E);
|
|
67
|
+
if (w) {
|
|
68
|
+
const V = x && !e ? /* @__PURE__ */ t(
|
|
68
69
|
"a",
|
|
69
70
|
{
|
|
70
|
-
href:
|
|
71
|
+
href: x,
|
|
71
72
|
target: m,
|
|
72
73
|
rel: I(T, m),
|
|
73
|
-
onClick:
|
|
74
|
+
onClick: i,
|
|
74
75
|
className: `${k} border-0 flex-1 min-w-0 text-left no-underline text-inherit`,
|
|
75
|
-
role:
|
|
76
|
+
role: n,
|
|
76
77
|
tabIndex: C,
|
|
77
78
|
"aria-checked": p,
|
|
78
|
-
"aria-current":
|
|
79
|
-
"aria-label":
|
|
79
|
+
"aria-current": y,
|
|
80
|
+
"aria-label": g,
|
|
80
81
|
"aria-labelledby": v,
|
|
81
82
|
children: a
|
|
82
83
|
}
|
|
83
|
-
) :
|
|
84
|
+
) : i ? /* @__PURE__ */ t(
|
|
84
85
|
"button",
|
|
85
86
|
{
|
|
86
87
|
type: "button",
|
|
87
|
-
onClick:
|
|
88
|
+
onClick: i,
|
|
88
89
|
disabled: e,
|
|
89
90
|
className: `${k} border-0 flex-1 min-w-0 text-left`,
|
|
90
|
-
role:
|
|
91
|
+
role: n,
|
|
91
92
|
tabIndex: C,
|
|
92
93
|
"aria-checked": p,
|
|
93
|
-
"aria-current":
|
|
94
|
-
"aria-label":
|
|
94
|
+
"aria-current": y,
|
|
95
|
+
"aria-label": g,
|
|
95
96
|
"aria-labelledby": v,
|
|
96
97
|
children: a
|
|
97
98
|
}
|
|
98
99
|
) : (
|
|
99
100
|
// The set goes here, not on the wrapper: `radio` and `checkbox` make their
|
|
100
101
|
// descendants presentational, which would bury a control in the trailing slot.
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ t("div", { className: "flex-1 min-w-0", ...L, children: a })
|
|
102
103
|
);
|
|
103
104
|
return /* @__PURE__ */ O(
|
|
104
105
|
"div",
|
|
105
106
|
{
|
|
106
107
|
className: [
|
|
107
|
-
|
|
108
|
+
D,
|
|
108
109
|
"flex items-center",
|
|
109
110
|
R,
|
|
110
|
-
|
|
111
|
+
A ? "group/row" : "",
|
|
111
112
|
b
|
|
112
113
|
].filter(Boolean).join(" "),
|
|
113
|
-
style:
|
|
114
|
+
style: E,
|
|
114
115
|
children: [
|
|
115
116
|
V,
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ t(
|
|
117
118
|
"div",
|
|
118
119
|
{
|
|
119
|
-
className: `shrink-0 flex items-center ${
|
|
120
|
+
className: `shrink-0 flex items-center ${A ? ie : ""}`,
|
|
120
121
|
children: $
|
|
121
122
|
}
|
|
122
123
|
)
|
|
@@ -124,115 +125,119 @@ const oe = {
|
|
|
124
125
|
}
|
|
125
126
|
);
|
|
126
127
|
}
|
|
127
|
-
return
|
|
128
|
+
return x && !e ? /* @__PURE__ */ t(
|
|
128
129
|
"a",
|
|
129
130
|
{
|
|
130
|
-
href:
|
|
131
|
+
href: x,
|
|
131
132
|
target: m,
|
|
132
133
|
rel: I(T, m),
|
|
133
|
-
onClick:
|
|
134
|
+
onClick: i,
|
|
134
135
|
className: `${N} no-underline text-inherit`,
|
|
135
|
-
style:
|
|
136
|
-
role:
|
|
136
|
+
style: E,
|
|
137
|
+
role: n,
|
|
137
138
|
tabIndex: C,
|
|
138
139
|
"aria-checked": p,
|
|
139
|
-
"aria-current":
|
|
140
|
-
"aria-label":
|
|
140
|
+
"aria-current": y,
|
|
141
|
+
"aria-label": g,
|
|
141
142
|
"aria-labelledby": v,
|
|
142
143
|
children: a
|
|
143
144
|
}
|
|
144
|
-
) :
|
|
145
|
+
) : i ? /* @__PURE__ */ t(
|
|
145
146
|
"button",
|
|
146
147
|
{
|
|
147
148
|
type: "button",
|
|
148
|
-
onClick:
|
|
149
|
+
onClick: i,
|
|
149
150
|
disabled: e,
|
|
150
151
|
className: N,
|
|
151
|
-
style:
|
|
152
|
-
role:
|
|
152
|
+
style: E,
|
|
153
|
+
role: n,
|
|
153
154
|
tabIndex: C,
|
|
154
155
|
"aria-checked": p,
|
|
155
|
-
"aria-current":
|
|
156
|
-
"aria-label":
|
|
156
|
+
"aria-current": y,
|
|
157
|
+
"aria-label": g,
|
|
157
158
|
"aria-labelledby": v,
|
|
158
159
|
children: a
|
|
159
160
|
}
|
|
160
|
-
) : /* @__PURE__ */
|
|
161
|
-
}, ce = ({ children:
|
|
161
|
+
) : /* @__PURE__ */ t("div", { className: N, style: E, ...L, children: a });
|
|
162
|
+
}, ce = ({ children: o, className: a = "", style: r }) => /* @__PURE__ */ t("div", { className: a, style: r, onClick: (e) => e.stopPropagation(), children: o }), ye = 39, se = Object.assign(
|
|
162
163
|
({
|
|
163
|
-
header:
|
|
164
|
+
header: o,
|
|
164
165
|
children: a,
|
|
165
166
|
expanded: r,
|
|
166
167
|
onToggle: e,
|
|
167
|
-
sticky:
|
|
168
|
+
sticky: c = !1,
|
|
168
169
|
stickyTopOffset: s = 0,
|
|
169
170
|
divider: d = !1,
|
|
170
171
|
tone: f = "default",
|
|
171
172
|
"aria-label": b,
|
|
172
|
-
className:
|
|
173
|
-
style:
|
|
173
|
+
className: h = "",
|
|
174
|
+
style: l
|
|
174
175
|
}) => {
|
|
175
|
-
const
|
|
176
|
-
return /* @__PURE__ */ O(F, { divider: d, tone: f, className:
|
|
176
|
+
const i = q.useId(), u = e ? () => e(!r) : void 0;
|
|
177
|
+
return /* @__PURE__ */ O(F, { divider: d, tone: f, className: h, style: l, children: [
|
|
177
178
|
/* @__PURE__ */ O(
|
|
178
179
|
"div",
|
|
179
180
|
{
|
|
180
|
-
className: `group flex items-center w-full ${u ? "cursor-pointer" : ""} ${
|
|
181
|
-
style:
|
|
181
|
+
className: `group flex items-center w-full ${u ? "cursor-pointer" : ""} ${c && r ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
|
|
182
|
+
style: c && r ? { top: s } : void 0,
|
|
182
183
|
onClick: u,
|
|
183
184
|
role: "presentation",
|
|
184
185
|
children: [
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ t("span", { className: "shrink-0 flex items-center pl-[16px] pr-[12px]", children: u && /* @__PURE__ */ t(
|
|
186
187
|
"button",
|
|
187
188
|
{
|
|
188
189
|
type: "button",
|
|
189
190
|
className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${j}`,
|
|
190
191
|
"aria-expanded": r,
|
|
191
|
-
"aria-controls":
|
|
192
|
+
"aria-controls": i,
|
|
192
193
|
"aria-label": b,
|
|
193
194
|
onClick: (m) => {
|
|
194
195
|
m.stopPropagation(), u();
|
|
195
196
|
},
|
|
196
|
-
children: /* @__PURE__ */
|
|
197
|
+
children: /* @__PURE__ */ t(J, { expanded: r })
|
|
197
198
|
}
|
|
198
199
|
) }),
|
|
199
|
-
|
|
200
|
+
o
|
|
200
201
|
]
|
|
201
202
|
}
|
|
202
203
|
),
|
|
203
|
-
r && /* @__PURE__ */
|
|
204
|
+
r && /* @__PURE__ */ t("div", { id: i, children: a })
|
|
204
205
|
] });
|
|
205
206
|
},
|
|
206
207
|
{ Controls: ce }
|
|
207
|
-
),
|
|
208
|
-
|
|
208
|
+
), de = {
|
|
209
|
+
default: "bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]",
|
|
210
|
+
highlight: "bg-[var(--malachite-card-warm-background,rgb(244,242,240))]"
|
|
211
|
+
}, P = ({
|
|
212
|
+
children: o,
|
|
209
213
|
padding: a = !1,
|
|
210
214
|
overflow: r = "hidden",
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
"aria-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
tone: e = "default",
|
|
216
|
+
shadow: c = e !== "highlight",
|
|
217
|
+
role: s,
|
|
218
|
+
"aria-label": d,
|
|
219
|
+
"aria-labelledby": f,
|
|
220
|
+
className: b = "",
|
|
221
|
+
style: h
|
|
222
|
+
}) => /* @__PURE__ */ t(
|
|
218
223
|
"div",
|
|
219
224
|
{
|
|
220
|
-
className: `w-full rounded-[var(--malachite-radius-xxl,14px)] ${r === "clip" ? "overflow-clip" : r === "visible" ? "overflow-visible" : "overflow-hidden"}
|
|
225
|
+
className: `w-full rounded-[var(--malachite-radius-xxl,14px)] ${r === "clip" ? "overflow-clip" : r === "visible" ? "overflow-visible" : "overflow-hidden"} ${de[e]} ${a ? "py-3 px-4" : ""} ${b}`,
|
|
221
226
|
style: {
|
|
222
|
-
...
|
|
227
|
+
...c ? { boxShadow: ne } : {},
|
|
223
228
|
...Z,
|
|
224
|
-
...
|
|
229
|
+
...h
|
|
225
230
|
},
|
|
226
|
-
role:
|
|
227
|
-
"aria-label":
|
|
228
|
-
"aria-labelledby":
|
|
229
|
-
children:
|
|
231
|
+
role: s,
|
|
232
|
+
"aria-label": d,
|
|
233
|
+
"aria-labelledby": f,
|
|
234
|
+
children: o
|
|
230
235
|
}
|
|
231
236
|
);
|
|
232
237
|
P.Row = F;
|
|
233
238
|
P.ExpandableRow = se;
|
|
234
239
|
export {
|
|
235
|
-
|
|
240
|
+
ye as EXPANDABLE_ROW_LEAD_PX,
|
|
236
241
|
P as Surface,
|
|
237
242
|
se as SurfaceExpandableRow,
|
|
238
243
|
F as SurfaceRow,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.js","sources":["../../src/components/Surface.tsx"],"sourcesContent":["import React from 'react';\nimport DisclosureArrow from './DisclosureArrow';\nimport { paintOnChild } from './asChild';\nimport { FOCUS_RING_INSET } from './focusRing';\nimport { resolveRel } from './linkRel';\nimport { isRenderableNode } from './renderableNode';\nimport { safeHref } from './safeHref';\nimport {\n FOREGROUND_RESET,\n SELECTED_ROW_ACCENT,\n SELECTED_ROW_BACKGROUND,\n SELECTED_ROW_FOREGROUND,\n SELECTED_TEXT_CONTEXT,\n} from './selectedRow';\n\nexport interface SurfaceProps {\n children?: React.ReactNode;\n padding?: boolean;\n /**\n * Content overflow. Defaults to `hidden` so children are clipped to the rounded\n * corners. Use `clip` to keep the rounded clipping WITHOUT creating a scroll\n * container — so a `position: sticky` descendant still pins (unlike `hidden`,\n * which traps it). `visible` disables clipping entirely.\n */\n overflow?: 'hidden' | 'visible' | 'clip';\n /** `false` drops the elevation shadow, for a card that sits flat on its ground. */\n shadow?: boolean;\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\ninterface SurfaceRowChromeProps {\n children?: React.ReactNode;\n /** Renders a bottom divider — omit on the last row in a Surface. */\n divider?: boolean;\n /** Removes the hover affordance / disables the control (e.g. while loading/busy). */\n disabled?: boolean;\n /** Announces the row as selected — `aria-checked` under a `radio`/`checkbox` role,\n * `aria-current` otherwise — and paints `Table`'s selected treatment unless `selection`\n * says not to. `'mixed'` is for a `checkbox` row that is partly selected: it announces\n * `aria-checked=\"mixed\"` there, never paints and never marks the row current, and counts\n * as not selected under any other role. */\n selected?: boolean | 'mixed';\n /** How a `selected` row shows it. `highlight` paints the treatment; `tint` paints it\n * without the accent bar, for a menu whose choice is already marked inside the row;\n * `announce` leaves the visual to a control inside the row and only sets the ARIA state.\n * Defaults to `announce` under `role=\"checkbox\"` and `highlight` otherwise. */\n selection?: 'highlight' | 'tint' | 'announce';\n /**\n * Tints the whole row by what it reports. `muted` is a row whose subject is inactive —\n * not disabled: it stays interactive. `success` and `error` are for a row that carries\n * an outcome, where the result belongs to the whole line rather than to one cell in it.\n */\n tone?: 'default' | 'muted' | 'success' | 'error';\n /** `compact` is an 8px by 16px inset the row owns. */\n inset?: 'none' | 'compact';\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst INSET_CLASSES: Record<NonNullable<SurfaceRowChromeProps['inset']>, string> = {\n none: '',\n compact: 'px-[16px] py-[8px]',\n};\n\n/** Stays an interface under its original name: a consumer may `extends` it. */\nexport interface SurfaceRowProps extends SurfaceRowChromeProps {\n asChild?: false;\n /**\n * When provided, the whole row becomes clickable: it renders as a `<button>`\n * (or `<a>` when `href` is set), so the entire row is the click target with\n * native focus + Enter/Space — no manual tabIndex/key handlers. For a\n * selectable row, put a presentational `<Radio>`/`<Checkbox>` inside as the\n * visual indicator; do NOT nest an interactive control (invalid + double tab stop).\n */\n onClick?: (event: React.MouseEvent) => void;\n /** Renders the clickable row as an anchor instead of a button. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n /** Content pinned right, outside the row button, so it may hold its own control. */\n trailing?: React.ReactNode;\n /**\n * Shows `trailing` only while the row is hovered or holds focus, and while a menu\n * it opened is still open. Hidden by opacity, so it stays in the tab order; a touch screen,\n * which has no hover, always shows it.\n */\n revealTrailing?: boolean;\n /** ARIA role for a clickable row, e.g. `radio`/`checkbox` (wrap the list in a `radiogroup`). */\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** `-1` takes the row out of the Tab order, for a roving radio group. */\n tabIndex?: number;\n}\n\n/**\n * The outcome tones reuse the tag tokens rather than minting row ones, so a row saying \"this\n * passed\" and a tag saying it are the same green wherever the two sit together.\n */\nconst TONE_CLASSES: Record<NonNullable<SurfaceRowProps['tone']>, string> = {\n default: '',\n muted: 'bg-[var(--malachite-card-dimmed-background)]',\n success: 'bg-[var(--malachite-tag-success-background)]',\n error: 'bg-[var(--malachite-tag-error-background)]',\n};\n\n/**\n * The text an outcome tone carries with it, through the same context channel a selected row\n * uses, so `Typography` inside the row follows the tint instead of staying near-black on it.\n * `color` as well, for row content that is not Typography.\n *\n * Only the outcome tones. `muted` dims its subject rather than recolouring it, and its\n * foreground is the ordinary one.\n */\nconst TONE_FOREGROUNDS: Partial<Record<NonNullable<SurfaceRowProps['tone']>, string>> = {\n success: 'var(--malachite-tag-success-foreground)',\n error: 'var(--malachite-tag-error-foreground)',\n};\n\nexport interface SurfaceRowAsChildProps extends SurfaceRowChromeProps {\n asChild: true;\n children: React.ReactElement;\n}\n\nexport type AnySurfaceRowProps = SurfaceRowProps | SurfaceRowAsChildProps;\n\n// Not `group-hover` or `group-has-[:focus-visible]`: WebKit never applies the first (its\n// `@media (hover: hover)` nested in the group selector) nor the second inside a shadow root,\n// so the control stayed hidden in Safari. An open menu takes focus out of the row into a\n// portal, and would otherwise lose its trigger.\nconst REVEALED_ON_INTERACTION =\n 'opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100';\n\nconst TRIPLE_SHADOW =\n '0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)';\n\n/**\n * A single full-bleed row inside a <Surface>. Owns the row chrome — hover\n * highlight, colour transition and an optional bottom divider — so consumers\n * compose their own content inside without re-implementing design-system styling.\n * Pass `onClick`/`href` to make the entire row clickable (rendered as a real\n * button/anchor, so keyboard navigation works natively).\n */\nconst SurfaceRow: React.FC<AnySurfaceRowProps> = (props) => {\n const {\n children,\n divider = false,\n disabled = false,\n selected,\n selection,\n tone = 'default',\n inset = 'none',\n className = '',\n style,\n } = props;\n const asChild = props.asChild === true;\n const {\n onClick,\n href: rawHref,\n target,\n rel,\n trailing,\n revealTrailing,\n role,\n } = asChild ? ({} as SurfaceRowProps) : (props as SurfaceRowProps);\n // A rejected href (e.g. `javascript:`) leaves the row a button or a plain row, never an anchor.\n const href = safeHref(rawHref);\n const ariaLabel = asChild ? undefined : (props as SurfaceRowProps)['aria-label'];\n const ariaLabelledBy = asChild ? undefined : (props as SurfaceRowProps)['aria-labelledby'];\n const tabIndex = asChild ? undefined : (props as SurfaceRowProps).tabIndex;\n const interactive = Boolean(onClick || href);\n // `asChild` is interactive for the hover affordance only, not the focus/reset classes.\n const hover =\n disabled && (interactive || asChild)\n ? ''\n : 'transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]';\n\n // A class, not an inline colour, which would outrank the hover utility. It replaces the\n // button reset's `bg-transparent` rather than joining it: same specificity, so the winner\n // would be whichever Tailwind emitted last.\n const tinted = tone !== 'default';\n const toneClass = TONE_CLASSES[tone];\n\n const hasTrailing = !asChild && isRenderableNode(trailing);\n const insetClass = INSET_CLASSES[inset];\n const controlPadding = insetClass && !hasTrailing ? '' : 'p-0';\n\n const chromeClasses = [\n 'w-full text-left border-0',\n toneClass,\n divider ? 'border-b border-solid border-[var(--malachite-card-border)]' : '',\n hover,\n ]\n .filter(Boolean)\n .join(' ');\n\n const controlClasses = [\n interactive\n ? `appearance-none ${tinted ? '' : 'bg-transparent'} ${controlPadding} ${FOCUS_RING_INSET}`\n : '',\n interactive && !disabled ? 'cursor-pointer' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const classes = [chromeClasses, controlClasses, hasTrailing ? '' : insetClass, className]\n .filter(Boolean)\n .join(' ');\n\n const paints = selection ? selection !== 'announce' : role !== 'checkbox';\n const accent = selection !== 'tint';\n\n // A gradient layer so the tint composites over hover, and an inset shadow because\n // `ring-*` silently doesn't paint in a shadow root.\n const selectedStyle: React.CSSProperties =\n selected === true && paints\n ? {\n backgroundImage: `linear-gradient(${SELECTED_ROW_BACKGROUND}, ${SELECTED_ROW_BACKGROUND})`,\n color: SELECTED_ROW_FOREGROUND,\n ...(accent ? { boxShadow: `inset 2px 0 0 ${SELECTED_ROW_ACCENT}` } : {}),\n ...SELECTED_TEXT_CONTEXT,\n }\n : {};\n\n const toneForeground = TONE_FOREGROUNDS[tone];\n const toneStyle: React.CSSProperties = toneForeground\n ? ({\n color: toneForeground,\n '--malachite-ctx-text-primary': toneForeground,\n } as React.CSSProperties)\n : {};\n\n // `selected` last of the two: a row can be both, and selection is the state the reader is\n // acting on, so it wins the colour.\n const rowStyle = { ...toneStyle, ...selectedStyle, ...style };\n\n // Only a checkbox has a partly-checked state; a radio is chosen or not.\n const ariaChecked =\n role === 'checkbox' && selected === 'mixed'\n ? ('mixed' as const)\n : role === 'radio' || role === 'checkbox'\n ? selected === true\n : undefined;\n // `aria-current`, not `aria-pressed`: a selected row is one of many choices, not a toggle\n // (same call as `Dropdown`'s options). A role that carries its own state uses that instead.\n const ariaCurrent = ariaChecked === undefined && selected === true ? true : undefined;\n\n // Everything a control would have carried, for the branches that render none: the row\n // element is then the only thing assistive tech sees. `aria-disabled` because there is no\n // control to be natively disabled — and it is inert without a role, like the name.\n const rowFallbackAria = {\n role,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-disabled': role && disabled ? true : undefined,\n };\n\n if (asChild) {\n return paintOnChild(children, classes, rowStyle);\n }\n\n if (hasTrailing) {\n const control =\n href && !disabled ? (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${controlClasses} border-0 flex-1 min-w-0 text-left no-underline text-inherit`}\n role={role}\n tabIndex={tabIndex}\n aria-checked={ariaChecked}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </a>\n ) : onClick ? (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={`${controlClasses} border-0 flex-1 min-w-0 text-left`}\n role={role}\n tabIndex={tabIndex}\n aria-checked={ariaChecked}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </button>\n ) : (\n // The set goes here, not on the wrapper: `radio` and `checkbox` make their\n // descendants presentational, which would bury a control in the trailing slot.\n <div className=\"flex-1 min-w-0\" {...rowFallbackAria}>\n {children}\n </div>\n );\n\n return (\n <div\n className={[\n chromeClasses,\n 'flex items-center',\n insetClass,\n revealTrailing ? 'group/row' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={rowStyle}\n >\n {control}\n <div\n className={`shrink-0 flex items-center ${revealTrailing ? REVEALED_ON_INTERACTION : ''}`}\n >\n {trailing}\n </div>\n </div>\n );\n }\n\n if (href && !disabled) {\n return (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${classes} no-underline text-inherit`}\n style={rowStyle}\n role={role}\n tabIndex={tabIndex}\n aria-checked={ariaChecked}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </a>\n );\n }\n\n if (onClick) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={classes}\n style={rowStyle}\n role={role}\n tabIndex={tabIndex}\n aria-checked={ariaChecked}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </button>\n );\n }\n\n return (\n <div className={classes} style={rowStyle} {...rowFallbackAria}>\n {children}\n </div>\n );\n};\n\nexport interface SurfaceExpandableRowProps {\n /** The row itself, laid out across the line. May hold its own controls. */\n header: React.ReactNode;\n /** The body, rendered beneath the row while it is open. */\n children?: React.ReactNode;\n expanded: boolean;\n /** Omit for a row that cannot open. The arrow's space is still reserved, so a list of\n * rows stays in one column whether or not each one has a body. */\n onToggle?: (expanded: boolean) => void;\n /**\n * Pins the row while its body scrolls, so a long body never leaves the reader without\n * the line it belongs to. Offset by whatever is already pinned above it.\n */\n sticky?: boolean;\n stickyTopOffset?: number;\n divider?: boolean;\n tone?: SurfaceRowProps['tone'];\n /** Names the disclosure control, which is otherwise only an arrow. */\n 'aria-label'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\n/**\n * Stops a click inside it from toggling the row, for the cells that hold controls.\n *\n * Explicit rather than sniffing the event's target for an interactive ancestor: a control\n * rendering into a shadow root retargets the event to its host, so the sniff would miss\n * exactly the components most likely to sit in a row.\n */\nconst ExpandableRowControls: React.FC<{\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n}> = ({ children, className = '', style }) => (\n <div className={className} style={style} onClick={(event) => event.stopPropagation()}>\n {children}\n </div>\n);\n\n/**\n * A row that opens to reveal a body, for a line that carries its own controls.\n *\n * Not `Accordion`: that puts its header inside the toggle button, so a header holding a\n * dropdown or a second button is invalid. Here the row surface takes the click and a cell\n * opts out with `ExpandableRow.Controls`, while the arrow stays a real button so the\n * keyboard reaches it.\n */\n/**\n * The space before the header: the arrow's own inset, its glyph and the gap after it.\n * Exported so a consumer aligning a column header above these rows offsets by the same\n * amount instead of guessing at it.\n */\nexport const EXPANDABLE_ROW_LEAD_PX = 39;\n\nconst SurfaceExpandableRow: React.FC<SurfaceExpandableRowProps> & {\n Controls: typeof ExpandableRowControls;\n} = Object.assign(\n ({\n header,\n children,\n expanded,\n onToggle,\n sticky = false,\n stickyTopOffset = 0,\n divider = false,\n tone = 'default',\n 'aria-label': ariaLabel,\n className = '',\n style,\n }: SurfaceExpandableRowProps) => {\n const bodyId = React.useId();\n const toggle = onToggle ? () => onToggle(!expanded) : undefined;\n\n return (\n <SurfaceRow divider={divider} tone={tone} className={className} style={style}>\n {/* `group` so the arrow takes its hover state from the whole row. */}\n <div\n className={`group flex items-center w-full ${toggle ? 'cursor-pointer' : ''} ${\n sticky && expanded\n ? 'sticky z-[1] bg-[var(--malachite-card-background)]'\n : ''\n }`}\n style={sticky && expanded ? { top: stickyTopOffset } : undefined}\n // Presentational: the arrow below is the keyboard control, and this only\n // widens the pointer target.\n onClick={toggle}\n role=\"presentation\"\n >\n {/* Reserved whether or not this row opens, so a list stays in one column.\n The inset and gap match Accordion's header. */}\n <span className=\"shrink-0 flex items-center pl-[16px] pr-[12px]\">\n {toggle && (\n <button\n type=\"button\"\n className={`appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${FOCUS_RING_INSET}`}\n aria-expanded={expanded}\n aria-controls={bodyId}\n aria-label={ariaLabel}\n onClick={(event) => {\n event.stopPropagation();\n toggle();\n }}\n >\n <DisclosureArrow expanded={expanded} />\n </button>\n )}\n </span>\n {header}\n </div>\n {expanded && <div id={bodyId}>{children}</div>}\n </SurfaceRow>\n );\n },\n { Controls: ExpandableRowControls },\n);\n\ninterface SurfaceComponent extends React.FC<SurfaceProps> {\n Row: React.FC<AnySurfaceRowProps>;\n ExpandableRow: typeof SurfaceExpandableRow;\n}\n\nconst Surface = (({\n children,\n padding = false,\n overflow = 'hidden',\n shadow = true,\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}: SurfaceProps) => {\n // Literal class names (not interpolated) so Tailwind's JIT emits them.\n const overflowClass =\n overflow === 'clip'\n ? 'overflow-clip'\n : overflow === 'visible'\n ? 'overflow-visible'\n : 'overflow-hidden';\n return (\n <div\n className={`w-full rounded-[var(--malachite-radius-xxl,14px)] ${overflowClass} bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)] ${padding ? 'py-3 px-4' : ''} ${className}`}\n style={{\n ...(shadow ? { boxShadow: TRIPLE_SHADOW } : {}),\n ...FOREGROUND_RESET,\n ...style,\n }}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </div>\n );\n}) as SurfaceComponent;\n\nSurface.Row = SurfaceRow;\nSurface.ExpandableRow = SurfaceExpandableRow;\n\nexport default Surface;\nexport { Surface, SurfaceRow, SurfaceExpandableRow };\n"],"names":["INSET_CLASSES","TONE_CLASSES","TONE_FOREGROUNDS","REVEALED_ON_INTERACTION","TRIPLE_SHADOW","SurfaceRow","props","children","divider","disabled","selected","selection","tone","inset","className","style","asChild","onClick","rawHref","target","rel","trailing","revealTrailing","role","href","safeHref","ariaLabel","ariaLabelledBy","tabIndex","interactive","hover","tinted","toneClass","hasTrailing","isRenderableNode","insetClass","controlPadding","chromeClasses","controlClasses","FOCUS_RING_INSET","classes","paints","accent","selectedStyle","SELECTED_ROW_BACKGROUND","SELECTED_ROW_FOREGROUND","SELECTED_ROW_ACCENT","SELECTED_TEXT_CONTEXT","toneForeground","rowStyle","ariaChecked","ariaCurrent","rowFallbackAria","paintOnChild","control","jsx","resolveRel","jsxs","ExpandableRowControls","event","EXPANDABLE_ROW_LEAD_PX","SurfaceExpandableRow","header","expanded","onToggle","sticky","stickyTopOffset","bodyId","React","toggle","DisclosureArrow","Surface","padding","overflow","shadow","FOREGROUND_RESET"],"mappings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,IACxN,OAAO;AAAA,MACH,GAAI4D,IAAS,EAAE,WAAWtE,GAAA,IAAkB,CAAA;AAAA,MAC5C,GAAGuE;AAAA,MACH,GAAG5D;AAAA,IAAA;AAAA,IAEP,MAAAQ;AAAA,IACA,cAAYG;AAAA,IACZ,mBAAiBC;AAAA,IAEhB,UAAApB;AAAA,EAAA;AAAA;AAKbgE,EAAQ,MAAMlE;AACdkE,EAAQ,gBAAgBV;"}
|
|
1
|
+
{"version":3,"file":"Surface.js","sources":["../../src/components/Surface.tsx"],"sourcesContent":["import React from 'react';\nimport DisclosureArrow from './DisclosureArrow';\nimport { paintOnChild } from './asChild';\nimport { FOCUS_RING_INSET } from './focusRing';\nimport { resolveRel } from './linkRel';\nimport { isRenderableNode } from './renderableNode';\nimport { safeHref } from './safeHref';\nimport {\n FOREGROUND_RESET,\n SELECTED_ROW_ACCENT,\n SELECTED_ROW_BACKGROUND,\n SELECTED_ROW_FOREGROUND,\n SELECTED_TEXT_CONTEXT,\n} from './selectedRow';\n\nexport type SurfaceTone = 'default' | 'highlight';\n\nexport interface SurfaceProps {\n children?: React.ReactNode;\n padding?: boolean;\n /**\n * Content overflow. Defaults to `hidden` so children are clipped to the rounded\n * corners. Use `clip` to keep the rounded clipping WITHOUT creating a scroll\n * container — so a `position: sticky` descendant still pins (unlike `hidden`,\n * which traps it). `visible` disables clipping entirely.\n */\n overflow?: 'hidden' | 'visible' | 'clip';\n /**\n * `false` drops the elevation shadow, for a card that sits flat on its ground.\n * Default: `true`, or `false` with `tone=\"highlight\"`.\n */\n shadow?: boolean;\n /**\n * `highlight` paints the warm ground with no border and no shadow, for a static block that\n * stands out from the page, such as a hero or a guide's section header. Its ground is too\n * close to `Surface.Row`'s hover for clickable rows inside it.\n */\n tone?: SurfaceTone;\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\ninterface SurfaceRowChromeProps {\n children?: React.ReactNode;\n /** Renders a bottom divider — omit on the last row in a Surface. */\n divider?: boolean;\n /** Removes the hover affordance / disables the control (e.g. while loading/busy). */\n disabled?: boolean;\n /** Announces the row as selected — `aria-checked` under a `radio`/`checkbox` role,\n * `aria-current` otherwise — and paints `Table`'s selected treatment unless `selection`\n * says not to. `'mixed'` is for a `checkbox` row that is partly selected: it announces\n * `aria-checked=\"mixed\"` there, never paints and never marks the row current, and counts\n * as not selected under any other role. */\n selected?: boolean | 'mixed';\n /** How a `selected` row shows it. `highlight` paints the treatment; `tint` paints it\n * without the accent bar, for a menu whose choice is already marked inside the row;\n * `announce` leaves the visual to a control inside the row and only sets the ARIA state.\n * Defaults to `announce` under `role=\"checkbox\"` and `highlight` otherwise. */\n selection?: 'highlight' | 'tint' | 'announce';\n /**\n * Tints the whole row by what it reports. `muted` is a row whose subject is inactive —\n * not disabled: it stays interactive. `success` and `error` are for a row that carries\n * an outcome, where the result belongs to the whole line rather than to one cell in it.\n */\n tone?: 'default' | 'muted' | 'success' | 'error';\n /** `compact` is an 8px by 16px inset the row owns. */\n inset?: 'none' | 'compact';\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst INSET_CLASSES: Record<NonNullable<SurfaceRowChromeProps['inset']>, string> = {\n none: '',\n // The 16px is ROW_INSET_PX in accordionBodyInset.ts too; Accordion's bodyIndent gives it back.\n compact: 'px-[16px] py-[8px]',\n};\n\n/** Stays an interface under its original name: a consumer may `extends` it. */\nexport interface SurfaceRowProps extends SurfaceRowChromeProps {\n asChild?: false;\n /**\n * When provided, the whole row becomes clickable: it renders as a `<button>`\n * (or `<a>` when `href` is set), so the entire row is the click target with\n * native focus + Enter/Space — no manual tabIndex/key handlers. For a\n * selectable row, put a presentational `<Radio>`/`<Checkbox>` inside as the\n * visual indicator; do NOT nest an interactive control (invalid + double tab stop).\n */\n onClick?: (event: React.MouseEvent) => void;\n /** Renders the clickable row as an anchor instead of a button. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n /** Content pinned right, outside the row button, so it may hold its own control. */\n trailing?: React.ReactNode;\n /**\n * Shows `trailing` only while the row is hovered or holds focus, and while a menu\n * it opened is still open. Hidden by opacity, so it stays in the tab order; a touch screen,\n * which has no hover, always shows it.\n */\n revealTrailing?: boolean;\n /** ARIA role for a clickable row, e.g. `radio`/`checkbox` (wrap the list in a `radiogroup`). */\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** `-1` takes the row out of the Tab order, for a roving radio group. */\n tabIndex?: number;\n}\n\n/**\n * The outcome tones reuse the tag tokens rather than minting row ones, so a row saying \"this\n * passed\" and a tag saying it are the same green wherever the two sit together.\n */\nconst TONE_CLASSES: Record<NonNullable<SurfaceRowProps['tone']>, string> = {\n default: '',\n muted: 'bg-[var(--malachite-card-dimmed-background)]',\n success: 'bg-[var(--malachite-tag-success-background)]',\n error: 'bg-[var(--malachite-tag-error-background)]',\n};\n\n/**\n * The text an outcome tone carries with it, through the same context channel a selected row\n * uses, so `Typography` inside the row follows the tint instead of staying near-black on it.\n * `color` as well, for row content that is not Typography.\n *\n * Only the outcome tones. `muted` dims its subject rather than recolouring it, and its\n * foreground is the ordinary one.\n */\nconst TONE_FOREGROUNDS: Partial<Record<NonNullable<SurfaceRowProps['tone']>, string>> = {\n success: 'var(--malachite-tag-success-foreground)',\n error: 'var(--malachite-tag-error-foreground)',\n};\n\nexport interface SurfaceRowAsChildProps extends SurfaceRowChromeProps {\n asChild: true;\n children: React.ReactElement;\n}\n\nexport type AnySurfaceRowProps = SurfaceRowProps | SurfaceRowAsChildProps;\n\n// Not `group-hover` or `group-has-[:focus-visible]`: WebKit never applies the first (its\n// `@media (hover: hover)` nested in the group selector) nor the second inside a shadow root,\n// so the control stayed hidden in Safari. An open menu takes focus out of the row into a\n// portal, and would otherwise lose its trigger.\nconst REVEALED_ON_INTERACTION =\n 'opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100';\n\nconst TRIPLE_SHADOW =\n '0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)';\n\n/**\n * A single full-bleed row inside a <Surface>. Owns the row chrome — hover\n * highlight, colour transition and an optional bottom divider — so consumers\n * compose their own content inside without re-implementing design-system styling.\n * Pass `onClick`/`href` to make the entire row clickable (rendered as a real\n * button/anchor, so keyboard navigation works natively).\n */\nconst SurfaceRow: React.FC<AnySurfaceRowProps> = (props) => {\n const {\n children,\n divider = false,\n disabled = false,\n selected,\n selection,\n tone = 'default',\n inset = 'none',\n className = '',\n style,\n } = props;\n const asChild = props.asChild === true;\n const {\n onClick,\n href: rawHref,\n target,\n rel,\n trailing,\n revealTrailing,\n role,\n } = asChild ? ({} as SurfaceRowProps) : (props as SurfaceRowProps);\n // A rejected href (e.g. `javascript:`) leaves the row a button or a plain row, never an anchor.\n const href = safeHref(rawHref);\n const ariaLabel = asChild ? undefined : (props as SurfaceRowProps)['aria-label'];\n const ariaLabelledBy = asChild ? undefined : (props as SurfaceRowProps)['aria-labelledby'];\n const tabIndex = asChild ? undefined : (props as SurfaceRowProps).tabIndex;\n const interactive = Boolean(onClick || href);\n // `asChild` is interactive for the hover affordance only, not the focus/reset classes.\n const hover =\n disabled && (interactive || asChild)\n ? ''\n : 'transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]';\n\n // A class, not an inline colour, which would outrank the hover utility. It replaces the\n // button reset's `bg-transparent` rather than joining it: same specificity, so the winner\n // would be whichever Tailwind emitted last.\n const tinted = tone !== 'default';\n const toneClass = TONE_CLASSES[tone];\n\n const hasTrailing = !asChild && isRenderableNode(trailing);\n const insetClass = INSET_CLASSES[inset];\n const controlPadding = insetClass && !hasTrailing ? '' : 'p-0';\n\n const chromeClasses = [\n 'w-full text-left border-0',\n toneClass,\n divider ? 'border-b border-solid border-[var(--malachite-card-border)]' : '',\n hover,\n ]\n .filter(Boolean)\n .join(' ');\n\n const controlClasses = [\n interactive\n ? `appearance-none ${tinted ? '' : 'bg-transparent'} ${controlPadding} ${FOCUS_RING_INSET}`\n : '',\n interactive && !disabled ? 'cursor-pointer' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const classes = [chromeClasses, controlClasses, hasTrailing ? '' : insetClass, className]\n .filter(Boolean)\n .join(' ');\n\n const paints = selection ? selection !== 'announce' : role !== 'checkbox';\n const accent = selection !== 'tint';\n\n // A gradient layer so the tint composites over hover, and an inset shadow because\n // `ring-*` silently doesn't paint in a shadow root.\n const selectedStyle: React.CSSProperties =\n selected === true && paints\n ? {\n backgroundImage: `linear-gradient(${SELECTED_ROW_BACKGROUND}, ${SELECTED_ROW_BACKGROUND})`,\n color: SELECTED_ROW_FOREGROUND,\n ...(accent ? { boxShadow: `inset 2px 0 0 ${SELECTED_ROW_ACCENT}` } : {}),\n ...SELECTED_TEXT_CONTEXT,\n }\n : {};\n\n const toneForeground = TONE_FOREGROUNDS[tone];\n const toneStyle: React.CSSProperties = toneForeground\n ? ({\n color: toneForeground,\n '--malachite-ctx-text-primary': toneForeground,\n } as React.CSSProperties)\n : {};\n\n // `selected` last of the two: a row can be both, and selection is the state the reader is\n // acting on, so it wins the colour.\n const rowStyle = { ...toneStyle, ...selectedStyle, ...style };\n\n // Only a checkbox has a partly-checked state; a radio is chosen or not.\n const ariaChecked =\n role === 'checkbox' && selected === 'mixed'\n ? ('mixed' as const)\n : role === 'radio' || role === 'checkbox'\n ? selected === true\n : undefined;\n // `aria-current`, not `aria-pressed`: a selected row is one of many choices, not a toggle\n // (same call as `Dropdown`'s options). A role that carries its own state uses that instead.\n const ariaCurrent = ariaChecked === undefined && selected === true ? true : undefined;\n\n // Everything a control would have carried, for the branches that render none: the row\n // element is then the only thing assistive tech sees. `aria-disabled` because there is no\n // control to be natively disabled — and it is inert without a role, like the name.\n const rowFallbackAria = {\n role,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-disabled': role && disabled ? true : undefined,\n };\n\n if (asChild) {\n return paintOnChild(children, classes, rowStyle);\n }\n\n if (hasTrailing) {\n const control =\n href && !disabled ? (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${controlClasses} border-0 flex-1 min-w-0 text-left no-underline text-inherit`}\n role={role}\n tabIndex={tabIndex}\n aria-checked={ariaChecked}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </a>\n ) : onClick ? (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={`${controlClasses} border-0 flex-1 min-w-0 text-left`}\n role={role}\n tabIndex={tabIndex}\n aria-checked={ariaChecked}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </button>\n ) : (\n // The set goes here, not on the wrapper: `radio` and `checkbox` make their\n // descendants presentational, which would bury a control in the trailing slot.\n <div className=\"flex-1 min-w-0\" {...rowFallbackAria}>\n {children}\n </div>\n );\n\n return (\n <div\n className={[\n chromeClasses,\n 'flex items-center',\n insetClass,\n revealTrailing ? 'group/row' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={rowStyle}\n >\n {control}\n <div\n className={`shrink-0 flex items-center ${revealTrailing ? REVEALED_ON_INTERACTION : ''}`}\n >\n {trailing}\n </div>\n </div>\n );\n }\n\n if (href && !disabled) {\n return (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${classes} no-underline text-inherit`}\n style={rowStyle}\n role={role}\n tabIndex={tabIndex}\n aria-checked={ariaChecked}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </a>\n );\n }\n\n if (onClick) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={classes}\n style={rowStyle}\n role={role}\n tabIndex={tabIndex}\n aria-checked={ariaChecked}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </button>\n );\n }\n\n return (\n <div className={classes} style={rowStyle} {...rowFallbackAria}>\n {children}\n </div>\n );\n};\n\nexport interface SurfaceExpandableRowProps {\n /** The row itself, laid out across the line. May hold its own controls. */\n header: React.ReactNode;\n /** The body, rendered beneath the row while it is open. */\n children?: React.ReactNode;\n expanded: boolean;\n /** Omit for a row that cannot open. The arrow's space is still reserved, so a list of\n * rows stays in one column whether or not each one has a body. */\n onToggle?: (expanded: boolean) => void;\n /**\n * Pins the row while its body scrolls, so a long body never leaves the reader without\n * the line it belongs to. Offset by whatever is already pinned above it.\n */\n sticky?: boolean;\n stickyTopOffset?: number;\n divider?: boolean;\n tone?: SurfaceRowProps['tone'];\n /** Names the disclosure control, which is otherwise only an arrow. */\n 'aria-label'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\n/**\n * Stops a click inside it from toggling the row, for the cells that hold controls.\n *\n * Explicit rather than sniffing the event's target for an interactive ancestor: a control\n * rendering into a shadow root retargets the event to its host, so the sniff would miss\n * exactly the components most likely to sit in a row.\n */\nconst ExpandableRowControls: React.FC<{\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n}> = ({ children, className = '', style }) => (\n <div className={className} style={style} onClick={(event) => event.stopPropagation()}>\n {children}\n </div>\n);\n\n/**\n * A row that opens to reveal a body, for a line that carries its own controls.\n *\n * Not `Accordion`: that puts its header inside the toggle button, so a header holding a\n * dropdown or a second button is invalid. Here the row surface takes the click and a cell\n * opts out with `ExpandableRow.Controls`, while the arrow stays a real button so the\n * keyboard reaches it.\n */\n/**\n * The space before the header: the arrow's own inset, its glyph and the gap after it.\n * Exported so a consumer aligning a column header above these rows offsets by the same\n * amount instead of guessing at it.\n */\nexport const EXPANDABLE_ROW_LEAD_PX = 39;\n\nconst SurfaceExpandableRow: React.FC<SurfaceExpandableRowProps> & {\n Controls: typeof ExpandableRowControls;\n} = Object.assign(\n ({\n header,\n children,\n expanded,\n onToggle,\n sticky = false,\n stickyTopOffset = 0,\n divider = false,\n tone = 'default',\n 'aria-label': ariaLabel,\n className = '',\n style,\n }: SurfaceExpandableRowProps) => {\n const bodyId = React.useId();\n const toggle = onToggle ? () => onToggle(!expanded) : undefined;\n\n return (\n <SurfaceRow divider={divider} tone={tone} className={className} style={style}>\n {/* `group` so the arrow takes its hover state from the whole row. */}\n <div\n className={`group flex items-center w-full ${toggle ? 'cursor-pointer' : ''} ${\n sticky && expanded\n ? 'sticky z-[1] bg-[var(--malachite-card-background)]'\n : ''\n }`}\n style={sticky && expanded ? { top: stickyTopOffset } : undefined}\n // Presentational: the arrow below is the keyboard control, and this only\n // widens the pointer target.\n onClick={toggle}\n role=\"presentation\"\n >\n {/* Reserved whether or not this row opens, so a list stays in one column.\n The inset and gap match Accordion's header. */}\n <span className=\"shrink-0 flex items-center pl-[16px] pr-[12px]\">\n {toggle && (\n <button\n type=\"button\"\n className={`appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${FOCUS_RING_INSET}`}\n aria-expanded={expanded}\n aria-controls={bodyId}\n aria-label={ariaLabel}\n onClick={(event) => {\n event.stopPropagation();\n toggle();\n }}\n >\n <DisclosureArrow expanded={expanded} />\n </button>\n )}\n </span>\n {header}\n </div>\n {expanded && <div id={bodyId}>{children}</div>}\n </SurfaceRow>\n );\n },\n { Controls: ExpandableRowControls },\n);\n\ninterface SurfaceComponent extends React.FC<SurfaceProps> {\n Row: React.FC<AnySurfaceRowProps>;\n ExpandableRow: typeof SurfaceExpandableRow;\n}\n\nconst SURFACE_TONE_CLASSES: Record<SurfaceTone, string> = {\n default:\n 'bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]',\n highlight: 'bg-[var(--malachite-card-warm-background,rgb(244,242,240))]',\n};\n\nconst Surface = (({\n children,\n padding = false,\n overflow = 'hidden',\n tone = 'default',\n shadow = tone !== 'highlight',\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}: SurfaceProps) => {\n // Literal class names (not interpolated) so Tailwind's JIT emits them.\n const overflowClass =\n overflow === 'clip'\n ? 'overflow-clip'\n : overflow === 'visible'\n ? 'overflow-visible'\n : 'overflow-hidden';\n return (\n <div\n className={`w-full rounded-[var(--malachite-radius-xxl,14px)] ${overflowClass} ${SURFACE_TONE_CLASSES[tone]} ${padding ? 'py-3 px-4' : ''} ${className}`}\n style={{\n ...(shadow ? { boxShadow: TRIPLE_SHADOW } : {}),\n ...FOREGROUND_RESET,\n ...style,\n }}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </div>\n );\n}) as SurfaceComponent;\n\nSurface.Row = SurfaceRow;\nSurface.ExpandableRow = SurfaceExpandableRow;\n\nexport default Surface;\nexport { Surface, SurfaceRow, SurfaceExpandableRow };\n"],"names":["INSET_CLASSES","TONE_CLASSES","TONE_FOREGROUNDS","REVEALED_ON_INTERACTION","TRIPLE_SHADOW","SurfaceRow","props","children","divider","disabled","selected","selection","tone","inset","className","style","asChild","onClick","rawHref","target","rel","trailing","revealTrailing","role","href","safeHref","ariaLabel","ariaLabelledBy","tabIndex","interactive","hover","tinted","toneClass","hasTrailing","isRenderableNode","insetClass","controlPadding","chromeClasses","controlClasses","FOCUS_RING_INSET","classes","paints","accent","selectedStyle","SELECTED_ROW_BACKGROUND","SELECTED_ROW_FOREGROUND","SELECTED_ROW_ACCENT","SELECTED_TEXT_CONTEXT","toneForeground","rowStyle","ariaChecked","ariaCurrent","rowFallbackAria","paintOnChild","control","jsx","resolveRel","jsxs","ExpandableRowControls","event","EXPANDABLE_ROW_LEAD_PX","SurfaceExpandableRow","header","expanded","onToggle","sticky","stickyTopOffset","bodyId","React","toggle","DisclosureArrow","SURFACE_TONE_CLASSES","Surface","padding","overflow","shadow","FOREGROUND_RESET"],"mappings":";;;;;;;;;AA0EA,MAAMA,KAA6E;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,qBACA,iBAGyE,IAAIH,GAAqB3D,CAAI,CAAC,IAAI6D,IAAU,cAAc,EAAE,IAAI3D,CAAS;AAAA,IACtJ,OAAO;AAAA,MACH,GAAI6D,IAAS,EAAE,WAAWvE,GAAA,IAAkB,CAAA;AAAA,MAC5C,GAAGwE;AAAA,MACH,GAAG7D;AAAA,IAAA;AAAA,IAEP,MAAAQ;AAAA,IACA,cAAYG;AAAA,IACZ,mBAAiBC;AAAA,IAEhB,UAAApB;AAAA,EAAA;AAAA;AAKbiE,EAAQ,MAAMnE;AACdmE,EAAQ,gBAAgBX;"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs as t, Fragment as f, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as s } from "react";
|
|
3
|
+
import { Modal as g } from "./Modal.js";
|
|
4
|
+
import { FOCUS_RING as b, FOCUS_RING_INSET as p } from "./focusRing.js";
|
|
5
|
+
const C = ({ src: l, alt: o, title: i, onError: a }) => {
|
|
6
|
+
const [d, r] = s(!1), [c, m] = s(!1), n = () => r(!1), u = () => {
|
|
7
|
+
m(!0), r(!0);
|
|
8
|
+
};
|
|
9
|
+
return /* @__PURE__ */ t(f, { children: [
|
|
10
|
+
/* @__PURE__ */ e(
|
|
11
|
+
"button",
|
|
12
|
+
{
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-label": `Enlarge image: ${o}`,
|
|
15
|
+
onClick: u,
|
|
16
|
+
className: `block max-h-[240px] w-fit max-w-full cursor-zoom-in overflow-hidden rounded-lg border border-solid border-[var(--malachite-card-border)] bg-transparent p-0 ${b}`,
|
|
17
|
+
children: /* @__PURE__ */ e(
|
|
18
|
+
"img",
|
|
19
|
+
{
|
|
20
|
+
src: l,
|
|
21
|
+
alt: o,
|
|
22
|
+
loading: "lazy",
|
|
23
|
+
decoding: "async",
|
|
24
|
+
onError: a ? () => a() : void 0,
|
|
25
|
+
className: "block h-auto w-full"
|
|
26
|
+
},
|
|
27
|
+
l
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
c && /* @__PURE__ */ e(
|
|
32
|
+
g,
|
|
33
|
+
{
|
|
34
|
+
open: d,
|
|
35
|
+
onClose: n,
|
|
36
|
+
title: i || o,
|
|
37
|
+
size: "fullscreen",
|
|
38
|
+
surface: "none",
|
|
39
|
+
children: /* @__PURE__ */ t("div", { className: "relative flex h-full w-full items-center justify-center", children: [
|
|
40
|
+
/* @__PURE__ */ e(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
type: "button",
|
|
44
|
+
"aria-label": "Close enlarged image",
|
|
45
|
+
onClick: n,
|
|
46
|
+
className: `absolute inset-0 z-10 cursor-zoom-out border-0 bg-transparent p-0 ${p}`
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
"img",
|
|
51
|
+
{
|
|
52
|
+
src: l,
|
|
53
|
+
alt: o,
|
|
54
|
+
className: "max-h-full max-w-full rounded-lg object-contain"
|
|
55
|
+
},
|
|
56
|
+
l
|
|
57
|
+
)
|
|
58
|
+
] })
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] });
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
C as ZoomableImage,
|
|
65
|
+
C as default
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=ZoomableImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomableImage.js","sources":["../../src/components/ZoomableImage.tsx"],"sourcesContent":["import type React from 'react';\nimport { useState } from 'react';\nimport Modal from './Modal';\nimport { FOCUS_RING, FOCUS_RING_INSET } from './focusRing';\n\nexport interface ZoomableImageProps {\n src: string;\n /**\n * Describes the image. Required and non-empty: it names the thumbnail's button and the\n * enlarged view, so an empty `alt` leaves both unnamed.\n */\n alt: string;\n /** Names the enlarged view for assistive tech. Default: `alt`, also when `title` is empty. */\n title?: string;\n /**\n * The thumbnail failed to load, so the caller can leave the image out. A thumbnail loads\n * lazily, so for one below the fold this fires once it nears the viewport, not on render.\n */\n onError?: () => void;\n}\n\n/**\n * An image that enlarges on click, for a screenshot too detailed to read inline. The enlarged\n * image is as large as the window allows at its own aspect ratio, up to its natural size, and a\n * click anywhere closes it.\n */\nconst ZoomableImage: React.FC<ZoomableImageProps> = ({ src, alt, title, onError }) => {\n const [isEnlarged, setIsEnlarged] = useState(false);\n // Latched on first enlarge, so an idle thumbnail mounts no Modal; never reset, so the exit transition still plays.\n const [hasEnlarged, setHasEnlarged] = useState(false);\n const close = () => setIsEnlarged(false);\n const enlarge = () => {\n setHasEnlarged(true);\n setIsEnlarged(true);\n };\n\n return (\n <>\n <button\n type=\"button\"\n aria-label={`Enlarge image: ${alt}`}\n onClick={enlarge}\n className={`block max-h-[240px] w-fit max-w-full cursor-zoom-in overflow-hidden rounded-lg border border-solid border-[var(--malachite-card-border)] bg-transparent p-0 ${FOCUS_RING}`}\n >\n {/* At its own width up to the container's, never stretched. The button, not the image,\n caps the height and clips a tall image to its top: a `max-h` on the image would\n narrow it instead, and the button would fit that narrower width.\n Keyed on `src`: a reused <img> keeps drawing the old image until the new one loads. */}\n <img\n key={src}\n src={src}\n alt={alt}\n loading=\"lazy\"\n decoding=\"async\"\n onError={onError ? () => onError() : undefined}\n className=\"block h-auto w-full\"\n />\n </button>\n {hasEnlarged && (\n <Modal\n open={isEnlarged}\n onClose={close}\n title={title || alt}\n size=\"fullscreen\"\n surface=\"none\"\n >\n {/* The image sits beside the close button, not inside it: a button's children are\n presentational, so an image inside it would never reach assistive tech. */}\n <div className=\"relative flex h-full w-full items-center justify-center\">\n <button\n type=\"button\"\n aria-label=\"Close enlarged image\"\n onClick={close}\n className={`absolute inset-0 z-10 cursor-zoom-out border-0 bg-transparent p-0 ${FOCUS_RING_INSET}`}\n />\n <img\n key={src}\n src={src}\n alt={alt}\n className=\"max-h-full max-w-full rounded-lg object-contain\"\n />\n </div>\n </Modal>\n )}\n </>\n );\n};\n\nexport { ZoomableImage };\nexport default ZoomableImage;\n"],"names":["ZoomableImage","src","alt","title","onError","isEnlarged","setIsEnlarged","useState","hasEnlarged","setHasEnlarged","close","enlarge","jsxs","Fragment","jsx","FOCUS_RING","Modal","FOCUS_RING_INSET"],"mappings":";;;;AA0BA,MAAMA,IAA8C,CAAC,EAAE,KAAAC,GAAK,KAAAC,GAAK,OAAAC,GAAO,SAAAC,QAAc;AAClF,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAS,EAAK,GAE5C,CAACC,GAAaC,CAAc,IAAIF,EAAS,EAAK,GAC9CG,IAAQ,MAAMJ,EAAc,EAAK,GACjCK,IAAU,MAAM;AAClB,IAAAF,EAAe,EAAI,GACnBH,EAAc,EAAI;AAAA,EACtB;AAEA,SACI,gBAAAM,EAAAC,GAAA,EACI,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAK;AAAA,QACL,cAAY,kBAAkBZ,CAAG;AAAA,QACjC,SAASS;AAAA,QACT,WAAW,+JAA+JI,CAAU;AAAA,QAMpL,UAAA,gBAAAD;AAAA,UAAC;AAAA,UAAA;AAAA,YAEG,KAAAb;AAAA,YACA,KAAAC;AAAA,YACA,SAAQ;AAAA,YACR,UAAS;AAAA,YACT,SAASE,IAAU,MAAMA,EAAA,IAAY;AAAA,YACrC,WAAU;AAAA,UAAA;AAAA,UANLH;AAAA,QAAA;AAAA,MAOT;AAAA,IAAA;AAAA,IAEHO,KACG,gBAAAM;AAAA,MAACE;AAAA,MAAA;AAAA,QACG,MAAMX;AAAA,QACN,SAASK;AAAA,QACT,OAAOP,KAASD;AAAA,QAChB,MAAK;AAAA,QACL,SAAQ;AAAA,QAIR,UAAA,gBAAAU,EAAC,OAAA,EAAI,WAAU,2DACX,UAAA;AAAA,UAAA,gBAAAE;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,MAAK;AAAA,cACL,cAAW;AAAA,cACX,SAASJ;AAAA,cACT,WAAW,qEAAqEO,CAAgB;AAAA,YAAA;AAAA,UAAA;AAAA,UAEpG,gBAAAH;AAAA,YAAC;AAAA,YAAA;AAAA,cAEG,KAAAb;AAAA,cACA,KAAAC;AAAA,cACA,WAAU;AAAA,YAAA;AAAA,YAHLD;AAAA,UAAA;AAAA,QAIT,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,EACJ,GAER;AAER;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const n = { tight: 12, full: 16 }, P = 11, s = { default: 12, sunken: 16 }, l = 16, u = (t) => t ? n.tight : n.full, d = (t) => t ? s.sunken : s.default, G = ({
|
|
2
|
+
arrowPosition: t,
|
|
3
|
+
hasLeading: e,
|
|
4
|
+
sunken: o
|
|
5
|
+
}) => {
|
|
6
|
+
const c = u(e || t === "gutter"), g = t === "start" ? P + d(o) : 0;
|
|
7
|
+
return c + g - l;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
P as ARROW_PX,
|
|
11
|
+
s as TOGGLE_GAP_PX,
|
|
12
|
+
n as TOGGLE_PADDING_PX,
|
|
13
|
+
G as bodyInsetPx,
|
|
14
|
+
d as toggleGapPx,
|
|
15
|
+
u as togglePaddingLeftPx
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=accordionBodyInset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordionBodyInset.js","sources":["../../src/components/accordionBodyInset.ts"],"sourcesContent":["// The toggle's geometry, set inline by Accordion from these so the body inset cannot drift from it.\nexport const TOGGLE_PADDING_PX = { tight: 12, full: 16 };\nexport const ARROW_PX = 11;\nexport const TOGGLE_GAP_PX = { default: 12, sunken: 16 };\n// Surface.Row's `compact` inset, a class there; its note points here.\nconst ROW_INSET_PX = 16;\n\nexport const togglePaddingLeftPx = (tight: boolean): number =>\n tight ? TOGGLE_PADDING_PX.tight : TOGGLE_PADDING_PX.full;\n\nexport const toggleGapPx = (sunken: boolean): number =>\n sunken ? TOGGLE_GAP_PX.sunken : TOGGLE_GAP_PX.default;\n\n/** Body offset from the toggle's column edge, less the 16px inset a compact `Surface.Row` owns. */\nexport const bodyInsetPx = ({\n arrowPosition,\n hasLeading,\n sunken,\n}: {\n arrowPosition: 'start' | 'end' | 'gutter';\n hasLeading: boolean;\n sunken: boolean;\n}): number => {\n const padding = togglePaddingLeftPx(hasLeading || arrowPosition === 'gutter');\n const arrow = arrowPosition === 'start' ? ARROW_PX + toggleGapPx(sunken) : 0;\n return padding + arrow - ROW_INSET_PX;\n};\n"],"names":["TOGGLE_PADDING_PX","ARROW_PX","TOGGLE_GAP_PX","ROW_INSET_PX","togglePaddingLeftPx","tight","toggleGapPx","sunken","bodyInsetPx","arrowPosition","hasLeading","padding","arrow"],"mappings":"AACO,MAAMA,IAAoB,EAAE,OAAO,IAAI,MAAM,GAAA,GACvCC,IAAW,IACXC,IAAgB,EAAE,SAAS,IAAI,QAAQ,GAAA,GAE9CC,IAAe,IAERC,IAAsB,CAACC,MAChCA,IAAQL,EAAkB,QAAQA,EAAkB,MAE3CM,IAAc,CAACC,MACxBA,IAASL,EAAc,SAASA,EAAc,SAGrCM,IAAc,CAAC;AAAA,EACxB,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAH;AACJ,MAIc;AACV,QAAMI,IAAUP,EAAoBM,KAAcD,MAAkB,QAAQ,GACtEG,IAAQH,MAAkB,UAAUR,IAAWK,EAAYC,CAAM,IAAI;AAC3E,SAAOI,IAAUC,IAAQT;AAC7B;"}
|