@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 +1 @@
1
- {"version":3,"file":"salla-tel-input.js","sourceRoot":"","sources":["../../../src/components/salla-tel-input/salla-tel-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAKtC,MAAM,OAAO,aAAa;EACxB;;;gBAwBuB,OAAO;uBAIiB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,IAAI,IAAI;;4BAU9D,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC;uBAC1C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC;oBAC3C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;mBAC3E,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;8BAC9D,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;yBACxF,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjF,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,QA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E,CAAC,IAAI,CAAC,gBAAgB,GAAG,EAAE,EACrG,KAAK,EAAC,cAAc,GAAG,CACpB,CACR,CAAC;EACJ,CAAC;EAED,gBAAgB;IACd,IAAI,CAAC,YAAY,EAAE,CAAC;EACtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Element, Component, Host, h, Prop, Method, Event, EventEmitter, State } from '@stencil/core';\nimport TelInput from \"intl-tel-input\";\nimport { Phone } from './interfaces';\n\n@Component({ tag: 'salla-tel-input', styleUrl: 'salla-tel-input.scss' })\n\nexport class SallaTelInput {\n constructor() {\n salla.lang.onLoaded(() => {\n this.mobileLabel = salla.lang.get('common.elements.mobile');\n this.countryCodeLabel = salla.lang.get('common.elements.country_code');\n this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });\n this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });\n this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });\n this.tooLong = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });\n this.mobileRequired = salla.lang.get('common.errors.field_required', { attribute: this.mobileLabel });\n this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];\n });\n }\n\n /**\n * Current mobile number\n */\n @Prop({ mutable: true }) phone: string;\n /**\n * Automatically focus telephone input\n */\n @Prop({ reflect:true }) autofocus: boolean;\n /**\n * input name\n */\n @Prop() name: string = 'phone';\n /**\n * Current country_code\n */\n @Prop({ mutable: true }) countryCode: string = salla.config.get('user.country_code', 'SA') || 'SA';\n\n /**\n * Event emmitted when user enters a phone number.\n */\n @Event() phoneEntered: EventEmitter<Phone>;\n\n\n @Element() host: HTMLElement;\n @State() mobileRequired: string;\n @State() countryCodeLabel: string = salla.lang.get('common.country_code');\n @State() mobileLabel: string = salla.lang.get('common.elements.mobile');\n @State() tooShort: string = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });\n @State() tooLong: string = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });\n @State() invalidCountryCode: string = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });\n @State() invalidNumber: string = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });\n @State() errorMap: string[] = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];\n\n private phoneInput: HTMLInputElement;\n private countryCodeInput: HTMLInputElement;\n private errorMsg: any;\n private iti: any;\n\n\n /**\n * Get current values\n * @return {{mobile:number,countryCode:'SA'|string}}\n */\n @Method()\n async getValues() {\n return {\n [this.name]: this.phone = this.phoneInput.value,\n countryCode: this.countryCode = this.countryCodeInput.value,\n countryKey: (this.host.querySelector('.iti__selected-dial-code') as any).innerText\n }\n }\n\n /**\n * Is current data valid or not\n * @return {boolean}\n */\n @Method()\n async isValid() {\n this.reset();\n if (this.iti.isValidNumber()) return true;\n\n if (!this.phoneInput.value.trim()) {\n this.phoneInput.classList.add(\"s-has-error\");\n this.errorMsg.innerText = this.mobileRequired || 'The mobile is required';\n return;\n }\n\n this.phoneInput.classList.add(\"s-has-error\");\n let errorCode = this.iti.getValidationError();\n this.errorMsg.innerText = this.errorMap[errorCode] || '';\n\n salla.logger.info('Phone number (' + this.countryCode + ' - ' + this.phone + ') is not valid, error code ' + errorCode);\n return false;\n }\n\n private initTelInput() {\n salla.helpers.inputDigitsOnly(this.phoneInput);\n this.iti = TelInput(this.phoneInput, {\n initialCountry: this.countryCode || 'sa',\n preferredCountries: ['sa', 'ae', 'kw', 'bh', 'qa', 'iq', 'om', 'ye', 'eg', 'jo', 'ps', 'sd', 'lb', 'dz', 'tn', 'ma', 'ly'],\n excludeCountries: ['sy', 'ir', 'cu', 'kp'],\n formatOnDisplay: false,\n separateDialCode: true,\n autoPlaceholder: 'aggressive',\n utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.min.js',\n });\n\n this.autofocus && this.phoneInput.focus()\n\n this.phoneInput.addEventListener(\"countrychange\", () => {\n let data = this.iti.getSelectedCountryData();\n let value = data.iso2.toUpperCase();\n this.countryCodeInput.value = value\n this.countryCode = value;\n this.phoneEntered.emit({ number: this.phone, country_code: value })\n });\n\n // on blur: validate\n // this.phoneInput.addEventListener('blur', () => this.isValid());\n\n // on keyup / change flag: reset\n this.phoneInput.addEventListener('input', (e: Event) => {\n salla.helpers.inputDigitsOnly(e.target);\n this.reset();\n this.phoneEntered.emit({ number: (e.target as HTMLInputElement).value, country_code: this.countryCode })\n });\n\n }\n\n private reset() {\n this.phoneInput.classList.remove(\"s-has-error\");\n this.errorMsg.innerHTML = \"\";\n };\n\n private handleCountryInput(event) {\n if (!!this.phone) {\n this.phoneEntered.emit({ number: event.target.value, country_code: this.countryCode })\n }\n }\n\n\n render() {\n return (\n <Host class=\"s-tel-input\">\n <input type=\"tel\" name={this.name} value={this.phone} onChange={(event) => this.handleCountryInput(event)} ref={el => this.phoneInput = el}\n enterkeyhint=\"next\"\n autocomplete=\"tel\"\n class=\"s-tel-input-control tel-input s-ltr\" />\n <span class=\"s-tel-input-error-msg\" ref={el => this.errorMsg = el}/>\n <input type=\"hidden\" name=\"country_code\" value={this.countryCode} ref={el => this.countryCodeInput = el}\n class=\"country_code\" />\n </Host>\n );\n }\n\n componentDidLoad() {\n this.initTelInput();\n }\n}\n"]}
1
+ {"version":3,"file":"salla-tel-input.js","sourceRoot":"","sources":["../../../src/components/salla-tel-input/salla-tel-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,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AC,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;KACvF;EACH,CAAC;EAGD,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAC,aAAa;MACvB,aAAO,IAAI,EAAC,KAAK,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,EAAE,EACxI,YAAY,EAAC,MAAM,EACnB,YAAY,EAAC,KAAK,EAClB,KAAK,EAAC,qCAAqC,GAAG;MAC/C,YAAM,KAAK,EAAC,uBAAuB,EAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG;MACrE,aAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,cAAc,EAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,GAAG,EAAE,EACrG,KAAK,EAAC,cAAc,GAAG,CACpB,CACR,CAAC;EACJ,CAAC;EAED,gBAAgB;IACd,IAAI,CAAC,YAAY,EAAE,CAAC;EACtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Element, Component, Host, h, Prop, Method, Event, EventEmitter, State } from '@stencil/core';\nimport TelInput from \"intl-tel-input\";\nimport { Phone } from './interfaces';\n\n@Component({ tag: 'salla-tel-input', styleUrl: 'salla-tel-input.scss' })\n\nexport class SallaTelInput {\n constructor() {\n salla.lang.onLoaded(() => {\n this.mobileLabel = salla.lang.get('common.elements.mobile');\n this.countryCodeLabel = salla.lang.get('common.elements.country_code');\n this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });\n this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });\n this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });\n this.tooLong = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });\n this.mobileRequired = salla.lang.get('common.errors.field_required', { attribute: this.mobileLabel });\n this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];\n });\n }\n\n /**\n * Current mobile number\n */\n @Prop({ mutable: true }) phone: string;\n /**\n * Automatically focus telephone input\n */\n @Prop({ reflect:true }) autofocus: boolean;\n /**\n * input name\n */\n @Prop() name: string = 'phone';\n /**\n * Current country_code\n */\n @Prop({ mutable: true }) countryCode: string = salla.config.get('user.country_code', 'SA') || 'SA';\n\n /**\n * Event emmitted when user enters a phone number.\n */\n @Event() phoneEntered: EventEmitter<Phone>;\n\n\n @Element() host: HTMLElement;\n @State() mobileRequired: string;\n @State() countryCodeLabel: string = salla.lang.get('common.country_code');\n @State() mobileLabel: string = salla.lang.get('common.elements.mobile');\n @State() tooShort: string = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });\n @State() tooLong: string = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });\n @State() invalidCountryCode: string = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });\n @State() invalidNumber: string = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });\n @State() errorMap: string[] = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];\n\n private phoneInput: HTMLInputElement;\n private countryCodeInput: HTMLInputElement;\n private errorMsg: any;\n private iti: any;\n\n\n /**\n * Get current values\n * @return {{mobile:number,countryCode:'SA'|string}}\n */\n @Method()\n async getValues() {\n return {\n [this.name]: this.phone = this.phoneInput.value,\n countryCode: this.countryCode = this.countryCodeInput.value,\n countryKey: (this.host.querySelector('.iti__selected-dial-code') as any).innerText\n }\n }\n\n /**\n * Is current data valid or not\n * @return {boolean}\n */\n @Method()\n async isValid() {\n this.reset();\n if (this.iti.isValidNumber()) return true;\n\n if (!this.phoneInput.value.trim()) {\n this.phoneInput.classList.add(\"s-has-error\");\n this.errorMsg.innerText = this.mobileRequired || 'The mobile is required';\n return;\n }\n\n this.phoneInput.classList.add(\"s-has-error\");\n let errorCode = this.iti.getValidationError();\n this.errorMsg.innerText = this.errorMap[errorCode] || '';\n\n salla.logger.info('Phone number (' + this.countryCode + ' - ' + this.phone + ') is not valid, error code ' + errorCode);\n return false;\n }\n\n private initTelInput() {\n salla.helpers.inputDigitsOnly(this.phoneInput);\n this.iti = TelInput(this.phoneInput, {\n initialCountry: this.countryCode || 'sa',\n preferredCountries: ['sa', 'ae', 'kw', 'bh', 'qa', 'iq', 'om', 'ye', 'eg', 'jo', 'ps', 'sd', 'lb', 'dz', 'tn', 'ma', 'ly'],\n excludeCountries: ['sy', 'ir', 'cu', 'kp'],\n formatOnDisplay: false,\n separateDialCode: true,\n autoPlaceholder: 'aggressive',\n utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/21.2.7/js/utils.min.js',\n });\n\n this.autofocus && this.phoneInput.focus()\n\n this.phoneInput.addEventListener(\"countrychange\", () => {\n let data = this.iti.getSelectedCountryData();\n let value = data.iso2.toUpperCase();\n this.countryCodeInput.value = value\n this.countryCode = value;\n this.phoneEntered.emit({ number: this.phone, country_code: value })\n });\n\n // on blur: validate\n // this.phoneInput.addEventListener('blur', () => this.isValid());\n\n // on keyup / change flag: reset\n this.phoneInput.addEventListener('input', (e: Event) => {\n salla.helpers.inputDigitsOnly(e.target);\n this.reset();\n this.phoneEntered.emit({ number: (e.target as HTMLInputElement).value, country_code: this.countryCode })\n });\n\n }\n\n private reset() {\n this.phoneInput.classList.remove(\"s-has-error\");\n this.errorMsg.innerHTML = \"\";\n };\n\n private handleCountryInput(event) {\n if (!!this.phone) {\n this.phoneEntered.emit({ number: event.target.value, country_code: this.countryCode })\n }\n }\n\n\n render() {\n return (\n <Host class=\"s-tel-input\">\n <input type=\"tel\" name={this.name} value={this.phone} onChange={(event) => this.handleCountryInput(event)} ref={el => this.phoneInput = el}\n enterkeyhint=\"next\"\n autocomplete=\"tel\"\n class=\"s-tel-input-control tel-input s-ltr\" />\n <span class=\"s-tel-input-error-msg\" ref={el => this.errorMsg = el}/>\n <input type=\"hidden\" name=\"country_code\" value={this.countryCode} ref={el => this.countryCodeInput = el}\n class=\"country_code\" />\n </Host>\n );\n }\n\n componentDidLoad() {\n this.initTelInput();\n }\n}\n"]}