@salla.sa/twilight-components 1.0.18 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/cjs/Helper-fcea994c.js +23 -0
  2. package/dist/cjs/index-4b8b3ffe.js +1696 -0
  3. package/dist/cjs/index.cjs.js +13 -0
  4. package/dist/cjs/loader.cjs.js +21 -0
  5. package/dist/cjs/salla-branches.cjs.entry.js +92 -0
  6. package/dist/cjs/salla-button_5.cjs.entry.js +1686 -0
  7. package/dist/cjs/salla-localization.cjs.entry.js +82 -0
  8. package/dist/cjs/salla-login-008cc893.js +125 -0
  9. package/dist/cjs/salla-offer.cjs.entry.js +50 -0
  10. package/dist/cjs/salla-product-availability.cjs.entry.js +75 -0
  11. package/dist/cjs/salla-rating.cjs.entry.js +300 -0
  12. package/dist/cjs/salla-search-c7aad59a.js +81 -0
  13. package/dist/cjs/salla-search.cjs.entry.js +11 -0
  14. package/dist/cjs/twilight-components.cjs.js +19 -0
  15. package/dist/collection/Helpers/Helper.js +19 -0
  16. package/dist/collection/collection-manifest.json +22 -0
  17. package/dist/collection/components/generate-summary.js +35 -0
  18. package/dist/collection/components/salla-branches/salla-branches.css +12 -0
  19. package/dist/collection/components/salla-branches/salla-branches.js +233 -0
  20. package/dist/collection/components/salla-button/salla-button.css +3 -0
  21. package/dist/collection/components/salla-button/salla-button.js +246 -0
  22. package/dist/collection/components/salla-localization/salla-localization.js +208 -0
  23. package/dist/collection/components/salla-login/salla-login.css +3 -0
  24. package/dist/collection/components/salla-login/salla-login.js +378 -0
  25. package/dist/collection/components/salla-modal/salla-modal.js +459 -0
  26. package/dist/collection/components/salla-offer/salla-offer.js +81 -0
  27. package/dist/collection/components/salla-product-availability/salla-product-availability.js +331 -0
  28. package/dist/collection/components/salla-rating/salla-rating.css +7 -0
  29. package/dist/collection/components/salla-rating/salla-rating.js +483 -0
  30. package/dist/collection/components/salla-search/salla-search.js +132 -0
  31. package/dist/collection/components/salla-tel-input/salla-tel-input.js +14 -0
  32. package/dist/collection/components/salla-verify/salla-verify.js +273 -0
  33. package/dist/collection/index.js +2 -0
  34. package/dist/collection/interfaces/colors.js +1 -0
  35. package/dist/collection/interfaces/index.js +2 -0
  36. package/dist/collection/interfaces/ratio.js +1 -0
  37. package/dist/collection/plugins/tailwind-theme/generator.js +62 -0
  38. package/dist/collection/plugins/tailwind-theme/index.js +26 -0
  39. package/dist/{twilight-components → esm}/Helper-d07ebbc7.js +0 -0
  40. package/dist/esm/index-092659c7.js +1668 -0
  41. package/dist/esm/index.js +4 -0
  42. package/dist/esm/loader.js +17 -0
  43. package/dist/esm/polyfills/core-js.js +11 -0
  44. package/dist/esm/polyfills/css-shim.js +1 -0
  45. package/dist/esm/polyfills/dom.js +79 -0
  46. package/dist/esm/polyfills/es5-html-element.js +1 -0
  47. package/dist/esm/polyfills/index.js +34 -0
  48. package/dist/esm/polyfills/system.js +6 -0
  49. package/dist/{twilight-components → esm}/salla-branches.entry.js +1 -1
  50. package/dist/esm/salla-button_5.entry.js +1678 -0
  51. package/dist/{twilight-components → esm}/salla-localization.entry.js +1 -1
  52. package/dist/{twilight-components/salla-login-b92c73dc.js → esm/salla-login-38586400.js} +2 -6
  53. package/dist/{twilight-components → esm}/salla-offer.entry.js +1 -1
  54. package/dist/{twilight-components → esm}/salla-product-availability.entry.js +1 -1
  55. package/dist/{twilight-components → esm}/salla-rating.entry.js +1 -1
  56. package/dist/{twilight-components/salla-search-69f2d9c1.js → esm/salla-search-ca856aab.js} +1 -1
  57. package/dist/esm/salla-search.entry.js +3 -0
  58. package/dist/esm/twilight-components.js +17 -0
  59. package/dist/index.cjs.js +1 -0
  60. package/dist/index.js +1 -0
  61. package/dist/twilight-components/index.esm.js +1 -4
  62. package/dist/twilight-components/p-03d0ec44.entry.js +1 -0
  63. package/dist/twilight-components/p-13a55257.entry.js +1 -0
  64. package/dist/twilight-components/p-160062c6.js +1 -0
  65. package/dist/twilight-components/p-47f17d3b.js +1 -0
  66. package/dist/twilight-components/p-5307c7b5.entry.js +1 -0
  67. package/dist/twilight-components/p-6a1f43c6.entry.js +1 -0
  68. package/dist/twilight-components/p-7088e517.entry.js +1 -0
  69. package/dist/twilight-components/p-924e3c88.js +1 -0
  70. package/dist/twilight-components/p-e8965b01.js +1 -0
  71. package/dist/twilight-components/p-ecb1b6cc.entry.js +1 -0
  72. package/dist/twilight-components/p-f11b401a.entry.js +1 -0
  73. package/dist/twilight-components/twilight-components.css +1 -3
  74. package/dist/twilight-components/twilight-components.esm.js +1 -125
  75. package/dist/types/components/salla-login/salla-login.d.ts +0 -1
  76. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +4 -0
  77. package/dist/types/components.d.ts +13 -0
  78. package/package.json +2 -1
  79. package/dist/twilight-components/app-globals-0f993ce5.js +0 -3
  80. package/dist/twilight-components/css-shim-a64b8820.js +0 -4
  81. package/dist/twilight-components/dom-d08ba8aa.js +0 -73
  82. package/dist/twilight-components/index-8966d27f.js +0 -3010
  83. package/dist/twilight-components/salla-button.entry.js +0 -75
  84. package/dist/twilight-components/salla-login-7c25f64b.js +0 -116
  85. package/dist/twilight-components/salla-login.entry.js +0 -3
  86. package/dist/twilight-components/salla-modal.entry.js +0 -113
  87. package/dist/twilight-components/salla-search.entry.js +0 -3
  88. package/dist/twilight-components/salla-verify.entry.js +0 -114
  89. package/dist/twilight-components/shadow-css-bc14d9fd.js +0 -389
@@ -0,0 +1,273 @@
1
+ import { Component, Element, Event, h, Method, Prop } from '@stencil/core';
2
+ import Helper from "../../Helpers/Helper";
3
+ export class SallaVerify {
4
+ constructor() {
5
+ this.url = 'profile/verify-mobile';
6
+ this.by = 'sms';
7
+ this.autoReload = true;
8
+ Helper.setHost(this.host);
9
+ if (this.withoutModal) {
10
+ this.modal = { show: () => '', hide: () => '' };
11
+ }
12
+ else {
13
+ salla.event.on('profile::verify.mobile', data => this.show(data));
14
+ }
15
+ }
16
+ async getCode() {
17
+ return this.code.value;
18
+ }
19
+ async show(data) {
20
+ this.data = data;
21
+ this.resendTimer();
22
+ this.otpInputs = document.querySelectorAll('.s-verify-input');
23
+ this.otpInputs[0].focus();
24
+ Helper.on('input', '.s-verify-input', e => salla.helpers.digitsOnly(e.target));
25
+ Helper.onKeyUp('.s-verify-input', event => {
26
+ var _a, _b, _c, _d;
27
+ let key = event.keyCode || event.charCode;
28
+ if (event.target.value) {
29
+ (_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
30
+ (_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
31
+ }
32
+ else if ([8, 46].includes(key)) {
33
+ (_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
34
+ (_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
35
+ }
36
+ this.toggleOTPSubmit();
37
+ });
38
+ Helper.on('paste', '.s-verify-input', event => {
39
+ let text = event.clipboardData.getData('text').toArabicDigits().replace(/[^0-9.]/g, '').replace('..', '.');
40
+ this.otpInputs.forEach((input, i) => input.value = text[i] || '');
41
+ this.toggleOTPSubmit();
42
+ setTimeout(() => this.otpInputs[3].focus(), 100);
43
+ });
44
+ return this.modal.show();
45
+ }
46
+ toggleOTPSubmit() {
47
+ let otp = [];
48
+ this.otpInputs.forEach(input => input.value && otp.push(input.value));
49
+ this.code.value = otp.join('');
50
+ if (otp.length === 4) {
51
+ this.btn.removeAttribute('disabled');
52
+ this.btn.click();
53
+ return;
54
+ }
55
+ this.btn.setAttribute('disabled', '');
56
+ }
57
+ resendTimer() {
58
+ Helper.showElement(this.resendMessage).hideElement(this.resend);
59
+ let resendAfter = 30;
60
+ let timerId = setInterval(() => {
61
+ if (resendAfter === -1) {
62
+ clearTimeout(timerId);
63
+ Helper.hideElement(this.resendMessage).showElement(this.resend);
64
+ }
65
+ else {
66
+ this.timer.innerHTML = `${resendAfter >= 10 ? resendAfter : '0' + resendAfter} : 00`;
67
+ resendAfter--;
68
+ }
69
+ }, 1000);
70
+ }
71
+ resendCode() {
72
+ return this.btn.stop()
73
+ .then(() => this.btn.disable())
74
+ .then(() => {
75
+ this.otpInputs.forEach(input => input.value = '');
76
+ this.otpInputs[0].focus();
77
+ })
78
+ .then(() => salla.api.auth.resend(Object.assign({ resend_by: this.by }, this.data)))
79
+ .then(() => this.resendTimer())
80
+ .catch(() => this.resendTimer());
81
+ }
82
+ submit() {
83
+ return this.btn.load()
84
+ .then(() => this.btn.disable())
85
+ .then(() => salla.document.api.request(this.url, Object.assign({ code: this.code.value }, this.data)))
86
+ .then(response => this.verified.emit(response))
87
+ .then(() => this.btn.stop() && this.btn.disable())
88
+ .then(() => this.modal.hide())
89
+ .then(() => this.autoReload && window.location.reload())
90
+ .catch(() => this.btn.stop() && this.btn.enable());
91
+ }
92
+ render() {
93
+ return this.withoutModal ? this.myBody() :
94
+ h("salla-modal", { id: "s-verify", ref: modal => this.modal = modal, title: salla.lang.get('pages.profile.verify_title') }, this.myBody());
95
+ }
96
+ myBody() {
97
+ return [
98
+ h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }),
99
+ // <label class="s-verify-label">{salla.lang.get('pages.profile.verify_placeholder')}</label>,
100
+ h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }),
101
+ h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))),
102
+ h("div", { slot: "footer", class: "s-verify-footer" },
103
+ h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')),
104
+ h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el },
105
+ salla.lang.get('blocks.header.resend_after'),
106
+ h("b", { class: "s-verify-timer", ref: el => this.timer = el })),
107
+ h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')),
108
+ this.backText ?
109
+ h("a", { href: "#", class: "s-verify-resend", onClick: () => this.backClicked.emit() }, this.backText)
110
+ : '')
111
+ ];
112
+ }
113
+ static get is() { return "salla-verify"; }
114
+ static get properties() { return {
115
+ "withoutModal": {
116
+ "type": "boolean",
117
+ "mutable": false,
118
+ "complexType": {
119
+ "original": "boolean",
120
+ "resolved": "boolean",
121
+ "references": {}
122
+ },
123
+ "required": false,
124
+ "optional": false,
125
+ "docs": {
126
+ "tags": [],
127
+ "text": "Should render component without modal"
128
+ },
129
+ "attribute": "without-modal",
130
+ "reflect": false
131
+ },
132
+ "url": {
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": "url",
147
+ "reflect": false,
148
+ "defaultValue": "'profile/verify-mobile'"
149
+ },
150
+ "by": {
151
+ "type": "string",
152
+ "mutable": false,
153
+ "complexType": {
154
+ "original": "string",
155
+ "resolved": "string",
156
+ "references": {}
157
+ },
158
+ "required": false,
159
+ "optional": false,
160
+ "docs": {
161
+ "tags": [],
162
+ "text": ""
163
+ },
164
+ "attribute": "by",
165
+ "reflect": false,
166
+ "defaultValue": "'sms'"
167
+ },
168
+ "backText": {
169
+ "type": "string",
170
+ "mutable": false,
171
+ "complexType": {
172
+ "original": "string",
173
+ "resolved": "string",
174
+ "references": {}
175
+ },
176
+ "required": false,
177
+ "optional": false,
178
+ "docs": {
179
+ "tags": [],
180
+ "text": ""
181
+ },
182
+ "attribute": "back-text",
183
+ "reflect": false
184
+ },
185
+ "autoReload": {
186
+ "type": "boolean",
187
+ "mutable": false,
188
+ "complexType": {
189
+ "original": "boolean",
190
+ "resolved": "boolean",
191
+ "references": {}
192
+ },
193
+ "required": false,
194
+ "optional": false,
195
+ "docs": {
196
+ "tags": [],
197
+ "text": ""
198
+ },
199
+ "attribute": "auto-reload",
200
+ "reflect": false,
201
+ "defaultValue": "true"
202
+ }
203
+ }; }
204
+ static get events() { return [{
205
+ "method": "verified",
206
+ "name": "verified",
207
+ "bubbles": true,
208
+ "cancelable": true,
209
+ "composed": true,
210
+ "docs": {
211
+ "tags": [],
212
+ "text": ""
213
+ },
214
+ "complexType": {
215
+ "original": "any",
216
+ "resolved": "any",
217
+ "references": {}
218
+ }
219
+ }, {
220
+ "method": "backClicked",
221
+ "name": "backClicked",
222
+ "bubbles": true,
223
+ "cancelable": true,
224
+ "composed": true,
225
+ "docs": {
226
+ "tags": [],
227
+ "text": ""
228
+ },
229
+ "complexType": {
230
+ "original": "any",
231
+ "resolved": "any",
232
+ "references": {}
233
+ }
234
+ }]; }
235
+ static get methods() { return {
236
+ "getCode": {
237
+ "complexType": {
238
+ "signature": "() => Promise<string>",
239
+ "parameters": [],
240
+ "references": {
241
+ "Promise": {
242
+ "location": "global"
243
+ }
244
+ },
245
+ "return": "Promise<string>"
246
+ },
247
+ "docs": {
248
+ "text": "",
249
+ "tags": []
250
+ }
251
+ },
252
+ "show": {
253
+ "complexType": {
254
+ "signature": "(data: any) => Promise<any>",
255
+ "parameters": [{
256
+ "tags": [],
257
+ "text": ""
258
+ }],
259
+ "references": {
260
+ "Promise": {
261
+ "location": "global"
262
+ }
263
+ },
264
+ "return": "Promise<any>"
265
+ },
266
+ "docs": {
267
+ "text": "",
268
+ "tags": []
269
+ }
270
+ }
271
+ }; }
272
+ static get elementRef() { return "host"; }
273
+ }
@@ -0,0 +1,2 @@
1
+ export * from './components/salla-login/salla-login';
2
+ export * from './components/salla-search/salla-search';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './colors';
2
+ export * from './ratio';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,62 @@
1
+ var fs = require('fs');
2
+ var path = require('path');
3
+ var _ = require('lodash');
4
+ var components = {};
5
+ var componentsPath = path.resolve(__dirname, '../../components');
6
+
7
+ //==================== Global Salla Components Styles ====================//
8
+ var utilities = {
9
+ '.s-has-error': {'@apply !border-red-500 !text-red-500': {}},
10
+ '.s-ltr' : {direction: 'ltr'},
11
+ '.s-input' : {'@apply appearance-none form-input': {}},
12
+ '.s-hidden' : {'@apply hidden': {}},
13
+ '.s-block' : {'@apply block': {}},
14
+ };
15
+
16
+ fs.readdirSync(componentsPath, {withFileTypes: true})
17
+ .filter(parent => parent.isDirectory())
18
+ .forEach(directory => {
19
+ try {
20
+ components[directory.name.replace('salla-', '')] = require(path.resolve(componentsPath, directory.name, 'utilities.json'));
21
+ } catch (e) {
22
+ // ignore
23
+ }
24
+ });
25
+
26
+ for (const [keyComponent, value] of Object.entries(components)) {
27
+ console.log('> Processing ' + keyComponent + ' ...');
28
+ _.forEach(value, function (value, keyUtility) {
29
+ keyUtility = '.s-' + keyComponent + '-' + keyUtility;
30
+ utilities[keyUtility] = {[`@apply ${value}`]: {}};
31
+ });
32
+ console.log('✓ Processed ' + keyComponent + '');
33
+ }
34
+
35
+ // write the utilities for the plugin
36
+ console.log('> Write utilities ...');
37
+ fs.writeFileSync(
38
+ path.resolve(__dirname, 'utilities.json'),
39
+ JSON.stringify(utilities),
40
+ function (err) {
41
+ if (err) {
42
+ return console.log(err);
43
+ }
44
+ console.log('The file was saved!');
45
+ }
46
+ );
47
+
48
+
49
+ // write the save list css
50
+ console.log('> Write safe-list-css ...');
51
+ fs.writeFileSync(
52
+ path.resolve(__dirname, 'safe-list-css.txt'),
53
+ Object.keys(utilities).map((name) => name.replace('.', '')).join('\n'),
54
+ function (err) {
55
+ if (err) {
56
+ return console.log(err);
57
+ }
58
+ console.log('The file was saved!');
59
+ }
60
+ );
61
+
62
+ console.log('✓ Done ...');
@@ -0,0 +1,26 @@
1
+ module.exports = require('tailwindcss/plugin').withOptions(() => {
2
+ return function ({addUtilities}) {
3
+ addUtilities({
4
+ // TODO :: find if there are used and defined them here if its.
5
+ '.anime-item' : {},
6
+ '.text-md' : {},
7
+ '.items-top' : {},
8
+ '.error' : {},
9
+ '.search-box' : {},
10
+ '.spinner-loader-wrap': {},
11
+ });
12
+
13
+ // todo :: move it to global
14
+ addUtilities({
15
+ '.spinner-loader': {
16
+ 'border-right-color': 'var(--color-main) !important',
17
+ '&.reverse': {
18
+ 'border-right-color': '#9f7171 !important',
19
+ 'background-color' : '#f98181'
20
+ }
21
+ }
22
+ });
23
+
24
+ addUtilities(require('./utilities.json'));
25
+ };
26
+ });