@constructor-io/constructorio-ui-autocomplete 1.23.10 → 1.23.11

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.
@@ -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(react_1.default.Fragment, null,
18
- 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' }),
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 && ((_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' })),
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 && ((_d = item.data) === null || _d === void 0 ? void 0 : _d.total_num_results) && (react_1.default.createElement("p", { className: 'cio-suggestion-count' },
34
- "(", (_e = item.data) === null || _e === void 0 ? void 0 :
35
- _e.total_num_results,
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 {
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.23.10';
3
+ exports.default = '1.23.11';
@@ -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(React.Fragment, null,
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 +1 @@
1
- export default '1.23.10';
1
+ export default '1.23.11';
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 {
@@ -1,2 +1,2 @@
1
- declare const _default: "1.23.10";
1
+ declare const _default: "1.23.11";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-ui-autocomplete",
3
- "version": "1.23.10",
3
+ "version": "1.23.11",
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",