@empathyco/x-components 6.0.0-alpha.190 → 6.0.0-alpha.191
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 +8 -0
- package/docs/API-reference/components/ai/x-components.ai-overview.md +64 -0
- package/docs/API-reference/components/device/x-components.device-detector.md +33 -59
- package/docs/API-reference/components/empathize/x-components.empathize.md +74 -42
- package/docs/API-reference/components/experience-controls/x-components.experience-controls.md +2 -8
- package/docs/API-reference/components/identifier-results/x-components.identifier-result.md +13 -3
- package/docs/API-reference/components/identifier-results/x-components.identifier-results.md +29 -23
- package/docs/API-reference/components/next-queries/x-components.next-query.md +17 -38
- package/docs/API-reference/components/popular-searches/x-components.popular-search.md +17 -37
- package/docs/API-reference/components/popular-searches/x-components.popular-searches.md +6 -40
- package/docs/API-reference/components/recommendations/x-components.recommendations.md +33 -46
- package/docs/API-reference/components/tagging/x-components.tagging.md +4 -25
- package/docs/API-reference/components/url/x-components.url-handler.md +8 -22
- package/js/x-modules/ai/components/ai-overview.vue.js.map +1 -1
- package/js/x-modules/ai/components/ai-overview.vue2.js.map +1 -1
- package/js/x-modules/device/components/device-detector.vue.js.map +1 -1
- package/js/x-modules/device/components/device-detector.vue2.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
- package/js/x-modules/experience-controls/components/experience-controls.vue.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-result.vue.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-result.vue2.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-results.vue.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-results.vue2.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query.vue2.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-search.vue2.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue2.js.map +1 -1
- package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
- package/js/x-modules/recommendations/components/recommendations.vue2.js.map +1 -1
- package/js/x-modules/tagging/components/tagging.vue.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue2.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.0.0-alpha.191 (2026-01-22)
|
|
7
|
+
|
|
8
|
+
* docs: Update x-modules components documentation (1/6) (#1963) ([7b236fc](https://github.com/empathyco/x/commit/7b236fc)), closes [#1963](https://github.com/empathyco/x/issues/1963)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## 6.0.0-alpha.190 (2026-01-21)
|
|
7
15
|
|
|
8
16
|
* docs: Update common components documentation (#1962) ([9c51d49](https://github.com/empathyco/x/commit/9c51d49)), closes [#1962](https://github.com/empathyco/x/issues/1962)
|
|
@@ -32,3 +32,67 @@ title: AiOverview
|
|
|
32
32
|
| <code>sliding-panels-right-button</code> | | None |
|
|
33
33
|
| <code>result</code> | (required) result card | |
|
|
34
34
|
| <code>suggestions-extra-content</code> | | None |
|
|
35
|
+
|
|
36
|
+
## AI Overview Examples
|
|
37
|
+
|
|
38
|
+
The `ai-overview` component provides an AI-generated summary and suggestions for queries.
|
|
39
|
+
|
|
40
|
+
### Basic usage
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<template>
|
|
44
|
+
<AiOverview
|
|
45
|
+
:title="'AI Overview'"
|
|
46
|
+
:title-loading="'Generating with Empathy AI'"
|
|
47
|
+
:expand-text="'Show more'"
|
|
48
|
+
:collapse-text="'Show less'"
|
|
49
|
+
:content-classes="'my-content-class'"
|
|
50
|
+
:sliding-panels-classes="'my-sliding-panel-class'"
|
|
51
|
+
:sliding-panel-containers-classes="'my-sliding-panel-container-class'"
|
|
52
|
+
:sliding-panel-buttons-classes="'my-sliding-panel-button-class'"
|
|
53
|
+
>
|
|
54
|
+
<template #result="{ result }">
|
|
55
|
+
<ResultCard :result="result" />
|
|
56
|
+
</template>
|
|
57
|
+
</AiOverview>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup>
|
|
61
|
+
import AiOverview from '@empathyco/x-components/js/x-modules/ai/components/ai-overview.vue'
|
|
62
|
+
import ResultCard from './ResultCard.vue'
|
|
63
|
+
</script>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Customizing slots
|
|
67
|
+
|
|
68
|
+
You can customize the loading title, extra content, and sliding panel slots:
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<template>
|
|
72
|
+
<AiOverview
|
|
73
|
+
:title="'AI Overview'"
|
|
74
|
+
:title-loading="'Loading... Please wait'"
|
|
75
|
+
:expand-text="'Show more'"
|
|
76
|
+
:collapse-text="'Show less'"
|
|
77
|
+
>
|
|
78
|
+
<template #title-loading>
|
|
79
|
+
<span>Custom loading title...</span>
|
|
80
|
+
</template>
|
|
81
|
+
<template #extra-content>
|
|
82
|
+
<div>Extra content below the main overview</div>
|
|
83
|
+
</template>
|
|
84
|
+
<template #sliding-panels-addons="{ arrivedState }">
|
|
85
|
+
<span v-if="arrivedState.left">Left end reached</span>
|
|
86
|
+
<span v-if="arrivedState.right">Right end reached</span>
|
|
87
|
+
</template>
|
|
88
|
+
<template #result="{ result }">
|
|
89
|
+
<ResultCard :result="result" />
|
|
90
|
+
</template>
|
|
91
|
+
</AiOverview>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<script setup>
|
|
95
|
+
import AiOverview from '@empathyco/x-components/js/x-modules/ai/components/ai-overview.vue'
|
|
96
|
+
import ResultCard from './ResultCard.vue'
|
|
97
|
+
</script>
|
|
98
|
+
```
|
|
@@ -35,28 +35,21 @@ _Try resizing the browser window!_
|
|
|
35
35
|
<template>
|
|
36
36
|
<div>
|
|
37
37
|
<DeviceDetector :breakpoints="breakpoints" />
|
|
38
|
-
{{
|
|
38
|
+
{{ x.device }}
|
|
39
39
|
</div>
|
|
40
40
|
</template>
|
|
41
41
|
|
|
42
|
-
<script>
|
|
42
|
+
<script setup>
|
|
43
|
+
import { reactive } from 'vue'
|
|
43
44
|
import { DeviceDetector } from '@empathyco/x-components/device'
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
breakpoints: {
|
|
53
|
-
mobile: 600,
|
|
54
|
-
tablet: 900,
|
|
55
|
-
desktop: Number.POSITIVE_INFINITY,
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
}
|
|
45
|
+
import { use$x } from '../../../composables/use-$x'
|
|
46
|
+
|
|
47
|
+
const x = use$x()
|
|
48
|
+
const breakpoints = reactive({
|
|
49
|
+
mobile: 600,
|
|
50
|
+
tablet: 900,
|
|
51
|
+
desktop: Number.POSITIVE_INFINITY,
|
|
52
|
+
})
|
|
60
53
|
</script>
|
|
61
54
|
```
|
|
62
55
|
|
|
@@ -71,35 +64,28 @@ _Try resizing the window to check that it never changes_
|
|
|
71
64
|
<template>
|
|
72
65
|
<div>
|
|
73
66
|
<DeviceDetector force="mobile" :breakpoints="breakpoints" />
|
|
74
|
-
{{
|
|
67
|
+
{{ x.device }}
|
|
75
68
|
</div>
|
|
76
69
|
</template>
|
|
77
70
|
|
|
78
|
-
<script>
|
|
71
|
+
<script setup>
|
|
72
|
+
import { reactive } from 'vue'
|
|
79
73
|
import { DeviceDetector } from '@empathyco/x-components/device'
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
breakpoints: {
|
|
89
|
-
mobile: 600,
|
|
90
|
-
tablet: 900,
|
|
91
|
-
desktop: Number.POSITIVE_INFINITY,
|
|
92
|
-
},
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
}
|
|
74
|
+
import { use$x } from '../../../composables/use-$x'
|
|
75
|
+
|
|
76
|
+
const x = use$x()
|
|
77
|
+
const breakpoints = reactive({
|
|
78
|
+
mobile: 600,
|
|
79
|
+
tablet: 900,
|
|
80
|
+
desktop: Number.POSITIVE_INFINITY,
|
|
81
|
+
})
|
|
96
82
|
</script>
|
|
97
83
|
```
|
|
98
84
|
|
|
99
85
|
### Play with events
|
|
100
86
|
|
|
101
87
|
In this example, the `DeviceDetector` will emit a `DeviceProvided` event, with the new device as the
|
|
102
|
-
payload. This device is stored in a
|
|
88
|
+
payload. This device is stored in a ref and then displayed.
|
|
103
89
|
|
|
104
90
|
_Try resizing the browser window!_
|
|
105
91
|
|
|
@@ -111,29 +97,17 @@ _Try resizing the browser window!_
|
|
|
111
97
|
</div>
|
|
112
98
|
</template>
|
|
113
99
|
|
|
114
|
-
<script>
|
|
100
|
+
<script setup>
|
|
115
101
|
import { DeviceDetector } from '@empathyco/x-components/device'
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
breakpoints: {
|
|
126
|
-
mobile: 600,
|
|
127
|
-
tablet: 900,
|
|
128
|
-
desktop: Number.POSITIVE_INFINITY,
|
|
129
|
-
},
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
methods: {
|
|
133
|
-
storeDevice(device) {
|
|
134
|
-
this.device = device
|
|
135
|
-
},
|
|
136
|
-
},
|
|
102
|
+
import { reactive, ref } from 'vue'
|
|
103
|
+
const device = ref('unknown')
|
|
104
|
+
const breakpoints = reactive({
|
|
105
|
+
mobile: 600,
|
|
106
|
+
tablet: 900,
|
|
107
|
+
desktop: Number.POSITIVE_INFINITY,
|
|
108
|
+
})
|
|
109
|
+
function storeDevice(newDevice) {
|
|
110
|
+
device.value = newDevice
|
|
137
111
|
}
|
|
138
112
|
</script>
|
|
139
113
|
```
|
|
@@ -43,71 +43,103 @@ This component will listen to the configured events in `eventsToOpenEmpathize` a
|
|
|
43
43
|
are:
|
|
44
44
|
|
|
45
45
|
- Open: `UserFocusedSearchBox`, `UserIsTypingAQuery`, `UserClickedSearchBox`
|
|
46
|
-
- Close: `UserClosedEmpathize`, `UserSelectedASuggestion`, `
|
|
46
|
+
- Close: `UserClosedEmpathize`, `UserSelectedASuggestion`, `UserPressedEnterKey`, `UserBlurredSearchBox`
|
|
47
47
|
|
|
48
|
-
### Basic
|
|
48
|
+
### Basic example
|
|
49
49
|
|
|
50
50
|
The component rendering the query suggestions, popular searches and history queries with keyboard
|
|
51
51
|
navigation.
|
|
52
52
|
|
|
53
53
|
```vue
|
|
54
|
-
<
|
|
55
|
-
<
|
|
54
|
+
<template>
|
|
55
|
+
<Empathize>
|
|
56
56
|
<BaseKeyboardNavigation>
|
|
57
|
-
<QuerySuggestions/>
|
|
58
|
-
<PopularSearches/>
|
|
59
|
-
<HistoryQueries/>
|
|
57
|
+
<QuerySuggestions />
|
|
58
|
+
<PopularSearches />
|
|
59
|
+
<HistoryQueries />
|
|
60
60
|
</BaseKeyboardNavigation>
|
|
61
|
-
</
|
|
62
|
-
</
|
|
61
|
+
</Empathize>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup>
|
|
65
|
+
import Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'
|
|
66
|
+
import BaseKeyboardNavigation from '@empathyco/x-components/js/components/base-keyboard-navigation.vue'
|
|
67
|
+
import QuerySuggestions from '@empathyco/x-components/js/x-modules/query-suggestions/components/query-suggestions.vue'
|
|
68
|
+
import PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'
|
|
69
|
+
import HistoryQueries from '@empathyco/x-components/js/x-modules/history-queries/components/history-queries.vue'
|
|
70
|
+
</script>
|
|
63
71
|
```
|
|
64
72
|
|
|
65
|
-
Defining custom values for the events to open and close the Empathize. For example opening it when
|
|
73
|
+
Defining custom values for the events to open and close the Empathize. For example, opening it when
|
|
66
74
|
the search box loses the focus and closing it when the search box receives the focus:
|
|
67
75
|
|
|
68
76
|
```vue
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
<template>
|
|
78
|
+
<Empathize
|
|
79
|
+
:events-to-open-empathize="['UserBlurredSearchBox']"
|
|
80
|
+
:events-to-close-empathize="['UserFocusedSearchBox']"
|
|
81
|
+
>
|
|
74
82
|
Please, type a query in the Search Box.
|
|
75
|
-
</
|
|
76
|
-
</
|
|
83
|
+
</Empathize>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script setup>
|
|
87
|
+
import Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'
|
|
88
|
+
</script>
|
|
77
89
|
```
|
|
78
90
|
|
|
79
|
-
An animation can be used for the opening and closing using the `animation` prop. The animation
|
|
80
|
-
be a
|
|
91
|
+
An animation can be used for the opening and closing using the `animation` prop. The animation must
|
|
92
|
+
be a component with a `Transition` and a slot inside:
|
|
81
93
|
|
|
82
94
|
```vue
|
|
83
|
-
<
|
|
84
|
-
<
|
|
85
|
-
<PopularSearches/>
|
|
86
|
-
</
|
|
87
|
-
</
|
|
95
|
+
<template>
|
|
96
|
+
<Empathize :animation="collapseFromTop">
|
|
97
|
+
<PopularSearches />
|
|
98
|
+
</Empathize>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script setup>
|
|
102
|
+
import Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'
|
|
103
|
+
import PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'
|
|
104
|
+
import CollapseFromTop from './collapseFromTop.vue'
|
|
105
|
+
const animation = CollapseFromTop
|
|
106
|
+
</script>
|
|
88
107
|
```
|
|
89
108
|
|
|
90
|
-
###
|
|
109
|
+
### Advanced example
|
|
91
110
|
|
|
92
111
|
The component rendering the query suggestions, popular searches and history queries with keyboard
|
|
93
112
|
navigation. It also configures `searchAndCloseOnNoContent` to trigger a search and close the empathize
|
|
94
|
-
when has no
|
|
95
|
-
if the empathize has content or not.
|
|
96
|
-
It also configures `searchAndCloseDebounceInMs` to 500ms as debounce time to search and close the
|
|
97
|
-
empathize when has no-content.
|
|
113
|
+
when it has no content as fallback behaviour. To do that, `hasContent` prop must be reactive to know
|
|
114
|
+
if the empathize has content or not. It also configures `searchAndCloseDebounceInMs` to 500ms as debounce time to search and close the empathize when it has no content.
|
|
98
115
|
|
|
99
116
|
```vue
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
</
|
|
117
|
+
<template>
|
|
118
|
+
<Empathize
|
|
119
|
+
:animation="empathizeAnimation"
|
|
120
|
+
:events-to-close-empathize="empathizeCloseEvents"
|
|
121
|
+
:has-content="showEmpathize"
|
|
122
|
+
:search-and-close-debounce-in-ms="500"
|
|
123
|
+
search-and-close-on-no-content
|
|
124
|
+
>
|
|
125
|
+
<BaseKeyboardNavigation>
|
|
126
|
+
<QuerySuggestions />
|
|
127
|
+
<PopularSearches />
|
|
128
|
+
<HistoryQueries />
|
|
129
|
+
</BaseKeyboardNavigation>
|
|
130
|
+
</Empathize>
|
|
131
|
+
</template>
|
|
132
|
+
|
|
133
|
+
<script setup>
|
|
134
|
+
import Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'
|
|
135
|
+
import BaseKeyboardNavigation from '@empathyco/x-components/js/components/base-keyboard-navigation.vue'
|
|
136
|
+
import QuerySuggestions from '@empathyco/x-components/js/x-modules/query-suggestions/components/query-suggestions.vue'
|
|
137
|
+
import PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'
|
|
138
|
+
import HistoryQueries from '@empathyco/x-components/js/x-modules/history-queries/components/history-queries.vue'
|
|
139
|
+
import CollapseFromTop from './collapseFromTop.vue'
|
|
140
|
+
import { ref } from 'vue'
|
|
141
|
+
const empathizeAnimation = CollapseFromTop
|
|
142
|
+
const empathizeCloseEvents = ['UserClosedEmpathize', 'UserSelectedASuggestion']
|
|
143
|
+
const showEmpathize = ref(true)
|
|
144
|
+
</script>
|
|
113
145
|
```
|
package/docs/API-reference/components/experience-controls/x-components.experience-controls.md
CHANGED
|
@@ -17,14 +17,8 @@ This component will fire the events received in the `ExperienceControlsEventsCha
|
|
|
17
17
|
<template>
|
|
18
18
|
<ExperienceControls />
|
|
19
19
|
</template>
|
|
20
|
-
<script>
|
|
21
|
-
import { ExperienceControls } from '@empathyco/x-components/experience-controls'
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
components: {
|
|
26
|
-
ExperienceControls,
|
|
27
|
-
},
|
|
28
|
-
}
|
|
21
|
+
<script setup>
|
|
22
|
+
import { ExperienceControls } from '@empathyco/x-components/experience-controls'
|
|
29
23
|
</script>
|
|
30
24
|
```
|
|
@@ -18,10 +18,20 @@ query from the state. Receives as prop the @empathyco/x-types#Result data.
|
|
|
18
18
|
## Examples
|
|
19
19
|
|
|
20
20
|
This component renders an identifier result value and highlights its matching part with the query
|
|
21
|
-
from the state. Receives as prop the result data
|
|
21
|
+
from the state. Receives as prop the result data.
|
|
22
22
|
|
|
23
|
-
### Basic usage
|
|
23
|
+
### Basic usage
|
|
24
24
|
|
|
25
25
|
```vue
|
|
26
|
-
<
|
|
26
|
+
<template>
|
|
27
|
+
<IdentifierResult :result="result" />
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup>
|
|
31
|
+
import IdentifierResult from '@empathyco/x-components/js/x-modules/identifier-results/components/identifier-result.vue'
|
|
32
|
+
const result = {
|
|
33
|
+
identifier: { value: 'ABC-123-XYZ' },
|
|
34
|
+
// ...other result properties
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
27
37
|
```
|
|
@@ -25,22 +25,33 @@ other component.
|
|
|
25
25
|
|
|
26
26
|
## Examples
|
|
27
27
|
|
|
28
|
-
### Play with slot
|
|
29
|
-
|
|
30
28
|
A IdentifierResult **must** be used inside the IdentifierResults component. In the example below the
|
|
31
29
|
BaseResultLink is used as a wrapper and its default slot is filled with the IdentifierResult
|
|
32
30
|
component.
|
|
33
31
|
|
|
32
|
+
### Play with slot
|
|
33
|
+
|
|
34
34
|
```vue
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</
|
|
35
|
+
<template>
|
|
36
|
+
<IdentifierResults :animation="animation">
|
|
37
|
+
<template #default="{ identifierResult }">
|
|
38
|
+
<BaseResultLink :result="identifierResult">
|
|
39
|
+
<template #default="{ result }">
|
|
40
|
+
<IdentifierResult :result="result" />
|
|
41
|
+
</template>
|
|
42
|
+
</BaseResultLink>
|
|
43
|
+
</template>
|
|
44
|
+
</IdentifierResults>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
import IdentifierResults from '@empathyco/x-components/js/x-modules/identifier-results/components/identifier-results.vue'
|
|
49
|
+
import IdentifierResult from '@empathyco/x-components/js/x-modules/identifier-results/components/identifier-result.vue'
|
|
50
|
+
import BaseResultLink from '@empathyco/x-components/js/components/base-result-link.vue'
|
|
51
|
+
import FadeAndSlide from '@empathyco/x-components/js/animations/fade-and-slide.vue'
|
|
52
|
+
|
|
53
|
+
const animation = FadeAndSlide
|
|
54
|
+
</script>
|
|
44
55
|
```
|
|
45
56
|
|
|
46
57
|
### Play with props
|
|
@@ -49,20 +60,15 @@ In this example, the identifier results have been limited to render a maximum of
|
|
|
49
60
|
|
|
50
61
|
```vue
|
|
51
62
|
<template>
|
|
52
|
-
<IdentifierResults
|
|
53
|
-
<
|
|
63
|
+
<IdentifierResults :max-items-to-render="3">
|
|
64
|
+
<template #default="{ identifierResult }">
|
|
65
|
+
<IdentifierResult :result="identifierResult" />
|
|
66
|
+
</template>
|
|
54
67
|
</IdentifierResults>
|
|
55
68
|
</template>
|
|
56
69
|
|
|
57
|
-
<script>
|
|
58
|
-
import
|
|
59
|
-
|
|
60
|
-
export default {
|
|
61
|
-
name: 'IdentifierResultsDemo',
|
|
62
|
-
components: {
|
|
63
|
-
IdentifierResults,
|
|
64
|
-
IdentifierResult,
|
|
65
|
-
},
|
|
66
|
-
}
|
|
70
|
+
<script setup>
|
|
71
|
+
import IdentifierResults from '@empathyco/x-components/js/x-modules/identifier-results/components/identifier-results.vue'
|
|
72
|
+
import IdentifierResult from '@empathyco/x-components/js/x-modules/identifier-results/components/identifier-result.vue'
|
|
67
73
|
</script>
|
|
68
74
|
```
|
|
@@ -38,12 +38,12 @@ A list of events that the component will emit:
|
|
|
38
38
|
|
|
39
39
|
## Examples
|
|
40
40
|
|
|
41
|
-
This
|
|
41
|
+
This component expects just a suggestion as a prop to be rendered. It has a slot to override the
|
|
42
42
|
content. By default, it renders the suggestion query of the next query. It also has an optional
|
|
43
43
|
prop, `highlightCurated`, to indicate if the curated Next Queries should be differentiated with a
|
|
44
44
|
CSS class.
|
|
45
45
|
|
|
46
|
-
### Basic
|
|
46
|
+
### Basic usage
|
|
47
47
|
|
|
48
48
|
Using default slot:
|
|
49
49
|
|
|
@@ -52,28 +52,18 @@ Using default slot:
|
|
|
52
52
|
<NextQuery :suggestion="suggestion" />
|
|
53
53
|
</template>
|
|
54
54
|
|
|
55
|
-
<script>
|
|
55
|
+
<script setup>
|
|
56
56
|
import { NextQuery } from '@empathyco/x-components/next-queries'
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
data() {
|
|
64
|
-
return {
|
|
65
|
-
suggestion: {
|
|
66
|
-
modelName: 'NextQuery',
|
|
67
|
-
query: 'tshirt',
|
|
68
|
-
facets: [],
|
|
69
|
-
},
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
}
|
|
57
|
+
import { ref } from 'vue'
|
|
58
|
+
const suggestion = ref({
|
|
59
|
+
modelName: 'NextQuery',
|
|
60
|
+
query: 'tshirt',
|
|
61
|
+
facets: [],
|
|
62
|
+
})
|
|
73
63
|
</script>
|
|
74
64
|
```
|
|
75
65
|
|
|
76
|
-
### Overriding default slot
|
|
66
|
+
### Overriding default slot
|
|
77
67
|
|
|
78
68
|
The default slot allows you to replace the content of the suggestion button.
|
|
79
69
|
|
|
@@ -87,25 +77,14 @@ The default slot allows you to replace the content of the suggestion button.
|
|
|
87
77
|
</NextQuery>
|
|
88
78
|
</template>
|
|
89
79
|
|
|
90
|
-
<script>
|
|
80
|
+
<script setup>
|
|
91
81
|
import { NextQuery } from '@empathyco/x-components/next-queries'
|
|
92
82
|
import { TrendingIcon } from '@empathyco/x-components'
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
data() {
|
|
101
|
-
return {
|
|
102
|
-
suggestion: {
|
|
103
|
-
modelName: 'NextQuery',
|
|
104
|
-
query: 'tshirt',
|
|
105
|
-
facets: [],
|
|
106
|
-
},
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
}
|
|
83
|
+
import { ref } from 'vue'
|
|
84
|
+
const suggestion = ref({
|
|
85
|
+
modelName: 'NextQuery',
|
|
86
|
+
query: 'tshirt',
|
|
87
|
+
facets: [],
|
|
88
|
+
})
|
|
110
89
|
</script>
|
|
111
90
|
```
|
|
@@ -32,37 +32,28 @@ A list of events that the component will emit:
|
|
|
32
32
|
|
|
33
33
|
## Examples
|
|
34
34
|
|
|
35
|
-
This
|
|
35
|
+
This component expects just a suggestion as a prop to be rendered. It has a slot to override the
|
|
36
36
|
content. By default, it renders the suggestion query of the popular search.
|
|
37
37
|
|
|
38
|
-
### Basic
|
|
38
|
+
### Basic usage
|
|
39
39
|
|
|
40
40
|
```vue live
|
|
41
41
|
<template>
|
|
42
42
|
<PopularSearch :suggestion="suggestion" />
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
|
-
<script>
|
|
45
|
+
<script setup>
|
|
46
46
|
import { PopularSearch } from '@empathyco/x-components/popular-searches'
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
suggestion: {
|
|
55
|
-
modelName: 'PopularSearch',
|
|
56
|
-
query: 'tshirt',
|
|
57
|
-
facets: [],
|
|
58
|
-
},
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
}
|
|
47
|
+
import { ref } from 'vue'
|
|
48
|
+
const suggestion = ref({
|
|
49
|
+
modelName: 'PopularSearch',
|
|
50
|
+
query: 'tshirt',
|
|
51
|
+
facets: [],
|
|
52
|
+
})
|
|
62
53
|
</script>
|
|
63
54
|
```
|
|
64
55
|
|
|
65
|
-
### Custom
|
|
56
|
+
### Custom usage
|
|
66
57
|
|
|
67
58
|
```vue live
|
|
68
59
|
<template>
|
|
@@ -74,25 +65,14 @@ export default {
|
|
|
74
65
|
</PopularSearch>
|
|
75
66
|
</template>
|
|
76
67
|
|
|
77
|
-
<script>
|
|
68
|
+
<script setup>
|
|
78
69
|
import { PopularSearch } from '@empathyco/x-components/popular-searches'
|
|
79
70
|
import { TrendingIcon } from '@empathyco/x-components'
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
data() {
|
|
88
|
-
return {
|
|
89
|
-
suggestion: {
|
|
90
|
-
modelName: 'PopularSearch',
|
|
91
|
-
query: 'tshirt',
|
|
92
|
-
facets: [],
|
|
93
|
-
},
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
}
|
|
71
|
+
import { ref } from 'vue'
|
|
72
|
+
const suggestion = ref({
|
|
73
|
+
modelName: 'PopularSearch',
|
|
74
|
+
query: 'tshirt',
|
|
75
|
+
facets: [],
|
|
76
|
+
})
|
|
97
77
|
</script>
|
|
98
78
|
```
|