classcard-ui 0.2.1503-beta.0 → 0.2.1504

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.1503-beta.0",
3
+ "version": "0.2.1504",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -40,6 +40,7 @@
40
40
  errorClasses,
41
41
  customClasses ? customClasses : 'rounded-md',
42
42
  isSearchEnabled ? 'pl-8' : '',
43
+ trailingIcon && isValidate ? 'pr-9' : '',
43
44
  ]"
44
45
  class="block w-full h-full flex-1 px-3 py-2 text-sm text-gray-900 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"
45
46
  :placeholder="placeholder"
@@ -54,6 +55,35 @@
54
55
  >
55
56
  <c-icon name="exclamation-circle" type="solid" class="h-5 w-5 bg-white"></c-icon>
56
57
  </div>
58
+ <!-- trailing info icon with optional tooltip; hidden when a validation error is shown so the error icon takes priority -->
59
+ <div
60
+ v-if="trailingIcon && isValidate"
61
+ class="absolute inset-y-0 right-0 flex items-center pr-3"
62
+ >
63
+ <span
64
+ tabindex="0"
65
+ class="relative flex items-center text-gray-400 focus:outline-none"
66
+ @mouseenter="showTrailingTooltip = true"
67
+ @mouseleave="showTrailingTooltip = false"
68
+ @focus="showTrailingTooltip = true"
69
+ @blur="showTrailingTooltip = false"
70
+ >
71
+ <c-icon
72
+ :name="trailingIcon"
73
+ :type="trailingIconType"
74
+ :viewBox="trailingIconViewBox || undefined"
75
+ :classes="`${trailingIconClass} `"
76
+ cursorType="cursor-pointer"
77
+ ></c-icon>
78
+ <c-tool-tip
79
+ v-if="showTrailingTooltip && trailingIconTooltip"
80
+ :tooltipText="trailingIconTooltip"
81
+ isTopAligned
82
+ classes="bottom-full left-1/2 mb-2 -translate-x-1/2 whitespace-nowrap bg-gray-900 text-white"
83
+ color="#111827"
84
+ ></c-tool-tip>
85
+ </span>
86
+ </div>
57
87
  <slot name="customIcon" v-if="customIcon"></slot>
58
88
  </div>
59
89
  <!-- validation error message -->
@@ -69,9 +99,10 @@
69
99
 
70
100
  <script>
71
101
  import CIcon from "../CIcon/CIcon.vue";
102
+ import CToolTip from "../CToolTip/CToolTip.vue";
72
103
  export default {
73
104
  name: "CInput",
74
- components: { CIcon },
105
+ components: { CIcon, CToolTip },
75
106
  props: {
76
107
  // Label of input field
77
108
  label: {
@@ -138,6 +169,28 @@ export default {
138
169
  type: Boolean,
139
170
  default: false,
140
171
  },
172
+ // c-icon name to render at the right edge of the input
173
+ trailingIcon: {
174
+ type: String,
175
+ },
176
+ // type passed through to the trailing <c-icon :type>
177
+ trailingIconType: {
178
+ type: String,
179
+ default: "outline",
180
+ },
181
+ // tooltip text shown on hover/focus of the trailing icon
182
+ trailingIconTooltip: {
183
+ type: String,
184
+ },
185
+ // viewBox passed through to the trailing <c-icon>; only applied when provided
186
+ trailingIconViewBox: {
187
+ type: String,
188
+ },
189
+ // class bound on the trailing <c-icon> so callers control colour/size (positioning is preserved)
190
+ trailingIconClass: {
191
+ type: String,
192
+ default: "h-5 w-5 text-gray-400",
193
+ },
141
194
  },
142
195
  computed: {
143
196
  errorClasses() {
@@ -162,6 +215,7 @@ export default {
162
215
  data() {
163
216
  return {
164
217
  inputValue: this.value,
218
+ showTrailingTooltip: false,
165
219
  };
166
220
  },
167
221
  watch: {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="flex items-center justify-center">
3
3
  <p class="text-sm font-medium text-gray-900">
4
- {{ steps[currentStep - 1].name }}
4
+ {{ customName ? customName : steps[currentStep - 1].name }}
5
5
  </p>
6
6
  <ol role="list" class="ml-4 flex items-center space-x-5">
7
7
  <li v-for="step in steps" :key="step.name">
@@ -59,6 +59,10 @@ export default {
59
59
  type: Number,
60
60
  require: true,
61
61
  },
62
+ customName: {
63
+ type: String,
64
+ default: "",
65
+ },
62
66
  preferredColor: {
63
67
  type: String,
64
68
  default: "indigo",
@@ -43,6 +43,7 @@
43
43
  "
44
44
  >
45
45
  {{ item[labelName] }}
46
+ <span v-if="item.labelHelperText" :class="item.labelHelperTextClass">{{ item.labelHelperText }}</span>
46
47
  </p>
47
48
  <c-tag
48
49
  v-if="item.tag"
@@ -15,10 +15,7 @@
15
15
  </div>
16
16
  <button
17
17
  type="button"
18
- :class="[
19
- 'inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2',
20
- extraClasses,
21
- ]"
18
+ class="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
22
19
  @click="initFilestack()"
23
20
  :id="id"
24
21
  v-if="displayMode == 'overlay' && icon"
@@ -28,7 +25,6 @@
28
25
  :class="icon.class"
29
26
  :name="icon.name"
30
27
  :viewBox="icon.viewBox"
31
- cursorType="cursor-pointer"
32
28
  ></c-icon>
33
29
  {{ buttonText }}
34
30
  </button>
@@ -120,10 +116,6 @@ export default {
120
116
  id: {
121
117
  type: String,
122
118
  },
123
- extraClasses: {
124
- type: String,
125
- default: "",
126
- },
127
119
  buttonText: {
128
120
  type: String,
129
121
  default: "Upload",
@@ -14,6 +14,9 @@ export default {
14
14
  value: String,
15
15
  disabled: Boolean,
16
16
  type: String,
17
+ trailingIcon: String,
18
+ trailingIconType: String,
19
+ trailingIconTooltip: String,
17
20
  },
18
21
  };
19
22
 
@@ -34,3 +37,14 @@ Default.args = {
34
37
  disabled: true,
35
38
  type: "text",
36
39
  };
40
+
41
+ export const TrailingIcon = Template.bind({});
42
+ TrailingIcon.args = {
43
+ label: "Email",
44
+ placeholder: "Enter your email",
45
+ hint: "Optional",
46
+ isValidate: true,
47
+ type: "text",
48
+ trailingIcon: "information-circle",
49
+ trailingIconTooltip: "Pending verification",
50
+ };