@autoafleveren/ui 1.5.6 → 1.6.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.
- package/dist/icons.cjs +1 -1
- package/dist/icons.js +112 -112
- package/dist/types/composables/useContextMenu/index.d.ts +3 -0
- package/dist/ui-storybook.css +1 -1
- package/dist/ui.cjs +31 -31
- package/dist/ui.js +450 -445
- package/package.json +1 -1
- package/src/modules/components/AppActionBar/AppActionBar.vue +1 -1
- package/src/modules/components/AppActionBar/AppActionBarItem.vue +1 -1
- package/src/modules/components/AppActionBar/AppActionBarSubMenu.vue +1 -1
- package/src/modules/components/AppContextMenu/AppContextMenu.vue +2 -2
- package/src/modules/composables/useContextMenu/index.ts +10 -1
- package/src/modules/composables/useFocusTrap/index.d.ts +2 -0
- package/src/modules/composables/useFocusTrap/index.ts +2 -2
package/package.json
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<div
|
|
63
63
|
ref="actionBar"
|
|
64
64
|
:class="{ 'translate-y-0! max-md:mt-0!': selection.length > 0 && isOpen }"
|
|
65
|
-
class="fixed inset-x-0 top-0 z-100 flex h-14 md:-mt-1 -translate-y-24 items-center justify-between bg-secondary
|
|
65
|
+
class="app-actionbar fixed inset-x-0 top-0 z-100 flex h-14 md:-mt-1 -translate-y-24 items-center justify-between bg-secondary
|
|
66
66
|
px-4 text-white transition-[translate] ease-in-out max-md:transform-none! max-md:translate-none! max-md:-mt-10"
|
|
67
67
|
data-test-action-bar-wrapper
|
|
68
68
|
>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<div
|
|
53
53
|
ref="subMenu"
|
|
54
54
|
:class="{ '-top-full left-full': props.context }"
|
|
55
|
-
class="absolute w-fit rounded-lg bg-secondary p-2"
|
|
55
|
+
class="absolute w-fit rounded-lg bg-secondary p-2 [.app-actionbar:not(.translate-y-0\!)_&]:hidden"
|
|
56
56
|
>
|
|
57
57
|
<div
|
|
58
58
|
ref="submenuArrow"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
searchActionsQuery.value = value;
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
const actionsWithFallback = computed((): Action[] => props.actions ?? actionbar.actions.value);
|
|
33
|
+
const actionsWithFallback = computed((): Action[] => props.actions ?? contextMenu.actions.value ?? actionbar.actions.value);
|
|
34
34
|
const normalizedSearchQuery = computed((): string => searchActionsQuery.value?.toLowerCase().trim() || '');
|
|
35
35
|
const isSearching = computed((): boolean => normalizedSearchQuery.value?.length > 0);
|
|
36
36
|
const filteredActions = computed((): Action[] => {
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
v-if="isOpen && (actionsWithFallback.length > 0 || contextMenu.shortcuts.value.length > 0)"
|
|
99
99
|
ref="contextMenuElement"
|
|
100
100
|
:style="`left: ${event.x}px; top: ${event.y}px;`"
|
|
101
|
-
class="app-context-menu fixed z-
|
|
101
|
+
class="app-context-menu fixed z-100 flex w-64 flex-col rounded-lg bg-secondary p-2 drop-shadow-card empty:hidden"
|
|
102
102
|
data-test-context-menu
|
|
103
103
|
>
|
|
104
104
|
<div v-if="enableSearch && actionsWithFallback.length > 0">
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { createApp, inject, ref } from 'vue';
|
|
1
|
+
import { createApp, inject, ref, shallowRef } from 'vue';
|
|
2
2
|
import { get } from 'radash';
|
|
3
3
|
import { AppContextMenu } from '~components';
|
|
4
4
|
|
|
5
5
|
import type { App, Ref } from 'vue';
|
|
6
6
|
import type { ContextMenuInstance, Shortcut, Props } from '~components/AppContextMenu/index.d';
|
|
7
|
+
import type { Action } from '~components/AppActionBar/index.d';
|
|
7
8
|
|
|
8
9
|
export const activeRowClass = 'app-context-menu-active-row';
|
|
9
10
|
|
|
@@ -11,6 +12,7 @@ const state = {
|
|
|
11
12
|
instances: ref<ContextMenuInstance[]>([]),
|
|
12
13
|
shortcuts: ref<Shortcut[]>([]),
|
|
13
14
|
item: ref<unknown>(),
|
|
15
|
+
actions: shallowRef<Action[]>([]),
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
function closeContextMenu(contextInstance: ContextMenuInstance): void {
|
|
@@ -25,6 +27,8 @@ interface UseContextMenu<T> {
|
|
|
25
27
|
close: () => Promise<void>;
|
|
26
28
|
closeAll: () => void;
|
|
27
29
|
shortcuts: Ref<Shortcut[]>;
|
|
30
|
+
actions: Ref<Action[]>;
|
|
31
|
+
setActions: (actions: Action[]) => void;
|
|
28
32
|
instance: Ref<ContextMenuInstance | undefined>;
|
|
29
33
|
instances: Ref<ContextMenuInstance[]>;
|
|
30
34
|
}
|
|
@@ -111,6 +115,10 @@ export function useContextMenu<T>(): UseContextMenu<T> {
|
|
|
111
115
|
return Promise.resolve();
|
|
112
116
|
}
|
|
113
117
|
|
|
118
|
+
function setActions(actions: Action[]): void {
|
|
119
|
+
state.actions.value = actions;
|
|
120
|
+
}
|
|
121
|
+
|
|
114
122
|
function closeAll(): void {
|
|
115
123
|
state.instances.value.forEach(stateInstance => {
|
|
116
124
|
stateInstance?.ref.close();
|
|
@@ -131,5 +139,6 @@ export function useContextMenu<T>(): UseContextMenu<T> {
|
|
|
131
139
|
close,
|
|
132
140
|
closeAll,
|
|
133
141
|
setShortcuts,
|
|
142
|
+
setActions,
|
|
134
143
|
} as unknown as UseContextMenu<T>;
|
|
135
144
|
}
|
|
@@ -8,10 +8,10 @@ import type { Options } from './index.d';
|
|
|
8
8
|
|
|
9
9
|
export function useFocusTrap(
|
|
10
10
|
target: MaybeRefOrGetter<Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>>,
|
|
11
|
-
options: Options = {},
|
|
11
|
+
options: Options = { allowOutsideClick: true, preventScroll: false },
|
|
12
12
|
) {
|
|
13
13
|
const isActive = ref<boolean>(false);
|
|
14
|
-
const { activate: activateTrap, deactivate: deactivateTrap } = useFocusTrapVueUse(target);
|
|
14
|
+
const { activate: activateTrap, deactivate: deactivateTrap } = useFocusTrapVueUse(target, options);
|
|
15
15
|
const activeElement = useActiveElement();
|
|
16
16
|
const onEscapeCallback = ref<() => void>();
|
|
17
17
|
const onBackCallback = ref<() => void>();
|