@selectwin/kit 0.1.255 → 0.1.257
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 +25 -0
- package/dist/SelectAppFrame.d.ts +23 -4
- package/dist/SelectAppFrame.js +120 -111
- package/dist/SelectConversationNote.d.ts +37 -0
- package/dist/SelectConversationNote.js +93 -0
- package/dist/SelectLocale.d.ts +6 -0
- package/dist/SelectLocale.js +12 -2
- package/dist/SelectMail.d.ts +17 -2
- package/dist/SelectMail.js +9 -6
- package/dist/SelectScrollArea.d.ts +19 -0
- package/dist/SelectScrollArea.js +23 -0
- package/dist/SelectTriggerMenu.d.ts +77 -0
- package/dist/SelectTriggerMenu.js +98 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +185 -182
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,6 +74,31 @@ não o verde do WhatsApp; os tons do chat se trocam pelos `--select-chat-*` (a l
|
|
|
74
74
|
O vazio das listas tem módulo próprio (0.1.234): o `SelectTableEmpty` só depende do React, e a `SelectCardGrid` não
|
|
75
75
|
leva mais a tabela nem o GSAP. O teste `SelectTableEmpty.test.ts` trava esse grafo de imports.
|
|
76
76
|
|
|
77
|
+
O scroll padrão (0.1.256): o `SelectScrollArea` é a caixa que rola com a barra fina do kit — o polegar no cinza da borda
|
|
78
|
+
do campo (`--select-scrollbar-thumb`, mais escuro com o mouse em cima: `--select-scrollbar-thumb-hover`), a trilha
|
|
79
|
+
transparente, a calha guardada no eixo vertical e a rolagem que não passa para a página. `axis` escolhe o eixo (`y`, o
|
|
80
|
+
padrão, `x` ou `both`), `hideBar` esconde a barra (a tira que corre de lado), `label` faz do conteúdo sem nada focável
|
|
81
|
+
uma região que entra no Tab, e `as` troca a tag. O desenho é a classe `.select-scroll` (`--y`, `--x`, `--both`,
|
|
82
|
+
`--nobar`), e as barras finas dos componentes leem os mesmos tokens. Num módulo próprio, que só depende do React.
|
|
83
|
+
|
|
84
|
+
A moldura sem a rolagem da janela (0.1.256): `SelectAppFrame contained` (opcional; sem ela, nada muda). A moldura ocupa a
|
|
85
|
+
tela, a barra e o trilho ficam parados e a página rola no invólucro do `SelectAppPanel`, de ponta a ponta à direita do
|
|
86
|
+
trilho, com a barra na borda do painel. O `scrollRef` do painel entrega o invólucro (para voltar ao topo na troca de
|
|
87
|
+
página), e o `fill` serve à página de altura cheia: a coluna da página tem a altura do invólucro e é uma coluna flex.
|
|
88
|
+
|
|
89
|
+
A nota interna e a lista do "/" e da "@" (0.1.257, o CRM sobre o Chat da SWMX; as pranchas O-Inbox e C-Mobile do
|
|
90
|
+
canvas do CRM): o `SelectConversationNote` é a nota entre as mensagens, do lado de quem responde, no fundo de aviso com a
|
|
91
|
+
borda tracejada, o cadeado e "Nota interna · só a equipe vê" em cima e, no pé, quem escreveu, a hora e quem foi avisado;
|
|
92
|
+
o `SelectMentionText` (com o `SelectMention` e o `selectMentionParts`) destaca cada "@nome" no começo de uma palavra, sem
|
|
93
|
+
pegar o e-mail; o `SelectNoteField` é a caixa do compositor no modo nota (o mesmo desenho, "Só a equipe vê · o contato
|
|
94
|
+
não" em cima e o campo do app por dentro), e o `SelectNoteDot`, o quadradinho do "Nota interna" no segmentado. O
|
|
95
|
+
`SelectTriggerMenu` é a lista que abre por um caractere, acima da caixa: o título, a dica do teclado, o atalho em código
|
|
96
|
+
(`code`) ou o avatar e o nome, o texto e de quem é, "Buscando…" e "Nada encontrado". O foco fica na caixa (o
|
|
97
|
+
`selectTriggerFieldProps` dá o `aria-controls` e o `aria-activedescendant`), e o teclado é do `useSelectTriggerMenu` (↑ ↓
|
|
98
|
+
dão a volta, Enter e Tab escolhem, Esc fecha). O `selectTriggerAt` acha o "/" ou a "@" no começo da palavra do cursor, e
|
|
99
|
+
o `selectReplaceTrigger` troca o gatilho e a busca pelo escolhido. Os tons: os do aviso, mais `--select-note-border`,
|
|
100
|
+
`--select-note-meta` e `--select-note-dot` (o claro e o escuro).
|
|
101
|
+
|
|
77
102
|
## Build
|
|
78
103
|
|
|
79
104
|
```bash
|
package/dist/SelectAppFrame.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
|
|
2
2
|
import { SelectKitMessages } from './SelectLocale';
|
|
3
3
|
export interface SelectAppFrameProps extends ComponentPropsWithoutRef<'div'> {
|
|
4
4
|
/** O "Pular para o conteúdo": o primeiro Tab da página leva direto à coluna dela. */
|
|
@@ -6,15 +6,34 @@ export interface SelectAppFrameProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
6
6
|
to: string;
|
|
7
7
|
label: string;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* 0.1.256: a janela não rola. A moldura ocupa a tela, a barra e o trilho ficam parados e a página rola dentro do painel,
|
|
11
|
+
* no invólucro de ponta a ponta à direita do trilho (o `scrollRef` do `SelectAppPanel`). Padrão `false`: nada muda.
|
|
12
|
+
*/
|
|
13
|
+
contained?: boolean;
|
|
9
14
|
}
|
|
10
15
|
/** O fundo escuro de toda a tela (o da barra: o painel claro sobe dele) e o atalho para o conteúdo. */
|
|
11
|
-
export declare function SelectAppFrame({ skip, className, children, ...rest }: SelectAppFrameProps): import("react").JSX.Element;
|
|
16
|
+
export declare function SelectAppFrame({ skip, contained, className, children, ...rest }: SelectAppFrameProps): import("react").JSX.Element;
|
|
12
17
|
export interface SelectAppPanelProps extends ComponentPropsWithoutRef<'div'> {
|
|
13
18
|
/** O trilho das seções (`SelectAppRail`): no computador, numa coluna à esquerda; abaixo de 1024 px, some. */
|
|
14
19
|
rail?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* 0.1.256, na moldura `contained`: o invólucro que rola a página. É por ele que o app volta ao topo na troca de página
|
|
22
|
+
* (`scrollTop = 0`) e lê a rolagem — a janela não rola.
|
|
23
|
+
*/
|
|
24
|
+
scrollRef?: Ref<HTMLDivElement>;
|
|
25
|
+
/**
|
|
26
|
+
* 0.1.256, na moldura `contained`: a página de altura cheia (o construtor de um fluxo, a caixa de entrada). A coluna da
|
|
27
|
+
* página tem a altura do invólucro e é uma coluna flex — o filho com `flex: 1` ocupa o que sobra, sem medir a janela —,
|
|
28
|
+
* e o invólucro não guarda a calha da barra. Numa tela baixa demais, o invólucro rola.
|
|
29
|
+
*/
|
|
30
|
+
fill?: boolean;
|
|
15
31
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
32
|
+
/**
|
|
33
|
+
* O painel claro de cantos redondos, embaixo da barra: o trilho e a página. Na moldura `contained`, a página vai no
|
|
34
|
+
* invólucro que rola (`select-appframe__scroll`), e o trilho fica fora dele, parado.
|
|
35
|
+
*/
|
|
36
|
+
export declare function SelectAppPanel({ rail, scrollRef, fill, className, children, ...rest }: SelectAppPanelProps): import("react").JSX.Element;
|
|
18
37
|
export interface SelectAppMainProps extends ComponentPropsWithoutRef<'main'> {
|
|
19
38
|
/**
|
|
20
39
|
* Um menu lateral da área (a Operação, com as páginas em grupos): uma coluna ao lado do conteúdo, embaixo do cabeçalho
|
package/dist/SelectAppFrame.js
CHANGED
|
@@ -1,153 +1,162 @@
|
|
|
1
1
|
import { ChevronDownIcon as e, CloseIcon as t, MenuIcon as n } from "./icons.js";
|
|
2
2
|
import { useSelectMessages as r } from "./SelectLocale.js";
|
|
3
3
|
import { SelectIconButton as i } from "./SelectIconButton.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { selectScrollClass as a } from "./SelectScrollArea.js";
|
|
5
|
+
import { createContext as o, forwardRef as s, useContext as c, useEffect as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
|
|
6
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
7
|
+
import { Link as g } from "react-router-dom";
|
|
7
8
|
//#region src/SelectAppFrame.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
...
|
|
12
|
-
className:
|
|
13
|
-
children: [e && /* @__PURE__ */
|
|
9
|
+
var _ = (...e) => e.filter(Boolean).join(" "), v = o(!1);
|
|
10
|
+
function y({ skip: e, contained: t = !1, className: n, children: r, ...i }) {
|
|
11
|
+
return /* @__PURE__ */ h("div", {
|
|
12
|
+
...i,
|
|
13
|
+
className: _("select-appframe", t && "select-appframe--contained", n),
|
|
14
|
+
children: [e && /* @__PURE__ */ m("a", {
|
|
14
15
|
href: e.to,
|
|
15
16
|
className: "select-appframe__skip",
|
|
16
17
|
children: e.label
|
|
17
|
-
}),
|
|
18
|
+
}), t ? /* @__PURE__ */ m(v.Provider, {
|
|
19
|
+
value: !0,
|
|
20
|
+
children: r
|
|
21
|
+
}) : r]
|
|
18
22
|
});
|
|
19
23
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
function b({ rail: e, scrollRef: t, fill: n = !1, className: r, children: i, ...o }) {
|
|
25
|
+
let s = c(v);
|
|
26
|
+
return /* @__PURE__ */ h("div", {
|
|
27
|
+
...o,
|
|
28
|
+
className: _("select-appframe__panel", r),
|
|
29
|
+
children: [e, s ? /* @__PURE__ */ m("div", {
|
|
30
|
+
ref: t,
|
|
31
|
+
className: _("select-appframe__scroll", a("y"), n && "select-appframe__scroll--fill"),
|
|
32
|
+
children: i
|
|
33
|
+
}) : i]
|
|
25
34
|
});
|
|
26
35
|
}
|
|
27
|
-
var
|
|
36
|
+
var x = s(function({ aside: e, asideCompact: t, className: n, children: r, ...i }, a) {
|
|
28
37
|
let o = e != null || t != null;
|
|
29
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ h("main", {
|
|
30
39
|
ref: a,
|
|
31
40
|
...i,
|
|
32
|
-
className:
|
|
33
|
-
children: [o && /* @__PURE__ */
|
|
41
|
+
className: _("select-appframe__main", o && "select-appframe__main--aside", n),
|
|
42
|
+
children: [o && /* @__PURE__ */ h("div", {
|
|
34
43
|
className: "select-appframe__aside",
|
|
35
|
-
children: [e != null && /* @__PURE__ */
|
|
44
|
+
children: [e != null && /* @__PURE__ */ m("div", {
|
|
36
45
|
className: "select-appframe__asidenav",
|
|
37
46
|
children: e
|
|
38
|
-
}), t != null && /* @__PURE__ */
|
|
47
|
+
}), t != null && /* @__PURE__ */ m("div", {
|
|
39
48
|
className: "select-appframe__asidecompact",
|
|
40
49
|
children: t
|
|
41
50
|
})]
|
|
42
51
|
}), r]
|
|
43
52
|
});
|
|
44
53
|
});
|
|
45
|
-
function
|
|
46
|
-
return /* @__PURE__ */
|
|
54
|
+
function S({ pages: e, onPick: t }) {
|
|
55
|
+
return /* @__PURE__ */ m(p, { children: e.map((e) => /* @__PURE__ */ m(g, {
|
|
47
56
|
to: e.to,
|
|
48
|
-
className:
|
|
57
|
+
className: _("select-apprail__page", e.current && "is-active"),
|
|
49
58
|
"aria-current": e.current ? "page" : void 0,
|
|
50
59
|
onClick: t,
|
|
51
60
|
children: e.label
|
|
52
61
|
}, e.id)) });
|
|
53
62
|
}
|
|
54
|
-
function
|
|
55
|
-
var
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
let
|
|
63
|
+
function C({ items: t, wide: n, open: r, setOpen: i, flyout: a, setFlyout: o, up: s = !1, t: c }) {
|
|
64
|
+
var f, p;
|
|
65
|
+
let v = t.findIndex((e) => e.active), y = d(0);
|
|
66
|
+
v >= 0 && (y.current = v);
|
|
67
|
+
let b = n ? t.findIndex((e) => {
|
|
59
68
|
var t;
|
|
60
69
|
return e.id === r && (((t = e.pages) == null ? void 0 : t.length) ?? 0) > 0;
|
|
61
|
-
}) : -1,
|
|
62
|
-
return
|
|
70
|
+
}) : -1, x = b >= 0 && b < y.current ? ((f = t[b].pages) == null ? void 0 : f.length) ?? 0 : 0, C = d(null), w = d(null), T = (p = t.flatMap((e) => e.pages ?? []).find((e) => e.current)) == null ? void 0 : p.id;
|
|
71
|
+
return u(() => {
|
|
63
72
|
let e = w.current;
|
|
64
|
-
e && (e.style.setProperty("--rail-i", String(
|
|
65
|
-
}),
|
|
73
|
+
e && (e.style.setProperty("--rail-i", String(y.current)), e.style.setProperty("--rail-pn", String(x)), e.style.setProperty("--rail-pb", x > 0 ? "1" : "0"));
|
|
74
|
+
}), l(() => {
|
|
66
75
|
var e, t;
|
|
67
76
|
n && ((e = C.current) == null || (e = e.querySelector(".select-apprail__page[aria-current=\"page\"]")) == null || (t = e.scrollIntoView) == null || t.call(e, { block: "nearest" }));
|
|
68
77
|
}, [
|
|
69
78
|
T,
|
|
70
79
|
r,
|
|
71
80
|
n
|
|
72
|
-
]), /* @__PURE__ */
|
|
81
|
+
]), /* @__PURE__ */ h("div", {
|
|
73
82
|
ref: C,
|
|
74
|
-
className:
|
|
75
|
-
children: [/* @__PURE__ */
|
|
83
|
+
className: _("select-apprail__pill", n && "is-wide"),
|
|
84
|
+
children: [/* @__PURE__ */ m("span", {
|
|
76
85
|
ref: w,
|
|
77
|
-
className:
|
|
86
|
+
className: _("select-apprail__ind", v >= 0 && "is-on"),
|
|
78
87
|
"aria-hidden": "true"
|
|
79
88
|
}), t.map((t) => {
|
|
80
|
-
let
|
|
81
|
-
return /* @__PURE__ */
|
|
89
|
+
let l = t.pages ?? [], u = l.length > 0, d = n && u && r === t.id, f = !n && u && a === t.id;
|
|
90
|
+
return /* @__PURE__ */ h("div", {
|
|
82
91
|
className: "select-apprail__slot",
|
|
83
92
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ h(g, {
|
|
85
94
|
to: t.to,
|
|
86
|
-
className:
|
|
95
|
+
className: _("select-apprail__btn", t.active && "is-active"),
|
|
87
96
|
"aria-label": t.label,
|
|
88
97
|
"aria-current": t.active ? "true" : void 0,
|
|
89
|
-
"aria-expanded":
|
|
98
|
+
"aria-expanded": u ? d || f : void 0,
|
|
90
99
|
onClick: (e) => {
|
|
91
|
-
if (!
|
|
92
|
-
|
|
100
|
+
if (!u) {
|
|
101
|
+
o(null);
|
|
93
102
|
return;
|
|
94
103
|
}
|
|
95
104
|
if (!n) {
|
|
96
|
-
e.preventDefault(),
|
|
105
|
+
e.preventDefault(), o(f ? null : t.id);
|
|
97
106
|
return;
|
|
98
107
|
}
|
|
99
|
-
|
|
108
|
+
d && t.active && e.preventDefault(), i(d ? null : t.id);
|
|
100
109
|
},
|
|
101
110
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ m("span", {
|
|
103
112
|
className: "select-apprail__icon",
|
|
104
113
|
"aria-hidden": "true",
|
|
105
114
|
children: t.icon
|
|
106
115
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ m("span", {
|
|
108
117
|
className: "select-apprail__label",
|
|
109
118
|
"aria-hidden": "true",
|
|
110
119
|
children: t.label
|
|
111
120
|
}),
|
|
112
|
-
|
|
113
|
-
className:
|
|
121
|
+
u && /* @__PURE__ */ m("span", {
|
|
122
|
+
className: _("select-apprail__chev", d && "is-open"),
|
|
114
123
|
"aria-hidden": "true",
|
|
115
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ m(e, {})
|
|
116
125
|
}),
|
|
117
|
-
!n && !
|
|
126
|
+
!n && !f && /* @__PURE__ */ h("span", {
|
|
118
127
|
className: "select-apprail__tip",
|
|
119
128
|
"aria-hidden": "true",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ m("span", {
|
|
121
130
|
className: "select-apprail__name",
|
|
122
131
|
children: t.label
|
|
123
|
-
}),
|
|
132
|
+
}), u && /* @__PURE__ */ m("span", {
|
|
124
133
|
className: "select-apprail__hint",
|
|
125
|
-
children:
|
|
134
|
+
children: c.seePages
|
|
126
135
|
})]
|
|
127
136
|
})
|
|
128
137
|
]
|
|
129
138
|
}),
|
|
130
|
-
|
|
131
|
-
className:
|
|
139
|
+
f && /* @__PURE__ */ h("div", {
|
|
140
|
+
className: _("select-apprail__fly", s && "select-apprail__fly--up"),
|
|
132
141
|
role: "group",
|
|
133
|
-
"aria-label":
|
|
134
|
-
children: [/* @__PURE__ */
|
|
142
|
+
"aria-label": c.sectionPages(t.label),
|
|
143
|
+
children: [/* @__PURE__ */ m("span", {
|
|
135
144
|
className: "select-apprail__flytitle",
|
|
136
145
|
children: t.label
|
|
137
|
-
}), /* @__PURE__ */
|
|
138
|
-
pages:
|
|
139
|
-
onPick: () =>
|
|
146
|
+
}), /* @__PURE__ */ m(S, {
|
|
147
|
+
pages: l,
|
|
148
|
+
onPick: () => o(null)
|
|
140
149
|
})]
|
|
141
150
|
}),
|
|
142
|
-
|
|
143
|
-
className:
|
|
144
|
-
children: /* @__PURE__ */
|
|
151
|
+
u && /* @__PURE__ */ m("div", {
|
|
152
|
+
className: _("select-apprail__pagesw", d && "is-open"),
|
|
153
|
+
children: /* @__PURE__ */ m("div", {
|
|
145
154
|
className: "select-apprail__pagesclip",
|
|
146
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ m("div", {
|
|
147
156
|
className: "select-apprail__pages",
|
|
148
157
|
role: "group",
|
|
149
|
-
"aria-label":
|
|
150
|
-
children: /* @__PURE__ */
|
|
158
|
+
"aria-label": c.sectionPages(t.label),
|
|
159
|
+
children: /* @__PURE__ */ m(S, { pages: l })
|
|
151
160
|
})
|
|
152
161
|
})
|
|
153
162
|
})
|
|
@@ -156,19 +165,19 @@ function y({ items: t, wide: n, open: r, setOpen: i, flyout: a, setFlyout: l, up
|
|
|
156
165
|
})]
|
|
157
166
|
});
|
|
158
167
|
}
|
|
159
|
-
function
|
|
160
|
-
var
|
|
168
|
+
function w({ label: e, wide: t, onToggle: i, items: a, bottom: o = [], shortcutKey: s = "[", toggleIcon: c, messages: u }) {
|
|
169
|
+
var p, g;
|
|
161
170
|
let v = {
|
|
162
171
|
...r().appFrame.rail,
|
|
163
|
-
...
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
let [T, E] =
|
|
167
|
-
|
|
172
|
+
...u
|
|
173
|
+
}, y = [...a, ...o], b = ((p = y.find((e) => e.active)) == null ? void 0 : p.id) ?? null, x = ((g = y.flatMap((e) => e.pages ?? []).find((e) => e.current)) == null ? void 0 : g.id) ?? null, [S, w] = f(b);
|
|
174
|
+
l(() => w(b), [b]);
|
|
175
|
+
let [T, E] = f(null), D = d(null);
|
|
176
|
+
l(() => E(null), [
|
|
177
|
+
b,
|
|
168
178
|
x,
|
|
169
|
-
S,
|
|
170
179
|
t
|
|
171
|
-
]),
|
|
180
|
+
]), l(() => {
|
|
172
181
|
if (!T) return;
|
|
173
182
|
let e = (e) => {
|
|
174
183
|
var t;
|
|
@@ -180,101 +189,101 @@ function b({ label: e, wide: t, onToggle: i, items: a, bottom: s = [], shortcutK
|
|
|
180
189
|
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
181
190
|
};
|
|
182
191
|
}, [T]);
|
|
183
|
-
let O =
|
|
184
|
-
O.current = i,
|
|
185
|
-
if (!
|
|
192
|
+
let O = d(i);
|
|
193
|
+
O.current = i, l(() => {
|
|
194
|
+
if (!s) return;
|
|
186
195
|
let e = (e) => {
|
|
187
|
-
if (e.key !==
|
|
196
|
+
if (e.key !== s || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
188
197
|
let t = e.target;
|
|
189
198
|
t && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)) || O.current();
|
|
190
199
|
};
|
|
191
200
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
192
|
-
}, [
|
|
193
|
-
let k = t ? v.collapse : v.expand, A = (e, n = !1) => /* @__PURE__ */
|
|
201
|
+
}, [s]);
|
|
202
|
+
let k = t ? v.collapse : v.expand, A = (e, n = !1) => /* @__PURE__ */ m(C, {
|
|
194
203
|
items: e,
|
|
195
204
|
wide: t,
|
|
196
|
-
open:
|
|
205
|
+
open: S,
|
|
197
206
|
setOpen: w,
|
|
198
207
|
flyout: T,
|
|
199
208
|
setFlyout: E,
|
|
200
209
|
up: n,
|
|
201
210
|
t: v
|
|
202
211
|
});
|
|
203
|
-
return /* @__PURE__ */
|
|
212
|
+
return /* @__PURE__ */ h("nav", {
|
|
204
213
|
ref: D,
|
|
205
214
|
"aria-label": e,
|
|
206
|
-
className:
|
|
207
|
-
children: [/* @__PURE__ */
|
|
215
|
+
className: _("select-apprail", t && "is-wide"),
|
|
216
|
+
children: [/* @__PURE__ */ h("div", {
|
|
208
217
|
className: "select-apprail__top",
|
|
209
|
-
children: [/* @__PURE__ */
|
|
218
|
+
children: [/* @__PURE__ */ h("button", {
|
|
210
219
|
type: "button",
|
|
211
220
|
className: "select-apprail__toggle",
|
|
212
221
|
"aria-expanded": t,
|
|
213
222
|
"aria-label": k,
|
|
214
223
|
onClick: i,
|
|
215
224
|
children: [
|
|
216
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ m("span", {
|
|
217
226
|
className: "select-apprail__icon",
|
|
218
227
|
"aria-hidden": "true",
|
|
219
|
-
children:
|
|
228
|
+
children: c ?? /* @__PURE__ */ m(n, {})
|
|
220
229
|
}),
|
|
221
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ m("span", {
|
|
222
231
|
className: "select-apprail__label",
|
|
223
232
|
"aria-hidden": "true",
|
|
224
233
|
children: k
|
|
225
234
|
}),
|
|
226
|
-
|
|
235
|
+
s && /* @__PURE__ */ m("kbd", {
|
|
227
236
|
className: "select-apprail__kbd",
|
|
228
237
|
"aria-hidden": "true",
|
|
229
|
-
children:
|
|
238
|
+
children: s
|
|
230
239
|
}),
|
|
231
|
-
!t && /* @__PURE__ */
|
|
240
|
+
!t && /* @__PURE__ */ m("span", {
|
|
232
241
|
className: "select-apprail__tip",
|
|
233
242
|
"aria-hidden": "true",
|
|
234
|
-
children: /* @__PURE__ */
|
|
243
|
+
children: /* @__PURE__ */ m("span", {
|
|
235
244
|
className: "select-apprail__name",
|
|
236
|
-
children:
|
|
245
|
+
children: s ? v.shortcut(k, s) : k
|
|
237
246
|
})
|
|
238
247
|
})
|
|
239
248
|
]
|
|
240
249
|
}), a.length > 0 && A(a)]
|
|
241
|
-
}),
|
|
250
|
+
}), o.length > 0 && A(o, !0)]
|
|
242
251
|
});
|
|
243
252
|
}
|
|
244
|
-
function
|
|
245
|
-
let g = r().appFrame, _ =
|
|
246
|
-
return
|
|
253
|
+
function T({ id: e, open: n, onClose: a, label: o, logo: s, closeLabel: c, closeIcon: u, context: f, children: p }) {
|
|
254
|
+
let g = r().appFrame, _ = d(null);
|
|
255
|
+
return l(() => {
|
|
247
256
|
var e, t;
|
|
248
257
|
let r = _.current;
|
|
249
258
|
r && (n && !r.open ? (e = r.showModal) == null || e.call(r) : !n && r.open && ((t = r.close) == null || t.call(r)));
|
|
250
|
-
}, [n]), /* @__PURE__ */
|
|
259
|
+
}, [n]), /* @__PURE__ */ m("dialog", {
|
|
251
260
|
ref: _,
|
|
252
261
|
id: e,
|
|
253
|
-
"aria-label":
|
|
262
|
+
"aria-label": o,
|
|
254
263
|
className: "select-appdrawer",
|
|
255
264
|
onClose: a,
|
|
256
265
|
onClick: (e) => e.target === e.currentTarget && a(),
|
|
257
|
-
children: /* @__PURE__ */
|
|
266
|
+
children: /* @__PURE__ */ h("div", {
|
|
258
267
|
className: "select-appdrawer__box",
|
|
259
268
|
children: [
|
|
260
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ h("div", {
|
|
261
270
|
className: "select-appdrawer__head",
|
|
262
|
-
children: [
|
|
263
|
-
label:
|
|
264
|
-
icon:
|
|
271
|
+
children: [s, /* @__PURE__ */ m(i, {
|
|
272
|
+
label: c ?? g.drawerClose,
|
|
273
|
+
icon: u ?? /* @__PURE__ */ m(t, {}),
|
|
265
274
|
onClick: a
|
|
266
275
|
})]
|
|
267
276
|
}),
|
|
268
|
-
|
|
277
|
+
f != null && /* @__PURE__ */ m("div", {
|
|
269
278
|
className: "select-appdrawer__context",
|
|
270
|
-
children:
|
|
279
|
+
children: f
|
|
271
280
|
}),
|
|
272
|
-
|
|
281
|
+
p
|
|
273
282
|
]
|
|
274
283
|
})
|
|
275
284
|
});
|
|
276
285
|
}
|
|
277
286
|
//#endregion
|
|
278
|
-
export {
|
|
287
|
+
export { T as SelectAppDrawer, y as SelectAppFrame, x as SelectAppMain, b as SelectAppPanel, w as SelectAppRail };
|
|
279
288
|
|
|
280
289
|
//# sourceMappingURL=SelectAppFrame.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SelectConversationNoteProps {
|
|
3
|
+
/** O texto da nota (com as menções em destaque: `SelectMentionText`). */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Quem escreveu ("Você", "Marcos Vieira"). */
|
|
6
|
+
author?: ReactNode;
|
|
7
|
+
/** A hora ("10:59"). */
|
|
8
|
+
time?: ReactNode;
|
|
9
|
+
/** O que mais vai no pé ("Ricardo foi avisado"). */
|
|
10
|
+
meta?: ReactNode;
|
|
11
|
+
/** O rótulo de cima (padrão: "Nota interna · só a equipe vê"). */
|
|
12
|
+
label?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare function SelectConversationNote({ children, author, time, meta, label }: SelectConversationNoteProps): import("react").JSX.Element;
|
|
15
|
+
/** A menção em destaque ("@Ricardo"): no texto da nota e onde mais o app a mostrar. */
|
|
16
|
+
export declare function SelectMention({ children }: {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/** O texto em pedaços: o texto puro e cada "@nome". */
|
|
20
|
+
export declare function selectMentionParts(text: string): Array<{
|
|
21
|
+
mention: boolean;
|
|
22
|
+
text: string;
|
|
23
|
+
}>;
|
|
24
|
+
/** O texto com cada "@nome" em destaque (o resto, como veio: as quebras de linha ficam, no `pre-wrap` da conversa). */
|
|
25
|
+
export declare function SelectMentionText({ children }: {
|
|
26
|
+
children: string;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
export interface SelectNoteFieldProps {
|
|
29
|
+
/** O campo de texto da nota (o do app; por dentro da caixa, ele fica sem borda e sem fundo). */
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
/** O rótulo de cima (padrão: "Só a equipe vê · o contato não"). */
|
|
32
|
+
label?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/** A caixa do compositor no modo nota: o fundo e a borda tracejada da nota, com o cadeado e o rótulo em cima. */
|
|
35
|
+
export declare function SelectNoteField({ children, label }: SelectNoteFieldProps): import("react").JSX.Element;
|
|
36
|
+
/** O quadradinho amarelo da nota (o "Nota interna" do segmentado). Só enfeite: o texto do lado diz o que é. */
|
|
37
|
+
export declare function SelectNoteDot(): import("react").JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useSelectMessages as e } from "./SelectLocale.js";
|
|
2
|
+
import { Fragment as t } from "react";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
//#region src/SelectConversationNote.tsx
|
|
5
|
+
function a() {
|
|
6
|
+
return /* @__PURE__ */ r("svg", {
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
width: "12",
|
|
9
|
+
height: "12",
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: "2",
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
children: /* @__PURE__ */ r("path", { d: "M7 11V8a5 5 0 0 1 10 0v3M5.5 11h13v9h-13z" })
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function o({ children: n, author: o, time: s, meta: c, label: l }) {
|
|
20
|
+
let u = e().chat, d = [
|
|
21
|
+
o,
|
|
22
|
+
s,
|
|
23
|
+
c
|
|
24
|
+
].filter((e) => e != null && e !== "");
|
|
25
|
+
return /* @__PURE__ */ r("div", {
|
|
26
|
+
className: "select-convo__msg select-convo__msg--out select-convo__msg--note",
|
|
27
|
+
children: /* @__PURE__ */ i("div", {
|
|
28
|
+
className: "select-convo__note",
|
|
29
|
+
role: "note",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ i("span", {
|
|
32
|
+
className: "select-convo__note-label",
|
|
33
|
+
children: [/* @__PURE__ */ r(a, {}), l ?? u.noteLabel]
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ r("div", {
|
|
36
|
+
className: "select-convo__text",
|
|
37
|
+
children: n
|
|
38
|
+
}),
|
|
39
|
+
d.length > 0 ? /* @__PURE__ */ r("span", {
|
|
40
|
+
className: "select-convo__note-meta",
|
|
41
|
+
children: d.map((e, n) => /* @__PURE__ */ i(t, { children: [n > 0 ? " · " : null, e] }, n))
|
|
42
|
+
}) : null
|
|
43
|
+
]
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function s({ children: e }) {
|
|
48
|
+
return /* @__PURE__ */ r("span", {
|
|
49
|
+
className: "select-mention",
|
|
50
|
+
children: e
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
var c = /(^|[^\p{L}\p{M}\p{N}_@.])(@[\p{L}\p{N}_](?:[\p{L}\p{M}\p{N}_.-]*[\p{L}\p{M}\p{N}_])?)/gu;
|
|
54
|
+
function l(e) {
|
|
55
|
+
let t = [], n = 0;
|
|
56
|
+
for (let r of e.matchAll(c)) {
|
|
57
|
+
let i = (r.index ?? 0) + (r[1] ?? "").length, a = r[2] ?? "";
|
|
58
|
+
i > n && t.push({
|
|
59
|
+
mention: !1,
|
|
60
|
+
text: e.slice(n, i)
|
|
61
|
+
}), t.push({
|
|
62
|
+
mention: !0,
|
|
63
|
+
text: a
|
|
64
|
+
}), n = i + a.length;
|
|
65
|
+
}
|
|
66
|
+
return n < e.length && t.push({
|
|
67
|
+
mention: !1,
|
|
68
|
+
text: e.slice(n)
|
|
69
|
+
}), t;
|
|
70
|
+
}
|
|
71
|
+
function u({ children: e }) {
|
|
72
|
+
return /* @__PURE__ */ r(n, { children: l(e).map((e, n) => e.mention ? /* @__PURE__ */ r(s, { children: e.text }, n) : /* @__PURE__ */ r(t, { children: e.text }, n)) });
|
|
73
|
+
}
|
|
74
|
+
function d({ children: t, label: n }) {
|
|
75
|
+
let o = e().chat;
|
|
76
|
+
return /* @__PURE__ */ i("div", {
|
|
77
|
+
className: "select-note-field",
|
|
78
|
+
children: [/* @__PURE__ */ i("span", {
|
|
79
|
+
className: "select-note-field__label",
|
|
80
|
+
children: [/* @__PURE__ */ r(a, {}), n ?? o.noteFieldLabel]
|
|
81
|
+
}), t]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function f() {
|
|
85
|
+
return /* @__PURE__ */ r("span", {
|
|
86
|
+
className: "select-note-dot",
|
|
87
|
+
"aria-hidden": "true"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { o as SelectConversationNote, s as SelectMention, u as SelectMentionText, f as SelectNoteDot, d as SelectNoteField, l as selectMentionParts };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=SelectConversationNote.js.map
|
package/dist/SelectLocale.d.ts
CHANGED
|
@@ -191,6 +191,12 @@ export interface SelectKitMessages {
|
|
|
191
191
|
copied: string;
|
|
192
192
|
send: string;
|
|
193
193
|
record: string;
|
|
194
|
+
/** 0.1.257: a nota interna (SelectConversationNote, SelectNoteField) e a lista do "/" e da "@" (SelectTriggerMenu). */
|
|
195
|
+
noteLabel: string;
|
|
196
|
+
noteFieldLabel: string;
|
|
197
|
+
triggerHint: string;
|
|
198
|
+
triggerLoading: string;
|
|
199
|
+
triggerEmpty: string;
|
|
194
200
|
};
|
|
195
201
|
/** 0.1.223: a entrada — o nome de cada caixinha do código (SelectOtpInput) e a força da senha (SelectPasswordStrength). */
|
|
196
202
|
auth: {
|
package/dist/SelectLocale.js
CHANGED
|
@@ -201,7 +201,12 @@ var r = {
|
|
|
201
201
|
listOptions: "Opções da lista",
|
|
202
202
|
copied: "Copiado",
|
|
203
203
|
send: "Enviar",
|
|
204
|
-
record: "Gravar áudio"
|
|
204
|
+
record: "Gravar áudio",
|
|
205
|
+
noteLabel: "Nota interna · só a equipe vê",
|
|
206
|
+
noteFieldLabel: "Só a equipe vê · o contato não",
|
|
207
|
+
triggerHint: "↑ ↓ escolhe · Enter insere · Esc fecha",
|
|
208
|
+
triggerLoading: "Buscando…",
|
|
209
|
+
triggerEmpty: "Nada encontrado"
|
|
205
210
|
},
|
|
206
211
|
carousel: {
|
|
207
212
|
label: "Destaques",
|
|
@@ -454,7 +459,12 @@ var r = {
|
|
|
454
459
|
listOptions: "List options",
|
|
455
460
|
copied: "Copied",
|
|
456
461
|
send: "Send",
|
|
457
|
-
record: "Record audio"
|
|
462
|
+
record: "Record audio",
|
|
463
|
+
noteLabel: "Internal note · only the team sees it",
|
|
464
|
+
noteFieldLabel: "Only the team sees it · not the contact",
|
|
465
|
+
triggerHint: "↑ ↓ choose · Enter inserts · Esc closes",
|
|
466
|
+
triggerLoading: "Searching…",
|
|
467
|
+
triggerEmpty: "Nothing found"
|
|
458
468
|
},
|
|
459
469
|
carousel: {
|
|
460
470
|
label: "Highlights",
|