@salla.sa/twilight-components 1.0.57 → 1.0.60

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 (161) hide show
  1. package/dist/cjs/{index-0b5b5867.js → index-543e387e.js} +293 -8
  2. package/dist/cjs/index.cjs.js +0 -11
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/salla-branches.cjs.entry.js +2 -2
  5. package/dist/cjs/salla-button.cjs.entry.js +9 -9
  6. package/dist/cjs/salla-conditional-fields.cjs.entry.js +90 -0
  7. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
  8. package/dist/cjs/salla-localization-modal.cjs.entry.js +2 -2
  9. package/dist/cjs/salla-login-modal.cjs.entry.js +199 -4
  10. package/dist/cjs/salla-modal_2.cjs.entry.js +87 -4
  11. package/dist/cjs/salla-offer-modal.cjs.entry.js +2 -2
  12. package/dist/cjs/salla-product-availability.cjs.entry.js +2 -2
  13. package/dist/cjs/salla-quantity-input.cjs.entry.js +67 -0
  14. package/dist/cjs/salla-rating-modal.cjs.entry.js +6 -56
  15. package/dist/cjs/salla-rating-stars.cjs.entry.js +80 -0
  16. package/dist/cjs/salla-tabby.cjs.entry.js +19 -0
  17. package/dist/cjs/salla-tamara.cjs.entry.js +19 -0
  18. package/dist/cjs/salla-tel-input.cjs.entry.js +2 -2
  19. package/dist/cjs/salla-verify-modal.cjs.entry.js +2 -2
  20. package/dist/cjs/twilight-components.cjs.js +2 -2
  21. package/dist/collection/collection-manifest.json +7 -2
  22. package/dist/collection/components/salla-branches/salla-branches.css +1077 -0
  23. package/dist/collection/components/salla-button/salla-button.css +1077 -0
  24. package/dist/collection/components/salla-button/salla-button.js +10 -10
  25. package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.css +3 -0
  26. package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +96 -0
  27. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.css +1077 -0
  28. package/dist/collection/components/salla-localization-modal/salla-localization-modal.css +1077 -0
  29. package/dist/collection/components/salla-login-modal/salla-login-modal.css +1077 -0
  30. package/dist/collection/components/salla-modal/salla-modal.css +1077 -0
  31. package/dist/collection/components/salla-offer-modal/salla-offer-modal.css +1077 -0
  32. package/dist/collection/components/salla-product-availability/salla-product-availability.css +1077 -0
  33. package/dist/collection/components/salla-quantity-input/salla-quantity-input.css +3 -0
  34. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +74 -0
  35. package/dist/collection/components/salla-rating-modal/salla-rating-modal.css +1077 -0
  36. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +5 -59
  37. package/dist/collection/components/salla-rating-stars/salla-rating-stars.css +1089 -0
  38. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +137 -0
  39. package/dist/collection/components/salla-search/salla-search.css +1077 -0
  40. package/dist/collection/components/salla-tabby/salla-tabby.css +1117 -0
  41. package/dist/collection/components/salla-tabby/salla-tabby.js +14 -0
  42. package/dist/collection/components/salla-tamara/salla-tamara.css +1135 -0
  43. package/dist/collection/components/salla-tamara/salla-tamara.js +15 -0
  44. package/dist/collection/components/salla-tel-input/salla-tel-input.css +1290 -0
  45. package/dist/collection/components/salla-verify-modal/salla-verify-modal.css +1077 -0
  46. package/dist/collection/index.js +1 -2
  47. package/dist/components/Helper.js +23 -0
  48. package/dist/components/index.d.ts +26 -0
  49. package/dist/components/index.js +1 -0
  50. package/dist/components/salla-branches.d.ts +7 -0
  51. package/dist/components/salla-branches.js +90 -0
  52. package/dist/components/salla-button.d.ts +7 -0
  53. package/dist/components/salla-button.js +118 -0
  54. package/dist/components/salla-conditional-fields.d.ts +7 -0
  55. package/dist/components/salla-conditional-fields.js +89 -0
  56. package/dist/components/salla-infinite-scroll.d.ts +7 -0
  57. package/dist/components/salla-infinite-scroll.js +93 -0
  58. package/dist/components/salla-localization-modal.d.ts +7 -0
  59. package/dist/components/salla-localization-modal.js +116 -0
  60. package/dist/components/salla-login-modal.d.ts +7 -0
  61. package/dist/components/salla-login-modal.js +205 -0
  62. package/dist/components/salla-modal.d.ts +7 -0
  63. package/dist/components/salla-modal.js +152 -0
  64. package/dist/components/salla-offer-modal.d.ts +7 -0
  65. package/dist/components/salla-offer-modal.js +141 -0
  66. package/dist/components/salla-product-availability.d.ts +7 -0
  67. package/dist/components/salla-product-availability.js +114 -0
  68. package/dist/components/salla-quantity-input.d.ts +7 -0
  69. package/dist/components/salla-quantity-input.js +66 -0
  70. package/dist/components/salla-rating-modal.d.ts +7 -0
  71. package/dist/components/salla-rating-modal.js +178 -0
  72. package/dist/components/salla-rating-stars.d.ts +7 -0
  73. package/dist/components/salla-rating-stars.js +79 -0
  74. package/dist/components/salla-search.d.ts +7 -0
  75. package/dist/components/salla-search.js +91 -0
  76. package/dist/components/salla-tabby.d.ts +7 -0
  77. package/dist/components/salla-tabby.js +18 -0
  78. package/dist/components/salla-tamara.d.ts +7 -0
  79. package/dist/components/salla-tamara.js +19 -0
  80. package/dist/components/salla-tel-input.d.ts +7 -0
  81. package/dist/components/salla-tel-input.js +1477 -0
  82. package/dist/components/salla-verify-modal.d.ts +7 -0
  83. package/dist/components/salla-verify-modal.js +147 -0
  84. package/dist/esm/{index-8b97d225.js → index-2423ebcb.js} +293 -8
  85. package/dist/esm/index.js +1 -4
  86. package/dist/esm/loader.js +2 -2
  87. package/dist/esm/salla-branches.entry.js +2 -2
  88. package/dist/esm/salla-button.entry.js +9 -9
  89. package/dist/esm/salla-conditional-fields.entry.js +86 -0
  90. package/dist/esm/salla-infinite-scroll.entry.js +2 -2
  91. package/dist/esm/salla-localization-modal.entry.js +2 -2
  92. package/dist/esm/salla-login-modal.entry.js +202 -3
  93. package/dist/esm/salla-modal_2.entry.js +87 -4
  94. package/dist/esm/salla-offer-modal.entry.js +2 -2
  95. package/dist/esm/salla-product-availability.entry.js +2 -2
  96. package/dist/esm/salla-quantity-input.entry.js +63 -0
  97. package/dist/esm/salla-rating-modal.entry.js +6 -56
  98. package/dist/esm/salla-rating-stars.entry.js +76 -0
  99. package/dist/esm/salla-tabby.entry.js +15 -0
  100. package/dist/esm/salla-tamara.entry.js +15 -0
  101. package/dist/esm/salla-tel-input.entry.js +2 -2
  102. package/dist/esm/salla-verify-modal.entry.js +2 -2
  103. package/dist/esm/twilight-components.js +2 -2
  104. package/dist/twilight-components/index.esm.js +0 -1
  105. package/dist/twilight-components/p-01accdcd.entry.js +1 -0
  106. package/dist/twilight-components/p-0e85664f.entry.js +1 -0
  107. package/dist/twilight-components/p-0ee36dd8.entry.js +1 -0
  108. package/dist/twilight-components/p-1fb0ca8a.js +1 -0
  109. package/dist/twilight-components/p-1ffd27c4.entry.js +1 -0
  110. package/dist/twilight-components/p-2012882b.entry.js +1 -0
  111. package/dist/twilight-components/p-3d9fd3d3.entry.js +1 -0
  112. package/dist/twilight-components/p-5b2cdd7c.entry.js +1 -0
  113. package/dist/twilight-components/p-728bd268.entry.js +1 -0
  114. package/dist/twilight-components/p-72985a41.entry.js +1 -0
  115. package/dist/twilight-components/p-747f80df.entry.js +1 -0
  116. package/dist/twilight-components/p-81a7a676.entry.js +1 -0
  117. package/dist/twilight-components/p-880711d4.entry.js +1 -0
  118. package/dist/twilight-components/p-8dd742df.entry.js +1 -0
  119. package/dist/twilight-components/p-9642541b.entry.js +1 -0
  120. package/dist/twilight-components/p-a24588ab.entry.js +1 -0
  121. package/dist/twilight-components/p-e3cbda45.entry.js +1 -0
  122. package/dist/twilight-components/twilight-components.css +1 -1
  123. package/dist/twilight-components/twilight-components.esm.js +1 -1
  124. package/dist/types/components/salla-button/salla-button.d.ts +2 -2
  125. package/dist/types/components/salla-conditional-fields/salla-conditional-fields.d.ts +10 -0
  126. package/dist/types/components/salla-quantity-input/salla-quantity-input.d.ts +19 -0
  127. package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +0 -3
  128. package/dist/types/components/salla-rating-stars/salla-rating-stars.d.ts +11 -0
  129. package/dist/types/components/salla-tabby/salla-tabby.d.ts +3 -0
  130. package/dist/types/components/salla-tamara/salla-tamara.d.ts +3 -0
  131. package/dist/types/components.d.ts +79 -8
  132. package/dist/types/index.d.ts +1 -2
  133. package/example/assets/images/star.png +0 -0
  134. package/example/dist/tailwind.css +964 -329
  135. package/example/dist/twilight.js +437 -2
  136. package/example/index.html +681 -125
  137. package/package.json +17 -10
  138. package/dist/cjs/salla-login-modal-02e4e65e.js +0 -204
  139. package/dist/cjs/salla-search-9d17eb96.js +0 -90
  140. package/dist/esm/salla-login-modal-7ad386c8.js +0 -202
  141. package/dist/esm/salla-search-ce45eb5b.js +0 -88
  142. package/dist/loader/cdn.js +0 -3
  143. package/dist/loader/index.cjs.js +0 -3
  144. package/dist/loader/index.d.ts +0 -13
  145. package/dist/loader/index.es2017.js +0 -3
  146. package/dist/loader/index.js +0 -4
  147. package/dist/loader/package.json +0 -10
  148. package/dist/twilight-components/p-1514ed09.js +0 -1
  149. package/dist/twilight-components/p-2a032b88.entry.js +0 -1
  150. package/dist/twilight-components/p-2f3f4cce.entry.js +0 -1
  151. package/dist/twilight-components/p-635c08a7.entry.js +0 -1
  152. package/dist/twilight-components/p-646fbb7f.entry.js +0 -1
  153. package/dist/twilight-components/p-64977eab.entry.js +0 -1
  154. package/dist/twilight-components/p-79ab1ed9.entry.js +0 -1
  155. package/dist/twilight-components/p-7c4ba872.entry.js +0 -1
  156. package/dist/twilight-components/p-84936d9d.entry.js +0 -1
  157. package/dist/twilight-components/p-884a80ca.entry.js +0 -1
  158. package/dist/twilight-components/p-c51984d6.entry.js +0 -1
  159. package/dist/twilight-components/p-cb1c59a2.js +0 -1
  160. package/dist/twilight-components/p-ebd63ad4.js +0 -1
  161. package/dist/twilight-components/p-ee9d8563.entry.js +0 -1
@@ -3,9 +3,9 @@ export class SallaButton {
3
3
  constructor() {
4
4
  this.hostAttributes = {};
5
5
  /**
6
- * Button Type
6
+ * Button Type todo :: find better name,
7
7
  */
8
- this.buttonType = 'btn';
8
+ this.shape = 'btn';
9
9
  /**
10
10
  * Button Color
11
11
  */
@@ -84,21 +84,21 @@ export class SallaButton {
84
84
  }
85
85
  getBtnAttributes() {
86
86
  for (let i = 0; i < this.host.attributes.length; i++) {
87
- if (!['type', 'color', 'fill', 'size', 'width', 'id', 'loading'].includes(this.host.attributes[i].name)) {
87
+ if (!['color', 'fill', 'size', 'width', 'id', 'loading'].includes(this.host.attributes[i].name)) {
88
88
  this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
89
89
  }
90
90
  }
91
91
  this.hostAttributes.type = this.hostAttributes.type || 'button';
92
92
  this.hostAttributes.class +=
93
- ' s-button-element s-button-' + this.buttonType
93
+ ' s-button-element s-button-' + this.shape
94
94
  + ' s-button-' + (this.fill == "none" ? 'fill-none' : this.fill)
95
95
  + (this.size != "medium" ? ' s-button-' + this.size : '')
96
96
  + (this.width != "normal" ? ' s-button-' + this.width : '')
97
- + (this.buttonType == "link" ? ' s-button-' + this.color + '-link' : '')
98
- + (this.buttonType != "link" && this.fill != 'outline' ? ' s-button-' + this.color : '')
97
+ + (this.shape == "link" ? ' s-button-' + this.color + '-link' : '')
98
+ + (this.shape != "link" && this.fill != 'outline' ? ' s-button-' + this.color : '')
99
99
  + (this.fill == 'outline' ? ' s-button-' + this.color + '-outline' : '')
100
100
  + (this.disabled ? ' s-button-disabled ' : '')
101
- + (this.buttonType == 'icon' ? ' s-button-loader-center' : ' s-button-loader-' + this.loaderPosition);
101
+ + (this.shape == 'icon' ? ' s-button-loader-center' : ' s-button-loader-' + this.loaderPosition);
102
102
  return this.hostAttributes;
103
103
  }
104
104
  render() {
@@ -116,7 +116,7 @@ export class SallaButton {
116
116
  "$": ["salla-button.css"]
117
117
  }; }
118
118
  static get properties() { return {
119
- "buttonType": {
119
+ "shape": {
120
120
  "type": "string",
121
121
  "mutable": false,
122
122
  "complexType": {
@@ -128,9 +128,9 @@ export class SallaButton {
128
128
  "optional": false,
129
129
  "docs": {
130
130
  "tags": [],
131
- "text": "Button Type"
131
+ "text": "Button Type todo :: find better name,"
132
132
  },
133
- "attribute": "button-type",
133
+ "attribute": "shape",
134
134
  "reflect": true,
135
135
  "defaultValue": "'btn'"
136
136
  },
@@ -0,0 +1,96 @@
1
+ import { Component, Element, Host, Listen, h } from '@stencil/core';
2
+ /**
3
+ * its to easy to use, currenlty its support select & checkbox input as trigger for show/hide the dom
4
+ * the dom you can put it like this data-show-when="{name of the field} {= or !=} {value of the field}"
5
+ */
6
+ export class SallaConditionalFields {
7
+ changeHandler(event) {
8
+ var _a;
9
+ salla.log('Received the change event: ', event);
10
+ if (!event.target || !['SELECT'].includes(event.target.tagName) && !['checkbox'].includes(event.target.getAttribute('type'))) {
11
+ // todo :: support debug
12
+ salla.log('Ignore the change because is not support input: ' + (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.tagName) || 'N/A'));
13
+ return;
14
+ }
15
+ // to extract the option id from the input name, the supported names are name[*] and name[*][]
16
+ let optionId = event.target.name.replace('[]', '');
17
+ let isMultiple = event.target.getAttribute('type') === 'checkbox';
18
+ salla.log('Trying to find all the element with condation:', `[data-show-when^="${optionId}"]`);
19
+ this.host.querySelectorAll(`[data-show-when^="${optionId}"]`)
20
+ .forEach((field) => {
21
+ // @ts-ignore
22
+ let isEqual = !(field === null || field === void 0 ? void 0 : field.dataset.showWhen.includes('!='));
23
+ // @ts-ignore
24
+ let value = field === null || field === void 0 ? void 0 : field.dataset.showWhen.replace(/(.*)(=|!=)(.*)/gm, '$3').trim();
25
+ // let isSelected = isMultiple ? event.target?.checked : value === event.target.value;
26
+ let isSelected = false;
27
+ if (isMultiple) {
28
+ // @ts-ignore
29
+ let selectedValues = Array.from(this.host.querySelectorAll(`input[name="${event.target.name}"]:checked`), e => e === null || e === void 0 ? void 0 : e.value);
30
+ isSelected = selectedValues.includes(value.toString());
31
+ }
32
+ else {
33
+ isSelected = value === event.target.value;
34
+ }
35
+ salla.log('The input is ', (isMultiple ? 'Multiple' : 'Single'), ' value:', isSelected);
36
+ let showTheInput = (isEqual && isSelected) || (!isEqual && !isSelected);
37
+ if (showTheInput) {
38
+ field.classList.remove('hidden');
39
+ field.querySelectorAll('[name]').forEach((input) => {
40
+ input.removeAttribute('disabled');
41
+ //To handle focus on hidden input error
42
+ if (!['checkbox'].includes(input.getAttribute('type')) && field.getElementsByClassName('required').length) {
43
+ input.setAttribute('required', '');
44
+ }
45
+ });
46
+ }
47
+ else {
48
+ field.classList.add('hidden');
49
+ field.querySelectorAll('[name]').forEach((input) => {
50
+ input.setAttribute('disabled', '');
51
+ input.removeAttribute('required');
52
+ if (['checkbox'].includes(input.getAttribute('type')) && input.hasOwnProperty('checked')) {
53
+ // @ts-ignore
54
+ input.checked = false;
55
+ }
56
+ //firing this event will show errors, so don't run it when pageLoading.
57
+ // if (this.optionsAlreadyInitiated) {
58
+ // salla.document.event.fireEvent(input, 'change', {'bubbles': true});
59
+ // }
60
+ });
61
+ }
62
+ });
63
+ }
64
+ componentDidRender() {
65
+ this.host.querySelectorAll(`[data-show-when]`).forEach((field) => {
66
+ var _a;
67
+ // @ts-ignore
68
+ let optionName = (_a = field === null || field === void 0 ? void 0 : field.dataset) === null || _a === void 0 ? void 0 : _a.showWhen.replace(/(.*)(=|!=)(.*)/gm, '$1').trim();
69
+ if (!optionName) {
70
+ return;
71
+ }
72
+ this.changeHandler({
73
+ target: this.host.querySelector('[name^="' + optionName + '"]')
74
+ });
75
+ });
76
+ }
77
+ render() {
78
+ return (h(Host, null,
79
+ h("slot", null)));
80
+ }
81
+ static get is() { return "salla-conditional-fields"; }
82
+ static get originalStyleUrls() { return {
83
+ "$": ["salla-conditional-fields.css"]
84
+ }; }
85
+ static get styleUrls() { return {
86
+ "$": ["salla-conditional-fields.css"]
87
+ }; }
88
+ static get elementRef() { return "host"; }
89
+ static get listeners() { return [{
90
+ "name": "change",
91
+ "method": "changeHandler",
92
+ "target": undefined,
93
+ "capture": false,
94
+ "passive": false
95
+ }]; }
96
+ }