classcard-ui 0.2.498 → 0.2.501
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 +81 -86
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +81 -86
- 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 +81 -81
- 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 +104 -104
- 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 +150 -150
- package/src/components/CButton/index.js +2 -2
- package/src/components/CButtonGroup/CButtonGroup.vue +116 -116
- package/src/components/CButtonGroup/index.js +2 -2
- package/src/components/CButtonIcon/CButtonIcon.vue +91 -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 +70 -70
- 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 +120 -120
- 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 +217 -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 +115 -115
- 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 +313 -313
- 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 +56 -56
- 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 +94 -94
- package/src/components/CReorderableStackedList/index.js +2 -2
- package/src/components/CSelect/CSelect.vue +286 -286
- 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 +501 -501
- package/src/components/CTable/index.js +2 -2
- package/src/components/CTabs/CTabs.vue +107 -107
- 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 +196 -196
- package/src/components/CUpload/index.js +2 -2
- package/src/components/index.js +47 -47
- package/src/icons.js +254 -254
- package/src/main.js +22 -22
- 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,108 +1,91 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<slot></slot>
|
|
4
|
-
<button
|
|
5
|
-
v-if="type == 'tertiary'"
|
|
6
|
-
class="flex cursor-pointer flex-row rounded-md px-2 py-2 text-sm text-indigo-600 hover:bg-indigo-100 hover:text-indigo-800 focus:
|
|
7
|
-
@click="$emit('action')"
|
|
8
|
-
>
|
|
9
|
-
<c-icon
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type:
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.type == "success",
|
|
93
|
-
"text-gray-900 hover:bg-gray-200 bg-gray-100":
|
|
94
|
-
this.type == "secondary-gray",
|
|
95
|
-
"cursor-default pointer-events-none": this.isLoading,
|
|
96
|
-
};
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
methods: {
|
|
101
|
-
onClick() {
|
|
102
|
-
this.$emit("onClick");
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
</script>
|
|
107
|
-
|
|
108
|
-
<style></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<button
|
|
5
|
+
v-if="type == 'tertiary'"
|
|
6
|
+
class="focus:outline-none flex cursor-pointer flex-row rounded-md px-2 py-2 text-sm text-indigo-600 hover:bg-indigo-100 hover:text-indigo-800 focus:ring-2 focus:ring-indigo-200 focus:ring-offset-2"
|
|
7
|
+
@click.prevent="$emit('action')"
|
|
8
|
+
>
|
|
9
|
+
<c-icon v-if="icon" :type="icon.type" :class="icon.class" :name="icon.name"></c-icon>
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</button>
|
|
12
|
+
<button
|
|
13
|
+
v-else-if="type == 'rounded-hover'"
|
|
14
|
+
@click.prevent="$emit('action')"
|
|
15
|
+
class="focus:outline-none flex h-8 w-8 cursor-pointer items-center justify-center rounded-full bg-white text-gray-500 hover:bg-gray-100 hover:text-gray-500 focus:ring-2 focus:ring-indigo-500"
|
|
16
|
+
>
|
|
17
|
+
<c-icon v-if="icon" :type="icon.type" :class="icon.class" :name="icon.name"></c-icon>
|
|
18
|
+
</button>
|
|
19
|
+
<button
|
|
20
|
+
v-else
|
|
21
|
+
:type="type"
|
|
22
|
+
:class="classes"
|
|
23
|
+
class="focus:outline-none inline-flex items-center rounded-md px-2 py-2 text-sm font-medium shadow-sm focus:ring-2 focus:ring-offset-2"
|
|
24
|
+
@click.prevent="$emit('action')"
|
|
25
|
+
>
|
|
26
|
+
<c-icon v-if="isLoading" class="mr-2 h-5 w-5" :class="loaderClasses" name="loader"></c-icon>
|
|
27
|
+
<c-icon
|
|
28
|
+
v-if="icon"
|
|
29
|
+
:type="icon.type"
|
|
30
|
+
:class="icon.class"
|
|
31
|
+
:name="icon.name"
|
|
32
|
+
:viewBox="icon.viewBox"
|
|
33
|
+
></c-icon>
|
|
34
|
+
<slot></slot>
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
41
|
+
export default {
|
|
42
|
+
name: "CButtonIcon",
|
|
43
|
+
components: { CIcon },
|
|
44
|
+
props: {
|
|
45
|
+
icon: {
|
|
46
|
+
type: Object,
|
|
47
|
+
},
|
|
48
|
+
type: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "primary",
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
isLoading: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
action: {
|
|
58
|
+
type: Function,
|
|
59
|
+
},
|
|
60
|
+
loaderClasses: {
|
|
61
|
+
type: String,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
computed: {
|
|
66
|
+
classes() {
|
|
67
|
+
return {
|
|
68
|
+
"border border-gray-200 bg-white text-gray-700 hover:bg-gray-50 focus:ring-indigo-600":
|
|
69
|
+
this.type == "white",
|
|
70
|
+
"text-indigo-700 bg-indigo-100 hover:bg-indigo-200 focus:ring-indigo-500":
|
|
71
|
+
this.type == "secondary",
|
|
72
|
+
"border text-white hover:bg-indigo-800 bg-indigo-700 focus:ring-indigo-600":
|
|
73
|
+
this.type == "primary",
|
|
74
|
+
"border text-white hover:bg-red-800 bg-red-700 focus:ring-red-600": this.type == "danger",
|
|
75
|
+
"border text-white hover:bg-green-800 bg-green-700 focus:ring-green-600":
|
|
76
|
+
this.type == "success",
|
|
77
|
+
"text-gray-900 hover:bg-gray-200 bg-gray-100": this.type == "secondary-gray",
|
|
78
|
+
"cursor-default pointer-events-none": this.isLoading,
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
methods: {
|
|
84
|
+
onClick() {
|
|
85
|
+
this.$emit("onClick");
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<style></style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CButtonIcon from './CButtonIcon.vue'
|
|
2
|
-
|
|
1
|
+
import CButtonIcon from './CButtonIcon.vue'
|
|
2
|
+
|
|
3
3
|
export default CButtonIcon
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span class="relative z-0 inline-flex w-full rounded-md shadow-sm">
|
|
3
|
-
<button
|
|
4
|
-
v-if="image"
|
|
5
|
-
type="button"
|
|
6
|
-
class="focus:outline-none relative -ml-px inline-flex items-center rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500"
|
|
7
|
-
>
|
|
8
|
-
<img class="h-10 w-10" :src="image" />
|
|
9
|
-
</button>
|
|
10
|
-
<button
|
|
11
|
-
type="button"
|
|
12
|
-
class="focus:outline-none relative inline-flex w-full items-center justify-between rounded-r-md border border-gray-300 bg-white py-2 pl-4 pr-1 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500"
|
|
13
|
-
:class="image ? 'rounded-r-md' : 'rounded-md'"
|
|
14
|
-
@click="$emit('action')"
|
|
15
|
-
>
|
|
16
|
-
{{ label }}
|
|
17
|
-
<c-icon type="solid" name="chevron-right" class="h-5 w-5"></c-icon>
|
|
18
|
-
</button>
|
|
19
|
-
</span>
|
|
20
|
-
</template>
|
|
21
|
-
<script>
|
|
22
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
23
|
-
export default {
|
|
24
|
-
name: "CButtonLink",
|
|
25
|
-
components: { CIcon },
|
|
26
|
-
props: {
|
|
27
|
-
label: {
|
|
28
|
-
type: String,
|
|
29
|
-
},
|
|
30
|
-
image: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: null,
|
|
33
|
-
},
|
|
34
|
-
action: {
|
|
35
|
-
type: Function,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<span class="relative z-0 inline-flex w-full rounded-md shadow-sm">
|
|
3
|
+
<button
|
|
4
|
+
v-if="image"
|
|
5
|
+
type="button"
|
|
6
|
+
class="focus:outline-none relative -ml-px inline-flex items-center rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500"
|
|
7
|
+
>
|
|
8
|
+
<img class="h-10 w-10" :src="image" />
|
|
9
|
+
</button>
|
|
10
|
+
<button
|
|
11
|
+
type="button"
|
|
12
|
+
class="focus:outline-none relative inline-flex w-full items-center justify-between rounded-r-md border border-gray-300 bg-white py-2 pl-4 pr-1 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500"
|
|
13
|
+
:class="image ? 'rounded-r-md' : 'rounded-md'"
|
|
14
|
+
@click="$emit('action')"
|
|
15
|
+
>
|
|
16
|
+
{{ label }}
|
|
17
|
+
<c-icon type="solid" name="chevron-right" class="h-5 w-5"></c-icon>
|
|
18
|
+
</button>
|
|
19
|
+
</span>
|
|
20
|
+
</template>
|
|
21
|
+
<script>
|
|
22
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
23
|
+
export default {
|
|
24
|
+
name: "CButtonLink",
|
|
25
|
+
components: { CIcon },
|
|
26
|
+
props: {
|
|
27
|
+
label: {
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
30
|
+
image: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: null,
|
|
33
|
+
},
|
|
34
|
+
action: {
|
|
35
|
+
type: Function,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
</script>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CButtonLink from './CButtonLink.vue'
|
|
2
|
-
|
|
1
|
+
import CButtonLink from './CButtonLink.vue'
|
|
2
|
+
|
|
3
3
|
export default CButtonLink
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<slot></slot>
|
|
4
|
-
<div class="relative inline-block text-left">
|
|
5
|
-
<button
|
|
6
|
-
:type="type"
|
|
7
|
-
@click="toggleDropdown = !toggleDropdown"
|
|
8
|
-
@blur="close()"
|
|
9
|
-
:class="classes"
|
|
10
|
-
class="inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 text-sm font-medium focus:outline-none"
|
|
11
|
-
aria-haspopup="listbox"
|
|
12
|
-
aria-expanded="true"
|
|
13
|
-
aria-labelledby="listbox-label"
|
|
14
|
-
>
|
|
15
|
-
<c-icon v-if="isLoading" class="mr-2 h-5 w-5" name="loader"></c-icon>
|
|
16
|
-
{{ label }}
|
|
17
|
-
<c-icon name="chevron-down" type="solid" class="ml-2 h-5 w-5"></c-icon>
|
|
18
|
-
</button>
|
|
19
|
-
|
|
20
|
-
<div
|
|
21
|
-
v-if="toggleDropdown"
|
|
22
|
-
:class="dropdownPositionClass"
|
|
23
|
-
class="z-10 absolute mt-2 -mr-1 w-56 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5"
|
|
24
|
-
>
|
|
25
|
-
<ul class="py-1" tabindex="-1" role="listbox" aria-labelledby="listbox-label">
|
|
26
|
-
<li
|
|
27
|
-
v-for="(item) in items"
|
|
28
|
-
:key="item.text"
|
|
29
|
-
class="flex px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 cursor-pointer"
|
|
30
|
-
@mousedown="emitOptionAction(item.action)"
|
|
31
|
-
>
|
|
32
|
-
<c-icon
|
|
33
|
-
v-if="item.icon"
|
|
34
|
-
:type="item.iconType"
|
|
35
|
-
class="mr-2 h-5 w-5 text-gray-500"
|
|
36
|
-
:name="item.icon"
|
|
37
|
-
></c-icon>
|
|
38
|
-
<slot name="customIcon" v-if="item.customIcon"></slot>
|
|
39
|
-
{{ item.text }}
|
|
40
|
-
</li>
|
|
41
|
-
</ul>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
49
|
-
export default {
|
|
50
|
-
name: "CButtonSelect",
|
|
51
|
-
components: { CIcon },
|
|
52
|
-
props: {
|
|
53
|
-
label: {
|
|
54
|
-
type: String,
|
|
55
|
-
required: true,
|
|
56
|
-
},
|
|
57
|
-
type: {
|
|
58
|
-
type: String,
|
|
59
|
-
default: "primary",
|
|
60
|
-
},
|
|
61
|
-
items: {
|
|
62
|
-
type: Array,
|
|
63
|
-
required: true,
|
|
64
|
-
},
|
|
65
|
-
isLoading: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
default: false,
|
|
68
|
-
},
|
|
69
|
-
dropdownPositionClass: {
|
|
70
|
-
type: String,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
data() {
|
|
74
|
-
return {
|
|
75
|
-
toggleDropdown: false,
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
computed: {
|
|
80
|
-
classes() {
|
|
81
|
-
return {
|
|
82
|
-
"text-gray-700 border-gray-300 hover:bg-gray-50 focus:ring-indigo-600":
|
|
83
|
-
this.type == "secondary",
|
|
84
|
-
"text-white hover:bg-indigo-800 bg-indigo-700 focus:ring-indigo-600":
|
|
85
|
-
this.type == "primary",
|
|
86
|
-
"text-white hover:bg-red-800 bg-red-700 focus:ring-red-600": this.type == "danger",
|
|
87
|
-
"text-white hover:bg-green-800 bg-green-700 focus:ring-green-600": this.type == "success",
|
|
88
|
-
"cursor-default pointer-events-none": this.isLoading,
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
methods: {
|
|
93
|
-
emitOptionAction(action) {
|
|
94
|
-
this.$emit("buttonActions", action);
|
|
95
|
-
},
|
|
96
|
-
close() {
|
|
97
|
-
this.toggleDropdown = false;
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<style></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<div class="relative inline-block text-left">
|
|
5
|
+
<button
|
|
6
|
+
:type="type"
|
|
7
|
+
@click="toggleDropdown = !toggleDropdown"
|
|
8
|
+
@blur="close()"
|
|
9
|
+
:class="classes"
|
|
10
|
+
class="inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 text-sm font-medium focus:outline-none"
|
|
11
|
+
aria-haspopup="listbox"
|
|
12
|
+
aria-expanded="true"
|
|
13
|
+
aria-labelledby="listbox-label"
|
|
14
|
+
>
|
|
15
|
+
<c-icon v-if="isLoading" class="mr-2 h-5 w-5" name="loader"></c-icon>
|
|
16
|
+
{{ label }}
|
|
17
|
+
<c-icon name="chevron-down" type="solid" class="ml-2 h-5 w-5"></c-icon>
|
|
18
|
+
</button>
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
v-if="toggleDropdown"
|
|
22
|
+
:class="dropdownPositionClass"
|
|
23
|
+
class="z-10 absolute mt-2 -mr-1 w-56 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5"
|
|
24
|
+
>
|
|
25
|
+
<ul class="py-1" tabindex="-1" role="listbox" aria-labelledby="listbox-label">
|
|
26
|
+
<li
|
|
27
|
+
v-for="(item) in items"
|
|
28
|
+
:key="item.text"
|
|
29
|
+
class="flex px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 cursor-pointer"
|
|
30
|
+
@mousedown="emitOptionAction(item.action)"
|
|
31
|
+
>
|
|
32
|
+
<c-icon
|
|
33
|
+
v-if="item.icon"
|
|
34
|
+
:type="item.iconType"
|
|
35
|
+
class="mr-2 h-5 w-5 text-gray-500"
|
|
36
|
+
:name="item.icon"
|
|
37
|
+
></c-icon>
|
|
38
|
+
<slot name="customIcon" v-if="item.customIcon"></slot>
|
|
39
|
+
{{ item.text }}
|
|
40
|
+
</li>
|
|
41
|
+
</ul>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
49
|
+
export default {
|
|
50
|
+
name: "CButtonSelect",
|
|
51
|
+
components: { CIcon },
|
|
52
|
+
props: {
|
|
53
|
+
label: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
type: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "primary",
|
|
60
|
+
},
|
|
61
|
+
items: {
|
|
62
|
+
type: Array,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
isLoading: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false,
|
|
68
|
+
},
|
|
69
|
+
dropdownPositionClass: {
|
|
70
|
+
type: String,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
data() {
|
|
74
|
+
return {
|
|
75
|
+
toggleDropdown: false,
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
computed: {
|
|
80
|
+
classes() {
|
|
81
|
+
return {
|
|
82
|
+
"text-gray-700 border-gray-300 hover:bg-gray-50 focus:ring-indigo-600":
|
|
83
|
+
this.type == "secondary",
|
|
84
|
+
"text-white hover:bg-indigo-800 bg-indigo-700 focus:ring-indigo-600":
|
|
85
|
+
this.type == "primary",
|
|
86
|
+
"text-white hover:bg-red-800 bg-red-700 focus:ring-red-600": this.type == "danger",
|
|
87
|
+
"text-white hover:bg-green-800 bg-green-700 focus:ring-green-600": this.type == "success",
|
|
88
|
+
"cursor-default pointer-events-none": this.isLoading,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
emitOptionAction(action) {
|
|
94
|
+
this.$emit("buttonActions", action);
|
|
95
|
+
},
|
|
96
|
+
close() {
|
|
97
|
+
this.toggleDropdown = false;
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style></style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CButtonSelect from './CButtonSelect.vue'
|
|
2
|
-
|
|
1
|
+
import CButtonSelect from './CButtonSelect.vue'
|
|
2
|
+
|
|
3
3
|
export default CButtonSelect
|