@searchcraft/javascript-sdk 0.9.0 → 0.9.1

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.
@@ -24,7 +24,7 @@ export { SearchcraftToggleButton, defineCustomElement as defineCustomElementSear
24
24
  export { p as parseCustomStyles, s as serializeStyles } from './p-d9551738.js';
25
25
 
26
26
  const name = "@searchcraft/javascript-sdk";
27
- const version = "0.9.0";
27
+ const version = "0.9.1";
28
28
  const description = "Searchcraft Javascript SDK";
29
29
  const author = "Searchcraft";
30
30
  const license = "Apache-2.0";
@@ -65,7 +65,7 @@ const dependencies = {
65
65
  nanoid: "^5.0.9"
66
66
  };
67
67
  const devDependencies = {
68
- "@searchcraft/core": "^0.9.0",
68
+ "@searchcraft/core": "^0.9.1",
69
69
  "@stencil/core": "^4.7.0",
70
70
  "@stencil/react-output-target": "^0.8.2",
71
71
  "@stencil/sass": "^3.0.12",
@@ -1 +1 @@
1
- {"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA;;;MAGa,WAAY,SAAQA,EAAe;IAC9C,YAAY,MAAyB;QACnC,KAAK,CAAC,MAAM,EAAE;YACZ,OAAO,EAAE,WAAW,CAAC,IAAI;YACzB,UAAU,EAAE,WAAW,CAAC,OAAO;SAChC,CAAC,CAAC;KACJ;;;;;","names":["SearchcraftCore"],"sources":["src/index.ts"],"sourcesContent":["import { type SearchcraftConfig, SearchcraftCore } from '@searchcraft/core';\nimport { searchcraftStore } from '@store';\nimport packageJson from '../package.json';\n\n/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\nexport type * from './components';\nexport type { SearchcraftConfig };\nexport { searchcraftStore };\n\nexport {\n parseCustomStyles,\n serializeStyles,\n} from './utils';\n\nexport type { Components } from './components';\n\n/**\n * The consumer-facing `Searchcraft` class.\n */\nexport class Searchcraft extends SearchcraftCore {\n constructor(config: SearchcraftConfig) {\n super(config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n }\n}\n"],"version":3}
1
+ {"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA;;;MAGa,WAAY,SAAQA,EAAe;IAC9C,YAAY,MAAyB;QACnC,KAAK,CAAC,MAAM,EAAE;YACZ,OAAO,EAAE,WAAW,CAAC,IAAI;YACzB,UAAU,EAAE,WAAW,CAAC,OAAO;SAChC,CAAC,CAAC;KACJ;;;;;","names":["SearchcraftCore"],"sources":["src/index.ts"],"sourcesContent":["import { type SearchcraftConfig, SearchcraftCore } from '@searchcraft/core';\nimport { searchcraftStore } from '@store';\nimport packageJson from '../package.json';\n\n/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\nexport type * from './components';\nexport type { SearchcraftConfig };\nexport { searchcraftStore };\n\nexport {\n parseCustomStyles,\n serializeStyles,\n} from './utils';\n\nexport type { Components } from './components';\n\n/**\n * The consumer-facing `Searchcraft` class.\n */\nexport class Searchcraft extends SearchcraftCore {\n constructor(config: SearchcraftConfig) {\n super(config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n }\n}\n\n/**\n * Exports the shared types that all SDKs need\n */\nexport type * from '@searchcraft/core/dist/types/sdk-types';\n"],"version":3}
@@ -116,9 +116,9 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
116
116
  const inputGridStyles = {
117
117
  gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',
118
118
  };
119
- return (h("form", { key: '2c14849e36610a8da9c24004dfcbbd53b5e9f068', class: 'searchcraft-input-form', onSubmit: this.handleFormSubmit }, h("div", { key: '9fbc29171b5764b36f0efb24bc1f90b149ce7a0a', class: inputGridClassNames, style: inputGridStyles }, h("div", { key: 'a4126032544a6b56869f9654060b2baee686df55', class: 'searchcraft-input-button-wrapper' }, h("searchcraft-button", { key: '605f079014b82c4ff3f1f1114cba420004244750', onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), this.inputLabel && (h("div", { key: '6d6d275c7a6f3c82a6e94d1978516ef1ba2901dd', class: 'searchcraft-input-label-wrapper' }, h("searchcraft-input-label", { key: 'fa3c06bb3f873af486d65408e98e78ecdaa4ed9d', label: this.inputLabel }))), this.error && (h("div", { key: 'bf57d444c5de3b8f225cd3eeff93679f4152d7cb', class: 'searchcraft-input-error-wrapper' }, h("searchcraft-error-message", { key: '7fcf3e079853c8d53451e91fae619b99aa77afad', errorMessage: 'Something went wrong.' }))), h("div", { key: '6cdecf2241a2874e97c3ce25c92cd10aca7945ae', class: 'searchcraft-input-wrapper' }, h("input", { key: '2953736cd91b6d4c59cf74ea4889a0502e58f160', autoComplete: 'off', class: 'searchcraft-input', onFocus: () => this.inputFocus?.emit(), onBlur: () => this.inputBlur?.emit(), onInput: (event) => {
119
+ return (h("form", { key: '52760b113a209c51638bcb005e0b6c3d5bf9741d', class: 'searchcraft-input-form', onSubmit: this.handleFormSubmit }, h("div", { key: '6b20020b8a67c9d860fca7da67150a8d75bd3313', class: inputGridClassNames, style: inputGridStyles }, h("div", { key: '67bba2889e6fde70c4f349dfbd61d9a632c08301', class: 'searchcraft-input-button-wrapper' }, h("searchcraft-button", { key: 'a839e1a67d238bfbe6d47857f6339e49d14f9560', onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), this.inputLabel && (h("div", { key: 'a2a69b7dbdf1142459d6ffad90dc26a38a76276d', class: 'searchcraft-input-label-wrapper' }, h("searchcraft-input-label", { key: '621a4903821ba8c1854e3ff89d30a24dba3ed0fb', label: this.inputLabel }))), this.error && (h("div", { key: 'b4cd633a139488cac185c38123b138fc5d51cd20', class: 'searchcraft-input-error-wrapper' }, h("searchcraft-error-message", { key: 'ccadaf96ac8317b6415a83e6523816328e83eb3e', errorMessage: 'Something went wrong.' }))), h("div", { key: '0f13777c2e5f806ce12fff9680d7862a27b2e260', class: 'searchcraft-input-wrapper' }, h("input", { key: 'a9b58a486dfaadaedf3eeb9aec5e4c3c3548536b', autoComplete: 'off', class: 'searchcraft-input', onFocus: () => this.inputFocus?.emit(), onBlur: () => this.inputBlur?.emit(), onInput: (event) => {
120
120
  this.handleOnInput(event);
121
- }, placeholder: this.placeholderValue, style: validatedCustomStyles, type: 'text', value: this.inputValue }), h("div", { key: 'b2c51a1c05f58c7918f80aef10c457b9d488d10d', class: 'searchcraft-input-search-icon-wrapper' }, h("svg", { key: '66a5a1eb63565ff51e11b6c8728a1d2ca7e8dece', class: 'searchcraft-input-search-icon', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { key: 'bc6ba43a25df7b51eec1a32daa7872e02886449a', id: 'searchcraft-title' }, "Searchcraft Search Icon Light"), h("path", { key: '97e536d07c9e32cd0a82a852b00c0b40bfb1820a', d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))), isShowingClearButton && (h("button", { key: '2a87b3403fdb997bebb4e7407bbbd8dcffa5afca', type: 'button', class: 'searchcraft-input-clear-button', onClick: this.handleClearInput }, h("svg", { key: '4b8319269c80d3f12b46b1c20db12b8f0929937c', class: 'searchcraft-input-clear-icon', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { key: '81ba07486777af6ceedc92429bb6a88624b777c3', id: 'icon-title' }, "Searchcraft Clear Input Icon Light"), h("path", { key: '065f1f9a2b10532bc1495bacd7c4ef3de3867c1b', 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', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))))))));
121
+ }, placeholder: this.placeholderValue, style: validatedCustomStyles, type: 'text', value: this.inputValue }), h("div", { key: 'a57e4f72ee1383e42158bbc9e35d47d2c468acf5', class: 'searchcraft-input-search-icon-wrapper' }, h("svg", { key: 'c7bda92af1488981d5de08af0f9ae3064c76c354', class: 'searchcraft-input-search-icon', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { key: 'f4dc47ae6c88517eeaea574fe819423b3d6e6cb5', id: 'searchcraft-title' }, "Searchcraft Search Icon Light"), h("path", { key: 'c77497591b4f31de0f3e008baa79c006fd0a2eb9', d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))), isShowingClearButton && (h("button", { key: 'e125b759eaa21dfdd4058bf36f3c10233f067835', type: 'button', class: 'searchcraft-input-clear-button', onClick: this.handleClearInput }, h("svg", { key: 'b2767658bb9edbc51efd6430e051127b08c9ab83', class: 'searchcraft-input-clear-icon', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { key: '990ff3c8f207d09192e954b0f5d059e0683db2d4', id: 'icon-title' }, "Searchcraft Clear Input Icon Light"), h("path", { key: '5322d9abb4d60a75869ca943a17157a32c502035', 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', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))))))));
122
122
  }
123
123
  static get watchers() { return {
124
124
  "core": ["onCoreChange"]
@@ -168,4 +168,4 @@ function defineCustomElement() {
168
168
 
169
169
  export { SearchcraftInput as S, defineCustomElement as d };
170
170
 
171
- //# sourceMappingURL=p-3026f7d3.js.map
171
+ //# sourceMappingURL=p-5bd5c3cb.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-5bd5c3cb.js","mappings":";;;;;;;;MAoCa,gBAAgB;;;;;;;;;;;IAInB,UAAU,GAAG,IAAI,CAAC;;;;IAIlB,eAAe,GAA8B,MAAM,CAAC;;;;IAIpD,WAAW,CAAU;;;;IAIrB,UAAU,CAAU;;;;IAIpB,YAAY,GAAoC,EAAE,CAAC;;;;IAInD,gBAAgB,GAAG,cAAc,CAAC;;;;IAIlC,UAAU,GAAG,EAAE,CAAC;;;;IAIf,UAAU,CAAsB;;;;IAIhC,SAAS,CAAsB;;;;IAI/B,SAAS,CAAsB;IAE/B,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IAC7B,KAAK,GAAG,KAAK,CAAC;IAEf,IAAI,CAAmB;IAEvB,WAAW,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IAElD,IAAI;QACF,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;SACx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AAU,EAAE,IAAI,EAAE,EACtC,MAAM,EAAE,MAAM,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,EACpC,OAAO,EAAE,CAAC,KAAK;gBACb,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aAC3B,EACD,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAClC,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,IAAI,CAAC,UAAU,GACtB,EACF,4DAAK,KAAK,EAAC,uCAAuC,IAChD,4DACE,KAAK,EAAC,+BAA+B,EACrC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,mBAAmB,IAEnC,8DAAO,EAAE,EAAC,mBAAmB,oCAErB,EACR,6DACE,CAAC,EAAC,mNAAmN,EACrN,MAAM,EAAC,cAAc,kBACR,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,CACF,EACL,oBAAoB,KACnB,+DACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,gCAAgC,EACtC,OAAO,EAAE,IAAI,CAAC,gBAAgB,IAE9B,4DACE,KAAK,EAAC,8BAA8B,EACpC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,8DAAO,EAAE,EAAC,YAAY,yCAEd,EACR,6DACE,CAAC,EAAC,uIAAuI,EACzI,MAAM,EAAC,cAAc,kBACR,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,CACC,CACV,CACG,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input-form/searchcraft-input-form.tsx"],"sourcesContent":["import {\n Component,\n h,\n Prop,\n State,\n Event,\n type EventEmitter,\n Watch,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\nimport type { SearchcraftCore } from '@searchcraft/core';\n\nimport { parseCustomStyles } from '@utils';\nimport { searchcraftStore } from '@store';\n\n/**\n * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.\n * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-form placeholder-value=\"Search here\" />\n * ```\n *\n * ```js\n * // index.js\n * const searchInputForm = document.querySelector('searchcraft-input-form');\n *\n * ```\n */\n@Component({\n tag: 'searchcraft-input-form',\n shadow: false,\n})\nexport class SearchcraftInput {\n /**\n * Whether or not to automatically submit the search term when the input changes.\n */\n @Prop() autoSearch = true;\n /**\n * Where to place the search button.\n */\n @Prop() buttonPlacement: 'left' | 'right' | 'none' = 'none';\n /**\n * The label for the submit button.\n */\n @Prop() buttonLabel?: string;\n /**\n * The label rendered above the input.\n */\n @Prop() inputLabel?: string;\n /**\n * A custom styles object to be applied to the input element.\n */\n @Prop() customStyles: string | Record<string, string> = {};\n /**\n * The input element's placeholder value.\n */\n @Prop() placeholderValue = 'Enter Search';\n /**\n * The starting value of the input element.\n */\n @Prop() searchTerm = '';\n /**\n * When the input becomes focused.\n */\n @Event() inputFocus?: EventEmitter<void>;\n /**\n * When the input becomes unfocused.\n */\n @Event() inputBlur?: EventEmitter<void>;\n /**\n * Event emitted when input initializes.\n */\n @Event() inputInit?: EventEmitter<void>;\n\n @State() inputValue = this.searchTerm;\n @State() error = false;\n\n @Prop() core?: SearchcraftCore;\n\n private searchStore = searchcraftStore.getState();\n\n init() {\n if (this.core) {\n this.searchStore.initialize(this.core);\n this.inputInit?.emit();\n }\n }\n\n connectedCallback() {\n this.init();\n }\n\n @Watch('core')\n onCoreChange() {\n this.init();\n }\n\n handleOnInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.inputValue = input.value;\n\n if (!this.autoSearch) {\n return;\n }\n\n this.performSearch(input.value);\n };\n\n private performSearch = async (value: string) => {\n if (value === searchcraftStore.getState().searchTerm) {\n return;\n }\n\n this.searchTerm = value.trim();\n this.error = false;\n this.searchStore.setSearchTerm(this.searchTerm);\n\n try {\n await this.searchStore.search();\n } catch (error) {\n console.log(error);\n this.error = true;\n }\n };\n\n handleClearInput = () => {\n this.inputValue = '';\n this.searchTerm = '';\n this.searchStore.setSearchTerm('');\n this.searchStore.setSearchClientResponseItems([]);\n this.error = false;\n };\n\n handleFormSubmit = async (event: Event) => {\n event.preventDefault();\n await this.performSearch(this.searchTerm);\n };\n\n render() {\n const validatedCustomStyles = parseCustomStyles(this.customStyles);\n\n const isShowingClearButton = this.inputValue.length > 0;\n\n const inputGridClassNames = classNames('searchcraft-input-grid', {\n 'searchcraft-input-grid-buttonLeft': this.buttonPlacement === 'left',\n 'searchcraft-input-grid-buttonRight': this.buttonPlacement === 'right',\n 'searchcraft-input-grid-buttonNone': this.buttonPlacement === 'none',\n });\n\n const shouldHaveVerticalGap = this.inputLabel || this.error;\n const inputGridStyles = {\n gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',\n };\n\n return (\n <form class='searchcraft-input-form' onSubmit={this.handleFormSubmit}>\n <div class={inputGridClassNames} style={inputGridStyles}>\n <div class='searchcraft-input-button-wrapper'>\n <searchcraft-button\n onButtonClick={this.handleFormSubmit}\n label={this.buttonLabel}\n />\n </div>\n {this.inputLabel && (\n <div class='searchcraft-input-label-wrapper'>\n <searchcraft-input-label label={this.inputLabel} />\n </div>\n )}\n {this.error && (\n <div class='searchcraft-input-error-wrapper'>\n <searchcraft-error-message errorMessage='Something went wrong.' />\n </div>\n )}\n <div class='searchcraft-input-wrapper'>\n <input\n autoComplete='off'\n class='searchcraft-input'\n onFocus={() => this.inputFocus?.emit()}\n onBlur={() => this.inputBlur?.emit()}\n onInput={(event) => {\n this.handleOnInput(event);\n }}\n placeholder={this.placeholderValue}\n style={validatedCustomStyles}\n type='text'\n value={this.inputValue}\n />\n <div class='searchcraft-input-search-icon-wrapper'>\n <svg\n class='searchcraft-input-search-icon'\n viewBox='0 0 20 20'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='searchcraft-title'\n >\n <title id='searchcraft-title'>\n Searchcraft Search Icon Light\n </title>\n <path\n d='M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z'\n stroke='currentColor'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </div>\n {isShowingClearButton && (\n <button\n type='button'\n class='searchcraft-input-clear-button'\n onClick={this.handleClearInput}\n >\n <svg\n class='searchcraft-input-clear-icon'\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'>\n Searchcraft Clear Input Icon Light\n </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='currentColor'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n </form>\n );\n }\n}\n"],"version":3}
@@ -1 +1 @@
1
- {"file":"p-cd9ba361.js","mappings":";;;;MAkBa,2BAA2B;;;;;IAC9B,IAAI,CAAuC;IAC3C,oBAAoB,CAAmC;;;;IAIvD,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAAqD;;;;IAIjE,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAAqD;;;;IAI9D,cAAc,GAAqB,OAAO,CAAC;;;;IAI3C,YAAY,CAAqB;;;;IAIjC,gBAAgB,GAAG,CAAC,CAAC;IAEpB,YAAY,CAAqB;IACjC,eAAe,CAAqB;IACpC,WAAW,CAAqB;IAChC,aAAa,CAAqB;IAClC,WA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,CACN,EACA,IAAI,CAAC,WAAW,KACf,SACE,KAAK,EAAC,6CAA6C,EACnD,KAAK,EAAE,MAAM,CAAC,cAAc,IAAI,EAAE,IAEjC,IAAI,CAAC,WAAW,CACf,CACL,EAEA,IAAI,CAAC,aAAa,KACjB,SACE,KAAK,EAAC,+CAA+C,EACrD,KAAK,EAAE,MAAM,CAAC,gBAAgB,IAAI,EAAE,IAEnC,IAAI,CAAC,aAAa,CACjB,CACL,EACA,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,KACzD,SACE,KAAK,EAAC,kCAAkC,EACxC,IAAI,EAAE,IAAI,CAAC,UAAU,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,EAC1B,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,GAAG,EAAE,IAAI,CAAC,SAAS,IAElB,IAAI,CAAC,WAAW,CACf,CACL,CACG,EACL,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,IAAI,cAAc,CAC1D,CACZ,CAAC;;QAGF,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,QACE,SACE,KAAK,EAAC,qCAAqC,EAC3C,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,IAAI,EAAE,IAAI,CAAC,aAAa,EACxB,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,EAC7B,QAAQ,EAAC,GAAG,EACZ,MAAM,EAAE,IAAI,CAAC,eAAe,IAE3B,gBAAgB,CACf,EACJ;SACH;;QAGD,QACE,WACE,KAAK,EAAC,qCAAqC,EAC3C,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,IAE5B,gBAAgB,CACb,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["import { searchcraftStore } from '@store';\nimport type {\n SearchClientResponseItem,\n SearchDocument,\n} from '@searchcraft/core';\nimport { Component, Fragment, h, Prop, State } from '@stencil/core';\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\nimport type { SearchResultMappings } from '@searchcraft/core';\n\n/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\n */\n@Component({\n tag: 'searchcraft-base-search-result',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n @Prop() item: SearchClientResponseItem | undefined;\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right' = 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles: string | undefined;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\n @Prop() documentPosition = 0;\n\n @State() titleContent: string | undefined;\n @State() subtitleContent: string | undefined;\n @State() bodyContent: string | undefined;\n @State() footerContent: string | undefined;\n @State() buttonLabel: string | undefined;\n @State() buttonHref: string | undefined;\n @State() containerHref: string | undefined;\n @State() imageSrc: string | undefined;\n @State() imageAlt: string | undefined;\n\n private searchcraftStore = searchcraftStore.getState();\n\n connectedCallback() {\n if (this.item) {\n this.mapValuesFromDocument(this.item.document);\n }\n }\n\n mapValuesFromDocument(document: SearchDocument) {\n this.titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.title,\n );\n this.subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.subtitle,\n );\n this.bodyContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.body,\n );\n this.containerHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.containerHref,\n );\n this.buttonHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.buttonHref,\n );\n this.imageSrc = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.imageSource,\n );\n this.footerContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.footer,\n );\n }\n\n private handleLinkClick = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.searchTerm;\n const number_of_documents =\n this.searchcraftStore.searchClientResponseItems.length;\n\n searchcraft.measureClient?.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.handleLinkClick}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"p-cd9ba361.js","mappings":";;;;MAkBa,2BAA2B;;;;;IAC9B,IAAI,CAA4B;IAChC,oBAAoB,CAAwB;;;;IAI5C,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAA0C;;;;IAItD,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAA0C;;;;IAInD,cAAc,GAAqB,OAAO,CAAC;;;;IAI3C,YAAY,CAAU;;;;IAItB,gBAAgB,GAAG,CAAC,CAAC;IAEpB,YAAY,CAAqB;IACjC,eAAe,CAAqB;IACpC,WAAW,CAAqB;IAChC,aAAa,CAAqB;IAClC,WAAW,CAAqB;IAChC,UAAU,CAAqB;IAC/B,aAAa,CAAqB;IAClC,QAAQ,CAAqB;IAC7B,QAAQ,CAAqB;IAE9B,gBAAgB,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IAEvD,iBAAiB;QACf,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,qBAAqB,CAAC,IAAI,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IAAI,EAAE,IAEnC,IAAI,CAAC,aAAa,CACjB,CACL,EACA,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,KACzD,SACE,KAAK,EAAC,kCAAkC,EACxC,IAAI,EAAE,IAAI,CAAC,UAAU,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,EAC1B,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,GAAG,EAAE,IAAI,CAAC,SAAS,IAElB,IAAI,CAAC,WAAW,CACf,CACL,CACG,EACL,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,IAAI,cAAc,CAC1D,CACZ,CAAC;;QAGF,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,QACE,SACE,KAAK,EAAC,qCAAqC,EAC3C,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,IAAI,EAAE,IAAI,CAAC,aAAa,EACxB,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,EAC7B,QAAQ,EAAC,GAAG,EACZ,MAAM,EAAE,IAAI,CAAC,eAAe,IAE3B,gBAAgB,CACf,EACJ;SACH;;QAGD,QACE,WACE,KAAK,EAAC,qCAAqC,EAC3C,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,IAE5B,gBAAgB,CACb,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["import { searchcraftStore } from '@store';\nimport type {\n SearchClientResponseItem,\n SearchDocument,\n} from '@searchcraft/core';\nimport { Component, Fragment, h, Prop, State } from '@stencil/core';\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\nimport type { SearchResultMappings } from '@searchcraft/core';\n\n/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\n */\n@Component({\n tag: 'searchcraft-base-search-result',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n @Prop() item?: SearchClientResponseItem;\n @Prop() searchResultMappings?: SearchResultMappings;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel?: 'noreferrer' | 'noopener' | 'nofollow';\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel?: 'noreferrer' | 'noopener' | 'nofollow';\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right' = 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles?: string;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\n @Prop() documentPosition = 0;\n\n @State() titleContent: string | undefined;\n @State() subtitleContent: string | undefined;\n @State() bodyContent: string | undefined;\n @State() footerContent: string | undefined;\n @State() buttonLabel: string | undefined;\n @State() buttonHref: string | undefined;\n @State() containerHref: string | undefined;\n @State() imageSrc: string | undefined;\n @State() imageAlt: string | undefined;\n\n private searchcraftStore = searchcraftStore.getState();\n\n connectedCallback() {\n if (this.item) {\n this.mapValuesFromDocument(this.item.document);\n }\n }\n\n mapValuesFromDocument(document: SearchDocument) {\n this.titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.title,\n );\n this.subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.subtitle,\n );\n this.bodyContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.body,\n );\n this.containerHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.containerHref,\n );\n this.buttonHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.buttonHref,\n );\n this.imageSrc = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.imageSource,\n );\n this.footerContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.footer,\n );\n }\n\n private handleLinkClick = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.searchTerm;\n const number_of_documents =\n this.searchcraftStore.searchClientResponseItems.length;\n\n searchcraft.measureClient?.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.handleLinkClick}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1 +1 @@
1
- {"file":"searchcraft-base-search-results.js","mappings":";;;;;;;MAiDaA,8BAA4B;;;;;;;;IAI/B,sBAAsB,CAGhB;;;;IAIN,oBAAoB,CAAmC;;;;IAIvD,oBAAoB,GAAqB,OAAO,CAAC;;;;IAIjD,WAAW,CAAqB;;;;IAIhC,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAAqD;;;;IAI9D,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAAqD;IAEhE,UAAU,GAAG,EAAE,CAAC;IAChB,yBAAyB,GAA+B,EAAE,CAAC;IAC3D,qBAAqB,GAA2B,EAAE,CAAC;IACnD,oBAAoB,CAAC;IACrB,iBAAiB,CAAC;IAClB,kBAAkB,GAAG,KAAK,CAAC;IAC3B,MAAM,CAAqB;IAE5B,WAAW,GAAe,SAAQ,CAAC;IAE3C,IAAI,gBAAgB;QAClB,IAAI,gBAAgB,GAAG,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,gBAAgB;gBACd,OAAO,IAAI,CAAC,sBAAsB,KAAK,QAAQ;sBAC3C,IAAI,CAAC,sBAAsB;sBAC3B,eAAe,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;SACpD;QACD,OAAO,gBAAgB,CAAC;KACzB;IAED,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,SAAS,CAAC,CA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,IAAI,CAAC,EAAE,mBACG,IAAI,CAAC,gBAAgB,qBACnB,IAAI,CAAC,oBAAoB,mBAC3B,IAAI,CAAC,YAAY,sBACd,IAAI,CAAC,eAAe,kBACxB,IAAI,CAAC,WAAW,IAAI,WAAW,gBACjC,IAAI,CAAC,SAAS,mBACX,IAAI,CAAC,YAAY,uBAE9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,GAAG,KAAK,EAE5D,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAC/C,IAAI,EAAE,IAAI,GACV,CACH,CAAC,CACE,EACN;KACH;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACjC,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAChC;QAED,IACE,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;YAC1B,IAAI,CAAC,yBAAyB,CAAC,MAAM,KAAK,CAAC;YAC3C,CAAC,IAAI,CAAC,kBAAkB,EACxB;YACA,OAAO,IAAI,CAAC,yBAAyB,EAAE,CAAC;SACzC;QAED,QAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,IAAI,MAAM;YACrC,KAAK,eAAe;gBAClB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACjC,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpC;gBACE,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;SACjC;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftBaseSearchResults"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":["import { Component, h, Prop, State, type JSX } from '@stencil/core';\n\nimport type {\n AdClientResponseItem,\n SearchClientResponseItem,\n SearchcraftConfig,\n} from '@searchcraft/core';\n\nimport { type SearchcraftState, searchcraftStore } from '@store';\n\nimport { serializeStyles } from '@utils';\nimport type { SearchResultMappings } from '@searchcraft/core';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n @State() searchTerm = '';\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchResultsPerPage;\n @State() searchResultsPage;\n @State() isSearchInProgress = false;\n @State() config?: SearchcraftConfig;\n\n private unsubscribe: () => void = () => {};\n\n get serializedStyles(): string {\n let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\n return serializedStyles;\n }\n\n componentDidLoad() {\n this.unsubscribe = searchcraftStore.subscribe((state) =>\n this.handleStateChange(state),\n );\n const currentState = searchcraftStore.getState();\n this.searchClientResponseItems = currentState.searchClientResponseItems;\n this.searchTerm = currentState.searchTerm;\n this.config = currentState.core?.config;\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleStateChange(state: SearchcraftState) {\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n this.config = state.core?.config;\n this.isSearchInProgress = state.isSearchInProgress;\n }\n\n renderEmptyState() {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n renderNoResultsFoundState() {\n return (\n <div class='searchcraft-search-results-container'>\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.searchTerm}\" query`}\n />\n </div>\n </div>\n );\n }\n\n renderWithADMAds() {\n return (\n <div class='searchcraft-search-results-container'>\n {this.adClientResponseItems?.map((item) => (\n <searchcraft-ad\n adSource='adMarketplace'\n adClientResponseItem={item}\n key={item.id}\n />\n ))}\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n </div>\n );\n }\n\n renderWithCustomAds() {\n const itemsToRender: JSX.Element[] = [];\n const interstitialInterval = this.config?.customAdInterstitialInterval || 0;\n const interstitialQuantity = this.config?.customAdInterstitialQuantity || 1;\n const adStartQuantity = this.config?.customAdStartQuantity || 0;\n const adEndQuantity = this.config?.customAdEndQuantity || 0;\n const searchItems = this.searchClientResponseItems || [];\n\n // Renders ads at beginning\n for (let n = 0; n < adStartQuantity; n++) {\n itemsToRender.push(<searchcraft-ad adSource='Custom' key={`${n}-ad`} />);\n }\n\n // Renders search results + interstitial ads\n searchItems.forEach((item, index) => {\n if (\n interstitialInterval &&\n index % interstitialInterval === 0 &&\n index + interstitialInterval < searchItems.length &&\n index >= interstitialInterval\n ) {\n for (let n = 0; n < interstitialQuantity; n++) {\n itemsToRender.push(\n <searchcraft-ad adSource='Custom' key={`${item.id}-ad-${n}`} />,\n );\n }\n }\n itemsToRender.push(\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />,\n );\n });\n\n // Renders ads at end\n for (let n = 0; n < adEndQuantity; n++) {\n itemsToRender.push(<searchcraft-ad adSource='Custom' key={`${n}-ad`} />);\n }\n\n return (\n <div class='searchcraft-search-results-container'>{itemsToRender}</div>\n );\n }\n\n renderWithNoAds() {\n return (\n <div class='searchcraft-search-results-container'>\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n </div>\n );\n }\n\n render() {\n if (this.searchTerm.trim() === '') {\n return this.renderEmptyState();\n }\n\n if (\n this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0 &&\n !this.isSearchInProgress\n ) {\n return this.renderNoResultsFoundState();\n }\n\n switch (this.config?.adSource || 'None') {\n case 'adMarketplace':\n return this.renderWithADMAds();\n case 'Custom':\n return this.renderWithCustomAds();\n default:\n return this.renderWithNoAds();\n }\n }\n}\n"],"version":3}
1
+ {"file":"searchcraft-base-search-results.js","mappings":";;;;;;;MAiDaA,8BAA4B;;;;;;;;IAI/B,sBAAsB,CAEa;;;;IAInC,oBAAoB,CAAwB;;;;IAI5C,oBAAoB,GAAqB,OAAO,CAAC;;;;IAIjD,WAAW,CAAU;;;;IAIrB,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAA0C;;;;IAInD,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAA0C;IAErD,UAAU,GAAG,EAAE,CAAC;IAChB,yBAAyB,GAA+B,EAAE,CAAC;IAC3D,qBAAqB,GAA2B,EAAE,CAAC;IACnD,oBAAoB,CAAC;IACrB,iBAAiB,CAAC;IAClB,kBAAkB,GAAG,KAAK,CAAC;IAC3B,MAAM,CAAqB;IAE5B,WAAW,GAAe,SAAQ,CAAC;IAE3C,IAAI,gBAAgB;QAClB,IAAI,gBAAgB,GAAG,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,gBAAgB;gBACd,OAAO,IAAI,CAAC,sBAAsB,KAAK,QAAQ;sBAC3C,IAAI,CAAC,sBAAsB;sBAC3B,eAAe,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;SACpD;QACD,OAAO,gBAAgB,CAAC;KACzB;IAED,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,S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E,GAAG,EAAE,IAAI,CAAC,EAAE,mBACG,IAAI,CAAC,gBAAgB,qBACnB,IAAI,CAAC,oBAAoB,mBAC3B,IAAI,CAAC,YAAY,sBACd,IAAI,CAAC,eAAe,kBACxB,IAAI,CAAC,WAAW,IAAI,WAAW,gBACjC,IAAI,CAAC,SAAS,mBACX,IAAI,CAAC,YAAY,uBAE9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,GAAG,KAAK,EAE5D,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAC/C,IAAI,EAAE,IAAI,GACV,CACH,CAAC,CACE,EACN;KACH;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACjC,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAChC;QAED,IACE,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;YAC1B,IAAI,CAAC,yBAAyB,CAAC,MAAM,KAAK,CAAC;YAC3C,CAAC,IAAI,CAAC,kBAAkB,EACxB;YACA,OAAO,IAAI,CAAC,yBAAyB,EAAE,CAAC;SACzC;QAED,QAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,IAAI,MAAM;YACrC,KAAK,eAAe;gBAClB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACjC,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpC;gBACE,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;SACjC;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftBaseSearchResults"],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":["import { Component, h, Prop, State, type JSX } from '@stencil/core';\n\nimport type {\n AdClientResponseItem,\n SearchClientResponseItem,\n SearchcraftConfig,\n} from '@searchcraft/core';\n\nimport { type SearchcraftState, searchcraftStore } from '@store';\n\nimport { serializeStyles } from '@utils';\nimport type { SearchResultMappings } from '@searchcraft/core';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults?:\n | string\n | Record<string, Record<string, string>>;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings?: SearchResultMappings;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel?: string;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel?: 'noreferrer' | 'noopener' | 'nofollow';\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel?: 'noreferrer' | 'noopener' | 'nofollow';\n\n @State() searchTerm = '';\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchResultsPerPage;\n @State() searchResultsPage;\n @State() isSearchInProgress = false;\n @State() config?: SearchcraftConfig;\n\n private unsubscribe: () => void = () => {};\n\n get serializedStyles(): string {\n let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\n return serializedStyles;\n }\n\n componentDidLoad() {\n this.unsubscribe = searchcraftStore.subscribe((state) =>\n this.handleStateChange(state),\n );\n const currentState = searchcraftStore.getState();\n this.searchClientResponseItems = currentState.searchClientResponseItems;\n this.searchTerm = currentState.searchTerm;\n this.config = currentState.core?.config;\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleStateChange(state: SearchcraftState) {\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n this.config = state.core?.config;\n this.isSearchInProgress = state.isSearchInProgress;\n }\n\n renderEmptyState() {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n renderNoResultsFoundState() {\n return (\n <div class='searchcraft-search-results-container'>\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.searchTerm}\" query`}\n />\n </div>\n </div>\n );\n }\n\n renderWithADMAds() {\n return (\n <div class='searchcraft-search-results-container'>\n {this.adClientResponseItems?.map((item) => (\n <searchcraft-ad\n adSource='adMarketplace'\n adClientResponseItem={item}\n key={item.id}\n />\n ))}\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n </div>\n );\n }\n\n renderWithCustomAds() {\n const itemsToRender: JSX.Element[] = [];\n const interstitialInterval = this.config?.customAdInterstitialInterval || 0;\n const interstitialQuantity = this.config?.customAdInterstitialQuantity || 1;\n const adStartQuantity = this.config?.customAdStartQuantity || 0;\n const adEndQuantity = this.config?.customAdEndQuantity || 0;\n const searchItems = this.searchClientResponseItems || [];\n\n // Renders ads at beginning\n for (let n = 0; n < adStartQuantity; n++) {\n itemsToRender.push(<searchcraft-ad adSource='Custom' key={`${n}-ad`} />);\n }\n\n // Renders search results + interstitial ads\n searchItems.forEach((item, index) => {\n if (\n interstitialInterval &&\n index % interstitialInterval === 0 &&\n index + interstitialInterval < searchItems.length &&\n index >= interstitialInterval\n ) {\n for (let n = 0; n < interstitialQuantity; n++) {\n itemsToRender.push(\n <searchcraft-ad adSource='Custom' key={`${item.id}-ad-${n}`} />,\n );\n }\n }\n itemsToRender.push(\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />,\n );\n });\n\n // Renders ads at end\n for (let n = 0; n < adEndQuantity; n++) {\n itemsToRender.push(<searchcraft-ad adSource='Custom' key={`${n}-ad`} />);\n }\n\n return (\n <div class='searchcraft-search-results-container'>{itemsToRender}</div>\n );\n }\n\n renderWithNoAds() {\n return (\n <div class='searchcraft-search-results-container'>\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={this.serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n </div>\n );\n }\n\n render() {\n if (this.searchTerm.trim() === '') {\n return this.renderEmptyState();\n }\n\n if (\n this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0 &&\n !this.isSearchInProgress\n ) {\n return this.renderNoResultsFoundState();\n }\n\n switch (this.config?.adSource || 'None') {\n case 'adMarketplace':\n return this.renderWithADMAds();\n case 'Custom':\n return this.renderWithCustomAds();\n default:\n return this.renderWithNoAds();\n }\n }\n}\n"],"version":3}
@@ -26,8 +26,8 @@ const SearchcraftFilterPanel$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
26
26
  this.unsubscribe?.();
27
27
  }
28
28
  handleDateRangeChanged(fieldName, min, max) {
29
- const start = new Date(min);
30
- const end = new Date(max);
29
+ const start = new Date(new Date(min).getFullYear(), 0, 1);
30
+ const end = new Date(new Date(max).getFullYear() + 1, 0, 0);
31
31
  this.searchStore.addRangeValueForIndexField({
32
32
  fieldName,
33
33
  value: `${fieldName}:[${start.toISOString()} TO ${end.toISOString()}]`,
@@ -65,7 +65,7 @@ const SearchcraftFilterPanel$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
65
65
  * Iterate through `items` and render them based on `type`
66
66
  */
67
67
  render() {
68
- return (h("div", { key: 'a2860cc8afa3f1c3e8af38a6d040b75b2e414554', class: 'searchcraft-filter-panel' }, this.items.map((filterItem) => {
68
+ return (h("div", { key: '73ca2e0efab911c5095c23ba33e85a26cc440b4a', class: 'searchcraft-filter-panel' }, this.items.map((filterItem) => {
69
69
  switch (filterItem.type) {
70
70
  case 'dateRange': {
71
71
  const item = filterItem;
@@ -1 +1 @@
1
- {"file":"searchcraft-filter-panel.js","mappings":";;;;;;;MAwBaA,wBAAsB;;;;;;;;IAIzB,KAAK,GAAiB,EAAE,CAAC;IAExB,WAAW,CAA2B;IACtC,cAAc,CAAqB;IAEpC,WAAW,GAAG,gBAAgB,C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MAAM,IAAI,GAAG,UAAwC,CAAC;oBACtD,QACE,iCACE,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,eAAe,EAAE,CAAC,KAAK;4BACrB,IAAI,CAAC,6BAA6B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;yBAClD,GACD,EACF;iBACH;aACF;SACF,CAAC,CACE,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftFilterPanel"],"sources":["src/components/searchcraft-filter-panel/searchcraft-filter-panel.tsx"],"sourcesContent":["import { Component, h, Prop, State } from '@stencil/core';\nimport type {\n FilterItem,\n DateRangeFilterItem,\n NumericFilterItem,\n ExactMatchToggleFilterItem,\n FacetsFilterItem,\n} from '@searchcraft/core';\nimport { searchcraftStore } from '@store';\nimport { getMillis } from '@utils';\n\n/**\n * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-filter-panel />\n * ```\n */\n@Component({\n tag: 'searchcraft-filter-panel',\n shadow: false,\n})\nexport class SearchcraftFilterPanel {\n /**\n * The items to filter.\n */\n @Prop() items: FilterItem[] = [];\n\n @State() unsubscribe: (() => void) | undefined;\n @State() lastSearchTerm: string | undefined;\n\n private searchStore = searchcraftStore.getState();\n\n componentDidLoad() {\n this.unsubscribe = searchcraftStore.subscribe((state) => {\n if (this.lastSearchTerm !== state.searchTerm) {\n // A place to put actions to do when the query changes\n }\n this.lastSearchTerm = state.searchTerm || '';\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleDateRangeChanged(fieldName: string, min: number, max: number) {\n const start = new Date(min);\n const end = new Date(max);\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${start.toISOString()} TO ${end.toISOString()}]`,\n });\n\n this.searchStore.search();\n }\n\n handleNumericRangeChanged(fieldName: string, min: number, max: number) {\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${min} TO ${max}]`,\n });\n this.searchStore.search();\n }\n\n handleFacetSelectionUpdated(fieldName: string, paths: string[]) {\n if (paths.length > 0) {\n this.searchStore.addFacetPathsForIndexField({\n fieldName,\n value: `${fieldName}: IN [${paths.join(' ')}]`,\n });\n } else {\n this.searchStore.removeFacetPathsForIndexField(fieldName);\n }\n this.searchStore.search();\n }\n\n handleExactMatchToggleUpdated(isActive: boolean) {\n this.searchStore.setSearchMode(isActive ? 'exact' : 'fuzzy');\n this.searchStore.search();\n }\n\n handleMostRecentToggleUpdated(isActive: boolean) {\n this.searchStore.setSortType(isActive ? 'desc' : 'asc');\n this.searchStore.search();\n }\n\n /**\n * Iterate through `items` and render them based on `type`\n */\n render() {\n return (\n <div class='searchcraft-filter-panel'>\n {this.items.map((filterItem) => {\n switch (filterItem.type) {\n case 'dateRange': {\n const item = filterItem as DateRangeFilterItem;\n const min = new Date(item.options.minDate).getTime();\n const max = new Date(item.options.maxDate).getTime();\n const granularityValue = getMillis(item.options.granularity);\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={min}\n max={max}\n granularity={granularityValue}\n dataType='date'\n onRangeChanged={(event) => {\n this.handleDateRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'numericRange': {\n const item = filterItem as NumericFilterItem;\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={item.options.min}\n max={item.options.max}\n granularity={item.options.granularity}\n onRangeChanged={(event) => {\n this.handleNumericRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'facets': {\n const item = filterItem as FacetsFilterItem;\n // return \"filters-list\"\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-facet-list\n fieldName={item.fieldName}\n onFacetSelectionUpdated={(event) => {\n this.handleFacetSelectionUpdated(\n item.fieldName,\n event.detail.paths,\n );\n }}\n />\n </div>\n );\n }\n case 'exactMatchToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleExactMatchToggleUpdated(event.detail);\n }}\n />\n );\n }\n case 'mostRecentToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleMostRecentToggleUpdated(event.detail);\n }}\n />\n );\n }\n }\n })}\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"searchcraft-filter-panel.js","mappings":";;;;;;;MAwBaA,wBAAsB;;;;;;;;IAIzB,KAAK,GAAiB,EAAE,CAAC;IAExB,WAAW,CAA2B;IACtC,cAAc,CAAqB;IAEpC,WAAW,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IAElD,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,KAAK;YAIlD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC;SAC9C,CAAC,CAAC;KACJ;IAED,oBAAoB;QAClB,IAAI,CAAC,WAAW,IAAI,CAAC;KACtB;IAED,sBAAsB,CAAC,SAAiB,EAAE,GAAW,EAAE,GAAW;QAChE,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,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/components/searchcraft-filter-panel/searchcraft-filter-panel.tsx"],"sourcesContent":["import { Component, h, Prop, State } from '@stencil/core';\nimport type {\n FilterItem,\n DateRangeFilterItem,\n NumericFilterItem,\n ExactMatchToggleFilterItem,\n FacetsFilterItem,\n} from '@searchcraft/core';\nimport { searchcraftStore } from '@store';\nimport { getMillis } from '@utils';\n\n/**\n * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-filter-panel />\n * ```\n */\n@Component({\n tag: 'searchcraft-filter-panel',\n shadow: false,\n})\nexport class SearchcraftFilterPanel {\n /**\n * The items to filter.\n */\n @Prop() items: FilterItem[] = [];\n\n @State() unsubscribe: (() => void) | undefined;\n @State() lastSearchTerm: string | undefined;\n\n private searchStore = searchcraftStore.getState();\n\n componentDidLoad() {\n this.unsubscribe = searchcraftStore.subscribe((state) => {\n if (this.lastSearchTerm !== state.searchTerm) {\n // A place to put actions to do when the query changes\n }\n this.lastSearchTerm = state.searchTerm || '';\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleDateRangeChanged(fieldName: string, min: number, max: number) {\n const start = new Date(new Date(min).getFullYear(), 0, 1);\n const end = new Date(new Date(max).getFullYear() + 1, 0, 0);\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${start.toISOString()} TO ${end.toISOString()}]`,\n });\n\n this.searchStore.search();\n }\n\n handleNumericRangeChanged(fieldName: string, min: number, max: number) {\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${min} TO ${max}]`,\n });\n this.searchStore.search();\n }\n\n handleFacetSelectionUpdated(fieldName: string, paths: string[]) {\n if (paths.length > 0) {\n this.searchStore.addFacetPathsForIndexField({\n fieldName,\n value: `${fieldName}: IN [${paths.join(' ')}]`,\n });\n } else {\n this.searchStore.removeFacetPathsForIndexField(fieldName);\n }\n this.searchStore.search();\n }\n\n handleExactMatchToggleUpdated(isActive: boolean) {\n this.searchStore.setSearchMode(isActive ? 'exact' : 'fuzzy');\n this.searchStore.search();\n }\n\n handleMostRecentToggleUpdated(isActive: boolean) {\n this.searchStore.setSortType(isActive ? 'desc' : 'asc');\n this.searchStore.search();\n }\n\n /**\n * Iterate through `items` and render them based on `type`\n */\n render() {\n return (\n <div class='searchcraft-filter-panel'>\n {this.items.map((filterItem) => {\n switch (filterItem.type) {\n case 'dateRange': {\n const item = filterItem as DateRangeFilterItem;\n const min = new Date(item.options.minDate).getTime();\n const max = new Date(item.options.maxDate).getTime();\n const granularityValue = getMillis(item.options.granularity);\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={min}\n max={max}\n granularity={granularityValue}\n dataType='date'\n onRangeChanged={(event) => {\n this.handleDateRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'numericRange': {\n const item = filterItem as NumericFilterItem;\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={item.options.min}\n max={item.options.max}\n granularity={item.options.granularity}\n onRangeChanged={(event) => {\n this.handleNumericRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'facets': {\n const item = filterItem as FacetsFilterItem;\n // return \"filters-list\"\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-facet-list\n fieldName={item.fieldName}\n onFacetSelectionUpdated={(event) => {\n this.handleFacetSelectionUpdated(\n item.fieldName,\n event.detail.paths,\n );\n }}\n />\n </div>\n );\n }\n case 'exactMatchToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleExactMatchToggleUpdated(event.detail);\n }}\n />\n );\n }\n case 'mostRecentToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleMostRecentToggleUpdated(event.detail);\n }}\n />\n );\n }\n }\n })}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { S as SearchcraftInput, d as defineCustomElement$1 } from './p-3026f7d3.js';
1
+ import { S as SearchcraftInput, d as defineCustomElement$1 } from './p-5bd5c3cb.js';
2
2
 
3
3
  const SearchcraftInputForm = SearchcraftInput;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -4,7 +4,7 @@ import { s as searchcraftStore } from './p-6d8b0ead.js';
4
4
  import { d as defineCustomElement$8 } from './p-05872320.js';
5
5
  import { d as defineCustomElement$7 } from './p-71cc28c1.js';
6
6
  import { d as defineCustomElement$6 } from './p-0e393fe1.js';
7
- import { d as defineCustomElement$5 } from './p-3026f7d3.js';
7
+ import { d as defineCustomElement$5 } from './p-5bd5c3cb.js';
8
8
  import { d as defineCustomElement$4 } from './p-e55a7970.js';
9
9
  import { d as defineCustomElement$3 } from './p-3568414f.js';
10
10
  import { d as defineCustomElement$2 } from './p-b0bc5cee.js';
@@ -1 +1 @@
1
- {"file":"searchcraft-popover-form.js","mappings":";;;;;;;;;;;MAsCaA,wBAAsB;;;;;;;;;;;;IAQzB,IAAI,GAAsC,QAAQ,CAAC;;;;IAInD,qBAAqB,CAAoC;;;;IAIzD,MAAM,GAAG,GAAG,CAAC;;;;IAIb,cAAc,GAAuC,MAAM,CAAC;IAE3D,uBAAuB,GAAG,KAAK,CAAC;IAChC,WAAW,CAA2B;IACtC,yBAAyB,GAA+B,EAAE,CAAC;IAC3D,qBAAqB,GAA2B,EAAE,CAAC;IACnD,UAAU,CAAqB;IAC/B,SAAS,GAAG,KAAK,CAAC;IAClB,YAAY,GAAG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EACzD,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EACjD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,GAC/C,CACH,CACG,CACF,EACN;SACH;KACF;IAED,MAAM;QACJ,QAAQ,IAAI,CAAC,IAAI;YACf,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpC,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACnC,KAAK,YAAY;gBACf,OAAO,IAAI,CAAC,uBAAuB,EAAE,CAAC;SACzC;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftPopoverForm"],"sources":["src/components/searchcraft-popover-form/searchcraft-popover-form.tsx"],"sourcesContent":["import { Component, Element, Prop, State, h } from '@stencil/core';\nimport classNames from 'classnames';\nimport type {\n SearchClientResponseItem,\n AdClientResponseItem,\n PopoverResultMappings,\n} from '@searchcraft/core';\n\nimport { searchcraftStore } from '@store';\n\n/**\n * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-form type=\"fullscreen\" />\n * ```\n *\n * ```js\n * // index.js\n * const popoverForm = document.querySelector('searchcraft-popover-form');\n *\n * popoverForm.popoverResultMappings = {\n * containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n * ```\n */\n@Component({\n tag: 'searchcraft-popover-form',\n shadow: false,\n})\nexport class SearchcraftPopoverForm {\n /**\n * The type of popover form to render.\n *\n * - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.\n * - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.\n * - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.\n */\n @Prop() type: 'inline' | 'fullscreen' | 'modal' = 'inline';\n /**\n * Formats the content rendered for each result.\n */\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n /**\n * The hotkey that activates the popover.\n */\n @Prop() hotkey = 'k';\n /**\n * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.\n */\n @Prop() hotkeyModifier: 'ctrl' | 'meta' | 'alt' | 'option' = 'meta';\n\n @State() isPopoverVisibleInState = false;\n @State() unsubscribe: (() => void) | undefined;\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchTerm: string | undefined;\n @State() isFocused = false;\n @State() breakpointSm = 576;\n @State() breakpointMd = 768;\n @State() breakpointLg = 992;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n\n @State() modalElement;\n\n @Element() hostElement!: HTMLElement;\n\n componentDidLoad() {\n // Loads the breakpoint values into state\n const computedStyle = getComputedStyle(document.documentElement);\n this.breakpointSm = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-sm').trim(),\n );\n this.breakpointMd = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-md').trim(),\n );\n this.breakpointLg = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-lg').trim(),\n );\n // Set popover visiblity in state\n this.isPopoverVisibleInState = searchcraftStore.getState().isPopoverVisible;\n\n // Add event listeners\n document.addEventListener('click', this.handleDocumentClick);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n\n // Subscribe to state events\n this.unsubscribe = searchcraftStore.subscribe((state) => {\n if (this.isPopoverVisibleInState !== state.isPopoverVisible) {\n this.handlePopoverVisibilityChange(state.isPopoverVisible);\n }\n\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n document.removeEventListener('click', this.handleDocumentClick);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n handleDocumentClick = (event: MouseEvent) => {\n if (!this.hostElement.contains(event.target as Node)) {\n this.isFocused = false;\n }\n };\n\n /**\n * Handles when popover visibility is changed in state\n */\n handlePopoverVisibilityChange(isVisible: boolean) {\n this.isPopoverVisibleInState = isVisible;\n document.body.style.overflow = isVisible ? 'hidden' : 'auto';\n }\n\n /**\n * Actions to perform when various keys are pressed within the popover form.\n */\n handleDocumentKeyDown = (event: KeyboardEvent) => {\n // Document-scoped actions\n if (event.key === this.hotkey) {\n this.handleHotkeyPressed(event);\n }\n\n // Document-scoped -> Popover-scoped keyboard event boundary\n if (!this.hostElement.contains(document.activeElement)) {\n return;\n }\n\n // Popover-scoped actions\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault();\n this.focusOnNextListItem(event.key);\n break;\n case 'Escape':\n searchcraftStore.getState().setPopoverVisibility(false);\n break;\n default:\n return;\n }\n };\n\n handleInputInit = () => {\n const input = this.hostElement.querySelector('.searchcraft-input') as\n | HTMLInputElement\n | undefined;\n input?.focus();\n };\n\n /**\n * When popover is `inline` and the viewport is at the smallest breakpoint,\n * focusing on the input will open a modal version of the popover form.\n */\n handleInputFocus() {\n this.isFocused = true;\n\n if (\n this.type === 'inline' &&\n window.visualViewport &&\n window.visualViewport.width < this.breakpointSm\n ) {\n searchcraftStore.getState().setPopoverVisibility(true);\n\n // Appends a popover form of type=`modal` to the body\n if (!this.modalElement) {\n this.modalElement = document.createElement('searchcraft-popover-form');\n this.modalElement.popoverResultMappings = this.popoverResultMappings;\n this.modalElement.setAttribute('type', 'fullscreen');\n document.body.appendChild(this.modalElement);\n }\n }\n }\n\n handleModalBackdropClick(_event: MouseEvent) {\n searchcraftStore.getState().setPopoverVisibility(false);\n }\n\n /**\n * When a hotkey is pressed, tests if the modifiers also match.\n * If modifiers match, toggles visibility of the popover modal.\n */\n handleHotkeyPressed(event: KeyboardEvent) {\n if (\n (event.ctrlKey && this.hotkeyModifier === 'ctrl') ||\n (event.altKey && this.hotkeyModifier === 'alt') ||\n (event.metaKey && this.hotkeyModifier === 'meta')\n ) {\n event.preventDefault();\n if (this.type === 'inline' && !this.isPopoverVisibleInState) {\n const hostElementInput = this.hostElement.querySelector(\n '.searchcraft-input',\n ) as HTMLInputElement | undefined;\n hostElementInput?.focus();\n } else {\n searchcraftStore\n .getState()\n .setPopoverVisibility(!this.isPopoverVisibleInState);\n }\n }\n }\n\n handleCancelButtonClick() {\n searchcraftStore.getState().setPopoverVisibility(false);\n }\n\n /**\n * Moves focus to the next/previous list item in the list view. If you are at the top\n * of the list view, it moves focus back to the input.\n *\n * @param direction\n */\n focusOnNextListItem(direction: 'ArrowDown' | 'ArrowUp') {\n const listItems = Array.from(\n document.querySelectorAll<HTMLAnchorElement>(\n 'a.searchcraft-popover-list-item',\n ),\n ).filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null);\n\n const currentIndex = listItems.indexOf(\n document.activeElement as HTMLAnchorElement,\n );\n\n if (direction === 'ArrowDown') {\n listItems[(currentIndex + 1) % listItems.length]?.focus();\n } else if (direction === 'ArrowUp') {\n if (currentIndex >= 1) {\n listItems[currentIndex - 1]?.focus();\n } else {\n const input = document.querySelector('.searchcraft-input') as\n | HTMLInputElement\n | undefined;\n\n if (input) {\n input.focus();\n requestAnimationFrame(() => {\n input.selectionEnd = input.value.length;\n input.selectionStart = input.value.length;\n });\n }\n }\n }\n }\n\n get hasResultsToShow() {\n return (\n this.searchTerm &&\n this.searchTerm?.trim()?.length > 0 &&\n this.searchClientResponseItems.length > 0\n );\n }\n\n renderInlinePopover() {\n const isListViewVisible = this.hasResultsToShow && this.isFocused;\n\n const popoverFormClassNames = classNames(\n 'searchcraft-popover-form searchcraft-popover-form-inline',\n {\n 'searchcraft-popover-form-active': isListViewVisible,\n },\n );\n\n return (\n <div class={popoverFormClassNames}>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n />\n {isListViewVisible && (\n <div class='searchcraft-popover-inline-wrapper-outer'>\n <div class='searchcraft-popover-inline-wrapper-inner'>\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n </div>\n </div>\n )}\n </div>\n );\n }\n\n renderModalPopover() {\n if (this.isPopoverVisibleInState) {\n const popoverFormClassNames = classNames('searchcraft-popover-form', {\n 'searchcraft-popover-form-active': this.hasResultsToShow,\n });\n\n return (\n <div class='searchcraft-popover-form-modal'>\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}\n <div\n class='searchcraft-popover-form-modal-backdrop'\n onClick={this.handleModalBackdropClick}\n />\n <div class='searchcraft-popover-form-modal-inner'>\n <div class={popoverFormClassNames}>\n <div class='searchcraft-popover-form-input-wrapper'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n )}\n </div>\n </div>\n </div>\n );\n }\n }\n\n renderFullscreenPopover() {\n if (this.isPopoverVisibleInState) {\n return (\n <div class='searchcraft-popover-form-fullscreen'>\n <div class='searchcraft-popover-form'>\n <div class='searchcraft-popover-form-input-wrapper'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n )}\n </div>\n </div>\n );\n }\n }\n\n render() {\n switch (this.type) {\n case 'inline':\n return this.renderInlinePopover();\n case 'modal':\n return this.renderModalPopover();\n case 'fullscreen':\n return this.renderFullscreenPopover();\n }\n }\n}\n"],"version":3}
1
+ {"file":"searchcraft-popover-form.js","mappings":";;;;;;;;;;;MAsCaA,wBAAsB;;;;;;;;;;;;IAQzB,IAAI,GAAsC,QAAQ,CAAC;;;;IAInD,qBAAqB,CAAyB;;;;IAI9C,MAAM,GAAG,GAAG,CAAC;;;;IAIb,cAAc,GAAuC,MAAM,CAAC;IAE3D,uBAAuB,GAAG,KAAK,CAAC;IAChC,WAAW,CAA2B;IACtC,yBAAyB,GAA+B,EAAE,CAAC;IAC3D,qBAAqB,GAA2B,EAAE,CAAC;IACnD,UAAU,CAAqB;IAC/B,SAAS,GAAG,KAAK,CAAC;IAClB,YAAY,GAAG,GAAG,CAAC;IACnB,YAAY,GAAG,GAAG,CAAC;IACnB,YAAY,GAAG,GAAG,CAAC;IACnB,iBAAiB,CAAC;IAClB,oBAAoB,CAAC;IAErB,YAAY,CAAC;;IAItB,gBAAgB;;QAEd,MAAM,aAAa,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QACjE,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CACnC,aAAa,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE,CAC5D,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CACnC,aAAa,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,IAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftPopoverForm"],"sources":["src/components/searchcraft-popover-form/searchcraft-popover-form.tsx"],"sourcesContent":["import { Component, Element, Prop, State, h } from '@stencil/core';\nimport classNames from 'classnames';\nimport type {\n SearchClientResponseItem,\n AdClientResponseItem,\n PopoverResultMappings,\n} from '@searchcraft/core';\n\nimport { searchcraftStore } from '@store';\n\n/**\n * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-form type=\"fullscreen\" />\n * ```\n *\n * ```js\n * // index.js\n * const popoverForm = document.querySelector('searchcraft-popover-form');\n *\n * popoverForm.popoverResultMappings = {\n * containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n * ```\n */\n@Component({\n tag: 'searchcraft-popover-form',\n shadow: false,\n})\nexport class SearchcraftPopoverForm {\n /**\n * The type of popover form to render.\n *\n * - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.\n * - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.\n * - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.\n */\n @Prop() type: 'inline' | 'fullscreen' | 'modal' = 'inline';\n /**\n * Formats the content rendered for each result.\n */\n @Prop() popoverResultMappings?: PopoverResultMappings;\n /**\n * The hotkey that activates the popover.\n */\n @Prop() hotkey = 'k';\n /**\n * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.\n */\n @Prop() hotkeyModifier: 'ctrl' | 'meta' | 'alt' | 'option' = 'meta';\n\n @State() isPopoverVisibleInState = false;\n @State() unsubscribe: (() => void) | undefined;\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchTerm: string | undefined;\n @State() isFocused = false;\n @State() breakpointSm = 576;\n @State() breakpointMd = 768;\n @State() breakpointLg = 992;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n\n @State() modalElement;\n\n @Element() hostElement!: HTMLElement;\n\n componentDidLoad() {\n // Loads the breakpoint values into state\n const computedStyle = getComputedStyle(document.documentElement);\n this.breakpointSm = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-sm').trim(),\n );\n this.breakpointMd = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-md').trim(),\n );\n this.breakpointLg = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-lg').trim(),\n );\n // Set popover visiblity in state\n this.isPopoverVisibleInState = searchcraftStore.getState().isPopoverVisible;\n\n // Add event listeners\n document.addEventListener('click', this.handleDocumentClick);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n\n // Subscribe to state events\n this.unsubscribe = searchcraftStore.subscribe((state) => {\n if (this.isPopoverVisibleInState !== state.isPopoverVisible) {\n this.handlePopoverVisibilityChange(state.isPopoverVisible);\n }\n\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n document.removeEventListener('click', this.handleDocumentClick);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n handleDocumentClick = (event: MouseEvent) => {\n if (!this.hostElement.contains(event.target as Node)) {\n this.isFocused = false;\n }\n };\n\n /**\n * Handles when popover visibility is changed in state\n */\n handlePopoverVisibilityChange(isVisible: boolean) {\n this.isPopoverVisibleInState = isVisible;\n document.body.style.overflow = isVisible ? 'hidden' : 'auto';\n }\n\n /**\n * Actions to perform when various keys are pressed within the popover form.\n */\n handleDocumentKeyDown = (event: KeyboardEvent) => {\n // Document-scoped actions\n if (event.key === this.hotkey) {\n this.handleHotkeyPressed(event);\n }\n\n // Document-scoped -> Popover-scoped keyboard event boundary\n if (!this.hostElement.contains(document.activeElement)) {\n return;\n }\n\n // Popover-scoped actions\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault();\n this.focusOnNextListItem(event.key);\n break;\n case 'Escape':\n searchcraftStore.getState().setPopoverVisibility(false);\n break;\n default:\n return;\n }\n };\n\n handleInputInit = () => {\n const input = this.hostElement.querySelector('.searchcraft-input') as\n | HTMLInputElement\n | undefined;\n input?.focus();\n };\n\n /**\n * When popover is `inline` and the viewport is at the smallest breakpoint,\n * focusing on the input will open a modal version of the popover form.\n */\n handleInputFocus() {\n this.isFocused = true;\n\n if (\n this.type === 'inline' &&\n window.visualViewport &&\n window.visualViewport.width < this.breakpointSm\n ) {\n searchcraftStore.getState().setPopoverVisibility(true);\n\n // Appends a popover form of type=`modal` to the body\n if (!this.modalElement) {\n this.modalElement = document.createElement('searchcraft-popover-form');\n this.modalElement.popoverResultMappings = this.popoverResultMappings;\n this.modalElement.setAttribute('type', 'fullscreen');\n document.body.appendChild(this.modalElement);\n }\n }\n }\n\n handleModalBackdropClick(_event: MouseEvent) {\n searchcraftStore.getState().setPopoverVisibility(false);\n }\n\n /**\n * When a hotkey is pressed, tests if the modifiers also match.\n * If modifiers match, toggles visibility of the popover modal.\n */\n handleHotkeyPressed(event: KeyboardEvent) {\n if (\n (event.ctrlKey && this.hotkeyModifier === 'ctrl') ||\n (event.altKey && this.hotkeyModifier === 'alt') ||\n (event.metaKey && this.hotkeyModifier === 'meta')\n ) {\n event.preventDefault();\n if (this.type === 'inline' && !this.isPopoverVisibleInState) {\n const hostElementInput = this.hostElement.querySelector(\n '.searchcraft-input',\n ) as HTMLInputElement | undefined;\n hostElementInput?.focus();\n } else {\n searchcraftStore\n .getState()\n .setPopoverVisibility(!this.isPopoverVisibleInState);\n }\n }\n }\n\n handleCancelButtonClick() {\n searchcraftStore.getState().setPopoverVisibility(false);\n }\n\n /**\n * Moves focus to the next/previous list item in the list view. If you are at the top\n * of the list view, it moves focus back to the input.\n *\n * @param direction\n */\n focusOnNextListItem(direction: 'ArrowDown' | 'ArrowUp') {\n const listItems = Array.from(\n document.querySelectorAll<HTMLAnchorElement>(\n 'a.searchcraft-popover-list-item',\n ),\n ).filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null);\n\n const currentIndex = listItems.indexOf(\n document.activeElement as HTMLAnchorElement,\n );\n\n if (direction === 'ArrowDown') {\n listItems[(currentIndex + 1) % listItems.length]?.focus();\n } else if (direction === 'ArrowUp') {\n if (currentIndex >= 1) {\n listItems[currentIndex - 1]?.focus();\n } else {\n const input = document.querySelector('.searchcraft-input') as\n | HTMLInputElement\n | undefined;\n\n if (input) {\n input.focus();\n requestAnimationFrame(() => {\n input.selectionEnd = input.value.length;\n input.selectionStart = input.value.length;\n });\n }\n }\n }\n }\n\n get hasResultsToShow() {\n return (\n this.searchTerm &&\n this.searchTerm?.trim()?.length > 0 &&\n this.searchClientResponseItems.length > 0\n );\n }\n\n renderInlinePopover() {\n const isListViewVisible = this.hasResultsToShow && this.isFocused;\n\n const popoverFormClassNames = classNames(\n 'searchcraft-popover-form searchcraft-popover-form-inline',\n {\n 'searchcraft-popover-form-active': isListViewVisible,\n },\n );\n\n return (\n <div class={popoverFormClassNames}>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n />\n {isListViewVisible && (\n <div class='searchcraft-popover-inline-wrapper-outer'>\n <div class='searchcraft-popover-inline-wrapper-inner'>\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n </div>\n </div>\n )}\n </div>\n );\n }\n\n renderModalPopover() {\n if (this.isPopoverVisibleInState) {\n const popoverFormClassNames = classNames('searchcraft-popover-form', {\n 'searchcraft-popover-form-active': this.hasResultsToShow,\n });\n\n return (\n <div class='searchcraft-popover-form-modal'>\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}\n <div\n class='searchcraft-popover-form-modal-backdrop'\n onClick={this.handleModalBackdropClick}\n />\n <div class='searchcraft-popover-form-modal-inner'>\n <div class={popoverFormClassNames}>\n <div class='searchcraft-popover-form-input-wrapper'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n )}\n </div>\n </div>\n </div>\n );\n }\n }\n\n renderFullscreenPopover() {\n if (this.isPopoverVisibleInState) {\n return (\n <div class='searchcraft-popover-form-fullscreen'>\n <div class='searchcraft-popover-form'>\n <div class='searchcraft-popover-form-input-wrapper'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n />\n )}\n </div>\n </div>\n );\n }\n }\n\n render() {\n switch (this.type) {\n case 'inline':\n return this.renderInlinePopover();\n case 'modal':\n return this.renderModalPopover();\n case 'fullscreen':\n return this.renderFullscreenPopover();\n }\n }\n}\n"],"version":3}
@@ -11,11 +11,11 @@ const SearchcraftTheme$1 = /*@__PURE__*/ proxyCustomElement(class SearchcraftThe
11
11
  /**
12
12
  * The name of the theme.
13
13
  */
14
- theme = 'light';
14
+ theme;
15
15
  /**
16
16
  * The custom theme configuration object.
17
17
  */
18
- customTheme = '[]';
18
+ customTheme;
19
19
  camelToKebab = (string) => {
20
20
  return string
21
21
  .replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`) // Convert uppercase letters to `-lowercase`
@@ -37,9 +37,9 @@ const SearchcraftTheme$1 = /*@__PURE__*/ proxyCustomElement(class SearchcraftThe
37
37
  }
38
38
  }
39
39
  // Add theme name to body
40
- document.body.dataset.theme = this.theme;
40
+ document.body.dataset.theme = this.theme || 'light';
41
41
  // Add CSS variables from customTheme configuration to document
42
- Object.entries(JSON.parse(this.customTheme)).map(([key, value]) => {
42
+ Object.entries(JSON.parse(this.customTheme || '[]')).map(([key, value]) => {
43
43
  document.documentElement.style.setProperty(`--${this.camelToKebab(key)}`, `${value}`);
44
44
  });
45
45
  }
@@ -1 +1 @@
1
- {"file":"searchcraft-theme.js","mappings":";;AAAA,eAAe,CAAC;AAChB;;MCgBaA,kBAAgB;;;;;;;;IAInB,KAAK,GAAG,OAAO,CAAC;;;;IAIhB,WAAW,GAAG,IAAI,CAAC;IAEnB,YAAY,GAAG,CAAC,MAAM;QAC5B,OAAO,MAAM;aACV,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,KAAK,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;aACvD,WAAW,EAAE,CAAC;KAClB,CAAC;IAEF,gBAAgB;;QAEd,MAAM,YAAY,GAChB,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC;YAC5C,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAClC,YAAY,CAAC,SAAS,GAAG,MAAM,CAAC;QAChC,YAAY,CAAC,EAAE,GAAG,mBAAmB,CAAC;QAEtC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;YAChC,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;aAClD;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;aAChC;SACF;;QAGD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;;QAGzC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC;YAC5D,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CACxC,KAAK,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,EAC7B,GAAG,KAAK,EAAE,CACX,CAAC;SACH,CAAC,CAAC;KACJ;IAED,MAAM;QACJ,OAAO;KACR;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftTheme"],"sources":["src/themes/hologram.css?raw","src/components/searchcraft-theme/searchcraft-theme.tsx"],"sourcesContent":["export default `:root{--sc-text-base-size: 1em;--sc-text-scale-ratio: 1.1;--sc-font-family: sans-serif;--sc-font-bold: 700;--sc-font-normal: 400;--sc-heading-1-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-2-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-3-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-4-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-5-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-6-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) );--sc-body-font-size: calc(var(--sc-text-base-size));--sc-body-small-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) )}:root{--sc-border-radius: 8px;--sc-border-radius-sm: calc(var(--sc-border-radius) / 2);--sc-border-radius-lg: calc(var(--sc-border-radius) * 2)}:root{--sc-breakpoint-sm: 576px;--sc-breakpoint-md: 768px;--sc-breakpoint-lg: 992px}:root{--sc-surface-neutral-primary: var(--sc-color-background, #ffffff);--sc-color-background-hover: hsl( from var(--sc-color-background) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-primary-hover: var(--sc-color-background-hover, #fafafa);--sc-color-background-active: hsl( from var(--sc-color-background) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-primary-active: var( --sc-color-background-active, #f7f7f7 );--sc-surface-neutral-secondary: var( --sc-color-background-secondary, var(--sc-color-background, #f3f3f3) );--sc-surface-neutral-secondary-hover: var( --sc-color-background-secondary-hover, var(--sc-color-background-hover, #e6e6e6) );--sc-surface-neutral-secondary-active: var( --sc-color-background-secondary-active, var(--sc-color-background-active, #e0e0e0) );--sc-surface-neutral-light: #ffffff;--sc-content-neutral-primary: var(--sc-color-foreground, #292929);--sc-color-foreground-secondary: hsl( from var(--sc-color-foreground) h s clamp(10, calc(l + 5), 90) );--sc-content-neutral-secondary: var(--sc-color-foreground-secondary, #404040);--sc-border-neutral: rgba(0, 0, 0, 0.1);--sc-surface-brand-primary: var(--sc-color-brand, #000000);--sc-color-brand-hover: hsl( from var(--sc-color-brand) h s clamp(20, calc(l + 5), 95) );--sc-surface-brand-primary-hover: var(--sc-color-brand-hover, #2e2e2e);--sc-color-brand-active: hsl( from var(--sc-color-brand) h s clamp(10, calc(l - 5), 85) );--sc-surface-brand-primary-active: var(--sc-color-brand-active, #292929);--sc-surface-brand-secondary: var( --sc-color-brand-secondary, var(--sc-color-brand, #e6e6e6) );--sc-surface-brand-secondary-hover: var( --sc-color-brand-secondary-hover, var(--sc-color-brand-hover, #ebebeb) );--sc-surface-brand-secondary-active: var( --sc-color-brand-secondary-active, var(--sc-color-brand-active, #e0e0e0) );--sc-content-brand: var( --sc-color-brand-text, var(--sc-surface-brand-primary) );--sc-content-brand-on-primary: #ffffff;--sc-border-brand: var(--sc-surface-brand-primary);--sc-surface-success-primary: var(--sc-color-success, #008000);--sc-color-success-primary-hover: hsl(from var(--sc-color-success) h s 30);--sc-surface-success-primary-hover: var( --sc-color-success-primary-hover, #009900 );--sc-color-success-primary-active: hsl(from var(--sc-color-success) h s 20);--sc-surface-success-primary-active: var( --sc-color-success-primary-active, #006600 );--sc-color-success-secondary: hsl(from var(--sc-color-success) h s 90);--sc-surface-success-secondary: var(--sc-color-success-secondary, #ccffcc);--sc-color-success-secondary-hover: hsl( from var(--sc-color-success-secondary) h s 95 );--sc-surface-success-secondary-hover: var( --sc-color-success-secondary-hover, #e6ffe6 );--sc-color-success-secondary-active: hsl( from var(--sc-color-success-secondary) h s 85 );--sc-surface-success-secondary-active: var( --sc-color-success-secondary-active, #b2ffb2 );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30) );--sc-content-success-on-primary: #ffffff;--sc-border-success: var(--sc-surface-success-primary);--sc-surface-caution-primary: var(--sc-color-caution, #cc6600);--sc-color-caution-primary-hover: hsl(from var(--sc-color-caution) h s 30);--sc-surface-caution-primary-hover: var( --sc-color-caution-primary-hover, #e57300 );--sc-color-caution-primary-active: hsl(from var(--sc-color-caution) h s 20);--sc-surface-caution-primary-active: var( --sc-color-caution-primary-active, #b25a00 );--sc-color-caution-secondary: hsl(from var(--sc-color-caution) h s 90);--sc-surface-caution-secondary: var(--sc-color-caution-secondary, #ffd9b3);--sc-color-caution-secondary-hover: hsl( from var(--sc-color-caution-secondary) h s 95 );--sc-surface-caution-secondary-hover: var( --sc-color-caution-secondary-hover, #ffe5cc );--sc-color-caution-secondary-active: hsl( from var(--sc-color-caution-secondary) h s 85 );--sc-surface-caution-secondary-active: var( --sc-color-caution-secondary-active, #ffcc99 );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30) );--sc-content-caution-on-primary: #ffffff;--sc-border-caution: var(--sc-surface-caution-primary);--sc-surface-danger-primary: var(--sc-color-danger, #cc0000);--sc-color-danger-primary-hover: hsl(from var(--sc-color-danger) h s 30);--sc-surface-danger-primary-hover: var( --sc-color-danger-primary-hover, #e50000 );--sc-color-danger-primary-active: hsl(from var(--sc-color-danger) h s 20);--sc-surface-danger-primary-active: var( --sc-color-danger-primary-active, #b30000 );--sc-color-danger-secondary: hsl(from var(--sc-color-danger) h s 90);--sc-surface-danger-secondary: var(--sc-color-danger-secondary, #ffcccc);--sc-color-danger-secondary-hover: hsl( from var(--sc-color-danger-secondary) h s 95 );--sc-surface-danger-secondary-hover: var( --sc-color-danger-secondary-hover, #ffe7e7 );--sc-color-danger-secondary-active: hsl( from var(--sc-color-danger-secondary) h s 85 );--sc-surface-danger-secondary-active: var( --sc-color-danger-secondary-active, #ffb3b3 );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30) );--sc-content-danger-on-primary: #ffffff;--sc-border-danger: var(--sc-surface-danger-primary);--sc-color-disabled: hsl(from var(--sc-color-page-primary) h s calc(l * 0.5));--sc-surface-disabled: var(--sc-color-disabled, #d9d9d9);--sc-color-disabled-text: hsl( from var(--sc-color-text-primary) h s calc(l * 0.5) );--sc-content-disabled: var(--sc-color-disabled-text, #737373);--sc-content-disabled-on-disabled: var(--sc-color-disabled-text, #737373)}@supports(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none){:root{--sc-color-background-hover: hsl( from var(--sc-color-background) h s clamp(10%, calc(l + 5%), 95%) );--sc-color-background-active: hsl( from var(--sc-color-background) h s clamp(5%, calc(l - 5%), 90%) );--sc-color-foreground-secondary: hsl( from var(--sc-color-foreground) h s clamp(10%, calc(l + 5%), 90%) );--sc-color-brand-hover: hsl( from var(--sc-color-brand) h s clamp(20%, calc(l + 5%), 95%) );--sc-color-brand-active: hsl( from var(--sc-color-brand) h s clamp(10%, calc(l - 5%), 85%) );--sc-color-success-primary-hover: hsl(from var(--sc-color-success) h s 30%);--sc-color-success-primary-active: hsl( from var(--sc-color-success) h s 20% );--sc-color-success-secondary: hsl(from var(--sc-color-success) h s 90%);--sc-color-success-secondary-hover: hsl( from var(--sc-color-success-secondary) h s 95% );--sc-color-success-secondary-active: hsl( from var(--sc-color-success-secondary) h s 85% );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30%) );--sc-color-caution-primary-hover: hsl(from var(--sc-color-caution) h s 30%);--sc-color-caution-primary-active: hsl( from var(--sc-color-caution) h s 20% );--sc-color-caution-secondary: hsl(from var(--sc-color-caution) h s 90%);--sc-color-caution-secondary-hover: hsl( from var(--sc-color-caution-secondary) h s 95% );--sc-color-caution-secondary-active: hsl( from var(--sc-color-caution-secondary) h s 85% );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30%) );--sc-color-danger-primary-hover: hsl(from var(--sc-color-danger) h s 30%);--sc-color-danger-primary-active: hsl(from var(--sc-color-danger) h s 20%);--sc-color-danger-secondary: hsl(from var(--sc-color-danger) h s 90%);--sc-color-danger-secondary-hover: hsl( from var(--sc-color-danger-secondary) h s 95% );--sc-color-danger-secondary-active: hsl( from var(--sc-color-danger-secondary) h s 85% );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30%) )}}.searchcraft-custom-ad{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-adm-ad{all:unset;display:flex;flex-direction:row;cursor:pointer;gap:8px;padding-right:var(--sc-popover-list-item-padding-horizontal);padding-left:var(--sc-popover-list-item-padding-horizontal);padding-top:var(--sc-popover-list-item-padding-vertical);padding-bottom:var(--sc-popover-list-item-padding-vertical);border:1px solid blue}.searchcraft-adm-ad:focus{background-color:var(--sc-surface-neutral-secondary-active);color:var(--sc-content-neutral-secondary)}.searchcraft-adm-ad:hover{background-color:var(--sc-surface-neutral-secondary-hover);color:var(--sc-content-neutral-secondary)}.searchcraft-adm-ad-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);margin:0;color:inherit}.searchcraft-adm-ad-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);margin:0;color:inherit}.searchcraft-adm-ad-image-wrapper{width:var(--sc-popover-list-item-image-size);height:var(--sc-popover-list-item-image-size);display:flex;align-items:center;justify-content:center;flex-shrink:0}.searchcraft-adm-ad-image{max-width:var(--sc-popover-list-item-image-size);max-height:var(--sc-popover-list-item-image-size)}.searchcraft-adm-ad-info-wrapper{display:flex;flex-direction:column;gap:8px;justify-content:center}.searchcraft-search-result-container{all:unset;align-items:flex-start;border-radius:var(--sc-border-radius-lg);display:flex;flex-direction:column;gap:16px;padding:8px;color:inherit;background-color:var(--sc-surface-neutral-primary)}@media(min-width: 768px){.searchcraft-search-result-container{flex-direction:row}}a.searchcraft-search-result-container{cursor:pointer;transition:background-color 100ms}.searchcraft-base-search-result-content-container{flex:1;display:flex;flex-direction:column;gap:8px}.searchcraft-search-result-image{border-radius:calc(--sc-border-radius-lg - 8px);border-radius:calc(var(--sc-border-radius-lg) - 8px);width:100%}@media(min-width: 768px){.searchcraft-search-result-image{width:200px}}.searchcraft-base-search-result-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin:0}.searchcraft-base-search-result-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-disabled);margin:0}.searchcraft-base-search-result-body-content{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-neutral-secondary);margin:0}.searchcraft-base-search-result-footer-content{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-disabled);margin:0}.searchcraft-search-results-container{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-results-empty-state-container{text-align:center}.searchcraft-search-results-error-message-container{text-align:center}.searchcraft-button{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);background:none;border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;gap:4px;padding:12px;position:relative}.searchcraft-button.searchcraft-button-disabled{cursor:not-allowed}.searchcraft-button-primary{background-color:var(--sc-surface-brand-primary);color:var(--sc-content-brand-on-primary);font-weight:var(--sc-font-bold)}.searchcraft-button-primary:hover{background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button-primary:focus{border-color:var(--sc-border-primary)}.searchcraft-button-primary:active{background-color:var(--sc-surface-brand-primary-active)}.searchcraft-button-primary.searchcraft-button-disabled,.searchcraft-button-primary.searchcraft-button-disabled:hover,.searchcraft-button-primary.searchcraft-button-disabled:focus,.searchcraft-button-primary.searchcraft-button-disabled:active{background-color:var(--sc-surface-disabled);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-tertiary{background-color:var(--sc-surface-neutral-primary);color:var(--sc-content-brand);font-weight:var(--sc-font-normal)}.searchcraft-button-tertiary:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-button-tertiary:focus{background-color:var(--sc-surface-neutral-light);border-color:var(--sc-border-primary)}.searchcraft-button-tertiary:active{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-button-tertiary.searchcraft-button-disabled,.searchcraft-button-tertiary.searchcraft-button-disabled:hover,.searchcraft-button-tertiary.searchcraft-button-disabled:focus,.searchcraft-button-tertiary.searchcraft-button-disabled:active{background-color:var(--sc-surface-neutral-light);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-error-message{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-danger);margin:0}.filtersListContainer{width:100%}.filterCheckboxLabel{align-items:center;color:var(--sc-content-brand);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.filterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.filterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.filterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.filterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.filterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.childFilterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:12px;margin-left:24px;position:relative}.childFilterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childFilterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.childFilterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.childFilterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childFilterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}.searchcraft-facet-message{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-disabled);text-align:center}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-bold)}:root{--sc-input-border-radius: var(--sc-border-radius);--sc-input-search-icon-size: 20px;--sc-input-clear-icon-size: 20px;--sc-input-padding-left: 44px;--sc-input-padding-right: 44px}.searchcraft-input-grid{display:grid;gap:4px 8px}.searchcraft-input-grid-buttonLeft{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-grid-buttonLeft .searchcraft-input-button-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-label-wrapper{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-error-wrapper{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonRight{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-grid-buttonRight .searchcraft-input-button-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-label-wrapper{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-error-wrapper{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonNone{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-grid-buttonNone .searchcraft-input-button-wrapper{display:none}.searchcraft-input-grid-buttonNone .searchcraft-input-label-wrapper{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonNone .searchcraft-input-error-wrapper{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonNone .searchcraft-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-wrapper{position:relative;display:flex}.searchcraft-input{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-border-radius);border:none;color:var(--sc-content-neutral-primary);outline:none;padding-left:var(--sc-input-padding-left);padding-right:var(--sc-input-padding-right);padding-top:12px;padding-bottom:12px;flex:1}.searchcraft-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input:focus{outline:var(--sc-border-brand) solid 2px}.searchcraft-input:focus::placeholder{opacity:0}.searchcraft-input.error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input.error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-search-icon-wrapper{align-items:center;justify-content:center;display:flex;position:absolute;pointer-events:none;bottom:0;left:0;top:0;width:var(--sc-input-padding-left)}.searchcraft-input-search-icon{pointer-events:none;width:var(--sc-input-search-icon-size);height:var(--sc-input-search-icon-size);color:var(--sc-content-neutral-secondary)}.searchcraft-input-clear-button{all:unset;align-items:center;justify-content:center;cursor:pointer;display:flex;position:absolute;border:none;outline:none;bottom:0;right:0;top:0;width:var(--sc-input-padding-right)}.searchcraft-input-clear-icon{width:var(--sc-input-clear-icon-size);height:var(--sc-input-clear-icon-size);color:var(--sc-content-brand)}.searchcraft-input-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin-top:4px;margin-bottom:4px}:root{--sc-popover-form-border-radius: var(--sc-border-radius);--sc-popover-list-view-height: 400px;--sc-popover-list-item-image-size: 60px;--sc-popover-list-item-padding-horizontal: 8px;--sc-popover-list-item-padding-vertical: 8px;--sc-popover-modal-max-width: 570px}.searchcraft-popover-form{display:flex;flex-direction:column;flex:1}.searchcraft-popover-form .searchcraft-popover-form-input-wrapper{padding:12px;background-color:var(--sc-surface-neutral-secondary);display:flex;flex-direction:row;gap:4px}.searchcraft-popover-form .searchcraft-popover-form-input-wrapper>searchcraft-input-form{flex:1}.searchcraft-popover-form .searchcraft-popover-form-cancel-button{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);border:0;outline:0;padding:0;flex-shrink:0;background:none;cursor:pointer;padding-left:12px;padding-right:12px}.searchcraft-popover-form .searchcraft-popover-form-cancel-button:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-popover-form .searchcraft-popover-form-cancel-button:focus{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-popover-form-inline .searchcraft-input{border-top-left-radius:var(--sc-popover-form-border-radius);border-top-right-radius:var(--sc-popover-form-border-radius);border-bottom-left-radius:var(--sc-popover-form-border-radius);border-bottom-right-radius:var(--sc-popover-form-border-radius);border:none;outline:none}.searchcraft-popover-form-inline.searchcraft-popover-form-active .searchcraft-input{border-top-left-radius:var(--sc-popover-form-border-radius);border-top-right-radius:var(--sc-popover-form-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.searchcraft-popover-form-inline .searchcraft-popover-inline-wrapper-outer{position:relative}.searchcraft-popover-form-inline .searchcraft-popover-inline-wrapper-inner{position:absolute;height:var(--sc-popover-list-view-height);z-index:1000;width:100%}.searchcraft-popover-form-inline .searchcraft-popover-list-view{display:flex;flex-direction:column;overflow:auto;background-color:var(--sc-surface-neutral-secondary);border-bottom-left-radius:var(--sc-popover-form-border-radius);border-bottom-right-radius:var(--sc-popover-form-border-radius);max-height:var(--sc-popover-list-view-height)}.searchcraft-popover-form-modal{position:fixed;inset:0;z-index:1000;display:flex;align-items:flex-start;justify-content:center;padding:0;background-color:var(--sc-surface-neutral-secondary)}@media(min-width: 576px){.searchcraft-popover-form-modal{padding:16px;background-color:rgba(0,0,0,0)}}.searchcraft-popover-form-modal .searchcraft-input{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);outline-width:1px;outline-color:var(--sc-border-neutral)}.searchcraft-popover-form-modal .searchcraft-popover-form-modal-backdrop{position:absolute;inset:0;background-color:rgba(0,0,0,.5);display:none}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-form-modal-backdrop{display:block}}.searchcraft-popover-form-modal .searchcraft-popover-form-modal-inner{position:absolute;inset:0;z-index:1002;margin-top:0px;display:flex;border-radius:var(--sc-popover-form-border-radius);overflow:hidden}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-form-modal-inner{inset:auto;position:relative;width:100%;margin-top:100px;max-width:var(--sc-popover-modal-max-width)}}.searchcraft-popover-form-modal .searchcraft-popover-list-view{display:flex;flex-direction:column;overflow:auto;background-color:var(--sc-surface-neutral-secondary);border-bottom-left-radius:0;border-bottom-right-radius:0}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-list-view{max-height:var(--sc-popover-list-view-height)}}.searchcraft-popover-form-modal searchcraft-popover-list-view{overflow:scroll}@media(min-width: 576px){.searchcraft-popover-form-modal searchcraft-popover-list-view{overflow:auto}}.searchcraft-popover-form-fullscreen{position:fixed;inset:0;z-index:1000;background-color:var(--sc-surface-neutral-secondary)}.searchcraft-popover-form-fullscreen .searchcraft-popover-form{position:absolute;inset:0}.searchcraft-popover-form-fullscreen .searchcraft-input{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);outline-width:1px;outline-color:var(--sc-border-neutral)}.searchcraft-popover-form-fullscreen searchcraft-popover-list-view{overflow:scroll}.searchcraft-popover-list-item{all:unset;color:var(--sc-content-neutral-secondary);display:flex;flex-direction:row;cursor:pointer;gap:8px;padding-right:var(--sc-popover-list-item-padding-horizontal);padding-left:var(--sc-popover-list-item-padding-horizontal);padding-top:var(--sc-popover-list-item-padding-vertical);padding-bottom:var(--sc-popover-list-item-padding-vertical)}.searchcraft-popover-list-item:focus{background-color:var(--sc-surface-neutral-secondary-active);color:var(--sc-content-neutral-secondary)}.searchcraft-popover-list-item:hover{background-color:var(--sc-surface-neutral-secondary-hover);color:var(--sc-content-neutral-secondary)}.searchcraft-popover-list-item-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);margin:0;color:inherit}.searchcraft-popover-list-item-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);margin:0;color:inherit}.searchcraft-popover-list-item-image-wrapper{width:var(--sc-popover-list-item-image-size);height:var(--sc-popover-list-item-image-size);display:flex;align-items:center;justify-content:center;flex-shrink:0}.searchcraft-popover-list-item-image{max-width:var(--sc-popover-list-item-image-size);max-height:var(--sc-popover-list-item-image-size)}.searchcraft-popover-list-item-info-wrapper{display:flex;flex-direction:column;gap:8px;justify-content:center}.searchcraft-results-info{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-primary);margin:0}.searchcraft-slider-container{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%}.searchcraft-slider-range-container{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range-container::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range-container .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-input{appearance:none;background:rgba(0,0,0,0);border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range-container .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px;-webkit-appearance:none}.searchcraft-slider-range-container .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px}.searchcraft-slider-label-container{color:var(--sc-content-primary);display:flex;font-family:\"Source Sans Pro\",sans-serif;font-size:15px;font-weight:600;justify-content:space-between;margin-top:10px;width:100%}.searchcraft-slider-label{min-width:30px;text-align:center}.searchcraft-toggle-button-container{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);margin:0;color:var(--sc-content-neutral-primary)}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);margin:0;color:var(--sc-content-neutral-secondary)}.searchcraft-toggle-button-background{transition:background-color .2s;background:var(--sc-surface-disabled);border:none;border-radius:16px;cursor:pointer;height:26px;position:relative;width:44px;flex-shrink:0}.searchcraft-toggle-button-background.active{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0,0,0,.05)}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform .3s ease;width:18px}.searchcraft-toggle-button-handle.active{transform:translateX(16px)}.searchcraft-pagination{display:inline-grid;gap:16px;grid-template-columns:repeat(3, auto);grid-template-rows:1fr}.searchcraft-pagination-list{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius);display:flex;list-style-type:none;margin:0;overflow:hidden;padding:0;width:auto}.searchcraft-pagination-list li{border-right:1px solid var(--sc-border-neutral);height:100%;min-height:44px;width:44px}.searchcraft-pagination-list li:last-child{border-right:none}.searchcraft-pagination-item{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);align-items:center;background-color:var(--sc-surface-neutral-primary);border:none;display:flex;height:100%;justify-content:center;width:100%}.searchcraft-pagination-item-active{background-color:var(--sc-surface-brand-secondary);font-weight:var(--sc-font-bold)}.searchcraft-pagination-control{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius)}.searchcraft-pagination-range{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);align-items:center;display:flex}.searchcraft-select{display:flex;flex-direction:column;gap:4px}.searchcraft-select-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-bold)}.searchcraft-select-input-wrapper{position:relative}.searchcraft-select-input{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);appearance:none;background-color:var(--sc-surface-neutral-secondary);border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;height:44px;padding:0 44px 0 16px;width:100%}.searchcraft-select-input:hover{background-color:var(--sc-surface-neutral-secondary-hover)}.searchcraft-select-input:active{background-color:var(--sc-surface-neutral-secondary-active)}.searchcraft-select-input:focus{border-color:var(--sc-border-brand);outline:none}.searchcraft-select-input-icon{pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.searchcraft-select-caption{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size)}.searchcraft-search-results-per-page{display:flex}.searchcraft-search-results-per-page-select{align-items:center;display:flex;gap:12px}.searchcraft-search-results-per-page-select-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-search-results-per-page-select-input{min-width:120px}/*# sourceMappingURL=hologram.css.map */\n`","import { Component, Prop } from '@stencil/core';\nimport styles from '../../themes/hologram.css?raw';\n\n/**\n * This web component adds Searchcraft's built-in css theme to your page's <head> tag.\n * It does not render anything visible, its only function is to manage the css styles on the page.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-theme theme=\"light\" custom-theme=\"{}\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-theme',\n shadow: false,\n})\nexport class SearchcraftTheme {\n /**\n * The name of the theme.\n */\n @Prop() theme = 'light';\n /**\n * The custom theme configuration object.\n */\n @Prop() customTheme = '[]';\n\n private camelToKebab = (string) => {\n return string\n .replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`) // Convert uppercase letters to `-lowercase`\n .toLowerCase(); // Ensure the whole string is in lowercase\n };\n\n componentDidLoad() {\n // Inject style element\n const styleElement =\n document.querySelector('#searchcraft-theme') ||\n document.createElement('style');\n styleElement.innerHTML = styles;\n styleElement.id = 'searchcraft-theme';\n\n const head = document.head || document.getElementsByTagName('head')[0];\n\n if (!head.contains(styleElement)) {\n if (head.firstChild) {\n head.insertBefore(styleElement, head.firstChild);\n } else {\n head.appendChild(styleElement);\n }\n }\n\n // Add theme name to body\n document.body.dataset.theme = this.theme;\n\n // Add CSS variables from customTheme configuration to document\n Object.entries(JSON.parse(this.customTheme)).map(([key, value]) => {\n document.documentElement.style.setProperty(\n `--${this.camelToKebab(key)}`,\n `${value}`,\n );\n });\n }\n\n render() {\n return;\n }\n}\n"],"version":3}
1
+ {"file":"searchcraft-theme.js","mappings":";;AAAA,eAAe,CAAC;AAChB;;MCgBaA,kBAAgB;;;;;;;;IAInB,KAAK,CAAU;;;;IAIf,WAAW,CAAU;IAErB,YAAY,GAAG,CAAC,MAAM;QAC5B,OAAO,MAAM;aACV,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,KAAK,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;aACvD,WAAW,EAAE,CAAC;KAClB,CAAC;IAEF,gBAAgB;;QAEd,MAAM,YAAY,GAChB,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC;YAC5C,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAClC,YAAY,CAAC,SAAS,GAAG,MAAM,CAAC;QAChC,YAAY,CAAC,EAAE,GAAG,mBAAmB,CAAC;QAEtC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;YAChC,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;aAClD;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;aAChC;SACF;;QAGD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC;;QAGpD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC;YACpE,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CACxC,KAAK,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,EAC7B,GAAG,KAAK,EAAE,CACX,CAAC;SACH,CAAC,CAAC;KACJ;IAED,MAAM;QACJ,OAAO;KACR;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftTheme"],"sources":["src/themes/hologram.css?raw","src/components/searchcraft-theme/searchcraft-theme.tsx"],"sourcesContent":["export default `:root{--sc-text-base-size: 1em;--sc-text-scale-ratio: 1.1;--sc-font-family: sans-serif;--sc-font-bold: 700;--sc-font-normal: 400;--sc-heading-1-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-2-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-3-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-4-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-5-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-6-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) );--sc-body-font-size: calc(var(--sc-text-base-size));--sc-body-small-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) )}:root{--sc-border-radius: 8px;--sc-border-radius-sm: calc(var(--sc-border-radius) / 2);--sc-border-radius-lg: calc(var(--sc-border-radius) * 2)}:root{--sc-breakpoint-sm: 576px;--sc-breakpoint-md: 768px;--sc-breakpoint-lg: 992px}:root{--sc-surface-neutral-primary: var(--sc-color-background, #ffffff);--sc-color-background-hover: hsl( from var(--sc-color-background) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-primary-hover: var(--sc-color-background-hover, #fafafa);--sc-color-background-active: hsl( from var(--sc-color-background) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-primary-active: var( --sc-color-background-active, #f7f7f7 );--sc-surface-neutral-secondary: var( --sc-color-background-secondary, var(--sc-color-background, #f3f3f3) );--sc-surface-neutral-secondary-hover: var( --sc-color-background-secondary-hover, var(--sc-color-background-hover, #e6e6e6) );--sc-surface-neutral-secondary-active: var( --sc-color-background-secondary-active, var(--sc-color-background-active, #e0e0e0) );--sc-surface-neutral-light: #ffffff;--sc-content-neutral-primary: var(--sc-color-foreground, #292929);--sc-color-foreground-secondary: hsl( from var(--sc-color-foreground) h s clamp(10, calc(l + 5), 90) );--sc-content-neutral-secondary: var(--sc-color-foreground-secondary, #404040);--sc-border-neutral: rgba(0, 0, 0, 0.1);--sc-surface-brand-primary: var(--sc-color-brand, #000000);--sc-color-brand-hover: hsl( from var(--sc-color-brand) h s clamp(20, calc(l + 5), 95) );--sc-surface-brand-primary-hover: var(--sc-color-brand-hover, #2e2e2e);--sc-color-brand-active: hsl( from var(--sc-color-brand) h s clamp(10, calc(l - 5), 85) );--sc-surface-brand-primary-active: var(--sc-color-brand-active, #292929);--sc-surface-brand-secondary: var( --sc-color-brand-secondary, var(--sc-color-brand, #e6e6e6) );--sc-surface-brand-secondary-hover: var( --sc-color-brand-secondary-hover, var(--sc-color-brand-hover, #ebebeb) );--sc-surface-brand-secondary-active: var( --sc-color-brand-secondary-active, var(--sc-color-brand-active, #e0e0e0) );--sc-content-brand: var( --sc-color-brand-text, var(--sc-surface-brand-primary) );--sc-content-brand-on-primary: #ffffff;--sc-border-brand: var(--sc-surface-brand-primary);--sc-surface-success-primary: var(--sc-color-success, #008000);--sc-color-success-primary-hover: hsl(from var(--sc-color-success) h s 30);--sc-surface-success-primary-hover: var( --sc-color-success-primary-hover, #009900 );--sc-color-success-primary-active: hsl(from var(--sc-color-success) h s 20);--sc-surface-success-primary-active: var( --sc-color-success-primary-active, #006600 );--sc-color-success-secondary: hsl(from var(--sc-color-success) h s 90);--sc-surface-success-secondary: var(--sc-color-success-secondary, #ccffcc);--sc-color-success-secondary-hover: hsl( from var(--sc-color-success-secondary) h s 95 );--sc-surface-success-secondary-hover: var( --sc-color-success-secondary-hover, #e6ffe6 );--sc-color-success-secondary-active: hsl( from var(--sc-color-success-secondary) h s 85 );--sc-surface-success-secondary-active: var( --sc-color-success-secondary-active, #b2ffb2 );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30) );--sc-content-success-on-primary: #ffffff;--sc-border-success: var(--sc-surface-success-primary);--sc-surface-caution-primary: var(--sc-color-caution, #cc6600);--sc-color-caution-primary-hover: hsl(from var(--sc-color-caution) h s 30);--sc-surface-caution-primary-hover: var( --sc-color-caution-primary-hover, #e57300 );--sc-color-caution-primary-active: hsl(from var(--sc-color-caution) h s 20);--sc-surface-caution-primary-active: var( --sc-color-caution-primary-active, #b25a00 );--sc-color-caution-secondary: hsl(from var(--sc-color-caution) h s 90);--sc-surface-caution-secondary: var(--sc-color-caution-secondary, #ffd9b3);--sc-color-caution-secondary-hover: hsl( from var(--sc-color-caution-secondary) h s 95 );--sc-surface-caution-secondary-hover: var( --sc-color-caution-secondary-hover, #ffe5cc );--sc-color-caution-secondary-active: hsl( from var(--sc-color-caution-secondary) h s 85 );--sc-surface-caution-secondary-active: var( --sc-color-caution-secondary-active, #ffcc99 );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30) );--sc-content-caution-on-primary: #ffffff;--sc-border-caution: var(--sc-surface-caution-primary);--sc-surface-danger-primary: var(--sc-color-danger, #cc0000);--sc-color-danger-primary-hover: hsl(from var(--sc-color-danger) h s 30);--sc-surface-danger-primary-hover: var( --sc-color-danger-primary-hover, #e50000 );--sc-color-danger-primary-active: hsl(from var(--sc-color-danger) h s 20);--sc-surface-danger-primary-active: var( --sc-color-danger-primary-active, #b30000 );--sc-color-danger-secondary: hsl(from var(--sc-color-danger) h s 90);--sc-surface-danger-secondary: var(--sc-color-danger-secondary, #ffcccc);--sc-color-danger-secondary-hover: hsl( from var(--sc-color-danger-secondary) h s 95 );--sc-surface-danger-secondary-hover: var( --sc-color-danger-secondary-hover, #ffe7e7 );--sc-color-danger-secondary-active: hsl( from var(--sc-color-danger-secondary) h s 85 );--sc-surface-danger-secondary-active: var( --sc-color-danger-secondary-active, #ffb3b3 );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30) );--sc-content-danger-on-primary: #ffffff;--sc-border-danger: var(--sc-surface-danger-primary);--sc-color-disabled: hsl(from var(--sc-color-page-primary) h s calc(l * 0.5));--sc-surface-disabled: var(--sc-color-disabled, #d9d9d9);--sc-color-disabled-text: hsl( from var(--sc-color-text-primary) h s calc(l * 0.5) );--sc-content-disabled: var(--sc-color-disabled-text, #737373);--sc-content-disabled-on-disabled: var(--sc-color-disabled-text, #737373)}@supports(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none){:root{--sc-color-background-hover: hsl( from var(--sc-color-background) h s clamp(10%, calc(l + 5%), 95%) );--sc-color-background-active: hsl( from var(--sc-color-background) h s clamp(5%, calc(l - 5%), 90%) );--sc-color-foreground-secondary: hsl( from var(--sc-color-foreground) h s clamp(10%, calc(l + 5%), 90%) );--sc-color-brand-hover: hsl( from var(--sc-color-brand) h s clamp(20%, calc(l + 5%), 95%) );--sc-color-brand-active: hsl( from var(--sc-color-brand) h s clamp(10%, calc(l - 5%), 85%) );--sc-color-success-primary-hover: hsl(from var(--sc-color-success) h s 30%);--sc-color-success-primary-active: hsl( from var(--sc-color-success) h s 20% );--sc-color-success-secondary: hsl(from var(--sc-color-success) h s 90%);--sc-color-success-secondary-hover: hsl( from var(--sc-color-success-secondary) h s 95% );--sc-color-success-secondary-active: hsl( from var(--sc-color-success-secondary) h s 85% );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30%) );--sc-color-caution-primary-hover: hsl(from var(--sc-color-caution) h s 30%);--sc-color-caution-primary-active: hsl( from var(--sc-color-caution) h s 20% );--sc-color-caution-secondary: hsl(from var(--sc-color-caution) h s 90%);--sc-color-caution-secondary-hover: hsl( from var(--sc-color-caution-secondary) h s 95% );--sc-color-caution-secondary-active: hsl( from var(--sc-color-caution-secondary) h s 85% );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30%) );--sc-color-danger-primary-hover: hsl(from var(--sc-color-danger) h s 30%);--sc-color-danger-primary-active: hsl(from var(--sc-color-danger) h s 20%);--sc-color-danger-secondary: hsl(from var(--sc-color-danger) h s 90%);--sc-color-danger-secondary-hover: hsl( from var(--sc-color-danger-secondary) h s 95% );--sc-color-danger-secondary-active: hsl( from var(--sc-color-danger-secondary) h s 85% );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30%) )}}.searchcraft-custom-ad{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-adm-ad{all:unset;display:flex;flex-direction:row;cursor:pointer;gap:8px;padding-right:var(--sc-popover-list-item-padding-horizontal);padding-left:var(--sc-popover-list-item-padding-horizontal);padding-top:var(--sc-popover-list-item-padding-vertical);padding-bottom:var(--sc-popover-list-item-padding-vertical);border:1px solid blue}.searchcraft-adm-ad:focus{background-color:var(--sc-surface-neutral-secondary-active);color:var(--sc-content-neutral-secondary)}.searchcraft-adm-ad:hover{background-color:var(--sc-surface-neutral-secondary-hover);color:var(--sc-content-neutral-secondary)}.searchcraft-adm-ad-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);margin:0;color:inherit}.searchcraft-adm-ad-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);margin:0;color:inherit}.searchcraft-adm-ad-image-wrapper{width:var(--sc-popover-list-item-image-size);height:var(--sc-popover-list-item-image-size);display:flex;align-items:center;justify-content:center;flex-shrink:0}.searchcraft-adm-ad-image{max-width:var(--sc-popover-list-item-image-size);max-height:var(--sc-popover-list-item-image-size)}.searchcraft-adm-ad-info-wrapper{display:flex;flex-direction:column;gap:8px;justify-content:center}.searchcraft-search-result-container{all:unset;align-items:flex-start;border-radius:var(--sc-border-radius-lg);display:flex;flex-direction:column;gap:16px;padding:8px;color:inherit;background-color:var(--sc-surface-neutral-primary)}@media(min-width: 768px){.searchcraft-search-result-container{flex-direction:row}}a.searchcraft-search-result-container{cursor:pointer;transition:background-color 100ms}.searchcraft-base-search-result-content-container{flex:1;display:flex;flex-direction:column;gap:8px}.searchcraft-search-result-image{border-radius:calc(--sc-border-radius-lg - 8px);border-radius:calc(var(--sc-border-radius-lg) - 8px);width:100%}@media(min-width: 768px){.searchcraft-search-result-image{width:200px}}.searchcraft-base-search-result-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin:0}.searchcraft-base-search-result-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-disabled);margin:0}.searchcraft-base-search-result-body-content{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-neutral-secondary);margin:0}.searchcraft-base-search-result-footer-content{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-disabled);margin:0}.searchcraft-search-results-container{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-results-empty-state-container{text-align:center}.searchcraft-search-results-error-message-container{text-align:center}.searchcraft-button{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);background:none;border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;gap:4px;padding:12px;position:relative}.searchcraft-button.searchcraft-button-disabled{cursor:not-allowed}.searchcraft-button-primary{background-color:var(--sc-surface-brand-primary);color:var(--sc-content-brand-on-primary);font-weight:var(--sc-font-bold)}.searchcraft-button-primary:hover{background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button-primary:focus{border-color:var(--sc-border-primary)}.searchcraft-button-primary:active{background-color:var(--sc-surface-brand-primary-active)}.searchcraft-button-primary.searchcraft-button-disabled,.searchcraft-button-primary.searchcraft-button-disabled:hover,.searchcraft-button-primary.searchcraft-button-disabled:focus,.searchcraft-button-primary.searchcraft-button-disabled:active{background-color:var(--sc-surface-disabled);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-tertiary{background-color:var(--sc-surface-neutral-primary);color:var(--sc-content-brand);font-weight:var(--sc-font-normal)}.searchcraft-button-tertiary:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-button-tertiary:focus{background-color:var(--sc-surface-neutral-light);border-color:var(--sc-border-primary)}.searchcraft-button-tertiary:active{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-button-tertiary.searchcraft-button-disabled,.searchcraft-button-tertiary.searchcraft-button-disabled:hover,.searchcraft-button-tertiary.searchcraft-button-disabled:focus,.searchcraft-button-tertiary.searchcraft-button-disabled:active{background-color:var(--sc-surface-neutral-light);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-error-message{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-danger);margin:0}.filtersListContainer{width:100%}.filterCheckboxLabel{align-items:center;color:var(--sc-content-brand);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.filterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.filterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.filterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.filterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.filterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.childFilterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:12px;margin-left:24px;position:relative}.childFilterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childFilterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.childFilterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.childFilterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childFilterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}.searchcraft-facet-message{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-disabled);text-align:center}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-bold)}:root{--sc-input-border-radius: var(--sc-border-radius);--sc-input-search-icon-size: 20px;--sc-input-clear-icon-size: 20px;--sc-input-padding-left: 44px;--sc-input-padding-right: 44px}.searchcraft-input-grid{display:grid;gap:4px 8px}.searchcraft-input-grid-buttonLeft{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-grid-buttonLeft .searchcraft-input-button-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-label-wrapper{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-error-wrapper{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonRight{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-grid-buttonRight .searchcraft-input-button-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-label-wrapper{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-error-wrapper{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonNone{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-grid-buttonNone .searchcraft-input-button-wrapper{display:none}.searchcraft-input-grid-buttonNone .searchcraft-input-label-wrapper{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonNone .searchcraft-input-error-wrapper{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonNone .searchcraft-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-wrapper{position:relative;display:flex}.searchcraft-input{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-border-radius);border:none;color:var(--sc-content-neutral-primary);outline:none;padding-left:var(--sc-input-padding-left);padding-right:var(--sc-input-padding-right);padding-top:12px;padding-bottom:12px;flex:1}.searchcraft-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input:focus{outline:var(--sc-border-brand) solid 2px}.searchcraft-input:focus::placeholder{opacity:0}.searchcraft-input.error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input.error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-search-icon-wrapper{align-items:center;justify-content:center;display:flex;position:absolute;pointer-events:none;bottom:0;left:0;top:0;width:var(--sc-input-padding-left)}.searchcraft-input-search-icon{pointer-events:none;width:var(--sc-input-search-icon-size);height:var(--sc-input-search-icon-size);color:var(--sc-content-neutral-secondary)}.searchcraft-input-clear-button{all:unset;align-items:center;justify-content:center;cursor:pointer;display:flex;position:absolute;border:none;outline:none;bottom:0;right:0;top:0;width:var(--sc-input-padding-right)}.searchcraft-input-clear-icon{width:var(--sc-input-clear-icon-size);height:var(--sc-input-clear-icon-size);color:var(--sc-content-brand)}.searchcraft-input-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin-top:4px;margin-bottom:4px}:root{--sc-popover-form-border-radius: var(--sc-border-radius);--sc-popover-list-view-height: 400px;--sc-popover-list-item-image-size: 60px;--sc-popover-list-item-padding-horizontal: 8px;--sc-popover-list-item-padding-vertical: 8px;--sc-popover-modal-max-width: 570px}.searchcraft-popover-form{display:flex;flex-direction:column;flex:1}.searchcraft-popover-form .searchcraft-popover-form-input-wrapper{padding:12px;background-color:var(--sc-surface-neutral-secondary);display:flex;flex-direction:row;gap:4px}.searchcraft-popover-form .searchcraft-popover-form-input-wrapper>searchcraft-input-form{flex:1}.searchcraft-popover-form .searchcraft-popover-form-cancel-button{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);border:0;outline:0;padding:0;flex-shrink:0;background:none;cursor:pointer;padding-left:12px;padding-right:12px}.searchcraft-popover-form .searchcraft-popover-form-cancel-button:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-popover-form .searchcraft-popover-form-cancel-button:focus{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-popover-form-inline .searchcraft-input{border-top-left-radius:var(--sc-popover-form-border-radius);border-top-right-radius:var(--sc-popover-form-border-radius);border-bottom-left-radius:var(--sc-popover-form-border-radius);border-bottom-right-radius:var(--sc-popover-form-border-radius);border:none;outline:none}.searchcraft-popover-form-inline.searchcraft-popover-form-active .searchcraft-input{border-top-left-radius:var(--sc-popover-form-border-radius);border-top-right-radius:var(--sc-popover-form-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.searchcraft-popover-form-inline .searchcraft-popover-inline-wrapper-outer{position:relative}.searchcraft-popover-form-inline .searchcraft-popover-inline-wrapper-inner{position:absolute;height:var(--sc-popover-list-view-height);z-index:1000;width:100%}.searchcraft-popover-form-inline .searchcraft-popover-list-view{display:flex;flex-direction:column;overflow:auto;background-color:var(--sc-surface-neutral-secondary);border-bottom-left-radius:var(--sc-popover-form-border-radius);border-bottom-right-radius:var(--sc-popover-form-border-radius);max-height:var(--sc-popover-list-view-height)}.searchcraft-popover-form-modal{position:fixed;inset:0;z-index:1000;display:flex;align-items:flex-start;justify-content:center;padding:0;background-color:var(--sc-surface-neutral-secondary)}@media(min-width: 576px){.searchcraft-popover-form-modal{padding:16px;background-color:rgba(0,0,0,0)}}.searchcraft-popover-form-modal .searchcraft-input{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);outline-width:1px;outline-color:var(--sc-border-neutral)}.searchcraft-popover-form-modal .searchcraft-popover-form-modal-backdrop{position:absolute;inset:0;background-color:rgba(0,0,0,.5);display:none}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-form-modal-backdrop{display:block}}.searchcraft-popover-form-modal .searchcraft-popover-form-modal-inner{position:absolute;inset:0;z-index:1002;margin-top:0px;display:flex;border-radius:var(--sc-popover-form-border-radius);overflow:hidden}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-form-modal-inner{inset:auto;position:relative;width:100%;margin-top:100px;max-width:var(--sc-popover-modal-max-width)}}.searchcraft-popover-form-modal .searchcraft-popover-list-view{display:flex;flex-direction:column;overflow:auto;background-color:var(--sc-surface-neutral-secondary);border-bottom-left-radius:0;border-bottom-right-radius:0}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-list-view{max-height:var(--sc-popover-list-view-height)}}.searchcraft-popover-form-modal searchcraft-popover-list-view{overflow:scroll}@media(min-width: 576px){.searchcraft-popover-form-modal searchcraft-popover-list-view{overflow:auto}}.searchcraft-popover-form-fullscreen{position:fixed;inset:0;z-index:1000;background-color:var(--sc-surface-neutral-secondary)}.searchcraft-popover-form-fullscreen .searchcraft-popover-form{position:absolute;inset:0}.searchcraft-popover-form-fullscreen .searchcraft-input{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);outline-width:1px;outline-color:var(--sc-border-neutral)}.searchcraft-popover-form-fullscreen searchcraft-popover-list-view{overflow:scroll}.searchcraft-popover-list-item{all:unset;color:var(--sc-content-neutral-secondary);display:flex;flex-direction:row;cursor:pointer;gap:8px;padding-right:var(--sc-popover-list-item-padding-horizontal);padding-left:var(--sc-popover-list-item-padding-horizontal);padding-top:var(--sc-popover-list-item-padding-vertical);padding-bottom:var(--sc-popover-list-item-padding-vertical)}.searchcraft-popover-list-item:focus{background-color:var(--sc-surface-neutral-secondary-active);color:var(--sc-content-neutral-secondary)}.searchcraft-popover-list-item:hover{background-color:var(--sc-surface-neutral-secondary-hover);color:var(--sc-content-neutral-secondary)}.searchcraft-popover-list-item-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);margin:0;color:inherit}.searchcraft-popover-list-item-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);margin:0;color:inherit}.searchcraft-popover-list-item-image-wrapper{width:var(--sc-popover-list-item-image-size);height:var(--sc-popover-list-item-image-size);display:flex;align-items:center;justify-content:center;flex-shrink:0}.searchcraft-popover-list-item-image{max-width:var(--sc-popover-list-item-image-size);max-height:var(--sc-popover-list-item-image-size)}.searchcraft-popover-list-item-info-wrapper{display:flex;flex-direction:column;gap:8px;justify-content:center}.searchcraft-results-info{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-primary);margin:0}.searchcraft-slider-container{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%}.searchcraft-slider-range-container{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range-container::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range-container .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-input{appearance:none;background:rgba(0,0,0,0);border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range-container .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px;-webkit-appearance:none}.searchcraft-slider-range-container .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px}.searchcraft-slider-label-container{color:var(--sc-content-primary);display:flex;font-family:\"Source Sans Pro\",sans-serif;font-size:15px;font-weight:600;justify-content:space-between;margin-top:10px;width:100%}.searchcraft-slider-label{min-width:30px;text-align:center}.searchcraft-toggle-button-container{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);margin:0;color:var(--sc-content-neutral-primary)}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);margin:0;color:var(--sc-content-neutral-secondary)}.searchcraft-toggle-button-background{transition:background-color .2s;background:var(--sc-surface-disabled);border:none;border-radius:16px;cursor:pointer;height:26px;position:relative;width:44px;flex-shrink:0}.searchcraft-toggle-button-background.active{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0,0,0,.05)}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform .3s ease;width:18px}.searchcraft-toggle-button-handle.active{transform:translateX(16px)}.searchcraft-pagination{display:inline-grid;gap:16px;grid-template-columns:repeat(3, auto);grid-template-rows:1fr}.searchcraft-pagination-list{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius);display:flex;list-style-type:none;margin:0;overflow:hidden;padding:0;width:auto}.searchcraft-pagination-list li{border-right:1px solid var(--sc-border-neutral);height:100%;min-height:44px;width:44px}.searchcraft-pagination-list li:last-child{border-right:none}.searchcraft-pagination-item{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);align-items:center;background-color:var(--sc-surface-neutral-primary);border:none;display:flex;height:100%;justify-content:center;width:100%}.searchcraft-pagination-item-active{background-color:var(--sc-surface-brand-secondary);font-weight:var(--sc-font-bold)}.searchcraft-pagination-control{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius)}.searchcraft-pagination-range{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);align-items:center;display:flex}.searchcraft-select{display:flex;flex-direction:column;gap:4px}.searchcraft-select-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-bold)}.searchcraft-select-input-wrapper{position:relative}.searchcraft-select-input{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);appearance:none;background-color:var(--sc-surface-neutral-secondary);border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;height:44px;padding:0 44px 0 16px;width:100%}.searchcraft-select-input:hover{background-color:var(--sc-surface-neutral-secondary-hover)}.searchcraft-select-input:active{background-color:var(--sc-surface-neutral-secondary-active)}.searchcraft-select-input:focus{border-color:var(--sc-border-brand);outline:none}.searchcraft-select-input-icon{pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.searchcraft-select-caption{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size)}.searchcraft-search-results-per-page{display:flex}.searchcraft-search-results-per-page-select{align-items:center;display:flex;gap:12px}.searchcraft-search-results-per-page-select-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-search-results-per-page-select-input{min-width:120px}/*# sourceMappingURL=hologram.css.map */\n`","import { Component, Prop } from '@stencil/core';\nimport styles from '../../themes/hologram.css?raw';\n\n/**\n * This web component adds Searchcraft's built-in css theme to your page's <head> tag.\n * It does not render anything visible, its only function is to manage the css styles on the page.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-theme theme=\"light\" custom-theme=\"{}\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-theme',\n shadow: false,\n})\nexport class SearchcraftTheme {\n /**\n * The name of the theme.\n */\n @Prop() theme?: string;\n /**\n * The custom theme configuration object.\n */\n @Prop() customTheme?: string;\n\n private camelToKebab = (string) => {\n return string\n .replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`) // Convert uppercase letters to `-lowercase`\n .toLowerCase(); // Ensure the whole string is in lowercase\n };\n\n componentDidLoad() {\n // Inject style element\n const styleElement =\n document.querySelector('#searchcraft-theme') ||\n document.createElement('style');\n styleElement.innerHTML = styles;\n styleElement.id = 'searchcraft-theme';\n\n const head = document.head || document.getElementsByTagName('head')[0];\n\n if (!head.contains(styleElement)) {\n if (head.firstChild) {\n head.insertBefore(styleElement, head.firstChild);\n } else {\n head.appendChild(styleElement);\n }\n }\n\n // Add theme name to body\n document.body.dataset.theme = this.theme || 'light';\n\n // Add CSS variables from customTheme configuration to document\n Object.entries(JSON.parse(this.customTheme || '[]')).map(([key, value]) => {\n document.documentElement.style.setProperty(\n `--${this.camelToKebab(key)}`,\n `${value}`,\n );\n });\n }\n\n render() {\n return;\n }\n}\n"],"version":3}
@@ -6,8 +6,8 @@ import type { SearchResultMappings } from '@searchcraft/core';
6
6
  * It is consumed within the `searchcraft-base-search-results` component.
7
7
  */
8
8
  export declare class SearchcraftBaseSearchResult {
9
- item: SearchClientResponseItem | undefined;
10
- searchResultMappings: SearchResultMappings | undefined;
9
+ item?: SearchClientResponseItem;
10
+ searchResultMappings?: SearchResultMappings;
11
11
  /**
12
12
  * Where to open the link for the containing element.
13
13
  */
@@ -15,7 +15,7 @@ export declare class SearchcraftBaseSearchResult {
15
15
  /**
16
16
  * The relationship between the current document and the link for the containing element.
17
17
  */
18
- containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;
18
+ containerRel?: 'noreferrer' | 'noopener' | 'nofollow';
19
19
  /**
20
20
  * Where to open the link for the button rendered when containerHref is not present.
21
21
  */
@@ -23,7 +23,7 @@ export declare class SearchcraftBaseSearchResult {
23
23
  /**
24
24
  * The relationship between the current document and the link for the button rendered when containerHref is not present.
25
25
  */
26
- buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;
26
+ buttonRel?: 'noreferrer' | 'noopener' | 'nofollow';
27
27
  /**
28
28
  * The placement of the image.
29
29
  */
@@ -31,7 +31,7 @@ export declare class SearchcraftBaseSearchResult {
31
31
  /**
32
32
  * A custom styles object.
33
33
  */
34
- customStyles: string | undefined;
34
+ customStyles?: string;
35
35
  /**
36
36
  * The position in the document. Used with the "document_clicked" measure event.
37
37
  */
@@ -37,11 +37,11 @@ export declare class SearchcraftBaseSearchResults {
37
37
  /**
38
38
  * A custom styles object.
39
39
  */
40
- customStylesForResults: string | Record<string, Record<string, string>> | undefined;
40
+ customStylesForResults?: string | Record<string, Record<string, string>>;
41
41
  /**
42
42
  * Formats the content rendered for each result.
43
43
  */
44
- searchResultMappings: SearchResultMappings | undefined;
44
+ searchResultMappings?: SearchResultMappings;
45
45
  /**
46
46
  * The placement of the image for each result.
47
47
  */
@@ -49,7 +49,7 @@ export declare class SearchcraftBaseSearchResults {
49
49
  /**
50
50
  * The label for the button rendered when containerHref is not present for each result.
51
51
  */
52
- buttonLabel: string | undefined;
52
+ buttonLabel?: string;
53
53
  /**
54
54
  * Where to open the link for the button rendered when containerHref is not present for each result.
55
55
  */
@@ -57,7 +57,7 @@ export declare class SearchcraftBaseSearchResults {
57
57
  /**
58
58
  * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
59
59
  */
60
- buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;
60
+ buttonRel?: 'noreferrer' | 'noopener' | 'nofollow';
61
61
  /**
62
62
  * Where to open the link for the containing element for each result.
63
63
  */
@@ -65,7 +65,7 @@ export declare class SearchcraftBaseSearchResults {
65
65
  /**
66
66
  * The relationship between the current document and the link for the containing element for each result.
67
67
  */
68
- containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;
68
+ containerRel?: 'noreferrer' | 'noopener' | 'nofollow';
69
69
  searchTerm: string;
70
70
  searchClientResponseItems: SearchClientResponseItem[];
71
71
  adClientResponseItems: AdClientResponseItem[];
@@ -28,11 +28,11 @@ export declare class SearchcraftInput {
28
28
  /**
29
29
  * The label for the submit button.
30
30
  */
31
- buttonLabel: string | undefined;
31
+ buttonLabel?: string;
32
32
  /**
33
33
  * The label rendered above the input.
34
34
  */
35
- inputLabel: string | undefined;
35
+ inputLabel?: string;
36
36
  /**
37
37
  * A custom styles object to be applied to the input element.
38
38
  */
@@ -35,7 +35,7 @@ export declare class SearchcraftPopoverForm {
35
35
  /**
36
36
  * Formats the content rendered for each result.
37
37
  */
38
- popoverResultMappings: PopoverResultMappings | undefined;
38
+ popoverResultMappings?: PopoverResultMappings;
39
39
  /**
40
40
  * The hotkey that activates the popover.
41
41
  */
@@ -12,11 +12,11 @@ export declare class SearchcraftTheme {
12
12
  /**
13
13
  * The name of the theme.
14
14
  */
15
- theme: string;
15
+ theme?: string;
16
16
  /**
17
17
  * The custom theme configuration object.
18
18
  */
19
- customTheme: string;
19
+ customTheme?: string;
20
20
  private camelToKebab;
21
21
  componentDidLoad(): void;
22
22
  render(): void;
@@ -26,7 +26,7 @@ export namespace Components {
26
26
  /**
27
27
  * The relationship between the current document and the link for the button rendered when containerHref is not present.
28
28
  */
29
- "buttonRel": 'noreferrer' | 'noopener' | 'nofollow' | undefined;
29
+ "buttonRel"?: 'noreferrer' | 'noopener' | 'nofollow';
30
30
  /**
31
31
  * Where to open the link for the button rendered when containerHref is not present.
32
32
  */
@@ -34,7 +34,7 @@ export namespace Components {
34
34
  /**
35
35
  * The relationship between the current document and the link for the containing element.
36
36
  */
37
- "containerRel": 'noreferrer' | 'noopener' | 'nofollow' | undefined;
37
+ "containerRel"?: 'noreferrer' | 'noopener' | 'nofollow';
38
38
  /**
39
39
  * Where to open the link for the containing element.
40
40
  */
@@ -42,7 +42,7 @@ export namespace Components {
42
42
  /**
43
43
  * A custom styles object.
44
44
  */
45
- "customStyles": string | undefined;
45
+ "customStyles"?: string;
46
46
  /**
47
47
  * The position in the document. Used with the "document_clicked" measure event.
48
48
  */
@@ -51,8 +51,8 @@ export namespace Components {
51
51
  * The placement of the image.
52
52
  */
53
53
  "imagePlacement": 'left' | 'right';
54
- "item": SearchClientResponseItem | undefined;
55
- "searchResultMappings": SearchResultMappings | undefined;
54
+ "item"?: SearchClientResponseItem;
55
+ "searchResultMappings"?: SearchResultMappings;
56
56
  }
57
57
  /**
58
58
  * This web component is responsible for displaying the results of a search query.
@@ -86,11 +86,11 @@ export namespace Components {
86
86
  /**
87
87
  * The label for the button rendered when containerHref is not present for each result.
88
88
  */
89
- "buttonLabel": string | undefined;
89
+ "buttonLabel"?: string;
90
90
  /**
91
91
  * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
92
92
  */
93
- "buttonRel": 'noreferrer' | 'noopener' | 'nofollow' | undefined;
93
+ "buttonRel"?: 'noreferrer' | 'noopener' | 'nofollow';
94
94
  /**
95
95
  * Where to open the link for the button rendered when containerHref is not present for each result.
96
96
  */
@@ -98,7 +98,7 @@ export namespace Components {
98
98
  /**
99
99
  * The relationship between the current document and the link for the containing element for each result.
100
100
  */
101
- "containerRel": 'noreferrer' | 'noopener' | 'nofollow' | undefined;
101
+ "containerRel"?: 'noreferrer' | 'noopener' | 'nofollow';
102
102
  /**
103
103
  * Where to open the link for the containing element for each result.
104
104
  */
@@ -106,9 +106,8 @@ export namespace Components {
106
106
  /**
107
107
  * A custom styles object.
108
108
  */
109
- "customStylesForResults": | string
110
- | Record<string, Record<string, string>>
111
- | undefined;
109
+ "customStylesForResults"?: | string
110
+ | Record<string, Record<string, string>>;
112
111
  /**
113
112
  * The placement of the image for each result.
114
113
  */
@@ -116,7 +115,7 @@ export namespace Components {
116
115
  /**
117
116
  * Formats the content rendered for each result.
118
117
  */
119
- "searchResultMappings": SearchResultMappings | undefined;
118
+ "searchResultMappings"?: SearchResultMappings;
120
119
  }
121
120
  /**
122
121
  * This web component represents a button to be consumed within the `search-input-form` component.
@@ -224,7 +223,7 @@ export namespace Components {
224
223
  /**
225
224
  * The label for the submit button.
226
225
  */
227
- "buttonLabel": string | undefined;
226
+ "buttonLabel"?: string;
228
227
  /**
229
228
  * Where to place the search button.
230
229
  */
@@ -237,7 +236,7 @@ export namespace Components {
237
236
  /**
238
237
  * The label rendered above the input.
239
238
  */
240
- "inputLabel": string | undefined;
239
+ "inputLabel"?: string;
241
240
  /**
242
241
  * The input element's placeholder value.
243
242
  */
@@ -315,7 +314,7 @@ export namespace Components {
315
314
  /**
316
315
  * Formats the content rendered for each result.
317
316
  */
318
- "popoverResultMappings": PopoverResultMappings | undefined;
317
+ "popoverResultMappings"?: PopoverResultMappings;
319
318
  /**
320
319
  * The type of popover form to render. - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content. - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component. - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
321
320
  */
@@ -482,11 +481,11 @@ export namespace Components {
482
481
  /**
483
482
  * The custom theme configuration object.
484
483
  */
485
- "customTheme": string;
484
+ "customTheme"?: string;
486
485
  /**
487
486
  * The name of the theme.
488
487
  */
489
- "theme": string;
488
+ "theme"?: string;
490
489
  }
491
490
  /**
492
491
  * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
@@ -946,7 +945,7 @@ declare namespace LocalJSX {
946
945
  /**
947
946
  * The relationship between the current document and the link for the button rendered when containerHref is not present.
948
947
  */
949
- "buttonRel"?: 'noreferrer' | 'noopener' | 'nofollow' | undefined;
948
+ "buttonRel"?: 'noreferrer' | 'noopener' | 'nofollow';
950
949
  /**
951
950
  * Where to open the link for the button rendered when containerHref is not present.
952
951
  */
@@ -954,7 +953,7 @@ declare namespace LocalJSX {
954
953
  /**
955
954
  * The relationship between the current document and the link for the containing element.
956
955
  */
957
- "containerRel"?: 'noreferrer' | 'noopener' | 'nofollow' | undefined;
956
+ "containerRel"?: 'noreferrer' | 'noopener' | 'nofollow';
958
957
  /**
959
958
  * Where to open the link for the containing element.
960
959
  */
@@ -962,7 +961,7 @@ declare namespace LocalJSX {
962
961
  /**
963
962
  * A custom styles object.
964
963
  */
965
- "customStyles"?: string | undefined;
964
+ "customStyles"?: string;
966
965
  /**
967
966
  * The position in the document. Used with the "document_clicked" measure event.
968
967
  */
@@ -971,8 +970,8 @@ declare namespace LocalJSX {
971
970
  * The placement of the image.
972
971
  */
973
972
  "imagePlacement"?: 'left' | 'right';
974
- "item"?: SearchClientResponseItem | undefined;
975
- "searchResultMappings"?: SearchResultMappings | undefined;
973
+ "item"?: SearchClientResponseItem;
974
+ "searchResultMappings"?: SearchResultMappings;
976
975
  }
977
976
  /**
978
977
  * This web component is responsible for displaying the results of a search query.
@@ -1006,11 +1005,11 @@ declare namespace LocalJSX {
1006
1005
  /**
1007
1006
  * The label for the button rendered when containerHref is not present for each result.
1008
1007
  */
1009
- "buttonLabel"?: string | undefined;
1008
+ "buttonLabel"?: string;
1010
1009
  /**
1011
1010
  * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
1012
1011
  */
1013
- "buttonRel"?: 'noreferrer' | 'noopener' | 'nofollow' | undefined;
1012
+ "buttonRel"?: 'noreferrer' | 'noopener' | 'nofollow';
1014
1013
  /**
1015
1014
  * Where to open the link for the button rendered when containerHref is not present for each result.
1016
1015
  */
@@ -1018,7 +1017,7 @@ declare namespace LocalJSX {
1018
1017
  /**
1019
1018
  * The relationship between the current document and the link for the containing element for each result.
1020
1019
  */
1021
- "containerRel"?: 'noreferrer' | 'noopener' | 'nofollow' | undefined;
1020
+ "containerRel"?: 'noreferrer' | 'noopener' | 'nofollow';
1022
1021
  /**
1023
1022
  * Where to open the link for the containing element for each result.
1024
1023
  */
@@ -1027,8 +1026,7 @@ declare namespace LocalJSX {
1027
1026
  * A custom styles object.
1028
1027
  */
1029
1028
  "customStylesForResults"?: | string
1030
- | Record<string, Record<string, string>>
1031
- | undefined;
1029
+ | Record<string, Record<string, string>>;
1032
1030
  /**
1033
1031
  * The placement of the image for each result.
1034
1032
  */
@@ -1036,7 +1034,7 @@ declare namespace LocalJSX {
1036
1034
  /**
1037
1035
  * Formats the content rendered for each result.
1038
1036
  */
1039
- "searchResultMappings"?: SearchResultMappings | undefined;
1037
+ "searchResultMappings"?: SearchResultMappings;
1040
1038
  }
1041
1039
  /**
1042
1040
  * This web component represents a button to be consumed within the `search-input-form` component.
@@ -1152,7 +1150,7 @@ declare namespace LocalJSX {
1152
1150
  /**
1153
1151
  * The label for the submit button.
1154
1152
  */
1155
- "buttonLabel"?: string | undefined;
1153
+ "buttonLabel"?: string;
1156
1154
  /**
1157
1155
  * Where to place the search button.
1158
1156
  */
@@ -1165,7 +1163,7 @@ declare namespace LocalJSX {
1165
1163
  /**
1166
1164
  * The label rendered above the input.
1167
1165
  */
1168
- "inputLabel"?: string | undefined;
1166
+ "inputLabel"?: string;
1169
1167
  /**
1170
1168
  * When the input becomes unfocused.
1171
1169
  */
@@ -1255,7 +1253,7 @@ declare namespace LocalJSX {
1255
1253
  /**
1256
1254
  * Formats the content rendered for each result.
1257
1255
  */
1258
- "popoverResultMappings"?: PopoverResultMappings | undefined;
1256
+ "popoverResultMappings"?: PopoverResultMappings;
1259
1257
  /**
1260
1258
  * The type of popover form to render. - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content. - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component. - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
1261
1259
  */
@@ -20,4 +20,8 @@ export type { Components } from './components';
20
20
  export declare class Searchcraft extends SearchcraftCore {
21
21
  constructor(config: SearchcraftConfig);
22
22
  }
23
+ /**
24
+ * Exports the shared types that all SDKs need
25
+ */
26
+ export type * from '@searchcraft/core/dist/types/sdk-types';
23
27
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@searchcraft/javascript-sdk",
3
3
  "private": false,
4
- "version": "0.9.0",
4
+ "version": "0.9.1",
5
5
  "description": "Searchcraft Javascript SDK",
6
6
  "author": "Searchcraft",
7
7
  "license": "Apache-2.0",
@@ -43,12 +43,12 @@
43
43
  "nanoid": "^5.0.9"
44
44
  },
45
45
  "devDependencies": {
46
- "@searchcraft/core": "^0.9.0",
46
+ "@searchcraft/core": "^0.9.1",
47
47
  "@stencil/core": "^4.7.0",
48
48
  "@stencil/react-output-target": "^0.8.2",
49
49
  "@stencil/sass": "^3.0.12",
50
50
  "@types/node": "^16.18.11",
51
51
  "zustand": "^5.0.1"
52
52
  },
53
- "gitHead": "1b259f503157f086d1f782acb6c4bc72e1159446"
53
+ "gitHead": "ed9e1c16623cdc4592bac8a7df59ce436d21e5d2"
54
54
  }
@@ -1 +0,0 @@
1
- {"file":"p-3026f7d3.js","mappings":";;;;;;;;MAoCa,gBAAgB;;;;;;;;;;;IAInB,UAAU,GAAG,IAAI,CAAC;;;;IAIlB,eAAe,GAA8B,MAAM,CAAC;;;;IAIpD,WAAW,CAAqB;;;;IAIhC,UAAU,CAAqB;;;;IAI/B,YAAY,GAAoC,EAAE,CAAC;;;;IAInD,gBAAgB,GAAG,cAAc,CAAC;;;;IAIlC,UAAU,GAAG,EAAE,CAAC;;;;IAIf,UAAU,CAAsB;;;;IAIhC,SAAS,CAAsB;;;;IAI/B,SAAS,CAAsB;IAE/B,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IAC7B,KAAK,GAAG,KAAK,CAAC;IAEf,IAAI,CAAmB;IAEvB,WAAW,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IAElD,IAAI;QACF,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;SACxB;KACF;IAED,iBAAiB;QACf,IAAI,CAAC,IAAI,EAAE,CAAC;KACb;IAGD,YAAY;QACV,IAAI,CAAC,IAAI,EAAE,CAAC;KACb;IAED,aAAa,GAAG,CAAC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Aa,CAAC,KAAK,CAAC,CAAC;aAC3B,EACD,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAClC,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,IAAI,CAAC,UAAU,GACtB,EACF,4DAAK,KAAK,EAAC,uCAAuC,IAChD,4DACE,KAAK,EAAC,+BAA+B,EACrC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,mBAAmB,IAEnC,8DAAO,EAAE,EAAC,mBAAmB,oCAErB,EACR,6DACE,CAAC,EAAC,mNAAmN,EACrN,MAAM,EAAC,cAAc,kBACR,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,CACF,EACL,oBAAoB,KACnB,+DACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,gCAAgC,EACtC,OAAO,EAAE,IAAI,CAAC,gBAAgB,IAE9B,4DACE,KAAK,EAAC,8BAA8B,EACpC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,8DAAO,EAAE,EAAC,YAAY,yCAEd,EACR,6DACE,CAAC,EAAC,uIAAuI,EACzI,MAAM,EAAC,cAAc,kBACR,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,CACC,CACV,CACG,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input-form/searchcraft-input-form.tsx"],"sourcesContent":["import {\n Component,\n h,\n Prop,\n State,\n Event,\n type EventEmitter,\n Watch,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\nimport type { SearchcraftCore } from '@searchcraft/core';\n\nimport { parseCustomStyles } from '@utils';\nimport { searchcraftStore } from '@store';\n\n/**\n * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.\n * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-form placeholder-value=\"Search here\" />\n * ```\n *\n * ```js\n * // index.js\n * const searchInputForm = document.querySelector('searchcraft-input-form');\n *\n * ```\n */\n@Component({\n tag: 'searchcraft-input-form',\n shadow: false,\n})\nexport class SearchcraftInput {\n /**\n * Whether or not to automatically submit the search term when the input changes.\n */\n @Prop() autoSearch = true;\n /**\n * Where to place the search button.\n */\n @Prop() buttonPlacement: 'left' | 'right' | 'none' = 'none';\n /**\n * The label for the submit button.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The label rendered above the input.\n */\n @Prop() inputLabel: string | undefined;\n /**\n * A custom styles object to be applied to the input element.\n */\n @Prop() customStyles: string | Record<string, string> = {};\n /**\n * The input element's placeholder value.\n */\n @Prop() placeholderValue = 'Enter Search';\n /**\n * The starting value of the input element.\n */\n @Prop() searchTerm = '';\n /**\n * When the input becomes focused.\n */\n @Event() inputFocus?: EventEmitter<void>;\n /**\n * When the input becomes unfocused.\n */\n @Event() inputBlur?: EventEmitter<void>;\n /**\n * Event emitted when input initializes.\n */\n @Event() inputInit?: EventEmitter<void>;\n\n @State() inputValue = this.searchTerm;\n @State() error = false;\n\n @Prop() core?: SearchcraftCore;\n\n private searchStore = searchcraftStore.getState();\n\n init() {\n if (this.core) {\n this.searchStore.initialize(this.core);\n this.inputInit?.emit();\n }\n }\n\n connectedCallback() {\n this.init();\n }\n\n @Watch('core')\n onCoreChange() {\n this.init();\n }\n\n handleOnInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.inputValue = input.value;\n\n if (!this.autoSearch) {\n return;\n }\n\n this.performSearch(input.value);\n };\n\n private performSearch = async (value: string) => {\n if (value === searchcraftStore.getState().searchTerm) {\n return;\n }\n\n this.searchTerm = value.trim();\n this.error = false;\n this.searchStore.setSearchTerm(this.searchTerm);\n\n try {\n await this.searchStore.search();\n } catch (error) {\n console.log(error);\n this.error = true;\n }\n };\n\n handleClearInput = () => {\n this.inputValue = '';\n this.searchTerm = '';\n this.searchStore.setSearchTerm('');\n this.searchStore.setSearchClientResponseItems([]);\n this.error = false;\n };\n\n handleFormSubmit = async (event: Event) => {\n event.preventDefault();\n await this.performSearch(this.searchTerm);\n };\n\n render() {\n const validatedCustomStyles = parseCustomStyles(this.customStyles);\n\n const isShowingClearButton = this.inputValue.length > 0;\n\n const inputGridClassNames = classNames('searchcraft-input-grid', {\n 'searchcraft-input-grid-buttonLeft': this.buttonPlacement === 'left',\n 'searchcraft-input-grid-buttonRight': this.buttonPlacement === 'right',\n 'searchcraft-input-grid-buttonNone': this.buttonPlacement === 'none',\n });\n\n const shouldHaveVerticalGap = this.inputLabel || this.error;\n const inputGridStyles = {\n gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',\n };\n\n return (\n <form class='searchcraft-input-form' onSubmit={this.handleFormSubmit}>\n <div class={inputGridClassNames} style={inputGridStyles}>\n <div class='searchcraft-input-button-wrapper'>\n <searchcraft-button\n onButtonClick={this.handleFormSubmit}\n label={this.buttonLabel}\n />\n </div>\n {this.inputLabel && (\n <div class='searchcraft-input-label-wrapper'>\n <searchcraft-input-label label={this.inputLabel} />\n </div>\n )}\n {this.error && (\n <div class='searchcraft-input-error-wrapper'>\n <searchcraft-error-message errorMessage='Something went wrong.' />\n </div>\n )}\n <div class='searchcraft-input-wrapper'>\n <input\n autoComplete='off'\n class='searchcraft-input'\n onFocus={() => this.inputFocus?.emit()}\n onBlur={() => this.inputBlur?.emit()}\n onInput={(event) => {\n this.handleOnInput(event);\n }}\n placeholder={this.placeholderValue}\n style={validatedCustomStyles}\n type='text'\n value={this.inputValue}\n />\n <div class='searchcraft-input-search-icon-wrapper'>\n <svg\n class='searchcraft-input-search-icon'\n viewBox='0 0 20 20'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='searchcraft-title'\n >\n <title id='searchcraft-title'>\n Searchcraft Search Icon Light\n </title>\n <path\n d='M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z'\n stroke='currentColor'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </div>\n {isShowingClearButton && (\n <button\n type='button'\n class='searchcraft-input-clear-button'\n onClick={this.handleClearInput}\n >\n <svg\n class='searchcraft-input-clear-icon'\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'>\n Searchcraft Clear Input Icon Light\n </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='currentColor'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n </form>\n );\n }\n}\n"],"version":3}