@teammodlr/ui-kit 2.3.1 → 2.3.3
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/lib/components/cardcontextmenu/CardContextMenu.vue.d.ts +129 -0
- package/lib/components/cardcontextmenu/CardContextMenuItem.vue.d.ts +88 -0
- package/lib/components/cardcontextmenu/CardContextMenuList.vue.d.ts +5 -0
- package/lib/components/cardcontextmenu/CardContextMenuSeperator.vue.d.ts +4 -0
- package/lib/components/cardcontextmenu/CardContextMenuWrapper.vue.d.ts +2 -0
- package/lib/components/cardcontextmenu/hooks.d.ts +2 -0
- package/lib/components/cardcontextmenu/style/Dropdown.css.d.ts +9 -0
- package/lib/components/cardcontextmenu/style/index.d.ts +1 -0
- package/lib/components/cardcontextmenu/symbol.d.ts +6 -0
- package/lib/components/dialog/Dialog.vue.d.ts +1 -1
- package/lib/components/index.d.ts +4 -0
- package/lib/index.cjs.js +8 -8
- package/lib/index.es.js +4175 -3806
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/src/components/cardcontextmenu/CardContextMenu.vue +276 -0
- package/src/components/cardcontextmenu/CardContextMenuItem.vue +151 -0
- package/src/components/cardcontextmenu/CardContextMenuList.vue +20 -0
- package/src/components/cardcontextmenu/CardContextMenuSeperator.vue +23 -0
- package/src/components/cardcontextmenu/CardContextMenuWrapper.vue +18 -0
- package/src/components/cardcontextmenu/examples/basic.vue +71 -0
- package/src/components/cardcontextmenu/examples/index.stories.ts +22 -0
- package/src/components/cardcontextmenu/examples/index.ts +1 -0
- package/src/components/cardcontextmenu/hooks.ts +30 -0
- package/src/components/cardcontextmenu/style/Dropdown.css.ts +158 -0
- package/src/components/cardcontextmenu/style/index.ts +1 -0
- package/src/components/cardcontextmenu/symbol.ts +9 -0
- package/src/components/dialog/Dialog.vue +33 -47
- package/src/components/dialogprovider/DialogProvider.vue +14 -20
- package/src/components/dialogprovider/examples/basic.vue +55 -54
- package/src/components/dropdown/Dropdown.vue +2 -2
- package/src/components/dropdown/examples/context.vue +3 -1
- package/src/components/index.ts +5 -0
- package/src/styles/transitions.css.ts +98 -97
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<slot/>
|
|
2
|
+
<slot />
|
|
3
3
|
<template v-if="Object.keys(dialogMap).length > 0">
|
|
4
|
-
<template v-for="dialog in Object.values(dialogMap)">
|
|
5
|
-
<MDialog
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
v-bind="filteredOptions(dialog.options)"
|
|
9
|
-
ref="setDialogRef(dialog.key)"
|
|
10
|
-
@close="remove(dialog.key)"
|
|
11
|
-
@on-close="handleClose(dialog.key)"
|
|
12
|
-
@on-open="handleOpen(dialog.key)"
|
|
13
|
-
>
|
|
4
|
+
<template v-for="dialog in Object.values(dialogMap)" :key="dialog.key">
|
|
5
|
+
<MDialog v-model:open="dialog.options.open" v-bind="filteredOptions(dialog.options)"
|
|
6
|
+
ref="setDialogRef(dialog.key)" @close="remove(dialog.key)" @on-close="handleClose(dialog.key)"
|
|
7
|
+
@on-open="handleOpen(dialog.key)">
|
|
14
8
|
<template #default>
|
|
15
|
-
<MRenderer
|
|
16
|
-
v-if="dialog.options.render"
|
|
17
|
-
:h="dialog.options.render"
|
|
18
|
-
:props="dialog.options.props"
|
|
19
|
-
/>
|
|
9
|
+
<MRenderer v-if="dialog.options.render" :h="dialog.options.render" :props="dialog.options.props" />
|
|
20
10
|
</template>
|
|
21
11
|
</MDialog>
|
|
22
12
|
</template>
|
|
23
13
|
</template>
|
|
24
14
|
</template>
|
|
25
15
|
<script lang="ts">
|
|
26
|
-
import {defineComponent, reactive, provide, ref} from 'vue';
|
|
27
|
-
import type {DialogApiInjection, DialogOptions, DialogReactive} from './types';
|
|
16
|
+
import { defineComponent, reactive, provide, ref, nextTick } from 'vue';
|
|
17
|
+
import type { DialogApiInjection, DialogOptions, DialogReactive } from './types';
|
|
28
18
|
import MDialog from '../dialog/Dialog.vue';
|
|
29
19
|
import MRenderer from '../renderer/renderer';
|
|
30
20
|
|
|
21
|
+
|
|
31
22
|
export default defineComponent({
|
|
32
23
|
name: 'DialogProvider',
|
|
33
24
|
components: {
|
|
@@ -61,20 +52,23 @@ export default defineComponent({
|
|
|
61
52
|
const dialog: DialogReactive = {
|
|
62
53
|
key,
|
|
63
54
|
options: reactiveOptions,
|
|
64
|
-
open: () => {
|
|
55
|
+
open: async () => {
|
|
65
56
|
const dialogComponent = dialogRefs.value[key];
|
|
66
57
|
if (dialogComponent && dialogComponent.open) {
|
|
67
58
|
dialogComponent.open();
|
|
68
59
|
} else {
|
|
60
|
+
await nextTick();
|
|
69
61
|
dialog.options.open = true;
|
|
70
62
|
handleOpen(key);
|
|
71
63
|
}
|
|
72
64
|
},
|
|
73
|
-
close: () => {
|
|
65
|
+
close: async () => {
|
|
74
66
|
const dialogComponent = dialogRefs.value[key];
|
|
75
67
|
if (dialogComponent && dialogComponent.close) {
|
|
76
68
|
dialogComponent.close();
|
|
77
69
|
} else {
|
|
70
|
+
await nextTick();
|
|
71
|
+
dialog.options.open = false;
|
|
78
72
|
handleClose(key);
|
|
79
73
|
}
|
|
80
74
|
},
|
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<button @click="showDialog">Show Dialog</button>
|
|
4
|
-
<button @click="showDialog2">Show Dialog 2</button>
|
|
5
|
-
{{ testTitle }}
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script lang="ts" setup>
|
|
10
|
-
import {ref, h} from 'vue';
|
|
11
|
-
import {useDialog} from '../useDialog';
|
|
12
|
-
|
|
13
|
-
const dialog = useDialog();
|
|
14
|
-
const testTitle = ref('This is a test');
|
|
15
|
-
|
|
16
|
-
function renderMessage({message}: { message: string }) {
|
|
17
|
-
return h('p', [
|
|
18
|
-
'Here are ',
|
|
19
|
-
h('span', {style: 'color: red'}, [message]),
|
|
20
|
-
' that using render function',
|
|
21
|
-
]);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function showDialog() {
|
|
25
|
-
dialog.create('hello', {
|
|
26
|
-
title: testTitle,
|
|
27
|
-
render: renderMessage,
|
|
28
|
-
props: {message: testTitle},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<button @click="showDialog">Show Dialog</button>
|
|
4
|
+
<button @click="showDialog2">Show Dialog 2</button>
|
|
5
|
+
{{ testTitle }}
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import {ref, h} from 'vue';
|
|
11
|
+
import {useDialog} from '../useDialog';
|
|
12
|
+
|
|
13
|
+
const dialog = useDialog();
|
|
14
|
+
const testTitle = ref('This is a test');
|
|
15
|
+
|
|
16
|
+
function renderMessage({message}: { message: string }) {
|
|
17
|
+
return h('p', [
|
|
18
|
+
'Here are ',
|
|
19
|
+
h('span', {style: 'color: red'}, [message]),
|
|
20
|
+
' that using render function',
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function showDialog() {
|
|
25
|
+
const dlg = dialog.create('hello', {
|
|
26
|
+
title: testTitle,
|
|
27
|
+
render: renderMessage,
|
|
28
|
+
props: {message: testTitle},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
dlg.open();
|
|
32
|
+
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
testTitle.value = 'changed';
|
|
35
|
+
}, 4000);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function showDialog2() {
|
|
39
|
+
dialog.create('hello-two', {
|
|
40
|
+
title: "Hello Second Dialog",
|
|
41
|
+
render: renderMessage,
|
|
42
|
+
props: {message: testTitle},
|
|
43
|
+
open: true,
|
|
44
|
+
modal: false,
|
|
45
|
+
draggable: false,
|
|
46
|
+
onOpen: () => {
|
|
47
|
+
console.log('hello world')
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
testTitle.value = 'changed again';
|
|
53
|
+
}, 4000);
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ContextMenuRoot v-if="contextMenu">
|
|
2
|
+
<ContextMenuRoot v-model:open="isOpen" v-if="contextMenu" v-bind="$attrs">
|
|
3
3
|
<ContextMenuTrigger as-child>
|
|
4
4
|
<slot />
|
|
5
5
|
</ContextMenuTrigger>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</ContextMenuContent>
|
|
10
10
|
</ContextMenuPortal>
|
|
11
11
|
</ContextMenuRoot>
|
|
12
|
-
<DropdownMenuRoot v-model:open="isOpen" v-else :modal="modal">
|
|
12
|
+
<DropdownMenuRoot v-model:open="isOpen" v-else :modal="modal" v-bind="$attrs">
|
|
13
13
|
<DropdownMenuTrigger as-child>
|
|
14
14
|
<slot />
|
|
15
15
|
</DropdownMenuTrigger>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
<MDropdown
|
|
5
|
+
<MDropdown v-model:open="isOpen" :style="{ top: `199px`, left: `9px` }">
|
|
6
6
|
<div style="background: #eee; width: 500px; height: 500px;">
|
|
7
7
|
</div>
|
|
8
8
|
<template #menu>
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
48
|
<script lang="ts" setup>
|
|
49
|
+
import { ref } from 'vue';
|
|
50
|
+
const isOpen = ref(true);
|
|
49
51
|
const handleClick = () => {
|
|
50
52
|
alert('hi');
|
|
51
53
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -19,6 +19,11 @@ export { default as MDropdownHeading } from './dropdown/DropdownHeading.vue';
|
|
|
19
19
|
export { default as MDropdownSeperator } from './dropdown/DropdownSeperator.vue';
|
|
20
20
|
|
|
21
21
|
// export { DropdownMenuSub as MDropdownMenuSub, DropdownMenuSubTrigger as MDropdownMenuSubTrigger, DropdownMenuSubContent as MDropdownMenuSubContent } from 'radix-vue';
|
|
22
|
+
|
|
23
|
+
export { default as MCardContextMenu } from './cardcontextmenu/CardContextMenu.vue';
|
|
24
|
+
export { default as MCardContextMenuItem } from './cardcontextmenu/CardContextMenuItem.vue';
|
|
25
|
+
export { default as MCardContextMenuList } from './cardcontextmenu/CardContextMenuList.vue';
|
|
26
|
+
export { default as MCardContextMenuSeperator } from './cardcontextmenu/CardContextMenuSeperator.vue';
|
|
22
27
|
export { default as MForm } from './form/Form.vue';
|
|
23
28
|
export { default as MImage } from './image/Image.vue';
|
|
24
29
|
export { default as MInput } from './input/Input.vue';
|
|
@@ -1,97 +1,98 @@
|
|
|
1
|
-
import { style, globalKeyframes } from '@vanilla-extract/css';
|
|
2
|
-
import { themeVars } from './theme.css';
|
|
3
|
-
|
|
4
|
-
const FADE_NAME = 'fade';
|
|
5
|
-
const FADE_DURATION = 0.2;
|
|
6
|
-
globalKeyframes(FADE_NAME, {
|
|
7
|
-
from: {
|
|
8
|
-
opacity: 0
|
|
9
|
-
},
|
|
10
|
-
to: {
|
|
11
|
-
opacity: 1
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const fade = {
|
|
16
|
-
enterActive: style({
|
|
17
|
-
animation: `${FADE_DURATION}s ${FADE_NAME} ${themeVars.transition.default}`
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
leaveActive: style({
|
|
21
|
-
animation: `${FADE_DURATION}s ${FADE_NAME} ${themeVars.transition.default} reverse`
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
enterFrom: style({
|
|
25
|
-
opacity: 0
|
|
26
|
-
}),
|
|
27
|
-
|
|
28
|
-
leaveTo: style({
|
|
29
|
-
opacity: 0
|
|
30
|
-
})
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const SCALE_NAME = 'scale';
|
|
34
|
-
const SCALE_DURATION = 0.12;
|
|
35
|
-
globalKeyframes(SCALE_NAME, {
|
|
36
|
-
'0%': {
|
|
37
|
-
opacity: 0,
|
|
38
|
-
scale: 0.95
|
|
39
|
-
},
|
|
40
|
-
'100%': {
|
|
41
|
-
opacity: 1,
|
|
42
|
-
scale: 1
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export const scale = {
|
|
47
|
-
enterActive: style({
|
|
48
|
-
animation: `${SCALE_DURATION}s ${SCALE_NAME} ${themeVars.transition.default}`
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
leaveActive: style({
|
|
52
|
-
animation: `${SCALE_DURATION}s ${SCALE_NAME} ${themeVars.transition.default} reverse`
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
enterFrom: style({
|
|
56
|
-
opacity: 0
|
|
57
|
-
}),
|
|
58
|
-
|
|
59
|
-
leaveTo: style({
|
|
60
|
-
opacity: 0
|
|
61
|
-
})
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const MODAL_NAME = 'modal';
|
|
65
|
-
const MODAL_DURATION = 0.5;
|
|
66
|
-
globalKeyframes(MODAL_NAME, {
|
|
67
|
-
'0%': {
|
|
68
|
-
opacity: 0,
|
|
69
|
-
scale: 0.95,
|
|
70
|
-
// offset bottom
|
|
71
|
-
transformOrigin: 'bottom',
|
|
72
|
-
transform: `translateY(10%)`
|
|
73
|
-
},
|
|
74
|
-
'100%': {
|
|
75
|
-
opacity: 1,
|
|
76
|
-
scale: 1,
|
|
77
|
-
transform: `translateY(0%)`
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
export const modalScale = {
|
|
82
|
-
enterActive: style({
|
|
83
|
-
animation: `${MODAL_DURATION}s ${MODAL_NAME} ${themeVars.transition.default}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
1
|
+
import { style, globalKeyframes } from '@vanilla-extract/css';
|
|
2
|
+
import { themeVars } from './theme.css';
|
|
3
|
+
|
|
4
|
+
const FADE_NAME = 'fade';
|
|
5
|
+
const FADE_DURATION = 0.2;
|
|
6
|
+
globalKeyframes(FADE_NAME, {
|
|
7
|
+
from: {
|
|
8
|
+
opacity: 0
|
|
9
|
+
},
|
|
10
|
+
to: {
|
|
11
|
+
opacity: 1
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const fade = {
|
|
16
|
+
enterActive: style({
|
|
17
|
+
animation: `${FADE_DURATION}s ${FADE_NAME} ${themeVars.transition.default}`
|
|
18
|
+
}),
|
|
19
|
+
|
|
20
|
+
leaveActive: style({
|
|
21
|
+
animation: `${FADE_DURATION}s ${FADE_NAME} ${themeVars.transition.default} reverse`
|
|
22
|
+
}),
|
|
23
|
+
|
|
24
|
+
enterFrom: style({
|
|
25
|
+
opacity: 0
|
|
26
|
+
}),
|
|
27
|
+
|
|
28
|
+
leaveTo: style({
|
|
29
|
+
opacity: 0
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const SCALE_NAME = 'scale';
|
|
34
|
+
const SCALE_DURATION = 0.12;
|
|
35
|
+
globalKeyframes(SCALE_NAME, {
|
|
36
|
+
'0%': {
|
|
37
|
+
opacity: 0,
|
|
38
|
+
scale: 0.95
|
|
39
|
+
},
|
|
40
|
+
'100%': {
|
|
41
|
+
opacity: 1,
|
|
42
|
+
scale: 1
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const scale = {
|
|
47
|
+
enterActive: style({
|
|
48
|
+
animation: `${SCALE_DURATION}s ${SCALE_NAME} ${themeVars.transition.default}`
|
|
49
|
+
}),
|
|
50
|
+
|
|
51
|
+
leaveActive: style({
|
|
52
|
+
animation: `${SCALE_DURATION}s ${SCALE_NAME} ${themeVars.transition.default} reverse`
|
|
53
|
+
}),
|
|
54
|
+
|
|
55
|
+
enterFrom: style({
|
|
56
|
+
opacity: 0
|
|
57
|
+
}),
|
|
58
|
+
|
|
59
|
+
leaveTo: style({
|
|
60
|
+
opacity: 0
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const MODAL_NAME = 'modal';
|
|
65
|
+
const MODAL_DURATION = 0.5;
|
|
66
|
+
globalKeyframes(MODAL_NAME, {
|
|
67
|
+
'0%': {
|
|
68
|
+
opacity: 0,
|
|
69
|
+
scale: 0.95,
|
|
70
|
+
// offset bottom
|
|
71
|
+
transformOrigin: 'bottom',
|
|
72
|
+
transform: `translateY(10%)`
|
|
73
|
+
},
|
|
74
|
+
'100%': {
|
|
75
|
+
opacity: 1,
|
|
76
|
+
scale: 1,
|
|
77
|
+
transform: `translateY(0%)`
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const modalScale = {
|
|
82
|
+
enterActive: style({
|
|
83
|
+
animation: `${MODAL_DURATION}s ${MODAL_NAME} ${themeVars.transition.default}`,
|
|
84
|
+
willChange: 'transform, opacity'
|
|
85
|
+
}),
|
|
86
|
+
|
|
87
|
+
leaveActive: style({
|
|
88
|
+
animation: `${MODAL_DURATION}s ${MODAL_NAME} ${themeVars.transition.default} reverse`
|
|
89
|
+
}),
|
|
90
|
+
|
|
91
|
+
enterFrom: style({
|
|
92
|
+
opacity: 0
|
|
93
|
+
}),
|
|
94
|
+
|
|
95
|
+
leaveTo: style({
|
|
96
|
+
opacity: 0
|
|
97
|
+
})
|
|
98
|
+
};
|