@empathyco/x-components
Version:
Empathy X Components
58 lines (55 loc) • 1.63 kB
JavaScript
import { defineComponent, computed } from 'vue';
import BaseCurrency from '../currency/base-currency.vue.js';
/**
* Component that renders the {@link @empathyco/x-types#Result} current price
* that may or may not be on sale.
*
* @public
*/
var _sfc_main = defineComponent({
components: { BaseCurrency },
props: {
/**
* (Required) The {@link @empathyco/x-types#Result} information.
*
* @public
*/
result: {
type: Object,
required: true,
},
/**
* Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.
*
* @public
*/
currency: String,
/**
* The currency format possibilities from Intl.NumberFormatOptions.
* Allows customization of decimal places, grouping, etc.
*
* @public
*/
format: {
type: Object,
default: () => ({}),
},
},
setup(props) {
/**
* Dynamic CSS classes to add to the root element of this component.
*
* @returns A booleans dictionary where each key is the class name to add,
* and the boolean value tells if it should be added or not.
* @internal
*/
const dynamicClasses = computed(() => ({
'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,
}));
return {
dynamicClasses,
};
},
});
export { _sfc_main as default };
//# sourceMappingURL=base-result-current-price.vue2.js.map