@salla.sa/twilight-components 1.0.19 → 1.0.21

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 (92) hide show
  1. package/dist/{esm → twilight-components}/Helper-d07ebbc7.js +0 -0
  2. package/dist/twilight-components/app-globals-0f993ce5.js +3 -0
  3. package/dist/twilight-components/css-shim-a64b8820.js +4 -0
  4. package/dist/twilight-components/dom-d08ba8aa.js +73 -0
  5. package/dist/twilight-components/index-9c087700.js +3010 -0
  6. package/dist/twilight-components/index.esm.js +4 -1
  7. package/dist/{esm → twilight-components}/salla-branches.entry.js +1 -1
  8. package/dist/twilight-components/salla-button.entry.js +75 -0
  9. package/dist/{esm → twilight-components}/salla-localization.entry.js +1 -1
  10. package/dist/{esm/salla-login-38586400.js → twilight-components/salla-login-57b18c2c.js} +1 -1
  11. package/dist/twilight-components/salla-login.entry.js +3 -0
  12. package/dist/twilight-components/salla-modal.entry.js +113 -0
  13. package/dist/twilight-components/salla-offer.entry.js +75 -0
  14. package/dist/{esm → twilight-components}/salla-product-availability.entry.js +1 -1
  15. package/dist/twilight-components/salla-rating.entry.js +228 -0
  16. package/dist/{esm/salla-search-ca856aab.js → twilight-components/salla-search-30fec1e8.js} +1 -1
  17. package/dist/twilight-components/salla-search.entry.js +3 -0
  18. package/dist/{esm/salla-button_5.entry.js → twilight-components/salla-tel-input.entry.js} +33 -294
  19. package/dist/twilight-components/salla-verify.entry.js +114 -0
  20. package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
  21. package/dist/twilight-components/twilight-components.css +3 -1
  22. package/dist/twilight-components/twilight-components.esm.js +125 -1
  23. package/dist/types/components/salla-offer/offer-schema.d.ts +47 -0
  24. package/dist/types/components/salla-offer/salla-offer.d.ts +13 -48
  25. package/dist/types/components/salla-rating/order-feedback-response.d.ts +62 -0
  26. package/dist/types/components/salla-rating/salla-rating.d.ts +25 -23
  27. package/dist/types/components.d.ts +2 -10
  28. package/package.json +1 -1
  29. package/dist/cjs/Helper-fcea994c.js +0 -23
  30. package/dist/cjs/index-4b8b3ffe.js +0 -1696
  31. package/dist/cjs/index.cjs.js +0 -13
  32. package/dist/cjs/loader.cjs.js +0 -21
  33. package/dist/cjs/salla-branches.cjs.entry.js +0 -92
  34. package/dist/cjs/salla-button_5.cjs.entry.js +0 -1686
  35. package/dist/cjs/salla-localization.cjs.entry.js +0 -82
  36. package/dist/cjs/salla-login-008cc893.js +0 -125
  37. package/dist/cjs/salla-offer.cjs.entry.js +0 -50
  38. package/dist/cjs/salla-product-availability.cjs.entry.js +0 -75
  39. package/dist/cjs/salla-rating.cjs.entry.js +0 -300
  40. package/dist/cjs/salla-search-c7aad59a.js +0 -81
  41. package/dist/cjs/salla-search.cjs.entry.js +0 -11
  42. package/dist/cjs/twilight-components.cjs.js +0 -19
  43. package/dist/collection/Helpers/Helper.js +0 -19
  44. package/dist/collection/collection-manifest.json +0 -22
  45. package/dist/collection/components/generate-summary.js +0 -35
  46. package/dist/collection/components/salla-branches/salla-branches.css +0 -12
  47. package/dist/collection/components/salla-branches/salla-branches.js +0 -233
  48. package/dist/collection/components/salla-button/salla-button.css +0 -3
  49. package/dist/collection/components/salla-button/salla-button.js +0 -246
  50. package/dist/collection/components/salla-localization/salla-localization.js +0 -208
  51. package/dist/collection/components/salla-login/salla-login.css +0 -3
  52. package/dist/collection/components/salla-login/salla-login.js +0 -378
  53. package/dist/collection/components/salla-modal/salla-modal.js +0 -459
  54. package/dist/collection/components/salla-offer/salla-offer.js +0 -81
  55. package/dist/collection/components/salla-product-availability/salla-product-availability.js +0 -331
  56. package/dist/collection/components/salla-rating/salla-rating.css +0 -7
  57. package/dist/collection/components/salla-rating/salla-rating.js +0 -483
  58. package/dist/collection/components/salla-search/salla-search.js +0 -132
  59. package/dist/collection/components/salla-tel-input/salla-tel-input.js +0 -14
  60. package/dist/collection/components/salla-verify/salla-verify.js +0 -273
  61. package/dist/collection/index.js +0 -2
  62. package/dist/collection/interfaces/colors.js +0 -1
  63. package/dist/collection/interfaces/index.js +0 -2
  64. package/dist/collection/interfaces/ratio.js +0 -1
  65. package/dist/collection/plugins/tailwind-theme/generator.js +0 -62
  66. package/dist/collection/plugins/tailwind-theme/index.js +0 -26
  67. package/dist/esm/index-092659c7.js +0 -1668
  68. package/dist/esm/index.js +0 -4
  69. package/dist/esm/loader.js +0 -17
  70. package/dist/esm/polyfills/core-js.js +0 -11
  71. package/dist/esm/polyfills/css-shim.js +0 -1
  72. package/dist/esm/polyfills/dom.js +0 -79
  73. package/dist/esm/polyfills/es5-html-element.js +0 -1
  74. package/dist/esm/polyfills/index.js +0 -34
  75. package/dist/esm/polyfills/system.js +0 -6
  76. package/dist/esm/salla-offer.entry.js +0 -46
  77. package/dist/esm/salla-rating.entry.js +0 -296
  78. package/dist/esm/salla-search.entry.js +0 -3
  79. package/dist/esm/twilight-components.js +0 -17
  80. package/dist/index.cjs.js +0 -1
  81. package/dist/index.js +0 -1
  82. package/dist/twilight-components/p-03d0ec44.entry.js +0 -1
  83. package/dist/twilight-components/p-13a55257.entry.js +0 -1
  84. package/dist/twilight-components/p-160062c6.js +0 -1
  85. package/dist/twilight-components/p-47f17d3b.js +0 -1
  86. package/dist/twilight-components/p-5307c7b5.entry.js +0 -1
  87. package/dist/twilight-components/p-6a1f43c6.entry.js +0 -1
  88. package/dist/twilight-components/p-7088e517.entry.js +0 -1
  89. package/dist/twilight-components/p-924e3c88.js +0 -1
  90. package/dist/twilight-components/p-e8965b01.js +0 -1
  91. package/dist/twilight-components/p-ecb1b6cc.entry.js +0 -1
  92. package/dist/twilight-components/p-f11b401a.entry.js +0 -1
@@ -1,246 +0,0 @@
1
- import { Component, Element, h, Method, Prop, Watch, Host } from '@stencil/core';
2
- import Helper from "../../Helpers/Helper";
3
- export class SallaButton {
4
- constructor() {
5
- this.btnStyle = 'primary';
6
- this.loading = false;
7
- this.disabled = false;
8
- this.loaderPosition = 'before';
9
- this.wide = false;
10
- this.hostAttributes = {};
11
- //============= Initiate Button Attributes =============//
12
- for (let i = 0; i < this.host.attributes.length; i++) {
13
- this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
14
- }
15
- this.hostAttributes.type = this.hostAttributes.type || 'button';
16
- this.hostAttributes.class += ' s-button-btn btn--has-loading'
17
- + ' s-button-' + this.btnStyle
18
- + (this.wide ? ' s-button-wide ' : '')
19
- + ' loader-' + this.loaderPosition
20
- + (this.loaderPosition == 'before' ? ' s-button-loader-after' : '');
21
- delete this.hostAttributes['btn-style'];
22
- delete this.hostAttributes['id'];
23
- if (this.wide) {
24
- this.host.classList.add('s-button-wide');
25
- }
26
- }
27
- async load() {
28
- if (this.loaderPosition == 'center')
29
- this.text.classList.add('s-button-hide');
30
- this.host.setAttribute('loading', '');
31
- return this.host;
32
- }
33
- async stop() {
34
- this.host.removeAttribute('loading');
35
- return this.host;
36
- }
37
- async disable() {
38
- this.host.setAttribute('disabled', '');
39
- }
40
- async enable() {
41
- this.host.removeAttribute('disabled');
42
- }
43
- handleVisible(newKind, oldKind) {
44
- //todo::use united styles
45
- this.btn.classList.remove('btn-' + oldKind);
46
- this.btn.classList.add('btn-' + newKind);
47
- }
48
- handleLoading(newVal) {
49
- //todo::use united styles
50
- Helper.toggleElement(this.btn, 'btn--is-loading', 'btn--no-loading', () => newVal);
51
- }
52
- render() {
53
- return (
54
- //TODO:: use HOST then fake button behaviours
55
- h(Host, { class: "s-button-host-tag" },
56
- h("button", Object.assign({ ref: btn => this.btn = btn, disabled: this.disabled }, this.hostAttributes),
57
- h("span", { class: "s-button-text", ref: el => this.text = el },
58
- h("slot", null)),
59
- this.loading ? h("span", { class: {
60
- //todo::use united styles
61
- 's-button-loader': true,
62
- 's-button-loader-start': this.loaderPosition === 'start',
63
- 's-button-loader-end': this.loaderPosition === 'end',
64
- 's-button-loader-center': this.loaderPosition === 'center',
65
- } }) : '')));
66
- }
67
- static get is() { return "salla-button"; }
68
- static get originalStyleUrls() { return {
69
- "$": ["salla-button.css"]
70
- }; }
71
- static get styleUrls() { return {
72
- "$": ["salla-button.css"]
73
- }; }
74
- static get properties() { return {
75
- "btnStyle": {
76
- "type": "string",
77
- "mutable": false,
78
- "complexType": {
79
- "original": "'primary' | 'outline' | 'outline-primary' | 'danger'",
80
- "resolved": "\"danger\" | \"outline\" | \"outline-primary\" | \"primary\"",
81
- "references": {}
82
- },
83
- "required": false,
84
- "optional": false,
85
- "docs": {
86
- "tags": [],
87
- "text": ""
88
- },
89
- "attribute": "btn-style",
90
- "reflect": true,
91
- "defaultValue": "'primary'"
92
- },
93
- "loading": {
94
- "type": "boolean",
95
- "mutable": false,
96
- "complexType": {
97
- "original": "boolean",
98
- "resolved": "boolean",
99
- "references": {}
100
- },
101
- "required": false,
102
- "optional": false,
103
- "docs": {
104
- "tags": [],
105
- "text": ""
106
- },
107
- "attribute": "loading",
108
- "reflect": true,
109
- "defaultValue": "false"
110
- },
111
- "disabled": {
112
- "type": "boolean",
113
- "mutable": false,
114
- "complexType": {
115
- "original": "boolean",
116
- "resolved": "boolean",
117
- "references": {}
118
- },
119
- "required": false,
120
- "optional": false,
121
- "docs": {
122
- "tags": [],
123
- "text": ""
124
- },
125
- "attribute": "disabled",
126
- "reflect": true,
127
- "defaultValue": "false"
128
- },
129
- "loaderPosition": {
130
- "type": "string",
131
- "mutable": false,
132
- "complexType": {
133
- "original": "'start' | 'end' | 'center' | 'before'",
134
- "resolved": "\"before\" | \"center\" | \"end\" | \"start\"",
135
- "references": {}
136
- },
137
- "required": false,
138
- "optional": false,
139
- "docs": {
140
- "tags": [],
141
- "text": ""
142
- },
143
- "attribute": "loader-position",
144
- "reflect": false,
145
- "defaultValue": "'before'"
146
- },
147
- "wide": {
148
- "type": "boolean",
149
- "mutable": false,
150
- "complexType": {
151
- "original": "boolean",
152
- "resolved": "boolean",
153
- "references": {}
154
- },
155
- "required": false,
156
- "optional": false,
157
- "docs": {
158
- "tags": [],
159
- "text": ""
160
- },
161
- "attribute": "wide",
162
- "reflect": false,
163
- "defaultValue": "false"
164
- }
165
- }; }
166
- static get methods() { return {
167
- "load": {
168
- "complexType": {
169
- "signature": "() => Promise<HTMLElement>",
170
- "parameters": [],
171
- "references": {
172
- "Promise": {
173
- "location": "global"
174
- },
175
- "HTMLElement": {
176
- "location": "global"
177
- }
178
- },
179
- "return": "Promise<HTMLElement>"
180
- },
181
- "docs": {
182
- "text": "",
183
- "tags": []
184
- }
185
- },
186
- "stop": {
187
- "complexType": {
188
- "signature": "() => Promise<HTMLElement>",
189
- "parameters": [],
190
- "references": {
191
- "Promise": {
192
- "location": "global"
193
- },
194
- "HTMLElement": {
195
- "location": "global"
196
- }
197
- },
198
- "return": "Promise<HTMLElement>"
199
- },
200
- "docs": {
201
- "text": "",
202
- "tags": []
203
- }
204
- },
205
- "disable": {
206
- "complexType": {
207
- "signature": "() => Promise<void>",
208
- "parameters": [],
209
- "references": {
210
- "Promise": {
211
- "location": "global"
212
- }
213
- },
214
- "return": "Promise<void>"
215
- },
216
- "docs": {
217
- "text": "",
218
- "tags": []
219
- }
220
- },
221
- "enable": {
222
- "complexType": {
223
- "signature": "() => Promise<void>",
224
- "parameters": [],
225
- "references": {
226
- "Promise": {
227
- "location": "global"
228
- }
229
- },
230
- "return": "Promise<void>"
231
- },
232
- "docs": {
233
- "text": "",
234
- "tags": []
235
- }
236
- }
237
- }; }
238
- static get elementRef() { return "host"; }
239
- static get watchers() { return [{
240
- "propName": "btnStyle",
241
- "methodName": "handleVisible"
242
- }, {
243
- "propName": "loading",
244
- "methodName": "handleLoading"
245
- }]; }
246
- }
@@ -1,208 +0,0 @@
1
- import { Component, Element, h, Method, Prop } from '@stencil/core';
2
- import Helper from "../../Helpers/Helper";
3
- /**
4
- * @slot header - The top of the modal.
5
- * @slot footer - Replaces the bottom button.
6
- * @slot language - Replaces language label, has replaceable props `{name}`, `{code}`, `{country_code}`.
7
- * @slot currency - Replaces currency label, has replaceable props `{name}`, `{code}`, `{country_code}`.
8
- */
9
- export class SallaLocalization {
10
- constructor() {
11
- var _a, _b;
12
- this.language = salla.config.get('language', {});
13
- this.currency = salla.config.get('currency', {});
14
- this.languagesTitle = salla.lang.get('common.titles.language');
15
- this.currenciesTitle = salla.lang.get('common.titles.currency');
16
- this.ok = salla.lang.get('common.elements.ok');
17
- Helper.setHost(this.host);
18
- salla.event.on('localization::show', () => this.show());
19
- /**
20
- * letting developer to insert his own slot like:
21
- * <salla-localization>
22
- * <div slot="language">...{name}....</div>
23
- * <div slot="currency">...{name}....</div>
24
- * </salla-localization>
25
- * Because scoped templates not supported in stencil );
26
- * we made a workaround to pass language & currency attributes, then replace names in rendering
27
- */
28
- this.languageSlot = ((_a = Helper.getElement('[slot="language"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<label class="s-localization-label" for="lang-{code}"><span>{name}</span><div class="s-localization-flag flag iti__flag iti__{country_code}"></div></label>';
29
- this.currencySlot = ((_b = Helper.getElement('[slot="currency"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || '<label class="s-localization-label" for="currency-{code}"><span>{name}</span><small class="s-localization-currency">{code}</small></label>';
30
- this.languages = Object.values(salla.config.get('languages', {}));
31
- this.currencies = Object.values(salla.config.get('currencies', {}));
32
- }
33
- async show() {
34
- return this.modal.show();
35
- }
36
- async hide() {
37
- return this.modal.hide();
38
- }
39
- onChangeCurrency(event) {
40
- this.currency = salla.config.get('currencies.' + event.target.value);
41
- }
42
- onChangeLanguage(event) {
43
- this.language = salla.config.get('languages.' + event.target.value);
44
- }
45
- async submit() {
46
- let url;
47
- console.log('this.currency.code::::', this.currency, this.currency.code);
48
- this.btn.load()
49
- .then(() => this.currency.code === salla.config.get('user.currency') || ((url = window.location.href) && salla.currency.api.change(this.currency.code)))
50
- .then(() => this.language.code === salla.config.get('user.language') || (url = this.language.url))
51
- .then(() => this.btn.stop())
52
- .then(() => this.hide())
53
- .then(() => url && (window.location.href = url));
54
- }
55
- render() {
56
- return (h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal, "modal-width": "xs" },
57
- h("div", { slot: "header" },
58
- h("slot", { name: "header" })),
59
- h("div", { class: "s-localization-inner" },
60
- this.languages.length > 1 ?
61
- h("div", { class: "s-localization-section" },
62
- h("label", { class: "s-localization-title" }, this.languagesTitle),
63
- h("div", { class: "s-localization-section-inner" }, this.languages.length < 6 ?
64
- this.languages.map(lang => h("div", { class: "s-localization-item" },
65
- h("input", { class: "s-localization-input", type: "radio", checked: this.language.code == lang.code, onChange: () => this.language = lang, name: "language", id: 'lang-' + lang.code.toLowerCase(), value: lang.code }),
66
- h("div", { id: "language-slot", innerHTML: this.languageSlot
67
- .replace(/\{name\}/g, lang.name)
68
- .replace(/\{code\}/g, lang.code)
69
- .replace(/\{country_code\}/g, lang.country_code) }))) :
70
- h("select", { class: "s-branches-select", name: "currency", onChange: e => this.onChangeLanguage(e) }, this.languages.map(lang => h("option", { value: lang.code, selected: this.language.code == lang.code }, lang.name)))))
71
- : '',
72
- this.currencies.length > 1 ?
73
- h("div", { class: "s-localization-section" },
74
- h("label", { class: "s-localization-title" }, this.currenciesTitle),
75
- h("div", { class: "s-localization-section-inner" }, this.currencies.length < 6 ?
76
- this.currencies.map(currency => h("div", { class: "s-localization-item" },
77
- h("input", { class: "s-localization-input", type: "radio", name: "currency", checked: this.currency.code == currency.code, onChange: () => this.currency = currency, id: 'currency-' + currency.code, value: currency.code }),
78
- h("div", { id: "currency-slot", innerHTML: this.currencySlot
79
- .replace(/\{name\}/g, currency.name)
80
- .replace(/\{code\}/g, currency.code)
81
- .replace(/\{country_code\}/g, currency.country_code) }))) :
82
- h("select", { class: "s-branches-select", name: "currency", onChange: e => this.onChangeCurrency(e) }, this.currencies.map(currency => h("option", { value: currency.code, selected: this.currency.code == currency.code }, currency.name)))))
83
- : ''),
84
- h("slot", { name: "footer" },
85
- h("salla-button", { wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.ok))));
86
- }
87
- /**
88
- * to reduce dom levels we will move slot data into the parent dom
89
- */
90
- componentDidRender() {
91
- this.host.querySelectorAll('#currency-slot').forEach(el => el.replaceWith(el.firstChild));
92
- this.host.querySelectorAll('#language-slot').forEach(el => el.replaceWith(el.firstChild));
93
- }
94
- static get is() { return "salla-localization"; }
95
- static get properties() { return {
96
- "languagesTitle": {
97
- "type": "string",
98
- "mutable": false,
99
- "complexType": {
100
- "original": "string",
101
- "resolved": "string",
102
- "references": {}
103
- },
104
- "required": false,
105
- "optional": false,
106
- "docs": {
107
- "tags": [],
108
- "text": ""
109
- },
110
- "attribute": "languages-title",
111
- "reflect": false,
112
- "defaultValue": "salla.lang.get('common.titles.language')"
113
- },
114
- "currenciesTitle": {
115
- "type": "string",
116
- "mutable": false,
117
- "complexType": {
118
- "original": "string",
119
- "resolved": "string",
120
- "references": {}
121
- },
122
- "required": false,
123
- "optional": false,
124
- "docs": {
125
- "tags": [],
126
- "text": ""
127
- },
128
- "attribute": "currencies-title",
129
- "reflect": false,
130
- "defaultValue": "salla.lang.get('common.titles.currency')"
131
- },
132
- "ok": {
133
- "type": "string",
134
- "mutable": false,
135
- "complexType": {
136
- "original": "string",
137
- "resolved": "string",
138
- "references": {}
139
- },
140
- "required": false,
141
- "optional": false,
142
- "docs": {
143
- "tags": [],
144
- "text": ""
145
- },
146
- "attribute": "ok",
147
- "reflect": false,
148
- "defaultValue": "salla.lang.get('common.elements.ok')"
149
- }
150
- }; }
151
- static get methods() { return {
152
- "show": {
153
- "complexType": {
154
- "signature": "() => Promise<HTMLElement>",
155
- "parameters": [],
156
- "references": {
157
- "Promise": {
158
- "location": "global"
159
- },
160
- "HTMLElement": {
161
- "location": "global"
162
- }
163
- },
164
- "return": "Promise<HTMLElement>"
165
- },
166
- "docs": {
167
- "text": "",
168
- "tags": []
169
- }
170
- },
171
- "hide": {
172
- "complexType": {
173
- "signature": "() => Promise<HTMLElement>",
174
- "parameters": [],
175
- "references": {
176
- "Promise": {
177
- "location": "global"
178
- },
179
- "HTMLElement": {
180
- "location": "global"
181
- }
182
- },
183
- "return": "Promise<HTMLElement>"
184
- },
185
- "docs": {
186
- "text": "",
187
- "tags": []
188
- }
189
- },
190
- "submit": {
191
- "complexType": {
192
- "signature": "() => Promise<void>",
193
- "parameters": [],
194
- "references": {
195
- "Promise": {
196
- "location": "global"
197
- }
198
- },
199
- "return": "Promise<void>"
200
- },
201
- "docs": {
202
- "text": "",
203
- "tags": []
204
- }
205
- }
206
- }; }
207
- static get elementRef() { return "host"; }
208
- }
@@ -1,3 +0,0 @@
1
- salla-verify{
2
- display: block;
3
- }