@thibezer/ui-components-kit 2.17.1 → 2.17.3
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 +15 -0
- package/dist/camadas.cjs +80 -83
- package/dist/camadas.js +1131 -869
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +1 -0
- package/dist/components/ui-camadas/camadas-atualizacao-incremental.d.ts +1 -0
- package/dist/components/ui-camadas/camadas-colecao.d.ts +1 -0
- package/dist/components/ui-camadas/camadas-drag-drop.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-drop-ops.d.ts +34 -0
- package/dist/components/ui-camadas/camadas-lembranca.d.ts +2 -1
- package/dist/components/ui-camadas/camadas-persistencia.d.ts +3 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +1 -0
- package/dist/custom-elements.json +4531 -4079
- package/dist/tipos-elementos.d.ts +3 -0
- package/dist/tipos-vue.d.ts +3 -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-Bq_XUrIQ.cjs +0 -32
- package/dist/ui-controle-cores-BtA6yzu3.js +0 -291
- 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,1233 +0,0 @@
|
|
|
1
|
-
var J = Object.defineProperty;
|
|
2
|
-
var Q = (o, s, t) => s in o ? J(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
|
-
var d = (o, s, t) => Q(o, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { L as M } from "./listener-bag-DQgv7OON.js";
|
|
5
|
-
import { d as N, S as $ } 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 $ {
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
d(this, "iconContainer");
|
|
23
|
-
d(this, "svgContainer");
|
|
24
|
-
d(this, "slotElement");
|
|
25
|
-
d(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
|
-
N("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}}', V = '.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 k(o, s) {
|
|
76
|
-
if (!o) return null;
|
|
77
|
-
const t = document.createElement("ui-icone");
|
|
78
|
-
if (t.setAttribute("tamanho", String(s)), o.trimStart().startsWith("<")) {
|
|
79
|
-
const e = Z(o);
|
|
80
|
-
if (!e) return null;
|
|
81
|
-
t.appendChild(e);
|
|
82
|
-
} else
|
|
83
|
-
t.setAttribute("nome", o);
|
|
84
|
-
return t;
|
|
85
|
-
}
|
|
86
|
-
const K = /* @__PURE__ */ new Set();
|
|
87
|
-
function S(o) {
|
|
88
|
-
return o.rotuloAcessivel ? o.rotuloAcessivel : o.rotulo ? o.rotulo : o.icone && !o.icone.trimStart().startsWith("<") ? o.icone : (K.has(o.id) || (K.add(o.id), console.warn(`[ui-barra-ferramentas] O item "${o.id}" não tem "rotulo" nem "rotuloAcessivel": o id será usado como nome acessível.`)), o.id);
|
|
89
|
-
}
|
|
90
|
-
function T(o, s) {
|
|
91
|
-
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
|
|
92
|
-
o.forEach((i) => t.has(i) ? e.add(i) : t.add(i)), e.size && console.warn(`[ui-barra-ferramentas] ${s}: ids duplicados (${[...e].join(", ")}). Use ids únicos, senão atualizarItem() e os eventos podem atingir o item errado.`);
|
|
93
|
-
}
|
|
94
|
-
function q(o, s = []) {
|
|
95
|
-
for (const t of o)
|
|
96
|
-
t.tipo !== "separador" && (s.push(t.id), t.filhos && q(t.filhos, s));
|
|
97
|
-
return s;
|
|
98
|
-
}
|
|
99
|
-
function A(o, s) {
|
|
100
|
-
o.disabled = !!s.disabled;
|
|
101
|
-
const t = s.tipo, e = t === "toggle" || t === "ferramenta";
|
|
102
|
-
e ? o.setAttribute("aria-pressed", String(!!s.ativo)) : o.removeAttribute("aria-pressed"), o.classList.toggle("ui-ferr-btn--ativo", e && !!s.ativo);
|
|
103
|
-
}
|
|
104
|
-
function j(o, s, t) {
|
|
105
|
-
var n;
|
|
106
|
-
const e = document.createElement("button");
|
|
107
|
-
e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${s}`, e.dataset.id = o.id, e.tabIndex = -1;
|
|
108
|
-
const i = !!((n = o.filhos) != null && n.length), r = s !== "paleta" && !o.somenteIcone && !!o.rotulo;
|
|
109
|
-
o.rotuloAcessivel ? e.setAttribute("aria-label", o.rotuloAcessivel) : r ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", S(o)), o.atalho && e.setAttribute("aria-keyshortcuts", o.atalho), e.dataset.tooltip = S(o), o.atalho && (e.dataset.atalho = o.atalho);
|
|
110
|
-
const a = k(o.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 (s !== "paleta" && o.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 = o.rotulo, e.appendChild(l);
|
|
118
|
-
}
|
|
119
|
-
if (i && !o.dividido) {
|
|
120
|
-
if (s === "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, o), e;
|
|
129
|
-
}
|
|
130
|
-
function rt(o, s, t) {
|
|
131
|
-
const e = document.createElement("div");
|
|
132
|
-
e.className = `ui-ferr-split ui-ferr-split--${s}`, e.dataset.id = o.id;
|
|
133
|
-
const i = j({ ...o, filhos: void 0, dividido: !1 }, s, 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--${s}`, r.dataset.id = o.id, r.dataset.split = "gatilho", r.tabIndex = -1, r.disabled = !!o.disabled, r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), r.setAttribute("aria-label", `Opções de ${S(o)}`), r.dataset.tooltip = `Opções de ${S(o)}`;
|
|
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 m(o, s) {
|
|
141
|
-
for (const t of o) {
|
|
142
|
-
if (t.id === s) return t;
|
|
143
|
-
if (t.filhos) {
|
|
144
|
-
const e = m(t.filhos, s);
|
|
145
|
-
if (e) return e;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function U(o, s) {
|
|
150
|
-
if (!s || !s.trim()) return !1;
|
|
151
|
-
const t = s.split("+").map((f) => f.trim()), e = t[t.length - 1], i = t.some((f) => /^(ctrl|control|cmd|meta)$/i.test(f)), r = t.some((f) => /^alt$/i.test(f)), a = t.some((f) => /^shift$/i.test(f)), n = o.ctrlKey || o.metaKey, l = o.altKey, c = o.shiftKey;
|
|
152
|
-
if (i !== n || r !== l || a !== c) return !1;
|
|
153
|
-
const u = e.toLowerCase(), p = (o.key || "").toLowerCase();
|
|
154
|
-
return u === "esc" || u === "escape" ? p === "escape" : u === "del" || u === "delete" ? p === "delete" : u === "enter" ? p === "enter" : u === "space" || u === "espaço" ? p === " " || p === "space" : p === u;
|
|
155
|
-
}
|
|
156
|
-
function F(o) {
|
|
157
|
-
const s = o.filter((t) => !t.disabled);
|
|
158
|
-
o.forEach((t) => t.tabIndex = -1), s.length && (s[0].tabIndex = 0);
|
|
159
|
-
}
|
|
160
|
-
function W(o) {
|
|
161
|
-
const s = o.find((t) => t.tabIndex === 0 && !t.disabled);
|
|
162
|
-
s ? o.forEach((t) => {
|
|
163
|
-
t !== s && (t.tabIndex = -1);
|
|
164
|
-
}) : F(o);
|
|
165
|
-
}
|
|
166
|
-
function Y(o, s) {
|
|
167
|
-
const t = o.find((e) => e === s || e.contains(s));
|
|
168
|
-
!t || t.disabled || o.forEach((e) => e.tabIndex = e === t ? 0 : -1);
|
|
169
|
-
}
|
|
170
|
-
function R(o, s, t, e) {
|
|
171
|
-
const i = s.filter((l) => !l.disabled), r = i.length, a = i.findIndex((l) => l === o.target);
|
|
172
|
-
if (r === 0 || a < 0) return !1;
|
|
173
|
-
let n = a;
|
|
174
|
-
if (t.includes(o.key)) n = (a - 1 + r) % r;
|
|
175
|
-
else if (e.includes(o.key)) n = (a + 1) % r;
|
|
176
|
-
else if (o.key === "Home") n = 0;
|
|
177
|
-
else if (o.key === "End") n = r - 1;
|
|
178
|
-
else return !1;
|
|
179
|
-
return o.preventDefault(), s.forEach((l) => l.tabIndex = -1), i[n].tabIndex = 0, i[n].focus(), !0;
|
|
180
|
-
}
|
|
181
|
-
function at(o, s, t = !1) {
|
|
182
|
-
const e = s.filter((l) => !l.disabled), i = e.length, r = e.findIndex((l) => l === o.target);
|
|
183
|
-
if (i === 0 || r < 0) return !1;
|
|
184
|
-
let a = r;
|
|
185
|
-
const n = r % 2;
|
|
186
|
-
if (o.key === "ArrowRight")
|
|
187
|
-
t ? n === 1 && (a = r - 1) : n === 0 && r + 1 < i && (a = r + 1);
|
|
188
|
-
else if (o.key === "ArrowLeft")
|
|
189
|
-
t ? n === 0 && r + 1 < i && (a = r + 1) : n === 1 && (a = r - 1);
|
|
190
|
-
else if (o.key === "ArrowDown")
|
|
191
|
-
r + 2 < i ? a = r + 2 : r + 1 < i && n === 0 && (a = r + 1);
|
|
192
|
-
else if (o.key === "ArrowUp")
|
|
193
|
-
r - 2 >= 0 ? a = r - 2 : r - 1 >= 0 && n === 1 && (a = r - 1);
|
|
194
|
-
else if (o.key === "Home")
|
|
195
|
-
a = 0;
|
|
196
|
-
else if (o.key === "End")
|
|
197
|
-
a = i - 1;
|
|
198
|
-
else
|
|
199
|
-
return !1;
|
|
200
|
-
return o.preventDefault(), s.forEach((l) => l.tabIndex = -1), e[a].tabIndex = 0, e[a].focus(), !0;
|
|
201
|
-
}
|
|
202
|
-
let ot = 0;
|
|
203
|
-
class X {
|
|
204
|
-
constructor(s, t) {
|
|
205
|
-
d(this, "el");
|
|
206
|
-
d(this, "textoEl");
|
|
207
|
-
d(this, "atalhoEl");
|
|
208
|
-
d(this, "timer");
|
|
209
|
-
d(this, "alvoAtual", null);
|
|
210
|
-
d(this, "id", `ui-ferr-tooltip-${++ot}`);
|
|
211
|
-
d(this, "listeners", new M());
|
|
212
|
-
this.raiz = s, 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(s, t, e) {
|
|
230
|
-
this.limparTimer(), this.timer = window.setTimeout(() => this.mostrar(s, t, e), 140);
|
|
231
|
-
}
|
|
232
|
-
mostrar(s, t, e) {
|
|
233
|
-
if (this.limparTimer(), !s.isConnected || !t) return;
|
|
234
|
-
this.alvoAtual = s, 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"), s.setAttribute("aria-describedby", this.id);
|
|
235
|
-
const i = s.getBoundingClientRect(), r = this.el.getBoundingClientRect();
|
|
236
|
-
let a = i.bottom + 6, n = 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)), n < 6 ? n = 6 : n + (r.width || 80) > window.innerWidth - 6 && (n = Math.max(6, window.innerWidth - (r.width || 80) - 6)), this.el.style.top = `${a}px`, this.el.style.left = `${n}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 P(o, s, t, e, i = {}) {
|
|
251
|
-
var B;
|
|
252
|
-
const r = i.lado ?? "baixo", a = new M(), n = document.createElement("div");
|
|
253
|
-
n.className = "ui-ferr-menu", n.setAttribute("role", "menu"), n.id = `ui-ferr-menu-${++st}`, n.setAttribute("aria-label", s.getAttribute("aria-label") || "Menu"), s.setAttribute("aria-controls", n.id);
|
|
254
|
-
const l = [];
|
|
255
|
-
let c = !1, u = null;
|
|
256
|
-
const p = () => {
|
|
257
|
-
u && (u.fechar(), u = null);
|
|
258
|
-
}, f = () => {
|
|
259
|
-
var h;
|
|
260
|
-
c || (c = !0, p(), s.removeAttribute("aria-controls"), a.cleanup(), n.remove(), (h = i.onFechar) == null || h.call(i));
|
|
261
|
-
}, g = getComputedStyle(s).direction === "rtl";
|
|
262
|
-
t.forEach((h) => {
|
|
263
|
-
var H;
|
|
264
|
-
if (h.tipo === "separador") {
|
|
265
|
-
const x = document.createElement("div");
|
|
266
|
-
x.className = "ui-ferr-menu__sep", x.setAttribute("role", "separator"), n.appendChild(x);
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
const b = document.createElement("button");
|
|
270
|
-
b.type = "button", b.className = "ui-ferr-menu__item";
|
|
271
|
-
const E = h.tipo ?? i.tipoPadrao ?? "botao";
|
|
272
|
-
E === "toggle" ? (b.setAttribute("role", "menuitemcheckbox"), b.setAttribute("aria-checked", String(!!h.ativo))) : E === "ferramenta" ? (b.setAttribute("role", "menuitemradio"), b.setAttribute("aria-checked", String(!!h.ativo))) : b.setAttribute("role", "menuitem"), b.dataset.id = h.id, b.disabled = !!h.disabled, h.atalho && b.setAttribute("aria-keyshortcuts", h.atalho), h.ativo && b.classList.add("ui-ferr-menu__item--ativo");
|
|
273
|
-
const C = document.createElement("span");
|
|
274
|
-
C.className = "ui-ferr-menu__icone";
|
|
275
|
-
const z = k(h.icone, 14);
|
|
276
|
-
z && C.appendChild(z), b.appendChild(C);
|
|
277
|
-
const v = document.createElement("span");
|
|
278
|
-
if (v.className = "ui-ferr-menu__rotulo", v.textContent = S(h), b.appendChild(v), h.atalho) {
|
|
279
|
-
const x = document.createElement("span");
|
|
280
|
-
x.className = "ui-ferr-menu__atalho", x.textContent = h.atalho, b.appendChild(x);
|
|
281
|
-
}
|
|
282
|
-
if (!!((H = h.filhos) != null && H.length)) {
|
|
283
|
-
b.classList.add("ui-ferr-menu__item--has-sub"), b.setAttribute("aria-haspopup", "menu"), b.setAttribute("aria-expanded", "false");
|
|
284
|
-
const x = document.createElement("span");
|
|
285
|
-
x.className = "ui-ferr-menu__caret-sub", b.appendChild(x);
|
|
286
|
-
const O = (D) => {
|
|
287
|
-
(u == null ? void 0 : u.ancora) !== b && (p(), b.setAttribute("aria-expanded", "true"), u = P(o, b, h.filhos, e, {
|
|
288
|
-
lado: g ? "esquerda" : "direita",
|
|
289
|
-
focar: D,
|
|
290
|
-
tipoPadrao: i.tipoPadrao,
|
|
291
|
-
onFechar: () => {
|
|
292
|
-
b.setAttribute("aria-expanded", "false"), u = null;
|
|
293
|
-
}
|
|
294
|
-
}));
|
|
295
|
-
};
|
|
296
|
-
b.addEventListener("pointerenter", () => O(!1)), b.addEventListener("click", (D) => {
|
|
297
|
-
D.stopPropagation(), O(!0);
|
|
298
|
-
});
|
|
299
|
-
} else
|
|
300
|
-
b.addEventListener("pointerenter", p), b.addEventListener("click", (x) => {
|
|
301
|
-
x.stopPropagation(), f(), s.focus(), e(h);
|
|
302
|
-
});
|
|
303
|
-
l.push(b), n.appendChild(b);
|
|
304
|
-
}), o.appendChild(n);
|
|
305
|
-
const _ = s.getBoundingClientRect(), w = n.getBoundingClientRect();
|
|
306
|
-
let L = r === "baixo" ? _.bottom + 2 : _.top, y = r === "direita" ? _.right + 4 : r === "esquerda" ? _.left - w.width - 4 : g ? _.right - w.width : _.left;
|
|
307
|
-
w.width && y + w.width > window.innerWidth - 4 && (y = Math.max(4, window.innerWidth - w.width - 4)), y < 4 && (y = 4), w.height && L + w.height > window.innerHeight - 4 && (L = Math.max(4, window.innerHeight - w.height - 4)), n.style.top = `${L}px`, n.style.left = `${y}px`;
|
|
308
|
-
const I = () => l.filter((h) => !h.disabled);
|
|
309
|
-
return a.add(n, "keydown", (h) => {
|
|
310
|
-
const b = I(), E = b.findIndex((v) => v === h.target), C = g ? "ArrowLeft" : "ArrowRight", z = g ? "ArrowRight" : "ArrowLeft";
|
|
311
|
-
if (h.key === "Escape")
|
|
312
|
-
h.preventDefault(), h.stopPropagation(), f(), s.focus();
|
|
313
|
-
else if (h.key === "Tab")
|
|
314
|
-
f();
|
|
315
|
-
else if (b.length && (h.key === "ArrowDown" || h.key === "ArrowUp")) {
|
|
316
|
-
h.preventDefault(), p();
|
|
317
|
-
const v = h.key === "ArrowDown" ? 1 : -1;
|
|
318
|
-
b[(E + v + b.length) % b.length].focus();
|
|
319
|
-
} else if (b.length && h.key === C) {
|
|
320
|
-
const v = b[E];
|
|
321
|
-
v != null && v.classList.contains("ui-ferr-menu__item--has-sub") && (h.preventDefault(), v.click());
|
|
322
|
-
} else h.key === z && (r === "direita" || r === "esquerda") ? (h.preventDefault(), h.stopPropagation(), f(), s.focus()) : b.length && h.key === "Home" ? (h.preventDefault(), b[0].focus()) : b.length && h.key === "End" && (h.preventDefault(), b[b.length - 1].focus());
|
|
323
|
-
}), a.add(document, "pointerdown", (h) => {
|
|
324
|
-
const b = h.composedPath();
|
|
325
|
-
!b.includes(n) && !b.includes(s) && !(u != null && u.elemento.contains(h.target)) && f();
|
|
326
|
-
}, !0), a.add(window, "resize", f), a.add(window, "scroll", (h) => {
|
|
327
|
-
h.target instanceof Node && n.contains(h.target) || f();
|
|
328
|
-
}, !0), i.focar && ((B = I()[0]) == null || B.focus()), { elemento: n, ancora: s, fechar: f, focarPrimeiro: () => {
|
|
329
|
-
var h;
|
|
330
|
-
return (h = I()[0]) == null ? void 0 : h.focus();
|
|
331
|
-
} };
|
|
332
|
-
}
|
|
333
|
-
const nt = 3;
|
|
334
|
-
function lt({ aba: o, ativa: s, idBotao: t, idPainel: e }) {
|
|
335
|
-
const i = document.createElement("button");
|
|
336
|
-
return i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = o.id, i.id = t, s && i.setAttribute("aria-controls", e), i.textContent = o.rotulo, i.tabIndex = s ? 0 : -1, i.setAttribute("aria-selected", String(s)), i.classList.toggle("ui-ribbon__aba--ativa", s), i.classList.toggle("ui-ribbon__aba--contextual", !!o.contextual), i;
|
|
337
|
-
}
|
|
338
|
-
const ut = '<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16" stroke="currentColor" stroke-width="2" fill="none"/></svg>', dt = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 12h8V4M12 12l-7-7"/></svg>', ct = (o) => o.rotuloLancador || `Mais opções de ${o.rotulo || "ferramentas"}`;
|
|
339
|
-
function ht(o, s) {
|
|
340
|
-
s.classList.add("ui-ribbon__grupo--colapsado");
|
|
341
|
-
const t = document.createElement("button");
|
|
342
|
-
t.type = "button", t.className = "ui-ferr-btn ui-ferr-btn--grande ui-ribbon__btn-colapsado", t.dataset.grupoColapsado = o.id, t.dataset.tooltip = o.rotulo, t.setAttribute("aria-haspopup", "menu"), t.setAttribute("aria-expanded", "false");
|
|
343
|
-
const e = k(o.icone, 24) || k(ut, 24);
|
|
344
|
-
if (e) {
|
|
345
|
-
const a = document.createElement("span");
|
|
346
|
-
a.className = "ui-ferr-btn__icone", a.appendChild(e), t.appendChild(a);
|
|
347
|
-
}
|
|
348
|
-
const i = document.createElement("span");
|
|
349
|
-
i.className = "ui-ferr-btn__rotulo", i.textContent = o.rotulo, t.appendChild(i);
|
|
350
|
-
const r = document.createElement("span");
|
|
351
|
-
return r.className = "ui-ferr-btn__caret", t.appendChild(r), s.appendChild(t), s;
|
|
352
|
-
}
|
|
353
|
-
function pt(o, s, t = {}) {
|
|
354
|
-
const e = document.createElement("div");
|
|
355
|
-
if (e.className = "ui-ribbon__grupo", e.setAttribute("role", "group"), e.setAttribute("aria-label", o.rotulo), e.dataset.id = o.id, t.colapsado) return ht(o, e);
|
|
356
|
-
const i = (c, u, p) => {
|
|
357
|
-
var f;
|
|
358
|
-
return c.dividido && ((f = c.filhos) != null && f.length) && t.criarDividido ? t.criarDividido(c, u, p) : s(c, u, p);
|
|
359
|
-
}, r = document.createElement("div");
|
|
360
|
-
r.className = "ui-ribbon__grupo-itens";
|
|
361
|
-
let a = null, n = 0;
|
|
362
|
-
const l = () => {
|
|
363
|
-
a && r.appendChild(a), a = null, n = 0;
|
|
364
|
-
};
|
|
365
|
-
if (o.itens.forEach((c) => {
|
|
366
|
-
if (c.tipo === "separador") {
|
|
367
|
-
l();
|
|
368
|
-
const u = document.createElement("div");
|
|
369
|
-
u.className = "ui-ribbon__separador", u.setAttribute("role", "separator"), r.appendChild(u);
|
|
370
|
-
} else c.tamanho === "grande" ? (l(), r.appendChild(i(c, "grande", 24))) : (a || (a = document.createElement("div"), a.className = "ui-ribbon__coluna"), a.appendChild(i(c, "pequeno", 16)), ++n === nt && l());
|
|
371
|
-
}), l(), o.rotulo || o.lancadorDialogo) {
|
|
372
|
-
const c = document.createElement("div");
|
|
373
|
-
if (c.className = "ui-ribbon__grupo-rotulo", o.rotulo && (c.textContent = o.rotulo), o.lancadorDialogo) {
|
|
374
|
-
const u = document.createElement("button");
|
|
375
|
-
u.type = "button", u.className = "ui-ribbon__lancador", u.dataset.lancador = o.id;
|
|
376
|
-
const p = ct(o);
|
|
377
|
-
u.setAttribute("aria-label", p), u.dataset.tooltip = p;
|
|
378
|
-
const f = k(dt, 10);
|
|
379
|
-
f && u.appendChild(f), c.appendChild(u);
|
|
380
|
-
}
|
|
381
|
-
return e.appendChild(r), e.appendChild(c), e;
|
|
382
|
-
}
|
|
383
|
-
return e.appendChild(r), e;
|
|
384
|
-
}
|
|
385
|
-
function bt(o, s, t, e, i = !1) {
|
|
386
|
-
if (s < 0 || t <= 0) return null;
|
|
387
|
-
if (i && (o === "Enter" || o === " ")) return { tipo: "ativar", indice: s };
|
|
388
|
-
const [r, a] = e ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
|
|
389
|
-
return o === r ? { tipo: "ir-para", indice: (s + 1) % t } : o === a ? { tipo: "ir-para", indice: (s - 1 + t) % t } : o === "Home" ? { tipo: "ir-para", indice: 0 } : o === "End" ? { tipo: "ir-para", indice: t - 1 } : o === "ArrowDown" ? { tipo: "descer" } : null;
|
|
390
|
-
}
|
|
391
|
-
let ft = 0;
|
|
392
|
-
class mt extends $ {
|
|
393
|
-
constructor() {
|
|
394
|
-
super();
|
|
395
|
-
d(this, "rootElement");
|
|
396
|
-
d(this, "abasElement");
|
|
397
|
-
d(this, "gruposElement");
|
|
398
|
-
d(this, "painelElement");
|
|
399
|
-
d(this, "fixarElement");
|
|
400
|
-
d(this, "uid", `ui-ribbon-${++ft}`);
|
|
401
|
-
d(this, "_abaPendente", "");
|
|
402
|
-
d(this, "_pronto", !1);
|
|
403
|
-
d(this, "_modoControlado", !1);
|
|
404
|
-
d(this, "_abas", []);
|
|
405
|
-
d(this, "_abaAtiva", "");
|
|
406
|
-
d(this, "menu", null);
|
|
407
|
-
d(this, "listeners", new M());
|
|
408
|
-
d(this, "tooltip", null);
|
|
409
|
-
d(this, "observerResize", null);
|
|
410
|
-
d(this, "gruposColapsados", /* @__PURE__ */ new Set());
|
|
411
|
-
d(this, "keytipsAtivas", !1);
|
|
412
|
-
d(this, "handleFocusInGrupos", (t) => Y(this.botoesPainel(), t.target));
|
|
413
|
-
/* ---------- Interação ---------- */
|
|
414
|
-
d(this, "handleClickAbas", (t) => {
|
|
415
|
-
const e = t.target.closest(".ui-ribbon__aba");
|
|
416
|
-
e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
|
|
417
|
-
});
|
|
418
|
-
d(this, "handleClickFixar", () => {
|
|
419
|
-
this.recolhido = !this.recolhido;
|
|
420
|
-
});
|
|
421
|
-
d(this, "handleDblClickAbas", (t) => {
|
|
422
|
-
t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
|
|
423
|
-
});
|
|
424
|
-
d(this, "handleKeyDownAbas", (t) => {
|
|
425
|
-
var a, n;
|
|
426
|
-
const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = bt(t.key, e.findIndex((l) => l === t.target), e.length, this.rtl, this.ativacaoManual);
|
|
427
|
-
if (!i) return;
|
|
428
|
-
if (t.preventDefault(), i.tipo === "descer") {
|
|
429
|
-
this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (a = this.botoesPainel().find((l) => !l.disabled)) == null || a.focus();
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
if (i.tipo === "ativar") {
|
|
433
|
-
const l = e[i.indice].dataset.id;
|
|
434
|
-
l && this.selecionarAba(l);
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
const r = e[i.indice].dataset.id;
|
|
438
|
-
if (this.ativacaoManual) {
|
|
439
|
-
e.forEach((l) => l.tabIndex = -1), e[i.indice].tabIndex = 0, e[i.indice].focus();
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
r && this.selecionarAba(r), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(r ?? "")}"]`)) == null || n.focus();
|
|
443
|
-
});
|
|
444
|
-
d(this, "handleClickGrupos", (t) => {
|
|
445
|
-
var c;
|
|
446
|
-
const e = t.target, i = this._abas.find((u) => u.id === this._abaAtiva), r = e.closest(".ui-ribbon__btn-colapsado");
|
|
447
|
-
if (r) {
|
|
448
|
-
const u = i == null ? void 0 : i.grupos.find((p) => p.id === r.dataset.grupoColapsado);
|
|
449
|
-
u && this.alternarMenuGrupoColapsado(r, u);
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
const a = e.closest(".ui-ribbon__lancador");
|
|
453
|
-
if (a) {
|
|
454
|
-
const u = i == null ? void 0 : i.grupos.find((p) => p.id === a.dataset.lancador);
|
|
455
|
-
u && this.dispatchEvent(new CustomEvent("ui-grupo-dialogo", {
|
|
456
|
-
detail: { id: typeof u.lancadorDialogo == "string" ? u.lancadorDialogo : u.id, grupo: u },
|
|
457
|
-
bubbles: !0,
|
|
458
|
-
composed: !0
|
|
459
|
-
}));
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
const n = e.closest(".ui-ferr-split__gatilho");
|
|
463
|
-
if (n) {
|
|
464
|
-
const u = n.closest(".ui-ferr-split"), p = u == null ? void 0 : u.dataset.id, f = i && m(i.grupos.flatMap((g) => g.itens), p ?? "");
|
|
465
|
-
f && ((c = f.filhos) != null && c.length) && this.alternarMenu(n, f, !1);
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
const l = e.closest(".ui-ferr-btn");
|
|
469
|
-
l != null && l.dataset.id && this.acionar(l, t.detail === 0);
|
|
470
|
-
});
|
|
471
|
-
d(this, "handleKeyDownGrupos", (t) => {
|
|
472
|
-
var r;
|
|
473
|
-
const e = this.botoesPainel();
|
|
474
|
-
if (this.rtl ? R(t, e, ["ArrowRight"], ["ArrowLeft"]) : R(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
|
|
475
|
-
const i = t.target instanceof HTMLButtonElement ? t.target : null;
|
|
476
|
-
(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));
|
|
477
|
-
});
|
|
478
|
-
d(this, "handleEscape", (t) => {
|
|
479
|
-
t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
480
|
-
});
|
|
481
|
-
d(this, "handlePointerDownFora", (t) => {
|
|
482
|
-
!this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
483
|
-
});
|
|
484
|
-
d(this, "handleAtalho", (t) => {
|
|
485
|
-
if (!this.hasAttribute("atalhos") && !this.hasAttribute("keytips") || t.defaultPrevented) return;
|
|
486
|
-
const e = t.composedPath(), i = e[0];
|
|
487
|
-
if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((u) => {
|
|
488
|
-
var f, g;
|
|
489
|
-
const p = (f = u.getAttribute) == null ? void 0 : f.call(u, "role");
|
|
490
|
-
return ((g = u.getAttribute) == null ? void 0 : g.call(u, "aria-modal")) === "true" || p === "textbox" || p === "searchbox" || p === "combobox" || p === "spinbutton";
|
|
491
|
-
})) return;
|
|
492
|
-
if (this.hasAttribute("keytips") && (t.key === "Alt" || t.key === "F10") && !t.ctrlKey && !t.shiftKey && !t.metaKey) {
|
|
493
|
-
t.preventDefault(), this.alternarKeyTips();
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
if (!this.hasAttribute("atalhos")) return;
|
|
497
|
-
const a = this._abas.find((u) => u.id === this._abaAtiva);
|
|
498
|
-
if (!a) return;
|
|
499
|
-
const l = a.grupos.flatMap((u) => u.itens).find((u) => !u.disabled && U(t, u.atalho));
|
|
500
|
-
if (!l) return;
|
|
501
|
-
t.preventDefault();
|
|
502
|
-
const c = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(l.id)}"]`);
|
|
503
|
-
c ? this.acionar(c, !1) : this.emitir(l);
|
|
504
|
-
});
|
|
505
|
-
const t = this.attachShadow({ mode: "open" });
|
|
506
|
-
t.innerHTML = `
|
|
507
|
-
<style>${V}${it}</style>
|
|
508
|
-
<div class="ui-ribbon">
|
|
509
|
-
<div class="ui-ribbon__cabecalho">
|
|
510
|
-
<div class="ui-ribbon__abas" role="tablist"></div>
|
|
511
|
-
<button type="button" class="ui-ribbon__fixar"></button>
|
|
512
|
-
</div>
|
|
513
|
-
<div class="ui-ribbon__painel" role="tabpanel">
|
|
514
|
-
<div class="ui-ribbon__grupos" role="toolbar" aria-label="Ferramentas"></div>
|
|
515
|
-
</div>
|
|
516
|
-
</div>
|
|
517
|
-
`, 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`;
|
|
518
|
-
}
|
|
519
|
-
static get observedAttributes() {
|
|
520
|
-
return [
|
|
521
|
-
"aba-ativa",
|
|
522
|
-
"recolhido",
|
|
523
|
-
"compacto",
|
|
524
|
-
"ativacao-manual",
|
|
525
|
-
"copiar-dados",
|
|
526
|
-
"modo-controlado",
|
|
527
|
-
"atalhos",
|
|
528
|
-
"keytips",
|
|
529
|
-
"aria-label",
|
|
530
|
-
"rotulo-abas",
|
|
531
|
-
"rotulo-fixar",
|
|
532
|
-
"rotulo-expandir"
|
|
533
|
-
];
|
|
534
|
-
}
|
|
535
|
-
connectedCallback() {
|
|
536
|
-
var e;
|
|
537
|
-
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();
|
|
538
|
-
const t = this.getAttribute("aba-ativa");
|
|
539
|
-
t && !this._abaAtiva && (this._abaPendente = t), this.aplicarRotulos(), this.renderizar(), this._pronto = !0;
|
|
540
|
-
}
|
|
541
|
-
disconnectedCallback() {
|
|
542
|
-
var t, e;
|
|
543
|
-
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();
|
|
544
|
-
}
|
|
545
|
-
attributeChangedCallback(t, e, i) {
|
|
546
|
-
if (e !== i)
|
|
547
|
-
if (t === "aba-ativa") {
|
|
548
|
-
if (!i || i === this._abaAtiva) return;
|
|
549
|
-
this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
|
|
550
|
-
} else t === "recolhido" ? (this.rootElement.classList.remove("ui-ribbon--aberto"), this.aplicarRotulos(), this._pronto && e === null != (i === null) && this.dispatchEvent(
|
|
551
|
-
new CustomEvent("ui-recolhido-change", {
|
|
552
|
-
detail: { recolhido: i !== null },
|
|
553
|
-
bubbles: !0,
|
|
554
|
-
composed: !0
|
|
555
|
-
})
|
|
556
|
-
)) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
|
|
557
|
-
}
|
|
558
|
-
aplicarRotulos() {
|
|
559
|
-
this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
|
|
560
|
-
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";
|
|
561
|
-
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);
|
|
562
|
-
}
|
|
563
|
-
/* ---------- API pública ---------- */
|
|
564
|
-
get modoControlado() {
|
|
565
|
-
return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
|
|
566
|
-
}
|
|
567
|
-
set modoControlado(t) {
|
|
568
|
-
this._modoControlado = !!t;
|
|
569
|
-
}
|
|
570
|
-
get copiarDados() {
|
|
571
|
-
return this.modoControlado;
|
|
572
|
-
}
|
|
573
|
-
set copiarDados(t) {
|
|
574
|
-
this.modoControlado = t;
|
|
575
|
-
}
|
|
576
|
-
get ativacaoManual() {
|
|
577
|
-
return this.hasAttribute("ativacao-manual");
|
|
578
|
-
}
|
|
579
|
-
set ativacaoManual(t) {
|
|
580
|
-
t ? this.setAttribute("ativacao-manual", "") : this.removeAttribute("ativacao-manual");
|
|
581
|
-
}
|
|
582
|
-
get abas() {
|
|
583
|
-
return this._abas;
|
|
584
|
-
}
|
|
585
|
-
set abas(t) {
|
|
586
|
-
const e = Array.isArray(t) ? t : [];
|
|
587
|
-
this._abas = this.modoControlado ? e.map((i) => ({
|
|
588
|
-
...i,
|
|
589
|
-
grupos: i.grupos.map((r) => ({
|
|
590
|
-
...r,
|
|
591
|
-
itens: r.itens.map((a) => {
|
|
592
|
-
var n;
|
|
593
|
-
return {
|
|
594
|
-
...a,
|
|
595
|
-
filhos: (n = a.filhos) == null ? void 0 : n.map((l) => ({ ...l }))
|
|
596
|
-
};
|
|
597
|
-
})
|
|
598
|
-
}))
|
|
599
|
-
})) : e, T(this._abas.map((i) => i.id), "<ui-ribbon> abas"), T(
|
|
600
|
-
this._abas.flatMap((i) => i.grupos.flatMap((r) => q(r.itens))),
|
|
601
|
-
"<ui-ribbon> itens"
|
|
602
|
-
), this.gruposColapsados.clear(), this.renderizar();
|
|
603
|
-
}
|
|
604
|
-
get abaAtiva() {
|
|
605
|
-
return this._abaAtiva;
|
|
606
|
-
}
|
|
607
|
-
set abaAtiva(t) {
|
|
608
|
-
this.selecionarAba(t);
|
|
609
|
-
}
|
|
610
|
-
get recolhido() {
|
|
611
|
-
return this.hasAttribute("recolhido");
|
|
612
|
-
}
|
|
613
|
-
set recolhido(t) {
|
|
614
|
-
t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
|
|
615
|
-
}
|
|
616
|
-
get compacto() {
|
|
617
|
-
return this.hasAttribute("compacto");
|
|
618
|
-
}
|
|
619
|
-
set compacto(t) {
|
|
620
|
-
t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
|
|
621
|
-
}
|
|
622
|
-
selecionarAba(t, e = !0) {
|
|
623
|
-
const i = this._abas.find((r) => r.id === t && !r.oculta);
|
|
624
|
-
if (!i) {
|
|
625
|
-
t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
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(
|
|
629
|
-
new CustomEvent("ui-aba-change", {
|
|
630
|
-
detail: { id: i.id, aba: i },
|
|
631
|
-
bubbles: !0,
|
|
632
|
-
composed: !0
|
|
633
|
-
})
|
|
634
|
-
));
|
|
635
|
-
}
|
|
636
|
-
definirAbaVisivel(t, e) {
|
|
637
|
-
const i = this._abas.find((n) => n.id === t);
|
|
638
|
-
if (!i) return;
|
|
639
|
-
const r = this._abaAtiva;
|
|
640
|
-
i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
|
|
641
|
-
const a = this._abas.find((n) => n.id === this._abaAtiva);
|
|
642
|
-
!e && r === t && a && this.dispatchEvent(
|
|
643
|
-
new CustomEvent("ui-aba-change", { detail: { id: a.id, aba: a }, bubbles: !0, composed: !0 })
|
|
644
|
-
);
|
|
645
|
-
}
|
|
646
|
-
/** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
|
|
647
|
-
atualizarItem(t, e) {
|
|
648
|
-
const i = this._abas.flatMap((c) => c.grupos.flatMap((u) => u.itens)), r = m(i, t);
|
|
649
|
-
if (!r) {
|
|
650
|
-
console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
Object.assign(r, e);
|
|
654
|
-
const a = this._abas.find((c) => c.id === this._abaAtiva);
|
|
655
|
-
if (!a || !m(a.grupos.flatMap((c) => c.itens), t)) return;
|
|
656
|
-
const n = Object.keys(e).every((c) => c === "ativo" || c === "disabled"), l = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
|
|
657
|
-
n ? l && (A(l, this.efetivo(r)), W(this.botoesPainel())) : this.comFoco(() => this.renderizarPainel());
|
|
658
|
-
}
|
|
659
|
-
efetivo(t) {
|
|
660
|
-
var e;
|
|
661
|
-
return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
|
|
662
|
-
}
|
|
663
|
-
/* ---------- Foco preservado em re-renderizações ---------- */
|
|
664
|
-
capturarFoco() {
|
|
665
|
-
var e, i;
|
|
666
|
-
const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
|
|
667
|
-
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;
|
|
668
|
-
}
|
|
669
|
-
comFoco(t) {
|
|
670
|
-
const e = this.capturarFoco();
|
|
671
|
-
if (t(), !e) return;
|
|
672
|
-
const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
|
|
673
|
-
i && !i.disabled && i.focus();
|
|
674
|
-
}
|
|
675
|
-
/* ---------- Renderização ---------- */
|
|
676
|
-
abasVisiveis() {
|
|
677
|
-
return this._abas.filter((t) => !t.oculta);
|
|
678
|
-
}
|
|
679
|
-
renderizar() {
|
|
680
|
-
var e;
|
|
681
|
-
const t = this.abasVisiveis();
|
|
682
|
-
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(() => {
|
|
683
|
-
this.renderizarAbas(), this.renderizarPainel();
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
renderizarAbas() {
|
|
687
|
-
this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
|
|
688
|
-
this.abasElement.appendChild(lt({
|
|
689
|
-
aba: t,
|
|
690
|
-
ativa: t.id === this._abaAtiva,
|
|
691
|
-
idBotao: this.idAba(t.id),
|
|
692
|
-
idPainel: this.painelElement.id
|
|
693
|
-
}));
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
idAba(t) {
|
|
697
|
-
return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
|
|
698
|
-
}
|
|
699
|
-
renderizarPainel() {
|
|
700
|
-
this.fecharMenu(), this.gruposElement.innerHTML = "";
|
|
701
|
-
const t = this._abas.find((e) => e.id === this._abaAtiva);
|
|
702
|
-
if (!t) {
|
|
703
|
-
this.painelElement.removeAttribute("aria-labelledby");
|
|
704
|
-
return;
|
|
705
|
-
}
|
|
706
|
-
this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(pt(
|
|
707
|
-
e,
|
|
708
|
-
(i, r, a) => this.criarBotao(i, r, a),
|
|
709
|
-
{
|
|
710
|
-
colapsado: this.gruposColapsados.has(e.id),
|
|
711
|
-
criarDividido: (i, r, a) => rt(this.efetivo(i), r, a)
|
|
712
|
-
}
|
|
713
|
-
))), F(this.botoesPainel());
|
|
714
|
-
}
|
|
715
|
-
iniciarResizeObserver() {
|
|
716
|
-
typeof ResizeObserver > "u" || (this.observerResize = new ResizeObserver(() => {
|
|
717
|
-
this.ajustarColapsoGrupos();
|
|
718
|
-
}), this.observerResize.observe(this.painelElement));
|
|
719
|
-
}
|
|
720
|
-
ajustarColapsoGrupos() {
|
|
721
|
-
const t = this._abas.find((i) => i.id === this._abaAtiva);
|
|
722
|
-
if (!t || !t.grupos.length) return;
|
|
723
|
-
const e = this.gruposElement;
|
|
724
|
-
if (e.scrollWidth > e.clientWidth) {
|
|
725
|
-
const i = [...t.grupos].filter((r) => !this.gruposColapsados.has(r.id)).sort((r, a) => (r.prioridade ?? 0) - (a.prioridade ?? 0));
|
|
726
|
-
i.length > 0 && (this.gruposColapsados.add(i[0].id), this.renderizarPainel());
|
|
727
|
-
} else if (this.gruposColapsados.size > 0) {
|
|
728
|
-
const i = [...t.grupos].filter((r) => this.gruposColapsados.has(r.id)).sort((r, a) => (a.prioridade ?? 0) - (r.prioridade ?? 0));
|
|
729
|
-
i.length > 0 && (this.gruposColapsados.delete(i[0].id), this.renderizarPainel(), e.scrollWidth > e.clientWidth && (this.gruposColapsados.add(i[0].id), this.renderizarPainel()));
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
alternarMenuGrupoColapsado(t, e) {
|
|
733
|
-
var r;
|
|
734
|
-
const i = ((r = this.menu) == null ? void 0 : r.ancora) === t;
|
|
735
|
-
this.fecharMenu(), !i && (t.setAttribute("aria-expanded", "true"), this.menu = P(
|
|
736
|
-
this.shadowRoot,
|
|
737
|
-
t,
|
|
738
|
-
e.itens,
|
|
739
|
-
(a) => {
|
|
740
|
-
const n = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(a.id)}"]`);
|
|
741
|
-
if (n) this.acionar(n, !1);
|
|
742
|
-
else {
|
|
743
|
-
const l = a.ativo;
|
|
744
|
-
a.tipo === "toggle" ? a.ativo = !l : a.tipo === "ferramenta" && (a.ativo = !0), this.emitir(a) || (a.ativo = l);
|
|
745
|
-
}
|
|
746
|
-
this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
lado: "baixo",
|
|
750
|
-
onFechar: () => {
|
|
751
|
-
t.setAttribute("aria-expanded", "false"), this.menu = null;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
));
|
|
755
|
-
}
|
|
756
|
-
criarBotao(t, e, i) {
|
|
757
|
-
return j(this.efetivo(t), e, i);
|
|
758
|
-
}
|
|
759
|
-
botoesPainel() {
|
|
760
|
-
return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
|
|
761
|
-
}
|
|
762
|
-
get rtl() {
|
|
763
|
-
return getComputedStyle(this).direction === "rtl";
|
|
764
|
-
}
|
|
765
|
-
alternarKeyTips() {
|
|
766
|
-
if (this.keytipsAtivas = !this.keytipsAtivas, this.shadowRoot.querySelectorAll(".ui-ribbon__keytip").forEach((e) => e.remove()), !this.keytipsAtivas) return;
|
|
767
|
-
Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")).forEach((e, i) => {
|
|
768
|
-
const r = document.createElement("span");
|
|
769
|
-
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);
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
acionar(t, e) {
|
|
773
|
-
var n;
|
|
774
|
-
const i = this._abas.find((l) => l.id === this._abaAtiva), r = i == null ? void 0 : i.grupos.find((l) => m(l.itens, t.dataset.id)), a = r && m(r.itens, t.dataset.id);
|
|
775
|
-
if (!(!a || a.disabled)) {
|
|
776
|
-
if ((n = a.filhos) != null && n.length && !a.dividido) {
|
|
777
|
-
this.alternarMenu(t, a, e);
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
if (a.tipo === "toggle") {
|
|
781
|
-
const l = a.ativo;
|
|
782
|
-
a.ativo = !l, A(t, a), this.emitir(a) || (a.ativo = l, A(t, a));
|
|
783
|
-
} else if (a.tipo === "ferramenta") {
|
|
784
|
-
const l = a.ativo, c = r ? r.exclusivo !== !1 : !0, u = c && r ? r.itens.filter((p) => p.tipo === "ferramenta" && p.id !== a.id && p.ativo) : [];
|
|
785
|
-
a.ativo = !0, A(t, a), c && u.forEach((p) => {
|
|
786
|
-
p.ativo = !1;
|
|
787
|
-
const f = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(p.id)}"]`);
|
|
788
|
-
f && A(f, p);
|
|
789
|
-
}), this.emitir(a) || (a.ativo = l, A(t, a), c && u.forEach((p) => {
|
|
790
|
-
p.ativo = !0;
|
|
791
|
-
const f = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(p.id)}"]`);
|
|
792
|
-
f && A(f, p);
|
|
793
|
-
}));
|
|
794
|
-
} else
|
|
795
|
-
this.emitir(a);
|
|
796
|
-
this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
alternarMenu(t, e, i) {
|
|
800
|
-
var a;
|
|
801
|
-
const r = ((a = this.menu) == null ? void 0 : a.ancora) === t;
|
|
802
|
-
this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = P(
|
|
803
|
-
this.shadowRoot,
|
|
804
|
-
t,
|
|
805
|
-
e.filhos,
|
|
806
|
-
(n) => {
|
|
807
|
-
if (n.tipo === "toggle") {
|
|
808
|
-
const l = n.ativo;
|
|
809
|
-
n.ativo = !l, this.emitir(n, e) || (n.ativo = l);
|
|
810
|
-
} else
|
|
811
|
-
this.emitir(n, e);
|
|
812
|
-
this.rootElement.classList.remove("ui-ribbon--aberto");
|
|
813
|
-
},
|
|
814
|
-
{
|
|
815
|
-
lado: "baixo",
|
|
816
|
-
focar: i,
|
|
817
|
-
onFechar: () => {
|
|
818
|
-
t.setAttribute("aria-expanded", "false"), this.menu = null;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
));
|
|
822
|
-
}
|
|
823
|
-
fecharMenu() {
|
|
824
|
-
var t;
|
|
825
|
-
(t = this.menu) == null || t.fechar(), this.menu = null;
|
|
826
|
-
}
|
|
827
|
-
/** Retorna false se o consumidor cancelou o evento (preventDefault). */
|
|
828
|
-
emitir(t, e) {
|
|
829
|
-
return this.dispatchEvent(
|
|
830
|
-
new CustomEvent("ui-ferramenta", {
|
|
831
|
-
detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
|
|
832
|
-
bubbles: !0,
|
|
833
|
-
composed: !0,
|
|
834
|
-
cancelable: !0
|
|
835
|
-
})
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
N("ui-ribbon", mt);
|
|
840
|
-
const gt = ':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}}', vt = 380, xt = 8, _t = 50;
|
|
841
|
-
class At {
|
|
842
|
-
constructor() {
|
|
843
|
-
d(this, "timer");
|
|
844
|
-
d(this, "timerSupressao");
|
|
845
|
-
d(this, "inicio", null);
|
|
846
|
-
d(this, "suprimir", !1);
|
|
847
|
-
}
|
|
848
|
-
/** Começa a contar; `aoDisparar` roda se o ponteiro ficar parado até `TEMPO_PRESSAO_LONGA_MS`. */
|
|
849
|
-
iniciar(s, t, e) {
|
|
850
|
-
this.cancelar(), window.clearTimeout(this.timerSupressao), this.inicio = { x: s, y: t }, this.timer = window.setTimeout(() => {
|
|
851
|
-
this.suprimir = !0, e();
|
|
852
|
-
}, vt);
|
|
853
|
-
}
|
|
854
|
-
/** Arrastar/rolar com o dedo cancela o clique longo. */
|
|
855
|
-
mover(s, t) {
|
|
856
|
-
this.timer === void 0 || !this.inicio || Math.hypot(s - this.inicio.x, t - this.inicio.y) > xt && this.cancelar();
|
|
857
|
-
}
|
|
858
|
-
/** Fim do gesto: cancela a contagem e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
|
|
859
|
-
fim() {
|
|
860
|
-
this.cancelar(), this.suprimir && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
|
|
861
|
-
this.suprimir = !1;
|
|
862
|
-
}, _t));
|
|
863
|
-
}
|
|
864
|
-
cancelar() {
|
|
865
|
-
this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0), this.inicio = null;
|
|
866
|
-
}
|
|
867
|
-
/** `true` (uma única vez) se o próximo `click` deve ser ignorado por ser o resíduo de uma pressão longa. */
|
|
868
|
-
consumirSupressao() {
|
|
869
|
-
return this.suprimir ? (this.suprimir = !1, window.clearTimeout(this.timerSupressao), !0) : !1;
|
|
870
|
-
}
|
|
871
|
-
destruir() {
|
|
872
|
-
this.cancelar(), window.clearTimeout(this.timerSupressao), this.suprimir = !1;
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
function wt(o, s) {
|
|
876
|
-
return o.find(s) ?? o[0];
|
|
877
|
-
}
|
|
878
|
-
const yt = /* @__PURE__ */ new Set(["textbox", "searchbox", "combobox", "spinbutton"]);
|
|
879
|
-
function Et(o) {
|
|
880
|
-
const s = o[0];
|
|
881
|
-
return s && (/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName) || s.isContentEditable) ? !0 : o.some((t) => {
|
|
882
|
-
var r, a;
|
|
883
|
-
const e = t, i = (r = e.getAttribute) == null ? void 0 : r.call(e, "role");
|
|
884
|
-
return ((a = e.getAttribute) == null ? void 0 : a.call(e, "aria-modal")) === "true" || !!i && yt.has(i);
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
function Ct(o, s, t, e) {
|
|
888
|
-
const i = typeof o == "string" ? { key: o, ctrlKey: !1, metaKey: !1, altKey: !1, shiftKey: !1 } : o;
|
|
889
|
-
if (!i || !i.key) return null;
|
|
890
|
-
const r = s.filter((l) => !l.disabled && U(i, l.atalho));
|
|
891
|
-
if (r.length === 0) return null;
|
|
892
|
-
let a = r[0];
|
|
893
|
-
if (r.length > 1) {
|
|
894
|
-
const l = r.findIndex((c) => c.id === e);
|
|
895
|
-
a = r[(l + 1) % r.length];
|
|
896
|
-
}
|
|
897
|
-
const n = t.find((l) => {
|
|
898
|
-
var c;
|
|
899
|
-
return (c = l.filhos) == null ? void 0 : c.some((u) => u.id === a.id);
|
|
900
|
-
});
|
|
901
|
-
return { alvo: a, pai: n };
|
|
902
|
-
}
|
|
903
|
-
const kt = { sm: 16, md: 18, lg: 22 };
|
|
904
|
-
class St extends $ {
|
|
905
|
-
constructor() {
|
|
906
|
-
super();
|
|
907
|
-
d(this, "rootElement");
|
|
908
|
-
d(this, "_ferramentas", []);
|
|
909
|
-
d(this, "_ativo", "");
|
|
910
|
-
d(this, "_pendente", "");
|
|
911
|
-
d(this, "visiveis", /* @__PURE__ */ new Map());
|
|
912
|
-
// id do grupo → id do filho exibido
|
|
913
|
-
d(this, "menu", null);
|
|
914
|
-
d(this, "pressao", new At());
|
|
915
|
-
d(this, "listeners", new M());
|
|
916
|
-
d(this, "tooltip", null);
|
|
917
|
-
d(this, "_modoControlado", !1);
|
|
918
|
-
d(this, "handleClick", (t) => {
|
|
919
|
-
if (this.pressao.consumirSupressao()) return;
|
|
920
|
-
const e = t.target.closest(".ui-ferr-btn"), i = e != null && e.dataset.id ? m(this._ferramentas, e.dataset.id) : void 0;
|
|
921
|
-
if (!e || !i) return;
|
|
922
|
-
const r = e.dataset.grupo ? m(this._ferramentas, e.dataset.grupo) : void 0;
|
|
923
|
-
this.acionar(i, r);
|
|
924
|
-
});
|
|
925
|
-
d(this, "handleFocusIn", (t) => Y(this.botoes(), t.target));
|
|
926
|
-
d(this, "handlePointerDown", (t) => {
|
|
927
|
-
const e = t;
|
|
928
|
-
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
929
|
-
const i = t.target.closest(".ui-ferr-btn--grupo");
|
|
930
|
-
!i || i.disabled || this.pressao.iniciar(e.clientX ?? 0, e.clientY ?? 0, () => this.abrirFlyout(i, !1));
|
|
931
|
-
});
|
|
932
|
-
d(this, "handlePointerMove", (t) => {
|
|
933
|
-
const e = t;
|
|
934
|
-
this.pressao.mover(e.clientX ?? 0, e.clientY ?? 0);
|
|
935
|
-
});
|
|
936
|
-
d(this, "handlePointerFim", () => this.pressao.fim());
|
|
937
|
-
d(this, "handleContextMenu", (t) => {
|
|
938
|
-
const e = t.target.closest(".ui-ferr-btn--grupo");
|
|
939
|
-
e && (t.preventDefault(), this.pressao.cancelar(), this.abrirFlyout(e, !1));
|
|
940
|
-
});
|
|
941
|
-
d(this, "handleKeyDown", (t) => {
|
|
942
|
-
var l;
|
|
943
|
-
const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = this.colunas;
|
|
944
|
-
if (!e && r === 2) {
|
|
945
|
-
if (at(t, this.botoes(), i)) return;
|
|
946
|
-
} else {
|
|
947
|
-
const c = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], u = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
|
|
948
|
-
if (R(t, this.botoes(), c, u)) return;
|
|
949
|
-
}
|
|
950
|
-
const a = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", n = t.target instanceof HTMLButtonElement ? t.target : null;
|
|
951
|
-
n != null && n.dataset.grupo && t.key === a && (t.preventDefault(), ((l = this.menu) == null ? void 0 : l.ancora) === n ? this.menu.focarPrimeiro() : this.abrirFlyout(n, !0));
|
|
952
|
-
});
|
|
953
|
-
d(this, "handleAtalho", (t) => {
|
|
954
|
-
if (!this.hasAttribute("atalhos") || t.defaultPrevented || Et(t.composedPath()) || !this.donaDosAtalhos()) return;
|
|
955
|
-
const e = Ct(t, this.todasFerramentas(), this._ferramentas, this._ativo);
|
|
956
|
-
e && (t.preventDefault(), this.acionar(e.alvo, e.pai));
|
|
957
|
-
});
|
|
958
|
-
const t = this.attachShadow({ mode: "open" });
|
|
959
|
-
t.innerHTML = `
|
|
960
|
-
<style>${V}${gt}</style>
|
|
961
|
-
<div class="ui-paleta ui-paleta--vertical" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
|
|
962
|
-
`, this.rootElement = t.querySelector(".ui-paleta");
|
|
963
|
-
}
|
|
964
|
-
static get observedAttributes() {
|
|
965
|
-
return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "aria-label", "copiar-dados", "modo-controlado"];
|
|
966
|
-
}
|
|
967
|
-
connectedCallback() {
|
|
968
|
-
var e;
|
|
969
|
-
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);
|
|
970
|
-
const t = this.getAttribute("valor") || this.getAttribute("value");
|
|
971
|
-
t && !this._ativo && (this._pendente = t), this.aplicarPendente(), this.renderizar();
|
|
972
|
-
}
|
|
973
|
-
disconnectedCallback() {
|
|
974
|
-
var t;
|
|
975
|
-
this.pressao.destruir(), this.fecharMenu(), (t = this.tooltip) == null || t.destruir(), this.tooltip = null, this.listeners.cleanup();
|
|
976
|
-
}
|
|
977
|
-
attributeChangedCallback(t, e, i) {
|
|
978
|
-
if (e !== i)
|
|
979
|
-
if (t === "valor" || t === "value") {
|
|
980
|
-
const r = this.getAttribute("valor") || this.getAttribute("value") || "";
|
|
981
|
-
r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
|
|
982
|
-
} else
|
|
983
|
-
this.renderizar();
|
|
984
|
-
}
|
|
985
|
-
/* ---------- API pública ---------- */
|
|
986
|
-
/**
|
|
987
|
-
* Quando `true` ou atributo `copiar-dados` / `modo-controlado`: clona a árvore de itens
|
|
988
|
-
* para não mutar os objetos fornecidos pelo consumidor (Item 11).
|
|
989
|
-
*/
|
|
990
|
-
get modoControlado() {
|
|
991
|
-
return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
|
|
992
|
-
}
|
|
993
|
-
set modoControlado(t) {
|
|
994
|
-
this._modoControlado = !!t;
|
|
995
|
-
}
|
|
996
|
-
get copiarDados() {
|
|
997
|
-
return this.modoControlado;
|
|
998
|
-
}
|
|
999
|
-
set copiarDados(t) {
|
|
1000
|
-
this.modoControlado = t;
|
|
1001
|
-
}
|
|
1002
|
-
get ferramentas() {
|
|
1003
|
-
return this._ferramentas;
|
|
1004
|
-
}
|
|
1005
|
-
set ferramentas(t) {
|
|
1006
|
-
const e = Array.isArray(t) ? t : [];
|
|
1007
|
-
this._ferramentas = this.modoControlado ? e.map((i) => {
|
|
1008
|
-
var r;
|
|
1009
|
-
return { ...i, filhos: (r = i.filhos) == null ? void 0 : r.map((a) => ({ ...a })) };
|
|
1010
|
-
}) : e, T(q(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
|
|
1011
|
-
}
|
|
1012
|
-
get valor() {
|
|
1013
|
-
return this._ativo;
|
|
1014
|
-
}
|
|
1015
|
-
set valor(t) {
|
|
1016
|
-
this.ativar(t);
|
|
1017
|
-
}
|
|
1018
|
-
get value() {
|
|
1019
|
-
return this.valor;
|
|
1020
|
-
}
|
|
1021
|
-
set value(t) {
|
|
1022
|
-
this.valor = t;
|
|
1023
|
-
}
|
|
1024
|
-
get orientacao() {
|
|
1025
|
-
return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
|
|
1026
|
-
}
|
|
1027
|
-
set orientacao(t) {
|
|
1028
|
-
this.setAttribute("orientacao", t);
|
|
1029
|
-
}
|
|
1030
|
-
get colunas() {
|
|
1031
|
-
return this.getAttribute("colunas") === "2" ? 2 : 1;
|
|
1032
|
-
}
|
|
1033
|
-
set colunas(t) {
|
|
1034
|
-
this.setAttribute("colunas", String(t));
|
|
1035
|
-
}
|
|
1036
|
-
get tamanho() {
|
|
1037
|
-
const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
|
|
1038
|
-
return t === "sm" || t === "lg" ? t : "md";
|
|
1039
|
-
}
|
|
1040
|
-
set tamanho(t) {
|
|
1041
|
-
this.setAttribute("tamanho", t);
|
|
1042
|
-
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
|
|
1045
|
-
* `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
|
|
1046
|
-
*/
|
|
1047
|
-
ativar(t, e = !0) {
|
|
1048
|
-
if (!t) {
|
|
1049
|
-
this.limpar(e);
|
|
1050
|
-
return;
|
|
1051
|
-
}
|
|
1052
|
-
const i = m(this._ferramentas, t);
|
|
1053
|
-
if (!i) {
|
|
1054
|
-
this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
|
|
1058
|
-
console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
|
|
1059
|
-
return;
|
|
1060
|
-
}
|
|
1061
|
-
this._pendente = "";
|
|
1062
|
-
const r = this._ativo;
|
|
1063
|
-
this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
|
|
1064
|
-
}
|
|
1065
|
-
/** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
|
|
1066
|
-
limpar(t = !0) {
|
|
1067
|
-
const e = this._ativo;
|
|
1068
|
-
!e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
|
|
1069
|
-
}
|
|
1070
|
-
atualizarItem(t, e) {
|
|
1071
|
-
var n;
|
|
1072
|
-
const i = m(this._ferramentas, t);
|
|
1073
|
-
if (!i) {
|
|
1074
|
-
console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
|
|
1075
|
-
return;
|
|
1076
|
-
}
|
|
1077
|
-
Object.assign(i, e);
|
|
1078
|
-
const r = Object.keys(e).every((l) => l === "ativo" || l === "disabled"), a = this._ferramentas.find((l) => {
|
|
1079
|
-
var c;
|
|
1080
|
-
return (c = l.filhos) == null ? void 0 : c.some((u) => u.id === t);
|
|
1081
|
-
});
|
|
1082
|
-
if (r && !(a && "disabled" in e)) {
|
|
1083
|
-
const l = this.botoes().find((c) => c.dataset.id === t || c.dataset.grupo === t);
|
|
1084
|
-
if (l) {
|
|
1085
|
-
A(l, this.itemParaBotao(a ?? i)), W(this.botoes());
|
|
1086
|
-
return;
|
|
1087
|
-
}
|
|
1088
|
-
if (a || (n = i.filhos) != null && n.length) return;
|
|
1089
|
-
}
|
|
1090
|
-
this.renderizar();
|
|
1091
|
-
}
|
|
1092
|
-
/* ---------- Estado interno ---------- */
|
|
1093
|
-
refletirValor(t) {
|
|
1094
|
-
const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
|
|
1095
|
-
this.getAttribute(e) !== t && this.setAttribute(e, t);
|
|
1096
|
-
}
|
|
1097
|
-
aplicarPendente() {
|
|
1098
|
-
if (!this._pendente) return;
|
|
1099
|
-
const t = m(this._ferramentas, this._pendente);
|
|
1100
|
-
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 = "");
|
|
1101
|
-
}
|
|
1102
|
-
definirAtivoInterno(t) {
|
|
1103
|
-
this._ativo = t;
|
|
1104
|
-
const e = this._ferramentas.find((i) => {
|
|
1105
|
-
var r;
|
|
1106
|
-
return (r = i.filhos) == null ? void 0 : r.some((a) => a.id === t);
|
|
1107
|
-
});
|
|
1108
|
-
e && this.visiveis.set(e.id, t);
|
|
1109
|
-
}
|
|
1110
|
-
emitirMudanca(t, e, i) {
|
|
1111
|
-
const r = { valor: t, item: e, anterior: i };
|
|
1112
|
-
this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
|
|
1113
|
-
}
|
|
1114
|
-
/** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
|
|
1115
|
-
itemExibido(t) {
|
|
1116
|
-
var a;
|
|
1117
|
-
if (!((a = t.filhos) != null && a.length)) return t;
|
|
1118
|
-
const e = (n) => n.tipo !== "separador" && !n.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((n) => n.id === i);
|
|
1119
|
-
return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((n) => n.tipo !== "separador") ?? t.filhos[0];
|
|
1120
|
-
}
|
|
1121
|
-
itemParaBotao(t) {
|
|
1122
|
-
const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
|
|
1123
|
-
return {
|
|
1124
|
-
...e,
|
|
1125
|
-
tipo: i,
|
|
1126
|
-
ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
|
|
1127
|
-
filhos: t.filhos
|
|
1128
|
-
};
|
|
1129
|
-
}
|
|
1130
|
-
todasFerramentas() {
|
|
1131
|
-
return this._ferramentas.flatMap((t) => {
|
|
1132
|
-
var e;
|
|
1133
|
-
return (e = t.filhos) != null && e.length ? t.filhos : [t];
|
|
1134
|
-
}).filter((t) => t.tipo !== "separador");
|
|
1135
|
-
}
|
|
1136
|
-
/* ---------- Renderização ---------- */
|
|
1137
|
-
renderizar() {
|
|
1138
|
-
var c;
|
|
1139
|
-
const t = (c = this.shadowRoot) == null ? void 0 : c.activeElement, e = t && t.classList.contains("ui-ferr-btn") ? { id: t.dataset.id ?? "", grupo: t.dataset.grupo ?? "" } : null;
|
|
1140
|
-
this.fecharMenu();
|
|
1141
|
-
const i = this.orientacao, r = this.tamanho, a = this.colunas;
|
|
1142
|
-
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 = "";
|
|
1143
|
-
const n = kt[r] ?? 18;
|
|
1144
|
-
this._ferramentas.forEach((u) => {
|
|
1145
|
-
var g;
|
|
1146
|
-
if (u.tipo === "separador") {
|
|
1147
|
-
const _ = document.createElement("div");
|
|
1148
|
-
_.className = "ui-paleta__sep", _.setAttribute("role", "separator"), this.rootElement.appendChild(_);
|
|
1149
|
-
return;
|
|
1150
|
-
}
|
|
1151
|
-
const p = this.itemExibido(u), f = j(this.itemParaBotao(u), "paleta", n);
|
|
1152
|
-
f.dataset.id = p.id, (g = u.filhos) != null && g.length && (f.dataset.grupo = u.id), this.rootElement.appendChild(f);
|
|
1153
|
-
}), F(this.botoes());
|
|
1154
|
-
const l = this.botoes().find((u) => u.dataset.id === this._ativo && !u.disabled);
|
|
1155
|
-
if (l && (this.botoes().forEach((u) => u.tabIndex = -1), l.tabIndex = 0), e) {
|
|
1156
|
-
const u = this.botoes().find((p) => e.grupo ? p.dataset.grupo === e.grupo : p.dataset.id === e.id);
|
|
1157
|
-
u && !u.disabled && u.focus();
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
botoes() {
|
|
1161
|
-
return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
|
|
1162
|
-
}
|
|
1163
|
-
/** Reflete no botão o estado atual do item (sem recriar o DOM). */
|
|
1164
|
-
atualizarBotaoDe(t, e) {
|
|
1165
|
-
const i = this.botoes().find((r) => r.dataset.id === t.id);
|
|
1166
|
-
i && A(i, this.itemParaBotao(e ?? t));
|
|
1167
|
-
}
|
|
1168
|
-
/* ---------- Interação ---------- */
|
|
1169
|
-
acionar(t, e) {
|
|
1170
|
-
if (t.disabled) return;
|
|
1171
|
-
const i = t.tipo ?? "ferramenta", r = this._ativo, a = t.ativo;
|
|
1172
|
-
i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
|
|
1173
|
-
new CustomEvent("ui-ferramenta", {
|
|
1174
|
-
detail: {
|
|
1175
|
-
id: t.id,
|
|
1176
|
-
item: t,
|
|
1177
|
-
pai: e,
|
|
1178
|
-
ativo: i === "ferramenta" ? !0 : t.ativo,
|
|
1179
|
-
origem: "paleta"
|
|
1180
|
-
},
|
|
1181
|
-
bubbles: !0,
|
|
1182
|
-
composed: !0,
|
|
1183
|
-
cancelable: !0
|
|
1184
|
-
})
|
|
1185
|
-
) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = a, this.atualizarBotaoDe(t, e)));
|
|
1186
|
-
}
|
|
1187
|
-
/** Várias paletas com `atalhos` na página: só a que contém o foco (ou a primeira no DOM) responde. */
|
|
1188
|
-
donaDosAtalhos() {
|
|
1189
|
-
const t = Array.from(document.querySelectorAll("ui-paleta-ferramentas[atalhos]"));
|
|
1190
|
-
return t.length <= 1 ? !0 : wt(t, (e) => {
|
|
1191
|
-
var i;
|
|
1192
|
-
return e.matches(":focus-within") || !!((i = e.shadowRoot) != null && i.activeElement);
|
|
1193
|
-
}) === this;
|
|
1194
|
-
}
|
|
1195
|
-
abrirFlyout(t, e) {
|
|
1196
|
-
var a;
|
|
1197
|
-
const i = t.dataset.grupo ? m(this._ferramentas, t.dataset.grupo) : void 0;
|
|
1198
|
-
if (!((a = i == null ? void 0 : i.filhos) != null && a.length)) return;
|
|
1199
|
-
this.fecharMenu();
|
|
1200
|
-
const r = i.filhos.map((n) => ({
|
|
1201
|
-
...n,
|
|
1202
|
-
ativo: (n.tipo ?? "ferramenta") === "ferramenta" ? n.id === this._ativo : n.ativo
|
|
1203
|
-
}));
|
|
1204
|
-
t.setAttribute("aria-expanded", "true"), this.menu = P(
|
|
1205
|
-
this.shadowRoot,
|
|
1206
|
-
t,
|
|
1207
|
-
r,
|
|
1208
|
-
(n) => {
|
|
1209
|
-
var c;
|
|
1210
|
-
const l = m(i.filhos, n.id);
|
|
1211
|
-
l && (this.acionar(l, i), (c = this.botoes().find((u) => u.dataset.grupo === i.id)) == null || c.focus());
|
|
1212
|
-
},
|
|
1213
|
-
{
|
|
1214
|
-
lado: this.getAttribute("orientacao") === "horizontal" ? "baixo" : "direita",
|
|
1215
|
-
focar: e,
|
|
1216
|
-
tipoPadrao: "ferramenta",
|
|
1217
|
-
onFechar: () => {
|
|
1218
|
-
t.setAttribute("aria-expanded", "false"), this.menu = null;
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
);
|
|
1222
|
-
}
|
|
1223
|
-
fecharMenu() {
|
|
1224
|
-
var t;
|
|
1225
|
-
(t = this.menu) == null || t.fechar(), this.menu = null;
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
N("ui-paleta-ferramentas", St);
|
|
1229
|
-
export {
|
|
1230
|
-
et as U,
|
|
1231
|
-
St as a,
|
|
1232
|
-
mt as b
|
|
1233
|
-
};
|