@velumweb/ui-kit 1.0.1 → 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.
Files changed (216) hide show
  1. package/dist/components/Button/Button.d.ts +32 -32
  2. package/dist/components/Button/Button.stories.d.ts +15 -15
  3. package/dist/components/Button/index.d.ts +1 -1
  4. package/dist/components/Container/Box.d.ts +33 -33
  5. package/dist/components/Container/index.d.ts +1 -1
  6. package/dist/components/Input/Input.d.ts +38 -38
  7. package/dist/components/Input/Input.stories.d.ts +14 -14
  8. package/dist/components/Input/index.d.ts +1 -1
  9. package/dist/components/Modal/Modal.d.ts +29 -29
  10. package/dist/components/Modal/Modal.stories.d.ts +13 -13
  11. package/dist/components/Modal/index.d.ts +1 -1
  12. package/dist/components/Toggle/Toggle.d.ts +18 -18
  13. package/dist/components/Toggle/Toggle.stories.d.ts +13 -13
  14. package/dist/components/Toggle/index.d.ts +1 -1
  15. package/dist/components/index.d.ts +6 -5
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.es.js +583 -569
  18. package/dist/index.es2.js +1 -1
  19. package/dist/theme.d.ts +2 -0
  20. package/dist/ui-kit.css +1 -1
  21. package/package.json +8 -3
  22. package/readme.md +19 -2
  23. package/.storybook/main.ts +0 -14
  24. package/.storybook/manager.ts +0 -32
  25. package/.storybook/preview.ts +0 -14
  26. package/CNAME +0 -1
  27. package/docs/CNAME +0 -1
  28. package/docs/assets/Button-CfaZpHIg.css +0 -1
  29. package/docs/assets/Button-DBH2W8EG.js +0 -1
  30. package/docs/assets/Button.stories-uPwy2cWr.js +0 -34
  31. package/docs/assets/Input-RjFZkyU_.css +0 -1
  32. package/docs/assets/Input.stories-BWPjJb-G.js +0 -21
  33. package/docs/assets/Modal-CWKTs3Ep.css +0 -1
  34. package/docs/assets/Modal.stories-eOcMgB-u.js +0 -7
  35. package/docs/assets/Toggle-BmcBtVup.css +0 -1
  36. package/docs/assets/Toggle.stories-MYi2irTa.js +0 -9
  37. package/docs/assets/iframe-CssGlRqL.js +0 -1062
  38. package/docs/assets/jsx-runtime-u17CrQMm.js +0 -1
  39. package/docs/assets/preload-helper-PPVm8Dsz.js +0 -1
  40. package/docs/assets/react-18-BQzlCVST.js +0 -9
  41. package/docs/assets/svg-lib/3-dots-horizontal-svgrepo-com.svg +0 -5
  42. package/docs/assets/svg-lib/about-empty-page-svgrepo-com.svg +0 -5
  43. package/docs/assets/svg-lib/alert-square.svg +0 -26
  44. package/docs/assets/svg-lib/arrow-bottom-svgrepo-com.svg +0 -9
  45. package/docs/assets/svg-lib/arrow-left-svgrepo-com.svg +0 -5
  46. package/docs/assets/svg-lib/arrow-right-svgrepo-com.svg +0 -5
  47. package/docs/assets/svg-lib/arrow-top-svgrepo-com.svg +0 -9
  48. package/docs/assets/svg-lib/checkmark-svgrepo-com.svg +0 -5
  49. package/docs/assets/svg-lib/clock-svgrepo-com.svg +0 -5
  50. package/docs/assets/svg-lib/cross-svgrepo-com.svg +0 -12
  51. package/docs/assets/svg-lib/download-svgrepo-com.svg +0 -5
  52. package/docs/assets/svg-lib/edit-pen-svgrepo-com.svg +0 -5
  53. package/docs/assets/svg-lib/favorite-svgrepo-com.svg +0 -5
  54. package/docs/assets/svg-lib/forbiden-svgrepo-com.svg +0 -9
  55. package/docs/assets/svg-lib/input-svgrepo-com.svg +0 -5
  56. package/docs/assets/svg-lib/link-svgrepo-com.svg +0 -5
  57. package/docs/assets/svg-lib/messages-alert-svgrepo-com.svg +0 -6
  58. package/docs/assets/svg-lib/messages-svgrepo-com.svg +0 -5
  59. package/docs/assets/svg-lib/mic-off-svgrepo-com.svg +0 -6
  60. package/docs/assets/svg-lib/mic-svgrepo-com.svg +0 -5
  61. package/docs/assets/svg-lib/music-svgrepo-com.svg +0 -6
  62. package/docs/assets/svg-lib/next-long-arrow-right-svgrepo-com.svg +0 -5
  63. package/docs/assets/svg-lib/notification-alert-svgrepo-com.svg +0 -6
  64. package/docs/assets/svg-lib/notification-svgrepo-com.svg +0 -5
  65. package/docs/assets/svg-lib/notifications-off-svgrepo-com.svg +0 -6
  66. package/docs/assets/svg-lib/party-simple-colored-svgrepo-com.svg +0 -11
  67. package/docs/assets/svg-lib/pattern-circles-svgrepo-com.svg +0 -5
  68. package/docs/assets/svg-lib/play-button-simple-svgrepo-com.svg +0 -5
  69. package/docs/assets/svg-lib/plus-outlined-svgrepo-com.svg +0 -5
  70. package/docs/assets/svg-lib/previous-long-arrow-left-svgrepo-com.svg +0 -5
  71. package/docs/assets/svg-lib/queue-listing-cards-svgrepo-com.svg +0 -6
  72. package/docs/assets/svg-lib/queue-remove-svgrepo-com.svg +0 -5
  73. package/docs/assets/svg-lib/recent-svgrepo-com.svg +0 -5
  74. package/docs/assets/svg-lib/remove-svgrepo-com.svg +0 -5
  75. package/docs/assets/svg-lib/repeat-svgrepo-com.svg +0 -5
  76. package/docs/assets/svg-lib/schedule-add-svgrepo-com.svg +0 -5
  77. package/docs/assets/svg-lib/schedule-alert-svgrepo-com.svg +0 -6
  78. package/docs/assets/svg-lib/schedule-remove-svgrepo-com.svg +0 -6
  79. package/docs/assets/svg-lib/schedule-svgrepo-com.svg +0 -5
  80. package/docs/assets/svg-lib/search-svgrepo-com.svg +0 -5
  81. package/docs/assets/svg-lib/session-abandon-svgrepo-com.svg +0 -5
  82. package/docs/assets/svg-lib/session-join-svgrepo-com.svg +0 -5
  83. package/docs/assets/svg-lib/session-leave-svgrepo-com.svg +0 -5
  84. package/docs/assets/svg-lib/settings-svgrepo-com.svg +0 -5
  85. package/docs/assets/svg-lib/share-svgrepo-com.svg +0 -5
  86. package/docs/assets/svg-lib/sound-off-svgrepo-com.svg +0 -6
  87. package/docs/assets/svg-lib/sound-svgrepo-com.svg +0 -5
  88. package/docs/assets/svg-lib/spectacles-svgrepo-com.svg +0 -5
  89. package/docs/assets/svg-lib/star-svgrepo-com.svg +0 -5
  90. package/docs/assets/svg-lib/user-avatar-with-alert-svgrepo-com.svg +0 -6
  91. package/docs/assets/svg-lib/user-banned-svgrepo-com.svg +0 -6
  92. package/docs/assets/svg-lib/user-svgrepo-com.svg +0 -5
  93. package/docs/assets/svglist.png +0 -0
  94. package/docs/components/Button/Button.d.ts +0 -32
  95. package/docs/components/Button/Button.stories.d.ts +0 -15
  96. package/docs/components/Button/index.d.ts +0 -1
  97. package/docs/components/Container/Box.d.ts +0 -33
  98. package/docs/components/Container/index.d.ts +0 -1
  99. package/docs/components/Input/Input.d.ts +0 -38
  100. package/docs/components/Input/Input.stories.d.ts +0 -14
  101. package/docs/components/Input/index.d.ts +0 -1
  102. package/docs/components/Modal/Modal.d.ts +0 -29
  103. package/docs/components/Modal/Modal.stories.d.ts +0 -13
  104. package/docs/components/Modal/index.d.ts +0 -1
  105. package/docs/components/Toggle/Toggle.d.ts +0 -18
  106. package/docs/components/Toggle/Toggle.stories.d.ts +0 -13
  107. package/docs/components/Toggle/index.d.ts +0 -1
  108. package/docs/components/index.d.ts +0 -5
  109. package/docs/favicon-wrapper.svg +0 -46
  110. package/docs/favicon.svg +0 -1
  111. package/docs/iframe.html +0 -686
  112. package/docs/index.d.ts +0 -1
  113. package/docs/index.html +0 -137
  114. package/docs/index.json +0 -1
  115. package/docs/makeColors.ts +0 -37
  116. package/docs/notes.txt +0 -11
  117. package/docs/nunito-sans-bold-italic.woff2 +0 -0
  118. package/docs/nunito-sans-bold.woff2 +0 -0
  119. package/docs/nunito-sans-italic.woff2 +0 -0
  120. package/docs/nunito-sans-regular.woff2 +0 -0
  121. package/docs/project.json +0 -1
  122. package/docs/sb-addons/storybook-1/manager-bundle.js +0 -3
  123. package/docs/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -628
  124. package/docs/sb-common-assets/favicon-wrapper.svg +0 -46
  125. package/docs/sb-common-assets/favicon.svg +0 -1
  126. package/docs/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  127. package/docs/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  128. package/docs/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  129. package/docs/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  130. package/docs/sb-manager/globals-runtime.js +0 -75597
  131. package/docs/sb-manager/globals.js +0 -24
  132. package/docs/sb-manager/manager-stores.js +0 -23
  133. package/docs/sb-manager/runtime.js +0 -19698
  134. package/docs/style_setter.js +0 -19
  135. package/docs/vite-inject-mocker-entry.js +0 -2
  136. package/index.html +0 -7
  137. package/public/assets/svg-lib/3-dots-horizontal-svgrepo-com.svg +0 -5
  138. package/public/assets/svg-lib/about-empty-page-svgrepo-com.svg +0 -5
  139. package/public/assets/svg-lib/alert-square.svg +0 -26
  140. package/public/assets/svg-lib/arrow-bottom-svgrepo-com.svg +0 -9
  141. package/public/assets/svg-lib/arrow-left-svgrepo-com.svg +0 -5
  142. package/public/assets/svg-lib/arrow-right-svgrepo-com.svg +0 -5
  143. package/public/assets/svg-lib/arrow-top-svgrepo-com.svg +0 -9
  144. package/public/assets/svg-lib/checkmark-svgrepo-com.svg +0 -5
  145. package/public/assets/svg-lib/clock-svgrepo-com.svg +0 -5
  146. package/public/assets/svg-lib/cross-svgrepo-com.svg +0 -12
  147. package/public/assets/svg-lib/download-svgrepo-com.svg +0 -5
  148. package/public/assets/svg-lib/edit-pen-svgrepo-com.svg +0 -5
  149. package/public/assets/svg-lib/favorite-svgrepo-com.svg +0 -5
  150. package/public/assets/svg-lib/forbiden-svgrepo-com.svg +0 -9
  151. package/public/assets/svg-lib/input-svgrepo-com.svg +0 -5
  152. package/public/assets/svg-lib/link-svgrepo-com.svg +0 -5
  153. package/public/assets/svg-lib/messages-alert-svgrepo-com.svg +0 -6
  154. package/public/assets/svg-lib/messages-svgrepo-com.svg +0 -5
  155. package/public/assets/svg-lib/mic-off-svgrepo-com.svg +0 -6
  156. package/public/assets/svg-lib/mic-svgrepo-com.svg +0 -5
  157. package/public/assets/svg-lib/music-svgrepo-com.svg +0 -6
  158. package/public/assets/svg-lib/next-long-arrow-right-svgrepo-com.svg +0 -5
  159. package/public/assets/svg-lib/notification-alert-svgrepo-com.svg +0 -6
  160. package/public/assets/svg-lib/notification-svgrepo-com.svg +0 -5
  161. package/public/assets/svg-lib/notifications-off-svgrepo-com.svg +0 -6
  162. package/public/assets/svg-lib/party-simple-colored-svgrepo-com.svg +0 -11
  163. package/public/assets/svg-lib/pattern-circles-svgrepo-com.svg +0 -5
  164. package/public/assets/svg-lib/play-button-simple-svgrepo-com.svg +0 -5
  165. package/public/assets/svg-lib/plus-outlined-svgrepo-com.svg +0 -5
  166. package/public/assets/svg-lib/previous-long-arrow-left-svgrepo-com.svg +0 -5
  167. package/public/assets/svg-lib/queue-listing-cards-svgrepo-com.svg +0 -6
  168. package/public/assets/svg-lib/queue-remove-svgrepo-com.svg +0 -5
  169. package/public/assets/svg-lib/recent-svgrepo-com.svg +0 -5
  170. package/public/assets/svg-lib/remove-svgrepo-com.svg +0 -5
  171. package/public/assets/svg-lib/repeat-svgrepo-com.svg +0 -5
  172. package/public/assets/svg-lib/schedule-add-svgrepo-com.svg +0 -5
  173. package/public/assets/svg-lib/schedule-alert-svgrepo-com.svg +0 -6
  174. package/public/assets/svg-lib/schedule-remove-svgrepo-com.svg +0 -6
  175. package/public/assets/svg-lib/schedule-svgrepo-com.svg +0 -5
  176. package/public/assets/svg-lib/search-svgrepo-com.svg +0 -5
  177. package/public/assets/svg-lib/session-abandon-svgrepo-com.svg +0 -5
  178. package/public/assets/svg-lib/session-join-svgrepo-com.svg +0 -5
  179. package/public/assets/svg-lib/session-leave-svgrepo-com.svg +0 -5
  180. package/public/assets/svg-lib/settings-svgrepo-com.svg +0 -5
  181. package/public/assets/svg-lib/share-svgrepo-com.svg +0 -5
  182. package/public/assets/svg-lib/sound-off-svgrepo-com.svg +0 -6
  183. package/public/assets/svg-lib/sound-svgrepo-com.svg +0 -5
  184. package/public/assets/svg-lib/spectacles-svgrepo-com.svg +0 -5
  185. package/public/assets/svg-lib/star-svgrepo-com.svg +0 -5
  186. package/public/assets/svg-lib/user-avatar-with-alert-svgrepo-com.svg +0 -6
  187. package/public/assets/svg-lib/user-banned-svgrepo-com.svg +0 -6
  188. package/public/assets/svg-lib/user-svgrepo-com.svg +0 -5
  189. package/public/assets/svglist.png +0 -0
  190. package/src/components/Button/Button.stories.ts +0 -64
  191. package/src/components/Button/Button.tsx +0 -99
  192. package/src/components/Button/button.scss +0 -147
  193. package/src/components/Button/index.ts +0 -1
  194. package/src/components/Container/Box.tsx +0 -83
  195. package/src/components/Container/box.scss +0 -41
  196. package/src/components/Container/index.ts +0 -1
  197. package/src/components/Input/Input.stories.ts +0 -49
  198. package/src/components/Input/Input.tsx +0 -172
  199. package/src/components/Input/index.ts +0 -1
  200. package/src/components/Input/input.scss +0 -69
  201. package/src/components/Modal/Modal.stories.ts +0 -33
  202. package/src/components/Modal/Modal.tsx +0 -125
  203. package/src/components/Modal/index.ts +0 -1
  204. package/src/components/Modal/modal.scss +0 -54
  205. package/src/components/Toggle/Toggle.stories.ts +0 -35
  206. package/src/components/Toggle/Toggle.tsx +0 -60
  207. package/src/components/Toggle/index.ts +0 -1
  208. package/src/components/Toggle/toggle.scss +0 -97
  209. package/src/components/index.ts +0 -5
  210. package/src/main.scss +0 -46
  211. package/src/style.ts +0 -1
  212. package/tsconfig.json +0 -15
  213. package/utils/makeColors.ts +0 -37
  214. package/utils/notes.txt +0 -11
  215. package/utils/style_setter.js +0 -19
  216. package/vite.config.ts +0 -42
@@ -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
- }
@@ -1,5 +0,0 @@
1
- export * from "./Button";
2
- export * from "./Container";
3
- export * from "./Modal";
4
- export * from "./Input";
5
- export * from "./Toggle";
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/src/style.ts DELETED
@@ -1 +0,0 @@
1
- import './main.scss'
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
- }
@@ -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
@@ -1,11 +0,0 @@
1
- TODO
2
-
3
- 1) Контейнер для мобильных форм и главной кнопки:
4
- - ширина 100%
5
- - margin 0 16px
6
- - дочерние элементы занимают всю ширину
7
-
8
-
9
- 2) Button - добавить tooltip
10
-
11
- 3) Button, Toggle добавить loading маску
@@ -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,42 +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({
10
- insertTypesEntry: true,
11
- beforeWriteFile: (filePath, content) => {
12
- if (filePath.endsWith('style.d.ts')) {
13
- return false;
14
- }
15
- }
16
- })
17
- ],
18
- server: {
19
- port: 9000
20
- },
21
- build: {
22
- lib: {
23
- entry: {
24
- index: path.resolve(__dirname, 'src/components/index.ts'),
25
- style: path.resolve(__dirname, 'src/style.ts')
26
- },
27
- name: "velumUIkit",
28
- formats: ["es"],
29
- fileName: (format) => `index.${format}.js`,
30
- },
31
- rollupOptions: {
32
- external: ["react", "react-dom"],
33
- output: {
34
- globals: {
35
- react: 'React',
36
- 'react-dom': 'ReactDOM'
37
- }
38
- }
39
- },
40
- outDir: 'dist'
41
- }
42
- });