@empathyco/x-components 6.3.2 → 7.0.1

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 (51) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/core/index.js +0 -1
  3. package/core/index.js.map +1 -1
  4. package/docs/API-reference/api/x-adapter-platform.platformnextquery.md +1 -1
  5. package/docs/API-reference/api/x-adapter-platform.platformnextquery.source.md +1 -1
  6. package/docs/API-reference/api/x-adapter-platform.platformrelatedtag.md +1 -1
  7. package/docs/API-reference/api/x-adapter-platform.platformrelatedtag.source.md +1 -1
  8. package/docs/API-reference/api/x-components.basecurrency.md +10 -25
  9. package/docs/API-reference/api/x-components.basepricefilterlabel.md +4 -6
  10. package/docs/API-reference/api/x-components.baseresultcurrentprice.md +9 -3
  11. package/docs/API-reference/api/x-components.baseresultpreviousprice.md +9 -3
  12. package/docs/API-reference/api/x-components.md +0 -15
  13. package/docs/API-reference/components/common/currency/x-components.base-currency.md +47 -140
  14. package/docs/API-reference/components/common/filters/labels/x-components.base-price-filter-label.md +43 -8
  15. package/docs/API-reference/components/common/result/x-components.base-result-current-price.md +30 -7
  16. package/docs/API-reference/components/common/result/x-components.base-result-previous-price.md +33 -7
  17. package/js/components/currency/base-currency.vue.js +5 -8
  18. package/js/components/currency/base-currency.vue.js.map +1 -1
  19. package/js/components/currency/base-currency.vue2.js +21 -63
  20. package/js/components/currency/base-currency.vue2.js.map +1 -1
  21. package/js/components/filters/labels/base-price-filter-label.vue.js +15 -4
  22. package/js/components/filters/labels/base-price-filter-label.vue.js.map +1 -1
  23. package/js/components/result/base-result-current-price.vue.js +2 -1
  24. package/js/components/result/base-result-current-price.vue.js.map +1 -1
  25. package/js/components/result/base-result-current-price.vue2.js +9 -13
  26. package/js/components/result/base-result-current-price.vue2.js.map +1 -1
  27. package/js/components/result/base-result-previous-price.vue.js +2 -1
  28. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  29. package/js/components/result/base-result-previous-price.vue2.js +9 -12
  30. package/js/components/result/base-result-previous-price.vue2.js.map +1 -1
  31. package/js/index.js +0 -1
  32. package/js/index.js.map +1 -1
  33. package/package.json +3 -3
  34. package/report/x-adapter-platform.api.json +2 -2
  35. package/report/x-components.api.json +294 -85
  36. package/report/x-components.api.md +33 -20
  37. package/types/src/components/currency/base-currency.vue.d.ts +27 -43
  38. package/types/src/components/currency/base-currency.vue.d.ts.map +1 -1
  39. package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts +26 -8
  40. package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts.map +1 -1
  41. package/types/src/components/result/base-result-current-price.vue.d.ts +21 -27
  42. package/types/src/components/result/base-result-current-price.vue.d.ts.map +1 -1
  43. package/types/src/components/result/base-result-previous-price.vue.d.ts +21 -25
  44. package/types/src/components/result/base-result-previous-price.vue.d.ts.map +1 -1
  45. package/types/src/utils/index.d.ts +0 -1
  46. package/types/src/utils/index.d.ts.map +1 -1
  47. package/docs/API-reference/api/x-components.currencyformatter.md +0 -76
  48. package/js/utils/currency-formatter.js +0 -121
  49. package/js/utils/currency-formatter.js.map +0 -1
  50. package/types/src/utils/currency-formatter.d.ts +0 -30
  51. package/types/src/utils/currency-formatter.d.ts.map +0 -1
@@ -10,10 +10,11 @@ Component that renders the @empathyco/x-types#Result previous price.
10
10
 
11
11
  ## Props
12
12
 
13
- | Name | Description | Type | Default |
14
- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------------- |
15
- | <code>result</code> | (Required) The @empathyco/x-types#Result information. | <code>Result</code> | <code></code> |
16
- | <code>format</code> | Format or mask to be defined as string.<br />- Use 'i' to define integer numbers.<br />- Use 'd' to define decimal numbers. You can define the length of the decimal part. If the<br />doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.<br />- Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.<br />- Decimal separator must be defined between the last 'i' and the first 'd'. It can be more<br />than one character.<br />- Set whatever you need around the integers and decimals marks. | <code>string</code> | <code></code> |
13
+ | Name | Description | Type | Default |
14
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | ----------------------- |
15
+ | <code>result</code> | (Required) The @empathyco/x-types#Result information. | <code>Result</code> | <code></code> |
16
+ | <code>currency</code> | Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes. | <code>string</code> | <code></code> |
17
+ | <code>format</code> | The currency format possibilities from Intl.NumberFormatOptions.<br />Allows customization of decimal places, grouping, etc. | <code>Omit<Intl.NumberFormatOptions, 'currency' \| 'style'></code> | <code>() => ({})</code> |
17
18
 
18
19
  ## Slots
19
20
 
@@ -25,16 +26,40 @@ Component that renders the @empathyco/x-types#Result previous price.
25
26
 
26
27
  ### Basic example
27
28
 
28
- This component shows the previous price formatted if it has discount. The component has an optional
29
- `format` prop to select the currency format to be applied.
29
+ This component shows the previous price formatted if it has discount. The component has optional
30
+ `currency` and `format` props to customize the display.
30
31
 
31
32
  ```vue
32
33
  <template>
33
- <BaseResultPreviousPrice :result="result" :format="'i.iii,ddd €'" />
34
+ <BaseResultPreviousPrice :result="result" currency="USD" />
34
35
  </template>
35
36
 
36
37
  <script setup>
37
38
  import { BaseResultPreviousPrice } from "@empathyco/x-components";
39
+
40
+ const result = {
41
+ price: { originalValue: 199.99, hasDiscount: true },
42
+ // ...other result properties
43
+ };
44
+ </script>
45
+ ```
46
+
47
+ ### Customizing format
48
+
49
+ You can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:
50
+
51
+ ```vue
52
+ <template>
53
+ <BaseResultPreviousPrice
54
+ :result="result"
55
+ currency="EUR"
56
+ :format="{ minimumFractionDigits: 2, maximumFractionDigits: 2 }"
57
+ />
58
+ </template>
59
+
60
+ <script setup>
61
+ import { BaseResultPreviousPrice } from "@empathyco/x-components";
62
+
38
63
  const result = {
39
64
  price: { originalValue: 199.99, hasDiscount: true },
40
65
  // ...other result properties
@@ -55,6 +80,7 @@ const result = {
55
80
 
56
81
  <script setup>
57
82
  import { BaseResultPreviousPrice } from "@empathyco/x-components";
83
+
58
84
  const result = {
59
85
  price: { originalValue: 199.99, hasDiscount: true },
60
86
  // ...other result properties
@@ -1,19 +1,16 @@
1
1
  import _sfc_main from './base-currency.vue2.js';
2
- import { openBlock, createElementBlock, toDisplayString, createCommentVNode } from 'vue';
2
+ import { openBlock, createElementBlock, toDisplayString } from 'vue';
3
3
  import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
4
4
 
5
- const _hoisted_1 = {
6
- key: 0,
7
- class: "x-currency"
8
- };
5
+ const _hoisted_1 = { class: "x-currency" };
9
6
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
10
- return _ctx.value !== void 0 ? (openBlock(), createElementBlock(
7
+ return openBlock(), createElementBlock(
11
8
  "span",
12
9
  _hoisted_1,
13
- toDisplayString(_ctx.currency),
10
+ toDisplayString(_ctx.currencyText),
14
11
  1
15
12
  /* TEXT */
16
- )) : createCommentVNode("v-if", true);
13
+ );
17
14
  }
18
15
  var BaseCurrency = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
19
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span v-if=\"value !== undefined\" class=\"x-currency\">{{ currency }}</span>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, inject } from 'vue'\nimport { currencyFormatter } from '../../utils/currency-formatter'\n\n/**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the 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 * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * '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 * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The format as string.\n *\n * @public\n */\n format: {\n type: String,\n },\n },\n\n setup(props) {\n /**\n * The injected format as string.\n *\n * @public\n */\n const injectedFormat = inject<string>('currencyFormat', 'i.iii,dd')\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n const renderedFormat = computed<string>(() => props.format ?? injectedFormat)\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n const currency = computed<string>(() => currencyFormatter(props.value, renderedFormat.value))\n\n return {\n currency,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, with the proper\nformat provided as string property. The rendered tag is a span in order to render a default inline\nHTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" />\n <!-- output: '12.345.678,87' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678,876 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$ i.iii,dd\" />\n <!-- output: '$ 12.345.678,87' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$i.iii,dd\" />\n <!-- output: '$12.345.678,87' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd€\" />\n <!-- output: '12.345.678,87€' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i,iii.dd €\" />\n <!-- output: '12,345,678.87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii.dd €\" />\n <!-- output: '12 345 678.87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii - dd €\" />\n <!-- output: '12 345 678 - 87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,876543 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,870000 ' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,000000 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script setup>\nimport { BaseCurrency } from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_createCommentVNode"],"mappings":";;;;;;EACmC,KAAA,EAAM;;;AAA3B,EAAA,OAAA,IAAA,CAAA,KAAA,KAAU,MAAA,IAAAA,SAAA,EAAA,EAAtBC,kBAAA;AAAA,IAAyE,MAAA;AAAA,IAAzE,UAAA;AAAA,IAAyEC,gBAAlB,IAAA,CAAA,QAAQ,CAAA;AAAA,IAAA;AAAA;AAAA,GAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;;;;;;"}
1
+ {"version":3,"file":"base-currency.vue.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span class=\"x-currency\">{{ currencyText }}</span>\n</template>\n\n<script lang=\"ts\">\nimport type { SnippetConfig } from '@x/x-installer'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\n\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The ISO 4217 currency value. If not specified we use snippetConfig.currency\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n * Note: 'currency' and 'style' options are managed internally.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n\n setup(props) {\n const snippetConfig = inject<SnippetConfig>('snippetConfig')\n\n const currencyText = computed<string>(() => {\n const currency = props.currency ?? snippetConfig?.currency ?? 'EUR'\n return Intl.NumberFormat(snippetConfig?.uiLang, {\n style: 'currency',\n ...props.format,\n currency,\n }).format(props.value)\n })\n\n return {\n currencyText,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, formatted\nusing the Intl.NumberFormat API with ISO 4217 currency codes. The rendered tag is a span in order\nto render a default inline HTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" currency=\"EUR\" />\n <!-- output depends on locale, e.g., '12.345.678,88 €' for es-ES -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Customizing decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87654321\"\n currency=\"USD\"\n :format=\"{ minimumFractionDigits: 3, maximumFractionDigits: 3 }\"\n />\n <!-- output: '$12,345,678.877' for en-US locale -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### No decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n />\n <!-- output: '12.345.679 €' for es-ES locale (rounds up) -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using different currencies\n\n```vue\n<template>\n <div>\n <BaseCurrency :value=\"1234.56\" currency=\"USD\" />\n <!-- output: '$1,234.56' for en-US -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n <!-- output: '1.234,56 €' for es-ES -->\n <BaseCurrency :value=\"1234.56\" currency=\"GBP\" />\n <!-- output: '£1,234.56' for en-GB -->\n <BaseCurrency :value=\"1234.56\" currency=\"JPY\" />\n <!-- output: '¥1,235' for ja-JP -->\n </div>\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Advanced formatting options\n\nYou can pass any valid Intl.NumberFormatOptions (except 'currency' and 'style' which are managed\ninternally):\n\n```vue\n<template>\n <BaseCurrency\n :value=\"1234567.89\"\n currency=\"EUR\"\n :format=\"{\n minimumFractionDigits: 2,\n maximumFractionDigits: 4,\n useGrouping: true,\n }\"\n />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString"],"mappings":";;;;AACQ,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,YAAA,EAAY;;AAAxB,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAAkD,MAAA;AAAA,IAAlD,UAAA;AAAA,IAAkDC,gBAAtB,IAAA,CAAA,YAAY,CAAA;AAAA,IAAA;AAAA;AAAA,GAAA;;;;;;"}
@@ -1,43 +1,5 @@
1
1
  import { defineComponent, inject, computed } from 'vue';
2
- import { currencyFormatter } from '../../utils/currency-formatter.js';
3
2
 
4
- /**
5
- * Renders the value received as a property which always must be a JavaScript number, with the
6
- * proper format provided as a string property or by injection. The rendered tag is a span in
7
- * order to render a default inline HTML element.
8
- *
9
- * Regarding the format or mask to be defined as string:
10
- * - Use 'i' to define integer numbers.
11
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
12
- * format doesn't include decimals, it is filled with zeros until reach the length defined with
13
- * 'd's.
14
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
15
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
16
- * than one character.
17
- * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the
18
- * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).
19
- * - Set whatever you need around the integers and decimals marks.
20
- * - Default mask: 'i.iii,dd' which returns '1.345,67'.
21
- *
22
- * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length
23
- * of decimals provided from the adapter. Otherwise, when the component truncate the decimal
24
- * part, it deletes significant digits.
25
- *
26
- * Basic example:
27
- *
28
- * ```vue
29
- * <BaseCurrency
30
- * :value="123456.789"
31
- * format="i.iiii,dddd €"
32
- * />
33
- * ```
34
- *
35
- * It will render: `123.456,7890 €`.
36
- *
37
- * See docs below for more examples.
38
- *
39
- * @public
40
- */
41
3
  var _sfc_main = defineComponent({
42
4
  props: {
43
5
  /**
@@ -53,39 +15,35 @@ var _sfc_main = defineComponent({
53
15
  required: true,
54
16
  },
55
17
  /**
56
- * The format as string.
18
+ * The ISO 4217 currency value. If not specified we use snippetConfig.currency
57
19
  *
58
20
  * @public
59
21
  */
60
- format: {
61
- type: String,
62
- },
63
- },
64
- setup(props) {
22
+ currency: String,
65
23
  /**
66
- * The injected format as string.
24
+ * The currency format possibilities from Intl.NumberFormatOptions.
25
+ * Allows customization of decimal places, grouping, etc.
26
+ * Note: 'currency' and 'style' options are managed internally.
67
27
  *
68
28
  * @public
69
29
  */
70
- const injectedFormat = inject('currencyFormat', 'i.iii,dd');
71
- /**
72
- * A format which can be passed through prop or injected.
73
- *
74
- * @returns A format as string.
75
- *
76
- * @internal
77
- */
78
- const renderedFormat = computed(() => props.format ?? injectedFormat);
79
- /**
80
- * Returns the formatted result as string.
81
- *
82
- * @returns Formatted number.
83
- *
84
- * @internal
85
- */
86
- const currency = computed(() => currencyFormatter(props.value, renderedFormat.value));
30
+ format: {
31
+ type: Object,
32
+ default: () => ({}),
33
+ },
34
+ },
35
+ setup(props) {
36
+ const snippetConfig = inject('snippetConfig');
37
+ const currencyText = computed(() => {
38
+ const currency = props.currency ?? snippetConfig?.currency ?? 'EUR';
39
+ return Intl.NumberFormat(snippetConfig?.uiLang, {
40
+ style: 'currency',
41
+ ...props.format,
42
+ currency,
43
+ }).format(props.value);
44
+ });
87
45
  return {
88
- currency,
46
+ currencyText,
89
47
  };
90
48
  },
91
49
  });
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue2.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span v-if=\"value !== undefined\" class=\"x-currency\">{{ currency }}</span>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, inject } from 'vue'\nimport { currencyFormatter } from '../../utils/currency-formatter'\n\n/**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the 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 * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * '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 * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The format as string.\n *\n * @public\n */\n format: {\n type: String,\n },\n },\n\n setup(props) {\n /**\n * The injected format as string.\n *\n * @public\n */\n const injectedFormat = inject<string>('currencyFormat', 'i.iii,dd')\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n const renderedFormat = computed<string>(() => props.format ?? injectedFormat)\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n const currency = computed<string>(() => currencyFormatter(props.value, renderedFormat.value))\n\n return {\n currency,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, with the proper\nformat provided as string property. The rendered tag is a span in order to render a default inline\nHTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" />\n <!-- output: '12.345.678,87' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678,876 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$ i.iii,dd\" />\n <!-- output: '$ 12.345.678,87' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$i.iii,dd\" />\n <!-- output: '$12.345.678,87' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd€\" />\n <!-- output: '12.345.678,87€' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i,iii.dd €\" />\n <!-- output: '12,345,678.87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii.dd €\" />\n <!-- output: '12 345 678.87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii - dd €\" />\n <!-- output: '12 345 678 - 87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,876543 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,870000 ' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,000000 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script setup>\nimport { BaseCurrency } from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;;;;AAOE;AACF,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;AAIE;QACF,MAAM,cAAa,GAAI,MAAM,CAAS,gBAAgB,EAAE,UAAU,CAAA;AAElE;;;;;;AAME;AACF,QAAA,MAAM,cAAa,GAAI,QAAQ,CAAS,MAAM,KAAK,CAAC,MAAK,IAAK,cAAc,CAAA;AAE5E;;;;;;AAME;AACF,QAAA,MAAM,WAAW,QAAQ,CAAS,MAAM,iBAAiB,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAA;QAE5F,OAAO;YACL,QAAQ;SACV;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-currency.vue2.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span class=\"x-currency\">{{ currencyText }}</span>\n</template>\n\n<script lang=\"ts\">\nimport type { SnippetConfig } from '@x/x-installer'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\n\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The ISO 4217 currency value. If not specified we use snippetConfig.currency\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n * Note: 'currency' and 'style' options are managed internally.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n\n setup(props) {\n const snippetConfig = inject<SnippetConfig>('snippetConfig')\n\n const currencyText = computed<string>(() => {\n const currency = props.currency ?? snippetConfig?.currency ?? 'EUR'\n return Intl.NumberFormat(snippetConfig?.uiLang, {\n style: 'currency',\n ...props.format,\n currency,\n }).format(props.value)\n })\n\n return {\n currencyText,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, formatted\nusing the Intl.NumberFormat API with ISO 4217 currency codes. The rendered tag is a span in order\nto render a default inline HTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" currency=\"EUR\" />\n <!-- output depends on locale, e.g., '12.345.678,88 €' for es-ES -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Customizing decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87654321\"\n currency=\"USD\"\n :format=\"{ minimumFractionDigits: 3, maximumFractionDigits: 3 }\"\n />\n <!-- output: '$12,345,678.877' for en-US locale -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### No decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n />\n <!-- output: '12.345.679 €' for es-ES locale (rounds up) -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using different currencies\n\n```vue\n<template>\n <div>\n <BaseCurrency :value=\"1234.56\" currency=\"USD\" />\n <!-- output: '$1,234.56' for en-US -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n <!-- output: '1.234,56 €' for es-ES -->\n <BaseCurrency :value=\"1234.56\" currency=\"GBP\" />\n <!-- output: '£1,234.56' for en-GB -->\n <BaseCurrency :value=\"1234.56\" currency=\"JPY\" />\n <!-- output: '¥1,235' for ja-JP -->\n </div>\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Advanced formatting options\n\nYou can pass any valid Intl.NumberFormatOptions (except 'currency' and 'style' which are managed\ninternally):\n\n```vue\n<template>\n <BaseCurrency\n :value=\"1234567.89\"\n currency=\"EUR\"\n :format=\"{\n minimumFractionDigits: 2,\n maximumFractionDigits: 4,\n useGrouping: true,\n }\"\n />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;AASA,gBAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;;;;AAOE;AACF,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;;AAME;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAwE;AAC9E,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,aAAY,GAAI,MAAM,CAAgB,eAAe,CAAA;AAE3D,QAAA,MAAM,eAAe,QAAQ,CAAS,MAAI;YACxC,MAAM,QAAO,GAAI,KAAK,CAAC,QAAO,IAAK,aAAa,EAAE,QAAO,IAAK,KAAI;AAClE,YAAA,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE;AAC9C,gBAAA,KAAK,EAAE,UAAU;gBACjB,GAAG,KAAK,CAAC,MAAM;gBACf,QAAQ;AACT,aAAA,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAA;AACvB,QAAA,CAAC,CAAA;QAED,OAAO;YACL,YAAY;SACd;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -15,10 +15,19 @@ var _sfc_main = defineComponent({
15
15
  type: Object,
16
16
  required: true,
17
17
  },
18
- /** Configuration for show the label. */
19
- format: {
20
- type: String,
21
- },
18
+ /**
19
+ * An ISO 4217 currency value.
20
+ *
21
+ * @public
22
+ */
23
+ currency: String,
24
+ /**
25
+ * The currency format possibilities from Intl.NumberFormatOptions.
26
+ * Allows customization of decimal places, grouping, etc.
27
+ *
28
+ * @public
29
+ */
30
+ format: Object,
22
31
  /**
23
32
  * Message shown when the filter hasn't got the min value defined.
24
33
  *
@@ -67,12 +76,14 @@ var _sfc_main = defineComponent({
67
76
  if (partMessage === '{min}') {
68
77
  return h(BaseCurrency, {
69
78
  value: props.filter.range.min,
79
+ currency: props.currency,
70
80
  format: props.format,
71
81
  });
72
82
  }
73
83
  else if (partMessage === '{max}') {
74
84
  return h(BaseCurrency, {
75
85
  value: props.filter.range.max,
86
+ currency: props.currency,
76
87
  format: props.format,
77
88
  });
78
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base-price-filter-label.vue.js","sources":["../../../../../src/components/filters/labels/base-price-filter-label.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { RangeValue } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h } from 'vue'\nimport BaseCurrency from '../../currency/base-currency.vue'\n\n/**\n * Renders a label for a price filter, allowing to select different messages depending on the\n * value of the filter.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /** The filter data for get min and max value. */\n filter: {\n type: Object as PropType<{ range: RangeValue }>,\n required: true,\n },\n /** Configuration for show the label. */\n format: {\n type: String,\n },\n /**\n * Message shown when the filter hasn't got the min value defined.\n *\n * @public\n */\n lessThan: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter has both the min and max values defined.\n *\n * @public\n */\n fromTo: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter hasn't got max value defined.\n *\n * @public\n */\n from: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n /**\n * The active label, retrieved from the provided props.\n * It depends on the min and max values of the filter.\n *\n * @returns The active label to be formatted with the min and max values of the filter.\n */\n const label = computed<string>(() => {\n return props.filter.range.min === null\n ? props.lessThan\n : props.filter.range.max === null\n ? props.from\n : props.fromTo\n })\n\n return () => {\n const labelParts = label.value.split(/(\\{min\\}|\\{max\\})/)\n\n const children = labelParts.map(partMessage => {\n if (partMessage === '{min}') {\n return h(BaseCurrency, {\n value: props.filter.range.min as number,\n format: props.format,\n })\n } else if (partMessage === '{max}') {\n return h(BaseCurrency, {\n value: props.filter.range.max as number,\n format: props.format,\n })\n }\n return partMessage\n })\n\n return h('span', { class: 'x-price-filter-label' }, children)\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders a label for a price filter, allowing to select different messages depending on the value of\nthe filter.\n\n- When the `min` value property isn't defined in the filter, you can show a message like\n `Less than $10` by using the `lessThan` prop, combined with the `{max}` placeholder.\n- When the `max` value property isn't defined in the filter, you can show a message like\n `More than $300` by using the `from` prop, combined with the `{min}` placeholder.\n- If both the `min` and `max` values of the filter are defined, you can show a message like\n `$10 - $300` by using the `fromTo` prop.\n\nThis component uses internally the `BaseCurrency` one, so you can pass the same props to configure\nhow the price should look like.\n\n### Basic usage\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n format=\"$i\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAMA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;;AAEL,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAyC;AAC/C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;AAKE;AACF,QAAA,MAAM,KAAI,GAAI,QAAQ,CAAS,MAAI;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;kBAC9B,KAAK,CAAC;kBACN,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;sBACzB,KAAK,CAAC;AACR,sBAAE,KAAK,CAAC,MAAK;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,OAAO,MAAI;YACT,MAAM,UAAS,GAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAA;YAExD,MAAM,WAAW,UAAU,CAAC,GAAG,CAAC,WAAU,IAAG;AAC3C,gBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAC3B,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AAAO,qBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAClC,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AACA,gBAAA,OAAO,WAAU;AACnB,YAAA,CAAC,CAAA;AAED,YAAA,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAqB,EAAG,EAAE,QAAQ,CAAA;AAC9D,QAAA,CAAA;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-price-filter-label.vue.js","sources":["../../../../../src/components/filters/labels/base-price-filter-label.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { RangeValue } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h } from 'vue'\nimport BaseCurrency from '../../currency/base-currency.vue'\n\n/**\n * Renders a label for a price filter, allowing to select different messages depending on the\n * value of the filter.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /** The filter data for get min and max value. */\n filter: {\n type: Object as PropType<{ range: RangeValue }>,\n required: true,\n },\n /**\n * An ISO 4217 currency value.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n /**\n * Message shown when the filter hasn't got the min value defined.\n *\n * @public\n */\n lessThan: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter has both the min and max values defined.\n *\n * @public\n */\n fromTo: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter hasn't got max value defined.\n *\n * @public\n */\n from: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n /**\n * The active label, retrieved from the provided props.\n * It depends on the min and max values of the filter.\n *\n * @returns The active label to be formatted with the min and max values of the filter.\n */\n const label = computed<string>(() => {\n return props.filter.range.min === null\n ? props.lessThan\n : props.filter.range.max === null\n ? props.from\n : props.fromTo\n })\n\n return () => {\n const labelParts = label.value.split(/(\\{min\\}|\\{max\\})/)\n\n const children = labelParts.map(partMessage => {\n if (partMessage === '{min}') {\n return h(BaseCurrency, {\n value: props.filter.range.min as number,\n currency: props.currency,\n format: props.format,\n })\n } else if (partMessage === '{max}') {\n return h(BaseCurrency, {\n value: props.filter.range.max as number,\n currency: props.currency,\n format: props.format,\n })\n }\n return partMessage\n })\n\n return h('span', { class: 'x-price-filter-label' }, children)\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders a label for a price filter, allowing to select different messages depending on the value of\nthe filter.\n\n- When the `min` value property isn't defined in the filter, you can show a message like\n `Less than $10` by using the `lessThan` prop, combined with the `{max}` placeholder.\n- When the `max` value property isn't defined in the filter, you can show a message like\n `More than $300` by using the `from` prop, combined with the `{min}` placeholder.\n- If both the `min` and `max` values of the filter are defined, you can show a message like\n `$10 - $300` by using the `fromTo` prop.\n\nThis component uses internally the `BaseCurrency` one, so you can pass the same props to configure\nhow the price should look like.\n\n### Basic usage\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"USD\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAMA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;;AAEL,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAyC;AAC/C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE,MAAwE;AAChF;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;AAKE;AACF,QAAA,MAAM,KAAI,GAAI,QAAQ,CAAS,MAAI;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;kBAC9B,KAAK,CAAC;kBACN,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;sBACzB,KAAK,CAAC;AACR,sBAAE,KAAK,CAAC,MAAK;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,OAAO,MAAI;YACT,MAAM,UAAS,GAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAA;YAExD,MAAM,WAAW,UAAU,CAAC,GAAG,CAAC,WAAU,IAAG;AAC3C,gBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAC3B,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AAAO,qBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAClC,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AACA,gBAAA,OAAO,WAAU;AACnB,YAAA,CAAC,CAAA;AAED,YAAA,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAqB,EAAG,EAAE,QAAQ,CAAA;AAC9D,QAAA,CAAA;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -15,8 +15,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
15
15
  _ctx.result.price?.value ? (openBlock(), createBlock(_component_BaseCurrency, {
16
16
  key: 0,
17
17
  value: _ctx.result.price.value,
18
+ currency: _ctx.currency,
18
19
  format: _ctx.format
19
- }, null, 8, ["value", "format"])) : createCommentVNode("v-if", true)
20
+ }, null, 8, ["value", "currency", "format"])) : createCommentVNode("v-if", true)
20
21
  ])
21
22
  ],
22
23
  2
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-current-price.vue.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency v-if=\"result.price?.value\" :value=\"result.price.value\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#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 * - Default mask: 'i.iii,dd' which returns '1.345,67'.\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 setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `format` by property or let\nthe `BaseCurrency` component use an injected one.\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\" :format=\"'i.iii,ddd €'\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n </BaseResultCurrentPrice>\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createBlock","_createCommentVNode"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAQM,KAAA;AAAA,IAAA;AAAA,MARA,KAAA,EAAKC,cAAA,CAAA,CAAE,IAAA,CAAA,cAAA,EAAsB,wBAAwB,CAAA,CAAA;AAAA,MAAC,WAAA,EAAU;AAAA,KAAA;;AAKpE,MAAAC,UAAA,CAEO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAFA,MAAA,EAAQ,IAAA,CAAA,MAAA,EAAM,EAArB,MAEO;AAAA,QADe,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,KAAA,IAAAH,SAAA,EAAA,EAAlCI,WAAA,CAAwF,uBAAA,EAAA;AAAA,UAAA,GAAA,EAAA,CAAA;AAA9C,UAAA,KAAA,EAAO,YAAO,KAAA,CAAM,KAAA;AAAA,UAAQ,MAAA,EAAQ,IAAA,CAAA;AAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,QAAA,CAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-result-current-price.vue.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.value\"\n :value=\"result.price.value\"\n :currency=\"currency\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `currency` and `format`\nproperties to customize the display.\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultCurrentPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.456, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n </BaseResultCurrentPrice>\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createBlock","_createCommentVNode"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAaM,KAAA;AAAA,IAAA;AAAA,MAbA,KAAA,EAAKC,cAAA,CAAA,CAAE,IAAA,CAAA,cAAA,EAAsB,wBAAwB,CAAA,CAAA;AAAA,MAAC,WAAA,EAAU;AAAA,KAAA;;AAKpE,MAAAC,UAAA,CAOO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAPA,MAAA,EAAQ,IAAA,CAAA,MAAA,EAAM,EAArB,MAOO;AAAA,QALG,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,KAAA,IAAAH,SAAA,EAAA,EADtBI,WAAA,CAKE,uBAAA,EAAA;AAAA,UAAA,GAAA,EAAA,CAAA;AAHC,UAAA,KAAA,EAAO,YAAO,KAAA,CAAM,KAAA;AAAA,UACpB,QAAA,EAAU,IAAA,CAAA,QAAA;AAAA,UACV,MAAA,EAAQ,IAAA,CAAA;AAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,UAAA,EAAA,QAAA,CAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;;"}
@@ -20,24 +20,20 @@ var _sfc_main = defineComponent({
20
20
  required: true,
21
21
  },
22
22
  /**
23
- * Format or mask to be defined as string.
24
- * - Use 'i' to define integer numbers.
25
- * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
26
- * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
27
- * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
28
- * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
29
- * than one character.
30
- * - Set whatever you need around the integers and decimals marks.
31
- * - Default mask: 'i.iii,dd' which returns '1.345,67'.
23
+ * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.
32
24
  *
33
- * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length
34
- * of decimals provided from the adapter. Otherwise, when the component truncate the decimal
35
- * part, delete significant digits.
25
+ * @public
26
+ */
27
+ currency: String,
28
+ /**
29
+ * The currency format possibilities from Intl.NumberFormatOptions.
30
+ * Allows customization of decimal places, grouping, etc.
36
31
  *
37
32
  * @public
38
33
  */
39
34
  format: {
40
- type: String,
35
+ type: Object,
36
+ default: () => ({}),
41
37
  },
42
38
  },
43
39
  setup(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-current-price.vue2.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency v-if=\"result.price?.value\" :value=\"result.price.value\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#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 * - Default mask: 'i.iii,dd' which returns '1.345,67'.\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 setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `format` by property or let\nthe `BaseCurrency` component use an injected one.\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\" :format=\"'i.iii,ddd €'\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n </BaseResultCurrentPrice>\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAmBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;;;;;;;;;;;;;AAgBE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;;AAME;AACF,QAAA,MAAM,cAAa,GAAI,QAAQ,CAAgB,OAAO;YACpD,iCAAiC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,WAAU,IAAK,KAAK;AAC5E,SAAA,CAAC,CAAA;QAEF,OAAO;YACL,cAAc;SAChB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-result-current-price.vue2.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.value\"\n :value=\"result.price.value\"\n :currency=\"currency\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `currency` and `format`\nproperties to customize the display.\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultCurrentPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.456, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n </BaseResultCurrentPrice>\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAwBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAwE;AAC9E,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;;AAME;AACF,QAAA,MAAM,cAAa,GAAI,QAAQ,CAAgB,OAAO;YACpD,iCAAiC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,WAAU,IAAK,KAAK;AAC5E,SAAA,CAAC,CAAA;QAEF,OAAO;YACL,cAAc;SAChB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -14,8 +14,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
14
14
  _ctx.result.price?.originalValue ? (openBlock(), createBlock(_component_BaseCurrency, {
15
15
  key: 0,
16
16
  value: _ctx.result.price.originalValue,
17
+ currency: _ctx.currency,
17
18
  format: _ctx.format
18
- }, null, 8, ["value", "format"])) : createCommentVNode("v-if", true)
19
+ }, null, 8, ["value", "currency", "format"])) : createCommentVNode("v-if", true)
19
20
  ])
20
21
  ])) : createCommentVNode("v-if", true);
21
22
  }
@@ -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\n v-if=\"result.price?.originalValue\"\n :value=\"result.price.originalValue\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#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 an optional\n`format` prop 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 setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\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 setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_renderSlot","_createBlock","_createCommentVNode"],"mappings":";;;;;;EAGI,KAAA,EAAM,yBAAA;AAAA,EACN,WAAA,EAAU;;;;AAFJ,EAAA,OAAA,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,WAAA,IAAAA,SAAA,EAAA,EADtBC,kBAAA,CAgBM,KAAA,EAhBN,UAAA,EAgBM;AAAA,IAPJC,UAAA,CAMO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EANA,MAAA,EAAQ,IAAA,CAAA,MAAA,IAAf,MAMO;AAAA,MAJG,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,aAAA,IAAAF,SAAA,EAAA,EADtBG,WAAA,CAIE,uBAAA,EAAA;AAAA,QAAA,GAAA,EAAA,CAAA;AAFC,QAAA,KAAA,EAAO,YAAO,KAAA,CAAM,aAAA;AAAA,QACpB,MAAA,EAAQ,IAAA,CAAA;AAAA,OAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,QAAA,CAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;"}
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\n v-if=\"result.price?.originalValue\"\n :value=\"result.price.originalValue\"\n :currency=\"currency\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\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 optional\n`currency` and `format` props to customize the display.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultPreviousPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\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 setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_renderSlot","_createBlock","_createCommentVNode"],"mappings":";;;;;;EAGI,KAAA,EAAM,yBAAA;AAAA,EACN,WAAA,EAAU;;;;AAFJ,EAAA,OAAA,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,WAAA,IAAAA,SAAA,EAAA,EADtBC,kBAAA,CAiBM,KAAA,EAjBN,UAAA,EAiBM;AAAA,IARJC,UAAA,CAOO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAPA,MAAA,EAAQ,IAAA,CAAA,MAAA,IAAf,MAOO;AAAA,MALG,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,aAAA,IAAAF,SAAA,EAAA,EADtBG,WAAA,CAKE,uBAAA,EAAA;AAAA,QAAA,GAAA,EAAA,CAAA;AAHC,QAAA,KAAA,EAAO,YAAO,KAAA,CAAM,aAAA;AAAA,QACpB,QAAA,EAAU,IAAA,CAAA,QAAA;AAAA,QACV,MAAA,EAAQ,IAAA,CAAA;AAAA,OAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,UAAA,EAAA,QAAA,CAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;"}
@@ -19,23 +19,20 @@ var _sfc_main = defineComponent({
19
19
  required: true,
20
20
  },
21
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.
22
+ * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.
30
23
  *
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.
24
+ * @public
25
+ */
26
+ currency: String,
27
+ /**
28
+ * The currency format possibilities from Intl.NumberFormatOptions.
29
+ * Allows customization of decimal places, grouping, etc.
34
30
  *
35
31
  * @public
36
32
  */
37
33
  format: {
38
- type: String,
34
+ type: Object,
35
+ default: () => ({}),
39
36
  },
40
37
  },
41
38
  });
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-previous-price.vue2.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\n v-if=\"result.price?.originalValue\"\n :value=\"result.price.originalValue\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#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 an optional\n`format` prop 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 setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\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 setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AA0BA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;;;;;;;;;;;;AAeE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACb,SAAA;AACF,KAAA;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-result-previous-price.vue2.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\n v-if=\"result.price?.originalValue\"\n :value=\"result.price.originalValue\"\n :currency=\"currency\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\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 optional\n`currency` and `format` props to customize the display.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultPreviousPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\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 setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AA2BA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAwE;AAC9E,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AACF,KAAA;AACF,CAAA,CAAA;;;;"}
package/js/index.js CHANGED
@@ -175,7 +175,6 @@ export { AnimationProp } from './types/animation-prop.js';
175
175
  export { arrayToObject, createEmitterArrayFilter, deepFilter, deepFlat, groupItemsBy, isArrayEmpty } from './utils/array.js';
176
176
  export { CancelSymbol, cancellablePromise } from './utils/cancellable-promise.js';
177
177
  export { clone } from './utils/clone.js';
178
- export { currencyFormatter } from './utils/currency-formatter.js';
179
178
  export { debounce as debounceFunction } from './utils/debounce.js';
180
179
  export { areFiltersDifferent, createRawFilters } from './utils/filters.js';
181
180
  export { FOCUSABLE_SELECTORS } from './utils/focus.js';
package/js/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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}