classcard-ui 0.2.1474 → 0.2.1476

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.
@@ -317,7 +317,7 @@
317
317
  option.isDisabled ? 'custom-disabled-state' : ''
318
318
  } ${optionClasses} relative cursor-pointer select-none text-gray-700 hover:bg-gray-100`"
319
319
  >
320
- <div v-if="addCheckBox" class="flex h-5 items-center">
320
+ <div v-if="addCheckBox" class="flex h-5 shrink-0 items-center">
321
321
  <input
322
322
  type="checkbox"
323
323
  name="group"
@@ -325,8 +325,8 @@
325
325
  :checked="isChecked(option)"
326
326
  />
327
327
  </div>
328
- <div class="flex items-center gap-2">
329
- <div v-if="option.showImage" class="flex-shrink-0">
328
+ <div class="flex min-w-0 flex-1 items-start gap-2">
329
+ <div v-if="option.showImage" class="shrink-0 pt-0.5">
330
330
  <c-avatar
331
331
  v-if="option.photo"
332
332
  size="extraextraextrasmall"
@@ -342,7 +342,7 @@
342
342
  ></c-avatar>
343
343
  </div>
344
344
  <div
345
- class="flex items-center justify-center rounded-full bg-gray-100 p-1"
345
+ class="flex shrink-0 items-center justify-center rounded-full bg-gray-100 p-1"
346
346
  v-if="option.showIcon && option.icon"
347
347
  >
348
348
  <c-icon
@@ -358,7 +358,7 @@
358
358
  option.photo || option.initials ? '' : 'text-left',
359
359
  addCheckBox ? 'overflow-hidden' : '',
360
360
  ]"
361
- class="list-options block break-words font-normal"
361
+ class="list-options min-w-0 flex-1 break-words font-normal"
362
362
  v-bind:style="{
363
363
  ...(shouldShowCustomFonts
364
364
  ? { fontFamily: option[renderOptionName] }
@@ -367,6 +367,12 @@
367
367
  >{{ option[renderOptionName] }}
368
368
  </span>
369
369
  </div>
370
+ <c-icon
371
+ v-if="!addCheckBox && isOptionSelected(option)"
372
+ name="check-outline-v2"
373
+ type="outline-v2"
374
+ class="h-4 w-4 shrink-0 self-center text-indigo-700"
375
+ />
370
376
  </span>
371
377
  </li>
372
378
  <hr
@@ -393,7 +399,7 @@
393
399
  option.isDisabled ? 'custom-disabled-state' : ''
394
400
  } ${optionClasses} relative cursor-pointer select-none text-gray-700 hover:bg-gray-100`"
395
401
  >
396
- <div v-if="addCheckBox" class="flex h-5 items-center">
402
+ <div v-if="addCheckBox" class="flex h-5 shrink-0 items-center">
397
403
  <input
398
404
  type="checkbox"
399
405
  name="value"
@@ -401,8 +407,8 @@
401
407
  :checked="preservedOrder ? isChecked(option) : true"
402
408
  />
403
409
  </div>
404
- <div class="flex items-center gap-2">
405
- <div v-if="option.showImage" class="flex-shrink-0">
410
+ <div class="flex min-w-0 flex-1 items-start gap-2">
411
+ <div v-if="option.showImage" class="shrink-0 pt-0.5">
406
412
  <c-avatar
407
413
  v-if="option.photo"
408
414
  size="extraextraextrasmall"
@@ -418,7 +424,7 @@
418
424
  ></c-avatar>
419
425
  </div>
420
426
  <div
421
- class="flex items-center justify-center rounded-full bg-gray-100 p-1"
427
+ class="flex shrink-0 items-center justify-center rounded-full bg-gray-100 p-1"
422
428
  v-if="option.showIcon && option.icon"
423
429
  >
424
430
  <c-icon
@@ -434,7 +440,7 @@
434
440
  option.photo || option.initials ? '' : 'text-left',
435
441
  addCheckBox ? 'overflow-hidden' : '',
436
442
  ]"
437
- class="list-options block break-words font-normal"
443
+ class="list-options min-w-0 flex-1 break-words font-normal"
438
444
  v-bind:style="{
439
445
  ...(shouldShowCustomFonts
440
446
  ? { fontFamily: option[renderOptionName] }
@@ -469,7 +475,7 @@
469
475
  option.isDisabled ? 'custom-disabled-state' : ''
470
476
  } ${optionClasses} relative cursor-pointer select-none text-gray-700 hover:bg-gray-100`"
471
477
  >
472
- <div v-if="addCheckBox" class="flex h-5 items-center">
478
+ <div v-if="addCheckBox" class="flex h-5 shrink-0 items-center">
473
479
  <input
474
480
  type="checkbox"
475
481
  name="value"
@@ -477,8 +483,8 @@
477
483
  :checked="selectAll || isChecked(option)"
478
484
  />
479
485
  </div>
480
- <div class="flex items-center gap-2">
481
- <div v-if="option.showImage" class="flex-shrink-0">
486
+ <div class="flex min-w-0 flex-1 items-start gap-2">
487
+ <div v-if="option.showImage" class="shrink-0 pt-0.5">
482
488
  <c-avatar
483
489
  v-if="option.photo"
484
490
  size="extraextraextrasmall"
@@ -494,7 +500,7 @@
494
500
  ></c-avatar>
495
501
  </div>
496
502
  <div
497
- class="flex items-center justify-center rounded-full bg-gray-100 p-1"
503
+ class="flex shrink-0 items-center justify-center rounded-full bg-gray-100 p-1"
498
504
  v-if="option.showIcon && option.icon"
499
505
  >
500
506
  <c-icon
@@ -505,26 +511,36 @@
505
511
  >
506
512
  </c-icon>
507
513
  </div>
508
- <span
509
- :class="[
510
- option.photo || option.initials ? '' : 'text-left',
511
- addCheckBox ? 'overflow-hidden' : '',
512
- ]"
513
- class="list-options flex items-center gap-2 break-words font-normal"
514
- v-bind:style="{
515
- ...(shouldShowCustomFonts
516
- ? { fontFamily: option[renderOptionName] }
517
- : {}),
518
- }"
519
- >{{ option[renderOptionName] }}
514
+ <div
515
+ class="list-options flex min-w-0 flex-1 flex-wrap items-center gap-2 font-normal"
516
+ >
517
+ <span
518
+ :class="[
519
+ option.photo || option.initials ? '' : 'text-left',
520
+ addCheckBox ? 'overflow-hidden' : '',
521
+ ]"
522
+ class="min-w-0 flex-1 break-words"
523
+ v-bind:style="{
524
+ ...(shouldShowCustomFonts
525
+ ? { fontFamily: option[renderOptionName] }
526
+ : {}),
527
+ }"
528
+ >{{ option[renderOptionName] }}</span
529
+ >
520
530
  <c-tag
521
531
  v-if="option.badge"
522
532
  :label="option.badge.label"
523
533
  :color="option.badge.color"
524
534
  class="shrink-0"
525
535
  ></c-tag>
526
- </span>
536
+ </div>
527
537
  </div>
538
+ <c-icon
539
+ v-if="!addCheckBox && isOptionSelected(option)"
540
+ name="check-outline-v2"
541
+ type="outline-v2"
542
+ class="h-4 w-4 shrink-0 self-center text-indigo-700"
543
+ />
528
544
  </span>
529
545
  <hr v-if="option.isBorder" class="my-1" />
530
546
  </li>
@@ -839,7 +855,7 @@ export default {
839
855
  if (this.isDisabled) {
840
856
  return "text-gray-500";
841
857
  }
842
-
858
+
843
859
  if (this.type === "indigo") {
844
860
  return "text-indigo-600";
845
861
  }
@@ -1014,6 +1030,33 @@ export default {
1014
1030
  list.scrollTo({ top: target, behavior: "smooth" });
1015
1031
  }
1016
1032
  },
1033
+ isOptionSelected(option) {
1034
+ /*
1035
+ * Compares value to option by id when both exist,
1036
+ * otherwise by renderOptionName / string value.
1037
+ */
1038
+ if (option == null) {
1039
+ return false;
1040
+ }
1041
+
1042
+ const v = this.value;
1043
+ if (v === null) {
1044
+ return false;
1045
+ }
1046
+
1047
+ if (typeof v === "object" && v !== null) {
1048
+ if (v.id !== undefined && option.id !== undefined) {
1049
+ return v.id === option.id;
1050
+ }
1051
+
1052
+ const vLabel = v[this.renderOptionName];
1053
+ if (vLabel !== undefined && vLabel !== null) {
1054
+ return String(vLabel) === String(option[this.renderOptionName]);
1055
+ }
1056
+ }
1057
+
1058
+ return String(v) === String(option[this.renderOptionName]);
1059
+ },
1017
1060
  getIndex(option) {
1018
1061
  return this.selectedValuesArray.findIndex((item) => item.id == option.id);
1019
1062
  },
@@ -1102,7 +1145,9 @@ export default {
1102
1145
  String((item && item[this.renderOptionName]) || "").toLowerCase();
1103
1146
 
1104
1147
  selectedValues.sort((a, b) => getSortKey(a).localeCompare(getSortKey(b)));
1105
- unselectedValues.sort((a, b) => getSortKey(a).localeCompare(getSortKey(b)));
1148
+ unselectedValues.sort((a, b) =>
1149
+ getSortKey(a).localeCompare(getSortKey(b))
1150
+ );
1106
1151
 
1107
1152
  return {
1108
1153
  groups,
package/src/icons.js CHANGED
@@ -827,4 +827,5 @@ export default {
827
827
  "wrench-solid-v2": "M19 5.5C19 7.98528 16.9853 10 14.5 10C14.4022 10 14.3051 9.99688 14.2088 9.99073C13.3358 9.93497 12.4014 10.1183 11.8414 10.7903L5.81681 18.0198C5.29925 18.6409 4.53256 19 3.7241 19C2.21962 19 1 17.7804 1 16.2759C1 15.4674 1.3591 14.7008 1.98017 14.1832L9.20974 8.15855C9.88173 7.59855 10.065 6.66418 10.0093 5.79122C10.0031 5.69494 10 5.59783 10 5.5C10 3.01472 12.0147 1 14.5 1C14.9823 1 15.4469 1.07588 15.8825 1.21636C16.2067 1.32092 16.2735 1.72672 16.0327 1.9676L13.3398 4.66042C13.2094 4.79088 13.1582 4.98403 13.2292 5.15431C13.5334 5.88351 14.1172 6.46695 14.8466 6.77074C15.0168 6.84163 15.2098 6.79041 15.3402 6.66002L18.0325 3.96772C18.2734 3.72683 18.6792 3.79367 18.7838 4.11791C18.9242 4.55338 19 5.01783 19 5.5ZM4 17C4.55228 17 5 16.5523 5 16C5 15.4477 4.55228 15 4 15C3.44772 15 3 15.4477 3 16C3 16.5523 3.44772 17 4 17Z",
828
828
  "rectangle-stack-solid-v2": "M4.63867 3.88103C4.95292 3.7956 5.28358 3.75 5.62488 3.75H14.3749C14.7162 3.75 15.0468 3.7956 15.3611 3.88103C14.9505 3.06211 14.1033 2.5 13.1249 2.5H6.87488C5.89642 2.5 5.04925 3.06211 4.63867 3.88103Z M1.875 10C1.875 8.61929 2.99429 7.5 4.375 7.5H15.625C17.0057 7.5 18.125 8.61929 18.125 10V15C18.125 16.3807 17.0057 17.5 15.625 17.5H4.375C2.99429 17.5 1.875 16.3807 1.875 15V10Z M4.37488 6.25C4.03358 6.25 3.70292 6.2956 3.38867 6.38103C3.79925 5.56211 4.64642 5 5.62488 5H14.3749C15.3533 5 16.2005 5.56211 16.6111 6.38103C16.2968 6.2956 15.9662 6.25 15.6249 6.25H4.37488Z",
829
829
  "face-smile-solid-v2": "M10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18ZM13.5355 13.5355C13.8284 13.2426 13.8284 12.7678 13.5355 12.4749C13.2426 12.182 12.7678 12.182 12.4749 12.4749C11.108 13.8417 8.89196 13.8417 7.52513 12.4749C7.23223 12.182 6.75736 12.182 6.46447 12.4749C6.17157 12.7678 6.17157 13.2426 6.46447 13.5355C8.41709 15.4881 11.5829 15.4881 13.5355 13.5355ZM9 8.5C9 9.32843 8.55228 10 8 10C7.44772 10 7 9.32843 7 8.5C7 7.67157 7.44772 7 8 7C8.55228 7 9 7.67157 9 8.5ZM12 10C12.5523 10 13 9.32843 13 8.5C13 7.67157 12.5523 7 12 7C11.4477 7 11 7.67157 11 8.5C11 9.32843 11.4477 10 12 10Z",
830
+ "document-check-outline": "M16.875 3.75H9.375C8.33947 3.75 7.5 4.58947 7.5 5.625V34.375C7.5 35.4105 8.33947 36.25 9.375 36.25H30.625C31.6605 36.25 32.5 35.4105 32.5 34.375V19.375M16.875 3.75H17.5C25.7843 3.75 32.5 10.4657 32.5 18.75V19.375M16.875 3.75C19.9816 3.75 22.5 6.2684 22.5 9.375V11.875C22.5 12.9105 23.3395 13.75 24.375 13.75H26.875C29.9816 13.75 32.5 16.2684 32.5 19.375M15 25L18.75 28.75L25 20",
830
831
  };