@salla.sa/twilight-components 1.4.21 → 1.5.2
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/loader.cjs.js +1 -1
- package/dist/cjs/salla-button_24.cjs.entry.js +287 -242
- package/dist/cjs/salla-scopes.cjs.entry.js +156 -0
- package/dist/cjs/search-b487cc49.js +13 -0
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/assets/{flat.svg → svg/flat.svg} +0 -0
- package/dist/collection/assets/svg/tag.svg +0 -1
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +12 -6
- package/dist/collection/components/salla-loyalty/salla-loyalty.js +1 -1
- package/dist/collection/components/salla-modal/salla-modal.js +21 -51
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +39 -32
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +4 -2
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +12 -9
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +4 -2
- package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +4 -3
- package/dist/collection/components/salla-search/salla-search.js +7 -4
- package/dist/collection/components/salla-social-share/salla-social-share.js +3 -1
- package/dist/collection/components/salla-swiper/salla-swiper.css +0 -23
- package/dist/collection/components/salla-swiper/salla-swiper.js +4 -2
- package/dist/collection/components/salla-tel-input/salla-tel-input.css +1 -2
- package/dist/collection/components/salla-verify/salla-verify.js +4 -1
- package/dist/components/arrow-right.js +11 -0
- package/dist/components/cancel.js +11 -0
- package/dist/components/keyboard_arrow_right.js +11 -0
- package/dist/components/mail.js +11 -0
- package/dist/components/salla-login-modal.js +20 -3
- package/dist/components/salla-loyalty.js +3 -15
- package/dist/components/salla-modal2.js +25 -25
- package/dist/components/salla-offer-modal.js +25 -3
- package/dist/components/salla-product-availability2.js +9 -2
- package/dist/components/salla-quantity-input.js +16 -2
- package/dist/components/salla-rating-modal.js +10 -3
- package/dist/components/salla-rating-stars2.js +4 -3
- package/dist/components/salla-scopes.js +1 -7
- package/dist/components/salla-search.js +7 -4
- package/dist/components/salla-social-share.js +10 -8
- package/dist/components/salla-swiper2.js +10 -2
- package/dist/components/salla-tel-input2.js +1 -1
- package/dist/components/salla-verify2.js +8 -1
- package/dist/components/search.js +11 -0
- package/dist/components/star2.js +11 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-button_24.entry.js +287 -242
- package/dist/esm/salla-scopes.entry.js +152 -0
- package/dist/esm/search-19ea3313.js +11 -0
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/p-282f9df8.entry.js +4 -0
- package/dist/twilight-components/p-40a01521.entry.js +4 -0
- package/dist/twilight-components/p-475ef754.js +4 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-modal/salla-modal.d.ts +2 -10
- package/dist/types/components/salla-search/salla-search.d.ts +1 -1
- package/dist/types/components.d.ts +4 -18
- package/example/assets/tailwind.css +269 -75
- package/package.json +4 -4
- package/dist/cjs/Helper-8ae6a805.js +0 -28
- package/dist/cjs/salla-quantity-input.cjs.entry.js +0 -87
- package/dist/esm/Helper-e1d414a5.js +0 -26
- package/dist/esm/salla-quantity-input.entry.js +0 -83
- package/dist/twilight-components/p-4c5055cf.entry.js +0 -4
- package/dist/twilight-components/p-9d2ca9c8.js +0 -4
- package/dist/twilight-components/p-b31f472a.entry.js +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/twilight-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Salla Team <support@salla.dev> (https://salla.dev)",
|
|
6
6
|
"bugs": {
|
|
@@ -57,16 +57,16 @@
|
|
|
57
57
|
"@stencil/core": "^2.17.1",
|
|
58
58
|
"@stencil/postcss": "^2.1.0",
|
|
59
59
|
"@stencil/react-output-target": "^0.3.1",
|
|
60
|
-
"@stencil/sass": "1.
|
|
60
|
+
"@stencil/sass": "1.5.2",
|
|
61
61
|
"@stencil/vue-output-target": "^0.6.1",
|
|
62
62
|
"@types/jest": "^28.1.6",
|
|
63
63
|
"@types/puppeteer": "3.0.2",
|
|
64
|
-
"jest": "^
|
|
64
|
+
"jest": "^29.0.2",
|
|
65
65
|
"jest-cli": "^27.4.5",
|
|
66
66
|
"lodash": "^4.17.21",
|
|
67
67
|
"prettier": "^2.4.1",
|
|
68
68
|
"promisify-child-process": "^3.1.4",
|
|
69
|
-
"puppeteer": "^
|
|
69
|
+
"puppeteer": "^17.1.1",
|
|
70
70
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
71
71
|
"stencil-inline-svg": "^1.1.0",
|
|
72
72
|
"stencil-tailwind-plugin": "^1.4.1",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
//TODO::check why there are too much listeners for languages::translations.loaded
|
|
7
|
-
salla.event.setMaxListeners(20);
|
|
8
|
-
class Helper extends salla.AppHelpers {
|
|
9
|
-
setHost(host) {
|
|
10
|
-
this.host = host;
|
|
11
|
-
}
|
|
12
|
-
getElement(selector) {
|
|
13
|
-
return this.host.querySelector(selector);
|
|
14
|
-
}
|
|
15
|
-
getAttribute(selector, attribute) {
|
|
16
|
-
var _a;
|
|
17
|
-
return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
|
|
18
|
-
}
|
|
19
|
-
val(selector) {
|
|
20
|
-
return this.getAttribute(selector, 'value');
|
|
21
|
-
}
|
|
22
|
-
isUser() {
|
|
23
|
-
return salla.config.get('user.type') === 'user';
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const Helper$1 = new Helper;
|
|
27
|
-
|
|
28
|
-
exports.Helper = Helper$1;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
|
-
|
|
8
|
-
const index = require('./index-0d0167d5.js');
|
|
9
|
-
const Helper = require('./Helper-8ae6a805.js');
|
|
10
|
-
|
|
11
|
-
const sallaQuantityInputCss = "";
|
|
12
|
-
|
|
13
|
-
const SallaQuantityInput = class {
|
|
14
|
-
constructor(hostRef) {
|
|
15
|
-
index.registerInstance(this, hostRef);
|
|
16
|
-
this.hostAttributes = {};
|
|
17
|
-
this.hasIncrementSlot = false;
|
|
18
|
-
this.hasDecrementSlot = false;
|
|
19
|
-
this.didLoaded = false;
|
|
20
|
-
this.quantity = 1;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Workaround to fire change event for the input.
|
|
24
|
-
*/
|
|
25
|
-
watchPropHandler() {
|
|
26
|
-
if (!this.didLoaded) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
Helper.Helper.debounce(() => salla.document.event.fireEvent(this.textInput, 'change', { 'bubbles': true }));
|
|
30
|
-
}
|
|
31
|
-
componentWillLoad() {
|
|
32
|
-
this.quantity = parseInt(this.host.getAttribute('value')) || 1;
|
|
33
|
-
this.hasIncrementSlot = !!this.host.querySelector('[slot="increment-button"]');
|
|
34
|
-
this.hasDecrementSlot = !!this.host.querySelector('[slot="decrement-button"]');
|
|
35
|
-
}
|
|
36
|
-
componentDidLoad() {
|
|
37
|
-
this.didLoaded = true;
|
|
38
|
-
this.textInput.addEventListener('input', (event) => salla.helpers.inputDigitsOnly(event.target));
|
|
39
|
-
}
|
|
40
|
-
getInputAttributes() {
|
|
41
|
-
for (let i = 0; i < this.host.attributes.length; i++) {
|
|
42
|
-
if (!['id', 'value', 'min', 'class'].includes(this.host.attributes[i].name)) {
|
|
43
|
-
this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return this.hostAttributes;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* decrease quantity by one.
|
|
50
|
-
* @return HTMLSallaQuantityInputElement
|
|
51
|
-
*/
|
|
52
|
-
async decrease() {
|
|
53
|
-
return this.setValue(this.quantity - 1);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* increase quantity by one.
|
|
57
|
-
* @return HTMLSallaQuantityInputElement
|
|
58
|
-
*/
|
|
59
|
-
async increase() {
|
|
60
|
-
return this.setValue(this.quantity + 1);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* set quantity by one.
|
|
64
|
-
* @return HTMLSallaQuantityInputElement
|
|
65
|
-
*/
|
|
66
|
-
async setValue(value) {
|
|
67
|
-
let maxQuantity = parseInt(this.host.getAttribute('max'));
|
|
68
|
-
if (maxQuantity && value > maxQuantity) {
|
|
69
|
-
value = maxQuantity;
|
|
70
|
-
}
|
|
71
|
-
if (value <= 1) {
|
|
72
|
-
value = 1;
|
|
73
|
-
}
|
|
74
|
-
this.quantity = value;
|
|
75
|
-
return this.host;
|
|
76
|
-
}
|
|
77
|
-
render() {
|
|
78
|
-
return (index.h(index.Host, { class: "s-quantity-input s-quantity-input-container" }, index.h("button", { onClick: () => this.increase(), class: "s-quantity-input-increase-button s-quantity-input-button", type: "button" }, !this.hasIncrementSlot ? index.h("i", { class: "sicon-add" }) : '', index.h("slot", { name: "increment-button" })), index.h("input", Object.assign({ class: "s-quantity-input-input" }, this.getInputAttributes(), { ref: (el) => this.textInput = el, onInput: (event) => this.setValue(event.target.value), min: "1", value: this.quantity })), index.h("button", { class: "s-quantity-input-decrease-button s-quantity-input-button", onClick: () => this.decrease(), type: "button" }, !this.hasDecrementSlot ? index.h("i", { class: "sicon-minus" }) : '', index.h("slot", { name: "decrement-button" }))));
|
|
79
|
-
}
|
|
80
|
-
get host() { return index.getElement(this); }
|
|
81
|
-
static get watchers() { return {
|
|
82
|
-
"quantity": ["watchPropHandler"]
|
|
83
|
-
}; }
|
|
84
|
-
};
|
|
85
|
-
SallaQuantityInput.style = sallaQuantityInputCss;
|
|
86
|
-
|
|
87
|
-
exports.salla_quantity_input = SallaQuantityInput;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
//TODO::check why there are too much listeners for languages::translations.loaded
|
|
5
|
-
salla.event.setMaxListeners(20);
|
|
6
|
-
class Helper extends salla.AppHelpers {
|
|
7
|
-
setHost(host) {
|
|
8
|
-
this.host = host;
|
|
9
|
-
}
|
|
10
|
-
getElement(selector) {
|
|
11
|
-
return this.host.querySelector(selector);
|
|
12
|
-
}
|
|
13
|
-
getAttribute(selector, attribute) {
|
|
14
|
-
var _a;
|
|
15
|
-
return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
|
|
16
|
-
}
|
|
17
|
-
val(selector) {
|
|
18
|
-
return this.getAttribute(selector, 'value');
|
|
19
|
-
}
|
|
20
|
-
isUser() {
|
|
21
|
-
return salla.config.get('user.type') === 'user';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const Helper$1 = new Helper;
|
|
25
|
-
|
|
26
|
-
export { Helper$1 as H };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import { r as registerInstance, h, H as Host, g as getElement } from './index-4e30ffd0.js';
|
|
5
|
-
import { H as Helper } from './Helper-e1d414a5.js';
|
|
6
|
-
|
|
7
|
-
const sallaQuantityInputCss = "";
|
|
8
|
-
|
|
9
|
-
const SallaQuantityInput = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
registerInstance(this, hostRef);
|
|
12
|
-
this.hostAttributes = {};
|
|
13
|
-
this.hasIncrementSlot = false;
|
|
14
|
-
this.hasDecrementSlot = false;
|
|
15
|
-
this.didLoaded = false;
|
|
16
|
-
this.quantity = 1;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Workaround to fire change event for the input.
|
|
20
|
-
*/
|
|
21
|
-
watchPropHandler() {
|
|
22
|
-
if (!this.didLoaded) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
Helper.debounce(() => salla.document.event.fireEvent(this.textInput, 'change', { 'bubbles': true }));
|
|
26
|
-
}
|
|
27
|
-
componentWillLoad() {
|
|
28
|
-
this.quantity = parseInt(this.host.getAttribute('value')) || 1;
|
|
29
|
-
this.hasIncrementSlot = !!this.host.querySelector('[slot="increment-button"]');
|
|
30
|
-
this.hasDecrementSlot = !!this.host.querySelector('[slot="decrement-button"]');
|
|
31
|
-
}
|
|
32
|
-
componentDidLoad() {
|
|
33
|
-
this.didLoaded = true;
|
|
34
|
-
this.textInput.addEventListener('input', (event) => salla.helpers.inputDigitsOnly(event.target));
|
|
35
|
-
}
|
|
36
|
-
getInputAttributes() {
|
|
37
|
-
for (let i = 0; i < this.host.attributes.length; i++) {
|
|
38
|
-
if (!['id', 'value', 'min', 'class'].includes(this.host.attributes[i].name)) {
|
|
39
|
-
this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return this.hostAttributes;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* decrease quantity by one.
|
|
46
|
-
* @return HTMLSallaQuantityInputElement
|
|
47
|
-
*/
|
|
48
|
-
async decrease() {
|
|
49
|
-
return this.setValue(this.quantity - 1);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* increase quantity by one.
|
|
53
|
-
* @return HTMLSallaQuantityInputElement
|
|
54
|
-
*/
|
|
55
|
-
async increase() {
|
|
56
|
-
return this.setValue(this.quantity + 1);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* set quantity by one.
|
|
60
|
-
* @return HTMLSallaQuantityInputElement
|
|
61
|
-
*/
|
|
62
|
-
async setValue(value) {
|
|
63
|
-
let maxQuantity = parseInt(this.host.getAttribute('max'));
|
|
64
|
-
if (maxQuantity && value > maxQuantity) {
|
|
65
|
-
value = maxQuantity;
|
|
66
|
-
}
|
|
67
|
-
if (value <= 1) {
|
|
68
|
-
value = 1;
|
|
69
|
-
}
|
|
70
|
-
this.quantity = value;
|
|
71
|
-
return this.host;
|
|
72
|
-
}
|
|
73
|
-
render() {
|
|
74
|
-
return (h(Host, { class: "s-quantity-input s-quantity-input-container" }, h("button", { onClick: () => this.increase(), class: "s-quantity-input-increase-button s-quantity-input-button", type: "button" }, !this.hasIncrementSlot ? h("i", { class: "sicon-add" }) : '', h("slot", { name: "increment-button" })), h("input", Object.assign({ class: "s-quantity-input-input" }, this.getInputAttributes(), { ref: (el) => this.textInput = el, onInput: (event) => this.setValue(event.target.value), min: "1", value: this.quantity })), h("button", { class: "s-quantity-input-decrease-button s-quantity-input-button", onClick: () => this.decrease(), type: "button" }, !this.hasDecrementSlot ? h("i", { class: "sicon-minus" }) : '', h("slot", { name: "decrement-button" }))));
|
|
75
|
-
}
|
|
76
|
-
get host() { return getElement(this); }
|
|
77
|
-
static get watchers() { return {
|
|
78
|
-
"quantity": ["watchPropHandler"]
|
|
79
|
-
}; }
|
|
80
|
-
};
|
|
81
|
-
SallaQuantityInput.style = sallaQuantityInputCss;
|
|
82
|
-
|
|
83
|
-
export { SallaQuantityInput as salla_quantity_input };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{r as t,h as s,H as i,g as n}from"./p-1503d976.js";import{H as e}from"./p-9d2ca9c8.js";const a=class{constructor(s){t(this,s),this.hostAttributes={},this.hasIncrementSlot=!1,this.hasDecrementSlot=!1,this.didLoaded=!1,this.quantity=1}watchPropHandler(){this.didLoaded&&e.debounce((()=>salla.document.event.fireEvent(this.textInput,"change",{bubbles:!0})))}componentWillLoad(){this.quantity=parseInt(this.host.getAttribute("value"))||1,this.hasIncrementSlot=!!this.host.querySelector('[slot="increment-button"]'),this.hasDecrementSlot=!!this.host.querySelector('[slot="decrement-button"]')}componentDidLoad(){this.didLoaded=!0,this.textInput.addEventListener("input",(t=>salla.helpers.inputDigitsOnly(t.target)))}getInputAttributes(){for(let t=0;t<this.host.attributes.length;t++)["id","value","min","class"].includes(this.host.attributes[t].name)||(this.hostAttributes[this.host.attributes[t].name]=this.host.attributes[t].value);return this.hostAttributes}async decrease(){return this.setValue(this.quantity-1)}async increase(){return this.setValue(this.quantity+1)}async setValue(t){let s=parseInt(this.host.getAttribute("max"));return s&&t>s&&(t=s),t<=1&&(t=1),this.quantity=t,this.host}render(){return s(i,{class:"s-quantity-input s-quantity-input-container"},s("button",{onClick:()=>this.increase(),class:"s-quantity-input-increase-button s-quantity-input-button",type:"button"},this.hasIncrementSlot?"":s("i",{class:"sicon-add"}),s("slot",{name:"increment-button"})),s("input",Object.assign({class:"s-quantity-input-input"},this.getInputAttributes(),{ref:t=>this.textInput=t,onInput:t=>this.setValue(t.target.value),min:"1",value:this.quantity})),s("button",{class:"s-quantity-input-decrease-button s-quantity-input-button",onClick:()=>this.decrease(),type:"button"},this.hasDecrementSlot?"":s("i",{class:"sicon-minus"}),s("slot",{name:"decrement-button"})))}get host(){return n(this)}static get watchers(){return{quantity:["watchPropHandler"]}}};a.style="";export{a as salla_quantity_input}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
salla.event.setMaxListeners(20);class t extends salla.AppHelpers{setHost(t){this.host=t}getElement(t){return this.host.querySelector(t)}getAttribute(t,e){var s;return null===(s=this.getElement(t))||void 0===s?void 0:s.getAttribute(e)}val(t){return this.getAttribute(t,"value")}isUser(){return"user"===salla.config.get("user.type")}}const e=new t;export{e as H}
|