classcard-ui 0.2.671 → 0.2.689
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/dist/classcard-ui.common.js +48 -48
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +48 -48
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +3 -2
- package/src/App.vue +16 -0
- package/src/components/CAlerts/CAlerts.vue +70 -0
- package/src/components/CAlerts/index.js +3 -0
- package/src/components/CAnchorTabs/CAnchorTabs.vue +96 -0
- package/src/components/CAnchorTabs/index.js +3 -0
- package/src/components/CAnchorTag/CAnchorTag.vue +62 -0
- package/src/components/CAnchorTag/index.js +3 -0
- package/src/components/CAvatar/CAvatar.vue +112 -0
- package/src/components/CAvatar/index.js +3 -0
- package/src/components/CAvatarGroup/CAvatarGroup.vue +145 -0
- package/src/components/CAvatarGroup/index.js +3 -0
- package/src/components/CBasicTable/CBasicTable.vue +184 -0
- package/src/components/CBasicTable/index.js +3 -0
- package/src/components/CBreadcrumbs/CBreadcrumbs.vue +38 -0
- package/src/components/CBreadcrumbs/index.js +3 -0
- package/src/components/CButton/CButton.vue +147 -0
- package/src/components/CButton/index.js +3 -0
- package/src/components/CButtonGroup/CButtonGroup.vue +116 -0
- package/src/components/CButtonGroup/index.js +3 -0
- package/src/components/CButtonIcon/CButtonIcon.vue +91 -0
- package/src/components/CButtonIcon/index.js +3 -0
- package/src/components/CButtonLink/CButtonLink.vue +39 -0
- package/src/components/CButtonLink/index.js +3 -0
- package/src/components/CButtonSelect/CButtonSelect.vue +103 -0
- package/src/components/CButtonSelect/index.js +3 -0
- package/src/components/CButtonWithDropdown/CButtonWithDropdown.vue +168 -0
- package/src/components/CButtonWithDropdown/index.js +3 -0
- package/src/components/CCalendar/CCalendar.vue +401 -0
- package/src/components/CCalendar/index.js +3 -0
- package/src/components/CCard/CCard.vue +49 -0
- package/src/components/CCard/index.js +3 -0
- package/src/components/CCheckbox/CCheckbox.vue +70 -0
- package/src/components/CCheckbox/index.js +3 -0
- package/src/components/CCollapsibleSection/CCollapsibleSection.vue +99 -0
- package/src/components/CCollapsibleSection/index.js +3 -0
- package/src/components/CColorDots/CColorDots.vue +35 -0
- package/src/components/CColorDots/index.js +3 -0
- package/src/components/CConfirmActionModal/CConfirmActionModal.vue +120 -0
- package/src/components/CConfirmActionModal/index.js +3 -0
- package/src/components/CDatepicker/CDatepicker.vue +139 -0
- package/src/components/CDatepicker/index.js +3 -0
- package/src/components/CDualSelect/CDualSelect.vue +193 -0
- package/src/components/CDualSelect/index.js +3 -0
- package/src/components/CEditor/CEditor.vue +96 -0
- package/src/components/CEditor/index.js +3 -0
- package/src/components/CFormSectionHeading/CFormSectionHeading.vue +53 -0
- package/src/components/CFormSectionHeading/index.js +3 -0
- package/src/components/CGroupedSelect/CGroupedSelect.vue +217 -0
- package/src/components/CGroupedSelect/index.js +3 -0
- package/src/components/CIcon/CIcon.vue +77 -0
- package/src/components/CIcon/index.js +3 -0
- package/src/components/CIconDropdown/CIconDropdown.vue +111 -0
- package/src/components/CIconDropdown/index.js +3 -0
- package/src/components/CInput/CInput.vue +120 -0
- package/src/components/CInput/index.js +3 -0
- package/src/components/CInputAddon/CInputAddon.vue +202 -0
- package/src/components/CInputAddon/index.js +3 -0
- package/src/components/CInputEmail/CInputEmail.vue +93 -0
- package/src/components/CInputEmail/index.js +3 -0
- package/src/components/CModalHeading/CModalHeading.vue +22 -0
- package/src/components/CModalHeading/index.js +3 -0
- package/src/components/CModuleHelpLinks/CModuleHelpLinks.vue +39 -0
- package/src/components/CModuleHelpLinks/index.js +3 -0
- package/src/components/CMultiselect/CMultiselect.vue +333 -0
- package/src/components/CMultiselect/index.js +3 -0
- package/src/components/CMultiselectr/CMultiselectr.vue +44 -0
- package/src/components/CMultiselectr/index.js +3 -0
- package/src/components/CPageHeading/CPageHeading.vue +56 -0
- package/src/components/CPageHeading/index.js +3 -0
- package/src/components/CPagination/CPagination.vue +202 -0
- package/src/components/CPagination/index.js +3 -0
- package/src/components/CPhoneNumber/CPhoneNumber.vue +81 -0
- package/src/components/CPhoneNumber/index.js +3 -0
- package/src/components/CRadio/CRadio.vue +106 -0
- package/src/components/CRadio/index.js +3 -0
- package/src/components/CRangeSlider/CRangeSlider.vue +55 -0
- package/src/components/CRangeSlider/index.js +3 -0
- package/src/components/CReorderableStackedList/CReorderableStackedList.vue +94 -0
- package/src/components/CReorderableStackedList/index.js +3 -0
- package/src/components/CSelect/CSelect.vue +343 -0
- package/src/components/CSelect/index.js +3 -0
- package/src/components/CSmallTimeline/CSmallTimeline.vue +40 -0
- package/src/components/CSmallTimeline/index.js +3 -0
- package/src/components/CStackedList/CStackedList.vue +132 -0
- package/src/components/CStackedList/index.js +3 -0
- package/src/components/CStats/CStats.vue +111 -0
- package/src/components/CStats/index.js +3 -0
- package/src/components/CSwitch/CSwitch.vue +140 -0
- package/src/components/CSwitch/index.js +3 -0
- package/src/components/CTable/CTable.vue +536 -0
- package/src/components/CTable/index.js +3 -0
- package/src/components/CTabs/CTabs.vue +111 -0
- package/src/components/CTabs/index.js +3 -0
- package/src/components/CTag/CTag.vue +36 -0
- package/src/components/CTag/index.js +3 -0
- package/src/components/CTextarea/CTextarea.vue +95 -0
- package/src/components/CTextarea/index.js +3 -0
- package/src/components/CTimeline/CTimeline.vue +237 -0
- package/src/components/CTimeline/index.js +3 -0
- package/src/components/CUpload/CUpload.vue +231 -0
- package/src/components/CUpload/index.js +3 -0
- package/src/components/index.js +48 -0
- package/src/icons.js +275 -0
- package/src/main.js +22 -0
- package/src/stories/CAlerts.stories.js +37 -0
- package/src/stories/CAnchorTabs.stories.js +29 -0
- package/src/stories/CAnchorTag.stories.js +36 -0
- package/src/stories/CAvatar.stories.js +38 -0
- package/src/stories/CAvatarGroup.stories.js +100 -0
- package/src/stories/CBasicTable.stories.js +316 -0
- package/src/stories/CBreadcrumbs.stories.js +24 -0
- package/src/stories/CButton.stories.js +46 -0
- package/src/stories/CButtonGroup.stories.js +33 -0
- package/src/stories/CButtonIcon.stories.js +27 -0
- package/src/stories/CButtonLink.stories.js +24 -0
- package/src/stories/CButtonSelect.stories.js +32 -0
- package/src/stories/CButtonWithDropdown.stories.js +41 -0
- package/src/stories/CCalendar.stories.js +16 -0
- package/src/stories/CCard.stories.js +30 -0
- package/src/stories/CCheckbox.stories.js +29 -0
- package/src/stories/CCollapsibleSection.stories.js +28 -0
- package/src/stories/CColorDots.stories.js +28 -0
- package/src/stories/CConfirmActionModal.stories.js +59 -0
- package/src/stories/CDatepicker.stories.js +30 -0
- package/src/stories/CDualSelect.stories.js +29 -0
- package/src/stories/CEditor.stories.js +30 -0
- package/src/stories/CFormSectionHeading.stories.js +34 -0
- package/src/stories/CGroupedSelect.stories.js +69 -0
- package/src/stories/CIcon.stories.js +26 -0
- package/src/stories/CIconDropdown.stories.js +40 -0
- package/src/stories/CInput.stories.js +36 -0
- package/src/stories/CInputAddon.stories.js +37 -0
- package/src/stories/CInputEmail.stories.js +27 -0
- package/src/stories/CModalHeading.stories.js +25 -0
- package/src/stories/CModuleHelpLinks.stories.js +25 -0
- package/src/stories/CMultiselect.stories.js +97 -0
- package/src/stories/CMultiselectr.stories.js +23 -0
- package/src/stories/CPageHeading.stories.js +32 -0
- package/src/stories/CPagination.stories.js +30 -0
- package/src/stories/CPhoneNumber.stories.js +29 -0
- package/src/stories/CRadio.stories.js +36 -0
- package/src/stories/CRangeSlider.stories.js +23 -0
- package/src/stories/CReorderableStackedList.stories.js +23 -0
- package/src/stories/CSelect.stories.js +50 -0
- package/src/stories/CSmallTimeline.stories.js +26 -0
- package/src/stories/CStackedList.stories.js +37 -0
- package/src/stories/CStats.stories.js +33 -0
- package/src/stories/CSwitch.stories.js +28 -0
- package/src/stories/CTable.stories.js +77 -0
- package/src/stories/CTabs.stories.js +33 -0
- package/src/stories/CTag.stories.js +23 -0
- package/src/stories/CTextarea.stories.js +32 -0
- package/src/stories/CTimeline.stories.js +26 -0
- package/src/stories/CUpload.stories.js +36 -0
- package/src/stories/Introduction.stories.mdx +207 -0
- package/src/stories/Page.vue +88 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/header.css +26 -0
- package/src/stories/page.css +69 -0
- package/src/stories/utils.css +18 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="flex flex-col">
|
|
4
|
+
<div class="-my-2">
|
|
5
|
+
<div class="py-2 align-middle inline-block min-w-full">
|
|
6
|
+
<div class="">
|
|
7
|
+
<table :class="columnData ? 'divide-y divide-gray-200' : ''" class="min-w-full">
|
|
8
|
+
<thead class="table w-full table-fixed">
|
|
9
|
+
<tr v-if="columnData && columnData.length">
|
|
10
|
+
<th v-if="enableSelection" class="px-2 py-3 sticky top-0 z-10 bg-gray-100">
|
|
11
|
+
<c-checkbox @onChange="changeAllValues"></c-checkbox>
|
|
12
|
+
</th>
|
|
13
|
+
<th
|
|
14
|
+
v-for="(column, index) in columnData"
|
|
15
|
+
:key="index"
|
|
16
|
+
scope="col"
|
|
17
|
+
class="px-2 py-3 text-left text-sm font-medium text-gray-500 sticky top-0 z-10 bg-gray-100"
|
|
18
|
+
>
|
|
19
|
+
{{ column }}
|
|
20
|
+
</th>
|
|
21
|
+
</tr>
|
|
22
|
+
</thead>
|
|
23
|
+
<tbody class="bg-white divide-y divide-gray-200 max-h-96 block overflow-y-auto">
|
|
24
|
+
<tr
|
|
25
|
+
v-for="(row, index) in rowRecords"
|
|
26
|
+
@click="$emit('rowClick', index)"
|
|
27
|
+
:key="row.index"
|
|
28
|
+
class="align-top table w-full table-fixed"
|
|
29
|
+
:class="[
|
|
30
|
+
`${selectedRow && index === selectedIndex ? 'bg-indigo-100' : ''}`,
|
|
31
|
+
`${disabledRow ? 'opacity-40 pointer-events-none' : ''}`,
|
|
32
|
+
]"
|
|
33
|
+
>
|
|
34
|
+
<td
|
|
35
|
+
v-for="(record, index) in row"
|
|
36
|
+
:key="index"
|
|
37
|
+
class="px-2 whitespace-nowrap text-sm text-gray-900"
|
|
38
|
+
:class="columnClasses"
|
|
39
|
+
>
|
|
40
|
+
<c-checkbox
|
|
41
|
+
v-if="enableSelection && record.isSelected"
|
|
42
|
+
:value="record.isSelected.value"
|
|
43
|
+
></c-checkbox>
|
|
44
|
+
<p v-else-if="record.tag">
|
|
45
|
+
<c-tag :label="record.tag.label" :color="record.tag.color"></c-tag>
|
|
46
|
+
</p>
|
|
47
|
+
<p v-else-if="record.avatar">
|
|
48
|
+
<c-avatar
|
|
49
|
+
:image="record.avatar.image"
|
|
50
|
+
:rounded="record.avatar.rounded"
|
|
51
|
+
:size="record.avatar.size"
|
|
52
|
+
:name="record.avatar.name"
|
|
53
|
+
:description="record.avatar.description"
|
|
54
|
+
></c-avatar>
|
|
55
|
+
</p>
|
|
56
|
+
<p v-else-if="record.secondary" class="text-gray-500">
|
|
57
|
+
{{ record.secondary.label }}
|
|
58
|
+
</p>
|
|
59
|
+
<p v-else-if="record.icon">
|
|
60
|
+
<c-icon
|
|
61
|
+
:type="record.icon.type"
|
|
62
|
+
:class="record.icon.class"
|
|
63
|
+
:name="record.icon.name"
|
|
64
|
+
></c-icon>
|
|
65
|
+
</p>
|
|
66
|
+
<p v-else-if="record.linkLabel">
|
|
67
|
+
<a
|
|
68
|
+
href="#"
|
|
69
|
+
class="flex block text-sm text-indigo-600 hover:underline"
|
|
70
|
+
@click.prevent="action"
|
|
71
|
+
>
|
|
72
|
+
{{ record.linkLabel.label }}
|
|
73
|
+
</a>
|
|
74
|
+
</p>
|
|
75
|
+
<p v-else-if="record.switch">
|
|
76
|
+
<c-switch :value="record.switch.value"></c-switch>
|
|
77
|
+
</p>
|
|
78
|
+
<div v-else-if="record.selectpicker">
|
|
79
|
+
<c-select
|
|
80
|
+
:placeholder="record.selectpicker.placeholder"
|
|
81
|
+
:options="record.selectpicker.options"
|
|
82
|
+
:dropdownClass="record.selectpicker.dropdownClass"
|
|
83
|
+
></c-select>
|
|
84
|
+
</div>
|
|
85
|
+
<div v-else-if="record.stackedList">
|
|
86
|
+
<c-stacked-list
|
|
87
|
+
:listItems="record.stackedList.items"
|
|
88
|
+
:divider="record.stackedList.divider"
|
|
89
|
+
></c-stacked-list>
|
|
90
|
+
</div>
|
|
91
|
+
<div v-else-if="record.colorText">
|
|
92
|
+
<p :class="record.colorText.class">
|
|
93
|
+
{{ record.colorText.value }}
|
|
94
|
+
</p>
|
|
95
|
+
<p v-if="record.colorText.description" class="text-gray-500">
|
|
96
|
+
{{ record.colorText.description }}
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
99
|
+
<div v-else>
|
|
100
|
+
<p>{{ record.record.value }}</p>
|
|
101
|
+
<div class="flex" v-if="record.record.description">
|
|
102
|
+
<slot></slot>
|
|
103
|
+
<p class="text-gray-500">
|
|
104
|
+
{{ record.record.description }}
|
|
105
|
+
</p>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</td>
|
|
109
|
+
</tr>
|
|
110
|
+
</tbody>
|
|
111
|
+
</table>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</template>
|
|
118
|
+
|
|
119
|
+
<script>
|
|
120
|
+
import CTag from "../CTag/CTag.vue";
|
|
121
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
122
|
+
import CSwitch from "../CSwitch/CSwitch.vue";
|
|
123
|
+
import CCheckbox from "../CCheckbox/CCheckbox.vue";
|
|
124
|
+
import CAvatar from "../CAvatar/CAvatar.vue";
|
|
125
|
+
import CSelect from "../CSelect/CSelect.vue";
|
|
126
|
+
import CStackedList from "../CStackedList/CStackedList.vue";
|
|
127
|
+
export default {
|
|
128
|
+
name: "CBasicTable",
|
|
129
|
+
components: {
|
|
130
|
+
CTag,
|
|
131
|
+
CIcon,
|
|
132
|
+
CSwitch,
|
|
133
|
+
CCheckbox,
|
|
134
|
+
CAvatar,
|
|
135
|
+
CStackedList,
|
|
136
|
+
CSelect,
|
|
137
|
+
},
|
|
138
|
+
props: {
|
|
139
|
+
columnData: {
|
|
140
|
+
type: Array,
|
|
141
|
+
},
|
|
142
|
+
rowRecords: {
|
|
143
|
+
type: Array,
|
|
144
|
+
},
|
|
145
|
+
enableSelection: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
},
|
|
148
|
+
selectedRow: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
},
|
|
151
|
+
disabledRow: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
},
|
|
154
|
+
rowClick: {
|
|
155
|
+
type: Function,
|
|
156
|
+
},
|
|
157
|
+
selectedIndex: {
|
|
158
|
+
type: String,
|
|
159
|
+
},
|
|
160
|
+
columnClasses: {
|
|
161
|
+
type: String,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
data() {
|
|
165
|
+
return {};
|
|
166
|
+
},
|
|
167
|
+
methods: {
|
|
168
|
+
action() {
|
|
169
|
+
this.$emit("linkAction");
|
|
170
|
+
},
|
|
171
|
+
changeAllValues(value) {
|
|
172
|
+
this.rowRecords.forEach(function (row) {
|
|
173
|
+
row.forEach(function (record) {
|
|
174
|
+
if (record.isSelected) {
|
|
175
|
+
record.isSelected.value = value;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<style></style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<nav class="flex" aria-label="Breadcrumb">
|
|
4
|
+
<ol class="flex items-center space-x-4">
|
|
5
|
+
<li v-for="nav in navObject" v-bind:key="nav.label">
|
|
6
|
+
<div class="flex items-center">
|
|
7
|
+
<c-icon
|
|
8
|
+
name="chevron-right" type="solid"
|
|
9
|
+
class="flex-shrink-0 h-5 w-5 text-gray-400"
|
|
10
|
+
></c-icon>
|
|
11
|
+
|
|
12
|
+
<a
|
|
13
|
+
:href="nav.href"
|
|
14
|
+
class="ml-4 text-sm font-medium text-gray-500 hover:text-gray-700"
|
|
15
|
+
>{{nav.label}}</a
|
|
16
|
+
>
|
|
17
|
+
</div>
|
|
18
|
+
</li>
|
|
19
|
+
</ol>
|
|
20
|
+
</nav>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
26
|
+
export default {
|
|
27
|
+
name: "CBreadcrumbs",
|
|
28
|
+
components: { CIcon },
|
|
29
|
+
props: {
|
|
30
|
+
navObject: {
|
|
31
|
+
type: Array,
|
|
32
|
+
required:true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style></style>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<button
|
|
5
|
+
v-if="type == 'tertiary'"
|
|
6
|
+
:class="customClasses"
|
|
7
|
+
class="focus:outline-none flex cursor-pointer flex-row rounded-md px-4 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"
|
|
8
|
+
@click.prevent="$emit('action')"
|
|
9
|
+
>
|
|
10
|
+
<c-icon
|
|
11
|
+
v-if="icon"
|
|
12
|
+
:type="icon.type"
|
|
13
|
+
:class="iconClasses"
|
|
14
|
+
:name="icon.name"
|
|
15
|
+
:viewBox="icon.viewBox"
|
|
16
|
+
></c-icon
|
|
17
|
+
>{{ label }}
|
|
18
|
+
<slot name="customButtonContent"></slot>
|
|
19
|
+
</button>
|
|
20
|
+
<button
|
|
21
|
+
v-else-if="type != 'tertiary' && label.length"
|
|
22
|
+
:type="type"
|
|
23
|
+
:class="classes"
|
|
24
|
+
:disabled="disabled"
|
|
25
|
+
class="focus:outline-none inline-flex items-center rounded-md px-4 py-2 text-sm font-medium shadow-sm focus:ring-2 focus:ring-offset-2 disabled:opacity-50"
|
|
26
|
+
@click.prevent="$emit('action')"
|
|
27
|
+
>
|
|
28
|
+
<c-icon v-if="isLoading" class="mr-2 h-4 w-4" name="loader"></c-icon>
|
|
29
|
+
<c-icon
|
|
30
|
+
v-if="icon && !isLoading"
|
|
31
|
+
:type="icon.type"
|
|
32
|
+
:class="iconClasses"
|
|
33
|
+
:name="icon.name"
|
|
34
|
+
:viewBox="icon.viewBox"
|
|
35
|
+
></c-icon>
|
|
36
|
+
{{ label }}
|
|
37
|
+
<slot name="customButtonContent"></slot>
|
|
38
|
+
</button>
|
|
39
|
+
<button
|
|
40
|
+
v-else-if="type != 'tertiary' && label.length == 0"
|
|
41
|
+
:type="type"
|
|
42
|
+
:class="classes"
|
|
43
|
+
:disabled="disabled"
|
|
44
|
+
class="focus:outline-none inline-flex items-center rounded-md px-3 py-2 text-sm font-medium shadow-sm focus:ring-2 focus:ring-offset-2 disabled:opacity-50"
|
|
45
|
+
@click.prevent="$emit('action')"
|
|
46
|
+
>
|
|
47
|
+
<c-icon v-if="isLoading" class="mr-2 h-4 w-4" name="loader"></c-icon>
|
|
48
|
+
<c-icon
|
|
49
|
+
v-if="icon && !isLoading"
|
|
50
|
+
:type="icon.type"
|
|
51
|
+
:class="iconClasses"
|
|
52
|
+
:name="icon.name"
|
|
53
|
+
:viewBox="icon.viewBox"
|
|
54
|
+
></c-icon>
|
|
55
|
+
<slot name="customButtonContent"></slot>
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
62
|
+
export default {
|
|
63
|
+
name: "CButton",
|
|
64
|
+
components: { CIcon },
|
|
65
|
+
props: {
|
|
66
|
+
label: {
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
icon: {
|
|
70
|
+
type: Object,
|
|
71
|
+
},
|
|
72
|
+
type: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: "primary",
|
|
75
|
+
required: true,
|
|
76
|
+
},
|
|
77
|
+
isLoading: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false,
|
|
80
|
+
},
|
|
81
|
+
disabled: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
},
|
|
84
|
+
action: {
|
|
85
|
+
type: Function,
|
|
86
|
+
},
|
|
87
|
+
customClasses: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: "",
|
|
90
|
+
},
|
|
91
|
+
iconCustomClasses: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: "",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
computed: {
|
|
98
|
+
classes() {
|
|
99
|
+
let classes = {
|
|
100
|
+
"text-gray-700 border bg-white border-gray-300 hover:bg-gray-50 focus:ring-indigo-600":
|
|
101
|
+
this.type == "white",
|
|
102
|
+
"text-indigo-700 bg-indigo-100 hover:bg-indigo-200 focus:ring-indigo-500":
|
|
103
|
+
this.type == "secondary",
|
|
104
|
+
"text-white hover:bg-indigo-800 bg-indigo-700 focus:ring-indigo-600":
|
|
105
|
+
this.type == "primary",
|
|
106
|
+
"text-white hover:bg-red-800 bg-red-700 focus:ring-red-600 border border-transparent":
|
|
107
|
+
this.type == "danger",
|
|
108
|
+
"text-white hover:bg-green-800 bg-green-700 focus:ring-green-600 border border-transparent":
|
|
109
|
+
this.type == "success",
|
|
110
|
+
"text-green-800 border border-solid border-gray-300 bg-white hover:bg-gray-50 focus:ring-indigo-600":
|
|
111
|
+
this.type == "secondary-success",
|
|
112
|
+
"text-gray-700 hover:bg-gray-200 bg-gray-100": this.type == "secondary-gray",
|
|
113
|
+
"bg-red-100 text-red-800 hover:bg-red-200 focus:ring-red-200": this.type == "light-red",
|
|
114
|
+
"bg-green-100 text-green-800 hover:bg-green-200 focus:ring-green-200":
|
|
115
|
+
this.type == "light-green",
|
|
116
|
+
"bg-gray-800 text-white hover:bg-gray-700 focus:ring-gray-500": this.type == "dark-blue",
|
|
117
|
+
"cursor-default pointer-events-none": this.isLoading,
|
|
118
|
+
};
|
|
119
|
+
classes[this.customClasses] = true;
|
|
120
|
+
return classes;
|
|
121
|
+
},
|
|
122
|
+
iconClasses() {
|
|
123
|
+
let iconClasses = {
|
|
124
|
+
"h-5 w-5 mr-1": this.iconCustomClasses ? false : true,
|
|
125
|
+
"text-indigo-400": this.type == "secondary",
|
|
126
|
+
"text-white":
|
|
127
|
+
this.type == "success" ||
|
|
128
|
+
this.type == "primary" ||
|
|
129
|
+
this.type == "danger" ||
|
|
130
|
+
this.type == "dark-blue",
|
|
131
|
+
"text-gray-400": this.type == "secondary-gray" || this.type == "white",
|
|
132
|
+
"text-red-400": this.type == "light-red",
|
|
133
|
+
};
|
|
134
|
+
iconClasses[this.iconCustomClasses] = true;
|
|
135
|
+
return iconClasses;
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
methods: {
|
|
140
|
+
onClick() {
|
|
141
|
+
this.$emit("onClick");
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<style></style>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<span
|
|
4
|
+
v-if="!hideDropdownIcon"
|
|
5
|
+
class="relative -ml-px block sm:hidden sm:shadow-sm"
|
|
6
|
+
>
|
|
7
|
+
<div>
|
|
8
|
+
<button
|
|
9
|
+
@click="showButtons = !showButtons"
|
|
10
|
+
type="button"
|
|
11
|
+
class="focus:ring-blue-600 focus:border-blue-600 focus:outline-none relative inline-flex items-center rounded-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-900 hover:bg-gray-50 focus:z-10 focus:ring-1 sm:rounded-md sm:px-3"
|
|
12
|
+
id="menu-3"
|
|
13
|
+
aria-expanded="false"
|
|
14
|
+
aria-haspopup="true"
|
|
15
|
+
>
|
|
16
|
+
<span class="">{{ buttonObject[0].label }}</span>
|
|
17
|
+
<c-icon
|
|
18
|
+
type="solid"
|
|
19
|
+
name="chevron-down"
|
|
20
|
+
class="ml-2 h-5 w-5"
|
|
21
|
+
></c-icon>
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
<div
|
|
25
|
+
v-show="showButtons"
|
|
26
|
+
class="ring-black focus:outline-none absolute z-10 mt-2 w-full origin-top-right rounded-md bg-white shadow-lg ring-1 ring-opacity-5"
|
|
27
|
+
role="menu"
|
|
28
|
+
aria-orientation="vertical"
|
|
29
|
+
>
|
|
30
|
+
<div class="py-1">
|
|
31
|
+
<a
|
|
32
|
+
v-for="button in buttonObject"
|
|
33
|
+
v-bind:key="button.label"
|
|
34
|
+
href="#"
|
|
35
|
+
class="flex px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900"
|
|
36
|
+
role="menuitem"
|
|
37
|
+
>
|
|
38
|
+
<div v-if="button.icon == ''" class="h-5"></div>
|
|
39
|
+
<c-icon
|
|
40
|
+
v-if="button.icon"
|
|
41
|
+
:name="button.icon"
|
|
42
|
+
type="solid"
|
|
43
|
+
class="-ml-1 mr-2 h-5 w-5 text-gray-400"
|
|
44
|
+
></c-icon>
|
|
45
|
+
{{ button.label }}
|
|
46
|
+
</a>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</span>
|
|
50
|
+
<span :class="buttonClass">
|
|
51
|
+
<button
|
|
52
|
+
v-for="(button, index) in buttonObject"
|
|
53
|
+
v-bind:key="button.label"
|
|
54
|
+
type="button"
|
|
55
|
+
class="focus:outline-none relative inline-flex items-center border-r border-l border-t border-b border-gray-300 bg-white px-2 py-2 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"
|
|
56
|
+
:class="{
|
|
57
|
+
'rounded-r-md rounded-l-none border-l border-r':
|
|
58
|
+
index == buttonObject.length - 1,
|
|
59
|
+
'rounded-l-md': index == 0,
|
|
60
|
+
'border-r-0': index != buttonObject.length - 1,
|
|
61
|
+
'px-4': button.label,
|
|
62
|
+
}"
|
|
63
|
+
@click="handleEvent(button.onClickAction)"
|
|
64
|
+
@blur="handleEvent(button.blurAction)"
|
|
65
|
+
>
|
|
66
|
+
<div v-if="button.icon == ''" class="h-5"></div>
|
|
67
|
+
<c-icon
|
|
68
|
+
v-if="button.icon"
|
|
69
|
+
:name="button.icon"
|
|
70
|
+
type="solid"
|
|
71
|
+
:class="button.label ? '-ml-1 mr-2' : ''"
|
|
72
|
+
class="h-5 w-5 text-gray-400"
|
|
73
|
+
></c-icon>
|
|
74
|
+
{{ button.label }}
|
|
75
|
+
<slot></slot>
|
|
76
|
+
</button>
|
|
77
|
+
</span>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script>
|
|
82
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
83
|
+
export default {
|
|
84
|
+
name: "CButtonGroup",
|
|
85
|
+
components: { CIcon },
|
|
86
|
+
props: {
|
|
87
|
+
buttonObject: {
|
|
88
|
+
type: Array,
|
|
89
|
+
required: true,
|
|
90
|
+
},
|
|
91
|
+
hideDropdownIcon: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
showButtons: false,
|
|
99
|
+
buttonClass:
|
|
100
|
+
this.hideDropdownIcon === true
|
|
101
|
+
? "z-0 relative inline-flex rounded-md block"
|
|
102
|
+
: "z-0 relative inline-flex hidden rounded-md sm:block",
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
methods: {
|
|
106
|
+
handleEvent(function_name) {
|
|
107
|
+
if (function_name) function_name();
|
|
108
|
+
},
|
|
109
|
+
buttonAction(event, value) {
|
|
110
|
+
this.$emit("onClick", value);
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<style></style>
|
|
@@ -0,0 +1,91 @@
|
|
|
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>
|
|
@@ -0,0 +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>
|