@appbaseio/reactivesearch-vue 3.0.0-rc.5.alpha.4 → 3.0.0-rc.6

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 (67) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +39803 -35283
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +32 -32
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-d4da7470.js → Button-9e179864.js} +13 -6
  6. package/dist/cjs/{ComponentWrapper-9146d811.js → ComponentWrapper-0b9ffb1a.js} +3 -0
  7. package/dist/cjs/DropDown-aef75c14.js +702 -0
  8. package/dist/cjs/DynamicRangeSlider.js +1 -1
  9. package/dist/cjs/{Input-497be42a.js → Input-56eba499.js} +71 -1
  10. package/dist/cjs/MultiDropdownList.js +6 -6
  11. package/dist/cjs/MultiList.js +3 -3
  12. package/dist/cjs/MultiRange.js +2 -2
  13. package/dist/cjs/{Pagination-b953a80a.js → Pagination-58a0cf3f.js} +2 -2
  14. package/dist/cjs/RangeInput.js +3 -3
  15. package/dist/cjs/RangeSlider.js +2 -2
  16. package/dist/cjs/ReactiveBase.js +4 -4
  17. package/dist/cjs/ReactiveComponent.js +2 -2
  18. package/dist/cjs/ReactiveGoogleMap.js +6 -5
  19. package/dist/cjs/ReactiveList.js +4 -4
  20. package/dist/cjs/ResultCard.js +1 -1
  21. package/dist/cjs/ResultList.js +1 -1
  22. package/dist/cjs/SelectedFilters.js +3 -2
  23. package/dist/cjs/SingleDropdownList.js +6 -6
  24. package/dist/cjs/SingleList.js +3 -3
  25. package/dist/cjs/SingleRange.js +2 -2
  26. package/dist/cjs/ToggleButton.js +4 -3
  27. package/dist/cjs/index.js +14 -13
  28. package/dist/cjs/install-70991c13.js +3820 -0
  29. package/dist/cjs/install.js +9 -9
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/cjs/{vueTypes-1bf00978.js → vueTypes-a5f1745e.js} +18 -0
  32. package/dist/es/{Button-fd869491.js → Button-c2ff5178.js} +13 -6
  33. package/dist/es/{ComponentWrapper-8a3c388d.js → ComponentWrapper-a2635cfc.js} +3 -0
  34. package/dist/es/DropDown-39fedff8.js +693 -0
  35. package/dist/es/DynamicRangeSlider.js +1 -1
  36. package/dist/es/{Input-f7499ef8.js → Input-11d211d2.js} +71 -2
  37. package/dist/es/MultiDropdownList.js +6 -6
  38. package/dist/es/MultiList.js +3 -3
  39. package/dist/es/MultiRange.js +2 -2
  40. package/dist/es/{Pagination-c2745bec.js → Pagination-ae401c33.js} +2 -2
  41. package/dist/es/RangeInput.js +3 -3
  42. package/dist/es/RangeSlider.js +2 -2
  43. package/dist/es/ReactiveBase.js +4 -4
  44. package/dist/es/ReactiveComponent.js +2 -2
  45. package/dist/es/ReactiveGoogleMap.js +6 -5
  46. package/dist/es/ReactiveList.js +4 -4
  47. package/dist/es/ResultCard.js +1 -1
  48. package/dist/es/ResultList.js +1 -1
  49. package/dist/es/SelectedFilters.js +3 -2
  50. package/dist/es/SingleDropdownList.js +6 -6
  51. package/dist/es/SingleList.js +3 -3
  52. package/dist/es/SingleRange.js +2 -2
  53. package/dist/es/ToggleButton.js +4 -3
  54. package/dist/es/index.js +11 -11
  55. package/dist/es/install-8296e8da.js +3812 -0
  56. package/dist/es/install.js +9 -9
  57. package/dist/es/version.js +1 -1
  58. package/dist/es/{vueTypes-f1923c72.js → vueTypes-09cab4d3.js} +18 -0
  59. package/package.json +7 -5
  60. package/dist/cjs/CancelSvg-ab0f8b23.js +0 -409
  61. package/dist/cjs/DropDown-e7125b72.js +0 -299
  62. package/dist/cjs/SearchBox.js +0 -1853
  63. package/dist/cjs/install-3c4520bf.js +0 -874
  64. package/dist/es/CancelSvg-e7ae49e9.js +0 -401
  65. package/dist/es/DropDown-13afb4d2.js +0 -295
  66. package/dist/es/SearchBox.js +0 -1847
  67. package/dist/es/install-ff8b0750.js +0 -868
@@ -1,1853 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var reactivecore = require('@appbaseio/reactivecore');
8
- var constants = require('@appbaseio/reactivecore/lib/utils/constants');
9
- var _transformOn = _interopDefault(require('@vue/babel-helper-vue-transform-on'));
10
- var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-f8b843f8.js');
11
- var vue = require('vue');
12
- var VueTypes = _interopDefault(require('vue-types'));
13
- var helper = require('@appbaseio/reactivecore/lib/utils/helper');
14
- var vueEmotion = require('@appbaseio/vue-emotion');
15
- var css = require('@emotion/css');
16
- require('polished');
17
- var Button = require('./Button-d4da7470.js');
18
- var vueTypes = require('./vueTypes-1bf00978.js');
19
- require('@appbaseio/reactivecore/lib/utils/transform');
20
- require('redux');
21
- var index = require('./index-779ed366.js');
22
- var ComponentWrapper = require('./ComponentWrapper-9146d811.js');
23
- var PreferencesConsumer = require('./PreferencesConsumer-85dee673.js');
24
- var Title = require('./Title-8802a218.js');
25
- var Flex = require('./Flex-ddde6d26.js');
26
- var hotkeys = _interopDefault(require('hotkeys-js'));
27
- var CancelSvg = require('./CancelSvg-ab0f8b23.js');
28
- var Input = require('./Input-497be42a.js');
29
- require('compute-scroll-into-view');
30
- var Container = require('./Container-29f049b2.js');
31
- var Highlight = _interopDefault(require('vue-highlight-words'));
32
-
33
- var _templateObject;
34
- var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
35
- InputGroup.defaultProps = {
36
- className: 'input-group'
37
- };
38
-
39
- var _templateObject$1;
40
- var InputAddon = vueEmotion.styled('span')(_templateObject$1 || (_templateObject$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid #ccc;\n border-radius: 2px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 400;\n padding: 0 11px;\n position: relative;\n transition: all 0.3s;\n box-sizing: border-box;\n overflow: hidden;\n\n &:first-of-type {\n border-right: none;\n }\n &:last-of-type {\n border-left: none;\n }\n"])));
41
- InputAddon.defaultProps = {
42
- className: 'input-addon'
43
- };
44
-
45
- var getClassName = reactivecore.helper.getClassName;
46
- var SuggestionWrapper = {
47
- name: 'SuggestionWrapper',
48
- props: {
49
- innerClassName: vueTypes.types.string,
50
- themePreset: vueTypes.types.themePreset,
51
- innerClass: vueTypes.types.style
52
- },
53
- render: function render() {
54
- var _this$$props = this.$props,
55
- themePreset = _this$$props.themePreset,
56
- innerClass = _this$$props.innerClass,
57
- innerClassName = _this$$props.innerClassName;
58
- return vue.createVNode("div", {
59
- "class": Input.noSuggestions(themePreset) + " " + getClassName(innerClass, innerClassName || '')
60
- }, [vue.createVNode("li", null, [this.$slots["default"]()])]);
61
- }
62
- };
63
-
64
- var _templateObject$2;
65
- var highlightStyle = {
66
- fontWeight: 600,
67
- padding: 0,
68
- backgroundColor: 'transparent',
69
- color: 'inherit'
70
- };
71
- var PredictiveSuggestion = vueEmotion.styled('span')(_templateObject$2 || (_templateObject$2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t.highlight {\n\t\tbackground: transparent;\n\t\tcolor: inherit;\n\t\tfont-weight: 600;\n\t\tpadding: 0;\n\t}\n"])));
72
- var SuggestionItem = {
73
- name: 'SuggestionItem',
74
- props: {
75
- currentValue: vueTypes.types.string,
76
- suggestion: vueTypes.types.any
77
- },
78
- render: function render() {
79
- var _this = this;
80
- var _this$suggestion = this.suggestion,
81
- label = _this$suggestion.label,
82
- value = _this$suggestion.value,
83
- title = _this$suggestion.title,
84
- description = _this$suggestion.description,
85
- image = _this$suggestion.image,
86
- isPredictiveSuggestion = _this$suggestion.isPredictiveSuggestion,
87
- _suggestion_type = _this$suggestion._suggestion_type,
88
- _category = _this$suggestion._category;
89
- if (label) {
90
- // label has highest precedence
91
- return typeof label === 'string' ? vue.createVNode("div", {
92
- "class": "trim"
93
- }, [(_category ? false : isPredictiveSuggestion
94
- // eslint-disable-next-line
95
- || !!_suggestion_type) ? vue.createVNode(PredictiveSuggestion, {
96
- "innerHTML": label
97
- }, null) : vue.createVNode(Highlight, {
98
- "searchWords": _category ? [_category] : this.currentValue.split(' '),
99
- "textToHighlight": label,
100
- "autoEscape": true,
101
- "highlightStyle": highlightStyle
102
- }, null)]) : label;
103
- }
104
- if (title || image || description) {
105
- return vue.createVNode(Flex.Flex, {
106
- "alignItems": "center",
107
- "css": {
108
- width: '100%'
109
- }
110
- }, {
111
- "default": function _default() {
112
- return [image && vue.createVNode("div", {
113
- "css": {
114
- margin: 'auto',
115
- marginRight: 10
116
- }
117
- }, [vue.createVNode("img", {
118
- "src": image,
119
- "alt": " ",
120
- "height": "50px",
121
- "width": "50px",
122
- "css": {
123
- objectFit: 'contain'
124
- }
125
- }, null)]), vue.createVNode(Flex.Flex, {
126
- "direction": "column",
127
- "css": {
128
- width: image ? 'calc(100% - 60px)' : '100%'
129
- }
130
- }, {
131
- "default": function _default() {
132
- return [title && vue.createVNode("div", {
133
- "class": "trim"
134
- }, [vue.createVNode(Highlight, {
135
- "searchWords": _this.currentValue.split(' '),
136
- "textToHighlight": title,
137
- "highlightStyle": highlightStyle,
138
- "class": css.css({
139
- fontSize: '1rem'
140
- })
141
- }, null)]), description && vue.createVNode("div", {
142
- "class": ['trim', css.css({
143
- marginTop: 3
144
- })]
145
- }, [vue.createVNode(Highlight, {
146
- "searchWords": _this.currentValue.split(' '),
147
- "textToHighlight": description,
148
- "highlightStyle": highlightStyle
149
- }, null)])];
150
- }
151
- })];
152
- }
153
- });
154
- }
155
- return value;
156
- }
157
- };
158
-
159
- var SearchSvg = {
160
- name: 'SearchSvg',
161
- props: ['styles'],
162
- render: function render() {
163
- return vue.createVNode("svg", {
164
- "alt": "Search",
165
- "class": "search-icon",
166
- "height": "12",
167
- "xmlns": "http://www.w3.org/2000/svg",
168
- "viewBox": "0 0 15 15",
169
- "style": _rollupPluginBabelHelpers._extends({
170
- transform: 'scale(1.35)',
171
- position: 'relative'
172
- }, this.$props.styles ? this.$props.styles : {})
173
- }, [vue.createVNode("title", null, [vue.createTextVNode("Search")]), vue.createVNode("path", {
174
- "d": 'M6.02945,10.20327a4.17382,4.17382,0,1,1,4.17382-4.17382A4.15609,4.15609,0,0,1,6.02945,10.20327Zm9.69195,4.2199L10.8989,9.59979A5.88021,5.88021,0,0,0,12.058,6.02856,6.00467,6.00467,0,1,0,9.59979,10.8989l4.82338,4.82338a.89729.89729,0,0,0,1.29912,0,.89749.89749,0,0,0-.00087-1.29909Z'
175
- }, null)]);
176
- }
177
- };
178
-
179
- var _templateObject$3;
180
-
181
- // eslint-disable-next-line
182
- vueEmotion.createGlobalStyle(_templateObject$3 || (_templateObject$3 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t#el_TvxDfTAtKp {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_D93PK3GbmJ {\n\t\t-webkit-transform: translate(163px, 131px);\n\t\ttransform: translate(163px, 131px);\n\t\tfill: #d8d8d8;\n\t}\n"])));
183
- var MicSvg = {
184
- name: 'MicSvg',
185
- props: ['className'],
186
- render: function render() {
187
- return vue.createVNode("svg", {
188
- "viewBox": "0 0 480 480",
189
- "xmlns": "http://www.w3.org/2000/svg",
190
- "id": "el_xS0FRzQjJ",
191
- "width": 28,
192
- "height": 28,
193
- "className": this.$props.className,
194
- "style": {
195
- transform: 'scale(1.5)'
196
- }
197
- }, [vue.createVNode("g", {
198
- "id": "el_TvxDfTAtKp",
199
- "fillRule": "evenodd"
200
- }, [vue.createVNode("g", {
201
- "id": "el_D93PK3GbmJ",
202
- "fillRule": "nonzero",
203
- "style": {
204
- fill: '#595959'
205
- }
206
- }, [vue.createVNode("path", {
207
- "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
208
- "id": "el_uly3EwA2O3"
209
- }, null), vue.createVNode("path", {
210
- "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,-2.84217094e-14 76.9864699,-2.84217094e-14 C55.8825877,-2.84217094e-14 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
211
- "id": "el_tnDbR4ytu4"
212
- }, null)])])]);
213
- }
214
- };
215
-
216
- var _templateObject$4;
217
-
218
- // eslint-disable-next-line
219
- vueEmotion.createGlobalStyle(_templateObject$4 || (_templateObject$4 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t#el_X81iT9kZYo {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_gMpyalCphp {\n\t\t-webkit-transform: translate(163px, 131px);\n\t\ttransform: translate(163px, 131px);\n\t}\n\t#el_c7H-3u-D4l {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_qhFcdAAFwo {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_M8X8g37WOI {\n\t\tstroke: #e83137;\n\t\tstroke-width: 21;\n\t}\n"])));
220
- var MuteSvg = {
221
- name: 'MuteSvg',
222
- props: ['className'],
223
- render: function render() {
224
- return vue.createVNode("svg", {
225
- "style": {
226
- transform: 'scale(1.5)'
227
- },
228
- "viewBox": "0 0 480 480",
229
- "xmlns": "http://www.w3.org/2000/svg",
230
- "id": "el_D1rEpH2zj",
231
- "width": 28,
232
- "height": 28,
233
- "className": this.$props.className
234
- }, [vue.createVNode("g", {
235
- "id": "el_X81iT9kZYo",
236
- "fillRule": "evenodd"
237
- }, [vue.createVNode("g", {
238
- "id": "el_gMpyalCphp"
239
- }, [vue.createVNode("path", {
240
- "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
241
- "id": "el_c7H-3u-D4l",
242
- "fillRule": "nonzero",
243
- "style": {
244
- fill: '#595959'
245
- }
246
- }, null), vue.createVNode("path", {
247
- "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,-2.84217094e-14 76.9864699,-2.84217094e-14 C55.8825877,-2.84217094e-14 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
248
- "id": "el_qhFcdAAFwo",
249
- "fillRule": "nonzero",
250
- "style": {
251
- fill: '#595959'
252
- }
253
- }, null), vue.createVNode("path", {
254
- "d": "M11.5,206.5 L142.5,12.5",
255
- "id": "el_M8X8g37WOI",
256
- "strokeLinecap": "round",
257
- "strokeLinejoin": "round"
258
- }, null)])])]);
259
- }
260
- };
261
-
262
- var _templateObject$5;
263
-
264
- // eslint-disable-next-line
265
- vueEmotion.createGlobalStyle(_templateObject$5 || (_templateObject$5 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t@-webkit-keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t13.89% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t13.89% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t27.78% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t27.78% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t41.67% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t41.67% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t55.56% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t55.56% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t69.44% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t69.44% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t83.33% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t83.33% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t97.22% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t97.22% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t#el_hiibMG0x- * {\n\t\t-webkit-animation-duration: 1.2s;\n\t\tanimation-duration: 1.2s;\n\t\t-webkit-animation-iteration-count: infinite;\n\t\tanimation-iteration-count: infinite;\n\t\t-webkit-animation-timing-function: cubic-bezier(0, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0, 0, 1, 1);\n\t}\n\t#el_QJeJ_2CDw5 {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_UYYCfubTRf {\n\t\t-webkit-transform: translate(163px, 123px);\n\t\ttransform: translate(163px, 123px);\n\t}\n\t#el_uzZNtK32Zi {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_EYKQ2N9Kgy {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_6SDP2LAgKC {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t}\n\t#el_-Vm65Ltfy7 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_q04iZcSim4 {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_6WKby7wXqV {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n\t\tanimation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_9bggsfQOtU {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_NKxqi9eIym {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_Wi-my975tM {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n\t\tanimation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_zclQ34fvf7 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_1OsvRT8HkeZ {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_DkfFFTaFxy8 {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n\t\tanimation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_aa9sjx4H0vA {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_tea114vWg0J {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_34IgwiMB5rf {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n\t\tanimation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_z5u6RAFhx7d {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_7nfuWmA5Uhy {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_DeebuCsPTGA {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n\t\tanimation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el__ZcqlS20zcw {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_8DnEQnD7VWV {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_ZOjjrPTvyrv {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n\t\tanimation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_FYYKCI_u24e {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_XZty4MnTp5Y {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_2FATegVmf0K {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n\t\tanimation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_RMT1KUfbdF8 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_RgLcovvFiO1 {\n\t\tfill: #d8d8d8;\n\t}\n"])));
266
- var ListenSvg = {
267
- name: 'ListenSvg',
268
- props: ['className'],
269
- render: function render() {
270
- return vue.createVNode("svg", {
271
- "viewBox": "0 0 480 480",
272
- "xmlns": "http://www.w3.org/2000/svg",
273
- "xmlnsXlink": "http://www.w3.org/1999/xlink",
274
- "id": "el_hiibMG0x-",
275
- "width": 28,
276
- "height": 29,
277
- "className": this.$props.className,
278
- "style": {
279
- transform: 'scale(1.5)'
280
- }
281
- }, [vue.createVNode("defs", null, [vue.createVNode("path", {
282
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
283
- "id": "path-1"
284
- }, null), vue.createVNode("path", {
285
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
286
- "id": "path-3"
287
- }, null), vue.createVNode("path", {
288
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
289
- "id": "path-5"
290
- }, null), vue.createVNode("path", {
291
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
292
- "id": "path-7"
293
- }, null), vue.createVNode("path", {
294
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
295
- "id": "path-9"
296
- }, null), vue.createVNode("path", {
297
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
298
- "id": "path-11"
299
- }, null), vue.createVNode("path", {
300
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
301
- "id": "path-13"
302
- }, null), vue.createVNode("path", {
303
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
304
- "id": "path-15"
305
- }, null)]), vue.createVNode("g", {
306
- "id": "el_QJeJ_2CDw5",
307
- "fillRule": "evenodd"
308
- }, [vue.createVNode("g", {
309
- "id": "el_UYYCfubTRf"
310
- }, [vue.createVNode("path", {
311
- "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
312
- "id": "el_uzZNtK32Zi",
313
- "fillRule": "nonzero",
314
- "style": {
315
- fill: '#0B6AFF'
316
- }
317
- }, null), vue.createVNode("path", {
318
- "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,0 76.9864699,0 C55.8825877,0 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
319
- "id": "el_EYKQ2N9Kgy",
320
- "fillRule": "nonzero"
321
- }, null), vue.createVNode("g", {
322
- "id": "el_6SDP2LAgKC"
323
- }, [vue.createVNode("mask", {
324
- "id": "mask-2",
325
- "fill": "#fff"
326
- }, [vue.createVNode("use", {
327
- "xlink:href": "#path-1"
328
- }, null)]), vue.createVNode("path", {
329
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
330
- "id": "el_-Vm65Ltfy7",
331
- "fillRule": "nonzero",
332
- "mask": "url(#mask-2)"
333
- }, null), vue.createVNode("rect", {
334
- "id": "el_q04iZcSim4",
335
- "mask": "url(#mask-2)",
336
- "x": "0.279",
337
- "width": "77",
338
- "height": "130"
339
- }, null)]), vue.createVNode("g", {
340
- "id": "el_6WKby7wXqV"
341
- }, [vue.createVNode("mask", {
342
- "id": "mask-4",
343
- "fill": "#fff"
344
- }, [vue.createVNode("use", {
345
- "xlink:href": "#path-3"
346
- }, null)]), vue.createVNode("path", {
347
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
348
- "id": "el_9bggsfQOtU",
349
- "fillRule": "nonzero",
350
- "mask": "url(#mask-4)"
351
- }, null), vue.createVNode("rect", {
352
- "id": "el_NKxqi9eIym",
353
- "mask": "url(#mask-4)",
354
- "x": "0.279",
355
- "width": "77",
356
- "height": "115"
357
- }, null)]), vue.createVNode("g", {
358
- "id": "el_Wi-my975tM"
359
- }, [vue.createVNode("mask", {
360
- "id": "mask-6",
361
- "fill": "#fff"
362
- }, [vue.createVNode("use", {
363
- "xlink:href": "#path-5"
364
- }, null)]), vue.createVNode("path", {
365
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
366
- "id": "el_zclQ34fvf7",
367
- "fillRule": "nonzero",
368
- "mask": "url(#mask-6)"
369
- }, null), vue.createVNode("rect", {
370
- "id": "el_1OsvRT8HkeZ",
371
- "mask": "url(#mask-6)",
372
- "x": "0.279",
373
- "width": "77",
374
- "height": "100"
375
- }, null)]), vue.createVNode("g", {
376
- "id": "el_DkfFFTaFxy8"
377
- }, [vue.createVNode("mask", {
378
- "id": "mask-8",
379
- "fill": "#fff"
380
- }, [vue.createVNode("use", {
381
- "xlink:href": "#path-7"
382
- }, null)]), vue.createVNode("path", {
383
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
384
- "id": "el_aa9sjx4H0vA",
385
- "fillRule": "nonzero",
386
- "mask": "url(#mask-8)"
387
- }, null), vue.createVNode("rect", {
388
- "id": "el_tea114vWg0J",
389
- "mask": "url(#mask-8)",
390
- "x": "0.279",
391
- "width": "77",
392
- "height": "85"
393
- }, null)]), vue.createVNode("g", {
394
- "id": "el_34IgwiMB5rf"
395
- }, [vue.createVNode("mask", {
396
- "id": "mask-10",
397
- "fill": "#fff"
398
- }, [vue.createVNode("use", {
399
- "xlink:href": "#path-9"
400
- }, null)]), vue.createVNode("path", {
401
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
402
- "id": "el_z5u6RAFhx7d",
403
- "fillRule": "nonzero",
404
- "mask": "url(#mask-10)"
405
- }, null), vue.createVNode("rect", {
406
- "id": "el_7nfuWmA5Uhy",
407
- "mask": "url(#mask-10)",
408
- "x": "0.279",
409
- "width": "77",
410
- "height": "70"
411
- }, null)]), vue.createVNode("g", {
412
- "id": "el_DeebuCsPTGA"
413
- }, [vue.createVNode("mask", {
414
- "id": "mask-12",
415
- "fill": "#fff"
416
- }, [vue.createVNode("use", {
417
- "xlink:href": "#path-11"
418
- }, null)]), vue.createVNode("path", {
419
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
420
- "id": "el__ZcqlS20zcw",
421
- "fillRule": "nonzero",
422
- "mask": "url(#mask-12)"
423
- }, null), vue.createVNode("rect", {
424
- "id": "el_8DnEQnD7VWV",
425
- "mask": "url(#mask-12)",
426
- "x": "0.279",
427
- "width": "77",
428
- "height": "55"
429
- }, null)]), vue.createVNode("g", {
430
- "id": "el_ZOjjrPTvyrv"
431
- }, [vue.createVNode("mask", {
432
- "id": "mask-14",
433
- "fill": "#fff"
434
- }, [vue.createVNode("use", {
435
- "xlink:href": "#path-13"
436
- }, null)]), vue.createVNode("path", {
437
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
438
- "id": "el_FYYKCI_u24e",
439
- "fillRule": "nonzero",
440
- "mask": "url(#mask-14)"
441
- }, null), vue.createVNode("rect", {
442
- "id": "el_XZty4MnTp5Y",
443
- "mask": "url(#mask-14)",
444
- "x": "0.279",
445
- "width": "77",
446
- "height": "40"
447
- }, null)]), vue.createVNode("g", {
448
- "id": "el_2FATegVmf0K"
449
- }, [vue.createVNode("mask", {
450
- "id": "mask-16",
451
- "fill": "#fff"
452
- }, [vue.createVNode("use", {
453
- "xlink:href": "#path-15"
454
- }, null)]), vue.createVNode("path", {
455
- "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
456
- "id": "el_RMT1KUfbdF8",
457
- "fillRule": "nonzero",
458
- "mask": "url(#mask-16)"
459
- }, null), vue.createVNode("rect", {
460
- "id": "el_RgLcovvFiO1",
461
- "mask": "url(#mask-16)",
462
- "x": "0.279",
463
- "width": "77",
464
- "height": "25"
465
- }, null)])])])]);
466
- }
467
- };
468
-
469
- var STATUS = {
470
- inactive: 'INACTIVE',
471
- stopped: 'STOPPED',
472
- active: 'ACTIVE',
473
- denied: 'DENIED'
474
- };
475
- var Mic = {
476
- name: 'Mic',
477
- props: {
478
- children: vueTypes.types.title,
479
- lang: VueTypes.string.def('en-US'),
480
- iconPosition: VueTypes.string.def('left'),
481
- handleResult: vueTypes.types.func,
482
- onNoMatch: vueTypes.types.func,
483
- onError: vueTypes.types.func,
484
- getInstance: vueTypes.types.func,
485
- render: vueTypes.types.func,
486
- className: vueTypes.types.string,
487
- applyClearStyle: VueTypes.bool,
488
- showIcon: VueTypes.bool
489
- },
490
- methods: {
491
- getComponent: function getComponent() {
492
- var status = this.$data.status;
493
- var data = {
494
- handleClick: this.handleClick,
495
- status: status
496
- };
497
- return index.getComponent(data, this);
498
- },
499
- stopMic: function stopMic() {
500
- if (this.instance) {
501
- this.status = STATUS.inactive;
502
- this.instance.stop();
503
- this.instance = null;
504
- }
505
- },
506
- handleClick: function handleClick() {
507
- var _this = this;
508
- this.results = [];
509
- if (window && window.SpeechRecognition) {
510
- var status = this.$data.status;
511
- if (status === STATUS.active) {
512
- this.status = STATUS.inactive;
513
- }
514
- var _this$$props = this.$props,
515
- handleResult = _this$$props.handleResult,
516
- onNoMatch = _this$$props.onNoMatch,
517
- onError = _this$$props.onError,
518
- lang = _this$$props.lang,
519
- getInstance = _this$$props.getInstance;
520
- var _window = window,
521
- SpeechRecognition = _window.SpeechRecognition;
522
- if (this.instance && this.status !== STATUS.denied) {
523
- this.status = STATUS.inactive;
524
- this.instance.stop();
525
- this.instance = null;
526
- return;
527
- }
528
- this.instance = new SpeechRecognition();
529
- this.instance.continuous = true;
530
- this.instance.interimResults = true;
531
- this.instance.lang = lang;
532
- if (getInstance) {
533
- getInstance(this.instance);
534
- }
535
- this.instance.start();
536
- this.instance.onstart = function () {
537
- _this.status = STATUS.active;
538
- };
539
- this.instance.onresult = function (_ref) {
540
- var results = _ref.results,
541
- timeStamp = _ref.timeStamp;
542
- _this.stopMic();
543
- if (handleResult) {
544
- handleResult({
545
- results: results,
546
- timeStamp: timeStamp
547
- });
548
- }
549
- _this.results.push({
550
- results: results,
551
- timeStamp: timeStamp
552
- });
553
- };
554
- this.instance.onnomatch = function (e) {
555
- return onNoMatch ? onNoMatch(e) : console.warn(e);
556
- };
557
- this.instance.onerror = function (e) {
558
- if (e.error === 'no-speech' || e.error === 'audio-capture') {
559
- _this.status = STATUS.inactive;
560
- } else if (e.error === 'not-allowed') {
561
- _this.status = STATUS.denied;
562
- }
563
- console.error(e);
564
- if (onError) {
565
- onError(e);
566
- }
567
- };
568
-
569
- /* Below Two methods run when Continuous is False */
570
- this.instance.onspeechend = function () {
571
- _this.status = STATUS.inactive;
572
- };
573
- this.instance.onaudioend = function () {
574
- _this.status = STATUS.inactive;
575
- };
576
- }
577
- }
578
- },
579
- computed: {
580
- hasCustomRenderer: function hasCustomRenderer() {
581
- return index.hasCustomRenderer(this);
582
- },
583
- Icon: function Icon() {
584
- var status = this.$data.status;
585
- var className = this.$props.className;
586
- switch (status) {
587
- case STATUS.active:
588
- return vue.createVNode(ListenSvg, {
589
- "className": className,
590
- "nativeOnClick": this.handleClick
591
- }, null);
592
- case STATUS.stopped:
593
- case STATUS.denied:
594
- return vue.createVNode(MuteSvg, {
595
- "className": className,
596
- "nativeOnClick": this.handleClick
597
- }, null);
598
- default:
599
- return vue.createVNode(MicSvg, {
600
- "className": className,
601
- "nativeOnClick": this.handleClick
602
- }, null);
603
- }
604
- }
605
- },
606
- data: function data() {
607
- return {
608
- status: STATUS.inactive
609
- };
610
- },
611
- created: function created() {
612
- this.results = [];
613
- if (typeof window !== 'undefined') {
614
- window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition || null;
615
- if (!window.SpeechRecognition) {
616
- console.error('SpeechRecognition is not supported in this browser. Please check the browser compatibility at https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition#Browser_compatibility.');
617
- }
618
- }
619
- },
620
- render: function render() {
621
- var _this2 = this;
622
- if (this.hasCustomRenderer) {
623
- return this.getComponent();
624
- }
625
- return vue.createVNode(CancelSvg.IconWrapper, null, {
626
- "default": function _default() {
627
- return [_this2.Icon];
628
- }
629
- });
630
- }
631
- };
632
-
633
- var CustomSvg = {
634
- name: 'CustomSvg',
635
- props: {
636
- className: String,
637
- icon: Function,
638
- type: String
639
- },
640
- data: function data() {
641
- return {
642
- customIcon: this.$props.icon && typeof this.$props.icon === 'function' ? this.$props.icon() : null
643
- };
644
- },
645
- render: function render() {
646
- if (this.customIcon) {
647
- return vue.createVNode("div", {
648
- "class": this.$props.className
649
- }, [this.customIcon]);
650
- }
651
- if (this.$props.type === 'recent-search-icon') {
652
- return vue.createVNode("svg", {
653
- "xmlns": "http://www.w3.org/2000/svg",
654
- "alt": "Recent Search",
655
- "height": "20",
656
- "width": "20",
657
- "viewBox": "0 0 24 24",
658
- "style": {
659
- fill: '#707070'
660
- },
661
- "class": this.$props.className
662
- }, [vue.createVNode("path", {
663
- "d": "M0 0h24v24H0z",
664
- "fill": "none"
665
- }, null), vue.createVNode("path", {
666
- "d": "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"
667
- }, null)]);
668
- }
669
- if (this.$props.type === 'promoted-search-icon') {
670
- return vue.createVNode("svg", {
671
- "xmlns": "http://www.w3.org/2000/svg",
672
- "width": "20",
673
- "alt": "promoted search",
674
- "height": "20",
675
- "viewBox": "0 0 24 24",
676
- "class": this.$props.className,
677
- "style": {
678
- fill: '#707070'
679
- }
680
- }, [vue.createVNode("path", {
681
- "d": "M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"
682
- }, null)]);
683
- }
684
- if (this.$props.type === 'popular-search-icon') {
685
- return vue.createVNode("svg", {
686
- "xmlns": "http://www.w3.org/2000/svg",
687
- "alt": "Popular Search",
688
- "height": "20",
689
- "width": "20",
690
- "viewBox": "0 0 24 24",
691
- "style": {
692
- fill: '#707070'
693
- },
694
- "class": this.$props.className
695
- }, [vue.createVNode("path", {
696
- "d": "M0 0h24v24H0z",
697
- "fill": "none"
698
- }, null), vue.createVNode("path", {
699
- "d": "M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"
700
- }, null)]);
701
- }
702
- return vue.createVNode(SearchSvg, {
703
- "styles": {
704
- position: 'relative',
705
- fill: '#707070',
706
- left: '3px',
707
- marginRight: '8px'
708
- }
709
- }, null);
710
- }
711
- };
712
-
713
- var _templateObject$6;
714
- var AutofillSvgIcon = vueEmotion.styled('button')(_templateObject$6 || (_templateObject$6 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmargin-left: auto;\n\tposition: relative;\n\tright: -3px;\n\tborder: none;\n\toutline: none;\n\tbackground: transparent;\n\tpadding: 0;\n\tz-index: 111000;\n\n\tsvg {\n\t\tcursor: pointer;\n\t\tfill: #707070;\n\t\theight: 20px;\n\t}\n\n\t&:hover {\n\t\tsvg {\n\t\t\tfill: #1c1a1a;\n\t\t}\n\t}\n"])));
715
- var AutoFillSvg = {
716
- name: 'AutoFillSvg',
717
- render: function render() {
718
- return vue.createVNode(AutofillSvgIcon, {
719
- "onClick": this.$attrs.click
720
- }, {
721
- "default": function _default() {
722
- return [vue.createVNode("svg", {
723
- "viewBox": "0 0 24 24"
724
- }, [vue.createVNode("path", {
725
- "d": "M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"
726
- }, null)])];
727
- }
728
- });
729
- },
730
- methods: {
731
- clicked: function clicked(e) {
732
- e.stopPropagation();
733
- window.console.log('hey', e);
734
- }
735
- }
736
- };
737
-
738
- var _templateObject$7, _templateObject2;
739
- var TagsContainer = vueEmotion.styled('div')(_templateObject$7 || (_templateObject$7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
740
- var TagItem = vueEmotion.styled('span')(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
741
-
742
- function _isSlot(s) {
743
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
744
- }
745
- var updateQuery = reactivecore.Actions.updateQuery,
746
- setCustomQuery = reactivecore.Actions.setCustomQuery,
747
- setDefaultQuery = reactivecore.Actions.setDefaultQuery,
748
- recordSuggestionClick = reactivecore.Actions.recordSuggestionClick;
749
- var _debounce = reactivecore.helper.debounce,
750
- checkValueChange = reactivecore.helper.checkValueChange,
751
- getClassName$1 = reactivecore.helper.getClassName,
752
- isEqual = reactivecore.helper.isEqual,
753
- getCompositeAggsQuery = reactivecore.helper.getCompositeAggsQuery,
754
- withClickIds = reactivecore.helper.withClickIds,
755
- getResultStats = reactivecore.helper.getResultStats;
756
- var SearchBox = vue.defineComponent({
757
- name: 'SearchBox',
758
- isTagsMode: false,
759
- data: function data() {
760
- var props = this.$props;
761
- this.__state = {
762
- currentValue: '',
763
- selectedTags: [],
764
- isOpen: false,
765
- normalizedSuggestions: []
766
- };
767
- this.internalComponent = props.componentId + "__internal";
768
- return this.__state;
769
- },
770
- inject: {
771
- theme: {
772
- from: 'theme_reactivesearch'
773
- }
774
- },
775
- created: function created() {
776
- var mode = this.$props.mode;
777
- if (mode === constants.SEARCH_COMPONENTS_MODES.TAG) {
778
- this.$options.isTagsMode = true;
779
- }
780
- if (this.$options.isTagsMode) {
781
- console.warn('Warning(ReactiveSearch): The `categoryField` prop is not supported when `mode` prop is set to `tag`');
782
- }
783
- this.currentValue = index.decodeHtml(this.selectedValue || this.value || this.defaultValue || '');
784
- if (this.$options.isTagsMode) {
785
- this.currentValue = '';
786
- }
787
- this.handleTextChange = _debounce(this.handleText, this.$props.debounce);
788
-
789
- // Set custom and default queries in store
790
- this.triggerCustomQuery(this.currentValue, this.selectedCategory);
791
- this.triggerDefaultQuery(this.currentValue);
792
- if (this.selectedValue) {
793
- this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? reactivecore.causes.SUGGESTION_SELECT : undefined);
794
- } else if (this.$props.value) {
795
- this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? reactivecore.causes.SUGGESTION_SELECT : undefined);
796
- } else if (this.$props.defaultValue) {
797
- this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? reactivecore.causes.SUGGESTION_SELECT : undefined);
798
- }
799
- },
800
- computed: {
801
- hasCustomRenderer: function hasCustomRenderer() {
802
- return index.hasCustomRenderer(this);
803
- },
804
- stats: function stats() {
805
- return getResultStats(this);
806
- }
807
- },
808
- props: {
809
- autoFocus: VueTypes.bool,
810
- autosuggest: VueTypes.bool.def(true),
811
- beforeValueChange: vueTypes.types.func,
812
- className: VueTypes.string.def(''),
813
- clearIcon: vueTypes.types.children,
814
- componentId: vueTypes.types.stringRequired,
815
- customHighlight: vueTypes.types.func,
816
- customQuery: vueTypes.types.func,
817
- defaultQuery: vueTypes.types.func,
818
- dataField: VueTypes.oneOfType([VueTypes.string, VueTypes.shape({
819
- field: VueTypes.string,
820
- weight: VueTypes.number
821
- }), VueTypes.arrayOf(VueTypes.string), VueTypes.arrayOf({
822
- field: VueTypes.string,
823
- weight: VueTypes.number
824
- })]),
825
- aggregationField: vueTypes.types.string,
826
- aggregationSize: VueTypes.number,
827
- size: VueTypes.number,
828
- debounce: VueTypes.number.def(0),
829
- defaultValue: vueTypes.types.string,
830
- excludeFields: vueTypes.types.excludeFields,
831
- value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), vueTypes.types.value]),
832
- defaultSuggestions: vueTypes.types.suggestions,
833
- enableSynonyms: VueTypes.bool.def(true),
834
- enableQuerySuggestions: VueTypes.bool.def(false),
835
- enablePopularSuggestions: VueTypes.bool.def(false),
836
- enableRecentSuggestions: VueTypes.bool.def(false),
837
- fieldWeights: vueTypes.types.fieldWeights,
838
- filterLabel: vueTypes.types.string,
839
- fuzziness: vueTypes.types.fuzziness,
840
- highlight: VueTypes.bool,
841
- highlightField: vueTypes.types.stringOrArray,
842
- icon: vueTypes.types.children,
843
- iconPosition: VueTypes.oneOf(['left', 'right']).def('left'),
844
- includeFields: vueTypes.types.includeFields,
845
- innerClass: vueTypes.types.style,
846
- innerRef: VueTypes.string.def('searchInputField'),
847
- render: vueTypes.types.func,
848
- renderNoSuggestion: vueTypes.types.title,
849
- renderError: vueTypes.types.title,
850
- placeholder: VueTypes.string.def('Search'),
851
- queryFormat: VueTypes.oneOf(['and', 'or']).def('or'),
852
- react: vueTypes.types.react,
853
- showClear: VueTypes.bool.def(true),
854
- showDistinctSuggestions: VueTypes.bool.def(true),
855
- showFilter: VueTypes.bool.def(true),
856
- showIcon: VueTypes.bool.def(true),
857
- title: vueTypes.types.title,
858
- URLParams: VueTypes.bool.def(false),
859
- strictSelection: VueTypes.bool.def(false),
860
- nestedField: vueTypes.types.string,
861
- enablePredictiveSuggestions: VueTypes.bool.def(false),
862
- recentSearchesIcon: VueTypes.any,
863
- popularSearchesIcon: VueTypes.any,
864
- // mic props
865
- showVoiceSearch: VueTypes.bool.def(false),
866
- getMicInstance: vueTypes.types.func,
867
- renderMic: vueTypes.types.func,
868
- distinctField: vueTypes.types.string,
869
- distinctFieldConfig: vueTypes.types.props,
870
- //
871
- focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
872
- addonBefore: VueTypes.any,
873
- addonAfter: VueTypes.any,
874
- expandSuggestionsContainer: VueTypes.bool.def(true),
875
- index: VueTypes.string,
876
- popularSuggestionsConfig: VueTypes.object,
877
- recentSuggestionsConfig: VueTypes.object,
878
- applyStopwords: VueTypes.bool,
879
- customStopwords: vueTypes.types.stringArray,
880
- onData: vueTypes.types.func,
881
- renderItem: vueTypes.types.func,
882
- enterButton: VueTypes.bool.def(false),
883
- renderEnterButton: VueTypes.any,
884
- mode: VueTypes.oneOf(['select', 'tag']).def('select'),
885
- renderSelectedTags: VueTypes.any,
886
- searchboxId: VueTypes.string,
887
- endpoint: vueTypes.types.endpointConfig
888
- },
889
- mounted: function mounted() {
890
- this.listenForFocusShortcuts();
891
- },
892
- watch: {
893
- dataField: function dataField(newVal, oldVal) {
894
- if (!isEqual(newVal, oldVal)) {
895
- this.triggerCustomQuery(this.$data.currentValue);
896
- }
897
- },
898
- fieldWeights: function fieldWeights() {
899
- this.triggerCustomQuery(this.$data.currentValue);
900
- },
901
- fuzziness: function fuzziness() {
902
- this.triggerCustomQuery(this.$data.currentValue);
903
- },
904
- queryFormat: function queryFormat() {
905
- this.triggerCustomQuery(this.$data.currentValue);
906
- },
907
- defaultValue: function defaultValue(newVal) {
908
- this.setValue(newVal, true, this.$props);
909
- },
910
- value: function value(newVal, oldVal) {
911
- if (!isEqual(newVal, oldVal)) {
912
- this.setValue(newVal, true, this.$props, newVal === '' ? reactivecore.causes.CLEAR_VALUE : undefined, false);
913
- }
914
- },
915
- defaultQuery: function defaultQuery(newVal, oldVal) {
916
- if (!index.isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
917
- this.triggerDefaultQuery(this.$data.currentValue);
918
- }
919
- },
920
- customQuery: function customQuery(newVal, oldVal) {
921
- if (!index.isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
922
- this.triggerCustomQuery(this.$data.currentValue);
923
- }
924
- },
925
- suggestions: function suggestions(newVal) {
926
- var suggestionsList = [];
927
- if (Array.isArray(newVal) && newVal.length) {
928
- suggestionsList = [].concat(withClickIds(newVal));
929
- } else if (Array.isArray(this.$props.defaultSuggestions) && this.$props.defaultSuggestions.length) {
930
- suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
931
- }
932
- this.normalizedSuggestions = suggestionsList;
933
- },
934
- selectedValue: function selectedValue(newVal, oldVal) {
935
- if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
936
- if (!newVal && this.$data.currentValue) {
937
- // selected value is cleared, call onValueSelected
938
- this.onValueSelectedHandler('', reactivecore.causes.CLEAR_VALUE);
939
- }
940
- if (this.$options.isTagsMode) {
941
- // handling reset of tags through SelectedFilters or URL
942
- this.selectedTags = [];
943
- }
944
- var cause = !newVal ? reactivecore.causes.CLEAR_VALUE : undefined;
945
- if (this.$options.isTagsMode) {
946
- cause = reactivecore.causes.SUGGESTION_SELECT;
947
- }
948
- this.setValue(newVal || '', true, this.$props, cause);
949
- }
950
- },
951
- focusShortcuts: function focusShortcuts() {
952
- this.listenForFocusShortcuts();
953
- },
954
- rawData: function rawData(newVal) {
955
- this.$emit('on-data', {
956
- data: this.normalizedSuggestions,
957
- rawData: newVal,
958
- aggregationData: this.aggregationData,
959
- loading: this.isLoading,
960
- error: this.isError
961
- });
962
- },
963
- aggregationData: function aggregationData(newVal) {
964
- this.$emit('on-data', {
965
- data: this.normalizedSuggestions,
966
- rawData: this.rawData,
967
- aggregationData: newVal,
968
- loading: this.isLoading,
969
- error: this.isError
970
- });
971
- },
972
- loading: function loading(newVal) {
973
- this.$emit('on-data', {
974
- data: this.normalizedSuggestions,
975
- rawData: this.rawData,
976
- aggregationData: this.aggregationData,
977
- loading: newVal,
978
- error: this.isError
979
- });
980
- },
981
- error: function error(newVal) {
982
- this.$emit('on-data', {
983
- data: this.normalizedSuggestions,
984
- rawData: this.rawData,
985
- aggregationData: this.aggregationData,
986
- loading: this.isLoading,
987
- error: newVal
988
- });
989
- },
990
- debounce: function debounce(newVal, oldVal) {
991
- if (!isEqual(newVal, oldVal)) {
992
- this.handleTextChange = _debounce(this.handleText, newVal);
993
- }
994
- }
995
- },
996
- methods: {
997
- handleText: function handleText(value, cause) {
998
- if (cause === reactivecore.causes.CLEAR_VALUE) {
999
- this.triggerCustomQuery(value);
1000
- this.triggerDefaultQuery(value);
1001
- } else if (this.$props.autosuggest) {
1002
- this.triggerDefaultQuery(value);
1003
- } else if (!this.$props.enterButton) {
1004
- this.triggerCustomQuery(value);
1005
- }
1006
- },
1007
- getComponent: function getComponent(downshiftProps) {
1008
- if (downshiftProps === void 0) {
1009
- downshiftProps = {};
1010
- }
1011
- var currentValue = this.$data.currentValue;
1012
- var data = {
1013
- error: this.error,
1014
- loading: this.isLoading,
1015
- downshiftProps: downshiftProps,
1016
- data: this.normalizedSuggestions,
1017
- rawData: this.rawData,
1018
- value: currentValue,
1019
- resultStats: this.stats
1020
- };
1021
- return index.getComponent(data, this);
1022
- },
1023
- // returns size and aggs property
1024
- getBasicQueryOptions: function getBasicQueryOptions() {
1025
- var aggregationField = this.$props.aggregationField;
1026
- var queryOptions = helper.getQueryOptions(this.$props);
1027
- if (aggregationField) {
1028
- queryOptions.aggs = getCompositeAggsQuery({
1029
- props: this.$props,
1030
- showTopHits: true
1031
- }).aggs;
1032
- }
1033
- return queryOptions;
1034
- },
1035
- handleSearchIconClick: function handleSearchIconClick() {
1036
- var currentValue = this.currentValue;
1037
- if (currentValue.trim()) {
1038
- this.setValue(currentValue, true);
1039
- this.onValueSelectedHandler(currentValue, reactivecore.causes.SEARCH_ICON_CLICK);
1040
- }
1041
- },
1042
- setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1043
- var _this = this;
1044
- if (isDefaultValue === void 0) {
1045
- isDefaultValue = false;
1046
- }
1047
- if (props === void 0) {
1048
- props = this.$props;
1049
- }
1050
- if (toggleIsOpen === void 0) {
1051
- toggleIsOpen = true;
1052
- }
1053
- if (categoryValue === void 0) {
1054
- categoryValue = undefined;
1055
- }
1056
- var performUpdate = function performUpdate() {
1057
- if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
1058
- return;
1059
- }
1060
- if (_this.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1061
- if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1062
- // check if value already present in selectedTags
1063
- if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1064
- _this.isOpen = false;
1065
- return;
1066
- }
1067
- _this.selectedTags = [].concat(_this.selectedTags);
1068
- if (typeof value === 'string' && !!value) {
1069
- _this.selectedTags.push(value);
1070
- } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1071
- _this.selectedTags = value;
1072
- }
1073
- } else if (value) {
1074
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1075
- }
1076
- _this.currentValue = '';
1077
- } else {
1078
- _this.currentValue = index.decodeHtml(value);
1079
- }
1080
- var queryHandlerValue = value;
1081
- if (_this.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1082
- queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1083
- }
1084
- if (isDefaultValue) {
1085
- if (_this.$props.autosuggest) {
1086
- if (toggleIsOpen) {
1087
- _this.isOpen = false;
1088
- }
1089
- if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
1090
- } // in case of strict selection only SUGGESTION_SELECT should be able
1091
- // to set the query otherwise the value should reset
1092
- if (props.strictSelection) {
1093
- if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1094
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1095
- } else {
1096
- _this.setValue('', true);
1097
- }
1098
- } else if (props.value === undefined || cause === reactivecore.causes.SUGGESTION_SELECT || cause === reactivecore.causes.CLEAR_VALUE) {
1099
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1100
- }
1101
- } else {
1102
- // debounce for handling text while typing
1103
- _this.handleTextChange(value, cause);
1104
- }
1105
- _this.$emit('valueChange', value);
1106
- _this.$emit('value-change', value);
1107
- };
1108
- checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1109
- },
1110
- triggerDefaultQuery: function triggerDefaultQuery(paramValue) {
1111
- if (!this.$props.autosuggest) {
1112
- return;
1113
- }
1114
- var value = typeof paramValue !== 'string' ? this.currentValue : paramValue;
1115
- var query = SearchBox.defaultQuery(value, this.$props);
1116
- if (this.defaultQuery) {
1117
- var defaultQueryToBeSet = this.defaultQuery(value, this.$props) || {};
1118
- if (defaultQueryToBeSet.query) {
1119
- query = defaultQueryToBeSet.query;
1120
- }
1121
-
1122
- // Update calculated default query in store
1123
- index.updateDefaultQuery(this.$props.componentId, this.setDefaultQuery, this.$props, value);
1124
- }
1125
- this.updateQuery({
1126
- componentId: this.internalComponent,
1127
- query: query,
1128
- value: value,
1129
- componentType: constants.componentTypes.searchBox
1130
- });
1131
- },
1132
- triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
1133
- if (categoryValue === void 0) {
1134
- categoryValue = undefined;
1135
- }
1136
- var _this$$props = this.$props,
1137
- customQuery = _this$$props.customQuery,
1138
- filterLabel = _this$$props.filterLabel,
1139
- showFilter = _this$$props.showFilter,
1140
- URLParams = _this$$props.URLParams;
1141
- var value = typeof paramValue !== 'string' ? this.$data.currentValue : paramValue;
1142
- if (this.$options.isTagsMode) {
1143
- value = paramValue;
1144
- }
1145
- var defaultQueryTobeSet = SearchBox.defaultQuery("" + value + (categoryValue ? " in " + categoryValue : ''), this.$props);
1146
- var query = defaultQueryTobeSet;
1147
- if (customQuery) {
1148
- var customQueryTobeSet = customQuery(value, this.$props);
1149
- var queryTobeSet = customQueryTobeSet.query;
1150
- if (queryTobeSet) {
1151
- query = queryTobeSet;
1152
- }
1153
- index.updateCustomQuery(this.$props.componentId, this.setCustomQuery, this.$props, value);
1154
- }
1155
- this.updateQuery({
1156
- componentId: this.$props.componentId,
1157
- query: query,
1158
- value: value,
1159
- label: filterLabel,
1160
- showFilter: showFilter,
1161
- URLParams: URLParams,
1162
- componentType: constants.componentTypes.searchBox,
1163
- category: categoryValue
1164
- });
1165
- },
1166
- handleFocus: function handleFocus(event) {
1167
- if (this.$props.autosuggest) {
1168
- this.isOpen = true;
1169
- }
1170
- this.$emit('focus', event);
1171
- },
1172
- handleVoiceResults: function handleVoiceResults(_ref) {
1173
- var results = _ref.results;
1174
- if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1175
- this.setValue(results[0][0].transcript.trim(), true);
1176
- }
1177
- },
1178
- triggerQuery: function triggerQuery(_ref2) {
1179
- var _ref2$isOpen = _ref2.isOpen,
1180
- isOpen = _ref2$isOpen === void 0 ? undefined : _ref2$isOpen,
1181
- _ref2$customQuery = _ref2.customQuery,
1182
- customQuery = _ref2$customQuery === void 0 ? true : _ref2$customQuery,
1183
- _ref2$defaultQuery = _ref2.defaultQuery,
1184
- defaultQuery = _ref2$defaultQuery === void 0 ? true : _ref2$defaultQuery,
1185
- _ref2$value = _ref2.value,
1186
- value = _ref2$value === void 0 ? undefined : _ref2$value,
1187
- _ref2$categoryValue = _ref2.categoryValue,
1188
- categoryValue = _ref2$categoryValue === void 0 ? undefined : _ref2$categoryValue;
1189
- if (typeof isOpen === 'boolean') {
1190
- this.isOpen = isOpen;
1191
- }
1192
- if (customQuery) {
1193
- this.triggerCustomQuery(value, categoryValue);
1194
- }
1195
- if (defaultQuery) {
1196
- this.triggerDefaultQuery(value);
1197
- }
1198
- },
1199
- triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
1200
- // click analytics would only work client side and after javascript loads
1201
- var docId = documentId;
1202
- if (!docId) {
1203
- var hitData = this.normalizedSuggestions.find(function (hit) {
1204
- return hit._click_id === searchPosition;
1205
- });
1206
- if (hitData && hitData.source && hitData.source._id) {
1207
- docId = hitData.source._id;
1208
- }
1209
- }
1210
- this.recordSuggestionClick(searchPosition, docId);
1211
- },
1212
- clearValue: function clearValue() {
1213
- this.setValue('', false, this.$props, reactivecore.causes.CLEAR_VALUE, false);
1214
- this.onValueSelectedHandler('', reactivecore.causes.CLEAR_VALUE);
1215
- },
1216
- handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1217
- if (highlightedIndex === void 0) {
1218
- highlightedIndex = null;
1219
- }
1220
- // if a suggestion was selected, delegate the handling to suggestion handler
1221
- if (event.key === 'Enter') {
1222
- if (this.$props.autosuggest === false) {
1223
- this.enterButtonOnClick();
1224
- } else if (highlightedIndex === null) {
1225
- this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? reactivecore.causes.SUGGESTION_SELECT : undefined // to handle tags
1226
- );
1227
-
1228
- this.onValueSelectedHandler(event.target.value, reactivecore.causes.ENTER_PRESS);
1229
- }
1230
- }
1231
-
1232
- // Need to review
1233
- this.$emit('keyDown', event, this.triggerQuery);
1234
- this.$emit('key-down', event, this.triggerQuery);
1235
- },
1236
- onInputChange: function onInputChange(e) {
1237
- var _this2 = this;
1238
- var inputValue = e.target.value;
1239
- if (!this.$data.isOpen && this.$props.autosuggest) {
1240
- this.isOpen = true;
1241
- }
1242
- var value = this.$props.value;
1243
- if (value === undefined) {
1244
- this.setValue(inputValue, false, this.$props, inputValue === '' ? reactivecore.causes.CLEAR_VALUE : undefined);
1245
- } else {
1246
- this.$emit('change', inputValue, function (_ref3) {
1247
- var isOpen = _ref3.isOpen;
1248
- return _this2.triggerQuery({
1249
- defaultQuery: true,
1250
- customQuery: true,
1251
- value: inputValue,
1252
- isOpen: isOpen
1253
- });
1254
- }, e);
1255
- }
1256
- },
1257
- onSuggestionSelected: function onSuggestionSelected(suggestion) {
1258
- var _this3 = this;
1259
- this.isOpen = false;
1260
- var value = this.$props.value;
1261
- // Record analytics for selected suggestions
1262
- this.triggerClickAnalytics(suggestion._click_id);
1263
- if (value === undefined) {
1264
- this.setValue(suggestion.value, true, this.$props, reactivecore.causes.SUGGESTION_SELECT, false, suggestion._category);
1265
- } else {
1266
- var emitValue = suggestion.value;
1267
- if (this.$options.isTagsMode) {
1268
- emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
1269
- if (this.selectedTags.includes(suggestion.value)) {
1270
- // avoid duplicates in tags array
1271
- this.isOpen = false;
1272
- return;
1273
- }
1274
- emitValue.push(suggestion.value);
1275
- }
1276
- this.setValue(emitValue, true, this.$props, reactivecore.causes.SUGGESTION_SELECT, false, suggestion._category);
1277
- this.$emit('change', emitValue, function (_ref4) {
1278
- var isOpen = _ref4.isOpen;
1279
- return _this3.triggerQuery(_rollupPluginBabelHelpers._extends({
1280
- isOpen: isOpen,
1281
- value: emitValue
1282
- }, !_this3.$options.isTagsMode && {
1283
- categoryValue: suggestion._category
1284
- }));
1285
- });
1286
- }
1287
- this.onValueSelectedHandler(suggestion.value, reactivecore.causes.SUGGESTION_SELECT, suggestion.source);
1288
- },
1289
- onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1290
- if (currentValue === void 0) {
1291
- currentValue = this.$data.currentValue;
1292
- }
1293
- for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1294
- cause[_key - 1] = arguments[_key];
1295
- }
1296
- this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
1297
- this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
1298
- },
1299
- handleStateChange: function handleStateChange(changes) {
1300
- var isOpen = changes.isOpen;
1301
- this.isOpen = isOpen;
1302
- },
1303
- getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
1304
- var isDark = this.themePreset === 'dark';
1305
- if (isDark) {
1306
- return highlightedIndex === index ? '#555' : '#424242';
1307
- }
1308
- return highlightedIndex === index ? '#eee' : '#fff';
1309
- },
1310
- renderIcon: function renderIcon() {
1311
- if (this.$props.showIcon) {
1312
- return this.$props.icon || vue.createVNode(SearchSvg, null, null);
1313
- }
1314
- return null;
1315
- },
1316
- renderErrorComponent: function renderErrorComponent() {
1317
- var _this4 = this;
1318
- var renderError = this.$slots.renderError || this.$props.renderError;
1319
- if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1320
- return vue.createVNode(SuggestionWrapper, {
1321
- "innerClass": this.$props.innerClass,
1322
- "innerClassName": "error",
1323
- "theme": this.theme,
1324
- "themePreset": this.themePreset
1325
- }, {
1326
- "default": function _default() {
1327
- return [index.isFunction(renderError) ? renderError(_this4.error) : renderError];
1328
- }
1329
- });
1330
- }
1331
- return null;
1332
- },
1333
- renderCancelIcon: function renderCancelIcon() {
1334
- if (this.$props.showClear) {
1335
- return this.$props.clearIcon || vue.createVNode(CancelSvg.CancelSvg, null, null);
1336
- }
1337
- return null;
1338
- },
1339
- renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
1340
- if (finalSuggestionsList === void 0) {
1341
- finalSuggestionsList = [];
1342
- }
1343
- var innerClass = this.$props.innerClass;
1344
- var renderNoSuggestion = this.$slots.renderNoSuggestion || this.$props.renderNoSuggestion;
1345
- var renderError = this.$slots.renderError || this.$props.renderError;
1346
- var _this$$data = this.$data,
1347
- isOpen = _this$$data.isOpen,
1348
- currentValue = _this$$data.currentValue;
1349
- if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
1350
- return vue.createVNode(SuggestionWrapper, {
1351
- "innerClass": innerClass,
1352
- "themePreset": this.themePreset,
1353
- "theme": this.theme,
1354
- "innerClassName": "noSuggestion"
1355
- }, {
1356
- "default": function _default() {
1357
- return typeof renderNoSuggestion === 'function' ? renderNoSuggestion(currentValue) : renderNoSuggestion;
1358
- }
1359
- });
1360
- }
1361
- return null;
1362
- },
1363
- renderInputAddonBefore: function renderInputAddonBefore() {
1364
- var addonBefore = this.$slots.addonBefore;
1365
- if (addonBefore) {
1366
- var _slot;
1367
- return vue.createVNode(InputAddon, {
1368
- "class": "addon-before"
1369
- }, _isSlot(_slot = addonBefore()) ? _slot : {
1370
- "default": function _default() {
1371
- return [_slot];
1372
- }
1373
- });
1374
- }
1375
- return null;
1376
- },
1377
- renderInputAddonAfter: function renderInputAddonAfter() {
1378
- var addonAfter = this.$slots.addonAfter;
1379
- if (addonAfter) {
1380
- var _slot2;
1381
- return vue.createVNode(InputAddon, {
1382
- "class": "addon-after"
1383
- }, _isSlot(_slot2 = addonAfter()) ? _slot2 : {
1384
- "default": function _default() {
1385
- return [_slot2];
1386
- }
1387
- });
1388
- }
1389
- return null;
1390
- },
1391
- enterButtonOnClick: function enterButtonOnClick() {
1392
- this.triggerQuery({
1393
- isOpen: false,
1394
- value: this.currentValue,
1395
- customQuery: true
1396
- });
1397
- },
1398
- renderEnterButtonElement: function renderEnterButtonElement() {
1399
- var _this5 = this;
1400
- var _this$$props2 = this.$props,
1401
- enterButton = _this$$props2.enterButton,
1402
- innerClass = _this$$props2.innerClass;
1403
- var renderEnterButton = this.$slots.renderEnterButton;
1404
- if (enterButton) {
1405
- var getEnterButtonMarkup = function getEnterButtonMarkup() {
1406
- if (renderEnterButton) {
1407
- return renderEnterButton(_this5.enterButtonOnClick);
1408
- }
1409
- return vue.createVNode(Button.Button, {
1410
- "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
1411
- "primary": true,
1412
- "onClick": _this5.enterButtonOnClick
1413
- }, {
1414
- "default": function _default() {
1415
- return [vue.createTextVNode("Search")];
1416
- }
1417
- });
1418
- };
1419
- return vue.createVNode("div", {
1420
- "class": "enter-button-wrapper"
1421
- }, [getEnterButtonMarkup()]);
1422
- }
1423
- return null;
1424
- },
1425
- renderIcons: function renderIcons() {
1426
- var _this6 = this;
1427
- var _slot3, _slot4, _slot5;
1428
- var _this$$props3 = this.$props,
1429
- iconPosition = _this$$props3.iconPosition,
1430
- showClear = _this$$props3.showClear,
1431
- innerClass = _this$$props3.innerClass,
1432
- getMicInstance = _this$$props3.getMicInstance,
1433
- showVoiceSearch = _this$$props3.showVoiceSearch,
1434
- showIcon = _this$$props3.showIcon;
1435
- var renderMic = this.$slots.renderMic || this.$props.renderMic;
1436
- var currentValue = this.$data.currentValue;
1437
- return vue.createVNode("div", null, [vue.createVNode(CancelSvg.IconGroup, {
1438
- "groupPosition": "right",
1439
- "positionType": "absolute"
1440
- }, {
1441
- "default": function _default() {
1442
- return [currentValue && showClear && vue.createVNode(CancelSvg.IconWrapper, {
1443
- "onClick": _this6.clearValue,
1444
- "showIcon": showIcon,
1445
- "isClearIcon": true
1446
- }, _isSlot(_slot3 = _this6.renderCancelIcon()) ? _slot3 : {
1447
- "default": function _default() {
1448
- return [_slot3];
1449
- }
1450
- }), showVoiceSearch && vue.createVNode(Mic, {
1451
- "getInstance": getMicInstance,
1452
- "render": renderMic,
1453
- "handleResult": _this6.handleVoiceResults,
1454
- "className": getClassName$1(innerClass, 'mic') || null
1455
- }, null), iconPosition === 'right' && showIcon && vue.createVNode(CancelSvg.IconWrapper, {
1456
- "onClick": _this6.handleSearchIconClick
1457
- }, _isSlot(_slot4 = _this6.renderIcon()) ? _slot4 : {
1458
- "default": function _default() {
1459
- return [_slot4];
1460
- }
1461
- })];
1462
- }
1463
- }), vue.createVNode(CancelSvg.IconGroup, {
1464
- "groupPosition": "left",
1465
- "positionType": "absolute"
1466
- }, {
1467
- "default": function _default() {
1468
- return [iconPosition === 'left' && showIcon && vue.createVNode(CancelSvg.IconWrapper, {
1469
- "onClick": _this6.handleSearchIconClick
1470
- }, _isSlot(_slot5 = _this6.renderIcon()) ? _slot5 : {
1471
- "default": function _default() {
1472
- return [_slot5];
1473
- }
1474
- })];
1475
- }
1476
- })]);
1477
- },
1478
- focusSearchBox: function focusSearchBox(event) {
1479
- var _this$$refs, _this$$refs$this$$pro;
1480
- var elt = event.target || event.srcElement;
1481
- var tagName = elt.tagName;
1482
- if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1483
- // already in an input
1484
- return;
1485
- }
1486
- (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
1487
- },
1488
- listenForFocusShortcuts: function listenForFocusShortcuts() {
1489
- var _this7 = this;
1490
- var _this$$props$focusSho = this.$props.focusShortcuts,
1491
- focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1492
- if (index.isEmpty(focusShortcuts)) {
1493
- return;
1494
- }
1495
- var shortcutsString = index.parseFocusShortcuts(focusShortcuts).join(',');
1496
-
1497
- // handler for alphabets and other key combinations
1498
- hotkeys(shortcutsString,
1499
- // eslint-disable-next-line no-unused-vars
1500
- /* eslint-disable no-shadow */
1501
- function (event, handler) {
1502
- // Prevent the default refresh event under WINDOWS system
1503
- event.preventDefault();
1504
- _this7.focusSearchBox(event);
1505
- });
1506
-
1507
- // if one of modifier keys are used, they are handled below
1508
- hotkeys('*', function (event) {
1509
- var modifierKeys = index.extractModifierKeysFromFocusShortcuts(focusShortcuts);
1510
- if (modifierKeys.length === 0) return;
1511
- for (var index$1 = 0; index$1 < modifierKeys.length; index$1 += 1) {
1512
- var element = modifierKeys[index$1];
1513
- if (hotkeys[element]) {
1514
- _this7.focusSearchBox(event);
1515
- break;
1516
- }
1517
- }
1518
- });
1519
- },
1520
- onAutofillClick: function onAutofillClick(suggestion) {
1521
- var value = suggestion.value;
1522
- this.isOpen = true;
1523
- this.currentValue = index.decodeHtml(value);
1524
- this.triggerDefaultQuery(value);
1525
- },
1526
- renderAutoFill: function renderAutoFill(suggestion) {
1527
- var _this8 = this;
1528
- var handleAutoFillClick = function handleAutoFillClick(e) {
1529
- e.stopPropagation();
1530
- _this8.onAutofillClick(suggestion);
1531
- };
1532
- /* 👇 avoid showing autofill for category suggestions👇 */
1533
- return suggestion._category ? null : vue.createVNode(AutoFillSvg, {
1534
- "onClick": handleAutoFillClick
1535
- }, null);
1536
- },
1537
- renderTag: function renderTag(item) {
1538
- var _this9 = this;
1539
- var innerClass = this.$props.innerClass;
1540
- return vue.createVNode(TagItem, {
1541
- "class": getClassName$1(innerClass, 'selected-tag') || ''
1542
- }, {
1543
- "default": function _default() {
1544
- return [vue.createVNode("span", null, [item]), vue.createVNode("span", {
1545
- "role": "img",
1546
- "aria-label": "delete-tag",
1547
- "class": "close-icon",
1548
- "onClick": function onClick() {
1549
- return _this9.clearTag(item);
1550
- }
1551
- }, [vue.createVNode(CancelSvg.CancelSvg, null, null)])];
1552
- }
1553
- });
1554
- },
1555
- clearAllTags: function clearAllTags() {
1556
- this.selectedTags = [];
1557
- this.setValue('', true, this.$props, reactivecore.causes.SUGGESTION_SELECT);
1558
- if (this.$props.value !== undefined) {
1559
- this.$emit('change', this.selectedTags, this.triggerQuery);
1560
- }
1561
- },
1562
- clearTag: function clearTag(tagValue) {
1563
- this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1564
- return tag !== tagValue;
1565
- }));
1566
- this.setValue('', true, this.$props, reactivecore.causes.SUGGESTION_SELECT);
1567
- if (this.$props.value !== undefined) {
1568
- this.$emit('change', this.selectedTags, this.triggerQuery);
1569
- }
1570
- },
1571
- renderTags: function renderTags() {
1572
- var _this10 = this;
1573
- if (!Array.isArray(this.selectedTags)) {
1574
- return null;
1575
- }
1576
- var tagsList = [].concat(this.selectedTags);
1577
- var shouldRenderClearAllTag = tagsList.length > 1;
1578
- var renderSelectedTags = this.$slots.renderSelectedTags || this.$props.renderSelectedTags;
1579
- return renderSelectedTags ? renderSelectedTags({
1580
- values: this.selectedTags,
1581
- handleClear: this.clearTag,
1582
- handleClearAll: this.clearAllTags
1583
- }) : vue.createVNode(TagsContainer, null, {
1584
- "default": function _default() {
1585
- return [tagsList.map(function (item) {
1586
- return _this10.renderTag(item);
1587
- }), shouldRenderClearAllTag && vue.createVNode(TagItem, {
1588
- "class": getClassName$1(_this10.$props.innerClass, 'selected-tag') || ''
1589
- }, {
1590
- "default": function _default() {
1591
- return [vue.createVNode("span", null, [vue.createTextVNode("Clear All")]), vue.createVNode("span", {
1592
- "role": "img",
1593
- "aria-label": "delete-tag",
1594
- "class": "close-icon",
1595
- "onClick": _this10.clearAllTags
1596
- }, [vue.createVNode(CancelSvg.CancelSvg, null, null)])];
1597
- }
1598
- })];
1599
- }
1600
- });
1601
- }
1602
- },
1603
- render: function render() {
1604
- var _this11 = this;
1605
- var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
1606
- var _this$$slots = this.$slots,
1607
- recentSearchesIcon = _this$$slots.recentSearchesIcon,
1608
- popularSearchesIcon = _this$$slots.popularSearchesIcon;
1609
- var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
1610
- var renderItem = this.$slots.renderItem || this.$props.renderItem;
1611
- return vue.createVNode(Container.Container, {
1612
- "class": this.$props.className
1613
- }, {
1614
- "default": function _default() {
1615
- return [_this11.$props.title && vue.createVNode(Title.Title, {
1616
- "class": getClassName$1(_this11.$props.innerClass, 'title') || ''
1617
- }, {
1618
- "default": function _default() {
1619
- return [_this11.$props.title];
1620
- }
1621
- }), _this11.$props.autosuggest ? vue.createVNode(CancelSvg.Downshift, {
1622
- "id": _this11.$props.componentId + "-downshift",
1623
- "handleChange": _this11.onSuggestionSelected,
1624
- "handleMouseup": _this11.handleStateChange,
1625
- "isOpen": _this11.$data.isOpen
1626
- }, {
1627
- "default": function _default(_ref5) {
1628
- var getInputEvents = _ref5.getInputEvents,
1629
- getInputProps = _ref5.getInputProps,
1630
- getItemProps = _ref5.getItemProps,
1631
- getItemEvents = _ref5.getItemEvents,
1632
- isOpen = _ref5.isOpen,
1633
- highlightedIndex = _ref5.highlightedIndex,
1634
- setHighlightedIndex = _ref5.setHighlightedIndex;
1635
- var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
1636
- var getIcon = function getIcon(iconType) {
1637
- switch (iconType) {
1638
- case helper.suggestionTypes.Recent:
1639
- return recentSearchesIcon;
1640
- case helper.suggestionTypes.Popular:
1641
- return popularSearchesIcon;
1642
- default:
1643
- return null;
1644
- }
1645
- };
1646
- return vue.createVNode("div", null, [_this11.hasCustomRenderer && _this11.getComponent({
1647
- isOpen: isOpen,
1648
- getItemProps: getItemProps,
1649
- getItemEvents: getItemEvents,
1650
- highlightedIndex: highlightedIndex
1651
- }), _this11.renderErrorComponent(), !_this11.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
1652
- "class": Input.suggestions(_this11.themePreset, _this11.theme) + " " + getClassName$1(_this11.$props.innerClass, 'list')
1653
- }, [_this11.normalizedSuggestions.map(function (item, index) {
1654
- return renderItem ? vue.createVNode("li", vue.mergeProps(getItemProps({
1655
- item: item
1656
- }), getItemEvents({
1657
- item: item
1658
- }), {
1659
- "key": index + 1 + "-" + item.value,
1660
- "style": {
1661
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
1662
- justifyContent: 'flex-start',
1663
- alignItems: 'center'
1664
- }
1665
- }), [renderItem(item)]) : vue.createVNode("li", vue.mergeProps(getItemProps({
1666
- item: item
1667
- }), _transformOn(getItemEvents({
1668
- item: item
1669
- })), {
1670
- "key": index + 1 + "-" + item.value,
1671
- "style": {
1672
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
1673
- justifyContent: 'flex-start',
1674
- alignItems: 'center'
1675
- }
1676
- }), [vue.createVNode("div", {
1677
- "style": {
1678
- padding: '0 10px 0 0',
1679
- display: 'flex'
1680
- }
1681
- }, [vue.createVNode(CustomSvg, {
1682
- "className": getClassName$1(_this11.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1683
- "icon": getIcon(item._suggestion_type),
1684
- "type": item._suggestion_type + "-search-icon"
1685
- }, null)]), vue.createVNode(SuggestionItem, {
1686
- "currentValue": _this11.currentValue,
1687
- "suggestion": item
1688
- }, null), _this11.renderAutoFill(item)]);
1689
- })]) : _this11.renderNoSuggestions(_this11.normalizedSuggestions)]);
1690
- };
1691
- return vue.createVNode("div", {
1692
- "class": Input.suggestionsContainer
1693
- }, [vue.createVNode(InputGroup, null, {
1694
- "default": function _default() {
1695
- return [_this11.renderInputAddonBefore(), vue.createVNode(CancelSvg.InputWrapper, null, {
1696
- "default": function _default() {
1697
- return [vue.createVNode(Input.Input, vue.mergeProps(_transformOn(getInputEvents({
1698
- onInput: _this11.onInputChange,
1699
- onBlur: function onBlur(e) {
1700
- _this11.$emit('blur', e, _this11.triggerQuery);
1701
- },
1702
- onFocus: _this11.handleFocus,
1703
- onKeyPress: function onKeyPress(e) {
1704
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1705
- _this11.$emit('key-press', e, _this11.triggerQuery);
1706
- },
1707
- onKeyDown: function onKeyDown(e) {
1708
- return _this11.handleKeyDown(e, highlightedIndex);
1709
- },
1710
- onKeyUp: function onKeyUp(e) {
1711
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1712
- _this11.$emit('key-up', e, _this11.triggerQuery);
1713
- },
1714
- onClick: function onClick() {
1715
- setHighlightedIndex(null);
1716
- }
1717
- })), {
1718
- "id": _this11.$props.componentId + "-input",
1719
- "showIcon": _this11.$props.showIcon,
1720
- "showClear": _this11.$props.showClear,
1721
- "iconPosition": _this11.$props.iconPosition,
1722
- "ref": _this11.$props.innerRef,
1723
- "class": getClassName$1(_this11.$props.innerClass, 'input'),
1724
- "placeholder": _this11.$props.placeholder,
1725
- "autoFocus": _this11.$props.autoFocus
1726
- }, getInputProps({
1727
- value: _this11.$data.currentValue === null ? '' : _this11.$data.currentValue
1728
- }), {
1729
- "themePreset": _this11.themePreset,
1730
- "autocomplete": "off"
1731
- }), null), _this11.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
1732
- }
1733
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
1734
- }
1735
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this11.renderTags()]);
1736
- }
1737
- }) : vue.createVNode("div", {
1738
- "class": Input.suggestionsContainer
1739
- }, [vue.createVNode(InputGroup, null, {
1740
- "default": function _default() {
1741
- return [_this11.renderInputAddonBefore(), vue.createVNode(CancelSvg.InputWrapper, null, {
1742
- "default": function _default() {
1743
- return [vue.createVNode(Input.Input, vue.mergeProps(_transformOn({
1744
- blur: function blur(e) {
1745
- _this11.$emit('blur', e, _this11.triggerQuery);
1746
- },
1747
- keypress: function keypress(e) {
1748
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1749
- _this11.$emit('key-press', e, _this11.triggerQuery);
1750
- },
1751
- input: _this11.onInputChange,
1752
- focus: function focus(e) {
1753
- _this11.$emit('focus', e, _this11.triggerQuery);
1754
- },
1755
- keydown: _this11.handleKeyDown,
1756
- keyup: function keyup(e) {
1757
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1758
- _this11.$emit('key-up', e, _this11.triggerQuery);
1759
- }
1760
- }), {
1761
- "class": getClassName$1(_this11.$props.innerClass, 'input') || '',
1762
- "placeholder": _this11.$props.placeholder,
1763
- "autofocus": _this11.$props.autoFocus,
1764
- "value": _this11.$data.currentValue ? _this11.$data.currentValue : '',
1765
- "iconPosition": _this11.$props.iconPosition,
1766
- "showIcon": _this11.$props.showIcon,
1767
- "showClear": _this11.$props.showClear,
1768
- "ref": _this11.$props.innerRef,
1769
- "themePreset": _this11.themePreset
1770
- }), null), _this11.renderIcons()];
1771
- }
1772
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
1773
- }
1774
- })])];
1775
- }
1776
- });
1777
- },
1778
- destroyed: function destroyed() {
1779
- document.removeEventListener('keydown', this.onKeyDown);
1780
- }
1781
- });
1782
- SearchBox.hasInternalComponent = function () {
1783
- return true;
1784
- };
1785
- SearchBox.defaultQuery = function (value, props) {
1786
- var finalQuery = null;
1787
- finalQuery = {
1788
- bool: {
1789
- should: SearchBox.shouldQuery(value, props),
1790
- minimum_should_match: '1'
1791
- }
1792
- };
1793
- if (finalQuery && props.nestedField) {
1794
- return {
1795
- query: {
1796
- nested: {
1797
- path: props.nestedField,
1798
- query: finalQuery
1799
- }
1800
- }
1801
- };
1802
- }
1803
- return finalQuery;
1804
- };
1805
- SearchBox.shouldQuery = function (value, props) {
1806
- return {
1807
- query: {
1808
- queryFormat: props.queryFormat,
1809
- dataField: props.dataField,
1810
- value: value,
1811
- nestedField: props.nestedField,
1812
- queryString: props.queryString,
1813
- searchOperators: props.searchOperators
1814
- }
1815
- };
1816
- };
1817
- var mapStateToProps = function mapStateToProps(state, props) {
1818
- return {
1819
- selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
1820
- selectedCategory: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].category || null,
1821
- suggestions: state.hits[props.componentId] && state.hits[props.componentId].hits,
1822
- rawData: state.rawData[props.componentId],
1823
- aggregationData: state.compositeAggregations[props.componentId] || [],
1824
- themePreset: state.config.themePreset,
1825
- isLoading: !!state.isLoading[props.componentId + "_active"],
1826
- error: state.error[props.componentId],
1827
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
1828
- total: state.hits[props.componentId] && state.hits[props.componentId].total,
1829
- hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
1830
- };
1831
- };
1832
- var mapDispatchToProps = {
1833
- updateQuery: updateQuery,
1834
- setCustomQuery: setCustomQuery,
1835
- setDefaultQuery: setDefaultQuery,
1836
- recordSuggestionClick: recordSuggestionClick
1837
- };
1838
- var SBConnected = PreferencesConsumer.PreferencesConsumer(ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchToProps)(SearchBox), {
1839
- componentType: constants.componentTypes.searchBox,
1840
- internalComponent: true
1841
- }));
1842
- SBConnected.name = SearchBox.name;
1843
- SBConnected.defaultQuery = SearchBox.defaultQuery;
1844
- SBConnected.shouldQuery = SearchBox.shouldQuery;
1845
- SBConnected.hasInternalComponent = SearchBox.hasInternalComponent;
1846
- SBConnected.install = function (Vue) {
1847
- Vue.component(SBConnected.name, SBConnected);
1848
- };
1849
- // Add componentType for SSR
1850
- SBConnected.componentType = constants.componentTypes.searchBox;
1851
-
1852
- exports.SBConnected = SBConnected;
1853
- exports.default = SBConnected;