@empathyco/x-components 6.0.0-alpha.124 → 6.0.0-alpha.126

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 (98) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/core/index.js +2 -0
  3. package/core/index.js.map +1 -1
  4. package/docs/API-reference/api/x-adapter-platform.aiquestionsrequestschema.md +2 -0
  5. package/docs/API-reference/api/x-adapter-platform.aitasksendpointadapter.md +13 -0
  6. package/docs/API-reference/api/x-adapter-platform.aitasksrequestschema.md +2 -0
  7. package/docs/API-reference/api/x-adapter-platform.md +5 -4
  8. package/docs/API-reference/api/x-adapter-platform.platformaiquestionsresponse.md +2 -0
  9. package/docs/API-reference/api/x-adapter-platform.platformaitasksresponse.md +2 -0
  10. package/docs/API-reference/api/x-components.aioverview.md +36 -4
  11. package/docs/API-reference/api/x-components.changeheight.md +13 -0
  12. package/docs/API-reference/api/x-components.md +1 -0
  13. package/docs/API-reference/api/x-types.aiquestion.md +2 -0
  14. package/docs/API-reference/api/x-types.aiquestionsrequest.md +2 -0
  15. package/docs/API-reference/api/x-types.aiquestionsresponse.md +2 -0
  16. package/docs/API-reference/api/x-types.aitasksrequest.md +2 -0
  17. package/docs/API-reference/api/x-types.aitasksresponse.md +2 -0
  18. package/docs/API-reference/api/x-types.md +6 -6
  19. package/docs/API-reference/api/x-types.stepempathising.md +2 -0
  20. package/docs/API-reference/components/ai/x-components.ai-overview.md +14 -0
  21. package/docs/API-reference/components/ai/x-components.ai-question-results.md +19 -0
  22. package/docs/API-reference/components/common/animations/x-components.change-height.md +13 -0
  23. package/docs/API-reference/components/common/icons/x-components.ai-star.md +7 -0
  24. package/js/components/animations/change-height.vue.js +23 -0
  25. package/js/components/animations/change-height.vue.js.map +1 -0
  26. package/js/components/animations/change-height.vue2.js +32 -0
  27. package/js/components/animations/change-height.vue2.js.map +1 -0
  28. package/js/components/animations/collapse-height.vue.js +2 -2
  29. package/js/components/animations/cross-fade.vue.js +2 -2
  30. package/js/components/base-dropdown.vue2.js +1 -0
  31. package/js/components/base-dropdown.vue2.js.map +1 -1
  32. package/js/components/icons/ai-star.vue.js +38 -0
  33. package/js/components/icons/ai-star.vue.js.map +1 -0
  34. package/js/components/icons/chevron-down.vue.js +2 -2
  35. package/js/components/modals/base-modal.vue2.js +1 -0
  36. package/js/components/modals/base-modal.vue2.js.map +1 -1
  37. package/js/components/panels/base-header-toggle-panel.vue2.js +1 -0
  38. package/js/components/panels/base-header-toggle-panel.vue2.js.map +1 -1
  39. package/js/components/panels/base-id-toggle-panel.vue2.js +1 -0
  40. package/js/components/panels/base-id-toggle-panel.vue2.js.map +1 -1
  41. package/js/components/panels/base-tabs-panel.vue2.js +1 -0
  42. package/js/components/panels/base-tabs-panel.vue2.js.map +1 -1
  43. package/js/components/result/base-result-add-to-cart.vue.js +2 -2
  44. package/js/components/result/base-result-image.vue.js +2 -2
  45. package/js/components/result/base-result-image.vue2.js +1 -0
  46. package/js/components/result/base-result-image.vue2.js.map +1 -1
  47. package/js/components/result/base-result-link.vue.js +2 -2
  48. package/js/components/result/base-result-rating.vue.js +2 -2
  49. package/js/index.js +2 -0
  50. package/js/index.js.map +1 -1
  51. package/js/views/home/result.vue.js +110 -0
  52. package/js/views/home/result.vue.js.map +1 -0
  53. package/js/views/home/result.vue2.js +30 -0
  54. package/js/views/home/result.vue2.js.map +1 -0
  55. package/js/x-modules/ai/components/ai-overview.vue.js +154 -17
  56. package/js/x-modules/ai/components/ai-overview.vue.js.map +1 -1
  57. package/js/x-modules/ai/components/ai-overview.vue2.js +155 -8
  58. package/js/x-modules/ai/components/ai-overview.vue2.js.map +1 -1
  59. package/js/x-modules/ai/components/ai-overview.vue3.js +7 -0
  60. package/js/x-modules/ai/components/ai-overview.vue3.js.map +1 -0
  61. package/js/x-modules/ai/components/ai-question-results.vue.js +69 -0
  62. package/js/x-modules/ai/components/ai-question-results.vue.js.map +1 -0
  63. package/js/x-modules/ai/components/ai-question-results.vue2.js +38 -0
  64. package/js/x-modules/ai/components/ai-question-results.vue2.js.map +1 -0
  65. package/js/x-modules/ai/components/ai-question-results.vue3.js +7 -0
  66. package/js/x-modules/ai/components/ai-question-results.vue3.js.map +1 -0
  67. package/js/x-modules/ai/wiring.js +5 -0
  68. package/js/x-modules/ai/wiring.js.map +1 -1
  69. package/js/x-modules/empathize/components/empathize.vue2.js +1 -0
  70. package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
  71. package/js/x-modules/queries-preview/components/query-preview-button.vue.js +2 -2
  72. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +1 -0
  73. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js.map +1 -1
  74. package/js/x-modules/queries-preview/components/query-preview-list.vue.js +2 -2
  75. package/js/x-modules/queries-preview/components/query-preview.vue2.js +1 -0
  76. package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
  77. package/js/x-modules/scroll/components/scroll-to-top.vue2.js +1 -0
  78. package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
  79. package/package.json +4 -4
  80. package/report/x-adapter-platform.api.json +54 -4
  81. package/report/x-components.api.json +163 -5
  82. package/report/x-components.api.md +47 -4
  83. package/report/x-types.api.json +6 -6
  84. package/types/components/animations/change-height.vue.d.ts +5 -0
  85. package/types/components/animations/change-height.vue.d.ts.map +1 -0
  86. package/types/components/animations/index.d.ts +1 -0
  87. package/types/components/animations/index.d.ts.map +1 -1
  88. package/types/components/icons/index.d.ts +1 -0
  89. package/types/components/icons/index.d.ts.map +1 -1
  90. package/types/views/home/result.vue.d.ts +17 -0
  91. package/types/views/home/result.vue.d.ts.map +1 -0
  92. package/types/x-modules/ai/components/ai-overview.vue.d.ts +67 -4
  93. package/types/x-modules/ai/components/ai-overview.vue.d.ts.map +1 -1
  94. package/types/x-modules/ai/components/ai-question-results.vue.d.ts +19 -0
  95. package/types/x-modules/ai/components/ai-question-results.vue.d.ts.map +1 -0
  96. package/types/x-modules/ai/wiring.d.ts +3 -0
  97. package/types/x-modules/ai/wiring.d.ts.map +1 -1
  98. package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,36 @@
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.126 (2025-08-21)
7
+
8
+ * fix: applied format ([713c3ab](https://github.com/empathyco/x/commit/713c3ab))
9
+ * fix: applied some fixes mentioned in the comments ([69e9cd2](https://github.com/empathyco/x/commit/69e9cd2))
10
+ * fix(ai): apply styles ([15c2358](https://github.com/empathyco/x/commit/15c2358))
11
+ * fix(ai): integrate AIOverview in Home.vue ([2558948](https://github.com/empathyco/x/commit/2558948))
12
+ * fix(ai): set query when clicking on a query preview ([93090c5](https://github.com/empathyco/x/commit/93090c5))
13
+ * feat: implemented AiOverview default slot ([aa94a07](https://github.com/empathyco/x/commit/aa94a07))
14
+ * feat(ai): AI Overview component ([cf43216](https://github.com/empathyco/x/commit/cf43216))
15
+ * feat(ai): AiOverview custom button Text ([0e15561](https://github.com/empathyco/x/commit/0e15561))
16
+ * feat(ai): AiOverview header implementation ([3e9df81](https://github.com/empathyco/x/commit/3e9df81))
17
+ * feat(ai): bind question to slot default ([2d14717](https://github.com/empathyco/x/commit/2d14717))
18
+ * feat(ai): integrate AIOverview in Home.vue ([22a2176](https://github.com/empathyco/x/commit/22a2176))
19
+ * test(ai-question-results): added test and migrate the tailwind to css ([8e6d559](https://github.com/empathyco/x/commit/8e6d559))
20
+ * test(ai): slot fallback ([acdf20a](https://github.com/empathyco/x/commit/acdf20a))
21
+ * styles(ai): gradient ([abba0e2](https://github.com/empathyco/x/commit/abba0e2))
22
+ * style: added some styles to sliding panel ([b517493](https://github.com/empathyco/x/commit/b517493))
23
+
24
+
25
+
26
+
27
+
28
+ ## 6.0.0-alpha.125 (2025-08-21)
29
+
30
+ **Note:** Version bump only for package @empathyco/x-components
31
+
32
+
33
+
34
+
35
+
6
36
  ## 6.0.0-alpha.124 (2025-08-20)
7
37
 
8
38
  * test(ai): actions and getters ([ee1aac0](https://github.com/empathyco/x/commit/ee1aac0))
package/core/index.js CHANGED
@@ -2,6 +2,7 @@ export { animateClipPath } from '../js/components/animations/animate-clip-path/a
2
2
  export { animateScale } from '../js/components/animations/animate-scale/animate-scale.factory.js';
3
3
  export { animateTranslate } from '../js/components/animations/animate-translate/animate-translate.factory.js';
4
4
  export { default as AnimateWidth } from '../js/components/animations/animate-width.vue.js';
5
+ export { default as ChangeHeight } from '../js/components/animations/change-height.vue.js';
5
6
  export { default as CollapseHeight } from '../js/components/animations/collapse-height.vue.js';
6
7
  export { default as CollapseWidth } from '../js/components/animations/collapse-width.vue.js';
7
8
  export { createDirectionalAnimationFactory } from '../js/components/animations/create-directional-animation-factory.js';
@@ -32,6 +33,7 @@ export { default as BasePriceFilterLabel } from '../js/components/filters/labels
32
33
  export { default as BaseRatingFilterLabel } from '../js/components/filters/labels/base-rating-filter-label.vue.js';
33
34
  export { default as GlobalXBus } from '../js/components/global-x-bus.vue.js';
34
35
  export { default as Highlight } from '../js/components/highlight.vue.js';
36
+ export { default as AIStarIcon } from '../js/components/icons/ai-star.vue.js';
35
37
  export { default as ArrowDownIcon } from '../js/components/icons/arrow-down.vue.js';
36
38
  export { default as ArrowLeftIcon } from '../js/components/icons/arrow-left.vue.js';
37
39
  export { default as ArrowRightIcon } from '../js/components/icons/arrow-right.vue.js';
package/core/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## aiQuestionsRequestSchema variable
6
6
 
7
+ Default implementation for the AiQuestionsRequestSchema.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-adapter-platform](./x-adapter-platform.md) &gt; [aiTasksEndpointAdapter](./x-adapter-platform.aitasksendpointadapter.md)
4
+
5
+ ## aiTasksEndpointAdapter variable
6
+
7
+ Default adapter for the questions v1 endpoint.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ aiTasksEndpointAdapter: import("@empathyco/x-adapter").ExtendableEndpointAdapter<AiTasksRequest, AiTasksResponse>
13
+ ```
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## aiTasksRequestSchema variable
6
6
 
7
+ Default implementation for the AiTasksRequestSchema.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -20,9 +20,9 @@
20
20
  | [FacetConfig](./x-adapter-platform.facetconfig.md) | Facet configuration containing the model name and the schema. |
21
21
  | [PlatformAdapter](./x-adapter-platform.platformadapter.md) | Platform adapter interface. |
22
22
  | [PlatformAiQuestionsRequest](./x-adapter-platform.platformaiquestionsrequest.md) | Request for the <code>Questions v1</code> endpoint. |
23
- | [PlatformAiQuestionsResponse](./x-adapter-platform.platformaiquestionsresponse.md) | |
23
+ | [PlatformAiQuestionsResponse](./x-adapter-platform.platformaiquestionsresponse.md) | Response for the <code>questions</code> endpoint. |
24
24
  | [PlatformAiTasksRequest](./x-adapter-platform.platformaitasksrequest.md) | Request for the <code>Tasks v1</code> endpoint. |
25
- | [PlatformAiTasksResponse](./x-adapter-platform.platformaitasksresponse.md) | |
25
+ | [PlatformAiTasksResponse](./x-adapter-platform.platformaitasksresponse.md) | Response for the <code>tasks</code> endpoint. |
26
26
  | [PlatformBanner](./x-adapter-platform.platformbanner.md) | Banner model for the <code>platform</code> API. |
27
27
  | [PlatformExperienceControlsRequest](./x-adapter-platform.platformexperiencecontrolsrequest.md) | Request for the <code>experience controls</code> endpoint. |
28
28
  | [PlatformExperienceControlsResponse](./x-adapter-platform.platformexperiencecontrolsresponse.md) | Response for the <code>experience controls</code> endpoint. |
@@ -66,12 +66,13 @@
66
66
  | --- | --- |
67
67
  | [aiQuestionsEndpointAdapter](./x-adapter-platform.aiquestionsendpointadapter.md) | Default adapter for the questions v1 endpoint. |
68
68
  | [aiQuestionsRequestMapper](./x-adapter-platform.aiquestionsrequestmapper.md) | Default implementation for the AIQuestionsRequestMapper. |
69
- | [aiQuestionsRequestSchema](./x-adapter-platform.aiquestionsrequestschema.md) | |
69
+ | [aiQuestionsRequestSchema](./x-adapter-platform.aiquestionsrequestschema.md) | Default implementation for the AiQuestionsRequestSchema. |
70
70
  | [aiQuestionsResponseMapper](./x-adapter-platform.aiquestionsresponsemapper.md) | Default implementation for the AiQuestionsResponseMapper. |
71
71
  | [aiQuestionsResponseSchema](./x-adapter-platform.aiquestionsresponseschema.md) | Default implementation for the AIQuestionsResponseSchema. |
72
72
  | [aiQuestionsSchema](./x-adapter-platform.aiquestionsschema.md) | Default implementation for the AIQuestionsSchema. |
73
+ | [aiTasksEndpointAdapter](./x-adapter-platform.aitasksendpointadapter.md) | Default adapter for the questions v1 endpoint. |
73
74
  | [aiTasksRequestMapper](./x-adapter-platform.aitasksrequestmapper.md) | Default implementation for the AiTasksRequestMapper. |
74
- | [aiTasksRequestSchema](./x-adapter-platform.aitasksrequestschema.md) | |
75
+ | [aiTasksRequestSchema](./x-adapter-platform.aitasksrequestschema.md) | Default implementation for the AiTasksRequestSchema. |
75
76
  | [aiTasksResponseMapper](./x-adapter-platform.aitasksresponsemapper.md) | Default implementation for the AiTasksResponseMapper. |
76
77
  | [aiTasksResponseSchema](./x-adapter-platform.aitasksresponseschema.md) | Default implementation for the AITasksResponseSchema. |
77
78
  | [aiTasksSchema](./x-adapter-platform.aitasksschema.md) | Default implementation for the AITasksSchema. |
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## PlatformAiQuestionsResponse interface
6
6
 
7
+ Response for the `questions` endpoint.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## PlatformAiTasksResponse interface
6
6
 
7
+ Response for the `tasks` endpoint.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -7,8 +7,40 @@
7
7
  **Signature:**
8
8
 
9
9
  ```typescript
10
- _default: import("vue").DefineComponent<{}, {
11
- currentQuestion: import("vue").ComputedRef<import("@empathyco/x-types").AiQuestion | undefined>;
12
- currentQuestionLoading: import("vue").ComputedRef<boolean>;
13
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>
10
+ _default: import("vue").DefineComponent<{
11
+ title: {
12
+ type: PropType<string>;
13
+ default: string;
14
+ };
15
+ titleLoading: {
16
+ type: PropType<string>;
17
+ default: string;
18
+ };
19
+ buttonText: {
20
+ type: PropType<string>;
21
+ default: string;
22
+ };
23
+ }, {
24
+ expanded: import("vue").Ref<boolean>;
25
+ question: import("vue").ComputedRef<import("@empathyco/x-types").AiQuestion | undefined>;
26
+ open: () => void;
27
+ loading: import("vue").ComputedRef<boolean>;
28
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
29
+ title: {
30
+ type: PropType<string>;
31
+ default: string;
32
+ };
33
+ titleLoading: {
34
+ type: PropType<string>;
35
+ default: string;
36
+ };
37
+ buttonText: {
38
+ type: PropType<string>;
39
+ default: string;
40
+ };
41
+ }>>, {
42
+ title: string;
43
+ titleLoading: string;
44
+ buttonText: string;
45
+ }, {}>
14
46
  ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [ChangeHeight](./x-components.changeheight.md)
4
+
5
+ ## ChangeHeight variable
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ _default: import("vue").DefineComponent<{}, {
11
+ wrapper: import("vue").Ref<HTMLElement | undefined>;
12
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>
13
+ ```
@@ -387,6 +387,7 @@ X-Components is a library usable everywhere not only for search experiences.
387
387
  | [cancelFetchAndSaveRelatedTagsWire](./x-components.cancelfetchandsaverelatedtagswire.md) | Cancels the [RelatedTagsActions.fetchAndSaveRelatedTags](./x-components.relatedtagsactions.fetchandsaverelatedtags.md) request promise. |
388
388
  | [cancelFetchAndSaveSearchResponseWire](./x-components.cancelfetchandsavesearchresponsewire.md) | Cancels the [SearchActions.fetchAndSaveSearchResponse](./x-components.searchactions.fetchandsavesearchresponse.md) request promise. |
389
389
  | [cancelFetchAndSaveSuggestionsWire](./x-components.cancelfetchandsavesuggestionswire.md) | Cancels the [QuerySuggestionsActions.fetchAndSaveSuggestions](./x-components.querysuggestionsactions.fetchandsavesuggestions.md) request promise. |
390
+ | [ChangeHeight](./x-components.changeheight.md) | |
390
391
  | [ClearFilters](./x-components.clearfilters.md) | Renders a simple button, emitting the needed events when clicked. |
391
392
  | [clearHistoryQueries](./x-components.clearhistoryqueries.md) | Clears the history queries. |
392
393
  | [ClearHistoryQueries](./x-components.clearhistoryqueries.md) | A button that when is pressed, emits the [HistoryQueriesXEvents.UserPressedClearHistoryQueries](./x-components.historyqueriesxevents.userpressedclearhistoryqueries.md) event, expressing the user intention to clear the whole history of queries. |
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## AiQuestion interface
6
6
 
7
+ A question is an entity generated by the AI. It contains the question text, the response text and the search queries.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## AiQuestionsRequest interface
6
6
 
7
+ Request for the question endpoint.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## AiQuestionsResponse interface
6
6
 
7
+ Response for the question endpoint.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## AiTasksRequest interface
6
6
 
7
+ Request for the task endpoint.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## AiTasksResponse interface
6
6
 
7
+ Response for the task endpoint.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -30,11 +30,11 @@ Entry point to export search-type models and testing schemas in a unified api-ex
30
30
 
31
31
  | Interface | Description |
32
32
  | --- | --- |
33
- | [AiQuestion](./x-types.aiquestion.md) | |
34
- | [AiQuestionsRequest](./x-types.aiquestionsrequest.md) | |
35
- | [AiQuestionsResponse](./x-types.aiquestionsresponse.md) | |
36
- | [AiTasksRequest](./x-types.aitasksrequest.md) | |
37
- | [AiTasksResponse](./x-types.aitasksresponse.md) | |
33
+ | [AiQuestion](./x-types.aiquestion.md) | A question is an entity generated by the AI. It contains the question text, the response text and the search queries. |
34
+ | [AiQuestionsRequest](./x-types.aiquestionsrequest.md) | Request for the question endpoint. |
35
+ | [AiQuestionsResponse](./x-types.aiquestionsresponse.md) | Response for the question endpoint. |
36
+ | [AiTasksRequest](./x-types.aitasksrequest.md) | Request for the task endpoint. |
37
+ | [AiTasksResponse](./x-types.aitasksresponse.md) | Response for the task endpoint. |
38
38
  | [Banner](./x-types.banner.md) | A banner is an image with a title, that when clicked redirect the user to an URL. Often it is represented as a 100% wide element that appears on top of the results inside the grid or between rows. |
39
39
  | [BooleanFilter](./x-types.booleanfilter.md) | A boolean filter used in a [FacetFilter](./x-types.facetfilter.md)<!-- -->, which status can be selected or not and it may contains the total results number that the filter should return. |
40
40
  | [EditableNumberRangeFacet](./x-types.editablenumberrangefacet.md) | Editable Number Range Facet is a trait for filtering results using user editable [RangeValue](./x-types.rangevalue.md)<!-- -->.Editable means that the value max and min can be changed by the user instead of havingseveral boolean filters with different values. It extends from [Facet](./x-types.facet.md)<!-- -->,changes the modelName and uses [EditableNumberRangeFilter](./x-types.editablenumberrangefilter.md) as filters. |
@@ -95,7 +95,7 @@ Entry point to export search-type models and testing schemas in a unified api-ex
95
95
  | [SimpleFilter](./x-types.simplefilter.md) | A type of filter used in [SimpleFacet](./x-types.simplefacet.md) and extends from [Filter](./x-types.filter.md)<!-- -->. It can be selected or not. |
96
96
  | [SortableRequest](./x-types.sortablerequest.md) | Interface for any Request with sorting. |
97
97
  | [Stats](./x-types.stats.md) | <p>Statistics for the current search results.</p><p>Price - interval of the prices of the results.</p> |
98
- | [StepEmpathising](./x-types.stepempathising.md) | |
98
+ | [StepEmpathising](./x-types.stepempathising.md) | Model for each step of the empathising task. |
99
99
  | [Suggestion](./x-types.suggestion.md) | A suggestion represents a query that has been proposed to the user, due of being popular, matching with the current search query... |
100
100
  | [Taggable](./x-types.taggable.md) | A taggable entity. |
101
101
  | [Tagging](./x-types.tagging.md) | The tagging user actions. |
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## StepEmpathising interface
6
6
 
7
+ Model for each step of the empathising task.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -5,3 +5,17 @@ title: AiOverview
5
5
  ---
6
6
 
7
7
  # AiOverview
8
+
9
+ ## Props
10
+
11
+ | Name | Description | Type | Default |
12
+ | ------------------------- | -------------------------------------------------- | ------------------- | ----------------------------------------- |
13
+ | <code>title</code> | The text displayed when the question ended loading | <code>string</code> | <code>'Empathy AI Overview'</code> |
14
+ | <code>titleLoading</code> | The text displayed when the question is loading. | <code>string</code> | <code>'Generating with Empathy AI'</code> |
15
+ | <code>buttonText</code> | The text displayed on the expand button. | <code>string</code> | <code>'Show more'</code> |
16
+
17
+ ## Slots
18
+
19
+ | Name | Description | Bindings<br />(name - type - description) |
20
+ | -------------------- | ----------- | ----------------------------------------- |
21
+ | <code>default</code> | | |
@@ -0,0 +1,19 @@
1
+ ---
2
+
3
+ title: AiQuestionResults
4
+
5
+ ---
6
+
7
+ # AiQuestionResults
8
+
9
+ ## Props
10
+
11
+ | Name | Description | Type | Default |
12
+ | --------------------- | ----------- | ----------------------- | ------------- |
13
+ | <code>question</code> | | <code>AiQuestion</code> | <code></code> |
14
+
15
+ ## Slots
16
+
17
+ | Name | Description | Bindings<br />(name - type - description) |
18
+ | ----------------------------------------- | ---------------------------------------------------- | ----------------------------------------- |
19
+ | <code>related-prompt-extra-content</code> | The slot to render related prompt extra information. | None |
@@ -0,0 +1,13 @@
1
+ ---
2
+
3
+ title: ChangeHeight
4
+
5
+ ---
6
+
7
+ # ChangeHeight
8
+
9
+ ## Slots
10
+
11
+ | Name | Description | Bindings<br />(name - type - description) |
12
+ | -------------------- | ----------- | ----------------------------------------- |
13
+ | <code>default</code> | | None |
@@ -0,0 +1,7 @@
1
+ ---
2
+
3
+ title: AiStar
4
+
5
+ ---
6
+
7
+ # AiStar
@@ -0,0 +1,23 @@
1
+ import _sfc_main from './change-height.vue2.js';
2
+ import { openBlock, createElementBlock, createElementVNode, renderSlot } from 'vue';
3
+ import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
4
+
5
+ const _hoisted_1 = { class: "x-overflow-hidden x-transition-all x-duration-300" };
6
+ const _hoisted_2 = { ref: "wrapper" };
7
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
8
+ return openBlock(), createElementBlock("div", _hoisted_1, [
9
+ createElementVNode(
10
+ "div",
11
+ _hoisted_2,
12
+ [
13
+ renderSlot(_ctx.$slots, "default")
14
+ ],
15
+ 512
16
+ /* NEED_PATCH */
17
+ )
18
+ ]);
19
+ }
20
+ var ChangeHeight = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
21
+
22
+ export { ChangeHeight as default };
23
+ //# sourceMappingURL=change-height.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change-height.vue.js","sources":["../../../../src/components/animations/change-height.vue"],"sourcesContent":["<template>\n <div class=\"x-overflow-hidden x-transition-all x-duration-300\">\n <div ref=\"wrapper\">\n <slot />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, onMounted, onUnmounted, ref } from 'vue'\n\nexport default defineComponent({\n setup() {\n const wrapper = ref<HTMLElement>()\n const observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.target.parentElement) {\n entry.target.parentElement.style.height = `${entry.contentRect.height}px`\n }\n }\n })\n\n onMounted(() => {\n if (wrapper.value?.parentElement) {\n const height = wrapper.value.getBoundingClientRect().height\n wrapper.value.parentElement.style.height = `${height}px`\n observer.observe(wrapper.value)\n }\n })\n\n onUnmounted(() => {\n if (wrapper.value) {\n observer.unobserve(wrapper.value)\n }\n })\n\n return {\n wrapper,\n }\n },\n})\n</script>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode","_renderSlot"],"mappings":";;;;AACO,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,mDAAmD,EAAA,CAAA;AACvD,MAAA,UAAA,GAAA,EAAA,GAAA,EAAI,SAAS,EAAA,CAAA;;AADpB,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAIM,OAJN,UAIM,EAAA;AAAA,IAHJC,kBAAA;AAAA,MAEM,KAAA;AAAA,MAFN,UAAA;AAAA,MAEM;AAAA,QADJC,UAAQ,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA,OAAA;;;;;;;;;;"}
@@ -0,0 +1,32 @@
1
+ import { defineComponent, ref, onMounted, onUnmounted } from 'vue';
2
+
3
+ var _sfc_main = defineComponent({
4
+ setup() {
5
+ const wrapper = ref();
6
+ const observer = new ResizeObserver(entries => {
7
+ for (const entry of entries) {
8
+ if (entry.target.parentElement) {
9
+ entry.target.parentElement.style.height = `${entry.contentRect.height}px`;
10
+ }
11
+ }
12
+ });
13
+ onMounted(() => {
14
+ if (wrapper.value?.parentElement) {
15
+ const height = wrapper.value.getBoundingClientRect().height;
16
+ wrapper.value.parentElement.style.height = `${height}px`;
17
+ observer.observe(wrapper.value);
18
+ }
19
+ });
20
+ onUnmounted(() => {
21
+ if (wrapper.value) {
22
+ observer.unobserve(wrapper.value);
23
+ }
24
+ });
25
+ return {
26
+ wrapper,
27
+ };
28
+ },
29
+ });
30
+
31
+ export { _sfc_main as default };
32
+ //# sourceMappingURL=change-height.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change-height.vue2.js","sources":["../../../../src/components/animations/change-height.vue"],"sourcesContent":["<template>\n <div class=\"x-overflow-hidden x-transition-all x-duration-300\">\n <div ref=\"wrapper\">\n <slot />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, onMounted, onUnmounted, ref } from 'vue'\n\nexport default defineComponent({\n setup() {\n const wrapper = ref<HTMLElement>()\n const observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.target.parentElement) {\n entry.target.parentElement.style.height = `${entry.contentRect.height}px`\n }\n }\n })\n\n onMounted(() => {\n if (wrapper.value?.parentElement) {\n const height = wrapper.value.getBoundingClientRect().height\n wrapper.value.parentElement.style.height = `${height}px`\n observer.observe(wrapper.value)\n }\n })\n\n onUnmounted(() => {\n if (wrapper.value) {\n observer.unobserve(wrapper.value)\n }\n })\n\n return {\n wrapper,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;AAWA,gBAAe,eAAe,CAAC;IAC7B,KAAK,GAAA;AACH,QAAA,MAAM,OAAQ,GAAE,GAAG,EAAc,CAAA;AACjC,QAAA,MAAM,QAAS,GAAE,IAAI,cAAc,CAAC,OAAM,IAAK;AAC7C,YAAA,KAAK,MAAM,KAAM,IAAG,OAAO,EAAE;AAC3B,gBAAA,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE;AAC9B,oBAAA,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAK,GAAI,CAAA,EAAG,KAAK,CAAC,WAAW,CAAC,MAAM,IAAG,CAAA;iBAC1E;aACF;AACF,SAAC,CAAA,CAAA;QAED,SAAS,CAAC,MAAM;AACd,YAAA,IAAI,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE;gBAChC,MAAM,MAAK,GAAI,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,MAAK,CAAA;AAC1D,gBAAA,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,MAAK,GAAI,CAAA,EAAG,MAAM,CAAA,EAAA,CAAG,CAAA;AACvD,gBAAA,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAA,CAAA;aAChC;AACF,SAAC,CAAA,CAAA;QAED,WAAW,CAAC,MAAM;AAChB,YAAA,IAAI,OAAO,CAAC,KAAK,EAAE;AACjB,gBAAA,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,CAAA;aAClC;AACF,SAAC,CAAA,CAAA;QAED,OAAO;YACL,OAAO;SACT,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
@@ -18,7 +18,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
18
18
  /* FORWARDED */
19
19
  }, 8, ["appear", "onEnter", "onAfterEnter", "onLeave"]);
20
20
  }
21
- var collapseHeight = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
21
+ var CollapseHeight = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
22
22
 
23
- export { collapseHeight as default };
23
+ export { CollapseHeight as default };
24
24
  //# sourceMappingURL=collapse-height.vue.js.map
@@ -15,7 +15,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
15
15
  /* FORWARDED */
16
16
  }, 8, ["appear"]);
17
17
  }
18
- var crossFade = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
18
+ var CrossFade = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
19
19
 
20
- export { crossFade as default };
20
+ export { CrossFade as default };
21
21
  //# sourceMappingURL=cross-fade.vue.js.map
@@ -9,6 +9,7 @@ import './animations/animate-scale/animate-scale.style.scss.js';
9
9
  import './animations/animate-translate/animate-translate.style.scss.js';
10
10
  import './animations/animate-width.vue2.js';
11
11
  import './animations/animate-width.vue3.js';
12
+ import './animations/change-height.vue2.js';
12
13
  import './animations/collapse-height.vue2.js';
13
14
  import './animations/collapse-height.vue3.js';
14
15
  import './animations/collapse-width.vue2.js';
@@ -1 +1 @@
1
- {"version":3,"file":"base-dropdown.vue2.js","sources":["../../../src/components/base-dropdown.vue"],"sourcesContent":["<template>\n <div\n ref=\"rootRef\"\n :class=\"dropdownCSSClasses\"\n class=\"x-dropdown\"\n @keydown=\"updateSearchBuffer\"\n @keydown.down.prevent=\"highlightNextItem\"\n @keydown.up.prevent=\"highlightPreviousItem\"\n >\n <button\n ref=\"toggleButtonRef\"\n class=\"x-dropdown__toggle\"\n data-test=\"dropdown-toggle\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen.toString()\"\n :aria-controls=\"listId\"\n :aria-label=\"ariaLabel\"\n aria-autocomplete=\"none\"\n @click=\"toggle\"\n @keydown.up.down.prevent.stop=\"open\"\n >\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-if=\"hasToggleSlot\" :is-open=\"isOpen\" :item=\"modelValue\" name=\"toggle\">\n {{ modelValue }}\n </slot>\n <slot v-else :item=\"modelValue\" name=\"item\">{{ modelValue }}</slot>\n </button>\n\n <component :is=\"animation\">\n <ul\n v-show=\"isOpen\"\n :id=\"listId\"\n class=\"x-dropdown__items-list\"\n data-test=\"dropdown-list\"\n role=\"listbox\"\n tabindex=\"-1\"\n @keydown.end=\"highlightLastItem\"\n @keydown.esc=\"closeAndFocusToggleButton\"\n @keydown.home=\"highlightFirstItem\"\n >\n <li v-for=\"(item, index) in items\" :key=\"item.id || item\" class=\"x-dropdown__list-item\">\n <button\n :ref=\"el => (itemsButtonRefs[index] = el)\"\n :aria-selected=\"(item === modelValue).toString()\"\n :class=\"itemsCSSClasses[index]\"\n class=\"x-dropdown__item\"\n data-test=\"dropdown-item\"\n role=\"option\"\n @click=\"emitSelectedItemChanged(item)\"\n >\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot\n :is-highlighted=\"index === highlightedItemIndex\"\n :is-selected=\"item === modelValue\"\n :item=\"item\"\n name=\"item\"\n >\n {{ item }}\n </slot>\n </button>\n </li>\n </ul>\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Identifiable } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport { AnimationProp } from '../types'\nimport { debounceFunction, getTargetElement, normalizeString } from '../utils'\nimport { NoAnimation } from './animations'\n\ntype DropdownItem = string | number | Identifiable\nlet dropdownCount = 0\n\n/**\n * Dropdown component that mimics a Select element behavior, but with the option\n * to customize the toggle button and each item contents.\n */\nexport default defineComponent({\n name: 'BaseDropdown',\n props: {\n /** List of items to display.*/\n items: {\n type: Array as PropType<DropdownItem[]>,\n required: true,\n },\n /** The selected item. */\n modelValue: {\n type: null as unknown as PropType<DropdownItem | null>,\n validator: (v: any) =>\n typeof v === 'string' || typeof v === 'number' || typeof v === 'object' || v === null,\n required: true,\n },\n /** Description of what the dropdown is used for. */\n ariaLabel: String,\n /**\n * Animation component to use for expanding the dropdown. This is a single element animation,\n * so only `<transition>` components are allowed.\n */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation,\n },\n /** Time to wait without receiving any keystroke before resetting the items search query. */\n searchTimeoutMs: {\n type: Number,\n default: 1000,\n },\n },\n emits: ['update:modelValue'],\n setup(props, { emit, slots }) {\n const rootRef = ref<HTMLElement>()\n /** The button that opens and closes the list of options. */\n const toggleButtonRef = ref<HTMLButtonElement>()\n /** Array containing the dropdown list buttons HTMLElements. */\n const itemsButtonRefs = ref<HTMLButtonElement[]>([])\n\n /** Property to check whether the dropdown is expanded or closed. */\n const isOpen = ref(false)\n /** Index of the element that has the focus in the list. -1 means no element has focus. */\n const highlightedItemIndex = ref(-1)\n /** String to search for the first element that starts with it. */\n const searchBuffer = ref('')\n\n /** Resets the search buffer after a certain time has passed. */\n let restartResetSearchTimeout: () => void\n /* Unique ID to identify the dropdown. */\n const listId = `x-dropdown-${dropdownCount++}`\n\n /**\n * Dynamic CSS classes to add to the dropdown root element.\n *\n * @returns An object containing the CSS classes to add to the dropdown root element.\n */\n const dropdownCSSClasses = computed(() => ({ 'x-dropdown--is-open': isOpen }))\n\n /**\n * Dynamic CSS classes to add to each one of the items.\n *\n * @returns An object containing the CSS classes to add to each item.\n */\n const itemsCSSClasses = computed(() =>\n props.items.map((item, index) => ({\n 'x-dropdown__item--is-selected': props.modelValue === item,\n 'x-dropdown__item--is-highlighted': highlightedItemIndex.value === index,\n })),\n )\n\n /* Opens the dropdown. */\n const open = () => (isOpen.value = true)\n /* Closes the dropdown. */\n const close = () => (isOpen.value = false)\n /* Toggles the dropdown. */\n const toggle = () => (isOpen.value = !isOpen.value)\n\n /**\n * Closes the modal and focuses the toggle button.\n */\n function closeAndFocusToggleButton() {\n close()\n toggleButtonRef.value?.focus()\n }\n\n /**\n * Emits the event that the selected item has changed.\n *\n * @param item - The new selected item.\n */\n function emitSelectedItemChanged(item: DropdownItem) {\n emit('update:modelValue', item)\n closeAndFocusToggleButton()\n }\n\n /**\n * Highlights the item after the one that is currently highlighted.\n */\n function highlightNextItem() {\n open()\n highlightedItemIndex.value = (highlightedItemIndex.value + 1) % props.items.length\n }\n\n /**\n * Highlights the item before the one that is currently highlighted.\n */\n function highlightPreviousItem() {\n const currentIndex = highlightedItemIndex.value\n open()\n highlightedItemIndex.value = currentIndex > 0 ? currentIndex - 1 : props.items.length - 1\n }\n\n /**\n * Highlights the first of the provided items.\n */\n function highlightFirstItem() {\n highlightedItemIndex.value = 0\n }\n\n /**\n * Highlights the last of the provided items.\n */\n function highlightLastItem() {\n highlightedItemIndex.value = props.items.length - 1\n }\n\n /**\n * Updates the variable that is used to search in the filters.\n *\n * @param event - The event coming from the user typing.\n */\n function updateSearchBuffer(event: KeyboardEvent) {\n if (/^\\w$/.test(event.key)) {\n const key = event.key\n searchBuffer.value += key\n restartResetSearchTimeout()\n }\n }\n\n /**\n * Resets the search buffer.\n */\n function resetSearchBuffer() {\n searchBuffer.value = ''\n }\n\n /**\n * Closes the dropdown if the passed event has happened on an element out of the dropdown.\n *\n * @param event - The event to check if it has happened out of the dropdown component.\n */\n function closeIfEventIsOutOfDropdown(event: MouseEvent | TouchEvent | FocusEvent) {\n if (!rootRef.value?.contains(getTargetElement(event))) {\n close()\n }\n }\n\n /**\n * Adds listeners to the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function addDocumentCloseListeners() {\n document.addEventListener('mousedown', closeIfEventIsOutOfDropdown)\n document.addEventListener('touchstart', closeIfEventIsOutOfDropdown)\n document.addEventListener('focusin', closeIfEventIsOutOfDropdown)\n }\n\n /**\n * Removes the listeners of the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function removeDocumentCloseListeners() {\n document.removeEventListener('mousedown', closeIfEventIsOutOfDropdown)\n document.removeEventListener('touchstart', closeIfEventIsOutOfDropdown)\n document.removeEventListener('focusin', closeIfEventIsOutOfDropdown)\n }\n\n /**\n * Highlights the item that matches the search buffer. To do so it checks the list buttons\n * text content. It highlights items following this priority:\n * - If an element is already highlighted, it starts searching from that element.\n * - If no element is found starting from the previously highlighted, it returns the first one.\n * - If no element is found matching the search query it highlights the first element.\n *\n * @param search - The search string to find in the HTML.\n */\n watch(searchBuffer, search => {\n if (search) {\n const normalizedSearch = normalizeString(search)\n const matchingIndices = itemsButtonRefs?.value?.reduce<number[]>(\n (matchingIndices, button, index) => {\n const safeButtonWordCharacters = button.textContent!.replace(/\\W/g, '')\n const normalizedButtonText = normalizeString(safeButtonWordCharacters)\n if (normalizedButtonText.startsWith(normalizedSearch)) {\n matchingIndices.push(index)\n }\n return matchingIndices\n },\n [],\n )\n highlightedItemIndex.value =\n // First matching item starting to search from the current highlighted element\n matchingIndices?.find(index => index >= highlightedItemIndex.value) ??\n // First matching item\n matchingIndices?.[0] ??\n // First item\n 0\n }\n })\n\n /**\n * Updates the debounced function to reset the search.\n *\n * @param searchTimeoutMs - The new milliseconds that have to pass without typing before\n * resetting the search.\n */\n watch(\n () => props.searchTimeoutMs,\n searchTimeoutMs => {\n restartResetSearchTimeout = debounceFunction(resetSearchBuffer, searchTimeoutMs)\n },\n { immediate: true },\n )\n\n /**\n * Focuses the DOM element which matches the `highlightedItemIndex`.\n *\n * @param highlightedItemIndex - The index of the HTML element to focus.\n */\n watch(\n highlightedItemIndex,\n highlightedItemIndex => {\n nextTick(() => itemsButtonRefs.value[highlightedItemIndex]?.focus())\n },\n { immediate: true },\n )\n\n /**\n * When the dropdown is open it sets the focused element to the one that is selected.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n highlightedItemIndex.value = isOpen\n ? props.modelValue === null\n ? 0\n : props.items.indexOf(props.modelValue)\n : -1\n })\n\n /**\n * Adds and removes listeners to close the dropdown when it loses the focus.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n /*\n * Because there is an issue with Firefox in macOS and Safari that doesn't focus the target\n * element of the `mousedown` events, the `focusout` event `relatedTarget` property can't be\n * used to detect whether the user has blurred the dropdown. The hack here is to use\n * document listeners that have the side effect of losing the focus.\n */\n if (isOpen) {\n addDocumentCloseListeners()\n } else {\n removeDocumentCloseListeners()\n }\n })\n\n /**\n * If the dropdown is destroyed before removing the document listeners, it ensures that they\n * are removed too.\n */\n onBeforeUnmount(() => {\n removeDocumentCloseListeners()\n })\n\n return {\n hasToggleSlot: !!slots.toggle,\n closeAndFocusToggleButton,\n dropdownCSSClasses,\n emitSelectedItemChanged,\n highlightFirstItem,\n highlightLastItem,\n highlightNextItem,\n highlightPreviousItem,\n highlightedItemIndex,\n isOpen,\n itemsButtonRefs,\n itemsCSSClasses,\n listId,\n open,\n rootRef,\n toggle,\n toggleButtonRef,\n updateSearchBuffer,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-dropdown {\n position: relative;\n}\n\n.x-dropdown__items-list {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n top: calc(100% + var(--x-size-gap-dropdown-default, 0));\n}\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `Dropdown` component is a simple yet customizable select component. The component needs to work\nthe list of items available to select, which are passed using the `items` prop, and the selected\nitem, which is passed in using the `value` prop.\n\nThe supported items must be an array that can contain unique strings, unique numbers, or objects\nwith a unique `id` property.\n\nThe content of each item can be customized using the `item` slot, which apart from the data of the\nitem, it also receives via prop if the element is selected or highlighted.\n\nThere `toggle` slot can be used to customize the button that opens the dropdown. If this is not\nprovided, the `item` slot will be used for that.\n\n```vue\n<template>\n <BaseDropdown v-model=\"value\" :items=\"items\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>\n\n <template #item=\"{ item, isSelected, isHighlighted }\">\n <span v-if=\"isHighlighted\">🟢</span>\n <span v-if=\"isSelected\">✅</span>\n <span>{{ item }}</span>\n </template>\n </BaseDropdown>\n</template>\n\n<script>\nimport { BaseDropdown } from '@empathyco/x-components'\n\nexport default {\n name: 'DropdownTest',\n components: {\n BaseDropdown,\n },\n data() {\n return {\n items: ['a', 2, { id: '3' }],\n value: 'a',\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["NoAnimation","debounceFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,IAAI,gBAAgB,CAAA,CAAA;AAEpB;;;AAGE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,KAAK,EAAE;;AAEL,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,KAAiC;AACvC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;;AAED,QAAA,UAAU,EAAE;AACV,YAAA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,EACD,EAAE,SAAS,EAAE,MAAM,CACrB,CAAA;AAEA;;;;AAIE;AACF,QAAA,KAAK,CAAC,MAAM,EAAE,MAAK,IAAK;YACtB,oBAAoB,CAAC,KAAI,GAAI,MAAK;AAChC,kBAAE,KAAK,CAAC,UAAS,KAAM,IAAG;AACxB,sBAAE,CAAA;sBACA,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAA;kBACtC,CAAC,CAAA,CAAA;AACP,SAAC,CAAA,CAAA;AAED;;;;AAIE;AACF,QAAA,KAAK,CAAC,MAAM,EAAE,MAAK,IAAK;AACtB;;;;;AAKE;YACF,IAAI,MAAM,EAAE;AACV,gBAAA,yBAAyB,EAAC,CAAA;aAC1B;iBAAK;AACL,gBAAA,4BAA4B,EAAC,CAAA;aAC/B;AACF,SAAC,CAAA,CAAA;AAED;;;AAGE;QACF,eAAe,CAAC,MAAM;AACpB,YAAA,4BAA4B,EAAC,CAAA;AAC/B,SAAC,CAAA,CAAA;QAED,OAAO;AACL,YAAA,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM;YAC7B,yBAAyB;YACzB,kBAAkB;YAClB,uBAAuB;YACvB,kBAAkB;YAClB,iBAAiB;YACjB,iBAAiB;YACjB,qBAAqB;YACrB,oBAAoB;YACpB,MAAM;YACN,eAAe;YACf,eAAe;YACf,MAAM;YACN,IAAI;YACJ,OAAO;YACP,MAAM;YACN,eAAe;YACf,kBAAkB;SACpB,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-dropdown.vue2.js","sources":["../../../src/components/base-dropdown.vue"],"sourcesContent":["<template>\n <div\n ref=\"rootRef\"\n :class=\"dropdownCSSClasses\"\n class=\"x-dropdown\"\n @keydown=\"updateSearchBuffer\"\n @keydown.down.prevent=\"highlightNextItem\"\n @keydown.up.prevent=\"highlightPreviousItem\"\n >\n <button\n ref=\"toggleButtonRef\"\n class=\"x-dropdown__toggle\"\n data-test=\"dropdown-toggle\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen.toString()\"\n :aria-controls=\"listId\"\n :aria-label=\"ariaLabel\"\n aria-autocomplete=\"none\"\n @click=\"toggle\"\n @keydown.up.down.prevent.stop=\"open\"\n >\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-if=\"hasToggleSlot\" :is-open=\"isOpen\" :item=\"modelValue\" name=\"toggle\">\n {{ modelValue }}\n </slot>\n <slot v-else :item=\"modelValue\" name=\"item\">{{ modelValue }}</slot>\n </button>\n\n <component :is=\"animation\">\n <ul\n v-show=\"isOpen\"\n :id=\"listId\"\n class=\"x-dropdown__items-list\"\n data-test=\"dropdown-list\"\n role=\"listbox\"\n tabindex=\"-1\"\n @keydown.end=\"highlightLastItem\"\n @keydown.esc=\"closeAndFocusToggleButton\"\n @keydown.home=\"highlightFirstItem\"\n >\n <li v-for=\"(item, index) in items\" :key=\"item.id || item\" class=\"x-dropdown__list-item\">\n <button\n :ref=\"el => (itemsButtonRefs[index] = el)\"\n :aria-selected=\"(item === modelValue).toString()\"\n :class=\"itemsCSSClasses[index]\"\n class=\"x-dropdown__item\"\n data-test=\"dropdown-item\"\n role=\"option\"\n @click=\"emitSelectedItemChanged(item)\"\n >\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot\n :is-highlighted=\"index === highlightedItemIndex\"\n :is-selected=\"item === modelValue\"\n :item=\"item\"\n name=\"item\"\n >\n {{ item }}\n </slot>\n </button>\n </li>\n </ul>\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Identifiable } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport { AnimationProp } from '../types'\nimport { debounceFunction, getTargetElement, normalizeString } from '../utils'\nimport { NoAnimation } from './animations'\n\ntype DropdownItem = string | number | Identifiable\nlet dropdownCount = 0\n\n/**\n * Dropdown component that mimics a Select element behavior, but with the option\n * to customize the toggle button and each item contents.\n */\nexport default defineComponent({\n name: 'BaseDropdown',\n props: {\n /** List of items to display.*/\n items: {\n type: Array as PropType<DropdownItem[]>,\n required: true,\n },\n /** The selected item. */\n modelValue: {\n type: null as unknown as PropType<DropdownItem | null>,\n validator: (v: any) =>\n typeof v === 'string' || typeof v === 'number' || typeof v === 'object' || v === null,\n required: true,\n },\n /** Description of what the dropdown is used for. */\n ariaLabel: String,\n /**\n * Animation component to use for expanding the dropdown. This is a single element animation,\n * so only `<transition>` components are allowed.\n */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation,\n },\n /** Time to wait without receiving any keystroke before resetting the items search query. */\n searchTimeoutMs: {\n type: Number,\n default: 1000,\n },\n },\n emits: ['update:modelValue'],\n setup(props, { emit, slots }) {\n const rootRef = ref<HTMLElement>()\n /** The button that opens and closes the list of options. */\n const toggleButtonRef = ref<HTMLButtonElement>()\n /** Array containing the dropdown list buttons HTMLElements. */\n const itemsButtonRefs = ref<HTMLButtonElement[]>([])\n\n /** Property to check whether the dropdown is expanded or closed. */\n const isOpen = ref(false)\n /** Index of the element that has the focus in the list. -1 means no element has focus. */\n const highlightedItemIndex = ref(-1)\n /** String to search for the first element that starts with it. */\n const searchBuffer = ref('')\n\n /** Resets the search buffer after a certain time has passed. */\n let restartResetSearchTimeout: () => void\n /* Unique ID to identify the dropdown. */\n const listId = `x-dropdown-${dropdownCount++}`\n\n /**\n * Dynamic CSS classes to add to the dropdown root element.\n *\n * @returns An object containing the CSS classes to add to the dropdown root element.\n */\n const dropdownCSSClasses = computed(() => ({ 'x-dropdown--is-open': isOpen }))\n\n /**\n * Dynamic CSS classes to add to each one of the items.\n *\n * @returns An object containing the CSS classes to add to each item.\n */\n const itemsCSSClasses = computed(() =>\n props.items.map((item, index) => ({\n 'x-dropdown__item--is-selected': props.modelValue === item,\n 'x-dropdown__item--is-highlighted': highlightedItemIndex.value === index,\n })),\n )\n\n /* Opens the dropdown. */\n const open = () => (isOpen.value = true)\n /* Closes the dropdown. */\n const close = () => (isOpen.value = false)\n /* Toggles the dropdown. */\n const toggle = () => (isOpen.value = !isOpen.value)\n\n /**\n * Closes the modal and focuses the toggle button.\n */\n function closeAndFocusToggleButton() {\n close()\n toggleButtonRef.value?.focus()\n }\n\n /**\n * Emits the event that the selected item has changed.\n *\n * @param item - The new selected item.\n */\n function emitSelectedItemChanged(item: DropdownItem) {\n emit('update:modelValue', item)\n closeAndFocusToggleButton()\n }\n\n /**\n * Highlights the item after the one that is currently highlighted.\n */\n function highlightNextItem() {\n open()\n highlightedItemIndex.value = (highlightedItemIndex.value + 1) % props.items.length\n }\n\n /**\n * Highlights the item before the one that is currently highlighted.\n */\n function highlightPreviousItem() {\n const currentIndex = highlightedItemIndex.value\n open()\n highlightedItemIndex.value = currentIndex > 0 ? currentIndex - 1 : props.items.length - 1\n }\n\n /**\n * Highlights the first of the provided items.\n */\n function highlightFirstItem() {\n highlightedItemIndex.value = 0\n }\n\n /**\n * Highlights the last of the provided items.\n */\n function highlightLastItem() {\n highlightedItemIndex.value = props.items.length - 1\n }\n\n /**\n * Updates the variable that is used to search in the filters.\n *\n * @param event - The event coming from the user typing.\n */\n function updateSearchBuffer(event: KeyboardEvent) {\n if (/^\\w$/.test(event.key)) {\n const key = event.key\n searchBuffer.value += key\n restartResetSearchTimeout()\n }\n }\n\n /**\n * Resets the search buffer.\n */\n function resetSearchBuffer() {\n searchBuffer.value = ''\n }\n\n /**\n * Closes the dropdown if the passed event has happened on an element out of the dropdown.\n *\n * @param event - The event to check if it has happened out of the dropdown component.\n */\n function closeIfEventIsOutOfDropdown(event: MouseEvent | TouchEvent | FocusEvent) {\n if (!rootRef.value?.contains(getTargetElement(event))) {\n close()\n }\n }\n\n /**\n * Adds listeners to the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function addDocumentCloseListeners() {\n document.addEventListener('mousedown', closeIfEventIsOutOfDropdown)\n document.addEventListener('touchstart', closeIfEventIsOutOfDropdown)\n document.addEventListener('focusin', closeIfEventIsOutOfDropdown)\n }\n\n /**\n * Removes the listeners of the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function removeDocumentCloseListeners() {\n document.removeEventListener('mousedown', closeIfEventIsOutOfDropdown)\n document.removeEventListener('touchstart', closeIfEventIsOutOfDropdown)\n document.removeEventListener('focusin', closeIfEventIsOutOfDropdown)\n }\n\n /**\n * Highlights the item that matches the search buffer. To do so it checks the list buttons\n * text content. It highlights items following this priority:\n * - If an element is already highlighted, it starts searching from that element.\n * - If no element is found starting from the previously highlighted, it returns the first one.\n * - If no element is found matching the search query it highlights the first element.\n *\n * @param search - The search string to find in the HTML.\n */\n watch(searchBuffer, search => {\n if (search) {\n const normalizedSearch = normalizeString(search)\n const matchingIndices = itemsButtonRefs?.value?.reduce<number[]>(\n (matchingIndices, button, index) => {\n const safeButtonWordCharacters = button.textContent!.replace(/\\W/g, '')\n const normalizedButtonText = normalizeString(safeButtonWordCharacters)\n if (normalizedButtonText.startsWith(normalizedSearch)) {\n matchingIndices.push(index)\n }\n return matchingIndices\n },\n [],\n )\n highlightedItemIndex.value =\n // First matching item starting to search from the current highlighted element\n matchingIndices?.find(index => index >= highlightedItemIndex.value) ??\n // First matching item\n matchingIndices?.[0] ??\n // First item\n 0\n }\n })\n\n /**\n * Updates the debounced function to reset the search.\n *\n * @param searchTimeoutMs - The new milliseconds that have to pass without typing before\n * resetting the search.\n */\n watch(\n () => props.searchTimeoutMs,\n searchTimeoutMs => {\n restartResetSearchTimeout = debounceFunction(resetSearchBuffer, searchTimeoutMs)\n },\n { immediate: true },\n )\n\n /**\n * Focuses the DOM element which matches the `highlightedItemIndex`.\n *\n * @param highlightedItemIndex - The index of the HTML element to focus.\n */\n watch(\n highlightedItemIndex,\n highlightedItemIndex => {\n nextTick(() => itemsButtonRefs.value[highlightedItemIndex]?.focus())\n },\n { immediate: true },\n )\n\n /**\n * When the dropdown is open it sets the focused element to the one that is selected.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n highlightedItemIndex.value = isOpen\n ? props.modelValue === null\n ? 0\n : props.items.indexOf(props.modelValue)\n : -1\n })\n\n /**\n * Adds and removes listeners to close the dropdown when it loses the focus.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n /*\n * Because there is an issue with Firefox in macOS and Safari that doesn't focus the target\n * element of the `mousedown` events, the `focusout` event `relatedTarget` property can't be\n * used to detect whether the user has blurred the dropdown. The hack here is to use\n * document listeners that have the side effect of losing the focus.\n */\n if (isOpen) {\n addDocumentCloseListeners()\n } else {\n removeDocumentCloseListeners()\n }\n })\n\n /**\n * If the dropdown is destroyed before removing the document listeners, it ensures that they\n * are removed too.\n */\n onBeforeUnmount(() => {\n removeDocumentCloseListeners()\n })\n\n return {\n hasToggleSlot: !!slots.toggle,\n closeAndFocusToggleButton,\n dropdownCSSClasses,\n emitSelectedItemChanged,\n highlightFirstItem,\n highlightLastItem,\n highlightNextItem,\n highlightPreviousItem,\n highlightedItemIndex,\n isOpen,\n itemsButtonRefs,\n itemsCSSClasses,\n listId,\n open,\n rootRef,\n toggle,\n toggleButtonRef,\n updateSearchBuffer,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-dropdown {\n position: relative;\n}\n\n.x-dropdown__items-list {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n top: calc(100% + var(--x-size-gap-dropdown-default, 0));\n}\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `Dropdown` component is a simple yet customizable select component. The component needs to work\nthe list of items available to select, which are passed using the `items` prop, and the selected\nitem, which is passed in using the `value` prop.\n\nThe supported items must be an array that can contain unique strings, unique numbers, or objects\nwith a unique `id` property.\n\nThe content of each item can be customized using the `item` slot, which apart from the data of the\nitem, it also receives via prop if the element is selected or highlighted.\n\nThere `toggle` slot can be used to customize the button that opens the dropdown. If this is not\nprovided, the `item` slot will be used for that.\n\n```vue\n<template>\n <BaseDropdown v-model=\"value\" :items=\"items\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>\n\n <template #item=\"{ item, isSelected, isHighlighted }\">\n <span v-if=\"isHighlighted\">🟢</span>\n <span v-if=\"isSelected\">✅</span>\n <span>{{ item }}</span>\n </template>\n </BaseDropdown>\n</template>\n\n<script>\nimport { BaseDropdown } from '@empathyco/x-components'\n\nexport default {\n name: 'DropdownTest',\n components: {\n BaseDropdown,\n },\n data() {\n return {\n items: ['a', 2, { id: '3' }],\n value: 'a',\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["NoAnimation","debounceFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,IAAI,gBAAgB,CAAA,CAAA;AAEpB;;;AAGE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,KAAK,EAAE;;AAEL,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,KAAiC;AACvC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,IAAgD;YACtD,SAAS,EAAE,CAAC,CAAM,KAChB,OAAO,CAAA,KAAM,QAAO,IAAK,OAAO,CAAA,KAAM,QAAO,IAAK,OAAO,CAAE,KAAI,YAAY,CAAE,KAAI,IAAI;AACvF,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;;AAED,QAAA,SAAS,EAAE,MAAM;AACjB;;;AAGE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,MAAMA,WAAW;AAC3B,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AA,KAAK,CAAC,MAAM,EAAE,MAAK,IAAK;AACtB;;;;;AAKE;YACF,IAAI,MAAM,EAAE;AACV,gBAAA,yBAAyB,EAAC,CAAA;aAC1B;iBAAK;AACL,gBAAA,4BAA4B,EAAC,CAAA;aAC/B;AACF,SAAC,CAAA,CAAA;AAED;;;AAGE;QACF,eAAe,CAAC,MAAM;AACpB,YAAA,4BAA4B,EAAC,CAAA;AAC/B,SAAC,CAAA,CAAA;QAED,OAAO;AACL,YAAA,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM;YAC7B,yBAAyB;YACzB,kBAAkB;YAClB,uBAAuB;YACvB,kBAAkB;YAClB,iBAAiB;YACjB,iBAAiB;YACjB,qBAAqB;YACrB,oBAAoB;YACpB,MAAM;YACN,eAAe;YACf,eAAe;YACf,MAAM;YACN,IAAI;YACJ,OAAO;YACP,MAAM;YACN,eAAe;YACf,kBAAkB;SACpB,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
@@ -0,0 +1,38 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from 'vue';
2
+ import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
3
+
4
+ const _sfc_main = { };
5
+
6
+ const _hoisted_1 = {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ viewBox: "0 0 19 18"
9
+ };
10
+ const _hoisted_2 = /*#__PURE__*/createElementVNode("path", {
11
+ d: "M15.863 9.14279C9.98542 8.1632 9.98542 8.1632 9.00583 2.28564C8.02623 8.1632 8.02623 8.1632 2.14868 9.14279C8.02623 10.1224 8.02623 10.1224 9.00583 15.9999C9.98542 10.1224 9.98542 10.1224 15.863 9.14279Z",
12
+ fill: "currentColor",
13
+ stroke: "currentColor",
14
+ "stroke-width": "2.70677",
15
+ "stroke-linecap": "round",
16
+ "stroke-linejoin": "round"
17
+ }, null, -1 /* HOISTED */);
18
+ const _hoisted_3 = /*#__PURE__*/createElementVNode("circle", {
19
+ opacity: "0.5",
20
+ cx: "15.8629",
21
+ cy: "2.28571",
22
+ r: "1.38346",
23
+ fill: "currentColor",
24
+ stroke: "currentColor",
25
+ "stroke-width": "1.80451"
26
+ }, null, -1 /* HOISTED */);
27
+ const _hoisted_4 = [
28
+ _hoisted_2,
29
+ _hoisted_3
30
+ ];
31
+
32
+ function _sfc_render(_ctx, _cache) {
33
+ return (openBlock(), createElementBlock("svg", _hoisted_1, [..._hoisted_4]))
34
+ }
35
+ var AIStarIcon = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render]]);
36
+
37
+ export { AIStarIcon as default };
38
+ //# sourceMappingURL=ai-star.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-star.vue.js","sources":["../../../../src/components/icons/ai-star.vue"],"sourcesContent":["<template>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 19 18\">\n <path\n d=\"M15.863 9.14279C9.98542 8.1632 9.98542 8.1632 9.00583 2.28564C8.02623 8.1632 8.02623 8.1632 2.14868 9.14279C8.02623 10.1224 8.02623 10.1224 9.00583 15.9999C9.98542 10.1224 9.98542 10.1224 15.863 9.14279Z\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n stroke-width=\"2.70677\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <circle\n opacity=\"0.5\"\n cx=\"15.8629\"\n cy=\"2.28571\"\n r=\"1.38346\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n stroke-width=\"1.80451\"\n />\n </svg>\n</template>\n"],"names":["_createElementVNode","_createElementBlock"],"mappings":";;;;;;AACO,EAAA,KAAK,EAAC,4BAA4B;AAAC,EAAA,OAAO,EAAC,WAAW;;gCACzDA,kBAOE,CAAA,MAAA,EAAA;AANA,EAAA,CAAC,EAAC,6MAA6M;AAC/M,EAAA,IAAI,EAAC,cAAc;AACnB,EAAA,MAAM,EAAC,cAAc;AACrB,EAAA,cAAY,EAAC,SAAS;AACtB,EAAA,gBAAc,EAAC,OAAO;AACtB,EAAA,iBAAe,EAAC,OAAO;;gCAEzBA,kBAQE,CAAA,QAAA,EAAA;AAPA,EAAA,OAAO,EAAC,KAAK;AACb,EAAA,EAAE,EAAC,SAAS;AACZ,EAAA,EAAE,EAAC,SAAS;AACZ,EAAA,CAAC,EAAC,SAAS;AACX,EAAA,IAAI,EAAC,cAAc;AACnB,EAAA,MAAM,EAAC,cAAc;AACrB,EAAA,cAAY,EAAC,SAAS;;;EAfxB,UAOE;EACF,UAQE;;;;uBAjBJC,kBAkBM,CAAA,KAAA,EAlBN,UAkBM,EAnBR,CAAA,GAAA,UAAA,CAAA,CAAA,CAAA;;;;;;"}