classcard-ui 0.2.126 → 0.2.135
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 +18555 -568
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.css +1 -1
- package/dist/classcard-ui.umd.js +18555 -568
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +13 -5
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +13 -12
- package/src/components/CDualSelect/CDualSelect.vue +56 -27
- package/src/components/CFormSectionHeading/CFormSectionHeading.vue +19 -3
- package/src/components/CGroupedSelect/CGroupedSelect.vue +164 -0
- package/src/components/CGroupedSelect/index.js +3 -0
- package/src/components/CIconDropdown/CIconDropdown.vue +12 -13
- package/src/components/CMultiselect/CMultiselect.vue +38 -5
- package/src/components/CPhoneNumber/CPhoneNumber.vue +8 -2
- package/src/components/CSelect/CSelect.vue +4 -4
- package/src/components/index.js +1 -0
- package/src/icons.js +1 -1
- package/src/stories/CDualSelect.stories.js +5 -7
- package/src/stories/CGroupedSelect.stories.js +69 -0
- package/src/stories/CPhoneNumber.stories.js +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "classcard-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.135",
|
|
4
4
|
"main": "dist/classcard-ui.common.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -15,28 +15,29 @@
|
|
|
15
15
|
"src/*"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@shopify/draggable": "
|
|
18
|
+
"@shopify/draggable": "^1.0.0-beta.8",
|
|
19
19
|
"@tailwindcss/forms": "^0.2.1",
|
|
20
|
-
"core-js": "^3.
|
|
21
|
-
"dayjs": "^1.10.
|
|
20
|
+
"core-js": "^3.18.0",
|
|
21
|
+
"dayjs": "^1.10.7",
|
|
22
22
|
"gridjs-selection": "^3.4.0",
|
|
23
23
|
"gridjs-vue": "^3.4.0",
|
|
24
|
+
"lodash": "^4.17.21",
|
|
24
25
|
"vue": "^2.6.14",
|
|
25
26
|
"vue-good-table": "^2.21.8",
|
|
26
27
|
"vue-multiselect": "^2.1.6",
|
|
27
28
|
"vue-quill-editor": "^3.0.6",
|
|
28
|
-
"vue-select": "^3.
|
|
29
|
+
"vue-select": "^3.13.0",
|
|
29
30
|
"vue-table-draggable": "^1.0.1",
|
|
30
31
|
"vue-tailwind-picker": "^2.0.0",
|
|
31
32
|
"vue-tel-input": "^4.4.2"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@babel/core": "^7.
|
|
35
|
-
"@storybook/addon-actions": "^6.
|
|
36
|
-
"@storybook/addon-essentials": "^6.
|
|
37
|
-
"@storybook/addon-links": "^6.
|
|
38
|
-
"@storybook/vue": "^6.
|
|
39
|
-
"@tailwindcss/postcss7-compat": "^2.2.
|
|
35
|
+
"@babel/core": "^7.15.5",
|
|
36
|
+
"@storybook/addon-actions": "^6.3.8",
|
|
37
|
+
"@storybook/addon-essentials": "^6.3.8",
|
|
38
|
+
"@storybook/addon-links": "^6.3.8",
|
|
39
|
+
"@storybook/vue": "^6.3.8",
|
|
40
|
+
"@tailwindcss/postcss7-compat": "^2.2.14",
|
|
40
41
|
"@vue/cli-plugin-babel": "^4.5.13",
|
|
41
42
|
"@vue/cli-plugin-eslint": "^4.5.13",
|
|
42
43
|
"@vue/cli-service": "^4.5.13",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"eslint": "^6.7.2",
|
|
47
48
|
"eslint-plugin-vue": "^6.2.2",
|
|
48
49
|
"postcss": "^7.0.36",
|
|
49
|
-
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.
|
|
50
|
+
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.14",
|
|
50
51
|
"vue-template-compiler": "^2.6.14"
|
|
51
52
|
},
|
|
52
53
|
"eslintConfig": {
|
|
@@ -11,11 +11,9 @@
|
|
|
11
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"
|
|
12
12
|
>
|
|
13
13
|
<span class="block truncate">
|
|
14
|
-
Select a option
|
|
14
|
+
{{ firstDropdownSelectedValue ? firstDropdownSelectedValue : "Select a option" }}
|
|
15
15
|
</span>
|
|
16
|
-
<span
|
|
17
|
-
class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"
|
|
18
|
-
>
|
|
16
|
+
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
|
|
19
17
|
<c-icon name="chevron-down" type="solid" class="h-5 w-5"></c-icon>
|
|
20
18
|
</span>
|
|
21
19
|
</button>
|
|
@@ -29,11 +27,9 @@
|
|
|
29
27
|
class="relative block 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"
|
|
30
28
|
>
|
|
31
29
|
<span class="block truncate">
|
|
32
|
-
Select
|
|
30
|
+
{{ secondDropdownSelectedValue ? secondDropdownSelectedValue : "Select a option" }}
|
|
33
31
|
</span>
|
|
34
|
-
<span
|
|
35
|
-
class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"
|
|
36
|
-
>
|
|
32
|
+
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
|
|
37
33
|
<c-icon name="chevron-down" type="solid" class="h-5 w-5"></c-icon>
|
|
38
34
|
</span>
|
|
39
35
|
</button>
|
|
@@ -45,7 +41,7 @@
|
|
|
45
41
|
leave-active-class="transition ease-in duration-75"
|
|
46
42
|
leave-class="transform opacity-100 scale-100"
|
|
47
43
|
leave-to-class="transform opacity-0 scale-95"
|
|
48
|
-
|
|
44
|
+
>
|
|
49
45
|
<div
|
|
50
46
|
v-show="toggleFirstDropdown"
|
|
51
47
|
class="origin-top-right absolute mt-2 -mr-1 w-full rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5 z-10"
|
|
@@ -57,11 +53,11 @@
|
|
|
57
53
|
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"
|
|
58
54
|
>
|
|
59
55
|
<li
|
|
60
|
-
v-for="item in
|
|
56
|
+
v-for="item in firstDropdownOptions"
|
|
61
57
|
v-bind:key="item.items"
|
|
62
58
|
role="menuitem"
|
|
63
|
-
class="text-gray-900
|
|
64
|
-
@mousedown="
|
|
59
|
+
class="text-gray-900 select-none relative py-2 pl-3 pr-9 cursor-pointer"
|
|
60
|
+
@mousedown="handleFirstClick(item)"
|
|
65
61
|
>
|
|
66
62
|
<span class="font-normal block truncate list-options">
|
|
67
63
|
{{ item.text }}
|
|
@@ -77,7 +73,7 @@
|
|
|
77
73
|
leave-active-class="transition ease-in duration-75"
|
|
78
74
|
leave-class="transform opacity-100 scale-100"
|
|
79
75
|
leave-to-class="transform opacity-0 scale-95"
|
|
80
|
-
|
|
76
|
+
>
|
|
81
77
|
<div
|
|
82
78
|
v-show="toggleSecondDropdown"
|
|
83
79
|
class="origin-top-right absolute mt-2 -mr-1 w-full rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5 z-10"
|
|
@@ -89,10 +85,11 @@
|
|
|
89
85
|
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"
|
|
90
86
|
>
|
|
91
87
|
<li
|
|
92
|
-
v-for="item in
|
|
88
|
+
v-for="item in secondDropdownOptions"
|
|
93
89
|
v-bind:key="item.items"
|
|
94
90
|
role="menuitem"
|
|
95
|
-
class="text-gray-900
|
|
91
|
+
class="text-gray-900 select-none relative py-2 pl-3 pr-9 cursor-pointer"
|
|
92
|
+
@mousedown="handleSecondClick(item)"
|
|
96
93
|
>
|
|
97
94
|
<span class="font-normal block truncate list-options">
|
|
98
95
|
{{ item.text }}
|
|
@@ -101,6 +98,10 @@
|
|
|
101
98
|
</ul>
|
|
102
99
|
</div>
|
|
103
100
|
</transition>
|
|
101
|
+
<!-- validation error message -->
|
|
102
|
+
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
103
|
+
{{ errorMessage }}
|
|
104
|
+
</p>
|
|
104
105
|
</div>
|
|
105
106
|
</template>
|
|
106
107
|
|
|
@@ -110,23 +111,42 @@ export default {
|
|
|
110
111
|
name: "CDualSelect",
|
|
111
112
|
components: { CIcon },
|
|
112
113
|
props: {
|
|
114
|
+
// validation is passed or not
|
|
115
|
+
isValidate: { type: Boolean },
|
|
116
|
+
// validation error message
|
|
117
|
+
errorMessage: {
|
|
118
|
+
type: String,
|
|
119
|
+
},
|
|
113
120
|
label: {
|
|
114
121
|
type: String,
|
|
115
122
|
required: true,
|
|
116
123
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
firstDropdownValue: {
|
|
125
|
+
type: String,
|
|
126
|
+
},
|
|
127
|
+
secondDropdownValue: {
|
|
128
|
+
type: String,
|
|
129
|
+
},
|
|
130
|
+
firstDropdownOptions: {
|
|
122
131
|
type: Array,
|
|
123
132
|
required: true,
|
|
124
133
|
},
|
|
134
|
+
secondDropdownOptions: {
|
|
135
|
+
type: Array,
|
|
136
|
+
},
|
|
137
|
+
onChangeFirstOptions: {
|
|
138
|
+
type: Function,
|
|
139
|
+
},
|
|
140
|
+
onChangeSecondOptions: {
|
|
141
|
+
type: Function,
|
|
142
|
+
},
|
|
125
143
|
},
|
|
126
144
|
data() {
|
|
127
145
|
return {
|
|
128
146
|
toggleFirstDropdown: false,
|
|
129
147
|
toggleSecondDropdown: false,
|
|
148
|
+
firstDropdownSelectedValue: this.firstDropdownValue ? this.firstDropdownValue : "",
|
|
149
|
+
secondDropdownSelectedValue: this.secondDropdownValue ? this.secondDropdownValue : "",
|
|
130
150
|
};
|
|
131
151
|
},
|
|
132
152
|
methods: {
|
|
@@ -134,9 +154,14 @@ export default {
|
|
|
134
154
|
this.toggleFirstDropdown = false;
|
|
135
155
|
this.toggleSecondDropdown = false;
|
|
136
156
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
157
|
+
handleFirstClick(item) {
|
|
158
|
+
this.firstDropdownSelectedValue = item.text;
|
|
159
|
+
this.$emit("onChangeFirstOptions", item);
|
|
160
|
+
},
|
|
161
|
+
handleSecondClick(item) {
|
|
162
|
+
this.secondDropdownSelectedValue = item.text;
|
|
163
|
+
this.$emit("onChangeSecondOptions", item);
|
|
164
|
+
},
|
|
140
165
|
},
|
|
141
166
|
computed: {
|
|
142
167
|
classes() {
|
|
@@ -145,14 +170,18 @@ export default {
|
|
|
145
170
|
this.type == "secondary",
|
|
146
171
|
"text-white hover:bg-indigo-800 bg-indigo-700 focus:ring-indigo-600":
|
|
147
172
|
this.type == "primary",
|
|
148
|
-
"text-white hover:bg-red-800 bg-red-700 focus:ring-red-600":
|
|
149
|
-
|
|
150
|
-
"text-white hover:bg-green-800 bg-green-700 focus:ring-green-600":
|
|
151
|
-
this.type == "success",
|
|
173
|
+
"text-white hover:bg-red-800 bg-red-700 focus:ring-red-600": this.type == "danger",
|
|
174
|
+
"text-white hover:bg-green-800 bg-green-700 focus:ring-green-600": this.type == "success",
|
|
152
175
|
"cursor-default pointer-events-none": this.isLoading,
|
|
153
176
|
};
|
|
154
177
|
},
|
|
155
178
|
},
|
|
179
|
+
watch: {
|
|
180
|
+
firstDropdownValue() {
|
|
181
|
+
this.firstDropdownSelectedValue = this.firstDropdownValue;
|
|
182
|
+
this.secondDropdownSelectedValue = this.secondDropdownValue;
|
|
183
|
+
},
|
|
184
|
+
},
|
|
156
185
|
};
|
|
157
186
|
</script>
|
|
158
187
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div :class="classes" class="border-gray-200">
|
|
4
|
-
<div class="flex justify-between">
|
|
4
|
+
<div class="flex justify-between items-center">
|
|
5
5
|
<div>
|
|
6
6
|
<h3 class="text-base font-semibold text-gray-900">
|
|
7
7
|
{{ heading }}
|
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
{{ description }}
|
|
11
11
|
</p>
|
|
12
12
|
</div>
|
|
13
|
-
<c-button
|
|
14
|
-
|
|
13
|
+
<c-button
|
|
14
|
+
v-if="tabAction"
|
|
15
|
+
:type="tabAction.type"
|
|
16
|
+
:label="tabAction.label"
|
|
17
|
+
@action="emitTabAction"
|
|
18
|
+
></c-button>
|
|
19
|
+
<c-anchor-tag v-if="tabLink" :label="tabLink.label" :action="emitTabLink"></c-anchor-tag>
|
|
15
20
|
</div>
|
|
16
21
|
</div>
|
|
17
22
|
</div>
|
|
@@ -28,9 +33,20 @@ export default {
|
|
|
28
33
|
divider: { type: Boolean },
|
|
29
34
|
tabAction: { type: Object },
|
|
30
35
|
tabLink: { type: Object },
|
|
36
|
+
actionEvent: {
|
|
37
|
+
type: Function,
|
|
38
|
+
},
|
|
31
39
|
classes: {
|
|
32
40
|
type: String,
|
|
33
41
|
},
|
|
34
42
|
},
|
|
43
|
+
methods: {
|
|
44
|
+
emitTabAction() {
|
|
45
|
+
this.$emit("actionEvent");
|
|
46
|
+
},
|
|
47
|
+
emitTabLink() {
|
|
48
|
+
this.$emit("actionEvent");
|
|
49
|
+
},
|
|
50
|
+
},
|
|
35
51
|
};
|
|
36
52
|
</script>
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<label v-if="label" class="block text-sm font-medium text-gray-700">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</label>
|
|
6
|
+
<div class="mt-1 relative">
|
|
7
|
+
<div class="relative">
|
|
8
|
+
<input
|
|
9
|
+
type="text"
|
|
10
|
+
class="bg-white relative w-full border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
|
11
|
+
aria-haspopup="listbox"
|
|
12
|
+
aria-expanded="true"
|
|
13
|
+
aria-labelledby="listbox-label"
|
|
14
|
+
:value="inputValue"
|
|
15
|
+
@focus="showDropDown = true"
|
|
16
|
+
@blur="closeDropDown()"
|
|
17
|
+
/>
|
|
18
|
+
<span
|
|
19
|
+
class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"
|
|
20
|
+
>
|
|
21
|
+
<!-- Heroicon name: solid/selector -->
|
|
22
|
+
<svg
|
|
23
|
+
class="h-5 w-5 text-gray-400"
|
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
viewBox="0 0 20 20"
|
|
26
|
+
fill="currentColor"
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
>
|
|
29
|
+
<path
|
|
30
|
+
fill-rule="evenodd"
|
|
31
|
+
d="M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z"
|
|
32
|
+
clip-rule="evenodd"
|
|
33
|
+
/>
|
|
34
|
+
</svg>
|
|
35
|
+
</span>
|
|
36
|
+
</div>
|
|
37
|
+
<!--
|
|
38
|
+
Select popover, show/hide based on select state.
|
|
39
|
+
|
|
40
|
+
Entering: ""
|
|
41
|
+
From: ""
|
|
42
|
+
To: ""
|
|
43
|
+
Leaving: "transition ease-in duration-100"
|
|
44
|
+
From: "opacity-100"
|
|
45
|
+
To: "opacity-0"
|
|
46
|
+
-->
|
|
47
|
+
<ul
|
|
48
|
+
class="absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
|
|
49
|
+
tabindex="-1"
|
|
50
|
+
role="listbox"
|
|
51
|
+
aria-labelledby="listbox-label"
|
|
52
|
+
aria-activedescendant="listbox-option-3"
|
|
53
|
+
v-if="showDropDown"
|
|
54
|
+
>
|
|
55
|
+
<!--
|
|
56
|
+
Select option, manage highlight styles based on mouseenter/mouseleave and keyboard navigation.
|
|
57
|
+
|
|
58
|
+
Highlighted: "text-white bg-indigo-600", Not Highlighted: "text-gray-900"
|
|
59
|
+
-->
|
|
60
|
+
<span v-for="option in options" :key="option.id">
|
|
61
|
+
<li
|
|
62
|
+
class="text-gray-900 cursor-default select-none relative py-2 pl-3 pr-9"
|
|
63
|
+
role="option"
|
|
64
|
+
>
|
|
65
|
+
<span class="font-bold italic block truncate">
|
|
66
|
+
{{ option.label }}
|
|
67
|
+
</span>
|
|
68
|
+
</li>
|
|
69
|
+
<li
|
|
70
|
+
class="text-gray-900 cursor-default select-none relative py-2 pl-3 pr-9 group hover:text-white hover:bg-indigo-600"
|
|
71
|
+
v-for="subOption in option.options"
|
|
72
|
+
:key="subOption.id"
|
|
73
|
+
role="option"
|
|
74
|
+
@click="handleOptionClick(subOption)"
|
|
75
|
+
>
|
|
76
|
+
<!-- Selected: "font-semibold", Not Selected: "font-normal" -->
|
|
77
|
+
<span
|
|
78
|
+
:class="[
|
|
79
|
+
subOption.label === value.label
|
|
80
|
+
? 'font-semibold'
|
|
81
|
+
: 'font-normal',
|
|
82
|
+
' block truncate',
|
|
83
|
+
]"
|
|
84
|
+
>
|
|
85
|
+
{{ subOption.label }}
|
|
86
|
+
</span>
|
|
87
|
+
|
|
88
|
+
<!--
|
|
89
|
+
Checkmark, only display for selected option.
|
|
90
|
+
|
|
91
|
+
Highlighted: "text-white", Not Highlighted: "text-indigo-600"
|
|
92
|
+
-->
|
|
93
|
+
<span
|
|
94
|
+
class="text-indigo-600 absolute inset-y-0 right-0 flex items-center pr-4 group-hover:text-white"
|
|
95
|
+
v-if="subOption.label === value.label"
|
|
96
|
+
>
|
|
97
|
+
<!-- Heroicon name: solid/check -->
|
|
98
|
+
<svg
|
|
99
|
+
class="h-5 w-5"
|
|
100
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
101
|
+
viewBox="0 0 20 20"
|
|
102
|
+
fill="currentColor"
|
|
103
|
+
aria-hidden="true"
|
|
104
|
+
>
|
|
105
|
+
<path
|
|
106
|
+
fill-rule="evenodd"
|
|
107
|
+
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
|
108
|
+
clip-rule="evenodd"
|
|
109
|
+
/>
|
|
110
|
+
</svg>
|
|
111
|
+
</span>
|
|
112
|
+
</li>
|
|
113
|
+
</span>
|
|
114
|
+
|
|
115
|
+
<!-- More items... -->
|
|
116
|
+
</ul>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<script>
|
|
122
|
+
import { debounce } from "lodash";
|
|
123
|
+
|
|
124
|
+
export default {
|
|
125
|
+
name: "CGroupedSelect",
|
|
126
|
+
props: {
|
|
127
|
+
label: String,
|
|
128
|
+
options: Object,
|
|
129
|
+
value: Object,
|
|
130
|
+
},
|
|
131
|
+
data() {
|
|
132
|
+
return {
|
|
133
|
+
showDropDown: false,
|
|
134
|
+
inputValue: "",
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
onInput(e) {
|
|
139
|
+
this.inputValue = e.target.value;
|
|
140
|
+
debounce(function () {
|
|
141
|
+
this.$emit("search", e.target.value);
|
|
142
|
+
}, 500);
|
|
143
|
+
},
|
|
144
|
+
handleOptionClick(option) {
|
|
145
|
+
this.$emit("input", option);
|
|
146
|
+
this.inputValue = option.label;
|
|
147
|
+
},
|
|
148
|
+
closeDropDown() {
|
|
149
|
+
this.inputValue = this.value.label;
|
|
150
|
+
this.showDropDown = false;
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
watch: {
|
|
154
|
+
value(newValue) {
|
|
155
|
+
this.inputValue = newValue.label;
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
mounted() {
|
|
159
|
+
this.inputValue = this.value.label;
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<style></style>
|
|
@@ -7,21 +7,17 @@
|
|
|
7
7
|
type="white"
|
|
8
8
|
@click="toggleDropdown = !toggleDropdown"
|
|
9
9
|
@blur="close()"
|
|
10
|
-
class="inline-flex justify-center w-full rounded-full
|
|
10
|
+
class="inline-flex justify-center w-full rounded-full border-none p-2 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-600"
|
|
11
11
|
aria-haspopup="true"
|
|
12
12
|
aria-expanded="true"
|
|
13
13
|
>
|
|
14
|
-
<c-icon
|
|
15
|
-
:name="icon.name"
|
|
16
|
-
:type="icon.type"
|
|
17
|
-
:class="icon.class"
|
|
18
|
-
></c-icon>
|
|
14
|
+
<c-icon :name="icon.name" :type="icon.type" :class="icon.class"></c-icon>
|
|
19
15
|
</button>
|
|
20
16
|
</div>
|
|
21
17
|
<div
|
|
22
18
|
v-show="toggleDropdown"
|
|
23
19
|
:class="classes"
|
|
24
|
-
class="origin-top-right z-10 absolute mt-2 -mr-1
|
|
20
|
+
class="origin-top-right z-10 absolute mt-2 -mr-1 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5"
|
|
25
21
|
>
|
|
26
22
|
<div
|
|
27
23
|
class="py-2 w-max"
|
|
@@ -32,8 +28,8 @@
|
|
|
32
28
|
<a
|
|
33
29
|
v-for="item in items"
|
|
34
30
|
v-bind:key="item.text"
|
|
35
|
-
@mousedown="
|
|
36
|
-
class="flex
|
|
31
|
+
@mousedown="dropdownAction(item)"
|
|
32
|
+
class="flex px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 cursor-pointer"
|
|
37
33
|
role="menuitem"
|
|
38
34
|
>
|
|
39
35
|
{{ item.text }}
|
|
@@ -55,11 +51,14 @@ export default {
|
|
|
55
51
|
required: true,
|
|
56
52
|
},
|
|
57
53
|
icon: {
|
|
58
|
-
type: Object
|
|
54
|
+
type: Object,
|
|
59
55
|
},
|
|
60
56
|
classes: {
|
|
61
57
|
type: String,
|
|
62
58
|
},
|
|
59
|
+
action: {
|
|
60
|
+
type: Function,
|
|
61
|
+
},
|
|
63
62
|
},
|
|
64
63
|
data() {
|
|
65
64
|
return {
|
|
@@ -67,12 +66,12 @@ export default {
|
|
|
67
66
|
};
|
|
68
67
|
},
|
|
69
68
|
methods: {
|
|
70
|
-
|
|
71
|
-
this.$emit(item
|
|
69
|
+
dropdownAction(item) {
|
|
70
|
+
this.$emit("action", item);
|
|
72
71
|
},
|
|
73
72
|
close() {
|
|
74
73
|
this.toggleDropdown = false;
|
|
75
|
-
}
|
|
74
|
+
},
|
|
76
75
|
},
|
|
77
76
|
};
|
|
78
77
|
</script>
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
<v-select
|
|
5
5
|
class="text-sm mt-1"
|
|
6
6
|
:placeholder="placeholder"
|
|
7
|
-
multiple
|
|
8
|
-
taggable
|
|
7
|
+
:multiple="isMultiple"
|
|
8
|
+
:taggable="isTaggable"
|
|
9
|
+
:push-tags="pushTags"
|
|
9
10
|
:selectable="() => (limitSelection == true ? value.length < 1 : value)"
|
|
10
11
|
:filterable="false"
|
|
11
12
|
v-model="value"
|
|
12
13
|
:options="options"
|
|
14
|
+
@input="setSelectedOptions"
|
|
13
15
|
@search="fetchOptions"
|
|
14
16
|
:label="optionLabel"
|
|
15
17
|
>
|
|
@@ -49,28 +51,59 @@ export default {
|
|
|
49
51
|
},
|
|
50
52
|
label: String,
|
|
51
53
|
placeholder: String,
|
|
54
|
+
// whether multiple fields are allowed or not
|
|
55
|
+
isMultiple: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
},
|
|
58
|
+
// append newly created tags in options
|
|
59
|
+
pushTags: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
},
|
|
62
|
+
// whether to allow user to create new options
|
|
63
|
+
isTaggable: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
},
|
|
52
66
|
limitSelection: {
|
|
53
67
|
type: Boolean,
|
|
54
68
|
},
|
|
55
69
|
getOptions: {
|
|
70
|
+
// function to emit on search{
|
|
56
71
|
type: Function,
|
|
57
72
|
},
|
|
58
73
|
customiseOption: {
|
|
59
74
|
type: Boolean,
|
|
60
75
|
},
|
|
76
|
+
// the name of the option to render in the selectpicker
|
|
61
77
|
optionLabel: {
|
|
62
78
|
type: String,
|
|
63
79
|
},
|
|
80
|
+
// action to trigger after selecting option from dropdown
|
|
81
|
+
onSelectOptions: {
|
|
82
|
+
type: Function,
|
|
83
|
+
},
|
|
84
|
+
optionsSelected: {
|
|
85
|
+
type: Array,
|
|
86
|
+
},
|
|
64
87
|
},
|
|
65
88
|
computed: {},
|
|
66
89
|
data() {
|
|
67
90
|
return {
|
|
68
|
-
|
|
91
|
+
loaderSearching: true,
|
|
92
|
+
value: this.optionsSelected && this.optionsSelected.length ? this.optionsSelected : [],
|
|
69
93
|
};
|
|
70
94
|
},
|
|
71
95
|
methods: {
|
|
72
|
-
fetchOptions(search,
|
|
73
|
-
this.$emit("getOptions", search,
|
|
96
|
+
fetchOptions(search, loaderSearching) {
|
|
97
|
+
this.$emit("getOptions", search, loaderSearching);
|
|
98
|
+
},
|
|
99
|
+
setSelectedOptions(params) {
|
|
100
|
+
this.value = params;
|
|
101
|
+
this.$emit("onSelectOptions", params);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
watch: {
|
|
105
|
+
optionsSelected() {
|
|
106
|
+
this.value = this.optionsSelected;
|
|
74
107
|
},
|
|
75
108
|
},
|
|
76
109
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<label class="text-sm text-gray-900">{{ label }}</label>
|
|
4
4
|
<div class="w-full mt-1">
|
|
5
|
-
<vue-tel-input v-bind="bindProps"></vue-tel-input>
|
|
5
|
+
<vue-tel-input v-bind="bindProps" :autoFormat="false" v-model="value"></vue-tel-input>
|
|
6
6
|
</div>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
@@ -15,16 +15,22 @@ export default {
|
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
17
17
|
// eslint-disable-next-line vue/require-prop-type-constructor
|
|
18
|
-
phone:
|
|
18
|
+
phone: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
19
21
|
label: String,
|
|
20
22
|
},
|
|
21
23
|
data() {
|
|
22
24
|
return {
|
|
25
|
+
value: this.phone,
|
|
23
26
|
bindProps: {
|
|
24
27
|
placeholder: "Enter phone number",
|
|
25
28
|
inputClasses: ["px-3", "py-2", "text-sm"],
|
|
26
29
|
inputId: "c-phone",
|
|
27
30
|
wrapperClasses: "c-phone-wrapper",
|
|
31
|
+
showDialCode: false,
|
|
32
|
+
enabledCountryCode: false,
|
|
33
|
+
mode: "auto",
|
|
28
34
|
},
|
|
29
35
|
};
|
|
30
36
|
},
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</div>
|
|
12
12
|
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
13
13
|
</div>
|
|
14
|
-
<div class="mt-1
|
|
14
|
+
<div class="relative" :class="label ? 'mt-1' : ''">
|
|
15
15
|
<button
|
|
16
16
|
type="button"
|
|
17
17
|
@click="toggleDropdown = !toggleDropdown"
|
|
@@ -162,7 +162,7 @@ export default {
|
|
|
162
162
|
// icons in dropdown list
|
|
163
163
|
icon: { type: Object },
|
|
164
164
|
// value to set as default option in dropdown
|
|
165
|
-
value: { type: Object },
|
|
165
|
+
value: { type: [Object, String] },
|
|
166
166
|
// type of dropdown - gray,tertiary or default
|
|
167
167
|
type: {
|
|
168
168
|
type: String,
|
|
@@ -180,7 +180,7 @@ export default {
|
|
|
180
180
|
data() {
|
|
181
181
|
return {
|
|
182
182
|
toggleDropdown: false,
|
|
183
|
-
selectedValue: this.value ? this.value
|
|
183
|
+
selectedValue: this.value ? this.value || this.value.option : "",
|
|
184
184
|
showSelectedValue: false,
|
|
185
185
|
showFocus: false,
|
|
186
186
|
};
|
|
@@ -213,7 +213,7 @@ export default {
|
|
|
213
213
|
},
|
|
214
214
|
watch: {
|
|
215
215
|
value() {
|
|
216
|
-
this.selectedValue = this.value.option
|
|
216
|
+
this.selectedValue = this.value.option ? this.value.option : this.value;
|
|
217
217
|
},
|
|
218
218
|
},
|
|
219
219
|
};
|
package/src/components/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export { default as CDualSelect } from "./CEditor";
|
|
|
20
20
|
export { default as CEditor } from "./CDualSelect";
|
|
21
21
|
export { default as CFormSectionHeading } from "./CFormSectionHeading";
|
|
22
22
|
export { default as CIcon } from "./CIcon";
|
|
23
|
+
export { default as CGroupedSelect } from "./CGroupedSelect";
|
|
23
24
|
export { default as CIconDropdown } from "./CIconDropdown";
|
|
24
25
|
export { default as CInput } from "./CInput";
|
|
25
26
|
export { default as CInputAddon } from "./CInputAddon";
|
package/src/icons.js
CHANGED
|
@@ -27,7 +27,7 @@ export default {
|
|
|
27
27
|
'product': 'M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4',
|
|
28
28
|
'coupon': 'M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z',
|
|
29
29
|
'taxes': 'M3 6l3 1m0 0l-3 9a5.002 5.002 0 006.001 0M6 7l3 9M6 7l6-2m6 2l3-1m-3 1l-3 9a5.002 5.002 0 006.001 0M18 7l3 9m-3-9l-6-2m0-2v2m0 16V5m0 16H9m3 0h3',
|
|
30
|
-
'clipboard-check': 'M9
|
|
30
|
+
'clipboard-check': 'M9 2a1 1 0 000 2h2a1 1 0 100-2H9z M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z',
|
|
31
31
|
'cloud':'M3 15a4 4 0 004 4h9a5 5 0 10-.1-9.999 5.002 5.002 0 10-9.78 2.096A4.001 4.001 0 003 15z',
|
|
32
32
|
'search':'M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z',
|
|
33
33
|
'menu-alt-2': 'M4 6h16M4 12h16M4 18h7',
|