@pequity/squirrel 6.0.0 → 6.0.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.
- package/README.md +4 -4
- package/dist/cjs/config.js +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/p-dropdown.js +2 -6
- package/dist/cjs/tailwind.js +1 -1
- package/dist/cjs/useSelectList.js +12 -5
- package/dist/es/config.js +2 -2
- package/dist/es/index.js +2 -2
- package/dist/es/p-dropdown.js +2 -6
- package/dist/es/tailwind.js +2 -2
- package/dist/es/useSelectList.js +13 -6
- package/dist/squirrel/components/p-dropdown/p-dropdown.vue.d.ts +5 -403
- package/dist/squirrel/tailwind/config.d.ts +2 -2
- package/package.json +10 -12
- package/squirrel/components/p-dropdown/p-dropdown.vue +3 -9
- package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +47 -1
- package/squirrel/components/p-select-list/p-select-list.spec.js +39 -0
- package/squirrel/components/p-select-list/useSelectList.ts +27 -7
- package/squirrel/tailwind/config.ts +2 -2
- package/squirrel/utils/listKeyboardNavigation.spec.js +36 -0
- package/squirrel/utils/tailwind.ts +1 -3
- package/dist/tailwind/config.js +0 -105
package/README.md
CHANGED
|
@@ -53,13 +53,13 @@ Add the "Inter" font to your project's `index.html` file:
|
|
|
53
53
|
<link rel="preconnect" href="https://rsms.me/" /><link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
Use the Squirrel Tailwind configuration as a `preset` in your project's `tailwind.config.
|
|
56
|
+
Use the Squirrel Tailwind configuration as a `preset` in your project's `tailwind.config.js` file:
|
|
57
57
|
|
|
58
58
|
```js
|
|
59
|
-
|
|
59
|
+
import { squirrelTailwindConfig } from '@pequity/squirrel';
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
presets: [
|
|
61
|
+
export default {
|
|
62
|
+
presets: [squirrelTailwindConfig],
|
|
63
63
|
content: [
|
|
64
64
|
'./index.html',
|
|
65
65
|
'./src/**/*.{vue,js,ts,jsx,tsx,mdx}',
|
package/dist/cjs/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const squirrelTailwindConfig = {
|
|
4
4
|
content: ["./index.html", "./squirrel/**/*.{vue,js,ts,jsx,tsx,mdx}", "./src/**/*.{vue,js,ts,jsx,tsx,mdx}"],
|
|
5
5
|
theme: {
|
|
6
6
|
colors: {
|
|
@@ -102,4 +102,4 @@ const config = {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
exports.
|
|
105
|
+
exports.squirrelTailwindConfig = squirrelTailwindConfig;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1005,7 +1005,7 @@ exports.PTableTd = pTableTd;
|
|
|
1005
1005
|
exports.PTabs = pTabs_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
1006
1006
|
exports.PTextarea = pTextarea;
|
|
1007
1007
|
exports.PToggle = pToggle;
|
|
1008
|
-
exports.
|
|
1008
|
+
exports.squirrelTailwindConfig = config.squirrelTailwindConfig;
|
|
1009
1009
|
exports.CURRENCY_INPUT_DEFAULTS = currency.CURRENCY_INPUT_DEFAULTS;
|
|
1010
1010
|
exports.getNextActiveElement = dom.getNextActiveElement;
|
|
1011
1011
|
exports.isElement = dom.isElement;
|
package/dist/cjs/p-dropdown.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const listKeyboardNavigation = require("./listKeyboardNavigation.js");
|
|
3
|
-
const floatingVue = require("floating-vue");
|
|
4
3
|
const vue = require("vue");
|
|
5
4
|
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
6
5
|
const ESCAPE_KEY = "Escape";
|
|
@@ -13,9 +12,6 @@ const nextFrame = () => {
|
|
|
13
12
|
};
|
|
14
13
|
const _sfc_main = vue.defineComponent({
|
|
15
14
|
name: "PDropdown",
|
|
16
|
-
components: {
|
|
17
|
-
Dropdown: floatingVue.Dropdown
|
|
18
|
-
},
|
|
19
15
|
inheritAttrs: false,
|
|
20
16
|
props: {
|
|
21
17
|
/**
|
|
@@ -110,8 +106,8 @@ const _sfc_main = vue.defineComponent({
|
|
|
110
106
|
}
|
|
111
107
|
});
|
|
112
108
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
113
|
-
const
|
|
114
|
-
return vue.openBlock(), vue.createBlock(
|
|
109
|
+
const _component_VDropdown = vue.resolveComponent("VDropdown");
|
|
110
|
+
return vue.openBlock(), vue.createBlock(_component_VDropdown, vue.mergeProps({ ref: "vPopper" }, { ..._ctx.defaultAttrs, ..._ctx.$attrs }, {
|
|
115
111
|
onShow: _ctx.onShow,
|
|
116
112
|
onHide: _ctx.destroy
|
|
117
113
|
}), vue.createSlots({ _: 2 }, [
|
package/dist/cjs/tailwind.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const config$1 = require("./config.js");
|
|
5
5
|
const lodashEs = require("lodash-es");
|
|
6
6
|
const resolveConfig = require("tailwindcss/resolveConfig");
|
|
7
|
-
const config = resolveConfig(config$1.
|
|
7
|
+
const config = resolveConfig(config$1.squirrelTailwindConfig);
|
|
8
8
|
const theme = config.theme;
|
|
9
9
|
const colors = theme == null ? void 0 : theme.colors;
|
|
10
10
|
(_a = theme == null ? void 0 : theme.extend) == null ? void 0 : _a.colors;
|
|
@@ -39,6 +39,9 @@ const useSelectList = (props, inputSearch, virtualizerRef, emit) => {
|
|
|
39
39
|
const selectedItems = vue.computed(() => {
|
|
40
40
|
return internalItems.value.filter((item) => internalValue.value.includes(item[props.itemValue]));
|
|
41
41
|
});
|
|
42
|
+
const deselectedItems = vue.computed(() => {
|
|
43
|
+
return internalItems.value.filter((item) => !internalValue.value.includes(item[props.itemValue]));
|
|
44
|
+
});
|
|
42
45
|
const computedItems = vue.computed(() => {
|
|
43
46
|
return lodashEs.cloneDeep(internalItems.value).filter((item) => {
|
|
44
47
|
return String(item[props.itemText]).toLocaleLowerCase().includes(String(search.value).toLocaleLowerCase());
|
|
@@ -205,17 +208,21 @@ const useSelectList = (props, inputSearch, virtualizerRef, emit) => {
|
|
|
205
208
|
return internalItems.value.indexOf(selectedItems.value[0]);
|
|
206
209
|
};
|
|
207
210
|
const selectAll = () => {
|
|
208
|
-
if (!props.multiple)
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
+
if (!props.multiple) return;
|
|
211
212
|
const selectedItems2 = internalValue.value;
|
|
213
|
+
const deselectedDisabledItemsValues = deselectedItems.value.filter((item) => isDisabled(item)).map((item) => item[props.itemValue]);
|
|
212
214
|
const filteredItems = computedItems.value.map((item) => item[props.itemValue]);
|
|
213
|
-
const
|
|
215
|
+
const uniqueItems = lodashEs.uniqBy([...selectedItems2, ...filteredItems], (item) => item);
|
|
216
|
+
const toEmit = lodashEs.difference(uniqueItems, deselectedDisabledItemsValues);
|
|
214
217
|
emit("update:modelValue", toArrOfObjIfNeeded(toEmit));
|
|
215
218
|
};
|
|
216
219
|
const clearAll = () => {
|
|
220
|
+
if (!props.multiple) return;
|
|
217
221
|
search.value = "";
|
|
218
|
-
|
|
222
|
+
const disabledItemsValues = internalItems.value.filter((item) => isDisabled(item)).map((item) => item[props.itemValue]);
|
|
223
|
+
const selectedItemsValues = internalValue.value;
|
|
224
|
+
const selectedDisabledItems = lodashEs.intersection(disabledItemsValues, selectedItemsValues);
|
|
225
|
+
emit("update:modelValue", toArrOfObjIfNeeded(selectedDisabledItems));
|
|
219
226
|
};
|
|
220
227
|
vue.watch(
|
|
221
228
|
() => props.items,
|
package/dist/es/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const squirrelTailwindConfig = {
|
|
2
2
|
content: ["./index.html", "./squirrel/**/*.{vue,js,ts,jsx,tsx,mdx}", "./src/**/*.{vue,js,ts,jsx,tsx,mdx}"],
|
|
3
3
|
theme: {
|
|
4
4
|
colors: {
|
|
@@ -101,5 +101,5 @@ const config = {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
export {
|
|
104
|
-
|
|
104
|
+
squirrelTailwindConfig
|
|
105
105
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -54,7 +54,7 @@ import { default as default19 } from "./p-table-td.js";
|
|
|
54
54
|
import { _ as _14 } from "./chunks/p-tabs.js";
|
|
55
55
|
import { default as default20 } from "./p-textarea.js";
|
|
56
56
|
import { default as default21 } from "./p-toggle.js";
|
|
57
|
-
import {
|
|
57
|
+
import { squirrelTailwindConfig } from "./config.js";
|
|
58
58
|
import { CURRENCY_INPUT_DEFAULTS } from "./currency.js";
|
|
59
59
|
import { getNextActiveElement, isElement, isVisible } from "./dom.js";
|
|
60
60
|
import { default as default22 } from "./inputClassesMixin.js";
|
|
@@ -1016,7 +1016,6 @@ export {
|
|
|
1016
1016
|
SPACING_SUFFIX,
|
|
1017
1017
|
TEXTAREA_BASE,
|
|
1018
1018
|
colsInjectionKey,
|
|
1019
|
-
config,
|
|
1020
1019
|
createPagingRange,
|
|
1021
1020
|
getColor,
|
|
1022
1021
|
getColorDeep,
|
|
@@ -1032,6 +1031,7 @@ export {
|
|
|
1032
1031
|
sanitizeUrl,
|
|
1033
1032
|
setupListKeyboardNavigation,
|
|
1034
1033
|
splitStringForHighlight,
|
|
1034
|
+
squirrelTailwindConfig,
|
|
1035
1035
|
toNumberOrNull,
|
|
1036
1036
|
toString,
|
|
1037
1037
|
useInputClasses,
|
package/dist/es/p-dropdown.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { setupListKeyboardNavigation } from "./listKeyboardNavigation.js";
|
|
2
|
-
import { Dropdown } from "floating-vue";
|
|
3
2
|
import { defineComponent, resolveComponent, openBlock, createBlock, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps } from "vue";
|
|
4
3
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
5
4
|
const ESCAPE_KEY = "Escape";
|
|
@@ -12,9 +11,6 @@ const nextFrame = () => {
|
|
|
12
11
|
};
|
|
13
12
|
const _sfc_main = defineComponent({
|
|
14
13
|
name: "PDropdown",
|
|
15
|
-
components: {
|
|
16
|
-
Dropdown
|
|
17
|
-
},
|
|
18
14
|
inheritAttrs: false,
|
|
19
15
|
props: {
|
|
20
16
|
/**
|
|
@@ -109,8 +105,8 @@ const _sfc_main = defineComponent({
|
|
|
109
105
|
}
|
|
110
106
|
});
|
|
111
107
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
112
|
-
const
|
|
113
|
-
return openBlock(), createBlock(
|
|
108
|
+
const _component_VDropdown = resolveComponent("VDropdown");
|
|
109
|
+
return openBlock(), createBlock(_component_VDropdown, mergeProps({ ref: "vPopper" }, { ..._ctx.defaultAttrs, ..._ctx.$attrs }, {
|
|
114
110
|
onShow: _ctx.onShow,
|
|
115
111
|
onHide: _ctx.destroy
|
|
116
112
|
}), createSlots({ _: 2 }, [
|
package/dist/es/tailwind.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import {
|
|
2
|
+
import { squirrelTailwindConfig } from "./config.js";
|
|
3
3
|
import { get } from "lodash-es";
|
|
4
4
|
import resolveConfig from "tailwindcss/resolveConfig";
|
|
5
|
-
const config = resolveConfig(
|
|
5
|
+
const config = resolveConfig(squirrelTailwindConfig);
|
|
6
6
|
const theme = config.theme;
|
|
7
7
|
const colors = theme == null ? void 0 : theme.colors;
|
|
8
8
|
(_a = theme == null ? void 0 : theme.extend) == null ? void 0 : _a.colors;
|
package/dist/es/useSelectList.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isObject } from "./object.js";
|
|
|
2
2
|
import { setupListKeyboardNavigation } from "./listKeyboardNavigation.js";
|
|
3
3
|
import { toString } from "./string.js";
|
|
4
4
|
import { useVirtualizer } from "@tanstack/vue-virtual";
|
|
5
|
-
import { cloneDeep, uniqBy } from "lodash-es";
|
|
5
|
+
import { cloneDeep, uniqBy, difference, intersection } from "lodash-es";
|
|
6
6
|
import { ref, computed, watch, onUnmounted, nextTick } from "vue";
|
|
7
7
|
const createInternalItems = (items) => {
|
|
8
8
|
let arr = Array.isArray(items) ? items.slice() : [];
|
|
@@ -37,6 +37,9 @@ const useSelectList = (props, inputSearch, virtualizerRef, emit) => {
|
|
|
37
37
|
const selectedItems = computed(() => {
|
|
38
38
|
return internalItems.value.filter((item) => internalValue.value.includes(item[props.itemValue]));
|
|
39
39
|
});
|
|
40
|
+
const deselectedItems = computed(() => {
|
|
41
|
+
return internalItems.value.filter((item) => !internalValue.value.includes(item[props.itemValue]));
|
|
42
|
+
});
|
|
40
43
|
const computedItems = computed(() => {
|
|
41
44
|
return cloneDeep(internalItems.value).filter((item) => {
|
|
42
45
|
return String(item[props.itemText]).toLocaleLowerCase().includes(String(search.value).toLocaleLowerCase());
|
|
@@ -203,17 +206,21 @@ const useSelectList = (props, inputSearch, virtualizerRef, emit) => {
|
|
|
203
206
|
return internalItems.value.indexOf(selectedItems.value[0]);
|
|
204
207
|
};
|
|
205
208
|
const selectAll = () => {
|
|
206
|
-
if (!props.multiple)
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
+
if (!props.multiple) return;
|
|
209
210
|
const selectedItems2 = internalValue.value;
|
|
211
|
+
const deselectedDisabledItemsValues = deselectedItems.value.filter((item) => isDisabled(item)).map((item) => item[props.itemValue]);
|
|
210
212
|
const filteredItems = computedItems.value.map((item) => item[props.itemValue]);
|
|
211
|
-
const
|
|
213
|
+
const uniqueItems = uniqBy([...selectedItems2, ...filteredItems], (item) => item);
|
|
214
|
+
const toEmit = difference(uniqueItems, deselectedDisabledItemsValues);
|
|
212
215
|
emit("update:modelValue", toArrOfObjIfNeeded(toEmit));
|
|
213
216
|
};
|
|
214
217
|
const clearAll = () => {
|
|
218
|
+
if (!props.multiple) return;
|
|
215
219
|
search.value = "";
|
|
216
|
-
|
|
220
|
+
const disabledItemsValues = internalItems.value.filter((item) => isDisabled(item)).map((item) => item[props.itemValue]);
|
|
221
|
+
const selectedItemsValues = internalValue.value;
|
|
222
|
+
const selectedDisabledItems = intersection(disabledItemsValues, selectedItemsValues);
|
|
223
|
+
emit("update:modelValue", toArrOfObjIfNeeded(selectedDisabledItems));
|
|
217
224
|
};
|
|
218
225
|
watch(
|
|
219
226
|
() => props.items,
|
|
@@ -27,14 +27,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
27
27
|
};
|
|
28
28
|
}>, {}, {
|
|
29
29
|
defaultAttrs: {
|
|
30
|
-
triggers:
|
|
31
|
-
autoHide:
|
|
30
|
+
triggers: string[];
|
|
31
|
+
autoHide: boolean;
|
|
32
32
|
theme: string;
|
|
33
33
|
popperClass: string;
|
|
34
|
-
placement:
|
|
34
|
+
placement: string;
|
|
35
35
|
distance: number;
|
|
36
36
|
delay: number;
|
|
37
|
-
handleResize:
|
|
37
|
+
handleResize: boolean;
|
|
38
38
|
};
|
|
39
39
|
navigationSvc: ListKeyboardNavigationInstance | null;
|
|
40
40
|
prevReference: HTMLElement | null;
|
|
@@ -73,403 +73,5 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
73
73
|
enableArrowNavigation: boolean;
|
|
74
74
|
enableCloseOnEsc: boolean;
|
|
75
75
|
triggerStyle: Record<string, any>;
|
|
76
|
-
}, {}, {
|
|
77
|
-
Dropdown: import("vue").DefineComponent<{
|
|
78
|
-
theme: {
|
|
79
|
-
type: StringConstructor;
|
|
80
|
-
default: any;
|
|
81
|
-
};
|
|
82
|
-
referenceNode: {
|
|
83
|
-
type: import("vue").PropType<() => Element>;
|
|
84
|
-
default: any;
|
|
85
|
-
};
|
|
86
|
-
shown: {
|
|
87
|
-
type: BooleanConstructor;
|
|
88
|
-
default: boolean;
|
|
89
|
-
};
|
|
90
|
-
showGroup: {
|
|
91
|
-
type: StringConstructor;
|
|
92
|
-
default: any;
|
|
93
|
-
};
|
|
94
|
-
ariaId: {
|
|
95
|
-
default: any;
|
|
96
|
-
};
|
|
97
|
-
disabled: {
|
|
98
|
-
type: BooleanConstructor;
|
|
99
|
-
default: any;
|
|
100
|
-
};
|
|
101
|
-
positioningDisabled: {
|
|
102
|
-
type: BooleanConstructor;
|
|
103
|
-
default: any;
|
|
104
|
-
};
|
|
105
|
-
placement: {
|
|
106
|
-
type: import("vue").PropType<import("floating-vue/dist/util/popper.js").Placement>;
|
|
107
|
-
default: any;
|
|
108
|
-
};
|
|
109
|
-
delay: {
|
|
110
|
-
type: import("vue").PropType<string | number | {
|
|
111
|
-
show: number;
|
|
112
|
-
hide: number;
|
|
113
|
-
}>;
|
|
114
|
-
default: any;
|
|
115
|
-
};
|
|
116
|
-
distance: {
|
|
117
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
118
|
-
default: any;
|
|
119
|
-
};
|
|
120
|
-
skidding: {
|
|
121
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
122
|
-
default: any;
|
|
123
|
-
};
|
|
124
|
-
triggers: {
|
|
125
|
-
type: import("vue").PropType<import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]>;
|
|
126
|
-
default: any;
|
|
127
|
-
};
|
|
128
|
-
showTriggers: {
|
|
129
|
-
type: import("vue").PropType<import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[])>;
|
|
130
|
-
default: any;
|
|
131
|
-
};
|
|
132
|
-
hideTriggers: {
|
|
133
|
-
type: import("vue").PropType<import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[])>;
|
|
134
|
-
default: any;
|
|
135
|
-
};
|
|
136
|
-
popperTriggers: {
|
|
137
|
-
type: import("vue").PropType<import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]>;
|
|
138
|
-
default: any;
|
|
139
|
-
};
|
|
140
|
-
popperShowTriggers: {
|
|
141
|
-
type: import("vue").PropType<import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[])>;
|
|
142
|
-
default: any;
|
|
143
|
-
};
|
|
144
|
-
popperHideTriggers: {
|
|
145
|
-
type: import("vue").PropType<import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[])>;
|
|
146
|
-
default: any;
|
|
147
|
-
};
|
|
148
|
-
container: {
|
|
149
|
-
type: any[];
|
|
150
|
-
default: any;
|
|
151
|
-
};
|
|
152
|
-
boundary: {
|
|
153
|
-
type: any[];
|
|
154
|
-
default: any;
|
|
155
|
-
};
|
|
156
|
-
strategy: {
|
|
157
|
-
type: import("vue").PropType<"absolute" | "fixed">;
|
|
158
|
-
default: any;
|
|
159
|
-
};
|
|
160
|
-
autoHide: {
|
|
161
|
-
type: import("vue").PropType<boolean | ((event: Event) => boolean)>;
|
|
162
|
-
default: any;
|
|
163
|
-
};
|
|
164
|
-
handleResize: {
|
|
165
|
-
type: BooleanConstructor;
|
|
166
|
-
default: any;
|
|
167
|
-
};
|
|
168
|
-
instantMove: {
|
|
169
|
-
type: BooleanConstructor;
|
|
170
|
-
default: any;
|
|
171
|
-
};
|
|
172
|
-
eagerMount: {
|
|
173
|
-
type: BooleanConstructor;
|
|
174
|
-
default: any;
|
|
175
|
-
};
|
|
176
|
-
popperClass: {
|
|
177
|
-
type: (ObjectConstructor | StringConstructor | ArrayConstructor)[];
|
|
178
|
-
default: any;
|
|
179
|
-
};
|
|
180
|
-
computeTransformOrigin: {
|
|
181
|
-
type: BooleanConstructor;
|
|
182
|
-
default: any;
|
|
183
|
-
};
|
|
184
|
-
autoMinSize: {
|
|
185
|
-
type: BooleanConstructor;
|
|
186
|
-
default: any;
|
|
187
|
-
};
|
|
188
|
-
autoSize: {
|
|
189
|
-
type: import("vue").PropType<boolean | "min" | "max">;
|
|
190
|
-
default: any;
|
|
191
|
-
};
|
|
192
|
-
autoMaxSize: {
|
|
193
|
-
type: BooleanConstructor;
|
|
194
|
-
default: any;
|
|
195
|
-
};
|
|
196
|
-
autoBoundaryMaxSize: {
|
|
197
|
-
type: BooleanConstructor;
|
|
198
|
-
default: any;
|
|
199
|
-
};
|
|
200
|
-
preventOverflow: {
|
|
201
|
-
type: BooleanConstructor;
|
|
202
|
-
default: any;
|
|
203
|
-
};
|
|
204
|
-
overflowPadding: {
|
|
205
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
206
|
-
default: any;
|
|
207
|
-
};
|
|
208
|
-
arrowPadding: {
|
|
209
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
210
|
-
default: any;
|
|
211
|
-
};
|
|
212
|
-
arrowOverflow: {
|
|
213
|
-
type: BooleanConstructor;
|
|
214
|
-
default: any;
|
|
215
|
-
};
|
|
216
|
-
flip: {
|
|
217
|
-
type: BooleanConstructor;
|
|
218
|
-
default: any;
|
|
219
|
-
};
|
|
220
|
-
shift: {
|
|
221
|
-
type: BooleanConstructor;
|
|
222
|
-
default: any;
|
|
223
|
-
};
|
|
224
|
-
shiftCrossAxis: {
|
|
225
|
-
type: BooleanConstructor;
|
|
226
|
-
default: any;
|
|
227
|
-
};
|
|
228
|
-
noAutoFocus: {
|
|
229
|
-
type: BooleanConstructor;
|
|
230
|
-
default: any;
|
|
231
|
-
};
|
|
232
|
-
disposeTimeout: {
|
|
233
|
-
type: NumberConstructor;
|
|
234
|
-
default: any;
|
|
235
|
-
};
|
|
236
|
-
}, unknown, unknown, {
|
|
237
|
-
finalTheme(): string;
|
|
238
|
-
}, {
|
|
239
|
-
getTargetNodes(): unknown[];
|
|
240
|
-
}, {
|
|
241
|
-
computed: {
|
|
242
|
-
themeClass(): string[];
|
|
243
|
-
};
|
|
244
|
-
} | {
|
|
245
|
-
methods: {
|
|
246
|
-
show(...args: any[]): any;
|
|
247
|
-
hide(...args: any[]): any;
|
|
248
|
-
dispose(...args: any[]): any;
|
|
249
|
-
onResize(...args: any[]): any;
|
|
250
|
-
};
|
|
251
|
-
}, import("vue").ComponentOptionsMixin, {
|
|
252
|
-
show: () => true;
|
|
253
|
-
hide: () => true;
|
|
254
|
-
'update:shown': (shown: boolean) => true;
|
|
255
|
-
'apply-show': () => true;
|
|
256
|
-
'apply-hide': () => true;
|
|
257
|
-
'close-group': () => true;
|
|
258
|
-
'close-directive': () => true;
|
|
259
|
-
'auto-hide': () => true;
|
|
260
|
-
resize: () => true;
|
|
261
|
-
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
262
|
-
theme: {
|
|
263
|
-
type: StringConstructor;
|
|
264
|
-
default: any;
|
|
265
|
-
};
|
|
266
|
-
referenceNode: {
|
|
267
|
-
type: import("vue").PropType<() => Element>;
|
|
268
|
-
default: any;
|
|
269
|
-
};
|
|
270
|
-
shown: {
|
|
271
|
-
type: BooleanConstructor;
|
|
272
|
-
default: boolean;
|
|
273
|
-
};
|
|
274
|
-
showGroup: {
|
|
275
|
-
type: StringConstructor;
|
|
276
|
-
default: any;
|
|
277
|
-
};
|
|
278
|
-
ariaId: {
|
|
279
|
-
default: any;
|
|
280
|
-
};
|
|
281
|
-
disabled: {
|
|
282
|
-
type: BooleanConstructor;
|
|
283
|
-
default: any;
|
|
284
|
-
};
|
|
285
|
-
positioningDisabled: {
|
|
286
|
-
type: BooleanConstructor;
|
|
287
|
-
default: any;
|
|
288
|
-
};
|
|
289
|
-
placement: {
|
|
290
|
-
type: import("vue").PropType<import("floating-vue").Placement>;
|
|
291
|
-
default: any;
|
|
292
|
-
};
|
|
293
|
-
delay: {
|
|
294
|
-
type: import("vue").PropType<string | number | {
|
|
295
|
-
show: number;
|
|
296
|
-
hide: number;
|
|
297
|
-
}>;
|
|
298
|
-
default: any;
|
|
299
|
-
};
|
|
300
|
-
distance: {
|
|
301
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
302
|
-
default: any;
|
|
303
|
-
};
|
|
304
|
-
skidding: {
|
|
305
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
306
|
-
default: any;
|
|
307
|
-
};
|
|
308
|
-
triggers: {
|
|
309
|
-
type: import("vue").PropType<import("floating-vue").TriggerEvent[]>;
|
|
310
|
-
default: any;
|
|
311
|
-
};
|
|
312
|
-
showTriggers: {
|
|
313
|
-
type: import("vue").PropType<import("floating-vue").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[])>;
|
|
314
|
-
default: any;
|
|
315
|
-
};
|
|
316
|
-
hideTriggers: {
|
|
317
|
-
type: import("vue").PropType<import("floating-vue").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[])>;
|
|
318
|
-
default: any;
|
|
319
|
-
};
|
|
320
|
-
popperTriggers: {
|
|
321
|
-
type: import("vue").PropType<import("floating-vue").TriggerEvent[]>;
|
|
322
|
-
default: any;
|
|
323
|
-
};
|
|
324
|
-
popperShowTriggers: {
|
|
325
|
-
type: import("vue").PropType<import("floating-vue").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[])>;
|
|
326
|
-
default: any;
|
|
327
|
-
};
|
|
328
|
-
popperHideTriggers: {
|
|
329
|
-
type: import("vue").PropType<import("floating-vue").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[])>;
|
|
330
|
-
default: any;
|
|
331
|
-
};
|
|
332
|
-
container: {
|
|
333
|
-
type: any[];
|
|
334
|
-
default: any;
|
|
335
|
-
};
|
|
336
|
-
boundary: {
|
|
337
|
-
type: any[];
|
|
338
|
-
default: any;
|
|
339
|
-
};
|
|
340
|
-
strategy: {
|
|
341
|
-
type: import("vue").PropType<"absolute" | "fixed">;
|
|
342
|
-
default: any;
|
|
343
|
-
};
|
|
344
|
-
autoHide: {
|
|
345
|
-
type: import("vue").PropType<boolean | ((event: Event) => boolean)>;
|
|
346
|
-
default: any;
|
|
347
|
-
};
|
|
348
|
-
handleResize: {
|
|
349
|
-
type: BooleanConstructor;
|
|
350
|
-
default: any;
|
|
351
|
-
};
|
|
352
|
-
instantMove: {
|
|
353
|
-
type: BooleanConstructor;
|
|
354
|
-
default: any;
|
|
355
|
-
};
|
|
356
|
-
eagerMount: {
|
|
357
|
-
type: BooleanConstructor;
|
|
358
|
-
default: any;
|
|
359
|
-
};
|
|
360
|
-
popperClass: {
|
|
361
|
-
type: (ObjectConstructor | StringConstructor | ArrayConstructor)[];
|
|
362
|
-
default: any;
|
|
363
|
-
};
|
|
364
|
-
computeTransformOrigin: {
|
|
365
|
-
type: BooleanConstructor;
|
|
366
|
-
default: any;
|
|
367
|
-
};
|
|
368
|
-
autoMinSize: {
|
|
369
|
-
type: BooleanConstructor;
|
|
370
|
-
default: any;
|
|
371
|
-
};
|
|
372
|
-
autoSize: {
|
|
373
|
-
type: import("vue").PropType<boolean | "min" | "max">;
|
|
374
|
-
default: any;
|
|
375
|
-
};
|
|
376
|
-
autoMaxSize: {
|
|
377
|
-
type: BooleanConstructor;
|
|
378
|
-
default: any;
|
|
379
|
-
};
|
|
380
|
-
autoBoundaryMaxSize: {
|
|
381
|
-
type: BooleanConstructor;
|
|
382
|
-
default: any;
|
|
383
|
-
};
|
|
384
|
-
preventOverflow: {
|
|
385
|
-
type: BooleanConstructor;
|
|
386
|
-
default: any;
|
|
387
|
-
};
|
|
388
|
-
overflowPadding: {
|
|
389
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
390
|
-
default: any;
|
|
391
|
-
};
|
|
392
|
-
arrowPadding: {
|
|
393
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
394
|
-
default: any;
|
|
395
|
-
};
|
|
396
|
-
arrowOverflow: {
|
|
397
|
-
type: BooleanConstructor;
|
|
398
|
-
default: any;
|
|
399
|
-
};
|
|
400
|
-
flip: {
|
|
401
|
-
type: BooleanConstructor;
|
|
402
|
-
default: any;
|
|
403
|
-
};
|
|
404
|
-
shift: {
|
|
405
|
-
type: BooleanConstructor;
|
|
406
|
-
default: any;
|
|
407
|
-
};
|
|
408
|
-
shiftCrossAxis: {
|
|
409
|
-
type: BooleanConstructor;
|
|
410
|
-
default: any;
|
|
411
|
-
};
|
|
412
|
-
noAutoFocus: {
|
|
413
|
-
type: BooleanConstructor;
|
|
414
|
-
default: any;
|
|
415
|
-
};
|
|
416
|
-
disposeTimeout: {
|
|
417
|
-
type: NumberConstructor;
|
|
418
|
-
default: any;
|
|
419
|
-
};
|
|
420
|
-
}>> & {
|
|
421
|
-
onResize?: () => any;
|
|
422
|
-
onShow?: () => any;
|
|
423
|
-
onHide?: () => any;
|
|
424
|
-
"onUpdate:shown"?: (shown: boolean) => any;
|
|
425
|
-
"onApply-show"?: () => any;
|
|
426
|
-
"onApply-hide"?: () => any;
|
|
427
|
-
"onClose-group"?: () => any;
|
|
428
|
-
"onClose-directive"?: () => any;
|
|
429
|
-
"onAuto-hide"?: () => any;
|
|
430
|
-
}, {
|
|
431
|
-
placement: import("floating-vue").Placement;
|
|
432
|
-
strategy: "absolute" | "fixed";
|
|
433
|
-
disabled: boolean;
|
|
434
|
-
positioningDisabled: boolean;
|
|
435
|
-
delay: string | number | {
|
|
436
|
-
show: number;
|
|
437
|
-
hide: number;
|
|
438
|
-
};
|
|
439
|
-
distance: string | number;
|
|
440
|
-
skidding: string | number;
|
|
441
|
-
triggers: import("floating-vue").TriggerEvent[];
|
|
442
|
-
showTriggers: import("floating-vue").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]);
|
|
443
|
-
hideTriggers: import("floating-vue").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]);
|
|
444
|
-
popperTriggers: import("floating-vue").TriggerEvent[];
|
|
445
|
-
popperShowTriggers: import("floating-vue").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]);
|
|
446
|
-
popperHideTriggers: import("floating-vue").TriggerEvent[] | ((triggers: import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]) => import("floating-vue/dist/components/PopperWrapper.vue.js").TriggerEvent[]);
|
|
447
|
-
container: any;
|
|
448
|
-
boundary: any;
|
|
449
|
-
autoHide: boolean | ((event: Event) => boolean);
|
|
450
|
-
handleResize: boolean;
|
|
451
|
-
instantMove: boolean;
|
|
452
|
-
eagerMount: boolean;
|
|
453
|
-
popperClass: string | unknown[] | Record<string, any>;
|
|
454
|
-
computeTransformOrigin: boolean;
|
|
455
|
-
autoMinSize: boolean;
|
|
456
|
-
autoSize: boolean | "min" | "max";
|
|
457
|
-
autoMaxSize: boolean;
|
|
458
|
-
autoBoundaryMaxSize: boolean;
|
|
459
|
-
preventOverflow: boolean;
|
|
460
|
-
overflowPadding: string | number;
|
|
461
|
-
arrowPadding: string | number;
|
|
462
|
-
arrowOverflow: boolean;
|
|
463
|
-
flip: boolean;
|
|
464
|
-
shift: boolean;
|
|
465
|
-
shiftCrossAxis: boolean;
|
|
466
|
-
noAutoFocus: boolean;
|
|
467
|
-
disposeTimeout: number;
|
|
468
|
-
shown: boolean;
|
|
469
|
-
theme: string;
|
|
470
|
-
referenceNode: () => Element;
|
|
471
|
-
showGroup: string;
|
|
472
|
-
ariaId: any;
|
|
473
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
474
|
-
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
76
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
475
77
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const squirrelTailwindConfig: {
|
|
2
2
|
readonly content: ["./index.html", "./squirrel/**/*.{vue,js,ts,jsx,tsx,mdx}", "./src/**/*.{vue,js,ts,jsx,tsx,mdx}"];
|
|
3
3
|
readonly theme: {
|
|
4
4
|
readonly colors: {
|
|
@@ -97,4 +97,4 @@ export declare const config: {
|
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
|
-
export type SquirrelTailwindConfig = typeof
|
|
100
|
+
export type SquirrelTailwindConfig = typeof squirrelTailwindConfig;
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pequity/squirrel",
|
|
3
3
|
"description": "Squirrel component library",
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.2",
|
|
5
5
|
"packageManager": "pnpm@9.15.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"preinstall": "npx only-allow pnpm",
|
|
9
9
|
"dev": "vite --host",
|
|
10
10
|
"debug:hmr": "vite --host --debug hmr",
|
|
11
|
-
"build
|
|
12
|
-
"build": "rimraf dist && pnpm run build:tailwind && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.squirrel.json && resolve-tspaths --src ./squirrel --project tsconfig.squirrel.json && vite build",
|
|
11
|
+
"build": "rimraf dist && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.squirrel.json && resolve-tspaths --src ./squirrel --project tsconfig.squirrel.json && vite build",
|
|
13
12
|
"preview": "vite preview",
|
|
14
13
|
"lint": "eslint \"**/*.{vue,ts,js}\"",
|
|
15
14
|
"lint-fix": "eslint --fix \"**/*.{vue,ts,js}\"",
|
|
@@ -32,8 +31,7 @@
|
|
|
32
31
|
"import": "./dist/es/index.js",
|
|
33
32
|
"require": "./dist/cjs/index.js"
|
|
34
33
|
},
|
|
35
|
-
"./assets/squirrel.css": "./dist/squirrel.css"
|
|
36
|
-
"./tailwind": "./dist/tailwind/config.js"
|
|
34
|
+
"./assets/squirrel.css": "./dist/squirrel.css"
|
|
37
35
|
},
|
|
38
36
|
"main": "./dist/cjs/index.js",
|
|
39
37
|
"module": "./dist/es/index.js",
|
|
@@ -49,10 +47,10 @@
|
|
|
49
47
|
"vue-toastification": "^2.0.0-rc.5"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
|
-
"@commitlint/cli": "^19.6.
|
|
50
|
+
"@commitlint/cli": "^19.6.1",
|
|
53
51
|
"@commitlint/config-conventional": "^19.6.0",
|
|
54
52
|
"@pequity/eslint-config": "^1.0.3",
|
|
55
|
-
"@playwright/test": "^1.49.
|
|
53
|
+
"@playwright/test": "^1.49.1",
|
|
56
54
|
"@semantic-release/changelog": "^6.0.3",
|
|
57
55
|
"@semantic-release/git": "^10.0.1",
|
|
58
56
|
"@storybook/addon-a11y": "^8.4.7",
|
|
@@ -67,10 +65,10 @@
|
|
|
67
65
|
"@storybook/theming": "^8.4.7",
|
|
68
66
|
"@storybook/vue3": "^8.4.7",
|
|
69
67
|
"@storybook/vue3-vite": "^8.4.7",
|
|
70
|
-
"@tanstack/vue-virtual": "3.11.
|
|
68
|
+
"@tanstack/vue-virtual": "3.11.2",
|
|
71
69
|
"@types/jsdom": "^21.1.7",
|
|
72
70
|
"@types/lodash-es": "^4.17.12",
|
|
73
|
-
"@types/node": "^22.10.
|
|
71
|
+
"@types/node": "^22.10.2",
|
|
74
72
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
75
73
|
"@vitest/coverage-v8": "^2.1.8",
|
|
76
74
|
"@vue/compiler-sfc": "3.5.13",
|
|
@@ -78,14 +76,14 @@
|
|
|
78
76
|
"@vuepic/vue-datepicker": "10.0.0",
|
|
79
77
|
"autoprefixer": "^10.4.20",
|
|
80
78
|
"dayjs": "1.11.13",
|
|
81
|
-
"eslint": "^9.
|
|
79
|
+
"eslint": "^9.17.0",
|
|
82
80
|
"eslint-plugin-storybook": "^0.11.1",
|
|
83
81
|
"floating-vue": "5.2.2",
|
|
84
82
|
"glob": "^11.0.0",
|
|
85
83
|
"husky": "^9.1.7",
|
|
86
84
|
"iconify-icon": "^2.2.0",
|
|
87
85
|
"jsdom": "^25.0.1",
|
|
88
|
-
"lint-staged": "^15.2.
|
|
86
|
+
"lint-staged": "^15.2.11",
|
|
89
87
|
"lodash-es": "4.17.21",
|
|
90
88
|
"make-coverage-badge": "^1.2.0",
|
|
91
89
|
"postcss": "^8.4.49",
|
|
@@ -93,7 +91,7 @@
|
|
|
93
91
|
"prettier-plugin-tailwindcss": "^0.6.9",
|
|
94
92
|
"resolve-tspaths": "^0.8.23",
|
|
95
93
|
"rimraf": "^6.0.1",
|
|
96
|
-
"sass": "^1.
|
|
94
|
+
"sass": "^1.83.0",
|
|
97
95
|
"semantic-release": "^24.2.0",
|
|
98
96
|
"storybook": "^8.4.7",
|
|
99
97
|
"svgo": "^3.3.2",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<VDropdown ref="vPopper" v-bind="{ ...defaultAttrs, ...$attrs }" @show="onShow" @hide="destroy">
|
|
3
3
|
<template v-for="(_, slot) in $slots" #[slot]="scope">
|
|
4
4
|
<slot :name="slot" v-bind="scope || {}" />
|
|
5
5
|
</template>
|
|
6
|
-
</
|
|
6
|
+
</VDropdown>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
@@ -88,11 +88,8 @@ import {
|
|
|
88
88
|
type ListKeyboardNavigationInstance,
|
|
89
89
|
setupListKeyboardNavigation,
|
|
90
90
|
} from '@squirrel/utils/listKeyboardNavigation';
|
|
91
|
-
import { Dropdown } from 'floating-vue';
|
|
92
91
|
import { defineComponent } from 'vue';
|
|
93
92
|
|
|
94
|
-
type DropdownProps = InstanceType<typeof Dropdown>['$props'];
|
|
95
|
-
|
|
96
93
|
type VPopper = {
|
|
97
94
|
$refs: {
|
|
98
95
|
popperContent: {
|
|
@@ -125,9 +122,6 @@ const nextFrame = () => {
|
|
|
125
122
|
|
|
126
123
|
export default defineComponent({
|
|
127
124
|
name: 'PDropdown',
|
|
128
|
-
components: {
|
|
129
|
-
Dropdown,
|
|
130
|
-
},
|
|
131
125
|
inheritAttrs: false,
|
|
132
126
|
props: {
|
|
133
127
|
/**
|
|
@@ -167,7 +161,7 @@ export default defineComponent({
|
|
|
167
161
|
distance: 4,
|
|
168
162
|
delay: 0,
|
|
169
163
|
handleResize: true,
|
|
170
|
-
}
|
|
164
|
+
},
|
|
171
165
|
navigationSvc: null as ListKeyboardNavigationInstance | null,
|
|
172
166
|
prevReference: null as HTMLElement | null,
|
|
173
167
|
};
|
|
@@ -197,6 +197,27 @@ describe('PDropdownSelect.vue', () => {
|
|
|
197
197
|
cleanup(wrapper);
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
+
it('does not select disabled items when "Select All" is clicked', async () => {
|
|
201
|
+
useVirtualizer.mockImplementation(() => createMockedVirtualizer(10));
|
|
202
|
+
|
|
203
|
+
const items = cloneDeep(filterListItems).slice(0, 10);
|
|
204
|
+
items[0].disabled = true;
|
|
205
|
+
items[1].disabled = true;
|
|
206
|
+
const wrapper = createWrapper({ selected: [], items }, { multiple: true });
|
|
207
|
+
|
|
208
|
+
await wrapper.find('button').trigger('click');
|
|
209
|
+
|
|
210
|
+
await wrapper.findByText('Select all').trigger('click');
|
|
211
|
+
|
|
212
|
+
const selectedItemsOptions = wrapper.findAll('[p-select-list-option-item]');
|
|
213
|
+
const selectedItems = wrapper.findAll('[p-select-list-option-item].selected');
|
|
214
|
+
|
|
215
|
+
expect(selectedItems.length).toBe(selectedItemsOptions.length - 2);
|
|
216
|
+
expect(wrapper.vm.$data.selected.length).toBe(items.length - 2);
|
|
217
|
+
|
|
218
|
+
cleanup(wrapper);
|
|
219
|
+
});
|
|
220
|
+
|
|
200
221
|
it('clears all values', async () => {
|
|
201
222
|
const wrapper = createWrapper({ selected: [] }, { multiple: true });
|
|
202
223
|
|
|
@@ -213,6 +234,26 @@ describe('PDropdownSelect.vue', () => {
|
|
|
213
234
|
cleanup(wrapper);
|
|
214
235
|
});
|
|
215
236
|
|
|
237
|
+
it('does not clear disabled items', async () => {
|
|
238
|
+
useVirtualizer.mockImplementation(() => createMockedVirtualizer(10));
|
|
239
|
+
|
|
240
|
+
const items = cloneDeep(filterListItems).slice(0, 10);
|
|
241
|
+
items[0].disabled = true;
|
|
242
|
+
items[1].disabled = true;
|
|
243
|
+
const wrapper = createWrapper({ selected: [1, 2], items }, { multiple: true });
|
|
244
|
+
|
|
245
|
+
await wrapper.find('button').trigger('click');
|
|
246
|
+
|
|
247
|
+
await wrapper.findByText('Clear all').trigger('click');
|
|
248
|
+
|
|
249
|
+
const selectedItems = wrapper.findAll('[p-select-list-option-item].selected');
|
|
250
|
+
|
|
251
|
+
expect(selectedItems.length).toBe(2);
|
|
252
|
+
expect(wrapper.vm.$data.selected).toEqual([1, 2]);
|
|
253
|
+
|
|
254
|
+
cleanup(wrapper);
|
|
255
|
+
});
|
|
256
|
+
|
|
216
257
|
it('displays the selected items on top', async () => {
|
|
217
258
|
useVirtualizer.mockImplementation(() => createMockedVirtualizer(20));
|
|
218
259
|
|
|
@@ -532,6 +573,8 @@ describe('PDropdownSelect.vue', () => {
|
|
|
532
573
|
});
|
|
533
574
|
|
|
534
575
|
expect(wrapper.vm.$data.selected).toEqual([1, 3]);
|
|
576
|
+
|
|
577
|
+
cleanup(wrapper);
|
|
535
578
|
});
|
|
536
579
|
|
|
537
580
|
it('disables the item when the disabled item prop is set', async () => {
|
|
@@ -555,6 +598,7 @@ describe('PDropdownSelect.vue', () => {
|
|
|
555
598
|
expect(item.classes()).not.toContain('pointer-events-none');
|
|
556
599
|
}
|
|
557
600
|
});
|
|
601
|
+
|
|
558
602
|
cleanup(wrapper);
|
|
559
603
|
});
|
|
560
604
|
|
|
@@ -580,13 +624,14 @@ describe('PDropdownSelect.vue', () => {
|
|
|
580
624
|
expect(item.classes()).not.toContain('pointer-events-none');
|
|
581
625
|
}
|
|
582
626
|
});
|
|
627
|
+
|
|
583
628
|
cleanup(wrapper);
|
|
584
629
|
});
|
|
585
630
|
|
|
586
631
|
it('renders clear button when clearable is true and a value is selected', async () => {
|
|
587
632
|
useVirtualizer.mockImplementation(() => createMockedVirtualizer(20));
|
|
588
633
|
|
|
589
|
-
const wrapper = createWrapper({ selected: 17 }, { clearable: true });
|
|
634
|
+
const wrapper = createWrapper({ selected: [17] }, { multiple: true, clearable: true });
|
|
590
635
|
|
|
591
636
|
const clearButton = wrapper.find('button[aria-label="Clear selection"]');
|
|
592
637
|
expect(clearButton.exists()).toBe(true);
|
|
@@ -618,6 +663,7 @@ describe('PDropdownSelect.vue', () => {
|
|
|
618
663
|
|
|
619
664
|
await clearButton.trigger('click');
|
|
620
665
|
expect(wrapper.vm.$data.selected).toEqual([]);
|
|
666
|
+
|
|
621
667
|
cleanup(wrapper);
|
|
622
668
|
});
|
|
623
669
|
});
|
|
@@ -183,6 +183,25 @@ describe('PSelectList.vue', () => {
|
|
|
183
183
|
cleanup(wrapper);
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
+
it('does not select disabled items when "Select All" is clicked', async () => {
|
|
187
|
+
useVirtualizer.mockImplementation(() => createMockedVirtualizer(10));
|
|
188
|
+
|
|
189
|
+
const items = cloneDeep(filterListItems).slice(0, 10);
|
|
190
|
+
items[0].disabled = true;
|
|
191
|
+
items[1].disabled = true;
|
|
192
|
+
const wrapper = createWrapper({ selected: [], items }, { multiple: true });
|
|
193
|
+
|
|
194
|
+
await wrapper.findByText('Select all').trigger('click');
|
|
195
|
+
|
|
196
|
+
const selectedItemsOptions = wrapper.findAll('[p-select-list-option-item]');
|
|
197
|
+
const selectedItems = wrapper.findAll('[p-select-list-option-item].selected');
|
|
198
|
+
|
|
199
|
+
expect(selectedItems.length).toBe(selectedItemsOptions.length - 2);
|
|
200
|
+
expect(wrapper.vm.$data.selected.length).toBe(items.length - 2);
|
|
201
|
+
|
|
202
|
+
cleanup(wrapper);
|
|
203
|
+
});
|
|
204
|
+
|
|
186
205
|
it('clears all values', async () => {
|
|
187
206
|
const wrapper = createWrapper({ selected: [] }, { multiple: true });
|
|
188
207
|
|
|
@@ -198,6 +217,24 @@ describe('PSelectList.vue', () => {
|
|
|
198
217
|
cleanup(wrapper);
|
|
199
218
|
});
|
|
200
219
|
|
|
220
|
+
it('does not clear disabled items', async () => {
|
|
221
|
+
useVirtualizer.mockImplementation(() => createMockedVirtualizer(10));
|
|
222
|
+
|
|
223
|
+
const items = cloneDeep(filterListItems).slice(0, 10);
|
|
224
|
+
items[0].disabled = true;
|
|
225
|
+
items[1].disabled = true;
|
|
226
|
+
const wrapper = createWrapper({ selected: [1, 2], items }, { multiple: true });
|
|
227
|
+
|
|
228
|
+
await wrapper.findByText('Clear all').trigger('click');
|
|
229
|
+
|
|
230
|
+
const selectedItems = wrapper.findAll('[p-select-list-option-item].selected');
|
|
231
|
+
|
|
232
|
+
expect(selectedItems.length).toBe(2);
|
|
233
|
+
expect(wrapper.vm.$data.selected).toEqual([1, 2]);
|
|
234
|
+
|
|
235
|
+
cleanup(wrapper);
|
|
236
|
+
});
|
|
237
|
+
|
|
201
238
|
it('displays the selected items on top', async () => {
|
|
202
239
|
useVirtualizer.mockImplementation(() => createMockedVirtualizer(20));
|
|
203
240
|
|
|
@@ -448,6 +485,8 @@ describe('PSelectList.vue', () => {
|
|
|
448
485
|
});
|
|
449
486
|
|
|
450
487
|
expect(wrapper.vm.$data.selected).toEqual([1, 3]);
|
|
488
|
+
|
|
489
|
+
cleanup(wrapper);
|
|
451
490
|
});
|
|
452
491
|
|
|
453
492
|
it('removes values from the internalValue (modelValue) that are not in the items list', async () => {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@squirrel/utils/listKeyboardNavigation';
|
|
12
12
|
import { toString } from '@squirrel/utils/string';
|
|
13
13
|
import { useVirtualizer } from '@tanstack/vue-virtual';
|
|
14
|
-
import { cloneDeep, uniqBy } from 'lodash-es';
|
|
14
|
+
import { cloneDeep, difference, intersection, uniqBy } from 'lodash-es';
|
|
15
15
|
import { type ComponentPublicInstance, computed, nextTick, onUnmounted, type Ref, ref, watch } from 'vue';
|
|
16
16
|
|
|
17
17
|
type Emits = {
|
|
@@ -59,7 +59,11 @@ export const useSelectList = (props: Props, inputSearch: InputSearch, virtualize
|
|
|
59
59
|
|
|
60
60
|
// Computed
|
|
61
61
|
const selectedItems = computed(() => {
|
|
62
|
-
return internalItems.value.filter((item) => internalValue.value.includes(item[props.itemValue]
|
|
62
|
+
return internalItems.value.filter((item) => internalValue.value.includes(item[props.itemValue]));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const deselectedItems = computed(() => {
|
|
66
|
+
return internalItems.value.filter((item) => !internalValue.value.includes(item[props.itemValue]));
|
|
63
67
|
});
|
|
64
68
|
|
|
65
69
|
const computedItems = computed(() => {
|
|
@@ -279,20 +283,36 @@ export const useSelectList = (props: Props, inputSearch: InputSearch, virtualize
|
|
|
279
283
|
};
|
|
280
284
|
|
|
281
285
|
const selectAll = () => {
|
|
282
|
-
if (!props.multiple)
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
286
|
+
if (!props.multiple) return;
|
|
285
287
|
|
|
286
288
|
const selectedItems = internalValue.value;
|
|
289
|
+
const deselectedDisabledItemsValues = deselectedItems.value
|
|
290
|
+
.filter((item) => isDisabled(item))
|
|
291
|
+
.map((item) => item[props.itemValue]);
|
|
287
292
|
const filteredItems = computedItems.value.map((item) => item[props.itemValue]);
|
|
288
|
-
const
|
|
293
|
+
const uniqueItems = uniqBy([...selectedItems, ...filteredItems], (item) => item);
|
|
294
|
+
|
|
295
|
+
// We cannot select disabled items so we remove them from the list
|
|
296
|
+
const toEmit = difference(uniqueItems, deselectedDisabledItemsValues);
|
|
289
297
|
|
|
290
298
|
emit('update:modelValue', toArrOfObjIfNeeded(toEmit));
|
|
291
299
|
};
|
|
292
300
|
|
|
293
301
|
const clearAll = () => {
|
|
302
|
+
if (!props.multiple) return;
|
|
303
|
+
|
|
294
304
|
search.value = '';
|
|
295
|
-
|
|
305
|
+
|
|
306
|
+
// We cannot clear disabled items that are selected
|
|
307
|
+
const disabledItemsValues = internalItems.value
|
|
308
|
+
.filter((item) => isDisabled(item))
|
|
309
|
+
.map((item) => item[props.itemValue]);
|
|
310
|
+
|
|
311
|
+
const selectedItemsValues = internalValue.value;
|
|
312
|
+
|
|
313
|
+
const selectedDisabledItems = intersection(disabledItemsValues, selectedItemsValues);
|
|
314
|
+
|
|
315
|
+
emit('update:modelValue', toArrOfObjIfNeeded(selectedDisabledItems));
|
|
296
316
|
};
|
|
297
317
|
|
|
298
318
|
// Watch
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config } from 'tailwindcss';
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const squirrelTailwindConfig = {
|
|
4
4
|
content: ['./index.html', './squirrel/**/*.{vue,js,ts,jsx,tsx,mdx}', './src/**/*.{vue,js,ts,jsx,tsx,mdx}'],
|
|
5
5
|
theme: {
|
|
6
6
|
colors: {
|
|
@@ -103,4 +103,4 @@ export const config = {
|
|
|
103
103
|
},
|
|
104
104
|
} as const satisfies Config;
|
|
105
105
|
|
|
106
|
-
export type SquirrelTailwindConfig = typeof
|
|
106
|
+
export type SquirrelTailwindConfig = typeof squirrelTailwindConfig;
|
|
@@ -168,4 +168,40 @@ describe('listKeyboardNavigation', () => {
|
|
|
168
168
|
|
|
169
169
|
navigationSvc.destroy();
|
|
170
170
|
});
|
|
171
|
+
|
|
172
|
+
it('triggers selection event on enter key', () => {
|
|
173
|
+
const navigationSvc = createTestSvc();
|
|
174
|
+
|
|
175
|
+
const event = new window.KeyboardEvent('keydown', {
|
|
176
|
+
key: 'Enter',
|
|
177
|
+
keyCode: 13,
|
|
178
|
+
bubbles: true,
|
|
179
|
+
target: document.querySelector('.dropdown-menu'),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const items = navigationSvc.getItems();
|
|
183
|
+
navigationSvc.setFocusedItem(items[1]);
|
|
184
|
+
|
|
185
|
+
const clickEvent = vi.fn();
|
|
186
|
+
items[1].addEventListener('click', clickEvent);
|
|
187
|
+
|
|
188
|
+
navigationSvc.listKeydown(event);
|
|
189
|
+
|
|
190
|
+
expect(clickEvent).toHaveBeenCalled();
|
|
191
|
+
|
|
192
|
+
navigationSvc.destroy();
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it('warns when multiple instances are initialized', () => {
|
|
196
|
+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
197
|
+
|
|
198
|
+
const navigationSvc1 = createTestSvc();
|
|
199
|
+
const navigationSvc2 = createTestSvc();
|
|
200
|
+
|
|
201
|
+
expect(consoleWarnSpy).toHaveBeenCalledWith('There can only be one instance of list navigation active at a time.');
|
|
202
|
+
|
|
203
|
+
navigationSvc1.destroy();
|
|
204
|
+
navigationSvc2.destroy();
|
|
205
|
+
consoleWarnSpy.mockRestore();
|
|
206
|
+
});
|
|
171
207
|
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// Relative import is used here because of
|
|
3
|
-
// "Module source URI is not allowed in this document: “http://tailwind.config/”" error
|
|
1
|
+
import { squirrelTailwindConfig } from '@squirrel/tailwind/config';
|
|
4
2
|
import { get } from 'lodash-es';
|
|
5
3
|
import type { Config } from 'tailwindcss';
|
|
6
4
|
import resolveConfig from 'tailwindcss/resolveConfig';
|
package/dist/tailwind/config.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.config = void 0;
|
|
4
|
-
exports.config = {
|
|
5
|
-
content: ['./index.html', './squirrel/**/*.{vue,js,ts,jsx,tsx,mdx}', './src/**/*.{vue,js,ts,jsx,tsx,mdx}'],
|
|
6
|
-
theme: {
|
|
7
|
-
colors: {
|
|
8
|
-
transparent: 'transparent',
|
|
9
|
-
current: 'currentColor',
|
|
10
|
-
/* Design system colors */
|
|
11
|
-
white: 'rgb(var(--color-white))',
|
|
12
|
-
black: 'rgb(var(--color-black))',
|
|
13
|
-
night: 'rgb(var(--color-night))',
|
|
14
|
-
'barley-white': 'rgb(var(--color-barley-white))',
|
|
15
|
-
'horses-neck': 'rgb(var(--color-horses-neck))',
|
|
16
|
-
'active-blue': 'rgb(var(--color-active-blue))',
|
|
17
|
-
/* Pequity colors */
|
|
18
|
-
'p-gray': {
|
|
19
|
-
10: 'rgb(var(--color-p-gray-10))',
|
|
20
|
-
20: 'rgb(var(--color-p-gray-20))',
|
|
21
|
-
30: 'rgb(var(--color-p-gray-30))',
|
|
22
|
-
40: 'rgb(var(--color-p-gray-40))',
|
|
23
|
-
50: 'rgb(var(--color-p-gray-50))',
|
|
24
|
-
60: 'rgb(var(--color-p-gray-60))',
|
|
25
|
-
70: 'rgb(var(--color-p-gray-70))',
|
|
26
|
-
80: 'rgb(var(--color-p-gray-80))',
|
|
27
|
-
90: 'rgb(var(--color-p-gray-90))',
|
|
28
|
-
100: 'rgb(var(--color-p-gray-100))',
|
|
29
|
-
},
|
|
30
|
-
'p-blue': {
|
|
31
|
-
10: 'rgb(var(--color-p-blue-10))',
|
|
32
|
-
15: 'rgb(var(--color-p-blue-15))',
|
|
33
|
-
20: 'rgb(var(--color-p-blue-20))',
|
|
34
|
-
30: 'rgb(var(--color-p-blue-30))',
|
|
35
|
-
40: 'rgb(var(--color-p-blue-40))',
|
|
36
|
-
50: 'rgb(var(--color-p-blue-50))',
|
|
37
|
-
60: 'rgb(var(--color-p-blue-60))',
|
|
38
|
-
70: 'rgb(var(--color-p-blue-70))',
|
|
39
|
-
80: 'rgb(var(--color-p-blue-80))',
|
|
40
|
-
},
|
|
41
|
-
'p-purple': {
|
|
42
|
-
10: 'rgb(var(--color-p-purple-10))',
|
|
43
|
-
20: 'rgb(var(--color-p-purple-20))',
|
|
44
|
-
30: 'rgb(var(--color-p-purple-30))',
|
|
45
|
-
40: 'rgb(var(--color-p-purple-40))',
|
|
46
|
-
50: 'rgb(var(--color-p-purple-50))',
|
|
47
|
-
60: 'rgb(var(--color-p-purple-60))',
|
|
48
|
-
},
|
|
49
|
-
'p-green': {
|
|
50
|
-
10: 'rgb(var(--color-p-green-10))',
|
|
51
|
-
20: 'rgb(var(--color-p-green-20))',
|
|
52
|
-
30: 'rgb(var(--color-p-green-30))',
|
|
53
|
-
40: 'rgb(var(--color-p-green-40))',
|
|
54
|
-
50: 'rgb(var(--color-p-green-50))',
|
|
55
|
-
},
|
|
56
|
-
'p-red': {
|
|
57
|
-
10: 'rgb(var(--color-p-red-10))',
|
|
58
|
-
20: 'rgb(var(--color-p-red-20))',
|
|
59
|
-
30: 'rgb(var(--color-p-red-30))',
|
|
60
|
-
40: 'rgb(var(--color-p-red-40))',
|
|
61
|
-
50: 'rgb(var(--color-p-red-50))',
|
|
62
|
-
},
|
|
63
|
-
/* Aliases */
|
|
64
|
-
primary: 'rgb(var(--color-primary))',
|
|
65
|
-
accent: 'rgb(var(--color-accent))',
|
|
66
|
-
surface: 'rgb(var(--color-surface))',
|
|
67
|
-
'on-surface': 'rgb(var(--color-on-surface))',
|
|
68
|
-
error: 'rgb(var(--color-error))',
|
|
69
|
-
'on-error': 'rgb(var(--color-on-error))',
|
|
70
|
-
info: 'rgb(var(--color-info))',
|
|
71
|
-
'on-info': 'rgb(var(--color-on-info))',
|
|
72
|
-
success: 'rgb(var(--color-success))',
|
|
73
|
-
'on-success': 'rgb(var(--color-on-success))',
|
|
74
|
-
warning: 'rgb(var(--color-warning))',
|
|
75
|
-
'on-warning': 'rgb(var(--color-on-warning))',
|
|
76
|
-
},
|
|
77
|
-
fontFamily: {
|
|
78
|
-
sans: ['Inter', 'Helvetica', 'Arial', 'sans-serif'],
|
|
79
|
-
},
|
|
80
|
-
fontSize: {
|
|
81
|
-
xs: '0.75rem',
|
|
82
|
-
sm: '0.875rem',
|
|
83
|
-
base: '1rem',
|
|
84
|
-
lg: '1.125rem',
|
|
85
|
-
xl: '1.25rem',
|
|
86
|
-
'2xl': '1.5rem',
|
|
87
|
-
'3xl': '1.875rem',
|
|
88
|
-
'4xl': '2.25rem',
|
|
89
|
-
'5xl': '3rem',
|
|
90
|
-
'6xl': '4rem',
|
|
91
|
-
},
|
|
92
|
-
extend: {
|
|
93
|
-
borderColor: {
|
|
94
|
-
DEFAULT: 'rgb(var(--color-p-gray-30))',
|
|
95
|
-
},
|
|
96
|
-
spacing: {
|
|
97
|
-
7.5: '1.875rem',
|
|
98
|
-
},
|
|
99
|
-
zIndex: {
|
|
100
|
-
110: '110',
|
|
101
|
-
},
|
|
102
|
-
screens: {},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
};
|