@appscode/design-system 1.1.0-beta.9 → 1.1.0-beta.90

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 (117) hide show
  1. package/base/utilities/_all.scss +2 -2
  2. package/base/utilities/_colors.scss +105 -136
  3. package/base/utilities/_global.scss +25 -20
  4. package/base/utilities/_layouts.scss +0 -138
  5. package/base/utilities/_typography.scss +2 -2
  6. package/components/_ac-alert-box.scss +2 -2
  7. package/components/_ac-code-highlight.scss +9 -12
  8. package/components/_ac-drag.scss +4 -4
  9. package/components/_ac-modal.scss +2 -2
  10. package/components/_ac-select-box.scss +5 -5
  11. package/components/_ac-table.scss +7 -7
  12. package/components/_ac-tabs.scss +29 -26
  13. package/components/_all.scss +8 -5
  14. package/components/_buttons.scss +10 -10
  15. package/components/_getkeeper.scss +110 -0
  16. package/components/_graph.scss +10 -10
  17. package/components/_image-upload.scss +4 -4
  18. package/components/_input-card.scss +232 -0
  19. package/components/_input.scss +573 -0
  20. package/components/_left-sidebar-menu.scss +9 -13
  21. package/components/_monaco-editor.scss +2 -2
  22. package/components/_multi-select.scss +589 -0
  23. package/components/_navbar.scss +7 -7
  24. package/components/_nested-list.scss +2 -2
  25. package/components/_overview-info.scss +3 -3
  26. package/components/_pricing-table.scss +5 -5
  27. package/components/_progress-bar.scss +61 -74
  28. package/components/_subscription-card.scss +8 -10
  29. package/components/_table-of-content.scss +4 -4
  30. package/components/{_ac-terminal.scss → _terminal.scss} +63 -74
  31. package/components/_widget-menu.scss +7 -12
  32. package/components/_wizard.scss +13 -286
  33. package/components/ac-toaster/_ac-toasted.scss +4 -4
  34. package/components/bbum/_information-center.scss +8 -10
  35. package/components/bbum/_mobile-desktop.scss +9 -14
  36. package/components/bbum/_single-post-preview.scss +9 -9
  37. package/components/ui-builder/_ui-builder.scss +202 -18
  38. package/components/ui-builder/_vue-open-api.scss +63 -18
  39. package/icons/close-icon.svg +3 -0
  40. package/layouts/_code-preview.scss +6 -7
  41. package/package.json +1 -1
  42. package/vue-components/types/notification.ts +3 -3
  43. package/vue-components/types/table.ts +1 -0
  44. package/vue-components/v2/banner/Banner.vue +1 -1
  45. package/vue-components/v2/button/Buttons.vue +1 -1
  46. package/vue-components/v2/modal/Modal.vue +1 -1
  47. package/vue-components/v3/alert/Alert.vue +2 -2
  48. package/vue-components/v3/banner/Banner.vue +2 -2
  49. package/vue-components/v3/breadcrumbs/Breadcrumb.vue +66 -4
  50. package/vue-components/v3/button/Button.vue +49 -786
  51. package/vue-components/v3/button/Buttons.vue +18 -2
  52. package/vue-components/v3/cards/Cluster.vue +37 -26
  53. package/vue-components/v3/cards/FeatureCard.vue +7 -11
  54. package/vue-components/v3/cards/FeatureCards.vue +1 -1
  55. package/vue-components/v3/cards/InfoCard.vue +1 -2
  56. package/vue-components/v3/cards/Monitoring.vue +6 -10
  57. package/vue-components/v3/cards/OverviewCard.vue +4 -0
  58. package/vue-components/v3/cards/OverviewCards.vue +10 -2
  59. package/vue-components/v3/cards/Vendor.vue +10 -6
  60. package/vue-components/v3/content/ContentHeader.vue +1 -1
  61. package/vue-components/v3/dropdown/DropdownAction.vue +95 -0
  62. package/vue-components/v3/editor/Editor.vue +20 -5
  63. package/vue-components/v3/editor/FilteredFileEditor.vue +9 -2
  64. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +4 -1
  65. package/vue-components/v3/footer/FooterArea.vue +8 -2
  66. package/vue-components/v3/footer/Info.vue +10 -8
  67. package/vue-components/v3/footer/Status.vue +24 -23
  68. package/vue-components/v3/footer/Usage.vue +20 -30
  69. package/vue-components/v3/form/Form.vue +0 -3
  70. package/vue-components/v3/form/FormFooter.vue +24 -0
  71. package/vue-components/v3/form-fields/AcSingleInput.vue +1 -508
  72. package/vue-components/v3/form-fields/FileUpload.vue +89 -0
  73. package/vue-components/v3/form-fields/Input.vue +2 -3
  74. package/vue-components/v3/header/Header.vue +1 -1
  75. package/vue-components/v3/loaders/InfoCardLoader.vue +18 -60
  76. package/vue-components/v3/loaders/SingleInfoCardLoader.vue +24 -0
  77. package/vue-components/v3/modal/Modal.vue +7 -12
  78. package/vue-components/v3/modals/JsonShowModal.vue +1 -0
  79. package/vue-components/v3/navbar/Appdrawer.vue +3 -1
  80. package/vue-components/v3/navbar/Navbar.vue +0 -159
  81. package/vue-components/v3/navbar/NavbarItem.vue +37 -15
  82. package/vue-components/v3/navbar/NavbarItemContent.vue +6 -8
  83. package/vue-components/v3/navbar/Notification.vue +38 -10
  84. package/vue-components/v3/navbar/User.vue +43 -31
  85. package/vue-components/v3/notification/AlertBox.vue +233 -3
  86. package/vue-components/v3/notification/Notification.vue +2 -2
  87. package/vue-components/v3/option-dots/Options.vue +17 -8
  88. package/vue-components/v3/pagination/Pagination.vue +27 -17
  89. package/vue-components/v3/preloader/Preloader.vue +1 -1
  90. package/vue-components/v3/searchbars/SearchBar.vue +1 -10
  91. package/vue-components/v3/sidebar/ClusterSwitcher.vue +1 -765
  92. package/vue-components/v3/sidebar/Sidebar.vue +2 -30
  93. package/vue-components/v3/sidebar/SidebarBody.vue +9 -2
  94. package/vue-components/v3/sidebar/SidebarFooter.vue +6 -3
  95. package/vue-components/v3/sidebar/SidebarHeader.vue +6 -2
  96. package/vue-components/v3/sidebar/Steps.vue +2 -2
  97. package/vue-components/v3/sidebar/sidebar-tabs/SidebarTabs.vue +78 -2
  98. package/vue-components/v3/sidebar/sidebar-tabs/SidebarTabsLayout.vue +15 -3
  99. package/vue-components/v3/tab/Tabs.vue +27 -0
  100. package/vue-components/v3/table/Table.vue +14 -16
  101. package/vue-components/v3/table/TableCell.vue +1 -9
  102. package/vue-components/v3/table/TableRow.vue +2 -2
  103. package/vue-components/v3/table/table-cell/ArrayCell.vue +35 -32
  104. package/vue-components/v3/table/table-cell/CellValue.vue +14 -40
  105. package/vue-components/v3/table/table-cell/ObjectCell.vue +40 -38
  106. package/vue-components/v3/tag/Tag.vue +1 -0
  107. package/base/utilities/dark-theme.scss +0 -26
  108. package/components/_ac-card.scss +0 -0
  109. package/components/_ac-input.scss +0 -901
  110. package/components/_ac-multi-select.scss +0 -780
  111. package/vue-components/text.vue +0 -1
  112. package/vue-components/types/longRunningTasks.ts +0 -20
  113. package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +0 -94
  114. package/vue-components/v3/modals/LongRunningTasksModal.vue +0 -402
  115. package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +0 -151
  116. /package/components/{_ac-accordion.scss → _accordion.scss} +0 -0
  117. /package/components/{_ac-report.scss → _report.scss} +0 -0
@@ -1,8 +1,15 @@
1
1
  <script setup lang="ts">
2
2
  import { defineAsyncComponent, ref, watch, computed, nextTick } from "vue";
3
- import type { User, Organization } from "../../types/user";
3
+ import HeroiconsCog6Tooth from "~icons/heroicons/cog-6-tooth";
4
+ import HeroiconsWrenchScrewdriver from "~icons/heroicons/wrench-screwdriver";
5
+ import HeroiconsUserGroup from "~icons/heroicons/user-group";
6
+ import HeroiconsChartPie from "~icons/heroicons/chart-pie";
7
+ import HeroiconsPower from "~icons/heroicons/power";
8
+ import HeroiconsCheck from "~icons/heroicons/check";
4
9
 
5
- interface FormatedOrgs extends Organization {
10
+ import type { User } from "../../types/user";
11
+
12
+ interface FormatedOrgs extends User {
6
13
  isPersonalAccount?: boolean;
7
14
  }
8
15
 
@@ -93,13 +100,13 @@ watch(dropDownStatus, (n) => {
93
100
  <navbar-item :modifierClasses="'ac-profile-button'">
94
101
  <template #navbar-item>
95
102
  <div class="ac-user-profile mr-8">
96
- <img :src="(user.avatar_url as string)" alt="User Photo" />
103
+ <img :src="user.avatar_url" alt="User Photo" />
97
104
  </div>
98
105
  {{ user.full_name || user.username }}
99
106
  <i class="fa fa-angle-down" aria-hidden="true"></i>
100
107
  </template>
101
108
  <!-- <button class="button ac-nav-button ac-profile-button">
102
-
109
+
103
110
  </button> -->
104
111
 
105
112
  <template #navbar-content>
@@ -129,17 +136,23 @@ watch(dropDownStatus, (n) => {
129
136
  <a :href="`mailto:${user.email}`"> {{ user.email }}</a>
130
137
  </div>
131
138
  </div>
132
- <transition-group name="list" tag="ul" class="list-items">
139
+ <transition-group
140
+ name="list"
141
+ tag="ul"
142
+ class="list-items py-2 ac-scrollbar px-0"
143
+ >
133
144
  <li key="settings">
134
145
  <a
135
146
  data-testid="user-settings-link"
136
147
  :href="`${serverDomain}/user/settings/`"
137
- >Settings</a
148
+ ><span class="icon"><HeroiconsCog6Tooth /></span
149
+ ><span>Settings</span></a
138
150
  >
139
151
  </li>
140
152
  <li v-if="user.is_admin" key="site-admin">
141
153
  <a data-testid="site-admin-link" :href="`${accountsDomain}/admin`"
142
- >Site Administration</a
154
+ ><span class="icon"><HeroiconsWrenchScrewdriver /></span
155
+ ><span>Site Administration</span></a
143
156
  >
144
157
  </li>
145
158
  <li
@@ -151,7 +164,10 @@ watch(dropDownStatus, (n) => {
151
164
  class="ac-dropdown-button is-fullwidth is-flex is-justify-content-space-between is-align-items-center"
152
165
  @click="toggleList()"
153
166
  >
154
- <span>Switch Account</span>
167
+ <div class="is-flex gap-8">
168
+ <span class="icon"><HeroiconsUserGroup /></span
169
+ ><span>Switch Account</span>
170
+ </div>
155
171
  <span
156
172
  ><i
157
173
  :class="`fa fa-angle-${
@@ -203,40 +219,25 @@ watch(dropDownStatus, (n) => {
203
219
  v-if="idx === 0"
204
220
  class="material-icons font-size-18 ml-10 is-pulled-right"
205
221
  >
206
- check
222
+ <HeroiconsCheck />
207
223
  </span>
208
224
  </div>
209
225
  </a>
210
226
  </li>
211
227
  </transition-group>
212
228
  </li>
213
- <li key="dashboard">
214
- <router-link
215
- v-if="isPlatformDomain"
216
- to="/dashboard"
217
- data-testid="user-dashboard-link"
218
- >
219
- Dashboard
220
- </router-link>
221
- <a
222
- v-else
223
- :href="`${serverDomain}/dashboard`"
224
- data-testid="user-dashboard-link"
225
- >
226
- Dashboard
227
- </a>
228
- </li>
229
229
  <li key="signout" @click="$emit('on-logout')">
230
230
  <a
231
231
  data-testid="user-logout-link"
232
232
  :href="`${accountsDomain}/user/logout`"
233
233
  >
234
- Sign out
234
+ <span class="icon"><HeroiconsPower /></span>
235
+ <span>Sign out</span>
235
236
  </a>
236
237
  </li>
237
- <li key="theme" v-if="showThemeMode">
238
+ <!-- <li key="theme" v-if="showThemeMode">
238
239
  <theme-mode @set:theme="setTheme" />
239
- </li>
240
+ </li> -->
240
241
  </transition-group>
241
242
  </div>
242
243
  </navbar-item-content>
@@ -253,7 +254,6 @@ watch(dropDownStatus, (n) => {
253
254
  }
254
255
  .navbar-dropdown-wrapper {
255
256
  width: 240px;
256
- transition: width 0.9s ease-in-out;
257
257
  }
258
258
 
259
259
  .user-profile-wrapper {
@@ -265,7 +265,7 @@ watch(dropDownStatus, (n) => {
265
265
  display: flex;
266
266
  align-items: center;
267
267
  border-bottom: 1px solid $primary-90;
268
- padding: 8px 16px;
268
+ padding: 16px 16px;
269
269
 
270
270
  .profile-photo {
271
271
  // width: 50px;
@@ -306,6 +306,10 @@ watch(dropDownStatus, (n) => {
306
306
  }
307
307
  }
308
308
  }
309
+ .list-items {
310
+ max-height: calc(100vh - 100px);
311
+ overflow-y: auto;
312
+ }
309
313
  }
310
314
 
311
315
  .ac-menu-item {
@@ -341,17 +345,25 @@ watch(dropDownStatus, (n) => {
341
345
 
342
346
  &.is-open {
343
347
  ul {
348
+ padding: 8px;
344
349
  max-height: 200px;
345
350
  visibility: visible;
346
351
  transition: max-height 0.25s ease-out;
352
+ li {
353
+ padding: 0;
354
+ border: 1px solid $primary-95;
355
+ }
347
356
  }
348
357
  }
349
358
  a {
350
- padding: 6px 16px;
359
+ padding: 8px 16px;
351
360
  font-weight: 500;
352
361
  display: block;
353
362
  color: $primary-10;
354
363
  transition: 0.3s;
364
+ display: flex;
365
+ align-items: center;
366
+ gap: 8px;
355
367
 
356
368
  &:hover {
357
369
  background-color: $primary-97;
@@ -27,10 +27,15 @@ const { notificationType, content, hideIcon, actionButton } = toRefs(props);
27
27
 
28
28
  const iconClass = computed(() => {
29
29
  if (notificationType.value === "success") return "fa-check-circle";
30
- else if (notificationType.value === "info") return "fa-info-circle";
31
- else if (notificationType.value === "danger") return "fa-times-circle";
30
+ else if (notificationType.value === "info") return "fa-info-circle ";
31
+ else if (notificationType.value === "error") return "fa-times-circle";
32
32
  else return "fa-info-circle";
33
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
+ });
34
39
 
35
40
  const getSanitizedHtml = (content: string) => {
36
41
  return DOMPurify.sanitize(content || "");
@@ -40,7 +45,10 @@ const getSanitizedHtml = (content: string) => {
40
45
  <template>
41
46
  <!-- alert-message area start -->
42
47
  <!-- plsease, use this class name ('.is-info' 'is-success', 'is-danger', 'is-warning') -->
43
- <div :class="`notification is-${notificationType} mb-15`">
48
+ <div
49
+ class="ac-notification is-${notificationType} mb-15"
50
+ :class="backgroundColor"
51
+ >
44
52
  <p>
45
53
  <i v-if="!hideIcon" :class="`fa ${iconClass} mr-5`"></i
46
54
  ><span v-html="getSanitizedHtml(content)"></span>
@@ -56,3 +64,225 @@ const getSanitizedHtml = (content: string) => {
56
64
  </div>
57
65
  <!-- alert-message area end -->
58
66
  </template>
67
+
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;
85
+
86
+ p {
87
+ color: $primary;
88
+ margin-bottom: 0;
89
+
90
+ .close-icon {
91
+ padding-right: 10px;
92
+ font-size: 15px;
93
+ }
94
+
95
+ a {
96
+ text-decoration: underline;
97
+ color: $primary;
98
+
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>
@@ -9,7 +9,7 @@ import {
9
9
  watch,
10
10
  } from "vue";
11
11
  import type { Ref } from "vue";
12
- import type { TaskLog } from "../../types/longRunningTasks";
12
+ // import type { TaskLog } from "../../types/longRunningTasks";
13
13
  import type { Notification } from "../../types/notification";
14
14
 
15
15
  const NotificationItem = defineAsyncComponent(
@@ -48,7 +48,7 @@ async function subscribeToNotifcations() {
48
48
  for await (const msg of subscription) {
49
49
  console.log("notifications ===>");
50
50
  console.log({ data: StringCodec().decode(msg.data) });
51
- const log: TaskLog = JSON.parse(StringCodec().decode(msg.data));
51
+ const log = JSON.parse(StringCodec().decode(msg.data));
52
52
  console.log({ log });
53
53
  const currentTime = new Date().getTime();
54
54
  addNewNotification({
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { type Ref, onMounted, onUnmounted, ref } from "vue";
2
+ import { onMounted, onUnmounted, ref, type Ref } from "vue";
3
3
 
4
4
  interface Props {
5
5
  modifierClasses?: string;
@@ -44,18 +44,28 @@ const documentClick = (e: Event) => {
44
44
  </div>
45
45
  <!-- dropdown Item start -->
46
46
  <!-- use "is-hidden" class in the line below for hide dropdown element -->
47
- <slot v-if="showOptions" />
47
+ <slot :class="{ 'is-hidden': !showOptions }" />
48
48
  <!-- dropdown Item end -->
49
49
  </button>
50
50
  </template>
51
51
 
52
52
  <style lang="scss">
53
53
  .ac-options {
54
- position: relative;
55
- z-index: 9;
56
- background-color: transparent;
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;
57
62
  border: none;
58
- box-shadow: none;
63
+ background-color: transparent;
64
+ cursor: pointer;
65
+ &:hover {
66
+ background-color: $primary-90;
67
+ }
68
+
59
69
  &:focus-within {
60
70
  .options-items {
61
71
  opacity: 1;
@@ -87,8 +97,6 @@ const documentClick = (e: Event) => {
87
97
  &.is-right {
88
98
  .option-dots {
89
99
  align-items: flex-end;
90
- padding: 0 10px;
91
- margin-right: -10px;
92
100
  }
93
101
 
94
102
  .options-items {
@@ -131,6 +139,7 @@ const documentClick = (e: Event) => {
131
139
  opacity: 0;
132
140
  visibility: hidden;
133
141
  transition: 0.3s ease-in-out;
142
+ text-align: left;
134
143
 
135
144
  li {
136
145
  .list-button {
@@ -1,22 +1,30 @@
1
1
  <script setup lang="ts">
2
- import { ref, computed, watch } from "vue";
2
+ import { computed, ref, watch } from "vue";
3
3
 
4
4
  interface Props {
5
5
  hideRowsPerPageSelection?: boolean;
6
6
  totalNoOfItems?: number;
7
- preSelectedItemsCountPerPage?: number;
7
+ itemsPerPage?: number;
8
8
  }
9
9
 
10
10
  const props = withDefaults(defineProps<Props>(), {
11
11
  hideRowsPerPageSelection: false,
12
12
  totalNoOfItems: 0,
13
- preSelectedItemsCountPerPage: 5,
13
+ itemsPerPage: 5,
14
14
  });
15
15
 
16
- const emit = defineEmits(["pagination:pagechange"]);
16
+ const emit = defineEmits(["pagination:pagechange", "pagination:countchange"]);
17
17
 
18
18
  const activePageNo = ref(1);
19
- const selectedItemCountPerPage = ref(props.preSelectedItemsCountPerPage);
19
+ const selectedItemCountPerPage = computed({
20
+ get() {
21
+ return props.itemsPerPage;
22
+ },
23
+ set(n) {
24
+ activePageNo.value = 1;
25
+ emit("pagination:countchange", n);
26
+ },
27
+ });
20
28
 
21
29
  const noOfPages = computed(() => {
22
30
  return Math.ceil(props.totalNoOfItems / selectedItemCountPerPage.value);
@@ -35,9 +43,9 @@ const pageRange = computed(() => {
35
43
  if (activePageNo.value < 3) {
36
44
  o.start = 1;
37
45
  o.end = 5;
38
- } else if (activePageNo.value > noOfPageNos.value - 2) {
39
- o.start = noOfPageNos.value - 4;
40
- o.end = noOfPageNos.value;
46
+ } else if (activePageNo.value >= noOfPages.value - 2) {
47
+ o.start = noOfPages.value - 4;
48
+ o.end = noOfPages.value;
41
49
  } else {
42
50
  o.start = activePageNo.value - 2;
43
51
  o.end = activePageNo.value + 2;
@@ -79,7 +87,7 @@ const changePage = (page: number) => {
79
87
  };
80
88
 
81
89
  const nextPage = () => {
82
- activePageNo.value = Math.min(activePageNo.value + 1, noOfPageNos.value);
90
+ activePageNo.value = Math.min(activePageNo.value + 1, noOfPages.value);
83
91
  };
84
92
 
85
93
  watch(
@@ -89,12 +97,9 @@ watch(
89
97
  },
90
98
  {
91
99
  deep: true,
100
+ immediate: true,
92
101
  }
93
102
  );
94
-
95
- watch(selectedItemCountPerPage, () => {
96
- activePageNo.value = 1;
97
- });
98
103
  </script>
99
104
 
100
105
  <template>
@@ -102,10 +107,7 @@ watch(selectedItemCountPerPage, () => {
102
107
  <div class="pagination-filter level-left">
103
108
  <div
104
109
  class="level-item"
105
- v-show="
106
- !hideRowsPerPageSelection &&
107
- totalNoOfItems > preSelectedItemsCountPerPage
108
- "
110
+ v-show="!hideRowsPerPageSelection && totalNoOfItems > itemsPerPage"
109
111
  >
110
112
  <label>Rows per page</label>
111
113
  <select
@@ -172,6 +174,7 @@ watch(selectedItemCountPerPage, () => {
172
174
  ul {
173
175
  li {
174
176
  display: inline-block;
177
+
175
178
  a {
176
179
  display: block;
177
180
  width: 20px;
@@ -188,12 +191,15 @@ watch(selectedItemCountPerPage, () => {
188
191
  color: $white-100;
189
192
  border: 1px solid $primary-90;
190
193
  }
194
+
191
195
  &.previous {
192
196
  background-color: $primary-97;
193
197
  }
198
+
194
199
  &.next {
195
200
  background-color: $primary-97;
196
201
  }
202
+
197
203
  &.is-current {
198
204
  background-color: $primary;
199
205
  color: $white-100;
@@ -207,11 +213,13 @@ watch(selectedItemCountPerPage, () => {
207
213
  .pagination-filter {
208
214
  color: $primary-30;
209
215
  font-size: 12px;
216
+
210
217
  span {
211
218
  font-weight: 500;
212
219
  padding: 0 4px;
213
220
  }
214
221
  }
222
+
215
223
  .pagination-filter {
216
224
  select {
217
225
  background-color: $primary-97;
@@ -220,10 +228,12 @@ watch(selectedItemCountPerPage, () => {
220
228
  margin-left: 4px;
221
229
  height: 22px;
222
230
  padding: 0 4px;
231
+
223
232
  &:focus,
224
233
  &:active,
225
234
  &:focus-visible {
226
235
  border: 1px solid $primary;
236
+ outline: none;
227
237
  }
228
238
  }
229
239
  }
@@ -12,7 +12,7 @@ withDefaults(defineProps<Props>(), {
12
12
 
13
13
  <template>
14
14
  <div
15
- class="is-flex is-justify-content-center is-align-items-center is-flex-direction-column ac-preloader"
15
+ class="is-flex is-justify-content-center is-align-items-center is-flex-direction-column ac-preloader page-loader"
16
16
  style="height: calc(100vh - 200px)"
17
17
  >
18
18
  <span v-if="showSpinner" class="spinner"></span>
@@ -20,7 +20,7 @@ const emit = defineEmits(["search"]);
20
20
  const searchText = ref("");
21
21
 
22
22
  watch(searchText, (n) => {
23
- emit("search", n);
23
+ emit("search", n.trim());
24
24
  });
25
25
  </script>
26
26
 
@@ -58,15 +58,6 @@ watch(searchText, (n) => {
58
58
  .ac-single-input {
59
59
  width: 200px;
60
60
  transition: 0.3s all;
61
- input {
62
- // padding: 0 20px;
63
- &::placeholder {
64
- // opacity: 0;
65
- }
66
- &:focus {
67
- // opacity: 1;
68
- }
69
- }
70
61
  }
71
62
  }
72
63
  </style>