vue3-extended-multiselect 1.4.1 → 1.4.2

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.
Files changed (45) hide show
  1. package/.browserslistrc +3 -3
  2. package/.eslintrc.js +34 -34
  3. package/.github/workflows/publish.yml +41 -41
  4. package/.nvmrc +0 -0
  5. package/CHANGELOG.md +185 -181
  6. package/LICENSE +21 -21
  7. package/README.md +266 -266
  8. package/babel.config.js +5 -5
  9. package/index.js +2 -2
  10. package/jest.config.js +61 -61
  11. package/package.json +47 -47
  12. package/src/assets/base-arrow.svg +70 -70
  13. package/src/assets/cancel.svg +34 -34
  14. package/src/assets/circle-arrow.svg +7 -7
  15. package/src/assets/double-arrow.svg +39 -39
  16. package/src/assets/inner-arrow.svg +8 -8
  17. package/src/assets/loader.svg +5 -5
  18. package/src/assets/triangle-arrow.svg +72 -72
  19. package/src/assets/triangle-circle-arrow.svg +38 -38
  20. package/src/assets/wide-arrow.svg +72 -72
  21. package/src/components/ExtendedMultiselectCancel.vue +166 -166
  22. package/src/components/ExtendedMultiselectInput.vue +687 -687
  23. package/src/components/ExtendedMultiselectLoader.vue +182 -182
  24. package/src/components/ExtendedMultiselectMultiple.vue +320 -320
  25. package/src/components/ExtendedMultiselectOptions.vue +1144 -1144
  26. package/src/components/ExtendedMultiselectToggle.vue +273 -273
  27. package/src/components/Vue3ExtendedMultiselect.vue +1752 -1752
  28. package/src/composition/cancel.js +38 -38
  29. package/src/composition/image-path.js +16 -16
  30. package/src/composition/labels.js +41 -41
  31. package/src/composition/preselected-options.js +67 -67
  32. package/src/composition/search-value.js +33 -33
  33. package/src/composition/sizes.js +42 -42
  34. package/src/composition/toggle.js +33 -33
  35. package/src/events/LocalEmitter.js +31 -31
  36. package/src/events/emitter.js +2 -2
  37. package/src/sets/sets.js +99 -99
  38. package/src/styles/animations.css +18 -18
  39. package/src/styles/main.css +441 -441
  40. package/src/styles/variables.css +49 -49
  41. package/tests/unit/events.spec.js +138 -138
  42. package/tests/unit/props.spec.js +1099 -1099
  43. package/tests/utils/mount.js +37 -37
  44. package/tests/utils/utils.js +20 -20
  45. package/typings/vue3-extended-multiselect.d.ts +43 -43
@@ -1,274 +1,274 @@
1
- <template>
2
- <div
3
- aria-label="Toggle options list"
4
- id="extended__multiselect-toggle"
5
- role="switch"
6
- :aria-checked="dropdownActive"
7
- :class="toggleSlotClass"
8
- :tabindex="increasedTabindex"
9
- @click.stop.left="toggleOptionsList"
10
- @click.stop.middle="toggleOptionsList"
11
- @keypress.stop="toggleOptionsList($event)"
12
- >
13
- <img
14
- alt=""
15
- v-if="!loading"
16
- :class="classesSummary"
17
- :src="icon"
18
- />
19
- <extended-multiselect-loader
20
- v-else
21
- :icon-filter="iconFilter"
22
- :icon-size="iconSize"
23
- />
24
- <svg
25
- version="1.1"
26
- xmlns="http://www.w3.org/2000/svg"
27
- xmlns:xlink="http://www.w3.org/1999/xlink"
28
- width="0"
29
- height="0"
30
- >
31
- <defs>
32
- <filter
33
- x="0"
34
- y="0"
35
- width="1"
36
- height="1"
37
- id="basicFilter"
38
- >
39
- <feFlood flood-color="#BDBDBD"/>
40
- <feComposite
41
- out="SourceGraphic"
42
- in2="SourceGraphic"
43
- operator="in"
44
- />
45
- </filter>
46
- <filter
47
- x="0"
48
- y="0"
49
- width="1"
50
- height="1"
51
- id="blackFilter"
52
- >
53
- <feFlood flood-color="#000000"/>
54
- <feComposite
55
- out="SourceGraphic"
56
- in2="SourceGraphic"
57
- operator="in"
58
- />
59
- </filter>
60
- <filter
61
- x="0"
62
- y="0"
63
- width="1"
64
- height="1"
65
- id="greenFilter"
66
- >
67
- <feFlood flood-color="#068504"/>
68
- <feComposite
69
- out="SourceGraphic"
70
- in2="SourceGraphic"
71
- operator="in"
72
- />
73
- </filter>
74
- </defs>
75
- </svg>
76
- </div>
77
- </template>
78
-
79
- <script setup>
80
- import {
81
- computed,
82
- defineProps,
83
- toRefs,
84
- } from "vue";
85
-
86
- import useImagePath from "../composition/image-path";
87
- import useToggle from "../composition/toggle";
88
- import useSizes from "../composition/sizes";
89
-
90
- import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
91
-
92
- const props = defineProps({
93
- /**
94
- * Determines what class to use on toggle slot
95
- * @default false
96
- * @property {boolean} disabled
97
- */
98
- disabled: {
99
- type: Boolean,
100
- default: false,
101
- },
102
-
103
- /**
104
- * Determines whether option list expanded or not
105
- * @property {boolean} dropdownActive
106
- */
107
- dropdownActive: {
108
- type: Boolean,
109
- required: true,
110
- },
111
-
112
- /**
113
- * Defines a svg-filter for icons
114
- * @property {string} iconFilter
115
- */
116
- iconFilter: {
117
- type: String,
118
- required: true,
119
- },
120
-
121
- /**
122
- * Provides size to create special size-class
123
- * for each kind of icon
124
- * @property {string} iconSize
125
- */
126
- iconSize: {
127
- type: String,
128
- required: true,
129
- },
130
-
131
- /**
132
- * Replaces toggle button with loader
133
- * @property {boolean} loading
134
- */
135
- loading: {
136
- type: Boolean,
137
- required: true,
138
- },
139
-
140
- /**
141
- * Assigns unique identifier of extended multiselect
142
- * for each event
143
- * @property {string} emitterUniqueId
144
- */
145
- emitterUniqueId: {
146
- type: String,
147
- required: true,
148
- },
149
-
150
- /**
151
- * Determines toggle icon to be used in default toggle slot
152
- * @property {string} toggleIcon
153
- */
154
- toggleIcon: {
155
- type: String,
156
- required: true,
157
- },
158
-
159
- /**
160
- * Defines "tabindex" attribute of toggle button
161
- * @default null
162
- * @property {number|null} tabindex
163
- */
164
- tabindex: {
165
- type: Number,
166
- default: null,
167
- },
168
- });
169
-
170
- const {
171
- disabled,
172
- dropdownActive,
173
- emitterUniqueId,
174
- iconFilter,
175
- iconSize,
176
- loading,
177
- tabindex,
178
- toggleIcon,
179
- } = toRefs(props);
180
-
181
- const { createImagePath } = useImagePath();
182
-
183
- const { toggleSlotClass, toggleOptionsList } = useToggle(
184
- loading,
185
- disabled,
186
- null,
187
- emitterUniqueId,
188
- );
189
- const { iconSizeClass } = useSizes(iconSize);
190
-
191
- /**
192
- * Defines a list of toggle button classes
193
- * @function
194
- * @returns {Array} classes
195
- */
196
- const classesSummary = computed(() => {
197
- return [
198
- iconFilterClass.value,
199
- iconSizeClass.value,
200
- iconFilterRotationClass.value
201
- ];
202
- });
203
-
204
- /**
205
- * Determines kind of toggle icon based on
206
- * "toggleIcon" prop
207
- * @function
208
- * @returns {string} icon
209
- */
210
- const icon = computed(() => {
211
- const baseArrow = createImagePath("base-arrow.svg");
212
-
213
- switch(toggleIcon.value) {
214
- case "base-arrow":
215
- return baseArrow;
216
- case "double-arrow":
217
- return createImagePath("double-arrow.svg");
218
- case "wide-arrow":
219
- return createImagePath("wide-arrow.svg");
220
- case "circle-arrow":
221
- return createImagePath("circle-arrow.svg");
222
- case "inner-arrow":
223
- return createImagePath("inner-arrow.svg");
224
- case "triangle-arrow":
225
- return createImagePath("triangle-arrow.svg");
226
- case "triangle-circle-arrow":
227
- return createImagePath("triangle-circle-arrow.svg");
228
- default:
229
- return baseArrow;
230
- }
231
- });
232
-
233
- /**
234
- * Defines svg-filter for toggle icon
235
- * @function
236
- * @returns {string} svg-filter
237
- */
238
- const iconFilterClass = computed(() => {
239
- const basicFilter = "extended__multiselect-filter";
240
-
241
- switch(iconFilter) {
242
- case "basic":
243
- return `${basicFilter}_basic`;
244
- case "black":
245
- return `${basicFilter}_black`;
246
- case "green":
247
- return `${basicFilter}_green`;
248
- default:
249
- return `${basicFilter}_basic`;
250
- }
251
- });
252
-
253
- /**
254
- * Defines rotation class of toggle icon based on
255
- * "dropdownActive" prop
256
- * @function
257
- * @returns {string} class
258
- */
259
- const iconFilterRotationClass = computed(() => {
260
- return dropdownActive.value
261
- ? "extended__multiselect-toggle--active"
262
- : "extended__multiselect-toggle--locked";
263
- });
264
-
265
- /**
266
- * Sets "tabindex" attibute of toggle button based on
267
- * given tabindex
268
- * @function
269
- * @returns {number} tabindex
270
- */
271
- const increasedTabindex = computed(() => {
272
- return tabindex.value ? tabindex.value + 1 : 0;
273
- });
1
+ <template>
2
+ <div
3
+ aria-label="Toggle options list"
4
+ id="extended__multiselect-toggle"
5
+ role="switch"
6
+ :aria-checked="dropdownActive"
7
+ :class="toggleSlotClass"
8
+ :tabindex="increasedTabindex"
9
+ @click.stop.left="toggleOptionsList"
10
+ @click.stop.middle="toggleOptionsList"
11
+ @keypress.stop="toggleOptionsList($event)"
12
+ >
13
+ <img
14
+ alt=""
15
+ v-if="!loading"
16
+ :class="classesSummary"
17
+ :src="icon"
18
+ />
19
+ <extended-multiselect-loader
20
+ v-else
21
+ :icon-filter="iconFilter"
22
+ :icon-size="iconSize"
23
+ />
24
+ <svg
25
+ version="1.1"
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ xmlns:xlink="http://www.w3.org/1999/xlink"
28
+ width="0"
29
+ height="0"
30
+ >
31
+ <defs>
32
+ <filter
33
+ x="0"
34
+ y="0"
35
+ width="1"
36
+ height="1"
37
+ id="basicFilter"
38
+ >
39
+ <feFlood flood-color="#BDBDBD"/>
40
+ <feComposite
41
+ out="SourceGraphic"
42
+ in2="SourceGraphic"
43
+ operator="in"
44
+ />
45
+ </filter>
46
+ <filter
47
+ x="0"
48
+ y="0"
49
+ width="1"
50
+ height="1"
51
+ id="blackFilter"
52
+ >
53
+ <feFlood flood-color="#000000"/>
54
+ <feComposite
55
+ out="SourceGraphic"
56
+ in2="SourceGraphic"
57
+ operator="in"
58
+ />
59
+ </filter>
60
+ <filter
61
+ x="0"
62
+ y="0"
63
+ width="1"
64
+ height="1"
65
+ id="greenFilter"
66
+ >
67
+ <feFlood flood-color="#068504"/>
68
+ <feComposite
69
+ out="SourceGraphic"
70
+ in2="SourceGraphic"
71
+ operator="in"
72
+ />
73
+ </filter>
74
+ </defs>
75
+ </svg>
76
+ </div>
77
+ </template>
78
+
79
+ <script setup>
80
+ import {
81
+ computed,
82
+ defineProps,
83
+ toRefs,
84
+ } from "vue";
85
+
86
+ import useImagePath from "../composition/image-path";
87
+ import useToggle from "../composition/toggle";
88
+ import useSizes from "../composition/sizes";
89
+
90
+ import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
91
+
92
+ const props = defineProps({
93
+ /**
94
+ * Determines what class to use on toggle slot
95
+ * @default false
96
+ * @property {boolean} disabled
97
+ */
98
+ disabled: {
99
+ type: Boolean,
100
+ default: false,
101
+ },
102
+
103
+ /**
104
+ * Determines whether option list expanded or not
105
+ * @property {boolean} dropdownActive
106
+ */
107
+ dropdownActive: {
108
+ type: Boolean,
109
+ required: true,
110
+ },
111
+
112
+ /**
113
+ * Defines a svg-filter for icons
114
+ * @property {string} iconFilter
115
+ */
116
+ iconFilter: {
117
+ type: String,
118
+ required: true,
119
+ },
120
+
121
+ /**
122
+ * Provides size to create special size-class
123
+ * for each kind of icon
124
+ * @property {string} iconSize
125
+ */
126
+ iconSize: {
127
+ type: String,
128
+ required: true,
129
+ },
130
+
131
+ /**
132
+ * Replaces toggle button with loader
133
+ * @property {boolean} loading
134
+ */
135
+ loading: {
136
+ type: Boolean,
137
+ required: true,
138
+ },
139
+
140
+ /**
141
+ * Assigns unique identifier of extended multiselect
142
+ * for each event
143
+ * @property {string} emitterUniqueId
144
+ */
145
+ emitterUniqueId: {
146
+ type: String,
147
+ required: true,
148
+ },
149
+
150
+ /**
151
+ * Determines toggle icon to be used in default toggle slot
152
+ * @property {string} toggleIcon
153
+ */
154
+ toggleIcon: {
155
+ type: String,
156
+ required: true,
157
+ },
158
+
159
+ /**
160
+ * Defines "tabindex" attribute of toggle button
161
+ * @default null
162
+ * @property {number|null} tabindex
163
+ */
164
+ tabindex: {
165
+ type: Number,
166
+ default: null,
167
+ },
168
+ });
169
+
170
+ const {
171
+ disabled,
172
+ dropdownActive,
173
+ emitterUniqueId,
174
+ iconFilter,
175
+ iconSize,
176
+ loading,
177
+ tabindex,
178
+ toggleIcon,
179
+ } = toRefs(props);
180
+
181
+ const { createImagePath } = useImagePath();
182
+
183
+ const { toggleSlotClass, toggleOptionsList } = useToggle(
184
+ loading,
185
+ disabled,
186
+ null,
187
+ emitterUniqueId,
188
+ );
189
+ const { iconSizeClass } = useSizes(iconSize);
190
+
191
+ /**
192
+ * Defines a list of toggle button classes
193
+ * @function
194
+ * @returns {Array} classes
195
+ */
196
+ const classesSummary = computed(() => {
197
+ return [
198
+ iconFilterClass.value,
199
+ iconSizeClass.value,
200
+ iconFilterRotationClass.value
201
+ ];
202
+ });
203
+
204
+ /**
205
+ * Determines kind of toggle icon based on
206
+ * "toggleIcon" prop
207
+ * @function
208
+ * @returns {string} icon
209
+ */
210
+ const icon = computed(() => {
211
+ const baseArrow = createImagePath("base-arrow.svg");
212
+
213
+ switch(toggleIcon.value) {
214
+ case "base-arrow":
215
+ return baseArrow;
216
+ case "double-arrow":
217
+ return createImagePath("double-arrow.svg");
218
+ case "wide-arrow":
219
+ return createImagePath("wide-arrow.svg");
220
+ case "circle-arrow":
221
+ return createImagePath("circle-arrow.svg");
222
+ case "inner-arrow":
223
+ return createImagePath("inner-arrow.svg");
224
+ case "triangle-arrow":
225
+ return createImagePath("triangle-arrow.svg");
226
+ case "triangle-circle-arrow":
227
+ return createImagePath("triangle-circle-arrow.svg");
228
+ default:
229
+ return baseArrow;
230
+ }
231
+ });
232
+
233
+ /**
234
+ * Defines svg-filter for toggle icon
235
+ * @function
236
+ * @returns {string} svg-filter
237
+ */
238
+ const iconFilterClass = computed(() => {
239
+ const basicFilter = "extended__multiselect-filter";
240
+
241
+ switch(iconFilter) {
242
+ case "basic":
243
+ return `${basicFilter}_basic`;
244
+ case "black":
245
+ return `${basicFilter}_black`;
246
+ case "green":
247
+ return `${basicFilter}_green`;
248
+ default:
249
+ return `${basicFilter}_basic`;
250
+ }
251
+ });
252
+
253
+ /**
254
+ * Defines rotation class of toggle icon based on
255
+ * "dropdownActive" prop
256
+ * @function
257
+ * @returns {string} class
258
+ */
259
+ const iconFilterRotationClass = computed(() => {
260
+ return dropdownActive.value
261
+ ? "extended__multiselect-toggle--active"
262
+ : "extended__multiselect-toggle--locked";
263
+ });
264
+
265
+ /**
266
+ * Sets "tabindex" attibute of toggle button based on
267
+ * given tabindex
268
+ * @function
269
+ * @returns {number} tabindex
270
+ */
271
+ const increasedTabindex = computed(() => {
272
+ return tabindex.value ? tabindex.value + 1 : 0;
273
+ });
274
274
  </script>