@constructor-io/constructorio-ui-autocomplete 1.9.0 → 1.9.2
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 +15 -15
- package/lib/cjs/components/Autocomplete/SectionItem/SectionItem.js +13 -8
- package/lib/cjs/components/Autocomplete/SectionItem/SectionItemText.js +25 -0
- package/lib/cjs/components/Autocomplete/SectionItemsList/SectionItemsList.js +1 -1
- package/lib/cjs/constants.js +2 -1
- package/lib/cjs/utils.js +5 -2
- package/lib/cjs/version.js +3 -0
- package/lib/mjs/components/Autocomplete/SectionItem/SectionItem.js +13 -8
- package/lib/mjs/components/Autocomplete/SectionItem/SectionItemText.js +21 -0
- package/lib/mjs/components/Autocomplete/SectionItemsList/SectionItemsList.js +1 -1
- package/lib/mjs/constants.js +1 -0
- package/lib/mjs/utils.js +3 -1
- package/lib/mjs/version.js +1 -0
- package/lib/types/components/Autocomplete/SectionItem/SectionItem.d.ts +1 -0
- package/lib/types/components/Autocomplete/SectionItem/SectionItemText.d.ts +8 -0
- package/lib/types/constants.d.ts +1 -0
- package/lib/types/types.d.ts +1 -0
- package/lib/types/utils.d.ts +1 -0
- package/lib/types/version.d.ts +2 -0
- package/package.json +4 -3
|
@@ -4,33 +4,38 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const CioAutocompleteProvider_1 = require("../CioAutocompleteProvider");
|
|
6
6
|
const typeGuards_1 = require("../../../typeGuards");
|
|
7
|
+
const SectionItemText_1 = tslib_1.__importDefault(require("./SectionItemText"));
|
|
7
8
|
function SectionItem(props) {
|
|
8
9
|
var _a, _b, _c, _d, _e;
|
|
9
|
-
const { item, children } = props;
|
|
10
|
-
const { getItemProps, advancedParameters } = (0, react_1.useContext)(CioAutocompleteProvider_1.CioAutocompleteContext);
|
|
10
|
+
const { item, children, displaySearchTermHighlights } = props;
|
|
11
|
+
const { getItemProps, advancedParameters, query } = (0, react_1.useContext)(CioAutocompleteProvider_1.CioAutocompleteContext);
|
|
11
12
|
const { displaySearchSuggestionImages, displaySearchSuggestionResultCounts } = advancedParameters || {};
|
|
12
13
|
let defaultChildren;
|
|
13
14
|
if ((0, typeGuards_1.isProduct)(item)) {
|
|
14
15
|
defaultChildren = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
16
|
react_1.default.createElement("img", { "data-testid": 'cio-img', src: (_a = item.data) === null || _a === void 0 ? void 0 : _a.image_url, alt: item.value, className: 'cio-product-image' }),
|
|
16
|
-
react_1.default.createElement("p", { "data-testid": 'cio-text', className: 'cio-product-text' },
|
|
17
|
+
react_1.default.createElement("p", { "data-testid": 'cio-text', className: 'cio-product-text' },
|
|
18
|
+
react_1.default.createElement(SectionItemText_1.default, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights }))));
|
|
17
19
|
}
|
|
18
20
|
else if ((0, typeGuards_1.isInGroupSuggestion)(item)) {
|
|
19
|
-
defaultChildren = react_1.default.createElement("p", { className: 'cio-term-in-group' },
|
|
20
|
-
"in
|
|
21
|
-
|
|
21
|
+
defaultChildren = (react_1.default.createElement("p", { className: 'cio-term-in-group' },
|
|
22
|
+
"in",
|
|
23
|
+
' ',
|
|
24
|
+
react_1.default.createElement(SectionItemText_1.default, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights })));
|
|
22
25
|
}
|
|
23
26
|
else if ((0, typeGuards_1.isSearchSuggestion)(item)) {
|
|
24
27
|
defaultChildren = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
25
28
|
displaySearchSuggestionImages && ((_b = item.data) === null || _b === void 0 ? void 0 : _b.image_url) && (react_1.default.createElement("img", { src: (_c = item.data) === null || _c === void 0 ? void 0 : _c.image_url, alt: item.value, className: 'cio-suggestion-image' })),
|
|
26
|
-
react_1.default.createElement("p", { className: 'cio-suggestion-text' },
|
|
29
|
+
react_1.default.createElement("p", { className: 'cio-suggestion-text' },
|
|
30
|
+
react_1.default.createElement(SectionItemText_1.default, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights })),
|
|
27
31
|
displaySearchSuggestionResultCounts && ((_d = item.data) === null || _d === void 0 ? void 0 : _d.total_num_results) && (react_1.default.createElement("p", { className: 'cio-suggestion-count' },
|
|
28
32
|
"(", (_e = item.data) === null || _e === void 0 ? void 0 :
|
|
29
33
|
_e.total_num_results,
|
|
30
34
|
")"))));
|
|
31
35
|
}
|
|
32
36
|
else {
|
|
33
|
-
defaultChildren = react_1.default.createElement("p", { className: 'cio-custom-text' },
|
|
37
|
+
defaultChildren = (react_1.default.createElement("p", { className: 'cio-custom-text' },
|
|
38
|
+
react_1.default.createElement(SectionItemText_1.default, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights })));
|
|
34
39
|
}
|
|
35
40
|
return react_1.default.createElement("li", Object.assign({}, getItemProps(item)), children || defaultChildren);
|
|
36
41
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const typeGuards_1 = require("../../../typeGuards");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
function SectionItemText({ item, query, highlightSearchTerm, }) {
|
|
8
|
+
const itemText = (0, typeGuards_1.isInGroupSuggestion)(item) ? item.groupName : item.value;
|
|
9
|
+
if (highlightSearchTerm) {
|
|
10
|
+
const queryRegex = new RegExp(`(${(0, utils_1.escapeRegExp)(query)})`, 'gi');
|
|
11
|
+
const queryIncludedInText = queryRegex.test(itemText);
|
|
12
|
+
if (query && queryIncludedInText) {
|
|
13
|
+
const splitText = itemText.split(queryRegex);
|
|
14
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, splitText.map((split, index) => {
|
|
15
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
16
|
+
if (queryRegex.test(split))
|
|
17
|
+
return react_1.default.createElement("b", { key: `matched-word-${index}` }, split);
|
|
18
|
+
return split;
|
|
19
|
+
})));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
23
|
+
return react_1.default.createElement(react_1.default.Fragment, null, itemText);
|
|
24
|
+
}
|
|
25
|
+
exports.default = SectionItemText;
|
|
@@ -12,7 +12,7 @@ const DefaultRenderSectionItemsList = function ({ section }) {
|
|
|
12
12
|
return null;
|
|
13
13
|
return (react_1.default.createElement("li", { className: `${sectionName} cio-section`, role: 'none' },
|
|
14
14
|
react_1.default.createElement("h5", { className: 'cio-sectionName', "aria-hidden": true }, (0, utils_1.camelToStartCase)(sectionName)),
|
|
15
|
-
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 }))))));
|
|
15
|
+
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 }))))));
|
|
16
16
|
};
|
|
17
17
|
function SectionItemsList(props) {
|
|
18
18
|
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.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.recommendationsDescription = exports.sectionOrderDescription = exports.numResultsDescription = exports.contentDescription = exports.productsDescription = exports.searchSuggestionsDescription = exports.placeholderDescription = exports.cioJsClientDescription = exports.apiKeyDescription = exports.zeroStateDescription = exports.userEventsDescription = exports.sectionsDescription = exports.hookDescription = exports.componentDescription = exports.apiKey = void 0;
|
|
3
|
+
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.cioJsClientDescription = exports.apiKeyDescription = 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
|
/// //////////////////////////////
|
|
@@ -108,6 +108,7 @@ exports.contentDescription = `Override default \`sections\` to only suggest cont
|
|
|
108
108
|
exports.numResultsDescription = `Override default \`numResults\` to only suggest 2 products per query`;
|
|
109
109
|
exports.sectionOrderDescription = `Override default \`numResults\` to suggest products, then terms`;
|
|
110
110
|
exports.recommendationsDescription = `Use constructor's recommendations service, with \`"type": "recommendations"\``;
|
|
111
|
+
exports.displaySearchTermHighlightsDescription = `Use constructor's auto highlighting of words that match the search keyword, with \`"displaySearchTermHighlights": true\``;
|
|
111
112
|
exports.customSectionDescription = `Use a custom section, by managing and passing your own data, with \`"type": "custom"\` and \`"data":[{...}]\``;
|
|
112
113
|
exports.onFocusDescription = `Pass an \`onFocus\` callback function to execute some code each time the user applies focus to the text input field`;
|
|
113
114
|
exports.onChangeDescription = `Pass an \`onChange\` callback function to execute some code each time the user changes the value of the text input field`;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getActiveSectionsWithData = exports.getCioClient = exports.disableStoryActions = exports.stringifyWithDefaults = exports.functionStrings = exports.getStoryParams = exports.sleep = exports.clearConstructorRequests = exports.isTrackingRequestSent = exports.camelToStartCase = exports.getItemPosition = void 0;
|
|
3
|
+
exports.escapeRegExp = exports.getActiveSectionsWithData = exports.getCioClient = exports.disableStoryActions = exports.stringifyWithDefaults = exports.functionStrings = exports.getStoryParams = exports.sleep = exports.clearConstructorRequests = exports.isTrackingRequestSent = exports.camelToStartCase = exports.getItemPosition = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const constructorio_client_javascript_1 = tslib_1.__importDefault(require("@constructor-io/constructorio-client-javascript"));
|
|
6
6
|
const typeGuards_1 = require("./typeGuards");
|
|
7
|
+
const version_1 = tslib_1.__importDefault(require("./version"));
|
|
7
8
|
const getItemPosition = ({ item, items }) => {
|
|
8
9
|
var _a;
|
|
9
10
|
const index = items.findIndex((itemInFlatList) => (itemInFlatList === null || itemInFlatList === void 0 ? void 0 : itemInFlatList.id) === (item === null || item === void 0 ? void 0 : item.id));
|
|
@@ -88,7 +89,7 @@ const getCioClient = (apiKey) => {
|
|
|
88
89
|
return new constructorio_client_javascript_1.default({
|
|
89
90
|
apiKey,
|
|
90
91
|
sendTrackingEvents: true,
|
|
91
|
-
version:
|
|
92
|
+
version: `cio-ui-autocomplete-${version_1.default}`,
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
return null;
|
|
@@ -116,3 +117,5 @@ const getActiveSectionsWithData = (activeSections, sectionResults) => {
|
|
|
116
117
|
return activeSectionsWithData;
|
|
117
118
|
};
|
|
118
119
|
exports.getActiveSectionsWithData = getActiveSectionsWithData;
|
|
120
|
+
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
121
|
+
exports.escapeRegExp = escapeRegExp;
|
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { CioAutocompleteContext } from '../CioAutocompleteProvider';
|
|
3
3
|
import { isProduct, isInGroupSuggestion, isSearchSuggestion } from '../../../typeGuards';
|
|
4
|
+
import SectionItemText from './SectionItemText';
|
|
4
5
|
export default function SectionItem(props) {
|
|
5
|
-
const { item, children } = props;
|
|
6
|
-
const { getItemProps, advancedParameters } = useContext(CioAutocompleteContext);
|
|
6
|
+
const { item, children, displaySearchTermHighlights } = props;
|
|
7
|
+
const { getItemProps, advancedParameters, query } = useContext(CioAutocompleteContext);
|
|
7
8
|
const { displaySearchSuggestionImages, displaySearchSuggestionResultCounts } = advancedParameters || {};
|
|
8
9
|
let defaultChildren;
|
|
9
10
|
if (isProduct(item)) {
|
|
10
11
|
defaultChildren = (React.createElement(React.Fragment, null,
|
|
11
12
|
React.createElement("img", { "data-testid": 'cio-img', src: item.data?.image_url, alt: item.value, className: 'cio-product-image' }),
|
|
12
|
-
React.createElement("p", { "data-testid": 'cio-text', className: 'cio-product-text' },
|
|
13
|
+
React.createElement("p", { "data-testid": 'cio-text', className: 'cio-product-text' },
|
|
14
|
+
React.createElement(SectionItemText, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights }))));
|
|
13
15
|
}
|
|
14
16
|
else if (isInGroupSuggestion(item)) {
|
|
15
|
-
defaultChildren = React.createElement("p", { className: 'cio-term-in-group' },
|
|
16
|
-
"in
|
|
17
|
-
|
|
17
|
+
defaultChildren = (React.createElement("p", { className: 'cio-term-in-group' },
|
|
18
|
+
"in",
|
|
19
|
+
' ',
|
|
20
|
+
React.createElement(SectionItemText, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights })));
|
|
18
21
|
}
|
|
19
22
|
else if (isSearchSuggestion(item)) {
|
|
20
23
|
defaultChildren = (React.createElement(React.Fragment, null,
|
|
21
24
|
displaySearchSuggestionImages && item.data?.image_url && (React.createElement("img", { src: item.data?.image_url, alt: item.value, className: 'cio-suggestion-image' })),
|
|
22
|
-
React.createElement("p", { className: 'cio-suggestion-text' },
|
|
25
|
+
React.createElement("p", { className: 'cio-suggestion-text' },
|
|
26
|
+
React.createElement(SectionItemText, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights })),
|
|
23
27
|
displaySearchSuggestionResultCounts && item.data?.total_num_results && (React.createElement("p", { className: 'cio-suggestion-count' },
|
|
24
28
|
"(",
|
|
25
29
|
item.data?.total_num_results,
|
|
26
30
|
")"))));
|
|
27
31
|
}
|
|
28
32
|
else {
|
|
29
|
-
defaultChildren = React.createElement("p", { className: 'cio-custom-text' },
|
|
33
|
+
defaultChildren = (React.createElement("p", { className: 'cio-custom-text' },
|
|
34
|
+
React.createElement(SectionItemText, { item: item, query: query, highlightSearchTerm: displaySearchTermHighlights })));
|
|
30
35
|
}
|
|
31
36
|
return React.createElement("li", { ...getItemProps(item) }, children || defaultChildren);
|
|
32
37
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isInGroupSuggestion } from '../../../typeGuards';
|
|
3
|
+
import { escapeRegExp } from '../../../utils';
|
|
4
|
+
export default function SectionItemText({ item, query, highlightSearchTerm, }) {
|
|
5
|
+
const itemText = isInGroupSuggestion(item) ? item.groupName : item.value;
|
|
6
|
+
if (highlightSearchTerm) {
|
|
7
|
+
const queryRegex = new RegExp(`(${escapeRegExp(query)})`, 'gi');
|
|
8
|
+
const queryIncludedInText = queryRegex.test(itemText);
|
|
9
|
+
if (query && queryIncludedInText) {
|
|
10
|
+
const splitText = itemText.split(queryRegex);
|
|
11
|
+
return (React.createElement(React.Fragment, null, splitText.map((split, index) => {
|
|
12
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
13
|
+
if (queryRegex.test(split))
|
|
14
|
+
return React.createElement("b", { key: `matched-word-${index}` }, split);
|
|
15
|
+
return split;
|
|
16
|
+
})));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
20
|
+
return React.createElement(React.Fragment, null, itemText);
|
|
21
|
+
}
|
|
@@ -8,7 +8,7 @@ const DefaultRenderSectionItemsList = function ({ section }) {
|
|
|
8
8
|
return null;
|
|
9
9
|
return (React.createElement("li", { className: `${sectionName} cio-section`, role: 'none' },
|
|
10
10
|
React.createElement("h5", { className: 'cio-sectionName', "aria-hidden": true }, camelToStartCase(sectionName)),
|
|
11
|
-
React.createElement("ul", { className: 'cio-section-items', role: 'none' }, section?.data?.map((item) => (React.createElement(SectionItem, { item: item, key: item?.id }))))));
|
|
11
|
+
React.createElement("ul", { className: 'cio-section-items', role: 'none' }, section?.data?.map((item) => (React.createElement(SectionItem, { item: item, key: item?.id, displaySearchTermHighlights: section.displaySearchTermHighlights }))))));
|
|
12
12
|
};
|
|
13
13
|
export default function SectionItemsList(props) {
|
|
14
14
|
const { section, children = DefaultRenderSectionItemsList } = props;
|
package/lib/mjs/constants.js
CHANGED
|
@@ -105,6 +105,7 @@ export const contentDescription = `Override default \`sections\` to only suggest
|
|
|
105
105
|
export const numResultsDescription = `Override default \`numResults\` to only suggest 2 products per query`;
|
|
106
106
|
export const sectionOrderDescription = `Override default \`numResults\` to suggest products, then terms`;
|
|
107
107
|
export const recommendationsDescription = `Use constructor's recommendations service, with \`"type": "recommendations"\``;
|
|
108
|
+
export const displaySearchTermHighlightsDescription = `Use constructor's auto highlighting of words that match the search keyword, with \`"displaySearchTermHighlights": true\``;
|
|
108
109
|
export const customSectionDescription = `Use a custom section, by managing and passing your own data, with \`"type": "custom"\` and \`"data":[{...}]\``;
|
|
109
110
|
export const onFocusDescription = `Pass an \`onFocus\` callback function to execute some code each time the user applies focus to the text input field`;
|
|
110
111
|
export const onChangeDescription = `Pass an \`onChange\` callback function to execute some code each time the user changes the value of the text input field`;
|
package/lib/mjs/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ConstructorIOClient from '@constructor-io/constructorio-client-javascript';
|
|
2
2
|
import { isCustomSection } from './typeGuards';
|
|
3
|
+
import version from './version';
|
|
3
4
|
export const getItemPosition = ({ item, items }) => {
|
|
4
5
|
const index = items.findIndex((itemInFlatList) => itemInFlatList?.id === item?.id);
|
|
5
6
|
const sectionId = items[index]?.section;
|
|
@@ -73,7 +74,7 @@ export const getCioClient = (apiKey) => {
|
|
|
73
74
|
return new ConstructorIOClient({
|
|
74
75
|
apiKey,
|
|
75
76
|
sendTrackingEvents: true,
|
|
76
|
-
version:
|
|
77
|
+
version: `cio-ui-autocomplete-${version}`,
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
return null;
|
|
@@ -99,3 +100,4 @@ export const getActiveSectionsWithData = (activeSections, sectionResults) => {
|
|
|
99
100
|
});
|
|
100
101
|
return activeSectionsWithData;
|
|
101
102
|
};
|
|
103
|
+
export const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default '1.9.2';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Item } from '../../../types';
|
|
3
|
+
export interface SectionItemTextProps {
|
|
4
|
+
item: Item;
|
|
5
|
+
query: string;
|
|
6
|
+
highlightSearchTerm?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function SectionItemText({ item, query, highlightSearchTerm, }: SectionItemTextProps): JSX.Element;
|
package/lib/types/constants.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare const contentDescription = "Override default `sections` to only s
|
|
|
14
14
|
export declare const numResultsDescription = "Override default `numResults` to only suggest 2 products per query";
|
|
15
15
|
export declare const sectionOrderDescription = "Override default `numResults` to suggest products, then terms";
|
|
16
16
|
export declare const recommendationsDescription = "Use constructor's recommendations service, with `\"type\": \"recommendations\"`";
|
|
17
|
+
export declare const displaySearchTermHighlightsDescription = "Use constructor's auto highlighting of words that match the search keyword, with `\"displaySearchTermHighlights\": true`";
|
|
17
18
|
export declare const customSectionDescription = "Use a custom section, by managing and passing your own data, with `\"type\": \"custom\"` and `\"data\":[{...}]`";
|
|
18
19
|
export declare const onFocusDescription = "Pass an `onFocus` callback function to execute some code each time the user applies focus to the text input field";
|
|
19
20
|
export declare const onChangeDescription = "Pass an `onChange` callback function to execute some code each time the user changes the value of the text input field";
|
package/lib/types/types.d.ts
CHANGED
package/lib/types/utils.d.ts
CHANGED
|
@@ -33,4 +33,5 @@ export declare const stringifyWithDefaults: (obj: {
|
|
|
33
33
|
export declare const disableStoryActions: (story: any) => void;
|
|
34
34
|
export declare const getCioClient: (apiKey?: string) => ConstructorIOClient | null;
|
|
35
35
|
export declare const getActiveSectionsWithData: (activeSections: UserDefinedSection[], sectionResults: AutocompleteResultSections) => Section[];
|
|
36
|
+
export declare const escapeRegExp: (string: string) => string;
|
|
36
37
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructor-io/constructorio-ui-autocomplete",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "Constructor.io Autocomplete UI library for web applications",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
"build-storybook": "storybook build -o 'docs'",
|
|
35
35
|
"serve-built-storybook": "npx http-server docs",
|
|
36
36
|
"verify-node-version": "chmod +x ./scripts/verify-node-version.sh && ./scripts/verify-node-version.sh",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"preversion": "node ./src/generateVersion.js",
|
|
38
|
+
"version": "npm run preversion && npm run verify-node-version && npm run build-storybook && git add -u ./docs && git add ./docs/* && git add ./src/version.ts && npm run compile",
|
|
39
|
+
"compile": "node ./src/generateVersion.js && rm -rf lib && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && npm run copy-styles && vite build"
|
|
39
40
|
},
|
|
40
41
|
"author": "constructor.io",
|
|
41
42
|
"license": "MIT",
|