@salla.sa/twilight-components 1.0.5 → 1.0.6
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/Helper-8c75b6ac.js +20 -0
- package/dist/cjs/index-e9451c82.js +1446 -0
- package/dist/cjs/index.cjs.js +12 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/salla-currency-language.cjs.entry.js +46 -0
- package/dist/cjs/salla-login-3ec94029.js +14 -0
- package/dist/cjs/salla-login_2.cjs.entry.js +57 -0
- package/dist/{twilight-components/search-modal-ee69bd04.js → cjs/salla-search-2b1d67e4.js} +12 -10
- package/dist/cjs/salla-search.cjs.entry.js +10 -0
- package/dist/cjs/twilight-components.cjs.js +19 -0
- package/dist/collection/Helpers/Helper.js +16 -0
- package/dist/collection/collection-manifest.json +15 -0
- package/dist/collection/components/currency-language/salla-currency-language.js +97 -0
- package/dist/collection/components/generate-summary.js +35 -0
- package/dist/collection/components/login/salla-login.js +31 -0
- package/dist/collection/components/modal/salla-modal.js +184 -0
- package/dist/collection/components/search/salla-search.js +154 -0
- package/dist/collection/index.js +2 -0
- package/dist/{types/components/salla-modal/test/salla-modal.e2e.d.ts → collection/interfaces/colors.js} +0 -0
- package/dist/collection/interfaces/index.js +2 -0
- package/dist/{types/components/salla-modal/test/salla-modal.spec.d.ts → collection/interfaces/ratio.js} +0 -0
- package/dist/collection/plugins/tailwind-theme/generator.js +53 -0
- package/dist/collection/plugins/tailwind-theme/index.js +26 -0
- package/dist/esm/Helper-23b2de40.js +18 -0
- package/dist/esm/index-8919a244.js +1418 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/salla-currency-language.entry.js +42 -0
- package/dist/{twilight-components/salla-login-0e725af9.js → esm/salla-login-4aa5bb90.js} +1 -1
- package/dist/esm/salla-login_2.entry.js +52 -0
- package/dist/{twilight-components/search-modal-c1babeb6.js → esm/salla-search-bd2f71b3.js} +3 -3
- package/dist/esm/salla-search.entry.js +2 -0
- package/dist/esm/twilight-components.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/twilight-components/index.esm.js +1 -3
- package/dist/twilight-components/p-1abaafe4.entry.js +1 -0
- package/dist/twilight-components/p-41dc89e6.js +1 -0
- package/dist/twilight-components/p-520446eb.js +1 -0
- package/dist/twilight-components/p-58b1afae.js +1 -0
- package/dist/twilight-components/p-840f0daa.entry.js +1 -0
- package/dist/twilight-components/p-9f9af3e0.js +1 -0
- package/dist/twilight-components/p-b134c95d.entry.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -125
- package/dist/types/Helpers/Helper.d.ts +8 -0
- package/dist/types/components/currency-language/salla-currency-language.d.ts +10 -0
- package/dist/types/components/{salla-login → login}/salla-login.d.ts +0 -0
- package/dist/types/components/modal/salla-modal.d.ts +16 -0
- package/dist/types/components/{search-modal/search-modal.d.ts → search/salla-search.d.ts} +1 -1
- package/dist/types/components.d.ts +28 -11
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/dist/twilight-components/app-globals-0f993ce5.js +0 -3
- package/dist/twilight-components/css-shim-a64b8820.js +0 -4
- package/dist/twilight-components/dom-d08ba8aa.js +0 -73
- package/dist/twilight-components/index-0aa9ca9b.js +0 -3010
- package/dist/twilight-components/index-d2312a61.js +0 -3010
- package/dist/twilight-components/index-d6ed984a.js +0 -3010
- package/dist/twilight-components/salla-login-2a48c6c7.js +0 -29
- package/dist/twilight-components/salla-login-2bfbce21.js +0 -16
- package/dist/twilight-components/salla-login-45a3f61c.js +0 -16
- package/dist/twilight-components/salla-login-5fe80dd7.js +0 -29
- package/dist/twilight-components/salla-login-69a00ca2.js +0 -12
- package/dist/twilight-components/salla-login-7bf31d85.js +0 -29
- package/dist/twilight-components/salla-login-cb872dc2.js +0 -16
- package/dist/twilight-components/salla-login.entry.js +0 -2
- package/dist/twilight-components/salla-modal.entry.js +0 -24
- package/dist/twilight-components/salla-search-modal.entry.js +0 -2
- package/dist/twilight-components/search-modal-5dc35a08.js +0 -94
- package/dist/twilight-components/shadow-css-bc14d9fd.js +0 -389
- package/dist/types/components/salla-modal/salla-modal.d.ts +0 -9
- package/dist/types/utils/utils.d.ts +0 -6
- package/dist/types/utils/utils.spec.d.ts +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const sallaLogin = require('./salla-login-3ec94029.js');
|
|
6
|
+
const sallaSearch = require('./salla-search-2b1d67e4.js');
|
|
7
|
+
require('./index-e9451c82.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.SallaLogin = sallaLogin.SallaLogin;
|
|
12
|
+
exports.SallaSearch = sallaSearch.SallaSearch;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-e9451c82.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Esm v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchEsm = () => {
|
|
11
|
+
return index.promiseResolve();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defineCustomElements = (win, options) => {
|
|
15
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
|
+
return patchEsm().then(() => {
|
|
17
|
+
return index.bootstrapLazy([["salla-login_2.cjs",[[0,"salla-login"],[4,"salla-modal",{"error":[4],"success":[4],"visible":[516],"subTitle":[1,"sub-title"],"icon":[1]}]]],["salla-currency-language.cjs",[[4,"salla-currency-language",{"show":[64],"hide":[64]}]]],["salla-search.cjs",[[4,"salla-search",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-e9451c82.js');
|
|
6
|
+
const Helper = require('./Helper-8c75b6ac.js');
|
|
7
|
+
|
|
8
|
+
const SallaCurrencyLanguage = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
Helper.Helper.setHost(this.host);
|
|
12
|
+
}
|
|
13
|
+
async show() {
|
|
14
|
+
this.modal.setAttribute('visible', '');
|
|
15
|
+
}
|
|
16
|
+
async hide() {
|
|
17
|
+
this.modal.removeAttribute('visible');
|
|
18
|
+
}
|
|
19
|
+
submit() {
|
|
20
|
+
this.hide()
|
|
21
|
+
.then(() => {
|
|
22
|
+
let code = Helper.Helper.val('[name=currency]:checked');
|
|
23
|
+
if (code !== salla.config.currency.code) {
|
|
24
|
+
return salla.currency.api.change(code);
|
|
25
|
+
}
|
|
26
|
+
}).then(() => {
|
|
27
|
+
let language = Helper.Helper.val('[name=lang]:checked');
|
|
28
|
+
if (language !== salla.config.language.code) {
|
|
29
|
+
window.location.href = salla.config.languages.filter(lang => lang.code === language)[0].url;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
return (index.h("salla-modal", { id: "lang-currency-modal", class: "hidden" }, index.h("slot", { name: "header" }, index.h("div", { slot: "header" })), index.h("div", { class: "s-currency-language-inner" }, salla.config.languages
|
|
35
|
+
? index.h("div", { class: "s-currency-language-section" }, index.h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.language')), index.h("fieldset", { class: "s-currency-language-fieldset" }, index.h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_language')), index.h("div", { class: "s-currency-language-section-inner" }, salla.config.languages.map(lang => index.h("div", { class: "flex items-center" }, index.h("input", { id: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-input", name: "lang", checked: salla.config.language.code == lang.code, type: "radio", value: lang.code }), index.h("label", { htmlFor: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-label" }, index.h("span", null, lang.name), index.h("div", { class: 's-currency-language-flag flag iti__flag iti__' + lang.country_code })))))))
|
|
36
|
+
: '', salla.config.currencies
|
|
37
|
+
? index.h("div", { class: "s-currency-language-section" }, index.h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.currency')), index.h("fieldset", { class: "s-currency-language-fieldset" }, index.h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_currency')), index.h("div", { class: "s-currency-language-section-inner" }, salla.config.currencies.map(currency => index.h("div", { class: "s-currency-language-item" }, index.h("input", { class: "s-currency-language-input", checked: salla.config.currency.code == currency.code, id: 'currency-' + currency.code, name: "currency", type: "radio", value: currency.code }), index.h("label", { class: "s-currency-language-label", htmlFor: 'currency-' + currency.code }, index.h("span", null, currency.name), index.h("small", { class: "s-currency-language-currency" }, currency.code)))))))
|
|
38
|
+
: ''), index.h("p", { slot: "footer" }, index.h("slot", { name: "footer" }, index.h("button", { type: "button", class: "s-currency-language-submit", onClick: () => this.submit() }, salla.lang.get('common.elements.ok'))))));
|
|
39
|
+
}
|
|
40
|
+
componentDidRender() {
|
|
41
|
+
this.modal = document.querySelector('#lang-currency-modal');
|
|
42
|
+
}
|
|
43
|
+
get host() { return index.getElement(this); }
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.salla_currency_language = SallaCurrencyLanguage;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-e9451c82.js');
|
|
4
|
+
|
|
5
|
+
const SallaLogin = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
index.registerInstance(this, hostRef);
|
|
8
|
+
}
|
|
9
|
+
render() {
|
|
10
|
+
return (index.h("salla-modal", { id: "salla-login", title: "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0648\u0642\u0639" }, index.h("div", { id: "showLoginMethods" }, index.h("p", { class: "text-sm text-gray-text mb-5" }, "\u0627\u062E\u062A\u0631 \u0627\u0644\u0648\u0633\u064A\u0644\u0629 \u0627\u0644\u0645\u0646\u0627\u0633\u0628\u0629"), index.h("div", { id: "openEmailLogin", class: "mb-2.5 box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200" }, index.h("div", { class: "flex-shrink-0" }, index.h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, index.h("i", { class: "sicon-mail" }))), index.h("div", { class: "flex-1 min-w-0" }, index.h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, index.h("div", { class: "flex-1" }, index.h("span", { class: "absolute inset-0", "aria-hidden": "true" }), index.h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), index.h("h6", { class: "font-boldf" }, "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A")), index.h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))), index.h("div", { class: "box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200" }, index.h("div", { class: "flex-shrink-0" }, index.h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, index.h("i", { class: "sicon-phone" }))), index.h("div", { class: "flex-1 min-w-0" }, index.h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, index.h("div", { class: "flex-1" }, index.h("span", { class: "absolute inset-0", "aria-hidden": "true" }), index.h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), index.h("h6", { class: "font-boldf" }, "\u0627\u0644\u0647\u0627\u062A\u0641")), index.h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))))));
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.SallaLogin = SallaLogin;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const sallaLogin = require('./salla-login-3ec94029.js');
|
|
6
|
+
const index = require('./index-e9451c82.js');
|
|
7
|
+
const Helper = require('./Helper-8c75b6ac.js');
|
|
8
|
+
|
|
9
|
+
const SallaModal = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.ready = index.createEvent(this, "ready", 7);
|
|
13
|
+
this.close = index.createEvent(this, "close", 7);
|
|
14
|
+
this.error = false;
|
|
15
|
+
this.success = false;
|
|
16
|
+
this.visible = false;
|
|
17
|
+
this.subTitle = '';
|
|
18
|
+
this.icon = 'sicon-cancel';
|
|
19
|
+
}
|
|
20
|
+
handleVisible(newValue) {
|
|
21
|
+
return newValue === true
|
|
22
|
+
? this.show()
|
|
23
|
+
: this.hide();
|
|
24
|
+
}
|
|
25
|
+
show() {
|
|
26
|
+
this.host.classList.remove('hidden');
|
|
27
|
+
setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
|
|
28
|
+
this.ready.emit();
|
|
29
|
+
}
|
|
30
|
+
hide() {
|
|
31
|
+
this.toggleModal(false);
|
|
32
|
+
this.close.emit();
|
|
33
|
+
}
|
|
34
|
+
toggleModal(isOpen) {
|
|
35
|
+
Helper.Helper.toggleElement(this.host.querySelector('.s-modal-overlay'), 'ease-out duration-300 opacity-100', 'opacity-0', () => isOpen)
|
|
36
|
+
.toggleElement(this.host.querySelector('.s-modal-body'), 'ease-out duration-300 opacity-100 translate-y-0 sm:scale-100', //add these classes
|
|
37
|
+
'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', //remove these classes
|
|
38
|
+
() => isOpen)
|
|
39
|
+
.toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
|
|
40
|
+
if (!isOpen) {
|
|
41
|
+
setTimeout(() => this.host.classList.add('hidden'), 350);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
this.host.id = this.host.id || 'salla-modal';
|
|
46
|
+
return (index.h(index.Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" }, index.h("div", { class: "s-modal-wrapper" }, index.h("div", { class: "s-modal-overlay", onClick: () => this.host.removeAttribute('visible') }), index.h("span", { class: "s-modal-spacer" }, "\u200B"), index.h("div", { class: "s-modal-body" }, index.h("slot", { name: "header" }, index.h("div", { class: "s-modal-header" }, index.h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.host.removeAttribute('visible'), type: "button" }, index.h("span", { class: "sicon-cancel" })), index.h("div", { class: "s-modal-title" }, this.host.title), index.h("p", { class: "s-modal-sub-title" }, this.subTitle), this.error || this.success
|
|
47
|
+
? index.h("div", { class: { 's-modal-icon': true, 'bg-red-100': this.error, 'bg-green-100': this.success } }, index.h("i", { class: { [this.icon]: true, 'text-red-600': this.error, 'text-green-600': this.success } }))
|
|
48
|
+
: '')), index.h("slot", null), index.h("slot", { name: "footer" })))));
|
|
49
|
+
}
|
|
50
|
+
get host() { return index.getElement(this); }
|
|
51
|
+
static get watchers() { return {
|
|
52
|
+
"visible": ["handleVisible"]
|
|
53
|
+
}; }
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.salla_login = sallaLogin.SallaLogin;
|
|
57
|
+
exports.salla_modal = SallaModal;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const index = require('./index-e9451c82.js');
|
|
4
|
+
|
|
5
|
+
const SallaSearch = class {
|
|
4
6
|
constructor(hostRef) {
|
|
5
|
-
registerInstance(this, hostRef);
|
|
7
|
+
index.registerInstance(this, hostRef);
|
|
6
8
|
this.fetchStatus = '';
|
|
7
9
|
this.showModal = false;
|
|
8
10
|
/**
|
|
@@ -72,23 +74,23 @@ const SearchModal = class {
|
|
|
72
74
|
.replace("{price}", (_a = item.price) === null || _a === void 0 ? void 0 : _a.after)
|
|
73
75
|
.replace("{url}", item.url)
|
|
74
76
|
.replace("{thumb}", item.thumb);
|
|
75
|
-
return (h("div", { class: "s-search-modal-product", innerHTML: product }));
|
|
77
|
+
return (index.h("div", { class: "s-search-modal-product", innerHTML: product }));
|
|
76
78
|
}
|
|
77
79
|
else {
|
|
78
|
-
return (h("div", { class: "s-search-modal-product" }, h("a", { target: "_blank", href: item.url, class: "s-search-modal-product-image-container" }, h("img", { class: "s-search-modal-product-image", src: item.thumb })), h("div", { class: "s-search-modal-product-details" }, h("div", { class: "s-search-modal-product-title" }, item.title), h("div", { class: "s-search-modal-product-price" }, (_b = item.price) === null || _b === void 0 ? void 0 : _b.after))));
|
|
80
|
+
return (index.h("div", { class: "s-search-modal-product" }, index.h("a", { target: "_blank", href: item.url, class: "s-search-modal-product-image-container" }, index.h("img", { class: "s-search-modal-product-image", src: item.thumb })), index.h("div", { class: "s-search-modal-product-details" }, index.h("div", { class: "s-search-modal-product-title" }, item.title), index.h("div", { class: "s-search-modal-product-price" }, (_b = item.price) === null || _b === void 0 ? void 0 : _b.after))));
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
render() {
|
|
82
|
-
return (h(Host, { class: "s-search-modal" }, h("button", { type: "button", onClick: this.openSearch, class: "s-search-modal-search-button-icon" }, this.hasSearchIconSlot ? (h("slot", { name: "search-icon" })) : (h("i", { class: "sicon-search font-bold" }))), this.showModal && (h("div", { class: "s-search-modal-container", style: { backgroundColor: 'rgba(0,0,0,0.5)' } }, h("div", { class: "s-search-modal-wrapper", onClick: this.closeSearch }, h("div", { class: "s-search-modal-inner", onClick: e => {
|
|
84
|
+
return (index.h(index.Host, { class: "s-search-modal" }, index.h("button", { type: "button", onClick: this.openSearch, class: "s-search-modal-search-button-icon" }, this.hasSearchIconSlot ? (index.h("slot", { name: "search-icon" })) : (index.h("i", { class: "sicon-search font-bold" }))), this.showModal && (index.h("div", { class: "s-search-modal-container", style: { backgroundColor: 'rgba(0,0,0,0.5)' } }, index.h("div", { class: "s-search-modal-wrapper", onClick: this.closeSearch }, index.h("div", { class: "s-search-modal-inner", onClick: e => {
|
|
83
85
|
e.stopPropagation();
|
|
84
|
-
} }, h("div", { class: "s-search-modal-search-box-container" }, h("div", { class: !this.showResult
|
|
86
|
+
} }, index.h("div", { class: "s-search-modal-search-box-container" }, index.h("div", { class: !this.showResult
|
|
85
87
|
? 's-search-modal-search-box-inner'
|
|
86
|
-
: 's-search-modal-search-box-inner-open' }, h("input", { class: "s-search-modal-input", type: "text", placeholder: this.searchPlaceholder, value: this.searchTerm, onInput: event => this.handleChange(event) }), this.fetchStatus != 'loading' ? (h("button", { class: "s-search-modal-search-icon" }, h("i", { class: "sicon-search" }))) : (h("span", { class: "s-search-modal-spinner" }, h("span", { class: "s-search-modal-spinner-loader" }))))), h("div", { class: "s-search-modal-search-results" }, this.fetchStatus === 'error' && (h("p", { class: "s-search-modal-no-results error p-4 text-sm text-gray-text" }, this.noResultsText)), this.results &&
|
|
88
|
+
: 's-search-modal-search-box-inner-open' }, index.h("input", { class: "s-search-modal-input", type: "text", placeholder: this.searchPlaceholder, value: this.searchTerm, onInput: event => this.handleChange(event) }), this.fetchStatus != 'loading' ? (index.h("button", { class: "s-search-modal-search-icon" }, index.h("i", { class: "sicon-search" }))) : (index.h("span", { class: "s-search-modal-spinner" }, index.h("span", { class: "s-search-modal-spinner-loader" }))))), index.h("div", { class: "s-search-modal-search-results" }, this.fetchStatus === 'error' && (index.h("p", { class: "s-search-modal-no-results error p-4 text-sm text-gray-text" }, this.noResultsText)), this.results &&
|
|
87
89
|
this.results.map(item => {
|
|
88
90
|
return this.getProduct(item);
|
|
89
91
|
}))))))));
|
|
90
92
|
}
|
|
91
|
-
get hostElement() { return getElement(this); }
|
|
93
|
+
get hostElement() { return index.getElement(this); }
|
|
92
94
|
};
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
exports.SallaSearch = SallaSearch;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-e9451c82.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('twilight-components.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["salla-login_2.cjs",[[0,"salla-login"],[4,"salla-modal",{"error":[4],"success":[4],"visible":[516],"subTitle":[1,"sub-title"],"icon":[1]}]]],["salla-currency-language.cjs",[[4,"salla-currency-language",{"show":[64],"hide":[64]}]]],["salla-search.cjs",[[4,"salla-search",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
|
|
19
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class Helper extends salla.AppHelpers {
|
|
2
|
+
setHost(host) {
|
|
3
|
+
this.host = host;
|
|
4
|
+
}
|
|
5
|
+
getElement(selector) {
|
|
6
|
+
return this.host.querySelector(selector);
|
|
7
|
+
}
|
|
8
|
+
getAttribute(selector, attribute) {
|
|
9
|
+
var _a;
|
|
10
|
+
return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
|
|
11
|
+
}
|
|
12
|
+
val(selector) {
|
|
13
|
+
return this.getAttribute(selector, 'value');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export default new Helper;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"./components/login/salla-login.js",
|
|
4
|
+
"./components/search/salla-search.js",
|
|
5
|
+
"./components/currency-language/salla-currency-language.js",
|
|
6
|
+
"./components/modal/salla-modal.js"
|
|
7
|
+
],
|
|
8
|
+
"compiler": {
|
|
9
|
+
"name": "@stencil/core",
|
|
10
|
+
"version": "2.8.1",
|
|
11
|
+
"typescriptVersion": "4.2.3"
|
|
12
|
+
},
|
|
13
|
+
"collections": [],
|
|
14
|
+
"bundles": []
|
|
15
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Component, Element, h, Method } from '@stencil/core';
|
|
2
|
+
import Helper from "../../Helpers/Helper";
|
|
3
|
+
export class SallaCurrencyLanguage {
|
|
4
|
+
constructor() {
|
|
5
|
+
Helper.setHost(this.host);
|
|
6
|
+
}
|
|
7
|
+
async show() {
|
|
8
|
+
this.modal.setAttribute('visible', '');
|
|
9
|
+
}
|
|
10
|
+
async hide() {
|
|
11
|
+
this.modal.removeAttribute('visible');
|
|
12
|
+
}
|
|
13
|
+
submit() {
|
|
14
|
+
this.hide()
|
|
15
|
+
.then(() => {
|
|
16
|
+
let code = Helper.val('[name=currency]:checked');
|
|
17
|
+
if (code !== salla.config.currency.code) {
|
|
18
|
+
return salla.currency.api.change(code);
|
|
19
|
+
}
|
|
20
|
+
}).then(() => {
|
|
21
|
+
let language = Helper.val('[name=lang]:checked');
|
|
22
|
+
if (language !== salla.config.language.code) {
|
|
23
|
+
window.location.href = salla.config.languages.filter(lang => lang.code === language)[0].url;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return (h("salla-modal", { id: "lang-currency-modal", class: "hidden" },
|
|
29
|
+
h("slot", { name: "header" },
|
|
30
|
+
h("div", { slot: "header" })),
|
|
31
|
+
h("div", { class: "s-currency-language-inner" },
|
|
32
|
+
salla.config.languages
|
|
33
|
+
? h("div", { class: "s-currency-language-section" },
|
|
34
|
+
h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.language')),
|
|
35
|
+
h("fieldset", { class: "s-currency-language-fieldset" },
|
|
36
|
+
h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_language')),
|
|
37
|
+
h("div", { class: "s-currency-language-section-inner" }, salla.config.languages.map(lang => h("div", { class: "flex items-center" },
|
|
38
|
+
h("input", { id: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-input", name: "lang", checked: salla.config.language.code == lang.code, type: "radio", value: lang.code }),
|
|
39
|
+
h("label", { htmlFor: 'lang-' + lang.code.toLowerCase(), class: "s-currency-language-label" },
|
|
40
|
+
h("span", null, lang.name),
|
|
41
|
+
h("div", { class: 's-currency-language-flag flag iti__flag iti__' + lang.country_code })))))))
|
|
42
|
+
: '',
|
|
43
|
+
salla.config.currencies
|
|
44
|
+
? h("div", { class: "s-currency-language-section" },
|
|
45
|
+
h("label", { class: "s-currency-language-title" }, salla.lang.get('common.titles.currency')),
|
|
46
|
+
h("fieldset", { class: "s-currency-language-fieldset" },
|
|
47
|
+
h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_currency')),
|
|
48
|
+
h("div", { class: "s-currency-language-section-inner" }, salla.config.currencies.map(currency => h("div", { class: "s-currency-language-item" },
|
|
49
|
+
h("input", { class: "s-currency-language-input", checked: salla.config.currency.code == currency.code, id: 'currency-' + currency.code, name: "currency", type: "radio", value: currency.code }),
|
|
50
|
+
h("label", { class: "s-currency-language-label", htmlFor: 'currency-' + currency.code },
|
|
51
|
+
h("span", null, currency.name),
|
|
52
|
+
h("small", { class: "s-currency-language-currency" }, currency.code)))))))
|
|
53
|
+
: ''),
|
|
54
|
+
h("p", { slot: "footer" },
|
|
55
|
+
h("slot", { name: "footer" },
|
|
56
|
+
h("button", { type: "button", class: "s-currency-language-submit", onClick: () => this.submit() }, salla.lang.get('common.elements.ok'))))));
|
|
57
|
+
}
|
|
58
|
+
componentDidRender() {
|
|
59
|
+
this.modal = document.querySelector('#lang-currency-modal');
|
|
60
|
+
}
|
|
61
|
+
static get is() { return "salla-currency-language"; }
|
|
62
|
+
static get methods() { return {
|
|
63
|
+
"show": {
|
|
64
|
+
"complexType": {
|
|
65
|
+
"signature": "() => Promise<void>",
|
|
66
|
+
"parameters": [],
|
|
67
|
+
"references": {
|
|
68
|
+
"Promise": {
|
|
69
|
+
"location": "global"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"return": "Promise<void>"
|
|
73
|
+
},
|
|
74
|
+
"docs": {
|
|
75
|
+
"text": "",
|
|
76
|
+
"tags": []
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"hide": {
|
|
80
|
+
"complexType": {
|
|
81
|
+
"signature": "() => Promise<void>",
|
|
82
|
+
"parameters": [],
|
|
83
|
+
"references": {
|
|
84
|
+
"Promise": {
|
|
85
|
+
"location": "global"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"return": "Promise<void>"
|
|
89
|
+
},
|
|
90
|
+
"docs": {
|
|
91
|
+
"text": "",
|
|
92
|
+
"tags": []
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}; }
|
|
96
|
+
static get elementRef() { return "host"; }
|
|
97
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var fs = require('fs'), path = require('path'), util = require('util');
|
|
2
|
+
|
|
3
|
+
var dirToJSON = function (dir, done) {
|
|
4
|
+
var results = [];
|
|
5
|
+
|
|
6
|
+
function recWalk(d, res) {
|
|
7
|
+
var list = fs.readdirSync(d);
|
|
8
|
+
list.forEach((name) => {
|
|
9
|
+
var file = path.resolve(d, name);
|
|
10
|
+
var stat = fs.statSync(file);
|
|
11
|
+
if (stat && stat.isDirectory()) {
|
|
12
|
+
var title;
|
|
13
|
+
if (name) {
|
|
14
|
+
title = 'salla-' + name
|
|
15
|
+
}
|
|
16
|
+
res.push({ title: title, file: name + '/readme.md' });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
recWalk(dir, results);
|
|
23
|
+
done(null, results);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
done(err);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
dirToJSON("src/components", function (err, results) {
|
|
30
|
+
if (err) console.log(err);
|
|
31
|
+
else fs.writeFile('src/components/summary.json', JSON.stringify(results), 'utf8', function (err) {
|
|
32
|
+
if (err) throw err;
|
|
33
|
+
console.log('Saved!');
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Component, h } from '@stencil/core';
|
|
2
|
+
export class SallaLogin {
|
|
3
|
+
render() {
|
|
4
|
+
return (h("salla-modal", { id: "salla-login", title: "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0648\u0642\u0639" },
|
|
5
|
+
h("div", { id: "showLoginMethods" },
|
|
6
|
+
h("p", { class: "text-sm text-gray-text mb-5" }, "\u0627\u062E\u062A\u0631 \u0627\u0644\u0648\u0633\u064A\u0644\u0629 \u0627\u0644\u0645\u0646\u0627\u0633\u0628\u0629"),
|
|
7
|
+
h("div", { id: "openEmailLogin", class: "mb-2.5 box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200" },
|
|
8
|
+
h("div", { class: "flex-shrink-0" },
|
|
9
|
+
h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" },
|
|
10
|
+
h("i", { class: "sicon-mail" }))),
|
|
11
|
+
h("div", { class: "flex-1 min-w-0" },
|
|
12
|
+
h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" },
|
|
13
|
+
h("div", { class: "flex-1" },
|
|
14
|
+
h("span", { class: "absolute inset-0", "aria-hidden": "true" }),
|
|
15
|
+
h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"),
|
|
16
|
+
h("h6", { class: "font-boldf" }, "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A")),
|
|
17
|
+
h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))),
|
|
18
|
+
h("div", { class: "box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200" },
|
|
19
|
+
h("div", { class: "flex-shrink-0" },
|
|
20
|
+
h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" },
|
|
21
|
+
h("i", { class: "sicon-phone" }))),
|
|
22
|
+
h("div", { class: "flex-1 min-w-0" },
|
|
23
|
+
h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" },
|
|
24
|
+
h("div", { class: "flex-1" },
|
|
25
|
+
h("span", { class: "absolute inset-0", "aria-hidden": "true" }),
|
|
26
|
+
h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"),
|
|
27
|
+
h("h6", { class: "font-boldf" }, "\u0627\u0644\u0647\u0627\u062A\u0641")),
|
|
28
|
+
h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))))));
|
|
29
|
+
}
|
|
30
|
+
static get is() { return "salla-login"; }
|
|
31
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Component, h, Prop, Host, Element, Event, Watch } from '@stencil/core';
|
|
2
|
+
import Helper from "../../Helpers/Helper";
|
|
3
|
+
export class SallaModal {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.error = false;
|
|
6
|
+
this.success = false;
|
|
7
|
+
this.visible = false;
|
|
8
|
+
this.subTitle = '';
|
|
9
|
+
this.icon = 'sicon-cancel';
|
|
10
|
+
}
|
|
11
|
+
handleVisible(newValue) {
|
|
12
|
+
return newValue === true
|
|
13
|
+
? this.show()
|
|
14
|
+
: this.hide();
|
|
15
|
+
}
|
|
16
|
+
show() {
|
|
17
|
+
this.host.classList.remove('hidden');
|
|
18
|
+
setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
|
|
19
|
+
this.ready.emit();
|
|
20
|
+
}
|
|
21
|
+
hide() {
|
|
22
|
+
this.toggleModal(false);
|
|
23
|
+
this.close.emit();
|
|
24
|
+
}
|
|
25
|
+
toggleModal(isOpen) {
|
|
26
|
+
Helper.toggleElement(this.host.querySelector('.s-modal-overlay'), 'ease-out duration-300 opacity-100', 'opacity-0', () => isOpen)
|
|
27
|
+
.toggleElement(this.host.querySelector('.s-modal-body'), 'ease-out duration-300 opacity-100 translate-y-0 sm:scale-100', //add these classes
|
|
28
|
+
'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', //remove these classes
|
|
29
|
+
() => isOpen)
|
|
30
|
+
.toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
|
|
31
|
+
if (!isOpen) {
|
|
32
|
+
setTimeout(() => this.host.classList.add('hidden'), 350);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
this.host.id = this.host.id || 'salla-modal';
|
|
37
|
+
return (h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" },
|
|
38
|
+
h("div", { class: "s-modal-wrapper" },
|
|
39
|
+
h("div", { class: "s-modal-overlay", onClick: () => this.host.removeAttribute('visible') }),
|
|
40
|
+
h("span", { class: "s-modal-spacer" }, "\u200B"),
|
|
41
|
+
h("div", { class: "s-modal-body" },
|
|
42
|
+
h("slot", { name: "header" },
|
|
43
|
+
h("div", { class: "s-modal-header" },
|
|
44
|
+
h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.host.removeAttribute('visible'), type: "button" },
|
|
45
|
+
h("span", { class: "sicon-cancel" })),
|
|
46
|
+
h("div", { class: "s-modal-title" }, this.host.title),
|
|
47
|
+
h("p", { class: "s-modal-sub-title" }, this.subTitle),
|
|
48
|
+
this.error || this.success
|
|
49
|
+
? h("div", { class: { 's-modal-icon': true, 'bg-red-100': this.error, 'bg-green-100': this.success } },
|
|
50
|
+
h("i", { class: { [this.icon]: true, 'text-red-600': this.error, 'text-green-600': this.success } }))
|
|
51
|
+
: '')),
|
|
52
|
+
h("slot", null),
|
|
53
|
+
h("slot", { name: "footer" })))));
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "salla-modal"; }
|
|
56
|
+
static get properties() { return {
|
|
57
|
+
"error": {
|
|
58
|
+
"type": "boolean",
|
|
59
|
+
"mutable": false,
|
|
60
|
+
"complexType": {
|
|
61
|
+
"original": "boolean",
|
|
62
|
+
"resolved": "boolean",
|
|
63
|
+
"references": {}
|
|
64
|
+
},
|
|
65
|
+
"required": false,
|
|
66
|
+
"optional": false,
|
|
67
|
+
"docs": {
|
|
68
|
+
"tags": [],
|
|
69
|
+
"text": ""
|
|
70
|
+
},
|
|
71
|
+
"attribute": "error",
|
|
72
|
+
"reflect": false,
|
|
73
|
+
"defaultValue": "false"
|
|
74
|
+
},
|
|
75
|
+
"success": {
|
|
76
|
+
"type": "boolean",
|
|
77
|
+
"mutable": false,
|
|
78
|
+
"complexType": {
|
|
79
|
+
"original": "boolean",
|
|
80
|
+
"resolved": "boolean",
|
|
81
|
+
"references": {}
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"optional": false,
|
|
85
|
+
"docs": {
|
|
86
|
+
"tags": [],
|
|
87
|
+
"text": ""
|
|
88
|
+
},
|
|
89
|
+
"attribute": "success",
|
|
90
|
+
"reflect": false,
|
|
91
|
+
"defaultValue": "false"
|
|
92
|
+
},
|
|
93
|
+
"visible": {
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "boolean",
|
|
98
|
+
"resolved": "boolean",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": false,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": ""
|
|
106
|
+
},
|
|
107
|
+
"attribute": "visible",
|
|
108
|
+
"reflect": true,
|
|
109
|
+
"defaultValue": "false"
|
|
110
|
+
},
|
|
111
|
+
"subTitle": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"complexType": {
|
|
115
|
+
"original": "string",
|
|
116
|
+
"resolved": "string",
|
|
117
|
+
"references": {}
|
|
118
|
+
},
|
|
119
|
+
"required": false,
|
|
120
|
+
"optional": false,
|
|
121
|
+
"docs": {
|
|
122
|
+
"tags": [],
|
|
123
|
+
"text": ""
|
|
124
|
+
},
|
|
125
|
+
"attribute": "sub-title",
|
|
126
|
+
"reflect": false,
|
|
127
|
+
"defaultValue": "''"
|
|
128
|
+
},
|
|
129
|
+
"icon": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "string",
|
|
134
|
+
"resolved": "string",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": ""
|
|
142
|
+
},
|
|
143
|
+
"attribute": "icon",
|
|
144
|
+
"reflect": false,
|
|
145
|
+
"defaultValue": "'sicon-cancel'"
|
|
146
|
+
}
|
|
147
|
+
}; }
|
|
148
|
+
static get events() { return [{
|
|
149
|
+
"method": "ready",
|
|
150
|
+
"name": "ready",
|
|
151
|
+
"bubbles": true,
|
|
152
|
+
"cancelable": true,
|
|
153
|
+
"composed": true,
|
|
154
|
+
"docs": {
|
|
155
|
+
"tags": [],
|
|
156
|
+
"text": ""
|
|
157
|
+
},
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "any",
|
|
160
|
+
"resolved": "any",
|
|
161
|
+
"references": {}
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
"method": "close",
|
|
165
|
+
"name": "close",
|
|
166
|
+
"bubbles": true,
|
|
167
|
+
"cancelable": true,
|
|
168
|
+
"composed": true,
|
|
169
|
+
"docs": {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": ""
|
|
172
|
+
},
|
|
173
|
+
"complexType": {
|
|
174
|
+
"original": "any",
|
|
175
|
+
"resolved": "any",
|
|
176
|
+
"references": {}
|
|
177
|
+
}
|
|
178
|
+
}]; }
|
|
179
|
+
static get elementRef() { return "host"; }
|
|
180
|
+
static get watchers() { return [{
|
|
181
|
+
"propName": "visible",
|
|
182
|
+
"methodName": "handleVisible"
|
|
183
|
+
}]; }
|
|
184
|
+
}
|