ublo-lib 1.47.92 → 1.47.93

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.
@@ -31,7 +31,18 @@ const SearchBar = ({ lang, resultFormatter, backdrop, OverrideIcons = {}, messag
31
31
  LoadIcon: LoaderIcon,
32
32
  };
33
33
  const Icons = Object.assign({}, DefaultIcons, OverrideIcons);
34
- const close = () => {
34
+ const close = (skipEvent = false) => {
35
+ if (!skipEvent) {
36
+ if (text?.length > 2) {
37
+ sendEvent("basic", "fail", {
38
+ query: text,
39
+ match_count: search?.result?.length,
40
+ });
41
+ }
42
+ else {
43
+ sendEvent("basic", "cancel");
44
+ }
45
+ }
35
46
  setText("");
36
47
  if (document.activeElement) {
37
48
  document.activeElement.blur();
@@ -85,17 +96,10 @@ const SearchBar = ({ lang, resultFormatter, backdrop, OverrideIcons = {}, messag
85
96
  const handleBlur = () => {
86
97
  if (text?.length > 2) {
87
98
  const event = search?.result?.length === 0 ? "Search failed" : "Search canceled";
88
- sendEvent("basic", "fail", {
89
- query: text,
90
- match_count: search?.result?.length,
91
- });
92
99
  Plausible.sendGoal(event, {
93
100
  Terms: text,
94
101
  });
95
102
  }
96
- else {
97
- sendEvent("basic", "cancel");
98
- }
99
103
  };
100
104
  const focusInput = (focus = true) => {
101
105
  sendEvent("basic", "load");
@@ -139,7 +143,7 @@ const SearchBar = ({ lang, resultFormatter, backdrop, OverrideIcons = {}, messag
139
143
  "search-bar--opened": results.length > 0,
140
144
  "search-bar--loading": search?.loading,
141
145
  });
142
- return (_jsxs("div", { className: classes, children: [backdrop && _jsx("div", { className: "search-bar__backdrop", onClick: close }), _jsxs("div", { className: "search-bar__input-container", children: [_jsx("input", { ref: input, type: "text", value: text, onChange: updateSearch, onFocus: focusInput, onKeyDown: handleKeyDown, className: "search-bar__input", placeholder: message(ubloLang, "what-are-you-looking-for", messages), onBlur: handleBlur }), _jsx(Icon, { className: "search-bar__icon" }), _jsxs("div", { ref: resultsContainer, className: "search-bar__results", children: [results?.map((result, i) => {
146
+ return (_jsxs("div", { className: classes, onFocus: focusInput, children: [backdrop && _jsx("div", { className: "search-bar__backdrop", onClick: close }), _jsxs("div", { className: "search-bar__input-container", children: [_jsx("input", { ref: input, type: "text", value: text, onChange: updateSearch, onKeyDown: handleKeyDown, className: "search-bar__input", placeholder: message(ubloLang, "what-are-you-looking-for", messages), onBlur: handleBlur }), _jsx(Icon, { className: "search-bar__icon" }), _jsxs("div", { ref: resultsContainer, className: "search-bar__results", children: [results?.map((result, i) => {
143
147
  const { name, title, page, path } = result;
144
148
  const externalLink = page === undefined;
145
149
  const Tag = externalLink ? "a" : Link;
@@ -167,7 +171,7 @@ const SearchBar = ({ lang, resultFormatter, backdrop, OverrideIcons = {}, messag
167
171
  });
168
172
  };
169
173
  const onClick = () => {
170
- close();
174
+ close(false);
171
175
  sendPlausibleGoal();
172
176
  };
173
177
  const props = externalLink ? anchorProps : linkProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.47.92",
3
+ "version": "1.47.93",
4
4
  "peerDependencies": {
5
5
  "classnames": "^2.5.1",
6
6
  "dt-design-system": "^3.12.0",