@salla.sa/twilight-components 1.0.0

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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/cjs/index-6ea83d19.js +1619 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/cjs/salla-alert_3.cjs.entry.js +171 -0
  7. package/dist/cjs/salla-modal.cjs.entry.js +52 -0
  8. package/dist/cjs/twilight-components.cjs.js +19 -0
  9. package/dist/collection/collection-manifest.json +15 -0
  10. package/dist/collection/components/alert/alert.css +112 -0
  11. package/dist/collection/components/alert/alert.js +194 -0
  12. package/dist/collection/components/generate-summary.js +35 -0
  13. package/dist/collection/components/modal/modal.css +158 -0
  14. package/dist/collection/components/modal/modal.js +180 -0
  15. package/dist/collection/components/salla-login/salla-login.css +104 -0
  16. package/dist/collection/components/salla-login/salla-login.js +113 -0
  17. package/dist/collection/components/search-modal/search-modal.css +0 -0
  18. package/dist/collection/components/search-modal/search-modal.js +126 -0
  19. package/dist/collection/index.js +1 -0
  20. package/dist/collection/interfaces/colors.js +1 -0
  21. package/dist/collection/interfaces/index.js +2 -0
  22. package/dist/collection/interfaces/ratio.js +1 -0
  23. package/dist/collection/plugins/tailwind-theme/index.js +35 -0
  24. package/dist/collection/plugins/tailwind-theme/scripts/generator.js +51 -0
  25. package/dist/collection/utils/utils.js +16 -0
  26. package/dist/esm/index-3c2b0663.js +1591 -0
  27. package/dist/esm/index.js +1 -0
  28. package/dist/esm/loader.js +17 -0
  29. package/dist/esm/polyfills/core-js.js +11 -0
  30. package/dist/esm/polyfills/css-shim.js +1 -0
  31. package/dist/esm/polyfills/dom.js +79 -0
  32. package/dist/esm/polyfills/es5-html-element.js +1 -0
  33. package/dist/esm/polyfills/index.js +34 -0
  34. package/dist/esm/polyfills/system.js +6 -0
  35. package/dist/esm/salla-alert_3.entry.js +165 -0
  36. package/dist/esm/salla-modal.entry.js +48 -0
  37. package/dist/esm/twilight-components.js +17 -0
  38. package/dist/index.cjs.js +1 -0
  39. package/dist/index.js +1 -0
  40. package/dist/twilight-components/index.esm.js +0 -0
  41. package/dist/twilight-components/p-58168e3c.entry.js +1 -0
  42. package/dist/twilight-components/p-a2a8cae2.entry.js +1 -0
  43. package/dist/twilight-components/p-e1773073.js +1 -0
  44. package/dist/twilight-components/twilight-components.esm.js +1 -0
  45. package/dist/types/components/alert/alert.d.ts +38 -0
  46. package/dist/types/components/modal/modal.d.ts +28 -0
  47. package/dist/types/components/salla-login/salla-login.d.ts +14 -0
  48. package/dist/types/components/search-modal/search-modal.d.ts +22 -0
  49. package/dist/types/components.d.ts +188 -0
  50. package/dist/types/index.d.ts +1 -0
  51. package/dist/types/interfaces/colors.d.ts +1 -0
  52. package/dist/types/interfaces/index.d.ts +2 -0
  53. package/dist/types/interfaces/ratio.d.ts +1 -0
  54. package/dist/types/stencil-public-runtime.d.ts +1563 -0
  55. package/dist/types/utils/utils.d.ts +6 -0
  56. package/loader/cdn.js +3 -0
  57. package/loader/index.cjs.js +3 -0
  58. package/loader/index.d.ts +13 -0
  59. package/loader/index.es2017.js +3 -0
  60. package/loader/index.js +4 -0
  61. package/loader/package.json +10 -0
  62. package/package.json +66 -0
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Initial Variables
3
+ */
4
+ /**
5
+ * Functions
6
+ */
7
+ /**
8
+ * Delivered variables
9
+ */
10
+ .wrapper {
11
+ opacity: 0;
12
+ visibility: hidden;
13
+ position: fixed;
14
+ width: 100%;
15
+ height: 100%;
16
+ top: 0;
17
+ left: 0;
18
+ background: rgba(0, 0, 0, 0.42);
19
+ -webkit-transition: opacity 0.5s, visibility 0s 0.5s;
20
+ transition: opacity 0.5s, visibility 0s 0.5s;
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ z-index: 1050;
25
+ }
26
+ .wrapper .modal {
27
+ font-family: Helvetica, sans-serif;
28
+ font-size: 14px;
29
+ background-color: #fff;
30
+ position: absolute;
31
+ top: 50%;
32
+ left: 50%;
33
+ transform: translate(-50%, -50%);
34
+ width: 90%;
35
+ border: 1px solid rgba(0, 0, 0, 0.2);
36
+ border-radius: 0.3rem;
37
+ }
38
+ @media (min-width: 576px) {
39
+ .wrapper .modal {
40
+ max-width: 500px;
41
+ }
42
+ }
43
+ .wrapper .modal .modal-header {
44
+ display: none;
45
+ -ms-flex-align: start;
46
+ align-items: flex-start;
47
+ -ms-flex-pack: justify;
48
+ justify-content: space-between;
49
+ padding: 1rem 1rem;
50
+ border-bottom: 1px solid #dee2e6;
51
+ border-top-left-radius: 0.3rem;
52
+ border-top-right-radius: 0.3rem;
53
+ }
54
+ .wrapper .modal .modal-header h5 {
55
+ margin: 0;
56
+ font-weight: normal;
57
+ }
58
+ .wrapper .modal .modal-header .title {
59
+ font-size: 1.25rem;
60
+ }
61
+ .wrapper .modal .modal-header button.close {
62
+ padding: 0;
63
+ background-color: transparent;
64
+ border: 0;
65
+ -webkit-appearance: none;
66
+ -moz-appearance: none;
67
+ appearance: none;
68
+ color: grey;
69
+ outline: 0;
70
+ float: right;
71
+ font-size: 1.5rem;
72
+ font-weight: 700;
73
+ line-height: 1;
74
+ text-shadow: 0 1px 0 #fff;
75
+ opacity: 0.5;
76
+ }
77
+ .wrapper .modal .modal-header button.close :hover {
78
+ color: black;
79
+ cursor: pointer;
80
+ }
81
+ .wrapper .modal .displayed {
82
+ display: flex;
83
+ }
84
+ .wrapper .modal .modal-body {
85
+ position: relative;
86
+ -ms-flex: 1 1 auto;
87
+ flex: 1 1 auto;
88
+ padding: 1rem;
89
+ }
90
+ .wrapper .modal .modal-footer {
91
+ display: -ms-flexbox;
92
+ display: flex;
93
+ -ms-flex-align: center;
94
+ align-items: center;
95
+ -ms-flex-pack: end;
96
+ justify-content: flex-end;
97
+ padding: 1rem;
98
+ border-top: 1px solid #dee2e6;
99
+ border-bottom-right-radius: 0.3rem;
100
+ border-bottom-left-radius: 0.3rem;
101
+ }
102
+ .wrapper .modal .modal-footer .btn-primary {
103
+ color: #fff;
104
+ background-color: #007bff;
105
+ border-color: #007bff;
106
+ outline: none;
107
+ }
108
+ .wrapper .modal .modal-footer .btn-primary:hover {
109
+ background-color: #0069d9;
110
+ border-color: #0062cc;
111
+ cursor: pointer;
112
+ }
113
+ .wrapper .modal .modal-footer .btn-secondary {
114
+ color: #fff;
115
+ background-color: #6c757d;
116
+ border-color: #6c757d;
117
+ outline: none;
118
+ }
119
+ .wrapper .modal .modal-footer .btn-secondary:hover {
120
+ background-color: #5a6269;
121
+ border-color: #5a6269;
122
+ cursor: pointer;
123
+ }
124
+ .wrapper .modal .modal-footer > :not(:last-child) {
125
+ margin-right: 0.25rem;
126
+ }
127
+ .wrapper .modal .button-container {
128
+ text-align: right;
129
+ }
130
+ .wrapper .modal button {
131
+ display: inline-block;
132
+ font-weight: 400;
133
+ color: #212529;
134
+ text-align: center;
135
+ vertical-align: middle;
136
+ -webkit-user-select: none;
137
+ -moz-user-select: none;
138
+ -ms-user-select: none;
139
+ user-select: none;
140
+ background-color: transparent;
141
+ border: 1px solid transparent;
142
+ padding: 0.375rem 0.75rem;
143
+ font-size: 1rem;
144
+ line-height: 1.5;
145
+ border-radius: 0.25rem;
146
+ transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
147
+ }
148
+ .wrapper .modal button:hover {
149
+ background-color: #6c757d;
150
+ border-color: #6c757d;
151
+ }
152
+
153
+ .visible {
154
+ opacity: 1;
155
+ visibility: visible;
156
+ transform: scale(1);
157
+ transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
158
+ }
@@ -0,0 +1,180 @@
1
+ import { Component, Event, h, Prop } from '@stencil/core';
2
+ export class Modal {
3
+ constructor() {
4
+ /**
5
+ * The title to display in the modal.
6
+ */
7
+ this.modalTitle = 'Modal Title';
8
+ /**
9
+ * The text to display in the cancel button.
10
+ */
11
+ this.cancelText = 'Cancel';
12
+ /**
13
+ * The text to display in the save button.
14
+ */
15
+ this.saveText = 'Save';
16
+ /**
17
+ * If 'true' will make the modal visible.
18
+ */
19
+ this.visible = false;
20
+ /**
21
+ * If 'true' will show the modal header.
22
+ */
23
+ this.modalHeader = false;
24
+ this.handleCancelClick = () => {
25
+ this.visible = false;
26
+ this.cancel.emit();
27
+ };
28
+ this.handleOkClick = () => {
29
+ this.visible = false;
30
+ this.ok.emit();
31
+ };
32
+ this.handleClose = () => {
33
+ this.visible = false;
34
+ };
35
+ }
36
+ render() {
37
+ return (h("div", { class: this.visible ? 'wrapper visible' : 'wrapper' },
38
+ h("div", { class: "modal" },
39
+ h("div", { class: this.modalHeader ? 'modal-header displayed' : 'modal-header' },
40
+ h("h5", { class: "title" }, this.modalTitle),
41
+ h("button", { type: "button", class: "close", "data-dismiss": "modal", "aria-label": "Close", onClick: this.handleClose },
42
+ h("span", { "aria-hidden": "true" }, "\u00D7"))),
43
+ h("div", { class: "modal-body" },
44
+ h("slot", null)),
45
+ h("div", { class: "modal-footer" },
46
+ h("button", { type: "button", class: "btn-secondary", onClick: this.handleCancelClick }, this.cancelText),
47
+ h("button", { type: "button", class: "btn-primary", onClick: this.handleOkClick }, this.saveText)))));
48
+ }
49
+ static get is() { return "salla-modal"; }
50
+ static get encapsulation() { return "scoped"; }
51
+ static get originalStyleUrls() { return {
52
+ "$": ["modal.scss"]
53
+ }; }
54
+ static get styleUrls() { return {
55
+ "$": ["modal.css"]
56
+ }; }
57
+ static get properties() { return {
58
+ "modalTitle": {
59
+ "type": "string",
60
+ "mutable": false,
61
+ "complexType": {
62
+ "original": "string",
63
+ "resolved": "string",
64
+ "references": {}
65
+ },
66
+ "required": false,
67
+ "optional": false,
68
+ "docs": {
69
+ "tags": [],
70
+ "text": "The title to display in the modal."
71
+ },
72
+ "attribute": "modal-title",
73
+ "reflect": false,
74
+ "defaultValue": "'Modal Title'"
75
+ },
76
+ "cancelText": {
77
+ "type": "string",
78
+ "mutable": false,
79
+ "complexType": {
80
+ "original": "string",
81
+ "resolved": "string",
82
+ "references": {}
83
+ },
84
+ "required": false,
85
+ "optional": false,
86
+ "docs": {
87
+ "tags": [],
88
+ "text": "The text to display in the cancel button."
89
+ },
90
+ "attribute": "cancel-text",
91
+ "reflect": false,
92
+ "defaultValue": "'Cancel'"
93
+ },
94
+ "saveText": {
95
+ "type": "string",
96
+ "mutable": false,
97
+ "complexType": {
98
+ "original": "string",
99
+ "resolved": "string",
100
+ "references": {}
101
+ },
102
+ "required": false,
103
+ "optional": false,
104
+ "docs": {
105
+ "tags": [],
106
+ "text": "The text to display in the save button."
107
+ },
108
+ "attribute": "save-text",
109
+ "reflect": false,
110
+ "defaultValue": "'Save'"
111
+ },
112
+ "visible": {
113
+ "type": "boolean",
114
+ "mutable": true,
115
+ "complexType": {
116
+ "original": "boolean",
117
+ "resolved": "boolean",
118
+ "references": {}
119
+ },
120
+ "required": false,
121
+ "optional": false,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "If 'true' will make the modal visible."
125
+ },
126
+ "attribute": "visible",
127
+ "reflect": true,
128
+ "defaultValue": "false"
129
+ },
130
+ "modalHeader": {
131
+ "type": "boolean",
132
+ "mutable": false,
133
+ "complexType": {
134
+ "original": "boolean",
135
+ "resolved": "boolean",
136
+ "references": {}
137
+ },
138
+ "required": false,
139
+ "optional": false,
140
+ "docs": {
141
+ "tags": [],
142
+ "text": "If 'true' will show the modal header."
143
+ },
144
+ "attribute": "modal-header",
145
+ "reflect": true,
146
+ "defaultValue": "false"
147
+ }
148
+ }; }
149
+ static get events() { return [{
150
+ "method": "ok",
151
+ "name": "ok",
152
+ "bubbles": true,
153
+ "cancelable": true,
154
+ "composed": true,
155
+ "docs": {
156
+ "tags": [],
157
+ "text": ""
158
+ },
159
+ "complexType": {
160
+ "original": "any",
161
+ "resolved": "any",
162
+ "references": {}
163
+ }
164
+ }, {
165
+ "method": "cancel",
166
+ "name": "cancel",
167
+ "bubbles": true,
168
+ "cancelable": true,
169
+ "composed": true,
170
+ "docs": {
171
+ "tags": [],
172
+ "text": ""
173
+ },
174
+ "complexType": {
175
+ "original": "any",
176
+ "resolved": "any",
177
+ "references": {}
178
+ }
179
+ }]; }
180
+ }
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Initial Variables
3
+ */
4
+ /**
5
+ * Functions
6
+ */
7
+ /**
8
+ * Delivered variables
9
+ */
10
+ .wrapper {
11
+ opacity: 0;
12
+ visibility: hidden;
13
+ position: fixed;
14
+ width: 100%;
15
+ height: 100%;
16
+ top: 0;
17
+ left: 0;
18
+ background: #fcfcfc;
19
+ -webkit-transition: opacity 0.5s, visibility 0s 0.5s;
20
+ transition: opacity 0.5s, visibility 0s 0.5s;
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ z-index: 1050;
25
+ }
26
+ .wrapper .modal {
27
+ font-family: Helvetica, sans-serif;
28
+ font-size: 14px;
29
+ background-color: #fff;
30
+ position: absolute;
31
+ top: 50%;
32
+ left: 50%;
33
+ transform: translate(-50%, -50%);
34
+ width: 90%;
35
+ border: 1px solid rgba(0, 0, 0, 0.2);
36
+ border-radius: 0.3rem;
37
+ }
38
+ @media (min-width: 576px) {
39
+ .wrapper .modal {
40
+ max-width: 500px;
41
+ }
42
+ }
43
+ .wrapper .modal .displayed {
44
+ display: flex;
45
+ }
46
+ .wrapper .modal .modal-body {
47
+ position: relative;
48
+ -ms-flex: 1 1 auto;
49
+ flex: 1 1 auto;
50
+ padding: 1rem;
51
+ }
52
+
53
+ .visible {
54
+ opacity: 1;
55
+ visibility: visible;
56
+ transform: scale(1);
57
+ transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
58
+ }
59
+
60
+ .hide {
61
+ display: none !important;
62
+ }
63
+
64
+ .show {
65
+ display: block !important;
66
+ }
67
+
68
+ .search-box {
69
+ display: flex;
70
+ }
71
+ .search-box input {
72
+ width: 100%;
73
+ padding: 10px;
74
+ padding-inline-start: 32px;
75
+ }
76
+ .search-box button {
77
+ background-color: transparent;
78
+ border: 0;
79
+ position: absolute;
80
+ padding: 12px;
81
+ left: 12px;
82
+ }
83
+
84
+ .results {
85
+ list-style: none;
86
+ padding: 0;
87
+ margin: 0;
88
+ max-height: 300px;
89
+ overflow-y: scroll;
90
+ }
91
+ .results .product-img {
92
+ width: 50px;
93
+ margin-inline-end: 10px;
94
+ }
95
+ .results a:first-child {
96
+ margin-top: 20px;
97
+ }
98
+ .results a {
99
+ display: flex;
100
+ border-bottom: 1px solid #ddd;
101
+ }
102
+ .results a h5 {
103
+ margin-top: 5px;
104
+ }
@@ -0,0 +1,113 @@
1
+ import { Component, h, Prop, Listen, State } from '@stencil/core';
2
+ export class SallaLogin {
3
+ constructor() {
4
+ this.fetchStatus = '';
5
+ this.searchIcon = 'Search_Icon.svg';
6
+ /**
7
+ * If 'true' will make the modal visible.
8
+ */
9
+ this.visible = false;
10
+ this.handleClose = () => {
11
+ this.visible = false;
12
+ };
13
+ }
14
+ handleClick(ev) {
15
+ if (!ev.path.some(x => x.className && x.className.includes('modal-body')) &&
16
+ ev.target.localName === 'salla-search-modal') {
17
+ this.visible = false;
18
+ }
19
+ }
20
+ render() {
21
+ return (h("div", { class: this.visible ? 'wrapper visible' : 'wrapper' },
22
+ h("div", { class: "modal" },
23
+ h("div", { class: 'modal-header' },
24
+ h("h5", { class: "title" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u064A \u0627\u0644\u0645\u0648\u0642\u0639"),
25
+ h("button", { type: "button", class: "close", "data-dismiss": "modal", "aria-label": "Close", onClick: this.handleClose },
26
+ h("span", { "aria-hidden": "true" }, "\u00D7"))),
27
+ h("div", { class: "modal-body" },
28
+ h("div", { id: "showLoginMethods" },
29
+ 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"),
30
+ 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" },
31
+ h("div", { class: "flex-shrink-0" },
32
+ h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" },
33
+ h("i", { class: "sicon-mail" }))),
34
+ h("div", { class: "flex-1 min-w-0" },
35
+ h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" },
36
+ h("div", { class: "flex-1" },
37
+ h("span", { class: "absolute inset-0", "aria-hidden": "true" }),
38
+ h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"),
39
+ h("h6", { class: "font-boldf" }, "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A")),
40
+ h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))),
41
+ 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" },
42
+ h("div", { class: "flex-shrink-0" },
43
+ h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" },
44
+ h("i", { class: "sicon-phone" }))),
45
+ h("div", { class: "flex-1 min-w-0" },
46
+ h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" },
47
+ h("div", { class: "flex-1" },
48
+ h("span", { class: "absolute inset-0", "aria-hidden": "true" }),
49
+ h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"),
50
+ h("h6", { class: "font-boldf" }, "\u0627\u0644\u0647\u0627\u062A\u0641")),
51
+ h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))))))));
52
+ }
53
+ static get is() { return "salla-login"; }
54
+ static get encapsulation() { return "shadow"; }
55
+ static get originalStyleUrls() { return {
56
+ "$": ["salla-login.scss"]
57
+ }; }
58
+ static get styleUrls() { return {
59
+ "$": ["salla-login.css"]
60
+ }; }
61
+ static get assetsDirs() { return ["assets"]; }
62
+ static get properties() { return {
63
+ "searchIcon": {
64
+ "type": "string",
65
+ "mutable": false,
66
+ "complexType": {
67
+ "original": "string",
68
+ "resolved": "string",
69
+ "references": {}
70
+ },
71
+ "required": false,
72
+ "optional": false,
73
+ "docs": {
74
+ "tags": [],
75
+ "text": ""
76
+ },
77
+ "attribute": "search-icon",
78
+ "reflect": false,
79
+ "defaultValue": "'Search_Icon.svg'"
80
+ },
81
+ "visible": {
82
+ "type": "boolean",
83
+ "mutable": true,
84
+ "complexType": {
85
+ "original": "boolean",
86
+ "resolved": "boolean",
87
+ "references": {}
88
+ },
89
+ "required": false,
90
+ "optional": false,
91
+ "docs": {
92
+ "tags": [],
93
+ "text": "If 'true' will make the modal visible."
94
+ },
95
+ "attribute": "visible",
96
+ "reflect": true,
97
+ "defaultValue": "false"
98
+ }
99
+ }; }
100
+ static get states() { return {
101
+ "searchTerm": {},
102
+ "results": {},
103
+ "fetchStatus": {},
104
+ "showResult": {}
105
+ }; }
106
+ static get listeners() { return [{
107
+ "name": "click",
108
+ "method": "handleClick",
109
+ "target": "window",
110
+ "capture": false,
111
+ "passive": false
112
+ }]; }
113
+ }
@@ -0,0 +1,126 @@
1
+ import { Component, h, Host, Prop, State } from '@stencil/core';
2
+ export class SearchModal {
3
+ constructor() {
4
+ this.fetchStatus = '';
5
+ this.showModal = false;
6
+ /**
7
+ * The text to overwrite search placeholder.
8
+ */
9
+ this.searchPlaceholder = 'Search here ...';
10
+ this.handleChange = event => {
11
+ this.searchTerm = event.target.value;
12
+ console.log('this.value', this.searchTerm);
13
+ this.fetchStatus = 'loading';
14
+ this.showResult = false;
15
+ this.results = [];
16
+ if (this.searchTerm.length > 2) {
17
+ window.salla.search.api
18
+ .search(this.searchTerm)
19
+ .then(response => response)
20
+ .then(response => {
21
+ console.log('response', response);
22
+ this.fetchStatus = 'idle';
23
+ this.results = response.results;
24
+ this.showResult = true;
25
+ if (this.results.length < 1) {
26
+ this.fetchStatus = 'error';
27
+ }
28
+ })
29
+ .catch(err => {
30
+ this.showResult = true;
31
+ this.fetchStatus = 'error';
32
+ console.log(err);
33
+ });
34
+ }
35
+ };
36
+ this.openSearch = () => {
37
+ console.log('openSearchModal');
38
+ this.searchTerm = '';
39
+ this.fetchStatus = '';
40
+ this.results = [];
41
+ this.showModal = true;
42
+ window.scrollTo(0, 0);
43
+ document.getElementsByTagName('html')[0].style.position = 'fixed';
44
+ document.getElementsByTagName('html')[0].style.overflowY = 'scroll';
45
+ //this.$nextTick(() => { this.$refs.searchInput.focus(); });
46
+ };
47
+ this.closeSearch = () => {
48
+ console.log('closeSearchModal');
49
+ this.searchTerm = '';
50
+ this.fetchStatus = '';
51
+ this.results = [];
52
+ document.getElementsByTagName('html')[0].style.position = 'static';
53
+ document.getElementsByTagName('html')[0].style.overflowY = 'auto';
54
+ this.showModal = false;
55
+ };
56
+ }
57
+ getProduct(item) {
58
+ var _a;
59
+ return (h("div", { key: item.id, class: "s-search-modal-results-item" },
60
+ h("div", { class: "s-search-modal-product" },
61
+ h("a", { target: "_blank", href: item.url, class: "s-search-modal-product-image-container" },
62
+ h("img", { class: "s-search-modal-product-image", src: item.thumb })),
63
+ h("div", { class: "s-search-modal-product-details" },
64
+ h("div", { class: "s-search-modal-product-title" },
65
+ h("h3", { class: "s-search-modal-product-title-h3" }, item.title)),
66
+ h("div", { class: "s-search-modal-product-price" },
67
+ h("h4", { class: "s-search-modal-product-price-h4" }, (_a = item.price) === null || _a === void 0 ? void 0 : _a.after))))));
68
+ }
69
+ render() {
70
+ return (h(Host, { class: "s-search-modal" },
71
+ h("button", { type: "button", onClick: this.openSearch, class: "s-search-modal-search-button-icon" },
72
+ h("i", { class: "sicon-search font-bold" })),
73
+ this.showModal && (h("div", { class: "s-search-modal-container", style: { backgroundColor: 'rgba(0,0,0,0.5)' } },
74
+ h("div", { class: "s-search-modal-wrapper", onClick: this.closeSearch },
75
+ h("div", { class: "s-search-modal-inner" },
76
+ h("div", { class: "s-search-modal-search-box-container" },
77
+ h("div", { class: !this.showResult ? 's-search-modal-search-box-inner' : 's-search-modal-search-box-inner-open' },
78
+ h("input", { onClick: e => {
79
+ e.stopPropagation();
80
+ }, class: "s-search-modal-input", type: "text", placeholder: this.searchPlaceholder, value: this.searchTerm, onInput: event => this.handleChange(event) }),
81
+ this.fetchStatus != 'loading' ? (h("button", { class: "s-search-modal-search-icon" },
82
+ h("i", { class: "sicon-search" }))) : (h("span", { class: "s-search-modal-spinner" },
83
+ h("span", { class: "s-search-modal-spinner-loader" }))))),
84
+ h("div", { class: "s-search-modal-search-results" },
85
+ this.fetchStatus === 'error' && (h("p", { class: "s-search-modal-no-results error p-4 text-sm text-gray-text" }, "\u0644\u0627 \u064A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C")),
86
+ this.results &&
87
+ this.results.map(item => {
88
+ return this.getProduct(item);
89
+ }))))))));
90
+ }
91
+ static get is() { return "salla-search-modal"; }
92
+ static get originalStyleUrls() { return {
93
+ "$": ["search-modal.scss"]
94
+ }; }
95
+ static get styleUrls() { return {
96
+ "$": ["search-modal.css"]
97
+ }; }
98
+ static get assetsDirs() { return ["assets"]; }
99
+ static get properties() { return {
100
+ "searchPlaceholder": {
101
+ "type": "string",
102
+ "mutable": false,
103
+ "complexType": {
104
+ "original": "string",
105
+ "resolved": "string",
106
+ "references": {}
107
+ },
108
+ "required": false,
109
+ "optional": false,
110
+ "docs": {
111
+ "tags": [],
112
+ "text": "The text to overwrite search placeholder."
113
+ },
114
+ "attribute": "search-placeholder",
115
+ "reflect": false,
116
+ "defaultValue": "'Search here ...'"
117
+ }
118
+ }; }
119
+ static get states() { return {
120
+ "searchTerm": {},
121
+ "results": {},
122
+ "fetchStatus": {},
123
+ "showResult": {},
124
+ "showModal": {}
125
+ }; }
126
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './colors';
2
+ export * from './ratio';
@@ -0,0 +1 @@
1
+ export {};