classcard-ui 0.2.519 → 0.2.522

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.519",
3
+ "version": "0.2.522",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -2,9 +2,10 @@
2
2
  <div>
3
3
  <div class="-space-y-px rounded-md bg-white">
4
4
  <div
5
- class="relative rounded-tl-md rounded-tr-md pb-5"
6
- v-for="item in items"
5
+ v-for="(item, index) in items"
6
+ class="relative p-4 first:rounded-t-md last:rounded-b-md"
7
7
  v-bind:key="item.label"
8
+ :class="customClasses ? classes(item, index) : ''"
8
9
  >
9
10
  <div class="flex items-start">
10
11
  <input
@@ -20,10 +21,24 @@
20
21
  class="ml-3 flex cursor-pointer flex-col"
21
22
  @click="onChange(item.value)"
22
23
  >
23
- <span class="block text-sm font-medium">
24
+ <span
25
+ class="block text-sm font-medium"
26
+ :class="
27
+ customClasses && item.value === selectedItem
28
+ ? 'text-indigo-900'
29
+ : ''
30
+ "
31
+ >
24
32
  {{ item.label }}
25
33
  </span>
26
- <span class="block text-sm text-gray-500">
34
+ <span
35
+ class="block text-sm"
36
+ :class="
37
+ customClasses && item.value === selectedItem
38
+ ? 'text-indigo-700'
39
+ : 'text-gray-500'
40
+ "
41
+ >
27
42
  {{ item.description }}
28
43
  </span>
29
44
  </label>
@@ -48,6 +63,10 @@ export default {
48
63
  isDisabled: {
49
64
  type: Boolean,
50
65
  },
66
+ customClasses: {
67
+ type: Boolean,
68
+ default: false,
69
+ },
51
70
  name: {
52
71
  type: String,
53
72
  required: true,
@@ -63,6 +82,26 @@ export default {
63
82
  this.$emit("onChange", selectedValue);
64
83
  this.selectedItem = selectedValue;
65
84
  },
85
+ classes(item, index) {
86
+ let classForRadio = "";
87
+ if (item.value === this.selectedItem && index === 0) {
88
+ classForRadio = "border border-indigo-200 rounded-t-md bg-indigo-50";
89
+ } else if (
90
+ item.value === this.selectedItem &&
91
+ index === this.items.length - 1
92
+ ) {
93
+ classForRadio = "border border-indigo-200 rounded-b-md bg-indigo-50";
94
+ } else if (
95
+ item.value === this.selectedItem &&
96
+ 0 < index < this.items.length - 1
97
+ ) {
98
+ classForRadio = "border border-indigo-200 bg-indigo-50";
99
+ } else {
100
+ classForRadio = "border border-gray-200";
101
+ }
102
+
103
+ return classForRadio;
104
+ },
66
105
  },
67
106
  watch: {
68
107
  selectedOption() {
@@ -126,6 +126,7 @@
126
126
  ></c-avatar>
127
127
  </div>
128
128
  <c-icon
129
+ class="flex-none"
129
130
  v-if="option.showIcon && option.icon"
130
131
  :class="option.icon.class"
131
132
  :name="option.icon.name"