@appscode/design-system 2.17.82 → 2.17.83-alpha-2

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/main.scss CHANGED
@@ -21,6 +21,7 @@
21
21
  @import "@/components/vue-components/styles/components/avatar";
22
22
  @import "@/components/vue-components/styles/components/terminal";
23
23
  @import "@/components/vue-components/styles/components/steps";
24
+ @import "@/components/vue-components/styles/components/sidebar-tabs/sidebar-tabs";
24
25
  @import "@/components/vue-components/styles/components/code-preview/all";
25
26
  @import "@/components/vue-components/styles/components/form-fields/input";
26
27
  @import "@/components/vue-components/styles/components/form-fields/check-radio-switch";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "2.17.82",
3
+ "version": "2.17.83-alpha-2",
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,21 @@
1
+ import { computed, onMounted, ref } from "vue";
2
+ import { useElementSize, useMutationObserver } from "@vueuse/core";
3
+
4
+ export function useElementsOffset(selectors: string[]) {
5
+ const elRefs = selectors.map(() => ref<HTMLElement | null>(null));
6
+ const sizes = elRefs.map((el) => useElementSize(el));
7
+
8
+ const resolveElements = () => {
9
+ selectors.forEach((selector, i) => {
10
+ elRefs[i].value = document.querySelector<HTMLElement>(selector);
11
+ });
12
+ };
13
+
14
+ onMounted(resolveElements);
15
+ useMutationObserver(document.body, resolveElements, {
16
+ childList: true,
17
+ subtree: true,
18
+ });
19
+
20
+ return computed(() => sizes.reduce((total, { height }) => total + height.value, 0));
21
+ }
@@ -2,7 +2,7 @@
2
2
  width: 220px;
3
3
  border-right: 1px solid $color-border;
4
4
  padding: 8px;
5
- height: calc(100vh - 50px);
5
+ height: calc(100vh - var(--sidebar-tabs-offset, 50px));
6
6
  overflow-y: auto;
7
7
  ul {
8
8
  li {
@@ -1,6 +1,18 @@
1
- <script setup lang="ts"></script>
1
+ <script setup lang="ts">
2
+ import { useElementsOffset } from "../../../composables/element-offset";
3
+
4
+ export interface Props {
5
+ offsetSelectors?: string[];
6
+ }
7
+
8
+ const props = withDefaults(defineProps<Props>(), {
9
+ offsetSelectors: () => [".ac-navbar-area", ".inner-header", ".footer-area"],
10
+ });
11
+
12
+ const sidebarOffset = useElementsOffset(props.offsetSelectors);
13
+ </script>
2
14
  <template>
3
- <div class="sidebar-tabs">
15
+ <div class="sidebar-tabs" :style="{ '--sidebar-tabs-offset': sidebarOffset + 'px' }">
4
16
  <slot />
5
17
  </div>
6
18
  </template>