@salla.sa/twilight-components 2.13.48 → 2.13.50

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 (65) hide show
  1. package/dist/cjs/app-globals-0efa4587.js.map +1 -1
  2. package/dist/cjs/salla-add-product-button_47.cjs.entry.js +2 -2
  3. package/dist/cjs/salla-add-product-button_47.cjs.entry.js.map +1 -1
  4. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  5. package/dist/cjs/salla-filters.cjs.entry.js.map +1 -1
  6. package/dist/cjs/salla-price-range.cjs.entry.js +10 -8
  7. package/dist/cjs/salla-price-range.cjs.entry.js.map +1 -1
  8. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +1 -1
  9. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js.map +1 -1
  10. package/dist/collection/components/salla-filters/salla-filters.js +1 -1
  11. package/dist/collection/components/salla-filters/salla-filters.js.map +1 -1
  12. package/dist/collection/components/salla-price-range/salla-price-range.js +10 -8
  13. package/dist/collection/components/salla-price-range/salla-price-range.js.map +1 -1
  14. package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
  15. package/dist/collection/components/salla-tel-input/salla-tel-input.js.map +1 -1
  16. package/dist/components/index.js.map +1 -1
  17. package/dist/components/salla-bottom-alert.js +1 -1
  18. package/dist/components/salla-bottom-alert.js.map +1 -1
  19. package/dist/components/salla-filters.js +1 -1
  20. package/dist/components/salla-filters.js.map +1 -1
  21. package/dist/components/salla-price-range2.js +10 -8
  22. package/dist/components/salla-price-range2.js.map +1 -1
  23. package/dist/components/salla-quick-buy2.js.map +1 -1
  24. package/dist/components/salla-tel-input2.js +1 -1
  25. package/dist/components/salla-tel-input2.js.map +1 -1
  26. package/dist/esm/app-globals-32c0b133.js.map +1 -1
  27. package/dist/esm/salla-add-product-button_47.entry.js +2 -2
  28. package/dist/esm/salla-add-product-button_47.entry.js.map +1 -1
  29. package/dist/esm/salla-filters.entry.js +1 -1
  30. package/dist/esm/salla-filters.entry.js.map +1 -1
  31. package/dist/esm/salla-price-range.entry.js +10 -8
  32. package/dist/esm/salla-price-range.entry.js.map +1 -1
  33. package/dist/esm-es5/app-globals-32c0b133.js.map +1 -1
  34. package/dist/esm-es5/salla-add-product-button_47.entry.js +2 -2
  35. package/dist/esm-es5/salla-add-product-button_47.entry.js.map +1 -1
  36. package/dist/esm-es5/salla-filters.entry.js +1 -1
  37. package/dist/esm-es5/salla-filters.entry.js.map +1 -1
  38. package/dist/esm-es5/salla-price-range.entry.js +1 -1
  39. package/dist/esm-es5/salla-price-range.entry.js.map +1 -1
  40. package/dist/twilight/{p-00f68eb0.entry.js → p-429870cc.entry.js} +3 -3
  41. package/dist/twilight/p-429870cc.entry.js.map +1 -0
  42. package/dist/twilight/p-44a3fce3.system.js.map +1 -1
  43. package/dist/twilight/p-72f22697.entry.js +5 -0
  44. package/dist/twilight/p-72f22697.entry.js.map +1 -0
  45. package/dist/twilight/{p-fd50cc47.system.entry.js → p-868c776b.system.entry.js} +2 -2
  46. package/dist/twilight/p-868c776b.system.entry.js.map +1 -0
  47. package/dist/twilight/p-93a162ca.js.map +1 -1
  48. package/dist/twilight/{p-40175f65.entry.js → p-9d552606.entry.js} +2 -2
  49. package/dist/twilight/p-9d552606.entry.js.map +1 -0
  50. package/dist/twilight/{p-8a76175f.system.entry.js → p-b0585915.system.entry.js} +3 -3
  51. package/dist/twilight/p-b0585915.system.entry.js.map +1 -0
  52. package/dist/twilight/p-b9c7fc02.system.js +1 -1
  53. package/dist/twilight/p-caaedb09.system.entry.js +5 -0
  54. package/dist/twilight/p-caaedb09.system.entry.js.map +1 -0
  55. package/dist/twilight/twilight.esm.js +1 -1
  56. package/dist/types/components/salla-price-range/salla-price-range.d.ts +1 -1
  57. package/package.json +5 -5
  58. package/dist/twilight/p-00f68eb0.entry.js.map +0 -1
  59. package/dist/twilight/p-40175f65.entry.js.map +0 -1
  60. package/dist/twilight/p-8a76175f.system.entry.js.map +0 -1
  61. package/dist/twilight/p-de881d07.entry.js +0 -5
  62. package/dist/twilight/p-de881d07.entry.js.map +0 -1
  63. package/dist/twilight/p-f53461d7.system.entry.js +0 -5
  64. package/dist/twilight/p-f53461d7.system.entry.js.map +0 -1
  65. package/dist/twilight/p-fd50cc47.system.entry.js.map +0 -1
@@ -1,5 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as t,c as i,h as s,H as e}from"./p-fafedb13.js";import{a as r}from"./p-91a1d8b6.js";import{a as l}from"./p-5800516f.js";const a=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";const h=class{constructor(s){t(this,s);this.changed=i(this,"changed",7);this.filterValues=[];this.minPrice=undefined;this.maxPrice=undefined;this.option=undefined;this.filtersData=undefined;this.min=0;this.max=1e4;this.priceOptions=undefined;this.moreThanLabel="أكثر من";this.lessThanLabel="أقل من";this.toLabel="الى";this.fromLabel="من";this.typing=false;this.isMin=false;this.isRTL=salla.config.get("theme.is_rtl",true)}connectedCallback(){var t;if(this.filtersData&&((t=this.filtersData)===null||t===void 0?void 0:t.price)){this.minPrice=this.filtersData.price.min;this.maxPrice=this.filtersData.price.max}salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel);this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel);this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel);this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)}));if(this.option.values.length==1){return}if(this.option.values.length<=5){this.filterValues=this.option.values;return}const i=Math.ceil(this.option.values.length/5);for(let t=0;t<this.option.values.length;t+=i){this.filterValues.push(this.option.values.slice(t,t+i).reduce(((t,i)=>{t.to=i.to;t.count+=i.count;return t})))}}async reset(){this.minInput.value=null;this.maxInput.value=null}getPriceLabel(t){if(isNaN(t.from)||t.from<1){return`${this.lessThanLabel} ${salla.money(t.to)}`}if(isNaN(t.to)||t.to<1){return`${this.moreThanLabel} ${salla.money(t.from)}`}return`${salla.money(t.from)} ${this.toLabel} ${salla.money(t.to)}`}minInputValidation(t){if(t&&(t>this.max||this.maxPrice&&t>this.maxPrice)){return}if(t<this.min){this.minPrice=this.min;return}if(t){this.minPrice=t}}maxInputValidation(t){if(t&&(t<this.min||this.minPrice&&t<this.minPrice)){return}if(t>this.max){this.maxPrice=this.max;return}}async changedEventHandler(t){salla.helpers.inputDigitsOnly(this.minInput);salla.helpers.inputDigitsOnly(this.maxInput);const i=this.minPrice?+this.minPrice*1:"";const s=this.maxPrice?+this.maxPrice*1:"";if(this.isMin){if(!this.maxPrice){this.maxPrice=""}this.minInputValidation(i)}else{if(!this.minPrice){this.minPrice=0}this.maxInputValidation(s)}this.isReady&&this.changed.emit({event:t,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(t,i){this.minPrice=i.from;this.maxPrice=i.to!=="*"?i.to:"";this.changedEventHandler(t)}isChecked(t){if(!this.minPrice&&!this.maxPrice){return false}let i=(t.from<1||t.from=="*")&&this.minPrice==0||t.from==this.minPrice;let s=t.to=="*"||!t.to||t.to==this.maxPrice;return i&&s}handleMinPrice(t){this.isMin=true;const i=t.target.value;this.minPrice=i}handleMaxPrice(t){this.isMin=false;const i=t.target.value;this.maxPrice=i}render(){return s(e,null,this.filterValues.map(((t,i)=>s("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${i}`},s("input",{id:`${this.option.key}-${i}`,name:"price",type:"radio",checked:this.isChecked(t),class:"s-filters-radio",onChange:i=>this.handleMinMaxPrice(i,t)}),this.getPriceLabel(t)))),s("div",{class:"flex justify-center items-center"},s("div",{class:"relative max-w-xl w-full"},s("div",{class:"s-price-range-inputs"},s("div",{class:"s-price-range-relative"},s("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{type:"number",maxlength:"5",ref:t=>this.minInput=t,onBlur:t=>this.handleMinPrice(t),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),s("div",{class:"s-price-range-gray-text"}," -"),s("div",{class:"s-price-range-relative"},s("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),s("input",{type:"number",maxlength:"5",ref:t=>this.maxInput=t,onBlur:t=>this.handleMaxPrice(t),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),s("salla-button",{color:"gray",shape:"icon",size:"small",fill:"outline",onClick:t=>this.changedEventHandler(t)},s("span",{innerHTML:this.isRTL?r:l}))))))}componentDidLoad(){this.isReady=true}};h.style=a;export{h as salla_price_range};
5
- //# sourceMappingURL=p-de881d07.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["sallaPriceRangeCss","SallaPriceRange","this","filterValues","salla","config","get","connectedCallback","filtersData","_a","price","minPrice","min","maxPrice","max","lang","onLoaded","moreThanLabel","getWithDefault","lessThanLabel","toLabel","fromLabel","option","values","length","chunkSize","Math","ceil","i","push","slice","reduce","final","currentValue","to","count","reset","minInput","value","maxInput","getPriceLabel","filterValue","isNaN","from","money","minInputValidation","maxInputValidation","changedEventHandler","event","helpers","inputDigitsOnly","minInputValue","maxInputValue","isMin","isReady","changed","emit","handleMinMaxPrice","isChecked","isMinEqual","isMaxEqual","handleMinPrice","target","handleMaxPrice","render","h","Host","map","index","class","htmlFor","key","id","name","type","checked","onChange","e","currency","symbol","maxlength","ref","el","onBlur","placeholder","color","shape","size","fill","onClick","innerHTML","isRTL","arrowLeft","arrowRight","componentDidLoad"],"sources":["src/components/salla-price-range/salla-price-range.scss?tag=salla-price-range","src/components/salla-price-range/salla-price-range.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n\n.rtl, [dir=\"rtl\"] {\n .rtl-range-slider {\n transform: rotateY(180deg);\n }\n\n .rtl-range-numbers{\n flex-direction: row-reverse;\n }\n\n .form-select, select{\n background-position: left 0.5rem center;\n padding-right: 12px;\n } \n\n // divide\n.menu-divide {\n li {\n &:not(:last-child) {\n &:after {\n left: 0;\n right: auto;\n }\n }\n }\n}\n}\n\ninput[type=range]::-webkit-slider-thumb {\n pointer-events: all;\n width: 24px;\n height: 24px;\n -webkit-appearance: none;\n}\n\n[type='checkbox']:checked{\n background-size: 80%;\n}","import { Component, Host, h, State, Prop, Event, Method } from '@stencil/core';\nimport { Filter, FilterValue } from \"../salla-filters/interfaces\";\nimport arrowLeft from '../../assets/svg/arrow-left.svg'\nimport arrowRight from '../../assets/svg/arrow-right.svg'\n\n\n@Component({\n tag: 'salla-price-range',\n styleUrl: 'salla-price-range.scss',\n})\nexport class SallaPriceRange {\n /**\n * Minimum price threshold value\n */\n @Prop({ mutable: true }) minPrice;\n\n /**\n * Maximum price threshold value\n */\n @Prop({ mutable: true }) maxPrice;\n\n /**\n * Product price range filter option object instance\n */\n @Prop({ reflect: true }) option: Filter;\n\n /**\n * Currently selected price filter data\n */\n @Prop({ reflect: true }) filtersData: any;\n\n\n @State() min = 0;\n @State() max = 10000;\n @State() priceOptions: any;\n @State() moreThanLabel: string = \"أكثر من\";\n @State() lessThanLabel: string = \"أقل من\";\n @State() toLabel: string = \"الى\";\n @State() fromLabel: string = \"من\";\n @State() typing: boolean = false;\n @State() isMin: boolean = false;\n @State() isRTL: Boolean = salla.config.get('theme.is_rtl', true);\n\n\n /**\n * Custome event emitted when there is a change in price input.\n */\n @Event() changed: any;\n\n isReady: Boolean;\n minInput: HTMLInputElement;\n maxInput: HTMLInputElement;\n filterValues: Array<FilterValue> = [];\n\n\n connectedCallback() {\n if (this.filtersData && this.filtersData?.price) {\n this.minPrice = this.filtersData.price.min;\n this.maxPrice = this.filtersData.price.max;\n }\n salla.lang.onLoaded(() => {\n this.moreThanLabel = salla.lang.getWithDefault('common.elements.more_than', this.moreThanLabel)\n this.lessThanLabel = salla.lang.getWithDefault('common.elements.less_than', this.lessThanLabel)\n this.toLabel = salla.lang.getWithDefault('common.elements.to', this.toLabel)\n this.fromLabel = salla.lang.getWithDefault('common.elements.from', this.fromLabel)\n })\n\n //no need to show one option only\n if (this.option.values.length == 1) {\n return;\n }\n //here we may receive too many prices, we will group all inputs to\n if (this.option.values.length <= 5) {\n this.filterValues = this.option.values;\n return;\n }\n const chunkSize = Math.ceil(this.option.values.length / 5);\n for (let i = 0; i < this.option.values.length; i += chunkSize) {\n this.filterValues.push(\n this.option.values\n .slice(i, i + chunkSize)\n .reduce((final: FilterValue, currentValue: FilterValue) => {\n final.to = currentValue.to;\n final.count += currentValue.count;\n return final;\n })\n );\n // do whatever\n }\n }\n\n /**\n * reset the price range inputs\n */\n @Method()\n async reset() {\n //@ts-ignore\n this.minInput.value = null;\n this.maxInput.value = null;\n }\n\n private getPriceLabel(filterValue: FilterValue) {\n // @ts-ignore\n if (isNaN(filterValue.from) || filterValue.from < 1) {\n return `${this.lessThanLabel} ${salla.money(filterValue.to)}`;\n }\n // @ts-ignore\n if (isNaN(filterValue.to) || filterValue.to < 1) {\n return `${this.moreThanLabel} ${salla.money(filterValue.from)}`;\n }\n\n return `${salla.money(filterValue.from)} ${this.toLabel} ${salla.money(filterValue.to)}`;\n }\n\n minInputValidation(value) {\n if (value && (value > this.max || (this.maxPrice && value > this.maxPrice))) {\n // this.minPrice = this.maxPrice;\n return;\n }\n\n if (value < this.min) {\n this.minPrice = this.min;\n return;\n }\n\n if (value) {\n this.minPrice = value;\n }\n }\n\n maxInputValidation(value) {\n if (value && (value < this.min || (this.minPrice && value < this.minPrice))) {\n // this.maxPrice = this.minPrice;\n return;\n }\n if (value > this.max) {\n this.maxPrice = this.max;\n return;\n }\n }\n\n private async changedEventHandler(event) {\n\n salla.helpers.inputDigitsOnly(this.minInput)\n salla.helpers.inputDigitsOnly(this.maxInput)\n\n const minInputValue = this.minPrice ? +this.minPrice * 1 : \"\"\n const maxInputValue = this.maxPrice ? +this.maxPrice * 1 : \"\"\n\n if (this.isMin) {\n if (!this.maxPrice) {\n this.maxPrice = '';\n }\n this.minInputValidation(minInputValue);\n } else {\n if (!this.minPrice) {\n this.minPrice = 0;\n }\n this.maxInputValidation(maxInputValue)\n }\n\n this.isReady && this.changed.emit({\n event: event,\n option: this.option,\n value: { max: this.maxPrice, min: this.minPrice }\n })\n }\n private handleMinMaxPrice(event: Event, value: FilterValue): void {\n //todo:: cover when from is star\n this.minPrice = value.from;\n this.maxPrice = value.to !== '*' ? value.to : \"\";\n\n this.changedEventHandler(event);\n }\n\n\n\n private isChecked(filterValue: FilterValue) {\n if (!this.minPrice && !this.maxPrice) {\n return false;\n }\n\n //1 filterValue.from zero or * and this.minPrice not set or zero\n //2 filterValue.from == this.minPrice\n //@ts-ignore\n let isMinEqual = ((filterValue.from < 1 || filterValue.from == '*') && this.minPrice == 0) || filterValue.from == this.minPrice;\n\n //1 filterValue.to == \"*\" or null\n //2 filterValue.to == this.max\n let isMaxEqual = filterValue.to == '*' || !filterValue.to || filterValue.to == this.maxPrice;\n return isMinEqual && isMaxEqual;\n }\n\n private handleMinPrice(event: Event) {\n this.isMin = true\n const value = (event.target as HTMLInputElement).value\n this.minPrice = value\n }\n private handleMaxPrice(event: Event) {\n this.isMin = false\n const value = (event.target as HTMLInputElement).value\n this.maxPrice = value\n }\n\n\n render() {\n return (\n <Host>\n {\n this.filterValues.map((filterValue: FilterValue, index: number) => {\n\n return <label class=\"s-filters-label\" htmlFor={`${this.option.key}-${index}`}>\n <input\n id={`${this.option.key}-${index}`}\n name=\"price\"\n type=\"radio\"\n checked={this.isChecked(filterValue)}\n class=\"s-filters-radio\"\n onChange={e => this.handleMinMaxPrice(e, filterValue)}\n />\n {this.getPriceLabel(filterValue)}\n </label>\n })\n }\n\n\n <div class=\"flex justify-center items-center\">\n <div class=\"relative max-w-xl w-full\">\n <div class=\"s-price-range-inputs\">\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.minInput = el}\n onBlur={(e) => this.handleMinPrice(e)}\n value={this.minPrice}\n placeholder={this.fromLabel}\n class=\"s-price-range-number-input\"\n\n />\n </div>\n\n <div class=\"s-price-range-gray-text\"> -</div>\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.maxInput = el}\n onBlur={(e) => this.handleMaxPrice(e)}\n value={this.maxPrice}\n placeholder={this.toLabel}\n class=\"s-price-range-number-input\" aria-describedby=\"price-currency\" />\n </div>\n <salla-button color='gray' shape='icon' size='small' fill='outline' onClick={(event) => this.changedEventHandler(event)}>\n <span innerHTML={this.isRTL ? arrowLeft : arrowRight} />\n </salla-button>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n"],"mappings":";;;iIAAA,MAAMA,EAAqB,0nB,MCUdC,EAAe,M,0DA0C1BC,KAAAC,aAAmC,G,0GApBpB,E,SACA,I,+CAEkB,U,mBACA,S,aACN,M,eACE,K,YACF,M,WACD,M,WACAC,MAAMC,OAAOC,IAAI,eAAgB,K,CAc3D,iBAAAC,G,MACE,GAAIL,KAAKM,eAAeC,EAAAP,KAAKM,eAAW,MAAAC,SAAA,SAAAA,EAAEC,OAAO,CAC/CR,KAAKS,SAAWT,KAAKM,YAAYE,MAAME,IACvCV,KAAKW,SAAWX,KAAKM,YAAYE,MAAMI,G,CAEzCV,MAAMW,KAAKC,UAAS,KAClBd,KAAKe,cAAgBb,MAAMW,KAAKG,eAAe,4BAA6BhB,KAAKe,eACjFf,K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GAAM3E,KAAK6D,eAAec,GACnCvC,MAAOpC,KAAKW,SACZuE,YAAalF,KAAKkB,QAClBiD,MAAM,6BAA4B,mBAAkB,oBAExDJ,EAAA,gBAAcoB,MAAM,OAAOC,MAAM,OAAOC,KAAK,QAAQC,KAAK,UAAUC,QAAUzC,GAAU9C,KAAK6C,oBAAoBC,IAC/GiB,EAAA,QAAMyB,UAAWxF,KAAKyF,MAAQC,EAAYC,Q,CASxD,gBAAAC,GACE5F,KAAKoD,QAAU,I"}
@@ -1,5 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,a){function s(t){try{o(n.next(t))}catch(t){a(t)}}function l(t){try{o(n["throw"](t))}catch(t){a(t)}}function o(t){t.done?i(t.value):r(t.value).then(s,l)}o((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,r,a,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(t){return function(e){return o([t,e])}}function o(l){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,l[0]&&(i=0)),i)try{if(n=1,r&&(a=l[0]&2?r["return"]:l[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;if(r=0,a)l=[l[0]&2,a.value];switch(l[0]){case 0:case 1:a=l;break;case 4:i.label++;return{value:l[1],done:false};case 5:i.label++;r=l[1];l=[0];continue;case 7:l=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){i.label=l[1];break}if(l[0]===6&&i.label<a[1]){i.label=a[1];a=l;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(l);break}if(a[2])i.ops.pop();i.trys.pop();continue}l=e.call(t,i)}catch(t){l=[6,t];r=0}finally{n=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};
2
- /*!
3
- * Crafted with ❤ by Salla
4
- */System.register(["./p-a0dabf35.system.js","./p-910b705d.system.js","./p-77c16d35.system.js"],(function(t){"use strict";var e,i,n,r,a,s;return{setters:[function(t){e=t.r;i=t.c;n=t.h;r=t.H},function(t){a=t.a},function(t){s=t.a}],execute:function(){var l=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";var o=t("salla_price_range",function(){function t(t){e(this,t);this.changed=i(this,"changed",7);this.filterValues=[];this.minPrice=undefined;this.maxPrice=undefined;this.option=undefined;this.filtersData=undefined;this.min=0;this.max=1e4;this.priceOptions=undefined;this.moreThanLabel="أكثر من";this.lessThanLabel="أقل من";this.toLabel="الى";this.fromLabel="من";this.typing=false;this.isMin=false;this.isRTL=salla.config.get("theme.is_rtl",true)}t.prototype.connectedCallback=function(){var t=this;var e;if(this.filtersData&&((e=this.filtersData)===null||e===void 0?void 0:e.price)){this.minPrice=this.filtersData.price.min;this.maxPrice=this.filtersData.price.max}salla.lang.onLoaded((function(){t.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",t.moreThanLabel);t.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",t.lessThanLabel);t.toLabel=salla.lang.getWithDefault("common.elements.to",t.toLabel);t.fromLabel=salla.lang.getWithDefault("common.elements.from",t.fromLabel)}));if(this.option.values.length==1){return}if(this.option.values.length<=5){this.filterValues=this.option.values;return}var i=Math.ceil(this.option.values.length/5);for(var n=0;n<this.option.values.length;n+=i){this.filterValues.push(this.option.values.slice(n,n+i).reduce((function(t,e){t.to=e.to;t.count+=e.count;return t})))}};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.minInput.value=null;this.maxInput.value=null;return[2]}))}))};t.prototype.getPriceLabel=function(t){if(isNaN(t.from)||t.from<1){return"".concat(this.lessThanLabel," ").concat(salla.money(t.to))}if(isNaN(t.to)||t.to<1){return"".concat(this.moreThanLabel," ").concat(salla.money(t.from))}return"".concat(salla.money(t.from)," ").concat(this.toLabel," ").concat(salla.money(t.to))};t.prototype.minInputValidation=function(t){if(t&&(t>this.max||this.maxPrice&&t>this.maxPrice)){return}if(t<this.min){this.minPrice=this.min;return}if(t){this.minPrice=t}};t.prototype.maxInputValidation=function(t){if(t&&(t<this.min||this.minPrice&&t<this.minPrice)){return}if(t>this.max){this.maxPrice=this.max;return}};t.prototype.changedEventHandler=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){salla.helpers.inputDigitsOnly(this.minInput);salla.helpers.inputDigitsOnly(this.maxInput);e=this.minPrice?+this.minPrice*1:"";i=this.maxPrice?+this.maxPrice*1:"";if(this.isMin){if(!this.maxPrice){this.maxPrice=""}this.minInputValidation(e)}else{if(!this.minPrice){this.minPrice=0}this.maxInputValidation(i)}this.isReady&&this.changed.emit({event:t,option:this.option,value:{max:this.maxPrice,min:this.minPrice}});return[2]}))}))};t.prototype.handleMinMaxPrice=function(t,e){this.minPrice=e.from;this.maxPrice=e.to!=="*"?e.to:"";this.changedEventHandler(t)};t.prototype.isChecked=function(t){if(!this.minPrice&&!this.maxPrice){return false}var e=(t.from<1||t.from=="*")&&this.minPrice==0||t.from==this.minPrice;var i=t.to=="*"||!t.to||t.to==this.maxPrice;return e&&i};t.prototype.handleMinPrice=function(t){this.isMin=true;var e=t.target.value;this.minPrice=e};t.prototype.handleMaxPrice=function(t){this.isMin=false;var e=t.target.value;this.maxPrice=e};t.prototype.render=function(){var t=this;return n(r,null,this.filterValues.map((function(e,i){return n("label",{class:"s-filters-label",htmlFor:"".concat(t.option.key,"-").concat(i)},n("input",{id:"".concat(t.option.key,"-").concat(i),name:"price",type:"radio",checked:t.isChecked(e),class:"s-filters-radio",onChange:function(i){return t.handleMinMaxPrice(i,e)}}),t.getPriceLabel(e))})),n("div",{class:"flex justify-center items-center"},n("div",{class:"relative max-w-xl w-full"},n("div",{class:"s-price-range-inputs"},n("div",{class:"s-price-range-relative"},n("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),n("input",{type:"number",maxlength:"5",ref:function(e){return t.minInput=e},onBlur:function(e){return t.handleMinPrice(e)},value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),n("div",{class:"s-price-range-gray-text"}," -"),n("div",{class:"s-price-range-relative"},n("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),n("input",{type:"number",maxlength:"5",ref:function(e){return t.maxInput=e},onBlur:function(e){return t.handleMaxPrice(e)},value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),n("salla-button",{color:"gray",shape:"icon",size:"small",fill:"outline",onClick:function(e){return t.changedEventHandler(e)}},n("span",{innerHTML:this.isRTL?a:s}))))))};t.prototype.componentDidLoad=function(){this.isReady=true};return t}());o.style=l}}}));
5
- //# sourceMappingURL=p-f53461d7.system.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["sallaPriceRangeCss","SallaPriceRange","exports","this","filterValues","salla","config","get","class_1","prototype","connectedCallback","_this","filtersData","_a","price","minPrice","min","maxPrice","max","lang","onLoaded","moreThanLabel","getWithDefault","lessThanLabel","toLabel","fromLabel","option","values","length","chunkSize","Math","ceil","i","push","slice","reduce","final","currentValue","to","count","reset","minInput","value","maxInput","getPriceLabel","filterValue","isNaN","from","concat","money","minInputValidation","maxInputValidation","changedEventHandler","event","helpers","inputDigitsOnly","minInputValue","maxInputValue","isMin","isReady","changed","emit","handleMinMaxPrice","isChecked","isMinEqual","isMaxEqual","handleMinPrice","target","handleMaxPrice","render","h","Host","map","index","class","htmlFor","key","id","name","type","checked","onChange","e","currency","symbol","maxlength","ref","el","onBlur","placeholder","color","shape","size","fill","onClick","innerHTML","isRTL","arrowLeft","arrowRight","componentDidLoad"],"sources":["src/components/salla-price-range/salla-price-range.scss?tag=salla-price-range","src/components/salla-price-range/salla-price-range.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n\n.rtl, [dir=\"rtl\"] {\n .rtl-range-slider {\n transform: rotateY(180deg);\n }\n\n .rtl-range-numbers{\n flex-direction: row-reverse;\n }\n\n .form-select, select{\n background-position: left 0.5rem center;\n padding-right: 12px;\n } \n\n // divide\n.menu-divide {\n li {\n &:not(:last-child) {\n &:after {\n left: 0;\n right: auto;\n }\n }\n }\n}\n}\n\ninput[type=range]::-webkit-slider-thumb {\n pointer-events: all;\n width: 24px;\n height: 24px;\n -webkit-appearance: none;\n}\n\n[type='checkbox']:checked{\n background-size: 80%;\n}","import { Component, Host, h, State, Prop, Event, Method } from '@stencil/core';\nimport { Filter, FilterValue } from \"../salla-filters/interfaces\";\nimport arrowLeft from '../../assets/svg/arrow-left.svg'\nimport arrowRight from '../../assets/svg/arrow-right.svg'\n\n\n@Component({\n tag: 'salla-price-range',\n styleUrl: 'salla-price-range.scss',\n})\nexport class SallaPriceRange {\n /**\n * Minimum price threshold value\n */\n @Prop({ mutable: true }) minPrice;\n\n /**\n * Maximum price threshold value\n */\n @Prop({ mutable: true }) maxPrice;\n\n /**\n * Product price range filter option object instance\n */\n @Prop({ reflect: true }) option: Filter;\n\n /**\n * Currently selected price filter data\n */\n @Prop({ reflect: true }) filtersData: any;\n\n\n @State() min = 0;\n @State() max = 10000;\n @State() priceOptions: any;\n @State() moreThanLabel: string = \"أكثر من\";\n @State() lessThanLabel: string = \"أقل من\";\n @State() toLabel: string = \"الى\";\n @State() fromLabel: string = \"من\";\n @State() typing: boolean = false;\n @State() isMin: boolean = false;\n @State() isRTL: Boolean = salla.config.get('theme.is_rtl', true);\n\n\n /**\n * Custome event emitted when there is a change in price input.\n */\n @Event() changed: any;\n\n isReady: Boolean;\n minInput: HTMLInputElement;\n maxInput: HTMLInputElement;\n filterValues: Array<FilterValue> = [];\n\n\n connectedCallback() {\n if (this.filtersData && this.filtersData?.price) {\n this.minPrice = this.filtersData.price.min;\n this.maxPrice = this.filtersData.price.max;\n }\n salla.lang.onLoaded(() => {\n this.moreThanLabel = salla.lang.getWithDefault('common.elements.more_than', this.moreThanLabel)\n this.lessThanLabel = salla.lang.getWithDefault('common.elements.less_than', this.lessThanLabel)\n this.toLabel = salla.lang.getWithDefault('common.elements.to', this.toLabel)\n this.fromLabel = salla.lang.getWithDefault('common.elements.from', this.fromLabel)\n })\n\n //no need to show one option only\n if (this.option.values.length == 1) {\n return;\n }\n //here we may receive too many prices, we will group all inputs to\n if (this.option.values.length <= 5) {\n this.filterValues = this.option.values;\n return;\n }\n const chunkSize = Math.ceil(this.option.values.length / 5);\n for (let i = 0; i < this.option.values.length; i += chunkSize) {\n this.filterValues.push(\n this.option.values\n .slice(i, i + chunkSize)\n .reduce((final: FilterValue, currentValue: FilterValue) => {\n final.to = currentValue.to;\n final.count += currentValue.count;\n return final;\n })\n );\n // do whatever\n }\n }\n\n /**\n * reset the price range inputs\n */\n @Method()\n async reset() {\n //@ts-ignore\n this.minInput.value = null;\n this.maxInput.value = null;\n }\n\n private getPriceLabel(filterValue: FilterValue) {\n // @ts-ignore\n if (isNaN(filterValue.from) || filterValue.from < 1) {\n return `${this.lessThanLabel} ${salla.money(filterValue.to)}`;\n }\n // @ts-ignore\n if (isNaN(filterValue.to) || filterValue.to < 1) {\n return `${this.moreThanLabel} ${salla.money(filterValue.from)}`;\n }\n\n return `${salla.money(filterValue.from)} ${this.toLabel} ${salla.money(filterValue.to)}`;\n }\n\n minInputValidation(value) {\n if (value && (value > this.max || (this.maxPrice && value > this.maxPrice))) {\n // this.minPrice = this.maxPrice;\n return;\n }\n\n if (value < this.min) {\n this.minPrice = this.min;\n return;\n }\n\n if (value) {\n this.minPrice = value;\n }\n }\n\n maxInputValidation(value) {\n if (value && (value < this.min || (this.minPrice && value < this.minPrice))) {\n // this.maxPrice = this.minPrice;\n return;\n }\n if (value > this.max) {\n this.maxPrice = this.max;\n return;\n }\n }\n\n private async changedEventHandler(event) {\n\n salla.helpers.inputDigitsOnly(this.minInput)\n salla.helpers.inputDigitsOnly(this.maxInput)\n\n const minInputValue = this.minPrice ? +this.minPrice * 1 : \"\"\n const maxInputValue = this.maxPrice ? +this.maxPrice * 1 : \"\"\n\n if (this.isMin) {\n if (!this.maxPrice) {\n this.maxPrice = '';\n }\n this.minInputValidation(minInputValue);\n } else {\n if (!this.minPrice) {\n this.minPrice = 0;\n }\n this.maxInputValidation(maxInputValue)\n }\n\n this.isReady && this.changed.emit({\n event: event,\n option: this.option,\n value: { max: this.maxPrice, min: this.minPrice }\n })\n }\n private handleMinMaxPrice(event: Event, value: FilterValue): void {\n //todo:: cover when from is star\n this.minPrice = value.from;\n this.maxPrice = value.to !== '*' ? value.to : \"\";\n\n this.changedEventHandler(event);\n }\n\n\n\n private isChecked(filterValue: FilterValue) {\n if (!this.minPrice && !this.maxPrice) {\n return false;\n }\n\n //1 filterValue.from zero or * and this.minPrice not set or zero\n //2 filterValue.from == this.minPrice\n //@ts-ignore\n let isMinEqual = ((filterValue.from < 1 || filterValue.from == '*') && this.minPrice == 0) || filterValue.from == this.minPrice;\n\n //1 filterValue.to == \"*\" or null\n //2 filterValue.to == this.max\n let isMaxEqual = filterValue.to == '*' || !filterValue.to || filterValue.to == this.maxPrice;\n return isMinEqual && isMaxEqual;\n }\n\n private handleMinPrice(event: Event) {\n this.isMin = true\n const value = (event.target as HTMLInputElement).value\n this.minPrice = value\n }\n private handleMaxPrice(event: Event) {\n this.isMin = false\n const value = (event.target as HTMLInputElement).value\n this.maxPrice = value\n }\n\n\n render() {\n return (\n <Host>\n {\n this.filterValues.map((filterValue: FilterValue, index: number) => {\n\n return <label class=\"s-filters-label\" htmlFor={`${this.option.key}-${index}`}>\n <input\n id={`${this.option.key}-${index}`}\n name=\"price\"\n type=\"radio\"\n checked={this.isChecked(filterValue)}\n class=\"s-filters-radio\"\n onChange={e => this.handleMinMaxPrice(e, filterValue)}\n />\n {this.getPriceLabel(filterValue)}\n </label>\n })\n }\n\n\n <div class=\"flex justify-center items-center\">\n <div class=\"relative max-w-xl w-full\">\n <div class=\"s-price-range-inputs\">\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.minInput = el}\n onBlur={(e) => this.handleMinPrice(e)}\n value={this.minPrice}\n placeholder={this.fromLabel}\n class=\"s-price-range-number-input\"\n\n />\n </div>\n\n <div class=\"s-price-range-gray-text\"> -</div>\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.maxInput = el}\n onBlur={(e) => this.handleMaxPrice(e)}\n value={this.maxPrice}\n placeholder={this.toLabel}\n class=\"s-price-range-number-input\" aria-describedby=\"price-currency\" />\n </div>\n <salla-button color='gray' shape='icon' size='small' fill='outline' onClick={(event) => this.changedEventHandler(event)}>\n <span innerHTML={this.isRTL ? arrowLeft : arrowRight} />\n </salla-button>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n"],"mappings":";;;yPAAA,IAAMA,EAAqB,0nB,ICUdC,EAAeC,EAAA,+B,yDA0C1BC,KAAAC,aAAmC,G,0GApBpB,E,SACA,I,+CAEkB,U,mBACA,S,aACN,M,eACE,K,YACF,M,WACD,M,WACAC,MAAMC,OAAOC,IAAI,eAAgB,K,C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,kBAAkBoB,EAAGrC,EAA1B,IAEhBlC,EAAKiC,cAAcC,G,IAM1ByB,EAAA,OAAKI,MAAM,oCACTJ,EAAA,OAAKI,MAAM,4BACTJ,EAAA,OAAKI,MAAM,wBACTJ,EAAA,OAAKI,MAAM,0BACTJ,EAAA,OAAKI,MAAM,0BAAwB,IAAGrE,MAAMC,OAAO6E,WAAWC,QAC9Dd,EAAA,SACES,KAAK,SACLM,UAAU,IACVC,IAAK,SAAAC,GAAM,OAAA5E,EAAK8B,SAAW8C,CAAhB,EACXC,OAAQ,SAACN,GAAM,OAAAvE,EAAKuD,eAAegB,EAApB,EACfxC,MAAOvC,KAAKY,SACZ0E,YAAatF,KAAKsB,UAClBiD,MAAM,gCAKVJ,EAAA,OAAKI,MAAM,2BAAyB,MACpCJ,EAAA,OAAKI,MAAM,0BACTJ,EAAA,OAAKI,MAAM,0BAAwB,IAAGrE,MAAMC,OAAO6E,WAAWC,QAC9Dd,EAAA,SACES,KAAK,SACLM,UAAU,IACVC,IAAK,SAAAC,GAAM,OAAA5E,EAAKgC,SAAW4C,CAAhB,EACXC,OAAQ,SAACN,GAAM,OAAAvE,EAAKyD,eAAec,EAApB,EACfxC,MAAOvC,KAAKc,SACZwE,YAAatF,KAAKqB,QAClBkD,MAAM,6BAA4B,mBAAkB,oBAExDJ,EAAA,gBAAcoB,MAAM,OAAOC,MAAM,OAAOC,KAAK,QAAQC,KAAK,UAAUC,QAAS,SAACzC,GAAU,OAAA1C,EAAKyC,oBAAoBC,EAAzB,GACtFiB,EAAA,QAAMyB,UAAW5F,KAAK6F,MAAQC,EAAYC,Q,EASxD1F,EAAAC,UAAA0F,iBAAA,WACEhG,KAAKwD,QAAU,I,WAhQS,I"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["sallaFiltersCss","SallaFilters","exports","class_1","hostRef","_this","this","isReady","salla","event","on","host","style","display","lang","onLoaded","apply","get","reset","_c","filters","freshFilterData","map","filter","label","category_id","brand_id","rating","price","key","type","FilterOptionTypes","VALUES","values","max_1","max","min_1","min","stars","filtersData","variants","VARIANTS","searchParams","URLSearchParams","window","location","search","hasFilters","_i","_d","keys","length","includes","config","Object","currentUrl","href","filterValue","separator","indexOf","newUrl","history","pushState","path","childNodes","forEach","widget","__awaiter","__generator","setWidgetHeight","sent","prototype","componentWillLoad","Helper","extractFiltersFromUrl","console","warn","e_1","message","getFilters","applyFilters","setTimeout","url","URL","entries","startsWith","delete","encodedFilterValues","encodeFilters","sanitizedFilterValues","split","item","join","concat","_a","toString","emit","changed","parentKey","encodedFilters","hasOwnProperty","call","value","fullKey","Array","isArray","i","push","result","resetFilters","removeFiltersQueryParams","from","encodeURIComponent","finalUrl","pathname","handleOptionChange","option","RANGE","isChecked","target","checked","val","render","h","Host","onChanged","detail","_b","class","color","fill","onClick","componentDidLoad"],"sources":["src/components/salla-filters/salla-filters.scss?tag=salla-filters","src/components/salla-filters/salla-filters.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.s-rating-stars-small {\n line-height: 12px;\n}\n.s-filters-radio{\n background-image: none !important;\n}","import { Component, Element, h, Event, EventEmitter, Host, Method, Prop, State } from '@stencil/core';\nimport { Filter, FilterOptionTypes } from \"./interfaces\";\nimport Helper from '../../Helpers/Helper';\n@Component({\n tag: 'salla-filters',\n styleUrl: 'salla-filters.scss',\n})\nexport class SallaFilters {\n\n constructor() {\n salla.event.on('filters::hidden', () => this.host.style.display = 'none');\n\n salla.lang.onLoaded(() => {\n this.apply = salla.lang.get('pages.checkout.apply');\n this.reset = salla.lang.get('pages.categories.filters_reset');\n });\n\n salla.event.on('filters::fetched', ({ filters }) => {\n this.host.style.display = '';\n let freshFilterData: any = {};\n this.filters = filters\n .map((filter: Filter) => {\n filter.label = {\n category_id: salla.lang.get('common.titles.categories'),\n brand_id: salla.lang.get('common.titles.brands'),\n rating: salla.lang.get('pages.categories.filter_rating'),\n price: salla.lang.get('pages.categories.filter_price'),\n }[filter.key] || filter.label;\n // filter.type = FilterOptionTypes.VALUES;\n if (filter.key == 'rating') {\n filter.type = FilterOptionTypes.VALUES;\n //@ts-ignore\n let { max, min } = filter.values;\n //@ts-ignore\n filter.values = [5, 4, 3, 2, 1].filter(stars => stars >= min || stars <= max)\n }\n if (this.filtersData.variants && filter.type == FilterOptionTypes.VARIANTS) {\n freshFilterData.variants = this.filtersData.variants;\n }\n if (this.filtersData[filter.key] && filter.type !== FilterOptionTypes.VARIANTS) {\n freshFilterData[filter.key] = this.filtersData[filter.key];\n }\n let searchParams = new URLSearchParams(window.location.search);\n let hasFilters = false;\n for (let key of searchParams.keys()) {\n if (key.includes('filters')) {\n hasFilters = true;\n break; // No need to continue checking once a match is found\n }\n }\n if (salla.config.get('page.slug') == \"product.index\" && Object.keys(freshFilterData).length == 0 && !hasFilters) {\n // Append the current category to the url if there are no pre-selected filters\n let currentUrl = window.location.href;\n let filterValue = salla.config.get('page.id');\n let separator = currentUrl.indexOf('?') !== -1 ? '&' : '?';\n let newUrl = currentUrl + separator + 'filters[category_id]=' + filterValue;\n freshFilterData.category_id = filterValue;\n window.history.pushState({ path: newUrl }, '', newUrl);\n }\n return filter;\n });\n this.filtersData = freshFilterData;\n this.host.childNodes.forEach(async (widget: HTMLSallaFiltersWidgetElement) => widget.setWidgetHeight && await widget.setWidgetHeight())\n });\n }\n\n async componentWillLoad() {\n try {\n const searchParams = new URLSearchParams(window.location.search);\n this.filtersData = await Helper.extractFiltersFromUrl(searchParams);\n } catch (e) {\n console.warn('failed to get filters from URL', e.message);\n }\n }\n\n\n @Element() host: HTMLElement;\n\n /**\n * Array of filter options\n */\n @Prop({ reflect: true, mutable: true }) filters?: Filter[];\n\n private isReady = false;//to avoid triggering the changed event\n\n @State() isSidebarOpen: boolean;\n @State() filtersData: object | any = {}\n @State() apply: string;\n @State() reset: string;\n\n /**\n * Custom event fired when the selected filters are changed.\n */\n @Event() changed: EventEmitter;\n\n /**\n * Method to get filter data.\n */\n @Method()\n async getFilters() {\n return this.filtersData;\n }\n\n /**\n * Apply filter action.\n */\n @Method()\n async applyFilters() {\n if (!this.isReady) {\n return;\n }\n let hasFilters = Object.keys(this.filtersData).length > 0;\n setTimeout(() => {\n if (hasFilters) {\n let url = new URL(window.location.href);\n for (const [key] of url.searchParams.entries()) {\n if (key.startsWith(\"filters\")) {\n url.searchParams.delete(key);\n }\n }\n let encodedFilterValues = this.encodeFilters(this.filtersData)\n let sanitizedFilterValues = url.search.split(\"&\").filter(item => !item.includes('filters')).join(\"&\")\n if (!!sanitizedFilterValues) {\n url.search = url.search.split(\"&filters\")[0] + \"&\" + encodedFilterValues\n } else {\n url.search = `?${encodedFilterValues}`\n }\n window.history.pushState({}, '', url.href);\n }\n else {\n let url = new URL(window.location.href);\n url.searchParams?.delete('filters');\n window.history.pushState({}, '', url.toString());\n }\n salla.event.emit('salla-filters::changed', this.filtersData);\n this.changed.emit(this.filtersData);\n }, 300);\n }\n\n\n private encodeFilters(filters, parentKey = 'filters') {\n const encodedFilters = [];\n\n for (const key in filters) {\n if (Object.prototype.hasOwnProperty.call(filters, key)) {\n const value = filters[key];\n\n const fullKey = parentKey ? `${parentKey}[${key}]` : key;\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n encodedFilters.push(`${fullKey}[${i}]=${value[i]}`)\n }\n }\n else if (typeof value === 'object' && value !== null) {\n encodedFilters.push(this.encodeFilters(value, fullKey));\n } else {\n // const encodedKey = encodeURIComponent(fullKey);\n // const encodedValue = encodeURIComponent(value);\n let result = `${fullKey}=${value}`\n encodedFilters.push(result);\n }\n }\n }\n return encodedFilters.join('&');\n };\n\n /**\n * Reset selected filters.\n */\n @Method()\n async resetFilters() {\n this.removeFiltersQueryParams()\n this.filtersData = {};\n this.host.childNodes.forEach((widget: HTMLSallaFiltersWidgetElement) => widget.reset && widget.reset())\n salla.event.emit('salla-filters::reset');\n return this.applyFilters();\n }\n\n private removeFiltersQueryParams() {\n const searchParams = new URLSearchParams(window.location.search);\n\n const newUrl = Array.from(searchParams.keys())\n .filter(key => !key.startsWith('filters['))\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(searchParams.get(key))}`)\n .join('&');\n\n const finalUrl = newUrl ? `${window.location.pathname}?${newUrl}` : window.location.pathname;\n window.history.pushState({}, '', finalUrl);\n }\n\n /**\n * @param {{target:HTMLInputElement}} event\n * @param option\n * @param value\n * @private\n */\n private handleOptionChange(event, option: Filter, value) {\n if (option.type === FilterOptionTypes.RANGE) {\n this.filtersData[option.key] = value;\n\n }\n let isChecked = event.target.checked;\n\n if (option.type === FilterOptionTypes.VARIANTS) {\n this.filtersData.variants = this.filtersData.variants || {};\n isChecked && (this.filtersData.variants[option.key] = value);\n isChecked || (delete this.filtersData.variants[option.key]);\n }\n\n else if (event.target.type == \"radio\") {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n }\n\n //it's checkbox\n // add if condition to avoid error when the filter is not existed in the filtersData\n else if (event.target.type == \"checkbox\") {\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n this.applyFilters();\n }\n\n\n\n render() {\n return <Host>\n {this.filters?.map(option => <salla-filters-widget\n option={option}\n filtersData={this.filtersData}\n onChanged={({ detail: { event, option, value } }) => {\n this.handleOptionChange(event, option, value)\n }} />)}\n\n {this.filters?.length ? <div class=\"s-filters-footer\">\n {/* <salla-button color='primary' onClick={() => this.applyFilters()}>{this.apply}</salla-button> */}\n <salla-button color='gray' fill='outline' onClick={() => this.resetFilters()}>{this.reset}</salla-button>\n </div> : ''}\n </Host>;\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n\n"],"mappings":";;;uSAAA,IAAMA,EAAkB,gH,ICOXC,EAAYC,EAAA,2BAEvB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,2CA0EQA,KAAAC,QAAU,M,qEAGmB,G,0CA5EnCC,MAAMC,MAAMC,GAAG,mBAAmB,WAAM,O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