classcard-ui 0.2.387 → 0.2.390

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.
Files changed (173) hide show
  1. package/README.md +24 -24
  2. package/dist/classcard-ui.common.js +101 -61
  3. package/dist/classcard-ui.common.js.map +1 -1
  4. package/dist/classcard-ui.css +1 -1
  5. package/dist/classcard-ui.umd.js +101 -61
  6. package/dist/classcard-ui.umd.js.map +1 -1
  7. package/dist/classcard-ui.umd.min.js +1 -1
  8. package/dist/classcard-ui.umd.min.js.map +1 -1
  9. package/package.json +79 -79
  10. package/src/App.vue +16 -16
  11. package/src/components/CAlerts/CAlerts.vue +70 -70
  12. package/src/components/CAlerts/index.js +2 -2
  13. package/src/components/CAnchorTabs/CAnchorTabs.vue +98 -98
  14. package/src/components/CAnchorTabs/index.js +2 -2
  15. package/src/components/CAnchorTag/CAnchorTag.vue +62 -62
  16. package/src/components/CAnchorTag/index.js +2 -2
  17. package/src/components/CAvatar/CAvatar.vue +89 -89
  18. package/src/components/CAvatar/index.js +2 -2
  19. package/src/components/CAvatarGroup/CAvatarGroup.vue +145 -145
  20. package/src/components/CAvatarGroup/index.js +2 -2
  21. package/src/components/CBasicTable/CBasicTable.vue +184 -184
  22. package/src/components/CBasicTable/index.js +2 -2
  23. package/src/components/CBreadcrumbs/CBreadcrumbs.vue +38 -38
  24. package/src/components/CBreadcrumbs/index.js +2 -2
  25. package/src/components/CButton/CButton.vue +121 -121
  26. package/src/components/CButton/index.js +2 -2
  27. package/src/components/CButtonGroup/CButtonGroup.vue +100 -100
  28. package/src/components/CButtonGroup/index.js +2 -2
  29. package/src/components/CButtonIcon/CButtonIcon.vue +82 -82
  30. package/src/components/CButtonIcon/index.js +2 -2
  31. package/src/components/CButtonLink/CButtonLink.vue +39 -39
  32. package/src/components/CButtonLink/index.js +2 -2
  33. package/src/components/CButtonSelect/CButtonSelect.vue +103 -103
  34. package/src/components/CButtonSelect/index.js +2 -2
  35. package/src/components/CButtonWithDropdown/CButtonWithDropdown.vue +168 -168
  36. package/src/components/CButtonWithDropdown/index.js +2 -2
  37. package/src/components/CCard/CCard.vue +49 -49
  38. package/src/components/CCard/index.js +2 -2
  39. package/src/components/CCheckbox/CCheckbox.vue +61 -61
  40. package/src/components/CCheckbox/index.js +2 -2
  41. package/src/components/CCollapsibleSection/CCollapsibleSection.vue +99 -99
  42. package/src/components/CCollapsibleSection/index.js +2 -2
  43. package/src/components/CColorDots/CColorDots.vue +35 -35
  44. package/src/components/CColorDots/index.js +3 -3
  45. package/src/components/CConfirmActionModal/CConfirmActionModal.vue +116 -116
  46. package/src/components/CConfirmActionModal/index.js +3 -3
  47. package/src/components/CDatepicker/CDatepicker.vue +134 -134
  48. package/src/components/CDatepicker/index.js +2 -2
  49. package/src/components/CDualSelect/CDualSelect.vue +193 -193
  50. package/src/components/CDualSelect/index.js +2 -2
  51. package/src/components/CEditor/CEditor.vue +91 -91
  52. package/src/components/CEditor/index.js +2 -2
  53. package/src/components/CFormSectionHeading/CFormSectionHeading.vue +52 -52
  54. package/src/components/CFormSectionHeading/index.js +2 -2
  55. package/src/components/CGroupedSelect/CGroupedSelect.vue +212 -212
  56. package/src/components/CGroupedSelect/index.js +3 -3
  57. package/src/components/CIcon/CIcon.vue +70 -70
  58. package/src/components/CIcon/index.js +2 -2
  59. package/src/components/CIconDropdown/CIconDropdown.vue +90 -90
  60. package/src/components/CIconDropdown/index.js +2 -2
  61. package/src/components/CInput/CInput.vue +110 -110
  62. package/src/components/CInput/index.js +2 -2
  63. package/src/components/CInputAddon/CInputAddon.vue +199 -199
  64. package/src/components/CInputAddon/index.js +2 -2
  65. package/src/components/CInputEmail/CInputEmail.vue +84 -84
  66. package/src/components/CInputEmail/index.js +2 -2
  67. package/src/components/CModalHeading/CModalHeading.vue +22 -22
  68. package/src/components/CModalHeading/index.js +2 -2
  69. package/src/components/CModuleHelpLinks/CModuleHelpLinks.vue +39 -39
  70. package/src/components/CModuleHelpLinks/index.js +3 -3
  71. package/src/components/CMultiselect/CMultiselect.vue +318 -276
  72. package/src/components/CMultiselect/index.js +2 -2
  73. package/src/components/CMultiselectr/CMultiselectr.vue +44 -44
  74. package/src/components/CMultiselectr/index.js +2 -2
  75. package/src/components/CPageHeading/CPageHeading.vue +52 -52
  76. package/src/components/CPageHeading/index.js +2 -2
  77. package/src/components/CPagination/CPagination.vue +192 -192
  78. package/src/components/CPagination/index.js +2 -2
  79. package/src/components/CPhoneNumber/CPhoneNumber.vue +62 -62
  80. package/src/components/CPhoneNumber/index.js +2 -2
  81. package/src/components/CRadio/CRadio.vue +70 -70
  82. package/src/components/CRadio/index.js +2 -2
  83. package/src/components/CRangeSlider/CRangeSlider.vue +55 -55
  84. package/src/components/CRangeSlider/index.js +2 -2
  85. package/src/components/CReorderableStackedList/CReorderableStackedList.vue +89 -89
  86. package/src/components/CReorderableStackedList/index.js +2 -2
  87. package/src/components/CSelect/CSelect.vue +271 -271
  88. package/src/components/CSelect/index.js +2 -2
  89. package/src/components/CSmallTimeline/CSmallTimeline.vue +40 -40
  90. package/src/components/CSmallTimeline/index.js +2 -2
  91. package/src/components/CStackedList/CStackedList.vue +77 -77
  92. package/src/components/CStackedList/index.js +2 -2
  93. package/src/components/CStats/CStats.vue +88 -88
  94. package/src/components/CStats/index.js +2 -2
  95. package/src/components/CSwitch/CSwitch.vue +132 -132
  96. package/src/components/CSwitch/index.js +2 -2
  97. package/src/components/CTable/CTable.vue +448 -448
  98. package/src/components/CTable/index.js +2 -2
  99. package/src/components/CTabs/CTabs.vue +109 -109
  100. package/src/components/CTabs/index.js +2 -2
  101. package/src/components/CTag/CTag.vue +36 -36
  102. package/src/components/CTag/index.js +2 -2
  103. package/src/components/CTextarea/CTextarea.vue +85 -85
  104. package/src/components/CTextarea/index.js +2 -2
  105. package/src/components/CTimeline/CTimeline.vue +237 -237
  106. package/src/components/CTimeline/index.js +2 -2
  107. package/src/components/CUpload/CUpload.vue +122 -122
  108. package/src/components/CUpload/index.js +2 -2
  109. package/src/components/index.js +47 -47
  110. package/src/icons.js +231 -231
  111. package/src/main.js +17 -17
  112. package/src/stories/CAlerts.stories.js +37 -37
  113. package/src/stories/CAnchorTabs.stories.js +29 -29
  114. package/src/stories/CAnchorTag.stories.js +36 -36
  115. package/src/stories/CAvatar.stories.js +38 -38
  116. package/src/stories/CAvatarGroup.stories.js +100 -100
  117. package/src/stories/CBasicTable.stories.js +316 -316
  118. package/src/stories/CBreadcrumbs.stories.js +24 -24
  119. package/src/stories/CButton.stories.js +46 -46
  120. package/src/stories/CButtonGroup.stories.js +33 -33
  121. package/src/stories/CButtonIcon.stories.js +27 -27
  122. package/src/stories/CButtonLink.stories.js +24 -24
  123. package/src/stories/CButtonSelect.stories.js +32 -32
  124. package/src/stories/CButtonWithDropdown.stories.js +41 -41
  125. package/src/stories/CCard.stories.js +30 -30
  126. package/src/stories/CCheckbox.stories.js +29 -29
  127. package/src/stories/CCollapsibleSection.stories.js +28 -28
  128. package/src/stories/CColorDots.stories.js +28 -28
  129. package/src/stories/CConfirmActionModal.stories.js +59 -59
  130. package/src/stories/CDatepicker.stories.js +30 -30
  131. package/src/stories/CDualSelect.stories.js +29 -29
  132. package/src/stories/CEditor.stories.js +30 -30
  133. package/src/stories/CFormSectionHeading.stories.js +34 -34
  134. package/src/stories/CGroupedSelect.stories.js +69 -69
  135. package/src/stories/CIcon.stories.js +26 -26
  136. package/src/stories/CIconDropdown.stories.js +39 -39
  137. package/src/stories/CInput.stories.js +36 -36
  138. package/src/stories/CInputAddon.stories.js +37 -37
  139. package/src/stories/CInputEmail.stories.js +27 -27
  140. package/src/stories/CModalHeading.stories.js +25 -25
  141. package/src/stories/CModuleHelpLinks.stories.js +25 -25
  142. package/src/stories/CMultiselect.stories.js +97 -97
  143. package/src/stories/CMultiselectr.stories.js +23 -23
  144. package/src/stories/CPageHeading.stories.js +32 -32
  145. package/src/stories/CPagination.stories.js +30 -30
  146. package/src/stories/CPhoneNumber.stories.js +29 -29
  147. package/src/stories/CRadio.stories.js +36 -36
  148. package/src/stories/CRangeSlider.stories.js +23 -23
  149. package/src/stories/CReorderableStackedList.stories.js +23 -23
  150. package/src/stories/CSelect.stories.js +50 -50
  151. package/src/stories/CSmallTimeline.stories.js +26 -26
  152. package/src/stories/CStackedList.stories.js +25 -25
  153. package/src/stories/CStats.stories.js +33 -33
  154. package/src/stories/CSwitch.stories.js +28 -28
  155. package/src/stories/CTable.stories.js +77 -77
  156. package/src/stories/CTabs.stories.js +29 -29
  157. package/src/stories/CTag.stories.js +23 -23
  158. package/src/stories/CTextarea.stories.js +32 -32
  159. package/src/stories/CTimeline.stories.js +26 -26
  160. package/src/stories/CUpload.stories.js +36 -36
  161. package/src/stories/Introduction.stories.mdx +207 -207
  162. package/src/stories/Page.vue +88 -88
  163. package/src/stories/assets/code-brackets.svg +0 -0
  164. package/src/stories/assets/colors.svg +0 -0
  165. package/src/stories/assets/comments.svg +0 -0
  166. package/src/stories/assets/direction.svg +0 -0
  167. package/src/stories/assets/flow.svg +0 -0
  168. package/src/stories/assets/plugin.svg +0 -0
  169. package/src/stories/assets/repo.svg +0 -0
  170. package/src/stories/assets/stackalt.svg +0 -0
  171. package/src/stories/header.css +26 -26
  172. package/src/stories/page.css +69 -69
  173. package/src/stories/utils.css +17 -17
@@ -1,70 +1,70 @@
1
- <template>
2
- <div>
3
- <svg
4
- v-if="name == 'loader'"
5
- :class="classes"
6
- class="animate-spin"
7
- xmlns="http://www.w3.org/2000/svg"
8
- fill="none"
9
- viewBox="0 0 24 24"
10
- >
11
- <circle
12
- class="opacity-25"
13
- cx="12"
14
- cy="12"
15
- r="10"
16
- stroke="currentColor"
17
- stroke-width="4"
18
- ></circle>
19
- <path class="opacity-75" fill="currentColor" :d="path"></path>
20
- </svg>
21
- <svg
22
- v-if="name !== 'loader' && type == 'solid'"
23
- :class="classes"
24
- class="cursor-pointer"
25
- :viewBox="viewBox"
26
- fill="currentColor"
27
- fill-rule="evenodd"
28
- >
29
- <path :d="path" />
30
- </svg>
31
- <svg
32
- v-if="name !== 'loader' && type == 'outline'"
33
- fill="none"
34
- viewBox="0 0 24 24"
35
- stroke="currentColor"
36
- :class="classes"
37
- class="cursor-pointer"
38
- >
39
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" :d="path" />
40
- </svg>
41
- </div>
42
- </template>
43
-
44
- <script>
45
- import icons from "../../icons.js";
46
- export default {
47
- name: "CIcon",
48
- props: {
49
- name: {
50
- type: String,
51
- required: true,
52
- },
53
- classes: {
54
- type: String,
55
- },
56
- type: {
57
- type: String,
58
- },
59
- viewBox: {
60
- type: String,
61
- default: "0 0 20 20",
62
- },
63
- },
64
- computed: {
65
- path() {
66
- return icons[this.name];
67
- },
68
- },
69
- };
70
- </script>
1
+ <template>
2
+ <div>
3
+ <svg
4
+ v-if="name == 'loader'"
5
+ :class="classes"
6
+ class="animate-spin"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ fill="none"
9
+ viewBox="0 0 24 24"
10
+ >
11
+ <circle
12
+ class="opacity-25"
13
+ cx="12"
14
+ cy="12"
15
+ r="10"
16
+ stroke="currentColor"
17
+ stroke-width="4"
18
+ ></circle>
19
+ <path class="opacity-75" fill="currentColor" :d="path"></path>
20
+ </svg>
21
+ <svg
22
+ v-if="name !== 'loader' && type == 'solid'"
23
+ :class="classes"
24
+ class="cursor-pointer"
25
+ :viewBox="viewBox"
26
+ fill="currentColor"
27
+ fill-rule="evenodd"
28
+ >
29
+ <path :d="path" />
30
+ </svg>
31
+ <svg
32
+ v-if="name !== 'loader' && type == 'outline'"
33
+ fill="none"
34
+ viewBox="0 0 24 24"
35
+ stroke="currentColor"
36
+ :class="classes"
37
+ class="cursor-pointer"
38
+ >
39
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" :d="path" />
40
+ </svg>
41
+ </div>
42
+ </template>
43
+
44
+ <script>
45
+ import icons from "../../icons.js";
46
+ export default {
47
+ name: "CIcon",
48
+ props: {
49
+ name: {
50
+ type: String,
51
+ required: true,
52
+ },
53
+ classes: {
54
+ type: String,
55
+ },
56
+ type: {
57
+ type: String,
58
+ },
59
+ viewBox: {
60
+ type: String,
61
+ default: "0 0 20 20",
62
+ },
63
+ },
64
+ computed: {
65
+ path() {
66
+ return icons[this.name];
67
+ },
68
+ },
69
+ };
70
+ </script>
@@ -1,3 +1,3 @@
1
- import CIcon from './CIcon.vue'
2
-
1
+ import CIcon from './CIcon.vue'
2
+
3
3
  export default CIcon
@@ -1,90 +1,90 @@
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="focus:outline-none inline-flex w-full justify-center rounded-full border-none p-2 focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2"
11
- aria-haspopup="true"
12
- aria-expanded="true"
13
- >
14
- <c-icon :name="icon.name" :type="icon.type" :class="icon.class"></c-icon>
15
- </button>
16
- </div>
17
- <div
18
- v-show="toggleDropdown"
19
- :class="classes"
20
- 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"
21
- >
22
- <div
23
- class="w-max py-2"
24
- role="menu"
25
- aria-orientation="vertical"
26
- aria-labelledby="option-menu"
27
- >
28
- <a
29
- v-for="(item, index) in items"
30
- v-bind:key="item.text"
31
- @mousedown.stop.prevent="dropdownAction(item)"
32
- 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"
33
- :class="item.class"
34
- role="menuitem"
35
- :disabled="item.disabled"
36
- >
37
- <c-icon
38
- v-if="item.icon"
39
- :name="dropdownIcons[index].name"
40
- :type="dropdownIcons[index].type"
41
- :class="dropdownIcons[index].class"
42
- ></c-icon>
43
- {{ item.text }}
44
- </a>
45
- </div>
46
- </div>
47
- </div>
48
- </div>
49
- </template>
50
-
51
- <script>
52
- import CIcon from "../CIcon/CIcon.vue";
53
- export default {
54
- name: "CIconDropdown",
55
- components: { CIcon },
56
- props: {
57
- items: {
58
- type: Array,
59
- required: true,
60
- },
61
- icon: {
62
- type: Object,
63
- },
64
- dropdownIcons: {
65
- type: Object,
66
- },
67
- classes: {
68
- type: String,
69
- },
70
- action: {
71
- type: Function,
72
- },
73
- },
74
- data() {
75
- return {
76
- toggleDropdown: false,
77
- };
78
- },
79
- methods: {
80
- dropdownAction(item) {
81
- this.$emit("action", item);
82
- },
83
- close() {
84
- this.toggleDropdown = false;
85
- },
86
- },
87
- };
88
- </script>
89
-
90
- <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="focus:outline-none inline-flex w-full justify-center rounded-full border-none p-2 focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2"
11
+ aria-haspopup="true"
12
+ aria-expanded="true"
13
+ >
14
+ <c-icon :name="icon.name" :type="icon.type" :class="icon.class"></c-icon>
15
+ </button>
16
+ </div>
17
+ <div
18
+ v-show="toggleDropdown"
19
+ :class="classes"
20
+ 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"
21
+ >
22
+ <div
23
+ class="w-max py-2"
24
+ role="menu"
25
+ aria-orientation="vertical"
26
+ aria-labelledby="option-menu"
27
+ >
28
+ <a
29
+ v-for="(item, index) in items"
30
+ v-bind:key="item.text"
31
+ @mousedown.stop.prevent="dropdownAction(item)"
32
+ 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"
33
+ :class="item.class"
34
+ role="menuitem"
35
+ :disabled="item.disabled"
36
+ >
37
+ <c-icon
38
+ v-if="item.icon"
39
+ :name="dropdownIcons[index].name"
40
+ :type="dropdownIcons[index].type"
41
+ :class="dropdownIcons[index].class"
42
+ ></c-icon>
43
+ {{ item.text }}
44
+ </a>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </template>
50
+
51
+ <script>
52
+ import CIcon from "../CIcon/CIcon.vue";
53
+ export default {
54
+ name: "CIconDropdown",
55
+ components: { CIcon },
56
+ props: {
57
+ items: {
58
+ type: Array,
59
+ required: true,
60
+ },
61
+ icon: {
62
+ type: Object,
63
+ },
64
+ dropdownIcons: {
65
+ type: Object,
66
+ },
67
+ classes: {
68
+ type: String,
69
+ },
70
+ action: {
71
+ type: Function,
72
+ },
73
+ },
74
+ data() {
75
+ return {
76
+ toggleDropdown: false,
77
+ };
78
+ },
79
+ methods: {
80
+ dropdownAction(item) {
81
+ this.$emit("action", item);
82
+ },
83
+ close() {
84
+ this.toggleDropdown = false;
85
+ },
86
+ },
87
+ };
88
+ </script>
89
+
90
+ <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