@appscode/design-system 1.1.0-beta.77 → 1.1.0-beta.78
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
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineAsyncComponent, ref } from "vue";
|
|
3
|
+
import HeroiconsChevronDown from "~icons/heroicons/chevron-down";
|
|
4
|
+
import HeroiconsChevronUp from "~icons/heroicons/chevron-up";
|
|
5
|
+
import { onClickOutside } from "@vueuse/core";
|
|
6
|
+
|
|
7
|
+
const AcButton = defineAsyncComponent(() => import("../button/Button.vue"));
|
|
8
|
+
interface Props {
|
|
9
|
+
modelValue: boolean;
|
|
10
|
+
title?: string;
|
|
11
|
+
buttonModifierClass?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
iconClass: string;
|
|
14
|
+
}
|
|
15
|
+
withDefaults(defineProps<Props>(), {
|
|
16
|
+
modelValue: false,
|
|
17
|
+
title: "",
|
|
18
|
+
buttonModifierClass: "",
|
|
19
|
+
disabled: false,
|
|
20
|
+
iconClass: "",
|
|
21
|
+
});
|
|
22
|
+
const actionDropdown = ref<HTMLElement | null>(null);
|
|
23
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
24
|
+
|
|
25
|
+
onClickOutside(actionDropdown, () => emit("update:modelValue", false));
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<!-- dropdown start -->
|
|
30
|
+
<div ref="actionDropdown" :class="{ 'dropdown is-active': modelValue }">
|
|
31
|
+
<div class="dropdown-trigger">
|
|
32
|
+
<ac-button
|
|
33
|
+
:modifier-classes="buttonModifierClass"
|
|
34
|
+
aria-haspopup="true"
|
|
35
|
+
aria-controls="dropdown-menu3"
|
|
36
|
+
:disabled="disabled"
|
|
37
|
+
:icon-class="iconClass"
|
|
38
|
+
@click="emit('update:modelValue', !modelValue)"
|
|
39
|
+
>
|
|
40
|
+
<template #icon>
|
|
41
|
+
<slot name="icon" />
|
|
42
|
+
</template>
|
|
43
|
+
<span>{{ title }}</span>
|
|
44
|
+
<span class="icon is-small">
|
|
45
|
+
<HeroiconsChevronDown v-if="!modelValue" />
|
|
46
|
+
<HeroiconsChevronUp v-else />
|
|
47
|
+
</span>
|
|
48
|
+
</ac-button>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="dropdown-menu" id="dropdown-menu3" role="menu">
|
|
51
|
+
<div class="dropdown-content">
|
|
52
|
+
<slot name="list" />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
<!-- dropdown end -->
|
|
57
|
+
</template>
|
|
58
|
+
<style lang="scss">
|
|
59
|
+
.dropdown-group {
|
|
60
|
+
margin-bottom: 16px;
|
|
61
|
+
}
|
|
62
|
+
.dropdown-content {
|
|
63
|
+
min-width: 220px;
|
|
64
|
+
border: 1px solid $primary-90;
|
|
65
|
+
|
|
66
|
+
label {
|
|
67
|
+
padding: 8px 16px;
|
|
68
|
+
display: flex;
|
|
69
|
+
border-bottom: 1px solid $primary-95;
|
|
70
|
+
color: $primary-20;
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
}
|
|
73
|
+
.dropdown-item {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 8px;
|
|
77
|
+
font-size: 13px;
|
|
78
|
+
padding: 8px 16px;
|
|
79
|
+
color: $primary-20;
|
|
80
|
+
&:hover {
|
|
81
|
+
background-color: $primary-97;
|
|
82
|
+
color: $primary;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
</style>
|