@searchcraft/javascript-sdk 0.12.0 → 0.12.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.
Files changed (32) hide show
  1. package/dist/components/index.d.ts +13 -0
  2. package/dist/components/index.js +136 -17
  3. package/dist/components/index.js.map +1 -1
  4. package/dist/components/{p-b7e99386.js → p-870f81fd.js} +38 -6
  5. package/dist/components/p-870f81fd.js.map +1 -0
  6. package/dist/components/{p-0c495408.js → p-c8566920.js} +74 -33
  7. package/dist/components/p-c8566920.js.map +1 -0
  8. package/dist/components/searchcraft-facet-list.js +1 -1
  9. package/dist/components/searchcraft-filter-panel.js +2 -2
  10. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  11. package/dist/components/searchcraft-input-form.js +1 -1
  12. package/dist/components/searchcraft-pagination.js +8 -2
  13. package/dist/components/searchcraft-pagination.js.map +1 -1
  14. package/dist/components/searchcraft-popover-form.js +1 -1
  15. package/dist/components/searchcraft-results-info.js +9 -1
  16. package/dist/components/searchcraft-results-info.js.map +1 -1
  17. package/dist/components/searchcraft-search-results-per-page.js +8 -2
  18. package/dist/components/searchcraft-search-results-per-page.js.map +1 -1
  19. package/dist/hydrate/index.js +192 -100
  20. package/dist/hydrate/index.mjs +192 -100
  21. package/dist/types/classes/SearchcraftCore.d.ts +1 -1
  22. package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +1 -1
  23. package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +1 -1
  24. package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +5 -0
  25. package/dist/types/components/searchcraft-pagination/searchcraft-pagination.d.ts +1 -0
  26. package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +1 -0
  27. package/dist/types/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.d.ts +1 -0
  28. package/dist/types/components.d.ts +8 -0
  29. package/dist/types/store/SearchcraftStore.types.d.ts +6 -1
  30. package/package.json +4 -3
  31. package/dist/components/p-0c495408.js.map +0 -1
  32. package/dist/components/p-b7e99386.js.map +0 -1
@@ -21,6 +21,7 @@ const SearchcraftResultsInfo$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
21
21
  searchResultsPage;
22
22
  searchResultsPerPage;
23
23
  searchResultsCount;
24
+ searchClientRequestProperties;
24
25
  // local vars
25
26
  count = 0;
26
27
  range = [0, 0];
@@ -34,6 +35,7 @@ const SearchcraftResultsInfo$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
34
35
  this.searchResultsPage = state.searchResultsPage;
35
36
  this.searchResultsPerPage = state.searchResultsPerPage;
36
37
  this.searchResultsCount = state.searchResultsCount;
38
+ this.searchClientRequestProperties = state.searchClientRequestProperties;
37
39
  // local vars
38
40
  this.count = this.searchResultsCount;
39
41
  this.range[0] =
@@ -56,7 +58,12 @@ const SearchcraftResultsInfo$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
56
58
  this.cleanupCore?.();
57
59
  }
58
60
  render() {
59
- if (!this.searchTerm || this.searchResultsCount === 0) {
61
+ // Check if this is an initialQuery case (string requestProperties with empty searchTerm)
62
+ const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
63
+ this.searchTerm.trim() === '';
64
+ // Only hide if there's no search term AND no initialQuery AND no results
65
+ if ((!this.searchTerm && !isInitialQuery) ||
66
+ this.searchResultsCount === 0) {
60
67
  return null;
61
68
  }
62
69
  return (h("p", { class: 'searchcraft-results-info' }, typeof this.template !== 'undefined'
@@ -74,6 +81,7 @@ const SearchcraftResultsInfo$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
74
81
  "searchResultsPage": [32],
75
82
  "searchResultsPerPage": [32],
76
83
  "searchResultsCount": [32],
84
+ "searchClientRequestProperties": [32],
77
85
  "count": [32],
78
86
  "range": [32],
79
87
  "responseTime": [32]
@@ -1 +1 @@
1
- {"file":"searchcraft-results-info.js","mappings":";;;;;MA0DaA,wBAAsB;;;;;;;;IAIzB,QAAQ,CA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CACvE,CAAC,CACF,CAAC;SACH,CAAC,CAAC;KACJ;IAED,iBAAiB;QACf,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,eAAe,CACzC,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAChC,CAAC;KACH;IAED,oBAAoB;QAClB,IAAI,CAAC,WAAW,IAAI,CAAC;QACrB,IAAI,CAAC,WAAW,IAAI,CAAC;KACtB;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,kBAAkB,KAAK,CAAC,EAAE;YACrD,OAAO,IAAI,CAAC;SACb;QAED,QACE,SAAG,KAAK,EAAC,0BAA0B,IAChC,OAAO,IAAI,CAAC,QAAQ,KAAK,WAAW;cACjC,IAAI,CAAC,QAAQ,CACX;gBACE,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrD,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,YAAY,EAAE,IAAI,CAAC,YAAY;aAChC,EACD,EAAE,IAAI,EAAE,CACT;cACD,GAAG,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,IAAI,CAAC,YAAY,IAAI,CACjF,EACJ;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftResultsInfo"],"sources":["src/components/searchcraft-results-info/searchcraft-results-info.tsx"],"sourcesContent":["import type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\nimport { Component, h, State, Prop } from '@stencil/core';\n\nimport type { ResultsInfoTemplate } from '@types';\n\nimport { formatNumberWithCommas, html } from '@utils';\n\n/**\n * This web component is designed to display the number of results returned from a search query.\n *\n * @react-import\n * ```jsx\n * import { SearchcraftResultsInfo } from \"@searchcraft/react-sdk\";\n * ```\n *\n * @vue-import\n * ```jsx\n * import { SearchcraftResultsInfo } from \"@searchcraft/vue-sdk\";\n * ```\n *\n * @js-example\n * ```html\n * <!-- index.html -->\n * <searchcraft-results-info />\n * ```\n *\n * ```js\n * // index.js\n * const resultsInfo = document.querySelector('searchcraft-results-info');\n *\n * resultsInfo.template = (info, { html }) => html`\n * ${info.range[0]}-${info.range[1]} of ${info.count} results in ${info.responseTime}ms\n * `;\n * ```\n *\n * @react-example\n * ```jsx\n * <SearchcraftResultsInfo\n * template={(info, { html }) => html`\n * ${info.range[0]}-${info.range[1]} of ${info.count} results in ${info.responseTime}ms\n * `}\n * />\n * ```\n *\n * @vue-example\n * ```jsx\n * <SearchcraftResultsInfo\n * :template={(info, { html }) => html`\n * ${info.range[0]}-${info.range[1]} of ${info.count} results in ${info.responseTime}ms\n * `}\n * />\n * ```\n */\n@Component({\n tag: 'searchcraft-results-info',\n shadow: false,\n})\nexport class SearchcraftResultsInfo {\n /**\n * A callback function responsible for rendering the results info.\n */\n @Prop() template?: ResultsInfoTemplate;\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n\n // store vars\n @State() searchTerm;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n @State() searchResultsCount;\n\n // local vars\n @State() count = 0;\n @State() range: number[] = [0, 0];\n @State() responseTime = '0';\n\n unsubscribe: () => void = () => {};\n private cleanupCore?: () => void;\n\n onCoreAvailable(core: SearchcraftCore) {\n this.unsubscribe = core.store.subscribe((state) => {\n // store vars\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n this.searchResultsCount = state.searchResultsCount;\n\n // local vars\n this.count = this.searchResultsCount;\n this.range[0] =\n this.searchResultsPage <= 1\n ? 1\n : this.searchResultsPerPage * (this.searchResultsPage - 1);\n this.range[1] = this.searchResultsPerPage * this.searchResultsPage;\n this.range[1] =\n this.range[1] > this.searchResultsCount\n ? this.searchResultsCount\n : this.range[1];\n this.responseTime = ((state.searchResponseTimeTaken || 0) * 1000).toFixed(\n 2,\n );\n });\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n this.cleanupCore?.();\n }\n\n render() {\n if (!this.searchTerm || this.searchResultsCount === 0) {\n return null;\n }\n\n return (\n <p class='searchcraft-results-info'>\n {typeof this.template !== 'undefined'\n ? this.template(\n {\n range: [Number(this.range[0]), Number(this.range[1])],\n count: this.count,\n responseTime: this.responseTime,\n },\n { html },\n )\n : `${formatNumberWithCommas(this.count)} results found in ${this.responseTime}ms`}\n </p>\n );\n }\n}\n"],"version":3}
1
+ {"file":"searchcraft-results-info.js","mappings":";;;;;MA0DaA,wBAAsB;;;;;;;;IAIzB,QAAQ,CAAuB;;;;IAI/B,aAAa,CAAU;;IAGtB,UAAU,CAAC;IACX,iBAAiB,CAAC;IAClB,oBAAoB,CAAC;IACrB,kBAAkB,CAAC;IACnB,6BAA6B,CAAC;;IAG9B,KAAK,GAAG,CAAC,CAAC;IACV,KAAK,GAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzB,YAAY,GAAG,GAAG,CAAC;IAE5B,WAAW,GAAe,SAAQ,CAAC;IAC3B,WAAW,CAAc;IAEjC,eAAe,CAAC,IAAqB;QACnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK;;YAE5C,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YACnC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;YACjD,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,CAAC;YACvD,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAAC;YACnD,IAAI,CAAC,6BAA6B,GAAG,KAAK,CAAC,6BAA6B,CAAC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,IAAI,CAAC,QAAQ,KAAK,WAAW;cACjC,IAAI,CAAC,QAAQ,CACX;gBACE,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrD,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,YAAY,EAAE,IAAI,CAAC,YAAY;aAChC,EACD,EAAE,IAAI,EAAE,CACT;cACD,GAAG,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,IAAI,CAAC,YAAY,IAAI,CACjF,EACJ;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftResultsInfo"],"sources":["src/components/searchcraft-results-info/searchcraft-results-info.tsx"],"sourcesContent":["import type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\nimport { Component, Prop, State, h } from '@stencil/core';\n\nimport type { ResultsInfoTemplate } from '@types';\n\nimport { formatNumberWithCommas, html } from '@utils';\n\n/**\n * This web component is designed to display the number of results returned from a search query.\n *\n * @react-import\n * ```jsx\n * import { SearchcraftResultsInfo } from \"@searchcraft/react-sdk\";\n * ```\n *\n * @vue-import\n * ```jsx\n * import { SearchcraftResultsInfo } from \"@searchcraft/vue-sdk\";\n * ```\n *\n * @js-example\n * ```html\n * <!-- index.html -->\n * <searchcraft-results-info />\n * ```\n *\n * ```js\n * // index.js\n * const resultsInfo = document.querySelector('searchcraft-results-info');\n *\n * resultsInfo.template = (info, { html }) => html`\n * ${info.range[0]}-${info.range[1]} of ${info.count} results in ${info.responseTime}ms\n * `;\n * ```\n *\n * @react-example\n * ```jsx\n * <SearchcraftResultsInfo\n * template={(info, { html }) => html`\n * ${info.range[0]}-${info.range[1]} of ${info.count} results in ${info.responseTime}ms\n * `}\n * />\n * ```\n *\n * @vue-example\n * ```jsx\n * <SearchcraftResultsInfo\n * :template={(info, { html }) => html`\n * ${info.range[0]}-${info.range[1]} of ${info.count} results in ${info.responseTime}ms\n * `}\n * />\n * ```\n */\n@Component({\n tag: 'searchcraft-results-info',\n shadow: false,\n})\nexport class SearchcraftResultsInfo {\n /**\n * A callback function responsible for rendering the results info.\n */\n @Prop() template?: ResultsInfoTemplate;\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n\n // store vars\n @State() searchTerm;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n @State() searchResultsCount;\n @State() searchClientRequestProperties;\n\n // local vars\n @State() count = 0;\n @State() range: number[] = [0, 0];\n @State() responseTime = '0';\n\n unsubscribe: () => void = () => {};\n private cleanupCore?: () => void;\n\n onCoreAvailable(core: SearchcraftCore) {\n this.unsubscribe = core.store.subscribe((state) => {\n // store vars\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n this.searchResultsCount = state.searchResultsCount;\n this.searchClientRequestProperties = state.searchClientRequestProperties;\n\n // local vars\n this.count = this.searchResultsCount;\n this.range[0] =\n this.searchResultsPage <= 1\n ? 1\n : this.searchResultsPerPage * (this.searchResultsPage - 1);\n this.range[1] = this.searchResultsPerPage * this.searchResultsPage;\n this.range[1] =\n this.range[1] > this.searchResultsCount\n ? this.searchResultsCount\n : this.range[1];\n this.responseTime = ((state.searchResponseTimeTaken || 0) * 1000).toFixed(\n 2,\n );\n });\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n this.cleanupCore?.();\n }\n\n render() {\n // Check if this is an initialQuery case (string requestProperties with empty searchTerm)\n const isInitialQuery =\n typeof this.searchClientRequestProperties === 'string' &&\n this.searchTerm.trim() === '';\n\n // Only hide if there's no search term AND no initialQuery AND no results\n if (\n (!this.searchTerm && !isInitialQuery) ||\n this.searchResultsCount === 0\n ) {\n return null;\n }\n\n return (\n <p class='searchcraft-results-info'>\n {typeof this.template !== 'undefined'\n ? this.template(\n {\n range: [Number(this.range[0]), Number(this.range[1])],\n count: this.count,\n responseTime: this.responseTime,\n },\n { html },\n )\n : `${formatNumberWithCommas(this.count)} results found in ${this.responseTime}ms`}\n </p>\n );\n }\n}\n"],"version":3}
@@ -22,6 +22,7 @@ const SearchcraftSearchResultsPerPage$1 = /*@__PURE__*/ proxyCustomElement(class
22
22
  searchResultsPerPage;
23
23
  searchResultsCount;
24
24
  searchResultsPagesCount;
25
+ searchClientRequestProperties;
25
26
  // local vars
26
27
  initialSearchResultsPerPage;
27
28
  // store functions
@@ -36,6 +37,7 @@ const SearchcraftSearchResultsPerPage$1 = /*@__PURE__*/ proxyCustomElement(class
36
37
  this.searchResultsPerPage = state.searchResultsPerPage;
37
38
  this.searchResultsPage = state.searchResultsPage;
38
39
  this.searchResultsCount = state.searchResultsCount;
40
+ this.searchClientRequestProperties = state.searchClientRequestProperties;
39
41
  // local vars
40
42
  this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage);
41
43
  // store functions
@@ -53,8 +55,11 @@ const SearchcraftSearchResultsPerPage$1 = /*@__PURE__*/ proxyCustomElement(class
53
55
  this.cleanupCore?.();
54
56
  }
55
57
  render() {
56
- // early return if there isn't a searchTerm or there is 1 or fewer pages of results
57
- if (!this.searchTerm || this.searchResultsPagesCount <= 1) {
58
+ // Check if this is an initialQuery case (string requestProperties with empty searchTerm)
59
+ const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
60
+ this.searchTerm.trim() === '';
61
+ // early return if there isn't a searchTerm (unless it's initialQuery) or there is 1 or fewer pages of results
62
+ if ((!this.searchTerm && !isInitialQuery) || this.searchResultsPagesCount <= 1) {
58
63
  return;
59
64
  }
60
65
  return (h("div", { class: 'searchcraft-search-results-per-page' }, h("div", { class: 'searchcraft-search-results-per-page-select' }, h("label", { class: 'searchcraft-search-results-per-page-select-label', htmlFor: 'searchcraft-search-results-per-page-select-input' }, "Results Per Page"), h("div", { class: 'searchcraft-search-results-per-page-select-input' }, h("searchcraft-select", { inputId: 'searchcraft-search-results-per-page-select-input', name: 'results-per-page', options: [...Array(5)].map((_, index) => {
@@ -77,6 +82,7 @@ const SearchcraftSearchResultsPerPage$1 = /*@__PURE__*/ proxyCustomElement(class
77
82
  "searchResultsPerPage": [32],
78
83
  "searchResultsCount": [32],
79
84
  "searchResultsPagesCount": [32],
85
+ "searchClientRequestProperties": [32],
80
86
  "initialSearchResultsPerPage": [32],
81
87
  "setSearchResultsPerPage": [32],
82
88
  "setSearchResultsPage": [32]
@@ -1 +1 @@
1
- {"file":"searchcraft-search-results-per-page.js","mappings":";;;;MAqCaA,iCAA+B;;;;;;;;;IAKlC,SAAS,GAAoB,EAAE,CAAC;;;;IAIhC,aAAa,CAAU;;IAGtB,UAAU,CAAC;IACX,iBAAiB,CAAC;IAClB,oBAAoB,CAAC;IACrB,kBAAkB,CAAC;IACnB,uBAAuB,CAAC;;IAGxB,2BAA2B,CAAC;;IAG5B,uBAAuB,GAA8B,SAAQ,CAAC;IAC9D,oBAAoB,GAA2B,SAAQ,CAAC;IAEzD,WAAW,GAAe,SAAQ,CAAC;IACnC,WAAW,CAAc;IAEjC,eAAe,CAAC,IAAqB;QACnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK;;YAE5C,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YACnC,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,CAAC;YACvD,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;YACjD,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAAC;;YAGnD,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,IAAI,CACtC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,oBAAoB,CACpD,CAAC;;YAGF,I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,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;aAC9B,GACD,CACE,CACF,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftSearchResultsPerPage"],"sources":["src/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.tsx"],"sourcesContent":["import type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\nimport { Component, h, State, Prop } from '@stencil/core';\n\n/**\n * This web component is designed to choose the number of search results displayed.\n *\n * @react-import\n * ```jsx\n * import { SearchcraftSearchResultsPerPage } from \"@searchcraft/react-sdk\";\n * ```\n *\n * @vue-import\n * ```jsx\n * import { SearchcraftSearchResultsPerPage } from \"@searchcraft/vue-sdk\";\n * ```\n *\n * @js-example\n * ```html\n * <!-- index.html -->\n * <searchcraft-search-results-per-page increment=\"20\" />\n * ```\n *\n * @react-example\n * ```jsx\n * <SearchcraftSearchResultsPerPage increment={20} />\n * ```\n *\n * @vue-example\n * ```jsx\n * <SearchcraftSearchResultsPerPage increment=\"20\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-search-results-per-page',\n shadow: false,\n})\nexport class SearchcraftSearchResultsPerPage {\n /**\n * The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]).\n * The base value is defined by the `searchResultsPerPage` option in the configuration.\n */\n @Prop() increment: string | number = 20;\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n\n // store vars\n @State() searchTerm;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n @State() searchResultsCount;\n @State() searchResultsPagesCount;\n\n // local vars\n @State() initialSearchResultsPerPage;\n\n // store functions\n @State() setSearchResultsPerPage: (perPage: number) => void = () => {};\n @State() setSearchResultsPage: (page: number) => void = () => {};\n\n private unsubscribe: () => void = () => {};\n private cleanupCore?: () => void;\n\n onCoreAvailable(core: SearchcraftCore) {\n this.unsubscribe = core.store.subscribe((state) => {\n // store vars\n this.searchTerm = state.searchTerm;\n this.searchResultsPerPage = state.searchResultsPerPage;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsCount = state.searchResultsCount;\n\n // local vars\n this.searchResultsPagesCount = Math.ceil(\n this.searchResultsCount / this.searchResultsPerPage,\n );\n\n // store functions\n this.setSearchResultsPage = state.setSearchResultsPage;\n this.setSearchResultsPerPage = state.setSearchResultsPerPage;\n });\n\n this.initialSearchResultsPerPage =\n core.store.getState().searchResultsPerPage;\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n this.cleanupCore?.();\n }\n\n render() {\n // early return if there isn't a searchTerm or there is 1 or fewer pages of results\n if (!this.searchTerm || this.searchResultsPagesCount <= 1) {\n return;\n }\n\n return (\n <div class='searchcraft-search-results-per-page'>\n <div class='searchcraft-search-results-per-page-select'>\n <label\n class='searchcraft-search-results-per-page-select-label'\n htmlFor='searchcraft-search-results-per-page-select-input'\n >\n Results Per Page\n </label>\n <div class='searchcraft-search-results-per-page-select-input'>\n <searchcraft-select\n inputId='searchcraft-search-results-per-page-select-input'\n name='results-per-page'\n options={[...Array(5)].map((_, index) => {\n const value =\n this.initialSearchResultsPerPage +\n Number(this.increment) * index;\n return {\n label: `${value}`,\n value,\n };\n })}\n onSelectChange={(event) => {\n this.setSearchResultsPerPage(Number(event.detail));\n this.setSearchResultsPage(1);\n }}\n />\n </div>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"searchcraft-search-results-per-page.js","mappings":";;;;MAqCaA,iCAA+B;;;;;;;;;IAKlC,SAAS,GAAoB,EAAE,CAAC;;;;IAIhC,aAAa,CAAU;;IAGtB,UAAU,CAAC;IACX,iBAAiB,CAAC;IAClB,oBAAoB,CAAC;IACrB,kBAAkB,CAAC;IACnB,uBAAuB,CAAC;IACxB,6BAA6B,CAAC;;IAG9B,2BAA2B,CAAC;;IAG5B,uBAAuB,G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AAE,CAAC;;QAGhC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,uBAAuB,IAAI,CAAC,EAAE;YAC9E,OAAO;SACR;QAED,QACE,WAAK,KAAK,EAAC,qCAAqC,IAC9C,WAAK,KAAK,EAAC,4CAA4C,IACrD,aACE,KAAK,EAAC,kDAAkD,EACxD,OAAO,EAAC,kDAAkD,uBAGpD,EACR,WAAK,KAAK,EAAC,kDAAkD,IAC3D,0BACE,OAAO,EAAC,kDAAkD,EAC1D,IAAI,EAAC,kBAAkB,EACvB,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK;gBAClC,MAAM,KAAK,GACT,IAAI,CAAC,2BAA2B;oBAChC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;gBACjC,OAAO;oBACL,KAAK,EAAE,GAAG,KAAK,EAAE;oBACjB,KAAK;iBACN,CAAC;aACH,CAAC,EACF,cAAc,EAAE,CAAC,KAAK;gBACpB,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;gBACnD,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;aAC9B,GACD,CACE,CACF,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftSearchResultsPerPage"],"sources":["src/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.tsx"],"sourcesContent":["import type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\nimport { Component, Prop, State, h } from '@stencil/core';\n\n/**\n * This web component is designed to choose the number of search results displayed.\n *\n * @react-import\n * ```jsx\n * import { SearchcraftSearchResultsPerPage } from \"@searchcraft/react-sdk\";\n * ```\n *\n * @vue-import\n * ```jsx\n * import { SearchcraftSearchResultsPerPage } from \"@searchcraft/vue-sdk\";\n * ```\n *\n * @js-example\n * ```html\n * <!-- index.html -->\n * <searchcraft-search-results-per-page increment=\"20\" />\n * ```\n *\n * @react-example\n * ```jsx\n * <SearchcraftSearchResultsPerPage increment={20} />\n * ```\n *\n * @vue-example\n * ```jsx\n * <SearchcraftSearchResultsPerPage increment=\"20\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-search-results-per-page',\n shadow: false,\n})\nexport class SearchcraftSearchResultsPerPage {\n /**\n * The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]).\n * The base value is defined by the `searchResultsPerPage` option in the configuration.\n */\n @Prop() increment: string | number = 20;\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n\n // store vars\n @State() searchTerm;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n @State() searchResultsCount;\n @State() searchResultsPagesCount;\n @State() searchClientRequestProperties;\n\n // local vars\n @State() initialSearchResultsPerPage;\n\n // store functions\n @State() setSearchResultsPerPage: (perPage: number) => void = () => {};\n @State() setSearchResultsPage: (page: number) => void = () => {};\n\n private unsubscribe: () => void = () => {};\n private cleanupCore?: () => void;\n\n onCoreAvailable(core: SearchcraftCore) {\n this.unsubscribe = core.store.subscribe((state) => {\n // store vars\n this.searchTerm = state.searchTerm;\n this.searchResultsPerPage = state.searchResultsPerPage;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsCount = state.searchResultsCount;\n this.searchClientRequestProperties = state.searchClientRequestProperties;\n\n // local vars\n this.searchResultsPagesCount = Math.ceil(\n this.searchResultsCount / this.searchResultsPerPage,\n );\n\n // store functions\n this.setSearchResultsPage = state.setSearchResultsPage;\n this.setSearchResultsPerPage = state.setSearchResultsPerPage;\n });\n\n this.initialSearchResultsPerPage =\n core.store.getState().searchResultsPerPage;\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n this.cleanupCore?.();\n }\n\n render() {\n // Check if this is an initialQuery case (string requestProperties with empty searchTerm)\n const isInitialQuery =\n typeof this.searchClientRequestProperties === 'string' &&\n this.searchTerm.trim() === '';\n\n // early return if there isn't a searchTerm (unless it's initialQuery) or there is 1 or fewer pages of results\n if ((!this.searchTerm && !isInitialQuery) || this.searchResultsPagesCount <= 1) {\n return;\n }\n\n return (\n <div class='searchcraft-search-results-per-page'>\n <div class='searchcraft-search-results-per-page-select'>\n <label\n class='searchcraft-search-results-per-page-select-label'\n htmlFor='searchcraft-search-results-per-page-select-input'\n >\n Results Per Page\n </label>\n <div class='searchcraft-search-results-per-page-select-input'>\n <searchcraft-select\n inputId='searchcraft-search-results-per-page-select-input'\n name='results-per-page'\n options={[...Array(5)].map((_, index) => {\n const value =\n this.initialSearchResultsPerPage +\n Number(this.increment) * index;\n return {\n label: `${value}`,\n value,\n };\n })}\n onSelectChange={(event) => {\n this.setSearchResultsPerPage(Number(event.detail));\n this.setSearchResultsPage(1);\n }}\n />\n </div>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
@@ -2559,6 +2559,65 @@ class SearchcraftErrorMessage {
2559
2559
  }; }
2560
2560
  }
2561
2561
 
2562
+ /**
2563
+ * This is the default instance id for searchcraft core instances.
2564
+ * When no id is specified in a component's props, use this one.
2565
+ */
2566
+ const DEFAULT_CORE_INSTANCE_ID = 'searchcraft';
2567
+ /**
2568
+ * CoreInstanceRegistry
2569
+ *
2570
+ * This class is responsible for managing all of the instances of SearchcraftCore on a page.
2571
+ * It provides a means for consuming components to use the instance of SearchcraftCore that
2572
+ * they need to use when that instance of core gets added to the Registry.
2573
+ */
2574
+ class CoreInstanceRegistry {
2575
+ coreInstances = {};
2576
+ subscriptions = {};
2577
+ /**
2578
+ * Adds a SearchcraftCore instance to the Registry.
2579
+ *
2580
+ * When the instance is added, iterates through the onAvailable callbacks
2581
+ * that have been subscribed via useCoreInstance.
2582
+ *
2583
+ * @param coreInstance The SearchcraftCore instance to add to the registry
2584
+ * @param searchcraftId The unique identifier for this SearchcraftCore instance.
2585
+ */
2586
+ addCoreInstance(coreInstance, searchcraftId) {
2587
+ const id = searchcraftId || DEFAULT_CORE_INSTANCE_ID;
2588
+ this.coreInstances[id] = coreInstance;
2589
+ for (const callback of this.subscriptions[id] || []) {
2590
+ callback(coreInstance);
2591
+ }
2592
+ }
2593
+ /**
2594
+ * Use the specified instance of SearchcraftCore. When the instance becomes available,
2595
+ * the onAvailable callback will be called.
2596
+ *
2597
+ * @param searchcraftId The SearchcraftCore instance to use.
2598
+ * @param onAvailable The callback that gets called when the core instance becomes available.
2599
+ */
2600
+ useCoreInstance(searchcraftId, onAvailable) {
2601
+ const id = searchcraftId || DEFAULT_CORE_INSTANCE_ID;
2602
+ // If the core instance already is available, call the onAvailable callback immediately.
2603
+ if (this.coreInstances[id]) {
2604
+ onAvailable(this.coreInstances[id]);
2605
+ return () => { };
2606
+ }
2607
+ // Add the callback to the collection of callbacks for this searchcraft instance.
2608
+ if (!this.subscriptions[id]) {
2609
+ this.subscriptions[id] = [];
2610
+ }
2611
+ this.subscriptions[id].push(onAvailable);
2612
+ return () => {
2613
+ if (this.subscriptions[id]) {
2614
+ this.subscriptions[id] = this.subscriptions[id].filter((cb) => cb !== onAvailable);
2615
+ }
2616
+ };
2617
+ }
2618
+ }
2619
+ const registry = new CoreInstanceRegistry();
2620
+
2562
2621
  /**
2563
2622
  * Helper function for getting a Node (FacetWithChildrenObject)
2564
2623
  * at a given path. Traverses the node tree to get the node.
@@ -4219,65 +4278,6 @@ const html = (strings, ...values) => {
4219
4278
  return result || '';
4220
4279
  };
4221
4280
 
4222
- /**
4223
- * This is the default instance id for searchcraft core instances.
4224
- * When no id is specified in a component's props, use this one.
4225
- */
4226
- const DEFAULT_CORE_INSTANCE_ID = 'searchcraft';
4227
- /**
4228
- * CoreInstanceRegistry
4229
- *
4230
- * This class is responsible for managing all of the instances of SearchcraftCore on a page.
4231
- * It provides a means for consuming components to use the instance of SearchcraftCore that
4232
- * they need to use when that instance of core gets added to the Registry.
4233
- */
4234
- class CoreInstanceRegistry {
4235
- coreInstances = {};
4236
- subscriptions = {};
4237
- /**
4238
- * Adds a SearchcraftCore instance to the Registry.
4239
- *
4240
- * When the instance is added, iterates through the onAvailable callbacks
4241
- * that have been subscribed via useCoreInstance.
4242
- *
4243
- * @param coreInstance The SearchcraftCore instance to add to the registry
4244
- * @param searchcraftId The unique identifier for this SearchcraftCore instance.
4245
- */
4246
- addCoreInstance(coreInstance, searchcraftId) {
4247
- const id = searchcraftId || DEFAULT_CORE_INSTANCE_ID;
4248
- this.coreInstances[id] = coreInstance;
4249
- for (const callback of this.subscriptions[id] || []) {
4250
- callback(coreInstance);
4251
- }
4252
- }
4253
- /**
4254
- * Use the specified instance of SearchcraftCore. When the instance becomes available,
4255
- * the onAvailable callback will be called.
4256
- *
4257
- * @param searchcraftId The SearchcraftCore instance to use.
4258
- * @param onAvailable The callback that gets called when the core instance becomes available.
4259
- */
4260
- useCoreInstance(searchcraftId, onAvailable) {
4261
- const id = searchcraftId || DEFAULT_CORE_INSTANCE_ID;
4262
- // If the core instance already is available, call the onAvailable callback immediately.
4263
- if (this.coreInstances[id]) {
4264
- onAvailable(this.coreInstances[id]);
4265
- return () => { };
4266
- }
4267
- // Add the callback to the collection of callbacks for this searchcraft instance.
4268
- if (!this.subscriptions[id]) {
4269
- this.subscriptions[id] = [];
4270
- }
4271
- this.subscriptions[id].push(onAvailable);
4272
- return () => {
4273
- if (this.subscriptions[id]) {
4274
- this.subscriptions[id] = this.subscriptions[id].filter((cb) => cb !== onAvailable);
4275
- }
4276
- };
4277
- }
4278
- }
4279
- const registry = new CoreInstanceRegistry();
4280
-
4281
4281
  /**
4282
4282
  * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
4283
4283
  * It is consumed within the `searchcraft-filter-panel`.
@@ -4440,45 +4440,86 @@ class SearchcraftFacetList {
4440
4440
  handleStateUpdate(_state) {
4441
4441
  const state = { ..._state };
4442
4442
  // Determine what action to take based on the current State
4443
- if (state.searchTerm.trim() === '') {
4443
+ // Check if this is an initialQuery case (string requestProperties with empty searchTerm)
4444
+ const isInitialQuery = typeof state.searchClientRequestProperties === 'string' &&
4445
+ state.searchTerm.trim() === '';
4446
+ if (state.searchTerm.trim() === '' && !isInitialQuery) {
4444
4447
  this.handleIncomingSearchResponse(state, 'SEARCH_TERM_EMPTY');
4445
4448
  this.lastSearchTerm = '';
4446
4449
  }
4447
4450
  else if (this.lastTimeTaken !== state.searchResponseTimeTaken &&
4448
- state.searchClientRequestProperties &&
4449
- typeof state.searchClientRequestProperties === 'object') {
4450
- const requestProperties = state.searchClientRequestProperties;
4451
- let actionType = 'UNKNOWN';
4452
- if (this.lastSearchTerm !== requestProperties.searchTerm) {
4453
- if (this.areAnyFacetPathsSelected) {
4454
- actionType = 'NEW_SEARCH_TERM_WHILE_FACETS_ACTIVE';
4451
+ state.searchClientRequestProperties) {
4452
+ // Handle both object and string requestProperties (string is used for initialQuery)
4453
+ if (typeof state.searchClientRequestProperties === 'object') {
4454
+ const requestProperties = state.searchClientRequestProperties;
4455
+ let actionType = 'UNKNOWN';
4456
+ if (this.lastSearchTerm !== requestProperties.searchTerm) {
4457
+ if (this.areAnyFacetPathsSelected) {
4458
+ actionType = 'NEW_SEARCH_TERM_WHILE_FACETS_ACTIVE';
4459
+ }
4460
+ else {
4461
+ actionType = 'NEW_SEARCH_TERM';
4462
+ }
4455
4463
  }
4456
- else {
4457
- actionType = 'NEW_SEARCH_TERM';
4464
+ else if (this.lastRangeValues !==
4465
+ JSON.stringify(requestProperties.rangeValueForIndexFields)) {
4466
+ actionType = 'RANGE_VALUE_UPDATE';
4458
4467
  }
4468
+ else if (this.lastFacetValues !==
4469
+ JSON.stringify(requestProperties.facetPathsForIndexFields)) {
4470
+ actionType = 'FACET_UPDATE';
4471
+ }
4472
+ else if (this.lastSortType !== requestProperties.order_by) {
4473
+ actionType = 'SORT_ORDER_UPDATE';
4474
+ }
4475
+ else if (this.lastSearchMode !== requestProperties.mode) {
4476
+ actionType = 'EXACT_MATCH_UPDATE';
4477
+ }
4478
+ this.lastRangeValues = JSON.stringify(requestProperties.rangeValueForIndexFields);
4479
+ this.lastFacetValues = JSON.stringify(requestProperties.facetPathsForIndexFields);
4480
+ this.lastSortType = requestProperties.order_by;
4481
+ this.lastSearchMode = requestProperties.mode;
4482
+ this.lastSearchTerm = requestProperties.searchTerm;
4483
+ this.lastTimeTaken = state.searchResponseTimeTaken;
4484
+ // Handle the incoming response, using the action we have determined.
4485
+ this.handleIncomingSearchResponse(state, actionType);
4459
4486
  }
4460
- else if (this.lastRangeValues !==
4461
- JSON.stringify(requestProperties.rangeValueForIndexFields)) {
4462
- actionType = 'RANGE_VALUE_UPDATE';
4463
- }
4464
- else if (this.lastFacetValues !==
4465
- JSON.stringify(requestProperties.facetPathsForIndexFields)) {
4466
- actionType = 'FACET_UPDATE';
4467
- }
4468
- else if (this.lastSortType !== requestProperties.order_by) {
4469
- actionType = 'SORT_ORDER_UPDATE';
4470
- }
4471
- else if (this.lastSearchMode !== requestProperties.mode) {
4472
- actionType = 'EXACT_MATCH_UPDATE';
4487
+ else if (typeof state.searchClientRequestProperties === 'string') {
4488
+ // Handle initialQuery case where requestProperties is a string
4489
+ // For initialQuery, searchTerm will be empty but we still want to show facets
4490
+ let actionType = 'NEW_SEARCH_TERM';
4491
+ // Parse the request to get facet and range filters from the query array
4492
+ const requestObj = JSON.parse(state.searchClientRequestProperties);
4493
+ const queryArray = Array.isArray(requestObj.query)
4494
+ ? requestObj.query
4495
+ : [requestObj.query];
4496
+ // Extract filter queries (those with occur: 'must')
4497
+ const filterQueries = queryArray.filter((q) => q.occur === 'must');
4498
+ const currentFilters = JSON.stringify(filterQueries);
4499
+ // Determine the action type based on what changed
4500
+ if (this.lastFacetValues !== undefined && this.lastFacetValues !== currentFilters) {
4501
+ // Filters have changed (not initial load)
4502
+ actionType = 'FACET_UPDATE';
4503
+ }
4504
+ else if (state.searchTerm.trim() === '' && this.lastSearchTerm === '') {
4505
+ // Initial load or no changes with empty search term
4506
+ actionType = 'NEW_SEARCH_TERM';
4507
+ }
4508
+ else if (this.lastSearchTerm !== state.searchTerm) {
4509
+ // User has typed a new search term after initialQuery
4510
+ if (this.areAnyFacetPathsSelected) {
4511
+ actionType = 'NEW_SEARCH_TERM_WHILE_FACETS_ACTIVE';
4512
+ }
4513
+ else {
4514
+ actionType = 'NEW_SEARCH_TERM';
4515
+ }
4516
+ }
4517
+ this.lastFacetValues = currentFilters;
4518
+ this.lastSearchTerm = state.searchTerm;
4519
+ this.lastTimeTaken = state.searchResponseTimeTaken;
4520
+ // Handle the incoming response, using the action we have determined.
4521
+ this.handleIncomingSearchResponse(state, actionType);
4473
4522
  }
4474
- this.lastRangeValues = JSON.stringify(requestProperties.rangeValueForIndexFields);
4475
- this.lastFacetValues = JSON.stringify(requestProperties.facetPathsForIndexFields);
4476
- this.lastSortType = requestProperties.order_by;
4477
- this.lastSearchMode = requestProperties.mode;
4478
- this.lastSearchTerm = requestProperties.searchTerm;
4479
- this.lastTimeTaken = state.searchResponseTimeTaken;
4480
- // Handle the incoming response, using the action we have determined.
4481
- this.handleIncomingSearchResponse(state, actionType);
4482
4523
  }
4483
4524
  }
4484
4525
  onCoreAvailable(core) {
@@ -4718,7 +4759,7 @@ class SearchcraftFilterPanel {
4718
4759
  * Iterate through `items` and render them based on `type`
4719
4760
  */
4720
4761
  render() {
4721
- return (hAsync("div", { key: 'b18a05516bea8d145d1ca015835d63fafbfc8bd8', class: 'searchcraft-filter-panel' }, this.items.map((filterItem) => {
4762
+ return (hAsync("div", { key: 'ee8974e38b296a1ba27111bc2a4244d8915f5839', class: 'searchcraft-filter-panel' }, this.items.map((filterItem) => {
4722
4763
  switch (filterItem.type) {
4723
4764
  case 'dateRange': {
4724
4765
  const item = filterItem;
@@ -4837,6 +4878,10 @@ class SearchcraftInputForm {
4837
4878
  * 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.
4838
4879
  */
4839
4880
  placeholderBehavior;
4881
+ /**
4882
+ * The value to display in the input field.
4883
+ */
4884
+ value;
4840
4885
  /**
4841
4886
  * When the input becomes focused.
4842
4887
  */
@@ -4857,18 +4902,41 @@ class SearchcraftInputForm {
4857
4902
  cleanupCore;
4858
4903
  init() {
4859
4904
  if (this.core) {
4905
+ // Initialize inputValue from prop if provided
4906
+ if (this.value !== undefined && this.value.trim().length > 0) {
4907
+ this.inputValue = this.value;
4908
+ this.core.store.getState().setSearchTerm(this.value);
4909
+ // Trigger search if autoSearch is enabled
4910
+ if (this.autoSearch) {
4911
+ this.core.store.getState().search();
4912
+ }
4913
+ }
4860
4914
  this.inputInit?.emit();
4861
4915
  }
4862
4916
  }
4863
4917
  onCoreChange() {
4864
4918
  this.init();
4865
4919
  }
4920
+ onValueChange(newValue) {
4921
+ if (newValue !== undefined && newValue !== this.inputValue) {
4922
+ this.inputValue = newValue;
4923
+ this.core?.store.getState().setSearchTerm(newValue);
4924
+ // Trigger search if autoSearch is enabled and value is not empty
4925
+ if (this.autoSearch && newValue.trim().length > 0) {
4926
+ this.core?.store.getState().search();
4927
+ }
4928
+ }
4929
+ }
4866
4930
  onCoreAvailable(core) {
4867
4931
  this.core = core;
4868
4932
  this.init();
4869
4933
  this.unsubscribe = core.store.subscribe((state) => {
4870
4934
  this.searchTerm = state.searchTerm;
4871
- this.inputValue = state.searchTerm;
4935
+ // Only update inputValue from store if value prop is not set
4936
+ // OR if the store was cleared (empty string)
4937
+ if (this.value === undefined || state.searchTerm === '') {
4938
+ this.inputValue = state.searchTerm;
4939
+ }
4872
4940
  });
4873
4941
  }
4874
4942
  connectedCallback() {
@@ -4897,6 +4965,8 @@ class SearchcraftInputForm {
4897
4965
  }
4898
4966
  };
4899
4967
  handleClearInput = () => {
4968
+ // Clear the input value even if controlled by prop
4969
+ this.inputValue = '';
4900
4970
  this.core?.store.getState().resetSearchValues();
4901
4971
  this.error = false;
4902
4972
  };
@@ -4915,14 +4985,15 @@ class SearchcraftInputForm {
4915
4985
  const inputGridStyles = {
4916
4986
  gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',
4917
4987
  };
4918
- return (hAsync("form", { key: 'c1eea324038f640a9075d5714378d5c4b97168e0', class: 'searchcraft-input-form', onSubmit: this.handleFormSubmit }, hAsync("div", { key: 'f157c00510e5c3e75dd703996be24de5e97bbcd9', class: inputGridClassNames, style: inputGridStyles }, hAsync("div", { key: 'c97f3e5ef9ed6aee103dedc76b3ee1620b69ebba', class: 'searchcraft-input-form-button' }, hAsync("searchcraft-button", { key: '4bb5dfea8b9f8f2f0a7e5fc5c1b199ef9d209278', onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), this.inputLabel && (hAsync("div", { key: 'aa8beca21ce414d645687ee73b7ca29c740438a2', class: 'searchcraft-input-form-label' }, hAsync("searchcraft-input-label", { key: '8c15364abcf2e43354b445be6c7ceb9387ea4a67', label: this.inputLabel }))), this.error && (hAsync("div", { key: '5987b6da22a25da50613ceb277bfe44b31ba8f37', class: 'searchcraft-input-form-error-message' }, hAsync("searchcraft-error-message", { key: 'f2a230f0cf3cf0bbaddbb37ef2f38afdf73b28f6' }, "Something went wrong."))), hAsync("div", { key: 'a0862217135ac6f9a96d9e64e6fca5f772eb8f51', class: 'searchcraft-input-form-input-wrapper' }, hAsync("input", { key: '7071be386f0c73a0230e0815640b134ee5139262', autoComplete: 'off', class: classNames('searchcraft-input-form-input', {
4988
+ return (hAsync("form", { key: 'd214ace44e9209154d215e803de088aefa58a285', class: 'searchcraft-input-form', onSubmit: this.handleFormSubmit }, hAsync("div", { key: '5699f5dca28caf5e9584401f1883d2e08d26e3ec', class: inputGridClassNames, style: inputGridStyles }, hAsync("div", { key: 'ef792a946414a680e9c99c145246d00b9b8f2ffb', class: 'searchcraft-input-form-button' }, hAsync("searchcraft-button", { key: 'ba5a8cb98889bb486781af4915a21c94a0b1498a', onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), this.inputLabel && (hAsync("div", { key: 'a9e770ef967f7ab1c6ddf8f87f23cea509894536', class: 'searchcraft-input-form-label' }, hAsync("searchcraft-input-label", { key: '93b29e630e71a3c7724921aa9586aab76e592f4f', label: this.inputLabel }))), this.error && (hAsync("div", { key: '641ef4f468d527c24a1635d49dcbbba03030686f', class: 'searchcraft-input-form-error-message' }, hAsync("searchcraft-error-message", { key: '2d839d17b702fe1b41d7e49aacfc52fb53315766' }, "Something went wrong."))), hAsync("div", { key: 'af0c73478de21447c992bd0037ba007d54f53a86', class: 'searchcraft-input-form-input-wrapper' }, hAsync("input", { key: '3de1be1aa71c143b58cd6080d422410bd400e4e5', autoComplete: 'off', class: classNames('searchcraft-input-form-input', {
4919
4989
  'searchcraft-placeholder-hide-on-focus': this.placeholderBehavior === 'hide-on-focus',
4920
4990
  }), onFocus: () => this.inputFocus?.emit(), onBlur: () => this.inputBlur?.emit(), onInput: (event) => {
4921
4991
  this.handleInput(event);
4922
- }, placeholder: this.placeholderValue, type: 'text', value: this.inputValue }), hAsync("div", { key: '178a7a21a84f012662312dc2b9145fff0aec6a44', class: 'searchcraft-input-form-input-icon' }, hAsync("svg", { key: '7fb86586c155f7075fb65280482eb2ab5ff8a9db', class: 'searchcraft-input-form-input-search-icon', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, hAsync("title", { key: '0a48667010f2c998917271f941877c5ec826329f' }, "Search icon"), hAsync("path", { key: '94c54dfa1406bdc6c2f87f3b31e1b01862b58e08', 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 && (hAsync("button", { key: '931fc5e8842de1e8f3bab3fa163261c54c24148c', type: 'button', class: 'searchcraft-input-form-clear-button', onClick: this.handleClearInput }, hAsync("svg", { key: '0676b050222eb9a7bf2f7c7c112ae40c0644ecf7', class: 'searchcraft-input-form-clear-icon', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, hAsync("title", { key: '002b23596bc977b5a942776e4f7b513db4584361' }, "Clear icon"), hAsync("path", { key: '05346b8f1ede39b9e1924760f400df10d8b0aa49', 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' }))))))));
4992
+ }, placeholder: this.placeholderValue, type: 'text', value: this.inputValue }), hAsync("div", { key: 'fe9043c046e3b1b91129299f0860919ba8a8416b', class: 'searchcraft-input-form-input-icon' }, hAsync("svg", { key: '31ae1553cd214d5e2f97c9e3699862dff51a0916', class: 'searchcraft-input-form-input-search-icon', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, hAsync("title", { key: '9db677da65283ff15b0d4e79b5d9daf89637b33f' }, "Search icon"), hAsync("path", { key: '2a002eae6ed3725a432e7c3e4649c0bd2ffff7a0', 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 && (hAsync("button", { key: 'b7e92b22c3234eb31d85b0aa98d7c682b2fc0021', type: 'button', class: 'searchcraft-input-form-clear-button', onClick: this.handleClearInput }, hAsync("svg", { key: 'bfbeb742f197da0cac6dd5df2627db9df5349207', class: 'searchcraft-input-form-clear-icon', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, hAsync("title", { key: 'c62b9d237b3762609fed72e0520322fb5eabe979' }, "Clear icon"), hAsync("path", { key: '198a13760ce8b076ef8e791dec933b210ff3017a', 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' }))))))));
4923
4993
  }
4924
4994
  static get watchers() { return {
4925
- "core": ["onCoreChange"]
4995
+ "core": ["onCoreChange"],
4996
+ "value": ["onValueChange"]
4926
4997
  }; }
4927
4998
  static get cmpMeta() { return {
4928
4999
  "$flags$": 0,
@@ -4935,6 +5006,7 @@ class SearchcraftInputForm {
4935
5006
  "inputLabel": [1, "input-label"],
4936
5007
  "placeholderValue": [1, "placeholder-value"],
4937
5008
  "placeholderBehavior": [1, "placeholder-behavior"],
5009
+ "value": [1],
4938
5010
  "inputValue": [32],
4939
5011
  "searchTerm": [32],
4940
5012
  "error": [32]
@@ -5046,6 +5118,7 @@ class SearchcraftPagination {
5046
5118
  searchResultsPerPage;
5047
5119
  searchResultsPage;
5048
5120
  searchResultsCount;
5121
+ searchClientRequestProperties;
5049
5122
  // local vars
5050
5123
  searchResultsPagesCount = 1;
5051
5124
  searchResultsRangeMin = 1;
@@ -5061,6 +5134,7 @@ class SearchcraftPagination {
5061
5134
  this.searchResultsPerPage = state.searchResultsPerPage;
5062
5135
  this.searchResultsPage = state.searchResultsPage;
5063
5136
  this.searchResultsCount = state.searchResultsCount;
5137
+ this.searchClientRequestProperties = state.searchClientRequestProperties;
5064
5138
  // local vars
5065
5139
  this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage);
5066
5140
  this.searchResultsRangeMin =
@@ -5120,8 +5194,11 @@ class SearchcraftPagination {
5120
5194
  return (hAsync("li", null, hAsync("span", { class: 'searchcraft-pagination-item searchcraft-pagination-item-active' }, this.searchResultsPage)));
5121
5195
  }
5122
5196
  render() {
5123
- // early return if there isn't a searchTerm or there is 1 or fewer pages of results
5124
- if (!this.searchTerm || this.searchResultsPagesCount <= 1) {
5197
+ // Check if this is an initialQuery case (string requestProperties with empty searchTerm)
5198
+ const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
5199
+ this.searchTerm.trim() === '';
5200
+ // early return if there isn't a searchTerm (unless it's initialQuery) or there is 1 or fewer pages of results
5201
+ if ((!this.searchTerm && !isInitialQuery) || this.searchResultsPagesCount <= 1) {
5125
5202
  return;
5126
5203
  }
5127
5204
  return (hAsync("div", { class: 'searchcraft-pagination' }, hAsync("div", { class: 'searchcraft-pagination-control' }, hAsync("searchcraft-button", { disabled: this.searchResultsPage === 1, hierarchy: 'tertiary', onButtonClick: () => this.handleGoToPage(Math.max(1, this.searchResultsPage - 1)), label: 'Previous', iconPosition: 'left', icon: hAsync("svg", { class: 'searchcraft-button-icon', width: '20', height: '20', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, hAsync("title", null, "Previous page icon"), hAsync("path", { d: 'M12.5 15L7.5 10L12.5 5', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })), iconOnly: true })), hAsync("ul", { class: 'searchcraft-pagination-list' }, this.renderOddPaginationItem(1), this.renderEvenPaginationItem(2), this.renderMiddlePaginationItem(), this.renderEvenPaginationItem(this.searchResultsPagesCount > 4
@@ -5139,6 +5216,7 @@ class SearchcraftPagination {
5139
5216
  "searchResultsPerPage": [32],
5140
5217
  "searchResultsPage": [32],
5141
5218
  "searchResultsCount": [32],
5219
+ "searchClientRequestProperties": [32],
5142
5220
  "searchResultsPagesCount": [32],
5143
5221
  "searchResultsRangeMin": [32],
5144
5222
  "searchResultsRangeMax": [32],
@@ -6162,6 +6240,7 @@ class SearchcraftResultsInfo {
6162
6240
  searchResultsPage;
6163
6241
  searchResultsPerPage;
6164
6242
  searchResultsCount;
6243
+ searchClientRequestProperties;
6165
6244
  // local vars
6166
6245
  count = 0;
6167
6246
  range = [0, 0];
@@ -6175,6 +6254,7 @@ class SearchcraftResultsInfo {
6175
6254
  this.searchResultsPage = state.searchResultsPage;
6176
6255
  this.searchResultsPerPage = state.searchResultsPerPage;
6177
6256
  this.searchResultsCount = state.searchResultsCount;
6257
+ this.searchClientRequestProperties = state.searchClientRequestProperties;
6178
6258
  // local vars
6179
6259
  this.count = this.searchResultsCount;
6180
6260
  this.range[0] =
@@ -6197,7 +6277,12 @@ class SearchcraftResultsInfo {
6197
6277
  this.cleanupCore?.();
6198
6278
  }
6199
6279
  render() {
6200
- if (!this.searchTerm || this.searchResultsCount === 0) {
6280
+ // Check if this is an initialQuery case (string requestProperties with empty searchTerm)
6281
+ const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
6282
+ this.searchTerm.trim() === '';
6283
+ // Only hide if there's no search term AND no initialQuery AND no results
6284
+ if ((!this.searchTerm && !isInitialQuery) ||
6285
+ this.searchResultsCount === 0) {
6201
6286
  return null;
6202
6287
  }
6203
6288
  return (hAsync("p", { class: 'searchcraft-results-info' }, typeof this.template !== 'undefined'
@@ -6218,6 +6303,7 @@ class SearchcraftResultsInfo {
6218
6303
  "searchResultsPage": [32],
6219
6304
  "searchResultsPerPage": [32],
6220
6305
  "searchResultsCount": [32],
6306
+ "searchClientRequestProperties": [32],
6221
6307
  "count": [32],
6222
6308
  "range": [32],
6223
6309
  "responseTime": [32]
@@ -6592,6 +6678,7 @@ class SearchcraftSearchResultsPerPage {
6592
6678
  searchResultsPerPage;
6593
6679
  searchResultsCount;
6594
6680
  searchResultsPagesCount;
6681
+ searchClientRequestProperties;
6595
6682
  // local vars
6596
6683
  initialSearchResultsPerPage;
6597
6684
  // store functions
@@ -6606,6 +6693,7 @@ class SearchcraftSearchResultsPerPage {
6606
6693
  this.searchResultsPerPage = state.searchResultsPerPage;
6607
6694
  this.searchResultsPage = state.searchResultsPage;
6608
6695
  this.searchResultsCount = state.searchResultsCount;
6696
+ this.searchClientRequestProperties = state.searchClientRequestProperties;
6609
6697
  // local vars
6610
6698
  this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage);
6611
6699
  // store functions
@@ -6623,8 +6711,11 @@ class SearchcraftSearchResultsPerPage {
6623
6711
  this.cleanupCore?.();
6624
6712
  }
6625
6713
  render() {
6626
- // early return if there isn't a searchTerm or there is 1 or fewer pages of results
6627
- if (!this.searchTerm || this.searchResultsPagesCount <= 1) {
6714
+ // Check if this is an initialQuery case (string requestProperties with empty searchTerm)
6715
+ const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
6716
+ this.searchTerm.trim() === '';
6717
+ // early return if there isn't a searchTerm (unless it's initialQuery) or there is 1 or fewer pages of results
6718
+ if ((!this.searchTerm && !isInitialQuery) || this.searchResultsPagesCount <= 1) {
6628
6719
  return;
6629
6720
  }
6630
6721
  return (hAsync("div", { class: 'searchcraft-search-results-per-page' }, hAsync("div", { class: 'searchcraft-search-results-per-page-select' }, hAsync("label", { class: 'searchcraft-search-results-per-page-select-label', htmlFor: 'searchcraft-search-results-per-page-select-input' }, "Results Per Page"), hAsync("div", { class: 'searchcraft-search-results-per-page-select-input' }, hAsync("searchcraft-select", { inputId: 'searchcraft-search-results-per-page-select-input', name: 'results-per-page', options: [...Array(5)].map((_, index) => {
@@ -6650,6 +6741,7 @@ class SearchcraftSearchResultsPerPage {
6650
6741
  "searchResultsPerPage": [32],
6651
6742
  "searchResultsCount": [32],
6652
6743
  "searchResultsPagesCount": [32],
6744
+ "searchClientRequestProperties": [32],
6653
6745
  "initialSearchResultsPerPage": [32],
6654
6746
  "setSearchResultsPerPage": [32],
6655
6747
  "setSearchResultsPage": [32]