@selectwin/kit 0.1.224 → 0.1.226
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/SelectAvatar.d.ts +4 -2
- package/dist/SelectAvatar.js +9 -9
- package/dist/SelectCombobox.d.ts +5 -0
- package/dist/SelectCombobox.js +92 -84
- package/dist/SelectFilterBar.js +14 -14
- package/dist/SelectMenu.d.ts +18 -2
- package/dist/SelectMenu.js +71 -23
- package/dist/SelectSideNav.d.ts +7 -0
- package/dist/SelectSideNav.js +140 -109
- package/dist/index.d.ts +1 -1
- package/dist/index.js +152 -152
- package/dist/internal/listChrome.js +5 -5
- package/dist/style.css +1 -1
- package/package.json +67 -67
package/dist/SelectAvatar.d.ts
CHANGED
|
@@ -7,8 +7,10 @@ type SelectAvatarOwnProps = {
|
|
|
7
7
|
dashed?: boolean;
|
|
8
8
|
/** Circular (with a hairline) — app/logo tiles. */
|
|
9
9
|
round?: boolean;
|
|
10
|
-
/** `md` (2.25rem, rows) or `lg` (3.75rem, page header). */
|
|
11
|
-
size?: 'md' | 'lg';
|
|
10
|
+
/** `sm` (1.25rem, 0.1.225: dentro de uma pílula — o trocador de workspace), `md` (2.25rem, rows) or `lg` (3.75rem, page header). */
|
|
11
|
+
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
/** 0.1.225: `accent` — as iniciais no tom do acento (o workspace, a marca), em vez do cinza neutro da pessoa. */
|
|
13
|
+
tone?: 'neutral' | 'accent';
|
|
12
14
|
/** How many letters stand for the name: 1 (default) or 2 (first + last word). */
|
|
13
15
|
initials?: 1 | 2;
|
|
14
16
|
/**
|
package/dist/SelectAvatar.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { forwardRef as e, useState as t } from "react";
|
|
2
2
|
import { jsx as n } from "react/jsx-runtime";
|
|
3
3
|
//#region src/SelectAvatar.tsx
|
|
4
|
-
var r = e(function({ name: e, src: r, icon: a, dashed: o = !1, round: s = !1, size: c = "md",
|
|
5
|
-
let
|
|
4
|
+
var r = e(function({ name: e, src: r, icon: a, dashed: o = !1, round: s = !1, size: c = "md", tone: l = "neutral", initials: u = 1, monogram: d, className: f, ...p }, m) {
|
|
5
|
+
let h = (d == null ? void 0 : d.trim().slice(0, 3).toUpperCase()) || i(e, u), [g, _] = t(null), v = !!r && g !== r;
|
|
6
6
|
return /* @__PURE__ */ n("span", {
|
|
7
|
-
ref:
|
|
8
|
-
...
|
|
9
|
-
className: `select-avatar${c === "lg" ? " select-avatar--lg" : ""}${o ? " select-avatar--dashed" : ""}${s ? " select-avatar--round" : ""}${
|
|
7
|
+
ref: m,
|
|
8
|
+
...p,
|
|
9
|
+
className: `select-avatar${c === "lg" ? " select-avatar--lg" : c === "sm" ? " select-avatar--sm" : ""}${l === "accent" ? " select-avatar--accent" : ""}${o ? " select-avatar--dashed" : ""}${s ? " select-avatar--round" : ""}${f ? " " + f : ""}`,
|
|
10
10
|
"aria-hidden": "true",
|
|
11
|
-
children:
|
|
11
|
+
children: v ? /* @__PURE__ */ n("img", {
|
|
12
12
|
src: r,
|
|
13
13
|
alt: "",
|
|
14
14
|
className: "select-avatar__img",
|
|
15
|
-
onError: () =>
|
|
15
|
+
onError: () => _(r ?? null)
|
|
16
16
|
}) : a ? /* @__PURE__ */ n("span", {
|
|
17
17
|
className: "select-avatar__icon",
|
|
18
18
|
children: a
|
|
19
19
|
}) : /* @__PURE__ */ n("span", {
|
|
20
|
-
className: `select-avatar__initial${
|
|
21
|
-
children:
|
|
20
|
+
className: `select-avatar__initial${h.length > 2 ? " select-avatar__initial--long" : ""}`,
|
|
21
|
+
children: h
|
|
22
22
|
})
|
|
23
23
|
});
|
|
24
24
|
});
|
package/dist/SelectCombobox.d.ts
CHANGED
|
@@ -40,6 +40,11 @@ type SelectComboboxOwnProps = {
|
|
|
40
40
|
* troca e empurraria o resto da barra. Um comprimento CSS (`'16rem'`).
|
|
41
41
|
*/
|
|
42
42
|
minWidth?: string;
|
|
43
|
+
/**
|
|
44
|
+
* 0.1.226: o nome do campo para o leitor de tela quando não há `label` visível (o seletor numa barra ou numa célula).
|
|
45
|
+
* Ignorado com `label`.
|
|
46
|
+
*/
|
|
47
|
+
ariaLabel?: string;
|
|
43
48
|
};
|
|
44
49
|
export type SelectComboboxProps = SelectComboboxOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectComboboxOwnProps>;
|
|
45
50
|
export declare const SelectCombobox: import('react').ForwardRefExoticComponent<SelectComboboxOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectComboboxOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
|
package/dist/SelectCombobox.js
CHANGED
|
@@ -1,142 +1,150 @@
|
|
|
1
1
|
import { CheckIcon as e, ChevronDownIcon as t } from "./icons.js";
|
|
2
2
|
import { useSelectMessages as n } from "./SelectLocale.js";
|
|
3
3
|
import { SelectInfoTip as r } from "./SelectInfoTip.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { moveInOptions as i, useOptionListFocus as a } from "./internal/optionList.js";
|
|
5
|
+
import { useSelectReveal as o } from "./internal/useSelectReveal.js";
|
|
6
|
+
import { SelectPopover as s } from "./SelectPopover.js";
|
|
7
|
+
import { forwardRef as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
8
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
9
|
//#region src/SelectCombobox.tsx
|
|
9
|
-
function
|
|
10
|
-
let n = e > 0 ? Math.min(.03, .35 / e) : 0, r =
|
|
10
|
+
function h({ count: e, children: t }) {
|
|
11
|
+
let n = e > 0 ? Math.min(.03, .35 / e) : 0, r = o({
|
|
11
12
|
selector: ".select-combobox__option",
|
|
12
13
|
y: 6,
|
|
13
14
|
duration: .3,
|
|
14
15
|
stagger: n
|
|
15
16
|
});
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ p("div", {
|
|
17
18
|
className: "select-combobox__list",
|
|
18
19
|
ref: r,
|
|
19
20
|
children: t
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
var
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
var g = c(function({ label: o, value: c, onChange: g, options: _, placeholder: v, searchPlaceholder: y, labelAction: b, help: x, hint: S, error: C, emptyText: ee, disabled: w, required: T, size: E = "md", searchable: D = !0, allowCustom: O = !1, customLabel: k, minWidth: A, ariaLabel: j, className: M, style: N, ...P }, F) {
|
|
24
|
+
let I = n(), L = v ?? I.common.selectPlaceholder, R = y ?? I.common.searchPlaceholder, z = ee ?? I.common.noResults, B = l(), [V, H] = f(!1), [U, W] = f(""), G = d(null);
|
|
25
|
+
a(V, G);
|
|
26
|
+
let K = _.find((e) => e.value === c), q = K ? K.label : O && c ? c : null, J = u(() => {
|
|
27
|
+
let e = U.trim().toLowerCase();
|
|
28
|
+
return !D || !e ? _ : _.filter((t) => {
|
|
26
29
|
var n;
|
|
27
30
|
return t.label.toLowerCase().includes(e) || ((n = t.secondary) == null ? void 0 : n.toLowerCase().includes(e));
|
|
28
31
|
});
|
|
29
32
|
}, [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
]),
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
ref:
|
|
40
|
-
...
|
|
41
|
-
style:
|
|
42
|
-
minWidth:
|
|
43
|
-
...
|
|
44
|
-
} :
|
|
45
|
-
className: `select-field${
|
|
33
|
+
_,
|
|
34
|
+
U,
|
|
35
|
+
D
|
|
36
|
+
]), Y = U.trim(), X = Y ? _.find((e) => e.label.toLowerCase() === Y.toLowerCase()) : void 0, Z = O && D && Y !== "" && !X, Q = () => {
|
|
37
|
+
H(!1), W("");
|
|
38
|
+
}, $ = (e) => {
|
|
39
|
+
g(e), Q();
|
|
40
|
+
}, te = C ? `${B}-err` : S ? `${B}-hint` : void 0;
|
|
41
|
+
return /* @__PURE__ */ m("div", {
|
|
42
|
+
ref: F,
|
|
43
|
+
...P,
|
|
44
|
+
style: A ? {
|
|
45
|
+
minWidth: A,
|
|
46
|
+
...N
|
|
47
|
+
} : N,
|
|
48
|
+
className: `select-field${E === "sm" ? " select-field--sm" : ""}${M ? " " + M : ""}`,
|
|
46
49
|
children: [
|
|
47
|
-
(
|
|
50
|
+
(o || x || b) && /* @__PURE__ */ m("div", {
|
|
48
51
|
className: "select-field__labelrow",
|
|
49
|
-
children: [/* @__PURE__ */
|
|
52
|
+
children: [/* @__PURE__ */ m("span", {
|
|
50
53
|
className: "select-field__labelwrap",
|
|
51
|
-
children: [
|
|
54
|
+
children: [o && /* @__PURE__ */ p("label", {
|
|
52
55
|
className: "select-field__label",
|
|
53
|
-
htmlFor:
|
|
54
|
-
children:
|
|
55
|
-
}),
|
|
56
|
-
}),
|
|
56
|
+
htmlFor: B,
|
|
57
|
+
children: o
|
|
58
|
+
}), x != null && x !== "" && /* @__PURE__ */ p(r, { content: x })]
|
|
59
|
+
}), b]
|
|
57
60
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ p("div", {
|
|
59
62
|
className: "select-combobox",
|
|
60
|
-
children: /* @__PURE__ */
|
|
61
|
-
active:
|
|
62
|
-
onClose:
|
|
63
|
+
children: /* @__PURE__ */ p(s, {
|
|
64
|
+
active: V,
|
|
65
|
+
onClose: Q,
|
|
63
66
|
placement: "bottom-start",
|
|
64
67
|
role: "listbox",
|
|
65
68
|
matchWidth: !0,
|
|
66
|
-
activator: /* @__PURE__ */
|
|
67
|
-
id:
|
|
69
|
+
activator: /* @__PURE__ */ m("button", {
|
|
70
|
+
id: B,
|
|
68
71
|
type: "button",
|
|
69
|
-
className: `select-combobox__trigger${
|
|
70
|
-
onClick: () =>
|
|
71
|
-
disabled:
|
|
72
|
+
className: `select-combobox__trigger${C ? " select-input--error" : ""}${V ? " is-open" : ""}`,
|
|
73
|
+
onClick: () => V ? Q() : H(!0),
|
|
74
|
+
disabled: w,
|
|
72
75
|
"aria-haspopup": "listbox",
|
|
73
|
-
"aria-
|
|
74
|
-
"
|
|
75
|
-
"aria-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
"aria-label": o ? void 0 : j,
|
|
77
|
+
"data-value": c,
|
|
78
|
+
"aria-expanded": V,
|
|
79
|
+
"aria-required": T || void 0,
|
|
80
|
+
"aria-describedby": te,
|
|
81
|
+
"aria-invalid": C ? !0 : void 0,
|
|
82
|
+
children: [/* @__PURE__ */ p("span", {
|
|
83
|
+
className: `select-combobox__value${q == null ? " is-placeholder" : ""}`,
|
|
84
|
+
children: q ?? L
|
|
85
|
+
}), /* @__PURE__ */ p("span", {
|
|
80
86
|
className: "select-combobox__caret",
|
|
81
87
|
"aria-hidden": "true",
|
|
82
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ p(t, {})
|
|
83
89
|
})]
|
|
84
90
|
}),
|
|
85
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ m("div", {
|
|
86
92
|
className: "select-combobox__panel",
|
|
87
|
-
|
|
93
|
+
ref: G,
|
|
94
|
+
onKeyDown: i,
|
|
95
|
+
children: [D && /* @__PURE__ */ p("div", {
|
|
88
96
|
className: "select-combobox__search",
|
|
89
|
-
children: /* @__PURE__ */
|
|
97
|
+
children: /* @__PURE__ */ p("input", {
|
|
90
98
|
className: "select-combobox__searchinput",
|
|
91
99
|
type: "text",
|
|
92
|
-
value:
|
|
93
|
-
onChange: (e) =>
|
|
100
|
+
value: U,
|
|
101
|
+
onChange: (e) => W(e.target.value),
|
|
94
102
|
onKeyDown: (e) => {
|
|
95
|
-
e.key === "Enter" &&
|
|
103
|
+
e.key === "Enter" && O && Y !== "" && (e.preventDefault(), $(X ? X.value : Y));
|
|
96
104
|
},
|
|
97
|
-
placeholder:
|
|
98
|
-
autoFocus: !0
|
|
105
|
+
placeholder: R
|
|
99
106
|
})
|
|
100
|
-
}), /* @__PURE__ */
|
|
101
|
-
count:
|
|
102
|
-
children: [
|
|
107
|
+
}), /* @__PURE__ */ m(h, {
|
|
108
|
+
count: J.length + +!!Z,
|
|
109
|
+
children: [Z && /* @__PURE__ */ p("button", {
|
|
103
110
|
type: "button",
|
|
104
111
|
role: "option",
|
|
105
112
|
"aria-selected": !1,
|
|
106
113
|
className: "select-combobox__option select-combobox__option--custom",
|
|
107
|
-
onClick: () => Y
|
|
108
|
-
children: /* @__PURE__ */
|
|
114
|
+
onClick: () => $(Y),
|
|
115
|
+
children: /* @__PURE__ */ p("span", {
|
|
109
116
|
className: "select-combobox__optiontext",
|
|
110
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ p("span", {
|
|
111
118
|
className: "select-combobox__optionlabel",
|
|
112
|
-
children:
|
|
119
|
+
children: k ? k(Y) : `Usar “${Y}”`
|
|
113
120
|
})
|
|
114
121
|
})
|
|
115
|
-
}),
|
|
122
|
+
}), J.length === 0 ? Z ? null : /* @__PURE__ */ p("div", {
|
|
116
123
|
className: "select-combobox__empty",
|
|
117
|
-
children:
|
|
118
|
-
}) :
|
|
119
|
-
let n = t.value ===
|
|
120
|
-
return /* @__PURE__ */
|
|
124
|
+
children: z
|
|
125
|
+
}) : J.map((t) => {
|
|
126
|
+
let n = t.value === c;
|
|
127
|
+
return /* @__PURE__ */ m("button", {
|
|
121
128
|
type: "button",
|
|
122
129
|
role: "option",
|
|
123
130
|
"aria-selected": n,
|
|
131
|
+
"data-value": t.value,
|
|
124
132
|
disabled: t.disabled,
|
|
125
133
|
className: `select-combobox__option${n ? " is-selected" : ""}`,
|
|
126
|
-
onClick: () =>
|
|
127
|
-
children: [/* @__PURE__ */
|
|
134
|
+
onClick: () => $(t.value),
|
|
135
|
+
children: [/* @__PURE__ */ m("span", {
|
|
128
136
|
className: "select-combobox__optiontext",
|
|
129
|
-
children: [/* @__PURE__ */
|
|
137
|
+
children: [/* @__PURE__ */ p("span", {
|
|
130
138
|
className: "select-combobox__optionlabel",
|
|
131
139
|
children: t.label
|
|
132
|
-
}), t.secondary && /* @__PURE__ */
|
|
140
|
+
}), t.secondary && /* @__PURE__ */ p("span", {
|
|
133
141
|
className: "select-combobox__optionsecondary",
|
|
134
142
|
children: t.secondary
|
|
135
143
|
})]
|
|
136
|
-
}), n && /* @__PURE__ */
|
|
144
|
+
}), n && /* @__PURE__ */ p("span", {
|
|
137
145
|
className: "select-combobox__check",
|
|
138
146
|
"aria-hidden": "true",
|
|
139
|
-
children: /* @__PURE__ */
|
|
147
|
+
children: /* @__PURE__ */ p(e, {})
|
|
140
148
|
})]
|
|
141
149
|
}, t.value);
|
|
142
150
|
})]
|
|
@@ -144,19 +152,19 @@ var p = o(function({ label: i, value: o, onChange: p, options: m, placeholder: h
|
|
|
144
152
|
})
|
|
145
153
|
})
|
|
146
154
|
}),
|
|
147
|
-
|
|
148
|
-
id: `${
|
|
155
|
+
C ? /* @__PURE__ */ p("p", {
|
|
156
|
+
id: `${B}-err`,
|
|
149
157
|
className: "select-field__error",
|
|
150
|
-
children:
|
|
151
|
-
}) :
|
|
152
|
-
id: `${
|
|
158
|
+
children: C
|
|
159
|
+
}) : S ? /* @__PURE__ */ p("p", {
|
|
160
|
+
id: `${B}-hint`,
|
|
153
161
|
className: "select-field__hint",
|
|
154
|
-
children:
|
|
162
|
+
children: S
|
|
155
163
|
}) : null
|
|
156
164
|
]
|
|
157
165
|
});
|
|
158
166
|
});
|
|
159
167
|
//#endregion
|
|
160
|
-
export {
|
|
168
|
+
export { g as SelectCombobox };
|
|
161
169
|
|
|
162
170
|
//# sourceMappingURL=SelectCombobox.js.map
|
package/dist/SelectFilterBar.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CheckIcon as e, ChevronDownIcon as t, CloseIcon as n, PlusIcon as r, SearchIcon as i } from "./icons.js";
|
|
2
2
|
import { useSelectMessages as a } from "./SelectLocale.js";
|
|
3
3
|
import { SelectField as o } from "./SelectField.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { moveInOptions as s, useOptionListFocus as c } from "./internal/optionList.js";
|
|
5
|
+
import { SelectPopover as l } from "./SelectPopover.js";
|
|
6
|
+
import { SelectSearchInput as u } from "./SelectSearchInput.js";
|
|
7
7
|
import { SelectDateField as d } from "./SelectDateField.js";
|
|
8
8
|
import { formatDateValue as f } from "./internal/dateValue.js";
|
|
9
9
|
import { forwardRef as p, useEffect as m, useRef as h, useState as g } from "react";
|
|
@@ -30,11 +30,11 @@ function x(e, t) {
|
|
|
30
30
|
}
|
|
31
31
|
function S({ filter: n, value: r, onChange: i, open: f, onToggle: p, onClose: S, disabled: C }) {
|
|
32
32
|
let w = a(), [T, E] = g(""), D = h(null);
|
|
33
|
-
|
|
33
|
+
c(f && (n.type === "select" || n.type === "multiselect"), D), m(() => {
|
|
34
34
|
f || E("");
|
|
35
35
|
}, [f]);
|
|
36
36
|
let O = r.trim() !== "", k = O ? x(n, r) : null, A = O && !!n.error, j = n.options ?? [], M = j.length > 7, N = M ? j.filter((e) => e.label.toLowerCase().includes(T.trim().toLowerCase())) : j;
|
|
37
|
-
return /* @__PURE__ */ v(
|
|
37
|
+
return /* @__PURE__ */ v(l, {
|
|
38
38
|
active: f,
|
|
39
39
|
onClose: S,
|
|
40
40
|
placement: "bottom-start",
|
|
@@ -59,10 +59,10 @@ function S({ filter: n, value: r, onChange: i, open: f, onToggle: p, onClose: S,
|
|
|
59
59
|
n.type === "multiselect" ? /* @__PURE__ */ v("div", {
|
|
60
60
|
className: "select-facet__panel",
|
|
61
61
|
ref: D,
|
|
62
|
-
onKeyDown:
|
|
62
|
+
onKeyDown: s,
|
|
63
63
|
children: [M && /* @__PURE__ */ _("div", {
|
|
64
64
|
className: "select-facet__search",
|
|
65
|
-
children: /* @__PURE__ */ _(
|
|
65
|
+
children: /* @__PURE__ */ _(u, {
|
|
66
66
|
value: T,
|
|
67
67
|
onChange: E,
|
|
68
68
|
placeholder: w.filterBar.searchOption
|
|
@@ -93,10 +93,10 @@ function S({ filter: n, value: r, onChange: i, open: f, onToggle: p, onClose: S,
|
|
|
93
93
|
}) : n.type === "select" ? /* @__PURE__ */ v("div", {
|
|
94
94
|
className: "select-facet__panel",
|
|
95
95
|
ref: D,
|
|
96
|
-
onKeyDown:
|
|
96
|
+
onKeyDown: s,
|
|
97
97
|
children: [M && /* @__PURE__ */ _("div", {
|
|
98
98
|
className: "select-facet__search",
|
|
99
|
-
children: /* @__PURE__ */ _(
|
|
99
|
+
children: /* @__PURE__ */ _(u, {
|
|
100
100
|
value: T,
|
|
101
101
|
onChange: E,
|
|
102
102
|
placeholder: w.filterBar.searchOption
|
|
@@ -165,11 +165,11 @@ function S({ filter: n, value: r, onChange: i, open: f, onToggle: p, onClose: S,
|
|
|
165
165
|
]
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
var C = p(function({ filters: e, values: t, onChange: o, onClearAll:
|
|
168
|
+
var C = p(function({ filters: e, values: t, onChange: o, onClearAll: u, search: d, leading: f, disabled: p, className: m, ...y }, b) {
|
|
169
169
|
let C = a(), [w, T] = g([]), [E, D] = g(null), [O, k] = g(!1), A = h(null);
|
|
170
|
-
|
|
170
|
+
c(O, A);
|
|
171
171
|
let j = (e) => (t[e.key] ?? "").trim() !== "", M = (e) => !!e.pinned || j(e) || w.includes(e.key), N = e.filter(M), P = e.filter((e) => !M(e)), F = e.filter(j), I = () => {
|
|
172
|
-
T([]), D(null),
|
|
172
|
+
T([]), D(null), u();
|
|
173
173
|
}, L = (e) => {
|
|
174
174
|
T((t) => t.includes(e) ? t : [...t, e]), k(!1), D(e);
|
|
175
175
|
};
|
|
@@ -231,7 +231,7 @@ var C = p(function({ filters: e, values: t, onChange: o, onClearAll: c, search:
|
|
|
231
231
|
onClose: () => D((t) => t === e.key ? null : t),
|
|
232
232
|
disabled: p
|
|
233
233
|
}, e.key)),
|
|
234
|
-
P.length > 0 && /* @__PURE__ */ _(
|
|
234
|
+
P.length > 0 && /* @__PURE__ */ _(l, {
|
|
235
235
|
active: O,
|
|
236
236
|
onClose: () => k(!1),
|
|
237
237
|
placement: "bottom-start",
|
|
@@ -251,7 +251,7 @@ var C = p(function({ filters: e, values: t, onChange: o, onClearAll: c, search:
|
|
|
251
251
|
className: "select-facet__options",
|
|
252
252
|
role: "menu",
|
|
253
253
|
ref: A,
|
|
254
|
-
onKeyDown:
|
|
254
|
+
onKeyDown: s,
|
|
255
255
|
children: P.map((e) => /* @__PURE__ */ _("button", {
|
|
256
256
|
type: "button",
|
|
257
257
|
role: "menuitem",
|
package/dist/SelectMenu.d.ts
CHANGED
|
@@ -23,7 +23,9 @@ type SelectMenuLinkOwnProps = {
|
|
|
23
23
|
description?: ReactNode;
|
|
24
24
|
/** Destino. Absoluto (https:, mailto:) → tratado como externo por padrão. Esquema fora de
|
|
25
25
|
* `http(s)`/`mailto`/`tel` (`javascript:`…) sai sem `href` (internal/safeHref). */
|
|
26
|
-
href
|
|
26
|
+
href?: string;
|
|
27
|
+
/** 0.1.225: um endereço do app — o `<Link>` do roteador (sem recarregar a página). */
|
|
28
|
+
to?: string;
|
|
27
29
|
icon?: ReactNode;
|
|
28
30
|
/** Elemento à direita. Num item externo, default = a seta de "abre fora". */
|
|
29
31
|
trailing?: ReactNode;
|
|
@@ -32,7 +34,7 @@ type SelectMenuLinkOwnProps = {
|
|
|
32
34
|
tone?: 'default' | 'critical';
|
|
33
35
|
};
|
|
34
36
|
export type SelectMenuLinkProps = SelectMenuLinkOwnProps & Omit<ComponentPropsWithoutRef<'a'>, keyof SelectMenuLinkOwnProps>;
|
|
35
|
-
/** A linha de menu que é um LINK de verdade (<a>), não um botão com onClick: preserva
|
|
37
|
+
/** A linha de menu que é um LINK de verdade (<a>; com `to`, 0.1.225, o <Link> do roteador), não um botão com onClick: preserva
|
|
36
38
|
* clique do meio, "abrir em nova aba" e o URL na barra de status do browser — o que um
|
|
37
39
|
* menu de documentação/recursos precisa ter. */
|
|
38
40
|
export declare const SelectMenuLink: import('react').ForwardRefExoticComponent<SelectMenuLinkOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">, keyof SelectMenuLinkOwnProps> & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
@@ -41,6 +43,20 @@ export declare const SelectMenuLink: import('react').ForwardRefExoticComponent<S
|
|
|
41
43
|
export declare function SelectMenuHeading({ children }: {
|
|
42
44
|
children: ReactNode;
|
|
43
45
|
}): import("react").JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* 0.1.225: o TOPO do menu da conta — quem está entrando: a foto ou as iniciais (`avatar`), o nome e as linhas de apoio
|
|
48
|
+
* (o e-mail, o papel). Não é um item: não recebe foco.
|
|
49
|
+
*/
|
|
50
|
+
export declare function SelectMenuHeader({ avatar, title, children }: {
|
|
51
|
+
avatar?: ReactNode;
|
|
52
|
+
title: ReactNode;
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
}): import("react").JSX.Element;
|
|
55
|
+
/** 0.1.225: uma linha do menu com o rótulo à esquerda e um controle à direita (o tema, o idioma). */
|
|
56
|
+
export declare function SelectMenuRow({ label, children }: {
|
|
57
|
+
label: ReactNode;
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
}): import("react").JSX.Element;
|
|
44
60
|
export declare function SelectMenuDivider(): import("react").JSX.Element;
|
|
45
61
|
type SelectMenuButtonOwnProps = {
|
|
46
62
|
children: ReactNode;
|
package/dist/SelectMenu.js
CHANGED
|
@@ -2,8 +2,9 @@ import { safeHref as e } from "./internal/safeHref.js";
|
|
|
2
2
|
import { ChevronDownIcon as t, ExternalLinkIcon as n } from "./icons.js";
|
|
3
3
|
import { forwardRef as r } from "react";
|
|
4
4
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { Link as o } from "react-router-dom";
|
|
5
6
|
//#region src/SelectMenu.tsx
|
|
6
|
-
var
|
|
7
|
+
var s = r(function({ children: e, className: t, ...n }, r) {
|
|
7
8
|
return /* @__PURE__ */ i("div", {
|
|
8
9
|
ref: r,
|
|
9
10
|
...n,
|
|
@@ -12,7 +13,7 @@ var o = r(function({ children: e, className: t, ...n }, r) {
|
|
|
12
13
|
children: e
|
|
13
14
|
});
|
|
14
15
|
});
|
|
15
|
-
function
|
|
16
|
+
function c({ children: e, description: t }) {
|
|
16
17
|
return t == null || t === "" ? /* @__PURE__ */ i("span", {
|
|
17
18
|
className: "select-menu__label",
|
|
18
19
|
children: e
|
|
@@ -27,20 +28,20 @@ function s({ children: e, description: t }) {
|
|
|
27
28
|
})]
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
var
|
|
31
|
+
var l = r(function({ children: e, description: t, icon: n, trailing: r, onClick: o, active: s = !1, tone: l = "default", className: u, ...d }, f) {
|
|
31
32
|
return /* @__PURE__ */ a("button", {
|
|
32
33
|
ref: f,
|
|
33
34
|
...d,
|
|
34
35
|
type: "button",
|
|
35
36
|
role: "menuitem",
|
|
36
|
-
className: `select-menu__item select-menu__item--${l}${
|
|
37
|
+
className: `select-menu__item select-menu__item--${l}${s ? " is-active" : ""}${u ? " " + u : ""}`,
|
|
37
38
|
onClick: o,
|
|
38
39
|
children: [
|
|
39
40
|
n && /* @__PURE__ */ i("span", {
|
|
40
41
|
className: "select-menu__icon",
|
|
41
42
|
children: n
|
|
42
43
|
}),
|
|
43
|
-
/* @__PURE__ */ i(
|
|
44
|
+
/* @__PURE__ */ i(c, {
|
|
44
45
|
description: t,
|
|
45
46
|
children: e
|
|
46
47
|
}),
|
|
@@ -50,45 +51,92 @@ var c = r(function({ children: e, description: t, icon: n, trailing: r, onClick:
|
|
|
50
51
|
})
|
|
51
52
|
]
|
|
52
53
|
});
|
|
53
|
-
}),
|
|
54
|
-
let
|
|
55
|
-
return /* @__PURE__ */ a(
|
|
56
|
-
ref:
|
|
57
|
-
...
|
|
58
|
-
|
|
54
|
+
}), u = r(function({ children: t, description: r, href: s, to: l, icon: u, trailing: d, external: f, tone: p = "default", className: m, ...h }, g) {
|
|
55
|
+
let _ = e(l ?? s), v = l == null && (f ?? /^(https?:|mailto:|tel:)/i.test(_ ?? "")), y = d ?? (v ? /* @__PURE__ */ i(n, {}) : void 0);
|
|
56
|
+
return l != null && _ !== void 0 ? /* @__PURE__ */ a(o, {
|
|
57
|
+
ref: g,
|
|
58
|
+
...h,
|
|
59
|
+
to: _,
|
|
59
60
|
role: "menuitem",
|
|
60
|
-
|
|
61
|
-
rel: g ? "noreferrer" : p.rel,
|
|
62
|
-
className: `select-menu__item select-menu__item--${d}${f ? " " + f : ""}`,
|
|
61
|
+
className: `select-menu__item select-menu__item--${p}${m ? " " + m : ""}`,
|
|
63
62
|
children: [
|
|
64
|
-
|
|
63
|
+
u && /* @__PURE__ */ i("span", {
|
|
65
64
|
className: "select-menu__icon",
|
|
66
|
-
children:
|
|
65
|
+
children: u
|
|
67
66
|
}),
|
|
68
|
-
/* @__PURE__ */ i(
|
|
67
|
+
/* @__PURE__ */ i(c, {
|
|
69
68
|
description: r,
|
|
70
69
|
children: t
|
|
71
70
|
}),
|
|
72
|
-
|
|
71
|
+
y && /* @__PURE__ */ i("span", {
|
|
73
72
|
className: "select-menu__trailing",
|
|
74
|
-
children:
|
|
73
|
+
children: y
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}) : /* @__PURE__ */ a("a", {
|
|
77
|
+
ref: g,
|
|
78
|
+
...h,
|
|
79
|
+
href: _,
|
|
80
|
+
role: "menuitem",
|
|
81
|
+
target: v ? "_blank" : h.target,
|
|
82
|
+
rel: v ? "noreferrer" : h.rel,
|
|
83
|
+
className: `select-menu__item select-menu__item--${p}${m ? " " + m : ""}`,
|
|
84
|
+
children: [
|
|
85
|
+
u && /* @__PURE__ */ i("span", {
|
|
86
|
+
className: "select-menu__icon",
|
|
87
|
+
children: u
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ i(c, {
|
|
90
|
+
description: r,
|
|
91
|
+
children: t
|
|
92
|
+
}),
|
|
93
|
+
y && /* @__PURE__ */ i("span", {
|
|
94
|
+
className: "select-menu__trailing",
|
|
95
|
+
children: y
|
|
75
96
|
})
|
|
76
97
|
]
|
|
77
98
|
});
|
|
78
99
|
});
|
|
79
|
-
function
|
|
100
|
+
function d({ children: e }) {
|
|
80
101
|
return /* @__PURE__ */ i("div", {
|
|
81
102
|
className: "select-menu__heading",
|
|
82
103
|
children: e
|
|
83
104
|
});
|
|
84
105
|
}
|
|
85
|
-
function
|
|
106
|
+
function f({ avatar: e, title: t, children: n }) {
|
|
107
|
+
return /* @__PURE__ */ a("div", {
|
|
108
|
+
className: "select-menu__header",
|
|
109
|
+
children: [e == null ? null : /* @__PURE__ */ i("span", {
|
|
110
|
+
className: "select-menu__header-avatar",
|
|
111
|
+
children: e
|
|
112
|
+
}), /* @__PURE__ */ a("span", {
|
|
113
|
+
className: "select-menu__header-text",
|
|
114
|
+
children: [/* @__PURE__ */ i("span", {
|
|
115
|
+
className: "select-menu__title",
|
|
116
|
+
children: t
|
|
117
|
+
}), n]
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function p({ label: e, children: t }) {
|
|
122
|
+
return /* @__PURE__ */ a("div", {
|
|
123
|
+
className: "select-menu__row",
|
|
124
|
+
children: [/* @__PURE__ */ i("span", {
|
|
125
|
+
className: "select-menu__row-label",
|
|
126
|
+
children: e
|
|
127
|
+
}), /* @__PURE__ */ i("span", {
|
|
128
|
+
className: "select-menu__row-control",
|
|
129
|
+
children: t
|
|
130
|
+
})]
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function m() {
|
|
86
134
|
return /* @__PURE__ */ i("div", {
|
|
87
135
|
className: "select-menu__divider",
|
|
88
136
|
role: "separator"
|
|
89
137
|
});
|
|
90
138
|
}
|
|
91
|
-
var
|
|
139
|
+
var h = r(function({ children: e, onClick: n, active: r = !1, className: o, ...s }, c) {
|
|
92
140
|
return /* @__PURE__ */ a("button", {
|
|
93
141
|
ref: c,
|
|
94
142
|
...s,
|
|
@@ -105,6 +153,6 @@ var f = r(function({ children: e, onClick: n, active: r = !1, className: o, ...s
|
|
|
105
153
|
});
|
|
106
154
|
});
|
|
107
155
|
//#endregion
|
|
108
|
-
export {
|
|
156
|
+
export { s as SelectMenu, h as SelectMenuButton, m as SelectMenuDivider, f as SelectMenuHeader, d as SelectMenuHeading, l as SelectMenuItem, u as SelectMenuLink, p as SelectMenuRow };
|
|
109
157
|
|
|
110
158
|
//# sourceMappingURL=SelectMenu.js.map
|
package/dist/SelectSideNav.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ export interface SideNavItem {
|
|
|
16
16
|
hint?: string;
|
|
17
17
|
/** Um ponto no ícone do trilho — ex.: a fila com trabalho parado (o número fica no menu aberto). */
|
|
18
18
|
indicator?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 0.1.225: o item é um LINK de verdade até a página — `to` é um endereço do app (o `<Link>` do roteador) e `href`, um
|
|
21
|
+
* de fora. Abre em outra aba, copia o endereço e o leitor de tela diz "link" (e "página atual" no ativo). O `onSelect`
|
|
22
|
+
* continua sendo chamado no clique (para fechar a gaveta, por exemplo).
|
|
23
|
+
*/
|
|
24
|
+
to?: string;
|
|
25
|
+
href?: string;
|
|
19
26
|
}
|
|
20
27
|
export interface SideNavSection {
|
|
21
28
|
label?: string;
|