plugin-ui-for-kzt 0.0.8 → 0.0.10
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/README.md +21 -9
- package/example/App.vue +355 -0
- package/example/index.html +12 -0
- package/example/main.ts +8 -0
- package/example/shims-vue.d.ts +5 -0
- package/package.json +17 -7
- package/src/assets/icons/arrow-down.svg +3 -0
- package/src/assets/icons/calendar.svg +12 -0
- package/src/assets/icons/checkbox-circle.svg +3 -0
- package/src/assets/icons/checkbox.svg +3 -0
- package/src/assets/icons/email-sms.svg +4 -0
- package/src/assets/icons/help.svg +3 -0
- package/src/assets/icons/kg.svg +16 -0
- package/src/assets/icons/kz.svg +42 -0
- package/src/assets/icons/loader.svg +13 -0
- package/src/assets/icons/ru.svg +12 -0
- package/src/assets/icons/uz.svg +26 -0
- package/src/components/BaseBreadCrumbs/BaseBreadCrumbs.vue +142 -0
- package/src/components/BaseBreadCrumbs/README.md +49 -0
- package/src/components/BaseButton/BaseButton.vue +489 -0
- package/src/components/BaseButton/README.md +53 -0
- package/src/components/BaseCalendar/BaseCalendar.vue +231 -0
- package/src/components/BaseCalendar/README.md +126 -0
- package/src/components/BaseCheckbox/BaseCheckbox.vue +252 -0
- package/src/components/BaseCheckbox/README.md +110 -0
- package/src/components/BaseDropdown/BaseDropdown.vue +160 -0
- package/src/components/BaseDropdown/README.md +91 -0
- package/src/components/BaseIcon/BaseIcon.vue +47 -0
- package/src/components/BaseIcon/README.md +35 -0
- package/src/components/BaseInput/BaseInput.vue +300 -0
- package/src/components/BaseInput/README.md +85 -0
- package/src/components/BaseInputCalendar/BaseInputCalendar.vue +242 -0
- package/src/components/BaseInputCalendar/README.md +84 -0
- package/src/components/BaseInputCurrency/BaseInputCurrency.vue +198 -0
- package/src/components/BaseInputCurrency/README.md +57 -0
- package/src/components/BaseInputEmail/BaseInputEmail.vue +89 -0
- package/src/components/BaseInputEmail/README.md +71 -0
- package/src/components/BaseInputPhone/BaseInputPhone.vue +175 -0
- package/src/components/BaseLoader/BaseLoader.vue +45 -0
- package/src/components/BaseLoader/README.md +29 -0
- package/src/components/BaseOpenedListItem/BaseOpenedListItem.vue +216 -0
- package/src/components/BaseOpenedListItem/README.md +67 -0
- package/src/components/BaseRadio/BaseRadio.vue +283 -0
- package/src/components/BaseRadio/README.md +74 -0
- package/src/components/BaseSegmentedButtons/BaseSegmentedButtons.vue +89 -0
- package/src/components/BaseSegmentedButtons/README.md +75 -0
- package/src/components/BaseSelect/BaseSelect.vue +370 -0
- package/src/components/BaseSelect/README.md +95 -0
- package/src/components/BaseSiteInput/BaseSiteInput.vue +153 -0
- package/src/components/BaseTextarea/BaseTextarea.vue +212 -0
- package/src/components/BaseTextarea/README.md +75 -0
- package/src/components/BaseToggle/BaseToggle.vue +271 -0
- package/src/components/BaseToggle/README.md +76 -0
- package/src/components/BaseTooltip/BaseTooltip.vue +318 -0
- package/src/components/BaseTooltip/README.md +74 -0
- package/src/components/Modal/Modal.vue +21 -23
- package/src/components/Spinner/Spinner.vue +2 -1
- package/src/composables/kit/color.ts +14 -0
- package/src/composables/kit/interactive.ts +53 -0
- package/src/composables/kit/size.ts +15 -0
- package/src/composables/kit/state.ts +28 -0
- package/src/composables/kit/style.ts +18 -0
- package/src/composables/kit/utils.ts +7 -0
- package/src/icons/index.ts +9 -0
- package/src/index.ts +93 -2
- package/src/plugins/modalPlugin.ts +22 -9
- package/src/shims-context.d.ts +19 -0
- package/src/styles/index.scss +2 -1
- package/src/styles/root.scss +167 -0
- package/src/styles/variables.scss +160 -0
- package/src/types/breadcrumbs.d.ts +13 -0
- package/src/types/button.d.ts +13 -0
- package/src/types/calendar.d.ts +16 -0
- package/src/types/checkbox-radio.d.ts +15 -0
- package/src/types/dropdown.d.ts +20 -0
- package/src/types/icon.d.ts +8 -0
- package/src/types/input.d.ts +56 -0
- package/src/types/toggle.d.ts +12 -0
- package/src/types/tooltip.d.ts +8 -0
- package/src/types/utils.d.ts +37 -0
- package/src/vue-virtual-scroller.d.ts +9 -0
- package/tsconfig.json +6 -3
- package/webpack.config.js +90 -35
- package/dist/index.js +0 -4922
- package/dist/types/components/Toaster/timer.d.ts +0 -12
- package/dist/types/index.d.ts +0 -11
- package/dist/types/plugins/modalPlugin.d.ts +0 -16
- package/dist/types/plugins/toasterPlugin.d.ts +0 -26
- package/dist/types/store/modal.d.ts +0 -11
- package/dist/types/types/index.d.ts +0 -4
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
## 🧩 BaseToggle
|
|
2
|
+
|
|
3
|
+
Компонент переключателя (`toggle`) с поддержкой текста, состояний, размеров и работы через `v-model`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### ✅ Пример использования
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<base-toggle
|
|
11
|
+
v-model="isEnabled"
|
|
12
|
+
label="Получать уведомления"
|
|
13
|
+
sub-label="Включить уведомления по email"
|
|
14
|
+
size="medium"
|
|
15
|
+
:disabled="false"
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### ⚙️ Пропсы
|
|
22
|
+
|
|
23
|
+
- `modelValue: boolean`
|
|
24
|
+
Управляет состоянием переключателя (вкл/выкл). Используется через `v-model`.
|
|
25
|
+
|
|
26
|
+
- `id: string`
|
|
27
|
+
Уникальный идентификатор для `input`.
|
|
28
|
+
|
|
29
|
+
- `label?: string`
|
|
30
|
+
Основной текст слева или справа от переключателя.
|
|
31
|
+
|
|
32
|
+
- `subLabel?: string`
|
|
33
|
+
Второстепенный текст под `label`.
|
|
34
|
+
|
|
35
|
+
- `readonly?: boolean`
|
|
36
|
+
Делает компонент только для чтения, без возможности взаимодействия.
|
|
37
|
+
|
|
38
|
+
- `labelPosition?: 'left' | 'right'`
|
|
39
|
+
Управляет позицией текста. По умолчанию `'right'`.
|
|
40
|
+
|
|
41
|
+
- `size?: 'small' | 'medium'`
|
|
42
|
+
Размер компонента. По умолчанию `'medium'`.
|
|
43
|
+
|
|
44
|
+
- `disabled?: boolean`
|
|
45
|
+
Делает переключатель неактивным.
|
|
46
|
+
|
|
47
|
+
- `required?: boolean`
|
|
48
|
+
Добавляет обязательность (и атрибут `required`).
|
|
49
|
+
|
|
50
|
+
- `error?: boolean`
|
|
51
|
+
Активирует ошибочное состояние (подсветка, `data-error`).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### 📤 События
|
|
56
|
+
|
|
57
|
+
- `update:modelValue`
|
|
58
|
+
Эмитится при клике/переключении, возвращает новое значение `boolean`.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### 🎨 Поведение и классы
|
|
63
|
+
|
|
64
|
+
Компонент использует внутренние composables:
|
|
65
|
+
|
|
66
|
+
- `useKitSize` — добавляет классы размера:
|
|
67
|
+
`--small-size`, `--medium-size`, `--large-size`
|
|
68
|
+
|
|
69
|
+
- `useKitState` — обрабатывает состояние, ошибки, доступность:
|
|
70
|
+
`--is-disabled`, `--is-error`, `--is-loading` и др.
|
|
71
|
+
Также добавляет `data-*` атрибуты на элемент `input`.
|
|
72
|
+
|
|
73
|
+
- Дополнительные классы:
|
|
74
|
+
- `--is-active-value` — если `modelValue === true`
|
|
75
|
+
- `--is-readonly` — если `readonly === true`
|
|
76
|
+
- `--is-left-label-position` — если `labelPosition === 'left'`
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="base-tooltip-container">
|
|
3
|
+
<div
|
|
4
|
+
class="base-tooltip__trigger"
|
|
5
|
+
@mouseenter="showTooltip"
|
|
6
|
+
@mouseleave="hideTooltip"
|
|
7
|
+
@click="toggleTooltip"
|
|
8
|
+
>
|
|
9
|
+
<slot name="trigger">
|
|
10
|
+
<base-icon
|
|
11
|
+
name="help"
|
|
12
|
+
size="extra-small"
|
|
13
|
+
/>
|
|
14
|
+
</slot>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<Transition name="tooltip">
|
|
18
|
+
<div
|
|
19
|
+
v-if="isVisible"
|
|
20
|
+
class="base-tooltip"
|
|
21
|
+
:class="classList"
|
|
22
|
+
>
|
|
23
|
+
<div class="base-tooltip__wrapper">
|
|
24
|
+
<div class="base-tooltip__title">{{ title }}</div>
|
|
25
|
+
<div class="base-tooltip__content" v-html="content" />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</Transition>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
|
34
|
+
import type { ITooltipProps } from '../../types/tooltip';
|
|
35
|
+
|
|
36
|
+
const props = withDefaults(defineProps<ITooltipProps>(), {
|
|
37
|
+
position: 'top',
|
|
38
|
+
trigger: 'hover',
|
|
39
|
+
theme: 'light',
|
|
40
|
+
arrow: true,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const isVisible = ref(false);
|
|
44
|
+
|
|
45
|
+
function showTooltip() {
|
|
46
|
+
if (props.trigger === 'hover') {
|
|
47
|
+
isVisible.value = true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function hideTooltip() {
|
|
52
|
+
if (props.trigger === 'hover') {
|
|
53
|
+
isVisible.value = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function toggleTooltip() {
|
|
58
|
+
if (props.trigger === 'click') {
|
|
59
|
+
isVisible.value = !isVisible.value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function handleClickOutside(event: MouseEvent) {
|
|
64
|
+
if (props.trigger === 'click' && isVisible.value) {
|
|
65
|
+
const tooltip = document.querySelector('.base-tooltip');
|
|
66
|
+
const trigger = document.querySelector('.base-tooltip__trigger');
|
|
67
|
+
if (tooltip && trigger && !tooltip.contains(event.target as Node) && !trigger.contains(event.target as Node)) {
|
|
68
|
+
isVisible.value = false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
onMounted(() => {
|
|
74
|
+
document.addEventListener('click', handleClickOutside);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
onUnmounted(() => {
|
|
78
|
+
document.removeEventListener('click', handleClickOutside);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const classList = computed(() => [
|
|
82
|
+
`--is-${props.position}`,
|
|
83
|
+
`--is-${props.trigger}`,
|
|
84
|
+
`--is-${props.theme}`,
|
|
85
|
+
{
|
|
86
|
+
'--is-arrow': props.arrow,
|
|
87
|
+
'--is-visible': isVisible.value,
|
|
88
|
+
},
|
|
89
|
+
]);
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<style lang="scss" scoped>
|
|
93
|
+
@import '../../styles/variables';
|
|
94
|
+
@import '../../styles/root';
|
|
95
|
+
|
|
96
|
+
.base-tooltip-container {
|
|
97
|
+
position: relative;
|
|
98
|
+
display: inline-block;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.base-tooltip__trigger {
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.base-tooltip {
|
|
106
|
+
$tooltip: &;
|
|
107
|
+
|
|
108
|
+
position: absolute;
|
|
109
|
+
z-index: 1000;
|
|
110
|
+
width: fit-content;
|
|
111
|
+
|
|
112
|
+
&.--is-top, &.--is-top-left, &.--is-top-right {
|
|
113
|
+
bottom: 100%;
|
|
114
|
+
left: 50%;
|
|
115
|
+
margin-bottom: var(--spacing-s);
|
|
116
|
+
transform: translateX(-50%);
|
|
117
|
+
transform-origin: bottom center;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.--is-bottom {
|
|
121
|
+
top: 100%;
|
|
122
|
+
left: 50%;
|
|
123
|
+
margin-top: var(--spacing-s);
|
|
124
|
+
transform: translateX(-50%);
|
|
125
|
+
transform-origin: top center;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&.--is-left {
|
|
129
|
+
top: 50%;
|
|
130
|
+
right: 100%;
|
|
131
|
+
margin-right: var(--spacing-s);
|
|
132
|
+
transform: translateY(-50%);
|
|
133
|
+
transform-origin: right center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&.--is-right {
|
|
137
|
+
top: 50%;
|
|
138
|
+
left: 100%;
|
|
139
|
+
margin-left: var(--spacing-s);
|
|
140
|
+
transform: translateY(-50%);
|
|
141
|
+
transform-origin: left center;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&__wrapper {
|
|
145
|
+
position: relative;
|
|
146
|
+
display: inline-block;
|
|
147
|
+
width: max-content;
|
|
148
|
+
max-width: 320px;
|
|
149
|
+
padding: var(--spacing-s) var(--spacing-m);
|
|
150
|
+
border-radius: var(--corner-radius-xs);
|
|
151
|
+
box-shadow: 0px 0px 12px -2px var(--effects-drop-shadows-100);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&.--is-light {
|
|
155
|
+
#{$tooltip} {
|
|
156
|
+
&__wrapper {
|
|
157
|
+
color: var(--primary-text-secondary);
|
|
158
|
+
background: var(--primary-black-white);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&.--is-dark {
|
|
164
|
+
#{$tooltip} {
|
|
165
|
+
&__wrapper {
|
|
166
|
+
color: var(--primary-black-white);
|
|
167
|
+
background: var(--primary-black-900);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&.--is-arrow {
|
|
173
|
+
#{$tooltip} {
|
|
174
|
+
&__wrapper {
|
|
175
|
+
&::before {
|
|
176
|
+
position: absolute;
|
|
177
|
+
content: '';
|
|
178
|
+
width: 12px;
|
|
179
|
+
height: 12px;
|
|
180
|
+
z-index: 1;
|
|
181
|
+
transform: rotate(45deg);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&.--is-light {
|
|
187
|
+
#{$tooltip} {
|
|
188
|
+
&__wrapper {
|
|
189
|
+
&::before {
|
|
190
|
+
background: var(--primary-black-white);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&.--is-dark {
|
|
197
|
+
#{$tooltip} {
|
|
198
|
+
&__wrapper {
|
|
199
|
+
&::before {
|
|
200
|
+
background: var(--primary-black-900);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
&.--is-top, &.--is-top-left, &.--is-top-right {
|
|
207
|
+
#{$tooltip} {
|
|
208
|
+
&__wrapper {
|
|
209
|
+
&::before {
|
|
210
|
+
left: calc(50% - 6px);
|
|
211
|
+
bottom: -5px;
|
|
212
|
+
box-shadow: 4px 4px 8px -3px var(--effects-drop-shadows-100);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&.--is-bottom {
|
|
219
|
+
#{$tooltip} {
|
|
220
|
+
&__wrapper {
|
|
221
|
+
&::before {
|
|
222
|
+
bottom: 100%;
|
|
223
|
+
left: calc(50% - 6px);
|
|
224
|
+
top: -4px;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&.--is-left {
|
|
231
|
+
#{$tooltip} {
|
|
232
|
+
&__wrapper {
|
|
233
|
+
&::before {
|
|
234
|
+
top: calc(50% - 6px);
|
|
235
|
+
right: -4px;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&.--is-right {
|
|
242
|
+
#{$tooltip} {
|
|
243
|
+
&__wrapper {
|
|
244
|
+
&::before {
|
|
245
|
+
top: calc(50% - 6px);
|
|
246
|
+
left: -4px;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&__title {
|
|
254
|
+
font: var(--typography-text-xs-semibold);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&__content {
|
|
258
|
+
font: var(--typography-text-xs-regular);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.tooltip-enter-active,
|
|
263
|
+
.tooltip-leave-active {
|
|
264
|
+
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.tooltip-enter-from,
|
|
268
|
+
.tooltip-leave-to {
|
|
269
|
+
opacity: 0;
|
|
270
|
+
transform: scale(0.95);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.base-tooltip.--is-top,
|
|
274
|
+
.base-tooltip.--is-top-left,
|
|
275
|
+
.base-tooltip.--is-top-right {
|
|
276
|
+
&.tooltip-enter-from,
|
|
277
|
+
&.tooltip-leave-to {
|
|
278
|
+
transform: translateX(-50%) translateY(10px) scale(0.95);
|
|
279
|
+
}
|
|
280
|
+
&.tooltip-enter-to,
|
|
281
|
+
&.tooltip-leave-from {
|
|
282
|
+
transform: translateX(-50%) translateY(0) scale(1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.base-tooltip.--is-bottom {
|
|
287
|
+
&.tooltip-enter-from,
|
|
288
|
+
&.tooltip-leave-to {
|
|
289
|
+
transform: translateX(-50%) translateY(-10px) scale(0.95);
|
|
290
|
+
}
|
|
291
|
+
&.tooltip-enter-to,
|
|
292
|
+
&.tooltip-leave-from {
|
|
293
|
+
transform: translateX(-50%) translateY(0) scale(1);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.base-tooltip.--is-left {
|
|
298
|
+
&.tooltip-enter-from,
|
|
299
|
+
&.tooltip-leave-to {
|
|
300
|
+
transform: translateY(-50%) translateX(10px) scale(0.95);
|
|
301
|
+
}
|
|
302
|
+
&.tooltip-enter-to,
|
|
303
|
+
&.tooltip-leave-from {
|
|
304
|
+
transform: translateY(-50%) translateX(0) scale(1);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.base-tooltip.--is-right {
|
|
309
|
+
&.tooltip-enter-from,
|
|
310
|
+
&.tooltip-leave-to {
|
|
311
|
+
transform: translateY(-50%) translateX(-10px) scale(0.95);
|
|
312
|
+
}
|
|
313
|
+
&.tooltip-enter-to,
|
|
314
|
+
&.tooltip-leave-from {
|
|
315
|
+
transform: translateY(-50%) translateX(0) scale(1);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
## 🧠 BaseTooltip
|
|
2
|
+
|
|
3
|
+
`BaseTooltip` — простой и настраиваемый компонент тултипа с поддержкой тем, стрелки, и триггеров по ховеру или клику.
|
|
4
|
+
|
|
5
|
+
### ✅ Пример использования
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<base-tooltip
|
|
9
|
+
title="Заголовок"
|
|
10
|
+
content="Описание тултипа"
|
|
11
|
+
position="right"
|
|
12
|
+
theme="dark"
|
|
13
|
+
:arrow="true"
|
|
14
|
+
>
|
|
15
|
+
<template #trigger>
|
|
16
|
+
<button>?</button>
|
|
17
|
+
</template>
|
|
18
|
+
</base-tooltip>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Если не передать слот `trigger`, по умолчанию будет отображена иконка `help`.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Конечно! Вот обновлённый стиль описания пропсов — менее формальный, более описательный и дружелюбный:
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### ⚙️ Свойства (props)
|
|
30
|
+
|
|
31
|
+
- **`title`**
|
|
32
|
+
_Тип:_ `string`
|
|
33
|
+
Заголовок, который будет отображаться в тултипе сверху. Можно оставить пустым, если нужен только текст.
|
|
34
|
+
|
|
35
|
+
- **`content`**
|
|
36
|
+
_Тип:_ `string`
|
|
37
|
+
Основное содержимое тултипа. То, что пользователь должен увидеть при наведении/клике.
|
|
38
|
+
|
|
39
|
+
- **`position`**
|
|
40
|
+
_Тип:_ `'top' | 'bottom' | 'left' | 'right'`
|
|
41
|
+
_По умолчанию:_ `'top'`
|
|
42
|
+
Указывает, где появится тултип относительно элемента — сверху, снизу, слева или справа.
|
|
43
|
+
|
|
44
|
+
- **`trigger`**
|
|
45
|
+
_Тип:_ `'hover' | 'click'`
|
|
46
|
+
_По умолчанию:_ `'hover'`
|
|
47
|
+
Способ активации тултипа: по наведению курсора (`hover`) или по клику (`click`).
|
|
48
|
+
|
|
49
|
+
- **`theme`**
|
|
50
|
+
_Тип:_ `'light' | 'dark'`
|
|
51
|
+
_По умолчанию:_ `'light'`
|
|
52
|
+
Цветовая тема тултипа. Светлая подойдёт для светлых интерфейсов, тёмная — для тёмных.
|
|
53
|
+
|
|
54
|
+
- **`arrow`**
|
|
55
|
+
_Тип:_ `boolean`
|
|
56
|
+
_По умолчанию:_ `true`
|
|
57
|
+
Показывать ли стрелочку, указывающую на элемент. Если не нужна — просто отключи.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### 🎯 Слоты
|
|
62
|
+
|
|
63
|
+
| Название | Описание |
|
|
64
|
+
|------------|----------|
|
|
65
|
+
| `trigger` | Элемент, при наведении или клике на который появляется тултип |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### 📌 Особенности
|
|
70
|
+
|
|
71
|
+
- Реагирует на клик или ховер в зависимости от `trigger`.
|
|
72
|
+
- Автоматически скрывается при клике вне компонента (`click-outside`).
|
|
73
|
+
- Можно вставить любой элемент в `trigger` слот.
|
|
74
|
+
- Поддержка позиционирования и стрелки с соответствующим стилем.
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="modal-container" @click.stop>
|
|
3
3
|
<div
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
class="modal-container-header"
|
|
5
|
+
:class="{
|
|
6
6
|
'modal-container-header-show-all': showMore,
|
|
7
|
-
[getTypeModal.nameClass]: getTypeModal.nameClass
|
|
7
|
+
[getTypeModal.nameClass]: getTypeModal.nameClass.length,
|
|
8
8
|
}"
|
|
9
9
|
>
|
|
10
10
|
{{getTypeModal.nameClass}}
|
|
11
11
|
<div class="modal-container-header-title">
|
|
12
|
-
<component :is="getTypeModal.img"
|
|
12
|
+
<component :is="getTypeModal.img"/>
|
|
13
13
|
<div>{{ options.title }}</div>
|
|
14
14
|
<div>{{ getTypeModal.nameClass }}</div>
|
|
15
15
|
</div>
|
|
16
16
|
<div
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
class="modal-container-header-show-more"
|
|
18
|
+
@click="showMore = !showMore"
|
|
19
19
|
>
|
|
20
20
|
{{ showMore ? "Скрыть" : "Смотреть больше" }}
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
|
-
<CloseIcon class="modal-button-close" @click="onClose"
|
|
23
|
+
<CloseIcon class="modal-button-close" @click="onClose"/>
|
|
24
24
|
<div v-if="showMore" class="modal-container-subtitle">
|
|
25
|
-
Описание: <br
|
|
25
|
+
Описание: <br/>
|
|
26
26
|
{{ options.message }}
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script setup lang="ts">
|
|
32
|
-
import {ref, computed
|
|
32
|
+
import {ref, computed} from "vue";
|
|
33
33
|
import CloseIcon from "../icons/CloseIcon.vue";
|
|
34
34
|
import ErrorIcon from "../icons/ErrorIcon.vue";
|
|
35
35
|
import SuccessIcon from "../icons/SuccessIcon.vue";
|
|
@@ -38,7 +38,7 @@ import InfoIcon from "../icons/InfoIcon.vue";
|
|
|
38
38
|
import {IModalState, IModalType} from "../../types/index";
|
|
39
39
|
|
|
40
40
|
interface IProps {
|
|
41
|
-
options:IModalState
|
|
41
|
+
options: IModalState
|
|
42
42
|
name: IModalType;
|
|
43
43
|
onClose: () => void;
|
|
44
44
|
}
|
|
@@ -46,27 +46,24 @@ interface IProps {
|
|
|
46
46
|
const props = defineProps<IProps>();
|
|
47
47
|
const showMore = ref<boolean>(false);
|
|
48
48
|
|
|
49
|
-
const getTypeModal = computed<{ img:
|
|
50
|
-
console.log(props.name)
|
|
49
|
+
const getTypeModal = computed<{ img: any; nameClass: string }>(() => {
|
|
50
|
+
console.log(props.name, 'show props name')
|
|
51
51
|
switch (props.name) {
|
|
52
52
|
case "error":
|
|
53
|
-
return {
|
|
53
|
+
return {img: ErrorIcon, nameClass: "error"};
|
|
54
54
|
case "success":
|
|
55
|
-
return {
|
|
55
|
+
return {img: SuccessIcon, nameClass: "success"};
|
|
56
56
|
case "warning":
|
|
57
|
-
return {
|
|
57
|
+
return {img: WarningIcon, nameClass: "warning"};
|
|
58
58
|
case "info":
|
|
59
|
-
return {
|
|
59
|
+
return {img: InfoIcon, nameClass: "info"};
|
|
60
60
|
default:
|
|
61
|
-
return {
|
|
62
|
-
img: SuccessIcon,
|
|
63
|
-
nameClass: "info-modal",
|
|
64
|
-
};
|
|
61
|
+
return {img: WarningIcon, nameClass: "info"};
|
|
65
62
|
}
|
|
66
63
|
});
|
|
67
64
|
</script>
|
|
68
65
|
|
|
69
|
-
<style lang="scss">
|
|
66
|
+
<style lang="scss" scoped>
|
|
70
67
|
.modal {
|
|
71
68
|
position: fixed;
|
|
72
69
|
top: 0;
|
|
@@ -104,6 +101,7 @@ const getTypeModal = computed<{ img: Component; nameClass: string }>(() => {
|
|
|
104
101
|
font-size: 20px;
|
|
105
102
|
font-weight: 400;
|
|
106
103
|
line-height: 24px;
|
|
104
|
+
|
|
107
105
|
&-show-all {
|
|
108
106
|
border-radius: 12px 12px 0 0;
|
|
109
107
|
}
|
|
@@ -140,11 +138,11 @@ const getTypeModal = computed<{ img: Component; nameClass: string }>(() => {
|
|
|
140
138
|
background: #15b853;
|
|
141
139
|
}
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
.warning {
|
|
144
142
|
background: #f4a900;
|
|
145
143
|
}
|
|
146
144
|
|
|
147
|
-
.
|
|
145
|
+
.info {
|
|
148
146
|
background: #0085cf;
|
|
149
147
|
}
|
|
150
148
|
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ICoreColor } from '../../types/utils';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
export function useKitColor(props: ICoreColor) {
|
|
5
|
+
const colorClassList = computed(() => [
|
|
6
|
+
{
|
|
7
|
+
[`--${props.color}-color`]: props.color,
|
|
8
|
+
},
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
colorClassList,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ICoreInteractive } from '../../types/utils';
|
|
2
|
+
import { computed, useAttrs, getCurrentInstance } from 'vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export function useKitInteractive(props: ICoreInteractive) {
|
|
6
|
+
const INTERACTIVE_TAGS = {
|
|
7
|
+
BUTTON: 'button',
|
|
8
|
+
LINK: 'link',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const attrs = useAttrs();
|
|
12
|
+
|
|
13
|
+
const isInteractive = computed(() => {
|
|
14
|
+
if (!props.tag || [INTERACTIVE_TAGS.LINK].includes(props.tag)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return Boolean(attrs.to);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const componentTag = computed(() => {
|
|
22
|
+
const instance = getCurrentInstance();
|
|
23
|
+
const hasRouterLink = instance?.appContext.components['RouterLink'] || false;
|
|
24
|
+
|
|
25
|
+
if (!props.tag) {
|
|
26
|
+
return 'button';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (attrs.to && hasRouterLink) {
|
|
30
|
+
return 'router-link';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
[INTERACTIVE_TAGS.BUTTON]: 'button',
|
|
35
|
+
[INTERACTIVE_TAGS.LINK]: 'a',
|
|
36
|
+
span: 'span',
|
|
37
|
+
div: 'div',
|
|
38
|
+
}[props.tag] || 'a';
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const interactiveClassList = computed(() => {
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
'--is-interactive': isInteractive.value,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
componentTag,
|
|
51
|
+
interactiveClassList,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ICoreSize } from '../../types/utils';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export function useKitSize(props: ICoreSize) {
|
|
6
|
+
const sizeClassList = computed(() => [
|
|
7
|
+
{
|
|
8
|
+
[`--${props.size}-size`]: props.size,
|
|
9
|
+
},
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
sizeClassList,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ICoreState } from '../../types/utils';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export function useKitState(props: ICoreState) {
|
|
6
|
+
const stateClassList = computed(() => [
|
|
7
|
+
{
|
|
8
|
+
'--is-selected': props.selected,
|
|
9
|
+
'--is-active': props.active,
|
|
10
|
+
'--is-required': props.required,
|
|
11
|
+
'--is-error': props.error,
|
|
12
|
+
'--is-loading': props.loading,
|
|
13
|
+
'--is-disabled': props.disabled,
|
|
14
|
+
},
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
const stateAttrs = computed(() => ({
|
|
18
|
+
...(Boolean(props.error) && { 'data-error': Boolean(props.error) }),
|
|
19
|
+
...(props.disabled && { 'data-disabled': props.disabled }),
|
|
20
|
+
...(props.required && { required: props.required }),
|
|
21
|
+
...(props.disabled && { disabled: props.disabled }),
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
stateClassList,
|
|
26
|
+
stateAttrs,
|
|
27
|
+
};
|
|
28
|
+
}
|