@selectwin/kit 0.1.263 → 0.1.264

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 CHANGED
@@ -275,6 +275,15 @@ Os tokens novos das prévias que imitam o leitor e o navegador (`--select-mailpr
275
275
  `--select-browser-*`) moram só no :root, iguais nos dois temas; o resto segue o painel pelos tokens de sempre. Os textos
276
276
  novos estão no `SelectLocale`, em pt-BR e en.
277
277
 
278
+ Os três detalhes da barra de ações do balão (0.1.264; o dono, depois da 0.1.262). A barra do balão que abre a conversa
279
+ (sem nada em cima dele, nem o dia) sai embaixo dele na conversa estreita e no celular: em cima ela passava do topo da
280
+ área que rola. Com o dia em cima, como no Chat da SWMX, ela fica em cima, como nas pranchas. Pelo foco, a barra só fica
281
+ com o foco visível (`:has(:focus-visible)`; o `:focus-within` só no navegador sem o `:has()`), e o `SelectPopover` aberto
282
+ pelo ponteiro e fechado só com o Esc devolve o foco ao gatilho sem o anel (`focusVisible: false`): quem usa o mouse vê a
283
+ barra sumir quando o ponteiro sai do balão; quem usa o teclado (ou anda pelo painel com as setas e o Tab) segue com o anel
284
+ e a barra. E o gatilho de painel no `SelectIconButton` (com `aria-expanded`) guarda o desenho de ativo, mas não anuncia
285
+ "pressionado": o leitor de tela ouve "expandido" (também o seletor de colunas do `SelectDataTable`). Sem prop nova.
286
+
278
287
  ## Build
279
288
 
280
289
  ```bash
@@ -10,7 +10,8 @@ type SelectIconButtonOwnProps = {
10
10
  /**
11
11
  * Pressed/selected look — e.g. the active device in a preview toggle. 0.1.200: o `aria-pressed` só sai quando `active`
12
12
  * vem: o botão de ícone comum (copiar, fechar, o "…") não é um botão de alternar, e o leitor de tela o anunciava como
13
- * "não pressionado".
13
+ * "não pressionado". 0.1.264: o gatilho de um painel (com `aria-expanded`, o seletor de emoji, o de reação) fica com o
14
+ * desenho de ativo enquanto o painel está aberto, mas o leitor de tela ouve "expandido", nunca "pressionado".
14
15
  */
15
16
  active?: boolean;
16
17
  };
@@ -11,7 +11,7 @@ var r = t(function({ icon: t, label: r, onClick: i, disabled: a = !1, size: o =
11
11
  type: "button",
12
12
  className: `select-iconbtn select-iconbtn--${o} select-iconbtn--${s}${c ? " is-active" : ""}${l ? " " + l : ""}`,
13
13
  "aria-label": r,
14
- "aria-pressed": c,
14
+ "aria-pressed": u["aria-expanded"] === void 0 ? c : void 0,
15
15
  onClick: i,
16
16
  disabled: a,
17
17
  children: t
@@ -9,7 +9,7 @@ import { createPortal as h } from "react-dom";
9
9
  //#region src/SelectPopover.tsx
10
10
  var g = [], _ = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
11
11
  function v({ active: v, onClose: y, activator: b, children: x, placement: S = "bottom-start", gap: C = 6, role: w, trapFocus: T = !1, matchWidth: E = !1, theme: D }) {
12
- let O = u(null), k = u(null), A = u(null), [j, M] = d(null), [N, P] = d("light"), [F] = d(() => ({})), I = a(), L = s(() => {
12
+ let O = u(null), k = u(null), A = u(null), j = u(!1), [M, N] = d(null), [P, F] = d("light"), [I] = d(() => ({})), L = a(), R = s(() => {
13
13
  var t;
14
14
  let n = ((t = O.current) == null ? void 0 : t.firstElementChild) ?? O.current, r = k.current;
15
15
  if (!n || !r) return;
@@ -17,7 +17,7 @@ function v({ active: v, onClose: y, activator: b, children: x, placement: S = "b
17
17
  width: r.offsetWidth,
18
18
  height: r.offsetHeight
19
19
  }, S, C);
20
- M({
20
+ N({
21
21
  top: a.top,
22
22
  left: a.left,
23
23
  minWidth: E ? i.width : void 0
@@ -29,17 +29,21 @@ function v({ active: v, onClose: y, activator: b, children: x, placement: S = "b
29
29
  ]);
30
30
  return l(() => {
31
31
  if (!v) {
32
- M(null);
32
+ N(null);
33
33
  return;
34
34
  }
35
- P(o(O.current)), L();
36
- }, [v, L]), l(() => {
35
+ F(o(O.current)), R();
36
+ }, [v, R]), l(() => {
37
37
  var e, t;
38
38
  if (!v) return;
39
39
  let n = document.activeElement, r = !n || n === document.body || !!((e = k.current) != null && e.contains(n));
40
40
  return A.current = r ? ((t = O.current) == null ? void 0 : t.querySelector(_)) ?? n : n, () => {
41
41
  var e, t;
42
- return (e = A.current) == null || (t = e.focus) == null ? void 0 : t.call(e, { preventScroll: !0 });
42
+ let n = j.current ? {
43
+ preventScroll: !0,
44
+ focusVisible: !1
45
+ } : { preventScroll: !0 };
46
+ (e = A.current) == null || (t = e.focus) == null || t.call(e, n);
43
47
  };
44
48
  }, [v]), c(() => {
45
49
  if (!v) return;
@@ -50,18 +54,18 @@ function v({ active: v, onClose: y, activator: b, children: x, placement: S = "b
50
54
  };
51
55
  }, [v]), c(() => {
52
56
  if (!v) return;
53
- let e = () => L();
57
+ let e = () => R();
54
58
  return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
55
59
  window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
56
60
  };
57
- }, [v, L]), c(() => {
61
+ }, [v, R]), c(() => {
58
62
  if (!v) return;
59
- let e = i(F, I), t = (e) => {
63
+ let e = i(I, L), t = (e) => {
60
64
  var t, n;
61
65
  let r = e.target;
62
66
  (t = k.current) != null && t.contains(r) || (n = O.current) != null && n.contains(r) || g.length && g[g.length - 1] !== k.current || y();
63
67
  }, n = (e) => {
64
- e.key === "Escape" && r(F) && (e.stopPropagation(), y());
68
+ e.key === "Escape" && r(I) && (e.stopPropagation(), y());
65
69
  };
66
70
  return document.addEventListener("mousedown", t, !0), document.addEventListener("keydown", n), () => {
67
71
  e(), document.removeEventListener("mousedown", t, !0), document.removeEventListener("keydown", n);
@@ -69,24 +73,33 @@ function v({ active: v, onClose: y, activator: b, children: x, placement: S = "b
69
73
  }, [
70
74
  v,
71
75
  y,
72
- F,
73
- I
76
+ I,
77
+ L
74
78
  ]), t(v && T, k), /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", {
75
79
  className: "select-pop__trigger",
76
80
  ref: O,
77
81
  "data-open": v ? "true" : void 0,
82
+ onPointerDown: () => {
83
+ j.current = !0;
84
+ },
85
+ onKeyDown: (e) => {
86
+ e.key !== "Escape" && (j.current = !1);
87
+ },
78
88
  children: b
79
89
  }), v && h(/* @__PURE__ */ p("div", {
80
90
  ref: k,
81
91
  className: "select select-pop__panel",
82
- "data-theme": D ?? N,
92
+ "data-theme": D ?? P,
83
93
  role: w,
84
94
  tabIndex: -1,
85
- style: j ? {
95
+ onKeyDown: (e) => {
96
+ e.key !== "Escape" && (j.current = !1);
97
+ },
98
+ style: M ? {
86
99
  position: "fixed",
87
- top: j.top,
88
- left: j.left,
89
- minWidth: j.minWidth
100
+ top: M.top,
101
+ left: M.left,
102
+ minWidth: M.minWidth
90
103
  } : {
91
104
  position: "fixed",
92
105
  top: 0,
@@ -94,7 +107,7 @@ function v({ active: v, onClose: y, activator: b, children: x, placement: S = "b
94
107
  opacity: 0
95
108
  },
96
109
  children: /* @__PURE__ */ p(n, {
97
- value: F,
110
+ value: I,
98
111
  children: x
99
112
  })
100
113
  }), document.body)] });