@appscode/design-system 2.17.26 → 2.17.28

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.17.26",
3
+ "version": "2.17.28",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -1,6 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { defineProps, type Component } from "vue";
2
+ import { defineProps, defineEmits, type Component, defineAsyncComponent } from "vue";
3
3
  import AcButton from "../../v3/button/Button.vue";
4
+ const Skeletons = defineAsyncComponent(() => import("../skeleton/Skeletons.vue"));
5
+ const Skeleton = defineAsyncComponent(() => import("../skeleton/Skeleton.vue"));
4
6
  interface UsageRow {
5
7
  icon?: Component;
6
8
  label: string;
@@ -9,25 +11,37 @@ interface UsageRow {
9
11
 
10
12
  type Header = string | { label: string; button?: boolean; text?: string };
11
13
 
12
- withDefaults(
14
+ const props = withDefaults(
13
15
  defineProps<{
14
16
  title?: string;
15
17
  thead?: Header[];
16
18
  tbody?: UsageRow[];
19
+ isLoaderActive?: boolean;
17
20
  }>(),
18
21
  {
19
22
  title: "Total Usage Data",
20
23
  thead: () => [],
21
24
  tbody: () => [],
25
+ isLoaderActive: false,
22
26
  },
23
27
  );
28
+
29
+ const emit = defineEmits<{
30
+ "header-button-click": [headerLabel: string, headerIndex: number];
31
+ }>();
32
+
33
+ const handleHeaderButtonClick = (header: Header, index: number) => {
34
+ if (typeof header === "object" && header.button) {
35
+ emit("header-button-click", header.label, index);
36
+ }
37
+ };
24
38
  </script>
25
39
 
26
40
  <template>
27
41
  <h5 class="mb-8">{{ title }}</h5>
28
42
  <div class="usage-table-card">
29
43
  <div class="table-row thead">
30
- <div v-for="(header, index) in thead" :key="index" class="table-cell">
44
+ <div v-for="(header, index) in thead" :key="index" class="table-cell has-text-weight-normal">
31
45
  <template v-if="typeof header === 'string'">
32
46
  {{ header }}
33
47
  </template>
@@ -37,7 +51,7 @@ withDefaults(
37
51
  <ac-button
38
52
  modifier-classes="is-text has-text-primary p-0 height-auto"
39
53
  v-if="header.button"
40
- @click="$emit('total-click')"
54
+ @click="handleHeaderButtonClick(header, index)"
41
55
  >({{ header.text }})</ac-button
42
56
  >
43
57
  </div>
@@ -54,8 +68,17 @@ withDefaults(
54
68
  <span>{{ row.label }}</span>
55
69
  </div>
56
70
  </div>
57
- <div v-for="(val, valIndex) in row.values" :key="valIndex" class="table-cell">
58
- {{ val }}
71
+ <div v-for="(val, valIndex) in row.values" :key="valIndex" class="table-cell has-text-weight-normal">
72
+ <div v-if="isLoaderActive">
73
+ <skeletons>
74
+ <template #default>
75
+ <Skeleton />
76
+ </template>
77
+ </skeletons>
78
+ </div>
79
+ <div v-else>
80
+ {{ val }}
81
+ </div>
59
82
  </div>
60
83
  </div>
61
84
  </div>