@empathyco/x-components 3.0.0-alpha.82 → 3.0.0-alpha.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/core/index.js.map +1 -1
- package/design-system/full-theme.css +64 -64
- package/docs/API-reference/api/x-components.md +0 -3
- package/docs/API-reference/api/x-components.xmoduleoptions.md +1 -1
- package/docs/API-reference/api/x-components.xstoremoduleoptions.md +1 -1
- package/docs/API-reference/components/history-queries/x-components.clear-history-queries.md +29 -4
- package/docs/API-reference/components/history-queries/x-components.history-queries.md +51 -23
- package/docs/API-reference/components/history-queries/x-components.history-query.md +67 -17
- package/docs/API-reference/components/next-queries/x-components.next-queries-list.md +2 -2
- package/docs/API-reference/components/next-queries/x-components.next-queries.md +107 -26
- package/docs/API-reference/components/next-queries/x-components.next-query.md +57 -9
- package/docs/API-reference/components/popular-searches/x-components.popular-search.md +54 -11
- package/docs/API-reference/components/popular-searches/x-components.popular-searches.md +87 -23
- package/docs/API-reference/components/query-suggestions/x-components.query-suggestion.md +6 -6
- package/docs/API-reference/components/query-suggestions/x-components.query-suggestions.md +15 -14
- package/docs/API-reference/components/related-tags/x-components.related-tag.md +14 -20
- package/docs/API-reference/components/related-tags/x-components.related-tags.md +25 -23
- package/docs/API-reference/components/search-box/x-components.clear-search-input.md +26 -21
- package/docs/API-reference/components/search-box/x-components.search-button.md +39 -17
- package/docs/API-reference/components/search-box/x-components.search-input.md +18 -18
- package/js/index.js +0 -1
- package/js/index.js.map +1 -1
- package/js/x-installer/x-installer/x-installer.js.map +1 -1
- package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries-list.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-search.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tag.vue.js +2 -2
- package/js/x-modules/related-tags/components/related-tag.vue.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tags.vue.js +2 -2
- package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
- package/js/x-modules/search-box/components/clear-search-input.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-input.vue.js +2 -2
- package/js/x-modules/search-box/components/search-input.vue.js.map +1 -1
- package/js/x-modules/tagging/store/actions/track.action.js +1 -2
- package/js/x-modules/tagging/store/actions/track.action.js.map +1 -1
- package/js/x-modules/tagging/wiring.js +1 -1
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/package.json +5 -6
- package/report/x-components.api.json +5 -380
- package/report/x-components.api.md +6 -30
- package/tagging/index.js +0 -1
- package/types/plugins/x-plugin.types.d.ts +2 -1
- package/types/plugins/x-plugin.types.d.ts.map +1 -1
- package/types/utils/types.d.ts +1 -10
- package/types/utils/types.d.ts.map +1 -1
- package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
- package/types/x-modules/tagging/service/index.d.ts +0 -1
- package/types/x-modules/tagging/service/index.d.ts.map +1 -1
- package/types/x-modules/tagging/service/types.d.ts +0 -20
- package/types/x-modules/tagging/service/types.d.ts.map +1 -1
- package/types/x-modules/tagging/wiring.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.deeppartial.md +0 -17
- package/docs/API-reference/api/x-components.defaultsessionservice._constructor_.md +0 -21
- package/docs/API-reference/api/x-components.defaultsessionservice.clearsessionid.md +0 -17
- package/docs/API-reference/api/x-components.defaultsessionservice.getsessionid.md +0 -19
- package/docs/API-reference/api/x-components.defaultsessionservice.instance.md +0 -13
- package/docs/API-reference/api/x-components.defaultsessionservice.md +0 -37
- package/docs/API-reference/api/x-components.defaultsessionservice.session_id_key.md +0 -13
- package/docs/API-reference/api/x-components.defaultsessionservice.storageservice.md +0 -11
- package/docs/API-reference/api/x-components.defaultsessionservice.ttlms.md +0 -11
- package/docs/API-reference/api/x-components.sessionservice.clearsessionid.md +0 -17
- package/docs/API-reference/api/x-components.sessionservice.getsessionid.md +0 -23
- package/docs/API-reference/api/x-components.sessionservice.md +0 -21
- package/js/x-modules/tagging/service/session.service.js +0 -48
- package/js/x-modules/tagging/service/session.service.js.map +0 -1
- package/types/x-modules/tagging/service/session.service.d.ts +0 -37
- package/types/x-modules/tagging/service/session.service.d.ts.map +0 -1
|
@@ -34,20 +34,60 @@ of `shirts`.
|
|
|
34
34
|
You don't need to pass any props, or slots. Simply add the component, and when it has any next
|
|
35
35
|
queries it will show them
|
|
36
36
|
|
|
37
|
-
```vue
|
|
38
|
-
<
|
|
37
|
+
```vue live
|
|
38
|
+
<template>
|
|
39
|
+
<div>
|
|
40
|
+
<SearchInput />
|
|
41
|
+
<NextQueries />
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
import { SearchInput } from "@empathyco/x-components/search-box";
|
|
47
|
+
import { NextQueries } from "@empathyco/x-components/next-queries";
|
|
48
|
+
|
|
49
|
+
export default {
|
|
50
|
+
name: "NextQueriesDemo",
|
|
51
|
+
components: {
|
|
52
|
+
SearchInput,
|
|
53
|
+
NextQueries
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
39
57
|
```
|
|
40
58
|
|
|
41
59
|
The component has three optional props. `animation` to render the component with an animation,
|
|
42
60
|
`maxItemToRender` to limit the number of next queries will be rendered (by default it is 5) and
|
|
43
61
|
`highlightCurated` to indicate if the curated Next Queries inside the list should be highlighted.
|
|
44
62
|
|
|
45
|
-
```vue
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
```vue live
|
|
64
|
+
<template>
|
|
65
|
+
<div>
|
|
66
|
+
<SearchInput />
|
|
67
|
+
<NextQueries
|
|
68
|
+
:animation="'FadeAndSlide'"
|
|
69
|
+
:maxItemsToRender="10"
|
|
70
|
+
:highlightCurated="true"
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
import Vue from "vue";
|
|
77
|
+
import { SearchInput } from "@empathyco/x-components/search-box";
|
|
78
|
+
import { NextQueries } from "@empathyco/x-components/next-queries";
|
|
79
|
+
import { FadeAndSlide } from "@empathyco/x-components";
|
|
80
|
+
|
|
81
|
+
// Registering the animation as a global component
|
|
82
|
+
Vue.component("FadeAndSlide", FadeAndSlide);
|
|
83
|
+
export default {
|
|
84
|
+
name: "NextQueriesDemo",
|
|
85
|
+
components: {
|
|
86
|
+
SearchInput,
|
|
87
|
+
NextQueries
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
</script>
|
|
51
91
|
```
|
|
52
92
|
|
|
53
93
|
### Overriding Next Queries' Content
|
|
@@ -56,13 +96,33 @@ You can use your custom implementation of the Next Query's content. In the examp
|
|
|
56
96
|
using the default Next Query's content, an icon is added, as well as a span with the query of the
|
|
57
97
|
Next Query suggestion.
|
|
58
98
|
|
|
59
|
-
```vue
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
99
|
+
```vue live
|
|
100
|
+
<template>
|
|
101
|
+
<div>
|
|
102
|
+
<SearchInput />
|
|
103
|
+
<NextQueries>
|
|
104
|
+
<template #suggestion-content="{ suggestion }">
|
|
105
|
+
<Nq1Icon />
|
|
106
|
+
<span class="x-next-query__query">{{ suggestion.query }}</span>
|
|
107
|
+
</template>
|
|
108
|
+
</NextQueries>
|
|
109
|
+
</div>
|
|
110
|
+
</template>
|
|
111
|
+
|
|
112
|
+
<script>
|
|
113
|
+
import { SearchInput } from "@empathyco/x-components/search-box";
|
|
114
|
+
import { NextQueries } from "@empathyco/x-components/next-queries";
|
|
115
|
+
import { Nq1Icon } from "@empathyco/x-components";
|
|
116
|
+
|
|
117
|
+
export default {
|
|
118
|
+
name: "NextQueriesDemo",
|
|
119
|
+
components: {
|
|
120
|
+
SearchInput,
|
|
121
|
+
NextQueries,
|
|
122
|
+
Nq1Icon
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
</script>
|
|
66
126
|
```
|
|
67
127
|
|
|
68
128
|
### Adding a custom next query component
|
|
@@ -72,16 +132,37 @@ the `emitNextQuerySelected` function when the next query is selected. In the exa
|
|
|
72
132
|
of using the default `button` tag for a next query, an icon is added, and the text of the next query
|
|
73
133
|
is wrapped in a `span`
|
|
74
134
|
|
|
75
|
-
```vue
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<
|
|
135
|
+
```vue live
|
|
136
|
+
<template>
|
|
137
|
+
<div>
|
|
138
|
+
<SearchInput />
|
|
139
|
+
<NextQueries>
|
|
140
|
+
<template #suggestion="{ suggestion }">
|
|
141
|
+
<NextQuery :suggestion="suggestion" class="x-next-queries__suggestion">
|
|
142
|
+
<template #default="{ suggestion }">
|
|
143
|
+
<Nq1Icon />
|
|
144
|
+
<span class="x-next-query__query">{{ suggestion.query }}</span>
|
|
145
|
+
</template>
|
|
146
|
+
</NextQuery>
|
|
147
|
+
<button>Custom Behaviour</button>
|
|
82
148
|
</template>
|
|
83
|
-
</
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
149
|
+
</NextQueries>
|
|
150
|
+
</div>
|
|
151
|
+
</template>
|
|
152
|
+
|
|
153
|
+
<script>
|
|
154
|
+
import { SearchInput } from "@empathyco/x-components/search-box";
|
|
155
|
+
import { NextQueries, NextQuery } from "@empathyco/x-components/next-queries";
|
|
156
|
+
import { Nq1Icon } from "@empathyco/x-components";
|
|
157
|
+
|
|
158
|
+
export default {
|
|
159
|
+
name: "NextQueriesDemo",
|
|
160
|
+
components: {
|
|
161
|
+
SearchInput,
|
|
162
|
+
NextQueries,
|
|
163
|
+
NextQuery,
|
|
164
|
+
Nq1Icon
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
</script>
|
|
87
168
|
```
|
|
@@ -34,21 +34,69 @@ CSS class.
|
|
|
34
34
|
|
|
35
35
|
Using default slot:
|
|
36
36
|
|
|
37
|
-
```vue
|
|
38
|
-
<
|
|
37
|
+
```vue live
|
|
38
|
+
<template>
|
|
39
|
+
<NextQuery :suggestion="suggestion" />
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { NextQuery } from "@empathyco/x-components/next-queries";
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name: "NextQueryDemo",
|
|
47
|
+
components: {
|
|
48
|
+
NextQuery
|
|
49
|
+
},
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
suggestion: {
|
|
53
|
+
modelName: "NextQuery",
|
|
54
|
+
query: "tshirt",
|
|
55
|
+
facets: []
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
39
61
|
```
|
|
40
62
|
|
|
41
63
|
### Overriding default slot.
|
|
42
64
|
|
|
43
65
|
The default slot allows you to replace the content of the suggestion button.
|
|
44
66
|
|
|
45
|
-
```vue
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
67
|
+
```vue live
|
|
68
|
+
<template>
|
|
69
|
+
<NextQuery :suggestion="suggestion">
|
|
70
|
+
<template #default="{ suggestion }">
|
|
71
|
+
<Nq1Icon />
|
|
72
|
+
<span class="x-next-query__query" :aria-label="suggestion.query">{{
|
|
73
|
+
suggestion.query
|
|
74
|
+
}}</span>
|
|
75
|
+
</template>
|
|
76
|
+
</NextQuery>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script>
|
|
80
|
+
import { NextQuery } from "@empathyco/x-components/next-queries";
|
|
81
|
+
import { Nq1Icon } from "@empathyco/x-components";
|
|
82
|
+
|
|
83
|
+
export default {
|
|
84
|
+
name: "NextQueryDemo",
|
|
85
|
+
components: {
|
|
86
|
+
NextQuery,
|
|
87
|
+
Nq1Icon
|
|
88
|
+
},
|
|
89
|
+
data() {
|
|
90
|
+
return {
|
|
91
|
+
suggestion: {
|
|
92
|
+
modelName: "NextQuery",
|
|
93
|
+
query: "tshirt",
|
|
94
|
+
facets: []
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
</script>
|
|
52
100
|
```
|
|
53
101
|
|
|
54
102
|
## Dynamic Classes
|
|
@@ -29,21 +29,64 @@ content. By default, it renders the suggestion query of the popular search.
|
|
|
29
29
|
|
|
30
30
|
### Basic Usage
|
|
31
31
|
|
|
32
|
-
```vue
|
|
33
|
-
<
|
|
32
|
+
```vue live
|
|
33
|
+
<template>
|
|
34
|
+
<PopularSearch :suggestion="suggestion" />
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import { PopularSearch } from "@empathyco/x-components/popular-searches";
|
|
39
|
+
export default {
|
|
40
|
+
name: "PopularSearchDemo",
|
|
41
|
+
components: {
|
|
42
|
+
PopularSearch
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
suggestion: {
|
|
47
|
+
modelName: "PopularSearch",
|
|
48
|
+
query: "tshirt",
|
|
49
|
+
facets: []
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
34
55
|
```
|
|
35
56
|
|
|
36
57
|
### Custom Usage
|
|
37
58
|
|
|
38
|
-
```vue
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</
|
|
46
|
-
</
|
|
59
|
+
```vue live
|
|
60
|
+
<template>
|
|
61
|
+
<PopularSearch :suggestion="suggestion">
|
|
62
|
+
<template #default="{ suggestion }">
|
|
63
|
+
<TrendingIcon />
|
|
64
|
+
<span :aria-label="suggestion.query">{{ suggestion.query }}</span>
|
|
65
|
+
</template>
|
|
66
|
+
</PopularSearch>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
import { PopularSearch } from "@empathyco/x-components/popular-searches";
|
|
71
|
+
import { TrendingIcon } from "@empathyco/x-components";
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
name: "PopularSearchDemo",
|
|
75
|
+
components: {
|
|
76
|
+
PopularSearch,
|
|
77
|
+
TrendingIcon
|
|
78
|
+
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
suggestion: {
|
|
82
|
+
modelName: "PopularSearch",
|
|
83
|
+
query: "tshirt",
|
|
84
|
+
facets: []
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
</script>
|
|
47
90
|
```
|
|
48
91
|
|
|
49
92
|
## Events
|
|
@@ -32,15 +32,45 @@ optionally have associated a set of filters.
|
|
|
32
32
|
You don't need to pass any props, or slots. Simply add the component, and when it has any popular
|
|
33
33
|
searches it will show them.
|
|
34
34
|
|
|
35
|
-
```vue
|
|
36
|
-
<
|
|
35
|
+
```vue live
|
|
36
|
+
<template>
|
|
37
|
+
<PopularSearches />
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
import { PopularSearches } from "@empathyco/x-components/popular-searches";
|
|
42
|
+
export default {
|
|
43
|
+
name: "PopularSearchesDemo",
|
|
44
|
+
components: {
|
|
45
|
+
PopularSearches
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
37
49
|
```
|
|
38
50
|
|
|
39
51
|
The component has two optional props. `animation` to render the component with an animation and
|
|
40
52
|
`maxItemToRender` to limit the number of popular searches will be rendered (by default it is 5).
|
|
41
53
|
|
|
42
|
-
```vue
|
|
43
|
-
<
|
|
54
|
+
```vue live
|
|
55
|
+
<template>
|
|
56
|
+
<PopularSearches :animation="'FadeAndSlide'" :maxItemsToRender="10" />
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script>
|
|
60
|
+
import Vue from "vue";
|
|
61
|
+
import { PopularSearches } from "@empathyco/x-components/popular-searches";
|
|
62
|
+
import FadeAndSlide from "@empathyco/x-components";
|
|
63
|
+
|
|
64
|
+
// Registering the animation as a global component
|
|
65
|
+
Vue.component("FadeAndSlide", FadeAndSlide);
|
|
66
|
+
export default {
|
|
67
|
+
name: "PopularSearchesDemo",
|
|
68
|
+
components: {
|
|
69
|
+
PopularSearches,
|
|
70
|
+
FadeAndSlide
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
44
74
|
```
|
|
45
75
|
|
|
46
76
|
### Overriding Popular Search's Content
|
|
@@ -49,13 +79,28 @@ You can use your custom implementation of the Popular Search's content. In the e
|
|
|
49
79
|
instead of using the default Popular Search's content, an icon is added, as well as a span with the
|
|
50
80
|
query of the Popular Search's suggestion.
|
|
51
81
|
|
|
52
|
-
```vue
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</
|
|
82
|
+
```vue live
|
|
83
|
+
<template>
|
|
84
|
+
<PopularSearches>
|
|
85
|
+
<template #suggestion-content="{ suggestion }">
|
|
86
|
+
<TrendingIcon />
|
|
87
|
+
<span class="x-popular-search__query">{{ suggestion.query }}</span>
|
|
88
|
+
</template>
|
|
89
|
+
</PopularSearches>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script>
|
|
93
|
+
import { PopularSearches } from "@empathyco/x-components/popular-searches";
|
|
94
|
+
import { TrendingIcon } from "@empathyco/x-components";
|
|
95
|
+
|
|
96
|
+
export default {
|
|
97
|
+
name: "PopularSearchesDemo",
|
|
98
|
+
components: {
|
|
99
|
+
PopularSearches,
|
|
100
|
+
TrendingIcon
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
</script>
|
|
59
104
|
```
|
|
60
105
|
|
|
61
106
|
### Adding a Custom Popular Search Item
|
|
@@ -66,16 +111,35 @@ implementation is added, it has an image and a span as content (as in the previo
|
|
|
66
111
|
button with a user customized behaviour is added at the same hierarchical level as the Popular
|
|
67
112
|
Search component.
|
|
68
113
|
|
|
69
|
-
```vue
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</
|
|
114
|
+
```vue live
|
|
115
|
+
<template>
|
|
116
|
+
<PopularSearches>
|
|
117
|
+
<template #suggestion="{ suggestion }">
|
|
118
|
+
<PopularSearch :suggestion="suggestion">
|
|
119
|
+
<template #default="{ suggestion }">
|
|
120
|
+
<TrendingIcon />
|
|
121
|
+
<span class="x-popular-search__query">{{ suggestion.query }}</span>
|
|
122
|
+
</template>
|
|
123
|
+
</PopularSearch>
|
|
124
|
+
<button>Custom Behaviour</button>
|
|
125
|
+
</template>
|
|
126
|
+
</PopularSearches>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<script>
|
|
130
|
+
import {
|
|
131
|
+
PopularSearches,
|
|
132
|
+
PopularSearch
|
|
133
|
+
} from "@empathyco/x-components/popular-searches";
|
|
134
|
+
import { TrendingIcon } from "@empathyco/x-components";
|
|
135
|
+
|
|
136
|
+
export default {
|
|
137
|
+
name: "PopularSearchesDemo",
|
|
138
|
+
components: {
|
|
139
|
+
PopularSearches,
|
|
140
|
+
PopularSearch,
|
|
141
|
+
TrendingIcon
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
</script>
|
|
81
145
|
```
|
|
@@ -39,7 +39,7 @@ implemented.
|
|
|
39
39
|
|
|
40
40
|
Here you can see how a single query suggestion is rendered using the `suggestion` prop.
|
|
41
41
|
|
|
42
|
-
```vue
|
|
42
|
+
```vue live
|
|
43
43
|
<template>
|
|
44
44
|
<QuerySuggestion :suggestion="suggestion" />
|
|
45
45
|
</template>
|
|
@@ -55,7 +55,7 @@ export default {
|
|
|
55
55
|
return {
|
|
56
56
|
suggestion: {
|
|
57
57
|
modelName: "QuerySuggestion",
|
|
58
|
-
query: "
|
|
58
|
+
query: "tshirt",
|
|
59
59
|
facets: []
|
|
60
60
|
}
|
|
61
61
|
};
|
|
@@ -69,7 +69,7 @@ export default {
|
|
|
69
69
|
In this example, the query suggestion is painted in blue by passing a color style in the HTML span
|
|
70
70
|
element.
|
|
71
71
|
|
|
72
|
-
```vue
|
|
72
|
+
```vue live
|
|
73
73
|
<template>
|
|
74
74
|
<QuerySuggestion :suggestion="suggestion" #default="{ queryHTML }">
|
|
75
75
|
<span v-html="queryHTML" style="color: blue;" />
|
|
@@ -87,7 +87,7 @@ export default {
|
|
|
87
87
|
return {
|
|
88
88
|
suggestion: {
|
|
89
89
|
modelName: "QuerySuggestion",
|
|
90
|
-
query: "
|
|
90
|
+
query: "tshirt",
|
|
91
91
|
facets: []
|
|
92
92
|
}
|
|
93
93
|
};
|
|
@@ -101,7 +101,7 @@ export default {
|
|
|
101
101
|
In this example, when you click on the query suggestion, a message is displayed to illustrate that
|
|
102
102
|
the `UserSelectedAQuerySuggestion` event has been triggered.
|
|
103
103
|
|
|
104
|
-
```vue
|
|
104
|
+
```vue live
|
|
105
105
|
<template>
|
|
106
106
|
<QuerySuggestion
|
|
107
107
|
:suggestion="suggestion"
|
|
@@ -120,7 +120,7 @@ export default {
|
|
|
120
120
|
return {
|
|
121
121
|
suggestion: {
|
|
122
122
|
modelName: "QuerySuggestion",
|
|
123
|
-
query: "
|
|
123
|
+
query: "tshirt",
|
|
124
124
|
facets: []
|
|
125
125
|
}
|
|
126
126
|
};
|
|
@@ -34,12 +34,12 @@ implemented.
|
|
|
34
34
|
<!-- prettier-ignore-end -->
|
|
35
35
|
|
|
36
36
|
In this example, a list of query suggestions is displayed. See how the suggestions change as you
|
|
37
|
-
type “
|
|
37
|
+
type “sandal”. If you click on a suggestion, the search term in the search input is updated and the
|
|
38
38
|
query suggestions are changed to reflect the new search term.
|
|
39
39
|
|
|
40
|
-
_Type “
|
|
40
|
+
_Type “sandal” or another fashion term in the input field to try it out!_
|
|
41
41
|
|
|
42
|
-
```vue
|
|
42
|
+
```vue live
|
|
43
43
|
<template>
|
|
44
44
|
<div>
|
|
45
45
|
<SearchInput />
|
|
@@ -66,22 +66,23 @@ export default {
|
|
|
66
66
|
In this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the
|
|
67
67
|
matching query suggestions are shuffled with a slight delay as more letters of the term are typed.
|
|
68
68
|
|
|
69
|
-
_Type “
|
|
69
|
+
_Type “lipstick” or another fashion term in the input field to try it out!_
|
|
70
70
|
|
|
71
|
-
```vue
|
|
71
|
+
```vue live
|
|
72
72
|
<template>
|
|
73
73
|
<div>
|
|
74
74
|
<SearchInput />
|
|
75
|
-
<QuerySuggestions animation="StaggeredFadeAndSlide" />
|
|
75
|
+
<QuerySuggestions :animation="'StaggeredFadeAndSlide'" />
|
|
76
76
|
</div>
|
|
77
77
|
</template>
|
|
78
78
|
|
|
79
79
|
<script>
|
|
80
|
+
import Vue from "vue";
|
|
80
81
|
import { QuerySuggestions } from "@empathyco/x-components/query-suggestions";
|
|
81
82
|
import { SearchInput } from "@empathyco/x-components/search-box";
|
|
82
83
|
import { StaggeredFadeAndSlide } from "@empathyco/x-components";
|
|
83
84
|
|
|
84
|
-
//
|
|
85
|
+
// Registering the animation as a global component
|
|
85
86
|
Vue.component("StaggeredFadeAndSlide", StaggeredFadeAndSlide);
|
|
86
87
|
export default {
|
|
87
88
|
name: "QuerySuggestionsDemo",
|
|
@@ -97,9 +98,9 @@ export default {
|
|
|
97
98
|
|
|
98
99
|
Here, the `suggestion` binding property passes the suggestion data.
|
|
99
100
|
|
|
100
|
-
_Type “
|
|
101
|
+
_Type “bag” or another fashion term in the input field to try it out!_
|
|
101
102
|
|
|
102
|
-
```vue
|
|
103
|
+
```vue live
|
|
103
104
|
<template>
|
|
104
105
|
<div>
|
|
105
106
|
<SearchInput />
|
|
@@ -133,7 +134,7 @@ If you're not using the [`QuerySuggestion`](./query-suggestion.md) component, th
|
|
|
133
134
|
you must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in
|
|
134
135
|
`QuerySuggestions`.
|
|
135
136
|
|
|
136
|
-
```vue
|
|
137
|
+
```vue live
|
|
137
138
|
<template>
|
|
138
139
|
<div>
|
|
139
140
|
<SearchInput />
|
|
@@ -180,9 +181,9 @@ you must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` e
|
|
|
180
181
|
In this example, the `suggestion` and `queryHTML` bindings have been passed in the
|
|
181
182
|
`suggestion-content` slot to paint the resulting query suggestions in blue.
|
|
182
183
|
|
|
183
|
-
_Type “
|
|
184
|
+
_Type “trousers” or another toy in the input field to try it out!_
|
|
184
185
|
|
|
185
|
-
```vue
|
|
186
|
+
```vue live
|
|
186
187
|
<template>
|
|
187
188
|
<div>
|
|
188
189
|
<SearchInput />
|
|
@@ -216,9 +217,9 @@ Components can be combined and communicate with each other. Commonly, the `Query
|
|
|
216
217
|
component communicates with the [`SearchInput`](../search-box/x-components.search-input.md),
|
|
217
218
|
updating the term in the search input.
|
|
218
219
|
|
|
219
|
-
_Type “
|
|
220
|
+
_Type “pants” or another toy in the input field to try it out!_
|
|
220
221
|
|
|
221
|
-
```vue
|
|
222
|
+
```vue live
|
|
222
223
|
<template>
|
|
223
224
|
<div>
|
|
224
225
|
<SearchInput />
|
|
@@ -50,9 +50,9 @@ In this example related tag data is passed as a prop.
|
|
|
50
50
|
|
|
51
51
|
_Here you can see how the RelatedTag component is rendered._
|
|
52
52
|
|
|
53
|
-
```vue
|
|
53
|
+
```vue live
|
|
54
54
|
<template>
|
|
55
|
-
<RelatedTag :relatedTag="tag"
|
|
55
|
+
<RelatedTag :relatedTag="tag" />
|
|
56
56
|
</template>
|
|
57
57
|
|
|
58
58
|
<script>
|
|
@@ -67,10 +67,9 @@ export default {
|
|
|
67
67
|
return {
|
|
68
68
|
tag: {
|
|
69
69
|
modelName: "RelatedTag",
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
tag: "story"
|
|
70
|
+
query: "high heel",
|
|
71
|
+
isCurated: false,
|
|
72
|
+
tag: "heel"
|
|
74
73
|
}
|
|
75
74
|
};
|
|
76
75
|
}
|
|
@@ -84,7 +83,7 @@ In this example, an HTML span element is passed in the `default` slot.
|
|
|
84
83
|
|
|
85
84
|
_See how the related tag can be rendered._
|
|
86
85
|
|
|
87
|
-
```vue
|
|
86
|
+
```vue live
|
|
88
87
|
<template>
|
|
89
88
|
<RelatedTag :relatedTag="tag" #default="{ relatedTag }">
|
|
90
89
|
<span :aria-label="relatedTag.tag">{{ relatedTag.tag }}</span>
|
|
@@ -103,10 +102,9 @@ export default {
|
|
|
103
102
|
return {
|
|
104
103
|
tag: {
|
|
105
104
|
modelName: "RelatedTag",
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
tag: "story"
|
|
105
|
+
query: "high heel",
|
|
106
|
+
isCurated: false,
|
|
107
|
+
tag: "heel"
|
|
110
108
|
}
|
|
111
109
|
};
|
|
112
110
|
}
|
|
@@ -121,12 +119,9 @@ event is implemented, as illustrated by the “Tag” message returned.
|
|
|
121
119
|
|
|
122
120
|
_See how the event is triggered when the related tag is clicked._
|
|
123
121
|
|
|
124
|
-
```vue
|
|
122
|
+
```vue live
|
|
125
123
|
<template>
|
|
126
|
-
<RelatedTag
|
|
127
|
-
:relatedTag="tag"
|
|
128
|
-
@UserSelectedARelatedTag="alertRelatedTag"
|
|
129
|
-
></RelatedTag>
|
|
124
|
+
<RelatedTag :relatedTag="tag" @UserSelectedARelatedTag="alertRelatedTag" />
|
|
130
125
|
</template>
|
|
131
126
|
|
|
132
127
|
<script>
|
|
@@ -141,10 +136,9 @@ export default {
|
|
|
141
136
|
return {
|
|
142
137
|
tag: {
|
|
143
138
|
modelName: "RelatedTag",
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
tag: "story"
|
|
139
|
+
query: "high heel",
|
|
140
|
+
isCurated: false,
|
|
141
|
+
tag: "heel"
|
|
148
142
|
}
|
|
149
143
|
};
|
|
150
144
|
},
|