@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.
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-branches.cjs.entry.js +5 -5
- package/dist/cjs/salla-button_4.cjs.entry.js +299 -0
- package/dist/cjs/salla-localization.cjs.entry.js +27 -24
- package/dist/cjs/salla-login-342876b9.js +118 -0
- package/dist/cjs/salla-offer.cjs.entry.js +25 -0
- package/dist/cjs/salla-product-availability.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating.cjs.entry.js +155 -158
- package/dist/cjs/{salla-search-311c7053.js → salla-search-28da4616.js} +2 -2
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-branches/salla-branches.js +26 -28
- package/dist/collection/components/salla-button/salla-button.js +26 -23
- package/dist/collection/components/salla-localization/salla-localization.js +35 -29
- package/dist/collection/components/salla-login/salla-login.js +343 -26
- package/dist/collection/components/salla-modal/salla-modal.js +144 -45
- package/dist/collection/components/salla-offer/salla-offer.js +40 -0
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
- package/dist/collection/components/salla-rating/salla-rating.css +4 -0
- package/dist/collection/components/salla-rating/salla-rating.js +206 -211
- package/dist/collection/components/salla-search/salla-search.js +3 -3
- package/dist/collection/components/salla-verify/salla-verify.js +160 -21
- package/dist/collection/plugins/tailwind-theme/generator.js +21 -12
- package/dist/collection/plugins/tailwind-theme/index.js +9 -9
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-branches.entry.js +5 -5
- package/dist/esm/salla-button_4.entry.js +292 -0
- package/dist/esm/salla-localization.entry.js +27 -24
- package/dist/esm/salla-login-32d25ffa.js +116 -0
- package/dist/esm/salla-offer.entry.js +21 -0
- package/dist/esm/salla-product-availability.entry.js +1 -1
- package/dist/esm/salla-rating.entry.js +155 -158
- package/dist/esm/{salla-search-add7bdb6.js → salla-search-f552c487.js} +2 -2
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/{p-d584d0c7.entry.js → p-33990e49.entry.js} +1 -1
- package/dist/twilight-components/p-36683152.js +1 -0
- package/dist/twilight-components/p-3cfede65.entry.js +1 -0
- package/dist/twilight-components/p-648661c8.entry.js +1 -0
- package/dist/twilight-components/p-93c3ac79.js +1 -0
- package/dist/twilight-components/p-a923a51e.entry.js +1 -0
- package/dist/twilight-components/p-bc278b0e.entry.js +1 -0
- package/dist/twilight-components/p-fa04c4b6.entry.js +1 -0
- package/dist/twilight-components/p-fa2f0e64.entry.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-button/salla-button.d.ts +3 -2
- package/dist/types/components/salla-localization/salla-localization.d.ts +8 -0
- package/dist/types/components/salla-login/salla-login.d.ts +39 -0
- package/dist/types/components/salla-modal/salla-modal.d.ts +12 -4
- package/dist/types/components/salla-offer/salla-offer.d.ts +8 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +23 -9
- package/dist/types/components/salla-verify/salla-verify.d.ts +16 -6
- package/dist/types/components.d.ts +94 -8
- package/package.json +2 -1
- package/dist/cjs/salla-button.cjs.entry.js +0 -77
- package/dist/cjs/salla-login-6a54572d.js +0 -14
- package/dist/cjs/salla-login_2.cjs.entry.js +0 -97
- package/dist/cjs/salla-verify.cjs.entry.js +0 -96
- package/dist/esm/salla-button.entry.js +0 -73
- package/dist/esm/salla-login-c9c9fa57.js +0 -12
- package/dist/esm/salla-login_2.entry.js +0 -92
- package/dist/esm/salla-verify.entry.js +0 -92
- package/dist/twilight-components/p-010b8dfd.entry.js +0 -1
- package/dist/twilight-components/p-0ceecf63.js +0 -1
- package/dist/twilight-components/p-32d29245.entry.js +0 -1
- package/dist/twilight-components/p-50e70ad4.entry.js +0 -1
- package/dist/twilight-components/p-68c9f122.entry.js +0 -1
- package/dist/twilight-components/p-8126278e.entry.js +0 -1
- package/dist/twilight-components/p-9d327a79.entry.js +0 -1
- package/dist/twilight-components/p-b05450bc.entry.js +0 -1
- 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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
47
|
-
.toggleElement(this.host.querySelector('
|
|
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 (
|
|
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.
|
|
69
|
-
h("
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
"
|
|
193
|
+
"width": {
|
|
154
194
|
"type": "string",
|
|
155
195
|
"mutable": false,
|
|
156
196
|
"complexType": {
|
|
157
|
-
"original": "
|
|
158
|
-
"resolved": "
|
|
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": "
|
|
207
|
+
"attribute": "width",
|
|
168
208
|
"reflect": true,
|
|
169
|
-
"defaultValue": "'
|
|
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": "
|
|
264
|
-
"name": "
|
|
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": "
|
|
279
|
-
"name": "
|
|
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",
|
|
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),
|