@wrrdev/fenix-ui 1.0.5 → 1.0.7
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 +314 -314
- package/dist/.nojekyll +0 -0
- package/dist/components/accordion/accordion.d.ts +72 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -0
- package/dist/components/accordion/accordion.js +277 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.d.ts.map +1 -0
- package/dist/components/accordion/index.js +9 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/calendar/calendar.d.ts +2 -2
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/calendar.js +187 -89
- package/dist/components/calendar/calendar.js.map +1 -1
- package/dist/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/dropdown.js +1 -1
- package/dist/components/dropdown/dropdown.js.map +1 -1
- package/dist/components/knob/index.d.ts +8 -0
- package/dist/components/knob/index.d.ts.map +1 -0
- package/dist/components/knob/index.js +7 -0
- package/dist/components/knob/index.js.map +1 -0
- package/dist/components/knob/knob.d.ts +51 -0
- package/dist/components/knob/knob.d.ts.map +1 -0
- package/dist/components/knob/knob.js +323 -0
- package/dist/components/knob/knob.js.map +1 -0
- package/dist/components/orderlist/index.d.ts +3 -0
- package/dist/components/orderlist/index.d.ts.map +1 -0
- package/dist/components/orderlist/index.js +7 -0
- package/dist/components/orderlist/index.js.map +1 -0
- package/dist/components/orderlist/orderlist.d.ts +78 -0
- package/dist/components/orderlist/orderlist.d.ts.map +1 -0
- package/dist/components/orderlist/orderlist.js +666 -0
- package/dist/components/orderlist/orderlist.js.map +1 -0
- package/dist/components/picklist/index.d.ts +3 -0
- package/dist/components/picklist/index.d.ts.map +1 -0
- package/dist/components/picklist/index.js +7 -0
- package/dist/components/picklist/index.js.map +1 -0
- package/dist/components/picklist/picklist.d.ts +102 -0
- package/dist/components/picklist/picklist.d.ts.map +1 -0
- package/dist/components/picklist/picklist.js +749 -0
- package/dist/components/picklist/picklist.js.map +1 -0
- package/dist/components/tooltip/directive.d.ts +31 -0
- package/dist/components/tooltip/directive.d.ts.map +1 -0
- package/dist/components/tooltip/directive.js +294 -0
- package/dist/components/tooltip/directive.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/components/tooltip/index.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +4 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/core/presets.d.ts.map +1 -1
- package/dist/core/presets.js +48 -9
- package/dist/core/presets.js.map +1 -1
- package/dist/core/tokens.d.ts.map +1 -1
- package/dist/core/tokens.js +4 -4
- package/dist/core/tokens.js.map +1 -1
- package/dist/docs/app.d.ts +3 -25
- package/dist/docs/app.d.ts.map +1 -1
- package/dist/docs/componentes/accordion.doc.d.ts +8 -0
- package/dist/docs/componentes/accordion.doc.d.ts.map +1 -0
- package/dist/docs/componentes/alert.doc.d.ts +8 -0
- package/dist/docs/componentes/alert.doc.d.ts.map +1 -0
- package/dist/docs/componentes/autocomplete.doc.d.ts +8 -0
- package/dist/docs/componentes/autocomplete.doc.d.ts.map +1 -0
- package/dist/docs/componentes/badge.doc.d.ts +8 -0
- package/dist/docs/componentes/badge.doc.d.ts.map +1 -0
- package/dist/docs/componentes/button.doc.d.ts +8 -0
- package/dist/docs/componentes/button.doc.d.ts.map +1 -0
- package/dist/docs/componentes/calendar.doc.d.ts +8 -0
- package/dist/docs/componentes/calendar.doc.d.ts.map +1 -0
- package/dist/docs/componentes/checkbox.doc.d.ts +8 -0
- package/dist/docs/componentes/checkbox.doc.d.ts.map +1 -0
- package/dist/docs/componentes/datepicker.doc.d.ts +8 -0
- package/dist/docs/componentes/datepicker.doc.d.ts.map +1 -0
- package/dist/docs/componentes/dialog.doc.d.ts +8 -0
- package/dist/docs/componentes/dialog.doc.d.ts.map +1 -0
- package/dist/docs/componentes/drawer.doc.d.ts +8 -0
- package/dist/docs/componentes/drawer.doc.d.ts.map +1 -0
- package/dist/docs/componentes/dropdown.doc.d.ts +8 -0
- package/dist/docs/componentes/dropdown.doc.d.ts.map +1 -0
- package/dist/docs/componentes/floatlabel.doc.d.ts +8 -0
- package/dist/docs/componentes/floatlabel.doc.d.ts.map +1 -0
- package/dist/docs/componentes/index.d.ts +10 -0
- package/dist/docs/componentes/index.d.ts.map +1 -0
- package/dist/docs/componentes/input.doc.d.ts +8 -0
- package/dist/docs/componentes/input.doc.d.ts.map +1 -0
- package/dist/docs/componentes/knob.doc.d.ts +8 -0
- package/dist/docs/componentes/knob.doc.d.ts.map +1 -0
- package/dist/docs/componentes/multiselect.doc.d.ts +8 -0
- package/dist/docs/componentes/multiselect.doc.d.ts.map +1 -0
- package/dist/docs/componentes/orderlist.doc.d.ts +8 -0
- package/dist/docs/componentes/orderlist.doc.d.ts.map +1 -0
- package/dist/docs/componentes/pagination.doc.d.ts +8 -0
- package/dist/docs/componentes/pagination.doc.d.ts.map +1 -0
- package/dist/docs/componentes/picklist.doc.d.ts +8 -0
- package/dist/docs/componentes/picklist.doc.d.ts.map +1 -0
- package/dist/docs/componentes/progress.doc.d.ts +8 -0
- package/dist/docs/componentes/progress.doc.d.ts.map +1 -0
- package/dist/docs/componentes/radio.doc.d.ts +8 -0
- package/dist/docs/componentes/radio.doc.d.ts.map +1 -0
- package/dist/docs/componentes/select.doc.d.ts +8 -0
- package/dist/docs/componentes/select.doc.d.ts.map +1 -0
- package/dist/docs/componentes/skeleton.doc.d.ts +8 -0
- package/dist/docs/componentes/skeleton.doc.d.ts.map +1 -0
- package/dist/docs/componentes/spinner.doc.d.ts +8 -0
- package/dist/docs/componentes/spinner.doc.d.ts.map +1 -0
- package/dist/docs/componentes/switch.doc.d.ts +8 -0
- package/dist/docs/componentes/switch.doc.d.ts.map +1 -0
- package/dist/docs/componentes/table.doc.d.ts +8 -0
- package/dist/docs/componentes/table.doc.d.ts.map +1 -0
- package/dist/docs/componentes/tabs.doc.d.ts +8 -0
- package/dist/docs/componentes/tabs.doc.d.ts.map +1 -0
- package/dist/docs/componentes/textarea.doc.d.ts +8 -0
- package/dist/docs/componentes/textarea.doc.d.ts.map +1 -0
- package/dist/docs/componentes/toast.doc.d.ts +8 -0
- package/dist/docs/componentes/toast.doc.d.ts.map +1 -0
- package/dist/docs/componentes/tooltip.doc.d.ts +25 -0
- package/dist/docs/componentes/tooltip.doc.d.ts.map +1 -0
- package/dist/docs/shared.d.ts +9 -0
- package/dist/docs/shared.d.ts.map +1 -0
- package/dist/docs/types.d.ts +47 -0
- package/dist/docs/types.d.ts.map +1 -0
- package/dist/fenix-ui.umd.min.js +815 -157
- package/dist/fenix-ui2.esm.js +2522 -103
- package/dist/fenix-ui2.esm.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/package.json +212 -187
package/dist/fenix-ui.umd.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(w){typeof define=="function"&&define.amd?define(w):w()})(function(){"use strict";var Ft=w=>{throw TypeError(w)};var Le=(w,m,p)=>m.has(w)||Ft("Cannot "+p);var Yt=(w,m,p)=>m.has(w)?Ft("Cannot add the same private member more than once"):m instanceof WeakSet?m.add(w):m.set(w,p);var Ht=(w,m,p)=>(Le(w,m,"access private method"),p);var L,Ot;const w=new Map;function m(v){return w.set(v.name,v),v}m({name:"fenix",label:"Fenix (padrão)",tokens:{}}),m({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"}}}),m({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"}}}),m({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"}}}),m({name:"shun",label:"Shun",tokens:{color:{primary:"#db2777",secondary:"#f472b6",info:"#ec4899",warning:"#c026d3"},radius:{sm:"10px",md:"14px",lg:"20px"}}}),m({name:"ikki",label:"Ikki",tokens:{color:{primary:"#ea580c",secondary:"#fb923c",danger:"#dc2626",warning:"#f59e0b"},radius:{sm:"2px",md:"4px",lg:"6px"}}}),m({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 p(v,...t){return v.reduce((e,r,s)=>e+r+(s<t.length?String(t[s]):""),"")}const lt=class lt extends HTMLElement{static get observedAttributes(){return[]}constructor(){super(),this.root=this.attachShadow({mode:"open"})}attributeChangedCallback(){this.isConnected&&this.render()}connectedCallback(){this.render()}disconnectedCallback(){}hasAttr(t){return this.hasAttribute(t)}getAttr(t,e=""){var r;return(r=this.getAttribute(t))!=null?r:e}toggleAttr(t,e){e?this.setAttribute(t,""):this.removeAttribute(t)}setTemplate(t){const e=this.constructor.styles;this.root.innerHTML=`<style>${e}</style>${t}`}};lt.styles="";let f=lt;function b(v,t){var e;return typeof customElements!="undefined"&&!customElements.get(v)&&customElements.define(v,t),(e=customElements.get(v))!=null?e:t}const ct=class ct extends f{constructor(){super(...arguments),this.spawnRipple=t=>{if(this.hasAttr("disabled")||this.hasAttr("loading"))return;const e=getComputedStyle(this).getPropertyValue("--fx-effect-ripple").trim();if(e==="0"||e==="false")return;const r=this.root.querySelector(".btn");if(!r)return;const s=r.getBoundingClientRect(),i=Math.max(s.width,s.height),a=document.createElement("span");a.className="btn__ripple",a.style.width=a.style.height=`${i}px`,a.style.left=`${t.clientX-s.left-i/2}px`,a.style.top=`${t.clientY-s.top-i/2}px`,r.appendChild(a),a.addEventListener("animationend",()=>a.remove())}}static get observedAttributes(){return["variant","size","disabled","loading","type","full"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get loading(){return this.hasAttr("loading")}set loading(t){this.toggleAttr("loading",!!t)}render(){const t=this.hasAttr("loading"),e=this.hasAttr("disabled")||t,r=this.getAttr("type","button");this.setTemplate(`
|
|
2
2
|
<button class="btn" part="button" type="${r}">
|
|
3
3
|
<span class="btn__icon" part="icon"><slot name="icon"></slot></span>
|
|
4
4
|
<span class="btn__label" part="label"><slot></slot></span>
|
|
5
5
|
${t?'<span class="btn__spinner" aria-hidden="true"></span>':""}
|
|
6
6
|
</button>
|
|
7
|
-
`);const s=this.root.querySelector(".btn");if(!s)return;const
|
|
7
|
+
`);const s=this.root.querySelector(".btn");if(!s)return;const i=s.querySelector(".btn__icon slot"),a=this.root.querySelector(".btn__icon"),o=!!(i!=null&&i.assignedNodes({flatten:!0}).some(n=>{var c;return n.nodeType===Node.ELEMENT_NODE||((c=n.textContent)!=null?c:"").trim()!==""}));a==null||a.toggleAttribute("hidden",!o),e?(s.setAttribute("disabled",""),s.setAttribute("aria-disabled","true")):(s.removeAttribute("disabled"),s.removeAttribute("aria-disabled")),t?s.setAttribute("aria-busy","true"):s.removeAttribute("aria-busy")}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerdown",this.spawnRipple)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("pointerdown",this.spawnRipple)}};ct.styles=p`
|
|
8
8
|
:host {
|
|
9
9
|
display: inline-block;
|
|
10
10
|
vertical-align: middle;
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
@media (prefers-reduced-motion: reduce) {
|
|
105
105
|
.btn__ripple { display: none; }
|
|
106
106
|
}
|
|
107
|
-
`;let
|
|
107
|
+
`;let T=ct;function Xt(){return b("fx-button",T)}Xt();const dt=class dt extends f{static get observedAttributes(){return["variant","round"]}render(){this.setTemplate('<span class="badge" part="badge"><slot></slot></span>')}};dt.styles=p`
|
|
108
108
|
:host {
|
|
109
109
|
display: inline-flex;
|
|
110
110
|
vertical-align: middle;
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
:host([variant='danger']) .badge { background: var(--fx-color-danger); color: #fff; border-color: transparent; }
|
|
130
130
|
:host([variant='info']) .badge { background: var(--fx-color-info); color: #fff; border-color: transparent; }
|
|
131
131
|
:host(:not([round])) .badge { border-radius: var(--fx-radius-sm); }
|
|
132
|
-
`;let
|
|
132
|
+
`;let D=dt;function Ut(){return b("fx-badge",D)}Ut();const ht=class ht extends f{static get observedAttributes(){return["size"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}render(){this.setTemplate('<span class="spinner" part="spinner" role="status" aria-label="Carregando"></span>')}};ht.styles=p`
|
|
133
133
|
:host {
|
|
134
134
|
display: inline-block;
|
|
135
135
|
vertical-align: middle;
|
|
@@ -150,22 +150,22 @@
|
|
|
150
150
|
@media (prefers-reduced-motion: reduce) {
|
|
151
151
|
.spinner { animation-duration: 2.5s; }
|
|
152
152
|
}
|
|
153
|
-
`;let
|
|
153
|
+
`;let M=ht;function Wt(){return b("fx-spinner",M)}Wt();const ut=class ut extends f{static get observedAttributes(){return["size","disabled","placeholder","searchable","clearable","error","success"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get options(){return[...this.querySelectorAll("option")].map(t=>{var e,r,s,i,a;return{value:(s=(r=t.getAttribute("value"))!=null?r:(e=t.textContent)==null?void 0:e.trim())!=null?s:"",label:(a=(i=t.textContent)==null?void 0:i.trim())!=null?a:""}})}connectedCallback(){super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=t=>{this.hasAttr("open")&&(t.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.observer)==null||t.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}select(t){this.value=t,this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){var d,g,y,S,k,z,_;const t=this.hasAttr("open"),e=this.root.querySelector(".search"),r=(d=e==null?void 0:e.value)!=null?d:"",s=e!=null&&this.root.activeElement===e,i=s?e.selectionStart:null,a=this.options;let o=this.getAttr("value");if(!o){const x=this.querySelector("option[selected]");o=(S=(y=x==null?void 0:x.getAttribute("value"))!=null?y:(g=x==null?void 0:x.textContent)==null?void 0:g.trim())!=null?S:""}const n=(z=(k=a.find(x=>x.value===o))==null?void 0:k.label)!=null?z:"",c=this.getAttr("placeholder","Selecione…"),u=r?a.filter(x=>x.label.toLowerCase().includes(r.toLowerCase())):a;this.setTemplate(`
|
|
154
154
|
<span class="trigger" part="trigger" role="button" tabindex="${this.disabled?-1:0}" aria-haspopup="listbox" aria-expanded="${t}">
|
|
155
|
-
<span class="${
|
|
155
|
+
<span class="${n?"label":"placeholder"}">${n||c}</span>
|
|
156
156
|
<span class="actions">
|
|
157
|
-
${this.hasAttr("clearable")&&
|
|
157
|
+
${this.hasAttr("clearable")&&o?'<button type="button" class="clear" part="clear" aria-label="Limpar">×</button>':""}
|
|
158
158
|
<span class="caret">▼</span>
|
|
159
159
|
</span>
|
|
160
160
|
</span>
|
|
161
161
|
<div class="panel" part="panel" role="listbox">
|
|
162
162
|
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${this.getAttr("search-placeholder","Pesquisar…")}">`:""}
|
|
163
|
-
${
|
|
164
|
-
<button type="button" class="opt" role="option" data-value="${
|
|
165
|
-
aria-selected="${
|
|
166
|
-
${
|
|
163
|
+
${u.map(x=>`
|
|
164
|
+
<button type="button" class="opt" role="option" data-value="${x.value}"
|
|
165
|
+
aria-selected="${x.value===o}">${x.label}</button>`).join("")}
|
|
166
|
+
${u.length===0?`<div class="empty">${this.getAttr("no-results","Nenhum resultado")}</div>`:""}
|
|
167
167
|
</div>
|
|
168
|
-
`),t&&this.setAttribute("open","");const
|
|
168
|
+
`),t&&this.setAttribute("open","");const l=this.root.querySelector(".search");if(l&&(l.value=r,l.addEventListener("input",()=>this.render()),l.addEventListener("click",x=>x.stopPropagation()),s)){l.focus();try{l.setSelectionRange(i,i)}catch(x){}}const h=this.root.querySelector(".trigger");h&&(this.disabled&&h.setAttribute("aria-disabled","true"),h.addEventListener("click",x=>{var Rt;this.disabled||x.target.closest(".clear")||(this.toggleAttribute("open"),this.render(),(Rt=this.root.querySelector(".search"))==null||Rt.focus())}),h.addEventListener("keydown",x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),h.click())}),(_=this.root.querySelector(".clear"))==null||_.addEventListener("click",x=>{x.stopPropagation(),this.value="",this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:""}}))}),this.root.querySelectorAll(".opt").forEach(x=>{x.addEventListener("click",()=>this.select(x.dataset.value))}))}};ut.styles=p`
|
|
169
169
|
:host {
|
|
170
170
|
display: inline-block;
|
|
171
171
|
vertical-align: middle;
|
|
@@ -307,14 +307,14 @@
|
|
|
307
307
|
}
|
|
308
308
|
.clear:hover { color: var(--fx-color-danger); }
|
|
309
309
|
.clear[hidden] { display: none; }
|
|
310
|
-
`;let
|
|
310
|
+
`;let q=ut;function Jt(){return b("fx-select",q)}Jt();const pt=class pt extends f{static get observedAttributes(){return["type","size","placeholder","disabled","readonly","min","max","step"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}render(){const t=this.getAttr("type","text"),e=this.getAttr("placeholder"),r=this.hasAttr("readonly"),s=this.hasAttr("disabled"),i=this.getAttr("min"),a=this.getAttr("max"),o=this.getAttr("step");this.setTemplate(`
|
|
311
311
|
${this.hasAttr("clearable")?'<div class="wrap">':""}
|
|
312
312
|
<input class="field" part="input" type="${t}"
|
|
313
313
|
${e?`placeholder="${e}"`:""}
|
|
314
|
-
${
|
|
314
|
+
${i?`min="${i}"`:""} ${a?`max="${a}"`:""} ${o?`step="${o}"`:""}
|
|
315
315
|
/>
|
|
316
316
|
${this.hasAttr("clearable")?'<button type="button" class="clear" part="clear" aria-label="Limpar" tabindex="-1">×</button></div>':""}
|
|
317
|
-
`);const
|
|
317
|
+
`);const n=this.root.querySelector(".field");if(!n)return;n.value=this.getAttr("value"),s&&n.setAttribute("disabled",""),r&&n.setAttribute("readonly","");const c=h=>{this.value=n.value,this.dispatchEvent(new CustomEvent(h,{bubbles:!0,composed:!0,detail:{value:n.value}}))};n.addEventListener("input",h=>{h.stopPropagation(),c("input")}),n.addEventListener("change",h=>{h.stopPropagation(),c("change")});const u=this.root.querySelector(".clear"),l=()=>{u==null||u.toggleAttribute("hidden",n.value==="")};l(),u==null||u.addEventListener("click",()=>{n.value="",l(),c("input"),c("change"),n.focus()}),n.addEventListener("input",l)}};pt.styles=p`
|
|
318
318
|
:host {
|
|
319
319
|
display: inline-block;
|
|
320
320
|
vertical-align: middle;
|
|
@@ -385,13 +385,13 @@
|
|
|
385
385
|
}
|
|
386
386
|
.clear:hover { color: var(--fx-color-danger); }
|
|
387
387
|
.clear[hidden] { display: none; }
|
|
388
|
-
`;let
|
|
388
|
+
`;let I=pt;function Gt(){return b("fx-input",I)}Gt();const ft=class ft extends f{static get observedAttributes(){return["checked","disabled","size"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get checked(){return this.hasAttr("checked")}set checked(t){this.toggleAttr("checked",!!t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}render(){this.setTemplate(`
|
|
389
389
|
<button class="switch" part="switch" type="button" role="switch"
|
|
390
390
|
aria-checked="${this.checked}" ${this.hasAttr("disabled")?"disabled":""}>
|
|
391
391
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
392
392
|
<span class="label" part="label"><slot></slot></span>
|
|
393
393
|
</button>
|
|
394
|
-
`);const t=this.root.querySelector(".switch");t&&t.addEventListener("click",()=>{this.hasAttr("disabled")||(this.checked=!this.checked,t.setAttribute("aria-checked",String(this.checked)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked}})))})}};
|
|
394
|
+
`);const t=this.root.querySelector(".switch");t&&t.addEventListener("click",()=>{this.hasAttr("disabled")||(this.checked=!this.checked,t.setAttribute("aria-checked",String(this.checked)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked}})))})}};ft.styles=p`
|
|
395
395
|
:host {
|
|
396
396
|
display: inline-flex;
|
|
397
397
|
vertical-align: middle;
|
|
@@ -445,14 +445,14 @@
|
|
|
445
445
|
:host([size='lg']) .track { width: 48px; height: 26px; }
|
|
446
446
|
:host([size='lg']) .thumb { top: 4px; left: 4px; width: 18px; height: 18px; }
|
|
447
447
|
:host([size='lg'][checked]) .thumb { transform: translateX(22px); }
|
|
448
|
-
`;let N=
|
|
448
|
+
`;let N=ft;function Qt(){return b("fx-switch",N)}Qt();const gt=class gt extends f{constructor(){super(...arguments),this.selected=new Set}static get observedAttributes(){return["disabled","placeholder"]}get values(){const t=this.getAttr("values");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}set values(t){this.setAttribute("values",t.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get options(){return[...this.querySelectorAll("option")].map(t=>{var e,r,s,i,a;return{value:(s=(r=t.getAttribute("value"))!=null?r:(e=t.textContent)==null?void 0:e.trim())!=null?s:"",label:(a=(i=t.textContent)==null?void 0:i.trim())!=null?a:""}})}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=t=>{this.hasAttr("open")&&(t.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.observer)==null||t.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(t){this.selected.has(t)?this.selected.delete(t):this.selected.add(t),this.commit()}render(){var c,u,l,h;const t=this.hasAttr("open"),e=(u=(c=this.root.querySelector(".search"))==null?void 0:c.value)!=null?u:"",r=this.options;for(const d of[...this.selected])r.some(g=>g.value===d)||this.selected.delete(d);const s=r.filter(d=>this.selected.has(d.value)),i=this.getAttr("placeholder","Selecione…"),a=e?r.filter(d=>d.label.toLowerCase().includes(e.toLowerCase())):r;this.setTemplate(`
|
|
449
449
|
<span class="trigger" part="trigger" role="button" tabindex="${this.disabled?-1:0}" aria-haspopup="listbox" aria-expanded="${t}" aria-disabled="${this.disabled}">
|
|
450
450
|
<span class="lead">
|
|
451
451
|
${s.length?s.map(d=>`
|
|
452
452
|
<span class="chip" data-value="${d.value}">
|
|
453
453
|
${d.label}
|
|
454
454
|
<span class="chip__x" role="button" aria-label="Remover ${d.label}">×</span>
|
|
455
|
-
</span>`).join(""):`<span class="placeholder">${
|
|
455
|
+
</span>`).join(""):`<span class="placeholder">${i}</span>`}
|
|
456
456
|
</span>
|
|
457
457
|
<span class="trigger-right">
|
|
458
458
|
${this.hasAttr("clearable")&&s.length?'<button type="button" class="icon-btn clear" part="clear" aria-label="Limpar seleção">×</button>':""}
|
|
@@ -474,7 +474,7 @@
|
|
|
474
474
|
${a.length===0?`<li class="empty">${this.getAttr("no-results","Nenhum resultado")}</li>`:""}
|
|
475
475
|
</ul>
|
|
476
476
|
</div>
|
|
477
|
-
`),t&&this.setAttribute("open","");const
|
|
477
|
+
`),t&&this.setAttribute("open","");const o=this.root.querySelector(".search");o&&(o.value=e,o.addEventListener("input",()=>{var y;const d=(y=o.selectionStart)!=null?y:o.value.length;this.render();const g=this.root.querySelector(".search");g&&(g.focus(),g.setSelectionRange(d,d))}),o.addEventListener("click",d=>d.stopPropagation()));const n=this.root.querySelector(".trigger");n&&(n.addEventListener("click",d=>{if(!this.disabled&&!d.target.closest(".clear")&&!d.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",d=>{this.disabled||(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}),(l=this.root.querySelector(".clear"))==null||l.addEventListener("click",d=>{d.stopPropagation(),this.selected.clear(),this.commit()}),(h=this.root.querySelector(".clear-all"))==null||h.addEventListener("click",d=>{d.stopPropagation(),this.selected.clear(),this.commit()}),this.root.querySelectorAll(".chip").forEach(d=>{var g;(g=d.querySelector(".chip__x"))==null||g.addEventListener("click",y=>{y.stopPropagation(),this.toggleValue(d.dataset.value)})}),this.root.querySelectorAll(".opt").forEach(d=>{d.addEventListener("click",()=>this.toggleValue(d.dataset.value))}))}};gt.styles=p`
|
|
478
478
|
:host {
|
|
479
479
|
display: inline-block;
|
|
480
480
|
vertical-align: middle;
|
|
@@ -689,96 +689,144 @@
|
|
|
689
689
|
.opt[aria-selected='true'] .box::after { content: '✓'; }
|
|
690
690
|
.empty { padding: var(--fx-space-md); color: var(--fx-text-muted); text-align: center; }
|
|
691
691
|
:host([disabled]) .trigger { opacity: 0.55; cursor: not-allowed; background: var(--fx-surface-surface-hover); }
|
|
692
|
-
`;let
|
|
692
|
+
`;let j=gt;function Zt(){return b("fx-multiselect",j)}Zt();const A=(v,t,e)=>v*1e4+t*100+e;function C(v){const t=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/.exec(v.trim());if(!t)return null;const e=+t[1],r=t[2]?+t[2]:1,s=t[3]?+t[3]:null;return s!==null?{lo:A(e,r,s),hi:A(e,r,s)}:t[2]?{lo:A(e,r,1),hi:A(e,r,31)}:{lo:A(e,1,1),hi:A(e,12,31)}}const bt=class bt extends f{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 t=this.getAttr("mode");return t==="range"||t==="multiple"?t:this.hasAttr("range")?"range":"single"}set mode(t){this.setAttribute("mode",t)}get range(){return this.mode==="range"}set range(t){this.toggleAttr("range",!!t)}get values(){const t=this.getAttr("values");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}set values(t){this.setAttribute("values",t.join(","))}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}bounds(){return{min:C(this.getAttr("min","")),max:C(this.getAttr("max",""))}}locale(){return this.getAttr("locale","pt-BR")}fmt(t,e){try{return new Intl.DateTimeFormat(this.locale(),t).format(e)}catch(r){return new Intl.DateTimeFormat("pt-BR",t).format(e)}}dayDisabled(t,e,r){const{min:s,max:i}=this.bounds(),a=A(t,e+1,r);return s!==null&&a<s.lo||i!==null&&a>i.hi}monthDisabled(t,e){const{min:r,max:s}=this.bounds(),i=A(t,e,1),a=A(t,e,31);return r!==null&&a<r.lo||s!==null&&i>s.hi}yearDisabled(t){const{min:e,max:r}=this.bounds(),s=A(t,1,1),i=A(t,12,31);return e!==null&&i<e.lo||r!==null&&s>r.hi}dayKeyOf(t){return A(t.getFullYear(),t.getMonth()+1,t.getDate())}keyToDate(t){return new Date(Math.floor(t/1e4),Math.floor(t/100)%100-1,t%100)}iso(t){const e=this.keyToDate(t),r=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${r(e.getMonth()+1)}-${r(e.getDate())}`}selection(){const t=new Set(this.values.map(r=>{var s,i;return(i=(s=C(r))==null?void 0:s.lo)!=null?i:0}).filter(Boolean));if(this.mode==="range"){let r=this.pickStart,s=this.pickEnd;const i=C(this.getAttr("start","")),a=C(this.getAttr("end",""));return r===null&&i&&(r=i.lo),s===null&&a&&(s=a.lo),{start:r,end:s,single:null,multi:t}}if(this.mode==="multiple")return{start:null,end:null,single:null,multi:t};const e=C(this.getAttr("value",""));return{start:null,end:null,single:e?e.lo:null,multi:t}}emit(){if(this.mode==="range"){const t={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",t.start),this.setAttribute("end",t.end),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:t}))}else if(this.mode==="multiple"){const t=this.values;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:t}}))}else{const t=this.getAttr("value");this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}}))}}pickDay(t){if(this.mode==="range"){if(this.pickStart===null||this.pickEnd!==null){this.pickStart=t,this.pickEnd=null,this.setAttribute("start",this.iso(t)),this.removeAttribute("end"),this.render();return}t<this.pickStart?[this.pickStart,this.pickEnd]=[t,this.pickStart]:this.pickEnd=t,this.emit()}else if(this.mode==="multiple"){const e=new Set(this.values),r=this.iso(t);e.has(r)?e.delete(r):e.add(r),this.values=[...e].sort(),this.emit()}else this.value=this.iso(t),this.emit();this.render()}navigate(t){if(this.view==="days"){const e=new Date(this.cursor.y,this.cursor.m+t,1);this.cursor={y:e.getFullYear(),m:e.getMonth()}}else this.view==="months"?this.cursor.y+=t:this.cursor.y+=t*12;this.render()}render(){const t=this.dayKeyOf(new Date),e=this.selection(),r=this.locale(),s={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 i="";if(this.view==="days")i=[...Array(7)].map((c,u)=>this.fmt({weekday:"short"},new Date(2024,8,1+u))).map(c=>`<span class="wd">${c}</span>`).join("")+this.daysHtml(t,e,r);else if(this.view==="months")i=[...Array(12)].map((n,c)=>{const u=this.monthDisabled(this.cursor.y,c+1);return`<button type="button" class="cell" data-month="${c}" ${u?"disabled":""}>${this.fmt({month:"short"},new Date(this.cursor.y,c,1))}</button>`}).join("");else{const n=Math.floor(this.cursor.y/12)*12;i=[...Array(12)].map((c,u)=>{const l=n+u,h=this.yearDisabled(l);return`<button type="button" class="cell" data-year="${l}" ${h?"disabled":""}>${l}</button>`}).join("")}const a=this.view==="days"?'data-goto="months"':this.view==="months"?'data-goto="years"':"";this.setTemplate(`
|
|
693
693
|
<div class="head">
|
|
694
694
|
<button type="button" class="nav" data-nav="-1" aria-label="Anterior">‹</button>
|
|
695
695
|
<button type="button" class="title" part="title" ${a}>${s[this.view]}</button>
|
|
696
696
|
<button type="button" class="nav" data-nav="1" aria-label="Próximo">›</button>
|
|
697
697
|
</div>
|
|
698
|
-
<div class="grid ${this.view}">${
|
|
699
|
-
`),this.root.querySelectorAll("[data-nav]").forEach(
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
698
|
+
<div class="grid ${this.view}">${i}</div>
|
|
699
|
+
`),this.root.querySelectorAll("[data-nav]").forEach(n=>n.addEventListener("click",()=>this.navigate(Number(n.dataset.nav))));const o=this.root.querySelector("[data-goto]");o==null||o.addEventListener("click",()=>{this.view=o.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(t,e,r){const{y:s,m:i}=this.cursor,a=new Date(s,i,1).getDay(),o=new Date(s,i+1,0).getDate(),n=new Date(s,i,0).getDate();let c="";for(let u=a-1;u>=0;u--)c+=`<span class="cell muted">${n-u}</span>`;for(let u=1;u<=o;u++){const l=A(s,i+1,u),h=e.single===l||e.start===l||e.end===l||e.multi.has(l),d=e.start!==null&&e.end!==null&&l>e.start&&l<e.end,g=["cell",h?"sel":"",d?"in-range":"",l===t?"today":""].filter(Boolean).join(" ");c+=`<button type="button" class="${g}" data-day="${l}" ${this.dayDisabled(s,i,u)?"disabled":""}>${u}</button>`}return c}};bt.styles=p`
|
|
700
|
+
:host {
|
|
701
|
+
display: inline-block;
|
|
702
|
+
font-family: var(--fx-font-family);
|
|
703
|
+
font-size: var(--fx-font-size);
|
|
704
|
+
color: var(--fx-text-default);
|
|
705
|
+
background: var(--fx-surface-background);
|
|
706
|
+
border: 1px solid var(--fx-border-default);
|
|
707
|
+
border-radius: var(--fx-radius-md);
|
|
708
|
+
box-shadow: var(--fx-shadow-sm);
|
|
709
|
+
padding: var(--fx-space-sm);
|
|
710
|
+
user-select: none;
|
|
711
|
+
}
|
|
712
|
+
:host([disabled]) {
|
|
713
|
+
opacity: 0.55;
|
|
714
|
+
pointer-events: none;
|
|
715
|
+
}
|
|
716
|
+
.head {
|
|
717
|
+
display: flex;
|
|
718
|
+
height: 48px;
|
|
719
|
+
align-items: center;
|
|
720
|
+
justify-content: space-between;
|
|
721
|
+
gap: var(--fx-space-xs);
|
|
722
|
+
margin-bottom: var(--fx-space-xs);
|
|
723
|
+
border-bottom: 1px solid var(--fx-border-default);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
.title {
|
|
727
|
+
min-width: 24px;
|
|
728
|
+
border: none;
|
|
729
|
+
background: none;
|
|
730
|
+
color: var(--fx-text-default);
|
|
731
|
+
cursor: pointer;
|
|
732
|
+
font: inherit;
|
|
733
|
+
border-radius: var(--fx-radius-sm);
|
|
734
|
+
}
|
|
735
|
+
.nav {
|
|
714
736
|
display: flex;
|
|
715
737
|
align-items: center;
|
|
716
|
-
justify-content: space-between;
|
|
717
|
-
gap: var(--fx-space-xs);
|
|
718
|
-
margin-bottom: var(--fx-space-xs);
|
|
719
|
-
}
|
|
720
|
-
.nav,
|
|
721
|
-
.title {
|
|
722
|
-
border: none;
|
|
723
|
-
background: none;
|
|
724
|
-
color: var(--fx-text-default);
|
|
725
|
-
cursor: pointer;
|
|
726
|
-
font: inherit;
|
|
727
|
-
border-radius: var(--fx-radius-sm);
|
|
728
|
-
padding: var(--fx-space-3xs, 4px) var(--fx-space-xs);
|
|
729
|
-
}
|
|
730
|
-
.nav:hover, .title:hover { background: var(--fx-surface-surface-hover); }
|
|
731
|
-
.title { font-weight: var(--fx-font-weight); text-transform: capitalize; flex: 1; }
|
|
732
|
-
.grid {
|
|
733
|
-
display: grid;
|
|
734
|
-
grid-template-columns: repeat(7, 34px);
|
|
735
|
-
gap: 2px;
|
|
736
|
-
}
|
|
737
|
-
.grid.months, .grid.years { grid-template-columns: repeat(4, minmax(52px, 1fr)); }
|
|
738
|
-
.wd {
|
|
739
|
-
text-align: center;
|
|
740
|
-
color: var(--fx-text-muted);
|
|
741
|
-
font-size: calc(var(--fx-font-size) - 2px);
|
|
742
|
-
padding: var(--fx-space-3xs, 4px) 0;
|
|
743
|
-
text-transform: capitalize;
|
|
744
|
-
}
|
|
745
|
-
.cell {
|
|
746
|
-
position: relative;
|
|
747
|
-
border: none;
|
|
748
|
-
background: none;
|
|
749
|
-
font: inherit;
|
|
750
|
-
color: var(--fx-text-default);
|
|
751
|
-
height: 32px;
|
|
752
|
-
border-radius: var(--fx-radius-sm);
|
|
753
|
-
cursor: pointer;
|
|
754
|
-
display: inline-flex;
|
|
755
|
-
align-items: center;
|
|
756
738
|
justify-content: center;
|
|
739
|
+
font-size: 20px;
|
|
740
|
+
border: none;
|
|
741
|
+
background: none;
|
|
742
|
+
color: var(--fx-text-muted);
|
|
743
|
+
cursor: pointer;
|
|
744
|
+
border-radius: var(--fx-radius-sm);
|
|
757
745
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
746
|
+
.nav:hover,
|
|
747
|
+
.title:hover {
|
|
748
|
+
background: var(--fx-surface-surface-hover);
|
|
749
|
+
}
|
|
750
|
+
.title {
|
|
751
|
+
padding: var(--fx-space-3xs, 4px) var(--fx-space-xs);
|
|
752
|
+
font-weight: var(--fx-font-weight);
|
|
753
|
+
text-transform: capitalize;
|
|
754
|
+
flex: 1;
|
|
755
|
+
}
|
|
756
|
+
.grid {
|
|
757
|
+
display: grid;
|
|
758
|
+
grid-template-columns: repeat(7, 34px);
|
|
759
|
+
gap: 2px;
|
|
760
|
+
}
|
|
761
|
+
.grid.months,
|
|
762
|
+
.grid.years {
|
|
763
|
+
grid-template-columns: repeat(4, minmax(52px, 1fr));
|
|
764
|
+
}
|
|
765
|
+
.wd {
|
|
766
|
+
text-align: center;
|
|
767
|
+
color: var(--fx-text-muted);
|
|
768
|
+
font-size: calc(var(--fx-font-size) - 2px);
|
|
769
|
+
padding: var(--fx-space-3xs, 4px) 0;
|
|
770
|
+
text-transform: capitalize;
|
|
771
|
+
}
|
|
772
|
+
.cell {
|
|
773
|
+
position: relative;
|
|
774
|
+
border: none;
|
|
775
|
+
background: none;
|
|
776
|
+
font: inherit;
|
|
777
|
+
color: var(--fx-text-default);
|
|
778
|
+
height: 32px;
|
|
779
|
+
border-radius: var(--fx-radius-sm);
|
|
780
|
+
cursor: pointer;
|
|
781
|
+
display: inline-flex;
|
|
782
|
+
align-items: center;
|
|
783
|
+
justify-content: center;
|
|
784
|
+
}
|
|
785
|
+
.cell:hover {
|
|
786
|
+
background: color-mix(
|
|
787
|
+
in srgb,
|
|
788
|
+
var(--fx-color-primary) 12%,
|
|
789
|
+
transparent
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
.cell.muted {
|
|
793
|
+
color: var(--fx-text-disabled);
|
|
794
|
+
}
|
|
795
|
+
.cell.today::after {
|
|
796
|
+
content: "";
|
|
797
|
+
position: absolute;
|
|
798
|
+
bottom: 3px;
|
|
799
|
+
width: 4px;
|
|
800
|
+
height: 4px;
|
|
801
|
+
border-radius: var(--fx-radius-full);
|
|
802
|
+
background: var(--fx-color-primary);
|
|
803
|
+
}
|
|
804
|
+
.cell.sel {
|
|
805
|
+
background: var(--fx-color-primary);
|
|
806
|
+
color: #fff;
|
|
807
|
+
font-weight: var(--fx-font-weight);
|
|
808
|
+
}
|
|
809
|
+
.cell.sel::after {
|
|
810
|
+
background: #fff;
|
|
811
|
+
}
|
|
812
|
+
.cell.in-range {
|
|
813
|
+
background: color-mix(
|
|
814
|
+
in srgb,
|
|
815
|
+
var(--fx-color-primary) 16%,
|
|
816
|
+
transparent
|
|
817
|
+
);
|
|
818
|
+
border-radius: 0;
|
|
819
|
+
}
|
|
820
|
+
.grid.months .cell,
|
|
821
|
+
.grid.years .cell {
|
|
822
|
+
height: 40px;
|
|
823
|
+
}
|
|
824
|
+
.cell[disabled] {
|
|
825
|
+
opacity: 0.35;
|
|
826
|
+
cursor: not-allowed;
|
|
827
|
+
pointer-events: none;
|
|
828
|
+
}
|
|
829
|
+
`;let V=bt;function te(){return b("fx-calendar",V)}te();const xt=class xt extends f{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"]}get mode(){const t=this.getAttr("mode","single");return["single","range","multiple"].includes(t)?t:"single"}set mode(t){this.setAttribute("mode",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}get values(){const t=this.getAttr("values");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}set values(t){this.setAttribute("values",t.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}connectedCallback(){super.connectedCallback(),this.docListener=t=>{this.hasAttr("open")&&(t.composedPath().includes(this)||this.removeAttribute("open"))},document.addEventListener("click",this.docListener)}disconnectedCallback(){super.disconnectedCallback(),this.docListener&&document.removeEventListener("click",this.docListener)}formatDate(t){if(!t)return"";const e=this.getAttr("format");if(!e)return t.split("T")[0];const[r,s]=t.split("T"),[i="",a="",o=""]=r.split("-"),[n="00",c="00",u="00"]=(s!=null?s:"").split(":");return e.replace(/yyyy/gi,"").replace(/MM/g,"").replace(/mm/g,"").replace(/dd/gi,"").replace(/HH/g,"").replace(/SS/gi,"").replace(/\u0001/g,i).replace(/\u0002/g,a).replace(/\u0003/g,o).replace(/\u0004/g,n).replace(/\u0005/g,c).replace(/\u0006/g,u)}displayText(){if(this.mode==="range"){const e=this.getAttr("start"),r=this.getAttr("end");if(this.hasAttr("show-time"),!e&&!r)return"";if(this.hasAttr("show-time")){const s=i=>i?`${this.formatDate(i)} ${this.timeText()}`:i?`${this.formatDate(i)} …`:"";return e&&r?`${s(e)} → ${s(r)}`:s(e)}return e&&r?`${this.formatDate(e)} → ${this.formatDate(r)}`:e?`${this.formatDate(e)} → …`:""}if(this.mode==="multiple")return this.values.map(e=>this.formatDate(e)).join(", ");const t=this.formatDate(this.value);return t&&this.hasAttr("show-time")?`${t} ${this.timeText()}`:t}timeText(){const t=e=>String(e).padStart(2,"0");return`${t(this.time.h)}:${t(this.time.m)}:${t(this.time.s)}`}loadTimeFromValue(){const e=(this.value||this.getAttr("start")||"").split("T")[1];if(!e)return;const[r,s,i]=e.split(":").map(a=>parseInt(a,10));this.time={h:r||0,m:s||0,s:i||0}}withTime(t){return t&&(this.hasAttr("show-time")?`${t}T${this.timeText()}`:t)}render(){var u,l;const t=this.disabled,e=this.hasAttr("clearable"),r=this.displayText(),s=r.length>0,i=this.hasAttr("show-time");this.loadTimeFromValue();let a=`min="${this.getAttr("min")}" max="${this.getAttr("max")}"`;if(this.mode==="range")a+=` range start="${this.getAttr("start")}" end="${this.getAttr("end")}"`;else if(this.mode==="multiple"){const h=this.values.map(d=>d.split("T")[0]).join(",");a+=` mode="multiple" values="${h}"`}else{const h=(u=this.value.split("T")[0])!=null?u:"";a+=` value="${h}"`}this.setTemplate(`
|
|
782
830
|
<div class="field" part="field">
|
|
783
831
|
<input class="display" part="display" type="text" ${this.hasAttr("free-text")&&!t?"":"readonly"}
|
|
784
832
|
placeholder="${this.getAttr("placeholder","dd/mm/aaaa")}"
|
|
@@ -797,13 +845,13 @@
|
|
|
797
845
|
</div>
|
|
798
846
|
<div class="pop" part="popover">
|
|
799
847
|
<fx-calendar ${a}></fx-calendar>
|
|
800
|
-
${
|
|
848
|
+
${i?`<div class="time-row" part="time">
|
|
801
849
|
<input class="t-h" type="number" min="0" max="23" value="${this.time.h}" aria-label="Hora"><span class="sep">:</span>
|
|
802
850
|
<input class="t-m" type="number" min="0" max="59" value="${this.time.m}" aria-label="Minuto"><span class="sep">:</span>
|
|
803
851
|
<input class="t-s" type="number" min="0" max="59" value="${this.time.s}" aria-label="Segundo">
|
|
804
852
|
</div>`:""}
|
|
805
853
|
</div>
|
|
806
|
-
`);const
|
|
854
|
+
`);const o=this.root.querySelector(".field");if(!o||t)return;o.addEventListener("click",h=>{if(!h.target.closest(".clear")&&!(this.hasAttr("free-text")&&h.target.classList.contains("display")))if(this.toggleAttribute("open"),this.hasAttr("open")){const d=this.getBoundingClientRect();this.toggleAttribute("up",d.bottom+340>window.innerHeight&&d.top>340)}else this.removeAttribute("up")}),(l=this.root.querySelector(".clear"))==null||l.addEventListener("click",h=>{h.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",h=>{var g;const d=(g=h.detail)!=null?g:{};(d.start!==void 0||d.end!==void 0)&&(d.start?this.setAttribute("start",this.withTime(d.start)):this.removeAttribute("start"),d.end?this.setAttribute("end",this.withTime(d.end)):this.removeAttribute("end")),d.values!==void 0&&(this.values=d.values.map(y=>this.withTime(y))),d.value!==void 0&&(d.value?this.setAttribute("value",this.withTime(d.value)):this.removeAttribute("value"),this.mode==="single"&&this.removeAttribute("open")),this.render(),this.emitChange(d)});const c=this.root.querySelector(".display");if(c&&this.hasAttr("free-text")&&!t&&(c.addEventListener("keydown",h=>{h.key==="Enter"&&(h.preventDefault(),this.commitTyped(c))}),c.addEventListener("blur",()=>this.commitTyped(c))),i){const h=()=>{const d=this.root.querySelector(".t-h"),g=this.root.querySelector(".t-m"),y=this.root.querySelector(".t-s"),S=(_,x)=>Math.min(x,Math.max(0,parseInt(_!=null?_:"0",10)||0));this.time={h:S(d==null?void 0:d.value,23),m:S(g==null?void 0:g.value,59),s:S(y==null?void 0:y.value,59)};const k=_=>_.split("T")[0]?`${_.split("T")[0]}T${this.timeText()}`:_;this.value&&this.setAttribute("value",k(this.value)),this.getAttr("start")&&this.setAttribute("start",k(this.getAttr("start"))),this.getAttr("end")&&this.setAttribute("end",k(this.getAttr("end"))),this.values.length&&(this.values=this.values.map(_=>k(_)));const z=this.root.querySelector(".display");z&&(z.value=this.displayText()),this.emitChange({value:this.value})};[".t-h",".t-m",".t-s"].forEach(d=>{var g;(g=this.root.querySelector(d))==null||g.addEventListener("input",h)})}}emitChange(t){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:t}))}parseTyped(t){var y,S;const e=t.trim();if(!e)return null;const r=this.getAttr("format","dd/mm/yyyy").toLowerCase(),s=["dd","mm","yyyy"].filter(k=>r.includes(k));if(s.length<3)return null;const i=e.split(new RegExp("[^0-9]+")).filter(Boolean);if(i.length!==3)return null;const a={};s.forEach((k,z)=>a[k]=i[z]);const o=`${a.yyyy}-${((y=a.mm)!=null?y:"").padStart(2,"0")}-${((S=a.dd)!=null?S:"").padStart(2,"0")}`,n=new Date(`${o}T12:00:00`);if(Number.isNaN(n.getTime()))return null;const[c,u,l]=o.split("-").map(k=>parseInt(k,10));if(n.getFullYear()!==c||n.getMonth()+1!==u||n.getDate()!==l)return null;const h=(k,z)=>k.split("T")[0].localeCompare(z.split("T")[0]),d=this.getAttr("min"),g=this.getAttr("max");return d&&h(o,d)<0||g&&h(o,g)>0?null:o}commitTyped(t){const e=this.parseTyped(t.value);if(!e){t.classList.add("invalid"),this.dispatchEvent(new CustomEvent("invalid",{bubbles:!0,composed:!0,detail:{text:t.value}})),t.value=this.displayText(),setTimeout(()=>t.classList.remove("invalid"),1500);return}if(this.mode==="single")this.setAttribute("value",this.withTime(e)),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(e)),this.removeAttribute("end");else{const[r,s]=[this.getAttr("start").split("T")[0],e].sort();this.setAttribute("start",this.withTime(r)),this.setAttribute("end",this.withTime(s))}this.emitChange({start:this.getAttr("start"),end:this.getAttr("end")})}else{const r=this.values.filter(s=>s.split("T")[0]!==e);r.push(this.withTime(e)),this.values=r,this.emitChange({values:this.values})}this.render()}};xt.styles=p`
|
|
807
855
|
:host {
|
|
808
856
|
display: inline-block;
|
|
809
857
|
vertical-align: middle;
|
|
@@ -946,7 +994,7 @@
|
|
|
946
994
|
:host([disabled]) .display { cursor: not-allowed; }
|
|
947
995
|
:host([free-text]) .display { cursor: text; }
|
|
948
996
|
:host([free-text]) .display.invalid { border-bottom: 2px solid var(--fx-color-danger); }
|
|
949
|
-
`;let
|
|
997
|
+
`;let P=xt;function ee(){return b("fx-datepicker",P)}ee();const vt=class vt extends f{static get observedAttributes(){return["checked","disabled","indeterminate"]}get checked(){return this.hasAttr("checked")}set checked(t){this.toggleAttr("checked",!!t)}get indeterminate(){return this.hasAttr("indeterminate")}set indeterminate(t){this.toggleAttr("indeterminate",!!t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}render(){const t=this.size==="sm"?"14px":this.size==="lg"?"22px":"18px";this.style.getPropertyValue("--fx-size-checkbox")||this.style.setProperty("--fx-size-checkbox",t),this.setTemplate(`
|
|
950
998
|
<span class="box" part="box" role="checkbox" tabindex="0"
|
|
951
999
|
aria-checked="${this.indeterminate?"mixed":this.checked}"
|
|
952
1000
|
aria-disabled="${this.disabled}">
|
|
@@ -955,7 +1003,7 @@
|
|
|
955
1003
|
</span>
|
|
956
1004
|
<span class="label" part="label"><slot></slot></span>
|
|
957
1005
|
</span>
|
|
958
|
-
`);const e=this.root.querySelector(".box");e&&(e.addEventListener("click",()=>this.toggle()),e.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.toggle())}))}toggle(){this.disabled||(this.indeterminate=!1,this.checked=!this.checked,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked,value:this.getAttr("value")}})))}};
|
|
1006
|
+
`);const e=this.root.querySelector(".box");e&&(e.addEventListener("click",()=>this.toggle()),e.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.toggle())}))}toggle(){this.disabled||(this.indeterminate=!1,this.checked=!this.checked,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked,value:this.getAttr("value")}})))}};vt.styles=p`
|
|
959
1007
|
:host {
|
|
960
1008
|
display: inline-flex;
|
|
961
1009
|
vertical-align: middle;
|
|
@@ -1016,13 +1064,13 @@
|
|
|
1016
1064
|
cursor: not-allowed;
|
|
1017
1065
|
pointer-events: none;
|
|
1018
1066
|
}
|
|
1019
|
-
`;let
|
|
1067
|
+
`;let B=vt;function re(){return b("fx-checkbox",B)}re();const mt=class mt extends f{static get observedAttributes(){return["checked","disabled"]}get checked(){return this.hasAttr("checked")}set checked(t){this.toggleAttr("checked",!!t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}render(){const t=this.size==="sm"?"14px":this.size==="lg"?"22px":"18px";this.style.getPropertyValue("--fx-size-radio")||this.style.setProperty("--fx-size-radio",t),this.setTemplate(`
|
|
1020
1068
|
<span class="box" part="box" role="radio" tabindex="0"
|
|
1021
1069
|
aria-checked="${this.checked}" aria-disabled="${this.disabled}">
|
|
1022
1070
|
<span class="control" part="control"><span class="dot" part="dot"></span></span>
|
|
1023
1071
|
<span class="label" part="label"><slot></slot></span>
|
|
1024
1072
|
</span>
|
|
1025
|
-
`);const e=this.root.querySelector(".box");e&&(e.addEventListener("click",()=>this.select()),e.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.select())}))}select(){if(this.disabled||this.checked)return;const t=this.getAttr("name");t&&document.querySelectorAll(`fx-radio[name="${t}"]`).forEach(e=>{e.checked=!1}),this.checked=!0,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:!0,value:this.getAttr("value")}}))}};
|
|
1073
|
+
`);const e=this.root.querySelector(".box");e&&(e.addEventListener("click",()=>this.select()),e.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.select())}))}select(){if(this.disabled||this.checked)return;const t=this.getAttr("name");t&&document.querySelectorAll(`fx-radio[name="${t}"]`).forEach(e=>{e.checked=!1}),this.checked=!0,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:!0,value:this.getAttr("value")}}))}};mt.styles=p`
|
|
1026
1074
|
:host {
|
|
1027
1075
|
display: inline-flex;
|
|
1028
1076
|
vertical-align: middle;
|
|
@@ -1078,26 +1126,26 @@
|
|
|
1078
1126
|
cursor: not-allowed;
|
|
1079
1127
|
pointer-events: none;
|
|
1080
1128
|
}
|
|
1081
|
-
`;let
|
|
1129
|
+
`;let K=mt;function se(){return b("fx-radio",K)}se();const yt=class yt extends f{constructor(){super(...arguments),this.data=[],this.page=0,this.sortField="",this.sortDir=1,this.filters={}}static get observedAttributes(){return["pagination","rows","rows-options","striped","empty-message","pagination-position"]}get rowsPerPage(){const t=Number(this.getAttr("rows","10"));return t>0?t:10}set rowsPerPage(t){this.setAttribute("rows",String(t))}get columns(){return[...this.querySelectorAll("fx-column")].map(t=>{var e,r,s,i,a;return{field:(e=t.getAttribute("field"))!=null?e:"",header:(s=(r=t.getAttribute("header"))!=null?r:t.getAttribute("field"))!=null?s:"",sortable:t.hasAttribute("sortable"),filterable:t.hasAttribute("filterable"),align:(i=t.getAttribute("align"))!=null?i:"left",template:(a=t.querySelector("template"))!=null?a:void 0}})}connectedCallback(){if(super.connectedCallback(),!this.data.length)try{const t=this.getAttr("data");t&&(this.data=JSON.parse(t))}catch(t){}new MutationObserver(()=>this.render()).observe(this,{childList:!0,subtree:!0})}computeRows(){let t=[...this.data];for(const[r,s]of Object.entries(this.filters)){if(!s)continue;const i=s.toLowerCase();t=t.filter(a=>{var o;return String((o=a[r])!=null?o:"").toLowerCase().includes(i)})}const e=t.length;if(this.sortField&&t.sort((r,s)=>{const i=r[this.sortField],a=s[this.sortField];return typeof i=="number"&&typeof a=="number"?(i-a)*this.sortDir:String(i!=null?i:"").localeCompare(String(a!=null?a:""),"pt-BR")*this.sortDir}),this.hasAttr("pagination")){const r=this.page*this.rowsPerPage;t=t.slice(r,r+this.rowsPerPage)}return{rows:t,total:e}}cellHtml(t,e){const r=e[t.field];return t.template?t.template.innerHTML.replace(/\{\{(\w+)\}\}/g,(s,i)=>{var a;return i==="value"?String(r!=null?r:""):i==="row"?"":String((a=e[i])!=null?a:"")}):String(r!=null?r:"")}render(){var u;const t=this.columns.filter(l=>l.field),{rows:e,total:r}=this.computeRows(),s=this.hasAttr("pagination"),i=Math.max(1,Math.ceil(r/this.rowsPerPage));this.page>=i&&(this.page=i-1);const a=t.map(l=>{const h=this.sortField===l.field?this.sortDir===1?"▲":"▼":"";return`<th part="header" class="${l.sortable?"sortable":""}" style="text-align:${l.align}" data-field="${l.field}">${l.header}${h?`<span class="sort-ind">${h}</span>`:""}</th>`}).join(""),o=t.some(l=>l.filterable)?`<tr class="filter-row">${t.map(l=>{var h;return`<th style="text-align:${l.align}">${l.filterable?`<input class="filter" data-field="${l.field}" placeholder="Filtrar…" value="${(h=this.filters[l.field])!=null?h:""}">`:""}</th>`}).join("")}</tr>`:"",n=e.length?e.map((l,h)=>`<tr part="row" data-index="${h}">${t.map(d=>`<td part="cell" style="text-align:${d.align}">${this.cellHtml(d,l)}</td>`).join("")}</tr>`).join(""):`<tr><td class="empty" colspan="${t.length||1}">${this.getAttr("empty-message","Nenhum registro encontrado")}</td></tr>`,c=s?`
|
|
1082
1130
|
<div class="pager" part="pager">
|
|
1083
|
-
<span class="info">Página ${this.page+1} de ${
|
|
1131
|
+
<span class="info">Página ${this.page+1} de ${i} · ${r} registros</span>
|
|
1084
1132
|
<button type="button" class="pg-btn" data-pg="first" ${this.page===0?"disabled":""}>«</button>
|
|
1085
1133
|
<button type="button" class="pg-btn" data-pg="prev" ${this.page===0?"disabled":""}>‹</button>
|
|
1086
|
-
${Array.from({length:
|
|
1087
|
-
<button type="button" class="pg-btn" data-pg="next" ${this.page>=
|
|
1088
|
-
<button type="button" class="pg-btn" data-pg="last" ${this.page>=
|
|
1134
|
+
${Array.from({length:i},(l,h)=>`<button type="button" class="pg-btn" data-pg="${h}" aria-current="${h===this.page}">${h+1}</button>`).join("")}
|
|
1135
|
+
<button type="button" class="pg-btn" data-pg="next" ${this.page>=i-1?"disabled":""}>›</button>
|
|
1136
|
+
<button type="button" class="pg-btn" data-pg="last" ${this.page>=i-1?"disabled":""}>»</button>
|
|
1089
1137
|
<label class="info">Por página:
|
|
1090
|
-
<select class="rows-sel">${this.getAttr("rows-options","5,10,20,50").split(",").map(
|
|
1138
|
+
<select class="rows-sel">${this.getAttr("rows-options","5,10,20,50").split(",").map(l=>l.trim()).map(l=>`<option value="${l}" ${Number(l)===this.rowsPerPage?"selected":""}>${l}</option>`).join("")}</select>
|
|
1091
1139
|
</label>
|
|
1092
1140
|
</div>`:"";this.setTemplate(`
|
|
1093
1141
|
<div class="scroll">
|
|
1094
1142
|
<table part="table">
|
|
1095
|
-
<thead><tr>${a}</tr>${
|
|
1096
|
-
<tbody>${
|
|
1143
|
+
<thead><tr>${a}</tr>${o}</thead>
|
|
1144
|
+
<tbody>${n}</tbody>
|
|
1097
1145
|
</table>
|
|
1098
1146
|
</div>
|
|
1099
1147
|
${c}
|
|
1100
|
-
`),this.root.querySelectorAll("th.sortable").forEach(
|
|
1148
|
+
`),this.root.querySelectorAll("th.sortable").forEach(l=>{l.addEventListener("click",()=>{const h=l.dataset.field;this.sortField===h?this.sortDir=this.sortDir===1?-1:1:(this.sortField=h,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"}}))})}),this.root.querySelectorAll(".filter").forEach(l=>{l.addEventListener("input",()=>{this.filters[l.dataset.field]=l.value,this.page=0;const h=l.dataset.field,d=l.selectionStart;this.render();const g=this.root.querySelector(`.filter[data-field="${h}"]`);g&&(g.focus(),g.setSelectionRange(d,d))}),l.addEventListener("click",h=>h.stopPropagation())}),this.root.querySelectorAll(".pg-btn").forEach(l=>{l.addEventListener("click",()=>{const h=l.dataset.pg;this.page=h==="first"?0:h==="prev"?Math.max(0,this.page-1):h==="next"?Math.min(i-1,this.page+1):h==="last"?i-1:Number(h),this.render(),this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,composed:!0,detail:{page:this.page+1,pages:i,rowsPerPage:this.rowsPerPage,total:r}}))})}),(u=this.root.querySelector(".rows-sel"))==null||u.addEventListener("change",l=>{this.rowsPerPage=Number(l.target.value),this.page=0,this.render()}),this.root.querySelectorAll("tbody tr[data-index]").forEach(l=>{l.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("row-click",{bubbles:!0,composed:!0,detail:{row:e[Number(l.dataset.index)],index:Number(l.dataset.index)}}))})})}};yt.styles=p`
|
|
1101
1149
|
:host {
|
|
1102
1150
|
display: block;
|
|
1103
1151
|
font-family: var(--fx-font-family);
|
|
@@ -1179,16 +1227,16 @@
|
|
|
1179
1227
|
padding: 2px var(--fx-space-xs);
|
|
1180
1228
|
outline: none;
|
|
1181
1229
|
}
|
|
1182
|
-
`;let
|
|
1230
|
+
`;let R=yt;function ie(){return b("fx-table",R)}ie();const kt=class kt extends f{constructor(){super(...arguments),this.targetControl=null,this.observer=null,this.listenersReady=!1}static get observedAttributes(){return["variant","error","invalid","success","valid"]}render(){var o;const t=this.findControl(),r=this.findLabel(),s=r?(o=r.textContent)==null?void 0:o.replace(/\s+/g," ").trim():"",i=r&&r.getAttribute("for")||"",a=this.getAttribute("variant")==="over";this.setTemplate(`
|
|
1183
1231
|
<div class="wrapper" part="wrapper">
|
|
1184
|
-
${a?`<label class="flabel" part="label" for="${
|
|
1232
|
+
${a?`<label class="flabel" part="label" for="${i}">${s}</label>`:""}
|
|
1185
1233
|
<div class="field-box" part="field">
|
|
1186
1234
|
<slot></slot>
|
|
1187
|
-
${a?"":`<label class="flabel" part="label" for="${
|
|
1235
|
+
${a?"":`<label class="flabel" part="label" for="${i}">${s}</label>`}
|
|
1188
1236
|
</div>
|
|
1189
1237
|
<div class="error-message" part="error"></div>
|
|
1190
1238
|
</div>
|
|
1191
|
-
`),r&&r.setAttribute("hidden",""),this.attachEvents(),this.syncControlReference(t),this.syncState(),this.applyError()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.observer)==null||t.disconnect()}findControl(){var t;return(t=Array.from(this.children).find(e=>e.tagName.toLowerCase()!=="label"))!=null?t:null}findLabel(){var t;return(t=Array.from(this.children).find(e=>e.tagName.toLowerCase()==="label"))!=null?t:null}attachEvents(){const t=this.root.querySelector("slot");t&&t.addEventListener("slotchange",()=>{const e=this.findControl();this.syncControlReference(e),this.syncState(),this.applyError()}),!this.listenersReady&&(this.listenersReady=!0,this.addEventListener("focusin",()=>this.syncState()),this.addEventListener("focusout",()=>setTimeout(()=>this.syncState(),60)),this.addEventListener("input",()=>this.syncState()),this.addEventListener("change",()=>this.syncState()))}syncControlReference(t=this.targetControl){var e;t!==this.targetControl&&((e=this.observer)==null||e.disconnect(),this.observer=null,this.targetControl=t,t&&(this.observer=new MutationObserver(()=>this.syncState()),this.observer.observe(t,{attributes:!0,attributeFilter:["value","values","start","end","open"]})))}syncState(){var a,
|
|
1239
|
+
`),r&&r.setAttribute("hidden",""),this.attachEvents(),this.syncControlReference(t),this.syncState(),this.applyError()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.observer)==null||t.disconnect()}findControl(){var t;return(t=Array.from(this.children).find(e=>e.tagName.toLowerCase()!=="label"))!=null?t:null}findLabel(){var t;return(t=Array.from(this.children).find(e=>e.tagName.toLowerCase()==="label"))!=null?t:null}attachEvents(){const t=this.root.querySelector("slot");t&&t.addEventListener("slotchange",()=>{const e=this.findControl();this.syncControlReference(e),this.syncState(),this.applyError()}),!this.listenersReady&&(this.listenersReady=!0,this.addEventListener("focusin",()=>this.syncState()),this.addEventListener("focusout",()=>setTimeout(()=>this.syncState(),60)),this.addEventListener("input",()=>this.syncState()),this.addEventListener("change",()=>this.syncState()))}syncControlReference(t=this.targetControl){var e;t!==this.targetControl&&((e=this.observer)==null||e.disconnect(),this.observer=null,this.targetControl=t,t&&(this.observer=new MutationObserver(()=>this.syncState()),this.observer.observe(t,{attributes:!0,attributeFilter:["value","values","start","end","open"]})))}syncState(){var a,o,n;if(this.targetControl&&!this.targetControl.isConnected&&(this.targetControl=null,(a=this.observer)==null||a.disconnect(),this.observer=null),!this.targetControl){this.removeAttribute("active"),this.removeAttribute("focus");return}const t=this.targetControl,e=t.getAttribute?((o=t.getAttribute("value"))!=null?o:"").trim():"",r=t.getAttribute?((n=t.getAttribute("values"))!=null?n:"").trim():"",s=!!(typeof t.value=="string"&&t.value.trim()!==""||Array.isArray(t.values)&&t.values.length>0||e!==""||r!==""||t.hasAttribute&&(t.hasAttribute("open")||t.hasAttribute("start"))),i=this.isFocusedInside();s||i?(this.setAttribute("active",""),i?this.setAttribute("focus",""):this.removeAttribute("focus")):(this.removeAttribute("active"),this.removeAttribute("focus"))}applyError(){var r;const t=this.hasAttr("error")||this.hasAttr("invalid"),e=this.root.querySelector(".error-message");if(e&&(e.textContent=t?((r=this.getAttribute("error-text"))==null?void 0:r.trim())||"Valor inválido":""),this.targetControl&&typeof this.targetControl.setAttribute=="function"){const s=this.targetControl;t?(s.setAttribute("error",""),s.removeAttribute("success")):this.hasAttr("success")||this.hasAttr("valid")?(s.setAttribute("success",""),s.removeAttribute("error")):(s.removeAttribute("error"),s.removeAttribute("success"))}}isWithin(t){let e=t;for(;e&&e!==this;)e=e.parentElement;return e===this}isFocusedInside(){const t=document.activeElement;return!!(t&&this.isWithin(t))}};kt.styles=p`
|
|
1192
1240
|
:host {
|
|
1193
1241
|
display: inline-block;
|
|
1194
1242
|
position: relative;
|
|
@@ -1300,11 +1348,11 @@
|
|
|
1300
1348
|
:host([invalid]) .error-message {
|
|
1301
1349
|
display: block;
|
|
1302
1350
|
}
|
|
1303
|
-
`;let
|
|
1351
|
+
`;let F=kt;function ae(){return b("fx-floatlabel",F)}ae();const wt=class wt extends f{static get observedAttributes(){return["size","placeholder","disabled","readonly","rows","maxlength"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}render(){const t=this.getAttr("placeholder"),e=this.hasAttr("readonly"),r=this.hasAttr("disabled"),s=this.getAttr("rows"),i=this.getAttr("maxlength");this.setTemplate(`<textarea class="field" part="textarea"
|
|
1304
1352
|
${t?`placeholder="${t}"`:""}
|
|
1305
1353
|
${s?`rows="${s}"`:""}
|
|
1306
|
-
${
|
|
1307
|
-
></textarea>`);const a=this.root.querySelector(".field");if(!a)return;a.value=this.getAttr("value"),r&&a.setAttribute("disabled",""),e&&a.setAttribute("readonly","");const
|
|
1354
|
+
${i?`maxlength="${i}"`:""}
|
|
1355
|
+
></textarea>`);const a=this.root.querySelector(".field");if(!a)return;a.value=this.getAttr("value"),r&&a.setAttribute("disabled",""),e&&a.setAttribute("readonly","");const o=n=>{this.value=a.value,this.dispatchEvent(new CustomEvent(n,{bubbles:!0,composed:!0,detail:{value:a.value}}))};a.addEventListener("input",n=>{n.stopPropagation(),o("input")}),a.addEventListener("change",n=>{n.stopPropagation(),o("change")})}};wt.styles=p`
|
|
1308
1356
|
:host {
|
|
1309
1357
|
display: inline-block;
|
|
1310
1358
|
vertical-align: middle;
|
|
@@ -1351,7 +1399,7 @@
|
|
|
1351
1399
|
}
|
|
1352
1400
|
:host([size='sm']) .field { width: 220px; min-height: var(--fx-size-sm); padding: var(--fx-space-sm) var(--fx-space-md); }
|
|
1353
1401
|
:host([size='lg']) .field { width: 300px; min-height: calc(var(--fx-size-lg) + 80px); }
|
|
1354
|
-
`;let
|
|
1402
|
+
`;let Y=wt;function oe(){return b("fx-textarea",Y)}oe();const At=class At extends f{static get observedAttributes(){return["open","size","heading"]}get open(){return this.hasAttr("open")}set open(t){this.toggleAttr("open",t)}render(){const t=this.open,e=this.getAttr("heading");if(this.setTemplate(`
|
|
1355
1403
|
<div class="overlay" part="overlay" ${t?"":"hidden"}>
|
|
1356
1404
|
<div class="dialog" role="dialog" aria-modal="true" aria-label="${e}">
|
|
1357
1405
|
<header>
|
|
@@ -1362,7 +1410,7 @@
|
|
|
1362
1410
|
<footer part="footer"><slot name="footer"></slot></footer>
|
|
1363
1411
|
</div>
|
|
1364
1412
|
</div>
|
|
1365
|
-
`),!t)return;const r=this.root.querySelector(".overlay"),s=this.root.querySelector(".close"),
|
|
1413
|
+
`),!t)return;const r=this.root.querySelector(".overlay"),s=this.root.querySelector(".close"),i=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))};r==null||r.addEventListener("click",o=>{o.target===r&&i()}),s==null||s.addEventListener("click",i);const a=o=>{o.key==="Escape"&&(o.stopPropagation(),i())};document.addEventListener("keydown",a,{once:!0}),this._cleanup=()=>document.removeEventListener("keydown",a),requestAnimationFrame(()=>{var o;return(o=this.root.querySelector(".dialog"))==null?void 0:o.focus()}),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0}))}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._cleanup)==null||t.call(this)}};At.styles=p`
|
|
1366
1414
|
:host { display: contents; }
|
|
1367
1415
|
.overlay {
|
|
1368
1416
|
position: fixed;
|
|
@@ -1431,7 +1479,7 @@
|
|
|
1431
1479
|
gap: var(--fx-space-sm);
|
|
1432
1480
|
}
|
|
1433
1481
|
footer[hidden] { display: none; }
|
|
1434
|
-
`;let
|
|
1482
|
+
`;let H=At;function ne(){return b("fx-dialog",H)}ne();const Bt={success:"var(--fx-color-success, #10b981)",error:"var(--fx-color-danger, #f43f5e)",info:"var(--fx-color-info, #0ea5e9)",warning:"var(--fx-color-warning, #f59e0b)"},Kt={success:"✓",error:"✕",warning:"!",info:"i"},le=`
|
|
1435
1483
|
:host { display: contents; }
|
|
1436
1484
|
.card {
|
|
1437
1485
|
display: flex; align-items: flex-start; gap: 10px;
|
|
@@ -1465,19 +1513,19 @@
|
|
|
1465
1513
|
color: var(--fx-text-muted, #64748b); font-size: 15px; padding: 2px 4px; border-radius: 4px;
|
|
1466
1514
|
}
|
|
1467
1515
|
.close:hover { color: var(--fx-color-danger, #f43f5e); background: var(--fx-surface-surface-hover, rgba(0,0,0,.05)); }
|
|
1468
|
-
`;class
|
|
1469
|
-
<style>${
|
|
1470
|
-
<div class="card" style="--kind:${
|
|
1471
|
-
<span class="icon">${(
|
|
1516
|
+
`;class ce extends HTMLElement{constructor(){super();Yt(this,L);this.timer=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["kind","title","message","duration"]}connectedCallback(){var s;this.shadowRoot.firstChild||Ht(this,L,Ot).call(this);const e=Number((s=this.getAttribute("duration"))!=null?s:"4000"),r=e===0?0:Math.max(Number.isNaN(e)?4e3:e,1e3);!Number.isNaN(r)&&r>0&&!this.timer&&(this.timer=setTimeout(()=>this.dismiss(),r))}disconnectedCallback(){this.timer&&clearTimeout(this.timer),this.timer=null}dismiss(){this.timer&&clearTimeout(this.timer),this.timer=null;const e=this.shadowRoot.querySelector(".card");e?(e.classList.add("leaving"),setTimeout(()=>this.remove(),200)):this.remove()}}L=new WeakSet,Ot=function(){var n,c,u,l;const e=this.getAttribute("kind")||"info",r=(n=this.getAttribute("title"))!=null?n:"",s=(c=this.getAttribute("message"))!=null?c:"",i=(u=Bt[e])!=null?u:Bt.info;this.shadowRoot.innerHTML=`
|
|
1517
|
+
<style>${le}</style>
|
|
1518
|
+
<div class="card" style="--kind:${i}" role="status" part="card">
|
|
1519
|
+
<span class="icon">${(l=Kt[e])!=null?l:Kt.info}</span>
|
|
1472
1520
|
<div class="body">
|
|
1473
1521
|
${r?'<div class="title"></div>':""}
|
|
1474
1522
|
${s?'<div class="msg"></div>':""}
|
|
1475
1523
|
</div>
|
|
1476
1524
|
<button class="close" aria-label="Fechar">✕</button>
|
|
1477
|
-
</div>`;const a=this.shadowRoot.querySelector(".title"),
|
|
1525
|
+
</div>`;const a=this.shadowRoot.querySelector(".title"),o=this.shadowRoot.querySelector(".msg");a&&(a.textContent=r),o&&(o.textContent=s),this.shadowRoot.querySelector(".close").addEventListener("click",()=>this.dismiss())};function de(v){let t=document.querySelector(`[data-fx-toast-region="${v}"]`);if(!t){t=document.createElement("div"),t.setAttribute("data-fx-toast-region",v);const[e,r]=v.split("-"),s=t.style;s.position="fixed",s[e]="16px",r==="center"?(s.left="50%",s.transform="translateX(-50%)"):s[r]="16px",s.display="flex",s.flexDirection="column",s.gap="8px",s.zIndex="1100",s.pointerEvents="none",new MutationObserver(()=>{t.querySelectorAll("*").forEach(i=>i.style.pointerEvents="auto")}).observe(t,{childList:!0}),document.body.appendChild(t)}return t}class he{constructor(){this.seq=0,this.map=new Map,this.success=(t,e,r)=>this.push("success",t,e,r),this.error=(t,e,r)=>this.push("error",t,e,r),this.info=(t,e,r)=>this.push("info",t,e,r),this.warning=(t,e,r)=>this.push("warning",t,e,r)}push(t,e,r,s){var c,u,l;const i=++this.seq,a=typeof r=="string"?r:r==null?void 0:r.message,o={...typeof r=="object"&&r?r:void 0,...s},n=document.createElement("fx-toast");return n.setAttribute("kind",t),n.setAttribute("title",e),a&&n.setAttribute("message",a),n.setAttribute("position",(c=o.position)!=null?c:"top-right"),n.setAttribute("duration",String((u=o.duration)!=null?u:4e3)),de((l=o.position)!=null?l:"top-right").appendChild(n),this.map.set(i,n),i}close(t){var e;(e=this.map.get(t))==null||e.dismiss(),this.map.delete(t)}}const ue=new he;globalThis.FenixToast=ue;function pe(){customElements.get("fx-toast")||customElements.define("fx-toast",ce)}pe();const _t=class _t extends f{static get observedAttributes(){return["content","position"]}render(){const t=this.getAttr("content");this.setTemplate(`
|
|
1478
1526
|
<slot></slot>
|
|
1479
1527
|
<span class="bubble" part="bubble" role="tooltip">${t}</span>
|
|
1480
|
-
`)}};
|
|
1528
|
+
`)}};_t.styles=p`
|
|
1481
1529
|
:host {
|
|
1482
1530
|
position: relative;
|
|
1483
1531
|
display: inline-flex;
|
|
@@ -1538,14 +1586,14 @@
|
|
|
1538
1586
|
top: 50%; left: auto; right: 100%; transform: translateY(-50%);
|
|
1539
1587
|
border: 5px solid transparent; border-right-color: var(--fx-text-default, #1e293b);
|
|
1540
1588
|
}
|
|
1541
|
-
`;let
|
|
1589
|
+
`;let O=_t;function fe(){return b("fx-tooltip",O)}fe();const St=class St extends f{static get observedAttributes(){return["value"]}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}render(){var r;const t=Array.from(this.querySelectorAll("fx-tab")),e=this.value||((r=t[0])==null?void 0:r.getAttribute("tab"))||"";this.setTemplate(`
|
|
1542
1590
|
<div class="list" role="tablist">
|
|
1543
|
-
${t.map(s=>{var
|
|
1544
|
-
data-tab="${
|
|
1545
|
-
${a?'aria-disabled="true" data-disabled="true"':""}>${(
|
|
1591
|
+
${t.map(s=>{var o,n;const i=(o=s.getAttribute("tab"))!=null?o:"",a=s.hasAttribute("disabled");return`<button type="button" class="tab" role="tab" part="tab"
|
|
1592
|
+
data-tab="${i}" aria-selected="${i===e}"
|
|
1593
|
+
${a?'aria-disabled="true" data-disabled="true"':""}>${(n=s.textContent)==null?void 0:n.trim()}</button>`}).join("")}
|
|
1546
1594
|
</div>
|
|
1547
1595
|
<slot></slot>
|
|
1548
|
-
`),this.panels.forEach(s=>{s.getAttribute("tab")===e?s.removeAttribute("hidden"):s.setAttribute("hidden","")}),this.root.querySelectorAll(".tab").forEach(s=>{s.addEventListener("click",()=>{var
|
|
1596
|
+
`),this.panels.forEach(s=>{s.getAttribute("tab")===e?s.removeAttribute("hidden"):s.setAttribute("hidden","")}),this.root.querySelectorAll(".tab").forEach(s=>{s.addEventListener("click",()=>{var i;s.hasAttribute("data-disabled")||(this.value=(i=s.dataset.tab)!=null?i:"",this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}})))})})}get panels(){const t=Array.from(this.querySelectorAll("fx-tab-panel"));if(t.length)return t;const e=[];let r=this.nextElementSibling;for(;r&&!r.matches("fx-tabs");)r.matches("fx-tab-panel")?e.push(r):e.push(...Array.from(r.querySelectorAll(":scope > fx-tab-panel"))),r=r.nextElementSibling;return e}};St.styles=p`
|
|
1549
1597
|
:host {
|
|
1550
1598
|
display: block;
|
|
1551
1599
|
font-family: var(--fx-font-family);
|
|
@@ -1596,10 +1644,10 @@
|
|
|
1596
1644
|
::slotted(fx-tab) {
|
|
1597
1645
|
display: none !important;
|
|
1598
1646
|
}
|
|
1599
|
-
`;let X=
|
|
1647
|
+
`;let X=St;const zt=class zt extends f{constructor(){super(...arguments),this._initialized=!1}static get observedAttributes(){return["tab"]}get tab(){return this.getAttr("tab")}get visible(){return!this.hasAttr("hidden")}set visible(t){this.toggleAttr("hidden",!t)}render(){var t;if(this.setTemplate("<slot></slot>"),!this._initialized){const e=(t=this.closest("fx-tabs"))!=null?t:(()=>{let s=this.previousElementSibling;for(;s;){if(s.matches("fx-tabs"))return s;s=s.previousElementSibling}return null})(),r=e&&e.getAttribute("value")||"";this.getAttribute("tab")!==r&&this.setAttribute("hidden",""),this._initialized=!0}}};zt.styles=p`
|
|
1600
1648
|
:host { display: block; padding: var(--fx-space-lg) 0; font-family: var(--fx-font-family); color: var(--fx-text-default); }
|
|
1601
1649
|
:host([hidden]) { display: none; }
|
|
1602
|
-
`;let
|
|
1650
|
+
`;let U=zt;function ge(){return b("fx-tabs",X)}function be(){return b("fx-tab-panel",U)}ge(),be();const $t=class $t extends f{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(t){this.setAttribute("value",String(Math.min(100,Math.max(0,t))))}render(){const t=Math.min(100,Math.max(0,this.value)),e=this.hasAttr("indeterminate"),r=this.getAttr("label"),s=!e&&!this.hasAttr("hide-label");this.setTemplate(`
|
|
1603
1651
|
${r?`<div class="caption" part="caption">${r}</div>`:""}
|
|
1604
1652
|
<div class="row">
|
|
1605
1653
|
<div class="track" part="track" role="progressbar"
|
|
@@ -1608,7 +1656,7 @@
|
|
|
1608
1656
|
</div>
|
|
1609
1657
|
${s?`<span class="pct">${t}%</span>`:""}
|
|
1610
1658
|
</div>
|
|
1611
|
-
`),!this._done&&!this.hasAttr("indeterminate")&&t>=100&&(this._done=!0,this.dispatchEvent(new CustomEvent("complete",{bubbles:!0,composed:!0}))),t<100&&(this._done=!1)}}
|
|
1659
|
+
`),!this._done&&!this.hasAttr("indeterminate")&&t>=100&&(this._done=!0,this.dispatchEvent(new CustomEvent("complete",{bubbles:!0,composed:!0}))),t<100&&(this._done=!1)}};$t.styles=p`
|
|
1612
1660
|
:host {
|
|
1613
1661
|
display: block;
|
|
1614
1662
|
font-family: var(--fx-font-family);
|
|
@@ -1658,9 +1706,9 @@
|
|
|
1658
1706
|
color: var(--fx-text-muted);
|
|
1659
1707
|
margin-bottom: var(--fx-space-xs);
|
|
1660
1708
|
}
|
|
1661
|
-
`;let
|
|
1662
|
-
${Array.from({length:
|
|
1663
|
-
`)}};
|
|
1709
|
+
`;let W=$t;function xe(){return b("fx-progress",W)}xe();const Et=class Et extends f{static get observedAttributes(){return["variant","width","height","lines"]}render(){const t=this.getAttr("variant","text"),e=this.getAttr("width"),r=this.getAttr("height"),s=`${e?`width:${e};`:""}${r?`height:${r};`:""}`;if(t==="circle"){const a=r||e||"40px",o=s.includes("height")?s:`width:${a};height:${a};`;this.setTemplate(`<div class="bone circle" part="bone" style="${o}"></div>`);return}if(t==="rect"){const a=s||"width:100%;height:80px;";this.setTemplate(`<div class="bone" part="bone" style="${a}"></div>`);return}const i=Number(this.getAttr("lines","3"))||3;this.setTemplate(`
|
|
1710
|
+
${Array.from({length:i},()=>'<div class="bone text"></div>').join("")}
|
|
1711
|
+
`)}};Et.styles=p`
|
|
1664
1712
|
:host { display: block; width: 100%; min-width: 80px; font-family: var(--fx-font-family); }
|
|
1665
1713
|
.bone {
|
|
1666
1714
|
background: linear-gradient(
|
|
@@ -1678,7 +1726,7 @@
|
|
|
1678
1726
|
.text { height: 12px; width: 100%; margin-bottom: var(--fx-space-sm); }
|
|
1679
1727
|
.text:last-of-type { width: 60%; margin-bottom: 0; }
|
|
1680
1728
|
.circle { border-radius: var(--fx-radius-full); }
|
|
1681
|
-
`;let J=
|
|
1729
|
+
`;let J=Et;function ve(){return b("fx-skeleton",J)}ve();const Ct=class Ct extends f{static get observedAttributes(){return["variant","title","dismissible"]}render(){var s,i;const t=this.getAttr("variant","info"),e=this.getAttr("title"),r={info:"ℹ",success:"✓",warning:"⚠",danger:"✕"};this.setTemplate(`
|
|
1682
1730
|
<div class="alert" part="alert" role="alert">
|
|
1683
1731
|
<span class="icon">${(s=r[t])!=null?s:"ℹ"}</span>
|
|
1684
1732
|
<div class="content">
|
|
@@ -1687,7 +1735,7 @@
|
|
|
1687
1735
|
</div>
|
|
1688
1736
|
${this.hasAttr("dismissible")?'<button type="button" class="close" aria-label="Fechar">×</button>':""}
|
|
1689
1737
|
</div>
|
|
1690
|
-
`),(
|
|
1738
|
+
`),(i=this.root.querySelector(".close"))==null||i.addEventListener("click",()=>{this.hidden=!0,this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))})}};Ct.styles=p`
|
|
1691
1739
|
:host {
|
|
1692
1740
|
display: block;
|
|
1693
1741
|
font-family: var(--fx-font-family);
|
|
@@ -1719,16 +1767,16 @@
|
|
|
1719
1767
|
line-height: 1; padding: 0; border-radius: var(--fx-radius-full);
|
|
1720
1768
|
}
|
|
1721
1769
|
.close:hover { color: var(--_color); }
|
|
1722
|
-
`;let
|
|
1770
|
+
`;let G=Ct;function me(){return b("fx-alert",G)}me();const Lt=class Lt extends f{static get observedAttributes(){return["label","position","open"]}get open(){return this.hasAttr("open")}set open(t){this.toggleAttr("open",t)}render(){const t=this.getAttr("label","Ações"),e=Array.from(this.querySelectorAll("fx-dropdown-item"));this.setTemplate(`
|
|
1723
1771
|
<span class="trigger" role="button" tabindex="0" part="trigger"
|
|
1724
1772
|
aria-haspopup="menu" aria-expanded="${this.open}">
|
|
1725
1773
|
${t} ▾
|
|
1726
1774
|
</span>
|
|
1727
1775
|
<div class="panel" role="menu" part="panel">
|
|
1728
|
-
${e.length?
|
|
1776
|
+
${e.length?"":'<div class="empty">Nenhuma ação</div>'}
|
|
1729
1777
|
<slot></slot>
|
|
1730
1778
|
</div>
|
|
1731
|
-
`);const r=this.root.querySelector(".trigger");r==null||r.addEventListener("click",s=>{s.stopPropagation(),document.querySelectorAll("fx-dropdown[open]").forEach(
|
|
1779
|
+
`);const r=this.root.querySelector(".trigger");r==null||r.addEventListener("click",s=>{s.stopPropagation(),document.querySelectorAll("fx-dropdown[open]").forEach(i=>{i!==this&&(i.open=!1)}),this.open=!this.open}),r==null||r.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this.open=!this.open)}),e.forEach(s=>{s.addEventListener("click",()=>{var i;this.open=!1,this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{value:(i=s.getAttribute("value"))!=null?i:""}}))})})}};Lt.styles=p`
|
|
1732
1780
|
:host {
|
|
1733
1781
|
position: relative;
|
|
1734
1782
|
display: inline-block;
|
|
@@ -1761,7 +1809,7 @@
|
|
|
1761
1809
|
:host(:not([position])) .panel { left: 0; right: auto; }
|
|
1762
1810
|
::slotted(fx-dropdown-item) { display: block; }
|
|
1763
1811
|
.empty { color: var(--fx-text-muted); font-size: calc(var(--fx-font-size) - 2px); padding: var(--fx-space-sm); }
|
|
1764
|
-
`;let
|
|
1812
|
+
`;let Q=Lt;const Tt=class Tt extends f{static get observedAttributes(){return["value"]}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}render(){this.setTemplate('<button type="button" class="item" part="item" role="menuitem"><slot></slot></button>')}};Tt.styles=p`
|
|
1765
1813
|
:host {
|
|
1766
1814
|
display: block;
|
|
1767
1815
|
font-family: var(--fx-font-family);
|
|
@@ -1782,13 +1830,13 @@
|
|
|
1782
1830
|
transition: background var(--fx-motion-duration-fast) var(--fx-motion-easing);
|
|
1783
1831
|
}
|
|
1784
1832
|
.item:hover { background: color-mix(in srgb, var(--fx-color-primary) 12%, var(--fx-surface-background)); color: var(--fx-color-primary); }
|
|
1785
|
-
`;let
|
|
1833
|
+
`;let Z=Tt;function ye(){return b("fx-dropdown",Q)}function ke(){return b("fx-dropdown-item",Z)}ye(),ke();const Dt=class Dt extends f{constructor(){super(...arguments),this._onKeydown=()=>{}}static get observedAttributes(){return["open","title","position"]}get open(){return this.hasAttr("open")}set open(t){this.toggleAttr("open",t)}get title(){return this.getAttr("title")}set title(t){this.setAttribute("title",t)}get position(){const t=this.getAttr("position");return["left","right","top","bottom"].includes(t)?t:"right"}set position(t){this.setAttribute("position",t)}render(){var r,s;const t=this.getAttr("title");this.setTemplate(`
|
|
1786
1834
|
<div class="overlay" part="overlay"></div>
|
|
1787
1835
|
<div class="panel" part="panel" role="dialog" aria-modal="true" aria-label="${t||"Drawer"}">
|
|
1788
1836
|
${t!==""?`<div class="header" part="header"><span class="title">${t}</span><button type="button" class="close" part="close" aria-label="Fechar">✕</button></div>`:""}
|
|
1789
1837
|
<div class="body" part="body"><slot></slot></div>
|
|
1790
1838
|
</div>
|
|
1791
|
-
`);const e=()=>{this.open&&(this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))};(r=this.root.querySelector(".overlay"))==null||r.addEventListener("click",e),(s=this.root.querySelector(".close"))==null||s.addEventListener("click",e)}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this._onKeydown=e=>{e.key==="Escape"&&this.open&&(this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},document.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){var t;document.removeEventListener("keydown",this._onKeydown),(t=super.disconnectedCallback)==null||t.call(this)}}
|
|
1839
|
+
`);const e=()=>{this.open&&(this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))};(r=this.root.querySelector(".overlay"))==null||r.addEventListener("click",e),(s=this.root.querySelector(".close"))==null||s.addEventListener("click",e)}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this._onKeydown=e=>{e.key==="Escape"&&this.open&&(this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},document.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){var t;document.removeEventListener("keydown",this._onKeydown),(t=super.disconnectedCallback)==null||t.call(this)}};Dt.styles=p`
|
|
1792
1840
|
:host {
|
|
1793
1841
|
display: contents;
|
|
1794
1842
|
font-family: var(--fx-font-family);
|
|
@@ -1906,8 +1954,8 @@
|
|
|
1906
1954
|
padding: var(--fx-space-md);
|
|
1907
1955
|
flex: 1;
|
|
1908
1956
|
}
|
|
1909
|
-
`;let
|
|
1910
|
-
<span class="info">${this.total?`${
|
|
1957
|
+
`;let tt=Dt;function we(){return b("fx-drawer",tt)}we();const Mt=class Mt extends f{static get observedAttributes(){return["page","total","rows","rows-options","position"]}get page(){return Number(this.getAttr("page","1"))||1}set page(t){this.setAttribute("page",String(t))}get total(){return Number(this.getAttr("total","0"))||0}set total(t){this.setAttribute("total",String(t))}get rows(){return Number(this.getAttr("rows","10"))||10}set rows(t){this.setAttribute("rows",String(t))}get pages(){return Math.max(1,Math.ceil(this.total/this.rows))}render(){const t=this.pages,e=Math.min(Math.max(1,this.page),t),r=(this.getAttr("rows-options","5,10,20,50")||"").split(",").map(c=>c.trim()).filter(Boolean),s=[];for(let c=Math.max(1,e-2);c<=Math.min(t,e+2);c++)s.push(c);const i=o(e,this.rows),a=Math.min(e*this.rows,this.total);this.setTemplate(`
|
|
1958
|
+
<span class="info">${this.total?`${i}-${a} de ${this.total}`:"0 itens"}</span>
|
|
1911
1959
|
<button type="button" class="nav" part="prev" data-go="${e-1}" ${e<=1?"disabled":""}>‹</button>
|
|
1912
1960
|
${s[0]!==1&&t>5?'<button type="button" class="nav" data-go="1">1</button>':""}
|
|
1913
1961
|
${s.map(c=>`<button type="button" class="nav ${c===e?"active":""}" data-go="${c}">${c}</button>`).join("")}
|
|
@@ -1917,7 +1965,7 @@
|
|
|
1917
1965
|
<select class="nav" part="rows" aria-label="Itens por página">
|
|
1918
1966
|
${r.map(c=>`<option value="${c}" ${Number(c)===this.rows?"selected":""}>${c}</option>`).join("")}
|
|
1919
1967
|
</select>`:""}
|
|
1920
|
-
`);function
|
|
1968
|
+
`);function o(c,u){return(c-1)*u+1}this.root.querySelectorAll(".nav[data-go]").forEach(c=>{c.addEventListener("click",()=>{const u=Number(c.dataset.go);u>=1&&u<=t&&u!==e&&(this.page=u,this.emit())})});const n=this.root.querySelector("select.nav");n==null||n.addEventListener("change",()=>{this.rows=Number(n.value),this.page=1,this.emit()})}emit(){this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,composed:!0,detail:{page:this.page,rows:this.rows}}))}};Mt.styles=p`
|
|
1921
1969
|
:host {
|
|
1922
1970
|
display: flex;
|
|
1923
1971
|
align-items: center;
|
|
@@ -1953,11 +2001,11 @@
|
|
|
1953
2001
|
}
|
|
1954
2002
|
.info { color: var(--fx-text-muted); font-size: calc(var(--fx-font-size) - 2px); }
|
|
1955
2003
|
select.nav { cursor: pointer; }
|
|
1956
|
-
`;let
|
|
2004
|
+
`;let et=Mt;function Ae(){return b("fx-pagination",et)}Ae();const qt=class qt extends f{static get observedAttributes(){return["size","placeholder","source","disabled","min-chars"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}get source(){try{const t=JSON.parse(this.getAttr("source","[]"));return Array.isArray(t)?t.map(String):[]}catch(t){return[]}}render(){const t=this.getAttr("placeholder");this.setTemplate(`
|
|
1957
2005
|
<input class="field" part="input" type="text"
|
|
1958
2006
|
${t?`placeholder="${t}"`:""} autocomplete="off"/>
|
|
1959
2007
|
<div class="list" part="list" role="listbox"></div>
|
|
1960
|
-
`);const e=this.root.querySelector(".field");if(!e)return;e.value=this.value,this.hasAttr("disabled")&&e.setAttribute("disabled","");const r=this.root.querySelector(".list"),s=Number(this.getAttr("min-chars","1"))||1,
|
|
2008
|
+
`);const e=this.root.querySelector(".field");if(!e)return;e.value=this.value,this.hasAttr("disabled")&&e.setAttribute("disabled","");const r=this.root.querySelector(".list"),s=Number(this.getAttr("min-chars","1"))||1,i=()=>{if(!r)return;const a=e.value.toLowerCase(),o=this.source.filter(n=>n.toLowerCase().includes(a)).slice(0,8);r.innerHTML=o.length?o.map(n=>`<button type="button" class="opt" role="option" data-v="${n}">${n}</button>`).join(""):'<div class="empty">Nenhum resultado</div>',r.querySelectorAll(".opt").forEach(n=>{n.addEventListener("click",()=>{var c;e.value=(c=n.dataset.v)!=null?c:"",this.value=e.value,this.toggleAttr("open",!1),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{value:this.value}}))})}),this.toggleAttr("open",!0)};e.addEventListener("input",()=>{this.value=e.value,i()}),e.addEventListener("focus",()=>{e.value.length>=s&&i()}),document.addEventListener("click",a=>{this.contains(a.target)||this.toggleAttr("open",!1)})}};qt.styles=p`
|
|
1961
2009
|
:host {
|
|
1962
2010
|
position: relative;
|
|
1963
2011
|
display: inline-block;
|
|
@@ -2019,4 +2067,614 @@
|
|
|
2019
2067
|
}
|
|
2020
2068
|
.opt:hover { background: color-mix(in srgb, var(--fx-color-primary) 12%, var(--fx-surface-background)); color: var(--fx-color-primary); }
|
|
2021
2069
|
.empty { color: var(--fx-text-muted); font-size: calc(var(--fx-font-size) - 2px); padding: var(--fx-space-sm) var(--fx-space-md); }
|
|
2022
|
-
`;let
|
|
2070
|
+
`;let rt=qt;function _e(){return b("fx-autocomplete",rt)}_e();const It=class It extends f{constructor(){super(...arguments),this._isDragging=!1,this._startY=0,this._startValue=0,this._onMouseMove=t=>{if(!this._isDragging)return;const e=this._startY-t.clientY,r=(this.max-this.min)/100;this.emitChange(this._startValue+e*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(t){if(this.readonly||this.disabled)return;const e=this.clampValue(t),r=this.clampValue(Number(this.getAttr("value","0"))||0);e!==r&&(this.setAttribute("value",String(e)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}})))}get min(){return Number(this.getAttr("min","0"))||0}set min(t){this.setAttribute("min",String(t))}get max(){return Number(this.getAttr("max","100"))||100}set max(t){this.setAttribute("max",String(t))}get step(){return Number(this.getAttr("step","1"))||1}set step(t){this.setAttribute("step",String(t))}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get strokeWidth(){return Number(this.getAttr("stroke-width","8"))||8}set strokeWidth(t){this.setAttribute("stroke-width",String(t))}get valueColor(){return this.getAttr("value-color","")}set valueColor(t){this.setAttribute("value-color",t)}get rangeColor(){return this.getAttr("range-color","")}set rangeColor(t){this.setAttribute("range-color",t)}get readonly(){return this.hasAttr("readonly")}set readonly(t){this.toggleAttr("readonly",!!t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get valueTemplate(){return this.getAttr("value-template","{value}")}set valueTemplate(t){this.setAttribute("value-template",t)}render(){const t=this.min,e=this.max,r=this.clampValue(this.value),s=e-t,i=s>0?(r-t)/s:0,a=this.getSizeNum(),o=this.strokeWidth,n=(a-o)/2,c=2*Math.PI*n,u=c*(1-i),l=this.valueColor?`--_value-color: ${this.valueColor};`:"",h=this.rangeColor?`--_range-color: ${this.rangeColor};`:"",d=this.valueTemplate.replace("{value}",String(Math.round(r)));this.setTemplate(`
|
|
2071
|
+
<div class="knob" part="knob" tabindex="${this.disabled?"-1":"0"}"
|
|
2072
|
+
role="slider" aria-valuenow="${r}" aria-valuemin="${t}" aria-valuemax="${e}"
|
|
2073
|
+
aria-readonly="${this.readonly}" aria-disabled="${this.disabled}"
|
|
2074
|
+
style="${l}${h}">
|
|
2075
|
+
<svg viewBox="0 0 ${a} ${a}" part="svg">
|
|
2076
|
+
<circle class="track" part="track"
|
|
2077
|
+
cx="${a/2}" cy="${a/2}" r="${n}" />
|
|
2078
|
+
<circle class="value" part="value"
|
|
2079
|
+
cx="${a/2}" cy="${a/2}" r="${n}"
|
|
2080
|
+
stroke-dasharray="${c}"
|
|
2081
|
+
stroke-dashoffset="${u}" />
|
|
2082
|
+
</svg>
|
|
2083
|
+
<div class="label" part="label">${d}</div>
|
|
2084
|
+
</div>
|
|
2085
|
+
`),this.attachListeners()}getSizeNum(){const t=this.size;return t==="sm"?60:t==="lg"?140:100}clampValue(t){const e=this.min,r=this.max,s=this.step;let i=Math.min(r,Math.max(e,t));return s>0&&(i=Math.round((i-e)/s)*s+e,i=Math.min(r,Math.max(e,i))),i}emitChange(t){const e=this.clampValue(t);e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}})))}attachListeners(){const t=this.root.querySelector(".knob");t&&(t.addEventListener("mousedown",e=>{this.readonly||this.disabled||(e.preventDefault(),this._isDragging=!0,this._startY=e.clientY,this._startValue=this.value,t.focus(),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp))}),t.addEventListener("touchstart",e=>{this.readonly||this.disabled||(e.preventDefault(),this._isDragging=!0,this._startY=e.touches[0].clientY,this._startValue=this.value,t.focus())},{passive:!1}),t.addEventListener("touchmove",e=>{if(!this._isDragging||this.readonly||this.disabled)return;e.preventDefault();const r=this._startY-e.touches[0].clientY,s=(this.max-this.min)/100;this.emitChange(this._startValue+r*s)},{passive:!1}),t.addEventListener("touchend",()=>{this._isDragging=!1}),t.addEventListener("keydown",e=>{if(this.readonly||this.disabled)return;const r=this.step;switch(e.key){case"ArrowUp":case"ArrowRight":e.preventDefault(),this.emitChange(this.value+r);break;case"ArrowDown":case"ArrowLeft":e.preventDefault(),this.emitChange(this.value-r);break;case"Home":e.preventDefault(),this.emitChange(this.min);break;case"End":e.preventDefault(),this.emitChange(this.max);break;case"PageUp":e.preventDefault(),this.emitChange(this.value+r*10);break;case"PageDown":e.preventDefault(),this.emitChange(this.value-r*10);break}}))}disconnectedCallback(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),super.disconnectedCallback()}};It.styles=p`
|
|
2086
|
+
:host {
|
|
2087
|
+
display: inline-flex;
|
|
2088
|
+
align-items: center;
|
|
2089
|
+
justify-content: center;
|
|
2090
|
+
font-family: var(--fx-font-family);
|
|
2091
|
+
font-size: var(--fx-font-size);
|
|
2092
|
+
--_size: 100px;
|
|
2093
|
+
--_stroke-width: 8px;
|
|
2094
|
+
--_value-color: var(--fx-color-primary);
|
|
2095
|
+
--_range-color: var(--fx-border-default);
|
|
2096
|
+
}
|
|
2097
|
+
:host([size='sm']) { --_size: 60px; }
|
|
2098
|
+
:host([size='lg']) { --_size: 140px; }
|
|
2099
|
+
.knob {
|
|
2100
|
+
position: relative;
|
|
2101
|
+
width: var(--_size);
|
|
2102
|
+
height: var(--_size);
|
|
2103
|
+
cursor: pointer;
|
|
2104
|
+
user-select: none;
|
|
2105
|
+
touch-action: none;
|
|
2106
|
+
}
|
|
2107
|
+
:host([readonly]) .knob,
|
|
2108
|
+
:host([disabled]) .knob {
|
|
2109
|
+
cursor: default;
|
|
2110
|
+
pointer-events: none;
|
|
2111
|
+
}
|
|
2112
|
+
:host([disabled]) .knob {
|
|
2113
|
+
opacity: 0.55;
|
|
2114
|
+
}
|
|
2115
|
+
svg {
|
|
2116
|
+
width: 100%;
|
|
2117
|
+
height: 100%;
|
|
2118
|
+
transform: rotate(-90deg);
|
|
2119
|
+
}
|
|
2120
|
+
.track {
|
|
2121
|
+
fill: none;
|
|
2122
|
+
stroke: var(--_range-color);
|
|
2123
|
+
stroke-width: var(--_stroke-width);
|
|
2124
|
+
}
|
|
2125
|
+
.value {
|
|
2126
|
+
fill: none;
|
|
2127
|
+
stroke: var(--_value-color);
|
|
2128
|
+
stroke-width: var(--_stroke-width);
|
|
2129
|
+
stroke-linecap: round;
|
|
2130
|
+
transition: stroke-dashoffset var(--fx-motion-duration-fast) var(--fx-motion-easing);
|
|
2131
|
+
}
|
|
2132
|
+
.label {
|
|
2133
|
+
position: absolute;
|
|
2134
|
+
inset: 0;
|
|
2135
|
+
display: flex;
|
|
2136
|
+
align-items: center;
|
|
2137
|
+
justify-content: center;
|
|
2138
|
+
font-weight: 600;
|
|
2139
|
+
color: var(--fx-text-default);
|
|
2140
|
+
pointer-events: none;
|
|
2141
|
+
}
|
|
2142
|
+
:host([size='sm']) .label { font-size: 11px; }
|
|
2143
|
+
:host([size='md']) .label { font-size: 14px; }
|
|
2144
|
+
:host([size='lg']) .label { font-size: 18px; }
|
|
2145
|
+
.knob:focus-visible {
|
|
2146
|
+
outline: none;
|
|
2147
|
+
}
|
|
2148
|
+
.knob:focus-visible svg {
|
|
2149
|
+
filter: drop-shadow(var(--fx-effect-focus-ring, 0 0 0 3px color-mix(in srgb, var(--fx-color-primary) 22%, transparent)));
|
|
2150
|
+
}
|
|
2151
|
+
`;let st=It;function Se(){return b("fx-knob",st)}Se();const Nt=class Nt extends f{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(t){this._data=t,this._filteredData=null,this.render()}get data(){return this._data}set selection(t){this._selection=t,this.render()}get selection(){return this._selection}get dataKey(){return this.getAttr("data-key","")}set dataKey(t){this.setAttribute("data-key",t)}get filter(){return this.hasAttr("filter")}set filter(t){this.toggleAttr("filter",t)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(t){this.setAttribute("filter-by",t)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(t){this.setAttribute("filter-placeholder",t)}get breakpoint(){return this.getAttr("breakpoint","960px")}set breakpoint(t){this.setAttribute("breakpoint",t)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(t){this.toggleAttr("dragdrop",t)}get striped(){return this.hasAttr("striped")}set striped(t){this.toggleAttr("striped",t)}get selectionMode(){const t=this.getAttr("selection-mode","");return t==="single"||t==="multiple"?t:""}set selectionMode(t){this.setAttribute("selection-mode",t)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(t){this.toggleAttr("show-select-all",t)}get filterValue(){return this._filterValue}set filterValue(t){this._filterValue=t,this._applyFilter(),this._updateListDisplay()}setOptionTemplate(t){this._optionTemplate=t,this.render()}connectedCallback(){this._parseDataAttribute(),super.connectedCallback()}attributeChangedCallback(){this.getAttr("data","")!==""&&this._parseDataAttribute(),super.attributeChangedCallback()}_parseDataAttribute(){const t=this.getAttr("data","");if(t)try{this._data=JSON.parse(t),this._filteredData=null}catch(e){this._data=[]}}_applyFilter(){if(!this._filterValue){this._filteredData=null;return}const t=this.filterBy.split(",").map(e=>e.trim());this._filteredData=this._data.filter(e=>t.some(r=>{const s=e[r];return s==null?!1:String(s).toLowerCase().includes(this._filterValue.toLowerCase())}))}_getDisplayData(){return this._filteredData||this._data}_getItemKey(t,e){return this.dataKey&&t[this.dataKey]!=null?String(t[this.dataKey]):t.id!=null?String(t.id):t.key!=null?String(t.key):t.label!=null?String(t.label):t.name!=null?String(t.name):t.value!=null?String(t.value):String(e)}_getItemLabel(t){const e=["label","name","title","text","value"];for(const r of e)if(t[r]!=null)return String(t[r]);return JSON.stringify(t)}_isSelected(t){return this._selection.some(e=>this._getItemKey(e,-1)===this._getItemKey(t,-1))}_moveItem(t,e){const r=this._getActualIndex(t),s=this._getActualIndex(e);if(r===-1||s===-1)return;const i=this._data.splice(r,1)[0];this._data.splice(s,0,i),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_getActualIndex(t){if(this._filteredData){const e=this._filteredData[t];return this._data.findIndex(r=>this._getItemKey(r,-1)===this._getItemKey(e,-1))}return t}_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(t){const e=this._getItemKey(t,-1),r=this._selection.findIndex(s=>this._getItemKey(s,-1)===e);r>=0?this._selection.splice(r,1):this.selectionMode==="multiple"?this._selection.push(t):this._selection=[t],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_selectAll(){const t=this._getDisplayData();this._selection=[...t],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_deselectAll(){this._selection=[],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_toggleSelectAll(){const t=this._getDisplayData();this._selection.length===t.length?this._deselectAll():this._selectAll()}render(){const t=this._getDisplayData(),e=this.selectionMode,r=this.selectionMode==="multiple",s=r&&t.length>0&&this._selection.length===t.length;this.setTemplate(`
|
|
2152
|
+
<div class="container" part="container">
|
|
2153
|
+
${this.filter?`
|
|
2154
|
+
<div class="filter-wrapper" part="filter-wrapper">
|
|
2155
|
+
<input type="text" class="filter-input" part="filter-input"
|
|
2156
|
+
placeholder="${this.filterPlaceholder}"
|
|
2157
|
+
value="${E(this._filterValue)}"
|
|
2158
|
+
aria-label="Filtrar lista" />
|
|
2159
|
+
</div>
|
|
2160
|
+
`:""}
|
|
2161
|
+
<div class="main-row" part="main-row">
|
|
2162
|
+
<div class="controls-bar" part="controls-bar">
|
|
2163
|
+
<div class="control-group">
|
|
2164
|
+
<button class="control-btn" data-action="top" part="control-btn" aria-label="Mover para o inicio">
|
|
2165
|
+
<span class="control-btn-icon">«</span>
|
|
2166
|
+
</button>
|
|
2167
|
+
<button class="control-btn" data-action="up" part="control-btn" aria-label="Mover para cima">
|
|
2168
|
+
<span class="control-btn-icon">↑</span>
|
|
2169
|
+
</button>
|
|
2170
|
+
</div>
|
|
2171
|
+
<div class="control-group">
|
|
2172
|
+
<button class="control-btn" data-action="down" part="control-btn" aria-label="Mover para baixo">
|
|
2173
|
+
<span class="control-btn-icon">↓</span>
|
|
2174
|
+
</button>
|
|
2175
|
+
<button class="control-btn" data-action="bottom" part="control-btn" aria-label="Mover para o fim">
|
|
2176
|
+
<span class="control-btn-icon">»</span>
|
|
2177
|
+
</button>
|
|
2178
|
+
</div>
|
|
2179
|
+
</div>
|
|
2180
|
+
<div class="list-wrapper" part="list-wrapper">
|
|
2181
|
+
${r&&this.showSelectAll?`
|
|
2182
|
+
<div class="select-all-bar" part="select-all-bar">
|
|
2183
|
+
<label>
|
|
2184
|
+
<input type="checkbox" class="select-all-checkbox"
|
|
2185
|
+
${s?"checked":""}
|
|
2186
|
+
aria-label="Selecionar todos" />
|
|
2187
|
+
Selecionar Todos
|
|
2188
|
+
</label>
|
|
2189
|
+
<span class="selection-count">${this._selection.length} selecionado(s)</span>
|
|
2190
|
+
</div>
|
|
2191
|
+
`:""}
|
|
2192
|
+
<ul class="list" part="list" role="listbox"
|
|
2193
|
+
aria-multiselectable="${r}"
|
|
2194
|
+
tabindex="0">
|
|
2195
|
+
${t.length===0?`
|
|
2196
|
+
<li class="empty-message" part="empty-message">
|
|
2197
|
+
${this.filter?"Nenhum resultado encontrado":"Nenhum item disponivel"}
|
|
2198
|
+
</li>
|
|
2199
|
+
`:t.map((i,a)=>{const o=this._getItemKey(i,a),n=this._getItemLabel(i),c=this._isSelected(i),u=this._optionTemplate?this._optionTemplate(i):E(n);return`
|
|
2200
|
+
<li class="list-item${c?" selected":""}" part="list-item"
|
|
2201
|
+
data-index="${a}" data-key="${E(o)}"
|
|
2202
|
+
role="option" aria-selected="${c}"
|
|
2203
|
+
${this.dragdrop?'draggable="true"':""}
|
|
2204
|
+
tabindex="0">
|
|
2205
|
+
${this.dragdrop?'<span class="drag-handle" part="drag-handle" aria-label="Arrastar">⋮⋮</span>':""}
|
|
2206
|
+
${e?`
|
|
2207
|
+
<input type="checkbox" class="checkbox" part="checkbox"
|
|
2208
|
+
${c?"checked":""}
|
|
2209
|
+
aria-label="Selecionar ${E(n)}" />
|
|
2210
|
+
`:""}
|
|
2211
|
+
<span class="item-content" part="item-content">${u}</span>
|
|
2212
|
+
</li>
|
|
2213
|
+
`}).join("")}
|
|
2214
|
+
</ul>
|
|
2215
|
+
</div>
|
|
2216
|
+
</div>
|
|
2217
|
+
</div>
|
|
2218
|
+
`),this._attachListeners(),this._attachItemListeners(this.root.querySelector(".list")),this._updateControlsState()}_attachListeners(){if(this._listenersAttached)return;this._listenersAttached=!0;const t=this.root;t.addEventListener("input",r=>{const s=r.target;s.classList.contains("filter-input")&&(this.filterValue=s.value)}),t.addEventListener("change",r=>{r.target.classList.contains("select-all-checkbox")&&this._toggleSelectAll()}),t.addEventListener("click",r=>{const i=r.target.closest(".control-btn");i&&this._handleMoveAction(i.dataset.action)});let e=null;t.addEventListener("dragstart",r=>{const s=r.target.closest(".list-item");s&&(this._draggedIndex=Number(s.dataset.index),s.classList.add("dragging"),r.dataTransfer.effectAllowed="move")}),t.addEventListener("dragend",r=>{r.target.classList.remove("dragging"),this._draggedIndex=null,t.querySelectorAll(".drag-over").forEach(i=>i.classList.remove("drag-over")),e=null}),t.addEventListener("dragover",r=>{r.preventDefault();const s=r.target.closest(".list-item");!s||s.classList.contains("dragging")||(e&&e.classList.remove("drag-over"),s.classList.add("drag-over"),e=s)}),t.addEventListener("drop",r=>{if(r.preventDefault(),this._draggedIndex===null)return;const s=r.target.closest(".list-item");if(!s)return;const i=Number(s.dataset.index);s.classList.remove("drag-over"),e=null,this._moveItem(this._draggedIndex,i),this._draggedIndex=null}),this._updateControlsState()}_attachItemListeners(t){t&&(t.addEventListener("click",e=>{const r=e.target,s=r.closest(".list-item");if(!s)return;if(r.classList.contains("checkbox")){e.stopPropagation();const a=Number(s.dataset.index);this._toggleSelection(this._getDisplayData()[a]);return}const i=Number(s.dataset.index);this._toggleSelection(this._getDisplayData()[i])}),t.addEventListener("keydown",e=>{const r=e.target;if(!r.classList.contains("list-item"))return;const s=Array.from(t.querySelectorAll(".list-item")),i=s.indexOf(r);switch(e.key){case"ArrowUp":e.preventDefault(),i>0&&s[i-1].focus();break;case"ArrowDown":e.preventDefault(),i<s.length-1&&s[i+1].focus();break;case" ":case"Enter":if(e.preventDefault(),this.selectionMode){const o=Number(r.dataset.index);this._toggleSelection(this._getDisplayData()[o])}break}}))}_updateListDisplay(){const t=this.root.querySelector(".list-wrapper");if(!t){this.render();return}const e=this._getDisplayData(),r=this.selectionMode,s=this.selectionMode==="multiple",i=s&&e.length>0&&this._selection.length===e.length;t.innerHTML=`
|
|
2219
|
+
${s&&this.showSelectAll?`
|
|
2220
|
+
<div class="select-all-bar" part="select-all-bar">
|
|
2221
|
+
<label>
|
|
2222
|
+
<input type="checkbox" class="select-all-checkbox"
|
|
2223
|
+
${i?"checked":""}
|
|
2224
|
+
aria-label="Selecionar todos" />
|
|
2225
|
+
Selecionar Todos
|
|
2226
|
+
</label>
|
|
2227
|
+
<span class="selection-count">${this._selection.length} selecionado(s)</span>
|
|
2228
|
+
</div>
|
|
2229
|
+
`:""}
|
|
2230
|
+
<ul class="list" part="list" role="listbox"
|
|
2231
|
+
aria-multiselectable="${s}"
|
|
2232
|
+
tabindex="0">
|
|
2233
|
+
${e.length===0?`
|
|
2234
|
+
<li class="empty-message" part="empty-message">
|
|
2235
|
+
${this.filter?"Nenhum resultado encontrado":"Nenhum item disponivel"}
|
|
2236
|
+
</li>
|
|
2237
|
+
`:e.map((a,o)=>{const n=this._getItemKey(a,o),c=this._getItemLabel(a),u=this._isSelected(a),l=this._optionTemplate?this._optionTemplate(a):E(c);return`
|
|
2238
|
+
<li class="list-item${u?" selected":""}" part="list-item"
|
|
2239
|
+
data-index="${o}" data-key="${E(n)}"
|
|
2240
|
+
role="option" aria-selected="${u}"
|
|
2241
|
+
${this.dragdrop?'draggable="true"':""}
|
|
2242
|
+
tabindex="0">
|
|
2243
|
+
${this.dragdrop?'<span class="drag-handle" part="drag-handle" aria-label="Arrastar">⋮⋮</span>':""}
|
|
2244
|
+
${r?`
|
|
2245
|
+
<input type="checkbox" class="checkbox" part="checkbox"
|
|
2246
|
+
${u?"checked":""}
|
|
2247
|
+
aria-label="Selecionar ${E(c)}" />
|
|
2248
|
+
`:""}
|
|
2249
|
+
<span class="item-content" part="item-content">${l}</span>
|
|
2250
|
+
</li>
|
|
2251
|
+
`}).join("")}
|
|
2252
|
+
</ul>
|
|
2253
|
+
`,this._attachListeners(),this._attachItemListeners(this.root.querySelector(".list"))}_handleMoveAction(t){if(!this._selection.length)return;const e=this._getDisplayData(),r=this._selection.map(s=>e.findIndex(i=>this._getItemKey(i,-1)===this._getItemKey(s,-1))).filter(s=>s>=0).sort((s,i)=>s-i);if(r.length!==0)switch(t){case"top":this._moveSelectedToStart(r);break;case"up":this._moveSelectedByOne(r,-1);break;case"down":this._moveSelectedByOne(r,1);break;case"bottom":this._moveSelectedToEnd(r);break}}_moveSelectedToStart(t){const e=[],r=[];for(const i of t){const a=this._getActualIndex(i);e.push(this._data[a]),r.push(a)}r.sort((i,a)=>a-i).forEach(i=>this._data.splice(i,1));const s=this._getActualIndex(0);this._data.splice(s,0,...e),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_moveSelectedToEnd(t){const e=[],r=[];for(const a of t){const o=this._getActualIndex(a);e.push(this._data[o]),r.push(o)}r.sort((a,o)=>o-a).forEach(a=>this._data.splice(a,1));const s=this._getDisplayData(),i=this._getActualIndex(s.length-1);this._data.splice(i+1,0,...e),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_moveSelectedByOne(t,e){if(this._getDisplayData().length===0)return;const s=t.map(o=>this._getActualIndex(o)).filter(o=>o>=0).sort((o,n)=>o-n);if(s.length===0||e<0&&s[0]<=0||e>0&&s[s.length-1]>=this._data.length-1)return;const i=s.map(o=>this._data[o]);for(let o=s.length-1;o>=0;o--)this._data.splice(s[o],1);let a;e<0?a=s[0]-1:a=s[s.length-1]-s.length+1+1,a=Math.max(0,Math.min(a,this._data.length)),this._data.splice(a,0,...i),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_updateControlsState(){const t=this._getDisplayData(),e=this._selection.map(s=>t.findIndex(i=>this._getItemKey(i,-1)===this._getItemKey(s,-1))).filter(s=>s>=0);this.root.querySelectorAll(".control-btn").forEach(s=>{const i=s.dataset.action;let a=e.length===0;if(!a)switch(i){case"top":case"up":a=e[0]===0;break;case"bottom":case"down":a=e[e.length-1]===t.length-1;break}s.disabled=a})}};Nt.styles=p`
|
|
2254
|
+
|
|
2255
|
+
:host {
|
|
2256
|
+
display: block;
|
|
2257
|
+
font-family: var(--fx-font-family);
|
|
2258
|
+
font-size: var(--fx-font-size);
|
|
2259
|
+
--orderlist-primary: var(--fx-color-primary, #3b82f6);
|
|
2260
|
+
--orderlist-border: var(--fx-border-default, #e2e8f0);
|
|
2261
|
+
--orderlist-bg: var(--fx-surface-background, #ffffff);
|
|
2262
|
+
--orderlist-bg-hover: var(--fx-surface-surface-hover, #f1f5f9);
|
|
2263
|
+
--orderlist-text: var(--fx-text-default, #1e293b);
|
|
2264
|
+
--orderlist-text-muted: var(--fx-text-muted, #64748b);
|
|
2265
|
+
--orderlist-radius: var(--fx-radius-md, 8px);
|
|
2266
|
+
--orderlist-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
2267
|
+
--orderlist-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
2268
|
+
}
|
|
2269
|
+
* { box-sizing: border-box; }
|
|
2270
|
+
.container { display: flex; flex-direction: column; gap: var(--fx-space-md, 16px); }
|
|
2271
|
+
.list-wrapper { display: flex; flex-direction: column; gap: var(--fx-space-sm, 8px); flex: 1; min-width: 0; }
|
|
2272
|
+
.select-all-bar { display: flex; align-items: center; justify-content: space-between; padding: var(--fx-space-sm, 10px) var(--fx-space-md, 14px); background: linear-gradient(135deg, var(--orderlist-bg), var(--orderlist-bg-hover)); border: 1px solid var(--orderlist-border); border-radius: var(--orderlist-radius); font-size: 0.9em; font-weight: 500; }
|
|
2273
|
+
.select-all-bar label { display: flex; align-items: center; gap: var(--fx-space-sm, 10px); cursor: pointer; user-select: none; color: var(--orderlist-text); }
|
|
2274
|
+
.select-all-bar input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--orderlist-primary); cursor: pointer; }
|
|
2275
|
+
.filter-wrapper { margin-bottom: var(--fx-space-xs, 4px); }
|
|
2276
|
+
.filter-input { width: 100%; padding: var(--fx-space-sm, 10px) var(--fx-space-md, 14px); padding-left: 42px; border: 1.5px solid var(--orderlist-border); border-radius: var(--orderlist-radius); font-family: inherit; font-size: inherit; color: var(--orderlist-text); background: var(--orderlist-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 14px center; transition: var(--orderlist-transition); }
|
|
2277
|
+
.filter-input:focus { outline: none; border-color: var(--orderlist-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orderlist-primary) 20%, transparent); }
|
|
2278
|
+
.filter-input::placeholder { color: var(--orderlist-text-muted); }
|
|
2279
|
+
.main-row { display: flex; align-items: stretch; gap: var(--fx-space-sm, 8px); }
|
|
2280
|
+
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--orderlist-border); border-radius: var(--orderlist-radius); overflow: hidden; box-shadow: var(--orderlist-shadow); max-height: 450px; overflow-y: auto; flex: 1; }
|
|
2281
|
+
.list::-webkit-scrollbar { width: 6px; }
|
|
2282
|
+
.list::-webkit-scrollbar-track { background: transparent; }
|
|
2283
|
+
.list::-webkit-scrollbar-thumb { background: var(--orderlist-border); border-radius: 3px; }
|
|
2284
|
+
.list::-webkit-scrollbar-thumb:hover { background: var(--orderlist-text-muted); }
|
|
2285
|
+
.selection-count { font-size: 0.85em; color: var(--orderlist-primary); background: color-mix(in srgb, var(--orderlist-primary) 12%, transparent); padding: 4px 12px; border-radius: 20px; font-weight: 600; }
|
|
2286
|
+
:host([striped]) .list-item:nth-child(even) { background: var(--fx-surface-surface, #f8fafc); }
|
|
2287
|
+
.list-item { display: flex; align-items: center; gap: var(--fx-space-sm, 10px); padding: var(--fx-space-sm, 10px) var(--fx-space-md, 14px); background: var(--orderlist-bg); border-bottom: 1px solid var(--orderlist-border); cursor: pointer; user-select: none; transition: var(--orderlist-transition); }
|
|
2288
|
+
.list-item:last-child { border-bottom: none; }
|
|
2289
|
+
.list-item:hover { background: var(--orderlist-bg-hover); }
|
|
2290
|
+
.list-item.selected { background: color-mix(in srgb, var(--orderlist-primary) 8%, transparent); border-left: 3px solid var(--orderlist-primary); padding-left: 11px; }
|
|
2291
|
+
.list-item:focus-visible { outline: none; background: color-mix(in srgb, var(--orderlist-primary) 15%, transparent); }
|
|
2292
|
+
.list-item.dragging { opacity: 0.5; background: var(--orderlist-bg-hover); }
|
|
2293
|
+
.list-item.drag-over { border-top: 2px solid var(--orderlist-primary); }
|
|
2294
|
+
.drag-handle { color: var(--orderlist-text-muted); cursor: grab; flex-shrink: 0; font-size: 1.2em; opacity: 0.6; transition: var(--orderlist-transition); }
|
|
2295
|
+
.drag-handle:hover { opacity: 1; }
|
|
2296
|
+
.drag-handle:active { cursor: grabbing; }
|
|
2297
|
+
.item-content { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2298
|
+
.checkbox { flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--orderlist-primary); cursor: pointer; transition: var(--orderlist-transition); }
|
|
2299
|
+
.checkbox:hover { transform: scale(1.1); }
|
|
2300
|
+
.empty-message { padding: var(--fx-space-xl, 32px); text-align: center; color: var(--orderlist-text-muted); font-style: italic; }
|
|
2301
|
+
.controls-bar {
|
|
2302
|
+
display: flex;
|
|
2303
|
+
flex-direction: column;
|
|
2304
|
+
gap: 4px;
|
|
2305
|
+
padding: var(--fx-space-xs, 6px);
|
|
2306
|
+
background: var(--orderlist-bg);
|
|
2307
|
+
border: 1px solid var(--orderlist-border);
|
|
2308
|
+
border-radius: var(--orderlist-radius);
|
|
2309
|
+
box-shadow: var(--orderlist-shadow);
|
|
2310
|
+
height: fit-content;
|
|
2311
|
+
position: sticky;
|
|
2312
|
+
top: 0;
|
|
2313
|
+
align-self: flex-start;
|
|
2314
|
+
}
|
|
2315
|
+
.control-group { display: flex; flex-direction: column; gap: 3px; }
|
|
2316
|
+
.control-group + .control-group { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--orderlist-border); }
|
|
2317
|
+
button.control-btn { display: flex; align-items: center; justify-content: center; width: 42px; height: 38px; padding: 0; border: none; border-radius: 8px; background: transparent; color: var(--orderlist-text-muted); cursor: pointer; font-size: 16px; line-height: 1; transition: var(--orderlist-transition); position: relative; }
|
|
2318
|
+
button.control-btn:hover:not(:disabled) { background: var(--orderlist-bg-hover); color: var(--orderlist-primary); transform: scale(1.1); }
|
|
2319
|
+
button.control-btn:active:not(:disabled) { transform: scale(0.92); background: color-mix(in srgb, var(--orderlist-primary) 15%, transparent); }
|
|
2320
|
+
button.control-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--orderlist-primary) 30%, transparent); }
|
|
2321
|
+
button.control-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
|
|
2322
|
+
.control-btn-icon { font-size: 18px; line-height: 1; }
|
|
2323
|
+
/* Tooltip nos botoes */
|
|
2324
|
+
button.control-btn:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }
|
|
2325
|
+
@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; } }
|
|
2326
|
+
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
|
|
2327
|
+
.list-item { animation: slideIn 0.2s ease-out; }
|
|
2328
|
+
@media (prefers-color-scheme: light) { :host { --orderlist-border: #334155; --orderlist-bg: #1e293b; --orderlist-bg-hover: #334155; --orderlist-text: #f1f5f9; --orderlist-text-muted: #94a3b8; --orderlist-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); } }
|
|
2329
|
+
`;let it=Nt;function E(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ze(){return b("fx-orderlist",it)}ze();const jt=class jt extends f{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(t){this._source=t,this._filteredSource=null,this.render()}get source(){return this._source}set target(t){this._target=t,this._filteredTarget=null,this.render()}get target(){return this._target}set sourceSelection(t){this._sourceSelection=t,this.render()}get sourceSelection(){return this._sourceSelection}set targetSelection(t){this._targetSelection=t,this.render()}get targetSelection(){return this._targetSelection}get sourceKey(){return this.getAttr("source-key","")}set sourceKey(t){this.setAttribute("source-key",t)}get targetKey(){return this.getAttr("target-key","")}set targetKey(t){this.setAttribute("target-key",t)}get filter(){return this.hasAttr("filter")}set filter(t){this.toggleAttr("filter",t)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(t){this.setAttribute("filter-by",t)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(t){this.setAttribute("filter-placeholder",t)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(t){this.toggleAttr("dragdrop",t)}get striped(){return this.hasAttr("striped")}set striped(t){this.toggleAttr("striped",t)}get selectionMode(){const t=this.getAttr("selection-mode","");return t==="single"||t==="multiple"?t:""}set selectionMode(t){this.setAttribute("selection-mode",t)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(t){this.toggleAttr("show-select-all",t)}get sourceLabel(){return this.getAttr("source-label","Disponíveis")}set sourceLabel(t){this.setAttribute("source-label",t)}get targetLabel(){return this.getAttr("target-label","Selecionados")}set targetLabel(t){this.setAttribute("target-label",t)}get sourceFilterValue(){return this._sourceFilterValue}set sourceFilterValue(t){this._sourceFilterValue=t,this._applySourceFilter(),this._updateListDisplay()}get targetFilterValue(){return this._targetFilterValue}set targetFilterValue(t){this._targetFilterValue=t,this._applyTargetFilter(),this._updateListDisplay()}setOptionTemplate(t){this._optionTemplate=t,this.render()}connectedCallback(){this._parseSourceAttribute(),this._parseTargetAttribute(),super.connectedCallback()}attributeChangedCallback(){this.getAttr("source","")!==""&&this._parseSourceAttribute(),this.getAttr("target","")!==""&&this._parseTargetAttribute(),super.attributeChangedCallback()}_parseSourceAttribute(){const t=this.getAttr("source","");if(t)try{this._source=JSON.parse(t),this._filteredSource=null}catch(e){this._source=[]}}_parseTargetAttribute(){const t=this.getAttr("target","");if(t)try{this._target=JSON.parse(t),this._filteredTarget=null}catch(e){this._target=[]}}_applySourceFilter(){if(!this._sourceFilterValue){this._filteredSource=null;return}const t=this.filterBy.split(",").map(e=>e.trim());this._filteredSource=this._source.filter(e=>t.some(r=>{const s=e[r];return s==null?!1:String(s).toLowerCase().includes(this._sourceFilterValue.toLowerCase())}))}_applyTargetFilter(){if(!this._targetFilterValue){this._filteredTarget=null;return}const t=this.filterBy.split(",").map(e=>e.trim());this._filteredTarget=this._target.filter(e=>t.some(r=>{const s=e[r];return s==null?!1:String(s).toLowerCase().includes(this._targetFilterValue.toLowerCase())}))}_getDisplaySource(){return this._filteredSource||this._source}_getDisplayTarget(){return this._filteredTarget||this._target}_getItemKey(t,e,r){const s=r?this.sourceKey:this.targetKey;return s&&t[s]!=null?String(t[s]):t.id!=null?String(t.id):t.key!=null?String(t.key):t.label!=null?String(t.label):t.name!=null?String(t.name):t.value!=null?String(t.value):String(e)}_getItemLabel(t){const e=["label","name","title","text","value"];for(const r of e)if(t[r]!=null)return String(t[r]);return JSON.stringify(t)}_isSourceSelected(t,e){return this._sourceSelection.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(t,e,!0))}_isTargetSelected(t,e){return this._targetSelection.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(t,e,!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 t=this._getDisplaySource(),e=this._getDisplayTarget(),r=this.selectionMode,s=r==="multiple"&&this.showSelectAll,i=t.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:t.map((c,u)=>`<li class="list-item${this._isSourceSelected(c,u)?" selected":""}" data-index="${u}" data-list="source" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isSourceSelected(c,u)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(c):$(this._getItemLabel(c))}</span></li>`).join(""),a=e.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:e.map((c,u)=>`<li class="list-item${this._isTargetSelected(c,u)?" selected":""}" data-index="${u}" data-list="target" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isTargetSelected(c,u)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(c):$(this._getItemLabel(c))}</span></li>`).join(""),o=s?`<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=s?`<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">${$(this.sourceLabel)} (${this._source.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input source-filter" placeholder="'+this.filterPlaceholder+'" value="'+$(this._sourceFilterValue)+'" /></div>':""}${o}<div class="list-wrapper"><ul class="list source-list" role="listbox" tabindex="0">${i}</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">${$(this.targetLabel)} (${this._target.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input target-filter" placeholder="'+this.filterPlaceholder+'" value="'+$(this._targetFilterValue)+'" /></div>':""}${n}<div class="list-wrapper"><ul class="list target-list" role="listbox" tabindex="0">${a}</ul></div></div></div>`),this._attachListeners()}_attachListeners(){this._filterListenersAttached||(this._filterListenersAttached=!0,this.root.addEventListener("input",t=>{const e=t.target;if(e.classList.contains("select-all-checkbox")){this._handleSelectAll(e);return}e.classList.contains("source-filter")?this.sourceFilterValue=e.value:e.classList.contains("target-filter")&&(this.targetFilterValue=e.value)}),this.root.addEventListener("click",t=>{const e=t.target,r=e.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 s=e.closest(".list-item");if(!s)return;const i=s.dataset.list==="source",a=Number(s.dataset.index),o=(i?this._getDisplaySource():this._getDisplayTarget())[a];i?this._toggleSourceSelection(o,a):this._toggleTargetSelection(o,a)})),this._updateControlsState()}_handleSelectAll(t){t.dataset.list==="source"?(this._sourceSelection=t.checked?[...this._getDisplaySource()]:[],this._emitSelectionChangeSource()):(this._targetSelection=t.checked?[...this._getDisplayTarget()]:[],this._emitSelectionChangeTarget()),this._updateSelectionDisplay(),this._updateControlsState()}_updateSelectionDisplay(){const t=(e,r,s)=>{e&&e.querySelectorAll(".list-item").forEach(i=>{const a=Number(i.dataset.index),o=r(s()[a],a);i.classList.toggle("selected",o),i.setAttribute("aria-selected",String(o));const n=i.querySelector(".checkbox");n&&(n.checked=o)})};t(this.root.querySelector(".source-list"),(e,r)=>this._isSourceSelected(e,r),()=>this._getDisplaySource()),t(this.root.querySelector(".target-list"),(e,r)=>this._isTargetSelected(e,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:e,total:r,sel:s})=>{var a;if(!e)return;e.checked=r>0&&s===r;const i=(a=e.closest(".select-all-bar"))==null?void 0:a.querySelector(".selection-count");i&&(i.textContent=`${s} selecionado(s)`)})}_updateControlsState(){this.root.querySelectorAll(".control-btn").forEach(t=>{const e=t.dataset.action;t.disabled=e==="move-target"&&this._sourceSelection.length===0||e==="move-all-target"&&this._source.length===0||e==="move-source"&&this._targetSelection.length===0||e==="move-all-source"&&this._target.length===0})}_moveToTarget(){if(!this._sourceSelection.length)return;const t=[...this._sourceSelection];this._source=this._source.filter(e=>!t.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(e,-1,!0))),this._target=[...this._target,...t],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveToSource(){if(!this._targetSelection.length)return;const t=[...this._targetSelection];this._target=this._target.filter(e=>!t.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(e,-1,!1))),this._source=[...this._source,...t],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_moveAllToTarget(){const t=[...this._source];this._source=[],this._target=[...this._target,...t],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveAllToSource(){const t=[...this._target];this._target=[],this._source=[...this._source,...t],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_toggleSourceSelection(t,e){const r=this.selectionMode||"single",s=this._getItemKey(t,e,!0),i=this._sourceSelection.findIndex(a=>this._getItemKey(a,-1,!0)===s);i>=0?this._sourceSelection.splice(i,1):r==="multiple"?this._sourceSelection.push(t):this._sourceSelection=[t],this._emitSelectionChangeSource(),this._updateSelectionDisplay(),this._updateControlsState()}_toggleTargetSelection(t,e){const r=this.selectionMode||"single",s=this._getItemKey(t,e,!1),i=this._targetSelection.findIndex(a=>this._getItemKey(a,-1,!1)===s);i>=0?this._targetSelection.splice(i,1):r==="multiple"?this._targetSelection.push(t):this._targetSelection=[t],this._emitSelectionChangeTarget(),this._updateSelectionDisplay(),this._updateControlsState()}_updateListDisplay(){var u,l;const t=(u=this.root.querySelector(".source-list"))==null?void 0:u.parentElement,e=(l=this.root.querySelector(".target-list"))==null?void 0:l.parentElement,r=this.root.querySelector(".list-container:first-of-type .list-label"),s=this.root.querySelector(".list-container:last-of-type .list-label");if(!t||!e){this.render();return}const i=this._getDisplaySource(),a=this._getDisplayTarget(),o=this.selectionMode,n=i.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:i.map((h,d)=>`<li class="list-item${this._isSourceSelected(h,d)?" selected":""}" part="list-item" data-index="${d}" data-list="source" role="option" aria-selected="${this._isSourceSelected(h,d)}" tabindex="0">${o?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isSourceSelected(h,d)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(h):$(this._getItemLabel(h))}</span></li>`).join(""),c=a.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:a.map((h,d)=>`<li class="list-item${this._isTargetSelected(h,d)?" selected":""}" part="list-item" data-index="${d}" data-list="target" role="option" aria-selected="${this._isTargetSelected(h,d)}" tabindex="0">${o?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isTargetSelected(h,d)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(h):$(this._getItemLabel(h))}</span></li>`).join("");t.innerHTML=`<ul class="list source-list" role="listbox" tabindex="0">${n}</ul>`,e.innerHTML=`<ul class="list target-list" role="listbox" tabindex="0">${c}</ul>`,r&&(r.textContent=`${this.sourceLabel} (${this._source.length})`),s&&(s.textContent=`${this.targetLabel} (${this._target.length})`),this._updateSelectAllBars(),this._attachListeners()}};jt.styles=p`
|
|
2330
|
+
:host {
|
|
2331
|
+
display: block;
|
|
2332
|
+
font-family: var(--fx-font-family);
|
|
2333
|
+
font-size: var(--fx-font-size);
|
|
2334
|
+
--picklist-primary: var(--fx-color-primary, #3b82f6);
|
|
2335
|
+
--picklist-border: var(--fx-border-default, #e2e8f0);
|
|
2336
|
+
--picklist-bg: var(--fx-surface-background, #ffffff);
|
|
2337
|
+
--picklist-bg-hover: var(--fx-surface-surface-hover, #f1f5f9);
|
|
2338
|
+
--picklist-text: var(--fx-text-default, #1e293b);
|
|
2339
|
+
--picklist-text-muted: var(--fx-text-muted, #64748b);
|
|
2340
|
+
--picklist-radius: var(--fx-radius-md, 8px);
|
|
2341
|
+
--picklist-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
2342
|
+
--picklist-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
2343
|
+
}
|
|
2344
|
+
* { box-sizing: border-box; }
|
|
2345
|
+
.container {
|
|
2346
|
+
display: flex;
|
|
2347
|
+
gap: var(--fx-space-sm, 8px);
|
|
2348
|
+
align-items: stretch;
|
|
2349
|
+
}
|
|
2350
|
+
.list-container {
|
|
2351
|
+
flex: 1;
|
|
2352
|
+
display: flex;
|
|
2353
|
+
flex-direction: column;
|
|
2354
|
+
gap: var(--fx-space-sm, 8px);
|
|
2355
|
+
min-width: 0;
|
|
2356
|
+
}
|
|
2357
|
+
.list-label {
|
|
2358
|
+
font-weight: 600;
|
|
2359
|
+
color: var(--picklist-text);
|
|
2360
|
+
font-size: calc(var(--fx-font-size) - 1px);
|
|
2361
|
+
}
|
|
2362
|
+
.select-all-bar {
|
|
2363
|
+
display: flex;
|
|
2364
|
+
align-items: center;
|
|
2365
|
+
justify-content: space-between;
|
|
2366
|
+
padding: var(--fx-space-sm, 10px) var(--fx-space-md, 14px);
|
|
2367
|
+
background: linear-gradient(135deg, var(--picklist-bg), var(--picklist-bg-hover));
|
|
2368
|
+
border: 1px solid var(--picklist-border);
|
|
2369
|
+
border-radius: var(--picklist-radius);
|
|
2370
|
+
font-size: 0.9em;
|
|
2371
|
+
font-weight: 500;
|
|
2372
|
+
}
|
|
2373
|
+
.select-all-bar label {
|
|
2374
|
+
display: flex;
|
|
2375
|
+
align-items: center;
|
|
2376
|
+
gap: var(--fx-space-sm, 10px);
|
|
2377
|
+
cursor: pointer;
|
|
2378
|
+
user-select: none;
|
|
2379
|
+
color: var(--picklist-text);
|
|
2380
|
+
}
|
|
2381
|
+
.select-all-bar input[type="checkbox"] {
|
|
2382
|
+
width: 18px;
|
|
2383
|
+
height: 18px;
|
|
2384
|
+
accent-color: var(--picklist-primary);
|
|
2385
|
+
cursor: pointer;
|
|
2386
|
+
}
|
|
2387
|
+
.selection-count {
|
|
2388
|
+
font-size: 0.85em;
|
|
2389
|
+
color: var(--picklist-primary);
|
|
2390
|
+
background: color-mix(in srgb, var(--picklist-primary) 12%, transparent);
|
|
2391
|
+
padding: 4px 12px;
|
|
2392
|
+
border-radius: 20px;
|
|
2393
|
+
font-weight: 600;
|
|
2394
|
+
}
|
|
2395
|
+
.controls {
|
|
2396
|
+
display: flex;
|
|
2397
|
+
flex-direction: column;
|
|
2398
|
+
gap: 4px;
|
|
2399
|
+
justify-content: center;
|
|
2400
|
+
padding: var(--fx-space-xs, 6px);
|
|
2401
|
+
background: var(--picklist-bg);
|
|
2402
|
+
border: 1px solid var(--picklist-border);
|
|
2403
|
+
border-radius: var(--picklist-radius);
|
|
2404
|
+
box-shadow: var(--picklist-shadow);
|
|
2405
|
+
height: fit-content;
|
|
2406
|
+
position: sticky;
|
|
2407
|
+
top: 0;
|
|
2408
|
+
align-self: center;
|
|
2409
|
+
}
|
|
2410
|
+
.control-group {
|
|
2411
|
+
display: flex;
|
|
2412
|
+
flex-direction: column;
|
|
2413
|
+
gap: 3px;
|
|
2414
|
+
}
|
|
2415
|
+
.control-group + .control-group {
|
|
2416
|
+
margin-top: 4px;
|
|
2417
|
+
padding-top: 6px;
|
|
2418
|
+
border-top: 1px solid var(--picklist-border);
|
|
2419
|
+
}
|
|
2420
|
+
.list-wrapper {
|
|
2421
|
+
flex: 1;
|
|
2422
|
+
display: flex;
|
|
2423
|
+
flex-direction: column;
|
|
2424
|
+
gap: var(--fx-space-sm, 8px);
|
|
2425
|
+
}
|
|
2426
|
+
.filter-wrapper {
|
|
2427
|
+
margin-bottom: var(--fx-space-xs, 4px);
|
|
2428
|
+
}
|
|
2429
|
+
.filter-input {
|
|
2430
|
+
width: 100%;
|
|
2431
|
+
box-sizing: border-box;
|
|
2432
|
+
padding: var(--fx-space-sm, 10px) var(--fx-space-md, 14px);
|
|
2433
|
+
padding-left: 42px;
|
|
2434
|
+
border: 1.5px solid var(--picklist-border);
|
|
2435
|
+
border-radius: var(--picklist-radius);
|
|
2436
|
+
font-family: inherit;
|
|
2437
|
+
font-size: inherit;
|
|
2438
|
+
color: var(--picklist-text);
|
|
2439
|
+
background: var(--picklist-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 14px center;
|
|
2440
|
+
transition: var(--picklist-transition);
|
|
2441
|
+
}
|
|
2442
|
+
.filter-input:focus {
|
|
2443
|
+
outline: none;
|
|
2444
|
+
border-color: var(--picklist-primary);
|
|
2445
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--picklist-primary) 20%, transparent);
|
|
2446
|
+
}
|
|
2447
|
+
.filter-input::placeholder {
|
|
2448
|
+
color: var(--picklist-text-muted);
|
|
2449
|
+
}
|
|
2450
|
+
.list {
|
|
2451
|
+
list-style: none;
|
|
2452
|
+
margin: 0;
|
|
2453
|
+
padding: 0;
|
|
2454
|
+
border: 1px solid var(--picklist-border);
|
|
2455
|
+
border-radius: var(--picklist-radius);
|
|
2456
|
+
overflow: hidden;
|
|
2457
|
+
box-shadow: var(--picklist-shadow);
|
|
2458
|
+
min-height: 200px;
|
|
2459
|
+
max-height: 450px;
|
|
2460
|
+
overflow-y: auto;
|
|
2461
|
+
flex: 1;
|
|
2462
|
+
}
|
|
2463
|
+
.list::-webkit-scrollbar { width: 6px; }
|
|
2464
|
+
.list::-webkit-scrollbar-track { background: transparent; }
|
|
2465
|
+
.list::-webkit-scrollbar-thumb { background: var(--picklist-border); border-radius: 3px; }
|
|
2466
|
+
.list::-webkit-scrollbar-thumb:hover { background: var(--picklist-text-muted); }
|
|
2467
|
+
:host([striped]) .list-item:nth-child(even) {
|
|
2468
|
+
background: var(--fx-surface-surface, #f8fafc);
|
|
2469
|
+
}
|
|
2470
|
+
.list-item {
|
|
2471
|
+
display: flex;
|
|
2472
|
+
align-items: center;
|
|
2473
|
+
gap: var(--fx-space-sm, 10px);
|
|
2474
|
+
padding: var(--fx-space-sm, 10px) var(--fx-space-md, 14px);
|
|
2475
|
+
background: var(--picklist-bg);
|
|
2476
|
+
border-bottom: 1px solid var(--picklist-border);
|
|
2477
|
+
cursor: pointer;
|
|
2478
|
+
user-select: none;
|
|
2479
|
+
transition: var(--picklist-transition);
|
|
2480
|
+
}
|
|
2481
|
+
.list-item:last-child { border-bottom: none; }
|
|
2482
|
+
.list-item:hover { background: var(--picklist-bg-hover); }
|
|
2483
|
+
.list-item.selected {
|
|
2484
|
+
background: color-mix(in srgb, var(--picklist-primary) 8%, transparent);
|
|
2485
|
+
border-left: 3px solid var(--picklist-primary);
|
|
2486
|
+
padding-left: 11px;
|
|
2487
|
+
}
|
|
2488
|
+
.list-item:focus-visible {
|
|
2489
|
+
outline: none;
|
|
2490
|
+
background: color-mix(in srgb, var(--picklist-primary) 15%, transparent);
|
|
2491
|
+
}
|
|
2492
|
+
.checkbox {
|
|
2493
|
+
flex-shrink: 0;
|
|
2494
|
+
width: 18px;
|
|
2495
|
+
height: 18px;
|
|
2496
|
+
accent-color: var(--picklist-primary);
|
|
2497
|
+
cursor: pointer;
|
|
2498
|
+
transition: var(--picklist-transition);
|
|
2499
|
+
}
|
|
2500
|
+
.checkbox:hover { transform: scale(1.1); }
|
|
2501
|
+
.item-content {
|
|
2502
|
+
flex: 1;
|
|
2503
|
+
min-width: 0;
|
|
2504
|
+
overflow: hidden;
|
|
2505
|
+
text-overflow: ellipsis;
|
|
2506
|
+
white-space: nowrap;
|
|
2507
|
+
}
|
|
2508
|
+
.empty-message {
|
|
2509
|
+
padding: var(--fx-space-xl, 32px);
|
|
2510
|
+
text-align: center;
|
|
2511
|
+
color: var(--picklist-text-muted);
|
|
2512
|
+
font-style: italic;
|
|
2513
|
+
}
|
|
2514
|
+
button.control-btn {
|
|
2515
|
+
display: flex;
|
|
2516
|
+
align-items: center;
|
|
2517
|
+
justify-content: center;
|
|
2518
|
+
width: 42px;
|
|
2519
|
+
height: 38px;
|
|
2520
|
+
padding: 0;
|
|
2521
|
+
border: none;
|
|
2522
|
+
border-radius: 8px;
|
|
2523
|
+
background: transparent;
|
|
2524
|
+
color: var(--picklist-text-muted);
|
|
2525
|
+
cursor: pointer;
|
|
2526
|
+
font-size: 16px;
|
|
2527
|
+
line-height: 1;
|
|
2528
|
+
transition: var(--picklist-transition);
|
|
2529
|
+
position: relative;
|
|
2530
|
+
}
|
|
2531
|
+
button.control-btn:hover:not(:disabled) {
|
|
2532
|
+
background: var(--picklist-bg-hover);
|
|
2533
|
+
color: var(--picklist-primary);
|
|
2534
|
+
transform: scale(1.1);
|
|
2535
|
+
}
|
|
2536
|
+
button.control-btn:active:not(:disabled) {
|
|
2537
|
+
transform: scale(0.92);
|
|
2538
|
+
background: color-mix(in srgb, var(--picklist-primary) 15%, transparent);
|
|
2539
|
+
}
|
|
2540
|
+
button.control-btn:focus-visible {
|
|
2541
|
+
outline: none;
|
|
2542
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--picklist-primary) 30%, transparent);
|
|
2543
|
+
}
|
|
2544
|
+
button.control-btn:disabled {
|
|
2545
|
+
opacity: 0.3;
|
|
2546
|
+
cursor: not-allowed;
|
|
2547
|
+
transform: none;
|
|
2548
|
+
}
|
|
2549
|
+
.control-btn-icon { font-size: 18px; line-height: 1; }
|
|
2550
|
+
|
|
2551
|
+
button.control-btn:hover::after {
|
|
2552
|
+
opacity: 1;
|
|
2553
|
+
transform: translateX(-50%) translateY(0);
|
|
2554
|
+
}
|
|
2555
|
+
@media (max-width: 640px) {
|
|
2556
|
+
.container { flex-direction: column; }
|
|
2557
|
+
.controls {
|
|
2558
|
+
flex-direction: row;
|
|
2559
|
+
flex-wrap: wrap;
|
|
2560
|
+
justify-content: center;
|
|
2561
|
+
position: relative;
|
|
2562
|
+
}
|
|
2563
|
+
.control-group { flex-direction: row; }
|
|
2564
|
+
.control-group + .control-group {
|
|
2565
|
+
margin-top: 0;
|
|
2566
|
+
margin-left: 4px;
|
|
2567
|
+
padding-top: 0;
|
|
2568
|
+
padding-left: 4px;
|
|
2569
|
+
border-top: none;
|
|
2570
|
+
border-left: 1px solid var(--picklist-border);
|
|
2571
|
+
}
|
|
2572
|
+
button.control-btn { width: 44px; height: 40px; }
|
|
2573
|
+
button.control-btn::after { display: none; }
|
|
2574
|
+
.list { max-height: 300px; min-height: 150px; }
|
|
2575
|
+
}
|
|
2576
|
+
@keyframes slideIn {
|
|
2577
|
+
from { opacity: 0; transform: translateX(-10px); }
|
|
2578
|
+
to { opacity: 1; transform: translateX(0); }
|
|
2579
|
+
}
|
|
2580
|
+
.list-item { animation: slideIn 0.2s ease-out; }
|
|
2581
|
+
`;let at=jt;function $(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function $e(){return b("fx-picklist",at)}$e();const Vt=class Vt extends f{constructor(){super(...arguments),this._mo=null}static get observedAttributes(){return["header","expanded","disabled"]}get header(){return this.getAttr("header","")}set header(t){this.setAttribute("header",t)}get value(){return this.getAttr("value","")}set value(t){this.setAttribute("value",t)}get expanded(){return this.hasAttr("expanded")}set expanded(t){this.toggleAttr("expanded",t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",t)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",t=>{t.composedPath().some(r=>{var s;return(s=r.classList)==null?void 0:s.contains("header")})&&(this.disabled||this.dispatchEvent(new CustomEvent("fx-accordion-toggle",{bubbles:!0,composed:!0,detail:{panel:this}})))}),this._mo=new MutationObserver(()=>this.render()),this._mo.observe(this,{attributes:!0,attributeFilter:["expanded","header","disabled"]})}disconnectedCallback(){var t;(t=this._mo)==null||t.disconnect(),this._mo=null}render(){this.setTemplate(`
|
|
2582
|
+
<button type="button" class="header" part="header" role="button"
|
|
2583
|
+
aria-expanded="${this.expanded}"
|
|
2584
|
+
${this.disabled?'aria-disabled="true"':""}>
|
|
2585
|
+
<span class="header-text" part="header-text">
|
|
2586
|
+
<slot name="header">${this.header}</slot>
|
|
2587
|
+
</span>
|
|
2588
|
+
<span class="chevron" part="chevron" aria-hidden="true">
|
|
2589
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"
|
|
2590
|
+
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
2591
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
2592
|
+
</svg>
|
|
2593
|
+
</span>
|
|
2594
|
+
</button>
|
|
2595
|
+
<div class="content" part="content" role="region">
|
|
2596
|
+
<div class="content-inner">
|
|
2597
|
+
<div class="content-pad" part="content-pad"><slot></slot></div>
|
|
2598
|
+
</div>
|
|
2599
|
+
</div>
|
|
2600
|
+
`)}};Vt.styles=p`
|
|
2601
|
+
:host {
|
|
2602
|
+
display: block;
|
|
2603
|
+
font-family: var(--fx-font-family);
|
|
2604
|
+
font-size: var(--fx-font-size);
|
|
2605
|
+
color: var(--fx-text-default);
|
|
2606
|
+
border-bottom: 1px solid var(--fx-border-default);
|
|
2607
|
+
}
|
|
2608
|
+
:host(:last-child) { border-bottom: none; }
|
|
2609
|
+
:host([disabled]) { opacity: 0.6; pointer-events: none; }
|
|
2610
|
+
.header {
|
|
2611
|
+
display: flex;
|
|
2612
|
+
align-items: center;
|
|
2613
|
+
justify-content: space-between;
|
|
2614
|
+
gap: var(--fx-space-md);
|
|
2615
|
+
width: 100%;
|
|
2616
|
+
box-sizing: border-box;
|
|
2617
|
+
padding: var(--fx-space-lg, 20px) var(--fx-space-md, 14px);
|
|
2618
|
+
border: none;
|
|
2619
|
+
background: transparent;
|
|
2620
|
+
font-family: inherit;
|
|
2621
|
+
font-size: inherit;
|
|
2622
|
+
font-weight: 500;
|
|
2623
|
+
color: var(--fx-text-muted);
|
|
2624
|
+
text-align: left;
|
|
2625
|
+
cursor: pointer;
|
|
2626
|
+
transition: color var(--fx-motion-duration-fast, 150ms) var(--fx-motion-easing, ease),
|
|
2627
|
+
background var(--fx-motion-duration-fast, 150ms) var(--fx-motion-easing, ease);
|
|
2628
|
+
}
|
|
2629
|
+
.header:hover { color: var(--fx-text-default); }
|
|
2630
|
+
.header:focus-visible {
|
|
2631
|
+
outline: none;
|
|
2632
|
+
box-shadow: var(--fx-effect-focus-ring, none);
|
|
2633
|
+
border-radius: var(--fx-radius-sm, 4px);
|
|
2634
|
+
}
|
|
2635
|
+
:host([expanded]) .header {
|
|
2636
|
+
color: var(--fx-text-default);
|
|
2637
|
+
font-weight: 700;
|
|
2638
|
+
}
|
|
2639
|
+
.header-text { flex: 1; min-width: 0; }
|
|
2640
|
+
.chevron {
|
|
2641
|
+
flex-shrink: 0;
|
|
2642
|
+
display: inline-flex;
|
|
2643
|
+
align-items: center;
|
|
2644
|
+
justify-content: center;
|
|
2645
|
+
width: 24px;
|
|
2646
|
+
height: 24px;
|
|
2647
|
+
color: var(--fx-text-muted);
|
|
2648
|
+
transition: transform var(--fx-motion-duration-normal, 250ms) var(--fx-motion-easing, ease);
|
|
2649
|
+
}
|
|
2650
|
+
:host([expanded]) .chevron { transform: rotate(180deg); color: var(--fx-color-primary); }
|
|
2651
|
+
.content {
|
|
2652
|
+
display: grid;
|
|
2653
|
+
grid-template-rows: 0fr;
|
|
2654
|
+
transition: grid-template-rows var(--fx-motion-duration-normal, 250ms) var(--fx-motion-easing, ease);
|
|
2655
|
+
}
|
|
2656
|
+
:host([expanded]) .content { grid-template-rows: 1fr; }
|
|
2657
|
+
.content-inner { overflow: hidden; }
|
|
2658
|
+
.content-pad {
|
|
2659
|
+
padding: 0 var(--fx-space-md, 14px) var(--fx-space-lg, 20px);
|
|
2660
|
+
color: var(--fx-text-muted);
|
|
2661
|
+
line-height: 1.6;
|
|
2662
|
+
}
|
|
2663
|
+
`;let ot=Vt;const Pt=class Pt extends f{constructor(){super(...arguments),this._observer=null,this._initialized=!1,this._listenersAttached=!1}static get observedAttributes(){return["value","multiple"]}get multiple(){return this.hasAttr("multiple")}set multiple(t){this.toggleAttr("multiple",t)}get values(){return this.getAttr("value","").split(",").map(t=>t.trim()).filter(Boolean)}set values(t){this.setAttribute("value",t.join(","))}connectedCallback(){this._observer=new MutationObserver(()=>this._sync()),this._observer.observe(this,{childList:!0,subtree:!0}),super.connectedCallback(),queueMicrotask(()=>this._sync())}disconnectedCallback(){var t;(t=this._observer)==null||t.disconnect(),this._observer=null}render(){this.setTemplate(`
|
|
2664
|
+
<div class="accordion" part="accordion">
|
|
2665
|
+
<slot></slot>
|
|
2666
|
+
</div>
|
|
2667
|
+
`),this._sync(),this._attachListeners()}get panels(){return Array.from(this.querySelectorAll("fx-accordion-panel"))}_sync(){const t=this.values,e=Array.from(this.querySelectorAll("fx-accordion-panel"));if(!this._initialized&&t.length===0&&e.length>0){this._initialized=!0;const r=e.find(s=>!s.hasAttribute("disabled"));if(r){this.values=[r.getAttribute("value")||"0"];return}}this._initialized=!0,e.forEach((r,s)=>{const i=r.getAttribute("value")||String(s);r.hasAttribute("value")||r.setAttribute("value",i),r.toggleAttribute("expanded",t.includes(i))})}_attachListeners(){this._listenersAttached||(this._listenersAttached=!0,this.addEventListener("fx-accordion-toggle",t=>{var r;const e=(r=t.detail)==null?void 0:r.panel;!e||e.disabled||this.toggle(e)}))}toggle(t){const e=t.value;let r=this.values;t.expanded?r=r.filter(s=>s!==e):this.multiple?r=[...r,e]:r=[e],this.values=r,this._sync(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:r}}))}open(t){const e=this.panels.find((r,s)=>(r.value||String(s))===t);e&&!e.expanded&&this.toggle(e)}close(t){const e=this.panels.find((r,s)=>(r.value||String(s))===t);e&&e.expanded&&this.toggle(e)}};Pt.styles=p`
|
|
2668
|
+
:host {
|
|
2669
|
+
display: block;
|
|
2670
|
+
font-family: var(--fx-font-family);
|
|
2671
|
+
font-size: var(--fx-font-size);
|
|
2672
|
+
}
|
|
2673
|
+
.accordion {
|
|
2674
|
+
background: var(--fx-surface-background, #ffffff);
|
|
2675
|
+
border: 1px solid var(--fx-border-default);
|
|
2676
|
+
border-radius: var(--fx-radius-md, 8px);
|
|
2677
|
+
overflow: hidden;
|
|
2678
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
2679
|
+
}
|
|
2680
|
+
`;let nt=Pt;function Ee(){return b("fx-accordion",nt)}function Ce(){return b("fx-accordion-panel",ot)}Ee(),Ce()});
|