classcard-ui 0.2.1483 → 0.2.1485

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.1483",
3
+ "version": "0.2.1485",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/src/.DS_Store ADDED
Binary file
@@ -9,8 +9,8 @@
9
9
  v-if="type == 'tertiary'"
10
10
  :class="customClasses"
11
11
  :id="id"
12
- :disabled="disabled"
13
- class="child-button inline-flex h-9 cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-indigo-600 hover:bg-indigo-100 hover:text-indigo-800 focus:outline-none focus:ring-2 focus:ring-indigo-200 focus:ring-offset-2"
12
+ :disabled="disabled || isLoading"
13
+ class="child-button inline-flex h-9 items-center gap-2 rounded-md px-3 py-2 text-sm text-indigo-600 hover:bg-indigo-100 hover:text-indigo-800 focus:outline-none focus:ring-2 focus:ring-indigo-200 focus:ring-offset-2"
14
14
  @click.prevent="$emit('action')"
15
15
  >
16
16
  <c-icon
@@ -30,7 +30,7 @@
30
30
  :id="id"
31
31
  :style="computedStyles"
32
32
  :class="[classes]"
33
- :disabled="disabled"
33
+ :disabled="disabled || isLoading"
34
34
  class="child-button inline-flex h-9 items-center gap-2 rounded-md px-3 py-2 text-sm font-medium shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2"
35
35
  @click.prevent="$emit('action')"
36
36
  >
@@ -52,8 +52,8 @@
52
52
  :id="id"
53
53
  :style="computedStyles"
54
54
  :class="[classes]"
55
- :disabled="disabled"
56
- class="child-button inline-flex h-9 items-center gap-2 rounded-md px-4 py-2 text-sm font-medium shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2"
55
+ :disabled="disabled || isLoading"
56
+ class="child-button inline-flex h-9 items-center gap-2 rounded-md px-3 py-2 text-sm font-medium shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2"
57
57
  @click.prevent="$emit('action')"
58
58
  >
59
59
  {{ label }}
@@ -73,7 +73,7 @@
73
73
  :type="type"
74
74
  :id="id"
75
75
  :class="[classes]"
76
- :disabled="disabled"
76
+ :disabled="disabled || isLoading"
77
77
  class="child-button inline-flex h-9 items-center gap-2 rounded-md px-3 py-2 text-sm font-medium shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2"
78
78
  @click.prevent="$emit('action')"
79
79
  >
@@ -50,12 +50,12 @@
50
50
  >
51
51
  <div
52
52
  aria-hidden="true"
53
- class="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-red-100"
53
+ :class="iconContainerClasses"
54
54
  >
55
55
  <c-icon
56
56
  name="exclamation-triangle-outline-v2"
57
57
  type="outline-v2"
58
- class="h-6 w-6 text-red-600"
58
+ :class="iconClasses"
59
59
  viewBox="0 0 24 24"
60
60
  ></c-icon>
61
61
  </div>
@@ -125,6 +125,22 @@
125
125
  import CButton from "../CButton";
126
126
  import CIcon from '../CIcon/CIcon.vue';
127
127
  import CTextarea from "../CTextarea";
128
+
129
+ const COLOR_VARIANT_CLASSES = {
130
+ red: {
131
+ background: "bg-red-100",
132
+ text: "text-red-600",
133
+ },
134
+ indigo: {
135
+ background: "bg-indigo-100",
136
+ text: "text-indigo-600",
137
+ },
138
+ yellow: {
139
+ background: "bg-yellow-100",
140
+ text: "text-yellow-600",
141
+ },
142
+ };
143
+
128
144
  export default {
129
145
  name: "CConfirmActionModal",
130
146
  components: {
@@ -200,6 +216,10 @@ export default {
200
216
  textAreaLabel: {
201
217
  type: String,
202
218
  },
219
+ colorVariant: {
220
+ type: String,
221
+ default: "red",
222
+ },
203
223
  },
204
224
  computed: {
205
225
  ariaDescribedby() {
@@ -207,6 +227,18 @@ export default {
207
227
  ? "modal-message modal-description"
208
228
  : "modal-message";
209
229
  },
230
+ colorVariantClasses() {
231
+ return COLOR_VARIANT_CLASSES[this.colorVariant] || COLOR_VARIANT_CLASSES.red;
232
+ },
233
+ iconContainerClasses() {
234
+ return [
235
+ "flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full",
236
+ this.colorVariantClasses.background,
237
+ ];
238
+ },
239
+ iconClasses() {
240
+ return ["h-6 w-6", this.colorVariantClasses.text];
241
+ },
210
242
  },
211
243
  methods: {
212
244
  handleTextAreaInputChange(value) {
@@ -1,35 +1,34 @@
1
1
  <template>
2
- <div>
2
+ <div class="inline-block">
3
3
  <nav
4
- class="group relative flex rounded-lg bg-gray-100 p-0.5 hover:bg-gray-200"
4
+ class="group rounded-lg bg-gray-100 p-0.5 hover:bg-gray-200"
5
5
  aria-label="Tabs"
6
6
  >
7
- <div
8
- class="absolute inset-y-0.5 rounded-md bg-white shadow-sm ring-1 ring-black ring-opacity-5 transition-all duration-200 ease-in-out"
9
- :style="overlayStyle"
10
- ></div>
11
- <button
12
- v-for="(tabOption, index) in tabOptions"
13
- :key="index"
14
- ref="tabButtons"
15
- class="relative z-10 flex min-w-0 flex-grow rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-100"
16
- :tabindex="getTabIdentifier(tabOption) === currentTab ? '0' : '-1'"
17
- :id="id"
18
- :style="computedStyles"
19
- :aria-label="tabOption.label"
20
- :aria-selected="getTabIdentifier(tabOption) === currentTab"
21
- :aria-current="getTabIdentifier(tabOption) === currentTab"
22
- :aria-controls="getTabIdentifier(tabOption)"
23
- @click="handleButtonClick(tabOption)"
24
- >
7
+ <div class="relative inline-flex">
25
8
  <div
26
- class="inset-tabs-classes flex min-w-0 flex-grow items-center justify-center space-x-2 rounded-md p-1.5 text-sm font-medium lg:pl-2.5 lg:pr-3.5"
9
+ class="inset-tabs-overlay pointer-events-none absolute inset-y-0 left-0 rounded-md bg-white shadow-sm ring-1 ring-black ring-opacity-5"
10
+ :style="overlayStyle"
11
+ ></div>
12
+ <button
13
+ v-for="(tabOption, index) in tabOptions"
14
+ :key="index"
15
+ ref="tabButtons"
16
+ type="button"
17
+ class="inset-tabs-classes relative z-10 inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border-0 bg-transparent px-3 py-1.5 text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-100"
18
+ :tabindex="getTabIdentifier(tabOption) === currentTab ? '0' : '-1'"
19
+ :id="id ? `${id}-${getTabIdentifier(tabOption).toLowerCase()}` : getTabIdentifier(tabOption).toLowerCase()"
20
+ :style="computedStyles"
21
+ :aria-label="tabOption.label"
22
+ :aria-selected="getTabIdentifier(tabOption) === currentTab"
23
+ :aria-current="getTabIdentifier(tabOption) === currentTab"
24
+ :aria-controls="getTabIdentifier(tabOption)"
25
+ @click="handleButtonClick(tabOption)"
27
26
  >
28
27
  <c-icon
29
28
  v-if="tabOption.icon"
30
29
  :type="tabOption.icon.type"
31
30
  :class="[
32
- 'inset-tabs-icon h-5 w-5',
31
+ 'inset-tabs-icon h-5 w-5 shrink-0',
33
32
  getTabIdentifier(tabOption) === currentTab
34
33
  ? 'inset-tabs-icon-selected'
35
34
  : 'text-gray-400',
@@ -48,8 +47,8 @@
48
47
  ]"
49
48
  >{{ tabOption.label }}</span
50
49
  >
51
- </div>
52
- </button>
50
+ </button>
51
+ </div>
53
52
  </nav>
54
53
  </div>
55
54
  </template>
@@ -69,6 +68,7 @@ export default {
69
68
  },
70
69
  id: {
71
70
  type: String,
71
+ default: "tab",
72
72
  },
73
73
  tabOptions: {
74
74
  type: Array,
@@ -96,16 +96,19 @@ export default {
96
96
  },
97
97
  updateOverlayPosition() {
98
98
  const tabButtons = this.$refs.tabButtons;
99
- if (!tabButtons) return;
100
-
99
+ if (!tabButtons || !tabButtons.length) return;
100
+
101
101
  const index = this.tabOptions.findIndex(
102
102
  (tab) => this.getTabIdentifier(tab) === this.currentTab
103
103
  );
104
+ if (index === -1) return;
104
105
  const tabButton = tabButtons[index];
105
106
  if (!tabButton) return;
106
-
107
- this.overlayStyle.width = `${tabButton.offsetWidth}px`;
108
- this.overlayStyle.transform = `translateX(${tabButton.offsetLeft}px)`;
107
+
108
+ this.overlayStyle = {
109
+ width: `${tabButton.offsetWidth}px`,
110
+ transform: `translateX(${tabButton.offsetLeft}px)`,
111
+ };
109
112
  },
110
113
  },
111
114
  computed: {
@@ -127,9 +130,12 @@ export default {
127
130
  };
128
131
  </script>
129
132
 
130
-
131
133
  <style>
134
+ .inset-tabs-overlay {
135
+ transition: transform 200ms ease-in-out, width 200ms ease-in-out;
136
+ }
137
+
132
138
  .inset-tabs-icon.inset-tabs-icon-selected {
133
139
  color: var(--inset-tab-icon-color);
134
140
  }
135
- </style>
141
+ </style>
@@ -7,7 +7,7 @@
7
7
  tagClasses,
8
8
  useFlex ? 'flex' : 'inline-flex',
9
9
  ]"
10
- class="items-center rounded-md px-2.5 py-0.5 text-sm"
10
+ class="items-center rounded-md px-3 py-0.5 text-sm"
11
11
  >
12
12
  <span
13
13
  v-if="dotIcon"
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  <button
17
17
  type="button"
18
- class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 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"
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"
19
19
  @click="initFilestack()"
20
20
  :id="id"
21
21
  v-if="displayMode == 'overlay' && icon"
@@ -38,6 +38,7 @@
38
38
  <c-icon
39
39
  name="arrow-up"
40
40
  type="solid"
41
+ cursorType="cursor-pointer"
41
42
  class="mr-1 h-5 w-5 flex-none text-indigo-600"
42
43
  viewBox="0 0 20 20"
43
44
  ></c-icon>
@@ -38,6 +38,12 @@ export default {
38
38
  ],
39
39
  },
40
40
  },
41
+ colorVariant: {
42
+ control: {
43
+ type: "select",
44
+ options: ["red", "yellow", "indigo"],
45
+ },
46
+ },
41
47
  },
42
48
  };
43
49
 
@@ -57,4 +63,5 @@ Default.args = {
57
63
  actionTwoType: "danger",
58
64
  loadButton: false,
59
65
  isTextAreaEnabled: false,
66
+ colorVariant: "red",
60
67
  };