@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,459 +0,0 @@
1
- import { Component, h, Prop, Host, Element, Event, Watch, Method, State } from '@stencil/core';
2
- import Helper from "../../Helpers/Helper";
3
- /**
4
- * @slot body - The content of modal
5
- * @slot footer - The footer of modal
6
- */
7
- export class SallaModal {
8
- constructor() {
9
- var _a;
10
- //todo:: unite three colors (error, success, primary) in one prop
11
- this.error = false;
12
- this.success = false;
13
- this.primary = false;
14
- this.isClosable = true;
15
- this.width = 'md';
16
- this.visible = false;
17
- this.isLoading = false;
18
- this.subTitleFirst = false;
19
- this.subTitle = '';
20
- this.icon = '';
21
- this.imageIcon = '';
22
- Helper.setHost(this.host);
23
- salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
24
- salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
25
- this.title = this.host.title;
26
- this.host.removeAttribute('title');
27
- (_a = Helper.getElement('[slot=body]')) === null || _a === void 0 ? void 0 : _a.classList.add('s-modal-body', 's-modal-' + this.width);
28
- }
29
- handleVisible(newValue) {
30
- if (!newValue) {
31
- this.toggleModal(false);
32
- this.modalClosed.emit();
33
- return;
34
- }
35
- this.host.classList.remove('hidden');
36
- setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
37
- this.modalOpened.emit();
38
- }
39
- async show() {
40
- this.host.setAttribute('visible', '');
41
- return this.host;
42
- }
43
- async hide() {
44
- this.host.removeAttribute('visible');
45
- return this.host;
46
- }
47
- async setTitle(title) {
48
- this.title = title;
49
- return this.host;
50
- }
51
- async loading() {
52
- this.isLoading = true;
53
- return this.host;
54
- }
55
- async stopLoading() {
56
- this.isLoading = false;
57
- return this.host;
58
- }
59
- toggleModal(isOpen) {
60
- Helper
61
- // .toggleElement(this.host.querySelector('.s-modal-body'), 's-modal-entering', 's-modal-leaving', () => isOpen)
62
- .toggleElement(this.host.querySelector('[slot=body]') || this.host, 's-modal-entering', 's-modal-leaving', () => isOpen)
63
- .toggleElement(this.overlay, 's-modal-entering', 's-modal-overlay-leaving', () => isOpen)
64
- //todo:: use united class names
65
- .toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
66
- if (!isOpen) {
67
- setTimeout(() => this.host.classList.add('hidden'), 350);
68
- }
69
- }
70
- closeModal() {
71
- if (!this.isClosable) {
72
- return;
73
- }
74
- this.host.removeAttribute('visible');
75
- }
76
- //todo:: pref for each modal
77
- render() {
78
- this.host.id = this.host.id || 'salla-modal';
79
- return (
80
- //todo:: use suitable class name instead of hidden
81
- h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" },
82
- h("div", { class: "s-modal-wrapper" },
83
- h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }),
84
- h("span", { class: "s-modal-spacer" }, "\u200B"),
85
- h("slot", { name: "body" },
86
- h("div", { class: 's-modal-body ' + 's-modal-' + this.width, slot: "body" }, this.isLoading
87
- ? h("span", null, "Loading...")
88
- : [h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } },
89
- this.isClosable ?
90
- //todo:: remove cursor-pointer
91
- h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" },
92
- h("span", { class: "sicon-cancel" }))
93
- : '',
94
- this.error || this.success || this.icon
95
- ? h("div", { class: {
96
- 's-modal-icon': true,
97
- 's-modal-bg-error': this.error,
98
- 's-modal-bg-success': this.success,
99
- 's-modal-bg-normal': !this.error && !this.success,
100
- 's-modal-bg-primary': this.primary
101
- } },
102
- h("i", { class: {
103
- [this.icon]: true,
104
- 's-modal-text-error': this.error,
105
- 's-modal-text-success': this.success,
106
- } }))
107
- : this.imageIcon ?
108
- h("img", { class: "s-modal-header-img", src: this.imageIcon })
109
- : '',
110
- this.title || this.subTitle ?
111
- h("div", { class: "s-modal-header-content" },
112
- h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.title }),
113
- h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle }))
114
- : ''),
115
- h("slot", null),
116
- h("slot", { name: "footer" })
117
- ])))));
118
- }
119
- static get is() { return "salla-modal"; }
120
- static get properties() { return {
121
- "error": {
122
- "type": "boolean",
123
- "mutable": false,
124
- "complexType": {
125
- "original": "boolean",
126
- "resolved": "boolean",
127
- "references": {}
128
- },
129
- "required": false,
130
- "optional": false,
131
- "docs": {
132
- "tags": [],
133
- "text": ""
134
- },
135
- "attribute": "error",
136
- "reflect": false,
137
- "defaultValue": "false"
138
- },
139
- "success": {
140
- "type": "boolean",
141
- "mutable": false,
142
- "complexType": {
143
- "original": "boolean",
144
- "resolved": "boolean",
145
- "references": {}
146
- },
147
- "required": false,
148
- "optional": false,
149
- "docs": {
150
- "tags": [],
151
- "text": ""
152
- },
153
- "attribute": "success",
154
- "reflect": false,
155
- "defaultValue": "false"
156
- },
157
- "primary": {
158
- "type": "boolean",
159
- "mutable": false,
160
- "complexType": {
161
- "original": "boolean",
162
- "resolved": "boolean",
163
- "references": {}
164
- },
165
- "required": false,
166
- "optional": false,
167
- "docs": {
168
- "tags": [],
169
- "text": ""
170
- },
171
- "attribute": "primary",
172
- "reflect": false,
173
- "defaultValue": "false"
174
- },
175
- "isClosable": {
176
- "type": "boolean",
177
- "mutable": true,
178
- "complexType": {
179
- "original": "boolean",
180
- "resolved": "boolean",
181
- "references": {}
182
- },
183
- "required": false,
184
- "optional": false,
185
- "docs": {
186
- "tags": [],
187
- "text": ""
188
- },
189
- "attribute": "is-closable",
190
- "reflect": false,
191
- "defaultValue": "true"
192
- },
193
- "width": {
194
- "type": "string",
195
- "mutable": false,
196
- "complexType": {
197
- "original": "'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full'",
198
- "resolved": "\"full\" | \"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\"",
199
- "references": {}
200
- },
201
- "required": false,
202
- "optional": false,
203
- "docs": {
204
- "tags": [],
205
- "text": ""
206
- },
207
- "attribute": "width",
208
- "reflect": true,
209
- "defaultValue": "'md'"
210
- },
211
- "visible": {
212
- "type": "boolean",
213
- "mutable": false,
214
- "complexType": {
215
- "original": "boolean",
216
- "resolved": "boolean",
217
- "references": {}
218
- },
219
- "required": false,
220
- "optional": false,
221
- "docs": {
222
- "tags": [],
223
- "text": ""
224
- },
225
- "attribute": "visible",
226
- "reflect": true,
227
- "defaultValue": "false"
228
- },
229
- "isLoading": {
230
- "type": "boolean",
231
- "mutable": true,
232
- "complexType": {
233
- "original": "boolean",
234
- "resolved": "boolean",
235
- "references": {}
236
- },
237
- "required": false,
238
- "optional": false,
239
- "docs": {
240
- "tags": [],
241
- "text": ""
242
- },
243
- "attribute": "is-loading",
244
- "reflect": true,
245
- "defaultValue": "false"
246
- },
247
- "subTitleFirst": {
248
- "type": "boolean",
249
- "mutable": false,
250
- "complexType": {
251
- "original": "boolean",
252
- "resolved": "boolean",
253
- "references": {}
254
- },
255
- "required": false,
256
- "optional": false,
257
- "docs": {
258
- "tags": [],
259
- "text": ""
260
- },
261
- "attribute": "sub-title-first",
262
- "reflect": false,
263
- "defaultValue": "false"
264
- },
265
- "subTitle": {
266
- "type": "string",
267
- "mutable": false,
268
- "complexType": {
269
- "original": "string",
270
- "resolved": "string",
271
- "references": {}
272
- },
273
- "required": false,
274
- "optional": false,
275
- "docs": {
276
- "tags": [],
277
- "text": ""
278
- },
279
- "attribute": "sub-title",
280
- "reflect": false,
281
- "defaultValue": "''"
282
- },
283
- "icon": {
284
- "type": "string",
285
- "mutable": false,
286
- "complexType": {
287
- "original": "string",
288
- "resolved": "string",
289
- "references": {}
290
- },
291
- "required": false,
292
- "optional": false,
293
- "docs": {
294
- "tags": [],
295
- "text": ""
296
- },
297
- "attribute": "icon",
298
- "reflect": false,
299
- "defaultValue": "''"
300
- },
301
- "imageIcon": {
302
- "type": "string",
303
- "mutable": false,
304
- "complexType": {
305
- "original": "string",
306
- "resolved": "string",
307
- "references": {}
308
- },
309
- "required": false,
310
- "optional": false,
311
- "docs": {
312
- "tags": [],
313
- "text": ""
314
- },
315
- "attribute": "image-icon",
316
- "reflect": false,
317
- "defaultValue": "''"
318
- }
319
- }; }
320
- static get states() { return {
321
- "title": {}
322
- }; }
323
- static get events() { return [{
324
- "method": "modalOpened",
325
- "name": "modalOpened",
326
- "bubbles": true,
327
- "cancelable": true,
328
- "composed": true,
329
- "docs": {
330
- "tags": [],
331
- "text": ""
332
- },
333
- "complexType": {
334
- "original": "any",
335
- "resolved": "any",
336
- "references": {}
337
- }
338
- }, {
339
- "method": "modalClosed",
340
- "name": "modalClosed",
341
- "bubbles": true,
342
- "cancelable": true,
343
- "composed": true,
344
- "docs": {
345
- "tags": [],
346
- "text": ""
347
- },
348
- "complexType": {
349
- "original": "any",
350
- "resolved": "any",
351
- "references": {}
352
- }
353
- }]; }
354
- static get methods() { return {
355
- "show": {
356
- "complexType": {
357
- "signature": "() => Promise<HTMLElement>",
358
- "parameters": [],
359
- "references": {
360
- "Promise": {
361
- "location": "global"
362
- },
363
- "HTMLElement": {
364
- "location": "global"
365
- }
366
- },
367
- "return": "Promise<HTMLElement>"
368
- },
369
- "docs": {
370
- "text": "",
371
- "tags": []
372
- }
373
- },
374
- "hide": {
375
- "complexType": {
376
- "signature": "() => Promise<HTMLElement>",
377
- "parameters": [],
378
- "references": {
379
- "Promise": {
380
- "location": "global"
381
- },
382
- "HTMLElement": {
383
- "location": "global"
384
- }
385
- },
386
- "return": "Promise<HTMLElement>"
387
- },
388
- "docs": {
389
- "text": "",
390
- "tags": []
391
- }
392
- },
393
- "setTitle": {
394
- "complexType": {
395
- "signature": "(title: any) => Promise<HTMLElement>",
396
- "parameters": [{
397
- "tags": [],
398
- "text": ""
399
- }],
400
- "references": {
401
- "Promise": {
402
- "location": "global"
403
- },
404
- "HTMLElement": {
405
- "location": "global"
406
- }
407
- },
408
- "return": "Promise<HTMLElement>"
409
- },
410
- "docs": {
411
- "text": "",
412
- "tags": []
413
- }
414
- },
415
- "loading": {
416
- "complexType": {
417
- "signature": "() => Promise<HTMLElement>",
418
- "parameters": [],
419
- "references": {
420
- "Promise": {
421
- "location": "global"
422
- },
423
- "HTMLElement": {
424
- "location": "global"
425
- }
426
- },
427
- "return": "Promise<HTMLElement>"
428
- },
429
- "docs": {
430
- "text": "",
431
- "tags": []
432
- }
433
- },
434
- "stopLoading": {
435
- "complexType": {
436
- "signature": "() => Promise<HTMLElement>",
437
- "parameters": [],
438
- "references": {
439
- "Promise": {
440
- "location": "global"
441
- },
442
- "HTMLElement": {
443
- "location": "global"
444
- }
445
- },
446
- "return": "Promise<HTMLElement>"
447
- },
448
- "docs": {
449
- "text": "",
450
- "tags": []
451
- }
452
- }
453
- }; }
454
- static get elementRef() { return "host"; }
455
- static get watchers() { return [{
456
- "propName": "visible",
457
- "methodName": "handleVisible"
458
- }]; }
459
- }
@@ -1,81 +0,0 @@
1
- import { Component, h, Element, Method, State } from '@stencil/core';
2
- export class SallaOffer {
3
- constructor() {
4
- this.offer = null;
5
- salla.offer.event.onExisted(data => {
6
- //TODO:: use the best, should we hide the offer by product Id or Offer id🤔
7
- if (salla.localStore.get('remember-offer-' + data.offer.offer_id)) {
8
- salla.log('User selected to don\'t show this offer again.');
9
- return;
10
- }
11
- this.show(data.product_id);
12
- });
13
- }
14
- async show(productId) {
15
- this.modal.show()
16
- .then(() => salla.api.offer.details(productId))
17
- //TODO:: make sure there is only one offer
18
- .then(response => this.offer = response.data[0])
19
- .then(() => console.log(this.offer));
20
- }
21
- rememberMe(event) {
22
- salla.localStore.set('remember-offer-' + this.offer.id, event.target.checked);
23
- }
24
- render() {
25
- var _a, _b;
26
- return h("salla-modal", { ref: modal => this.modal = modal, "is-loading": this.offer === null }, this.offer !== null
27
- ? [h("div", { class: "s-offer-header" },
28
- h("b", { class: "s-offer-title" }, this.offer.name),
29
- h("h3", { class: "s-offer-subtitle" }, this.offer.message)),
30
- h("div", { class: "s-offer-body" }, ((_a = this.offer.get.categories) === null || _a === void 0 ? void 0 : _a.length) > 0
31
- ? this.offer.get.categories.map(category => h("a", { href: category.urls.customer, class: "s-offer-badge" },
32
- h("i", { class: "s-offer-badge-icon sicon-tag" }),
33
- h("span", { class: "s-offer-badge-text" }, category.name)))
34
- : (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => h("div", { class: "s-offer-product" },
35
- "- ",
36
- product.name))),
37
- h("div", { class: "s-offer-footer" },
38
- this.offer.expiry_date ?
39
- h("p", { class: "s-offer-expiry" },
40
- salla.lang.get('pages.products.offer_expires_in'),
41
- " ",
42
- this.offer.expiry_date)
43
- : '',
44
- h("label", { class: "s-offer-remember-label" },
45
- h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-remember-input" }),
46
- "\u00A0 ",
47
- salla.lang.get('common.remember_my_choice'))),
48
- ] : '');
49
- }
50
- componentDidRender() {
51
- //todo:: now from where there is hidden attributes to the doms🤔
52
- //todo:: add animation
53
- this.modal.querySelectorAll('[hidden]').forEach(el => el.removeAttribute('hidden'));
54
- }
55
- static get is() { return "salla-offer"; }
56
- static get states() { return {
57
- "offer": {}
58
- }; }
59
- static get methods() { return {
60
- "show": {
61
- "complexType": {
62
- "signature": "(productId: number) => Promise<void>",
63
- "parameters": [{
64
- "tags": [],
65
- "text": ""
66
- }],
67
- "references": {
68
- "Promise": {
69
- "location": "global"
70
- }
71
- },
72
- "return": "Promise<void>"
73
- },
74
- "docs": {
75
- "text": "",
76
- "tags": []
77
- }
78
- }
79
- }; }
80
- static get elementRef() { return "host"; }
81
- }