@per-diem-calculator/vanilla 1.0.21 → 1.0.22

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/dist/index.js CHANGED
@@ -9630,7 +9630,7 @@ class Ia extends HTMLElement {
9630
9630
  ot(this, Bt);
9631
9631
  ot(this, Xn, (t) => {
9632
9632
  const n = t.target;
9633
- if (console.log(t.target), !((n instanceof HTMLElement || n instanceof SVGElement) && (n.closest(".ts-control") || n.closest("button"))))
9633
+ if (!((n instanceof HTMLElement || n instanceof SVGElement) && (n.closest(".ts-control") || n.closest("button"))))
9634
9634
  return;
9635
9635
  Lr(() => {
9636
9636
  c(this, Bt).open();
@@ -1098,7 +1098,7 @@
1098
1098
  />
1099
1099
  </svg>
1100
1100
  </div>
1101
- `,k0=document.createElement("template");class la extends HTMLElement{constructor(){super();ot(this,lt);ot(this,Jt);ot(this,en,!1);ot(this,me,!1);ot(this,Xn,!1);ot(this,jt);ot(this,Zn,t=>{const n=t.target;if(console.log(t.target),!((n instanceof HTMLElement||n instanceof SVGElement)&&(n.closest(".ts-control")||n.closest("button"))))return;ur(()=>{c(this,jt).open()})()});this.attachShadow({mode:"open"}),ht(this,Jt,this.getAttribute("pdc")==="country"?"country":"city"),ht(this,me,this.getAttribute("styled")==="true"),ht(this,jt,M(this,lt,Ha).call(this))}attributeChangedCallback(t,n,r){c(this,me)&&M(this,lt,H0).call(this,`bg-${r==="white"?"white":"neutral-50"}`)}focusEl(){c(this,jt).control.focus()}enableTabIndex(t){c(this,lt,Ua).setAttribute("tabindex",t?"0":"-1")}enable(t){this.removeAttribute(c(this,Jt)),t?(c(this,jt).enable(),c(this,lt,fe).classList.add("active"),c(this,lt,fe).removeAttribute("inert")):(c(this,jt).disable(),c(this,lt,fe).classList.remove("active","success"),c(this,lt,fe).setAttribute("inert","")),this.enableTabIndex(t),c(this,lt,fe).classList.remove("success","error"),ht(this,Xn,t)}setOptions(t){M(this,lt,B0).call(this,!0),this.enable(!1),c(this,jt).destroy(),M(this,lt,U0).call(this),t.forEach(n=>{const r=c(this,Jt)==="country"?n.country:n.city;if(!n.label||!r)throw new Error(`Failed to get label when creating the options for ${n}.`);const a=document.createElement("option");a.setAttribute("value",r),a.textContent=n.label,c(this,lt,N0).appendChild(a),c(this,jt).sync()}),this.enable(!0),c(this,jt).on("change",()=>{const n=c(this,jt).getValue();Array.isArray(n)||(this.setAttribute(c(this,Jt),n),c(this,me)&&(M(this,lt,j0).call(this,!1),c(this,lt,fe).classList.remove("error"),c(this,lt,fe).classList.add("success")),c(this,jt).control.setAttribute("tabindex","-1"))}),setTimeout(()=>{M(this,lt,B0).call(this,!1)},ni*2)}validate(){return ht(this,en,!1),this.hasAttribute(c(this,Jt))?(ht(this,en,!0),c(this,en)):(c(this,me)&&M(this,lt,j0).call(this,!0),c(this,en))}get isEnabled(){return c(this,Xn)}get pdcValue(){const t=this.getAttribute(c(this,Jt));return t||null}}Jt=new WeakMap,en=new WeakMap,me=new WeakMap,Xn=new WeakMap,jt=new WeakMap,lt=new WeakSet,Ha=function(){return this.removeAttribute(c(this,Jt)),c(this,lt,Fe).innerHTML="",c(this,me)?(k0.innerHTML=oa,Ze(c(this,lt,Fe))):k0.innerHTML=$e(oa),c(this,lt,Fe).appendChild(k0.content.cloneNode(!0)),c(this,lt,P0).textContent=c(this,Jt)==="country"?"State":"City",c(this,lt,P0).setAttribute("aria-label",`Select the trip ${c(this,Jt)==="country"?"state":"city"}`),M(this,lt,Ba).call(this),M(this,lt,U0).call(this)},Ba=function(){let t=0,n=0;c(this,lt,fe).addEventListener("pointerdown",r=>{if(!(r instanceof PointerEvent))return;const a=Bn(r);t=a.pointerStartX,n=a.pointerStartY}),c(this,lt,fe).addEventListener("pointerup",r=>{if(!(r instanceof PointerEvent))return;const a=Un(r,c(this,Zn).bind(this),t,n);t=a.pointerStartX,n=a.pointerStartY}),c(this,lt,fe).addEventListener("keydown",r=>{r instanceof KeyboardEvent&&(r.key==="Enter"||r.key===" ")&&c(this,Zn).call(this,r)})},Zn=new WeakMap,fe=function(){const t=c(this,lt,Fe).querySelector("#pdc-container");if(!t)throw new Error("Failed to get container for Select custom element");return t},N0=function(){const t=c(this,lt,Fe).querySelector("select");if(!t)throw new Error("Failed to get select for Select custom element");return t},Ua=function(){const t=c(this,lt,Fe).querySelector("button");if(!t)throw new Error("Failed to get button for Select custom element");return t},P0=function(){const t=c(this,lt,Fe).querySelector("label");if(!t)throw new Error("Failed to get label for Select custom element");return t},$0=function(){const t=c(this,lt,Fe).querySelector("#loading-spinner");if(!t)throw new Error("Failed to get loading spinner element for Select custom element");return t},Ur=function(){var n;const t=(n=this.closest("#locations-container"))==null?void 0:n.querySelector("#error");if(!t)throw new Error("Failed to get View's error element from Category custom element");return t},Fe=function(){if(!this.shadowRoot)throw new Error("Failed to render shadowRoot in Select custom element");return this.shadowRoot},H0=function(t=null){if(!c(this,me))return;const n=c(this,lt,Fe).querySelector("div");n==null||n.classList.remove("bg-white","bg-neutral-50"),n==null||n.classList.add(t||`bg-${this.getAttribute("bg")}`)},B0=function(t){c(this,me)&&(t?c(this,lt,$0).classList.add("active"):c(this,lt,$0).classList.remove("active"))},U0=function(){const t=c(this,Jt)==="city"?`No results
1101
+ `,k0=document.createElement("template");class la extends HTMLElement{constructor(){super();ot(this,lt);ot(this,Jt);ot(this,en,!1);ot(this,me,!1);ot(this,Xn,!1);ot(this,jt);ot(this,Zn,t=>{const n=t.target;if(!((n instanceof HTMLElement||n instanceof SVGElement)&&(n.closest(".ts-control")||n.closest("button"))))return;ur(()=>{c(this,jt).open()})()});this.attachShadow({mode:"open"}),ht(this,Jt,this.getAttribute("pdc")==="country"?"country":"city"),ht(this,me,this.getAttribute("styled")==="true"),ht(this,jt,M(this,lt,Ha).call(this))}attributeChangedCallback(t,n,r){c(this,me)&&M(this,lt,H0).call(this,`bg-${r==="white"?"white":"neutral-50"}`)}focusEl(){c(this,jt).control.focus()}enableTabIndex(t){c(this,lt,Ua).setAttribute("tabindex",t?"0":"-1")}enable(t){this.removeAttribute(c(this,Jt)),t?(c(this,jt).enable(),c(this,lt,fe).classList.add("active"),c(this,lt,fe).removeAttribute("inert")):(c(this,jt).disable(),c(this,lt,fe).classList.remove("active","success"),c(this,lt,fe).setAttribute("inert","")),this.enableTabIndex(t),c(this,lt,fe).classList.remove("success","error"),ht(this,Xn,t)}setOptions(t){M(this,lt,B0).call(this,!0),this.enable(!1),c(this,jt).destroy(),M(this,lt,U0).call(this),t.forEach(n=>{const r=c(this,Jt)==="country"?n.country:n.city;if(!n.label||!r)throw new Error(`Failed to get label when creating the options for ${n}.`);const a=document.createElement("option");a.setAttribute("value",r),a.textContent=n.label,c(this,lt,N0).appendChild(a),c(this,jt).sync()}),this.enable(!0),c(this,jt).on("change",()=>{const n=c(this,jt).getValue();Array.isArray(n)||(this.setAttribute(c(this,Jt),n),c(this,me)&&(M(this,lt,j0).call(this,!1),c(this,lt,fe).classList.remove("error"),c(this,lt,fe).classList.add("success")),c(this,jt).control.setAttribute("tabindex","-1"))}),setTimeout(()=>{M(this,lt,B0).call(this,!1)},ni*2)}validate(){return ht(this,en,!1),this.hasAttribute(c(this,Jt))?(ht(this,en,!0),c(this,en)):(c(this,me)&&M(this,lt,j0).call(this,!0),c(this,en))}get isEnabled(){return c(this,Xn)}get pdcValue(){const t=this.getAttribute(c(this,Jt));return t||null}}Jt=new WeakMap,en=new WeakMap,me=new WeakMap,Xn=new WeakMap,jt=new WeakMap,lt=new WeakSet,Ha=function(){return this.removeAttribute(c(this,Jt)),c(this,lt,Fe).innerHTML="",c(this,me)?(k0.innerHTML=oa,Ze(c(this,lt,Fe))):k0.innerHTML=$e(oa),c(this,lt,Fe).appendChild(k0.content.cloneNode(!0)),c(this,lt,P0).textContent=c(this,Jt)==="country"?"State":"City",c(this,lt,P0).setAttribute("aria-label",`Select the trip ${c(this,Jt)==="country"?"state":"city"}`),M(this,lt,Ba).call(this),M(this,lt,U0).call(this)},Ba=function(){let t=0,n=0;c(this,lt,fe).addEventListener("pointerdown",r=>{if(!(r instanceof PointerEvent))return;const a=Bn(r);t=a.pointerStartX,n=a.pointerStartY}),c(this,lt,fe).addEventListener("pointerup",r=>{if(!(r instanceof PointerEvent))return;const a=Un(r,c(this,Zn).bind(this),t,n);t=a.pointerStartX,n=a.pointerStartY}),c(this,lt,fe).addEventListener("keydown",r=>{r instanceof KeyboardEvent&&(r.key==="Enter"||r.key===" ")&&c(this,Zn).call(this,r)})},Zn=new WeakMap,fe=function(){const t=c(this,lt,Fe).querySelector("#pdc-container");if(!t)throw new Error("Failed to get container for Select custom element");return t},N0=function(){const t=c(this,lt,Fe).querySelector("select");if(!t)throw new Error("Failed to get select for Select custom element");return t},Ua=function(){const t=c(this,lt,Fe).querySelector("button");if(!t)throw new Error("Failed to get button for Select custom element");return t},P0=function(){const t=c(this,lt,Fe).querySelector("label");if(!t)throw new Error("Failed to get label for Select custom element");return t},$0=function(){const t=c(this,lt,Fe).querySelector("#loading-spinner");if(!t)throw new Error("Failed to get loading spinner element for Select custom element");return t},Ur=function(){var n;const t=(n=this.closest("#locations-container"))==null?void 0:n.querySelector("#error");if(!t)throw new Error("Failed to get View's error element from Category custom element");return t},Fe=function(){if(!this.shadowRoot)throw new Error("Failed to render shadowRoot in Select custom element");return this.shadowRoot},H0=function(t=null){if(!c(this,me))return;const n=c(this,lt,Fe).querySelector("div");n==null||n.classList.remove("bg-white","bg-neutral-50"),n==null||n.classList.add(t||`bg-${this.getAttribute("bg")}`)},B0=function(t){c(this,me)&&(t?c(this,lt,$0).classList.add("active"):c(this,lt,$0).classList.remove("active"))},U0=function(){const t=c(this,Jt)==="city"?`No results
1102
1102
  found. Choose the first available option such as "Standard Rate", "[OTHER]", etc.`:"No results found.",n=new Kt(c(this,lt,N0),{placeholder:`Select ${c(this,Jt)==="country"?"state":"city"}`,maxItems:1,plugins:["dropdown_input"],selectOnTab:!0,openOnFocus:!1,render:{no_results:()=>` <div class="no-results">
1103
1103
  ${t}
1104
1104
  </div>`}});return ht(this,jt,n),c(this,jt).disable(),c(this,jt).tabIndex=-1,this.enableTabIndex(!1),M(this,lt,H0).call(this),n},j0=function(t){if(t){c(this,me)&&(c(this,lt,fe).classList.add("error"),c(this,lt,Ur).classList.add("active")),c(this,lt,Ur).textContent=c(this,Jt)==="country"?"Select state.":"Select city.";return}c(this,me)&&(c(this,lt,fe).classList.remove("error"),c(this,lt,Ur).classList.remove("active"))},he(la,"observedAttributes",["bg"]);const ca=`<div
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@per-diem-calculator/vanilla",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "author": "Ahmad Dowla <ahmad.dowla@gmail.com>",
5
5
  "description": "Open source per diem calculator for both domestic and international trips. Built in TypeScript with Tailwind. Rates sourced from GSA, State Dept., and DOD.",
6
6
  "license": "MIT",