@teammodlr/ui-kit 2.1.49 → 2.1.51
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 +1 -1
- package/lib/components/badge/style/Badge.css.d.ts +2 -2
- package/lib/components/button/Button.vue.d.ts +4 -4
- package/lib/components/button/style/Button.css.d.ts +3 -3
- package/lib/components/checkbox/Checkbox.vue.d.ts +4 -4
- package/lib/components/configprovider/ConfigProvider.vue.d.ts +12 -11
- package/lib/components/confirm/ConfirmProvider.vue.d.ts +10 -10
- package/lib/components/dropdown/DropdownItem.vue.d.ts +2 -2
- package/lib/components/dropdown/style/Dropdown.css.d.ts +1 -1
- package/lib/components/input/Input.vue.d.ts +6 -6
- package/lib/components/link/Link.vue.d.ts +2 -2
- package/lib/components/messageprovider/Message.vue.d.ts +2 -2
- package/lib/components/messageprovider/MessageProvider.vue.d.ts +5 -5
- package/lib/components/messageprovider/style/Message.css.d.ts +1 -1
- package/lib/components/modal/Modal.vue.d.ts +1 -1
- package/lib/components/radio/Radio.vue.d.ts +6 -6
- package/lib/components/radiobutton/RadioButton.vue.d.ts +4 -4
- package/lib/components/renderer/renderer.d.ts +1 -1
- package/lib/components/select/Select.vue.d.ts +21 -20
- package/lib/components/switch/Switch.vue.d.ts +4 -4
- package/lib/components/tab/Tab.vue.d.ts +4 -6
- package/lib/components/tab/TabGroup.vue.d.ts +17 -3
- package/lib/components/tab/style/Tab.css.d.ts +7 -0
- package/lib/components/tab/style/index.d.ts +1 -0
- package/lib/components/table/Table.vue.d.ts +2 -2
- package/lib/components/textarea/Textarea.vue.d.ts +5 -5
- package/lib/composables/useInput.d.ts +1 -1
- package/lib/index.cjs.js +10 -13
- package/lib/index.es.js +2386 -2432
- package/lib/install.d.ts +1 -1
- package/lib/style.css +1 -1
- package/package.json +75 -89
- package/src/components/avatar/examples/index.stories.ts +25 -25
- package/src/components/avatargroup/examples/index.stories.ts +19 -19
- package/src/components/badge/examples/index.stories.ts +19 -19
- package/src/components/breadcrumb/examples/index.stories.ts +16 -16
- package/src/components/button/examples/index.stories.ts +37 -37
- package/src/components/buttongroup/examples/index.stories.ts +17 -17
- package/src/components/checkbox/examples/index.stories.ts +16 -16
- package/src/components/colorpicker/examples/index.stories.ts +12 -12
- package/src/components/configprovider/ConfigProvider.vue +38 -38
- package/src/components/confirm/ConfirmProvider.vue +82 -82
- package/src/components/confirm/examples/index.stories.ts +26 -26
- package/src/components/dialog/examples/index.stories.ts +14 -14
- package/src/components/dropdown/examples/index.stories.ts +26 -26
- package/src/components/form/examples/index.stories.ts +23 -23
- package/src/components/image/examples/index.stories.ts +10 -10
- package/src/components/input/examples/index.stories.ts +26 -26
- package/src/components/link/examples/index.stories.ts +15 -15
- package/src/components/messageprovider/examples/index.stories.ts +26 -26
- package/src/components/modal/examples/index.stories.ts +16 -16
- package/src/components/pagination/examples/index.stories.ts +11 -11
- package/src/components/radio/examples/index.stories.ts +16 -16
- package/src/components/radiobuttongroup/examples/index.stories.ts +18 -18
- package/src/components/renderer/examlpes/index.stories.ts +14 -14
- package/src/components/select/Select.vue +755 -755
- package/src/components/select/examples/basic.vue +26 -26
- package/src/components/select/examples/index.stories.ts +16 -16
- package/src/components/select/types.ts +27 -27
- package/src/components/skeleton/examples/index.stories.ts +13 -13
- package/src/components/switch/examples/index.stories.ts +15 -15
- package/src/components/switch/style/Switch.css.ts +135 -135
- package/src/components/tab/Tab.vue +85 -98
- package/src/components/tab/TabGroup.vue +96 -90
- package/src/components/tab/examples/index.stories.ts +21 -10
- package/src/components/tab/style/Tab.css.ts +137 -0
- package/src/components/tab/style/index.ts +1 -0
- package/src/components/table/examples/index.stories.ts +17 -17
- package/src/components/tag/examples/index.stories.ts +16 -16
- package/src/components/textarea/examples/index.stories.ts +14 -14
- package/src/components/tooltip/examples/index.stories.ts +17 -17
- package/src/components/transfer/examples/index.stories.ts +12 -12
- package/src/components/tree/examples/index.stories.ts +12 -12
- package/src/components/virtualscroll/examples/index.stories.ts +11 -11
- package/src/composables/useCachedUid.ts +15 -15
- package/src/composables/useInput.ts +151 -151
- package/src/examples/cards/cards.stories.ts +9 -9
- package/src/examples/modal/modal.stories.ts +9 -9
- package/src/types/props.ts +21 -21
- package/src/utils/call.ts +34 -34
- package/src/utils/injection.ts +45 -45
- package/src/components/tab/Tab.css +0 -113
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<MSelect
|
|
3
|
-
v-model="value"
|
|
4
|
-
:options="options"
|
|
5
|
-
:option-value="'id'"
|
|
6
|
-
:option-label="'name'"
|
|
7
|
-
blank
|
|
8
|
-
@update:value="testThis"
|
|
9
|
-
/>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script lang="ts" setup>
|
|
13
|
-
import { ref } from "vue";
|
|
14
|
-
|
|
15
|
-
// make list of options with 1000 items
|
|
16
|
-
const options = Array.from({ length: 50 }, (_, i) => ({
|
|
17
|
-
id: i,
|
|
18
|
-
name: `Option ${i+1}`
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
const value = ref();
|
|
22
|
-
|
|
23
|
-
function testThis(value: any, option: any) {
|
|
24
|
-
alert('value: ' + value);
|
|
25
|
-
}
|
|
26
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<MSelect
|
|
3
|
+
v-model="value"
|
|
4
|
+
:options="options"
|
|
5
|
+
:option-value="'id'"
|
|
6
|
+
:option-label="'name'"
|
|
7
|
+
blank
|
|
8
|
+
@update:value="testThis"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import { ref } from "vue";
|
|
14
|
+
|
|
15
|
+
// make list of options with 1000 items
|
|
16
|
+
const options = Array.from({ length: 50 }, (_, i) => ({
|
|
17
|
+
id: i,
|
|
18
|
+
name: `Option ${i+1}`
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const value = ref();
|
|
22
|
+
|
|
23
|
+
function testThis(value: any, option: any) {
|
|
24
|
+
alert('value: ' + value);
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import MSelect from '../Select.vue';
|
|
2
|
-
import { MSelectBasic, MSelectSearchable, MSelectMultiple } from './index';
|
|
3
|
-
|
|
4
|
-
import { createStory, sizeArgType } from '../../../__storybook__';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
component: MSelect,
|
|
8
|
-
title: 'Components/Select',
|
|
9
|
-
argTypes: {
|
|
10
|
-
...sizeArgType()
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const Basic = createStory(MSelectBasic);
|
|
15
|
-
export const Searchable = createStory(MSelectSearchable);
|
|
16
|
-
export const Multiple = createStory(MSelectMultiple);
|
|
1
|
+
import MSelect from '../Select.vue';
|
|
2
|
+
import { MSelectBasic, MSelectSearchable, MSelectMultiple } from './index';
|
|
3
|
+
|
|
4
|
+
import { createStory, sizeArgType } from '../../../__storybook__';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: MSelect,
|
|
8
|
+
title: 'Components/Select',
|
|
9
|
+
argTypes: {
|
|
10
|
+
...sizeArgType()
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Basic = createStory(MSelectBasic);
|
|
15
|
+
export const Searchable = createStory(MSelectSearchable);
|
|
16
|
+
export const Multiple = createStory(MSelectMultiple);
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export type ValueAtom = string | number
|
|
2
|
-
export type Value = ValueAtom | string[] | number[] | ValueAtom[]
|
|
3
|
-
export type OnUpdateValue = (
|
|
4
|
-
value: string &
|
|
5
|
-
number &
|
|
6
|
-
ValueAtom &
|
|
7
|
-
string[] &
|
|
8
|
-
number[] &
|
|
9
|
-
ValueAtom[] &
|
|
10
|
-
(ValueAtom | null) &
|
|
11
|
-
(string[] | null) &
|
|
12
|
-
(number[] | null) &
|
|
13
|
-
(ValueAtom[] | null),
|
|
14
|
-
option: object & null
|
|
15
|
-
) => void
|
|
16
|
-
export type OnUpdateValueImpl = (
|
|
17
|
-
value:
|
|
18
|
-
| ValueAtom
|
|
19
|
-
| string[]
|
|
20
|
-
| number[]
|
|
21
|
-
| ValueAtom[]
|
|
22
|
-
| (ValueAtom | null)
|
|
23
|
-
| (string[] | null)
|
|
24
|
-
| (number[] | null)
|
|
25
|
-
| (ValueAtom[] | null),
|
|
26
|
-
option: object | null
|
|
27
|
-
) => void
|
|
1
|
+
export type ValueAtom = string | number
|
|
2
|
+
export type Value = ValueAtom | string[] | number[] | ValueAtom[]
|
|
3
|
+
export type OnUpdateValue = (
|
|
4
|
+
value: string &
|
|
5
|
+
number &
|
|
6
|
+
ValueAtom &
|
|
7
|
+
string[] &
|
|
8
|
+
number[] &
|
|
9
|
+
ValueAtom[] &
|
|
10
|
+
(ValueAtom | null) &
|
|
11
|
+
(string[] | null) &
|
|
12
|
+
(number[] | null) &
|
|
13
|
+
(ValueAtom[] | null),
|
|
14
|
+
option: object & null
|
|
15
|
+
) => void
|
|
16
|
+
export type OnUpdateValueImpl = (
|
|
17
|
+
value:
|
|
18
|
+
| ValueAtom
|
|
19
|
+
| string[]
|
|
20
|
+
| number[]
|
|
21
|
+
| ValueAtom[]
|
|
22
|
+
| (ValueAtom | null)
|
|
23
|
+
| (string[] | null)
|
|
24
|
+
| (number[] | null)
|
|
25
|
+
| (ValueAtom[] | null),
|
|
26
|
+
option: object | null
|
|
27
|
+
) => void
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createStory } from '../../../__storybook__';
|
|
2
|
-
import MSkeleton from '../Skeleton.vue';
|
|
3
|
-
|
|
4
|
-
import { MSkeletonBasic, MSkeletonPost } from './index';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
component: MSkeleton,
|
|
8
|
-
title: 'Components/Skeleton',
|
|
9
|
-
argTypes: {}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const Basic = createStory(MSkeletonBasic);
|
|
13
|
-
export const Post = createStory(MSkeletonPost);
|
|
1
|
+
import { createStory } from '../../../__storybook__';
|
|
2
|
+
import MSkeleton from '../Skeleton.vue';
|
|
3
|
+
|
|
4
|
+
import { MSkeletonBasic, MSkeletonPost } from './index';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: MSkeleton,
|
|
8
|
+
title: 'Components/Skeleton',
|
|
9
|
+
argTypes: {}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Basic = createStory(MSkeletonBasic);
|
|
13
|
+
export const Post = createStory(MSkeletonPost);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import MSwitch from '../Switch.vue';
|
|
2
|
-
import { MSwitchBasic, MSwitchSlot } from './index';
|
|
3
|
-
|
|
4
|
-
import { createStory, sizeArgType, colorArgType } from '../../../__storybook__';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
component: MSwitch,
|
|
8
|
-
title: 'Components/Switch',
|
|
9
|
-
argTypes: {
|
|
10
|
-
...sizeArgType()
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const Basic = createStory(MSwitchBasic);
|
|
15
|
-
export const Slot = createStory(MSwitchSlot);
|
|
1
|
+
import MSwitch from '../Switch.vue';
|
|
2
|
+
import { MSwitchBasic, MSwitchSlot } from './index';
|
|
3
|
+
|
|
4
|
+
import { createStory, sizeArgType, colorArgType } from '../../../__storybook__';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: MSwitch,
|
|
8
|
+
title: 'Components/Switch',
|
|
9
|
+
argTypes: {
|
|
10
|
+
...sizeArgType()
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Basic = createStory(MSwitchBasic);
|
|
15
|
+
export const Slot = createStory(MSwitchSlot);
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createVar,
|
|
3
|
-
globalStyle,
|
|
4
|
-
style,
|
|
5
|
-
styleVariants
|
|
6
|
-
} from '@vanilla-extract/css';
|
|
7
|
-
import { themeVars } from '../../../styles/theme.css';
|
|
8
|
-
|
|
9
|
-
const sizes = {
|
|
10
|
-
xs: '14px',
|
|
11
|
-
sm: '16px',
|
|
12
|
-
md: '18px',
|
|
13
|
-
lg: '20px',
|
|
14
|
-
xl: '22px'
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const vars = {
|
|
18
|
-
offBackground: createVar(),
|
|
19
|
-
onBackground: createVar(),
|
|
20
|
-
handleBackground: createVar(),
|
|
21
|
-
height: createVar()
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const toggle = style({
|
|
25
|
-
vars: {
|
|
26
|
-
[vars.height]: sizes.md,
|
|
27
|
-
[vars.offBackground]: themeVars.color.gray[300],
|
|
28
|
-
[vars.onBackground]: themeVars.color.blue[500],
|
|
29
|
-
[vars.handleBackground]: '#fff'
|
|
30
|
-
},
|
|
31
|
-
outline: 0,
|
|
32
|
-
display: 'block',
|
|
33
|
-
width: `calc(${vars.height} * 2)`,
|
|
34
|
-
minWidth: `calc(${vars.height} * 2)`,
|
|
35
|
-
height: `calc(${vars.height} + 2px)`,
|
|
36
|
-
position: 'relative',
|
|
37
|
-
cursor: 'pointer',
|
|
38
|
-
userSelect: 'none',
|
|
39
|
-
borderRadius: '2em',
|
|
40
|
-
padding: '2px',
|
|
41
|
-
background: vars.offBackground,
|
|
42
|
-
transition: 'all .4s ease',
|
|
43
|
-
selectors: {
|
|
44
|
-
['&:after']: {
|
|
45
|
-
position: 'relative',
|
|
46
|
-
display: 'block',
|
|
47
|
-
content: '""',
|
|
48
|
-
width: `calc(${vars.height} - 2px)`,
|
|
49
|
-
height: '100%',
|
|
50
|
-
left: 0,
|
|
51
|
-
borderRadius: '50%',
|
|
52
|
-
background: vars.handleBackground,
|
|
53
|
-
transition: 'all .2s ease'
|
|
54
|
-
},
|
|
55
|
-
['&:before']: {
|
|
56
|
-
position: 'relative',
|
|
57
|
-
content: '""',
|
|
58
|
-
width: '50%',
|
|
59
|
-
height: '100%',
|
|
60
|
-
display: 'none'
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export const checked = style({
|
|
66
|
-
vars: {
|
|
67
|
-
[vars.offBackground]: vars.onBackground
|
|
68
|
-
},
|
|
69
|
-
selectors: {
|
|
70
|
-
['&:after']: {
|
|
71
|
-
left: '50%'
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
export const base = style({
|
|
77
|
-
position: 'relative',
|
|
78
|
-
display: 'inline-flex',
|
|
79
|
-
alignItems: 'center',
|
|
80
|
-
cursor: 'pointer',
|
|
81
|
-
gap: themeVars.space['1.5']
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
export const input = style({
|
|
85
|
-
position: 'absolute',
|
|
86
|
-
opacity: 0,
|
|
87
|
-
cursor: 'pointer'
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
export const disabled = style({
|
|
91
|
-
opacity: 0.5,
|
|
92
|
-
cursor: 'not-allowed'
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
export const label = style({
|
|
96
|
-
marginLeft: themeVars.space['0.5'],
|
|
97
|
-
fontWeight: '500',
|
|
98
|
-
display: 'inline-block',
|
|
99
|
-
fontSize: themeVars.fontSize.base,
|
|
100
|
-
wordBreak: 'break-word',
|
|
101
|
-
cursor: 'pointer'
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
export const size = styleVariants({
|
|
105
|
-
xs: {
|
|
106
|
-
vars: {
|
|
107
|
-
[vars.height]: sizes.xs
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
sm: {
|
|
111
|
-
vars: {
|
|
112
|
-
[vars.height]: sizes.sm
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
md: {
|
|
116
|
-
vars: {
|
|
117
|
-
[vars.height]: sizes.md
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
lg: {
|
|
121
|
-
vars: {
|
|
122
|
-
[vars.height]: sizes.lg
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
xl: {
|
|
126
|
-
vars: {
|
|
127
|
-
[vars.height]: sizes.xl
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
globalStyle(`${base} ${input}:focus + ${toggle}`, {
|
|
133
|
-
vars: {},
|
|
134
|
-
boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}`
|
|
135
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
createVar,
|
|
3
|
+
globalStyle,
|
|
4
|
+
style,
|
|
5
|
+
styleVariants
|
|
6
|
+
} from '@vanilla-extract/css';
|
|
7
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
8
|
+
|
|
9
|
+
const sizes = {
|
|
10
|
+
xs: '14px',
|
|
11
|
+
sm: '16px',
|
|
12
|
+
md: '18px',
|
|
13
|
+
lg: '20px',
|
|
14
|
+
xl: '22px'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const vars = {
|
|
18
|
+
offBackground: createVar(),
|
|
19
|
+
onBackground: createVar(),
|
|
20
|
+
handleBackground: createVar(),
|
|
21
|
+
height: createVar()
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const toggle = style({
|
|
25
|
+
vars: {
|
|
26
|
+
[vars.height]: sizes.md,
|
|
27
|
+
[vars.offBackground]: themeVars.color.gray[300],
|
|
28
|
+
[vars.onBackground]: themeVars.color.blue[500],
|
|
29
|
+
[vars.handleBackground]: '#fff'
|
|
30
|
+
},
|
|
31
|
+
outline: 0,
|
|
32
|
+
display: 'block',
|
|
33
|
+
width: `calc(${vars.height} * 2)`,
|
|
34
|
+
minWidth: `calc(${vars.height} * 2)`,
|
|
35
|
+
height: `calc(${vars.height} + 2px)`,
|
|
36
|
+
position: 'relative',
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
userSelect: 'none',
|
|
39
|
+
borderRadius: '2em',
|
|
40
|
+
padding: '2px',
|
|
41
|
+
background: vars.offBackground,
|
|
42
|
+
transition: 'all .4s ease',
|
|
43
|
+
selectors: {
|
|
44
|
+
['&:after']: {
|
|
45
|
+
position: 'relative',
|
|
46
|
+
display: 'block',
|
|
47
|
+
content: '""',
|
|
48
|
+
width: `calc(${vars.height} - 2px)`,
|
|
49
|
+
height: '100%',
|
|
50
|
+
left: 0,
|
|
51
|
+
borderRadius: '50%',
|
|
52
|
+
background: vars.handleBackground,
|
|
53
|
+
transition: 'all .2s ease'
|
|
54
|
+
},
|
|
55
|
+
['&:before']: {
|
|
56
|
+
position: 'relative',
|
|
57
|
+
content: '""',
|
|
58
|
+
width: '50%',
|
|
59
|
+
height: '100%',
|
|
60
|
+
display: 'none'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const checked = style({
|
|
66
|
+
vars: {
|
|
67
|
+
[vars.offBackground]: vars.onBackground
|
|
68
|
+
},
|
|
69
|
+
selectors: {
|
|
70
|
+
['&:after']: {
|
|
71
|
+
left: '50%'
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const base = style({
|
|
77
|
+
position: 'relative',
|
|
78
|
+
display: 'inline-flex',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
cursor: 'pointer',
|
|
81
|
+
gap: themeVars.space['1.5']
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export const input = style({
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
opacity: 0,
|
|
87
|
+
cursor: 'pointer'
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export const disabled = style({
|
|
91
|
+
opacity: 0.5,
|
|
92
|
+
cursor: 'not-allowed'
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const label = style({
|
|
96
|
+
marginLeft: themeVars.space['0.5'],
|
|
97
|
+
fontWeight: '500',
|
|
98
|
+
display: 'inline-block',
|
|
99
|
+
fontSize: themeVars.fontSize.base,
|
|
100
|
+
wordBreak: 'break-word',
|
|
101
|
+
cursor: 'pointer'
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export const size = styleVariants({
|
|
105
|
+
xs: {
|
|
106
|
+
vars: {
|
|
107
|
+
[vars.height]: sizes.xs
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
sm: {
|
|
111
|
+
vars: {
|
|
112
|
+
[vars.height]: sizes.sm
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
md: {
|
|
116
|
+
vars: {
|
|
117
|
+
[vars.height]: sizes.md
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
lg: {
|
|
121
|
+
vars: {
|
|
122
|
+
[vars.height]: sizes.lg
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
xl: {
|
|
126
|
+
vars: {
|
|
127
|
+
[vars.height]: sizes.xl
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
globalStyle(`${base} ${input}:focus + ${toggle}`, {
|
|
133
|
+
vars: {},
|
|
134
|
+
boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}`
|
|
135
|
+
});
|
|
@@ -1,98 +1,85 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<
|
|
3
|
-
:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
computedValue,
|
|
88
|
-
computedLabel,
|
|
89
|
-
tabRef,
|
|
90
|
-
computedTabWrapperClasses,
|
|
91
|
-
computedTabClasses,
|
|
92
|
-
handleClick,
|
|
93
|
-
selected,
|
|
94
|
-
teleportTo
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="tabRef" :class="computedTabClasses" @click.prevent="handleClick" :disabled="disabled">
|
|
3
|
+
<span :class="computedTabLabelClasses">
|
|
4
|
+
<slot name="tab" :label="label" :value="value">
|
|
5
|
+
{{ computedLabel }}
|
|
6
|
+
</slot>
|
|
7
|
+
</span>
|
|
8
|
+
|
|
9
|
+
<teleport v-if="selected && teleportTo" :to="teleportTo">
|
|
10
|
+
<slot />
|
|
11
|
+
</teleport>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { computed, defineComponent, inject, onMounted, reactive, ref } from 'vue';
|
|
17
|
+
import { tabButton, tabButtonActive, tabLabel } from './style';
|
|
18
|
+
export default defineComponent({
|
|
19
|
+
name: "Tab",
|
|
20
|
+
props: {
|
|
21
|
+
value: {
|
|
22
|
+
type: [String, Number]
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
setup(props, { emit }) {
|
|
33
|
+
const computedValue = computed(() => props.value);
|
|
34
|
+
const computedLabel = computed(() => props.label || props.value);
|
|
35
|
+
const tabRef = ref<HTMLElement | null>(null);
|
|
36
|
+
const teleportTo = ref(null);
|
|
37
|
+
|
|
38
|
+
const tabs = inject("tabs", {
|
|
39
|
+
tabsContentRef: ref(null),
|
|
40
|
+
selectTab: (tab: string | number) => { },
|
|
41
|
+
state: reactive({
|
|
42
|
+
active: "",
|
|
43
|
+
type: "base"
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const computedTabClasses = computed(() => {
|
|
48
|
+
return {
|
|
49
|
+
[tabButton[tabs.state.type as keyof typeof tabButton]]: true,
|
|
50
|
+
[tabButtonActive[tabs.state.type as keyof typeof tabButtonActive]]: selected.value,
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const computedTabLabelClasses = computed(() => {
|
|
55
|
+
return {
|
|
56
|
+
[tabLabel]: true,
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
const selected = computed(() => {
|
|
62
|
+
return tabs.state.active === computedValue.value;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
function handleClick() {
|
|
66
|
+
tabs.selectTab(computedValue.value!);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
onMounted(() => {
|
|
70
|
+
teleportTo.value = tabs.tabsContentRef.value;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
computedValue,
|
|
75
|
+
computedLabel,
|
|
76
|
+
tabRef,
|
|
77
|
+
computedTabClasses,
|
|
78
|
+
computedTabLabelClasses,
|
|
79
|
+
handleClick,
|
|
80
|
+
selected,
|
|
81
|
+
teleportTo
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
</script>
|