@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
@@ -0,0 +1,702 @@
1
+ 'use strict';
2
+
3
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
+
5
+ var reactivecore = require('@appbaseio/reactivecore');
6
+ var _transformOn = _interopDefault(require('@vue/babel-helper-vue-transform-on'));
7
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-f8b843f8.js');
8
+ var vue = require('vue');
9
+ var VueTypes = _interopDefault(require('vue-types'));
10
+ var vueEmotion = require('@appbaseio/vue-emotion');
11
+ var vueTypes = require('./vueTypes-a5f1745e.js');
12
+ var index = require('./index-779ed366.js');
13
+ var Input = require('./Input-56eba499.js');
14
+ var computeScrollIntoView = _interopDefault(require('compute-scroll-into-view'));
15
+ var suggestions = require('@appbaseio/reactivecore/lib/utils/suggestions');
16
+
17
+ var _templateObject;
18
+ var InputWrapper = vueEmotion.styled('span')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tflex: 1;\n\tposition: relative;\n\theight: 42px;\n"])));
19
+
20
+ var _templateObject$1;
21
+ var IconGroup = vueEmotion.styled('div')(_templateObject$1 || (_templateObject$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tgrid-gap: 6px;\n\tmargin: 0 10px;\n\theight: 100%;\n\n\t", ";\n\n\t", ";\n\n\t", ";\n"])), function (_ref) {
22
+ var positionType = _ref.positionType;
23
+ if (positionType === 'absolute') {
24
+ return "\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: 50%;\n\t\t\t\ttransform: translateY(-50%);\n\t\t\t";
25
+ }
26
+ return null;
27
+ }, function (_ref2) {
28
+ var groupPosition = _ref2.groupPosition;
29
+ return groupPosition === 'right' ? "\n\t\t\t\t\tright: 0;\n\t\t\t " : "\n\t\t\t\t\tleft: 0;\n\t\t\t ";
30
+ }, function (_ref3) {
31
+ var enableAI = _ref3.enableAI;
32
+ return enableAI ? "\n\t\ttop: 0%;\n\t transform: translateY(0);\n \theight: 42px;\n\t" : '';
33
+ });
34
+
35
+ var _templateObject$2;
36
+ var IconWrapper = vueEmotion.styled('div')(_templateObject$2 || (_templateObject$2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmax-width: 23px;\n\twidth: max-content;\n\tcursor: pointer;\n\theight: 100%;\n\tmin-width: 20px;\n\n\tsvg.search-icon {\n\t\tfill: ", ";\n\t\ttransform: scale(1.5);\n\t}\n\n\tsvg.cancel-icon {\n\t\tfill: ", ";\n\t}\n"])), function (_ref) {
37
+ var _ref$theme = _ref.theme,
38
+ theme = _ref$theme === void 0 ? {} : _ref$theme;
39
+ return theme.colors ? theme.colors.primaryColor : 'unset';
40
+ }, function (_ref2) {
41
+ var _ref2$theme = _ref2.theme,
42
+ theme = _ref2$theme === void 0 ? {} : _ref2$theme;
43
+ return theme.colors ? theme.colors.borderColor : '#000';
44
+ });
45
+
46
+ /**
47
+ * Scroll node into view if necessary
48
+ * @param {HTMLElement} node the element that should scroll into view
49
+ * @param {HTMLElement} rootNode the root element of the component
50
+ */
51
+ // eslint-disable-next-line
52
+ var scrollIntoView = function scrollIntoView(node, rootNode) {
53
+ if (node === null) {
54
+ return;
55
+ }
56
+ var actions = computeScrollIntoView(node, {
57
+ boundary: rootNode,
58
+ block: 'nearest',
59
+ scrollMode: 'if-needed'
60
+ });
61
+ actions.forEach(function (_ref) {
62
+ var el = _ref.el,
63
+ top = _ref.top,
64
+ left = _ref.left;
65
+ el.scrollTop = top;
66
+ el.scrollLeft = left;
67
+ });
68
+ };
69
+
70
+ var Downshift = {
71
+ // eslint-disable-next-line
72
+ props: ['isOpen', 'inputValue', 'selectedItem', 'highlightedIndex', 'handleChange',
73
+ // 'itemToString',
74
+ 'handleMouseup'],
75
+ data: function data() {
76
+ return {
77
+ isMouseDown: false,
78
+ internal_isOpen: false,
79
+ internal_inputValue: '',
80
+ internal_selectedItem: null,
81
+ internal_highlightedIndex: null
82
+ };
83
+ },
84
+ computed: {
85
+ mergedState: function mergedState() {
86
+ var _this = this;
87
+ return Object.keys(this.$props).reduce(function (state, key) {
88
+ var _extends2;
89
+ return _rollupPluginBabelHelpers._extends({}, state, (_extends2 = {}, _extends2[key] = _this.isControlledProp(key) ? _this.$props[key] : _this["internal_" + key], _extends2));
90
+ }, {});
91
+ },
92
+ internalItemCount: function internalItemCount() {
93
+ return this.items.length;
94
+ }
95
+ },
96
+ mounted: function mounted() {
97
+ window.addEventListener('mousedown', this.handleWindowMousedown);
98
+ window.addEventListener('mouseup', this.handleWindowMouseup);
99
+ },
100
+ beforeUnmount: function beforeUnmount() {
101
+ window.removeEventListener('mousedown', this.handleWindowMousedown);
102
+ window.removeEventListener('mouseup', this.handleWindowMouseup);
103
+ },
104
+ methods: {
105
+ handleWindowMousedown: function handleWindowMousedown() {
106
+ this.isMouseDown = true;
107
+ },
108
+ handleWindowMouseup: function handleWindowMouseup(event) {
109
+ this.isMouseDown = false;
110
+ if ((event.target === this.$refs.rootNode || !this.$refs.rootNode.contains(event.target)) && this.mergedState.isOpen) {
111
+ // TODO: handle on outer click here
112
+ if (!this.isMouseDown) {
113
+ this.reset();
114
+ if (this.$props.handleMouseup) {
115
+ this.$props.handleMouseup({
116
+ isOpen: false
117
+ });
118
+ }
119
+ }
120
+ }
121
+ },
122
+ keyDownArrowDown: function keyDownArrowDown(event) {
123
+ event.preventDefault();
124
+ var amount = event.shiftKey ? 5 : 1;
125
+ if (this.mergedState.isOpen) {
126
+ this.changeHighlightedIndex(amount);
127
+ } else {
128
+ this.setState({
129
+ isOpen: true
130
+ });
131
+ this.setHighlightedIndex();
132
+ }
133
+ },
134
+ keyDownArrowUp: function keyDownArrowUp(event) {
135
+ event.preventDefault();
136
+ var amount = event.shiftKey ? -5 : -1;
137
+ if (this.mergedState.isOpen) {
138
+ this.changeHighlightedIndex(amount);
139
+ } else {
140
+ this.setState({
141
+ isOpen: true
142
+ });
143
+ this.setHighlightedIndex();
144
+ }
145
+ },
146
+ keyDownEnter: function keyDownEnter(event) {
147
+ if (this.mergedState.isOpen) {
148
+ event.preventDefault();
149
+ this.selectHighlightedItem();
150
+ }
151
+ },
152
+ keyDownEscape: function keyDownEscape(event) {
153
+ event.preventDefault();
154
+ this.reset();
155
+ },
156
+ selectHighlightedItem: function selectHighlightedItem() {
157
+ return this.selectItemAtIndex(this.mergedState.highlightedIndex);
158
+ },
159
+ selectItemAtIndex: function selectItemAtIndex(itemIndex) {
160
+ var item = this.items[itemIndex];
161
+ if (item == null) {
162
+ return;
163
+ }
164
+ this.selectItem(item);
165
+ },
166
+ selectItem: function selectItem(item) {
167
+ if (this.$props.handleChange) {
168
+ this.$props.handleChange(item);
169
+ }
170
+ function getInputValue() {
171
+ if (this.isControlledProp('selectedItem')) {
172
+ return '';
173
+ }
174
+ return typeof item === 'object' ? item.label || '' : item;
175
+ }
176
+ this.setState({
177
+ isOpen: false,
178
+ highlightedIndex: null,
179
+ selectedItem: item,
180
+ inputValue: getInputValue.call(this)
181
+ });
182
+ },
183
+ changeHighlightedIndex: function changeHighlightedIndex(moveAmount) {
184
+ if (this.internalItemCount < 0) {
185
+ return;
186
+ }
187
+ var highlightedIndex = this.mergedState.highlightedIndex;
188
+ var baseIndex = highlightedIndex;
189
+ if (baseIndex === null) {
190
+ baseIndex = moveAmount > 0 ? -1 : this.internalItemCount + 1;
191
+ }
192
+ var newIndex = baseIndex + moveAmount;
193
+ if (newIndex < 0) {
194
+ newIndex = this.internalItemCount;
195
+ } else if (newIndex > this.internalItemCount) {
196
+ newIndex = 0;
197
+ }
198
+ this.setHighlightedIndex(newIndex);
199
+ },
200
+ setHighlightedIndex: function setHighlightedIndex(highlightedIndex) {
201
+ if (highlightedIndex === void 0) {
202
+ highlightedIndex = null;
203
+ }
204
+ this.setState({
205
+ highlightedIndex: highlightedIndex
206
+ });
207
+ var element = document.getElementById("Downshift" + highlightedIndex);
208
+ scrollIntoView(element, this.rootNode);
209
+ // Implement scrollIntroView thingy
210
+ },
211
+ reset: function reset() {
212
+ var selectedItem = this.mergedState.selectedItem;
213
+ this.setState({
214
+ isOpen: false,
215
+ highlightedIndex: null,
216
+ inputValue: selectedItem
217
+ });
218
+ },
219
+ getItemProps: function getItemProps(_ref) {
220
+ var index = _ref.index,
221
+ item = _ref.item;
222
+ var newIndex = index;
223
+ if (index === undefined) {
224
+ if (this.$props.itemToString) {
225
+ this.items.push(this.$props.itemToString(item));
226
+ } else {
227
+ this.items.push(item);
228
+ }
229
+ newIndex = this.items.indexOf(item);
230
+ } else {
231
+ this.items[newIndex] = item;
232
+ }
233
+ return {
234
+ id: "Downshift" + newIndex
235
+ };
236
+ },
237
+ getItemEvents: function getItemEvents(_ref2) {
238
+ var index = _ref2.index,
239
+ item = _ref2.item;
240
+ var newIndex = index;
241
+ if (index === undefined) {
242
+ newIndex = this.items.indexOf(item);
243
+ }
244
+ var vm = this;
245
+ return {
246
+ mouseenter: function mouseenter() {
247
+ vm.setHighlightedIndex(newIndex);
248
+ },
249
+ click: function click(event) {
250
+ event.stopPropagation();
251
+ vm.selectItemAtIndex(newIndex);
252
+ }
253
+ };
254
+ },
255
+ getInputProps: function getInputProps(_ref3) {
256
+ var value = _ref3.value;
257
+ var inputValue = this.mergedState.inputValue;
258
+ if (value !== inputValue) {
259
+ this.setState({
260
+ inputValue: value
261
+ });
262
+ }
263
+ return {
264
+ value: inputValue
265
+ };
266
+ },
267
+ getButtonProps: function getButtonProps(_ref4) {
268
+ var _this2 = this;
269
+ var onClick = _ref4.onClick,
270
+ onKeyDown = _ref4.onKeyDown,
271
+ onKeyUp = _ref4.onKeyUp,
272
+ onBlur = _ref4.onBlur;
273
+ return {
274
+ click: function click(event) {
275
+ _this2.setState({
276
+ isOpen: true,
277
+ inputValue: event.target.value
278
+ });
279
+ if (onClick) {
280
+ onClick(event);
281
+ }
282
+ },
283
+ keydown: function keydown(event) {
284
+ if (event.key && _this2["keyDown" + event.key]) {
285
+ _this2["keyDown" + event.key].call(_this2, event);
286
+ }
287
+ if (onKeyDown) {
288
+ onKeyDown(event);
289
+ }
290
+ },
291
+ keyup: function keyup(event) {
292
+ if (onKeyUp) {
293
+ onKeyUp(event);
294
+ }
295
+ },
296
+ blur: function blur(event) {
297
+ if (onBlur) {
298
+ onBlur(event);
299
+ }
300
+ }
301
+ };
302
+ },
303
+ getInputEvents: function getInputEvents(_ref5) {
304
+ var _this3 = this;
305
+ var onInput = _ref5.onInput,
306
+ onBlur = _ref5.onBlur,
307
+ onFocus = _ref5.onFocus,
308
+ onKeyPress = _ref5.onKeyPress,
309
+ onKeyDown = _ref5.onKeyDown,
310
+ onKeyUp = _ref5.onKeyUp,
311
+ onClick = _ref5.onClick;
312
+ return {
313
+ input: function input(event) {
314
+ _this3.setState({
315
+ isOpen: true,
316
+ inputValue: event.target.value
317
+ });
318
+ if (onInput) {
319
+ onInput(event);
320
+ }
321
+ },
322
+ focus: function focus(event) {
323
+ if (onFocus) {
324
+ onFocus(event);
325
+ }
326
+ },
327
+ keydown: function keydown(event) {
328
+ if (event.key && _this3["keyDown" + event.key]) {
329
+ _this3["keyDown" + event.key].call(_this3, event);
330
+ }
331
+ if (onKeyDown) {
332
+ onKeyDown(event);
333
+ }
334
+ },
335
+ keypress: function keypress(event) {
336
+ if (onKeyPress) {
337
+ onKeyPress(event);
338
+ }
339
+ },
340
+ keyup: function keyup(event) {
341
+ if (onKeyUp) {
342
+ onKeyUp(event);
343
+ }
344
+ },
345
+ blur: function blur(event) {
346
+ if (onBlur) {
347
+ onBlur(event);
348
+ }
349
+ // TODO: implement isMouseDown
350
+ // this.reset()
351
+ },
352
+
353
+ click: onClick
354
+ };
355
+ },
356
+ getHelpersAndState: function getHelpersAndState() {
357
+ var getItemProps = this.getItemProps,
358
+ getItemEvents = this.getItemEvents,
359
+ getInputProps = this.getInputProps,
360
+ getInputEvents = this.getInputEvents,
361
+ getButtonProps = this.getButtonProps,
362
+ setHighlightedIndex = this.setHighlightedIndex;
363
+ return _rollupPluginBabelHelpers._extends({
364
+ getItemProps: getItemProps,
365
+ getItemEvents: getItemEvents,
366
+ getInputProps: getInputProps,
367
+ getInputEvents: getInputEvents,
368
+ getButtonProps: getButtonProps,
369
+ setHighlightedIndex: setHighlightedIndex
370
+ }, this.mergedState);
371
+ },
372
+ isControlledProp: function isControlledProp(prop) {
373
+ return this.$props[prop] !== undefined;
374
+ },
375
+ setState: function setState(stateToSet) {
376
+ var _this4 = this;
377
+ // eslint-disable-next-line
378
+ Object.keys(stateToSet).forEach(function (key) {
379
+ // eslint-disable-next-line
380
+ if (_this4.isControlledProp(key)) {
381
+ _this4.$emit(key + "Change", stateToSet[key]);
382
+ _this4.$emit(key + "-change", stateToSet[key]);
383
+ } else {
384
+ _this4["internal_" + key] = stateToSet[key];
385
+ }
386
+ });
387
+ this.$emit('stateChange', this.mergedState);
388
+ this.$emit('state-change', this.mergedState);
389
+ }
390
+ },
391
+ render: function render() {
392
+ this.items = [];
393
+ return vue.createVNode("div", {
394
+ "ref": "rootNode"
395
+ }, [this.$slots["default"] && this.$slots["default"](_rollupPluginBabelHelpers._extends({}, this.getHelpersAndState()))]);
396
+ }
397
+ };
398
+
399
+ var CancelSvg = (function () {
400
+ return vue.createVNode("svg", {
401
+ "alt": "Clear",
402
+ "class": "cancel-icon",
403
+ "xmlns": "http://www.w3.org/2000/svg",
404
+ "height": "20px",
405
+ "viewBox": "0 0 24 24",
406
+ "width": "20px"
407
+ }, [vue.createVNode("title", null, [vue.createTextVNode("Clear")]), vue.createVNode("path", {
408
+ "d": "M0 0h24v24H0V0z",
409
+ "fill": "none"
410
+ }, null), vue.createVNode("path", {
411
+ "d": "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
412
+ }, null)]);
413
+ });
414
+
415
+ var _templateObject$3, _templateObject2;
416
+ var small = "\n\tmin-height: 0;\n\theight: 30px;\n\tborder: 0;\n\tbox-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px;\n\tborder-radius: 2px;\n";
417
+ var dark = function dark(_ref) {
418
+ var theme = _ref.theme;
419
+ return "\n\tbackground-color: " + (theme.colors ? theme.colors.backgroundColor : '') + ";\n\tborder-color: " + (theme.colors ? theme.colors.borderColor : '') + ";\n\tcolor: " + (theme.colors ? theme.colors.textColor : '') + ";\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: " + (theme.colors ? theme.colors.backgroundColor : '') + ";\n\t}\n";
420
+ };
421
+ var Select = vueEmotion.styled('button')(_templateObject$3 || (_templateObject$3 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmin-height: 42px;\n\tborder-radius: 0;\n\toutline: none;\n\tpadding: 5px 12px;\n\tfont-size: 0.9rem;\n\tline-height: 1.2rem;\n\tbackground-color: #fff;\n\tborder: 1px solid #ccc;\n\tcolor: #424242;\n\tcursor: pointer;\n\tuser-select: none;\n\ttransition: all 0.3s ease;\n\n\t", ";\n\n\t& > div {\n\t\twidth: calc(100% - 24px);\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\ttext-align: left;\n\t}\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: #fcfcfc;\n\t}\n\n\t", ";\n"])), function (props) {
422
+ return props.small ? small : null;
423
+ }, function (_ref2) {
424
+ var themePreset = _ref2.themePreset;
425
+ return themePreset === 'dark' && dark;
426
+ });
427
+ var Tick = vueEmotion.styled('span')(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 16px;\n\theight: 16px;\n\tdisplay: inline-block;\n\tposition: relative;\n\tuser-select: none;\n\talign-items: center;\n\n\t&::after {\n\t\tbox-sizing: content-box;\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\tbackground-color: transparent;\n\t\ttop: 50%;\n\t\tleft: 0;\n\t\twidth: 8px;\n\t\theight: 4px;\n\t\tmargin-top: -4px;\n\t\tborder-style: solid;\n\t\tborder-color: ", ";\n\t\tborder-width: 0 0 2px 2px;\n\t\tborder-radius: 0;\n\t\tborder-image: none;\n\t\ttransform: rotate(-45deg) scale(1);\n\t\ttransition: all 200ms ease-out;\n\t}\n"])), function (_ref3) {
428
+ var theme = _ref3.theme;
429
+ return theme.colors.primaryColor;
430
+ });
431
+
432
+ var _templateObject$4;
433
+ var open = "\n\ttop: 0.55em;\n\ttransform: rotate(-45deg);\n";
434
+ var Chevron = vueEmotion.styled('span')(_templateObject$4 || (_templateObject$4 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t&::before {\n\t\tcontent: '';\n\t\tborder-style: solid;\n\t\tborder-width: 0.15em 0.15em 0 0;\n\t\tdisplay: inline-block;\n\t\theight: 0.45em;\n\t\tposition: relative;\n\t\ttop: 0.35em;\n\t\tleft: 0;\n\t\ttransform: rotate(135deg);\n\t\tvertical-align: top;\n\t\twidth: 0.45em;\n\n\t\t", ";\n\t}\n"])), function (props) {
435
+ return props.open ? open : null;
436
+ });
437
+
438
+ var getClassName = reactivecore.helper.getClassName;
439
+ var Dropdown = {
440
+ data: function data() {
441
+ this.__state = {
442
+ isOpen: false,
443
+ searchTerm: ''
444
+ };
445
+ return this.__state;
446
+ },
447
+ inject: {
448
+ theme: {
449
+ from: 'theme_reactivesearch'
450
+ }
451
+ },
452
+ props: {
453
+ innerClass: vueTypes.types.style,
454
+ items: vueTypes.types.data,
455
+ keyField: VueTypes.string.def('key'),
456
+ labelField: VueTypes.string.def('label'),
457
+ multi: VueTypes.bool,
458
+ // change event
459
+ placeholder: vueTypes.types.string,
460
+ returnsObject: VueTypes.bool,
461
+ customLabelRenderer: vueTypes.types.func,
462
+ hasCustomRenderer: VueTypes.bool,
463
+ customRenderer: vueTypes.types.func,
464
+ renderItem: vueTypes.types.func,
465
+ renderNoResults: VueTypes.any,
466
+ handleChange: vueTypes.types.func,
467
+ transformData: vueTypes.types.func,
468
+ selectedItem: vueTypes.types.selectedValue,
469
+ showCount: VueTypes.bool,
470
+ single: VueTypes.bool,
471
+ small: VueTypes.bool.def(false),
472
+ themePreset: vueTypes.types.themePreset,
473
+ showSearch: VueTypes.bool,
474
+ showClear: VueTypes.bool,
475
+ searchPlaceholder: VueTypes.string.def('Type here to search...')
476
+ },
477
+ render: function render() {
478
+ var _this = this;
479
+ var _this$$props = this.$props,
480
+ items = _this$$props.items,
481
+ selectedItem = _this$$props.selectedItem,
482
+ placeholder = _this$$props.placeholder,
483
+ labelField = _this$$props.labelField,
484
+ keyField = _this$$props.keyField,
485
+ themePreset = _this$$props.themePreset,
486
+ renderItem = _this$$props.renderItem,
487
+ transformData = _this$$props.transformData,
488
+ footer = _this$$props.footer,
489
+ customLabelRenderer = _this$$props.customLabelRenderer,
490
+ hasCustomRenderer = _this$$props.hasCustomRenderer,
491
+ customRenderer = _this$$props.customRenderer;
492
+ var itemsToRender = items;
493
+ if (transformData) {
494
+ itemsToRender = transformData(itemsToRender);
495
+ }
496
+ var filteredItemsToRender = itemsToRender.filter(function (item) {
497
+ if (String(item[labelField]).length) {
498
+ if (_this.$props.showSearch && _this.$data.searchTerm) {
499
+ return suggestions.replaceDiacritics(String(item[labelField])).toLowerCase().includes(suggestions.replaceDiacritics(_this.$data.searchTerm.toLowerCase()));
500
+ }
501
+ return true;
502
+ }
503
+ return false;
504
+ });
505
+ return vue.createVNode(Downshift, {
506
+ "isOpen": this.$data.isOpen,
507
+ "selectedItem": selectedItem,
508
+ "handleChange": this.onChange,
509
+ "handleMouseup": this.handleStateChange
510
+ }, {
511
+ "default": function _default(_ref) {
512
+ var getItemProps = _ref.getItemProps,
513
+ isOpen = _ref.isOpen,
514
+ highlightedIndex = _ref.highlightedIndex,
515
+ getButtonProps = _ref.getButtonProps,
516
+ getItemEvents = _ref.getItemEvents,
517
+ getInputEvents = _ref.getInputEvents;
518
+ return vue.createVNode("div", {
519
+ "class": Input.suggestionsContainer
520
+ }, [vue.createVNode(Select, vue.mergeProps(_transformOn(getButtonProps({
521
+ onClick: _this.toggle
522
+ })), {
523
+ "class": getClassName(_this.$props.innerClass, 'select') || '',
524
+ "title": selectedItem ? _this.renderToString(selectedItem) : placeholder,
525
+ "small": _this.$props.small,
526
+ "themePreset": _this.$props.themePreset
527
+ }), {
528
+ "default": function _default() {
529
+ return [customLabelRenderer ? customLabelRenderer(selectedItem) : vue.createVNode("div", null, [selectedItem ? _this.renderToString(selectedItem) : placeholder]), vue.createVNode(Chevron, {
530
+ "open": isOpen
531
+ }, null)];
532
+ }
533
+ }), hasCustomRenderer ? customRenderer(itemsToRender, {
534
+ getItemProps: getItemProps,
535
+ isOpen: isOpen,
536
+ highlightedIndex: highlightedIndex,
537
+ getButtonProps: getButtonProps,
538
+ getItemEvents: getItemEvents
539
+ }) : isOpen && itemsToRender.length ? vue.createVNode("ul", {
540
+ "class": Input.suggestions(themePreset, _this.theme) + " " + (_this.$props.small ? 'small' : '') + " " + getClassName(_this.$props.innerClass, 'list')
541
+ }, [_this.$props.showSearch ? _this.renderSearchbox({
542
+ on: {
543
+ input: getInputEvents({
544
+ onInput: _this.handleInputChange
545
+ }).input
546
+ }
547
+ }) : null, !hasCustomRenderer && filteredItemsToRender.length === 0 ? _this.renderNoResult() : filteredItemsToRender.map(function (item, index) {
548
+ var selected = _this.$props.multi // MultiDropdownList
549
+ && (selectedItem && !!selectedItem[item[keyField]] // MultiDropdownRange
550
+ || Array.isArray(selectedItem) && selectedItem.find(function (value) {
551
+ return value[labelField] === item[labelField];
552
+ }));
553
+ if (!_this.$props.multi) selected = item.key === selectedItem;
554
+ return vue.createVNode("li", vue.mergeProps(getItemProps({
555
+ item: item
556
+ }), _transformOn(getItemEvents({
557
+ item: item
558
+ })), {
559
+ "key": item[keyField],
560
+ "class": "" + (selected ? 'active' : ''),
561
+ "style": {
562
+ backgroundColor: _this.getBackgroundColor(highlightedIndex === index, selected)
563
+ }
564
+ }), [renderItem ? renderItem({
565
+ label: item[labelField],
566
+ count: item.doc_count,
567
+ isChecked: selected && _this.$props.multi
568
+ }) : vue.createVNode("div", null, [typeof item[labelField] === 'string' ? vue.createVNode("span", {
569
+ "innerHTML": item[labelField]
570
+ }, null) : item[labelField], _this.$props.showCount && item.doc_count && vue.createVNode("span", {
571
+ "class": getClassName(_this.$props.innerClass, 'count') || ''
572
+ }, [vue.createTextVNode("\xA0("), item.doc_count, vue.createTextVNode(")")])]), selected && _this.$props.multi ? vue.createVNode(Tick, {
573
+ "class": getClassName(_this.$props.innerClass, 'icon') || ''
574
+ }, null) : null]);
575
+ }), footer]) : null]);
576
+ }
577
+ });
578
+ },
579
+ methods: {
580
+ toggle: function toggle() {
581
+ this.isOpen = !this.$data.isOpen;
582
+ },
583
+ close: function close() {
584
+ this.isOpen = false;
585
+ },
586
+ onChange: function onChange(item) {
587
+ if (this.$props.returnsObject) {
588
+ this.$props.handleChange(item);
589
+ } else {
590
+ this.$props.handleChange(item[this.$props.keyField]);
591
+ }
592
+ if (!this.$props.multi) {
593
+ this.isOpen = false;
594
+ this.searchTerm = '';
595
+ }
596
+ },
597
+ handleStateChange: function handleStateChange(_ref2) {
598
+ var isOpen = _ref2.isOpen;
599
+ this.isOpen = isOpen;
600
+ },
601
+ getBackgroundColor: function getBackgroundColor(highlighted, selected) {
602
+ var isDark = this.$props.themePreset === 'dark';
603
+ if (highlighted) {
604
+ return isDark ? '#555' : '#eee';
605
+ }
606
+ if (selected) {
607
+ return isDark ? '#686868' : '#fafafa';
608
+ }
609
+ return isDark ? '#424242' : '#fff';
610
+ },
611
+ handleInputChange: function handleInputChange(e) {
612
+ var value = e.target.value;
613
+ this.searchTerm = value;
614
+ },
615
+ clearSearchTerm: function clearSearchTerm() {
616
+ this.searchTerm = '';
617
+ },
618
+ renderToString: function renderToString(value) {
619
+ var _this2 = this;
620
+ var customLabelRenderer = this.$props.customLabelRenderer;
621
+ if (customLabelRenderer) {
622
+ var customLabel = customLabelRenderer(value);
623
+ if (typeof customLabel === 'string') {
624
+ return customLabel;
625
+ }
626
+ }
627
+ if (Array.isArray(value) && value.length) {
628
+ var arrayToRender = value.map(function (item) {
629
+ return _this2.renderToString(item);
630
+ });
631
+ return arrayToRender.join(', ');
632
+ }
633
+ if (value && typeof value === 'object') {
634
+ if (value[this.$props.labelField]) {
635
+ return value[this.$props.labelField];
636
+ }
637
+ if (Object.keys(value).length) {
638
+ return this.renderToString(Object.keys(value));
639
+ }
640
+ return this.$props.placeholder;
641
+ }
642
+ return value;
643
+ },
644
+ renderNoResult: function renderNoResult() {
645
+ var renderNoResults = this.$slots.renderNoResults || this.$props.renderNoResults;
646
+ return vue.createVNode("p", {
647
+ "class": getClassName(this.$props.innerClass, 'noResults') || null
648
+ }, [index.isFunction(renderNoResults) ? renderNoResults() : renderNoResults]);
649
+ },
650
+ renderSearchbox: function renderSearchbox(eventObject) {
651
+ var _this3 = this;
652
+ var _this$$props2 = this.$props,
653
+ componentId = _this$$props2.componentId,
654
+ searchPlaceholder = _this$$props2.searchPlaceholder,
655
+ showClear = _this$$props2.showClear,
656
+ themePreset = _this$$props2.themePreset,
657
+ innerClass = _this$$props2.innerClass;
658
+ var InputComponent = vue.createVNode(Input.Input, vue.mergeProps({
659
+ "id": componentId + "-input",
660
+ "style": {
661
+ border: 0,
662
+ borderBottom: '1px solid #ddd'
663
+ },
664
+ "showIcon": false,
665
+ "showClear": showClear,
666
+ "class": getClassName(innerClass, 'input'),
667
+ "placeholder": searchPlaceholder,
668
+ "value": this.$data.searchTerm,
669
+ "themePreset": themePreset
670
+ }, eventObject), null);
671
+ if (showClear) {
672
+ return vue.createVNode(InputWrapper, null, {
673
+ "default": function _default() {
674
+ return [InputComponent, _this3.searchTerm && vue.createVNode(IconGroup, {
675
+ "groupPosition": "right",
676
+ "positionType": "absolute"
677
+ }, {
678
+ "default": function _default() {
679
+ return [vue.createVNode(IconWrapper, {
680
+ "onClick": _this3.clearSearchTerm,
681
+ "isClearIcon": true
682
+ }, {
683
+ "default": function _default() {
684
+ return [vue.createVNode(CancelSvg, null, null)];
685
+ }
686
+ })];
687
+ }
688
+ })];
689
+ }
690
+ });
691
+ }
692
+ return InputComponent;
693
+ }
694
+ }
695
+ };
696
+
697
+ exports.CancelSvg = CancelSvg;
698
+ exports.Downshift = Downshift;
699
+ exports.Dropdown = Dropdown;
700
+ exports.IconGroup = IconGroup;
701
+ exports.IconWrapper = IconWrapper;
702
+ exports.InputWrapper = InputWrapper;