vue3-extended-multiselect 1.7.0 → 1.7.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 (46) hide show
  1. package/.browserslistrc +2 -2
  2. package/.eslintrc.js +34 -34
  3. package/.github/workflows/publish.yml +41 -41
  4. package/CHANGELOG.md +284 -275
  5. package/LICENSE +21 -21
  6. package/README.md +267 -267
  7. package/babel.config.js +9 -9
  8. package/index.js +2 -2
  9. package/jest.config.js +61 -61
  10. package/package.json +46 -46
  11. package/src/assets/base-arrow.svg +70 -70
  12. package/src/assets/cancel.svg +34 -34
  13. package/src/assets/circle-arrow.svg +7 -7
  14. package/src/assets/double-arrow.svg +39 -39
  15. package/src/assets/inner-arrow.svg +8 -8
  16. package/src/assets/loader.svg +5 -5
  17. package/src/assets/triangle-arrow.svg +72 -72
  18. package/src/assets/triangle-circle-arrow.svg +38 -38
  19. package/src/assets/wide-arrow.svg +72 -72
  20. package/src/components/ExtendedMultiselectCancel.vue +165 -165
  21. package/src/components/ExtendedMultiselectInput.vue +705 -705
  22. package/src/components/ExtendedMultiselectLoader.vue +182 -182
  23. package/src/components/ExtendedMultiselectMultiple.vue +365 -365
  24. package/src/components/ExtendedMultiselectOptions.vue +1168 -1168
  25. package/src/components/ExtendedMultiselectToggle.vue +271 -271
  26. package/src/components/Vue3ExtendedMultiselect.vue +1803 -1783
  27. package/src/composition/cancel.js +36 -36
  28. package/src/composition/click-outside.js +8 -8
  29. package/src/composition/emitter.js +8 -8
  30. package/src/composition/image-path.js +16 -16
  31. package/src/composition/labels.js +41 -41
  32. package/src/composition/preselected-options.js +67 -67
  33. package/src/composition/search-value.js +33 -33
  34. package/src/composition/sizes.js +44 -44
  35. package/src/composition/toggle.js +31 -31
  36. package/src/events/LocalEmitter.js +31 -31
  37. package/src/events/instance.js +3 -0
  38. package/src/sets/sets.js +99 -99
  39. package/src/styles/animations.css +18 -18
  40. package/src/styles/main.css +454 -454
  41. package/src/styles/variables.css +49 -49
  42. package/tests/unit/events.spec.js +136 -136
  43. package/tests/unit/props.spec.js +1128 -1128
  44. package/tests/utils/mount.js +37 -37
  45. package/tests/utils/utils.js +20 -20
  46. package/typings/vue3-extended-multiselect.d.ts +43 -43
@@ -1,50 +1,50 @@
1
- .extended__multiselect-wrapper,
2
- .extended__multiselect-wrapper--disabled {
3
- --basic-color: #708090;
4
- --basic-transparent: rgba(112, 128, 144, 0.6);
5
- --cancel: #B22222;
6
- --cancel-backgound-color: rgba(179, 33, 33, 0.1);
7
- --dark-slate-blue: #483D8B;
8
- --dark-slate-blue-transparent: rgba(72, 61, 139, 0.6);
9
- --dark-slate-grey: #2F4F4F;
10
- --dark-slate-grey-transparent: rgba(47, 79, 79, 0.6);
11
- --disabled: rgba(176, 176, 176, 0.6);
12
- --hover-color: #FFFFFF;
13
- --loader-color: #00BFFF;
14
- --strict: #000000;
15
- --strict-transparent: rgba(0, 0, 0, 0.6);
16
- --teal: #008080;
17
- --teal-transparent: rgba(0, 128, 128, 0.6);
18
-
19
- --block-border-radius: 4px;
20
- --block-cancel-padding: 4px;
21
- --block-gap: 6px;
22
- --block-padding: 1px 3px 1px 7px;
23
- --border-radius: 6px;
24
- --border-radius-small: 3px;
25
- --cancel-padding: 3px 8px;
26
- --grid-columns: 1fr 36px 36px;
27
- --grid-rows: 1fr 36px;
28
- --half-size: 50%;
29
- --icon-size-block: 14px;
30
- --icon-size-large: 18px;
31
- --icon-size-medium: 15px;
32
- --icon-size-small: 12px;
33
- --increaser-padding: 3px 7px;
34
- --max-size: 100%;
35
- --min-block-height: 26px;
36
- --options-padding: 6px 0;
37
- --outer-gap: 10px;
38
- --root-padding: 6px 10px;
39
- --toggle-icon-gap: 1px;
40
- --wide-text: 700;
41
- --wrapper-padding: 5px 10px;
42
-
43
- --border: 1px solid;
44
- --default-cursor: default;
45
- --icons-align-self: start;
46
- --icons-justify-self: center;
47
- --pointer-cursor: pointer;
48
- --wrapper-transition: border-top-left-radius 250ms ease 0s, border-top-right-radius 250ms ease 0s,
49
- border-bottom-left-radius 250ms ease-out, border-bottom-right-radius 250ms ease-out;
1
+ .extended__multiselect-wrapper,
2
+ .extended__multiselect-wrapper--disabled {
3
+ --basic-color: #708090;
4
+ --basic-transparent: rgba(112, 128, 144, 0.6);
5
+ --cancel: #B22222;
6
+ --cancel-backgound-color: rgba(179, 33, 33, 0.1);
7
+ --dark-slate-blue: #483D8B;
8
+ --dark-slate-blue-transparent: rgba(72, 61, 139, 0.6);
9
+ --dark-slate-grey: #2F4F4F;
10
+ --dark-slate-grey-transparent: rgba(47, 79, 79, 0.6);
11
+ --disabled: rgba(176, 176, 176, 0.6);
12
+ --hover-color: #FFFFFF;
13
+ --loader-color: #00BFFF;
14
+ --strict: #000000;
15
+ --strict-transparent: rgba(0, 0, 0, 0.6);
16
+ --teal: #008080;
17
+ --teal-transparent: rgba(0, 128, 128, 0.6);
18
+
19
+ --block-border-radius: 4px;
20
+ --block-cancel-padding: 4px;
21
+ --block-gap: 6px;
22
+ --block-padding: 1px 3px 1px 7px;
23
+ --border-radius: 6px;
24
+ --border-radius-small: 3px;
25
+ --cancel-padding: 3px 8px;
26
+ --grid-columns: 1fr 36px 36px;
27
+ --grid-rows: 1fr 36px;
28
+ --half-size: 50%;
29
+ --icon-size-block: 14px;
30
+ --icon-size-large: 18px;
31
+ --icon-size-medium: 15px;
32
+ --icon-size-small: 12px;
33
+ --increaser-padding: 3px 7px;
34
+ --max-size: 100%;
35
+ --min-block-height: 26px;
36
+ --options-padding: 6px 0;
37
+ --outer-gap: 10px;
38
+ --root-padding: 6px 10px;
39
+ --toggle-icon-gap: 1px;
40
+ --wide-text: 700;
41
+ --wrapper-padding: 5px 10px;
42
+
43
+ --border: 1px solid;
44
+ --default-cursor: default;
45
+ --icons-align-self: start;
46
+ --icons-justify-self: center;
47
+ --pointer-cursor: pointer;
48
+ --wrapper-transition: border-top-left-radius 250ms ease 0s, border-top-right-radius 250ms ease 0s,
49
+ border-bottom-left-radius 250ms ease-out, border-bottom-right-radius 250ms ease-out;
50
50
  }
@@ -1,137 +1,137 @@
1
- import { fireEvent } from "@testing-library/dom";
2
- import {
3
- mountComponent,
4
- wrapperProvides,
5
- SEARCH_PATTERN,
6
- } from "../utils/mount";
7
- import {
8
- mockOptionSelection,
9
- createNewOptionsWrapper,
10
- } from "../utils/utils";
11
-
12
- import Vue3ExtendedMultiselect from "../../src/components/Vue3ExtendedMultiselect.vue";
13
- import ExtendedMultiselectInput from "../../src/components/ExtendedMultiselectInput.vue";
14
- import ExtendedMultiselectMultiple from "../../src/components/ExtendedMultiselectMultiple.vue";
15
-
16
- let wrapper;
17
-
18
- describe("events", () => {
19
- it("correctly emits 'pattern-changed' event", async () => {
20
- const propsData = {
21
- options: globalThis.OPTIONS,
22
- };
23
-
24
- wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
25
-
26
- wrapper.vm.emitter.emit(
27
- "extended:search-pattern-changed",
28
- globalThis.SEARCH_VALUE,
29
- );
30
-
31
- expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE);
32
- });
33
-
34
-
35
- it("correctly emits 'select' event", async () => {
36
- const propsData = {
37
- defaultExpanded: true,
38
- simpleEvents: false,
39
- inputId: globalThis.INPUT_ID,
40
- options: globalThis.OPTIONS,
41
- };
42
-
43
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
44
-
45
- await mockOptionSelection(wrapper);
46
-
47
- expect(wrapper.emitted().select[0][0].option.label).toEqual("First Option");
48
- expect(wrapper.emitted().select[0][0].inputId).toEqual(globalThis.INPUT_ID);
49
- });
50
-
51
-
52
- it("correctly emits 'clean' event", async () => {
53
- const propsData = {
54
- showClearIcon: true,
55
- defaultExpanded: true,
56
- options: globalThis.OPTIONS,
57
- };
58
-
59
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
60
-
61
- const cleanButton = wrapper.find("#extended__multiselect-cancel");
62
-
63
- await fireEvent.click(cleanButton.element);
64
-
65
- expect(wrapper.emitted().clean).toBeDefined();
66
- });
67
-
68
-
69
- it("correctly emits 'option-created' event", async () => {
70
- const propsData = {
71
- defaultExpanded: true,
72
- createOnTheGo: true,
73
- inputId: globalThis.INPUT_ID,
74
- };
75
-
76
- wrapper = await mountComponent(
77
- Vue3ExtendedMultiselect,
78
- false,
79
- propsData,
80
- wrapperProvides(globalThis.SEARCH_VALUE, SEARCH_PATTERN),
81
- );
82
-
83
- await fireEvent.mouseDown(createNewOptionsWrapper(wrapper).element);
84
-
85
- expect(wrapper.emitted()["option-created"][0][0]).toEqual(globalThis.SEARCH_VALUE);
86
- });
87
-
88
-
89
- it("correctly emits 'active' event", async () => {
90
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false);
91
-
92
- const inputWrapper = wrapper.findComponent(ExtendedMultiselectInput);
93
- const field = inputWrapper.find("input");
94
-
95
- await fireEvent.focus(field.element);
96
-
97
- expect(wrapper.emitted().active[0][0]).toBeNull();
98
- });
99
-
100
-
101
- it("correctly emits 'close' event", async () => {
102
- const propsData = {
103
- defaultExpanded: true,
104
- simpleEvents: false,
105
- inputId: globalThis.INPUT_ID,
106
- options: globalThis.OPTIONS,
107
- };
108
-
109
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
110
-
111
- await mockOptionSelection(wrapper);
112
-
113
- expect(wrapper.emitted().close[0][0].inputId).toEqual(globalThis.INPUT_ID);
114
- expect(wrapper.emitted().close[0][0].options).toHaveLength(1);
115
- });
116
-
117
-
118
- it("correctly emits 'increase' event", async () => {
119
- expect.assertions(1);
120
-
121
- const propsData = {
122
- multiple: true,
123
- toggleMultipleBlocksLimit: true,
124
- multipleBlocksLimit: 1,
125
- increaseDisplayBy: 1,
126
- preselectedOptions: globalThis.OPTIONS,
127
- options: globalThis.OPTIONS,
128
- };
129
- const wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
130
- const multipleWrapper = wrapper.findComponent(ExtendedMultiselectMultiple);
131
- const increaserWrapper = multipleWrapper.find(".extended__multiselect-increaser");
132
-
133
- await fireEvent.click(increaserWrapper.element);
134
-
135
- expect(wrapper.emitted().increase[0][0]).toEqual(2);
136
- });
1
+ import { fireEvent } from "@testing-library/dom";
2
+ import {
3
+ mountComponent,
4
+ wrapperProvides,
5
+ SEARCH_PATTERN,
6
+ } from "../utils/mount";
7
+ import {
8
+ mockOptionSelection,
9
+ createNewOptionsWrapper,
10
+ } from "../utils/utils";
11
+
12
+ import Vue3ExtendedMultiselect from "../../src/components/Vue3ExtendedMultiselect.vue";
13
+ import ExtendedMultiselectInput from "../../src/components/ExtendedMultiselectInput.vue";
14
+ import ExtendedMultiselectMultiple from "../../src/components/ExtendedMultiselectMultiple.vue";
15
+
16
+ let wrapper;
17
+
18
+ describe("events", () => {
19
+ it("correctly emits 'pattern-changed' event", async () => {
20
+ const propsData = {
21
+ options: globalThis.OPTIONS,
22
+ };
23
+
24
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
25
+
26
+ wrapper.vm.emitter.emit(
27
+ "extended:search-pattern-changed",
28
+ globalThis.SEARCH_VALUE,
29
+ );
30
+
31
+ expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE);
32
+ });
33
+
34
+
35
+ it("correctly emits 'select' event", async () => {
36
+ const propsData = {
37
+ defaultExpanded: true,
38
+ simpleEvents: false,
39
+ inputId: globalThis.INPUT_ID,
40
+ options: globalThis.OPTIONS,
41
+ };
42
+
43
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
44
+
45
+ await mockOptionSelection(wrapper);
46
+
47
+ expect(wrapper.emitted().select[0][0].option.label).toEqual("First Option");
48
+ expect(wrapper.emitted().select[0][0].inputId).toEqual(globalThis.INPUT_ID);
49
+ });
50
+
51
+
52
+ it("correctly emits 'clean' event", async () => {
53
+ const propsData = {
54
+ showClearIcon: true,
55
+ defaultExpanded: true,
56
+ options: globalThis.OPTIONS,
57
+ };
58
+
59
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
60
+
61
+ const cleanButton = wrapper.find("#extended__multiselect-cancel");
62
+
63
+ await fireEvent.click(cleanButton.element);
64
+
65
+ expect(wrapper.emitted().clean).toBeDefined();
66
+ });
67
+
68
+
69
+ it("correctly emits 'option-created' event", async () => {
70
+ const propsData = {
71
+ defaultExpanded: true,
72
+ createOnTheGo: true,
73
+ inputId: globalThis.INPUT_ID,
74
+ };
75
+
76
+ wrapper = await mountComponent(
77
+ Vue3ExtendedMultiselect,
78
+ false,
79
+ propsData,
80
+ wrapperProvides(globalThis.SEARCH_VALUE, SEARCH_PATTERN),
81
+ );
82
+
83
+ await fireEvent.mouseDown(createNewOptionsWrapper(wrapper).element);
84
+
85
+ expect(wrapper.emitted()["option-created"][0][0]).toEqual(globalThis.SEARCH_VALUE);
86
+ });
87
+
88
+
89
+ it("correctly emits 'active' event", async () => {
90
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false);
91
+
92
+ const inputWrapper = wrapper.findComponent(ExtendedMultiselectInput);
93
+ const field = inputWrapper.find("input");
94
+
95
+ await fireEvent.focus(field.element);
96
+
97
+ expect(wrapper.emitted().active[0][0]).toBeNull();
98
+ });
99
+
100
+
101
+ it("correctly emits 'close' event", async () => {
102
+ const propsData = {
103
+ defaultExpanded: true,
104
+ simpleEvents: false,
105
+ inputId: globalThis.INPUT_ID,
106
+ options: globalThis.OPTIONS,
107
+ };
108
+
109
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
110
+
111
+ await mockOptionSelection(wrapper);
112
+
113
+ expect(wrapper.emitted().close[0][0].inputId).toEqual(globalThis.INPUT_ID);
114
+ expect(wrapper.emitted().close[0][0].options).toHaveLength(1);
115
+ });
116
+
117
+
118
+ it("correctly emits 'increase' event", async () => {
119
+ expect.assertions(1);
120
+
121
+ const propsData = {
122
+ multiple: true,
123
+ toggleMultipleBlocksLimit: true,
124
+ multipleBlocksLimit: 1,
125
+ increaseDisplayBy: 1,
126
+ preselectedOptions: globalThis.OPTIONS,
127
+ options: globalThis.OPTIONS,
128
+ };
129
+ const wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
130
+ const multipleWrapper = wrapper.findComponent(ExtendedMultiselectMultiple);
131
+ const increaserWrapper = multipleWrapper.find(".extended__multiselect-increaser");
132
+
133
+ await fireEvent.click(increaserWrapper.element);
134
+
135
+ expect(wrapper.emitted().increase[0][0]).toEqual(2);
136
+ });
137
137
  });