11import { defineComponent , h } from 'vue'
2+ import { shape } from 'vue-types'
23
4+ import { Color } from '../props'
35import { CCard , CCardBody } from './../card'
46import { CProgress } from '../progress/CProgress'
57
6- const CWidgetProgress = defineComponent ( {
7- name : 'CWidgetProgress ' ,
8+ const CWidgetStatsB = defineComponent ( {
9+ name : 'CWidgetStatsB ' ,
810 props : {
911 /**
10- * Sets the color context of the component to one of CoreUI’s themed colors. [docs]
12+ * Sets the color context of the component to one of CoreUI’s themed colors
1113 *
1214 * @values 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
1315 */
14- color : {
15- type : String ,
16- default : undefined ,
17- require : false ,
18- } ,
16+ color : Color ,
17+ /**
18+ * Colors have been inverted from their default dark shade.
19+ */
1920 inverse : {
2021 type : Boolean ,
2122 default : undefined ,
2223 require : false ,
2324 } ,
25+ progress : shape ( {
26+ /**
27+ * Sets the color context of the progress bar to one of CoreUI’s themed colors
28+ *
29+ * @values 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
30+ */
31+ color : Color ,
32+ /**
33+ * The percent to progress the ProgressBar (out of 100).
34+ * @default 0
35+ */
36+ value : {
37+ type : Number ,
38+ default : 0 ,
39+ } ,
40+ } ) ,
2441 /**
25- * Sets the color context of the progress bar to one of CoreUI’s themed colors. [docs]
26- *
27- * @values 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
42+ * Helper text for your component. If you want to pass non-string value please use dedicated slot `<template #text>...</template>`
2843 */
29- progressColor : {
30- type : String ,
31- default : undefined ,
32- require : false ,
33- } ,
34- progressValue : {
35- type : Number ,
36- default : 0 ,
37- require : false ,
38- } ,
3944 text : {
4045 type : String ,
4146 default : undefined ,
4247 require : false ,
4348 } ,
49+ /**
50+ * Title node for your component. If you want to pass non-string value please use dedicated slot `<template #title>...</template>`
51+ */
4452 title : {
4553 type : String ,
4654 default : undefined ,
4755 require : false ,
4856 } ,
57+ /**
58+ * Value node for your component. If you want to pass non-string value please use dedicated slot `<template #value>...</template>`
59+ */
4960 value : {
5061 type : [ Number , String ] ,
5162 default : 0 ,
5263 require : false ,
5364 } ,
5465 } ,
55- setup ( props ) {
66+ setup ( props , { slots } ) {
5667 return ( ) =>
5768 h (
5869 CCard ,
5970 {
6071 class : [
6172 {
62- [ 'text-white ' ] : props . inverse ,
73+ [ 'text-high-emphasis-inverse ' ] : props . inverse ,
6374 } ,
6475 ] ,
6576 color : props . color ,
@@ -71,32 +82,32 @@ const CWidgetProgress = defineComponent({
7182 class : 'card-body' ,
7283 } ,
7384 ( ) => [
74- props . value &&
85+ ( props . value || slots . value ) &&
7586 h (
7687 'div' ,
7788 {
7889 class : 'fs-4 fw-semibold' ,
7990 } ,
8091 {
81- default : ( ) => props . value ,
92+ default : ( ) => ( slots . value && slots . value ( ) ) || props . value ,
8293 } ,
8394 ) ,
84- props . title &&
95+ ( props . title || slots . title ) &&
8596 h (
8697 'div' ,
8798 { } ,
8899 {
89- default : ( ) => props . title ,
100+ default : ( ) => ( slots . title && slots . title ( ) ) || props . title ,
90101 } ,
91102 ) ,
92103 h ( CProgress , {
93104 class : 'my-2' ,
94- color : props . progressColor ,
105+ color : props . progress ?. color ,
95106 height : 4 ,
96- value : props . progressValue ,
107+ value : props . progress ?. value ,
97108 white : props . inverse ,
98109 } ) ,
99- props . text &&
110+ ( props . text || slots . text ) &&
100111 h (
101112 'small' ,
102113 {
@@ -105,7 +116,7 @@ const CWidgetProgress = defineComponent({
105116 ] ,
106117 } ,
107118 {
108- default : ( ) => props . text ,
119+ default : ( ) => ( slots . text && slots . text ( ) ) || props . text ,
109120 } ,
110121 ) ,
111122 ] ,
@@ -114,4 +125,4 @@ const CWidgetProgress = defineComponent({
114125 } ,
115126} )
116127
117- export { CWidgetProgress }
128+ export { CWidgetStatsB }
0 commit comments