classcard-ui 0.2.705 → 0.2.708
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 +68 -75
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +68 -75
- 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 +96 -96
- 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 +112 -112
- 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 +147 -147
- 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 -91
- 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/CCalendar/CCalendar.vue +401 -401
- package/src/components/CCalendar/index.js +3 -3
- 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 +139 -139
- 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 +96 -96
- package/src/components/CEditor/index.js +2 -2
- package/src/components/CFormSectionHeading/CFormSectionHeading.vue +53 -53
- package/src/components/CFormSectionHeading/index.js +2 -2
- package/src/components/CGroupedSelect/CGroupedSelect.vue +217 -217
- package/src/components/CGroupedSelect/index.js +3 -3
- package/src/components/CIcon/CIcon.vue +77 -77
- package/src/components/CIcon/index.js +2 -2
- package/src/components/CIconDropdown/CIconDropdown.vue +111 -111
- package/src/components/CIconDropdown/index.js +2 -2
- package/src/components/CInput/CInput.vue +120 -120
- package/src/components/CInput/index.js +2 -2
- package/src/components/CInputAddon/CInputAddon.vue +202 -202
- package/src/components/CInputAddon/index.js +2 -2
- package/src/components/CInputEmail/CInputEmail.vue +93 -93
- 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 +339 -339
- 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 +81 -81
- package/src/components/CPhoneNumber/index.js +2 -2
- package/src/components/CRadio/CRadio.vue +106 -106
- 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 +348 -343
- 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 +132 -132
- package/src/components/CStackedList/index.js +2 -2
- package/src/components/CStats/CStats.vue +111 -111
- package/src/components/CStats/index.js +2 -2
- package/src/components/CSwitch/CSwitch.vue +140 -140
- package/src/components/CSwitch/index.js +2 -2
- package/src/components/CTable/CTable.vue +536 -536
- package/src/components/CTable/index.js +2 -2
- package/src/components/CTabs/CTabs.vue +111 -111
- 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 +95 -95
- 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 +231 -231
- package/src/components/CUpload/index.js +2 -2
- package/src/components/index.js +48 -48
- package/src/icons.js +285 -285
- 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/CCalendar.stories.js +16 -16
- 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 +33 -33
- 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,231 +1,231 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex h-full flex-col">
|
|
3
|
-
<div class="flex items-center justify-between">
|
|
4
|
-
<div class="flex items-center">
|
|
5
|
-
<!-- label of input field -->
|
|
6
|
-
<label class="block text-sm font-medium text-gray-900">{{ label }}</label>
|
|
7
|
-
<!-- asterisk sign to render if field is required -->
|
|
8
|
-
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
9
|
-
</div>
|
|
10
|
-
<label v-if="!isUploaded" class="block text-sm font-medium text-gray-400">
|
|
11
|
-
{{ hint }}
|
|
12
|
-
</label>
|
|
13
|
-
</div>
|
|
14
|
-
<button
|
|
15
|
-
type="button"
|
|
16
|
-
class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
|
|
17
|
-
@click="initFilestack()"
|
|
18
|
-
v-if="displayMode == 'overlay' && icon"
|
|
19
|
-
>
|
|
20
|
-
<c-icon
|
|
21
|
-
:type="icon.type"
|
|
22
|
-
:class="icon.class"
|
|
23
|
-
:name="icon.name"
|
|
24
|
-
:viewBox="icon.viewBox"
|
|
25
|
-
></c-icon>
|
|
26
|
-
{{ buttonText }}
|
|
27
|
-
</button>
|
|
28
|
-
<button
|
|
29
|
-
type="button"
|
|
30
|
-
class="mt-1.5 flex h-full w-auto items-center justify-center rounded-lg border-2 border-dashed border-gray-300 px-9 py-14 text-center hover:border-gray-400 focus:outline-none"
|
|
31
|
-
@click="initFilestack()"
|
|
32
|
-
v-if="displayMode == 'overlay' && !icon && !isAvatar"
|
|
33
|
-
>
|
|
34
|
-
<c-icon
|
|
35
|
-
name="arrow-up"
|
|
36
|
-
type="solid"
|
|
37
|
-
class="mr-1 h-5 w-5 flex-none text-indigo-600"
|
|
38
|
-
viewBox="0 0 20 20"
|
|
39
|
-
></c-icon>
|
|
40
|
-
<span class="text-sm font-medium text-indigo-900"> Upload </span>
|
|
41
|
-
</button>
|
|
42
|
-
<div
|
|
43
|
-
class="relative hidden h-full w-full overflow-hidden rounded-full lg:block"
|
|
44
|
-
@click="initFilestack()"
|
|
45
|
-
v-if="displayMode == 'overlay' && !icon && isAvatar"
|
|
46
|
-
>
|
|
47
|
-
<img
|
|
48
|
-
v-if="imageUrl"
|
|
49
|
-
class="relative h-full w-full rounded-full object-cover"
|
|
50
|
-
:src="imageUrl"
|
|
51
|
-
/>
|
|
52
|
-
<c-avatar
|
|
53
|
-
v-else
|
|
54
|
-
size="very large"
|
|
55
|
-
:nameInitials="shortName"
|
|
56
|
-
:isDynamicallyColored="coloredAvatars"
|
|
57
|
-
:rounded="true"
|
|
58
|
-
></c-avatar>
|
|
59
|
-
<label
|
|
60
|
-
class="absolute inset-0 flex h-full w-full cursor-pointer items-center justify-center bg-gray-900 bg-opacity-75 text-sm font-medium text-white opacity-0 focus-within:opacity-100 hover:opacity-100"
|
|
61
|
-
>
|
|
62
|
-
<c-icon
|
|
63
|
-
v-if="openIcon"
|
|
64
|
-
:name="openIcon.name"
|
|
65
|
-
:type="openIcon.type"
|
|
66
|
-
:class="openIcon.class"
|
|
67
|
-
></c-icon>
|
|
68
|
-
<span>{{ uploadText }}</span>
|
|
69
|
-
<span class="sr-only"> user photo</span>
|
|
70
|
-
</label>
|
|
71
|
-
</div>
|
|
72
|
-
<div :class="filestackClasses" id="filestack-uploader"></div>
|
|
73
|
-
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
74
|
-
{{ errorMessage }}
|
|
75
|
-
</p>
|
|
76
|
-
<!-- description about the input field -->
|
|
77
|
-
<p v-if="helpText && isValidate == true" class="mt-2 text-sm text-gray-500">
|
|
78
|
-
{{ helpText }}
|
|
79
|
-
</p>
|
|
80
|
-
</div>
|
|
81
|
-
</template>
|
|
82
|
-
|
|
83
|
-
<script>
|
|
84
|
-
import * as filestack from "filestack-js";
|
|
85
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
86
|
-
import CAvatar from "../CAvatar/CAvatar.vue";
|
|
87
|
-
|
|
88
|
-
export default {
|
|
89
|
-
name: "CUpload",
|
|
90
|
-
components: {
|
|
91
|
-
CIcon,
|
|
92
|
-
CAvatar,
|
|
93
|
-
},
|
|
94
|
-
props: {
|
|
95
|
-
buttonText: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: "Upload",
|
|
98
|
-
},
|
|
99
|
-
isAvatar: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: false,
|
|
102
|
-
},
|
|
103
|
-
shortName: {
|
|
104
|
-
type: String,
|
|
105
|
-
},
|
|
106
|
-
imageUrl: {
|
|
107
|
-
type: String,
|
|
108
|
-
default: "",
|
|
109
|
-
},
|
|
110
|
-
icon: {
|
|
111
|
-
type: Object,
|
|
112
|
-
},
|
|
113
|
-
fileSize: {
|
|
114
|
-
type: String,
|
|
115
|
-
},
|
|
116
|
-
openIcon: {
|
|
117
|
-
type: Object,
|
|
118
|
-
},
|
|
119
|
-
uploadText: {
|
|
120
|
-
type: String,
|
|
121
|
-
default: "Change",
|
|
122
|
-
},
|
|
123
|
-
hint: {
|
|
124
|
-
type: String,
|
|
125
|
-
default: "",
|
|
126
|
-
},
|
|
127
|
-
helpText: {
|
|
128
|
-
type: String,
|
|
129
|
-
},
|
|
130
|
-
label: {
|
|
131
|
-
type: String,
|
|
132
|
-
default: "",
|
|
133
|
-
},
|
|
134
|
-
isValidate: { type: Boolean },
|
|
135
|
-
errorMessage: {
|
|
136
|
-
type: String,
|
|
137
|
-
},
|
|
138
|
-
filestackApiKey: {
|
|
139
|
-
type: String,
|
|
140
|
-
default: "",
|
|
141
|
-
},
|
|
142
|
-
filestackClasses: {
|
|
143
|
-
type: String,
|
|
144
|
-
default: "w-96 h-96",
|
|
145
|
-
},
|
|
146
|
-
url: {
|
|
147
|
-
type: String,
|
|
148
|
-
},
|
|
149
|
-
maxFiles: {
|
|
150
|
-
type: Number,
|
|
151
|
-
default: 1,
|
|
152
|
-
},
|
|
153
|
-
onUploadSuccess: {
|
|
154
|
-
type: Function,
|
|
155
|
-
},
|
|
156
|
-
aspectRatio: {
|
|
157
|
-
type: Number,
|
|
158
|
-
default: null,
|
|
159
|
-
},
|
|
160
|
-
onUploadOpen: {
|
|
161
|
-
type: Function,
|
|
162
|
-
},
|
|
163
|
-
displayMode: {
|
|
164
|
-
type: String,
|
|
165
|
-
default: "inline",
|
|
166
|
-
},
|
|
167
|
-
isUploaded: {
|
|
168
|
-
type: Boolean,
|
|
169
|
-
default: false,
|
|
170
|
-
},
|
|
171
|
-
isCircle: {
|
|
172
|
-
type: Boolean,
|
|
173
|
-
default: false,
|
|
174
|
-
},
|
|
175
|
-
coloredAvatars: {
|
|
176
|
-
type: Boolean,
|
|
177
|
-
default: false,
|
|
178
|
-
},
|
|
179
|
-
uploadSources: {
|
|
180
|
-
type: Array,
|
|
181
|
-
default: () => ["local_file_system", "unsplash"],
|
|
182
|
-
},
|
|
183
|
-
isRequired:{
|
|
184
|
-
type:Boolean
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
data() {
|
|
188
|
-
return {};
|
|
189
|
-
},
|
|
190
|
-
methods: {
|
|
191
|
-
initFilestack() {
|
|
192
|
-
const client = filestack.init(this.filestackApiKey);
|
|
193
|
-
const options = {
|
|
194
|
-
displayMode: this.displayMode,
|
|
195
|
-
container: "#filestack-uploader",
|
|
196
|
-
uploadInBackground: false,
|
|
197
|
-
maxFiles: this.maxFiles,
|
|
198
|
-
onOpen: (param) => this.$emit("onUploadOpen", param),
|
|
199
|
-
onClose: (param) => this.$emit("onUploadOpen", param),
|
|
200
|
-
onUploadDone: (res) => this.$emit("filestack-uploaded", res),
|
|
201
|
-
fromSources: this.uploadSources,
|
|
202
|
-
transformations: {
|
|
203
|
-
crop: {
|
|
204
|
-
aspectRatio: this.aspectRatio ? this.aspectRatio : 0,
|
|
205
|
-
force: this.aspectRatio ? true : false,
|
|
206
|
-
},
|
|
207
|
-
circle: this.isCircle,
|
|
208
|
-
},
|
|
209
|
-
};
|
|
210
|
-
const picker = client.picker(options);
|
|
211
|
-
picker.open();
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
computed: {
|
|
215
|
-
errorClasses() {
|
|
216
|
-
return {
|
|
217
|
-
"border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":
|
|
218
|
-
this.isValidate == false,
|
|
219
|
-
"border-gray-300 border-dashed": this.isValidate == true,
|
|
220
|
-
};
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
mounted() {
|
|
224
|
-
if (this.displayMode == "inline") {
|
|
225
|
-
this.initFilestack();
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
};
|
|
229
|
-
</script>
|
|
230
|
-
|
|
231
|
-
<style></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex h-full flex-col">
|
|
3
|
+
<div class="flex items-center justify-between">
|
|
4
|
+
<div class="flex items-center">
|
|
5
|
+
<!-- label of input field -->
|
|
6
|
+
<label class="block text-sm font-medium text-gray-900">{{ label }}</label>
|
|
7
|
+
<!-- asterisk sign to render if field is required -->
|
|
8
|
+
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
9
|
+
</div>
|
|
10
|
+
<label v-if="!isUploaded" class="block text-sm font-medium text-gray-400">
|
|
11
|
+
{{ hint }}
|
|
12
|
+
</label>
|
|
13
|
+
</div>
|
|
14
|
+
<button
|
|
15
|
+
type="button"
|
|
16
|
+
class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
|
|
17
|
+
@click="initFilestack()"
|
|
18
|
+
v-if="displayMode == 'overlay' && icon"
|
|
19
|
+
>
|
|
20
|
+
<c-icon
|
|
21
|
+
:type="icon.type"
|
|
22
|
+
:class="icon.class"
|
|
23
|
+
:name="icon.name"
|
|
24
|
+
:viewBox="icon.viewBox"
|
|
25
|
+
></c-icon>
|
|
26
|
+
{{ buttonText }}
|
|
27
|
+
</button>
|
|
28
|
+
<button
|
|
29
|
+
type="button"
|
|
30
|
+
class="mt-1.5 flex h-full w-auto items-center justify-center rounded-lg border-2 border-dashed border-gray-300 px-9 py-14 text-center hover:border-gray-400 focus:outline-none"
|
|
31
|
+
@click="initFilestack()"
|
|
32
|
+
v-if="displayMode == 'overlay' && !icon && !isAvatar"
|
|
33
|
+
>
|
|
34
|
+
<c-icon
|
|
35
|
+
name="arrow-up"
|
|
36
|
+
type="solid"
|
|
37
|
+
class="mr-1 h-5 w-5 flex-none text-indigo-600"
|
|
38
|
+
viewBox="0 0 20 20"
|
|
39
|
+
></c-icon>
|
|
40
|
+
<span class="text-sm font-medium text-indigo-900"> Upload </span>
|
|
41
|
+
</button>
|
|
42
|
+
<div
|
|
43
|
+
class="relative hidden h-full w-full overflow-hidden rounded-full lg:block"
|
|
44
|
+
@click="initFilestack()"
|
|
45
|
+
v-if="displayMode == 'overlay' && !icon && isAvatar"
|
|
46
|
+
>
|
|
47
|
+
<img
|
|
48
|
+
v-if="imageUrl"
|
|
49
|
+
class="relative h-full w-full rounded-full object-cover"
|
|
50
|
+
:src="imageUrl"
|
|
51
|
+
/>
|
|
52
|
+
<c-avatar
|
|
53
|
+
v-else
|
|
54
|
+
size="very large"
|
|
55
|
+
:nameInitials="shortName"
|
|
56
|
+
:isDynamicallyColored="coloredAvatars"
|
|
57
|
+
:rounded="true"
|
|
58
|
+
></c-avatar>
|
|
59
|
+
<label
|
|
60
|
+
class="absolute inset-0 flex h-full w-full cursor-pointer items-center justify-center bg-gray-900 bg-opacity-75 text-sm font-medium text-white opacity-0 focus-within:opacity-100 hover:opacity-100"
|
|
61
|
+
>
|
|
62
|
+
<c-icon
|
|
63
|
+
v-if="openIcon"
|
|
64
|
+
:name="openIcon.name"
|
|
65
|
+
:type="openIcon.type"
|
|
66
|
+
:class="openIcon.class"
|
|
67
|
+
></c-icon>
|
|
68
|
+
<span>{{ uploadText }}</span>
|
|
69
|
+
<span class="sr-only"> user photo</span>
|
|
70
|
+
</label>
|
|
71
|
+
</div>
|
|
72
|
+
<div :class="filestackClasses" id="filestack-uploader"></div>
|
|
73
|
+
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
74
|
+
{{ errorMessage }}
|
|
75
|
+
</p>
|
|
76
|
+
<!-- description about the input field -->
|
|
77
|
+
<p v-if="helpText && isValidate == true" class="mt-2 text-sm text-gray-500">
|
|
78
|
+
{{ helpText }}
|
|
79
|
+
</p>
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<script>
|
|
84
|
+
import * as filestack from "filestack-js";
|
|
85
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
86
|
+
import CAvatar from "../CAvatar/CAvatar.vue";
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
name: "CUpload",
|
|
90
|
+
components: {
|
|
91
|
+
CIcon,
|
|
92
|
+
CAvatar,
|
|
93
|
+
},
|
|
94
|
+
props: {
|
|
95
|
+
buttonText: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: "Upload",
|
|
98
|
+
},
|
|
99
|
+
isAvatar: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
102
|
+
},
|
|
103
|
+
shortName: {
|
|
104
|
+
type: String,
|
|
105
|
+
},
|
|
106
|
+
imageUrl: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: "",
|
|
109
|
+
},
|
|
110
|
+
icon: {
|
|
111
|
+
type: Object,
|
|
112
|
+
},
|
|
113
|
+
fileSize: {
|
|
114
|
+
type: String,
|
|
115
|
+
},
|
|
116
|
+
openIcon: {
|
|
117
|
+
type: Object,
|
|
118
|
+
},
|
|
119
|
+
uploadText: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: "Change",
|
|
122
|
+
},
|
|
123
|
+
hint: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: "",
|
|
126
|
+
},
|
|
127
|
+
helpText: {
|
|
128
|
+
type: String,
|
|
129
|
+
},
|
|
130
|
+
label: {
|
|
131
|
+
type: String,
|
|
132
|
+
default: "",
|
|
133
|
+
},
|
|
134
|
+
isValidate: { type: Boolean },
|
|
135
|
+
errorMessage: {
|
|
136
|
+
type: String,
|
|
137
|
+
},
|
|
138
|
+
filestackApiKey: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: "",
|
|
141
|
+
},
|
|
142
|
+
filestackClasses: {
|
|
143
|
+
type: String,
|
|
144
|
+
default: "w-96 h-96",
|
|
145
|
+
},
|
|
146
|
+
url: {
|
|
147
|
+
type: String,
|
|
148
|
+
},
|
|
149
|
+
maxFiles: {
|
|
150
|
+
type: Number,
|
|
151
|
+
default: 1,
|
|
152
|
+
},
|
|
153
|
+
onUploadSuccess: {
|
|
154
|
+
type: Function,
|
|
155
|
+
},
|
|
156
|
+
aspectRatio: {
|
|
157
|
+
type: Number,
|
|
158
|
+
default: null,
|
|
159
|
+
},
|
|
160
|
+
onUploadOpen: {
|
|
161
|
+
type: Function,
|
|
162
|
+
},
|
|
163
|
+
displayMode: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: "inline",
|
|
166
|
+
},
|
|
167
|
+
isUploaded: {
|
|
168
|
+
type: Boolean,
|
|
169
|
+
default: false,
|
|
170
|
+
},
|
|
171
|
+
isCircle: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: false,
|
|
174
|
+
},
|
|
175
|
+
coloredAvatars: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: false,
|
|
178
|
+
},
|
|
179
|
+
uploadSources: {
|
|
180
|
+
type: Array,
|
|
181
|
+
default: () => ["local_file_system", "unsplash"],
|
|
182
|
+
},
|
|
183
|
+
isRequired:{
|
|
184
|
+
type:Boolean
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
data() {
|
|
188
|
+
return {};
|
|
189
|
+
},
|
|
190
|
+
methods: {
|
|
191
|
+
initFilestack() {
|
|
192
|
+
const client = filestack.init(this.filestackApiKey);
|
|
193
|
+
const options = {
|
|
194
|
+
displayMode: this.displayMode,
|
|
195
|
+
container: "#filestack-uploader",
|
|
196
|
+
uploadInBackground: false,
|
|
197
|
+
maxFiles: this.maxFiles,
|
|
198
|
+
onOpen: (param) => this.$emit("onUploadOpen", param),
|
|
199
|
+
onClose: (param) => this.$emit("onUploadOpen", param),
|
|
200
|
+
onUploadDone: (res) => this.$emit("filestack-uploaded", res),
|
|
201
|
+
fromSources: this.uploadSources,
|
|
202
|
+
transformations: {
|
|
203
|
+
crop: {
|
|
204
|
+
aspectRatio: this.aspectRatio ? this.aspectRatio : 0,
|
|
205
|
+
force: this.aspectRatio ? true : false,
|
|
206
|
+
},
|
|
207
|
+
circle: this.isCircle,
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
const picker = client.picker(options);
|
|
211
|
+
picker.open();
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
computed: {
|
|
215
|
+
errorClasses() {
|
|
216
|
+
return {
|
|
217
|
+
"border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":
|
|
218
|
+
this.isValidate == false,
|
|
219
|
+
"border-gray-300 border-dashed": this.isValidate == true,
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
mounted() {
|
|
224
|
+
if (this.displayMode == "inline") {
|
|
225
|
+
this.initFilestack();
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
</script>
|
|
230
|
+
|
|
231
|
+
<style></style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CUpload from './CUpload.vue'
|
|
2
|
-
|
|
1
|
+
import CUpload from './CUpload.vue'
|
|
2
|
+
|
|
3
3
|
export default CUpload
|
package/src/components/index.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
export { default as CAlerts } from "./CAlerts";
|
|
2
|
-
export { default as CAnchorTabs } from "./CAnchorTabs";
|
|
3
|
-
export { default as CAnchorTag } from "./CAnchorTag";
|
|
4
|
-
export { default as CAvatar } from "./CAvatar";
|
|
5
|
-
export { default as CAvatarGroup } from "./CAvatarGroup";
|
|
6
|
-
export { default as CBasicTable } from "./CBasicTable";
|
|
7
|
-
export { default as CBreadcrumbs } from "./CBreadcrumbs";
|
|
8
|
-
export { default as CButton } from "./CButton";
|
|
9
|
-
export { default as CButtonGroup } from "./CButtonGroup";
|
|
10
|
-
export { default as CButtonIcon } from "./CButtonIcon";
|
|
11
|
-
export { default as CButtonLink } from "./CButtonLink";
|
|
12
|
-
export { default as CButtonSelect } from "./CButtonSelect";
|
|
13
|
-
export { default as CButtonWithDropdown } from "./CButtonWithDropdown";
|
|
14
|
-
export { default as CCard } from "./CCard";
|
|
15
|
-
export { default as CCheckbox } from "./CCheckbox";
|
|
16
|
-
export { default as CCollapsibleSection } from "./CCollapsibleSection";
|
|
17
|
-
export { default as CColorDots } from "./CColorDots";
|
|
18
|
-
export { default as CDatepicker } from "./CDatepicker";
|
|
19
|
-
export { default as CDualSelect } from "./CEditor";
|
|
20
|
-
export { default as CEditor } from "./CDualSelect";
|
|
21
|
-
export { default as CFormSectionHeading } from "./CFormSectionHeading";
|
|
22
|
-
export { default as CIcon } from "./CIcon";
|
|
23
|
-
export { default as CGroupedSelect } from "./CGroupedSelect";
|
|
24
|
-
export { default as CIconDropdown } from "./CIconDropdown";
|
|
25
|
-
export { default as CInput } from "./CInput";
|
|
26
|
-
export { default as CInputAddon } from "./CInputAddon";
|
|
27
|
-
export { default as CInputEmail } from "./CInputEmail";
|
|
28
|
-
export { default as CModalHeading } from "./CModalHeading";
|
|
29
|
-
export { default as CModuleHelpLinks } from "./CModuleHelpLinks";
|
|
30
|
-
export { default as CMultiselect } from "./CMultiselect";
|
|
31
|
-
export { default as CPageHeading } from "./CPageHeading";
|
|
32
|
-
export { default as CPagination } from "./CPagination";
|
|
33
|
-
export { default as CPhoneNumber } from "./CPhoneNumber";
|
|
34
|
-
export { default as CRadio } from "./CRadio";
|
|
35
|
-
export { default as CReorderableStackedList } from "./CReorderableStackedList";
|
|
36
|
-
export { default as CSelect } from "./CSelect";
|
|
37
|
-
export { default as CSmallTimeline } from "./CSmallTimeline";
|
|
38
|
-
export { default as CStackedList } from "./CStackedList";
|
|
39
|
-
export { default as CStats } from "./CStats";
|
|
40
|
-
export { default as CSwitch } from "./CSwitch";
|
|
41
|
-
export { default as CTable } from "./CTable";
|
|
42
|
-
export { default as CTabs } from "./CTabs";
|
|
43
|
-
export { default as CTag } from "./CTag";
|
|
44
|
-
export { default as CTextarea } from "./CTextarea";
|
|
45
|
-
export { default as CTimeline } from "./CTimeline";
|
|
46
|
-
export { default as CUpload } from "./CUpload";
|
|
47
|
-
export { default as CConfirmActionModal } from "./CConfirmActionModal";
|
|
48
|
-
export { default as CCalendar } from "./CCalendar";
|
|
1
|
+
export { default as CAlerts } from "./CAlerts";
|
|
2
|
+
export { default as CAnchorTabs } from "./CAnchorTabs";
|
|
3
|
+
export { default as CAnchorTag } from "./CAnchorTag";
|
|
4
|
+
export { default as CAvatar } from "./CAvatar";
|
|
5
|
+
export { default as CAvatarGroup } from "./CAvatarGroup";
|
|
6
|
+
export { default as CBasicTable } from "./CBasicTable";
|
|
7
|
+
export { default as CBreadcrumbs } from "./CBreadcrumbs";
|
|
8
|
+
export { default as CButton } from "./CButton";
|
|
9
|
+
export { default as CButtonGroup } from "./CButtonGroup";
|
|
10
|
+
export { default as CButtonIcon } from "./CButtonIcon";
|
|
11
|
+
export { default as CButtonLink } from "./CButtonLink";
|
|
12
|
+
export { default as CButtonSelect } from "./CButtonSelect";
|
|
13
|
+
export { default as CButtonWithDropdown } from "./CButtonWithDropdown";
|
|
14
|
+
export { default as CCard } from "./CCard";
|
|
15
|
+
export { default as CCheckbox } from "./CCheckbox";
|
|
16
|
+
export { default as CCollapsibleSection } from "./CCollapsibleSection";
|
|
17
|
+
export { default as CColorDots } from "./CColorDots";
|
|
18
|
+
export { default as CDatepicker } from "./CDatepicker";
|
|
19
|
+
export { default as CDualSelect } from "./CEditor";
|
|
20
|
+
export { default as CEditor } from "./CDualSelect";
|
|
21
|
+
export { default as CFormSectionHeading } from "./CFormSectionHeading";
|
|
22
|
+
export { default as CIcon } from "./CIcon";
|
|
23
|
+
export { default as CGroupedSelect } from "./CGroupedSelect";
|
|
24
|
+
export { default as CIconDropdown } from "./CIconDropdown";
|
|
25
|
+
export { default as CInput } from "./CInput";
|
|
26
|
+
export { default as CInputAddon } from "./CInputAddon";
|
|
27
|
+
export { default as CInputEmail } from "./CInputEmail";
|
|
28
|
+
export { default as CModalHeading } from "./CModalHeading";
|
|
29
|
+
export { default as CModuleHelpLinks } from "./CModuleHelpLinks";
|
|
30
|
+
export { default as CMultiselect } from "./CMultiselect";
|
|
31
|
+
export { default as CPageHeading } from "./CPageHeading";
|
|
32
|
+
export { default as CPagination } from "./CPagination";
|
|
33
|
+
export { default as CPhoneNumber } from "./CPhoneNumber";
|
|
34
|
+
export { default as CRadio } from "./CRadio";
|
|
35
|
+
export { default as CReorderableStackedList } from "./CReorderableStackedList";
|
|
36
|
+
export { default as CSelect } from "./CSelect";
|
|
37
|
+
export { default as CSmallTimeline } from "./CSmallTimeline";
|
|
38
|
+
export { default as CStackedList } from "./CStackedList";
|
|
39
|
+
export { default as CStats } from "./CStats";
|
|
40
|
+
export { default as CSwitch } from "./CSwitch";
|
|
41
|
+
export { default as CTable } from "./CTable";
|
|
42
|
+
export { default as CTabs } from "./CTabs";
|
|
43
|
+
export { default as CTag } from "./CTag";
|
|
44
|
+
export { default as CTextarea } from "./CTextarea";
|
|
45
|
+
export { default as CTimeline } from "./CTimeline";
|
|
46
|
+
export { default as CUpload } from "./CUpload";
|
|
47
|
+
export { default as CConfirmActionModal } from "./CConfirmActionModal";
|
|
48
|
+
export { default as CCalendar } from "./CCalendar";
|