@teammodlr/ui-kit 2.1.74 → 2.1.76
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/dialog/Dialog.vue.d.ts +5 -1
- package/lib/components/dialog/style/Dialog.css.d.ts +2 -0
- package/lib/components/dialogprovider/DialogProvider.vue.d.ts +11 -1
- package/lib/components/dialogprovider/types.d.ts +1 -0
- package/lib/components/tab/TabGroup.vue.d.ts +6 -0
- package/lib/index.cjs.js +9 -9
- package/lib/index.es.js +2631 -2588
- package/lib/style.css +1 -1
- package/package.json +11 -11
- package/src/components/dialog/Dialog.vue +56 -16
- package/src/components/dialog/style/Dialog.css.ts +147 -138
- package/src/components/dialogprovider/DialogProvider.vue +38 -6
- package/src/components/dialogprovider/examples/basic.vue +4 -1
- package/src/components/dialogprovider/types.ts +1 -0
- package/src/components/tab/TabGroup.vue +31 -8
- package/src/components/tab/examples/basic.vue +23 -23
|
@@ -1,138 +1,147 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createVar,
|
|
3
|
-
globalKeyframes,
|
|
4
|
-
style,
|
|
5
|
-
styleVariants
|
|
6
|
-
} from '@vanilla-extract/css';
|
|
7
|
-
import { themeVars } from '../../../styles/theme.css';
|
|
8
|
-
|
|
9
|
-
export const vars = {};
|
|
10
|
-
|
|
11
|
-
export const root = style({});
|
|
12
|
-
export const backdrop = style({
|
|
13
|
-
position: 'fixed',
|
|
14
|
-
inset: 0,
|
|
15
|
-
top: 0,
|
|
16
|
-
bottom: 0,
|
|
17
|
-
left: 0,
|
|
18
|
-
right: 0,
|
|
19
|
-
display: 'flex',
|
|
20
|
-
justifyContent: 'center',
|
|
21
|
-
alignItems: 'center',
|
|
22
|
-
pointerEvents: 'none'
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const backdropColor = style({
|
|
26
|
-
backgroundColor: 'rgba(0,0,0,.45)'
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export const wrapper = style({
|
|
30
|
-
position: 'fixed',
|
|
31
|
-
inset: 0,
|
|
32
|
-
top: 0,
|
|
33
|
-
left: 0,
|
|
34
|
-
right: 0,
|
|
35
|
-
bottom: 0,
|
|
36
|
-
outline: 0,
|
|
37
|
-
overflow: 'auto',
|
|
38
|
-
boxSizing: 'border-box',
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export const notModal = style({
|
|
42
|
-
pointerEvents: 'none'
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
export const dialog = style({
|
|
46
|
-
boxSizing: 'border-box',
|
|
47
|
-
margin: '0 auto',
|
|
48
|
-
padding: 0,
|
|
49
|
-
position: 'relative',
|
|
50
|
-
top: '100px',
|
|
51
|
-
width: 'auto',
|
|
52
|
-
maxWidth: `calc(100vw - 32px)`,
|
|
53
|
-
paddingBottom: '24px'
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
export const content = style({
|
|
57
|
-
position: 'relative',
|
|
58
|
-
backgroundColor: '#FFF',
|
|
59
|
-
backgroundClip: 'padding-box',
|
|
60
|
-
border: `1px solid ${themeVars.color.gray[300]}`,
|
|
61
|
-
borderRadius: themeVars.rounded.medium,
|
|
62
|
-
pointerEvents: 'auto',
|
|
63
|
-
boxShadow: `2px 2px 8px rgba(128, 128, 128, 0.1), 0 9px 28px 8px rgba(0,0,0,.05)`
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export const header = style({
|
|
67
|
-
color: themeVars.color.font.default,
|
|
68
|
-
backgroundColor: '#FFF',
|
|
69
|
-
marginBottom: themeVars.space[2],
|
|
70
|
-
borderBottom: `1px solid ${themeVars.color.gray[300]}`,
|
|
71
|
-
height: `35px`,
|
|
72
|
-
display: `flex`,
|
|
73
|
-
alignItems: `center`,
|
|
74
|
-
padding: `0px ${themeVars.space[2]}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
'
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
1
|
+
import {
|
|
2
|
+
createVar,
|
|
3
|
+
globalKeyframes,
|
|
4
|
+
style,
|
|
5
|
+
styleVariants
|
|
6
|
+
} from '@vanilla-extract/css';
|
|
7
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
8
|
+
|
|
9
|
+
export const vars = {};
|
|
10
|
+
|
|
11
|
+
export const root = style({});
|
|
12
|
+
export const backdrop = style({
|
|
13
|
+
position: 'fixed',
|
|
14
|
+
inset: 0,
|
|
15
|
+
top: 0,
|
|
16
|
+
bottom: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
right: 0,
|
|
19
|
+
display: 'flex',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
pointerEvents: 'none'
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const backdropColor = style({
|
|
26
|
+
backgroundColor: 'rgba(0,0,0,.45)'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const wrapper = style({
|
|
30
|
+
position: 'fixed',
|
|
31
|
+
inset: 0,
|
|
32
|
+
top: 0,
|
|
33
|
+
left: 0,
|
|
34
|
+
right: 0,
|
|
35
|
+
bottom: 0,
|
|
36
|
+
outline: 0,
|
|
37
|
+
overflow: 'auto',
|
|
38
|
+
boxSizing: 'border-box',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const notModal = style({
|
|
42
|
+
pointerEvents: 'none'
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
export const dialog = style({
|
|
46
|
+
boxSizing: 'border-box',
|
|
47
|
+
margin: '0 auto',
|
|
48
|
+
padding: 0,
|
|
49
|
+
position: 'relative',
|
|
50
|
+
top: '100px',
|
|
51
|
+
width: 'auto',
|
|
52
|
+
maxWidth: `calc(100vw - 32px)`,
|
|
53
|
+
paddingBottom: '24px'
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const content = style({
|
|
57
|
+
position: 'relative',
|
|
58
|
+
backgroundColor: '#FFF',
|
|
59
|
+
backgroundClip: 'padding-box',
|
|
60
|
+
border: `1px solid ${themeVars.color.gray[300]}`,
|
|
61
|
+
borderRadius: themeVars.rounded.medium,
|
|
62
|
+
pointerEvents: 'auto',
|
|
63
|
+
boxShadow: `2px 2px 8px rgba(128, 128, 128, 0.1), 0 9px 28px 8px rgba(0,0,0,.05)`
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const header = style({
|
|
67
|
+
color: themeVars.color.font.default,
|
|
68
|
+
backgroundColor: '#FFF',
|
|
69
|
+
marginBottom: themeVars.space[2],
|
|
70
|
+
borderBottom: `1px solid ${themeVars.color.gray[300]}`,
|
|
71
|
+
height: `35px`,
|
|
72
|
+
display: `flex`,
|
|
73
|
+
alignItems: `center`,
|
|
74
|
+
padding: `0px ${themeVars.space[2]}`,
|
|
75
|
+
borderRadius: `${themeVars.rounded.medium} ${themeVars.rounded.medium} 0 0`,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const draggable = style({
|
|
79
|
+
cursor: "grab"
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const dragging = style({
|
|
83
|
+
cursor: "grabbing"
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const footer = style({
|
|
87
|
+
textAlign: 'end',
|
|
88
|
+
background: `0 0`,
|
|
89
|
+
marginTop: themeVars.space[2]
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const title = style({
|
|
93
|
+
margin: 0,
|
|
94
|
+
color: themeVars.color.font.default,
|
|
95
|
+
fontWeight: 600,
|
|
96
|
+
lineHeight: 1.5,
|
|
97
|
+
wordWrap: 'break-word',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const close = style([
|
|
101
|
+
{
|
|
102
|
+
outline: `none ${themeVars.color.gray[300]}`,
|
|
103
|
+
display: 'inline-block',
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
top: themeVars.space[1.5],
|
|
106
|
+
right: themeVars.space[1.5],
|
|
107
|
+
width: '1.5rem',
|
|
108
|
+
height: '1.5rem',
|
|
109
|
+
backgroundColor: 'transparent',
|
|
110
|
+
border: 'none',
|
|
111
|
+
padding: 0,
|
|
112
|
+
cursor: 'pointer',
|
|
113
|
+
transition: 'all 0.2s',
|
|
114
|
+
borderRadius: themeVars.rounded.full,
|
|
115
|
+
marginLeft: themeVars.space[2],
|
|
116
|
+
':hover': {
|
|
117
|
+
backgroundColor: themeVars.color.gray[150]
|
|
118
|
+
},
|
|
119
|
+
':focus': {
|
|
120
|
+
backgroundColor: themeVars.color.gray[150]
|
|
121
|
+
},
|
|
122
|
+
'::before': {
|
|
123
|
+
content: '""',
|
|
124
|
+
position: 'absolute',
|
|
125
|
+
top: '50%',
|
|
126
|
+
left: '50%',
|
|
127
|
+
transform: 'translate(-50%, -50%) rotate(45deg)',
|
|
128
|
+
width: '0.8rem',
|
|
129
|
+
height: '2px',
|
|
130
|
+
backgroundColor: themeVars.color.gray[500],
|
|
131
|
+
transformOrigin: 'center',
|
|
132
|
+
transition: 'all 0.2s'
|
|
133
|
+
},
|
|
134
|
+
'::after': {
|
|
135
|
+
content: '""',
|
|
136
|
+
position: 'absolute',
|
|
137
|
+
top: '50%',
|
|
138
|
+
left: '50%',
|
|
139
|
+
transform: 'translate(-50%, -50%) rotate(-45deg)',
|
|
140
|
+
width: '0.8rem',
|
|
141
|
+
height: '2px',
|
|
142
|
+
backgroundColor: themeVars.color.gray[500],
|
|
143
|
+
transformOrigin: 'center',
|
|
144
|
+
transition: 'all 0.2s'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]);
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<slot/>
|
|
3
3
|
<template v-if="Object.keys(dialogMap).length > 0">
|
|
4
|
-
<
|
|
4
|
+
<template v-for="dialog in Object.values(dialogMap)">
|
|
5
5
|
<MDialog
|
|
6
|
-
v-
|
|
6
|
+
v-if="dialog.options.open"
|
|
7
7
|
:key="dialog.key"
|
|
8
|
-
v-bind="dialog.options"
|
|
8
|
+
v-bind="filteredOptions(dialog.options)"
|
|
9
9
|
ref="setDialogRef(dialog.key)"
|
|
10
10
|
@close="remove(dialog.key)"
|
|
11
|
+
@on-close="handleClose(dialog.key)"
|
|
12
|
+
@on-open="handleOpen(dialog.key)"
|
|
11
13
|
>
|
|
12
|
-
<
|
|
14
|
+
<template #default>
|
|
15
|
+
<MRenderer
|
|
16
|
+
v-if="dialog.options.render"
|
|
17
|
+
:h="dialog.options.render"
|
|
18
|
+
:props="dialog.options.props"
|
|
19
|
+
/>
|
|
20
|
+
</template>
|
|
13
21
|
</MDialog>
|
|
14
|
-
</
|
|
22
|
+
</template>
|
|
15
23
|
</template>
|
|
16
24
|
</template>
|
|
17
25
|
<script lang="ts">
|
|
@@ -59,6 +67,7 @@ export default defineComponent({
|
|
|
59
67
|
dialogComponent.open();
|
|
60
68
|
} else {
|
|
61
69
|
dialog.options.open = true;
|
|
70
|
+
handleOpen(key);
|
|
62
71
|
}
|
|
63
72
|
},
|
|
64
73
|
close: () => {
|
|
@@ -66,7 +75,7 @@ export default defineComponent({
|
|
|
66
75
|
if (dialogComponent && dialogComponent.close) {
|
|
67
76
|
dialogComponent.close();
|
|
68
77
|
} else {
|
|
69
|
-
|
|
78
|
+
handleClose(key);
|
|
70
79
|
}
|
|
71
80
|
},
|
|
72
81
|
};
|
|
@@ -75,11 +84,31 @@ export default defineComponent({
|
|
|
75
84
|
return dialog;
|
|
76
85
|
}
|
|
77
86
|
|
|
87
|
+
function filteredOptions(options: DialogOptions) {
|
|
88
|
+
const { render, props, ...filtered } = options;
|
|
89
|
+
return filtered;
|
|
90
|
+
}
|
|
91
|
+
|
|
78
92
|
function remove(key: string) {
|
|
79
93
|
delete dialogMap[key];
|
|
80
94
|
delete dialogRefs.value[key];
|
|
81
95
|
}
|
|
82
96
|
|
|
97
|
+
function handleOpen(key: string) {
|
|
98
|
+
const dialog = dialogMap[key];
|
|
99
|
+
if (dialog && dialog.options.onOpen) {
|
|
100
|
+
dialog.options.onOpen();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function handleClose(key: string) {
|
|
105
|
+
const dialog = dialogMap[key];
|
|
106
|
+
if (dialog && dialog.options.onClose) {
|
|
107
|
+
dialog.options.onClose();
|
|
108
|
+
}
|
|
109
|
+
remove(key);
|
|
110
|
+
}
|
|
111
|
+
|
|
83
112
|
const api: DialogApiInjection = {
|
|
84
113
|
create,
|
|
85
114
|
remove,
|
|
@@ -90,7 +119,10 @@ export default defineComponent({
|
|
|
90
119
|
return {
|
|
91
120
|
dialogMap,
|
|
92
121
|
remove,
|
|
122
|
+
handleClose,
|
|
123
|
+
handleOpen,
|
|
93
124
|
setDialogRef,
|
|
125
|
+
filteredOptions
|
|
94
126
|
};
|
|
95
127
|
},
|
|
96
128
|
});
|
|
@@ -13,12 +13,16 @@
|
|
|
13
13
|
import type { Size } from '../../types/props';
|
|
14
14
|
import { computed, defineComponent, provide, reactive, ref, watchEffect, type PropType } from 'vue';
|
|
15
15
|
import { tabs, tabContent, tabsEvenly } from './style';
|
|
16
|
+
|
|
16
17
|
export default defineComponent({
|
|
17
18
|
name: "TabGroup",
|
|
18
19
|
props: {
|
|
19
20
|
modelValue: {
|
|
20
21
|
type: [String, Number],
|
|
21
22
|
},
|
|
23
|
+
selected: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
},
|
|
22
26
|
size: {
|
|
23
27
|
type: String as PropType<Size>,
|
|
24
28
|
default: 'md'
|
|
@@ -38,20 +42,32 @@ export default defineComponent({
|
|
|
38
42
|
}
|
|
39
43
|
},
|
|
40
44
|
emit: [
|
|
41
|
-
'update:modelValue'
|
|
45
|
+
'update:modelValue',
|
|
46
|
+
'update:selected'
|
|
42
47
|
],
|
|
43
48
|
setup(props, { emit }) {
|
|
44
49
|
const wrapperRef = ref<HTMLElement>();
|
|
45
50
|
const tabsContentRef = ref<HTMLElement>();
|
|
46
51
|
const contentRef = ref<HTMLElement>();
|
|
47
52
|
const active = ref();
|
|
53
|
+
const selectedActive = ref();
|
|
54
|
+
|
|
55
|
+
// Watch for changes in modelValue
|
|
56
|
+
watchEffect(() => {
|
|
57
|
+
if (props.modelValue !== undefined) {
|
|
58
|
+
active.value = props.modelValue;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
48
61
|
|
|
62
|
+
// Watch for changes in selected
|
|
49
63
|
watchEffect(() => {
|
|
50
|
-
|
|
64
|
+
if (props.selected !== undefined) {
|
|
65
|
+
selectedActive.value = props.selected;
|
|
66
|
+
}
|
|
51
67
|
});
|
|
52
68
|
|
|
53
69
|
const state = reactive({
|
|
54
|
-
active: computed(() => active.value),
|
|
70
|
+
active: computed(() => active.value ?? selectedActive.value),
|
|
55
71
|
type: computed(() => props.type)
|
|
56
72
|
});
|
|
57
73
|
|
|
@@ -66,7 +82,6 @@ export default defineComponent({
|
|
|
66
82
|
return {
|
|
67
83
|
[tabs[props.type as keyof typeof tabs]]: true,
|
|
68
84
|
[tabsEvenly]: props.evenly
|
|
69
|
-
|
|
70
85
|
}
|
|
71
86
|
});
|
|
72
87
|
|
|
@@ -74,18 +89,26 @@ export default defineComponent({
|
|
|
74
89
|
return {
|
|
75
90
|
[tabContent]: true
|
|
76
91
|
}
|
|
77
|
-
})
|
|
92
|
+
});
|
|
78
93
|
|
|
79
94
|
function selectTab(tab: string | number) {
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
// Update both modelValue and selected if they exist
|
|
96
|
+
if (props.modelValue !== undefined) {
|
|
97
|
+
active.value = tab;
|
|
98
|
+
emit('update:modelValue', tab);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (props.selected !== undefined) {
|
|
102
|
+
selectedActive.value = tab;
|
|
103
|
+
emit('update:selected', tab);
|
|
104
|
+
}
|
|
82
105
|
}
|
|
83
106
|
|
|
84
107
|
provide("tabs", {
|
|
85
108
|
tabsContentRef,
|
|
86
109
|
selectTab,
|
|
87
110
|
state
|
|
88
|
-
})
|
|
111
|
+
});
|
|
89
112
|
|
|
90
113
|
return {
|
|
91
114
|
wrapperRef,
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<MTabGroup v-model="active">
|
|
3
|
-
<MTab value="one" label="OneOneOneOneOneOneOneOneOneOneOneOneOneOneOneOne" closable @on-close="close">
|
|
4
|
-
Hello Worlddsd
|
|
5
|
-
</MTab>
|
|
6
|
-
<MTab value="two" label="Two" disabled>
|
|
7
|
-
Hello World Two
|
|
8
|
-
</MTab>
|
|
9
|
-
<MTab value="three" label="Third">
|
|
10
|
-
Hello World Two dfndjfn
|
|
11
|
-
</MTab>
|
|
12
|
-
</MTabGroup>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script lang="ts" setup>
|
|
16
|
-
import { ref } from "vue";
|
|
17
|
-
|
|
18
|
-
const active = ref("one");
|
|
19
|
-
|
|
20
|
-
function close(tab: any) {
|
|
21
|
-
console.log('hi', tab);
|
|
22
|
-
}
|
|
23
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<MTabGroup v-model="active">
|
|
3
|
+
<MTab value="one" label="OneOneOneOneOneOneOneOneOneOneOneOneOneOneOneOne" closable @on-close="close">
|
|
4
|
+
Hello Worlddsd
|
|
5
|
+
</MTab>
|
|
6
|
+
<MTab value="two" label="Two" disabled>
|
|
7
|
+
Hello World Two
|
|
8
|
+
</MTab>
|
|
9
|
+
<MTab value="three" label="Third">
|
|
10
|
+
Hello World Two dfndjfn
|
|
11
|
+
</MTab>
|
|
12
|
+
</MTabGroup>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import { ref } from "vue";
|
|
17
|
+
|
|
18
|
+
const active = ref("one");
|
|
19
|
+
|
|
20
|
+
function close(tab: any) {
|
|
21
|
+
console.log('hi', tab);
|
|
22
|
+
}
|
|
23
|
+
</script>
|