@appscode/design-system 2.2.40 → 2.2.41

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.40",
3
+ "version": "2.2.41",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  interface Props {
3
3
  label: string;
4
- customClass: string;
4
+ customClass?: string;
5
5
  isCollapsible: boolean;
6
6
  isRequired: boolean;
7
7
  errors: Array<string>;
@@ -181,7 +181,10 @@ function readableTime(utcTime: string) {
181
181
  <tbody>
182
182
  <template v-for="(itemRow, idxRow) in dataForTable" :key="idxRow">
183
183
  <tr data-testid="ac-table-row">
184
- <td v-for="(itemColumn, idx) in itemRow.cells" :key="itemColumn.data as string + idx">
184
+ <td
185
+ v-for="(itemColumn, idx) in itemRow.cells"
186
+ :key="itemColumn.data as string || 'namespace' + idx"
187
+ >
185
188
  <template v-if="tableHeaders[idx].type === 'date'">
186
189
  {{ readableTime(itemColumn.data as string) }}
187
190
  </template>
@@ -0,0 +1,72 @@
1
+ <script setup lang="ts">
2
+ import { defineAsyncComponent } from "vue";
3
+
4
+ interface Props {
5
+ title?: string;
6
+ message?: string;
7
+ itemName?: string;
8
+ modifierClasses?: string;
9
+ isDeleteActive?: boolean;
10
+ disableModalClose?: boolean;
11
+ ignoreOutsideClick?: boolean;
12
+ hideActionFooter?: boolean;
13
+ }
14
+
15
+ withDefaults(defineProps<Props>(), {
16
+ title: "Delete Modal",
17
+ message: "Do you want to delete",
18
+ itemName: "item",
19
+ modifierClasses: "is-normal",
20
+ isDeleteActive: false,
21
+ disableModalClose: false,
22
+ ignoreOutsideClick: false,
23
+ hideActionFooter: false,
24
+ });
25
+
26
+ defineEmits(["onDelete"]);
27
+
28
+ const open = defineModel({ type: Boolean });
29
+
30
+ const Modal = defineAsyncComponent(() => import("./DialogModal.vue"));
31
+ const AcButton = defineAsyncComponent(() => import("./../button/Button.vue"));
32
+ </script>
33
+
34
+ <template>
35
+ <!-- modal start -->
36
+
37
+ <modal
38
+ v-model="open"
39
+ :title="title"
40
+ :class="modifierClasses"
41
+ :hide-action-footer="hideActionFooter"
42
+ :disable-modal-close="disableModalClose"
43
+ :ignore-outside-click="ignoreOutsideClick"
44
+ >
45
+ <!-- freedom content start -->
46
+ <div class="action-message pt-35 pb-35 has-text-centered">
47
+ <h5 class="is-message">{{ message }} {{ itemName ? "" : "?" }}</h5>
48
+ <p class="is-description">{{ itemName }} {{ itemName ? "?" : "" }}</p>
49
+ </div>
50
+
51
+ <!-- freedom content end -->
52
+
53
+ <!-- modal footer start -->
54
+ <template #modal-footer-controls>
55
+ <ac-button
56
+ @click.stop="open = false"
57
+ title="Cancel"
58
+ modifier-classes="is-outlined"
59
+ :disabled="isDeleteActive || disableModalClose"
60
+ data-testid="delete-confirmation-modal-close-button"
61
+ />
62
+ <ac-button
63
+ title="Yes"
64
+ modifier-classes="is-danger"
65
+ :is-loader-active="isDeleteActive"
66
+ @click.stop="$emit('onDelete', itemName)"
67
+ data-testid="delete-confirmation-modal-confirm-button"
68
+ />
69
+ </template>
70
+ </modal>
71
+ <!-- modal end -->
72
+ </template>
@@ -0,0 +1,156 @@
1
+ <script setup lang="ts">
2
+ import { defineAsyncComponent, ref, watch, nextTick } from "vue";
3
+
4
+ interface Props {
5
+ title?: string;
6
+ ignoreOutsideClick?: boolean;
7
+ hideActionFooter?: boolean;
8
+ disableModalClose?: boolean;
9
+ }
10
+
11
+ const props = withDefaults(defineProps<Props>(), {
12
+ title: "Modal",
13
+ disableModalClose: false,
14
+ ignoreOutsideClick: false,
15
+ hideActionFooter: false,
16
+ });
17
+
18
+ const HeaderItems = defineAsyncComponent(() => import("./../header/HeaderItems.vue"));
19
+
20
+ const dialogModal = ref<HTMLDialogElement | null>(null);
21
+
22
+ const model = defineModel({ type: Boolean });
23
+
24
+ const onKeyDown = (e: KeyboardEvent) => {
25
+ if (model.value && e.keyCode === 27) {
26
+ destroyModal();
27
+ }
28
+ };
29
+
30
+ const initializeModal = () => {
31
+ model.value = true;
32
+ document.addEventListener("keydown", onKeyDown);
33
+ };
34
+
35
+ const destroyModal = () => {
36
+ if (props.disableModalClose) return;
37
+ model.value = false;
38
+ document.removeEventListener("keydown", onKeyDown);
39
+ };
40
+
41
+ watch(
42
+ () => model.value,
43
+ (n) => {
44
+ if (n) {
45
+ initializeModal();
46
+ openDialog();
47
+ } else {
48
+ destroyModal();
49
+ }
50
+ }
51
+ );
52
+
53
+ const handleBackdropClick = (event: MouseEvent) => {
54
+ if (event.target === dialogModal.value && !props.ignoreOutsideClick) {
55
+ destroyModal();
56
+ }
57
+ };
58
+
59
+ const openDialog = async () => {
60
+ await nextTick();
61
+ if (dialogModal.value) {
62
+ dialogModal.value.showModal();
63
+ }
64
+ };
65
+
66
+ const handleCancel = (event: Event) => {
67
+ event.preventDefault();
68
+ };
69
+ </script>
70
+
71
+ <template>
72
+ <dialog v-if="model" ref="dialogModal" @click="handleBackdropClick" @cancel="handleCancel" class="ac-modal">
73
+ <div class="ac-modal-inner" @click.stop>
74
+ <div class="ac-modal-header">
75
+ <h5>{{ title }}</h5>
76
+ <header-items>
77
+ <slot name="modal-header-controls" />
78
+ </header-items>
79
+
80
+ <div class="header-items is-flex is-align-items-center">
81
+ <div class="header-item">
82
+ <button
83
+ @click="destroyModal"
84
+ class="button ac-button is-white"
85
+ data-testid="modal-generic-close-icon"
86
+ :disabled="disableModalClose"
87
+ >
88
+ <span class="icon">
89
+ <svg
90
+ xmlns="http://www.w3.org/2000/svg"
91
+ fill="none"
92
+ viewBox="0 0 24 24"
93
+ stroke-width="1.5"
94
+ stroke="currentColor"
95
+ class="size-6"
96
+ >
97
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
98
+ </svg>
99
+ </span>
100
+ </button>
101
+ </div>
102
+ </div>
103
+ </div>
104
+
105
+ <div class="ac-modal-body ac-vscrollbar" data-testid="ac-modal-content-with-scroll">
106
+ <div class="ac-modal-content">
107
+ <div class="action-message pt-35 pb-35 has-text-centered">
108
+ <slot />
109
+ </div>
110
+ </div>
111
+ </div>
112
+
113
+ <div
114
+ v-if="!hideActionFooter"
115
+ class="ac-modal-footer action-footer is-flex is-align-items-center is-justify-content-space-between"
116
+ >
117
+ <div>
118
+ <slot name="modal-footer-left" />
119
+ </div>
120
+
121
+ <div class="buttons has-text-right is-block">
122
+ <slot name="modal-footer-controls" />
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </dialog>
127
+ </template>
128
+
129
+ <style lang="scss" scoped>
130
+ @import "../../../vue-components/styles/components/modal";
131
+
132
+ .ac-modal {
133
+ position: unset;
134
+ min-height: auto;
135
+ &:after {
136
+ position: unset;
137
+ background-color: unset;
138
+ opacity: 1;
139
+ }
140
+ .ac-modal-inner {
141
+ box-shadow: none;
142
+ }
143
+ }
144
+
145
+ dialog {
146
+ background: transparent;
147
+ border: none;
148
+ &::backdrop {
149
+ background-color: rgba(0, 0, 0, 0.5);
150
+ }
151
+ }
152
+
153
+ dialog:focus {
154
+ outline: none;
155
+ }
156
+ </style>