UNPKG

@coreui/vue

Version:

UI Components Library for Vue.js

103 lines (100 loc) 3.69 kB
import { defineComponent, h } from 'vue'; import { shape as J } from '../../node_modules/vue-types/dist/vue-types.modern.js'; import { CCard } from '../card/CCard.js'; import { CCardBody } from '../card/CCardBody.js'; import '../card/CCardFooter.js'; import '../card/CCardGroup.js'; import '../card/CCardHeader.js'; import '../card/CCardImage.js'; import '../card/CCardImageOverlay.js'; import '../card/CCardLink.js'; import '../card/CCardSubtitle.js'; import '../card/CCardText.js'; import '../card/CCardTitle.js'; import { CProgress } from '../progress/CProgress.js'; import '../progress/CProgressBar.js'; import '../progress/CProgressStacked.js'; import { Color } from '../../props.js'; const CWidgetStatsB = defineComponent({ name: 'CWidgetStatsB', props: { /** * Sets the color context of the component to one of CoreUI’s themed colors * * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light' */ color: Color, /** * Colors have been inverted from their default dark shade. */ inverse: Boolean, progress: J({ /** * Sets the color context of the progress bar to one of CoreUI’s themed colors * * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light' */ color: Color, /** * The percent to progress the ProgressBar (out of 100). */ value: { type: Number, default: 0, }, }), /** * Helper text for your component. If you want to pass non-string value please use dedicated slot `<template #text>...</template>` */ text: String, /** * Title for your component. If you want to pass non-string value please use dedicated slot `<template #title>...</template>` */ title: String, /** * Value for your component. If you want to pass non-string or non-number value please use dedicated slot `<template #value>...</template>` */ value: { type: [Number, String], default: 0, }, }, setup(props, { slots }) { return () => h(CCard, { class: [ { 'text-white': props.inverse, }, ], color: props.color, }, () => h(CCardBody, { class: 'card-body', }, () => [ (props.value || slots.value) && h('div', { class: 'fs-4 fw-semibold', }, { default: () => (slots.value && slots.value()) || props.value, }), (props.title || slots.title) && h('div', {}, { default: () => (slots.title && slots.title()) || props.title, }), h(CProgress, { class: 'my-2', ...(props.progress && props.progress.color && { color: props.progress.color }), height: 4, ...(props.progress && props.progress.value && { value: props.progress.value }), white: props.inverse, }), (props.text || slots.text) && h('small', { class: [props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary'], }, { default: () => (slots.text && slots.text()) || props.text, }), ])); }, }); export { CWidgetStatsB }; //# sourceMappingURL=CWidgetStatsB.js.map