@selectwin/kit 0.1.252 → 0.1.254
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 +83 -69
- package/dist/SelectAttachMenu.d.ts +29 -0
- package/dist/SelectAttachMenu.js +167 -0
- package/dist/SelectAudioRecorder.d.ts +27 -0
- package/dist/SelectAudioRecorder.js +287 -0
- package/dist/SelectAvatar.d.ts +3 -1
- package/dist/SelectAvatar.js +1 -1
- package/dist/SelectChatSendButton.d.ts +14 -0
- package/dist/SelectChatSendButton.js +25 -0
- package/dist/SelectConversation.d.ts +33 -2
- package/dist/SelectConversation.js +127 -83
- package/dist/SelectConversationQuote.d.ts +20 -0
- package/dist/SelectConversationQuote.js +87 -0
- package/dist/SelectConversationReactions.d.ts +31 -0
- package/dist/SelectConversationReactions.js +101 -0
- package/dist/SelectEmojiPicker.d.ts +12 -0
- package/dist/SelectEmojiPicker.js +178 -0
- package/dist/SelectIconTile.d.ts +2 -1
- package/dist/SelectLightbox.d.ts +32 -0
- package/dist/SelectLightbox.js +172 -0
- package/dist/SelectLocale.d.ts +68 -0
- package/dist/SelectLocale.js +140 -0
- package/dist/SelectMail.d.ts +3 -2
- package/dist/SelectMail.js +224 -244
- package/dist/SelectMessageCards.d.ts +150 -0
- package/dist/SelectMessageCards.js +429 -0
- package/dist/SelectMessageTicks.d.ts +7 -0
- package/dist/SelectMessageTicks.js +31 -0
- package/dist/SelectVoiceNote.d.ts +27 -0
- package/dist/SelectVoiceNote.js +245 -0
- package/dist/emojiData.d.ts +33 -0
- package/dist/emojiData.js +103 -0
- package/dist/icons.d.ts +22 -0
- package/dist/icons.js +89 -10
- package/dist/index.d.ts +23 -1
- package/dist/index.js +236 -224
- package/dist/internal/fileKind.d.ts +12 -0
- package/dist/internal/fileKind.js +44 -0
- package/dist/style.css +1 -1
- package/package.json +67 -67
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { CloseIcon as e, PlusIcon as t } from "./icons.js";
|
|
3
|
+
import { useSelectMessages as n } from "./SelectLocale.js";
|
|
4
|
+
import { SelectEmojiPicker as r } from "./SelectEmojiPicker.js";
|
|
5
|
+
import { useRef as i, useState as a } from "react";
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
//#region src/SelectConversationReactions.tsx
|
|
8
|
+
var l = (...e) => e.filter(Boolean).join(" "), u = [
|
|
9
|
+
"👍",
|
|
10
|
+
"❤️",
|
|
11
|
+
"😂",
|
|
12
|
+
"😮",
|
|
13
|
+
"😢",
|
|
14
|
+
"🙏"
|
|
15
|
+
];
|
|
16
|
+
function d({ reactions: e, onToggle: t }) {
|
|
17
|
+
let r = n().chat;
|
|
18
|
+
return e.length ? /* @__PURE__ */ s("div", {
|
|
19
|
+
className: "select-chatreacts",
|
|
20
|
+
role: "group",
|
|
21
|
+
"aria-label": r.reactions,
|
|
22
|
+
children: e.map((e) => {
|
|
23
|
+
let n = e.count ?? 1, i = e.who ? r.reactedWith(e.who, e.emoji) : r.reactionCount(e.emoji, n), a = /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("span", {
|
|
24
|
+
className: "select-chatreacts__emoji",
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
children: e.emoji
|
|
27
|
+
}), /* @__PURE__ */ s("span", {
|
|
28
|
+
className: "select-chatreacts__who",
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
children: e.who ?? n
|
|
31
|
+
})] }), u = l("select-chatreacts__chip", e.mine && "is-mine");
|
|
32
|
+
return t ? /* @__PURE__ */ s("button", {
|
|
33
|
+
type: "button",
|
|
34
|
+
className: u,
|
|
35
|
+
"aria-label": i,
|
|
36
|
+
"aria-pressed": !!e.mine,
|
|
37
|
+
title: i,
|
|
38
|
+
onClick: () => t(e.emoji),
|
|
39
|
+
children: a
|
|
40
|
+
}, e.emoji) : /* @__PURE__ */ s("span", {
|
|
41
|
+
className: u,
|
|
42
|
+
role: "img",
|
|
43
|
+
"aria-label": i,
|
|
44
|
+
title: i,
|
|
45
|
+
children: a
|
|
46
|
+
}, e.emoji);
|
|
47
|
+
})
|
|
48
|
+
}) : null;
|
|
49
|
+
}
|
|
50
|
+
function f({ onPick: o, selected: d, emojis: f = u, more: p = !0, recent: m, "aria-label": h }) {
|
|
51
|
+
let g = n().chat, [_, v] = a(!1), [y, b] = a(0), x = i(null), S = f.length + +!!p;
|
|
52
|
+
return /* @__PURE__ */ c("div", {
|
|
53
|
+
className: "select-reactpicker",
|
|
54
|
+
children: [/* @__PURE__ */ c("div", {
|
|
55
|
+
ref: x,
|
|
56
|
+
className: "select-reactpicker__row",
|
|
57
|
+
role: "toolbar",
|
|
58
|
+
"aria-label": h ?? g.reactionPicker,
|
|
59
|
+
onKeyDown: (e) => {
|
|
60
|
+
var t;
|
|
61
|
+
let n = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0, r = e.key === "Home" ? 0 : e.key === "End" ? S - 1 : null;
|
|
62
|
+
if (!n && r == null) return;
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
let i = r ?? (y + n + S) % S;
|
|
65
|
+
b(i), (t = x.current) == null || (t = t.querySelectorAll("button")[i]) == null || t.focus();
|
|
66
|
+
},
|
|
67
|
+
children: [f.map((e, t) => {
|
|
68
|
+
let n = d === e;
|
|
69
|
+
return /* @__PURE__ */ s("button", {
|
|
70
|
+
type: "button",
|
|
71
|
+
className: l("select-reactpicker__btn", n && "is-selected"),
|
|
72
|
+
tabIndex: t === y ? 0 : -1,
|
|
73
|
+
"aria-label": n ? g.unreact(e) : g.react(e),
|
|
74
|
+
"aria-pressed": n,
|
|
75
|
+
title: n ? g.unreact(e) : g.react(e),
|
|
76
|
+
onFocus: () => b(t),
|
|
77
|
+
onClick: () => o(e),
|
|
78
|
+
children: e
|
|
79
|
+
}, e);
|
|
80
|
+
}), p ? /* @__PURE__ */ s("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
className: "select-reactpicker__btn select-reactpicker__more",
|
|
83
|
+
tabIndex: y === f.length ? 0 : -1,
|
|
84
|
+
"aria-label": _ ? g.lessEmoji : g.moreEmoji,
|
|
85
|
+
"aria-expanded": _,
|
|
86
|
+
title: _ ? g.lessEmoji : g.moreEmoji,
|
|
87
|
+
onFocus: () => b(f.length),
|
|
88
|
+
onClick: () => v((e) => !e),
|
|
89
|
+
children: s(_ ? e : t, {})
|
|
90
|
+
}) : null]
|
|
91
|
+
}), _ ? /* @__PURE__ */ s(r, {
|
|
92
|
+
autoFocus: !0,
|
|
93
|
+
recent: m,
|
|
94
|
+
onPick: o
|
|
95
|
+
}) : null]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { u as SELECT_QUICK_REACTIONS, d as SelectConversationReactions, f as SelectReactionPicker };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=SelectConversationReactions.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SelectEmojiPickerProps {
|
|
2
|
+
/** O emoji escolhido (o caractere pronto para ir na mensagem). */
|
|
3
|
+
onPick: (emoji: string) => void;
|
|
4
|
+
/** Os usados por último, na categoria "Recentes" (os primeiros da lista primeiro). */
|
|
5
|
+
recent?: string[];
|
|
6
|
+
/** Quantos por linha (padrão: 8). */
|
|
7
|
+
columns?: number;
|
|
8
|
+
/** O foco vai para a busca ao aparecer (o seletor que abre num popover). */
|
|
9
|
+
autoFocus?: boolean;
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function SelectEmojiPicker({ onPick, recent, columns, autoFocus, 'aria-label': ariaLabel }: SelectEmojiPickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { useSelectLocale as e, useSelectMessages as t } from "./SelectLocale.js";
|
|
3
|
+
import { SelectSearchInput as n } from "./SelectSearchInput.js";
|
|
4
|
+
import { searchSelectEmoji as r, selectEmojiCategories as i } from "./emojiData.js";
|
|
5
|
+
import { useEffect as a, useId as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
6
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
|
+
//#region src/SelectEmojiPicker.tsx
|
|
8
|
+
var f = (...e) => e.filter(Boolean).join(" ");
|
|
9
|
+
function p({ onPick: p, recent: m, columns: h = 8, autoFocus: g = !1, "aria-label": _ }) {
|
|
10
|
+
var v;
|
|
11
|
+
let y = t().chat, b = e(), x = o(), [S, C] = l(""), [w, T] = l(0), [E, D] = l(null), O = c(null), k = c(null), A = Math.max(1, Math.floor(h)), j = i(), M = (m ?? []).join(""), N = s(() => {
|
|
12
|
+
if (S.trim()) return [{
|
|
13
|
+
id: "results",
|
|
14
|
+
label: y.emojiResults,
|
|
15
|
+
icon: "",
|
|
16
|
+
items: r(S)
|
|
17
|
+
}];
|
|
18
|
+
let e = /* @__PURE__ */ new Map();
|
|
19
|
+
for (let t of j) for (let n of t.emoji) e.set(n.char, n);
|
|
20
|
+
let t = (m ?? []).filter(Boolean).map((t) => e.get(t) ?? {
|
|
21
|
+
char: t,
|
|
22
|
+
pt: [t],
|
|
23
|
+
en: [t]
|
|
24
|
+
}), n = j.map((e) => ({
|
|
25
|
+
id: e.id,
|
|
26
|
+
label: b === "en" ? e.en : e.pt,
|
|
27
|
+
icon: e.icon,
|
|
28
|
+
items: e.emoji
|
|
29
|
+
}));
|
|
30
|
+
return t.length ? [{
|
|
31
|
+
id: "recent",
|
|
32
|
+
label: y.emojiRecent,
|
|
33
|
+
icon: "🕘",
|
|
34
|
+
items: t
|
|
35
|
+
}, ...n] : n;
|
|
36
|
+
}, [
|
|
37
|
+
S,
|
|
38
|
+
M,
|
|
39
|
+
b,
|
|
40
|
+
y
|
|
41
|
+
]), P = s(() => {
|
|
42
|
+
let e = [], t = 0;
|
|
43
|
+
for (let n of N) {
|
|
44
|
+
for (let r = 0; r < n.items.length; r += A) e.push({
|
|
45
|
+
start: t + r,
|
|
46
|
+
length: Math.min(A, n.items.length - r)
|
|
47
|
+
});
|
|
48
|
+
t += n.items.length;
|
|
49
|
+
}
|
|
50
|
+
return e;
|
|
51
|
+
}, [N, A]), F = P.reduce((e, t) => e + t.length, 0);
|
|
52
|
+
a(() => {
|
|
53
|
+
T(0), k.current && (k.current.scrollTop = 0);
|
|
54
|
+
}, [S]), a(() => {
|
|
55
|
+
var e;
|
|
56
|
+
g && ((e = O.current) == null || e.focus({ preventScroll: !0 }));
|
|
57
|
+
}, [g]);
|
|
58
|
+
let I = (e) => (b === "en" ? e.en[0] : e.pt[0]) ?? e.char, L = (e) => {
|
|
59
|
+
var t, n;
|
|
60
|
+
let r = Math.max(0, Math.min(F - 1, e));
|
|
61
|
+
T(r);
|
|
62
|
+
let i = (t = k.current) == null ? void 0 : t.querySelector(`[data-emoji-index="${r}"]`);
|
|
63
|
+
i == null || i.focus({ preventScroll: !0 }), i == null || (n = i.scrollIntoView) == null || n.call(i, { block: "nearest" });
|
|
64
|
+
}, R = (e) => {
|
|
65
|
+
let t = e.target.getAttribute("data-emoji-index");
|
|
66
|
+
if (t == null) return;
|
|
67
|
+
let n = Number(t), r = P.findIndex((e) => n >= e.start && n < e.start + e.length), i = P[r];
|
|
68
|
+
if (!i) return;
|
|
69
|
+
let a = n - i.start, o = !0;
|
|
70
|
+
if (e.key === "ArrowRight") L(n + 1);
|
|
71
|
+
else if (e.key === "ArrowLeft") L(n - 1);
|
|
72
|
+
else if (e.key === "ArrowDown") {
|
|
73
|
+
let e = P[r + 1];
|
|
74
|
+
e && L(e.start + Math.min(a, e.length - 1));
|
|
75
|
+
} else if (e.key === "ArrowUp") {
|
|
76
|
+
var s;
|
|
77
|
+
let e = P[r - 1];
|
|
78
|
+
e ? L(e.start + Math.min(a, e.length - 1)) : (s = O.current) == null || s.focus();
|
|
79
|
+
} else e.key === "Home" ? L(e.ctrlKey ? 0 : i.start) : e.key === "End" ? L(e.ctrlKey ? F - 1 : i.start + i.length - 1) : o = !1;
|
|
80
|
+
o && e.preventDefault();
|
|
81
|
+
}, z = (e) => {
|
|
82
|
+
D(e);
|
|
83
|
+
let t = k.current, n = t == null ? void 0 : t.querySelector(`[data-emoji-section="${e}"]`);
|
|
84
|
+
t && n && (t.scrollTop = n.offsetTop);
|
|
85
|
+
let r = N.findIndex((t) => t.id === e);
|
|
86
|
+
r >= 0 && T(N.slice(0, r).reduce((e, t) => e + t.items.length, 0));
|
|
87
|
+
}, B = () => {
|
|
88
|
+
let e = k.current;
|
|
89
|
+
if (!e || S.trim()) return;
|
|
90
|
+
let t = null;
|
|
91
|
+
e.querySelectorAll("[data-emoji-section]").forEach((n) => {
|
|
92
|
+
n.offsetTop <= e.scrollTop + 8 && (t = n.getAttribute("data-emoji-section"));
|
|
93
|
+
}), D(t);
|
|
94
|
+
}, V = E ?? ((v = N[0]) == null ? void 0 : v.id) ?? null, H = 0;
|
|
95
|
+
return /* @__PURE__ */ d("div", {
|
|
96
|
+
className: "select-emojipicker",
|
|
97
|
+
role: "group",
|
|
98
|
+
"aria-label": _ ?? y.emoji,
|
|
99
|
+
style: { "--select-emoji-cols": A },
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ u(n, {
|
|
102
|
+
size: "sm",
|
|
103
|
+
value: S,
|
|
104
|
+
onChange: (e) => C(e),
|
|
105
|
+
placeholder: y.emojiSearch,
|
|
106
|
+
inputLabel: y.emojiSearch,
|
|
107
|
+
inputRef: O,
|
|
108
|
+
inputProps: {
|
|
109
|
+
autoComplete: "off",
|
|
110
|
+
onKeyDown: (e) => {
|
|
111
|
+
e.key === "ArrowDown" && F > 0 && (e.preventDefault(), L(w));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
S.trim() ? null : /* @__PURE__ */ u("div", {
|
|
116
|
+
className: "select-emojipicker__cats",
|
|
117
|
+
role: "group",
|
|
118
|
+
"aria-label": y.emojiCategories,
|
|
119
|
+
children: N.map((e) => /* @__PURE__ */ u("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
className: f("select-emojipicker__cat", V === e.id && "is-active"),
|
|
122
|
+
"aria-label": e.label,
|
|
123
|
+
"aria-current": V === e.id || void 0,
|
|
124
|
+
title: e.label,
|
|
125
|
+
onClick: () => z(e.id),
|
|
126
|
+
children: /* @__PURE__ */ u("span", {
|
|
127
|
+
"aria-hidden": "true",
|
|
128
|
+
children: e.icon
|
|
129
|
+
})
|
|
130
|
+
}, e.id))
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ d("div", {
|
|
133
|
+
ref: k,
|
|
134
|
+
className: "select-emojipicker__scroll",
|
|
135
|
+
onScroll: B,
|
|
136
|
+
onKeyDown: R,
|
|
137
|
+
children: [N.map((e) => {
|
|
138
|
+
let t = `${x}-${e.id}`;
|
|
139
|
+
return e.items.length ? /* @__PURE__ */ d("div", {
|
|
140
|
+
className: "select-emojipicker__section",
|
|
141
|
+
"data-emoji-section": e.id,
|
|
142
|
+
role: "group",
|
|
143
|
+
"aria-labelledby": t,
|
|
144
|
+
children: [/* @__PURE__ */ u("div", {
|
|
145
|
+
className: "select-emojipicker__heading",
|
|
146
|
+
id: t,
|
|
147
|
+
children: e.label
|
|
148
|
+
}), /* @__PURE__ */ u("div", {
|
|
149
|
+
className: "select-emojipicker__grid",
|
|
150
|
+
children: e.items.map((t) => {
|
|
151
|
+
let n = H++, r = I(t);
|
|
152
|
+
return /* @__PURE__ */ u("button", {
|
|
153
|
+
type: "button",
|
|
154
|
+
className: "select-emojipicker__emoji",
|
|
155
|
+
"data-emoji-index": n,
|
|
156
|
+
tabIndex: n === w ? 0 : -1,
|
|
157
|
+
"aria-label": r,
|
|
158
|
+
title: r,
|
|
159
|
+
onFocus: () => T(n),
|
|
160
|
+
onClick: () => p(t.char),
|
|
161
|
+
children: t.char
|
|
162
|
+
}, `${e.id}-${t.char}`);
|
|
163
|
+
})
|
|
164
|
+
})]
|
|
165
|
+
}, e.id) : null;
|
|
166
|
+
}), S.trim() && F === 0 ? /* @__PURE__ */ u("div", {
|
|
167
|
+
className: "select-emojipicker__empty",
|
|
168
|
+
role: "status",
|
|
169
|
+
children: y.emojiNone
|
|
170
|
+
}) : null]
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
export { p as SelectEmojiPicker };
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=SelectEmojiPicker.js.map
|
package/dist/SelectIconTile.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
/** 0.1.254: `accent` (o tom do acento do app: a foto, a lista, os botões no menu de anexar) e `violet` (o áudio). */
|
|
3
|
+
export type SelectIconTileTone = 'neutral' | 'success' | 'critical' | 'warning' | 'info' | 'pro' | 'accent' | 'violet';
|
|
3
4
|
type SelectIconTileOwnProps = {
|
|
4
5
|
icon: ReactNode;
|
|
5
6
|
tone?: SelectIconTileTone;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SelectLightboxItem {
|
|
3
|
+
src: string;
|
|
4
|
+
/** `video` = o vídeo com os controles do navegador. */
|
|
5
|
+
kind?: 'image' | 'video';
|
|
6
|
+
/** O que a foto mostra. */
|
|
7
|
+
alt?: string;
|
|
8
|
+
/** A legenda, embaixo. */
|
|
9
|
+
caption?: ReactNode;
|
|
10
|
+
/** Quem mandou ("Mariana Costa", "Você"). */
|
|
11
|
+
author?: ReactNode;
|
|
12
|
+
/** Quando ("Hoje, 18:20"). */
|
|
13
|
+
time?: ReactNode;
|
|
14
|
+
/** A foto ou as iniciais de quem mandou (`SelectAvatar`). */
|
|
15
|
+
avatar?: ReactNode;
|
|
16
|
+
/** O link de baixar esta mídia. */
|
|
17
|
+
downloadHref?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SelectLightboxProps {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
items: SelectLightboxItem[];
|
|
23
|
+
/** A mídia à vista (de 0). */
|
|
24
|
+
index: number;
|
|
25
|
+
onIndexChange: (index: number) => void;
|
|
26
|
+
/** "Responder a esta foto": quem usa fecha e põe a citação no compositor. */
|
|
27
|
+
onReply?: (index: number) => void;
|
|
28
|
+
/** Baixar quando o item não tem `downloadHref` (o link gerado na hora). */
|
|
29
|
+
onDownload?: (index: number) => void;
|
|
30
|
+
'aria-label'?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function SelectLightbox({ open, onClose, items, index, onIndexChange, onReply, onDownload, 'aria-label': ariaLabel }: SelectLightboxProps): import('react').ReactPortal | null;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { safeHref as e } from "./internal/safeHref.js";
|
|
3
|
+
import { ChevronLeftIcon as t, ChevronRightIcon as n, CloseIcon as r, DownloadIcon as i, ReplyIcon as a } from "./icons.js";
|
|
4
|
+
import { useSelectMessages as o } from "./SelectLocale.js";
|
|
5
|
+
import { useFocusTrap as s } from "./internal/useFocusTrap.js";
|
|
6
|
+
import { LayerProvider as c, isTopLayer as l, openLayer as u, useParentLayer as d } from "./internal/layers.js";
|
|
7
|
+
import { useEffect as f, useRef as p, useState as m } from "react";
|
|
8
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
import { createPortal as _ } from "react-dom";
|
|
10
|
+
//#region src/SelectLightbox.tsx
|
|
11
|
+
function v({ open: v, onClose: y, items: b, index: x, onIndexChange: S, onReply: C, onDownload: w, "aria-label": T }) {
|
|
12
|
+
let E = o().chat, D = p(null), O = p(null), [k] = m(() => ({})), A = d(), j = p({
|
|
13
|
+
onClose: y,
|
|
14
|
+
onIndexChange: S,
|
|
15
|
+
index: x,
|
|
16
|
+
count: b.length
|
|
17
|
+
});
|
|
18
|
+
j.current = {
|
|
19
|
+
onClose: y,
|
|
20
|
+
onIndexChange: S,
|
|
21
|
+
index: x,
|
|
22
|
+
count: b.length
|
|
23
|
+
};
|
|
24
|
+
let M = b.length, N = Math.max(0, Math.min(M - 1, x)), P = b[N], F = v && P != null;
|
|
25
|
+
if (f(() => {
|
|
26
|
+
var e;
|
|
27
|
+
if (!F) return;
|
|
28
|
+
let t = document.activeElement;
|
|
29
|
+
O.current = t instanceof HTMLElement && t !== document.body ? t : null;
|
|
30
|
+
let n = u(k, A), r = document.body.style.overflow;
|
|
31
|
+
document.body.style.overflow = "hidden", (e = D.current) == null || e.focus({ preventScroll: !0 });
|
|
32
|
+
let i = (e) => {
|
|
33
|
+
if (!l(k)) return;
|
|
34
|
+
let { onClose: t, onIndexChange: n, index: r, count: i } = j.current;
|
|
35
|
+
if (e.key === "Escape") {
|
|
36
|
+
if (e.defaultPrevented) return;
|
|
37
|
+
e.preventDefault(), t();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let a = e.target;
|
|
41
|
+
a != null && a.closest("video, input, textarea, select") || (e.key === "ArrowLeft" && r > 0 ? (e.preventDefault(), n(r - 1)) : e.key === "ArrowRight" && r < i - 1 && (e.preventDefault(), n(r + 1)));
|
|
42
|
+
};
|
|
43
|
+
return document.addEventListener("keydown", i), () => {
|
|
44
|
+
n(), document.removeEventListener("keydown", i), document.body.style.overflow = r;
|
|
45
|
+
let e = O.current;
|
|
46
|
+
O.current = null, e != null && e.isConnected && e.focus({ preventScroll: !0 });
|
|
47
|
+
};
|
|
48
|
+
}, [
|
|
49
|
+
F,
|
|
50
|
+
k,
|
|
51
|
+
A
|
|
52
|
+
]), s(F, D, { initialFocus: !1 }), !F || typeof document > "u") return null;
|
|
53
|
+
let I = e(P.downloadHref), L = M > 1 ? E.counter(N + 1, M) : null;
|
|
54
|
+
return _(/* @__PURE__ */ h("div", {
|
|
55
|
+
ref: D,
|
|
56
|
+
className: "select select-lightbox",
|
|
57
|
+
"data-theme": "dark",
|
|
58
|
+
role: "dialog",
|
|
59
|
+
"aria-modal": "true",
|
|
60
|
+
"aria-label": T ?? E.lightbox,
|
|
61
|
+
tabIndex: -1,
|
|
62
|
+
children: /* @__PURE__ */ g(c, {
|
|
63
|
+
value: k,
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ g("div", {
|
|
66
|
+
className: "select-lightbox__head",
|
|
67
|
+
children: [
|
|
68
|
+
P.avatar ? /* @__PURE__ */ h("span", {
|
|
69
|
+
className: "select-lightbox__avatar",
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
children: P.avatar
|
|
72
|
+
}) : null,
|
|
73
|
+
/* @__PURE__ */ g("span", {
|
|
74
|
+
className: "select-lightbox__who",
|
|
75
|
+
children: [P.author == null ? null : /* @__PURE__ */ h("span", {
|
|
76
|
+
className: "select-lightbox__author",
|
|
77
|
+
children: P.author
|
|
78
|
+
}), P.time != null || L ? /* @__PURE__ */ g("span", {
|
|
79
|
+
className: "select-lightbox__sub",
|
|
80
|
+
children: [
|
|
81
|
+
P.time,
|
|
82
|
+
P.time != null && L ? " · " : null,
|
|
83
|
+
L ? /* @__PURE__ */ h("span", {
|
|
84
|
+
"aria-live": "polite",
|
|
85
|
+
children: L
|
|
86
|
+
}) : null
|
|
87
|
+
]
|
|
88
|
+
}) : null]
|
|
89
|
+
}),
|
|
90
|
+
C ? /* @__PURE__ */ h("button", {
|
|
91
|
+
type: "button",
|
|
92
|
+
className: "select-lightbox__btn",
|
|
93
|
+
onClick: () => C(N),
|
|
94
|
+
"aria-label": E.reply,
|
|
95
|
+
title: E.reply,
|
|
96
|
+
children: /* @__PURE__ */ h(a, {})
|
|
97
|
+
}) : null,
|
|
98
|
+
I === void 0 ? w ? /* @__PURE__ */ h("button", {
|
|
99
|
+
type: "button",
|
|
100
|
+
className: "select-lightbox__btn",
|
|
101
|
+
onClick: () => w(N),
|
|
102
|
+
"aria-label": E.downloadMedia,
|
|
103
|
+
title: E.downloadMedia,
|
|
104
|
+
children: /* @__PURE__ */ h(i, {})
|
|
105
|
+
}) : null : /* @__PURE__ */ h("a", {
|
|
106
|
+
className: "select-lightbox__btn",
|
|
107
|
+
href: I,
|
|
108
|
+
download: !0,
|
|
109
|
+
target: "_blank",
|
|
110
|
+
rel: "noopener noreferrer",
|
|
111
|
+
"aria-label": E.downloadMedia,
|
|
112
|
+
title: E.downloadMedia,
|
|
113
|
+
children: /* @__PURE__ */ h(i, {})
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ h("button", {
|
|
116
|
+
type: "button",
|
|
117
|
+
className: "select-lightbox__btn",
|
|
118
|
+
onClick: y,
|
|
119
|
+
"aria-label": E.close,
|
|
120
|
+
title: E.close,
|
|
121
|
+
children: /* @__PURE__ */ h(r, {})
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ g("div", {
|
|
126
|
+
className: "select-lightbox__stage",
|
|
127
|
+
children: [
|
|
128
|
+
M > 1 ? /* @__PURE__ */ h("button", {
|
|
129
|
+
type: "button",
|
|
130
|
+
className: "select-lightbox__nav",
|
|
131
|
+
onClick: () => S(N - 1),
|
|
132
|
+
disabled: N === 0,
|
|
133
|
+
"aria-label": E.previous,
|
|
134
|
+
title: E.previous,
|
|
135
|
+
children: /* @__PURE__ */ h(t, {})
|
|
136
|
+
}) : null,
|
|
137
|
+
/* @__PURE__ */ h("div", {
|
|
138
|
+
className: "select-lightbox__figure",
|
|
139
|
+
children: P.kind === "video" ? /* @__PURE__ */ h("video", {
|
|
140
|
+
className: "select-lightbox__media",
|
|
141
|
+
src: P.src,
|
|
142
|
+
controls: !0,
|
|
143
|
+
preload: "metadata"
|
|
144
|
+
}, P.src) : /* @__PURE__ */ h("img", {
|
|
145
|
+
className: "select-lightbox__media",
|
|
146
|
+
src: P.src,
|
|
147
|
+
alt: P.alt ?? ""
|
|
148
|
+
}, P.src)
|
|
149
|
+
}),
|
|
150
|
+
M > 1 ? /* @__PURE__ */ h("button", {
|
|
151
|
+
type: "button",
|
|
152
|
+
className: "select-lightbox__nav",
|
|
153
|
+
onClick: () => S(N + 1),
|
|
154
|
+
disabled: N === M - 1,
|
|
155
|
+
"aria-label": E.next,
|
|
156
|
+
title: E.next,
|
|
157
|
+
children: /* @__PURE__ */ h(n, {})
|
|
158
|
+
}) : null
|
|
159
|
+
]
|
|
160
|
+
}),
|
|
161
|
+
P.caption == null ? null : /* @__PURE__ */ h("div", {
|
|
162
|
+
className: "select-lightbox__caption",
|
|
163
|
+
children: P.caption
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
})
|
|
167
|
+
}), document.body);
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
export { v as SelectLightbox };
|
|
171
|
+
|
|
172
|
+
//# sourceMappingURL=SelectLightbox.js.map
|
package/dist/SelectLocale.d.ts
CHANGED
|
@@ -124,6 +124,74 @@ export interface SelectKitMessages {
|
|
|
124
124
|
attachmentBusy: (name: string) => string;
|
|
125
125
|
attachmentGet: (name: string) => string;
|
|
126
126
|
};
|
|
127
|
+
/**
|
|
128
|
+
* 0.1.254: as peças do chat (o inbox do WhatsApp) — o estado do envio, a citação, as reações, o seletor de emoji, o
|
|
129
|
+
* áudio, o gravador, os cartões das mensagens, o visualizador de mídia e o menu de anexar.
|
|
130
|
+
*/
|
|
131
|
+
chat: {
|
|
132
|
+
status: Record<'queued' | 'sent' | 'delivered' | 'read' | 'failed', string>;
|
|
133
|
+
quote: string;
|
|
134
|
+
quoteJump: string;
|
|
135
|
+
replyingTo: string;
|
|
136
|
+
cancelReply: string;
|
|
137
|
+
reactions: string;
|
|
138
|
+
reactedWith: (who: string, emoji: string) => string;
|
|
139
|
+
reactionCount: (emoji: string, n: number) => string;
|
|
140
|
+
react: (emoji: string) => string;
|
|
141
|
+
unreact: (emoji: string) => string;
|
|
142
|
+
reactionPicker: string;
|
|
143
|
+
moreEmoji: string;
|
|
144
|
+
lessEmoji: string;
|
|
145
|
+
emoji: string;
|
|
146
|
+
emojiSearch: string;
|
|
147
|
+
emojiCategories: string;
|
|
148
|
+
emojiNone: string;
|
|
149
|
+
emojiResults: string;
|
|
150
|
+
emojiRecent: string;
|
|
151
|
+
play: string;
|
|
152
|
+
pause: string;
|
|
153
|
+
seek: string;
|
|
154
|
+
position: (at: string, total: string) => string;
|
|
155
|
+
speed: (rate: string) => string;
|
|
156
|
+
voiceNote: string;
|
|
157
|
+
audioFailed: string;
|
|
158
|
+
recorder: string;
|
|
159
|
+
recording: string;
|
|
160
|
+
recPaused: string;
|
|
161
|
+
recRequesting: string;
|
|
162
|
+
recDiscard: string;
|
|
163
|
+
recPause: string;
|
|
164
|
+
recResume: string;
|
|
165
|
+
recSend: string;
|
|
166
|
+
recDenied: string;
|
|
167
|
+
recNoMic: string;
|
|
168
|
+
recUnsupported: string;
|
|
169
|
+
recFailed: string;
|
|
170
|
+
retry: string;
|
|
171
|
+
close: string;
|
|
172
|
+
openMap: string;
|
|
173
|
+
location: string;
|
|
174
|
+
download: (name: string) => string;
|
|
175
|
+
openPhoto: string;
|
|
176
|
+
openMedia: (at: number, count: number) => string;
|
|
177
|
+
moreMedia: (n: number) => string;
|
|
178
|
+
album: (n: number) => string;
|
|
179
|
+
video: string;
|
|
180
|
+
lightbox: string;
|
|
181
|
+
previous: string;
|
|
182
|
+
next: string;
|
|
183
|
+
counter: (at: number, count: number) => string;
|
|
184
|
+
reply: string;
|
|
185
|
+
downloadMedia: string;
|
|
186
|
+
attach: string;
|
|
187
|
+
unread: (n: number) => string;
|
|
188
|
+
messageActions: string;
|
|
189
|
+
template: string;
|
|
190
|
+
listOptions: string;
|
|
191
|
+
copied: string;
|
|
192
|
+
send: string;
|
|
193
|
+
record: string;
|
|
194
|
+
};
|
|
127
195
|
/** 0.1.223: a entrada — o nome de cada caixinha do código (SelectOtpInput) e a força da senha (SelectPasswordStrength). */
|
|
128
196
|
auth: {
|
|
129
197
|
digit: (n: number) => string;
|