vue3-extended-multiselect 0.3.0 → 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 (44) hide show
  1. package/.eslintrc.js +35 -29
  2. package/.github/workflows/publish.yml +41 -41
  3. package/CHANGELOG.md +91 -72
  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 -48
  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
  44. package/vite.config.js +0 -7
@@ -1,38 +1,38 @@
1
- import { mount, shallowMount } from "@vue/test-utils";
2
- import { reactive } from "vue";
3
-
4
- export const mountComponent = (component, shallow, propsData, options) => {
5
- if (shallow) {
6
- return shallowMount(component, {
7
- propsData,
8
- ...options,
9
- });
10
- } else {
11
- return mount(component, {
12
- propsData,
13
- ...options,
14
- });
15
- }
16
- };
17
-
18
- export const wrapperProvides = (searchValue, searchPattern) => {
19
- return {
20
- provide: {
21
- searchState: reactive({
22
- searchValue: searchValue,
23
- searchPattern: searchPattern,
24
- }),
25
- },
26
- };
27
- };
28
-
29
- export const wrapperSlots = {
30
- slots: {
31
- moreThanLimit: `<div>${globalThis.MORE_THAN_LIMIT}</div>`,
32
- lessThanLimit: `<div>${globalThis.LESS_THAN_LIMIT}</div>`,
33
- },
34
- };
35
-
36
- export const SEARCH_PATTERN = /126/;
37
- export const NO_OPTIONS_PATTERN = /No options/i;
1
+ import { mount, shallowMount } from "@vue/test-utils";
2
+ import { reactive } from "vue";
3
+
4
+ export const mountComponent = (component, shallow, propsData, options) => {
5
+ if (shallow) {
6
+ return shallowMount(component, {
7
+ propsData,
8
+ ...options,
9
+ });
10
+ } else {
11
+ return mount(component, {
12
+ propsData,
13
+ ...options,
14
+ });
15
+ }
16
+ };
17
+
18
+ export const wrapperProvides = (searchValue, searchPattern) => {
19
+ return {
20
+ provide: {
21
+ searchState: reactive({
22
+ searchValue: searchValue,
23
+ searchPattern: searchPattern,
24
+ }),
25
+ },
26
+ };
27
+ };
28
+
29
+ export const wrapperSlots = {
30
+ slots: {
31
+ moreThanLimit: `<div>${globalThis.MORE_THAN_LIMIT}</div>`,
32
+ lessThanLimit: `<div>${globalThis.LESS_THAN_LIMIT}</div>`,
33
+ },
34
+ };
35
+
36
+ export const SEARCH_PATTERN = /126/;
37
+ export const NO_OPTIONS_PATTERN = /No options/i;
38
38
  export const FIRST_OPTION_PATTERN = /F/i;
@@ -1,21 +1,21 @@
1
- import { fireEvent } from "@testing-library/dom";
2
-
3
- import ExtendedMultiselectOptions from "../../src/components/ExtendedMultiselectOptions.vue";
4
-
5
- export const mockOptionSelection = async (wrapper) => {
6
- const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
7
- const optionsListWrapper = optionsWrapper.find(".extended__multiselect-options_container");
8
- const optionElement = optionsListWrapper.find(".extended__multiselect-options_option");
9
-
10
- await fireEvent.click(optionElement.element);
11
- }
12
-
13
- export const expandOptionsList = async (wrapper) => {
14
- const toggle = wrapper.find("#extended__multiselect-toggle");
15
- await fireEvent.click(toggle.element);
16
- }
17
-
18
- export const createNewOptionsWrapper = (wrapper) => {
19
- const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
20
- return optionsWrapper.find("div > div:first-child");
1
+ import { fireEvent } from "@testing-library/dom";
2
+
3
+ import ExtendedMultiselectOptions from "../../src/components/ExtendedMultiselectOptions.vue";
4
+
5
+ export const mockOptionSelection = async (wrapper) => {
6
+ const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
7
+ const optionsListWrapper = optionsWrapper.find(".extended__multiselect-options_container");
8
+ const optionElement = optionsListWrapper.find(".extended__multiselect-options_option");
9
+
10
+ await fireEvent.click(optionElement.element);
11
+ }
12
+
13
+ export const expandOptionsList = async (wrapper) => {
14
+ const toggle = wrapper.find("#extended__multiselect-toggle");
15
+ await fireEvent.click(toggle.element);
16
+ }
17
+
18
+ export const createNewOptionsWrapper = (wrapper) => {
19
+ const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
20
+ return optionsWrapper.find("div > div:first-child");
21
21
  }
@@ -1,43 +1,43 @@
1
- /**
2
- * General type for any kind of option
3
- */
4
- export type UnionOptionType = string | number | boolean | object | Array<unknown> | Function | null | undefined;
5
-
6
- /**
7
- * Method types provided by slot-scope
8
- */
9
- export type Cancel = () => void;
10
- export type CreateCustomOptionLabel = (option: UnionOptionType) => null | string;
11
- export type Increase = Cancel;
12
- export type DeselectBlock = (index: number) => void;
13
- export type ToggleOptionsList = (keyboardEvent?: KeyboardEvent) => void;
14
-
15
- interface InputIdInPayload {
16
- inputId?: string;
17
- }
18
-
19
- interface Limit extends InputIdInPayload {
20
- limit: number;
21
- }
22
-
23
- interface OptionsList extends InputIdInPayload {
24
- options: UnionOptionType[];
25
- }
26
-
27
- interface PatternChanged extends InputIdInPayload {
28
- pattern: string;
29
- }
30
-
31
- interface SingleOption extends InputIdInPayload {
32
- option: UnionOptionType;
33
- }
34
-
35
- /**
36
- * Event types
37
- */
38
- export type CleanEvent = UnionOptionType[] | OptionsList;
39
- export type CloseEvent = CleanEvent;
40
- export type IncreaseEvent = number | Limit;
41
- export type OptionCreatedEvent = UnionOptionType | SingleOption;
42
- export type PatternChangedEvent = string | PatternChanged;
1
+ /**
2
+ * General type for any kind of option
3
+ */
4
+ export type UnionOptionType = string | number | boolean | object | Array<unknown> | Function | null | undefined;
5
+
6
+ /**
7
+ * Method types provided by slot-scope
8
+ */
9
+ export type Cancel = () => void;
10
+ export type CreateCustomOptionLabel = (option: UnionOptionType) => null | string;
11
+ export type Increase = Cancel;
12
+ export type DeselectBlock = (index: number) => void;
13
+ export type ToggleOptionsList = (keyboardEvent?: KeyboardEvent) => void;
14
+
15
+ interface InputIdInPayload {
16
+ inputId?: string;
17
+ }
18
+
19
+ interface Limit extends InputIdInPayload {
20
+ limit: number;
21
+ }
22
+
23
+ interface OptionsList extends InputIdInPayload {
24
+ options: UnionOptionType[];
25
+ }
26
+
27
+ interface PatternChanged extends InputIdInPayload {
28
+ pattern: string;
29
+ }
30
+
31
+ interface SingleOption extends InputIdInPayload {
32
+ option: UnionOptionType;
33
+ }
34
+
35
+ /**
36
+ * Event types
37
+ */
38
+ export type CleanEvent = UnionOptionType[] | OptionsList;
39
+ export type CloseEvent = CleanEvent;
40
+ export type IncreaseEvent = number | Limit;
41
+ export type OptionCreatedEvent = UnionOptionType | SingleOption;
42
+ export type PatternChangedEvent = string | PatternChanged;
43
43
  export type SelectEvent = OptionCreatedEvent;
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- tests/unit
2
- tests/utils/mount.js
package/vite.config.js DELETED
@@ -1,7 +0,0 @@
1
- import { defineConfig } from "vite";
2
-
3
- import vitePluginRequire from "vite-plugin-require";
4
-
5
- export default defineConfig({
6
- plugins: [vitePluginRequire({})],
7
- });