@searchcraft/javascript-sdk 0.1.7 → 0.1.9

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 (140) hide show
  1. package/dist/cjs/{index-7b49313c.js → index-d0e71432.js} +10 -4
  2. package/dist/cjs/index-d0e71432.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/{searchcraft-auto-search-form_13.cjs.entry.js → searchcraft-auto-search-form_16.cjs.entry.js} +219 -16
  6. package/dist/cjs/searchcraft-auto-search-form_16.cjs.entry.js.map +1 -0
  7. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +3 -3
  8. package/dist/cjs/searchcraft-button-icon.cjs.entry.js +1 -1
  9. package/dist/cjs/searchcraft-button.cjs.entry.js +1 -1
  10. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +2 -2
  11. package/dist/cjs/{store-3d577aac.js → store-3f6eab7d.js} +110 -42
  12. package/dist/cjs/store-3f6eab7d.js.map +1 -0
  13. package/dist/collection/collection-manifest.json +4 -1
  14. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +7 -4
  15. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -1
  16. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +78 -7
  17. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
  18. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +4 -0
  19. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +131 -0
  20. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -0
  21. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +35 -0
  22. package/dist/collection/components/searchcraft-input/searchcraft-input.js +21 -2
  23. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -1
  24. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +97 -0
  25. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -0
  26. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +75 -0
  27. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +1 -1
  28. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +1 -1
  29. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +79 -0
  30. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -0
  31. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +38 -0
  32. package/dist/collection/provider/store.js +35 -2
  33. package/dist/collection/provider/store.js.map +1 -1
  34. package/dist/components/index.js +2 -2
  35. package/dist/components/{p-a3ea7edc.js → p-05cd002d.js} +2 -2
  36. package/dist/components/{p-a3ea7edc.js.map → p-05cd002d.js.map} +1 -1
  37. package/dist/components/{p-85d96d9b.js → p-25bd714c.js} +2 -2
  38. package/dist/components/{p-85d96d9b.js.map → p-25bd714c.js.map} +1 -1
  39. package/dist/components/{p-62f37242.js → p-37df2122.js} +16 -11
  40. package/dist/components/p-37df2122.js.map +1 -0
  41. package/dist/components/{p-f3af2b04.js → p-3cbac2bb.js} +2 -2
  42. package/dist/components/{p-f3af2b04.js.map → p-3cbac2bb.js.map} +1 -1
  43. package/dist/components/{p-07fba086.js → p-403f6115.js} +5 -5
  44. package/dist/components/{p-07fba086.js.map → p-403f6115.js.map} +1 -1
  45. package/dist/components/{p-04bad430.js → p-50ca3fe4.js} +3 -3
  46. package/dist/components/{p-04bad430.js.map → p-50ca3fe4.js.map} +1 -1
  47. package/dist/components/{p-3ea9ba3a.js → p-574e8e3c.js} +3 -3
  48. package/dist/components/{p-3ea9ba3a.js.map → p-574e8e3c.js.map} +1 -1
  49. package/dist/components/{p-9c617862.js → p-5aa6335f.js} +110 -42
  50. package/dist/components/p-5aa6335f.js.map +1 -0
  51. package/dist/components/{p-d33fdd81.js → p-71dff048.js} +2 -2
  52. package/dist/components/{p-d33fdd81.js.map → p-71dff048.js.map} +1 -1
  53. package/dist/components/{p-d73bc01d.js → p-9bb9d6f0.js} +2 -2
  54. package/dist/components/{p-d73bc01d.js.map → p-9bb9d6f0.js.map} +1 -1
  55. package/dist/components/{p-c14731ca.js → p-c9629cc3.js} +2 -2
  56. package/dist/components/{p-c14731ca.js.map → p-c9629cc3.js.map} +1 -1
  57. package/dist/components/{p-af65953e.js → p-c9cd5533.js} +6 -2
  58. package/dist/components/p-c9cd5533.js.map +1 -0
  59. package/dist/components/{p-781a9a8c.js → p-e0e0fc94.js} +3 -3
  60. package/dist/components/{p-781a9a8c.js.map → p-e0e0fc94.js.map} +1 -1
  61. package/dist/components/{p-6b1d0cba.js → p-f2e41d24.js} +3 -3
  62. package/dist/components/{p-6b1d0cba.js.map → p-f2e41d24.js.map} +1 -1
  63. package/dist/components/searchcraft-auto-search-form.js +20 -17
  64. package/dist/components/searchcraft-auto-search-form.js.map +1 -1
  65. package/dist/components/searchcraft-base-search-form.js +14 -14
  66. package/dist/components/searchcraft-base-search-result.js +1 -1
  67. package/dist/components/searchcraft-base-search-results.js +45 -8
  68. package/dist/components/searchcraft-base-search-results.js.map +1 -1
  69. package/dist/components/searchcraft-button-icon.js +1 -1
  70. package/dist/components/searchcraft-button.js +1 -1
  71. package/dist/components/searchcraft-clear-icon-set.js +1 -1
  72. package/dist/components/searchcraft-clear-input-button.js +1 -1
  73. package/dist/components/searchcraft-error-message.js +1 -1
  74. package/dist/components/searchcraft-filters-list.d.ts +11 -0
  75. package/dist/components/searchcraft-filters-list.js +103 -0
  76. package/dist/components/searchcraft-filters-list.js.map +1 -0
  77. package/dist/components/searchcraft-input-caption.js +1 -1
  78. package/dist/components/searchcraft-input-icon.js +1 -1
  79. package/dist/components/searchcraft-input-label.js +1 -1
  80. package/dist/components/searchcraft-input.js +1 -1
  81. package/dist/components/searchcraft-search-icon-set.js +1 -1
  82. package/dist/components/searchcraft-slider.d.ts +11 -0
  83. package/dist/components/searchcraft-slider.js +72 -0
  84. package/dist/components/searchcraft-slider.js.map +1 -0
  85. package/dist/components/searchcraft-spinner-dark.js +1 -1
  86. package/dist/components/searchcraft-spinner-light.js +1 -1
  87. package/dist/components/searchcraft-toggle-button.d.ts +11 -0
  88. package/dist/components/searchcraft-toggle-button.js +71 -0
  89. package/dist/components/searchcraft-toggle-button.js.map +1 -0
  90. package/dist/esm/{index-e4a4f86d.js → index-92040c37.js} +10 -4
  91. package/dist/esm/index-92040c37.js.map +1 -0
  92. package/dist/esm/index.js +1 -1
  93. package/dist/esm/loader.js +3 -3
  94. package/dist/esm/{searchcraft-auto-search-form_13.entry.js → searchcraft-auto-search-form_16.entry.js} +217 -17
  95. package/dist/esm/searchcraft-auto-search-form_16.entry.js.map +1 -0
  96. package/dist/esm/searchcraft-base-search-form.entry.js +3 -3
  97. package/dist/esm/searchcraft-button-icon.entry.js +1 -1
  98. package/dist/esm/searchcraft-button.entry.js +1 -1
  99. package/dist/esm/searchcraft-javascript-sdk.js +3 -3
  100. package/dist/esm/{store-03dc618f.js → store-5f6f8445.js} +110 -42
  101. package/dist/esm/store-5f6f8445.js.map +1 -0
  102. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  103. package/dist/searchcraft-javascript-sdk/{p-6a17384e.entry.js → p-02f632b6.entry.js} +2 -2
  104. package/dist/searchcraft-javascript-sdk/{p-e6f6972c.js → p-05369654.js} +3 -3
  105. package/dist/searchcraft-javascript-sdk/p-05369654.js.map +1 -0
  106. package/dist/searchcraft-javascript-sdk/p-5aa6335f.js +11 -0
  107. package/dist/searchcraft-javascript-sdk/p-5aa6335f.js.map +1 -0
  108. package/dist/searchcraft-javascript-sdk/p-639d019b.entry.js +2 -0
  109. package/dist/searchcraft-javascript-sdk/{p-6c825f8c.entry.js.map → p-639d019b.entry.js.map} +1 -1
  110. package/dist/searchcraft-javascript-sdk/p-73265750.entry.js +2 -0
  111. package/dist/searchcraft-javascript-sdk/p-73265750.entry.js.map +1 -0
  112. package/dist/searchcraft-javascript-sdk/{p-98eab6f9.entry.js → p-81eaebdc.entry.js} +2 -2
  113. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  114. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  115. package/dist/types/components/searchcraft-auto-search-form/searchcraft-auto-search-form.d.ts +1 -0
  116. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +3 -15
  117. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +23 -0
  118. package/dist/types/components/searchcraft-input/searchcraft-input.d.ts +2 -0
  119. package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +11 -0
  120. package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +12 -0
  121. package/dist/types/components.d.ts +75 -24
  122. package/dist/types/provider/store.d.ts +17 -5
  123. package/package.json +1 -1
  124. package/dist/cjs/index-7b49313c.js.map +0 -1
  125. package/dist/cjs/searchcraft-auto-search-form_13.cjs.entry.js.map +0 -1
  126. package/dist/cjs/store-3d577aac.js.map +0 -1
  127. package/dist/components/p-62f37242.js.map +0 -1
  128. package/dist/components/p-9c617862.js.map +0 -1
  129. package/dist/components/p-af65953e.js.map +0 -1
  130. package/dist/esm/index-e4a4f86d.js.map +0 -1
  131. package/dist/esm/searchcraft-auto-search-form_13.entry.js.map +0 -1
  132. package/dist/esm/store-03dc618f.js.map +0 -1
  133. package/dist/searchcraft-javascript-sdk/p-6c825f8c.entry.js +0 -2
  134. package/dist/searchcraft-javascript-sdk/p-9c617862.js +0 -11
  135. package/dist/searchcraft-javascript-sdk/p-9c617862.js.map +0 -1
  136. package/dist/searchcraft-javascript-sdk/p-e6f6972c.js.map +0 -1
  137. package/dist/searchcraft-javascript-sdk/p-f77e9c21.entry.js +0 -2
  138. package/dist/searchcraft-javascript-sdk/p-f77e9c21.entry.js.map +0 -1
  139. /package/dist/searchcraft-javascript-sdk/{p-6a17384e.entry.js.map → p-02f632b6.entry.js.map} +0 -0
  140. /package/dist/searchcraft-javascript-sdk/{p-98eab6f9.entry.js.map → p-81eaebdc.entry.js.map} +0 -0
@@ -0,0 +1,75 @@
1
+ .slider-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 10px;
5
+ font-family: Arial, sans-serif;
6
+ align-items: center;
7
+ }
8
+
9
+ label {
10
+ font-size: 14px;
11
+ font-weight: bold;
12
+ margin-bottom: 10px;
13
+ }
14
+
15
+ .range-container {
16
+ display: flex;
17
+ width: 100%;
18
+ align-items: center;
19
+ }
20
+
21
+ .range-slider {
22
+ width: 100%;
23
+ height: 4px;
24
+ background: #ddd;
25
+ border-radius: 2px;
26
+ outline: none;
27
+ margin: 0 -1px;
28
+ position: relative;
29
+ }
30
+
31
+ .range-slider::-webkit-slider-thumb {
32
+ -webkit-appearance: none;
33
+ appearance: none;
34
+ width: 20px;
35
+ height: 20px;
36
+ background: #007bff;
37
+ border-radius: 50%;
38
+ border: 2px solid #fff;
39
+ cursor: pointer;
40
+ position: relative;
41
+ }
42
+
43
+ .range-slider::-moz-range-thumb {
44
+ width: 20px;
45
+ height: 20px;
46
+ background: #007bff;
47
+ border-radius: 50%;
48
+ border: 2px solid #fff;
49
+ cursor: pointer;
50
+ }
51
+
52
+ .range-slider:before {
53
+ content: "";
54
+ position: absolute;
55
+ height: 4px;
56
+ background: #007bff;
57
+ border-radius: 2px;
58
+ left: 0;
59
+ right: 0;
60
+ z-index: -1;
61
+ }
62
+
63
+ .year-labels {
64
+ display: flex;
65
+ justify-content: space-between;
66
+ width: 100%;
67
+ margin-top: 10px;
68
+ font-size: 12px;
69
+ color: #555;
70
+ }
71
+
72
+ .year-label {
73
+ min-width: 30px;
74
+ text-align: center;
75
+ }
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  export class SearchcraftSpinnerDark {
3
3
  render() {
4
- return (h("div", { key: '76685b09609a42adbff41ee43ecb4b4e161d4598', class: 'spinnerContainer' }, h("div", { key: '7e7a01010f21e5b95358b7385d41a45e90a5b3bd', class: 'spinnerDark' })));
4
+ return (h("div", { key: 'fa6235c4bf182daac64d41cd04a995aa3476b59a', class: 'spinnerContainer' }, h("div", { key: '68532114a4f25a5d12c8514e5c6d2984a68573af', class: 'spinnerDark' })));
5
5
  }
6
6
  static get is() { return "searchcraft-spinner-dark"; }
7
7
  static get encapsulation() { return "shadow"; }
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  export class SearchcraftSpinnerLight {
3
3
  render() {
4
- return (h("div", { key: '7bd4d997ef43d35ee60033a27b6bc46c6d693c33', class: 'spinnerContainer' }, h("div", { key: 'f8cc9948aa6a264719ffc54d25a10af27dc0f802', class: 'spinnerLight' })));
4
+ return (h("div", { key: 'f1c941149c07dac7ee09eff1ae98dca00dcdf924', class: 'spinnerContainer' }, h("div", { key: '2f93e299ef12f4f382d189ab58c743ee9e981ce2', class: 'spinnerLight' })));
5
5
  }
6
6
  static get is() { return "searchcraft-spinner-light"; }
7
7
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,79 @@
1
+ import { h } from "@stencil/core";
2
+ import { useSearchcraftStore } from "../../provider/store";
3
+ export class SearchcraftToggleButton {
4
+ constructor() {
5
+ // Zustand store hook
6
+ this.searchStore = useSearchcraftStore.getState();
7
+ this.handleToggle = async () => {
8
+ this.isActive = !this.isActive;
9
+ if (this.type === 'mode') {
10
+ const mode = this.isActive ? 'normal' : 'fuzzy';
11
+ this.searchStore.setSearchParams({
12
+ mode,
13
+ });
14
+ }
15
+ else if (this.type === 'sort') {
16
+ const sort = this.isActive ? 'asc' : 'desc';
17
+ this.searchStore.setSearchParams({
18
+ sort,
19
+ });
20
+ }
21
+ try {
22
+ await this.searchStore.search();
23
+ }
24
+ catch (error) {
25
+ console.error('Search failed:', error);
26
+ }
27
+ };
28
+ this.type = 'mode';
29
+ this.isActive = false;
30
+ }
31
+ render() {
32
+ const label = this.type === 'mode'
33
+ ? 'Exact Match'
34
+ : this.type === 'sort'
35
+ ? 'Sort Order'
36
+ : '';
37
+ return (h("div", { key: '8bfbd9cf161d3dc285d7309ada79e9fb68624a45', class: 'toggle-container' }, h("span", { key: '99b5f67e53e45ebf97fef2bb2a52e50c804dec4d' }, label), h("button", { key: 'c6444cfcd24ef3558d0d93ebe0d4dcd4ceb8b29e', class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, h("div", { key: '801f2e99c695449e161699fc874aa05ee1cf1e07', class: `toggle-switch ${this.isActive ? 'active' : ''}` }))));
38
+ }
39
+ static get is() { return "searchcraft-toggle-button"; }
40
+ static get encapsulation() { return "shadow"; }
41
+ static get originalStyleUrls() {
42
+ return {
43
+ "$": ["searchcraft-toggle-button.module.scss"]
44
+ };
45
+ }
46
+ static get styleUrls() {
47
+ return {
48
+ "$": ["searchcraft-toggle-button.module.css"]
49
+ };
50
+ }
51
+ static get properties() {
52
+ return {
53
+ "type": {
54
+ "type": "string",
55
+ "mutable": false,
56
+ "complexType": {
57
+ "original": "'mode' | 'sort'",
58
+ "resolved": "\"mode\" | \"sort\"",
59
+ "references": {}
60
+ },
61
+ "required": false,
62
+ "optional": false,
63
+ "docs": {
64
+ "tags": [],
65
+ "text": "Type of the toggle - determines what it controls\n'mode': toggles between 'fuzzy' and 'normal'\n'sort': toggles between 'asc' and 'desc'"
66
+ },
67
+ "attribute": "type",
68
+ "reflect": false,
69
+ "defaultValue": "'mode'"
70
+ }
71
+ };
72
+ }
73
+ static get states() {
74
+ return {
75
+ "isActive": {}
76
+ };
77
+ }
78
+ }
79
+ //# sourceMappingURL=searchcraft-toggle-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchcraft-toggle-button.js","sourceRoot":"","sources":["../../../src/components/searchcraft-toggle-button/searchcraft-toggle-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,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YAC3B,+DAAO,KAAK,CAAQ;YACpB,+DACE,KAAK,EAAE,kBAAkB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EACxD,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,IAAI,EAAC,QAAQ;gBAEb,4DAAK,KAAK,EAAE,iBAAiB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,GAAI,CACzD,CACL,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State } from '@stencil/core';\nimport { useSearchcraftStore } from '@provider/store';\n\n@Component({\n tag: 'searchcraft-toggle-button',\n styleUrl: 'searchcraft-toggle-button.module.scss',\n shadow: true,\n})\nexport class SearchcraftToggleButton {\n /**\n * Type of the toggle - determines what it controls\n * 'mode': toggles between 'fuzzy' and 'normal'\n * 'sort': toggles between 'asc' and 'desc'\n */\n @Prop() type: 'mode' | 'sort' = 'mode';\n\n @State() isActive = false;\n\n // Zustand store hook\n private searchStore = useSearchcraftStore.getState();\n\n private handleToggle = async () => {\n this.isActive = !this.isActive;\n\n if (this.type === 'mode') {\n const mode = this.isActive ? 'normal' : 'fuzzy';\n this.searchStore.setSearchParams({\n mode,\n });\n } else if (this.type === 'sort') {\n const sort = this.isActive ? 'asc' : 'desc';\n this.searchStore.setSearchParams({\n sort,\n });\n }\n\n try {\n await this.searchStore.search();\n } catch (error) {\n console.error('Search failed:', error);\n }\n };\n\n render() {\n const label =\n this.type === 'mode'\n ? 'Exact Match'\n : this.type === 'sort'\n ? 'Sort Order'\n : '';\n\n return (\n <div class='toggle-container'>\n <span>{label}</span>\n <button\n class={`toggle-wrapper ${this.isActive ? 'active' : ''}`}\n onClick={this.handleToggle}\n type='button'\n >\n <div class={`toggle-switch ${this.isActive ? 'active' : ''}`} />\n </button>\n </div>\n );\n }\n}\n"]}
@@ -0,0 +1,38 @@
1
+ .toggle-container {
2
+ display: flex;
3
+ align-items: center;
4
+ font-size: 14px;
5
+ color: #333;
6
+ }
7
+
8
+ .toggle-wrapper {
9
+ box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.05);
10
+ margin-left: 10px;
11
+ border: none;
12
+ border-radius: 16px;
13
+ width: 44px;
14
+ height: 26px;
15
+ background: #ddd;
16
+ position: relative;
17
+ cursor: pointer;
18
+ }
19
+
20
+ .toggle-wrapper.active {
21
+ box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.05);
22
+ background: #007DB3;
23
+ }
24
+
25
+ .toggle-wrapper .toggle-switch {
26
+ width: 18px;
27
+ height: 18px;
28
+ background: #fff;
29
+ border-radius: 50%;
30
+ position: absolute;
31
+ top: calc(50% - 9px);
32
+ left: 4px;
33
+ transition: transform 0.3s ease;
34
+ }
35
+
36
+ .toggle-wrapper .toggle-switch.active {
37
+ transform: translateX(16px);
38
+ }
@@ -26,20 +26,53 @@ const useSearchcraftStore = create((set, get) => {
26
26
  query: '',
27
27
  isRequesting: false,
28
28
  searchResults: null,
29
+ facets: null,
30
+ selectedFilters: [], // Initialize selected filters as an empty array
31
+ searchParams: {
32
+ mode: 'fuzzy',
33
+ sort: 'desc',
34
+ },
29
35
  setQuery: (query) => set({ query }),
30
36
  setSearchResults: (results) => set({ searchResults: results }),
37
+ setFacets: (facets) => set({ facets }),
38
+ setSelectedFilters: (filters) => set({ selectedFilters: filters }), // Update the selected filters
31
39
  setIsRequesting: (isRequesting) => set({ isRequesting }),
40
+ setSearchParams: (params) => set((state) => ({
41
+ searchParams: Object.assign(Object.assign({}, state.searchParams), params),
42
+ })),
43
+ setYearsRange: (yearsRange) => set((state) => ({
44
+ searchParams: Object.assign(Object.assign({}, state.searchParams), { yearsRange }),
45
+ })),
32
46
  search: async () => {
33
- const { query, setIsRequesting, setSearchResults } = get();
47
+ const { query, selectedFilters, setIsRequesting, setSearchResults, setFacets, searchParams, } = get();
34
48
  if (!searchcraft) {
35
49
  throw new Error('Searchcraft instance is not initialized.');
36
50
  }
37
51
  setIsRequesting(true);
38
52
  log(LogLevel.INFO, `Starting search with query: "${query}"`);
39
53
  try {
40
- const results = await searchcraft.search({ query, mode: 'fuzzy' });
54
+ const counts = selectedFilters.reduce((acc, filter) => {
55
+ const cleanedFilter = filter.replace(/^section:/, ''); // Remove 'section:' prefix
56
+ acc[cleanedFilter] = 1; // Assign a dummy count of 1 (or use actual values if available)
57
+ return acc;
58
+ }, {});
59
+ console.log(counts);
60
+ const searchRequest = {
61
+ query,
62
+ mode: searchParams.mode,
63
+ sort: searchParams.sort,
64
+ facets: selectedFilters.length > 0 ? { section: { counts } } : null,
65
+ yearsRange: searchParams.yearsRange,
66
+ };
67
+ console.log('Search Request:', searchRequest);
68
+ const results = await searchcraft.search(searchRequest);
41
69
  setSearchResults(results);
70
+ console.log(results.data.facets);
71
+ // Extract facets from the results and update the state
72
+ const updatedFacets = results.data.facets || null;
73
+ setFacets(updatedFacets);
42
74
  log(LogLevel.DEBUG, `Search results: ${JSON.stringify(results)}`);
75
+ log(LogLevel.DEBUG, `Updated facets: ${JSON.stringify(updatedFacets)}`);
43
76
  }
44
77
  catch (error) {
45
78
  console.error(`Search failed: ${error.message}`);
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/provider/store.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAEL,WAAW,EACX,QAAQ,GAET,MAAM,mBAAmB,CAAC;AAkB3B,sCAAsC;AACtC,MAAM,mBAAmB,GAAG,MAAM,CAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAChE,IAAI,WAAW,GAA2B,IAAI,CAAC;IAC/C,IAAI,gBAAgB,GAAuB,IAAI,CAAC;IAEhD,MAAM,GAAG,GAAG,CAAC,KAAe,EAAE,OAAe,EAAE,EAAE;QAC/C,IAAI,gBAAgB,EAA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AC","sourcesContent":["import { create } from 'zustand';\nimport {\n type CoreSDK as SearchcraftCore,\n SDKDebugger,\n LogLevel,\n type SearchcraftResponse,\n} from '@searchcraft/core';\n\ninterface SearchcraftState {\n query: string;\n isRequesting: boolean;\n searchResults: SearchcraftResponse | null;\n setQuery: (query: string) => void;\n setSearchResults: (results: SearchcraftResponse | null) => void;\n setIsRequesting: (isRequesting: boolean) => void;\n search: () => Promise<void>;\n initialize: (searchcraft: SearchcraftCore, debug?: boolean) => void;\n}\n\ninterface ThemeState {\n theme: 'light' | 'dark';\n toggleTheme: () => void;\n}\n\n// Zustand store for Searchcraft state\nconst useSearchcraftStore = create<SearchcraftState>((set, get) => {\n let searchcraft: SearchcraftCore | null = null;\n let debuggerInstance: SDKDebugger | null = null;\n\n const log = (level: LogLevel, message: string) => {\n if (debuggerInstance) {\n switch (level) {\n case LogLevel.DEBUG:\n debuggerInstance.debug(message);\n break;\n case LogLevel.INFO:\n debuggerInstance.info(message);\n break;\n case LogLevel.WARN:\n debuggerInstance.warn(message);\n break;\n case LogLevel.ERROR:\n debuggerInstance.error(message);\n break;\n }\n }\n };\n\n return {\n query: '',\n isRequesting: false,\n searchResults: null,\n setQuery: (query) => set({ query }),\n setSearchResults: (results) => set({ searchResults: results }),\n setIsRequesting: (isRequesting) => set({ isRequesting }),\n search: async () => {\n const { query, setIsRequesting, setSearchResults } = get();\n if (!searchcraft) {\n throw new Error('Searchcraft instance is not initialized.');\n }\n setIsRequesting(true);\n log(LogLevel.INFO, `Starting search with query: \"${query}\"`);\n try {\n const results = await searchcraft.search({ query, mode: 'fuzzy' });\n setSearchResults(results);\n log(LogLevel.DEBUG, `Search results: ${JSON.stringify(results)}`);\n } catch (error) {\n console.error(`Search failed: ${(error as Error).message}`);\n log(\n LogLevel.ERROR,\n `Search failed with error: ${(error as Error).message}`,\n );\n } finally {\n setIsRequesting(false);\n }\n },\n initialize: (searchcraftInstance, debug = false) => {\n searchcraft = searchcraftInstance;\n debuggerInstance = debug\n ? new SDKDebugger({ logLevel: LogLevel.DEBUG })\n : null;\n\n log(LogLevel.INFO, 'Searchcraft store initialized.');\n },\n };\n});\n\n// Zustand store for Theme state\nconst useThemeStore = create<ThemeState>((set) => ({\n theme: 'light',\n toggleTheme: () =>\n set((state) => ({ theme: state.theme === 'light' ? 'dark' : 'light' })),\n}));\n\n// Export the Zustand stores for use in Stencil components\nexport { useSearchcraftStore, useThemeStore };\n"]}
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/provider/store.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAEL,WAAW,EACX,QAAQ,GAGT,MAAM,mBAAmB,CAAC;AA+B3B,sCAAsC;AACtC,MAAM,mBAAmB,GAAG,MAAM,CAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAChE,IAAI,WAAW,GAA2B,IAAI,CAAC;IAC/C,IAAI,gBAAgB,GAAuB,IAAI,CAAC;IAEhD,MAAM,GAAG,GAAG,CAAC,KAAe,EAAE,OAAe,EAAE,EAAE;QAC/C,IAAI,gBAAgB,EAAE,CAAC;YACrB,QAAQ,KAAK,EAAE,CAAC;gBACd,KAAK,QAAQ,CAAC,KAAK;oBACjB,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBAChC,MAAM;gBACR,KAAK,QAAQ,CAAC,IAAI;oBAChB,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAC/B,MAAM;gBACR,KAAK,QAAQ,CAAC,IAAI;oBAChB,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAC/B,MAAM;gBACR,KAAK,QAAQ,CAAC,KAAK;oBACjB,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBAChC,MAAM;YACV,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,KAAK,EAAE,EAAE;QACT,YAAY,EAAE,KAAK;QACnB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earchcraftResponse,\n type Facets,\n} from '@searchcraft/core';\n\ninterface ThemeState {\n theme: 'light' | 'dark';\n toggleTheme: () => void;\n}\n\ninterface SearchParams {\n mode: 'fuzzy' | 'normal';\n sort: 'asc' | 'desc';\n yearsRange?: [number, number];\n}\n\ninterface SearchcraftState {\n query: string;\n isRequesting: boolean;\n searchResults: SearchcraftResponse | null;\n facets: Facets | null;\n selectedFilters: string[]; // Add this to store selected filters\n searchParams: SearchParams;\n setQuery: (query: string) => void;\n setSearchResults: (results: SearchcraftResponse | null) => void;\n setFacets: (facets: Facets) => void;\n setSelectedFilters: (filters: string[]) => void; // Update selected filters\n setIsRequesting: (isRequesting: boolean) => void;\n setSearchParams: (params: Partial<SearchParams>) => void;\n setYearsRange: (yearsRange: [number, number]) => void;\n search: () => Promise<void>;\n initialize: (searchcraft: SearchcraftCore, debug?: boolean) => void;\n}\n\n// Zustand store for Searchcraft state\nconst useSearchcraftStore = create<SearchcraftState>((set, get) => {\n let searchcraft: SearchcraftCore | null = null;\n let debuggerInstance: SDKDebugger | null = null;\n\n const log = (level: LogLevel, message: string) => {\n if (debuggerInstance) {\n switch (level) {\n case LogLevel.DEBUG:\n debuggerInstance.debug(message);\n break;\n case LogLevel.INFO:\n debuggerInstance.info(message);\n break;\n case LogLevel.WARN:\n debuggerInstance.warn(message);\n break;\n case LogLevel.ERROR:\n debuggerInstance.error(message);\n break;\n }\n }\n };\n\n return {\n query: '',\n isRequesting: false,\n searchResults: null,\n facets: null,\n selectedFilters: [], // Initialize selected filters as an empty array\n searchParams: {\n mode: 'fuzzy',\n sort: 'desc',\n },\n setQuery: (query) => set({ query }),\n setSearchResults: (results) => set({ searchResults: results }),\n setFacets: (facets) => set({ facets }),\n setSelectedFilters: (filters) => set({ selectedFilters: filters }), // Update the selected filters\n setIsRequesting: (isRequesting) => set({ isRequesting }),\n setSearchParams: (params) =>\n set((state) => ({\n searchParams: {\n ...state.searchParams,\n ...params,\n },\n })),\n setYearsRange: (yearsRange) =>\n set((state) => ({\n searchParams: {\n ...state.searchParams,\n yearsRange,\n },\n })),\n search: async () => {\n const {\n query,\n selectedFilters,\n setIsRequesting,\n setSearchResults,\n setFacets,\n searchParams,\n } = get();\n if (!searchcraft) {\n throw new Error('Searchcraft instance is not initialized.');\n }\n setIsRequesting(true);\n log(LogLevel.INFO, `Starting search with query: \"${query}\"`);\n\n try {\n const counts: Record<string, number> = selectedFilters.reduce(\n (acc, filter) => {\n const cleanedFilter = filter.replace(/^section:/, ''); // Remove 'section:' prefix\n acc[cleanedFilter] = 1; // Assign a dummy count of 1 (or use actual values if available)\n return acc;\n },\n {} as Record<string, number>,\n );\n\n console.log(counts);\n\n const searchRequest = {\n query,\n mode: searchParams.mode,\n sort: searchParams.sort,\n facets: selectedFilters.length > 0 ? { section: { counts } } : null,\n yearsRange: searchParams.yearsRange,\n };\n\n console.log('Search Request:', searchRequest);\n\n const results = await searchcraft.search(searchRequest);\n setSearchResults(results);\n console.log(results.data.facets);\n\n // Extract facets from the results and update the state\n const updatedFacets = results.data.facets || null;\n setFacets(updatedFacets);\n\n log(LogLevel.DEBUG, `Search results: ${JSON.stringify(results)}`);\n log(LogLevel.DEBUG, `Updated facets: ${JSON.stringify(updatedFacets)}`);\n } catch (error) {\n console.error(`Search failed: ${(error as Error).message}`);\n log(\n LogLevel.ERROR,\n `Search failed with error: ${(error as Error).message}`,\n );\n } finally {\n setIsRequesting(false);\n }\n },\n initialize: (searchcraftInstance, debug = false) => {\n searchcraft = searchcraftInstance;\n debuggerInstance = debug\n ? new SDKDebugger({ logLevel: LogLevel.DEBUG })\n : null;\n\n log(LogLevel.INFO, 'Searchcraft store initialized.');\n },\n };\n});\n\n// Zustand store for Theme state\nconst useThemeStore = create<ThemeState>((set) => ({\n theme: 'light',\n toggleTheme: () =>\n set((state) => ({ theme: state.theme === 'light' ? 'dark' : 'light' })),\n}));\n\n// Export the Zustand stores for use in Stencil components\nexport { useSearchcraftStore, useThemeStore };\n"]}
@@ -1,5 +1,5 @@
1
- export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-af65953e.js';
1
+ export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-c9cd5533.js';
2
2
  export { e as extractDynamicProperties, p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles } from './p-17c94ac1.js';
3
- export { u as useSearchcraftStore, a as useThemeStore } from './p-9c617862.js';
3
+ export { u as useSearchcraftStore, a as useThemeStore } from './p-5aa6335f.js';
4
4
 
5
5
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, h } from './p-af65953e.js';
1
+ import { p as proxyCustomElement, H, h } from './p-c9cd5533.js';
2
2
 
3
3
  const SearchcraftClearIconSet = /*@__PURE__*/ proxyCustomElement(class SearchcraftClearIconSet extends H {
4
4
  constructor() {
@@ -41,4 +41,4 @@ defineCustomElement();
41
41
 
42
42
  export { SearchcraftClearIconSet as S, defineCustomElement as d };
43
43
 
44
- //# sourceMappingURL=p-a3ea7edc.js.map
44
+ //# sourceMappingURL=p-05cd002d.js.map
@@ -1 +1 @@
1
- {"file":"p-a3ea7edc.js","mappings":";;MAMa,uBAAuB;;;;;oBAMhC,aAAa;;IAEf,MAAM;QACJ,QAAQ,IAAI,CAAC,IAAI;YACf,KAAK,aAAa;gBAChB,QACE,WACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,aAAO,EAAE,EAAC,YAAY,yCAA2C,EACjE,YACE,CAAC,EAAC,uIAAuI,EACzI,MAAM,EAAC,OAAO,kBACD,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YACJ,KAAK,YAAY;gBACf,QACE,WACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,aAAO,EAAE,EAAC,YAAY,wCAA0C,EAChE,YACE,CAAC,EAAC,uIAAuI,EACzI,MAAM,EAAC,OAAO,kBACD,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YACJ,KAAK,aAAa;gBAChB,QACE,WACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,aAAO,EAAE,EAAC,YAAY,yCAA2C,EACjE,YACE,CAAC,EAAC,uCAAuC,EACzC,MAAM,EAAC,SAAS,kBACH,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YACJ,KAAK,YAAY;gBACf,QACE,WACE,KAAK,EAAC,GAAG,EACT,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,aAAO,EAAE,EAAC,YAAY,wCAA0C,EAChE,YACE,CAAC,EAAC,qBAAqB,EACvB,MAAM,EAAC,SAAS,kBACH,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YAEJ;gBACE,OAAO,IAAI,CAAC;SACf;KACF;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/assets/searchcraft-clear-icon-set.tsx"],"sourcesContent":["import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-clear-icon-set',\n shadow: true,\n})\nexport class SearchcraftClearIconSet {\n /**\n * Type of the icon to display.\n * Options: 'clear-light', 'clear-dark', 'arrow-light', 'arrow-dark'\n */\n @Prop() type: 'clear-light' | 'clear-dark' | 'arrow-light' | 'arrow-dark' =\n 'clear-light';\n\n render() {\n switch (this.type) {\n case 'clear-light':\n return (\n <svg\n width='22'\n height='22'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Clear Input Icon Light</title>\n <path\n d='M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z'\n stroke='black'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'clear-dark':\n return (\n <svg\n width='22'\n height='22'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Clear Input Icon Dark</title>\n <path\n d='M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z'\n stroke='white'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'arrow-light':\n return (\n <svg\n width='20'\n height='21'\n viewBox='0 0 20 21'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Arrow Right Icon Light</title>\n <path\n d='M7.5 15.0444L12.5 10.0444L7.5 5.04443'\n stroke='#737373'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'arrow-dark':\n return (\n <svg\n width='8'\n height='12'\n viewBox='0 0 8 12'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Arrow Right Icon Dark</title>\n <path\n d='M1.5 11L6.5 6L1.5 1'\n stroke='#BFBFBF'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n\n default:\n return null;\n }\n }\n}\n"],"version":3}
1
+ {"file":"p-05cd002d.js","mappings":";;MAMa,uBAAuB;;;;;oB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,kBACH,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YAEJ;gBACE,OAAO,IAAI,CAAC;SACf;KACF;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/assets/searchcraft-clear-icon-set.tsx"],"sourcesContent":["import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-clear-icon-set',\n shadow: true,\n})\nexport class SearchcraftClearIconSet {\n /**\n * Type of the icon to display.\n * Options: 'clear-light', 'clear-dark', 'arrow-light', 'arrow-dark'\n */\n @Prop() type: 'clear-light' | 'clear-dark' | 'arrow-light' | 'arrow-dark' =\n 'clear-light';\n\n render() {\n switch (this.type) {\n case 'clear-light':\n return (\n <svg\n width='22'\n height='22'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Clear Input Icon Light</title>\n <path\n d='M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z'\n stroke='black'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'clear-dark':\n return (\n <svg\n width='22'\n height='22'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Clear Input Icon Dark</title>\n <path\n d='M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z'\n stroke='white'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'arrow-light':\n return (\n <svg\n width='20'\n height='21'\n viewBox='0 0 20 21'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Arrow Right Icon Light</title>\n <path\n d='M7.5 15.0444L12.5 10.0444L7.5 5.04443'\n stroke='#737373'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'arrow-dark':\n return (\n <svg\n width='8'\n height='12'\n viewBox='0 0 8 12'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Arrow Right Icon Dark</title>\n <path\n d='M1.5 11L6.5 6L1.5 1'\n stroke='#BFBFBF'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n\n default:\n return null;\n }\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, h } from './p-af65953e.js';
1
+ import { p as proxyCustomElement, H, h } from './p-c9cd5533.js';
2
2
  import { c as classNames } from './p-5cdc6210.js';
3
3
 
4
4
  const searchcraftInputCaptionModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputCaptionLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040}.inputCaptionDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6}.inputCaptionErrorLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.inputCaptionErrorDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}.inputCaptionLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040;text-align:right}.inputCaptionDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6;text-align:right}.inputCaptionErrorLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000;text-align:right}.inputCaptionErrorDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3;text-align:right}";
@@ -58,4 +58,4 @@ defineCustomElement();
58
58
 
59
59
  export { SearchcraftInputCaption as S, defineCustomElement as d };
60
60
 
61
- //# sourceMappingURL=p-85d96d9b.js.map
61
+ //# sourceMappingURL=p-25bd714c.js.map
@@ -1 +1 @@
1
- {"file":"p-85d96d9b.js","mappings":";;;AAAA,MAAM,gCAAgC,GAAG,8oCAA8oC,CAAC;AACxrC,sCAAe,gCAAgC;;MCOlC,uBAAuB;;;;;;qCAED,EAAE;iCACP,cAAc;sCACT,KAAK;qBACrB,OAAO;;IAEhB,YAAY;QAClB,OAAO,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC;KAC/B;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,sBAAsB,IAChC,SACE,KAAK,EAAE,UAAU,CACf,IAAI,CAAC,KAAK;kBACN,IAAI,CAAC,YAAY;sBACf,2BAA2B;sBAC3B,0BAA0B;kBAC5B,IAAI,CAAC,YAAY;sBACf,sBAAsB;sBACtB,qBAAqB,EAC3B,IAAI,CAAC,qBAAqB,EAC1B,4BAA4B,CAC7B,IAEA,IAAI,CAAC,iBAAiB,CACrB,KAEJ,SACE,KAAK,EAAE,UAAU,CACf,IAAI,CAAC,KAAK;kBACN,IAAI,CAAC,YAAY;sBACf,2BAA2B;sBAC3B,0BAA0B;kBAC5B,IAAI,CAAC,YAAY;sBACf,sBAAsB;sBACtB,qBAAqB,EAC3B,IAAI,CAAC,qBAAqB,EAC1B,4BAA4B,CAC7B,IAEA,IAAI,CAAC,iBAAiB,CACrB,CACL,CAAC;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input-caption/searchcraft-input-caption.module.scss?tag=searchcraft-input-caption&encapsulation=shadow","src/components/searchcraft-input-caption/searchcraft-input-caption.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin input-caption-base {\n font-family: var(--font-stack);\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n margin-top: 4px;\n}\n\n@mixin input-caption-base-light {\n @include input-caption-base;\n color: $light-input-caption-color;\n}\n\n@mixin input-caption-base-dark {\n @include input-caption-base;\n color: $dark-input-caption-color;\n}\n\n.inputCaptionLightLTR {\n @include input-caption-base-light;\n}\n\n.inputCaptionDarkLTR {\n @include input-caption-base-dark;\n}\n\n.inputCaptionErrorLightLTR {\n @include input-caption-base;\n color: $light-input-caption-color-error;\n}\n\n.inputCaptionErrorDarkLTR {\n @include input-caption-base;\n color: $dark-input-caption-color-error;\n}\n\n.inputCaptionLightRTL {\n @include input-caption-base-light;\n text-align: right;\n}\n\n.inputCaptionDarkRTL {\n @include input-caption-base-dark;\n text-align: right;\n}\n\n.inputCaptionErrorLightRTL {\n @include input-caption-base;\n color: $light-input-caption-color-error;\n text-align: right;\n}\n\n.inputCaptionErrorDarkRTL {\n @include input-caption-base;\n color: $dark-input-caption-color-error;\n text-align: right;\n}","import { Component, Prop, h, State } from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'searchcraft-input-caption',\n styleUrl: 'searchcraft-input-caption.module.scss',\n shadow: true,\n})\nexport class SearchcraftInputCaption {\n @Prop() error?: boolean;\n @Prop() inputCaptionClassName? = '';\n @Prop() inputCaptionValue = 'Enter Search';\n @Prop() rightToLeftOrientation = false;\n @State() theme = 'light';\n\n private isLightTheme() {\n return this.theme === 'light';\n }\n\n render() {\n return this.rightToLeftOrientation ? (\n <p\n class={classNames(\n this.error\n ? this.isLightTheme\n ? 'inputCaptionErrorLightRTL'\n : 'inputCaptionErrorDarkRTL'\n : this.isLightTheme\n ? 'inputCaptionLightRTL'\n : 'inputCaptionDarkRTL',\n this.inputCaptionClassName,\n '.searchcraft-input-caption',\n )}\n >\n {this.inputCaptionValue}\n </p>\n ) : (\n <p\n class={classNames(\n this.error\n ? this.isLightTheme\n ? 'inputCaptionErrorLightLTR'\n : 'inputCaptionErrorDarkLTR'\n : this.isLightTheme\n ? 'inputCaptionLightLTR'\n : 'inputCaptionDarkLTR',\n this.inputCaptionClassName,\n '.searchcraft-input-caption',\n )}\n >\n {this.inputCaptionValue}\n </p>\n );\n }\n}\n"],"version":3}
1
+ {"file":"p-25bd714c.js","mappings":";;;AAAA,MAAM,gCAAgC,GAAG,8oCAA8oC,CAAC;AACxrC,sCAAe,gCAAgC;;MCOlC,uBAAuB;;;;;;qCAED,EAAE;iCACP,cAAc;sCACT,KAAK;qBACrB,OAAO;;IAEhB,YAAY;QAClB,OAAO,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC;KAC/B;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,sBAAsB,IAChC,SACE,KAAK,EAAE,UAAU,CACf,IAAI,CAAC,KAAK;kBACN,IAAI,CAAC,YAAY;sBACf,2BAA2B;sBAC3B,0BAA0B;kBAC5B,IAAI,CAAC,YAAY;sBACf,sBAAsB;sBACtB,qBAAqB,EAC3B,IAAI,CAAC,qBAAqB,EAC1B,4BAA4B,CAC7B,IAEA,IAAI,CAAC,iBAAiB,CACrB,KAEJ,SACE,KAAK,EAAE,UAAU,CACf,IAAI,CAAC,KAAK;kBACN,IAAI,CAAC,YAAY;sBACf,2BAA2B;sBAC3B,0BAA0B;kBAC5B,IAAI,CAAC,YAAY;sBACf,sBAAsB;sBACtB,qBAAqB,EAC3B,IAAI,CAAC,qBAAqB,EAC1B,4BAA4B,CAC7B,IAEA,IAAI,CAAC,iBAAiB,CACrB,CACL,CAAC;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input-caption/searchcraft-input-caption.module.scss?tag=searchcraft-input-caption&encapsulation=shadow","src/components/searchcraft-input-caption/searchcraft-input-caption.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin input-caption-base {\n font-family: var(--font-stack);\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n margin-top: 4px;\n}\n\n@mixin input-caption-base-light {\n @include input-caption-base;\n color: $light-input-caption-color;\n}\n\n@mixin input-caption-base-dark {\n @include input-caption-base;\n color: $dark-input-caption-color;\n}\n\n.inputCaptionLightLTR {\n @include input-caption-base-light;\n}\n\n.inputCaptionDarkLTR {\n @include input-caption-base-dark;\n}\n\n.inputCaptionErrorLightLTR {\n @include input-caption-base;\n color: $light-input-caption-color-error;\n}\n\n.inputCaptionErrorDarkLTR {\n @include input-caption-base;\n color: $dark-input-caption-color-error;\n}\n\n.inputCaptionLightRTL {\n @include input-caption-base-light;\n text-align: right;\n}\n\n.inputCaptionDarkRTL {\n @include input-caption-base-dark;\n text-align: right;\n}\n\n.inputCaptionErrorLightRTL {\n @include input-caption-base;\n color: $light-input-caption-color-error;\n text-align: right;\n}\n\n.inputCaptionErrorDarkRTL {\n @include input-caption-base;\n color: $dark-input-caption-color-error;\n text-align: right;\n}","import { Component, Prop, h, State } from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'searchcraft-input-caption',\n styleUrl: 'searchcraft-input-caption.module.scss',\n shadow: true,\n})\nexport class SearchcraftInputCaption {\n @Prop() error?: boolean;\n @Prop() inputCaptionClassName? = '';\n @Prop() inputCaptionValue = 'Enter Search';\n @Prop() rightToLeftOrientation = false;\n @State() theme = 'light';\n\n private isLightTheme() {\n return this.theme === 'light';\n }\n\n render() {\n return this.rightToLeftOrientation ? (\n <p\n class={classNames(\n this.error\n ? this.isLightTheme\n ? 'inputCaptionErrorLightRTL'\n : 'inputCaptionErrorDarkRTL'\n : this.isLightTheme\n ? 'inputCaptionLightRTL'\n : 'inputCaptionDarkRTL',\n this.inputCaptionClassName,\n '.searchcraft-input-caption',\n )}\n >\n {this.inputCaptionValue}\n </p>\n ) : (\n <p\n class={classNames(\n this.error\n ? this.isLightTheme\n ? 'inputCaptionErrorLightLTR'\n : 'inputCaptionErrorDarkLTR'\n : this.isLightTheme\n ? 'inputCaptionLightLTR'\n : 'inputCaptionDarkLTR',\n this.inputCaptionClassName,\n '.searchcraft-input-caption',\n )}\n >\n {this.inputCaptionValue}\n </p>\n );\n }\n}\n"],"version":3}
@@ -1,13 +1,13 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-af65953e.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-c9cd5533.js';
2
2
  import { c as classNames } from './p-5cdc6210.js';
3
3
  import { p as parseCustomStyles } from './p-17c94ac1.js';
4
- import { d as defineCustomElement$7 } from './p-a3ea7edc.js';
5
- import { d as defineCustomElement$6 } from './p-07fba086.js';
6
- import { d as defineCustomElement$5 } from './p-85d96d9b.js';
7
- import { d as defineCustomElement$4 } from './p-6b1d0cba.js';
8
- import { d as defineCustomElement$3 } from './p-d33fdd81.js';
9
- import { d as defineCustomElement$2 } from './p-04bad430.js';
10
- import { d as defineCustomElement$1 } from './p-781a9a8c.js';
4
+ import { d as defineCustomElement$7 } from './p-05cd002d.js';
5
+ import { d as defineCustomElement$6 } from './p-403f6115.js';
6
+ import { d as defineCustomElement$5 } from './p-25bd714c.js';
7
+ import { d as defineCustomElement$4 } from './p-f2e41d24.js';
8
+ import { d as defineCustomElement$3 } from './p-71dff048.js';
9
+ import { d as defineCustomElement$2 } from './p-50ca3fe4.js';
10
+ import { d as defineCustomElement$1 } from './p-e0e0fc94.js';
11
11
 
12
12
  const searchcraftInputModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputContainerLTR{position:relative;width:100%}.inputContainerRTL{position:relative;width:100%;margin-left:8px}.inputLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-right:8px;padding-left:36px;padding-right:16px}.inputLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000}.inputDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-right:8px;padding-left:36px;padding-right:16px}.inputDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightLTR::placeholder{color:#737373}.inputErrorLightLTR:focus{outline:2px solid #000}.inputErrorLightLTR:focus-visible{outline:2px solid #c00}.inputErrorDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkLTR::placeholder{color:#BFBFBF}.inputErrorDarkLTR:focus{outline:2px solid #FFF}.inputErrorDarkLTR:focus-visible{outline:2px solid #FFB3B3}.inputLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000}.inputDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightRTL::placeholder{color:#737373}.inputErrorLightRTL:focus{outline:2px solid #000}.inputErrorLightRTL:focus-visible{outline:2px solid #c00}.inputErrorDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkRTL::placeholder{color:#BFBFBF}.inputErrorDarkRTL:focus{outline:2px solid #FFF}.inputErrorDarkRTL:focus-visible{outline:2px solid #FFB3B3}.inputWrapper{align-items:center;display:flex;position:relative;width:100%}";
13
13
  const SearchcraftInputStyle0 = searchcraftInputModuleCss;
@@ -19,6 +19,7 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
19
19
  this.__attachShadow();
20
20
  this.clearInput = createEvent(this, "clearInput", 7);
21
21
  this.searchInputChange = createEvent(this, "searchInputChange", 7);
22
+ this.inputKeyUp = createEvent(this, "inputKeyUp", 7);
22
23
  this.customStyles = {};
23
24
  this.error = false;
24
25
  this.formClassName = '';
@@ -40,6 +41,10 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
40
41
  const input = event.target;
41
42
  this.searchInputChange.emit(input.value);
42
43
  }
44
+ handleInputKeyUp(event) {
45
+ const input = event.target;
46
+ this.inputKeyUp.emit(input.value);
47
+ }
43
48
  handleClearInput() {
44
49
  if (this.clearInput) {
45
50
  this.clearInput.emit();
@@ -60,11 +65,11 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
60
65
  const placeholderStyle = {
61
66
  fontSize: validatedCustomStyles.placeholderFontSize || '16px',
62
67
  };
63
- return (h("div", { key: '41f29f98e95d5811e81dd885cd282cd8f50cb776', class: classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (h(Fragment, null, h("input", { class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
68
+ return (h("div", { key: 'ca2698b808ef606d890817f6b8c133503663570e', class: classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (h(Fragment, null, h("input", { class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
64
69
  #searchcraft-input-id::placeholder {
65
70
  font-size: ${placeholderStyle.fontSize};
66
71
  }
67
- `), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h("div", { class: 'inputWrapper' }, h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), h("input", { class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
72
+ `), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h("div", { class: 'inputWrapper' }, h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), h("input", { class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
68
73
  #searchcraft-input-id::placeholder {
69
74
  font-size: ${placeholderStyle.fontSize};
70
75
  }
@@ -138,4 +143,4 @@ defineCustomElement();
138
143
 
139
144
  export { SearchcraftInput as S, defineCustomElement as d };
140
145
 
141
- //# sourceMappingURL=p-62f37242.js.map
146
+ //# sourceMappingURL=p-37df2122.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-37df2122.js","mappings":";;;;;;;;;;;AAAA,MAAM,yBAAyB,GAAG,2sHAA2sH,CAAC;AAC9uH,+BAAe,yBAAyB;;MCsB3B,gBAAgB;;;;;;;;4BAC6B,EAAE;qBAC1C,KAAK;6BACG,EAAE;qCACM,EAAE;iCACN,EAAE;8BACL,EAAE;+BACD,EAAE;8BACH,EAAE;4BACJ,KAAK;gCACD,cAAc;sCACR,KAAK;qBACtB,EAAE;qBAMD,OAAO;;IAExB,IAAY,YAAY;QACtB,OAAO,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC;KAC/B;IAED,iBAAiB,CAAC,KAAY;QAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,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,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,GACnD,CACH,EACA,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,KACpB,sCACE,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,GACnD,CACH,CACG,CACP,CACG,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input/searchcraft-input.module.scss?tag=searchcraft-input&encapsulation=shadow","src/components/searchcraft-input/searchcraft-input.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin input-container-base {\n position: relative;\n width: 100%;\n}\n\n@mixin input-base {\n border: none;\n border-radius: 8px;\n font-family: var(--font-stack);\n outline: none;\n padding-bottom: 15px;\n padding-top: 15px;\n width: 100%;\n\n &::placeholder {\n font-family: var(--font-stack);\n font-size: 16px;\n }\n}\n\n@mixin input-base-light {\n @include input-base;\n background-color: $light-input-background-color;\n color: $light-input-label-color;\n\n &::placeholder {\n color: $light-input-placeholder-color;\n }\n\n &:focus {\n outline: 2px solid $light-input-outline-focus;\n }\n}\n\n@mixin input-base-dark {\n @include input-base;\n background-color: $dark-input-background-color;\n color: $dark-input-label-color;\n\n &::placeholder {\n color: $dark-input-placeholder-color;\n }\n\n &:focus {\n outline: 2px solid $dark-input-outline-focus;\n }\n}\n\n@mixin input-error-base-light {\n @include input-base-light;\n outline: 2px solid $light-input-error-outline;\n\n &:focus-visible {\n outline: 2px solid $light-input-error-outline,\n }\n}\n\n@mixin input-error-base-dark {\n @include input-base-dark;\n outline: 2px solid $dark-input-error-outline;\n\n &:focus-visible {\n outline: 2px solid $dark-input-error-outline;\n }\n}\n\n.inputContainerLTR {\n @include input-container-base;\n}\n\n.inputContainerRTL {\n @include input-container-base;\n margin-left: 8px;\n}\n\n@mixin align-LTR {\n margin-right: 8px;\n padding-left: 36px;\n padding-right: 16px;\n}\n\n.inputLightLTR {\n @include input-base-light;\n @include align-LTR;\n}\n\n.inputDarkLTR {\n @include input-base-dark;\n @include align-LTR;\n}\n\n.inputErrorLightLTR {\n @include input-error-base-light;\n @include align-LTR;\n}\n\n.inputErrorDarkLTR {\n @include input-error-base-dark;\n @include align-LTR;\n}\n\n@mixin align-RTL {\n margin-left: 8px;\n padding-left: 16px;\n padding-right: 36px;\n text-align: right;\n}\n\n.inputLightRTL {\n @include input-base-light;\n @include align-RTL;\n}\n\n.inputDarkRTL {\n @include input-base-dark;\n @include align-RTL;\n}\n\n.inputErrorLightRTL {\n @include input-error-base-light;\n @include align-RTL;\n}\n\n.inputErrorDarkRTL {\n @include input-error-base-dark;\n @include align-RTL;\n}\n\n.inputWrapper {\n align-items: center;\n display: flex;\n position: relative;\n width: 100%;\n}\n","import {\n Component,\n h,\n Prop,\n State,\n Event,\n Fragment,\n type EventEmitter,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\nimport { parseCustomStyles } from '@utils/utils';\n\nexport interface ScInputCustomEvent<T> extends CustomEvent<T> {\n detail: T;\n target: HTMLSearchcraftInputElement;\n}\n\n@Component({\n tag: 'searchcraft-input',\n styleUrl: 'searchcraft-input.module.scss',\n shadow: true,\n})\nexport class SearchcraftInput {\n @Prop() customStyles: string | Record<string, string> = {};\n @Prop() error = false;\n @Prop() formClassName = '';\n @Prop() inputCaptionClassName = '';\n @Prop() inputCaptionValue = '';\n @Prop() inputClassName = '';\n @Prop() inputIconHeight = 20;\n @Prop() inputIconWidth = 20;\n @Prop() isRequesting = false;\n @Prop() placeholderValue = 'Enter Search';\n @Prop() rightToLeftOrientation = false;\n @Prop() query = '';\n\n @Event() clearInput: EventEmitter<void>;\n @Event() searchInputChange: EventEmitter<string>;\n @Event() inputKeyUp: EventEmitter<string>;\n\n @State() theme = 'light';\n\n private get isLightTheme() {\n return this.theme === 'light';\n }\n\n handleInputChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.searchInputChange.emit(input.value);\n }\n\n handleInputKeyUp(event: KeyboardEvent) {\n const input = event.target as HTMLInputElement;\n this.inputKeyUp.emit(input.value);\n }\n\n handleClearInput() {\n if (this.clearInput) {\n this.clearInput.emit();\n }\n }\n\n render() {\n const containerClassName = this.rightToLeftOrientation\n ? 'inputContainerRTL'\n : 'inputContainerLTR';\n\n const inputClassName = classNames(\n this.error\n ? this.isLightTheme\n ? 'inputErrorLightRTL'\n : 'inputErrorDarkRTL'\n : this.isLightTheme\n ? 'inputLightLTR'\n : 'inputDarkLTR',\n 'searchcraft-input',\n );\n\n const validatedCustomStyles = parseCustomStyles(this.customStyles);\n\n const placeholderStyle = {\n fontSize: validatedCustomStyles.placeholderFontSize || '16px',\n };\n return (\n <div\n class={classNames(\n containerClassName,\n this.formClassName,\n 'searchcraft-input-form',\n )}\n >\n {this.rightToLeftOrientation ? (\n <Fragment>\n <input\n class={classNames(inputClassName, 'searchcraft-input')}\n id='searchcraft-input-id'\n onChange={this.handleInputChange.bind(this)}\n onKeyUp={this.handleInputKeyUp.bind(this)}\n placeholder={this.placeholderValue}\n type='text'\n value={this.query}\n style={validatedCustomStyles}\n />\n <style>\n {`\n #searchcraft-input-id::placeholder {\n font-size: ${placeholderStyle.fontSize};\n }\n `}\n </style>\n {this.inputCaptionValue && (\n <searchcraft-input-caption\n inputCaptionClassName={this.inputCaptionClassName}\n inputCaptionValue={this.inputCaptionValue}\n rightToLeftOrientation={this.rightToLeftOrientation}\n />\n )}\n {this.query.length > 0 && (\n <searchcraft-clear-input-button\n isRequesting={this.isRequesting}\n onClearInput={this.handleClearInput}\n rightToLeftOrientation={this.rightToLeftOrientation}\n />\n )}\n <searchcraft-input-icon\n error={this.error}\n height={this.inputIconHeight}\n rightToLeftOrientation={this.rightToLeftOrientation}\n width={this.inputIconWidth}\n />\n </Fragment>\n ) : (\n <div class='inputWrapper'>\n <searchcraft-input-icon\n error={this.error}\n height={this.inputIconHeight}\n rightToLeftOrientation={this.rightToLeftOrientation}\n width={this.inputIconWidth}\n />\n <input\n class={classNames(inputClassName, 'searchcraft-input')}\n id='searchcraft-input-id'\n onChange={this.handleInputChange.bind(this)}\n onKeyUp={this.handleInputKeyUp.bind(this)}\n placeholder={this.placeholderValue}\n type='text'\n value={this.query}\n style={validatedCustomStyles}\n />\n <style>\n {`\n #searchcraft-input-id::placeholder {\n font-size: ${placeholderStyle.fontSize};\n }\n `}\n </style>\n {this.inputCaptionValue && (\n <searchcraft-input-caption\n inputCaptionClassName={this.inputCaptionClassName}\n inputCaptionValue={this.inputCaptionValue}\n rightToLeftOrientation={this.rightToLeftOrientation}\n />\n )}\n {this.query.length > 0 && (\n <searchcraft-clear-input-button\n isRequesting={this.isRequesting}\n onClearInput={this.handleClearInput}\n rightToLeftOrientation={this.rightToLeftOrientation}\n />\n )}\n </div>\n )}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h } from './p-af65953e.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h } from './p-c9cd5533.js';
2
2
 
3
3
  const searchcraftBaseSearchResultModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{background-color:#FAFAFA;align-items:flex-start;border-radius:16px;display:flex;position:relative;flex-direction:column;gap:16px;padding:8px}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{background-color:#2E2E2E;align-items:flex-start;border-radius:16px;display:flex;position:relative;flex-direction:column;gap:16px;padding:8px}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{position:absolute;right:5px;top:-2px;display:inline-block}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-height:540px;max-width:100%}@media (min-width: 600px){.imageContainer{max-height:175px}}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.imageLight{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0px;position:relative;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0px;position:relative;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
4
4
  const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
@@ -83,4 +83,4 @@ defineCustomElement();
83
83
 
84
84
  export { SearchcraftBaseSearchResult as S, defineCustomElement as d };
85
85
 
86
- //# sourceMappingURL=p-f3af2b04.js.map
86
+ //# sourceMappingURL=p-3cbac2bb.js.map
@@ -1 +1 @@
1
- {"file":"p-f3af2b04.js","mappings":";;AAAA,MAAM,oCAAoC,GAAG,0zFAA0zF,CAAC;AACx2F,0CAAe,oCAAoC;;MCMtC,2BAA2B;;;;;;;;QAa7B,mBAAc,GAAe,SAAQ,CAAC;QACtC,oBAAe,GAAe,SAAQ,CAAC;QACvC,mBAAc,GAAe,SAAQ,CAAC;QAEvC,sBAAiB,GAAG;YAC1B,IAAI,CAAC,cAAc,EAAE,CAAC;SACvB,CAAC;QAEM,yBAAoB,GAAG;YAC7B,IAAI,IAAI,CAAC,aAAa,EAAE;gBACtB,IAAI,CAAC,cAAc,EAAE,CAAC;aACvB;SACF,CAAC;0BAxBmB,EAAE;gCACI,EAAE;2BACP,EAAE;6BACA,KAAK;8BACJ,EAAE;gCACA,EAAE;+BACH,EAAE;2BACN,EAAE;8BACC,EAAE;yBACW,OAAO;4BACtB,IAAI;;IAgBnB,WAAW;QACjB,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACtC;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;YACrD,OAAO,EAAE,CAAC;SACX;KACF;IAED,MAAM;QACJ,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAElC,QACE,4DACE,KAAK,EACH,IAAI,CAAC,aAAa;kBACd,YAAY;sBACV,iCAAiC;sBACjC,gCAAgC;kBAClC,iBAAiB,EAEvB,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,EAC7B,QAAQ,EAAC,GAAG,EACZ,OAAO,EAAE,IAAI,CAAC,oBAAoB,E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sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.module.scss?tag=searchcraft-base-search-result&encapsulation=shadow","src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin interactive-result-container-base {\n align-items: flex-start;\n border-radius: 16px;\n display: flex;\n position: relative;\n flex-direction: column;\n gap: 16px;\n padding: 8px;\n\n @media (min-width: 600px) {\n flex-direction: row;\n }\n}\n\n.interactiveResultContainerLight {\n background-color: $light-search-result-container-background;\n @include interactive-result-container-base;\n}\n\n.interactiveResultContainerDark {\n background-color: $dark-search-result-container-background;\n @include interactive-result-container-base;\n}\n\n.resultContainer {\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n @media (min-width: 600px) {\n flex-direction: row;\n }\n}\n\n.interactiveIconLarge {\n display: inline-block;\n position: absolute;\n right: 5px;\n top: 8px;\n\n\n @media (max-width: 600px) {\n display: none;\n }\n}\n\n.interactiveIconSmall {\n position: absolute;\n right: 5px;\n top: -2px;\n display: inline-block;\n\n\n @media (min-width: 600px) {\n display: none;\n }\n}\n\n.imageContainer {\n max-height: 540px;\n max-width: 100%;\n\n @media (min-width: 600px) {\n max-height: 175px;\n }\n}\n\n.contentContainer {\n max-height: 100%;\n max-width: 100%;\n\n @media (min-width: 600px) {\n max-width: 50%;\n }\n}\n\n@mixin image-base {\n aspect-ratio: 2 / 1;\n border-radius: 8px;\n max-height: 100%;\n max-width: 100%;\n}\n\n.imageLight {\n @include image-base;\n border: 1px solid $light-search-result-image-border;\n}\n\n.imageDark {\n @include image-base;\n border: 1px solid $dark-search-result-image-border;\n}\n\n@mixin heading-base {\n font-family: var(--font-stack);\n font-size: 16px;\n font-weight: 700;\n line-height: 20px;\n margin-bottom: 4px;\n margin-top: 0px;\n position: relative;\n}\n\n.headingLight {\n @include heading-base;\n color: $light-search-result-heading-color;\n}\n\n.headingDark {\n @include heading-base;\n color: $dark-search-result-heading-color;\n}\n\n@mixin subheading-base {\n font-family: var(--font-stack);\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n margin-bottom: 4px;\n margin-top: 0px;\n}\n\n.subheadingLight {\n @include subheading-base;\n color: $light-search-result-subheading-color;\n}\n\n.subheadingDark {\n @include subheading-base;\n color: $dark-search-result-subheading-color\n}\n\n@mixin body-content-base {\n font-family: var(--font-stack);\n font-size: 16px;\n font-weight: 400;\n line-height: 20px;\n margin-bottom: 4px;\n margin-top: 0px;\n}\n\n.primaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.primaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}\n\n.secondaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.secondaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}\n\n.tertiaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.tertiaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}","import { Component, Event, h, Prop } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-base-search-result',\n styleUrl: 'searchcraft-base-search-result.module.scss',\n shadow: true,\n})\nexport class SearchcraftBaseSearchResult {\n @Prop() buttonText = ''; // Label for the button\n @Prop() imageDescription = ''; // Alternative text for the image\n @Prop() imageSource = ''; // Source URL for the image\n @Prop() isInteractive = false; // Determines if the result is interactive\n @Prop() primaryContent = ''; // Primary body content\n @Prop() secondaryContent = ''; // Secondary body content\n @Prop() tertiaryContent = ''; // Tertiary body content\n @Prop() headingText = ''; // Text for the heading\n @Prop() subheadingText = ''; // Text for the subheading\n @Prop() themeMode: 'light' | 'dark' = 'light'; // Light or dark theme context\n @Prop() customStyles = '{}'; // New string prop for serialized styles.\n\n @Event() buttonCallback: () => void = () => {}; // Callback for button click\n @Event() keyDownCallback: () => void = () => {}; // Callback for key down event\n @Event() resultCallback: () => void = () => {}; // Callback for result container click\n\n private handleButtonClick = () => {\n this.buttonCallback();\n };\n\n private handleContainerClick = () => {\n if (this.isInteractive) {\n this.resultCallback();\n }\n };\n\n private parseStyles(): Record<string, { [key: string]: string }> {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n\n render() {\n const isLightTheme = this.themeMode === 'light';\n const styles = this.parseStyles();\n\n return (\n <div\n class={\n this.isInteractive\n ? isLightTheme\n ? 'interactiveResultContainerLight'\n : 'interactiveResultContainerDark'\n : 'resultContainer'\n }\n style={styles.container || {}}\n tabindex='0'\n onClick={this.handleContainerClick}\n onKeyDown={this.keyDownCallback}\n >\n <div class='imageContainer'>\n <img\n alt={this.imageDescription}\n src={this.imageSource}\n style={styles.image || {}}\n class={isLightTheme ? 'imageLight' : 'imageDark'}\n />\n </div>\n <div class='contentContainer'>\n <h2\n style={styles.heading || {}}\n class={isLightTheme ? 'headingLight' : 'headingDark'}\n >\n {this.headingText}\n </h2>\n <h3\n style={styles.subheading || {}}\n class={isLightTheme ? 'subheadingLight' : 'subheadingDark'}\n >\n {this.subheadingText}\n </h3>\n <p\n style={styles.primaryContent || {}}\n class={isLightTheme ? 'primaryContentLight' : 'primaryContentDark'}\n >\n {this.primaryContent}\n </p>\n <div>\n <p\n style={styles.secondaryContent || {}}\n class={\n isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark'\n }\n >\n {this.secondaryContent}\n </p>\n <p\n style={styles.tertiaryContent || {}}\n class={\n isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark'\n }\n >\n {this.tertiaryContent}\n </p>\n </div>\n {this.buttonText && (\n <button\n onClick={this.handleButtonClick}\n style={styles.button || {}}\n type='button'\n >\n {this.buttonText}\n </button>\n )}\n </div>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"p-3cbac2bb.js","mappings":";;AAAA,MAAM,oCAAoC,GAAG,0zFAA0zF,CAAC;AACx2F,0CAAe,oCAAoC;;MCMtC,2BAA2B;;;;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W,GAChD,CACE,EACN,4DAAK,KAAK,EAAC,kBAAkB,IAC3B,2DACE,KAAK,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE,EAC3B,KAAK,EAAE,YAAY,GAAG,cAAc,GAAG,aAAa,IAEnD,IAAI,CAAC,WAAW,CACd,EACL,2DACE,KAAK,EAAE,MAAM,CAAC,UAAU,IAAI,EAAE,EAC9B,KAAK,EAAE,YAAY,GAAG,iBAAiB,GAAG,gBAAgB,IAEzD,IAAI,CAAC,cAAc,CACjB,EACL,0DACE,KAAK,EAAE,MAAM,CAAC,cAAc,IAAI,EAAE,EAClC,KAAK,EAAE,YAAY,GAAG,qBAAqB,GAAG,oBAAoB,IAEjE,IAAI,CAAC,cAAc,CAClB,EACJ,8DACE,0DACE,KAAK,EAAE,MAAM,CAAC,gBAAgB,IAAI,EAAE,EACpC,KAAK,EACH,YAAY,GAAG,uBAAuB,GAAG,sBAAsB,IAGhE,IAAI,CAAC,gBAAgB,CACpB,EACJ,0DACE,KAAK,EAAE,MAAM,CAAC,eAAe,IAAI,EAAE,EACnC,KAAK,EACH,YAAY,GAAG,sBAAsB,GAAG,qBAAqB,IAG9D,IAAI,CAAC,eAAe,CACnB,CACA,EACL,IAAI,CAAC,UAAU,KACd,+DACE,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,EAC1B,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,UAAU,CACT,CACV,CACG,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.module.scss?tag=searchcraft-base-search-result&encapsulation=shadow","src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin interactive-result-container-base {\n align-items: flex-start;\n border-radius: 16px;\n display: flex;\n position: relative;\n flex-direction: column;\n gap: 16px;\n padding: 8px;\n\n @media (min-width: 600px) {\n flex-direction: row;\n }\n}\n\n.interactiveResultContainerLight {\n background-color: $light-search-result-container-background;\n @include interactive-result-container-base;\n}\n\n.interactiveResultContainerDark {\n background-color: $dark-search-result-container-background;\n @include interactive-result-container-base;\n}\n\n.resultContainer {\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n @media (min-width: 600px) {\n flex-direction: row;\n }\n}\n\n.interactiveIconLarge {\n display: inline-block;\n position: absolute;\n right: 5px;\n top: 8px;\n\n\n @media (max-width: 600px) {\n display: none;\n }\n}\n\n.interactiveIconSmall {\n position: absolute;\n right: 5px;\n top: -2px;\n display: inline-block;\n\n\n @media (min-width: 600px) {\n display: none;\n }\n}\n\n.imageContainer {\n max-height: 540px;\n max-width: 100%;\n\n @media (min-width: 600px) {\n max-height: 175px;\n }\n}\n\n.contentContainer {\n max-height: 100%;\n max-width: 100%;\n\n @media (min-width: 600px) {\n max-width: 50%;\n }\n}\n\n@mixin image-base {\n aspect-ratio: 2 / 1;\n border-radius: 8px;\n max-height: 100%;\n max-width: 100%;\n}\n\n.imageLight {\n @include image-base;\n border: 1px solid $light-search-result-image-border;\n}\n\n.imageDark {\n @include image-base;\n border: 1px solid $dark-search-result-image-border;\n}\n\n@mixin heading-base {\n font-family: var(--font-stack);\n font-size: 16px;\n font-weight: 700;\n line-height: 20px;\n margin-bottom: 4px;\n margin-top: 0px;\n position: relative;\n}\n\n.headingLight {\n @include heading-base;\n color: $light-search-result-heading-color;\n}\n\n.headingDark {\n @include heading-base;\n color: $dark-search-result-heading-color;\n}\n\n@mixin subheading-base {\n font-family: var(--font-stack);\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n margin-bottom: 4px;\n margin-top: 0px;\n}\n\n.subheadingLight {\n @include subheading-base;\n color: $light-search-result-subheading-color;\n}\n\n.subheadingDark {\n @include subheading-base;\n color: $dark-search-result-subheading-color\n}\n\n@mixin body-content-base {\n font-family: var(--font-stack);\n font-size: 16px;\n font-weight: 400;\n line-height: 20px;\n margin-bottom: 4px;\n margin-top: 0px;\n}\n\n.primaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.primaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}\n\n.secondaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.secondaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}\n\n.tertiaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.tertiaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}","import { Component, Event, h, Prop } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-base-search-result',\n styleUrl: 'searchcraft-base-search-result.module.scss',\n shadow: true,\n})\nexport class SearchcraftBaseSearchResult {\n @Prop() buttonText = ''; // Label for the button\n @Prop() imageDescription = ''; // Alternative text for the image\n @Prop() imageSource = ''; // Source URL for the image\n @Prop() isInteractive = false; // Determines if the result is interactive\n @Prop() primaryContent = ''; // Primary body content\n @Prop() secondaryContent = ''; // Secondary body content\n @Prop() tertiaryContent = ''; // Tertiary body content\n @Prop() headingText = ''; // Text for the heading\n @Prop() subheadingText = ''; // Text for the subheading\n @Prop() themeMode: 'light' | 'dark' = 'light'; // Light or dark theme context\n @Prop() customStyles = '{}'; // New string prop for serialized styles.\n\n @Event() buttonCallback: () => void = () => {}; // Callback for button click\n @Event() keyDownCallback: () => void = () => {}; // Callback for key down event\n @Event() resultCallback: () => void = () => {}; // Callback for result container click\n\n private handleButtonClick = () => {\n this.buttonCallback();\n };\n\n private handleContainerClick = () => {\n if (this.isInteractive) {\n this.resultCallback();\n }\n };\n\n private parseStyles(): Record<string, { [key: string]: string }> {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n\n render() {\n const isLightTheme = this.themeMode === 'light';\n const styles = this.parseStyles();\n\n return (\n <div\n class={\n this.isInteractive\n ? isLightTheme\n ? 'interactiveResultContainerLight'\n : 'interactiveResultContainerDark'\n : 'resultContainer'\n }\n style={styles.container || {}}\n tabindex='0'\n onClick={this.handleContainerClick}\n onKeyDown={this.keyDownCallback}\n >\n <div class='imageContainer'>\n <img\n alt={this.imageDescription}\n src={this.imageSource}\n style={styles.image || {}}\n class={isLightTheme ? 'imageLight' : 'imageDark'}\n />\n </div>\n <div class='contentContainer'>\n <h2\n style={styles.heading || {}}\n class={isLightTheme ? 'headingLight' : 'headingDark'}\n >\n {this.headingText}\n </h2>\n <h3\n style={styles.subheading || {}}\n class={isLightTheme ? 'subheadingLight' : 'subheadingDark'}\n >\n {this.subheadingText}\n </h3>\n <p\n style={styles.primaryContent || {}}\n class={isLightTheme ? 'primaryContentLight' : 'primaryContentDark'}\n >\n {this.primaryContent}\n </p>\n <div>\n <p\n style={styles.secondaryContent || {}}\n class={\n isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark'\n }\n >\n {this.secondaryContent}\n </p>\n <p\n style={styles.tertiaryContent || {}}\n class={\n isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark'\n }\n >\n {this.tertiaryContent}\n </p>\n </div>\n {this.buttonText && (\n <button\n onClick={this.handleButtonClick}\n style={styles.button || {}}\n type='button'\n >\n {this.buttonText}\n </button>\n )}\n </div>\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,8 +1,8 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h } from './p-af65953e.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h } from './p-c9cd5533.js';
2
2
  import { c as classNames } from './p-5cdc6210.js';
3
- import { d as defineCustomElement$3 } from './p-a3ea7edc.js';
4
- import { d as defineCustomElement$2 } from './p-04bad430.js';
5
- import { d as defineCustomElement$1 } from './p-781a9a8c.js';
3
+ import { d as defineCustomElement$3 } from './p-05cd002d.js';
4
+ import { d as defineCustomElement$2 } from './p-50ca3fe4.js';
5
+ import { d as defineCustomElement$1 } from './p-e0e0fc94.js';
6
6
 
7
7
  const searchcraftClearInputButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputClearButtonLTR{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;padding:0;position:absolute;right:25px;top:50%;transform:translateY(-50%);width:20px}.inputClearButtonRTL{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;left:25px;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:20px}";
8
8
  const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
@@ -66,4 +66,4 @@ defineCustomElement();
66
66
 
67
67
  export { SearchcraftClearInputButton as S, defineCustomElement as d };
68
68
 
69
- //# sourceMappingURL=p-07fba086.js.map
69
+ //# sourceMappingURL=p-403f6115.js.map