nuance-ui 0.1.7 → 0.1.8
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/dist/module.json +1 -1
- package/dist/module.mjs +1 -20
- package/dist/runtime/components/box.d.vue.ts +1 -1
- package/dist/runtime/components/box.vue +10 -2
- package/dist/runtime/components/box.vue.d.ts +1 -1
- package/dist/runtime/components/button/button.vue +3 -3
- package/dist/runtime/components/checkbox/checkbox-card.d.vue.ts +1 -1
- package/dist/runtime/components/checkbox/checkbox-card.vue.d.ts +1 -1
- package/dist/runtime/components/index.d.ts +2 -0
- package/dist/runtime/components/index.js +2 -0
- package/dist/runtime/components/link/lib.d.ts +2 -2
- package/dist/runtime/components/roving-focus/_lib/context.d.ts +51 -0
- package/dist/runtime/components/roving-focus/_lib/context.js +90 -0
- package/dist/runtime/components/roving-focus/index.d.ts +1 -0
- package/dist/runtime/components/roving-focus/index.js +1 -0
- package/dist/runtime/components/roving-focus/roving-focus-item.d.vue.ts +13 -0
- package/dist/runtime/components/roving-focus/roving-focus-item.vue +32 -0
- package/dist/runtime/components/roving-focus/roving-focus-item.vue.d.ts +13 -0
- package/dist/runtime/components/roving-focus/roving-focus.d.vue.ts +21 -0
- package/dist/runtime/components/roving-focus/roving-focus.vue +23 -0
- package/dist/runtime/components/roving-focus/roving-focus.vue.d.ts +21 -0
- package/dist/runtime/components/select/select.d.vue.ts +2 -2
- package/dist/runtime/components/select/select.vue.d.ts +2 -2
- package/dist/runtime/components/tabs/tabs-tab.d.vue.ts +1 -1
- package/dist/runtime/components/tabs/tabs-tab.vue.d.ts +1 -1
- package/dist/runtime/components/tree/_ui/tree-item.d.vue.ts +0 -0
- package/dist/runtime/components/tree/_ui/tree-item.vue +171 -0
- package/dist/runtime/components/tree/_ui/tree-item.vue.d.ts +0 -0
- package/dist/runtime/components/tree/_ui/tree-root.d.vue.ts +33 -0
- package/dist/runtime/components/tree/_ui/tree-root.vue +77 -0
- package/dist/runtime/components/tree/_ui/tree-root.vue.d.ts +33 -0
- package/dist/runtime/components/tree/index.d.ts +1 -0
- package/dist/runtime/components/tree/index.js +1 -0
- package/dist/runtime/components/tree/lib/context.d.ts +24 -0
- package/dist/runtime/components/tree/lib/context.js +102 -0
- package/dist/runtime/components/tree/lib/get-default.d.ts +7 -0
- package/dist/runtime/components/tree/lib/get-default.js +10 -0
- package/dist/runtime/components/tree/model.d.ts +33 -0
- package/dist/runtime/components/tree/model.js +0 -0
- package/dist/runtime/components/tree/tree.d.vue.ts +23 -0
- package/dist/runtime/components/tree/tree.vue +36 -0
- package/dist/runtime/components/tree/tree.vue.d.ts +23 -0
- package/dist/runtime/composals/index.d.ts +0 -1
- package/dist/runtime/composals/index.js +0 -1
- package/dist/runtime/utils/get-mod.d.ts +2 -0
- package/dist/runtime/{composals/use-mod.js → utils/get-mod.js} +2 -13
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +2 -0
- package/dist/runtime/utils/tree.d.ts +88 -0
- package/dist/runtime/utils/tree.js +85 -0
- package/package.json +1 -1
- package/dist/runtime/composals/use-mod.d.ts +0 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -24,26 +24,7 @@ const module$1 = defineNuxtModule({
|
|
|
24
24
|
"@nuxt/icon": {
|
|
25
25
|
version: ">=2.1.0",
|
|
26
26
|
defaults: {
|
|
27
|
-
|
|
28
|
-
class: "",
|
|
29
|
-
clientBundle: {
|
|
30
|
-
scan: {
|
|
31
|
-
globInclude: ["src/**/*.vue", "src/**/*.ts"],
|
|
32
|
-
globExclude: [
|
|
33
|
-
"node_modules",
|
|
34
|
-
".idea",
|
|
35
|
-
".output",
|
|
36
|
-
".data",
|
|
37
|
-
".nuxt",
|
|
38
|
-
".nitro",
|
|
39
|
-
".cache",
|
|
40
|
-
"dist",
|
|
41
|
-
"server"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
includeCustomCollections: true,
|
|
45
|
-
sizeLimitKb: 256
|
|
46
|
-
}
|
|
27
|
+
class: ""
|
|
47
28
|
}
|
|
48
29
|
}
|
|
49
30
|
},
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { getMod, isFalsy } from "@nui/utils";
|
|
3
|
+
import { computed } from "vue";
|
|
3
4
|
const { is = "div", mod } = defineProps({
|
|
4
5
|
is: { type: null, required: false },
|
|
5
6
|
mod: { type: [Object, Array, null], required: false }
|
|
6
7
|
});
|
|
7
|
-
const _mod =
|
|
8
|
+
const _mod = computed(() => {
|
|
9
|
+
if (!mod)
|
|
10
|
+
return null;
|
|
11
|
+
if (Array.isArray(mod)) {
|
|
12
|
+
return mod.filter((i) => !isFalsy(i)).reduce((acc, value) => ({ ...acc, ...getMod(value) }), {});
|
|
13
|
+
}
|
|
14
|
+
return getMod(mod);
|
|
15
|
+
});
|
|
8
16
|
</script>
|
|
9
17
|
|
|
10
18
|
<template>
|
|
@@ -34,6 +34,7 @@ const {
|
|
|
34
34
|
is: { type: null, required: false },
|
|
35
35
|
mod: { type: [Object, Array, null], required: false }
|
|
36
36
|
});
|
|
37
|
+
const mod = computed(() => [{ loading, variant }, _mod]);
|
|
37
38
|
const style = computed(() => useStyleResolver((theme) => {
|
|
38
39
|
const {
|
|
39
40
|
background,
|
|
@@ -60,18 +61,17 @@ const style = computed(() => useStyleResolver((theme) => {
|
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
}));
|
|
63
|
-
const mod = computed(() => [{ loading, variant }, _mod]);
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<template>
|
|
67
67
|
<Box
|
|
68
68
|
:is
|
|
69
69
|
:mod='[
|
|
70
|
-
mod,
|
|
71
70
|
{
|
|
72
71
|
"with-left-section": !!$slots?.leftSection,
|
|
73
72
|
"with-right-section": !!$slots?.rightSection
|
|
74
|
-
}
|
|
73
|
+
},
|
|
74
|
+
mod
|
|
75
75
|
]'
|
|
76
76
|
:style='style.root'
|
|
77
77
|
:class='[css.root, classes?.root]'
|
|
@@ -17,10 +17,12 @@ export * from './modal/index.js';
|
|
|
17
17
|
export * from './nav-link/index.js';
|
|
18
18
|
export * from './paper.vue.js';
|
|
19
19
|
export * from './popover/index.js';
|
|
20
|
+
export * from './roving-focus/index.js';
|
|
20
21
|
export * from './select/index.js';
|
|
21
22
|
export * from './tabs/index.js';
|
|
22
23
|
export * from './text.vue.js';
|
|
23
24
|
export * from './textarea.vue.js';
|
|
24
25
|
export * from './title.vue.js';
|
|
25
26
|
export * from './transition/index.js';
|
|
27
|
+
export * from './tree/index.js';
|
|
26
28
|
export * from './visually-hidden/index.js';
|
|
@@ -17,10 +17,12 @@ export * from "./modal/index.js";
|
|
|
17
17
|
export * from "./nav-link/index.js";
|
|
18
18
|
export * from "./paper.vue";
|
|
19
19
|
export * from "./popover/index.js";
|
|
20
|
+
export * from "./roving-focus/index.js";
|
|
20
21
|
export * from "./select/index.js";
|
|
21
22
|
export * from "./tabs/index.js";
|
|
22
23
|
export * from "./text.vue";
|
|
23
24
|
export * from "./textarea.vue";
|
|
24
25
|
export * from "./title.vue";
|
|
25
26
|
export * from "./transition/index.js";
|
|
27
|
+
export * from "./tree/index.js";
|
|
26
28
|
export * from "./visually-hidden/index.js";
|
|
@@ -3,14 +3,14 @@ export declare function extractNuxtLinkProps<T extends NuxtLinkProps>(props: T):
|
|
|
3
3
|
link: {
|
|
4
4
|
prefetch: NonNullable<import("vue").UnwrapRef<T["prefetch"]>> | undefined;
|
|
5
5
|
noPrefetch: NonNullable<import("vue").UnwrapRef<T["noPrefetch"]>> | undefined;
|
|
6
|
+
to?: import("vue").UnwrapRef<T["to"]> | undefined;
|
|
6
7
|
target?: import("vue").UnwrapRef<T["target"]> | undefined;
|
|
7
8
|
replace?: import("vue").UnwrapRef<T["replace"]> | undefined;
|
|
8
|
-
to?: import("vue").UnwrapRef<T["to"]> | undefined;
|
|
9
9
|
external?: import("vue").UnwrapRef<T["external"]> | undefined;
|
|
10
10
|
rel?: import("vue").UnwrapRef<T["rel"]> | undefined;
|
|
11
11
|
noRel?: import("vue").UnwrapRef<T["noRel"]> | undefined;
|
|
12
12
|
prefetchOn?: import("vue").UnwrapRef<T["prefetchOn"]> | undefined;
|
|
13
13
|
trailingSlash?: import("vue").UnwrapRef<T["trailingSlash"]> | undefined;
|
|
14
14
|
};
|
|
15
|
-
rest: Omit<T, Extract<"
|
|
15
|
+
rest: Omit<T, Extract<"to", keyof T> | Extract<"target", keyof T> | Extract<"replace", keyof T> | Extract<"external", keyof T> | Extract<"rel", keyof T> | Extract<"noRel", keyof T> | Extract<"prefetch", keyof T> | Extract<"noPrefetch", keyof T> | Extract<"prefetchOn", keyof T> | Extract<"trailingSlash", keyof T>>;
|
|
16
16
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ShallowRef } from 'vue';
|
|
2
|
+
interface State {
|
|
3
|
+
/** Ref to the container that holds all roving items */
|
|
4
|
+
list: Readonly<ShallowRef<HTMLElement | null>>;
|
|
5
|
+
/** Whether focus should loop from last to first and vice versa */
|
|
6
|
+
loop?: boolean;
|
|
7
|
+
/** Keyboard navigation direction */
|
|
8
|
+
orientation?: 'vertical' | 'horizontal' | 'both';
|
|
9
|
+
/** Custom attribute to mark items instead of data-roving-item */
|
|
10
|
+
attr?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Provides the roving focus context to descendants.
|
|
14
|
+
* Must be called in the parent component that wraps the roving items.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { init } = useProvideRovingFocus({ list: containerRef, loop: true })
|
|
18
|
+
*/
|
|
19
|
+
export declare const useProvideRovingFocus: (args_0: State) => {
|
|
20
|
+
attr: string;
|
|
21
|
+
list: Readonly<ShallowRef<HTMLElement | null>>;
|
|
22
|
+
loop: boolean | undefined;
|
|
23
|
+
orientation: "both" | "horizontal" | "vertical" | undefined;
|
|
24
|
+
init: () => number;
|
|
25
|
+
focus: {
|
|
26
|
+
(dir: "first" | "last"): void;
|
|
27
|
+
(dir: "prev" | "next", element: HTMLElement | undefined | null): void;
|
|
28
|
+
};
|
|
29
|
+
getItems: () => HTMLElement[];
|
|
30
|
+
focusElement: (element?: HTMLElement) => void;
|
|
31
|
+
onItemUnmount: (element: HTMLElement | null | undefined) => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Consumes the roving focus context.
|
|
35
|
+
* Use inside each roving focus item to get access to navigation methods.
|
|
36
|
+
*/
|
|
37
|
+
export declare const useRovingFocus: () => {
|
|
38
|
+
attr: string;
|
|
39
|
+
list: Readonly<ShallowRef<HTMLElement | null>>;
|
|
40
|
+
loop: boolean | undefined;
|
|
41
|
+
orientation: "both" | "horizontal" | "vertical" | undefined;
|
|
42
|
+
init: () => number;
|
|
43
|
+
focus: {
|
|
44
|
+
(dir: "first" | "last"): void;
|
|
45
|
+
(dir: "prev" | "next", element: HTMLElement | undefined | null): void;
|
|
46
|
+
};
|
|
47
|
+
getItems: () => HTMLElement[];
|
|
48
|
+
focusElement: (element?: HTMLElement) => void;
|
|
49
|
+
onItemUnmount: (element: HTMLElement | null | undefined) => void;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createStrictInjection } from "@nui/helpers";
|
|
2
|
+
import { unrefElement } from "@vueuse/core";
|
|
3
|
+
import { nextTick, ref, watch } from "vue";
|
|
4
|
+
const SELECT_ATTR = "data-roving-item";
|
|
5
|
+
const injectionKey = Symbol("roving-focus");
|
|
6
|
+
const [useProvide, useState] = createStrictInjection(({ list, loop, orientation, attr = SELECT_ATTR }) => {
|
|
7
|
+
const activeIx = ref(-1);
|
|
8
|
+
const init = () => activeIx.value = 0;
|
|
9
|
+
const getItems = () => Array.from(
|
|
10
|
+
unrefElement(list)?.querySelectorAll(`[${attr}]:not(:disabled)`) ?? []
|
|
11
|
+
);
|
|
12
|
+
watch(activeIx, (ix, oldIx) => {
|
|
13
|
+
const items = getItems();
|
|
14
|
+
if (ix !== oldIx) {
|
|
15
|
+
items[oldIx]?.setAttribute("tabindex", "-1");
|
|
16
|
+
items[ix]?.setAttribute("tabindex", "0");
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const focusElement = (element) => {
|
|
20
|
+
if (!element)
|
|
21
|
+
return;
|
|
22
|
+
activeIx.value = getItems().indexOf(element);
|
|
23
|
+
nextTick(() => element.focus());
|
|
24
|
+
};
|
|
25
|
+
function focus(dir, element) {
|
|
26
|
+
if (!element && dir !== "first" && dir !== "last")
|
|
27
|
+
return;
|
|
28
|
+
const items = getItems();
|
|
29
|
+
const ix = element ? items.indexOf(element) : -1;
|
|
30
|
+
let nextIndex = ix;
|
|
31
|
+
switch (dir) {
|
|
32
|
+
case "first":
|
|
33
|
+
nextIndex = 0;
|
|
34
|
+
break;
|
|
35
|
+
case "last":
|
|
36
|
+
nextIndex = items.length - 1;
|
|
37
|
+
break;
|
|
38
|
+
case "next": {
|
|
39
|
+
nextIndex = ix + 1;
|
|
40
|
+
if (nextIndex >= items.length)
|
|
41
|
+
nextIndex = loop ? 0 : items.length - 1;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case "prev": {
|
|
45
|
+
nextIndex = ix - 1;
|
|
46
|
+
if (nextIndex < 0)
|
|
47
|
+
nextIndex = loop ? items.length - 1 : 0;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (nextIndex !== ix && items[nextIndex] !== void 0) {
|
|
52
|
+
activeIx.value = nextIndex;
|
|
53
|
+
focusElement(items[nextIndex]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const onItemUnmount = (element) => {
|
|
57
|
+
if (!element)
|
|
58
|
+
return;
|
|
59
|
+
const items = getItems();
|
|
60
|
+
const currentIndex = items.indexOf(element);
|
|
61
|
+
if (currentIndex === activeIx.value) {
|
|
62
|
+
nextTick(() => {
|
|
63
|
+
const newItems = getItems();
|
|
64
|
+
if (newItems.length === 0)
|
|
65
|
+
return activeIx.value = -1;
|
|
66
|
+
const nextIndex = currentIndex < newItems.length ? currentIndex : newItems.length - 1;
|
|
67
|
+
activeIx.value = nextIndex;
|
|
68
|
+
newItems[nextIndex]?.focus();
|
|
69
|
+
});
|
|
70
|
+
} else if (currentIndex < activeIx.value) {
|
|
71
|
+
activeIx.value--;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
attr,
|
|
76
|
+
list,
|
|
77
|
+
loop,
|
|
78
|
+
orientation,
|
|
79
|
+
init,
|
|
80
|
+
focus,
|
|
81
|
+
getItems,
|
|
82
|
+
focusElement,
|
|
83
|
+
onItemUnmount
|
|
84
|
+
};
|
|
85
|
+
}, {
|
|
86
|
+
injectionKey,
|
|
87
|
+
name: "RovingFocus"
|
|
88
|
+
});
|
|
89
|
+
export const useProvideRovingFocus = useProvide;
|
|
90
|
+
export const useRovingFocus = useState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useRovingFocus } from './_lib/context.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useRovingFocus } from "./_lib/context.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare var __VLS_16: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_16) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { unrefElement } from "@vueuse/core";
|
|
3
|
+
import { computed, onBeforeUnmount, useTemplateRef } from "vue";
|
|
4
|
+
import Renderless from "../renderless/renderless.vue";
|
|
5
|
+
import { useRovingFocus } from "./_lib/context";
|
|
6
|
+
const { focus, focusElement, orientation, attr, onItemUnmount } = useRovingFocus();
|
|
7
|
+
const isVertical = computed(() => orientation === "vertical" || orientation === "both");
|
|
8
|
+
const isHorizontal = computed(() => orientation === "horizontal" || orientation === "both");
|
|
9
|
+
const attrs = computed(() => ({ [attr]: "" }));
|
|
10
|
+
const ref = useTemplateRef("item");
|
|
11
|
+
onBeforeUnmount(() => {
|
|
12
|
+
const el = unrefElement(ref);
|
|
13
|
+
onItemUnmount(el);
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<Renderless
|
|
19
|
+
v-bind='attrs'
|
|
20
|
+
ref='item'
|
|
21
|
+
:tabindex='-1'
|
|
22
|
+
@keydown.up.prevent='isVertical && focus("prev", $event.currentTarget)'
|
|
23
|
+
@keydown.down.prevent='isVertical && focus("next", $event.currentTarget)'
|
|
24
|
+
@keydown.left.prevent='isHorizontal && focus("prev", $event.currentTarget)'
|
|
25
|
+
@keydown.right.prevent='isHorizontal && focus("next", $event.currentTarget)'
|
|
26
|
+
@keydown.home.prevent='focus("first")'
|
|
27
|
+
@keydown.end.prevent='focus("last")'
|
|
28
|
+
@click.prevent='focusElement($event.currentTarget)'
|
|
29
|
+
>
|
|
30
|
+
<slot />
|
|
31
|
+
</Renderless>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare var __VLS_16: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_16) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface RovingFocusProps {
|
|
2
|
+
/** Loop focus from last to first and vice versa */
|
|
3
|
+
loop?: boolean;
|
|
4
|
+
/** Allowed arrow key directions */
|
|
5
|
+
orientation?: 'vertical' | 'horizontal' | 'both';
|
|
6
|
+
/** Custom attribute instead of data-roving-item */
|
|
7
|
+
attr?: string;
|
|
8
|
+
}
|
|
9
|
+
declare var __VLS_7: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_7) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<RovingFocusProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<RovingFocusProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { nextTick, onMounted, useTemplateRef } from "vue";
|
|
3
|
+
import Renderless from "../renderless/renderless.vue";
|
|
4
|
+
import { useProvideRovingFocus } from "./_lib/context";
|
|
5
|
+
const { loop = false, orientation = "vertical" } = defineProps({
|
|
6
|
+
loop: { type: Boolean, required: false },
|
|
7
|
+
orientation: { type: String, required: false },
|
|
8
|
+
attr: { type: String, required: false }
|
|
9
|
+
});
|
|
10
|
+
const list = useTemplateRef("list");
|
|
11
|
+
const { init } = useProvideRovingFocus({
|
|
12
|
+
list,
|
|
13
|
+
loop,
|
|
14
|
+
orientation
|
|
15
|
+
});
|
|
16
|
+
onMounted(() => nextTick(() => init()));
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<Renderless ref='list'>
|
|
21
|
+
<slot />
|
|
22
|
+
</Renderless>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface RovingFocusProps {
|
|
2
|
+
/** Loop focus from last to first and vice versa */
|
|
3
|
+
loop?: boolean;
|
|
4
|
+
/** Allowed arrow key directions */
|
|
5
|
+
orientation?: 'vertical' | 'horizontal' | 'both';
|
|
6
|
+
/** Custom attribute instead of data-roving-item */
|
|
7
|
+
attr?: string;
|
|
8
|
+
}
|
|
9
|
+
declare var __VLS_7: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_7) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<RovingFocusProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<RovingFocusProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -23,7 +23,7 @@ declare const __VLS_export: <Value extends string = string, Ext extends Combobox
|
|
|
23
23
|
open?: boolean;
|
|
24
24
|
modelValue?: ComboboxItem<Value, Ext> | null;
|
|
25
25
|
search?: string;
|
|
26
|
-
}) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((evt: "select", args_0: number) => void) & ((evt: "clear") => void) & ((evt: "close", args_0: import("
|
|
26
|
+
}) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((evt: "select", args_0: number) => void) & ((evt: "clear") => void) & ((evt: "close", args_0: import("..").ComboboxDropdownEventSource) => void) & ((evt: "submit", args_0: string, args_1: ComboboxItem) => void) & ((evt: "open", args_0: import("..").ComboboxDropdownEventSource) => void) & ((evt: "update:modelValue", value: ComboboxItem<Value, Ext> | null) => void) & ((evt: "update:search", value: string) => void) & ((evt: "update:open", value: boolean) => void)>>> & import("vue").PublicProps;
|
|
27
27
|
expose: (exposed: {}) => void;
|
|
28
28
|
attrs: any;
|
|
29
29
|
slots: {
|
|
@@ -37,7 +37,7 @@ declare const __VLS_export: <Value extends string = string, Ext extends Combobox
|
|
|
37
37
|
} & {
|
|
38
38
|
rightSection?: (props: {}) => any;
|
|
39
39
|
};
|
|
40
|
-
emit: (((evt: "select", args_0: number) => void) & ((evt: "clear") => void) & ((evt: "close", args_0: import("
|
|
40
|
+
emit: (((evt: "select", args_0: number) => void) & ((evt: "clear") => void) & ((evt: "close", args_0: import("..").ComboboxDropdownEventSource) => void) & ((evt: "submit", args_0: string, args_1: ComboboxItem) => void) & ((evt: "open", args_0: import("..").ComboboxDropdownEventSource) => void)) & (((evt: "update:modelValue", value: ComboboxItem<Value, Ext> | null) => void) & ((evt: "update:search", value: string) => void) & ((evt: "update:open", value: boolean) => void));
|
|
41
41
|
}>) => import("vue").VNode & {
|
|
42
42
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
43
43
|
};
|
|
@@ -23,7 +23,7 @@ declare const __VLS_export: <Value extends string = string, Ext extends Combobox
|
|
|
23
23
|
open?: boolean;
|
|
24
24
|
modelValue?: ComboboxItem<Value, Ext> | null;
|
|
25
25
|
search?: string;
|
|
26
|
-
}) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((evt: "select", args_0: number) => void) & ((evt: "clear") => void) & ((evt: "close", args_0: import("
|
|
26
|
+
}) & __VLS_EmitsToProps<__VLS_NormalizeEmits<((evt: "select", args_0: number) => void) & ((evt: "clear") => void) & ((evt: "close", args_0: import("..").ComboboxDropdownEventSource) => void) & ((evt: "submit", args_0: string, args_1: ComboboxItem) => void) & ((evt: "open", args_0: import("..").ComboboxDropdownEventSource) => void) & ((evt: "update:modelValue", value: ComboboxItem<Value, Ext> | null) => void) & ((evt: "update:search", value: string) => void) & ((evt: "update:open", value: boolean) => void)>>> & import("vue").PublicProps;
|
|
27
27
|
expose: (exposed: {}) => void;
|
|
28
28
|
attrs: any;
|
|
29
29
|
slots: {
|
|
@@ -37,7 +37,7 @@ declare const __VLS_export: <Value extends string = string, Ext extends Combobox
|
|
|
37
37
|
} & {
|
|
38
38
|
rightSection?: (props: {}) => any;
|
|
39
39
|
};
|
|
40
|
-
emit: (((evt: "select", args_0: number) => void) & ((evt: "clear") => void) & ((evt: "close", args_0: import("
|
|
40
|
+
emit: (((evt: "select", args_0: number) => void) & ((evt: "clear") => void) & ((evt: "close", args_0: import("..").ComboboxDropdownEventSource) => void) & ((evt: "submit", args_0: string, args_1: ComboboxItem) => void) & ((evt: "open", args_0: import("..").ComboboxDropdownEventSource) => void)) & (((evt: "update:modelValue", value: ComboboxItem<Value, Ext> | null) => void) & ((evt: "update:search", value: string) => void) & ((evt: "update:open", value: boolean) => void));
|
|
41
41
|
}>) => import("vue").VNode & {
|
|
42
42
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
43
43
|
};
|
|
File without changes
|