@wrrdev/fenix-ui 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -2
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +9 -3
- package/dist/components/autocomplete/autocomplete.js.map +1 -1
- package/dist/components/button/button.js +2 -2
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/card/card.d.ts +2 -1
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/card.js +5 -2
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/fileupload/fileupload.d.ts.map +1 -1
- package/dist/components/fileupload/fileupload.js +5 -0
- package/dist/components/fileupload/fileupload.js.map +1 -1
- package/dist/components/input/input.d.ts +3 -0
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +14 -4
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/multiselect/multiselect.d.ts.map +1 -1
- package/dist/components/multiselect/multiselect.js +9 -3
- package/dist/components/multiselect/multiselect.js.map +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +9 -2
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/textarea/textarea.js +10 -3
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/core/jsx.d.ts +211 -29
- package/dist/core/jsx.d.ts.map +1 -1
- package/dist/core/jsx.js.map +1 -1
- package/dist/core/presets.js +1 -1
- package/dist/core/presets.js.map +1 -1
- package/dist/core/react.d.ts +20 -0
- package/dist/core/react.d.ts.map +1 -0
- package/dist/core/react.js +5 -0
- package/dist/core/react.js.map +1 -0
- package/dist/core/vue.d.ts +45 -2
- package/dist/core/vue.d.ts.map +1 -1
- package/dist/core/vue.js.map +1 -1
- package/dist/docs/app.d.ts +6 -0
- package/dist/docs/app.d.ts.map +1 -1
- package/dist/docs/componentes/autocomplete.doc.d.ts.map +1 -1
- package/dist/docs/componentes/card.doc.d.ts.map +1 -1
- package/dist/docs/componentes/input.doc.d.ts.map +1 -1
- package/dist/docs/componentes/multiselect.doc.d.ts.map +1 -1
- package/dist/docs/componentes/select.doc.d.ts.map +1 -1
- package/dist/docs/componentes/textarea.doc.d.ts.map +1 -1
- package/dist/fenix-ui.esm.js +2 -2
- package/dist/fenix-ui.esm.js.map +1 -1
- package/dist/fenix-ui.umd.min.js +172 -128
- package/dist/fenix-ui2.esm.js +2 -4321
- package/dist/fenix-ui2.esm.js.map +1 -1
- package/dist/fenix-ui3.esm.js +4316 -10621
- package/dist/fenix-ui3.esm.js.map +1 -1
- package/dist/fenix-ui4.esm.js +10669 -106
- package/dist/fenix-ui4.esm.js.map +1 -1
- package/dist/fenix-ui5.esm.js +110 -0
- package/dist/fenix-ui5.esm.js.map +1 -0
- package/package.json +6 -5
package/dist/fenix-ui.umd.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(z){typeof define=="function"&&define.amd?define(z):z()})(function(){"use strict";var jt=z=>{throw TypeError(z)};var ta=(z,k,m)=>k.has(z)||jt("Cannot "+m);var Nt=(z,k,m)=>k.has(z)?jt("Cannot add the same private member more than once"):k instanceof WeakSet?k.add(z):k.set(z,m);var Ft=(z,k,m)=>(ta(z,k,"access private method"),m);var I,Pt;const z=new Map;function k(d){return z.set(d.name,d),d}k({name:"fenix",label:"Fenix (padrão)",tokens:{}}),k({name:"seiya",label:"Seiya",tokens:{color:{primary:"#e11d48",secondary:"#fb7185",info:"#f43f5e",danger:"#be123c"},radius:{sm:"6px",md:"10px",lg:"16px"},effect:{"focus-ring":"none"}}}),k({name:"shiryu",label:"Shiryu",tokens:{color:{primary:"#0d9488",secondary:"#2dd4bf",success:"#059669",info:"#14b8a6"},radius:{sm:"4px",md:"8px",lg:"14px"},effect:{"focus-ring":"none"}}}),k({name:"hyoga",label:"Hyoga",tokens:{color:{primary:"#0284c7",secondary:"#38bdf8",info:"#06b6d4",danger:"#e11d48"},surface:{surface:"#f0f9ff","surface-hover":"#e0f2fe"},radius:{sm:"8px",md:"12px",lg:"18px"}}}),k({name:"shun",label:"Shun",tokens:{color:{primary:"#db2777",secondary:"#f472b6",info:"#ec4899",warning:"#c026d3"},radius:{sm:"10px",md:"14px",lg:"20px"}}}),k({name:"ikki",label:"Ikki",tokens:{color:{primary:"#ea580c",secondary:"#fb923c",danger:"#dc2626",warning:"#f59e0b"},radius:{sm:"2px",md:"4px",lg:"6px"}}}),k({name:"aiolia",label:"Aiolia",tokens:{color:{primary:"#b45309",secondary:"#f59e0b",warning:"#eab308",info:"#84cc16"},radius:{sm:"6px",md:"12px",lg:"20px"},effect:{"focus-ring":"none"}}});function m(d,...e){return d.reduce((t,r,a)=>t+r+(a<e.length?String(e[a]):""),"")}const De=class De extends HTMLElement{static get observedAttributes(){return[]}constructor(){super(),this.root=this.attachShadow({mode:"open"})}attributeChangedCallback(e,t,r){this.isConnected&&this.render()}connectedCallback(){this.render()}disconnectedCallback(){}hasAttr(e){return this.hasAttribute(e)}getAttr(e,t=""){var r;return(r=this.getAttribute(e))!=null?r:t}toggleAttr(e,t){t?this.setAttribute(e,""):this.removeAttribute(e)}setTemplate(e){const t=this.constructor.styles;this.root.innerHTML=`<style>${t}</style>${e}`}};De.styles="";let b=De;function x(d,e){var t;return typeof customElements!="undefined"&&!customElements.get(d)&&customElements.define(d,e),(t=customElements.get(d))!=null?t:e}const Vt={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},Rt=/[&<>"'`=/]/g;function
|
|
1
|
+
(function(z){typeof define=="function"&&define.amd?define(z):z()})(function(){"use strict";var jt=z=>{throw TypeError(z)};var ta=(z,k,m)=>k.has(z)||jt("Cannot "+m);var Nt=(z,k,m)=>k.has(z)?jt("Cannot add the same private member more than once"):k instanceof WeakSet?k.add(z):k.set(z,m);var Ft=(z,k,m)=>(ta(z,k,"access private method"),m);var I,Pt;const z=new Map;function k(d){return z.set(d.name,d),d}k({name:"fenix",label:"Fenix (padrão)",tokens:{effect:{"focus-ring":"none"}}}),k({name:"seiya",label:"Seiya",tokens:{color:{primary:"#e11d48",secondary:"#fb7185",info:"#f43f5e",danger:"#be123c"},radius:{sm:"6px",md:"10px",lg:"16px"},effect:{"focus-ring":"none"}}}),k({name:"shiryu",label:"Shiryu",tokens:{color:{primary:"#0d9488",secondary:"#2dd4bf",success:"#059669",info:"#14b8a6"},radius:{sm:"4px",md:"8px",lg:"14px"},effect:{"focus-ring":"none"}}}),k({name:"hyoga",label:"Hyoga",tokens:{color:{primary:"#0284c7",secondary:"#38bdf8",info:"#06b6d4",danger:"#e11d48"},surface:{surface:"#f0f9ff","surface-hover":"#e0f2fe"},radius:{sm:"8px",md:"12px",lg:"18px"}}}),k({name:"shun",label:"Shun",tokens:{color:{primary:"#db2777",secondary:"#f472b6",info:"#ec4899",warning:"#c026d3"},radius:{sm:"10px",md:"14px",lg:"20px"}}}),k({name:"ikki",label:"Ikki",tokens:{color:{primary:"#ea580c",secondary:"#fb923c",danger:"#dc2626",warning:"#f59e0b"},radius:{sm:"2px",md:"4px",lg:"6px"}}}),k({name:"aiolia",label:"Aiolia",tokens:{color:{primary:"#b45309",secondary:"#f59e0b",warning:"#eab308",info:"#84cc16"},radius:{sm:"6px",md:"12px",lg:"20px"},effect:{"focus-ring":"none"}}});function m(d,...e){return d.reduce((t,r,a)=>t+r+(a<e.length?String(e[a]):""),"")}const De=class De extends HTMLElement{static get observedAttributes(){return[]}constructor(){super(),this.root=this.attachShadow({mode:"open"})}attributeChangedCallback(e,t,r){this.isConnected&&this.render()}connectedCallback(){this.render()}disconnectedCallback(){}hasAttr(e){return this.hasAttribute(e)}getAttr(e,t=""){var r;return(r=this.getAttribute(e))!=null?r:t}toggleAttr(e,t){t?this.setAttribute(e,""):this.removeAttribute(e)}setTemplate(e){const t=this.constructor.styles;this.root.innerHTML=`<style>${t}</style>${e}`}};De.styles="";let b=De;function x(d,e){var t;return typeof customElements!="undefined"&&!customElements.get(d)&&customElements.define(d,e),(t=customElements.get(d))!=null?t:e}const Vt={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},Rt=/[&<>"'`=/]/g;function h(d){return d==null?"":String(d).replace(Rt,e=>Vt[e]||e)}const j="Fenix Icons",E=`
|
|
2
2
|
.fx-icon {
|
|
3
3
|
font-family: ${`var(--fx-icon-font, ${j})`};
|
|
4
4
|
font-weight: normal;
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
}
|
|
18
18
|
.fx-icon.fx-icon-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
|
|
19
19
|
.fx-icon.fx-icon-bold { font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 24; }
|
|
20
|
-
`;function q(d){return/^[a-z][a-z0-9_]*$/.test(d.trim())}function C(d){const e=(d!=null?d:"").trim();return e?q(e)?`<i class="fx-icon" aria-hidden="true">${e}</i>`:`<span aria-hidden="true">${
|
|
20
|
+
`;function q(d){return/^[a-z][a-z0-9_]*$/.test(d.trim())}function C(d){const e=(d!=null?d:"").trim();return e?q(e)?`<i class="fx-icon" aria-hidden="true">${e}</i>`:`<span aria-hidden="true">${h(e)}</span>`:""}const Me=class Me extends b{constructor(){super(...arguments),this.spawnRipple=e=>{if(this.hasAttr("disabled")||this.hasAttr("loading"))return;const t=getComputedStyle(this).getPropertyValue("--fx-effect-ripple").trim();if(t==="0"||t==="false")return;const r=this.root.querySelector(".btn");if(!r)return;const a=r.getBoundingClientRect(),o=Math.max(a.width,a.height),i=document.createElement("span");i.className="btn__ripple",i.style.width=i.style.height=`${o}px`,i.style.left=`${e.clientX-a.left-o/2}px`,i.style.top=`${e.clientY-a.top-o/2}px`,r.appendChild(i),i.addEventListener("animationend",()=>i.remove())}}static get observedAttributes(){return["variant","size","disabled","loading","type","full","icon","icon-pos"]}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get loading(){return this.hasAttr("loading")}set loading(e){this.toggleAttr("loading",!!e)}render(){var f;const e=this.hasAttr("loading"),t=this.hasAttr("disabled")||e,r=this.getAttr("type","button"),a=this.getAttr("icon"),o=this.getAttr("icon-pos","left")==="right",s=this.querySelector('[slot="icon"]')?'<slot name="icon"></slot>':a?C(a):"";this.setTemplate(`
|
|
21
21
|
<button class="btn" part="button" type="${r}">
|
|
22
22
|
${o?"":`<span class="btn__icon" part="icon">${s}</span>`}
|
|
23
23
|
<span class="btn__label" part="label"><slot></slot></span>
|
|
24
24
|
${o?`<span class="btn__icon" part="icon">${s}</span>`:""}
|
|
25
25
|
${e?'<span class="btn__spinner" aria-hidden="true"></span>':""}
|
|
26
26
|
</button>
|
|
27
|
-
`);const n=this.root.querySelector(".btn");if(!n)return;const l=s.trim()!=="";for(const _ of this.root.querySelectorAll(".btn__icon"))_.toggleAttribute("hidden",!l);const
|
|
27
|
+
`);const n=this.root.querySelector(".btn");if(!n)return;const l=s.trim()!=="";for(const _ of this.root.querySelectorAll(".btn__icon"))_.toggleAttribute("hidden",!l);const p=[...(f=this.childNodes)!=null?f:[]].some(_=>{var c,g;return _.nodeType===Node.ELEMENT_NODE?((c=_.getAttribute)==null?void 0:c.call(_,"slot"))!=="icon":((g=_.textContent)!=null?g:"").trim()!==""});n.classList.toggle("btn--icon-only",!p&&l),t?(n.setAttribute("disabled",""),n.setAttribute("aria-disabled","true")):(n.removeAttribute("disabled"),n.removeAttribute("aria-disabled")),e?n.setAttribute("aria-busy","true"):n.removeAttribute("aria-busy")}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerdown",this.spawnRipple)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("pointerdown",this.spawnRipple)}};Me.styles=m`
|
|
28
28
|
${E}
|
|
29
29
|
:host {
|
|
30
30
|
display: inline-block;
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
box-shadow var(--fx-motion-duration-normal) var(--fx-motion-easing);
|
|
63
63
|
}
|
|
64
64
|
.btn:focus-visible {
|
|
65
|
-
outline:
|
|
66
|
-
|
|
65
|
+
outline: none;
|
|
66
|
+
box-shadow: var(--fx-effect-focus-ring, none);
|
|
67
67
|
}
|
|
68
68
|
.btn:hover { filter: brightness(0.88); }
|
|
69
69
|
.btn:active { transform: translateY(1px); }
|
|
@@ -183,20 +183,20 @@
|
|
|
183
183
|
@media (prefers-reduced-motion: reduce) {
|
|
184
184
|
.spinner { animation-duration: 2.5s; }
|
|
185
185
|
}
|
|
186
|
-
`;let P=je;function
|
|
186
|
+
`;let P=je;function Ht(){return x("fx-spinner",P)}Ht();const Ne=class Ne extends b{static get observedAttributes(){return["size","disabled","placeholder","searchable","clearable","error","invalid","success","valid"]}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get options(){return[...this.querySelectorAll("option")].map(e=>{var t,r,a,o,i;return{value:(a=(r=e.getAttribute("value"))!=null?r:(t=e.textContent)==null?void 0:t.trim())!=null?a:"",label:(i=(o=e.textContent)==null?void 0:o.trim())!=null?i:""}})}connectedCallback(){super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.observer)==null||e.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}select(e){this.value=e,this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}}))}_navigateOptions(e){var o;e.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const t=Array.from(this.root.querySelectorAll(".opt"));if(!t.length)return;const r=t.indexOf(this.root.activeElement);let a=0;e.key==="ArrowDown"?a=r===-1?0:Math.min(r+1,t.length-1):e.key==="ArrowUp"?a=r===-1?t.length-1:Math.max(r-1,0):e.key==="Home"?a=0:e.key==="End"&&(a=t.length-1),(o=t[a])==null||o.focus()}render(){var c,g,u,v,y,S,A;const e=this.hasAttr("open"),t=this.root.querySelector(".search"),r=(c=t==null?void 0:t.value)!=null?c:"",a=t!=null&&this.root.activeElement===t,o=a?t.selectionStart:null,i=this.options;let s=this.getAttr("value");if(!s){const w=this.querySelector("option[selected]");s=(v=(u=w==null?void 0:w.getAttribute("value"))!=null?u:(g=w==null?void 0:w.textContent)==null?void 0:g.trim())!=null?v:""}const n=(S=(y=i.find(w=>w.value===s))==null?void 0:y.label)!=null?S:"",l=this.getAttr("placeholder","Selecione…"),p=r?i.filter(w=>w.label.toLowerCase().includes(r.toLowerCase())):i;this.setTemplate(`
|
|
187
187
|
<span class="trigger" part="trigger" role="button" tabindex="${this.disabled?-1:0}" aria-haspopup="listbox" aria-expanded="${e}">
|
|
188
|
-
<span class="${n?"label":"placeholder"}">${
|
|
188
|
+
<span class="${n?"label":"placeholder"}">${h(n)||h(l)}</span>
|
|
189
189
|
<span class="actions">
|
|
190
190
|
${this.hasAttr("clearable")&&s?'<button type="button" class="clear" part="clear" aria-label="Limpar">×</button>':""}
|
|
191
191
|
<span class="caret">▼</span>
|
|
192
192
|
</span>
|
|
193
193
|
</span>
|
|
194
194
|
<div class="panel" part="panel" role="listbox">
|
|
195
|
-
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${
|
|
196
|
-
${
|
|
197
|
-
<button type="button" class="opt" role="option" data-value="${
|
|
198
|
-
aria-selected="${w.value===s}">${
|
|
199
|
-
${
|
|
195
|
+
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${h(this.getAttr("search-placeholder","Pesquisar…"))}">`:""}
|
|
196
|
+
${p.map(w=>`
|
|
197
|
+
<button type="button" class="opt" role="option" data-value="${h(w.value)}"
|
|
198
|
+
aria-selected="${w.value===s}">${h(w.label)}</button>`).join("")}
|
|
199
|
+
${p.length===0?`<div class="empty">${h(this.getAttr("no-results","Nenhum resultado"))}</div>`:""}
|
|
200
200
|
</div>
|
|
201
201
|
`),e&&this.setAttribute("open","");const f=this.root.querySelector(".search");if(f&&(f.value=r,f.addEventListener("input",()=>this.render()),f.addEventListener("click",w=>w.stopPropagation()),a)){f.focus();try{f.setSelectionRange(o,o)}catch(w){}}const _=this.root.querySelector(".trigger");_&&(this.disabled&&_.setAttribute("aria-disabled","true"),_.addEventListener("click",w=>{var D;this.disabled||w.target.closest(".clear")||(this.toggleAttribute("open"),this.render(),(D=this.root.querySelector(".search"))==null||D.focus())}),_.addEventListener("keydown",w=>{var D;if(!this.disabled){if(w.key==="Enter"||w.key===" "){w.preventDefault(),_.click();return}if(w.key==="Escape"){this.hasAttr("open")&&(this.removeAttribute("open"),this.render(),(D=this.root.querySelector(".trigger"))==null||D.focus());return}(w.key==="ArrowDown"||w.key==="ArrowUp"||w.key==="Home"||w.key==="End")&&this._navigateOptions(w)}}),(A=this.root.querySelector(".clear"))==null||A.addEventListener("click",w=>{w.stopPropagation(),this.value="",this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:""}}))}),this.root.querySelectorAll(".opt").forEach(w=>{w.addEventListener("click",()=>this.select(w.dataset.value))}))}};Ne.styles=m`
|
|
202
202
|
:host {
|
|
@@ -205,6 +205,10 @@
|
|
|
205
205
|
font-family: var(--fx-font-family);
|
|
206
206
|
font-size: var(--fx-font-size);
|
|
207
207
|
position: relative;
|
|
208
|
+
/* Largura no HOST (padrão: conteúdo com mín. 200px). CSS externo, classes
|
|
209
|
+
e style inline no elemento definem a largura sem precisar do full. */
|
|
210
|
+
width: var(--fx-select-width, max-content);
|
|
211
|
+
min-width: var(--fx-select-min-width, 200px);
|
|
208
212
|
}
|
|
209
213
|
.trigger {
|
|
210
214
|
display: inline-flex;
|
|
@@ -213,7 +217,8 @@
|
|
|
213
217
|
gap: var(--fx-space-sm);
|
|
214
218
|
box-sizing: border-box;
|
|
215
219
|
min-height: var(--fx-size-md);
|
|
216
|
-
|
|
220
|
+
/* Acompanha a largura definida no :host. */
|
|
221
|
+
width: 100%;
|
|
217
222
|
font: inherit;
|
|
218
223
|
font-weight: var(--fx-font-weight);
|
|
219
224
|
color: var(--fx-text-default);
|
|
@@ -234,10 +239,12 @@
|
|
|
234
239
|
border-color: var(--fx-color-primary);
|
|
235
240
|
box-shadow: var(--fx-effect-focus-ring, none);
|
|
236
241
|
}
|
|
237
|
-
:host([size='sm'])
|
|
242
|
+
:host([size='sm']) { min-width: var(--fx-select-min-width-sm, 180px); }
|
|
243
|
+
:host([size='sm']) .trigger { min-height: var(--fx-size-sm); }
|
|
238
244
|
:host([size='lg']) .trigger { min-height: var(--fx-size-lg); font-size: calc(var(--fx-font-size) + 4px); }
|
|
239
245
|
/* Full width: o host estica até o pai e o trigger acompanha. */
|
|
240
246
|
:host([full]) { display: block; width: 100%; }
|
|
247
|
+
:host([full]) { min-width: 0; }
|
|
241
248
|
:host([full]) .trigger { width: 100%; min-width: 0; }
|
|
242
249
|
:host([full]) .panel { width: 100%; }
|
|
243
250
|
/* Validação */
|
|
@@ -344,13 +351,13 @@
|
|
|
344
351
|
}
|
|
345
352
|
.clear:hover { color: var(--fx-color-danger); }
|
|
346
353
|
.clear[hidden] { display: none; }
|
|
347
|
-
`;let V=Ne;function
|
|
354
|
+
`;let V=Ne;function Kt(){return x("fx-select",V)}Kt();const Fe=class Fe extends b{static get observedAttributes(){return["type","size","placeholder","disabled","readonly","min","max","step","icon","icon-pos","error","invalid","success","valid"]}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}render(){const e=this.getAttr("type","text"),t=this.getAttr("placeholder"),r=this.hasAttr("readonly"),a=this.hasAttr("disabled"),o=this.getAttr("min"),i=this.getAttr("max"),s=this.getAttr("step"),n=this.getAttr("icon"),l=this.getAttr("icon-pos","left")==="right"?"right":"left",f=this.querySelector('[slot="icon"]')?'<slot name="icon" part="icon"></slot>':n?C(n):"",_=!!f;this.setTemplate(`
|
|
348
355
|
${this.hasAttr("clearable")?'<div class="wrap" part="wrap">':""}
|
|
349
356
|
${_?`<div class="field-icon icon-${l}">`:""}
|
|
350
357
|
${_&&l==="left"?f:""}
|
|
351
|
-
<input class="field" part="input" type="${
|
|
352
|
-
${t?`placeholder="${
|
|
353
|
-
${o?`min="${
|
|
358
|
+
<input class="field" part="input" type="${h(e)}"
|
|
359
|
+
${t?`placeholder="${h(t)}"`:""}
|
|
360
|
+
${o?`min="${h(o)}"`:""} ${i?`max="${h(i)}"`:""} ${s?`step="${h(s)}"`:""}
|
|
354
361
|
/>
|
|
355
362
|
${_&&l==="right"?f:""}
|
|
356
363
|
${_?"</div>":""}
|
|
@@ -359,6 +366,12 @@
|
|
|
359
366
|
:host {
|
|
360
367
|
display: inline-block;
|
|
361
368
|
vertical-align: middle;
|
|
369
|
+
/* Largura padrão no HOST (e não no .field interno): assim CSS externo,
|
|
370
|
+
classes do framework (ex.: w-full) e style inline no elemento vencem
|
|
371
|
+
este default naturalmente — regras do documento têm precedência sobre
|
|
372
|
+
:host. Default global trocável via token: --fx-input-width (-sm/-lg). */
|
|
373
|
+
width: var(--fx-input-width, 260px);
|
|
374
|
+
vertical-align: middle;
|
|
362
375
|
font-family: var(--fx-font-family);
|
|
363
376
|
font-size: var(--fx-font-size);
|
|
364
377
|
}
|
|
@@ -372,7 +385,8 @@
|
|
|
372
385
|
border: 1px solid var(--fx-border-default);
|
|
373
386
|
border-radius: var(--fx-radius-md);
|
|
374
387
|
padding: var(--fx-space-md) var(--fx-space-lg);
|
|
375
|
-
|
|
388
|
+
/* Acompanha a largura definida no :host. */
|
|
389
|
+
width: 100%;
|
|
376
390
|
box-sizing: border-box;
|
|
377
391
|
transition:
|
|
378
392
|
border-color var(--fx-motion-duration-normal) var(--fx-motion-easing),
|
|
@@ -406,8 +420,10 @@
|
|
|
406
420
|
border-color: var(--fx-color-success, #16a34a);
|
|
407
421
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-color-success, #16a34a) 18%, transparent);
|
|
408
422
|
}
|
|
409
|
-
:host([size='sm'])
|
|
410
|
-
:host([size='
|
|
423
|
+
:host([size='sm']) { width: var(--fx-input-width-sm, 220px); }
|
|
424
|
+
:host([size='sm']) .field { padding: var(--fx-space-sm) var(--fx-space-md); font-size: var(--fx-font-size); min-height: var(--fx-size-sm); }
|
|
425
|
+
:host([size='lg']) { width: var(--fx-input-width-lg, 300px); }
|
|
426
|
+
:host([size='lg']) .field { padding: var(--fx-space-lg) var(--fx-space-xl); font-size: calc(var(--fx-font-size) + 4px); min-height: var(--fx-size-lg); }
|
|
411
427
|
/* Full width: o host estica até o pai e o campo interno acompanha
|
|
412
428
|
(usar com um container de largura controlada, ex. w-full no Vue). */
|
|
413
429
|
:host([full]) { display: block; width: 100%; }
|
|
@@ -415,7 +431,7 @@
|
|
|
415
431
|
/* Clearable */
|
|
416
432
|
:host([clearable]) { position: relative; display: inline-flex; }
|
|
417
433
|
:host([clearable][full]) { display: block; }
|
|
418
|
-
.wrap { position: relative; display: inline-flex; align-items: center; }
|
|
434
|
+
.wrap { position: relative; display: inline-flex; align-items: center; width: 100%; }
|
|
419
435
|
:host([full]) .wrap { display: flex; width: 100%; }
|
|
420
436
|
:host([clearable]) .field { padding-right: var(--fx-space-xl); }
|
|
421
437
|
:host([clearable][full]) .field { flex: 1 1 auto; }
|
|
@@ -425,6 +441,7 @@
|
|
|
425
441
|
position: relative;
|
|
426
442
|
display: inline-flex;
|
|
427
443
|
box-sizing: border-box;
|
|
444
|
+
width: 100%;
|
|
428
445
|
}
|
|
429
446
|
.field-icon .field { flex: 1 1 auto; min-width: 0; }
|
|
430
447
|
:host([full]) .field-icon { display: flex; width: 100%; }
|
|
@@ -534,14 +551,14 @@
|
|
|
534
551
|
:host([size='lg']) .track { width: 48px; height: 26px; }
|
|
535
552
|
:host([size='lg']) .thumb { top: 4px; left: 4px; width: 18px; height: 18px; }
|
|
536
553
|
:host([size='lg'][checked]) .thumb { transform: translateX(22px); }
|
|
537
|
-
`;let B=Pe;function Xt(){return x("fx-switch",B)}Xt();const Ve=class Ve extends b{constructor(){super(...arguments),this.selected=new Set}static get observedAttributes(){return["disabled","placeholder","error","invalid","success","valid"]}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get options(){return[...this.querySelectorAll("option")].map(e=>{var t,r,a,o,i;return{value:(a=(r=e.getAttribute("value"))!=null?r:(t=e.textContent)==null?void 0:t.trim())!=null?a:"",label:(i=(o=e.textContent)==null?void 0:o.trim())!=null?i:""}})}connectedCallback(){this.selected=new Set(this.values),super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.observer)==null||e.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}commit(){this.values=[...this.selected],this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:[...this.selected]}}))}toggleValue(e){this.selected.has(e)?this.selected.delete(e):this.selected.add(e),this.commit()}_navigateOptions(e){var o;e.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const t=Array.from(this.root.querySelectorAll(".opt"));if(!t.length)return;const r=t.indexOf(this.root.activeElement);let a=0;e.key==="ArrowDown"?a=r===-1?0:Math.min(r+1,t.length-1):e.key==="ArrowUp"?a=r===-1?t.length-1:Math.max(r-1,0):e.key==="Home"?a=0:e.key==="End"&&(a=t.length-1),(o=t[a])==null||o.focus()}render(){var l,
|
|
554
|
+
`;let B=Pe;function Xt(){return x("fx-switch",B)}Xt();const Ve=class Ve extends b{constructor(){super(...arguments),this.selected=new Set}static get observedAttributes(){return["disabled","placeholder","error","invalid","success","valid"]}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get options(){return[...this.querySelectorAll("option")].map(e=>{var t,r,a,o,i;return{value:(a=(r=e.getAttribute("value"))!=null?r:(t=e.textContent)==null?void 0:t.trim())!=null?a:"",label:(i=(o=e.textContent)==null?void 0:o.trim())!=null?i:""}})}connectedCallback(){this.selected=new Set(this.values),super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.observer)==null||e.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}commit(){this.values=[...this.selected],this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:[...this.selected]}}))}toggleValue(e){this.selected.has(e)?this.selected.delete(e):this.selected.add(e),this.commit()}_navigateOptions(e){var o;e.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const t=Array.from(this.root.querySelectorAll(".opt"));if(!t.length)return;const r=t.indexOf(this.root.activeElement);let a=0;e.key==="ArrowDown"?a=r===-1?0:Math.min(r+1,t.length-1):e.key==="ArrowUp"?a=r===-1?t.length-1:Math.max(r-1,0):e.key==="Home"?a=0:e.key==="End"&&(a=t.length-1),(o=t[a])==null||o.focus()}render(){var l,p,f,_;const e=this.hasAttr("open"),t=(p=(l=this.root.querySelector(".search"))==null?void 0:l.value)!=null?p:"",r=this.options;for(const c of[...this.selected])r.some(g=>g.value===c)||this.selected.delete(c);const a=r.filter(c=>this.selected.has(c.value)),o=this.getAttr("placeholder","Selecione…"),i=t?r.filter(c=>c.label.toLowerCase().includes(t.toLowerCase())):r;this.setTemplate(`
|
|
538
555
|
<span class="trigger" part="trigger" role="button" tabindex="${this.disabled?-1:0}" aria-haspopup="listbox" aria-expanded="${e}" aria-disabled="${this.disabled}">
|
|
539
556
|
<span class="lead">
|
|
540
557
|
${a.length?a.map(c=>`
|
|
541
|
-
<span class="chip" data-value="${
|
|
542
|
-
${
|
|
543
|
-
<span class="chip__x" role="button" aria-label="Remover ${
|
|
544
|
-
</span>`).join(""):`<span class="placeholder">${
|
|
558
|
+
<span class="chip" data-value="${h(c.value)}">
|
|
559
|
+
${h(c.label)}
|
|
560
|
+
<span class="chip__x" role="button" aria-label="Remover ${h(c.label)}">×</span>
|
|
561
|
+
</span>`).join(""):`<span class="placeholder">${h(o)}</span>`}
|
|
545
562
|
</span>
|
|
546
563
|
<span class="trigger-right">
|
|
547
564
|
${this.hasAttr("clearable")&&a.length?'<button type="button" class="icon-btn clear" part="clear" aria-label="Limpar seleção">×</button>':""}
|
|
@@ -553,14 +570,14 @@
|
|
|
553
570
|
<span class="count">${a.length} selecionado${a.length===1?"":"s"}</span>
|
|
554
571
|
${this.hasAttr("clearable")&&a.length?'<button type="button" class="clear-all">Limpar tudo</button>':""}
|
|
555
572
|
</div>
|
|
556
|
-
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${
|
|
573
|
+
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${h(this.getAttr("search-placeholder","Pesquisar…"))}">`:""}
|
|
557
574
|
<ul class="list">
|
|
558
575
|
${i.map(c=>`
|
|
559
|
-
<li><button type="button" class="opt" role="option" data-value="${
|
|
576
|
+
<li><button type="button" class="opt" role="option" data-value="${h(c.value)}"
|
|
560
577
|
aria-selected="${this.selected.has(c.value)}">
|
|
561
|
-
<span class="box" aria-hidden="true"></span>${
|
|
578
|
+
<span class="box" aria-hidden="true"></span>${h(c.label)}
|
|
562
579
|
</button></li>`).join("")}
|
|
563
|
-
${i.length===0?`<li class="empty">${
|
|
580
|
+
${i.length===0?`<li class="empty">${h(this.getAttr("no-results","Nenhum resultado"))}</li>`:""}
|
|
564
581
|
</ul>
|
|
565
582
|
</div>
|
|
566
583
|
`),e&&this.setAttribute("open","");const s=this.root.querySelector(".search");s&&(s.value=t,s.addEventListener("input",()=>{var u;const c=(u=s.selectionStart)!=null?u:s.value.length;this.render();const g=this.root.querySelector(".search");g&&(g.focus(),g.setSelectionRange(c,c))}),s.addEventListener("click",c=>c.stopPropagation()));const n=this.root.querySelector(".trigger");n&&(n.addEventListener("click",c=>{if(!this.disabled&&!c.target.closest(".clear")&&!c.target.closest(".chip__x")){if(this.toggleAttribute("open"),this.hasAttr("open")){const g=this.getBoundingClientRect();this.toggleAttribute("up",g.bottom+300>window.innerHeight&&g.top>300)}else this.removeAttribute("up");this.render()}}),n.addEventListener("keydown",c=>{var g;if(!this.disabled){if(c.key==="Enter"||c.key===" "){c.preventDefault(),n.dispatchEvent(new MouseEvent("click",{bubbles:!0}));return}if(c.key==="Escape"){this.hasAttr("open")&&(this.removeAttribute("open"),this.render(),(g=this.root.querySelector(".trigger"))==null||g.focus());return}(c.key==="ArrowDown"||c.key==="ArrowUp"||c.key==="Home"||c.key==="End")&&this._navigateOptions(c)}}),(f=this.root.querySelector(".clear"))==null||f.addEventListener("click",c=>{c.stopPropagation(),this.selected.clear(),this.commit()}),(_=this.root.querySelector(".clear-all"))==null||_.addEventListener("click",c=>{c.stopPropagation(),this.selected.clear(),this.commit()}),this.root.querySelectorAll(".chip").forEach(c=>{var g;(g=c.querySelector(".chip__x"))==null||g.addEventListener("click",u=>{u.stopPropagation(),this.toggleValue(c.dataset.value)})}),this.root.querySelectorAll(".opt").forEach(c=>{c.addEventListener("click",()=>this.toggleValue(c.dataset.value))}))}};Ve.styles=m`
|
|
@@ -570,13 +587,17 @@
|
|
|
570
587
|
font-family: var(--fx-font-family);
|
|
571
588
|
font-size: var(--fx-font-size);
|
|
572
589
|
position: relative;
|
|
590
|
+
/* Largura padrão no HOST: CSS externo, classes e style inline no elemento
|
|
591
|
+
vencem este default naturalmente (regras do documento > :host). */
|
|
592
|
+
width: var(--fx-multiselect-width, 240px);
|
|
573
593
|
}
|
|
574
594
|
.trigger {
|
|
575
595
|
display: inline-flex;
|
|
576
596
|
align-items: center;
|
|
577
597
|
flex-wrap: nowrap;
|
|
578
598
|
gap: var(--fx-space-xs);
|
|
579
|
-
|
|
599
|
+
/* Acompanha a largura definida no :host. */
|
|
600
|
+
width: 100%;
|
|
580
601
|
box-sizing: border-box;
|
|
581
602
|
min-height: var(--fx-size-md);
|
|
582
603
|
padding: var(--fx-space-xs) var(--fx-space-md);
|
|
@@ -599,8 +620,10 @@
|
|
|
599
620
|
min-width: 0;
|
|
600
621
|
overflow: hidden;
|
|
601
622
|
}
|
|
602
|
-
:host([size='sm'])
|
|
603
|
-
:host([size='
|
|
623
|
+
:host([size='sm']) { width: var(--fx-multiselect-width-sm, 200px); }
|
|
624
|
+
:host([size='sm']) .trigger { min-height: var(--fx-size-sm); }
|
|
625
|
+
:host([size='lg']) { width: var(--fx-multiselect-width-lg, 280px); }
|
|
626
|
+
:host([size='lg']) .trigger { min-height: var(--fx-size-lg); font-size: calc(var(--fx-font-size) + 4px); }
|
|
604
627
|
/* Full width: o host estica até o pai e o trigger acompanha. */
|
|
605
628
|
:host([full]) { display: block; width: 100%; }
|
|
606
629
|
:host([full]) .trigger { width: 100%; }
|
|
@@ -781,14 +804,14 @@
|
|
|
781
804
|
.opt[aria-selected='true'] .box::after { content: '✓'; }
|
|
782
805
|
.empty { padding: var(--fx-space-md); color: var(--fx-text-muted); text-align: center; }
|
|
783
806
|
:host([disabled]) .trigger { opacity: 0.55; cursor: not-allowed; background: var(--fx-surface-surface-hover); }
|
|
784
|
-
`;let O=Ve;function Ut(){return x("fx-multiselect",O)}Ut();const $=(d,e,t)=>d*1e4+e*100+t;function L(d){const e=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/.exec(d.trim());if(!e)return null;const t=+e[1],r=e[2]?+e[2]:1,a=e[3]?+e[3]:null;return a!==null?{lo:$(t,r,a),hi:$(t,r,a)}:e[2]?{lo:$(t,r,1),hi:$(t,r,31)}:{lo:$(t,1,1),hi:$(t,12,31)}}const Re=class Re extends b{constructor(){super(...arguments),this.view="days",this.cursor={y:new Date().getFullYear(),m:new Date().getMonth()},this.pickStart=null,this.pickEnd=null}static get observedAttributes(){return["value","start","end","min","max","range","mode","values","locale","disabled"]}get mode(){const e=this.getAttr("mode");return e==="range"||e==="multiple"?e:this.hasAttr("range")?"range":"single"}set mode(e){this.setAttribute("mode",e)}get range(){return this.mode==="range"}set range(e){this.toggleAttr("range",!!e)}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}bounds(){return{min:L(this.getAttr("min","")),max:L(this.getAttr("max",""))}}locale(){return this.getAttr("locale","pt-BR")}fmt(e,t){try{return new Intl.DateTimeFormat(this.locale(),e).format(t)}catch(r){return new Intl.DateTimeFormat("pt-BR",e).format(t)}}dayDisabled(e,t,r){const{min:a,max:o}=this.bounds(),i=$(e,t+1,r);return a!==null&&i<a.lo||o!==null&&i>o.hi}monthDisabled(e,t){const{min:r,max:a}=this.bounds(),o=$(e,t,1),i=$(e,t,31);return r!==null&&i<r.lo||a!==null&&o>a.hi}yearDisabled(e){const{min:t,max:r}=this.bounds(),a=$(e,1,1),o=$(e,12,31);return t!==null&&o<t.lo||r!==null&&a>r.hi}dayKeyOf(e){return $(e.getFullYear(),e.getMonth()+1,e.getDate())}keyToDate(e){return new Date(Math.floor(e/1e4),Math.floor(e/100)%100-1,e%100)}iso(e){const t=this.keyToDate(e),r=a=>String(a).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}selection(){const e=new Set(this.values.map(r=>{var a,o;return(o=(a=L(r))==null?void 0:a.lo)!=null?o:0}).filter(Boolean));if(this.mode==="range"){let r=this.pickStart,a=this.pickEnd;const o=L(this.getAttr("start","")),i=L(this.getAttr("end",""));return r===null&&o&&(r=o.lo),a===null&&i&&(a=i.lo),{start:r,end:a,single:null,multi:e}}if(this.mode==="multiple")return{start:null,end:null,single:null,multi:e};const t=L(this.getAttr("value",""));return{start:null,end:null,single:t?t.lo:null,multi:e}}emit(){if(this.mode==="range"){const e={start:this.pickStart!==null?this.iso(this.pickStart):this.getAttr("start",""),end:this.pickEnd!==null?this.iso(this.pickEnd):this.getAttr("end","")};this.setAttribute("start",e.start),this.setAttribute("end",e.end),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e}))}else if(this.mode==="multiple"){const e=this.values;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:e}}))}else{const e=this.getAttr("value");this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}}))}}pickDay(e){if(this.mode==="range"){if(this.pickStart===null||this.pickEnd!==null){this.pickStart=e,this.pickEnd=null,this.setAttribute("start",this.iso(e)),this.removeAttribute("end"),this.render();return}e<this.pickStart?[this.pickStart,this.pickEnd]=[e,this.pickStart]:this.pickEnd=e,this.emit()}else if(this.mode==="multiple"){const t=new Set(this.values),r=this.iso(e);t.has(r)?t.delete(r):t.add(r),this.values=[...t].sort(),this.emit()}else this.value=this.iso(e),this.emit();this.render()}navigate(e){if(this.view==="days"){const t=new Date(this.cursor.y,this.cursor.m+e,1);this.cursor={y:t.getFullYear(),m:t.getMonth()}}else this.view==="months"?this.cursor.y+=e:this.cursor.y+=e*12;this.render()}render(){const e=this.dayKeyOf(new Date),t=this.selection(),r=this.locale(),a={days:this.fmt({month:"long",year:"numeric"},new Date(this.cursor.y,this.cursor.m,1)),months:String(this.cursor.y),years:`${Math.floor(this.cursor.y/12)*12} – ${Math.floor(this.cursor.y/12)*12+11}`};let o="";if(this.view==="days")o=[...Array(7)].map((l,
|
|
807
|
+
`;let O=Ve;function Ut(){return x("fx-multiselect",O)}Ut();const $=(d,e,t)=>d*1e4+e*100+t;function L(d){const e=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/.exec(d.trim());if(!e)return null;const t=+e[1],r=e[2]?+e[2]:1,a=e[3]?+e[3]:null;return a!==null?{lo:$(t,r,a),hi:$(t,r,a)}:e[2]?{lo:$(t,r,1),hi:$(t,r,31)}:{lo:$(t,1,1),hi:$(t,12,31)}}const Re=class Re extends b{constructor(){super(...arguments),this.view="days",this.cursor={y:new Date().getFullYear(),m:new Date().getMonth()},this.pickStart=null,this.pickEnd=null}static get observedAttributes(){return["value","start","end","min","max","range","mode","values","locale","disabled"]}get mode(){const e=this.getAttr("mode");return e==="range"||e==="multiple"?e:this.hasAttr("range")?"range":"single"}set mode(e){this.setAttribute("mode",e)}get range(){return this.mode==="range"}set range(e){this.toggleAttr("range",!!e)}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}bounds(){return{min:L(this.getAttr("min","")),max:L(this.getAttr("max",""))}}locale(){return this.getAttr("locale","pt-BR")}fmt(e,t){try{return new Intl.DateTimeFormat(this.locale(),e).format(t)}catch(r){return new Intl.DateTimeFormat("pt-BR",e).format(t)}}dayDisabled(e,t,r){const{min:a,max:o}=this.bounds(),i=$(e,t+1,r);return a!==null&&i<a.lo||o!==null&&i>o.hi}monthDisabled(e,t){const{min:r,max:a}=this.bounds(),o=$(e,t,1),i=$(e,t,31);return r!==null&&i<r.lo||a!==null&&o>a.hi}yearDisabled(e){const{min:t,max:r}=this.bounds(),a=$(e,1,1),o=$(e,12,31);return t!==null&&o<t.lo||r!==null&&a>r.hi}dayKeyOf(e){return $(e.getFullYear(),e.getMonth()+1,e.getDate())}keyToDate(e){return new Date(Math.floor(e/1e4),Math.floor(e/100)%100-1,e%100)}iso(e){const t=this.keyToDate(e),r=a=>String(a).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}selection(){const e=new Set(this.values.map(r=>{var a,o;return(o=(a=L(r))==null?void 0:a.lo)!=null?o:0}).filter(Boolean));if(this.mode==="range"){let r=this.pickStart,a=this.pickEnd;const o=L(this.getAttr("start","")),i=L(this.getAttr("end",""));return r===null&&o&&(r=o.lo),a===null&&i&&(a=i.lo),{start:r,end:a,single:null,multi:e}}if(this.mode==="multiple")return{start:null,end:null,single:null,multi:e};const t=L(this.getAttr("value",""));return{start:null,end:null,single:t?t.lo:null,multi:e}}emit(){if(this.mode==="range"){const e={start:this.pickStart!==null?this.iso(this.pickStart):this.getAttr("start",""),end:this.pickEnd!==null?this.iso(this.pickEnd):this.getAttr("end","")};this.setAttribute("start",e.start),this.setAttribute("end",e.end),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e}))}else if(this.mode==="multiple"){const e=this.values;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:e}}))}else{const e=this.getAttr("value");this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}}))}}pickDay(e){if(this.mode==="range"){if(this.pickStart===null||this.pickEnd!==null){this.pickStart=e,this.pickEnd=null,this.setAttribute("start",this.iso(e)),this.removeAttribute("end"),this.render();return}e<this.pickStart?[this.pickStart,this.pickEnd]=[e,this.pickStart]:this.pickEnd=e,this.emit()}else if(this.mode==="multiple"){const t=new Set(this.values),r=this.iso(e);t.has(r)?t.delete(r):t.add(r),this.values=[...t].sort(),this.emit()}else this.value=this.iso(e),this.emit();this.render()}navigate(e){if(this.view==="days"){const t=new Date(this.cursor.y,this.cursor.m+e,1);this.cursor={y:t.getFullYear(),m:t.getMonth()}}else this.view==="months"?this.cursor.y+=e:this.cursor.y+=e*12;this.render()}render(){const e=this.dayKeyOf(new Date),t=this.selection(),r=this.locale(),a={days:this.fmt({month:"long",year:"numeric"},new Date(this.cursor.y,this.cursor.m,1)),months:String(this.cursor.y),years:`${Math.floor(this.cursor.y/12)*12} – ${Math.floor(this.cursor.y/12)*12+11}`};let o="";if(this.view==="days")o=[...Array(7)].map((l,p)=>this.fmt({weekday:"short"},new Date(2024,8,1+p))).map(l=>`<span class="wd">${l}</span>`).join("")+this.daysHtml(e,t,r);else if(this.view==="months")o=[...Array(12)].map((n,l)=>{const p=this.monthDisabled(this.cursor.y,l+1);return`<button type="button" class="cell" data-month="${l}" ${p?"disabled":""}>${this.fmt({month:"short"},new Date(this.cursor.y,l,1))}</button>`}).join("");else{const n=Math.floor(this.cursor.y/12)*12;o=[...Array(12)].map((l,p)=>{const f=n+p,_=this.yearDisabled(f);return`<button type="button" class="cell" data-year="${f}" ${_?"disabled":""}>${f}</button>`}).join("")}const i=this.view==="days"?'data-goto="months"':this.view==="months"?'data-goto="years"':"";this.setTemplate(`
|
|
785
808
|
<div class="head">
|
|
786
809
|
<button type="button" class="nav" data-nav="-1" aria-label="Anterior">‹</button>
|
|
787
810
|
<button type="button" class="title" part="title" ${i}>${a[this.view]}</button>
|
|
788
811
|
<button type="button" class="nav" data-nav="1" aria-label="Próximo">›</button>
|
|
789
812
|
</div>
|
|
790
813
|
<div class="grid ${this.view}">${o}</div>
|
|
791
|
-
`),this.root.querySelectorAll("[data-nav]").forEach(n=>n.addEventListener("click",()=>this.navigate(Number(n.dataset.nav))));const s=this.root.querySelector("[data-goto]");s==null||s.addEventListener("click",()=>{this.view=s.dataset.goto,this.render()}),this.root.querySelectorAll("[data-day]").forEach(n=>n.addEventListener("click",()=>this.pickDay(Number(n.dataset.day)))),this.root.querySelectorAll("[data-month]").forEach(n=>n.addEventListener("click",()=>{this.cursor.m=Number(n.dataset.month),this.view="days",this.render()})),this.root.querySelectorAll("[data-year]").forEach(n=>n.addEventListener("click",()=>{this.cursor.y=Number(n.dataset.year),this.view="months",this.render()}))}daysHtml(e,t,r){const{y:a,m:o}=this.cursor,i=new Date(a,o,1).getDay(),s=new Date(a,o+1,0).getDate(),n=new Date(a,o,0).getDate();let l="";for(let
|
|
814
|
+
`),this.root.querySelectorAll("[data-nav]").forEach(n=>n.addEventListener("click",()=>this.navigate(Number(n.dataset.nav))));const s=this.root.querySelector("[data-goto]");s==null||s.addEventListener("click",()=>{this.view=s.dataset.goto,this.render()}),this.root.querySelectorAll("[data-day]").forEach(n=>n.addEventListener("click",()=>this.pickDay(Number(n.dataset.day)))),this.root.querySelectorAll("[data-month]").forEach(n=>n.addEventListener("click",()=>{this.cursor.m=Number(n.dataset.month),this.view="days",this.render()})),this.root.querySelectorAll("[data-year]").forEach(n=>n.addEventListener("click",()=>{this.cursor.y=Number(n.dataset.year),this.view="months",this.render()}))}daysHtml(e,t,r){const{y:a,m:o}=this.cursor,i=new Date(a,o,1).getDay(),s=new Date(a,o+1,0).getDate(),n=new Date(a,o,0).getDate();let l="";for(let p=i-1;p>=0;p--)l+=`<span class="cell muted">${n-p}</span>`;for(let p=1;p<=s;p++){const f=$(a,o+1,p),_=t.single===f||t.start===f||t.end===f||t.multi.has(f),c=t.start!==null&&t.end!==null&&f>t.start&&f<t.end,g=["cell",_?"sel":"",c?"in-range":"",f===e?"today":""].filter(Boolean).join(" ");l+=`<button type="button" class="${g}" data-day="${f}" ${this.dayDisabled(a,o,p)?"disabled":""}>${p}</button>`}return l}};Re.styles=m`
|
|
792
815
|
:host {
|
|
793
816
|
display: inline-block;
|
|
794
817
|
font-family: var(--fx-font-family);
|
|
@@ -918,11 +941,11 @@
|
|
|
918
941
|
cursor: not-allowed;
|
|
919
942
|
pointer-events: none;
|
|
920
943
|
}
|
|
921
|
-
`;let
|
|
944
|
+
`;let H=Re;function Jt(){return x("fx-calendar",H)}Jt();const Be=class Be extends b{constructor(){super(...arguments),this.time={h:0,m:0,s:0}}static get observedAttributes(){return["value","start","end","values","mode","min","max","placeholder","disabled","format","show-time","free-text","error","invalid","success","valid"]}get mode(){const e=this.getAttr("mode","single");return["single","range","multiple"].includes(e)?e:"single"}set mode(e){this.setAttribute("mode",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get values(){const e=this.getAttr("values");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set values(e){this.setAttribute("values",e.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}connectedCallback(){super.connectedCallback(),this.docListener=e=>{this.hasAttr("open")&&(e.composedPath().includes(this)||this.removeAttribute("open"))},document.addEventListener("click",this.docListener)}disconnectedCallback(){super.disconnectedCallback(),this.docListener&&document.removeEventListener("click",this.docListener)}formatDate(e){if(!e)return"";const t=this.getAttr("format");if(!t)return e.split("T")[0];const[r,a]=e.split("T"),[o="",i="",s=""]=r.split("-"),[n="00",l="00",p="00"]=(a!=null?a:"").split(":");return t.replace(/yyyy/gi,"").replace(/MM/g,"").replace(/mm/g,"").replace(/dd/gi,"").replace(/HH/g,"").replace(/SS/gi,"").replace(/\u0001/g,o).replace(/\u0002/g,i).replace(/\u0003/g,s).replace(/\u0004/g,n).replace(/\u0005/g,l).replace(/\u0006/g,p)}displayText(){if(this.mode==="range"){const t=this.getAttr("start"),r=this.getAttr("end");if(this.hasAttr("show-time"),!t&&!r)return"";if(this.hasAttr("show-time")){const a=o=>o?`${this.formatDate(o)} ${this.timeText()}`:o?`${this.formatDate(o)} …`:"";return t&&r?`${a(t)} → ${a(r)}`:a(t)}return t&&r?`${this.formatDate(t)} → ${this.formatDate(r)}`:t?`${this.formatDate(t)} → …`:""}if(this.mode==="multiple")return this.values.map(t=>this.formatDate(t)).join(", ");const e=this.formatDate(this.value);return e&&this.hasAttr("show-time")?`${e} ${this.timeText()}`:e}timeText(){const e=t=>String(t).padStart(2,"0");return`${e(this.time.h)}:${e(this.time.m)}:${e(this.time.s)}`}loadTimeFromValue(){const t=(this.value||this.getAttr("start")||"").split("T")[1];if(!t)return;const[r,a,o]=t.split(":").map(i=>parseInt(i,10));this.time={h:r||0,m:a||0,s:o||0}}withTime(e){return e&&(this.hasAttr("show-time")?`${e}T${this.timeText()}`:e)}render(){var p,f;const e=this.disabled,t=this.hasAttr("clearable"),r=this.displayText(),a=r.length>0,o=this.hasAttr("show-time");this.loadTimeFromValue();let i=`min="${h(this.getAttr("min"))}" max="${h(this.getAttr("max"))}"`;if(this.mode==="range")i+=` range start="${h(this.getAttr("start"))}" end="${h(this.getAttr("end"))}"`;else if(this.mode==="multiple"){const _=this.values.map(c=>c.split("T")[0]).join(",");i+=` mode="multiple" values="${h(_)}"`}else{const _=(p=this.value.split("T")[0])!=null?p:"";i+=` value="${h(_)}"`}this.setTemplate(`
|
|
922
945
|
<div class="field" part="field">
|
|
923
946
|
<input class="display" part="display" type="text" ${this.hasAttr("free-text")&&!e?"":"readonly"}
|
|
924
|
-
placeholder="${
|
|
925
|
-
value="${
|
|
947
|
+
placeholder="${h(this.getAttr("placeholder","dd/mm/aaaa"))}"
|
|
948
|
+
value="${h(r)}" ${e?"disabled":""}>
|
|
926
949
|
<button type="button" class="clear" part="clear" aria-label="Limpar"
|
|
927
950
|
${t&&a?"":"hidden"}>
|
|
928
951
|
×
|
|
@@ -943,7 +966,7 @@
|
|
|
943
966
|
<input class="t-s" type="number" min="0" max="59" value="${this.time.s}" aria-label="Segundo">
|
|
944
967
|
</div>`:""}
|
|
945
968
|
</div>
|
|
946
|
-
`);const s=this.root.querySelector(".field");if(!s||e)return;s.addEventListener("click",_=>{if(!_.target.closest(".clear")&&!(this.hasAttr("free-text")&&_.target.classList.contains("display")))if(this.toggleAttribute("open"),this.hasAttr("open")){const c=this.getBoundingClientRect();this.toggleAttribute("up",c.bottom+340>window.innerHeight&&c.top>340)}else this.removeAttribute("up")}),(f=this.root.querySelector(".clear"))==null||f.addEventListener("click",_=>{_.stopPropagation(),this.removeAttribute("value"),this.removeAttribute("start"),this.removeAttribute("end"),this.removeAttribute("values"),this.removeAttribute("open"),this.render(),this.emitChange({})});const n=this.root.querySelector(".pop fx-calendar");n==null||n.addEventListener("change",_=>{var g;const c=(g=_.detail)!=null?g:{};(c.start!==void 0||c.end!==void 0)&&(c.start?this.setAttribute("start",this.withTime(c.start)):this.removeAttribute("start"),c.end?this.setAttribute("end",this.withTime(c.end)):this.removeAttribute("end")),c.values!==void 0&&(this.values=c.values.map(u=>this.withTime(u))),c.value!==void 0&&(c.value?this.setAttribute("value",this.withTime(c.value)):this.removeAttribute("value"),this.mode==="single"&&this.removeAttribute("open")),this.render(),this.emitChange(c)});const l=this.root.querySelector(".display");if(l&&this.hasAttr("free-text")&&!e&&(l.addEventListener("keydown",_=>{_.key==="Enter"&&(_.preventDefault(),this.commitTyped(l))}),l.addEventListener("blur",()=>this.commitTyped(l))),o){const _=()=>{const c=this.root.querySelector(".t-h"),g=this.root.querySelector(".t-m"),u=this.root.querySelector(".t-s"),v=(A,w)=>Math.min(w,Math.max(0,parseInt(A!=null?A:"0",10)||0));this.time={h:v(c==null?void 0:c.value,23),m:v(g==null?void 0:g.value,59),s:v(u==null?void 0:u.value,59)};const y=A=>A.split("T")[0]?`${A.split("T")[0]}T${this.timeText()}`:A;this.value&&this.setAttribute("value",y(this.value)),this.getAttr("start")&&this.setAttribute("start",y(this.getAttr("start"))),this.getAttr("end")&&this.setAttribute("end",y(this.getAttr("end"))),this.values.length&&(this.values=this.values.map(A=>y(A)));const S=this.root.querySelector(".display");S&&(S.value=this.displayText()),this.emitChange({value:this.value})};[".t-h",".t-m",".t-s"].forEach(c=>{var g;(g=this.root.querySelector(c))==null||g.addEventListener("input",_)})}}emitChange(e){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e}))}parseTyped(e){var u,v;const t=e.trim();if(!t)return null;const r=this.getAttr("format","dd/mm/yyyy").toLowerCase(),a=["dd","mm","yyyy"].filter(y=>r.includes(y));if(a.length<3)return null;const o=t.split(new RegExp("[^0-9]+")).filter(Boolean);if(o.length!==3)return null;const i={};a.forEach((y,S)=>i[y]=o[S]);const s=`${i.yyyy}-${((u=i.mm)!=null?u:"").padStart(2,"0")}-${((v=i.dd)!=null?v:"").padStart(2,"0")}`,n=new Date(`${s}T12:00:00`);if(Number.isNaN(n.getTime()))return null;const[l,
|
|
969
|
+
`);const s=this.root.querySelector(".field");if(!s||e)return;s.addEventListener("click",_=>{if(!_.target.closest(".clear")&&!(this.hasAttr("free-text")&&_.target.classList.contains("display")))if(this.toggleAttribute("open"),this.hasAttr("open")){const c=this.getBoundingClientRect();this.toggleAttribute("up",c.bottom+340>window.innerHeight&&c.top>340)}else this.removeAttribute("up")}),(f=this.root.querySelector(".clear"))==null||f.addEventListener("click",_=>{_.stopPropagation(),this.removeAttribute("value"),this.removeAttribute("start"),this.removeAttribute("end"),this.removeAttribute("values"),this.removeAttribute("open"),this.render(),this.emitChange({})});const n=this.root.querySelector(".pop fx-calendar");n==null||n.addEventListener("change",_=>{var g;const c=(g=_.detail)!=null?g:{};(c.start!==void 0||c.end!==void 0)&&(c.start?this.setAttribute("start",this.withTime(c.start)):this.removeAttribute("start"),c.end?this.setAttribute("end",this.withTime(c.end)):this.removeAttribute("end")),c.values!==void 0&&(this.values=c.values.map(u=>this.withTime(u))),c.value!==void 0&&(c.value?this.setAttribute("value",this.withTime(c.value)):this.removeAttribute("value"),this.mode==="single"&&this.removeAttribute("open")),this.render(),this.emitChange(c)});const l=this.root.querySelector(".display");if(l&&this.hasAttr("free-text")&&!e&&(l.addEventListener("keydown",_=>{_.key==="Enter"&&(_.preventDefault(),this.commitTyped(l))}),l.addEventListener("blur",()=>this.commitTyped(l))),o){const _=()=>{const c=this.root.querySelector(".t-h"),g=this.root.querySelector(".t-m"),u=this.root.querySelector(".t-s"),v=(A,w)=>Math.min(w,Math.max(0,parseInt(A!=null?A:"0",10)||0));this.time={h:v(c==null?void 0:c.value,23),m:v(g==null?void 0:g.value,59),s:v(u==null?void 0:u.value,59)};const y=A=>A.split("T")[0]?`${A.split("T")[0]}T${this.timeText()}`:A;this.value&&this.setAttribute("value",y(this.value)),this.getAttr("start")&&this.setAttribute("start",y(this.getAttr("start"))),this.getAttr("end")&&this.setAttribute("end",y(this.getAttr("end"))),this.values.length&&(this.values=this.values.map(A=>y(A)));const S=this.root.querySelector(".display");S&&(S.value=this.displayText()),this.emitChange({value:this.value})};[".t-h",".t-m",".t-s"].forEach(c=>{var g;(g=this.root.querySelector(c))==null||g.addEventListener("input",_)})}}emitChange(e){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e}))}parseTyped(e){var u,v;const t=e.trim();if(!t)return null;const r=this.getAttr("format","dd/mm/yyyy").toLowerCase(),a=["dd","mm","yyyy"].filter(y=>r.includes(y));if(a.length<3)return null;const o=t.split(new RegExp("[^0-9]+")).filter(Boolean);if(o.length!==3)return null;const i={};a.forEach((y,S)=>i[y]=o[S]);const s=`${i.yyyy}-${((u=i.mm)!=null?u:"").padStart(2,"0")}-${((v=i.dd)!=null?v:"").padStart(2,"0")}`,n=new Date(`${s}T12:00:00`);if(Number.isNaN(n.getTime()))return null;const[l,p,f]=s.split("-").map(y=>parseInt(y,10));if(n.getFullYear()!==l||n.getMonth()+1!==p||n.getDate()!==f)return null;const _=(y,S)=>y.split("T")[0].localeCompare(S.split("T")[0]),c=this.getAttr("min"),g=this.getAttr("max");return c&&_(s,c)<0||g&&_(s,g)>0?null:s}commitTyped(e){const t=this.parseTyped(e.value);if(!t){e.classList.add("invalid"),this.dispatchEvent(new CustomEvent("invalid",{bubbles:!0,composed:!0,detail:{text:e.value}})),e.value=this.displayText(),setTimeout(()=>e.classList.remove("invalid"),1500);return}if(this.mode==="single")this.setAttribute("value",this.withTime(t)),this.emitChange({value:this.value});else if(this.mode==="range"){if(!this.getAttr("start")||this.getAttr("start")&&this.getAttr("end"))this.setAttribute("start",this.withTime(t)),this.removeAttribute("end");else{const[r,a]=[this.getAttr("start").split("T")[0],t].sort();this.setAttribute("start",this.withTime(r)),this.setAttribute("end",this.withTime(a))}this.emitChange({start:this.getAttr("start"),end:this.getAttr("end")})}else{const r=this.values.filter(a=>a.split("T")[0]!==t);r.push(this.withTime(t)),this.values=r,this.emitChange({values:this.values})}this.render()}};Be.styles=m`
|
|
947
970
|
:host {
|
|
948
971
|
display: inline-block;
|
|
949
972
|
vertical-align: middle;
|
|
@@ -1090,7 +1113,7 @@
|
|
|
1090
1113
|
:host([disabled]) .display { cursor: not-allowed; }
|
|
1091
1114
|
:host([free-text]) .display { cursor: text; }
|
|
1092
1115
|
:host([free-text]) .display.invalid { border-bottom: 2px solid var(--fx-color-danger); }
|
|
1093
|
-
`;let
|
|
1116
|
+
`;let K=Be;function Wt(){return x("fx-datepicker",K)}Wt();const Oe=class Oe extends b{static get observedAttributes(){return["checked","disabled","indeterminate"]}get checked(){return this.hasAttr("checked")}set checked(e){this.toggleAttr("checked",!!e)}get indeterminate(){return this.hasAttr("indeterminate")}set indeterminate(e){this.toggleAttr("indeterminate",!!e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}render(){const e=this.size==="sm"?"14px":this.size==="lg"?"22px":"18px";this.style.getPropertyValue("--fx-size-checkbox")||this.style.setProperty("--fx-size-checkbox",e),this.setTemplate(`
|
|
1094
1117
|
<span class="box" part="box" role="checkbox" tabindex="0"
|
|
1095
1118
|
aria-checked="${this.indeterminate?"mixed":this.checked}"
|
|
1096
1119
|
aria-disabled="${this.disabled}">
|
|
@@ -1160,13 +1183,13 @@
|
|
|
1160
1183
|
cursor: not-allowed;
|
|
1161
1184
|
pointer-events: none;
|
|
1162
1185
|
}
|
|
1163
|
-
`;let Y=Oe;function Gt(){return x("fx-checkbox",Y)}Gt();const
|
|
1186
|
+
`;let Y=Oe;function Gt(){return x("fx-checkbox",Y)}Gt();const He=class He extends b{static get observedAttributes(){return["checked","disabled"]}get checked(){return this.hasAttr("checked")}set checked(e){this.toggleAttr("checked",!!e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}render(){const e=this.size==="sm"?"14px":this.size==="lg"?"22px":"18px";this.style.getPropertyValue("--fx-size-radio")||this.style.setProperty("--fx-size-radio",e),this.setTemplate(`
|
|
1164
1187
|
<span class="box" part="box" role="radio" tabindex="0"
|
|
1165
1188
|
aria-checked="${this.checked}" aria-disabled="${this.disabled}">
|
|
1166
1189
|
<span class="control" part="control"><span class="dot" part="dot"></span></span>
|
|
1167
1190
|
<span class="label" part="label"><slot></slot></span>
|
|
1168
1191
|
</span>
|
|
1169
|
-
`);const t=this.root.querySelector(".box");t&&(t.addEventListener("click",()=>this.select()),t.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.select())}))}select(){if(this.disabled||this.checked)return;const e=this.getAttr("name");e&&document.querySelectorAll(`fx-radio[name="${CSS.escape(e)}"]`).forEach(t=>{t.checked=!1}),this.checked=!0,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:!0,value:this.getAttr("value")}}))}};
|
|
1192
|
+
`);const t=this.root.querySelector(".box");t&&(t.addEventListener("click",()=>this.select()),t.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.select())}))}select(){if(this.disabled||this.checked)return;const e=this.getAttr("name");e&&document.querySelectorAll(`fx-radio[name="${CSS.escape(e)}"]`).forEach(t=>{t.checked=!1}),this.checked=!0,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:!0,value:this.getAttr("value")}}))}};He.styles=m`
|
|
1170
1193
|
:host {
|
|
1171
1194
|
display: inline-flex;
|
|
1172
1195
|
vertical-align: middle;
|
|
@@ -1222,7 +1245,7 @@
|
|
|
1222
1245
|
cursor: not-allowed;
|
|
1223
1246
|
pointer-events: none;
|
|
1224
1247
|
}
|
|
1225
|
-
`;let X=Ke;function Zt(){return x("fx-radio",X)}Zt();const T="pt-BR",Qt={currency:d=>{if(d==null||d==="")return"";try{return new Intl.NumberFormat(T,{style:"currency",currency:"BRL"}).format(Number(d))}catch(e){return String(d)}},date:(d,e)=>{const t=Et(d);if(!t)return String(d!=null?d:"");const r={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"}},a=e&&r[e]?r[e]:r.medium;try{return new Intl.DateTimeFormat(T,a).format(t)}catch(o){return t.toLocaleDateString(T)}},dateTime:d=>{const e=Et(d);if(!e)return String(d!=null?d:"");try{return new Intl.DateTimeFormat(T,{dateStyle:"medium",timeStyle:"short"}).format(e)}catch(t){return e.toLocaleString(T)}},number:(d,e)=>{if(d==null||d==="")return"";try{const t={};if(e!==void 0){const r=Number(e);t.minimumFractionDigits=r,t.maximumFractionDigits=r}return new Intl.NumberFormat(T,t).format(Number(d))}catch(t){return String(d)}}};function Et(d){if(d==null||d==="")return null;if(d instanceof Date)return isNaN(d.getTime())?null:d;if(typeof d=="number"){const e=new Date(d);return isNaN(e.getTime())?null:e}if(typeof d=="string"){const e=new Date(d);return isNaN(e.getTime())?null:e}return null}const er=d=>/[a-z_$]/i.test(d),tr=d=>/[a-z0-9_$]/i.test(d);function rr(d){const e=[];let t=0;for(;t<d.length;){const r=d[t];if(/\s/.test(r)){t++;continue}if(r==="'"||r==='"'){const o=r;let i="";for(t++;t<d.length&&d[t]!==o;)d[t]==="\\"&&t+1<d.length?(i+=d[t+1],t+=2):(i+=d[t],t++);t++,e.push({type:"str",value:i});continue}if(r>="0"&&r<="9"){let o="";for(;t<d.length&&(d[t]>="0"&&d[t]<="9"||d[t]===".");)o+=d[t],t++;e.push({type:"num",value:o});continue}if(er(r)){let o="";for(;t<d.length&&tr(d[t]);)o+=d[t],t++;o==="true"||o==="false"||o==="null"?e.push({type:"kw",value:o}):e.push({type:"id",value:o});continue}const a=d.slice(t,t+2);if(a==="=="||a==="!="||a===">="||a==="<="){e.push({type:"cmp",value:a}),t+=2;continue}if(r==="+"){e.push({type:"op",value:"+"}),t++;continue}if(r==="-"){e.push({type:"op",value:"-"}),t++;continue}if(r==="*"){e.push({type:"op",value:"*"}),t++;continue}if(r==="/"){e.push({type:"op",value:"/"}),t++;continue}if(r===">"){e.push({type:"cmp",value:">"}),t++;continue}if(r==="<"){e.push({type:"cmp",value:"<"}),t++;continue}if(r==="!"){e.push({type:"op",value:"!"}),t++;continue}if(r==="?"){e.push({type:"qm",value:"?"}),t++;continue}if(r===":"){e.push({type:"colon",value:":"}),t++;continue}if(r==="|"){e.push({type:"pipe",value:"|"}),t++;continue}if(r==="("){e.push({type:"lparen",value:"("}),t++;continue}if(r===")"){e.push({type:"rparen",value:")"}),t++;continue}if(r==="."){e.push({type:"dot",value:"."}),t++;continue}t++}return e}class ar{constructor(e,t){this.tokens=e,this.ctx=t,this.pos=0}peek(){return this.pos<this.tokens.length?this.tokens[this.pos]:null}next(){return this.pos<this.tokens.length?this.tokens[this.pos++]:null}matchType(e){var t;return((t=this.peek())==null?void 0:t.type)===e?this.next():null}parse(){return this.parsePipe()}parsePipe(){var t,r;let e=this.parseTernary();for(;((t=this.peek())==null?void 0:t.type)==="pipe";){this.next();const a=this.matchType("id");if(!a)break;let o;if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const i=this.peek();i&&(i.type==="str"||i.type==="num"||i.type==="id")&&(o=i.type==="str"?i.value:String(i.value),this.next())}e=this.applyPipe(a.value,o,e)}return e}parseTernary(){var t,r;const e=this.parseComparison();if(((t=this.peek())==null?void 0:t.type)==="qm"){this.next();const a=this.parsePipe();if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const o=this.parsePipe();return e?a:o}return a}return e}parseComparison(){const e=this.parseAdditive(),t=this.peek();if((t==null?void 0:t.type)==="cmp"){this.next();const r=this.parseAdditive();return this.compare(e,t.value,r)}return e}compare(e,t,r){const a=Ct(e),o=Ct(r);switch(t){case"==":return a==o;case"!=":return a!=o;case">":return a>o;case"<":return a<o;case">=":return a>=o;case"<=":return a<=o}return!1}parseAdditive(){let e=this.parseMultiplicative();for(;;){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="+"||t.value==="-")){this.next();const r=this.parseMultiplicative();e=t.value==="+"?this.add(e,r):this.subtract(e,r)}else break}return e}add(e,t){return typeof e=="string"||typeof t=="string"?String(e!=null?e:"")+String(t!=null?t:""):Number(e)+Number(t)}subtract(e,t){return Number(e)-Number(t)}parseMultiplicative(){let e=this.parseUnary();for(;;){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="*"||t.value==="/")){this.next();const r=this.parseUnary();e=t.value==="*"?Number(e)*Number(r):Number(e)/Number(r)}else break}return e}parseUnary(){const e=this.peek();if((e==null?void 0:e.type)==="op"&&(e.value==="+"||e.value==="-")){this.next();const t=Number(this.parseUnary());return e.value==="-"?-t:t}return(e==null?void 0:e.type)==="op"&&e.value==="!"?(this.next(),!this.parseUnary()):this.parsePrimary()}parsePrimary(){var t;const e=this.peek();if(e){if(e.type==="lparen"){this.next();const r=this.parsePipe();return this.matchType("rparen"),r}if(e.type==="str")return this.next(),e.value;if(e.type==="num")return this.next(),Number(e.value);if(e.type==="kw")return this.next(),e.value==="true"?!0:e.value==="false"?!1:null;if(e.type==="id"){this.next();let r=this.resolveId(e.value);for(;((t=this.peek())==null?void 0:t.type)==="dot";){this.next();const a=this.peek();if((a==null?void 0:a.type)==="id")this.next(),r=r==null?void 0:r[a.value];else break}return r}this.next()}}resolveId(e){switch(e){case"value":return this.ctx.value;case"row":return this.ctx.row;case"true":return!0;case"false":return!1;case"null":return null;default:return this.ctx.row[e]}}applyPipe(e,t,r){const a=Qt[e];if(!a)return U(r);try{return a(r,t)}catch(o){return U(r)}}}function Ct(d){return typeof d=="number"?d:typeof d=="boolean"?d?1:0:String(d!=null?d:"")}function U(d){return d==null?"":typeof d=="object"?"[object Object]":String(d)}function or(d,e){try{const t=rr(d),a=new ar(t,e).parse();return U(a)}catch(t){return""}}function ir(d,e,t){const r={value:e[t],row:e};return d.replace(/\{\{([^}]+)\}\}/g,(a,o)=>p(or(sr(o.trim()),r)))}function sr(d){return d.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"').replace(/'/g,"'")}const He=class He extends b{constructor(){super(...arguments),this._data=[],this.page=0,this.sortField="",this.sortDir=1,this.filters={},this.globalSearch=""}static get observedAttributes(){return["pagination","rows","rows-options","striped","empty-message","pagination-position","lazy","total","loading","loading-message"]}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e:[],this.render()}get total(){var e;return(e=this._total)!=null?e:this._data.length}set total(e){this._total=e,this.setAttribute("total",String(e))}get rowsPerPage(){const e=Number(this.getAttr("rows","10"));return e>0?e:10}set rowsPerPage(e){this.setAttribute("rows",String(e))}get lazy(){return this.hasAttr("lazy")}get columns(){return[...this.querySelectorAll("fx-column")].map(e=>{var o,i,s,n;const t=e.querySelector("template"),r=t?void 0:e.innerHTML.trim(),a=(o=e.getAttribute("align"))!=null?o:"left";return{field:(i=e.getAttribute("field"))!=null?i:"",header:(n=(s=e.getAttribute("header"))!=null?s:e.getAttribute("field"))!=null?n:"",sortable:e.hasAttribute("sortable"),filterable:e.hasAttribute("filterable"),align:["left","center","right","justify","start","end"].includes(a)?a:"left",template:t!=null?t:void 0,directTemplate:r||void 0}})}get toolbarTemplate(){return this.querySelector('template[slot="toolbar"]')}connectedCallback(){this._parseDataAttribute(),super.connectedCallback(),this._columnObserver=new MutationObserver(()=>this.render()),this._columnObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){var e;(e=this._columnObserver)==null||e.disconnect(),super.disconnectedCallback()}_parseDataAttribute(){if(!this._data.length)try{const t=this.getAttr("data");t&&(this._data=JSON.parse(t))}catch(t){}const e=this.getAttr("total");if(e){const t=Number(e);isNaN(t)||(this._total=t)}}computeRows(){let e=[...this._data];for(const[r,a]of Object.entries(this.filters)){if(!a)continue;const o=a.toLowerCase();e=e.filter(i=>{var s;return String((s=i[r])!=null?s:"").toLowerCase().includes(o)})}if(this.globalSearch){const r=this.globalSearch.toLowerCase(),a=this._getSearchFields();e=e.filter(o=>(a.length?a:Object.keys(o)).some(s=>{var n;return String((n=o[s])!=null?n:"").toLowerCase().includes(r)}))}const t=this.lazy?this.total:e.length;if(this.sortField&&e.sort((r,a)=>{const o=r[this.sortField],i=a[this.sortField];return typeof o=="number"&&typeof i=="number"?(o-i)*this.sortDir:String(o!=null?o:"").localeCompare(String(i!=null?i:""),"pt-BR")*this.sortDir}),this.hasAttr("pagination")&&!this.lazy){const r=this.page*this.rowsPerPage;e=e.slice(r,r+this.rowsPerPage)}return{rows:e,total:t}}_getSearchFields(){const e=this.root.querySelector("[data-search-fields]");if(!e)return[];const t=e.getAttribute("data-search-fields");return t===null?[]:t.split(",").map(r=>r.trim()).filter(Boolean)}cellHtml(e,t){var a,o,i;const r=(o=(a=e.template)==null?void 0:a.innerHTML)!=null?o:e.directTemplate;return r?ir(r,t,e.field):p(String((i=t[e.field])!=null?i:""))}render(){var g;const e=this.columns.filter(u=>u.field),{rows:t,total:r}=this.computeRows(),a=this.hasAttr("pagination"),o=Math.max(1,Math.ceil(r/this.rowsPerPage));this.page>=o&&(this.page=o-1);const i=this.toolbarTemplate,s=i?`<div class="toolbar" part="toolbar">${i.innerHTML}</div>`:"",n=e.map(u=>{const v=this.sortField===u.field,y=v?this.sortDir===1?"▲":"▼":u.sortable?"⇅":"",S=v?"active":"";return`<th part="header" class="${u.sortable?"sortable":""}" style="text-align:${u.align}" data-field="${p(u.field)}">${p(u.header)}${y?`<span class="sort-ind ${S}">${y}</span>`:""}</th>`}).join(""),l=e.some(u=>u.filterable)?`<tr class="filter-row">${e.map(u=>{var v;return`<th style="text-align:${u.align}">${u.filterable?`<input class="filter" data-field="${p(u.field)}" placeholder="${p("Filtrar…")}" value="${p((v=this.filters[u.field])!=null?v:"")}">`:""}</th>`}).join("")}</tr>`:"",h=t.length?t.map((u,v)=>`<tr part="row" data-index="${v}">${e.map(y=>`<td part="cell" style="text-align:${y.align}">${this.cellHtml(y,u)}</td>`).join("")}</tr>`).join(""):`<tr><td class="empty" colspan="${e.length||1}">${p(this.getAttr("empty-message","Nenhum registro encontrado"))}</td></tr>`,f=a?`
|
|
1248
|
+
`;let X=He;function Zt(){return x("fx-radio",X)}Zt();const T="pt-BR",Qt={currency:d=>{if(d==null||d==="")return"";try{return new Intl.NumberFormat(T,{style:"currency",currency:"BRL"}).format(Number(d))}catch(e){return String(d)}},date:(d,e)=>{const t=Et(d);if(!t)return String(d!=null?d:"");const r={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"}},a=e&&r[e]?r[e]:r.medium;try{return new Intl.DateTimeFormat(T,a).format(t)}catch(o){return t.toLocaleDateString(T)}},dateTime:d=>{const e=Et(d);if(!e)return String(d!=null?d:"");try{return new Intl.DateTimeFormat(T,{dateStyle:"medium",timeStyle:"short"}).format(e)}catch(t){return e.toLocaleString(T)}},number:(d,e)=>{if(d==null||d==="")return"";try{const t={};if(e!==void 0){const r=Number(e);t.minimumFractionDigits=r,t.maximumFractionDigits=r}return new Intl.NumberFormat(T,t).format(Number(d))}catch(t){return String(d)}}};function Et(d){if(d==null||d==="")return null;if(d instanceof Date)return isNaN(d.getTime())?null:d;if(typeof d=="number"){const e=new Date(d);return isNaN(e.getTime())?null:e}if(typeof d=="string"){const e=new Date(d);return isNaN(e.getTime())?null:e}return null}const er=d=>/[a-z_$]/i.test(d),tr=d=>/[a-z0-9_$]/i.test(d);function rr(d){const e=[];let t=0;for(;t<d.length;){const r=d[t];if(/\s/.test(r)){t++;continue}if(r==="'"||r==='"'){const o=r;let i="";for(t++;t<d.length&&d[t]!==o;)d[t]==="\\"&&t+1<d.length?(i+=d[t+1],t+=2):(i+=d[t],t++);t++,e.push({type:"str",value:i});continue}if(r>="0"&&r<="9"){let o="";for(;t<d.length&&(d[t]>="0"&&d[t]<="9"||d[t]===".");)o+=d[t],t++;e.push({type:"num",value:o});continue}if(er(r)){let o="";for(;t<d.length&&tr(d[t]);)o+=d[t],t++;o==="true"||o==="false"||o==="null"?e.push({type:"kw",value:o}):e.push({type:"id",value:o});continue}const a=d.slice(t,t+2);if(a==="=="||a==="!="||a===">="||a==="<="){e.push({type:"cmp",value:a}),t+=2;continue}if(r==="+"){e.push({type:"op",value:"+"}),t++;continue}if(r==="-"){e.push({type:"op",value:"-"}),t++;continue}if(r==="*"){e.push({type:"op",value:"*"}),t++;continue}if(r==="/"){e.push({type:"op",value:"/"}),t++;continue}if(r===">"){e.push({type:"cmp",value:">"}),t++;continue}if(r==="<"){e.push({type:"cmp",value:"<"}),t++;continue}if(r==="!"){e.push({type:"op",value:"!"}),t++;continue}if(r==="?"){e.push({type:"qm",value:"?"}),t++;continue}if(r===":"){e.push({type:"colon",value:":"}),t++;continue}if(r==="|"){e.push({type:"pipe",value:"|"}),t++;continue}if(r==="("){e.push({type:"lparen",value:"("}),t++;continue}if(r===")"){e.push({type:"rparen",value:")"}),t++;continue}if(r==="."){e.push({type:"dot",value:"."}),t++;continue}t++}return e}class ar{constructor(e,t){this.tokens=e,this.ctx=t,this.pos=0}peek(){return this.pos<this.tokens.length?this.tokens[this.pos]:null}next(){return this.pos<this.tokens.length?this.tokens[this.pos++]:null}matchType(e){var t;return((t=this.peek())==null?void 0:t.type)===e?this.next():null}parse(){return this.parsePipe()}parsePipe(){var t,r;let e=this.parseTernary();for(;((t=this.peek())==null?void 0:t.type)==="pipe";){this.next();const a=this.matchType("id");if(!a)break;let o;if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const i=this.peek();i&&(i.type==="str"||i.type==="num"||i.type==="id")&&(o=i.type==="str"?i.value:String(i.value),this.next())}e=this.applyPipe(a.value,o,e)}return e}parseTernary(){var t,r;const e=this.parseComparison();if(((t=this.peek())==null?void 0:t.type)==="qm"){this.next();const a=this.parsePipe();if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const o=this.parsePipe();return e?a:o}return a}return e}parseComparison(){const e=this.parseAdditive(),t=this.peek();if((t==null?void 0:t.type)==="cmp"){this.next();const r=this.parseAdditive();return this.compare(e,t.value,r)}return e}compare(e,t,r){const a=Ct(e),o=Ct(r);switch(t){case"==":return a==o;case"!=":return a!=o;case">":return a>o;case"<":return a<o;case">=":return a>=o;case"<=":return a<=o}return!1}parseAdditive(){let e=this.parseMultiplicative();for(;;){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="+"||t.value==="-")){this.next();const r=this.parseMultiplicative();e=t.value==="+"?this.add(e,r):this.subtract(e,r)}else break}return e}add(e,t){return typeof e=="string"||typeof t=="string"?String(e!=null?e:"")+String(t!=null?t:""):Number(e)+Number(t)}subtract(e,t){return Number(e)-Number(t)}parseMultiplicative(){let e=this.parseUnary();for(;;){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="*"||t.value==="/")){this.next();const r=this.parseUnary();e=t.value==="*"?Number(e)*Number(r):Number(e)/Number(r)}else break}return e}parseUnary(){const e=this.peek();if((e==null?void 0:e.type)==="op"&&(e.value==="+"||e.value==="-")){this.next();const t=Number(this.parseUnary());return e.value==="-"?-t:t}return(e==null?void 0:e.type)==="op"&&e.value==="!"?(this.next(),!this.parseUnary()):this.parsePrimary()}parsePrimary(){var t;const e=this.peek();if(e){if(e.type==="lparen"){this.next();const r=this.parsePipe();return this.matchType("rparen"),r}if(e.type==="str")return this.next(),e.value;if(e.type==="num")return this.next(),Number(e.value);if(e.type==="kw")return this.next(),e.value==="true"?!0:e.value==="false"?!1:null;if(e.type==="id"){this.next();let r=this.resolveId(e.value);for(;((t=this.peek())==null?void 0:t.type)==="dot";){this.next();const a=this.peek();if((a==null?void 0:a.type)==="id")this.next(),r=r==null?void 0:r[a.value];else break}return r}this.next()}}resolveId(e){switch(e){case"value":return this.ctx.value;case"row":return this.ctx.row;case"true":return!0;case"false":return!1;case"null":return null;default:return this.ctx.row[e]}}applyPipe(e,t,r){const a=Qt[e];if(!a)return U(r);try{return a(r,t)}catch(o){return U(r)}}}function Ct(d){return typeof d=="number"?d:typeof d=="boolean"?d?1:0:String(d!=null?d:"")}function U(d){return d==null?"":typeof d=="object"?"[object Object]":String(d)}function or(d,e){try{const t=rr(d),a=new ar(t,e).parse();return U(a)}catch(t){return""}}function ir(d,e,t){const r={value:e[t],row:e};return d.replace(/\{\{([^}]+)\}\}/g,(a,o)=>h(or(sr(o.trim()),r)))}function sr(d){return d.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"').replace(/'/g,"'")}const Ke=class Ke extends b{constructor(){super(...arguments),this._data=[],this.page=0,this.sortField="",this.sortDir=1,this.filters={},this.globalSearch=""}static get observedAttributes(){return["pagination","rows","rows-options","striped","empty-message","pagination-position","lazy","total","loading","loading-message"]}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e:[],this.render()}get total(){var e;return(e=this._total)!=null?e:this._data.length}set total(e){this._total=e,this.setAttribute("total",String(e))}get rowsPerPage(){const e=Number(this.getAttr("rows","10"));return e>0?e:10}set rowsPerPage(e){this.setAttribute("rows",String(e))}get lazy(){return this.hasAttr("lazy")}get columns(){return[...this.querySelectorAll("fx-column")].map(e=>{var o,i,s,n;const t=e.querySelector("template"),r=t?void 0:e.innerHTML.trim(),a=(o=e.getAttribute("align"))!=null?o:"left";return{field:(i=e.getAttribute("field"))!=null?i:"",header:(n=(s=e.getAttribute("header"))!=null?s:e.getAttribute("field"))!=null?n:"",sortable:e.hasAttribute("sortable"),filterable:e.hasAttribute("filterable"),align:["left","center","right","justify","start","end"].includes(a)?a:"left",template:t!=null?t:void 0,directTemplate:r||void 0}})}get toolbarTemplate(){return this.querySelector('template[slot="toolbar"]')}connectedCallback(){this._parseDataAttribute(),super.connectedCallback(),this._columnObserver=new MutationObserver(()=>this.render()),this._columnObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){var e;(e=this._columnObserver)==null||e.disconnect(),super.disconnectedCallback()}_parseDataAttribute(){if(!this._data.length)try{const t=this.getAttr("data");t&&(this._data=JSON.parse(t))}catch(t){}const e=this.getAttr("total");if(e){const t=Number(e);isNaN(t)||(this._total=t)}}computeRows(){let e=[...this._data];for(const[r,a]of Object.entries(this.filters)){if(!a)continue;const o=a.toLowerCase();e=e.filter(i=>{var s;return String((s=i[r])!=null?s:"").toLowerCase().includes(o)})}if(this.globalSearch){const r=this.globalSearch.toLowerCase(),a=this._getSearchFields();e=e.filter(o=>(a.length?a:Object.keys(o)).some(s=>{var n;return String((n=o[s])!=null?n:"").toLowerCase().includes(r)}))}const t=this.lazy?this.total:e.length;if(this.sortField&&e.sort((r,a)=>{const o=r[this.sortField],i=a[this.sortField];return typeof o=="number"&&typeof i=="number"?(o-i)*this.sortDir:String(o!=null?o:"").localeCompare(String(i!=null?i:""),"pt-BR")*this.sortDir}),this.hasAttr("pagination")&&!this.lazy){const r=this.page*this.rowsPerPage;e=e.slice(r,r+this.rowsPerPage)}return{rows:e,total:t}}_getSearchFields(){const e=this.root.querySelector("[data-search-fields]");if(!e)return[];const t=e.getAttribute("data-search-fields");return t===null?[]:t.split(",").map(r=>r.trim()).filter(Boolean)}cellHtml(e,t){var a,o,i;const r=(o=(a=e.template)==null?void 0:a.innerHTML)!=null?o:e.directTemplate;return r?ir(r,t,e.field):h(String((i=t[e.field])!=null?i:""))}render(){var g;const e=this.columns.filter(u=>u.field),{rows:t,total:r}=this.computeRows(),a=this.hasAttr("pagination"),o=Math.max(1,Math.ceil(r/this.rowsPerPage));this.page>=o&&(this.page=o-1);const i=this.toolbarTemplate,s=i?`<div class="toolbar" part="toolbar">${i.innerHTML}</div>`:"",n=e.map(u=>{const v=this.sortField===u.field,y=v?this.sortDir===1?"▲":"▼":u.sortable?"⇅":"",S=v?"active":"";return`<th part="header" class="${u.sortable?"sortable":""}" style="text-align:${u.align}" data-field="${h(u.field)}">${h(u.header)}${y?`<span class="sort-ind ${S}">${y}</span>`:""}</th>`}).join(""),l=e.some(u=>u.filterable)?`<tr class="filter-row">${e.map(u=>{var v;return`<th style="text-align:${u.align}">${u.filterable?`<input class="filter" data-field="${h(u.field)}" placeholder="${h("Filtrar…")}" value="${h((v=this.filters[u.field])!=null?v:"")}">`:""}</th>`}).join("")}</tr>`:"",p=t.length?t.map((u,v)=>`<tr part="row" data-index="${v}">${e.map(y=>`<td part="cell" style="text-align:${y.align}">${this.cellHtml(y,u)}</td>`).join("")}</tr>`).join(""):`<tr><td class="empty" colspan="${e.length||1}">${h(this.getAttr("empty-message","Nenhum registro encontrado"))}</td></tr>`,f=a?`
|
|
1226
1249
|
<div class="pager" part="pager">
|
|
1227
1250
|
<span class="info">Página ${this.page+1} de ${o} · ${r} registros</span>
|
|
1228
1251
|
<button type="button" class="pg-btn" data-pg="first" ${this.page===0?"disabled":""}>«</button>
|
|
@@ -1230,22 +1253,22 @@
|
|
|
1230
1253
|
${Array.from({length:o},(u,v)=>`<button type="button" class="pg-btn" data-pg="${v}" aria-current="${v===this.page}">${v+1}</button>`).join("")}
|
|
1231
1254
|
<button type="button" class="pg-btn" data-pg="next" ${this.page>=o-1?"disabled":""}>›</button>
|
|
1232
1255
|
<button type="button" class="pg-btn" data-pg="last" ${this.page>=o-1?"disabled":""}>»</button>
|
|
1233
|
-
<label class="info">${
|
|
1234
|
-
<fx-select class="rows-sel" size="sm" value="${this.rowsPerPage}" aria-label="Itens por página">${this.getAttr("rows-options","5,10,20,50").split(",").map(u=>u.trim()).map(u=>`<option value="${
|
|
1256
|
+
<label class="info">${h("Por página:")}
|
|
1257
|
+
<fx-select class="rows-sel" size="sm" value="${this.rowsPerPage}" aria-label="Itens por página">${this.getAttr("rows-options","5,10,20,50").split(",").map(u=>u.trim()).map(u=>`<option value="${h(u)}">${h(u)}</option>`).join("")}</fx-select>
|
|
1235
1258
|
</label>
|
|
1236
|
-
</div>`:"",c=this.hasAttr("loading")?`<div class="loading-overlay" part="loading-overlay"><div class="tbl-spinner" part="spinner"></div><span class="loading-text">${
|
|
1259
|
+
</div>`:"",c=this.hasAttr("loading")?`<div class="loading-overlay" part="loading-overlay"><div class="tbl-spinner" part="spinner"></div><span class="loading-text">${h(this.getAttr("loading-message","Carregando…"))}</span></div>`:"";this.setTemplate(`
|
|
1237
1260
|
${s}
|
|
1238
1261
|
<div class="table-wrap">
|
|
1239
1262
|
<div class="scroll">
|
|
1240
1263
|
<table part="table">
|
|
1241
1264
|
<thead><tr>${n}</tr>${l}</thead>
|
|
1242
|
-
<tbody>${
|
|
1265
|
+
<tbody>${p}</tbody>
|
|
1243
1266
|
</table>
|
|
1244
1267
|
</div>
|
|
1245
1268
|
${c}
|
|
1246
1269
|
</div>
|
|
1247
1270
|
${f}
|
|
1248
|
-
`),this.root.querySelectorAll("th.sortable").forEach(u=>{u.addEventListener("click",()=>{const v=u.dataset.field;this.sortField===v?this.sortDir=this.sortDir===1?-1:1:(this.sortField=v,this.sortDir=1),this.render(),this.dispatchEvent(new CustomEvent("sort-change",{bubbles:!0,composed:!0,detail:{field:this.sortField,direction:this.sortDir===1?"asc":"desc",lazy:this.lazy}}))})}),this.root.querySelectorAll(".filter").forEach(u=>{u.addEventListener("input",()=>{const v=u.dataset.field,y=u.value,S=u.selectionStart;this.filters[v]=y,this.page=0,this.render(),this.dispatchEvent(new CustomEvent("filter-change",{bubbles:!0,composed:!0,detail:{field:v,value:y,lazy:this.lazy}}));const A=this.root.querySelector(`.filter[data-field="${
|
|
1271
|
+
`),this.root.querySelectorAll("th.sortable").forEach(u=>{u.addEventListener("click",()=>{const v=u.dataset.field;this.sortField===v?this.sortDir=this.sortDir===1?-1:1:(this.sortField=v,this.sortDir=1),this.render(),this.dispatchEvent(new CustomEvent("sort-change",{bubbles:!0,composed:!0,detail:{field:this.sortField,direction:this.sortDir===1?"asc":"desc",lazy:this.lazy}}))})}),this.root.querySelectorAll(".filter").forEach(u=>{u.addEventListener("input",()=>{const v=u.dataset.field,y=u.value,S=u.selectionStart;this.filters[v]=y,this.page=0,this.render(),this.dispatchEvent(new CustomEvent("filter-change",{bubbles:!0,composed:!0,detail:{field:v,value:y,lazy:this.lazy}}));const A=this.root.querySelector(`.filter[data-field="${h(v)}"]`);A&&(A.focus(),A.setSelectionRange(S,S))}),u.addEventListener("click",v=>v.stopPropagation())}),this.root.querySelectorAll("[data-search-fields]").forEach(u=>{u.addEventListener("input",()=>{this.globalSearch=u.value,this.page=0;const v=u.selectionStart;this.render();const y=this.root.querySelector("[data-search-fields]");y&&(y.focus(),y.setSelectionRange(v,v))})}),this.root.querySelectorAll(".pg-btn").forEach(u=>{u.addEventListener("click",()=>{const v=u.dataset.pg;this.page=v==="first"?0:v==="prev"?Math.max(0,this.page-1):v==="next"?Math.min(o-1,this.page+1):v==="last"?o-1:Number(v),this.render(),this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,composed:!0,detail:{page:this.page+1,pages:o,rowsPerPage:this.rowsPerPage,total:r,lazy:this.lazy}}))})}),(g=this.root.querySelector("fx-select.rows-sel"))==null||g.addEventListener("change",u=>{var y;const v=Number((y=u.detail)==null?void 0:y.value);!v||v===this.rowsPerPage||(this.rowsPerPage=v,this.page=0,this.render())}),this.root.querySelectorAll("tbody tr[data-index]").forEach(u=>{u.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("row-click",{bubbles:!0,composed:!0,detail:{row:t[Number(u.dataset.index)],index:Number(u.dataset.index)}}))})}),this._restoreToolbarSearch()}_restoreToolbarSearch(){const e=this.root.querySelector("[data-search-fields]");e&&this.globalSearch&&(e.value=this.globalSearch)}};Ke.styles=m`
|
|
1249
1272
|
:host {
|
|
1250
1273
|
display: block;
|
|
1251
1274
|
font-family: var(--fx-font-family);
|
|
@@ -1447,7 +1470,7 @@
|
|
|
1447
1470
|
color: var(--fx-text-muted);
|
|
1448
1471
|
font-size: calc(var(--fx-font-size) - 1px);
|
|
1449
1472
|
}
|
|
1450
|
-
`;let J=
|
|
1473
|
+
`;let J=Ke;function nr(){return x("fx-table",J)}nr();const Ye=class Ye extends b{constructor(){super(...arguments),this.targetControl=null,this.observer=null,this.listenersReady=!1}static get observedAttributes(){return["variant","error","invalid","success","valid","full","icon","icon-pos"]}render(){var s;const e=this.findControl(),r=this.findLabel(),a=r?(s=r.textContent)==null?void 0:s.replace(/\s+/g," ").trim():"",o=r&&r.getAttribute("for")||"",i=this.getAttribute("variant")==="over";this.setTemplate(`
|
|
1451
1474
|
<div class="wrapper" part="wrapper">
|
|
1452
1475
|
${i?`<label class="flabel" part="label" for="${o}">${a}</label>`:""}
|
|
1453
1476
|
<div class="field-box" part="field">
|
|
@@ -1590,13 +1613,17 @@
|
|
|
1590
1613
|
display: block;
|
|
1591
1614
|
}
|
|
1592
1615
|
`;let W=Ye;function lr(){return x("fx-floatlabel",W)}lr();const Xe=class Xe extends b{static get observedAttributes(){return["size","placeholder","disabled","readonly","rows","maxlength","error","invalid","success","valid"]}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}render(){const e=this.getAttr("placeholder"),t=this.hasAttr("readonly"),r=this.hasAttr("disabled"),a=this.getAttr("rows"),o=this.getAttr("maxlength");this.setTemplate(`<textarea class="field" part="textarea"
|
|
1593
|
-
${e?`placeholder="${
|
|
1594
|
-
${a?`rows="${
|
|
1595
|
-
${o?`maxlength="${
|
|
1616
|
+
${e?`placeholder="${h(e)}"`:""}
|
|
1617
|
+
${a?`rows="${h(a)}"`:""}
|
|
1618
|
+
${o?`maxlength="${h(o)}"`:""}
|
|
1596
1619
|
></textarea>`);const i=this.root.querySelector(".field");if(!i)return;i.value=this.getAttr("value"),r&&i.setAttribute("disabled",""),t&&i.setAttribute("readonly","");const s=n=>{this.value=i.value,this.dispatchEvent(new CustomEvent(n,{bubbles:!0,composed:!0,detail:{value:i.value}}))};i.addEventListener("input",n=>{n.stopPropagation(),s("input")}),i.addEventListener("change",n=>{n.stopPropagation(),s("change")})}};Xe.styles=m`
|
|
1597
1620
|
:host {
|
|
1598
1621
|
display: inline-block;
|
|
1599
1622
|
vertical-align: middle;
|
|
1623
|
+
/* Largura padrão no HOST: CSS externo, classes e style inline no elemento
|
|
1624
|
+
vencem este default naturalmente (regras do documento > :host). */
|
|
1625
|
+
width: var(--fx-textarea-width, 260px);
|
|
1626
|
+
vertical-align: middle;
|
|
1600
1627
|
font-family: var(--fx-font-family);
|
|
1601
1628
|
font-size: var(--fx-font-size);
|
|
1602
1629
|
}
|
|
@@ -1609,7 +1636,8 @@
|
|
|
1609
1636
|
border: 1px solid var(--fx-border-default);
|
|
1610
1637
|
border-radius: var(--fx-radius-md);
|
|
1611
1638
|
padding: var(--fx-space-md) var(--fx-space-lg);
|
|
1612
|
-
|
|
1639
|
+
/* Acompanha a largura definida no :host. */
|
|
1640
|
+
width: 100%;
|
|
1613
1641
|
min-height: calc(var(--fx-size-md) + 40px);
|
|
1614
1642
|
resize: vertical;
|
|
1615
1643
|
box-sizing: border-box;
|
|
@@ -1638,16 +1666,18 @@
|
|
|
1638
1666
|
border-color: var(--fx-color-success, #16a34a);
|
|
1639
1667
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-color-success, #16a34a) 18%, transparent);
|
|
1640
1668
|
}
|
|
1641
|
-
:host([size='sm'])
|
|
1642
|
-
:host([size='
|
|
1669
|
+
:host([size='sm']) { width: var(--fx-textarea-width-sm, 220px); }
|
|
1670
|
+
:host([size='sm']) .field { min-height: var(--fx-size-sm); padding: var(--fx-space-sm) var(--fx-space-md); }
|
|
1671
|
+
:host([size='lg']) { width: var(--fx-textarea-width-lg, 300px); }
|
|
1672
|
+
:host([size='lg']) .field { min-height: calc(var(--fx-size-lg) + 80px); }
|
|
1643
1673
|
/* Full width: o host estica até o pai e o campo interno acompanha. */
|
|
1644
1674
|
:host([full]) { display: block; width: 100%; }
|
|
1645
1675
|
:host([full]) .field { width: 100%; }
|
|
1646
1676
|
`;let G=Xe;function cr(){return x("fx-textarea",G)}cr();const Ue=class Ue extends b{constructor(){super(...arguments),this._previouslyFocused=null}static get observedAttributes(){return["open","size","heading"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){var s;const e=this.open,t=this.getAttr("heading");if(this.setTemplate(`
|
|
1647
1677
|
<div class="overlay" part="overlay" ${e?"":"hidden"}>
|
|
1648
|
-
<div class="dialog" role="dialog" aria-modal="true" aria-label="${
|
|
1678
|
+
<div class="dialog" role="dialog" aria-modal="true" aria-label="${h(t)}" tabindex="-1">
|
|
1649
1679
|
<header>
|
|
1650
|
-
<h2>${
|
|
1680
|
+
<h2>${h(t)}</h2>
|
|
1651
1681
|
<button type="button" class="close" part="close" aria-label="Fechar">×</button>
|
|
1652
1682
|
</header>
|
|
1653
1683
|
<div class="body"><slot></slot></div>
|
|
@@ -1731,22 +1761,22 @@
|
|
|
1731
1761
|
gap: var(--fx-space-sm);
|
|
1732
1762
|
}
|
|
1733
1763
|
footer[hidden] { display: none; }
|
|
1734
|
-
`;let Z=Ue;function dr(){return x("fx-dialog",Z)}dr();const Je=class Je extends b{constructor(){super(...arguments),this._previouslyFocused=null,this._onReposition=()=>{if(!this.open)return;const e=this.root.querySelector(".popup");e&&!e.hidden&&this._position(e)}}static get observedAttributes(){return["open","target","message","icon","accept-label","reject-label","position"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){var
|
|
1764
|
+
`;let Z=Ue;function dr(){return x("fx-dialog",Z)}dr();const Je=class Je extends b{constructor(){super(...arguments),this._previouslyFocused=null,this._onReposition=()=>{if(!this.open)return;const e=this.root.querySelector(".popup");e&&!e.hidden&&this._position(e)}}static get observedAttributes(){return["open","target","message","icon","accept-label","reject-label","position"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){var p,f,_;const e=this.getAttr("message"),t=this.getAttr("icon"),r=q(t);r&&Promise.resolve().then(()=>M);const a=this.getAttr("accept-label","Sim"),o=this.getAttr("reject-label","Não");if(this.setTemplate(`
|
|
1735
1765
|
<div class="popup" part="popup" role="alertdialog" aria-modal="false" ${this.open?"":"hidden"}>
|
|
1736
1766
|
<div class="message" part="message">
|
|
1737
|
-
${t?`<span class="icon${r?" fx-icon":""}" aria-hidden="true">${
|
|
1738
|
-
<p class="text"><slot>${
|
|
1767
|
+
${t?`<span class="icon${r?" fx-icon":""}" aria-hidden="true">${h(t)}</span>`:""}
|
|
1768
|
+
<p class="text"><slot>${h(e)}</slot></p>
|
|
1739
1769
|
</div>
|
|
1740
1770
|
<footer part="footer">
|
|
1741
1771
|
<slot name="reject">
|
|
1742
|
-
<button type="button" class="reject" part="reject-button">${
|
|
1772
|
+
<button type="button" class="reject" part="reject-button">${h(o)}</button>
|
|
1743
1773
|
</slot>
|
|
1744
1774
|
<slot name="accept">
|
|
1745
|
-
<button type="button" class="accept" part="accept-button">${
|
|
1775
|
+
<button type="button" class="accept" part="accept-button">${h(a)}</button>
|
|
1746
1776
|
</slot>
|
|
1747
1777
|
</footer>
|
|
1748
1778
|
</div>
|
|
1749
|
-
`),!this.open)return;const i=this.root.querySelector(".popup");if(!i)return;(
|
|
1779
|
+
`),!this.open)return;const i=this.root.querySelector(".popup");if(!i)return;(p=this._cleanup)==null||p.call(this),this._cleanup=void 0;const s=c=>{var g;this.open=!1,(g=this._cleanup)==null||g.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent(c,{bubbles:!0,composed:!0}))};(f=this.root.querySelector(".reject"))==null||f.addEventListener("click",()=>s("reject")),(_=this.root.querySelector(".accept"))==null||_.addEventListener("click",()=>s("accept"));const n=c=>{c.key==="Escape"&&(c.stopPropagation(),s("reject"))},l=c=>{const g=c.composedPath(),u=this._anchor(),v=u?g.includes(u):!1;!g.includes(i)&&!v&&s("reject")};document.addEventListener("keydown",n),document.addEventListener("pointerdown",l,!0),this._cleanup=()=>{document.removeEventListener("keydown",n),document.removeEventListener("pointerdown",l,!0)},this._position(i),this._previouslyFocused=document.activeElement,requestAnimationFrame(()=>{var c;(c=this.root.querySelector("button.accept"))==null||c.focus()})}_anchor(){const e=this.getAttr("target");if(!e)return null;try{return document.querySelector(e)}catch(t){return null}}_position(e){const t=this._anchor();if(!t)return;e.hidden=!1;const r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),o=8,i=8;let s;const n=this.getAttr("position","auto");n==="top"?s="top":n==="bottom"?s="bottom":s=r.bottom+o+a.height<=window.innerHeight-i?"bottom":"top";const l=Math.min(Math.max(i,r.left+r.width/2-a.width/2),window.innerWidth-a.width-i),p=s==="bottom"?r.bottom+o:r.top-o-a.height;e.dataset.side=s,e.style.left=`${Math.round(l)}px`,e.style.top=`${Math.round(Math.max(i,p))}px`;const f=Math.min(Math.max(r.left+r.width/2-l,16),a.width-16);e.style.setProperty("--fxcp-arrow-x",`${Math.round(f)}px`)}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition)}disconnectedCallback(){var e;super.disconnectedCallback(),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),(e=this._cleanup)==null||e.call(this),this._cleanup=void 0,this._restoreFocus()}};Je.styles=m`
|
|
1750
1780
|
:host { display: contents; }
|
|
1751
1781
|
.popup {
|
|
1752
1782
|
position: fixed;
|
|
@@ -1828,16 +1858,16 @@
|
|
|
1828
1858
|
color: #fff;
|
|
1829
1859
|
}
|
|
1830
1860
|
footer button.accept:hover { filter: brightness(0.92); background: var(--fx-color-primary); }
|
|
1831
|
-
`;let Q=Je;function
|
|
1832
|
-
${t?`<div class="drop" part="dropzone" role="button" tabindex="0" aria-label="${
|
|
1861
|
+
`;let Q=Je;function hr(){return x("fx-confirmpopup",Q)}hr();const We=class We extends b{constructor(){super(...arguments),this._files=[],this._done=!1}static get observedAttributes(){return["mode","size","severity","label","icon","accept","multiple","disabled","show-progress","progress","value","full"]}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get progress(){return Math.min(100,Math.max(0,Number(this.getAttr("progress","0"))||0))}set progress(e){this.setAttribute("progress",String(e))}get files(){return this._files}set files(e){this._files=Array.from(e),this.value=this._files.map(t=>t.name).join(", "),this._syncFilesArea()}render(){const t=this.getAttr("mode","basic")==="advanced",r=this.getAttr("label","Escolher arquivo"),a=this.getAttr("icon"),o=this.getAttr("accept"),i=this.hasAttr("multiple"),s=this.hasAttr("disabled"),n=this.hasAttr("show-progress"),l=this.progress,p=`<input type="file" class="picker" ${o?`accept="${h(o)}"`:""} ${i?"multiple":""} ${s?"disabled":""} />`;this.setTemplate(`
|
|
1862
|
+
${t?`<div class="drop" part="dropzone" role="button" tabindex="0" aria-label="${h(r)}">
|
|
1833
1863
|
${a?`<span class="icon" part="icon" aria-hidden="true">${C(a)}</span>`:""}
|
|
1834
|
-
<span>${
|
|
1864
|
+
<span>${h(r)}</span>
|
|
1835
1865
|
<span class="hint">ou arraste e solte aqui</span>
|
|
1836
1866
|
</div>`:`<button type="button" class="btn" part="button">
|
|
1837
1867
|
${a?`<span class="icon" part="icon" aria-hidden="true">${C(a)}</span>`:""}
|
|
1838
|
-
<span>${
|
|
1868
|
+
<span>${h(r)}</span>
|
|
1839
1869
|
</button>`}
|
|
1840
|
-
${
|
|
1870
|
+
${p}
|
|
1841
1871
|
<div class="files" part="files"></div>
|
|
1842
1872
|
${n?`
|
|
1843
1873
|
<div class="progress-row" part="progress">
|
|
@@ -1848,9 +1878,9 @@
|
|
|
1848
1878
|
</div>`:""}
|
|
1849
1879
|
`),this._bindPicker(),this._syncFilesArea(),!this._done&&n&&l>=100&&this._files.length&&(this._done=!0,this.dispatchEvent(new CustomEvent("complete",{bubbles:!0,composed:!0}))),l<100&&(this._done=!1)}_picker(){return this.root.querySelector(".picker")}_bindPicker(){var a;const e=this._picker();if(!e)return;const t=(a=this.root.querySelector(".btn"))!=null?a:this.root.querySelector(".drop");t==null||t.addEventListener("click",()=>e.click()),t==null||t.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),e.click())}),e.addEventListener("change",()=>{var o;return this._acceptFiles((o=e.files)!=null?o:[])});const r=this.root.querySelector(".drop");r&&(r.addEventListener("dragover",o=>{o.preventDefault(),r.classList.add("over")}),r.addEventListener("dragleave",()=>r.classList.remove("over")),r.addEventListener("drop",o=>{var i;o.preventDefault(),r.classList.remove("over"),(i=o.dataTransfer)!=null&&i.files.length&&this._acceptFiles(o.dataTransfer.files)}))}_acceptFiles(e){const t=this.hasAttr("multiple")?Array.from(e):[e[0]].filter(Boolean);this.files=t;const r=this._picker();r&&(r.value=""),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{files:t}}))}_fmtSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}_syncFilesArea(){var t,r;const e=(r=(t=this.root)==null?void 0:t.querySelector)==null?void 0:r.call(t,".files");e&&(e.innerHTML=this._files.map((a,o)=>`
|
|
1850
1880
|
<div class="file" part="file">
|
|
1851
|
-
<span class="name">${
|
|
1881
|
+
<span class="name">${h(a.name)}</span>
|
|
1852
1882
|
<span class="size">${this._fmtSize(a.size)}</span>
|
|
1853
|
-
<button type="button" class="remove" data-i="${o}" part="remove" aria-label="Remover ${
|
|
1883
|
+
<button type="button" class="remove" data-i="${o}" part="remove" aria-label="Remover ${h(a.name)}">×</button>
|
|
1854
1884
|
</div>`).join(""),e.querySelectorAll(".remove").forEach(a=>a.addEventListener("click",()=>{const o=this._files.splice(Number(a.dataset.i),1)[0];this.value=this._files.map(i=>i.name).join(", "),this.progress=0,this._syncFilesArea(),this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,composed:!0,detail:{file:o}}))})))}};We.styles=m`
|
|
1855
1885
|
:host {
|
|
1856
1886
|
display: inline-block;
|
|
@@ -1866,6 +1896,9 @@
|
|
|
1866
1896
|
align-items: center;
|
|
1867
1897
|
justify-content: center;
|
|
1868
1898
|
gap: var(--fx-space-sm);
|
|
1899
|
+
/* Largura acompanha o host: CSS externo/classe/inline no elemento esticam
|
|
1900
|
+
o botão sem precisar do full (host é shrink-to-fit por padrão). */
|
|
1901
|
+
width: 100%;
|
|
1869
1902
|
min-height: var(--fx-size-md);
|
|
1870
1903
|
padding: var(--fx-space-md) var(--fx-space-lg);
|
|
1871
1904
|
font-family: inherit;
|
|
@@ -1909,6 +1942,8 @@
|
|
|
1909
1942
|
align-items: center;
|
|
1910
1943
|
justify-content: center;
|
|
1911
1944
|
gap: var(--fx-space-sm);
|
|
1945
|
+
/* Acompanha a largura do host (definida por CSS externo/classe/inline). */
|
|
1946
|
+
width: 100%;
|
|
1912
1947
|
min-height: 100px;
|
|
1913
1948
|
padding: var(--fx-space-lg);
|
|
1914
1949
|
border: 2px dashed var(--fx-border-default);
|
|
@@ -1984,7 +2019,7 @@
|
|
|
1984
2019
|
:host([full]) .drop { width: 100%; }
|
|
1985
2020
|
/* Base dos glifos Fenix Icons (o @font-face vem de @wrrdev/fenix-ui/icons). */
|
|
1986
2021
|
${E}
|
|
1987
|
-
`;let ee=We;function
|
|
2022
|
+
`;let ee=We;function pr(){return x("fx-fileupload",ee)}pr();const Ge=class Ge extends b{constructor(){super(...arguments),this._dragging=!1}static get observedAttributes(){return["min","max","step","size","disabled","show-value","label"]}get min(){return this._num("min",0)}get max(){return this._num("max",100)}get step(){return this._num("step",1)}get value(){return this._clamp(this._num("value",this.min))}set value(e){const t=this._snap(e);this.setAttribute("value",String(t)),this.isConnected&&this._syncVisual()}_num(e,t){const r=this.getAttribute(e);if(r===null||r==="")return t;const a=Number(r);return Number.isFinite(a)?a:t}_clamp(e){return Math.min(this.max,Math.max(this.min,e))}_snap(e){const t=this.step||1,r=Math.round((this._clamp(e)-this.min)/t)*t+this.min;return Number(this._clamp(r).toFixed(10))}_pct(){const e=this.max-this.min;return e<=0?0:(this.value-this.min)/e*100}render(){const e=this._pct(),t=this.getAttr("label"),r=this.hasAttr("show-value");this.setTemplate(`
|
|
1988
2023
|
${t?`<div class="label" part="label"><span>${t}</span>${r?`<span>${this.value}</span>`:""}</div>`:""}
|
|
1989
2024
|
<div class="track-wrap" part="track" tabindex="0" role="slider"
|
|
1990
2025
|
aria-valuemin="${this.min}" aria-valuemax="${this.max}" aria-valuenow="${this.value}"
|
|
@@ -2144,8 +2179,8 @@
|
|
|
2144
2179
|
.remove:hover { background: rgba(0, 0, 0, 0.18); }
|
|
2145
2180
|
.remove[hidden] { display: none; }
|
|
2146
2181
|
`;let re=Ze;function fr(){return x("fx-chip",re)}fr();const Qe=class Qe extends b{static get observedAttributes(){return["size","shape","variant","src","alt"]}get variant(){return this.getAttr("variant","text")}get src(){return this.getAttr("src")}set src(e){this.setAttribute("src",e)}render(){const e=this.variant,t=this.getAttr("src"),r=this.getAttr("alt",""),a=e==="icon",o=e==="image"&&t;this.setTemplate(`
|
|
2147
|
-
<span class="avatar${o?" image":a?" icon-slot":" text"}" part="avatar" aria-label="${
|
|
2148
|
-
${o?`<img src="${
|
|
2182
|
+
<span class="avatar${o?" image":a?" icon-slot":" text"}" part="avatar" aria-label="${h(r)}" role="img">
|
|
2183
|
+
${o?`<img src="${h(t)}" alt="${h(r)}">`:a?'<slot name="icon" class="slot-icon"></slot>':"<slot></slot>"}
|
|
2149
2184
|
</span>
|
|
2150
2185
|
`)}};Qe.styles=m`
|
|
2151
2186
|
:host {
|
|
@@ -2198,9 +2233,9 @@
|
|
|
2198
2233
|
}
|
|
2199
2234
|
:host(.avatar-group) > .avatar:last-child { margin-left: 0; }
|
|
2200
2235
|
:host(.avatar-group) > .avatar:hover { z-index: 2; }
|
|
2201
|
-
`;let ae=Qe;function _r(){return x("fx-avatar",ae)}_r();const et=class et extends b{static get observedAttributes(){return["variant","size","padded","heading"]}render(){const e=this.getAttr("heading");this.setTemplate(`
|
|
2236
|
+
`;let ae=Qe;function _r(){return x("fx-avatar",ae)}_r();const et=class et extends b{static get observedAttributes(){return["variant","radius","size","padded","heading"]}render(){const e=this.getAttr("heading");this.setTemplate(`
|
|
2202
2237
|
<div class="card" part="card">
|
|
2203
|
-
<header part="header" ${e?"":"hidden"}>${
|
|
2238
|
+
<header part="header" ${e?"":"hidden"}>${h(e)}<slot name="header"></slot></header>
|
|
2204
2239
|
<div class="body" part="content"><slot></slot></div>
|
|
2205
2240
|
<footer part="footer"><slot name="footer"></slot></footer>
|
|
2206
2241
|
</div>
|
|
@@ -2228,8 +2263,11 @@
|
|
|
2228
2263
|
:host([variant='outline']) .card { box-shadow: none; border-style: solid; border-width: 1px; }
|
|
2229
2264
|
:host([variant='ghost']) .card { box-shadow: none; border-color: transparent; background: transparent; }
|
|
2230
2265
|
|
|
2231
|
-
/*
|
|
2266
|
+
/* Raio do container: radius (nome atual) — size continua aceito
|
|
2267
|
+
como alias legado para não quebrar quem já usava o atributo. */
|
|
2268
|
+
:host([radius='sm']) .card,
|
|
2232
2269
|
:host([size='sm']) .card { border-radius: var(--fx-radius-sm); }
|
|
2270
|
+
:host([radius='lg']) .card,
|
|
2233
2271
|
:host([size='lg']) .card { border-radius: var(--fx-radius-xl); }
|
|
2234
2272
|
|
|
2235
2273
|
header {
|
|
@@ -2256,7 +2294,7 @@
|
|
|
2256
2294
|
}
|
|
2257
2295
|
footer[hidden] { display: none; }
|
|
2258
2296
|
`;let oe=et;function mr(){return x("fx-card",oe)}mr();const tt=class tt extends b{constructor(){super(...arguments),this._items=[]}static get observedAttributes(){return["size","separator","label"]}render(){const e=this.getAttr("label","Breadcrumb");this.setTemplate(`
|
|
2259
|
-
<nav part="nav" aria-label="${
|
|
2297
|
+
<nav part="nav" aria-label="${h(e)}"></nav>
|
|
2260
2298
|
`),this._decorateItems()}_decorateItems(){var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("nav");if(!e)return;const t=this.getAttr("separator","/");this._items.length===0&&(this._items=Array.from(this.children).filter(a=>a.matches('[slot="item"]'))),e.innerHTML="",this._items.forEach((a,o)=>{const i=o===this._items.length-1;if(a.setAttribute("aria-current",i?"page":"false"),e.appendChild(a),i)return;const s=document.createElement("span");s.className="sep",s.setAttribute("part","separator"),s.setAttribute("aria-hidden","true"),s.textContent=t,e.appendChild(s)})}connectedCallback(){super.connectedCallback();const e=new MutationObserver(()=>{this.children.length>0&&(e.disconnect(),this._decorateItems())});e.observe(this,{childList:!0}),this.children.length>0&&this._decorateItems()}disconnectedCallback(){super.disconnectedCallback(),this._items=[]}};tt.styles=m`
|
|
2261
2299
|
:host {
|
|
2262
2300
|
display: block;
|
|
@@ -2302,7 +2340,7 @@
|
|
|
2302
2340
|
<div class="body" part="content"><slot></slot></div>
|
|
2303
2341
|
<footer part="footer" hidden><slot name="footer"></slot></footer>
|
|
2304
2342
|
</div>
|
|
2305
|
-
`),!this.open)return;const e=this.root.querySelector(".popup");if(!e)return;(o=this._cleanup)==null||o.call(this),this._cleanup=void 0;const t=()=>{var i;this.open=!1,(i=this._cleanup)==null||i.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0}))},r=i=>{i.key==="Escape"&&(i.stopPropagation(),t())},a=i=>{if(!this.hasAttr("dismissible"))return;const s=i.composedPath(),n=this._anchor(),l=n?s.includes(n):!1;!s.includes(e)&&!l&&t()};document.addEventListener("keydown",r),document.addEventListener("pointerdown",a,!0),this._cleanup=()=>{document.removeEventListener("keydown",r),document.removeEventListener("pointerdown",a,!0)},this._syncSlots(),this._position(e),this._previouslyFocused=document.activeElement,requestAnimationFrame(()=>e.focus({preventScroll:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0}))}_anchor(){const e=this.getAttr("target");if(!e)return null;try{return document.querySelector(e)}catch(t){return null}}_syncSlots(){const e=this.root.querySelector('slot[name="header"]'),t=this.root.querySelector('slot[name="footer"]'),r=this.root.querySelector("header"),a=this.root.querySelector("footer"),o=!!e&&e.assignedNodes().length>0,i=!!t&&t.assignedNodes().length>0;r==null||r.toggleAttribute("hidden",!o),a==null||a.toggleAttribute("hidden",!i)}_position(e){const t=this._anchor();if(!t)return;e.hidden=!1;const r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),o=8,i=8;let s;const n=this.getAttr("position","auto");n==="top"?s="top":n==="bottom"?s="bottom":s=r.bottom+o+a.height<=window.innerHeight-i?"bottom":"top",s==="top"&&r.top-o-a.height<i&&r.bottom+o+a.height<=window.innerHeight-i?s="bottom":s==="bottom"&&r.bottom+o+a.height>window.innerHeight-i&&r.top-o-a.height>=i&&(s="top");const l=Math.min(Math.max(i,r.left+r.width/2-a.width/2),window.innerWidth-a.width-i),
|
|
2343
|
+
`),!this.open)return;const e=this.root.querySelector(".popup");if(!e)return;(o=this._cleanup)==null||o.call(this),this._cleanup=void 0;const t=()=>{var i;this.open=!1,(i=this._cleanup)==null||i.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0}))},r=i=>{i.key==="Escape"&&(i.stopPropagation(),t())},a=i=>{if(!this.hasAttr("dismissible"))return;const s=i.composedPath(),n=this._anchor(),l=n?s.includes(n):!1;!s.includes(e)&&!l&&t()};document.addEventListener("keydown",r),document.addEventListener("pointerdown",a,!0),this._cleanup=()=>{document.removeEventListener("keydown",r),document.removeEventListener("pointerdown",a,!0)},this._syncSlots(),this._position(e),this._previouslyFocused=document.activeElement,requestAnimationFrame(()=>e.focus({preventScroll:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0}))}_anchor(){const e=this.getAttr("target");if(!e)return null;try{return document.querySelector(e)}catch(t){return null}}_syncSlots(){const e=this.root.querySelector('slot[name="header"]'),t=this.root.querySelector('slot[name="footer"]'),r=this.root.querySelector("header"),a=this.root.querySelector("footer"),o=!!e&&e.assignedNodes().length>0,i=!!t&&t.assignedNodes().length>0;r==null||r.toggleAttribute("hidden",!o),a==null||a.toggleAttribute("hidden",!i)}_position(e){const t=this._anchor();if(!t)return;e.hidden=!1;const r=t.getBoundingClientRect(),a=e.getBoundingClientRect(),o=8,i=8;let s;const n=this.getAttr("position","auto");n==="top"?s="top":n==="bottom"?s="bottom":s=r.bottom+o+a.height<=window.innerHeight-i?"bottom":"top",s==="top"&&r.top-o-a.height<i&&r.bottom+o+a.height<=window.innerHeight-i?s="bottom":s==="bottom"&&r.bottom+o+a.height>window.innerHeight-i&&r.top-o-a.height>=i&&(s="top");const l=Math.min(Math.max(i,r.left+r.width/2-a.width/2),window.innerWidth-a.width-i),p=s==="bottom"?r.bottom+o:r.top-o-a.height;e.dataset.side=s,e.style.left=`${Math.round(l)}px`,e.style.top=`${Math.round(Math.max(i,p))}px`;const f=Math.min(Math.max(r.left+r.width/2-l,16),a.width-16);e.style.setProperty("--fxpp-arrow-x",`${Math.round(f)}px`)}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition),this._bindTrigger()}disconnectedCallback(){var e,t;super.disconnectedCallback(),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),(e=this._triggerCleanup)==null||e.call(this),this._triggerCleanup=void 0,(t=this._cleanup)==null||t.call(this),this._cleanup=void 0,this._restoreFocus()}_bindTrigger(){const e=this._anchor();if(!e)return;this.getAttr("trigger","click")==="hover"?(e.addEventListener("mouseenter",this._onEnter),e.addEventListener("mouseleave",this._onLeave),this._triggerCleanup=()=>{e.removeEventListener("mouseenter",this._onEnter),e.removeEventListener("mouseleave",this._onLeave)}):(e.addEventListener("pointerdown",this._onClick),this._triggerCleanup=()=>e.removeEventListener("pointerdown",this._onClick))}};rt.styles=m`
|
|
2306
2344
|
:host { display: contents; }
|
|
2307
2345
|
.popup {
|
|
2308
2346
|
position: fixed;
|
|
@@ -2361,7 +2399,7 @@
|
|
|
2361
2399
|
gap: var(--fx-space-sm);
|
|
2362
2400
|
}
|
|
2363
2401
|
footer[hidden] { display: none; }
|
|
2364
|
-
`;let se=rt;function br(){return x("fx-popover",se)}br();const at=class at extends b{constructor(){super(...arguments),this._titles=[],this._panels=[]}static get observedAttributes(){return["active","linear","show-numbers"]}get stepCount(){return this._titles.length}get active(){const e=Number(this.getAttr("active","0"));return Math.min(this.stepCount-1,Math.max(0,Number.isFinite(e)?e:0))}set active(e){this.setAttribute("active",String(Math.min(this.stepCount-1,Math.max(0,e))))}get isLast(){return this.active>=this.stepCount-1}goTo(e){const t=Math.min(this.stepCount-1,Math.max(0,e));this.hasAttr("linear")&&t>this.active+1||(this.active=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:this.active}})),this.isLast&&this.dispatchEvent(new CustomEvent("complete",{bubbles:!0,composed:!0})))}next(){this.goTo(this.active+1)}prev(){this.goTo(this.active-1)}render(){this._panels=Array.from(this.children).filter(a=>a.matches('[slot^="step-"]')),this._titles=this._panels.map((a,o)=>a.getAttribute("step-title")||`Paso ${o+1}`);const e=Math.min(this.active,Math.max(0,this._titles.length-1)),t=this._titles.map((a,o)=>{const i=o===e?"active":o<e?"done":"",s=o<e&&!this.hasAttr("show-numbers")?"✓":String(o+1);return`<span class="step ${i}" part="step" data-i="${o}"><span class="num">${s}</span>${
|
|
2402
|
+
`;let se=rt;function br(){return x("fx-popover",se)}br();const at=class at extends b{constructor(){super(...arguments),this._titles=[],this._panels=[]}static get observedAttributes(){return["active","linear","show-numbers"]}get stepCount(){return this._titles.length}get active(){const e=Number(this.getAttr("active","0"));return Math.min(this.stepCount-1,Math.max(0,Number.isFinite(e)?e:0))}set active(e){this.setAttribute("active",String(Math.min(this.stepCount-1,Math.max(0,e))))}get isLast(){return this.active>=this.stepCount-1}goTo(e){const t=Math.min(this.stepCount-1,Math.max(0,e));this.hasAttr("linear")&&t>this.active+1||(this.active=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:this.active}})),this.isLast&&this.dispatchEvent(new CustomEvent("complete",{bubbles:!0,composed:!0})))}next(){this.goTo(this.active+1)}prev(){this.goTo(this.active-1)}render(){this._panels=Array.from(this.children).filter(a=>a.matches('[slot^="step-"]')),this._titles=this._panels.map((a,o)=>a.getAttribute("step-title")||`Paso ${o+1}`);const e=Math.min(this.active,Math.max(0,this._titles.length-1)),t=this._titles.map((a,o)=>{const i=o===e?"active":o<e?"done":"",s=o<e&&!this.hasAttr("show-numbers")?"✓":String(o+1);return`<span class="step ${i}" part="step" data-i="${o}"><span class="num">${s}</span>${h(a)}</span>`}).join(""),r=this._panels.map((a,o)=>`<section class="panel" part="panel" ${o===e?"":"hidden"}>${a.innerHTML}</section>`).join("");this.setTemplate(`
|
|
2365
2403
|
<div class="steps" part="steps">${t}</div>
|
|
2366
2404
|
<div class="panel-wrap">${r}</div>
|
|
2367
2405
|
<div class="actions" part="actions">
|
|
@@ -2470,18 +2508,18 @@
|
|
|
2470
2508
|
.star[hidden] { display: none; }
|
|
2471
2509
|
.star.filled { color: var(--fx-color-warning); }
|
|
2472
2510
|
.star.hovered { color: var(--fx-color-warning); }
|
|
2473
|
-
`;let le=ot;function xr(){return x("fx-rating",le)}xr();const it=class it extends b{constructor(){super(...arguments),this._onOutside=e=>{const t=e.composedPath();this.root.querySelectorAll(".dropdown.open").forEach(r=>{t.includes(r)||r.classList.remove("open")})}}static get observedAttributes(){return["orientation","size","dense","titles"]}get orientation(){return this.getAttr("orientation","horizontal")}get items(){return Array.from(this.children).filter(e=>e.matches('[slot="item"]')).map(e=>e)}render(){const e=this.getAttr("titles"),t=e?e.split(",").map(o=>o.trim()):[],a=this.items.map((o,i)=>{var f;const s=t[i]||((f=o.textContent)==null?void 0:f.trim())||`Item ${i+1}`,n=o.matches("[submenu]"),l=o.hasAttribute("disabled"),
|
|
2511
|
+
`;let le=ot;function xr(){return x("fx-rating",le)}xr();const it=class it extends b{constructor(){super(...arguments),this._onOutside=e=>{const t=e.composedPath();this.root.querySelectorAll(".dropdown.open").forEach(r=>{t.includes(r)||r.classList.remove("open")})}}static get observedAttributes(){return["orientation","size","dense","titles"]}get orientation(){return this.getAttr("orientation","horizontal")}get items(){return Array.from(this.children).filter(e=>e.matches('[slot="item"]')).map(e=>e)}render(){const e=this.getAttr("titles"),t=e?e.split(",").map(o=>o.trim()):[],a=this.items.map((o,i)=>{var f;const s=t[i]||((f=o.textContent)==null?void 0:f.trim())||`Item ${i+1}`,n=o.matches("[submenu]"),l=o.hasAttribute("disabled"),p=`
|
|
2474
2512
|
<span class="item" part="item" data-i="${i}" ${l?'aria-disabled="true"':""}>
|
|
2475
|
-
${
|
|
2513
|
+
${h(s)}${n?'<span class="caret">▾</span>':""}
|
|
2476
2514
|
</span>`;return n?`
|
|
2477
2515
|
<span class="submenu-wrap" part="submenu-wrap">
|
|
2478
|
-
${
|
|
2516
|
+
${p}
|
|
2479
2517
|
<div class="dropdown" part="submenu"><slot name="submenu-${i}"></slot></div>
|
|
2480
|
-
</span>`:
|
|
2518
|
+
</span>`:p}).join("");this.setTemplate(`
|
|
2481
2519
|
<nav part="menu" aria-label="Menu">
|
|
2482
2520
|
${a}
|
|
2483
2521
|
</nav>
|
|
2484
|
-
`),this._bindItems()}_bindItems(){Array.from(this.root.querySelectorAll(".item")).forEach(t=>{const r=Number(t.dataset.i);t.addEventListener("click",()=>{var i,s,n,l;if(t.getAttribute("aria-disabled")==="true")return;const a=this.items[r];if(a==null?void 0:a.hasAttribute("submenu")){this.root.querySelectorAll(".dropdown.open").forEach(
|
|
2522
|
+
`),this._bindItems()}_bindItems(){Array.from(this.root.querySelectorAll(".item")).forEach(t=>{const r=Number(t.dataset.i);t.addEventListener("click",()=>{var i,s,n,l;if(t.getAttribute("aria-disabled")==="true")return;const a=this.items[r];if(a==null?void 0:a.hasAttribute("submenu")){this.root.querySelectorAll(".dropdown.open").forEach(p=>{var f;p!==((f=t.parentElement)==null?void 0:f.querySelector(".dropdown"))&&p.classList.remove("open")}),(s=(i=t.parentElement)==null?void 0:i.querySelector(".dropdown"))==null||s.classList.toggle("open");return}this._setActive(t),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{index:r,label:(l=(n=t.textContent)==null?void 0:n.trim())!=null?l:""}}))}),t.addEventListener("keydown",a=>{const o=a;(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t.click())})})}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onOutside)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this._onOutside)}_setActive(e){Array.from(this.root.querySelectorAll(".item")).forEach(t=>{t.classList.toggle("active",t===e)})}};it.styles=m`
|
|
2485
2523
|
:host { display: block; font-family: var(--fx-font-family); font-size: var(--fx-font-size); }
|
|
2486
2524
|
:host([orientation='vertical']) { border: 1px solid var(--fx-border-default); border-radius: var(--fx-radius-md); }
|
|
2487
2525
|
nav {
|
|
@@ -2532,7 +2570,7 @@
|
|
|
2532
2570
|
}
|
|
2533
2571
|
.dropdown.open { display: flex; }
|
|
2534
2572
|
:host([orientation='vertical']) .dropdown { left: 100%; top: 0; }
|
|
2535
|
-
`;let ce=it;function yr(){return x("fx-menu",ce)}yr();const st=class st extends b{static get observedAttributes(){return["multiple","size"]}get value(){const e=this.getAttr("value");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set value(e){this.setAttribute("value",e.join(","))}get multiple(){return this.hasAttr("multiple")}get options(){return Array.from(this.children).filter(e=>e.matches('[slot="option"]')).map(e=>e)}render(){const e=this.options,t=this.value,r=e.map((a,o)=>{var n,l;const i=(n=a.getAttribute("value"))!=null?n:"",s=t.includes(i);return`<button type="button" class="option ${s?"active":""}" part="option" data-v="${
|
|
2573
|
+
`;let ce=it;function yr(){return x("fx-menu",ce)}yr();const st=class st extends b{static get observedAttributes(){return["multiple","size"]}get value(){const e=this.getAttr("value");return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}set value(e){this.setAttribute("value",e.join(","))}get multiple(){return this.hasAttr("multiple")}get options(){return Array.from(this.children).filter(e=>e.matches('[slot="option"]')).map(e=>e)}render(){const e=this.options,t=this.value,r=e.map((a,o)=>{var n,l;const i=(n=a.getAttribute("value"))!=null?n:"",s=t.includes(i);return`<button type="button" class="option ${s?"active":""}" part="option" data-v="${h(i)}" aria-pressed="${s}">${h(((l=a.textContent)==null?void 0:l.trim())||`Opción ${o+1}`)}</button>`}).join("");this.setTemplate(`
|
|
2536
2574
|
<div class="options" part="options" role="group" aria-label="Toggle buttons">
|
|
2537
2575
|
${r}
|
|
2538
2576
|
</div>
|
|
@@ -2566,8 +2604,8 @@
|
|
|
2566
2604
|
`;let de=st;function wr(){return x("fx-toggle-button-group",de)}wr();const nt=class nt extends b{static get observedAttributes(){return["icon","heading","description"]}render(){const e=this.getAttr("icon","📭"),t=this.getAttr("heading"),r=this.getAttr("description");this.setTemplate(`
|
|
2567
2605
|
<div class="wrap" part="wrap">
|
|
2568
2606
|
<span class="icon" part="icon" aria-hidden="true">${C(e)}</span>
|
|
2569
|
-
<h4 part="heading" ${t?"":"hidden"}>${
|
|
2570
|
-
<p part="description" ${r?"":"hidden"}>${
|
|
2607
|
+
<h4 part="heading" ${t?"":"hidden"}>${h(t)}</h4>
|
|
2608
|
+
<p part="description" ${r?"":"hidden"}>${h(r)}</p>
|
|
2571
2609
|
<slot name="icon"></slot>
|
|
2572
2610
|
<span class="action"><slot name="action"></slot></span>
|
|
2573
2611
|
</div>
|
|
@@ -2611,7 +2649,7 @@
|
|
|
2611
2649
|
.action:empty { display: none; }
|
|
2612
2650
|
/* Base dos glifos Fenix Icons (o @font-face vem de @wrrdev/fenix-ui/icons). */
|
|
2613
2651
|
${E}
|
|
2614
|
-
`;let
|
|
2652
|
+
`;let he=nt;function kr(){return x("fx-empty-state",he)}kr();const lt=class lt extends b{constructor(){super(...arguments),this._prevScore=-1}static get observedAttributes(){return["value","label","size"]}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}_score(){const e=this.value;if(!e)return 0;let t=0;return e.length>=6&&t++,e.length>=10&&t++,/[A-Z]/.test(e)&&/[a-z]/.test(e)&&t++,/\d/.test(e)&&/[^A-Za-z0-9]/.test(e)&&t++,Math.min(4,t)}_labelFor(e){return["Muito fraca","Fraca","Razoável","Forte","Muito forte"][e]}render(){this._paint()}_paint(){const e=this._score(),t=this.getAttr("label","Força da senha");this.setTemplate(`
|
|
2615
2653
|
<div class="label" part="label">
|
|
2616
2654
|
<span>${t}</span>
|
|
2617
2655
|
<strong>${e>0?this._labelFor(e):""}</strong>
|
|
@@ -2654,7 +2692,7 @@
|
|
|
2654
2692
|
:host([data-score='2']) { --_color: var(--fx-color-warning); }
|
|
2655
2693
|
:host([data-score='3']) { --_color: var(--fx-color-info); }
|
|
2656
2694
|
:host([data-score='4']) { --_color: var(--fx-color-success); }
|
|
2657
|
-
`;let
|
|
2695
|
+
`;let pe=lt;function Ar(){return x("fx-password-strength",pe)}Ar();const ct=class ct extends b{static get observedAttributes(){return["marker","size","orientation"]}render(){this.setTemplate('<ol class="tl" part="timeline"></ol>'),this._decorate()}_decorate(){var a;const e=(a=this.shadowRoot)==null?void 0:a.querySelector("ol");if(!e)return;const t=this.getAttr("marker","●"),r=Array.from(this.querySelectorAll('[slot="item"]'));r.length&&(e.innerHTML=r.map(o=>{var f,_;const i=(f=o.getAttribute("time"))!=null?f:"",s=(_=o.getAttribute("title"))!=null?_:"",n=[i?`<span class="time">${h(i)}</span>`:"",s?`<span class="title">${h(s)}</span>`:""].join(""),l=o.getAttribute("icon");return`<li class="event" part="event">${l?`<span class="dot fx-icon" part="marker" aria-hidden="true">${h(l)}</span>`:`<span class="dot" part="marker" aria-hidden="true">${h(t)}</span>`}<div class="head">${n}</div><div class="content">${o.innerHTML}</div></li>`}).join(""),r.some(o=>o.hasAttribute("icon"))&&Promise.resolve().then(()=>M))}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver(()=>this._decorate()),this._observer.observe(this,{childList:!0,subtree:!1}),this._decorate()}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._observer)==null||e.disconnect(),this._observer=void 0}};ct.styles=m`
|
|
2658
2696
|
:host {
|
|
2659
2697
|
display: block;
|
|
2660
2698
|
font-family: var(--fx-font-family);
|
|
@@ -2834,7 +2872,7 @@
|
|
|
2834
2872
|
transition: background var(--fx-motion-duration-fast) var(--fx-motion-easing), width var(--fx-motion-duration-fast) var(--fx-motion-easing);
|
|
2835
2873
|
}
|
|
2836
2874
|
.dot.on { background: var(--fx-color-primary); width: 20px; }
|
|
2837
|
-
`;let fe=dt;function Sr(){return x("fx-carousel",fe)}Sr();const
|
|
2875
|
+
`;let fe=dt;function Sr(){return x("fx-carousel",fe)}Sr();const ht=class ht extends b{constructor(){super(...arguments),this._expanded=new Set,this._selected=null}static get observedAttributes(){return["data","expand-all","size"]}render(){this.setTemplate(`<ul part="tree">${this._renderNodes(this.data,"")}</ul>`),this._bind()}_path(e,t){return t?`${t}.${e}`:`${e}`}_renderNodes(e,t){const r=this.hasAttr("expand-all");return e.map((a,o)=>{const i=this._path(o,t),s=Array.isArray(a.children)&&a.children.length>0,n=r||this._expanded.has(i),l=this._selected===i?" selected":"",p=s?`<ul class="children" ${n?"":"hidden"}>${this._renderNodes(a.children,i)}</ul>`:"";return`<li><span class="row${l}" data-path="${i}" role="treeitem" tabindex="0"><span class="caret ${s?n?"open":"":"leaf"}" data-toggle="${s?i:""}">▸</span>${a.icon?`<span class="icon">${h(a.icon)}</span>`:""}<span class="label">${h(a.label)}</span></span>${p}</li>`}).join("")}get data(){try{const e=JSON.parse(this.getAttr("data","[]"));return Array.isArray(e)?e:[]}catch(e){return[]}}set data(e){this.setAttribute("data",JSON.stringify(e))}_bind(){this.root.querySelectorAll(".caret[data-toggle]").forEach(e=>{const t=e.dataset.toggle;t&&e.addEventListener("click",r=>{r.stopPropagation(),this._toggle(t,e)})}),this.root.querySelectorAll(".row").forEach(e=>{var r;const t=(r=e.dataset.path)!=null?r:"";e.addEventListener("click",()=>{this._selected=t,this.root.querySelectorAll(".row").forEach(a=>a.classList.toggle("selected",a===e)),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{node:this._findNode(t)}}))}),e.addEventListener("keydown",a=>{a.key==="Enter"&&e.click()})})}_toggle(e,t){var o;this._expanded.has(e)?this._expanded.delete(e):this._expanded.add(e);const r=this._expanded.has(e);t.classList.toggle("open",r);const a=t.closest("li");(o=a==null?void 0:a.querySelector(":scope > ul.children"))==null||o.toggleAttribute("hidden",!r)}_findNode(e){var a;let t=this.data,r;for(const o of e.split(".")){if(r=t[Number(o)],!r)return;t=(a=r.children)!=null?a:[]}return r}setAllExpanded(e){e?this.setAttribute("expand-all",""):(this.removeAttribute("expand-all"),this._expanded.clear()),this.render()}};ht.styles=m`
|
|
2838
2876
|
:host {
|
|
2839
2877
|
display: block;
|
|
2840
2878
|
font-family: var(--fx-font-family);
|
|
@@ -2876,7 +2914,7 @@
|
|
|
2876
2914
|
.children[hidden] { display: none; }
|
|
2877
2915
|
:host([size='sm']) .row { padding: 2px var(--fx-space-xs); font-size: calc(var(--fx-font-size) - 2px); }
|
|
2878
2916
|
:host([size='lg']) .row { padding: var(--fx-space-sm) var(--fx-space-md); font-size: calc(var(--fx-font-size) + 1px); }
|
|
2879
|
-
`;let _e=
|
|
2917
|
+
`;let _e=ht;function $r(){return x("fx-tree",_e)}$r();const Lt={success:"var(--fx-color-success, #10b981)",error:"var(--fx-color-danger, #f43f5e)",info:"var(--fx-color-info, #0ea5e9)",warning:"var(--fx-color-warning, #f59e0b)"},Tt={success:"✓",error:"✕",warning:"!",info:"i"},Er=`
|
|
2880
2918
|
:host { display: contents; pointer-events: auto; }
|
|
2881
2919
|
/* Modo explícito: sobrepõe os tokens herdados do tema global SOMENTE neste card. */
|
|
2882
2920
|
:host([mode='dark']) {
|
|
@@ -2949,10 +2987,10 @@
|
|
|
2949
2987
|
${a?'<div class="msg"></div>':""}
|
|
2950
2988
|
</div>
|
|
2951
2989
|
<button class="close" aria-label="Fechar">✕</button>
|
|
2952
|
-
</div>`;const l=this.shadowRoot.querySelector(".title"),
|
|
2990
|
+
</div>`;const l=this.shadowRoot.querySelector(".title"),p=this.shadowRoot.querySelector(".msg");l&&(l.textContent=r),p&&(p.textContent=a),this.shadowRoot.querySelector(".close").addEventListener("click",()=>this.dismiss())};function Lr(d){let e=document.querySelector(`[data-fx-toast-region="${d}"]`);if(!e){e=document.createElement("div"),e.setAttribute("data-fx-toast-region",d);const[t,r]=d.split("-"),a=e.style;a.position="fixed",a[t]="16px",r==="center"?(a.left="50%",a.transform="translateX(-50%)"):a[r]="16px",a.display="flex",a.flexDirection="column",a.gap="8px",a.zIndex="1100",a.pointerEvents="none",document.body.appendChild(e)}return e}class Tr{constructor(){this.seq=0,this.map=new Map,this.success=(e,t,r)=>this.push("success",e,t,r),this.error=(e,t,r)=>this.push("error",e,t,r),this.info=(e,t,r)=>this.push("info",e,t,r),this.warning=(e,t,r)=>this.push("warning",e,t,r)}push(e,t,r,a){var l,p,f;const o=++this.seq,i=typeof r=="string"?r:r==null?void 0:r.message,s={...typeof r=="object"&&r?r:void 0,...a},n=document.createElement("fx-toast");return n.setAttribute("kind",e),n.setAttribute("title",t),i&&n.setAttribute("message",i),n.setAttribute("position",(l=s.position)!=null?l:"top-right"),n.setAttribute("duration",String((p=s.duration)!=null?p:4e3)),s.mode&&n.setAttribute("mode",s.mode),Lr((f=s.position)!=null?f:"top-right").appendChild(n),this.map.set(o,n),o}close(e){var t;(t=this.map.get(e))==null||t.dismiss(),this.map.delete(e)}}const qr=new Tr;globalThis.FenixToast=qr;function Dr(){customElements.get("fx-toast")||customElements.define("fx-toast",Cr)}Dr();const pt=class pt extends b{static get observedAttributes(){return["content","position"]}render(){const e=this.getAttr("content");this.setTemplate(`
|
|
2953
2991
|
<slot></slot>
|
|
2954
|
-
<span class="bubble" part="bubble" role="tooltip">${
|
|
2955
|
-
`)}};
|
|
2992
|
+
<span class="bubble" part="bubble" role="tooltip">${h(e)}</span>
|
|
2993
|
+
`)}};pt.styles=m`
|
|
2956
2994
|
:host {
|
|
2957
2995
|
position: relative;
|
|
2958
2996
|
display: inline-flex;
|
|
@@ -3013,11 +3051,11 @@
|
|
|
3013
3051
|
top: 50%; left: auto; right: 100%; transform: translateY(-50%);
|
|
3014
3052
|
border: 5px solid transparent; border-right-color: var(--fx-text-default, #1e293b);
|
|
3015
3053
|
}
|
|
3016
|
-
`;let me=
|
|
3054
|
+
`;let me=pt;function Mr(){return x("fx-tooltip",me)}Mr();const ut=class ut extends b{static get observedAttributes(){return["value"]}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}render(){var r;const e=Array.from(this.querySelectorAll("fx-tab")),t=this.value||((r=e[0])==null?void 0:r.getAttribute("tab"))||"";this.setTemplate(`
|
|
3017
3055
|
<div class="list" role="tablist">
|
|
3018
3056
|
${e.map(a=>{var s,n,l;const o=(s=a.getAttribute("tab"))!=null?s:"",i=a.hasAttribute("disabled");return`<button type="button" class="tab" role="tab" part="tab"
|
|
3019
|
-
data-tab="${
|
|
3020
|
-
${i?'aria-disabled="true" data-disabled="true"':""}>${
|
|
3057
|
+
data-tab="${h(o)}" aria-selected="${o===t}"
|
|
3058
|
+
${i?'aria-disabled="true" data-disabled="true"':""}>${h((l=(n=a.textContent)==null?void 0:n.trim())!=null?l:"")}</button>`}).join("")}
|
|
3021
3059
|
</div>
|
|
3022
3060
|
<slot></slot>
|
|
3023
3061
|
`),this.panels.forEach(a=>{a.getAttribute("tab")===t?a.removeAttribute("hidden"):a.setAttribute("hidden","")}),this.root.querySelectorAll(".tab").forEach(a=>{a.addEventListener("click",()=>{var o;a.hasAttribute("data-disabled")||(this.value=(o=a.dataset.tab)!=null?o:"",this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}})))})})}get panels(){const e=Array.from(this.querySelectorAll("fx-tab-panel"));if(e.length)return e;const t=[];let r=this.nextElementSibling;for(;r&&!r.matches("fx-tabs");)r.matches("fx-tab-panel")?t.push(r):t.push(...Array.from(r.querySelectorAll(":scope > fx-tab-panel"))),r=r.nextElementSibling;return t}};ut.styles=m`
|
|
@@ -3075,7 +3113,7 @@
|
|
|
3075
3113
|
:host { display: block; padding: var(--fx-space-lg) 0; font-family: var(--fx-font-family); color: var(--fx-text-default); }
|
|
3076
3114
|
:host([hidden]) { display: none; }
|
|
3077
3115
|
`;let be=ft;function Ir(){return x("fx-tabs",ge)}function jr(){return x("fx-tab-panel",be)}Ir(),jr();const _t=class _t extends b{constructor(){super(...arguments),this._done=!1}static get observedAttributes(){return["value","indeterminate","variant","label","hide-label","size"]}get value(){return Number(this.getAttr("value","0"))||0}set value(e){this.setAttribute("value",String(Math.min(100,Math.max(0,e))))}render(){const e=Math.min(100,Math.max(0,this.value)),t=this.hasAttr("indeterminate"),r=this.getAttr("label"),a=!t&&!this.hasAttr("hide-label");this.setTemplate(`
|
|
3078
|
-
${r?`<div class="caption" part="caption">${
|
|
3116
|
+
${r?`<div class="caption" part="caption">${h(r)}</div>`:""}
|
|
3079
3117
|
<div class="row">
|
|
3080
3118
|
<div class="track" part="track" role="progressbar"
|
|
3081
3119
|
aria-valuenow="${e}" aria-valuemin="0" aria-valuemax="100">
|
|
@@ -3153,11 +3191,11 @@
|
|
|
3153
3191
|
.text { height: 12px; width: 100%; margin-bottom: var(--fx-space-sm); }
|
|
3154
3192
|
.text:last-of-type { width: 60%; margin-bottom: 0; }
|
|
3155
3193
|
.circle { border-radius: var(--fx-radius-full); }
|
|
3156
|
-
`;let xe=mt;function Fr(){return x("fx-skeleton",xe)}Fr();const gt=class gt extends b{static get observedAttributes(){return["variant","title","dismissible","icon"]}render(){var i,s;const e=this.getAttr("variant","info"),t=this.getAttr("title"),r=this.getAttr("icon");q(r)&&Promise.resolve().then(()=>M);const o=r?`<span class="icon${q(r)?" fx-icon":""}" part="icon" aria-hidden="true">${
|
|
3194
|
+
`;let xe=mt;function Fr(){return x("fx-skeleton",xe)}Fr();const gt=class gt extends b{static get observedAttributes(){return["variant","title","dismissible","icon"]}render(){var i,s;const e=this.getAttr("variant","info"),t=this.getAttr("title"),r=this.getAttr("icon");q(r)&&Promise.resolve().then(()=>M);const o=r?`<span class="icon${q(r)?" fx-icon":""}" part="icon" aria-hidden="true">${h(r)}</span>`:`<span class="icon">${(i={info:"ℹ",success:"✓",warning:"⚠",danger:"✕"}[e])!=null?i:"ℹ"}</span>`;this.setTemplate(`
|
|
3157
3195
|
<div class="alert" part="alert" role="alert">
|
|
3158
3196
|
${o}
|
|
3159
3197
|
<div class="content">
|
|
3160
|
-
${t?`<div class="title">${
|
|
3198
|
+
${t?`<div class="title">${h(t)}</div>`:""}
|
|
3161
3199
|
<div class="body"><slot></slot></div>
|
|
3162
3200
|
</div>
|
|
3163
3201
|
${this.hasAttr("dismissible")?'<button type="button" class="close" aria-label="Fechar">×</button>':""}
|
|
@@ -3200,7 +3238,7 @@
|
|
|
3200
3238
|
`;let ye=gt;function Pr(){return x("fx-alert",ye)}Pr();const bt=class bt extends b{constructor(){super(...arguments),this._listenersAttached=!1}static get observedAttributes(){return["label","position","open"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}render(){const e=this.getAttr("label","Ações"),t=Array.from(this.querySelectorAll("fx-dropdown-item"));this.setTemplate(`
|
|
3201
3239
|
<span class="trigger" role="button" tabindex="0" part="trigger"
|
|
3202
3240
|
aria-haspopup="menu" aria-expanded="${this.open}">
|
|
3203
|
-
${
|
|
3241
|
+
${h(e)} ▾
|
|
3204
3242
|
</span>
|
|
3205
3243
|
<div class="panel" role="menu" part="panel">
|
|
3206
3244
|
${t.length?"":'<div class="empty">Nenhuma ação</div>'}
|
|
@@ -3262,8 +3300,8 @@
|
|
|
3262
3300
|
.item:hover { background: color-mix(in srgb, var(--fx-color-primary) 12%, var(--fx-surface-background)); color: var(--fx-color-primary); }
|
|
3263
3301
|
`;let ke=vt;function Vr(){return x("fx-dropdown",we)}function Rr(){return x("fx-dropdown-item",ke)}Vr(),Rr();const xt=class xt extends b{constructor(){super(...arguments),this._onKeydown=()=>{},this._previouslyFocused=null,this._close=()=>{this.open&&(this.open=!1,this._restoreFocus(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}static get observedAttributes(){return["open","title","position"]}get open(){return this.hasAttr("open")}set open(e){this.toggleAttr("open",e)}get title(){return this.getAttr("title")}set title(e){this.setAttribute("title",e)}get position(){const e=this.getAttr("position");return["left","right","top","bottom"].includes(e)?e:"right"}set position(e){this.setAttribute("position",e)}render(){var t,r;const e=this.getAttr("title");this.setTemplate(`
|
|
3264
3302
|
<div class="overlay" part="overlay"></div>
|
|
3265
|
-
<div class="panel" part="panel" role="dialog" aria-modal="true" aria-label="${
|
|
3266
|
-
${e!==""?`<div class="header" part="header"><span class="title">${
|
|
3303
|
+
<div class="panel" part="panel" role="dialog" aria-modal="true" aria-label="${h(e||"Drawer")}" tabindex="-1">
|
|
3304
|
+
${e!==""?`<div class="header" part="header"><span class="title">${h(e)}</span><button type="button" class="close" part="close" aria-label="Fechar">✕</button></div>`:""}
|
|
3267
3305
|
<div class="body" part="body"><slot></slot></div>
|
|
3268
3306
|
</div>
|
|
3269
3307
|
`),(t=this.root.querySelector(".overlay"))==null||t.addEventListener("click",this._close),(r=this.root.querySelector(".close"))==null||r.addEventListener("click",this._close),this.open&&requestAnimationFrame(()=>{var a;this._previouslyFocused===null&&(this._previouslyFocused=document.activeElement),(a=this.root.querySelector(".panel"))==null||a.focus()})}connectedCallback(){var e;(e=super.connectedCallback)==null||e.call(this),this._onKeydown=t=>{t.key==="Escape"&&this.open?this._close():t.key==="Tab"&&this.open&&this._trapFocus(t)},document.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){var e;document.removeEventListener("keydown",this._onKeydown),this._restoreFocus(),(e=super.disconnectedCallback)==null||e.call(this)}_trapFocus(e){const t=this.root.querySelector(".panel");if(!t)return;const r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r.length)return;const a=r[0],o=r[r.length-1],i=this.root.activeElement;e.shiftKey&&(i===a||i===t)?(e.preventDefault(),o.focus()):!e.shiftKey&&i===o&&(e.preventDefault(),a.focus())}_restoreFocus(){var e;(e=this._previouslyFocused)!=null&&e.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}};xt.styles=m`
|
|
@@ -3393,9 +3431,9 @@
|
|
|
3393
3431
|
<button type="button" class="nav" part="next" data-go="${t+1}" ${t>=e?"disabled":""}>›</button>
|
|
3394
3432
|
${r.length?`
|
|
3395
3433
|
<fx-select class="rows-sel" part="rows" size="sm" value="${this.rows}" aria-label="Itens por página">
|
|
3396
|
-
${r.map(l=>`<option value="${
|
|
3434
|
+
${r.map(l=>`<option value="${h(l)}">${h(l)}</option>`).join("")}
|
|
3397
3435
|
</fx-select>`:""}
|
|
3398
|
-
`);function s(l,
|
|
3436
|
+
`);function s(l,p){return(l-1)*p+1}this.root.querySelectorAll(".nav[data-go]").forEach(l=>{l.addEventListener("click",()=>{const p=Number(l.dataset.go);p>=1&&p<=e&&p!==t&&(this.page=p,this.emit())})});const n=this.root.querySelector("fx-select.rows-sel");n==null||n.addEventListener("change",l=>{var f;const p=Number((f=l.detail)==null?void 0:f.value);!p||p===this.rows||(this.rows=p,this.page=1,this.emit())})}emit(){this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,composed:!0,detail:{page:this.page,rows:this.rows}}))}};yt.styles=m`
|
|
3399
3437
|
:host {
|
|
3400
3438
|
display: flex;
|
|
3401
3439
|
align-items: center;
|
|
@@ -3440,12 +3478,15 @@
|
|
|
3440
3478
|
}
|
|
3441
3479
|
`;let ze=yt;function Or(){return x("fx-pagination",ze)}Or();const wt=class wt extends b{static get observedAttributes(){return["size","placeholder","source","disabled","min-chars","error","invalid","success","valid"]}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get value(){return this.getAttr("value")}set value(e){this.setAttribute("value",e)}get source(){try{const e=JSON.parse(this.getAttr("source","[]"));return Array.isArray(e)?e.map(String):[]}catch(e){return[]}}set source(e){this.setAttribute("source",typeof e=="string"?e:JSON.stringify(e))}connectedCallback(){super.connectedCallback(),this.docListener=e=>{this.contains(e.target)||this.toggleAttr("open",!1)},document.addEventListener("click",this.docListener)}disconnectedCallback(){super.disconnectedCallback(),this.docListener&&document.removeEventListener("click",this.docListener),this.docListener=void 0}render(){const e=this.getAttr("placeholder");this.setTemplate(`
|
|
3442
3480
|
<input class="field" part="input" type="text"
|
|
3443
|
-
${e?`placeholder="${
|
|
3481
|
+
${e?`placeholder="${h(e)}"`:""} autocomplete="off"/>
|
|
3444
3482
|
<div class="list" part="list" role="listbox"></div>
|
|
3445
|
-
`);const t=this.root.querySelector(".field");if(!t)return;t.value=this.value,this.hasAttr("disabled")&&t.setAttribute("disabled","");const r=this.root.querySelector(".list"),a=Number(this.getAttr("min-chars","1"))||1,o=()=>{if(!r)return;const i=t.value.toLowerCase(),s=this.source.filter(n=>n.toLowerCase().includes(i)).slice(0,8);r.innerHTML=s.length?s.map(n=>`<button type="button" class="opt" role="option" data-v="${
|
|
3483
|
+
`);const t=this.root.querySelector(".field");if(!t)return;t.value=this.value,this.hasAttr("disabled")&&t.setAttribute("disabled","");const r=this.root.querySelector(".list"),a=Number(this.getAttr("min-chars","1"))||1,o=()=>{if(!r)return;const i=t.value.toLowerCase(),s=this.source.filter(n=>n.toLowerCase().includes(i)).slice(0,8);r.innerHTML=s.length?s.map(n=>`<button type="button" class="opt" role="option" data-v="${h(n)}">${h(n)}</button>`).join(""):'<div class="empty">Nenhum resultado</div>',r.querySelectorAll(".opt").forEach(n=>{n.addEventListener("click",()=>{var l;t.value=(l=n.dataset.v)!=null?l:"",this.value=t.value,this.toggleAttr("open",!1),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{value:this.value}}))})}),this.toggleAttr("open",!0)};t.addEventListener("input",()=>{this.value=t.value,o()}),t.addEventListener("focus",()=>{t.value.length>=a&&o()}),t.addEventListener("keydown",i=>{var p;if(i.key==="Escape"){this.toggleAttr("open",!1);return}if(i.key!=="ArrowDown"&&i.key!=="ArrowUp")return;i.preventDefault(),this.hasAttr("open")||o();const s=Array.from(this.root.querySelectorAll(".opt"));if(!s.length)return;const n=s.indexOf(this.root.activeElement),l=i.key==="ArrowDown"?n===-1?0:Math.min(n+1,s.length-1):n===-1?s.length-1:Math.max(n-1,0);(p=s[l])==null||p.focus()})}};wt.styles=m`
|
|
3446
3484
|
:host {
|
|
3447
3485
|
position: relative;
|
|
3448
3486
|
display: inline-block;
|
|
3487
|
+
/* Largura padrão no HOST: CSS externo, classes e style inline no elemento
|
|
3488
|
+
vencem este default naturalmente (regras do documento > :host). */
|
|
3489
|
+
width: var(--fx-autocomplete-width, 260px);
|
|
3449
3490
|
font-family: var(--fx-font-family);
|
|
3450
3491
|
font-size: var(--fx-font-size);
|
|
3451
3492
|
}
|
|
@@ -3458,7 +3499,8 @@
|
|
|
3458
3499
|
border: 1px solid var(--fx-border-default);
|
|
3459
3500
|
border-radius: var(--fx-radius-md);
|
|
3460
3501
|
padding: var(--fx-space-md) var(--fx-space-lg);
|
|
3461
|
-
|
|
3502
|
+
/* Acompanha a largura definida no :host. */
|
|
3503
|
+
width: 100%;
|
|
3462
3504
|
min-height: var(--fx-size-md);
|
|
3463
3505
|
box-sizing: border-box;
|
|
3464
3506
|
transition:
|
|
@@ -3472,8 +3514,10 @@
|
|
|
3472
3514
|
border-color: var(--fx-color-primary);
|
|
3473
3515
|
box-shadow: var(--fx-effect-focus-ring, none);
|
|
3474
3516
|
}
|
|
3475
|
-
:host([size='sm'])
|
|
3476
|
-
:host([size='
|
|
3517
|
+
:host([size='sm']) { width: var(--fx-autocomplete-width-sm, 220px); }
|
|
3518
|
+
:host([size='sm']) .field { min-height: var(--fx-size-sm); padding: var(--fx-space-sm) var(--fx-space-md); }
|
|
3519
|
+
:host([size='lg']) { width: var(--fx-autocomplete-width-lg, 300px); }
|
|
3520
|
+
:host([size='lg']) .field { min-height: var(--fx-size-lg); }
|
|
3477
3521
|
/* Full width: o host estica até o pai e o campo interno acompanha. */
|
|
3478
3522
|
:host([full]) { display: block; width: 100%; }
|
|
3479
3523
|
:host([full]) .field { width: 100%; }
|
|
@@ -3518,7 +3562,7 @@
|
|
|
3518
3562
|
}
|
|
3519
3563
|
.opt:hover { background: color-mix(in srgb, var(--fx-color-primary) 12%, var(--fx-surface-background)); color: var(--fx-color-primary); }
|
|
3520
3564
|
.empty { color: var(--fx-text-muted); font-size: calc(var(--fx-font-size) - 2px); padding: var(--fx-space-sm) var(--fx-space-md); }
|
|
3521
|
-
`;let Se=wt;function
|
|
3565
|
+
`;let Se=wt;function Hr(){return x("fx-autocomplete",Se)}Hr();const kt=class kt extends b{constructor(){super(...arguments),this._isDragging=!1,this._startY=0,this._startValue=0,this._onMouseMove=e=>{if(!this._isDragging)return;const t=this._startY-e.clientY,r=(this.max-this.min)/100;this.emitChange(this._startValue+t*r)},this._onMouseUp=()=>{this._isDragging=!1,document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp)}}static get observedAttributes(){return["value","min","max","step","size","stroke-width","value-color","range-color","readonly","disabled","value-template"]}get value(){return this.clampValue(Number(this.getAttr("value","0"))||0)}set value(e){if(this.readonly||this.disabled)return;const t=this.clampValue(e),r=this.clampValue(Number(this.getAttr("value","0"))||0);t!==r&&(this.setAttribute("value",String(t)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}})))}get min(){return Number(this.getAttr("min","0"))||0}set min(e){this.setAttribute("min",String(e))}get max(){return Number(this.getAttr("max","100"))||100}set max(e){this.setAttribute("max",String(e))}get step(){return Number(this.getAttr("step","1"))||1}set step(e){this.setAttribute("step",String(e))}get size(){const e=this.getAttr("size","md");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get strokeWidth(){return Number(this.getAttr("stroke-width","8"))||8}set strokeWidth(e){this.setAttribute("stroke-width",String(e))}get valueColor(){return this.getAttr("value-color","")}set valueColor(e){this.setAttribute("value-color",e)}get rangeColor(){return this.getAttr("range-color","")}set rangeColor(e){this.setAttribute("range-color",e)}get readonly(){return this.hasAttr("readonly")}set readonly(e){this.toggleAttr("readonly",!!e)}get disabled(){return this.hasAttr("disabled")}set disabled(e){this.toggleAttr("disabled",!!e)}get valueTemplate(){return this.getAttr("value-template","{value}")}set valueTemplate(e){this.setAttribute("value-template",e)}render(){const e=this.min,t=this.max,r=this.clampValue(this.value),a=t-e,o=a>0?(r-e)/a:0,i=this.getSizeNum(),s=this.strokeWidth,n=(i-s)/2,l=2*Math.PI*n,p=l*(1-o),f=this.valueColor?this.safeColor(this.valueColor):"",_=this.rangeColor?this.safeColor(this.rangeColor):"",c=f?`--_value-color: ${f};`:"",g=_?`--_range-color: ${_};`:"",u=this.valueTemplate.replace("{value}",String(Math.round(r)));this.setTemplate(`
|
|
3522
3566
|
<div class="knob" part="knob" tabindex="${this.disabled?"-1":"0"}"
|
|
3523
3567
|
role="slider" aria-valuenow="${r}" aria-valuemin="${e}" aria-valuemax="${t}"
|
|
3524
3568
|
aria-readonly="${this.readonly}" aria-disabled="${this.disabled}"
|
|
@@ -3529,9 +3573,9 @@
|
|
|
3529
3573
|
<circle class="value" part="value"
|
|
3530
3574
|
cx="${i/2}" cy="${i/2}" r="${n}"
|
|
3531
3575
|
stroke-dasharray="${l}"
|
|
3532
|
-
stroke-dashoffset="${
|
|
3576
|
+
stroke-dashoffset="${p}" />
|
|
3533
3577
|
</svg>
|
|
3534
|
-
<div class="label" part="label">${
|
|
3578
|
+
<div class="label" part="label">${h(u)}</div>
|
|
3535
3579
|
</div>
|
|
3536
3580
|
`),this.attachListeners()}getSizeNum(){const e=this.size;return e==="sm"?60:e==="lg"?140:100}safeColor(e){const t=e.trim();return/^#[0-9a-fA-F]{3,8}$/.test(t)||/^(rgb|rgba|hsl|hsla)\([\d\s.,%()]+\)$/i.test(t)||/^var\(--[\w-]+(,\s*[^)]*)?\)$/.test(t)||/^[a-zA-Z]+$/.test(t)?t:""}clampValue(e){const t=this.min,r=this.max,a=this.step;let o=Math.min(r,Math.max(t,e));return a>0&&(o=Math.round((o-t)/a)*a+t,o=Math.min(r,Math.max(t,o))),o}emitChange(e){const t=this.clampValue(e);t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}})))}attachListeners(){const e=this.root.querySelector(".knob");e&&(e.addEventListener("mousedown",t=>{this.readonly||this.disabled||(t.preventDefault(),this._isDragging=!0,this._startY=t.clientY,this._startValue=this.value,e.focus(),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp))}),e.addEventListener("touchstart",t=>{this.readonly||this.disabled||(t.preventDefault(),this._isDragging=!0,this._startY=t.touches[0].clientY,this._startValue=this.value,e.focus())},{passive:!1}),e.addEventListener("touchmove",t=>{if(!this._isDragging||this.readonly||this.disabled)return;t.preventDefault();const r=this._startY-t.touches[0].clientY,a=(this.max-this.min)/100;this.emitChange(this._startValue+r*a)},{passive:!1}),e.addEventListener("touchend",()=>{this._isDragging=!1}),e.addEventListener("keydown",t=>{if(this.readonly||this.disabled)return;const r=this.step;switch(t.key){case"ArrowUp":case"ArrowRight":t.preventDefault(),this.emitChange(this.value+r);break;case"ArrowDown":case"ArrowLeft":t.preventDefault(),this.emitChange(this.value-r);break;case"Home":t.preventDefault(),this.emitChange(this.min);break;case"End":t.preventDefault(),this.emitChange(this.max);break;case"PageUp":t.preventDefault(),this.emitChange(this.value+r*10);break;case"PageDown":t.preventDefault(),this.emitChange(this.value-r*10);break}}))}disconnectedCallback(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),super.disconnectedCallback()}};kt.styles=m`
|
|
3537
3581
|
:host {
|
|
@@ -3599,13 +3643,13 @@
|
|
|
3599
3643
|
.knob:focus-visible svg {
|
|
3600
3644
|
filter: drop-shadow(var(--fx-effect-focus-ring, 0 0 0 3px color-mix(in srgb, var(--fx-color-primary) 22%, transparent)));
|
|
3601
3645
|
}
|
|
3602
|
-
`;let $e=kt;function
|
|
3646
|
+
`;let $e=kt;function Kr(){return x("fx-knob",$e)}Kr();const At=class At extends b{constructor(){super(...arguments),this._data=[],this._filteredData=null,this._selection=[],this._filterValue="",this._draggedIndex=null,this._listenersAttached=!1,this._optionTemplate=null}static get observedAttributes(){return["data","data-key","filter","filter-by","filter-placeholder","breakpoint","controls-location","dragdrop","striped","selection-mode","show-select-all"]}set data(e){this._data=e,this._filteredData=null,this.render()}get data(){return this._data}set selection(e){this._selection=e,this.render()}get selection(){return this._selection}get dataKey(){return this.getAttr("data-key","")}set dataKey(e){this.setAttribute("data-key",e)}get filter(){return this.hasAttr("filter")}set filter(e){this.toggleAttr("filter",e)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(e){this.setAttribute("filter-by",e)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(e){this.setAttribute("filter-placeholder",e)}get breakpoint(){return this.getAttr("breakpoint","960px")}set breakpoint(e){this.setAttribute("breakpoint",e)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(e){this.toggleAttr("dragdrop",e)}get striped(){return this.hasAttr("striped")}set striped(e){this.toggleAttr("striped",e)}get selectionMode(){const e=this.getAttr("selection-mode","");return e==="single"||e==="multiple"?e:""}set selectionMode(e){this.setAttribute("selection-mode",e)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(e){this.toggleAttr("show-select-all",e)}get filterValue(){return this._filterValue}set filterValue(e){this._filterValue=e,this._applyFilter(),this._updateListDisplay()}setOptionTemplate(e){this._optionTemplate=e,this.render()}connectedCallback(){this._parseDataAttribute(),super.connectedCallback()}attributeChangedCallback(e,t,r){this.getAttr("data","")!==""&&this._parseDataAttribute(),super.attributeChangedCallback(e,t,r)}_parseDataAttribute(){const e=this.getAttr("data","");if(e)try{this._data=JSON.parse(e),this._filteredData=null}catch(t){this._data=[]}}_applyFilter(){if(!this._filterValue){this._filteredData=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredData=this._data.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._filterValue.toLowerCase())}))}_getDisplayData(){return this._filteredData||this._data}_getItemKey(e,t){return this.dataKey&&e[this.dataKey]!=null?String(e[this.dataKey]):e.id!=null?String(e.id):e.key!=null?String(e.key):e.label!=null?String(e.label):e.name!=null?String(e.name):e.value!=null?String(e.value):String(t)}_getItemLabel(e){const t=["label","name","title","text","value"];for(const r of t)if(e[r]!=null)return String(e[r]);return JSON.stringify(e)}_isSelected(e){return this._selection.some(t=>this._getItemKey(t,-1)===this._getItemKey(e,-1))}_moveItem(e,t){const r=this._getActualIndex(e),a=this._getActualIndex(t);if(r===-1||a===-1)return;const o=this._data.splice(r,1)[0];this._data.splice(a,0,o),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_getActualIndex(e){if(this._filteredData){const t=this._filteredData[e];return this._data.findIndex(r=>this._getItemKey(r,-1)===this._getItemKey(t,-1))}return e}_emitReorder(){this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,composed:!0,detail:{items:[...this._data]}}))}_emitSelectionChange(){this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{selection:[...this._selection]}}))}_toggleSelection(e){const t=this._getItemKey(e,-1),r=this._selection.findIndex(a=>this._getItemKey(a,-1)===t);r>=0?this._selection.splice(r,1):this.selectionMode==="multiple"?this._selection.push(e):this._selection=[e],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_selectAll(){const e=this._getDisplayData();this._selection=[...e],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_deselectAll(){this._selection=[],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_toggleSelectAll(){const e=this._getDisplayData();this._selection.length===e.length?this._deselectAll():this._selectAll()}render(){const e=this._getDisplayData(),t=this.selectionMode,r=this.selectionMode==="multiple",a=r&&e.length>0&&this._selection.length===e.length;this.setTemplate(`
|
|
3603
3647
|
<div class="container" part="container">
|
|
3604
3648
|
${this.filter?`
|
|
3605
3649
|
<div class="filter-wrapper" part="filter-wrapper">
|
|
3606
3650
|
<input type="text" class="filter-input" part="filter-input"
|
|
3607
3651
|
placeholder="${this.filterPlaceholder}"
|
|
3608
|
-
value="${
|
|
3652
|
+
value="${h(this._filterValue)}"
|
|
3609
3653
|
aria-label="Filtrar lista" />
|
|
3610
3654
|
</div>
|
|
3611
3655
|
`:""}
|
|
@@ -3647,9 +3691,9 @@
|
|
|
3647
3691
|
<li class="empty-message" part="empty-message">
|
|
3648
3692
|
${this.filter?"Nenhum resultado encontrado":"Nenhum item disponivel"}
|
|
3649
3693
|
</li>
|
|
3650
|
-
`:e.map((o,i)=>{const s=this._getItemKey(o,i),n=this._getItemLabel(o),l=this._isSelected(o),
|
|
3694
|
+
`:e.map((o,i)=>{const s=this._getItemKey(o,i),n=this._getItemLabel(o),l=this._isSelected(o),p=this._optionTemplate?this._optionTemplate(o):h(n);return`
|
|
3651
3695
|
<li class="list-item${l?" selected":""}" part="list-item"
|
|
3652
|
-
data-index="${i}" data-key="${
|
|
3696
|
+
data-index="${i}" data-key="${h(s)}"
|
|
3653
3697
|
role="option" aria-selected="${l}"
|
|
3654
3698
|
${this.dragdrop?'draggable="true"':""}
|
|
3655
3699
|
tabindex="0">
|
|
@@ -3657,9 +3701,9 @@
|
|
|
3657
3701
|
${t?`
|
|
3658
3702
|
<input type="checkbox" class="checkbox" part="checkbox"
|
|
3659
3703
|
${l?"checked":""}
|
|
3660
|
-
aria-label="Selecionar ${
|
|
3704
|
+
aria-label="Selecionar ${h(n)}" />
|
|
3661
3705
|
`:""}
|
|
3662
|
-
<span class="item-content" part="item-content">${
|
|
3706
|
+
<span class="item-content" part="item-content">${p}</span>
|
|
3663
3707
|
</li>
|
|
3664
3708
|
`}).join("")}
|
|
3665
3709
|
</ul>
|
|
@@ -3685,17 +3729,17 @@
|
|
|
3685
3729
|
<li class="empty-message" part="empty-message">
|
|
3686
3730
|
${this.filter?"Nenhum resultado encontrado":"Nenhum item disponivel"}
|
|
3687
3731
|
</li>
|
|
3688
|
-
`:t.map((i,s)=>{const n=this._getItemKey(i,s),l=this._getItemLabel(i),
|
|
3689
|
-
<li class="list-item${
|
|
3690
|
-
data-index="${s}" data-key="${
|
|
3691
|
-
role="option" aria-selected="${
|
|
3732
|
+
`:t.map((i,s)=>{const n=this._getItemKey(i,s),l=this._getItemLabel(i),p=this._isSelected(i),f=this._optionTemplate?this._optionTemplate(i):h(l);return`
|
|
3733
|
+
<li class="list-item${p?" selected":""}" part="list-item"
|
|
3734
|
+
data-index="${s}" data-key="${h(n)}"
|
|
3735
|
+
role="option" aria-selected="${p}"
|
|
3692
3736
|
${this.dragdrop?'draggable="true"':""}
|
|
3693
3737
|
tabindex="0">
|
|
3694
3738
|
${this.dragdrop?'<span class="drag-handle" part="drag-handle" aria-label="Arrastar">⋮⋮</span>':""}
|
|
3695
3739
|
${r?`
|
|
3696
3740
|
<input type="checkbox" class="checkbox" part="checkbox"
|
|
3697
|
-
${
|
|
3698
|
-
aria-label="Selecionar ${
|
|
3741
|
+
${p?"checked":""}
|
|
3742
|
+
aria-label="Selecionar ${h(l)}" />
|
|
3699
3743
|
`:""}
|
|
3700
3744
|
<span class="item-content" part="item-content">${f}</span>
|
|
3701
3745
|
</li>
|
|
@@ -3776,7 +3820,7 @@
|
|
|
3776
3820
|
@media (max-width: 640px) { .main-row { flex-direction: column; } .controls-bar { flex-direction: row; flex-wrap: wrap; justify-content: center; position: relative; } .control-group { flex-direction: row; } .control-group + .control-group { margin-top: 0; margin-left: 4px; padding-top: 0; padding-left: 4px; border-top: none; border-left: 1px solid var(--orderlist-border); } button.control-btn { width: 44px; height: 40px; } button.control-btn::after { display: none; } .list { max-height: 300px; } }
|
|
3777
3821
|
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
|
|
3778
3822
|
.list-item { animation: slideIn 0.2s ease-out; }
|
|
3779
|
-
`;let Ee=At;function Yr(){return x("fx-orderlist",Ee)}Yr();const zt=class zt extends b{constructor(){super(...arguments),this._source=[],this._filteredSource=null,this._target=[],this._filteredTarget=null,this._sourceSelection=[],this._targetSelection=[],this._sourceFilterValue="",this._targetFilterValue="",this._filterListenersAttached=!1,this._optionTemplate=null}static get observedAttributes(){return["source","target","source-key","target-key","filter","filter-by","filter-placeholder","dragdrop","striped","selection-mode","show-select-all","source-label","target-label"]}set source(e){this._source=e,this._filteredSource=null,this.render()}get source(){return this._source}set target(e){this._target=e,this._filteredTarget=null,this.render()}get target(){return this._target}set sourceSelection(e){this._sourceSelection=e,this.render()}get sourceSelection(){return this._sourceSelection}set targetSelection(e){this._targetSelection=e,this.render()}get targetSelection(){return this._targetSelection}get sourceKey(){return this.getAttr("source-key","")}set sourceKey(e){this.setAttribute("source-key",e)}get targetKey(){return this.getAttr("target-key","")}set targetKey(e){this.setAttribute("target-key",e)}get filter(){return this.hasAttr("filter")}set filter(e){this.toggleAttr("filter",e)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(e){this.setAttribute("filter-by",e)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(e){this.setAttribute("filter-placeholder",e)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(e){this.toggleAttr("dragdrop",e)}get striped(){return this.hasAttr("striped")}set striped(e){this.toggleAttr("striped",e)}get selectionMode(){const e=this.getAttr("selection-mode","");return e==="single"||e==="multiple"?e:""}set selectionMode(e){this.setAttribute("selection-mode",e)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(e){this.toggleAttr("show-select-all",e)}get sourceLabel(){return this.getAttr("source-label","Disponíveis")}set sourceLabel(e){this.setAttribute("source-label",e)}get targetLabel(){return this.getAttr("target-label","Selecionados")}set targetLabel(e){this.setAttribute("target-label",e)}get sourceFilterValue(){return this._sourceFilterValue}set sourceFilterValue(e){this._sourceFilterValue=e,this._applySourceFilter(),this._updateListDisplay()}get targetFilterValue(){return this._targetFilterValue}set targetFilterValue(e){this._targetFilterValue=e,this._applyTargetFilter(),this._updateListDisplay()}setOptionTemplate(e){this._optionTemplate=e,this.render()}connectedCallback(){this._parseSourceAttribute(),this._parseTargetAttribute(),super.connectedCallback()}attributeChangedCallback(e,t,r){this.getAttr("source","")!==""&&this._parseSourceAttribute(),this.getAttr("target","")!==""&&this._parseTargetAttribute(),super.attributeChangedCallback(e,t,r)}_parseSourceAttribute(){const e=this.getAttr("source","");if(e)try{this._source=JSON.parse(e),this._filteredSource=null}catch(t){this._source=[]}}_parseTargetAttribute(){const e=this.getAttr("target","");if(e)try{this._target=JSON.parse(e),this._filteredTarget=null}catch(t){this._target=[]}}_applySourceFilter(){if(!this._sourceFilterValue){this._filteredSource=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredSource=this._source.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._sourceFilterValue.toLowerCase())}))}_applyTargetFilter(){if(!this._targetFilterValue){this._filteredTarget=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredTarget=this._target.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._targetFilterValue.toLowerCase())}))}_getDisplaySource(){return this._filteredSource||this._source}_getDisplayTarget(){return this._filteredTarget||this._target}_getItemKey(e,t,r){const a=r?this.sourceKey:this.targetKey;return a&&e[a]!=null?String(e[a]):e.id!=null?String(e.id):e.key!=null?String(e.key):e.label!=null?String(e.label):e.name!=null?String(e.name):e.value!=null?String(e.value):String(t)}_getItemLabel(e){const t=["label","name","title","text","value"];for(const r of t)if(e[r]!=null)return String(e[r]);return JSON.stringify(e)}_isSourceSelected(e,t){return this._sourceSelection.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(e,t,!0))}_isTargetSelected(e,t){return this._targetSelection.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(e,t,!1))}_emitMoveToTarget(){this.dispatchEvent(new CustomEvent("move-to-target",{bubbles:!0,composed:!0,detail:{items:[...this._sourceSelection],source:[...this._source],target:[...this._target]}}))}_emitMoveToSource(){this.dispatchEvent(new CustomEvent("move-to-source",{bubbles:!0,composed:!0,detail:{items:[...this._targetSelection],source:[...this._source],target:[...this._target]}}))}_emitSelectionChangeSource(){this.dispatchEvent(new CustomEvent("selection-change-source",{bubbles:!0,composed:!0,detail:{selection:[...this._sourceSelection]}}))}_emitSelectionChangeTarget(){this.dispatchEvent(new CustomEvent("selection-change-target",{bubbles:!0,composed:!0,detail:{selection:[...this._targetSelection]}}))}render(){const e=this._getDisplaySource(),t=this._getDisplayTarget(),r=this.selectionMode,a=r==="multiple"&&this.showSelectAll,o=e.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:e.map((l,h)=>`<li class="list-item${this._isSourceSelected(l,h)?" selected":""}" data-index="${h}" data-list="source" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isSourceSelected(l,h)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(l):p(this._getItemLabel(l))}</span></li>`).join(""),i=t.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:t.map((l,h)=>`<li class="list-item${this._isTargetSelected(l,h)?" selected":""}" data-index="${h}" data-list="target" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isTargetSelected(l,h)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(l):p(this._getItemLabel(l))}</span></li>`).join(""),s=a?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="source" ${this._sourceSelection.length>0&&this._sourceSelection.length===this._source.length?"checked":""} aria-label="Selecionar todos da origem" /> Selecionar Todos</label><span class="selection-count">${this._sourceSelection.length} selecionado(s)</span></div>`:"",n=a?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="target" ${this._targetSelection.length>0&&this._targetSelection.length===this._target.length?"checked":""} aria-label="Selecionar todos do destino" /> Selecionar Todos</label><span class="selection-count">${this._targetSelection.length} selecionado(s)</span></div>`:"";this.setTemplate(`<div class="container"><div class="list-container"><div class="list-label">${p(this.sourceLabel)} (${this._source.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input source-filter" placeholder="'+this.filterPlaceholder+'" value="'+p(this._sourceFilterValue)+'" /></div>':""}${s}<div class="list-wrapper"><ul class="list source-list" role="listbox" tabindex="0">${o}</ul></div></div><div class="controls"><div class="control-group"><button class="control-btn" data-action="move-all-target" part="control-btn" aria-label="Mover todos para destino"><span class="control-btn-icon">»</span></button><button class="control-btn" data-action="move-target" part="control-btn" aria-label="Mover para destino"><span class="control-btn-icon">→</span></button></div><div class="control-group"><button class="control-btn" data-action="move-source" part="control-btn" aria-label="Mover para origem"><span class="control-btn-icon">←</span></button><button class="control-btn" data-action="move-all-source" part="control-btn" aria-label="Mover todos para origem"><span class="control-btn-icon">«</span></button></div></div><div class="list-container"><div class="list-label">${p(this.targetLabel)} (${this._target.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input target-filter" placeholder="'+this.filterPlaceholder+'" value="'+p(this._targetFilterValue)+'" /></div>':""}${n}<div class="list-wrapper"><ul class="list target-list" role="listbox" tabindex="0">${i}</ul></div></div></div>`),this._attachListeners()}_attachListeners(){this._filterListenersAttached||(this._filterListenersAttached=!0,this.root.addEventListener("input",e=>{const t=e.target;if(t.classList.contains("select-all-checkbox")){this._handleSelectAll(t);return}t.classList.contains("source-filter")?this.sourceFilterValue=t.value:t.classList.contains("target-filter")&&(this.targetFilterValue=t.value)}),this.root.addEventListener("click",e=>{const t=e.target,r=t.closest(".control-btn");if(r){switch(r.dataset.action){case"move-target":this._moveToTarget();break;case"move-all-target":this._moveAllToTarget();break;case"move-source":this._moveToSource();break;case"move-all-source":this._moveAllToSource();break}return}const a=t.closest(".list-item");if(!a)return;const o=a.dataset.list==="source",i=Number(a.dataset.index),s=(o?this._getDisplaySource():this._getDisplayTarget())[i];o?this._toggleSourceSelection(s,i):this._toggleTargetSelection(s,i)})),this._updateControlsState()}_handleSelectAll(e){e.dataset.list==="source"?(this._sourceSelection=e.checked?[...this._getDisplaySource()]:[],this._emitSelectionChangeSource()):(this._targetSelection=e.checked?[...this._getDisplayTarget()]:[],this._emitSelectionChangeTarget()),this._updateSelectionDisplay(),this._updateControlsState()}_updateSelectionDisplay(){const e=(t,r,a)=>{t&&t.querySelectorAll(".list-item").forEach(o=>{const i=Number(o.dataset.index),s=r(a()[i],i);o.classList.toggle("selected",s),o.setAttribute("aria-selected",String(s));const n=o.querySelector(".checkbox");n&&(n.checked=s)})};e(this.root.querySelector(".source-list"),(t,r)=>this._isSourceSelected(t,r),()=>this._getDisplaySource()),e(this.root.querySelector(".target-list"),(t,r)=>this._isTargetSelected(t,r),()=>this._getDisplayTarget()),this._updateSelectAllBars()}_updateSelectAllBars(){if(!(this.selectionMode==="multiple"&&this.showSelectAll))return;[{el:this.root.querySelector('.select-all-checkbox[data-list="source"]'),total:this._source.length,sel:this._sourceSelection.length},{el:this.root.querySelector('.select-all-checkbox[data-list="target"]'),total:this._target.length,sel:this._targetSelection.length}].forEach(({el:t,total:r,sel:a})=>{var i;if(!t)return;t.checked=r>0&&a===r;const o=(i=t.closest(".select-all-bar"))==null?void 0:i.querySelector(".selection-count");o&&(o.textContent=`${a} selecionado(s)`)})}_updateControlsState(){this.root.querySelectorAll(".control-btn").forEach(e=>{const t=e.dataset.action;e.disabled=t==="move-target"&&this._sourceSelection.length===0||t==="move-all-target"&&this._source.length===0||t==="move-source"&&this._targetSelection.length===0||t==="move-all-source"&&this._target.length===0})}_moveToTarget(){if(!this._sourceSelection.length)return;const e=[...this._sourceSelection];this._source=this._source.filter(t=>!e.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(t,-1,!0))),this._target=[...this._target,...e],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveToSource(){if(!this._targetSelection.length)return;const e=[...this._targetSelection];this._target=this._target.filter(t=>!e.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(t,-1,!1))),this._source=[...this._source,...e],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_moveAllToTarget(){const e=[...this._source];this._source=[],this._target=[...this._target,...e],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveAllToSource(){const e=[...this._target];this._target=[],this._source=[...this._source,...e],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_toggleSourceSelection(e,t){const r=this.selectionMode||"single",a=this._getItemKey(e,t,!0),o=this._sourceSelection.findIndex(i=>this._getItemKey(i,-1,!0)===a);o>=0?this._sourceSelection.splice(o,1):r==="multiple"?this._sourceSelection.push(e):this._sourceSelection=[e],this._emitSelectionChangeSource(),this._updateSelectionDisplay(),this._updateControlsState()}_toggleTargetSelection(e,t){const r=this.selectionMode||"single",a=this._getItemKey(e,t,!1),o=this._targetSelection.findIndex(i=>this._getItemKey(i,-1,!1)===a);o>=0?this._targetSelection.splice(o,1):r==="multiple"?this._targetSelection.push(e):this._targetSelection=[e],this._emitSelectionChangeTarget(),this._updateSelectionDisplay(),this._updateControlsState()}_updateListDisplay(){var h,f;const e=(h=this.root.querySelector(".source-list"))==null?void 0:h.parentElement,t=(f=this.root.querySelector(".target-list"))==null?void 0:f.parentElement,r=this.root.querySelector(".list-container:first-of-type .list-label"),a=this.root.querySelector(".list-container:last-of-type .list-label");if(!e||!t){this.render();return}const o=this._getDisplaySource(),i=this._getDisplayTarget(),s=this.selectionMode,n=o.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:o.map((_,c)=>`<li class="list-item${this._isSourceSelected(_,c)?" selected":""}" part="list-item" data-index="${c}" data-list="source" role="option" aria-selected="${this._isSourceSelected(_,c)}" tabindex="0">${s?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isSourceSelected(_,c)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(_):p(this._getItemLabel(_))}</span></li>`).join(""),l=i.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:i.map((_,c)=>`<li class="list-item${this._isTargetSelected(_,c)?" selected":""}" part="list-item" data-index="${c}" data-list="target" role="option" aria-selected="${this._isTargetSelected(_,c)}" tabindex="0">${s?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isTargetSelected(_,c)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(_):p(this._getItemLabel(_))}</span></li>`).join("");e.innerHTML=`<ul class="list source-list" role="listbox" tabindex="0">${n}</ul>`,t.innerHTML=`<ul class="list target-list" role="listbox" tabindex="0">${l}</ul>`,r&&(r.textContent=`${this.sourceLabel} (${this._source.length})`),a&&(a.textContent=`${this.targetLabel} (${this._target.length})`),this._updateSelectAllBars(),this._attachListeners()}};zt.styles=m`
|
|
3823
|
+
`;let Ee=At;function Yr(){return x("fx-orderlist",Ee)}Yr();const zt=class zt extends b{constructor(){super(...arguments),this._source=[],this._filteredSource=null,this._target=[],this._filteredTarget=null,this._sourceSelection=[],this._targetSelection=[],this._sourceFilterValue="",this._targetFilterValue="",this._filterListenersAttached=!1,this._optionTemplate=null}static get observedAttributes(){return["source","target","source-key","target-key","filter","filter-by","filter-placeholder","dragdrop","striped","selection-mode","show-select-all","source-label","target-label"]}set source(e){this._source=e,this._filteredSource=null,this.render()}get source(){return this._source}set target(e){this._target=e,this._filteredTarget=null,this.render()}get target(){return this._target}set sourceSelection(e){this._sourceSelection=e,this.render()}get sourceSelection(){return this._sourceSelection}set targetSelection(e){this._targetSelection=e,this.render()}get targetSelection(){return this._targetSelection}get sourceKey(){return this.getAttr("source-key","")}set sourceKey(e){this.setAttribute("source-key",e)}get targetKey(){return this.getAttr("target-key","")}set targetKey(e){this.setAttribute("target-key",e)}get filter(){return this.hasAttr("filter")}set filter(e){this.toggleAttr("filter",e)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(e){this.setAttribute("filter-by",e)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(e){this.setAttribute("filter-placeholder",e)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(e){this.toggleAttr("dragdrop",e)}get striped(){return this.hasAttr("striped")}set striped(e){this.toggleAttr("striped",e)}get selectionMode(){const e=this.getAttr("selection-mode","");return e==="single"||e==="multiple"?e:""}set selectionMode(e){this.setAttribute("selection-mode",e)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(e){this.toggleAttr("show-select-all",e)}get sourceLabel(){return this.getAttr("source-label","Disponíveis")}set sourceLabel(e){this.setAttribute("source-label",e)}get targetLabel(){return this.getAttr("target-label","Selecionados")}set targetLabel(e){this.setAttribute("target-label",e)}get sourceFilterValue(){return this._sourceFilterValue}set sourceFilterValue(e){this._sourceFilterValue=e,this._applySourceFilter(),this._updateListDisplay()}get targetFilterValue(){return this._targetFilterValue}set targetFilterValue(e){this._targetFilterValue=e,this._applyTargetFilter(),this._updateListDisplay()}setOptionTemplate(e){this._optionTemplate=e,this.render()}connectedCallback(){this._parseSourceAttribute(),this._parseTargetAttribute(),super.connectedCallback()}attributeChangedCallback(e,t,r){this.getAttr("source","")!==""&&this._parseSourceAttribute(),this.getAttr("target","")!==""&&this._parseTargetAttribute(),super.attributeChangedCallback(e,t,r)}_parseSourceAttribute(){const e=this.getAttr("source","");if(e)try{this._source=JSON.parse(e),this._filteredSource=null}catch(t){this._source=[]}}_parseTargetAttribute(){const e=this.getAttr("target","");if(e)try{this._target=JSON.parse(e),this._filteredTarget=null}catch(t){this._target=[]}}_applySourceFilter(){if(!this._sourceFilterValue){this._filteredSource=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredSource=this._source.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._sourceFilterValue.toLowerCase())}))}_applyTargetFilter(){if(!this._targetFilterValue){this._filteredTarget=null;return}const e=this.filterBy.split(",").map(t=>t.trim());this._filteredTarget=this._target.filter(t=>e.some(r=>{const a=t[r];return a==null?!1:String(a).toLowerCase().includes(this._targetFilterValue.toLowerCase())}))}_getDisplaySource(){return this._filteredSource||this._source}_getDisplayTarget(){return this._filteredTarget||this._target}_getItemKey(e,t,r){const a=r?this.sourceKey:this.targetKey;return a&&e[a]!=null?String(e[a]):e.id!=null?String(e.id):e.key!=null?String(e.key):e.label!=null?String(e.label):e.name!=null?String(e.name):e.value!=null?String(e.value):String(t)}_getItemLabel(e){const t=["label","name","title","text","value"];for(const r of t)if(e[r]!=null)return String(e[r]);return JSON.stringify(e)}_isSourceSelected(e,t){return this._sourceSelection.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(e,t,!0))}_isTargetSelected(e,t){return this._targetSelection.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(e,t,!1))}_emitMoveToTarget(){this.dispatchEvent(new CustomEvent("move-to-target",{bubbles:!0,composed:!0,detail:{items:[...this._sourceSelection],source:[...this._source],target:[...this._target]}}))}_emitMoveToSource(){this.dispatchEvent(new CustomEvent("move-to-source",{bubbles:!0,composed:!0,detail:{items:[...this._targetSelection],source:[...this._source],target:[...this._target]}}))}_emitSelectionChangeSource(){this.dispatchEvent(new CustomEvent("selection-change-source",{bubbles:!0,composed:!0,detail:{selection:[...this._sourceSelection]}}))}_emitSelectionChangeTarget(){this.dispatchEvent(new CustomEvent("selection-change-target",{bubbles:!0,composed:!0,detail:{selection:[...this._targetSelection]}}))}render(){const e=this._getDisplaySource(),t=this._getDisplayTarget(),r=this.selectionMode,a=r==="multiple"&&this.showSelectAll,o=e.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:e.map((l,p)=>`<li class="list-item${this._isSourceSelected(l,p)?" selected":""}" data-index="${p}" data-list="source" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isSourceSelected(l,p)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(l):h(this._getItemLabel(l))}</span></li>`).join(""),i=t.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:t.map((l,p)=>`<li class="list-item${this._isTargetSelected(l,p)?" selected":""}" data-index="${p}" data-list="target" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isTargetSelected(l,p)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(l):h(this._getItemLabel(l))}</span></li>`).join(""),s=a?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="source" ${this._sourceSelection.length>0&&this._sourceSelection.length===this._source.length?"checked":""} aria-label="Selecionar todos da origem" /> Selecionar Todos</label><span class="selection-count">${this._sourceSelection.length} selecionado(s)</span></div>`:"",n=a?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="target" ${this._targetSelection.length>0&&this._targetSelection.length===this._target.length?"checked":""} aria-label="Selecionar todos do destino" /> Selecionar Todos</label><span class="selection-count">${this._targetSelection.length} selecionado(s)</span></div>`:"";this.setTemplate(`<div class="container"><div class="list-container"><div class="list-label">${h(this.sourceLabel)} (${this._source.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input source-filter" placeholder="'+this.filterPlaceholder+'" value="'+h(this._sourceFilterValue)+'" /></div>':""}${s}<div class="list-wrapper"><ul class="list source-list" role="listbox" tabindex="0">${o}</ul></div></div><div class="controls"><div class="control-group"><button class="control-btn" data-action="move-all-target" part="control-btn" aria-label="Mover todos para destino"><span class="control-btn-icon">»</span></button><button class="control-btn" data-action="move-target" part="control-btn" aria-label="Mover para destino"><span class="control-btn-icon">→</span></button></div><div class="control-group"><button class="control-btn" data-action="move-source" part="control-btn" aria-label="Mover para origem"><span class="control-btn-icon">←</span></button><button class="control-btn" data-action="move-all-source" part="control-btn" aria-label="Mover todos para origem"><span class="control-btn-icon">«</span></button></div></div><div class="list-container"><div class="list-label">${h(this.targetLabel)} (${this._target.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input target-filter" placeholder="'+this.filterPlaceholder+'" value="'+h(this._targetFilterValue)+'" /></div>':""}${n}<div class="list-wrapper"><ul class="list target-list" role="listbox" tabindex="0">${i}</ul></div></div></div>`),this._attachListeners()}_attachListeners(){this._filterListenersAttached||(this._filterListenersAttached=!0,this.root.addEventListener("input",e=>{const t=e.target;if(t.classList.contains("select-all-checkbox")){this._handleSelectAll(t);return}t.classList.contains("source-filter")?this.sourceFilterValue=t.value:t.classList.contains("target-filter")&&(this.targetFilterValue=t.value)}),this.root.addEventListener("click",e=>{const t=e.target,r=t.closest(".control-btn");if(r){switch(r.dataset.action){case"move-target":this._moveToTarget();break;case"move-all-target":this._moveAllToTarget();break;case"move-source":this._moveToSource();break;case"move-all-source":this._moveAllToSource();break}return}const a=t.closest(".list-item");if(!a)return;const o=a.dataset.list==="source",i=Number(a.dataset.index),s=(o?this._getDisplaySource():this._getDisplayTarget())[i];o?this._toggleSourceSelection(s,i):this._toggleTargetSelection(s,i)})),this._updateControlsState()}_handleSelectAll(e){e.dataset.list==="source"?(this._sourceSelection=e.checked?[...this._getDisplaySource()]:[],this._emitSelectionChangeSource()):(this._targetSelection=e.checked?[...this._getDisplayTarget()]:[],this._emitSelectionChangeTarget()),this._updateSelectionDisplay(),this._updateControlsState()}_updateSelectionDisplay(){const e=(t,r,a)=>{t&&t.querySelectorAll(".list-item").forEach(o=>{const i=Number(o.dataset.index),s=r(a()[i],i);o.classList.toggle("selected",s),o.setAttribute("aria-selected",String(s));const n=o.querySelector(".checkbox");n&&(n.checked=s)})};e(this.root.querySelector(".source-list"),(t,r)=>this._isSourceSelected(t,r),()=>this._getDisplaySource()),e(this.root.querySelector(".target-list"),(t,r)=>this._isTargetSelected(t,r),()=>this._getDisplayTarget()),this._updateSelectAllBars()}_updateSelectAllBars(){if(!(this.selectionMode==="multiple"&&this.showSelectAll))return;[{el:this.root.querySelector('.select-all-checkbox[data-list="source"]'),total:this._source.length,sel:this._sourceSelection.length},{el:this.root.querySelector('.select-all-checkbox[data-list="target"]'),total:this._target.length,sel:this._targetSelection.length}].forEach(({el:t,total:r,sel:a})=>{var i;if(!t)return;t.checked=r>0&&a===r;const o=(i=t.closest(".select-all-bar"))==null?void 0:i.querySelector(".selection-count");o&&(o.textContent=`${a} selecionado(s)`)})}_updateControlsState(){this.root.querySelectorAll(".control-btn").forEach(e=>{const t=e.dataset.action;e.disabled=t==="move-target"&&this._sourceSelection.length===0||t==="move-all-target"&&this._source.length===0||t==="move-source"&&this._targetSelection.length===0||t==="move-all-source"&&this._target.length===0})}_moveToTarget(){if(!this._sourceSelection.length)return;const e=[...this._sourceSelection];this._source=this._source.filter(t=>!e.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(t,-1,!0))),this._target=[...this._target,...e],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveToSource(){if(!this._targetSelection.length)return;const e=[...this._targetSelection];this._target=this._target.filter(t=>!e.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(t,-1,!1))),this._source=[...this._source,...e],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_moveAllToTarget(){const e=[...this._source];this._source=[],this._target=[...this._target,...e],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveAllToSource(){const e=[...this._target];this._target=[],this._source=[...this._source,...e],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_toggleSourceSelection(e,t){const r=this.selectionMode||"single",a=this._getItemKey(e,t,!0),o=this._sourceSelection.findIndex(i=>this._getItemKey(i,-1,!0)===a);o>=0?this._sourceSelection.splice(o,1):r==="multiple"?this._sourceSelection.push(e):this._sourceSelection=[e],this._emitSelectionChangeSource(),this._updateSelectionDisplay(),this._updateControlsState()}_toggleTargetSelection(e,t){const r=this.selectionMode||"single",a=this._getItemKey(e,t,!1),o=this._targetSelection.findIndex(i=>this._getItemKey(i,-1,!1)===a);o>=0?this._targetSelection.splice(o,1):r==="multiple"?this._targetSelection.push(e):this._targetSelection=[e],this._emitSelectionChangeTarget(),this._updateSelectionDisplay(),this._updateControlsState()}_updateListDisplay(){var p,f;const e=(p=this.root.querySelector(".source-list"))==null?void 0:p.parentElement,t=(f=this.root.querySelector(".target-list"))==null?void 0:f.parentElement,r=this.root.querySelector(".list-container:first-of-type .list-label"),a=this.root.querySelector(".list-container:last-of-type .list-label");if(!e||!t){this.render();return}const o=this._getDisplaySource(),i=this._getDisplayTarget(),s=this.selectionMode,n=o.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:o.map((_,c)=>`<li class="list-item${this._isSourceSelected(_,c)?" selected":""}" part="list-item" data-index="${c}" data-list="source" role="option" aria-selected="${this._isSourceSelected(_,c)}" tabindex="0">${s?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isSourceSelected(_,c)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(_):h(this._getItemLabel(_))}</span></li>`).join(""),l=i.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:i.map((_,c)=>`<li class="list-item${this._isTargetSelected(_,c)?" selected":""}" part="list-item" data-index="${c}" data-list="target" role="option" aria-selected="${this._isTargetSelected(_,c)}" tabindex="0">${s?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isTargetSelected(_,c)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(_):h(this._getItemLabel(_))}</span></li>`).join("");e.innerHTML=`<ul class="list source-list" role="listbox" tabindex="0">${n}</ul>`,t.innerHTML=`<ul class="list target-list" role="listbox" tabindex="0">${l}</ul>`,r&&(r.textContent=`${this.sourceLabel} (${this._source.length})`),a&&(a.textContent=`${this.targetLabel} (${this._target.length})`),this._updateSelectAllBars(),this._attachListeners()}};zt.styles=m`
|
|
3780
3824
|
:host {
|
|
3781
3825
|
display: block;
|
|
3782
3826
|
font-family: var(--fx-font-family);
|
|
@@ -4034,7 +4078,7 @@
|
|
|
4034
4078
|
aria-expanded="${this.expanded}"
|
|
4035
4079
|
${this.disabled?'aria-disabled="true"':""}>
|
|
4036
4080
|
<span class="header-text" part="header-text">
|
|
4037
|
-
<slot name="header">${
|
|
4081
|
+
<slot name="header">${h(this.header)}</slot>
|
|
4038
4082
|
</span>
|
|
4039
4083
|
<span class="chevron" part="chevron" aria-hidden="true">
|
|
4040
4084
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"
|