@selectwin/kit 0.1.223 → 0.1.225

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.
@@ -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
  /**
@@ -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", initials: l = 1, monogram: u, className: d, ...f }, p) {
5
- let m = (u == null ? void 0 : u.trim().slice(0, 3).toUpperCase()) || i(e, l), [h, g] = t(null), _ = !!r && h !== r;
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: p,
8
- ...f,
9
- className: `select-avatar${c === "lg" ? " select-avatar--lg" : ""}${o ? " select-avatar--dashed" : ""}${s ? " select-avatar--round" : ""}${d ? " " + d : ""}`,
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: _ ? /* @__PURE__ */ n("img", {
11
+ children: v ? /* @__PURE__ */ n("img", {
12
12
  src: r,
13
13
  alt: "",
14
14
  className: "select-avatar__img",
15
- onError: () => g(r ?? null)
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${m.length > 2 ? " select-avatar__initial--long" : ""}`,
21
- children: m
20
+ className: `select-avatar__initial${h.length > 2 ? " select-avatar__initial--long" : ""}`,
21
+ children: h
22
22
  })
23
23
  });
24
24
  });
@@ -22,6 +22,11 @@ type SelectCopyRowOwnProps = {
22
22
  */
23
23
  secret?: boolean;
24
24
  secretName?: string;
25
+ /**
26
+ * 0.1.224: o texto MOSTRADO, quando é outro que o copiado: a chave do autenticador em grupos de 4 ("JBSW Y3DP …"),
27
+ * fácil de digitar à mão, e o copiar leva a chave sem os espaços (o `value`).
28
+ */
29
+ display?: string;
25
30
  };
26
31
  export type SelectCopyRowProps = SelectCopyRowOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectCopyRowOwnProps>;
27
32
  export declare const SelectCopyRow: import('react').ForwardRefExoticComponent<SelectCopyRowOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectCopyRowOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
@@ -6,12 +6,12 @@ import { SelectCopyButton as o } from "./SelectCopyButton.js";
6
6
  import { forwardRef as s, useState as c } from "react";
7
7
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
8
8
  //#region src/SelectCopyRow.tsx
9
- var f = s(function({ label: s, value: f, href: p, onCopy: m, prose: h = !1, truncate: g = "end", copyLabel: _, wrap: v = !1, secret: y = !1, secretName: b, className: x, ...S }, C) {
10
- let w = i(), [T, E] = c(!1), D = e(p), O = b ?? s ?? w.copyable.secret, k = y && !T, A = g === "start" && !h && !v;
9
+ var f = s(function({ label: s, value: f, href: p, onCopy: m, prose: h = !1, truncate: g = "end", copyLabel: _, wrap: v = !1, secret: y = !1, secretName: b, display: x, className: S, ...C }, w) {
10
+ let T = i(), [E, D] = c(!1), O = e(p), k = b ?? s ?? T.copyable.secret, A = y && !E, j = g === "start" && !h && !v;
11
11
  return /* @__PURE__ */ d("div", {
12
- ref: C,
13
- ...S,
14
- className: `select-copyrow${h ? " select-copyrow--prose" : ""}${A ? " select-copyrow--truncate-start" : ""}${v ? " select-copyrow--wrap" : ""}${x ? " " + x : ""}`,
12
+ ref: w,
13
+ ...C,
14
+ className: `select-copyrow${h ? " select-copyrow--prose" : ""}${j ? " select-copyrow--truncate-start" : ""}${v ? " select-copyrow--wrap" : ""}${S ? " " + S : ""}`,
15
15
  children: [s && /* @__PURE__ */ u("span", {
16
16
  className: "select-copyrow__label",
17
17
  children: s
@@ -19,34 +19,34 @@ var f = s(function({ label: s, value: f, href: p, onCopy: m, prose: h = !1, trun
19
19
  className: "select-copyrow__value",
20
20
  children: [/* @__PURE__ */ u("span", {
21
21
  className: "select-copyrow__text",
22
- title: A && !k ? f : void 0,
23
- children: k ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("span", {
22
+ title: j && !A ? x ?? f : void 0,
23
+ children: A ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("span", {
24
24
  "aria-hidden": "true",
25
25
  children: "•".repeat(Math.min(32, f.length))
26
26
  }), /* @__PURE__ */ u("span", {
27
27
  className: "select-copybtn__status",
28
- children: w.copyable.concealed(O)
29
- })] }) : A ? /* @__PURE__ */ u("bdi", {
28
+ children: T.copyable.concealed(k)
29
+ })] }) : j ? /* @__PURE__ */ u("bdi", {
30
30
  dir: "ltr",
31
- children: f
32
- }) : f
31
+ children: x ?? f
32
+ }) : x ?? f
33
33
  }), /* @__PURE__ */ d("div", {
34
34
  className: "select-copyrow__actions",
35
35
  children: [
36
- D && /* @__PURE__ */ u("a", {
36
+ O && /* @__PURE__ */ u("a", {
37
37
  className: "select-iconbtn select-iconbtn--sm",
38
- href: D,
38
+ href: O,
39
39
  target: "_blank",
40
40
  rel: "noreferrer",
41
- "aria-label": w.common.open,
42
- title: w.common.open,
41
+ "aria-label": T.common.open,
42
+ title: T.common.open,
43
43
  children: /* @__PURE__ */ u(t, {})
44
44
  }),
45
45
  y && /* @__PURE__ */ u(a, {
46
46
  size: "sm",
47
- icon: u(T ? r : n, {}),
48
- label: T ? w.copyable.conceal(O) : w.copyable.reveal(O),
49
- onClick: () => E((e) => !e)
47
+ icon: u(E ? r : n, {}),
48
+ label: E ? T.copyable.conceal(k) : T.copyable.reveal(k),
49
+ onClick: () => D((e) => !e)
50
50
  }),
51
51
  /* @__PURE__ */ u(o, {
52
52
  value: f,
@@ -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: string;
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;
@@ -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 o = r(function({ children: e, className: t, ...n }, r) {
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 s({ children: e, description: t }) {
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 c = r(function({ children: e, description: t, icon: n, trailing: r, onClick: o, active: c = !1, tone: l = "default", className: u, ...d }, f) {
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}${c ? " is-active" : ""}${u ? " " + u : ""}`,
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(s, {
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
- }), l = r(function({ children: t, description: r, href: o, icon: c, trailing: l, external: u, tone: d = "default", className: f, ...p }, m) {
54
- let h = e(o), g = u ?? /^(https?:|mailto:|tel:)/i.test(h ?? ""), _ = l ?? (g ? /* @__PURE__ */ i(n, {}) : void 0);
55
- return /* @__PURE__ */ a("a", {
56
- ref: m,
57
- ...p,
58
- href: h,
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
- target: g ? "_blank" : p.target,
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
- c && /* @__PURE__ */ i("span", {
63
+ u && /* @__PURE__ */ i("span", {
65
64
  className: "select-menu__icon",
66
- children: c
65
+ children: u
67
66
  }),
68
- /* @__PURE__ */ i(s, {
67
+ /* @__PURE__ */ i(c, {
69
68
  description: r,
70
69
  children: t
71
70
  }),
72
- _ && /* @__PURE__ */ i("span", {
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 u({ children: e }) {
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 d() {
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 f = r(function({ children: e, onClick: n, active: r = !1, className: o, ...s }, c) {
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 { o as SelectMenu, f as SelectMenuButton, d as SelectMenuDivider, u as SelectMenuHeading, c as SelectMenuItem, l as SelectMenuLink };
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
@@ -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;