@appscode/design-system 1.1.0 → 2.0.1

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.
Files changed (215) hide show
  1. package/base/_video-player.scss +65 -0
  2. package/base/utilities/_all.scss +7 -5
  3. package/base/utilities/_colors.scss +377 -0
  4. package/base/utilities/_customize-bulma.scss +23 -27
  5. package/base/utilities/_extended.scss +39 -0
  6. package/base/utilities/{_default.scss → _global.scss} +192 -333
  7. package/base/utilities/_layouts.scss +19 -0
  8. package/base/utilities/_mixin.scss +11 -11
  9. package/base/utilities/_spacing.scss +96 -0
  10. package/base/utilities/_typography.scss +56 -24
  11. package/components/_ac-alert-box.scss +205 -263
  12. package/components/_ac-calendar.scss +4 -4
  13. package/components/_ac-code-highlight.scss +13 -16
  14. package/components/_ac-content-layout.scss +165 -165
  15. package/components/_ac-drag.scss +13 -13
  16. package/components/_ac-modal.scss +212 -212
  17. package/components/_ac-options.scss +122 -123
  18. package/components/_ac-select-box.scss +10 -10
  19. package/components/_ac-table.scss +503 -502
  20. package/components/_ac-tabs.scss +65 -61
  21. package/components/_ac-tags.scss +116 -116
  22. package/components/_accordion.scss +117 -0
  23. package/components/_add-card.scss +3 -3
  24. package/components/_all.scss +35 -28
  25. package/components/_app-drawer.scss +0 -134
  26. package/components/_breadcumb.scss +0 -71
  27. package/components/_buttons.scss +779 -779
  28. package/components/_card-body-wrapper.scss +5 -5
  29. package/components/_dashboard-header.scss +0 -115
  30. package/components/_direct-deploy.scss +8 -8
  31. package/components/_getkeeper.scss +110 -0
  32. package/components/_go-to-top.scss +1 -1
  33. package/components/_graph.scss +10 -10
  34. package/components/_image-upload.scss +9 -9
  35. package/components/_input-card.scss +232 -0
  36. package/components/_input.scss +573 -0
  37. package/components/_left-sidebar-menu.scss +452 -587
  38. package/components/_monaco-editor.scss +2 -2
  39. package/components/{_ac-multi-select.scss → _multi-select.scss} +89 -251
  40. package/components/_navbar.scss +786 -752
  41. package/components/_nested-list.scss +3 -3
  42. package/components/_overview-info.scss +10 -10
  43. package/components/_overview-page.scss +4 -4
  44. package/components/_pagination.scss +106 -124
  45. package/components/_payment-card.scss +21 -21
  46. package/components/_preloader.scss +1 -1
  47. package/components/_preview-modal.scss +18 -18
  48. package/components/_pricing-table.scss +14 -14
  49. package/components/_progress-bar.scss +73 -86
  50. package/components/_subscription-card.scss +22 -24
  51. package/components/_table-of-content.scss +8 -8
  52. package/components/{_ac-terminal.scss → _terminal.scss} +114 -81
  53. package/components/_tfa.scss +9 -9
  54. package/components/_transitions.scss +35 -0
  55. package/components/_widget-menu.scss +252 -257
  56. package/components/_wizard.scss +518 -793
  57. package/components/ac-toaster/_ac-toasted.scss +11 -16
  58. package/components/bbum/_activities-header.scss +1 -1
  59. package/components/bbum/_card-team.scss +12 -12
  60. package/components/bbum/_information-center.scss +21 -23
  61. package/components/bbum/_left-sidebar.scss +8 -8
  62. package/components/bbum/_mobile-desktop.scss +16 -21
  63. package/components/bbum/_post.scss +5 -5
  64. package/components/bbum/_sign-up-notification.scss +10 -10
  65. package/components/bbum/_single-post-preview.scss +29 -29
  66. package/components/bbum/_user-profile.scss +10 -10
  67. package/components/ui-builder/_ui-builder.scss +221 -31
  68. package/components/ui-builder/_vue-open-api.scss +565 -7
  69. package/icons/close-icon.svg +3 -0
  70. package/layouts/_code-preview.scss +17 -18
  71. package/main.scss +26 -10
  72. package/package.json +1 -1
  73. package/plugins/theme.js +11 -9
  74. package/plugins/vue-toaster.js +1 -1
  75. package/vue-components/images/icons/cluster-icon.svg +10 -0
  76. package/vue-components/images/icons/org-icon.svg +10 -0
  77. package/vue-components/plugins/time-convert.js +49 -0
  78. package/vue-components/types/cluster.ts +6 -0
  79. package/vue-components/types/importFlow.ts +16 -0
  80. package/vue-components/types/notification.ts +6 -0
  81. package/vue-components/types/previewYaml.ts +8 -0
  82. package/vue-components/types/table.ts +55 -0
  83. package/vue-components/types/theme.ts +10 -0
  84. package/vue-components/types/user.ts +22 -0
  85. package/vue-components/v2/banner/Banner.vue +1 -1
  86. package/vue-components/v2/button/Buttons.vue +1 -1
  87. package/vue-components/v2/card/Card.vue +1 -1
  88. package/vue-components/v2/card/OverviewCards.vue +17 -2
  89. package/vue-components/v2/content/ContentTable.vue +14 -9
  90. package/vue-components/v2/editor/FilteredFileEditor.vue +2 -2
  91. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +21 -21
  92. package/vue-components/v2/icons/Ellipsis.vue +2 -1
  93. package/vue-components/v2/modal/Modal.vue +2 -6
  94. package/vue-components/v2/navbar/Appdrawer.vue +37 -12
  95. package/vue-components/v2/navbar/Navbar.vue +3 -3
  96. package/vue-components/v2/navbar/NavbarItem.vue +3 -1
  97. package/vue-components/v2/navbar/NavbarItemContent.vue +1 -1
  98. package/vue-components/v2/navbar/User.vue +5 -22
  99. package/vue-components/v2/pagination/Pagination.vue +66 -0
  100. package/vue-components/v2/sidebar/SidebarItem.vue +10 -7
  101. package/{components/_ac-accordion.scss → vue-components/v3/accordion/Accordion.vue} +40 -6
  102. package/vue-components/v3/alert/Alert.vue +238 -0
  103. package/vue-components/v3/alert/Toast.vue +79 -0
  104. package/vue-components/v3/banner/Banner.vue +10 -0
  105. package/vue-components/v3/breadcrumbs/Breadcrumb.vue +166 -0
  106. package/vue-components/v3/button/Button.vue +110 -57
  107. package/vue-components/v3/button/Buttons.vue +22 -0
  108. package/vue-components/v3/button/DownloadBtn.vue +31 -0
  109. package/vue-components/v3/cards/Card.vue +32 -0
  110. package/vue-components/v3/cards/CardContent.vue +7 -0
  111. package/vue-components/v3/cards/CardHeader.vue +14 -0
  112. package/vue-components/v3/cards/Cards.vue +7 -0
  113. package/vue-components/v3/cards/Cluster.vue +159 -0
  114. package/vue-components/v3/cards/Counter.vue +39 -0
  115. package/vue-components/v3/cards/FeatureCard.vue +67 -0
  116. package/vue-components/v3/cards/FeatureCards.vue +6 -0
  117. package/vue-components/v3/cards/InfoCard.vue +242 -0
  118. package/vue-components/v3/cards/Monitoring.vue +90 -0
  119. package/vue-components/v3/cards/OrgClusterCard.vue +86 -0
  120. package/vue-components/v3/cards/OverviewCard.vue +28 -0
  121. package/vue-components/v3/cards/OverviewCards.vue +39 -0
  122. package/vue-components/v3/cards/Payment.vue +62 -0
  123. package/vue-components/v3/cards/Vendor.vue +89 -0
  124. package/vue-components/v3/content/ContentHeader.vue +39 -30
  125. package/vue-components/v3/content/ContentLayout.vue +20 -0
  126. package/vue-components/v3/content/ContentTable.vue +44 -58
  127. package/vue-components/v3/dropdown/DropdownAction.vue +95 -0
  128. package/vue-components/v3/dropdown/DropdownDivider.vue +2 -0
  129. package/vue-components/v3/dropdown/DropdownItem.vue +2 -0
  130. package/vue-components/v3/dropdown/DropdownMenu.vue +85 -91
  131. package/vue-components/v3/editor/Editor.vue +117 -115
  132. package/vue-components/v3/editor/FilteredFileEditor.vue +325 -128
  133. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +73 -94
  134. package/vue-components/v3/footer/FooterArea.vue +40 -0
  135. package/vue-components/v3/footer/FooterItem.vue +32 -0
  136. package/vue-components/v3/footer/FooterItems.vue +15 -0
  137. package/vue-components/v3/footer/Info.vue +25 -0
  138. package/vue-components/v3/footer/Status.vue +43 -0
  139. package/vue-components/v3/footer/Usage.vue +34 -0
  140. package/vue-components/v3/form/Form.vue +24 -36
  141. package/vue-components/v3/form/FormFooter.vue +24 -0
  142. package/vue-components/v3/form/FormFooterControl.vue +7 -0
  143. package/vue-components/v3/form/FormFooterControls.vue +7 -0
  144. package/vue-components/v3/form-fields/AcSingleInput.vue +21 -0
  145. package/vue-components/v3/form-fields/FileUpload.vue +89 -0
  146. package/vue-components/v3/form-fields/Input.vue +19 -15
  147. package/vue-components/v3/header/Header.vue +120 -26
  148. package/vue-components/v3/header/HeaderItem.vue +18 -0
  149. package/vue-components/v3/header/HeaderItems.vue +4 -0
  150. package/vue-components/v3/icons/Ellipsis.vue +2 -0
  151. package/vue-components/v3/loaders/ClusterSwitcherLoader.vue +13 -0
  152. package/vue-components/v3/loaders/InfoCardLoader.vue +19 -0
  153. package/vue-components/v3/loaders/ResourceLoader.vue +4 -12
  154. package/vue-components/v3/loaders/SidebarLoader.vue +4 -12
  155. package/vue-components/v3/loaders/SingleInfoCardLoader.vue +24 -0
  156. package/vue-components/v3/modal/Modal.vue +294 -95
  157. package/vue-components/v3/modals/DeleteConfirmationModal.vue +37 -50
  158. package/vue-components/v3/modals/JsonShowModal.vue +63 -68
  159. package/vue-components/v3/navbar/Appdrawer.vue +198 -51
  160. package/vue-components/v3/navbar/Navbar.vue +139 -0
  161. package/vue-components/v3/navbar/NavbarItem.vue +103 -0
  162. package/vue-components/v3/navbar/NavbarItemContent.vue +282 -0
  163. package/vue-components/v3/navbar/Notification.vue +207 -0
  164. package/vue-components/v3/navbar/ThemeMode.vue +128 -112
  165. package/vue-components/v3/navbar/User.vue +431 -268
  166. package/vue-components/v3/notification/AlertBox.vue +266 -39
  167. package/vue-components/v3/notification/Notification.vue +50 -44
  168. package/vue-components/v3/notification/NotificationItem.vue +51 -19
  169. package/vue-components/v3/option-dots/Options.vue +197 -0
  170. package/vue-components/v3/pagination/Pagination.vue +216 -102
  171. package/vue-components/v3/preloader/Preloader.vue +23 -0
  172. package/vue-components/v3/searchbars/SearchBar.vue +50 -34
  173. package/vue-components/v3/sidebar/AccentColorPicker.vue +97 -0
  174. package/vue-components/v3/sidebar/ClusterSwitcher.vue +71 -86
  175. package/vue-components/v3/sidebar/Sidebar.vue +239 -0
  176. package/vue-components/v3/sidebar/SidebarBody.vue +14 -0
  177. package/vue-components/v3/sidebar/SidebarFooter.vue +89 -0
  178. package/vue-components/v3/sidebar/SidebarHeader.vue +131 -0
  179. package/vue-components/v3/sidebar/SidebarItem.vue +62 -0
  180. package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +101 -104
  181. package/vue-components/v3/sidebar/SidebarMenuList.vue +9 -0
  182. package/vue-components/v3/sidebar/Steps.vue +152 -0
  183. package/vue-components/v3/sidebar/sidebar-tabs/SidebarTabs.vue +204 -0
  184. package/vue-components/v3/sidebar/sidebar-tabs/SidebarTabsLayout.vue +44 -0
  185. package/vue-components/v3/sidebar/sidebar-tabs/TabsContent.vue +99 -0
  186. package/vue-components/v3/tab/TabItem.vue +10 -12
  187. package/vue-components/v3/tab/Tabs.vue +36 -0
  188. package/vue-components/v3/tab/TabsBody.vue +7 -0
  189. package/vue-components/v3/table/EmptyTableInfo.vue +8 -0
  190. package/vue-components/v3/table/FakeTableCell.vue +22 -31
  191. package/vue-components/v3/table/InfoTable.vue +89 -61
  192. package/vue-components/v3/table/MultiInfoTable.vue +72 -95
  193. package/vue-components/v3/table/Table.vue +596 -157
  194. package/vue-components/v3/table/TableCell.vue +13 -24
  195. package/vue-components/v3/table/TableContainer.vue +50 -28
  196. package/vue-components/v3/table/TableRow.vue +65 -87
  197. package/vue-components/v3/table/table-cell/ArrayCell.vue +94 -103
  198. package/vue-components/v3/table/table-cell/CellValue.vue +74 -106
  199. package/vue-components/v3/table/table-cell/GenericCell.vue +43 -42
  200. package/vue-components/v3/table/table-cell/ObjectCell.vue +91 -101
  201. package/vue-components/v3/table/table-cell/ValueWithModal.vue +22 -31
  202. package/vue-components/v3/tabs/EditorTabs.vue +18 -24
  203. package/vue-components/v3/tag/Tag.vue +16 -12
  204. package/vue-components/v3/tag/Tags.vue +7 -0
  205. package/base/utilities/_derived-variables.scss +0 -25
  206. package/base/utilities/_initial-variables.scss +0 -215
  207. package/base/utilities/dark-theme.scss +0 -26
  208. package/components/_ac-card.scss +0 -597
  209. package/components/_ac-input.scss +0 -876
  210. package/mixins/stickyContent.js +0 -141
  211. package/plugins/caching.ts +0 -243
  212. package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +0 -92
  213. package/vue-components/v3/modals/LongRunningTasksModal.vue +0 -400
  214. package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +0 -148
  215. /package/components/{_ac-report.scss → _report.scss} +0 -0
@@ -1,7 +1,54 @@
1
+ <script setup lang="ts">
2
+ import DOMPurify from "dompurify";
3
+ import { computed, defineAsyncComponent, toRefs } from "vue";
4
+
5
+ const AcButton = defineAsyncComponent(() => import("../button/Button.vue"));
6
+
7
+ interface Props {
8
+ notificationType?: string;
9
+ content?: string;
10
+ hideIcon?: boolean;
11
+ actionButton?: {
12
+ show: boolean;
13
+ title: string;
14
+ iconClass: string;
15
+ action: (...args: any) => void | undefined;
16
+ };
17
+ }
18
+
19
+ const props = withDefaults(defineProps<Props>(), {
20
+ notificationType: "",
21
+ content: "",
22
+ hideIcon: false,
23
+ actionButton: undefined,
24
+ });
25
+
26
+ const { notificationType, content, hideIcon, actionButton } = toRefs(props);
27
+
28
+ const iconClass = computed(() => {
29
+ if (notificationType.value === "success") return "fa-check-circle";
30
+ else if (notificationType.value === "info") return "fa-info-circle ";
31
+ else if (notificationType.value === "error") return "fa-times-circle";
32
+ else return "fa-info-circle";
33
+ });
34
+ const backgroundColor = computed(() => {
35
+ if (notificationType.value === "success") return "is-success";
36
+ else if (notificationType.value === "error") return "is-danger";
37
+ else return "";
38
+ });
39
+
40
+ const getSanitizedHtml = (content: string) => {
41
+ return DOMPurify.sanitize(content || "");
42
+ };
43
+ </script>
44
+
1
45
  <template>
2
46
  <!-- alert-message area start -->
3
- <!-- plsease, use this class name ('.is-info' 'is-success', 'is-error', 'is-warning') -->
4
- <div :class="`ac-notification is-${notificationType} mb-15`">
47
+ <!-- plsease, use this class name ('.is-info' 'is-success', 'is-danger', 'is-warning') -->
48
+ <div
49
+ class="ac-notification is-${notificationType} mb-15"
50
+ :class="backgroundColor"
51
+ >
5
52
  <p>
6
53
  <i v-if="!hideIcon" :class="`fa ${iconClass} mr-5`"></i
7
54
  ><span v-html="getSanitizedHtml(content)"></span>
@@ -18,44 +65,224 @@
18
65
  <!-- alert-message area end -->
19
66
  </template>
20
67
 
21
- <script setup lang="ts">
22
- import { toRefs, computed, defineAsyncComponent } from "vue";
23
- import DOMPurify from "dompurify";
68
+ <style lang="scss" scoped>
69
+ // for alert message
70
+ .ac-notification {
71
+ background-color: #dee7f5;
72
+ font-size: 13px;
73
+ color: $primary;
74
+ min-height: 36px;
75
+ display: flex;
76
+ align-items: center;
77
+ padding: 8px 16px;
78
+ overflow: hidden;
79
+ border: 1px solid $primary;
80
+ border-radius: 4px;
81
+ justify-content: flex-start;
82
+ position: relative;
83
+ z-index: 1;
84
+ min-width: 280px;
24
85
 
25
- const AcButton = defineAsyncComponent(
26
- () => import("@appscode/design-system/vue-components/v3/button/Button.vue")
27
- );
28
-
29
- const props = withDefaults(
30
- defineProps<{
31
- notificationType: string;
32
- content: string;
33
- hideIcon: boolean;
34
- actionButton?: {
35
- show: boolean;
36
- title: string;
37
- iconClass: string;
38
- action: (...args: any) => void | undefined;
39
- };
40
- }>(),
41
- {
42
- notificationType: "",
43
- content: "",
44
- hideIcon: false,
45
- actionButton: undefined,
46
- }
47
- );
86
+ p {
87
+ color: $primary;
88
+ margin-bottom: 0;
48
89
 
49
- const { notificationType, content, hideIcon, actionButton } = toRefs(props);
90
+ .close-icon {
91
+ padding-right: 10px;
92
+ font-size: 15px;
93
+ }
50
94
 
51
- const iconClass = computed(() => {
52
- if (notificationType.value === "success") return "fa-check-circle";
53
- else if (notificationType.value === "info") return "fa-info-circle";
54
- else if (notificationType.value === "error") return "fa-times-circle";
55
- else return "fa-info-circle";
56
- });
95
+ a {
96
+ text-decoration: underline;
97
+ color: $primary;
57
98
 
58
- const getSanitizedHtml = (content: string) => {
59
- return DOMPurify.sanitize(content || "");
60
- };
61
- </script>
99
+ &:hover {
100
+ color: hsla(
101
+ var(--hsl-hue),
102
+ var(--hsl-saturation),
103
+ calc(var(--hsl-lightness) - 10%),
104
+ 1
105
+ );
106
+ }
107
+ }
108
+ }
109
+
110
+ button.close {
111
+ background-color: transparent;
112
+ cursor: pointer;
113
+ right: 0px;
114
+ position: absolute;
115
+ box-shadow: none;
116
+ border: none;
117
+ font-size: 14px;
118
+ color: $danger;
119
+ width: 40px;
120
+ height: 100%;
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: center;
124
+ }
125
+ }
126
+
127
+ // mixin for .ac-notification
128
+ @mixin acNotification($colorName) {
129
+ background-color: scale-color($color: $colorName, $lightness: 80%);
130
+ color: $white-100;
131
+ border-color: $colorName;
132
+
133
+ p {
134
+ color: $colorName;
135
+
136
+ a {
137
+ color: $colorName;
138
+
139
+ &:hover {
140
+ color: $colorName;
141
+ opacity: 0.8;
142
+ }
143
+ }
144
+ }
145
+ }
146
+ @mixin acPrimaryNotification() {
147
+ background-color: hsla(
148
+ var(--hsl-hue),
149
+ var(--hsl-saturation),
150
+ var(--hsl-lightness),
151
+ 0.2
152
+ );
153
+ color: $white-100;
154
+ border-color: $primary;
155
+
156
+ p {
157
+ color: $primary;
158
+
159
+ a {
160
+ color: $primary;
161
+
162
+ &:hover {
163
+ color: $primary;
164
+ opacity: 0.8;
165
+ }
166
+ }
167
+ }
168
+ }
169
+
170
+ // is-primary
171
+ .ac-notification.is-primary {
172
+ @include acPrimaryNotification();
173
+ }
174
+
175
+ // is.info
176
+ .ac-notification.is-info {
177
+ @include acNotification($info);
178
+ }
179
+
180
+ // is.success
181
+ .ac-notification.is-success {
182
+ @include acNotification($success);
183
+ }
184
+
185
+ // is-danger
186
+ .ac-notification.is-danger {
187
+ @include acNotification($danger);
188
+ }
189
+
190
+ // is-warning
191
+ .ac-notification.is-warning {
192
+ @include acNotification($warning);
193
+ }
194
+
195
+ /*====================================
196
+ AC Toast
197
+ =====================================*/
198
+
199
+ .ac-toast {
200
+ width: 350px;
201
+ display: flex;
202
+ align-items: center;
203
+ justify-content: space-between;
204
+ font-size: 13px;
205
+ border-radius: 4px;
206
+ position: relative;
207
+ padding-right: 30px;
208
+ margin-bottom: 10px;
209
+
210
+ * {
211
+ color: $white-100;
212
+ }
213
+
214
+ p {
215
+ padding-left: 16px;
216
+
217
+ i.fa {
218
+ padding-right: 0 !important;
219
+ margin-right: 4px;
220
+ }
221
+ }
222
+
223
+ a {
224
+ font-weight: 500;
225
+ text-decoration: underline;
226
+ padding: 0 15px;
227
+
228
+ &:hover {
229
+ color: $black-70;
230
+ }
231
+ }
232
+
233
+ button.close-button {
234
+ border-radius: 0px;
235
+ background-color: transparent;
236
+ border: none;
237
+ color: $white-100;
238
+ position: absolute;
239
+ right: 0;
240
+ top: 0;
241
+ padding: 5px;
242
+ height: 100%;
243
+ width: 30px;
244
+ z-index: 1;
245
+ cursor: pointer;
246
+ border-left: 1px solid #dddddd;
247
+ }
248
+ }
249
+
250
+ // mixin for .ac-toast
251
+ @mixin acToast($colorName) {
252
+ background-color: $colorName;
253
+ color: $white-100;
254
+ border-color: $colorName;
255
+ }
256
+
257
+ // is-primary
258
+ .ac-toast.is-primary {
259
+ @include acToast($primary);
260
+ }
261
+
262
+ // is-info
263
+ .ac-toast.is-info {
264
+ @include acToast($info);
265
+ }
266
+
267
+ // is.success
268
+ .ac-toast.is-success {
269
+ @include acToast($success);
270
+ }
271
+
272
+ // is-danger
273
+ .ac-toast.is-danger {
274
+ @include acToast($danger);
275
+ }
276
+
277
+ // is-warning
278
+ .ac-toast.is-warning {
279
+ @include acToast($warning);
280
+ }
281
+
282
+ // dark theme start
283
+ // .is-dark-theme {
284
+ // .ac-notification.is-danger {
285
+ // background-color: $black-80;
286
+ // }
287
+ // }
288
+ </style>
@@ -1,53 +1,16 @@
1
- <template>
2
- <div
3
- @mouseenter="notificationPanelOpen = true"
4
- @mouseleave="notificationPanelOpen = false"
5
- >
6
- <button class="button ac-nav-button">
7
- <span v-if="unreadCount">{{ unreadCount }}</span>
8
- <i
9
- class="fa fa-bell"
10
- :class="{ 'ac-shake': unreadCount }"
11
- aria-hidden="true"
12
- ></i>
13
- </button>
14
- <div class="ac-menu-content is-notification">
15
- <div class="notification-header">
16
- <div class="left-content">
17
- <p>
18
- Notifications <span>({{ notifications.length }})</span>
19
- </p>
20
- </div>
21
- <div class="right-content"></div>
22
- </div>
23
- <div :key="notificationPanelOpen ? 1 : 0" class="notification-body">
24
- <transition-group v-if="notifications.length" name="slide-right">
25
- <notification-item
26
- v-for="notification in notifications"
27
- :key="`${notification.id}${unreadCount}`"
28
- :notification="notification"
29
- />
30
- </transition-group>
31
- <span v-else class="single-notification-item"
32
- >No new notifications</span
33
- >
34
- </div>
35
- </div>
36
- </div>
37
- </template>
38
-
39
1
  <script setup lang="ts">
40
- import { NatsConnection, StringCodec, Subscription } from "nats.ws";
2
+ import { StringCodec } from "nats.ws";
3
+ import type { NatsConnection, Subscription } from "nats.ws";
41
4
  import {
42
5
  computed,
43
6
  defineAsyncComponent,
44
7
  getCurrentInstance,
45
8
  ref,
46
- Ref,
47
9
  watch,
48
10
  } from "vue";
49
- import { TaskLog } from "../../../typings/long-running-tasks";
50
- import { Notification } from "../../../typings/notification";
11
+ import type { Ref } from "vue";
12
+ // import type { TaskLog } from "../../types/longRunningTasks";
13
+ import type { Notification } from "../../types/notification";
51
14
 
52
15
  const NotificationItem = defineAsyncComponent(
53
16
  () => import("./NotificationItem.vue")
@@ -81,13 +44,18 @@ async function subscribeToNotifcations() {
81
44
 
82
45
  if (subscription) {
83
46
  // listen to channel events
47
+ //@ts-ignore
84
48
  for await (const msg of subscription) {
85
49
  console.log("notifications ===>");
86
50
  console.log({ data: StringCodec().decode(msg.data) });
87
- const log: TaskLog = JSON.parse(StringCodec().decode(msg.data));
51
+ const log = JSON.parse(StringCodec().decode(msg.data));
88
52
  console.log({ log });
89
53
  const currentTime = new Date().getTime();
90
- addNewNotification({ ...log, id: currentTime, time: currentTime });
54
+ addNewNotification({
55
+ ...log,
56
+ id: String(currentTime),
57
+ time: currentTime,
58
+ });
91
59
  msg.respond();
92
60
  }
93
61
  console.log("Stopped listening to Notifications");
@@ -96,3 +64,41 @@ async function subscribeToNotifcations() {
96
64
  }
97
65
  subscribeToNotifcations();
98
66
  </script>
67
+
68
+ <template>
69
+ <div
70
+ @mouseenter="notificationPanelOpen = true"
71
+ @mouseleave="notificationPanelOpen = false"
72
+ >
73
+ <button class="button ac-nav-button">
74
+ <span v-if="unreadCount">{{ unreadCount }}</span>
75
+ <i
76
+ class="fa fa-bell"
77
+ :class="{ 'ac-shake': unreadCount }"
78
+ aria-hidden="true"
79
+ ></i>
80
+ </button>
81
+ <div class="ac-menu-content is-notification">
82
+ <div class="notification-header">
83
+ <div class="left-content">
84
+ <p>
85
+ Notifications <span>({{ notifications.length }})</span>
86
+ </p>
87
+ </div>
88
+ <div class="right-content"></div>
89
+ </div>
90
+ <div :key="notificationPanelOpen ? 1 : 0" class="notification-body">
91
+ <transition-group v-if="notifications.length" name="slide-right">
92
+ <notification-item
93
+ v-for="notification in notifications"
94
+ :key="`${notification.id}${unreadCount}`"
95
+ :notification="notification"
96
+ />
97
+ </transition-group>
98
+ <span v-else class="single-notification-item"
99
+ >No new notifications</span
100
+ >
101
+ </div>
102
+ </div>
103
+ </div>
104
+ </template>
@@ -1,3 +1,54 @@
1
+ <script setup lang="ts">
2
+ import { computed, toRefs } from "vue";
3
+ import moment from "moment";
4
+ import type { Notification } from "../../types/notification";
5
+
6
+ interface Props {
7
+ notification?: Notification;
8
+ }
9
+
10
+ const props = withDefaults(defineProps<Props>(), {
11
+ notification: () => ({
12
+ id: "0",
13
+ status: "Pending",
14
+ time: 0,
15
+ }),
16
+ });
17
+
18
+ const getDayDifferences = (options: { past: number }) => {
19
+ const past = moment(options.past).isValid()
20
+ ? moment(options.past).valueOf() / 1000
21
+ : options.past;
22
+ const now = Date.now() / 1000;
23
+ const diff = now - past;
24
+ if (options.past > 10) {
25
+ let ret = Math.floor(diff / 86400);
26
+ let unit = "";
27
+ if (diff < 60) {
28
+ ret = diff;
29
+ unit = " Second";
30
+ } else if (diff < 3600) {
31
+ ret = diff / 60;
32
+ unit = " Minute";
33
+ } else if (diff < 86400) {
34
+ ret = diff / 3600;
35
+ unit = " Hour";
36
+ } else {
37
+ ret = diff / 86400;
38
+ unit = " Day";
39
+ }
40
+ unit += ret > 1 ? "s" : "";
41
+ return ret + unit;
42
+ }
43
+ return undefined;
44
+ };
45
+
46
+ const { notification } = toRefs(props);
47
+ const notificationTime = computed(() =>
48
+ getDayDifferences({ past: notification?.value?.time || 0 })
49
+ );
50
+ </script>
51
+
1
52
  <template>
2
53
  <a class="single-notification-item is-complete">
3
54
  <p>
@@ -31,22 +82,3 @@
31
82
  </div>
32
83
  </a>
33
84
  </template>
34
-
35
- <script setup lang="ts">
36
- import { computed, toRefs } from 'vue'
37
- import { Notification } from '../../../typings/notification'
38
- import TimeConvert from '../../../plugins/time-convert'
39
-
40
- const props = withDefaults(defineProps<{ notification: Notification }>(), {
41
- notification: () => ({
42
- id: 0,
43
- status: 'Pending',
44
- time: 0,
45
- }),
46
- })
47
-
48
- const { notification } = toRefs(props)
49
- const notificationTime = computed(() =>
50
- TimeConvert.getDayDifferences({ past: notification.value.time })
51
- )
52
- </script>
@@ -0,0 +1,197 @@
1
+ <script setup lang="ts">
2
+ import { onMounted, onUnmounted, ref, type Ref } from "vue";
3
+
4
+ interface Props {
5
+ modifierClasses?: string;
6
+ position?: string;
7
+ }
8
+
9
+ withDefaults(defineProps<Props>(), {
10
+ modifierClasses: "",
11
+ position: "",
12
+ });
13
+
14
+ const showOptions = ref(false);
15
+
16
+ onMounted(() => {
17
+ document.addEventListener("click", documentClick);
18
+ });
19
+ onUnmounted(() => {
20
+ document.removeEventListener("click", documentClick);
21
+ });
22
+ const clusterOptionsButtons: Ref<HTMLElement | null> = ref(null);
23
+
24
+ const documentClick = (e: Event) => {
25
+ const el = clusterOptionsButtons.value;
26
+ const target = e.target as HTMLInputElement;
27
+ if (el != target && !el?.contains(target)) {
28
+ showOptions.value = false;
29
+ }
30
+ };
31
+ </script>
32
+ <template>
33
+ <button
34
+ class="ac-options"
35
+ ref="clusterOptionsButtons"
36
+ data-testid="cluster-option-buttons"
37
+ :class="position"
38
+ @click.prevent.stop="showOptions = !showOptions"
39
+ >
40
+ <div class="option-dots">
41
+ <span></span>
42
+ <span></span>
43
+ <span></span>
44
+ </div>
45
+ <!-- dropdown Item start -->
46
+ <!-- use "is-hidden" class in the line below for hide dropdown element -->
47
+ <slot :class="{ 'is-hidden': !showOptions }" />
48
+ <!-- dropdown Item end -->
49
+ </button>
50
+ </template>
51
+
52
+ <style lang="scss">
53
+ .ac-options {
54
+ border-radius: 50%;
55
+ width: 32px;
56
+ height: 32px;
57
+ text-align: center;
58
+ margin: 0;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ border: none;
63
+ background-color: transparent;
64
+ cursor: pointer;
65
+ &:hover {
66
+ background-color: $primary-90;
67
+ }
68
+
69
+ &:focus-within {
70
+ .options-items {
71
+ opacity: 1;
72
+ visibility: visible;
73
+ }
74
+ }
75
+
76
+ &.is-horaizental {
77
+ .option-dots {
78
+ flex-direction: row;
79
+
80
+ span {
81
+ margin-bottom: 0;
82
+ margin-right: 2px;
83
+ }
84
+ }
85
+ }
86
+
87
+ &.is-centered {
88
+ .option-dots {
89
+ align-items: center;
90
+ }
91
+
92
+ .options-items {
93
+ left: 50%;
94
+ }
95
+ }
96
+
97
+ &.is-right {
98
+ .option-dots {
99
+ align-items: flex-end;
100
+ }
101
+
102
+ .options-items {
103
+ right: 0px;
104
+ }
105
+ }
106
+
107
+ .option-dots {
108
+ display: flex;
109
+ flex-direction: column;
110
+ cursor: pointer;
111
+ align-items: flex-start;
112
+ border: none;
113
+ background-color: transparent;
114
+ transition: 0.3 ease-in-out;
115
+
116
+ &:hover {
117
+ color: $primary;
118
+ }
119
+
120
+ span {
121
+ width: 4px;
122
+ height: 4px;
123
+ background-color: $primary-20;
124
+ border-radius: 50%;
125
+ margin-bottom: 1px;
126
+ }
127
+ }
128
+
129
+ .options-items {
130
+ border-radius: 4px;
131
+ position: absolute;
132
+ z-index: 99;
133
+ background-color: $white-100;
134
+ min-width: 160px;
135
+ top: 30px;
136
+ padding: 5px 0;
137
+ border: 1px solid $primary-90;
138
+ list-style: none;
139
+ opacity: 0;
140
+ visibility: hidden;
141
+ transition: 0.3s ease-in-out;
142
+ text-align: left;
143
+
144
+ li {
145
+ .list-button {
146
+ width: 100%;
147
+ background-color: transparent;
148
+ border: none;
149
+ cursor: pointer;
150
+ font-weight: 400;
151
+ text-align: left;
152
+ color: $primary-20;
153
+ font-size: 13px;
154
+ padding: 10px 30px;
155
+ display: block;
156
+
157
+ &:hover {
158
+ background-color: $primary-90;
159
+ color: $primary;
160
+ }
161
+
162
+ span {
163
+ background-color: transparent;
164
+
165
+ &.icon {
166
+ margin-right: 5px;
167
+ }
168
+ }
169
+ }
170
+
171
+ a {
172
+ font-size: 13px;
173
+ padding: 7px 15px;
174
+ display: block;
175
+ text-decoration: none !important;
176
+ color: $primary-10 !important;
177
+ border: none;
178
+
179
+ &:hover {
180
+ background-color: $primary-90;
181
+ color: $primary !important;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ // dark theme start
189
+ .is-dark-theme {
190
+ .ac-options {
191
+ .options-items {
192
+ --ac-white: var(--dark-bg-light);
193
+ }
194
+ }
195
+ }
196
+ // dark theme end
197
+ </style>