classcard-ui 0.2.403 → 0.2.404
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/dist/classcard-ui.common.js +70 -52
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +70 -52
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +1 -1
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +79 -79
- package/src/App.vue +16 -16
- package/src/components/CAlerts/CAlerts.vue +70 -70
- package/src/components/CAlerts/index.js +2 -2
- package/src/components/CAnchorTabs/CAnchorTabs.vue +99 -99
- package/src/components/CAnchorTabs/index.js +2 -2
- package/src/components/CAnchorTag/CAnchorTag.vue +62 -62
- package/src/components/CAnchorTag/index.js +2 -2
- package/src/components/CAvatar/CAvatar.vue +89 -89
- package/src/components/CAvatar/index.js +2 -2
- package/src/components/CAvatarGroup/CAvatarGroup.vue +145 -145
- package/src/components/CAvatarGroup/index.js +2 -2
- package/src/components/CBasicTable/CBasicTable.vue +184 -184
- package/src/components/CBasicTable/index.js +2 -2
- package/src/components/CBreadcrumbs/CBreadcrumbs.vue +38 -38
- package/src/components/CBreadcrumbs/index.js +2 -2
- package/src/components/CButton/CButton.vue +142 -121
- package/src/components/CButton/index.js +2 -2
- package/src/components/CButtonGroup/CButtonGroup.vue +100 -100
- package/src/components/CButtonGroup/index.js +2 -2
- package/src/components/CButtonIcon/CButtonIcon.vue +108 -108
- package/src/components/CButtonIcon/index.js +2 -2
- package/src/components/CButtonLink/CButtonLink.vue +39 -39
- package/src/components/CButtonLink/index.js +2 -2
- package/src/components/CButtonSelect/CButtonSelect.vue +103 -103
- package/src/components/CButtonSelect/index.js +2 -2
- package/src/components/CButtonWithDropdown/CButtonWithDropdown.vue +168 -168
- package/src/components/CButtonWithDropdown/index.js +2 -2
- package/src/components/CCard/CCard.vue +49 -49
- package/src/components/CCard/index.js +2 -2
- package/src/components/CCheckbox/CCheckbox.vue +61 -61
- package/src/components/CCheckbox/index.js +2 -2
- package/src/components/CCollapsibleSection/CCollapsibleSection.vue +99 -99
- package/src/components/CCollapsibleSection/index.js +2 -2
- package/src/components/CColorDots/CColorDots.vue +35 -35
- package/src/components/CColorDots/index.js +3 -3
- package/src/components/CConfirmActionModal/CConfirmActionModal.vue +116 -116
- package/src/components/CConfirmActionModal/index.js +3 -3
- package/src/components/CDatepicker/CDatepicker.vue +134 -134
- package/src/components/CDatepicker/index.js +2 -2
- package/src/components/CDualSelect/CDualSelect.vue +193 -193
- package/src/components/CDualSelect/index.js +2 -2
- package/src/components/CEditor/CEditor.vue +91 -91
- package/src/components/CEditor/index.js +2 -2
- package/src/components/CFormSectionHeading/CFormSectionHeading.vue +52 -52
- package/src/components/CFormSectionHeading/index.js +2 -2
- package/src/components/CGroupedSelect/CGroupedSelect.vue +212 -212
- package/src/components/CGroupedSelect/index.js +3 -3
- package/src/components/CIcon/CIcon.vue +72 -72
- package/src/components/CIcon/index.js +2 -2
- package/src/components/CIconDropdown/CIconDropdown.vue +94 -94
- package/src/components/CIconDropdown/index.js +2 -2
- package/src/components/CInput/CInput.vue +110 -110
- package/src/components/CInput/index.js +2 -2
- package/src/components/CInputAddon/CInputAddon.vue +199 -199
- package/src/components/CInputAddon/index.js +2 -2
- package/src/components/CInputEmail/CInputEmail.vue +84 -84
- package/src/components/CInputEmail/index.js +2 -2
- package/src/components/CModalHeading/CModalHeading.vue +22 -22
- package/src/components/CModalHeading/index.js +2 -2
- package/src/components/CModuleHelpLinks/CModuleHelpLinks.vue +39 -39
- package/src/components/CModuleHelpLinks/index.js +3 -3
- package/src/components/CMultiselect/CMultiselect.vue +318 -318
- package/src/components/CMultiselect/index.js +2 -2
- package/src/components/CMultiselectr/CMultiselectr.vue +44 -44
- package/src/components/CMultiselectr/index.js +2 -2
- package/src/components/CPageHeading/CPageHeading.vue +52 -52
- package/src/components/CPageHeading/index.js +2 -2
- package/src/components/CPagination/CPagination.vue +202 -202
- package/src/components/CPagination/index.js +2 -2
- package/src/components/CPhoneNumber/CPhoneNumber.vue +62 -62
- package/src/components/CPhoneNumber/index.js +2 -2
- package/src/components/CRadio/CRadio.vue +70 -70
- package/src/components/CRadio/index.js +2 -2
- package/src/components/CRangeSlider/CRangeSlider.vue +55 -55
- package/src/components/CRangeSlider/index.js +2 -2
- package/src/components/CReorderableStackedList/CReorderableStackedList.vue +89 -89
- package/src/components/CReorderableStackedList/index.js +2 -2
- package/src/components/CSelect/CSelect.vue +271 -271
- package/src/components/CSelect/index.js +2 -2
- package/src/components/CSmallTimeline/CSmallTimeline.vue +40 -40
- package/src/components/CSmallTimeline/index.js +2 -2
- package/src/components/CStackedList/CStackedList.vue +87 -87
- package/src/components/CStackedList/index.js +2 -2
- package/src/components/CStats/CStats.vue +88 -88
- package/src/components/CStats/index.js +2 -2
- package/src/components/CSwitch/CSwitch.vue +132 -132
- package/src/components/CSwitch/index.js +2 -2
- package/src/components/CTable/CTable.vue +486 -486
- package/src/components/CTable/index.js +2 -2
- package/src/components/CTabs/CTabs.vue +109 -109
- package/src/components/CTabs/index.js +2 -2
- package/src/components/CTag/CTag.vue +36 -36
- package/src/components/CTag/index.js +2 -2
- package/src/components/CTextarea/CTextarea.vue +85 -85
- package/src/components/CTextarea/index.js +2 -2
- package/src/components/CTimeline/CTimeline.vue +237 -237
- package/src/components/CTimeline/index.js +2 -2
- package/src/components/CUpload/CUpload.vue +147 -147
- package/src/components/CUpload/index.js +2 -2
- package/src/components/index.js +47 -47
- package/src/icons.js +231 -231
- package/src/main.js +17 -17
- package/src/stories/CAlerts.stories.js +37 -37
- package/src/stories/CAnchorTabs.stories.js +29 -29
- package/src/stories/CAnchorTag.stories.js +36 -36
- package/src/stories/CAvatar.stories.js +38 -38
- package/src/stories/CAvatarGroup.stories.js +100 -100
- package/src/stories/CBasicTable.stories.js +316 -316
- package/src/stories/CBreadcrumbs.stories.js +24 -24
- package/src/stories/CButton.stories.js +46 -46
- package/src/stories/CButtonGroup.stories.js +33 -33
- package/src/stories/CButtonIcon.stories.js +27 -27
- package/src/stories/CButtonLink.stories.js +24 -24
- package/src/stories/CButtonSelect.stories.js +32 -32
- package/src/stories/CButtonWithDropdown.stories.js +41 -41
- package/src/stories/CCard.stories.js +30 -30
- package/src/stories/CCheckbox.stories.js +29 -29
- package/src/stories/CCollapsibleSection.stories.js +28 -28
- package/src/stories/CColorDots.stories.js +28 -28
- package/src/stories/CConfirmActionModal.stories.js +59 -59
- package/src/stories/CDatepicker.stories.js +30 -30
- package/src/stories/CDualSelect.stories.js +29 -29
- package/src/stories/CEditor.stories.js +30 -30
- package/src/stories/CFormSectionHeading.stories.js +34 -34
- package/src/stories/CGroupedSelect.stories.js +69 -69
- package/src/stories/CIcon.stories.js +26 -26
- package/src/stories/CIconDropdown.stories.js +39 -39
- package/src/stories/CInput.stories.js +36 -36
- package/src/stories/CInputAddon.stories.js +37 -37
- package/src/stories/CInputEmail.stories.js +27 -27
- package/src/stories/CModalHeading.stories.js +25 -25
- package/src/stories/CModuleHelpLinks.stories.js +25 -25
- package/src/stories/CMultiselect.stories.js +97 -97
- package/src/stories/CMultiselectr.stories.js +23 -23
- package/src/stories/CPageHeading.stories.js +32 -32
- package/src/stories/CPagination.stories.js +30 -30
- package/src/stories/CPhoneNumber.stories.js +29 -29
- package/src/stories/CRadio.stories.js +36 -36
- package/src/stories/CRangeSlider.stories.js +23 -23
- package/src/stories/CReorderableStackedList.stories.js +23 -23
- package/src/stories/CSelect.stories.js +50 -50
- package/src/stories/CSmallTimeline.stories.js +26 -26
- package/src/stories/CStackedList.stories.js +37 -37
- package/src/stories/CStats.stories.js +33 -33
- package/src/stories/CSwitch.stories.js +28 -28
- package/src/stories/CTable.stories.js +77 -77
- package/src/stories/CTabs.stories.js +29 -29
- package/src/stories/CTag.stories.js +23 -23
- package/src/stories/CTextarea.stories.js +32 -32
- package/src/stories/CTimeline.stories.js +26 -26
- package/src/stories/CUpload.stories.js +36 -36
- package/src/stories/Introduction.stories.mdx +207 -207
- package/src/stories/Page.vue +88 -88
- package/src/stories/assets/code-brackets.svg +0 -0
- package/src/stories/assets/colors.svg +0 -0
- package/src/stories/assets/comments.svg +0 -0
- package/src/stories/assets/direction.svg +0 -0
- package/src/stories/assets/flow.svg +0 -0
- package/src/stories/assets/plugin.svg +0 -0
- package/src/stories/assets/repo.svg +0 -0
- package/src/stories/assets/stackalt.svg +0 -0
- package/src/stories/header.css +26 -26
- package/src/stories/page.css +69 -69
- package/src/stories/utils.css +17 -17
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<slot></slot>
|
|
4
|
-
<div class="relative inline-block text-left">
|
|
5
|
-
<div>
|
|
6
|
-
<button
|
|
7
|
-
type="white"
|
|
8
|
-
@click.stop="toggleDropdown = !toggleDropdown"
|
|
9
|
-
@blur="close()"
|
|
10
|
-
class="inline-flex w-full justify-center rounded-full border-none p-2 focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2"
|
|
11
|
-
aria-haspopup="true"
|
|
12
|
-
aria-expanded="true"
|
|
13
|
-
>
|
|
14
|
-
<c-icon
|
|
15
|
-
:name="icon.name"
|
|
16
|
-
:type="icon.type"
|
|
17
|
-
:class="icon.class"
|
|
18
|
-
></c-icon>
|
|
19
|
-
</button>
|
|
20
|
-
</div>
|
|
21
|
-
<div
|
|
22
|
-
v-show="toggleDropdown"
|
|
23
|
-
:class="classes"
|
|
24
|
-
class="absolute z-10 mt-2 -mr-1 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-gray-900 ring-opacity-5"
|
|
25
|
-
>
|
|
26
|
-
<div
|
|
27
|
-
class="w-max py-2"
|
|
28
|
-
role="menu"
|
|
29
|
-
aria-orientation="vertical"
|
|
30
|
-
aria-labelledby="option-menu"
|
|
31
|
-
>
|
|
32
|
-
<a
|
|
33
|
-
v-for="(item, index) in items"
|
|
34
|
-
v-bind:key="item.text"
|
|
35
|
-
@mousedown.stop.prevent="dropdownAction(item)"
|
|
36
|
-
class="flex cursor-pointer px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 disabled:pointer-events-none disabled:opacity-50"
|
|
37
|
-
:class="item.class"
|
|
38
|
-
role="menuitem"
|
|
39
|
-
:disabled="item.disabled"
|
|
40
|
-
>
|
|
41
|
-
<c-icon
|
|
42
|
-
v-if="item.icon"
|
|
43
|
-
:name="dropdownIcons[index].name"
|
|
44
|
-
:type="dropdownIcons[index].type"
|
|
45
|
-
:class="dropdownIcons[index].class"
|
|
46
|
-
></c-icon>
|
|
47
|
-
{{ item.text }}
|
|
48
|
-
</a>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<script>
|
|
56
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
57
|
-
export default {
|
|
58
|
-
name: "CIconDropdown",
|
|
59
|
-
components: { CIcon },
|
|
60
|
-
props: {
|
|
61
|
-
items: {
|
|
62
|
-
type: Array,
|
|
63
|
-
required: true,
|
|
64
|
-
},
|
|
65
|
-
icon: {
|
|
66
|
-
type: Object,
|
|
67
|
-
},
|
|
68
|
-
dropdownIcons: {
|
|
69
|
-
type: Array,
|
|
70
|
-
},
|
|
71
|
-
classes: {
|
|
72
|
-
type: String,
|
|
73
|
-
},
|
|
74
|
-
action: {
|
|
75
|
-
type: Function,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
data() {
|
|
79
|
-
return {
|
|
80
|
-
toggleDropdown: false,
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
methods: {
|
|
84
|
-
dropdownAction(item) {
|
|
85
|
-
this.$emit("action", item);
|
|
86
|
-
},
|
|
87
|
-
close() {
|
|
88
|
-
this.toggleDropdown = false;
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
</script>
|
|
93
|
-
|
|
94
|
-
<style></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<div class="relative inline-block text-left">
|
|
5
|
+
<div>
|
|
6
|
+
<button
|
|
7
|
+
type="white"
|
|
8
|
+
@click.stop="toggleDropdown = !toggleDropdown"
|
|
9
|
+
@blur="close()"
|
|
10
|
+
class="inline-flex w-full justify-center rounded-full border-none p-2 focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2"
|
|
11
|
+
aria-haspopup="true"
|
|
12
|
+
aria-expanded="true"
|
|
13
|
+
>
|
|
14
|
+
<c-icon
|
|
15
|
+
:name="icon.name"
|
|
16
|
+
:type="icon.type"
|
|
17
|
+
:class="icon.class"
|
|
18
|
+
></c-icon>
|
|
19
|
+
</button>
|
|
20
|
+
</div>
|
|
21
|
+
<div
|
|
22
|
+
v-show="toggleDropdown"
|
|
23
|
+
:class="classes"
|
|
24
|
+
class="absolute z-10 mt-2 -mr-1 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-gray-900 ring-opacity-5"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
class="w-max py-2"
|
|
28
|
+
role="menu"
|
|
29
|
+
aria-orientation="vertical"
|
|
30
|
+
aria-labelledby="option-menu"
|
|
31
|
+
>
|
|
32
|
+
<a
|
|
33
|
+
v-for="(item, index) in items"
|
|
34
|
+
v-bind:key="item.text"
|
|
35
|
+
@mousedown.stop.prevent="dropdownAction(item)"
|
|
36
|
+
class="flex cursor-pointer px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 disabled:pointer-events-none disabled:opacity-50"
|
|
37
|
+
:class="item.class"
|
|
38
|
+
role="menuitem"
|
|
39
|
+
:disabled="item.disabled"
|
|
40
|
+
>
|
|
41
|
+
<c-icon
|
|
42
|
+
v-if="item.icon"
|
|
43
|
+
:name="dropdownIcons[index].name"
|
|
44
|
+
:type="dropdownIcons[index].type"
|
|
45
|
+
:class="dropdownIcons[index].class"
|
|
46
|
+
></c-icon>
|
|
47
|
+
{{ item.text }}
|
|
48
|
+
</a>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
57
|
+
export default {
|
|
58
|
+
name: "CIconDropdown",
|
|
59
|
+
components: { CIcon },
|
|
60
|
+
props: {
|
|
61
|
+
items: {
|
|
62
|
+
type: Array,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
icon: {
|
|
66
|
+
type: Object,
|
|
67
|
+
},
|
|
68
|
+
dropdownIcons: {
|
|
69
|
+
type: Array,
|
|
70
|
+
},
|
|
71
|
+
classes: {
|
|
72
|
+
type: String,
|
|
73
|
+
},
|
|
74
|
+
action: {
|
|
75
|
+
type: Function,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
data() {
|
|
79
|
+
return {
|
|
80
|
+
toggleDropdown: false,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
methods: {
|
|
84
|
+
dropdownAction(item) {
|
|
85
|
+
this.$emit("action", item);
|
|
86
|
+
},
|
|
87
|
+
close() {
|
|
88
|
+
this.toggleDropdown = false;
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<style></style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CIconDropdown from './CIconDropdown.vue'
|
|
2
|
-
|
|
1
|
+
import CIconDropdown from './CIconDropdown.vue'
|
|
2
|
+
|
|
3
3
|
export default CIconDropdown
|
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="flex justify-between">
|
|
4
|
-
<div class="flex items-center">
|
|
5
|
-
<!-- label of input field -->
|
|
6
|
-
<label class="block text-sm font-medium text-gray-900">
|
|
7
|
-
{{ label }}
|
|
8
|
-
</label>
|
|
9
|
-
<!-- asterisk sign to render if field is required -->
|
|
10
|
-
<p v-if="isRequired" class="text-red-600 ml-1">*</p>
|
|
11
|
-
</div>
|
|
12
|
-
<!-- hint on the right side of input field -->
|
|
13
|
-
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="relative mt-1 rounded-md">
|
|
16
|
-
<input
|
|
17
|
-
:type="type"
|
|
18
|
-
:value="inputValue"
|
|
19
|
-
@input="$emit('input', $event.target.value)"
|
|
20
|
-
@blur="$emit('blur', $event.target.value)"
|
|
21
|
-
@focus="$emit('focus', $event.target.value)"
|
|
22
|
-
:class="errorClasses"
|
|
23
|
-
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full px-3 py-2 rounded-md sm:text-sm disabled:opacity-50 text-gray-900"
|
|
24
|
-
:placeholder="placeholder"
|
|
25
|
-
:disabled="disabled"
|
|
26
|
-
/>
|
|
27
|
-
<!-- to render to show validation is failed -->
|
|
28
|
-
<div
|
|
29
|
-
v-if="!isValidate"
|
|
30
|
-
class="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-red-600"
|
|
31
|
-
>
|
|
32
|
-
<c-icon name="exclamation-circle" type="solid" class="h-5 w-5"></c-icon>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
<!-- validation error message -->
|
|
36
|
-
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
37
|
-
{{ errorMessage }}
|
|
38
|
-
</p>
|
|
39
|
-
<!-- description about the input field -->
|
|
40
|
-
<p v-if="helpText && isValidate == true" class="mt-2 text-sm text-gray-500">
|
|
41
|
-
{{ helpText }}
|
|
42
|
-
</p>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script>
|
|
47
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
48
|
-
export default {
|
|
49
|
-
name: "CInput",
|
|
50
|
-
components: { CIcon },
|
|
51
|
-
props: {
|
|
52
|
-
// Label of input field
|
|
53
|
-
label: {
|
|
54
|
-
type: String,
|
|
55
|
-
},
|
|
56
|
-
// placeholder of input
|
|
57
|
-
placeholder: {
|
|
58
|
-
type: String,
|
|
59
|
-
},
|
|
60
|
-
// v-model of the field
|
|
61
|
-
value: {
|
|
62
|
-
type: String,
|
|
63
|
-
},
|
|
64
|
-
// hint on right side of input
|
|
65
|
-
hint: { type: String },
|
|
66
|
-
// description about the field
|
|
67
|
-
helpText: {
|
|
68
|
-
type: String,
|
|
69
|
-
},
|
|
70
|
-
// validation is passed or not
|
|
71
|
-
isValidate: { type: Boolean },
|
|
72
|
-
// validation error message
|
|
73
|
-
errorMessage: {
|
|
74
|
-
type: String,
|
|
75
|
-
},
|
|
76
|
-
// to disable the input field
|
|
77
|
-
disabled: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
},
|
|
80
|
-
// whether the input field is mandatory or not
|
|
81
|
-
isRequired: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
},
|
|
84
|
-
// type of input field
|
|
85
|
-
type: {
|
|
86
|
-
type: String,
|
|
87
|
-
default: "text",
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
computed: {
|
|
91
|
-
errorClasses() {
|
|
92
|
-
return {
|
|
93
|
-
"border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":
|
|
94
|
-
this.isValidate == false,
|
|
95
|
-
"border-gray-300": this.isValidate == true,
|
|
96
|
-
};
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
data() {
|
|
100
|
-
return {
|
|
101
|
-
inputValue: this.value,
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
watch: {
|
|
105
|
-
value() {
|
|
106
|
-
this.inputValue = this.value;
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="flex justify-between">
|
|
4
|
+
<div class="flex items-center">
|
|
5
|
+
<!-- label of input field -->
|
|
6
|
+
<label class="block text-sm font-medium text-gray-900">
|
|
7
|
+
{{ label }}
|
|
8
|
+
</label>
|
|
9
|
+
<!-- asterisk sign to render if field is required -->
|
|
10
|
+
<p v-if="isRequired" class="text-red-600 ml-1">*</p>
|
|
11
|
+
</div>
|
|
12
|
+
<!-- hint on the right side of input field -->
|
|
13
|
+
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="relative mt-1 rounded-md">
|
|
16
|
+
<input
|
|
17
|
+
:type="type"
|
|
18
|
+
:value="inputValue"
|
|
19
|
+
@input="$emit('input', $event.target.value)"
|
|
20
|
+
@blur="$emit('blur', $event.target.value)"
|
|
21
|
+
@focus="$emit('focus', $event.target.value)"
|
|
22
|
+
:class="errorClasses"
|
|
23
|
+
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full px-3 py-2 rounded-md sm:text-sm disabled:opacity-50 text-gray-900"
|
|
24
|
+
:placeholder="placeholder"
|
|
25
|
+
:disabled="disabled"
|
|
26
|
+
/>
|
|
27
|
+
<!-- to render to show validation is failed -->
|
|
28
|
+
<div
|
|
29
|
+
v-if="!isValidate"
|
|
30
|
+
class="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-red-600"
|
|
31
|
+
>
|
|
32
|
+
<c-icon name="exclamation-circle" type="solid" class="h-5 w-5"></c-icon>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<!-- validation error message -->
|
|
36
|
+
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
37
|
+
{{ errorMessage }}
|
|
38
|
+
</p>
|
|
39
|
+
<!-- description about the input field -->
|
|
40
|
+
<p v-if="helpText && isValidate == true" class="mt-2 text-sm text-gray-500">
|
|
41
|
+
{{ helpText }}
|
|
42
|
+
</p>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
48
|
+
export default {
|
|
49
|
+
name: "CInput",
|
|
50
|
+
components: { CIcon },
|
|
51
|
+
props: {
|
|
52
|
+
// Label of input field
|
|
53
|
+
label: {
|
|
54
|
+
type: String,
|
|
55
|
+
},
|
|
56
|
+
// placeholder of input
|
|
57
|
+
placeholder: {
|
|
58
|
+
type: String,
|
|
59
|
+
},
|
|
60
|
+
// v-model of the field
|
|
61
|
+
value: {
|
|
62
|
+
type: String,
|
|
63
|
+
},
|
|
64
|
+
// hint on right side of input
|
|
65
|
+
hint: { type: String },
|
|
66
|
+
// description about the field
|
|
67
|
+
helpText: {
|
|
68
|
+
type: String,
|
|
69
|
+
},
|
|
70
|
+
// validation is passed or not
|
|
71
|
+
isValidate: { type: Boolean },
|
|
72
|
+
// validation error message
|
|
73
|
+
errorMessage: {
|
|
74
|
+
type: String,
|
|
75
|
+
},
|
|
76
|
+
// to disable the input field
|
|
77
|
+
disabled: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
},
|
|
80
|
+
// whether the input field is mandatory or not
|
|
81
|
+
isRequired: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
},
|
|
84
|
+
// type of input field
|
|
85
|
+
type: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: "text",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
computed: {
|
|
91
|
+
errorClasses() {
|
|
92
|
+
return {
|
|
93
|
+
"border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":
|
|
94
|
+
this.isValidate == false,
|
|
95
|
+
"border-gray-300": this.isValidate == true,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
data() {
|
|
100
|
+
return {
|
|
101
|
+
inputValue: this.value,
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
watch: {
|
|
105
|
+
value() {
|
|
106
|
+
this.inputValue = this.value;
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
</script>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CInput from './CInput.vue'
|
|
2
|
-
|
|
1
|
+
import CInput from './CInput.vue'
|
|
2
|
+
|
|
3
3
|
export default CInput
|