vueless 0.0.337 → 0.0.339
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/directives/vTooltip.js +18 -15
- package/package.json +2 -2
- package/ui.button-toggle-item/UToggleItem.vue +1 -1
- package/ui.dropdown-badge/UDropdownBadge.vue +9 -8
- package/ui.dropdown-badge/storybook/stories.js +3 -3
- package/ui.dropdown-list/UDropdownList.vue +1 -1
- package/utils/utilTheme.js +1 -1
- package/utils/utilUI.js +14 -16
- package/web-types.json +1 -1
package/directives/vTooltip.js
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
import tippy from "tippy.js";
|
|
2
2
|
import { merge } from "lodash-es";
|
|
3
3
|
|
|
4
|
-
// Fix for SSR
|
|
5
|
-
import "tippy.js/dist/tippy.css";
|
|
6
|
-
import "tippy.js/themes/light.css";
|
|
7
|
-
import "tippy.js/animations/shift-away.css";
|
|
8
|
-
|
|
9
4
|
import { vuelessConfig } from "../utils/utilUI.js";
|
|
10
5
|
import { isCSR, isSSR } from "../utils/utilHelper.js";
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
const defaultSettings = {
|
|
14
|
-
arrow: true,
|
|
15
|
-
theme: "light",
|
|
16
|
-
animation: "shift-away",
|
|
17
|
-
};
|
|
7
|
+
let settings = {};
|
|
18
8
|
|
|
19
|
-
|
|
9
|
+
if (isCSR) {
|
|
10
|
+
import("tippy.js/dist/tippy.css");
|
|
11
|
+
import("tippy.js/themes/light.css");
|
|
12
|
+
import("tippy.js/animations/shift-away.css");
|
|
20
13
|
|
|
21
|
-
|
|
14
|
+
const defaultSettings = {
|
|
15
|
+
arrow: true,
|
|
16
|
+
theme: "light",
|
|
17
|
+
animation: "shift-away",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
settings = merge(defaultSettings, vuelessConfig?.directive?.tooltip || {});
|
|
21
|
+
tippy.setDefaultProps(settings);
|
|
22
|
+
}
|
|
22
23
|
|
|
23
24
|
export default {
|
|
24
25
|
mounted(el, bindings) {
|
|
25
|
-
|
|
26
|
+
if (isSSR) return;
|
|
27
|
+
|
|
28
|
+
tippy(el, merge(settings, bindings.value || {}));
|
|
26
29
|
},
|
|
27
30
|
|
|
28
31
|
updated(el, bindings) {
|
|
29
32
|
if (!el._tippy || isSSR) return;
|
|
30
33
|
|
|
31
|
-
el._tippy.setProps(merge(
|
|
34
|
+
el._tippy.setProps(merge(settings, bindings.value || {}));
|
|
32
35
|
},
|
|
33
36
|
|
|
34
37
|
unmounted(el) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.339",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless Component Framework.",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@release-it/bumper": "^6.0.1",
|
|
38
38
|
"@vitejs/plugin-vue": "^5.0.5",
|
|
39
39
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
40
|
-
"@vueless/plugin-vite": "^0.0.
|
|
40
|
+
"@vueless/plugin-vite": "^0.0.60",
|
|
41
41
|
"@vueless/storybook": "^0.0.34",
|
|
42
42
|
"@vueless/web-types": "^0.0.15",
|
|
43
43
|
"autoprefixer": "^10.4.19",
|
|
@@ -53,7 +53,7 @@ import { computed, inject, onMounted, ref } from "vue";
|
|
|
53
53
|
import UButton from "../ui.button/UButton.vue";
|
|
54
54
|
import { getRandomId, getDefault } from "../utils/utilUI.js";
|
|
55
55
|
|
|
56
|
-
import { TYPE_RADIO } from "../ui.button-toggle/constants";
|
|
56
|
+
import { TYPE_RADIO } from "../ui.button-toggle/constants.js";
|
|
57
57
|
|
|
58
58
|
import useAttrs from "./useAttrs.js";
|
|
59
59
|
import defaultConfig from "./config.js";
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
<UDropdownList
|
|
53
53
|
v-if="isShownOptions"
|
|
54
|
+
ref="dropdownListRef"
|
|
54
55
|
v-model="selectedItem"
|
|
55
56
|
:size="size"
|
|
56
57
|
:options="options"
|
|
@@ -58,13 +59,12 @@
|
|
|
58
59
|
:label-key="labelKey"
|
|
59
60
|
v-bind="dropdownListAttrs"
|
|
60
61
|
:data-test="`${dataTest}-list`"
|
|
61
|
-
@click="onClickList"
|
|
62
62
|
/>
|
|
63
63
|
</div>
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
66
|
<script setup>
|
|
67
|
-
import {
|
|
67
|
+
import { nextTick, ref, watch } from "vue";
|
|
68
68
|
|
|
69
69
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
70
70
|
import UBadge from "../ui.text-badge/UBadge.vue";
|
|
@@ -208,10 +208,9 @@ const emit = defineEmits([
|
|
|
208
208
|
"select",
|
|
209
209
|
]);
|
|
210
210
|
|
|
211
|
-
provide("hideDropdownOptions", hideOptions);
|
|
212
|
-
|
|
213
211
|
const isShownOptions = ref(false);
|
|
214
212
|
const selectedItem = ref("");
|
|
213
|
+
const dropdownListRef = ref(null);
|
|
215
214
|
|
|
216
215
|
const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIconAttrs } = useAttrs(
|
|
217
216
|
props,
|
|
@@ -222,17 +221,19 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
|
|
|
222
221
|
|
|
223
222
|
watch(selectedItem, () => {
|
|
224
223
|
emit("select", selectedItem.value);
|
|
224
|
+
|
|
225
|
+
hideOptions();
|
|
225
226
|
});
|
|
226
227
|
|
|
227
228
|
function onClickBadge() {
|
|
228
229
|
isShownOptions.value = !isShownOptions.value;
|
|
230
|
+
|
|
231
|
+
if (isShownOptions.value) {
|
|
232
|
+
nextTick(() => dropdownListRef.value.wrapperRef.focus());
|
|
233
|
+
}
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
function hideOptions() {
|
|
232
237
|
isShownOptions.value = false;
|
|
233
238
|
}
|
|
234
|
-
|
|
235
|
-
function onClickList() {
|
|
236
|
-
hideOptions();
|
|
237
|
-
}
|
|
238
239
|
</script>
|
|
@@ -14,9 +14,9 @@ export default {
|
|
|
14
14
|
args: {
|
|
15
15
|
label: "Dropdown",
|
|
16
16
|
options: [
|
|
17
|
-
{ label: "option 1",
|
|
18
|
-
{ label: "option 2",
|
|
19
|
-
{ label: "option 3",
|
|
17
|
+
{ label: "option 1", id: "1" },
|
|
18
|
+
{ label: "option 2", id: "2" },
|
|
19
|
+
{ label: "option 3", id: "3" },
|
|
20
20
|
],
|
|
21
21
|
},
|
|
22
22
|
argTypes: {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
v-bind="wrapperAttrs"
|
|
7
7
|
@keydown.self.down.prevent="pointerForward"
|
|
8
8
|
@keydown.self.up.prevent="pointerBackward"
|
|
9
|
-
@keydown.enter.
|
|
9
|
+
@keydown.enter.stop.self="addPointerElement"
|
|
10
10
|
>
|
|
11
11
|
<ul :id="`listbox-${id}`" v-bind="listAttrs" role="listbox">
|
|
12
12
|
<li
|
package/utils/utilTheme.js
CHANGED
package/utils/utilUI.js
CHANGED
|
@@ -7,29 +7,27 @@ import {
|
|
|
7
7
|
GRAYSCALE_COLOR,
|
|
8
8
|
DEFAULT_BRAND_COLOR,
|
|
9
9
|
NESTED_COMPONENT_REG_EXP,
|
|
10
|
-
} from "../constants";
|
|
10
|
+
} from "../constants.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
Load Vueless config from the project root.
|
|
14
14
|
Both for server and client side renderings.
|
|
15
|
-
IIFE is used to
|
|
15
|
+
IIFE for SSR is used to prevent top level await issue.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
18
|
-
let config = {};
|
|
17
|
+
export let vuelessConfig = {};
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
config = Object.values(
|
|
27
|
-
import.meta.glob("/vueless.config.js", { eager: true, import: "default" }),
|
|
28
|
-
)[0];
|
|
29
|
-
}
|
|
19
|
+
if (isSSR) {
|
|
20
|
+
(async () =>
|
|
21
|
+
(vuelessConfig = (
|
|
22
|
+
await import(/* @vite-ignore */ `${process.cwd()}/vueless.config.js?${Date.now()}`)
|
|
23
|
+
).default))();
|
|
24
|
+
}
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
if (isCSR) {
|
|
27
|
+
vuelessConfig = Object.values(
|
|
28
|
+
import.meta.glob("/vueless.config.js", { eager: true, import: "default" }),
|
|
29
|
+
)[0];
|
|
30
|
+
}
|
|
33
31
|
|
|
34
32
|
/**
|
|
35
33
|
Extend twMerge (tailwind merge) by vueless and user config:
|