@searchcraft/javascript-sdk 0.1.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.
- package/LICENSE +201 -0
- package/dist/cjs/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/index-0c2339c7.js +1226 -0
- package/dist/cjs/index-0c2339c7.js.map +1 -0
- package/dist/cjs/index.cjs.js +12 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/sc-auto-search-form.cjs.entry.js +101 -0
- package/dist/cjs/sc-auto-search-form.cjs.entry.js.map +1 -0
- package/dist/cjs/sc-base-search-form_11.cjs.entry.js +471 -0
- package/dist/cjs/sc-base-search-form_11.cjs.entry.js.map +1 -0
- package/dist/cjs/sc-spinner-light-a3bfc8e6.js +20 -0
- package/dist/cjs/sc-spinner-light-a3bfc8e6.js.map +1 -0
- package/dist/cjs/sc-spinner-light.cjs.entry.js +12 -0
- package/dist/cjs/sc-spinner-light.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +27 -0
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -0
- package/dist/cjs/store-6c259dd0.js +251 -0
- package/dist/cjs/store-6c259dd0.js.map +1 -0
- package/dist/collection/assets/ButtonIcons.js +3 -0
- package/dist/collection/assets/ButtonIcons.js.map +1 -0
- package/dist/collection/assets/ClearInputIcon.js +6 -0
- package/dist/collection/assets/ClearInputIcon.js.map +1 -0
- package/dist/collection/assets/SearchIcons.js +6 -0
- package/dist/collection/assets/SearchIcons.js.map +1 -0
- package/dist/collection/collection-manifest.json +24 -0
- package/dist/collection/components/sc-auto-search-form/sc-auto-search-form.js +275 -0
- package/dist/collection/components/sc-auto-search-form/sc-auto-search-form.js.map +1 -0
- package/dist/collection/components/sc-auto-search-form/sc-auto-search-form.module.css +16 -0
- package/dist/collection/components/sc-base-search-form/sc-base-search-form.js +168 -0
- package/dist/collection/components/sc-base-search-form/sc-base-search-form.js.map +1 -0
- package/dist/collection/components/sc-base-search-form/sc-base-search-form.module.css +14 -0
- package/dist/collection/components/sc-base-search-result/sc-base-search-result.js +242 -0
- package/dist/collection/components/sc-base-search-result/sc-base-search-result.js.map +1 -0
- package/dist/collection/components/sc-base-search-result/sc-base-search-result.module.css +170 -0
- package/dist/collection/components/sc-base-search-results/sc-base-search-results.js +58 -0
- package/dist/collection/components/sc-base-search-results/sc-base-search-results.js.map +1 -0
- package/dist/collection/components/sc-base-search-results/sc-base-search-results.module.css +20 -0
- package/dist/collection/components/sc-button/sc-button.js +137 -0
- package/dist/collection/components/sc-button/sc-button.js.map +1 -0
- package/dist/collection/components/sc-button/sc-button.module.css +82 -0
- package/dist/collection/components/sc-clear-input-button/sc-clear-input-button.js +99 -0
- package/dist/collection/components/sc-clear-input-button/sc-clear-input-button.js.map +1 -0
- package/dist/collection/components/sc-clear-input-button/sc-clear-input-button.module.css +31 -0
- package/dist/collection/components/sc-error-message/sc-error-message.js +64 -0
- package/dist/collection/components/sc-error-message/sc-error-message.js.map +1 -0
- package/dist/collection/components/sc-error-message/sc-error-message.module.css +21 -0
- package/dist/collection/components/sc-input/sc-input.js +251 -0
- package/dist/collection/components/sc-input/sc-input.js.map +1 -0
- package/dist/collection/components/sc-input/sc-input.module.css +224 -0
- package/dist/collection/components/sc-input-caption/sc-input-caption.js +122 -0
- package/dist/collection/components/sc-input-caption/sc-input-caption.js.map +1 -0
- package/dist/collection/components/sc-input-caption/sc-input-caption.module.css +79 -0
- package/dist/collection/components/sc-input-icon/sc-input-icon.js +72 -0
- package/dist/collection/components/sc-input-icon/sc-input-icon.js.map +1 -0
- package/dist/collection/components/sc-input-icon/sc-input-icon.module.css +19 -0
- package/dist/collection/components/sc-input-label/sc-input-label.js +74 -0
- package/dist/collection/components/sc-input-label/sc-input-label.js.map +1 -0
- package/dist/collection/components/sc-input-label/sc-input-label.module.css +21 -0
- package/dist/collection/components/sc-spinner-dark/sc-spinner-dark.js +19 -0
- package/dist/collection/components/sc-spinner-dark/sc-spinner-dark.js.map +1 -0
- package/dist/collection/components/sc-spinner-dark/sc-spinner-dark.module.css +35 -0
- package/dist/collection/components/sc-spinner-light/sc-spinner-light.js +19 -0
- package/dist/collection/components/sc-spinner-light/sc-spinner-light.js.map +1 -0
- package/dist/collection/components/sc-spinner-light/sc-spinner-light.module.css +26 -0
- package/dist/collection/index.js +12 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/provider/store.js +68 -0
- package/dist/collection/provider/store.js.map +1 -0
- package/dist/collection/utils/utils.js +1 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/p-074239f9.js +34 -0
- package/dist/components/p-074239f9.js.map +1 -0
- package/dist/components/p-184d9504.js +61 -0
- package/dist/components/p-184d9504.js.map +1 -0
- package/dist/components/p-23bdbb1f.js +58 -0
- package/dist/components/p-23bdbb1f.js.map +1 -0
- package/dist/components/p-255a89f7.js +62 -0
- package/dist/components/p-255a89f7.js.map +1 -0
- package/dist/components/p-5410e357.js +108 -0
- package/dist/components/p-5410e357.js.map +1 -0
- package/dist/components/p-5b7b903a.js +71 -0
- package/dist/components/p-5b7b903a.js.map +1 -0
- package/dist/components/p-5cdc6210.js +82 -0
- package/dist/components/p-5cdc6210.js.map +1 -0
- package/dist/components/p-6f0eaec6.js +247 -0
- package/dist/components/p-6f0eaec6.js.map +1 -0
- package/dist/components/p-75be555b.js +54 -0
- package/dist/components/p-75be555b.js.map +1 -0
- package/dist/components/p-79564f07.js +41 -0
- package/dist/components/p-79564f07.js.map +1 -0
- package/dist/components/p-a912a224.js +1062 -0
- package/dist/components/p-a912a224.js.map +1 -0
- package/dist/components/p-b05f23e3.js +18 -0
- package/dist/components/p-b05f23e3.js.map +1 -0
- package/dist/components/p-c47cb37f.js +46 -0
- package/dist/components/p-c47cb37f.js.map +1 -0
- package/dist/components/p-c54fdecb.js +164 -0
- package/dist/components/p-c54fdecb.js.map +1 -0
- package/dist/components/p-dfb43eea.js +34 -0
- package/dist/components/p-dfb43eea.js.map +1 -0
- package/dist/components/sc-auto-search-form.d.ts +11 -0
- package/dist/components/sc-auto-search-form.js +152 -0
- package/dist/components/sc-auto-search-form.js.map +1 -0
- package/dist/components/sc-base-search-form.d.ts +11 -0
- package/dist/components/sc-base-search-form.js +135 -0
- package/dist/components/sc-base-search-form.js.map +1 -0
- package/dist/components/sc-base-search-result.d.ts +11 -0
- package/dist/components/sc-base-search-result.js +8 -0
- package/dist/components/sc-base-search-result.js.map +1 -0
- package/dist/components/sc-base-search-results.d.ts +11 -0
- package/dist/components/sc-base-search-results.js +83 -0
- package/dist/components/sc-base-search-results.js.map +1 -0
- package/dist/components/sc-button.d.ts +11 -0
- package/dist/components/sc-button.js +8 -0
- package/dist/components/sc-button.js.map +1 -0
- package/dist/components/sc-clear-input-button.d.ts +11 -0
- package/dist/components/sc-clear-input-button.js +8 -0
- package/dist/components/sc-clear-input-button.js.map +1 -0
- package/dist/components/sc-error-message.d.ts +11 -0
- package/dist/components/sc-error-message.js +8 -0
- package/dist/components/sc-error-message.js.map +1 -0
- package/dist/components/sc-input-caption.d.ts +11 -0
- package/dist/components/sc-input-caption.js +8 -0
- package/dist/components/sc-input-caption.js.map +1 -0
- package/dist/components/sc-input-icon.d.ts +11 -0
- package/dist/components/sc-input-icon.js +8 -0
- package/dist/components/sc-input-icon.js.map +1 -0
- package/dist/components/sc-input-label.d.ts +11 -0
- package/dist/components/sc-input-label.js +8 -0
- package/dist/components/sc-input-label.js.map +1 -0
- package/dist/components/sc-input.d.ts +11 -0
- package/dist/components/sc-input.js +8 -0
- package/dist/components/sc-input.js.map +1 -0
- package/dist/components/sc-spinner-dark.d.ts +11 -0
- package/dist/components/sc-spinner-dark.js +8 -0
- package/dist/components/sc-spinner-dark.js.map +1 -0
- package/dist/components/sc-spinner-light.d.ts +11 -0
- package/dist/components/sc-spinner-light.js +8 -0
- package/dist/components/sc-spinner-light.js.map +1 -0
- package/dist/esm/app-globals-0f993ce5.js +5 -0
- package/dist/esm/app-globals-0f993ce5.js.map +1 -0
- package/dist/esm/index-c97f8c28.js +1198 -0
- package/dist/esm/index-c97f8c28.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/sc-auto-search-form.entry.js +97 -0
- package/dist/esm/sc-auto-search-form.entry.js.map +1 -0
- package/dist/esm/sc-base-search-form_11.entry.js +457 -0
- package/dist/esm/sc-base-search-form_11.entry.js.map +1 -0
- package/dist/esm/sc-spinner-light-cdb79a33.js +18 -0
- package/dist/esm/sc-spinner-light-cdb79a33.js.map +1 -0
- package/dist/esm/sc-spinner-light.entry.js +4 -0
- package/dist/esm/sc-spinner-light.entry.js.map +1 -0
- package/dist/esm/searchcraft-javascript-sdk.js +22 -0
- package/dist/esm/searchcraft-javascript-sdk.js.map +1 -0
- package/dist/esm/store-2370857c.js +247 -0
- package/dist/esm/store-2370857c.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +1 -0
- package/dist/loader/index.cjs.js +1 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.es2017.js +1 -0
- package/dist/loader/index.js +2 -0
- package/dist/loader/package.json +11 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +2 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-6f0eaec6.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-6f0eaec6.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-8e9ba2cf.js +3 -0
- package/dist/searchcraft-javascript-sdk/p-8e9ba2cf.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-94c68cce.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-94c68cce.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-9545c59a.entry.js +7 -0
- package/dist/searchcraft-javascript-sdk/p-9545c59a.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-c632f66c.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-c632f66c.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-e1255160.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-f7dbb9a8.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-f7dbb9a8.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +2 -0
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -0
- package/dist/types/assets/ButtonIcons.d.ts +1 -0
- package/dist/types/assets/ClearInputIcon.d.ts +4 -0
- package/dist/types/assets/SearchIcons.d.ts +4 -0
- package/dist/types/components/sc-auto-search-form/sc-auto-search-form.d.ts +41 -0
- package/dist/types/components/sc-base-search-form/sc-base-search-form.d.ts +20 -0
- package/dist/types/components/sc-base-search-result/sc-base-search-result.d.ts +16 -0
- package/dist/types/components/sc-base-search-results/sc-base-search-results.d.ts +9 -0
- package/dist/types/components/sc-button/sc-button.d.ts +13 -0
- package/dist/types/components/sc-clear-input-button/sc-clear-input-button.d.ts +10 -0
- package/dist/types/components/sc-error-message/sc-error-message.d.ts +11 -0
- package/dist/types/components/sc-input/sc-input.d.ts +22 -0
- package/dist/types/components/sc-input-caption/sc-input-caption.d.ts +9 -0
- package/dist/types/components/sc-input-icon/sc-input-icon.d.ts +7 -0
- package/dist/types/components/sc-input-label/sc-input-label.d.ts +7 -0
- package/dist/types/components/sc-spinner-dark/sc-spinner-dark.d.ts +3 -0
- package/dist/types/components/sc-spinner-light/sc-spinner-light.d.ts +3 -0
- package/dist/types/components.d.ts +386 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/provider/store.d.ts +18 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/dist/types/utils/utils.d.ts +0 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +47 -0
- package/readme.md +11 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { ArrowRightIconLight, ArrowRightIconDark, } from "../../assets/ClearInputIcon";
|
|
3
|
+
export class ScBaseSearchResult {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.handleButtonClick = () => {
|
|
6
|
+
this.buttonCallbackFn();
|
|
7
|
+
};
|
|
8
|
+
this.handleContainerClick = () => {
|
|
9
|
+
if (this.interactiveResult) {
|
|
10
|
+
this.callbackFn();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
this.buttonCallbackFn = () => { };
|
|
14
|
+
this.buttonLabel = '';
|
|
15
|
+
this.callbackFn = () => { };
|
|
16
|
+
this.imageAltText = '';
|
|
17
|
+
this.imageSrc = '';
|
|
18
|
+
this.interactiveResult = false;
|
|
19
|
+
this.keyDownCallbackFn = () => { };
|
|
20
|
+
this.resultBodyContent = '';
|
|
21
|
+
this.resultHeading = '';
|
|
22
|
+
this.resultSubheading = '';
|
|
23
|
+
this.theme = 'light';
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
const isLightTheme = this.theme === 'light';
|
|
27
|
+
return (h("div", { key: 'ee89d0d997c1616d4534cae4ee9685f6ce040099', class: this.interactiveResult
|
|
28
|
+
? isLightTheme
|
|
29
|
+
? 'interactiveResultContainerLight'
|
|
30
|
+
: 'interactiveResultContainerDark'
|
|
31
|
+
: 'resultContainer', id: 'searchcraft-item', onClick: this.handleContainerClick, onKeyDown: this.keyDownCallbackFn, tabindex: '0' }, this.interactiveResult && (h("div", { key: 'fe1174e8a72f4b73a076c5be015e44a4b1ef8215', class: 'interactiveIconLarge' }, isLightTheme ? h(ArrowRightIconLight, null) : h(ArrowRightIconDark, null))), h("div", { key: 'c8c68d1beb4b57d9b6a7a860d754f2d8577a73fb', class: 'imageContainer' }, h("img", { key: 'e102470ecc13a71620004ed148a81d9af9984976', alt: this.imageAltText, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSrc })), h("div", { key: '07dbf514b64cb063c690ed42ec6ae04b1afbaf9a', class: 'contentContainer' }, h("h2", { key: 'fb6dfe3c58667cab4319f82e49ab90145904671c', class: isLightTheme ? 'headingLight' : 'headingDark' }, this.resultHeading, this.interactiveResult && (h("div", { key: '378b93a681888fc5709c627631284fd34b375b02', class: 'interactiveIconSmall' }, isLightTheme ? (h(ArrowRightIconLight, null)) : (h(ArrowRightIconDark, null))))), h("h3", { key: '9fc6e4d8d9a55489996492fbbb482eeabb69fde1', class: isLightTheme ? 'subheadingLight' : 'subheadingDark' }, this.resultSubheading), h("p", { key: '66810ac7427abe83a88237471cdc30c9cd2fa84b', class: isLightTheme ? 'bodyContentLight' : 'bodyContentDark' }, this.resultBodyContent), h("button", { key: '1df164311052868adde2dc41b8c769834622a10f', onClick: this.handleButtonClick, type: 'button' }, this.buttonLabel))));
|
|
32
|
+
}
|
|
33
|
+
static get is() { return "sc-base-search-result"; }
|
|
34
|
+
static get encapsulation() { return "shadow"; }
|
|
35
|
+
static get originalStyleUrls() {
|
|
36
|
+
return {
|
|
37
|
+
"$": ["sc-base-search-result.module.scss"]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
static get styleUrls() {
|
|
41
|
+
return {
|
|
42
|
+
"$": ["sc-base-search-result.module.css"]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
static get properties() {
|
|
46
|
+
return {
|
|
47
|
+
"buttonCallbackFn": {
|
|
48
|
+
"type": "unknown",
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"complexType": {
|
|
51
|
+
"original": "() => void",
|
|
52
|
+
"resolved": "() => void",
|
|
53
|
+
"references": {}
|
|
54
|
+
},
|
|
55
|
+
"required": false,
|
|
56
|
+
"optional": false,
|
|
57
|
+
"docs": {
|
|
58
|
+
"tags": [],
|
|
59
|
+
"text": ""
|
|
60
|
+
},
|
|
61
|
+
"defaultValue": "() => {}"
|
|
62
|
+
},
|
|
63
|
+
"buttonLabel": {
|
|
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": "button-label",
|
|
78
|
+
"reflect": false,
|
|
79
|
+
"defaultValue": "''"
|
|
80
|
+
},
|
|
81
|
+
"callbackFn": {
|
|
82
|
+
"type": "unknown",
|
|
83
|
+
"mutable": false,
|
|
84
|
+
"complexType": {
|
|
85
|
+
"original": "() => void",
|
|
86
|
+
"resolved": "() => void",
|
|
87
|
+
"references": {}
|
|
88
|
+
},
|
|
89
|
+
"required": false,
|
|
90
|
+
"optional": false,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": ""
|
|
94
|
+
},
|
|
95
|
+
"defaultValue": "() => {}"
|
|
96
|
+
},
|
|
97
|
+
"imageAltText": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"mutable": false,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "string",
|
|
102
|
+
"resolved": "string",
|
|
103
|
+
"references": {}
|
|
104
|
+
},
|
|
105
|
+
"required": false,
|
|
106
|
+
"optional": false,
|
|
107
|
+
"docs": {
|
|
108
|
+
"tags": [],
|
|
109
|
+
"text": ""
|
|
110
|
+
},
|
|
111
|
+
"attribute": "image-alt-text",
|
|
112
|
+
"reflect": false,
|
|
113
|
+
"defaultValue": "''"
|
|
114
|
+
},
|
|
115
|
+
"imageSrc": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "string",
|
|
120
|
+
"resolved": "string",
|
|
121
|
+
"references": {}
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"optional": false,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": ""
|
|
128
|
+
},
|
|
129
|
+
"attribute": "image-src",
|
|
130
|
+
"reflect": false,
|
|
131
|
+
"defaultValue": "''"
|
|
132
|
+
},
|
|
133
|
+
"interactiveResult": {
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "boolean",
|
|
138
|
+
"resolved": "boolean",
|
|
139
|
+
"references": {}
|
|
140
|
+
},
|
|
141
|
+
"required": false,
|
|
142
|
+
"optional": false,
|
|
143
|
+
"docs": {
|
|
144
|
+
"tags": [],
|
|
145
|
+
"text": ""
|
|
146
|
+
},
|
|
147
|
+
"attribute": "interactive-result",
|
|
148
|
+
"reflect": false,
|
|
149
|
+
"defaultValue": "false"
|
|
150
|
+
},
|
|
151
|
+
"keyDownCallbackFn": {
|
|
152
|
+
"type": "unknown",
|
|
153
|
+
"mutable": false,
|
|
154
|
+
"complexType": {
|
|
155
|
+
"original": "() => void",
|
|
156
|
+
"resolved": "() => void",
|
|
157
|
+
"references": {}
|
|
158
|
+
},
|
|
159
|
+
"required": false,
|
|
160
|
+
"optional": false,
|
|
161
|
+
"docs": {
|
|
162
|
+
"tags": [],
|
|
163
|
+
"text": ""
|
|
164
|
+
},
|
|
165
|
+
"defaultValue": "() => {}"
|
|
166
|
+
},
|
|
167
|
+
"resultBodyContent": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "string",
|
|
172
|
+
"resolved": "string",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": false,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": ""
|
|
180
|
+
},
|
|
181
|
+
"attribute": "result-body-content",
|
|
182
|
+
"reflect": false,
|
|
183
|
+
"defaultValue": "''"
|
|
184
|
+
},
|
|
185
|
+
"resultHeading": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"mutable": false,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "string",
|
|
190
|
+
"resolved": "string",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": ""
|
|
198
|
+
},
|
|
199
|
+
"attribute": "result-heading",
|
|
200
|
+
"reflect": false,
|
|
201
|
+
"defaultValue": "''"
|
|
202
|
+
},
|
|
203
|
+
"resultSubheading": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"mutable": false,
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "string",
|
|
208
|
+
"resolved": "string",
|
|
209
|
+
"references": {}
|
|
210
|
+
},
|
|
211
|
+
"required": false,
|
|
212
|
+
"optional": false,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": ""
|
|
216
|
+
},
|
|
217
|
+
"attribute": "result-subheading",
|
|
218
|
+
"reflect": false,
|
|
219
|
+
"defaultValue": "''"
|
|
220
|
+
},
|
|
221
|
+
"theme": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "'light' | 'dark'",
|
|
226
|
+
"resolved": "\"dark\" | \"light\"",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": false,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": ""
|
|
234
|
+
},
|
|
235
|
+
"attribute": "theme",
|
|
236
|
+
"reflect": false,
|
|
237
|
+
"defaultValue": "'light'"
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=sc-base-search-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sc-base-search-result.js","sourceRoot":"","sources":["../../../src/components/sc-base-search-result/sc-base-search-result.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAOhC,MAAM,OAAO,kBAAkB;;QAarB,sBAAiB,GAAG,GAAG,EAAE;YAC/B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC,CAAC;QAEM,yBAAoB,GAAG,GAAG,EAAE;YAClC,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBAC3B,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,CAAC;QACH,CAAC,CAAC;gCApBqC,GAAG,EAAE,GAAE,CAAC;2BACzB,EAAE;0BACS,GAAG,EAAE,GAAE,CAAC;4BAClB,EAAE;wBACN,EAAE;iCACO,KAAK;iCACO,GAAG,EAAE,GAAE,CAAC;iCACpB,EAAE;6BACN,EAAE;gCACC,EAAE;qBACK,OAAO;;IAYzC,MAAM;QACJ,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC;QAE5C,OAAO,CACL,4DACE,KAAK,EACH,IAAI,CAAC,iBAAiB;gBACpB,CAAC,CAAC,YAAY;oBACZ,CAAC,CAAC,iCAAiC;oBACnC,CAAC,CAAC,gCAAgC;gBACpC,CAAC,CAAC,iBAAiB,EAEvB,EAAE,EAAC,kBAAkB,EACrB,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAClC,SAAS,EAAE,IAAI,CAAC,iBAAiB,EACjC,QAAQ,EAAC,GAAG;YAEX,IAAI,CAAC,iBAAiB,IAAI,CACzB,4DAAK,KAAK,EAAC,sBAAsB,IAC9B,YAAY,CAAC,CAAC,CAAC,EAAC,mBAAmB,OAAG,CAAC,CAAC,CAAC,EAAC,kBAAkB,OAAG,CAC5D,CACP;YACD,4DAAK,KAAK,EAAC,gBAAgB;gBACzB,4DACE,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAChD,GAAG,EAAE,IAAI,CAAC,QAAQ,GAClB,CACE;YACN,4DAAK,KAAK,EAAC,kBAAkB;gBAC3B,2DAAI,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa;oBACrD,IAAI,CAAC,aAAa;oBAClB,IAAI,CAAC,iBAAiB,IAAI,CACzB,4DAAK,KAAK,EAAC,sBAAsB,IAC9B,YAAY,CAAC,CAAC,CAAC,CACd,EAAC,mBAAmB,OAAG,CACxB,CAAC,CAAC,CAAC,CACF,EAAC,kBAAkB,OAAG,CACvB,CACG,CACP,CACE;gBACL,2DAAI,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,IAC3D,IAAI,CAAC,gBAAgB,CACnB;gBACL,0DAAG,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,IAC5D,IAAI,CAAC,iBAAiB,CACrB;gBACJ,+DAAQ,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,EAAC,QAAQ,IACnD,IAAI,CAAC,WAAW,CACV,CACL,CACF,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from '@stencil/core';\n\nimport {\n ArrowRightIconLight,\n ArrowRightIconDark,\n} from '@assets/ClearInputIcon';\n\n@Component({\n tag: 'sc-base-search-result',\n styleUrl: 'sc-base-search-result.module.scss',\n shadow: true,\n})\nexport class ScBaseSearchResult {\n @Prop() buttonCallbackFn: () => void = () => {};\n @Prop() buttonLabel = '';\n @Prop() callbackFn: () => void = () => {};\n @Prop() imageAltText = '';\n @Prop() imageSrc = '';\n @Prop() interactiveResult = false;\n @Prop() keyDownCallbackFn: () => void = () => {};\n @Prop() resultBodyContent = '';\n @Prop() resultHeading = '';\n @Prop() resultSubheading = '';\n @Prop() theme: 'light' | 'dark' = 'light'; // Simulating theme context.\n\n private handleButtonClick = () => {\n this.buttonCallbackFn();\n };\n\n private handleContainerClick = () => {\n if (this.interactiveResult) {\n this.callbackFn();\n }\n };\n\n render() {\n const isLightTheme = this.theme === 'light';\n\n return (\n <div\n class={\n this.interactiveResult\n ? isLightTheme\n ? 'interactiveResultContainerLight'\n : 'interactiveResultContainerDark'\n : 'resultContainer'\n }\n id='searchcraft-item'\n onClick={this.handleContainerClick}\n onKeyDown={this.keyDownCallbackFn}\n tabindex='0'\n >\n {this.interactiveResult && (\n <div class='interactiveIconLarge'>\n {isLightTheme ? <ArrowRightIconLight /> : <ArrowRightIconDark />}\n </div>\n )}\n <div class='imageContainer'>\n <img\n alt={this.imageAltText}\n class={isLightTheme ? 'imageLight' : 'imageDark'}\n src={this.imageSrc}\n />\n </div>\n <div class='contentContainer'>\n <h2 class={isLightTheme ? 'headingLight' : 'headingDark'}>\n {this.resultHeading}\n {this.interactiveResult && (\n <div class='interactiveIconSmall'>\n {isLightTheme ? (\n <ArrowRightIconLight />\n ) : (\n <ArrowRightIconDark />\n )}\n </div>\n )}\n </h2>\n <h3 class={isLightTheme ? 'subheadingLight' : 'subheadingDark'}>\n {this.resultSubheading}\n </h3>\n <p class={isLightTheme ? 'bodyContentLight' : 'bodyContentDark'}>\n {this.resultBodyContent}\n </p>\n <button onClick={this.handleButtonClick} type='button'>\n {this.buttonLabel}\n </button>\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--font-stack: Helvetica, Arial, sans-serif;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.interactiveResultContainerLight {
|
|
6
|
+
background-color: #FAFAFA;
|
|
7
|
+
align-items: flex-start;
|
|
8
|
+
border-radius: 16px;
|
|
9
|
+
display: flex;
|
|
10
|
+
position: relative;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 16px;
|
|
13
|
+
padding: 8px;
|
|
14
|
+
}
|
|
15
|
+
@media (min-width: 600px) {
|
|
16
|
+
.interactiveResultContainerLight {
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.interactiveResultContainerDark {
|
|
22
|
+
background-color: #2E2E2E;
|
|
23
|
+
align-items: flex-start;
|
|
24
|
+
border-radius: 16px;
|
|
25
|
+
display: flex;
|
|
26
|
+
position: relative;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: 16px;
|
|
29
|
+
padding: 8px;
|
|
30
|
+
}
|
|
31
|
+
@media (min-width: 600px) {
|
|
32
|
+
.interactiveResultContainerDark {
|
|
33
|
+
flex-direction: row;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.resultContainer {
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: 16px;
|
|
42
|
+
}
|
|
43
|
+
@media (min-width: 600px) {
|
|
44
|
+
.resultContainer {
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.interactiveIconLarge {
|
|
50
|
+
display: inline-block;
|
|
51
|
+
position: absolute;
|
|
52
|
+
right: 5px;
|
|
53
|
+
top: 8px;
|
|
54
|
+
}
|
|
55
|
+
@media (max-width: 600px) {
|
|
56
|
+
.interactiveIconLarge {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.interactiveIconSmall {
|
|
62
|
+
position: absolute;
|
|
63
|
+
right: 5px;
|
|
64
|
+
top: -2px;
|
|
65
|
+
display: inline-block;
|
|
66
|
+
}
|
|
67
|
+
@media (min-width: 600px) {
|
|
68
|
+
.interactiveIconSmall {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.imageContainer {
|
|
74
|
+
max-height: 540px;
|
|
75
|
+
max-width: 100%;
|
|
76
|
+
}
|
|
77
|
+
@media (min-width: 600px) {
|
|
78
|
+
.imageContainer {
|
|
79
|
+
max-height: 100%;
|
|
80
|
+
max-width: 50%;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.contentContainer {
|
|
85
|
+
max-height: 100%;
|
|
86
|
+
max-width: 100%;
|
|
87
|
+
}
|
|
88
|
+
@media (min-width: 600px) {
|
|
89
|
+
.contentContainer {
|
|
90
|
+
max-width: 50%;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.imageLight {
|
|
95
|
+
aspect-ratio: 2/1;
|
|
96
|
+
border-radius: 8px;
|
|
97
|
+
max-height: 100%;
|
|
98
|
+
max-width: 100%;
|
|
99
|
+
border: 1px solid #D9D9D9;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.imageDark {
|
|
103
|
+
aspect-ratio: 2/1;
|
|
104
|
+
border-radius: 8px;
|
|
105
|
+
max-height: 100%;
|
|
106
|
+
max-width: 100%;
|
|
107
|
+
border: 1px solid #333;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.headingLight {
|
|
111
|
+
font-family: var(--font-stack);
|
|
112
|
+
font-size: 16px;
|
|
113
|
+
font-weight: 700;
|
|
114
|
+
line-height: 20px;
|
|
115
|
+
margin-bottom: 4px;
|
|
116
|
+
margin-top: 0px;
|
|
117
|
+
position: relative;
|
|
118
|
+
color: #292929;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.headingDark {
|
|
122
|
+
font-family: var(--font-stack);
|
|
123
|
+
font-size: 16px;
|
|
124
|
+
font-weight: 700;
|
|
125
|
+
line-height: 20px;
|
|
126
|
+
margin-bottom: 4px;
|
|
127
|
+
margin-top: 0px;
|
|
128
|
+
position: relative;
|
|
129
|
+
color: #FFF;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.subheadingLight {
|
|
133
|
+
font-family: var(--font-stack);
|
|
134
|
+
font-size: 12px;
|
|
135
|
+
font-weight: 400;
|
|
136
|
+
line-height: 16px;
|
|
137
|
+
margin-bottom: 4px;
|
|
138
|
+
margin-top: 0px;
|
|
139
|
+
color: #737373;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.subheadingDark {
|
|
143
|
+
font-family: var(--font-stack);
|
|
144
|
+
font-size: 12px;
|
|
145
|
+
font-weight: 400;
|
|
146
|
+
line-height: 16px;
|
|
147
|
+
margin-bottom: 4px;
|
|
148
|
+
margin-top: 0px;
|
|
149
|
+
color: #BFBFBF;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.bodyContentLight {
|
|
153
|
+
font-family: var(--font-stack);
|
|
154
|
+
font-size: 16px;
|
|
155
|
+
font-weight: 400;
|
|
156
|
+
line-height: 20px;
|
|
157
|
+
margin-bottom: 4px;
|
|
158
|
+
margin-top: 0px;
|
|
159
|
+
color: #404040;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.bodyContentDark {
|
|
163
|
+
font-family: var(--font-stack);
|
|
164
|
+
font-size: 16px;
|
|
165
|
+
font-weight: 400;
|
|
166
|
+
line-height: 20px;
|
|
167
|
+
margin-bottom: 4px;
|
|
168
|
+
margin-top: 0px;
|
|
169
|
+
color: #E6E6E6;
|
|
170
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { useSearchcraftStore } from "../../provider/store";
|
|
3
|
+
export class ScBaseSearchResults {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.query = '';
|
|
6
|
+
this.searchResults = null;
|
|
7
|
+
}
|
|
8
|
+
componentDidLoad() {
|
|
9
|
+
// Subscribe to state changes
|
|
10
|
+
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
11
|
+
console.log('Store updated:', state);
|
|
12
|
+
this.searchResults = Object.assign({}, state.searchResults);
|
|
13
|
+
this.query = state.query;
|
|
14
|
+
});
|
|
15
|
+
// Fetch initial state
|
|
16
|
+
const { searchResults, query } = useSearchcraftStore.getState();
|
|
17
|
+
console.log('Initial state:', searchResults, query);
|
|
18
|
+
this.searchResults = searchResults;
|
|
19
|
+
this.query = query;
|
|
20
|
+
}
|
|
21
|
+
disconnectedCallback() {
|
|
22
|
+
if (this.unsubscribe) {
|
|
23
|
+
this.unsubscribe();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
28
|
+
if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
29
|
+
console.warn('No search results data available');
|
|
30
|
+
return h("div", null, "No results to display.");
|
|
31
|
+
}
|
|
32
|
+
return (h("div", { class: 'resultsContainer' }, (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 :
|
|
33
|
+
_d.map((document, index) => {
|
|
34
|
+
const { doc: result } = document;
|
|
35
|
+
return (h("sc-base-search-result", { key: `${result === null || result === void 0 ? void 0 : result.id}-${index}`, "button-label": 'View More', "callback-fn": () => console.log('interactive element'), "button-callback-fn": () => console.log('button callback'), "interactive-result": true, "image-src": result === null || result === void 0 ? void 0 : result.poster, "result-body-content": result === null || result === void 0 ? void 0 : result.overview, "result-heading": result === null || result === void 0 ? void 0 : result.title, "result-subheading": result === null || result === void 0 ? void 0 : result.release_date }));
|
|
36
|
+
}), this.query.length > 0 &&
|
|
37
|
+
((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0 && (h("sc-error-message", { "error-message": `No search results found for "${this.query}" query` }))));
|
|
38
|
+
}
|
|
39
|
+
static get is() { return "sc-base-search-results"; }
|
|
40
|
+
static get encapsulation() { return "shadow"; }
|
|
41
|
+
static get originalStyleUrls() {
|
|
42
|
+
return {
|
|
43
|
+
"$": ["sc-base-search-results.module.scss"]
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
static get styleUrls() {
|
|
47
|
+
return {
|
|
48
|
+
"$": ["sc-base-search-results.module.css"]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
static get states() {
|
|
52
|
+
return {
|
|
53
|
+
"query": {},
|
|
54
|
+
"searchResults": {}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=sc-base-search-results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sc-base-search-results.js","sourceRoot":"","sources":["../../../src/components/sc-base-search-results/sc-base-search-results.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAOtD,MAAM,OAAO,mBAAmB;;qBACb,EAAE;6BAC2B,IAAI;;IAGlD,gBAAgB;QACd,6BAA6B;QAC7B,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACzD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;YACrC,IAAI,CAAC,aAAa,qBAAQ,KAAK,CAAC,aAAa,CAAE,CAAC;YAChD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,sBAAsB;QACtB,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,oBAAoB;QAClB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;IAED,MAAM;;QACJ,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,CAAA,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;YACjD,OAAO,wCAAiC,CAAC;QAC3C,CAAC;QACD,OAAO,CACL,WAAK,KAAK,EAAC,kBAAkB,IAC1B,MAAA,MAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI;eAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;gBACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;gBACjC,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,IAAI,KAAK,EAAE,kBAChB,WAAW,iBACX,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,wBACjC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,wBACpC,IAAI,eACb,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,yBACJ,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,oBACrB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,uBACV,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,GACvC,CACH,CAAC;YACJ,CAAC,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;gBACpB,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI,0CAAE,MAAM,MAAK,CAAC,IAAI,CAC9C,yCACiB,gCAAgC,IAAI,CAAC,KAAK,SAAS,GAClE,CACH,CACC,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, State } from '@stencil/core';\nimport type { SearchResult } from '@searchcraft/core';\n\nimport { useSearchcraftStore } from '@provider/store';\n\n@Component({\n tag: 'sc-base-search-results',\n styleUrl: 'sc-base-search-results.module.scss',\n shadow: true,\n})\nexport class ScBaseSearchResults {\n @State() query = '';\n @State() searchResults: SearchResult | null = null;\n private unsubscribe: () => void;\n\n componentDidLoad() {\n // Subscribe to state changes\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n console.log('Store updated:', state);\n this.searchResults = { ...state.searchResults };\n this.query = state.query;\n });\n\n // Fetch initial state\n const { searchResults, query } = useSearchcraftStore.getState();\n console.log('Initial state:', searchResults, query);\n this.searchResults = searchResults;\n this.query = query;\n }\n\n disconnectedCallback() {\n if (this.unsubscribe) {\n this.unsubscribe();\n }\n }\n\n render() {\n if (!this.searchResults?.data) {\n console.warn('No search results data available');\n return <div>No results to display.</div>;\n }\n return (\n <div class='resultsContainer'>\n {this.searchResults?.data?.hits?.map((document, index) => {\n const { doc: result } = document;\n return (\n <sc-base-search-result\n key={`${result?.id}-${index}`}\n button-label='View More'\n callback-fn={() => console.log('interactive element')}\n button-callback-fn={() => console.log('button callback')}\n interactive-result={true}\n image-src={result?.poster}\n result-body-content={result?.overview}\n result-heading={result?.title}\n result-subheading={result?.release_date}\n />\n );\n })}\n {this.query.length > 0 &&\n this.searchResults?.data?.hits?.length === 0 && (\n <sc-error-message\n error-message={`No search results found for \"${this.query}\" query`}\n />\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--font-stack: Helvetica, Arial, sans-serif;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.resultsContainer {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
margin: 100px 20px;
|
|
10
|
+
}
|
|
11
|
+
.resultsContainer > p {
|
|
12
|
+
align-self: center;
|
|
13
|
+
}
|
|
14
|
+
.resultsContainer > div {
|
|
15
|
+
margin-bottom: 20px;
|
|
16
|
+
}
|
|
17
|
+
.resultsContainer > div img {
|
|
18
|
+
height: 300px;
|
|
19
|
+
width: 200px;
|
|
20
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { h, Fragment, } from "@stencil/core";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
export class ScButton {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.handleClick = () => {
|
|
6
|
+
this.buttonClick.emit(); // Emit the event instead of calling a function
|
|
7
|
+
};
|
|
8
|
+
this.iconElement = undefined;
|
|
9
|
+
this.iconOnly = false;
|
|
10
|
+
this.iconPosition = 'left';
|
|
11
|
+
this.label = 'Search';
|
|
12
|
+
this.isRequesting = false;
|
|
13
|
+
this.theme = 'light';
|
|
14
|
+
}
|
|
15
|
+
getButtonStyle() {
|
|
16
|
+
return this.theme === 'light' ? 'buttonLight' : 'buttonDark';
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
const buttonStyle = this.getButtonStyle();
|
|
20
|
+
return (h(Fragment, { key: '1786fa90c9eff082b58b6b45dda5d64cc1da9c8a' }, this.iconOnly ? (h("button", { class: classNames(buttonStyle, 'searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.isRequesting ? h("sc-spinner-dark", null) : this.iconElement)) : (h("button", { class: classNames(buttonStyle, 'searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.iconPosition === 'left' && this.isRequesting ? (h("div", { class: 'spinner-margin-right' }, h("sc-spinner-dark", null))) : (this.iconElement), h("span", { class: classNames(this.isRequesting && 'button-label', 'searchcraft-button-label') }, this.label)))));
|
|
21
|
+
}
|
|
22
|
+
static get is() { return "sc-button"; }
|
|
23
|
+
static get encapsulation() { return "shadow"; }
|
|
24
|
+
static get originalStyleUrls() {
|
|
25
|
+
return {
|
|
26
|
+
"$": ["sc-button.module.scss"]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
static get styleUrls() {
|
|
30
|
+
return {
|
|
31
|
+
"$": ["sc-button.module.css"]
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static get properties() {
|
|
35
|
+
return {
|
|
36
|
+
"iconElement": {
|
|
37
|
+
"type": "unknown",
|
|
38
|
+
"mutable": false,
|
|
39
|
+
"complexType": {
|
|
40
|
+
"original": "Element",
|
|
41
|
+
"resolved": "Element",
|
|
42
|
+
"references": {
|
|
43
|
+
"Element": {
|
|
44
|
+
"location": "global",
|
|
45
|
+
"id": "global::Element"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": false,
|
|
50
|
+
"optional": true,
|
|
51
|
+
"docs": {
|
|
52
|
+
"tags": [],
|
|
53
|
+
"text": ""
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"iconOnly": {
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"mutable": false,
|
|
59
|
+
"complexType": {
|
|
60
|
+
"original": "boolean",
|
|
61
|
+
"resolved": "boolean",
|
|
62
|
+
"references": {}
|
|
63
|
+
},
|
|
64
|
+
"required": false,
|
|
65
|
+
"optional": false,
|
|
66
|
+
"docs": {
|
|
67
|
+
"tags": [],
|
|
68
|
+
"text": ""
|
|
69
|
+
},
|
|
70
|
+
"attribute": "icon-only",
|
|
71
|
+
"reflect": false,
|
|
72
|
+
"defaultValue": "false"
|
|
73
|
+
},
|
|
74
|
+
"iconPosition": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"mutable": false,
|
|
77
|
+
"complexType": {
|
|
78
|
+
"original": "string",
|
|
79
|
+
"resolved": "string",
|
|
80
|
+
"references": {}
|
|
81
|
+
},
|
|
82
|
+
"required": false,
|
|
83
|
+
"optional": false,
|
|
84
|
+
"docs": {
|
|
85
|
+
"tags": [],
|
|
86
|
+
"text": ""
|
|
87
|
+
},
|
|
88
|
+
"attribute": "icon-position",
|
|
89
|
+
"reflect": false,
|
|
90
|
+
"defaultValue": "'left'"
|
|
91
|
+
},
|
|
92
|
+
"label": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"mutable": false,
|
|
95
|
+
"complexType": {
|
|
96
|
+
"original": "string",
|
|
97
|
+
"resolved": "string",
|
|
98
|
+
"references": {}
|
|
99
|
+
},
|
|
100
|
+
"required": false,
|
|
101
|
+
"optional": false,
|
|
102
|
+
"docs": {
|
|
103
|
+
"tags": [],
|
|
104
|
+
"text": ""
|
|
105
|
+
},
|
|
106
|
+
"attribute": "label",
|
|
107
|
+
"reflect": false,
|
|
108
|
+
"defaultValue": "'Search'"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
static get states() {
|
|
113
|
+
return {
|
|
114
|
+
"isRequesting": {},
|
|
115
|
+
"theme": {}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
static get events() {
|
|
119
|
+
return [{
|
|
120
|
+
"method": "buttonClick",
|
|
121
|
+
"name": "buttonClick",
|
|
122
|
+
"bubbles": true,
|
|
123
|
+
"cancelable": true,
|
|
124
|
+
"composed": true,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": ""
|
|
128
|
+
},
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "void",
|
|
131
|
+
"resolved": "void",
|
|
132
|
+
"references": {}
|
|
133
|
+
}
|
|
134
|
+
}];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=sc-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sc-button.js","sourceRoot":"","sources":["../../../src/components/sc-button/sc-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EAEL,IAAI,EACJ,CAAC,EACD,KAAK,EACL,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,MAAM,OAAO,QAAQ;;QAeX,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,+CAA+C;QAC1E,CAAC,CAAC;;wBAfiB,KAAK;4BACD,MAAM;qBACb,QAAQ;4BAIA,KAAK;qBACZ,OAAO;;IAEhB,cAAc;QACpB,OAAO,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC;IAC/D,CAAC;IAMD,MAAM;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAE1C,OAAO,CACL,EAAC,QAAQ,uDACN,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,cACE,KAAK,EAAE,UAAU,CAAC,WAAW,EAAE,oBAAoB,CAAC,EACpD,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,0BAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CACpD,CACV,CAAC,CAAC,CAAC,CACF,cACE,KAAK,EAAE,UAAU,CAAC,WAAW,EAAE,oBAAoB,CAAC,EACpD,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ;YAEZ,IAAI,CAAC,YAAY,KAAK,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CACnD,WAAK,KAAK,EAAC,sBAAsB;gBAC/B,0BAAmB,CACf,CACP,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,WAAW,CACjB;YACD,YACE,KAAK,EAAE,UAAU,CACf,IAAI,CAAC,YAAY,IAAI,cAAc,EACnC,0BAA0B,CAC3B,IAEA,IAAI,CAAC,KAAK,CACN,CACA,CACV,CACQ,CACZ,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Event,\n type EventEmitter,\n Prop,\n h,\n State,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'sc-button',\n styleUrl: 'sc-button.module.scss',\n shadow: true,\n})\nexport class ScButton {\n @Prop() iconElement?: Element;\n @Prop() iconOnly = false;\n @Prop() iconPosition = 'left';\n @Prop() label = 'Search';\n\n @Event() buttonClick!: EventEmitter<void>;\n\n @State() isRequesting = false;\n @State() theme = 'light';\n\n private getButtonStyle() {\n return this.theme === 'light' ? 'buttonLight' : 'buttonDark';\n }\n\n private handleClick = () => {\n this.buttonClick.emit(); // Emit the event instead of calling a function\n };\n\n render() {\n const buttonStyle = this.getButtonStyle();\n\n return (\n <Fragment>\n {this.iconOnly ? (\n <button\n class={classNames(buttonStyle, 'searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.isRequesting ? <sc-spinner-dark /> : this.iconElement}\n </button>\n ) : (\n <button\n class={classNames(buttonStyle, 'searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.iconPosition === 'left' && this.isRequesting ? (\n <div class='spinner-margin-right'>\n <sc-spinner-dark />\n </div>\n ) : (\n this.iconElement\n )}\n <span\n class={classNames(\n this.isRequesting && 'button-label',\n 'searchcraft-button-label',\n )}\n >\n {this.label}\n </span>\n </button>\n )}\n </Fragment>\n );\n }\n}\n"]}
|