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,77 +1,77 @@
1
- <template>
2
- <div>
3
- <ul>
4
- <li
5
- v-for="items in listItems"
6
- v-bind:key="items.size"
7
- class="py-4 flex justify-between items-center"
8
- :class="{ 'cursor-pointer': items.collapse, 'border-b border-gray-200': divider === true }"
9
- v-on="items.collapse ? { click: () => collapseList() } : null"
10
- >
11
- <div class="flex">
12
- <c-icon
13
- v-if="items.collapse"
14
- :name="showSection ? 'chevron-down' : 'chevron-right'"
15
- type="solid"
16
- class="mt-3 mr-3 text-gray-900 h-5 w-5"
17
- ></c-icon>
18
- <c-avatar :size="items.size" :rounded="items.rounded" :image="items.image"></c-avatar>
19
- <div class="ml-3">
20
- <div class="flex pb-1">
21
- <p class="text-sm font-medium text-gray-900">
22
- {{ items.heading }}
23
- </p>
24
- <c-tag v-if="items.tag" label="Active" class="ml-2.5 relative bottom-0.5"></c-tag>
25
- </div>
26
- <p class="text-sm text-gray-500">{{ items.description }}</p>
27
- <div v-if="showSection" class="mt-3">
28
- <slot></slot>
29
- </div>
30
- </div>
31
- </div>
32
- <!-- <c-icon
33
- v-if="items.listIcon"
34
- name="trash"
35
- class="h-5 w-5 text-gray-500 hover:text-red-500 cursor-pointer"
36
- type="solid"
37
- ></c-icon> -->
38
- <button
39
- v-if="items.listIcon"
40
- type="button"
41
- class="rounded-full h-8 w-8 flex items-center justify-center text-gray-500 hover:bg-red-100 hover:text-red-800 focus:outline-none focus:ring-2 focus:ring-red-500"
42
- >
43
- <c-icon name="trash" type="solid" class="h-5 w-5 hover:text-red-800"></c-icon>
44
- </button>
45
- </li>
46
- </ul>
47
- </div>
48
- </template>
49
- <script>
50
- import CAvatar from "../CAvatar/CAvatar.vue";
51
- import CTag from "../CTag/CTag.vue";
52
- import CIcon from "../CIcon/CIcon.vue";
53
- export default {
54
- name: "CStackedList",
55
- components: { CAvatar, CTag, CIcon },
56
- props: {
57
- listItems: {
58
- type: Array,
59
- required: true,
60
- },
61
- divider: {
62
- type: Boolean,
63
- default: true,
64
- },
65
- },
66
- data() {
67
- return {
68
- showSection: false,
69
- };
70
- },
71
- methods: {
72
- collapseList() {
73
- this.showSection = !this.showSection;
74
- },
75
- },
76
- };
77
- </script>
1
+ <template>
2
+ <div>
3
+ <ul>
4
+ <li
5
+ v-for="items in listItems"
6
+ v-bind:key="items.size"
7
+ class="py-4 flex justify-between items-center"
8
+ :class="{ 'cursor-pointer': items.collapse, 'border-b border-gray-200': divider === true }"
9
+ v-on="items.collapse ? { click: () => collapseList() } : null"
10
+ >
11
+ <div class="flex">
12
+ <c-icon
13
+ v-if="items.collapse"
14
+ :name="showSection ? 'chevron-down' : 'chevron-right'"
15
+ type="solid"
16
+ class="mt-3 mr-3 text-gray-900 h-5 w-5"
17
+ ></c-icon>
18
+ <c-avatar :size="items.size" :rounded="items.rounded" :image="items.image"></c-avatar>
19
+ <div class="ml-3">
20
+ <div class="flex pb-1">
21
+ <p class="text-sm font-medium text-gray-900">
22
+ {{ items.heading }}
23
+ </p>
24
+ <c-tag v-if="items.tag" label="Active" class="ml-2.5 relative bottom-0.5"></c-tag>
25
+ </div>
26
+ <p class="text-sm text-gray-500">{{ items.description }}</p>
27
+ <div v-if="showSection" class="mt-3">
28
+ <slot></slot>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ <!-- <c-icon
33
+ v-if="items.listIcon"
34
+ name="trash"
35
+ class="h-5 w-5 text-gray-500 hover:text-red-500 cursor-pointer"
36
+ type="solid"
37
+ ></c-icon> -->
38
+ <button
39
+ v-if="items.listIcon"
40
+ type="button"
41
+ class="rounded-full h-8 w-8 flex items-center justify-center text-gray-500 hover:bg-red-100 hover:text-red-800 focus:outline-none focus:ring-2 focus:ring-red-500"
42
+ >
43
+ <c-icon name="trash" type="solid" class="h-5 w-5 hover:text-red-800"></c-icon>
44
+ </button>
45
+ </li>
46
+ </ul>
47
+ </div>
48
+ </template>
49
+ <script>
50
+ import CAvatar from "../CAvatar/CAvatar.vue";
51
+ import CTag from "../CTag/CTag.vue";
52
+ import CIcon from "../CIcon/CIcon.vue";
53
+ export default {
54
+ name: "CStackedList",
55
+ components: { CAvatar, CTag, CIcon },
56
+ props: {
57
+ listItems: {
58
+ type: Array,
59
+ required: true,
60
+ },
61
+ divider: {
62
+ type: Boolean,
63
+ default: true,
64
+ },
65
+ },
66
+ data() {
67
+ return {
68
+ showSection: false,
69
+ };
70
+ },
71
+ methods: {
72
+ collapseList() {
73
+ this.showSection = !this.showSection;
74
+ },
75
+ },
76
+ };
77
+ </script>
@@ -1,3 +1,3 @@
1
- import CStackedList from './CStackedList.vue'
2
-
1
+ import CStackedList from './CStackedList.vue'
2
+
3
3
  export default CStackedList
@@ -1,88 +1,88 @@
1
- <template>
2
- <!-- <div>
3
- <dl class="mt-5 sm:flex sm:flex-col md:flex md:flex-row justify-between">
4
- <div
5
- :class="index == statsCount.length - 1 ? '' : 'mr-2'"
6
- class="bg-white w-full overflow-hidden shadow rounded-lg"
7
- v-for="(count, index) in statsCount"
8
- v-bind:key="count.number"
9
- >
10
- <div class="px-4 pt-3 pb-1 flex">
11
- <c-icon
12
- v-if="count.icon"
13
- :name="count.icon.name"
14
- :type="count.icon.type"
15
- :class="count.icon.class"
16
- ></c-icon>
17
- <div :class="count.icon ? 'ml-3' : ''">
18
- <dt class="text-sm text-gray-500 flex">
19
- <span>{{ count.label }}</span>
20
- <span class="text-sm text-gray-900 ml-1">{{ count.number }}</span>
21
- </dt>
22
- <dd class="text-2xl font-semibold text-gray-900">
23
- {{ count.totalCount }}
24
- </dd>
25
- </div>
26
- </div>
27
- <div class="ml-12 pb-2 flex items-center" v-if="count.tag || count.days">
28
- <c-tag v-if="count.tag" :label="count.tag.label" :color="count.tag.color"></c-tag>
29
- <label v-if="count.days" class="text-xs text-gray-500 ml-1">{{ count.days }}</label>
30
- </div>
31
- </div>
32
- </dl>
33
- </div> -->
34
- <!-- This example requires Tailwind CSS v2.0+ -->
35
- <div>
36
- <dl
37
- class="mt-5 grid grid-cols-1 rounded-lg bg-gray-100 overflow-hidden divide-y divide-gray-200 md:grid-cols-3 md:divide-y-0 md:divide-x"
38
- >
39
- <div class="px-4 py-5 sm:p-6" v-for="count in statsCount" v-bind:key="count.number">
40
- <div class="flex">
41
- <c-icon
42
- v-if="count.icon"
43
- :name="count.icon.name"
44
- :type="count.icon.type"
45
- :class="count.icon.class"
46
- ></c-icon>
47
- <div :class="count.icon ? 'ml-3' : ''">
48
- <dt class="text-sm text-gray-500 flex">
49
- <span>{{ count.label }}</span>
50
- <span class="text-sm text-gray-900 ml-1">{{ count.number }}</span>
51
- </dt>
52
- <dd class="text-2xl font-semibold text-gray-900">
53
- {{ count.totalCount }}
54
- </dd>
55
- </div>
56
- </div>
57
- <div class="ml-8 pb-2 flex items-center" v-if="count.tag || count.days">
58
- <c-tag
59
- v-if="count.tag"
60
- :label="count.tag.label"
61
- :color="count.tag.color"
62
- :tagClasses="count.tag.class"
63
- ></c-tag>
64
- <label v-if="count.days" class="text-xs text-gray-500 ml-1">{{ count.days }}</label>
65
- </div>
66
- </div>
67
- </dl>
68
- </div>
69
- </template>
70
-
71
- <script>
72
- import CIcon from "../CIcon/CIcon.vue";
73
- import CTag from "../CTag/CTag.vue";
74
- export default {
75
- name: "CStats",
76
- components: { CIcon, CTag },
77
- props: {
78
- statsCount: {
79
- type: Array,
80
- },
81
- // icon: {
82
- // type: Object,
83
- // },
84
- },
85
- };
86
- </script>
87
-
88
- <style></style>
1
+ <template>
2
+ <!-- <div>
3
+ <dl class="mt-5 sm:flex sm:flex-col md:flex md:flex-row justify-between">
4
+ <div
5
+ :class="index == statsCount.length - 1 ? '' : 'mr-2'"
6
+ class="bg-white w-full overflow-hidden shadow rounded-lg"
7
+ v-for="(count, index) in statsCount"
8
+ v-bind:key="count.number"
9
+ >
10
+ <div class="px-4 pt-3 pb-1 flex">
11
+ <c-icon
12
+ v-if="count.icon"
13
+ :name="count.icon.name"
14
+ :type="count.icon.type"
15
+ :class="count.icon.class"
16
+ ></c-icon>
17
+ <div :class="count.icon ? 'ml-3' : ''">
18
+ <dt class="text-sm text-gray-500 flex">
19
+ <span>{{ count.label }}</span>
20
+ <span class="text-sm text-gray-900 ml-1">{{ count.number }}</span>
21
+ </dt>
22
+ <dd class="text-2xl font-semibold text-gray-900">
23
+ {{ count.totalCount }}
24
+ </dd>
25
+ </div>
26
+ </div>
27
+ <div class="ml-12 pb-2 flex items-center" v-if="count.tag || count.days">
28
+ <c-tag v-if="count.tag" :label="count.tag.label" :color="count.tag.color"></c-tag>
29
+ <label v-if="count.days" class="text-xs text-gray-500 ml-1">{{ count.days }}</label>
30
+ </div>
31
+ </div>
32
+ </dl>
33
+ </div> -->
34
+ <!-- This example requires Tailwind CSS v2.0+ -->
35
+ <div>
36
+ <dl
37
+ class="mt-5 grid grid-cols-1 rounded-lg bg-gray-100 overflow-hidden divide-y divide-gray-200 md:grid-cols-3 md:divide-y-0 md:divide-x"
38
+ >
39
+ <div class="px-4 py-5 sm:p-6" v-for="count in statsCount" v-bind:key="count.number">
40
+ <div class="flex">
41
+ <c-icon
42
+ v-if="count.icon"
43
+ :name="count.icon.name"
44
+ :type="count.icon.type"
45
+ :class="count.icon.class"
46
+ ></c-icon>
47
+ <div :class="count.icon ? 'ml-3' : ''">
48
+ <dt class="text-sm text-gray-500 flex">
49
+ <span>{{ count.label }}</span>
50
+ <span class="text-sm text-gray-900 ml-1">{{ count.number }}</span>
51
+ </dt>
52
+ <dd class="text-2xl font-semibold text-gray-900">
53
+ {{ count.totalCount }}
54
+ </dd>
55
+ </div>
56
+ </div>
57
+ <div class="ml-8 pb-2 flex items-center" v-if="count.tag || count.days">
58
+ <c-tag
59
+ v-if="count.tag"
60
+ :label="count.tag.label"
61
+ :color="count.tag.color"
62
+ :tagClasses="count.tag.class"
63
+ ></c-tag>
64
+ <label v-if="count.days" class="text-xs text-gray-500 ml-1">{{ count.days }}</label>
65
+ </div>
66
+ </div>
67
+ </dl>
68
+ </div>
69
+ </template>
70
+
71
+ <script>
72
+ import CIcon from "../CIcon/CIcon.vue";
73
+ import CTag from "../CTag/CTag.vue";
74
+ export default {
75
+ name: "CStats",
76
+ components: { CIcon, CTag },
77
+ props: {
78
+ statsCount: {
79
+ type: Array,
80
+ },
81
+ // icon: {
82
+ // type: Object,
83
+ // },
84
+ },
85
+ };
86
+ </script>
87
+
88
+ <style></style>
@@ -1,3 +1,3 @@
1
- import CStats from './CStats.vue'
2
-
1
+ import CStats from './CStats.vue'
2
+
3
3
  export default CStats
@@ -1,132 +1,132 @@
1
- <template>
2
- <div>
3
- <!-- small toggle -->
4
- <div
5
- v-if="size === 'small'"
6
- :class="label == '' ? 'items-center' : 'items-start'"
7
- class="flex cursor-pointer justify-between"
8
- >
9
- <span
10
- class="flex flex-grow flex-col"
11
- id="smallleft"
12
- v-if="direction == 'left'"
13
- @click="switchValue"
14
- >
15
- <span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
16
- <span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
17
- </span>
18
- <button
19
- type="button"
20
- class="group focus:outline-none relative inline-flex h-5 w-10 flex-shrink-0 cursor-pointer items-center justify-center rounded-full focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50"
21
- aria-pressed="false"
22
- @click="switchValue"
23
- :disabled="disabled"
24
- >
25
- <span class="sr-only">Use setting</span>
26
- <span
27
- aria-hidden="true"
28
- class="pointer-events-none absolute h-full w-full rounded-md bg-white"
29
- ></span>
30
- <span
31
- aria-hidden="true"
32
- :class="{ 'bg-indigo-600': isToggle, 'bg-gray-200': !isToggle }"
33
- class="pointer-events-none absolute mx-auto h-4 w-9 rounded-full transition-colors duration-200 ease-in-out"
34
- ></span>
35
- <span
36
- aria-hidden="true"
37
- :class="{ 'translate-x-5': isToggle, 'translate-x-0': !isToggle }"
38
- class="pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-full border border-gray-200 bg-white ring-0 transition-transform duration-200 ease-in-out"
39
- ></span>
40
- </button>
41
- <span class="flex flex-col" id="toggleLabel" v-if="direction == 'right'" @click="switchValue">
42
- <span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
43
- <span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
44
- </span>
45
- </div>
46
- <!-- large toggle -->
47
- <div
48
- v-else
49
- :class="label == '' ? 'items-center' : 'items-start'"
50
- class="flex cursor-pointer justify-between"
51
- >
52
- <span
53
- class="flex flex-grow flex-col"
54
- id="toggleLabel"
55
- v-if="direction == 'left'"
56
- @click="switchValue"
57
- >
58
- <span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
59
- <span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
60
- </span>
61
- <button
62
- type="button"
63
- aria-pressed="false"
64
- :class="{ 'bg-indigo-600': isToggle == 1, 'bg-gray-200': isToggle == 0 }"
65
- @click.stop="switchValue"
66
- class="focus:outline-none relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50"
67
- :disabled="disabled"
68
- >
69
- <span class="sr-only">Use setting</span>
70
- <span
71
- aria-hidden="true"
72
- :class="{ 'translate-x-5': isToggle == 1, 'translate-x-0': isToggle == 0 }"
73
- class="inline-block h-5 w-5 transform rounded-full bg-white ring-0 transition duration-200 ease-in-out"
74
- ></span>
75
- </button>
76
- <span class="flex flex-col disabled:opacity-50" id="toggleLabel" v-if="direction == 'right'">
77
- <span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
78
- <span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
79
- </span>
80
- </div>
81
- </div>
82
- </template>
83
-
84
- <script>
85
- export default {
86
- name: "CSwitch",
87
- components: {},
88
- props: {
89
- label: {
90
- type: String,
91
- },
92
- description: {
93
- type: String,
94
- },
95
- returnToggleValue: {
96
- type: Function,
97
- },
98
- classes: {
99
- type: String,
100
- },
101
- value: { type: Number },
102
- size: {
103
- type: String,
104
- },
105
- direction: {
106
- type: String,
107
- },
108
- disabled: {
109
- type: Boolean,
110
- default: false,
111
- },
112
- },
113
- data() {
114
- return {
115
- isToggle: this.value,
116
- };
117
- },
118
- methods: {
119
- switchValue() {
120
- this.isToggle = this.isToggle === 1 ? 0 : 1;
121
- this.$emit("returnToggleValue", this.isToggle);
122
- },
123
- },
124
- watch: {
125
- value() {
126
- this.isToggle = this.value;
127
- },
128
- },
129
- };
130
- </script>
131
-
132
- <style></style>
1
+ <template>
2
+ <div>
3
+ <!-- small toggle -->
4
+ <div
5
+ v-if="size === 'small'"
6
+ :class="label == '' ? 'items-center' : 'items-start'"
7
+ class="flex cursor-pointer justify-between"
8
+ >
9
+ <span
10
+ class="flex flex-grow flex-col"
11
+ id="smallleft"
12
+ v-if="direction == 'left'"
13
+ @click="switchValue"
14
+ >
15
+ <span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
16
+ <span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
17
+ </span>
18
+ <button
19
+ type="button"
20
+ class="group focus:outline-none relative inline-flex h-5 w-10 flex-shrink-0 cursor-pointer items-center justify-center rounded-full focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50"
21
+ aria-pressed="false"
22
+ @click="switchValue"
23
+ :disabled="disabled"
24
+ >
25
+ <span class="sr-only">Use setting</span>
26
+ <span
27
+ aria-hidden="true"
28
+ class="pointer-events-none absolute h-full w-full rounded-md bg-white"
29
+ ></span>
30
+ <span
31
+ aria-hidden="true"
32
+ :class="{ 'bg-indigo-600': isToggle, 'bg-gray-200': !isToggle }"
33
+ class="pointer-events-none absolute mx-auto h-4 w-9 rounded-full transition-colors duration-200 ease-in-out"
34
+ ></span>
35
+ <span
36
+ aria-hidden="true"
37
+ :class="{ 'translate-x-5': isToggle, 'translate-x-0': !isToggle }"
38
+ class="pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-full border border-gray-200 bg-white ring-0 transition-transform duration-200 ease-in-out"
39
+ ></span>
40
+ </button>
41
+ <span class="flex flex-col" id="toggleLabel" v-if="direction == 'right'" @click="switchValue">
42
+ <span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
43
+ <span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
44
+ </span>
45
+ </div>
46
+ <!-- large toggle -->
47
+ <div
48
+ v-else
49
+ :class="label == '' ? 'items-center' : 'items-start'"
50
+ class="flex cursor-pointer justify-between"
51
+ >
52
+ <span
53
+ class="flex flex-grow flex-col"
54
+ id="toggleLabel"
55
+ v-if="direction == 'left'"
56
+ @click="switchValue"
57
+ >
58
+ <span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
59
+ <span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
60
+ </span>
61
+ <button
62
+ type="button"
63
+ aria-pressed="false"
64
+ :class="{ 'bg-indigo-600': isToggle == 1, 'bg-gray-200': isToggle == 0 }"
65
+ @click.stop="switchValue"
66
+ class="focus:outline-none relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50"
67
+ :disabled="disabled"
68
+ >
69
+ <span class="sr-only">Use setting</span>
70
+ <span
71
+ aria-hidden="true"
72
+ :class="{ 'translate-x-5': isToggle == 1, 'translate-x-0': isToggle == 0 }"
73
+ class="inline-block h-5 w-5 transform rounded-full bg-white ring-0 transition duration-200 ease-in-out"
74
+ ></span>
75
+ </button>
76
+ <span class="flex flex-col disabled:opacity-50" id="toggleLabel" v-if="direction == 'right'">
77
+ <span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
78
+ <span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
79
+ </span>
80
+ </div>
81
+ </div>
82
+ </template>
83
+
84
+ <script>
85
+ export default {
86
+ name: "CSwitch",
87
+ components: {},
88
+ props: {
89
+ label: {
90
+ type: String,
91
+ },
92
+ description: {
93
+ type: String,
94
+ },
95
+ returnToggleValue: {
96
+ type: Function,
97
+ },
98
+ classes: {
99
+ type: String,
100
+ },
101
+ value: { type: Number },
102
+ size: {
103
+ type: String,
104
+ },
105
+ direction: {
106
+ type: String,
107
+ },
108
+ disabled: {
109
+ type: Boolean,
110
+ default: false,
111
+ },
112
+ },
113
+ data() {
114
+ return {
115
+ isToggle: this.value,
116
+ };
117
+ },
118
+ methods: {
119
+ switchValue() {
120
+ this.isToggle = this.isToggle === 1 ? 0 : 1;
121
+ this.$emit("returnToggleValue", this.isToggle);
122
+ },
123
+ },
124
+ watch: {
125
+ value() {
126
+ this.isToggle = this.value;
127
+ },
128
+ },
129
+ };
130
+ </script>
131
+
132
+ <style></style>
@@ -1,3 +1,3 @@
1
- import CSwitch from './CSwitch.vue'
2
-
1
+ import CSwitch from './CSwitch.vue'
2
+
3
3
  export default CSwitch