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,166 +1,166 @@
1
- <template>
2
- <div
3
- aria-label="Clear options list"
4
- id="extended__multiselect-cancel"
5
- role="button"
6
- :class="classes"
7
- :tabindex="increasedTabindex"
8
- @click.stop="cancel"
9
- @keypress.stop="cancel"
10
- >
11
- <img
12
- alt=""
13
- v-if="!loading"
14
- :class="iconSizeClass"
15
- :src="cancelIcon"
16
- />
17
- <extended-multiselect-loader
18
- v-else
19
- :icon-filter="iconFilter"
20
- :icon-size="iconSize"
21
- />
22
- </div>
23
- </template>
24
-
25
- <script setup>
26
- import {
27
- computed,
28
- defineProps,
29
- inject,
30
- ref,
31
- toRefs,
32
- } from "vue";
33
-
34
- import useCancel from "../composition/cancel";
35
- import useImagePath from "../composition/image-path";
36
- import useSizes from "../composition/sizes";
37
-
38
- import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
39
-
40
- const props = defineProps({
41
- /**
42
- * Blocks cancel button
43
- * @property {boolean} disabled
44
- */
45
- disabled: {
46
- type: Boolean,
47
- required: true,
48
- },
49
-
50
- /**
51
- * Assigns unique identifier of extended multiselect
52
- * for each event
53
- * @property {string} emitterUniqueId
54
- */
55
- emitterUniqueId: {
56
- type: String,
57
- required: true,
58
- },
59
-
60
- /**
61
- * Defines a svg-filter for icons
62
- * @property {string} iconFilter
63
- */
64
- iconFilter: {
65
- type: String,
66
- required: true,
67
- },
68
-
69
- /**
70
- * Provides size to create special size-class
71
- * for each kind of icon
72
- * @property {string} iconSize
73
- */
74
- iconSize: {
75
- type: String,
76
- required: true,
77
- },
78
-
79
- /**
80
- * Replaces cancel button with loader
81
- * @property {boolean} loading
82
- */
83
- loading: {
84
- type: Boolean,
85
- required: true,
86
- },
87
-
88
- /**
89
- * Determines whether to clear current value of search field
90
- * @property {boolean} showSearchField
91
- */
92
- showSearchField: {
93
- type: Boolean,
94
- required: true,
95
- },
96
-
97
- /**
98
- * Defines "tabindex" attribute of cancel button
99
- * @default null
100
- * @property {number|null} tabindex
101
- */
102
- tabindex: {
103
- type: Number,
104
- default: null,
105
- },
106
-
107
- /**
108
- * List of selected options
109
- * @property {Array} selectedOptions
110
- */
111
- selectedOptions: {
112
- type: Array,
113
- required: true,
114
- },
115
- });
116
-
117
- const setSearchValue = inject("setSearchValue");
118
- const setSearchPattern = inject("setSearchPattern");
119
-
120
- const {
121
- disabled,
122
- emitterUniqueId,
123
- iconFilter,
124
- iconSize,
125
- loading,
126
- selectedOptions,
127
- showSearchField,
128
- tabindex,
129
- } = toRefs(props);
130
-
131
- const { createImagePath } = useImagePath();
132
-
133
- const cancelIcon = ref(createImagePath("cancel.svg"));
134
-
135
- const { cancel } = useCancel(
136
- disabled,
137
- showSearchField,
138
- selectedOptions,
139
- emitterUniqueId,
140
- setSearchValue,
141
- setSearchPattern,
142
- );
143
- const { iconSizeClass } = useSizes(iconSize);
144
-
145
- /**
146
- * Toggles classes of component if "loading"
147
- * or "disabled" props equals true
148
- * @function
149
- * @returns {string} class
150
- */
151
- const classes = computed(() => {
152
- return (loading.value || disabled.value)
153
- ? "extended__multiselect-cancel--disabled"
154
- : "extended__multiselect-cancel";
155
- });
156
-
157
- /**
158
- * Sets "tabindex" attibute of clear button based on
159
- * given tabindex
160
- * @function
161
- * @returns {number} tabindex
162
- */
163
- const increasedTabindex = computed(() => {
164
- return tabindex.value ? tabindex.value + 2 : 0;
165
- });
166
- </script>
1
+ <template>
2
+ <div
3
+ aria-label="Clear options list"
4
+ id="extended__multiselect-cancel"
5
+ role="button"
6
+ :class="classes"
7
+ :tabindex="increasedTabindex"
8
+ @click.stop="cancel"
9
+ @keypress.stop="cancel"
10
+ >
11
+ <img
12
+ alt=""
13
+ v-if="!loading"
14
+ :class="iconSizeClass"
15
+ :src="cancelIcon"
16
+ />
17
+ <extended-multiselect-loader
18
+ v-else
19
+ :icon-filter="iconFilter"
20
+ :icon-size="iconSize"
21
+ />
22
+ </div>
23
+ </template>
24
+
25
+ <script setup>
26
+ import {
27
+ computed,
28
+ defineProps,
29
+ inject,
30
+ ref,
31
+ toRefs,
32
+ } from "vue";
33
+
34
+ import useCancel from "../composition/cancel";
35
+ import useImagePath from "../composition/image-path";
36
+ import useSizes from "../composition/sizes";
37
+
38
+ import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
39
+
40
+ const props = defineProps({
41
+ /**
42
+ * Blocks cancel button
43
+ * @property {boolean} disabled
44
+ */
45
+ disabled: {
46
+ type: Boolean,
47
+ required: true,
48
+ },
49
+
50
+ /**
51
+ * Assigns unique identifier of extended multiselect
52
+ * for each event
53
+ * @property {string} emitterUniqueId
54
+ */
55
+ emitterUniqueId: {
56
+ type: String,
57
+ required: true,
58
+ },
59
+
60
+ /**
61
+ * Defines a svg-filter for icons
62
+ * @property {string} iconFilter
63
+ */
64
+ iconFilter: {
65
+ type: String,
66
+ required: true,
67
+ },
68
+
69
+ /**
70
+ * Provides size to create special size-class
71
+ * for each kind of icon
72
+ * @property {string} iconSize
73
+ */
74
+ iconSize: {
75
+ type: String,
76
+ required: true,
77
+ },
78
+
79
+ /**
80
+ * Replaces cancel button with loader
81
+ * @property {boolean} loading
82
+ */
83
+ loading: {
84
+ type: Boolean,
85
+ required: true,
86
+ },
87
+
88
+ /**
89
+ * Determines whether to clear current value of search field
90
+ * @property {boolean} showSearchField
91
+ */
92
+ showSearchField: {
93
+ type: Boolean,
94
+ required: true,
95
+ },
96
+
97
+ /**
98
+ * Defines "tabindex" attribute of cancel button
99
+ * @default null
100
+ * @property {number|null} tabindex
101
+ */
102
+ tabindex: {
103
+ type: Number,
104
+ default: null,
105
+ },
106
+
107
+ /**
108
+ * List of selected options
109
+ * @property {Array} selectedOptions
110
+ */
111
+ selectedOptions: {
112
+ type: Array,
113
+ required: true,
114
+ },
115
+ });
116
+
117
+ const setSearchValue = inject("setSearchValue");
118
+ const setSearchPattern = inject("setSearchPattern");
119
+
120
+ const {
121
+ disabled,
122
+ emitterUniqueId,
123
+ iconFilter,
124
+ iconSize,
125
+ loading,
126
+ selectedOptions,
127
+ showSearchField,
128
+ tabindex,
129
+ } = toRefs(props);
130
+
131
+ const { createImagePath } = useImagePath();
132
+
133
+ const cancelIcon = ref(createImagePath("cancel.svg"));
134
+
135
+ const { cancel } = useCancel(
136
+ disabled,
137
+ showSearchField,
138
+ selectedOptions,
139
+ emitterUniqueId,
140
+ setSearchValue,
141
+ setSearchPattern,
142
+ );
143
+ const { iconSizeClass } = useSizes(iconSize);
144
+
145
+ /**
146
+ * Toggles classes of component if "loading"
147
+ * or "disabled" props equals true
148
+ * @function
149
+ * @returns {string} class
150
+ */
151
+ const classes = computed(() => {
152
+ return (loading.value || disabled.value)
153
+ ? "extended__multiselect-cancel--disabled"
154
+ : "extended__multiselect-cancel";
155
+ });
156
+
157
+ /**
158
+ * Sets "tabindex" attibute of clear button based on
159
+ * given tabindex
160
+ * @function
161
+ * @returns {number} tabindex
162
+ */
163
+ const increasedTabindex = computed(() => {
164
+ return tabindex.value ? tabindex.value + 2 : 0;
165
+ });
166
+ </script>