vue3-extended-multiselect 1.10.2 → 2.0.0

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 (50) hide show
  1. package/.browserslistrc +2 -2
  2. package/.eslintrc.js +35 -34
  3. package/.github/workflows/publish.yml +41 -41
  4. package/CHANGELOG.md +411 -389
  5. package/LICENSE +21 -21
  6. package/README.md +270 -270
  7. package/babel.config.js +9 -9
  8. package/index.js +2 -2
  9. package/jest.config.js +62 -62
  10. package/package.json +56 -46
  11. package/rollup.config.mjs +74 -0
  12. package/src/assets/{base-arrow.svg → images/base-arrow.svg} +70 -70
  13. package/src/assets/{cancel.svg → images/cancel.svg} +34 -34
  14. package/src/assets/{circle-arrow.svg → images/circle-arrow.svg} +7 -7
  15. package/src/assets/{double-arrow.svg → images/double-arrow.svg} +39 -39
  16. package/src/assets/{inner-arrow.svg → images/inner-arrow.svg} +8 -8
  17. package/src/assets/{loader.svg → images/loader.svg} +5 -5
  18. package/src/assets/{triangle-arrow.svg → images/triangle-arrow.svg} +72 -72
  19. package/src/assets/{triangle-circle-arrow.svg → images/triangle-circle-arrow.svg} +38 -38
  20. package/src/assets/{wide-arrow.svg → images/wide-arrow.svg} +72 -72
  21. package/src/components/ExtendedMultiselectCancel.vue +165 -165
  22. package/src/components/ExtendedMultiselectInput.vue +741 -741
  23. package/src/components/ExtendedMultiselectLoader.vue +182 -182
  24. package/src/components/ExtendedMultiselectMultiple.vue +399 -399
  25. package/src/components/ExtendedMultiselectOptions.vue +1190 -1190
  26. package/src/components/ExtendedMultiselectToggle.vue +271 -271
  27. package/src/components/Vue3ExtendedMultiselect.vue +2475 -1949
  28. package/src/composition/cancel.js +39 -39
  29. package/src/composition/click-outside.js +8 -8
  30. package/src/composition/debounce.js +8 -8
  31. package/src/composition/emitter.js +8 -8
  32. package/src/composition/image-path.js +16 -16
  33. package/src/composition/labels.js +41 -41
  34. package/src/composition/preselected-options.js +67 -67
  35. package/src/composition/search-value.js +33 -33
  36. package/src/composition/sizes.js +44 -44
  37. package/src/composition/toggle.js +31 -31
  38. package/src/sets/sets.js +99 -99
  39. package/src/styles/animations.css +18 -18
  40. package/src/styles/main.css +460 -460
  41. package/src/styles/variables.css +51 -51
  42. package/src/tools/Debounce.js +25 -25
  43. package/src/tools/LocalEmitter.js +31 -31
  44. package/src/tools/instance.js +2 -2
  45. package/tests/unit/events.spec.js +149 -149
  46. package/tests/unit/props.spec.js +1154 -1155
  47. package/tests/unit/tools.spec.js +55 -53
  48. package/tests/utils/mount.js +37 -37
  49. package/tests/utils/utils.js +24 -24
  50. package/typings/vue3-extended-multiselect.d.ts +43 -43
@@ -1,165 +1,165 @@
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="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
- * Defines a svg-filter for icons
52
- * @property {string} iconFilter
53
- */
54
- iconFilter: {
55
- type: String,
56
- required: true,
57
- },
58
-
59
- /**
60
- * Provides size to create special size-class
61
- * for each kind of icon
62
- * @property {string} iconSize
63
- */
64
- iconSize: {
65
- type: String,
66
- required: true,
67
- },
68
-
69
- /**
70
- * Replaces cancel button with loader
71
- * @property {boolean} loading
72
- */
73
- loading: {
74
- type: Boolean,
75
- required: true,
76
- },
77
-
78
- /**
79
- * Determines whether to clear current value of search field
80
- * @property {boolean} showSearchField
81
- */
82
- showSearchField: {
83
- type: Boolean,
84
- required: true,
85
- },
86
-
87
- /**
88
- * Defines "tabindex" attribute of cancel button
89
- * @default null
90
- * @property {number|null} tabindex
91
- */
92
- tabindex: {
93
- type: Number,
94
- default: null,
95
- },
96
-
97
- /**
98
- * List of selected options
99
- * @property {Array} selectedOptions
100
- */
101
- selectedOptions: {
102
- type: Array,
103
- required: true,
104
- },
105
-
106
- /**
107
- * Reactive instance of LocalEmitter class
108
- * @property {object} emitter
109
- */
110
- emitter: {
111
- type: Object,
112
- required: true,
113
- },
114
- });
115
-
116
- const setSearchValue = inject("setSearchValue");
117
- const setSearchPattern = inject("setSearchPattern");
118
-
119
- const {
120
- disabled,
121
- emitter,
122
- iconFilter,
123
- iconSize,
124
- loading,
125
- selectedOptions,
126
- showSearchField,
127
- tabindex,
128
- } = toRefs(props);
129
-
130
- const { createImagePath } = useImagePath();
131
-
132
- const cancelIcon = ref(createImagePath("cancel.svg"));
133
-
134
- const { cancel } = useCancel(
135
- disabled,
136
- showSearchField,
137
- selectedOptions,
138
- emitter,
139
- setSearchValue,
140
- setSearchPattern,
141
- );
142
- const { iconSizeClass } = useSizes(iconSize);
143
-
144
- /**
145
- * Toggles classes of component if "loading"
146
- * or "disabled" props equals true
147
- * @function
148
- * @returns {string} class
149
- */
150
- const classes = computed(() => {
151
- return (loading.value || disabled.value)
152
- ? "extended__multiselect-cancel--disabled"
153
- : "extended__multiselect-cancel";
154
- });
155
-
156
- /**
157
- * Sets "tabindex" attibute of clear button based on
158
- * given tabindex
159
- * @function
160
- * @returns {number} tabindex
161
- */
162
- const increasedTabindex = computed(() => {
163
- return tabindex.value ? tabindex.value + 2 : 0;
164
- });
165
- </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="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
+ * Defines a svg-filter for icons
52
+ * @property {string} iconFilter
53
+ */
54
+ iconFilter: {
55
+ type: String,
56
+ required: true,
57
+ },
58
+
59
+ /**
60
+ * Provides size to create special size-class
61
+ * for each kind of icon
62
+ * @property {string} iconSize
63
+ */
64
+ iconSize: {
65
+ type: String,
66
+ required: true,
67
+ },
68
+
69
+ /**
70
+ * Replaces cancel button with loader
71
+ * @property {boolean} loading
72
+ */
73
+ loading: {
74
+ type: Boolean,
75
+ required: true,
76
+ },
77
+
78
+ /**
79
+ * Determines whether to clear current value of search field
80
+ * @property {boolean} showSearchField
81
+ */
82
+ showSearchField: {
83
+ type: Boolean,
84
+ required: true,
85
+ },
86
+
87
+ /**
88
+ * Defines "tabindex" attribute of cancel button
89
+ * @default null
90
+ * @property {number|null} tabindex
91
+ */
92
+ tabindex: {
93
+ type: Number,
94
+ default: null,
95
+ },
96
+
97
+ /**
98
+ * List of selected options
99
+ * @property {Array} selectedOptions
100
+ */
101
+ selectedOptions: {
102
+ type: Array,
103
+ required: true,
104
+ },
105
+
106
+ /**
107
+ * Reactive instance of LocalEmitter class
108
+ * @property {object} emitter
109
+ */
110
+ emitter: {
111
+ type: Object,
112
+ required: true,
113
+ },
114
+ });
115
+
116
+ const setSearchValue = inject("setSearchValue");
117
+ const setSearchPattern = inject("setSearchPattern");
118
+
119
+ const {
120
+ disabled,
121
+ emitter,
122
+ iconFilter,
123
+ iconSize,
124
+ loading,
125
+ selectedOptions,
126
+ showSearchField,
127
+ tabindex,
128
+ } = toRefs(props);
129
+
130
+ const { createImagePath } = useImagePath();
131
+
132
+ const cancelIcon = ref(createImagePath("cancel.svg"));
133
+
134
+ const { cancel } = useCancel(
135
+ disabled,
136
+ showSearchField,
137
+ selectedOptions,
138
+ emitter,
139
+ setSearchValue,
140
+ setSearchPattern,
141
+ );
142
+ const { iconSizeClass } = useSizes(iconSize);
143
+
144
+ /**
145
+ * Toggles classes of component if "loading"
146
+ * or "disabled" props equals true
147
+ * @function
148
+ * @returns {string} class
149
+ */
150
+ const classes = computed(() => {
151
+ return (loading.value || disabled.value)
152
+ ? "extended__multiselect-cancel--disabled"
153
+ : "extended__multiselect-cancel";
154
+ });
155
+
156
+ /**
157
+ * Sets "tabindex" attibute of clear button based on
158
+ * given tabindex
159
+ * @function
160
+ * @returns {number} tabindex
161
+ */
162
+ const increasedTabindex = computed(() => {
163
+ return tabindex.value ? tabindex.value + 2 : 0;
164
+ });
165
+ </script>