Skip to content

Commit 3747339

Browse files
committed
refactor: change form components names.
1 parent 08729d6 commit 3747339

22 files changed

+70
-70
lines changed

src/components/Form/CFormRadio.vue

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/components/Form/CFormInput.vue renamed to src/components/Form/CInput.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@
3737

3838
<script>
3939
import CFormGroup from './CFormGroup'
40-
import { formInputProps as props } from './formProps'
41-
40+
import { inputProps as props } from './formProps'
4241
import * as allFormMixins from './formMixins'
4342
const mixins = Object.values(allFormMixins)
4443
4544
export default {
46-
name: 'CFormInput',
45+
name: 'CInput',
4746
inheritAttrs: false,
4847
components: { CFormGroup },
4948
mixins,

src/components/Form/CFormCheckbox.vue renamed to src/components/Form/CInputCheckbox.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535

3636
<script>
3737
import { safeId, validationComputedProps } from './formMixins'
38-
import { formCheckboxProps as props } from './formProps'
38+
import { inputCheckboxProps as props } from './formProps'
3939
import CFormGroup from './CFormGroup'
40+
4041
export default {
41-
name: 'CFormCheckbox',
42+
name: 'CInputCheckbox',
4243
inheritAttrs: false,
4344
components: { CFormGroup },
4445
mixins: [safeId, validationComputedProps],

src/components/Form/CFormFile.vue renamed to src/components/Form/CInputFile.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@
4444
<script>
4545
import * as allFormMixins from './formMixins'
4646
const mixins = Object.values(allFormMixins).filter((i, key) => key !== 'watchValue')
47-
import { formFileProps as props } from './formProps'
47+
import { inputFileProps as props } from './formProps'
4848
import CFormGroup from './CFormGroup'
49+
4950
export default {
50-
name: 'CFormFile',
51+
name: 'CInputFile',
5152
inheritAttrs: false,
5253
components: { CFormGroup },
5354
mixins,

src/components/Form/CInputRadio.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
import CInputCheckbox from './CInputCheckbox'
3+
4+
export default {
5+
name: 'CInputRadio',
6+
extends: CInputCheckbox,
7+
type: 'radio'
8+
}
9+
</script>

src/components/Form/CFormSelect.vue renamed to src/components/Form/CSelect.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@
5757
<script>
5858
import * as allFormMixins from './formMixins'
5959
const mixins = Object.values(allFormMixins)
60-
import { formSelectProps as props } from './formProps'
60+
import { selectProps as props } from './formProps'
6161
import CFormGroup from './CFormGroup'
62+
6263
export default {
63-
name: 'CFormSelect',
64+
name: 'CSelect',
6465
inheritAttrs: false,
6566
components: { CFormGroup },
6667
slots: [

src/components/Form/CFormTextarea.vue renamed to src/components/Form/CTextarea.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@
3535

3636
<script>
3737
import CFormGroup from './CFormGroup'
38-
import { formTextareaProps as props} from './formProps'
39-
38+
import { textareaProps as props} from './formProps'
4039
import * as allFormMixins from './formMixins'
4140
const mixins = Object.values(allFormMixins)
4241
4342
export default {
44-
name: 'CFormTextarea',
43+
name: 'CTextarea',
4544
inheritAttrs: false,
4645
components: { CFormGroup },
4746
mixins,

src/components/Form/formProps.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ const textInputsProps = {
4343
}
4444

4545
// Html props: disabled, required, accept, id, placeholder
46-
export const formFileProps = Object.assign(
46+
export const inputFileProps = Object.assign(
4747
{}, formGroupAlwaysSharedProps, props, {
4848
custom: Boolean,
4949
placeholder: String,
5050
multiple: Boolean
5151
})
5252

5353
// Html props: disabled, required, rows, cols, placeholder, id
54-
export const formTextareaProps = Object.assign(
54+
export const textareaProps = Object.assign(
5555
{}, formGroupSharedProps, props, textInputsProps
5656
)
5757

5858
// HTML props: disabled, required, placeholder, id
59-
export const formInputProps = Object.assign(
59+
export const inputProps = Object.assign(
6060
{}, formGroupSharedProps, props, textInputsProps, {
6161
type: {
6262
type: String,
@@ -65,7 +65,7 @@ export const formInputProps = Object.assign(
6565
})
6666

6767
// Html props: disabled, id required don't use multiple
68-
export const formSelectProps = Object.assign(
68+
export const selectProps = Object.assign(
6969
{}, formGroupSharedProps, props, {
7070
options: Array,
7171
value: [String, Number, Boolean, Array],
@@ -75,7 +75,7 @@ export const formSelectProps = Object.assign(
7575
})
7676

7777
// Html props: id, disabled, required
78-
export const formCheckboxProps = Object.assign(
78+
export const inputCheckboxProps = Object.assign(
7979
{}, formGroupAlwaysSharedProps, universalProps, {
8080
checked: Boolean,
8181
value: {

src/components/Form/index.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import CForm from './CForm'
2-
import CFormInput from './CFormInput'
3-
import CFormCheckbox from './CFormCheckbox'
4-
import CFormFile from './CFormFile'
5-
import CFormTextarea from './CFormTextarea'
6-
import CFormSelect from './CFormSelect'
7-
import CFormRadio from './CFormRadio'
82
import CFormGroup from './CFormGroup'
3+
import CInput from './CInput'
4+
import CInputCheckbox from './CInputCheckbox'
5+
import CInputFile from './CInputFile'
6+
import CInputRadio from './CInputRadio'
7+
import CSelect from './CSelect'
8+
import CTextarea from './CTextarea'
99

1010
export {
1111
CForm,
12-
CFormInput,
13-
CFormCheckbox,
14-
CFormFile,
15-
CFormTextarea,
16-
CFormSelect,
17-
CFormRadio,
18-
CFormGroup
12+
CFormGroup,
13+
CInput,
14+
CInputCheckbox,
15+
CInputFile,
16+
CInputRadio,
17+
CSelect,
18+
CTextarea
1919
}

src/components/Form/tests/CFormInput.spec.js renamed to src/components/Form/tests/CInput.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@vue/test-utils'
2-
import Component from '../CFormInput'
2+
import Component from '../CInput'
33

4-
const ComponentName = 'CFormInput'
4+
const ComponentName = 'CInput'
55
const wrapper = mount(Component, {
66
propsData: {
77
id: 'some_id',

src/components/Form/tests/CFormCheckbox.spec.js renamed to src/components/Form/tests/CInputCheckbox.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@vue/test-utils'
2-
import Component from '../CFormCheckbox'
2+
import Component from '../CInputCheckbox'
33

4-
const ComponentName = 'CFormCheckbox'
4+
const ComponentName = 'CInputCheckbox'
55
const wrapper = mount(Component, {
66
propsData: {
77
label: 'label',

src/components/Form/tests/CFormFile.spec.js renamed to src/components/Form/tests/CInputFile.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@vue/test-utils'
2-
import Component from '../CFormFile'
2+
import Component from '../CInputFile'
33

4-
const ComponentName = 'CFormFile'
4+
const ComponentName = 'CInputFile'
55
const wrapper = mount(Component, {
66
propsData: {
77
label: 'label',

src/components/Form/tests/CFormRadio.spec.js renamed to src/components/Form/tests/CInputRadio.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@vue/test-utils'
2-
import Component from '../CFormRadio'
2+
import Component from '../CInputRadio'
33

4-
const ComponentName = 'CFormRadio'
4+
const ComponentName = 'CInputRadio'
55
const customWrapper = mount(Component, {
66
propsData: {
77
label: 'label',

src/components/Form/tests/CFormSelect.spec.js renamed to src/components/Form/tests/CSelect.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@vue/test-utils'
2-
import Component from '../CFormSelect'
2+
import Component from '../CSelect'
33

4-
const ComponentName = 'CFormSelect'
4+
const ComponentName = 'CSelect'
55
const wrapperPlaintext = mount(Component, {
66
propsData: {
77
id: 'some_id',

src/components/Form/tests/CFormTextarea.spec.js renamed to src/components/Form/tests/CTextarea.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@vue/test-utils'
2-
import Component from '../CFormTextarea'
2+
import Component from '../CTextarea'
33

4-
const ComponentName = 'CFormTextarea'
4+
const ComponentName = 'CTextarea'
55
const wrapper = mount(Component, {
66
propsData: {
77
id: 'some_id',

src/components/Form/tests/__snapshots__/CFormInput.spec.js.snap renamed to src/components/Form/tests/__snapshots__/CInput.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`CFormInput renders correctly 1`] = `
3+
exports[`CInput renders correctly 1`] = `
44
<div
55
class="form-group"
66
role="group"
@@ -25,7 +25,7 @@ exports[`CFormInput renders correctly 1`] = `
2525
</div>
2626
`;
2727

28-
exports[`CFormInput renders correctly 2`] = `
28+
exports[`CInput renders correctly 2`] = `
2929
<div
3030
class="form-group was-validated"
3131
role="group"

src/components/Form/tests/__snapshots__/CFormCheckbox.spec.js.snap renamed to src/components/Form/tests/__snapshots__/CInputCheckbox.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`CFormCheckbox renders correctly 1`] = `
3+
exports[`CInputCheckbox renders correctly 1`] = `
44
<div
55
class="custom-control custom-control-inline custom-checkbox was-validated"
66
role="group"
@@ -46,7 +46,7 @@ exports[`CFormCheckbox renders correctly 1`] = `
4646
</div>
4747
`;
4848

49-
exports[`CFormCheckbox renders correctly basic checkbox 1`] = `
49+
exports[`CInputCheckbox renders correctly basic checkbox 1`] = `
5050
<div
5151
class="form-check"
5252
role="group"

src/components/Form/tests/__snapshots__/CFormFile.spec.js.snap renamed to src/components/Form/tests/__snapshots__/CInputFile.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`CFormFile renders correctly 1`] = `
3+
exports[`CInputFile renders correctly 1`] = `
44
<div
55
class="form-row was-validated"
66
role="group"
@@ -58,7 +58,7 @@ exports[`CFormFile renders correctly 1`] = `
5858
</div>
5959
`;
6060

61-
exports[`CFormFile renders correctly basic functionality 1`] = `
61+
exports[`CInputFile renders correctly basic functionality 1`] = `
6262
<div
6363
class="form-group position-relative"
6464
role="group"

src/components/Form/tests/__snapshots__/CFormRadio.spec.js.snap renamed to src/components/Form/tests/__snapshots__/CInputRadio.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`CFormRadio renders correctly 1`] = `
3+
exports[`CInputRadio renders correctly 1`] = `
44
<div
55
class="custom-control custom-control-inline custom-radio was-validated"
66
role="group"

src/components/Form/tests/__snapshots__/CFormSelect.spec.js.snap renamed to src/components/Form/tests/__snapshots__/CSelect.spec.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`CFormSelect renders correctly 1`] = `
3+
exports[`CSelect renders correctly 1`] = `
44
<div
55
class="form-group"
66
role="group"
@@ -59,7 +59,7 @@ exports[`CFormSelect renders correctly 1`] = `
5959
</div>
6060
`;
6161

62-
exports[`CFormSelect renders correctly 2`] = `
62+
exports[`CSelect renders correctly 2`] = `
6363
<div
6464
class="form-group"
6565
role="group"
@@ -109,7 +109,7 @@ exports[`CFormSelect renders correctly 2`] = `
109109
</div>
110110
`;
111111

112-
exports[`CFormSelect renders correctly 3`] = `
112+
exports[`CSelect renders correctly 3`] = `
113113
<div
114114
class="form-group was-validated"
115115
role="group"

src/components/Form/tests/__snapshots__/CFormTextarea.spec.js.snap renamed to src/components/Form/tests/__snapshots__/CTextarea.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`CFormTextarea renders correctly 1`] = `
3+
exports[`CTextarea renders correctly 1`] = `
44
<div
55
class="form-group"
66
role="group"
@@ -23,7 +23,7 @@ exports[`CFormTextarea renders correctly 1`] = `
2323
</div>
2424
`;
2525

26-
exports[`CFormTextarea renders correctly 2`] = `
26+
exports[`CTextarea renders correctly 2`] = `
2727
<div
2828
class="form-group was-validated"
2929
role="group"

src/components/index.d.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ declare class formSharedProps extends Vue {
174174
description: string
175175
}
176176

177-
export declare class CFormFile extends formSharedProps {
177+
export declare class CInputFile extends formSharedProps {
178178
label: string
179179
wasValidated: boolean
180180
isValid: [boolean, ()=>{}]
@@ -195,9 +195,8 @@ export declare class CFormGroup extends formSharedProps {
195195
wrapperClasses: [string, Array<any>, object]
196196
}
197197

198-
export declare class CFormInput extends formSharedProps {
198+
export declare class CInput extends formSharedProps {
199199
type: string
200-
201200
appendHtml: string
202201
prependHtml: string
203202
readonly: boolean
@@ -214,7 +213,7 @@ export declare class CFormInput extends formSharedProps {
214213
addWrapperClasses: [string, Array<any>, object]
215214
}
216215

217-
export declare class CFormRadio extends formSharedProps {
216+
export declare class CInputRadio extends formSharedProps {
218217
appendHtml: string
219218
prependHtml: string
220219

@@ -230,11 +229,11 @@ export declare class CFormRadio extends formSharedProps {
230229
inline: boolean
231230
}
232231

233-
export declare class CFormCheckbox extends CFormRadio {
232+
export declare class CInputCheckbox extends CInputRadio {
234233
checked: boolean
235234
}
236235

237-
export declare class CFormSelect extends formSharedProps {
236+
export declare class CSelect extends formSharedProps {
238237
appendHtml: string
239238
prependHtml: string
240239

@@ -254,7 +253,7 @@ export declare class CFormSelect extends formSharedProps {
254253
custom: boolean
255254
}
256255

257-
export declare class CFormTextarea extends formSharedProps {
256+
export declare class CTextarea extends formSharedProps {
258257
appendHtml: string
259258
prependHtml: string
260259
readonly: boolean

0 commit comments

Comments
 (0)