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,343 +1,348 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="flex w-full items-center justify-between" v-if="label">
|
|
4
|
-
<div class="flex items-center">
|
|
5
|
-
<!-- label of select field -->
|
|
6
|
-
<label class="block text-sm font-medium text-gray-900">
|
|
7
|
-
{{ label }}
|
|
8
|
-
</label>
|
|
9
|
-
<!-- asterisk sign to render if field is required -->
|
|
10
|
-
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
11
|
-
</div>
|
|
12
|
-
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<div class="relative">
|
|
16
|
-
<div class="relative" :class="label ? 'mt-1' : ''">
|
|
17
|
-
<input
|
|
18
|
-
type="text"
|
|
19
|
-
v-model="selectSearch"
|
|
20
|
-
@click="toggleDropdown = !toggleDropdown"
|
|
21
|
-
@focus="type == 'tertiary' ? (showFocus = true) : ''"
|
|
22
|
-
@blur="close()"
|
|
23
|
-
@keyup="search()"
|
|
24
|
-
aria-haspopup="listbox"
|
|
25
|
-
aria-expanded="true"
|
|
26
|
-
aria-labelledby="listbox-label"
|
|
27
|
-
:class="{ ...classes, [inputClasses]: true }"
|
|
28
|
-
class="relative w-full cursor-pointer rounded-md py-2 pl-3 pr-10 text-left text-sm focus:outline-none disabled:opacity-50 sm:text-sm"
|
|
29
|
-
:disabled="isDisabled"
|
|
30
|
-
autocomplete="off"
|
|
31
|
-
/>
|
|
32
|
-
|
|
33
|
-
<div
|
|
34
|
-
class="pointer-events-none absolute inset-0 left-3 flex h-[38px] items-center overflow-hidden pr-10"
|
|
35
|
-
>
|
|
36
|
-
<div class="flex items-center truncate" :style="selectedOptionStyles">
|
|
37
|
-
<div v-if="showImage && !selectSearch && value">
|
|
38
|
-
<c-avatar
|
|
39
|
-
v-if="value.photo"
|
|
40
|
-
size="extraextrasmall"
|
|
41
|
-
:image="value.photo"
|
|
42
|
-
:rounded="true"
|
|
43
|
-
></c-avatar>
|
|
44
|
-
<c-avatar
|
|
45
|
-
v-else
|
|
46
|
-
size="extraextrasmall"
|
|
47
|
-
:nameInitials="value.initials"
|
|
48
|
-
:rounded="true"
|
|
49
|
-
:isDynamicallyColored="coloredAvatars"
|
|
50
|
-
></c-avatar>
|
|
51
|
-
</div>
|
|
52
|
-
<c-icon
|
|
53
|
-
v-if="icon && !showImage"
|
|
54
|
-
:class="icon.class"
|
|
55
|
-
:name="icon.name"
|
|
56
|
-
:type="icon.type"
|
|
57
|
-
>
|
|
58
|
-
</c-icon>
|
|
59
|
-
<p :class="showImage ? 'ml-3' : ''" class="block truncate text-sm">
|
|
60
|
-
{{
|
|
61
|
-
selectedValue
|
|
62
|
-
? selectedValue
|
|
63
|
-
: !selectSearch || selectSearch == ""
|
|
64
|
-
? placeholder
|
|
65
|
-
: null
|
|
66
|
-
}}
|
|
67
|
-
</p>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
<div class="pointer-events-none absolute top-2 right-3 flex">
|
|
71
|
-
<div
|
|
72
|
-
v-if="type == 'tertiary' ? showFocus : true"
|
|
73
|
-
class="pointer-events-none right-0 flex items-center"
|
|
74
|
-
>
|
|
75
|
-
<c-icon
|
|
76
|
-
name="selector"
|
|
77
|
-
type="solid"
|
|
78
|
-
class="h-5 w-5 text-gray-400"
|
|
79
|
-
></c-icon>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
<transition
|
|
84
|
-
enter-active-class="transition ease-out duration-100"
|
|
85
|
-
enter-class="transform opacity-0 scale-95"
|
|
86
|
-
enter-to-class="transform opacity-100 scale-100"
|
|
87
|
-
leave-active-class="transition ease-in duration-75"
|
|
88
|
-
leave-class="transform opacity-100 scale-100"
|
|
89
|
-
leave-to-class="transform opacity-0 scale-95"
|
|
90
|
-
>
|
|
91
|
-
<div
|
|
92
|
-
v-if="toggleDropdown && !isDisabled"
|
|
93
|
-
class="absolute z-10 mt-1 w-full rounded-md bg-white shadow-lg"
|
|
94
|
-
>
|
|
95
|
-
<ul
|
|
96
|
-
tabindex="-1"
|
|
97
|
-
role="listbox"
|
|
98
|
-
aria-labelledby="listbox-label"
|
|
99
|
-
class="max-h-60 overflow-auto rounded-md py-1 text-base ring-1 ring-gray-900 ring-opacity-5 focus:outline-none sm:text-sm"
|
|
100
|
-
>
|
|
101
|
-
<li
|
|
102
|
-
v-if="addAction"
|
|
103
|
-
@mousedown="actionEvent($event)"
|
|
104
|
-
class="
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
:
|
|
136
|
-
:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
:
|
|
144
|
-
:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
class="
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
</
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
import
|
|
182
|
-
import
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
label
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
placeholder
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
value
|
|
232
|
-
|
|
233
|
-
type
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
this
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
this
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
this.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
this.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="flex w-full items-center justify-between" v-if="label">
|
|
4
|
+
<div class="flex items-center">
|
|
5
|
+
<!-- label of select field -->
|
|
6
|
+
<label class="block text-sm font-medium text-gray-900">
|
|
7
|
+
{{ label }}
|
|
8
|
+
</label>
|
|
9
|
+
<!-- asterisk sign to render if field is required -->
|
|
10
|
+
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
11
|
+
</div>
|
|
12
|
+
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="relative">
|
|
16
|
+
<div class="relative" :class="label ? 'mt-1' : ''">
|
|
17
|
+
<input
|
|
18
|
+
type="text"
|
|
19
|
+
v-model="selectSearch"
|
|
20
|
+
@click="toggleDropdown = !toggleDropdown"
|
|
21
|
+
@focus="type == 'tertiary' ? (showFocus = true) : ''"
|
|
22
|
+
@blur="close()"
|
|
23
|
+
@keyup="search()"
|
|
24
|
+
aria-haspopup="listbox"
|
|
25
|
+
aria-expanded="true"
|
|
26
|
+
aria-labelledby="listbox-label"
|
|
27
|
+
:class="{ ...classes, [inputClasses]: true }"
|
|
28
|
+
class="relative w-full cursor-pointer rounded-md py-2 pl-3 pr-10 text-left text-sm focus:outline-none disabled:opacity-50 sm:text-sm"
|
|
29
|
+
:disabled="isDisabled"
|
|
30
|
+
autocomplete="off"
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
class="pointer-events-none absolute inset-0 left-3 flex h-[38px] items-center overflow-hidden pr-10"
|
|
35
|
+
>
|
|
36
|
+
<div class="flex items-center truncate" :style="selectedOptionStyles">
|
|
37
|
+
<div v-if="showImage && !selectSearch && value">
|
|
38
|
+
<c-avatar
|
|
39
|
+
v-if="value.photo"
|
|
40
|
+
size="extraextrasmall"
|
|
41
|
+
:image="value.photo"
|
|
42
|
+
:rounded="true"
|
|
43
|
+
></c-avatar>
|
|
44
|
+
<c-avatar
|
|
45
|
+
v-else
|
|
46
|
+
size="extraextrasmall"
|
|
47
|
+
:nameInitials="value.initials"
|
|
48
|
+
:rounded="true"
|
|
49
|
+
:isDynamicallyColored="coloredAvatars"
|
|
50
|
+
></c-avatar>
|
|
51
|
+
</div>
|
|
52
|
+
<c-icon
|
|
53
|
+
v-if="icon && !showImage"
|
|
54
|
+
:class="icon.class"
|
|
55
|
+
:name="icon.name"
|
|
56
|
+
:type="icon.type"
|
|
57
|
+
>
|
|
58
|
+
</c-icon>
|
|
59
|
+
<p :class="showImage ? 'ml-3' : ''" class="block truncate text-sm">
|
|
60
|
+
{{
|
|
61
|
+
selectedValue
|
|
62
|
+
? selectedValue
|
|
63
|
+
: !selectSearch || selectSearch == ""
|
|
64
|
+
? placeholder
|
|
65
|
+
: null
|
|
66
|
+
}}
|
|
67
|
+
</p>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="pointer-events-none absolute top-2 right-3 flex">
|
|
71
|
+
<div
|
|
72
|
+
v-if="type == 'tertiary' ? showFocus : true"
|
|
73
|
+
class="pointer-events-none right-0 flex items-center"
|
|
74
|
+
>
|
|
75
|
+
<c-icon
|
|
76
|
+
name="selector"
|
|
77
|
+
type="solid"
|
|
78
|
+
class="h-5 w-5 text-gray-400"
|
|
79
|
+
></c-icon>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<transition
|
|
84
|
+
enter-active-class="transition ease-out duration-100"
|
|
85
|
+
enter-class="transform opacity-0 scale-95"
|
|
86
|
+
enter-to-class="transform opacity-100 scale-100"
|
|
87
|
+
leave-active-class="transition ease-in duration-75"
|
|
88
|
+
leave-class="transform opacity-100 scale-100"
|
|
89
|
+
leave-to-class="transform opacity-0 scale-95"
|
|
90
|
+
>
|
|
91
|
+
<div
|
|
92
|
+
v-if="toggleDropdown && !isDisabled"
|
|
93
|
+
class="absolute z-10 mt-1 w-full rounded-md bg-white shadow-lg"
|
|
94
|
+
>
|
|
95
|
+
<ul
|
|
96
|
+
tabindex="-1"
|
|
97
|
+
role="listbox"
|
|
98
|
+
aria-labelledby="listbox-label"
|
|
99
|
+
class="max-h-60 overflow-auto rounded-md py-1 text-base ring-1 ring-gray-900 ring-opacity-5 focus:outline-none sm:text-sm"
|
|
100
|
+
>
|
|
101
|
+
<li
|
|
102
|
+
v-if="addAction"
|
|
103
|
+
@mousedown="actionEvent($event)"
|
|
104
|
+
:class="`${isDropDownRelative ? 'relative' : ''}`"
|
|
105
|
+
class="flex cursor-pointer select-none py-2 pl-3 pr-9 text-indigo-500 hover:bg-indigo-100 hover:text-indigo-700"
|
|
106
|
+
>
|
|
107
|
+
<c-icon
|
|
108
|
+
type="outline"
|
|
109
|
+
class="mr-1 h-5 w-5 text-indigo-400 group-hover:text-indigo-500"
|
|
110
|
+
name="plus"
|
|
111
|
+
></c-icon>
|
|
112
|
+
{{ addAction.label }}
|
|
113
|
+
</li>
|
|
114
|
+
<li
|
|
115
|
+
v-for="(option, index) in renderOptions"
|
|
116
|
+
:key="index"
|
|
117
|
+
id="listbox-option-0"
|
|
118
|
+
role="option"
|
|
119
|
+
:ref="`option-${String(index)}`"
|
|
120
|
+
@mousedown="handleSelect($event, option)"
|
|
121
|
+
class="relative cursor-pointer select-none py-2 pl-3 pr-9 text-gray-900 hover:bg-indigo-700 hover:text-white"
|
|
122
|
+
:class="option.isDisabled ? 'pointer-events-none opacity-50' : ''"
|
|
123
|
+
>
|
|
124
|
+
<span class="flex items-center">
|
|
125
|
+
<div v-if="option.showImage">
|
|
126
|
+
<c-avatar
|
|
127
|
+
v-if="option.photo"
|
|
128
|
+
size="extraextrasmall"
|
|
129
|
+
:image="option.photo"
|
|
130
|
+
:rounded="true"
|
|
131
|
+
></c-avatar>
|
|
132
|
+
<c-avatar
|
|
133
|
+
v-else
|
|
134
|
+
size="extraextrasmall"
|
|
135
|
+
:nameInitials="option.initials"
|
|
136
|
+
:rounded="true"
|
|
137
|
+
:isDynamicallyColored="coloredAvatars"
|
|
138
|
+
></c-avatar>
|
|
139
|
+
</div>
|
|
140
|
+
<c-icon
|
|
141
|
+
class="flex-none"
|
|
142
|
+
v-if="option.showIcon && option.icon"
|
|
143
|
+
:class="option.icon.class"
|
|
144
|
+
:name="option.icon.name"
|
|
145
|
+
:type="option.icon.type"
|
|
146
|
+
>
|
|
147
|
+
</c-icon>
|
|
148
|
+
<span
|
|
149
|
+
:class="option.photo || option.initials ? 'ml-3' : ''"
|
|
150
|
+
class="list-options block break-words font-normal"
|
|
151
|
+
>{{ option[renderOptionName] }}
|
|
152
|
+
</span>
|
|
153
|
+
</span>
|
|
154
|
+
|
|
155
|
+
<span
|
|
156
|
+
class="absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600"
|
|
157
|
+
>
|
|
158
|
+
<c-icon
|
|
159
|
+
id="list-icon"
|
|
160
|
+
v-show="showSelectedValue"
|
|
161
|
+
name="check"
|
|
162
|
+
type="solid"
|
|
163
|
+
class="h-5 w-5"
|
|
164
|
+
></c-icon>
|
|
165
|
+
</span>
|
|
166
|
+
</li>
|
|
167
|
+
</ul>
|
|
168
|
+
</div>
|
|
169
|
+
</transition>
|
|
170
|
+
<!-- validation error message -->
|
|
171
|
+
<p v-if="!isValidate" class="mt-2 text-left text-sm text-red-600">
|
|
172
|
+
{{ errorMessage }}
|
|
173
|
+
</p>
|
|
174
|
+
<p v-if="helpText" class="mt-2 text-sm text-gray-500">
|
|
175
|
+
{{ helpText }}
|
|
176
|
+
</p>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
</template>
|
|
180
|
+
<script>
|
|
181
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
182
|
+
import CAvatar from "../CAvatar/CAvatar.vue";
|
|
183
|
+
import { isNumber } from "lodash";
|
|
184
|
+
export default {
|
|
185
|
+
name: "CSelect",
|
|
186
|
+
components: { CIcon, CAvatar },
|
|
187
|
+
props: {
|
|
188
|
+
// label of selectpicker
|
|
189
|
+
label: {
|
|
190
|
+
type: String,
|
|
191
|
+
},
|
|
192
|
+
// placeholder in selectpicker
|
|
193
|
+
placeholder: {
|
|
194
|
+
type: String,
|
|
195
|
+
},
|
|
196
|
+
// list to render in dropdown
|
|
197
|
+
options: {
|
|
198
|
+
type: Array,
|
|
199
|
+
required: true,
|
|
200
|
+
},
|
|
201
|
+
// show the avatars with different colors
|
|
202
|
+
coloredAvatars: {
|
|
203
|
+
type: Boolean,
|
|
204
|
+
},
|
|
205
|
+
// text below dropdown to describe more about the field
|
|
206
|
+
helpText: {
|
|
207
|
+
type: String,
|
|
208
|
+
},
|
|
209
|
+
// text adjacent to label of dropdown to provide hint about field
|
|
210
|
+
hint: { type: String },
|
|
211
|
+
// to show if image is present along with dropdown option
|
|
212
|
+
showImage: { type: Boolean },
|
|
213
|
+
// whether the select field is mandatory or not
|
|
214
|
+
isRequired: {
|
|
215
|
+
type: Boolean,
|
|
216
|
+
},
|
|
217
|
+
// validation is passed or not
|
|
218
|
+
isValidate: { type: Boolean, default: true },
|
|
219
|
+
// will truncate the text in input field
|
|
220
|
+
selectedOptionStyles: {
|
|
221
|
+
type: String,
|
|
222
|
+
},
|
|
223
|
+
// validation error message
|
|
224
|
+
errorMessage: {
|
|
225
|
+
type: String,
|
|
226
|
+
},
|
|
227
|
+
// perform action on first option in dropdown
|
|
228
|
+
addAction: { type: Object },
|
|
229
|
+
// icons in dropdown list
|
|
230
|
+
icon: { type: Object },
|
|
231
|
+
// value to set as default option in dropdown
|
|
232
|
+
value: { type: [Object, String], default: null },
|
|
233
|
+
// type of dropdown - gray,tertiary or default
|
|
234
|
+
type: {
|
|
235
|
+
type: String,
|
|
236
|
+
},
|
|
237
|
+
// name of the field in array to that contains text to render in dropdown
|
|
238
|
+
renderOptionName: {
|
|
239
|
+
type: String,
|
|
240
|
+
default: "option",
|
|
241
|
+
},
|
|
242
|
+
// whether to disable the selectpicker
|
|
243
|
+
isDisabled: {
|
|
244
|
+
type: Boolean,
|
|
245
|
+
default: false,
|
|
246
|
+
},
|
|
247
|
+
inputClasses: {
|
|
248
|
+
type: String,
|
|
249
|
+
default: "",
|
|
250
|
+
},
|
|
251
|
+
isDropDownRelative: {
|
|
252
|
+
type: Boolean,
|
|
253
|
+
default: true,
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
data() {
|
|
257
|
+
return {
|
|
258
|
+
toggleDropdown: false,
|
|
259
|
+
selectedValue: null,
|
|
260
|
+
showSelectedValue: false,
|
|
261
|
+
showFocus: false,
|
|
262
|
+
selectSearch: null,
|
|
263
|
+
renderOptions: this.options,
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
computed: {
|
|
267
|
+
classes() {
|
|
268
|
+
return {
|
|
269
|
+
"text-gray-900 border border-gray-200 hover:bg-gray-200 bg-gray-100 focus:ring-2 focus:border-gray-200 focus:ring-gray-200 focus:ring-offset-2 shadow-sm":
|
|
270
|
+
this.type == "gray",
|
|
271
|
+
"bg-white border border-gray-200 hover:bg-indigo-100 text-indigo-600 hover:text-indigo-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-200":
|
|
272
|
+
this.type == "tertiary",
|
|
273
|
+
"border border-gray-300 focus:ring-indigo-500 focus:border-indigo-500 bg-white shadow-sm focus:ring-1":
|
|
274
|
+
this.type == null,
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
methods: {
|
|
279
|
+
handleSelect(event, option) {
|
|
280
|
+
this.selectSearch = null;
|
|
281
|
+
this.selectedValue = option[this.renderOptionName];
|
|
282
|
+
this.$emit("onChangeValue", option);
|
|
283
|
+
this.toggleDropdown = false;
|
|
284
|
+
},
|
|
285
|
+
actionEvent(event) {
|
|
286
|
+
this.$emit("listAction", event);
|
|
287
|
+
},
|
|
288
|
+
close() {
|
|
289
|
+
this.selectSearch = null;
|
|
290
|
+
this.toggleDropdown = false;
|
|
291
|
+
this.type === "tertiary" ? (this.showFocus = false) : "";
|
|
292
|
+
this.renderOptions = this.options;
|
|
293
|
+
},
|
|
294
|
+
search() {
|
|
295
|
+
this.selectedValue = null;
|
|
296
|
+
if (!this.selectSearch || this.selectSearch == "") {
|
|
297
|
+
this.renderOptions = this.options;
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
let options = [...this.options];
|
|
301
|
+
this.renderOptions = options.filter((option) => {
|
|
302
|
+
isNumber(option[this.renderOptionName])
|
|
303
|
+
? (option[this.renderOptionName] =
|
|
304
|
+
option[this.renderOptionName].toString())
|
|
305
|
+
: "";
|
|
306
|
+
return option[this.renderOptionName]
|
|
307
|
+
.toLowerCase()
|
|
308
|
+
.includes(this.selectSearch.toLowerCase());
|
|
309
|
+
});
|
|
310
|
+
},
|
|
311
|
+
async scrollOptionIntoView(refName) {
|
|
312
|
+
await this.$nextTick();
|
|
313
|
+
this.$refs[refName][0].scrollIntoView({
|
|
314
|
+
behavior: "smooth",
|
|
315
|
+
block: "nearest", //changed due to pop up issue in main menu
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
watch: {
|
|
320
|
+
value() {
|
|
321
|
+
this.selectedValue =
|
|
322
|
+
this.value !== null && this.value[this.renderOptionName]
|
|
323
|
+
? this.value[this.renderOptionName]
|
|
324
|
+
: this.value;
|
|
325
|
+
},
|
|
326
|
+
options() {
|
|
327
|
+
this.renderOptions = this.options;
|
|
328
|
+
},
|
|
329
|
+
toggleDropdown(newValue) {
|
|
330
|
+
if (newValue) {
|
|
331
|
+
let index = this.renderOptions.findIndex(
|
|
332
|
+
(option) => option[this.renderOptionName] === this.selectedValue
|
|
333
|
+
);
|
|
334
|
+
if (index !== -1) {
|
|
335
|
+
let refName = `option-${String(index)}`;
|
|
336
|
+
this.scrollOptionIntoView(refName);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
mounted() {
|
|
342
|
+
this.selectedValue =
|
|
343
|
+
this.value !== null && this.value[this.renderOptionName]
|
|
344
|
+
? this.value[this.renderOptionName]
|
|
345
|
+
: this.value;
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
</script>
|