@teammodlr/ui-kit 2.2.2 → 2.3.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/components/dialog/Dialog.vue.d.ts +1 -1
- package/lib/components/dropdown/Dropdown.vue.d.ts +25 -27
- package/lib/components/dropdown/DropdownItem.vue.d.ts +1 -2
- package/lib/components/index.d.ts +1 -2
- package/lib/components/messageprovider/Message.vue.d.ts +1 -1
- package/lib/components/modal/Modal.vue.d.ts +1 -1
- package/lib/components/primative/primitive.d.ts +1 -1
- package/lib/index.cjs.js +10 -8
- package/lib/index.es.js +8363 -4234
- package/lib/style.css +1 -1
- package/package.json +2 -1
- package/src/components/dropdown/Dropdown.vue +207 -331
- package/src/components/dropdown/DropdownHeading.vue +23 -23
- package/src/components/dropdown/DropdownItem.vue +116 -151
- package/src/components/dropdown/DropdownSeperator.vue +26 -23
- package/src/components/dropdown/examples/basic.vue +246 -119
- package/src/components/dropdown/examples/context.vue +52 -71
- package/src/components/dropdown/style/Dropdown.css.ts +159 -158
- package/src/components/index.ts +3 -2
- package/src/components/tooltip/Tooltip.vue +1 -1
- package/lib/components/dropdown/DropdownTrigger.vue.d.ts +0 -11
- package/lib/components/dropdown/DropdownWrapper.vue.d.ts +0 -2
- package/src/components/dropdown/DropdownTrigger.vue +0 -20
- package/src/components/dropdown/DropdownWrapper.vue +0 -18
|
@@ -1,151 +1,116 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<
|
|
3
|
-
:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
:class="
|
|
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
|
-
import
|
|
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
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return [style.menuItem, style.variant[props.variant]];
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
const computedType = computed(() => {
|
|
121
|
-
if (props.href) {
|
|
122
|
-
return 'a';
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return 'li';
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// onMounted(() => {
|
|
129
|
-
// if (props.hotkey) {
|
|
130
|
-
// const combination = keys[props.hotkey];
|
|
131
|
-
|
|
132
|
-
// whenever(combination, (v) => {
|
|
133
|
-
// if (v && isOpen.value) {
|
|
134
|
-
// handleSelect();
|
|
135
|
-
// }
|
|
136
|
-
// })
|
|
137
|
-
// }
|
|
138
|
-
// })
|
|
139
|
-
|
|
140
|
-
return {
|
|
141
|
-
wrapper,
|
|
142
|
-
hasIconLeft,
|
|
143
|
-
hasIconRight,
|
|
144
|
-
handleSelect,
|
|
145
|
-
computedWrapperClasses,
|
|
146
|
-
style,
|
|
147
|
-
computedType
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuItem :class="computedWrapperClasses" :as="computedType" :href="href">
|
|
3
|
+
<div :class="style.menuItemIcon">
|
|
4
|
+
<slot name="icon-left" />
|
|
5
|
+
</div>
|
|
6
|
+
<div :class="style.menuItemTextContainer">
|
|
7
|
+
<span :class="style.menuItemText"><slot /></span>
|
|
8
|
+
</div>
|
|
9
|
+
<slot name="keyboard" />
|
|
10
|
+
</DropdownMenuItem>
|
|
11
|
+
<!-- <component
|
|
12
|
+
:is="computedType"
|
|
13
|
+
:href="href"
|
|
14
|
+
ref="wrapper"
|
|
15
|
+
:class="computedWrapperClasses"
|
|
16
|
+
role="menuitem"
|
|
17
|
+
tabindex="0"
|
|
18
|
+
@click="handleSelect"
|
|
19
|
+
v-bind="$attrs">
|
|
20
|
+
<div v-if="hasIconLeft" :class="style.menuItemIcon">
|
|
21
|
+
<slot name="icon-left" />
|
|
22
|
+
</div>
|
|
23
|
+
<div :class="style.menuItemTextContainer">
|
|
24
|
+
<span :class="style.menuItemText"><slot /></span>
|
|
25
|
+
</div>
|
|
26
|
+
<!-- <div v-if="hotkey" class="m-dropdown__hotkeys">
|
|
27
|
+
<template v-for="key in hotkey.split('+')">
|
|
28
|
+
<kbd>{{ key }}</kbd>
|
|
29
|
+
</template>
|
|
30
|
+
</div> -->
|
|
31
|
+
<!-- <div v-if="hasIconRight" :class="style.menuItemIcon">
|
|
32
|
+
<slot name="icon-right" />
|
|
33
|
+
</div>
|
|
34
|
+
</component> -->
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
import {
|
|
39
|
+
computed,
|
|
40
|
+
defineComponent,
|
|
41
|
+
type PropType,
|
|
42
|
+
ref
|
|
43
|
+
} from 'vue';
|
|
44
|
+
import { DropdownMenuItem } from "radix-vue";
|
|
45
|
+
import * as style from './style';
|
|
46
|
+
import type { Variant } from '../../types/props';
|
|
47
|
+
|
|
48
|
+
export default defineComponent({
|
|
49
|
+
name: 'DropdownItem',
|
|
50
|
+
components: {
|
|
51
|
+
DropdownMenuItem
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
label: {
|
|
55
|
+
type: [String, Number],
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
disabled: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
reference: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
onSelect: {
|
|
67
|
+
type: Function as PropType<(label: string | number) => void>,
|
|
68
|
+
default: () => {}
|
|
69
|
+
},
|
|
70
|
+
hotkey: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: null
|
|
73
|
+
},
|
|
74
|
+
description: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: null
|
|
77
|
+
},
|
|
78
|
+
href: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: null
|
|
81
|
+
},
|
|
82
|
+
variant: {
|
|
83
|
+
type: String as PropType<Variant>,
|
|
84
|
+
default: 'default'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
emits: [],
|
|
88
|
+
setup(props, { slots }) {
|
|
89
|
+
|
|
90
|
+
const hasIconLeft = computed(() => !!slots['icon-left']);
|
|
91
|
+
const hasIconRight = computed(() => !!slots['icon-right']);
|
|
92
|
+
|
|
93
|
+
const wrapper = ref(null);
|
|
94
|
+
const computedWrapperClasses = computed(() => {
|
|
95
|
+
return [style.menuItem, style.variant[props.variant]];
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const computedType = computed(() => {
|
|
99
|
+
if (props.href) {
|
|
100
|
+
return 'a';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return 'div';
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
wrapper,
|
|
108
|
+
hasIconLeft,
|
|
109
|
+
hasIconRight,
|
|
110
|
+
computedWrapperClasses,
|
|
111
|
+
style,
|
|
112
|
+
computedType
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
</script>
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import {computed, defineComponent} from "vue";
|
|
7
|
-
import * as style from "./style";
|
|
8
|
-
|
|
9
|
-
export default defineComponent({
|
|
10
|
-
name: "DropdownSeperator",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuSeparator :class="computedClasses" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import {computed, defineComponent} from "vue";
|
|
7
|
+
import * as style from "./style";
|
|
8
|
+
import { DropdownMenuSeparator } from 'radix-vue';
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: "DropdownSeperator",
|
|
11
|
+
components: {
|
|
12
|
+
DropdownMenuSeparator
|
|
13
|
+
},
|
|
14
|
+
setup() {
|
|
15
|
+
const computedClasses = computed(() => {
|
|
16
|
+
return [
|
|
17
|
+
style.menuSeperator
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
computedClasses
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
</script>
|