vue3-extended-multiselect 0.2.1 → 1.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 (43) hide show
  1. package/.eslintrc.js +35 -29
  2. package/.github/workflows/publish.yml +41 -41
  3. package/CHANGELOG.md +91 -65
  4. package/LICENSE +21 -21
  5. package/README.md +261 -262
  6. package/babel.config.js +3 -2
  7. package/index.js +2 -2
  8. package/jest.config.js +57 -57
  9. package/package.json +47 -46
  10. package/src/assets/base-arrow.svg +70 -70
  11. package/src/assets/cancel.svg +34 -34
  12. package/src/assets/circle-arrow.svg +7 -7
  13. package/src/assets/double-arrow.svg +39 -39
  14. package/src/assets/inner-arrow.svg +8 -8
  15. package/src/assets/loader.svg +5 -5
  16. package/src/assets/triangle-arrow.svg +72 -72
  17. package/src/assets/triangle-circle-arrow.svg +38 -38
  18. package/src/assets/wide-arrow.svg +72 -72
  19. package/src/components/ExtendedMultiselectCancel.vue +148 -145
  20. package/src/components/ExtendedMultiselectInput.vue +617 -617
  21. package/src/components/ExtendedMultiselectLoader.vue +182 -176
  22. package/src/components/ExtendedMultiselectMultiple.vue +295 -291
  23. package/src/components/ExtendedMultiselectOptions.vue +1091 -1088
  24. package/src/components/ExtendedMultiselectToggle.vue +261 -261
  25. package/src/components/Vue3ExtendedMultiselect.vue +1661 -1661
  26. package/src/composition/cancel.js +33 -28
  27. package/src/composition/image-path.js +17 -0
  28. package/src/composition/labels.js +39 -39
  29. package/src/composition/preselected-options.js +66 -66
  30. package/src/composition/search-value.js +33 -33
  31. package/src/composition/sizes.js +42 -42
  32. package/src/composition/toggle.js +33 -31
  33. package/src/events/emitter.js +3 -0
  34. package/src/sets/sets.js +99 -99
  35. package/src/styles/animations.css +18 -18
  36. package/src/styles/main.css +432 -432
  37. package/src/styles/variables.css +47 -48
  38. package/tests/unit/events.spec.js +135 -135
  39. package/tests/unit/props.spec.js +1040 -1040
  40. package/tests/utils/mount.js +37 -37
  41. package/tests/utils/utils.js +20 -20
  42. package/typings/vue3-extended-multiselect.d.ts +42 -42
  43. package/.eslintignore +0 -2
@@ -1,49 +1,48 @@
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
- --marker-padding: 6px 40px;
35
- --max-size: 100%;
36
- --min-block-height: 25px;
37
- --options-padding: 6px 0;
38
- --outer-gap: 10px;
39
- --root-padding: 6px 10px;
40
- --toggle-icon-gap: 1px;
41
- --wide-text: 700;
42
- --wrapper-padding: 5px 10px;
43
-
44
- --border: 1px solid;
45
- --default-cursor: default;
46
- --icons-align-self: start;
47
- --icons-justify-self: center;
48
- --pointer-cursor: pointer;
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: 25px;
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;
49
48
  }
@@ -1,136 +1,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 emitter from "tiny-emitter/instance";
13
-
14
- import Vue3ExtendedMultiselect from "../../src/components/Vue3ExtendedMultiselect.vue";
15
- import ExtendedMultiselectInput from "../../src/components/ExtendedMultiselectInput.vue";
16
- import ExtendedMultiselectMultiple from "../../src/components/ExtendedMultiselectMultiple.vue";
17
-
18
- let wrapper;
19
-
20
- describe("events", () => {
21
- it("correctly emits 'pattern-changed' event", async () => {
22
- const propsData = {
23
- options: globalThis.OPTIONS,
24
- };
25
-
26
- wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
27
-
28
- emitter.emit("extended:search-pattern-changed", globalThis.SEARCH_VALUE);
29
-
30
- expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE);
31
- });
32
-
33
-
34
- it("correctly emits 'select' event", async () => {
35
- const propsData = {
36
- defaultExpanded: true,
37
- simpleEvents: false,
38
- inputId: globalThis.INPUT_ID,
39
- options: globalThis.OPTIONS,
40
- };
41
-
42
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
43
-
44
- await mockOptionSelection(wrapper);
45
-
46
- expect(wrapper.emitted().select[0][0].option.label).toEqual("First Option");
47
- expect(wrapper.emitted().select[0][0].inputId).toEqual(globalThis.INPUT_ID);
48
- });
49
-
50
-
51
- it("correctly emits 'clean' event", async () => {
52
- const propsData = {
53
- showClearIcon: true,
54
- defaultExpanded: true,
55
- options: globalThis.OPTIONS,
56
- };
57
-
58
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
59
-
60
- const cleanButton = wrapper.find("#extended__multiselect-cancel");
61
-
62
- await fireEvent.click(cleanButton.element);
63
-
64
- expect(wrapper.emitted().clean).toBeDefined();
65
- });
66
-
67
-
68
- it("correctly emits 'option-created' event", async () => {
69
- const propsData = {
70
- defaultExpanded: true,
71
- createOnTheGo: true,
72
- inputId: globalThis.INPUT_ID,
73
- };
74
-
75
- wrapper = await mountComponent(
76
- Vue3ExtendedMultiselect,
77
- false,
78
- propsData,
79
- wrapperProvides(globalThis.SEARCH_VALUE, SEARCH_PATTERN),
80
- );
81
-
82
- await fireEvent.mouseDown(createNewOptionsWrapper(wrapper).element);
83
-
84
- expect(wrapper.emitted()["option-created"][0][0]).toEqual(globalThis.SEARCH_VALUE);
85
- });
86
-
87
-
88
- it("correctly emits 'active' event", async () => {
89
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false);
90
-
91
- const inputWrapper = wrapper.findComponent(ExtendedMultiselectInput);
92
- const field = inputWrapper.find("input");
93
-
94
- await fireEvent.focus(field.element);
95
-
96
- expect(wrapper.emitted().active[0][0]).toBeNull();
97
- });
98
-
99
-
100
- it("correctly emits 'close' event", async () => {
101
- const propsData = {
102
- defaultExpanded: true,
103
- simpleEvents: false,
104
- inputId: globalThis.INPUT_ID,
105
- options: globalThis.OPTIONS,
106
- };
107
-
108
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
109
-
110
- await mockOptionSelection(wrapper);
111
-
112
- expect(wrapper.emitted().close[0][0].inputId).toEqual(globalThis.INPUT_ID);
113
- expect(wrapper.emitted().close[0][0].options).toHaveLength(0);
114
- });
115
-
116
-
117
- it("correctly emits 'increase' event", async () => {
118
- expect.assertions(1);
119
-
120
- const propsData = {
121
- multiple: true,
122
- toggleMultipleBlocksLimit: true,
123
- multipleBlocksLimit: 1,
124
- increaseDisplayBy: 1,
125
- preselectedOptions: globalThis.OPTIONS,
126
- options: globalThis.OPTIONS,
127
- };
128
- const wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
129
- const multipleWrapper = wrapper.findComponent(ExtendedMultiselectMultiple);
130
- const increaserWrapper = multipleWrapper.find(".extended__multiselect-increaser");
131
-
132
- await fireEvent.click(increaserWrapper.element);
133
-
134
- expect(wrapper.emitted().increase[0][0]).toEqual(2);
135
- });
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 emitter from "../../src/events/emitter";
13
+
14
+ import Vue3ExtendedMultiselect from "../../src/components/Vue3ExtendedMultiselect.vue";
15
+ import ExtendedMultiselectInput from "../../src/components/ExtendedMultiselectInput.vue";
16
+ import ExtendedMultiselectMultiple from "../../src/components/ExtendedMultiselectMultiple.vue";
17
+
18
+ let wrapper;
19
+
20
+ describe("events", () => {
21
+ it("correctly emits 'pattern-changed' event", async () => {
22
+ const propsData = {
23
+ options: globalThis.OPTIONS,
24
+ };
25
+
26
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
27
+
28
+ emitter.emit("extended:search-pattern-changed", globalThis.SEARCH_VALUE);
29
+
30
+ expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE);
31
+ });
32
+
33
+
34
+ it("correctly emits 'select' event", async () => {
35
+ const propsData = {
36
+ defaultExpanded: true,
37
+ simpleEvents: false,
38
+ inputId: globalThis.INPUT_ID,
39
+ options: globalThis.OPTIONS,
40
+ };
41
+
42
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
43
+
44
+ await mockOptionSelection(wrapper);
45
+
46
+ expect(wrapper.emitted().select[0][0].option.label).toEqual("First Option");
47
+ expect(wrapper.emitted().select[0][0].inputId).toEqual(globalThis.INPUT_ID);
48
+ });
49
+
50
+
51
+ it("correctly emits 'clean' event", async () => {
52
+ const propsData = {
53
+ showClearIcon: true,
54
+ defaultExpanded: true,
55
+ options: globalThis.OPTIONS,
56
+ };
57
+
58
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
59
+
60
+ const cleanButton = wrapper.find("#extended__multiselect-cancel");
61
+
62
+ await fireEvent.click(cleanButton.element);
63
+
64
+ expect(wrapper.emitted().clean).toBeDefined();
65
+ });
66
+
67
+
68
+ it("correctly emits 'option-created' event", async () => {
69
+ const propsData = {
70
+ defaultExpanded: true,
71
+ createOnTheGo: true,
72
+ inputId: globalThis.INPUT_ID,
73
+ };
74
+
75
+ wrapper = await mountComponent(
76
+ Vue3ExtendedMultiselect,
77
+ false,
78
+ propsData,
79
+ wrapperProvides(globalThis.SEARCH_VALUE, SEARCH_PATTERN),
80
+ );
81
+
82
+ await fireEvent.mouseDown(createNewOptionsWrapper(wrapper).element);
83
+
84
+ expect(wrapper.emitted()["option-created"][0][0]).toEqual(globalThis.SEARCH_VALUE);
85
+ });
86
+
87
+
88
+ it("correctly emits 'active' event", async () => {
89
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false);
90
+
91
+ const inputWrapper = wrapper.findComponent(ExtendedMultiselectInput);
92
+ const field = inputWrapper.find("input");
93
+
94
+ await fireEvent.focus(field.element);
95
+
96
+ expect(wrapper.emitted().active[0][0]).toBeNull();
97
+ });
98
+
99
+
100
+ it("correctly emits 'close' event", async () => {
101
+ const propsData = {
102
+ defaultExpanded: true,
103
+ simpleEvents: false,
104
+ inputId: globalThis.INPUT_ID,
105
+ options: globalThis.OPTIONS,
106
+ };
107
+
108
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
109
+
110
+ await mockOptionSelection(wrapper);
111
+
112
+ expect(wrapper.emitted().close[0][0].inputId).toEqual(globalThis.INPUT_ID);
113
+ expect(wrapper.emitted().close[0][0].options).toHaveLength(0);
114
+ });
115
+
116
+
117
+ it("correctly emits 'increase' event", async () => {
118
+ expect.assertions(1);
119
+
120
+ const propsData = {
121
+ multiple: true,
122
+ toggleMultipleBlocksLimit: true,
123
+ multipleBlocksLimit: 1,
124
+ increaseDisplayBy: 1,
125
+ preselectedOptions: globalThis.OPTIONS,
126
+ options: globalThis.OPTIONS,
127
+ };
128
+ const wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
129
+ const multipleWrapper = wrapper.findComponent(ExtendedMultiselectMultiple);
130
+ const increaserWrapper = multipleWrapper.find(".extended__multiselect-increaser");
131
+
132
+ await fireEvent.click(increaserWrapper.element);
133
+
134
+ expect(wrapper.emitted().increase[0][0]).toEqual(2);
135
+ });
136
136
  });