@appscode/design-system 1.1.0-beta.77 → 1.1.0-beta.79

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "1.1.0-beta.77",
3
+ "version": "1.1.0-beta.79",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -0,0 +1,92 @@
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
31
+ ref="actionDropdown"
32
+ class="dropdown-action"
33
+ :class="{ 'dropdown is-active': modelValue }"
34
+ >
35
+ <div class="dropdown-trigger">
36
+ <ac-button
37
+ :modifier-classes="buttonModifierClass"
38
+ aria-haspopup="true"
39
+ aria-controls="dropdown-menu3"
40
+ :disabled="disabled"
41
+ :icon-class="iconClass"
42
+ @click="emit('update:modelValue', !modelValue)"
43
+ >
44
+ <template #icon>
45
+ <slot name="icon" />
46
+ </template>
47
+ <span>{{ title }}</span>
48
+ <span class="icon is-small">
49
+ <HeroiconsChevronDown v-if="!modelValue" />
50
+ <HeroiconsChevronUp v-else />
51
+ </span>
52
+ </ac-button>
53
+ </div>
54
+ <div class="dropdown-menu" id="dropdown-menu3" role="menu">
55
+ <div class="dropdown-content">
56
+ <slot name="list" />
57
+ </div>
58
+ </div>
59
+ </div>
60
+ <!-- dropdown end -->
61
+ </template>
62
+ <style lang="scss">
63
+ .dropdown-group {
64
+ margin-bottom: 16px;
65
+ }
66
+ .dropdown-action {
67
+ .dropdown-content {
68
+ min-width: 220px;
69
+ border: 1px solid $primary-90;
70
+
71
+ label {
72
+ padding: 8px 16px;
73
+ display: flex;
74
+ border-bottom: 1px solid $primary-95;
75
+ color: $primary-20;
76
+ font-weight: 500;
77
+ }
78
+ .dropdown-item {
79
+ display: flex;
80
+ align-items: center;
81
+ gap: 8px;
82
+ font-size: 13px;
83
+ padding: 8px 16px;
84
+ color: $primary-20;
85
+ &:hover {
86
+ background-color: $primary-97;
87
+ color: $primary;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ </style>