@velumweb/ui-kit 1.0.0 → 1.0.2
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/changelog.md +11 -0
- package/{docs → dist/components}/Button/Button.d.ts +32 -32
- package/dist/{Button → components/Button}/Button.stories.d.ts +15 -15
- package/dist/{Button → components/Button}/index.d.ts +1 -1
- package/dist/{Container → components/Container}/Box.d.ts +33 -33
- package/{docs → dist/components}/Container/index.d.ts +1 -1
- package/dist/{Input → components/Input}/Input.d.ts +38 -38
- package/{docs → dist/components}/Input/Input.stories.d.ts +14 -14
- package/{docs → dist/components}/Input/index.d.ts +1 -1
- package/{docs → dist/components}/Modal/Modal.d.ts +29 -29
- package/{docs → dist/components}/Modal/Modal.stories.d.ts +13 -13
- package/{docs → dist/components}/Modal/index.d.ts +1 -1
- package/dist/{Toggle → components/Toggle}/Toggle.d.ts +18 -18
- package/dist/{Toggle → components/Toggle}/Toggle.stories.d.ts +13 -13
- package/dist/{Toggle → components/Toggle}/index.d.ts +1 -1
- package/{docs → dist/components}/index.d.ts +6 -5
- package/dist/index.d.ts +2 -5
- package/dist/index.es.js +583 -569
- package/dist/index.es2.js +1 -0
- package/dist/theme.d.ts +2 -0
- package/dist/ui-kit.css +1 -1
- package/package.json +17 -3
- package/readme.md +19 -2
- package/.storybook/main.ts +0 -14
- package/.storybook/manager.ts +0 -32
- package/.storybook/preview.ts +0 -14
- package/dist/Button/Button.d.ts +0 -32
- package/dist/Container/index.d.ts +0 -1
- package/dist/Input/Input.stories.d.ts +0 -14
- package/dist/Input/index.d.ts +0 -1
- package/dist/Modal/Modal.d.ts +0 -29
- package/dist/Modal/Modal.stories.d.ts +0 -13
- package/dist/Modal/index.d.ts +0 -1
- package/dist/index.es.d.ts +0 -2
- package/dist/index.umd.js +0 -6
- package/docs/Button/Button.stories.d.ts +0 -15
- package/docs/Button/index.d.ts +0 -1
- package/docs/CNAME +0 -1
- package/docs/Container/Box.d.ts +0 -33
- package/docs/Input/Input.d.ts +0 -38
- package/docs/Toggle/Toggle.d.ts +0 -18
- package/docs/Toggle/Toggle.stories.d.ts +0 -13
- package/docs/Toggle/index.d.ts +0 -1
- package/docs/assets/Button-CfaZpHIg.css +0 -1
- package/docs/assets/Button-DBH2W8EG.js +0 -1
- package/docs/assets/Button.stories-uPwy2cWr.js +0 -34
- package/docs/assets/Input-D117xj27.js +0 -1
- package/docs/assets/Input-RjFZkyU_.css +0 -1
- package/docs/assets/Input.stories-Ck4AyV-4.js +0 -21
- package/docs/assets/Modal-CWKTs3Ep.css +0 -1
- package/docs/assets/Modal.stories-3HMpRqSx.js +0 -7
- package/docs/assets/Toggle-BmcBtVup.css +0 -1
- package/docs/assets/Toggle-DiHagfS3.js +0 -1
- package/docs/assets/Toggle.stories-d01loxLD.js +0 -9
- package/docs/assets/iframe-D7bwIom8.js +0 -1062
- package/docs/assets/jsx-runtime-u17CrQMm.js +0 -1
- package/docs/assets/preload-helper-PPVm8Dsz.js +0 -1
- package/docs/assets/react-18-CW3OMC0n.js +0 -9
- package/docs/assets/svg-lib/3-dots-horizontal-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/about-empty-page-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/alert-square.svg +0 -26
- package/docs/assets/svg-lib/arrow-bottom-svgrepo-com.svg +0 -9
- package/docs/assets/svg-lib/arrow-left-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/arrow-right-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/arrow-top-svgrepo-com.svg +0 -9
- package/docs/assets/svg-lib/checkmark-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/clock-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/cross-svgrepo-com.svg +0 -12
- package/docs/assets/svg-lib/download-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/edit-pen-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/favorite-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/forbiden-svgrepo-com.svg +0 -9
- package/docs/assets/svg-lib/input-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/link-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/messages-alert-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/messages-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/mic-off-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/mic-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/music-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/next-long-arrow-right-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/notification-alert-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/notification-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/notifications-off-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/party-simple-colored-svgrepo-com.svg +0 -11
- package/docs/assets/svg-lib/pattern-circles-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/play-button-simple-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/plus-outlined-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/previous-long-arrow-left-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/queue-listing-cards-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/queue-remove-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/recent-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/remove-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/repeat-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/schedule-add-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/schedule-alert-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/schedule-remove-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/schedule-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/search-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/session-abandon-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/session-join-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/session-leave-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/settings-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/share-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/sound-off-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/sound-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/spectacles-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/star-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/user-avatar-with-alert-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/user-banned-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/user-svgrepo-com.svg +0 -5
- package/docs/assets/svglist.png +0 -0
- package/docs/favicon-wrapper.svg +0 -46
- package/docs/favicon.svg +0 -1
- package/docs/iframe.html +0 -686
- package/docs/index.html +0 -137
- package/docs/index.json +0 -1
- package/docs/makeColors.ts +0 -37
- package/docs/notes.txt +0 -11
- package/docs/nunito-sans-bold-italic.woff2 +0 -0
- package/docs/nunito-sans-bold.woff2 +0 -0
- package/docs/nunito-sans-italic.woff2 +0 -0
- package/docs/nunito-sans-regular.woff2 +0 -0
- package/docs/project.json +0 -1
- package/docs/sb-addons/storybook-1/manager-bundle.js +0 -3
- package/docs/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -628
- package/docs/sb-common-assets/favicon-wrapper.svg +0 -46
- package/docs/sb-common-assets/favicon.svg +0 -1
- package/docs/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/docs/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/docs/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/docs/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/docs/sb-manager/globals-runtime.js +0 -75597
- package/docs/sb-manager/globals.js +0 -24
- package/docs/sb-manager/manager-stores.js +0 -23
- package/docs/sb-manager/runtime.js +0 -19698
- package/docs/style_setter.js +0 -19
- package/docs/vite-inject-mocker-entry.js +0 -2
- package/index.html +0 -7
- package/public/assets/svg-lib/3-dots-horizontal-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/about-empty-page-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/alert-square.svg +0 -26
- package/public/assets/svg-lib/arrow-bottom-svgrepo-com.svg +0 -9
- package/public/assets/svg-lib/arrow-left-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/arrow-right-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/arrow-top-svgrepo-com.svg +0 -9
- package/public/assets/svg-lib/checkmark-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/clock-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/cross-svgrepo-com.svg +0 -12
- package/public/assets/svg-lib/download-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/edit-pen-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/favorite-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/forbiden-svgrepo-com.svg +0 -9
- package/public/assets/svg-lib/input-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/link-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/messages-alert-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/messages-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/mic-off-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/mic-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/music-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/next-long-arrow-right-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/notification-alert-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/notification-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/notifications-off-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/party-simple-colored-svgrepo-com.svg +0 -11
- package/public/assets/svg-lib/pattern-circles-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/play-button-simple-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/plus-outlined-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/previous-long-arrow-left-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/queue-listing-cards-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/queue-remove-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/recent-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/remove-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/repeat-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/schedule-add-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/schedule-alert-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/schedule-remove-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/schedule-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/search-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/session-abandon-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/session-join-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/session-leave-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/settings-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/share-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/sound-off-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/sound-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/spectacles-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/star-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/user-avatar-with-alert-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/user-banned-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/user-svgrepo-com.svg +0 -5
- package/public/assets/svglist.png +0 -0
- package/src/components/Button/Button.stories.ts +0 -64
- package/src/components/Button/Button.tsx +0 -99
- package/src/components/Button/button.scss +0 -147
- package/src/components/Button/index.ts +0 -1
- package/src/components/Container/Box.tsx +0 -83
- package/src/components/Container/box.scss +0 -41
- package/src/components/Container/index.ts +0 -1
- package/src/components/Input/Input.stories.ts +0 -49
- package/src/components/Input/Input.tsx +0 -172
- package/src/components/Input/index.ts +0 -1
- package/src/components/Input/input.scss +0 -69
- package/src/components/Modal/Modal.stories.ts +0 -33
- package/src/components/Modal/Modal.tsx +0 -125
- package/src/components/Modal/index.ts +0 -1
- package/src/components/Modal/modal.scss +0 -54
- package/src/components/Toggle/Toggle.stories.ts +0 -35
- package/src/components/Toggle/Toggle.tsx +0 -60
- package/src/components/Toggle/index.ts +0 -1
- package/src/components/Toggle/toggle.scss +0 -97
- package/src/components/index.ts +0 -5
- package/src/main.scss +0 -46
- package/tsconfig.json +0 -15
- package/utils/makeColors.ts +0 -37
- package/utils/notes.txt +0 -11
- package/utils/style_setter.js +0 -19
- package/vite.config.ts +0 -32
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
@import '../../main.scss';
|
|
2
|
-
|
|
3
|
-
.kit-input--container {
|
|
4
|
-
display: flex;
|
|
5
|
-
line-height: 30px;
|
|
6
|
-
align-items: center;
|
|
7
|
-
position: relative;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.kit-input {
|
|
11
|
-
width: 100%;
|
|
12
|
-
height: 36px;
|
|
13
|
-
line-height: 30px;
|
|
14
|
-
padding: 0 .6rem;
|
|
15
|
-
border: 1px solid var(--primary-btn-color);
|
|
16
|
-
outline: none;
|
|
17
|
-
background-color: #efefef;
|
|
18
|
-
color: var(--text-color);
|
|
19
|
-
transition: .3s ease;
|
|
20
|
-
&.kit-input--disabled {
|
|
21
|
-
opacity: 0.5;
|
|
22
|
-
pointer-events: none;
|
|
23
|
-
user-select: none;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
.kit-input--error {
|
|
27
|
-
border: 1px solid var(--error-color);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.kit-input--standard {
|
|
31
|
-
border-radius: var(--corners-standard);
|
|
32
|
-
}
|
|
33
|
-
.kit-input--round {
|
|
34
|
-
border-radius: var(--corners-round);
|
|
35
|
-
}
|
|
36
|
-
.kit-input--square {
|
|
37
|
-
border-radius: var(--corners-square);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.kit-input-secondary-text {
|
|
41
|
-
font-size: 12px;
|
|
42
|
-
line-height: 24px;
|
|
43
|
-
margin-left: .8rem;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.kit-input::placeholder, .kit-input-bottomtext {
|
|
47
|
-
color: var(--text-color-secondary);
|
|
48
|
-
}
|
|
49
|
-
.kit-input-errortext {
|
|
50
|
-
color: var(--error-color);
|
|
51
|
-
}
|
|
52
|
-
.kit-input--label {
|
|
53
|
-
color: var(--text-color);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.kit-input:focus, .kit-input:hover {
|
|
57
|
-
outline: none;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.kit-input--icon-container {
|
|
61
|
-
position: absolute;
|
|
62
|
-
right: .4rem;
|
|
63
|
-
fill: none;
|
|
64
|
-
display: flex;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.kit-input--icon {
|
|
68
|
-
padding: 4px;
|
|
69
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Modal } from './Modal';
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Modal',
|
|
6
|
-
component: Modal,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered'
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story) => {
|
|
13
|
-
const script = document.createElement('script')
|
|
14
|
-
script.src = '/style_setter.js'
|
|
15
|
-
script.type = 'module'
|
|
16
|
-
document.head.appendChild(script)
|
|
17
|
-
|
|
18
|
-
return Story()
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
type Story = StoryObj<typeof meta>;
|
|
25
|
-
|
|
26
|
-
export const ModalWindow: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
width: 400,
|
|
29
|
-
isOpen: true,
|
|
30
|
-
children: 'This is modal window! You can close it.'
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { Box, Button } from "../index";
|
|
3
|
-
import './modal.scss';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Компонент модальное окно
|
|
7
|
-
* - размеры
|
|
8
|
-
* - углы
|
|
9
|
-
* - тип непрозрачности фона
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export interface ModalProps {
|
|
14
|
-
/** Ширина */
|
|
15
|
-
width?: number | 'auto';
|
|
16
|
-
|
|
17
|
-
/** Углы прямые / Закругленные / Круглые */
|
|
18
|
-
corners?: 'square' | 'standard' | 'round';
|
|
19
|
-
|
|
20
|
-
/** Тип непрозрачности фона */
|
|
21
|
-
background?: 'blackout' | 'blur';
|
|
22
|
-
|
|
23
|
-
/** Содержимое контейнера **/
|
|
24
|
-
children: ReactNode | string;
|
|
25
|
-
|
|
26
|
-
/** Дополнительные классы */
|
|
27
|
-
cls?: string;
|
|
28
|
-
|
|
29
|
-
/** Операции при закрытии */
|
|
30
|
-
onClose: () => void;
|
|
31
|
-
|
|
32
|
-
/** Окно открыто */
|
|
33
|
-
isOpen?: boolean;
|
|
34
|
-
|
|
35
|
-
/** Title */
|
|
36
|
-
title?: string; // TODO
|
|
37
|
-
|
|
38
|
-
/** Кнопка закрытия в углу */
|
|
39
|
-
closeButton?: boolean;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Элемент модалки */
|
|
43
|
-
export const Modal = ({
|
|
44
|
-
width = 'auto',
|
|
45
|
-
corners = 'standard',
|
|
46
|
-
background = 'blackout',
|
|
47
|
-
isOpen = false,
|
|
48
|
-
closeButton = true,
|
|
49
|
-
title = '',
|
|
50
|
-
cls = '',
|
|
51
|
-
children,
|
|
52
|
-
onClose,
|
|
53
|
-
...props
|
|
54
|
-
}: ModalProps) => {
|
|
55
|
-
const overlayRef = useRef<HTMLDivElement | null>(null);
|
|
56
|
-
const [showModal, setShowModal] = useState(isOpen);
|
|
57
|
-
|
|
58
|
-
function handleClose(): void {
|
|
59
|
-
setShowModal(false);
|
|
60
|
-
onClose && onClose();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** только для демонстрации в userbook */
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
setShowModal(isOpen);
|
|
66
|
-
}, [isOpen]);
|
|
67
|
-
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (!showModal) return;
|
|
70
|
-
|
|
71
|
-
function handleKeyDown(e) {
|
|
72
|
-
if (e.key === 'Escape') handleClose();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// закрытие по Esc
|
|
76
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
77
|
-
|
|
78
|
-
// блокировка скролла фона
|
|
79
|
-
const original = document.body.style.overflow;
|
|
80
|
-
document.body.style.overflow = 'hidden';
|
|
81
|
-
|
|
82
|
-
return () => {
|
|
83
|
-
document.body.style.overflow = original;
|
|
84
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
85
|
-
}
|
|
86
|
-
}, [showModal, handleClose]);
|
|
87
|
-
|
|
88
|
-
return(
|
|
89
|
-
<>
|
|
90
|
-
{showModal ? <div
|
|
91
|
-
className='kit-modal--overlay'
|
|
92
|
-
onClick={(e) => {
|
|
93
|
-
if (e.target === overlayRef.current) handleClose()
|
|
94
|
-
}}
|
|
95
|
-
ref={overlayRef}
|
|
96
|
-
>
|
|
97
|
-
<div
|
|
98
|
-
className={[
|
|
99
|
-
'kit-modal',
|
|
100
|
-
`kit-modal--${corners}`,
|
|
101
|
-
`kit-modal--bg-${background}`,
|
|
102
|
-
cls
|
|
103
|
-
].join(' ')}
|
|
104
|
-
style={{width: !isNaN(width as number) ? `${width}px` : 'fit-content'}}
|
|
105
|
-
{...props}>
|
|
106
|
-
<Box padding={[8, 16]} direction='column'>
|
|
107
|
-
<Box justify='end' margin={[0, -16]}>
|
|
108
|
-
<Button
|
|
109
|
-
type='transparent'
|
|
110
|
-
size='large'
|
|
111
|
-
onClick={handleClose}
|
|
112
|
-
iconPath='svg-lib/cross-svgrepo-com.svg'
|
|
113
|
-
cls='kit-modal-close'
|
|
114
|
-
/>
|
|
115
|
-
</Box>
|
|
116
|
-
<Box justify='start'>
|
|
117
|
-
{children}
|
|
118
|
-
</Box>
|
|
119
|
-
{ /** (необязательные) кнопки управления окном */}
|
|
120
|
-
</Box>
|
|
121
|
-
</div>
|
|
122
|
-
</div> : <></>}
|
|
123
|
-
</>
|
|
124
|
-
)
|
|
125
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Modal'
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
@import '../../main.scss';
|
|
2
|
-
|
|
3
|
-
.kit-modal--overlay {
|
|
4
|
-
position: fixed;
|
|
5
|
-
top: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
inset: 0;
|
|
8
|
-
width: 100%;
|
|
9
|
-
height: 100%;
|
|
10
|
-
background: rgba(0,0,0,0.8);
|
|
11
|
-
z-index: 9999;
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
animation: fadeInOverlay 0.2s ease-out;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.kit-modal {
|
|
19
|
-
background-color: var(--bg-color);
|
|
20
|
-
position: relative;
|
|
21
|
-
max-width: 420px; // TODO убрать?
|
|
22
|
-
width: 100%; // TODO убрать?
|
|
23
|
-
min-height: 200px;
|
|
24
|
-
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
|
|
25
|
-
animation: fadeInModal 0.2s ease-out;
|
|
26
|
-
& > div {
|
|
27
|
-
width: auto;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.kit-modal-close {
|
|
32
|
-
margin: -4px -16px 0 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// border-radius
|
|
36
|
-
.kit-modal--standard {
|
|
37
|
-
border-radius: var(--corners-standard);
|
|
38
|
-
}
|
|
39
|
-
.kit-modal--round {
|
|
40
|
-
border-radius: var(--corners-round);
|
|
41
|
-
}
|
|
42
|
-
.kit-modal--square {
|
|
43
|
-
border-radius: var(--corners-square);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// animations
|
|
47
|
-
@keyframes fadeInOverlay {
|
|
48
|
-
from { opacity: 0; }
|
|
49
|
-
to { opacity: 1; }
|
|
50
|
-
}
|
|
51
|
-
@keyframes fadeInModal {
|
|
52
|
-
from { opacity: 0; transform: scale(0.95); }
|
|
53
|
-
to { opacity: 1; transform: scale(1); }
|
|
54
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Toggle } from './Toggle';
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Example Toggle',
|
|
6
|
-
component: Toggle,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered'
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story) => {
|
|
13
|
-
const script = document.createElement('script')
|
|
14
|
-
script.src = '/style_setter.js'
|
|
15
|
-
script.type = 'module'
|
|
16
|
-
document.head.appendChild(script)
|
|
17
|
-
|
|
18
|
-
return Story()
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
type Story = StoryObj<typeof meta>;
|
|
25
|
-
|
|
26
|
-
export const CustomToggle: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
text: 'subscribe',
|
|
29
|
-
size: 'medium',
|
|
30
|
-
disabled: false,
|
|
31
|
-
cls: '',
|
|
32
|
-
onClick: () => console.log('CustomToggle')
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React, { useId } from 'react';
|
|
2
|
-
import './toggle.scss';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Компонент переключателя
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface ToggleProps {
|
|
9
|
-
/** Маленькая / Средняя / Большая */
|
|
10
|
-
size?: 'small' | 'medium' | 'large';
|
|
11
|
-
|
|
12
|
-
/** Доступность переключателя */
|
|
13
|
-
disabled?: boolean,
|
|
14
|
-
|
|
15
|
-
/** Текст переключателя */
|
|
16
|
-
text?: string;
|
|
17
|
-
|
|
18
|
-
/** Событие при нажатии */
|
|
19
|
-
onClick?: (e?: MouseEvent) => void;
|
|
20
|
-
|
|
21
|
-
/** Дополнительные классы */
|
|
22
|
-
cls?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Элемент кнопки */
|
|
26
|
-
export const Toggle: React.FC<ToggleProps> = ({
|
|
27
|
-
size = 'medium',
|
|
28
|
-
disabled = false,
|
|
29
|
-
cls = '',
|
|
30
|
-
text = '',
|
|
31
|
-
onClick,
|
|
32
|
-
...props
|
|
33
|
-
}) => {
|
|
34
|
-
const toggleId = useId();
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<label
|
|
38
|
-
htmlFor={toggleId}
|
|
39
|
-
className={[
|
|
40
|
-
'kit-toggle',
|
|
41
|
-
disabled ? 'kit-toggle--disabled' : '',
|
|
42
|
-
`kit-toggle--${size}`,
|
|
43
|
-
cls
|
|
44
|
-
].join(' ')}
|
|
45
|
-
>
|
|
46
|
-
<input
|
|
47
|
-
id={toggleId}
|
|
48
|
-
type="checkbox"
|
|
49
|
-
className="kit-toggle--input"
|
|
50
|
-
disabled={disabled}
|
|
51
|
-
defaultChecked={false}
|
|
52
|
-
onChange={(e) => onClick?.(e.target.checked)}
|
|
53
|
-
/>
|
|
54
|
-
|
|
55
|
-
<span className="kit-toggle--slider" aria-hidden="true" />
|
|
56
|
-
|
|
57
|
-
{text && <span className="kit-toggle--label">{text}</span>}
|
|
58
|
-
</label>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Toggle";
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
@import '../../main.scss';
|
|
2
|
-
|
|
3
|
-
.kit-toggle {
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
gap: 12px;
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
user-select: none;
|
|
9
|
-
font-family: system-ui, sans-serif;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.kit-toggle--input {
|
|
13
|
-
position: absolute;
|
|
14
|
-
opacity: 0;
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.kit-toggle--slider {
|
|
19
|
-
position: relative;
|
|
20
|
-
border-radius: 999px;
|
|
21
|
-
transition: background 0.25s ease;
|
|
22
|
-
background: #d1d5db;
|
|
23
|
-
}
|
|
24
|
-
.kit-toggle--slider::before {
|
|
25
|
-
content: "";
|
|
26
|
-
position: absolute;
|
|
27
|
-
top: 3px;
|
|
28
|
-
left: 3px;
|
|
29
|
-
border-radius: 50%;
|
|
30
|
-
transition: transform 0.25s ease, box-shadow 0.25s ease;
|
|
31
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
|
32
|
-
background: white;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.kit-toggle--input:checked + .kit-toggle--slider {
|
|
36
|
-
background: var(--primary-btn-color);
|
|
37
|
-
}
|
|
38
|
-
.kit-toggle--input:checked + .kit-toggle--slider::before {
|
|
39
|
-
transform: translateX(20px);
|
|
40
|
-
}
|
|
41
|
-
.kit-toggle--input:focus-visible + .kit-toggle--slider {
|
|
42
|
-
outline: 2px solid var(--primary-btn-color);
|
|
43
|
-
outline-offset: 2px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.kit-toggle--disabled {
|
|
47
|
-
opacity: 0.5;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
user-select: none;
|
|
50
|
-
}
|
|
51
|
-
.kit-toggle--disabled .kit-toggle--slider {
|
|
52
|
-
background: #9ca3af;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.kit-toggle--label {
|
|
56
|
-
color: var(--text-color);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.kit-toggle--small {
|
|
60
|
-
& > .kit-toggle--slider {
|
|
61
|
-
width: 38px;
|
|
62
|
-
height: 18px;
|
|
63
|
-
&::before {
|
|
64
|
-
width: 12px;
|
|
65
|
-
height: 12px;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
& > .kit-toggle--label {
|
|
69
|
-
font-size: 14px;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
.kit-toggle--medium {
|
|
73
|
-
& > .kit-toggle--slider {
|
|
74
|
-
width: 42px;
|
|
75
|
-
height: 22px;
|
|
76
|
-
&::before {
|
|
77
|
-
width: 16px;
|
|
78
|
-
height: 16px;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
& > .kit-toggle--label {
|
|
82
|
-
font-size: 16px;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
.kit-toggle--large {
|
|
86
|
-
& > .kit-toggle--slider {
|
|
87
|
-
width: 46px;
|
|
88
|
-
height: 26px;
|
|
89
|
-
&::before {
|
|
90
|
-
width: 20px;
|
|
91
|
-
height: 20px;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
& > .kit-toggle--label {
|
|
95
|
-
font-size: 18px;
|
|
96
|
-
}
|
|
97
|
-
}
|
package/src/components/index.ts
DELETED
package/src/main.scss
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
/** текст */
|
|
3
|
-
--font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
4
|
-
--text-color: #2e3242;
|
|
5
|
-
--text-color-secondary: #94a3b8;
|
|
6
|
-
|
|
7
|
-
--error-color: #ef4949;
|
|
8
|
-
|
|
9
|
-
/** основной фон */
|
|
10
|
-
--bg-color: #fff;
|
|
11
|
-
|
|
12
|
-
/** кнопки */
|
|
13
|
-
--primary-btn-color: #7C3AED;
|
|
14
|
-
--secondary-btn-color: #FFFFFF;
|
|
15
|
-
--hover-btn-color: #6D28D9;
|
|
16
|
-
|
|
17
|
-
/** углы элементов */
|
|
18
|
-
--corners-standard: 0.65em;
|
|
19
|
-
--corners-round: 3em;
|
|
20
|
-
--corners-square: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
*,
|
|
24
|
-
*::before,
|
|
25
|
-
*::after {
|
|
26
|
-
margin: 0;
|
|
27
|
-
padding: 0;
|
|
28
|
-
box-sizing: border-box;
|
|
29
|
-
font-family: var(--font-family);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
input::-webkit-outer-spin-button,
|
|
33
|
-
input::-webkit-inner-spin-button {
|
|
34
|
-
-webkit-appearance: none;
|
|
35
|
-
margin: 0;
|
|
36
|
-
}
|
|
37
|
-
input[type="number"] {
|
|
38
|
-
-moz-appearance: textfield;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
a {
|
|
42
|
-
//outline: none;
|
|
43
|
-
//text-decoration: none;
|
|
44
|
-
//line-height: 15px;
|
|
45
|
-
//color: rgba(14, 10, 255, 0.6);
|
|
46
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"jsx": "react-jsx",
|
|
6
|
-
"moduleResolution": "Node",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"emitDeclarationOnly": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src"]
|
|
15
|
-
}
|
package/utils/makeColors.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Утилиты для автоматического подбора цветов
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** Возвращает hover-цвет
|
|
7
|
-
* baseHex - цвет в формате #ffffff
|
|
8
|
-
* k - процент затемнения, по умолчанию 15%
|
|
9
|
-
* mode: 'dark' - более темный, чем основной
|
|
10
|
-
* mode: 'light' - более светлый, чем основной
|
|
11
|
-
* */
|
|
12
|
-
export function makeHoverColor(baseHex: string, k: number = 0.15, mode: 'dark' | 'light' = 'dark') {
|
|
13
|
-
const { r, g, b } = hexToRgb(baseHex);
|
|
14
|
-
const factor = mode === 'dark' ? 1 - k : 1 + k;
|
|
15
|
-
|
|
16
|
-
return rgbToHex(
|
|
17
|
-
r * factor,
|
|
18
|
-
g * factor,
|
|
19
|
-
b * factor
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function hexToRgb(hex) {
|
|
23
|
-
hex = hex.replace('#', '');
|
|
24
|
-
if (hex.length === 3) {
|
|
25
|
-
hex = hex.split('').map(x => x + x).join('');
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
r: parseInt(hex.slice(1, 3), 16),
|
|
29
|
-
g: parseInt(hex.slice(3, 5), 16),
|
|
30
|
-
b: parseInt(hex.slice(5, 7), 16)
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function rgbToHex(r, g, b) {
|
|
34
|
-
return (
|
|
35
|
-
'#' + [r, g, b].map(x => Math.max(0, Math.min(255, Math.round(x))).toString(16).padStart(2, '0')).join('')
|
|
36
|
-
);
|
|
37
|
-
}
|
package/utils/notes.txt
DELETED
package/utils/style_setter.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** Конфиг базовых стилей проекта */
|
|
2
|
-
|
|
3
|
-
const settings = {
|
|
4
|
-
/** Основные цвета интерфейса управления */
|
|
5
|
-
'--primary-btn-color': '#7C3AED',
|
|
6
|
-
'--secondary-btn-color': '#FFFFFF',
|
|
7
|
-
'--hover-btn-color': '#6D28D9',
|
|
8
|
-
'--bg-color': '#fff',
|
|
9
|
-
|
|
10
|
-
/** Углы */
|
|
11
|
-
'--corners-standard': '0.65em',
|
|
12
|
-
'--corners-round': '3em',
|
|
13
|
-
'--corners-square': '0',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
for(let key in settings) {
|
|
17
|
-
document.documentElement.style.setProperty(key, settings[key]);
|
|
18
|
-
}
|
|
19
|
-
|
package/vite.config.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import react from "@vitejs/plugin-react";
|
|
3
|
-
import dts from 'vite-plugin-dts'
|
|
4
|
-
import path from 'path';
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [
|
|
8
|
-
react(),
|
|
9
|
-
dts({ insertTypesEntry: true })
|
|
10
|
-
],
|
|
11
|
-
server: {
|
|
12
|
-
port: 9000
|
|
13
|
-
},
|
|
14
|
-
build: {
|
|
15
|
-
lib: {
|
|
16
|
-
entry: path.resolve(__dirname, 'src/components/index.ts'),
|
|
17
|
-
name: "velumUIkit",
|
|
18
|
-
formats: ["es", "umd"],
|
|
19
|
-
fileName: (format) => `index.${format}.js`,
|
|
20
|
-
},
|
|
21
|
-
rollupOptions: {
|
|
22
|
-
external: ["react", "react-dom"],
|
|
23
|
-
output: {
|
|
24
|
-
globals: {
|
|
25
|
-
react: 'React',
|
|
26
|
-
'react-dom': 'ReactDOM'
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
outDir: 'dist'
|
|
31
|
-
}
|
|
32
|
-
});
|