classcard-ui 0.2.1475 → 0.2.1476
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/README.md +24 -24
- package/dist/classcard-ui.common.js +86 -85
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.css +1 -1
- package/dist/classcard-ui.umd.js +86 -85
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +1 -1
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +83 -83
- package/src/App.vue +16 -16
- package/src/colorConfig.js +52 -52
- package/src/components/CAlertModal/CAlertModal.vue +179 -179
- package/src/components/CAlertModal/index.js +3 -3
- package/src/components/CAlerts/CAlerts.vue +114 -114
- package/src/components/CAlerts/index.js +2 -2
- package/src/components/CAnchorTabs/CAnchorTabs.vue +100 -100
- package/src/components/CAnchorTabs/index.js +2 -2
- package/src/components/CAnchorTag/CAnchorTag.vue +84 -84
- package/src/components/CAnchorTag/index.js +2 -2
- package/src/components/CAvatar/CAvatar.vue +230 -230
- package/src/components/CAvatar/index.js +2 -2
- package/src/components/CAvatarGroup/CAvatarGroup.vue +213 -213
- package/src/components/CAvatarGroup/index.js +2 -2
- package/src/components/CBasicTable/CBasicTable.vue +184 -184
- package/src/components/CBasicTable/index.js +2 -2
- package/src/components/CBreadcrumbs/CBreadcrumbs.vue +38 -38
- package/src/components/CBreadcrumbs/index.js +2 -2
- package/src/components/CButton/CButton.vue +239 -239
- package/src/components/CButton/index.js +2 -2
- package/src/components/CButtonGroup/CButtonGroup.vue +155 -155
- package/src/components/CButtonGroup/index.js +2 -2
- package/src/components/CButtonIcon/CButtonIcon.vue +166 -166
- package/src/components/CButtonIcon/index.js +2 -2
- package/src/components/CButtonLink/CButtonLink.vue +43 -43
- package/src/components/CButtonLink/index.js +2 -2
- package/src/components/CButtonSelect/CButtonSelect.vue +186 -186
- package/src/components/CButtonSelect/index.js +2 -2
- package/src/components/CButtonSelectBorder/CButtonSelectBorder.vue +265 -265
- package/src/components/CButtonSelectBorder/index.js +3 -3
- package/src/components/CButtonWithDropdown/CButtonWithDropdown.vue +152 -152
- package/src/components/CButtonWithDropdown/index.js +2 -2
- package/src/components/CCalendar/CCalendar.vue +443 -443
- package/src/components/CCalendar/index.js +3 -3
- package/src/components/CCard/CCard.vue +53 -53
- package/src/components/CCard/index.js +2 -2
- package/src/components/CCheckbox/CCheckbox.vue +200 -200
- package/src/components/CCheckbox/index.js +2 -2
- package/src/components/CCircularButton/CCircularButton.vue +57 -57
- package/src/components/CCircularButton/index.js +2 -2
- package/src/components/CCollapsibleSection/CCollapsibleSection.vue +121 -121
- package/src/components/CCollapsibleSection/index.js +2 -2
- package/src/components/CColorDots/CColorDots.vue +52 -52
- package/src/components/CColorDots/index.js +3 -3
- package/src/components/CConfirmActionModal/CConfirmActionModal.vue +221 -221
- package/src/components/CConfirmActionModal/index.js +3 -3
- package/src/components/CDatepicker/CDatepicker.vue +235 -235
- package/src/components/CDatepicker/index.js +2 -2
- package/src/components/CDualSelect/CDualSelect.vue +193 -193
- package/src/components/CDualSelect/index.js +2 -2
- package/src/components/CEditor/CEditor.vue +114 -114
- package/src/components/CEditor/index.js +2 -2
- package/src/components/CFormSectionHeading/CFormSectionHeading.vue +76 -76
- package/src/components/CFormSectionHeading/index.js +2 -2
- package/src/components/CGroupedFilterDropdown/CGroupedFilterDropdown.vue +263 -263
- package/src/components/CGroupedFilterDropdown/index.js +2 -2
- package/src/components/CGroupedSelect/CGroupedSelect.vue +366 -366
- package/src/components/CGroupedSelect/index.js +3 -3
- package/src/components/CIcon/CIcon.vue +112 -112
- package/src/components/CIcon/index.js +2 -2
- package/src/components/CIconDropdown/CIconDropdown.vue +206 -206
- package/src/components/CIconDropdown/index.js +2 -2
- package/src/components/CIconSelect/CIconSelect.vue +182 -182
- package/src/components/CIconSelect/index.js +3 -3
- package/src/components/CInput/CInput.vue +173 -173
- package/src/components/CInput/index.js +2 -2
- package/src/components/CInputAddon/CInputAddon.vue +297 -297
- package/src/components/CInputAddon/index.js +2 -2
- package/src/components/CInputEmail/CInputEmail.vue +107 -107
- package/src/components/CInputEmail/index.js +2 -2
- package/src/components/CInsetTabs/CInsetTabs.vue +134 -134
- package/src/components/CInsetTabs/index.js +3 -3
- package/src/components/CModalHeading/CModalHeading.vue +22 -22
- package/src/components/CModalHeading/index.js +2 -2
- package/src/components/CModuleHelpLinks/CModuleHelpLinks.vue +88 -88
- package/src/components/CModuleHelpLinks/index.js +3 -3
- package/src/components/CMultiselect/CMultiselect.vue +1170 -1170
- package/src/components/CMultiselect/index.js +2 -2
- package/src/components/CMultiselectr/CMultiselectr.vue +44 -44
- package/src/components/CMultiselectr/index.js +2 -2
- package/src/components/CPageHeading/CPageHeading.vue +83 -83
- package/src/components/CPageHeading/index.js +2 -2
- package/src/components/CPagination/CPagination.vue +239 -239
- package/src/components/CPagination/index.js +2 -2
- package/src/components/CPhoneNumber/CPhoneNumber.vue +213 -213
- package/src/components/CPhoneNumber/index.js +2 -2
- package/src/components/CProgress/CProgress.vue +91 -91
- package/src/components/CProgress/index.js +2 -2
- package/src/components/CRadio/CRadio.vue +197 -197
- package/src/components/CRadio/index.js +2 -2
- package/src/components/CRadioGroup/CRadioGroup.vue +96 -96
- package/src/components/CRadioGroup/index.js +2 -2
- package/src/components/CRangeSlider/CRangeSlider.vue +55 -55
- package/src/components/CRangeSlider/index.js +2 -2
- package/src/components/CReorderableStackedList/CReorderableStackedList.vue +94 -94
- package/src/components/CReorderableStackedList/index.js +2 -2
- package/src/components/CSelect/CSelect.vue +1210 -1210
- package/src/components/CSelect/index.js +2 -2
- package/src/components/CSmallTimeline/CSmallTimeline.vue +40 -40
- package/src/components/CSmallTimeline/index.js +2 -2
- package/src/components/CStackedList/CStackedList.vue +162 -162
- package/src/components/CStackedList/index.js +2 -2
- package/src/components/CStats/CStats.vue +157 -157
- package/src/components/CStats/index.js +2 -2
- package/src/components/CSwitch/CSwitch.vue +200 -200
- package/src/components/CSwitch/index.js +2 -2
- package/src/components/CTabLazy/CTabLazy.vue +83 -83
- package/src/components/CTabLazy/index.js +2 -2
- package/src/components/CTable/CTable.vue +1114 -1114
- package/src/components/CTable/index.js +2 -2
- package/src/components/CTabs/CTabs.vue +250 -250
- package/src/components/CTabs/index.js +2 -2
- package/src/components/CTag/CTag.vue +109 -109
- package/src/components/CTag/index.js +2 -2
- package/src/components/CTextarea/CTextarea.vue +118 -118
- package/src/components/CTextarea/index.js +2 -2
- package/src/components/CTimeline/CTimeline.vue +237 -237
- package/src/components/CTimeline/index.js +2 -2
- package/src/components/CToolTip/CToolTip.vue +108 -108
- package/src/components/CToolTip/index.js +3 -3
- package/src/components/CUpload/CUpload.vue +331 -331
- package/src/components/CUpload/index.js +2 -2
- package/src/components/NumberAnimator.vue +112 -112
- package/src/components/index.js +57 -57
- package/src/helper.js +8 -8
- package/src/icons.js +831 -830
- package/src/main.js +22 -22
- package/src/stories/CAlertModal.stories.js +30 -30
- package/src/stories/CAlerts.stories.js +39 -39
- package/src/stories/CAnchorTabs.stories.js +29 -29
- package/src/stories/CAnchorTag.stories.js +38 -38
- package/src/stories/CAvatar.stories.js +38 -38
- package/src/stories/CAvatarGroup.stories.js +136 -136
- package/src/stories/CBasicTable.stories.js +316 -316
- package/src/stories/CBreadcrumbs.stories.js +24 -24
- package/src/stories/CButton.stories.js +49 -49
- package/src/stories/CButtonGroup.stories.js +43 -43
- package/src/stories/CButtonIcon.stories.js +27 -27
- package/src/stories/CButtonLink.stories.js +24 -24
- package/src/stories/CButtonSelect.stories.js +44 -44
- package/src/stories/CButtonSelectBorder.stories.js +56 -56
- package/src/stories/CButtonWithDropdown.stories.js +41 -41
- package/src/stories/CCalendar.stories.js +16 -16
- package/src/stories/CCard.stories.js +30 -30
- package/src/stories/CCheckbox.stories.js +38 -38
- package/src/stories/CCircularButton.stories.js +29 -29
- package/src/stories/CCollapsibleSection.stories.js +29 -29
- package/src/stories/CColorDots.stories.js +37 -37
- package/src/stories/CConfirmActionModal.stories.js +60 -60
- package/src/stories/CDatepicker.stories.js +31 -31
- package/src/stories/CDualSelect.stories.js +29 -29
- package/src/stories/CEditor.stories.js +30 -30
- package/src/stories/CFormSectionHeading.stories.js +37 -37
- package/src/stories/CGroupedFilterDropdown.stories.js +176 -176
- package/src/stories/CGroupedSelect.stories.js +103 -103
- package/src/stories/CIcon.stories.js +31 -31
- package/src/stories/CIconDropdown.stories.js +52 -52
- package/src/stories/CIconSelect.stories.js +45 -45
- package/src/stories/CInput.stories.js +36 -36
- package/src/stories/CInputAddon.stories.js +37 -37
- package/src/stories/CInputEmail.stories.js +27 -27
- package/src/stories/CInsetTabs.stories.js +48 -48
- package/src/stories/CModalHeading.stories.js +25 -25
- package/src/stories/CModuleHelpLinks.stories.js +25 -25
- package/src/stories/CMultiselect.stories.js +136 -136
- package/src/stories/CMultiselectr.stories.js +23 -23
- package/src/stories/CPageHeading.stories.js +32 -32
- package/src/stories/CPagination.stories.js +30 -30
- package/src/stories/CPhoneNumber.stories.js +37 -37
- package/src/stories/CProgress.stories.js +23 -23
- package/src/stories/CRadio.stories.js +44 -44
- package/src/stories/CRadioGroup.stories.js +51 -51
- package/src/stories/CRangeSlider.stories.js +23 -23
- package/src/stories/CReorderableStackedList.stories.js +23 -23
- package/src/stories/CSelect.stories.js +157 -157
- package/src/stories/CSmallTimeline.stories.js +26 -26
- package/src/stories/CStackedList.stories.js +37 -37
- package/src/stories/CStats.stories.js +53 -53
- package/src/stories/CSwitch.stories.js +28 -28
- package/src/stories/CTabLazy.stories.js +42 -42
- package/src/stories/CTable.stories.js +203 -203
- package/src/stories/CTabs.stories.js +36 -36
- package/src/stories/CTag.stories.js +37 -37
- package/src/stories/CTextarea.stories.js +32 -32
- package/src/stories/CTimeline.stories.js +26 -26
- package/src/stories/CToolTip.stories.js +27 -27
- package/src/stories/CUpload.stories.js +36 -36
- package/src/stories/Introduction.stories.mdx +207 -207
- package/src/stories/Page.vue +88 -88
- package/src/stories/assets/code-brackets.svg +0 -0
- package/src/stories/assets/colors.svg +0 -0
- package/src/stories/assets/comments.svg +0 -0
- package/src/stories/assets/direction.svg +0 -0
- package/src/stories/assets/flow.svg +0 -0
- package/src/stories/assets/plugin.svg +0 -0
- package/src/stories/assets/repo.svg +0 -0
- package/src/stories/assets/stackalt.svg +0 -0
- package/src/stories/header.css +26 -26
- package/src/stories/page.css +69 -69
- package/src/stories/utils.css +32 -32
|
@@ -1,200 +1,200 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<!-- small toggle -->
|
|
4
|
-
<div
|
|
5
|
-
v-if="size === 'small'"
|
|
6
|
-
:class="[
|
|
7
|
-
label == '' ? 'items-center' : 'items-start',
|
|
8
|
-
disabled ? 'pointer-events-none cursor-default' : 'cursor-pointer',
|
|
9
|
-
]"
|
|
10
|
-
class="flex"
|
|
11
|
-
>
|
|
12
|
-
<span
|
|
13
|
-
class="mr-2 flex flex-grow flex-col"
|
|
14
|
-
:id="id"
|
|
15
|
-
v-if="direction == 'left'"
|
|
16
|
-
@click="switchValue"
|
|
17
|
-
>
|
|
18
|
-
<span v-if="label" :class="classes" class="text-gray-900">{{
|
|
19
|
-
label
|
|
20
|
-
}}</span>
|
|
21
|
-
<span v-if="description" class="text-sm text-gray-500">{{
|
|
22
|
-
description
|
|
23
|
-
}}</span>
|
|
24
|
-
</span>
|
|
25
|
-
<button
|
|
26
|
-
type="button"
|
|
27
|
-
class="group switch-state disabled-pointer-events-none relative inline-flex h-5 w-10 flex-shrink-0 cursor-pointer items-center justify-center rounded-full disabled:cursor-default disabled:opacity-50"
|
|
28
|
-
aria-pressed="false"
|
|
29
|
-
:style="colorStyles"
|
|
30
|
-
@click="switchValue"
|
|
31
|
-
:disabled="disabled"
|
|
32
|
-
>
|
|
33
|
-
<span class="sr-only">Use setting</span>
|
|
34
|
-
<span
|
|
35
|
-
aria-hidden="true"
|
|
36
|
-
class="pointer-events-none absolute h-full w-full rounded-md"
|
|
37
|
-
></span>
|
|
38
|
-
<span
|
|
39
|
-
aria-hidden="true"
|
|
40
|
-
class="switch-state pointer-events-none absolute mx-auto h-4 w-9 rounded-full transition-colors duration-200 ease-in-out"
|
|
41
|
-
:style="colorStyles"
|
|
42
|
-
></span>
|
|
43
|
-
<span
|
|
44
|
-
aria-hidden="true"
|
|
45
|
-
:class="{ 'translate-x-5': isToggle, 'translate-x-0': !isToggle }"
|
|
46
|
-
class="pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-full border border-gray-200 bg-white ring-0 transition-transform duration-200 ease-in-out"
|
|
47
|
-
></span>
|
|
48
|
-
</button>
|
|
49
|
-
<span
|
|
50
|
-
class="ml-2 flex flex-col"
|
|
51
|
-
:id="id"
|
|
52
|
-
v-if="direction == 'right'"
|
|
53
|
-
@click="switchValue"
|
|
54
|
-
>
|
|
55
|
-
<span v-if="label" :class="classes" class="text-gray-900">{{
|
|
56
|
-
label
|
|
57
|
-
}}</span>
|
|
58
|
-
<span v-if="description" class="text-sm text-gray-500">{{
|
|
59
|
-
description
|
|
60
|
-
}}</span>
|
|
61
|
-
</span>
|
|
62
|
-
</div>
|
|
63
|
-
<!-- large toggle -->
|
|
64
|
-
<div
|
|
65
|
-
v-else
|
|
66
|
-
:class="[
|
|
67
|
-
label == '' ? 'items-center' : 'items-start',
|
|
68
|
-
disabled ? 'pointer-events-none cursor-default' : 'cursor-pointer',
|
|
69
|
-
]"
|
|
70
|
-
class="flex cursor-pointer justify-between"
|
|
71
|
-
>
|
|
72
|
-
<span
|
|
73
|
-
class="mr-2 flex flex-grow flex-col"
|
|
74
|
-
:id="id"
|
|
75
|
-
v-if="direction == 'left'"
|
|
76
|
-
@click="switchValue"
|
|
77
|
-
>
|
|
78
|
-
<span v-if="label" :class="classes" class="text-gray-900">{{
|
|
79
|
-
label
|
|
80
|
-
}}</span>
|
|
81
|
-
<span v-if="description" class="text-sm text-gray-500">{{
|
|
82
|
-
description
|
|
83
|
-
}}</span>
|
|
84
|
-
</span>
|
|
85
|
-
<button
|
|
86
|
-
type="button"
|
|
87
|
-
aria-pressed="false"
|
|
88
|
-
:class="{
|
|
89
|
-
'cursor-default': disabled,
|
|
90
|
-
'cursor-pointer': !disabled,
|
|
91
|
-
}"
|
|
92
|
-
class="switch-state relative inline-flex h-6 w-11 flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out disabled:pointer-events-none disabled:opacity-50"
|
|
93
|
-
:style="colorStyles"
|
|
94
|
-
@click.stop="switchValue"
|
|
95
|
-
:disabled="disabled"
|
|
96
|
-
>
|
|
97
|
-
<span class="sr-only">Use setting</span>
|
|
98
|
-
<span
|
|
99
|
-
aria-hidden="true"
|
|
100
|
-
:class="{
|
|
101
|
-
'translate-x-5': isToggle == 1,
|
|
102
|
-
'translate-x-0': isToggle == 0,
|
|
103
|
-
}"
|
|
104
|
-
class="inline-block h-5 w-5 transform rounded-full bg-white ring-0 transition duration-200 ease-in-out"
|
|
105
|
-
></span>
|
|
106
|
-
</button>
|
|
107
|
-
<span
|
|
108
|
-
class="ml-2 flex flex-col disabled:opacity-50"
|
|
109
|
-
:id="id"
|
|
110
|
-
v-if="direction == 'right'"
|
|
111
|
-
>
|
|
112
|
-
<span v-if="label" :class="classes" class="text-gray-900">{{
|
|
113
|
-
label
|
|
114
|
-
}}</span>
|
|
115
|
-
<span v-if="description" class="text-sm text-gray-500">{{
|
|
116
|
-
description
|
|
117
|
-
}}</span>
|
|
118
|
-
</span>
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
</template>
|
|
122
|
-
|
|
123
|
-
<script>
|
|
124
|
-
import { COLOR_CONFIG } from "../../colorConfig";
|
|
125
|
-
|
|
126
|
-
export default {
|
|
127
|
-
name: "CSwitch",
|
|
128
|
-
components: {},
|
|
129
|
-
props: {
|
|
130
|
-
label: {
|
|
131
|
-
type: String,
|
|
132
|
-
},
|
|
133
|
-
id: {
|
|
134
|
-
type: String,
|
|
135
|
-
},
|
|
136
|
-
description: {
|
|
137
|
-
type: String,
|
|
138
|
-
},
|
|
139
|
-
returnToggleValue: {
|
|
140
|
-
type: Function,
|
|
141
|
-
},
|
|
142
|
-
classes: {
|
|
143
|
-
type: String,
|
|
144
|
-
},
|
|
145
|
-
value: { type: Number },
|
|
146
|
-
size: {
|
|
147
|
-
type: String,
|
|
148
|
-
},
|
|
149
|
-
direction: {
|
|
150
|
-
type: String,
|
|
151
|
-
},
|
|
152
|
-
disabled: {
|
|
153
|
-
type: Boolean,
|
|
154
|
-
default: false,
|
|
155
|
-
},
|
|
156
|
-
preferredColor: {
|
|
157
|
-
type: String,
|
|
158
|
-
default: "indigo",
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
data() {
|
|
162
|
-
return {
|
|
163
|
-
isToggle: this.value,
|
|
164
|
-
};
|
|
165
|
-
},
|
|
166
|
-
methods: {
|
|
167
|
-
switchValue() {
|
|
168
|
-
if (!this.disabled) {
|
|
169
|
-
this.isToggle = this.isToggle === 1 ? 0 : 1;
|
|
170
|
-
this.$emit("returnToggleValue", this.isToggle);
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
watch: {
|
|
175
|
-
value() {
|
|
176
|
-
this.isToggle = this.value;
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
computed: {
|
|
180
|
-
colorStyles() {
|
|
181
|
-
const colors = COLOR_CONFIG[this.preferredColor] || COLOR_CONFIG.indigo;
|
|
182
|
-
const isOn = this.isToggle === 1 || this.isToggle === true;
|
|
183
|
-
return {
|
|
184
|
-
"--switch-enabled-color": isOn ? colors.shade600 : "#e5e7eb", // gray-200 when off
|
|
185
|
-
"--switch-focus-color": colors.shade500,
|
|
186
|
-
};
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
</script>
|
|
191
|
-
|
|
192
|
-
<style scoped>
|
|
193
|
-
.switch-state {
|
|
194
|
-
background-color: var(--switch-enabled-color) !important;
|
|
195
|
-
}
|
|
196
|
-
.switch-state:focus {
|
|
197
|
-
outline: none;
|
|
198
|
-
box-shadow: 0 0 0 2px white, 0 0 0 4px var(--switch-focus-color) !important;
|
|
199
|
-
}
|
|
200
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<!-- small toggle -->
|
|
4
|
+
<div
|
|
5
|
+
v-if="size === 'small'"
|
|
6
|
+
:class="[
|
|
7
|
+
label == '' ? 'items-center' : 'items-start',
|
|
8
|
+
disabled ? 'pointer-events-none cursor-default' : 'cursor-pointer',
|
|
9
|
+
]"
|
|
10
|
+
class="flex"
|
|
11
|
+
>
|
|
12
|
+
<span
|
|
13
|
+
class="mr-2 flex flex-grow flex-col"
|
|
14
|
+
:id="id"
|
|
15
|
+
v-if="direction == 'left'"
|
|
16
|
+
@click="switchValue"
|
|
17
|
+
>
|
|
18
|
+
<span v-if="label" :class="classes" class="text-gray-900">{{
|
|
19
|
+
label
|
|
20
|
+
}}</span>
|
|
21
|
+
<span v-if="description" class="text-sm text-gray-500">{{
|
|
22
|
+
description
|
|
23
|
+
}}</span>
|
|
24
|
+
</span>
|
|
25
|
+
<button
|
|
26
|
+
type="button"
|
|
27
|
+
class="group switch-state disabled-pointer-events-none relative inline-flex h-5 w-10 flex-shrink-0 cursor-pointer items-center justify-center rounded-full disabled:cursor-default disabled:opacity-50"
|
|
28
|
+
aria-pressed="false"
|
|
29
|
+
:style="colorStyles"
|
|
30
|
+
@click="switchValue"
|
|
31
|
+
:disabled="disabled"
|
|
32
|
+
>
|
|
33
|
+
<span class="sr-only">Use setting</span>
|
|
34
|
+
<span
|
|
35
|
+
aria-hidden="true"
|
|
36
|
+
class="pointer-events-none absolute h-full w-full rounded-md"
|
|
37
|
+
></span>
|
|
38
|
+
<span
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
class="switch-state pointer-events-none absolute mx-auto h-4 w-9 rounded-full transition-colors duration-200 ease-in-out"
|
|
41
|
+
:style="colorStyles"
|
|
42
|
+
></span>
|
|
43
|
+
<span
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
:class="{ 'translate-x-5': isToggle, 'translate-x-0': !isToggle }"
|
|
46
|
+
class="pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-full border border-gray-200 bg-white ring-0 transition-transform duration-200 ease-in-out"
|
|
47
|
+
></span>
|
|
48
|
+
</button>
|
|
49
|
+
<span
|
|
50
|
+
class="ml-2 flex flex-col"
|
|
51
|
+
:id="id"
|
|
52
|
+
v-if="direction == 'right'"
|
|
53
|
+
@click="switchValue"
|
|
54
|
+
>
|
|
55
|
+
<span v-if="label" :class="classes" class="text-gray-900">{{
|
|
56
|
+
label
|
|
57
|
+
}}</span>
|
|
58
|
+
<span v-if="description" class="text-sm text-gray-500">{{
|
|
59
|
+
description
|
|
60
|
+
}}</span>
|
|
61
|
+
</span>
|
|
62
|
+
</div>
|
|
63
|
+
<!-- large toggle -->
|
|
64
|
+
<div
|
|
65
|
+
v-else
|
|
66
|
+
:class="[
|
|
67
|
+
label == '' ? 'items-center' : 'items-start',
|
|
68
|
+
disabled ? 'pointer-events-none cursor-default' : 'cursor-pointer',
|
|
69
|
+
]"
|
|
70
|
+
class="flex cursor-pointer justify-between"
|
|
71
|
+
>
|
|
72
|
+
<span
|
|
73
|
+
class="mr-2 flex flex-grow flex-col"
|
|
74
|
+
:id="id"
|
|
75
|
+
v-if="direction == 'left'"
|
|
76
|
+
@click="switchValue"
|
|
77
|
+
>
|
|
78
|
+
<span v-if="label" :class="classes" class="text-gray-900">{{
|
|
79
|
+
label
|
|
80
|
+
}}</span>
|
|
81
|
+
<span v-if="description" class="text-sm text-gray-500">{{
|
|
82
|
+
description
|
|
83
|
+
}}</span>
|
|
84
|
+
</span>
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
aria-pressed="false"
|
|
88
|
+
:class="{
|
|
89
|
+
'cursor-default': disabled,
|
|
90
|
+
'cursor-pointer': !disabled,
|
|
91
|
+
}"
|
|
92
|
+
class="switch-state relative inline-flex h-6 w-11 flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out disabled:pointer-events-none disabled:opacity-50"
|
|
93
|
+
:style="colorStyles"
|
|
94
|
+
@click.stop="switchValue"
|
|
95
|
+
:disabled="disabled"
|
|
96
|
+
>
|
|
97
|
+
<span class="sr-only">Use setting</span>
|
|
98
|
+
<span
|
|
99
|
+
aria-hidden="true"
|
|
100
|
+
:class="{
|
|
101
|
+
'translate-x-5': isToggle == 1,
|
|
102
|
+
'translate-x-0': isToggle == 0,
|
|
103
|
+
}"
|
|
104
|
+
class="inline-block h-5 w-5 transform rounded-full bg-white ring-0 transition duration-200 ease-in-out"
|
|
105
|
+
></span>
|
|
106
|
+
</button>
|
|
107
|
+
<span
|
|
108
|
+
class="ml-2 flex flex-col disabled:opacity-50"
|
|
109
|
+
:id="id"
|
|
110
|
+
v-if="direction == 'right'"
|
|
111
|
+
>
|
|
112
|
+
<span v-if="label" :class="classes" class="text-gray-900">{{
|
|
113
|
+
label
|
|
114
|
+
}}</span>
|
|
115
|
+
<span v-if="description" class="text-sm text-gray-500">{{
|
|
116
|
+
description
|
|
117
|
+
}}</span>
|
|
118
|
+
</span>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</template>
|
|
122
|
+
|
|
123
|
+
<script>
|
|
124
|
+
import { COLOR_CONFIG } from "../../colorConfig";
|
|
125
|
+
|
|
126
|
+
export default {
|
|
127
|
+
name: "CSwitch",
|
|
128
|
+
components: {},
|
|
129
|
+
props: {
|
|
130
|
+
label: {
|
|
131
|
+
type: String,
|
|
132
|
+
},
|
|
133
|
+
id: {
|
|
134
|
+
type: String,
|
|
135
|
+
},
|
|
136
|
+
description: {
|
|
137
|
+
type: String,
|
|
138
|
+
},
|
|
139
|
+
returnToggleValue: {
|
|
140
|
+
type: Function,
|
|
141
|
+
},
|
|
142
|
+
classes: {
|
|
143
|
+
type: String,
|
|
144
|
+
},
|
|
145
|
+
value: { type: Number },
|
|
146
|
+
size: {
|
|
147
|
+
type: String,
|
|
148
|
+
},
|
|
149
|
+
direction: {
|
|
150
|
+
type: String,
|
|
151
|
+
},
|
|
152
|
+
disabled: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: false,
|
|
155
|
+
},
|
|
156
|
+
preferredColor: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: "indigo",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
data() {
|
|
162
|
+
return {
|
|
163
|
+
isToggle: this.value,
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
methods: {
|
|
167
|
+
switchValue() {
|
|
168
|
+
if (!this.disabled) {
|
|
169
|
+
this.isToggle = this.isToggle === 1 ? 0 : 1;
|
|
170
|
+
this.$emit("returnToggleValue", this.isToggle);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
watch: {
|
|
175
|
+
value() {
|
|
176
|
+
this.isToggle = this.value;
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
computed: {
|
|
180
|
+
colorStyles() {
|
|
181
|
+
const colors = COLOR_CONFIG[this.preferredColor] || COLOR_CONFIG.indigo;
|
|
182
|
+
const isOn = this.isToggle === 1 || this.isToggle === true;
|
|
183
|
+
return {
|
|
184
|
+
"--switch-enabled-color": isOn ? colors.shade600 : "#e5e7eb", // gray-200 when off
|
|
185
|
+
"--switch-focus-color": colors.shade500,
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<style scoped>
|
|
193
|
+
.switch-state {
|
|
194
|
+
background-color: var(--switch-enabled-color) !important;
|
|
195
|
+
}
|
|
196
|
+
.switch-state:focus {
|
|
197
|
+
outline: none;
|
|
198
|
+
box-shadow: 0 0 0 2px white, 0 0 0 4px var(--switch-focus-color) !important;
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CSwitch from './CSwitch.vue'
|
|
2
|
-
|
|
1
|
+
import CSwitch from './CSwitch.vue'
|
|
2
|
+
|
|
3
3
|
export default CSwitch
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="border-b border-gray-200">
|
|
4
|
-
<div class="mt-2 max-w-5xl pr-4">
|
|
5
|
-
<nav class="-mb-px flex space-x-8" aria-label="Tabs">
|
|
6
|
-
<button
|
|
7
|
-
v-for="tab in tabs"
|
|
8
|
-
:key="tab.key"
|
|
9
|
-
:class="[
|
|
10
|
-
activeTab === tab.key
|
|
11
|
-
? 'border-b-2 border-indigo-600 text-indigo-700'
|
|
12
|
-
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700',
|
|
13
|
-
'flex whitespace-nowrap py-4 px-1 text-sm font-medium',
|
|
14
|
-
]"
|
|
15
|
-
:id="getActionIDFn(tab.label)"
|
|
16
|
-
@click="handleChangeTab(tab)"
|
|
17
|
-
aria-current="page"
|
|
18
|
-
>
|
|
19
|
-
{{ tab.label }}
|
|
20
|
-
<div class="ml-1" v-if="tab.count">
|
|
21
|
-
<span
|
|
22
|
-
:class="
|
|
23
|
-
activeTab == tab.key
|
|
24
|
-
? 'rounded-full bg-indigo-100 px-2 py-0.5 text-indigo-700'
|
|
25
|
-
: 'rounded-full bg-gray-100 px-2 py-0.5 text-gray-700'
|
|
26
|
-
"
|
|
27
|
-
>
|
|
28
|
-
{{ tab.count }}
|
|
29
|
-
</span>
|
|
30
|
-
</div>
|
|
31
|
-
</button>
|
|
32
|
-
</nav>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
<div>
|
|
36
|
-
<component
|
|
37
|
-
:is="currentTabComponent"
|
|
38
|
-
:currentTabComponent="currentTabComponent"
|
|
39
|
-
:activeTab="activeTab"
|
|
40
|
-
:data="data"
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script>
|
|
47
|
-
import { getActionID } from "../../helper";
|
|
48
|
-
|
|
49
|
-
export default {
|
|
50
|
-
name: "CTabLazy",
|
|
51
|
-
props: {
|
|
52
|
-
tabs: {
|
|
53
|
-
type: Array,
|
|
54
|
-
required: true,
|
|
55
|
-
},
|
|
56
|
-
currentTabComponent: {
|
|
57
|
-
type: String,
|
|
58
|
-
required: true,
|
|
59
|
-
},
|
|
60
|
-
id: {
|
|
61
|
-
type: String,
|
|
62
|
-
},
|
|
63
|
-
data: {
|
|
64
|
-
type: Object,
|
|
65
|
-
required: false,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
data() {
|
|
69
|
-
return {
|
|
70
|
-
activeTab: this.tabs[0].key,
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
methods: {
|
|
74
|
-
getActionIDFn(name) {
|
|
75
|
-
return getActionID(name, this.id);
|
|
76
|
-
},
|
|
77
|
-
handleChangeTab(tab) {
|
|
78
|
-
this.activeTab = tab.key;
|
|
79
|
-
this.$emit("switchTab", this.activeTab);
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="border-b border-gray-200">
|
|
4
|
+
<div class="mt-2 max-w-5xl pr-4">
|
|
5
|
+
<nav class="-mb-px flex space-x-8" aria-label="Tabs">
|
|
6
|
+
<button
|
|
7
|
+
v-for="tab in tabs"
|
|
8
|
+
:key="tab.key"
|
|
9
|
+
:class="[
|
|
10
|
+
activeTab === tab.key
|
|
11
|
+
? 'border-b-2 border-indigo-600 text-indigo-700'
|
|
12
|
+
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700',
|
|
13
|
+
'flex whitespace-nowrap py-4 px-1 text-sm font-medium',
|
|
14
|
+
]"
|
|
15
|
+
:id="getActionIDFn(tab.label)"
|
|
16
|
+
@click="handleChangeTab(tab)"
|
|
17
|
+
aria-current="page"
|
|
18
|
+
>
|
|
19
|
+
{{ tab.label }}
|
|
20
|
+
<div class="ml-1" v-if="tab.count">
|
|
21
|
+
<span
|
|
22
|
+
:class="
|
|
23
|
+
activeTab == tab.key
|
|
24
|
+
? 'rounded-full bg-indigo-100 px-2 py-0.5 text-indigo-700'
|
|
25
|
+
: 'rounded-full bg-gray-100 px-2 py-0.5 text-gray-700'
|
|
26
|
+
"
|
|
27
|
+
>
|
|
28
|
+
{{ tab.count }}
|
|
29
|
+
</span>
|
|
30
|
+
</div>
|
|
31
|
+
</button>
|
|
32
|
+
</nav>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div>
|
|
36
|
+
<component
|
|
37
|
+
:is="currentTabComponent"
|
|
38
|
+
:currentTabComponent="currentTabComponent"
|
|
39
|
+
:activeTab="activeTab"
|
|
40
|
+
:data="data"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
import { getActionID } from "../../helper";
|
|
48
|
+
|
|
49
|
+
export default {
|
|
50
|
+
name: "CTabLazy",
|
|
51
|
+
props: {
|
|
52
|
+
tabs: {
|
|
53
|
+
type: Array,
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
currentTabComponent: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
id: {
|
|
61
|
+
type: String,
|
|
62
|
+
},
|
|
63
|
+
data: {
|
|
64
|
+
type: Object,
|
|
65
|
+
required: false,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
data() {
|
|
69
|
+
return {
|
|
70
|
+
activeTab: this.tabs[0].key,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
methods: {
|
|
74
|
+
getActionIDFn(name) {
|
|
75
|
+
return getActionID(name, this.id);
|
|
76
|
+
},
|
|
77
|
+
handleChangeTab(tab) {
|
|
78
|
+
this.activeTab = tab.key;
|
|
79
|
+
this.$emit("switchTab", this.activeTab);
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
</script>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import CTabLazy from "./CTabLazy.vue";
|
|
2
|
-
export default CTabLazy;
|
|
1
|
+
import CTabLazy from "./CTabLazy.vue";
|
|
2
|
+
export default CTabLazy;
|