@salla.sa/twilight-components 1.0.16 → 1.0.17

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 (93) hide show
  1. package/dist/cjs/Helper-8852feaa.js +23 -0
  2. package/dist/cjs/index-0b5b5867.js +1656 -0
  3. package/dist/cjs/index.cjs.js +13 -0
  4. package/dist/cjs/loader.cjs.js +21 -0
  5. package/dist/cjs/salla-branches.cjs.entry.js +92 -0
  6. package/dist/cjs/salla-button_4.cjs.entry.js +299 -0
  7. package/dist/cjs/salla-localization.cjs.entry.js +80 -0
  8. package/dist/cjs/salla-login-342876b9.js +118 -0
  9. package/dist/cjs/salla-offer.cjs.entry.js +25 -0
  10. package/dist/cjs/salla-product-availability.cjs.entry.js +75 -0
  11. package/dist/cjs/salla-rating.cjs.entry.js +300 -0
  12. package/dist/cjs/salla-search-28da4616.js +81 -0
  13. package/dist/cjs/salla-search.cjs.entry.js +11 -0
  14. package/dist/cjs/twilight-components.cjs.js +19 -0
  15. package/dist/collection/Helpers/Helper.js +19 -0
  16. package/dist/collection/collection-manifest.json +21 -0
  17. package/dist/collection/components/generate-summary.js +35 -0
  18. package/dist/collection/components/salla-branches/salla-branches.css +12 -0
  19. package/dist/collection/components/salla-branches/salla-branches.js +233 -0
  20. package/dist/collection/components/salla-button/salla-button.css +3 -0
  21. package/dist/collection/components/salla-button/salla-button.js +246 -0
  22. package/dist/collection/components/salla-localization/salla-localization.js +206 -0
  23. package/dist/collection/components/salla-login/salla-login.js +348 -0
  24. package/dist/collection/components/salla-modal/salla-modal.js +459 -0
  25. package/dist/collection/components/salla-offer/salla-offer.js +40 -0
  26. package/dist/collection/components/salla-product-availability/salla-product-availability.js +331 -0
  27. package/dist/collection/components/salla-rating/salla-rating.css +7 -0
  28. package/dist/collection/components/salla-rating/salla-rating.js +483 -0
  29. package/dist/collection/components/salla-search/salla-search.js +132 -0
  30. package/dist/collection/components/salla-verify/salla-verify.js +238 -0
  31. package/dist/collection/index.js +2 -0
  32. package/dist/collection/interfaces/colors.js +1 -0
  33. package/dist/collection/interfaces/index.js +2 -0
  34. package/dist/collection/interfaces/ratio.js +1 -0
  35. package/dist/collection/plugins/tailwind-theme/generator.js +62 -0
  36. package/dist/collection/plugins/tailwind-theme/index.js +26 -0
  37. package/dist/{twilight-components → esm}/Helper-81ac9a8c.js +0 -0
  38. package/dist/esm/index-8b97d225.js +1628 -0
  39. package/dist/esm/index.js +4 -0
  40. package/dist/esm/loader.js +17 -0
  41. package/dist/esm/polyfills/core-js.js +11 -0
  42. package/dist/esm/polyfills/css-shim.js +1 -0
  43. package/dist/esm/polyfills/dom.js +79 -0
  44. package/dist/esm/polyfills/es5-html-element.js +1 -0
  45. package/dist/esm/polyfills/index.js +34 -0
  46. package/dist/esm/polyfills/system.js +6 -0
  47. package/dist/{twilight-components → esm}/salla-branches.entry.js +6 -6
  48. package/dist/esm/salla-button_4.entry.js +292 -0
  49. package/dist/esm/salla-localization.entry.js +76 -0
  50. package/dist/esm/salla-login-32d25ffa.js +116 -0
  51. package/dist/esm/salla-offer.entry.js +21 -0
  52. package/dist/{twilight-components → esm}/salla-product-availability.entry.js +2 -2
  53. package/dist/{twilight-components → esm}/salla-rating.entry.js +73 -70
  54. package/dist/{twilight-components/salla-search-5338c0a1.js → esm/salla-search-f552c487.js} +1 -1
  55. package/dist/esm/salla-search.entry.js +3 -0
  56. package/dist/esm/twilight-components.js +17 -0
  57. package/dist/index.cjs.js +1 -0
  58. package/dist/index.js +1 -0
  59. package/dist/twilight-components/index.esm.js +1 -4
  60. package/dist/twilight-components/p-33990e49.entry.js +1 -0
  61. package/dist/twilight-components/p-36683152.js +1 -0
  62. package/dist/twilight-components/p-3cfede65.entry.js +1 -0
  63. package/dist/twilight-components/p-648661c8.entry.js +1 -0
  64. package/dist/twilight-components/p-93c3ac79.js +1 -0
  65. package/dist/twilight-components/p-9bc28e0c.js +1 -0
  66. package/dist/twilight-components/p-a923a51e.entry.js +1 -0
  67. package/dist/twilight-components/p-bc278b0e.entry.js +1 -0
  68. package/dist/twilight-components/p-cb1c59a2.js +1 -0
  69. package/dist/twilight-components/p-fa04c4b6.entry.js +1 -0
  70. package/dist/twilight-components/p-fa2f0e64.entry.js +1 -0
  71. package/dist/twilight-components/twilight-components.css +1 -3
  72. package/dist/twilight-components/twilight-components.esm.js +1 -125
  73. package/dist/types/components/salla-button/salla-button.d.ts +3 -2
  74. package/dist/types/components/salla-localization/salla-localization.d.ts +8 -0
  75. package/dist/types/components/salla-login/salla-login.d.ts +39 -0
  76. package/dist/types/components/salla-modal/salla-modal.d.ts +12 -4
  77. package/dist/types/components/salla-offer/salla-offer.d.ts +8 -0
  78. package/dist/types/components/salla-rating/salla-rating.d.ts +17 -2
  79. package/dist/types/components/salla-verify/salla-verify.d.ts +16 -6
  80. package/dist/types/components.d.ts +94 -8
  81. package/package.json +2 -1
  82. package/dist/twilight-components/app-globals-0f993ce5.js +0 -3
  83. package/dist/twilight-components/css-shim-a64b8820.js +0 -4
  84. package/dist/twilight-components/dom-d08ba8aa.js +0 -73
  85. package/dist/twilight-components/index-8966d27f.js +0 -3010
  86. package/dist/twilight-components/salla-button.entry.js +0 -73
  87. package/dist/twilight-components/salla-localization.entry.js +0 -73
  88. package/dist/twilight-components/salla-login-4d620368.js +0 -12
  89. package/dist/twilight-components/salla-login.entry.js +0 -2
  90. package/dist/twilight-components/salla-modal.entry.js +0 -91
  91. package/dist/twilight-components/salla-search.entry.js +0 -3
  92. package/dist/twilight-components/salla-verify.entry.js +0 -92
  93. package/dist/twilight-components/shadow-css-bc14d9fd.js +0 -389
@@ -0,0 +1,459 @@
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
+ }
@@ -0,0 +1,40 @@
1
+ import { Component, h, Element, Method } from '@stencil/core';
2
+ export class SallaOffer {
3
+ constructor() {
4
+ salla.offer.event.onExisted(data => this.show(data.offer.offer_id));
5
+ }
6
+ async show(offerId) {
7
+ this.modal.show();
8
+ console.log(offerId);
9
+ }
10
+ render() {
11
+ return h("salla-modal", { ref: modal => this.modal = modal, "is-loading": true },
12
+ h("slot", null));
13
+ }
14
+ componentDidLoad() {
15
+ //
16
+ }
17
+ static get is() { return "salla-offer"; }
18
+ static get methods() { return {
19
+ "show": {
20
+ "complexType": {
21
+ "signature": "(offerId: number) => Promise<void>",
22
+ "parameters": [{
23
+ "tags": [],
24
+ "text": ""
25
+ }],
26
+ "references": {
27
+ "Promise": {
28
+ "location": "global"
29
+ }
30
+ },
31
+ "return": "Promise<void>"
32
+ },
33
+ "docs": {
34
+ "text": "",
35
+ "tags": []
36
+ }
37
+ }
38
+ }; }
39
+ static get elementRef() { return "host"; }
40
+ }