@salla.sa/twilight-components 1.0.6 → 1.0.7
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-e9451c82.js → index-23da2c6b.js} +159 -4
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/multi-warehouse_3.cjs.entry.js +155 -0
- package/dist/cjs/order-rating.cjs.entry.js +227 -0
- package/dist/cjs/salla-button.cjs.entry.js +56 -0
- package/dist/cjs/salla-localization.cjs.entry.js +49 -0
- package/dist/cjs/{salla-login-3ec94029.js → salla-login-476fb312.js} +1 -1
- package/dist/cjs/{salla-search-2b1d67e4.js → salla-search-b9403062.js} +7 -7
- package/dist/cjs/salla-search.cjs.entry.js +2 -2
- package/dist/cjs/twilight-components.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +7 -4
- package/dist/collection/components/multi-warehouse/multi-warehouse.js +239 -0
- package/dist/collection/components/order-rating/order-rating.css +3 -0
- package/dist/collection/components/order-rating/order-rating.js +288 -0
- package/dist/collection/components/salla-button/salla-button.css +3 -0
- package/dist/collection/components/salla-button/salla-button.js +167 -0
- package/dist/collection/components/salla-localization/salla-localization.js +106 -0
- package/dist/collection/components/{login → salla-login}/salla-login.js +0 -0
- package/dist/collection/components/{modal → salla-modal}/salla-modal.js +115 -18
- package/dist/collection/components/{search → salla-search}/salla-search.js +21 -21
- package/dist/collection/index.js +2 -2
- package/dist/collection/plugins/tailwind-theme/generator.js +1 -1
- package/dist/esm/{index-8919a244.js → index-643344dc.js} +159 -4
- package/dist/esm/index.js +3 -3
- package/dist/esm/loader.js +2 -2
- package/dist/esm/multi-warehouse_3.entry.js +149 -0
- package/dist/esm/order-rating.entry.js +223 -0
- package/dist/esm/salla-button.entry.js +52 -0
- package/dist/esm/salla-localization.entry.js +45 -0
- package/dist/esm/{salla-login-4aa5bb90.js → salla-login-0e85b2d8.js} +1 -1
- package/dist/esm/{salla-search-bd2f71b3.js → salla-search-5d4a6f1a.js} +7 -7
- package/dist/esm/salla-search.entry.js +2 -2
- package/dist/esm/twilight-components.js +2 -2
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/{p-41dc89e6.js → p-36c87e2e.js} +1 -1
- package/dist/twilight-components/p-4b137380.js +1 -0
- package/dist/twilight-components/p-4cc11ee2.entry.js +1 -0
- package/dist/twilight-components/p-60f0446f.entry.js +1 -0
- package/dist/twilight-components/p-b490f9e0.entry.js +1 -0
- package/dist/twilight-components/p-b72e6cfa.entry.js +1 -0
- package/dist/twilight-components/p-baeca520.entry.js +1 -0
- package/dist/twilight-components/p-d1ef2268.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/multi-warehouse/multi-warehouse.d.ts +23 -0
- package/dist/types/components/order-rating/order-rating.d.ts +16 -0
- package/dist/types/components/salla-button/salla-button.d.ts +15 -0
- package/dist/types/components/salla-localization/salla-localization.d.ts +10 -0
- package/dist/types/components/{login → salla-login}/salla-login.d.ts +0 -0
- package/dist/types/components/{modal → salla-modal}/salla-modal.d.ts +6 -2
- package/dist/types/components/{search → salla-search}/salla-search.d.ts +0 -0
- package/dist/types/components.d.ts +78 -11
- package/dist/types/index.d.ts +2 -2
- package/package.json +10 -6
- package/dist/cjs/salla-currency-language.cjs.entry.js +0 -46
- package/dist/cjs/salla-login_2.cjs.entry.js +0 -57
- package/dist/collection/components/currency-language/salla-currency-language.js +0 -97
- package/dist/esm/salla-currency-language.entry.js +0 -42
- package/dist/esm/salla-login_2.entry.js +0 -52
- package/dist/twilight-components/p-1abaafe4.entry.js +0 -1
- package/dist/twilight-components/p-58b1afae.js +0 -1
- package/dist/twilight-components/p-840f0daa.entry.js +0 -1
- package/dist/twilight-components/p-9f9af3e0.js +0 -1
- package/dist/twilight-components/p-b134c95d.entry.js +0 -1
- package/dist/types/components/currency-language/salla-currency-language.d.ts +0 -10
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Component, Element, h, Method, Prop, Watch } from '@stencil/core';
|
|
2
|
+
import Helper from "../../Helpers/Helper";
|
|
3
|
+
export class SallaButton {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.kind = 'primary';
|
|
6
|
+
this.loading = false;
|
|
7
|
+
this.hostAttributes = {};
|
|
8
|
+
for (let i = 0; i < this.host.attributes.length; i++) {
|
|
9
|
+
this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
|
|
10
|
+
}
|
|
11
|
+
this.hostAttributes['type'] = this.hostAttributes['type'] || 'button';
|
|
12
|
+
this.hostAttributes['class'] = (this.hostAttributes['class'] || '') + ' s-button-btn btn--has-loading btn-' + this.kind;
|
|
13
|
+
delete this.hostAttributes['kind'];
|
|
14
|
+
delete this.hostAttributes['id'];
|
|
15
|
+
}
|
|
16
|
+
async load() {
|
|
17
|
+
this.host.setAttribute('loading', '');
|
|
18
|
+
return this.host;
|
|
19
|
+
}
|
|
20
|
+
async stop() {
|
|
21
|
+
this.host.removeAttribute('loading');
|
|
22
|
+
return this.host;
|
|
23
|
+
}
|
|
24
|
+
async disable() {
|
|
25
|
+
this.btn.setAttribute('disabled', '');
|
|
26
|
+
}
|
|
27
|
+
async enable() {
|
|
28
|
+
this.btn.removeAttribute('disabled');
|
|
29
|
+
}
|
|
30
|
+
handleVisible(newKind, oldKind) {
|
|
31
|
+
this.btn.classList.remove('btn-' + oldKind);
|
|
32
|
+
this.btn.classList.add('btn-' + newKind);
|
|
33
|
+
}
|
|
34
|
+
handleLoading(newVal) {
|
|
35
|
+
Helper.toggleElement(this.btn, 'btn--is-loading', 'btn--no-loading', () => newVal);
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return (h("button", Object.assign({ ref: el => this.btn = el }, this.hostAttributes),
|
|
39
|
+
h("slot", null),
|
|
40
|
+
this.loading ? h("span", { class: "loader loader--small s-button-loader" }) : ''));
|
|
41
|
+
}
|
|
42
|
+
static get is() { return "salla-button"; }
|
|
43
|
+
static get originalStyleUrls() { return {
|
|
44
|
+
"$": ["salla-button.css"]
|
|
45
|
+
}; }
|
|
46
|
+
static get styleUrls() { return {
|
|
47
|
+
"$": ["salla-button.css"]
|
|
48
|
+
}; }
|
|
49
|
+
static get properties() { return {
|
|
50
|
+
"kind": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"mutable": false,
|
|
53
|
+
"complexType": {
|
|
54
|
+
"original": "string",
|
|
55
|
+
"resolved": "string",
|
|
56
|
+
"references": {}
|
|
57
|
+
},
|
|
58
|
+
"required": false,
|
|
59
|
+
"optional": false,
|
|
60
|
+
"docs": {
|
|
61
|
+
"tags": [],
|
|
62
|
+
"text": ""
|
|
63
|
+
},
|
|
64
|
+
"attribute": "kind",
|
|
65
|
+
"reflect": true,
|
|
66
|
+
"defaultValue": "'primary'"
|
|
67
|
+
},
|
|
68
|
+
"loading": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"mutable": false,
|
|
71
|
+
"complexType": {
|
|
72
|
+
"original": "boolean",
|
|
73
|
+
"resolved": "boolean",
|
|
74
|
+
"references": {}
|
|
75
|
+
},
|
|
76
|
+
"required": false,
|
|
77
|
+
"optional": false,
|
|
78
|
+
"docs": {
|
|
79
|
+
"tags": [],
|
|
80
|
+
"text": ""
|
|
81
|
+
},
|
|
82
|
+
"attribute": "loading",
|
|
83
|
+
"reflect": true,
|
|
84
|
+
"defaultValue": "false"
|
|
85
|
+
}
|
|
86
|
+
}; }
|
|
87
|
+
static get methods() { return {
|
|
88
|
+
"load": {
|
|
89
|
+
"complexType": {
|
|
90
|
+
"signature": "() => Promise<HTMLElement>",
|
|
91
|
+
"parameters": [],
|
|
92
|
+
"references": {
|
|
93
|
+
"Promise": {
|
|
94
|
+
"location": "global"
|
|
95
|
+
},
|
|
96
|
+
"HTMLElement": {
|
|
97
|
+
"location": "global"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"return": "Promise<HTMLElement>"
|
|
101
|
+
},
|
|
102
|
+
"docs": {
|
|
103
|
+
"text": "",
|
|
104
|
+
"tags": []
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"stop": {
|
|
108
|
+
"complexType": {
|
|
109
|
+
"signature": "() => Promise<HTMLElement>",
|
|
110
|
+
"parameters": [],
|
|
111
|
+
"references": {
|
|
112
|
+
"Promise": {
|
|
113
|
+
"location": "global"
|
|
114
|
+
},
|
|
115
|
+
"HTMLElement": {
|
|
116
|
+
"location": "global"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"return": "Promise<HTMLElement>"
|
|
120
|
+
},
|
|
121
|
+
"docs": {
|
|
122
|
+
"text": "",
|
|
123
|
+
"tags": []
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"disable": {
|
|
127
|
+
"complexType": {
|
|
128
|
+
"signature": "() => Promise<void>",
|
|
129
|
+
"parameters": [],
|
|
130
|
+
"references": {
|
|
131
|
+
"Promise": {
|
|
132
|
+
"location": "global"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"return": "Promise<void>"
|
|
136
|
+
},
|
|
137
|
+
"docs": {
|
|
138
|
+
"text": "",
|
|
139
|
+
"tags": []
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"enable": {
|
|
143
|
+
"complexType": {
|
|
144
|
+
"signature": "() => Promise<void>",
|
|
145
|
+
"parameters": [],
|
|
146
|
+
"references": {
|
|
147
|
+
"Promise": {
|
|
148
|
+
"location": "global"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"return": "Promise<void>"
|
|
152
|
+
},
|
|
153
|
+
"docs": {
|
|
154
|
+
"text": "",
|
|
155
|
+
"tags": []
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}; }
|
|
159
|
+
static get elementRef() { return "host"; }
|
|
160
|
+
static get watchers() { return [{
|
|
161
|
+
"propName": "kind",
|
|
162
|
+
"methodName": "handleVisible"
|
|
163
|
+
}, {
|
|
164
|
+
"propName": "loading",
|
|
165
|
+
"methodName": "handleLoading"
|
|
166
|
+
}]; }
|
|
167
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Component, Element, h, Method } from '@stencil/core';
|
|
2
|
+
import Helper from "../../Helpers/Helper";
|
|
3
|
+
export class SallaLocalization {
|
|
4
|
+
constructor() {
|
|
5
|
+
Helper.setHost(this.host);
|
|
6
|
+
salla.event.on('localization::show', () => this.show());
|
|
7
|
+
}
|
|
8
|
+
async show() {
|
|
9
|
+
return this.modal.show();
|
|
10
|
+
}
|
|
11
|
+
async hide() {
|
|
12
|
+
return this.modal.hide();
|
|
13
|
+
}
|
|
14
|
+
submit() {
|
|
15
|
+
let url;
|
|
16
|
+
this.btn.load()
|
|
17
|
+
.then(() => {
|
|
18
|
+
let code = Helper.val('[name=currency]:checked');
|
|
19
|
+
if (code !== salla.config.currency.code) {
|
|
20
|
+
url = window.location.href;
|
|
21
|
+
return salla.currency.api.change(code);
|
|
22
|
+
}
|
|
23
|
+
//binding
|
|
24
|
+
}).then(() => {
|
|
25
|
+
let language = Helper.val('[name=lang]:checked');
|
|
26
|
+
if (language !== salla.config.language.code) {
|
|
27
|
+
url = salla.config.languages.filter(lang => lang.code === language)[0].url;
|
|
28
|
+
}
|
|
29
|
+
}).then(() => this.btn.stop())
|
|
30
|
+
.then(() => this.hide())
|
|
31
|
+
.then(() => url && (window.location.href = url));
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
return (h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal },
|
|
35
|
+
h("slot", { name: "header" },
|
|
36
|
+
h("div", { slot: "header" })),
|
|
37
|
+
h("div", { class: "s-localization-inner" },
|
|
38
|
+
salla.config.languages
|
|
39
|
+
? h("div", { class: "s-localization-section" },
|
|
40
|
+
h("label", { class: "s-localization-title" }, salla.lang.get('common.titles.language')),
|
|
41
|
+
h("fieldset", { class: "s-localization-fieldset" },
|
|
42
|
+
h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_language')),
|
|
43
|
+
h("div", { class: "s-localization-section-inner" }, salla.config.languages.map(lang => h("div", { class: "flex items-center" },
|
|
44
|
+
h("input", { id: 'lang-' + lang.code.toLowerCase(), class: "s-localization-input", name: "lang", checked: salla.config.language.code == lang.code, type: "radio", value: lang.code }),
|
|
45
|
+
h("label", { htmlFor: 'lang-' + lang.code.toLowerCase(), class: "s-localization-label" },
|
|
46
|
+
h("span", null, lang.name),
|
|
47
|
+
h("div", { class: 's-localization-flag flag iti__flag iti__' + lang.country_code })))))))
|
|
48
|
+
: '',
|
|
49
|
+
salla.config.currencies
|
|
50
|
+
? h("div", { class: "s-localization-section" },
|
|
51
|
+
h("label", { class: "s-localization-title" }, salla.lang.get('common.titles.currency')),
|
|
52
|
+
h("fieldset", { class: "s-localization-fieldset" },
|
|
53
|
+
h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_currency')),
|
|
54
|
+
h("div", { class: "s-localization-section-inner" }, salla.config.currencies.map(currency => h("div", { class: "s-localization-item" },
|
|
55
|
+
h("input", { class: "s-localization-input", checked: salla.config.currency.code == currency.code, id: 'currency-' + currency.code, name: "currency", type: "radio", value: currency.code }),
|
|
56
|
+
h("label", { class: "s-localization-label", htmlFor: 'currency-' + currency.code },
|
|
57
|
+
h("span", null, currency.name),
|
|
58
|
+
h("small", { class: "s-localization-currency" }, currency.code)))))))
|
|
59
|
+
: ''),
|
|
60
|
+
h("p", { slot: "footer" },
|
|
61
|
+
h("slot", { name: "footer" },
|
|
62
|
+
h("salla-button", { ref: btn => this.btn = btn, onClick: () => this.submit(), class: "w-full" }, salla.lang.get('common.elements.ok'))))));
|
|
63
|
+
}
|
|
64
|
+
static get is() { return "salla-localization"; }
|
|
65
|
+
static get methods() { return {
|
|
66
|
+
"show": {
|
|
67
|
+
"complexType": {
|
|
68
|
+
"signature": "() => Promise<HTMLElement>",
|
|
69
|
+
"parameters": [],
|
|
70
|
+
"references": {
|
|
71
|
+
"Promise": {
|
|
72
|
+
"location": "global"
|
|
73
|
+
},
|
|
74
|
+
"HTMLElement": {
|
|
75
|
+
"location": "global"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"return": "Promise<HTMLElement>"
|
|
79
|
+
},
|
|
80
|
+
"docs": {
|
|
81
|
+
"text": "",
|
|
82
|
+
"tags": []
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"hide": {
|
|
86
|
+
"complexType": {
|
|
87
|
+
"signature": "() => Promise<HTMLElement>",
|
|
88
|
+
"parameters": [],
|
|
89
|
+
"references": {
|
|
90
|
+
"Promise": {
|
|
91
|
+
"location": "global"
|
|
92
|
+
},
|
|
93
|
+
"HTMLElement": {
|
|
94
|
+
"location": "global"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"return": "Promise<HTMLElement>"
|
|
98
|
+
},
|
|
99
|
+
"docs": {
|
|
100
|
+
"text": "",
|
|
101
|
+
"tags": []
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}; }
|
|
105
|
+
static get elementRef() { return "host"; }
|
|
106
|
+
}
|
|
File without changes
|
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
import { Component, h, Prop, Host, Element, Event, Watch } from '@stencil/core';
|
|
1
|
+
import { Component, h, Prop, Host, Element, Event, Watch, Method } from '@stencil/core';
|
|
2
2
|
import Helper from "../../Helpers/Helper";
|
|
3
|
+
//todo:: button component
|
|
3
4
|
export class SallaModal {
|
|
4
5
|
constructor() {
|
|
5
6
|
this.error = false;
|
|
6
7
|
this.success = false;
|
|
8
|
+
this.isClosable = true;
|
|
9
|
+
this.modalWidth = 'w-96'; //todo use friendly names
|
|
7
10
|
this.visible = false;
|
|
8
11
|
this.subTitle = '';
|
|
9
12
|
this.icon = 'sicon-cancel';
|
|
13
|
+
salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
|
|
14
|
+
salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
|
|
10
15
|
}
|
|
11
16
|
handleVisible(newValue) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
if (!newValue) {
|
|
18
|
+
this.toggleModal(false);
|
|
19
|
+
this.close.emit();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
17
22
|
this.host.classList.remove('hidden');
|
|
18
23
|
setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
|
|
19
24
|
this.ready.emit();
|
|
20
25
|
}
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
26
|
+
async show() {
|
|
27
|
+
this.host.setAttribute('visible', '');
|
|
28
|
+
return this.host;
|
|
29
|
+
}
|
|
30
|
+
async hide() {
|
|
31
|
+
this.host.removeAttribute('visible');
|
|
32
|
+
return this.host;
|
|
24
33
|
}
|
|
25
34
|
toggleModal(isOpen) {
|
|
26
35
|
Helper.toggleElement(this.host.querySelector('.s-modal-overlay'), 'ease-out duration-300 opacity-100', 'opacity-0', () => isOpen)
|
|
@@ -32,23 +41,35 @@ export class SallaModal {
|
|
|
32
41
|
setTimeout(() => this.host.classList.add('hidden'), 350);
|
|
33
42
|
}
|
|
34
43
|
}
|
|
44
|
+
closeModal() {
|
|
45
|
+
if (!this.isClosable) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.host.removeAttribute('visible');
|
|
49
|
+
}
|
|
35
50
|
render() {
|
|
36
51
|
this.host.id = this.host.id || 'salla-modal';
|
|
37
52
|
return (h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" },
|
|
38
53
|
h("div", { class: "s-modal-wrapper" },
|
|
39
|
-
h("div", { class: "s-modal-overlay", onClick: () => this.
|
|
54
|
+
h("div", { class: "s-modal-overlay", onClick: () => this.closeModal() }),
|
|
40
55
|
h("span", { class: "s-modal-spacer" }, "\u200B"),
|
|
41
|
-
h("div", { class:
|
|
56
|
+
h("div", { class: 's-modal-body ' + this.modalWidth },
|
|
42
57
|
h("slot", { name: "header" },
|
|
43
58
|
h("div", { class: "s-modal-header" },
|
|
44
|
-
|
|
45
|
-
h("
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
this.isClosable ?
|
|
60
|
+
h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" },
|
|
61
|
+
h("span", { class: "sicon-cancel" }))
|
|
62
|
+
: '',
|
|
48
63
|
this.error || this.success
|
|
49
|
-
? h("div", { class: { 's-modal-icon': true, 'bg-
|
|
50
|
-
h("i", { class: {
|
|
51
|
-
|
|
64
|
+
? h("div", { class: { 's-modal-icon': true, 's-modal-bg-error': this.error, 's-modal-bg-success': this.success } },
|
|
65
|
+
h("i", { class: {
|
|
66
|
+
[this.icon]: true,
|
|
67
|
+
's-modal-text-error': this.error,
|
|
68
|
+
's-modal-text-success': this.success
|
|
69
|
+
} }))
|
|
70
|
+
: '',
|
|
71
|
+
h("div", { class: "s-modal-title", innerHTML: this.host.title }),
|
|
72
|
+
h("p", { class: "s-modal-sub-title", innerHTML: this.subTitle }))),
|
|
52
73
|
h("slot", null),
|
|
53
74
|
h("slot", { name: "footer" })))));
|
|
54
75
|
}
|
|
@@ -90,6 +111,42 @@ export class SallaModal {
|
|
|
90
111
|
"reflect": false,
|
|
91
112
|
"defaultValue": "false"
|
|
92
113
|
},
|
|
114
|
+
"isClosable": {
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"mutable": true,
|
|
117
|
+
"complexType": {
|
|
118
|
+
"original": "boolean",
|
|
119
|
+
"resolved": "boolean",
|
|
120
|
+
"references": {}
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"optional": false,
|
|
124
|
+
"docs": {
|
|
125
|
+
"tags": [],
|
|
126
|
+
"text": ""
|
|
127
|
+
},
|
|
128
|
+
"attribute": "is-closable",
|
|
129
|
+
"reflect": false,
|
|
130
|
+
"defaultValue": "true"
|
|
131
|
+
},
|
|
132
|
+
"modalWidth": {
|
|
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": "modal-width",
|
|
147
|
+
"reflect": false,
|
|
148
|
+
"defaultValue": "'w-96'"
|
|
149
|
+
},
|
|
93
150
|
"visible": {
|
|
94
151
|
"type": "boolean",
|
|
95
152
|
"mutable": false,
|
|
@@ -176,6 +233,46 @@ export class SallaModal {
|
|
|
176
233
|
"references": {}
|
|
177
234
|
}
|
|
178
235
|
}]; }
|
|
236
|
+
static get methods() { return {
|
|
237
|
+
"show": {
|
|
238
|
+
"complexType": {
|
|
239
|
+
"signature": "() => Promise<HTMLElement>",
|
|
240
|
+
"parameters": [],
|
|
241
|
+
"references": {
|
|
242
|
+
"Promise": {
|
|
243
|
+
"location": "global"
|
|
244
|
+
},
|
|
245
|
+
"HTMLElement": {
|
|
246
|
+
"location": "global"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"return": "Promise<HTMLElement>"
|
|
250
|
+
},
|
|
251
|
+
"docs": {
|
|
252
|
+
"text": "",
|
|
253
|
+
"tags": []
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"hide": {
|
|
257
|
+
"complexType": {
|
|
258
|
+
"signature": "() => Promise<HTMLElement>",
|
|
259
|
+
"parameters": [],
|
|
260
|
+
"references": {
|
|
261
|
+
"Promise": {
|
|
262
|
+
"location": "global"
|
|
263
|
+
},
|
|
264
|
+
"HTMLElement": {
|
|
265
|
+
"location": "global"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
"return": "Promise<HTMLElement>"
|
|
269
|
+
},
|
|
270
|
+
"docs": {
|
|
271
|
+
"text": "",
|
|
272
|
+
"tags": []
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}; }
|
|
179
276
|
static get elementRef() { return "host"; }
|
|
180
277
|
static get watchers() { return [{
|
|
181
278
|
"propName": "visible",
|
|
@@ -70,35 +70,35 @@ export class SallaSearch {
|
|
|
70
70
|
.replace("{price}", (_a = item.price) === null || _a === void 0 ? void 0 : _a.after)
|
|
71
71
|
.replace("{url}", item.url)
|
|
72
72
|
.replace("{thumb}", item.thumb);
|
|
73
|
-
return (h("div", { class: "s-search-
|
|
73
|
+
return (h("div", { class: "s-search-product", innerHTML: product }));
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
|
-
return (h("div", { class: "s-search-
|
|
77
|
-
h("a", { target: "_blank", href: item.url, class: "s-search-
|
|
78
|
-
h("img", { class: "s-search-
|
|
79
|
-
h("div", { class: "s-search-
|
|
80
|
-
h("div", { class: "s-search-
|
|
81
|
-
h("div", { class: "s-search-
|
|
76
|
+
return (h("div", { class: "s-search-product" },
|
|
77
|
+
h("a", { target: "_blank", href: item.url, class: "s-search-product-image-container" },
|
|
78
|
+
h("img", { class: "s-search-product-image", src: item.thumb })),
|
|
79
|
+
h("div", { class: "s-search-product-details" },
|
|
80
|
+
h("div", { class: "s-search-product-title" }, item.title),
|
|
81
|
+
h("div", { class: "s-search-product-price" }, (_b = item.price) === null || _b === void 0 ? void 0 : _b.after))));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
render() {
|
|
85
|
-
return (h(Host, { class: "s-search
|
|
86
|
-
h("button", { type: "button", onClick: this.openSearch, class: "s-search-
|
|
87
|
-
this.showModal && (h("div", { class: "s-search-
|
|
88
|
-
h("div", { class: "s-search-
|
|
89
|
-
h("div", { class: "s-search-
|
|
85
|
+
return (h(Host, { class: "s-search" },
|
|
86
|
+
h("button", { type: "button", onClick: this.openSearch, class: "s-search-search-button-icon" }, this.hasSearchIconSlot ? (h("slot", { name: "search-icon" })) : (h("i", { class: "sicon-search font-bold" }))),
|
|
87
|
+
this.showModal && (h("div", { class: "s-search-container", style: { backgroundColor: 'rgba(0,0,0,0.5)' } },
|
|
88
|
+
h("div", { class: "s-search-wrapper", onClick: this.closeSearch },
|
|
89
|
+
h("div", { class: "s-search-inner", onClick: e => {
|
|
90
90
|
e.stopPropagation();
|
|
91
91
|
} },
|
|
92
|
-
h("div", { class: "s-search-
|
|
92
|
+
h("div", { class: "s-search-search-box-container" },
|
|
93
93
|
h("div", { class: !this.showResult
|
|
94
|
-
? 's-search-
|
|
95
|
-
: 's-search-
|
|
96
|
-
h("input", { class: "s-search-
|
|
97
|
-
this.fetchStatus != 'loading' ? (h("button", { class: "s-search-
|
|
98
|
-
h("i", { class: "sicon-search" }))) : (h("span", { class: "s-search-
|
|
99
|
-
h("span", { class: "s-search-
|
|
100
|
-
h("div", { class: "s-search-
|
|
101
|
-
this.fetchStatus === 'error' && (h("p", { class: "s-search-
|
|
94
|
+
? 's-search-search-box-inner'
|
|
95
|
+
: 's-search-search-box-inner-open' },
|
|
96
|
+
h("input", { class: "s-search-input", type: "text", placeholder: this.searchPlaceholder, value: this.searchTerm, onInput: event => this.handleChange(event) }),
|
|
97
|
+
this.fetchStatus != 'loading' ? (h("button", { class: "s-search-search-icon" },
|
|
98
|
+
h("i", { class: "sicon-search" }))) : (h("span", { class: "s-search-spinner" },
|
|
99
|
+
h("span", { class: "s-search-spinner-loader" }))))),
|
|
100
|
+
h("div", { class: "s-search-search-results" },
|
|
101
|
+
this.fetchStatus === 'error' && (h("p", { class: "s-search-no-results error p-4 text-sm text-gray-text" }, this.noResultsText)),
|
|
102
102
|
this.results &&
|
|
103
103
|
this.results.map(item => {
|
|
104
104
|
return this.getProduct(item);
|
package/dist/collection/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/login/salla-login';
|
|
2
|
-
export * from './components/search/salla-search';
|
|
1
|
+
export * from './components/salla-login/salla-login';
|
|
2
|
+
export * from './components/salla-search/salla-search';
|
|
@@ -7,7 +7,7 @@ fs.readdirSync(componentsPath, {withFileTypes: true})
|
|
|
7
7
|
.filter(parent => parent.isDirectory())
|
|
8
8
|
.forEach(directory => {
|
|
9
9
|
try {
|
|
10
|
-
components[directory.name] = require(path.resolve(componentsPath , directory.name, 'utilities.json'));
|
|
10
|
+
components[directory.name.replace('salla-','')] = require(path.resolve(componentsPath , directory.name, 'utilities.json'));
|
|
11
11
|
} catch (e) {
|
|
12
12
|
// ignore
|
|
13
13
|
}
|