plugin-ui-for-kzt 0.0.15 → 0.0.17
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/dist/components/BaseButton/BaseButton.vue.d.ts +2 -2
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +3 -3
- package/dist/components/BaseChips/BaseChips.vue.d.ts +27 -0
- package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +2 -2
- package/dist/components/BaseInput/BaseInput.vue.d.ts +4 -4
- package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +4 -4
- package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +4 -4
- package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +4 -4
- package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +4 -4
- package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +2 -2
- package/dist/components/BasePagination/BasePagination.vue.d.ts +51 -0
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +3 -3
- package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +1 -1
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +2 -2
- package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +1 -1
- package/dist/components/BaseSwiper/BaseSwiper.vue.d.ts +57 -0
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +4 -4
- package/dist/components/BaseToggle/BaseToggle.vue.d.ts +3 -3
- package/dist/components/Toaster/Toaster.vue.d.ts +4 -4
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1 -1
- package/dist/sprite.d.ts +4 -0
- package/dist/sprite.svg +1 -1
- package/example/App.vue +45 -23
- package/package.json +1 -1
- package/src/assets/icons/arrow-left-circle.svg +3 -0
- package/src/assets/icons/arrow-left.svg +4 -0
- package/src/assets/icons/arrow-right-circle.svg +3 -0
- package/src/assets/icons/arrow-right.svg +4 -0
- package/src/assets/icons/star.svg +3 -0
- package/src/components/BaseBreadCrumbs/BaseBreadCrumbs.vue +1 -2
- package/src/components/BaseButton/BaseButton.vue +29 -10
- package/src/components/BaseChips/BaseChips.vue +182 -0
- package/src/components/BaseChips/README.md +64 -0
- package/src/components/BaseInput/BaseInput.vue +1 -0
- package/src/components/BaseOpenedListItem/BaseOpenedListItem.vue +4 -4
- package/src/components/BasePagination/BasePagination.vue +405 -0
- package/src/components/BasePagination/README.md +156 -0
- package/src/components/BaseSiteInput/BaseSiteInput.vue +26 -9
- package/src/components/BaseSwiper/BaseSwiper.vue +229 -0
- package/src/components/BaseTextarea/BaseTextarea.vue +1 -0
- package/src/index.ts +42 -16
- package/src/sprite.ts +11 -0
- package/src/styles/root.scss +3 -0
- package/src/types/chips.d.ts +10 -0
- package/src/types/pagination.d.ts +13 -0
- package/src/types/swiper.d.ts +17 -0
- package/webpack.config.js +1 -1
- package/dist/icons/index.d.ts +0 -2
- package/src/icons/index.ts +0 -15
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="base-chips" :class="classList">
|
|
3
|
+
<button class="base-chips__wrapper">
|
|
4
|
+
<div class="base-chips__content">
|
|
5
|
+
<div v-if="iconName" class="base-chips__icon">
|
|
6
|
+
<base-icon
|
|
7
|
+
:name="iconName"
|
|
8
|
+
:size="props.size"
|
|
9
|
+
/>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="base-chips__text">{{ text }}</div>
|
|
12
|
+
<div v-if="count" class="base-chips__count">{{ count }}</div>
|
|
13
|
+
</div>
|
|
14
|
+
</button>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import type { ICoreChipsProps } from '../../types/chips';
|
|
20
|
+
import { useKitSize } from '../../composables/kit/size';
|
|
21
|
+
import BaseIcon from '../BaseIcon/BaseIcon.vue';
|
|
22
|
+
import { computed } from 'vue';
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(defineProps<ICoreChipsProps>(), {
|
|
25
|
+
size: 'medium',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const { sizeClassList } = useKitSize(props);
|
|
29
|
+
|
|
30
|
+
const classList = computed(() => [
|
|
31
|
+
sizeClassList.value,
|
|
32
|
+
{ '--is-active': props.active }
|
|
33
|
+
]);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style lang="scss">
|
|
37
|
+
@import '../../styles/variables';
|
|
38
|
+
@import '../../styles/root';
|
|
39
|
+
|
|
40
|
+
.base-chips {
|
|
41
|
+
$chip: &;
|
|
42
|
+
|
|
43
|
+
button {
|
|
44
|
+
border: none;
|
|
45
|
+
outline: none;
|
|
46
|
+
margin: 0;
|
|
47
|
+
padding: 0;
|
|
48
|
+
display: block;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__wrapper {
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
height: 100%;
|
|
55
|
+
width: fit-content;
|
|
56
|
+
background: var(--primary-black-200);
|
|
57
|
+
color: var(--primary-black-800);
|
|
58
|
+
transition: all var(--transition);
|
|
59
|
+
|
|
60
|
+
@include hover {
|
|
61
|
+
background: var(--primary-black-300);
|
|
62
|
+
color: var(--primary-black-900);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@include focused {
|
|
66
|
+
background: var(--primary-black-200);
|
|
67
|
+
color: var(--primary-black-800);
|
|
68
|
+
outline-width: 4px;
|
|
69
|
+
outline-color: var(--effects-primary-focus);
|
|
70
|
+
outline-style: solid;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include pressed {
|
|
74
|
+
background: var(--primary-black-400);
|
|
75
|
+
color: var(--primary-black);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&__content {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.--is-active {
|
|
86
|
+
#{$chip}__wrapper {
|
|
87
|
+
background: var(--primary-blue);
|
|
88
|
+
color: var(--primary-black-white);
|
|
89
|
+
|
|
90
|
+
@include hover {
|
|
91
|
+
background: var(--primary-black-300);
|
|
92
|
+
color: var(--primary-black-900);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@include pressed {
|
|
96
|
+
background: var(--primary-black-400);
|
|
97
|
+
color: var(--primary-black);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&.--extra-small-size {
|
|
103
|
+
#{$chip} {
|
|
104
|
+
&__content {
|
|
105
|
+
padding: var(--spacing-2s) var(--spacing-m);
|
|
106
|
+
gap: var(--spacing-xs);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&__wrapper {
|
|
110
|
+
height: 32px;
|
|
111
|
+
font: var(--typography-text-s-medium);
|
|
112
|
+
border-radius: var(--corner-radius-xl);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&__count {
|
|
116
|
+
transform: translateY(-3px);
|
|
117
|
+
font: var(--typography-text-xs-medium);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&.--small-size {
|
|
123
|
+
#{$chip} {
|
|
124
|
+
&__content {
|
|
125
|
+
padding: var(--spacing-s) var(--spacing-l);
|
|
126
|
+
gap: var(--spacing-s);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&__wrapper {
|
|
130
|
+
height: 40px;
|
|
131
|
+
font: var(--typography-text-m-medium);
|
|
132
|
+
border-radius: var(--corner-radius-xl);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&__count {
|
|
136
|
+
transform: translateY(-3px);
|
|
137
|
+
font: var(--typography-text-xs-medium);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&.--medium-size {
|
|
143
|
+
#{$chip} {
|
|
144
|
+
&__content {
|
|
145
|
+
padding: var(--spacing-2m) var(--spacing-l);
|
|
146
|
+
gap: var(--spacing-s);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&__wrapper {
|
|
150
|
+
height: 48px;
|
|
151
|
+
font: var(--typography-text-l-medium);
|
|
152
|
+
border-radius: var(--corner-radius-xl);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&__count {
|
|
156
|
+
transform: translateY(-4px);
|
|
157
|
+
font: var(--typography-text-s-medium);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&.--large-size {
|
|
163
|
+
#{$chip} {
|
|
164
|
+
&__content {
|
|
165
|
+
padding: var(--spacing-2l) var(--spacing-l);
|
|
166
|
+
gap: var(--spacing-s);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&__wrapper {
|
|
170
|
+
height: 56px;
|
|
171
|
+
font: var(--typography-text-l-medium);
|
|
172
|
+
border-radius: var(--corner-radius-2xl);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&__count {
|
|
176
|
+
transform: translateY(-5px);
|
|
177
|
+
font: var(--typography-text-s-medium);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Документация по использованию компонента BaseChips
|
|
2
|
+
|
|
3
|
+
Компонент `BaseChips` — это повторно используемый компонент Vue, предназначенный для отображения чипа (небольшого интерактивного элемента) с настраиваемым текстом, иконкой, количеством и размером. Он поддерживает различные состояния (активное, при наведении, фокусировка, нажатие) с плавными переходами и стилизуется в соответствии с предопределённой дизайн-системой.
|
|
4
|
+
|
|
5
|
+
## Содержание
|
|
6
|
+
- [Использование](#использование)
|
|
7
|
+
- [Свойства (Props)](#свойства-props)
|
|
8
|
+
- [События (Events)](#события-events)
|
|
9
|
+
- [Слоты (Slots)](#слоты-slots)
|
|
10
|
+
- [Стилизация](#стилизация)
|
|
11
|
+
|
|
12
|
+
## Использование
|
|
13
|
+
|
|
14
|
+
Используйте компонент `BaseChips` для отображения чипа с текстом, опциональной иконкой и количеством. Компонент поддерживает разные размеры и состояние активности.
|
|
15
|
+
|
|
16
|
+
## Свойства (Props)
|
|
17
|
+
|
|
18
|
+
| Свойство | Тип | Значение по умолчанию | Описание |
|
|
19
|
+
|-------------|-------------|-----------------------|----------------------------------------------|
|
|
20
|
+
| `text` | `string` | Обязательно | Основной текст, отображаемый внутри чипа. |
|
|
21
|
+
| `active` | `boolean` | `false` | Определяет, находится ли чип в активном состоянии. |
|
|
22
|
+
| `iconName` | `string` | `undefined` | Название иконки для отображения (требуется BaseIcon). |
|
|
23
|
+
| `count` | `number` | `undefined` | Число для отображения в чипе. |
|
|
24
|
+
| `size` | `'extra-small' | 'small' | 'medium' | 'large'` | `medium` | Размер чипа (влияет на высоту, шрифт и отступы). |
|
|
25
|
+
|
|
26
|
+
## События (Events)
|
|
27
|
+
|
|
28
|
+
Компонент не выбрасывает событий напрямую, но его поведение зависит от состояния `active`, которое можно управлять через родительский компонент.
|
|
29
|
+
|
|
30
|
+
## Слоты (Slots)
|
|
31
|
+
|
|
32
|
+
Компонент не предоставляет пользовательских слотов. Содержимое (текст, иконка, количество) определяется через пропсы.
|
|
33
|
+
|
|
34
|
+
## Стилизация
|
|
35
|
+
|
|
36
|
+
Стилизация может быть расширена через кастомные классы или модификации через `:deep()` в родительском компоненте.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Динамическое переключение состояния
|
|
40
|
+
```vue
|
|
41
|
+
<template>
|
|
42
|
+
<base-chips
|
|
43
|
+
:text="'Динамический чип'"
|
|
44
|
+
:active="isActive"
|
|
45
|
+
icon-name="check"
|
|
46
|
+
:count="count"
|
|
47
|
+
size="large"
|
|
48
|
+
@click="toggleActive"
|
|
49
|
+
/>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup>
|
|
53
|
+
import { ref } from 'vue';
|
|
54
|
+
import BaseChips from '/components/BaseChips/BaseChips.vue';
|
|
55
|
+
|
|
56
|
+
const isActive = ref(false);
|
|
57
|
+
const count = ref(5);
|
|
58
|
+
|
|
59
|
+
const toggleActive = () => {
|
|
60
|
+
isActive.value = !isActive.value;
|
|
61
|
+
count.value += 1;
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
64
|
+
```
|
|
@@ -98,7 +98,7 @@ const actualComponent = computed(() => {
|
|
|
98
98
|
width: 100%;
|
|
99
99
|
height: 100%;
|
|
100
100
|
text-align: left;
|
|
101
|
-
transition: all var(--
|
|
101
|
+
transition: all var(--transition);
|
|
102
102
|
|
|
103
103
|
@include hover {
|
|
104
104
|
background: var(--primary-black-100);
|
|
@@ -157,7 +157,7 @@ const actualComponent = computed(() => {
|
|
|
157
157
|
#{$item} {
|
|
158
158
|
&__wrapper {
|
|
159
159
|
gap: var(--spacing-s);
|
|
160
|
-
height:
|
|
160
|
+
height: 40px;
|
|
161
161
|
padding: var(--spacing-s) var(--spacing-2l);
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -177,7 +177,7 @@ const actualComponent = computed(() => {
|
|
|
177
177
|
#{$item} {
|
|
178
178
|
&__wrapper {
|
|
179
179
|
gap: var(--spacing-m);
|
|
180
|
-
height:
|
|
180
|
+
height: 48px;
|
|
181
181
|
padding: var(--spacing-m) var(--spacing-2l);
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -197,7 +197,7 @@ const actualComponent = computed(() => {
|
|
|
197
197
|
#{$item} {
|
|
198
198
|
&__wrapper {
|
|
199
199
|
gap: var(--spacing-l);
|
|
200
|
-
height:
|
|
200
|
+
height: 60px;
|
|
201
201
|
padding: var(--spacing-2l) var(--spacing-l);
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav class="base-pagination" :class="classList">
|
|
3
|
+
<base-button
|
|
4
|
+
v-if="type === 'numbers'"
|
|
5
|
+
class="base-pagination__nav base-pagination__nav--prev"
|
|
6
|
+
:disabled="currentPage === 1"
|
|
7
|
+
:size="props.size"
|
|
8
|
+
color="quaternary"
|
|
9
|
+
@click="goToPage(currentPage - 1)"
|
|
10
|
+
>
|
|
11
|
+
<base-icon
|
|
12
|
+
name="arrow-left"
|
|
13
|
+
:size="props.size"
|
|
14
|
+
color="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
<slot name="previousTextButton">Назад</slot>
|
|
17
|
+
</base-button>
|
|
18
|
+
|
|
19
|
+
<ul class="base-pagination__list">
|
|
20
|
+
<template v-if="props.type === 'numbers'">
|
|
21
|
+
<li
|
|
22
|
+
v-for="page in displayedPages"
|
|
23
|
+
:key="page"
|
|
24
|
+
class="base-pagination__item"
|
|
25
|
+
>
|
|
26
|
+
<div v-if="page === 'ellipsis'" class="base-pagination__ellipsis">
|
|
27
|
+
...
|
|
28
|
+
</div>
|
|
29
|
+
<base-button
|
|
30
|
+
v-else
|
|
31
|
+
class="base-pagination__page"
|
|
32
|
+
:class="{ 'base-pagination__page--active': page === currentPage }"
|
|
33
|
+
:size="props.size"
|
|
34
|
+
:color="isActiveButtonColor(page)"
|
|
35
|
+
@click="typeof page === 'number' && goToPage(page)"
|
|
36
|
+
>
|
|
37
|
+
{{ page }}
|
|
38
|
+
</base-button>
|
|
39
|
+
</li>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<template v-else>
|
|
43
|
+
<li
|
|
44
|
+
v-for="index in Math.min(totalPages, 3)"
|
|
45
|
+
:key="index"
|
|
46
|
+
class="base-pagination__item"
|
|
47
|
+
>
|
|
48
|
+
<div
|
|
49
|
+
:class="[
|
|
50
|
+
{
|
|
51
|
+
'base-pagination__dot': props.type === 'dots' || props.type === 'dotsWithBackground',
|
|
52
|
+
'base-pagination__dash': props.type === 'dashes' || props.type === 'dashesWithBackground',
|
|
53
|
+
'base-pagination__dot--active': (props.type === 'dots' || props.type === 'dotsWithBackground') && index === currentPage,
|
|
54
|
+
'base-pagination__dash--active': (props.type === 'dashes' || props.type === 'dashesWithBackground') && index === currentPage,
|
|
55
|
+
},
|
|
56
|
+
]"
|
|
57
|
+
@click="goToPage(index)"
|
|
58
|
+
></div>
|
|
59
|
+
</li>
|
|
60
|
+
</template>
|
|
61
|
+
</ul>
|
|
62
|
+
|
|
63
|
+
<base-button
|
|
64
|
+
v-if="type === 'numbers'"
|
|
65
|
+
class="base-pagination__nav base-pagination__nav--next"
|
|
66
|
+
color="quaternary"
|
|
67
|
+
:size="props.size"
|
|
68
|
+
:disabled="currentPage === totalPages"
|
|
69
|
+
@click="goToPage(currentPage + 1)"
|
|
70
|
+
>
|
|
71
|
+
<slot name="nextTextButton">Вперёд</slot>
|
|
72
|
+
<base-icon
|
|
73
|
+
name="arrow-right"
|
|
74
|
+
:size="props.size"
|
|
75
|
+
color="currentColor"
|
|
76
|
+
/>
|
|
77
|
+
</base-button>
|
|
78
|
+
</nav>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup lang="ts">
|
|
82
|
+
import { computed, ref, watch } from 'vue';
|
|
83
|
+
import type { TPaginationProps } from '../../types/pagination';
|
|
84
|
+
import { useKitSize } from '../../composables/kit/size';
|
|
85
|
+
import BaseButton from '../BaseButton/BaseButton.vue';
|
|
86
|
+
import BaseIcon from '../BaseIcon/BaseIcon.vue';
|
|
87
|
+
|
|
88
|
+
const props = withDefaults(defineProps<TPaginationProps>(), {
|
|
89
|
+
type: 'numbers',
|
|
90
|
+
currentPage: 1,
|
|
91
|
+
totalPages: 1,
|
|
92
|
+
maxDisplayedPages: 5,
|
|
93
|
+
size: 'medium',
|
|
94
|
+
color: 'primary',
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const emit = defineEmits(['update:currentPage']);
|
|
98
|
+
|
|
99
|
+
const currentPage = ref(props.currentPage);
|
|
100
|
+
|
|
101
|
+
watch(
|
|
102
|
+
() => props.currentPage,
|
|
103
|
+
(newPage) => {
|
|
104
|
+
if (newPage !== currentPage.value) {
|
|
105
|
+
currentPage.value = newPage;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
watch(currentPage, (newPage) => {
|
|
111
|
+
emit('update:currentPage', newPage);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const { sizeClassList } = useKitSize(props);
|
|
115
|
+
|
|
116
|
+
const displayedPages = computed(() => {
|
|
117
|
+
if (props.type !== 'numbers') return [];
|
|
118
|
+
|
|
119
|
+
const pages = [];
|
|
120
|
+
const maxDisplayed = props.maxDisplayedPages;
|
|
121
|
+
const halfDisplayed = Math.floor(maxDisplayed / 2);
|
|
122
|
+
|
|
123
|
+
if (props.totalPages <= maxDisplayed) {
|
|
124
|
+
for (let i = 1; i <= props.totalPages; i++) {
|
|
125
|
+
pages.push(i);
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
let start = Math.max(1, currentPage.value - halfDisplayed);
|
|
129
|
+
let end = Math.min(props.totalPages, currentPage.value + halfDisplayed);
|
|
130
|
+
|
|
131
|
+
if (end - start + 1 < maxDisplayed) {
|
|
132
|
+
if (currentPage.value - 1 <= halfDisplayed) {
|
|
133
|
+
end = maxDisplayed;
|
|
134
|
+
} else if (props.totalPages - currentPage.value < halfDisplayed) {
|
|
135
|
+
start = props.totalPages - maxDisplayed + 1;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (start > 2) {
|
|
140
|
+
pages.push(1);
|
|
141
|
+
if (start > 3) {
|
|
142
|
+
pages.push('ellipsis');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
for (let i = start; i <= end; i++) {
|
|
147
|
+
pages.push(i);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (end < props.totalPages - 1) {
|
|
151
|
+
if (end < props.totalPages - 2) {
|
|
152
|
+
pages.push('ellipsis');
|
|
153
|
+
}
|
|
154
|
+
pages.push(props.totalPages);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return pages;
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const isActiveButtonColor = (page: string | number) => {
|
|
162
|
+
return currentPage.value === page ? 'primary' : 'secondary';
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const classList = computed(() => [
|
|
166
|
+
sizeClassList.value,
|
|
167
|
+
`base-pagination--${props.type}`,
|
|
168
|
+
`--color-${props.color}`,
|
|
169
|
+
]);
|
|
170
|
+
|
|
171
|
+
const goToPage = (page: number) => {
|
|
172
|
+
if (page >= 1 && page <= props.totalPages) {
|
|
173
|
+
currentPage.value = page;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
</script>
|
|
177
|
+
|
|
178
|
+
<style lang="scss" scoped>
|
|
179
|
+
@import '@/styles/variables';
|
|
180
|
+
@import '@/styles/root';
|
|
181
|
+
|
|
182
|
+
.base-pagination {
|
|
183
|
+
$pagination: &;
|
|
184
|
+
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
gap: var(--spacing-s);
|
|
188
|
+
|
|
189
|
+
&__list {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
gap: var(--spacing-s);
|
|
193
|
+
list-style: none;
|
|
194
|
+
padding: 0;
|
|
195
|
+
margin: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&__item {
|
|
199
|
+
display: flex;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&__page {
|
|
203
|
+
transition: all 0.2s ease;
|
|
204
|
+
|
|
205
|
+
&--active {
|
|
206
|
+
cursor: default;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&__ellipsis {
|
|
211
|
+
cursor: default;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&__nav {
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
transition: all 0.2s ease;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
&__dot {
|
|
220
|
+
border-radius: 50%;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&__dot,
|
|
224
|
+
&__dash {
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
transition: all 0.2s ease;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
&.--small-size {
|
|
230
|
+
#{$pagination}__page {
|
|
231
|
+
width: 40px;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
&.--medium-size {
|
|
236
|
+
#{$pagination}__page {
|
|
237
|
+
width: 48px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
#{$pagination}__dot {
|
|
241
|
+
width: 8px;
|
|
242
|
+
height: 8px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
#{$pagination}__dash {
|
|
246
|
+
width: 42.67px;
|
|
247
|
+
height: 6px;
|
|
248
|
+
border-radius: var(--corner-radius-3xs);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&.base-pagination--dotsWithBackground,
|
|
252
|
+
&.base-pagination--dashesWithBackground {
|
|
253
|
+
.base-pagination__list {
|
|
254
|
+
padding: var(--spacing-s);
|
|
255
|
+
gap: var(--spacing-m);
|
|
256
|
+
border-radius: var(--corner-radius-m);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
&.--large-size {
|
|
262
|
+
#{$pagination}__page {
|
|
263
|
+
width: 56px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
#{$pagination}__dot {
|
|
267
|
+
width: 10px;
|
|
268
|
+
height: 10px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
#{$pagination}__dash {
|
|
272
|
+
width: 42.67px;
|
|
273
|
+
height: 8px;
|
|
274
|
+
border-radius: var(--corner-radius-xxs);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&.base-pagination--dotsWithBackground,
|
|
278
|
+
&.base-pagination--dashesWithBackground {
|
|
279
|
+
.base-pagination__list {
|
|
280
|
+
padding: var(--spacing-m);
|
|
281
|
+
gap: var(--spacing-l);
|
|
282
|
+
border-radius: var(--corner-radius-l);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&--dotsWithBackground,
|
|
288
|
+
&--dashesWithBackground {
|
|
289
|
+
&.base-pagination {
|
|
290
|
+
width: fit-content;
|
|
291
|
+
|
|
292
|
+
.base-pagination__list {
|
|
293
|
+
overflow: hidden;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
&.--color-primary {
|
|
297
|
+
.base-pagination__list {
|
|
298
|
+
background: var(--primary-blue-700);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.base-pagination__dot,
|
|
302
|
+
.base-pagination__dash {
|
|
303
|
+
background: var(--primary-blue-500);
|
|
304
|
+
|
|
305
|
+
&--active {
|
|
306
|
+
background: var(--primary-black-white);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
&.--color-secondary {
|
|
312
|
+
.base-pagination__list {
|
|
313
|
+
background: var(--primary-blue-50);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.base-pagination__dot,
|
|
317
|
+
.base-pagination__dash {
|
|
318
|
+
background: var(--primary-blue-200);
|
|
319
|
+
|
|
320
|
+
&--active {
|
|
321
|
+
background: var(--primary-blue);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&.--color-white {
|
|
327
|
+
.base-pagination__list {
|
|
328
|
+
background: #fff;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.base-pagination__dot,
|
|
332
|
+
.base-pagination__dash {
|
|
333
|
+
background: var(--primary-black-300);
|
|
334
|
+
|
|
335
|
+
&--active {
|
|
336
|
+
background: var(--primary-black-900);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
&.--color-black {
|
|
342
|
+
.base-pagination__list {
|
|
343
|
+
background: #000;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.base-pagination__dot,
|
|
347
|
+
.base-pagination__dash {
|
|
348
|
+
background: var(--primary-black-500);
|
|
349
|
+
|
|
350
|
+
&--active {
|
|
351
|
+
background: var(--primary-black-white);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
&--dots,
|
|
359
|
+
&--dashes {
|
|
360
|
+
&.--color-primary {
|
|
361
|
+
.base-pagination__dot,
|
|
362
|
+
.base-pagination__dash {
|
|
363
|
+
background: var(--primary-blue-200);
|
|
364
|
+
|
|
365
|
+
&--active {
|
|
366
|
+
background: var(--primary-blue);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
&.--color-secondary {
|
|
372
|
+
.base-pagination__dot,
|
|
373
|
+
.base-pagination__dash {
|
|
374
|
+
background: var(--primary-blue-500);
|
|
375
|
+
|
|
376
|
+
&--active {
|
|
377
|
+
background: var(--primary-black-white);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
&.--color-white {
|
|
383
|
+
.base-pagination__dot,
|
|
384
|
+
.base-pagination__dash {
|
|
385
|
+
background: var(--primary-black-300);
|
|
386
|
+
|
|
387
|
+
&--active {
|
|
388
|
+
background: var(--primary-black-900);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
&.--color-black {
|
|
394
|
+
.base-pagination__dot,
|
|
395
|
+
.base-pagination__dash {
|
|
396
|
+
background: var(--primary-black-500);
|
|
397
|
+
|
|
398
|
+
&--active {
|
|
399
|
+
background: var(--primary-black-white);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
</style>
|