classcard-ui 0.2.1468 → 0.2.1470

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "classcard-ui",
3
- "version": "0.2.1468",
3
+ "version": "0.2.1470",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -135,57 +135,154 @@
135
135
  ></path>
136
136
  </svg>
137
137
  </template>
138
- <template slot="option" slot-scope="option">
138
+ <template v-slot:option="option">
139
139
  <slot
140
+ v-if="$scopedSlots['custom-option']"
140
141
  name="custom-option"
141
- v-bind:option="isGrouped ? option : groupedArray"
142
- ></slot>
143
- </template>
144
- <template v-slot:option="option">
145
- <div v-if="!isGrouped">
146
- <div v-if="option.hasNoData" class="dropdown-menu-bordered"></div>
147
- <div v-else class="mt-1 flex h-full w-full items-center">
148
- <p v-if="showOptionImage" class="flex-shrink-0">
149
- <c-avatar
150
- v-if="option[imageLabel]"
151
- :size="
152
- option.description && showAdditionalText
153
- ? 'extrasmall'
154
- : 'extraextrasmall'
155
- "
156
- :image="option[imageLabel]"
157
- :rounded="true"
158
- :description="option.description"
159
- class="mr-2"
160
- ></c-avatar>
161
- <c-avatar
162
- v-if="!option.icon && !option[imageLabel] && option.initials"
163
- :size="
164
- option.description && showAdditionalText
165
- ? 'extrasmall'
166
- : 'extraextrasmall'
167
- "
168
- :nameInitials="option.initials"
169
- :description="option.description"
170
- :rounded="true"
171
- :isDynamicallyColored="true"
172
- class="mr-2"
173
- ></c-avatar>
142
+ :option="option"
143
+ />
144
+ <template v-else>
145
+ <div v-if="!isGrouped">
146
+ <div v-if="option.hasNoData" class="dropdown-menu-bordered"></div>
147
+ <div v-else class="mt-1 flex h-full w-full items-center">
148
+ <p v-if="showOptionImage" class="flex-shrink-0">
149
+ <c-avatar
150
+ v-if="option[imageLabel]"
151
+ :size="
152
+ option.description && showAdditionalText
153
+ ? 'extrasmall'
154
+ : 'extraextrasmall'
155
+ "
156
+ :image="option[imageLabel]"
157
+ :rounded="true"
158
+ :description="option.description"
159
+ class="mr-2"
160
+ ></c-avatar>
161
+ <c-avatar
162
+ v-if="
163
+ !option.icon && !option[imageLabel] && option.initials
164
+ "
165
+ :size="
166
+ option.description && showAdditionalText
167
+ ? 'extrasmall'
168
+ : 'extraextrasmall'
169
+ "
170
+ :nameInitials="option.initials"
171
+ :description="option.description"
172
+ :rounded="true"
173
+ :isDynamicallyColored="true"
174
+ class="mr-2"
175
+ ></c-avatar>
176
+ <c-icon
177
+ v-if="
178
+ option.icon && !option[imageLabel] && !option.initials
179
+ "
180
+ :name="option.icon.name"
181
+ :type="option.icon.type"
182
+ :class="`mr-2 h-5 w-5 text-gray-400 ${
183
+ option.icon.optionIconClass
184
+ ? option.icon.optionIconClass
185
+ : ''
186
+ }`"
187
+ cursorType="cursor-pointer"
188
+ />
189
+ </p>
190
+ <div class="w-full">
191
+ <div
192
+ :class="`flex items-center justify-between ${checkboxWrapperClass}`"
193
+ >
194
+ <div :class="`flex items-center ${tagWrapperClass}`">
195
+ <p>
196
+ {{
197
+ option[optionLabelSecondary]
198
+ ? option[optionLabelSecondary]
199
+ : option[optionLabel]
200
+ }}
201
+ </p>
202
+ <div class="ml-3">
203
+ <c-tag
204
+ v-if="tags && option.info && option.info !== ''"
205
+ :label="option.info"
206
+ color="gray"
207
+ ></c-tag>
208
+ <span v-else class="-ml-3 text-gray-300">
209
+ &nbsp;{{ option.info }}
210
+ </span>
211
+ </div>
212
+ </div>
213
+ <div @click.stop v-if="addCheckBox">
214
+ <c-checkbox
215
+ :value="isChecked(option)"
216
+ @onChange="handleSingleSelect(option)"
217
+ />
218
+ </div>
219
+ </div>
220
+ <p
221
+ class="text-xs"
222
+ v-if="option.description && showAdditionalText"
223
+ >
224
+ {{ option.description }}
225
+ </p>
226
+ </div>
227
+ </div>
228
+ </div>
229
+ <div
230
+ v-if="isGrouped"
231
+ :class="[
232
+ option.header
233
+ ? 'sticky-group-header -mx-4 -my-2 bg-gray-200 px-3 py-2'
234
+ : '',
235
+ ]"
236
+ >
237
+ <v-list-subheader
238
+ v-if="option.header"
239
+ class="flex items-center gap-1 text-gray-900"
240
+ >
174
241
  <c-icon
175
- v-if="option.icon && !option[imageLabel] && !option.initials"
242
+ v-if="option.icon"
176
243
  :name="option.icon.name"
177
244
  :type="option.icon.type"
178
- :class="`mr-2 h-5 w-5 text-gray-400 ${
179
- option.icon.optionIconClass
180
- ? option.icon.optionIconClass
181
- : ''
182
- }`"
183
- cursorType="cursor-pointer"
245
+ :class="`${
246
+ option.icon.headerIconClass
247
+ ? option.icon.headerIconClass
248
+ : 'h-4 w-4'
249
+ } text-gray-400`"
184
250
  />
185
- </p>
186
- <div class="w-full">
187
- <div :class="`flex items-center justify-between ${checkboxWrapperClass}`">
188
- <div :class="`flex items-center ${tagWrapperClass}`">
251
+ {{ option.header }}
252
+ </v-list-subheader>
253
+ <div
254
+ :class="[
255
+ 'mt-1 flex h-full w-full',
256
+ option.description ? 'items-start' : 'items-center',
257
+ ]"
258
+ >
259
+ <div @click.stop v-if="addCheckBox && !option.header">
260
+ <c-checkbox
261
+ :value="isChecked(option)"
262
+ @onChange="handleSingleSelect(option)"
263
+ />
264
+ </div>
265
+ <div v-if="!option.header && showOptionImage">
266
+ <c-avatar
267
+ v-if="option.image"
268
+ size="extraextrasmall"
269
+ :image="option.image"
270
+ :rounded="true"
271
+ :description="option.description"
272
+ class="mr-2"
273
+ ></c-avatar>
274
+ <c-avatar
275
+ v-else
276
+ size="extraextrasmall"
277
+ :nameInitials="option.initials"
278
+ :description="option.description"
279
+ :rounded="true"
280
+ :isDynamicallyColored="true"
281
+ class="mr-2"
282
+ ></c-avatar>
283
+ </div>
284
+ <div class="w-full">
285
+ <div class="flex items-center">
189
286
  <p>
190
287
  {{
191
288
  option[optionLabelSecondary]
@@ -194,115 +291,25 @@
194
291
  }}
195
292
  </p>
196
293
  <div class="ml-3">
197
- <c-tag
294
+ <span
198
295
  v-if="tags && option.info && option.info !== ''"
199
- :label="option.info"
200
- color="gray"
201
- ></c-tag>
202
- <span v-else class="-ml-3 text-gray-300">
203
- &nbsp;{{ option.info }}
296
+ class="inline-flex rounded-md bg-gray-400 px-2 py-px text-sm leading-5 text-white"
297
+ >
298
+ {{ option.info }}
299
+ </span>
300
+ <span v-else class="text-gray-300">
301
+ {{ option.info }}
204
302
  </span>
205
303
  </div>
206
304
  </div>
207
- <div @click.stop v-if="addCheckBox">
208
- <c-checkbox
209
- :value="isChecked(option)"
210
- @onChange="handleSingleSelect(option)"
211
- />
212
- </div>
213
- </div>
214
- <p
215
- class="text-xs"
216
- v-if="option.description && showAdditionalText"
217
- >
218
- {{ option.description }}
219
- </p>
220
- </div>
221
- </div>
222
- </div>
223
- <div
224
- v-if="isGrouped"
225
- :class="[
226
- option.header
227
- ? 'sticky-group-header -mx-4 -my-2 bg-gray-200 px-3 py-2'
228
- : '',
229
- ]"
230
- >
231
- <v-list-subheader
232
- v-if="option.header"
233
- class="flex items-center gap-1 text-gray-900"
234
- >
235
- <c-icon
236
- v-if="option.icon"
237
- :name="option.icon.name"
238
- :type="option.icon.type"
239
- :class="`${
240
- option.icon.headerIconClass
241
- ? option.icon.headerIconClass
242
- : 'h-4 w-4'
243
- } text-gray-400`"
244
- />
245
- {{ option.header }}
246
- </v-list-subheader>
247
- <div
248
- :class="[
249
- 'mt-1 flex h-full w-full',
250
- option.description ? 'items-start' : 'items-center',
251
- ]"
252
- >
253
- <div @click.stop v-if="addCheckBox && !option.header">
254
- <c-checkbox
255
- :value="isChecked(option)"
256
- @onChange="handleSingleSelect(option)"
257
- />
258
- </div>
259
- <div v-if="!option.header && showOptionImage">
260
- <c-avatar
261
- v-if="option.image"
262
- size="extraextrasmall"
263
- :image="option.image"
264
- :rounded="true"
265
- :description="option.description"
266
- class="mr-2"
267
- ></c-avatar>
268
- <c-avatar
269
- v-else
270
- size="extraextrasmall"
271
- :nameInitials="option.initials"
272
- :description="option.description"
273
- :rounded="true"
274
- :isDynamicallyColored="true"
275
- class="mr-2"
276
- ></c-avatar>
277
- </div>
278
- <div class="w-full">
279
- <div class="flex items-center">
280
- <p>
281
- {{
282
- option[optionLabelSecondary]
283
- ? option[optionLabelSecondary]
284
- : option[optionLabel]
285
- }}
305
+
306
+ <p class="text-xs" v-if="option.description">
307
+ {{ option.description }}
286
308
  </p>
287
- <div class="ml-3">
288
- <span
289
- v-if="tags && option.info && option.info !== ''"
290
- class="inline-flex rounded-md bg-gray-400 px-2 py-px text-sm leading-5 text-white"
291
- >
292
- {{ option.info }}
293
- </span>
294
- <span v-else class="text-gray-300">
295
- {{ option.info }}
296
- </span>
297
- </div>
298
309
  </div>
299
-
300
- <p class="text-xs" v-if="option.description">
301
- {{ option.description }}
302
- </p>
303
310
  </div>
304
311
  </div>
305
- </div>
312
+ </template>
306
313
  </template>
307
314
  <template #list-footer="{ search }">
308
315
  <li ref="load" class="loader" v-show="hasNextPage">
@@ -1,37 +1,4 @@
1
1
  <template>
2
- <!-- <div>
3
- <dl class="mt-5 sm:flex sm:flex-col md:flex md:flex-row justify-between">
4
- <div
5
- :class="index == statsCount.length - 1 ? '' : 'mr-2'"
6
- class="bg-white w-full overflow-hidden shadow rounded-lg"
7
- v-for="(count, index) in statsCount"
8
- v-bind:key="count.number"
9
- >
10
- <div class="px-4 pt-3 pb-1 flex">
11
- <c-icon
12
- v-if="count.icon"
13
- :name="count.icon.name"
14
- :type="count.icon.type"
15
- :class="count.icon.class"
16
- ></c-icon>
17
- <div :class="count.icon ? 'ml-3' : ''">
18
- <dt class="text-sm text-gray-500 flex">
19
- <span>{{ count.label }}</span>
20
- <span class="text-sm text-gray-900 ml-1">{{ count.number }}</span>
21
- </dt>
22
- <dd class="text-2xl font-semibold text-gray-900">
23
- {{ count.totalCount }}
24
- </dd>
25
- </div>
26
- </div>
27
- <div class="ml-12 pb-2 flex items-center" v-if="count.tag || count.days">
28
- <c-tag v-if="count.tag" :label="count.tag.label" :color="count.tag.color"></c-tag>
29
- <label v-if="count.days" class="text-xs text-gray-500 ml-1">{{ count.days }}</label>
30
- </div>
31
- </div>
32
- </dl>
33
- </div> -->
34
- <!-- This example requires Tailwind CSS v2.0+ -->
35
2
  <div>
36
3
  <div class="flex items-center justify-between" v-if="title">
37
4
  <h3 class="text-lg font-medium leading-6 text-gray-900">
@@ -44,10 +11,7 @@
44
11
  color="green"
45
12
  ></c-tag>
46
13
  </div>
47
- <dl
48
- class="mt-4 grid grid-cols-1 gap-6 overflow-hidden"
49
- :class="dynamicGridSize"
50
- >
14
+ <dl class="mt-4 grid grid-cols-1 gap-6" :class="dynamicGridSize">
51
15
  <div
52
16
  :class="['pt-3', showStatsBorder ? 'border-t border-gray-200' : '']"
53
17
  v-for="count in statsCount"
@@ -69,37 +33,26 @@
69
33
  >({{ count.suffix }})</span
70
34
  >
71
35
 
72
- <div
73
- :class="['ml-1', 'absolute', `${count.toolTip.class}`]"
74
- v-if="
75
- count.toolTip != undefined &&
76
- count.toolTip != null &&
77
- count.toolTip.showToolTip
78
- "
36
+ <span
37
+ v-if="count.icon && count.toolTip"
38
+ class="relative ml-2 inline-flex shrink-0 items-center self-center"
79
39
  >
80
40
  <c-tool-tip
41
+ v-if="count.toolTip.showToolTip || hoveredStatNumber === count.number"
81
42
  color="#1f2937"
82
- :classes="
83
- count.toolTip.classes
84
- ? count.toolTip.classes
85
- : 'text-white whitespace-nowrap font-normal sticky bg-gray-800 w-auto'
86
- "
43
+ :classes="tooltipClasses(count)"
87
44
  :tooltip-text="count.toolTip.text"
88
45
  :isTopAligned="true"
89
46
  ></c-tool-tip>
90
- </div>
91
-
92
- <c-icon
93
- v-if="
94
- count.icon != undefined && count.icon != null && count.toolTip
95
- "
96
- :name="count.icon.name"
97
- :type="count.icon.type"
98
- :class="count.icon.class"
99
- :cursorType="count.icon.cursorType"
100
- @mouseover.native="count.toolTip.showToolTip = true"
101
- @mouseleave.native="count.toolTip.showToolTip = false"
102
- ></c-icon>
47
+ <c-icon
48
+ :name="count.icon.name"
49
+ :type="count.icon.type"
50
+ :class="count.icon.class"
51
+ :cursorType="count.icon.cursorType"
52
+ @mouseover.native="hoveredStatNumber = count.number"
53
+ @mouseleave.native="hoveredStatNumber = null"
54
+ ></c-icon>
55
+ </span>
103
56
  <c-icon
104
57
  v-else-if="
105
58
  count.icon != undefined &&
@@ -181,6 +134,21 @@ export default {
181
134
  default: true,
182
135
  },
183
136
  },
137
+ data() {
138
+ return {
139
+ hoveredStatNumber: null,
140
+ };
141
+ },
142
+ methods: {
143
+ tooltipClasses(count) {
144
+ const base =
145
+ "block bottom-full left-1/2 mb-1 -translate-x-1/2 text-white font-normal bg-gray-800";
146
+ if (count.toolTip.classes) {
147
+ return `${base} ${count.toolTip.classes}`;
148
+ }
149
+ return `${base} whitespace-nowrap`;
150
+ },
151
+ },
184
152
  };
185
153
  </script>
186
154
 
@@ -42,8 +42,8 @@ Default.args = {
42
42
  },
43
43
  toolTip: {
44
44
  showToolTip: false,
45
- text: "texxt",
46
- class: `top-7 ml-[43px]`,
45
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
46
+ classes: "w-[200px] whitespace-pre-wrap",
47
47
  },
48
48
  },
49
49
  { label: "Partially paid", totalCount: "66145", number: 2 },