@appscode/design-system 2.2.13 → 2.2.14

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": "2.2.13",
3
+ "version": "2.2.14",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { defineAsyncComponent } from "vue";
2
+ import { defineAsyncComponent, ref } from "vue";
3
3
  interface app {
4
4
  url: string;
5
5
  icon_url: string;
@@ -17,10 +17,15 @@ withDefaults(defineProps<Props>(), {
17
17
 
18
18
  const NavbarItem = defineAsyncComponent(() => import("./NavbarItem.vue"));
19
19
  const NavbarItemContent = defineAsyncComponent(() => import("./NavbarItemContent.vue"));
20
+ const showDrawer = ref(false);
21
+
22
+ function handleIsActiveChange(isActive: string) {
23
+ showDrawer.value = !!isActive?.length;
24
+ }
20
25
  </script>
21
26
 
22
27
  <template>
23
- <navbar-item>
28
+ <navbar-item @on-is-active-change="handleIsActiveChange">
24
29
  <template #navbar-item>
25
30
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
26
31
  <path
@@ -54,7 +59,7 @@ const NavbarItemContent = defineAsyncComponent(() => import("./NavbarItemContent
54
59
  </svg>
55
60
  </template>
56
61
  <template #navbar-content>
57
- <navbar-item-content class="navbar-dropdown-wrapper" style="right: -30px">
62
+ <navbar-item-content v-if="showDrawer" class="navbar-dropdown-wrapper" style="right: -30px">
58
63
  <ul class="ac-scrollbar p-0 app-drawer">
59
64
  <li v-for="app in apps" :key="app.url">
60
65
  <a :href="app.url">
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { useRoute } from "vue-router";
3
- import { ref, watch } from "vue";
3
+ import { computed, ref, watch } from "vue";
4
4
  import { onClickOutside } from "@vueuse/core";
5
5
 
6
6
  interface Props {
@@ -11,15 +11,15 @@ withDefaults(defineProps<Props>(), {
11
11
  modifierClasses: "",
12
12
  });
13
13
 
14
- const emit = defineEmits(["isActive", "onRouteChange"]);
14
+ const emit = defineEmits(["onIsActiveChange", "onRouteChange"]);
15
15
 
16
16
  const navbarItem = ref(null);
17
17
 
18
18
  const isActive = ref("");
19
19
  function clickEvent() {
20
20
  if (isActive.value) isActive.value = "";
21
- else isActive.value = " is-active";
22
- emit("isActive", isActive.value);
21
+ else isActive.value = "is-active";
22
+ emit("onIsActiveChange", isActive.value);
23
23
  }
24
24
 
25
25
  const route = useRoute();
@@ -32,12 +32,14 @@ watch(
32
32
  );
33
33
  onClickOutside(navbarItem, () => {
34
34
  isActive.value = "";
35
- emit("isActive", isActive.value);
35
+ emit("onIsActiveChange", isActive.value);
36
36
  });
37
+
38
+ const isActiveClass = computed(() => (isActive.value.length ? ` ${isActive.value}` : ""));
37
39
  </script>
38
40
 
39
41
  <template>
40
- <div ref="navbarItem" class="ac-menu-item" :class="modifierClasses + isActive">
42
+ <div ref="navbarItem" class="ac-menu-item" :class="modifierClasses + isActiveClass">
41
43
  <button class="button ac-nav-button" @click="clickEvent()">
42
44
  <slot name="navbar-item" />
43
45
  </button>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { defineAsyncComponent } from "vue";
2
+ import { defineAsyncComponent, ref } from "vue";
3
3
  import TimeConvert from "../../plugins/time-convert";
4
4
  import type { Notification } from "../../types/notification";
5
5
  const NavbarItem = defineAsyncComponent(() => import("./NavbarItem.vue"));
@@ -14,13 +14,17 @@ withDefaults(
14
14
  unreadNotification: 0,
15
15
  }
16
16
  );
17
- defineEmits(["isActive"]);
18
17
  function notificationTime(time: number) {
19
18
  return TimeConvert.getDayDifferences({ past: time });
20
19
  }
20
+
21
+ const showNotification = ref(false);
22
+ function handleIsActiveChange(isActive: string | any[]) {
23
+ showNotification.value = !!isActive?.length;
24
+ }
21
25
  </script>
22
26
  <template>
23
- <navbar-item ref="notificationItem" @is-active="$emit('isActive', $event)">
27
+ <navbar-item ref="notificationItem" @on-is-active-change="handleIsActiveChange">
24
28
  <template #navbar-item>
25
29
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
26
30
  <g clip-path="url(#clip0_534_14009)">
@@ -44,7 +48,7 @@ function notificationTime(time: number) {
44
48
  </template>
45
49
 
46
50
  <template #navbar-content>
47
- <navbar-item-content class="navbar-dropdown-wrapper" style="width: 320px; right: -30px">
51
+ <navbar-item-content v-if="showNotification" class="navbar-dropdown-wrapper" style="width: 320px; right: -30px">
48
52
  <div class="dropdown-inner">
49
53
  <div class="notification-header">
50
54
  <h5>Notification</h5>
@@ -68,7 +68,7 @@ const toggleList = () => {
68
68
  const onOrganizationClick = (orgName: string) => {
69
69
  dropdownItems.value?.$el.scrollTo(0, 0);
70
70
  emit("activeorg$set", orgName);
71
- closeDropdown();
71
+ handleIsActiveChange("");
72
72
  };
73
73
 
74
74
  const locationOrigin = window.location.origin;
@@ -85,13 +85,20 @@ watch(dropDownStatus, (n) => {
85
85
  }
86
86
  });
87
87
 
88
- function closeDropdown() {
88
+ const showUserDropdown = ref(false);
89
+
90
+ function handleIsActiveChange(isActive: string) {
89
91
  dropDownStatus.value = "close";
92
+ showUserDropdown.value = !!isActive?.length;
90
93
  }
91
94
  </script>
92
95
 
93
96
  <template>
94
- <navbar-item :modifierClasses="'ac-profile-button'" @on-route-change="closeDropdown" @is-active="closeDropdown">
97
+ <navbar-item
98
+ :modifierClasses="'ac-profile-button'"
99
+ @on-route-change="handleIsActiveChange"
100
+ @on-is-active-change="handleIsActiveChange"
101
+ >
95
102
  <template #navbar-item>
96
103
  <div class="ac-user-profile mr-8">
97
104
  <img :src="user.avatar_url" alt="User Photo" />
@@ -104,7 +111,7 @@ function closeDropdown() {
104
111
  </button> -->
105
112
 
106
113
  <template #navbar-content>
107
- <navbar-item-content class="navbar-dropdown-wrapper">
114
+ <navbar-item-content v-if="showUserDropdown" class="navbar-dropdown-wrapper">
108
115
  <div v-if="user.username" class="user-profile-wrapper">
109
116
  <a
110
117
  :href="`${serverDomain}/${user.username}`"