@salla.sa/twilight-components 1.4.0 → 1.4.2

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.
@@ -7,7 +7,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  const index$1 = require('./index-0d0167d5.js');
9
9
  const Helper = require('./Helper-8ae6a805.js');
10
- require('https://static.addtoany.com/menu/page.js');
11
10
 
12
11
  const sallaButtonCss = "";
13
12
 
@@ -1527,7 +1526,7 @@ var ModeType;
1527
1526
  ModeType["AVAILABILITY"] = "availability";
1528
1527
  })(ModeType || (ModeType = {}));
1529
1528
 
1530
- const sallaScopesCss = ".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-container::-webkit-scrollbar{width:5px}.s-scopes-container::-webkit-scrollbar-track{background-color:#eee}.s-scopes-container::-webkit-scrollbar-thumb{background-color:var(--color-primary);border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px}.s-scopes-placeholder{flex:0 0 85%}";
1529
+ const sallaScopesCss = ".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}";
1531
1530
 
1532
1531
  const SallaScopees = class {
1533
1532
  constructor(hostRef) {
@@ -1622,7 +1621,7 @@ const SallaScopees = class {
1622
1621
  return index$1.h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" }, index$1.h("span", { slot: "title" }, this.branchNotFound), index$1.h("span", { slot: "description" }, this.ourServiceIsNotFound));
1623
1622
  }
1624
1623
  defaultContent() {
1625
- return [index$1.h("div", { class: "s-scopes-container" }, this.scopes.map((scope) => index$1.h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, index$1.h("input", { id: `${this.position} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }), index$1.h("label", { htmlFor: this.position + '_scope_' + scope.id, class: "s-scopes-label s-scopes-clickable" }, index$1.h("span", null, scope.name))))), this.footerContent()];
1624
+ return [index$1.h("div", { class: "s-scopes-container s-scrollbar" }, this.scopes.map((scope) => index$1.h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, index$1.h("input", { id: `${this.position} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }), index$1.h("label", { htmlFor: this.position + '_scope_' + scope.id, class: "s-scopes-label s-scopes-clickable" }, index$1.h("span", null, scope.name))))), this.footerContent()];
1626
1625
  }
1627
1626
  availabilityContent() {
1628
1627
  return index$1.h("div", { class: "s-scopes-container" }, this.scopes.map((scope) => index$1.h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, index$1.h("h2", { class: { "s-scopes-label": true, "s-scopes-clickable": this.isDefault } }, index$1.h("span", null, scope.name)), index$1.h("h2", { style: { 'color': scope.availability.color }, class: `s-scopes-${scope.availability.key}` }, scope.availability.label))));
@@ -3115,15 +3114,27 @@ const SallaSocialShare = class {
3115
3114
  this.platforms = this.allPlatforms;
3116
3115
  }
3117
3116
  componentWillLoad() {
3118
- // ? this will not work if there are multiple share components on the same page, this will be applied to the first one only
3119
- window.a2a_config = window.a2a_config || {};
3120
- window.a2a_config.linkurl = this.url ? this.url : window.location.href;
3121
- window.a2a_config.linkname = this.urlName ? this.urlName : document.title;
3117
+ let that = this;
3118
+ if (!document.getElementById('a2a-script')) {
3119
+ const script = document.createElement('script');
3120
+ script.src = 'https://static.addtoany.com/menu/page.js';
3121
+ script.setAttribute('id', 'a2a-script');
3122
+ script.onload = function () {
3123
+ // ? this will not work if there is one share component in the page
3124
+ window.a2a_config = window.a2a_config || {};
3125
+ window.a2a_config.linkurl = that.url ? that.url : window.location.href;
3126
+ window.a2a_config.linkname = that.urlName ? that.urlName : document.title;
3127
+ };
3128
+ document.body.appendChild(script);
3129
+ }
3130
+ else {
3131
+ return;
3132
+ }
3122
3133
  salla.lang.onLoaded(() => {
3123
3134
  window.a2a_config.locale = salla.lang.locale;
3124
3135
  });
3125
3136
  }
3126
- open() {
3137
+ async open() {
3127
3138
  this.opened = !this.opened;
3128
3139
  if (this.opened) {
3129
3140
  this.shareMenu.classList.add('opened');
@@ -8,20 +8,6 @@
8
8
  align-items: center;
9
9
  }
10
10
 
11
- .s-scopes-container::-webkit-scrollbar {
12
- width: 5px;
13
- }
14
- .s-scopes-container::-webkit-scrollbar-track {
15
- background-color: #eee;
16
- }
17
- .s-scopes-container::-webkit-scrollbar-thumb {
18
- background-color: var(--color-primary);
19
- border-radius: 10px;
20
- -webkit-border-radius: 10px;
21
- -moz-border-radius: 10px;
22
- -ms-border-radius: 10px;
23
- -o-border-radius: 10px;
24
- }
25
11
  .s-scopes-placeholder {
26
12
  flex: 0 0 85%;
27
13
  }
@@ -99,7 +99,7 @@ export class SallaScopees {
99
99
  h("span", { slot: "description" }, this.ourServiceIsNotFound));
100
100
  }
101
101
  defaultContent() {
102
- return [h("div", { class: "s-scopes-container" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-position": this.position },
102
+ return [h("div", { class: "s-scopes-container s-scrollbar" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-position": this.position },
103
103
  h("input", { id: `${this.position} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }),
104
104
  h("label", { htmlFor: this.position + '_scope_' + scope.id, class: "s-scopes-label s-scopes-clickable" },
105
105
  h("span", null, scope.name))))), this.footerContent()];
@@ -8,7 +8,7 @@ import twitter from '../../assets/svg/twitter.svg';
8
8
  import copy_link from '../../assets/svg/link.svg';
9
9
  import email from '../../assets/svg/mail.svg';
10
10
  import whatsapp from '../../assets/svg/whatsapp.svg';
11
- import "https://static.addtoany.com/menu/page.js";
11
+ // require("https://static.addtoany.com/menu/page.js");
12
12
  import { Socials } from './interfaces';
13
13
  export class SallaSocialShare {
14
14
  constructor() {
@@ -29,15 +29,27 @@ export class SallaSocialShare {
29
29
  this.platforms = this.allPlatforms;
30
30
  }
31
31
  componentWillLoad() {
32
- // ? this will not work if there are multiple share components on the same page, this will be applied to the first one only
33
- window.a2a_config = window.a2a_config || {};
34
- window.a2a_config.linkurl = this.url ? this.url : window.location.href;
35
- window.a2a_config.linkname = this.urlName ? this.urlName : document.title;
32
+ let that = this;
33
+ if (!document.getElementById('a2a-script')) {
34
+ const script = document.createElement('script');
35
+ script.src = 'https://static.addtoany.com/menu/page.js';
36
+ script.setAttribute('id', 'a2a-script');
37
+ script.onload = function () {
38
+ // ? this will not work if there is one share component in the page
39
+ window.a2a_config = window.a2a_config || {};
40
+ window.a2a_config.linkurl = that.url ? that.url : window.location.href;
41
+ window.a2a_config.linkname = that.urlName ? that.urlName : document.title;
42
+ };
43
+ document.body.appendChild(script);
44
+ }
45
+ else {
46
+ return;
47
+ }
36
48
  salla.lang.onLoaded(() => {
37
49
  window.a2a_config.locale = salla.lang.locale;
38
50
  });
39
51
  }
40
- open() {
52
+ async open() {
41
53
  this.opened = !this.opened;
42
54
  if (this.opened) {
43
55
  this.shareMenu.classList.add('opened');
@@ -153,7 +165,11 @@ export class SallaSocialShare {
153
165
  "complexType": {
154
166
  "signature": "() => Promise<void>",
155
167
  "parameters": [],
156
- "references": {},
168
+ "references": {
169
+ "Promise": {
170
+ "location": "global"
171
+ }
172
+ },
157
173
  "return": "Promise<void>"
158
174
  },
159
175
  "docs": {
@@ -11,6 +11,7 @@ var utilities = {
11
11
  '.s-input' : {'@apply appearance-none form-input': {}},
12
12
  '.s-hidden' : {'@apply hidden': {}},
13
13
  '.s-block' : {'@apply block': {}},
14
+ '.s-scrollbar' : {'@apply styled-scrollbar': {}},
14
15
  };
15
16
 
16
17
  fs.readdirSync(componentsPath, {withFileTypes: true})
@@ -1,18 +1,18 @@
1
1
  const plugin = require('tailwindcss/plugin')
2
2
 
3
- module.exports = plugin(function ({addUtilities, addVariant, matchUtilities, theme}) {
3
+ module.exports = plugin(function ({ addUtilities, addVariant, matchUtilities, theme }) {
4
4
  addVariant('border', ['&:focus'])
5
5
 
6
6
  addUtilities({
7
- '.s-hidden': {'@apply hidden': {}},
8
- '.s-has-error': {'@apply border-red-400 focus:border-red-500': {}},
9
- '.rounded-icon': {'@apply w-16 h-16 flex justify-center items-center rounded-full text-3xl': {}},
10
- '.form-input': {'@apply w-full h-10 transition-colors duration-300 focus:ring-transparent focus:border-primary dark:focus:border-primary sm:text-sm border-gray-200 dark:bg-gray-600 dark:border-gray-600 rounded-md': {}},
11
- '.btn': {'@apply transition duration-300 flex-1 inline-flex justify-center items-center px-6 pb-2.5 pt-2 text-sm font-bold rounded-md hover:opacity-80 whitespace-nowrap': {}},
12
- '.btn-primary': {'@apply text-primary-reverse border border-primary bg-primary': {}},
13
- '.btn-danger': {'@apply bg-red-400 text-white hover:opacity-80': {}},
14
- '.btn-outline': {'@apply text-gray-400 bg-white shadow-sm hover:text-gray-600 border border-gray-200': {}},
15
- '.btn-outline-primary': {'@apply border border-primary text-primary hover:bg-primary hover:text-primary-reverse': {}},
7
+ '.s-hidden': { '@apply hidden': {} },
8
+ '.s-has-error': { '@apply border-red-400 focus:border-red-500': {} },
9
+ '.rounded-icon': { '@apply w-16 h-16 flex justify-center items-center rounded-full text-3xl': {} },
10
+ '.form-input': { '@apply w-full h-10 transition-colors duration-300 focus:ring-transparent focus:border-primary dark:focus:border-primary sm:text-sm border-gray-200 dark:bg-gray-600 dark:border-gray-600 rounded-md': {} },
11
+ '.btn': { '@apply transition duration-300 flex-1 inline-flex justify-center items-center px-6 pb-2.5 pt-2 text-sm font-bold rounded-md hover:opacity-80 whitespace-nowrap': {} },
12
+ '.btn-primary': { '@apply text-primary-reverse border border-primary bg-primary': {} },
13
+ '.btn-danger': { '@apply bg-red-400 text-white hover:opacity-80': {} },
14
+ '.btn-outline': { '@apply text-gray-400 bg-white shadow-sm hover:text-gray-600 border border-gray-200': {} },
15
+ '.btn-outline-primary': { '@apply border border-primary text-primary hover:bg-primary hover:text-primary-reverse': {} },
16
16
  });
17
17
 
18
18
  // todo :: move it to global
@@ -23,6 +23,22 @@ module.exports = plugin(function ({addUtilities, addVariant, matchUtilities, the
23
23
  'border-right-color': '#9f7171 !important',
24
24
  'background-color': '#f98181'
25
25
  }
26
+ },
27
+ '.styled-scrollbar': {
28
+ '&::-webkit-scrollbar': {
29
+ 'width': '5px'
30
+ },
31
+ '&::-webkit-scrollbar-track': {
32
+ 'background-color': '#eee'
33
+ },
34
+ '&::-webkit-scrollbar-thumb': {
35
+ 'background-color': 'var(--color-primary)',
36
+ 'border-radius': '10px',
37
+ '-webkit-border-radius': '10px',
38
+ '-moz-border-radius': '10px',
39
+ '-ms-border-radius': '10px',
40
+ '-o-border-radius': '10px'
41
+ }
26
42
  }
27
43
  });
28
44
 
@@ -55,7 +71,7 @@ module.exports = plugin(function ({addUtilities, addVariant, matchUtilities, the
55
71
  'elastic': 'cubic-bezier(0.55, 0, 0.1, 1)',
56
72
  },
57
73
  screens: {
58
- 'xxs': {'min': '380px', 'max': '479px'},
74
+ 'xxs': { 'min': '380px', 'max': '479px' },
59
75
  'xs': '480px',
60
76
  },
61
77
  }
@@ -28,7 +28,7 @@ var ModeType;
28
28
  ModeType["AVAILABILITY"] = "availability";
29
29
  })(ModeType || (ModeType = {}));
30
30
 
31
- const sallaScopesCss = ".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-container::-webkit-scrollbar{width:5px}.s-scopes-container::-webkit-scrollbar-track{background-color:#eee}.s-scopes-container::-webkit-scrollbar-thumb{background-color:var(--color-primary);border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px}.s-scopes-placeholder{flex:0 0 85%}";
31
+ const sallaScopesCss = ".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}";
32
32
 
33
33
  const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
34
34
  constructor() {
@@ -124,7 +124,7 @@ const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
124
124
  return h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" }, h("span", { slot: "title" }, this.branchNotFound), h("span", { slot: "description" }, this.ourServiceIsNotFound));
125
125
  }
126
126
  defaultContent() {
127
- return [h("div", { class: "s-scopes-container" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, h("input", { id: `${this.position} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }), h("label", { htmlFor: this.position + '_scope_' + scope.id, class: "s-scopes-label s-scopes-clickable" }, h("span", null, scope.name))))), this.footerContent()];
127
+ return [h("div", { class: "s-scopes-container s-scrollbar" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, h("input", { id: `${this.position} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }), h("label", { htmlFor: this.position + '_scope_' + scope.id, class: "s-scopes-label s-scopes-clickable" }, h("span", null, scope.name))))), this.footerContent()];
128
128
  }
129
129
  availabilityContent() {
130
130
  return h("div", { class: "s-scopes-container" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, h("h2", { class: { "s-scopes-label": true, "s-scopes-clickable": this.isDefault } }, h("span", null, scope.name)), h("h2", { style: { 'color': scope.availability.color }, class: `s-scopes-${scope.availability.key}` }, scope.availability.label))));
@@ -2,7 +2,6 @@
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
4
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
5
- import 'https://static.addtoany.com/menu/page.js';
6
5
  import { d as defineCustomElement$2 } from './salla-button2.js';
7
6
 
8
7
  /*
@@ -1380,15 +1379,27 @@ const SallaSocialShare$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
1380
1379
  this.platforms = this.allPlatforms;
1381
1380
  }
1382
1381
  componentWillLoad() {
1383
- // ? this will not work if there are multiple share components on the same page, this will be applied to the first one only
1384
- window.a2a_config = window.a2a_config || {};
1385
- window.a2a_config.linkurl = this.url ? this.url : window.location.href;
1386
- window.a2a_config.linkname = this.urlName ? this.urlName : document.title;
1382
+ let that = this;
1383
+ if (!document.getElementById('a2a-script')) {
1384
+ const script = document.createElement('script');
1385
+ script.src = 'https://static.addtoany.com/menu/page.js';
1386
+ script.setAttribute('id', 'a2a-script');
1387
+ script.onload = function () {
1388
+ // ? this will not work if there is one share component in the page
1389
+ window.a2a_config = window.a2a_config || {};
1390
+ window.a2a_config.linkurl = that.url ? that.url : window.location.href;
1391
+ window.a2a_config.linkname = that.urlName ? that.urlName : document.title;
1392
+ };
1393
+ document.body.appendChild(script);
1394
+ }
1395
+ else {
1396
+ return;
1397
+ }
1387
1398
  salla.lang.onLoaded(() => {
1388
1399
  window.a2a_config.locale = salla.lang.locale;
1389
1400
  });
1390
1401
  }
1391
- open() {
1402
+ async open() {
1392
1403
  this.opened = !this.opened;
1393
1404
  if (this.opened) {
1394
1405
  this.shareMenu.classList.add('opened');
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-4e30ffd0.js';
5
5
  import { H as Helper } from './Helper-e1d414a5.js';
6
- import 'https://static.addtoany.com/menu/page.js';
7
6
 
8
7
  const sallaButtonCss = "";
9
8
 
@@ -1523,7 +1522,7 @@ var ModeType;
1523
1522
  ModeType["AVAILABILITY"] = "availability";
1524
1523
  })(ModeType || (ModeType = {}));
1525
1524
 
1526
- const sallaScopesCss = ".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-container::-webkit-scrollbar{width:5px}.s-scopes-container::-webkit-scrollbar-track{background-color:#eee}.s-scopes-container::-webkit-scrollbar-thumb{background-color:var(--color-primary);border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px}.s-scopes-placeholder{flex:0 0 85%}";
1525
+ const sallaScopesCss = ".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}";
1527
1526
 
1528
1527
  const SallaScopees = class {
1529
1528
  constructor(hostRef) {
@@ -1618,7 +1617,7 @@ const SallaScopees = class {
1618
1617
  return h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" }, h("span", { slot: "title" }, this.branchNotFound), h("span", { slot: "description" }, this.ourServiceIsNotFound));
1619
1618
  }
1620
1619
  defaultContent() {
1621
- return [h("div", { class: "s-scopes-container" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, h("input", { id: `${this.position} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }), h("label", { htmlFor: this.position + '_scope_' + scope.id, class: "s-scopes-label s-scopes-clickable" }, h("span", null, scope.name))))), this.footerContent()];
1620
+ return [h("div", { class: "s-scopes-container s-scrollbar" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, h("input", { id: `${this.position} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }), h("label", { htmlFor: this.position + '_scope_' + scope.id, class: "s-scopes-label s-scopes-clickable" }, h("span", null, scope.name))))), this.footerContent()];
1622
1621
  }
1623
1622
  availabilityContent() {
1624
1623
  return h("div", { class: "s-scopes-container" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, h("h2", { class: { "s-scopes-label": true, "s-scopes-clickable": this.isDefault } }, h("span", null, scope.name)), h("h2", { style: { 'color': scope.availability.color }, class: `s-scopes-${scope.availability.key}` }, scope.availability.label))));
@@ -3111,15 +3110,27 @@ const SallaSocialShare = class {
3111
3110
  this.platforms = this.allPlatforms;
3112
3111
  }
3113
3112
  componentWillLoad() {
3114
- // ? this will not work if there are multiple share components on the same page, this will be applied to the first one only
3115
- window.a2a_config = window.a2a_config || {};
3116
- window.a2a_config.linkurl = this.url ? this.url : window.location.href;
3117
- window.a2a_config.linkname = this.urlName ? this.urlName : document.title;
3113
+ let that = this;
3114
+ if (!document.getElementById('a2a-script')) {
3115
+ const script = document.createElement('script');
3116
+ script.src = 'https://static.addtoany.com/menu/page.js';
3117
+ script.setAttribute('id', 'a2a-script');
3118
+ script.onload = function () {
3119
+ // ? this will not work if there is one share component in the page
3120
+ window.a2a_config = window.a2a_config || {};
3121
+ window.a2a_config.linkurl = that.url ? that.url : window.location.href;
3122
+ window.a2a_config.linkname = that.urlName ? that.urlName : document.title;
3123
+ };
3124
+ document.body.appendChild(script);
3125
+ }
3126
+ else {
3127
+ return;
3128
+ }
3118
3129
  salla.lang.onLoaded(() => {
3119
3130
  window.a2a_config.locale = salla.lang.locale;
3120
3131
  });
3121
3132
  }
3122
- open() {
3133
+ async open() {
3123
3134
  this.opened = !this.opened;
3124
3135
  if (this.opened) {
3125
3136
  this.shareMenu.classList.add('opened');