@empathyco/x-components 3.0.0-alpha.364 → 3.0.0-alpha.366

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 (102) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/design-system/deprecated-full-theme.css +71 -71
  3. package/docs/API-reference/api/x-components.baseaddtocart.md +14 -11
  4. package/docs/API-reference/api/x-components.baseheadertogglepanel.animation.md +1 -1
  5. package/docs/API-reference/api/x-components.baseheadertogglepanel.md +1 -1
  6. package/docs/API-reference/api/x-components.basepricefilterlabel.md +46 -21
  7. package/docs/API-reference/api/x-components.baseratingfilterlabel.md +24 -11
  8. package/docs/API-reference/api/x-components.baseresultcurrentprice.md +20 -11
  9. package/docs/API-reference/api/x-components.baseresultimage.md +50 -13
  10. package/docs/API-reference/api/x-components.baseresultlink.md +15 -10
  11. package/docs/API-reference/api/x-components.baseresultpreviousprice.md +18 -11
  12. package/docs/API-reference/api/x-components.baseresultrating.md +20 -11
  13. package/docs/API-reference/api/x-components.basetogglepanel.md +24 -11
  14. package/docs/API-reference/api/x-components.md +9 -9
  15. package/js/components/filters/labels/base-price-filter-label.vue.js.map +1 -1
  16. package/js/components/filters/labels/base-price-filter-label.vue_rollup-plugin-vue_script.vue.js +79 -60
  17. package/js/components/filters/labels/base-price-filter-label.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  18. package/js/components/filters/labels/base-rating-filter-label.vue.js.map +1 -1
  19. package/js/components/filters/labels/base-rating-filter-label.vue_rollup-plugin-vue_script.vue.js +41 -29
  20. package/js/components/filters/labels/base-rating-filter-label.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  21. package/js/components/panels/base-header-toggle-panel.vue.js +1 -1
  22. package/js/components/panels/base-header-toggle-panel.vue.js.map +1 -1
  23. package/js/components/panels/base-header-toggle-panel.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  24. package/js/components/panels/base-header-toggle-panel.vue_rollup-plugin-vue_styles.0.vue.js +1 -1
  25. package/js/components/panels/base-toggle-panel.vue.js.map +1 -1
  26. package/js/components/panels/base-toggle-panel.vue_rollup-plugin-vue_script.vue.js +25 -15
  27. package/js/components/panels/base-toggle-panel.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  28. package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
  29. package/js/components/result/base-result-add-to-cart.vue_rollup-plugin-vue_script.vue.js +29 -23
  30. package/js/components/result/base-result-add-to-cart.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  31. package/js/components/result/base-result-current-price.vue.js.map +1 -1
  32. package/js/components/result/base-result-current-price.vue_rollup-plugin-vue_script.vue.js +47 -26
  33. package/js/components/result/base-result-current-price.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  34. package/js/components/result/base-result-image.vue.js +1 -1
  35. package/js/components/result/base-result-image.vue.js.map +1 -1
  36. package/js/components/result/base-result-image.vue_rollup-plugin-vue_script.vue.js +125 -96
  37. package/js/components/result/base-result-image.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  38. package/js/components/result/base-result-image.vue_rollup-plugin-vue_styles.0.vue.js +1 -1
  39. package/js/components/result/base-result-link.vue.js +2 -1
  40. package/js/components/result/base-result-link.vue.js.map +1 -1
  41. package/js/components/result/base-result-link.vue_rollup-plugin-vue_script.vue.js +46 -27
  42. package/js/components/result/base-result-link.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  43. package/js/components/result/base-result-link.vue_rollup-plugin-vue_styles.0.vue.js +1 -1
  44. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  45. package/js/components/result/base-result-previous-price.vue_rollup-plugin-vue_script.vue.js +34 -17
  46. package/js/components/result/base-result-previous-price.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  47. package/js/components/result/base-result-rating.vue.js +2 -1
  48. package/js/components/result/base-result-rating.vue.js.map +1 -1
  49. package/js/components/result/base-result-rating.vue_rollup-plugin-vue_script.vue.js +44 -27
  50. package/js/components/result/base-result-rating.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  51. package/js/components/result/base-result-rating.vue_rollup-plugin-vue_styles.0.vue.js +1 -1
  52. package/js/utils/options-api.js +4 -0
  53. package/js/utils/options-api.js.map +1 -0
  54. package/package.json +6 -6
  55. package/report/x-components.api.json +3107 -1695
  56. package/report/x-components.api.md +228 -82
  57. package/types/components/filters/labels/base-price-filter-label.vue.d.ts +59 -13
  58. package/types/components/filters/labels/base-price-filter-label.vue.d.ts.map +1 -1
  59. package/types/components/filters/labels/base-rating-filter-label.vue.d.ts +33 -11
  60. package/types/components/filters/labels/base-rating-filter-label.vue.d.ts.map +1 -1
  61. package/types/components/panels/base-header-toggle-panel.vue.d.ts +2 -1
  62. package/types/components/panels/base-header-toggle-panel.vue.d.ts.map +1 -1
  63. package/types/components/panels/base-toggle-panel.vue.d.ts +35 -5
  64. package/types/components/panels/base-toggle-panel.vue.d.ts.map +1 -1
  65. package/types/components/result/base-result-add-to-cart.vue.d.ts +16 -8
  66. package/types/components/result/base-result-add-to-cart.vue.d.ts.map +1 -1
  67. package/types/components/result/base-result-current-price.vue.d.ts +40 -10
  68. package/types/components/result/base-result-current-price.vue.d.ts.map +1 -1
  69. package/types/components/result/base-result-image.vue.d.ts +60 -70
  70. package/types/components/result/base-result-image.vue.d.ts.map +1 -1
  71. package/types/components/result/base-result-link.vue.d.ts +18 -23
  72. package/types/components/result/base-result-link.vue.d.ts.map +1 -1
  73. package/types/components/result/base-result-previous-price.vue.d.ts +40 -5
  74. package/types/components/result/base-result-previous-price.vue.d.ts.map +1 -1
  75. package/types/components/result/base-result-rating.vue.d.ts +28 -9
  76. package/types/components/result/base-result-rating.vue.d.ts.map +1 -1
  77. package/types/utils/options-api.d.ts +3 -0
  78. package/types/utils/options-api.d.ts.map +1 -0
  79. package/docs/API-reference/api/x-components.baseaddtocart.events.md +0 -13
  80. package/docs/API-reference/api/x-components.baseaddtocart.result.md +0 -13
  81. package/docs/API-reference/api/x-components.basepricefilterlabel.filter.md +0 -15
  82. package/docs/API-reference/api/x-components.basepricefilterlabel.format.md +0 -13
  83. package/docs/API-reference/api/x-components.basepricefilterlabel.from.md +0 -13
  84. package/docs/API-reference/api/x-components.basepricefilterlabel.fromto.md +0 -13
  85. package/docs/API-reference/api/x-components.basepricefilterlabel.label.md +0 -13
  86. package/docs/API-reference/api/x-components.basepricefilterlabel.lessthan.md +0 -13
  87. package/docs/API-reference/api/x-components.basepricefilterlabel.render.md +0 -22
  88. package/docs/API-reference/api/x-components.baseratingfilterlabel.filter.md +0 -13
  89. package/docs/API-reference/api/x-components.baseratingfilterlabel.max.md +0 -13
  90. package/docs/API-reference/api/x-components.baseresultcurrentprice.format.md +0 -18
  91. package/docs/API-reference/api/x-components.baseresultcurrentprice.result.md +0 -13
  92. package/docs/API-reference/api/x-components.baseresultimage.hoveranimation.md +0 -13
  93. package/docs/API-reference/api/x-components.baseresultimage.loadanimation.md +0 -13
  94. package/docs/API-reference/api/x-components.baseresultimage.result.md +0 -13
  95. package/docs/API-reference/api/x-components.baseresultimage.shownextimageonhover.md +0 -13
  96. package/docs/API-reference/api/x-components.baseresultlink.result.md +0 -13
  97. package/docs/API-reference/api/x-components.baseresultpreviousprice.format.md +0 -18
  98. package/docs/API-reference/api/x-components.baseresultpreviousprice.result.md +0 -13
  99. package/docs/API-reference/api/x-components.baseresultrating.link.md +0 -13
  100. package/docs/API-reference/api/x-components.baseresultrating.result.md +0 -13
  101. package/docs/API-reference/api/x-components.basetogglepanel.animation.md +0 -13
  102. package/docs/API-reference/api/x-components.basetogglepanel.open.md +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-link.vue.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n @click=\"emitUserClickedAResult\"\n @click.right=\"emitUserClickedAResult\"\n @click.middle=\"emitUserClickedAResult\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n >\n <!--\n @slot (Required) Link content with a text, an image, another component or both\n @binding {Result} result - Result data\n -->\n <slot :result=\"result\" />\n </a>\n</template>\n\n<script lang=\"ts\">\n import { Result } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Inject, Prop } from 'vue-property-decorator';\n import { PropsWithType } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n\n /**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending where it's used its father component may provide this events.\n *\n * @public\n */\n @Component\n export default class BaseResultLink extends Vue {\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n public $el!: HTMLElement;\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n @Inject({ from: 'resultClickExtraEvents', default: [] })\n protected resultClickExtraEvents!: PropsWithType<XEventsTypes, Result>[];\n\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n protected emitUserClickedAResult(): void {\n this.$x.emit('UserClickedAResult', this.result, { target: this.$el });\n this.resultClickExtraEvents.forEach(event => {\n this.$x.emit(event, this.result, { target: this.$el });\n });\n }\n }\n</script>\n\n<style lang=\"scss\" scoped>\n .x-result-link {\n text-decoration: none;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following event:\n\n- [`UserClickedAResult`](x-components.xeventstypes.userclickedaresult.md)\n\nThe component can emit more events on click using the `resultClickExtraEvents` prop.\n\n## See it in action\n\nThis component is a wrapper for the result contents (images, name, price...) It may be part of the\nsearch result page, recommendations or other section which needs to include results.\n\nAdditionally, this component may be injected other events to be emitted on click event, so,\ndepending where it's used its father component may provide this events.\n\nThe result prop is required. It will render a `<a></a>` with the href to the result URL:\n\n```vue\n<BaseResultLink :result=\"result\">\n <template #default=\"{ result }\">\n <img :src=\"result.images[0]\"/>\n <span>{{ result.name }}</span>\n </template>\n</BaseResultLink>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-result-link.vue.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n ref=\"el\"\n @click=\"emitUserClickedAResult\"\n @click.right=\"emitUserClickedAResult\"\n @click.middle=\"emitUserClickedAResult\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n >\n <!--\n @slot (Required) Link content with a text, an image, another component or both\n @binding {Result} result - Result data\n -->\n <slot :result=\"result\" />\n </a>\n</template>\n\n<script lang=\"ts\">\n import { Result } from '@empathyco/x-types';\n import { defineComponent, inject, PropType, ref } from 'vue';\n import { PropsWithType } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n import { use$x } from '../../composables/index';\n\n /**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending on where it's used its father component may provide this events.\n *\n * @public\n */\n export default defineComponent({\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true\n }\n },\n setup(props) {\n const $x = use$x();\n\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n const el = ref<HTMLElement | null>();\n\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n const resultClickExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultClickExtraEvents',\n []\n );\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n const emitUserClickedAResult = (): void => {\n $x.emit('UserClickedAResult', props.result, { target: el.value! });\n resultClickExtraEvents.forEach(event => {\n $x.emit(event, props.result, { target: el.value! });\n });\n };\n\n return {\n emitUserClickedAResult\n };\n }\n });\n</script>\n\n<style lang=\"scss\" scoped>\n .x-result-link {\n text-decoration: none;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following event:\n\n- [`UserClickedAResult`](x-components.xeventstypes.userclickedaresult.md)\n\nThe component can emit more events on click using the `resultClickExtraEvents` prop.\n\n## See it in action\n\nThis component is a wrapper for the result contents (images, name, price...) It may be part of the\nsearch result page, recommendations or other section which needs to include results.\n\nAdditionally, this component may be injected other events to be emitted on click event, so,\ndepending where it's used its father component may provide this events.\n\nThe result prop is required. It will render a `<a></a>` with the href to the result URL:\n\n```vue\n<BaseResultLink :result=\"result\">\n <template #default=\"{ result }\">\n <img :src=\"result.images[0]\"/>\n <span>{{ result.name }}</span>\n </template>\n</BaseResultLink>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
- import { __decorate } from 'tslib';
2
- import Vue from 'vue';
3
- import { Inject, Prop, Component } from 'vue-property-decorator';
1
+ import { defineComponent, ref, inject } from 'vue';
2
+ import '../../composables/create-use-device.composable.js';
3
+ import { use$x } from '../../composables/use-_x.js';
4
4
 
5
5
  /**
6
6
  * Component to be reused that renders an `<a>` wrapping the result contents.
@@ -8,34 +8,53 @@ import { Inject, Prop, Component } from 'vue-property-decorator';
8
8
  * @remarks
9
9
  * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse
10
10
  * events. Additionally, this component may be injected other events to be emitted on click
11
- * event, so, depending where it's used its father component may provide this events.
11
+ * event, so, depending on where it's used its father component may provide this events.
12
12
  *
13
13
  * @public
14
14
  */
15
- let BaseResultLink = class BaseResultLink extends Vue {
16
- /**
17
- * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also
18
- * additional events if have been injected in the component.
19
- *
20
- * @internal
21
- */
22
- emitUserClickedAResult() {
23
- this.$x.emit('UserClickedAResult', this.result, { target: this.$el });
24
- this.resultClickExtraEvents.forEach(event => {
25
- this.$x.emit(event, this.result, { target: this.$el });
26
- });
15
+ var script = defineComponent({
16
+ props: {
17
+ /**
18
+ * (Required) The {@link @empathyco/x-types#Result | result} information.
19
+ *
20
+ * @public
21
+ */
22
+ result: {
23
+ type: Object,
24
+ required: true
25
+ }
26
+ },
27
+ setup(props) {
28
+ const $x = use$x();
29
+ /**
30
+ * The rendered DOM element.
31
+ *
32
+ * @internal
33
+ */
34
+ const el = ref();
35
+ /**
36
+ * The list of additional events to be emitted by the component when user clicks the link.
37
+ *
38
+ * @internal
39
+ */
40
+ const resultClickExtraEvents = inject('resultClickExtraEvents', []);
41
+ /**
42
+ * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also
43
+ * additional events if have been injected in the component.
44
+ *
45
+ * @internal
46
+ */
47
+ const emitUserClickedAResult = () => {
48
+ $x.emit('UserClickedAResult', props.result, { target: el.value });
49
+ resultClickExtraEvents.forEach(event => {
50
+ $x.emit(event, props.result, { target: el.value });
51
+ });
52
+ };
53
+ return {
54
+ emitUserClickedAResult
55
+ };
27
56
  }
28
- };
29
- __decorate([
30
- Inject({ from: 'resultClickExtraEvents', default: [] })
31
- ], BaseResultLink.prototype, "resultClickExtraEvents", void 0);
32
- __decorate([
33
- Prop({ required: true })
34
- ], BaseResultLink.prototype, "result", void 0);
35
- BaseResultLink = __decorate([
36
- Component
37
- ], BaseResultLink);
38
- var script = BaseResultLink;
57
+ });
39
58
 
40
59
  export { script as default };
41
60
  //# sourceMappingURL=base-result-link.vue_rollup-plugin-vue_script.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-link.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/result/base-result-link.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n import { Result } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Inject, Prop } from 'vue-property-decorator';\n import { PropsWithType } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n\n /**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending where it's used its father component may provide this events.\n *\n * @public\n */\n @Component\n export default class BaseResultLink extends Vue {\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n public $el!: HTMLElement;\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n @Inject({ from: 'resultClickExtraEvents', default: [] })\n protected resultClickExtraEvents!: PropsWithType<XEventsTypes, Result>[];\n\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n protected emitUserClickedAResult(): void {\n this.$x.emit('UserClickedAResult', this.result, { target: this.$el });\n this.resultClickExtraEvents.forEach(event => {\n this.$x.emit(event, this.result, { target: this.$el });\n });\n }\n }\n"],"names":[],"mappings":";;;;AAwBE;;;;;;;;;AASG;AAEY,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,GAAG,CAAA;AAuB7C;;;;;AAKG;IACO,sBAAsB,GAAA;AAC9B,QAAA,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;AACtE,QAAA,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,KAAK,IAAG;AAC1C,YAAA,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;AACzD,SAAC,CAAC,CAAC;KACJ;CACF,CAAA;AAtBC,UAAA,CAAA;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACiB,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,wBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAQzE,UAAA,CAAA;AADC,IAAA,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACC,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AArBP,cAAc,GAAA,UAAA,CAAA;IADlC,SAAS;AACW,CAAA,EAAA,cAAc,CAmClC,CAAA;aAnCoB,cAAc;;;;"}
1
+ {"version":3,"file":"base-result-link.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/result/base-result-link.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n import { Result } from '@empathyco/x-types';\n import { defineComponent, inject, PropType, ref } from 'vue';\n import { PropsWithType } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n import { use$x } from '../../composables/index';\n\n /**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending on where it's used its father component may provide this events.\n *\n * @public\n */\n export default defineComponent({\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true\n }\n },\n setup(props) {\n const $x = use$x();\n\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n const el = ref<HTMLElement | null>();\n\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n const resultClickExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultClickExtraEvents',\n []\n );\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n const emitUserClickedAResult = (): void => {\n $x.emit('UserClickedAResult', props.result, { target: el.value! });\n resultClickExtraEvents.forEach(event => {\n $x.emit(event, props.result, { target: el.value! });\n });\n };\n\n return {\n emitUserClickedAResult\n };\n }\n });\n"],"names":[],"mappings":";;;;AAyBE;;;;;;;;;AASG;AACH,aAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;AAIG;AACH,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;AAEnB;;;;AAIG;AACH,QAAA,MAAM,EAAE,GAAG,GAAG,EAAsB,CAAC;AAErC;;;;AAIG;QACH,MAAM,sBAAsB,GAAG,MAAM,CACnC,wBAAwB,EACxB,EAAE,CACH,CAAC;AAEF;;;;;AAKG;QACH,MAAM,sBAAsB,GAAG,MAAW;AACxC,YAAA,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,KAAM,EAAE,CAAC,CAAC;AACnE,YAAA,sBAAsB,CAAC,OAAO,CAAC,KAAK,IAAG;AACrC,gBAAA,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,KAAM,EAAE,CAAC,CAAC;AACtD,aAAC,CAAC,CAAC;AACL,SAAC,CAAC;QAEF,OAAO;YACL,sBAAsB;SACvB,CAAC;KACH;AACF,CAAA,CAAC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { createInjector, createInjectorSSR } from 'vue-runtime-helpers';
2
2
 
3
- var css = ".x-result-link[data-v-2fa908e2] {\n text-decoration: none;\n}";
3
+ var css = ".x-result-link[data-v-5c0bb921] {\n text-decoration: none;\n}";
4
4
  const isBrowser = /*#__PURE__*/ (function () {
5
5
  return (
6
6
  Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) !==
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-previous-price.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency :value=\"result.price.originalValue\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Result } from '@empathyco/x-types';\n import { Component, Prop } from 'vue-property-decorator';\n import Vue from 'vue';\n import BaseCurrency from '../currency/base-currency.vue';\n\n /**\n * Component that renders the {@link @empathyco/x-types#Result | result} previous price.\n *\n * @public\n */\n @Component({\n components: { BaseCurrency }\n })\n export default class BaseResultPreviousPrice extends Vue {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has two optional\nprops. `format` to select the currency format to be applied.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" :format=\"'i.iii,ddd €'\" />\n</template>\n\n<script>\n import { BaseResultPreviousPrice } from '@empathyco/x-components';\n\n export default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice\n }\n };\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script>\n import { BaseResultPreviousPrice } from '@empathyco/x-components';\n\n export default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-result-previous-price.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency :value=\"result.price.originalValue\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Result } from '@empathyco/x-types';\n import { defineComponent, PropType } from 'vue';\n import BaseCurrency from '../currency/base-currency.vue';\n\n /**\n * Component that renders the {@link @empathyco/x-types#Result | result} previous price.\n *\n * @public\n */\n export default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true\n },\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n format: {\n type: String\n }\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has two optional\nprops. `format` to select the currency format to be applied.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" :format=\"'i.iii,ddd €'\" />\n</template>\n\n<script>\n import { BaseResultPreviousPrice } from '@empathyco/x-components';\n\n export default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice\n }\n };\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script>\n import { BaseResultPreviousPrice } from '@empathyco/x-components';\n\n export default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,4 @@
1
- import { __decorate } from 'tslib';
2
- import { Prop, Component } from 'vue-property-decorator';
3
- import Vue from 'vue';
1
+ import { defineComponent } from 'vue';
4
2
  import __vue_component__ from '../currency/base-currency.vue.js';
5
3
 
6
4
  /**
@@ -8,20 +6,39 @@ import __vue_component__ from '../currency/base-currency.vue.js';
8
6
  *
9
7
  * @public
10
8
  */
11
- let BaseResultPreviousPrice = class BaseResultPreviousPrice extends Vue {
12
- };
13
- __decorate([
14
- Prop({ required: true })
15
- ], BaseResultPreviousPrice.prototype, "result", void 0);
16
- __decorate([
17
- Prop()
18
- ], BaseResultPreviousPrice.prototype, "format", void 0);
19
- BaseResultPreviousPrice = __decorate([
20
- Component({
21
- components: { BaseCurrency: __vue_component__ }
22
- })
23
- ], BaseResultPreviousPrice);
24
- var script = BaseResultPreviousPrice;
9
+ var script = defineComponent({
10
+ components: { BaseCurrency: __vue_component__ },
11
+ props: {
12
+ /**
13
+ * (Required) The {@link @empathyco/x-types#Result | result} information.
14
+ *
15
+ * @public
16
+ */
17
+ result: {
18
+ type: Object,
19
+ required: true
20
+ },
21
+ /**
22
+ * Format or mask to be defined as string.
23
+ * - Use 'i' to define integer numbers.
24
+ * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
25
+ * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
26
+ * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
27
+ * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
28
+ * than one character.
29
+ * - Set whatever you need around the integers and decimals marks.
30
+ *
31
+ * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length
32
+ * of decimals provided from the adapter. Otherwise, when the component truncate the decimal
33
+ * part, delete significant digits.
34
+ *
35
+ * @public
36
+ */
37
+ format: {
38
+ type: String
39
+ }
40
+ }
41
+ });
25
42
 
26
43
  export { script as default };
27
44
  //# sourceMappingURL=base-result-previous-price.vue_rollup-plugin-vue_script.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-previous-price.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n import { Result } from '@empathyco/x-types';\n import { Component, Prop } from 'vue-property-decorator';\n import Vue from 'vue';\n import BaseCurrency from '../currency/base-currency.vue';\n\n /**\n * Component that renders the {@link @empathyco/x-types#Result | result} previous price.\n *\n * @public\n */\n @Component({\n components: { BaseCurrency }\n })\n export default class BaseResultPreviousPrice extends Vue {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n }\n"],"names":["BaseCurrency"],"mappings":";;;;;AAsBE;;;;AAIG;AAIY,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,GAAG,CAAA;CA2BvD,CAAA;AApBC,UAAA,CAAA;AADC,IAAA,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACC,CAAA,EAAA,uBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAmB1B,UAAA,CAAA;AADC,IAAA,IAAI,EAAE;AACmB,CAAA,EAAA,uBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AA1BP,uBAAuB,GAAA,UAAA,CAAA;AAH3C,IAAA,SAAS,CAAC;QACT,UAAU,EAAE,gBAAEA,iBAAY,EAAE;KAC7B,CAAC;AACmB,CAAA,EAAA,uBAAuB,CA2B3C,CAAA;aA3BoB,uBAAuB;;;;"}
1
+ {"version":3,"file":"base-result-previous-price.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n import { Result } from '@empathyco/x-types';\n import { defineComponent, PropType } from 'vue';\n import BaseCurrency from '../currency/base-currency.vue';\n\n /**\n * Component that renders the {@link @empathyco/x-types#Result | result} previous price.\n *\n * @public\n */\n export default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true\n },\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n format: {\n type: String\n }\n }\n });\n"],"names":["BaseCurrency"],"mappings":";;;AAqBE;;;;AAIG;AACH,aAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,gBAAEA,iBAAY,EAAE;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIG;AACH,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;;;;;;;;;;;;AAeG;AACH,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACF,KAAA;AACF,CAAA,CAAC;;;;"}
@@ -13,6 +13,7 @@ var __vue_render__ = function () {
13
13
  ? _c(
14
14
  _vm.link ? "a" : "div",
15
15
  {
16
+ ref: "el",
16
17
  tag: "component",
17
18
  staticClass: "x-result-rating",
18
19
  attrs: { href: _vm.link, "data-test": "result-rating" },
@@ -69,7 +70,7 @@ __vue_render__._withStripped = true;
69
70
  /* style */
70
71
  const __vue_inject_styles__ = undefined;
71
72
  /* scoped */
72
- const __vue_scope_id__ = "data-v-ae12fb70";
73
+ const __vue_scope_id__ = "data-v-1cb67b22";
73
74
  /* module identifier */
74
75
  const __vue_module_identifier__ = undefined;
75
76
  /* functional template */
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-rating.vue.js","sources":["../../../../src/components/result/base-result-rating.vue"],"sourcesContent":["<template>\n <component\n :is=\"link ? 'a' : 'div'\"\n v-if=\"result.rating && result.rating.value\"\n @click=\"emitClickedEvent\"\n :href=\"link\"\n class=\"x-result-rating\"\n data-test=\"result-rating\"\n >\n <!--\n @slot To override the whole content\n -->\n <slot :rating=\"result.rating.value\" :result=\"result\">\n <BaseRating :value=\"result.rating.value\" v-bind=\"$attrs\">\n <template #empty-icon>\n <!--\n @slot The content to render as empty icon\n -->\n <slot name=\"empty-icon\" />\n </template>\n\n <template #filled-icon>\n <!--\n @slot The content to render as filled icon\n -->\n <slot name=\"filled-icon\" />\n </template>\n </BaseRating>\n </slot>\n </component>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { Result } from '@empathyco/x-types';\n import BaseRating from '../base-rating.vue';\n\n /**\n * This component renders a {@link BaseRating} for a result passed as prop.\n *\n * @public\n */\n @Component({\n components: {\n BaseRating\n }\n })\n export default class BaseResultRating extends Vue {\n /**\n * The {@link @empathyco/x-types#Result | Result} to render its rating.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * A link to redirect when rating is clicked.\n *\n * @public\n */\n @Prop()\n protected link!: string;\n\n /**\n * Emits the `UserClickedAResultRating` event when user clicks this component, with the\n * {@link @empathyco/x-types#Result | Result} as payload.\n *\n * @internal\n */\n protected emitClickedEvent(): void {\n this.$x.emit('UserClickedAResultRating', this.result, { target: this.$el as HTMLElement });\n }\n }\n</script>\n\n<style scoped lang=\"scss\">\n .x-result-rating {\n color: inherit;\n text-decoration: none;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedAResultRating`](./../../api/x-components.searchboxxevents.md)\n\n## See it in action\n\nHere you have a basic example of how the result rating is rendered.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" />\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the result rating has been configured to 6 as maximum value using the prop `max`.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" :max=\"6\" />\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\nIn this example, the result rating has been configured with a link to redirect when is clicked.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" link=\"https://empathy.co/\" />\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\n### Play with events\n\nIn this example, a message has been added to be shown when the result rating is clicked.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" @UserClickedAResultRating=\"logUserClickedRating\" />\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n },\n methods: {\n logUserClickedRating(result) {\n console.log('User clickedRating of this result:', result);\n }\n }\n };\n</script>\n```\n\n## Extending the component\n\nThe rendered icons for rating can be configured through slots. Keep in mind that the icons for both\nstates (filled and empty), must have the same size make component work properly.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\">\n <template #filled-icon>❤️</template>\n <template #empty-icon>🤍</template>\n </BaseResultRating>\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\nIt is possible to override all the content of the component to show your own rating but keeping the\nlink and event behaviour:\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" #default=\"{ rating, result }\">\n <span v-for=\"star in rating\">⭐️</span>\n <span>{{ result.name }}</span>\n </BaseResultRating>\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\nEven it is possible to reuse our rating component:\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" #default=\"{ rating, result }\">\n <BaseRating :value=\"rating\" />\n <span>{{ result.name }}</span>\n </BaseResultRating>\n</template>\n\n<script>\n import { BaseResultRating, BaseRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n BaseRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-result-rating.vue.js","sources":["../../../../src/components/result/base-result-rating.vue"],"sourcesContent":["<template>\n <component\n :is=\"link ? 'a' : 'div'\"\n v-if=\"result.rating && result.rating.value\"\n ref=\"el\"\n @click=\"emitClickedEvent\"\n :href=\"link\"\n class=\"x-result-rating\"\n data-test=\"result-rating\"\n >\n <!--\n @slot To override the whole content\n -->\n <slot :rating=\"result.rating.value\" :result=\"result\">\n <BaseRating :value=\"result.rating.value\" v-bind=\"$attrs\">\n <template #empty-icon>\n <!--\n @slot The content to render as empty icon\n -->\n <slot name=\"empty-icon\" />\n </template>\n\n <template #filled-icon>\n <!--\n @slot The content to render as filled icon\n -->\n <slot name=\"filled-icon\" />\n </template>\n </BaseRating>\n </slot>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, PropType, ref } from 'vue';\n import { Result } from '@empathyco/x-types';\n import BaseRating from '../base-rating.vue';\n import { use$x } from '../../composables/index';\n\n /**\n * This component renders a {@link BaseRating} for a result passed as prop.\n *\n * @public\n */\n export default defineComponent({\n components: {\n BaseRating\n },\n props: {\n /**\n * The {@link @empathyco/x-types#Result | Result} to render its rating.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true\n },\n\n /**\n * A link to redirect when rating is clicked.\n *\n * @public\n */\n link: {\n type: String\n }\n },\n setup(props) {\n const $x = use$x();\n\n /**\n * Emits the `UserClickedAResultRating` event when user clicks this component, with the\n * {@link @empathyco/x-types#Result | Result} as payload.\n *\n * @internal\n */\n const emitClickedEvent = (): void => {\n const el = ref<HTMLElement | null>(null);\n $x.emit('UserClickedAResultRating', props.result, {\n target: el.value!\n });\n };\n\n return {\n emitClickedEvent\n };\n }\n });\n</script>\n\n<style scoped lang=\"scss\">\n .x-result-rating {\n color: inherit;\n text-decoration: none;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedAResultRating`](./../../api/x-components.searchboxxevents.md)\n\n## See it in action\n\nHere you have a basic example of how the result rating is rendered.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" />\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the result rating has been configured to 6 as maximum value using the prop `max`.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" :max=\"6\" />\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\nIn this example, the result rating has been configured with a link to redirect when is clicked.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" link=\"https://empathy.co/\" />\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\n### Play with events\n\nIn this example, a message has been added to be shown when the result rating is clicked.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" @UserClickedAResultRating=\"logUserClickedRating\" />\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n },\n methods: {\n logUserClickedRating(result) {\n console.log('User clickedRating of this result:', result);\n }\n }\n };\n</script>\n```\n\n## Extending the component\n\nThe rendered icons for rating can be configured through slots. Keep in mind that the icons for both\nstates (filled and empty), must have the same size make component work properly.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\">\n <template #filled-icon>❤️</template>\n <template #empty-icon>🤍</template>\n </BaseResultRating>\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\nIt is possible to override all the content of the component to show your own rating but keeping the\nlink and event behaviour:\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" #default=\"{ rating, result }\">\n <span v-for=\"star in rating\">⭐️</span>\n <span>{{ result.name }}</span>\n </BaseResultRating>\n</template>\n\n<script>\n import { BaseResultRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n\nEven it is possible to reuse our rating component:\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" #default=\"{ rating, result }\">\n <BaseRating :value=\"rating\" />\n <span>{{ result.name }}</span>\n </BaseResultRating>\n</template>\n\n<script>\n import { BaseResultRating, BaseRating } from '@empathyco/x-components';\n\n export default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n BaseRating\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 }\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;AAEA,MAAc,cAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,38 +1,55 @@
1
- import { __decorate } from 'tslib';
2
- import Vue from 'vue';
3
- import { Prop, Component } from 'vue-property-decorator';
1
+ import { defineComponent, ref } from 'vue';
4
2
  import __vue_component__ from '../base-rating.vue.js';
3
+ import '../../composables/create-use-device.composable.js';
4
+ import { use$x } from '../../composables/use-_x.js';
5
5
 
6
6
  /**
7
7
  * This component renders a {@link BaseRating} for a result passed as prop.
8
8
  *
9
9
  * @public
10
10
  */
11
- let BaseResultRating = class BaseResultRating extends Vue {
12
- /**
13
- * Emits the `UserClickedAResultRating` event when user clicks this component, with the
14
- * {@link @empathyco/x-types#Result | Result} as payload.
15
- *
16
- * @internal
17
- */
18
- emitClickedEvent() {
19
- this.$x.emit('UserClickedAResultRating', this.result, { target: this.$el });
20
- }
21
- };
22
- __decorate([
23
- Prop({ required: true })
24
- ], BaseResultRating.prototype, "result", void 0);
25
- __decorate([
26
- Prop()
27
- ], BaseResultRating.prototype, "link", void 0);
28
- BaseResultRating = __decorate([
29
- Component({
30
- components: {
31
- BaseRating: __vue_component__
11
+ var script = defineComponent({
12
+ components: {
13
+ BaseRating: __vue_component__
14
+ },
15
+ props: {
16
+ /**
17
+ * The {@link @empathyco/x-types#Result | Result} to render its rating.
18
+ *
19
+ * @public
20
+ */
21
+ result: {
22
+ type: Object,
23
+ required: true
24
+ },
25
+ /**
26
+ * A link to redirect when rating is clicked.
27
+ *
28
+ * @public
29
+ */
30
+ link: {
31
+ type: String
32
32
  }
33
- })
34
- ], BaseResultRating);
35
- var script = BaseResultRating;
33
+ },
34
+ setup(props) {
35
+ const $x = use$x();
36
+ /**
37
+ * Emits the `UserClickedAResultRating` event when user clicks this component, with the
38
+ * {@link @empathyco/x-types#Result | Result} as payload.
39
+ *
40
+ * @internal
41
+ */
42
+ const emitClickedEvent = () => {
43
+ const el = ref(null);
44
+ $x.emit('UserClickedAResultRating', props.result, {
45
+ target: el.value
46
+ });
47
+ };
48
+ return {
49
+ emitClickedEvent
50
+ };
51
+ }
52
+ });
36
53
 
37
54
  export { script as default };
38
55
  //# sourceMappingURL=base-result-rating.vue_rollup-plugin-vue_script.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-rating.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/result/base-result-rating.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { Result } from '@empathyco/x-types';\n import BaseRating from '../base-rating.vue';\n\n /**\n * This component renders a {@link BaseRating} for a result passed as prop.\n *\n * @public\n */\n @Component({\n components: {\n BaseRating\n }\n })\n export default class BaseResultRating extends Vue {\n /**\n * The {@link @empathyco/x-types#Result | Result} to render its rating.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * A link to redirect when rating is clicked.\n *\n * @public\n */\n @Prop()\n protected link!: string;\n\n /**\n * Emits the `UserClickedAResultRating` event when user clicks this component, with the\n * {@link @empathyco/x-types#Result | Result} as payload.\n *\n * @internal\n */\n protected emitClickedEvent(): void {\n this.$x.emit('UserClickedAResultRating', this.result, { target: this.$el as HTMLElement });\n }\n }\n"],"names":["BaseRating"],"mappings":";;;;;AAsCE;;;;AAIG;AAMY,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,GAAG,CAAA;AAiB/C;;;;;AAKG;IACO,gBAAgB,GAAA;AACxB,QAAA,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,GAAkB,EAAE,CAAC,CAAC;KAC5F;CACF,CAAA;AAnBC,UAAA,CAAA;AADC,IAAA,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACC,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAQ1B,UAAA,CAAA;AADC,IAAA,IAAI,EAAE;AACiB,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAfL,gBAAgB,GAAA,UAAA,CAAA;AALpC,IAAA,SAAS,CAAC;AACT,QAAA,UAAU,EAAE;wBACVA,iBAAU;AACX,SAAA;KACF,CAAC;AACmB,CAAA,EAAA,gBAAgB,CA0BpC,CAAA;aA1BoB,gBAAgB;;;;"}
1
+ {"version":3,"file":"base-result-rating.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/result/base-result-rating.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n import { defineComponent, PropType, ref } from 'vue';\n import { Result } from '@empathyco/x-types';\n import BaseRating from '../base-rating.vue';\n import { use$x } from '../../composables/index';\n\n /**\n * This component renders a {@link BaseRating} for a result passed as prop.\n *\n * @public\n */\n export default defineComponent({\n components: {\n BaseRating\n },\n props: {\n /**\n * The {@link @empathyco/x-types#Result | Result} to render its rating.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true\n },\n\n /**\n * A link to redirect when rating is clicked.\n *\n * @public\n */\n link: {\n type: String\n }\n },\n setup(props) {\n const $x = use$x();\n\n /**\n * Emits the `UserClickedAResultRating` event when user clicks this component, with the\n * {@link @empathyco/x-types#Result | Result} as payload.\n *\n * @internal\n */\n const emitClickedEvent = (): void => {\n const el = ref<HTMLElement | null>(null);\n $x.emit('UserClickedAResultRating', props.result, {\n target: el.value!\n });\n };\n\n return {\n emitClickedEvent\n };\n }\n });\n"],"names":["BaseRating"],"mappings":";;;;;AAuCE;;;;AAIG;AACH,aAAe,eAAe,CAAC;AAC7B,IAAA,UAAU,EAAE;oBACVA,iBAAU;AACX,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIG;AACH,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED;;;;AAIG;AACH,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;AAEnB;;;;;AAKG;QACH,MAAM,gBAAgB,GAAG,MAAW;AAClC,YAAA,MAAM,EAAE,GAAG,GAAG,CAAqB,IAAI,CAAC,CAAC;YACzC,EAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,KAAK,CAAC,MAAM,EAAE;gBAChD,MAAM,EAAE,EAAE,CAAC,KAAM;AAClB,aAAA,CAAC,CAAC;AACL,SAAC,CAAC;QAEF,OAAO;YACL,gBAAgB;SACjB,CAAC;KACH;AACF,CAAA,CAAC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { createInjector, createInjectorSSR } from 'vue-runtime-helpers';
2
2
 
3
- var css = ".x-result-rating[data-v-ae12fb70] {\n color: inherit;\n text-decoration: none;\n}";
3
+ var css = ".x-result-rating[data-v-1cb67b22] {\n color: inherit;\n text-decoration: none;\n}";
4
4
  const isBrowser = /*#__PURE__*/ (function () {
5
5
  return (
6
6
  Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) !==
@@ -0,0 +1,4 @@
1
+ const animationProp = [String, Object, Function];
2
+
3
+ export { animationProp };
4
+ //# sourceMappingURL=options-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options-api.js","sources":["../../../src/utils/options-api.ts"],"sourcesContent":["import { DefineComponent, PropType } from 'vue';\n\nexport const animationProp = [String, Object, Function] as PropType<DefineComponent | string>;\n"],"names":[],"mappings":"AAEa,MAAA,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-components",
3
- "version": "3.0.0-alpha.364",
3
+ "version": "3.0.0-alpha.366",
4
4
  "description": "Empathy X Components",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -68,12 +68,12 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@empathyco/x-adapter": "^8.0.0-alpha.28",
71
- "@empathyco/x-adapter-platform": "^1.0.0-alpha.70",
71
+ "@empathyco/x-adapter-platform": "^1.0.0-alpha.71",
72
72
  "@empathyco/x-bus": "^0.1.0-alpha.12",
73
73
  "@empathyco/x-deep-merge": "^1.3.0-alpha.34",
74
74
  "@empathyco/x-logger": "^1.2.0-alpha.11",
75
75
  "@empathyco/x-storage-service": "^2.0.0-alpha.11",
76
- "@empathyco/x-types": "^10.0.0-alpha.65",
76
+ "@empathyco/x-types": "^10.0.0-alpha.66",
77
77
  "@empathyco/x-utils": "^1.0.0-alpha.19",
78
78
  "@vue/devtools-api": "~6.5.0",
79
79
  "@vueuse/core": "~9.13.0",
@@ -93,7 +93,7 @@
93
93
  "@bahmutov/cypress-esbuild-preprocessor": "~2.2.0",
94
94
  "@cypress/vue2": "~2.0.1",
95
95
  "@empathyco/x-tailwindcss": "^1.0.0-alpha.29",
96
- "@microsoft/api-documenter": "~7.21.3",
96
+ "@microsoft/api-documenter": "~7.22.0",
97
97
  "@microsoft/api-extractor": "~7.34.0",
98
98
  "@rollup/plugin-commonjs": "~24.1.0",
99
99
  "@testing-library/jest-dom": "~5.16.0",
@@ -110,7 +110,7 @@
110
110
  "@vue/vue2-jest": "~27.0.0-alpha.3",
111
111
  "autoprefixer": "~10.4.4",
112
112
  "convert-source-map": "~2.0.0",
113
- "cypress": "~12.10.0",
113
+ "cypress": "~12.11.0",
114
114
  "esbuild": "0.17.18",
115
115
  "glob": "~7.2.0",
116
116
  "jest": "~27.5.0",
@@ -143,5 +143,5 @@
143
143
  "access": "public",
144
144
  "directory": "dist"
145
145
  },
146
- "gitHead": "2ca982795d1843f390b4dc678d78b80656ebf80d"
146
+ "gitHead": "23b076bb03324bbf4a6671fe4d664d162bcc2668"
147
147
  }