@teammodlr/ui-kit 1.0.7 → 2.0.1
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/__storybook__/argTypes.d.ts +10 -1
- package/lib/components/avatar/Avatar.vue.d.ts +16 -30
- package/lib/components/avatar/style/Avatar.css.d.ts +9 -0
- package/lib/components/avatar/style/index.d.ts +1 -0
- package/lib/components/avatargroup/AvatarGroup.vue.d.ts +28 -13
- package/lib/components/avatargroup/style/AvatarGroup.css.d.ts +2 -0
- package/lib/components/avatargroup/style/index.d.ts +1 -0
- package/lib/components/avatargroup/symbol.d.ts +13 -0
- package/lib/components/badge/Badge.vue.d.ts +30 -0
- package/lib/components/badge/style/Badge.css.d.ts +4 -0
- package/lib/components/badge/style/index.d.ts +1 -0
- package/lib/components/breadcrumb/Breadcrumb.vue.d.ts +12 -3
- package/lib/components/{breadcrumbitem → breadcrumb}/BreadcrumbItem.vue.d.ts +11 -0
- package/lib/components/breadcrumb/style/Breadcrumb.css.d.ts +4 -0
- package/lib/components/breadcrumb/style/index.d.ts +1 -0
- package/lib/components/breadcrumb/symbol.d.ts +13 -0
- package/lib/components/button/Button.vue.d.ts +39 -28
- package/lib/components/button/style/Button.css.d.ts +24 -0
- package/lib/components/button/style/index.d.ts +1 -0
- package/lib/components/buttongroup/ButtonGroup.vue.d.ts +2 -13
- package/lib/components/buttongroup/style/ButtonGroup.css.d.ts +2 -0
- package/lib/components/buttongroup/style/index.d.ts +1 -0
- package/lib/components/buttongroup/symbol.d.ts +6 -0
- package/lib/components/checkbox/Checkbox.vue.d.ts +17 -20
- package/lib/components/checkbox/style/Checkbox.css.d.ts +16 -0
- package/lib/components/checkbox/style/index.d.ts +1 -0
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +75 -0
- package/lib/components/colorpicker/style/ColorPicker.css.d.ts +9 -0
- package/lib/components/colorpicker/style/index.d.ts +1 -0
- package/lib/components/colorpicker/utils.d.ts +16 -0
- package/lib/components/dropdown/Dropdown.vue.d.ts +5 -4
- package/lib/components/dropdown/DropdownItem.vue.d.ts +12 -5
- package/lib/components/dropdown/DropdownList.vue.d.ts +4 -1
- package/lib/components/dropdown/style/Dropdown.css.d.ts +5 -0
- package/lib/components/dropdown/style/index.d.ts +1 -0
- package/lib/components/dropdown/symbol.d.ts +6 -0
- package/lib/components/form/Form.vue.d.ts +12 -1
- package/lib/components/form/style/Form.css.d.ts +4 -0
- package/lib/components/form/style/index.d.ts +2 -0
- package/lib/components/index.d.ts +10 -1
- package/lib/components/input/Input.vue.d.ts +35 -19
- package/lib/components/input/style/Input.css.d.ts +23 -0
- package/lib/components/input/style/index.d.ts +1 -0
- package/lib/components/link/Link.vue.d.ts +2 -2
- package/lib/components/messageprovider/Message.vue.d.ts +13 -1
- package/lib/components/messageprovider/MessageProvider.vue.d.ts +6 -5
- package/lib/components/messageprovider/style/Message.css.d.ts +12 -0
- package/lib/components/messageprovider/style/index.d.ts +1 -0
- package/lib/components/messageprovider/types.d.ts +2 -1
- package/lib/components/modal/Modal.vue.d.ts +52 -0
- package/lib/components/modal/style/Modal.css.d.ts +21 -0
- package/lib/components/modal/style/index.d.ts +1 -0
- package/lib/components/radio/Radio.vue.d.ts +85 -0
- package/lib/components/radio/style/Checkbox.css.d.ts +16 -0
- package/lib/components/radio/style/index.d.ts +1 -0
- package/lib/components/radiobutton/RadioButton.vue.d.ts +98 -0
- package/lib/components/radiobutton/style/RadioButton.css.d.ts +14 -0
- package/lib/components/radiobutton/style/index.d.ts +1 -0
- package/lib/components/radiobuttongroup/RadioButtonGroup.vue.d.ts +48 -0
- package/lib/components/radiobuttongroup/style/RadioButtonGroup.css.d.ts +3 -0
- package/lib/components/radiobuttongroup/style/index.d.ts +1 -0
- package/lib/components/radiobuttongroup/symbol.d.ts +9 -0
- package/lib/components/select/Select.vue.d.ts +22 -13
- package/lib/components/select/style/Select.css.d.ts +30 -0
- package/lib/components/select/style/index.d.ts +1 -0
- package/lib/components/skeleton/Skeleton.vue.d.ts +15 -21
- package/lib/components/skeleton/style/Skeleton.css.d.ts +8 -0
- package/lib/components/skeleton/style/index.d.ts +2 -0
- package/lib/components/slider/Slider.vue.d.ts +32 -0
- package/lib/components/slider/style/Slider.css.d.ts +4 -0
- package/lib/components/slider/style/index.d.ts +1 -0
- package/lib/components/tab/TabGroup.vue.d.ts +1 -1
- package/lib/components/table/Table.vue.d.ts +1 -1
- package/lib/components/tag/Tag.vue.d.ts +44 -0
- package/lib/components/tag/style/Tag.css.d.ts +11 -0
- package/lib/components/tag/style/index.d.ts +1 -0
- package/lib/components/tooltip/Tooltip.vue.d.ts +17 -2
- package/lib/components/tooltip/style/Tooltip.css.d.ts +6 -0
- package/lib/components/tooltip/style/index.d.ts +1 -0
- package/lib/components/virtualscroll/VirtualScroll.vue.d.ts +46 -16
- package/lib/components/virtualscroll/style/VirtualScroll.css.d.ts +1 -0
- package/lib/components/virtualscroll/style/index.d.ts +1 -0
- package/lib/composables/useInput.d.ts +1 -1
- package/lib/composables/useInteractive.d.ts +15 -0
- package/lib/composables/useZIndex.d.ts +8 -0
- package/lib/index.cjs.js +8 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.es.js +3699 -1694
- package/lib/style.css +1 -1
- package/lib/styles/theme.css.d.ts +147 -0
- package/lib/styles/typography.css.d.ts +22 -0
- package/lib/types/props.d.ts +1 -0
- package/package.json +34 -26
- package/src/__storybook__/argTypes.ts +19 -1
- package/src/components/avatar/Avatar.vue +33 -26
- package/src/components/avatar/examples/index.stories.ts +1 -1
- package/src/components/avatar/style/Avatar.css.ts +92 -0
- package/src/components/avatar/style/index.ts +1 -0
- package/src/components/avatargroup/AvatarGroup.vue +71 -32
- package/src/components/avatargroup/examples/basic.vue +33 -7
- package/src/components/avatargroup/examples/index.stories.ts +4 -8
- package/src/components/avatargroup/style/AvatarGroup.css.ts +21 -0
- package/src/components/avatargroup/style/index.ts +1 -0
- package/src/components/avatargroup/symbol.ts +17 -0
- package/src/components/badge/Badge.css +128 -0
- package/src/components/badge/Badge.vue +43 -0
- package/src/components/badge/examples/basic.vue +10 -0
- package/src/components/badge/examples/index.stories.ts +21 -0
- package/src/components/badge/examples/index.ts +1 -0
- package/src/components/badge/style/Badge.css.ts +124 -0
- package/src/components/badge/style/index.ts +1 -0
- package/src/components/breadcrumb/Breadcrumb.vue +22 -15
- package/src/components/breadcrumb/BreadcrumbItem.vue +73 -0
- package/src/components/breadcrumb/examples/basic.vue +5 -7
- package/src/components/breadcrumb/examples/index.stories.ts +2 -2
- package/src/components/breadcrumb/style/Breadcrumb.css.ts +40 -0
- package/src/components/breadcrumb/style/index.ts +1 -0
- package/src/components/breadcrumb/symbol.ts +17 -0
- package/src/components/button/Button.vue +194 -107
- package/src/components/button/examples/icon-left.vue +12 -0
- package/src/components/button/examples/icon.vue +6 -7
- package/src/components/button/examples/index.stories.ts +9 -7
- package/src/components/button/examples/index.ts +3 -2
- package/src/components/button/examples/variants-secondary.vue +8 -0
- package/src/components/button/examples/variants.vue +8 -0
- package/src/components/button/style/Button.css.ts +585 -0
- package/src/components/button/style/index.ts +1 -0
- package/src/components/buttongroup/ButtonGroup.vue +36 -47
- package/src/components/buttongroup/examples/basic.vue +2 -2
- package/src/components/buttongroup/examples/icon-group.vue +22 -0
- package/src/components/buttongroup/examples/index.stories.ts +4 -2
- package/src/components/buttongroup/examples/index.ts +1 -0
- package/src/components/buttongroup/style/ButtonGroup.css.ts +40 -0
- package/src/components/buttongroup/style/index.ts +1 -0
- package/src/components/buttongroup/symbol.ts +8 -0
- package/src/components/checkbox/Checkbox.vue +70 -54
- package/src/components/checkbox/examples/index.stories.ts +1 -1
- package/src/components/checkbox/style/Checkbox.css.ts +127 -0
- package/src/components/checkbox/style/index.ts +1 -0
- package/src/components/colorpicker/ColorPicker.vue +283 -0
- package/src/components/colorpicker/examples/basic.vue +3 -0
- package/src/components/colorpicker/examples/index.stories.ts +17 -0
- package/src/components/colorpicker/examples/index.ts +1 -0
- package/src/components/colorpicker/style/ColorPicker.css.ts +97 -0
- package/src/components/colorpicker/style/index.ts +1 -0
- package/src/components/colorpicker/utils.ts +188 -0
- package/src/components/dropdown/Dropdown.vue +45 -24
- package/src/components/dropdown/DropdownItem.vue +121 -118
- package/src/components/dropdown/DropdownList.vue +3 -3
- package/src/components/dropdown/DropdownWrapper.vue +2 -1
- package/src/components/dropdown/examples/custom.vue +13 -0
- package/src/components/dropdown/examples/index.stories.ts +4 -2
- package/src/components/dropdown/examples/index.ts +1 -0
- package/src/components/dropdown/style/Dropdown.css.ts +48 -0
- package/src/components/dropdown/style/index.ts +1 -0
- package/src/components/dropdown/symbol.ts +8 -0
- package/src/components/form/Form.vue +12 -3
- package/src/components/form/examples/basic.vue +4 -2
- package/src/components/form/examples/index.stories.ts +4 -2
- package/src/components/form/style/Form.css.ts +23 -0
- package/src/components/form/style/index.ts +2 -0
- package/src/components/image/examples/index.stories.ts +1 -1
- package/src/components/index.ts +10 -2
- package/src/components/input/Input.vue +84 -42
- package/src/components/input/examples/basic.vue +2 -1
- package/src/components/input/examples/index.stories.ts +1 -1
- package/src/components/input/examples/prefix.vue +4 -2
- package/src/components/input/examples/suffix.vue +4 -2
- package/src/components/input/style/Input.css.ts +221 -0
- package/src/components/input/style/index.ts +1 -0
- package/src/components/link/examples/index.stories.ts +1 -1
- package/src/components/messageprovider/Message.vue +52 -5
- package/src/components/messageprovider/MessageProvider.css +0 -13
- package/src/components/messageprovider/MessageProvider.vue +18 -16
- package/src/components/messageprovider/examples/basic.vue +56 -5
- package/src/components/messageprovider/examples/index.stories.ts +0 -1
- package/src/components/messageprovider/examples/index.ts +1 -0
- package/src/components/messageprovider/examples/update.vue +34 -0
- package/src/components/messageprovider/examples/wrapper.vue +1 -1
- package/src/components/messageprovider/style/Message.css.ts +109 -0
- package/src/components/messageprovider/style/index.ts +1 -0
- package/src/components/messageprovider/types.ts +9 -1
- package/src/components/modal/Modal.vue +126 -0
- package/src/components/modal/examples/basic.vue +40 -0
- package/src/components/modal/examples/index.stories.ts +20 -0
- package/src/components/modal/examples/index.ts +2 -0
- package/src/components/modal/examples/modal-form.vue +99 -0
- package/src/components/modal/style/Modal.css.ts +257 -0
- package/src/components/modal/style/index.ts +1 -0
- package/src/components/radio/Checkbox.css +185 -0
- package/src/components/radio/Radio.vue +137 -0
- package/src/components/radio/examples/basic.vue +9 -0
- package/src/components/radio/examples/index.stories.ts +19 -0
- package/src/components/radio/examples/index.ts +2 -0
- package/src/components/radio/style/Checkbox.css.ts +132 -0
- package/src/components/radio/style/index.ts +1 -0
- package/src/components/radiobutton/RadioButton.vue +131 -0
- package/src/components/radiobutton/style/RadioButton.css.ts +185 -0
- package/src/components/radiobutton/style/index.ts +1 -0
- package/src/components/radiobuttongroup/RadioButtonGroup.vue +75 -0
- package/src/components/radiobuttongroup/examples/basic.vue +17 -0
- package/src/components/radiobuttongroup/examples/index.stories.ts +22 -0
- package/src/components/radiobuttongroup/examples/index.ts +2 -0
- package/src/components/radiobuttongroup/style/RadioButtonGroup.css.ts +37 -0
- package/src/components/radiobuttongroup/style/index.ts +1 -0
- package/src/components/radiobuttongroup/symbol.ts +11 -0
- package/src/components/select/Select.css +0 -226
- package/src/components/select/Select.vue +116 -48
- package/src/components/select/examples/index.stories.ts +1 -1
- package/src/components/select/examples/multiple.vue +1 -2
- package/src/components/select/style/Select.css.ts +254 -0
- package/src/components/select/style/index.ts +1 -0
- package/src/components/skeleton/Skeleton.vue +55 -47
- package/src/components/skeleton/examples/index.stories.ts +1 -8
- package/src/components/skeleton/style/Skeleton.css.ts +57 -0
- package/src/components/skeleton/style/index.ts +2 -0
- package/src/components/slider/Slider.vue +76 -0
- package/src/components/slider/style/Slider.css.ts +43 -0
- package/src/components/slider/style/index.ts +1 -0
- package/src/components/tab/examples/index.stories.ts +1 -1
- package/src/components/table/examples/index.stories.ts +1 -1
- package/src/components/tag/Tag.css +0 -0
- package/src/components/tag/Tag.vue +66 -0
- package/src/components/tag/examples/basic.vue +5 -0
- package/src/components/tag/examples/index.stories.ts +22 -0
- package/src/components/tag/examples/index.ts +1 -0
- package/src/components/tag/style/Tag.css.ts +79 -0
- package/src/components/tag/style/index.ts +1 -0
- package/src/components/tooltip/Tooltip.css +0 -6
- package/src/components/tooltip/Tooltip.vue +53 -22
- package/src/components/tooltip/examples/basic.vue +2 -5
- package/src/components/tooltip/examples/index.stories.ts +1 -1
- package/src/components/tooltip/style/Tooltip.css.ts +48 -0
- package/src/components/tooltip/style/index.ts +1 -0
- package/src/components/virtualscroll/VirtualScroll.vue +159 -53
- package/src/components/virtualscroll/examples/basic.vue +21 -27
- package/src/components/virtualscroll/examples/index.stories.ts +2 -18
- package/src/components/virtualscroll/style/VirtualScroll.css.ts +18 -0
- package/src/components/virtualscroll/style/index.ts +1 -0
- package/src/composables/useInput.ts +2 -2
- package/src/composables/useInteractive.ts +20 -0
- package/src/composables/usePopper.ts +1 -1
- package/src/composables/useZIndex.ts +31 -0
- package/src/css/components.css +4 -3
- package/src/css/normalize.css +0 -379
- package/src/css/variables.css +2 -2
- package/src/examples/cards/cards.stories.ts +9 -0
- package/src/examples/cards/sidebar.vue +263 -0
- package/src/index.ts +1 -1
- package/src/styles/theme.css.ts +149 -0
- package/src/styles/typography.css.ts +91 -0
- package/src/types/props.ts +2 -0
- package/lib/components/breadcrumbitem/index.d.ts +0 -1
- package/src/components/avatar/Avatar.css +0 -69
- package/src/components/breadcrumbitem/BreadcrumbItem.vue +0 -66
- package/src/components/breadcrumbitem/index.ts +0 -1
- package/src/components/button/examples/colors-secondary.vue +0 -8
- package/src/components/button/examples/colors.vue +0 -8
- package/src/components/dropdown/Dropdown.css +0 -68
- /package/src/components/button/{Button.css → Button-old.css} +0 -0
|
@@ -3,30 +3,37 @@
|
|
|
3
3
|
<slot />
|
|
4
4
|
</ol>
|
|
5
5
|
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
import {
|
|
9
|
-
defineComponent, reactive, computed, provide, toRef
|
|
10
|
-
} from "vue";
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import type {PropType} from "vue";
|
|
9
|
+
import {computed, defineComponent, provide, reactive, toRef} from "vue";
|
|
10
|
+
import type {BreadcrumbItemState, BreadcrumbOptions, BreadcrumbState} from "./symbol";
|
|
11
|
+
import {BREADCRUMB_STATE} from "./symbol";
|
|
12
|
+
import * as style from "./style";
|
|
16
13
|
|
|
17
14
|
export default defineComponent({
|
|
18
15
|
name: "Breadcrumb",
|
|
19
16
|
components: {
|
|
20
|
-
BreadcrumbItem: () => import(
|
|
17
|
+
BreadcrumbItem: () => import('./BreadcrumbItem.vue')
|
|
21
18
|
},
|
|
22
19
|
props: {
|
|
23
20
|
seperator: {
|
|
24
21
|
type: String,
|
|
25
22
|
default: "/"
|
|
23
|
+
},
|
|
24
|
+
options: {
|
|
25
|
+
type: Array as PropType<BreadcrumbOptions[]>,
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
setup(props) {
|
|
29
|
-
const
|
|
29
|
+
const itemStates = new Set<BreadcrumbItemState>();
|
|
30
|
+
const refreshItems = () => {
|
|
31
|
+
Array.from(itemStates).forEach((item, index) => {
|
|
32
|
+
if (!item.label) {
|
|
33
|
+
item.label = index + 1;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
30
37
|
|
|
31
38
|
const state: BreadcrumbState = reactive({
|
|
32
39
|
separator: toRef(props, 'seperator'),
|
|
@@ -34,12 +41,12 @@ export default defineComponent({
|
|
|
34
41
|
});
|
|
35
42
|
|
|
36
43
|
const classes = computed(() => {
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
return [
|
|
45
|
+
style.base
|
|
46
|
+
]
|
|
40
47
|
});
|
|
41
48
|
|
|
42
|
-
provide(
|
|
49
|
+
provide(BREADCRUMB_STATE, state);
|
|
43
50
|
|
|
44
51
|
return {
|
|
45
52
|
props,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li :class="style.item">
|
|
3
|
+
<a tabindex="0" @click="handleClick" :class="style.link">
|
|
4
|
+
<slot>{{ label }}</slot>
|
|
5
|
+
</a>
|
|
6
|
+
<span :class="style.separator" role="separator">
|
|
7
|
+
{{ separator }}
|
|
8
|
+
</span>
|
|
9
|
+
</li>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import {defineComponent, inject, onBeforeUnmount, ref, watch} from "vue";
|
|
14
|
+
|
|
15
|
+
import {BREADCRUMB_STATE} from "./symbol";
|
|
16
|
+
import * as style from "./style";
|
|
17
|
+
|
|
18
|
+
export default defineComponent({
|
|
19
|
+
name: 'BreadcrumbItem',
|
|
20
|
+
props: {
|
|
21
|
+
label: {
|
|
22
|
+
type: [String, Number],
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
onClick: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default: () => {
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
setup(props) {
|
|
32
|
+
const breadcrumbState = inject(BREADCRUMB_STATE);
|
|
33
|
+
|
|
34
|
+
const label = ref(props.label);
|
|
35
|
+
const separator = ref("/");
|
|
36
|
+
|
|
37
|
+
watch(
|
|
38
|
+
() => props.label,
|
|
39
|
+
value => {
|
|
40
|
+
label.value = value;
|
|
41
|
+
breadcrumbState?.refreshItems()
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
if (breadcrumbState) {
|
|
46
|
+
// const state: BreadcrumbItemState = reactive({
|
|
47
|
+
// label: label
|
|
48
|
+
// })
|
|
49
|
+
|
|
50
|
+
watch(() => breadcrumbState?.separator, (value) => {
|
|
51
|
+
separator.value = value
|
|
52
|
+
},
|
|
53
|
+
{immediate: true}
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
onBeforeUnmount(() => {
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const handleClick = () => {
|
|
61
|
+
props.onClick();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
label,
|
|
66
|
+
separator,
|
|
67
|
+
style,
|
|
68
|
+
handleClick
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
</script>
|
|
73
|
+
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
</MBreadcrumb>
|
|
8
|
-
</div>
|
|
2
|
+
<MBreadcrumb>
|
|
3
|
+
<MBreadcrumbItem>Home</MBreadcrumbItem>
|
|
4
|
+
<MBreadcrumbItem>Category One</MBreadcrumbItem>
|
|
5
|
+
<MBreadcrumbItem>Category Two</MBreadcrumbItem>
|
|
6
|
+
</MBreadcrumb>
|
|
9
7
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MBreadcrumb from "../Breadcrumb.vue";
|
|
2
|
-
import MBreadcrumbItem from "
|
|
2
|
+
import MBreadcrumbItem from "../BreadcrumbItem.vue";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
MBreadcrumbBasic
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
createStory
|
|
10
|
-
} from "
|
|
10
|
+
} from "../../../__storybook__";
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
13
|
component: MBreadcrumb,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {globalStyle, style} from "@vanilla-extract/css";
|
|
2
|
+
import {themeVars} from "../../../styles/theme.css";
|
|
3
|
+
|
|
4
|
+
export const base = style({
|
|
5
|
+
display: "flex",
|
|
6
|
+
position: "relative",
|
|
7
|
+
margin: 0,
|
|
8
|
+
padding: 0,
|
|
9
|
+
listStyle: "none",
|
|
10
|
+
boxSizing: "border-box",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const item = style({
|
|
14
|
+
display: "flex",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
fontSize: themeVars.fontSize.base,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const link = style({
|
|
20
|
+
padding: `0 ${themeVars.space[2]}`,
|
|
21
|
+
color: themeVars.color.gray[600],
|
|
22
|
+
cursor: "pointer",
|
|
23
|
+
textDecoration: "none",
|
|
24
|
+
outline: 0,
|
|
25
|
+
transition: `color 0.2s ${themeVars.transition.default}`,
|
|
26
|
+
":hover": {
|
|
27
|
+
color: themeVars.color.blue[500],
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const separator = style({
|
|
32
|
+
padding: `0 ${themeVars.space[1]}`,
|
|
33
|
+
display: "inline-flex",
|
|
34
|
+
color: themeVars.color.gray[300],
|
|
35
|
+
userSelect: "none"
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
globalStyle(`${base} ${item}:last-child ${separator}`, {
|
|
39
|
+
display: "none"
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Breadcrumb.css";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {InjectionKey} from "vue";
|
|
2
|
+
|
|
3
|
+
export interface BreadcrumbOptions {
|
|
4
|
+
label: string;
|
|
5
|
+
name?: string | (() => string);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface BreadcrumbItemState {
|
|
9
|
+
label: string | number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface BreadcrumbState {
|
|
13
|
+
separator: string;
|
|
14
|
+
refreshItems: () => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const BREADCRUMB_STATE: InjectionKey<BreadcrumbState> = Symbol('BREADCRUMB_STATE');
|
|
@@ -1,108 +1,195 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="computedTag" :to="to" :href="href" :type="type" :class="computedClasses" :disabled="disabled"
|
|
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
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="computedTag" :to="to" :href="href" :type="type" :class="computedClasses" :disabled="disabled"
|
|
3
|
+
@click="handleClick" v-bind="$attrs">
|
|
4
|
+
<!-- <div :class="computedWaveClasses" :key="waveTimerId"></div>-->
|
|
5
|
+
<div :class="computedBorderClasses"></div>
|
|
6
|
+
<div :class="computedBorderStateClasses"></div>
|
|
7
|
+
<span v-if="hasIconLeft" :class="iconLeft">
|
|
8
|
+
<slot name="icon-left"/>
|
|
9
|
+
</span>
|
|
10
|
+
<span>
|
|
11
|
+
<slot/>
|
|
12
|
+
</span>
|
|
13
|
+
<span v-if="hasIconRight" :class="iconRight">
|
|
14
|
+
<slot name="icon-right"/>
|
|
15
|
+
</span>
|
|
16
|
+
</component>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import type {PropType} from "vue";
|
|
21
|
+
import {computed, defineComponent, inject, nextTick, onBeforeUnmount, onMounted, ref} from "vue";
|
|
22
|
+
import type {Size, Variant} from "../../types/props";
|
|
23
|
+
import * as style from "./style";
|
|
24
|
+
import {BUTTON_GROUP_STATE} from "../buttongroup/symbol";
|
|
25
|
+
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
name: "MButton",
|
|
28
|
+
props: {
|
|
29
|
+
type: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'button',
|
|
32
|
+
},
|
|
33
|
+
variant: {
|
|
34
|
+
type: String as PropType<Variant>,
|
|
35
|
+
default: 'default'
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
type: String as PropType<Size>,
|
|
39
|
+
default: 'md'
|
|
40
|
+
},
|
|
41
|
+
rounded: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
block: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
secondary: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
to: {
|
|
58
|
+
type: [String, Object],
|
|
59
|
+
default: null
|
|
60
|
+
},
|
|
61
|
+
href: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: '',
|
|
64
|
+
},
|
|
65
|
+
link: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false
|
|
68
|
+
},
|
|
69
|
+
icon: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
onClick: {
|
|
74
|
+
type: Function as PropType<(e: MouseEvent) => void>,
|
|
75
|
+
default: () => {
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
setup(props, {slots}) {
|
|
80
|
+
const group = inject(BUTTON_GROUP_STATE, null);
|
|
81
|
+
const state = inject("dropdown", null);
|
|
82
|
+
const sizeValue = ref<Size>('md');
|
|
83
|
+
const waveActive = ref<boolean>(false);
|
|
84
|
+
const waveTimerId = ref<number | null>(0);
|
|
85
|
+
|
|
86
|
+
const dropdownOpen = computed(() => {
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
return state?.isOpen.value;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const groupSize = computed(() => {
|
|
92
|
+
return group?.size;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const size = computed<Size>(() => {
|
|
96
|
+
return groupSize.value || props.size;
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
const hasIconLeft = computed(() => !!(slots['icon-left']));
|
|
100
|
+
const hasIconRight = computed(() => !!(slots['icon-right']));
|
|
101
|
+
|
|
102
|
+
const computedClasses = computed(() => {
|
|
103
|
+
// TODO: We can use dropdownOpen (T or F) to style the open button :)
|
|
104
|
+
return [
|
|
105
|
+
style.base,
|
|
106
|
+
[style.size[size.value]],
|
|
107
|
+
style.variant[props.variant],
|
|
108
|
+
{
|
|
109
|
+
[style.rounded]: props.rounded,
|
|
110
|
+
[style.secondary[props.variant]]: props.secondary,
|
|
111
|
+
[style.block]: props.block,
|
|
112
|
+
[style.link[props.variant]]: props.link,
|
|
113
|
+
[style.iconButton]: props.icon,
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const computedWaveClasses = computed(() => {
|
|
119
|
+
return [
|
|
120
|
+
style.wave,
|
|
121
|
+
{
|
|
122
|
+
[style.waveActive]: waveActive.value
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const computedBorderClasses = computed(() => {
|
|
128
|
+
return [
|
|
129
|
+
style.border
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const computedBorderStateClasses = computed(() => {
|
|
134
|
+
return [
|
|
135
|
+
style.borderState
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const computedTag = computed(() => (props.to ? 'nuxt-link' : props.href ? 'a' : 'button'));
|
|
140
|
+
|
|
141
|
+
onMounted(() => {
|
|
142
|
+
sizeValue.value = groupSize.value || props.size;
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
onBeforeUnmount(() => {
|
|
146
|
+
if (waveTimerId.value) {
|
|
147
|
+
clearTimeout(waveTimerId.value);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// const playWave = () => {
|
|
152
|
+
// if (props.disabled || props.secondary) {
|
|
153
|
+
// return;
|
|
154
|
+
// }
|
|
155
|
+
// if (waveTimerId.value) {
|
|
156
|
+
// clearTimeout(waveTimerId.value);
|
|
157
|
+
// waveActive.value = false;
|
|
158
|
+
// waveTimerId.value = null;
|
|
159
|
+
// }
|
|
160
|
+
// nextTick(() => {
|
|
161
|
+
// waveActive.value = true;
|
|
162
|
+
// waveTimerId.value = setTimeout(() => {
|
|
163
|
+
// waveActive.value = false;
|
|
164
|
+
// waveTimerId.value = null;
|
|
165
|
+
// }, 800);
|
|
166
|
+
// })
|
|
167
|
+
// }
|
|
168
|
+
|
|
169
|
+
const handleClick = (e: MouseEvent): void => {
|
|
170
|
+
if (props.disabled) {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
// playWave();
|
|
175
|
+
props.onClick(e);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
dropdownOpen,
|
|
180
|
+
computedClasses,
|
|
181
|
+
computedWaveClasses,
|
|
182
|
+
computedBorderClasses,
|
|
183
|
+
computedBorderStateClasses,
|
|
184
|
+
computedTag,
|
|
185
|
+
hasIconLeft,
|
|
186
|
+
hasIconRight,
|
|
187
|
+
handleClick,
|
|
188
|
+
waveTimerId,
|
|
189
|
+
iconLeft: style.iconLeft,
|
|
190
|
+
iconRight: style.iconRight,
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
</script>
|
|
108
195
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton>
|
|
3
|
+
<template #icon-left>
|
|
4
|
+
<svg width="24" height="24" viewBox="0 0 24 24" role="presentation">
|
|
5
|
+
<path
|
|
6
|
+
d="M12.072 17.284l-3.905 2.053a1 1 0 01-1.451-1.054l.745-4.349-3.159-3.08a1 1 0 01.554-1.705l4.366-.635 1.953-3.956a1 1 0 011.794 0l1.952 3.956 4.366.635a1 1 0 01.555 1.705l-3.16 3.08.746 4.349a1 1 0 01-1.45 1.054l-3.906-2.053z"
|
|
7
|
+
fill="currentColor" fill-rule="evenodd"></path>
|
|
8
|
+
</svg>
|
|
9
|
+
</template>
|
|
10
|
+
Hello World
|
|
11
|
+
</MButton>
|
|
12
|
+
</template>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<MButton>
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
</
|
|
8
|
-
Hello World
|
|
2
|
+
<MButton icon>
|
|
3
|
+
<svg width="24" height="24" viewBox="0 0 24 24" role="presentation">
|
|
4
|
+
<path
|
|
5
|
+
d="M12.072 17.284l-3.905 2.053a1 1 0 01-1.451-1.054l.745-4.349-3.159-3.08a1 1 0 01.554-1.705l4.366-.635 1.953-3.956a1 1 0 011.794 0l1.952 3.956 4.366.635a1 1 0 01.555 1.705l-3.16 3.08.746 4.349a1 1 0 01-1.45 1.054l-3.906-2.053z"
|
|
6
|
+
fill="currentColor" fill-rule="evenodd"></path>
|
|
7
|
+
</svg>
|
|
9
8
|
</MButton>
|
|
10
9
|
</template>
|
|
@@ -3,23 +3,24 @@ import {
|
|
|
3
3
|
MButtonBasic,
|
|
4
4
|
MButtonSize,
|
|
5
5
|
MButtonRounded,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
MButtonVariant,
|
|
7
|
+
MButtonVariantSecondary,
|
|
8
8
|
MButtonDisabled,
|
|
9
|
+
MButtonIconLeft,
|
|
9
10
|
MButtonIcon
|
|
10
11
|
} from "./index";
|
|
11
12
|
|
|
12
13
|
import {
|
|
13
|
-
|
|
14
|
+
variantArgType,
|
|
14
15
|
createStory,
|
|
15
16
|
sizeArgType
|
|
16
|
-
} from "
|
|
17
|
+
} from "../../../__storybook__";
|
|
17
18
|
|
|
18
19
|
export default {
|
|
19
20
|
component: MButton,
|
|
20
21
|
title: 'Components/Buttons/Button',
|
|
21
22
|
argTypes: {
|
|
22
|
-
...
|
|
23
|
+
...variantArgType(),
|
|
23
24
|
...sizeArgType()
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -27,7 +28,8 @@ export default {
|
|
|
27
28
|
export const Basic = createStory(MButtonBasic);
|
|
28
29
|
export const Size = createStory(MButtonSize);
|
|
29
30
|
export const Rounded = createStory(MButtonRounded);
|
|
30
|
-
export const Colors = createStory(
|
|
31
|
-
export const ColorsSecondary = createStory(
|
|
31
|
+
export const Colors = createStory(MButtonVariant);
|
|
32
|
+
export const ColorsSecondary = createStory(MButtonVariantSecondary);
|
|
32
33
|
export const Disabled = createStory(MButtonDisabled);
|
|
34
|
+
export const IconLeft = createStory(MButtonIconLeft);
|
|
33
35
|
export const Icon = createStory(MButtonIcon);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { default as MButtonBasic } from './basic.vue';
|
|
2
2
|
export { default as MButtonSize } from './size.vue';
|
|
3
3
|
export { default as MButtonRounded } from './rounded.vue';
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
4
|
+
export { default as MButtonVariant } from './variants.vue';
|
|
5
|
+
export { default as MButtonVariantSecondary } from './variants-secondary.vue';
|
|
6
6
|
export { default as MButtonDisabled } from './disabled.vue';
|
|
7
|
+
export { default as MButtonIconLeft } from './icon-left.vue';
|
|
7
8
|
export { default as MButtonIcon } from './icon.vue';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton secondary>Default</MButton><br/><br/>
|
|
3
|
+
<MButton secondary variant="tertiary">Tertiary</MButton><br/><br/>
|
|
4
|
+
<MButton secondary variant="primary">Primary</MButton><br/><br/>
|
|
5
|
+
<MButton secondary variant="success">Success</MButton><br/><br/>
|
|
6
|
+
<MButton secondary variant="warning">Warning</MButton><br/><br/>
|
|
7
|
+
<MButton secondary variant="error">Error</MButton><br/><br/>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MButton>Default</MButton><br/><br/>
|
|
3
|
+
<MButton variant="tertiary">Tertiary</MButton><br/><br/>
|
|
4
|
+
<MButton variant="primary">Primary</MButton><br/><br/>
|
|
5
|
+
<MButton variant="success">Success</MButton><br/><br/>
|
|
6
|
+
<MButton variant="warning">Warning</MButton><br/><br/>
|
|
7
|
+
<MButton variant="error">Error</MButton><br/><br/>
|
|
8
|
+
</template>
|