@topvisor/ui 0.0.34 → 0.0.35
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/.storybook/TopTheme.js +82 -0
- package/.storybook/TopThemeManager.js +44 -0
- package/.storybook/main.ts +43 -0
- package/.storybook/manager.ts +28 -0
- package/.storybook/preview-head.html +16 -0
- package/.storybook/preview.ts +48 -0
- package/.storybook/vue/coreDecorator.ts +19 -0
- package/.storybook/vue/vModelDecorator.ts +27 -0
- package/.vscode/extensions.json +11 -0
- package/.vscode/keybindings.example.json +121 -0
- package/.vscode/settings.json +46 -0
- package/Dockerfile +3 -0
- package/NPM.md +25 -0
- package/PUBLISH.md +18 -0
- package/README.md +19 -52
- package/STORYBOOK.md +27 -0
- package/USE_IN_PROJECT.md +29 -0
- package/build/afterBuild.sh +12 -0
- package/build/cssModules.ts +39 -0
- package/build/plugin/amdFix.ts +46 -0
- package/build/rollup.config.ts +18 -0
- package/nbproject/project.properties +11 -0
- package/nbproject/project.xml +9 -0
- package/package.json +68 -19
- package/public/README.md +63 -0
- package/src/components/common/common.ts +1 -0
- package/src/components/common/icon/icon.ts +4 -0
- package/src/components/common/icon/icon.vue +15 -0
- package/src/components/component.ts +133 -0
- package/src/components/forms/button/button.stories.ts +112 -0
- package/src/components/forms/button/button.ts +51 -0
- package/src/components/forms/button/button.vue +75 -0
- package/src/components/forms/button/stories/README.md +35 -0
- package/src/components/forms/button/stories/overview.vue +33 -0
- package/src/components/forms/button/style/button.css +124 -0
- package/src/components/forms/button/style/style-outline.css +42 -0
- package/src/components/forms/button/style/style-soft.css +31 -0
- package/src/components/forms/button/style/style-transparent.css +35 -0
- package/src/components/forms/checkbox/checkbox.stories.ts +33 -0
- package/src/components/forms/checkbox/checkbox.ts +23 -0
- package/src/components/forms/checkbox/checkbox.vue +135 -0
- package/src/components/forms/checkbox/stories/overview.vue +171 -0
- package/src/components/forms/controlLabel/controlLabel.stories.ts +38 -0
- package/src/components/forms/controlLabel/controlLabel.ts +4 -0
- package/src/components/forms/controlLabel/controlLabel.vue +48 -0
- package/src/components/forms/forms.ts +10 -0
- package/src/components/forms/helpers.ts +10 -0
- package/src/components/forms/hint/hint.stories.ts +46 -0
- package/src/components/forms/hint/hint.ts +8 -0
- package/src/components/forms/hint/hint.vue +32 -0
- package/src/components/forms/input/input.stories.ts +31 -0
- package/src/components/forms/input/input.ts +34 -0
- package/src/components/forms/input/input.vue +170 -0
- package/src/components/forms/input/stories/overview.vue +61 -0
- package/src/components/forms/inputDate/datepicker.css +233 -0
- package/src/components/forms/inputDate/datepicker.ts +101 -0
- package/src/components/forms/inputDate/inputDate.stories.ts +41 -0
- package/src/components/forms/inputDate/inputDate.ts +4 -0
- package/src/components/forms/inputDate/inputDate.vue +127 -0
- package/src/components/forms/inputDate/stories/overview.vue +35 -0
- package/src/components/forms/radio/radio.stories.ts +34 -0
- package/src/components/forms/radio/radio.ts +15 -0
- package/src/components/forms/radio/radio.vue +107 -0
- package/src/components/forms/radio/stories/overview.vue +79 -0
- package/src/components/forms/select/select.stories.ts +34 -0
- package/src/components/forms/select/select.ts +36 -0
- package/src/components/forms/select/select.vue +253 -0
- package/src/components/forms/select/stories/exampleOptions.ts +71 -0
- package/src/components/forms/select/stories/overview.vue +60 -0
- package/src/components/forms/switcher/stories/overview.vue +139 -0
- package/src/components/forms/switcher/switcher.stories.ts +33 -0
- package/src/components/forms/switcher/switcher.ts +22 -0
- package/src/components/forms/switcher/switcher.vue +113 -0
- package/src/components/forms/textarea/stories/overview.vue +62 -0
- package/src/components/forms/textarea/textarea.stories.ts +33 -0
- package/src/components/forms/textarea/textarea.ts +38 -0
- package/src/components/forms/textarea/textarea.vue +119 -0
- package/src/components/formsExt/editArea/editArea.stories.ts +72 -0
- package/src/components/formsExt/editArea/editArea.ts +25 -0
- package/src/components/formsExt/editArea/editArea.vue +172 -0
- package/src/components/formsExt/editArea/stories/README.md +17 -0
- package/src/components/formsExt/editArea/stories/overview.vue +66 -0
- package/src/components/formsExt/editInput/editInput.stories.ts +36 -0
- package/src/components/formsExt/editInput/editInput.ts +20 -0
- package/src/components/formsExt/editInput/editInput.vue +57 -0
- package/src/components/formsExt/editInput/stories/overview.vue +54 -0
- package/src/components/formsExt/formsExt.ts +3 -0
- package/src/components/formsExt/radioGroup/radioGroup.stories.ts +51 -0
- package/src/components/formsExt/radioGroup/radioGroup.ts +28 -0
- package/src/components/formsExt/radioGroup/radioGroup.vue +143 -0
- package/src/components/formsExt/radioGroup/stories/overview.vue +78 -0
- package/src/components/formsExt/radioGroup/styles/top-scrollBar.css +52 -0
- package/src/components/helper.js +10 -0
- package/src/components/helpersStories.ts +151 -0
- package/src/components/popup/lib/popup.globalEvents.js +205 -0
- package/src/components/popup/lib/popup.js +702 -0
- package/src/components/popup/lib/worker.globalEvents.js +78 -0
- package/src/components/popup/lib/worker.js +232 -0
- package/src/components/popup/popup/listItem.vue +42 -0
- package/src/components/popup/popup/opener.vue +74 -0
- package/src/components/popup/popup/popup.stories.ts +68 -0
- package/src/components/popup/popup/popup.ts +93 -0
- package/src/components/popup/popup/popup.vue +95 -0
- package/src/components/popup/popup/stories/README.md +34 -0
- package/src/components/popup/popup/stories/listItems.vue +44 -0
- package/src/components/popup/popup/stories/listSubItems.vue +52 -0
- package/src/components/popup/popup/stories/overview.vue +208 -0
- package/src/components/popup/popup/style/popup.css +243 -0
- package/src/components/popup/popup/style/popup.m.css +71 -0
- package/src/components/popup/popup/style/popup.pc.css +28 -0
- package/src/components/popup/popup.ts +3 -0
- package/src/components/popup/worker.ts +1 -0
- package/src/components/tabs/tabs/content.vue +24 -0
- package/src/components/tabs/tabs/stories/README.md +10 -0
- package/src/components/tabs/tabs/tab.vue +52 -0
- package/src/components/tabs/tabs/tabs.stories.ts +171 -0
- package/src/components/tabs/tabs/tabs.ts +22 -0
- package/src/components/tabs/tabs/tabs.vue +64 -0
- package/src/components/tabs/tabs.ts +3 -0
- package/src/core/base/Colors.stories.ts +15 -0
- package/src/core/base/Layout.stories.ts +15 -0
- package/src/core/base/Properties.stories.ts +15 -0
- package/src/core/base/base.mdx +21 -0
- package/src/core/core/core.ts +144 -0
- package/src/core/core/events.ts +54 -0
- package/src/core/core/options.ts +15 -0
- package/src/core/core/state.ts +44 -0
- package/src/core/directives/tooltip.ts +55 -0
- package/src/core/theme/Colors.stories.ts +15 -0
- package/src/core/theme/Properties.stories.ts +15 -0
- package/src/core/theme/theme.mdx +15 -0
- package/src/core/utils/date.ts +164 -0
- package/src/core/utils/device.ts +48 -0
- package/src/core/utils/dom.ts +185 -0
- package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272/gallery.vue" +72 -0
- package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272.mdx" +31 -0
- package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272.stories.ts" +14 -0
- package/src/docs/CSS/FAQ.mdx +43 -0
- package/src/docs/CSS//320/236/320/261/321/211/320/270/320/265 /320/274/320/276/320/264/320/270/321/204/320/270/320/272/320/260/321/202/320/276/321/200/321/213.mdx" +156 -0
- package/src/docs/CSS//320/237/320/265/321/200/320/265/320/274/320/265/320/275/320/275/321/213/320/265.mdx +47 -0
- package/src/docs/CSS//320/237/321/200/320/265/320/264/320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/321/200/321/213.mdx +15 -0
- package/src/docs/CSS//320/240/320/265/320/272/320/276/320/274/320/265/320/275/320/264/320/260/321/206/320/270/320/270 /320/221/320/255/320/234.mdx" +49 -0
- package/src/docs/CSS//320/241/321/202/320/270/320/273/320/270.md +53 -0
- package/src/docs/CSS//320/241/321/202/320/270/320/273/320/270.mdx +4 -0
- package/src/docs/CSS//320/247/321/202/320/276 /321/202/320/260/320/272/320/276/320/265 css /320/274/320/276/320/264/321/203/320/273/321/214.mdx" +53 -0
- package/src/docs/ROADMAP.md +17 -0
- package/src/docs/Roadmap.mdx +4 -0
- package/src/docs//320/222/320/262/320/265/320/264/320/265/320/275/320/270/320/265 /320/262 Storybook.mdx" +323 -0
- package/src/docs//320/232/320/276/320/274/320/277/320/276/320/275/320/265/320/275/321/202/321/213.mdx +20 -0
- package/src/docs//320/237/320/276/320/273/320/265/320/267/320/275/320/260/321/217 /320/270/320/275/321/204/320/276/321/200/320/274/320/260/321/206/320/270/321/217.mdx" +8 -0
- package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260/IDE.mdx" +42 -0
- package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260//320/233/320/270/320/275/321/202/320/265/321/200.mdx" +72 -0
- package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260.mdx" +29 -0
- package/src/globals.d.ts +1 -0
- package/{icomoon → src/resources/icomoon}/demo-files/demo.css +161 -161
- package/{icomoon → src/resources/icomoon}/demo-files/demo.js +30 -30
- package/{icomoon → src/resources/icomoon}/demo.html +2945 -2945
- package/{icomoon → src/resources/icomoon}/fonts/Topvisor-2.svg +232 -232
- package/{icomoon → src/resources/icomoon}/style.css +647 -647
- package/src/resources/styles/core/colors.css +204 -0
- package/src/resources/styles/core/components.css +70 -0
- package/src/resources/styles/core/core.ts +10 -0
- package/src/resources/styles/core/forms/clear.css +19 -0
- package/src/resources/styles/core/forms/controls.css +20 -0
- package/src/resources/styles/core/forms/focusable.css +26 -0
- package/src/resources/styles/core/forms/forms.css +100 -0
- package/src/resources/styles/core/icon.css +58 -0
- package/src/resources/styles/core/layout.css +40 -0
- package/src/resources/styles/core/modifiers/as.css +9 -0
- package/src/resources/styles/core/modifiers/ellipsis.css +18 -0
- package/src/resources/styles/core/modifiers/modifiers.css +81 -0
- package/src/resources/styles/core/modifiers/only.css +19 -0
- package/src/resources/styles/core/select.css +16 -0
- package/src/resources/styles/jquery-ui.min.css +6 -0
- package/src/resources/styles/storybook.css +11 -0
- package/src/resources/styles/themes/dark/theme.css +139 -0
- package/src/resources/styles/themes/dark.ts +1 -0
- package/src/resources/styles/themes/light/theme.css +139 -0
- package/src/resources/styles/themes/light.ts +1 -0
- package/src/storybook/components/color.vue +45 -0
- package/src/storybook/components/colors.vue +34 -0
- package/src/storybook/components/icomoon.ts +38 -0
- package/src/storybook/components/properties.vue +82 -0
- package/src/storybook/resources/accessibility.png +0 -0
- package/src/storybook/resources/accessibility.svg +5 -0
- package/src/storybook/resources/addon-library.png +0 -0
- package/src/storybook/resources/assets.png +0 -0
- package/src/storybook/resources/context.png +0 -0
- package/src/storybook/resources/discord.svg +15 -0
- package/src/storybook/resources/docs.png +0 -0
- package/src/storybook/resources/figma-plugin.png +0 -0
- package/src/storybook/resources/github.svg +3 -0
- package/src/storybook/resources/share.png +0 -0
- package/src/storybook/resources/styling.png +0 -0
- package/src/storybook/resources/testing.png +0 -0
- package/src/storybook/resources/theming.png +0 -0
- package/src/storybook/resources/tutorials.svg +12 -0
- package/src/storybook/resources/youtube.svg +4 -0
- package/src//320/224/320/276/320/261/321/200/320/276 /320/277/320/276/320/266/320/260/320/273/320/276/320/262/320/260/321/202/321/214.mdx" +3 -0
- package/tsconfig.json +62 -0
- package/vite.config.ts +91 -0
- package/.chunks/datepicker-0b648b9f.es.js +0 -275
- package/.chunks/datepicker-0b648b9f.es.js.map +0 -1
- package/.chunks/datepicker-0e9a0541.amd.js +0 -234
- package/.chunks/datepicker-0e9a0541.amd.js.map +0 -1
- package/.chunks/forms-02202302.amd.js +0 -3
- package/.chunks/forms-02202302.amd.js.map +0 -1
- package/.chunks/forms-eb00d0c1.es.js +0 -946
- package/.chunks/forms-eb00d0c1.es.js.map +0 -1
- package/.chunks/popup-6f73b4b2.es.js +0 -700
- package/.chunks/popup-6f73b4b2.es.js.map +0 -1
- package/.chunks/popup-e1f34511.amd.js +0 -341
- package/.chunks/popup-e1f34511.amd.js.map +0 -1
- package/common/common.amd.js +0 -2
- package/common/common.amd.js.map +0 -1
- package/common/common.js +0 -2
- package/common/common.js.map +0 -1
- package/core/core.amd.js +0 -2
- package/core/core.amd.js.map +0 -1
- package/core/core.js +0 -6
- package/core/core.js.map +0 -1
- package/core.css +0 -1
- package/dark.css +0 -1
- package/forms/forms.amd.js +0 -2
- package/forms/forms.amd.js.map +0 -1
- package/forms/forms.js +0 -15
- package/forms/forms.js.map +0 -1
- package/forms/helpers.amd.js +0 -2
- package/forms/helpers.amd.js.map +0 -1
- package/forms/helpers.js +0 -9
- package/forms/helpers.js.map +0 -1
- package/forms.css +0 -1
- package/formsExt/formsExt.amd.js +0 -3
- package/formsExt/formsExt.amd.js.map +0 -1
- package/formsExt/formsExt.js +0 -152
- package/formsExt/formsExt.js.map +0 -1
- package/formsExt.css +0 -1
- package/light.css +0 -1
- package/popup/popup.amd.js +0 -3
- package/popup/popup.amd.js.map +0 -1
- package/popup/popup.js +0 -144
- package/popup/popup.js.map +0 -1
- package/popup/worker.amd.js +0 -2
- package/popup/worker.amd.js.map +0 -1
- package/popup/worker.js +0 -154
- package/popup/worker.js.map +0 -1
- package/popup.css +0 -1
- package/tabs/tabs.amd.js +0 -3
- package/tabs/tabs.amd.js.map +0 -1
- package/tabs/tabs.js +0 -97
- package/tabs/tabs.js.map +0 -1
- package/tabs.css +0 -1
- package/utils/date.amd.js +0 -2
- package/utils/date.amd.js.map +0 -1
- package/utils/date.js +0 -6
- package/utils/date.js.map +0 -1
- package/utils/device.amd.js +0 -2
- package/utils/device.amd.js.map +0 -1
- package/utils/device.js +0 -6
- package/utils/device.js.map +0 -1
- package/utils/dom.amd.js +0 -2
- package/utils/dom.amd.js.map +0 -1
- package/utils/dom.js +0 -64
- package/utils/dom.js.map +0 -1
- /package/{icomoon → src/resources/icomoon}/fonts/Topvisor-2.ttf +0 -0
- /package/{icomoon → src/resources/icomoon}/fonts/Topvisor-2.woff +0 -0
- /package/{icomoon → src/resources/icomoon}/selection.json +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Props } from '../editArea';
|
|
3
|
+
import EditArea from '../editArea.vue';
|
|
4
|
+
import { reactive } from 'vue';
|
|
5
|
+
|
|
6
|
+
defineProps<Props>();
|
|
7
|
+
|
|
8
|
+
const genVariantProps = () => {
|
|
9
|
+
return {
|
|
10
|
+
'Без настроек': {
|
|
11
|
+
modelValue: '',
|
|
12
|
+
},
|
|
13
|
+
'С заголовком': {
|
|
14
|
+
modelValue: '',
|
|
15
|
+
title: 'editArea с заголовком',
|
|
16
|
+
},
|
|
17
|
+
'С placeholder': {
|
|
18
|
+
modelValue: '',
|
|
19
|
+
placeholder: 'Напишите что-нибудь...',
|
|
20
|
+
},
|
|
21
|
+
'С текстом': {
|
|
22
|
+
modelValue: 'Не выходи из комнаты, не совершай ошибку. Зачем тебе Солнце, если ты куришь Шипку? За дверью бессмысленно всё, ' +
|
|
23
|
+
'особенно — возглас счастья. Только в уборную — и сразу же возвращайся.',
|
|
24
|
+
},
|
|
25
|
+
'Много строк текста': {
|
|
26
|
+
modelValue: `Люблю грозу в начале мая,
|
|
27
|
+
Когда весенний, первый гром,
|
|
28
|
+
как бы резвяся и играя,
|
|
29
|
+
Грохочет в небе голубом.
|
|
30
|
+
|
|
31
|
+
Гремят раскаты молодые,
|
|
32
|
+
Вот дождик брызнул, пыль летит,
|
|
33
|
+
Повисли перлы дождевые,
|
|
34
|
+
И солнце нити золотит.
|
|
35
|
+
|
|
36
|
+
С горы бежит поток проворный,
|
|
37
|
+
В лесу не молкнет птичий гам,
|
|
38
|
+
И гам лесной и шум нагорный -
|
|
39
|
+
Все вторит весело громам.`,
|
|
40
|
+
},
|
|
41
|
+
'Мобильная версия': {
|
|
42
|
+
modelValue: '',
|
|
43
|
+
title: 'Вы пишите сообщение для: Hello Kitty',
|
|
44
|
+
placeholder: 'Напишите что-нибудь...',
|
|
45
|
+
attachToKeyboard: true,
|
|
46
|
+
},
|
|
47
|
+
} satisfies Record<string, Props>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const variantProps = reactive(genVariantProps());
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<template v-for="(props, h2) in variantProps">
|
|
55
|
+
<h2>
|
|
56
|
+
{{ h2 }}
|
|
57
|
+
</h2>
|
|
58
|
+
<EditArea
|
|
59
|
+
:="{...$props, ...props}"
|
|
60
|
+
v-model="props.modelValue"
|
|
61
|
+
></EditArea>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<!-- TODO: добавить переменную top-forms-fixed-height и использовать ее при добавлении отступов у страницы -->
|
|
65
|
+
<br><br><br><br><br><br><br><br><br><br>
|
|
66
|
+
</template>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
|
|
3
|
+
import { genArgsTypes, genOverviewStory } from '@/components/helpersStories';
|
|
4
|
+
import Component from './editInput.vue';
|
|
5
|
+
import * as ComponentsConst from './editInput';
|
|
6
|
+
import OverviewComponent from './stories/overview.vue';
|
|
7
|
+
|
|
8
|
+
const argTypes = genArgsTypes(Component, ComponentsConst, true);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Поле ввода с кнопкой
|
|
12
|
+
*
|
|
13
|
+
* При вводе значения появляется кнопка подтверждения ввода
|
|
14
|
+
*
|
|
15
|
+
* При нажитии кнопки подвтерждения или **Enter** будет выполнено событие **update:modelValue**
|
|
16
|
+
*
|
|
17
|
+
* При нажатии **Escape** значение в поле будет возвращено к начальному значению
|
|
18
|
+
*/
|
|
19
|
+
const meta = {
|
|
20
|
+
component: Component,
|
|
21
|
+
tags: ['autodocs'],
|
|
22
|
+
argTypes,
|
|
23
|
+
args: {
|
|
24
|
+
modelValue: '',
|
|
25
|
+
},
|
|
26
|
+
} satisfies Meta<typeof Component>;
|
|
27
|
+
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
|
|
30
|
+
export const Playground = {} satisfies Story;
|
|
31
|
+
|
|
32
|
+
export const Overview: Story = genOverviewStory({
|
|
33
|
+
args: {},
|
|
34
|
+
}, OverviewComponent);
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Props as InputProps } from '@/components/forms/input/input';
|
|
2
|
+
import type { Props as ButtonProps } from '@/components/forms/button/button';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
modelValue: string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Любые props компонента Input, за исключением modelValue
|
|
9
|
+
*/
|
|
10
|
+
input?: Omit<InputProps, 'modelValue'>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Любые props компонента Button
|
|
14
|
+
*/
|
|
15
|
+
button?: ButtonProps;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Emits {
|
|
19
|
+
(e: 'update:modelValue', value: string): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, toRef, watch } from 'vue';
|
|
3
|
+
import type { Props, Emits } from './editInput';
|
|
4
|
+
import Input from '@/components/forms/input/input.vue';
|
|
5
|
+
import Button from '@/components/forms/button/button.vue';
|
|
6
|
+
|
|
7
|
+
const props = defineProps<Props>();
|
|
8
|
+
|
|
9
|
+
const intermediateValue = ref(props.modelValue);
|
|
10
|
+
|
|
11
|
+
watch(toRef(props.modelValue), () => {
|
|
12
|
+
intermediateValue.value = props.modelValue;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<Emits>();
|
|
16
|
+
|
|
17
|
+
const submit = () => {
|
|
18
|
+
emit('update:modelValue', intermediateValue.value);
|
|
19
|
+
};
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div class="top-editInput">
|
|
24
|
+
<Input
|
|
25
|
+
:="input"
|
|
26
|
+
@keydown.esc.capture.stop="intermediateValue = modelValue"
|
|
27
|
+
@keydown.enter.stop="submit"
|
|
28
|
+
v-model="intermediateValue"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<Button
|
|
32
|
+
v-if="intermediateValue !== modelValue"
|
|
33
|
+
icon=""
|
|
34
|
+
styling="soft"
|
|
35
|
+
:="button"
|
|
36
|
+
@click="submit"
|
|
37
|
+
>
|
|
38
|
+
<!-- @slot Слот Button -->
|
|
39
|
+
<slot></slot>
|
|
40
|
+
</Button>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<style module>
|
|
45
|
+
.top-editInput {
|
|
46
|
+
width: 220px;
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: flex-end;
|
|
50
|
+
gap: var(--top-gap-1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.top-editInput .top-input {
|
|
54
|
+
width: unset;
|
|
55
|
+
flex-grow: 1;
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { reactive } from 'vue';
|
|
3
|
+
import EditInput from '../editInput.vue';
|
|
4
|
+
import type { Props } from '../editInput';
|
|
5
|
+
|
|
6
|
+
defineProps<Props>();
|
|
7
|
+
|
|
8
|
+
const modelValues = reactive({
|
|
9
|
+
0: '',
|
|
10
|
+
1: '',
|
|
11
|
+
2: '',
|
|
12
|
+
3: '',
|
|
13
|
+
});
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<h2>Смена значка</h2>
|
|
18
|
+
|
|
19
|
+
<EditInput
|
|
20
|
+
v-model="modelValues[0]"
|
|
21
|
+
:input="{}"
|
|
22
|
+
:button="{
|
|
23
|
+
icon: ''
|
|
24
|
+
}"
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
<h2>С подписью</h2>
|
|
28
|
+
|
|
29
|
+
<EditInput
|
|
30
|
+
v-model="modelValues[1]"
|
|
31
|
+
:input="{
|
|
32
|
+
title: 'Заголовок поля',
|
|
33
|
+
captionType: 'slide',
|
|
34
|
+
}"
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
<h2>С другой кнопкой</h2>
|
|
38
|
+
|
|
39
|
+
<EditInput
|
|
40
|
+
v-model="modelValues[2]"
|
|
41
|
+
:button="{
|
|
42
|
+
styling: '',
|
|
43
|
+
}"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<h2>С кнопкой очистки</h2>
|
|
47
|
+
|
|
48
|
+
<EditInput
|
|
49
|
+
v-model="modelValues[3]"
|
|
50
|
+
:input="{
|
|
51
|
+
addCleaner: true,
|
|
52
|
+
}"
|
|
53
|
+
/>
|
|
54
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
|
|
3
|
+
import { genArgsTypes, genOverviewStory } from '@/components/helpersStories';
|
|
4
|
+
import Component from './radioGroup.vue';
|
|
5
|
+
import * as ComponentsConst from './radioGroup';
|
|
6
|
+
import OverviewComponent from './stories/overview.vue';
|
|
7
|
+
|
|
8
|
+
const argTypes = genArgsTypes(Component, ComponentsConst);
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
component: Component,
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes,
|
|
14
|
+
args: {
|
|
15
|
+
modelValue: '',
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof Component>;
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Playground = {
|
|
22
|
+
args: {
|
|
23
|
+
radiosProps: [
|
|
24
|
+
{
|
|
25
|
+
value: '0',
|
|
26
|
+
title: 'ПК',
|
|
27
|
+
icon: '',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: '1',
|
|
31
|
+
title: 'Планшет',
|
|
32
|
+
icon: '',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: '2',
|
|
36
|
+
title: 'Смартфон',
|
|
37
|
+
icon: '',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
} satisfies Story;
|
|
42
|
+
|
|
43
|
+
export const Overview: Story = genOverviewStory({
|
|
44
|
+
args: {
|
|
45
|
+
size: 's',
|
|
46
|
+
showIndicator: false,
|
|
47
|
+
isError: false,
|
|
48
|
+
},
|
|
49
|
+
}, OverviewComponent);
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Size } from '@/components/forms/helpers';
|
|
2
|
+
import { sizes } from '@/components/forms/helpers';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
modelValue: string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Массив props для вставки radioGroupItem
|
|
9
|
+
*/
|
|
10
|
+
radiosProps?: ItemProps[];
|
|
11
|
+
|
|
12
|
+
showIndicator?: boolean;
|
|
13
|
+
size?: Size;
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Emits {
|
|
18
|
+
(e: 'update:modelValue', value: Props['modelValue']): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ItemProps {
|
|
22
|
+
value: Props['modelValue'];
|
|
23
|
+
title: string;
|
|
24
|
+
icon?: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { sizes };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { Props, Emits } from './radioGroup';
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
6
|
+
size: 's',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits<Emits>();
|
|
10
|
+
|
|
11
|
+
const localValue = computed({
|
|
12
|
+
get() {
|
|
13
|
+
return props.modelValue;
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
set(value) {
|
|
17
|
+
emit('update:modelValue', value);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div
|
|
25
|
+
:class="{
|
|
26
|
+
['top-radioGroup']: true,
|
|
27
|
+
['top-scrollBarXHidding']: true,
|
|
28
|
+
['top-size_' + size]: !!size,
|
|
29
|
+
['top-error']: isError,
|
|
30
|
+
}"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
v-for="item of radiosProps"
|
|
34
|
+
:class="{
|
|
35
|
+
['top-radioGroup_item-selected']: item.value === localValue,
|
|
36
|
+
['top-radioGroup_item']: true,
|
|
37
|
+
['top-disabled']: item.disabled,
|
|
38
|
+
}"
|
|
39
|
+
:data-top-icon="item.icon"
|
|
40
|
+
@click="localValue = item.value"
|
|
41
|
+
>
|
|
42
|
+
{{ item.title }}
|
|
43
|
+
|
|
44
|
+
<span
|
|
45
|
+
v-if="showIndicator"
|
|
46
|
+
class="top-radioGroup_circle"
|
|
47
|
+
></span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style module>
|
|
53
|
+
@import "./styles/top-scrollBar.css";
|
|
54
|
+
|
|
55
|
+
.top-radioGroup {
|
|
56
|
+
user-select: none;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
border-radius: 8px;
|
|
59
|
+
background-color: var(--color-theme-50);
|
|
60
|
+
height: var(--top-forms-base-height);
|
|
61
|
+
padding: 2px;
|
|
62
|
+
gap: 2px;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: flex-start;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.top-radioGroup_item {
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
border-radius: 6px;
|
|
71
|
+
height: calc(var(--top-forms-base-height) - 4px);
|
|
72
|
+
padding: 0 16px;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
flex-grow: 1;
|
|
78
|
+
gap: 4px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.top-radioGroup_item:hover {
|
|
82
|
+
background-color: var(--color-theme-25);
|
|
83
|
+
box-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* selected */
|
|
87
|
+
.top-radioGroup_item-selected {
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
background-color: var(--color-bg-3);
|
|
90
|
+
box-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* circle */
|
|
94
|
+
.top-radioGroup_circle {
|
|
95
|
+
padding: 3px;
|
|
96
|
+
margin-left: auto;
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.top-radioGroup_circle:before {
|
|
101
|
+
content: "";
|
|
102
|
+
border: 1px solid var(--color-line-3-opacity);
|
|
103
|
+
border-radius: 50%;
|
|
104
|
+
box-sizing: border-box;
|
|
105
|
+
width: calc(var(--top-forms-option-height) - 3px * 2);
|
|
106
|
+
height: calc(var(--top-forms-option-height) - 3px * 2);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.top-radioGroup_item:hover .top-radioGroup_circle:before {
|
|
110
|
+
border-color: var(--color-primary);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* circle selected */
|
|
114
|
+
.top-radioGroup_item-selected .top-radioGroup_circle:before {
|
|
115
|
+
border-color: var(--color-primary);
|
|
116
|
+
border-width: 5px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.top-radioGroup_item-selected:hover .top-radioGroup_circle:before {
|
|
120
|
+
border-color: var(--color-primary-2);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* top-disabled */
|
|
124
|
+
.top-radioGroup_item.top-disabled {
|
|
125
|
+
--top-icon-color: var(--color-text-3);
|
|
126
|
+
|
|
127
|
+
color: var(--color-text-3);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.top-radioGroup_item.top-disabled .top-radioGroup_circle:before {
|
|
131
|
+
border-color: var(--color-theme-400);
|
|
132
|
+
background-color: var(--color-theme-50);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* top-error */
|
|
136
|
+
.top-radioGroup.top-error .top-radioGroup_item:not(.top-disabled) .top-radioGroup_circle:before {
|
|
137
|
+
border-color: var(--color-negative);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.top-radioGroup.top-error .top-radioGroup_item:hover .top-radioGroup_circle:before {
|
|
141
|
+
border-color: var(--color-negative-2);
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import type { Props } from '../radioGroup';
|
|
4
|
+
import RadioGroup from '../radioGroup.vue';
|
|
5
|
+
|
|
6
|
+
defineProps<Props>();
|
|
7
|
+
|
|
8
|
+
const modelValue1 = ref('1');
|
|
9
|
+
const modelValue2 = ref('3');
|
|
10
|
+
|
|
11
|
+
const radiosProps1 = [
|
|
12
|
+
{
|
|
13
|
+
value: '0',
|
|
14
|
+
title: 'ПК',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: '1',
|
|
18
|
+
title: 'Планшет',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: '2',
|
|
22
|
+
title: 'Смартфон',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: '3',
|
|
26
|
+
title: 'Книга',
|
|
27
|
+
disabled: true,
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const radiosProps2 = [
|
|
32
|
+
{
|
|
33
|
+
value: '0',
|
|
34
|
+
title: 'ПК',
|
|
35
|
+
icon: '',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: '1',
|
|
39
|
+
title: 'Планшет',
|
|
40
|
+
icon: '',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: '2',
|
|
44
|
+
title: 'Смартфон',
|
|
45
|
+
icon: '',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: '3',
|
|
49
|
+
title: 'Книга',
|
|
50
|
+
icon: '',
|
|
51
|
+
disabled: true,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<div>
|
|
58
|
+
<h2>Стандартный вид</h2>
|
|
59
|
+
|
|
60
|
+
<RadioGroup
|
|
61
|
+
:="$props"
|
|
62
|
+
v-model="modelValue1"
|
|
63
|
+
:radiosProps="radiosProps1"
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<p><b>Ваш выбор:</b> {{ modelValue1 }}</p>
|
|
67
|
+
|
|
68
|
+
<h2>Со значками</h2>
|
|
69
|
+
|
|
70
|
+
<RadioGroup
|
|
71
|
+
:="$props"
|
|
72
|
+
v-model="modelValue2"
|
|
73
|
+
:radiosProps="radiosProps2"
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<p><b>Ваш выбор:</b> {{ modelValue2 }}</p>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* Стили для горизонтального скроллбара top-scrollBarXHidding*/
|
|
2
|
+
/* top-scrollBarXHidding - добавляет скроллбар, если он нужен. Скроллбар появится при hover */
|
|
3
|
+
/* чтобы эффект работал, родитель должен иметь фиксированную высоту */
|
|
4
|
+
.top-scrollBarXHidding {
|
|
5
|
+
scrollbar-width: none;
|
|
6
|
+
overflow-x: auto;
|
|
7
|
+
overflow-y: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.top-scrollBarXHidding:hover {
|
|
11
|
+
scrollbar-width: thin;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.top-scrollBarXHidding::-webkit-scrollbar {
|
|
15
|
+
height: 6px;
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.top-scrollBarXHidding:hover::-webkit-scrollbar {
|
|
20
|
+
display: block;
|
|
21
|
+
scrollbar-width: thin;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.top-scrollBarXHidding::-webkit-scrollbar-track {
|
|
25
|
+
background-color: transparent;
|
|
26
|
+
box-shadow: inset rgba(0, 0, 0, 0.06) 0 0 0 10px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.top-scrollBarXHidding::-webkit-scrollbar-track:hover {
|
|
30
|
+
box-shadow: inset rgba(0, 0, 0, 0.08) 0 0 0 10px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.top-scrollBarXHidding::-webkit-scrollbar-track:active {
|
|
34
|
+
box-shadow: inset rgba(0, 0, 0, 0.1) 0 0 0 10px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.top-scrollBarXHidding::-webkit-scrollbar-thumb {
|
|
38
|
+
background-color: var(--color-line-1-opacity);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.top-scrollBarXHidding::-webkit-scrollbar-thumb:hover {
|
|
42
|
+
background-color: var(--color-line-2-opacity);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.top-scrollBarXHidding::-webkit-scrollbar-thumb:active {
|
|
46
|
+
background-color: var(--color-line-3-opacity);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.top-scrollBarXHidding::-webkit-scrollbar-button {
|
|
50
|
+
width: 0;
|
|
51
|
+
height: 0;
|
|
52
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const REGEXP_START_SYMBOL_ICON = new RegExp('^[^a-zа-я0-9_%#!?.:\'"«»[\\](){} \\r\\n\\t<>&/+-]', 'i');
|
|
2
|
+
|
|
3
|
+
export const extractIconAndContent = content => {
|
|
4
|
+
const iconExists = content?.[0]?.match(REGEXP_START_SYMBOL_ICON);
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
icon: iconExists ? content[0] : null,
|
|
8
|
+
content: iconExists ? content.substring(1) : content,
|
|
9
|
+
};
|
|
10
|
+
};
|