@teammodlr/ui-kit 1.0.4 → 1.0.6
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/package.json +2 -1
- package/src/__storybook__/argTypes.ts +42 -0
- package/src/__storybook__/createStory.ts +15 -0
- package/src/__storybook__/index.ts +2 -0
- package/src/components/avatar/Avatar.css +69 -0
- package/src/components/avatar/Avatar.vue +102 -0
- package/src/components/avatar/examples/basic.vue +6 -0
- package/src/components/avatar/examples/custom-size.vue +7 -0
- package/src/components/avatar/examples/index.stories.ts +28 -0
- package/src/components/avatar/examples/index.ts +5 -0
- package/src/components/avatar/examples/sizes.vue +33 -0
- package/src/components/avatar/examples/slots.vue +7 -0
- package/src/components/avatar/examples/variants.vue +18 -0
- package/src/components/avatargroup/AvatarGroup.css +8 -0
- package/src/components/avatargroup/AvatarGroup.vue +32 -0
- package/src/components/avatargroup/examples/basic.vue +11 -0
- package/src/components/avatargroup/examples/index.stories.ts +28 -0
- package/src/components/avatargroup/examples/index.ts +1 -0
- package/src/components/breadcrumb/Breadcrumb.css +46 -0
- package/src/components/breadcrumb/Breadcrumb.vue +51 -0
- package/src/components/breadcrumb/examples/basic.vue +9 -0
- package/src/components/breadcrumb/examples/index.stories.ts +20 -0
- package/src/components/breadcrumb/examples/index.ts +1 -0
- package/src/components/breadcrumbitem/BreadcrumbItem.vue +66 -0
- package/src/components/breadcrumbitem/index.ts +1 -0
- package/src/components/button/Button.css +378 -0
- package/src/components/button/Button.vue +108 -0
- package/src/components/button/examples/basic.vue +3 -0
- package/src/components/button/examples/colors-secondary.vue +8 -0
- package/src/components/button/examples/colors.vue +8 -0
- package/src/components/button/examples/disabled.vue +3 -0
- package/src/components/button/examples/icon.vue +10 -0
- package/src/components/button/examples/index.stories.ts +33 -0
- package/src/components/button/examples/index.ts +7 -0
- package/src/components/button/examples/rounded.vue +7 -0
- package/src/components/button/examples/size.vue +7 -0
- package/src/components/buttongroup/ButtonGroup.vue +47 -0
- package/src/components/buttongroup/examples/basic.vue +9 -0
- package/src/components/buttongroup/examples/index.stories.ts +21 -0
- package/src/components/buttongroup/examples/index.ts +1 -0
- package/src/components/checkbox/Checkbox.css +185 -0
- package/src/components/checkbox/Checkbox.vue +140 -0
- package/src/components/checkbox/examples/basic.vue +9 -0
- package/src/components/checkbox/examples/index.stories.ts +21 -0
- package/src/components/checkbox/examples/index.ts +3 -0
- package/src/components/checkbox/examples/slot.vue +11 -0
- package/src/components/dropdown/Dropdown.css +68 -0
- package/src/components/dropdown/Dropdown.vue +237 -0
- package/src/components/dropdown/DropdownItem.vue +118 -0
- package/src/components/dropdown/DropdownList.vue +20 -0
- package/src/components/dropdown/DropdownWrapper.vue +17 -0
- package/src/components/dropdown/examples/basic.vue +73 -0
- package/src/components/dropdown/examples/context.vue +71 -0
- package/src/components/dropdown/examples/index.stories.ts +23 -0
- package/src/components/dropdown/examples/index.ts +2 -0
- package/src/components/dropdown/hooks.ts +30 -0
- package/src/components/form/Form.vue +141 -0
- package/src/components/form/examples/basic.vue +73 -0
- package/src/components/form/examples/index.stories.ts +23 -0
- package/src/components/form/examples/index.ts +1 -0
- package/src/components/image/Image.vue +71 -0
- package/src/components/image/examples/basic.vue +5 -0
- package/src/components/image/examples/index.stories.ts +12 -0
- package/src/components/image/examples/index.ts +1 -0
- package/src/components/index.ts +27 -0
- package/src/components/input/Input.css +173 -0
- package/src/components/input/Input.vue +176 -0
- package/src/components/input/examples/basic.vue +7 -0
- package/src/components/input/examples/index.stories.ts +24 -0
- package/src/components/input/examples/index.ts +4 -0
- package/src/components/input/examples/prefix.vue +7 -0
- package/src/components/input/examples/sizes.vue +9 -0
- package/src/components/input/examples/suffix.vue +7 -0
- package/src/components/link/Link.css +147 -0
- package/src/components/link/Link.vue +54 -0
- package/src/components/link/examples/basic.vue +3 -0
- package/src/components/link/examples/index.stories.ts +20 -0
- package/src/components/link/examples/index.ts +1 -0
- package/src/components/messageprovider/Message.vue +76 -0
- package/src/components/messageprovider/MessageProvider.css +36 -0
- package/src/components/messageprovider/MessageProvider.vue +142 -0
- package/src/components/messageprovider/examples/basic.vue +19 -0
- package/src/components/messageprovider/examples/index.stories.ts +30 -0
- package/src/components/messageprovider/examples/index.ts +1 -0
- package/src/components/messageprovider/examples/wrapper.vue +9 -0
- package/src/components/messageprovider/types.ts +39 -0
- package/src/components/messageprovider/useMessage.ts +12 -0
- package/src/components/select/Select.css +226 -0
- package/src/components/select/Select.vue +474 -0
- package/src/components/select/examples/basic.vue +20 -0
- package/src/components/select/examples/index.stories.ts +22 -0
- package/src/components/select/examples/index.ts +3 -0
- package/src/components/select/examples/multiple.vue +22 -0
- package/src/components/select/examples/searchable.vue +20 -0
- package/src/components/skeleton/Skeleton.css +73 -0
- package/src/components/skeleton/Skeleton.vue +47 -0
- package/src/components/skeleton/examples/basic.vue +3 -0
- package/src/components/skeleton/examples/index.stories.ts +24 -0
- package/src/components/skeleton/examples/index.ts +2 -0
- package/src/components/skeleton/examples/post.vue +8 -0
- package/src/components/tab/Tab.css +113 -0
- package/src/components/tab/Tab.vue +98 -0
- package/src/components/tab/TabGroup.vue +90 -0
- package/src/components/tab/examples/basic.vue +19 -0
- package/src/components/tab/examples/index.stories.ts +25 -0
- package/src/components/tab/examples/index.ts +2 -0
- package/src/components/tab/examples/vertical.vue +19 -0
- package/src/components/table/Table.css +45 -0
- package/src/components/table/Table.vue +108 -0
- package/src/components/table/TableBody.vue +13 -0
- package/src/components/table/TableCell.vue +13 -0
- package/src/components/table/TableHead.vue +22 -0
- package/src/components/table/TableHeadRow.vue +15 -0
- package/src/components/table/TableRow.vue +13 -0
- package/src/components/table/examples/basic.vue +46 -0
- package/src/components/table/examples/index.stories.ts +19 -0
- package/src/components/table/examples/index.ts +1 -0
- package/src/components/table/types/index.ts +5 -0
- package/src/components/tooltip/Tooltip.css +49 -0
- package/src/components/tooltip/Tooltip.vue +85 -0
- package/src/components/tooltip/examples/basic.vue +8 -0
- package/src/components/tooltip/examples/index.stories.ts +21 -0
- package/src/components/tooltip/examples/index.ts +1 -0
- package/src/components/virtualscroll/VirtualScroll.css +13 -0
- package/src/components/virtualscroll/VirtualScroll.vue +61 -0
- package/src/components/virtualscroll/examples/basic.vue +37 -0
- package/src/components/virtualscroll/examples/index.stories.ts +31 -0
- package/src/components/virtualscroll/examples/index.ts +1 -0
- package/src/composables/element.ts +13 -0
- package/src/composables/useCachedUid.ts +48 -0
- package/src/composables/useEventListener.ts +14 -0
- package/src/composables/useInput.ts +134 -0
- package/src/composables/useIsServer.ts +7 -0
- package/src/composables/useMount.ts +43 -0
- package/src/composables/usePopper.ts +194 -0
- package/src/create.ts +34 -0
- package/src/css/components.css +14 -0
- package/src/css/index.css +4 -0
- package/src/css/normalize.css +379 -0
- package/src/css/transitions.css +40 -0
- package/src/css/variables.css +80 -0
- package/src/exports/nuxt.js +33 -0
- package/src/exports/nuxt.plugin.js +8 -0
- package/src/index.ts +5 -0
- package/src/install.ts +8 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/types/props.ts +3 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createStory } from "@/__storybook__";
|
|
2
|
+
import MSkeleton from "../Skeleton.vue";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
MSkeletonBasic,
|
|
6
|
+
MSkeletonPost
|
|
7
|
+
} from "./index";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: MSkeleton,
|
|
11
|
+
title: 'Components/Skeleton',
|
|
12
|
+
argTypes: {
|
|
13
|
+
variant: {
|
|
14
|
+
options: ['thumb', 'line', 'circle', 'block'],
|
|
15
|
+
control: {
|
|
16
|
+
type: 'select',
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Basic = createStory(MSkeletonBasic);
|
|
24
|
+
export const Post = createStory(MSkeletonPost);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<MSkeleton variant="thumb" style="margin-bottom: 10px;" />
|
|
4
|
+
<MSkeleton variant="heading" style="margin-bottom: 10px; width: 340px;" />
|
|
5
|
+
<MSkeleton variant="line" style="margin-bottom: 6px;" />
|
|
6
|
+
<MSkeleton variant="line" />
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
.m-tab-group {
|
|
2
|
+
--tabs-gap: 14px;
|
|
3
|
+
--tabs-background: transparent;
|
|
4
|
+
--tabs-border-radius: 0;
|
|
5
|
+
--tabs-padding: 0;
|
|
6
|
+
--tabs-border: 1px solid var(--gray-200);
|
|
7
|
+
|
|
8
|
+
--tab-background: var(transparent);
|
|
9
|
+
--tab-color: var(--gray-600);
|
|
10
|
+
--tab-font-size: 15px;
|
|
11
|
+
--tab-padding: 12px 8px;
|
|
12
|
+
--tab-border-radius: 0px;
|
|
13
|
+
--tab-font-weight: 500;
|
|
14
|
+
--tab-box-shadow: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.m-tab-group__tabs {
|
|
18
|
+
background: var(--tabs-background);
|
|
19
|
+
border-radius: var(--tabs-border-radius);
|
|
20
|
+
position: relative;
|
|
21
|
+
border-bottom: var(--tabs-border);
|
|
22
|
+
display: flex;
|
|
23
|
+
min-width: 100%;
|
|
24
|
+
width: fit-content;
|
|
25
|
+
list-style: none;
|
|
26
|
+
padding: var(--tabs-padding);
|
|
27
|
+
margin: 0;
|
|
28
|
+
gap: var(--tabs-gap);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.m-tab-group__tabs .m-tab {
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.m-tab-group__tabs .m-tab .m-tabs__button {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
font-size: var(--tab-font-size);
|
|
40
|
+
font-weight: var(--tab-font-weight);
|
|
41
|
+
color: var(--tab-color);
|
|
42
|
+
background-color: var(--tab-background);
|
|
43
|
+
padding: var(--tab-padding);
|
|
44
|
+
border-radius: var(--tab-border-radius);
|
|
45
|
+
box-shadow: var(--tab-box-shadow);
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
transition: all 0.2s ease-in-out;
|
|
48
|
+
border: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.m-tab-group__tabs .m-tab:not(.m-tab--disabled) .m-tabs__button:hover {
|
|
52
|
+
--tab-background: var(transparent);
|
|
53
|
+
--tab-color: var(--blue);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.m-tab-group__tabs .m-tab.m-tab--active .m-tabs__button {
|
|
57
|
+
--tab-background: var(--white);
|
|
58
|
+
--tab-color: var(--blue);
|
|
59
|
+
--tab-box-shadow: inset 0px -2px 0px var(--blue);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.m-tab-group__tabs .m-tab.m-tab--disabled .m-tabs__button {
|
|
63
|
+
--tab-color: var(--gray-400);
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.m-tab-group.m-tab-group--xs {
|
|
68
|
+
--tabs-background: transparent;
|
|
69
|
+
--tabs-border-radius: 0;
|
|
70
|
+
--tabs-padding: 0;
|
|
71
|
+
--tabs-gap: 8px;
|
|
72
|
+
|
|
73
|
+
--tab-font-size: 12px;
|
|
74
|
+
--tab-padding: 10px 6px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.m-tab-group.m-tab-group--sm {
|
|
78
|
+
--tabs-background: transparent;
|
|
79
|
+
--tabs-border-radius: 0;
|
|
80
|
+
--tabs-padding: 0;
|
|
81
|
+
--tabs-gap: 10px;
|
|
82
|
+
|
|
83
|
+
--tab-font-size: 13px;
|
|
84
|
+
--tab-padding: 13px 6px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.m-tab-group.m-tab-group--lg {
|
|
88
|
+
--tabs-background: transparent;
|
|
89
|
+
--tabs-border-radius: 0;
|
|
90
|
+
--tabs-padding: 0;
|
|
91
|
+
|
|
92
|
+
--tab-font-size: 16px;
|
|
93
|
+
--tab-padding: 20px 12px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.m-tab-group.m-tab-group--xl {
|
|
97
|
+
--tabs-background: transparent;
|
|
98
|
+
--tabs-border-radius: 0;
|
|
99
|
+
--tabs-padding: 0;
|
|
100
|
+
|
|
101
|
+
--tab-font-size: 18px;
|
|
102
|
+
--tab-padding: 24px 16px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.m-tab-group.m-tab-group--vertical {
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.m-tab-group.m-tab-group--vertical .m-tab-group__tabs {
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
gap: 0;
|
|
112
|
+
width: 200px;
|
|
113
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li
|
|
3
|
+
:data-value="computedValue"
|
|
4
|
+
:class="computedTabWrapperClasses"
|
|
5
|
+
>
|
|
6
|
+
<button
|
|
7
|
+
role="button"
|
|
8
|
+
type="button"
|
|
9
|
+
ref="tabRef"
|
|
10
|
+
:class="computedTabClasses"
|
|
11
|
+
@click.prevent="handleClick"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
>
|
|
14
|
+
<slot
|
|
15
|
+
name="tab"
|
|
16
|
+
:label="label"
|
|
17
|
+
:value="value"
|
|
18
|
+
>
|
|
19
|
+
{{ computedLabel }}
|
|
20
|
+
</slot>
|
|
21
|
+
|
|
22
|
+
<teleport v-if="selected && teleportTo" :to="teleportTo">
|
|
23
|
+
<slot />
|
|
24
|
+
</teleport>
|
|
25
|
+
</button>
|
|
26
|
+
</li>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import { computed, defineComponent, inject, onMounted, reactive, ref } from 'vue';
|
|
31
|
+
|
|
32
|
+
export default defineComponent({
|
|
33
|
+
name: "Tab",
|
|
34
|
+
props: {
|
|
35
|
+
value: {
|
|
36
|
+
type: [String, Number]
|
|
37
|
+
},
|
|
38
|
+
label: {
|
|
39
|
+
type: String,
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
setup(props, { emit }) {
|
|
47
|
+
const computedValue = computed(() => props.value);
|
|
48
|
+
const computedLabel = computed(() => props.label || props.value);
|
|
49
|
+
const tabRef = ref<HTMLElement | null>(null);
|
|
50
|
+
const teleportTo = ref(null);
|
|
51
|
+
|
|
52
|
+
const tabs = inject("tabs", {
|
|
53
|
+
tabsContentRef: ref(null),
|
|
54
|
+
selectTab: (tab: string | number) => {},
|
|
55
|
+
state: reactive({
|
|
56
|
+
active: ""
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const computedTabWrapperClasses = computed(() => {
|
|
61
|
+
return {
|
|
62
|
+
'm-tab': true,
|
|
63
|
+
'm-tab--active': selected.value,
|
|
64
|
+
'm-tab--disabled': props.disabled
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const computedTabClasses = computed(() => {
|
|
69
|
+
return {
|
|
70
|
+
'm-tabs__button': true,
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const selected = computed(() => {
|
|
75
|
+
return tabs.state.active === computedValue.value;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
function handleClick() {
|
|
79
|
+
tabs.selectTab(computedValue.value!);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
onMounted(() => {
|
|
83
|
+
teleportTo.value = tabs.tabsContentRef.value;
|
|
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>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="computedWrapperClasses"
|
|
4
|
+
>
|
|
5
|
+
<div
|
|
6
|
+
ref="wrapperRef"
|
|
7
|
+
|
|
8
|
+
>
|
|
9
|
+
<ul
|
|
10
|
+
ref="tabsRef"
|
|
11
|
+
:class="computedTabsClasses"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</ul>
|
|
15
|
+
</div>
|
|
16
|
+
<div ref="tabsContentRef" class="m-tab-group__content"></div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import type { Size } from '../../types/props';
|
|
22
|
+
import { computed, defineComponent, provide, reactive, ref, watchEffect, type PropType } from 'vue';
|
|
23
|
+
|
|
24
|
+
export default defineComponent({
|
|
25
|
+
name: "TabGroup",
|
|
26
|
+
props: {
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: [String, Number],
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
type: String as PropType<Size>,
|
|
32
|
+
default: 'md'
|
|
33
|
+
},
|
|
34
|
+
vertical: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
emit: [
|
|
40
|
+
'update:modelValue'
|
|
41
|
+
],
|
|
42
|
+
setup(props, { emit }) {
|
|
43
|
+
const wrapperRef = ref<HTMLElement>();
|
|
44
|
+
const tabsContentRef = ref<HTMLElement>();
|
|
45
|
+
const contentRef = ref<HTMLElement>();
|
|
46
|
+
const active = ref();
|
|
47
|
+
|
|
48
|
+
watchEffect(() => {
|
|
49
|
+
active.value = props.modelValue;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const state = reactive({
|
|
53
|
+
active: computed(() => active.value)
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const computedWrapperClasses = computed(() => {
|
|
57
|
+
return {
|
|
58
|
+
'm-tab-group': true,
|
|
59
|
+
'm-tab-group--vertical': props.vertical,
|
|
60
|
+
[`m-tab-group--${props.size}`]: true
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const computedTabsClasses = computed(() => {
|
|
65
|
+
return {
|
|
66
|
+
'm-tab-group__tabs': true,
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
function selectTab(tab: string | number) {
|
|
71
|
+
active.value = tab;
|
|
72
|
+
emit('update:modelValue', tab);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
provide("tabs", {
|
|
76
|
+
tabsContentRef,
|
|
77
|
+
selectTab,
|
|
78
|
+
state
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
wrapperRef,
|
|
83
|
+
tabsContentRef,
|
|
84
|
+
contentRef,
|
|
85
|
+
computedWrapperClasses,
|
|
86
|
+
computedTabsClasses
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MTabGroup v-model="active">
|
|
3
|
+
<MTab value="one" label="One">
|
|
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
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import MTabGroup from "../TabGroup.vue";
|
|
2
|
+
import MTab from "../Tab.vue";
|
|
3
|
+
import {
|
|
4
|
+
MTabsBasic,
|
|
5
|
+
MTabsVertical
|
|
6
|
+
} from "./index";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
createStory,
|
|
10
|
+
sizeArgType
|
|
11
|
+
} from "@/__storybook__";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
component: MTabGroup,
|
|
15
|
+
subcomponents: {
|
|
16
|
+
MTab
|
|
17
|
+
},
|
|
18
|
+
title: 'Components/Tabs',
|
|
19
|
+
argTypes: {
|
|
20
|
+
...sizeArgType()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Basic = createStory(MTabsBasic);
|
|
25
|
+
export const Vertical = createStory(MTabsVertical);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MTabGroup v-model="active" vertical>
|
|
3
|
+
<MTab value="one" label="One">
|
|
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
|
+
</script>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.m-table__wrapper {
|
|
2
|
+
width: 100%;
|
|
3
|
+
overflow-x: auto;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.m-table {
|
|
7
|
+
--table-cell-padding: 10px 15px;
|
|
8
|
+
border-collapse: collapse;
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.m-table thead tr {
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.m-table thead tr th {
|
|
17
|
+
padding: var(--table-cell-padding);
|
|
18
|
+
text-align: left;
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
background-color: var(--gray-150);
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
color: var(--gray-700);
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
line-height: 15px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.m-table tbody tr:first-child td {
|
|
28
|
+
border-top: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.m-table tbody tr td {
|
|
32
|
+
padding: var(--table-cell-padding);
|
|
33
|
+
border-top: 1px solid var(--gray-150);
|
|
34
|
+
font-size: 15px;
|
|
35
|
+
line-height: 15px;
|
|
36
|
+
vertical-align: middle;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.m-table.m-table--striped tbody tr:nth-child(even) td {
|
|
40
|
+
background-color: var(--gray-50);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.m-table.m-table--hover tbody tr:hover td {
|
|
44
|
+
background-color: var(--gray-50);
|
|
45
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="wrapperComputedClasses"
|
|
4
|
+
>
|
|
5
|
+
<table
|
|
6
|
+
:class="tableComputedClasses"
|
|
7
|
+
>
|
|
8
|
+
<TableHeadRow>
|
|
9
|
+
<TableHead
|
|
10
|
+
v-for="(header, index) in headers"
|
|
11
|
+
:key="index"
|
|
12
|
+
:width="header.width"
|
|
13
|
+
>
|
|
14
|
+
{{ header.name }}
|
|
15
|
+
</TableHead>
|
|
16
|
+
</TableHeadRow>
|
|
17
|
+
<TableBody>
|
|
18
|
+
<TableRow
|
|
19
|
+
v-for="(item, index) in items"
|
|
20
|
+
:key="index"
|
|
21
|
+
>
|
|
22
|
+
<TableCell
|
|
23
|
+
v-for="(header, index) in headers"
|
|
24
|
+
:key="index"
|
|
25
|
+
>
|
|
26
|
+
<slot :name="header.key" :item="item">
|
|
27
|
+
{{//@ts-ignore
|
|
28
|
+
item[header.key] }}
|
|
29
|
+
</slot>
|
|
30
|
+
</TableCell>
|
|
31
|
+
</TableRow>
|
|
32
|
+
</TableBody>
|
|
33
|
+
</table>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
import { computed, defineComponent, type PropType } from 'vue';
|
|
39
|
+
import type { TableHeadItem } from './types';
|
|
40
|
+
import TableHeadRow from './TableHeadRow.vue';
|
|
41
|
+
import TableHead from './TableHead.vue';
|
|
42
|
+
import TableBody from './TableBody.vue';
|
|
43
|
+
import TableRow from './TableRow.vue';
|
|
44
|
+
import TableCell from './TableCell.vue';
|
|
45
|
+
|
|
46
|
+
export default defineComponent({
|
|
47
|
+
name: "Table",
|
|
48
|
+
components: {
|
|
49
|
+
TableHeadRow,
|
|
50
|
+
TableHead,
|
|
51
|
+
TableBody,
|
|
52
|
+
TableRow,
|
|
53
|
+
TableCell
|
|
54
|
+
},
|
|
55
|
+
emits: [
|
|
56
|
+
'update:sort',
|
|
57
|
+
],
|
|
58
|
+
props: {
|
|
59
|
+
headers: {
|
|
60
|
+
type: Array as PropType<Array<TableHeadItem>>,
|
|
61
|
+
default: () => [],
|
|
62
|
+
},
|
|
63
|
+
items: {
|
|
64
|
+
type: Array,
|
|
65
|
+
default: () => []
|
|
66
|
+
},
|
|
67
|
+
loading: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
striped: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
hover: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
setup(props) {
|
|
81
|
+
|
|
82
|
+
const wrapperComputedClasses = computed(() => {
|
|
83
|
+
return [
|
|
84
|
+
'm-table__wrapper',
|
|
85
|
+
{
|
|
86
|
+
'm-table__wrapper--loading': props.loading
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const tableComputedClasses = computed(() => {
|
|
92
|
+
return [
|
|
93
|
+
'm-table',
|
|
94
|
+
{
|
|
95
|
+
'm-table--loading': props.loading,
|
|
96
|
+
'm-table--striped': props.striped,
|
|
97
|
+
'm-table--hover': props.hover
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
wrapperComputedClasses,
|
|
104
|
+
tableComputedClasses
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<th>
|
|
3
|
+
<slot />
|
|
4
|
+
</th>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { defineComponent } from "vue";
|
|
9
|
+
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: "TableHead",
|
|
12
|
+
props: {
|
|
13
|
+
sort: {
|
|
14
|
+
type: Number
|
|
15
|
+
},
|
|
16
|
+
sortable: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MTable
|
|
3
|
+
:headers="headers"
|
|
4
|
+
:items="items"
|
|
5
|
+
striped
|
|
6
|
+
>
|
|
7
|
+
<template #actions="{ item }">
|
|
8
|
+
<MButton
|
|
9
|
+
color="blue"
|
|
10
|
+
secondary
|
|
11
|
+
size="sm"
|
|
12
|
+
>
|
|
13
|
+
Edit - {{ item.name }}
|
|
14
|
+
</MButton>
|
|
15
|
+
</template>
|
|
16
|
+
</MTable>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { ref } from "vue";
|
|
21
|
+
import type { TableHeadItem } from "../types";
|
|
22
|
+
|
|
23
|
+
let headers = ref<TableHeadItem[]>([
|
|
24
|
+
{
|
|
25
|
+
name: "Name",
|
|
26
|
+
key: "name",
|
|
27
|
+
width: 200
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "Age",
|
|
31
|
+
key: "age",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "Actions",
|
|
35
|
+
key: "actions"
|
|
36
|
+
}
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
let items = ref([
|
|
40
|
+
...Array.from({ length: 30 }, () => ({
|
|
41
|
+
name: "John Doe",
|
|
42
|
+
age: 4
|
|
43
|
+
}))
|
|
44
|
+
|
|
45
|
+
]);
|
|
46
|
+
</script>
|