@selectwin/kit 0.1.226 → 0.1.228
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/dist/SelectAppBar.d.ts +62 -0
- package/dist/SelectAppBar.js +136 -0
- package/dist/SelectAppFrame.d.ts +95 -0
- package/dist/SelectAppFrame.js +280 -0
- package/dist/SelectAppSearch.d.ts +34 -0
- package/dist/SelectAppSearch.js +192 -0
- package/dist/SelectLocale.d.ts +28 -0
- package/dist/SelectLocale.js +50 -0
- package/dist/SelectWorkspaceSwitcher.d.ts +5 -0
- package/dist/SelectWorkspaceSwitcher.js +11 -11
- package/dist/index.d.ts +6 -0
- package/dist/index.js +153 -150
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { SearchIcon as e } from "./icons.js";
|
|
2
|
+
import { useSelectMessages as t } from "./SelectLocale.js";
|
|
3
|
+
import { SelectAppBarButton as n } from "./SelectAppBar.js";
|
|
4
|
+
import { useEffect as r, useId as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
//#region src/SelectAppSearch.tsx
|
|
7
|
+
var u = (...e) => e.filter(Boolean).join(" ");
|
|
8
|
+
function d({ query: d, onQueryChange: f, groups: p, onSelect: m, loading: h = !1, shortcut: g = !0, messages: _, className: v }) {
|
|
9
|
+
var y;
|
|
10
|
+
let b = {
|
|
11
|
+
...t().appFrame.search,
|
|
12
|
+
..._
|
|
13
|
+
}, x = i(), S = o(null), C = o(null), w = o(null), [T, E] = s(!1), [D, O] = s(!1), [k, A] = s(0), j = a(() => p.filter((e) => e.items.length > 0), [p]), M = a(() => j.flatMap((e) => e.items), [j]), N = M.map((e) => e.key).join("\0");
|
|
14
|
+
r(() => A(0), [N]);
|
|
15
|
+
let P = () => {
|
|
16
|
+
E(!1), O(!1);
|
|
17
|
+
}, F = (e) => {
|
|
18
|
+
var t;
|
|
19
|
+
P(), f(""), (t = C.current) == null || t.blur(), m(e);
|
|
20
|
+
};
|
|
21
|
+
r(() => {
|
|
22
|
+
if (!g) return;
|
|
23
|
+
let e = (e) => {
|
|
24
|
+
var t;
|
|
25
|
+
if (!(e.metaKey || e.ctrlKey) || e.key.toLowerCase() !== "k") return;
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
let n = C.current !== null && C.current.offsetParent !== null;
|
|
28
|
+
E(!0), n ? (t = C.current) == null || t.focus() : O(!0);
|
|
29
|
+
};
|
|
30
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
31
|
+
}, [g]), r(() => {
|
|
32
|
+
var e;
|
|
33
|
+
D && ((e = w.current) == null || e.focus());
|
|
34
|
+
}, [D]), r(() => {
|
|
35
|
+
if (!T) return;
|
|
36
|
+
let e = (e) => {
|
|
37
|
+
var t;
|
|
38
|
+
(t = S.current) != null && t.contains(e.target) || P();
|
|
39
|
+
};
|
|
40
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
41
|
+
}, [T]);
|
|
42
|
+
let I = (e) => {
|
|
43
|
+
if (e.key === "ArrowDown") e.preventDefault(), E(!0), A((e) => M.length ? (e + 1) % M.length : 0);
|
|
44
|
+
else if (e.key === "ArrowUp") e.preventDefault(), A((e) => M.length ? (e - 1 + M.length) % M.length : 0);
|
|
45
|
+
else if (e.key === "Enter") {
|
|
46
|
+
let t = M[k];
|
|
47
|
+
t && (e.preventDefault(), F(t));
|
|
48
|
+
} else e.key === "Escape" && (e.preventDefault(), P(), e.currentTarget.blur());
|
|
49
|
+
}, L = (y = M[k]) == null ? void 0 : y.key, R = (e) => `${x}-${e}`, z = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform) ? "⌘ K" : "Ctrl K", B = (e) => /* @__PURE__ */ c("input", {
|
|
50
|
+
ref: e,
|
|
51
|
+
type: "search",
|
|
52
|
+
className: "select-appsearch__input",
|
|
53
|
+
placeholder: b.placeholder,
|
|
54
|
+
"aria-label": b.label,
|
|
55
|
+
role: "combobox",
|
|
56
|
+
"aria-expanded": T,
|
|
57
|
+
"aria-controls": x,
|
|
58
|
+
"aria-autocomplete": "list",
|
|
59
|
+
"aria-activedescendant": T && L ? R(L) : void 0,
|
|
60
|
+
value: d,
|
|
61
|
+
onChange: (e) => {
|
|
62
|
+
f(e.target.value), E(!0);
|
|
63
|
+
},
|
|
64
|
+
onFocus: () => E(!0),
|
|
65
|
+
onKeyDown: I
|
|
66
|
+
});
|
|
67
|
+
return /* @__PURE__ */ l("div", {
|
|
68
|
+
ref: S,
|
|
69
|
+
className: u("select-appsearch", T && "is-open", v),
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ l("label", {
|
|
72
|
+
className: "select-appsearch__field",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ c("span", {
|
|
75
|
+
className: "select-appsearch__fieldicon",
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
children: /* @__PURE__ */ c(e, {})
|
|
78
|
+
}),
|
|
79
|
+
B(C),
|
|
80
|
+
g && /* @__PURE__ */ c("kbd", {
|
|
81
|
+
className: "select-appsearch__kbd",
|
|
82
|
+
"aria-hidden": "true",
|
|
83
|
+
children: z
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ c(n, {
|
|
88
|
+
className: "select-appsearch__button",
|
|
89
|
+
label: b.open,
|
|
90
|
+
tooltip: !1,
|
|
91
|
+
"aria-expanded": T && D,
|
|
92
|
+
onClick: () => {
|
|
93
|
+
E(!0), O(!0);
|
|
94
|
+
},
|
|
95
|
+
children: /* @__PURE__ */ c(e, {})
|
|
96
|
+
}),
|
|
97
|
+
T && /* @__PURE__ */ l("div", {
|
|
98
|
+
className: u("select-appsearch__panel", D && "is-mobile"),
|
|
99
|
+
role: "dialog",
|
|
100
|
+
"aria-label": b.panel,
|
|
101
|
+
children: [
|
|
102
|
+
D && /* @__PURE__ */ c("div", {
|
|
103
|
+
className: "select-appsearch__panelfield",
|
|
104
|
+
children: B(w)
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ l("div", {
|
|
107
|
+
id: x,
|
|
108
|
+
role: "listbox",
|
|
109
|
+
"aria-label": b.results,
|
|
110
|
+
className: "select-appsearch__list",
|
|
111
|
+
children: [
|
|
112
|
+
j.map((e) => /* @__PURE__ */ l("div", {
|
|
113
|
+
role: "group",
|
|
114
|
+
"aria-label": e.title,
|
|
115
|
+
className: "select-appsearch__group",
|
|
116
|
+
children: [/* @__PURE__ */ c("span", {
|
|
117
|
+
className: "select-appsearch__grouptitle",
|
|
118
|
+
"aria-hidden": "true",
|
|
119
|
+
children: e.title
|
|
120
|
+
}), e.items.map((e) => /* @__PURE__ */ l("div", {
|
|
121
|
+
id: R(e.key),
|
|
122
|
+
role: "option",
|
|
123
|
+
"aria-selected": e.key === L,
|
|
124
|
+
className: u("select-appsearch__item", e.key === L && "is-active"),
|
|
125
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
126
|
+
onPointerEnter: () => A(M.indexOf(e)),
|
|
127
|
+
onClick: () => F(e),
|
|
128
|
+
children: [
|
|
129
|
+
e.icon != null && /* @__PURE__ */ c("span", {
|
|
130
|
+
className: "select-appsearch__icon",
|
|
131
|
+
"aria-hidden": "true",
|
|
132
|
+
children: e.icon
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ l("span", {
|
|
135
|
+
className: "select-appsearch__text",
|
|
136
|
+
children: [/* @__PURE__ */ c("span", {
|
|
137
|
+
className: u("select-appsearch__title", e.mono && "is-mono"),
|
|
138
|
+
children: e.title
|
|
139
|
+
}), e.sub ? /* @__PURE__ */ c("span", {
|
|
140
|
+
className: "select-appsearch__sub",
|
|
141
|
+
children: e.sub
|
|
142
|
+
}) : null]
|
|
143
|
+
}),
|
|
144
|
+
e.meta ? /* @__PURE__ */ c("span", {
|
|
145
|
+
className: "select-appsearch__meta",
|
|
146
|
+
children: e.meta
|
|
147
|
+
}) : null
|
|
148
|
+
]
|
|
149
|
+
}, e.key))]
|
|
150
|
+
}, e.title)),
|
|
151
|
+
j.length === 0 && !h && /* @__PURE__ */ c("p", {
|
|
152
|
+
className: "select-appsearch__empty",
|
|
153
|
+
children: b.none(d.trim())
|
|
154
|
+
}),
|
|
155
|
+
h && /* @__PURE__ */ c("p", {
|
|
156
|
+
className: "select-appsearch__status",
|
|
157
|
+
children: b.searching
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ l("div", {
|
|
162
|
+
className: "select-appsearch__foot",
|
|
163
|
+
"aria-hidden": "true",
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ l("span", { children: [
|
|
166
|
+
/* @__PURE__ */ c("kbd", { children: "↑" }),
|
|
167
|
+
" ",
|
|
168
|
+
/* @__PURE__ */ c("kbd", { children: "↓" }),
|
|
169
|
+
" ",
|
|
170
|
+
b.keys.move
|
|
171
|
+
] }),
|
|
172
|
+
/* @__PURE__ */ l("span", { children: [
|
|
173
|
+
/* @__PURE__ */ c("kbd", { children: "Enter" }),
|
|
174
|
+
" ",
|
|
175
|
+
b.keys.open
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ l("span", { children: [
|
|
178
|
+
/* @__PURE__ */ c("kbd", { children: "Esc" }),
|
|
179
|
+
" ",
|
|
180
|
+
b.keys.close
|
|
181
|
+
] })
|
|
182
|
+
]
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
export { d as SelectAppSearch };
|
|
191
|
+
|
|
192
|
+
//# sourceMappingURL=SelectAppSearch.js.map
|
package/dist/SelectLocale.d.ts
CHANGED
|
@@ -134,6 +134,34 @@ export interface SelectKitMessages {
|
|
|
134
134
|
fees: string;
|
|
135
135
|
netShort: string;
|
|
136
136
|
};
|
|
137
|
+
/** 0.1.227: a moldura do app — o botão do menu do celular e a busca da barra (SelectAppBar, SelectAppSearch). */
|
|
138
|
+
appFrame: {
|
|
139
|
+
menuOpen: string;
|
|
140
|
+
/** 0.1.228: o fechar da gaveta do celular (SelectAppDrawer). */
|
|
141
|
+
drawerClose: string;
|
|
142
|
+
/** 0.1.228: o trilho (SelectAppRail): o botão do topo, o atalho, a dica da seção com páginas e o grupo das páginas. */
|
|
143
|
+
rail: {
|
|
144
|
+
expand: string;
|
|
145
|
+
collapse: string;
|
|
146
|
+
shortcut: (label: string, key: string) => string;
|
|
147
|
+
seePages: string;
|
|
148
|
+
sectionPages: (section: string) => string;
|
|
149
|
+
};
|
|
150
|
+
search: {
|
|
151
|
+
label: string;
|
|
152
|
+
placeholder: string;
|
|
153
|
+
open: string;
|
|
154
|
+
panel: string;
|
|
155
|
+
results: string;
|
|
156
|
+
none: (query: string) => string;
|
|
157
|
+
searching: string;
|
|
158
|
+
keys: {
|
|
159
|
+
move: string;
|
|
160
|
+
open: string;
|
|
161
|
+
close: string;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
137
165
|
}
|
|
138
166
|
/** Os dicionários do kit, para quem quer conferir ou montar um texto do mesmo jeito. */
|
|
139
167
|
export declare const selectKitMessages: Readonly<Record<SelectLocaleCode, SelectKitMessages>>;
|
package/dist/SelectLocale.js
CHANGED
|
@@ -138,6 +138,31 @@ var r = {
|
|
|
138
138
|
net: "Valor líquido",
|
|
139
139
|
fees: "Taxas",
|
|
140
140
|
netShort: "Líquido"
|
|
141
|
+
},
|
|
142
|
+
appFrame: {
|
|
143
|
+
menuOpen: "Abrir o menu",
|
|
144
|
+
drawerClose: "Fechar o menu",
|
|
145
|
+
rail: {
|
|
146
|
+
expand: "Expandir o menu",
|
|
147
|
+
collapse: "Recolher o menu",
|
|
148
|
+
shortcut: (e, t) => `${e} ( ${t} )`,
|
|
149
|
+
seePages: "Clique para ver as páginas",
|
|
150
|
+
sectionPages: (e) => `Páginas de ${e}`
|
|
151
|
+
},
|
|
152
|
+
search: {
|
|
153
|
+
label: "Buscar",
|
|
154
|
+
placeholder: "Buscar",
|
|
155
|
+
open: "Buscar",
|
|
156
|
+
panel: "Busca",
|
|
157
|
+
results: "Resultados",
|
|
158
|
+
none: (e) => `Nada encontrado para "${e}".`,
|
|
159
|
+
searching: "Buscando…",
|
|
160
|
+
keys: {
|
|
161
|
+
move: "navegar",
|
|
162
|
+
open: "abrir",
|
|
163
|
+
close: "fechar"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
141
166
|
}
|
|
142
167
|
},
|
|
143
168
|
en: {
|
|
@@ -277,6 +302,31 @@ var r = {
|
|
|
277
302
|
net: "Net amount",
|
|
278
303
|
fees: "Fees",
|
|
279
304
|
netShort: "Net"
|
|
305
|
+
},
|
|
306
|
+
appFrame: {
|
|
307
|
+
menuOpen: "Open the menu",
|
|
308
|
+
drawerClose: "Close the menu",
|
|
309
|
+
rail: {
|
|
310
|
+
expand: "Expand the menu",
|
|
311
|
+
collapse: "Collapse the menu",
|
|
312
|
+
shortcut: (e, t) => `${e} ( ${t} )`,
|
|
313
|
+
seePages: "Click to see the pages",
|
|
314
|
+
sectionPages: (e) => `${e} pages`
|
|
315
|
+
},
|
|
316
|
+
search: {
|
|
317
|
+
label: "Search",
|
|
318
|
+
placeholder: "Search",
|
|
319
|
+
open: "Search",
|
|
320
|
+
panel: "Search",
|
|
321
|
+
results: "Results",
|
|
322
|
+
none: (e) => `Nothing found for "${e}".`,
|
|
323
|
+
searching: "Searching…",
|
|
324
|
+
keys: {
|
|
325
|
+
move: "move",
|
|
326
|
+
open: "open",
|
|
327
|
+
close: "close"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
280
330
|
}
|
|
281
331
|
}
|
|
282
332
|
}, i = e(null);
|
|
@@ -6,6 +6,11 @@ type SelectWorkspaceSwitcherOwnProps = {
|
|
|
6
6
|
onClick?: () => void;
|
|
7
7
|
/** Sem troca possível: desenha o mesmo pill, sem a seta e sem ser botão. */
|
|
8
8
|
readOnly?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 0.1.228: a pílula com a borda, numa linha de texto (a linha de contexto do cabeçalho da página, a caixa da gaveta
|
|
11
|
+
* do celular), em vez do botão sem fundo da barra.
|
|
12
|
+
*/
|
|
13
|
+
pill?: boolean;
|
|
9
14
|
};
|
|
10
15
|
export type SelectWorkspaceSwitcherProps = SelectWorkspaceSwitcherOwnProps & Omit<ComponentPropsWithoutRef<'button'>, keyof SelectWorkspaceSwitcherOwnProps>;
|
|
11
16
|
export declare const SelectWorkspaceSwitcher: import('react').ForwardRefExoticComponent<SelectWorkspaceSwitcherOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, keyof SelectWorkspaceSwitcherOwnProps> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -2,8 +2,8 @@ import { SelectorIcon as e } from "./icons.js";
|
|
|
2
2
|
import { forwardRef as t } from "react";
|
|
3
3
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
4
|
//#region src/SelectWorkspaceSwitcher.tsx
|
|
5
|
-
var a = t(function({ avatar: t, name: a, badge: o, onClick: s, readOnly: c = !1,
|
|
6
|
-
let
|
|
5
|
+
var a = t(function({ avatar: t, name: a, badge: o, onClick: s, readOnly: c = !1, pill: l = !1, className: u, ...d }, f) {
|
|
6
|
+
let p = /* @__PURE__ */ i(n, { children: [
|
|
7
7
|
t && /* @__PURE__ */ r("span", {
|
|
8
8
|
className: "select-wsswitcher__avatar",
|
|
9
9
|
children: t
|
|
@@ -15,19 +15,19 @@ var a = t(function({ avatar: t, name: a, badge: o, onClick: s, readOnly: c = !1,
|
|
|
15
15
|
o
|
|
16
16
|
] });
|
|
17
17
|
return c ? /* @__PURE__ */ r("div", {
|
|
18
|
-
className: `select-wsswitcher select-wsswitcher--readonly${l ? " " +
|
|
19
|
-
"aria-label":
|
|
20
|
-
title:
|
|
21
|
-
id:
|
|
22
|
-
children:
|
|
18
|
+
className: `select-wsswitcher select-wsswitcher--readonly${l ? " select-wsswitcher--pill" : ""}${u ? " " + u : ""}`,
|
|
19
|
+
"aria-label": d["aria-label"],
|
|
20
|
+
title: d.title,
|
|
21
|
+
id: d.id,
|
|
22
|
+
children: p
|
|
23
23
|
}) : /* @__PURE__ */ i("button", {
|
|
24
|
-
ref:
|
|
25
|
-
...
|
|
24
|
+
ref: f,
|
|
25
|
+
...d,
|
|
26
26
|
type: "button",
|
|
27
|
-
className: `select-wsswitcher${l ? " " +
|
|
27
|
+
className: `select-wsswitcher${l ? " select-wsswitcher--pill" : ""}${u ? " " + u : ""}`,
|
|
28
28
|
onClick: s,
|
|
29
29
|
"aria-haspopup": "menu",
|
|
30
|
-
children: [
|
|
30
|
+
children: [p, /* @__PURE__ */ r("span", {
|
|
31
31
|
className: "select-wsswitcher__selector",
|
|
32
32
|
"aria-hidden": "true",
|
|
33
33
|
children: /* @__PURE__ */ r(e, {})
|
package/dist/index.d.ts
CHANGED
|
@@ -69,6 +69,12 @@ export { SelectSection } from './SelectSection';
|
|
|
69
69
|
export { SelectRegions, type SelectRegionsProps } from './SelectRegions';
|
|
70
70
|
export { SelectTabs } from './SelectTabs';
|
|
71
71
|
export { SelectSideNav } from './SelectSideNav';
|
|
72
|
+
export { SelectAppBar, SelectAppBarButton, SelectAppBarAccount, SelectAppPages } from './SelectAppBar';
|
|
73
|
+
export type { SelectAppBarProps, SelectAppBarButtonProps, SelectAppBarAccountProps, SelectAppPage } from './SelectAppBar';
|
|
74
|
+
export { SelectAppSearch } from './SelectAppSearch';
|
|
75
|
+
export { SelectAppFrame, SelectAppPanel, SelectAppMain, SelectAppRail, SelectAppDrawer } from './SelectAppFrame';
|
|
76
|
+
export type { SelectAppFrameProps, SelectAppPanelProps, SelectAppMainProps, SelectAppRailProps, SelectAppRailItem, SelectAppRailPage, SelectAppDrawerProps, } from './SelectAppFrame';
|
|
77
|
+
export type { SelectAppSearchItem, SelectAppSearchGroup, SelectAppSearchProps } from './SelectAppSearch';
|
|
72
78
|
export { SelectSearchInput } from './SelectSearchInput';
|
|
73
79
|
export { SelectTable, SelectTableRow, SelectTableCell, SelectTableEmpty, SelectUserCell } from './SelectTable';
|
|
74
80
|
export { SelectMenu, SelectMenuItem, SelectMenuLink, SelectMenuHeading, SelectMenuHeader, SelectMenuRow, SelectMenuDivider, SelectMenuButton, } from './SelectMenu';
|