@brucesantos/design-space 0.1.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/CHANGELOG.md +76 -0
- package/README.md +146 -0
- package/dist/a11y/accessible-tree.d.ts +37 -0
- package/dist/a11y/contrast.d.ts +62 -0
- package/dist/a11y/useKeyboardMode.d.ts +23 -0
- package/dist/adapters/index.d.ts +37 -0
- package/dist/adapters/useScenarioData.d.ts +12 -0
- package/dist/contrast-MPoK6VR1.js +265 -0
- package/dist/contrast-MPoK6VR1.js.map +1 -0
- package/dist/controls/params.d.ts +30 -0
- package/dist/controls/state.d.ts +43 -0
- package/dist/deploy/index.d.ts +42 -0
- package/dist/design-space.css +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +1404 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/index.d.ts +35 -0
- package/dist/registry/validate.d.ts +21 -0
- package/dist/router/index.d.ts +15 -0
- package/dist/shell/Controls.d.ts +8 -0
- package/dist/shell/DesignSpace.d.ts +5 -0
- package/dist/shell/Home.d.ts +6 -0
- package/dist/shell/Inspector.d.ts +11 -0
- package/dist/shell/Sidebar.d.ts +7 -0
- package/dist/shell/Stage.d.ts +25 -0
- package/dist/shell/Topbar.d.ts +13 -0
- package/dist/shell/labels.d.ts +5 -0
- package/dist/testing/index.d.ts +45 -0
- package/dist/testing.js +42 -0
- package/dist/testing.js.map +1 -0
- package/dist/types/index.d.ts +310 -0
- package/dist/util/date.d.ts +40 -0
- package/package.json +67 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1404 @@
|
|
|
1
|
+
import { jsxs as d, jsx as a, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useEffect as E, useMemo as k, useCallback as M, forwardRef as ee, useRef as te } from "react";
|
|
3
|
+
import { v as ae, P as p, N as q, s as re, c as ne, g as se } from "./contrast-MPoK6VR1.js";
|
|
4
|
+
import { C as rt, S as nt, a as st, b as ot, d as it, e as dt, f as ct, h as lt, i as ut, j as ht, p as mt, r as pt, k as ft, l as bt, m as vt } from "./contrast-MPoK6VR1.js";
|
|
5
|
+
function oe(e) {
|
|
6
|
+
const t = new Map(e.scenarios.map((i) => [i.id, i])), r = new Map(e.personas.map((i) => [i.id, i])), n = new Map(e.fixtures.map((i) => [i.id, i])), s = new Map((e.rules ?? []).map((i) => [i.id, i])), l = new Map(e.modules.map((i) => [i.id, i])), c = new Map(
|
|
7
|
+
e.modules.flatMap((i) => (i.flows ?? []).map((h) => [h.id, h]))
|
|
8
|
+
), o = e.modules.map((i) => ({
|
|
9
|
+
module: i,
|
|
10
|
+
scenarios: e.scenarios.filter((h) => h.id.split(".")[0] === i.id)
|
|
11
|
+
})), u = new Set(o.flatMap((i) => i.scenarios.map((h) => h.id))), m = e.scenarios.filter((i) => !u.has(i.id)), f = (i) => i ? t.get(i) : void 0, v = (i) => i ? r.get(i) : void 0, g = (i) => i ? i.permissions ? i.permissions : v(i.persona)?.permissions ?? [] : [];
|
|
12
|
+
return {
|
|
13
|
+
product: e,
|
|
14
|
+
tree: o,
|
|
15
|
+
orphans: m,
|
|
16
|
+
issues: ae(e),
|
|
17
|
+
scenario: f,
|
|
18
|
+
persona: v,
|
|
19
|
+
fixture: (i) => i ? n.get(i) : void 0,
|
|
20
|
+
rule: (i) => i ? s.get(i) : void 0,
|
|
21
|
+
module: (i) => i ? l.get(i) : void 0,
|
|
22
|
+
flow: (i) => i ? c.get(i) : void 0,
|
|
23
|
+
rulesOf: (i) => (i?.rules ?? []).map((h) => s.get(h)).filter((h) => !!h),
|
|
24
|
+
permissionsOf: g,
|
|
25
|
+
scenariosForRoute: (i) => {
|
|
26
|
+
const h = i.split("?")[0];
|
|
27
|
+
return e.scenarios.filter((b) => b.route.split("?")[0] === h);
|
|
28
|
+
},
|
|
29
|
+
search: (i) => {
|
|
30
|
+
const h = W(i);
|
|
31
|
+
return h ? e.scenarios.filter((b) => {
|
|
32
|
+
const y = l.get(b.id.split(".")[0] ?? "")?.name ?? "";
|
|
33
|
+
return W(
|
|
34
|
+
[
|
|
35
|
+
b.title,
|
|
36
|
+
b.id,
|
|
37
|
+
b.intent ?? "",
|
|
38
|
+
b.route,
|
|
39
|
+
y,
|
|
40
|
+
r.get(b.persona)?.name ?? "",
|
|
41
|
+
(b.tags ?? []).join(" "),
|
|
42
|
+
(b.expected ?? []).join(" ")
|
|
43
|
+
].join(" ")
|
|
44
|
+
).includes(h);
|
|
45
|
+
}) : e.scenarios;
|
|
46
|
+
},
|
|
47
|
+
byStatus: (i) => e.scenarios.filter((h) => h.status === i),
|
|
48
|
+
coverage: () => {
|
|
49
|
+
const i = {
|
|
50
|
+
proposed: 0,
|
|
51
|
+
"in-review": 0,
|
|
52
|
+
approved: 0,
|
|
53
|
+
"in-implementation": 0,
|
|
54
|
+
implemented: 0,
|
|
55
|
+
superseded: 0
|
|
56
|
+
};
|
|
57
|
+
for (const h of e.scenarios) i[h.status] += 1;
|
|
58
|
+
return i;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function W(e) {
|
|
63
|
+
return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim();
|
|
64
|
+
}
|
|
65
|
+
const Y = [
|
|
66
|
+
{ id: "fit", label: "Ajustar" },
|
|
67
|
+
{ id: "mobile", label: "Celular", width: 390, height: 844 },
|
|
68
|
+
{ id: "tablet", label: "Tablet", width: 834, height: 1112 },
|
|
69
|
+
{ id: "desktop", label: "Desktop", width: 1440, height: 900 },
|
|
70
|
+
{ id: "custom", label: "Personalizado" }
|
|
71
|
+
], G = [1, 1.25, 1.5, 2];
|
|
72
|
+
function ie(e, t) {
|
|
73
|
+
const r = new URLSearchParams(e), n = r.get(p.scenario) ?? void 0, s = t.scenario(n), l = r.get(p.network), c = Number(r.get(p.textScale));
|
|
74
|
+
return {
|
|
75
|
+
scenario: s?.id,
|
|
76
|
+
persona: r.get(p.persona) ?? s?.persona,
|
|
77
|
+
fixture: r.get(p.fixture) ?? s?.fixture,
|
|
78
|
+
network: le(l) ? l : s?.network ?? "success",
|
|
79
|
+
viewport: r.get(p.viewport) ?? "fit",
|
|
80
|
+
customWidth: ue(r.get(p.customWidth)),
|
|
81
|
+
themeMode: r.get(p.themeMode) ?? t.product.theme?.modes?.[0],
|
|
82
|
+
locale: r.get(p.locale) ?? t.product.theme?.locales?.[0],
|
|
83
|
+
dataSource: r.get(p.dataSource) ?? t.product.dataSources?.default ?? "fixtures",
|
|
84
|
+
// Chrome visível por padrão. `?chrome=0` é o modo de revisão limpa e captura
|
|
85
|
+
// de tela, então precisa ser explícito para não sumir sem pedido.
|
|
86
|
+
chrome: r.get(p.chrome) !== "0",
|
|
87
|
+
keyboardMode: r.get(p.keyboardMode) === "1",
|
|
88
|
+
reducedMotion: r.get(p.reducedMotion) === "1",
|
|
89
|
+
textScale: G.includes(c) ? c : 1,
|
|
90
|
+
inspector: r.get(p.inspector) !== "0"
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function H(e, t) {
|
|
94
|
+
const r = new URLSearchParams(), n = t.scenario(e.scenario);
|
|
95
|
+
e.scenario && r.set(p.scenario, e.scenario), e.persona && e.persona !== n?.persona && r.set(p.persona, e.persona), e.fixture && e.fixture !== n?.fixture && r.set(p.fixture, e.fixture), e.network !== (n?.network ?? "success") && r.set(p.network, e.network), e.viewport !== "fit" && r.set(p.viewport, e.viewport), e.viewport === "custom" && e.customWidth && r.set(p.customWidth, String(e.customWidth));
|
|
96
|
+
const s = t.product.theme?.modes?.[0];
|
|
97
|
+
e.themeMode && e.themeMode !== s && r.set(p.themeMode, e.themeMode);
|
|
98
|
+
const l = t.product.theme?.locales?.[0];
|
|
99
|
+
e.locale && e.locale !== l && r.set(p.locale, e.locale);
|
|
100
|
+
const c = t.product.dataSources?.default ?? "fixtures";
|
|
101
|
+
e.dataSource && e.dataSource !== c && r.set(p.dataSource, e.dataSource), e.chrome || r.set(p.chrome, "0"), e.keyboardMode && r.set(p.keyboardMode, "1"), e.reducedMotion && r.set(p.reducedMotion, "1"), e.textScale !== 1 && r.set(p.textScale, String(e.textScale)), e.inspector || r.set(p.inspector, "0");
|
|
102
|
+
const o = r.toString();
|
|
103
|
+
return o ? `?${o}` : "";
|
|
104
|
+
}
|
|
105
|
+
function de(e) {
|
|
106
|
+
const [t, r] = _(() => U());
|
|
107
|
+
E(() => {
|
|
108
|
+
const m = () => r(U());
|
|
109
|
+
return window.addEventListener("popstate", m), () => window.removeEventListener("popstate", m);
|
|
110
|
+
}, []);
|
|
111
|
+
const n = k(() => ie(t.search, e), [t.search, e]), s = M((m, f, v = !1) => {
|
|
112
|
+
const g = `${m}${f}`;
|
|
113
|
+
v ? window.history.replaceState(null, "", g) : window.history.pushState(null, "", g), r({ path: m, search: f });
|
|
114
|
+
}, []), l = M(
|
|
115
|
+
(m) => {
|
|
116
|
+
const f = { ...n, ...m };
|
|
117
|
+
s(t.path, H(f, e), !0);
|
|
118
|
+
},
|
|
119
|
+
[n, t.path, s, e]
|
|
120
|
+
), c = M(
|
|
121
|
+
(m, f) => {
|
|
122
|
+
const [v, g] = m.split("?"), i = v || "/", h = g ? `?${g}` : t.search;
|
|
123
|
+
s(i, h, f?.replace ?? !1);
|
|
124
|
+
},
|
|
125
|
+
[t.search, s]
|
|
126
|
+
), o = M(
|
|
127
|
+
(m) => {
|
|
128
|
+
const f = e.scenario(m);
|
|
129
|
+
if (!f) return;
|
|
130
|
+
const v = {
|
|
131
|
+
...n,
|
|
132
|
+
scenario: f.id,
|
|
133
|
+
persona: f.persona,
|
|
134
|
+
fixture: f.fixture,
|
|
135
|
+
network: f.network ?? "success"
|
|
136
|
+
};
|
|
137
|
+
s(f.route, H(v, e), !1);
|
|
138
|
+
},
|
|
139
|
+
[n, s, e]
|
|
140
|
+
), u = k(() => ce(n), [n]);
|
|
141
|
+
return { location: t, controls: n, viewport: u, setControls: l, navigate: c, openScenario: o };
|
|
142
|
+
}
|
|
143
|
+
function ce(e) {
|
|
144
|
+
const t = Y.find((r) => r.id === e.viewport);
|
|
145
|
+
return e.viewport === "custom" ? { id: "custom", label: "Personalizado", width: e.customWidth ?? 1024 } : t ?? { id: "fit", label: "Ajustar" };
|
|
146
|
+
}
|
|
147
|
+
function U() {
|
|
148
|
+
return typeof window > "u" ? { path: "/", search: "" } : { path: window.location.pathname, search: window.location.search };
|
|
149
|
+
}
|
|
150
|
+
function le(e) {
|
|
151
|
+
return e !== null && q.includes(e);
|
|
152
|
+
}
|
|
153
|
+
function ue(e) {
|
|
154
|
+
if (!e) return;
|
|
155
|
+
const t = Number.parseInt(e, 10);
|
|
156
|
+
return Number.isFinite(t) && t > 0 ? t : void 0;
|
|
157
|
+
}
|
|
158
|
+
function he(e, t) {
|
|
159
|
+
const r = e.split("/").filter(Boolean), n = pe(t).split("/").filter(Boolean), s = {};
|
|
160
|
+
for (const [l, c] of r.entries()) {
|
|
161
|
+
if (c === "*")
|
|
162
|
+
return s["*"] = n.slice(l).join("/"), s;
|
|
163
|
+
const o = n[l];
|
|
164
|
+
if (o === void 0) return null;
|
|
165
|
+
if (c.startsWith(":")) {
|
|
166
|
+
s[c.slice(1)] = o;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (c !== o) return null;
|
|
170
|
+
}
|
|
171
|
+
return r.length !== n.length ? null : s;
|
|
172
|
+
}
|
|
173
|
+
function me(e, t) {
|
|
174
|
+
const r = [...e].sort((n, s) => K(s.path) - K(n.path));
|
|
175
|
+
for (const n of r) {
|
|
176
|
+
const s = he(n.path, t);
|
|
177
|
+
if (s) return { definition: n, params: s };
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function K(e) {
|
|
181
|
+
const t = e.split("/").filter(Boolean);
|
|
182
|
+
let r = t.length;
|
|
183
|
+
for (const n of t)
|
|
184
|
+
n === "*" ? r -= 2 : n.startsWith(":") ? r += 1 : r += 4;
|
|
185
|
+
return r;
|
|
186
|
+
}
|
|
187
|
+
function pe(e) {
|
|
188
|
+
const t = e.split("?")[0] ?? e;
|
|
189
|
+
try {
|
|
190
|
+
return decodeURI(t);
|
|
191
|
+
} catch {
|
|
192
|
+
return t;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const fe = 2500;
|
|
196
|
+
class be extends Error {
|
|
197
|
+
constructor(t) {
|
|
198
|
+
super(`Falha de rede simulada no cenário "${t}".`), this.name = "SimulatedNetworkError";
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function F(e) {
|
|
202
|
+
if (e)
|
|
203
|
+
return typeof e.data == "function" ? e.data() : e.data;
|
|
204
|
+
}
|
|
205
|
+
const O = {
|
|
206
|
+
id: "fixtures",
|
|
207
|
+
label: "Fixtures",
|
|
208
|
+
load: async ({ scenario: e, fixture: t, network: r }) => {
|
|
209
|
+
switch (r) {
|
|
210
|
+
case "empty":
|
|
211
|
+
return null;
|
|
212
|
+
case "error":
|
|
213
|
+
throw new be(e.id);
|
|
214
|
+
case "loading":
|
|
215
|
+
return new Promise(() => {
|
|
216
|
+
});
|
|
217
|
+
case "slow":
|
|
218
|
+
return await ve(fe), F(t);
|
|
219
|
+
default:
|
|
220
|
+
return F(t);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
function Je(e) {
|
|
225
|
+
const { id: t, label: r, baseUrl: n, path: s, init: l, fallbackToFixture: c = !0 } = e;
|
|
226
|
+
return {
|
|
227
|
+
id: t,
|
|
228
|
+
label: r,
|
|
229
|
+
load: async (o) => {
|
|
230
|
+
const u = new URL(s ? s(o) : o.scenario.route, n);
|
|
231
|
+
try {
|
|
232
|
+
const m = await fetch(u, l);
|
|
233
|
+
if (!m.ok) throw new Error(`${m.status} ${m.statusText}`);
|
|
234
|
+
return await m.json();
|
|
235
|
+
} catch (m) {
|
|
236
|
+
if (c) return F(o.fixture);
|
|
237
|
+
throw new Error(`Adapter "${t}" falhou em ${u.toString()}`, { cause: m });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function ve(e) {
|
|
243
|
+
return new Promise((t) => setTimeout(t, e));
|
|
244
|
+
}
|
|
245
|
+
function ge(e) {
|
|
246
|
+
const { scenario: t, fixture: r, network: n, adapter: s } = e, [l, c] = _({
|
|
247
|
+
data: void 0,
|
|
248
|
+
isLoading: !!t,
|
|
249
|
+
error: void 0
|
|
250
|
+
});
|
|
251
|
+
return E(() => {
|
|
252
|
+
if (!t) {
|
|
253
|
+
c({ data: void 0, isLoading: !1, error: void 0 });
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
let o = !0;
|
|
257
|
+
c({ data: void 0, isLoading: !0, error: void 0 });
|
|
258
|
+
const u = s ?? O;
|
|
259
|
+
return Promise.resolve(u.load({ scenario: t, fixture: r, network: n })).then((m) => {
|
|
260
|
+
o && c({ data: m, isLoading: !1, error: void 0 });
|
|
261
|
+
}).catch((m) => {
|
|
262
|
+
o && c({
|
|
263
|
+
data: void 0,
|
|
264
|
+
isLoading: !1,
|
|
265
|
+
error: m instanceof Error ? m : new Error(String(m))
|
|
266
|
+
});
|
|
267
|
+
}), () => {
|
|
268
|
+
o = !1;
|
|
269
|
+
};
|
|
270
|
+
}, [t, r, n, s]), l;
|
|
271
|
+
}
|
|
272
|
+
const Ne = {
|
|
273
|
+
a: "link",
|
|
274
|
+
article: "article",
|
|
275
|
+
aside: "complementary",
|
|
276
|
+
button: "button",
|
|
277
|
+
dialog: "dialog",
|
|
278
|
+
fieldset: "group",
|
|
279
|
+
footer: "contentinfo",
|
|
280
|
+
form: "form",
|
|
281
|
+
h1: "heading",
|
|
282
|
+
h2: "heading",
|
|
283
|
+
h3: "heading",
|
|
284
|
+
h4: "heading",
|
|
285
|
+
h5: "heading",
|
|
286
|
+
h6: "heading",
|
|
287
|
+
header: "banner",
|
|
288
|
+
hr: "separator",
|
|
289
|
+
img: "img",
|
|
290
|
+
li: "listitem",
|
|
291
|
+
main: "main",
|
|
292
|
+
nav: "navigation",
|
|
293
|
+
ol: "list",
|
|
294
|
+
option: "option",
|
|
295
|
+
output: "status",
|
|
296
|
+
progress: "progressbar",
|
|
297
|
+
section: "region",
|
|
298
|
+
select: "combobox",
|
|
299
|
+
table: "table",
|
|
300
|
+
tbody: "rowgroup",
|
|
301
|
+
td: "cell",
|
|
302
|
+
textarea: "textbox",
|
|
303
|
+
th: "columnheader",
|
|
304
|
+
tr: "row",
|
|
305
|
+
ul: "list"
|
|
306
|
+
}, we = {
|
|
307
|
+
button: "button",
|
|
308
|
+
checkbox: "checkbox",
|
|
309
|
+
email: "textbox",
|
|
310
|
+
image: "button",
|
|
311
|
+
number: "spinbutton",
|
|
312
|
+
radio: "radio",
|
|
313
|
+
range: "slider",
|
|
314
|
+
reset: "button",
|
|
315
|
+
search: "searchbox",
|
|
316
|
+
submit: "button",
|
|
317
|
+
tel: "textbox",
|
|
318
|
+
text: "textbox",
|
|
319
|
+
url: "textbox"
|
|
320
|
+
};
|
|
321
|
+
function _e(e) {
|
|
322
|
+
if (!e || !(e instanceof HTMLElement)) return;
|
|
323
|
+
const { name: t, nameFrom: r } = xe(e);
|
|
324
|
+
return {
|
|
325
|
+
role: ke(e),
|
|
326
|
+
name: t,
|
|
327
|
+
nameFrom: r,
|
|
328
|
+
description: Se(e),
|
|
329
|
+
states: ye(e),
|
|
330
|
+
selector: Ee(e),
|
|
331
|
+
hiddenFromTabOrder: e.tabIndex < 0,
|
|
332
|
+
hiddenFromAssistiveTech: Me(e)
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function ke(e) {
|
|
336
|
+
const t = e.getAttribute("role");
|
|
337
|
+
if (t) return t.split(/\s+/)[0] ?? t;
|
|
338
|
+
const r = e.tagName.toLowerCase();
|
|
339
|
+
if (r === "input") {
|
|
340
|
+
const n = e.type.toLowerCase();
|
|
341
|
+
return we[n] ?? "textbox";
|
|
342
|
+
}
|
|
343
|
+
return r === "a" && !e.hasAttribute("href") ? "generic" : Ne[r] ?? "generic";
|
|
344
|
+
}
|
|
345
|
+
function xe(e) {
|
|
346
|
+
const t = e.getAttribute("aria-labelledby");
|
|
347
|
+
if (t) {
|
|
348
|
+
const c = t.split(/\s+/).map((o) => e.ownerDocument.getElementById(o)?.textContent?.trim() ?? "").filter(Boolean).join(" ");
|
|
349
|
+
if (c) return { name: c, nameFrom: "aria-labelledby" };
|
|
350
|
+
}
|
|
351
|
+
const r = e.getAttribute("aria-label")?.trim();
|
|
352
|
+
if (r) return { name: r, nameFrom: "aria-label" };
|
|
353
|
+
if (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) {
|
|
354
|
+
const c = Array.from(e.labels ?? []).map((o) => o.textContent?.trim() ?? "").filter(Boolean);
|
|
355
|
+
if (c.length) return { name: c.join(" "), nameFrom: "label" };
|
|
356
|
+
}
|
|
357
|
+
if (e instanceof HTMLImageElement) {
|
|
358
|
+
const c = e.getAttribute("alt");
|
|
359
|
+
if (c !== null) return { name: c, nameFrom: "alt" };
|
|
360
|
+
}
|
|
361
|
+
const n = e.getAttribute("title")?.trim(), s = Ce(e);
|
|
362
|
+
return s ? { name: s, nameFrom: "content" } : n ? { name: n, nameFrom: "title" } : e instanceof HTMLInputElement && e.value ? { name: e.value, nameFrom: "value" } : e.getAttribute("placeholder")?.trim() ? { name: "", nameFrom: "none" } : { name: "", nameFrom: "none" };
|
|
363
|
+
}
|
|
364
|
+
function Se(e) {
|
|
365
|
+
const t = e.getAttribute("aria-describedby");
|
|
366
|
+
if (t) {
|
|
367
|
+
const r = t.split(/\s+/).map((n) => e.ownerDocument.getElementById(n)?.textContent?.trim() ?? "").filter(Boolean).join(" ");
|
|
368
|
+
if (r) return r;
|
|
369
|
+
}
|
|
370
|
+
return e.getAttribute("aria-description")?.trim() || void 0;
|
|
371
|
+
}
|
|
372
|
+
function ye(e) {
|
|
373
|
+
const t = [], r = (n, s = n.replace("aria-", "")) => {
|
|
374
|
+
const l = e.getAttribute(n);
|
|
375
|
+
l !== null && l !== "false" && t.push(l === "true" || l === "" ? s : `${s}=${l}`);
|
|
376
|
+
};
|
|
377
|
+
return e.disabled && t.push("disabled"), e.getAttribute("aria-disabled") === "true" && t.push("disabled"), e.required && t.push("required"), e.readOnly && t.push("readonly"), e.checked && t.push("checked"), r("aria-expanded"), r("aria-selected"), r("aria-checked"), r("aria-pressed"), r("aria-current"), r("aria-invalid"), r("aria-busy"), r("aria-live"), r("aria-haspopup"), r("aria-level", "level"), e.ownerDocument.activeElement === e && t.push("focused"), [...new Set(t)];
|
|
378
|
+
}
|
|
379
|
+
function Me(e) {
|
|
380
|
+
let t = e;
|
|
381
|
+
for (; t; ) {
|
|
382
|
+
if (t.getAttribute("aria-hidden") === "true" || t.hasAttribute("hidden")) return !0;
|
|
383
|
+
t = t.parentElement;
|
|
384
|
+
}
|
|
385
|
+
return !1;
|
|
386
|
+
}
|
|
387
|
+
function Ce(e) {
|
|
388
|
+
const t = e.cloneNode(!0);
|
|
389
|
+
for (const r of t.querySelectorAll("[aria-hidden='true'],[hidden]"))
|
|
390
|
+
r.remove();
|
|
391
|
+
return (t.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 160);
|
|
392
|
+
}
|
|
393
|
+
function Ee(e) {
|
|
394
|
+
const t = e.tagName.toLowerCase();
|
|
395
|
+
if (e.id) return `${t}#${e.id}`;
|
|
396
|
+
const r = e.getAttribute("data-testid");
|
|
397
|
+
if (r) return `${t}[data-testid="${r}"]`;
|
|
398
|
+
const n = Array.from(e.classList).slice(0, 2);
|
|
399
|
+
return n.length ? `${t}.${n.join(".")}` : t;
|
|
400
|
+
}
|
|
401
|
+
function Te(e = document) {
|
|
402
|
+
const t = [
|
|
403
|
+
"a[href]",
|
|
404
|
+
"button",
|
|
405
|
+
"input",
|
|
406
|
+
"select",
|
|
407
|
+
"textarea",
|
|
408
|
+
"summary",
|
|
409
|
+
"[tabindex]",
|
|
410
|
+
"[contenteditable='true']"
|
|
411
|
+
].join(",");
|
|
412
|
+
return Array.from(e.querySelectorAll(t)).filter((r) => {
|
|
413
|
+
if (r.tabIndex < 0 || r.disabled || r.getAttribute("aria-hidden") === "true") return !1;
|
|
414
|
+
const n = window.getComputedStyle(r);
|
|
415
|
+
return n.display === "none" || n.visibility === "hidden" ? !1 : r.offsetWidth > 0 || r.offsetHeight > 0 || r === document.activeElement;
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
function Ae(e, t) {
|
|
419
|
+
const [r, n] = _(), [s, l] = _([]), c = M(() => {
|
|
420
|
+
const o = t.current;
|
|
421
|
+
if (!o) {
|
|
422
|
+
l([]);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
l(
|
|
426
|
+
Te(o).map((u, m) => ({
|
|
427
|
+
index: m + 1,
|
|
428
|
+
element: u,
|
|
429
|
+
rect: u.getBoundingClientRect(),
|
|
430
|
+
forcedOrder: u.tabIndex > 0
|
|
431
|
+
}))
|
|
432
|
+
);
|
|
433
|
+
}, [t]);
|
|
434
|
+
return E(() => {
|
|
435
|
+
if (!e) {
|
|
436
|
+
n(void 0), l([]);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
const o = () => n(_e(document.activeElement));
|
|
440
|
+
document.addEventListener("focusin", o), window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), o(), c();
|
|
441
|
+
const u = t.current, m = u ? new MutationObserver(() => c()) : void 0;
|
|
442
|
+
return m?.observe(u, { childList: !0, subtree: !0, attributes: !0 }), () => {
|
|
443
|
+
document.removeEventListener("focusin", o), window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0), m?.disconnect();
|
|
444
|
+
};
|
|
445
|
+
}, [e, c, t]), { focused: r, tabStops: s, refresh: c };
|
|
446
|
+
}
|
|
447
|
+
const S = {
|
|
448
|
+
proposed: "Proposta",
|
|
449
|
+
"in-review": "Em revisão",
|
|
450
|
+
approved: "Aprovado",
|
|
451
|
+
"in-implementation": "Em implementação",
|
|
452
|
+
implemented: "Implementado",
|
|
453
|
+
superseded: "Superado"
|
|
454
|
+
}, Le = {
|
|
455
|
+
proposed: "Exploração ainda não aprovada.",
|
|
456
|
+
"in-review": "Aberto para validação de design, negócio ou cliente.",
|
|
457
|
+
approved: "Referência autorizada, registrada por URL de commit.",
|
|
458
|
+
"in-implementation": "Ligado a um trabalho ativo de engenharia.",
|
|
459
|
+
implemented: "Disponível no produto real e validado.",
|
|
460
|
+
superseded: "Mantido para histórico ou substituído por outra decisão."
|
|
461
|
+
}, Q = {
|
|
462
|
+
success: "Sucesso",
|
|
463
|
+
loading: "Carregando",
|
|
464
|
+
empty: "Vazio",
|
|
465
|
+
error: "Erro",
|
|
466
|
+
slow: "Lento"
|
|
467
|
+
}, Fe = {
|
|
468
|
+
full: "Jornada completável só por teclado",
|
|
469
|
+
partial: "Parcialmente operável por teclado",
|
|
470
|
+
"not-applicable": "Não se aplica"
|
|
471
|
+
};
|
|
472
|
+
function Oe({ registry: e, activeScenario: t, onOpenScenario: r }) {
|
|
473
|
+
const [n, s] = _(""), [l, c] = _(/* @__PURE__ */ new Set()), o = k(() => {
|
|
474
|
+
if (n.trim())
|
|
475
|
+
return new Set(e.search(n).map((i) => i.id));
|
|
476
|
+
}, [n, e]), u = (i) => c((h) => {
|
|
477
|
+
const b = new Set(h);
|
|
478
|
+
return b.has(i) ? b.delete(i) : b.add(i), b;
|
|
479
|
+
}), m = (i) => o ? i.filter((h) => o.has(h.id)) : i, f = e.tree.map((i) => ({ ...i, scenarios: m(i.scenarios) })).filter((i) => o ? i.scenarios.length > 0 : !0), v = m(e.orphans), g = f.reduce((i, h) => i + h.scenarios.length, 0) + v.length;
|
|
480
|
+
return /* @__PURE__ */ d("nav", { className: "ds-chrome ds-sidebar", "aria-label": "Cenários do produto", children: [
|
|
481
|
+
/* @__PURE__ */ a("div", { className: "ds-sidebar__search", children: /* @__PURE__ */ a(
|
|
482
|
+
"input",
|
|
483
|
+
{
|
|
484
|
+
className: "ds-input ds-input--search",
|
|
485
|
+
type: "search",
|
|
486
|
+
value: n,
|
|
487
|
+
placeholder: "Buscar situação…",
|
|
488
|
+
"aria-label": "Buscar cenário pelo vocabulário do produto",
|
|
489
|
+
onChange: (i) => s(i.target.value)
|
|
490
|
+
}
|
|
491
|
+
) }),
|
|
492
|
+
/* @__PURE__ */ d("div", { className: "ds-sidebar__tree", children: [
|
|
493
|
+
n.trim() !== "" && /* @__PURE__ */ a("p", { className: "ds-sidebar__empty", role: "status", children: g === 0 ? `Nenhuma situação para "${n}".` : `${g} ${g === 1 ? "situação" : "situações"}.` }),
|
|
494
|
+
f.map((i) => {
|
|
495
|
+
const h = !l.has(i.module.id) || !!o;
|
|
496
|
+
return /* @__PURE__ */ d("section", { className: "ds-module", children: [
|
|
497
|
+
/* @__PURE__ */ d(
|
|
498
|
+
"button",
|
|
499
|
+
{
|
|
500
|
+
type: "button",
|
|
501
|
+
className: "ds-module__header",
|
|
502
|
+
"aria-expanded": h,
|
|
503
|
+
onClick: () => u(i.module.id),
|
|
504
|
+
children: [
|
|
505
|
+
/* @__PURE__ */ a("span", { className: "ds-module__chevron", "aria-hidden": "true", children: "▶" }),
|
|
506
|
+
/* @__PURE__ */ a("span", { children: i.module.name }),
|
|
507
|
+
/* @__PURE__ */ a("span", { className: "ds-module__count", children: i.scenarios.length })
|
|
508
|
+
]
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
h && /* @__PURE__ */ d("ul", { className: "ds-module__scenarios", children: [
|
|
512
|
+
i.scenarios.map((b) => /* @__PURE__ */ a(
|
|
513
|
+
V,
|
|
514
|
+
{
|
|
515
|
+
scenario: b,
|
|
516
|
+
isActive: b.id === t,
|
|
517
|
+
onOpen: r
|
|
518
|
+
},
|
|
519
|
+
b.id
|
|
520
|
+
)),
|
|
521
|
+
i.scenarios.length === 0 && /* @__PURE__ */ a("li", { className: "ds-sidebar__empty", children: "Nenhum cenário ainda." })
|
|
522
|
+
] })
|
|
523
|
+
] }, i.module.id);
|
|
524
|
+
}),
|
|
525
|
+
v.length > 0 && /* @__PURE__ */ d("section", { className: "ds-module", children: [
|
|
526
|
+
/* @__PURE__ */ d("div", { className: "ds-module__header", "aria-hidden": "true", children: [
|
|
527
|
+
/* @__PURE__ */ a("span", { className: "ds-module__chevron", children: "▶" }),
|
|
528
|
+
/* @__PURE__ */ a("span", { children: "Sem módulo" }),
|
|
529
|
+
/* @__PURE__ */ a("span", { className: "ds-module__count", children: v.length })
|
|
530
|
+
] }),
|
|
531
|
+
/* @__PURE__ */ a("ul", { className: "ds-module__scenarios", children: v.map((i) => /* @__PURE__ */ a(
|
|
532
|
+
V,
|
|
533
|
+
{
|
|
534
|
+
scenario: i,
|
|
535
|
+
isActive: i.id === t,
|
|
536
|
+
onOpen: r
|
|
537
|
+
},
|
|
538
|
+
i.id
|
|
539
|
+
)) })
|
|
540
|
+
] })
|
|
541
|
+
] })
|
|
542
|
+
] });
|
|
543
|
+
}
|
|
544
|
+
function V({
|
|
545
|
+
scenario: e,
|
|
546
|
+
isActive: t,
|
|
547
|
+
onOpen: r
|
|
548
|
+
}) {
|
|
549
|
+
return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ d(
|
|
550
|
+
"button",
|
|
551
|
+
{
|
|
552
|
+
type: "button",
|
|
553
|
+
className: "ds-scenario",
|
|
554
|
+
"aria-current": t,
|
|
555
|
+
onClick: () => r(e.id),
|
|
556
|
+
children: [
|
|
557
|
+
/* @__PURE__ */ a(
|
|
558
|
+
"span",
|
|
559
|
+
{
|
|
560
|
+
className: "ds-status-dot",
|
|
561
|
+
"data-status": e.status,
|
|
562
|
+
title: S[e.status]
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
/* @__PURE__ */ a("span", { className: "ds-scenario__title", children: e.title }),
|
|
566
|
+
/* @__PURE__ */ a("span", { className: "ds-visually-hidden", children: S[e.status] })
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
) });
|
|
570
|
+
}
|
|
571
|
+
function $e({
|
|
572
|
+
product: e,
|
|
573
|
+
scenario: t,
|
|
574
|
+
deploy: r,
|
|
575
|
+
inspectorOpen: n,
|
|
576
|
+
sidebarOpen: s,
|
|
577
|
+
onToggleInspector: l,
|
|
578
|
+
onToggleSidebar: c,
|
|
579
|
+
onHideChrome: o
|
|
580
|
+
}) {
|
|
581
|
+
const [u, m] = _(!1), f = async () => {
|
|
582
|
+
const v = t ? re(t, { origin: r.origin }) : `${r.origin}${window.location.pathname}${window.location.search}`;
|
|
583
|
+
try {
|
|
584
|
+
await navigator.clipboard.writeText(v);
|
|
585
|
+
} catch {
|
|
586
|
+
window.prompt("Copie o link do cenário:", v);
|
|
587
|
+
}
|
|
588
|
+
m(!0), window.setTimeout(() => m(!1), 1600);
|
|
589
|
+
};
|
|
590
|
+
return /* @__PURE__ */ d("header", { className: "ds-chrome ds-topbar", children: [
|
|
591
|
+
/* @__PURE__ */ a(
|
|
592
|
+
"button",
|
|
593
|
+
{
|
|
594
|
+
type: "button",
|
|
595
|
+
className: "ds-btn ds-btn--ghost",
|
|
596
|
+
"aria-pressed": s,
|
|
597
|
+
onClick: c,
|
|
598
|
+
title: "Mostrar ou ocultar a navegação",
|
|
599
|
+
children: "☰"
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
/* @__PURE__ */ d("div", { className: "ds-topbar__product", children: [
|
|
603
|
+
/* @__PURE__ */ a("span", { children: e.name }),
|
|
604
|
+
e.tagline && /* @__PURE__ */ a("span", { className: "ds-topbar__tagline", children: e.tagline })
|
|
605
|
+
] }),
|
|
606
|
+
/* @__PURE__ */ a("div", { className: "ds-topbar__spacer" }),
|
|
607
|
+
/* @__PURE__ */ d("div", { className: "ds-topbar__meta", children: [
|
|
608
|
+
r.branch && /* @__PURE__ */ a("code", { title: `Branch: ${r.branch}`, children: r.branch.length > 28 ? `${r.branch.slice(0, 27)}…` : r.branch }),
|
|
609
|
+
r.shortCommit && /* @__PURE__ */ a("code", { title: `Commit: ${r.commit}`, children: r.shortCommit }),
|
|
610
|
+
/* @__PURE__ */ a("code", { title: `Ambiente: ${r.env}`, children: r.env })
|
|
611
|
+
] }),
|
|
612
|
+
/* @__PURE__ */ a("button", { type: "button", className: "ds-btn", onClick: f, children: u ? "Link copiado" : "Copiar link" }),
|
|
613
|
+
/* @__PURE__ */ a(
|
|
614
|
+
"button",
|
|
615
|
+
{
|
|
616
|
+
type: "button",
|
|
617
|
+
className: "ds-btn",
|
|
618
|
+
onClick: o,
|
|
619
|
+
title: "Ocultar o chrome do Design Space para revisão limpa e captura de tela",
|
|
620
|
+
children: "Revisão limpa"
|
|
621
|
+
}
|
|
622
|
+
),
|
|
623
|
+
/* @__PURE__ */ a(
|
|
624
|
+
"button",
|
|
625
|
+
{
|
|
626
|
+
type: "button",
|
|
627
|
+
className: "ds-btn",
|
|
628
|
+
"aria-pressed": n,
|
|
629
|
+
onClick: l,
|
|
630
|
+
children: "Painel"
|
|
631
|
+
}
|
|
632
|
+
)
|
|
633
|
+
] });
|
|
634
|
+
}
|
|
635
|
+
function Pe({ registry: e, controls: t, onChange: r }) {
|
|
636
|
+
const { product: n } = e, s = n.dataSources?.adapters ?? [], l = n.theme?.modes ?? [], c = n.theme?.locales ?? [];
|
|
637
|
+
return /* @__PURE__ */ d("div", { className: "ds-chrome ds-controls", role: "group", "aria-label": "Controles do cenário", children: [
|
|
638
|
+
/* @__PURE__ */ d("div", { className: "ds-field", children: [
|
|
639
|
+
/* @__PURE__ */ a("label", { htmlFor: "ds-persona", children: "Persona" }),
|
|
640
|
+
/* @__PURE__ */ d(
|
|
641
|
+
"select",
|
|
642
|
+
{
|
|
643
|
+
id: "ds-persona",
|
|
644
|
+
className: "ds-select",
|
|
645
|
+
value: t.persona ?? "",
|
|
646
|
+
onChange: (o) => r({ persona: o.target.value || void 0 }),
|
|
647
|
+
children: [
|
|
648
|
+
/* @__PURE__ */ a("option", { value: "", children: "—" }),
|
|
649
|
+
n.personas.map((o) => /* @__PURE__ */ a("option", { value: o.id, children: o.name }, o.id))
|
|
650
|
+
]
|
|
651
|
+
}
|
|
652
|
+
)
|
|
653
|
+
] }),
|
|
654
|
+
/* @__PURE__ */ d("div", { className: "ds-field", children: [
|
|
655
|
+
/* @__PURE__ */ a("label", { htmlFor: "ds-fixture", children: "Dados" }),
|
|
656
|
+
/* @__PURE__ */ d(
|
|
657
|
+
"select",
|
|
658
|
+
{
|
|
659
|
+
id: "ds-fixture",
|
|
660
|
+
className: "ds-select",
|
|
661
|
+
value: t.fixture ?? "",
|
|
662
|
+
onChange: (o) => r({ fixture: o.target.value || void 0 }),
|
|
663
|
+
children: [
|
|
664
|
+
/* @__PURE__ */ a("option", { value: "", children: "—" }),
|
|
665
|
+
n.fixtures.map((o) => /* @__PURE__ */ a("option", { value: o.id, children: o.label }, o.id))
|
|
666
|
+
]
|
|
667
|
+
}
|
|
668
|
+
)
|
|
669
|
+
] }),
|
|
670
|
+
/* @__PURE__ */ d("div", { className: "ds-field", children: [
|
|
671
|
+
/* @__PURE__ */ a("span", { className: "ds-field__label", id: "ds-network-label", children: "Rede" }),
|
|
672
|
+
/* @__PURE__ */ a("div", { className: "ds-segmented", role: "group", "aria-labelledby": "ds-network-label", children: q.map((o) => /* @__PURE__ */ a(
|
|
673
|
+
"button",
|
|
674
|
+
{
|
|
675
|
+
type: "button",
|
|
676
|
+
"aria-pressed": t.network === o,
|
|
677
|
+
onClick: () => r({ network: o }),
|
|
678
|
+
children: Q[o]
|
|
679
|
+
},
|
|
680
|
+
o
|
|
681
|
+
)) })
|
|
682
|
+
] }),
|
|
683
|
+
/* @__PURE__ */ d("div", { className: "ds-field", children: [
|
|
684
|
+
/* @__PURE__ */ a("span", { className: "ds-field__label", id: "ds-viewport-label", children: "Viewport" }),
|
|
685
|
+
/* @__PURE__ */ a("div", { className: "ds-segmented", role: "group", "aria-labelledby": "ds-viewport-label", children: Y.map((o) => /* @__PURE__ */ a(
|
|
686
|
+
"button",
|
|
687
|
+
{
|
|
688
|
+
type: "button",
|
|
689
|
+
"aria-pressed": t.viewport === o.id,
|
|
690
|
+
onClick: () => r({ viewport: o.id }),
|
|
691
|
+
children: o.label
|
|
692
|
+
},
|
|
693
|
+
o.id
|
|
694
|
+
)) }),
|
|
695
|
+
t.viewport === "custom" && /* @__PURE__ */ a(
|
|
696
|
+
"input",
|
|
697
|
+
{
|
|
698
|
+
className: "ds-input",
|
|
699
|
+
type: "number",
|
|
700
|
+
min: 240,
|
|
701
|
+
max: 3840,
|
|
702
|
+
step: 10,
|
|
703
|
+
style: { width: 88 },
|
|
704
|
+
"aria-label": "Largura personalizada em pixels",
|
|
705
|
+
value: t.customWidth ?? 1024,
|
|
706
|
+
onChange: (o) => r({ customWidth: Number(o.target.value) || void 0 })
|
|
707
|
+
}
|
|
708
|
+
)
|
|
709
|
+
] }),
|
|
710
|
+
l.length > 1 && /* @__PURE__ */ d("div", { className: "ds-field", children: [
|
|
711
|
+
/* @__PURE__ */ a("label", { htmlFor: "ds-theme", children: "Tema" }),
|
|
712
|
+
/* @__PURE__ */ a(
|
|
713
|
+
"select",
|
|
714
|
+
{
|
|
715
|
+
id: "ds-theme",
|
|
716
|
+
className: "ds-select",
|
|
717
|
+
value: t.themeMode ?? l[0],
|
|
718
|
+
onChange: (o) => r({ themeMode: o.target.value }),
|
|
719
|
+
children: l.map((o) => /* @__PURE__ */ a("option", { value: o, children: o }, o))
|
|
720
|
+
}
|
|
721
|
+
)
|
|
722
|
+
] }),
|
|
723
|
+
c.length > 1 && /* @__PURE__ */ d("div", { className: "ds-field", children: [
|
|
724
|
+
/* @__PURE__ */ a("label", { htmlFor: "ds-locale", children: "Idioma" }),
|
|
725
|
+
/* @__PURE__ */ a(
|
|
726
|
+
"select",
|
|
727
|
+
{
|
|
728
|
+
id: "ds-locale",
|
|
729
|
+
className: "ds-select",
|
|
730
|
+
value: t.locale ?? c[0],
|
|
731
|
+
onChange: (o) => r({ locale: o.target.value }),
|
|
732
|
+
children: c.map((o) => /* @__PURE__ */ a("option", { value: o, children: o }, o))
|
|
733
|
+
}
|
|
734
|
+
)
|
|
735
|
+
] }),
|
|
736
|
+
s.length > 0 && /* @__PURE__ */ d("div", { className: "ds-field", children: [
|
|
737
|
+
/* @__PURE__ */ a("label", { htmlFor: "ds-source", children: "Fonte" }),
|
|
738
|
+
/* @__PURE__ */ d(
|
|
739
|
+
"select",
|
|
740
|
+
{
|
|
741
|
+
id: "ds-source",
|
|
742
|
+
className: "ds-select",
|
|
743
|
+
value: t.dataSource ?? "fixtures",
|
|
744
|
+
onChange: (o) => r({ dataSource: o.target.value }),
|
|
745
|
+
children: [
|
|
746
|
+
/* @__PURE__ */ a("option", { value: "fixtures", children: "Fixtures" }),
|
|
747
|
+
s.filter((o) => o.id !== "fixtures").map((o) => /* @__PURE__ */ a("option", { value: o.id, children: o.label }, o.id))
|
|
748
|
+
]
|
|
749
|
+
}
|
|
750
|
+
)
|
|
751
|
+
] }),
|
|
752
|
+
/* @__PURE__ */ d("div", { className: "ds-field", children: [
|
|
753
|
+
/* @__PURE__ */ a("span", { className: "ds-field__label", children: "Acessibilidade" }),
|
|
754
|
+
/* @__PURE__ */ a(
|
|
755
|
+
"button",
|
|
756
|
+
{
|
|
757
|
+
type: "button",
|
|
758
|
+
className: "ds-btn",
|
|
759
|
+
"aria-pressed": t.keyboardMode,
|
|
760
|
+
onClick: () => r({ keyboardMode: !t.keyboardMode }),
|
|
761
|
+
title: "Percorrer a jornada só por teclado, com foco visível e ordem de tabulação evidenciada",
|
|
762
|
+
children: "Teclado"
|
|
763
|
+
}
|
|
764
|
+
),
|
|
765
|
+
/* @__PURE__ */ a(
|
|
766
|
+
"button",
|
|
767
|
+
{
|
|
768
|
+
type: "button",
|
|
769
|
+
className: "ds-btn",
|
|
770
|
+
"aria-pressed": t.reducedMotion,
|
|
771
|
+
onClick: () => r({ reducedMotion: !t.reducedMotion }),
|
|
772
|
+
title: "Reduzir movimento dentro do palco",
|
|
773
|
+
children: "Movimento"
|
|
774
|
+
}
|
|
775
|
+
),
|
|
776
|
+
/* @__PURE__ */ a("div", { className: "ds-segmented", role: "group", "aria-label": "Ampliação de texto", children: G.map((o) => /* @__PURE__ */ a(
|
|
777
|
+
"button",
|
|
778
|
+
{
|
|
779
|
+
type: "button",
|
|
780
|
+
"aria-pressed": t.textScale === o,
|
|
781
|
+
onClick: () => r({ textScale: o }),
|
|
782
|
+
children: o === 1 ? "100%" : `${o * 100}%`
|
|
783
|
+
},
|
|
784
|
+
o
|
|
785
|
+
)) })
|
|
786
|
+
] })
|
|
787
|
+
] });
|
|
788
|
+
}
|
|
789
|
+
function Re({
|
|
790
|
+
registry: e,
|
|
791
|
+
scenario: t,
|
|
792
|
+
controls: r,
|
|
793
|
+
focusedNode: n,
|
|
794
|
+
tabStopCount: s
|
|
795
|
+
}) {
|
|
796
|
+
const [l, c] = _("scenario"), o = e.issues.filter((u) => u.level === "error").length;
|
|
797
|
+
return /* @__PURE__ */ d("aside", { className: "ds-chrome ds-inspector", "aria-label": "Painel de contexto", children: [
|
|
798
|
+
/* @__PURE__ */ d("div", { className: "ds-inspector__tabs", role: "tablist", children: [
|
|
799
|
+
/* @__PURE__ */ a(L, { id: "scenario", current: l, onSelect: c, children: "Cenário" }),
|
|
800
|
+
/* @__PURE__ */ a(L, { id: "a11y", current: l, onSelect: c, children: "Acessibilidade" }),
|
|
801
|
+
/* @__PURE__ */ a(L, { id: "diagnostics", current: l, onSelect: c, children: o > 0 ? `Diagnóstico (${o})` : "Diagnóstico" })
|
|
802
|
+
] }),
|
|
803
|
+
/* @__PURE__ */ d("div", { className: "ds-inspector__body", role: "tabpanel", children: [
|
|
804
|
+
l === "scenario" && /* @__PURE__ */ a(De, { registry: e, scenario: t, controls: r }),
|
|
805
|
+
l === "a11y" && /* @__PURE__ */ a(
|
|
806
|
+
Ie,
|
|
807
|
+
{
|
|
808
|
+
registry: e,
|
|
809
|
+
scenario: t,
|
|
810
|
+
focusedNode: n,
|
|
811
|
+
keyboardMode: r.keyboardMode,
|
|
812
|
+
tabStopCount: s
|
|
813
|
+
}
|
|
814
|
+
),
|
|
815
|
+
l === "diagnostics" && /* @__PURE__ */ a(Be, { registry: e })
|
|
816
|
+
] })
|
|
817
|
+
] });
|
|
818
|
+
}
|
|
819
|
+
function L({
|
|
820
|
+
id: e,
|
|
821
|
+
current: t,
|
|
822
|
+
onSelect: r,
|
|
823
|
+
children: n
|
|
824
|
+
}) {
|
|
825
|
+
return /* @__PURE__ */ a(
|
|
826
|
+
"button",
|
|
827
|
+
{
|
|
828
|
+
type: "button",
|
|
829
|
+
role: "tab",
|
|
830
|
+
"aria-selected": t === e,
|
|
831
|
+
onClick: () => r(e),
|
|
832
|
+
children: n
|
|
833
|
+
}
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
function De({
|
|
837
|
+
registry: e,
|
|
838
|
+
scenario: t,
|
|
839
|
+
controls: r
|
|
840
|
+
}) {
|
|
841
|
+
if (!t)
|
|
842
|
+
return /* @__PURE__ */ a("p", { className: "ds-block", children: "Nenhum cenário ativo. Escolha uma situação na navegação para ver contexto, regras e critérios." });
|
|
843
|
+
const n = e.persona(r.persona ?? t.persona), s = r.persona ? e.persona(r.persona)?.permissions ?? [] : e.permissionsOf(t), l = e.rulesOf(t), c = e.fixture(r.fixture ?? t.fixture), o = !!(r.persona && r.persona !== t.persona);
|
|
844
|
+
return /* @__PURE__ */ d(x, { children: [
|
|
845
|
+
/* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
846
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Situação" }),
|
|
847
|
+
/* @__PURE__ */ a("p", { style: { color: "var(--ds-fg)", fontSize: 14, fontWeight: 600 }, children: t.title }),
|
|
848
|
+
t.intent && /* @__PURE__ */ a("p", { children: t.intent }),
|
|
849
|
+
/* @__PURE__ */ d("div", { className: "ds-chips", children: [
|
|
850
|
+
/* @__PURE__ */ a("span", { className: "ds-chip", "data-tone": je(t.status), children: S[t.status] }),
|
|
851
|
+
(t.tags ?? []).map((u) => /* @__PURE__ */ a("span", { className: "ds-chip", children: u }, u))
|
|
852
|
+
] }),
|
|
853
|
+
/* @__PURE__ */ a("p", { style: { marginTop: 6 }, children: Le[t.status] })
|
|
854
|
+
] }),
|
|
855
|
+
/* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
856
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Reprodução" }),
|
|
857
|
+
/* @__PURE__ */ d("dl", { className: "ds-kv", children: [
|
|
858
|
+
/* @__PURE__ */ a("dt", { children: "Id" }),
|
|
859
|
+
/* @__PURE__ */ a("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: t.id }),
|
|
860
|
+
/* @__PURE__ */ a("dt", { children: "Rota" }),
|
|
861
|
+
/* @__PURE__ */ a("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: t.route }),
|
|
862
|
+
/* @__PURE__ */ a("dt", { children: "Persona" }),
|
|
863
|
+
/* @__PURE__ */ d("dd", { children: [
|
|
864
|
+
n?.name ?? "—",
|
|
865
|
+
o && /* @__PURE__ */ a("span", { className: "ds-chip", "data-tone": "warn", style: { marginLeft: 6 }, children: "trocada" })
|
|
866
|
+
] }),
|
|
867
|
+
/* @__PURE__ */ a("dt", { children: "Dados" }),
|
|
868
|
+
/* @__PURE__ */ a("dd", { children: c?.label ?? "—" }),
|
|
869
|
+
/* @__PURE__ */ a("dt", { children: "Rede" }),
|
|
870
|
+
/* @__PURE__ */ a("dd", { children: Q[r.network] })
|
|
871
|
+
] }),
|
|
872
|
+
n?.goal && /* @__PURE__ */ d("p", { style: { marginTop: 8 }, children: [
|
|
873
|
+
"Objetivo: ",
|
|
874
|
+
n.goal
|
|
875
|
+
] })
|
|
876
|
+
] }),
|
|
877
|
+
s.length > 0 && /* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
878
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Permissões efetivas" }),
|
|
879
|
+
/* @__PURE__ */ a("div", { className: "ds-chips", children: s.map((u) => /* @__PURE__ */ a("span", { className: "ds-chip", children: u }, u)) })
|
|
880
|
+
] }),
|
|
881
|
+
t.preconditions?.length ? /* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
882
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Pré-condições" }),
|
|
883
|
+
/* @__PURE__ */ a("ul", { className: "ds-list", children: t.preconditions.map((u) => /* @__PURE__ */ a("li", { children: u }, u)) })
|
|
884
|
+
] }) : null,
|
|
885
|
+
l.length > 0 && /* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
886
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Regras" }),
|
|
887
|
+
l.map((u) => /* @__PURE__ */ d("div", { className: "ds-rule", children: [
|
|
888
|
+
/* @__PURE__ */ a("span", { className: "ds-rule__id", children: u.id }),
|
|
889
|
+
/* @__PURE__ */ a("span", { className: "ds-rule__statement", children: u.statement }),
|
|
890
|
+
u.rationale && /* @__PURE__ */ a("p", { className: "ds-rule__rationale", children: u.rationale })
|
|
891
|
+
] }, u.id))
|
|
892
|
+
] }),
|
|
893
|
+
t.actions?.length ? /* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
894
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Ações disponíveis" }),
|
|
895
|
+
/* @__PURE__ */ a("ul", { className: "ds-list", children: t.actions.map((u) => /* @__PURE__ */ a("li", { children: u }, u)) })
|
|
896
|
+
] }) : null,
|
|
897
|
+
t.expected?.length ? /* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
898
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Critérios de aceite" }),
|
|
899
|
+
/* @__PURE__ */ a("ul", { className: "ds-list", children: t.expected.map((u) => /* @__PURE__ */ a("li", { children: u }, u)) })
|
|
900
|
+
] }) : null,
|
|
901
|
+
t.approvedAt && /* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
902
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Aprovação" }),
|
|
903
|
+
/* @__PURE__ */ d("p", { children: [
|
|
904
|
+
t.approvedAt.date,
|
|
905
|
+
" · ",
|
|
906
|
+
/* @__PURE__ */ a("code", { children: t.approvedAt.commit.slice(0, 7) })
|
|
907
|
+
] }),
|
|
908
|
+
/* @__PURE__ */ a("a", { href: t.approvedAt.url, target: "_blank", rel: "noreferrer", children: "Abrir a versão aprovada" })
|
|
909
|
+
] }),
|
|
910
|
+
t.ticket && /* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
911
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Engenharia" }),
|
|
912
|
+
/* @__PURE__ */ a("p", { children: t.ticket })
|
|
913
|
+
] })
|
|
914
|
+
] });
|
|
915
|
+
}
|
|
916
|
+
function Ie({
|
|
917
|
+
registry: e,
|
|
918
|
+
scenario: t,
|
|
919
|
+
focusedNode: r,
|
|
920
|
+
keyboardMode: n,
|
|
921
|
+
tabStopCount: s
|
|
922
|
+
}) {
|
|
923
|
+
const l = ne(e.product.theme?.contrastPairs), c = l.filter((o) => o.passes !== !0);
|
|
924
|
+
return /* @__PURE__ */ d(x, { children: [
|
|
925
|
+
t && /* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
926
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Contrato do cenário" }),
|
|
927
|
+
/* @__PURE__ */ d("dl", { className: "ds-kv", children: [
|
|
928
|
+
/* @__PURE__ */ a("dt", { children: "Teclado" }),
|
|
929
|
+
/* @__PURE__ */ a("dd", { children: Fe[t.a11y.keyboard] }),
|
|
930
|
+
/* @__PURE__ */ a("dt", { children: "Contraste" }),
|
|
931
|
+
/* @__PURE__ */ d("dd", { children: [
|
|
932
|
+
"WCAG 2.2 ",
|
|
933
|
+
t.a11y.contrast
|
|
934
|
+
] })
|
|
935
|
+
] }),
|
|
936
|
+
t.a11y.announces?.length ? /* @__PURE__ */ d(x, { children: [
|
|
937
|
+
/* @__PURE__ */ a("p", { style: { marginTop: 8 }, children: "Precisa ser anunciado:" }),
|
|
938
|
+
/* @__PURE__ */ a("div", { className: "ds-chips", children: t.a11y.announces.map((o) => /* @__PURE__ */ a("span", { className: "ds-chip", children: o }, o)) })
|
|
939
|
+
] }) : null,
|
|
940
|
+
t.a11y.notes && /* @__PURE__ */ a("p", { style: { marginTop: 8 }, children: t.a11y.notes })
|
|
941
|
+
] }),
|
|
942
|
+
/* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
943
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Elemento em foco" }),
|
|
944
|
+
n ? r ? /* @__PURE__ */ d(x, { children: [
|
|
945
|
+
/* @__PURE__ */ d("dl", { className: "ds-kv", children: [
|
|
946
|
+
/* @__PURE__ */ a("dt", { children: "Papel" }),
|
|
947
|
+
/* @__PURE__ */ a("dd", { children: r.role }),
|
|
948
|
+
/* @__PURE__ */ a("dt", { children: "Nome" }),
|
|
949
|
+
/* @__PURE__ */ a("dd", { children: r.name ? r.name : /* @__PURE__ */ a("span", { style: { color: "var(--ds-err)" }, children: "sem nome acessível" }) }),
|
|
950
|
+
/* @__PURE__ */ a("dt", { children: "Nome vem de" }),
|
|
951
|
+
/* @__PURE__ */ a("dd", { children: r.nameFrom }),
|
|
952
|
+
r.description ? /* @__PURE__ */ d(x, { children: [
|
|
953
|
+
/* @__PURE__ */ a("dt", { children: "Descrição" }),
|
|
954
|
+
/* @__PURE__ */ a("dd", { children: r.description })
|
|
955
|
+
] }) : null,
|
|
956
|
+
/* @__PURE__ */ a("dt", { children: "Seletor" }),
|
|
957
|
+
/* @__PURE__ */ a("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: r.selector })
|
|
958
|
+
] }),
|
|
959
|
+
r.states.length > 0 && /* @__PURE__ */ a("div", { className: "ds-chips", style: { marginTop: 8 }, children: r.states.map((o) => /* @__PURE__ */ a("span", { className: "ds-chip", children: o }, o)) }),
|
|
960
|
+
r.hiddenFromAssistiveTech && /* @__PURE__ */ a("p", { className: "ds-note", style: { marginTop: 8 }, children: "Este elemento é focável mas está escondido de tecnologia assistiva. Um leitor de tela recebe foco sem receber conteúdo." }),
|
|
961
|
+
/* @__PURE__ */ d("p", { style: { marginTop: 8 }, children: [
|
|
962
|
+
s,
|
|
963
|
+
" paradas de tabulação no palco."
|
|
964
|
+
] })
|
|
965
|
+
] }) : /* @__PURE__ */ d("p", { children: [
|
|
966
|
+
"Pressione Tab dentro do palco. ",
|
|
967
|
+
s,
|
|
968
|
+
" paradas de tabulação foram encontradas."
|
|
969
|
+
] }) : /* @__PURE__ */ a("p", { children: "Ligue o modo teclado na barra de controles para inspecionar a árvore acessível." })
|
|
970
|
+
] }),
|
|
971
|
+
/* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
972
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Contraste dos tokens" }),
|
|
973
|
+
l.length === 0 ? /* @__PURE__ */ d("p", { children: [
|
|
974
|
+
"O produto não declarou pares de contraste em ",
|
|
975
|
+
/* @__PURE__ */ a("code", { children: "theme.contrastPairs" }),
|
|
976
|
+
". Contraste é propriedade de par de cores: declarar aqui valida na origem, uma vez."
|
|
977
|
+
] }) : /* @__PURE__ */ d("table", { className: "ds-contrast", children: [
|
|
978
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ d("tr", { children: [
|
|
979
|
+
/* @__PURE__ */ a("th", { scope: "col", children: "Par" }),
|
|
980
|
+
/* @__PURE__ */ a("th", { scope: "col", children: "Razão" })
|
|
981
|
+
] }) }),
|
|
982
|
+
/* @__PURE__ */ a("tbody", { children: l.map((o) => /* @__PURE__ */ d("tr", { children: [
|
|
983
|
+
/* @__PURE__ */ d("td", { children: [
|
|
984
|
+
/* @__PURE__ */ a(
|
|
985
|
+
"span",
|
|
986
|
+
{
|
|
987
|
+
className: "ds-swatch",
|
|
988
|
+
style: { background: o.pair.background },
|
|
989
|
+
"aria-hidden": "true"
|
|
990
|
+
}
|
|
991
|
+
),
|
|
992
|
+
/* @__PURE__ */ a(
|
|
993
|
+
"span",
|
|
994
|
+
{
|
|
995
|
+
className: "ds-swatch",
|
|
996
|
+
style: { background: o.pair.foreground },
|
|
997
|
+
"aria-hidden": "true"
|
|
998
|
+
}
|
|
999
|
+
),
|
|
1000
|
+
o.pair.name
|
|
1001
|
+
] }),
|
|
1002
|
+
/* @__PURE__ */ a(
|
|
1003
|
+
"td",
|
|
1004
|
+
{
|
|
1005
|
+
style: {
|
|
1006
|
+
color: o.passes === !0 ? "var(--ds-ok)" : o.passes === !1 ? "var(--ds-err)" : "var(--ds-warn)"
|
|
1007
|
+
},
|
|
1008
|
+
children: o.label
|
|
1009
|
+
}
|
|
1010
|
+
)
|
|
1011
|
+
] }, o.pair.name)) })
|
|
1012
|
+
] }),
|
|
1013
|
+
c.length > 0 && /* @__PURE__ */ d("p", { className: "ds-note", style: { marginTop: 8 }, children: [
|
|
1014
|
+
c.length,
|
|
1015
|
+
" ",
|
|
1016
|
+
c.length === 1 ? "par" : "pares",
|
|
1017
|
+
" fora do alvo. O teste de tokens do produto falha o build por isso."
|
|
1018
|
+
] })
|
|
1019
|
+
] }),
|
|
1020
|
+
/* @__PURE__ */ a("p", { className: "ds-note", children: "Verificação automática é piso, não teto. Ordem de leitura confusa, rótulo tecnicamente presente mas sem sentido e fluxo impossível de completar com leitor de tela passam no axe." })
|
|
1021
|
+
] });
|
|
1022
|
+
}
|
|
1023
|
+
function Be({ registry: e }) {
|
|
1024
|
+
const t = e.coverage(), { issues: r } = e;
|
|
1025
|
+
return /* @__PURE__ */ d(x, { children: [
|
|
1026
|
+
/* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
1027
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Cobertura por status" }),
|
|
1028
|
+
/* @__PURE__ */ a("dl", { className: "ds-kv", children: Object.entries(t).filter(([, n]) => n > 0).map(([n, s]) => /* @__PURE__ */ d("div", { style: { display: "contents" }, children: [
|
|
1029
|
+
/* @__PURE__ */ a("dt", { children: S[n] }),
|
|
1030
|
+
/* @__PURE__ */ a("dd", { style: { fontVariantNumeric: "tabular-nums" }, children: s })
|
|
1031
|
+
] }, n)) }),
|
|
1032
|
+
/* @__PURE__ */ d("p", { style: { marginTop: 8 }, children: [
|
|
1033
|
+
e.product.scenarios.length,
|
|
1034
|
+
" cenários registrados."
|
|
1035
|
+
] })
|
|
1036
|
+
] }),
|
|
1037
|
+
/* @__PURE__ */ d("div", { className: "ds-block", children: [
|
|
1038
|
+
/* @__PURE__ */ a("h2", { className: "ds-block__title", children: "Contrato de cenário" }),
|
|
1039
|
+
r.length === 0 ? /* @__PURE__ */ a("p", { children: "Nenhum problema encontrado." }) : r.map((n, s) => /* @__PURE__ */ d("div", { className: "ds-issue", "data-level": n.level, children: [
|
|
1040
|
+
/* @__PURE__ */ a("span", { className: "ds-issue__where", children: n.where }),
|
|
1041
|
+
n.message
|
|
1042
|
+
] }, `${n.where}-${s}`))
|
|
1043
|
+
] })
|
|
1044
|
+
] });
|
|
1045
|
+
}
|
|
1046
|
+
function je(e) {
|
|
1047
|
+
if (e === "approved" || e === "implemented") return "ok";
|
|
1048
|
+
if (e === "in-review" || e === "proposed") return "warn";
|
|
1049
|
+
}
|
|
1050
|
+
const ze = ee(function({ viewport: t, textScale: r, reducedMotion: n, keyboardMode: s, children: l }, c) {
|
|
1051
|
+
return /* @__PURE__ */ a("div", { className: "ds-stage-scroll", children: /* @__PURE__ */ a(
|
|
1052
|
+
"div",
|
|
1053
|
+
{
|
|
1054
|
+
ref: c,
|
|
1055
|
+
className: "ds-stage",
|
|
1056
|
+
"data-viewport": t.id,
|
|
1057
|
+
"data-keyboard-mode": s,
|
|
1058
|
+
"data-reduced-motion": n,
|
|
1059
|
+
style: {
|
|
1060
|
+
width: t.width ? `${t.width}px` : "100%",
|
|
1061
|
+
minHeight: t.height ? `${t.height}px` : void 0,
|
|
1062
|
+
// A ampliação é aplicada no `font-size` do contêiner, não com
|
|
1063
|
+
// `transform: scale`. É a diferença entre testar se o layout aguenta
|
|
1064
|
+
// texto grande e só dar zoom na captura de tela.
|
|
1065
|
+
fontSize: r === 1 ? void 0 : `${r * 100}%`
|
|
1066
|
+
},
|
|
1067
|
+
children: l
|
|
1068
|
+
}
|
|
1069
|
+
) });
|
|
1070
|
+
});
|
|
1071
|
+
function We({ stops: e }) {
|
|
1072
|
+
return e.length === 0 ? null : /* @__PURE__ */ a("div", { className: "ds-chrome ds-taborder", "aria-hidden": "true", children: e.map((t) => /* @__PURE__ */ a(
|
|
1073
|
+
"span",
|
|
1074
|
+
{
|
|
1075
|
+
className: "ds-taborder__badge",
|
|
1076
|
+
"data-forced": t.forcedOrder,
|
|
1077
|
+
style: { top: t.rect.top, left: t.rect.left },
|
|
1078
|
+
children: t.index
|
|
1079
|
+
},
|
|
1080
|
+
`${t.index}-${t.rect.top}-${t.rect.left}`
|
|
1081
|
+
)) });
|
|
1082
|
+
}
|
|
1083
|
+
function He({ title: e, children: t }) {
|
|
1084
|
+
return /* @__PURE__ */ d("div", { className: "ds-chrome ds-stage-empty", children: [
|
|
1085
|
+
/* @__PURE__ */ a("h2", { children: e }),
|
|
1086
|
+
t
|
|
1087
|
+
] });
|
|
1088
|
+
}
|
|
1089
|
+
function Ue({ registry: e, onOpenScenario: t }) {
|
|
1090
|
+
const { product: r } = e, n = e.coverage(), s = r.scenarios.length;
|
|
1091
|
+
return /* @__PURE__ */ d("div", { className: "ds-chrome ds-home", children: [
|
|
1092
|
+
/* @__PURE__ */ d("header", { className: "ds-home__header", children: [
|
|
1093
|
+
/* @__PURE__ */ a("h1", { children: r.name }),
|
|
1094
|
+
r.tagline && /* @__PURE__ */ a("p", { className: "ds-home__tagline", children: r.tagline }),
|
|
1095
|
+
/* @__PURE__ */ d("p", { className: "ds-home__lead", children: [
|
|
1096
|
+
"Especificação executável: cada situação abaixo abre por link, com persona, dados e regras próprios. ",
|
|
1097
|
+
s,
|
|
1098
|
+
" ",
|
|
1099
|
+
s === 1 ? "situação registrada" : "situações registradas",
|
|
1100
|
+
"."
|
|
1101
|
+
] }),
|
|
1102
|
+
/* @__PURE__ */ a("div", { className: "ds-chips", children: Object.entries(n).filter(([, l]) => l > 0).map(([l, c]) => /* @__PURE__ */ d("span", { className: "ds-chip", children: [
|
|
1103
|
+
S[l],
|
|
1104
|
+
": ",
|
|
1105
|
+
c
|
|
1106
|
+
] }, l)) })
|
|
1107
|
+
] }),
|
|
1108
|
+
e.tree.map(({ module: l, scenarios: c }) => /* @__PURE__ */ a(
|
|
1109
|
+
Ke,
|
|
1110
|
+
{
|
|
1111
|
+
module: l,
|
|
1112
|
+
scenarios: c,
|
|
1113
|
+
registry: e,
|
|
1114
|
+
onOpenScenario: t
|
|
1115
|
+
},
|
|
1116
|
+
l.id
|
|
1117
|
+
)),
|
|
1118
|
+
e.orphans.length > 0 && /* @__PURE__ */ d("section", { className: "ds-home__module", children: [
|
|
1119
|
+
/* @__PURE__ */ a("h2", { children: "Sem módulo" }),
|
|
1120
|
+
/* @__PURE__ */ a("p", { className: "ds-home__hint", children: "O prefixo do id não corresponde a nenhum módulo registrado, então estas situações não aparecem na navegação por módulo." }),
|
|
1121
|
+
/* @__PURE__ */ a(
|
|
1122
|
+
J,
|
|
1123
|
+
{
|
|
1124
|
+
scenarios: e.orphans,
|
|
1125
|
+
registry: e,
|
|
1126
|
+
onOpenScenario: t
|
|
1127
|
+
}
|
|
1128
|
+
)
|
|
1129
|
+
] })
|
|
1130
|
+
] });
|
|
1131
|
+
}
|
|
1132
|
+
function Ke({
|
|
1133
|
+
module: e,
|
|
1134
|
+
scenarios: t,
|
|
1135
|
+
registry: r,
|
|
1136
|
+
onOpenScenario: n
|
|
1137
|
+
}) {
|
|
1138
|
+
return /* @__PURE__ */ d("section", { className: "ds-home__module", children: [
|
|
1139
|
+
/* @__PURE__ */ a("h2", { children: e.name }),
|
|
1140
|
+
e.description && /* @__PURE__ */ a("p", { className: "ds-home__hint", children: e.description }),
|
|
1141
|
+
(e.flows ?? []).map((s) => /* @__PURE__ */ a(Ve, { flow: s, registry: r, onOpenScenario: n }, s.id)),
|
|
1142
|
+
/* @__PURE__ */ a(J, { scenarios: t, registry: r, onOpenScenario: n })
|
|
1143
|
+
] });
|
|
1144
|
+
}
|
|
1145
|
+
function Ve({
|
|
1146
|
+
flow: e,
|
|
1147
|
+
registry: t,
|
|
1148
|
+
onOpenScenario: r
|
|
1149
|
+
}) {
|
|
1150
|
+
return /* @__PURE__ */ d("div", { className: "ds-flow", children: [
|
|
1151
|
+
/* @__PURE__ */ a("h3", { children: e.title }),
|
|
1152
|
+
e.description && /* @__PURE__ */ a("p", { className: "ds-home__hint", children: e.description }),
|
|
1153
|
+
/* @__PURE__ */ a("ol", { className: "ds-flow__steps", children: e.steps.map((n, s) => {
|
|
1154
|
+
const l = t.scenario(n.scenario), c = Object.entries(n.branches ?? {});
|
|
1155
|
+
return /* @__PURE__ */ d("li", { children: [
|
|
1156
|
+
/* @__PURE__ */ a("button", { type: "button", className: "ds-flow__step", onClick: () => r(n.scenario), children: n.label ?? l?.title ?? n.scenario }),
|
|
1157
|
+
n.decision && /* @__PURE__ */ a("p", { className: "ds-flow__decision", children: n.decision }),
|
|
1158
|
+
c.length > 0 && /* @__PURE__ */ a("ul", { className: "ds-flow__branches", children: c.map(([o, u]) => /* @__PURE__ */ d("li", { children: [
|
|
1159
|
+
/* @__PURE__ */ a("span", { className: "ds-flow__branch-label", children: o }),
|
|
1160
|
+
/* @__PURE__ */ a(
|
|
1161
|
+
"button",
|
|
1162
|
+
{
|
|
1163
|
+
type: "button",
|
|
1164
|
+
className: "ds-flow__step",
|
|
1165
|
+
onClick: () => r(u),
|
|
1166
|
+
children: t.scenario(u)?.title ?? u
|
|
1167
|
+
}
|
|
1168
|
+
)
|
|
1169
|
+
] }, o)) })
|
|
1170
|
+
] }, `${n.scenario}-${s}`);
|
|
1171
|
+
}) })
|
|
1172
|
+
] });
|
|
1173
|
+
}
|
|
1174
|
+
function J({
|
|
1175
|
+
scenarios: e,
|
|
1176
|
+
registry: t,
|
|
1177
|
+
onOpenScenario: r
|
|
1178
|
+
}) {
|
|
1179
|
+
return e.length === 0 ? /* @__PURE__ */ a("p", { className: "ds-home__hint", children: "Nenhuma situação registrada neste módulo ainda." }) : /* @__PURE__ */ a("ul", { className: "ds-home__grid", children: e.map((n) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ d("button", { type: "button", className: "ds-home__card", onClick: () => r(n.id), children: [
|
|
1180
|
+
/* @__PURE__ */ d("span", { className: "ds-home__card-head", children: [
|
|
1181
|
+
/* @__PURE__ */ a("span", { className: "ds-status-dot", "data-status": n.status }),
|
|
1182
|
+
/* @__PURE__ */ a("span", { className: "ds-home__card-title", children: n.title })
|
|
1183
|
+
] }),
|
|
1184
|
+
n.intent && /* @__PURE__ */ a("span", { className: "ds-home__card-intent", children: n.intent }),
|
|
1185
|
+
/* @__PURE__ */ d("span", { className: "ds-home__card-meta", children: [
|
|
1186
|
+
t.persona(n.persona)?.name ?? n.persona,
|
|
1187
|
+
" · ",
|
|
1188
|
+
S[n.status],
|
|
1189
|
+
n.a11y.keyboard === "full" ? " · teclado" : ""
|
|
1190
|
+
] })
|
|
1191
|
+
] }) }, n.id)) });
|
|
1192
|
+
}
|
|
1193
|
+
function Xe({ product: e }) {
|
|
1194
|
+
const t = k(() => oe(e), [e]), r = k(() => se(), []), { location: n, controls: s, viewport: l, setControls: c, navigate: o, openScenario: u } = de(t), [m, f] = _(!0), v = te(null), { focused: g, tabStops: i } = Ae(s.keyboardMode, v), h = t.scenario(s.scenario), b = t.persona(s.persona ?? h?.persona), y = t.fixture(s.fixture ?? h?.fixture), $ = k(() => {
|
|
1195
|
+
const N = s.dataSource ?? "fixtures";
|
|
1196
|
+
return N === "fixtures" ? O : e.dataSources?.adapters?.find((w) => w.id === N) ?? O;
|
|
1197
|
+
}, [s.dataSource, e.dataSources?.adapters]), { data: P, isLoading: R, error: D } = ge({ scenario: h, fixture: y, network: s.network, adapter: $ });
|
|
1198
|
+
E(() => {
|
|
1199
|
+
const N = (w) => {
|
|
1200
|
+
if (!(!w.shiftKey || w.metaKey || w.ctrlKey || w.altKey || w.target?.matches("input, textarea, select, [contenteditable='true']"))) {
|
|
1201
|
+
switch (w.key) {
|
|
1202
|
+
case "C":
|
|
1203
|
+
c({ chrome: !s.chrome });
|
|
1204
|
+
break;
|
|
1205
|
+
case "K":
|
|
1206
|
+
c({ keyboardMode: !s.keyboardMode });
|
|
1207
|
+
break;
|
|
1208
|
+
case "P":
|
|
1209
|
+
c({ inspector: !s.inspector });
|
|
1210
|
+
break;
|
|
1211
|
+
default:
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
w.preventDefault();
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
return window.addEventListener("keydown", N), () => window.removeEventListener("keydown", N);
|
|
1218
|
+
}, [s.chrome, s.keyboardMode, s.inspector, c]);
|
|
1219
|
+
const T = k(() => s.persona && s.persona !== h?.persona ? t.persona(s.persona)?.permissions ?? [] : t.permissionsOf(h), [s.persona, t, h]), I = k(
|
|
1220
|
+
() => ({
|
|
1221
|
+
scenario: h,
|
|
1222
|
+
persona: b,
|
|
1223
|
+
permissions: T,
|
|
1224
|
+
can: (N) => T.includes(N),
|
|
1225
|
+
data: P,
|
|
1226
|
+
fixture: y,
|
|
1227
|
+
network: s.network,
|
|
1228
|
+
isLoading: R,
|
|
1229
|
+
error: D,
|
|
1230
|
+
rules: t.rulesOf(h),
|
|
1231
|
+
viewport: l,
|
|
1232
|
+
themeMode: s.themeMode,
|
|
1233
|
+
locale: s.locale,
|
|
1234
|
+
a11y: {
|
|
1235
|
+
keyboardMode: s.keyboardMode,
|
|
1236
|
+
reducedMotion: s.reducedMotion,
|
|
1237
|
+
textScale: s.textScale
|
|
1238
|
+
},
|
|
1239
|
+
navigate: o,
|
|
1240
|
+
openScenario: u
|
|
1241
|
+
}),
|
|
1242
|
+
[
|
|
1243
|
+
h,
|
|
1244
|
+
b,
|
|
1245
|
+
T,
|
|
1246
|
+
P,
|
|
1247
|
+
y,
|
|
1248
|
+
s.network,
|
|
1249
|
+
s.themeMode,
|
|
1250
|
+
s.locale,
|
|
1251
|
+
s.keyboardMode,
|
|
1252
|
+
s.reducedMotion,
|
|
1253
|
+
s.textScale,
|
|
1254
|
+
R,
|
|
1255
|
+
D,
|
|
1256
|
+
t,
|
|
1257
|
+
l,
|
|
1258
|
+
o,
|
|
1259
|
+
u
|
|
1260
|
+
]
|
|
1261
|
+
), X = !h && n.path === "/", A = me(e.routes, n.path), B = e.wrapper, j = e.notFound, z = A ? /* @__PURE__ */ a(A.definition.screen, { params: A.params, context: I }) : j ? /* @__PURE__ */ a(j, { path: n.path }) : /* @__PURE__ */ a(He, { title: "Nenhuma rota para este endereço", children: /* @__PURE__ */ d("p", { children: [
|
|
1262
|
+
/* @__PURE__ */ a("code", { children: n.path }),
|
|
1263
|
+
" não casa com nenhuma rota declarada em",
|
|
1264
|
+
" ",
|
|
1265
|
+
/* @__PURE__ */ a("code", { children: "productDefinition.routes" }),
|
|
1266
|
+
". Escolha uma situação na navegação."
|
|
1267
|
+
] }) }), Z = B ? /* @__PURE__ */ a(B, { context: I, children: z }) : z;
|
|
1268
|
+
return /* @__PURE__ */ d(
|
|
1269
|
+
"div",
|
|
1270
|
+
{
|
|
1271
|
+
className: "ds-root",
|
|
1272
|
+
"data-chrome": s.chrome ? "visible" : "hidden",
|
|
1273
|
+
"data-inspector": s.inspector ? "open" : "closed",
|
|
1274
|
+
"data-sidebar": m ? "open" : "closed",
|
|
1275
|
+
"data-viewport": l.id,
|
|
1276
|
+
children: [
|
|
1277
|
+
s.chrome && /* @__PURE__ */ a(
|
|
1278
|
+
$e,
|
|
1279
|
+
{
|
|
1280
|
+
product: e,
|
|
1281
|
+
scenario: h,
|
|
1282
|
+
deploy: r,
|
|
1283
|
+
inspectorOpen: s.inspector,
|
|
1284
|
+
sidebarOpen: m,
|
|
1285
|
+
onToggleInspector: () => c({ inspector: !s.inspector }),
|
|
1286
|
+
onToggleSidebar: () => f((N) => !N),
|
|
1287
|
+
onHideChrome: () => c({ chrome: !1 })
|
|
1288
|
+
}
|
|
1289
|
+
),
|
|
1290
|
+
s.chrome && /* @__PURE__ */ a(
|
|
1291
|
+
Oe,
|
|
1292
|
+
{
|
|
1293
|
+
registry: t,
|
|
1294
|
+
activeScenario: s.scenario,
|
|
1295
|
+
onOpenScenario: u
|
|
1296
|
+
}
|
|
1297
|
+
),
|
|
1298
|
+
/* @__PURE__ */ d("div", { className: "ds-stage-area", children: [
|
|
1299
|
+
X ? /* @__PURE__ */ a("div", { className: "ds-stage-scroll", children: /* @__PURE__ */ a(Ue, { registry: t, onOpenScenario: u }) }) : /* @__PURE__ */ a(
|
|
1300
|
+
ze,
|
|
1301
|
+
{
|
|
1302
|
+
ref: v,
|
|
1303
|
+
viewport: l,
|
|
1304
|
+
textScale: s.textScale,
|
|
1305
|
+
reducedMotion: s.reducedMotion,
|
|
1306
|
+
keyboardMode: s.keyboardMode,
|
|
1307
|
+
children: Z
|
|
1308
|
+
}
|
|
1309
|
+
),
|
|
1310
|
+
s.chrome && /* @__PURE__ */ a(Pe, { registry: t, controls: s, onChange: c })
|
|
1311
|
+
] }),
|
|
1312
|
+
s.chrome && /* @__PURE__ */ a(
|
|
1313
|
+
Re,
|
|
1314
|
+
{
|
|
1315
|
+
registry: t,
|
|
1316
|
+
scenario: h,
|
|
1317
|
+
controls: s,
|
|
1318
|
+
focusedNode: g,
|
|
1319
|
+
tabStopCount: i.length
|
|
1320
|
+
}
|
|
1321
|
+
),
|
|
1322
|
+
s.keyboardMode && /* @__PURE__ */ a(We, { stops: i }),
|
|
1323
|
+
!s.chrome && /* @__PURE__ */ a(
|
|
1324
|
+
"button",
|
|
1325
|
+
{
|
|
1326
|
+
type: "button",
|
|
1327
|
+
className: "ds-chrome ds-restore",
|
|
1328
|
+
onClick: () => c({ chrome: !0 }),
|
|
1329
|
+
children: "Mostrar controles"
|
|
1330
|
+
}
|
|
1331
|
+
)
|
|
1332
|
+
]
|
|
1333
|
+
}
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1336
|
+
function C(e) {
|
|
1337
|
+
return new Date(e.length === 10 ? `${e}T00:00:00` : e);
|
|
1338
|
+
}
|
|
1339
|
+
function Ze(e, t) {
|
|
1340
|
+
const r = C(e), n = C(t);
|
|
1341
|
+
let s = n.getFullYear() - r.getFullYear();
|
|
1342
|
+
const l = n.getMonth() - r.getMonth();
|
|
1343
|
+
return (l < 0 || l === 0 && n.getDate() < r.getDate()) && (s -= 1), s;
|
|
1344
|
+
}
|
|
1345
|
+
function et(e, t) {
|
|
1346
|
+
const r = C(e), n = C(t);
|
|
1347
|
+
return Math.floor((n.getTime() - r.getTime()) / 864e5);
|
|
1348
|
+
}
|
|
1349
|
+
export {
|
|
1350
|
+
rt as CONTRAST_THRESHOLDS,
|
|
1351
|
+
Xe as DesignSpace,
|
|
1352
|
+
Ue as Home,
|
|
1353
|
+
Fe as KEYBOARD_LABELS,
|
|
1354
|
+
Q as NETWORK_LABELS,
|
|
1355
|
+
q as NETWORK_STATES,
|
|
1356
|
+
p as PARAM,
|
|
1357
|
+
nt as SCENARIO_STATUSES,
|
|
1358
|
+
fe as SLOW_NETWORK_DELAY_MS,
|
|
1359
|
+
S as STATUS_LABELS,
|
|
1360
|
+
Le as STATUS_MEANING,
|
|
1361
|
+
be as SimulatedNetworkError,
|
|
1362
|
+
ze as Stage,
|
|
1363
|
+
He as StageEmpty,
|
|
1364
|
+
G as TEXT_SCALES,
|
|
1365
|
+
We as TabOrderOverlay,
|
|
1366
|
+
Y as VIEWPORTS,
|
|
1367
|
+
Ze as ageInYears,
|
|
1368
|
+
st as applyOverrides,
|
|
1369
|
+
ot as assertContrastPairs,
|
|
1370
|
+
it as checkContrastPair,
|
|
1371
|
+
ne as checkContrastPairs,
|
|
1372
|
+
dt as commitUrl,
|
|
1373
|
+
ke as computeRole,
|
|
1374
|
+
ct as contrastRatio,
|
|
1375
|
+
Je as createHttpAdapter,
|
|
1376
|
+
oe as createRegistry,
|
|
1377
|
+
et as daysBetween,
|
|
1378
|
+
_e as describeElement,
|
|
1379
|
+
O as fixtureAdapter,
|
|
1380
|
+
lt as flatten,
|
|
1381
|
+
ut as formatIssues,
|
|
1382
|
+
se as getDeployContext,
|
|
1383
|
+
ht as hasErrors,
|
|
1384
|
+
he as matchPath,
|
|
1385
|
+
mt as parseColor,
|
|
1386
|
+
ie as parseControls,
|
|
1387
|
+
C as parseIsoDate,
|
|
1388
|
+
pt as readCssVariable,
|
|
1389
|
+
ft as relativeLuminance,
|
|
1390
|
+
F as resolveFixture,
|
|
1391
|
+
me as resolveRoute,
|
|
1392
|
+
ce as resolveViewport,
|
|
1393
|
+
re as scenarioUrl,
|
|
1394
|
+
H as serializeControls,
|
|
1395
|
+
bt as serializeValue,
|
|
1396
|
+
Ee as shortSelector,
|
|
1397
|
+
Te as tabbableElements,
|
|
1398
|
+
de as useDesignSpaceState,
|
|
1399
|
+
Ae as useKeyboardMode,
|
|
1400
|
+
ge as useScenarioData,
|
|
1401
|
+
ae as validateProduct,
|
|
1402
|
+
vt as validateScenario
|
|
1403
|
+
};
|
|
1404
|
+
//# sourceMappingURL=index.js.map
|