classcard-ui 0.2.299 → 0.2.303
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 +98 -72
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +98 -72
- 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 +1 -1
- package/src/components/CDatepicker/CDatepicker.vue +29 -11
- package/src/components/CMultiselect/CMultiselect.vue +18 -18
- package/src/components/CSelect/CSelect.vue +20 -16
- package/src/icons.js +2 -0
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<div
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
<div class="flex items-center">
|
|
4
|
+
<div v-if="label">
|
|
5
|
+
<label class="block text-sm font-medium text-gray-900">
|
|
6
|
+
{{ label }}
|
|
7
|
+
</label>
|
|
8
|
+
</div>
|
|
9
|
+
<!-- asterisk sign to render if field is required -->
|
|
10
|
+
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
7
11
|
</div>
|
|
8
12
|
<v-date-picker
|
|
9
13
|
:class="{ 'inline-block h-full': true, 'w-full': isExpanded }"
|
|
@@ -14,12 +18,12 @@
|
|
|
14
18
|
firstDayOfWeek="2"
|
|
15
19
|
>
|
|
16
20
|
<template v-slot="{ inputValue, togglePopover }">
|
|
17
|
-
<div class="flex items-center
|
|
21
|
+
<div class="mt-1 flex items-center">
|
|
18
22
|
<button
|
|
19
23
|
type="button"
|
|
20
24
|
:class="[
|
|
21
|
-
disabled ? 'border-gray-100
|
|
22
|
-
'
|
|
25
|
+
disabled ? 'pointer-events-none border-gray-100' : 'border-gray-300',
|
|
26
|
+
'bg-blue-100 hover:bg-blue-200 text-blue-600 focus:bg-blue-500 focus:border-blue-500 focus:outline-none rounded-l-md border p-2 shadow-sm focus:text-white',
|
|
23
27
|
]"
|
|
24
28
|
@click="togglePopover()"
|
|
25
29
|
>
|
|
@@ -33,9 +37,9 @@
|
|
|
33
37
|
:value="inputValue"
|
|
34
38
|
:class="[
|
|
35
39
|
disabled
|
|
36
|
-
? 'border-
|
|
37
|
-
: 'border-
|
|
38
|
-
'
|
|
40
|
+
? 'border-l-0 border-gray-100 text-gray-400'
|
|
41
|
+
: 'border-l-0 border-gray-300 text-gray-900',
|
|
42
|
+
'focus:outline-none focus:border-blue-500 w-full appearance-none rounded-r-md border bg-white p-2 text-sm shadow-sm',
|
|
39
43
|
]"
|
|
40
44
|
:readonly="disabled"
|
|
41
45
|
@click="togglePopover()"
|
|
@@ -43,7 +47,11 @@
|
|
|
43
47
|
</div>
|
|
44
48
|
</template>
|
|
45
49
|
</v-date-picker>
|
|
46
|
-
|
|
50
|
+
<!-- validation error message -->
|
|
51
|
+
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
52
|
+
{{ errorMessage }}
|
|
53
|
+
</p>
|
|
54
|
+
<p v-if="helpText && isValidate == true" class="mt-1 text-sm text-gray-500">
|
|
47
55
|
{{ helpText }}
|
|
48
56
|
</p>
|
|
49
57
|
</div>
|
|
@@ -63,6 +71,9 @@ export default {
|
|
|
63
71
|
classes: {
|
|
64
72
|
type: String,
|
|
65
73
|
},
|
|
74
|
+
isRequired: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
},
|
|
66
77
|
label: {
|
|
67
78
|
type: String,
|
|
68
79
|
},
|
|
@@ -84,6 +95,13 @@ export default {
|
|
|
84
95
|
type: Boolean,
|
|
85
96
|
default: false,
|
|
86
97
|
},
|
|
98
|
+
isValidate: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: true,
|
|
101
|
+
},
|
|
102
|
+
errorMessage: {
|
|
103
|
+
type: String,
|
|
104
|
+
},
|
|
87
105
|
},
|
|
88
106
|
data() {
|
|
89
107
|
const masks = {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
4
|
-
label
|
|
5
|
-
|
|
3
|
+
<div class="flex items-center">
|
|
4
|
+
<label v-if="label" class="text-sm font-medium text-gray-900">{{ label }}</label>
|
|
5
|
+
<!-- asterisk sign to render if field is required -->
|
|
6
|
+
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
7
|
+
</div>
|
|
6
8
|
<p v-if="subLabel" class="text-sm text-gray-500">{{ subLabel }}</p>
|
|
7
9
|
<v-select
|
|
8
|
-
class="text-sm
|
|
10
|
+
class="mt-1 text-sm"
|
|
9
11
|
:placeholder="placeholder"
|
|
10
12
|
:multiple="isMultiple"
|
|
11
13
|
:taggable="isTaggable"
|
|
@@ -24,7 +26,7 @@
|
|
|
24
26
|
<span v-bind="attributes">
|
|
25
27
|
<svg
|
|
26
28
|
xmlns="http://www.w3.org/2000/svg"
|
|
27
|
-
class="h-5 w-5 text-gray-400
|
|
29
|
+
class="h-5 w-5 cursor-pointer text-gray-400"
|
|
28
30
|
viewBox="0 0 20 20"
|
|
29
31
|
fill="currentColor"
|
|
30
32
|
>
|
|
@@ -38,14 +40,12 @@
|
|
|
38
40
|
</template>
|
|
39
41
|
<!-- eslint-disable-next-line vue/no-unused-vars -->
|
|
40
42
|
<template #no-options="{ search, searching, loading }">
|
|
41
|
-
<span v-if="search.length < 1"
|
|
42
|
-
>Start typing to search for options...</span
|
|
43
|
-
>
|
|
43
|
+
<span v-if="search.length < 1">Start typing to search for options...</span>
|
|
44
44
|
<span v-else>No options found, try searching something else.</span>
|
|
45
45
|
</template>
|
|
46
46
|
<template #spinner="{ loading }">
|
|
47
47
|
<svg
|
|
48
|
-
class="
|
|
48
|
+
class="h-5 w-5 animate-spin text-gray-400"
|
|
49
49
|
xmlns="http://www.w3.org/2000/svg"
|
|
50
50
|
fill="none"
|
|
51
51
|
viewBox="0 0 24 24"
|
|
@@ -108,6 +108,9 @@ export default {
|
|
|
108
108
|
required: true,
|
|
109
109
|
},
|
|
110
110
|
label: String,
|
|
111
|
+
isRequired: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
},
|
|
111
114
|
subLabel: String,
|
|
112
115
|
placeholder: {
|
|
113
116
|
type: String,
|
|
@@ -145,7 +148,7 @@ export default {
|
|
|
145
148
|
type: Function,
|
|
146
149
|
},
|
|
147
150
|
optionsSelected: {
|
|
148
|
-
type: Array,
|
|
151
|
+
type: [Array, Object],
|
|
149
152
|
},
|
|
150
153
|
filterable: {
|
|
151
154
|
type: Boolean,
|
|
@@ -171,10 +174,7 @@ export default {
|
|
|
171
174
|
data() {
|
|
172
175
|
return {
|
|
173
176
|
loaderSearching: true,
|
|
174
|
-
value:
|
|
175
|
-
this.optionsSelected && this.optionsSelected.length
|
|
176
|
-
? this.optionsSelected
|
|
177
|
-
: [],
|
|
177
|
+
value: this.optionsSelected && this.optionsSelected.length ? this.optionsSelected : [],
|
|
178
178
|
};
|
|
179
179
|
},
|
|
180
180
|
methods: {
|
|
@@ -198,17 +198,17 @@ export default {
|
|
|
198
198
|
@apply cursor-pointer;
|
|
199
199
|
}
|
|
200
200
|
.vs__dropdown-toggle {
|
|
201
|
-
@apply
|
|
201
|
+
@apply focus:outline-none w-full rounded-md border border-gray-300 bg-white py-2 pl-3 text-left shadow-sm focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 sm:text-sm;
|
|
202
202
|
}
|
|
203
203
|
.vs__selected-options {
|
|
204
|
-
@apply overflow-hidden
|
|
204
|
+
@apply flex-nowrap overflow-hidden;
|
|
205
205
|
}
|
|
206
206
|
.vs--open .vs__dropdown-toggle {
|
|
207
207
|
border-bottom-color: rgba(212, 212, 216, var(--tw-border-opacity));
|
|
208
208
|
@apply rounded-b-md;
|
|
209
209
|
}
|
|
210
210
|
.vs__selected {
|
|
211
|
-
@apply border-none
|
|
211
|
+
@apply m-0 mr-1 border-none py-0 pl-0 pr-1.5;
|
|
212
212
|
}
|
|
213
213
|
.vs__selected-options {
|
|
214
214
|
@apply pl-0;
|
|
@@ -221,7 +221,7 @@ export default {
|
|
|
221
221
|
@apply pt-0 pr-3;
|
|
222
222
|
}
|
|
223
223
|
.vs__dropdown-menu {
|
|
224
|
-
@apply mt-2
|
|
224
|
+
@apply focus:outline-none mt-2 max-h-60 overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-opacity-5 sm:text-sm;
|
|
225
225
|
}
|
|
226
226
|
.vs__dropdown-option {
|
|
227
227
|
@apply py-2;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<div class="flex justify-between
|
|
3
|
+
<div class="flex w-full justify-between" v-if="label">
|
|
4
4
|
<div class="flex items-center">
|
|
5
5
|
<!-- label of select field -->
|
|
6
6
|
<label class="block text-sm font-medium text-gray-900">
|
|
7
7
|
{{ label }}
|
|
8
8
|
</label>
|
|
9
9
|
<!-- asterisk sign to render if field is required -->
|
|
10
|
-
<p v-if="isRequired" class="text-red-600
|
|
10
|
+
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
11
11
|
</div>
|
|
12
12
|
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
13
13
|
</div>
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
aria-expanded="true"
|
|
25
25
|
aria-labelledby="listbox-label"
|
|
26
26
|
:class="classes"
|
|
27
|
-
class="relative w-full rounded-md pl-3 pr-10
|
|
27
|
+
class="focus:outline-none relative w-full cursor-pointer rounded-md py-2 pl-3 pr-10 text-left disabled:opacity-50 sm:text-sm"
|
|
28
28
|
:disabled="isDisabled"
|
|
29
29
|
/>
|
|
30
30
|
|
|
31
|
-
<div class="absolute top-2 left-3 flex
|
|
32
|
-
<span class="flex items-center">
|
|
31
|
+
<div class="pointer-events-none absolute top-2 left-3 flex">
|
|
32
|
+
<span class="flex items-center" :style="selectedOptionStyles">
|
|
33
33
|
<c-avatar
|
|
34
34
|
v-if="showImage && !selectSearch"
|
|
35
35
|
size="extraextrasmall"
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
</span>
|
|
55
55
|
</span>
|
|
56
56
|
</div>
|
|
57
|
-
<div class="absolute top-2.5 right-3 flex
|
|
57
|
+
<div class="pointer-events-none absolute top-2.5 right-3 flex">
|
|
58
58
|
<div
|
|
59
59
|
v-if="type == 'tertiary' ? showFocus : true"
|
|
60
|
-
class="right-0 flex items-center
|
|
60
|
+
class="pointer-events-none right-0 flex items-center"
|
|
61
61
|
>
|
|
62
62
|
<c-icon name="selector" type="solid" class="h-5 w-5"></c-icon>
|
|
63
63
|
</div>
|
|
@@ -72,22 +72,22 @@
|
|
|
72
72
|
>
|
|
73
73
|
<div
|
|
74
74
|
v-if="toggleDropdown && !isDisabled"
|
|
75
|
-
class="absolute mt-1 rounded-md bg-white shadow-lg
|
|
75
|
+
class="absolute z-10 mt-1 w-full rounded-md bg-white shadow-lg"
|
|
76
76
|
>
|
|
77
77
|
<ul
|
|
78
78
|
tabindex="-1"
|
|
79
79
|
role="listbox"
|
|
80
80
|
aria-labelledby="listbox-label"
|
|
81
|
-
class="max-h-60 rounded-md py-1 text-base ring-1 ring-gray-900 ring-opacity-5
|
|
81
|
+
class="focus:outline-none max-h-60 overflow-auto rounded-md py-1 text-base ring-1 ring-gray-900 ring-opacity-5 sm:text-sm"
|
|
82
82
|
>
|
|
83
83
|
<li
|
|
84
84
|
v-if="addAction"
|
|
85
85
|
@mousedown="actionEvent($event)"
|
|
86
|
-
class="flex
|
|
86
|
+
class="relative flex cursor-pointer select-none py-2 pl-3 pr-9 text-indigo-500 hover:bg-indigo-100 hover:text-indigo-700"
|
|
87
87
|
>
|
|
88
88
|
<c-icon
|
|
89
89
|
type="outline"
|
|
90
|
-
class="h-5 w-5
|
|
90
|
+
class="mr-1 h-5 w-5 text-indigo-400 group-hover:text-indigo-500"
|
|
91
91
|
name="plus"
|
|
92
92
|
></c-icon>
|
|
93
93
|
{{ addAction.label }}
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
id="listbox-option-0"
|
|
99
99
|
role="option"
|
|
100
100
|
@mousedown="handleSelect($event, option)"
|
|
101
|
-
class="
|
|
102
|
-
:class="option.isDisabled ? '
|
|
101
|
+
class="relative cursor-pointer select-none py-2 pl-3 pr-9 text-gray-900 hover:bg-indigo-700 hover:text-white"
|
|
102
|
+
:class="option.isDisabled ? 'pointer-events-none opacity-50' : ''"
|
|
103
103
|
>
|
|
104
104
|
<span class="flex items-center">
|
|
105
105
|
<c-avatar
|
|
@@ -110,12 +110,12 @@
|
|
|
110
110
|
></c-avatar>
|
|
111
111
|
<span
|
|
112
112
|
:class="showImage && option.image ? 'ml-3' : ''"
|
|
113
|
-
class="
|
|
113
|
+
class="list-options block break-words font-normal"
|
|
114
114
|
>{{ option[renderOptionName] }}
|
|
115
115
|
</span>
|
|
116
116
|
</span>
|
|
117
117
|
|
|
118
|
-
<span class="
|
|
118
|
+
<span class="absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600">
|
|
119
119
|
<c-icon
|
|
120
120
|
id="list-icon"
|
|
121
121
|
v-show="showSelectedValue"
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
</div>
|
|
130
130
|
</transition>
|
|
131
131
|
<!-- validation error message -->
|
|
132
|
-
<p v-if="!isValidate" class="mt-2 text-
|
|
132
|
+
<p v-if="!isValidate" class="mt-2 text-left text-sm text-red-600">
|
|
133
133
|
{{ errorMessage }}
|
|
134
134
|
</p>
|
|
135
135
|
<p v-if="helpText" class="mt-2 text-sm text-gray-500">
|
|
@@ -173,6 +173,10 @@ export default {
|
|
|
173
173
|
},
|
|
174
174
|
// validation is passed or not
|
|
175
175
|
isValidate: { type: Boolean },
|
|
176
|
+
// will truncate the text in input field
|
|
177
|
+
selectedOptionStyles: {
|
|
178
|
+
type: String,
|
|
179
|
+
},
|
|
176
180
|
// validation error message
|
|
177
181
|
errorMessage: {
|
|
178
182
|
type: String,
|
package/src/icons.js
CHANGED
|
@@ -201,4 +201,6 @@ export default {
|
|
|
201
201
|
"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm3 4a1 1 0 000 2h.01a1 1 0 100-2H7zm3 0a1 1 0 000 2h3a1 1 0 100-2h-3zm-3 4a1 1 0 100 2h.01a1 1 0 100-2H7zm3 0a1 1 0 100 2h3a1 1 0 100-2h-3z",
|
|
202
202
|
"clipboard-check-outline":
|
|
203
203
|
"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4",
|
|
204
|
+
"home":
|
|
205
|
+
"M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"
|
|
204
206
|
};
|