@thibezer/ui-components-kit 2.17.0 → 2.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/camadas.cjs +85 -86
- package/dist/camadas.js +1380 -1331
- package/dist/components/ui-camadas/camadas-colecao.d.ts +3 -0
- package/dist/components/ui-camadas/camadas-drag-drop.d.ts +3 -1
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +1 -0
- package/dist/cores.cjs +1 -1
- package/dist/cores.js +2 -2
- package/dist/custom-elements.json +19922 -19922
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/register.cjs +1 -1
- package/dist/register.js +2 -2
- package/dist/{ui-controle-cores-Bq_XUrIQ.cjs → ui-controle-cores-B1w_Yl69.cjs} +1 -1
- package/dist/{ui-controle-cores-BtA6yzu3.js → ui-controle-cores-BRjMvmMn.js} +1 -1
- package/dist/ui-seletor-cor-CMuuW-Ym.cjs +83 -0
- package/dist/ui-seletor-cor-DFIQ1sin.js +405 -0
- package/package.json +1 -1
- package/dist/form-validacao-BIOXxt-1.js +0 -140
- package/dist/form-validacao-ytRYSF3E.cjs +0 -1
- package/dist/gerencigeo-canvas/layer_defaults.d.ts +0 -3
- package/dist/gerencigeo-canvas/layer_instance_ops.d.ts +0 -6
- package/dist/gerencigeo-canvas/layer_state_ops.d.ts +0 -6
- package/dist/leaflet-DcO7uRC-.cjs +0 -1
- package/dist/leaflet-PPDKB6Dd.js +0 -69
- package/dist/motor-BCWqlv3e.cjs +0 -1
- package/dist/motor-CXjQjVba.js +0 -1386
- package/dist/svg-seguro-BsbNQqpd.js +0 -50
- package/dist/svg-seguro-C76iLlAZ.cjs +0 -1
- package/dist/ui-badge-1UU8vT-b.js +0 -198
- package/dist/ui-badge-B5J_c5P5.js +0 -197
- package/dist/ui-badge-BxT-sDmV.cjs +0 -28
- package/dist/ui-badge-C0eKBI8E.js +0 -183
- package/dist/ui-badge-CKKKPdt8.cjs +0 -28
- package/dist/ui-badge-DC4y6Dik.cjs +0 -28
- package/dist/ui-botao-BOOnP8ds.cjs +0 -12
- package/dist/ui-botao-D24oXySA.cjs +0 -12
- package/dist/ui-botao-DfqSivHl.js +0 -165
- package/dist/ui-botao-Dsj08jjw.js +0 -165
- package/dist/ui-botao-OGJV6Vfk.js +0 -165
- package/dist/ui-botao-bU_bf6SU.js +0 -166
- package/dist/ui-botao-psS1juof.cjs +0 -12
- package/dist/ui-botao-xTbH5mpH.cjs +0 -12
- package/dist/ui-campo-texto-19tIrmBK.js +0 -377
- package/dist/ui-campo-texto-CH8mzX61.cjs +0 -16
- package/dist/ui-campo-texto-Cnn2UAkS.cjs +0 -16
- package/dist/ui-campo-texto-DVU_sWV1.cjs +0 -16
- package/dist/ui-campo-texto-Uu2dJE_0.js +0 -379
- package/dist/ui-campo-texto-W5M0gNE4.js +0 -377
- package/dist/ui-card-0wu4rjEX.cjs +0 -20
- package/dist/ui-card-B86lJXTP.cjs +0 -20
- package/dist/ui-card-BYyYxxY1.cjs +0 -20
- package/dist/ui-card-C_o5_0cB.js +0 -111
- package/dist/ui-card-CojoGXaT.js +0 -144
- package/dist/ui-card-DRtpOo3l.js +0 -143
- package/dist/ui-controle-cores-B4R6ct4I.js +0 -291
- package/dist/ui-controle-cores-BS0WYPdi.js +0 -572
- package/dist/ui-controle-cores-C8um-If9.cjs +0 -32
- package/dist/ui-controle-cores-CHMKGemo.cjs +0 -141
- package/dist/ui-controle-cores-C_cVXxCn.js +0 -291
- package/dist/ui-controle-cores-CuDFS8Y8.cjs +0 -32
- package/dist/ui-controle-cores-Dog7ERYv.js +0 -697
- package/dist/ui-controle-cores-Er6ZcQ7U.cjs +0 -111
- package/dist/ui-linha-BxhEBn27.js +0 -749
- package/dist/ui-linha-C306zxWG.cjs +0 -19
- package/dist/ui-linha-C_azWkcG.js +0 -517
- package/dist/ui-linha-CcalUBDw.cjs +0 -38
- package/dist/ui-linha-DAz6DBcl.cjs +0 -38
- package/dist/ui-linha-DkxwMhD-.js +0 -749
- package/dist/ui-modal-4nU-tXjO.cjs +0 -18
- package/dist/ui-modal-BkYvNP0G.js +0 -214
- package/dist/ui-modal-BwB9fksp.js +0 -214
- package/dist/ui-modal-CUNbpbZ1.cjs +0 -18
- package/dist/ui-modal-CvGFGh1h.cjs +0 -18
- package/dist/ui-modal-DBOtSTbR.js +0 -238
- package/dist/ui-paleta-ferramentas-BXXrI1Y7.js +0 -1233
- package/dist/ui-paleta-ferramentas-CEZYcN4J.js +0 -624
- package/dist/ui-paleta-ferramentas-CU4icLl0.js +0 -1171
- package/dist/ui-paleta-ferramentas-Ccmo-rB5.cjs +0 -21
- package/dist/ui-paleta-ferramentas-CsPMTY0G.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DLwZHIDv.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DNN5i6nL.js +0 -860
- package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +0 -18
- package/dist/ui-paleta-ferramentas-DbwdWVtT.js +0 -1173
- package/dist/ui-paleta-ferramentas-bvqxj1Yd.cjs +0 -21
- package/dist/ui-segmented-D6b6zxVs.cjs +0 -19
- package/dist/ui-segmented-DyF5YLsV.js +0 -418
- package/dist/ui-segmented-rn9RxRGM.cjs +0 -19
- package/dist/ui-segmented-wUraId2e.js +0 -412
- package/dist/ui-seletor-cor-C4U2eqxY.cjs +0 -82
- package/dist/ui-seletor-cor-D2_C6Aor.js +0 -391
- package/dist/ui-seletor-cor-DPKqf5wb.cjs +0 -82
- package/dist/ui-seletor-cor-FYtRccnK.js +0 -396
- package/dist/ui-skeleton-B2Rgrv8o.js +0 -648
- package/dist/ui-skeleton-DEHwpDqa.js +0 -648
- package/dist/ui-skeleton-DI4_9WOX.js +0 -428
- package/dist/ui-skeleton-DiOxTBZK.cjs +0 -52
- package/dist/ui-skeleton-SPYqku8P.cjs +0 -52
- package/dist/ui-skeleton-W9uwIceA.js +0 -585
- package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
- package/dist/ui-skeleton-sIphhOSx.cjs +0 -52
- package/dist/ui-switch-BL-x_-SM.js +0 -1202
- package/dist/ui-switch-BcOqOkiV.js +0 -856
- package/dist/ui-switch-C0i_3QXu.cjs +0 -66
- package/dist/ui-switch-D7iPKDj-.cjs +0 -53
- package/dist/ui-switch-DAIgOhqr.cjs +0 -66
- package/dist/ui-switch-_F8yubdX.js +0 -1203
- package/dist/ui-tabela-propriedades-2bq2nX-b.js +0 -3202
- package/dist/ui-tabela-propriedades-8IAYmk3P.cjs +0 -142
- package/dist/ui-tabela-propriedades-B8AwlpqL.cjs +0 -141
- package/dist/ui-tabela-propriedades-BBr5sqki.cjs +0 -145
- package/dist/ui-tabela-propriedades-BecPqC-e.cjs +0 -141
- package/dist/ui-tabela-propriedades-BoYXzP5Z.js +0 -3191
- package/dist/ui-tabela-propriedades-BokvDD3b.js +0 -2648
- package/dist/ui-tabela-propriedades-Boy7I5yW.js +0 -2412
- package/dist/ui-tabela-propriedades-C-PeuW1i.cjs +0 -141
- package/dist/ui-tabela-propriedades-C5YYnod1.js +0 -3053
- package/dist/ui-tabela-propriedades-CnfW9DZG.cjs +0 -142
- package/dist/ui-tabela-propriedades-CyPyKXtB.js +0 -3013
- package/dist/ui-tabela-propriedades-DWOKznMN.cjs +0 -142
- package/dist/ui-tabela-propriedades-Df9ajC6M.js +0 -2648
- package/dist/ui-tabela-propriedades-DqvPilK_.cjs +0 -142
- package/dist/ui-tabela-propriedades-DuaC4sFX.js +0 -2767
- package/dist/ui-toast-Bp_NlM5G.js +0 -156
- package/dist/ui-toast-DGTZKne5.cjs +0 -20
- package/dist/zero-js-triggers-C_KrvFOQ.js +0 -244
- package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
package/dist/ui-card-CojoGXaT.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
var x = Object.defineProperty;
|
|
2
|
-
var g = (t, i, e) => i in t ? x(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e;
|
|
3
|
-
var s = (t, i, e) => g(t, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
-
import { L as y } from "./listener-bag-DQgv7OON.js";
|
|
5
|
-
import { d as E, S as A } from "./ssr-safe-5cWfJP-s.js";
|
|
6
|
-
import { e as _, a as w } from "./opcoes-CupvWVIm.js";
|
|
7
|
-
const k = ':host{display:block;width:100%;box-sizing:border-box}:host([hidden]){display:none}:host(.h-full),:host([style*="height: 100%"]){height:100%}.ui-card{display:flex;flex-direction:column;width:100%;height:100%;box-sizing:border-box;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-card--plano{background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:none}.ui-card--elevado{background-color:var(--ui-cor-fundo-elevado, #1e1e24);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .4));border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent)}.ui-card--destaque{border-color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-card--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none}@media (hover: hover){.ui-card--clicavel:hover{transform:translateY(-3px);border-color:var(--ui-cor-primaria, #00E08A);box-shadow:var(--ui-sombra-lg, 0 10px 30px rgba(0, 0, 0, .5)),0 0 15px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}}.ui-card--clicavel:active{transform:translateY(-1px)}.ui-card--clicavel:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px;border-color:var(--ui-cor-primaria, #00E08A)}@media (prefers-reduced-motion: reduce){.ui-card{transition:none}.ui-card--clicavel:hover,.ui-card--clicavel:active{transform:none}}.ui-card--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-card__media{width:100%;overflow:hidden;display:block;line-height:0}::slotted([slot="midia"]),::slotted([slot="media"]){width:100%;height:auto;display:block;object-fit:cover}.ui-card__header{padding:14px 16px 8px;display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card__body{padding:12px 16px;flex:1;box-sizing:border-box}.ui-card__footer{padding:10px 16px 14px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card--compacto .ui-card__header{padding:10px 12px 6px}.ui-card--compacto .ui-card__body{padding:8px 12px}.ui-card--compacto .ui-card__footer{padding:8px 12px 10px}:host(.squarecircle) .ui-card,:host(.squarecircles) .ui-card,:host(.ui-squarecircle) .ui-card,:host(.ui-squarecircles) .ui-card,:host([formato="squarecircle"]) .ui-card,:host([formato="squarecircles"]) .ui-card,:host([formato="squircle"]) .ui-card{border-radius:var(--ui-raio-lg, 12px)}', C = [
|
|
8
|
-
"button",
|
|
9
|
-
"a",
|
|
10
|
-
"input",
|
|
11
|
-
"select",
|
|
12
|
-
"textarea",
|
|
13
|
-
"label",
|
|
14
|
-
"summary",
|
|
15
|
-
"ui-botao",
|
|
16
|
-
"ui-switch",
|
|
17
|
-
"ui-checkbox",
|
|
18
|
-
"ui-radio",
|
|
19
|
-
"ui-campo-texto",
|
|
20
|
-
"ui-segmented",
|
|
21
|
-
'[contenteditable]:not([contenteditable="false"])',
|
|
22
|
-
'[role="button"]',
|
|
23
|
-
'[role="link"]',
|
|
24
|
-
'[role="checkbox"]',
|
|
25
|
-
'[role="switch"]',
|
|
26
|
-
'[role="menuitem"]'
|
|
27
|
-
].join(", ");
|
|
28
|
-
function S(t, i) {
|
|
29
|
-
if (typeof Element > "u" || !(t instanceof Element)) return !1;
|
|
30
|
-
const e = t.closest(C);
|
|
31
|
-
return e !== null && e !== i && i.contains(e);
|
|
32
|
-
}
|
|
33
|
-
function q(t, i) {
|
|
34
|
-
return t.key !== "Enter" && t.key !== " " || t.repeat || t.ctrlKey || t.altKey || t.metaKey ? !1 : t.target === i;
|
|
35
|
-
}
|
|
36
|
-
function L(t, i, e) {
|
|
37
|
-
return Array.from(i.children).some((r) => e.includes(r.getAttribute("slot") ?? "")) ? !0 : t ? Array.from(t.querySelectorAll("slot")).filter((r) => e.includes(r.name)).some(
|
|
38
|
-
(r) => r.assignedNodes({ flatten: !0 }).some(
|
|
39
|
-
(o) => o.nodeType === 1 || o.nodeType === 3 && (o.textContent ?? "").trim() !== ""
|
|
40
|
-
)
|
|
41
|
-
) : !1;
|
|
42
|
-
}
|
|
43
|
-
const v = ["plano", "elevado", "destaque"];
|
|
44
|
-
class O extends A {
|
|
45
|
-
constructor() {
|
|
46
|
-
super();
|
|
47
|
-
s(this, "cardElement");
|
|
48
|
-
s(this, "listeners", new y());
|
|
49
|
-
s(this, "handleSlotChange", () => {
|
|
50
|
-
this.syncState();
|
|
51
|
-
});
|
|
52
|
-
s(this, "handleClick", (e) => {
|
|
53
|
-
this.disabled || !this.clicavel || e && S(e.target, this) || this.emitirClique();
|
|
54
|
-
});
|
|
55
|
-
s(this, "handleKeyDown", (e) => {
|
|
56
|
-
!this.clicavel || this.disabled || !q(e, this.cardElement) || (e.preventDefault(), this.emitirClique());
|
|
57
|
-
});
|
|
58
|
-
const e = this.attachShadow({ mode: "open" });
|
|
59
|
-
e.innerHTML = `
|
|
60
|
-
<style>${k}</style>
|
|
61
|
-
<div class="ui-card" part="base">
|
|
62
|
-
<div class="ui-card__media" part="midia">
|
|
63
|
-
<slot name="midia"></slot>
|
|
64
|
-
<slot name="media"></slot>
|
|
65
|
-
</div>
|
|
66
|
-
<div class="ui-card__header" part="cabecalho">
|
|
67
|
-
<slot name="cabecalho"></slot>
|
|
68
|
-
<slot name="header"></slot>
|
|
69
|
-
</div>
|
|
70
|
-
<div class="ui-card__body" part="corpo">
|
|
71
|
-
<slot></slot>
|
|
72
|
-
</div>
|
|
73
|
-
<div class="ui-card__footer" part="rodape">
|
|
74
|
-
<slot name="rodape"></slot>
|
|
75
|
-
<slot name="footer"></slot>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
`, this.cardElement = e.querySelector(".ui-card");
|
|
79
|
-
}
|
|
80
|
-
static get observedAttributes() {
|
|
81
|
-
return [
|
|
82
|
-
"elevacao",
|
|
83
|
-
"elevation",
|
|
84
|
-
"variante",
|
|
85
|
-
"variant",
|
|
86
|
-
"formato",
|
|
87
|
-
"clicavel",
|
|
88
|
-
"clickable",
|
|
89
|
-
"compacto",
|
|
90
|
-
"compact",
|
|
91
|
-
"disabled",
|
|
92
|
-
"aria-label"
|
|
93
|
-
];
|
|
94
|
-
}
|
|
95
|
-
connectedCallback() {
|
|
96
|
-
var a;
|
|
97
|
-
this.listeners.cleanup(), this.listeners.add(this.cardElement, "click", this.handleClick), this.listeners.add(this.cardElement, "keydown", this.handleKeyDown);
|
|
98
|
-
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelectorAll("slot");
|
|
99
|
-
e == null || e.forEach((c) => this.listeners.add(c, "slotchange", this.handleSlotChange)), this.syncState();
|
|
100
|
-
}
|
|
101
|
-
disconnectedCallback() {
|
|
102
|
-
this.listeners.cleanup();
|
|
103
|
-
}
|
|
104
|
-
attributeChangedCallback(e, a, c) {
|
|
105
|
-
this.syncState();
|
|
106
|
-
}
|
|
107
|
-
/** Leva o foco ao card clicável e habilitado; nos demais casos mantém o comportamento nativo do host. */
|
|
108
|
-
focus(e) {
|
|
109
|
-
this.clicavel && !this.disabled ? this.cardElement.focus(e) : super.focus(e);
|
|
110
|
-
}
|
|
111
|
-
get clicavel() {
|
|
112
|
-
return this.hasAttribute("clicavel") || this.hasAttribute("clickable");
|
|
113
|
-
}
|
|
114
|
-
set clicavel(e) {
|
|
115
|
-
e ? this.setAttribute("clicavel", "") : (this.removeAttribute("clicavel"), this.removeAttribute("clickable")), this.syncState();
|
|
116
|
-
}
|
|
117
|
-
get disabled() {
|
|
118
|
-
return this.hasAttribute("disabled");
|
|
119
|
-
}
|
|
120
|
-
set disabled(e) {
|
|
121
|
-
e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
122
|
-
}
|
|
123
|
-
syncState() {
|
|
124
|
-
var b, m, p, f;
|
|
125
|
-
const e = _(this.getAttribute("elevacao") || this.getAttribute("elevation"), v, "plano"), a = w(this.getAttribute("variante") || this.getAttribute("variant"), v), c = this.clicavel, r = this.hasAttribute("compacto") || this.hasAttribute("compact"), o = this.disabled;
|
|
126
|
-
if (this.cardElement.className = "ui-card", this.cardElement.classList.add(`ui-card--${e}`), a && this.cardElement.classList.add(`ui-card--${a}`), c) {
|
|
127
|
-
this.cardElement.classList.add("ui-card--clicavel"), this.cardElement.setAttribute("role", "button"), this.cardElement.setAttribute("tabindex", o ? "-1" : "0");
|
|
128
|
-
const l = (b = this.getAttribute("aria-label")) == null ? void 0 : b.trim();
|
|
129
|
-
l ? this.cardElement.setAttribute("aria-label", l) : this.cardElement.removeAttribute("aria-label");
|
|
130
|
-
} else
|
|
131
|
-
this.cardElement.removeAttribute("role"), this.cardElement.removeAttribute("tabindex"), this.cardElement.removeAttribute("aria-label");
|
|
132
|
-
o ? this.cardElement.setAttribute("aria-disabled", "true") : this.cardElement.removeAttribute("aria-disabled"), r && this.cardElement.classList.add("ui-card--compacto"), o && this.cardElement.classList.add("ui-card--disabled");
|
|
133
|
-
const n = (m = this.shadowRoot) == null ? void 0 : m.querySelector(".ui-card__header"), u = (p = this.shadowRoot) == null ? void 0 : p.querySelector(".ui-card__footer"), h = (f = this.shadowRoot) == null ? void 0 : f.querySelector(".ui-card__media"), d = (l) => L(this.shadowRoot, this, l);
|
|
134
|
-
h && (h.style.display = d(["midia", "media"]) ? "block" : "none"), n && (n.style.display = d(["cabecalho", "header"]) ? "flex" : "none"), u && (u.style.display = d(["rodape", "footer"]) ? "flex" : "none");
|
|
135
|
-
}
|
|
136
|
-
emitirClique() {
|
|
137
|
-
const e = { id: this.id || "sem-id" };
|
|
138
|
-
this.dispatchEvent(new CustomEvent("ui-click", { detail: e, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-clique", { detail: { ...e }, bubbles: !0, composed: !0 }));
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
E("ui-card", O);
|
|
142
|
-
export {
|
|
143
|
-
O as U
|
|
144
|
-
};
|
package/dist/ui-card-DRtpOo3l.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
var x = Object.defineProperty;
|
|
2
|
-
var g = (t, i, e) => i in t ? x(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e;
|
|
3
|
-
var s = (t, i, e) => g(t, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
-
import { L as y } from "./listener-bag-DQgv7OON.js";
|
|
5
|
-
import { d as E, S as A } from "./ssr-safe-5cWfJP-s.js";
|
|
6
|
-
import { e as _, a as w } from "./opcoes-CupvWVIm.js";
|
|
7
|
-
const k = ':host{display:block;width:100%;box-sizing:border-box}:host([hidden]){display:none}:host(.h-full),:host([style*="height: 100%"]){height:100%}.ui-card{display:flex;flex-direction:column;width:100%;height:100%;box-sizing:border-box;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-card--plano{background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:none}.ui-card--elevado{background-color:var(--ui-cor-fundo-elevado, #1e1e24);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .4));border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent)}.ui-card--destaque{border-color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-card--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none}@media (hover: hover){.ui-card--clicavel:hover{transform:translateY(-3px);border-color:var(--ui-cor-primaria, #00E08A);box-shadow:var(--ui-sombra-lg, 0 10px 30px rgba(0, 0, 0, .5)),0 0 15px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}}.ui-card--clicavel:active{transform:translateY(-1px)}.ui-card--clicavel:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px;border-color:var(--ui-cor-primaria, #00E08A)}@media (prefers-reduced-motion: reduce){.ui-card{transition:none}.ui-card--clicavel:hover,.ui-card--clicavel:active{transform:none}}.ui-card--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-card__media{width:100%;overflow:hidden;display:block;line-height:0}::slotted([slot="midia"]),::slotted([slot="media"]){width:100%;height:auto;display:block;object-fit:cover}.ui-card__header{padding:14px 16px 8px;display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card__body{padding:12px 16px;flex:1;box-sizing:border-box}.ui-card__footer{padding:10px 16px 14px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card--compacto .ui-card__header{padding:10px 12px 6px}.ui-card--compacto .ui-card__body{padding:8px 12px}.ui-card--compacto .ui-card__footer{padding:8px 12px 10px}', C = [
|
|
8
|
-
"button",
|
|
9
|
-
"a",
|
|
10
|
-
"input",
|
|
11
|
-
"select",
|
|
12
|
-
"textarea",
|
|
13
|
-
"label",
|
|
14
|
-
"summary",
|
|
15
|
-
"ui-botao",
|
|
16
|
-
"ui-switch",
|
|
17
|
-
"ui-checkbox",
|
|
18
|
-
"ui-radio",
|
|
19
|
-
"ui-campo-texto",
|
|
20
|
-
"ui-segmented",
|
|
21
|
-
'[contenteditable]:not([contenteditable="false"])',
|
|
22
|
-
'[role="button"]',
|
|
23
|
-
'[role="link"]',
|
|
24
|
-
'[role="checkbox"]',
|
|
25
|
-
'[role="switch"]',
|
|
26
|
-
'[role="menuitem"]'
|
|
27
|
-
].join(", ");
|
|
28
|
-
function S(t, i) {
|
|
29
|
-
if (typeof Element > "u" || !(t instanceof Element)) return !1;
|
|
30
|
-
const e = t.closest(C);
|
|
31
|
-
return e !== null && e !== i && i.contains(e);
|
|
32
|
-
}
|
|
33
|
-
function q(t, i) {
|
|
34
|
-
return t.key !== "Enter" && t.key !== " " || t.repeat || t.ctrlKey || t.altKey || t.metaKey ? !1 : t.target === i;
|
|
35
|
-
}
|
|
36
|
-
function L(t, i, e) {
|
|
37
|
-
return Array.from(i.children).some((r) => e.includes(r.getAttribute("slot") ?? "")) ? !0 : t ? Array.from(t.querySelectorAll("slot")).filter((r) => e.includes(r.name)).some(
|
|
38
|
-
(r) => r.assignedNodes({ flatten: !0 }).some(
|
|
39
|
-
(o) => o.nodeType === 1 || o.nodeType === 3 && (o.textContent ?? "").trim() !== ""
|
|
40
|
-
)
|
|
41
|
-
) : !1;
|
|
42
|
-
}
|
|
43
|
-
const f = ["plano", "elevado", "destaque"];
|
|
44
|
-
class O extends A {
|
|
45
|
-
constructor() {
|
|
46
|
-
super();
|
|
47
|
-
s(this, "cardElement");
|
|
48
|
-
s(this, "listeners", new y());
|
|
49
|
-
s(this, "handleSlotChange", () => {
|
|
50
|
-
this.syncState();
|
|
51
|
-
});
|
|
52
|
-
s(this, "handleClick", (e) => {
|
|
53
|
-
this.disabled || !this.clicavel || e && S(e.target, this) || this.emitirClique();
|
|
54
|
-
});
|
|
55
|
-
s(this, "handleKeyDown", (e) => {
|
|
56
|
-
!this.clicavel || this.disabled || !q(e, this.cardElement) || (e.preventDefault(), this.emitirClique());
|
|
57
|
-
});
|
|
58
|
-
const e = this.attachShadow({ mode: "open" });
|
|
59
|
-
e.innerHTML = `
|
|
60
|
-
<style>${k}</style>
|
|
61
|
-
<div class="ui-card" part="base">
|
|
62
|
-
<div class="ui-card__media" part="midia">
|
|
63
|
-
<slot name="midia"></slot>
|
|
64
|
-
<slot name="media"></slot>
|
|
65
|
-
</div>
|
|
66
|
-
<div class="ui-card__header" part="cabecalho">
|
|
67
|
-
<slot name="cabecalho"></slot>
|
|
68
|
-
<slot name="header"></slot>
|
|
69
|
-
</div>
|
|
70
|
-
<div class="ui-card__body" part="corpo">
|
|
71
|
-
<slot></slot>
|
|
72
|
-
</div>
|
|
73
|
-
<div class="ui-card__footer" part="rodape">
|
|
74
|
-
<slot name="rodape"></slot>
|
|
75
|
-
<slot name="footer"></slot>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
`, this.cardElement = e.querySelector(".ui-card");
|
|
79
|
-
}
|
|
80
|
-
static get observedAttributes() {
|
|
81
|
-
return [
|
|
82
|
-
"elevacao",
|
|
83
|
-
"elevation",
|
|
84
|
-
"variante",
|
|
85
|
-
"variant",
|
|
86
|
-
"clicavel",
|
|
87
|
-
"clickable",
|
|
88
|
-
"compacto",
|
|
89
|
-
"compact",
|
|
90
|
-
"disabled",
|
|
91
|
-
"aria-label"
|
|
92
|
-
];
|
|
93
|
-
}
|
|
94
|
-
connectedCallback() {
|
|
95
|
-
var a;
|
|
96
|
-
this.listeners.cleanup(), this.listeners.add(this.cardElement, "click", this.handleClick), this.listeners.add(this.cardElement, "keydown", this.handleKeyDown);
|
|
97
|
-
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelectorAll("slot");
|
|
98
|
-
e == null || e.forEach((l) => this.listeners.add(l, "slotchange", this.handleSlotChange)), this.syncState();
|
|
99
|
-
}
|
|
100
|
-
disconnectedCallback() {
|
|
101
|
-
this.listeners.cleanup();
|
|
102
|
-
}
|
|
103
|
-
attributeChangedCallback(e, a, l) {
|
|
104
|
-
this.syncState();
|
|
105
|
-
}
|
|
106
|
-
/** Leva o foco ao card clicável e habilitado; nos demais casos mantém o comportamento nativo do host. */
|
|
107
|
-
focus(e) {
|
|
108
|
-
this.clicavel && !this.disabled ? this.cardElement.focus(e) : super.focus(e);
|
|
109
|
-
}
|
|
110
|
-
get clicavel() {
|
|
111
|
-
return this.hasAttribute("clicavel") || this.hasAttribute("clickable");
|
|
112
|
-
}
|
|
113
|
-
set clicavel(e) {
|
|
114
|
-
e ? this.setAttribute("clicavel", "") : (this.removeAttribute("clicavel"), this.removeAttribute("clickable")), this.syncState();
|
|
115
|
-
}
|
|
116
|
-
get disabled() {
|
|
117
|
-
return this.hasAttribute("disabled");
|
|
118
|
-
}
|
|
119
|
-
set disabled(e) {
|
|
120
|
-
e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
121
|
-
}
|
|
122
|
-
syncState() {
|
|
123
|
-
var b, m, p, v;
|
|
124
|
-
const e = _(this.getAttribute("elevacao") || this.getAttribute("elevation"), f, "plano"), a = w(this.getAttribute("variante") || this.getAttribute("variant"), f), l = this.clicavel, r = this.hasAttribute("compacto") || this.hasAttribute("compact"), o = this.disabled;
|
|
125
|
-
if (this.cardElement.className = "ui-card", this.cardElement.classList.add(`ui-card--${e}`), a && this.cardElement.classList.add(`ui-card--${a}`), l) {
|
|
126
|
-
this.cardElement.classList.add("ui-card--clicavel"), this.cardElement.setAttribute("role", "button"), this.cardElement.setAttribute("tabindex", o ? "-1" : "0");
|
|
127
|
-
const c = (b = this.getAttribute("aria-label")) == null ? void 0 : b.trim();
|
|
128
|
-
c ? this.cardElement.setAttribute("aria-label", c) : this.cardElement.removeAttribute("aria-label");
|
|
129
|
-
} else
|
|
130
|
-
this.cardElement.removeAttribute("role"), this.cardElement.removeAttribute("tabindex"), this.cardElement.removeAttribute("aria-label");
|
|
131
|
-
o ? this.cardElement.setAttribute("aria-disabled", "true") : this.cardElement.removeAttribute("aria-disabled"), r && this.cardElement.classList.add("ui-card--compacto"), o && this.cardElement.classList.add("ui-card--disabled");
|
|
132
|
-
const n = (m = this.shadowRoot) == null ? void 0 : m.querySelector(".ui-card__header"), u = (p = this.shadowRoot) == null ? void 0 : p.querySelector(".ui-card__footer"), h = (v = this.shadowRoot) == null ? void 0 : v.querySelector(".ui-card__media"), d = (c) => L(this.shadowRoot, this, c);
|
|
133
|
-
h && (h.style.display = d(["midia", "media"]) ? "block" : "none"), n && (n.style.display = d(["cabecalho", "header"]) ? "flex" : "none"), u && (u.style.display = d(["rodape", "footer"]) ? "flex" : "none");
|
|
134
|
-
}
|
|
135
|
-
emitirClique() {
|
|
136
|
-
const e = { id: this.id || "sem-id" };
|
|
137
|
-
this.dispatchEvent(new CustomEvent("ui-click", { detail: e, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-clique", { detail: { ...e }, bubbles: !0, composed: !0 }));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
E("ui-card", O);
|
|
141
|
-
export {
|
|
142
|
-
O as U
|
|
143
|
-
};
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
var k = Object.defineProperty;
|
|
2
|
-
var S = (d, l, e) => l in d ? k(d, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[l] = e;
|
|
3
|
-
var s = (d, l, e) => S(d, typeof l != "symbol" ? l + "" : l, e);
|
|
4
|
-
import { d as T, S as w } from "./ssr-safe-5cWfJP-s.js";
|
|
5
|
-
import { L as q } from "./listener-bag-DQgv7OON.js";
|
|
6
|
-
import { b as g, n as m, c as $, d as P, a as E } from "./ui-seletor-cor-D2_C6Aor.js";
|
|
7
|
-
const M = ':host{--_a: var(--ui-controle-cores-amostra, 26px);--_pilha: calc(var(--_a) * 5 / 3);--_borda: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 30%, transparent);--_borda-forte: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 70%, transparent);--_base: var(--ui-cor-superficie, #1d1d22);--_destaque: var(--ui-cor-primaria, #00e08a);--_vermelho: #ef4444;display:inline-block;flex-shrink:0;-webkit-user-select:none;user-select:none}:host([hidden]){display:none}*,*:before,*:after{box-sizing:border-box}.pilha{display:flex;align-items:stretch;gap:6px}.amostras{position:relative;flex:none;width:var(--_pilha);height:var(--_pilha)}.amostra{position:absolute;width:var(--_a);height:var(--_a);padding:0;background:var(--_base);border:1px solid var(--_borda);border-radius:6px;cursor:pointer;transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease,opacity .15s ease}.amostra--traco{right:0;bottom:0;z-index:1}.amostra--preenchimento{top:0;left:0;z-index:2;box-shadow:0 2px 6px #00000059}.amostra:hover{border-color:var(--_borda-forte);transform:scale(1.05)}.amostra:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:2px}.amostra--ativa,.amostra--ativa:hover{z-index:3;border-color:var(--_destaque);box-shadow:0 0 0 1.5px var(--_destaque),0 2px 6px #00000059}:host([so-traco]) .amostra--preenchimento{opacity:.4}.face{position:absolute;top:3px;right:3px;bottom:3px;left:3px;border-radius:3.5px;pointer-events:none}.face--traco{background:transparent;border:4px solid #ffffff}.face--sem-cor{background:repeating-conic-gradient(#3a3a45,#3a3a45 25%,#24242b 0%,#24242b 50%) 50% / 6px 6px!important;border-color:#ef44448c!important;overflow:hidden}.face--sem-cor:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(to top right,transparent calc(50% - 1px),var(--_vermelho) calc(50% - 1px),var(--_vermelho) calc(50% + 1px),transparent calc(50% + 1px))}.face--misto{display:flex;align-items:center;justify-content:center;background:#2e2e38!important;border-color:#64748b!important}.face--misto:after{content:"?";color:#fff;font-size:12px;font-weight:800;line-height:1;text-shadow:0 1px 2px rgba(0,0,0,.8)}.acoes{display:flex;flex:none;flex-direction:column;gap:2px;width:16px}.acao{display:flex;flex:1;align-items:center;justify-content:center;min-height:0;padding:0;background:transparent;border:0;border-radius:4px;color:var(--ui-cor-texto-secundario, #9696a6);cursor:pointer;transition:color .15s ease,background .15s ease}.acao:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 12%,transparent);color:var(--_destaque)}.acao:focus-visible{outline:2px solid var(--ui-cor-texto, #e1e1e6);outline-offset:1px}.acao svg{width:12px;height:12px}.acao--sem-cor:hover{background:#ef444433;color:var(--_vermelho)}.icone-padrao{position:relative;width:11px;height:11px}.ponto{position:absolute;width:7px;height:7px;border-radius:1.5px}.ponto--preenchimento{top:0;left:0;background:#00e08a;border:1px solid var(--_borda-forte)}.ponto--traco{right:0;bottom:0;background:var(--_base);border:1.5px solid #ffffff}:host([desabilitado]) .pilha{opacity:.5}:host([desabilitado]) .amostra,:host([desabilitado]) .acao{cursor:not-allowed;pointer-events:none}@media (prefers-reduced-motion: reduce){.amostra,.acao{transition:none}.amostra:hover{transform:none}}';
|
|
8
|
-
class j extends w {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
s(this, "raiz");
|
|
12
|
-
s(this, "listeners", new q());
|
|
13
|
-
s(this, "renderizado", !1);
|
|
14
|
-
s(this, "_preenchimento", "#00e08a");
|
|
15
|
-
s(this, "_traco", "#ffffff");
|
|
16
|
-
s(this, "_opacidade", 0.35);
|
|
17
|
-
s(this, "_espessuraTraco", 2.5);
|
|
18
|
-
s(this, "_alvo", "preenchimento");
|
|
19
|
-
s(this, "_misto", { preenchimento: !1, traco: !1 });
|
|
20
|
-
s(this, "_padrao", { preenchimento: "#00e08a", traco: "#ffffff" });
|
|
21
|
-
s(this, "_coresProjeto", []);
|
|
22
|
-
s(this, "_atalhos", {});
|
|
23
|
-
s(this, "seletor", null);
|
|
24
|
-
s(this, "estadoAoAbrir", null);
|
|
25
|
-
this.raiz = this.attachShadow({ mode: "open" });
|
|
26
|
-
}
|
|
27
|
-
static get observedAttributes() {
|
|
28
|
-
return ["preenchimento", "traco", "opacidade", "espessura-traco", "alvo", "padrao-preenchimento", "padrao-traco", "desabilitado"];
|
|
29
|
-
}
|
|
30
|
-
connectedCallback() {
|
|
31
|
-
this.renderizado || this.renderizar(), this.listeners.cleanup(), this.vincularEventos(), this.atualizar();
|
|
32
|
-
}
|
|
33
|
-
disconnectedCallback() {
|
|
34
|
-
this.fecharSeletor(!0), this.listeners.cleanup();
|
|
35
|
-
}
|
|
36
|
-
attributeChangedCallback(e, t, r) {
|
|
37
|
-
if (t !== r) {
|
|
38
|
-
if (e === "desabilitado") {
|
|
39
|
-
this.hasAttribute("desabilitado") && this.fecharSeletor(!1), this.atualizar();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (r !== null) {
|
|
43
|
-
if (e === "preenchimento") this.definirCores({ preenchimento: r });
|
|
44
|
-
else if (e === "traco") this.definirCores({ traco: r });
|
|
45
|
-
else if (e === "opacidade") this.definirCores({ opacidade: Number(r) });
|
|
46
|
-
else if (e === "espessura-traco") this.definirCores({ espessuraTraco: g(r) });
|
|
47
|
-
else if (e === "alvo") this.definirAlvo(r);
|
|
48
|
-
else if (e === "padrao-preenchimento" || e === "padrao-traco") {
|
|
49
|
-
const a = m(r);
|
|
50
|
-
if (!a) return;
|
|
51
|
-
e === "padrao-preenchimento" ? this._padrao.preenchimento = a : this._padrao.traco = a, this.atualizar();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/* ---------- Propriedades ---------- */
|
|
57
|
-
get preenchimento() {
|
|
58
|
-
return this._preenchimento;
|
|
59
|
-
}
|
|
60
|
-
set preenchimento(e) {
|
|
61
|
-
this.definirCores({ preenchimento: e });
|
|
62
|
-
}
|
|
63
|
-
get traco() {
|
|
64
|
-
return this._traco;
|
|
65
|
-
}
|
|
66
|
-
set traco(e) {
|
|
67
|
-
this.definirCores({ traco: e });
|
|
68
|
-
}
|
|
69
|
-
get opacidade() {
|
|
70
|
-
return this._opacidade;
|
|
71
|
-
}
|
|
72
|
-
set opacidade(e) {
|
|
73
|
-
this.definirCores({ opacidade: e });
|
|
74
|
-
}
|
|
75
|
-
get espessuraTraco() {
|
|
76
|
-
return this._espessuraTraco;
|
|
77
|
-
}
|
|
78
|
-
set espessuraTraco(e) {
|
|
79
|
-
this.definirCores({ espessuraTraco: e });
|
|
80
|
-
}
|
|
81
|
-
get alvo() {
|
|
82
|
-
return this._alvo;
|
|
83
|
-
}
|
|
84
|
-
set alvo(e) {
|
|
85
|
-
this.definirAlvo(e);
|
|
86
|
-
}
|
|
87
|
-
/** @deprecated Ignorado: o seletor de cor não mostra mais amostras de cores. */
|
|
88
|
-
get coresProjeto() {
|
|
89
|
-
return [...this._coresProjeto];
|
|
90
|
-
}
|
|
91
|
-
set coresProjeto(e) {
|
|
92
|
-
this._coresProjeto = $(e);
|
|
93
|
-
}
|
|
94
|
-
/** Teclas exibidas nas dicas dos botões (ex.: `{ inverter: 'Shift+X' }`). */
|
|
95
|
-
get atalhos() {
|
|
96
|
-
return { ...this._atalhos };
|
|
97
|
-
}
|
|
98
|
-
set atalhos(e) {
|
|
99
|
-
this._atalhos = { ...e || {} }, this.atualizar();
|
|
100
|
-
}
|
|
101
|
-
get seletorAberto() {
|
|
102
|
-
var e;
|
|
103
|
-
return !!((e = this.seletor) != null && e.aberto);
|
|
104
|
-
}
|
|
105
|
-
/* ---------- Métodos (sem eventos) ---------- */
|
|
106
|
-
/** Define cores, opacidade e/ou espessura sem emitir eventos. Valores inválidos são ignorados; uma cor definida deixa de ser "mista". */
|
|
107
|
-
definirCores(e = {}) {
|
|
108
|
-
const t = m(e.preenchimento), r = m(e.traco);
|
|
109
|
-
t && (this._preenchimento = t, this._misto.preenchimento = !1), r && (this._traco = r, this._misto.traco = !1), e.opacidade !== void 0 && (this._opacidade = P(e.opacidade, this._opacidade)), e.espessuraTraco !== void 0 && (this._espessuraTraco = g(e.espessuraTraco, this._espessuraTraco)), this.atualizar();
|
|
110
|
-
}
|
|
111
|
-
obterCores() {
|
|
112
|
-
return {
|
|
113
|
-
preenchimento: this._preenchimento,
|
|
114
|
-
traco: this._traco,
|
|
115
|
-
opacidade: this._opacidade,
|
|
116
|
-
espessuraTraco: this._espessuraTraco,
|
|
117
|
-
alvo: this._alvo
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
/** Marca a amostra como ativa sem emitir eventos. */
|
|
121
|
-
definirAlvo(e) {
|
|
122
|
-
this._alvo = e === "traco" ? "traco" : "preenchimento", this.atualizar(), this.sincronizarSeletor();
|
|
123
|
-
}
|
|
124
|
-
/** Mostra "?" nas amostras cujas cores divergem na seleção atual. */
|
|
125
|
-
definirMisto(e = {}) {
|
|
126
|
-
this._misto = { preenchimento: !!e.preenchimento, traco: !!e.traco }, this.atualizar();
|
|
127
|
-
}
|
|
128
|
-
/* ---------- Ações (emitem eventos) ---------- */
|
|
129
|
-
/** Alterna o alvo ativo entre preenchimento e traço; emite `ui-alvo-change`. */
|
|
130
|
-
alternarAlvo() {
|
|
131
|
-
this.mudarAlvo(this._alvo === "traco" ? "preenchimento" : "traco");
|
|
132
|
-
}
|
|
133
|
-
/** Troca preenchimento e traço; emite `ui-cores-change` confirmado. */
|
|
134
|
-
inverter() {
|
|
135
|
-
const e = this._preenchimento;
|
|
136
|
-
this._preenchimento = this._traco, this._traco = e, this._misto = { preenchimento: this._misto.traco, traco: this._misto.preenchimento }, this.atualizar(), this.emitirCores(!0, ["preenchimento", "traco"], "inverter");
|
|
137
|
-
}
|
|
138
|
-
/** "Sem cor" no alvo indicado (padrão: o ativo); emite `ui-cores-change` confirmado. */
|
|
139
|
-
semCor(e = this._alvo) {
|
|
140
|
-
const t = e === "traco" ? "traco" : "preenchimento";
|
|
141
|
-
t === "traco" ? this._traco = "none" : this._preenchimento = "none", this._misto[t] = !1, this.atualizar(), this.emitirCores(!0, [t], "sem-cor");
|
|
142
|
-
}
|
|
143
|
-
/** Volta às cores de `padrao-preenchimento` e `padrao-traco`; emite `ui-cores-change` confirmado. */
|
|
144
|
-
restaurarPadrao() {
|
|
145
|
-
this._preenchimento = this._padrao.preenchimento, this._traco = this._padrao.traco, this._misto = { preenchimento: !1, traco: !1 }, this.atualizar(), this.emitirCores(!0, ["preenchimento", "traco"], "padrao");
|
|
146
|
-
}
|
|
147
|
-
/** Abre o seletor de cor ancorado na amostra do alvo (que passa a ser o ativo). Com `focar`, leva o foco do teclado para o painel. */
|
|
148
|
-
abrirSeletor(e = this._alvo, t = !1) {
|
|
149
|
-
if (this.hasAttribute("desabilitado") || (this.mudarAlvo(e === "traco" ? "traco" : "preenchimento"), this.seletorAberto)) return;
|
|
150
|
-
const r = this.raiz.querySelector(`[data-alvo="${this._alvo}"]`) || this;
|
|
151
|
-
this.estadoAoAbrir = this.obterCores(), this.seletor = E({
|
|
152
|
-
ancora: r,
|
|
153
|
-
titulo: this.getAttribute("titulo-seletor") || "Cores e estilo",
|
|
154
|
-
modo: "duplo",
|
|
155
|
-
alvo: this._alvo,
|
|
156
|
-
preenchimento: this._preenchimento,
|
|
157
|
-
traco: this._traco,
|
|
158
|
-
opacidade: this._opacidade,
|
|
159
|
-
espessuraTraco: this._espessuraTraco,
|
|
160
|
-
misto: this._misto[this._alvo],
|
|
161
|
-
focar: t,
|
|
162
|
-
aoAlterar: (a) => this.aplicarDoSeletor(a, !1),
|
|
163
|
-
aoConfirmar: (a) => {
|
|
164
|
-
this.seletor = null, this.aplicarDoSeletor(a, !0);
|
|
165
|
-
},
|
|
166
|
-
aoCancelar: () => {
|
|
167
|
-
this.seletor = null, this.estadoAoAbrir = null;
|
|
168
|
-
},
|
|
169
|
-
aoTrocarAlvo: (a) => this.mudarAlvo(a)
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Fecha o seletor aberto por este controle. Com `confirmar` (padrão), grava o que foi editado;
|
|
174
|
-
* sem ele, cancela: as cores iniciais voltam (com um `ui-cores-change` não confirmado) e nada é confirmado.
|
|
175
|
-
*/
|
|
176
|
-
fecharSeletor(e = !0) {
|
|
177
|
-
const t = this.seletor;
|
|
178
|
-
t && (e ? t.fechar(!0) : t.elemento.cancelar());
|
|
179
|
-
}
|
|
180
|
-
/* ---------- Interno ---------- */
|
|
181
|
-
mudarAlvo(e) {
|
|
182
|
-
e !== this._alvo && (this._alvo = e, this.atualizar(), this.sincronizarSeletor(), this.dispatchEvent(new CustomEvent("ui-alvo-change", { detail: { alvo: e }, bubbles: !0, composed: !0 })));
|
|
183
|
-
}
|
|
184
|
-
/** Mantém a aba do seletor aberto igual ao alvo do controle. */
|
|
185
|
-
sincronizarSeletor() {
|
|
186
|
-
var e, t;
|
|
187
|
-
(t = (e = this.seletor) == null ? void 0 : e.elemento) == null || t.trocarAlvo(this._alvo);
|
|
188
|
-
}
|
|
189
|
-
aplicarDoSeletor(e, t) {
|
|
190
|
-
const r = (o) => {
|
|
191
|
-
const p = [];
|
|
192
|
-
return e.preenchimento !== o.preenchimento && p.push("preenchimento"), e.traco !== o.traco && p.push("traco"), e.opacidade !== o.opacidade && p.push("opacidade"), e.espessuraTraco !== void 0 && Math.abs(e.espessuraTraco - o.espessuraTraco) > 0.05 && p.push("espessuraTraco"), p;
|
|
193
|
-
}, a = r(this.obterCores());
|
|
194
|
-
if (this._preenchimento = e.preenchimento, this._traco = e.traco, this._opacidade = e.opacidade, e.espessuraTraco !== void 0 && (this._espessuraTraco = e.espessuraTraco), a.includes("preenchimento") && (this._misto.preenchimento = !1), a.includes("traco") && (this._misto.traco = !1), this.atualizar(), !t) {
|
|
195
|
-
a.length && this.emitirCores(!1, a, "seletor");
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
this.emitirCores(!0, this.estadoAoAbrir ? r(this.estadoAoAbrir) : a, "seletor"), this.estadoAoAbrir = null;
|
|
199
|
-
}
|
|
200
|
-
emitirCores(e, t, r) {
|
|
201
|
-
const a = { ...this.obterCores(), confirmado: e, alterados: t, origem: r };
|
|
202
|
-
this.dispatchEvent(new CustomEvent("ui-cores-change", { detail: a, bubbles: !0, composed: !0 }));
|
|
203
|
-
}
|
|
204
|
-
dica(e, t) {
|
|
205
|
-
return t ? `${e} [${t}]` : e;
|
|
206
|
-
}
|
|
207
|
-
renderizar() {
|
|
208
|
-
this.raiz.innerHTML = `
|
|
209
|
-
<style>${M}</style>
|
|
210
|
-
<div class="pilha" part="pilha" role="group" aria-label="Cores de desenho">
|
|
211
|
-
<div class="amostras" part="amostras">
|
|
212
|
-
<button type="button" class="amostra amostra--traco" data-alvo="traco" part="amostra amostra-traco">
|
|
213
|
-
<span class="face face--traco"></span>
|
|
214
|
-
</button>
|
|
215
|
-
<button type="button" class="amostra amostra--preenchimento" data-alvo="preenchimento" part="amostra amostra-preenchimento">
|
|
216
|
-
<span class="face face--preenchimento"></span>
|
|
217
|
-
</button>
|
|
218
|
-
</div>
|
|
219
|
-
<div class="acoes" part="acoes">
|
|
220
|
-
<button type="button" class="acao acao--inverter" data-acao="inverter" part="acao acao-inverter" aria-label="Inverter preenchimento e traço">
|
|
221
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
222
|
-
<path d="m16 3 4 4-4 4"/><path d="M20 7H4"/><path d="m8 21-4-4 4-4"/><path d="M4 17h16"/>
|
|
223
|
-
</svg>
|
|
224
|
-
</button>
|
|
225
|
-
<button type="button" class="acao acao--sem-cor" data-acao="sem-cor" part="acao acao-sem-cor" aria-label="Sem cor">
|
|
226
|
-
<svg viewBox="0 0 24 24" fill="none" stroke-width="2.4" stroke-linecap="round" aria-hidden="true">
|
|
227
|
-
<circle cx="12" cy="12" r="8" stroke="currentColor"/>
|
|
228
|
-
<line x1="6.5" y1="6.5" x2="17.5" y2="17.5" stroke="#ef4444"/>
|
|
229
|
-
</svg>
|
|
230
|
-
</button>
|
|
231
|
-
<button type="button" class="acao acao--padrao" data-acao="padrao" part="acao acao-padrao" aria-label="Restaurar cores padrão">
|
|
232
|
-
<span class="icone-padrao" aria-hidden="true">
|
|
233
|
-
<span class="ponto ponto--preenchimento"></span>
|
|
234
|
-
<span class="ponto ponto--traco"></span>
|
|
235
|
-
</span>
|
|
236
|
-
</button>
|
|
237
|
-
</div>
|
|
238
|
-
</div>
|
|
239
|
-
`, this.renderizado = !0;
|
|
240
|
-
}
|
|
241
|
-
vincularEventos() {
|
|
242
|
-
const e = this.raiz;
|
|
243
|
-
e.querySelectorAll("[data-alvo]").forEach((r) => {
|
|
244
|
-
const a = r.dataset.alvo;
|
|
245
|
-
this.listeners.add(r, "click", (o) => {
|
|
246
|
-
o.stopPropagation(), a !== this._alvo ? this.mudarAlvo(a) : this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(a);
|
|
247
|
-
}), this.listeners.add(r, "dblclick", (o) => {
|
|
248
|
-
o.stopPropagation(), this.abrirSeletor(a);
|
|
249
|
-
}), this.listeners.add(r, "keydown", (o) => {
|
|
250
|
-
o.key !== "Enter" && o.key !== " " || (o.preventDefault(), a === this._alvo && this.seletorAberto ? this.fecharSeletor(!0) : this.abrirSeletor(a, !0));
|
|
251
|
-
}), this.listeners.add(r, "keyup", (o) => {
|
|
252
|
-
o.key === " " && o.preventDefault();
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
const t = (r, a) => {
|
|
256
|
-
this.listeners.add(e.querySelector(`[data-acao="${r}"]`), "click", (o) => {
|
|
257
|
-
o.stopPropagation(), a();
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
t("inverter", () => this.inverter()), t("sem-cor", () => this.semCor()), t("padrao", () => this.restaurarPadrao());
|
|
261
|
-
}
|
|
262
|
-
atualizar() {
|
|
263
|
-
if (!this.renderizado) return;
|
|
264
|
-
const e = this.raiz, t = this._atalhos, r = this.hasAttribute("desabilitado"), a = (i, n) => n ? "Misto (?) [várias cores na seleção]" : i === "none" ? "Sem cor" : i, o = (i, n, c, y, z = "") => {
|
|
265
|
-
const h = e.querySelector(`[data-alvo="${i}"]`), u = h == null ? void 0 : h.querySelector(".face");
|
|
266
|
-
if (!h || !u) return;
|
|
267
|
-
const _ = this._alvo === i;
|
|
268
|
-
h.classList.toggle("amostra--ativa", _), h.setAttribute("aria-pressed", String(_)), h.disabled = r, u.classList.toggle("face--misto", c), u.classList.toggle("face--sem-cor", !c && n === "none");
|
|
269
|
-
const A = i === "traco" ? "borderColor" : "backgroundColor";
|
|
270
|
-
u.style[A] = c || n === "none" ? "" : n, i === "traco" && n !== "none" && !c && (u.style.borderWidth = `${Math.max(2, Math.min(4.5, this._espessuraTraco))}px`);
|
|
271
|
-
const x = `${y}: ${a(n, c)}${z}`;
|
|
272
|
-
h.title = this.dica(`${x} — clique para ativar, clique de novo para editar`, t.alternar), h.setAttribute("aria-label", x);
|
|
273
|
-
}, p = this._preenchimento === "none" || this._misto.preenchimento ? "" : `, opacidade ${Math.round(this._opacidade * 100)}%`;
|
|
274
|
-
o("preenchimento", this._preenchimento, this._misto.preenchimento, "Preenchimento", p);
|
|
275
|
-
const C = this._traco === "none" || this._misto.traco ? "" : `, espessura ${this._espessuraTraco}px`;
|
|
276
|
-
o("traco", this._traco, this._misto.traco, "Traço / contorno", C);
|
|
277
|
-
const f = (i, n) => {
|
|
278
|
-
const c = e.querySelector(`[data-acao="${i}"]`);
|
|
279
|
-
c && (c.title = n, c.disabled = r);
|
|
280
|
-
};
|
|
281
|
-
f("inverter", this.dica("Inverter preenchimento e traço", t.inverter)), f("sem-cor", this.dica("Sem cor no alvo ativo", t.semCor)), f("padrao", this.dica("Restaurar cores padrão", t.padrao));
|
|
282
|
-
const b = e.querySelector(".ponto--preenchimento");
|
|
283
|
-
b && (b.style.backgroundColor = this._padrao.preenchimento === "none" ? "transparent" : this._padrao.preenchimento);
|
|
284
|
-
const v = e.querySelector(".ponto--traco");
|
|
285
|
-
v && (v.style.borderColor = this._padrao.traco === "none" ? "#ef4444" : this._padrao.traco);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
T("ui-controle-cores", j);
|
|
289
|
-
export {
|
|
290
|
-
j as U
|
|
291
|
-
};
|