classcard-ui 0.2.1483 → 0.2.1484
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/dist/classcard-ui.common.js +128 -98
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.css +1 -1
- package/dist/classcard-ui.umd.js +128 -98
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +3 -3
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CConfirmActionModal/CConfirmActionModal.vue +34 -2
- package/src/components/CInsetTabs/CInsetTabs.vue +37 -31
- package/src/stories/CConfirmActionModal.stories.js +7 -0
package/package.json
CHANGED
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
>
|
|
51
51
|
<div
|
|
52
52
|
aria-hidden="true"
|
|
53
|
-
class="
|
|
53
|
+
:class="iconContainerClasses"
|
|
54
54
|
>
|
|
55
55
|
<c-icon
|
|
56
56
|
name="exclamation-triangle-outline-v2"
|
|
57
57
|
type="outline-v2"
|
|
58
|
-
class="
|
|
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
|
|
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-
|
|
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
|
-
</
|
|
52
|
-
</
|
|
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
|
|
108
|
-
|
|
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>
|
|
@@ -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
|
};
|