@thibezer/ui-components-kit 2.24.0 → 2.24.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.
Files changed (150) hide show
  1. package/CHANGELOG.md +69 -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 +18 -0
  14. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +4 -0
  15. package/dist/components/ui-card/ui-card.d.ts +4 -0
  16. package/dist/components/ui-editor-prancha/editor-modos.d.ts +10 -0
  17. package/dist/components/ui-editor-prancha/editor-tipos.d.ts +4 -0
  18. package/dist/components/ui-editor-prancha/index.d.ts +1 -0
  19. package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +39 -6
  20. package/dist/core.cjs +1 -1
  21. package/dist/core.js +44 -55
  22. package/dist/{cores-utils-BrdynxRd.js → cores-utils-DMyqWvZh.js} +2 -2
  23. package/dist/cores.cjs +32 -1
  24. package/dist/cores.js +300 -13
  25. package/dist/custom-elements.json +33962 -33439
  26. package/dist/data.cjs +28 -1
  27. package/dist/data.js +286 -99
  28. package/dist/{feature_caixa-2Sxv3tGa.js → feature_caixa-BVc5LenS.js} +42 -42
  29. package/dist/{feature_desenho-BVHivWIB.js → feature_desenho-CC8Mp5Gp.js} +2 -2
  30. package/dist/feedback.cjs +52 -1
  31. package/dist/feedback.js +655 -25
  32. package/dist/forms.cjs +66 -1
  33. package/dist/forms.js +1216 -39
  34. package/dist/{geometria-px-DUs5FgLE.js → geometria-px-DHMPUsxC.js} +47 -47
  35. package/dist/index.cjs +67 -1
  36. package/dist/index.js +1476 -274
  37. package/dist/kit-base-CGqj9aiD.cjs +2 -0
  38. package/dist/kit-base-_THn4w3u.js +1079 -0
  39. package/dist/mapa.cjs +5 -5
  40. package/dist/mapa.js +16 -17
  41. package/dist/modal.cjs +18 -1
  42. package/dist/modal.js +235 -29
  43. package/dist/motor.js +49 -49
  44. package/dist/prancha-nucleo.cjs +3 -1
  45. package/dist/prancha-nucleo.js +3120 -277
  46. package/dist/prancha.cjs +38 -1
  47. package/dist/prancha.js +3233 -228
  48. package/dist/register.cjs +1 -1
  49. package/dist/register.js +3 -20
  50. package/dist/seletor-mapa-base.cjs +13 -13
  51. package/dist/seletor-mapa-base.js +3 -5
  52. package/dist/tabela.cjs +142 -1
  53. package/dist/tabela.js +3773 -92
  54. package/dist/tipos-elementos.d.ts +5 -1
  55. package/dist/tipos-vue.d.ts +4 -1
  56. package/dist/tools.cjs +16 -1
  57. package/dist/tools.js +1564 -26
  58. package/dist/ui-seletor-cor-BGw8SBPm.cjs +83 -0
  59. package/dist/{ui-seletor-cor-Cd8jkzXG.js → ui-seletor-cor-B_twSm-V.js} +8 -9
  60. package/dist/utils-ClVgqVyJ.cjs +1 -0
  61. package/dist/utils-DrHoxxmf.js +83 -0
  62. package/package.json +43 -2
  63. package/dist/acessibilidade-CSzX-DkG.cjs +0 -1
  64. package/dist/acessibilidade-CUlSXc2X.js +0 -38
  65. package/dist/altura-controle-ukMRPckR.cjs +0 -1
  66. package/dist/altura-controle-vxQiXG4q.js +0 -62
  67. package/dist/alvo-digitavel-CzCvNVQ3.js +0 -23
  68. package/dist/alvo-digitavel-DbH0hYFf.cjs +0 -1
  69. package/dist/degrade-CIxvOTUv.cjs +0 -1
  70. package/dist/degrade-gDa5sW__.js +0 -119
  71. package/dist/feature_caixa-CnYPKVFS.cjs +0 -1
  72. package/dist/feature_caixa-DCs9ZeSk.js +0 -1038
  73. package/dist/feature_historico-BAIYk1Me.cjs +0 -3
  74. package/dist/feature_historico-C4h9y5fu.js +0 -3039
  75. package/dist/form-atalhos-7JTYvumA.cjs +0 -1
  76. package/dist/form-atalhos-DDTlpgaB.js +0 -203
  77. package/dist/form-erros-CwPz7Jr4.cjs +0 -1
  78. package/dist/form-erros-DT5HklfD.js +0 -184
  79. package/dist/form-submissao-C-SPRKgT.js +0 -61
  80. package/dist/form-submissao-DxKO5MHI.cjs +0 -1
  81. package/dist/form-validacao-BlQFxUVj.js +0 -104
  82. package/dist/form-validacao-DIeyQVH5.cjs +0 -1
  83. package/dist/geometria-px-DKrWq_XY.js +0 -639
  84. package/dist/leaflet-CEPcxGWV.cjs +0 -1
  85. package/dist/leaflet-DOq10gfg.js +0 -84
  86. package/dist/leaflet-loader-94z5VsdY.cjs +0 -2
  87. package/dist/leaflet-loader-Cjcdgj5R.js +0 -21
  88. package/dist/listener-bag-D5omxZ9h.cjs +0 -1
  89. package/dist/listener-bag-DQgv7OON.js +0 -34
  90. package/dist/motor-By2te6PZ.js +0 -1400
  91. package/dist/motor-CkMxd378.cjs +0 -1
  92. package/dist/opcoes-CupvWVIm.js +0 -24
  93. package/dist/opcoes-vdAUY5OI.cjs +0 -1
  94. package/dist/parts-CaoQiCfI.js +0 -7
  95. package/dist/parts-vQa2873h.cjs +0 -1
  96. package/dist/prancha-paleta-BZ-9QDgh.js +0 -5276
  97. package/dist/prancha-paleta-Bb24vP71.cjs +0 -17
  98. package/dist/ssr-safe-5cWfJP-s.js +0 -10
  99. package/dist/ssr-safe-CiHD1adl.cjs +0 -1
  100. package/dist/svg-seguro-ChVJ2L2z.js +0 -74
  101. package/dist/svg-seguro-J2RM1Ssf.cjs +0 -1
  102. package/dist/ui-badge-DE58YSBY.cjs +0 -28
  103. package/dist/ui-badge-KgmI3jOD.js +0 -201
  104. package/dist/ui-botao-Dz8YvmiA.cjs +0 -12
  105. package/dist/ui-botao-zLkcMMyP.js +0 -168
  106. package/dist/ui-bus-CUd99VJi.js +0 -177
  107. package/dist/ui-bus-XqBLlTYQ.cjs +0 -1
  108. package/dist/ui-camadas-DoHPnbQm.js +0 -3133
  109. package/dist/ui-camadas-Vx7wYD4D.cjs +0 -311
  110. package/dist/ui-campo-texto-Dliyt9qr.cjs +0 -16
  111. package/dist/ui-campo-texto-btevggO3.js +0 -379
  112. package/dist/ui-card-7IEYbCN0.js +0 -150
  113. package/dist/ui-card-Bx8EyzYY.cjs +0 -20
  114. package/dist/ui-card-DFnRp9bl.js +0 -146
  115. package/dist/ui-card-DrWVJQKw.cjs +0 -20
  116. package/dist/ui-controle-cores-B1w_Yl69.cjs +0 -32
  117. package/dist/ui-controle-cores-BRjMvmMn.js +0 -291
  118. package/dist/ui-controle-cores-BcH9k2Fa.js +0 -292
  119. package/dist/ui-controle-cores-CvSTP6gJ.cjs +0 -32
  120. package/dist/ui-editor-prancha-CIngI6yI.js +0 -2886
  121. package/dist/ui-editor-prancha-DorSe6sC.cjs +0 -31
  122. package/dist/ui-linha-2kY7TNUJ.cjs +0 -38
  123. package/dist/ui-linha-B4mBRm1x.cjs +0 -61
  124. package/dist/ui-linha-DTEIIww4.js +0 -1167
  125. package/dist/ui-linha-KFF86FW5.js +0 -752
  126. package/dist/ui-modal-BrXzVZ65.js +0 -216
  127. package/dist/ui-modal-lARKzEVZ.cjs +0 -18
  128. package/dist/ui-paleta-ferramentas-Bu6JaT0s.js +0 -1245
  129. package/dist/ui-paleta-ferramentas-D3Jhwt26.cjs +0 -21
  130. package/dist/ui-paleta-ferramentas-DebHYiwd.js +0 -1615
  131. package/dist/ui-paleta-ferramentas-Dgejtluh.js +0 -1423
  132. package/dist/ui-paleta-ferramentas-hzyo8wBt.cjs +0 -22
  133. package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +0 -22
  134. package/dist/ui-seletor-cor-0RLjcME6.cjs +0 -83
  135. package/dist/ui-seletor-cor-CMuuW-Ym.cjs +0 -83
  136. package/dist/ui-seletor-cor-DFIQ1sin.js +0 -405
  137. package/dist/ui-skeleton-BLEV6h3k.js +0 -653
  138. package/dist/ui-skeleton-B_XTaGrX.cjs +0 -52
  139. package/dist/ui-switch-BXIDwC-Y.cjs +0 -66
  140. package/dist/ui-switch-Ctxk-jKS.js +0 -1212
  141. package/dist/ui-tabela-CXxqbwXv.cjs +0 -7
  142. package/dist/ui-tabela-Cd0vOwnT.js +0 -1459
  143. package/dist/ui-tabela-propriedades-C5cIF5ES.js +0 -3779
  144. package/dist/ui-tabela-propriedades-CJyo568n.js +0 -3517
  145. package/dist/ui-tabela-propriedades-D96Djx-q.cjs +0 -136
  146. package/dist/ui-tabela-propriedades-Wa34hfIr.cjs +0 -142
  147. package/dist/ui-tabela-propriedades-ahQhQauu.js +0 -2329
  148. package/dist/ui-tabela-propriedades-w9JWhjHy.cjs +0 -142
  149. package/dist/zero-js-triggers-CJT988bR.js +0 -83
  150. package/dist/zero-js-triggers-CgM9IIQB.cjs +0 -1
package/dist/mapa.cjs CHANGED
@@ -1,14 +1,14 @@
1
- "use strict";var I=Object.defineProperty;var z=(r,e,t)=>e in r?I(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>z(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const m=require("./leaflet-CEPcxGWV.cjs"),p=require("./ssr-safe-CiHD1adl.cjs"),y=require("./leaflet-loader-94z5VsdY.cjs"),_=":host{display:block;width:100%;height:400px;position:relative;border-radius:var(--ui-raio-lg, 10px);overflow:hidden;box-shadow:var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))}.ui-mapa-container{width:100%;height:100%;z-index:1}.leaflet-top,.leaflet-bottom{z-index:1000}.ui-mapa-popup{font-family:inherit;font-size:13px;font-weight:500;color:#111827;padding:2px 4px}.ui-mapa-svg-pin,.ui-mapa-div-marker{background:transparent!important;border:none!important;cursor:pointer;transition:transform .15s ease,filter .15s ease}.ui-mapa-svg-pin:hover,.ui-mapa-div-marker:hover{transform:scale(1.15);filter:brightness(1.2)}";function d(){return y.obterLeafletSincrono()??null}async function E(){return await y.carregarLeaflet()??null}function L(r){return{osm:{nome:"OpenStreetMap",layer:()=>r.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'})},satelite:{nome:"Satélite (Esri)",layer:()=>r.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",{attribution:"Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"})},topografia:{nome:"Topografia",layer:()=>r.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",{attribution:'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'})},ruas:{nome:"Ruas (Esri)",layer:()=>r.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",{attribution:"Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012"})}}}const u={lat:-23.55052,lng:-46.633308,zoom:13},w="#00f5a0",O="#3388ff",k=3,c=r=>Number.isFinite(r);function v(r,e,t){const i=parseFloat(r??""),o=parseFloat(e??""),a=parseInt(t??"",10);return{lat:c(i)&&Math.abs(i)<=90?i:u.lat,lng:c(o)&&Math.abs(o)<=180?o:u.lng,zoom:c(a)&&a>=0&&a<=22?a:u.zoom}}function P(r,e){const t=parseInt(r??"",10);return c(t)&&t>0?t:e}const R=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,N=/^(?:rgb|rgba|hsl|hsla)\(\s*[\d.,%\s/deg-]+\)$/i,U=/^[a-z]{3,30}$/i;function T(r,e){const t=(r??"").trim();return R.test(t)||N.test(t)||U.test(t)?t:e}function D(r,e){const t=(r??"").split(",").map(i=>i.trim().toLowerCase()).filter(i=>e.includes(i));return t.length>0?t:["osm"]}function A(r){if(!r)return[];let e;try{e=JSON.parse(r)}catch(i){return console.error('Formato inválido para atributo pontos no <ui-mapa-linha>. Deve ser um JSON array, ex: "[[lat, lng], ...]"',i),[]}if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!Array.isArray(i)||i.length<2)continue;const[o,a]=i;typeof o=="number"&&typeof a=="number"&&c(o)&&c(a)&&Math.abs(o)<=90&&Math.abs(a)<=180&&t.push([o,a])}return t}const G="Mapa",H=`
1
+ "use strict";var x=Object.defineProperty;var I=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>I(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const n=require("./kit-base-CGqj9aiD.cjs"),g=require("./utils-ClVgqVyJ.cjs"),z=":host{display:block;width:100%;height:400px;position:relative;border-radius:var(--ui-raio-lg, 10px);overflow:hidden;box-shadow:var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))}.ui-mapa-container{width:100%;height:100%;z-index:1}.leaflet-top,.leaflet-bottom{z-index:1000}.ui-mapa-popup{font-family:inherit;font-size:13px;font-weight:500;color:#111827;padding:2px 4px}.ui-mapa-svg-pin,.ui-mapa-div-marker{background:transparent!important;border:none!important;cursor:pointer;transition:transform .15s ease,filter .15s ease}.ui-mapa-svg-pin:hover,.ui-mapa-div-marker:hover{transform:scale(1.15);filter:brightness(1.2)}";function m(){return n.obterLeafletSincrono()??null}async function _(){return await n.carregarLeaflet()??null}function E(r){return{osm:{nome:"OpenStreetMap",layer:()=>r.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'})},satelite:{nome:"Satélite (Esri)",layer:()=>r.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",{attribution:"Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"})},topografia:{nome:"Topografia",layer:()=>r.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",{attribution:'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'})},ruas:{nome:"Ruas (Esri)",layer:()=>r.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",{attribution:"Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012"})}}}const u={lat:-23.55052,lng:-46.633308,zoom:13},L="#00f5a0",w="#3388ff",O=3,p=r=>Number.isFinite(r);function v(r,e,t){const i=parseFloat(r??""),o=parseFloat(e??""),a=parseInt(t??"",10);return{lat:p(i)&&Math.abs(i)<=90?i:u.lat,lng:p(o)&&Math.abs(o)<=180?o:u.lng,zoom:p(a)&&a>=0&&a<=22?a:u.zoom}}function k(r,e){const t=parseInt(r??"",10);return p(t)&&t>0?t:e}const P=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,R=/^(?:rgb|rgba|hsl|hsla)\(\s*[\d.,%\s/deg-]+\)$/i,N=/^[a-z]{3,30}$/i;function y(r,e){const t=(r??"").trim();return P.test(t)||R.test(t)||N.test(t)?t:e}function U(r,e){const t=(r??"").split(",").map(i=>i.trim().toLowerCase()).filter(i=>e.includes(i));return t.length>0?t:["osm"]}function A(r){if(!r)return[];let e;try{e=JSON.parse(r)}catch(i){return console.error('Formato inválido para atributo pontos no <ui-mapa-linha>. Deve ser um JSON array, ex: "[[lat, lng], ...]"',i),[]}if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!Array.isArray(i)||i.length<2)continue;const[o,a]=i;typeof o=="number"&&typeof a=="number"&&p(o)&&p(a)&&Math.abs(o)<=90&&Math.abs(a)<=180&&t.push([o,a])}return t}const D="Mapa",G=`
2
2
  <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 140px; padding: 16px; box-sizing: border-box; text-align: center; color: var(--ui-cor-texto-secundario, #888899); font-family: var(--ui-fonte-base, 'Inter', sans-serif); font-size: 12px; background: var(--ui-cor-superficie, #141417); border-radius: var(--ui-raio-borda, 6px); border: 1px dashed var(--ui-cor-borda, rgba(255,255,255,0.15));">
3
3
  <span style="font-size: 20px; margin-bottom: 6px;" aria-hidden="true">🗺️</span>
4
4
  <strong style="color: var(--ui-cor-texto, #e1e1e6); margin-bottom: 4px;">Leaflet não encontrado</strong>
5
5
  <span style="max-width: 320px; line-height: 1.4;">Para utilizar o componente <code>&lt;ui-mapa&gt;</code>, instale a biblioteca <code>leaflet</code> ou inclua seu script no HTML: <code>&lt;script src=".../leaflet.js"&gt;&lt;/script&gt;</code>.</span>
6
6
  </div>
7
- `;class M extends p.SafeHTMLElement{constructor(){super();s(this,"mapContainer");s(this,"mapInstance",null);s(this,"_initTimer",null);s(this,"_resizeObserver");s(this,"_resizeTimer");s(this,"_invalidarTimer");const t=this.attachShadow({mode:"open"});t.innerHTML=`
7
+ `;class T extends n.SafeHTMLElement{constructor(){super();s(this,"mapContainer");s(this,"mapInstance",null);s(this,"_initTimer",null);s(this,"_resizeObserver");s(this,"_resizeTimer");s(this,"_invalidarTimer");const t=this.attachShadow({mode:"open"});t.innerHTML=`
8
8
  <style>
9
- ${m.leafletCss}
10
- ${_}
9
+ ${n.leafletCss}
10
+ ${z}
11
11
  </style>
12
12
  <div class="ui-mapa-container" id="map-container" part="base" role="region"></div>
13
13
  <div style="display: none;"><slot></slot></div>
14
- `,this.mapContainer=t.getElementById("map-container"),this.sincronizarRotulo()}static get observedAttributes(){return["lat","lng","zoom","aria-label"]}connectedCallback(){this.sincronizarRotulo(),this._initTimer=setTimeout(()=>{this._initTimer=null,this.initMap()},0)}disconnectedCallback(){var t;this._initTimer&&(clearTimeout(this._initTimer),this._initTimer=null),(t=this._resizeObserver)==null||t.disconnect(),this._resizeObserver=void 0,this._resizeTimer&&clearTimeout(this._resizeTimer),this._invalidarTimer&&clearTimeout(this._invalidarTimer),this._resizeTimer=void 0,this._invalidarTimer=void 0,this.mapInstance&&(this.mapInstance.remove(),this.mapInstance=null)}attributeChangedCallback(t,i,o){if(i!==o){if(t==="aria-label"){this.sincronizarRotulo();return}if(this.mapInstance){const a=v(this.getAttribute("lat"),this.getAttribute("lng"),this.getAttribute("zoom"));this.mapInstance.setView([a.lat,a.lng],a.zoom)}}}sincronizarRotulo(){var t;(t=this.mapContainer)==null||t.setAttribute("aria-label",this.getAttribute("aria-label")||G)}async initMap(){var b;if(this.mapInstance)return;const t=await E();if(!this.isConnected||this.mapInstance)return;if(!t){this.mapContainer.innerHTML=H;return}const i=L(t),o=v(this.getAttribute("lat"),this.getAttribute("lng"),this.getAttribute("zoom")),a=t.map(this.mapContainer).setView([o.lat,o.lng],o.zoom);this.mapInstance=a;const n=D(this.getAttribute("camadas"),Object.keys(i)),f=i[n[0]].layer();if(f.addTo(a),n.length>1){const l={[i[n[0]].nome]:f};for(const g of n.slice(1))l[i[g].nome]=i[g].layer();t.control.layers(l,void 0,{position:"topright"}).addTo(a)}(b=t.Icon)!=null&&b.Default&&(t.Icon.Default.imagePath="https://unpkg.com/leaflet@1.9.4/dist/images/"),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>{this._resizeTimer&&clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(()=>{var l;return(l=this.mapInstance)==null?void 0:l.invalidateSize()},60)}),this._resizeObserver.observe(this.mapContainer)),this._invalidarTimer=setTimeout(()=>{var l;return(l=this.mapInstance)==null?void 0:l.invalidateSize()},100),this.dispatchEvent(new CustomEvent("ui-mapa-pronto",{detail:{map:a},bubbles:!0,composed:!0}))}getMap(){return this.mapInstance}}p.definirCustomElement("ui-mapa",M);const h="http://www.w3.org/2000/svg";function V(r){const e=document.createElement("div");return e.style.cssText="width:14px;height:14px;border-radius:50%;border:2px solid #ffffff;box-shadow:0 1px 4px rgba(0,0,0,0.6);",e.style.backgroundColor=r,e}function $(r){const e=document.createElementNS(h,"svg");e.setAttribute("width","24"),e.setAttribute("height","32"),e.setAttribute("viewBox","0 0 24 32"),e.setAttribute("fill","none"),e.setAttribute("aria-hidden","true"),e.style.filter="drop-shadow(0 2px 4px rgba(0,0,0,0.45))";const t=document.createElementNS(h,"path");t.setAttribute("d","M12 0C5.372 0 0 5.372 0 12C0 21 12 32 12 32C12 32 24 21 24 12C24 5.372 18.628 0 12 0Z"),t.setAttribute("fill",r);const i=document.createElementNS(h,"circle");return i.setAttribute("cx","12"),i.setAttribute("cy","11"),i.setAttribute("r","4.5"),i.setAttribute("fill","#ffffff"),e.append(t,i),e}function F(r,e,t){return t==="circle"?r.divIcon({className:"ui-mapa-div-marker",html:V(e),iconSize:[14,14],iconAnchor:[7,7]}):r.divIcon({className:"ui-mapa-svg-pin",html:$(e),iconSize:[24,32],iconAnchor:[12,32],popupAnchor:[0,-30]})}const j=30,q=50;class C{constructor(e,t){s(this,"pai",null);s(this,"timer",null);s(this,"tentativas",0);s(this,"aoPronto",()=>{this.opcoes.aoPerderMapa(),this.tentativas=0,this.tentar()});this.host=e,this.opcoes=t}conectar(){var e;this.desconectar(),this.pai=this.host.closest("ui-mapa"),(e=this.pai)==null||e.addEventListener("ui-mapa-pronto",this.aoPronto),this.agendar(0)}desconectar(){var e;this.timer&&clearTimeout(this.timer),this.timer=null,(e=this.pai)==null||e.removeEventListener("ui-mapa-pronto",this.aoPronto),this.pai=null,this.tentativas=0}agendar(e){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.tentar(),e)}tentar(){this.timer=null;const e=this.pai??this.host.closest("ui-mapa");if(!e){console.warn(`<${this.opcoes.rotulo}> deve estar dentro de um elemento <ui-mapa>`);return}const t=e.getMap();if(!t){if(this.tentativas>=j){console.warn(`<${this.opcoes.rotulo}> Tempo limite esgotado aguardando inicialização do mapa pai.`);return}this.tentativas++,this.agendar(q);return}this.tentativas=0,this.opcoes.aoMapa(t)}}class S extends p.SafeHTMLElement{constructor(){super(...arguments);s(this,"marker",null);s(this,"vinculo",new C(this,{rotulo:"ui-mapa-marcador",aoMapa:t=>this.criarMarcador(t),aoPerderMapa:()=>this.removerMarcador()}))}static get observedAttributes(){return["lat","lng","titulo","cor","formato"]}connectedCallback(){this.vinculo.conectar()}disconnectedCallback(){this.vinculo.desconectar(),this.removerMarcador()}attributeChangedCallback(t,i,o){if(!(i===o||!this.marker)){if(t==="lat"||t==="lng"){const a=m.parseCoordenada(this.getAttribute("lat"),this.getAttribute("lng"));a&&this.marker.setLatLng([a.lat,a.lon])}else if(t==="titulo")this.marker.unbindPopup(),o&&this.marker.bindPopup(this.createPopupContent(o)),this.aplicarNomeAcessivel();else if(t==="cor"||t==="formato"){const a=d();a&&this.marker.setIcon(this.createIcon(a))}}}removerMarcador(){var t;(t=this.marker)==null||t.remove(),this.marker=null}createPopupContent(t){const i=document.createElement("div");return i.className="ui-mapa-popup",i.textContent=t,i}createIcon(t){const i=this.getAttribute("formato")==="circle"?"circle":"pin";return F(t,T(this.getAttribute("cor"),w),i)}aplicarNomeAcessivel(){var o;const t=(o=this.marker)==null?void 0:o.getElement();if(!t)return;const i=this.getAttribute("titulo");i?(t.setAttribute("aria-label",i),t.setAttribute("title",i)):(t.removeAttribute("aria-label"),t.removeAttribute("title"))}criarMarcador(t){this.removerMarcador();const i=m.parseCoordenada(this.getAttribute("lat"),this.getAttribute("lng"));if(!i)return;const o=d();if(!o)return;const a=this.getAttribute("titulo"),n=o.marker([i.lat,i.lon],{icon:this.createIcon(o),keyboard:!0,title:a||void 0});a&&n.bindPopup(this.createPopupContent(a)),n.addTo(t),this.marker=n,this.aplicarNomeAcessivel()}}p.definirCustomElement("ui-mapa-marcador",S);class x extends p.SafeHTMLElement{constructor(){super(...arguments);s(this,"polyline",null);s(this,"vinculo",new C(this,{rotulo:"ui-mapa-linha",aoMapa:t=>this.criarLinha(t),aoPerderMapa:()=>this.removerLinha()}))}static get observedAttributes(){return["pontos","cor","espessura"]}connectedCallback(){this.vinculo.conectar()}disconnectedCallback(){this.vinculo.desconectar(),this.removerLinha()}attributeChangedCallback(t,i,o){i===o||!this.polyline||(t==="pontos"?this.polyline.setLatLngs(A(this.getAttribute("pontos"))):this.polyline.setStyle(this.estilo()))}estilo(){return{color:T(this.getAttribute("cor"),O),weight:P(this.getAttribute("espessura"),k)}}removerLinha(){var t;(t=this.polyline)==null||t.remove(),this.polyline=null}criarLinha(t){this.removerLinha();const i=d();i&&(this.polyline=i.polyline(A(this.getAttribute("pontos")),this.estilo()).addTo(t))}}p.definirCustomElement("ui-mapa-linha",x);exports.UIMapa=M;exports.UIMapaLinha=x;exports.UIMapaMarcador=S;
14
+ `,this.mapContainer=t.getElementById("map-container"),this.sincronizarRotulo()}static get observedAttributes(){return["lat","lng","zoom","aria-label"]}connectedCallback(){this.sincronizarRotulo(),this._initTimer=setTimeout(()=>{this._initTimer=null,this.initMap()},0)}disconnectedCallback(){var t;this._initTimer&&(clearTimeout(this._initTimer),this._initTimer=null),(t=this._resizeObserver)==null||t.disconnect(),this._resizeObserver=void 0,this._resizeTimer&&clearTimeout(this._resizeTimer),this._invalidarTimer&&clearTimeout(this._invalidarTimer),this._resizeTimer=void 0,this._invalidarTimer=void 0,this.mapInstance&&(this.mapInstance.remove(),this.mapInstance=null)}attributeChangedCallback(t,i,o){if(i!==o){if(t==="aria-label"){this.sincronizarRotulo();return}if(this.mapInstance){const a=v(this.getAttribute("lat"),this.getAttribute("lng"),this.getAttribute("zoom"));this.mapInstance.setView([a.lat,a.lng],a.zoom)}}}sincronizarRotulo(){var t;(t=this.mapContainer)==null||t.setAttribute("aria-label",this.getAttribute("aria-label")||D)}async initMap(){var f;if(this.mapInstance)return;const t=await _();if(!this.isConnected||this.mapInstance)return;if(!t){this.mapContainer.innerHTML=G;return}const i=E(t),o=v(this.getAttribute("lat"),this.getAttribute("lng"),this.getAttribute("zoom")),a=t.map(this.mapContainer).setView([o.lat,o.lng],o.zoom);this.mapInstance=a;const l=U(this.getAttribute("camadas"),Object.keys(i)),d=i[l[0]].layer();if(d.addTo(a),l.length>1){const c={[i[l[0]].nome]:d};for(const b of l.slice(1))c[i[b].nome]=i[b].layer();t.control.layers(c,void 0,{position:"topright"}).addTo(a)}(f=t.Icon)!=null&&f.Default&&(t.Icon.Default.imagePath="https://unpkg.com/leaflet@1.9.4/dist/images/"),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>{this._resizeTimer&&clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(()=>{var c;return(c=this.mapInstance)==null?void 0:c.invalidateSize()},60)}),this._resizeObserver.observe(this.mapContainer)),this._invalidarTimer=setTimeout(()=>{var c;return(c=this.mapInstance)==null?void 0:c.invalidateSize()},100),this.dispatchEvent(new CustomEvent("ui-mapa-pronto",{detail:{map:a},bubbles:!0,composed:!0}))}getMap(){return this.mapInstance}}n.definirCustomElement("ui-mapa",T);const h="http://www.w3.org/2000/svg";function H(r){const e=document.createElement("div");return e.style.cssText="width:14px;height:14px;border-radius:50%;border:2px solid #ffffff;box-shadow:0 1px 4px rgba(0,0,0,0.6);",e.style.backgroundColor=r,e}function V(r){const e=document.createElementNS(h,"svg");e.setAttribute("width","24"),e.setAttribute("height","32"),e.setAttribute("viewBox","0 0 24 32"),e.setAttribute("fill","none"),e.setAttribute("aria-hidden","true"),e.style.filter="drop-shadow(0 2px 4px rgba(0,0,0,0.45))";const t=document.createElementNS(h,"path");t.setAttribute("d","M12 0C5.372 0 0 5.372 0 12C0 21 12 32 12 32C12 32 24 21 24 12C24 5.372 18.628 0 12 0Z"),t.setAttribute("fill",r);const i=document.createElementNS(h,"circle");return i.setAttribute("cx","12"),i.setAttribute("cy","11"),i.setAttribute("r","4.5"),i.setAttribute("fill","#ffffff"),e.append(t,i),e}function $(r,e,t){return t==="circle"?r.divIcon({className:"ui-mapa-div-marker",html:H(e),iconSize:[14,14],iconAnchor:[7,7]}):r.divIcon({className:"ui-mapa-svg-pin",html:V(e),iconSize:[24,32],iconAnchor:[12,32],popupAnchor:[0,-30]})}const F=30,B=50;class M{constructor(e,t){s(this,"pai",null);s(this,"timer",null);s(this,"tentativas",0);s(this,"aoPronto",()=>{this.opcoes.aoPerderMapa(),this.tentativas=0,this.tentar()});this.host=e,this.opcoes=t}conectar(){var e;this.desconectar(),this.pai=this.host.closest("ui-mapa"),(e=this.pai)==null||e.addEventListener("ui-mapa-pronto",this.aoPronto),this.agendar(0)}desconectar(){var e;this.timer&&clearTimeout(this.timer),this.timer=null,(e=this.pai)==null||e.removeEventListener("ui-mapa-pronto",this.aoPronto),this.pai=null,this.tentativas=0}agendar(e){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.tentar(),e)}tentar(){this.timer=null;const e=this.pai??this.host.closest("ui-mapa");if(!e){console.warn(`<${this.opcoes.rotulo}> deve estar dentro de um elemento <ui-mapa>`);return}const t=e.getMap();if(!t){if(this.tentativas>=F){console.warn(`<${this.opcoes.rotulo}> Tempo limite esgotado aguardando inicialização do mapa pai.`);return}this.tentativas++,this.agendar(B);return}this.tentativas=0,this.opcoes.aoMapa(t)}}class C extends n.SafeHTMLElement{constructor(){super(...arguments);s(this,"marker",null);s(this,"vinculo",new M(this,{rotulo:"ui-mapa-marcador",aoMapa:t=>this.criarMarcador(t),aoPerderMapa:()=>this.removerMarcador()}))}static get observedAttributes(){return["lat","lng","titulo","cor","formato"]}connectedCallback(){this.vinculo.conectar()}disconnectedCallback(){this.vinculo.desconectar(),this.removerMarcador()}attributeChangedCallback(t,i,o){if(!(i===o||!this.marker)){if(t==="lat"||t==="lng"){const a=g.parseCoordenada(this.getAttribute("lat"),this.getAttribute("lng"));a&&this.marker.setLatLng([a.lat,a.lon])}else if(t==="titulo")this.marker.unbindPopup(),o&&this.marker.bindPopup(this.createPopupContent(o)),this.aplicarNomeAcessivel();else if(t==="cor"||t==="formato"){const a=m();a&&this.marker.setIcon(this.createIcon(a))}}}removerMarcador(){var t;(t=this.marker)==null||t.remove(),this.marker=null}createPopupContent(t){const i=document.createElement("div");return i.className="ui-mapa-popup",i.textContent=t,i}createIcon(t){const i=this.getAttribute("formato")==="circle"?"circle":"pin";return $(t,y(this.getAttribute("cor"),L),i)}aplicarNomeAcessivel(){var o;const t=(o=this.marker)==null?void 0:o.getElement();if(!t)return;const i=this.getAttribute("titulo");i?(t.setAttribute("aria-label",i),t.setAttribute("title",i)):(t.removeAttribute("aria-label"),t.removeAttribute("title"))}criarMarcador(t){this.removerMarcador();const i=g.parseCoordenada(this.getAttribute("lat"),this.getAttribute("lng"));if(!i)return;const o=m();if(!o)return;const a=this.getAttribute("titulo"),l=o.marker([i.lat,i.lon],{icon:this.createIcon(o),keyboard:!0,title:a||void 0});a&&l.bindPopup(this.createPopupContent(a)),l.addTo(t),this.marker=l,this.aplicarNomeAcessivel()}}n.definirCustomElement("ui-mapa-marcador",C);class S extends n.SafeHTMLElement{constructor(){super(...arguments);s(this,"polyline",null);s(this,"vinculo",new M(this,{rotulo:"ui-mapa-linha",aoMapa:t=>this.criarLinha(t),aoPerderMapa:()=>this.removerLinha()}))}static get observedAttributes(){return["pontos","cor","espessura"]}connectedCallback(){this.vinculo.conectar()}disconnectedCallback(){this.vinculo.desconectar(),this.removerLinha()}attributeChangedCallback(t,i,o){i===o||!this.polyline||(t==="pontos"?this.polyline.setLatLngs(A(this.getAttribute("pontos"))):this.polyline.setStyle(this.estilo()))}estilo(){return{color:y(this.getAttribute("cor"),w),weight:k(this.getAttribute("espessura"),O)}}removerLinha(){var t;(t=this.polyline)==null||t.remove(),this.polyline=null}criarLinha(t){this.removerLinha();const i=m();i&&(this.polyline=i.polyline(A(this.getAttribute("pontos")),this.estilo()).addTo(t))}}n.definirCustomElement("ui-mapa-linha",S);exports.UIMapa=T;exports.UIMapaLinha=S;exports.UIMapaMarcador=C;
package/dist/mapa.js CHANGED
@@ -2,15 +2,14 @@ var C = Object.defineProperty;
2
2
  var x = (r, e, t) => e in r ? C(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var s = (r, e, t) => x(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  /* empty css */
5
- import { l as z, p as v } from "./leaflet-DOq10gfg.js";
6
- import { d as m, S as d } from "./ssr-safe-5cWfJP-s.js";
7
- import { c as S, o as I } from "./leaflet-loader-Cjcdgj5R.js";
5
+ import { c as z, o as S, S as m, l as I, d } from "./kit-base-_THn4w3u.js";
6
+ import { p as v } from "./utils-DrHoxxmf.js";
8
7
  const _ = ":host{display:block;width:100%;height:400px;position:relative;border-radius:var(--ui-raio-lg, 10px);overflow:hidden;box-shadow:var(--shadow-sm, 0 1px 3px rgba(0,0,0,.1))}.ui-mapa-container{width:100%;height:100%;z-index:1}.leaflet-top,.leaflet-bottom{z-index:1000}.ui-mapa-popup{font-family:inherit;font-size:13px;font-weight:500;color:#111827;padding:2px 4px}.ui-mapa-svg-pin,.ui-mapa-div-marker{background:transparent!important;border:none!important;cursor:pointer;transition:transform .15s ease,filter .15s ease}.ui-mapa-svg-pin:hover,.ui-mapa-div-marker:hover{transform:scale(1.15);filter:brightness(1.2)}";
9
8
  function h() {
10
- return I() ?? null;
9
+ return S() ?? null;
11
10
  }
12
11
  async function E() {
13
- return await S() ?? null;
12
+ return await z() ?? null;
14
13
  }
15
14
  function w(r) {
16
15
  return {
@@ -86,7 +85,7 @@ const U = "Mapa", V = `
86
85
  <span style="max-width: 320px; line-height: 1.4;">Para utilizar o componente <code>&lt;ui-mapa&gt;</code>, instale a biblioteca <code>leaflet</code> ou inclua seu script no HTML: <code>&lt;script src=".../leaflet.js"&gt;&lt;/script&gt;</code>.</span>
87
86
  </div>
88
87
  `;
89
- class H extends d {
88
+ class H extends m {
90
89
  constructor() {
91
90
  super();
92
91
  s(this, "mapContainer");
@@ -98,7 +97,7 @@ class H extends d {
98
97
  const t = this.attachShadow({ mode: "open" });
99
98
  t.innerHTML = `
100
99
  <style>
101
- ${z}
100
+ ${I}
102
101
  ${_}
103
102
  </style>
104
103
  <div class="ui-mapa-container" id="map-container" part="base" role="region"></div>
@@ -135,7 +134,7 @@ class H extends d {
135
134
  (t = this.mapContainer) == null || t.setAttribute("aria-label", this.getAttribute("aria-label") || U);
136
135
  }
137
136
  async initMap() {
138
- var b;
137
+ var f;
139
138
  if (this.mapInstance) return;
140
139
  const t = await E();
141
140
  if (!this.isConnected || this.mapInstance) return;
@@ -145,13 +144,13 @@ class H extends d {
145
144
  }
146
145
  const i = w(t), o = A(this.getAttribute("lat"), this.getAttribute("lng"), this.getAttribute("zoom")), a = t.map(this.mapContainer).setView([o.lat, o.lng], o.zoom);
147
146
  this.mapInstance = a;
148
- const n = G(this.getAttribute("camadas"), Object.keys(i)), f = i[n[0]].layer();
149
- if (f.addTo(a), n.length > 1) {
150
- const c = { [i[n[0]].nome]: f };
147
+ const n = G(this.getAttribute("camadas"), Object.keys(i)), b = i[n[0]].layer();
148
+ if (b.addTo(a), n.length > 1) {
149
+ const c = { [i[n[0]].nome]: b };
151
150
  for (const g of n.slice(1)) c[i[g].nome] = i[g].layer();
152
151
  t.control.layers(c, void 0, { position: "topright" }).addTo(a);
153
152
  }
154
- (b = t.Icon) != null && b.Default && (t.Icon.Default.imagePath = "https://unpkg.com/leaflet@1.9.4/dist/images/"), typeof ResizeObserver < "u" && (this._resizeObserver = new ResizeObserver(() => {
153
+ (f = t.Icon) != null && f.Default && (t.Icon.Default.imagePath = "https://unpkg.com/leaflet@1.9.4/dist/images/"), typeof ResizeObserver < "u" && (this._resizeObserver = new ResizeObserver(() => {
155
154
  this._resizeTimer && clearTimeout(this._resizeTimer), this._resizeTimer = setTimeout(() => {
156
155
  var c;
157
156
  return (c = this.mapInstance) == null ? void 0 : c.invalidateSize();
@@ -169,7 +168,7 @@ class H extends d {
169
168
  return this.mapInstance;
170
169
  }
171
170
  }
172
- m("ui-mapa", H);
171
+ d("ui-mapa", H);
173
172
  const u = "http://www.w3.org/2000/svg";
174
173
  function $(r) {
175
174
  const e = document.createElement("div");
@@ -227,7 +226,7 @@ class M {
227
226
  this.tentativas = 0, this.opcoes.aoMapa(t);
228
227
  }
229
228
  }
230
- class X extends d {
229
+ class X extends m {
231
230
  constructor() {
232
231
  super(...arguments);
233
232
  s(this, "marker", null);
@@ -289,8 +288,8 @@ class X extends d {
289
288
  a && n.bindPopup(this.createPopupContent(a)), n.addTo(t), this.marker = n, this.aplicarNomeAcessivel();
290
289
  }
291
290
  }
292
- m("ui-mapa-marcador", X);
293
- class W extends d {
291
+ d("ui-mapa-marcador", X);
292
+ class W extends m {
294
293
  constructor() {
295
294
  super(...arguments);
296
295
  s(this, "polyline", null);
@@ -328,7 +327,7 @@ class W extends d {
328
327
  i && (this.polyline = i.polyline(y(this.getAttribute("pontos")), this.estilo()).addTo(t));
329
328
  }
330
329
  }
331
- m("ui-mapa-linha", W);
330
+ d("ui-mapa-linha", W);
332
331
  export {
333
332
  H as UIMapa,
334
333
  W as UIMapaLinha,
package/dist/modal.cjs CHANGED
@@ -1 +1,18 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const o=require("./ui-modal-lARKzEVZ.cjs");require("./ui-botao-Dz8YvmiA.cjs");function m(r){return typeof document>"u"?Promise.resolve(!1):new Promise(t=>{const e=document.createElement("ui-modal");e.setAttribute("titulo",r.titulo);const n=document.createElement("p");n.style.margin="0",n.textContent=r.mensagem,e.appendChild(n);const u=(l,f,v)=>{const a=document.createElement("ui-botao");return a.setAttribute("slot","rodape"),a.setAttribute("variante",v),a.dataset.confirmar=l,a.textContent=f,a},c=u("cancelar",r.rotuloCancelar||"Cancelar","secundario"),d=u("confirmar",r.rotuloConfirmar,r.destrutivo?"destrutivo":"primario");e.append(c,d);let s=!1;const i=l=>{s||(s=!0,t(l),e.aberto=!1,setTimeout(()=>e.remove(),0))};d.addEventListener("click",()=>i(!0)),c.addEventListener("click",()=>i(!1)),e.addEventListener("ui-fechar",()=>i(!1)),document.body.appendChild(e),e.abrir()})}async function C(r,t={}){return r.avaliar()?m({titulo:t.titulo??"Descartar alterações?",mensagem:t.mensagem??"Há alterações que ainda não foram salvas. Se continuar, elas serão perdidas.",rotuloConfirmar:t.rotuloConfirmar??"Descartar alterações",rotuloCancelar:t.rotuloCancelar??"Continuar editando",destrutivo:!0}):!0}exports.UIDialog=o.UIDialog;exports.UIModal=o.UIModal;exports.aplicarInertForaDoModal=o.aplicarInertForaDoModal;exports.removerInertForaDoModal=o.removerInertForaDoModal;exports.confirmarAcao=m;exports.confirmarDescarteSeSujo=C;
1
+ "use strict";var M=Object.defineProperty;var T=(e,o,t)=>o in e?M(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t;var r=(e,o,t)=>T(e,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const h=require("./kit-base-CGqj9aiD.cjs"),z=':host{display:block;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-modal__backdrop{display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#000000b3;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:calc(var(--ui-z-modal, 1000) - 1);opacity:0;pointer-events:none;transition:opacity .25s ease}:host([aberto]) .ui-modal__backdrop,:host([open]) .ui-modal__backdrop{display:block;opacity:1;pointer-events:auto}.ui-modal__dialog{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%) scale(.95);max-width:560px;width:90%;max-height:85vh;background:var(--ui-degrade-interno, var(--ui-modal-fundo, var(--ui-fundo-card, var(--ui-cor-fundo-card, #18181c))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:var(--ui-raio-borda, 12px);box-shadow:var(--ui-sombra-lg, 0 12px 36px rgba(0, 0, 0, .6));z-index:var(--ui-z-modal, 1000);display:flex;flex-direction:column;opacity:0;visibility:hidden;pointer-events:none;overflow:hidden;transition:transform .25s cubic-bezier(.16,1,.3,1),opacity .2s ease,visibility 0s linear .2s;box-sizing:border-box;color:var(--ui-cor-texto, #e1e1e6)}:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{opacity:1;visibility:visible;pointer-events:auto;transform:translate(-50%,-50%) scale(1);transition:transform .25s cubic-bezier(.16,1,.3,1),opacity .2s ease,visibility 0s}@starting-style{:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{opacity:0;transform:translate(-50%,-50%) scale(.94)}:host([aberto]) .ui-modal__backdrop,:host([open]) .ui-modal__backdrop{opacity:0}}.ui-modal__handle{display:none;width:36px;height:4px;border-radius:2px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent);margin:6px auto 12px;flex-shrink:0}.ui-modal__header{padding:16px 20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);gap:12px}.ui-modal__titulo{font-size:18px;font-weight:600;margin:0;color:var(--ui-cor-texto, #e1e1e6)}.ui-modal__close{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);font-size:16px;cursor:pointer;padding:4px 8px;border-radius:var(--ui-raio-sm, 4px);line-height:1;display:inline-flex;align-items:center;justify-content:center;transition:color .15s ease,background-color .15s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent}:host([bloquear-fechamento]) .ui-modal__close{display:none}.ui-modal__close svg,.ui-modal__close ::slotted(svg){shape-rendering:geometricPrecision}.ui-modal__close:hover{color:#fff;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent)}.ui-modal__body{padding:20px;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;flex:1;box-sizing:border-box}.ui-modal__footer{padding:14px 20px;display:flex;align-items:center;justify-content:flex-end;gap:12px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);background:var(--ui-modal-rodape-fundo, var(--ui-cor-fundo-recuado, rgba(0, 0, 0, .15)))}@media (max-width: 640px){.ui-modal__dialog{top:auto!important;bottom:0!important;left:0!important;transform:translateY(100%)!important;width:100vw!important;max-width:100vw!important;border-radius:var(--ui-raio-xl, 16px) var(--ui-raio-xl, 16px) 0 0!important;max-height:85vh!important;max-height:85dvh!important;border-bottom:none!important;box-shadow:0 -8px 32px #000000b3!important}.ui-modal__close{min-width:44px;min-height:44px;font-size:18px}.ui-modal__footer{padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{transform:translateY(0)!important}.ui-modal__handle{display:block!important}}:host([bottom-sheet]) .ui-modal__dialog{top:auto!important;bottom:0!important;left:0!important;transform:translateY(100%)!important;width:100vw!important;max-width:100vw!important;border-radius:var(--ui-raio-xl, 16px) var(--ui-raio-xl, 16px) 0 0!important;max-height:85vh!important;max-height:85dvh!important;border-bottom:none!important;box-shadow:0 -8px 32px #000000b3!important}:host([bottom-sheet]) .ui-modal__close{min-width:44px;min-height:44px;font-size:18px}:host([bottom-sheet]) .ui-modal__footer{padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}:host([bottom-sheet][aberto]) .ui-modal__dialog,:host([bottom-sheet][open]) .ui-modal__dialog{transform:translateY(0)!important}:host([bottom-sheet]) .ui-modal__handle{display:block!important}:host(.squarecircle) .ui-modal__painel,:host(.squarecircles) .ui-modal__painel,:host(.ui-squarecircle) .ui-modal__painel,:host(.ui-squarecircles) .ui-modal__painel,:host([formato="squarecircle"]) .ui-modal__painel,:host([formato="squarecircles"]) .ui-modal__painel,:host([formato="squircle"]) .ui-modal__painel{border-radius:var(--ui-raio-xl, 16px)}: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-card: var(--ui-gradiente-card)}';function R(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"}function w(e){const o=new Set;if(typeof document>"u")return o;const t=a=>{a===e||a.contains(e)||R(a)||a.inert||a.hasAttribute("inert")||(a.setAttribute("inert",""),a.inert=!0,o.add(a))};let i=e;for(;i&&i!==document.body&&i!==document.documentElement;){const a=i.parentElement;if(!a)break;Array.from(a.children).forEach(l=>t(l)),i=a}return document.body&&Array.from(document.body.children).forEach(a=>t(a)),o}function A(e){e.forEach(o=>{o.removeAttribute("inert"),o.inert=!1}),e.clear()}const n=[];let y=new Set,k="";function S(){A(y);const e=n[n.length-1];y=e?w(e):new Set}function F(e){const o=n.indexOf(e);o>=0&&n.splice(o,1),n.length===0&&(k=document.body.style.overflow,document.body.style.overflow="hidden"),n.push(e),S()}function E(e){const o=n.indexOf(e);o<0||(n.splice(o,1),n.length===0&&(document.body.style.overflow=k),S())}function L(e){return n[n.length-1]===e}const _='a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), ui-campo-texto, ui-input, ui-botao, ui-botao-primario, ui-checkbox, ui-switch, ui-lista-flutuante, ui-radio, ui-select, ui-segmented';function v(){var o;let e=document.activeElement;for(;(o=e==null?void 0:e.shadowRoot)!=null&&o.activeElement;)e=e.shadowRoot.activeElement;return e}function b(e,o){let t=o;for(;t;){if(t===e)return!0;const i=t.getRootNode();t=t.parentNode??(i instanceof ShadowRoot?i.host:null)}return!1}function C(e){return!e.hasAttribute("disabled")&&e.getAttribute("aria-hidden")!=="true"}function q(e){const o=[];return e.querySelectorAll("slot").forEach(t=>{t.assignedElements({flatten:!0}).forEach(i=>{i instanceof HTMLElement&&(i.matches(_)&&o.push(i),o.push(...Array.from(i.querySelectorAll(_))))})}),o.filter(C)}function P(e){return[...Array.from(e.querySelectorAll(_)).filter(t=>window.getComputedStyle(t).display!=="none"&&C(t)),...q(e)]}function N(e,o){const t=q(e),i=t.filter(a=>a.hasAttribute("autofocus"));for(const a of[...i,...t])if(a.focus(),b(a,v()))return;o.focus()}function O(e,o,t){const i=P(t);if(i.length===0){e.preventDefault();return}const a=i[0],l=i[i.length-1],s=v(),d=!b(o,s),u=b(a,s),c=b(l,s);e.shiftKey?(u||d)&&(e.preventDefault(),l.focus()):(c||d)&&(e.preventDefault(),a.focus())}class x extends h.SafeHTMLElement{constructor(){super();r(this,"backdropElement");r(this,"dialogElement");r(this,"tituloElement");r(this,"closeElement");r(this,"ouvintes",new h.ListenerBag);r(this,"_elementoGatilho",null);r(this,"_tituloId");r(this,"_estaAberto",!1);r(this,"handleSlotChange",()=>{this.syncState()});r(this,"handleBackdropClick",t=>{t.stopPropagation(),this.fechar()});r(this,"handleCloseClick",t=>{t.stopPropagation(),this.fechar()});r(this,"handleKeyDown",t=>{this._estaAberto&&L(this)&&(t.key==="Escape"?(this.fechar(),t.stopImmediatePropagation()):t.key==="Tab"&&O(t,this,this.shadowRoot))});this._tituloId=`ui-modal-title-${Math.random().toString(36).substring(2,9)}`;const t=this.attachShadow({mode:"open"});t.innerHTML=`
2
+ <style>${z}</style>
3
+ <div class="ui-modal__backdrop" part="fundo"></div>
4
+ <div class="ui-modal__dialog" part="painel" role="dialog" aria-modal="true" aria-labelledby="${this._tituloId}" tabindex="-1">
5
+ <div class="ui-modal__handle"></div>
6
+ <div class="ui-modal__header" part="cabecalho">
7
+ <h3 class="ui-modal__titulo" part="titulo" id="${this._tituloId}"></h3>
8
+ <button class="ui-modal__close" part="fechar" type="button" aria-label="Fechar modal" title="Fechar">✕</button>
9
+ </div>
10
+ <div class="ui-modal__body" part="corpo">
11
+ <slot></slot>
12
+ </div>
13
+ <div class="ui-modal__footer" part="rodape">
14
+ <slot name="rodape"></slot>
15
+ <slot name="footer"></slot>
16
+ </div>
17
+ </div>
18
+ `,this.backdropElement=t.querySelector(".ui-modal__backdrop"),this.dialogElement=t.querySelector(".ui-modal__dialog"),this.tituloElement=t.querySelector(".ui-modal__titulo"),this.closeElement=t.querySelector(".ui-modal__close")}static get observedAttributes(){return["aberto","open","titulo","title","aria-label","aria-labelledby","rotulo","bottom-sheet","bloquear-fechamento",...h.ATRIBUTOS_DEGRADE]}connectedCallback(){this.ouvintes.cleanup(),this.ouvintes.add(this.backdropElement,"click",this.handleBackdropClick),this.ouvintes.add(this.closeElement,"click",this.handleCloseClick),this.ouvintes.add(window,"keydown",this.handleKeyDown),this.shadowRoot.querySelectorAll("slot").forEach(t=>{this.ouvintes.add(t,"slotchange",this.handleSlotChange)}),this.syncState()}disconnectedCallback(){this.ouvintes.cleanup(),this._estaAberto&&(this._estaAberto=!1,E(this))}attributeChangedCallback(t,i,a){this.syncState()}get aberto(){return this.hasAttribute("aberto")||this.hasAttribute("open")}set aberto(t){t?this.setAttribute("aberto",""):(this.removeAttribute("aberto"),this.removeAttribute("open"))}abrir(){this.aberto=!0}fechar(){this.hasAttribute("bloquear-fechamento")||(this.aberto=!1)}aoAbrir(){this._estaAberto=!0;const t=v();this._elementoGatilho=t&&t!==document.body&&!this.contains(t)?t:null,F(this),this.dispatchEvent(new CustomEvent("ui-abrir",{bubbles:!0,composed:!0})),setTimeout(()=>{this._estaAberto&&N(this.shadowRoot,this.dialogElement)},0)}aoFechar(){this._estaAberto=!1,E(this),this.dispatchEvent(new CustomEvent("ui-fechar",{bubbles:!0,composed:!0}));const t=this._elementoGatilho;this._elementoGatilho=null;const i=document.activeElement,a=!i||i===document.body||i===this||this.contains(i);t!=null&&t.isConnected&&a&&t.focus()}syncState(){var d,u;const t=this.aberto,i=this.getAttribute("titulo")||this.getAttribute("title")||"",a=(d=this.shadowRoot)==null?void 0:d.querySelector(".ui-modal__footer");this.dialogElement.setAttribute("aria-hidden",String(!t)),h.aplicarDegradeNoElemento(this,this.dialogElement);const l=this.getAttribute("aria-label")||this.getAttribute("rotulo"),s=this.getAttribute("aria-labelledby");if(l?(this.dialogElement.setAttribute("aria-label",l),this.dialogElement.removeAttribute("aria-labelledby")):s?(this.dialogElement.setAttribute("aria-labelledby",s),this.dialogElement.removeAttribute("aria-label")):i?(this.tituloElement.textContent=i,this.tituloElement.style.display="block",this.dialogElement.setAttribute("aria-labelledby",this._tituloId),this.dialogElement.removeAttribute("aria-label")):(this.tituloElement.style.display="none",this.dialogElement.removeAttribute("aria-labelledby"),this.dialogElement.setAttribute("aria-label","Diálogo modal")),a){const p=Array.from(((u=this.shadowRoot)==null?void 0:u.querySelectorAll('slot[name="rodape"], slot[name="footer"]'))||[]).some(f=>f.assignedNodes({flatten:!0}).some(g=>g.nodeType===Node.ELEMENT_NODE||g.textContent&&g.textContent.trim()!==""))||this.querySelector('[slot="rodape"], [slot="footer"]')!==null;a.style.display=p?"flex":"none"}this.isConnected&&t!==this._estaAberto&&(t?this.aoAbrir():this.aoFechar())}}class D extends x{}h.definirCustomElement("ui-modal",x);h.definirCustomElement("ui-dialog",D);function I(e){return typeof document>"u"?Promise.resolve(!1):new Promise(o=>{const t=document.createElement("ui-modal");t.setAttribute("titulo",e.titulo);const i=document.createElement("p");i.style.margin="0",i.textContent=e.mensagem,t.appendChild(i);const a=(c,p,f)=>{const m=document.createElement("ui-botao");return m.setAttribute("slot","rodape"),m.setAttribute("variante",f),m.dataset.confirmar=c,m.textContent=p,m},l=a("cancelar",e.rotuloCancelar||"Cancelar","secundario"),s=a("confirmar",e.rotuloConfirmar,e.destrutivo?"destrutivo":"primario");t.append(l,s);let d=!1;const u=c=>{d||(d=!0,o(c),t.aberto=!1,setTimeout(()=>t.remove(),0))};s.addEventListener("click",()=>u(!0)),l.addEventListener("click",()=>u(!1)),t.addEventListener("ui-fechar",()=>u(!1)),document.body.appendChild(t),t.abrir()})}async function j(e,o={}){return e.avaliar()?I({titulo:o.titulo??"Descartar alterações?",mensagem:o.mensagem??"Há alterações que ainda não foram salvas. Se continuar, elas serão perdidas.",rotuloConfirmar:o.rotuloConfirmar??"Descartar alterações",rotuloCancelar:o.rotuloCancelar??"Continuar editando",destrutivo:!0}):!0}exports.UIDialog=D;exports.UIModal=x;exports.aplicarInertForaDoModal=w;exports.confirmarAcao=I;exports.confirmarDescarteSeSujo=j;exports.removerInertForaDoModal=A;
package/dist/modal.js CHANGED
@@ -1,38 +1,244 @@
1
+ var C = Object.defineProperty;
2
+ var q = (e, o, t) => o in e ? C(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
3
+ var r = (e, o, t) => q(e, typeof o != "symbol" ? o + "" : o, t);
1
4
  /* empty css */
2
- import { U as E, a as g, b as x, r as y } from "./ui-modal-BrXzVZ65.js";
3
- import "./ui-botao-zLkcMMyP.js";
4
- function f(t) {
5
- return typeof document > "u" ? Promise.resolve(!1) : new Promise((r) => {
6
- const e = document.createElement("ui-modal");
7
- e.setAttribute("titulo", t.titulo);
8
- const o = document.createElement("p");
9
- o.style.margin = "0", o.textContent = t.mensagem, e.appendChild(o);
10
- const l = (i, d, m) => {
11
- const a = document.createElement("ui-botao");
12
- return a.setAttribute("slot", "rodape"), a.setAttribute("variante", m), a.dataset.confirmar = i, a.textContent = d, a;
13
- }, u = l("cancelar", t.rotuloCancelar || "Cancelar", "secundario"), s = l("confirmar", t.rotuloConfirmar, t.destrutivo ? "destrutivo" : "primario");
14
- e.append(u, s);
15
- let c = !1;
16
- const n = (i) => {
17
- c || (c = !0, r(i), e.aberto = !1, setTimeout(() => e.remove(), 0));
5
+ import { S as D, A as I, L as T, g as z, d as y } from "./kit-base-_THn4w3u.js";
6
+ const L = ':host{display:block;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-modal__backdrop{display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#000000b3;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:calc(var(--ui-z-modal, 1000) - 1);opacity:0;pointer-events:none;transition:opacity .25s ease}:host([aberto]) .ui-modal__backdrop,:host([open]) .ui-modal__backdrop{display:block;opacity:1;pointer-events:auto}.ui-modal__dialog{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%) scale(.95);max-width:560px;width:90%;max-height:85vh;background:var(--ui-degrade-interno, var(--ui-modal-fundo, var(--ui-fundo-card, var(--ui-cor-fundo-card, #18181c))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:var(--ui-raio-borda, 12px);box-shadow:var(--ui-sombra-lg, 0 12px 36px rgba(0, 0, 0, .6));z-index:var(--ui-z-modal, 1000);display:flex;flex-direction:column;opacity:0;visibility:hidden;pointer-events:none;overflow:hidden;transition:transform .25s cubic-bezier(.16,1,.3,1),opacity .2s ease,visibility 0s linear .2s;box-sizing:border-box;color:var(--ui-cor-texto, #e1e1e6)}:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{opacity:1;visibility:visible;pointer-events:auto;transform:translate(-50%,-50%) scale(1);transition:transform .25s cubic-bezier(.16,1,.3,1),opacity .2s ease,visibility 0s}@starting-style{:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{opacity:0;transform:translate(-50%,-50%) scale(.94)}:host([aberto]) .ui-modal__backdrop,:host([open]) .ui-modal__backdrop{opacity:0}}.ui-modal__handle{display:none;width:36px;height:4px;border-radius:2px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent);margin:6px auto 12px;flex-shrink:0}.ui-modal__header{padding:16px 20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);gap:12px}.ui-modal__titulo{font-size:18px;font-weight:600;margin:0;color:var(--ui-cor-texto, #e1e1e6)}.ui-modal__close{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);font-size:16px;cursor:pointer;padding:4px 8px;border-radius:var(--ui-raio-sm, 4px);line-height:1;display:inline-flex;align-items:center;justify-content:center;transition:color .15s ease,background-color .15s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent}:host([bloquear-fechamento]) .ui-modal__close{display:none}.ui-modal__close svg,.ui-modal__close ::slotted(svg){shape-rendering:geometricPrecision}.ui-modal__close:hover{color:#fff;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent)}.ui-modal__body{padding:20px;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;flex:1;box-sizing:border-box}.ui-modal__footer{padding:14px 20px;display:flex;align-items:center;justify-content:flex-end;gap:12px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);background:var(--ui-modal-rodape-fundo, var(--ui-cor-fundo-recuado, rgba(0, 0, 0, .15)))}@media (max-width: 640px){.ui-modal__dialog{top:auto!important;bottom:0!important;left:0!important;transform:translateY(100%)!important;width:100vw!important;max-width:100vw!important;border-radius:var(--ui-raio-xl, 16px) var(--ui-raio-xl, 16px) 0 0!important;max-height:85vh!important;max-height:85dvh!important;border-bottom:none!important;box-shadow:0 -8px 32px #000000b3!important}.ui-modal__close{min-width:44px;min-height:44px;font-size:18px}.ui-modal__footer{padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{transform:translateY(0)!important}.ui-modal__handle{display:block!important}}:host([bottom-sheet]) .ui-modal__dialog{top:auto!important;bottom:0!important;left:0!important;transform:translateY(100%)!important;width:100vw!important;max-width:100vw!important;border-radius:var(--ui-raio-xl, 16px) var(--ui-raio-xl, 16px) 0 0!important;max-height:85vh!important;max-height:85dvh!important;border-bottom:none!important;box-shadow:0 -8px 32px #000000b3!important}:host([bottom-sheet]) .ui-modal__close{min-width:44px;min-height:44px;font-size:18px}:host([bottom-sheet]) .ui-modal__footer{padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}:host([bottom-sheet][aberto]) .ui-modal__dialog,:host([bottom-sheet][open]) .ui-modal__dialog{transform:translateY(0)!important}:host([bottom-sheet]) .ui-modal__handle{display:block!important}:host(.squarecircle) .ui-modal__painel,:host(.squarecircles) .ui-modal__painel,:host(.ui-squarecircle) .ui-modal__painel,:host(.ui-squarecircles) .ui-modal__painel,:host([formato="squarecircle"]) .ui-modal__painel,:host([formato="squarecircles"]) .ui-modal__painel,:host([formato="squircle"]) .ui-modal__painel{border-radius:var(--ui-raio-xl, 16px)}: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-card: var(--ui-gradiente-card)}';
7
+ function M(e) {
8
+ return e.tagName === "SCRIPT" || e.tagName === "STYLE";
9
+ }
10
+ function R(e) {
11
+ const o = /* @__PURE__ */ new Set();
12
+ if (typeof document > "u") return o;
13
+ const t = (a) => {
14
+ a === e || a.contains(e) || M(a) || a.inert || a.hasAttribute("inert") || (a.setAttribute("inert", ""), a.inert = !0, o.add(a));
15
+ };
16
+ let i = e;
17
+ for (; i && i !== document.body && i !== document.documentElement; ) {
18
+ const a = i.parentElement;
19
+ if (!a) break;
20
+ Array.from(a.children).forEach((l) => t(l)), i = a;
21
+ }
22
+ return document.body && Array.from(document.body.children).forEach((a) => t(a)), o;
23
+ }
24
+ function F(e) {
25
+ e.forEach((o) => {
26
+ o.removeAttribute("inert"), o.inert = !1;
27
+ }), e.clear();
28
+ }
29
+ const n = [];
30
+ let v = /* @__PURE__ */ new Set(), E = "";
31
+ function w() {
32
+ F(v);
33
+ const e = n[n.length - 1];
34
+ v = e ? R(e) : /* @__PURE__ */ new Set();
35
+ }
36
+ function P(e) {
37
+ const o = n.indexOf(e);
38
+ o >= 0 && n.splice(o, 1), n.length === 0 && (E = document.body.style.overflow, document.body.style.overflow = "hidden"), n.push(e), w();
39
+ }
40
+ function x(e) {
41
+ const o = n.indexOf(e);
42
+ o < 0 || (n.splice(o, 1), n.length === 0 && (document.body.style.overflow = E), w());
43
+ }
44
+ function N(e) {
45
+ return n[n.length - 1] === e;
46
+ }
47
+ const g = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), ui-campo-texto, ui-input, ui-botao, ui-botao-primario, ui-checkbox, ui-switch, ui-lista-flutuante, ui-radio, ui-select, ui-segmented';
48
+ function _() {
49
+ var o;
50
+ let e = document.activeElement;
51
+ for (; (o = e == null ? void 0 : e.shadowRoot) != null && o.activeElement; )
52
+ e = e.shadowRoot.activeElement;
53
+ return e;
54
+ }
55
+ function h(e, o) {
56
+ let t = o;
57
+ for (; t; ) {
58
+ if (t === e) return !0;
59
+ const i = t.getRootNode();
60
+ t = t.parentNode ?? (i instanceof ShadowRoot ? i.host : null);
61
+ }
62
+ return !1;
63
+ }
64
+ function A(e) {
65
+ return !e.hasAttribute("disabled") && e.getAttribute("aria-hidden") !== "true";
66
+ }
67
+ function k(e) {
68
+ const o = [];
69
+ return e.querySelectorAll("slot").forEach((t) => {
70
+ t.assignedElements({ flatten: !0 }).forEach((i) => {
71
+ i instanceof HTMLElement && (i.matches(g) && o.push(i), o.push(...Array.from(i.querySelectorAll(g))));
72
+ });
73
+ }), o.filter(A);
74
+ }
75
+ function O(e) {
76
+ return [...Array.from(e.querySelectorAll(g)).filter((t) => window.getComputedStyle(t).display !== "none" && A(t)), ...k(e)];
77
+ }
78
+ function B(e, o) {
79
+ const t = k(e), i = t.filter((a) => a.hasAttribute("autofocus"));
80
+ for (const a of [...i, ...t])
81
+ if (a.focus(), h(a, _())) return;
82
+ o.focus();
83
+ }
84
+ function G(e, o, t) {
85
+ const i = O(t);
86
+ if (i.length === 0) {
87
+ e.preventDefault();
88
+ return;
89
+ }
90
+ const a = i[0], l = i[i.length - 1], s = _(), d = !h(o, s), u = h(a, s), c = h(l, s);
91
+ e.shiftKey ? (u || d) && (e.preventDefault(), l.focus()) : (c || d) && (e.preventDefault(), a.focus());
92
+ }
93
+ class S extends D {
94
+ constructor() {
95
+ super();
96
+ r(this, "backdropElement");
97
+ r(this, "dialogElement");
98
+ r(this, "tituloElement");
99
+ r(this, "closeElement");
100
+ r(this, "ouvintes", new T());
101
+ r(this, "_elementoGatilho", null);
102
+ r(this, "_tituloId");
103
+ /** Estado já aplicado (pilha, inert, scroll, eventos); difere de `aberto` durante uma transição. */
104
+ r(this, "_estaAberto", !1);
105
+ r(this, "handleSlotChange", () => {
106
+ this.syncState();
107
+ });
108
+ r(this, "handleBackdropClick", (t) => {
109
+ t.stopPropagation(), this.fechar();
110
+ });
111
+ r(this, "handleCloseClick", (t) => {
112
+ t.stopPropagation(), this.fechar();
113
+ });
114
+ r(this, "handleKeyDown", (t) => {
115
+ this._estaAberto && N(this) && (t.key === "Escape" ? (this.fechar(), t.stopImmediatePropagation()) : t.key === "Tab" && G(t, this, this.shadowRoot));
116
+ });
117
+ this._tituloId = `ui-modal-title-${Math.random().toString(36).substring(2, 9)}`;
118
+ const t = this.attachShadow({ mode: "open" });
119
+ t.innerHTML = `
120
+ <style>${L}</style>
121
+ <div class="ui-modal__backdrop" part="fundo"></div>
122
+ <div class="ui-modal__dialog" part="painel" role="dialog" aria-modal="true" aria-labelledby="${this._tituloId}" tabindex="-1">
123
+ <div class="ui-modal__handle"></div>
124
+ <div class="ui-modal__header" part="cabecalho">
125
+ <h3 class="ui-modal__titulo" part="titulo" id="${this._tituloId}"></h3>
126
+ <button class="ui-modal__close" part="fechar" type="button" aria-label="Fechar modal" title="Fechar">✕</button>
127
+ </div>
128
+ <div class="ui-modal__body" part="corpo">
129
+ <slot></slot>
130
+ </div>
131
+ <div class="ui-modal__footer" part="rodape">
132
+ <slot name="rodape"></slot>
133
+ <slot name="footer"></slot>
134
+ </div>
135
+ </div>
136
+ `, this.backdropElement = t.querySelector(".ui-modal__backdrop"), this.dialogElement = t.querySelector(".ui-modal__dialog"), this.tituloElement = t.querySelector(".ui-modal__titulo"), this.closeElement = t.querySelector(".ui-modal__close");
137
+ }
138
+ static get observedAttributes() {
139
+ return [
140
+ "aberto",
141
+ "open",
142
+ "titulo",
143
+ "title",
144
+ "aria-label",
145
+ "aria-labelledby",
146
+ "rotulo",
147
+ "bottom-sheet",
148
+ "bloquear-fechamento",
149
+ ...I
150
+ ];
151
+ }
152
+ connectedCallback() {
153
+ this.ouvintes.cleanup(), this.ouvintes.add(this.backdropElement, "click", this.handleBackdropClick), this.ouvintes.add(this.closeElement, "click", this.handleCloseClick), this.ouvintes.add(window, "keydown", this.handleKeyDown), this.shadowRoot.querySelectorAll("slot").forEach((t) => {
154
+ this.ouvintes.add(t, "slotchange", this.handleSlotChange);
155
+ }), this.syncState();
156
+ }
157
+ disconnectedCallback() {
158
+ this.ouvintes.cleanup(), this._estaAberto && (this._estaAberto = !1, x(this));
159
+ }
160
+ attributeChangedCallback(t, i, a) {
161
+ this.syncState();
162
+ }
163
+ get aberto() {
164
+ return this.hasAttribute("aberto") || this.hasAttribute("open");
165
+ }
166
+ set aberto(t) {
167
+ t ? this.setAttribute("aberto", "") : (this.removeAttribute("aberto"), this.removeAttribute("open"));
168
+ }
169
+ abrir() {
170
+ this.aberto = !0;
171
+ }
172
+ /** Fecha o modal, exceto com `bloquear-fechamento` (remova o atributo ou use `aberto = false` para forçar). */
173
+ fechar() {
174
+ this.hasAttribute("bloquear-fechamento") || (this.aberto = !1);
175
+ }
176
+ /**
177
+ * Abrir/fechar pelo método, pela propriedade ou pelo atributo (`aberto`/`open`, comum em
178
+ * React/Vue) passa sempre por aqui: mesmos eventos, mesmo foco e mesma camada de inert.
179
+ */
180
+ aoAbrir() {
181
+ this._estaAberto = !0;
182
+ const t = _();
183
+ this._elementoGatilho = t && t !== document.body && !this.contains(t) ? t : null, P(this), this.dispatchEvent(new CustomEvent("ui-abrir", { bubbles: !0, composed: !0 })), setTimeout(() => {
184
+ this._estaAberto && B(this.shadowRoot, this.dialogElement);
185
+ }, 0);
186
+ }
187
+ aoFechar() {
188
+ this._estaAberto = !1, x(this), this.dispatchEvent(new CustomEvent("ui-fechar", { bubbles: !0, composed: !0 }));
189
+ const t = this._elementoGatilho;
190
+ this._elementoGatilho = null;
191
+ const i = document.activeElement, a = !i || i === document.body || i === this || this.contains(i);
192
+ t != null && t.isConnected && a && t.focus();
193
+ }
194
+ syncState() {
195
+ var d, u;
196
+ const t = this.aberto, i = this.getAttribute("titulo") || this.getAttribute("title") || "", a = (d = this.shadowRoot) == null ? void 0 : d.querySelector(".ui-modal__footer");
197
+ this.dialogElement.setAttribute("aria-hidden", String(!t)), z(this, this.dialogElement);
198
+ const l = this.getAttribute("aria-label") || this.getAttribute("rotulo"), s = this.getAttribute("aria-labelledby");
199
+ if (l ? (this.dialogElement.setAttribute("aria-label", l), this.dialogElement.removeAttribute("aria-labelledby")) : s ? (this.dialogElement.setAttribute("aria-labelledby", s), this.dialogElement.removeAttribute("aria-label")) : i ? (this.tituloElement.textContent = i, this.tituloElement.style.display = "block", this.dialogElement.setAttribute("aria-labelledby", this._tituloId), this.dialogElement.removeAttribute("aria-label")) : (this.tituloElement.style.display = "none", this.dialogElement.removeAttribute("aria-labelledby"), this.dialogElement.setAttribute("aria-label", "Diálogo modal")), a) {
200
+ const p = Array.from(((u = this.shadowRoot) == null ? void 0 : u.querySelectorAll('slot[name="rodape"], slot[name="footer"]')) || []).some((b) => b.assignedNodes({ flatten: !0 }).some((f) => f.nodeType === Node.ELEMENT_NODE || f.textContent && f.textContent.trim() !== "")) || this.querySelector('[slot="rodape"], [slot="footer"]') !== null;
201
+ a.style.display = p ? "flex" : "none";
202
+ }
203
+ this.isConnected && t !== this._estaAberto && (t ? this.aoAbrir() : this.aoFechar());
204
+ }
205
+ }
206
+ class Y extends S {
207
+ }
208
+ y("ui-modal", S);
209
+ y("ui-dialog", Y);
210
+ function j(e) {
211
+ return typeof document > "u" ? Promise.resolve(!1) : new Promise((o) => {
212
+ const t = document.createElement("ui-modal");
213
+ t.setAttribute("titulo", e.titulo);
214
+ const i = document.createElement("p");
215
+ i.style.margin = "0", i.textContent = e.mensagem, t.appendChild(i);
216
+ const a = (c, p, b) => {
217
+ const m = document.createElement("ui-botao");
218
+ return m.setAttribute("slot", "rodape"), m.setAttribute("variante", b), m.dataset.confirmar = c, m.textContent = p, m;
219
+ }, l = a("cancelar", e.rotuloCancelar || "Cancelar", "secundario"), s = a("confirmar", e.rotuloConfirmar, e.destrutivo ? "destrutivo" : "primario");
220
+ t.append(l, s);
221
+ let d = !1;
222
+ const u = (c) => {
223
+ d || (d = !0, o(c), t.aberto = !1, setTimeout(() => t.remove(), 0));
18
224
  };
19
- s.addEventListener("click", () => n(!0)), u.addEventListener("click", () => n(!1)), e.addEventListener("ui-fechar", () => n(!1)), document.body.appendChild(e), e.abrir();
225
+ s.addEventListener("click", () => u(!0)), l.addEventListener("click", () => u(!1)), t.addEventListener("ui-fechar", () => u(!1)), document.body.appendChild(t), t.abrir();
20
226
  });
21
227
  }
22
- async function p(t, r = {}) {
23
- return t.avaliar() ? f({
24
- titulo: r.titulo ?? "Descartar alterações?",
25
- mensagem: r.mensagem ?? "Há alterações que ainda não foram salvas. Se continuar, elas serão perdidas.",
26
- rotuloConfirmar: r.rotuloConfirmar ?? "Descartar alterações",
27
- rotuloCancelar: r.rotuloCancelar ?? "Continuar editando",
228
+ async function K(e, o = {}) {
229
+ return e.avaliar() ? j({
230
+ titulo: o.titulo ?? "Descartar alterações?",
231
+ mensagem: o.mensagem ?? "Há alterações que ainda não foram salvas. Se continuar, elas serão perdidas.",
232
+ rotuloConfirmar: o.rotuloConfirmar ?? "Descartar alterações",
233
+ rotuloCancelar: o.rotuloCancelar ?? "Continuar editando",
28
234
  destrutivo: !0
29
235
  }) : !0;
30
236
  }
31
237
  export {
32
- E as UIDialog,
33
- g as UIModal,
34
- x as aplicarInertForaDoModal,
35
- f as confirmarAcao,
36
- p as confirmarDescarteSeSujo,
37
- y as removerInertForaDoModal
238
+ Y as UIDialog,
239
+ S as UIModal,
240
+ R as aplicarInertForaDoModal,
241
+ j as confirmarAcao,
242
+ K as confirmarDescarteSeSujo,
243
+ F as removerInertForaDoModal
38
244
  };