plugin-ui-for-kzt 0.0.16 → 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 +3 -3
- package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +1 -1
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +4 -4
- package/dist/components/BaseChips/BaseChips.vue.d.ts +27 -0
- package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +3 -3
- package/dist/components/BaseInput/BaseInput.vue.d.ts +5 -5
- package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +6 -6
- package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +5 -5
- package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +5 -5
- package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +5 -5
- package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +3 -3
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +4 -4
- package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +2 -2
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +3 -3
- 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 +5 -5
- package/dist/components/BaseToggle/BaseToggle.vue.d.ts +4 -4
- package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
- package/dist/components/Toaster/Toaster.vue.d.ts +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- 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-right-circle.svg +3 -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 +146 -123
- 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 +8 -2
- package/src/styles/root.scss +2 -0
- package/src/types/chips.d.ts +10 -0
- package/src/types/pagination.d.ts +2 -2
- package/src/types/swiper.d.ts +17 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="base-swiper">
|
|
3
|
+
<!-- Кнопки навигации -->
|
|
4
|
+
<button
|
|
5
|
+
:class="buttonClassList"
|
|
6
|
+
class="base-swiper__nav base-swiper__nav--prev"
|
|
7
|
+
@click="prevSlide"
|
|
8
|
+
:disabled="currentSlide === 0"
|
|
9
|
+
>
|
|
10
|
+
<base-icon
|
|
11
|
+
name="arrow-left-circle"
|
|
12
|
+
size="medium"
|
|
13
|
+
/>
|
|
14
|
+
</button>
|
|
15
|
+
<div class="base-swiper__container" ref="swiperContainer">
|
|
16
|
+
<div class="base-swiper__slides">
|
|
17
|
+
<div
|
|
18
|
+
v-for="(image, index) in images"
|
|
19
|
+
:key="index"
|
|
20
|
+
class="base-swiper__slide"
|
|
21
|
+
:style="{ transform: `translateX(-${currentSlide * 100}%)` }"
|
|
22
|
+
>
|
|
23
|
+
<img :src="image" alt="Slide" class="base-swiper__image" />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<button
|
|
28
|
+
:class="buttonClassList"
|
|
29
|
+
class="base-swiper__nav base-swiper__nav--next"
|
|
30
|
+
@click="nextSlide"
|
|
31
|
+
:disabled="currentSlide === images.length - 1"
|
|
32
|
+
>
|
|
33
|
+
<base-icon
|
|
34
|
+
name="arrow-right-circle"
|
|
35
|
+
size="medium"
|
|
36
|
+
/>
|
|
37
|
+
</button>
|
|
38
|
+
|
|
39
|
+
<!-- Пагинация -->
|
|
40
|
+
<div class="base-swiper__pagination">
|
|
41
|
+
<base-pagination
|
|
42
|
+
:type="paginationSettings.type"
|
|
43
|
+
v-model:current-page="currentPage"
|
|
44
|
+
:total-pages="images.length"
|
|
45
|
+
:color="paginationSettings.color"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script setup lang="ts">
|
|
52
|
+
import { ref, onMounted, onUnmounted, watch, computed } from 'vue';
|
|
53
|
+
import BaseIcon from '../BaseIcon/BaseIcon.vue';
|
|
54
|
+
import BasePagination from '../BasePagination/BasePagination.vue';
|
|
55
|
+
import type { ICoreSwiperProps } from '../../types/swiper';
|
|
56
|
+
|
|
57
|
+
const props = withDefaults(defineProps<ICoreSwiperProps>(), {
|
|
58
|
+
images: () => [],
|
|
59
|
+
autoplay: false,
|
|
60
|
+
autoplayInterval: 3000,
|
|
61
|
+
paginationSettings: {
|
|
62
|
+
type: 'dots',
|
|
63
|
+
color: 'primary',
|
|
64
|
+
},
|
|
65
|
+
buttonSize: 'medium',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const emit = defineEmits<{
|
|
69
|
+
(e: 'update:currentSlide', value: number): void;
|
|
70
|
+
}>();
|
|
71
|
+
|
|
72
|
+
const swiperContainer = ref<HTMLElement | null>(null);
|
|
73
|
+
const currentSlide = ref(0);
|
|
74
|
+
const currentPage = ref(1);
|
|
75
|
+
|
|
76
|
+
const buttonClassList = computed(() => [
|
|
77
|
+
`--${props.buttonSize}-size`,
|
|
78
|
+
`--color-${props.paginationSettings.color}`,
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
watch(currentSlide, (newSlide) => {
|
|
82
|
+
currentPage.value = newSlide + 1;
|
|
83
|
+
emit('update:currentSlide', newSlide);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
watch(currentPage, (newPage) => {
|
|
87
|
+
currentSlide.value = newPage - 1;
|
|
88
|
+
emit('update:currentSlide', currentSlide.value);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const prevSlide = () => {
|
|
92
|
+
if (currentSlide.value > 0) {
|
|
93
|
+
currentSlide.value -= 1;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const nextSlide = () => {
|
|
98
|
+
if (currentSlide.value < props.images.length - 1) {
|
|
99
|
+
currentSlide.value += 1;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
let autoplayIntervalId: ReturnType<typeof setInterval> | null = null;
|
|
104
|
+
|
|
105
|
+
const startAutoplay = () => {
|
|
106
|
+
if (props.autoplay && !autoplayIntervalId) {
|
|
107
|
+
autoplayIntervalId = setInterval(() => {
|
|
108
|
+
nextSlide();
|
|
109
|
+
if (currentSlide.value >= props.images.length - 1) {
|
|
110
|
+
currentSlide.value = 0; // Возвращаемся к первому слайду
|
|
111
|
+
}
|
|
112
|
+
}, props.autoplayInterval);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const stopAutoplay = () => {
|
|
117
|
+
if (autoplayIntervalId) {
|
|
118
|
+
clearInterval(autoplayIntervalId);
|
|
119
|
+
autoplayIntervalId = null;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
onMounted(() => {
|
|
124
|
+
startAutoplay();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
onUnmounted(() => {
|
|
128
|
+
stopAutoplay();
|
|
129
|
+
});
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<style lang="scss" scoped>
|
|
133
|
+
@import '../../styles/variables';
|
|
134
|
+
@import '../../styles/root';
|
|
135
|
+
|
|
136
|
+
.base-swiper {
|
|
137
|
+
$swiper: &;
|
|
138
|
+
|
|
139
|
+
position: relative;
|
|
140
|
+
width: 100%;
|
|
141
|
+
max-width: 640px;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
|
|
144
|
+
&__container {
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
position: relative;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&__slides {
|
|
150
|
+
display: flex;
|
|
151
|
+
width: 100%;
|
|
152
|
+
height: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&__slide {
|
|
156
|
+
flex: 0 0 100%;
|
|
157
|
+
height: 100%;
|
|
158
|
+
display: flex;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
align-items: center;
|
|
161
|
+
transition: all var(--transition);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&__image {
|
|
165
|
+
max-width: 100%;
|
|
166
|
+
max-height: 400px;
|
|
167
|
+
object-fit: contain;
|
|
168
|
+
border-radius: var(--corner-radius-m);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&__nav {
|
|
172
|
+
position: absolute;
|
|
173
|
+
top: 50%;
|
|
174
|
+
transform: translateY(-50%);
|
|
175
|
+
border: none;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
border-radius: 50%;
|
|
178
|
+
z-index: 10;
|
|
179
|
+
|
|
180
|
+
&--prev {
|
|
181
|
+
left: var(--spacing-m);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&--next {
|
|
185
|
+
right: var(--spacing-m);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&:disabled {
|
|
189
|
+
opacity: 0.5;
|
|
190
|
+
cursor: not-allowed;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&__nav.--color-primary {
|
|
195
|
+
background: var(--primary-blue);
|
|
196
|
+
color: var(--primary-black-white);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&__nav.--color-secondary {
|
|
200
|
+
background: var(--primary-blue-50);
|
|
201
|
+
color: var(--primary-blue-800);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&__nav.--color-black {
|
|
205
|
+
background: #000;
|
|
206
|
+
color: var(--primary-black-white);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&__nav.--color-white {
|
|
210
|
+
background: var(--primary-black-white);
|
|
211
|
+
color: var(--primary-black-700);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&__nav.--medium-size {
|
|
215
|
+
padding: var(--spacing-s);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&__nav.--large-size {
|
|
219
|
+
padding: var(--spacing-2m);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
&__pagination {
|
|
223
|
+
position: absolute;
|
|
224
|
+
bottom: 10px;
|
|
225
|
+
left: 50%;
|
|
226
|
+
transform: translateX(-50%);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
</style>
|
package/src/index.ts
CHANGED
|
@@ -28,6 +28,8 @@ import BaseSiteInput from "./components/BaseSiteInput/BaseSiteInput.vue";
|
|
|
28
28
|
import BaseInputPhone from "./components/BaseInputPhone/BaseInputPhone.vue";
|
|
29
29
|
import BaseInputCurrency from "./components/BaseInputCurrency/BaseInputCurrency.vue";
|
|
30
30
|
import BaseSegmentedButtons from "./components/BaseSegmentedButtons/BaseSegmentedButtons.vue";
|
|
31
|
+
import BaseChips from "./components/BaseChips/BaseChips.vue";
|
|
32
|
+
import BaseSwiper from "./components/BaseSwiper/BaseSwiper.vue";
|
|
31
33
|
|
|
32
34
|
const components = {
|
|
33
35
|
Modal,
|
|
@@ -54,7 +56,9 @@ const components = {
|
|
|
54
56
|
BaseInputPhone,
|
|
55
57
|
BaseInputCurrency,
|
|
56
58
|
BasePagination,
|
|
57
|
-
BaseSegmentedButtons
|
|
59
|
+
BaseSegmentedButtons,
|
|
60
|
+
BaseChips,
|
|
61
|
+
BaseSwiper
|
|
58
62
|
};
|
|
59
63
|
|
|
60
64
|
// Функция для загрузки sprite.svg
|
|
@@ -134,5 +138,7 @@ export {
|
|
|
134
138
|
BaseInputPhone,
|
|
135
139
|
BaseInputCurrency,
|
|
136
140
|
BasePagination,
|
|
137
|
-
BaseSegmentedButtons
|
|
141
|
+
BaseSegmentedButtons,
|
|
142
|
+
BaseChips,
|
|
143
|
+
BaseSwiper
|
|
138
144
|
};
|
package/src/styles/root.scss
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ICoreSize } from './utils';
|
|
2
2
|
|
|
3
|
-
type PaginationColor = 'primary' | 'secondary' | 'white' | 'black';
|
|
4
|
-
type PaginationType = 'dots' | 'dotsWithBackground' | 'dashes' | 'dashesWithBackground' | 'numbers';
|
|
3
|
+
export type PaginationColor = 'primary' | 'secondary' | 'white' | 'black';
|
|
4
|
+
export type PaginationType = 'dots' | 'dotsWithBackground' | 'dashes' | 'dashesWithBackground' | 'numbers';
|
|
5
5
|
export interface IPaginationProps {
|
|
6
6
|
type?: PaginationType;
|
|
7
7
|
currentPage?: number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PaginationColor, PaginationType } from './pagination';
|
|
2
|
+
import type { ICoreSize } from './utils';
|
|
3
|
+
|
|
4
|
+
type TButtonSize = 'medium' | 'large';
|
|
5
|
+
|
|
6
|
+
export interface ICoreSwiperProps {
|
|
7
|
+
images: string[];
|
|
8
|
+
paginationSettings?: {
|
|
9
|
+
type?: PaginationType;
|
|
10
|
+
color?: PaginationColor;
|
|
11
|
+
size?: ICoreSize;
|
|
12
|
+
}
|
|
13
|
+
currentSlide?: number;
|
|
14
|
+
autoplay?: boolean;
|
|
15
|
+
autoplayInterval?: number;
|
|
16
|
+
buttonSize?: TButtonSize;
|
|
17
|
+
}
|