@thibezer/ui-components-kit 2.17.0 → 2.17.2
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/CHANGELOG.md +23 -0
- package/dist/camadas.cjs +85 -86
- package/dist/camadas.js +1380 -1331
- package/dist/components/ui-camadas/camadas-colecao.d.ts +3 -0
- package/dist/components/ui-camadas/camadas-drag-drop.d.ts +3 -1
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +1 -0
- package/dist/cores.cjs +1 -1
- package/dist/cores.js +2 -2
- package/dist/custom-elements.json +19922 -19922
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/register.cjs +1 -1
- package/dist/register.js +2 -2
- package/dist/{ui-controle-cores-Bq_XUrIQ.cjs → ui-controle-cores-B1w_Yl69.cjs} +1 -1
- package/dist/{ui-controle-cores-BtA6yzu3.js → ui-controle-cores-BRjMvmMn.js} +1 -1
- package/dist/ui-seletor-cor-CMuuW-Ym.cjs +83 -0
- package/dist/ui-seletor-cor-DFIQ1sin.js +405 -0
- package/package.json +1 -1
- package/dist/form-validacao-BIOXxt-1.js +0 -140
- package/dist/form-validacao-ytRYSF3E.cjs +0 -1
- package/dist/gerencigeo-canvas/layer_defaults.d.ts +0 -3
- package/dist/gerencigeo-canvas/layer_instance_ops.d.ts +0 -6
- package/dist/gerencigeo-canvas/layer_state_ops.d.ts +0 -6
- package/dist/leaflet-DcO7uRC-.cjs +0 -1
- package/dist/leaflet-PPDKB6Dd.js +0 -69
- package/dist/motor-BCWqlv3e.cjs +0 -1
- package/dist/motor-CXjQjVba.js +0 -1386
- package/dist/svg-seguro-BsbNQqpd.js +0 -50
- package/dist/svg-seguro-C76iLlAZ.cjs +0 -1
- package/dist/ui-badge-1UU8vT-b.js +0 -198
- package/dist/ui-badge-B5J_c5P5.js +0 -197
- package/dist/ui-badge-BxT-sDmV.cjs +0 -28
- package/dist/ui-badge-C0eKBI8E.js +0 -183
- package/dist/ui-badge-CKKKPdt8.cjs +0 -28
- package/dist/ui-badge-DC4y6Dik.cjs +0 -28
- package/dist/ui-botao-BOOnP8ds.cjs +0 -12
- package/dist/ui-botao-D24oXySA.cjs +0 -12
- package/dist/ui-botao-DfqSivHl.js +0 -165
- package/dist/ui-botao-Dsj08jjw.js +0 -165
- package/dist/ui-botao-OGJV6Vfk.js +0 -165
- package/dist/ui-botao-bU_bf6SU.js +0 -166
- package/dist/ui-botao-psS1juof.cjs +0 -12
- package/dist/ui-botao-xTbH5mpH.cjs +0 -12
- package/dist/ui-campo-texto-19tIrmBK.js +0 -377
- package/dist/ui-campo-texto-CH8mzX61.cjs +0 -16
- package/dist/ui-campo-texto-Cnn2UAkS.cjs +0 -16
- package/dist/ui-campo-texto-DVU_sWV1.cjs +0 -16
- package/dist/ui-campo-texto-Uu2dJE_0.js +0 -379
- package/dist/ui-campo-texto-W5M0gNE4.js +0 -377
- package/dist/ui-card-0wu4rjEX.cjs +0 -20
- package/dist/ui-card-B86lJXTP.cjs +0 -20
- package/dist/ui-card-BYyYxxY1.cjs +0 -20
- package/dist/ui-card-C_o5_0cB.js +0 -111
- package/dist/ui-card-CojoGXaT.js +0 -144
- package/dist/ui-card-DRtpOo3l.js +0 -143
- package/dist/ui-controle-cores-B4R6ct4I.js +0 -291
- package/dist/ui-controle-cores-BS0WYPdi.js +0 -572
- package/dist/ui-controle-cores-C8um-If9.cjs +0 -32
- package/dist/ui-controle-cores-CHMKGemo.cjs +0 -141
- package/dist/ui-controle-cores-C_cVXxCn.js +0 -291
- package/dist/ui-controle-cores-CuDFS8Y8.cjs +0 -32
- package/dist/ui-controle-cores-Dog7ERYv.js +0 -697
- package/dist/ui-controle-cores-Er6ZcQ7U.cjs +0 -111
- package/dist/ui-linha-BxhEBn27.js +0 -749
- package/dist/ui-linha-C306zxWG.cjs +0 -19
- package/dist/ui-linha-C_azWkcG.js +0 -517
- package/dist/ui-linha-CcalUBDw.cjs +0 -38
- package/dist/ui-linha-DAz6DBcl.cjs +0 -38
- package/dist/ui-linha-DkxwMhD-.js +0 -749
- package/dist/ui-modal-4nU-tXjO.cjs +0 -18
- package/dist/ui-modal-BkYvNP0G.js +0 -214
- package/dist/ui-modal-BwB9fksp.js +0 -214
- package/dist/ui-modal-CUNbpbZ1.cjs +0 -18
- package/dist/ui-modal-CvGFGh1h.cjs +0 -18
- package/dist/ui-modal-DBOtSTbR.js +0 -238
- package/dist/ui-paleta-ferramentas-BXXrI1Y7.js +0 -1233
- package/dist/ui-paleta-ferramentas-CEZYcN4J.js +0 -624
- package/dist/ui-paleta-ferramentas-CU4icLl0.js +0 -1171
- package/dist/ui-paleta-ferramentas-Ccmo-rB5.cjs +0 -21
- package/dist/ui-paleta-ferramentas-CsPMTY0G.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DLwZHIDv.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DNN5i6nL.js +0 -860
- package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +0 -18
- package/dist/ui-paleta-ferramentas-DbwdWVtT.js +0 -1173
- package/dist/ui-paleta-ferramentas-bvqxj1Yd.cjs +0 -21
- package/dist/ui-segmented-D6b6zxVs.cjs +0 -19
- package/dist/ui-segmented-DyF5YLsV.js +0 -418
- package/dist/ui-segmented-rn9RxRGM.cjs +0 -19
- package/dist/ui-segmented-wUraId2e.js +0 -412
- package/dist/ui-seletor-cor-C4U2eqxY.cjs +0 -82
- package/dist/ui-seletor-cor-D2_C6Aor.js +0 -391
- package/dist/ui-seletor-cor-DPKqf5wb.cjs +0 -82
- package/dist/ui-seletor-cor-FYtRccnK.js +0 -396
- package/dist/ui-skeleton-B2Rgrv8o.js +0 -648
- package/dist/ui-skeleton-DEHwpDqa.js +0 -648
- package/dist/ui-skeleton-DI4_9WOX.js +0 -428
- package/dist/ui-skeleton-DiOxTBZK.cjs +0 -52
- package/dist/ui-skeleton-SPYqku8P.cjs +0 -52
- package/dist/ui-skeleton-W9uwIceA.js +0 -585
- package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
- package/dist/ui-skeleton-sIphhOSx.cjs +0 -52
- package/dist/ui-switch-BL-x_-SM.js +0 -1202
- package/dist/ui-switch-BcOqOkiV.js +0 -856
- package/dist/ui-switch-C0i_3QXu.cjs +0 -66
- package/dist/ui-switch-D7iPKDj-.cjs +0 -53
- package/dist/ui-switch-DAIgOhqr.cjs +0 -66
- package/dist/ui-switch-_F8yubdX.js +0 -1203
- package/dist/ui-tabela-propriedades-2bq2nX-b.js +0 -3202
- package/dist/ui-tabela-propriedades-8IAYmk3P.cjs +0 -142
- package/dist/ui-tabela-propriedades-B8AwlpqL.cjs +0 -141
- package/dist/ui-tabela-propriedades-BBr5sqki.cjs +0 -145
- package/dist/ui-tabela-propriedades-BecPqC-e.cjs +0 -141
- package/dist/ui-tabela-propriedades-BoYXzP5Z.js +0 -3191
- package/dist/ui-tabela-propriedades-BokvDD3b.js +0 -2648
- package/dist/ui-tabela-propriedades-Boy7I5yW.js +0 -2412
- package/dist/ui-tabela-propriedades-C-PeuW1i.cjs +0 -141
- package/dist/ui-tabela-propriedades-C5YYnod1.js +0 -3053
- package/dist/ui-tabela-propriedades-CnfW9DZG.cjs +0 -142
- package/dist/ui-tabela-propriedades-CyPyKXtB.js +0 -3013
- package/dist/ui-tabela-propriedades-DWOKznMN.cjs +0 -142
- package/dist/ui-tabela-propriedades-Df9ajC6M.js +0 -2648
- package/dist/ui-tabela-propriedades-DqvPilK_.cjs +0 -142
- package/dist/ui-tabela-propriedades-DuaC4sFX.js +0 -2767
- package/dist/ui-toast-Bp_NlM5G.js +0 -156
- package/dist/ui-toast-DGTZKne5.cjs +0 -20
- package/dist/zero-js-triggers-C_KrvFOQ.js +0 -244
- package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
|
@@ -1,1173 +0,0 @@
|
|
|
1
|
-
var J = Object.defineProperty;
|
|
2
|
-
var Q = (n, u, t) => u in n ? J(n, u, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[u] = t;
|
|
3
|
-
var h = (n, u, t) => Q(n, typeof u != "symbol" ? u + "" : u, t);
|
|
4
|
-
import { L as M } from "./listener-bag-DQgv7OON.js";
|
|
5
|
-
import { d as $, S as q } from "./ssr-safe-5cWfJP-s.js";
|
|
6
|
-
import { h as Z } from "./svg-seguro-ChVJ2L2z.js";
|
|
7
|
-
const tt = ':host{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;color:inherit;flex-shrink:0;width:var(--ui-tamanho-icone, 20px);height:var(--ui-tamanho-icone, 20px);box-sizing:border-box}.ui-icone{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;color:inherit;font-size:var(--ui-tamanho-icone, 20px)}::slotted(svg),.ui-icone svg{width:100%!important;height:100%!important;display:block;shape-rendering:geometricPrecision}:host([cor="primaria"]),:host([color="primaria"]){color:var(--ui-cor-primaria, #00E08A)}:host([cor="secundaria"]),:host([color="secundaria"]){color:var(--ui-cor-texto-secundario, #888899)}:host([cor="erro"]),:host([color="erro"]){color:var(--ui-cor-texto-erro, #ff5555)}:host([cor="sucesso"]),:host([color="sucesso"]){color:var(--ui-cor-texto-sucesso, #00E08A)}:host([cor="alerta"]),:host([color="alerta"]){color:var(--ui-cor-texto-alerta, #ffb86c)}', G = {
|
|
8
|
-
search: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
|
|
9
|
-
check: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',
|
|
10
|
-
eye: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>',
|
|
11
|
-
eyeOff: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>',
|
|
12
|
-
lock: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>',
|
|
13
|
-
trash: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>',
|
|
14
|
-
gear: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>',
|
|
15
|
-
bell: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>',
|
|
16
|
-
alert: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>',
|
|
17
|
-
close: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>'
|
|
18
|
-
};
|
|
19
|
-
class et extends q {
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
h(this, "iconContainer");
|
|
23
|
-
h(this, "svgContainer");
|
|
24
|
-
h(this, "slotElement");
|
|
25
|
-
h(this, "handleSlotChange", () => {
|
|
26
|
-
this.syncState();
|
|
27
|
-
});
|
|
28
|
-
const t = this.attachShadow({ mode: "open" });
|
|
29
|
-
t.innerHTML = `
|
|
30
|
-
<style>${tt}</style>
|
|
31
|
-
<span class="ui-icone" aria-hidden="true">
|
|
32
|
-
<span class="ui-icone__svg" style="display: none;"></span>
|
|
33
|
-
<slot></slot>
|
|
34
|
-
</span>
|
|
35
|
-
`, this.iconContainer = t.querySelector(".ui-icone"), this.svgContainer = t.querySelector(".ui-icone__svg"), this.slotElement = t.querySelector("slot");
|
|
36
|
-
}
|
|
37
|
-
static get observedAttributes() {
|
|
38
|
-
return ["tamanho", "size", "cor", "color", "nome", "name"];
|
|
39
|
-
}
|
|
40
|
-
connectedCallback() {
|
|
41
|
-
this.slotElement.addEventListener("slotchange", this.handleSlotChange), this.syncState();
|
|
42
|
-
}
|
|
43
|
-
disconnectedCallback() {
|
|
44
|
-
this.slotElement.removeEventListener("slotchange", this.handleSlotChange);
|
|
45
|
-
}
|
|
46
|
-
attributeChangedCallback(t, e, i) {
|
|
47
|
-
this.syncState();
|
|
48
|
-
}
|
|
49
|
-
resolveTamanhoPx() {
|
|
50
|
-
const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
|
|
51
|
-
switch (t.toLowerCase()) {
|
|
52
|
-
case "sm":
|
|
53
|
-
return "16px";
|
|
54
|
-
case "md":
|
|
55
|
-
return "20px";
|
|
56
|
-
case "lg":
|
|
57
|
-
return "24px";
|
|
58
|
-
case "xl":
|
|
59
|
-
return "32px";
|
|
60
|
-
default:
|
|
61
|
-
return isNaN(Number(t)) ? t : `${t}px`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
syncState() {
|
|
65
|
-
const t = this.resolveTamanhoPx();
|
|
66
|
-
this.style.setProperty("--ui-tamanho-icone", t);
|
|
67
|
-
const e = this.getAttribute("cor") || this.getAttribute("color");
|
|
68
|
-
e ? (this.style.setProperty("--ui-cor-icone", e), this.iconContainer.style.color = e) : (this.style.removeProperty("--ui-cor-icone"), this.iconContainer.style.color = ""), this.hasAttribute("aria-label") || this.hasAttribute("label") ? this.iconContainer.removeAttribute("aria-hidden") : this.iconContainer.setAttribute("aria-hidden", "true");
|
|
69
|
-
const r = this.getAttribute("nome") || this.getAttribute("name"), a = this.slotElement.assignedNodes().length > 0;
|
|
70
|
-
r && G[r] && !a ? (this.svgContainer.innerHTML = G[r], this.svgContainer.style.display = "inline-flex") : (this.svgContainer.innerHTML = "", this.svgContainer.style.display = "none");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
$("ui-icone", et);
|
|
74
|
-
const it = ':host{display:block;position:relative;box-sizing:border-box;min-height:122px;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}:host([recolhido]){min-height:31px}.ui-ribbon{display:flex;flex-direction:column;background:var(--ui-cor-superficie, #141417);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));-webkit-user-select:none;user-select:none}.ui-ribbon__cabecalho{display:flex;align-items:stretch;height:30px;box-sizing:border-box;box-shadow:inset 0 -1px 0 var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__abas{display:flex;flex:1;min-width:0;align-items:flex-end;gap:2px;padding:0 8px;box-sizing:border-box;overflow-x:auto;scrollbar-width:none;background:linear-gradient(to right,var(--ui-cor-superficie, #141417) 20px,transparent) left top / 28px calc(100% - 1px) no-repeat local,linear-gradient(to left,var(--ui-cor-superficie, #141417) 20px,transparent) right top / 28px calc(100% - 1px) no-repeat local,linear-gradient(to right,rgba(0,0,0,.35),transparent) left top / 14px calc(100% - 1px) no-repeat scroll,linear-gradient(to left,rgba(0,0,0,.35),transparent) right top / 14px calc(100% - 1px) no-repeat scroll}.ui-ribbon__abas::-webkit-scrollbar{display:none}.ui-ribbon__aba{position:relative;flex-shrink:0;height:28px;margin-bottom:1px;padding:0 14px;border:0;border-radius:6px 6px 0 0;background:transparent;color:var(--ui-cor-texto-secundario, #888899);font:inherit;font-size:.75rem;font-weight:600;white-space:nowrap;cursor:pointer;transition:background-color .12s ease,color .12s ease}.ui-ribbon__aba:hover{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__aba:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{height:30px;margin-bottom:0;color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-fundo-elevado, #1a1a1e);box-shadow:inset 1px 0 0 var(--ui-cor-borda, rgba(255, 255, 255, .12)),inset -1px 0 0 var(--ui-cor-borda, rgba(255, 255, 255, .12)),inset 0 1px 0 var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__aba--ativa:after{content:"";position:absolute;inset-inline:8px;bottom:1px;height:2px;border-radius:2px 2px 0 0;background:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__aba--contextual{color:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__aba--contextual:before{content:"";position:absolute;inset-inline:0;top:0;height:2px;border-radius:6px 6px 0 0;background:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__fixar{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;align-self:center;width:28px;height:24px;margin-inline:2px 6px;padding:0;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer}.ui-ribbon__fixar:hover{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__fixar:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__fixar:before{content:"";width:6px;height:6px;border:solid currentColor;border-width:2px 0 0 2px;transform:translateY(2px) rotate(45deg)}:host([recolhido]) .ui-ribbon__fixar:before{transform:translateY(-2px) rotate(225deg)}.ui-ribbon__painel{background:var(--ui-cor-fundo-elevado, #1a1a1e);overflow-x:auto;scrollbar-width:thin;scrollbar-color:var(--ui-cor-borda, rgba(255, 255, 255, .2)) transparent}.ui-ribbon__grupos{display:flex;align-items:stretch;width:max-content;min-width:100%;min-height:92px;padding:4px 8px;box-sizing:border-box}.ui-ribbon__grupo{display:flex;flex-direction:column;justify-content:center;flex-shrink:0;padding:0 var(--ui-espaco-sm, 8px);border-inline-end:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__grupo:last-child{border-inline-end:0}.ui-ribbon__grupo-itens{display:flex;flex:1;align-items:center;gap:var(--ui-espaco-xs, 4px)}.ui-ribbon__grupo-rotulo{position:relative;display:flex;align-items:center;justify-content:center;padding:3px 0 1px;color:var(--ui-cor-texto-secundario, #888899);font-size:.6875rem;line-height:1.2;text-align:center;white-space:nowrap}.ui-ribbon__grupo-rotulo:empty{display:none;padding:0}.ui-ribbon__lancador{position:absolute;right:0;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;padding:0;border:0;background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;border-radius:2px;opacity:.7}[dir=rtl] .ui-ribbon__lancador{right:auto;left:0}.ui-ribbon__lancador:hover{opacity:1;color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__lancador:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-1px}.ui-ribbon__grupo--colapsado{padding:0 4px;justify-content:center}.ui-ribbon__btn-colapsado{height:calc(100% - 6px);margin:3px 0}.ui-ribbon__keytip{position:absolute;z-index:100;padding:1px 4px;font-size:.625rem;font-weight:700;line-height:1;color:#111;background:#fef08a;border:1px solid #ca8a04;border-radius:2px;box-shadow:0 1px 3px #0006;pointer-events:none}.ui-ribbon__coluna{display:flex;flex-direction:column;justify-content:center;gap:2px}.ui-ribbon__separador{width:1px;height:68px;align-self:center;margin:0 var(--ui-espaco-xs, 4px);background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn--grande{flex-direction:column;min-width:52px;height:76px;padding:6px 8px;gap:3px;box-sizing:border-box;border-radius:var(--ui-raio-borda, 6px);justify-content:center;align-items:center}.ui-ferr-btn--grande .ui-ferr-btn__rotulo{max-width:72px;white-space:normal;text-align:center;line-height:1.15;overflow-wrap:anywhere}.ui-ferr-btn--pequeno{height:24px;padding:0 8px;border-radius:var(--ui-raio-sm, 4px);justify-content:flex-start;box-sizing:border-box}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:24px;padding:0;justify-content:center}.ui-ferr-split--pequeno{border-radius:var(--ui-raio-sm, 4px)}.ui-ferr-split--pequeno .ui-ferr-split__acao{border-radius:var(--ui-raio-sm, 4px) 0 0 var(--ui-raio-sm, 4px);padding:0 6px 0 8px}.ui-ferr-split--pequeno .ui-ferr-split__gatilho{border-radius:0 var(--ui-raio-sm, 4px) var(--ui-raio-sm, 4px) 0}.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px;box-shadow:none}:host([recolhido]) .ui-ribbon__painel{display:none;position:absolute;top:100%;inset-inline:0;z-index:var(--ui-z-docked-bar, 600);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .35))}:host([recolhido]) .ui-ribbon--aberto .ui-ribbon__painel{display:block}:host([recolhido]) .ui-ribbon__aba--ativa:after{display:none}:host([compacto]) .ui-ribbon__grupos{min-height:0;padding-block:2px}:host([compacto]) .ui-ribbon__grupo-rotulo{display:none}:host([compacto]) .ui-ferr-btn--grande{min-width:44px}@media (max-width: 720px){.ui-ferr-btn--pequeno:has(.ui-ferr-btn__icone) .ui-ferr-btn__rotulo{display:none}.ui-ferr-btn--pequeno:has(.ui-ferr-btn__icone){min-width:28px;justify-content:center;padding:0 4px}}@media (pointer: coarse){.ui-ribbon__cabecalho{height:38px}.ui-ribbon__aba{height:36px}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{height:38px}.ui-ferr-btn--pequeno{height:32px}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:32px}.ui-ribbon__fixar{width:36px;height:32px}}@media (prefers-reduced-motion: reduce){.ui-ribbon__aba{transition:none}}@media (forced-colors: active){.ui-ribbon__aba--ativa:after,.ui-ribbon__aba--contextual:before{background:Highlight;forced-color-adjust:none}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{box-shadow:none;border:1px solid CanvasText;border-bottom-color:Canvas}.ui-ribbon__aba:focus-visible,.ui-ribbon__fixar:focus-visible,.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline-color:Highlight}}', K = '.ui-ferr-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:4px;box-sizing:border-box;padding:0;border:1px solid transparent;border-radius:var(--ui-raio-borda, 6px);background:transparent;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:.75rem;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background-color .12s ease,border-color .12s ease,color .12s ease}.ui-ferr-btn:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-btn:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 14%,transparent)}.ui-ferr-btn:focus-visible{outline:2px solid transparent;outline-offset:2px;box-shadow:0 0 0 2px var(--ui-cor-fundo, #0b0b0d),0 0 0 4px var(--ui-cor-primaria, #00E08A)}.ui-ferr-btn:disabled{opacity:.4;cursor:not-allowed}.ui-ferr-btn--ativo{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent);border-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 55%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 28%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 36%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:disabled{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));border-color:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn__icone{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.ui-ferr-btn__rotulo{white-space:nowrap}.ui-ferr-btn__caret{width:0;height:0;flex-shrink:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid currentColor;opacity:.7}.ui-ferr-menu{position:fixed;z-index:var(--ui-z-popover, 1050);display:flex;flex-direction:column;gap:1px;min-width:180px;max-height:calc(100vh - 8px);overflow-y:auto;padding:4px;box-sizing:border-box;background:var(--ui-cor-fundo-menu, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .35));font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-ferr-menu__item{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:28px;padding:0 8px;box-sizing:border-box;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:inherit;font:inherit;font-size:.75rem;text-align:start;cursor:pointer}.ui-ferr-menu__item:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-menu__item:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px;background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-menu__item:disabled{opacity:.4;cursor:not-allowed}.ui-ferr-menu__item--ativo,.ui-ferr-menu__item[aria-checked=true]{color:var(--ui-cor-primaria, #00E08A);font-weight:600}.ui-ferr-menu__item--ativo:after,.ui-ferr-menu__item[aria-checked=true]:after{content:"";flex-shrink:0;width:4px;height:8px;margin-inline-start:4px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg) translateY(-1px)}.ui-ferr-menu__icone{display:inline-flex;width:16px;justify-content:center}.ui-ferr-menu__rotulo{flex:1}.ui-ferr-menu__atalho{margin-inline-start:16px;color:var(--ui-cor-texto-secundario, #888899);font-size:.6875rem;font-variant-numeric:tabular-nums}.ui-ferr-menu__sep{height:1px;margin:3px 2px;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}@media (pointer: coarse){.ui-ferr-menu__item{height:36px}}@media (prefers-reduced-motion: reduce){.ui-ferr-btn{transition:none}}.ui-ferr-tooltip{position:fixed;z-index:var(--ui-z-tooltip, 1200);pointer-events:none;display:none;align-items:center;gap:6px;padding:4px 8px;border-radius:var(--ui-raio-sm, 4px);background:var(--ui-cor-fundo-tooltip, #18181c);color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:.6875rem;line-height:1.2;white-space:nowrap;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));box-shadow:var(--ui-sombra-md, 0 4px 12px rgba(0, 0, 0, .35));opacity:0;transform:translateY(-2px);transition:opacity .12s ease,transform .12s ease}.ui-ferr-tooltip--visivel{display:inline-flex;opacity:1;transform:translateY(0)}.ui-ferr-tooltip__atalho{display:inline-flex;align-items:center;padding:1px 4px;border-radius:3px;background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto-secundario, #888899);font-family:inherit;font-size:.625rem;font-weight:600;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08))}.ui-ferr-split{display:inline-flex;align-items:stretch;border-radius:var(--ui-raio-borda, 6px);position:relative}.ui-ferr-split--grande{flex-direction:column}.ui-ferr-split--grande .ui-ferr-split__acao{border-bottom-left-radius:0;border-bottom-right-radius:0}.ui-ferr-split--grande .ui-ferr-split__gatilho{height:16px;width:100%;border-top-left-radius:0;border-top-right-radius:0;border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));padding:0;justify-content:center}.ui-ferr-split--pequeno{flex-direction:row}.ui-ferr-split--pequeno .ui-ferr-split__acao{border-top-right-radius:0;border-bottom-right-radius:0}.ui-ferr-split--pequeno .ui-ferr-split__gatilho{width:16px;height:24px;padding:0;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));justify-content:center}.ui-ferr-split:hover:not(:has(:disabled)){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .04))}.ui-ferr-menu__caret-sub{width:0;height:0;margin-inline-start:auto;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid currentColor;opacity:.7}[dir=rtl] .ui-ferr-menu__caret-sub{border-left:0;border-right:4px solid currentColor}@media (forced-colors: active){.ui-ferr-btn:focus-visible,.ui-ferr-menu__item:focus-visible{outline:2px solid Highlight}.ui-ferr-btn--ativo{background:Highlight;color:HighlightText;border-color:ButtonText;forced-color-adjust:none}.ui-ferr-btn:disabled,.ui-ferr-menu__item:disabled{opacity:1;color:GrayText}.ui-ferr-menu{border-color:CanvasText}.ui-ferr-menu__item:hover:not(:disabled){background:Highlight;color:HighlightText}}';
|
|
75
|
-
function S(n, u) {
|
|
76
|
-
if (!n) return null;
|
|
77
|
-
const t = document.createElement("ui-icone");
|
|
78
|
-
if (t.setAttribute("tamanho", String(u)), n.trimStart().startsWith("<")) {
|
|
79
|
-
const e = Z(n);
|
|
80
|
-
if (!e) return null;
|
|
81
|
-
t.appendChild(e);
|
|
82
|
-
} else
|
|
83
|
-
t.setAttribute("nome", n);
|
|
84
|
-
return t;
|
|
85
|
-
}
|
|
86
|
-
const V = /* @__PURE__ */ new Set();
|
|
87
|
-
function C(n) {
|
|
88
|
-
return n.rotuloAcessivel ? n.rotuloAcessivel : n.rotulo ? n.rotulo : n.icone && !n.icone.trimStart().startsWith("<") ? n.icone : (V.has(n.id) || (V.add(n.id), console.warn(`[ui-barra-ferramentas] O item "${n.id}" não tem "rotulo" nem "rotuloAcessivel": o id será usado como nome acessível.`)), n.id);
|
|
89
|
-
}
|
|
90
|
-
function D(n, u) {
|
|
91
|
-
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
|
|
92
|
-
n.forEach((i) => t.has(i) ? e.add(i) : t.add(i)), e.size && console.warn(`[ui-barra-ferramentas] ${u}: ids duplicados (${[...e].join(", ")}). Use ids únicos, senão atualizarItem() e os eventos podem atingir o item errado.`);
|
|
93
|
-
}
|
|
94
|
-
function N(n, u = []) {
|
|
95
|
-
for (const t of n)
|
|
96
|
-
t.tipo !== "separador" && (u.push(t.id), t.filhos && N(t.filhos, u));
|
|
97
|
-
return u;
|
|
98
|
-
}
|
|
99
|
-
function A(n, u) {
|
|
100
|
-
n.disabled = !!u.disabled;
|
|
101
|
-
const t = u.tipo, e = t === "toggle" || t === "ferramenta";
|
|
102
|
-
e ? n.setAttribute("aria-pressed", String(!!u.ativo)) : n.removeAttribute("aria-pressed"), n.classList.toggle("ui-ferr-btn--ativo", e && !!u.ativo);
|
|
103
|
-
}
|
|
104
|
-
function j(n, u, t) {
|
|
105
|
-
var o;
|
|
106
|
-
const e = document.createElement("button");
|
|
107
|
-
e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${u}`, e.dataset.id = n.id, e.tabIndex = -1;
|
|
108
|
-
const i = !!((o = n.filhos) != null && o.length), r = u !== "paleta" && !n.somenteIcone && !!n.rotulo;
|
|
109
|
-
n.rotuloAcessivel ? e.setAttribute("aria-label", n.rotuloAcessivel) : r ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", C(n)), n.atalho && e.setAttribute("aria-keyshortcuts", n.atalho), e.dataset.tooltip = C(n), n.atalho && (e.dataset.atalho = n.atalho);
|
|
110
|
-
const a = S(n.icone, t);
|
|
111
|
-
if (a) {
|
|
112
|
-
const l = document.createElement("span");
|
|
113
|
-
l.className = "ui-ferr-btn__icone", l.appendChild(a), e.appendChild(l);
|
|
114
|
-
}
|
|
115
|
-
if (u !== "paleta" && n.somenteIcone && e.classList.add("ui-ferr-btn--so-icone"), r) {
|
|
116
|
-
const l = document.createElement("span");
|
|
117
|
-
l.className = "ui-ferr-btn__rotulo", l.textContent = n.rotulo, e.appendChild(l);
|
|
118
|
-
}
|
|
119
|
-
if (i && !n.dividido) {
|
|
120
|
-
if (u === "paleta")
|
|
121
|
-
e.classList.add("ui-ferr-btn--grupo");
|
|
122
|
-
else {
|
|
123
|
-
const l = document.createElement("span");
|
|
124
|
-
l.className = "ui-ferr-btn__caret", e.appendChild(l);
|
|
125
|
-
}
|
|
126
|
-
e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false");
|
|
127
|
-
}
|
|
128
|
-
return A(e, n), e;
|
|
129
|
-
}
|
|
130
|
-
function rt(n, u, t) {
|
|
131
|
-
const e = document.createElement("div");
|
|
132
|
-
e.className = `ui-ferr-split ui-ferr-split--${u}`, e.dataset.id = n.id;
|
|
133
|
-
const i = j({ ...n, filhos: void 0, dividido: !1 }, u, t);
|
|
134
|
-
i.classList.add("ui-ferr-split__acao"), i.dataset.split = "acao";
|
|
135
|
-
const r = document.createElement("button");
|
|
136
|
-
r.type = "button", r.className = `ui-ferr-btn ui-ferr-split__gatilho ui-ferr-btn--${u}`, r.dataset.id = n.id, r.dataset.split = "gatilho", r.tabIndex = -1, r.disabled = !!n.disabled, r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), r.setAttribute("aria-label", `Opções de ${C(n)}`), r.dataset.tooltip = `Opções de ${C(n)}`;
|
|
137
|
-
const a = document.createElement("span");
|
|
138
|
-
return a.className = "ui-ferr-btn__caret", r.appendChild(a), e.appendChild(i), e.appendChild(r), e;
|
|
139
|
-
}
|
|
140
|
-
function g(n, u) {
|
|
141
|
-
for (const t of n) {
|
|
142
|
-
if (t.id === u) return t;
|
|
143
|
-
if (t.filhos) {
|
|
144
|
-
const e = g(t.filhos, u);
|
|
145
|
-
if (e) return e;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function U(n, u) {
|
|
150
|
-
if (!u || !u.trim()) return !1;
|
|
151
|
-
const t = u.split("+").map((p) => p.trim()), e = t[t.length - 1], i = t.some((p) => /^(ctrl|control|cmd|meta)$/i.test(p)), r = t.some((p) => /^alt$/i.test(p)), a = t.some((p) => /^shift$/i.test(p)), o = n.ctrlKey || n.metaKey, l = n.altKey, d = n.shiftKey;
|
|
152
|
-
if (i !== o || r !== l || a !== d) return !1;
|
|
153
|
-
const s = e.toLowerCase(), c = (n.key || "").toLowerCase();
|
|
154
|
-
return s === "esc" || s === "escape" ? c === "escape" : s === "del" || s === "delete" ? c === "delete" : s === "enter" ? c === "enter" : s === "space" || s === "espaço" ? c === " " || c === "space" : c === s;
|
|
155
|
-
}
|
|
156
|
-
function F(n) {
|
|
157
|
-
const u = n.filter((t) => !t.disabled);
|
|
158
|
-
n.forEach((t) => t.tabIndex = -1), u.length && (u[0].tabIndex = 0);
|
|
159
|
-
}
|
|
160
|
-
function W(n) {
|
|
161
|
-
const u = n.find((t) => t.tabIndex === 0 && !t.disabled);
|
|
162
|
-
u ? n.forEach((t) => {
|
|
163
|
-
t !== u && (t.tabIndex = -1);
|
|
164
|
-
}) : F(n);
|
|
165
|
-
}
|
|
166
|
-
function Y(n, u) {
|
|
167
|
-
const t = n.find((e) => e === u || e.contains(u));
|
|
168
|
-
!t || t.disabled || n.forEach((e) => e.tabIndex = e === t ? 0 : -1);
|
|
169
|
-
}
|
|
170
|
-
function R(n, u, t, e) {
|
|
171
|
-
const i = u.filter((l) => !l.disabled), r = i.length, a = i.findIndex((l) => l === n.target);
|
|
172
|
-
if (r === 0 || a < 0) return !1;
|
|
173
|
-
let o = a;
|
|
174
|
-
if (t.includes(n.key)) o = (a - 1 + r) % r;
|
|
175
|
-
else if (e.includes(n.key)) o = (a + 1) % r;
|
|
176
|
-
else if (n.key === "Home") o = 0;
|
|
177
|
-
else if (n.key === "End") o = r - 1;
|
|
178
|
-
else return !1;
|
|
179
|
-
return n.preventDefault(), u.forEach((l) => l.tabIndex = -1), i[o].tabIndex = 0, i[o].focus(), !0;
|
|
180
|
-
}
|
|
181
|
-
function at(n, u, t = !1) {
|
|
182
|
-
const e = u.filter((l) => !l.disabled), i = e.length, r = e.findIndex((l) => l === n.target);
|
|
183
|
-
if (i === 0 || r < 0) return !1;
|
|
184
|
-
let a = r;
|
|
185
|
-
const o = r % 2;
|
|
186
|
-
if (n.key === "ArrowRight")
|
|
187
|
-
t ? o === 1 && (a = r - 1) : o === 0 && r + 1 < i && (a = r + 1);
|
|
188
|
-
else if (n.key === "ArrowLeft")
|
|
189
|
-
t ? o === 0 && r + 1 < i && (a = r + 1) : o === 1 && (a = r - 1);
|
|
190
|
-
else if (n.key === "ArrowDown")
|
|
191
|
-
r + 2 < i ? a = r + 2 : r + 1 < i && o === 0 && (a = r + 1);
|
|
192
|
-
else if (n.key === "ArrowUp")
|
|
193
|
-
r - 2 >= 0 ? a = r - 2 : r - 1 >= 0 && o === 1 && (a = r - 1);
|
|
194
|
-
else if (n.key === "Home")
|
|
195
|
-
a = 0;
|
|
196
|
-
else if (n.key === "End")
|
|
197
|
-
a = i - 1;
|
|
198
|
-
else
|
|
199
|
-
return !1;
|
|
200
|
-
return n.preventDefault(), u.forEach((l) => l.tabIndex = -1), e[a].tabIndex = 0, e[a].focus(), !0;
|
|
201
|
-
}
|
|
202
|
-
let ot = 0;
|
|
203
|
-
class X {
|
|
204
|
-
constructor(u, t) {
|
|
205
|
-
h(this, "el");
|
|
206
|
-
h(this, "textoEl");
|
|
207
|
-
h(this, "atalhoEl");
|
|
208
|
-
h(this, "timer");
|
|
209
|
-
h(this, "alvoAtual", null);
|
|
210
|
-
h(this, "id", `ui-ferr-tooltip-${++ot}`);
|
|
211
|
-
h(this, "listeners", new M());
|
|
212
|
-
this.raiz = u, this.el = document.createElement("div"), this.el.className = "ui-ferr-tooltip", this.el.id = this.id, this.el.setAttribute("role", "tooltip"), this.el.setAttribute("aria-hidden", "true"), this.textoEl = document.createElement("span"), this.textoEl.className = "ui-ferr-tooltip__texto", this.atalhoEl = document.createElement("kbd"), this.atalhoEl.className = "ui-ferr-tooltip__atalho", this.el.appendChild(this.textoEl), this.el.appendChild(this.atalhoEl), this.raiz.appendChild(this.el), this.listeners.add(t, "pointerover", (e) => {
|
|
213
|
-
const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
|
|
214
|
-
if (i && i !== this.alvoAtual) {
|
|
215
|
-
const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", a = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
|
|
216
|
-
r && this.agendar(i, r, a);
|
|
217
|
-
}
|
|
218
|
-
}), this.listeners.add(t, "pointerout", (e) => {
|
|
219
|
-
const r = e.relatedTarget;
|
|
220
|
-
this.alvoAtual && (!r || !this.alvoAtual.contains(r)) && this.esconder();
|
|
221
|
-
}), this.listeners.add(t, "focusin", (e) => {
|
|
222
|
-
const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
|
|
223
|
-
if (i) {
|
|
224
|
-
const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", a = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
|
|
225
|
-
r && this.mostrar(i, r, a);
|
|
226
|
-
}
|
|
227
|
-
}), this.listeners.add(t, "focusout", () => this.esconder()), this.listeners.add(t, "pointerdown", () => this.esconder()), this.listeners.add(t, "click", () => this.esconder()), this.listeners.add(window, "scroll", () => this.esconder(), !0), this.listeners.add(window, "resize", () => this.esconder());
|
|
228
|
-
}
|
|
229
|
-
agendar(u, t, e) {
|
|
230
|
-
this.limparTimer(), this.timer = window.setTimeout(() => this.mostrar(u, t, e), 140);
|
|
231
|
-
}
|
|
232
|
-
mostrar(u, t, e) {
|
|
233
|
-
if (this.limparTimer(), !u.isConnected || !t) return;
|
|
234
|
-
this.alvoAtual = u, this.textoEl.textContent = t, e ? (this.atalhoEl.textContent = `(${e})`, this.atalhoEl.style.display = "") : (this.atalhoEl.textContent = "", this.atalhoEl.style.display = "none"), this.el.classList.add("ui-ferr-tooltip--visivel"), this.el.setAttribute("aria-hidden", "false"), u.setAttribute("aria-describedby", this.id);
|
|
235
|
-
const i = u.getBoundingClientRect(), r = this.el.getBoundingClientRect();
|
|
236
|
-
let a = i.bottom + 6, o = i.left + (i.width - (r.width || 80)) / 2;
|
|
237
|
-
a + (r.height || 24) > window.innerHeight - 6 && (a = Math.max(6, i.top - (r.height || 24) - 6)), o < 6 ? o = 6 : o + (r.width || 80) > window.innerWidth - 6 && (o = Math.max(6, window.innerWidth - (r.width || 80) - 6)), this.el.style.top = `${a}px`, this.el.style.left = `${o}px`;
|
|
238
|
-
}
|
|
239
|
-
esconder() {
|
|
240
|
-
this.limparTimer(), this.alvoAtual && (this.alvoAtual.removeAttribute("aria-describedby"), this.alvoAtual = null), this.el.classList.remove("ui-ferr-tooltip--visivel"), this.el.setAttribute("aria-hidden", "true");
|
|
241
|
-
}
|
|
242
|
-
limparTimer() {
|
|
243
|
-
this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0);
|
|
244
|
-
}
|
|
245
|
-
destruir() {
|
|
246
|
-
this.esconder(), this.listeners.cleanup(), this.el.remove();
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
let st = 0;
|
|
250
|
-
function z(n, u, t, e, i = {}) {
|
|
251
|
-
var H;
|
|
252
|
-
const r = i.lado ?? "baixo", a = new M(), o = document.createElement("div");
|
|
253
|
-
o.className = "ui-ferr-menu", o.setAttribute("role", "menu"), o.id = `ui-ferr-menu-${++st}`, o.setAttribute("aria-label", u.getAttribute("aria-label") || "Menu"), u.setAttribute("aria-controls", o.id);
|
|
254
|
-
const l = [];
|
|
255
|
-
let d = !1, s = null;
|
|
256
|
-
const c = () => {
|
|
257
|
-
s && (s.fechar(), s = null);
|
|
258
|
-
}, p = () => {
|
|
259
|
-
var b;
|
|
260
|
-
d || (d = !0, c(), u.removeAttribute("aria-controls"), a.cleanup(), o.remove(), (b = i.onFechar) == null || b.call(i));
|
|
261
|
-
}, m = getComputedStyle(u).direction === "rtl";
|
|
262
|
-
t.forEach((b) => {
|
|
263
|
-
var B;
|
|
264
|
-
if (b.tipo === "separador") {
|
|
265
|
-
const x = document.createElement("div");
|
|
266
|
-
x.className = "ui-ferr-menu__sep", x.setAttribute("role", "separator"), o.appendChild(x);
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
const f = document.createElement("button");
|
|
270
|
-
f.type = "button", f.className = "ui-ferr-menu__item";
|
|
271
|
-
const E = b.tipo ?? i.tipoPadrao ?? "botao";
|
|
272
|
-
E === "toggle" ? (f.setAttribute("role", "menuitemcheckbox"), f.setAttribute("aria-checked", String(!!b.ativo))) : E === "ferramenta" ? (f.setAttribute("role", "menuitemradio"), f.setAttribute("aria-checked", String(!!b.ativo))) : f.setAttribute("role", "menuitem"), f.dataset.id = b.id, f.disabled = !!b.disabled, b.atalho && f.setAttribute("aria-keyshortcuts", b.atalho), b.ativo && f.classList.add("ui-ferr-menu__item--ativo");
|
|
273
|
-
const k = document.createElement("span");
|
|
274
|
-
k.className = "ui-ferr-menu__icone";
|
|
275
|
-
const P = S(b.icone, 14);
|
|
276
|
-
P && k.appendChild(P), f.appendChild(k);
|
|
277
|
-
const v = document.createElement("span");
|
|
278
|
-
if (v.className = "ui-ferr-menu__rotulo", v.textContent = C(b), f.appendChild(v), b.atalho) {
|
|
279
|
-
const x = document.createElement("span");
|
|
280
|
-
x.className = "ui-ferr-menu__atalho", x.textContent = b.atalho, f.appendChild(x);
|
|
281
|
-
}
|
|
282
|
-
if (!!((B = b.filhos) != null && B.length)) {
|
|
283
|
-
f.classList.add("ui-ferr-menu__item--has-sub"), f.setAttribute("aria-haspopup", "menu"), f.setAttribute("aria-expanded", "false");
|
|
284
|
-
const x = document.createElement("span");
|
|
285
|
-
x.className = "ui-ferr-menu__caret-sub", f.appendChild(x);
|
|
286
|
-
const O = (T) => {
|
|
287
|
-
(s == null ? void 0 : s.ancora) !== f && (c(), f.setAttribute("aria-expanded", "true"), s = z(n, f, b.filhos, e, {
|
|
288
|
-
lado: m ? "esquerda" : "direita",
|
|
289
|
-
focar: T,
|
|
290
|
-
tipoPadrao: i.tipoPadrao,
|
|
291
|
-
onFechar: () => {
|
|
292
|
-
f.setAttribute("aria-expanded", "false"), s = null;
|
|
293
|
-
}
|
|
294
|
-
}));
|
|
295
|
-
};
|
|
296
|
-
f.addEventListener("pointerenter", () => O(!1)), f.addEventListener("click", (T) => {
|
|
297
|
-
T.stopPropagation(), O(!0);
|
|
298
|
-
});
|
|
299
|
-
} else
|
|
300
|
-
f.addEventListener("pointerenter", c), f.addEventListener("click", (x) => {
|
|
301
|
-
x.stopPropagation(), p(), u.focus(), e(b);
|
|
302
|
-
});
|
|
303
|
-
l.push(f), o.appendChild(f);
|
|
304
|
-
}), n.appendChild(o);
|
|
305
|
-
const _ = u.getBoundingClientRect(), y = o.getBoundingClientRect();
|
|
306
|
-
let L = r === "baixo" ? _.bottom + 2 : _.top, w = r === "direita" ? _.right + 4 : r === "esquerda" ? _.left - y.width - 4 : m ? _.right - y.width : _.left;
|
|
307
|
-
y.width && w + y.width > window.innerWidth - 4 && (w = Math.max(4, window.innerWidth - y.width - 4)), w < 4 && (w = 4), y.height && L + y.height > window.innerHeight - 4 && (L = Math.max(4, window.innerHeight - y.height - 4)), o.style.top = `${L}px`, o.style.left = `${w}px`;
|
|
308
|
-
const I = () => l.filter((b) => !b.disabled);
|
|
309
|
-
return a.add(o, "keydown", (b) => {
|
|
310
|
-
const f = I(), E = f.findIndex((v) => v === b.target), k = m ? "ArrowLeft" : "ArrowRight", P = m ? "ArrowRight" : "ArrowLeft";
|
|
311
|
-
if (b.key === "Escape")
|
|
312
|
-
b.preventDefault(), b.stopPropagation(), p(), u.focus();
|
|
313
|
-
else if (b.key === "Tab")
|
|
314
|
-
p();
|
|
315
|
-
else if (f.length && (b.key === "ArrowDown" || b.key === "ArrowUp")) {
|
|
316
|
-
b.preventDefault(), c();
|
|
317
|
-
const v = b.key === "ArrowDown" ? 1 : -1;
|
|
318
|
-
f[(E + v + f.length) % f.length].focus();
|
|
319
|
-
} else if (f.length && b.key === k) {
|
|
320
|
-
const v = f[E];
|
|
321
|
-
v != null && v.classList.contains("ui-ferr-menu__item--has-sub") && (b.preventDefault(), v.click());
|
|
322
|
-
} else b.key === P && (r === "direita" || r === "esquerda") ? (b.preventDefault(), b.stopPropagation(), p(), u.focus()) : f.length && b.key === "Home" ? (b.preventDefault(), f[0].focus()) : f.length && b.key === "End" && (b.preventDefault(), f[f.length - 1].focus());
|
|
323
|
-
}), a.add(document, "pointerdown", (b) => {
|
|
324
|
-
const f = b.composedPath();
|
|
325
|
-
!f.includes(o) && !f.includes(u) && !(s != null && s.elemento.contains(b.target)) && p();
|
|
326
|
-
}, !0), a.add(window, "resize", p), a.add(window, "scroll", (b) => {
|
|
327
|
-
b.target instanceof Node && o.contains(b.target) || p();
|
|
328
|
-
}, !0), i.focar && ((H = I()[0]) == null || H.focus()), { elemento: o, ancora: u, fechar: p, focarPrimeiro: () => {
|
|
329
|
-
var b;
|
|
330
|
-
return (b = I()[0]) == null ? void 0 : b.focus();
|
|
331
|
-
} };
|
|
332
|
-
}
|
|
333
|
-
let nt = 0;
|
|
334
|
-
class lt extends q {
|
|
335
|
-
constructor() {
|
|
336
|
-
super();
|
|
337
|
-
h(this, "rootElement");
|
|
338
|
-
h(this, "abasElement");
|
|
339
|
-
h(this, "gruposElement");
|
|
340
|
-
h(this, "painelElement");
|
|
341
|
-
h(this, "fixarElement");
|
|
342
|
-
h(this, "uid", `ui-ribbon-${++nt}`);
|
|
343
|
-
h(this, "_abaPendente", "");
|
|
344
|
-
h(this, "_pronto", !1);
|
|
345
|
-
h(this, "_modoControlado", !1);
|
|
346
|
-
h(this, "_abas", []);
|
|
347
|
-
h(this, "_abaAtiva", "");
|
|
348
|
-
h(this, "menu", null);
|
|
349
|
-
h(this, "listeners", new M());
|
|
350
|
-
h(this, "tooltip", null);
|
|
351
|
-
h(this, "observerResize", null);
|
|
352
|
-
h(this, "gruposColapsados", /* @__PURE__ */ new Set());
|
|
353
|
-
h(this, "keytipsAtivas", !1);
|
|
354
|
-
h(this, "handleFocusInGrupos", (t) => Y(this.botoesPainel(), t.target));
|
|
355
|
-
/* ---------- Interação ---------- */
|
|
356
|
-
h(this, "handleClickAbas", (t) => {
|
|
357
|
-
const e = t.target.closest(".ui-ribbon__aba");
|
|
358
|
-
e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
|
|
359
|
-
});
|
|
360
|
-
h(this, "handleClickFixar", () => {
|
|
361
|
-
this.recolhido = !this.recolhido;
|
|
362
|
-
});
|
|
363
|
-
h(this, "handleDblClickAbas", (t) => {
|
|
364
|
-
t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
|
|
365
|
-
});
|
|
366
|
-
h(this, "handleKeyDownAbas", (t) => {
|
|
367
|
-
var d, s;
|
|
368
|
-
const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = e.findIndex((c) => c === t.target);
|
|
369
|
-
if (i < 0) return;
|
|
370
|
-
if (this.ativacaoManual && (t.key === "Enter" || t.key === " ")) {
|
|
371
|
-
t.preventDefault();
|
|
372
|
-
const c = e[i].dataset.id;
|
|
373
|
-
c && this.selecionarAba(c);
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
let r = i;
|
|
377
|
-
const [a, o] = this.rtl ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
|
|
378
|
-
if (t.key === a) r = (i + 1) % e.length;
|
|
379
|
-
else if (t.key === o) r = (i - 1 + e.length) % e.length;
|
|
380
|
-
else if (t.key === "Home") r = 0;
|
|
381
|
-
else if (t.key === "End") r = e.length - 1;
|
|
382
|
-
else if (t.key === "ArrowDown") {
|
|
383
|
-
t.preventDefault(), this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (d = this.botoesPainel().find((c) => !c.disabled)) == null || d.focus();
|
|
384
|
-
return;
|
|
385
|
-
} else return;
|
|
386
|
-
t.preventDefault();
|
|
387
|
-
const l = e[r].dataset.id;
|
|
388
|
-
this.ativacaoManual ? (e.forEach((c) => c.tabIndex = -1), e[r].tabIndex = 0, e[r].focus()) : (l && this.selecionarAba(l), (s = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(l ?? "")}"]`)) == null || s.focus());
|
|
389
|
-
});
|
|
390
|
-
h(this, "handleClickGrupos", (t) => {
|
|
391
|
-
var a;
|
|
392
|
-
const e = t.target, i = e.closest(".ui-ferr-split__gatilho");
|
|
393
|
-
if (i) {
|
|
394
|
-
const o = i.closest(".ui-ferr-split"), l = o == null ? void 0 : o.dataset.id, d = this._abas.find((c) => c.id === this._abaAtiva), s = d && g(d.grupos.flatMap((c) => c.itens), l ?? "");
|
|
395
|
-
s && ((a = s.filhos) != null && a.length) && this.alternarMenu(i, s, !1);
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
const r = e.closest(".ui-ferr-btn");
|
|
399
|
-
r != null && r.dataset.id && this.acionar(r, t.detail === 0);
|
|
400
|
-
});
|
|
401
|
-
h(this, "handleKeyDownGrupos", (t) => {
|
|
402
|
-
var r;
|
|
403
|
-
const e = this.botoesPainel();
|
|
404
|
-
if (this.rtl ? R(t, e, ["ArrowRight"], ["ArrowLeft"]) : R(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
|
|
405
|
-
const i = t.target instanceof HTMLButtonElement ? t.target : null;
|
|
406
|
-
(i == null ? void 0 : i.getAttribute("aria-haspopup")) === "menu" && t.key === "ArrowDown" && (t.preventDefault(), ((r = this.menu) == null ? void 0 : r.ancora) === i ? this.menu.focarPrimeiro() : this.acionar(i, !0));
|
|
407
|
-
});
|
|
408
|
-
h(this, "handleEscape", (t) => {
|
|
409
|
-
t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
410
|
-
});
|
|
411
|
-
h(this, "handlePointerDownFora", (t) => {
|
|
412
|
-
!this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
413
|
-
});
|
|
414
|
-
h(this, "handleAtalho", (t) => {
|
|
415
|
-
if (!this.hasAttribute("atalhos") && !this.hasAttribute("keytips") || t.defaultPrevented) return;
|
|
416
|
-
const e = t.composedPath(), i = e[0];
|
|
417
|
-
if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((s) => {
|
|
418
|
-
var p, m;
|
|
419
|
-
const c = (p = s.getAttribute) == null ? void 0 : p.call(s, "role");
|
|
420
|
-
return ((m = s.getAttribute) == null ? void 0 : m.call(s, "aria-modal")) === "true" || c === "textbox" || c === "searchbox" || c === "combobox" || c === "spinbutton";
|
|
421
|
-
})) return;
|
|
422
|
-
if (this.hasAttribute("keytips") && (t.key === "Alt" || t.key === "F10") && !t.ctrlKey && !t.shiftKey && !t.metaKey) {
|
|
423
|
-
t.preventDefault(), this.alternarKeyTips();
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
if (!this.hasAttribute("atalhos")) return;
|
|
427
|
-
const a = this._abas.find((s) => s.id === this._abaAtiva);
|
|
428
|
-
if (!a) return;
|
|
429
|
-
const l = a.grupos.flatMap((s) => s.itens).find((s) => !s.disabled && U(t, s.atalho));
|
|
430
|
-
if (!l) return;
|
|
431
|
-
t.preventDefault();
|
|
432
|
-
const d = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(l.id)}"]`);
|
|
433
|
-
d ? this.acionar(d, !1) : this.emitir(l);
|
|
434
|
-
});
|
|
435
|
-
const t = this.attachShadow({ mode: "open" });
|
|
436
|
-
t.innerHTML = `
|
|
437
|
-
<style>${K}${it}</style>
|
|
438
|
-
<div class="ui-ribbon">
|
|
439
|
-
<div class="ui-ribbon__cabecalho">
|
|
440
|
-
<div class="ui-ribbon__abas" role="tablist"></div>
|
|
441
|
-
<button type="button" class="ui-ribbon__fixar"></button>
|
|
442
|
-
</div>
|
|
443
|
-
<div class="ui-ribbon__painel" role="tabpanel">
|
|
444
|
-
<div class="ui-ribbon__grupos" role="toolbar" aria-label="Ferramentas"></div>
|
|
445
|
-
</div>
|
|
446
|
-
</div>
|
|
447
|
-
`, this.rootElement = t.querySelector(".ui-ribbon"), this.abasElement = t.querySelector(".ui-ribbon__abas"), this.gruposElement = t.querySelector(".ui-ribbon__grupos"), this.painelElement = t.querySelector(".ui-ribbon__painel"), this.fixarElement = t.querySelector(".ui-ribbon__fixar"), this.painelElement.id = `${this.uid}-painel`;
|
|
448
|
-
}
|
|
449
|
-
static get observedAttributes() {
|
|
450
|
-
return [
|
|
451
|
-
"aba-ativa",
|
|
452
|
-
"recolhido",
|
|
453
|
-
"compacto",
|
|
454
|
-
"ativacao-manual",
|
|
455
|
-
"copiar-dados",
|
|
456
|
-
"modo-controlado",
|
|
457
|
-
"atalhos",
|
|
458
|
-
"keytips",
|
|
459
|
-
"aria-label",
|
|
460
|
-
"rotulo-abas",
|
|
461
|
-
"rotulo-fixar",
|
|
462
|
-
"rotulo-expandir"
|
|
463
|
-
];
|
|
464
|
-
}
|
|
465
|
-
connectedCallback() {
|
|
466
|
-
var e;
|
|
467
|
-
this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new X(this.shadowRoot, this.rootElement), this.listeners.add(this.abasElement, "click", this.handleClickAbas), this.listeners.add(this.fixarElement, "click", this.handleClickFixar), this.listeners.add(this.abasElement, "dblclick", this.handleDblClickAbas), this.listeners.add(this.abasElement, "keydown", this.handleKeyDownAbas), this.listeners.add(this.gruposElement, "click", this.handleClickGrupos), this.listeners.add(this.gruposElement, "keydown", this.handleKeyDownGrupos), this.listeners.add(document, "pointerdown", this.handlePointerDownFora, !0), this.listeners.add(this.rootElement, "keydown", this.handleEscape), this.listeners.add(this.gruposElement, "focusin", this.handleFocusInGrupos), this.listeners.add(document, "keydown", this.handleAtalho), this.iniciarResizeObserver();
|
|
468
|
-
const t = this.getAttribute("aba-ativa");
|
|
469
|
-
t && !this._abaAtiva && (this._abaPendente = t), this.aplicarRotulos(), this.renderizar(), this._pronto = !0;
|
|
470
|
-
}
|
|
471
|
-
disconnectedCallback() {
|
|
472
|
-
var t, e;
|
|
473
|
-
this._pronto = !1, this.fecharMenu(), (t = this.observerResize) == null || t.disconnect(), this.observerResize = null, (e = this.tooltip) == null || e.destruir(), this.tooltip = null, this.listeners.cleanup();
|
|
474
|
-
}
|
|
475
|
-
attributeChangedCallback(t, e, i) {
|
|
476
|
-
if (e !== i)
|
|
477
|
-
if (t === "aba-ativa") {
|
|
478
|
-
if (!i || i === this._abaAtiva) return;
|
|
479
|
-
this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
|
|
480
|
-
} else t === "recolhido" ? (this.rootElement.classList.remove("ui-ribbon--aberto"), this.aplicarRotulos(), this._pronto && e === null != (i === null) && this.dispatchEvent(
|
|
481
|
-
new CustomEvent("ui-recolhido-change", {
|
|
482
|
-
detail: { recolhido: i !== null },
|
|
483
|
-
bubbles: !0,
|
|
484
|
-
composed: !0
|
|
485
|
-
})
|
|
486
|
-
)) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
|
|
487
|
-
}
|
|
488
|
-
aplicarRotulos() {
|
|
489
|
-
this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
|
|
490
|
-
const t = this.hasAttribute("recolhido"), e = t ? this.getAttribute("rotulo-expandir") || "Fixar faixa de opções" : this.getAttribute("rotulo-fixar") || "Recolher faixa de opções";
|
|
491
|
-
this.fixarElement.setAttribute("aria-label", e), this.fixarElement.title = e, this.fixarElement.setAttribute("aria-expanded", String(!t)), this.fixarElement.setAttribute("aria-controls", this.painelElement.id);
|
|
492
|
-
}
|
|
493
|
-
/* ---------- API pública ---------- */
|
|
494
|
-
get modoControlado() {
|
|
495
|
-
return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
|
|
496
|
-
}
|
|
497
|
-
set modoControlado(t) {
|
|
498
|
-
this._modoControlado = !!t;
|
|
499
|
-
}
|
|
500
|
-
get copiarDados() {
|
|
501
|
-
return this.modoControlado;
|
|
502
|
-
}
|
|
503
|
-
set copiarDados(t) {
|
|
504
|
-
this.modoControlado = t;
|
|
505
|
-
}
|
|
506
|
-
get ativacaoManual() {
|
|
507
|
-
return this.hasAttribute("ativacao-manual");
|
|
508
|
-
}
|
|
509
|
-
set ativacaoManual(t) {
|
|
510
|
-
t ? this.setAttribute("ativacao-manual", "") : this.removeAttribute("ativacao-manual");
|
|
511
|
-
}
|
|
512
|
-
get abas() {
|
|
513
|
-
return this._abas;
|
|
514
|
-
}
|
|
515
|
-
set abas(t) {
|
|
516
|
-
const e = Array.isArray(t) ? t : [];
|
|
517
|
-
this._abas = this.modoControlado ? e.map((i) => ({
|
|
518
|
-
...i,
|
|
519
|
-
grupos: i.grupos.map((r) => ({
|
|
520
|
-
...r,
|
|
521
|
-
itens: r.itens.map((a) => {
|
|
522
|
-
var o;
|
|
523
|
-
return {
|
|
524
|
-
...a,
|
|
525
|
-
filhos: (o = a.filhos) == null ? void 0 : o.map((l) => ({ ...l }))
|
|
526
|
-
};
|
|
527
|
-
})
|
|
528
|
-
}))
|
|
529
|
-
})) : e, D(this._abas.map((i) => i.id), "<ui-ribbon> abas"), D(
|
|
530
|
-
this._abas.flatMap((i) => i.grupos.flatMap((r) => N(r.itens))),
|
|
531
|
-
"<ui-ribbon> itens"
|
|
532
|
-
), this.gruposColapsados.clear(), this.renderizar();
|
|
533
|
-
}
|
|
534
|
-
get abaAtiva() {
|
|
535
|
-
return this._abaAtiva;
|
|
536
|
-
}
|
|
537
|
-
set abaAtiva(t) {
|
|
538
|
-
this.selecionarAba(t);
|
|
539
|
-
}
|
|
540
|
-
get recolhido() {
|
|
541
|
-
return this.hasAttribute("recolhido");
|
|
542
|
-
}
|
|
543
|
-
set recolhido(t) {
|
|
544
|
-
t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
|
|
545
|
-
}
|
|
546
|
-
get compacto() {
|
|
547
|
-
return this.hasAttribute("compacto");
|
|
548
|
-
}
|
|
549
|
-
set compacto(t) {
|
|
550
|
-
t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
|
|
551
|
-
}
|
|
552
|
-
selecionarAba(t, e = !0) {
|
|
553
|
-
const i = this._abas.find((r) => r.id === t && !r.oculta);
|
|
554
|
-
if (!i) {
|
|
555
|
-
t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
i.id !== this._abaAtiva && (this._abaPendente = "", this.fecharMenu(), this.gruposColapsados.clear(), this._abaAtiva = i.id, this.getAttribute("aba-ativa") !== i.id && this.setAttribute("aba-ativa", i.id), this.renderizar(), e && this.dispatchEvent(
|
|
559
|
-
new CustomEvent("ui-aba-change", {
|
|
560
|
-
detail: { id: i.id, aba: i },
|
|
561
|
-
bubbles: !0,
|
|
562
|
-
composed: !0
|
|
563
|
-
})
|
|
564
|
-
));
|
|
565
|
-
}
|
|
566
|
-
definirAbaVisivel(t, e) {
|
|
567
|
-
const i = this._abas.find((o) => o.id === t);
|
|
568
|
-
if (!i) return;
|
|
569
|
-
const r = this._abaAtiva;
|
|
570
|
-
i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
|
|
571
|
-
const a = this._abas.find((o) => o.id === this._abaAtiva);
|
|
572
|
-
!e && r === t && a && this.dispatchEvent(
|
|
573
|
-
new CustomEvent("ui-aba-change", { detail: { id: a.id, aba: a }, bubbles: !0, composed: !0 })
|
|
574
|
-
);
|
|
575
|
-
}
|
|
576
|
-
/** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
|
|
577
|
-
atualizarItem(t, e) {
|
|
578
|
-
const i = this._abas.flatMap((d) => d.grupos.flatMap((s) => s.itens)), r = g(i, t);
|
|
579
|
-
if (!r) {
|
|
580
|
-
console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
Object.assign(r, e);
|
|
584
|
-
const a = this._abas.find((d) => d.id === this._abaAtiva);
|
|
585
|
-
if (!a || !g(a.grupos.flatMap((d) => d.itens), t)) return;
|
|
586
|
-
const o = Object.keys(e).every((d) => d === "ativo" || d === "disabled"), l = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
|
|
587
|
-
o ? l && (A(l, this.efetivo(r)), W(this.botoesPainel())) : this.comFoco(() => this.renderizarPainel());
|
|
588
|
-
}
|
|
589
|
-
efetivo(t) {
|
|
590
|
-
var e;
|
|
591
|
-
return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
|
|
592
|
-
}
|
|
593
|
-
/* ---------- Foco preservado em re-renderizações ---------- */
|
|
594
|
-
capturarFoco() {
|
|
595
|
-
var e, i;
|
|
596
|
-
const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
|
|
597
|
-
return (i = t == null ? void 0 : t.dataset) != null && i.id ? t.classList.contains("ui-ribbon__aba") ? { seletor: ".ui-ribbon__aba", id: t.dataset.id } : t.classList.contains("ui-ferr-btn") ? { seletor: ".ui-ferr-btn", id: t.dataset.id } : null : null;
|
|
598
|
-
}
|
|
599
|
-
comFoco(t) {
|
|
600
|
-
const e = this.capturarFoco();
|
|
601
|
-
if (t(), !e) return;
|
|
602
|
-
const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
|
|
603
|
-
i && !i.disabled && i.focus();
|
|
604
|
-
}
|
|
605
|
-
/* ---------- Renderização ---------- */
|
|
606
|
-
abasVisiveis() {
|
|
607
|
-
return this._abas.filter((t) => !t.oculta);
|
|
608
|
-
}
|
|
609
|
-
renderizar() {
|
|
610
|
-
var e;
|
|
611
|
-
const t = this.abasVisiveis();
|
|
612
|
-
this._abaPendente && t.length && (t.some((i) => i.id === this._abaPendente) ? (this._abaAtiva = this._abaPendente, this._abaPendente = "") : this._abas.some((i) => i.id === this._abaPendente) || (console.warn(`[ui-ribbon] aba-ativa="${this._abaPendente}" não existe em "abas".`), this._abaPendente = "")), t.some((i) => i.id === this._abaAtiva) || (this._abaAtiva = ((e = t[0]) == null ? void 0 : e.id) ?? ""), this._abaAtiva && !this._abaPendente && this.getAttribute("aba-ativa") !== this._abaAtiva && this.setAttribute("aba-ativa", this._abaAtiva), this.comFoco(() => {
|
|
613
|
-
this.renderizarAbas(), this.renderizarPainel();
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
renderizarAbas() {
|
|
617
|
-
this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
|
|
618
|
-
const e = t.id === this._abaAtiva, i = document.createElement("button");
|
|
619
|
-
i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = t.id, i.id = this.idAba(t.id), e && i.setAttribute("aria-controls", this.painelElement.id), i.textContent = t.rotulo, i.tabIndex = e ? 0 : -1, i.setAttribute("aria-selected", String(e)), i.classList.toggle("ui-ribbon__aba--ativa", e), i.classList.toggle("ui-ribbon__aba--contextual", !!t.contextual), this.abasElement.appendChild(i);
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
idAba(t) {
|
|
623
|
-
return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
|
|
624
|
-
}
|
|
625
|
-
renderizarPainel() {
|
|
626
|
-
this.fecharMenu(), this.gruposElement.innerHTML = "";
|
|
627
|
-
const t = this._abas.find((e) => e.id === this._abaAtiva);
|
|
628
|
-
if (!t) {
|
|
629
|
-
this.painelElement.removeAttribute("aria-labelledby");
|
|
630
|
-
return;
|
|
631
|
-
}
|
|
632
|
-
this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(this.criarGrupo(e))), F(this.botoesPainel());
|
|
633
|
-
}
|
|
634
|
-
iniciarResizeObserver() {
|
|
635
|
-
typeof ResizeObserver > "u" || (this.observerResize = new ResizeObserver(() => {
|
|
636
|
-
this.ajustarColapsoGrupos();
|
|
637
|
-
}), this.observerResize.observe(this.painelElement));
|
|
638
|
-
}
|
|
639
|
-
ajustarColapsoGrupos() {
|
|
640
|
-
const t = this._abas.find((i) => i.id === this._abaAtiva);
|
|
641
|
-
if (!t || !t.grupos.length) return;
|
|
642
|
-
const e = this.gruposElement;
|
|
643
|
-
if (e.scrollWidth > e.clientWidth) {
|
|
644
|
-
const i = [...t.grupos].filter((r) => !this.gruposColapsados.has(r.id)).sort((r, a) => (r.prioridade ?? 0) - (a.prioridade ?? 0));
|
|
645
|
-
i.length > 0 && (this.gruposColapsados.add(i[0].id), this.renderizarPainel());
|
|
646
|
-
} else if (this.gruposColapsados.size > 0) {
|
|
647
|
-
const i = [...t.grupos].filter((r) => this.gruposColapsados.has(r.id)).sort((r, a) => (a.prioridade ?? 0) - (r.prioridade ?? 0));
|
|
648
|
-
i.length > 0 && (this.gruposColapsados.delete(i[0].id), this.renderizarPainel(), e.scrollWidth > e.clientWidth && (this.gruposColapsados.add(i[0].id), this.renderizarPainel()));
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
alternarMenuGrupoColapsado(t, e) {
|
|
652
|
-
var r;
|
|
653
|
-
const i = ((r = this.menu) == null ? void 0 : r.ancora) === t;
|
|
654
|
-
this.fecharMenu(), !i && (t.setAttribute("aria-expanded", "true"), this.menu = z(
|
|
655
|
-
this.shadowRoot,
|
|
656
|
-
t,
|
|
657
|
-
e.itens,
|
|
658
|
-
(a) => {
|
|
659
|
-
const o = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(a.id)}"]`);
|
|
660
|
-
if (o) this.acionar(o, !1);
|
|
661
|
-
else {
|
|
662
|
-
const l = a.ativo;
|
|
663
|
-
a.tipo === "toggle" ? a.ativo = !l : a.tipo === "ferramenta" && (a.ativo = !0), this.emitir(a) || (a.ativo = l);
|
|
664
|
-
}
|
|
665
|
-
this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
lado: "baixo",
|
|
669
|
-
onFechar: () => {
|
|
670
|
-
t.setAttribute("aria-expanded", "false"), this.menu = null;
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
));
|
|
674
|
-
}
|
|
675
|
-
criarGrupo(t) {
|
|
676
|
-
const e = document.createElement("div");
|
|
677
|
-
if (e.className = "ui-ribbon__grupo", e.setAttribute("role", "group"), e.setAttribute("aria-label", t.rotulo), e.dataset.id = t.id, this.gruposColapsados.has(t.id)) {
|
|
678
|
-
e.classList.add("ui-ribbon__grupo--colapsado");
|
|
679
|
-
const d = document.createElement("button");
|
|
680
|
-
d.type = "button", d.className = "ui-ferr-btn ui-ferr-btn--grande ui-ribbon__btn-colapsado", d.dataset.id = t.id, d.dataset.tooltip = t.rotulo, d.setAttribute("aria-haspopup", "menu"), d.setAttribute("aria-expanded", "false");
|
|
681
|
-
const s = S(t.icone, 24) || S('<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16" stroke="currentColor" stroke-width="2" fill="none"/></svg>', 24);
|
|
682
|
-
if (s) {
|
|
683
|
-
const m = document.createElement("span");
|
|
684
|
-
m.className = "ui-ferr-btn__icone", m.appendChild(s), d.appendChild(m);
|
|
685
|
-
}
|
|
686
|
-
const c = document.createElement("span");
|
|
687
|
-
c.className = "ui-ferr-btn__rotulo", c.textContent = t.rotulo, d.appendChild(c);
|
|
688
|
-
const p = document.createElement("span");
|
|
689
|
-
return p.className = "ui-ferr-btn__caret", d.appendChild(p), d.addEventListener("click", (m) => {
|
|
690
|
-
m.stopPropagation(), this.alternarMenuGrupoColapsado(d, t);
|
|
691
|
-
}), e.appendChild(d), e;
|
|
692
|
-
}
|
|
693
|
-
const i = document.createElement("div");
|
|
694
|
-
i.className = "ui-ribbon__grupo-itens";
|
|
695
|
-
let r = null, a = 0;
|
|
696
|
-
const o = () => {
|
|
697
|
-
r && i.appendChild(r), r = null, a = 0;
|
|
698
|
-
}, l = (d, s, c) => {
|
|
699
|
-
var p;
|
|
700
|
-
return d.dividido && ((p = d.filhos) != null && p.length) ? rt(this.efetivo(d), s, c) : this.criarBotao(d, s, c);
|
|
701
|
-
};
|
|
702
|
-
if (t.itens.forEach((d) => {
|
|
703
|
-
if (d.tipo === "separador") {
|
|
704
|
-
o();
|
|
705
|
-
const s = document.createElement("div");
|
|
706
|
-
s.className = "ui-ribbon__separador", s.setAttribute("role", "separator"), i.appendChild(s);
|
|
707
|
-
} else d.tamanho === "grande" ? (o(), i.appendChild(l(d, "grande", 24))) : (r || (r = document.createElement("div"), r.className = "ui-ribbon__coluna"), r.appendChild(l(d, "pequeno", 16)), ++a === 3 && o());
|
|
708
|
-
}), o(), t.rotulo || t.lancadorDialogo) {
|
|
709
|
-
const d = document.createElement("div");
|
|
710
|
-
if (d.className = "ui-ribbon__grupo-rotulo", t.rotulo && (d.textContent = t.rotulo), t.lancadorDialogo) {
|
|
711
|
-
const s = document.createElement("button");
|
|
712
|
-
s.type = "button", s.className = "ui-ribbon__lancador";
|
|
713
|
-
const c = t.rotuloLancador || `Mais opções de ${t.rotulo || "ferramentas"}`;
|
|
714
|
-
s.setAttribute("aria-label", c), s.dataset.tooltip = c, s.innerHTML = '<svg viewBox="0 0 16 16" width="10" height="10" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 12h8V4M12 12l-7-7"/></svg>', s.addEventListener("click", (p) => {
|
|
715
|
-
p.stopPropagation(), this.dispatchEvent(new CustomEvent("ui-grupo-dialogo", {
|
|
716
|
-
detail: { id: typeof t.lancadorDialogo == "string" ? t.lancadorDialogo : t.id, grupo: t },
|
|
717
|
-
bubbles: !0,
|
|
718
|
-
composed: !0
|
|
719
|
-
}));
|
|
720
|
-
}), d.appendChild(s);
|
|
721
|
-
}
|
|
722
|
-
e.appendChild(d);
|
|
723
|
-
}
|
|
724
|
-
return e.appendChild(i), e;
|
|
725
|
-
}
|
|
726
|
-
criarBotao(t, e, i) {
|
|
727
|
-
return j(this.efetivo(t), e, i);
|
|
728
|
-
}
|
|
729
|
-
botoesPainel() {
|
|
730
|
-
return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
|
|
731
|
-
}
|
|
732
|
-
get rtl() {
|
|
733
|
-
return getComputedStyle(this).direction === "rtl";
|
|
734
|
-
}
|
|
735
|
-
alternarKeyTips() {
|
|
736
|
-
if (this.keytipsAtivas = !this.keytipsAtivas, this.shadowRoot.querySelectorAll(".ui-ribbon__keytip").forEach((e) => e.remove()), !this.keytipsAtivas) return;
|
|
737
|
-
Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")).forEach((e, i) => {
|
|
738
|
-
const r = document.createElement("span");
|
|
739
|
-
r.className = "ui-ribbon__keytip", r.textContent = String(i + 1), r.style.top = "2px", r.style.left = "4px", e.style.position = "relative", e.appendChild(r);
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
acionar(t, e) {
|
|
743
|
-
var o;
|
|
744
|
-
const i = this._abas.find((l) => l.id === this._abaAtiva), r = i == null ? void 0 : i.grupos.find((l) => g(l.itens, t.dataset.id)), a = r && g(r.itens, t.dataset.id);
|
|
745
|
-
if (!(!a || a.disabled)) {
|
|
746
|
-
if ((o = a.filhos) != null && o.length && !a.dividido) {
|
|
747
|
-
this.alternarMenu(t, a, e);
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
if (a.tipo === "toggle") {
|
|
751
|
-
const l = a.ativo;
|
|
752
|
-
a.ativo = !l, A(t, a), this.emitir(a) || (a.ativo = l, A(t, a));
|
|
753
|
-
} else if (a.tipo === "ferramenta") {
|
|
754
|
-
const l = a.ativo, d = r ? r.exclusivo !== !1 : !0, s = d && r ? r.itens.filter((c) => c.tipo === "ferramenta" && c.id !== a.id && c.ativo) : [];
|
|
755
|
-
a.ativo = !0, A(t, a), d && s.forEach((c) => {
|
|
756
|
-
c.ativo = !1;
|
|
757
|
-
const p = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(c.id)}"]`);
|
|
758
|
-
p && A(p, c);
|
|
759
|
-
}), this.emitir(a) || (a.ativo = l, A(t, a), d && s.forEach((c) => {
|
|
760
|
-
c.ativo = !0;
|
|
761
|
-
const p = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(c.id)}"]`);
|
|
762
|
-
p && A(p, c);
|
|
763
|
-
}));
|
|
764
|
-
} else
|
|
765
|
-
this.emitir(a);
|
|
766
|
-
this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
alternarMenu(t, e, i) {
|
|
770
|
-
var a;
|
|
771
|
-
const r = ((a = this.menu) == null ? void 0 : a.ancora) === t;
|
|
772
|
-
this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = z(
|
|
773
|
-
this.shadowRoot,
|
|
774
|
-
t,
|
|
775
|
-
e.filhos,
|
|
776
|
-
(o) => {
|
|
777
|
-
if (o.tipo === "toggle") {
|
|
778
|
-
const l = o.ativo;
|
|
779
|
-
o.ativo = !l, this.emitir(o, e) || (o.ativo = l);
|
|
780
|
-
} else
|
|
781
|
-
this.emitir(o, e);
|
|
782
|
-
this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
783
|
-
},
|
|
784
|
-
{
|
|
785
|
-
lado: "baixo",
|
|
786
|
-
focar: i,
|
|
787
|
-
onFechar: () => {
|
|
788
|
-
t.setAttribute("aria-expanded", "false"), this.menu = null;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
));
|
|
792
|
-
}
|
|
793
|
-
fecharMenu() {
|
|
794
|
-
var t;
|
|
795
|
-
(t = this.menu) == null || t.fechar(), this.menu = null;
|
|
796
|
-
}
|
|
797
|
-
/** Retorna false se o consumidor cancelou o evento (preventDefault). */
|
|
798
|
-
emitir(t, e) {
|
|
799
|
-
return this.dispatchEvent(
|
|
800
|
-
new CustomEvent("ui-ferramenta", {
|
|
801
|
-
detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
|
|
802
|
-
bubbles: !0,
|
|
803
|
-
composed: !0,
|
|
804
|
-
cancelable: !0
|
|
805
|
-
})
|
|
806
|
-
);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
$("ui-ribbon", lt);
|
|
810
|
-
const ut = ':host{display:inline-flex;flex-direction:column;max-width:100%;max-height:100%;vertical-align:top;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-paleta{--ui-paleta-btn: 34px;--ui-paleta-padding: 4px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 10px);--ui-paleta-btn-raio: var(--ui-paleta-raio-botao, max(2px, calc(var(--ui-paleta-raio) - var(--ui-paleta-padding))));display:flex;flex-direction:column;align-items:center;gap:2px;padding:var(--ui-paleta-padding);box-sizing:border-box;background:var(--ui-cor-superficie, #141417);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-paleta-raio);-webkit-user-select:none;user-select:none;min-width:0;min-height:0;max-width:100%;overflow:auto;scrollbar-width:thin}.ui-paleta--horizontal{flex-direction:row}.ui-paleta--sm{--ui-paleta-btn: 28px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 8px)}.ui-paleta--lg{--ui-paleta-btn: 42px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 12px)}.ui-paleta--cols-2{display:grid;grid-template-columns:repeat(2,var(--ui-paleta-btn));justify-content:center}.ui-paleta--cols-2 .ui-paleta__sep{grid-column:1 / -1}.ui-ferr-btn--grupo:after{content:"";position:absolute;inset-inline-end:3px;bottom:3px;width:0;height:0;border-inline-start:6px solid transparent;border-bottom:6px solid currentColor;opacity:.8;pointer-events:none;transition:opacity .12s ease,transform .12s ease}.ui-ferr-btn--grupo:hover:after,.ui-ferr-btn--grupo:focus-visible:after,.ui-ferr-btn--grupo[aria-expanded=true]:after{opacity:1;transform:scale(1.2);transform-origin:bottom right}.ui-paleta__sep{grid-column:1 / -1}.ui-paleta .ui-ferr-btn{width:var(--ui-paleta-btn);height:var(--ui-paleta-btn);border-radius:var(--ui-paleta-btn-raio)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo,.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled),.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:var(--ui-cor-primaria, #00E08A);border-color:transparent;color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 86%,#fff)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 80%,#000)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:disabled{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:inherit}.ui-ferr-btn--grupo:after{content:"";position:absolute;right:3px;bottom:3px;width:0;height:0;border-left:5px solid transparent;border-bottom:5px solid currentColor;opacity:.7;pointer-events:none}.ui-paleta__sep{width:70%;height:1px;margin:3px 0;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-paleta--horizontal .ui-paleta__sep{width:1px;height:70%;margin:0 3px}@media (pointer: coarse){.ui-paleta{--ui-paleta-btn: 40px}.ui-paleta--sm{--ui-paleta-btn: 36px}.ui-paleta--lg{--ui-paleta-btn: 48px}}@media (prefers-reduced-motion: reduce){.ui-ferr-btn--grupo:after{transition:none}}@media (forced-colors: active){.ui-paleta{border-color:CanvasText}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo,.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled),.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:Highlight;color:HighlightText;border-color:ButtonText;forced-color-adjust:none}.ui-paleta__sep{background:CanvasText}}', dt = 380, ct = 8, ht = 50, bt = { sm: 16, md: 18, lg: 22 };
|
|
811
|
-
class pt extends q {
|
|
812
|
-
constructor() {
|
|
813
|
-
super();
|
|
814
|
-
h(this, "rootElement");
|
|
815
|
-
h(this, "_ferramentas", []);
|
|
816
|
-
h(this, "_ativo", "");
|
|
817
|
-
h(this, "_pendente", "");
|
|
818
|
-
h(this, "visiveis", /* @__PURE__ */ new Map());
|
|
819
|
-
// id do grupo → id do filho exibido
|
|
820
|
-
h(this, "menu", null);
|
|
821
|
-
h(this, "timerPressao");
|
|
822
|
-
h(this, "timerSupressao");
|
|
823
|
-
h(this, "inicioPressao", null);
|
|
824
|
-
h(this, "suprimirClique", !1);
|
|
825
|
-
h(this, "listeners", new M());
|
|
826
|
-
h(this, "tooltip", null);
|
|
827
|
-
h(this, "_modoControlado", !1);
|
|
828
|
-
h(this, "handleClick", (t) => {
|
|
829
|
-
if (this.suprimirClique) {
|
|
830
|
-
this.suprimirClique = !1, window.clearTimeout(this.timerSupressao);
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
const e = t.target.closest(".ui-ferr-btn"), i = e != null && e.dataset.id ? g(this._ferramentas, e.dataset.id) : void 0;
|
|
834
|
-
if (!e || !i) return;
|
|
835
|
-
const r = e.dataset.grupo ? g(this._ferramentas, e.dataset.grupo) : void 0;
|
|
836
|
-
this.acionar(i, r);
|
|
837
|
-
});
|
|
838
|
-
h(this, "handleFocusIn", (t) => Y(this.botoes(), t.target));
|
|
839
|
-
h(this, "handlePointerDown", (t) => {
|
|
840
|
-
const e = t;
|
|
841
|
-
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
842
|
-
const i = t.target.closest(".ui-ferr-btn--grupo");
|
|
843
|
-
!i || i.disabled || (this.cancelarPressao(), window.clearTimeout(this.timerSupressao), this.inicioPressao = { x: e.clientX ?? 0, y: e.clientY ?? 0 }, this.timerPressao = window.setTimeout(() => {
|
|
844
|
-
this.suprimirClique = !0, this.abrirFlyout(i, !1);
|
|
845
|
-
}, dt));
|
|
846
|
-
});
|
|
847
|
-
/** Arrastar/rolar com o dedo cancela o clique longo. */
|
|
848
|
-
h(this, "handlePointerMove", (t) => {
|
|
849
|
-
if (this.timerPressao === void 0 || !this.inicioPressao) return;
|
|
850
|
-
const e = t, i = (e.clientX ?? 0) - this.inicioPressao.x, r = (e.clientY ?? 0) - this.inicioPressao.y;
|
|
851
|
-
Math.hypot(i, r) > ct && this.cancelarPressao();
|
|
852
|
-
});
|
|
853
|
-
/** Fim do gesto: cancela o timer e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
|
|
854
|
-
h(this, "handlePointerFim", () => {
|
|
855
|
-
this.cancelarPressao(), this.suprimirClique && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
|
|
856
|
-
this.suprimirClique = !1;
|
|
857
|
-
}, ht));
|
|
858
|
-
});
|
|
859
|
-
h(this, "cancelarPressao", () => {
|
|
860
|
-
this.timerPressao !== void 0 && (window.clearTimeout(this.timerPressao), this.timerPressao = void 0), this.inicioPressao = null;
|
|
861
|
-
});
|
|
862
|
-
h(this, "handleContextMenu", (t) => {
|
|
863
|
-
const e = t.target.closest(".ui-ferr-btn--grupo");
|
|
864
|
-
e && (t.preventDefault(), this.cancelarPressao(), this.abrirFlyout(e, !1));
|
|
865
|
-
});
|
|
866
|
-
h(this, "handleKeyDown", (t) => {
|
|
867
|
-
var l;
|
|
868
|
-
const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = this.colunas;
|
|
869
|
-
if (!e && r === 2) {
|
|
870
|
-
if (at(t, this.botoes(), i)) return;
|
|
871
|
-
} else {
|
|
872
|
-
const d = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], s = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
|
|
873
|
-
if (R(t, this.botoes(), d, s)) return;
|
|
874
|
-
}
|
|
875
|
-
const a = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", o = t.target instanceof HTMLButtonElement ? t.target : null;
|
|
876
|
-
o != null && o.dataset.grupo && t.key === a && (t.preventDefault(), ((l = this.menu) == null ? void 0 : l.ancora) === o ? this.menu.focarPrimeiro() : this.abrirFlyout(o, !0));
|
|
877
|
-
});
|
|
878
|
-
h(this, "handleAtalho", (t) => {
|
|
879
|
-
if (!this.hasAttribute("atalhos") || t.defaultPrevented) return;
|
|
880
|
-
const e = t.composedPath(), i = e[0];
|
|
881
|
-
if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((s) => {
|
|
882
|
-
var p, m;
|
|
883
|
-
const c = (p = s.getAttribute) == null ? void 0 : p.call(s, "role");
|
|
884
|
-
return ((m = s.getAttribute) == null ? void 0 : m.call(s, "aria-modal")) === "true" || c === "textbox" || c === "searchbox" || c === "combobox" || c === "spinbutton";
|
|
885
|
-
})) return;
|
|
886
|
-
const a = Array.from(document.querySelectorAll("ui-paleta-ferramentas[atalhos]"));
|
|
887
|
-
if (a.length > 1 && (a.find((c) => {
|
|
888
|
-
var p;
|
|
889
|
-
return c.matches(":focus-within") || ((p = c.shadowRoot) == null ? void 0 : p.activeElement);
|
|
890
|
-
}) || a[0]) !== this)
|
|
891
|
-
return;
|
|
892
|
-
const o = this.todasFerramentas().filter((s) => !s.disabled && U(t, s.atalho));
|
|
893
|
-
if (!o.length) return;
|
|
894
|
-
t.preventDefault();
|
|
895
|
-
let l = o[0];
|
|
896
|
-
if (o.length > 1) {
|
|
897
|
-
const s = o.findIndex((c) => c.id === this._ativo);
|
|
898
|
-
l = o[(s + 1) % o.length];
|
|
899
|
-
}
|
|
900
|
-
const d = this._ferramentas.find((s) => {
|
|
901
|
-
var c;
|
|
902
|
-
return (c = s.filhos) == null ? void 0 : c.some((p) => p.id === l.id);
|
|
903
|
-
});
|
|
904
|
-
this.acionar(l, d);
|
|
905
|
-
});
|
|
906
|
-
const t = this.attachShadow({ mode: "open" });
|
|
907
|
-
t.innerHTML = `
|
|
908
|
-
<style>${K}${ut}</style>
|
|
909
|
-
<div class="ui-paleta ui-paleta--vertical" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
|
|
910
|
-
`, this.rootElement = t.querySelector(".ui-paleta");
|
|
911
|
-
}
|
|
912
|
-
static get observedAttributes() {
|
|
913
|
-
return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "aria-label", "copiar-dados", "modo-controlado"];
|
|
914
|
-
}
|
|
915
|
-
connectedCallback() {
|
|
916
|
-
var e;
|
|
917
|
-
this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new X(this.shadowRoot, this.rootElement), this.listeners.add(this.rootElement, "click", this.handleClick), this.listeners.add(this.rootElement, "pointerdown", this.handlePointerDown), this.listeners.add(this.rootElement, "pointermove", this.handlePointerMove), this.listeners.add(this.rootElement, "pointerup", this.handlePointerFim), this.listeners.add(this.rootElement, "pointerleave", this.handlePointerFim), this.listeners.add(this.rootElement, "pointercancel", this.handlePointerFim), this.listeners.add(this.rootElement, "contextmenu", this.handleContextMenu), this.listeners.add(this.rootElement, "keydown", this.handleKeyDown), this.listeners.add(this.rootElement, "focusin", this.handleFocusIn), this.listeners.add(document, "keydown", this.handleAtalho);
|
|
918
|
-
const t = this.getAttribute("valor") || this.getAttribute("value");
|
|
919
|
-
t && !this._ativo && (this._pendente = t), this.aplicarPendente(), this.renderizar();
|
|
920
|
-
}
|
|
921
|
-
disconnectedCallback() {
|
|
922
|
-
var t;
|
|
923
|
-
this.cancelarPressao(), window.clearTimeout(this.timerSupressao), this.suprimirClique = !1, this.fecharMenu(), (t = this.tooltip) == null || t.destruir(), this.tooltip = null, this.listeners.cleanup();
|
|
924
|
-
}
|
|
925
|
-
attributeChangedCallback(t, e, i) {
|
|
926
|
-
if (e !== i)
|
|
927
|
-
if (t === "valor" || t === "value") {
|
|
928
|
-
const r = this.getAttribute("valor") || this.getAttribute("value") || "";
|
|
929
|
-
r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
|
|
930
|
-
} else
|
|
931
|
-
this.renderizar();
|
|
932
|
-
}
|
|
933
|
-
/* ---------- API pública ---------- */
|
|
934
|
-
/**
|
|
935
|
-
* Quando `true` ou atributo `copiar-dados` / `modo-controlado`: clona a árvore de itens
|
|
936
|
-
* para não mutar os objetos fornecidos pelo consumidor (Item 11).
|
|
937
|
-
*/
|
|
938
|
-
get modoControlado() {
|
|
939
|
-
return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
|
|
940
|
-
}
|
|
941
|
-
set modoControlado(t) {
|
|
942
|
-
this._modoControlado = !!t;
|
|
943
|
-
}
|
|
944
|
-
get copiarDados() {
|
|
945
|
-
return this.modoControlado;
|
|
946
|
-
}
|
|
947
|
-
set copiarDados(t) {
|
|
948
|
-
this.modoControlado = t;
|
|
949
|
-
}
|
|
950
|
-
get ferramentas() {
|
|
951
|
-
return this._ferramentas;
|
|
952
|
-
}
|
|
953
|
-
set ferramentas(t) {
|
|
954
|
-
const e = Array.isArray(t) ? t : [];
|
|
955
|
-
this._ferramentas = this.modoControlado ? e.map((i) => {
|
|
956
|
-
var r;
|
|
957
|
-
return { ...i, filhos: (r = i.filhos) == null ? void 0 : r.map((a) => ({ ...a })) };
|
|
958
|
-
}) : e, D(N(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
|
|
959
|
-
}
|
|
960
|
-
get valor() {
|
|
961
|
-
return this._ativo;
|
|
962
|
-
}
|
|
963
|
-
set valor(t) {
|
|
964
|
-
this.ativar(t);
|
|
965
|
-
}
|
|
966
|
-
get value() {
|
|
967
|
-
return this.valor;
|
|
968
|
-
}
|
|
969
|
-
set value(t) {
|
|
970
|
-
this.valor = t;
|
|
971
|
-
}
|
|
972
|
-
get orientacao() {
|
|
973
|
-
return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
|
|
974
|
-
}
|
|
975
|
-
set orientacao(t) {
|
|
976
|
-
this.setAttribute("orientacao", t);
|
|
977
|
-
}
|
|
978
|
-
get colunas() {
|
|
979
|
-
return this.getAttribute("colunas") === "2" ? 2 : 1;
|
|
980
|
-
}
|
|
981
|
-
set colunas(t) {
|
|
982
|
-
this.setAttribute("colunas", String(t));
|
|
983
|
-
}
|
|
984
|
-
get tamanho() {
|
|
985
|
-
const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
|
|
986
|
-
return t === "sm" || t === "lg" ? t : "md";
|
|
987
|
-
}
|
|
988
|
-
set tamanho(t) {
|
|
989
|
-
this.setAttribute("tamanho", t);
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
* Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
|
|
993
|
-
* `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
|
|
994
|
-
*/
|
|
995
|
-
ativar(t, e = !0) {
|
|
996
|
-
if (!t) {
|
|
997
|
-
this.limpar(e);
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
const i = g(this._ferramentas, t);
|
|
1001
|
-
if (!i) {
|
|
1002
|
-
this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
|
|
1006
|
-
console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
|
|
1007
|
-
return;
|
|
1008
|
-
}
|
|
1009
|
-
this._pendente = "";
|
|
1010
|
-
const r = this._ativo;
|
|
1011
|
-
this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
|
|
1012
|
-
}
|
|
1013
|
-
/** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
|
|
1014
|
-
limpar(t = !0) {
|
|
1015
|
-
const e = this._ativo;
|
|
1016
|
-
!e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
|
|
1017
|
-
}
|
|
1018
|
-
atualizarItem(t, e) {
|
|
1019
|
-
var o;
|
|
1020
|
-
const i = g(this._ferramentas, t);
|
|
1021
|
-
if (!i) {
|
|
1022
|
-
console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
|
|
1023
|
-
return;
|
|
1024
|
-
}
|
|
1025
|
-
Object.assign(i, e);
|
|
1026
|
-
const r = Object.keys(e).every((l) => l === "ativo" || l === "disabled"), a = this._ferramentas.find((l) => {
|
|
1027
|
-
var d;
|
|
1028
|
-
return (d = l.filhos) == null ? void 0 : d.some((s) => s.id === t);
|
|
1029
|
-
});
|
|
1030
|
-
if (r && !(a && "disabled" in e)) {
|
|
1031
|
-
const l = this.botoes().find((d) => d.dataset.id === t || d.dataset.grupo === t);
|
|
1032
|
-
if (l) {
|
|
1033
|
-
A(l, this.itemParaBotao(a ?? i)), W(this.botoes());
|
|
1034
|
-
return;
|
|
1035
|
-
}
|
|
1036
|
-
if (a || (o = i.filhos) != null && o.length) return;
|
|
1037
|
-
}
|
|
1038
|
-
this.renderizar();
|
|
1039
|
-
}
|
|
1040
|
-
/* ---------- Estado interno ---------- */
|
|
1041
|
-
refletirValor(t) {
|
|
1042
|
-
const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
|
|
1043
|
-
this.getAttribute(e) !== t && this.setAttribute(e, t);
|
|
1044
|
-
}
|
|
1045
|
-
aplicarPendente() {
|
|
1046
|
-
if (!this._pendente) return;
|
|
1047
|
-
const t = g(this._ferramentas, this._pendente);
|
|
1048
|
-
t && !t.disabled && (t.tipo ?? "ferramenta") === "ferramenta" ? (this.definirAtivoInterno(this._pendente), this._pendente = "") : this._ferramentas.length && (console.warn(`[ui-paleta-ferramentas] valor="${this._pendente}" não é uma ferramenta ativável em "ferramentas".`), this._pendente = "");
|
|
1049
|
-
}
|
|
1050
|
-
definirAtivoInterno(t) {
|
|
1051
|
-
this._ativo = t;
|
|
1052
|
-
const e = this._ferramentas.find((i) => {
|
|
1053
|
-
var r;
|
|
1054
|
-
return (r = i.filhos) == null ? void 0 : r.some((a) => a.id === t);
|
|
1055
|
-
});
|
|
1056
|
-
e && this.visiveis.set(e.id, t);
|
|
1057
|
-
}
|
|
1058
|
-
emitirMudanca(t, e, i) {
|
|
1059
|
-
const r = { valor: t, item: e, anterior: i };
|
|
1060
|
-
this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
|
|
1061
|
-
}
|
|
1062
|
-
/** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
|
|
1063
|
-
itemExibido(t) {
|
|
1064
|
-
var a;
|
|
1065
|
-
if (!((a = t.filhos) != null && a.length)) return t;
|
|
1066
|
-
const e = (o) => o.tipo !== "separador" && !o.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((o) => o.id === i);
|
|
1067
|
-
return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((o) => o.tipo !== "separador") ?? t.filhos[0];
|
|
1068
|
-
}
|
|
1069
|
-
itemParaBotao(t) {
|
|
1070
|
-
const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
|
|
1071
|
-
return {
|
|
1072
|
-
...e,
|
|
1073
|
-
tipo: i,
|
|
1074
|
-
ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
|
|
1075
|
-
filhos: t.filhos
|
|
1076
|
-
};
|
|
1077
|
-
}
|
|
1078
|
-
todasFerramentas() {
|
|
1079
|
-
return this._ferramentas.flatMap((t) => {
|
|
1080
|
-
var e;
|
|
1081
|
-
return (e = t.filhos) != null && e.length ? t.filhos : [t];
|
|
1082
|
-
}).filter((t) => t.tipo !== "separador");
|
|
1083
|
-
}
|
|
1084
|
-
/* ---------- Renderização ---------- */
|
|
1085
|
-
renderizar() {
|
|
1086
|
-
var d;
|
|
1087
|
-
const t = (d = this.shadowRoot) == null ? void 0 : d.activeElement, e = t && t.classList.contains("ui-ferr-btn") ? { id: t.dataset.id ?? "", grupo: t.dataset.grupo ?? "" } : null;
|
|
1088
|
-
this.fecharMenu();
|
|
1089
|
-
const i = this.orientacao, r = this.tamanho, a = this.colunas;
|
|
1090
|
-
this.rootElement.className = `ui-paleta ui-paleta--${i} ui-paleta--${r}`, a === 2 && i === "vertical" && this.rootElement.classList.add("ui-paleta--cols-2"), this.rootElement.setAttribute("aria-orientation", i), this.rootElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.rootElement.innerHTML = "";
|
|
1091
|
-
const o = bt[r] ?? 18;
|
|
1092
|
-
this._ferramentas.forEach((s) => {
|
|
1093
|
-
var m;
|
|
1094
|
-
if (s.tipo === "separador") {
|
|
1095
|
-
const _ = document.createElement("div");
|
|
1096
|
-
_.className = "ui-paleta__sep", _.setAttribute("role", "separator"), this.rootElement.appendChild(_);
|
|
1097
|
-
return;
|
|
1098
|
-
}
|
|
1099
|
-
const c = this.itemExibido(s), p = j(this.itemParaBotao(s), "paleta", o);
|
|
1100
|
-
p.dataset.id = c.id, (m = s.filhos) != null && m.length && (p.dataset.grupo = s.id), this.rootElement.appendChild(p);
|
|
1101
|
-
}), F(this.botoes());
|
|
1102
|
-
const l = this.botoes().find((s) => s.dataset.id === this._ativo && !s.disabled);
|
|
1103
|
-
if (l && (this.botoes().forEach((s) => s.tabIndex = -1), l.tabIndex = 0), e) {
|
|
1104
|
-
const s = this.botoes().find((c) => e.grupo ? c.dataset.grupo === e.grupo : c.dataset.id === e.id);
|
|
1105
|
-
s && !s.disabled && s.focus();
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
botoes() {
|
|
1109
|
-
return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
|
|
1110
|
-
}
|
|
1111
|
-
/** Reflete no botão o estado atual do item (sem recriar o DOM). */
|
|
1112
|
-
atualizarBotaoDe(t, e) {
|
|
1113
|
-
const i = this.botoes().find((r) => r.dataset.id === t.id);
|
|
1114
|
-
i && A(i, this.itemParaBotao(e ?? t));
|
|
1115
|
-
}
|
|
1116
|
-
/* ---------- Interação ---------- */
|
|
1117
|
-
acionar(t, e) {
|
|
1118
|
-
if (t.disabled) return;
|
|
1119
|
-
const i = t.tipo ?? "ferramenta", r = this._ativo, a = t.ativo;
|
|
1120
|
-
i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
|
|
1121
|
-
new CustomEvent("ui-ferramenta", {
|
|
1122
|
-
detail: {
|
|
1123
|
-
id: t.id,
|
|
1124
|
-
item: t,
|
|
1125
|
-
pai: e,
|
|
1126
|
-
ativo: i === "ferramenta" ? !0 : t.ativo,
|
|
1127
|
-
origem: "paleta"
|
|
1128
|
-
},
|
|
1129
|
-
bubbles: !0,
|
|
1130
|
-
composed: !0,
|
|
1131
|
-
cancelable: !0
|
|
1132
|
-
})
|
|
1133
|
-
) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = a, this.atualizarBotaoDe(t, e)));
|
|
1134
|
-
}
|
|
1135
|
-
abrirFlyout(t, e) {
|
|
1136
|
-
var a;
|
|
1137
|
-
const i = t.dataset.grupo ? g(this._ferramentas, t.dataset.grupo) : void 0;
|
|
1138
|
-
if (!((a = i == null ? void 0 : i.filhos) != null && a.length)) return;
|
|
1139
|
-
this.fecharMenu();
|
|
1140
|
-
const r = i.filhos.map((o) => ({
|
|
1141
|
-
...o,
|
|
1142
|
-
ativo: (o.tipo ?? "ferramenta") === "ferramenta" ? o.id === this._ativo : o.ativo
|
|
1143
|
-
}));
|
|
1144
|
-
t.setAttribute("aria-expanded", "true"), this.menu = z(
|
|
1145
|
-
this.shadowRoot,
|
|
1146
|
-
t,
|
|
1147
|
-
r,
|
|
1148
|
-
(o) => {
|
|
1149
|
-
var d;
|
|
1150
|
-
const l = g(i.filhos, o.id);
|
|
1151
|
-
l && (this.acionar(l, i), (d = this.botoes().find((s) => s.dataset.grupo === i.id)) == null || d.focus());
|
|
1152
|
-
},
|
|
1153
|
-
{
|
|
1154
|
-
lado: this.getAttribute("orientacao") === "horizontal" ? "baixo" : "direita",
|
|
1155
|
-
focar: e,
|
|
1156
|
-
tipoPadrao: "ferramenta",
|
|
1157
|
-
onFechar: () => {
|
|
1158
|
-
t.setAttribute("aria-expanded", "false"), this.menu = null;
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
);
|
|
1162
|
-
}
|
|
1163
|
-
fecharMenu() {
|
|
1164
|
-
var t;
|
|
1165
|
-
(t = this.menu) == null || t.fechar(), this.menu = null;
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
$("ui-paleta-ferramentas", pt);
|
|
1169
|
-
export {
|
|
1170
|
-
et as U,
|
|
1171
|
-
pt as a,
|
|
1172
|
-
lt as b
|
|
1173
|
-
};
|