@salla.sa/twilight-components 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/cjs/{index-e9451c82.js → index-23da2c6b.js} +159 -4
  2. package/dist/cjs/index.cjs.js +3 -3
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/multi-warehouse_3.cjs.entry.js +161 -0
  5. package/dist/cjs/order-rating.cjs.entry.js +252 -0
  6. package/dist/cjs/salla-button.cjs.entry.js +57 -0
  7. package/dist/cjs/salla-localization.cjs.entry.js +52 -0
  8. package/dist/cjs/{salla-login-3ec94029.js → salla-login-476fb312.js} +1 -1
  9. package/dist/cjs/{salla-search-2b1d67e4.js → salla-search-b9403062.js} +7 -7
  10. package/dist/cjs/salla-search.cjs.entry.js +2 -2
  11. package/dist/cjs/salla-verify.cjs.entry.js +94 -0
  12. package/dist/cjs/twilight-components.cjs.js +2 -2
  13. package/dist/collection/collection-manifest.json +8 -4
  14. package/dist/collection/components/multi-warehouse/multi-warehouse.js +239 -0
  15. package/dist/collection/components/order-rating/order-rating.css +3 -0
  16. package/dist/collection/components/order-rating/order-rating.js +321 -0
  17. package/dist/collection/components/salla-button/salla-button.css +3 -0
  18. package/dist/collection/components/salla-button/salla-button.js +186 -0
  19. package/dist/collection/components/salla-localization/salla-localization.js +109 -0
  20. package/dist/collection/components/{login → salla-login}/salla-login.js +0 -0
  21. package/dist/collection/components/{modal → salla-modal}/salla-modal.js +143 -18
  22. package/dist/collection/components/{search → salla-search}/salla-search.js +21 -21
  23. package/dist/collection/components/salla-verify/salla-verify.js +97 -0
  24. package/dist/collection/index.js +2 -2
  25. package/dist/collection/plugins/tailwind-theme/generator.js +1 -1
  26. package/dist/esm/{index-8919a244.js → index-643344dc.js} +159 -4
  27. package/dist/esm/index.js +3 -3
  28. package/dist/esm/loader.js +2 -2
  29. package/dist/esm/multi-warehouse_3.entry.js +155 -0
  30. package/dist/esm/order-rating.entry.js +248 -0
  31. package/dist/esm/salla-button.entry.js +53 -0
  32. package/dist/esm/salla-localization.entry.js +48 -0
  33. package/dist/esm/{salla-login-4aa5bb90.js → salla-login-0e85b2d8.js} +1 -1
  34. package/dist/esm/{salla-search-bd2f71b3.js → salla-search-5d4a6f1a.js} +7 -7
  35. package/dist/esm/salla-search.entry.js +2 -2
  36. package/dist/esm/salla-verify.entry.js +90 -0
  37. package/dist/esm/twilight-components.js +2 -2
  38. package/dist/twilight-components/index.esm.js +1 -1
  39. package/dist/twilight-components/{p-41dc89e6.js → p-36c87e2e.js} +1 -1
  40. package/dist/twilight-components/p-4b137380.js +1 -0
  41. package/dist/twilight-components/p-653bb9a8.entry.js +1 -0
  42. package/dist/twilight-components/p-a2395c9d.entry.js +1 -0
  43. package/dist/twilight-components/p-baeca520.entry.js +1 -0
  44. package/dist/twilight-components/p-bd10d8d5.entry.js +1 -0
  45. package/dist/twilight-components/p-d1ef2268.js +1 -0
  46. package/dist/twilight-components/p-ea986bca.entry.js +1 -0
  47. package/dist/twilight-components/p-f4340bd9.entry.js +1 -0
  48. package/dist/twilight-components/twilight-components.esm.js +1 -1
  49. package/dist/types/components/multi-warehouse/multi-warehouse.d.ts +23 -0
  50. package/dist/types/components/order-rating/order-rating.d.ts +20 -0
  51. package/dist/types/components/salla-button/salla-button.d.ts +16 -0
  52. package/dist/types/components/salla-localization/salla-localization.d.ts +14 -0
  53. package/dist/types/components/{login → salla-login}/salla-login.d.ts +0 -0
  54. package/dist/types/components/{modal → salla-modal}/salla-modal.d.ts +8 -2
  55. package/dist/types/components/{search → salla-search}/salla-search.d.ts +0 -0
  56. package/dist/types/components/salla-verify/salla-verify.d.ts +19 -0
  57. package/dist/types/components.d.ts +94 -11
  58. package/dist/types/index.d.ts +2 -2
  59. package/package.json +10 -6
  60. package/dist/cjs/salla-currency-language.cjs.entry.js +0 -46
  61. package/dist/cjs/salla-login_2.cjs.entry.js +0 -57
  62. package/dist/collection/components/currency-language/salla-currency-language.js +0 -97
  63. package/dist/esm/salla-currency-language.entry.js +0 -42
  64. package/dist/esm/salla-login_2.entry.js +0 -52
  65. package/dist/twilight-components/p-1abaafe4.entry.js +0 -1
  66. package/dist/twilight-components/p-58b1afae.js +0 -1
  67. package/dist/twilight-components/p-840f0daa.entry.js +0 -1
  68. package/dist/twilight-components/p-9f9af3e0.js +0 -1
  69. package/dist/twilight-components/p-b134c95d.entry.js +0 -1
  70. package/dist/types/components/currency-language/salla-currency-language.d.ts +0 -10
@@ -0,0 +1 @@
1
+ let e,t,l=!1,n=!1,o=!1,s=!1;const i="undefined"!=typeof window?window:{},r=i.document||{head:{}},c={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,l,n)=>e.addEventListener(t,l,n),rel:(e,t,l,n)=>e.removeEventListener(t,l,n),ce:(e,t)=>new CustomEvent(e,t)},f=e=>Promise.resolve(e),a=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),u="http://www.w3.org/1999/xlink",$=new WeakMap,d=e=>"sc-"+e.o,y={},h=e=>"object"==(e=typeof e)||"function"===e,p=(e,t,...l)=>{let n=null,o=null,s=null,i=!1,r=!1,c=[];const f=t=>{for(let l=0;l<t.length;l++)n=t[l],Array.isArray(n)?f(n):null!=n&&"boolean"!=typeof n&&((i="function"!=typeof e&&!h(n))&&(n+=""),i&&r?c[c.length-1].i+=n:c.push(i?m(null,n):n),r=i)};if(f(l),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const a=m(e,null);return a.u=t,c.length>0&&(a.$=c),a.h=o,a.p=s,a},m=(e,t)=>({t:0,m:e,i:t,k:null,$:null,u:null,h:null,p:null}),b={},w=(e,t,l,n,o,s)=>{if(l!==n){let r=te(e,t),f=t.toLowerCase();if("class"===t){const t=e.classList,o=g(l),s=g(n);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in l)n&&null!=n[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in n)l&&n[t]===l[t]||(t.includes("-")?e.style.setProperty(t,n[t]):e.style[t]=n[t])}else if("key"===t);else if("ref"===t)n&&n(e);else if(r||"o"!==t[0]||"n"!==t[1]){const i=h(n);if((r||i&&null!==n)&&!o)try{if(e.tagName.includes("-"))e[t]=n;else{let o=null==n?"":n;"list"===t?r=!1:null!=l&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;f!==(f=f.replace(/^xlink\:?/,""))&&(t=f,c=!0),null==n||!1===n?!1===n&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(u,t):e.removeAttribute(t)):(!r||4&s||o)&&!i&&(n=!0===n?"":n,c?e.setAttributeNS(u,t,n):e.setAttribute(t,n))}else t="-"===t[2]?t.slice(3):te(i,f)?f.slice(2):f[2]+t.slice(3),l&&c.rel(e,t,l,!1),n&&c.ael(e,t,n,!1)}},k=/\s/,g=e=>e?e.split(k):[],S=(e,t,l,n)=>{const o=11===t.k.nodeType&&t.k.host?t.k.host:t.k,s=e&&e.u||y,i=t.u||y;for(n in s)n in i||w(o,n,s[n],void 0,l,t.t);for(n in i)w(o,n,s[n],i[n],l,t.t)},j=(n,s,i)=>{let c,f,a,u=s.$[i],$=0;if(l||(o=!0,"slot"===u.m&&(u.t|=u.$?2:1)),null!==u.i)c=u.k=r.createTextNode(u.i);else if(1&u.t)c=u.k=r.createTextNode("");else if(c=u.k=r.createElement(2&u.t?"slot-fb":u.m),S(null,u,!1),u.$)for($=0;$<u.$.length;++$)f=j(n,u,$),f&&c.appendChild(f);return c["s-hn"]=t,3&u.t&&(c["s-sr"]=!0,c["s-cr"]=e,c["s-sn"]=u.p||"",a=n&&n.$&&n.$[i],a&&a.m===u.m&&n.k&&v(n.k,!1)),c},v=(e,l)=>{c.t|=1;const n=e.childNodes;for(let e=n.length-1;e>=0;e--){const s=n[e];s["s-hn"]!==t&&s["s-ol"]&&(x(s).insertBefore(s,R(s)),s["s-ol"].remove(),s["s-ol"]=void 0,o=!0),l&&v(s,l)}c.t&=-2},M=(e,t,l,n,o,s)=>{let i,r=e["s-cr"]&&e["s-cr"].parentNode||e;for(;o<=s;++o)n[o]&&(i=j(null,l,o),i&&(n[o].k=i,r.insertBefore(i,R(t))))},O=(e,t,l,o,s)=>{for(;t<=l;++t)(o=e[t])&&(s=o.k,A(o),n=!0,s["s-ol"]?s["s-ol"].remove():v(s,!0),s.remove())},C=(e,t)=>e.m===t.m&&("slot"===e.m?e.p===t.p:e.h===t.h),R=e=>e&&e["s-ol"]||e,x=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,P=(e,t)=>{const l=t.k=e.k,n=e.$,o=t.$,s=t.i;let i;null===s?("slot"===t.m||S(e,t,!1),null!==n&&null!==o?((e,t,l,n)=>{let o,s,i=0,r=0,c=0,f=0,a=t.length-1,u=t[0],$=t[a],d=n.length-1,y=n[0],h=n[d];for(;i<=a&&r<=d;)if(null==u)u=t[++i];else if(null==$)$=t[--a];else if(null==y)y=n[++r];else if(null==h)h=n[--d];else if(C(u,y))P(u,y),u=t[++i],y=n[++r];else if(C($,h))P($,h),$=t[--a],h=n[--d];else if(C(u,h))"slot"!==u.m&&"slot"!==h.m||v(u.k.parentNode,!1),P(u,h),e.insertBefore(u.k,$.k.nextSibling),u=t[++i],h=n[--d];else if(C($,y))"slot"!==u.m&&"slot"!==h.m||v($.k.parentNode,!1),P($,y),e.insertBefore($.k,u.k),$=t[--a],y=n[++r];else{for(c=-1,f=i;f<=a;++f)if(t[f]&&null!==t[f].h&&t[f].h===y.h){c=f;break}c>=0?(s=t[c],s.m!==y.m?o=j(t&&t[r],l,c):(P(s,y),t[c]=void 0,o=s.k),y=n[++r]):(o=j(t&&t[r],l,r),y=n[++r]),o&&x(u.k).insertBefore(o,R(u.k))}i>a?M(e,null==n[d+1]?null:n[d+1].k,l,n,r,d):r>d&&O(t,i,a)})(l,n,t,o):null!==o?(null!==e.i&&(l.textContent=""),M(l,null,t,o,0,o.length-1)):null!==n&&O(n,0,n.length-1)):(i=l["s-cr"])?i.parentNode.textContent=s:e.i!==s&&(l.data=s)},T=e=>{let t,l,n,o,s,i,r=e.childNodes;for(l=0,n=r.length;l<n;l++)if(t=r[l],1===t.nodeType){if(t["s-sr"])for(s=t["s-sn"],t.hidden=!1,o=0;o<n;o++)if(i=r[o].nodeType,r[o]["s-hn"]!==t["s-hn"]||""!==s){if(1===i&&s===r[o].getAttribute("slot")){t.hidden=!0;break}}else if(1===i||3===i&&""!==r[o].textContent.trim()){t.hidden=!0;break}T(t)}},E=[],L=e=>{let t,l,o,s,i,r,c=0,f=e.childNodes,a=f.length;for(;c<a;c++){if(t=f[c],t["s-sr"]&&(l=t["s-cr"])&&l.parentNode)for(o=l.parentNode.childNodes,s=t["s-sn"],r=o.length-1;r>=0;r--)l=o[r],l["s-cn"]||l["s-nr"]||l["s-hn"]===t["s-hn"]||(W(l,s)?(i=E.find((e=>e.g===l)),n=!0,l["s-sn"]=l["s-sn"]||s,i?i.S=t:E.push({S:t,g:l}),l["s-sr"]&&E.map((e=>{W(e.g,l["s-sn"])&&(i=E.find((e=>e.g===l)),i&&!e.S&&(e.S=i.S))}))):E.some((e=>e.g===l))||E.push({g:l}));1===t.nodeType&&L(t)}},W=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,A=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(A)},F=e=>Y(e).j,H=(e,t,l)=>{const n=F(e);return{emit:e=>N(n,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},N=(e,t,l)=>{const n=c.ce(t,l);return e.dispatchEvent(n),n},U=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},q=(e,t)=>{if(e.t|=16,!(4&e.t))return U(e,e.M),$e((()=>D(e,t)));e.t|=512},D=(e,t)=>{const l=e.O;let n;return t&&(n=G(l,"componentWillLoad")),I(n,(()=>V(e,l,t)))},V=async(e,t,l)=>{const n=e.j,o=n["s-rc"];l&&(e=>{const t=e.C;((e,t)=>{let l=d(t),n=se.get(l);if(e=11===e.nodeType?e:r,n)if("string"==typeof n){let t,o=$.get(e=e.head||e);o||$.set(e,o=new Set),o.has(l)||(t=r.createElement("style"),t.innerHTML=n,e.insertBefore(t,e.querySelector("link")),o&&o.add(l))}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n])})(e.j.getRootNode(),t)})(e);_(e,t),o&&(o.map((e=>e())),n["s-rc"]=void 0);{const t=n["s-p"],l=()=>z(e);0===t.length?l():(Promise.all(t).then(l),e.t|=4,t.length=0)}},_=(s,i)=>{try{i=i.render(),s.t&=-17,s.t|=2,((s,i)=>{const f=s.j,a=s.C,u=s.R||m(null,null),$=(e=>e&&e.m===b)(i)?i:p(null,null,i);if(t=f.tagName,a.P&&($.u=$.u||{},a.P.map((([e,t])=>$.u[t]=f[e]))),$.m=null,$.t|=4,s.R=$,$.k=u.k=f,e=f["s-cr"],l=0!=(1&a.t),n=!1,P(u,$),c.t|=1,o){let e,t,l,n,o,s;L($.k);let i=0;for(;i<E.length;i++)e=E[i],t=e.g,t["s-ol"]||(l=r.createTextNode(""),l["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=l,t));for(i=0;i<E.length;i++)if(e=E[i],t=e.g,e.S){for(n=e.S.parentNode,o=e.S.nextSibling,l=t["s-ol"];l=l.previousSibling;)if(s=l["s-nr"],s&&s["s-sn"]===t["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),n.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}n&&T($.k),c.t&=-2,E.length=0})(s,i)}catch(e){le(e,s.j)}return null},z=e=>{const t=e.j,l=e.M;G(e.O,"componentDidRender"),64&e.t||(e.t|=64,J(t),e.T(t),l||B()),e.L(t),e.v&&(e.v(),e.v=void 0),512&e.t&&ue((()=>q(e,!1))),e.t&=-517},B=()=>{J(r.documentElement),ue((()=>N(i,"appload",{detail:{namespace:"twilight-components"}})))},G=(e,t,l)=>{if(e&&e[t])try{return e[t](l)}catch(e){le(e)}},I=(e,t)=>e&&e.then?e.then(t):t(),J=e=>e.classList.add("hydrated"),K=(e,t,l)=>{if(t.W){e.watchers&&(t.A=e.watchers);const n=Object.entries(t.W),o=e.prototype;if(n.map((([e,[n]])=>{31&n||2&l&&32&n?Object.defineProperty(o,e,{get(){return((e,t)=>Y(this).F.get(t))(0,e)},set(l){((e,t,l,n)=>{const o=Y(e),s=o.j,i=o.F.get(t),r=o.t,c=o.O;if(l=((e,t)=>null==e||h(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(l,n.W[t][0]),!(8&r&&void 0!==i||l===i)&&(o.F.set(t,l),c)){if(n.A&&128&r){const e=n.A[t];e&&e.map((e=>{try{c[e](l,i,t)}catch(e){le(e,s)}}))}2==(18&r)&&q(o,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0}):1&l&&64&n&&Object.defineProperty(o,e,{value(...t){const l=Y(this);return l.H.then((()=>l.O[e](...t)))}})})),1&l){const l=new Map;o.attributeChangedCallback=function(e,t,n){c.jmp((()=>{const t=l.get(e);this.hasOwnProperty(t)&&(n=this[t],delete this[t]),this[t]=(null!==n||"boolean"!=typeof this[t])&&n}))},e.observedAttributes=n.filter((([e,t])=>15&t[0])).map((([e,n])=>{const o=n[1]||e;return l.set(o,e),512&n[0]&&t.P.push([e,o]),o}))}}return e},Q=(e,t={})=>{const l=[],n=t.exclude||[],o=i.customElements,s=r.head,f=s.querySelector("meta[charset]"),u=r.createElement("style"),$=[];let y,h=!0;Object.assign(c,t),c.l=new URL(t.resourcesUrl||"./",r.baseURI).href,e.map((e=>e[1].map((t=>{const s={t:t[0],o:t[1],W:t[2],N:t[3]};s.W=t[2],s.P=[],s.A={};const i=s.o,f=class extends HTMLElement{constructor(e){super(e),ee(e=this,s)}connectedCallback(){y&&(clearTimeout(y),y=null),h?$.push(this):c.jmp((()=>(e=>{if(0==(1&c.t)){const t=Y(e),l=t.C,n=()=>{};if(!(1&t.t)){t.t|=1,12&l.t&&(e=>{const t=e["s-cr"]=r.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let l=e;for(;l=l.parentNode||l.host;)if(l["s-p"]){U(t,t.M=l);break}}l.W&&Object.entries(l.W).map((([t,[l]])=>{if(31&l&&e.hasOwnProperty(t)){const l=e[t];delete e[t],e[t]=l}})),(async(e,t,l,n,o)=>{if(0==(32&t.t)){{if(t.t|=32,(o=oe(l)).then){const e=()=>{};o=await o,e()}o.isProxied||(l.A=o.watchers,K(o,l,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(e){le(e)}t.t&=-9,t.t|=128,e()}if(o.style){let e=o.style;const t=d(l);if(!se.has(t)){const n=()=>{};((e,t,l)=>{let n=se.get(e);a&&l?(n=n||new CSSStyleSheet,n.replace(t)):n=t,se.set(e,n)})(t,e,!!(1&l.t)),n()}}}const s=t.M,i=()=>q(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,t,l)}n()}})(this)))}disconnectedCallback(){c.jmp((()=>{}))}componentOnReady(){return Y(this).U}};s.q=e[0],n.includes(i)||o.get(i)||(l.push(i),o.define(i,K(f,s,1)))})))),u.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",u.setAttribute("data-styles",""),s.insertBefore(u,f?f.nextSibling:s.firstChild),h=!1,$.length?$.map((e=>e.connectedCallback())):c.jmp((()=>y=setTimeout(B,30)))},X=new WeakMap,Y=e=>X.get(e),Z=(e,t)=>X.set(t.O=e,t),ee=(e,t)=>{const l={t:0,j:e,C:t,F:new Map};return l.H=new Promise((e=>l.L=e)),l.U=new Promise((e=>l.T=e)),e["s-p"]=[],e["s-rc"]=[],X.set(e,l)},te=(e,t)=>t in e,le=(e,t)=>(0,console.error)(e,t),ne=new Map,oe=e=>{const t=e.o.replace(/-/g,"_"),l=e.q,n=ne.get(l);return n?n[t]:import(`./${l}.entry.js`).then((e=>(ne.set(l,e),e[t])),le)},se=new Map,ie=[],re=[],ce=(e,t)=>l=>{e.push(l),s||(s=!0,t&&4&c.t?ue(ae):c.raf(ae))},fe=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){le(e)}e.length=0},ae=()=>{fe(ie),fe(re),(s=ie.length>0)&&c.raf(ae)},ue=e=>f().then(e),$e=ce(re,!0);export{b as H,Q as b,H as c,F as g,p as h,f as p,Z as r}
@@ -0,0 +1 @@
1
+ import{r as s,h as t,g as e,c as i,H as a}from"./p-d1ef2268.js";export{S as salla_login}from"./p-36c87e2e.js";import{H as l}from"./p-520446eb.js";let o=require("store/src/store-engine"),r=require("store/storages/sessionStorage"),n=o.createStore(r);const h=class{constructor(t){s(this,t),this.open=!1,this.isOpenedBefore=n.get("multi-warehouse-opened-before"),this.displayAs="default",this.browseProductsFrom="all",this.branches=[{id:1,name:"فرع الرياض",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:2,name:"فرع جدة",open:!1,available:!1,limited:!1,tag:"غير متوفر"},{id:3,name:"فرع مكة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:4,name:"فرع المدينة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:5,name:"فرع جازان",open:!0,available:!0,limited:!0,tag:"الكمية محدودة"}],this.current=1,this.currentBranch=s=>this.branches.filter((s=>s.id==this.current))[0][s],this.statusColor=(s=null)=>s?s.limited?"text-red-400":s.available?"text-green-500":"text-gray-400":this.currentBranch("limited")?"text-red-400":this.currentBranch("available")?"text-green-500":"text-gray-400",this.isChoiceable=()=>"all"!==this.browseProductsFrom&&"single"==this.position||"header"==this.position,this.formTitle=()=>this.isChoiceable()?"توفر المنتج في الفروع الآخرى":"التسوق من فرع آخر",salla.event.on("branches::show",(()=>this.show()))}async show(){return this.modal.show()}async hide(){return this.modal.hide()}handelChange(s){this.selected=s.target.value}handleSubmit(){n.set("multi-warehouse-opened-before",!0),this.show(),setTimeout((()=>{this.current=this.selected}),300)}render(){return t("salla-modal",{"is-closable":this.isOpenedBefore||"popup"!=this.displayAs?"true":"false",ref:s=>this.modal=s,"modal-width":"w-116",id:"multi-warehouse-modal",class:"hidden"},t("slot",{name:"header"},t("div",{slot:"header"})),t("div",null,t("div",{class:"text-right"},t("div",{class:"flex items-center mb-8"},t("div",{class:"flex-shrink-0 sm:mb-0 me-4"},t("div",{class:"h-16 w-16 border border-gray-200 bg-white text-primary rounded-full flex justify-center items-center"},t("span",{class:"sicon-store-alt"}))),t("div",null,t("p",{class:"mt-1 text-xs text-gray-400"},"أنت الآن تتصفح المتجر من"),t("h4",{class:"text-base"},"فرع الرياض"))),t("fieldset",{class:"mt-4"},t("h4",{class:"text-sm text-gray-600 mb-6"},this.formTitle()),t("legend",{class:"sr-only"},this.formTitle()),this.branches.length<=5?t("div",{class:"space-y-5"},this.branches.map((s=>t("div",{class:"flex items-center"},t("input",{id:this.position+"_branch_"+s.id,disabled:!s.open&&this.isChoiceable(),name:"lang",type:"radio",value:s.id,onChange:s=>this.handelChange(s),class:{"me-3 focus:ring-primary h-4 w-4 text-primary border-gray-300":!0,"opacity-50":!s.open,hidden:!this.isChoiceable()},checked:this.current==s.id}),t("label",{htmlFor:this.position+"_branch_"+s.id,class:{"flex items-center justify-between text-sm font-medium text-gray-700 flex-grow":!0,"cursor-pointer":this.isChoiceable()}},t("span",{class:{"opacity-50":!s.open}},s.name),this.isChoiceable()?t("small",{class:"text-red-400"},s.open?"":"مُغلق"):t("span",{class:this.statusColor(s)},s.tag)))))):t("select",{class:"w-full h-10 transition-colors duration-300 focus:ring-transparent focus:border-primary sm:text-sm border-gray-200 rounded-md appearance-none visibility_condition px-4",onInput:s=>this.handelChange(s)},this.branches.map((s=>t("option",{value:s.id,disabled:!s.open,selected:this.selected==s.id},s.name," ",s.open?"":"- مُغلق"))))))),this.isChoiceable()?t("p",{slot:"footer"},t("slot",{name:"footer"},t("button",{type:"button",class:"mt-8 w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-primary text-base font-medium text-white transition-colors hover:bg-primary-d focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:col-start-2 sm:text-sm",onClick:()=>this.handleSubmit()},salla.lang.get("common.elements.ok")))):"")}componentDidRender(){}get host(){return e(this)}},d=class{constructor(t){s(this,t),this.ready=i(this,"ready",7),this.close=i(this,"close",7),this.error=!1,this.success=!1,this.isClosable=!0,this.modalWidth="w-96",this.visible=!1,this.subTitle="",this.icon="sicon-cancel",salla.event.on("modal::open",(s=>s.dataset.target==this.host.id&&this.show())),salla.event.on("modal::close",(s=>s.dataset.target==this.host.id&&this.hide())),this.title=this.host.title,this.host.removeAttribute("title")}handleVisible(s){if(!s)return this.toggleModal(!1),void this.close.emit();this.host.classList.remove("hidden"),setTimeout((()=>this.toggleModal(!0))),this.ready.emit()}async show(){return this.host.setAttribute("visible",""),this.host}async hide(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.title=s,this.host}toggleModal(s){l.toggleElement(this.host.querySelector(".s-modal-overlay"),"ease-out duration-300 opacity-100","opacity-0",(()=>s)).toggleElement(this.host.querySelector(".s-modal-body"),"ease-out duration-300 opacity-100 translate-y-0 sm:scale-100","opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",(()=>s)).toggleElement(document.body,"modal-is-open","modal-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("hidden")),350)}closeModal(){this.isClosable&&this.host.removeAttribute("visible")}render(){return this.host.id=this.host.id||"salla-modal",t(a,{class:"s-modal-container hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-wrapper"},t("div",{class:"s-modal-overlay",onClick:()=>this.closeModal()}),t("span",{class:"s-modal-spacer"},"​"),t("div",{class:"s-modal-body "+this.modalWidth},t("slot",{name:"header"},t("div",{class:"s-modal-header"},this.isClosable?t("button",{class:"s-modal-close cursor-pointer",onClick:()=>this.closeModal(),type:"button"},t("span",{class:"sicon-cancel"})):"",this.error||this.success?t("div",{class:{"s-modal-icon":!0,"s-modal-bg-error":this.error,"s-modal-bg-success":this.success}},t("i",{class:{[this.icon]:!0,"s-modal-text-error":this.error,"s-modal-text-success":this.success}})):"",t("div",{class:"s-modal-title",innerHTML:this.title}),t("p",{class:"s-modal-sub-title",innerHTML:this.subTitle}))),t("slot",null),t("slot",{name:"footer"}))))}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};export{h as multi_warehouse,d as salla_modal}
@@ -0,0 +1 @@
1
+ import{r as l,h as a,g as s}from"./p-d1ef2268.js";import{H as i}from"./p-520446eb.js";const t=class{constructor(a){l(this,a),i.setHost(this.host),salla.event.on("localization::show",(()=>this.show()))}setCurrentLanguage(l){this.language=l}setCurrentCurrency(l){this.currency=l}async show(){return this.modal.show()}async hide(){return this.modal.hide()}submit(){let l;this.btn.load().then((()=>{if(this.currency&&this.currency.code!==salla.config.currency.code)return l=window.location.href,salla.currency.api.change(this.currency.code)})).then((()=>{this.language&&this.language.code!==salla.config.language.code&&(l=this.language.url)})).then((()=>this.btn.stop())).then((()=>this.hide())).then((()=>l&&(window.location.href=l)))}render(){return a("salla-modal",{id:"salla-localization",class:"hidden",ref:l=>this.modal=l},a("slot",{name:"header"},a("div",{slot:"header"})),a("div",{class:"s-localization-inner"},salla.config.languages?a("div",{class:"s-localization-section"},a("label",{class:"s-localization-title"},salla.lang.get("common.titles.language")),a("fieldset",{class:"s-localization-fieldset"},a("legend",{class:"sr-only"},salla.lang.get("blocks.header.change_language")),a("div",{class:"s-localization-section-inner"},salla.config.languages.map((l=>a("div",{class:"flex items-center"},a("input",{class:"s-localization-input",checked:salla.config.language.code==l.code,onChange:()=>this.setCurrentLanguage(l),id:"lang-"+l.code.toLowerCase(),name:"language",type:"radio",value:l.code}),a("label",{htmlFor:"lang-"+l.code.toLowerCase(),class:"s-localization-label"},a("span",null,l.name),a("div",{class:"s-localization-flag flag iti__flag iti__"+l.country_code})))))))):"",salla.config.currencies?a("div",{class:"s-localization-section"},a("label",{class:"s-localization-title"},salla.lang.get("common.titles.currency")),a("fieldset",{class:"s-localization-fieldset"},a("legend",{class:"sr-only"},salla.lang.get("blocks.header.change_currency")),a("div",{class:"s-localization-section-inner"},salla.config.currencies.map((l=>a("div",{class:"s-localization-item"},a("input",{class:"s-localization-input",checked:salla.config.currency.code==l.code,onChange:()=>this.setCurrentCurrency(l),id:"currency-"+l.code,name:"currency",type:"radio",value:l.code}),a("label",{class:"s-localization-label",htmlFor:"currency-"+l.code},a("span",null,l.name),a("small",{class:"s-localization-currency"},l.code)))))))):""),a("p",{slot:"footer"},a("slot",{name:"footer"},a("salla-button",{ref:l=>this.btn=l,onClick:()=>this.submit(),class:"w-full"},salla.lang.get("common.elements.ok")))))}get host(){return s(this)}};export{t as salla_localization}
@@ -1 +1 @@
1
- import{p as s,b as e}from"./p-9f9af3e0.js";(()=>{const e=import.meta.url,a={};return""!==e&&(a.resourcesUrl=new URL(".",e).href),s(a)})().then((s=>e([["p-840f0daa",[[0,"salla-login"],[4,"salla-modal",{error:[4],success:[4],visible:[516],subTitle:[1,"sub-title"],icon:[1]}]]],["p-1abaafe4",[[4,"salla-currency-language",{show:[64],hide:[64]}]]],["p-b134c95d",[[4,"salla-search",{searchPlaceholder:[1,"search-placeholder"],noResultsText:[1,"no-results-text"],searchTerm:[32],results:[32],fetchStatus:[32],showResult:[32],showModal:[32]}]]]],s)));
1
+ import{p as e,b as s}from"./p-d1ef2268.js";(()=>{const s=import.meta.url,a={};return""!==s&&(a.resourcesUrl=new URL(".",s).href),e(a)})().then((e=>s([["p-f4340bd9",[[4,"salla-localization",{show:[64],hide:[64]}]]],["p-a2395c9d",[[0,"salla-verify"]]],["p-bd10d8d5",[[0,"order-rating",{order:[8]}]]],["p-baeca520",[[4,"salla-search",{searchPlaceholder:[1,"search-placeholder"],noResultsText:[1,"no-results-text"],searchTerm:[32],results:[32],fetchStatus:[32],showResult:[32],showModal:[32]}]]],["p-653bb9a8",[[4,"salla-button",{kind:[513],loading:[516],disabled:[516],load:[64],stop:[64],disable:[64],enable:[64]}]]],["p-ea986bca",[[4,"multi-warehouse",{position:[1],displayAs:[1,"display-as"],browseProductsFrom:[1,"browse-products-from"],branches:[16],current:[1026],open:[32],selected:[32],isOpenedBefore:[32],show:[64],hide:[64]}],[0,"salla-login"],[4,"salla-modal",{error:[4],success:[4],isClosable:[1028,"is-closable"],modalWidth:[1,"modal-width"],visible:[516],subTitle:[1,"sub-title"],icon:[1],show:[64],hide:[64],setTitle:[64]}]]]],e)));
@@ -0,0 +1,23 @@
1
+ export declare class MultiWarehouse {
2
+ open: boolean;
3
+ selected: number;
4
+ isOpenedBefore: string;
5
+ position: string;
6
+ displayAs: string;
7
+ browseProductsFrom: string;
8
+ branches: any[];
9
+ current: number;
10
+ private modal;
11
+ host: HTMLElement;
12
+ constructor();
13
+ show(): Promise<HTMLElement>;
14
+ hide(): Promise<HTMLElement>;
15
+ private currentBranch;
16
+ private statusColor;
17
+ private isChoiceable;
18
+ private formTitle;
19
+ private handelChange;
20
+ private handleSubmit;
21
+ render(): any;
22
+ componentDidRender(): void;
23
+ }
@@ -0,0 +1,20 @@
1
+ export declare class OrderRating {
2
+ stars: Number[];
3
+ order: any;
4
+ ratingChain: Promise<void>;
5
+ wizardInex: number;
6
+ componentDidRender(): void;
7
+ render(): any;
8
+ renderProductsRating(): any;
9
+ renderStoreRating(): any;
10
+ renderShippingRating(): any;
11
+ getStarsRating(): any;
12
+ initiateRating(): void;
13
+ handleWizard(): void;
14
+ showActiveStep(steps: any): void;
15
+ sendRating(): Promise<void>;
16
+ sendFeedback(type: any, formsData: any): void;
17
+ ratingValidation(): void;
18
+ highlightSelectedStars(): void;
19
+ starsRating(): void;
20
+ }
@@ -0,0 +1,16 @@
1
+ export declare class SallaButton {
2
+ constructor();
3
+ host: HTMLElement;
4
+ kind: string;
5
+ loading: boolean;
6
+ disabled: boolean;
7
+ load(): Promise<HTMLElement>;
8
+ stop(): Promise<HTMLElement>;
9
+ disable(): Promise<void>;
10
+ enable(): Promise<void>;
11
+ private hostAttributes;
12
+ private btn;
13
+ handleVisible(newKind: string, oldKind: string): void;
14
+ handleLoading(newVal: boolean): void;
15
+ render(): any;
16
+ }
@@ -0,0 +1,14 @@
1
+ export declare class SallaLocalization {
2
+ constructor();
3
+ private modal;
4
+ private btn;
5
+ private language;
6
+ private currency;
7
+ host: HTMLElement;
8
+ private setCurrentLanguage;
9
+ private setCurrentCurrency;
10
+ show(): Promise<HTMLElement>;
11
+ hide(): Promise<HTMLElement>;
12
+ private submit;
13
+ render(): any;
14
+ }
@@ -1,16 +1,22 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
2
  export declare class SallaModal {
3
+ constructor();
3
4
  error: boolean;
4
5
  success: boolean;
6
+ isClosable: boolean;
7
+ modalWidth: string;
5
8
  visible: boolean;
6
9
  subTitle: string;
7
10
  icon: string;
11
+ private title;
8
12
  host: HTMLElement;
9
13
  ready: EventEmitter;
10
14
  close: EventEmitter;
11
15
  handleVisible(newValue: boolean): void;
12
- private show;
13
- private hide;
16
+ show(): Promise<HTMLElement>;
17
+ hide(): Promise<HTMLElement>;
18
+ setTitle(title: any): Promise<HTMLElement>;
14
19
  private toggleModal;
20
+ private closeModal;
15
21
  render(): any;
16
22
  }
@@ -0,0 +1,19 @@
1
+ export declare class SallaVerify {
2
+ constructor();
3
+ host: HTMLElement;
4
+ private modal;
5
+ private code;
6
+ private btn;
7
+ private resendMessage;
8
+ private timer;
9
+ private resend;
10
+ private otpInputs;
11
+ private mobile;
12
+ private country_code;
13
+ private show;
14
+ private toggleOTPSubmit;
15
+ private resendTimer;
16
+ private submit;
17
+ private resendCode;
18
+ render(): any;
19
+ }
@@ -6,15 +6,41 @@
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
8
  export namespace Components {
9
- interface SallaCurrencyLanguage {
10
- "hide": () => Promise<void>;
11
- "show": () => Promise<void>;
9
+ interface MultiWarehouse {
10
+ "branches": any[];
11
+ "browseProductsFrom": string;
12
+ "current": number;
13
+ "displayAs": string;
14
+ "hide": () => Promise<HTMLElement>;
15
+ "position": string;
16
+ "show": () => Promise<HTMLElement>;
17
+ }
18
+ interface OrderRating {
19
+ "order": any;
20
+ }
21
+ interface SallaButton {
22
+ "disable": () => Promise<void>;
23
+ "disabled": boolean;
24
+ "enable": () => Promise<void>;
25
+ "kind": string;
26
+ "load": () => Promise<HTMLElement>;
27
+ "loading": boolean;
28
+ "stop": () => Promise<HTMLElement>;
29
+ }
30
+ interface SallaLocalization {
31
+ "hide": () => Promise<HTMLElement>;
32
+ "show": () => Promise<HTMLElement>;
12
33
  }
13
34
  interface SallaLogin {
14
35
  }
15
36
  interface SallaModal {
16
37
  "error": boolean;
38
+ "hide": () => Promise<HTMLElement>;
17
39
  "icon": string;
40
+ "isClosable": boolean;
41
+ "modalWidth": string;
42
+ "setTitle": (title: any) => Promise<HTMLElement>;
43
+ "show": () => Promise<HTMLElement>;
18
44
  "subTitle": string;
19
45
  "success": boolean;
20
46
  "visible": boolean;
@@ -29,13 +55,33 @@ export namespace Components {
29
55
  */
30
56
  "searchPlaceholder": string;
31
57
  }
58
+ interface SallaVerify {
59
+ }
32
60
  }
33
61
  declare global {
34
- interface HTMLSallaCurrencyLanguageElement extends Components.SallaCurrencyLanguage, HTMLStencilElement {
62
+ interface HTMLMultiWarehouseElement extends Components.MultiWarehouse, HTMLStencilElement {
63
+ }
64
+ var HTMLMultiWarehouseElement: {
65
+ prototype: HTMLMultiWarehouseElement;
66
+ new (): HTMLMultiWarehouseElement;
67
+ };
68
+ interface HTMLOrderRatingElement extends Components.OrderRating, HTMLStencilElement {
69
+ }
70
+ var HTMLOrderRatingElement: {
71
+ prototype: HTMLOrderRatingElement;
72
+ new (): HTMLOrderRatingElement;
73
+ };
74
+ interface HTMLSallaButtonElement extends Components.SallaButton, HTMLStencilElement {
35
75
  }
36
- var HTMLSallaCurrencyLanguageElement: {
37
- prototype: HTMLSallaCurrencyLanguageElement;
38
- new (): HTMLSallaCurrencyLanguageElement;
76
+ var HTMLSallaButtonElement: {
77
+ prototype: HTMLSallaButtonElement;
78
+ new (): HTMLSallaButtonElement;
79
+ };
80
+ interface HTMLSallaLocalizationElement extends Components.SallaLocalization, HTMLStencilElement {
81
+ }
82
+ var HTMLSallaLocalizationElement: {
83
+ prototype: HTMLSallaLocalizationElement;
84
+ new (): HTMLSallaLocalizationElement;
39
85
  };
40
86
  interface HTMLSallaLoginElement extends Components.SallaLogin, HTMLStencilElement {
41
87
  }
@@ -55,21 +101,48 @@ declare global {
55
101
  prototype: HTMLSallaSearchElement;
56
102
  new (): HTMLSallaSearchElement;
57
103
  };
104
+ interface HTMLSallaVerifyElement extends Components.SallaVerify, HTMLStencilElement {
105
+ }
106
+ var HTMLSallaVerifyElement: {
107
+ prototype: HTMLSallaVerifyElement;
108
+ new (): HTMLSallaVerifyElement;
109
+ };
58
110
  interface HTMLElementTagNameMap {
59
- "salla-currency-language": HTMLSallaCurrencyLanguageElement;
111
+ "multi-warehouse": HTMLMultiWarehouseElement;
112
+ "order-rating": HTMLOrderRatingElement;
113
+ "salla-button": HTMLSallaButtonElement;
114
+ "salla-localization": HTMLSallaLocalizationElement;
60
115
  "salla-login": HTMLSallaLoginElement;
61
116
  "salla-modal": HTMLSallaModalElement;
62
117
  "salla-search": HTMLSallaSearchElement;
118
+ "salla-verify": HTMLSallaVerifyElement;
63
119
  }
64
120
  }
65
121
  declare namespace LocalJSX {
66
- interface SallaCurrencyLanguage {
122
+ interface MultiWarehouse {
123
+ "branches"?: any[];
124
+ "browseProductsFrom"?: string;
125
+ "current"?: number;
126
+ "displayAs"?: string;
127
+ "position"?: string;
128
+ }
129
+ interface OrderRating {
130
+ "order"?: any;
131
+ }
132
+ interface SallaButton {
133
+ "disabled"?: boolean;
134
+ "kind"?: string;
135
+ "loading"?: boolean;
136
+ }
137
+ interface SallaLocalization {
67
138
  }
68
139
  interface SallaLogin {
69
140
  }
70
141
  interface SallaModal {
71
142
  "error"?: boolean;
72
143
  "icon"?: string;
144
+ "isClosable"?: boolean;
145
+ "modalWidth"?: string;
73
146
  "onClose"?: (event: CustomEvent<any>) => void;
74
147
  "onReady"?: (event: CustomEvent<any>) => void;
75
148
  "subTitle"?: string;
@@ -86,21 +159,31 @@ declare namespace LocalJSX {
86
159
  */
87
160
  "searchPlaceholder"?: string;
88
161
  }
162
+ interface SallaVerify {
163
+ }
89
164
  interface IntrinsicElements {
90
- "salla-currency-language": SallaCurrencyLanguage;
165
+ "multi-warehouse": MultiWarehouse;
166
+ "order-rating": OrderRating;
167
+ "salla-button": SallaButton;
168
+ "salla-localization": SallaLocalization;
91
169
  "salla-login": SallaLogin;
92
170
  "salla-modal": SallaModal;
93
171
  "salla-search": SallaSearch;
172
+ "salla-verify": SallaVerify;
94
173
  }
95
174
  }
96
175
  export { LocalJSX as JSX };
97
176
  declare module "@stencil/core" {
98
177
  export namespace JSX {
99
178
  interface IntrinsicElements {
100
- "salla-currency-language": LocalJSX.SallaCurrencyLanguage & JSXBase.HTMLAttributes<HTMLSallaCurrencyLanguageElement>;
179
+ "multi-warehouse": LocalJSX.MultiWarehouse & JSXBase.HTMLAttributes<HTMLMultiWarehouseElement>;
180
+ "order-rating": LocalJSX.OrderRating & JSXBase.HTMLAttributes<HTMLOrderRatingElement>;
181
+ "salla-button": LocalJSX.SallaButton & JSXBase.HTMLAttributes<HTMLSallaButtonElement>;
182
+ "salla-localization": LocalJSX.SallaLocalization & JSXBase.HTMLAttributes<HTMLSallaLocalizationElement>;
101
183
  "salla-login": LocalJSX.SallaLogin & JSXBase.HTMLAttributes<HTMLSallaLoginElement>;
102
184
  "salla-modal": LocalJSX.SallaModal & JSXBase.HTMLAttributes<HTMLSallaModalElement>;
103
185
  "salla-search": LocalJSX.SallaSearch & JSXBase.HTMLAttributes<HTMLSallaSearchElement>;
186
+ "salla-verify": LocalJSX.SallaVerify & JSXBase.HTMLAttributes<HTMLSallaVerifyElement>;
104
187
  }
105
188
  }
106
189
  }
@@ -4,5 +4,5 @@ declare global {
4
4
  }
5
5
  let salla: any;
6
6
  }
7
- export * from './components/login/salla-login';
8
- export * from './components/search/salla-search';
7
+ export * from './components/salla-login/salla-login';
8
+ export * from './components/salla-search/salla-search';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-components",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "twilight",
@@ -40,11 +40,10 @@
40
40
  "ci:build": "stencil build --ci",
41
41
  "ci:test": "stencil test --spec",
42
42
  "prerender": "stencil build --prerender",
43
- "prepublishOnly": "node ./publish.js"
43
+ "prepublishOnly": "node ./publish.js",
44
+ "tailwind": "node src/plugins/tailwind-theme/generator.js"
44
45
  },
45
46
  "devDependencies": {
46
- "lodash": "^4.17.21",
47
- "tailwindcss": "^2.2.19",
48
47
  "@compodoc/compodoc": "^1.1.14",
49
48
  "@stencil/core": "2.8.1",
50
49
  "@stencil/eslint-plugin": "^0.3.1",
@@ -60,9 +59,14 @@
60
59
  "eslint-plugin-react": "^7.26.0",
61
60
  "jest": "26.6.1",
62
61
  "jest-cli": "26.6.1",
62
+ "lodash": "^4.17.21",
63
63
  "prettier": "^2.4.1",
64
+ "promisify-child-process": "^3.1.4",
64
65
  "puppeteer": "^5.4.1",
65
- "typescript": "^4.4.3",
66
- "promisify-child-process": "^3.1.4"
66
+ "tailwindcss": "^2.2.19",
67
+ "typescript": "^4.4.3"
68
+ },
69
+ "dependencies": {
70
+ "store": "^2.0.12"
67
71
  }
68
72
  }
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-e9451c82.js');
6
- const Helper = require('./Helper-8c75b6ac.js');
7
-
8
- const SallaCurrencyLanguage = class {
9
- constructor(hostRef) {
10
- index.registerInstance(this, hostRef);
11
- Helper.Helper.setHost(this.host);
12
- }
13
- async show() {
14
- this.modal.setAttribute('visible', '');
15
- }
16
- async hide() {
17
- this.modal.removeAttribute('visible');
18
- }
19
- submit() {
20
- this.hide()
21
- .then(() => {
22
- let code = Helper.Helper.val('[name=currency]:checked');
23
- if (code !== salla.config.currency.code) {
24
- return salla.currency.api.change(code);
25
- }
26
- }).then(() => {
27
- let language = Helper.Helper.val('[name=lang]:checked');
28
- if (language !== salla.config.language.code) {
29
- window.location.href = salla.config.languages.filter(lang => lang.code === language)[0].url;
30
- }
31
- });
32
- }
33
- render() {
34
- return (index.h("salla-modal", { id: "lang-currency-modal", class: "hidden" }, index.h("slot", { name: "header" }, index.h("div", { slot: "header" })), index.h("div", { class: "s-currency-language-inner" }, salla.config.languages
35
- ? index.h("div", { class: "s-currency-language-section" }, index.h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.language')), index.h("fieldset", { class: "s-currency-language-fieldset" }, index.h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_language')), index.h("div", { class: "s-currency-language-section-inner" }, salla.config.languages.map(lang => index.h("div", { class: "flex items-center" }, index.h("input", { id: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-input", name: "lang", checked: salla.config.language.code == lang.code, type: "radio", value: lang.code }), index.h("label", { htmlFor: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-label" }, index.h("span", null, lang.name), index.h("div", { class: 's-currency-language-flag flag iti__flag iti__' + lang.country_code })))))))
36
- : '', salla.config.currencies
37
- ? index.h("div", { class: "s-currency-language-section" }, index.h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.currency')), index.h("fieldset", { class: "s-currency-language-fieldset" }, index.h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_currency')), index.h("div", { class: "s-currency-language-section-inner" }, salla.config.currencies.map(currency => index.h("div", { class: "s-currency-language-item" }, index.h("input", { class: "s-currency-language-input", checked: salla.config.currency.code == currency.code, id: 'currency-' + currency.code, name: "currency", type: "radio", value: currency.code }), index.h("label", { class: "s-currency-language-label", htmlFor: 'currency-' + currency.code }, index.h("span", null, currency.name), index.h("small", { class: "s-currency-language-currency" }, currency.code)))))))
38
- : ''), index.h("p", { slot: "footer" }, index.h("slot", { name: "footer" }, index.h("button", { type: "button", class: "s-currency-language-submit", onClick: () => this.submit() }, salla.lang.get('common.elements.ok'))))));
39
- }
40
- componentDidRender() {
41
- this.modal = document.querySelector('#lang-currency-modal');
42
- }
43
- get host() { return index.getElement(this); }
44
- };
45
-
46
- exports.salla_currency_language = SallaCurrencyLanguage;
@@ -1,57 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const sallaLogin = require('./salla-login-3ec94029.js');
6
- const index = require('./index-e9451c82.js');
7
- const Helper = require('./Helper-8c75b6ac.js');
8
-
9
- const SallaModal = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.ready = index.createEvent(this, "ready", 7);
13
- this.close = index.createEvent(this, "close", 7);
14
- this.error = false;
15
- this.success = false;
16
- this.visible = false;
17
- this.subTitle = '';
18
- this.icon = 'sicon-cancel';
19
- }
20
- handleVisible(newValue) {
21
- return newValue === true
22
- ? this.show()
23
- : this.hide();
24
- }
25
- show() {
26
- this.host.classList.remove('hidden');
27
- setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
28
- this.ready.emit();
29
- }
30
- hide() {
31
- this.toggleModal(false);
32
- this.close.emit();
33
- }
34
- toggleModal(isOpen) {
35
- Helper.Helper.toggleElement(this.host.querySelector('.s-modal-overlay'), 'ease-out duration-300 opacity-100', 'opacity-0', () => isOpen)
36
- .toggleElement(this.host.querySelector('.s-modal-body'), 'ease-out duration-300 opacity-100 translate-y-0 sm:scale-100', //add these classes
37
- 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', //remove these classes
38
- () => isOpen)
39
- .toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
40
- if (!isOpen) {
41
- setTimeout(() => this.host.classList.add('hidden'), 350);
42
- }
43
- }
44
- render() {
45
- this.host.id = this.host.id || 'salla-modal';
46
- return (index.h(index.Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" }, index.h("div", { class: "s-modal-wrapper" }, index.h("div", { class: "s-modal-overlay", onClick: () => this.host.removeAttribute('visible') }), index.h("span", { class: "s-modal-spacer" }, "\u200B"), index.h("div", { class: "s-modal-body" }, index.h("slot", { name: "header" }, index.h("div", { class: "s-modal-header" }, index.h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.host.removeAttribute('visible'), type: "button" }, index.h("span", { class: "sicon-cancel" })), index.h("div", { class: "s-modal-title" }, this.host.title), index.h("p", { class: "s-modal-sub-title" }, this.subTitle), this.error || this.success
47
- ? index.h("div", { class: { 's-modal-icon': true, 'bg-red-100': this.error, 'bg-green-100': this.success } }, index.h("i", { class: { [this.icon]: true, 'text-red-600': this.error, 'text-green-600': this.success } }))
48
- : '')), index.h("slot", null), index.h("slot", { name: "footer" })))));
49
- }
50
- get host() { return index.getElement(this); }
51
- static get watchers() { return {
52
- "visible": ["handleVisible"]
53
- }; }
54
- };
55
-
56
- exports.salla_login = sallaLogin.SallaLogin;
57
- exports.salla_modal = SallaModal;
@@ -1,97 +0,0 @@
1
- import { Component, Element, h, Method } from '@stencil/core';
2
- import Helper from "../../Helpers/Helper";
3
- export class SallaCurrencyLanguage {
4
- constructor() {
5
- Helper.setHost(this.host);
6
- }
7
- async show() {
8
- this.modal.setAttribute('visible', '');
9
- }
10
- async hide() {
11
- this.modal.removeAttribute('visible');
12
- }
13
- submit() {
14
- this.hide()
15
- .then(() => {
16
- let code = Helper.val('[name=currency]:checked');
17
- if (code !== salla.config.currency.code) {
18
- return salla.currency.api.change(code);
19
- }
20
- }).then(() => {
21
- let language = Helper.val('[name=lang]:checked');
22
- if (language !== salla.config.language.code) {
23
- window.location.href = salla.config.languages.filter(lang => lang.code === language)[0].url;
24
- }
25
- });
26
- }
27
- render() {
28
- return (h("salla-modal", { id: "lang-currency-modal", class: "hidden" },
29
- h("slot", { name: "header" },
30
- h("div", { slot: "header" })),
31
- h("div", { class: "s-currency-language-inner" },
32
- salla.config.languages
33
- ? h("div", { class: "s-currency-language-section" },
34
- h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.language')),
35
- h("fieldset", { class: "s-currency-language-fieldset" },
36
- h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_language')),
37
- h("div", { class: "s-currency-language-section-inner" }, salla.config.languages.map(lang => h("div", { class: "flex items-center" },
38
- h("input", { id: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-input", name: "lang", checked: salla.config.language.code == lang.code, type: "radio", value: lang.code }),
39
- h("label", { htmlFor: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-label" },
40
- h("span", null, lang.name),
41
- h("div", { class: 's-currency-language-flag flag iti__flag iti__' + lang.country_code })))))))
42
- : '',
43
- salla.config.currencies
44
- ? h("div", { class: "s-currency-language-section" },
45
- h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.currency')),
46
- h("fieldset", { class: "s-currency-language-fieldset" },
47
- h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_currency')),
48
- h("div", { class: "s-currency-language-section-inner" }, salla.config.currencies.map(currency => h("div", { class: "s-currency-language-item" },
49
- h("input", { class: "s-currency-language-input", checked: salla.config.currency.code == currency.code, id: 'currency-' + currency.code, name: "currency", type: "radio", value: currency.code }),
50
- h("label", { class: "s-currency-language-label", htmlFor: 'currency-' + currency.code },
51
- h("span", null, currency.name),
52
- h("small", { class: "s-currency-language-currency" }, currency.code)))))))
53
- : ''),
54
- h("p", { slot: "footer" },
55
- h("slot", { name: "footer" },
56
- h("button", { type: "button", class: "s-currency-language-submit", onClick: () => this.submit() }, salla.lang.get('common.elements.ok'))))));
57
- }
58
- componentDidRender() {
59
- this.modal = document.querySelector('#lang-currency-modal');
60
- }
61
- static get is() { return "salla-currency-language"; }
62
- static get methods() { return {
63
- "show": {
64
- "complexType": {
65
- "signature": "() => Promise<void>",
66
- "parameters": [],
67
- "references": {
68
- "Promise": {
69
- "location": "global"
70
- }
71
- },
72
- "return": "Promise<void>"
73
- },
74
- "docs": {
75
- "text": "",
76
- "tags": []
77
- }
78
- },
79
- "hide": {
80
- "complexType": {
81
- "signature": "() => Promise<void>",
82
- "parameters": [],
83
- "references": {
84
- "Promise": {
85
- "location": "global"
86
- }
87
- },
88
- "return": "Promise<void>"
89
- },
90
- "docs": {
91
- "text": "",
92
- "tags": []
93
- }
94
- }
95
- }; }
96
- static get elementRef() { return "host"; }
97
- }