@pocketprep/ui-kit 3.4.25 → 3.4.27

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.
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <div class="filter">
2
+ <div class="uikit-filter">
3
3
  <Link
4
4
  v-dark="isDarkMode"
5
5
  :has-icon="true"
6
6
  :aria-expanded="showFilterDropdown ? 'true' : 'false'"
7
- class="filter__link"
7
+ class="uikit-filter__link"
8
8
  :class="{
9
- 'filter__link--open': showFilterDropdown,
10
- 'filter__link--responsive': responsiveButton,
9
+ 'uikit-filter__link--open': showFilterDropdown,
10
+ 'uikit-filter__link--responsive': responsiveButton,
11
11
  }"
12
12
  role="button"
13
13
  type="tertiary"
@@ -17,12 +17,12 @@
17
17
  >
18
18
  <Icon
19
19
  type="filter"
20
- class="filter__icon"
20
+ class="uikit-filter__icon"
21
21
  />
22
22
  <span
23
- class="filter__text"
23
+ class="uikit-filter__text"
24
24
  :class="{
25
- 'filter__text--responsive': responsiveButton,
25
+ 'uikit-filter__text--responsive': responsiveButton,
26
26
  }"
27
27
  >
28
28
  {{ filterLabel }}
@@ -31,10 +31,10 @@
31
31
  <div
32
32
  v-if="showFilterDropdown"
33
33
  v-dark="isDarkMode"
34
- class="filter__dropdown"
34
+ class="uikit-filter__dropdown"
35
35
  :class="{
36
- [`filter__dropdown--${align}`]: true,
37
- [`filter__dropdown--${size}`]: true
36
+ [`uikit-filter__dropdown--${align}`]: true,
37
+ [`uikit-filter__dropdown--${size}`]: true
38
38
  }"
39
39
  >
40
40
  <slot name="filterOptions">
@@ -103,7 +103,7 @@ export default class FilterDropdown extends Vue {
103
103
  clickListener (e: MouseEvent) {
104
104
  if (this.showFilterDropdown) {
105
105
  const targetEl = e.target as HTMLElement
106
- if (!targetEl?.closest('.filter')
106
+ if (!targetEl?.closest('.uikit-filter')
107
107
  && this.showFilterDropdown !== 'checkbox'
108
108
  && document.body.contains(targetEl)
109
109
  ) {
@@ -155,7 +155,7 @@ export default class FilterDropdown extends Vue {
155
155
  @import '../../styles/colors';
156
156
  @import '../../styles/breakpoints';
157
157
 
158
- .filter {
158
+ .uikit-filter {
159
159
  position: relative;
160
160
  z-index: 2;
161
161
 
@@ -199,13 +199,13 @@ export default class FilterDropdown extends Vue {
199
199
  z-index: 1;
200
200
  box-sizing: border-box;
201
201
  background: $white;
202
- box-shadow: 0 6px 22px 0 rgba($brand-black, 0.1);
202
+ box-shadow: 0 6px 22px 0 rgba($brand-black, 0.2);
203
203
  max-height: 305px;
204
204
  overflow: auto;
205
205
 
206
206
  &--dark {
207
207
  background: $brand-black;
208
- box-shadow: 0 1px 6px 0 rgba($jet, 0.3);
208
+ box-shadow: 0 6px 22px 0 rgba($jet, 0.6);
209
209
  }
210
210
 
211
211
  &--left {
@@ -10,6 +10,7 @@
10
10
  <IconHelp v-else-if="type === 'help'" :title="title" />
11
11
  <IconArrow v-else-if="type === 'arrow'" :title="title" />
12
12
  <IconPaginationArrow v-else-if="type === 'paginationArrow'" :title="title" />
13
+ <IconPaginationArrowDouble v-else-if="type === 'paginationArrowDouble'" :title="title" />
13
14
  <IconAccordionArrow v-else-if="type === 'accordionArrow'" :title="title" />
14
15
  <IconQuestions v-else-if="type === 'questions'" :title="title" />
15
16
  <IconSubject v-else-if="type === 'subject'" :title="title" />
@@ -88,6 +89,7 @@ import IconHelp from './IconHelp.vue'
88
89
  import IconArrow from './IconArrow.vue'
89
90
  import IconAccordionArrow from './IconAccordionArrow.vue'
90
91
  import IconPaginationArrow from './IconPaginationArrow.vue'
92
+ import IconPaginationArrowDouble from './IconPaginationArrowDouble.vue'
91
93
  import IconQuestions from './IconQuestions.vue'
92
94
  import IconSubject from './IconSubject.vue'
93
95
  import IconFlag from './IconFlag.vue'
@@ -157,6 +159,7 @@ import IconPresent from './IconPresent.vue'
157
159
  IconArrow,
158
160
  IconCheck,
159
161
  IconPaginationArrow,
162
+ IconPaginationArrowDouble,
160
163
  IconQuestions,
161
164
  IconSubject,
162
165
  IconFlag,
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <!-- eslint-disable -->
3
+ <svg width="16" height="20" viewBox="0 0 16 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
4
+ <title>{{ title }}</title>
5
+ <g clip-path="url(#clip0_1238_216)">
6
+ <path d="M0.888889 9.11111C0.433035 9.56697 0.400474 10.2858 0.791206 10.7792L0.888889 10.8889L7.11111 17.1111C7.60203 17.602 8.39797 17.602 8.88889 17.1111C9.34474 16.6553 9.3773 15.9364 8.98657 15.443L8.88889 15.3333L3.55489 9.99934L8.88889 4.66667C9.34474 4.21081 9.3773 3.49196 8.98657 2.99853L8.88889 2.88889C8.43303 2.43303 7.71418 2.40047 7.22075 2.79121L7.11111 2.88889L0.888889 9.11111Z"/>
7
+ <path d="M7.38889 9.11111C6.93303 9.56697 6.90047 10.2858 7.29121 10.7792L7.38889 10.8889L13.6111 17.1111C14.102 17.602 14.898 17.602 15.3889 17.1111C15.8447 16.6553 15.8773 15.9364 15.4866 15.443L15.3889 15.3333L10.0549 9.99934L15.3889 4.66667C15.8447 4.21081 15.8773 3.49196 15.4866 2.99853L15.3889 2.88889C14.933 2.43303 14.2142 2.40047 13.7208 2.79121L13.6111 2.88889L7.38889 9.11111Z"/>
8
+ </g>
9
+ <defs>
10
+ <clipPath id="clip0_1238_216">
11
+ <rect width="16" height="20" fill="white"/>
12
+ </clipPath>
13
+ </defs>
14
+ </svg>
15
+ <!-- eslint-enable -->
16
+ </template>
17
+
18
+ <script lang="ts">
19
+ import { Component, Vue, Prop } from 'vue-facing-decorator'
20
+
21
+ @Component
22
+ export default class IconPaginationArrowDouble extends Vue {
23
+ @Prop() title!: string
24
+ }
25
+ </script>
@@ -11,6 +11,7 @@ export type TIconType =
11
11
  | 'help'
12
12
  | 'arrow'
13
13
  | 'paginationArrow'
14
+ | 'paginationArrowDouble'
14
15
  | 'questions'
15
16
  | 'subject'
16
17
  | 'flag'
@@ -56,14 +56,14 @@ export default class Modal extends Vue {
56
56
 
57
57
  .uikit-modal {
58
58
  border-radius: 12px;
59
- box-shadow: 0 2px 30px 0 rgba($brand-black, 0.1);
59
+ box-shadow: 0 1px 40px 0 rgba($brand-black, 0.5);
60
60
  z-index: 10001;
61
61
  background-color: $white;
62
62
 
63
63
  &--dark {
64
64
  background-color: $moonlit-ocean;
65
65
  color: $white;
66
- box-shadow: 0 1px 6px 0 rgba($jet, 0.3);
66
+ box-shadow: 0 1px 40px 0 $jet;
67
67
  }
68
68
 
69
69
  &__head {
@@ -13,6 +13,20 @@
13
13
  {{ nextPageDisabled ? total : (currentPage * perPage) + perPage }}
14
14
  of {{ total }} {{ unit }} <slot />
15
15
  </div>
16
+ <div
17
+ v-if="showAdvancedPagination"
18
+ v-dark="isDarkMode"
19
+ class="uikit-table-pagination__first-page"
20
+ :class="{ 'uikit-table-pagination__first-page--disabled': currentPage === 0 }"
21
+ :tabindex="currentPage === 0 ? -1 : 0"
22
+ aria-label="First Page"
23
+ :aria-disabled="currentPage === 0"
24
+ @keydown.enter="changePage('previous')"
25
+ @click="changePage('first')"
26
+ @mousedown.prevent
27
+ >
28
+ <Icon type="paginationArrowDouble" />
29
+ </div>
16
30
  <div
17
31
  v-dark="isDarkMode"
18
32
  class="uikit-table-pagination__previous"
@@ -39,6 +53,20 @@
39
53
  >
40
54
  <Icon type="accordionArrow" />
41
55
  </div>
56
+ <div
57
+ v-if="showAdvancedPagination"
58
+ v-dark="isDarkMode"
59
+ class="uikit-table-pagination__last-page"
60
+ :class="{ 'uikit-table-pagination__first-page--disabled': nextPageDisabled }"
61
+ :tabindex="currentPage === 0 ? -1 : 0"
62
+ aria-label="First Page"
63
+ :aria-disabled="currentPage === 0"
64
+ @keydown.enter="changePage('previous')"
65
+ @click="changePage('last')"
66
+ @mousedown.prevent
67
+ >
68
+ <Icon type="paginationArrowDouble" />
69
+ </div>
42
70
  </div>
43
71
  </template>
44
72
 
@@ -61,17 +89,30 @@ export default class TablePagination extends Vue {
61
89
  @Prop() total!: number
62
90
  @Prop() unit!: string
63
91
  @Prop({ default: false }) isDarkMode!: boolean
92
+ @Prop({ default: false }) showFirstAndLastBtn!: boolean
64
93
 
65
94
  get nextPageDisabled () {
66
95
  return this.currentPage >= Math.floor((this.total - 1) / this.perPage)
67
96
  }
68
97
 
98
+ get showAdvancedPagination () {
99
+ if (!this.showFirstAndLastBtn) {
100
+ return false
101
+ } else {
102
+ return Math.floor((this.total - 1) / this.perPage) >= 3
103
+ }
104
+ }
105
+
69
106
  @Emit('changePage')
70
- changePage (direction: 'next' | 'previous') {
107
+ changePage (direction: 'next' | 'previous' | 'first' | 'last') {
71
108
  const paginationInfo = this.$refs['pagination_info'] as HTMLElement
72
109
  paginationInfo.focus()
73
110
  if (direction === 'next') {
74
111
  return this.nextPageDisabled ? this.currentPage : this.currentPage + 1
112
+ } else if (direction === 'first') {
113
+ return 0
114
+ } else if (direction === 'last') {
115
+ return Math.floor((this.total - 1) / this.perPage)
75
116
  } else {
76
117
  return Math.max(0, this.currentPage - 1)
77
118
  }
@@ -149,5 +190,48 @@ export default class TablePagination extends Vue {
149
190
  &__next {
150
191
  transform: rotate(-90deg);
151
192
  }
193
+
194
+ &__first-page {
195
+ color: $brand-blue;
196
+ cursor: pointer;
197
+ user-select: none;
198
+ width: 16px;
199
+ height: 20px;
200
+ outline: none;
201
+ position: relative;
202
+ margin-right: 10px;
203
+
204
+ &--disabled {
205
+ opacity: 0.35;
206
+ cursor: default;
207
+ }
208
+
209
+ svg {
210
+ width: 100%;
211
+ height: 100%;
212
+ }
213
+ }
214
+
215
+ &__last-page {
216
+ color: $brand-blue;
217
+ cursor: pointer;
218
+ user-select: none;
219
+ width: 16px;
220
+ height: 20px;
221
+ outline: none;
222
+ position: relative;
223
+ margin-left: 10px;
224
+ transform: rotate(180deg);
225
+
226
+ &--disabled {
227
+ opacity: 0.35;
228
+ cursor: default;
229
+ }
230
+
231
+ svg {
232
+ width: 100%;
233
+ height: 100%;
234
+ }
235
+ }
152
236
  }
153
237
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.25",
3
+ "version": "3.4.27",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {