@appscode/design-system 1.1.0-beta.70 → 1.1.0-beta.71

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": "1.1.0-beta.70",
3
+ "version": "1.1.0-beta.71",
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,6 @@
1
1
  <script setup lang="ts">
2
2
  interface Props {
3
- modelValue?: string | number;
3
+ modelValue?: string;
4
4
  }
5
5
 
6
6
  withDefaults(defineProps<Props>(), {
@@ -18,10 +18,9 @@ const handleInput = (e: Event) => {
18
18
  <template>
19
19
  <input
20
20
  class="ac-input"
21
+ :class="{ 'width-200': modelValue }"
21
22
  data-testid="ac-input"
22
23
  :value="modelValue"
23
24
  @input="handleInput"
24
25
  />
25
26
  </template>
26
-
27
- <style lang="scss" scoped></style>
@@ -4,19 +4,27 @@ import { computed, ref, watch } from "vue";
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,6 +228,7 @@ 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 {
@@ -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