@selectwin/kit 0.1.231 → 0.1.233
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/README.md +14 -0
- package/dist/SelectAppDock.d.ts +57 -0
- package/dist/SelectAppDock.js +182 -0
- package/dist/SelectLocale.d.ts +14 -0
- package/dist/SelectLocale.js +22 -0
- package/dist/SelectTutorial.d.ts +48 -0
- package/dist/SelectTutorial.js +184 -0
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +65 -41
- package/dist/index.d.ts +4 -0
- package/dist/index.js +222 -220
- package/dist/internal/dockPlacement.d.ts +47 -0
- package/dist/internal/dockPlacement.js +59 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,20 @@ O card mostra o dado; a explicação vai no tooltip (0.1.196). O "i" `help` est
|
|
|
40
40
|
em cada balde do `SelectBalanceCard`. Na `SelectShareBar`, cada faixa tem o seu tooltip, e a nota da parte vai em
|
|
41
41
|
`tip`; o que o clique faz vai em `selectHint`/`clearHint`, no lugar da linha `hint`.
|
|
42
42
|
|
|
43
|
+
O tutorial flutuante (0.1.232): o `SelectTutorial` é um cartão no canto de baixo à esquerda (o direito é do
|
|
44
|
+
`SelectAssistant`) que abre um vídeo curto, sempre no tema OPOSTO ao do painel, para se destacar — os tokens
|
|
45
|
+
`--select-tutorial-*`, invertidos no bloco do escuro. O vídeo expande para o centro da tela sem recomeçar, e o selo
|
|
46
|
+
"Visto" acende sozinho quando ele termina (`watched` manda, quando vem). Abrir, fechar de vez (`onDismiss`) e guardar o
|
|
47
|
+
que foi visto são de quem usa.
|
|
48
|
+
|
|
49
|
+
A dock da moldura (0.1.233): o `SelectAppDock`, com o `SelectAppDockItem` e o `SelectAppDockSeparator`, é a barra de baixo
|
|
50
|
+
do painel, a `AppDock` que o dashboard-web desenhou. O padrão é a aba que sobe da borda de baixo do painel;
|
|
51
|
+
`variant="floating"` a solta da borda, e `draggable` deixa o usuário levá-la para onde quiser dentro do palco (o ancestral
|
|
52
|
+
posicionado). Ela gruda no centro e nas bordas, a alça anda pelo teclado (as setas, e Home volta) e dois cliques a
|
|
53
|
+
devolvem ao centro de baixo. No celular, ela fica parada embaixo. A posição vem em frações do palco (`null` é a casa), e
|
|
54
|
+
guardar é de quem usa (`position` + `onPositionChange`). Cada item é o alvo inteiro, ícone e nome (`labels` mostra o nome
|
|
55
|
+
embaixo). O item aceso usa `--select-appdock-active` e `--select-appdock-active-ink`, que o app troca pela cor dele.
|
|
56
|
+
|
|
43
57
|
Peer deps: **react**, **react-dom** (obrigatórios); **gsap** (opcional — só componentes animados),
|
|
44
58
|
**react-router-dom** (opcional). Tematização = sobrescrever os tokens CSS `--select-*` / `--sw-*`.
|
|
45
59
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { SelectKitMessages } from './SelectLocale';
|
|
3
|
+
import { DockSpot } from './internal/dockPlacement';
|
|
4
|
+
/** A posição da dock solta: `x` e `y` de 0 a 1 dentro do espaço livre do palco. `null` = a casa (o centro de baixo). */
|
|
5
|
+
export type SelectAppDockPosition = DockSpot;
|
|
6
|
+
export interface SelectAppDockProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
7
|
+
/** O nome da navegação para o leitor de tela ("Navegação principal", "Barra de apps"). */
|
|
8
|
+
label: string;
|
|
9
|
+
/** O nome embaixo de cada ícone. Sem ele, o nome fica na dica. */
|
|
10
|
+
labels?: boolean;
|
|
11
|
+
/** `tab` (padrão): a aba que sobe da borda de baixo do painel. `floating`: solta, a um respiro das bordas. */
|
|
12
|
+
variant?: 'tab' | 'floating';
|
|
13
|
+
/** Só na `floating`: o usuário leva a dock para onde quiser no palco. No celular, ela fica parada embaixo. */
|
|
14
|
+
draggable?: boolean;
|
|
15
|
+
/** A posição (controlada). `null` = a casa. Só vale com `draggable`. */
|
|
16
|
+
position?: SelectAppDockPosition | null;
|
|
17
|
+
/** A posição inicial, quando a dock guarda sozinha. */
|
|
18
|
+
defaultPosition?: SelectAppDockPosition | null;
|
|
19
|
+
/** A dock foi solta num lugar novo (ou voltou para casa: `null`). Guardar é de quem usa. */
|
|
20
|
+
onPositionChange?: (position: SelectAppDockPosition | null) => void;
|
|
21
|
+
/** Os textos, por cima dos do kit (`appFrame.dock`). */
|
|
22
|
+
messages?: Partial<SelectKitMessages['appFrame']['dock']>;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare function SelectAppDock({ label, labels, variant, draggable, position, defaultPosition, onPositionChange, messages, className, style, children, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, ...rest }: SelectAppDockProps): import("react").JSX.Element;
|
|
26
|
+
export interface SelectAppDockItemProps {
|
|
27
|
+
/** O nome: embaixo do ícone (com `labels`), na dica e para o leitor de tela. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** O que vai no botão redondo: o glifo, ou uma peça própria (a capa da aula com o anel do progresso). */
|
|
30
|
+
icon?: ReactNode;
|
|
31
|
+
/** Um link do roteador. */
|
|
32
|
+
to?: string;
|
|
33
|
+
/** Um link comum (passa pelo filtro de endereço do kit). */
|
|
34
|
+
href?: string;
|
|
35
|
+
/** Sem `to` nem `href`, o item é um botão. */
|
|
36
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
37
|
+
/** A página em que o usuário está: o item acende (e é o `aria-current`). */
|
|
38
|
+
active?: boolean;
|
|
39
|
+
/** Um painel aberto por este item: o botão fica aceso e a dica sai (ela ficaria por cima do painel). */
|
|
40
|
+
open?: boolean;
|
|
41
|
+
/** A dica, quando ela diz mais que o nome ("Continuar: Aula 3"). Com uma dica própria, ela aparece também com os nomes à mostra. */
|
|
42
|
+
tip?: ReactNode;
|
|
43
|
+
/** Só num tamanho: `phone` (até 768 px) ou `desktop`. */
|
|
44
|
+
only?: 'phone' | 'desktop';
|
|
45
|
+
/** O nome para o leitor de tela, quando ele diz mais que o `label` ("Continuar: Aula 3, 40% assistido"). */
|
|
46
|
+
'aria-label'?: string;
|
|
47
|
+
/** Num item que abre um painel. */
|
|
48
|
+
'aria-haspopup'?: 'menu' | 'dialog' | 'listbox' | true;
|
|
49
|
+
'aria-expanded'?: boolean;
|
|
50
|
+
className?: string;
|
|
51
|
+
}
|
|
52
|
+
/** Um item da dock: o alvo inteiro é o botão redondo + o nome. */
|
|
53
|
+
export declare function SelectAppDockItem({ label, icon, to, href, onClick, active, open, tip, only, className, ...aria }: SelectAppDockItemProps): import("react").JSX.Element;
|
|
54
|
+
/** O traço entre grupos de itens. */
|
|
55
|
+
export declare function SelectAppDockSeparator({ only }: {
|
|
56
|
+
only?: 'phone' | 'desktop';
|
|
57
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { safeHref as e } from "./internal/safeHref.js";
|
|
2
|
+
import { GripIcon as t } from "./icons.js";
|
|
3
|
+
import { useSelectMessages as n } from "./SelectLocale.js";
|
|
4
|
+
import { useMatchMedia as r } from "./internal/useMatchMedia.js";
|
|
5
|
+
import { dockIsHigh as i, dockPointOf as a, dockSpotOf as o, nudgeDock as s, snapDockPoint as c } from "./internal/dockPlacement.js";
|
|
6
|
+
import { useCallback as l, useEffect as u, useId as d, useLayoutEffect as f, useRef as p, useState as m } from "react";
|
|
7
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
8
|
+
import { Link as v } from "react-router-dom";
|
|
9
|
+
//#region src/SelectAppDock.tsx
|
|
10
|
+
var y = (...e) => e.filter(Boolean).join(" "), ee = "(max-width: 48em)", te = 4, ne = 450, b = 350;
|
|
11
|
+
function x(e) {
|
|
12
|
+
let t = getComputedStyle(e).getPropertyValue("--select-appdock-inset").trim(), n = parseFloat(t);
|
|
13
|
+
return Number.isFinite(n) ? t.endsWith("rem") ? n * parseFloat(getComputedStyle(document.documentElement).fontSize || "16") : t.endsWith("em") ? n * parseFloat(getComputedStyle(e).fontSize || "16") : n : 0;
|
|
14
|
+
}
|
|
15
|
+
function re(e, t) {
|
|
16
|
+
return {
|
|
17
|
+
cw: t.clientWidth,
|
|
18
|
+
ch: t.clientHeight,
|
|
19
|
+
dw: e.offsetWidth,
|
|
20
|
+
dh: e.offsetHeight,
|
|
21
|
+
inset: x(e)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
var S = (e, t) => !!e && e.cw === t.cw && e.ch === t.ch && e.dw === t.dw && e.dh === t.dh && e.inset === t.inset;
|
|
25
|
+
function C({ label: e, labels: v = !1, variant: x = "tab", draggable: C = !1, position: w, defaultPosition: T = null, onPositionChange: E, messages: ie, className: ae, style: D, children: oe, onPointerDown: O, onPointerMove: k, onPointerUp: A, onPointerCancel: j, ...se }) {
|
|
26
|
+
let M = {
|
|
27
|
+
...n().appFrame.dock,
|
|
28
|
+
...ie
|
|
29
|
+
}, ce = r(ee), N = x === "floating" && C && !ce, [P, le] = m(T), F = w !== void 0, I = N ? F ? w : P : null, L = p(null), [R, z] = m(null), [B, V] = m(null), [H, U] = m(!1), W = p(null), G = p(0), K = p(void 0), q = d();
|
|
30
|
+
f(() => {
|
|
31
|
+
let e = L.current, t = e == null ? void 0 : e.offsetParent;
|
|
32
|
+
if (!N || !e || !t) {
|
|
33
|
+
z(null);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let n = () => {
|
|
37
|
+
let n = re(e, t);
|
|
38
|
+
z((e) => S(e, n) ? e : n);
|
|
39
|
+
};
|
|
40
|
+
if (n(), typeof ResizeObserver > "u") return;
|
|
41
|
+
let r = new ResizeObserver(n);
|
|
42
|
+
return r.observe(t), r.observe(e), () => r.disconnect();
|
|
43
|
+
}, [N]), u(() => () => clearTimeout(K.current), []);
|
|
44
|
+
let J = l((e, t) => {
|
|
45
|
+
t && (U(!0), clearTimeout(K.current), K.current = setTimeout(() => U(!1), ne)), F || le(e), E == null || E(e);
|
|
46
|
+
}, [F, E]), Y = N && R !== null, X = Y ? B ?? a(I, R) : null, Z = Y ? a(null, R) : null, ue = (e) => {
|
|
47
|
+
var t, n;
|
|
48
|
+
if (O == null || O(e), !Y || e.button !== 0 || e.defaultPrevented) return;
|
|
49
|
+
let r = e.target;
|
|
50
|
+
(r.closest(".select-appdock__grip") || !r.closest("a, button, input, select, textarea, [role=\"button\"]")) && (W.current = {
|
|
51
|
+
pointer: e.pointerId,
|
|
52
|
+
x: e.clientX,
|
|
53
|
+
y: e.clientY,
|
|
54
|
+
from: a(I, R),
|
|
55
|
+
at: null
|
|
56
|
+
}, (t = (n = e.currentTarget).setPointerCapture) == null || t.call(n, e.pointerId));
|
|
57
|
+
}, de = (e) => {
|
|
58
|
+
k == null || k(e);
|
|
59
|
+
let t = W.current;
|
|
60
|
+
if (!t || t.pointer !== e.pointerId || !R) return;
|
|
61
|
+
let n = e.clientX - t.x, r = e.clientY - t.y;
|
|
62
|
+
!t.at && Math.hypot(n, r) < te || (t.at = c({
|
|
63
|
+
left: t.from.left + n,
|
|
64
|
+
top: t.from.top + r
|
|
65
|
+
}, R), V(t.at));
|
|
66
|
+
}, Q = (e, t) => {
|
|
67
|
+
var n, r;
|
|
68
|
+
let i = W.current;
|
|
69
|
+
if (!i || i.pointer !== e.pointerId || (W.current = null, (n = (r = e.currentTarget).hasPointerCapture) != null && n.call(r, e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), V(null), t || !R)) return;
|
|
70
|
+
if (i.at) {
|
|
71
|
+
G.current = 0, J(o(i.at, R), !1);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let a = e.timeStamp;
|
|
75
|
+
G.current && a - G.current <= b ? (G.current = 0, J(null, !0)) : G.current = a;
|
|
76
|
+
}, fe = (e) => {
|
|
77
|
+
if (!R) return;
|
|
78
|
+
if (e.key === "Home") {
|
|
79
|
+
e.preventDefault(), J(null, !0);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
let t = e.shiftKey ? 96 : 24, n = {
|
|
83
|
+
ArrowLeft: [-t, 0],
|
|
84
|
+
ArrowRight: [t, 0],
|
|
85
|
+
ArrowUp: [0, -t],
|
|
86
|
+
ArrowDown: [0, t]
|
|
87
|
+
}[e.key];
|
|
88
|
+
n && (e.preventDefault(), J(s(I, n[0], n[1], R), !0));
|
|
89
|
+
}, $ = B !== null, pe = !!X && !!Z && Math.abs(X.left - Z.left) < .5 && Math.abs(X.top - Z.top) < .5, me = X ? {
|
|
90
|
+
...D,
|
|
91
|
+
left: X.left,
|
|
92
|
+
top: X.top
|
|
93
|
+
} : D;
|
|
94
|
+
return /* @__PURE__ */ _(h, { children: [$ && Z && R && /* @__PURE__ */ g("span", {
|
|
95
|
+
className: y("select-appdock__home", pe && "is-near"),
|
|
96
|
+
style: {
|
|
97
|
+
left: Z.left,
|
|
98
|
+
top: Z.top,
|
|
99
|
+
width: R.dw,
|
|
100
|
+
height: R.dh
|
|
101
|
+
},
|
|
102
|
+
"aria-hidden": "true"
|
|
103
|
+
}), /* @__PURE__ */ _("div", {
|
|
104
|
+
...se,
|
|
105
|
+
ref: L,
|
|
106
|
+
className: y("select-appdock", `select-appdock--${x}`, v && "is-labeled", N && "is-movable", Y && "is-placed", $ && "is-dragging", H && "is-settling", i(I) && "is-high", ae),
|
|
107
|
+
style: me,
|
|
108
|
+
onPointerDown: ue,
|
|
109
|
+
onPointerMove: de,
|
|
110
|
+
onPointerUp: (e) => {
|
|
111
|
+
A == null || A(e), Q(e, !1);
|
|
112
|
+
},
|
|
113
|
+
onPointerCancel: (e) => {
|
|
114
|
+
j == null || j(e), Q(e, !0);
|
|
115
|
+
},
|
|
116
|
+
children: [N && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("button", {
|
|
117
|
+
type: "button",
|
|
118
|
+
className: "select-appdock__grip",
|
|
119
|
+
"aria-label": M.move,
|
|
120
|
+
"aria-describedby": q,
|
|
121
|
+
onKeyDown: fe,
|
|
122
|
+
children: /* @__PURE__ */ g(t, {})
|
|
123
|
+
}), /* @__PURE__ */ g("span", {
|
|
124
|
+
id: q,
|
|
125
|
+
hidden: !0,
|
|
126
|
+
children: M.moveHint
|
|
127
|
+
})] }), /* @__PURE__ */ g("nav", {
|
|
128
|
+
className: "select-appdock__row",
|
|
129
|
+
"aria-label": e,
|
|
130
|
+
children: oe
|
|
131
|
+
})]
|
|
132
|
+
})] });
|
|
133
|
+
}
|
|
134
|
+
function w({ label: t, icon: n, to: r, href: i, onClick: a, active: o = !1, open: s = !1, tip: c, only: l, className: u, ...d }) {
|
|
135
|
+
let f = y("select-appdock__item", l && `select-appdock__item--${l}`, o && "is-current", s && "is-open", c !== void 0 && "has-tip", u), p = /* @__PURE__ */ _(h, { children: [
|
|
136
|
+
/* @__PURE__ */ g("span", {
|
|
137
|
+
className: "select-appdock__btn",
|
|
138
|
+
"aria-hidden": "true",
|
|
139
|
+
children: n
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ g("span", {
|
|
142
|
+
className: "select-appdock__cap",
|
|
143
|
+
children: t
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ g("span", {
|
|
146
|
+
className: "select-appdock__tip",
|
|
147
|
+
"aria-hidden": "true",
|
|
148
|
+
children: c ?? t
|
|
149
|
+
})
|
|
150
|
+
] }), m = o ? "page" : void 0;
|
|
151
|
+
return r === void 0 ? i === void 0 ? /* @__PURE__ */ g("button", {
|
|
152
|
+
type: "button",
|
|
153
|
+
className: f,
|
|
154
|
+
onClick: a,
|
|
155
|
+
...d,
|
|
156
|
+
children: p
|
|
157
|
+
}) : /* @__PURE__ */ g("a", {
|
|
158
|
+
href: e(i),
|
|
159
|
+
className: f,
|
|
160
|
+
"aria-current": m,
|
|
161
|
+
onClick: a,
|
|
162
|
+
...d,
|
|
163
|
+
children: p
|
|
164
|
+
}) : /* @__PURE__ */ g(v, {
|
|
165
|
+
to: r,
|
|
166
|
+
className: f,
|
|
167
|
+
"aria-current": m,
|
|
168
|
+
onClick: a,
|
|
169
|
+
...d,
|
|
170
|
+
children: p
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function T({ only: e }) {
|
|
174
|
+
return /* @__PURE__ */ g("span", {
|
|
175
|
+
className: y("select-appdock__sep", e && `select-appdock__sep--${e}`),
|
|
176
|
+
"aria-hidden": "true"
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
export { C as SelectAppDock, w as SelectAppDockItem, T as SelectAppDockSeparator };
|
|
181
|
+
|
|
182
|
+
//# sourceMappingURL=SelectAppDock.js.map
|
package/dist/SelectLocale.d.ts
CHANGED
|
@@ -73,6 +73,15 @@ export interface SelectKitMessages {
|
|
|
73
73
|
input: string;
|
|
74
74
|
typing: string;
|
|
75
75
|
};
|
|
76
|
+
/** 0.1.232: o SelectTutorial. */
|
|
77
|
+
tutorial: {
|
|
78
|
+
dismiss: string;
|
|
79
|
+
expand: string;
|
|
80
|
+
shrink: string;
|
|
81
|
+
watched: string;
|
|
82
|
+
/** O nome do cartão e do vídeo grande quando o título não é texto. */
|
|
83
|
+
video: string;
|
|
84
|
+
};
|
|
76
85
|
chipInput: {
|
|
77
86
|
limit: (max: string) => string;
|
|
78
87
|
};
|
|
@@ -165,6 +174,11 @@ export interface SelectKitMessages {
|
|
|
165
174
|
close: string;
|
|
166
175
|
};
|
|
167
176
|
};
|
|
177
|
+
/** 0.1.233: a dock (SelectAppDock): a alça da dock solta e o que ela faz. */
|
|
178
|
+
dock: {
|
|
179
|
+
move: string;
|
|
180
|
+
moveHint: string;
|
|
181
|
+
};
|
|
168
182
|
};
|
|
169
183
|
}
|
|
170
184
|
/** Os dicionários do kit, para quem quer conferir ou montar um texto do mesmo jeito. */
|
package/dist/SelectLocale.js
CHANGED
|
@@ -70,6 +70,13 @@ var r = {
|
|
|
70
70
|
input: "Sua pergunta",
|
|
71
71
|
typing: "Escrevendo…"
|
|
72
72
|
},
|
|
73
|
+
tutorial: {
|
|
74
|
+
dismiss: "Fechar o tutorial",
|
|
75
|
+
expand: "Expandir o vídeo",
|
|
76
|
+
shrink: "Reduzir",
|
|
77
|
+
watched: "Visto",
|
|
78
|
+
video: "Vídeo do tutorial"
|
|
79
|
+
},
|
|
73
80
|
chipInput: { limit: (e) => `Limite de ${e} atingido.` },
|
|
74
81
|
factStrip: {
|
|
75
82
|
done: "feito",
|
|
@@ -163,6 +170,10 @@ var r = {
|
|
|
163
170
|
open: "abrir",
|
|
164
171
|
close: "fechar"
|
|
165
172
|
}
|
|
173
|
+
},
|
|
174
|
+
dock: {
|
|
175
|
+
move: "Mover a barra",
|
|
176
|
+
moveHint: "Arraste para levar a barra a outro lugar, ou use as setas. Home ou dois cliques a devolvem ao centro de baixo."
|
|
166
177
|
}
|
|
167
178
|
}
|
|
168
179
|
},
|
|
@@ -235,6 +246,13 @@ var r = {
|
|
|
235
246
|
input: "Your question",
|
|
236
247
|
typing: "Typing…"
|
|
237
248
|
},
|
|
249
|
+
tutorial: {
|
|
250
|
+
dismiss: "Close the tutorial",
|
|
251
|
+
expand: "Expand the video",
|
|
252
|
+
shrink: "Shrink",
|
|
253
|
+
watched: "Watched",
|
|
254
|
+
video: "Tutorial video"
|
|
255
|
+
},
|
|
238
256
|
chipInput: { limit: (e) => `Limit of ${e} reached.` },
|
|
239
257
|
factStrip: {
|
|
240
258
|
done: "done",
|
|
@@ -328,6 +346,10 @@ var r = {
|
|
|
328
346
|
open: "open",
|
|
329
347
|
close: "close"
|
|
330
348
|
}
|
|
349
|
+
},
|
|
350
|
+
dock: {
|
|
351
|
+
move: "Move the bar",
|
|
352
|
+
moveHint: "Drag to move the bar, or use the arrow keys. Home or a double click puts it back at the bottom centre."
|
|
331
353
|
}
|
|
332
354
|
}
|
|
333
355
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SelectTutorialVideo {
|
|
3
|
+
src: string;
|
|
4
|
+
/** A imagem de capa, antes do play. */
|
|
5
|
+
poster?: string;
|
|
6
|
+
/** O tipo do arquivo (`video/mp4`): o navegador escolhe sem baixar. */
|
|
7
|
+
type?: string;
|
|
8
|
+
/** As legendas, em WebVTT. */
|
|
9
|
+
captions?: {
|
|
10
|
+
src: string;
|
|
11
|
+
srcLang?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface SelectTutorialProps {
|
|
16
|
+
/** A linha de cima ("Tutorial · Primeiros passos"). */
|
|
17
|
+
kicker?: ReactNode;
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
/** O texto sob o vídeo. */
|
|
20
|
+
description?: ReactNode;
|
|
21
|
+
/** O vídeo (com os controles do navegador). */
|
|
22
|
+
video?: SelectTutorialVideo;
|
|
23
|
+
/** Outro conteúdo no lugar do vídeo (uma imagem, um player embutido), na mesma moldura 16:9. */
|
|
24
|
+
media?: ReactNode;
|
|
25
|
+
/** O selo da aula, no canto do vídeo ("Aula 01"). */
|
|
26
|
+
badge?: ReactNode;
|
|
27
|
+
/** Já assistido: o selo "Visto". Sem a prop, ele acende sozinho quando o vídeo termina. */
|
|
28
|
+
watched?: boolean;
|
|
29
|
+
/** O vídeo terminou — para quem chama guardar que foi visto. */
|
|
30
|
+
onEnded?: () => void;
|
|
31
|
+
/** Aberto (controlado). Sem ele, o cartão guarda o próprio estado, a partir de `defaultOpen`. */
|
|
32
|
+
open?: boolean;
|
|
33
|
+
defaultOpen?: boolean;
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
/** O "X" do cartão fechado: quem chama tira o cartão (e guarda que foi fechado). Sem ele, não há "X". */
|
|
36
|
+
onDismiss?: () => void;
|
|
37
|
+
/** O canto de baixo: `left` (padrão) ou `right`. */
|
|
38
|
+
side?: 'left' | 'right';
|
|
39
|
+
/** `viewport` (padrão) prende à janela do navegador; `container`, ao ancestral posicionado. */
|
|
40
|
+
anchor?: 'viewport' | 'container';
|
|
41
|
+
/** Nomes acessíveis — o padrão vem do idioma do kit. */
|
|
42
|
+
dismissLabel?: string;
|
|
43
|
+
expandLabel?: string;
|
|
44
|
+
shrinkLabel?: string;
|
|
45
|
+
watchedLabel?: string;
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function SelectTutorial({ kicker, title, description, video, media, badge, watched, onEnded, open: openProp, defaultOpen, onOpenChange, onDismiss, side, anchor, dismissLabel: dismissLabelProp, expandLabel: expandLabelProp, shrinkLabel: shrinkLabelProp, watchedLabel: watchedLabelProp, className, }: SelectTutorialProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { CheckIcon as e, ChevronDownIcon as t, CloseIcon as n, ExpandIcon as r, PlayIcon as ee, ShrinkIcon as te } from "./icons.js";
|
|
3
|
+
import { useSelectMessages as i } from "./SelectLocale.js";
|
|
4
|
+
import { useFocusTrap as a } from "./internal/useFocusTrap.js";
|
|
5
|
+
import { inertProps as o } from "./internal/inert.js";
|
|
6
|
+
import { useEffect as s, useId as ne, useRef as c, useState as l } from "react";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
//#region src/SelectTutorial.tsx
|
|
9
|
+
function f(e) {
|
|
10
|
+
try {
|
|
11
|
+
e && !e.paused && e.pause();
|
|
12
|
+
} catch {}
|
|
13
|
+
}
|
|
14
|
+
function p({ kicker: p, title: m, description: h, video: g, media: _, badge: v, watched: y, onEnded: b, open: x, defaultOpen: S = !1, onOpenChange: C, onDismiss: w, side: T = "left", anchor: E = "viewport", dismissLabel: D, expandLabel: O, shrinkLabel: k, watchedLabel: A, className: j }) {
|
|
15
|
+
let M = i(), N = D ?? M.tutorial.dismiss, P = O ?? M.tutorial.expand, F = k ?? M.tutorial.shrink, I = A ?? M.tutorial.watched, [L, R] = l(S), z = x ?? L, B = (e) => {
|
|
16
|
+
x === void 0 && R(e), C == null || C(e);
|
|
17
|
+
}, [V, H] = l(!1), [U, W] = l(!1), G = y ?? U, K = ne(), q = c(null), J = c(null), Y = c(null), X = c(null), re = g != null || _ != null;
|
|
18
|
+
a(V, Y), s(() => {
|
|
19
|
+
z || (H(!1), f(X.current));
|
|
20
|
+
}, [z]), s(() => () => f(X.current), []);
|
|
21
|
+
let Z = c(!1);
|
|
22
|
+
s(() => {
|
|
23
|
+
var e;
|
|
24
|
+
!V && Z.current && (Z.current = !1, (e = J.current) == null || e.focus());
|
|
25
|
+
}, [V]);
|
|
26
|
+
let Q = () => {
|
|
27
|
+
Z.current = !0, H(!1);
|
|
28
|
+
}, ie = (e) => {
|
|
29
|
+
if (e.key === "Escape") {
|
|
30
|
+
if (V) e.stopPropagation(), Q();
|
|
31
|
+
else if (z) {
|
|
32
|
+
var t;
|
|
33
|
+
e.stopPropagation(), B(!1), (t = q.current) == null || t.focus();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, ae = () => {
|
|
37
|
+
f(X.current), w == null || w();
|
|
38
|
+
}, $ = typeof m == "string" ? m : M.tutorial.video;
|
|
39
|
+
return /* @__PURE__ */ d("div", {
|
|
40
|
+
className: "select-tutorial" + (T === "right" ? " select-tutorial--right" : "") + (E === "container" ? " select-tutorial--container" : "") + (z ? " is-open" : "") + (V ? " is-theater" : "") + (j ? " " + j : ""),
|
|
41
|
+
onKeyDown: ie,
|
|
42
|
+
children: [V && /* @__PURE__ */ u("div", {
|
|
43
|
+
className: "select-tutorial__scrim",
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
onClick: Q
|
|
46
|
+
}), /* @__PURE__ */ d("section", {
|
|
47
|
+
className: "select-tutorial__card",
|
|
48
|
+
"aria-label": $,
|
|
49
|
+
children: [/* @__PURE__ */ d("div", {
|
|
50
|
+
className: "select-tutorial__head",
|
|
51
|
+
children: [/* @__PURE__ */ d("button", {
|
|
52
|
+
ref: q,
|
|
53
|
+
type: "button",
|
|
54
|
+
className: "select-tutorial__toggle",
|
|
55
|
+
"aria-expanded": z,
|
|
56
|
+
"aria-controls": K,
|
|
57
|
+
onClick: () => B(!z),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ u("span", {
|
|
60
|
+
className: "select-tutorial__play",
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
children: /* @__PURE__ */ u(ee, {})
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ d("span", {
|
|
65
|
+
className: "select-tutorial__heading",
|
|
66
|
+
children: [p != null && /* @__PURE__ */ u("span", {
|
|
67
|
+
className: "select-tutorial__kicker",
|
|
68
|
+
children: p
|
|
69
|
+
}), /* @__PURE__ */ u("span", {
|
|
70
|
+
className: "select-tutorial__title",
|
|
71
|
+
children: m
|
|
72
|
+
})]
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ u("span", {
|
|
75
|
+
className: "select-tutorial__chevron",
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
children: /* @__PURE__ */ u(t, {})
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
}), w && !z && /* @__PURE__ */ u("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
className: "select-tutorial__dismiss",
|
|
83
|
+
onClick: ae,
|
|
84
|
+
"aria-label": N,
|
|
85
|
+
title: N,
|
|
86
|
+
children: /* @__PURE__ */ u(n, {})
|
|
87
|
+
})]
|
|
88
|
+
}), /* @__PURE__ */ u("div", {
|
|
89
|
+
id: K,
|
|
90
|
+
className: "select-tutorial__body",
|
|
91
|
+
...o(!z),
|
|
92
|
+
children: /* @__PURE__ */ u("div", {
|
|
93
|
+
className: "select-tutorial__inner",
|
|
94
|
+
children: /* @__PURE__ */ d("div", {
|
|
95
|
+
className: "select-tutorial__content",
|
|
96
|
+
children: [re && /* @__PURE__ */ u("div", {
|
|
97
|
+
className: "select-tutorial__slot",
|
|
98
|
+
children: /* @__PURE__ */ d("div", {
|
|
99
|
+
ref: Y,
|
|
100
|
+
className: "select-tutorial__stage" + (V ? " is-theater" : ""),
|
|
101
|
+
role: V ? "dialog" : void 0,
|
|
102
|
+
"aria-modal": V ? !0 : void 0,
|
|
103
|
+
"aria-label": V ? $ : void 0,
|
|
104
|
+
tabIndex: V ? -1 : void 0,
|
|
105
|
+
children: [V && /* @__PURE__ */ d("div", {
|
|
106
|
+
className: "select-tutorial__theaterhead",
|
|
107
|
+
children: [/* @__PURE__ */ d("span", {
|
|
108
|
+
className: "select-tutorial__heading",
|
|
109
|
+
children: [p != null && /* @__PURE__ */ u("span", {
|
|
110
|
+
className: "select-tutorial__kicker",
|
|
111
|
+
children: p
|
|
112
|
+
}), /* @__PURE__ */ u("span", {
|
|
113
|
+
className: "select-tutorial__title",
|
|
114
|
+
children: m
|
|
115
|
+
})]
|
|
116
|
+
}), /* @__PURE__ */ d("button", {
|
|
117
|
+
type: "button",
|
|
118
|
+
className: "select-tutorial__shrink",
|
|
119
|
+
onClick: Q,
|
|
120
|
+
children: [/* @__PURE__ */ u(te, {}), F]
|
|
121
|
+
})]
|
|
122
|
+
}), /* @__PURE__ */ d("div", {
|
|
123
|
+
className: "select-tutorial__screen",
|
|
124
|
+
children: [
|
|
125
|
+
g ? /* @__PURE__ */ d("video", {
|
|
126
|
+
ref: X,
|
|
127
|
+
controls: !0,
|
|
128
|
+
playsInline: !0,
|
|
129
|
+
preload: "metadata",
|
|
130
|
+
poster: g.poster,
|
|
131
|
+
onEnded: () => {
|
|
132
|
+
W(!0), b == null || b();
|
|
133
|
+
},
|
|
134
|
+
children: [/* @__PURE__ */ u("source", {
|
|
135
|
+
src: g.src,
|
|
136
|
+
type: g.type
|
|
137
|
+
}), g.captions && /* @__PURE__ */ u("track", {
|
|
138
|
+
kind: "captions",
|
|
139
|
+
src: g.captions.src,
|
|
140
|
+
srcLang: g.captions.srcLang ?? "pt-BR",
|
|
141
|
+
label: g.captions.label,
|
|
142
|
+
default: !0
|
|
143
|
+
})]
|
|
144
|
+
}) : _,
|
|
145
|
+
(v != null || G) && /* @__PURE__ */ d("span", {
|
|
146
|
+
className: "select-tutorial__chips",
|
|
147
|
+
children: [v != null && /* @__PURE__ */ u("span", {
|
|
148
|
+
className: "select-tutorial__chip",
|
|
149
|
+
children: v
|
|
150
|
+
}), G && /* @__PURE__ */ d("span", {
|
|
151
|
+
className: "select-tutorial__chip select-tutorial__chip--seen",
|
|
152
|
+
children: [/* @__PURE__ */ u(e, {}), I]
|
|
153
|
+
})]
|
|
154
|
+
}),
|
|
155
|
+
!V && /* @__PURE__ */ u("button", {
|
|
156
|
+
ref: J,
|
|
157
|
+
type: "button",
|
|
158
|
+
className: "select-tutorial__expand",
|
|
159
|
+
onClick: () => H(!0),
|
|
160
|
+
"aria-label": P,
|
|
161
|
+
title: P,
|
|
162
|
+
children: /* @__PURE__ */ u("span", {
|
|
163
|
+
className: "select-tutorial__expandmark",
|
|
164
|
+
"aria-hidden": "true",
|
|
165
|
+
children: /* @__PURE__ */ u(r, {})
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
})]
|
|
170
|
+
})
|
|
171
|
+
}), h != null && /* @__PURE__ */ u("p", {
|
|
172
|
+
className: "select-tutorial__desc",
|
|
173
|
+
children: h
|
|
174
|
+
})]
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
})]
|
|
178
|
+
})]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
export { p as SelectTutorial };
|
|
183
|
+
|
|
184
|
+
//# sourceMappingURL=SelectTutorial.js.map
|
package/dist/icons.d.ts
CHANGED
|
@@ -156,6 +156,10 @@ export declare function PaletteIcon(): import("react").JSX.Element;
|
|
|
156
156
|
/** Duas barras (Iconsax pause) — pausar uma cobrança recorrente. */
|
|
157
157
|
/** Tocar (0.1.220): o triângulo, o par do `PauseIcon` (o botão de passar sozinho do SelectCarousel). */
|
|
158
158
|
export declare function PlayIcon(): import("react").JSX.Element;
|
|
159
|
+
/** Expandir (0.1.232): os quatro cantos com as setas para fora — o vídeo do SelectTutorial vai ao centro, grande. */
|
|
160
|
+
export declare function ExpandIcon(): import("react").JSX.Element;
|
|
161
|
+
/** Reduzir (0.1.232): o par do `ExpandIcon`, as setas para dentro. */
|
|
162
|
+
export declare function ShrinkIcon(): import("react").JSX.Element;
|
|
159
163
|
export declare function PauseIcon(): import("react").JSX.Element;
|
|
160
164
|
/** Seta voltando em volta (Iconsax arrow-rotate-left) — o ESTORNO: o dinheiro que volta. Não é o
|
|
161
165
|
* `RefreshIcon` (recarregar), que desenha o mesmo gesto para "de novo". */
|