@salla.sa/twilight-components 2.11.26 → 2.11.28

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 (52) hide show
  1. package/dist/cjs/camera-058ddeeb.js +13 -0
  2. package/dist/cjs/index-1d2b3370.js +10 -2
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{salla-button_37.cjs.entry.js → salla-button_36.cjs.entry.js} +59 -342
  5. package/dist/cjs/salla-conditional-fields.cjs.entry.js +99 -0
  6. package/dist/cjs/salla-product-options.cjs.entry.js +257 -0
  7. package/dist/cjs/twilight.cjs.js +1 -1
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/salla-product-options/salla-product-options.js +11 -4
  10. package/dist/collection/components/salla-progress-bar/salla-progress-bar.css +18 -0
  11. package/dist/collection/components/salla-progress-bar/salla-progress-bar.js +196 -0
  12. package/dist/collection/components/salla-slider/salla-slider.js +18 -2
  13. package/dist/collection/global/app-dev.js +5 -0
  14. package/dist/components/index.d.ts +1 -0
  15. package/dist/components/index.js +1 -0
  16. package/dist/components/salla-product-options.js +32 -21
  17. package/dist/components/salla-progress-bar.d.ts +11 -0
  18. package/dist/components/salla-progress-bar.js +9 -0
  19. package/dist/components/salla-progress-bar2.js +81 -0
  20. package/dist/components/salla-slider2.js +4 -2
  21. package/dist/esm/camera-647ab50f.js +11 -0
  22. package/dist/esm/index-f1d446ac.js +10 -2
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/{salla-button_37.entry.js → salla-button_36.entry.js} +58 -340
  25. package/dist/esm/salla-conditional-fields.entry.js +95 -0
  26. package/dist/esm/salla-product-options.entry.js +253 -0
  27. package/dist/esm/twilight.js +1 -1
  28. package/dist/esm-es5/camera-647ab50f.js +4 -0
  29. package/dist/esm-es5/index-f1d446ac.js +1 -1
  30. package/dist/esm-es5/loader.js +1 -1
  31. package/dist/esm-es5/salla-button_36.entry.js +53 -0
  32. package/dist/esm-es5/salla-conditional-fields.entry.js +4 -0
  33. package/dist/esm-es5/salla-product-options.entry.js +4 -0
  34. package/dist/esm-es5/twilight.js +1 -1
  35. package/dist/twilight/p-1b87ab66.system.js +1 -1
  36. package/dist/twilight/p-56830c52.system.entry.js +4 -0
  37. package/dist/twilight/p-643ea74e.entry.js +4 -0
  38. package/dist/twilight/p-7dcf1bf3.entry.js +36 -0
  39. package/dist/twilight/p-9b7452c1.entry.js +4 -0
  40. package/dist/twilight/p-ae899ce6.system.entry.js +53 -0
  41. package/dist/twilight/p-c328c14e.system.js +4 -0
  42. package/dist/twilight/p-ccd78636.js +4 -0
  43. package/dist/twilight/p-dbe8db94.system.entry.js +4 -0
  44. package/dist/twilight/twilight.esm.js +1 -1
  45. package/dist/types/components/salla-product-options/interfaces.d.ts +9 -0
  46. package/dist/types/components/salla-progress-bar/salla-progress-bar.d.ts +35 -0
  47. package/dist/types/components/salla-slider/salla-slider.d.ts +4 -0
  48. package/dist/types/components.d.ts +74 -0
  49. package/package.json +4 -4
  50. package/dist/esm-es5/salla-button_37.entry.js +0 -53
  51. package/dist/twilight/p-187222ed.system.entry.js +0 -53
  52. package/dist/twilight/p-a341ed7a.entry.js +0 -36
@@ -0,0 +1,196 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { Component, h, Prop } from '@stencil/core';
5
+ export class SallaProgressBar {
6
+ constructor() {
7
+ try {
8
+ if (this.donation) {
9
+ let donationJson = typeof this.donation == 'string' ? JSON.parse(this.donation) : this.donation;
10
+ if (donationJson.can_donate) {
11
+ this.value = donationJson.collected_amount;
12
+ this.target = donationJson.target_amount;
13
+ this.header = salla.lang.get('pages.products.target');
14
+ this.message = salla.lang.get('pages.products.donation_target_date') + ' ' + donationJson.target_end_date;
15
+ }
16
+ else {
17
+ this.message = donationJson.target_message;
18
+ }
19
+ }
20
+ }
21
+ catch (e) {
22
+ salla.log('Wrong donation json');
23
+ }
24
+ salla.lang.onLoaded(() => {
25
+ var _a, _b;
26
+ this.header = (_a = this.header) === null || _a === void 0 ? void 0 : _a.replace('pages.products.target', salla.lang.get('pages.products.target'));
27
+ this.message = (_b = this.message) === null || _b === void 0 ? void 0 : _b.replace('pages.products.donation_target_date', salla.lang.get('pages.products.donation_target_date'));
28
+ });
29
+ salla.onReady(() => {
30
+ this.color = this.color || salla.config.get('theme.color.primary', "#ffd5c4");
31
+ if (!this.unit) {
32
+ this.unit = salla.config.currency().symbol;
33
+ }
34
+ });
35
+ }
36
+ getPercentage() {
37
+ return (this.value / this.target) * 100;
38
+ }
39
+ render() {
40
+ if (!this.target && !this.message) {
41
+ return '';
42
+ }
43
+ return (h("div", { class: "s-progress-bar-container" },
44
+ this.header ? h("div", { class: "s-progress-bar-header" }, this.header) : '',
45
+ this.getProgressBar(),
46
+ this.message ? h("span", { class: "s-progress-bar-message" }, this.message) : ''));
47
+ }
48
+ getProgressBar() {
49
+ return this.target ? [
50
+ h("div", { class: "s-progress-bar-target-section" },
51
+ h("span", null,
52
+ salla.helpers.number(this.value),
53
+ " ",
54
+ this.unit),
55
+ h("span", null,
56
+ salla.helpers.number(this.target),
57
+ " ",
58
+ this.unit)),
59
+ h("div", { class: "s-progress-bar-wrapper" },
60
+ h("div", { class: "s-progress-bar-progress", style: { 'width': `${this.getPercentage()}%`, 'background-color': this.color } }))
61
+ ] : '';
62
+ }
63
+ static get is() { return "salla-progress-bar"; }
64
+ static get originalStyleUrls() { return {
65
+ "$": ["salla-progress-bar.scss"]
66
+ }; }
67
+ static get styleUrls() { return {
68
+ "$": ["salla-progress-bar.css"]
69
+ }; }
70
+ static get properties() { return {
71
+ "donation": {
72
+ "type": "string",
73
+ "mutable": false,
74
+ "complexType": {
75
+ "original": "string | Donation",
76
+ "resolved": "Donation | string",
77
+ "references": {
78
+ "Donation": {
79
+ "location": "import",
80
+ "path": "../salla-product-options/interfaces"
81
+ }
82
+ }
83
+ },
84
+ "required": false,
85
+ "optional": false,
86
+ "docs": {
87
+ "tags": [],
88
+ "text": "You can just pass the donation as json string ex: `{\"target_message\":null,\"target_date\":\"2023-04-18\",\"target_end_date\":\"2023-04-18\",\"target_amount\":400,\"collected_amount\":380,\"can_donate\":true}`"
89
+ },
90
+ "attribute": "donation",
91
+ "reflect": false
92
+ },
93
+ "target": {
94
+ "type": "number",
95
+ "mutable": true,
96
+ "complexType": {
97
+ "original": "number",
98
+ "resolved": "number",
99
+ "references": {}
100
+ },
101
+ "required": false,
102
+ "optional": false,
103
+ "docs": {
104
+ "tags": [],
105
+ "text": "The goal of the progress bar"
106
+ },
107
+ "attribute": "target",
108
+ "reflect": false
109
+ },
110
+ "value": {
111
+ "type": "number",
112
+ "mutable": true,
113
+ "complexType": {
114
+ "original": "number",
115
+ "resolved": "number",
116
+ "references": {}
117
+ },
118
+ "required": false,
119
+ "optional": false,
120
+ "docs": {
121
+ "tags": [],
122
+ "text": "The progress so far as of the goal."
123
+ },
124
+ "attribute": "value",
125
+ "reflect": false
126
+ },
127
+ "header": {
128
+ "type": "string",
129
+ "mutable": true,
130
+ "complexType": {
131
+ "original": "string",
132
+ "resolved": "string",
133
+ "references": {}
134
+ },
135
+ "required": false,
136
+ "optional": false,
137
+ "docs": {
138
+ "tags": [],
139
+ "text": "Big Title, before the progress bar."
140
+ },
141
+ "attribute": "header",
142
+ "reflect": false
143
+ },
144
+ "message": {
145
+ "type": "string",
146
+ "mutable": true,
147
+ "complexType": {
148
+ "original": "string",
149
+ "resolved": "string",
150
+ "references": {}
151
+ },
152
+ "required": false,
153
+ "optional": false,
154
+ "docs": {
155
+ "tags": [],
156
+ "text": "Subtitle under the progress bar or instead of it if the target not being set."
157
+ },
158
+ "attribute": "message",
159
+ "reflect": false
160
+ },
161
+ "unit": {
162
+ "type": "string",
163
+ "mutable": true,
164
+ "complexType": {
165
+ "original": "string",
166
+ "resolved": "string",
167
+ "references": {}
168
+ },
169
+ "required": false,
170
+ "optional": false,
171
+ "docs": {
172
+ "tags": [],
173
+ "text": "The unite to be added after the numbers, defaults to: `salla.config.currency().symbol`"
174
+ },
175
+ "attribute": "unit",
176
+ "reflect": false
177
+ },
178
+ "color": {
179
+ "type": "string",
180
+ "mutable": true,
181
+ "complexType": {
182
+ "original": "string",
183
+ "resolved": "string",
184
+ "references": {}
185
+ },
186
+ "required": false,
187
+ "optional": false,
188
+ "docs": {
189
+ "tags": [],
190
+ "text": "Progress bar color, defaults to: `salla.config.get('theme.color.primary', \"#ffd5c4\")`"
191
+ },
192
+ "attribute": "color",
193
+ "reflect": false
194
+ }
195
+ }; }
196
+ }
@@ -317,9 +317,11 @@ export class SallaSwiper {
317
317
  autoHeight: this.autoHeight,
318
318
  lazy: true,
319
319
  on: {
320
- // todo:: find better way for this workaround to show lazyLoad for duplicated slides, for some reason they are loaded but class not added.
320
+ // todo:: find better way for this workaround to show lazyLoad for duplicated slides, because it clones the slide after it's already rendered,
321
+ // then it re appended it as is,in this case the image is loaded but class not added.
321
322
  afterInit: (slider) => {
322
323
  var _a;
324
+ this.afterInit.emit(slider);
323
325
  (_a = document.lazyLoadInstance) === null || _a === void 0 ? void 0 : _a.update();
324
326
  this.loop && slider.slides.map(slide => {
325
327
  if (!slide.classList.contains('swiper-slide-duplicate')) {
@@ -381,7 +383,6 @@ export class SallaSwiper {
381
383
  }
382
384
  initSlider() {
383
385
  for (const slide of this.sliderWrapper.children) {
384
- //todo:: use `s-slider-slide`
385
386
  slide.classList.add('swiper-slide');
386
387
  }
387
388
  // @ts-ignore
@@ -821,6 +822,21 @@ export class SallaSwiper {
821
822
  "displayAllTitle": {}
822
823
  }; }
823
824
  static get events() { return [{
825
+ "method": "afterInit",
826
+ "name": "afterInit",
827
+ "bubbles": true,
828
+ "cancelable": true,
829
+ "composed": true,
830
+ "docs": {
831
+ "tags": [],
832
+ "text": "Event will fired right after initialization."
833
+ },
834
+ "complexType": {
835
+ "original": "any",
836
+ "resolved": "any",
837
+ "references": {}
838
+ }
839
+ }, {
824
840
  "method": "slideChange",
825
841
  "name": "slideChange",
826
842
  "bubbles": true,
@@ -7,6 +7,11 @@ export default function () {
7
7
  app();
8
8
  salla.init({
9
9
  debug: true,
10
+ theme: {
11
+ color: {
12
+ primary: '#5dd5c4'
13
+ }
14
+ },
10
15
  store: {
11
16
  url: process.env.URL,
12
17
  api: process.env.API,
@@ -23,6 +23,7 @@ export { SallaPlaceholder as SallaPlaceholder } from '../types/components/salla-
23
23
  export { SallaProductAvailability as SallaProductAvailability } from '../types/components/salla-product-availability/salla-product-availability';
24
24
  export { SallaProductOptions as SallaProductOptions } from '../types/components/salla-product-options/salla-product-options';
25
25
  export { SallaProductSizeGuide as SallaProductSizeGuide } from '../types/components/salla-product-size-guide/salla-product-size-guide';
26
+ export { SallaProgressBar as SallaProgressBar } from '../types/components/salla-progress-bar/salla-progress-bar';
26
27
  export { SallaQuantityInput as SallaQuantityInput } from '../types/components/salla-quantity-input/salla-quantity-input';
27
28
  export { SallaQuickOrder as SallaQuickOrder } from '../types/components/salla-quick-order/salla-quick-order';
28
29
  export { SallaRatingModal as SallaRatingModal } from '../types/components/salla-rating-modal/salla-rating-modal';
@@ -27,6 +27,7 @@ export { SallaPlaceholder, defineCustomElement as defineCustomElementSallaPlaceh
27
27
  export { SallaProductAvailability, defineCustomElement as defineCustomElementSallaProductAvailability } from './salla-product-availability.js';
28
28
  export { SallaProductOptions, defineCustomElement as defineCustomElementSallaProductOptions } from './salla-product-options.js';
29
29
  export { SallaProductSizeGuide, defineCustomElement as defineCustomElementSallaProductSizeGuide } from './salla-product-size-guide.js';
30
+ export { SallaProgressBar, defineCustomElement as defineCustomElementSallaProgressBar } from './salla-progress-bar.js';
30
31
  export { SallaQuantityInput, defineCustomElement as defineCustomElementSallaQuantityInput } from './salla-quantity-input.js';
31
32
  export { SallaQuickOrder, defineCustomElement as defineCustomElementSallaQuickOrder } from './salla-quick-order.js';
32
33
  export { SallaRatingModal, defineCustomElement as defineCustomElementSallaRatingModal } from './salla-rating-modal.js';
@@ -3,14 +3,15 @@
3
3
  */
4
4
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
5
  import { C as CameraIcon } from './camera.js';
6
- import { d as defineCustomElement$9 } from './salla-button2.js';
7
- import { d as defineCustomElement$8 } from './salla-color-picker2.js';
8
- import { d as defineCustomElement$7 } from './salla-conditional-fields2.js';
9
- import { d as defineCustomElement$6 } from './salla-datetime-picker2.js';
10
- import { d as defineCustomElement$5 } from './salla-file-upload2.js';
11
- import { d as defineCustomElement$4 } from './salla-loading2.js';
12
- import { d as defineCustomElement$3 } from './salla-map2.js';
13
- import { d as defineCustomElement$2 } from './salla-modal2.js';
6
+ import { d as defineCustomElement$a } from './salla-button2.js';
7
+ import { d as defineCustomElement$9 } from './salla-color-picker2.js';
8
+ import { d as defineCustomElement$8 } from './salla-conditional-fields2.js';
9
+ import { d as defineCustomElement$7 } from './salla-datetime-picker2.js';
10
+ import { d as defineCustomElement$6 } from './salla-file-upload2.js';
11
+ import { d as defineCustomElement$5 } from './salla-loading2.js';
12
+ import { d as defineCustomElement$4 } from './salla-map2.js';
13
+ import { d as defineCustomElement$3 } from './salla-modal2.js';
14
+ import { d as defineCustomElement$2 } from './salla-progress-bar2.js';
14
15
 
15
16
  var DisplayType;
16
17
  (function (DisplayType) {
@@ -103,7 +104,9 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
103
104
  this.optionsData = [];
104
105
  }
105
106
  if (this.productId && !salla.url.is_page('cart')) {
106
- salla.api.product.getDetails(this.productId, ['options']).then(resp => this.optionsData = resp.data.options);
107
+ salla.api.product.getDetails(this.productId, ['options']).then((resp) => {
108
+ this.optionsData = resp.data.options;
109
+ });
107
110
  }
108
111
  }
109
112
  //todo:: typo here, but I think we will drop it anyway😌
@@ -146,7 +149,8 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
146
149
  return salla.api.cart.getCurrentCartId();
147
150
  }
148
151
  render() {
149
- if (this.optionsData.length == 0) {
152
+ var _a;
153
+ if (((_a = this.optionsData) === null || _a === void 0 ? void 0 : _a.length) == 0) {
150
154
  return;
151
155
  }
152
156
  return (h(Host, { class: "s-product-options-wrapper" }, h("salla-conditional-fields", null, this.optionsData.map((option) => h("div", Object.assign({ class: `s-product-options-option-container${option.visibility_condition ? ' hidden' : ''}`, "data-option-id": option.id }, this.getOptionShownWhen(option)), option.name == 'splitter' ?
@@ -154,8 +158,10 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
154
158
  : h("div", { class: "s-product-options-option" }, h("label", { htmlFor: 'options[' + option.id + ']', class: "s-product-options-option-label" }, h("b", null, option.name, option.required && h("span", null, " * "), " "), h("small", null, option.placeholder)), h("div", { class: "s-product-options-option-content" }, this.getDisplayForType(option))))))));
155
159
  }
156
160
  //@ts-ignore
157
- donationOption(option) {
158
- return h("div", { class: "s-product-options-donation-wrapper" }, h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", value: option.value, placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.donationMoneyEntered.emit(e) }), h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol));
161
+ donationOption(option, product) {
162
+ return h("div", { class: "s-product-options-donation-wrapper" }, option.donation ?
163
+ h("div", { class: "s-product-options-donation-progress" }, h("salla-progress-bar", { donation: option.donation }))
164
+ : '', h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", value: option.value, placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.donationMoneyEntered.emit(e) }), h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol));
159
165
  }
160
166
  //todo:: why we need this way, use the native way!!
161
167
  //@ts-ignore
@@ -174,7 +180,7 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
174
180
  //@ts-ignore
175
181
  fileOption(option) {
176
182
  let types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
177
- return types.length
183
+ return (types === null || types === void 0 ? void 0 : types.length)
178
184
  ? this.fileUploader(option, { accept: types.join(',') })
179
185
  : 'File types not selected.';
180
186
  }
@@ -263,7 +269,7 @@ function defineCustomElement$1() {
263
269
  if (typeof customElements === "undefined") {
264
270
  return;
265
271
  }
266
- const components = ["salla-product-options", "salla-button", "salla-color-picker", "salla-conditional-fields", "salla-datetime-picker", "salla-file-upload", "salla-loading", "salla-map", "salla-modal"];
272
+ const components = ["salla-product-options", "salla-button", "salla-color-picker", "salla-conditional-fields", "salla-datetime-picker", "salla-file-upload", "salla-loading", "salla-map", "salla-modal", "salla-progress-bar"];
267
273
  components.forEach(tagName => { switch (tagName) {
268
274
  case "salla-product-options":
269
275
  if (!customElements.get(tagName)) {
@@ -272,40 +278,45 @@ function defineCustomElement$1() {
272
278
  break;
273
279
  case "salla-button":
274
280
  if (!customElements.get(tagName)) {
275
- defineCustomElement$9();
281
+ defineCustomElement$a();
276
282
  }
277
283
  break;
278
284
  case "salla-color-picker":
279
285
  if (!customElements.get(tagName)) {
280
- defineCustomElement$8();
286
+ defineCustomElement$9();
281
287
  }
282
288
  break;
283
289
  case "salla-conditional-fields":
284
290
  if (!customElements.get(tagName)) {
285
- defineCustomElement$7();
291
+ defineCustomElement$8();
286
292
  }
287
293
  break;
288
294
  case "salla-datetime-picker":
289
295
  if (!customElements.get(tagName)) {
290
- defineCustomElement$6();
296
+ defineCustomElement$7();
291
297
  }
292
298
  break;
293
299
  case "salla-file-upload":
294
300
  if (!customElements.get(tagName)) {
295
- defineCustomElement$5();
301
+ defineCustomElement$6();
296
302
  }
297
303
  break;
298
304
  case "salla-loading":
299
305
  if (!customElements.get(tagName)) {
300
- defineCustomElement$4();
306
+ defineCustomElement$5();
301
307
  }
302
308
  break;
303
309
  case "salla-map":
304
310
  if (!customElements.get(tagName)) {
305
- defineCustomElement$3();
311
+ defineCustomElement$4();
306
312
  }
307
313
  break;
308
314
  case "salla-modal":
315
+ if (!customElements.get(tagName)) {
316
+ defineCustomElement$3();
317
+ }
318
+ break;
319
+ case "salla-progress-bar":
309
320
  if (!customElements.get(tagName)) {
310
321
  defineCustomElement$2();
311
322
  }
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SallaProgressBar extends Components.SallaProgressBar, HTMLElement {}
4
+ export const SallaProgressBar: {
5
+ prototype: SallaProgressBar;
6
+ new (): SallaProgressBar;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { S as SallaProgressBar$1, d as defineCustomElement$1 } from './salla-progress-bar2.js';
5
+
6
+ const SallaProgressBar = SallaProgressBar$1;
7
+ const defineCustomElement = defineCustomElement$1;
8
+
9
+ export { SallaProgressBar, defineCustomElement };
@@ -0,0 +1,81 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
5
+
6
+ const sallaProgressBarCss = ".s-progress-bar-wrapper{background-color:#E5E7EB;width:100%;height:0.625rem;border-radius:9999px;margin-bottom:0.375rem}.s-progress-bar-progress{height:0.625rem;border-radius:9999px}.s-progress-bar-message{color:#a2a8b4;font-size:0.75rem;line-height:1rem;display:block;margin-bottom:0.625rem}";
7
+
8
+ const SallaProgressBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
+ constructor() {
10
+ super();
11
+ this.__registerHost();
12
+ try {
13
+ if (this.donation) {
14
+ let donationJson = typeof this.donation == 'string' ? JSON.parse(this.donation) : this.donation;
15
+ if (donationJson.can_donate) {
16
+ this.value = donationJson.collected_amount;
17
+ this.target = donationJson.target_amount;
18
+ this.header = salla.lang.get('pages.products.target');
19
+ this.message = salla.lang.get('pages.products.donation_target_date') + ' ' + donationJson.target_end_date;
20
+ }
21
+ else {
22
+ this.message = donationJson.target_message;
23
+ }
24
+ }
25
+ }
26
+ catch (e) {
27
+ salla.log('Wrong donation json');
28
+ }
29
+ salla.lang.onLoaded(() => {
30
+ var _a, _b;
31
+ this.header = (_a = this.header) === null || _a === void 0 ? void 0 : _a.replace('pages.products.target', salla.lang.get('pages.products.target'));
32
+ this.message = (_b = this.message) === null || _b === void 0 ? void 0 : _b.replace('pages.products.donation_target_date', salla.lang.get('pages.products.donation_target_date'));
33
+ });
34
+ salla.onReady(() => {
35
+ this.color = this.color || salla.config.get('theme.color.primary', "#ffd5c4");
36
+ if (!this.unit) {
37
+ this.unit = salla.config.currency().symbol;
38
+ }
39
+ });
40
+ }
41
+ getPercentage() {
42
+ return (this.value / this.target) * 100;
43
+ }
44
+ render() {
45
+ if (!this.target && !this.message) {
46
+ return '';
47
+ }
48
+ return (h("div", { class: "s-progress-bar-container" }, this.header ? h("div", { class: "s-progress-bar-header" }, this.header) : '', this.getProgressBar(), this.message ? h("span", { class: "s-progress-bar-message" }, this.message) : ''));
49
+ }
50
+ getProgressBar() {
51
+ return this.target ? [
52
+ h("div", { class: "s-progress-bar-target-section" }, h("span", null, salla.helpers.number(this.value), " ", this.unit), h("span", null, salla.helpers.number(this.target), " ", this.unit)),
53
+ h("div", { class: "s-progress-bar-wrapper" }, h("div", { class: "s-progress-bar-progress", style: { 'width': `${this.getPercentage()}%`, 'background-color': this.color } }))
54
+ ] : '';
55
+ }
56
+ static get style() { return sallaProgressBarCss; }
57
+ }, [0, "salla-progress-bar", {
58
+ "donation": [1],
59
+ "target": [1026],
60
+ "value": [1026],
61
+ "header": [1025],
62
+ "message": [1025],
63
+ "unit": [1025],
64
+ "color": [1025]
65
+ }]);
66
+ function defineCustomElement() {
67
+ if (typeof customElements === "undefined") {
68
+ return;
69
+ }
70
+ const components = ["salla-progress-bar"];
71
+ components.forEach(tagName => { switch (tagName) {
72
+ case "salla-progress-bar":
73
+ if (!customElements.get(tagName)) {
74
+ customElements.define(tagName, SallaProgressBar);
75
+ }
76
+ break;
77
+ } });
78
+ }
79
+ defineCustomElement();
80
+
81
+ export { SallaProgressBar as S, defineCustomElement as d };
@@ -17,6 +17,7 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
17
17
  constructor() {
18
18
  super();
19
19
  this.__registerHost();
20
+ this.afterInit = createEvent(this, "afterInit", 7);
20
21
  this.slideChange = createEvent(this, "slideChange", 7);
21
22
  this.reachBeginning = createEvent(this, "reachBeginning", 7);
22
23
  this.reachEnd = createEvent(this, "reachEnd", 7);
@@ -339,9 +340,11 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
339
340
  autoHeight: this.autoHeight,
340
341
  lazy: true,
341
342
  on: {
342
- // todo:: find better way for this workaround to show lazyLoad for duplicated slides, for some reason they are loaded but class not added.
343
+ // todo:: find better way for this workaround to show lazyLoad for duplicated slides, because it clones the slide after it's already rendered,
344
+ // then it re appended it as is,in this case the image is loaded but class not added.
343
345
  afterInit: (slider) => {
344
346
  var _a;
347
+ this.afterInit.emit(slider);
345
348
  (_a = document.lazyLoadInstance) === null || _a === void 0 ? void 0 : _a.update();
346
349
  this.loop && slider.slides.map(slide => {
347
350
  if (!slide.classList.contains('swiper-slide-duplicate')) {
@@ -403,7 +406,6 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
403
406
  }
404
407
  initSlider() {
405
408
  for (const slide of this.sliderWrapper.children) {
406
- //todo:: use `s-slider-slide`
407
409
  slide.classList.add('swiper-slide');
408
410
  }
409
411
  // @ts-ignore
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ const CameraIcon = `<!-- Generated by IcoMoon.io -->
5
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
6
+ <title>camera</title>
7
+ <path d="M16 10.667c-4.044 0-7.333 3.289-7.333 7.333s3.289 7.333 7.333 7.333 7.333-3.289 7.333-7.333-3.289-7.333-7.333-7.333zM16 22.667c-2.573 0-4.667-2.093-4.667-4.667s2.093-4.667 4.667-4.667 4.667 2.093 4.667 4.667-2.093 4.667-4.667 4.667zM28 5.333h-3.287l-2.271-3.407c-0.248-0.371-0.664-0.593-1.109-0.593h-10.667c-0.445 0-0.861 0.223-1.109 0.593l-2.271 3.407h-3.287c-2.205 0-4 1.795-4 4v17.333c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-17.333c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.735-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.599-1.333-1.333v-17.333c0-0.735 0.599-1.333 1.333-1.333h4c0.445 0 0.861-0.223 1.109-0.593l2.272-3.407h9.239l2.271 3.407c0.248 0.371 0.664 0.593 1.109 0.593h4c0.735 0 1.333 0.599 1.333 1.333zM25.333 10.66c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327z"></path>
8
+ </svg>
9
+ `;
10
+
11
+ export { CameraIcon as C };
@@ -1886,10 +1886,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1886
1886
  }
1887
1887
  switch(bundleId) {
1888
1888
 
1889
- case 'salla-button_37':
1889
+ case 'salla-button_36':
1890
1890
  return import(
1891
1891
  /* webpackMode: "lazy" */
1892
- './salla-button_37.entry.js').then(processMod, consoleError);
1892
+ './salla-button_36.entry.js').then(processMod, consoleError);
1893
1893
  case 'salla-add-product-button':
1894
1894
  return import(
1895
1895
  /* webpackMode: "lazy" */
@@ -1902,10 +1902,18 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1902
1902
  return import(
1903
1903
  /* webpackMode: "lazy" */
1904
1904
  './salla-loyalty-prize-item.entry.js').then(processMod, consoleError);
1905
+ case 'salla-product-options':
1906
+ return import(
1907
+ /* webpackMode: "lazy" */
1908
+ './salla-product-options.entry.js').then(processMod, consoleError);
1905
1909
  case 'salla-select':
1906
1910
  return import(
1907
1911
  /* webpackMode: "lazy" */
1908
1912
  './salla-select.entry.js').then(processMod, consoleError);
1913
+ case 'salla-conditional-fields':
1914
+ return import(
1915
+ /* webpackMode: "lazy" */
1916
+ './salla-conditional-fields.entry.js').then(processMod, consoleError);
1909
1917
  }
1910
1918
  }
1911
1919
  return import(