@teammodlr/ui-kit 2.0.21 → 2.0.23
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 +40 -40
- package/lib/__storybook__/createStory.d.ts +8 -8
- package/lib/__storybook__/index.d.ts +2 -2
- package/lib/components/avatar/Avatar.vue.d.ts +56 -56
- package/lib/components/avatar/style/Avatar.css.d.ts +9 -9
- package/lib/components/avatar/style/index.d.ts +1 -1
- package/lib/components/avatargroup/AvatarGroup.vue.d.ts +49 -49
- package/lib/components/avatargroup/style/AvatarGroup.css.d.ts +2 -2
- package/lib/components/avatargroup/style/index.d.ts +1 -1
- package/lib/components/avatargroup/symbol.d.ts +13 -13
- package/lib/components/badge/Badge.vue.d.ts +30 -30
- package/lib/components/badge/style/Badge.css.d.ts +4 -4
- package/lib/components/badge/style/index.d.ts +1 -1
- package/lib/components/breadcrumb/Breadcrumb.vue.d.ts +34 -34
- package/lib/components/breadcrumb/BreadcrumbItem.vue.d.ts +29 -29
- package/lib/components/breadcrumb/style/Breadcrumb.css.d.ts +4 -4
- package/lib/components/breadcrumb/style/index.d.ts +1 -1
- package/lib/components/breadcrumb/symbol.d.ts +13 -13
- package/lib/components/button/Button.vue.d.ts +141 -141
- package/lib/components/button/style/Button.css.d.ts +25 -25
- package/lib/components/button/style/index.d.ts +1 -1
- package/lib/components/buttongroup/ButtonGroup.vue.d.ts +18 -18
- package/lib/components/buttongroup/style/ButtonGroup.css.d.ts +2 -2
- package/lib/components/buttongroup/style/index.d.ts +1 -1
- package/lib/components/buttongroup/symbol.d.ts +6 -6
- package/lib/components/checkbox/Checkbox.vue.d.ts +94 -94
- package/lib/components/checkbox/style/Checkbox.css.d.ts +16 -16
- package/lib/components/checkbox/style/index.d.ts +1 -1
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +77 -77
- package/lib/components/colorpicker/style/ColorPicker.css.d.ts +10 -10
- package/lib/components/colorpicker/style/index.d.ts +1 -1
- package/lib/components/colorpicker/utils.d.ts +16 -16
- package/lib/components/dropdown/Dropdown.vue.d.ts +122 -122
- package/lib/components/dropdown/DropdownItem.vue.d.ts +78 -78
- package/lib/components/dropdown/DropdownList.vue.d.ts +5 -5
- package/lib/components/dropdown/DropdownSeperator.vue.d.ts +4 -4
- package/lib/components/dropdown/DropdownWrapper.vue.d.ts +2 -2
- package/lib/components/dropdown/hooks.d.ts +2 -2
- package/lib/components/dropdown/style/Dropdown.css.d.ts +6 -6
- package/lib/components/dropdown/style/index.d.ts +1 -1
- package/lib/components/dropdown/symbol.d.ts +6 -6
- package/lib/components/form/Form.vue.d.ts +75 -75
- package/lib/components/form/style/Form.css.d.ts +4 -4
- package/lib/components/form/style/index.d.ts +2 -2
- package/lib/components/form/symbol.d.ts +9 -9
- package/lib/components/image/Image.vue.d.ts +50 -50
- package/lib/components/index.d.ts +40 -39
- package/lib/components/input/Input.vue.d.ts +142 -142
- package/lib/components/input/style/Input.css.d.ts +23 -23
- package/lib/components/input/style/index.d.ts +1 -1
- package/lib/components/link/Link.vue.d.ts +51 -51
- package/lib/components/messageprovider/Message.vue.d.ts +73 -73
- package/lib/components/messageprovider/MessageProvider.vue.d.ts +52 -52
- package/lib/components/messageprovider/style/Message.css.d.ts +12 -12
- package/lib/components/messageprovider/style/index.d.ts +1 -1
- package/lib/components/messageprovider/types.d.ts +29 -29
- package/lib/components/messageprovider/useMessage.d.ts +2 -2
- package/lib/components/modal/Modal.vue.d.ts +52 -52
- package/lib/components/modal/style/Modal.css.d.ts +21 -21
- package/lib/components/modal/style/index.d.ts +1 -1
- package/lib/components/pagination/Pagination.vue.d.ts +75 -75
- package/lib/components/pagination/style/Pagination.css.d.ts +10 -10
- package/lib/components/pagination/style/index.d.ts +1 -1
- package/lib/components/radio/Radio.vue.d.ts +85 -85
- package/lib/components/radio/style/Checkbox.css.d.ts +16 -16
- package/lib/components/radio/style/index.d.ts +1 -1
- package/lib/components/radiobutton/RadioButton.vue.d.ts +98 -98
- package/lib/components/radiobutton/style/RadioButton.css.d.ts +14 -14
- package/lib/components/radiobutton/style/index.d.ts +1 -1
- package/lib/components/radiobuttongroup/RadioButtonGroup.vue.d.ts +48 -48
- package/lib/components/radiobuttongroup/style/RadioButtonGroup.css.d.ts +3 -3
- package/lib/components/radiobuttongroup/style/index.d.ts +1 -1
- package/lib/components/radiobuttongroup/symbol.d.ts +9 -9
- package/lib/components/select/Select.vue.d.ts +194 -194
- package/lib/components/select/style/Select.css.d.ts +31 -31
- package/lib/components/select/style/index.d.ts +1 -1
- package/lib/components/skeleton/Skeleton.vue.d.ts +33 -33
- package/lib/components/skeleton/style/Skeleton.css.d.ts +8 -8
- package/lib/components/skeleton/style/index.d.ts +2 -2
- package/lib/components/slider/Slider.vue.d.ts +32 -32
- package/lib/components/slider/style/Slider.css.d.ts +4 -4
- package/lib/components/slider/style/index.d.ts +1 -1
- package/lib/components/tab/Tab.vue.d.ts +41 -41
- package/lib/components/tab/TabGroup.vue.d.ts +43 -43
- package/lib/components/table/Table.vue.d.ts +62 -62
- package/lib/components/table/TableBody.vue.d.ts +2 -2
- package/lib/components/table/TableCell.vue.d.ts +2 -2
- package/lib/components/table/TableHead.vue.d.ts +30 -30
- package/lib/components/table/TableHeadRow.vue.d.ts +2 -2
- package/lib/components/table/TableRow.vue.d.ts +2 -2
- package/lib/components/table/style/Table.css.d.ts +4 -4
- package/lib/components/table/style/index.d.ts +1 -1
- package/lib/components/table/types/index.d.ts +6 -6
- package/lib/components/tag/Tag.vue.d.ts +44 -44
- package/lib/components/tag/style/Tag.css.d.ts +11 -11
- package/lib/components/tag/style/index.d.ts +1 -1
- package/lib/components/textarea/TextArea.vue.d.ts +137 -0
- package/lib/components/textarea/style/TextArea.css.d.ts +19 -0
- package/lib/components/textarea/style/index.d.ts +1 -0
- package/lib/components/tooltip/Tooltip.vue.d.ts +71 -71
- package/lib/components/tooltip/style/Tooltip.css.d.ts +10 -10
- package/lib/components/tooltip/style/index.d.ts +1 -1
- package/lib/components/transfer/Transfer.vue.d.ts +67 -67
- package/lib/components/transfer/style/Transfer.css.d.ts +7 -7
- package/lib/components/transfer/style/index.d.ts +1 -1
- package/lib/components/virtualscroll/VirtualScroll.vue.d.ts +73 -73
- package/lib/components/virtualscroll/style/VirtualScroll.css.d.ts +1 -1
- package/lib/components/virtualscroll/style/index.d.ts +1 -1
- package/lib/composables/element.d.ts +2 -2
- package/lib/composables/index.d.ts +3 -3
- package/lib/composables/useCachedUid.d.ts +13 -13
- package/lib/composables/useEventListener.d.ts +1 -1
- package/lib/composables/useInput.d.ts +36 -36
- package/lib/composables/useInteractive.d.ts +15 -15
- package/lib/composables/useIsServer.d.ts +1 -1
- package/lib/composables/useMount.d.ts +13 -13
- package/lib/composables/usePopper.d.ts +31 -31
- package/lib/composables/useZIndex.d.ts +8 -8
- package/lib/create.d.ts +9 -9
- package/lib/index.cjs.js +4 -4
- package/lib/index.d.ts +5 -5
- package/lib/index.es.js +1746 -1585
- package/lib/install.d.ts +4 -4
- package/lib/style.css +1 -1
- package/lib/styles/theme.css.d.ts +167 -167
- package/lib/styles/typography.css.d.ts +22 -22
- package/lib/types/props.d.ts +3 -3
- package/package.json +11 -11
- package/src/components/avatargroup/AvatarGroup.vue +71 -71
- package/src/components/avatargroup/symbol.ts +16 -16
- package/src/components/breadcrumb/BreadcrumbItem.vue +72 -72
- package/src/components/breadcrumb/style/Breadcrumb.css.ts +39 -39
- package/src/components/breadcrumb/symbol.ts +16 -16
- package/src/components/button/Button.vue +203 -203
- package/src/components/buttongroup/ButtonGroup.vue +36 -36
- package/src/components/buttongroup/symbol.ts +7 -7
- package/src/components/dropdown/DropdownItem.vue +134 -134
- package/src/components/dropdown/DropdownSeperator.vue +22 -22
- package/src/components/dropdown/symbol.ts +7 -7
- package/src/components/form/style/Form.css.ts +22 -22
- package/src/components/form/style/index.ts +1 -1
- package/src/components/form/symbol.ts +10 -10
- package/src/components/index.ts +2 -1
- package/src/components/modal/examples/index.ts +2 -2
- package/src/components/pagination/Pagination.vue +229 -229
- package/src/components/pagination/examples/basic.vue +17 -17
- package/src/components/pagination/examples/index.stories.ts +14 -14
- package/src/components/pagination/style/Pagination.css.ts +87 -87
- package/src/components/pagination/style/index.ts +1 -1
- package/src/components/radiobutton/RadioButton.vue +131 -131
- package/src/components/radiobutton/style/RadioButton.css.ts +183 -183
- package/src/components/radiobutton/style/index.ts +1 -1
- package/src/components/radiobuttongroup/RadioButtonGroup.vue +74 -74
- package/src/components/radiobuttongroup/style/RadioButtonGroup.css.ts +36 -36
- package/src/components/radiobuttongroup/symbol.ts +10 -10
- package/src/components/skeleton/Skeleton.vue +55 -55
- package/src/components/skeleton/style/Skeleton.css.ts +56 -56
- package/src/components/skeleton/style/index.ts +1 -1
- package/src/components/table/Table.vue +4 -1
- package/src/components/table/style/Table.css.ts +80 -80
- package/src/components/textarea/TextArea.css +173 -0
- package/src/components/textarea/TextArea.vue +181 -0
- package/src/components/textarea/examples/basic.vue +8 -0
- package/src/components/textarea/examples/index.stories.ts +18 -0
- package/src/components/textarea/examples/index.ts +1 -0
- package/src/components/textarea/style/TextArea.css.ts +190 -0
- package/src/components/textarea/style/index.ts +1 -0
- package/src/components/tooltip/style/Tooltip.css.ts +91 -91
- package/src/components/tooltip/style/index.ts +1 -1
- package/src/components/transfer/Transfer.vue +143 -143
- package/src/components/transfer/examples/basic.vue +20 -20
- package/src/components/transfer/examples/index.stories.ts +15 -15
- package/src/components/transfer/examples/index.ts +1 -1
- package/src/components/transfer/style/Transfer.css.ts +67 -67
- package/src/components/transfer/style/index.ts +1 -1
- package/src/composables/index.ts +2 -2
- package/src/composables/useInteractive.ts +19 -19
- package/src/composables/useZIndex.ts +30 -30
- package/src/examples/cards/cards.stories.ts +9 -9
- package/src/examples/cards/sidebar.vue +262 -262
- package/src/styles/theme.css.ts +170 -170
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teammodlr/ui-kit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.cjs.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"@capsizecss/vanilla-extract": "^1.0.0",
|
|
45
45
|
"@nuxt/kit": "^3.3.2",
|
|
46
46
|
"@nuxt/schema": "^3.3.2",
|
|
47
|
-
"@storybook/addon-actions": "^7.0.
|
|
48
|
-
"@storybook/addon-essentials": "^7.0.
|
|
49
|
-
"@storybook/addon-interactions": "^7.0.
|
|
50
|
-
"@storybook/addon-links": "^7.0.
|
|
51
|
-
"@storybook/addons": "^7.0.
|
|
52
|
-
"@storybook/testing-library": "^0.
|
|
53
|
-
"@storybook/theming": "^7.0.
|
|
54
|
-
"@storybook/vue3": "^7.0.
|
|
55
|
-
"@storybook/vue3-vite": "^7.0.
|
|
47
|
+
"@storybook/addon-actions": "^7.0.22",
|
|
48
|
+
"@storybook/addon-essentials": "^7.0.22",
|
|
49
|
+
"@storybook/addon-interactions": "^7.0.22",
|
|
50
|
+
"@storybook/addon-links": "^7.0.22",
|
|
51
|
+
"@storybook/addons": "^7.0.22",
|
|
52
|
+
"@storybook/testing-library": "^0.2.0",
|
|
53
|
+
"@storybook/theming": "^7.0.22",
|
|
54
|
+
"@storybook/vue3": "^7.0.22",
|
|
55
|
+
"@storybook/vue3-vite": "^7.0.22",
|
|
56
56
|
"@types/jsdom": "^21.1.0",
|
|
57
57
|
"@types/node": "^18.14.1",
|
|
58
58
|
"@vanilla-extract/css": "^1.9.5",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"bumpp": "^9.1.0",
|
|
65
65
|
"react": "^18.2.0",
|
|
66
66
|
"react-dom": "^18.2.0",
|
|
67
|
-
"storybook": "^7.0.
|
|
67
|
+
"storybook": "^7.0.22",
|
|
68
68
|
"ts-node": "^10.9.1",
|
|
69
69
|
"typescript": "^4.9.5",
|
|
70
70
|
"vite": "^4.2.1",
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul :class="style.base">
|
|
3
|
-
<li v-for="(option, index) in avatars" :key="index" :class="style.item">
|
|
4
|
-
<div style="display: inline-block; position: relative; outline: 0;" :style="{ zIndex: (avatars.length - index)}">
|
|
5
|
-
<MAvatar :src="option.src" :srcSet="option.srcSet" :alt="option.alt" />
|
|
6
|
-
</div>
|
|
7
|
-
</li>
|
|
8
|
-
<li v-if="options && options.length > max">
|
|
9
|
-
<MAvatar>
|
|
10
|
-
+{{ remaining }}
|
|
11
|
-
</MAvatar>
|
|
12
|
-
</li>
|
|
13
|
-
</ul>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script lang="ts">
|
|
17
|
-
import {computed, defineComponent, type PropType, provide, reactive, toRef} from 'vue';
|
|
18
|
-
import * as style from './style';
|
|
19
|
-
import type {AvatarGroupState, Options} from './symbol';
|
|
20
|
-
import type {Size} from "../../types/props";
|
|
21
|
-
import {AVATAR_GROUP_STATE} from "./symbol";
|
|
22
|
-
|
|
23
|
-
export default defineComponent({
|
|
24
|
-
name: "MAvatarGroup",
|
|
25
|
-
components: {
|
|
26
|
-
MAvatar: () => import('../avatar/Avatar.vue')
|
|
27
|
-
},
|
|
28
|
-
props: {
|
|
29
|
-
options: {
|
|
30
|
-
type: Array as PropType<Options[]>,
|
|
31
|
-
default: () => []
|
|
32
|
-
},
|
|
33
|
-
max: {
|
|
34
|
-
type: Number,
|
|
35
|
-
default: 5
|
|
36
|
-
},
|
|
37
|
-
size: {
|
|
38
|
-
type: String as PropType<Size>,
|
|
39
|
-
default: 'md'
|
|
40
|
-
},
|
|
41
|
-
rounded: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: false
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
setup(props) {
|
|
47
|
-
const state: AvatarGroupState = reactive({
|
|
48
|
-
size: toRef(props, 'size'),
|
|
49
|
-
rounded: toRef(props, 'rounded'),
|
|
50
|
-
max: toRef(props, 'max')
|
|
51
|
-
})
|
|
52
|
-
provide(AVATAR_GROUP_STATE, state);
|
|
53
|
-
|
|
54
|
-
const avatars = computed(() => {
|
|
55
|
-
return props.options.slice(0, props.max);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const remaining = computed(() => {
|
|
59
|
-
return props.options.length - props.max;
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
style,
|
|
64
|
-
avatars,
|
|
65
|
-
remaining
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<ul :class="style.base">
|
|
3
|
+
<li v-for="(option, index) in avatars" :key="index" :class="style.item">
|
|
4
|
+
<div style="display: inline-block; position: relative; outline: 0;" :style="{ zIndex: (avatars.length - index)}">
|
|
5
|
+
<MAvatar :src="option.src" :srcSet="option.srcSet" :alt="option.alt" />
|
|
6
|
+
</div>
|
|
7
|
+
</li>
|
|
8
|
+
<li v-if="options && options.length > max">
|
|
9
|
+
<MAvatar>
|
|
10
|
+
+{{ remaining }}
|
|
11
|
+
</MAvatar>
|
|
12
|
+
</li>
|
|
13
|
+
</ul>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import {computed, defineComponent, type PropType, provide, reactive, toRef} from 'vue';
|
|
18
|
+
import * as style from './style';
|
|
19
|
+
import type {AvatarGroupState, Options} from './symbol';
|
|
20
|
+
import type {Size} from "../../types/props";
|
|
21
|
+
import {AVATAR_GROUP_STATE} from "./symbol";
|
|
22
|
+
|
|
23
|
+
export default defineComponent({
|
|
24
|
+
name: "MAvatarGroup",
|
|
25
|
+
components: {
|
|
26
|
+
MAvatar: () => import('../avatar/Avatar.vue')
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
options: {
|
|
30
|
+
type: Array as PropType<Options[]>,
|
|
31
|
+
default: () => []
|
|
32
|
+
},
|
|
33
|
+
max: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 5
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
type: String as PropType<Size>,
|
|
39
|
+
default: 'md'
|
|
40
|
+
},
|
|
41
|
+
rounded: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
setup(props) {
|
|
47
|
+
const state: AvatarGroupState = reactive({
|
|
48
|
+
size: toRef(props, 'size'),
|
|
49
|
+
rounded: toRef(props, 'rounded'),
|
|
50
|
+
max: toRef(props, 'max')
|
|
51
|
+
})
|
|
52
|
+
provide(AVATAR_GROUP_STATE, state);
|
|
53
|
+
|
|
54
|
+
const avatars = computed(() => {
|
|
55
|
+
return props.options.slice(0, props.max);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const remaining = computed(() => {
|
|
59
|
+
return props.options.length - props.max;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
style,
|
|
64
|
+
avatars,
|
|
65
|
+
remaining
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
</script>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type {InjectionKey} from "vue";
|
|
2
|
-
import type {Size} from "../../types/props";
|
|
3
|
-
|
|
4
|
-
export type Options = {
|
|
5
|
-
src: string;
|
|
6
|
-
srcSet: string;
|
|
7
|
-
alt: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export interface AvatarGroupState {
|
|
12
|
-
max: number;
|
|
13
|
-
size: Size;
|
|
14
|
-
rounded: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
1
|
+
import type {InjectionKey} from "vue";
|
|
2
|
+
import type {Size} from "../../types/props";
|
|
3
|
+
|
|
4
|
+
export type Options = {
|
|
5
|
+
src: string;
|
|
6
|
+
srcSet: string;
|
|
7
|
+
alt: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export interface AvatarGroupState {
|
|
12
|
+
max: number;
|
|
13
|
+
size: Size;
|
|
14
|
+
rounded: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
17
|
export const AVATAR_GROUP_STATE: InjectionKey<AvatarGroupState> = Symbol('AVATAR_GROUP_STATE');
|
|
@@ -1,73 +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>
|
|
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
73
|
|
|
@@ -1,40 +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"
|
|
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
40
|
});
|
|
@@ -1,17 +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
|
-
|
|
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
17
|
export const BREADCRUMB_STATE: InjectionKey<BreadcrumbState> = Symbol('BREADCRUMB_STATE');
|