classcard-ui 0.2.498 → 0.2.501
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 +81 -86
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +81 -86
- 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 +81 -81
- package/src/App.vue +16 -16
- package/src/components/CAlerts/CAlerts.vue +70 -70
- package/src/components/CAlerts/index.js +2 -2
- package/src/components/CAnchorTabs/CAnchorTabs.vue +104 -104
- package/src/components/CAnchorTabs/index.js +2 -2
- package/src/components/CAnchorTag/CAnchorTag.vue +62 -62
- package/src/components/CAnchorTag/index.js +2 -2
- package/src/components/CAvatar/CAvatar.vue +89 -89
- package/src/components/CAvatar/index.js +2 -2
- package/src/components/CAvatarGroup/CAvatarGroup.vue +145 -145
- 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 +150 -150
- package/src/components/CButton/index.js +2 -2
- package/src/components/CButtonGroup/CButtonGroup.vue +116 -116
- package/src/components/CButtonGroup/index.js +2 -2
- package/src/components/CButtonIcon/CButtonIcon.vue +91 -108
- package/src/components/CButtonIcon/index.js +2 -2
- package/src/components/CButtonLink/CButtonLink.vue +39 -39
- package/src/components/CButtonLink/index.js +2 -2
- package/src/components/CButtonSelect/CButtonSelect.vue +103 -103
- package/src/components/CButtonSelect/index.js +2 -2
- package/src/components/CButtonWithDropdown/CButtonWithDropdown.vue +168 -168
- package/src/components/CButtonWithDropdown/index.js +2 -2
- package/src/components/CCard/CCard.vue +49 -49
- package/src/components/CCard/index.js +2 -2
- package/src/components/CCheckbox/CCheckbox.vue +70 -70
- package/src/components/CCheckbox/index.js +2 -2
- package/src/components/CCollapsibleSection/CCollapsibleSection.vue +99 -99
- package/src/components/CCollapsibleSection/index.js +2 -2
- package/src/components/CColorDots/CColorDots.vue +35 -35
- package/src/components/CColorDots/index.js +3 -3
- package/src/components/CConfirmActionModal/CConfirmActionModal.vue +120 -120
- package/src/components/CConfirmActionModal/index.js +3 -3
- package/src/components/CDatepicker/CDatepicker.vue +134 -134
- 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 +91 -91
- package/src/components/CEditor/index.js +2 -2
- package/src/components/CFormSectionHeading/CFormSectionHeading.vue +52 -52
- package/src/components/CFormSectionHeading/index.js +2 -2
- package/src/components/CGroupedSelect/CGroupedSelect.vue +217 -212
- package/src/components/CGroupedSelect/index.js +3 -3
- package/src/components/CIcon/CIcon.vue +72 -72
- package/src/components/CIcon/index.js +2 -2
- package/src/components/CIconDropdown/CIconDropdown.vue +94 -94
- package/src/components/CIconDropdown/index.js +2 -2
- package/src/components/CInput/CInput.vue +115 -115
- package/src/components/CInput/index.js +2 -2
- package/src/components/CInputAddon/CInputAddon.vue +199 -199
- package/src/components/CInputAddon/index.js +2 -2
- package/src/components/CInputEmail/CInputEmail.vue +84 -84
- package/src/components/CInputEmail/index.js +2 -2
- package/src/components/CModalHeading/CModalHeading.vue +22 -22
- package/src/components/CModalHeading/index.js +2 -2
- package/src/components/CModuleHelpLinks/CModuleHelpLinks.vue +39 -39
- package/src/components/CModuleHelpLinks/index.js +3 -3
- package/src/components/CMultiselect/CMultiselect.vue +313 -313
- 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 +56 -56
- package/src/components/CPageHeading/index.js +2 -2
- package/src/components/CPagination/CPagination.vue +202 -202
- package/src/components/CPagination/index.js +2 -2
- package/src/components/CPhoneNumber/CPhoneNumber.vue +62 -62
- package/src/components/CPhoneNumber/index.js +2 -2
- package/src/components/CRadio/CRadio.vue +70 -70
- package/src/components/CRadio/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 +286 -286
- 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 +87 -87
- package/src/components/CStackedList/index.js +2 -2
- package/src/components/CStats/CStats.vue +88 -88
- package/src/components/CStats/index.js +2 -2
- package/src/components/CSwitch/CSwitch.vue +132 -132
- package/src/components/CSwitch/index.js +2 -2
- package/src/components/CTable/CTable.vue +501 -501
- package/src/components/CTable/index.js +2 -2
- package/src/components/CTabs/CTabs.vue +107 -107
- package/src/components/CTabs/index.js +2 -2
- package/src/components/CTag/CTag.vue +36 -36
- package/src/components/CTag/index.js +2 -2
- package/src/components/CTextarea/CTextarea.vue +85 -85
- 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/CUpload/CUpload.vue +196 -196
- package/src/components/CUpload/index.js +2 -2
- package/src/components/index.js +47 -47
- package/src/icons.js +254 -254
- package/src/main.js +22 -22
- package/src/stories/CAlerts.stories.js +37 -37
- package/src/stories/CAnchorTabs.stories.js +29 -29
- package/src/stories/CAnchorTag.stories.js +36 -36
- package/src/stories/CAvatar.stories.js +38 -38
- package/src/stories/CAvatarGroup.stories.js +100 -100
- package/src/stories/CBasicTable.stories.js +316 -316
- package/src/stories/CBreadcrumbs.stories.js +24 -24
- package/src/stories/CButton.stories.js +46 -46
- package/src/stories/CButtonGroup.stories.js +33 -33
- package/src/stories/CButtonIcon.stories.js +27 -27
- package/src/stories/CButtonLink.stories.js +24 -24
- package/src/stories/CButtonSelect.stories.js +32 -32
- package/src/stories/CButtonWithDropdown.stories.js +41 -41
- package/src/stories/CCard.stories.js +30 -30
- package/src/stories/CCheckbox.stories.js +29 -29
- package/src/stories/CCollapsibleSection.stories.js +28 -28
- package/src/stories/CColorDots.stories.js +28 -28
- package/src/stories/CConfirmActionModal.stories.js +59 -59
- package/src/stories/CDatepicker.stories.js +30 -30
- package/src/stories/CDualSelect.stories.js +29 -29
- package/src/stories/CEditor.stories.js +30 -30
- package/src/stories/CFormSectionHeading.stories.js +34 -34
- package/src/stories/CGroupedSelect.stories.js +69 -69
- package/src/stories/CIcon.stories.js +26 -26
- package/src/stories/CIconDropdown.stories.js +39 -39
- 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/CModalHeading.stories.js +25 -25
- package/src/stories/CModuleHelpLinks.stories.js +25 -25
- package/src/stories/CMultiselect.stories.js +97 -97
- 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 +29 -29
- package/src/stories/CRadio.stories.js +36 -36
- package/src/stories/CRangeSlider.stories.js +23 -23
- package/src/stories/CReorderableStackedList.stories.js +23 -23
- package/src/stories/CSelect.stories.js +50 -50
- package/src/stories/CSmallTimeline.stories.js +26 -26
- package/src/stories/CStackedList.stories.js +37 -37
- package/src/stories/CStats.stories.js +33 -33
- package/src/stories/CSwitch.stories.js +28 -28
- package/src/stories/CTable.stories.js +77 -77
- package/src/stories/CTabs.stories.js +29 -29
- package/src/stories/CTag.stories.js +23 -23
- package/src/stories/CTextarea.stories.js +32 -32
- package/src/stories/CTimeline.stories.js +26 -26
- 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 +17 -17
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="flex items-center">
|
|
4
|
-
<div v-if="label">
|
|
5
|
-
<label class="block text-sm font-medium text-gray-900">
|
|
6
|
-
{{ label }}
|
|
7
|
-
</label>
|
|
8
|
-
</div>
|
|
9
|
-
<!-- asterisk sign to render if field is required -->
|
|
10
|
-
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
11
|
-
</div>
|
|
12
|
-
<v-date-picker
|
|
13
|
-
:class="{
|
|
14
|
-
'inline-block h-full': true,
|
|
15
|
-
'w-full': isExpanded,
|
|
16
|
-
}"
|
|
17
|
-
:masks="masks"
|
|
18
|
-
@input="onDayClick"
|
|
19
|
-
:value="value"
|
|
20
|
-
:min-date="minDate"
|
|
21
|
-
:attributes="attrs"
|
|
22
|
-
firstDayOfWeek="2"
|
|
23
|
-
:is-required="true"
|
|
24
|
-
>
|
|
25
|
-
<template v-slot="{ inputValue, togglePopover }">
|
|
26
|
-
<div class="mt-1 flex items-center">
|
|
27
|
-
<button
|
|
28
|
-
type="button"
|
|
29
|
-
:class="[
|
|
30
|
-
disabled ? 'pointer-events-none border-gray-100' : 'border-gray-300',
|
|
31
|
-
'text-blue-600 focus:outline-none rounded-l-md border bg-white p-2 shadow-sm focus:text-white',
|
|
32
|
-
]"
|
|
33
|
-
@click="togglePopover()"
|
|
34
|
-
>
|
|
35
|
-
<c-icon
|
|
36
|
-
name="calendar-solid"
|
|
37
|
-
:class="[disabled ? 'text-gray-200' : 'text-gray-400', 'h-5 w-5 ']"
|
|
38
|
-
type="solid"
|
|
39
|
-
></c-icon>
|
|
40
|
-
</button>
|
|
41
|
-
<input
|
|
42
|
-
:value="inputValue"
|
|
43
|
-
:class="[
|
|
44
|
-
disabled
|
|
45
|
-
? 'pointer-events-none border-l-0 border-gray-100 text-gray-400'
|
|
46
|
-
: 'border-l-0 border-gray-300 text-gray-900',
|
|
47
|
-
'focus:outline-none focus:border-blue-500 w-full appearance-none rounded-r-md border bg-white p-2 text-sm shadow-sm',
|
|
48
|
-
]"
|
|
49
|
-
:readonly="disabled"
|
|
50
|
-
@click="togglePopover()"
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
</v-date-picker>
|
|
55
|
-
<!-- validation error message -->
|
|
56
|
-
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
57
|
-
{{ errorMessage }}
|
|
58
|
-
</p>
|
|
59
|
-
<p v-if="helpText && isValidate == true" class="mt-1 text-sm text-gray-500">
|
|
60
|
-
{{ helpText }}
|
|
61
|
-
</p>
|
|
62
|
-
</div>
|
|
63
|
-
</template>
|
|
64
|
-
<script>
|
|
65
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
66
|
-
// import Calendar from "v-calendar/lib/components/calendar.umd";
|
|
67
|
-
import VDatePicker from "v-calendar/lib/components/date-picker.umd";
|
|
68
|
-
export default {
|
|
69
|
-
name: "CDatepicker",
|
|
70
|
-
components: {
|
|
71
|
-
// Calendar,
|
|
72
|
-
VDatePicker,
|
|
73
|
-
CIcon,
|
|
74
|
-
},
|
|
75
|
-
props: {
|
|
76
|
-
classes: {
|
|
77
|
-
type: String,
|
|
78
|
-
},
|
|
79
|
-
isRequired: {
|
|
80
|
-
type: Boolean,
|
|
81
|
-
},
|
|
82
|
-
label: {
|
|
83
|
-
type: String,
|
|
84
|
-
},
|
|
85
|
-
helpText: {
|
|
86
|
-
type: String,
|
|
87
|
-
},
|
|
88
|
-
value: {
|
|
89
|
-
type: [String, Date, Array],
|
|
90
|
-
},
|
|
91
|
-
disabled: {
|
|
92
|
-
type: Boolean,
|
|
93
|
-
default: false,
|
|
94
|
-
},
|
|
95
|
-
minDate: {
|
|
96
|
-
type: [String, Date],
|
|
97
|
-
default: null,
|
|
98
|
-
},
|
|
99
|
-
isExpanded: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: false,
|
|
102
|
-
},
|
|
103
|
-
isValidate: {
|
|
104
|
-
type: Boolean,
|
|
105
|
-
default: true,
|
|
106
|
-
},
|
|
107
|
-
errorMessage: {
|
|
108
|
-
type: String,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
data() {
|
|
112
|
-
const masks = {
|
|
113
|
-
input: ["MMM DD, YYYY", "YYYY/MM/DD", "DD-MM-YYYY", "DD/MM/YYYY", "YYYY-MM-DD", "L"],
|
|
114
|
-
};
|
|
115
|
-
return {
|
|
116
|
-
masks,
|
|
117
|
-
attrs: [
|
|
118
|
-
{
|
|
119
|
-
highlight: {
|
|
120
|
-
color: "blue",
|
|
121
|
-
fillMode: "outline",
|
|
122
|
-
},
|
|
123
|
-
dates: new Date(),
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
};
|
|
127
|
-
},
|
|
128
|
-
methods: {
|
|
129
|
-
onDayClick(date) {
|
|
130
|
-
this.$emit("input", date);
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="flex items-center">
|
|
4
|
+
<div v-if="label">
|
|
5
|
+
<label class="block text-sm font-medium text-gray-900">
|
|
6
|
+
{{ label }}
|
|
7
|
+
</label>
|
|
8
|
+
</div>
|
|
9
|
+
<!-- asterisk sign to render if field is required -->
|
|
10
|
+
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
11
|
+
</div>
|
|
12
|
+
<v-date-picker
|
|
13
|
+
:class="{
|
|
14
|
+
'inline-block h-full': true,
|
|
15
|
+
'w-full': isExpanded,
|
|
16
|
+
}"
|
|
17
|
+
:masks="masks"
|
|
18
|
+
@input="onDayClick"
|
|
19
|
+
:value="value"
|
|
20
|
+
:min-date="minDate"
|
|
21
|
+
:attributes="attrs"
|
|
22
|
+
firstDayOfWeek="2"
|
|
23
|
+
:is-required="true"
|
|
24
|
+
>
|
|
25
|
+
<template v-slot="{ inputValue, togglePopover }">
|
|
26
|
+
<div class="mt-1 flex items-center">
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
:class="[
|
|
30
|
+
disabled ? 'pointer-events-none border-gray-100' : 'border-gray-300',
|
|
31
|
+
'text-blue-600 focus:outline-none rounded-l-md border bg-white p-2 shadow-sm focus:text-white',
|
|
32
|
+
]"
|
|
33
|
+
@click="togglePopover()"
|
|
34
|
+
>
|
|
35
|
+
<c-icon
|
|
36
|
+
name="calendar-solid"
|
|
37
|
+
:class="[disabled ? 'text-gray-200' : 'text-gray-400', 'h-5 w-5 ']"
|
|
38
|
+
type="solid"
|
|
39
|
+
></c-icon>
|
|
40
|
+
</button>
|
|
41
|
+
<input
|
|
42
|
+
:value="inputValue"
|
|
43
|
+
:class="[
|
|
44
|
+
disabled
|
|
45
|
+
? 'pointer-events-none border-l-0 border-gray-100 text-gray-400'
|
|
46
|
+
: 'border-l-0 border-gray-300 text-gray-900',
|
|
47
|
+
'focus:outline-none focus:border-blue-500 w-full appearance-none rounded-r-md border bg-white p-2 text-sm shadow-sm',
|
|
48
|
+
]"
|
|
49
|
+
:readonly="disabled"
|
|
50
|
+
@click="togglePopover()"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
</v-date-picker>
|
|
55
|
+
<!-- validation error message -->
|
|
56
|
+
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
57
|
+
{{ errorMessage }}
|
|
58
|
+
</p>
|
|
59
|
+
<p v-if="helpText && isValidate == true" class="mt-1 text-sm text-gray-500">
|
|
60
|
+
{{ helpText }}
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
<script>
|
|
65
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
66
|
+
// import Calendar from "v-calendar/lib/components/calendar.umd";
|
|
67
|
+
import VDatePicker from "v-calendar/lib/components/date-picker.umd";
|
|
68
|
+
export default {
|
|
69
|
+
name: "CDatepicker",
|
|
70
|
+
components: {
|
|
71
|
+
// Calendar,
|
|
72
|
+
VDatePicker,
|
|
73
|
+
CIcon,
|
|
74
|
+
},
|
|
75
|
+
props: {
|
|
76
|
+
classes: {
|
|
77
|
+
type: String,
|
|
78
|
+
},
|
|
79
|
+
isRequired: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
},
|
|
82
|
+
label: {
|
|
83
|
+
type: String,
|
|
84
|
+
},
|
|
85
|
+
helpText: {
|
|
86
|
+
type: String,
|
|
87
|
+
},
|
|
88
|
+
value: {
|
|
89
|
+
type: [String, Date, Array],
|
|
90
|
+
},
|
|
91
|
+
disabled: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
minDate: {
|
|
96
|
+
type: [String, Date],
|
|
97
|
+
default: null,
|
|
98
|
+
},
|
|
99
|
+
isExpanded: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
102
|
+
},
|
|
103
|
+
isValidate: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: true,
|
|
106
|
+
},
|
|
107
|
+
errorMessage: {
|
|
108
|
+
type: String,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
data() {
|
|
112
|
+
const masks = {
|
|
113
|
+
input: ["MMM DD, YYYY", "YYYY/MM/DD", "DD-MM-YYYY", "DD/MM/YYYY", "YYYY-MM-DD", "L"],
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
masks,
|
|
117
|
+
attrs: [
|
|
118
|
+
{
|
|
119
|
+
highlight: {
|
|
120
|
+
color: "blue",
|
|
121
|
+
fillMode: "outline",
|
|
122
|
+
},
|
|
123
|
+
dates: new Date(),
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
methods: {
|
|
129
|
+
onDayClick(date) {
|
|
130
|
+
this.$emit("input", date);
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
</script>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CDatepicker from './CDatepicker.vue'
|
|
2
|
-
|
|
1
|
+
import CDatepicker from './CDatepicker.vue'
|
|
2
|
+
|
|
3
3
|
export default CDatepicker
|
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="flex">
|
|
4
|
-
<button
|
|
5
|
-
type="button"
|
|
6
|
-
aria-haspopup="listbox"
|
|
7
|
-
aria-expanded="true"
|
|
8
|
-
aria-labelledby="listbox-label"
|
|
9
|
-
@click="toggleFirstDropdown = !toggleFirstDropdown"
|
|
10
|
-
@blur="close()"
|
|
11
|
-
class="relative inline-flex items-center pl-3 pr-10 py-2 text-left rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-900 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 shadow-sm disabled:opacity-50"
|
|
12
|
-
:disabled="isDisabled"
|
|
13
|
-
>
|
|
14
|
-
<span class="block truncate">
|
|
15
|
-
{{ firstDropdownSelectedValue ? firstDropdownSelectedValue : "Select a option" }}
|
|
16
|
-
</span>
|
|
17
|
-
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
|
|
18
|
-
<c-icon name="chevron-down" type="solid" class="h-5 w-5"></c-icon>
|
|
19
|
-
</span>
|
|
20
|
-
</button>
|
|
21
|
-
<button
|
|
22
|
-
type="button"
|
|
23
|
-
aria-haspopup="listbox"
|
|
24
|
-
aria-expanded="true"
|
|
25
|
-
aria-labelledby="listbox-label"
|
|
26
|
-
@click="toggleSecondDropdown = !toggleSecondDropdown"
|
|
27
|
-
@blur="close()"
|
|
28
|
-
class="relative items-center -ml-px pl-3 pr-10 py-2 text-left rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-900 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 shadow-sm disabled:opacity-50"
|
|
29
|
-
:disabled="isDisabled"
|
|
30
|
-
>
|
|
31
|
-
<span class="block truncate">
|
|
32
|
-
{{ secondDropdownSelectedValue ? secondDropdownSelectedValue : "Select a option" }}
|
|
33
|
-
</span>
|
|
34
|
-
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
|
|
35
|
-
<c-icon name="chevron-down" type="solid" class="h-5 w-5"></c-icon>
|
|
36
|
-
</span>
|
|
37
|
-
</button>
|
|
38
|
-
</div>
|
|
39
|
-
<transition
|
|
40
|
-
enter-active-class="transition ease-out duration-100"
|
|
41
|
-
enter-class="transform opacity-0 scale-95"
|
|
42
|
-
enter-to-class="transform opacity-100 scale-100"
|
|
43
|
-
leave-active-class="transition ease-in duration-75"
|
|
44
|
-
leave-class="transform opacity-100 scale-100"
|
|
45
|
-
leave-to-class="transform opacity-0 scale-95"
|
|
46
|
-
>
|
|
47
|
-
<div
|
|
48
|
-
v-if="toggleFirstDropdown && !isDisabled"
|
|
49
|
-
class="origin-top-right absolute mt-2 -mr-1 w-56 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5 z-10"
|
|
50
|
-
>
|
|
51
|
-
<ul
|
|
52
|
-
tabindex="-1"
|
|
53
|
-
role="listbox"
|
|
54
|
-
aria-labelledby="listbox-label"
|
|
55
|
-
class="max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
|
|
56
|
-
>
|
|
57
|
-
<li
|
|
58
|
-
v-for="item in firstDropdownOptions"
|
|
59
|
-
v-bind:key="item.items"
|
|
60
|
-
role="menuitem"
|
|
61
|
-
class="text-gray-900 select-none relative py-2 pl-3 pr-9 cursor-pointer"
|
|
62
|
-
@mousedown="handleFirstClick(item)"
|
|
63
|
-
>
|
|
64
|
-
<span class="font-normal block truncate list-options">
|
|
65
|
-
{{ item.text }}
|
|
66
|
-
</span>
|
|
67
|
-
</li>
|
|
68
|
-
</ul>
|
|
69
|
-
</div>
|
|
70
|
-
</transition>
|
|
71
|
-
<transition
|
|
72
|
-
enter-active-class="transition ease-out duration-100"
|
|
73
|
-
enter-class="transform opacity-0 scale-95"
|
|
74
|
-
enter-to-class="transform opacity-100 scale-100"
|
|
75
|
-
leave-active-class="transition ease-in duration-75"
|
|
76
|
-
leave-class="transform opacity-100 scale-100"
|
|
77
|
-
leave-to-class="transform opacity-0 scale-95"
|
|
78
|
-
>
|
|
79
|
-
<div
|
|
80
|
-
v-if="toggleSecondDropdown && !isDisabled"
|
|
81
|
-
class="origin-top-right absolute mt-2 -mr-1 w-56 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5 z-10"
|
|
82
|
-
>
|
|
83
|
-
<ul
|
|
84
|
-
tabindex="-1"
|
|
85
|
-
role="listbox"
|
|
86
|
-
aria-labelledby="listbox-label"
|
|
87
|
-
class="max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
|
|
88
|
-
>
|
|
89
|
-
<li
|
|
90
|
-
v-for="item in secondDropdownOptions"
|
|
91
|
-
v-bind:key="item.items"
|
|
92
|
-
role="menuitem"
|
|
93
|
-
class="text-gray-900 select-none relative py-2 pl-3 pr-9 cursor-pointer"
|
|
94
|
-
@mousedown="handleSecondClick(item)"
|
|
95
|
-
>
|
|
96
|
-
<span class="font-normal block truncate list-options">
|
|
97
|
-
{{ item.text }}
|
|
98
|
-
</span>
|
|
99
|
-
</li>
|
|
100
|
-
</ul>
|
|
101
|
-
</div>
|
|
102
|
-
</transition>
|
|
103
|
-
<!-- validation error message -->
|
|
104
|
-
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
105
|
-
{{ errorMessage }}
|
|
106
|
-
</p>
|
|
107
|
-
</div>
|
|
108
|
-
</template>
|
|
109
|
-
|
|
110
|
-
<script>
|
|
111
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
112
|
-
export default {
|
|
113
|
-
name: "CDualSelect",
|
|
114
|
-
components: { CIcon },
|
|
115
|
-
props: {
|
|
116
|
-
// validation is passed or not
|
|
117
|
-
isValidate: { type: Boolean },
|
|
118
|
-
// validation error message
|
|
119
|
-
errorMessage: {
|
|
120
|
-
type: String,
|
|
121
|
-
},
|
|
122
|
-
label: {
|
|
123
|
-
type: String,
|
|
124
|
-
required: true,
|
|
125
|
-
},
|
|
126
|
-
firstDropdownValue: {
|
|
127
|
-
type: String,
|
|
128
|
-
},
|
|
129
|
-
secondDropdownValue: {
|
|
130
|
-
type: String,
|
|
131
|
-
},
|
|
132
|
-
firstDropdownOptions: {
|
|
133
|
-
type: Array,
|
|
134
|
-
required: true,
|
|
135
|
-
},
|
|
136
|
-
secondDropdownOptions: {
|
|
137
|
-
type: Array,
|
|
138
|
-
},
|
|
139
|
-
onChangeFirstOptions: {
|
|
140
|
-
type: Function,
|
|
141
|
-
},
|
|
142
|
-
onChangeSecondOptions: {
|
|
143
|
-
type: Function,
|
|
144
|
-
},
|
|
145
|
-
isDisabled: {
|
|
146
|
-
type: Boolean,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
data() {
|
|
150
|
-
return {
|
|
151
|
-
toggleFirstDropdown: false,
|
|
152
|
-
toggleSecondDropdown: false,
|
|
153
|
-
firstDropdownSelectedValue: this.firstDropdownValue ? this.firstDropdownValue : "",
|
|
154
|
-
secondDropdownSelectedValue: this.secondDropdownValue ? this.secondDropdownValue : "",
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
|
-
methods: {
|
|
158
|
-
close() {
|
|
159
|
-
this.toggleFirstDropdown = false;
|
|
160
|
-
this.toggleSecondDropdown = false;
|
|
161
|
-
},
|
|
162
|
-
handleFirstClick(item) {
|
|
163
|
-
this.firstDropdownSelectedValue = item.text;
|
|
164
|
-
this.$emit("onChangeFirstOptions", item);
|
|
165
|
-
},
|
|
166
|
-
handleSecondClick(item) {
|
|
167
|
-
this.secondDropdownSelectedValue = item.text;
|
|
168
|
-
this.$emit("onChangeSecondOptions", item);
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
computed: {
|
|
172
|
-
classes() {
|
|
173
|
-
return {
|
|
174
|
-
"text-gray-700 border-gray-300 hover:bg-gray-50 focus:ring-indigo-600":
|
|
175
|
-
this.type == "secondary",
|
|
176
|
-
"text-white hover:bg-indigo-800 bg-indigo-700 focus:ring-indigo-600":
|
|
177
|
-
this.type == "primary",
|
|
178
|
-
"text-white hover:bg-red-800 bg-red-700 focus:ring-red-600": this.type == "danger",
|
|
179
|
-
"text-white hover:bg-green-800 bg-green-700 focus:ring-green-600": this.type == "success",
|
|
180
|
-
"cursor-default pointer-events-none": this.isLoading,
|
|
181
|
-
};
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
watch: {
|
|
185
|
-
firstDropdownValue() {
|
|
186
|
-
this.firstDropdownSelectedValue = this.firstDropdownValue;
|
|
187
|
-
this.secondDropdownSelectedValue = this.secondDropdownValue;
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
</script>
|
|
192
|
-
|
|
193
|
-
<style></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="flex">
|
|
4
|
+
<button
|
|
5
|
+
type="button"
|
|
6
|
+
aria-haspopup="listbox"
|
|
7
|
+
aria-expanded="true"
|
|
8
|
+
aria-labelledby="listbox-label"
|
|
9
|
+
@click="toggleFirstDropdown = !toggleFirstDropdown"
|
|
10
|
+
@blur="close()"
|
|
11
|
+
class="relative inline-flex items-center pl-3 pr-10 py-2 text-left rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-900 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 shadow-sm disabled:opacity-50"
|
|
12
|
+
:disabled="isDisabled"
|
|
13
|
+
>
|
|
14
|
+
<span class="block truncate">
|
|
15
|
+
{{ firstDropdownSelectedValue ? firstDropdownSelectedValue : "Select a option" }}
|
|
16
|
+
</span>
|
|
17
|
+
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
|
|
18
|
+
<c-icon name="chevron-down" type="solid" class="h-5 w-5"></c-icon>
|
|
19
|
+
</span>
|
|
20
|
+
</button>
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
aria-haspopup="listbox"
|
|
24
|
+
aria-expanded="true"
|
|
25
|
+
aria-labelledby="listbox-label"
|
|
26
|
+
@click="toggleSecondDropdown = !toggleSecondDropdown"
|
|
27
|
+
@blur="close()"
|
|
28
|
+
class="relative items-center -ml-px pl-3 pr-10 py-2 text-left rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-900 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 shadow-sm disabled:opacity-50"
|
|
29
|
+
:disabled="isDisabled"
|
|
30
|
+
>
|
|
31
|
+
<span class="block truncate">
|
|
32
|
+
{{ secondDropdownSelectedValue ? secondDropdownSelectedValue : "Select a option" }}
|
|
33
|
+
</span>
|
|
34
|
+
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
|
|
35
|
+
<c-icon name="chevron-down" type="solid" class="h-5 w-5"></c-icon>
|
|
36
|
+
</span>
|
|
37
|
+
</button>
|
|
38
|
+
</div>
|
|
39
|
+
<transition
|
|
40
|
+
enter-active-class="transition ease-out duration-100"
|
|
41
|
+
enter-class="transform opacity-0 scale-95"
|
|
42
|
+
enter-to-class="transform opacity-100 scale-100"
|
|
43
|
+
leave-active-class="transition ease-in duration-75"
|
|
44
|
+
leave-class="transform opacity-100 scale-100"
|
|
45
|
+
leave-to-class="transform opacity-0 scale-95"
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
v-if="toggleFirstDropdown && !isDisabled"
|
|
49
|
+
class="origin-top-right absolute mt-2 -mr-1 w-56 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5 z-10"
|
|
50
|
+
>
|
|
51
|
+
<ul
|
|
52
|
+
tabindex="-1"
|
|
53
|
+
role="listbox"
|
|
54
|
+
aria-labelledby="listbox-label"
|
|
55
|
+
class="max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
|
|
56
|
+
>
|
|
57
|
+
<li
|
|
58
|
+
v-for="item in firstDropdownOptions"
|
|
59
|
+
v-bind:key="item.items"
|
|
60
|
+
role="menuitem"
|
|
61
|
+
class="text-gray-900 select-none relative py-2 pl-3 pr-9 cursor-pointer"
|
|
62
|
+
@mousedown="handleFirstClick(item)"
|
|
63
|
+
>
|
|
64
|
+
<span class="font-normal block truncate list-options">
|
|
65
|
+
{{ item.text }}
|
|
66
|
+
</span>
|
|
67
|
+
</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
</transition>
|
|
71
|
+
<transition
|
|
72
|
+
enter-active-class="transition ease-out duration-100"
|
|
73
|
+
enter-class="transform opacity-0 scale-95"
|
|
74
|
+
enter-to-class="transform opacity-100 scale-100"
|
|
75
|
+
leave-active-class="transition ease-in duration-75"
|
|
76
|
+
leave-class="transform opacity-100 scale-100"
|
|
77
|
+
leave-to-class="transform opacity-0 scale-95"
|
|
78
|
+
>
|
|
79
|
+
<div
|
|
80
|
+
v-if="toggleSecondDropdown && !isDisabled"
|
|
81
|
+
class="origin-top-right absolute mt-2 -mr-1 w-56 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5 z-10"
|
|
82
|
+
>
|
|
83
|
+
<ul
|
|
84
|
+
tabindex="-1"
|
|
85
|
+
role="listbox"
|
|
86
|
+
aria-labelledby="listbox-label"
|
|
87
|
+
class="max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
|
|
88
|
+
>
|
|
89
|
+
<li
|
|
90
|
+
v-for="item in secondDropdownOptions"
|
|
91
|
+
v-bind:key="item.items"
|
|
92
|
+
role="menuitem"
|
|
93
|
+
class="text-gray-900 select-none relative py-2 pl-3 pr-9 cursor-pointer"
|
|
94
|
+
@mousedown="handleSecondClick(item)"
|
|
95
|
+
>
|
|
96
|
+
<span class="font-normal block truncate list-options">
|
|
97
|
+
{{ item.text }}
|
|
98
|
+
</span>
|
|
99
|
+
</li>
|
|
100
|
+
</ul>
|
|
101
|
+
</div>
|
|
102
|
+
</transition>
|
|
103
|
+
<!-- validation error message -->
|
|
104
|
+
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
105
|
+
{{ errorMessage }}
|
|
106
|
+
</p>
|
|
107
|
+
</div>
|
|
108
|
+
</template>
|
|
109
|
+
|
|
110
|
+
<script>
|
|
111
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
112
|
+
export default {
|
|
113
|
+
name: "CDualSelect",
|
|
114
|
+
components: { CIcon },
|
|
115
|
+
props: {
|
|
116
|
+
// validation is passed or not
|
|
117
|
+
isValidate: { type: Boolean },
|
|
118
|
+
// validation error message
|
|
119
|
+
errorMessage: {
|
|
120
|
+
type: String,
|
|
121
|
+
},
|
|
122
|
+
label: {
|
|
123
|
+
type: String,
|
|
124
|
+
required: true,
|
|
125
|
+
},
|
|
126
|
+
firstDropdownValue: {
|
|
127
|
+
type: String,
|
|
128
|
+
},
|
|
129
|
+
secondDropdownValue: {
|
|
130
|
+
type: String,
|
|
131
|
+
},
|
|
132
|
+
firstDropdownOptions: {
|
|
133
|
+
type: Array,
|
|
134
|
+
required: true,
|
|
135
|
+
},
|
|
136
|
+
secondDropdownOptions: {
|
|
137
|
+
type: Array,
|
|
138
|
+
},
|
|
139
|
+
onChangeFirstOptions: {
|
|
140
|
+
type: Function,
|
|
141
|
+
},
|
|
142
|
+
onChangeSecondOptions: {
|
|
143
|
+
type: Function,
|
|
144
|
+
},
|
|
145
|
+
isDisabled: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
data() {
|
|
150
|
+
return {
|
|
151
|
+
toggleFirstDropdown: false,
|
|
152
|
+
toggleSecondDropdown: false,
|
|
153
|
+
firstDropdownSelectedValue: this.firstDropdownValue ? this.firstDropdownValue : "",
|
|
154
|
+
secondDropdownSelectedValue: this.secondDropdownValue ? this.secondDropdownValue : "",
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
methods: {
|
|
158
|
+
close() {
|
|
159
|
+
this.toggleFirstDropdown = false;
|
|
160
|
+
this.toggleSecondDropdown = false;
|
|
161
|
+
},
|
|
162
|
+
handleFirstClick(item) {
|
|
163
|
+
this.firstDropdownSelectedValue = item.text;
|
|
164
|
+
this.$emit("onChangeFirstOptions", item);
|
|
165
|
+
},
|
|
166
|
+
handleSecondClick(item) {
|
|
167
|
+
this.secondDropdownSelectedValue = item.text;
|
|
168
|
+
this.$emit("onChangeSecondOptions", item);
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
computed: {
|
|
172
|
+
classes() {
|
|
173
|
+
return {
|
|
174
|
+
"text-gray-700 border-gray-300 hover:bg-gray-50 focus:ring-indigo-600":
|
|
175
|
+
this.type == "secondary",
|
|
176
|
+
"text-white hover:bg-indigo-800 bg-indigo-700 focus:ring-indigo-600":
|
|
177
|
+
this.type == "primary",
|
|
178
|
+
"text-white hover:bg-red-800 bg-red-700 focus:ring-red-600": this.type == "danger",
|
|
179
|
+
"text-white hover:bg-green-800 bg-green-700 focus:ring-green-600": this.type == "success",
|
|
180
|
+
"cursor-default pointer-events-none": this.isLoading,
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
watch: {
|
|
185
|
+
firstDropdownValue() {
|
|
186
|
+
this.firstDropdownSelectedValue = this.firstDropdownValue;
|
|
187
|
+
this.secondDropdownSelectedValue = this.secondDropdownValue;
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<style></style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CDualSelect from './CDualSelect.vue'
|
|
2
|
-
|
|
1
|
+
import CDualSelect from './CDualSelect.vue'
|
|
2
|
+
|
|
3
3
|
export default CDualSelect
|