@thibezer/ui-components-kit 2.24.1 → 2.25.0

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.
Files changed (154) hide show
  1. package/CHANGELOG.md +83 -1
  2. package/dist/botao.cjs +12 -1
  3. package/dist/botao.js +162 -3
  4. package/dist/camadas.cjs +311 -1
  5. package/dist/camadas.js +3244 -148
  6. package/dist/campo-texto.cjs +16 -1
  7. package/dist/campo-texto.js +308 -7
  8. package/dist/canvas.cjs +22 -22
  9. package/dist/canvas.js +230 -233
  10. package/dist/card.cjs +20 -1
  11. package/dist/card.js +145 -2
  12. package/dist/components/ui-canvas-prancha/index.d.ts +1 -1
  13. package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +26 -0
  14. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +9 -0
  15. package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +2 -2
  16. package/dist/components/ui-editor-prancha/editor-barra.d.ts +19 -0
  17. package/dist/components/ui-editor-prancha/editor-modos.d.ts +35 -0
  18. package/dist/components/ui-editor-prancha/editor-tipos.d.ts +4 -0
  19. package/dist/components/ui-editor-prancha/index.d.ts +1 -0
  20. package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +63 -7
  21. package/dist/core/alvo-digitavel.d.ts +3 -0
  22. package/dist/core.cjs +1 -1
  23. package/dist/core.js +43 -54
  24. package/dist/{cores-utils-BrdynxRd.js → cores-utils-DMyqWvZh.js} +2 -2
  25. package/dist/cores.cjs +32 -1
  26. package/dist/cores.js +300 -13
  27. package/dist/custom-elements.json +11945 -11071
  28. package/dist/data.cjs +28 -1
  29. package/dist/data.js +286 -99
  30. package/dist/{feature_caixa-2Sxv3tGa.js → feature_caixa-BVc5LenS.js} +42 -42
  31. package/dist/{feature_desenho-BVHivWIB.js → feature_desenho-CC8Mp5Gp.js} +2 -2
  32. package/dist/feedback.cjs +52 -1
  33. package/dist/feedback.js +655 -25
  34. package/dist/forms.cjs +66 -1
  35. package/dist/forms.js +1216 -39
  36. package/dist/{geometria-px-DUs5FgLE.js → geometria-px-DHMPUsxC.js} +47 -47
  37. package/dist/index.cjs +67 -1
  38. package/dist/index.js +1476 -274
  39. package/dist/kit-base-BmkPi5Rz.cjs +2 -0
  40. package/dist/kit-base-CBXA66aM.js +1084 -0
  41. package/dist/mapa.cjs +5 -5
  42. package/dist/mapa.js +16 -17
  43. package/dist/modal.cjs +18 -1
  44. package/dist/modal.js +235 -29
  45. package/dist/motor.js +49 -49
  46. package/dist/prancha-nucleo.cjs +3 -1
  47. package/dist/prancha-nucleo.js +3120 -277
  48. package/dist/prancha.cjs +38 -1
  49. package/dist/prancha.js +3470 -228
  50. package/dist/register.cjs +1 -1
  51. package/dist/register.js +3 -20
  52. package/dist/seletor-mapa-base.cjs +13 -13
  53. package/dist/seletor-mapa-base.js +3 -5
  54. package/dist/tabela.cjs +142 -1
  55. package/dist/tabela.js +3773 -92
  56. package/dist/tipos-elementos.d.ts +7 -3
  57. package/dist/tipos-vue.d.ts +6 -3
  58. package/dist/tools.cjs +16 -1
  59. package/dist/tools.js +1564 -26
  60. package/dist/{ui-seletor-cor-Cd8jkzXG.js → ui-seletor-cor-CPjA9vhZ.js} +8 -9
  61. package/dist/ui-seletor-cor-D_ifitEN.cjs +83 -0
  62. package/dist/utils-ClVgqVyJ.cjs +1 -0
  63. package/dist/utils-DrHoxxmf.js +83 -0
  64. package/package.json +43 -2
  65. package/dist/acessibilidade-CSzX-DkG.cjs +0 -1
  66. package/dist/acessibilidade-CUlSXc2X.js +0 -38
  67. package/dist/altura-controle-ukMRPckR.cjs +0 -1
  68. package/dist/altura-controle-vxQiXG4q.js +0 -62
  69. package/dist/alvo-digitavel-CzCvNVQ3.js +0 -23
  70. package/dist/alvo-digitavel-DbH0hYFf.cjs +0 -1
  71. package/dist/degrade-CIxvOTUv.cjs +0 -1
  72. package/dist/degrade-gDa5sW__.js +0 -119
  73. package/dist/feature_caixa-CnYPKVFS.cjs +0 -1
  74. package/dist/feature_caixa-DCs9ZeSk.js +0 -1038
  75. package/dist/feature_historico-BAIYk1Me.cjs +0 -3
  76. package/dist/feature_historico-C4h9y5fu.js +0 -3039
  77. package/dist/form-atalhos-7JTYvumA.cjs +0 -1
  78. package/dist/form-atalhos-DDTlpgaB.js +0 -203
  79. package/dist/form-erros-CwPz7Jr4.cjs +0 -1
  80. package/dist/form-erros-DT5HklfD.js +0 -184
  81. package/dist/form-submissao-C-SPRKgT.js +0 -61
  82. package/dist/form-submissao-DxKO5MHI.cjs +0 -1
  83. package/dist/form-validacao-BlQFxUVj.js +0 -104
  84. package/dist/form-validacao-DIeyQVH5.cjs +0 -1
  85. package/dist/geometria-px-DKrWq_XY.js +0 -639
  86. package/dist/leaflet-CEPcxGWV.cjs +0 -1
  87. package/dist/leaflet-DOq10gfg.js +0 -84
  88. package/dist/leaflet-loader-94z5VsdY.cjs +0 -2
  89. package/dist/leaflet-loader-Cjcdgj5R.js +0 -21
  90. package/dist/listener-bag-D5omxZ9h.cjs +0 -1
  91. package/dist/listener-bag-DQgv7OON.js +0 -34
  92. package/dist/motor-By2te6PZ.js +0 -1400
  93. package/dist/motor-CkMxd378.cjs +0 -1
  94. package/dist/opcoes-CupvWVIm.js +0 -24
  95. package/dist/opcoes-vdAUY5OI.cjs +0 -1
  96. package/dist/parts-CaoQiCfI.js +0 -7
  97. package/dist/parts-vQa2873h.cjs +0 -1
  98. package/dist/prancha-paleta-BZ-9QDgh.js +0 -5276
  99. package/dist/prancha-paleta-Bb24vP71.cjs +0 -17
  100. package/dist/ssr-safe-5cWfJP-s.js +0 -10
  101. package/dist/ssr-safe-CiHD1adl.cjs +0 -1
  102. package/dist/svg-seguro-ChVJ2L2z.js +0 -74
  103. package/dist/svg-seguro-J2RM1Ssf.cjs +0 -1
  104. package/dist/ui-badge-DE58YSBY.cjs +0 -28
  105. package/dist/ui-badge-KgmI3jOD.js +0 -201
  106. package/dist/ui-botao-Dz8YvmiA.cjs +0 -12
  107. package/dist/ui-botao-zLkcMMyP.js +0 -168
  108. package/dist/ui-bus-CUd99VJi.js +0 -177
  109. package/dist/ui-bus-XqBLlTYQ.cjs +0 -1
  110. package/dist/ui-camadas-DoHPnbQm.js +0 -3133
  111. package/dist/ui-camadas-Vx7wYD4D.cjs +0 -311
  112. package/dist/ui-campo-texto-Dliyt9qr.cjs +0 -16
  113. package/dist/ui-campo-texto-btevggO3.js +0 -379
  114. package/dist/ui-card-7IEYbCN0.js +0 -150
  115. package/dist/ui-card-Bx8EyzYY.cjs +0 -20
  116. package/dist/ui-card-C-EJoKnm.js +0 -150
  117. package/dist/ui-card-DFnRp9bl.js +0 -146
  118. package/dist/ui-card-DrWVJQKw.cjs +0 -20
  119. package/dist/ui-card-DsIjHMmG.cjs +0 -20
  120. package/dist/ui-controle-cores-B1w_Yl69.cjs +0 -32
  121. package/dist/ui-controle-cores-BRjMvmMn.js +0 -291
  122. package/dist/ui-controle-cores-BcH9k2Fa.js +0 -292
  123. package/dist/ui-controle-cores-CvSTP6gJ.cjs +0 -32
  124. package/dist/ui-editor-prancha-CIngI6yI.js +0 -2886
  125. package/dist/ui-editor-prancha-DorSe6sC.cjs +0 -31
  126. package/dist/ui-linha-2kY7TNUJ.cjs +0 -38
  127. package/dist/ui-linha-B4mBRm1x.cjs +0 -61
  128. package/dist/ui-linha-DTEIIww4.js +0 -1167
  129. package/dist/ui-linha-KFF86FW5.js +0 -752
  130. package/dist/ui-modal-BrXzVZ65.js +0 -216
  131. package/dist/ui-modal-lARKzEVZ.cjs +0 -18
  132. package/dist/ui-paleta-ferramentas-Bu6JaT0s.js +0 -1245
  133. package/dist/ui-paleta-ferramentas-D3Jhwt26.cjs +0 -21
  134. package/dist/ui-paleta-ferramentas-DebHYiwd.js +0 -1615
  135. package/dist/ui-paleta-ferramentas-Dgejtluh.js +0 -1423
  136. package/dist/ui-paleta-ferramentas-hzyo8wBt.cjs +0 -22
  137. package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +0 -22
  138. package/dist/ui-seletor-cor-0RLjcME6.cjs +0 -83
  139. package/dist/ui-seletor-cor-CMuuW-Ym.cjs +0 -83
  140. package/dist/ui-seletor-cor-DFIQ1sin.js +0 -405
  141. package/dist/ui-skeleton-BLEV6h3k.js +0 -653
  142. package/dist/ui-skeleton-B_XTaGrX.cjs +0 -52
  143. package/dist/ui-switch-BXIDwC-Y.cjs +0 -66
  144. package/dist/ui-switch-Ctxk-jKS.js +0 -1212
  145. package/dist/ui-tabela-CXxqbwXv.cjs +0 -7
  146. package/dist/ui-tabela-Cd0vOwnT.js +0 -1459
  147. package/dist/ui-tabela-propriedades-C5cIF5ES.js +0 -3779
  148. package/dist/ui-tabela-propriedades-CJyo568n.js +0 -3517
  149. package/dist/ui-tabela-propriedades-D96Djx-q.cjs +0 -136
  150. package/dist/ui-tabela-propriedades-Wa34hfIr.cjs +0 -142
  151. package/dist/ui-tabela-propriedades-ahQhQauu.js +0 -2329
  152. package/dist/ui-tabela-propriedades-w9JWhjHy.cjs +0 -142
  153. package/dist/zero-js-triggers-CJT988bR.js +0 -83
  154. package/dist/zero-js-triggers-CgM9IIQB.cjs +0 -1
@@ -1,1167 +0,0 @@
1
- var W = Object.defineProperty;
2
- var Y = (a, o, t) => o in a ? W(a, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[o] = t;
3
- var s = (a, o, t) => Y(a, typeof o != "symbol" ? o + "" : o, t);
4
- import { d as _, S as D } from "./ssr-safe-5cWfJP-s.js";
5
- import { e as A, a as E, b as w } from "./opcoes-CupvWVIm.js";
6
- import { A as N, a as L } from "./degrade-gDa5sW__.js";
7
- import { F as P } from "./ui-campo-texto-btevggO3.js";
8
- import { L as $ } from "./listener-bag-DQgv7OON.js";
9
- import { a as J } from "./parts-CaoQiCfI.js";
10
- import { b as q, c as tt } from "./altura-controle-vxQiXG4q.js";
11
- const et = ':host{display:block;box-sizing:border-box;margin:0;padding:0;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([inline]){display:inline-block}.ui-texto{margin:0;padding:0;box-sizing:border-box;font-family:inherit;color:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;overflow-wrap:break-word}.ui-texto--h1{font-size:var(--ui-tamanho-h1, clamp(24px, 4vw, 36px));font-weight:var(--ui-peso-negrito, 700);line-height:var(--ui-altura-linha-titulo, 1.25);letter-spacing:-.5px}.ui-texto--h2{font-size:var(--ui-tamanho-h2, clamp(20px, 3vw, 28px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25);letter-spacing:-.3px}.ui-texto--h3{font-size:var(--ui-tamanho-h3, clamp(18px, 2.4vw, 24px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h4{font-size:var(--ui-tamanho-h4, clamp(16px, 2vw, 20px));font-weight:var(--ui-peso-medio, 500);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h5{font-size:var(--ui-tamanho-h5, clamp(14px, 1.6vw, 18px));font-weight:var(--ui-peso-medio, 500);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h6{font-size:var(--ui-tamanho-h6, clamp(13px, 1.2vw, 16px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25);text-transform:uppercase;letter-spacing:.5px}.ui-texto--corpo{font-size:var(--ui-tamanho-corpo, 14px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5)}.ui-texto--corpo-sm{font-size:var(--ui-tamanho-corpo-sm, 13px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5)}.ui-texto--caption{font-size:var(--ui-tamanho-caption, 11px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-compacta, 1.2);color:var(--ui-cor-texto-secundario, #888899)}.ui-texto--codigo{font-family:var(--ui-fonte-codigo, monospace);font-size:var(--ui-tamanho-codigo, 12px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5);background:var(--ui-cor-fundo-elevado, #1a1a1e);padding:2px 6px;border-radius:var(--ui-raio-sm, 4px);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-texto--cor-primaria{color:var(--ui-cor-primaria, #00E08A)}.ui-texto--cor-secundaria{color:var(--ui-cor-texto-secundario, #888899)}.ui-texto--cor-destaque{color:var(--ui-cor-destaque, #00E08A)}.ui-texto--cor-erro{color:var(--ui-cor-texto-erro, #ff5555)}.ui-texto--cor-sucesso{color:var(--ui-cor-texto-sucesso, #00E08A)}.ui-texto--cor-alerta{color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-texto--peso-normal{font-weight:var(--ui-peso-normal, 400)!important}.ui-texto--peso-medio{font-weight:var(--ui-peso-medio, 500)!important}.ui-texto--peso-seminegrito{font-weight:var(--ui-peso-seminegrito, 600)!important}.ui-texto--peso-negrito{font-weight:var(--ui-peso-negrito, 700)!important}.ui-texto--alinhamento-esquerda{text-align:left}.ui-texto--alinhamento-centro{text-align:center}.ui-texto--alinhamento-direita{text-align:right}.ui-texto--alinhamento-justificado{text-align:justify;-webkit-hyphens:auto;hyphens:auto}.ui-texto--truncar{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}.ui-texto--linhas{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--ui-texto-linhas, 3);line-clamp:var(--ui-texto-linhas, 3);overflow:hidden}@media print{.ui-texto--linhas{-webkit-line-clamp:unset;line-clamp:unset;display:block;overflow:visible}}:host(.degrade) .ui-texto:not(.ui-texto--codigo),:host(.ui-degrade) .ui-texto:not(.ui-texto--codigo),:host(.gradiente) .ui-texto:not(.ui-texto--codigo),:host(.ui-gradiente) .ui-texto:not(.ui-texto--codigo),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])) .ui-texto:not(.ui-texto--codigo),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])) .ui-texto:not(.ui-texto--codigo),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])) .ui-texto:not(.ui-texto--codigo),.ui-texto[data-degrade=ativo]:not(.ui-texto--codigo){background:var(--ui-degrade-interno, var(--ui-texto-fundo, var(--ui-gradiente-texto, var(--ui-gradiente-primario))));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}:host(.degrade) .ui-texto--codigo,:host(.ui-degrade) .ui-texto--codigo,:host(.gradiente) .ui-texto--codigo,:host(.ui-gradiente) .ui-texto--codigo,.ui-texto--codigo[data-degrade=ativo]{background:var(--ui-degrade-interno, var(--ui-texto-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e))))}', B = ["h1", "h2", "h3", "h4", "h5", "h6", "corpo", "corpo-sm", "caption", "codigo"], it = ["primaria", "secundaria", "destaque", "erro", "sucesso", "alerta"], at = ["normal", "medio", "seminegrito", "negrito"], ot = ["esquerda", "centro", "direita", "justificado"], rt = /* @__PURE__ */ new Set([
12
- "p",
13
- "span",
14
- "div",
15
- "h1",
16
- "h2",
17
- "h3",
18
- "h4",
19
- "h5",
20
- "h6",
21
- "small",
22
- "code",
23
- "strong",
24
- "em",
25
- "label",
26
- "blockquote",
27
- "pre",
28
- "b",
29
- "i"
30
- ]), nt = 50;
31
- class st extends D {
32
- constructor() {
33
- super();
34
- s(this, "container", null);
35
- s(this, "shadow", null);
36
- if (typeof this.attachShadow == "function" && typeof document < "u") {
37
- this.shadow = this.attachShadow({ mode: "open" });
38
- const t = document.createElement("p");
39
- t.className = "ui-texto ui-texto--corpo", t.setAttribute("part", "base"), t.appendChild(document.createElement("slot")), this.container = t, this.shadow.innerHTML = `<style>${et}</style>`, this.shadow.appendChild(t);
40
- }
41
- }
42
- static get observedAttributes() {
43
- return ["variante", "tag", "cor", "peso", "alinhamento", "truncar", "linhas", ...N];
44
- }
45
- connectedCallback() {
46
- this.render();
47
- }
48
- attributeChangedCallback(t, e, i) {
49
- this.render();
50
- }
51
- resolveTag() {
52
- const t = this.getAttribute("tag");
53
- if (t) {
54
- const i = t.toLowerCase().trim();
55
- if (rt.has(i))
56
- return i;
57
- console.warn(`[ui-texto] Tag "${t}" não permitida ou inválida. Utilizando fallback semântico.`);
58
- }
59
- const e = A(this.getAttribute("variante"), B, "corpo");
60
- switch (e) {
61
- case "h1":
62
- case "h2":
63
- case "h3":
64
- case "h4":
65
- case "h5":
66
- case "h6":
67
- return e;
68
- case "caption":
69
- return "small";
70
- case "codigo":
71
- return "code";
72
- case "corpo-sm":
73
- case "corpo":
74
- default:
75
- return "p";
76
- }
77
- }
78
- render() {
79
- const { container: t, shadow: e } = this;
80
- if (!t || !e) return;
81
- const i = this.resolveTag(), r = A(this.getAttribute("variante"), B, "corpo"), n = E(this.getAttribute("cor"), it), l = E(this.getAttribute("peso"), at), c = E(this.getAttribute("alinhamento"), ot), u = this.hasAttribute("truncar"), d = u ? 0 : w(this.getAttribute("linhas"), 1, nt, 0);
82
- let h = t;
83
- t.tagName.toLowerCase() !== i && (h = document.createElement(i), h.setAttribute("part", "base"), h.appendChild(document.createElement("slot")), e.replaceChild(h, t), this.container = h);
84
- const p = ["ui-texto", `ui-texto--${r}`];
85
- n && p.push(`ui-texto--cor-${n}`), l && p.push(`ui-texto--peso-${l}`), c && p.push(`ui-texto--alinhamento-${c}`), u && p.push("ui-texto--truncar"), d > 0 && p.push("ui-texto--linhas"), h.className = p.join(" "), d > 0 ? h.style.setProperty("--ui-texto-linhas", String(d)) : h.style.removeProperty("--ui-texto-linhas"), L(this, h);
86
- }
87
- }
88
- _("ui-texto", st);
89
- const lt = ':host{display:inline-block;box-sizing:border-box;vertical-align:middle}:host([largura-total]),:host([full-width]){display:block;width:100%}.ui-texto-editavel{position:relative;display:inline-flex;align-items:center;box-sizing:border-box;width:100%}.ui-texto-editavel__botao{display:inline-flex;align-items:center;justify-content:flex-start;gap:var(--ui-espaco-xs, 4px);width:100%;height:var(--ui-campo-altura, 34px);min-height:var(--ui-campo-altura, 34px);box-sizing:border-box;padding:0 12px;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);background:var(--ui-cor-botao-secundario-fundo, #1e1e24);color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:clamp(11px,.85rem,13px);font-weight:500;line-height:1.2;text-align:left;-webkit-user-select:none;user-select:none;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background-color .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease}.ui-texto-editavel__botao:hover:not(:disabled){background:var(--ui-cor-botao-secundario-hover, #2a2a34);border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 24%,transparent)}.ui-texto-editavel__botao:focus-visible{outline:none;box-shadow:0 0 0 2px var(--ui-cor-fundo, #0b0b0d),0 0 0 4px var(--ui-cor-primaria, #00E08A)}.ui-texto-editavel__texto{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.ui-texto-editavel__texto--placeholder{color:var(--ui-cor-texto-silenciado, rgba(255, 255, 255, .45));font-style:italic}.ui-texto-editavel__input{display:inline-block;width:100%;height:var(--ui-campo-altura, 34px);min-height:var(--ui-campo-altura, 34px);box-sizing:border-box;padding:0 11px;border:1px solid var(--ui-cor-primaria, #00E08A);border-radius:var(--ui-raio-borda, 6px);background:var(--ui-cor-campo-fundo, #121217);color:var(--ui-cor-texto, #ffffff);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:clamp(11px,.85rem,13px);font-weight:500;line-height:1.2;outline:none;box-shadow:0 0 0 1px var(--ui-cor-primaria, #00E08A),0 0 0 3px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent);transition:border-color .15s ease,box-shadow .15s ease}.ui-texto-editavel__input::selection{background:var(--ui-cor-primaria, #00E08A);color:#000}.ui-texto-editavel[data-modo=leitura] .ui-texto-editavel__input,.ui-texto-editavel[data-modo=edicao] .ui-texto-editavel__botao{display:none!important}.ui-texto-editavel--sm .ui-texto-editavel__botao,.ui-texto-editavel--sm .ui-texto-editavel__input{height:var(--ui-campo-altura-sm, 28px);min-height:var(--ui-campo-altura-sm, 28px);font-size:11px;padding-left:8px;padding-right:8px}.ui-texto-editavel--lg .ui-texto-editavel__botao,.ui-texto-editavel--lg .ui-texto-editavel__input{height:var(--ui-campo-altura-lg, 42px);min-height:var(--ui-campo-altura-lg, 42px);font-size:15px;padding-left:14px;padding-right:14px}.ui-texto-editavel--primario .ui-texto-editavel__botao,.ui-texto-editavel--primary .ui-texto-editavel__botao{background:var(--ui-cor-primaria, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000);border-color:transparent;font-weight:600}.ui-texto-editavel--primario .ui-texto-editavel__botao:hover:not(:disabled),.ui-texto-editavel--primary .ui-texto-editavel__botao:hover:not(:disabled){filter:brightness(1.1)}.ui-texto-editavel--ghost .ui-texto-editavel__botao,.ui-texto-editavel--terciario .ui-texto-editavel__botao{background:transparent;color:var(--ui-cor-texto, #e1e1e6);border-color:transparent}.ui-texto-editavel--ghost .ui-texto-editavel__botao:hover:not(:disabled),.ui-texto-editavel--terciario .ui-texto-editavel__botao:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-texto-editavel--outline .ui-texto-editavel__botao,.ui-texto-editavel--borda .ui-texto-editavel__botao{background:transparent;color:var(--ui-cor-texto, #e1e1e6);border-color:var(--ui-cor-borda, rgba(255, 255, 255, .2))}.ui-texto-editavel--outline .ui-texto-editavel__botao:hover:not(:disabled),.ui-texto-editavel--borda .ui-texto-editavel__botao:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .06));border-color:var(--ui-cor-primaria, #00E08A)}.ui-texto-editavel--texto .ui-texto-editavel__botao,.ui-texto-editavel--plano .ui-texto-editavel__botao{background:transparent;border-color:transparent;padding:0 4px;height:auto;min-height:unset;border-radius:4px}.ui-texto-editavel--texto .ui-texto-editavel__botao:hover:not(:disabled),.ui-texto-editavel--plano .ui-texto-editavel__botao:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .06));border-color:color-mix(in srgb,var(--ui-cor-borda, #ffffff) 15%,transparent)}.ui-texto-editavel--destaque .ui-texto-editavel__botao{background:var(--ui-cor-destaque, var(--ui-cor-primaria, #00E08A));color:var(--ui-cor-texto-sobre-primaria, #000000);border-color:transparent}.ui-texto-editavel--destrutivo .ui-texto-editavel__botao{background:var(--ui-cor-botao-destrutivo-fundo, #ff4444);color:var(--ui-cor-botao-destrutivo-texto, #ffffff);border-color:transparent}:host([disabled]){pointer-events:none;opacity:.55;cursor:not-allowed}.ui-texto-editavel__botao:disabled{cursor:not-allowed;opacity:.55}:host([readonly]) .ui-texto-editavel__botao,:host([somente-leitura]) .ui-texto-editavel__botao{cursor:default}', ct = [
90
- "valor",
91
- "value",
92
- "placeholder",
93
- "variante",
94
- "tamanho",
95
- "disabled",
96
- "desabilitado",
97
- "readonly",
98
- "somente-leitura",
99
- "ao-perder-foco",
100
- "obrigatorio",
101
- "maxlength",
102
- "limite-caracteres",
103
- "name",
104
- "nome"
105
- ];
106
- function ut(a) {
107
- return `
108
- <style>${a}</style>
109
- <div class="ui-texto-editavel ui-texto-editavel--secundario" data-modo="leitura" part="base">
110
- <button
111
- class="ui-texto-editavel__botao"
112
- part="botao"
113
- type="button"
114
- aria-description="Pressione Enter ou clique duas vezes para editar"
115
- >
116
- <span class="ui-texto-editavel__texto" part="texto"></span>
117
- </button>
118
- <input
119
- class="ui-texto-editavel__input"
120
- part="input"
121
- type="text"
122
- autocomplete="off"
123
- spellcheck="false"
124
- />
125
- </div>
126
- `;
127
- }
128
- function dt(a, o) {
129
- (a.key === "Enter" || a.key === "F2") && (a.preventDefault(), a.stopPropagation(), o());
130
- }
131
- function ht(a, o, t) {
132
- a.key === "Enter" ? (a.preventDefault(), a.stopPropagation(), o()) : a.key === "Escape" ? (a.preventDefault(), a.stopPropagation(), t()) : a.key === "Tab" && o();
133
- }
134
- class H extends P {
135
- constructor() {
136
- super();
137
- s(this, "container");
138
- s(this, "botaoElement");
139
- s(this, "textoElement");
140
- s(this, "inputElement");
141
- s(this, "_modo", "leitura");
142
- s(this, "_concluindo", !1);
143
- s(this, "_valorInterno", "");
144
- s(this, "_valorOriginalAoEditar", "");
145
- s(this, "listeners", new $());
146
- // === Handlers de Eventos ===
147
- s(this, "handleDuploClique", (t) => {
148
- t.stopPropagation(), !(this.disabled || this.readOnly) && this.editar();
149
- });
150
- s(this, "handleKeyDownBotao", (t) => {
151
- this.disabled || this.readOnly || dt(t, () => this.editar());
152
- });
153
- s(this, "handleKeyDownInput", (t) => {
154
- ht(
155
- t,
156
- () => this.salvar(),
157
- () => this.cancelar()
158
- );
159
- });
160
- s(this, "handleBlurInput", () => {
161
- if (this._concluindo || this._modo !== "edicao") return;
162
- const t = this.aoPerderFoco;
163
- t === "cancelar" ? this.cancelar() : t === "salvar" && this.salvar();
164
- });
165
- const t = this.attachShadow({ mode: "open", delegatesFocus: !0 });
166
- t.innerHTML = ut(lt), this.container = t.querySelector(".ui-texto-editavel"), this.botaoElement = t.querySelector(".ui-texto-editavel__botao"), this.textoElement = t.querySelector(".ui-texto-editavel__texto"), this.inputElement = t.querySelector(".ui-texto-editavel__input"), this._valorInterno = this.getAttribute("valor") ?? this.getAttribute("value") ?? "";
167
- }
168
- static get observedAttributes() {
169
- return ct;
170
- }
171
- connectedCallback() {
172
- this.listeners.cleanup(), this.listeners.add(this.botaoElement, "dblclick", this.handleDuploClique), this.listeners.add(this.botaoElement, "keydown", this.handleKeyDownBotao), this.listeners.add(this.inputElement, "keydown", this.handleKeyDownInput), this.listeners.add(this.inputElement, "blur", this.handleBlurInput), this.syncState();
173
- }
174
- disconnectedCallback() {
175
- this.listeners.cleanup();
176
- }
177
- attributeChangedCallback(t, e, i) {
178
- (t === "valor" || t === "value") && i !== null && this._modo === "leitura" && (this._valorInterno = i), this.syncState();
179
- }
180
- // === API Pública Programática ===
181
- /** Entra no modo de edição se o componente não estiver desabilitado ou em somente leitura. */
182
- editar() {
183
- this._modo === "edicao" || this.disabled || this.readOnly || (this._modo = "edicao", this._valorOriginalAoEditar = this._valorInterno, this.inputElement.value = this._valorInterno, this.container.setAttribute("data-modo", "edicao"), requestAnimationFrame(() => {
184
- this.inputElement.focus(), this.inputElement.select();
185
- }), this.dispararEventoModo());
186
- }
187
- /**
188
- * Salva as alterações feitas no modo de edição e retorna ao modo leitura.
189
- * Dispara `ui-salvar` (cancelável com preventDefault()).
190
- */
191
- salvar() {
192
- if (this._modo !== "edicao" || this._concluindo) return !1;
193
- this._concluindo = !0;
194
- const e = this.inputElement.value.trim();
195
- if (this.obrigatorio && e === "")
196
- return this._concluindo = !1, this.cancelar(), !1;
197
- const i = this._valorOriginalAoEditar;
198
- if (e !== i) {
199
- const r = new CustomEvent("ui-salvar", {
200
- bubbles: !0,
201
- composed: !0,
202
- cancelable: !0,
203
- detail: { valor: e, valorAnterior: i }
204
- });
205
- if (!this.dispatchEvent(r))
206
- return this._concluindo = !1, !1;
207
- this._valorInterno = e, this.setAttribute("valor", e), this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
208
- }
209
- return this._modo = "leitura", this.container.setAttribute("data-modo", "leitura"), this.syncState(), requestAnimationFrame(() => {
210
- this.botaoElement.focus();
211
- }), this.dispararEventoModo(), this._concluindo = !1, !0;
212
- }
213
- /** Cancela as alterações e restaura o valor prévio à edição. */
214
- cancelar() {
215
- this._modo !== "edicao" || this._concluindo || (this._concluindo = !0, this.inputElement.value = this._valorOriginalAoEditar, this._modo = "leitura", this.container.setAttribute("data-modo", "leitura"), this.syncState(), this.dispatchEvent(
216
- new CustomEvent("ui-cancelar", {
217
- bubbles: !0,
218
- composed: !0,
219
- detail: { valor: this._valorInterno }
220
- })
221
- ), requestAnimationFrame(() => {
222
- this.botaoElement.focus();
223
- }), this.dispararEventoModo(), this._concluindo = !1);
224
- }
225
- /** Informa se o componente está atualmente no modo de edição. */
226
- estaEditando() {
227
- return this._modo === "edicao";
228
- }
229
- dispararEventoModo() {
230
- this.dispatchEvent(
231
- new CustomEvent("ui-modo-alterado", {
232
- bubbles: !0,
233
- composed: !0,
234
- detail: { modo: this._modo }
235
- })
236
- );
237
- }
238
- // === Sincronização do DOM & Form-Associated ===
239
- syncState() {
240
- const t = this._valorInterno, e = this.placeholder;
241
- t.trim() !== "" ? (this.textoElement.textContent = t, this.textoElement.classList.remove("ui-texto-editavel__texto--placeholder")) : (this.textoElement.textContent = e, this.textoElement.classList.add("ui-texto-editavel__texto--placeholder"));
242
- const i = this.variante, r = this.tamanho;
243
- this.container.className = `ui-texto-editavel ui-texto-editavel--${i} ui-texto-editavel--${r}`;
244
- const n = this.disabled;
245
- this.botaoElement.disabled = n, this.inputElement.disabled = n;
246
- const l = this.maxlength;
247
- l !== null && l > 0 ? this.inputElement.maxLength = l : this.inputElement.removeAttribute("maxlength"), this.atualizarValidade();
248
- }
249
- atualizarValidade() {
250
- this.internals && typeof this.internals.setFormValue == "function" && this.internals.setFormValue(this._valorInterno);
251
- }
252
- // === Getters e Setters ===
253
- get valor() {
254
- return this._valorInterno;
255
- }
256
- set valor(t) {
257
- this._valorInterno = t ?? "", this.setAttribute("valor", this._valorInterno), this.syncState();
258
- }
259
- get value() {
260
- return this.valor;
261
- }
262
- set value(t) {
263
- this.valor = t;
264
- }
265
- get placeholder() {
266
- return this.getAttribute("placeholder") || "Clique duas vezes para editar";
267
- }
268
- set placeholder(t) {
269
- t ? this.setAttribute("placeholder", t) : this.removeAttribute("placeholder"), this.syncState();
270
- }
271
- get variante() {
272
- return this.getAttribute("variante") || "secundario";
273
- }
274
- set variante(t) {
275
- t ? this.setAttribute("variante", t) : this.removeAttribute("variante"), this.syncState();
276
- }
277
- get tamanho() {
278
- return this.getAttribute("tamanho") || "md";
279
- }
280
- set tamanho(t) {
281
- t ? this.setAttribute("tamanho", t) : this.removeAttribute("tamanho"), this.syncState();
282
- }
283
- get disabled() {
284
- return this._formDisabled || this.hasAttribute("disabled") || this.hasAttribute("desabilitado");
285
- }
286
- set disabled(t) {
287
- t ? this.setAttribute("disabled", "") : (this.removeAttribute("disabled"), this.removeAttribute("desabilitado")), this.syncState();
288
- }
289
- get readOnly() {
290
- return this.hasAttribute("readonly") || this.hasAttribute("somente-leitura");
291
- }
292
- set readOnly(t) {
293
- t ? this.setAttribute("readonly", "") : (this.removeAttribute("readonly"), this.removeAttribute("somente-leitura"));
294
- }
295
- get obrigatorio() {
296
- return this.hasAttribute("obrigatorio") || this.hasAttribute("required");
297
- }
298
- set obrigatorio(t) {
299
- t ? this.setAttribute("obrigatorio", "") : (this.removeAttribute("obrigatorio"), this.removeAttribute("required"));
300
- }
301
- get aoPerderFoco() {
302
- const t = this.getAttribute("ao-perder-foco");
303
- return t === "cancelar" || t === "ignorar" ? t : "salvar";
304
- }
305
- set aoPerderFoco(t) {
306
- this.setAttribute("ao-perder-foco", t);
307
- }
308
- get maxlength() {
309
- const t = this.getAttribute("maxlength") ?? this.getAttribute("limite-caracteres");
310
- if (!t) return null;
311
- const e = parseInt(t, 10);
312
- return isNaN(e) ? null : e;
313
- }
314
- set maxlength(t) {
315
- t !== null && t >= 0 ? this.setAttribute("maxlength", String(t)) : (this.removeAttribute("maxlength"), this.removeAttribute("limite-caracteres")), this.syncState();
316
- }
317
- }
318
- s(H, "formAssociated", !0);
319
- _("ui-texto-editavel", H);
320
- const pt = ':host{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);vertical-align:middle;position:relative}.ui-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-tamanho-avatar, 36px);height:var(--ui-tamanho-avatar, 36px);min-width:var(--ui-tamanho-avatar, 36px);min-height:var(--ui-tamanho-avatar, 36px);border-radius:50%;background:var(--ui-degrade-interno, var(--ui-avatar-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #22222a))));color:var(--ui-cor-primaria, #00E08A);font-weight:600;font-size:var(--ui-avatar-font-size, 14px);-webkit-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));line-height:1}.ui-avatar__img{width:100%;height:100%;object-fit:cover;display:block}.ui-avatar--quadrado{border-radius:8px}.ui-avatar__status{position:absolute;bottom:0;right:0;width:25%;height:25%;min-width:8px;min-height:8px;max-width:14px;max-height:14px;border-radius:50%;border:2px solid var(--ui-cor-fundo-card, #121214);box-sizing:border-box}.ui-avatar__status--online{background:var(--ui-cor-primaria, #00E08A)}.ui-avatar__status--offline{background:#889}.ui-avatar__status--ausente{background:#ffb86c}.ui-avatar__status--ocupado{background:#f55}.ui-avatar--xs{--ui-tamanho-avatar: 20px;--ui-avatar-font-size: 10px}.ui-avatar--sm{--ui-tamanho-avatar: 28px;--ui-avatar-font-size: 11px}.ui-avatar--md{--ui-tamanho-avatar: 36px;--ui-avatar-font-size: 14px}.ui-avatar--lg{--ui-tamanho-avatar: 48px;--ui-avatar-font-size: 18px}.ui-avatar--xl{--ui-tamanho-avatar: 64px;--ui-avatar-font-size: 24px}:host(.squarecircle) .ui-avatar,:host(.squarecircles) .ui-avatar,:host(.ui-squarecircle) .ui-avatar,:host(.ui-squarecircles) .ui-avatar,.ui-avatar--squarecircle{border-radius:var(--ui-raio-squircle, 24%)}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-elevado: var(--ui-gradiente-elevado)}', R = ["xs", "sm", "md", "lg", "xl"], mt = ["online", "offline", "ausente", "ocupado"], vt = 8, gt = 512;
321
- class bt extends D {
322
- constructor() {
323
- super();
324
- s(this, "avatarElement");
325
- s(this, "statusElement");
326
- /** O que este componente escreveu em aria-label / aria-hidden (para distinguir do que o consumidor definiu). */
327
- s(this, "_rotuloAuto", null);
328
- s(this, "_ocultoAuto", !1);
329
- s(this, "_sincronizando", !1);
330
- const t = this.attachShadow({ mode: "open" });
331
- t.innerHTML = `
332
- <style>${pt}</style>
333
- <div class="ui-avatar" part="base">
334
- <span class="ui-avatar__content" part="conteudo"></span>
335
- </div>
336
- <span class="ui-avatar__status" part="status" style="display: none;"></span>
337
- `, this.avatarElement = t.querySelector(".ui-avatar"), this.statusElement = t.querySelector(".ui-avatar__status");
338
- }
339
- static get observedAttributes() {
340
- return [
341
- "src",
342
- "nome",
343
- "name",
344
- "tamanho",
345
- "size",
346
- "formato",
347
- "status",
348
- "aria-label",
349
- ...N
350
- ];
351
- }
352
- connectedCallback() {
353
- this.syncState();
354
- }
355
- attributeChangedCallback(t, e, i) {
356
- this._sincronizando || this.syncState();
357
- }
358
- /** Iniciais por ponto de código (emoji e caracteres fora do BMP não são cortados ao meio). */
359
- extrairIniciais(t) {
360
- const e = t.trim().split(/\s+/).filter(Boolean);
361
- if (e.length === 0) return "?";
362
- if (e.length === 1)
363
- return Array.from(e[0]).slice(0, 2).join("").toUpperCase();
364
- const i = Array.from(e[0])[0], r = Array.from(e[e.length - 1])[0];
365
- return (i + r).toUpperCase();
366
- }
367
- lerNome() {
368
- return this.getAttribute("nome") || this.getAttribute("name") || "";
369
- }
370
- /**
371
- * Nome acessível: com nome, o host é uma imagem nomeada ("Ana, online"); sem nome, é decorativo.
372
- * Um `aria-label`/`aria-hidden` definido pelo consumidor nunca é sobrescrito.
373
- */
374
- sincronizarAcessibilidade(t, e) {
375
- const i = this.getAttribute("aria-label"), r = i !== null && i !== this._rotuloAuto, n = this.hasAttribute("aria-hidden") && !this._ocultoAuto;
376
- if (!(r || n)) {
377
- if (this._sincronizando = !0, t) {
378
- const l = e ? `${t}, ${e}` : t;
379
- this.setAttribute("role", "img"), this.setAttribute("aria-label", l), this._rotuloAuto = l, this.removeAttribute("aria-hidden"), this._ocultoAuto = !1;
380
- } else
381
- this._rotuloAuto !== null && this.removeAttribute("aria-label"), this._rotuloAuto = null, this.removeAttribute("role"), this.setAttribute("aria-hidden", "true"), this._ocultoAuto = !0;
382
- this._sincronizando = !1;
383
- }
384
- }
385
- syncState() {
386
- const t = this.getAttribute("src"), e = this.lerNome(), i = (this.getAttribute("tamanho") || this.getAttribute("size") || "md").trim().toLowerCase(), r = this.getAttribute("formato"), n = E(this.getAttribute("status"), mt);
387
- this.avatarElement.className = "ui-avatar";
388
- const l = E(i, R), c = parseInt(i, 10);
389
- l ? (this.avatarElement.classList.add(`ui-avatar--${l}`), this.avatarElement.style.removeProperty("--ui-tamanho-avatar")) : Number.isFinite(c) && c >= vt && c <= gt ? this.avatarElement.style.setProperty("--ui-tamanho-avatar", `${c}px`) : (this.avatarElement.classList.add(`ui-avatar--${A(null, R, "md")}`), this.avatarElement.style.removeProperty("--ui-tamanho-avatar")), r === "quadrado" ? this.avatarElement.classList.add("ui-avatar--quadrado") : (r === "squarecircle" || r === "squarecircles" || r === "squircle") && this.avatarElement.classList.add("ui-avatar--squarecircle"), L(this, this.avatarElement);
390
- const u = this.avatarElement.querySelector(".ui-avatar__content");
391
- if (u)
392
- if (t) {
393
- const d = u.querySelector("img");
394
- if (d && d.getAttribute("src") === t)
395
- d.alt = "";
396
- else {
397
- u.textContent = "";
398
- const h = document.createElement("img");
399
- h.className = "ui-avatar__img", h.src = t, h.alt = "", h.onerror = () => {
400
- this.renderFallback(u, this.lerNome());
401
- }, u.appendChild(h);
402
- }
403
- } else
404
- u.textContent = "", this.renderFallback(u, e);
405
- this.sincronizarAcessibilidade(e, n), n ? (this.statusElement.className = `ui-avatar__status ui-avatar__status--${n}`, this.statusElement.style.display = "block", this.statusElement.setAttribute("aria-hidden", "true")) : this.statusElement.style.display = "none";
406
- }
407
- renderFallback(t, e) {
408
- e ? t.textContent = this.extrairIniciais(e) : t.innerHTML = `
409
- <svg viewBox="0 0 24 24" width="60%" height="60%" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
410
- <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
411
- <circle cx="12" cy="7" r="4"></circle>
412
- </svg>
413
- `;
414
- }
415
- }
416
- _("ui-avatar", bt);
417
- class ft {
418
- constructor(o, t) {
419
- s(this, "rafId", null);
420
- s(this, "resizeObserver");
421
- this.trackElement = o, this.indicadorElement = t;
422
- }
423
- iniciarObserver(o, t) {
424
- typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => {
425
- this.atualizar(), t && t();
426
- }), this.resizeObserver.observe(o));
427
- }
428
- destruir() {
429
- this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0), this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
430
- }
431
- atualizar() {
432
- this.rafId !== null && cancelAnimationFrame(this.rafId), this.rafId = requestAnimationFrame(() => {
433
- this.rafId = null;
434
- const o = this.trackElement.querySelector(".ui-segmented__item--ativo");
435
- if (!o) {
436
- this.indicadorElement.style.opacity = "0";
437
- return;
438
- }
439
- const t = this.indicadorElement.parentElement, e = o.getBoundingClientRect(), i = t == null ? void 0 : t.getBoundingClientRect();
440
- let r, n;
441
- if (t && i && e.width > 0 && i.width > 0) {
442
- const l = t.clientLeft || 0;
443
- r = Number((e.left - i.left - l).toFixed(2)), n = Number(e.width.toFixed(2));
444
- } else
445
- r = Math.round(o.offsetLeft), n = Math.round(o.offsetWidth);
446
- this.indicadorElement.style.transform = `translateX(${r}px)`, this.indicadorElement.style.width = `${n}px`, this.indicadorElement.style.opacity = "1";
447
- });
448
- }
449
- }
450
- function xt(a, o, t, e) {
451
- if (t) return;
452
- const i = Array.from(
453
- o.querySelectorAll(".ui-segmented__item:not(:disabled)")
454
- );
455
- if (i.length === 0) return;
456
- const r = i.findIndex((c) => c.classList.contains("ui-segmented__item--ativo"));
457
- let n = r;
458
- if (a.key === "ArrowRight" || a.key === "ArrowDown")
459
- a.preventDefault(), n = (r + 1) % i.length;
460
- else if (a.key === "ArrowLeft" || a.key === "ArrowUp")
461
- a.preventDefault(), n = (r - 1 + i.length) % i.length;
462
- else if (a.key === "Home")
463
- a.preventDefault(), n = 0;
464
- else if (a.key === "End")
465
- a.preventDefault(), n = i.length - 1;
466
- else
467
- return;
468
- const l = i[n];
469
- if (l && l.dataset.indice) {
470
- const c = parseInt(l.dataset.indice, 10);
471
- e(c);
472
- }
473
- }
474
- const _t = ':host{display:inline-flex;vertical-align:middle;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([largura-total]),:host([full-width]){display:block;width:100%}.ui-segmented{--_altura: var(--ui-campo-altura, 34px);--_moldura: 3px;display:inline-flex;position:relative;height:var(--_altura);background:var(--ui-degrade-interno, var(--ui-segmented-fundo, var(--ui-fundo-superficie, var(--ui-cor-fundo, #0b0b0d))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);padding:var(--_moldura);box-sizing:border-box;-webkit-user-select:none;user-select:none;gap:2px;align-items:center}.ui-segmented--full{display:flex;width:100%}.ui-segmented--full .ui-segmented__item{flex:1}.ui-segmented--sm{--_moldura: 2px}.ui-segmented--sm .ui-segmented__item{font-size:12px;padding:0 8px}.ui-segmented--md .ui-segmented__item{font-size:13px;padding:0 14px}.ui-segmented--lg{--_moldura: 4px}.ui-segmented--lg .ui-segmented__item{font-size:14px;padding:0 18px}.ui-segmented__indicador{position:absolute;top:var(--_moldura);bottom:var(--_moldura);left:0;box-sizing:border-box;background:var(--ui-segmented-indicador-fundo, var(--ui-fundo-card, var(--ui-cor-fundo-card, #1e1e24)));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:calc(var(--ui-raio-borda, 8px) - 2px);box-shadow:var(--ui-sombra-sm, 0 2px 8px rgba(0, 0, 0, .4));pointer-events:none;transition:transform .22s cubic-bezier(.16,1,.3,1),width .22s cubic-bezier(.16,1,.3,1),opacity .15s ease;z-index:1;opacity:0}.ui-segmented__item{position:relative;z-index:2;display:inline-flex;align-items:center;justify-content:center;gap:6px;background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);font-family:inherit;font-weight:500;cursor:pointer;border-radius:calc(var(--ui-raio-borda, 8px) - 2px);line-height:1;white-space:nowrap;transition:color .15s ease;box-sizing:border-box;height:calc(var(--_altura) - 2px - 2 * var(--_moldura))}.ui-segmented__item:hover:not(:disabled){color:var(--ui-cor-texto, #e1e1e6)}.ui-segmented__item--ativo{color:var(--ui-cor-texto, #ffffff)!important;font-weight:600}.ui-segmented__item:focus-visible{outline:none;box-shadow:0 0 0 2px var(--ui-cor-primaria, #00E08A)}.ui-segmented__item:disabled{opacity:.35;cursor:not-allowed}.ui-segmented__icone{display:inline-flex;align-items:center;justify-content:center;line-height:1}.ui-segmented__icone ui-icone,.ui-segmented__icone svg{shape-rendering:geometricPrecision;display:inline-flex;align-items:center;justify-content:center}@media (max-width: 640px){.ui-segmented{--_altura: max(var(--ui-campo-altura, 34px), 38px)}}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-superficie: var(--ui-gradiente-superficie);--ui-fundo-card: var(--ui-gradiente-card)}', At = [
475
- "valor",
476
- "value",
477
- "name",
478
- "disabled",
479
- "tamanho",
480
- "size",
481
- "densidade",
482
- "altura",
483
- "height",
484
- "largura-total",
485
- "full-width",
486
- "obrigatorio",
487
- "required",
488
- "mensagem-validacao",
489
- ...N
490
- ];
491
- function yt() {
492
- return `
493
- <style>${_t}</style>
494
- <div class="ui-segmented ui-segmented--md" part="base" role="radiogroup">
495
- <div class="ui-segmented__indicador" part="indicador"></div>
496
- <div class="ui-segmented__track" style="display: contents;"></div>
497
- <slot style="display: none;"></slot>
498
- </div>
499
- `;
500
- }
501
- function wt(a, o, t, e, i) {
502
- const r = document.createElement("button");
503
- r.type = "button", r.role = "radio", r.className = "ui-segmented__item", r.setAttribute("part", a.valor === t ? "opcao opcao-selecionada" : "opcao"), r.dataset.valor = a.valor, r.dataset.indice = String(o);
504
- const n = a.valor === t;
505
- if (r.setAttribute("aria-checked", String(n)), r.tabIndex = n ? 0 : -1, n && r.classList.add("ui-segmented__item--ativo"), (e || a.disabled) && (r.disabled = !0), a.icone) {
506
- const c = document.createElement("span");
507
- c.className = "ui-segmented__icone";
508
- const u = document.createElement("ui-icone");
509
- u.setAttribute("nome", a.icone), u.setAttribute("tamanho", "14"), c.appendChild(u), r.appendChild(c);
510
- }
511
- const l = document.createElement("span");
512
- return l.className = "ui-segmented__texto", l.textContent = a.rotulo, r.appendChild(l), r.addEventListener("click", (c) => {
513
- c.stopPropagation(), i();
514
- }), r;
515
- }
516
- class X extends P {
517
- constructor() {
518
- super();
519
- s(this, "rootElement");
520
- s(this, "trackElement");
521
- s(this, "indicadorElement");
522
- s(this, "slotElement");
523
- s(this, "_opcoes", []);
524
- s(this, "_defaultValue", "");
525
- s(this, "listeners", new $());
526
- s(this, "indicadorController");
527
- s(this, "handleSlotChange", () => {
528
- this._opcoes.length === 0 && this.carregarOpcoes();
529
- });
530
- s(this, "handleKeyDown", (t) => {
531
- xt(t, this.trackElement, this.disabled, (e) => {
532
- this.selecionarIndice(e);
533
- });
534
- });
535
- const t = this.attachShadow({ mode: "open" });
536
- t.innerHTML = yt(), this.rootElement = t.querySelector(".ui-segmented"), this.indicadorElement = t.querySelector(".ui-segmented__indicador"), this.trackElement = t.querySelector(".ui-segmented__track"), this.slotElement = t.querySelector("slot"), this.indicadorController = new ft(
537
- this.trackElement,
538
- this.indicadorElement
539
- );
540
- }
541
- static get observedAttributes() {
542
- return At;
543
- }
544
- connectedCallback() {
545
- this.listeners.cleanup(), this.listeners.add(this.rootElement, "keydown", this.handleKeyDown), this.listeners.add(this.slotElement, "slotchange", this.handleSlotChange), this._defaultValue || (this._defaultValue = this.getAttribute("valor") || this.getAttribute("value") || ""), this.indicadorController.iniciarObserver(this.rootElement), this.carregarOpcoes(), this.syncState();
546
- }
547
- disconnectedCallback() {
548
- this.listeners.cleanup(), this.indicadorController.destruir();
549
- }
550
- attributeChangedCallback(t, e, i) {
551
- e !== i && (t === "valor" || t === "value" ? this.atualizarSelecao(i || "") : this.syncState());
552
- }
553
- // === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
554
- formResetCallback() {
555
- this.valor = this._defaultValue, this.syncState();
556
- }
557
- formStateRestoreCallback(t, e) {
558
- typeof t == "string" && (this.valor = t), this.syncState();
559
- }
560
- get type() {
561
- return "select-one";
562
- }
563
- atualizarValidade() {
564
- if (!this.internals || typeof this.internals.setValidity != "function") return;
565
- if (this.disabled) {
566
- this.internals.setValidity({});
567
- return;
568
- }
569
- if (this._customErrorMessage) {
570
- this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.rootElement);
571
- return;
572
- }
573
- if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && (!this.valor || this.valor.trim() === "")) {
574
- const e = this.getAttribute("mensagem-validacao") || "Selecione uma opção.";
575
- this.internals.setValidity({ valueMissing: !0 }, e, this.rootElement);
576
- return;
577
- }
578
- this.internals.setValidity({});
579
- }
580
- get valor() {
581
- return this.getAttribute("valor") || this.getAttribute("value") || "";
582
- }
583
- set valor(t) {
584
- this.setAttribute("valor", t), this.atualizarSelecao(t);
585
- }
586
- get value() {
587
- return this.valor;
588
- }
589
- set value(t) {
590
- this.valor = t;
591
- }
592
- get name() {
593
- return this.getAttribute("name") || "";
594
- }
595
- set name(t) {
596
- this.setAttribute("name", t);
597
- }
598
- get disabled() {
599
- return this.hasAttribute("disabled") || this._formDisabled;
600
- }
601
- set disabled(t) {
602
- t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
603
- }
604
- get opcoes() {
605
- return this._opcoes;
606
- }
607
- set opcoes(t) {
608
- this._opcoes = Array.isArray(t) ? t : [], this.renderizarOpcoes();
609
- }
610
- carregarOpcoes() {
611
- const t = this.slotElement.assignedElements();
612
- if (t.length > 0) {
613
- const e = [];
614
- t.forEach((i) => {
615
- var r, n;
616
- if (i instanceof HTMLElement) {
617
- const l = i.getAttribute("valor") || i.getAttribute("value") || i.getAttribute("data-value") || ((r = i.textContent) == null ? void 0 : r.trim()) || "", c = i.getAttribute("label") || i.getAttribute("rotulo") || ((n = i.textContent) == null ? void 0 : n.trim()) || l, u = i.getAttribute("icone") || i.getAttribute("icon") || void 0, d = i.hasAttribute("disabled");
618
- e.push({ valor: l, rotulo: c, icone: u, disabled: d });
619
- }
620
- }), this._opcoes = e, this.renderizarOpcoes();
621
- }
622
- }
623
- renderizarOpcoes() {
624
- this.trackElement.innerHTML = "";
625
- const t = this.valor, e = this.disabled;
626
- this._opcoes.forEach((r, n) => {
627
- const l = wt(
628
- r,
629
- n,
630
- t,
631
- e,
632
- () => this.selecionarIndice(n)
633
- );
634
- this.trackElement.appendChild(l);
635
- });
636
- const i = this.required || this.hasAttribute("sem-selecao-inicial");
637
- !t && this._opcoes.length > 0 && !i ? this.selecionarIndice(0, !1) : this.indicadorController.atualizar(), this.atualizarValidade();
638
- }
639
- selecionarIndice(t, e = !0) {
640
- var n, l;
641
- if (this.disabled) return;
642
- const i = this._opcoes[t];
643
- if (!i || i.disabled) return;
644
- const r = this.valor;
645
- this.setAttribute("valor", i.valor), this.internals && ((l = (n = this.internals).setFormValue) == null || l.call(n, i.valor)), this.atualizarSelecao(i.valor), e && r !== i.valor && (this.dispatchEvent(
646
- new CustomEvent("ui-change", {
647
- detail: { valor: i.valor, rotulo: i.rotulo, indice: t },
648
- bubbles: !0,
649
- composed: !0
650
- })
651
- ), this.dispatchEvent(
652
- new CustomEvent("ui-selecionar", {
653
- detail: { valor: i.valor, rotulo: i.rotulo, indice: t },
654
- bubbles: !0,
655
- composed: !0
656
- })
657
- ));
658
- }
659
- atualizarSelecao(t) {
660
- var i, r;
661
- Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((n) => {
662
- const l = n.dataset.valor === t;
663
- n.classList.toggle("ui-segmented__item--ativo", l), J(n, "opcao-selecionada", l), n.setAttribute("aria-checked", String(l)), n.tabIndex = l ? 0 : -1, l && n.focus();
664
- }), this.internals && ((r = (i = this.internals).setFormValue) == null || r.call(i, t)), this.indicadorController.atualizar(), this.atualizarValidade();
665
- }
666
- syncState() {
667
- q(this);
668
- const t = tt(
669
- this.getAttribute("tamanho") ?? this.getAttribute("size") ?? this.getAttribute("densidade")
670
- ) ?? "md", e = this.hasAttribute("largura-total") || this.hasAttribute("full-width"), i = this.disabled;
671
- this.rootElement.className = `ui-segmented ui-segmented--${t}`, e && this.rootElement.classList.add("ui-segmented--full"), L(this, this.rootElement), this.rootElement.setAttribute("aria-disabled", String(i)), Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((n) => {
672
- n.disabled = i;
673
- }), this.indicadorController.atualizar(), this.atualizarValidade();
674
- }
675
- }
676
- class Et extends X {
677
- }
678
- _("ui-segmented", X);
679
- _("ui-segmento", Et);
680
- const kt = `:host{display:block;box-sizing:border-box;container-type:inline-size;font-family:var(--ui-fonte-base, "Inter", sans-serif);--_cor: var(--ui-calendario-cor, var(--ui-cor-primaria, #00e08a));--_cor-texto: var(--ui-calendario-cor-texto, var(--ui-cor-texto-sobre-primaria, #000))}:host([hidden]){display:none}.ui-calendario{display:flex;flex-direction:column;color:var(--ui-cor-texto, #e1e1e6);border-radius:var(--ui-calendario-raio, 28px);background:var(--ui-calendario-moldura, linear-gradient(160deg, color-mix(in srgb, var(--_cor) 92%, #fff), var(--_cor)));box-shadow:0 18px 40px -18px color-mix(in srgb,var(--_cor) 55%,transparent),var(--ui-sombra-sm, 0 2px 6px rgba(0, 0, 0, .3));overflow:hidden}.ui-calendario__cabecalho{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 20px 14px;color:var(--_cor-texto)}.ui-calendario__titulo{font-size:.95rem;font-weight:700;letter-spacing:.01em;margin-right:auto}.ui-calendario__nav{display:inline-flex;align-items:center;gap:6px;margin-left:auto}.ui-calendario__nav-btn,.ui-calendario__hoje{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;font:inherit;color:inherit;cursor:pointer;background:color-mix(in srgb,var(--_cor-texto) 14%,transparent);transition:background .15s ease,transform .15s ease}.ui-calendario__nav-btn{width:34px;height:34px;border-radius:50%;display:inline-grid;place-items:center}.ui-calendario__nav-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}.ui-calendario__hoje{height:34px;padding:0 14px;border-radius:9999px;font-size:.8rem;font-weight:600}.ui-calendario__nav-btn:hover,.ui-calendario__hoje:hover{background:color-mix(in srgb,var(--_cor-texto) 26%,transparent)}.ui-calendario__nav-btn:active,.ui-calendario__hoje:active{transform:scale(.95)}.ui-calendario__nav-btn:focus-visible,.ui-calendario__hoje:focus-visible,.ui-calendario__select:focus-visible,.ui-calendario__dia:focus-visible{outline:2px solid var(--ui-cor-primaria, #00e08a);outline-offset:2px}.ui-calendario__cabecalho .ui-calendario__nav-btn:focus-visible,.ui-calendario__cabecalho .ui-calendario__hoje:focus-visible{outline-color:var(--_cor-texto)}.ui-calendario__corpo{margin:0 6px 6px;padding:14px 14px 16px;border-radius:calc(var(--ui-calendario-raio, 28px) - 6px);background:var(--ui-calendario-fundo, var(--ui-cor-superficie, #141417))}.ui-calendario__seletores{display:flex;justify-content:center;gap:8px;margin-bottom:12px}.ui-calendario__select{-webkit-appearance:none;-moz-appearance:none;appearance:none;font:inherit;font-size:.85rem;font-weight:600;color:var(--ui-cor-texto, #e1e1e6);background-color:var(--ui-cor-fundo-recuado, rgba(127, 127, 127, .14));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:9999px;padding:6px 28px 6px 14px;cursor:pointer;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239696a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");background-repeat:no-repeat;background-position:right 9px center;background-size:13px}.ui-calendario__select option{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-superficie, #141417)}.ui-calendario__semana,.ui-calendario__linha{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}.ui-calendario__semana{margin-bottom:6px}.ui-calendario__semana-dia{text-align:center;font-size:.7rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--ui-cor-texto-secundario, #9696a6);padding:4px 0}.ui-calendario__grade{display:flex;flex-direction:column;gap:4px}.ui-calendario__dia{-webkit-appearance:none;-moz-appearance:none;appearance:none;font:inherit;color:inherit;text-align:left;cursor:pointer;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:6px 7px;min-height:92px;border-radius:14px;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent);transition:background .15s ease,border-color .15s ease,transform .15s ease}.ui-calendario__dia:hover{background:color-mix(in srgb,var(--_cor) 12%,transparent);border-color:color-mix(in srgb,var(--_cor) 40%,transparent)}.ui-calendario__dia--fora{opacity:.38}.ui-calendario__dia--fim-semana:not(.ui-calendario__dia--selecionado) .ui-calendario__numero{color:var(--ui-cor-texto-secundario, #9696a6)}.ui-calendario__numero{display:inline-grid;place-items:center;min-width:26px;height:26px;padding:0 4px;border-radius:9999px;font-size:.82rem;font-weight:600;font-variant-numeric:tabular-nums}.ui-calendario__dia--hoje .ui-calendario__numero{box-shadow:inset 0 0 0 2px var(--_cor);color:var(--ui-cor-texto, #e1e1e6)}.ui-calendario__dia--selecionado{border-color:var(--_cor);background:color-mix(in srgb,var(--_cor) 16%,transparent)}.ui-calendario__dia--selecionado .ui-calendario__numero{background:var(--_cor);color:var(--_cor-texto);box-shadow:0 4px 10px -3px color-mix(in srgb,var(--_cor) 70%,transparent)}.ui-calendario__eventos{display:flex;flex-direction:column;gap:3px;width:100%;min-width:0}.ui-calendario__evento{--_ev: var(--ui-calendario-evento-cor, var(--_cor));display:block;width:100%;box-sizing:border-box;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:.7rem;font-weight:600;line-height:1.25;padding:2px 7px;border-radius:9999px;color:var(--_ev);background:color-mix(in srgb,var(--_ev) 16%,transparent);box-shadow:inset 3px 0 0 var(--_ev);transition:background .15s ease}.ui-calendario__evento:hover{background:color-mix(in srgb,var(--_ev) 28%,transparent)}.ui-calendario__mais{font-size:.68rem;font-weight:700;color:var(--ui-cor-texto-secundario, #9696a6);padding-left:4px}.ui-calendario__pontos{display:none;gap:3px;justify-content:center;width:100%;min-height:6px}.ui-calendario__ponto{width:6px;height:6px;border-radius:50%;background:var(--ui-calendario-evento-cor, var(--_cor))}.ui-calendario[data-exibicao=compacto] .ui-calendario__dia{min-height:0;aspect-ratio:1;align-items:center;justify-content:center;gap:2px;padding:4px;border-radius:50%;border-color:transparent;background:transparent}.ui-calendario[data-exibicao=compacto] .ui-calendario__eventos,.ui-calendario[data-exibicao=compacto] .ui-calendario__mais{display:none}.ui-calendario[data-exibicao=compacto] .ui-calendario__pontos{display:flex}.ui-calendario[data-exibicao=compacto] .ui-calendario__dia--selecionado{background:transparent}@container (max-width: 560px){.ui-calendario__dia{min-height:58px;align-items:center;padding:5px 2px;border-radius:12px}.ui-calendario__eventos{display:none}.ui-calendario__pontos{display:flex}.ui-calendario__corpo{padding:10px 8px 12px}.ui-calendario__semana,.ui-calendario__linha,.ui-calendario__grade{gap:3px}}.ui-calendario[data-variante=simples]{background:var(--ui-calendario-fundo, var(--ui-cor-superficie, #141417));box-shadow:var(--ui-sombra-sm, 0 2px 6px rgba(0, 0, 0, .3));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-calendario[data-variante=simples] .ui-calendario__cabecalho{color:var(--ui-cor-texto, #e1e1e6)}.ui-calendario[data-variante=simples] .ui-calendario__nav-btn,.ui-calendario[data-variante=simples] .ui-calendario__hoje{background:var(--ui-cor-fundo-recuado, rgba(127, 127, 127, .14))}.ui-calendario[data-variante=simples] .ui-calendario__corpo{margin:0;background:transparent}@media (prefers-reduced-motion: reduce){.ui-calendario *{transition:none!important}}`, St = /^(\d{4})-(\d{2})-(\d{2})(?:$|[T\s])/, Ct = /^(\d{4})-(\d{2})$/;
681
- function F(a, o) {
682
- return new Date(Date.UTC(a, o, 0)).getUTCDate();
683
- }
684
- function zt(a, o, t) {
685
- return a >= 1 && a <= 9999 && o >= 1 && o <= 12 && t >= 1 && t <= F(a, o);
686
- }
687
- function j(a) {
688
- return a < 10 ? `0${a}` : String(a);
689
- }
690
- function b({ ano: a, mes: o, dia: t }) {
691
- return `${String(a).padStart(4, "0")}-${j(o)}-${j(t)}`;
692
- }
693
- function T(a, o) {
694
- return `${String(a).padStart(4, "0")}-${j(o)}`;
695
- }
696
- function x(a) {
697
- if (typeof a != "string") return null;
698
- const o = St.exec(a.trim());
699
- if (!o) return null;
700
- const t = Number(o[1]), e = Number(o[2]), i = Number(o[3]);
701
- return zt(t, e, i) ? { ano: t, mes: e, dia: i } : null;
702
- }
703
- function S(a) {
704
- if (typeof a != "string") return null;
705
- const o = a.trim(), t = Ct.exec(o);
706
- if (t) {
707
- const i = Number(t[1]), r = Number(t[2]);
708
- return i >= 1 && i <= 9999 && r >= 1 && r <= 12 ? { ano: i, mes: r } : null;
709
- }
710
- const e = x(o);
711
- return e ? { ano: e.ano, mes: e.mes } : null;
712
- }
713
- function C(a = /* @__PURE__ */ new Date()) {
714
- return { ano: a.getFullYear(), mes: a.getMonth() + 1, dia: a.getDate() };
715
- }
716
- function f(a, o) {
717
- const t = new Date(Date.UTC(a.ano, a.mes - 1, a.dia + o));
718
- return { ano: t.getUTCFullYear(), mes: t.getUTCMonth() + 1, dia: t.getUTCDate() };
719
- }
720
- function O(a, o) {
721
- const t = a.ano * 12 + (a.mes - 1) + o, e = Math.floor(t / 12), i = (t % 12 + 12) % 12 + 1;
722
- return e < 1 || e > 9999 ? a : { ano: e, mes: i, dia: Math.min(a.dia, F(e, i)) };
723
- }
724
- function z(a) {
725
- return new Date(Date.UTC(a.ano, a.mes - 1, a.dia)).getUTCDay();
726
- }
727
- function Dt(a, o, t = 1, e = 6) {
728
- const i = t >= 0 && t <= 6 ? Math.trunc(t) : 1, r = { ano: a, mes: o, dia: 1 }, n = (z(r) - i + 7) % 7, l = [];
729
- for (let c = 0; c < e * 7; c++) {
730
- const u = f(r, c - n);
731
- l.push({ ...u, iso: b(u), doMes: u.ano === a && u.mes === o, diaSemana: z(u) });
732
- }
733
- return l;
734
- }
735
- function M(a) {
736
- const o = /* @__PURE__ */ new Map();
737
- if (!Array.isArray(a)) return o;
738
- for (const t of a) {
739
- if (!t || typeof t != "object") continue;
740
- const e = t, i = x(e.data);
741
- if (!i) continue;
742
- const r = b(i), n = o.get(r);
743
- n ? n.push(e) : o.set(r, [e]);
744
- }
745
- return o;
746
- }
747
- function G(a) {
748
- try {
749
- const o = new Intl.DateTimeFormat(a, { month: "long", timeZone: "UTC" });
750
- return Array.from({ length: 12 }, (t, e) => Z(o.format(new Date(Date.UTC(2021, e, 15)))));
751
- } catch {
752
- return G("pt-BR");
753
- }
754
- }
755
- function K(a, o, t = "short") {
756
- const e = [];
757
- try {
758
- const i = new Intl.DateTimeFormat(a, { weekday: t, timeZone: "UTC" });
759
- for (let r = 0; r < 7; r++) {
760
- const n = (o + r) % 7;
761
- e.push(i.format(new Date(Date.UTC(2021, 7, 1 + n))).replace(/\.$/, ""));
762
- }
763
- return e;
764
- } catch {
765
- return K("pt-BR", o, t);
766
- }
767
- }
768
- function Z(a) {
769
- return a && a.charAt(0).toLocaleUpperCase() + a.slice(1);
770
- }
771
- function It(a, o, t, e = !1) {
772
- switch (a) {
773
- case "ArrowLeft":
774
- return f(o, -1);
775
- case "ArrowRight":
776
- return f(o, 1);
777
- case "ArrowUp":
778
- return f(o, -7);
779
- case "ArrowDown":
780
- return f(o, 7);
781
- case "PageUp":
782
- return O(o, e ? -12 : -1);
783
- case "PageDown":
784
- return O(o, e ? 12 : 1);
785
- case "Home":
786
- return f(o, -((z(o) - t + 7) % 7));
787
- case "End":
788
- return f(o, 6 - (z(o) - t + 7) % 7);
789
- default:
790
- return null;
791
- }
792
- }
793
- const Tt = [
794
- "mes",
795
- "valor",
796
- "value",
797
- "titulo",
798
- "locale",
799
- "inicio-semana",
800
- "selecao",
801
- "exibicao",
802
- "variante",
803
- "eventos",
804
- "max-eventos"
805
- ];
806
- function Mt() {
807
- return `
808
- <div class="ui-calendario" part="base">
809
- <div class="ui-calendario__cabecalho" part="cabecalho">
810
- <span class="ui-calendario__titulo" part="titulo"></span>
811
- <div class="ui-calendario__nav" part="nav">
812
- <button type="button" class="ui-calendario__nav-btn" data-acao="anterior" part="nav-botao" aria-label="Mês anterior">
813
- <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 5l-7 7 7 7"/></svg>
814
- </button>
815
- <button type="button" class="ui-calendario__hoje" data-acao="hoje" part="hoje-botao">Hoje</button>
816
- <button type="button" class="ui-calendario__nav-btn" data-acao="proximo" part="nav-botao" aria-label="Próximo mês">
817
- <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 5l7 7-7 7"/></svg>
818
- </button>
819
- </div>
820
- </div>
821
- <div class="ui-calendario__corpo" part="corpo">
822
- <div class="ui-calendario__seletores" part="seletores">
823
- <select class="ui-calendario__select" data-seletor="mes" part="select" aria-label="Mês"></select>
824
- <select class="ui-calendario__select" data-seletor="ano" part="select" aria-label="Ano"></select>
825
- </div>
826
- <div class="ui-calendario__semana" part="semana" aria-hidden="true"></div>
827
- <div class="ui-calendario__grade" part="grade" role="grid"></div>
828
- </div>
829
- </div>
830
- `;
831
- }
832
- function V(a) {
833
- if (typeof a != "string") return null;
834
- const o = a.trim();
835
- return !o || /[;{}<>\\]|url\(|\/\*/i.test(o) ? null : o;
836
- }
837
- function qt(a, o) {
838
- const { dia: t, eventos: e } = o, i = a.createElement("button");
839
- i.type = "button", i.className = "ui-calendario__dia", i.setAttribute("role", "gridcell"), i.dataset.data = t.iso, i.tabIndex = o.foco ? 0 : -1, i.setAttribute("aria-label", o.rotulo), t.doMes || i.classList.add("ui-calendario__dia--fora"), (t.diaSemana === 0 || t.diaSemana === 6) && i.classList.add("ui-calendario__dia--fim-semana"), o.hoje && (i.classList.add("ui-calendario__dia--hoje"), i.setAttribute("aria-current", "date")), o.selecionado && i.classList.add("ui-calendario__dia--selecionado"), i.setAttribute("aria-selected", o.selecionado ? "true" : "false"), e.length && i.classList.add("ui-calendario__dia--com-eventos"), i.setAttribute("part", ["dia", t.doMes ? "" : "dia-fora", o.hoje ? "dia-hoje" : "", o.selecionado ? "dia-selecionado" : "", e.length ? "dia-com-eventos" : ""].filter(Boolean).join(" "));
840
- const r = a.createElement("span");
841
- if (r.className = "ui-calendario__numero", r.setAttribute("part", "numero"), r.textContent = String(t.dia), i.appendChild(r), e.length === 0) return i;
842
- const n = e.slice(0, o.maxEventos), l = e.length - n.length, c = a.createElement("span");
843
- if (c.className = "ui-calendario__eventos", n.forEach((d, h) => {
844
- const p = a.createElement("span");
845
- p.className = "ui-calendario__evento", p.setAttribute("part", "evento"), p.dataset.indice = String(h), d.tipo && (p.dataset.tipo = String(d.tipo));
846
- const y = V(d.cor);
847
- y && p.style.setProperty("--ui-calendario-evento-cor", y), p.textContent = typeof d.titulo == "string" ? d.titulo : "", p.title = p.textContent, c.appendChild(p);
848
- }), l > 0) {
849
- const d = a.createElement("span");
850
- d.className = "ui-calendario__mais", d.setAttribute("part", "mais"), d.textContent = `+${l}`, c.appendChild(d);
851
- }
852
- i.appendChild(c);
853
- const u = a.createElement("span");
854
- return u.className = "ui-calendario__pontos", u.setAttribute("aria-hidden", "true"), e.slice(0, 3).forEach((d) => {
855
- const h = a.createElement("span");
856
- h.className = "ui-calendario__ponto";
857
- const p = V(d.cor);
858
- p && h.style.setProperty("--ui-calendario-evento-cor", p), u.appendChild(h);
859
- }), i.appendChild(u), i;
860
- }
861
- const jt = ["unico", "nenhum"], Ot = ["completo", "compacto"], Nt = ["moldura", "simples"];
862
- class Lt extends D {
863
- constructor() {
864
- super();
865
- s(this, "raiz");
866
- s(this, "tituloEl");
867
- s(this, "selectMes");
868
- s(this, "selectAno");
869
- s(this, "semanaEl");
870
- s(this, "gradeEl");
871
- s(this, "listeners", new $());
872
- s(this, "_ano");
873
- s(this, "_mes");
874
- s(this, "_foco");
875
- s(this, "_eventos", []);
876
- s(this, "_porDia", /* @__PURE__ */ new Map());
877
- s(this, "_eventosAttr", !0);
878
- s(this, "_conectado", !1);
879
- // === Handlers ===
880
- s(this, "aoClicar", (t) => {
881
- var c;
882
- const e = t.target;
883
- if (!e || typeof e.closest != "function") return;
884
- const i = (c = e.closest("[data-acao]")) == null ? void 0 : c.dataset.acao;
885
- if (i === "anterior") return this.mesAnterior();
886
- if (i === "proximo") return this.proximoMes();
887
- if (i === "hoje") return this.hoje();
888
- const r = e.closest(".ui-calendario__dia");
889
- if (!r) return;
890
- const n = x(r.dataset.data);
891
- if (!n) return;
892
- const l = e.closest(".ui-calendario__evento");
893
- if (l) {
894
- const u = (this._porDia.get(b(n)) ?? [])[Number(l.dataset.indice)];
895
- if (u) {
896
- this.dispatchEvent(new CustomEvent("ui-evento-click", {
897
- detail: { evento: u, data: b(n) },
898
- bubbles: !0,
899
- composed: !0
900
- }));
901
- return;
902
- }
903
- }
904
- (n.ano !== this._ano || n.mes !== this._mes) && this.definirFoco(n, !1), this.selecionar(n), this.focarCelula();
905
- });
906
- s(this, "aoTeclar", (t) => {
907
- const e = t;
908
- if (e.key === "Enter" || e.key === " ") {
909
- e.preventDefault(), this.selecionar(this._foco), this.focarCelula();
910
- return;
911
- }
912
- const i = It(e.key, this._foco, this.inicioSemana, e.shiftKey);
913
- i && (e.preventDefault(), this.definirFoco(i, !0));
914
- });
915
- s(this, "aoMudarSeletor", () => {
916
- const t = w(this.selectMes.value, 1, 12, this._mes), e = w(this.selectAno.value, 1, 9999, this._ano), i = Math.min(this._foco.dia, F(e, t));
917
- this.definirFoco({ ano: e, mes: t, dia: i }, !1);
918
- });
919
- const t = this.attachShadow({ mode: "open" });
920
- t.innerHTML = `<style>${kt}</style>${Mt()}`, this.raiz = t.querySelector(".ui-calendario"), this.tituloEl = t.querySelector(".ui-calendario__titulo"), this.selectMes = t.querySelector('[data-seletor="mes"]'), this.selectAno = t.querySelector('[data-seletor="ano"]'), this.semanaEl = t.querySelector(".ui-calendario__semana"), this.gradeEl = t.querySelector(".ui-calendario__grade");
921
- const e = C();
922
- this._ano = e.ano, this._mes = e.mes, this._foco = e;
923
- }
924
- static get observedAttributes() {
925
- return Tt;
926
- }
927
- connectedCallback() {
928
- this.listeners.cleanup(), this.listeners.add(this.raiz, "click", this.aoClicar), this.listeners.add(this.gradeEl, "keydown", this.aoTeclar), this.listeners.add(this.selectMes, "change", this.aoMudarSeletor), this.listeners.add(this.selectAno, "change", this.aoMudarSeletor), this._conectado = !0, this.lerAtributosIniciais(), this.renderizar();
929
- }
930
- disconnectedCallback() {
931
- this.listeners.cleanup(), this._conectado = !1;
932
- }
933
- attributeChangedCallback(t, e, i) {
934
- if (e !== i) {
935
- if (t === "mes") {
936
- const r = S(i);
937
- r && (r.ano !== this._ano || r.mes !== this._mes) && (this._ano = r.ano, this._mes = r.mes, this._foco = this.focoDentroDoMes(this._foco));
938
- } else if (t === "valor" || t === "value") {
939
- const r = x(i);
940
- r && (this._foco = r, this._ano = r.ano, this._mes = r.mes);
941
- } else t === "eventos" && this._eventosAttr && (this._eventos = this.lerEventosDoAtributo(i), this._porDia = M(this._eventos));
942
- this._conectado && this.renderizar();
943
- }
944
- }
945
- // === API pública ===
946
- get eventos() {
947
- return this._eventos;
948
- }
949
- set eventos(t) {
950
- this._eventosAttr = !1, this._eventos = Array.isArray(t) ? t : [], this._porDia = M(this._eventos), this._conectado && this.renderizar();
951
- }
952
- get valor() {
953
- return this.getAttribute("valor") || this.getAttribute("value") || "";
954
- }
955
- set valor(t) {
956
- t ? this.setAttribute("valor", t) : this.removeAttribute("valor");
957
- }
958
- /** Mês exibido (`AAAA-MM`). */
959
- get mes() {
960
- return T(this._ano, this._mes);
961
- }
962
- set mes(t) {
963
- this.setAttribute("mes", t);
964
- }
965
- mesAnterior() {
966
- this.mudarMes(-1);
967
- }
968
- proximoMes() {
969
- this.mudarMes(1);
970
- }
971
- /** Vai para o mês da data informada (`AAAA-MM-DD` ou `AAAA-MM`) e foca o dia. */
972
- irPara(t) {
973
- const e = x(t);
974
- if (e) {
975
- this.definirFoco(e, !1);
976
- return;
977
- }
978
- const i = S(t);
979
- i && this.definirFoco({ ano: i.ano, mes: i.mes, dia: 1 }, !1);
980
- }
981
- /** Vai para o mês atual, foca e seleciona o dia de hoje. */
982
- hoje() {
983
- const t = C();
984
- this.definirFoco(t, !1), this.selecionar(t);
985
- }
986
- // === Estado derivado dos atributos ===
987
- get inicioSemana() {
988
- return w(this.getAttribute("inicio-semana"), 0, 6, 0);
989
- }
990
- get locale() {
991
- return this.getAttribute("locale") || "pt-BR";
992
- }
993
- get selecao() {
994
- return A(this.getAttribute("selecao"), jt, "unico");
995
- }
996
- get exibicao() {
997
- return A(this.getAttribute("exibicao"), Ot, "completo");
998
- }
999
- lerAtributosIniciais() {
1000
- const t = S(this.getAttribute("mes")) || S(this.getAttribute("valor") || this.getAttribute("value"));
1001
- t && (this._ano = t.ano, this._mes = t.mes);
1002
- const e = x(this.getAttribute("valor") || this.getAttribute("value"));
1003
- this._foco = this.focoDentroDoMes(e || this._foco), this._eventosAttr && this.hasAttribute("eventos") && (this._eventos = this.lerEventosDoAtributo(this.getAttribute("eventos")), this._porDia = M(this._eventos));
1004
- }
1005
- lerEventosDoAtributo(t) {
1006
- if (!t) return [];
1007
- try {
1008
- const e = JSON.parse(t);
1009
- return Array.isArray(e) ? e : [];
1010
- } catch {
1011
- return [];
1012
- }
1013
- }
1014
- /** Mantém o foco dentro do mês exibido (hoje, se for o mês atual; senão dia 1). */
1015
- focoDentroDoMes(t) {
1016
- if (t.ano === this._ano && t.mes === this._mes) return t;
1017
- const e = C();
1018
- return e.ano === this._ano && e.mes === this._mes ? e : { ano: this._ano, mes: this._mes, dia: 1 };
1019
- }
1020
- // === Mutações de estado ===
1021
- mudarMes(t) {
1022
- const e = O({ ano: this._ano, mes: this._mes, dia: this._foco.dia }, t);
1023
- this.definirFoco(e, !1);
1024
- }
1025
- definirFoco(t, e) {
1026
- const i = t.ano !== this._ano || t.mes !== this._mes;
1027
- this._ano = t.ano, this._mes = t.mes, this._foco = t, i && this.setAttribute("mes", T(t.ano, t.mes)), this.renderizar(), e && this.focarCelula(), i && this.dispatchEvent(new CustomEvent("ui-mes-change", {
1028
- detail: { mes: T(t.ano, t.mes) },
1029
- bubbles: !0,
1030
- composed: !0
1031
- }));
1032
- }
1033
- selecionar(t) {
1034
- if (this.selecao === "nenhum") return;
1035
- const e = b(t);
1036
- this.setAttribute("valor", e), this._foco = t, this.renderizar(), this.dispatchEvent(new CustomEvent("ui-change", {
1037
- detail: { data: e, eventos: this._porDia.get(e) ?? [] },
1038
- bubbles: !0,
1039
- composed: !0
1040
- }));
1041
- }
1042
- focarCelula() {
1043
- const t = this.gradeEl.querySelector(`[data-data="${b(this._foco)}"]`);
1044
- t == null || t.focus();
1045
- }
1046
- // === Renderização ===
1047
- renderizar() {
1048
- const t = this.ownerDocument, e = this.locale, i = this.inicioSemana, r = b(C()), n = x(this.valor), l = n ? b(n) : "", c = b(this._foco), u = w(this.getAttribute("max-eventos"), 1, 6, 3), d = G(e);
1049
- this.raiz.dataset.exibicao = this.exibicao, this.raiz.dataset.variante = A(this.getAttribute("variante"), Nt, "moldura");
1050
- const h = this.getAttribute("titulo") || "";
1051
- this.tituloEl.textContent = h, this.tituloEl.hidden = !h, this.selectMes.replaceChildren(...d.map((v, m) => {
1052
- const g = t.createElement("option");
1053
- return g.value = String(m + 1), g.textContent = v, g;
1054
- })), this.selectMes.value = String(this._mes);
1055
- const p = [];
1056
- for (let v = Math.max(1, this._ano - 10); v <= Math.min(9999, this._ano + 10); v++) {
1057
- const m = t.createElement("option");
1058
- m.value = String(v), m.textContent = String(v), p.push(m);
1059
- }
1060
- this.selectAno.replaceChildren(...p), this.selectAno.value = String(this._ano), this.semanaEl.replaceChildren(...K(e, i).map((v) => {
1061
- const m = t.createElement("span");
1062
- return m.className = "ui-calendario__semana-dia", m.textContent = Z(v), m;
1063
- }));
1064
- const y = Dt(this._ano, this._mes, i), Q = this.criarFormatadorDia(e);
1065
- this.gradeEl.setAttribute("aria-label", `${d[this._mes - 1]} de ${this._ano}`);
1066
- const U = [];
1067
- for (let v = 0; v < y.length / 7; v++) {
1068
- const m = t.createElement("div");
1069
- m.className = "ui-calendario__linha", m.setAttribute("role", "row"), y.slice(v * 7, v * 7 + 7).forEach((g) => {
1070
- const k = this._porDia.get(g.iso) ?? [], I = [Q(g)];
1071
- k.length && I.push(k.length === 1 ? "1 evento" : `${k.length} eventos`), g.iso === r && I.push("hoje"), m.appendChild(qt(t, {
1072
- dia: g,
1073
- eventos: k,
1074
- maxEventos: u,
1075
- hoje: g.iso === r,
1076
- selecionado: g.iso === l,
1077
- foco: g.iso === c,
1078
- rotulo: I.join(", ")
1079
- }));
1080
- }), U.push(m);
1081
- }
1082
- this.gradeEl.replaceChildren(...U);
1083
- }
1084
- criarFormatadorDia(t) {
1085
- try {
1086
- const e = new Intl.DateTimeFormat(t, { weekday: "long", day: "numeric", month: "long", year: "numeric", timeZone: "UTC" });
1087
- return (i) => e.format(new Date(Date.UTC(i.ano, i.mes - 1, i.dia)));
1088
- } catch {
1089
- return (e) => b(e);
1090
- }
1091
- }
1092
- }
1093
- _("ui-calendario", Lt);
1094
- const $t = ':host{--_espaco: var(--ui-espaco-sm, 8px);display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:var(--ui-linha-espaco, var(--_espaco));box-sizing:border-box;min-width:0;max-width:100%}:host([inline]){display:inline-flex;vertical-align:middle}:host([hidden]){display:none}:host([sem-quebra]){flex-wrap:nowrap}:host([espaco="nenhum"]){--_espaco: 0}:host([espaco="xs"]){--_espaco: var(--ui-espaco-xs, 4px)}:host([espaco="sm"]){--_espaco: var(--ui-espaco-sm, 8px)}:host([espaco="md"]){--_espaco: var(--ui-espaco-md, 16px)}:host([espaco="lg"]){--_espaco: var(--ui-espaco-lg, 24px)}:host([alinhar="inicio"]){align-items:flex-start}:host([alinhar="centro"]){align-items:center}:host([alinhar="fim"]){align-items:flex-end}:host([alinhar="esticar"]){align-items:stretch}:host([justificar="centro"]){justify-content:center}:host([justificar="fim"]){justify-content:flex-end}:host([justificar="entre"]){justify-content:space-between}:host([justificar="ao-redor"]){justify-content:space-around}::slotted(*){flex:0 0 auto;width:auto;max-width:100%;margin-top:0;margin-bottom:0}::slotted(ui-campo-texto),::slotted(ui-input),::slotted(ui-lista-flutuante),::slotted(ui-select){flex:1 1 var(--ui-linha-campo-base, 12rem);min-width:0}::slotted([expandir]){flex:1 1 0;min-width:0}';
1095
- class Ft extends D {
1096
- static get observedAttributes() {
1097
- return ["tamanho", "size", "densidade", "altura", "height"];
1098
- }
1099
- constructor() {
1100
- super();
1101
- const o = this.attachShadow({ mode: "open" });
1102
- o.innerHTML = `<style>${$t}</style><slot></slot>`;
1103
- }
1104
- connectedCallback() {
1105
- q(this);
1106
- }
1107
- attributeChangedCallback(o, t, e) {
1108
- t !== e && q(this);
1109
- }
1110
- lerTexto(o) {
1111
- return this.getAttribute(o);
1112
- }
1113
- definirTexto(o, t) {
1114
- t == null || t === "" ? this.removeAttribute(o) : this.setAttribute(o, String(t));
1115
- }
1116
- get tamanho() {
1117
- return this.lerTexto("tamanho");
1118
- }
1119
- set tamanho(o) {
1120
- this.definirTexto("tamanho", o);
1121
- }
1122
- get altura() {
1123
- return this.lerTexto("altura");
1124
- }
1125
- set altura(o) {
1126
- this.definirTexto("altura", o === null ? null : String(o));
1127
- }
1128
- get alinhar() {
1129
- return this.lerTexto("alinhar");
1130
- }
1131
- set alinhar(o) {
1132
- this.definirTexto("alinhar", o);
1133
- }
1134
- get justificar() {
1135
- return this.lerTexto("justificar");
1136
- }
1137
- set justificar(o) {
1138
- this.definirTexto("justificar", o);
1139
- }
1140
- get espaco() {
1141
- return this.lerTexto("espaco");
1142
- }
1143
- set espaco(o) {
1144
- this.definirTexto("espaco", o);
1145
- }
1146
- get semQuebra() {
1147
- return this.hasAttribute("sem-quebra");
1148
- }
1149
- set semQuebra(o) {
1150
- this.toggleAttribute("sem-quebra", !!o);
1151
- }
1152
- }
1153
- _("ui-linha", Ft);
1154
- export {
1155
- At as A,
1156
- ft as S,
1157
- bt as U,
1158
- Lt as a,
1159
- Ft as b,
1160
- X as c,
1161
- Et as d,
1162
- st as e,
1163
- H as f,
1164
- wt as g,
1165
- yt as h,
1166
- xt as t
1167
- };