@stackone/malachite 2.124.0 → 2.126.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 +9 -8
- package/dist/components/Card.js +17 -17
- package/dist/components/Card.js.map +1 -1
- package/dist/components/HexagonScale.js +25 -10
- package/dist/components/HexagonScale.js.map +1 -1
- package/dist/components/Input/Input.js +176 -195
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/KeyValueStrip.js +57 -41
- package/dist/components/KeyValueStrip.js.map +1 -1
- package/dist/components/PillButton.js +68 -45
- package/dist/components/PillButton.js.map +1 -1
- package/dist/components/ScoreMeter.js +79 -0
- package/dist/components/ScoreMeter.js.map +1 -0
- package/dist/components/Table/Table.js +3 -2
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Timeline.js +88 -77
- package/dist/components/Timeline.js.map +1 -1
- package/dist/components/Typography/Text.js +27 -24
- package/dist/components/Typography/Text.js.map +1 -1
- package/dist/components/overlayBehaviour.js +8 -9
- package/dist/components/overlayBehaviour.js.map +1 -1
- package/dist/index.d.ts +41 -2
- package/dist/index.js +293 -291
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { Tag as
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useId as j } from "react";
|
|
3
|
+
import { Tag as F } from "./Tag.js";
|
|
4
4
|
import o from "./Typography/Text.js";
|
|
5
|
-
import { getFontWeight as
|
|
6
|
-
import { devWarning as
|
|
5
|
+
import { getFontWeight as W, getFontFamily as E } from "./Typography/textStyles.js";
|
|
6
|
+
import { devWarning as O } from "./devWarning.js";
|
|
7
|
+
import { isRenderableNode as v } from "./renderableNode.js";
|
|
7
8
|
const p = {
|
|
8
9
|
neutral: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
9
10
|
info: "var(--malachite-text-info, rgb(12, 88, 174))",
|
|
10
11
|
success: "var(--malachite-text-success, rgb(2, 122, 66))",
|
|
11
12
|
warning: "var(--malachite-text-warning, rgb(150, 88, 10))",
|
|
12
13
|
error: "var(--malachite-text-error, rgb(237, 53, 54))"
|
|
13
|
-
},
|
|
14
|
-
fontFamily:
|
|
15
|
-
fontWeight:
|
|
14
|
+
}, R = {
|
|
15
|
+
fontFamily: E("mono"),
|
|
16
|
+
fontWeight: W("semi-bold"),
|
|
16
17
|
fontSize: "0.92em",
|
|
17
18
|
wordSpacing: "-0.25em",
|
|
18
19
|
marginLeft: "0.08em"
|
|
19
|
-
},
|
|
20
|
+
}, A = /* @__PURE__ */ e(
|
|
20
21
|
"svg",
|
|
21
22
|
{
|
|
22
23
|
"data-timeline-skipped": "",
|
|
@@ -33,34 +34,58 @@ const p = {
|
|
|
33
34
|
}
|
|
34
35
|
)
|
|
35
36
|
}
|
|
36
|
-
),
|
|
37
|
+
), D = ({
|
|
37
38
|
title: n,
|
|
39
|
+
eyebrow: s,
|
|
38
40
|
titleCode: t,
|
|
39
41
|
time: l,
|
|
40
|
-
tone:
|
|
42
|
+
tone: N,
|
|
41
43
|
marker: h,
|
|
42
44
|
icon: f,
|
|
43
|
-
skipped:
|
|
45
|
+
skipped: i = !1,
|
|
44
46
|
stopped: g = !1,
|
|
45
47
|
stoppedLabel: m,
|
|
46
48
|
skippedLabel: d,
|
|
47
49
|
meta: w = [],
|
|
48
|
-
children:
|
|
49
|
-
className:
|
|
50
|
+
children: y,
|
|
51
|
+
className: T = ""
|
|
50
52
|
}) => {
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
+
const $ = j();
|
|
54
|
+
if (i && g) {
|
|
53
55
|
const r = typeof n == "string" ? n : "";
|
|
54
|
-
|
|
55
|
-
`Timeline.Item.skipped+stopped:${r ||
|
|
56
|
+
O(
|
|
57
|
+
`Timeline.Item.skipped+stopped:${r || $}`,
|
|
56
58
|
`Timeline.Item${r ? ` "${r}"` : " (with a non-string title)"} got both \`skipped\` and \`stopped\`; a step that never ran can't be the one the flow ended on, so the badge is dropped.`
|
|
57
59
|
);
|
|
58
60
|
}
|
|
59
|
-
const x = g && !
|
|
61
|
+
const x = g && !i, c = N ?? (x ? "error" : "neutral"), z = i ? A : h, S = !i && !!h, b = t == null ? void 0 : t.trim(), u = /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-wrap items-center gap-x-[8px] gap-y-[4px] [overflow-wrap:anywhere]", children: [
|
|
62
|
+
/* @__PURE__ */ a(o, { size: "small", fontWeight: "bold", className: "min-w-0 leading-[18px]", children: [
|
|
63
|
+
n,
|
|
64
|
+
b && /* @__PURE__ */ a(_, { children: [
|
|
65
|
+
n ? " " : null,
|
|
66
|
+
/* @__PURE__ */ e("span", { translate: "no", style: R, children: b })
|
|
67
|
+
] })
|
|
68
|
+
] }),
|
|
69
|
+
i && /* @__PURE__ */ a("span", { className: "sr-only", children: [
|
|
70
|
+
", ",
|
|
71
|
+
(d == null ? void 0 : d.trim()) || "skipped"
|
|
72
|
+
] }),
|
|
73
|
+
x && /* @__PURE__ */ e("span", { className: "sr-only", children: ", " }),
|
|
74
|
+
x && /* @__PURE__ */ e(
|
|
75
|
+
F,
|
|
76
|
+
{
|
|
77
|
+
value: (m == null ? void 0 : m.trim()) || "Stopped here",
|
|
78
|
+
type: "error",
|
|
79
|
+
fontSize: "xsmall",
|
|
80
|
+
textTransform: "none",
|
|
81
|
+
paddingSize: "compact"
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] });
|
|
60
85
|
return /* @__PURE__ */ a(
|
|
61
86
|
"li",
|
|
62
87
|
{
|
|
63
|
-
className: `relative m-0 flex gap-[14px] pb-[40px] last:pb-0 [&:last-child>[data-timeline-line]]:hidden ${
|
|
88
|
+
className: `relative m-0 flex gap-[14px] pb-[40px] last:pb-0 [&:last-child>[data-timeline-line]]:hidden ${T}`,
|
|
64
89
|
children: [
|
|
65
90
|
/* @__PURE__ */ e(
|
|
66
91
|
"span",
|
|
@@ -74,65 +99,51 @@ const p = {
|
|
|
74
99
|
"span",
|
|
75
100
|
{
|
|
76
101
|
"aria-hidden": "true",
|
|
77
|
-
className: `flex h-[24px] w-[24px] flex-none items-center justify-center overflow-hidden rounded-full ${
|
|
78
|
-
children:
|
|
102
|
+
className: `flex h-[24px] w-[24px] flex-none items-center justify-center overflow-hidden rounded-full ${S ? "" : "border border-solid border-[var(--malachite-card-border,rgb(232,232,232))]"}`,
|
|
103
|
+
children: z || (f ? /* @__PURE__ */ e(
|
|
79
104
|
"span",
|
|
80
105
|
{
|
|
81
|
-
"data-timeline-icon":
|
|
106
|
+
"data-timeline-icon": c,
|
|
82
107
|
className: "flex h-[14px] w-[14px] items-center justify-center overflow-hidden [&>*]:max-h-full [&>*]:max-w-full [&_svg]:max-h-[14px] [&_svg]:max-w-[14px]",
|
|
83
|
-
style: { color: p[
|
|
108
|
+
style: { color: p[c] },
|
|
84
109
|
children: f
|
|
85
110
|
}
|
|
86
111
|
) : /* @__PURE__ */ e(
|
|
87
112
|
"span",
|
|
88
113
|
{
|
|
89
|
-
"data-timeline-dot":
|
|
114
|
+
"data-timeline-dot": c,
|
|
90
115
|
className: "h-[8px] w-[8px] rounded-full",
|
|
91
|
-
style: { backgroundColor: p[
|
|
116
|
+
style: { backgroundColor: p[c] }
|
|
92
117
|
}
|
|
93
118
|
))
|
|
94
119
|
}
|
|
95
120
|
),
|
|
96
121
|
/* @__PURE__ */ a("div", { className: "flex min-w-0 flex-1 flex-col gap-[8px] pt-[2px]", children: [
|
|
97
|
-
/* @__PURE__ */ a(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/* @__PURE__ */ e(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
(l || l === 0) && /* @__PURE__ */ e("span", { className: "sr-only", children: ", " }),
|
|
123
|
-
(l || l === 0) && /* @__PURE__ */ e(
|
|
124
|
-
o,
|
|
125
|
-
{
|
|
126
|
-
size: "xsmall",
|
|
127
|
-
color: "secondary",
|
|
128
|
-
font: "mono",
|
|
129
|
-
wrap: !1,
|
|
130
|
-
className: "pt-[2px]",
|
|
131
|
-
children: l
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
] }),
|
|
135
|
-
w.length > 0 && /* @__PURE__ */ e("dl", { className: "m-0 flex flex-wrap gap-x-[18px] gap-y-[6px] leading-[16px]", children: w.map((r, S) => /* @__PURE__ */ a(
|
|
122
|
+
/* @__PURE__ */ a(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: `flex justify-between gap-[12px] ${v(s) ? "items-end" : "items-start"}`,
|
|
126
|
+
children: [
|
|
127
|
+
v(s) ? /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col gap-[2px]", children: [
|
|
128
|
+
/* @__PURE__ */ e(o, { size: "xsmall", color: "secondary", fontWeight: "semi-bold", children: s }),
|
|
129
|
+
u
|
|
130
|
+
] }) : u,
|
|
131
|
+
(l || l === 0) && /* @__PURE__ */ e("span", { className: "sr-only", children: ", " }),
|
|
132
|
+
(l || l === 0) && /* @__PURE__ */ e(
|
|
133
|
+
o,
|
|
134
|
+
{
|
|
135
|
+
size: "xsmall",
|
|
136
|
+
color: "secondary",
|
|
137
|
+
font: "mono",
|
|
138
|
+
wrap: !1,
|
|
139
|
+
className: "pt-[2px]",
|
|
140
|
+
children: l
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
w.length > 0 && /* @__PURE__ */ e("dl", { className: "m-0 flex flex-wrap gap-x-[18px] gap-y-[6px] leading-[16px]", children: w.map((r, I) => /* @__PURE__ */ a(
|
|
136
147
|
"div",
|
|
137
148
|
{
|
|
138
149
|
className: "flex min-w-0 items-baseline gap-[3px]",
|
|
@@ -141,31 +152,31 @@ const p = {
|
|
|
141
152
|
/* @__PURE__ */ e("dd", { className: "m-0 flex min-w-0 [overflow-wrap:anywhere]", children: /* @__PURE__ */ e(o, { size: "xsmall", font: "mono", children: r.value }) })
|
|
142
153
|
]
|
|
143
154
|
},
|
|
144
|
-
`${r.label}-${
|
|
155
|
+
`${r.label}-${I}`
|
|
145
156
|
)) }),
|
|
146
|
-
|
|
157
|
+
y
|
|
147
158
|
] })
|
|
148
159
|
]
|
|
149
160
|
}
|
|
150
161
|
);
|
|
151
|
-
},
|
|
162
|
+
}, M = ({
|
|
152
163
|
children: n,
|
|
153
|
-
className:
|
|
154
|
-
"aria-label":
|
|
155
|
-
"aria-labelledby":
|
|
164
|
+
className: s = "",
|
|
165
|
+
"aria-label": t,
|
|
166
|
+
"aria-labelledby": l
|
|
156
167
|
}) => /* @__PURE__ */ e(
|
|
157
168
|
"ol",
|
|
158
169
|
{
|
|
159
170
|
role: "list",
|
|
160
|
-
"aria-label":
|
|
161
|
-
"aria-labelledby":
|
|
162
|
-
className: `m-0 list-none p-0 ${
|
|
171
|
+
"aria-label": t,
|
|
172
|
+
"aria-labelledby": l,
|
|
173
|
+
className: `m-0 list-none p-0 ${s}`,
|
|
163
174
|
children: n
|
|
164
175
|
}
|
|
165
176
|
);
|
|
166
|
-
|
|
177
|
+
M.Item = D;
|
|
167
178
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
M as Timeline,
|
|
180
|
+
M as default
|
|
170
181
|
};
|
|
171
182
|
//# sourceMappingURL=Timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.js","sources":["../../src/components/Timeline.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport Tag from './Tag';\nimport Text from './Typography/Text';\nimport { getFontFamily, getFontWeight } from './Typography/textStyles';\nimport { devWarning } from './devWarning';\n\nexport type TimelineTone = 'neutral' | 'info' | 'success' | 'warning' | 'error';\n\nexport interface TimelineProps {\n children: React.ReactNode;\n className?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport interface TimelineMetaEntry {\n label: string;\n value: React.ReactNode;\n}\n\nexport interface TimelineItemProps {\n title: React.ReactNode;\n /**\n * Code set after the title in the mono face, as one phrase with it, e.g. `title=\"n8n called\"`\n * with `titleCode=\"Salesforce | Delete contact\"`.\n */\n titleCode?: string;\n /** When the step happened, shown at the right of the title, e.g. `+6 ms`. */\n time?: React.ReactNode;\n /**\n * Paints the dot or the `icon`: `error` on a `stopped` step, else `neutral`, unless set. Colour\n * alone, so the title has to say what happened. Ignored when `skipped` or `marker` is set.\n */\n tone?: TimelineTone;\n /** Replaces the ringed dot with a 24px circle of its own, e.g. the caller's logo at size 24. Decorative: hidden from assistive tech. */\n marker?: React.ReactNode;\n /**\n * A 12-14px glyph drawn inside the ring in place of the dot, e.g. `<McpIcon size={13} />`, painted\n * by `tone` through `currentColor`. Use a filled glyph: inside the shadow root every unmarked svg\n * path is filled, so a stroke-only icon turns solid.\n * Decorative: hidden from assistive tech, so the title has to say what it stands for.\n * Precedence: `skipped`, then `marker`, then `icon`, then the dot.\n */\n icon?: React.ReactNode;\n /** A step that never ran: a grey chevron replaces the dot, `tone`, `marker` and `icon`. Wins over `stopped`. */\n skipped?: boolean;\n /** Marks the step the flow ended on, with a badge after the title. Ignored when `skipped`. */\n stopped?: boolean;\n /** The badge's text when `stopped`. Empty falls back to \"Stopped here\". */\n stoppedLabel?: string;\n /** Read to assistive tech after the title when `skipped`. Empty falls back to \"skipped\". */\n skippedLabel?: string;\n /** Label and value pairs in a wrapping row under the title. */\n meta?: readonly TimelineMetaEntry[];\n /**\n * The step's detail, below the title: tags, copy, payloads. Each child is a row of its own, 8px\n * apart, and unstyled, so wrap copy in `Typography.Text`.\n */\n children?: React.ReactNode;\n className?: string;\n}\n\n// The light theme's values as fallbacks: the dot paints before the theme reaches `:host`.\nconst DOT_COLOR: Record<TimelineTone, string> = {\n neutral: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n info: 'var(--malachite-text-info, rgb(12, 88, 174))',\n success: 'var(--malachite-text-success, rgb(2, 122, 66))',\n warning: 'var(--malachite-text-warning, rgb(150, 88, 10))',\n error: 'var(--malachite-text-error, rgb(237, 53, 54))',\n};\n\n// Mono runs wider than Inter, so it sits a touch under the title, at 0.92em of whatever size the\n// title is, and colour is the title's. A mono space is as wide as a letter, about twice the\n// title's, so the word spacing closes it to match, and a hair of margin evens the gap before it.\nconst TITLE_CODE_STYLE: React.CSSProperties = {\n fontFamily: getFontFamily('mono'),\n fontWeight: getFontWeight('semi-bold'),\n fontSize: '0.92em',\n wordSpacing: '-0.25em',\n marginLeft: '0.08em',\n};\n\nconst SKIPPED_MARK = (\n <svg\n data-timeline-skipped=\"\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n className=\"block\"\n style={{ color: DOT_COLOR.neutral }}\n >\n <path\n fill=\"currentColor\"\n d=\"M5.15 9.85l6 6a1.2 1.2 0 0 0 1.7 0l6-6A1.2 1.2 0 0 0 17.15 8.15L12 13.3 6.85 8.15A1.2 1.2 0 0 0 5.15 9.85Z\"\n />\n </svg>\n);\n\nconst Item: React.FC<TimelineItemProps> = ({\n title,\n titleCode,\n time,\n tone,\n marker,\n icon,\n skipped = false,\n stopped = false,\n stoppedLabel,\n skippedLabel,\n meta = [],\n children,\n className = '',\n}) => {\n const id = useId();\n if (skipped && stopped) {\n const name = typeof title === 'string' ? title : '';\n devWarning(\n `Timeline.Item.skipped+stopped:${name || id}`,\n `Timeline.Item${name ? ` \"${name}\"` : ' (with a non-string title)'} got both \\`skipped\\` and \\`stopped\\`; a step that never ran can't be the one the flow ended on, so the badge is dropped.`,\n );\n }\n const isStopped = stopped && !skipped;\n const dotTone = tone ?? (isStopped ? 'error' : 'neutral');\n const shownMarker = skipped ? SKIPPED_MARK : marker;\n const ringless = !skipped && Boolean(marker);\n const code = titleCode?.trim();\n return (\n <li\n className={`relative m-0 flex gap-[14px] pb-[40px] last:pb-0 [&:last-child>[data-timeline-line]]:hidden ${className}`}\n >\n <span\n data-timeline-line=\"\"\n aria-hidden=\"true\"\n className=\"absolute start-[11px] top-[26px] bottom-[2px] w-[2px] bg-[var(--malachite-card-border,rgb(232,232,232))]\"\n />\n <span\n aria-hidden=\"true\"\n // The ring's border would cut into a marker, so a marker gets the full 24px circle instead.\n className={`flex h-[24px] w-[24px] flex-none items-center justify-center overflow-hidden rounded-full ${ringless ? '' : 'border border-solid border-[var(--malachite-card-border,rgb(232,232,232))]'}`}\n >\n {shownMarker ||\n (icon ? (\n <span\n data-timeline-icon={dotTone}\n className=\"flex h-[14px] w-[14px] items-center justify-center overflow-hidden [&>*]:max-h-full [&>*]:max-w-full [&_svg]:max-h-[14px] [&_svg]:max-w-[14px]\"\n style={{ color: DOT_COLOR[dotTone] }}\n >\n {icon}\n </span>\n ) : (\n <span\n data-timeline-dot={dotTone}\n className=\"h-[8px] w-[8px] rounded-full\"\n style={{ backgroundColor: DOT_COLOR[dotTone] }}\n />\n ))}\n </span>\n <div className=\"flex min-w-0 flex-1 flex-col gap-[8px] pt-[2px]\">\n <div className=\"flex items-start justify-between gap-[12px]\">\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-[8px] gap-y-[4px] [overflow-wrap:anywhere]\">\n <Text size=\"small\" fontWeight=\"bold\" className=\"min-w-0 leading-[18px]\">\n {title}\n {code && (\n <>\n {title ? ' ' : null}\n <span translate=\"no\" style={TITLE_CODE_STYLE}>\n {code}\n </span>\n </>\n )}\n </Text>\n {skipped && (\n <span className=\"sr-only\">, {skippedLabel?.trim() || 'skipped'}</span>\n )}\n {isStopped && <span className=\"sr-only\">, </span>}\n {isStopped && (\n <Tag\n value={stoppedLabel?.trim() || 'Stopped here'}\n type=\"error\"\n fontSize=\"xsmall\"\n textTransform=\"none\"\n paddingSize=\"compact\"\n />\n )}\n </div>\n {(time || time === 0) && <span className=\"sr-only\">, </span>}\n {(time || time === 0) && (\n <Text\n size=\"xsmall\"\n color=\"secondary\"\n font=\"mono\"\n wrap={false}\n className=\"pt-[2px]\"\n >\n {time}\n </Text>\n )}\n </div>\n {meta.length > 0 && (\n <dl className=\"m-0 flex flex-wrap gap-x-[18px] gap-y-[6px] leading-[16px]\">\n {meta.map((entry, index) => (\n <div\n key={`${entry.label}-${index}`}\n className=\"flex min-w-0 items-baseline gap-[3px]\"\n >\n <dt className=\"flex\">\n <Text size=\"xsmall\" color=\"secondary\">\n {entry.label}\n </Text>\n </dt>\n <dd className=\"m-0 flex min-w-0 [overflow-wrap:anywhere]\">\n <Text size=\"xsmall\" font=\"mono\">\n {entry.value}\n </Text>\n </dd>\n </div>\n ))}\n </dl>\n )}\n {children}\n </div>\n </li>\n );\n};\n\n/** A vertical sequence of steps, each with a dot on a connecting line, a title, its timing and a body. */\nconst Timeline: React.FC<TimelineProps> & { Item: typeof Item } = ({\n children,\n className = '',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => (\n <ol\n // list-style: none strips list semantics in WebKit, so VoiceOver would not announce the steps.\n role=\"list\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={`m-0 list-none p-0 ${className}`}\n >\n {children}\n </ol>\n);\n\nTimeline.Item = Item;\n\nexport default Timeline;\nexport { Timeline };\n"],"names":["DOT_COLOR","TITLE_CODE_STYLE","getFontFamily","getFontWeight","SKIPPED_MARK","jsx","Item","title","titleCode","time","tone","marker","icon","skipped","stopped","stoppedLabel","skippedLabel","meta","children","className","id","useId","name","devWarning","isStopped","dotTone","shownMarker","ringless","code","jsxs","Text","Fragment","Tag","entry","index","Timeline","ariaLabel","ariaLabelledBy"],"mappings":";;;;;;AA+DA,MAAMA,IAA0C;AAAA,EAC5C,SAAS;AA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AAAA,EAAA;AAGZ,GAGMiB,IAA4D,CAAC;AAAA,EAC/D,UAAAjB;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,cAAciB;AAAA,EACd,mBAAmBC;AACvB,MACI,gBAAAhC;AAAA,EAAC;AAAA,EAAA;AAAA,IAEG,MAAK;AAAA,IACL,cAAY+B;AAAA,IACZ,mBAAiBC;AAAA,IACjB,WAAW,qBAAqBlB,CAAS;AAAA,IAExC,UAAAD;AAAA,EAAA;AACL;AAGJiB,EAAS,OAAO7B;"}
|
|
1
|
+
{"version":3,"file":"Timeline.js","sources":["../../src/components/Timeline.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport Tag from './Tag';\nimport Text from './Typography/Text';\nimport { getFontFamily, getFontWeight } from './Typography/textStyles';\nimport { devWarning } from './devWarning';\nimport { isRenderableNode } from './renderableNode';\n\nexport type TimelineTone = 'neutral' | 'info' | 'success' | 'warning' | 'error';\n\nexport interface TimelineProps {\n children: React.ReactNode;\n className?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport interface TimelineMetaEntry {\n label: string;\n value: React.ReactNode;\n}\n\nexport interface TimelineItemProps {\n title: React.ReactNode;\n eyebrow?: React.ReactNode;\n /**\n * Code set after the title in the mono face, as one phrase with it, e.g. `title=\"n8n called\"`\n * with `titleCode=\"Salesforce | Delete contact\"`.\n */\n titleCode?: string;\n /** When the step happened, shown at the right of the title, e.g. `+6 ms`. */\n time?: React.ReactNode;\n /**\n * Paints the dot or the `icon`: `error` on a `stopped` step, else `neutral`, unless set. Colour\n * alone, so the title has to say what happened. Ignored when `skipped` or `marker` is set.\n */\n tone?: TimelineTone;\n /** Replaces the ringed dot with a 24px circle of its own, e.g. the caller's logo at size 24. Decorative: hidden from assistive tech. */\n marker?: React.ReactNode;\n /**\n * A 12-14px glyph drawn inside the ring in place of the dot, e.g. `<McpIcon size={13} />`, painted\n * by `tone` through `currentColor`. Use a filled glyph: inside the shadow root every unmarked svg\n * path is filled, so a stroke-only icon turns solid.\n * Decorative: hidden from assistive tech, so the title has to say what it stands for.\n * Precedence: `skipped`, then `marker`, then `icon`, then the dot.\n */\n icon?: React.ReactNode;\n /** A step that never ran: a grey chevron replaces the dot, `tone`, `marker` and `icon`. Wins over `stopped`. */\n skipped?: boolean;\n /** Marks the step the flow ended on, with a badge after the title. Ignored when `skipped`. */\n stopped?: boolean;\n /** The badge's text when `stopped`. Empty falls back to \"Stopped here\". */\n stoppedLabel?: string;\n /** Read to assistive tech after the title when `skipped`. Empty falls back to \"skipped\". */\n skippedLabel?: string;\n /** Label and value pairs in a wrapping row under the title. */\n meta?: readonly TimelineMetaEntry[];\n /**\n * The step's detail, below the title: tags, copy, payloads. Each child is a row of its own, 8px\n * apart, and unstyled, so wrap copy in `Typography.Text`.\n */\n children?: React.ReactNode;\n className?: string;\n}\n\n// The light theme's values as fallbacks: the dot paints before the theme reaches `:host`.\nconst DOT_COLOR: Record<TimelineTone, string> = {\n neutral: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n info: 'var(--malachite-text-info, rgb(12, 88, 174))',\n success: 'var(--malachite-text-success, rgb(2, 122, 66))',\n warning: 'var(--malachite-text-warning, rgb(150, 88, 10))',\n error: 'var(--malachite-text-error, rgb(237, 53, 54))',\n};\n\n// Mono runs wider than Inter, so it sits a touch under the title, at 0.92em of whatever size the\n// title is, and colour is the title's. A mono space is as wide as a letter, about twice the\n// title's, so the word spacing closes it to match, and a hair of margin evens the gap before it.\nconst TITLE_CODE_STYLE: React.CSSProperties = {\n fontFamily: getFontFamily('mono'),\n fontWeight: getFontWeight('semi-bold'),\n fontSize: '0.92em',\n wordSpacing: '-0.25em',\n marginLeft: '0.08em',\n};\n\nconst SKIPPED_MARK = (\n <svg\n data-timeline-skipped=\"\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n className=\"block\"\n style={{ color: DOT_COLOR.neutral }}\n >\n <path\n fill=\"currentColor\"\n d=\"M5.15 9.85l6 6a1.2 1.2 0 0 0 1.7 0l6-6A1.2 1.2 0 0 0 17.15 8.15L12 13.3 6.85 8.15A1.2 1.2 0 0 0 5.15 9.85Z\"\n />\n </svg>\n);\n\nconst Item: React.FC<TimelineItemProps> = ({\n title,\n eyebrow,\n titleCode,\n time,\n tone,\n marker,\n icon,\n skipped = false,\n stopped = false,\n stoppedLabel,\n skippedLabel,\n meta = [],\n children,\n className = '',\n}) => {\n const id = useId();\n if (skipped && stopped) {\n const name = typeof title === 'string' ? title : '';\n devWarning(\n `Timeline.Item.skipped+stopped:${name || id}`,\n `Timeline.Item${name ? ` \"${name}\"` : ' (with a non-string title)'} got both \\`skipped\\` and \\`stopped\\`; a step that never ran can't be the one the flow ended on, so the badge is dropped.`,\n );\n }\n const isStopped = stopped && !skipped;\n const dotTone = tone ?? (isStopped ? 'error' : 'neutral');\n const shownMarker = skipped ? SKIPPED_MARK : marker;\n const ringless = !skipped && Boolean(marker);\n const code = titleCode?.trim();\n const titleRow = (\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-[8px] gap-y-[4px] [overflow-wrap:anywhere]\">\n <Text size=\"small\" fontWeight=\"bold\" className=\"min-w-0 leading-[18px]\">\n {title}\n {code && (\n <>\n {title ? ' ' : null}\n <span translate=\"no\" style={TITLE_CODE_STYLE}>\n {code}\n </span>\n </>\n )}\n </Text>\n {skipped && <span className=\"sr-only\">, {skippedLabel?.trim() || 'skipped'}</span>}\n {isStopped && <span className=\"sr-only\">, </span>}\n {isStopped && (\n <Tag\n value={stoppedLabel?.trim() || 'Stopped here'}\n type=\"error\"\n fontSize=\"xsmall\"\n textTransform=\"none\"\n paddingSize=\"compact\"\n />\n )}\n </div>\n );\n return (\n <li\n className={`relative m-0 flex gap-[14px] pb-[40px] last:pb-0 [&:last-child>[data-timeline-line]]:hidden ${className}`}\n >\n <span\n data-timeline-line=\"\"\n aria-hidden=\"true\"\n className=\"absolute start-[11px] top-[26px] bottom-[2px] w-[2px] bg-[var(--malachite-card-border,rgb(232,232,232))]\"\n />\n <span\n aria-hidden=\"true\"\n // The ring's border would cut into a marker, so a marker gets the full 24px circle instead.\n className={`flex h-[24px] w-[24px] flex-none items-center justify-center overflow-hidden rounded-full ${ringless ? '' : 'border border-solid border-[var(--malachite-card-border,rgb(232,232,232))]'}`}\n >\n {shownMarker ||\n (icon ? (\n <span\n data-timeline-icon={dotTone}\n className=\"flex h-[14px] w-[14px] items-center justify-center overflow-hidden [&>*]:max-h-full [&>*]:max-w-full [&_svg]:max-h-[14px] [&_svg]:max-w-[14px]\"\n style={{ color: DOT_COLOR[dotTone] }}\n >\n {icon}\n </span>\n ) : (\n <span\n data-timeline-dot={dotTone}\n className=\"h-[8px] w-[8px] rounded-full\"\n style={{ backgroundColor: DOT_COLOR[dotTone] }}\n />\n ))}\n </span>\n <div className=\"flex min-w-0 flex-1 flex-col gap-[8px] pt-[2px]\">\n <div\n className={`flex justify-between gap-[12px] ${isRenderableNode(eyebrow) ? 'items-end' : 'items-start'}`}\n >\n {isRenderableNode(eyebrow) ? (\n <div className=\"flex min-w-0 flex-col gap-[2px]\">\n <Text size=\"xsmall\" color=\"secondary\" fontWeight=\"semi-bold\">\n {eyebrow}\n </Text>\n {titleRow}\n </div>\n ) : (\n titleRow\n )}\n {(time || time === 0) && <span className=\"sr-only\">, </span>}\n {(time || time === 0) && (\n <Text\n size=\"xsmall\"\n color=\"secondary\"\n font=\"mono\"\n wrap={false}\n className=\"pt-[2px]\"\n >\n {time}\n </Text>\n )}\n </div>\n {meta.length > 0 && (\n <dl className=\"m-0 flex flex-wrap gap-x-[18px] gap-y-[6px] leading-[16px]\">\n {meta.map((entry, index) => (\n <div\n key={`${entry.label}-${index}`}\n className=\"flex min-w-0 items-baseline gap-[3px]\"\n >\n <dt className=\"flex\">\n <Text size=\"xsmall\" color=\"secondary\">\n {entry.label}\n </Text>\n </dt>\n <dd className=\"m-0 flex min-w-0 [overflow-wrap:anywhere]\">\n <Text size=\"xsmall\" font=\"mono\">\n {entry.value}\n </Text>\n </dd>\n </div>\n ))}\n </dl>\n )}\n {children}\n </div>\n </li>\n );\n};\n\n/** A vertical sequence of steps, each with a dot on a connecting line, a title, its timing and a body. */\nconst Timeline: React.FC<TimelineProps> & { Item: typeof Item } = ({\n children,\n className = '',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => (\n <ol\n // list-style: none strips list semantics in WebKit, so VoiceOver would not announce the steps.\n role=\"list\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={`m-0 list-none p-0 ${className}`}\n >\n {children}\n </ol>\n);\n\nTimeline.Item = Item;\n\nexport default Timeline;\nexport { Timeline };\n"],"names":["DOT_COLOR","TITLE_CODE_STYLE","getFontFamily","getFontWeight","SKIPPED_MARK","jsx","Item","title","eyebrow","titleCode","time","tone","marker","icon","skipped","stopped","stoppedLabel","skippedLabel","meta","children","className","id","useId","name","devWarning","isStopped","dotTone","shownMarker","ringless","code","titleRow","jsxs","Text","Fragment","Tag","isRenderableNode","entry","index","Timeline","ariaLabel","ariaLabelledBy"],"mappings":";;;;;;;AAiEA,MAAMA,IAA0C;AAAA,EAC5C,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAKMC,IAAwC;AAAA,EAC1C,YAAYC,EAAc,MAAM;AAAA,EAChC,YAAYC,EAAc,WAAW;AAAA,EACrC,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAChB,GAEMC,IACF,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,yBAAsB;AAAA,IACtB,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,WAAU;AAAA,IACV,OAAO,EAAE,OAAOL,EAAU,QAAA;AAAA,IAE1B,UAAA,gBAAAK;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAK;AAAA,QACL,GAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EACN;AACJ,GAGEC,IAAoC,CAAC;A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AAYkC;AAAA,IACZ,mBAAiBC;AAAA,IACjB,WAAW,qBAAqBpB,CAAS;AAAA,IAExC,UAAAD;AAAA,EAAA;AACL;AAGJmB,EAAS,OAAOhC;"}
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useFontFace as
|
|
3
|
-
import { getFontWeight as
|
|
1
|
+
import { jsx as F } from "react/jsx-runtime";
|
|
2
|
+
import { useFontFace as f } from "../../fontInjection.js";
|
|
3
|
+
import { getFontWeight as v, getFontFamily as h, getFontSize as u, getTextColor as x } from "./textStyles.js";
|
|
4
4
|
const b = ({
|
|
5
|
-
underline:
|
|
6
|
-
children:
|
|
5
|
+
underline: i = !1,
|
|
6
|
+
children: r,
|
|
7
7
|
color: a = "primary",
|
|
8
|
-
size:
|
|
9
|
-
font:
|
|
10
|
-
fontWeight:
|
|
8
|
+
size: n = "small",
|
|
9
|
+
font: e,
|
|
10
|
+
fontWeight: l = "normal",
|
|
11
11
|
tooltip: s,
|
|
12
|
-
textAlign:
|
|
13
|
-
wrap:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
textAlign: o,
|
|
13
|
+
wrap: t = !0,
|
|
14
|
+
breakAnywhere: m,
|
|
15
|
+
preserveLineBreaks: d,
|
|
16
|
+
as: p = "span",
|
|
17
|
+
className: c = "",
|
|
18
|
+
style: y = {}
|
|
17
19
|
}) => {
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
+
f(e === "heading" ? "stack-sans" : e === "body" ? "geist" : void 0);
|
|
21
|
+
const g = {
|
|
20
22
|
color: x(a),
|
|
21
|
-
fontSize: u(
|
|
23
|
+
fontSize: u(n),
|
|
22
24
|
// Left unset when not asked for, so Text keeps inheriting whatever the surrounding context…
|
|
23
|
-
fontFamily:
|
|
24
|
-
fontWeight:
|
|
25
|
-
textAlign:
|
|
26
|
-
textDecoration:
|
|
27
|
-
display:
|
|
28
|
-
whiteSpace:
|
|
29
|
-
|
|
25
|
+
fontFamily: e ? h(e) : void 0,
|
|
26
|
+
fontWeight: v(l),
|
|
27
|
+
textAlign: o,
|
|
28
|
+
textDecoration: i ? "underline" : "none",
|
|
29
|
+
display: o ? "block" : void 0,
|
|
30
|
+
whiteSpace: t ? d ? "pre-line" : void 0 : "nowrap",
|
|
31
|
+
overflowWrap: t && m ? "anywhere" : void 0,
|
|
32
|
+
...y
|
|
30
33
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ F(p, { className: c, style: g, title: s, children: r });
|
|
32
35
|
};
|
|
33
36
|
export {
|
|
34
37
|
b as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sources":["../../../src/components/Typography/Text.tsx"],"sourcesContent":["import React from 'react';\nimport { useFontFace } from '../../fontInjection';\nimport type { FontFamily, FontSize, FontWeight, TextColor, TextElement } from './textStyles';\nimport { getFontFamily, getFontSize, getFontWeight, getTextColor } from './textStyles';\n\n// Types only: a value re-export would put the non-component exports back in this file.\nexport type { FontSize, FontFamily, FontWeight, TextColor, TextElement } from './textStyles';\n\nexport interface TextProps {\n color?: TextColor;\n size?: FontSize;\n /**\n * Typeface. Defaults to `sans` (Inter), the library's body face. `heading` is Stack Sans\n * Text and `body` is Geist. Each is injected only when a `Text` asks for it, and declared\n * in the theme.\n */\n font?: FontFamily;\n underline?: boolean;\n fontWeight?: FontWeight;\n children: React.ReactNode;\n tooltip?: string;\n textAlign?: 'left' | 'center' | 'right' | 'justify';\n wrap?: boolean;\n /** The element it renders, for a heading or paragraph that keeps Text's look. */\n as?: TextElement;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst Text: React.FC<TextProps> = ({\n underline = false,\n children,\n color = 'primary',\n size = 'small',\n font,\n fontWeight = 'normal',\n tooltip,\n textAlign,\n wrap = true,\n as: Element = 'span',\n className = '',\n style = {},\n}) => {\n useFontFace(font === 'heading' ? 'stack-sans' : font === 'body' ? 'geist' : undefined);\n const textStyles: React.CSSProperties = {\n color: getTextColor(color),\n fontSize: getFontSize(size),\n // Left unset when not asked for, so Text keeps inheriting whatever the surrounding context…\n fontFamily: font ? getFontFamily(font) : undefined,\n fontWeight: getFontWeight(fontWeight),\n textAlign,\n textDecoration: underline ? 'underline' : 'none',\n display: textAlign ? 'block' : undefined,\n whiteSpace: wrap ?
|
|
1
|
+
{"version":3,"file":"Text.js","sources":["../../../src/components/Typography/Text.tsx"],"sourcesContent":["import React from 'react';\nimport { useFontFace } from '../../fontInjection';\nimport type { FontFamily, FontSize, FontWeight, TextColor, TextElement } from './textStyles';\nimport { getFontFamily, getFontSize, getFontWeight, getTextColor } from './textStyles';\n\n// Types only: a value re-export would put the non-component exports back in this file.\nexport type { FontSize, FontFamily, FontWeight, TextColor, TextElement } from './textStyles';\n\nexport interface TextProps {\n color?: TextColor;\n size?: FontSize;\n /**\n * Typeface. Defaults to `sans` (Inter), the library's body face. `heading` is Stack Sans\n * Text and `body` is Geist. Each is injected only when a `Text` asks for it, and declared\n * in the theme.\n */\n font?: FontFamily;\n underline?: boolean;\n fontWeight?: FontWeight;\n children: React.ReactNode;\n tooltip?: string;\n textAlign?: 'left' | 'center' | 'right' | 'justify';\n wrap?: boolean;\n /** Breaks a long id or URL instead of widening its container, while the text wraps. */\n breakAnywhere?: boolean;\n /** Keeps newlines while the text wraps. Runs of spaces still collapse. */\n preserveLineBreaks?: boolean;\n /** The element it renders, for a heading or paragraph that keeps Text's look. */\n as?: TextElement;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst Text: React.FC<TextProps> = ({\n underline = false,\n children,\n color = 'primary',\n size = 'small',\n font,\n fontWeight = 'normal',\n tooltip,\n textAlign,\n wrap = true,\n breakAnywhere,\n preserveLineBreaks,\n as: Element = 'span',\n className = '',\n style = {},\n}) => {\n useFontFace(font === 'heading' ? 'stack-sans' : font === 'body' ? 'geist' : undefined);\n const textStyles: React.CSSProperties = {\n color: getTextColor(color),\n fontSize: getFontSize(size),\n // Left unset when not asked for, so Text keeps inheriting whatever the surrounding context…\n fontFamily: font ? getFontFamily(font) : undefined,\n fontWeight: getFontWeight(fontWeight),\n textAlign,\n textDecoration: underline ? 'underline' : 'none',\n display: textAlign ? 'block' : undefined,\n whiteSpace: !wrap ? 'nowrap' : preserveLineBreaks ? 'pre-line' : undefined,\n overflowWrap: wrap && breakAnywhere ? 'anywhere' : undefined,\n ...style,\n };\n\n return (\n <Element className={className} style={textStyles} title={tooltip}>\n {children}\n </Element>\n );\n};\n\nexport default Text;\n"],"names":["Text","underline","children","color","size","font","fontWeight","tooltip","textAlign","wrap","breakAnywhere","preserveLineBreaks","Element","className","style","useFontFace","textStyles","getTextColor","getFontSize","getFontFamily","getFontWeight"],"mappings":";;;AAiCA,MAAMA,IAA4B,CAAC;AAAA,EAC/B,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,MAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,eAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,IAAIC,IAAU;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ,CAAA;AACZ,MAAM;AACF,EAAAC,EAAYV,MAAS,YAAY,eAAeA,MAAS,SAAS,UAAU,MAAS;AACrF,QAAMW,IAAkC;AAAA,IACpC,OAAOC,EAAad,CAAK;AAAA,IACzB,UAAUe,EAAYd,CAAI;AAAA;AAAA,IAE1B,YAAYC,IAAOc,EAAcd,CAAI,IAAI;AAAA,IACzC,YAAYe,EAAcd,CAAU;AAAA,IACpC,WAAAE;AAAA,IACA,gBAAgBP,IAAY,cAAc;AAAA,IAC1C,SAASO,IAAY,UAAU;AAAA,IAC/B,YAAaC,IAAkBE,IAAqB,aAAa,SAA7C;AAAA,IACpB,cAAcF,KAAQC,IAAgB,aAAa;AAAA,IACnD,GAAGI;AAAA,EAAA;AAGP,2BACKF,GAAA,EAAQ,WAAAC,GAAsB,OAAOG,GAAY,OAAOT,GACpD,UAAAL,GACL;AAER;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSyncExternalStore as O, useRef as p, useCallback as L, useEffect as C, useLayoutEffect as g } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { containsComposed as K, getDeepActiveElement as W } from "./activeElement.js";
|
|
3
3
|
import { ensureDroppedFocusTracking as $, focusReturnTarget as q } from "./droppedFocus.js";
|
|
4
4
|
import { pushEscapeLayer as J } from "./escapeLayers.js";
|
|
5
5
|
import { FOCUS_RING as Q } from "./focusRing.js";
|
|
@@ -96,7 +96,7 @@ const A = /* @__PURE__ */ new Set(), ht = () => {
|
|
|
96
96
|
}, Y = (t) => (v.add(t), () => {
|
|
97
97
|
v.delete(t);
|
|
98
98
|
}), P = (t, r, e, n) => {
|
|
99
|
-
const a = n[0], o = n[n.length - 1], s =
|
|
99
|
+
const a = n[0], o = n[n.length - 1], s = K(e, r);
|
|
100
100
|
if (r && s && r !== e && !n.includes(r)) {
|
|
101
101
|
const c = t.shiftKey ? Node.DOCUMENT_POSITION_PRECEDING : Node.DOCUMENT_POSITION_FOLLOWING;
|
|
102
102
|
n.some((d) => ft(r, d) & c) || (t.preventDefault(), (t.shiftKey ? o : a).focus());
|
|
@@ -111,7 +111,7 @@ const A = /* @__PURE__ */ new Set(), ht = () => {
|
|
|
111
111
|
r = i[s](), r && (e = _.get(i[s]) ?? 0);
|
|
112
112
|
if (!r)
|
|
113
113
|
return;
|
|
114
|
-
const n =
|
|
114
|
+
const n = W(), a = n ? tt(n) : null;
|
|
115
115
|
if (n && a && a.ticket > e) {
|
|
116
116
|
const s = a.popup.shadowRoot ?? a.popup, c = D(s);
|
|
117
117
|
if (c.length === 0) {
|
|
@@ -143,14 +143,13 @@ const A = /* @__PURE__ */ new Set(), ht = () => {
|
|
|
143
143
|
() => i.length > 0,
|
|
144
144
|
() => !1
|
|
145
145
|
), z = (t, r) => {
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
if (!K(t, W())) {
|
|
147
|
+
if (r === "content") {
|
|
148
|
+
(lt(t) ?? t).focus();
|
|
149
149
|
return;
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
}
|
|
151
|
+
t.focus();
|
|
152
152
|
}
|
|
153
|
-
t.focus();
|
|
154
153
|
}, Dt = ({
|
|
155
154
|
open: t,
|
|
156
155
|
onClose: r,
|