@constructor-io/constructorio-ui-autocomplete 1.23.10 → 1.23.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constructorio-ui-autocomplete-bundled.js +10 -10
- package/lib/cjs/components/Autocomplete/SearchInput/SearchInput.js +1 -1
- package/lib/cjs/components/Autocomplete/SectionItem/SectionItem.js +7 -7
- package/lib/cjs/components/Autocomplete/SectionItemsList/SectionItemsList.js +8 -2
- package/lib/cjs/constants.js +4 -2
- package/lib/cjs/hooks/useFetchRecommendationPod.js +1 -1
- package/lib/cjs/utils.js +1 -0
- package/lib/cjs/version.js +1 -1
- package/lib/mjs/components/Autocomplete/SearchInput/SearchInput.js +1 -1
- package/lib/mjs/components/Autocomplete/SectionItem/SectionItem.js +1 -1
- package/lib/mjs/components/Autocomplete/SectionItemsList/SectionItemsList.js +9 -3
- package/lib/mjs/constants.js +3 -1
- package/lib/mjs/hooks/useFetchRecommendationPod.js +1 -1
- package/lib/mjs/utils.js +1 -0
- package/lib/mjs/version.js +1 -1
- package/lib/styles.css +32 -0
- package/lib/types/constants.d.ts +2 -1
- package/lib/types/hooks/useSections.d.ts +1 -1
- package/lib/types/types.d.ts +2 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ function DefaultRenderInput({ getFormProps, getInputProps, getLabelProps, setQue
|
|
|
17
17
|
react_1.default.createElement("div", { className: 'cio-icon' },
|
|
18
18
|
react_1.default.createElement("svg", { stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', height: '1em', width: '1em', xmlns: 'http://www.w3.org/2000/svg' },
|
|
19
19
|
react_1.default.createElement("path", { d: 'M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z' })))),
|
|
20
|
-
react_1.default.createElement("button", { className: 'cio-submit-btn', "data-testid": 'cio-submit-btn', disabled: !inputProps.value, type: 'submit', "aria-label": 'Submit Search' },
|
|
20
|
+
react_1.default.createElement("button", { className: 'cio-submit-btn', "data-testid": 'cio-submit-btn', disabled: !inputProps.value, "data-cnstrc-search-submit-btn": true, type: 'submit', "aria-label": 'Submit Search' },
|
|
21
21
|
react_1.default.createElement("div", { className: 'cio-icon' },
|
|
22
22
|
react_1.default.createElement("svg", { stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', height: '1em', width: '1em', xmlns: 'http://www.w3.org/2000/svg' },
|
|
23
23
|
react_1.default.createElement("path", { d: 'M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z' }))))));
|
|
@@ -7,15 +7,15 @@ const typeGuards_1 = require("../../../typeGuards");
|
|
|
7
7
|
const SectionItemText_1 = tslib_1.__importDefault(require("./SectionItemText"));
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
function SectionItem(props) {
|
|
10
|
-
var _a, _b, _c, _d, _e;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11
11
|
const { item, children, displaySearchTermHighlights } = props;
|
|
12
12
|
const { getItemProps, advancedParameters, query, featureToggles } = (0, react_1.useContext)(CioAutocompleteProvider_1.CioAutocompleteContext);
|
|
13
13
|
const { featureDisplaySearchSuggestionImages, featureDisplaySearchSuggestionResultCounts } = featureToggles;
|
|
14
14
|
const { displaySearchSuggestionImages = featureDisplaySearchSuggestionImages, displaySearchSuggestionResultCounts = featureDisplaySearchSuggestionResultCounts, translations, } = advancedParameters || {};
|
|
15
15
|
let defaultChildren;
|
|
16
16
|
if ((0, typeGuards_1.isProduct)(item)) {
|
|
17
|
-
defaultChildren = (react_1.default.createElement(
|
|
18
|
-
react_1.default.createElement("img", { "data-testid": 'cio-img', src: (
|
|
17
|
+
defaultChildren = (react_1.default.createElement("a", { href: (_a = item.data) === null || _a === void 0 ? void 0 : _a.url },
|
|
18
|
+
react_1.default.createElement("img", { "data-testid": 'cio-img', src: (_b = item.data) === null || _b === void 0 ? void 0 : _b.image_url, alt: item.value, className: 'cio-product-image' }),
|
|
19
19
|
react_1.default.createElement("p", { "data-testid": 'cio-text', className: 'cio-product-text' },
|
|
20
20
|
react_1.default.createElement(SectionItemText_1.default, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights }))));
|
|
21
21
|
}
|
|
@@ -27,12 +27,12 @@ function SectionItem(props) {
|
|
|
27
27
|
}
|
|
28
28
|
else if ((0, typeGuards_1.isSearchSuggestion)(item)) {
|
|
29
29
|
defaultChildren = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
30
|
-
displaySearchSuggestionImages && ((
|
|
30
|
+
displaySearchSuggestionImages && ((_c = item.data) === null || _c === void 0 ? void 0 : _c.image_url) && (react_1.default.createElement("img", { src: (_d = item.data) === null || _d === void 0 ? void 0 : _d.image_url, alt: item.value, className: 'cio-suggestion-image' })),
|
|
31
31
|
react_1.default.createElement("p", { className: 'cio-suggestion-text' },
|
|
32
32
|
react_1.default.createElement(SectionItemText_1.default, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights })),
|
|
33
|
-
displaySearchSuggestionResultCounts && ((
|
|
34
|
-
"(", (
|
|
35
|
-
|
|
33
|
+
displaySearchSuggestionResultCounts && ((_e = item.data) === null || _e === void 0 ? void 0 : _e.total_num_results) && (react_1.default.createElement("p", { className: 'cio-suggestion-count' },
|
|
34
|
+
"(", (_f = item.data) === null || _f === void 0 ? void 0 :
|
|
35
|
+
_f.total_num_results,
|
|
36
36
|
")"))));
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
@@ -8,7 +8,9 @@ const CioAutocompleteProvider_1 = require("../CioAutocompleteProvider");
|
|
|
8
8
|
// eslint-disable-next-line func-names
|
|
9
9
|
const DefaultRenderSectionItemsList = function ({ section }) {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
const { getSectionProps } = (0, react_1.useContext)(CioAutocompleteProvider_1.CioAutocompleteContext);
|
|
11
|
+
const { getSectionProps, getFormProps, advancedParameters } = (0, react_1.useContext)(CioAutocompleteProvider_1.CioAutocompleteContext);
|
|
12
|
+
const { displayShowAllResultsButton, translations } = advancedParameters || {};
|
|
13
|
+
const { onSubmit } = getFormProps();
|
|
12
14
|
const { type, displayName } = section;
|
|
13
15
|
let sectionTitle = displayName;
|
|
14
16
|
if (!sectionTitle) {
|
|
@@ -32,7 +34,11 @@ const DefaultRenderSectionItemsList = function ({ section }) {
|
|
|
32
34
|
// @deprecated `cio-sectionName` will be removed in the next major release
|
|
33
35
|
return (react_1.default.createElement("li", Object.assign({}, getSectionProps(section)),
|
|
34
36
|
react_1.default.createElement("h5", { className: 'cio-section-name cio-sectionName', "aria-hidden": true }, (0, utils_1.camelToStartCase)(sectionTitle)),
|
|
35
|
-
react_1.default.createElement("ul", { className: 'cio-section-items', role: 'none' }, (_b = section === null || section === void 0 ? void 0 : section.data) === null || _b === void 0 ? void 0 : _b.map((item) => (react_1.default.createElement(SectionItem_1.default, { item: item, key: item === null || item === void 0 ? void 0 : item.id, displaySearchTermHighlights: section.displaySearchTermHighlights }))))
|
|
37
|
+
react_1.default.createElement("ul", { className: 'cio-section-items', role: 'none' }, (_b = section === null || section === void 0 ? void 0 : section.data) === null || _b === void 0 ? void 0 : _b.map((item) => (react_1.default.createElement(SectionItem_1.default, { item: item, key: item === null || item === void 0 ? void 0 : item.id, displaySearchTermHighlights: section.displaySearchTermHighlights })))),
|
|
38
|
+
displayShowAllResultsButton &&
|
|
39
|
+
type === 'autocomplete' &&
|
|
40
|
+
section.indexSectionName === 'Products' && (react_1.default.createElement("div", { className: 'cio-section-footer' },
|
|
41
|
+
react_1.default.createElement("button", { "data-cnstrc-search-submit-btn": true, className: 'cio-show-all-results-button', type: 'button', onClick: onSubmit }, (0, utils_1.translate)('show all results', translations))))));
|
|
36
42
|
};
|
|
37
43
|
function SectionItemsList(props) {
|
|
38
44
|
const { section, children = DefaultRenderSectionItemsList } = props;
|
package/lib/cjs/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.translationsDescription = exports.fetchZeroStateOnFocusDescription = exports.debounceDescription = exports.termsWithImagesAndCountsDescription = exports.filteredSuggestionsDescription = exports.termsWithGroupSuggestionsDescription = exports.advancedParametersDefaultDescription = exports.advancedParametersDescription = exports.customStylesDescription = exports.multipleSectionsDescription = exports.openOnFocusDescription = exports.zeroStateSectionsDescription = exports.onSubmitDefault = exports.onSubmitDescription = exports.onChangeDescription = exports.onFocusDescription = exports.customSectionDescription = exports.displaySearchTermHighlightsDescription = exports.recommendationsDescription = exports.sectionOrderDescription = exports.numResultsDescription = exports.contentDescription = exports.productsDescription = exports.searchSuggestionsDescription = exports.placeholderDescription = exports.cioJsClientOptionsDescription = exports.cioJsClientDescription = exports.apiKeyDescription = exports.fullFeaturedAndStyledExampleDescription = exports.zeroStateDescription = exports.userEventsDescription = exports.sectionsDescription = exports.hookDescription = exports.componentDescription = exports.apiKey = void 0;
|
|
3
|
+
exports.displayShowAllResultsButtonDescription = exports.translationsDescription = exports.fetchZeroStateOnFocusDescription = exports.debounceDescription = exports.termsWithImagesAndCountsDescription = exports.filteredSuggestionsDescription = exports.termsWithGroupSuggestionsDescription = exports.advancedParametersDefaultDescription = exports.advancedParametersDescription = exports.customStylesDescription = exports.multipleSectionsDescription = exports.openOnFocusDescription = exports.zeroStateSectionsDescription = exports.onSubmitDefault = exports.onSubmitDescription = exports.onChangeDescription = exports.onFocusDescription = exports.customSectionDescription = exports.displaySearchTermHighlightsDescription = exports.recommendationsDescription = exports.sectionOrderDescription = exports.numResultsDescription = exports.contentDescription = exports.productsDescription = exports.searchSuggestionsDescription = exports.placeholderDescription = exports.cioJsClientOptionsDescription = exports.cioJsClientDescription = exports.apiKeyDescription = exports.fullFeaturedAndStyledExampleDescription = exports.zeroStateDescription = exports.userEventsDescription = exports.sectionsDescription = exports.hookDescription = exports.componentDescription = exports.apiKey = void 0;
|
|
4
4
|
// Autocomplete key index
|
|
5
5
|
exports.apiKey = 'key_M57QS8SMPdLdLx4x';
|
|
6
6
|
/// //////////////////////////////
|
|
@@ -234,7 +234,9 @@ exports.translationsDescription = `Pass a \`translations\` object to display tra
|
|
|
234
234
|
- Current translatable keys:
|
|
235
235
|
\`\`\`
|
|
236
236
|
{
|
|
237
|
-
"in": "..."
|
|
237
|
+
"in": "...",
|
|
238
|
+
"show all results": "..."
|
|
238
239
|
}
|
|
239
240
|
\`\`\`
|
|
240
241
|
`;
|
|
242
|
+
exports.displayShowAllResultsButtonDescription = `Pass a boolean to \`displayShowAllResultsButton\` to display a button at the bottom of the Products section to show all results. This button will submit the form and trigger the \`onSubmit\` callback.`;
|
|
@@ -42,7 +42,7 @@ const useFetchRecommendationPod = (cioClient, recommendationPods, fetchZeroState
|
|
|
42
42
|
return;
|
|
43
43
|
fetchRecommendationResults();
|
|
44
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
-
}, [cioClient]);
|
|
45
|
+
}, [cioClient, recommendationPods]);
|
|
46
46
|
return { fetchRecommendationResults, recommendationsResults, podsData };
|
|
47
47
|
};
|
|
48
48
|
exports.default = useFetchRecommendationPod;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -206,6 +206,7 @@ exports.getItemsForActiveSections = getItemsForActiveSections;
|
|
|
206
206
|
const translate = (word, translations) => {
|
|
207
207
|
const localTranslations = {
|
|
208
208
|
in: 'in',
|
|
209
|
+
'show all results': 'show all results',
|
|
209
210
|
};
|
|
210
211
|
if (translations)
|
|
211
212
|
return translations[word];
|
package/lib/cjs/version.js
CHANGED
|
@@ -14,7 +14,7 @@ function DefaultRenderInput({ getFormProps, getInputProps, getLabelProps, setQue
|
|
|
14
14
|
React.createElement("div", { className: 'cio-icon' },
|
|
15
15
|
React.createElement("svg", { stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', height: '1em', width: '1em', xmlns: 'http://www.w3.org/2000/svg' },
|
|
16
16
|
React.createElement("path", { d: 'M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z' })))),
|
|
17
|
-
React.createElement("button", { className: 'cio-submit-btn', "data-testid": 'cio-submit-btn', disabled: !inputProps.value, type: 'submit', "aria-label": 'Submit Search' },
|
|
17
|
+
React.createElement("button", { className: 'cio-submit-btn', "data-testid": 'cio-submit-btn', disabled: !inputProps.value, "data-cnstrc-search-submit-btn": true, type: 'submit', "aria-label": 'Submit Search' },
|
|
18
18
|
React.createElement("div", { className: 'cio-icon' },
|
|
19
19
|
React.createElement("svg", { stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', height: '1em', width: '1em', xmlns: 'http://www.w3.org/2000/svg' },
|
|
20
20
|
React.createElement("path", { d: 'M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z' }))))));
|
|
@@ -10,7 +10,7 @@ export default function SectionItem(props) {
|
|
|
10
10
|
const { displaySearchSuggestionImages = featureDisplaySearchSuggestionImages, displaySearchSuggestionResultCounts = featureDisplaySearchSuggestionResultCounts, translations, } = advancedParameters || {};
|
|
11
11
|
let defaultChildren;
|
|
12
12
|
if (isProduct(item)) {
|
|
13
|
-
defaultChildren = (React.createElement(
|
|
13
|
+
defaultChildren = (React.createElement("a", { href: item.data?.url },
|
|
14
14
|
React.createElement("img", { "data-testid": 'cio-img', src: item.data?.image_url, alt: item.value, className: 'cio-product-image' }),
|
|
15
15
|
React.createElement("p", { "data-testid": 'cio-text', className: 'cio-product-text' },
|
|
16
16
|
React.createElement(SectionItemText, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights }))));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import SectionItem from '../SectionItem/SectionItem';
|
|
3
|
-
import { camelToStartCase } from '../../../utils';
|
|
3
|
+
import { camelToStartCase, translate } from '../../../utils';
|
|
4
4
|
import { CioAutocompleteContext } from '../CioAutocompleteProvider';
|
|
5
5
|
// eslint-disable-next-line func-names
|
|
6
6
|
const DefaultRenderSectionItemsList = function ({ section }) {
|
|
7
|
-
const { getSectionProps } = useContext(CioAutocompleteContext);
|
|
7
|
+
const { getSectionProps, getFormProps, advancedParameters } = useContext(CioAutocompleteContext);
|
|
8
|
+
const { displayShowAllResultsButton, translations } = advancedParameters || {};
|
|
9
|
+
const { onSubmit } = getFormProps();
|
|
8
10
|
const { type, displayName } = section;
|
|
9
11
|
let sectionTitle = displayName;
|
|
10
12
|
if (!sectionTitle) {
|
|
@@ -28,7 +30,11 @@ const DefaultRenderSectionItemsList = function ({ section }) {
|
|
|
28
30
|
// @deprecated `cio-sectionName` will be removed in the next major release
|
|
29
31
|
return (React.createElement("li", { ...getSectionProps(section) },
|
|
30
32
|
React.createElement("h5", { className: 'cio-section-name cio-sectionName', "aria-hidden": true }, camelToStartCase(sectionTitle)),
|
|
31
|
-
React.createElement("ul", { className: 'cio-section-items', role: 'none' }, section?.data?.map((item) => (React.createElement(SectionItem, { item: item, key: item?.id, displaySearchTermHighlights: section.displaySearchTermHighlights }))))
|
|
33
|
+
React.createElement("ul", { className: 'cio-section-items', role: 'none' }, section?.data?.map((item) => (React.createElement(SectionItem, { item: item, key: item?.id, displaySearchTermHighlights: section.displaySearchTermHighlights })))),
|
|
34
|
+
displayShowAllResultsButton &&
|
|
35
|
+
type === 'autocomplete' &&
|
|
36
|
+
section.indexSectionName === 'Products' && (React.createElement("div", { className: 'cio-section-footer' },
|
|
37
|
+
React.createElement("button", { "data-cnstrc-search-submit-btn": true, className: 'cio-show-all-results-button', type: 'button', onClick: onSubmit }, translate('show all results', translations))))));
|
|
32
38
|
};
|
|
33
39
|
export default function SectionItemsList(props) {
|
|
34
40
|
const { section, children = DefaultRenderSectionItemsList } = props;
|
package/lib/mjs/constants.js
CHANGED
|
@@ -230,7 +230,9 @@ export const translationsDescription = `Pass a \`translations\` object to displa
|
|
|
230
230
|
- Current translatable keys:
|
|
231
231
|
\`\`\`
|
|
232
232
|
{
|
|
233
|
-
"in": "..."
|
|
233
|
+
"in": "...",
|
|
234
|
+
"show all results": "..."
|
|
234
235
|
}
|
|
235
236
|
\`\`\`
|
|
236
237
|
`;
|
|
238
|
+
export const displayShowAllResultsButtonDescription = `Pass a boolean to \`displayShowAllResultsButton\` to display a button at the bottom of the Products section to show all results. This button will submit the form and trigger the \`onSubmit\` callback.`;
|
|
@@ -41,7 +41,7 @@ const useFetchRecommendationPod = (cioClient, recommendationPods, fetchZeroState
|
|
|
41
41
|
return;
|
|
42
42
|
fetchRecommendationResults();
|
|
43
43
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
-
}, [cioClient]);
|
|
44
|
+
}, [cioClient, recommendationPods]);
|
|
45
45
|
return { fetchRecommendationResults, recommendationsResults, podsData };
|
|
46
46
|
};
|
|
47
47
|
export default useFetchRecommendationPod;
|
package/lib/mjs/utils.js
CHANGED
|
@@ -188,6 +188,7 @@ export const getItemsForActiveSections = (activeSectionsWithData) => {
|
|
|
188
188
|
export const translate = (word, translations) => {
|
|
189
189
|
const localTranslations = {
|
|
190
190
|
in: 'in',
|
|
191
|
+
'show all results': 'show all results',
|
|
191
192
|
};
|
|
192
193
|
if (translations)
|
|
193
194
|
return translations[word];
|
package/lib/mjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.23.
|
|
1
|
+
export default '1.23.12';
|
package/lib/styles.css
CHANGED
|
@@ -91,6 +91,13 @@
|
|
|
91
91
|
border-bottom: 3px solid transparent;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
.cio-autocomplete .cio-item a {
|
|
95
|
+
color: inherit;
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
text-decoration: inherit;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
}
|
|
100
|
+
|
|
94
101
|
.cio-autocomplete .cio-item[aria-selected='true'] {
|
|
95
102
|
background-color: hsl(0, 0%, 90%);
|
|
96
103
|
border-radius: 4px;
|
|
@@ -122,6 +129,7 @@
|
|
|
122
129
|
width: 100%;
|
|
123
130
|
max-width: 100px;
|
|
124
131
|
max-height: 100px;
|
|
132
|
+
align-self: center;
|
|
125
133
|
}
|
|
126
134
|
|
|
127
135
|
.cio-autocomplete .cio-term-in-group {
|
|
@@ -142,4 +150,28 @@
|
|
|
142
150
|
.cio-autocomplete .cio-suggestion-count {
|
|
143
151
|
font-size: 0.8rem;
|
|
144
152
|
margin-left: 8px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.cio-autocomplete .cio-section-footer {
|
|
156
|
+
width: 100%;
|
|
157
|
+
display: flex;
|
|
158
|
+
justify-content: center;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.cio-autocomplete .cio-section-footer .cio-show-all-results-button {
|
|
162
|
+
background: none;
|
|
163
|
+
font: inherit;
|
|
164
|
+
color: inherit;
|
|
165
|
+
cursor: pointer;
|
|
166
|
+
border: 1px black solid;
|
|
167
|
+
border-radius: 5px;
|
|
168
|
+
padding: 5px;
|
|
169
|
+
flex-basis: calc(100%/3);
|
|
170
|
+
margin: 15px;
|
|
171
|
+
background-color: white;
|
|
172
|
+
text-transform: capitalize;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.cio-autocomplete .cio-section-footer .cio-show-all-results-button:hover {
|
|
176
|
+
background-color: hsl(0, 0%, 90%);
|
|
145
177
|
}
|
package/lib/types/constants.d.ts
CHANGED
|
@@ -33,4 +33,5 @@ export declare const filteredSuggestionsDescription = "Pass a `filters` object u
|
|
|
33
33
|
export declare const termsWithImagesAndCountsDescription = "Pass boolean flags for `displaySearchSuggestionImages` and `displaySearchSuggestionResultCounts` fields to display images and counts for search suggestions. These fields need to be made displayable before they can be used. Please contact your Constructor Integration Engineer for details.";
|
|
34
34
|
export declare const debounceDescription = "Pass an integer to `debounce` to override the recommended, default delay employed for debouncing autocomplete network requests between keystrokes as your users type into the text input field. The default value is 250, which results in a debounce delay of 250 milliseconds.";
|
|
35
35
|
export declare const fetchZeroStateOnFocusDescription = "Pass a boolean to `fetchZeroStateOnFocus` to override the zero state fetching behavior from initial render to input focus.";
|
|
36
|
-
export declare const translationsDescription = "Pass a `translations` object to display translatable words in your preferred language.\n\n- Current translatable keys:\n```\n {\n \"in\": \"...\"\n }\n```\n";
|
|
36
|
+
export declare const translationsDescription = "Pass a `translations` object to display translatable words in your preferred language.\n\n- Current translatable keys:\n```\n {\n \"in\": \"...\",\n \"show all results\": \"...\"\n }\n```\n";
|
|
37
|
+
export declare const displayShowAllResultsButtonDescription = "Pass a boolean to `displayShowAllResultsButton` to display a button at the bottom of the Products section to show all results. This button will submit the form and trigger the `onSubmit` callback.";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ConstructorIO from '@constructor-io/constructorio-client-javascript';
|
|
2
2
|
import { Nullable } from '@constructor-io/constructorio-client-javascript/lib/types';
|
|
3
3
|
import { AdvancedParameters, UserDefinedSection, Section } from '../types';
|
|
4
|
-
export default function useSections(query: string, cioClient: Nullable<ConstructorIO>, sections: UserDefinedSection[], zeroStateSections
|
|
4
|
+
export default function useSections(query: string, cioClient: Nullable<ConstructorIO>, sections: UserDefinedSection[], zeroStateSections?: UserDefinedSection[], advancedParameters?: AdvancedParameters): {
|
|
5
5
|
fetchRecommendationResults: () => Promise<void>;
|
|
6
6
|
activeSections: UserDefinedSection[];
|
|
7
7
|
activeSectionsWithData: Section[];
|
package/lib/types/types.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface AdvancedParametersBase {
|
|
|
13
13
|
numGroupsSuggestedPerTerm?: number;
|
|
14
14
|
displaySearchSuggestionImages?: boolean;
|
|
15
15
|
displaySearchSuggestionResultCounts?: boolean;
|
|
16
|
+
displayShowAllResultsButton?: boolean;
|
|
16
17
|
debounce?: number;
|
|
17
18
|
translations?: Translations;
|
|
18
19
|
fetchZeroStateOnFocus?: boolean;
|
|
@@ -133,6 +134,7 @@ export type HTMLPropsWithCioDataAttributes<T = any> = React.DetailedHTMLProps<Re
|
|
|
133
134
|
};
|
|
134
135
|
export type Translations = {
|
|
135
136
|
in?: string;
|
|
137
|
+
'show all results'?: string;
|
|
136
138
|
};
|
|
137
139
|
export interface PodData {
|
|
138
140
|
podId: string;
|
package/lib/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.23.
|
|
1
|
+
declare const _default: "1.23.12";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED