classcard-ui 0.2.1539 → 0.2.1540

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.1539",
3
+ "version": "0.2.1540",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -5,7 +5,6 @@
5
5
  <label v-if="label" class="block text-sm font-medium text-gray-900">
6
6
  {{ label }}
7
7
  </label>
8
- <!-- asterisk sign to render if field is required -->
9
8
  <p v-if="isRequired" class="ml-1 text-red-600">*</p>
10
9
  </div>
11
10
  <span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
@@ -34,13 +33,18 @@
34
33
  <div v-if="showOnlyDatePickerIcon">
35
34
  <button
36
35
  type="button"
37
- class="relative flex h-9 w-9 cursor-pointer items-center justify-center rounded focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:custom-disabled-state"
36
+ class="datepicker-button relative flex h-9 w-9 cursor-pointer items-center justify-center rounded focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:custom-disabled-state"
38
37
  :id="id + '_button_toggle_dropdown'"
39
38
  :disabled="disabled"
39
+ :style="computedStyles"
40
+ :aria-disabled="disabled"
41
+ :aria-label="disabled ? 'Disabled' : 'Open datepicker'"
42
+ :title="disabled ? 'Disabled' : 'Open datepicker'"
40
43
  @click="togglePopover()"
41
44
  >
42
45
  <c-icon
43
46
  :name="calendarIcon.iconName"
47
+ :cursorType="disabled ? 'not-allowed' : 'pointer'"
44
48
  class="text-gray-400 flex h-5 w-5 justify-center"
45
49
  :type="calendarIcon.type ? calendarIcon.type : 'solid'"
46
50
  :viewBox="calendarIcon.viewBox ? calendarIcon.viewBox : ''"
@@ -60,8 +64,9 @@
60
64
  <c-icon
61
65
  :name="calendarIcon.iconName"
62
66
  class="text-gray-400 h-5 w-5"
63
- :type="calendarIcon.type ? calendarIcon.type : 'solid'"
64
67
  :viewBox="calendarIcon.viewBox"
68
+ :cursorType="disabled ? 'not-allowed' : 'pointer'"
69
+ :type="calendarIcon.type ? calendarIcon.type : 'solid'"
65
70
  ></c-icon>
66
71
  </button>
67
72
  <input
@@ -77,7 +82,6 @@
77
82
  </template>
78
83
  </v-date-picker>
79
84
  </div>
80
- <!-- validation error message -->
81
85
  <p v-if="!isValidate" class="mt-2 text-sm text-red-600">
82
86
  {{ errorMessage }}
83
87
  </p>
@@ -87,13 +91,12 @@
87
91
  </div>
88
92
  </template>
89
93
  <script>
94
+ import { COLOR_CONFIG } from "../../colorConfig";
90
95
  import CIcon from "../CIcon/CIcon.vue";
91
- // import Calendar from "v-calendar/lib/components/calendar.umd";
92
96
  import VDatePicker from "v-calendar/lib/components/date-picker.umd";
93
97
  export default {
94
98
  name: "CDatepicker",
95
99
  components: {
96
- // Calendar,
97
100
  VDatePicker,
98
101
  CIcon,
99
102
  },
@@ -188,6 +191,10 @@ export default {
188
191
  type: Boolean,
189
192
  default: false,
190
193
  },
194
+ preferredColor: {
195
+ type: String,
196
+ default: "indigo",
197
+ },
191
198
  },
192
199
  data() {
193
200
  const masks = {
@@ -213,6 +220,14 @@ export default {
213
220
  ],
214
221
  };
215
222
  },
223
+ computed: {
224
+ computedStyles() {
225
+ const colors = COLOR_CONFIG[this.preferredColor] || COLOR_CONFIG.indigo;
226
+ return {
227
+ "--primary-ring-color": colors.shade600,
228
+ };
229
+ },
230
+ },
216
231
  methods: {
217
232
  onDayClick(date) {
218
233
  this.$emit("input", date);
@@ -233,3 +248,9 @@ export default {
233
248
  },
234
249
  };
235
250
  </script>
251
+
252
+ <style scoped>
253
+ .datepicker-button:focus {
254
+ outline-color: var(--primary-ring-color);
255
+ }
256
+ </style>
@@ -1,17 +1,21 @@
1
1
  <template>
2
2
  <div>
3
- <div class="-space-y-px rounded-md bg-white" :class="customWrapperClasses">
3
+ <div
4
+ class="-space-y-px rounded-md bg-white"
5
+ :class="customWrapperClasses"
6
+ >
4
7
  <div
5
8
  v-for="(item, index) in items"
6
- :class="`relative ${
9
+ :class="[
10
+ 'relative first:rounded-t-md last:rounded-b-md',
7
11
  index != items.length - 1
8
12
  ? useIncreasedPadding
9
13
  ? 'pb-6'
10
14
  : 'pb-4'
11
- : ''
12
- } ${
13
- customClasses ? classes(item, index) : ''
14
- } first:rounded-t-md last:rounded-b-md`"
15
+ : '',
16
+ customClasses ? classes(item, index) : '',
17
+ isDisabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',
18
+ ]"
15
19
  v-bind:key="item[labelName]"
16
20
  >
17
21
  <div class="flex items-start">
@@ -19,22 +23,21 @@
19
23
  type="radio"
20
24
  :value="item.value"
21
25
  :name="name"
22
- :id="id"
26
+ :id="id + '_input_' + item.value"
23
27
  v-model="selectedItem"
24
28
  @click="onChange(item.value)"
25
- class="radio-state mt-0.5 h-4 w-4 cursor-pointer disabled:opacity-50"
29
+ class="radio-state mt-0.5 h-4 w-4 disabled:opacity-50 disabled:cursor-not-allowed"
26
30
  :disabled="isDisabled"
27
31
  :style="colorStyles"
28
32
  />
29
33
  <div
30
- :class="`ml-3 flex cursor-pointer flex-col ${
31
- isDisabled ? 'opacity-60' : ''
32
- }`"
33
- :id="id"
34
+ :id="id + '_label_' + item.value"
35
+ class="ml-3 flex flex-col"
34
36
  @click="onChange(item.value)"
35
37
  >
36
38
  <div class="flex items-center gap-2">
37
39
  <p
40
+ :id="id + '_label_text_' + item.value"
38
41
  class="text-sm font-medium text-gray-900"
39
42
  :class="
40
43
  customClasses && item.value === selectedItem
@@ -43,7 +46,11 @@
43
46
  "
44
47
  >
45
48
  {{ item[labelName] }}
46
- <span v-if="item.labelHelperText" :class="item.labelHelperTextClass">{{ item.labelHelperText }}</span>
49
+ <span
50
+ v-if="item.labelHelperText"
51
+ :class="item.labelHelperTextClass"
52
+ >{{ item.labelHelperText }}</span
53
+ >
47
54
  </p>
48
55
  <c-tag
49
56
  v-if="item.tag"
@@ -52,6 +59,7 @@
52
59
  ></c-tag>
53
60
  </div>
54
61
  <p
62
+ :id="id + '_description_' + item.value"
55
63
  class="block text-sm"
56
64
  :class="
57
65
  customClasses && item.value === selectedItem
@@ -65,13 +73,14 @@
65
73
  </div>
66
74
  <slot v-if="item.value === selectedItem" :name="item.value" />
67
75
  </div>
68
- <div
76
+ <button
69
77
  v-if="showClearSelection"
78
+ type="button"
70
79
  class="cursor-pointer pt-4 text-sm text-gray-400 hover:text-gray-700 hover:underline"
71
80
  @click="clearSelection"
72
81
  >
73
82
  Clear selection
74
- </div>
83
+ </button>
75
84
  </div>
76
85
  </div>
77
86
  </template>
@@ -86,6 +95,7 @@ export default {
86
95
  props: {
87
96
  id: {
88
97
  type: String,
98
+ default: "c-radio",
89
99
  },
90
100
  items: {
91
101
  type: Array,
@@ -9,6 +9,12 @@ export default {
9
9
  classes: String,
10
10
  label: String,
11
11
  helpText: String,
12
+ preferredColor: {
13
+ control: {
14
+ type: "select",
15
+ options: ["red", "indigo", "yellow", "green", "purple", "gray"],
16
+ },
17
+ },
12
18
  },
13
19
  };
14
20