@teammodlr/ui-kit 1.0.2 → 1.0.5
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 +1 -3
- 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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teammodlr/ui-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.cjs.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"lib",
|
|
10
10
|
"src",
|
|
11
|
-
"!./src/__storybook__",
|
|
12
|
-
"!src/components/**/examples",
|
|
13
11
|
"*.d.ts"
|
|
14
12
|
],
|
|
15
13
|
"exports": {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import MAvatar from "../Avatar.vue";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
MAvatarBasic,
|
|
5
|
+
MAvatarSize,
|
|
6
|
+
MAvatarCustomSize,
|
|
7
|
+
MAvatarVariant,
|
|
8
|
+
MAvatarSlot
|
|
9
|
+
} from "./index";
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
colorArgType,
|
|
13
|
+
createStory, sizeArgType
|
|
14
|
+
} from "@/__storybook__";
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
component: MAvatar,
|
|
18
|
+
title: 'Components/Avatar',
|
|
19
|
+
argTypes: {
|
|
20
|
+
...sizeArgType()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Basic = createStory(MAvatarBasic);
|
|
25
|
+
export const Sizes = createStory(MAvatarSize);
|
|
26
|
+
export const CustomSize = createStory(MAvatarCustomSize);
|
|
27
|
+
export const Variants = createStory(MAvatarVariant);
|
|
28
|
+
export const Slots = createStory(MAvatarSlot);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as MAvatarBasic } from './basic.vue';
|
|
2
|
+
export { default as MAvatarSize } from './sizes.vue';
|
|
3
|
+
export { default as MAvatarCustomSize } from './custom-size.vue';
|
|
4
|
+
export { default as MAvatarVariant } from './variants.vue';
|
|
5
|
+
export { default as MAvatarSlot } from './slots.vue';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<MAvatar
|
|
4
|
+
src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp"
|
|
5
|
+
variant="rounded"
|
|
6
|
+
size="xs"
|
|
7
|
+
/><br /><br />
|
|
8
|
+
|
|
9
|
+
<MAvatar
|
|
10
|
+
src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp"
|
|
11
|
+
variant="rounded"
|
|
12
|
+
size="sm"
|
|
13
|
+
/><br /><br />
|
|
14
|
+
|
|
15
|
+
<MAvatar
|
|
16
|
+
src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp"
|
|
17
|
+
variant="rounded"
|
|
18
|
+
size="md"
|
|
19
|
+
/><br /><br />
|
|
20
|
+
|
|
21
|
+
<MAvatar
|
|
22
|
+
src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp"
|
|
23
|
+
variant="rounded"
|
|
24
|
+
size="lg"
|
|
25
|
+
/><br /><br />
|
|
26
|
+
|
|
27
|
+
<MAvatar
|
|
28
|
+
src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp"
|
|
29
|
+
variant="rounded"
|
|
30
|
+
size="xl"
|
|
31
|
+
/><br /><br />
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<MAvatar
|
|
4
|
+
src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp"
|
|
5
|
+
variant="square"
|
|
6
|
+
/><br /><br />
|
|
7
|
+
|
|
8
|
+
<MAvatar
|
|
9
|
+
src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp"
|
|
10
|
+
variant="rounded"
|
|
11
|
+
/><br /><br />
|
|
12
|
+
|
|
13
|
+
<MAvatar
|
|
14
|
+
src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp"
|
|
15
|
+
variant="circle"
|
|
16
|
+
/><br /><br />
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<template>
|
|
4
|
+
<MAvatarGroup>
|
|
5
|
+
<MAvatar src="https://cdn.discordapp.com/avatars/314170125915783180/9f71af5f78d3188a0c92800c94112496.webp" variant="circle" />
|
|
6
|
+
<MAvatar src="https://cdn.vuetifyjs.com/images/lists/2.jpg" variant="circle" />
|
|
7
|
+
<MAvatar src="https://cdn.vuetifyjs.com/images/lists/3.jpg" variant="circle" />
|
|
8
|
+
<MAvatar src="https://cdn.vuetifyjs.com/images/lists/4.jpg" variant="circle" />
|
|
9
|
+
<MAvatar src="https://cdn.vuetifyjs.com/images/lists/5.jpg" variant="circle" />
|
|
10
|
+
</MAvatarGroup>
|
|
11
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import MAvatarGroup from "../AvatarGroup.vue";
|
|
2
|
+
import MAvatar from "../../avatar/Avatar.vue";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
MAvatarGroupBasic
|
|
6
|
+
} from "./index";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
createStory
|
|
10
|
+
} from "@/__storybook__";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
component: MAvatarGroup,
|
|
14
|
+
subcomponents: {
|
|
15
|
+
MAvatar
|
|
16
|
+
},
|
|
17
|
+
title: 'Components/Avatar Group',
|
|
18
|
+
argTypes: {
|
|
19
|
+
size: {
|
|
20
|
+
control: {
|
|
21
|
+
type: 'select',
|
|
22
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl']
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Basic = createStory(MAvatarGroupBasic);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MAvatarGroupBasic } from './basic.vue';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import MBreadcrumb from "../Breadcrumb.vue";
|
|
2
|
+
import MBreadcrumbItem from "../../breadcrumbitem/BreadcrumbItem.vue";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
MBreadcrumbBasic
|
|
6
|
+
} from "./index";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
createStory
|
|
10
|
+
} from "@/__storybook__";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
component: MBreadcrumb,
|
|
14
|
+
subcomponents: {
|
|
15
|
+
MBreadcrumbItem
|
|
16
|
+
},
|
|
17
|
+
title: 'Components/Breadcrumb',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Basic = createStory(MBreadcrumbBasic);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MBreadcrumbBasic } from './basic.vue';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton secondary>Default</MButton><br/><br/>
|
|
3
|
+
<MButton color="gray" secondary>Gray</MButton><br/><br/>
|
|
4
|
+
<MButton color="blue" secondary>Blue</MButton><br/><br/>
|
|
5
|
+
<MButton color="green" secondary>Green</MButton><br/><br/>
|
|
6
|
+
<MButton color="red" secondary>Red</MButton><br/><br/>
|
|
7
|
+
<MButton color="yellow" secondary>Yellow</MButton><br/><br/>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton>Default</MButton><br/><br/>
|
|
3
|
+
<MButton color="gray">Gray</MButton><br/><br/>
|
|
4
|
+
<MButton color="blue">Blue</MButton><br/><br/>
|
|
5
|
+
<MButton color="green">Green</MButton><br/><br/>
|
|
6
|
+
<MButton color="red">Red</MButton><br/><br/>
|
|
7
|
+
<MButton color="yellow">Yellow</MButton><br/><br/>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton>
|
|
3
|
+
<template #icon-left>
|
|
4
|
+
<svg style="width: 20px; height: 20px;" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
|
5
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75" />
|
|
6
|
+
</svg>
|
|
7
|
+
</template>
|
|
8
|
+
Hello World
|
|
9
|
+
</MButton>
|
|
10
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import MButton from "../Button.vue";
|
|
2
|
+
import {
|
|
3
|
+
MButtonBasic,
|
|
4
|
+
MButtonSize,
|
|
5
|
+
MButtonRounded,
|
|
6
|
+
MButtonColor,
|
|
7
|
+
MButtonColorSecondary,
|
|
8
|
+
MButtonDisabled,
|
|
9
|
+
MButtonIcon
|
|
10
|
+
} from "./index";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
colorArgType,
|
|
14
|
+
createStory,
|
|
15
|
+
sizeArgType
|
|
16
|
+
} from "@/__storybook__";
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
component: MButton,
|
|
20
|
+
title: 'Components/Buttons/Button',
|
|
21
|
+
argTypes: {
|
|
22
|
+
...colorArgType(),
|
|
23
|
+
...sizeArgType()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Basic = createStory(MButtonBasic);
|
|
28
|
+
export const Size = createStory(MButtonSize);
|
|
29
|
+
export const Rounded = createStory(MButtonRounded);
|
|
30
|
+
export const Colors = createStory(MButtonColor);
|
|
31
|
+
export const ColorsSecondary = createStory(MButtonColorSecondary);
|
|
32
|
+
export const Disabled = createStory(MButtonDisabled);
|
|
33
|
+
export const Icon = createStory(MButtonIcon);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as MButtonBasic } from './basic.vue';
|
|
2
|
+
export { default as MButtonSize } from './size.vue';
|
|
3
|
+
export { default as MButtonRounded } from './rounded.vue';
|
|
4
|
+
export { default as MButtonColor } from './colors.vue';
|
|
5
|
+
export { default as MButtonColorSecondary } from './colors-secondary.vue';
|
|
6
|
+
export { default as MButtonDisabled } from './disabled.vue';
|
|
7
|
+
export { default as MButtonIcon } from './icon.vue';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton size="xs" rounded>Extra Small</MButton><br/><br/>
|
|
3
|
+
<MButton size="sm" rounded>Small</MButton><br/><br/>
|
|
4
|
+
<MButton size="md" rounded>Default</MButton><br/><br/>
|
|
5
|
+
<MButton size="lg" rounded>Large</MButton><br/><br/>
|
|
6
|
+
<MButton size="xl" rounded>Extra Large</MButton><br/><br/>
|
|
7
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton size="xs">Extra Small</MButton><br/><br/>
|
|
3
|
+
<MButton size="sm">Small</MButton><br/><br/>
|
|
4
|
+
<MButton size="md">Default</MButton><br/><br/>
|
|
5
|
+
<MButton size="lg">Large</MButton><br/><br/>
|
|
6
|
+
<MButton size="xl">Extra Large</MButton><br/><br/>
|
|
7
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import MButtonGroup from "../ButtonGroup.vue";
|
|
2
|
+
import MButton from "../../button/Button.vue";
|
|
3
|
+
import {
|
|
4
|
+
MButtonGroupBasic
|
|
5
|
+
} from "./index";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
createStory,
|
|
9
|
+
sizeArgType
|
|
10
|
+
} from "@/__storybook__";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
component: MButtonGroup,
|
|
14
|
+
subcomponents: { MButton },
|
|
15
|
+
title: 'Components/Buttons/Group',
|
|
16
|
+
argTypes: {
|
|
17
|
+
...sizeArgType()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Basic = createStory(MButtonGroupBasic);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MButtonGroupBasic } from './basic.vue';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import MCheckbox from "../Checkbox.vue";
|
|
2
|
+
import {
|
|
3
|
+
MCheckboxBasic,
|
|
4
|
+
MCheckboxSlot
|
|
5
|
+
} from "./index";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
createStory, sizeArgType, colorArgType
|
|
9
|
+
} from "@/__storybook__";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
component: MCheckbox,
|
|
13
|
+
title: 'Components/Checkbox',
|
|
14
|
+
argTypes: {
|
|
15
|
+
...sizeArgType(),
|
|
16
|
+
...colorArgType()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Basic = createStory(MCheckboxBasic);
|
|
21
|
+
export const Slot = createStory(MCheckboxSlot);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MDropdown>
|
|
3
|
+
<MButton>
|
|
4
|
+
Menu
|
|
5
|
+
</MButton>
|
|
6
|
+
|
|
7
|
+
<template #menu>
|
|
8
|
+
<MDropdownList>
|
|
9
|
+
<MDropdownItem hotkey="Ctrl+L" @click="handleClick">
|
|
10
|
+
Item One
|
|
11
|
+
</MDropdownItem>
|
|
12
|
+
<MDropdownItem>
|
|
13
|
+
Item Two
|
|
14
|
+
</MDropdownItem>
|
|
15
|
+
|
|
16
|
+
<MDropdown>
|
|
17
|
+
<MDropdownItem>
|
|
18
|
+
<template #icon-right>
|
|
19
|
+
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
|
21
|
+
<path fill-rule="evenodd"
|
|
22
|
+
d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z"
|
|
23
|
+
clip-rule="evenodd" />
|
|
24
|
+
</svg>
|
|
25
|
+
|
|
26
|
+
</template>
|
|
27
|
+
Item Three (Parent)
|
|
28
|
+
</MDropdownItem>
|
|
29
|
+
|
|
30
|
+
<template #menu>
|
|
31
|
+
<MDropdownList>
|
|
32
|
+
<MDropdownItem @click="handleClick">
|
|
33
|
+
Child One
|
|
34
|
+
</MDropdownItem>
|
|
35
|
+
<MDropdown>
|
|
36
|
+
<MDropdownItem>
|
|
37
|
+
<template #icon-right>
|
|
38
|
+
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
39
|
+
viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
|
40
|
+
<path fill-rule="evenodd"
|
|
41
|
+
d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z"
|
|
42
|
+
clip-rule="evenodd" />
|
|
43
|
+
</svg>
|
|
44
|
+
|
|
45
|
+
</template>
|
|
46
|
+
Item Three (Parent)
|
|
47
|
+
</MDropdownItem>
|
|
48
|
+
|
|
49
|
+
<template #menu>
|
|
50
|
+
<MDropdownList>
|
|
51
|
+
<MDropdownItem @click="handleClick">
|
|
52
|
+
Child One
|
|
53
|
+
</MDropdownItem>
|
|
54
|
+
<MDropdownItem>
|
|
55
|
+
Child Two
|
|
56
|
+
</MDropdownItem>
|
|
57
|
+
</MDropdownList>
|
|
58
|
+
</template>
|
|
59
|
+
</MDropdown>
|
|
60
|
+
</MDropdownList>
|
|
61
|
+
</template>
|
|
62
|
+
</MDropdown>
|
|
63
|
+
</MDropdownList>
|
|
64
|
+
</template>
|
|
65
|
+
</MDropdown>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script lang="ts" setup>
|
|
69
|
+
|
|
70
|
+
const handleClick = () => {
|
|
71
|
+
alert('hi');
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div style="background: #eee; width: 500px; height: 500px;" @contextmenu="handleContextMenu">
|
|
4
|
+
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<MDropdown :virtual="position" :open="showing">
|
|
8
|
+
<template #menu>
|
|
9
|
+
<MDropdownList>
|
|
10
|
+
<MDropdownItem>
|
|
11
|
+
Item One
|
|
12
|
+
</MDropdownItem>
|
|
13
|
+
<MDropdownItem>
|
|
14
|
+
Item Two
|
|
15
|
+
</MDropdownItem>
|
|
16
|
+
|
|
17
|
+
<MDropdown>
|
|
18
|
+
<MDropdownItem>
|
|
19
|
+
<template #icon-right>
|
|
20
|
+
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
|
22
|
+
<path fill-rule="evenodd"
|
|
23
|
+
d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z"
|
|
24
|
+
clip-rule="evenodd" />
|
|
25
|
+
</svg>
|
|
26
|
+
|
|
27
|
+
</template>
|
|
28
|
+
Item Three (Parent)
|
|
29
|
+
</MDropdownItem>
|
|
30
|
+
|
|
31
|
+
<template #menu>
|
|
32
|
+
<MDropdownList>
|
|
33
|
+
<MDropdownItem @click="handleClick">
|
|
34
|
+
Child One
|
|
35
|
+
</MDropdownItem>
|
|
36
|
+
<MDropdownItem>
|
|
37
|
+
Child Two
|
|
38
|
+
</MDropdownItem>
|
|
39
|
+
</MDropdownList>
|
|
40
|
+
</template>
|
|
41
|
+
</MDropdown>
|
|
42
|
+
</MDropdownList>
|
|
43
|
+
</template>
|
|
44
|
+
</MDropdown>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script lang="ts" setup>
|
|
49
|
+
import { nextTick, ref, reactive } from 'vue';
|
|
50
|
+
|
|
51
|
+
const showing = ref(false);
|
|
52
|
+
const position = reactive({
|
|
53
|
+
x: 0,
|
|
54
|
+
y: 0
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const handleContextMenu = (e: MouseEvent) => {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
showing.value = false;
|
|
60
|
+
nextTick().then(() => {
|
|
61
|
+
showing.value = true;
|
|
62
|
+
|
|
63
|
+
position.x = e.clientX;
|
|
64
|
+
position.y = e.clientY;
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const handleClick = () => {
|
|
69
|
+
alert('hi');
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import MDropdown from '../Dropdown.vue';
|
|
2
|
+
import MDropdownList from '../DropdownList.vue';
|
|
3
|
+
import MDropdownItem from '../DropdownItem.vue';
|
|
4
|
+
import MButton from '../../button/Button.vue';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
MDropdownBasic,
|
|
8
|
+
MDropdownContext
|
|
9
|
+
} from './index';
|
|
10
|
+
import { createStory } from '@/__storybook__';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
component: MDropdown,
|
|
14
|
+
subcomponents: {
|
|
15
|
+
MDropdownList,
|
|
16
|
+
MDropdownItem,
|
|
17
|
+
MButton
|
|
18
|
+
},
|
|
19
|
+
title: 'Components/Dropdown'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Basic = createStory(MDropdownBasic);
|
|
23
|
+
export const Context = createStory(MDropdownContext);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MForm @submit="onSubmit" :loading="loading">
|
|
3
|
+
<MInput
|
|
4
|
+
label="Email"
|
|
5
|
+
placeholder="Email Address"
|
|
6
|
+
name="email"
|
|
7
|
+
v-model="email"
|
|
8
|
+
:rules="[rules.isRequired, rules.isEmail]"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<MInput
|
|
12
|
+
label="Name"
|
|
13
|
+
placeholder="Name"
|
|
14
|
+
name="name"
|
|
15
|
+
v-model="name"
|
|
16
|
+
:rules="[rules.isRequired]"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<MSelect
|
|
20
|
+
label="Option"
|
|
21
|
+
v-model="option"
|
|
22
|
+
:options="options"
|
|
23
|
+
:option-value="'id'"
|
|
24
|
+
:option-label="'name'"
|
|
25
|
+
:rules="[rules.isRequired]"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<MCheckbox
|
|
29
|
+
label="Agree to terms"
|
|
30
|
+
v-model="agree"
|
|
31
|
+
:rules="[rules.isRequired]"
|
|
32
|
+
>
|
|
33
|
+
Something here!
|
|
34
|
+
</MCheckbox>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
<MButton type="submit" color="blue">Submit</MButton>
|
|
38
|
+
</MForm>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script lang="ts" setup>
|
|
42
|
+
import { MCheckbox, MSelect } from '@/components';
|
|
43
|
+
import { ref } from 'vue';
|
|
44
|
+
|
|
45
|
+
const rules = {
|
|
46
|
+
isEmail: (v: any) => /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || 'E-mail must be valid',
|
|
47
|
+
isRequired: (v: any) => !!v || 'Field is required',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const options = Array.from({ length: 50 }, (_, i) => ({
|
|
51
|
+
id: i+1,
|
|
52
|
+
name: `Option ${i+1}`
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
const loading = ref(false);
|
|
56
|
+
const email = ref('');
|
|
57
|
+
const name = ref('');
|
|
58
|
+
const option = ref('');
|
|
59
|
+
const agree = ref(false);
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
function onSubmit(valid: boolean) {
|
|
63
|
+
if (valid) {
|
|
64
|
+
loading.value = true;
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
console.log('submit', { email: email.value, name: name.value });
|
|
67
|
+
loading.value = false;
|
|
68
|
+
}, 3000);
|
|
69
|
+
} else {
|
|
70
|
+
console.log('invalid');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</script>
|