@salla.sa/twilight-components 1.0.15 → 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 (75) hide show
  1. package/dist/cjs/index.cjs.js +2 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/salla-branches.cjs.entry.js +5 -5
  4. package/dist/cjs/salla-button_4.cjs.entry.js +299 -0
  5. package/dist/cjs/salla-localization.cjs.entry.js +27 -24
  6. package/dist/cjs/salla-login-342876b9.js +118 -0
  7. package/dist/cjs/salla-offer.cjs.entry.js +25 -0
  8. package/dist/cjs/salla-product-availability.cjs.entry.js +1 -1
  9. package/dist/cjs/salla-rating.cjs.entry.js +155 -158
  10. package/dist/cjs/{salla-search-311c7053.js → salla-search-28da4616.js} +2 -2
  11. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  12. package/dist/cjs/twilight-components.cjs.js +1 -1
  13. package/dist/collection/collection-manifest.json +1 -0
  14. package/dist/collection/components/salla-branches/salla-branches.js +26 -28
  15. package/dist/collection/components/salla-button/salla-button.js +26 -23
  16. package/dist/collection/components/salla-localization/salla-localization.js +35 -29
  17. package/dist/collection/components/salla-login/salla-login.js +343 -26
  18. package/dist/collection/components/salla-modal/salla-modal.js +144 -45
  19. package/dist/collection/components/salla-offer/salla-offer.js +40 -0
  20. package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
  21. package/dist/collection/components/salla-rating/salla-rating.css +4 -0
  22. package/dist/collection/components/salla-rating/salla-rating.js +206 -211
  23. package/dist/collection/components/salla-search/salla-search.js +3 -3
  24. package/dist/collection/components/salla-verify/salla-verify.js +160 -21
  25. package/dist/collection/plugins/tailwind-theme/generator.js +21 -12
  26. package/dist/collection/plugins/tailwind-theme/index.js +9 -9
  27. package/dist/esm/index.js +2 -2
  28. package/dist/esm/loader.js +1 -1
  29. package/dist/esm/salla-branches.entry.js +5 -5
  30. package/dist/esm/salla-button_4.entry.js +292 -0
  31. package/dist/esm/salla-localization.entry.js +27 -24
  32. package/dist/esm/salla-login-32d25ffa.js +116 -0
  33. package/dist/esm/salla-offer.entry.js +21 -0
  34. package/dist/esm/salla-product-availability.entry.js +1 -1
  35. package/dist/esm/salla-rating.entry.js +155 -158
  36. package/dist/esm/{salla-search-add7bdb6.js → salla-search-f552c487.js} +2 -2
  37. package/dist/esm/salla-search.entry.js +1 -1
  38. package/dist/esm/twilight-components.js +1 -1
  39. package/dist/twilight-components/index.esm.js +1 -1
  40. package/dist/twilight-components/{p-d584d0c7.entry.js → p-33990e49.entry.js} +1 -1
  41. package/dist/twilight-components/p-36683152.js +1 -0
  42. package/dist/twilight-components/p-3cfede65.entry.js +1 -0
  43. package/dist/twilight-components/p-648661c8.entry.js +1 -0
  44. package/dist/twilight-components/p-93c3ac79.js +1 -0
  45. package/dist/twilight-components/p-a923a51e.entry.js +1 -0
  46. package/dist/twilight-components/p-bc278b0e.entry.js +1 -0
  47. package/dist/twilight-components/p-fa04c4b6.entry.js +1 -0
  48. package/dist/twilight-components/p-fa2f0e64.entry.js +1 -0
  49. package/dist/twilight-components/twilight-components.esm.js +1 -1
  50. package/dist/types/components/salla-button/salla-button.d.ts +3 -2
  51. package/dist/types/components/salla-localization/salla-localization.d.ts +8 -0
  52. package/dist/types/components/salla-login/salla-login.d.ts +39 -0
  53. package/dist/types/components/salla-modal/salla-modal.d.ts +12 -4
  54. package/dist/types/components/salla-offer/salla-offer.d.ts +8 -0
  55. package/dist/types/components/salla-rating/salla-rating.d.ts +23 -9
  56. package/dist/types/components/salla-verify/salla-verify.d.ts +16 -6
  57. package/dist/types/components.d.ts +94 -8
  58. package/package.json +2 -1
  59. package/dist/cjs/salla-button.cjs.entry.js +0 -77
  60. package/dist/cjs/salla-login-6a54572d.js +0 -14
  61. package/dist/cjs/salla-login_2.cjs.entry.js +0 -97
  62. package/dist/cjs/salla-verify.cjs.entry.js +0 -96
  63. package/dist/esm/salla-button.entry.js +0 -73
  64. package/dist/esm/salla-login-c9c9fa57.js +0 -12
  65. package/dist/esm/salla-login_2.entry.js +0 -92
  66. package/dist/esm/salla-verify.entry.js +0 -92
  67. package/dist/twilight-components/p-010b8dfd.entry.js +0 -1
  68. package/dist/twilight-components/p-0ceecf63.js +0 -1
  69. package/dist/twilight-components/p-32d29245.entry.js +0 -1
  70. package/dist/twilight-components/p-50e70ad4.entry.js +0 -1
  71. package/dist/twilight-components/p-68c9f122.entry.js +0 -1
  72. package/dist/twilight-components/p-8126278e.entry.js +0 -1
  73. package/dist/twilight-components/p-9d327a79.entry.js +0 -1
  74. package/dist/twilight-components/p-b05450bc.entry.js +0 -1
  75. package/dist/twilight-components/p-bd5da080.js +0 -1
@@ -1,14 +1,20 @@
1
- import { Component, h, Prop, Host, Element, Event, Watch, Method } from '@stencil/core';
1
+ import { Component, h, Prop, Host, Element, Event, Watch, Method, State } from '@stencil/core';
2
2
  import Helper from "../../Helpers/Helper";
3
- //todo:: button component
3
+ /**
4
+ * @slot body - The content of modal
5
+ * @slot footer - The footer of modal
6
+ */
4
7
  export class SallaModal {
5
8
  constructor() {
6
9
  var _a;
10
+ //todo:: unite three colors (error, success, primary) in one prop
7
11
  this.error = false;
8
12
  this.success = false;
13
+ this.primary = false;
9
14
  this.isClosable = true;
10
- this.modalWidth = 'w-96'; //todo use friendly names
15
+ this.width = 'md';
11
16
  this.visible = false;
17
+ this.isLoading = false;
12
18
  this.subTitleFirst = false;
13
19
  this.subTitle = '';
14
20
  this.icon = '';
@@ -18,17 +24,17 @@ export class SallaModal {
18
24
  salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
19
25
  this.title = this.host.title;
20
26
  this.host.removeAttribute('title');
21
- (_a = Helper.getElement('[slot=body]')) === null || _a === void 0 ? void 0 : _a.classList.add('s-modal-body');
27
+ (_a = Helper.getElement('[slot=body]')) === null || _a === void 0 ? void 0 : _a.classList.add('s-modal-body', 's-modal-' + this.width);
22
28
  }
23
29
  handleVisible(newValue) {
24
30
  if (!newValue) {
25
31
  this.toggleModal(false);
26
- this.close.emit();
32
+ this.modalClosed.emit();
27
33
  return;
28
34
  }
29
35
  this.host.classList.remove('hidden');
30
36
  setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
31
- this.ready.emit();
37
+ this.modalOpened.emit();
32
38
  }
33
39
  async show() {
34
40
  this.host.setAttribute('visible', '');
@@ -42,10 +48,20 @@ export class SallaModal {
42
48
  this.title = title;
43
49
  return this.host;
44
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
+ }
45
59
  toggleModal(isOpen) {
46
- Helper.toggleElement(this.host.querySelector('.s-modal-body'), 's-modal-entering', 's-modal-leaving', () => isOpen)
47
- .toggleElement(this.host.querySelector('[slot=body]'), 's-modal-entering', 's-modal-leaving', () => 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)
48
63
  .toggleElement(this.overlay, 's-modal-entering', 's-modal-overlay-leaving', () => isOpen)
64
+ //todo:: use united class names
49
65
  .toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
50
66
  if (!isOpen) {
51
67
  setTimeout(() => this.host.classList.add('hidden'), 350);
@@ -60,39 +76,45 @@ export class SallaModal {
60
76
  //todo:: pref for each modal
61
77
  render() {
62
78
  this.host.id = this.host.id || 'salla-modal';
63
- return (h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" },
79
+ return (
80
+ //todo:: use suitable class name instead of hidden
81
+ h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" },
64
82
  h("div", { class: "s-modal-wrapper" },
65
83
  h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }),
66
84
  h("span", { class: "s-modal-spacer" }, "\u200B"),
67
85
  h("slot", { name: "body" },
68
- h("div", { class: 's-modal-body ' + this.modalWidth },
69
- h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } },
70
- this.isClosable ?
71
- h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" },
72
- h("span", { class: "sicon-cancel" }))
73
- : '',
74
- this.error || this.success || this.icon
75
- ? h("div", { class: {
76
- 's-modal-icon': true,
77
- 's-modal-bg-error': this.error,
78
- 's-modal-bg-success': this.success,
79
- 's-modal-bg-normal': !this.error && !this.success
80
- } },
81
- h("i", { class: {
82
- [this.icon]: true,
83
- 's-modal-text-error': this.error,
84
- 's-modal-text-success': this.success,
85
- } }))
86
- : this.imageIcon ?
87
- h("img", { class: "s-modal-header-img", src: this.imageIcon })
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" }))
88
93
  : '',
89
- this.title || this.subTitle ?
90
- h("div", { class: "s-modal-header-content" },
91
- h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.title }),
92
- h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle }))
93
- : ''),
94
- h("slot", null),
95
- h("slot", { name: "footer" }))))));
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
+ ])))));
96
118
  }
97
119
  static get is() { return "salla-modal"; }
98
120
  static get properties() { return {
@@ -132,6 +154,24 @@ export class SallaModal {
132
154
  "reflect": false,
133
155
  "defaultValue": "false"
134
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
+ },
135
175
  "isClosable": {
136
176
  "type": "boolean",
137
177
  "mutable": true,
@@ -150,12 +190,12 @@ export class SallaModal {
150
190
  "reflect": false,
151
191
  "defaultValue": "true"
152
192
  },
153
- "modalWidth": {
193
+ "width": {
154
194
  "type": "string",
155
195
  "mutable": false,
156
196
  "complexType": {
157
- "original": "string",
158
- "resolved": "string",
197
+ "original": "'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full'",
198
+ "resolved": "\"full\" | \"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\"",
159
199
  "references": {}
160
200
  },
161
201
  "required": false,
@@ -164,9 +204,9 @@ export class SallaModal {
164
204
  "tags": [],
165
205
  "text": ""
166
206
  },
167
- "attribute": "modal-width",
207
+ "attribute": "width",
168
208
  "reflect": true,
169
- "defaultValue": "'w-96'"
209
+ "defaultValue": "'md'"
170
210
  },
171
211
  "visible": {
172
212
  "type": "boolean",
@@ -186,6 +226,24 @@ export class SallaModal {
186
226
  "reflect": true,
187
227
  "defaultValue": "false"
188
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
+ },
189
247
  "subTitleFirst": {
190
248
  "type": "boolean",
191
249
  "mutable": false,
@@ -259,9 +317,12 @@ export class SallaModal {
259
317
  "defaultValue": "''"
260
318
  }
261
319
  }; }
320
+ static get states() { return {
321
+ "title": {}
322
+ }; }
262
323
  static get events() { return [{
263
- "method": "ready",
264
- "name": "ready",
324
+ "method": "modalOpened",
325
+ "name": "modalOpened",
265
326
  "bubbles": true,
266
327
  "cancelable": true,
267
328
  "composed": true,
@@ -275,8 +336,8 @@ export class SallaModal {
275
336
  "references": {}
276
337
  }
277
338
  }, {
278
- "method": "close",
279
- "name": "close",
339
+ "method": "modalClosed",
340
+ "name": "modalClosed",
280
341
  "bubbles": true,
281
342
  "cancelable": true,
282
343
  "composed": true,
@@ -350,6 +411,44 @@ export class SallaModal {
350
411
  "text": "",
351
412
  "tags": []
352
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
+ }
353
452
  }
354
453
  }; }
355
454
  static get elementRef() { return "host"; }
@@ -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
+ }
@@ -54,7 +54,7 @@ export class SallaProductAvailability {
54
54
  this.isUser || this.isSubscribed ? '' : this.renderModal()));
55
55
  }
56
56
  renderModal() {
57
- return (h("salla-modal", { ref: modal => this.modal = modal, title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", modalWidth: "w-96" },
57
+ return (h("salla-modal", { ref: modal => this.modal = modal, title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", width: "md" },
58
58
  h("div", { class: "s-product-availability-body" },
59
59
  this.channels_.includes('email') ? [
60
60
  h("label", { class: "s-product-availability-label" }, this.emailLabel),
@@ -1,3 +1,7 @@
1
1
  :host {
2
2
  display: block;
3
3
  }
4
+
5
+ .unicode{
6
+ unicode-bidi: plaintext;
7
+ }