@teammodlr/ui-kit 2.3.23 → 3.0.0-beta.4
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/avatar/Avatar.vue.d.ts +2 -2
- package/lib/components/badge/style/Badge.css.d.ts +2 -2
- package/lib/components/button/Button.vue.d.ts +7 -4
- package/lib/components/button/style/Button.css.d.ts +3 -3
- package/lib/components/cardcontextmenu/CardContextMenu.vue.d.ts +5 -8
- package/lib/components/cardcontextmenu/CardContextMenuItem.vue.d.ts +11 -2
- package/lib/components/cardcontextmenu/CardContextMenuTriggerProvider.vue.d.ts +2 -0
- package/lib/components/cardcontextmenu/style/Dropdown.css.d.ts +2 -1
- package/lib/components/cardcontextmenu/symbol.d.ts +1 -0
- package/lib/components/checkbox/Checkbox.vue.d.ts +15 -4
- package/lib/components/collapse/CollapseItem.vue.d.ts +3 -2
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +8 -9
- package/lib/components/confirm/Confirm.vue.d.ts +9 -0
- package/lib/components/confirm/props.d.ts +4 -0
- package/lib/components/dialog/Dialog.vue.d.ts +13 -5
- package/lib/components/dialogprovider/DialogProvider.vue.d.ts +1 -0
- package/lib/components/dialogprovider/types.d.ts +1 -0
- package/lib/components/dropdown/Dropdown.vue.d.ts +3 -1
- package/lib/components/dropdown/DropdownItem.vue.d.ts +11 -1
- package/lib/components/dropdown/DropdownSeperator.vue.d.ts +1 -0
- package/lib/components/dropdown/DropdownTriggerProvider.vue.d.ts +2 -0
- package/lib/components/dropdown/style/Dropdown.css.d.ts +2 -1
- package/lib/components/dropdown/symbol.d.ts +2 -0
- package/lib/components/image/Image.vue.d.ts +1 -1
- package/lib/components/messageprovider/Message.vue.d.ts +1 -1
- package/lib/components/messageprovider/MessageProvider.vue.d.ts +22 -24
- package/lib/components/messageprovider/style/Message.css.d.ts +1 -1
- package/lib/components/messageprovider/types.d.ts +5 -0
- package/lib/components/modal/Modal.vue.d.ts +18 -6
- package/lib/components/radio/Radio.vue.d.ts +2 -0
- package/lib/components/radiobuttongroup/RadioButtonGroup.vue.d.ts +1 -0
- package/lib/components/select/Select.vue.d.ts +20 -11
- package/lib/components/switch/Switch.vue.d.ts +2 -0
- package/lib/components/tab/Tab.vue.d.ts +5 -2
- package/lib/components/tab/TabGroup.vue.d.ts +8 -3
- package/lib/components/textarea/Textarea.vue.d.ts +2 -1
- package/lib/components/tooltip/Tooltip.vue.d.ts +5 -20
- package/lib/components/tooltip/TooltipTrigger.vue.d.ts +1 -10
- package/lib/components/tree/Tree.vue.d.ts +3 -3
- package/lib/components/tree/TreeNode.vue.d.ts +26 -12
- package/lib/components/tree/types.d.ts +5 -5
- package/lib/index.cjs.js +5 -14
- package/lib/index.es.js +15444 -10914
- package/lib/style.css +1 -1
- package/package.json +12 -6
- package/src/components/avatar/Avatar.vue +32 -24
- package/src/components/button/Button.vue +24 -5
- package/src/components/cardcontextmenu/CardContextMenu.vue +68 -95
- package/src/components/cardcontextmenu/CardContextMenuItem.vue +40 -50
- package/src/components/cardcontextmenu/CardContextMenuSeperator.vue +9 -7
- package/src/components/cardcontextmenu/CardContextMenuTriggerProvider.vue +15 -0
- package/src/components/cardcontextmenu/style/Dropdown.css.ts +155 -2
- package/src/components/cardcontextmenu/symbol.ts +3 -0
- package/src/components/checkbox/Checkbox.vue +37 -12
- package/src/components/checkbox/style/Checkbox.css.ts +6 -6
- package/src/components/collapse/CollapseItem.vue +46 -21
- package/src/components/collapse/style/Collapse.css.ts +5 -1
- package/src/components/colorpicker/ColorPicker.vue +76 -45
- package/src/components/confirm/Confirm.vue +15 -8
- package/src/components/confirm/props.ts +4 -0
- package/src/components/dialog/Dialog.vue +183 -37
- package/src/components/dialog/style/Dialog.css.ts +15 -1
- package/src/components/dialogprovider/types.ts +1 -0
- package/src/components/dropdown/Dropdown.vue +46 -3
- package/src/components/dropdown/DropdownItem.vue +55 -25
- package/src/components/dropdown/DropdownSeperator.vue +19 -11
- package/src/components/dropdown/DropdownTriggerProvider.vue +15 -0
- package/src/components/dropdown/examples/context.vue +2 -2
- package/src/components/dropdown/style/Dropdown.css.ts +157 -4
- package/src/components/dropdown/symbol.ts +4 -0
- package/src/components/form/examples/basic.vue +19 -8
- package/src/components/messageprovider/MessageProvider.vue +136 -90
- package/src/components/messageprovider/examples/basic.vue +3 -1
- package/src/components/messageprovider/examples/index.stories.ts +37 -1
- package/src/components/messageprovider/types.ts +10 -0
- package/src/components/modal/Modal.vue +142 -67
- package/src/components/modal/style/Modal.css.ts +26 -2
- package/src/components/radio/Radio.vue +31 -17
- package/src/components/radiobutton/RadioButton.vue +15 -2
- package/src/components/radiobuttongroup/RadioButtonGroup.vue +11 -4
- package/src/components/select/Select.vue +301 -153
- package/src/components/select/examples/basic.vue +1 -1
- package/src/components/slider/Slider.vue +1 -1
- package/src/components/switch/Switch.vue +30 -10
- package/src/components/switch/style/Switch.css.ts +3 -5
- package/src/components/tab/Tab.vue +29 -20
- package/src/components/tab/TabGroup.vue +29 -38
- package/src/components/textarea/Textarea.vue +8 -4
- package/src/components/tooltip/Tooltip.vue +52 -141
- package/src/components/tooltip/TooltipTrigger.vue +14 -17
- package/src/components/tooltip/style/Tooltip.css.ts +148 -29
- package/src/components/tree/Tree.vue +138 -100
- package/src/components/tree/TreeNode.vue +105 -98
- package/src/components/tree/types.ts +4 -4
- package/src/styles/transitions.css.ts +36 -16
|
@@ -1,35 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
ref="referenceRef"
|
|
5
|
-
:class="computedReferenceClasses"
|
|
6
|
-
@click="toggleDropdown">
|
|
2
|
+
<DropdownMenuSub v-if="isNested" v-model:open="isOpen">
|
|
3
|
+
<CardContextMenuTriggerProvider>
|
|
7
4
|
<slot />
|
|
8
|
-
</
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
</CardContextMenuTriggerProvider>
|
|
6
|
+
<DropdownMenuPortal>
|
|
7
|
+
<DropdownMenuSubContent
|
|
8
|
+
:class="menuClasses"
|
|
9
|
+
align="start"
|
|
10
|
+
side="right"
|
|
11
|
+
:side-offset="2"
|
|
12
|
+
:align-offset="-6"
|
|
13
|
+
:style="{ zIndex, maxHeight }"
|
|
14
|
+
>
|
|
15
|
+
<slot name="menu" />
|
|
16
|
+
</DropdownMenuSubContent>
|
|
17
|
+
</DropdownMenuPortal>
|
|
18
|
+
</DropdownMenuSub>
|
|
19
|
+
<DropdownMenuRoot v-else :open="isOpen" @update:open="handleOpenChange">
|
|
20
|
+
<DropdownMenuTrigger v-if="$slots.default && !virtual" as-child>
|
|
21
|
+
<span ref="referenceRef" :class="computedReferenceClasses">
|
|
22
|
+
<slot />
|
|
23
|
+
</span>
|
|
24
|
+
</DropdownMenuTrigger>
|
|
25
|
+
<DropdownMenuPortal>
|
|
26
|
+
<DropdownMenuContent
|
|
27
|
+
v-if="isOpen"
|
|
28
|
+
:reference="reference"
|
|
29
|
+
:class="menuClasses"
|
|
30
|
+
:style="{ zIndex, maxHeight }"
|
|
31
|
+
:side-offset="14"
|
|
32
|
+
@close-auto-focus.prevent
|
|
33
|
+
>
|
|
34
|
+
<slot name="menu" />
|
|
35
|
+
</DropdownMenuContent>
|
|
36
|
+
</DropdownMenuPortal>
|
|
37
|
+
</DropdownMenuRoot>
|
|
28
38
|
</template>
|
|
29
39
|
|
|
30
40
|
<script lang="ts">
|
|
31
|
-
import { usePopper } from '../../composables/usePopper';
|
|
32
41
|
import type { Placement, VirtualElement } from '@popperjs/core';
|
|
42
|
+
import {
|
|
43
|
+
DropdownMenuContent,
|
|
44
|
+
DropdownMenuPortal,
|
|
45
|
+
DropdownMenuRoot,
|
|
46
|
+
DropdownMenuSub,
|
|
47
|
+
DropdownMenuSubContent,
|
|
48
|
+
DropdownMenuTrigger,
|
|
49
|
+
} from 'reka-ui';
|
|
33
50
|
import { scale } from '../../styles/transitions.css';
|
|
34
51
|
import {
|
|
35
52
|
defineComponent,
|
|
@@ -39,23 +56,28 @@ import {
|
|
|
39
56
|
provide,
|
|
40
57
|
watch,
|
|
41
58
|
onMounted,
|
|
42
|
-
nextTick,
|
|
43
59
|
computed,
|
|
44
60
|
toRef,
|
|
45
61
|
reactive,
|
|
46
62
|
watchEffect
|
|
47
63
|
} from 'vue';
|
|
48
|
-
import {
|
|
49
|
-
import { useLabel } from './hooks';
|
|
64
|
+
import { useEventListener } from '@vueuse/core';
|
|
50
65
|
import { useZIndex } from '../../composables/useZIndex';
|
|
51
66
|
import type { CardContextMenuState } from './symbol';
|
|
52
67
|
import { CARDCONTEXTMENU_STATE } from './symbol';
|
|
53
68
|
import * as style from './style';
|
|
54
|
-
import
|
|
69
|
+
import CardContextMenuTriggerProvider from './CardContextMenuTriggerProvider.vue';
|
|
70
|
+
|
|
55
71
|
export default defineComponent({
|
|
56
72
|
name: 'CardContextMenu',
|
|
57
73
|
components: {
|
|
58
|
-
|
|
74
|
+
CardContextMenuTriggerProvider,
|
|
75
|
+
DropdownMenuContent,
|
|
76
|
+
DropdownMenuPortal,
|
|
77
|
+
DropdownMenuRoot,
|
|
78
|
+
DropdownMenuSub,
|
|
79
|
+
DropdownMenuSubContent,
|
|
80
|
+
DropdownMenuTrigger,
|
|
59
81
|
},
|
|
60
82
|
props: {
|
|
61
83
|
open: {
|
|
@@ -109,10 +131,7 @@ export default defineComponent({
|
|
|
109
131
|
const isNested = !!parentState;
|
|
110
132
|
const label = toRef(props, 'label');
|
|
111
133
|
const isOpen = ref(props.open);
|
|
112
|
-
const
|
|
113
|
-
const transfer = toRef(props, 'transfer');
|
|
114
|
-
const wrapper = ref(null);
|
|
115
|
-
const referenceRef = ref(null);
|
|
134
|
+
const referenceRef = ref<HTMLElement | null>(null);
|
|
116
135
|
const zIndex = ref(props.zIndex ?? nextZIndex());
|
|
117
136
|
const reference = computed(() => {
|
|
118
137
|
if (props.virtual !== null) {
|
|
@@ -137,81 +156,39 @@ export default defineComponent({
|
|
|
137
156
|
}
|
|
138
157
|
return referenceRef.value;
|
|
139
158
|
});
|
|
140
|
-
const { popper, transferTo, updatePopper } = usePopper({
|
|
141
|
-
reference: reference,
|
|
142
|
-
placement,
|
|
143
|
-
transfer,
|
|
144
|
-
wrapper,
|
|
145
|
-
isDrop: true,
|
|
146
|
-
offset: isNested ? [-2, 2] : [0, 14]
|
|
147
|
-
});
|
|
148
|
-
const currentLabel = useLabel(label, referenceRef);
|
|
149
159
|
provide('dropdown-select', null);
|
|
150
160
|
const startState: CardContextMenuState = reactive({
|
|
151
161
|
handleSelect: handleSelect,
|
|
152
|
-
isOpen: isOpen
|
|
162
|
+
isOpen: isOpen.value
|
|
153
163
|
});
|
|
154
164
|
provide(CARDCONTEXTMENU_STATE, startState);
|
|
165
|
+
|
|
155
166
|
watch(
|
|
156
167
|
() => props.open,
|
|
157
168
|
value => {
|
|
158
169
|
isOpen.value = value;
|
|
159
170
|
}
|
|
160
171
|
);
|
|
161
|
-
|
|
162
|
-
() => props.placement,
|
|
163
|
-
value => {
|
|
164
|
-
setPlacement(value);
|
|
165
|
-
}
|
|
166
|
-
);
|
|
172
|
+
|
|
167
173
|
watch(isOpen, value => {
|
|
168
174
|
if (value) {
|
|
169
|
-
|
|
175
|
+
zIndex.value = props.zIndex ?? nextZIndex();
|
|
170
176
|
}
|
|
171
177
|
emit('update:open', value);
|
|
172
178
|
});
|
|
173
|
-
|
|
174
|
-
nextTick(() => {
|
|
175
|
-
setPlacement(props.placement);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
useEventListener('resize', () => {
|
|
179
|
-
updatePopper();
|
|
180
|
-
});
|
|
181
|
-
onClickOutside(wrapper, e => {
|
|
182
|
-
let parent = e.target as HTMLElement;
|
|
183
|
-
let i = 0;
|
|
184
|
-
while (parent) {
|
|
185
|
-
if (parent.classList.contains('m-dropdown-menu')) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
parent = parent.parentElement as HTMLElement;
|
|
189
|
-
if (i > 10) {
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
i++;
|
|
193
|
-
}
|
|
194
|
-
isOpen.value = false;
|
|
195
|
-
});
|
|
196
|
-
function setPlacement(value: Placement) {
|
|
197
|
-
const [xPlacement] = value.split('-');
|
|
198
|
-
if (isNested && xPlacement !== 'right' && xPlacement !== 'left') {
|
|
199
|
-
placement.value = 'right-start';
|
|
200
|
-
} else {
|
|
201
|
-
placement.value = value;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function toggleDropdown() {
|
|
205
|
-
isOpen.value = !isOpen.value;
|
|
206
|
-
}
|
|
179
|
+
|
|
207
180
|
function handleSelect(labels: string[]) {
|
|
208
181
|
isOpen.value = false;
|
|
209
182
|
props.onSelect(labels);
|
|
210
183
|
if (typeof parentState?.handleSelect === 'function') {
|
|
211
|
-
|
|
212
|
-
parentState.handleSelect([currentLabel.value!, ...labels]);
|
|
184
|
+
parentState.handleSelect(labels);
|
|
213
185
|
}
|
|
214
186
|
}
|
|
187
|
+
|
|
188
|
+
function handleOpenChange(value: boolean) {
|
|
189
|
+
isOpen.value = value;
|
|
190
|
+
}
|
|
191
|
+
|
|
215
192
|
const computedWrapperClasses = computed(() => {
|
|
216
193
|
return [
|
|
217
194
|
'm-dropdown',
|
|
@@ -221,7 +198,7 @@ export default defineComponent({
|
|
|
221
198
|
}
|
|
222
199
|
];
|
|
223
200
|
});
|
|
224
|
-
const computedReferenceClasses = computed(() =>
|
|
201
|
+
const computedReferenceClasses = computed(() => undefined);
|
|
225
202
|
const menuClasses = computed(() => {
|
|
226
203
|
return ['m-dropdown-menu', style.menu];
|
|
227
204
|
});
|
|
@@ -232,7 +209,6 @@ export default defineComponent({
|
|
|
232
209
|
useEventListener(window, 'resize', () => {
|
|
233
210
|
if (isOpen.value) {
|
|
234
211
|
resize();
|
|
235
|
-
updatePopper();
|
|
236
212
|
}
|
|
237
213
|
});
|
|
238
214
|
watchEffect(() => {
|
|
@@ -255,18 +231,15 @@ export default defineComponent({
|
|
|
255
231
|
}px`;
|
|
256
232
|
}
|
|
257
233
|
return {
|
|
258
|
-
wrapper,
|
|
259
234
|
referenceRef,
|
|
260
|
-
|
|
261
|
-
transferTo,
|
|
235
|
+
reference,
|
|
262
236
|
isOpen,
|
|
263
237
|
isNested,
|
|
264
|
-
|
|
238
|
+
handleOpenChange,
|
|
265
239
|
menuClasses,
|
|
266
240
|
computedWrapperClasses,
|
|
267
241
|
computedReferenceClasses,
|
|
268
242
|
transitionName,
|
|
269
|
-
toggleDropdown,
|
|
270
243
|
zIndex,
|
|
271
244
|
scale,
|
|
272
245
|
maxHeight
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
|
-
:is="
|
|
4
|
-
:href="href"
|
|
3
|
+
:is="itemComponent"
|
|
5
4
|
ref="wrapper"
|
|
6
5
|
:class="computedWrapperClasses"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@
|
|
10
|
-
v-bind="$attrs">
|
|
6
|
+
:disabled="disabled"
|
|
7
|
+
v-bind="componentProps"
|
|
8
|
+
@select="!isSubmenuTrigger ? handleSelect : undefined">
|
|
11
9
|
<div v-if="hasIconLeft" :class="style.menuItemIcon">
|
|
12
10
|
<slot name="icon-left" />
|
|
13
11
|
</div>
|
|
14
12
|
<div :class="style.menuItemTextContainer">
|
|
15
13
|
<span :class="style.menuItemText"><slot /></span>
|
|
16
14
|
</div>
|
|
17
|
-
|
|
18
|
-
<template v-for="key in hotkey.split('+')">
|
|
19
|
-
<kbd>{{ key }}</kbd>
|
|
20
|
-
</template>
|
|
21
|
-
</div> -->
|
|
22
|
-
<div v-if="hasIconRight" :class="style.menuItemIcon">
|
|
15
|
+
<div v-if="hasIconRight" :class="style.menuItemIconRight">
|
|
23
16
|
<slot name="icon-right" />
|
|
24
17
|
</div>
|
|
25
18
|
</component>
|
|
@@ -31,15 +24,19 @@ import {
|
|
|
31
24
|
defineComponent,
|
|
32
25
|
inject,
|
|
33
26
|
type PropType,
|
|
34
|
-
ref
|
|
35
|
-
toRef
|
|
27
|
+
ref
|
|
36
28
|
} from 'vue';
|
|
37
|
-
import {
|
|
29
|
+
import { DropdownMenuItem, DropdownMenuSubTrigger } from 'reka-ui';
|
|
38
30
|
import * as style from './style';
|
|
39
31
|
import type { Variant } from '../../types/props';
|
|
32
|
+
import { CARDCONTEXTMENU_STATE, CARDCONTEXTMENU_TRIGGER_STATE } from './symbol';
|
|
40
33
|
|
|
41
34
|
export default defineComponent({
|
|
42
35
|
name: 'CardContextMenuItem',
|
|
36
|
+
components: {
|
|
37
|
+
DropdownMenuItem,
|
|
38
|
+
DropdownMenuSubTrigger
|
|
39
|
+
},
|
|
43
40
|
props: {
|
|
44
41
|
label: {
|
|
45
42
|
type: [String, Number],
|
|
@@ -76,69 +73,62 @@ export default defineComponent({
|
|
|
76
73
|
},
|
|
77
74
|
emits: [],
|
|
78
75
|
setup(props, { slots }) {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
// const keys = useMagicKeys({
|
|
82
|
-
// passive: false,
|
|
83
|
-
// onEventFired: (event) => {
|
|
84
|
-
|
|
85
|
-
// // only fire when the dropdown is open
|
|
86
|
-
// if (state?.isOpen.value) {
|
|
87
|
-
// event.preventDefault();
|
|
88
|
-
// }
|
|
89
|
-
// }
|
|
90
|
-
// });
|
|
76
|
+
const state = inject(CARDCONTEXTMENU_STATE, null);
|
|
77
|
+
const isSubmenuTrigger = inject(CARDCONTEXTMENU_TRIGGER_STATE, false);
|
|
91
78
|
|
|
92
79
|
const hasIconLeft = computed(() => !!slots['icon-left']);
|
|
93
80
|
const hasIconRight = computed(() => !!slots['icon-right']);
|
|
94
81
|
|
|
95
|
-
const wrapper = ref(null);
|
|
96
|
-
const label = toRef(props, 'label');
|
|
82
|
+
const wrapper = ref<HTMLElement | null>(null);
|
|
97
83
|
const isReference = ref(props.reference);
|
|
98
|
-
const currentLabel =
|
|
84
|
+
const currentLabel = computed(() => {
|
|
85
|
+
return props.label ?? wrapper.value?.textContent?.trim() ?? '';
|
|
86
|
+
});
|
|
87
|
+
|
|
99
88
|
function handleSelect() {
|
|
100
|
-
if (props.disabled || isReference.value) {
|
|
89
|
+
if (props.disabled || isReference.value || isSubmenuTrigger) {
|
|
101
90
|
return;
|
|
102
91
|
}
|
|
103
92
|
|
|
104
|
-
if (typeof
|
|
105
|
-
|
|
106
|
-
parentSelect([currentLabel.value!]);
|
|
93
|
+
if (typeof state?.handleSelect === 'function') {
|
|
94
|
+
state.handleSelect([String(currentLabel.value)]);
|
|
107
95
|
}
|
|
108
96
|
|
|
109
|
-
props.onSelect(currentLabel.value
|
|
97
|
+
props.onSelect(currentLabel.value as string | number);
|
|
110
98
|
}
|
|
111
99
|
|
|
112
|
-
// const isOpen = computed(() => {
|
|
113
|
-
// return state?.isOpen.value;
|
|
114
|
-
// });
|
|
115
|
-
|
|
116
100
|
const computedWrapperClasses = computed(() => {
|
|
117
101
|
return [style.menuItem, style.variant[props.variant]];
|
|
118
102
|
});
|
|
119
103
|
|
|
104
|
+
const itemComponent = computed(() => {
|
|
105
|
+
return isSubmenuTrigger ? DropdownMenuSubTrigger : DropdownMenuItem;
|
|
106
|
+
});
|
|
107
|
+
|
|
120
108
|
const computedType = computed(() => {
|
|
121
109
|
if (props.href) {
|
|
122
110
|
return 'a';
|
|
123
111
|
}
|
|
124
112
|
|
|
125
|
-
return '
|
|
113
|
+
return 'div';
|
|
126
114
|
});
|
|
127
115
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
116
|
+
const componentProps = computed(() => {
|
|
117
|
+
if (isSubmenuTrigger) {
|
|
118
|
+
return {};
|
|
119
|
+
}
|
|
131
120
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
// }
|
|
138
|
-
// })
|
|
121
|
+
return {
|
|
122
|
+
as: computedType.value,
|
|
123
|
+
href: props.href
|
|
124
|
+
};
|
|
125
|
+
});
|
|
139
126
|
|
|
140
127
|
return {
|
|
141
128
|
wrapper,
|
|
129
|
+
itemComponent,
|
|
130
|
+
componentProps,
|
|
131
|
+
isSubmenuTrigger,
|
|
142
132
|
hasIconLeft,
|
|
143
133
|
hasIconRight,
|
|
144
134
|
handleSelect,
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<DropdownMenuSeparator :class="computedClasses" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
|
-
import {computed, defineComponent} from
|
|
7
|
-
import
|
|
6
|
+
import { computed, defineComponent } from 'vue';
|
|
7
|
+
import { DropdownMenuSeparator } from 'reka-ui';
|
|
8
|
+
import * as style from './style';
|
|
8
9
|
|
|
9
10
|
export default defineComponent({
|
|
10
|
-
name:
|
|
11
|
+
name: 'CardContextMenuSeperator',
|
|
12
|
+
components: {
|
|
13
|
+
DropdownMenuSeparator
|
|
14
|
+
},
|
|
11
15
|
setup() {
|
|
12
16
|
const computedClasses = computed(() => {
|
|
13
|
-
return [
|
|
14
|
-
style.menuSeperator
|
|
15
|
-
]
|
|
17
|
+
return [style.menuSeperator]
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
return {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<slot />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import { defineComponent, provide } from 'vue';
|
|
7
|
+
import { CARDCONTEXTMENU_TRIGGER_STATE } from './symbol';
|
|
8
|
+
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: 'CardContextMenuTriggerProvider',
|
|
11
|
+
setup() {
|
|
12
|
+
provide(CARDCONTEXTMENU_TRIGGER_STATE, true);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
@@ -1,6 +1,112 @@
|
|
|
1
|
-
import { createVar, style, styleVariants } from '@vanilla-extract/css';
|
|
1
|
+
import { createVar, globalKeyframes, style, styleVariants } from '@vanilla-extract/css';
|
|
2
2
|
import { themeVars } from '../../../styles/theme.css';
|
|
3
3
|
|
|
4
|
+
const menuFadeOutAnimation = 'card-context-menu-fade-out';
|
|
5
|
+
globalKeyframes(menuFadeOutAnimation, {
|
|
6
|
+
from: {
|
|
7
|
+
opacity: 1
|
|
8
|
+
},
|
|
9
|
+
to: {
|
|
10
|
+
opacity: 0
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const menuSlideFadeOutTopAnimation = 'card-context-menu-slide-fade-out-top';
|
|
15
|
+
globalKeyframes(menuSlideFadeOutTopAnimation, {
|
|
16
|
+
from: {
|
|
17
|
+
opacity: 1,
|
|
18
|
+
transform: 'translateY(0) scale(1)'
|
|
19
|
+
},
|
|
20
|
+
to: {
|
|
21
|
+
opacity: 0,
|
|
22
|
+
transform: 'translateY(6px) scale(0.98)'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const menuSlideFadeOutBottomAnimation = 'card-context-menu-slide-fade-out-bottom';
|
|
27
|
+
globalKeyframes(menuSlideFadeOutBottomAnimation, {
|
|
28
|
+
from: {
|
|
29
|
+
opacity: 1,
|
|
30
|
+
transform: 'translateY(0) scale(1)'
|
|
31
|
+
},
|
|
32
|
+
to: {
|
|
33
|
+
opacity: 0,
|
|
34
|
+
transform: 'translateY(-6px) scale(0.98)'
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const menuSlideFadeOutLeftAnimation = 'card-context-menu-slide-fade-out-left';
|
|
39
|
+
globalKeyframes(menuSlideFadeOutLeftAnimation, {
|
|
40
|
+
from: {
|
|
41
|
+
opacity: 1,
|
|
42
|
+
transform: 'translateX(0) scale(1)'
|
|
43
|
+
},
|
|
44
|
+
to: {
|
|
45
|
+
opacity: 0,
|
|
46
|
+
transform: 'translateX(6px) scale(0.98)'
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const menuSlideFadeOutRightAnimation = 'card-context-menu-slide-fade-out-right';
|
|
51
|
+
globalKeyframes(menuSlideFadeOutRightAnimation, {
|
|
52
|
+
from: {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
transform: 'translateX(0) scale(1)'
|
|
55
|
+
},
|
|
56
|
+
to: {
|
|
57
|
+
opacity: 0,
|
|
58
|
+
transform: 'translateX(-6px) scale(0.98)'
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const menuSlideFadeTopAnimation = 'card-context-menu-slide-fade-top';
|
|
63
|
+
globalKeyframes(menuSlideFadeTopAnimation, {
|
|
64
|
+
from: {
|
|
65
|
+
opacity: 0,
|
|
66
|
+
transform: 'translateY(6px) scale(0.98)'
|
|
67
|
+
},
|
|
68
|
+
to: {
|
|
69
|
+
opacity: 1,
|
|
70
|
+
transform: 'translateY(0) scale(1)'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const menuSlideFadeBottomAnimation = 'card-context-menu-slide-fade-bottom';
|
|
75
|
+
globalKeyframes(menuSlideFadeBottomAnimation, {
|
|
76
|
+
from: {
|
|
77
|
+
opacity: 0,
|
|
78
|
+
transform: 'translateY(-6px) scale(0.98)'
|
|
79
|
+
},
|
|
80
|
+
to: {
|
|
81
|
+
opacity: 1,
|
|
82
|
+
transform: 'translateY(0) scale(1)'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const menuSlideFadeLeftAnimation = 'card-context-menu-slide-fade-left';
|
|
87
|
+
globalKeyframes(menuSlideFadeLeftAnimation, {
|
|
88
|
+
from: {
|
|
89
|
+
opacity: 0,
|
|
90
|
+
transform: 'translateX(6px) scale(0.98)'
|
|
91
|
+
},
|
|
92
|
+
to: {
|
|
93
|
+
opacity: 1,
|
|
94
|
+
transform: 'translateX(0) scale(1)'
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const menuSlideFadeRightAnimation = 'card-context-menu-slide-fade-right';
|
|
99
|
+
globalKeyframes(menuSlideFadeRightAnimation, {
|
|
100
|
+
from: {
|
|
101
|
+
opacity: 0,
|
|
102
|
+
transform: 'translateX(-6px) scale(0.98)'
|
|
103
|
+
},
|
|
104
|
+
to: {
|
|
105
|
+
opacity: 1,
|
|
106
|
+
transform: 'translateX(0) scale(1)'
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
4
110
|
export const menu = style({
|
|
5
111
|
backgroundColor: '#ffffff',
|
|
6
112
|
borderRadius: '5px',
|
|
@@ -12,7 +118,45 @@ export const menu = style({
|
|
|
12
118
|
maxWidth: '350px',
|
|
13
119
|
border: `1px solid ${themeVars.color.gray[300]}`,
|
|
14
120
|
boxShadow: themeVars.shadow.md,
|
|
15
|
-
overflow: 'auto'
|
|
121
|
+
overflow: 'auto',
|
|
122
|
+
transformOrigin: 'var(--reka-dropdown-menu-content-transform-origin)',
|
|
123
|
+
willChange: 'transform, opacity',
|
|
124
|
+
selectors: {
|
|
125
|
+
'&[data-state="open"]': {
|
|
126
|
+
animationDuration: '0.16s',
|
|
127
|
+
animationTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',
|
|
128
|
+
animationFillMode: 'both'
|
|
129
|
+
},
|
|
130
|
+
'&[data-state="closed"]': {
|
|
131
|
+
animationDuration: '0.12s',
|
|
132
|
+
animationTimingFunction: 'ease-out',
|
|
133
|
+
animationFillMode: 'both'
|
|
134
|
+
},
|
|
135
|
+
'&[data-state="closed"][data-side="top"]': {
|
|
136
|
+
animationName: menuSlideFadeOutTopAnimation
|
|
137
|
+
},
|
|
138
|
+
'&[data-state="closed"][data-side="bottom"]': {
|
|
139
|
+
animationName: menuSlideFadeOutBottomAnimation
|
|
140
|
+
},
|
|
141
|
+
'&[data-state="closed"][data-side="left"]': {
|
|
142
|
+
animationName: menuSlideFadeOutLeftAnimation
|
|
143
|
+
},
|
|
144
|
+
'&[data-state="closed"][data-side="right"]': {
|
|
145
|
+
animationName: menuSlideFadeOutRightAnimation
|
|
146
|
+
},
|
|
147
|
+
'&[data-state="open"][data-side="top"]': {
|
|
148
|
+
animationName: menuSlideFadeTopAnimation
|
|
149
|
+
},
|
|
150
|
+
'&[data-state="open"][data-side="bottom"]': {
|
|
151
|
+
animationName: menuSlideFadeBottomAnimation
|
|
152
|
+
},
|
|
153
|
+
'&[data-state="open"][data-side="left"]': {
|
|
154
|
+
animationName: menuSlideFadeLeftAnimation
|
|
155
|
+
},
|
|
156
|
+
'&[data-state="open"][data-side="right"]': {
|
|
157
|
+
animationName: menuSlideFadeRightAnimation
|
|
158
|
+
}
|
|
159
|
+
}
|
|
16
160
|
});
|
|
17
161
|
|
|
18
162
|
export const menuItems = style({
|
|
@@ -143,6 +287,15 @@ export const menuItemIcon = style({
|
|
|
143
287
|
opacity: 0.8
|
|
144
288
|
});
|
|
145
289
|
|
|
290
|
+
export const menuItemIconRight = style({
|
|
291
|
+
gridArea: 'decoration',
|
|
292
|
+
flexShrink: 0,
|
|
293
|
+
display: 'flex',
|
|
294
|
+
alignItems: 'center',
|
|
295
|
+
opacity: 0.8,
|
|
296
|
+
marginLeft: themeVars.space[2]
|
|
297
|
+
});
|
|
298
|
+
|
|
146
299
|
export const menuSeperator = style({
|
|
147
300
|
height: '1px',
|
|
148
301
|
backgroundColor: themeVars.color.gray[200],
|