Skip to content

Commit f403793

Browse files
committed
docs: update props comments
1 parent 2260b57 commit f403793

File tree

9 files changed

+261
-141
lines changed

9 files changed

+261
-141
lines changed

packages/coreui-vue-chartjs/src/CChart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const CChart = defineComponent({
8383
/**
8484
* Chart.js chart type.
8585
*
86-
* @type {'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie' | 'scatter'}
86+
* @type 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie' | 'scatter'
8787
*/
8888
type: {
8989
type: String as PropType<ChartType>,

packages/coreui-vue/src/components/form/CFormCheck.ts

Lines changed: 66 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,94 @@
11
import { defineComponent, h } from 'vue'
2-
import { shape } from 'vue-types'
32

3+
import { CButton } from '../button'
44
import { CFormControlValidation } from './CFormControlValidation'
55
import { CFormLabel } from './CFormLabel'
66

7-
import { Color, Shape } from '../props'
8-
97
const CFormCheck = defineComponent({
108
name: 'CFormCheck',
119
inheritAttrs: false,
1210
props: {
13-
...CFormControlValidation.props,
1411
/**
1512
* Create button-like checkboxes and radio buttons.
13+
*
14+
* @see http://coreui.io/vue/docs/components/button.html
1615
*/
17-
button: shape({
18-
/**
19-
* Sets the color context of the component to one of CoreUI’s themed colors.
20-
*
21-
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
22-
*/
23-
color: Color,
24-
/**
25-
* Select the shape of the component.
26-
*
27-
* @values 'rounded', 'rounded-top', 'rounded-end', 'rounded-bottom', 'rounded-start', 'rounded-circle', 'rounded-pill', 'rounded-0', 'rounded-1', 'rounded-2', 'rounded-3'
28-
*/
29-
shape: Shape,
30-
/**
31-
* Size the component small or large.
32-
*
33-
* @values 'sm' | 'lg'
34-
*/
35-
size: {
36-
type: String,
37-
default: undefined,
38-
required: false,
39-
validator: (value: string) => {
40-
return ['sm', 'lg'].includes(value)
41-
},
42-
},
43-
/**
44-
* Set the button variant to an outlined button or a ghost button.
45-
*/
46-
variant: {
47-
type: String,
48-
default: undefined,
49-
required: false,
50-
validator: (value: string) => {
51-
return ['outline', 'ghost'].includes(value)
52-
},
53-
},
54-
}),
16+
button: {
17+
type: Object,
18+
},
5519
/**
56-
* The id global attribute defines an identifier (ID) that must be unique in the whole document.
20+
* Provide valuable, actionable feedback.
21+
*
22+
* @since 4.3.0
5723
*/
58-
id: {
24+
feedback: {
5925
type: String,
60-
default: undefined,
61-
required: false,
6226
},
6327
/**
64-
* Input Checkbox indeterminate Property
65-
*/
66-
indeterminate: Boolean,
67-
/**
68-
* Group checkboxes or radios on the same horizontal row by adding.
28+
* Provide valuable, actionable feedback.
29+
*
30+
* @since 4.3.0
6931
*/
70-
inline: {
71-
type: Boolean,
72-
required: false,
32+
feedbackInvalid: {
33+
type: String,
7334
},
7435
/**
75-
* Set component validation state to invalid.
36+
* Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
37+
*
38+
* @since 4.3.0
7639
*/
77-
invalid: {
78-
type: Boolean,
79-
required: false,
40+
feedbackValid: {
41+
type: String,
8042
},
8143
/**
8244
* Sets hit area to the full area of the component.
8345
*/
8446
hitArea: {
8547
type: String,
86-
required: false,
8748
validator: (value: string): boolean => {
8849
// The value must match one of these strings
8950
return ['full'].includes(value)
9051
},
9152
},
53+
/**
54+
* The id global attribute defines an identifier (ID) that must be unique in the whole document.
55+
*/
56+
id: {
57+
type: String,
58+
},
59+
/**
60+
* Input Checkbox indeterminate Property
61+
*/
62+
indeterminate: Boolean,
63+
/**
64+
* Group checkboxes or radios on the same horizontal row by adding.
65+
*/
66+
inline: {
67+
type: Boolean,
68+
},
69+
/**
70+
* Set component validation state to invalid.
71+
*/
72+
invalid: Boolean,
9273
/**
9374
* The element represents a caption for a component.
9475
*/
9576
label: {
9677
type: String,
97-
default: undefined,
98-
required: false,
9978
},
10079
/**
10180
* The default name for a value passed using v-model.
10281
*/
10382
modelValue: {
10483
type: [Boolean, String],
10584
value: undefined,
106-
required: false,
10785
},
86+
/**
87+
* Display validation feedback in a styled tooltip.
88+
*
89+
* @since 4.3.0
90+
*/
91+
tooltipFeedback: Boolean,
10892
/**
10993
* Specifies the type of component.
11094
*
@@ -113,14 +97,12 @@ const CFormCheck = defineComponent({
11397
type: {
11498
type: String,
11599
default: 'checkbox',
116-
required: false,
117100
},
118101
/**
119102
* Set component validation state to valid.
120103
*/
121104
valid: {
122105
type: Boolean,
123-
required: false,
124106
},
125107
},
126108
emits: [
@@ -161,19 +143,6 @@ const CFormCheck = defineComponent({
161143
},
162144
]
163145

164-
const labelClassName = props.button
165-
? [
166-
'btn',
167-
props.button.variant
168-
? `btn-${props.button.variant}-${props.button.color}`
169-
: `btn-${props.button.color}`,
170-
{
171-
[`btn-${props.button.size}`]: props.button.size,
172-
},
173-
`${props.button.shape}`,
174-
]
175-
: 'form-check-label'
176-
177146
const formControl = () => {
178147
return h('input', {
179148
...attrs,
@@ -186,18 +155,26 @@ const CFormCheck = defineComponent({
186155
})
187156
}
188157

189-
const formLabel = () => {
190-
return h(
191-
CFormLabel,
192-
{
193-
customClassName: labelClassName,
194-
...(props.id && { for: props.id }),
195-
},
196-
{
197-
default: () => (slots.label && slots.label()) || props.label,
198-
},
199-
)
200-
}
158+
const formLabel = () =>
159+
props.button
160+
? h(
161+
CButton,
162+
{
163+
component: 'label',
164+
...props.button,
165+
...(props.id && { for: props.id }),
166+
},
167+
{
168+
default: () => (slots.label && slots.label()) || props.label,
169+
},
170+
)
171+
: h(
172+
CFormLabel,
173+
{ class: 'form-check-label', ...(props.id && { for: props.id }) },
174+
{
175+
default: () => (slots.label && slots.label()) || props.label,
176+
},
177+
)
201178

202179
const formValidation = () => {
203180
return h(CFormControlValidation, {

packages/coreui-vue/src/components/form/CFormControlValidation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ const CFormControlValidation = defineComponent({
1414
/**
1515
* Provide valuable, actionable feedback.
1616
*
17-
* @since 4.2.0
17+
* @since 4.3.0
1818
*/
1919
feedback: {
2020
type: String,
2121
},
2222
/**
2323
* Provide valuable, actionable feedback.
2424
*
25-
* @since 4.2.0
25+
* @since 4.3.0
2626
*/
2727
feedbackInvalid: {
2828
type: String,
2929
},
3030
/**
3131
* Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
3232
*
33-
* @since 4.2.0
33+
* @since 4.3.0
3434
*/
3535
feedbackValid: {
3636
type: String,
@@ -42,7 +42,7 @@ const CFormControlValidation = defineComponent({
4242
/**
4343
* Display validation feedback in a styled tooltip.
4444
*
45-
* @since 4.2.0
45+
* @since 4.3.0
4646
*/
4747
tooltipFeedback: Boolean,
4848
/**

packages/coreui-vue/src/components/form/CFormControlWrapper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const CFormControlWrapper = defineComponent({
1212
/**
1313
* Provide valuable, actionable valid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
1414
*
15-
* @since 4.2.0
15+
* @since 4.3.0
1616
*/
1717
floatingLabel: {
1818
type: String,
@@ -26,15 +26,15 @@ const CFormControlWrapper = defineComponent({
2626
/**
2727
* Add a caption for a component.
2828
*
29-
* @since 4.2.0
29+
* @since 4.3.0
3030
*/
3131
label: {
3232
type: String,
3333
},
3434
/**
3535
* Add helper text to the component.
3636
*
37-
* @since 4.2.0
37+
* @since 4.3.0
3838
*/
3939
text: {
4040
type: String,

0 commit comments

Comments
 (0)