@cyber-harbour/ui 1.0.74 → 1.0.75

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 (176) hide show
  1. package/README.md +76 -0
  2. package/bin/switch-ui-lib.js +196 -0
  3. package/dist/index.js +90 -90
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +6 -6
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +12 -2
  8. package/.env.example +0 -0
  9. package/src/Core/Alert/Alert.tsx +0 -87
  10. package/src/Core/Alert/index.ts +0 -1
  11. package/src/Core/Box/Box.tsx +0 -46
  12. package/src/Core/Box/index.ts +0 -1
  13. package/src/Core/Button/Button.tsx +0 -208
  14. package/src/Core/Button/index.ts +0 -1
  15. package/src/Core/Checkbox/Checkbox.tsx +0 -73
  16. package/src/Core/Checkbox/index.ts +0 -1
  17. package/src/Core/ContentLoader/ContentLoader.tsx +0 -13
  18. package/src/Core/ContentLoader/index.ts +0 -1
  19. package/src/Core/ContextMenu/ContextMenu.tsx +0 -153
  20. package/src/Core/ContextMenu/ContextMenuDelimiter.tsx +0 -13
  21. package/src/Core/ContextMenu/index.ts +0 -3
  22. package/src/Core/ContextMenu/useContextMenuControl.ts +0 -21
  23. package/src/Core/Drawer/Drawer.tsx +0 -118
  24. package/src/Core/Drawer/index.ts +0 -1
  25. package/src/Core/EmptyData/EmptyData.tsx +0 -44
  26. package/src/Core/EmptyData/index.ts +0 -1
  27. package/src/Core/Flex/FlexContainer.tsx +0 -94
  28. package/src/Core/Flex/FlexItem.tsx +0 -58
  29. package/src/Core/Flex/index.ts +0 -4
  30. package/src/Core/Header/Header.tsx +0 -37
  31. package/src/Core/Header/HeaderDelimeter.tsx +0 -12
  32. package/src/Core/Header/HeaderSection.tsx +0 -37
  33. package/src/Core/Header/index.ts +0 -3
  34. package/src/Core/IconComponents/AlertIcon.tsx +0 -18
  35. package/src/Core/IconComponents/AndroidIcon.tsx +0 -28
  36. package/src/Core/IconComponents/ApiIcon.tsx +0 -26
  37. package/src/Core/IconComponents/ArrowCircleTopRightIcon.tsx +0 -27
  38. package/src/Core/IconComponents/ArrowRightIcon.tsx +0 -23
  39. package/src/Core/IconComponents/BallsMenu.tsx +0 -15
  40. package/src/Core/IconComponents/BugReportIcon.tsx +0 -16
  41. package/src/Core/IconComponents/BusIcon.tsx +0 -24
  42. package/src/Core/IconComponents/CalendarIcon.tsx +0 -26
  43. package/src/Core/IconComponents/CarIcon.tsx +0 -16
  44. package/src/Core/IconComponents/Check.tsx +0 -16
  45. package/src/Core/IconComponents/ChevronDown.tsx +0 -18
  46. package/src/Core/IconComponents/ChevronLeftIcon.tsx +0 -23
  47. package/src/Core/IconComponents/ChevronRightIcon.tsx +0 -23
  48. package/src/Core/IconComponents/ChevronUp.tsx +0 -18
  49. package/src/Core/IconComponents/CloseCircleIcon.tsx +0 -24
  50. package/src/Core/IconComponents/ClosedLockIcon.tsx +0 -22
  51. package/src/Core/IconComponents/Cross.tsx +0 -16
  52. package/src/Core/IconComponents/DataSetsIcon.tsx +0 -26
  53. package/src/Core/IconComponents/DeepSearchIcon.tsx +0 -16
  54. package/src/Core/IconComponents/DisabledVisibleIcon.tsx +0 -26
  55. package/src/Core/IconComponents/DocsIcon.tsx +0 -26
  56. package/src/Core/IconComponents/DownloadIcon.tsx +0 -26
  57. package/src/Core/IconComponents/EditUserIcon.tsx +0 -26
  58. package/src/Core/IconComponents/EnableVisibleIcon.tsx +0 -22
  59. package/src/Core/IconComponents/EnterArrowLeftIcon.tsx +0 -16
  60. package/src/Core/IconComponents/FileIcon.tsx +0 -16
  61. package/src/Core/IconComponents/FiltersIcon.tsx +0 -38
  62. package/src/Core/IconComponents/FlashIcon.tsx +0 -16
  63. package/src/Core/IconComponents/FolderAlertIcon.tsx +0 -32
  64. package/src/Core/IconComponents/FolderInfoIcon.tsx +0 -28
  65. package/src/Core/IconComponents/HomepageIcon.tsx +0 -16
  66. package/src/Core/IconComponents/InfoCircleFilled.tsx +0 -18
  67. package/src/Core/IconComponents/InfoCircleIcon.tsx +0 -23
  68. package/src/Core/IconComponents/IosIcon.tsx +0 -20
  69. package/src/Core/IconComponents/MapRadarIcon.tsx +0 -22
  70. package/src/Core/IconComponents/MaximizeIcon.tsx +0 -28
  71. package/src/Core/IconComponents/MicrosoftIcon.tsx +0 -28
  72. package/src/Core/IconComponents/MoonIcon.tsx +0 -16
  73. package/src/Core/IconComponents/OpenLockIcon.tsx +0 -30
  74. package/src/Core/IconComponents/OrganizationIcon.tsx +0 -26
  75. package/src/Core/IconComponents/PassportIcon.tsx +0 -796
  76. package/src/Core/IconComponents/PasswordFinderIcon.tsx +0 -22
  77. package/src/Core/IconComponents/PencilIcon.tsx +0 -16
  78. package/src/Core/IconComponents/PhonebookIcon.tsx +0 -22
  79. package/src/Core/IconComponents/PlaneIcon.tsx +0 -17
  80. package/src/Core/IconComponents/Plus.tsx +0 -20
  81. package/src/Core/IconComponents/PointIcon.tsx +0 -16
  82. package/src/Core/IconComponents/PrintIcon.tsx +0 -16
  83. package/src/Core/IconComponents/Profiler2Icon.tsx +0 -30
  84. package/src/Core/IconComponents/ProfilerIcon.tsx +0 -22
  85. package/src/Core/IconComponents/RelationIcon.tsx +0 -28
  86. package/src/Core/IconComponents/RelationPointsIcon.tsx +0 -36
  87. package/src/Core/IconComponents/RotateLeftIcon.tsx +0 -24
  88. package/src/Core/IconComponents/RotateRightIcon.tsx +0 -24
  89. package/src/Core/IconComponents/SandBoxIcon.tsx +0 -16
  90. package/src/Core/IconComponents/SearchIcon.tsx +0 -14
  91. package/src/Core/IconComponents/ShipIcon.tsx +0 -32
  92. package/src/Core/IconComponents/StatisticIcon.tsx +0 -26
  93. package/src/Core/IconComponents/SunIcon.tsx +0 -49
  94. package/src/Core/IconComponents/Unfold.tsx +0 -20
  95. package/src/Core/IconComponents/UpRightArrowCircleIcon.tsx +0 -22
  96. package/src/Core/IconComponents/UserInCircle.tsx +0 -24
  97. package/src/Core/IconComponents/Users.tsx +0 -36
  98. package/src/Core/IconComponents/VectorIcon.tsx +0 -17
  99. package/src/Core/IconComponents/WayIcon.tsx +0 -24
  100. package/src/Core/IconComponents/index.ts +0 -66
  101. package/src/Core/Input/Input.tsx +0 -245
  102. package/src/Core/Input/index.ts +0 -1
  103. package/src/Core/Label/Label.tsx +0 -139
  104. package/src/Core/Label/index.ts +0 -1
  105. package/src/Core/Line/Line.tsx +0 -26
  106. package/src/Core/Line/index.ts +0 -1
  107. package/src/Core/LinerProgress/LinerProgress.tsx +0 -47
  108. package/src/Core/LinerProgress/index.ts +0 -1
  109. package/src/Core/ListMenu/ListMenu.tsx +0 -31
  110. package/src/Core/ListMenu/ListMenuItem.tsx +0 -105
  111. package/src/Core/ListMenu/ListMenuSection.tsx +0 -54
  112. package/src/Core/ListMenu/index.ts +0 -3
  113. package/src/Core/Modal/Modal.tsx +0 -116
  114. package/src/Core/Modal/index.ts +0 -1
  115. package/src/Core/Overlay/Overlay.tsx +0 -94
  116. package/src/Core/Overlay/index.ts +0 -1
  117. package/src/Core/Pagination/Pagination.tsx +0 -139
  118. package/src/Core/Pagination/index.ts +0 -1
  119. package/src/Core/RowActionsMenu/RowActionsMenu.tsx +0 -153
  120. package/src/Core/RowActionsMenu/index.ts +0 -1
  121. package/src/Core/Select/Select.tsx +0 -197
  122. package/src/Core/Select/index.ts +0 -1
  123. package/src/Core/Sidebar/Sidebar.tsx +0 -80
  124. package/src/Core/Sidebar/SidebarContext.tsx +0 -13
  125. package/src/Core/Sidebar/SidebarDelimeter.tsx +0 -35
  126. package/src/Core/Sidebar/SidebarItem.tsx +0 -137
  127. package/src/Core/Sidebar/SidebarSection.tsx +0 -31
  128. package/src/Core/Sidebar/index.ts +0 -5
  129. package/src/Core/Switch/Switch.tsx +0 -71
  130. package/src/Core/Switch/index.ts +0 -1
  131. package/src/Core/Table/Cell.tsx +0 -42
  132. package/src/Core/Table/Row.tsx +0 -3
  133. package/src/Core/Table/Table.tsx +0 -94
  134. package/src/Core/Table/index.ts +0 -1
  135. package/src/Core/Tag/Tag.tsx +0 -144
  136. package/src/Core/Tag/index.ts +0 -1
  137. package/src/Core/Tooltip/Tooltip.tsx +0 -103
  138. package/src/Core/Tooltip/index.ts +0 -1
  139. package/src/Core/Typography/Typography.tsx +0 -70
  140. package/src/Core/Typography/index.ts +0 -1
  141. package/src/Core/index.ts +0 -27
  142. package/src/FullscreenCard/FullscreenCard.tsx +0 -56
  143. package/src/FullscreenCard/index.ts +0 -1
  144. package/src/Graph2D/Graph2D.tsx +0 -1837
  145. package/src/Graph2D/GraphLoader.tsx +0 -68
  146. package/src/Graph2D/icons/eye_light.png +0 -0
  147. package/src/Graph2D/icons/eye_light_hover.png +0 -0
  148. package/src/Graph2D/icons/group_light.png +0 -0
  149. package/src/Graph2D/icons/group_light_hover.png +0 -0
  150. package/src/Graph2D/index.ts +0 -2
  151. package/src/Graph2D/json_test.json +0 -44444
  152. package/src/Graph2D/types.ts +0 -122
  153. package/src/Layouts/Container/Container.tsx +0 -33
  154. package/src/Layouts/Container/index.ts +0 -1
  155. package/src/Layouts/PageLayout/PageLayout.tsx +0 -63
  156. package/src/Layouts/PageLayout/index.ts +0 -1
  157. package/src/Layouts/index.ts +0 -2
  158. package/src/Theme/Breakpoint.tsx +0 -50
  159. package/src/Theme/GlobalStyle.tsx +0 -18
  160. package/src/Theme/ThemeProvider.tsx +0 -30
  161. package/src/Theme/componentFabric.tsx +0 -159
  162. package/src/Theme/index.ts +0 -8
  163. package/src/Theme/styled.d.ts +0 -7
  164. package/src/Theme/themes/config.ts +0 -41
  165. package/src/Theme/themes/dark.ts +0 -1005
  166. package/src/Theme/themes/index.ts +0 -2
  167. package/src/Theme/themes/light.ts +0 -1004
  168. package/src/Theme/types.ts +0 -362
  169. package/src/Theme/useTheme.tsx +0 -7
  170. package/src/Theme/utils.ts +0 -205
  171. package/src/custom.d.ts +0 -19
  172. package/src/index.ts +0 -5
  173. package/src/utils.ts +0 -30
  174. package/tsconfig.paths.json +0 -5
  175. package/tsup.config.ts +0 -30
  176. package/tsup.dev.config.ts +0 -10
@@ -1,362 +0,0 @@
1
- import { CSSProperties } from 'styled-components';
2
-
3
- // Типи для компонентної палітри
4
- export type ButtonVariant = 'fill' | 'outlined' | 'empty';
5
- export type ButtonColor = 'default' | 'primary' | 'secondary' | 'error' | 'soft' | 'light';
6
- export type ButtonState = 'default' | 'hover' | 'active' | 'disabled';
7
- export type ButtonSize = 'small' | 'medium';
8
-
9
- export type InputVariant = 'outlined' | 'empty';
10
- export type InputState = 'default' | 'focus' | 'error' | 'disabled';
11
- export type InputSize = 'empty' | 'small' | 'medium';
12
-
13
- export type TagVariant = 'fill' | 'outlined';
14
- export type TagColor =
15
- | 'default'
16
- | 'primary'
17
- | 'error'
18
- | 'warning'
19
- | 'success'
20
- | 'disabled'
21
- | 'text'
22
- | 'orange'
23
- | string;
24
-
25
- export type LabelSize = 'small' | 'medium';
26
- export type LabelSizeStyle = {
27
- fontSize: number | string;
28
- gap: number | string;
29
- marginBottom: number | string;
30
- helpText: { fontSize: number | string; marginTop: number | string };
31
- };
32
-
33
- export type SwitchState = 'default' | 'checked' | 'disabled';
34
- // Типи для spacing та breakpoints
35
- export type Breakpoint = 'xs' | 's' | 'm' | 'l' | 'xl';
36
-
37
- // Тип для стилів елементів кнопок
38
- export type ButtonElementStyle = {
39
- background: string;
40
- text: string;
41
- border: string;
42
- boxShadow: string;
43
- filledIcon?: {
44
- background: string;
45
- color: string;
46
- };
47
- };
48
-
49
- // Тип для розмірів кнопок
50
- export type ButtonSizeStyle = {
51
- fontSize: number | string;
52
- paddingInline: number | string;
53
- paddingBlock: number | string;
54
- borderRadius: number | string;
55
- borderWidth: number | string;
56
- gap: number | string;
57
- iconSize: number | string;
58
- };
59
-
60
- // Тип для стилів елементів інпута
61
- export type InputElementStyle = {
62
- background: string;
63
- text: string;
64
- placeholder: string;
65
- border: string;
66
- boxShadow: string;
67
- icon: string;
68
- };
69
-
70
- // Тип для розмірів інпута
71
- export type InputSizeStyle = {
72
- fontSize: number | string;
73
- paddingInline: number | string;
74
- paddingBlock: number | string;
75
- borderRadius: number | string;
76
- iconSize: number | string;
77
- height: number | string;
78
- lineHeight: number;
79
- };
80
-
81
- export type TagElementStyle = {
82
- paddingInline: number | string;
83
- paddingBlock: number | string;
84
- borderRadius: number | string;
85
- borderWidth: number | string;
86
- color: Record<TagColor, string>;
87
- };
88
-
89
- // Тип для палітри
90
- export type Theme = {
91
- mode: 'light' | 'dark';
92
- baseSize: number;
93
- colors: {
94
- background: string;
95
- backgroundBase: string;
96
- primary: {
97
- main: string;
98
- light: string;
99
- lighter: string;
100
- lightest: string;
101
- lightest2: string;
102
- };
103
- text: {
104
- main: string;
105
- light: string;
106
- lighter: string;
107
- invert: string;
108
- success: string;
109
- error: string;
110
- };
111
- stroke: {
112
- main: string;
113
- light: string;
114
- lighter: string;
115
- };
116
- disable: string;
117
- success: string;
118
- error: string;
119
- warning: string;
120
- info: string;
121
- };
122
- line: {
123
- size: string | number;
124
- color: string;
125
- };
126
- typography: {
127
- fontFamily: string;
128
- lineHeight: number;
129
- variants: {
130
- h1: { fontSize: number | string };
131
- h2: { fontSize: number | string };
132
- h3: { fontSize: number | string };
133
- body: { fontSize: number | string };
134
- };
135
- };
136
- breakpoints: Record<Breakpoint, number>;
137
- zIndex: {
138
- dropdown: number;
139
- sticky: number;
140
- fixed: number;
141
- backdrop: number;
142
- modal: number;
143
- popover: number;
144
- tooltip: number;
145
- };
146
- button: {
147
- fill: Record<ButtonColor, Record<ButtonState, ButtonElementStyle>>;
148
- outlined: Record<ButtonColor, Record<ButtonState, ButtonElementStyle>>;
149
- empty: Record<ButtonColor, Record<ButtonState, ButtonElementStyle>>;
150
- sizes: Record<ButtonSize, ButtonSizeStyle>;
151
- };
152
- sidebar: {
153
- background: string;
154
- border: string;
155
- width: number;
156
- collapsedWidth: number;
157
- text: {
158
- default: string;
159
- active: string;
160
- hover: string;
161
- };
162
- item: {
163
- default: {
164
- background: string;
165
- border: string;
166
- padding: string;
167
- height: number;
168
- };
169
- active: {
170
- background: string;
171
- borderLeft: string;
172
- padding: string;
173
- height: number;
174
- };
175
- hover: {
176
- background: string;
177
- border: string;
178
- padding: string;
179
- height: number;
180
- };
181
- };
182
- section: {
183
- background: string;
184
- padding: string;
185
- title: {
186
- color: string;
187
- fontSize: string;
188
- fontWeight: number;
189
- };
190
- };
191
- delimeter: {
192
- color: string;
193
- thickness: number;
194
- margin: string;
195
- };
196
- };
197
- //ContextMenu
198
- contextMenu: {
199
- button: Record<ButtonState, ButtonElementStyle>;
200
- padding: number;
201
- delimeter: {
202
- style: CSSProperties['borderStyle'];
203
- color: string;
204
- thickness: number;
205
- marginInline: number | string;
206
- marginBlock: number | string;
207
- };
208
- shadow: string;
209
- icon: {
210
- size: number | string;
211
- };
212
- };
213
- //Select
214
- select: {
215
- item: Record<ButtonState, ButtonElementStyle>;
216
- paddingBlock: string | number;
217
- paddingInline: string | number;
218
- margin: string | number;
219
- padding: string | number;
220
- };
221
- // RowActionsMenu
222
- rowActionsMenu: {
223
- button: Record<ButtonState, ButtonElementStyle>;
224
- delimiterColor: string;
225
- icon: {
226
- size: number | string;
227
- };
228
- };
229
- //Input
230
- input: {
231
- sizes: Record<InputSize, InputSizeStyle>;
232
- outlined: Record<InputState, InputElementStyle>;
233
- empty: Record<InputState, InputElementStyle>;
234
- };
235
- //Box
236
- box: {
237
- padding: number | string;
238
- background: string;
239
- borderRadius: number | string;
240
- border: {
241
- width: number | string;
242
- style: string;
243
- color: string;
244
- };
245
- };
246
- // Graph2D component
247
- graph2D: {
248
- ring: {
249
- highlightFill: string;
250
- selectionFill: string;
251
- };
252
- button: {
253
- stroke: string;
254
- normalFill: string;
255
- hoverFill: string;
256
- textColor: string;
257
- spinnerColor: string;
258
- };
259
- grid: {
260
- dotColor: string;
261
- };
262
- link: {
263
- normal: string;
264
- highlighted: string;
265
- textColor: string;
266
- highlightedTextColor: string;
267
- textBgColor: string;
268
- highlightedTextBgColor: string;
269
- };
270
- };
271
- contentLoader: {
272
- foreground: string;
273
- background: string;
274
- };
275
- tag: Record<TagVariant, TagElementStyle>;
276
- alert: {
277
- paddingBlock: number | string;
278
- paddingLeft: number | string;
279
- paddingRight: number | string;
280
- borderRadius: number | string;
281
- fontSize: number | string;
282
- gap: number | string;
283
- icon: {
284
- width: number | string;
285
- height: number | string;
286
- paddingTop: number | string;
287
- };
288
- color: {
289
- icon: string;
290
- text: string;
291
- background: string;
292
- };
293
- };
294
- label: {
295
- sizes: Record<LabelSize, LabelSizeStyle>;
296
- color: string;
297
- helpTextColor: string;
298
- };
299
- leanerProgress: {
300
- background: string;
301
- progressColor: string;
302
- };
303
- switch: Record<
304
- SwitchState,
305
- {
306
- background: string;
307
- color: string;
308
- }
309
- >;
310
- drawer: {
311
- padding: string | number;
312
- width: number;
313
- shadow: string;
314
- };
315
- tooltip: {
316
- fontSize: string | number;
317
- padding: string | number;
318
- maxWidth: string | number;
319
- borderRadius: string | number;
320
- shadow: string;
321
- color: string;
322
- background: string;
323
- };
324
- pagination: {
325
- fontSize: string | number;
326
- paddingBlock: string | number;
327
- paddingInline: string | number;
328
- borderRadius: string | number;
329
- gap: string | number;
330
- height: string | number;
331
- iconSize: string | number;
332
- };
333
- overlay: {
334
- paddingBlock: string | number;
335
- background: string;
336
- gap: string | number;
337
- };
338
- modal: {
339
- padding: string | number;
340
- width: number;
341
- shadow: string;
342
- borderColor: string;
343
- background: string;
344
- borderRadius: string | number;
345
- };
346
- };
347
-
348
- //TODO check and refactoring
349
-
350
- type ThemeColors = Theme['colors'];
351
- type ColorCategory = keyof ThemeColors;
352
-
353
- export type NestedColorPaths =
354
- | keyof Pick<ThemeColors, 'background' | 'disable'>
355
- | `${Extract<ColorCategory, 'primary'>}.${keyof ThemeColors['primary']}`
356
- | `${Extract<ColorCategory, 'text'>}.${keyof ThemeColors['text']}`
357
- | `${Extract<ColorCategory, 'stroke'>}.${keyof ThemeColors['stroke']}`;
358
-
359
- export type ColorVariant = NestedColorPaths;
360
-
361
- // Typography variants type
362
- export type TypographyVariant = 'h1' | 'h2' | 'h3' | 'body';
@@ -1,7 +0,0 @@
1
- import { useTheme as useStyledTheme } from 'styled-components';
2
- import { Theme } from './types';
3
- export const useTheme = () => {
4
- const theme: Theme = useStyledTheme();
5
-
6
- return theme;
7
- };
@@ -1,205 +0,0 @@
1
- import { DefaultTheme } from 'styled-components';
2
- import { Breakpoint, ButtonColor, ButtonSize, ButtonState, ButtonVariant, InputState, InputVariant } from './types';
3
-
4
- /**
5
- * Helper function to resolve nested color paths from theme
6
- * Supports formats like 'primary.main', 'text.lightest', 'background'
7
- *
8
- * @param theme - The styled-components theme object
9
- * @param colorPath - A dot-notation path to the color in the theme, e.g. 'primary.main'
10
- * @returns The resolved color value or undefined if not found
11
- */
12
- export const resolveThemeColor = (theme: DefaultTheme, colorPath: string | undefined): string | undefined => {
13
- // Skip processing if not a string or empty
14
- if (!colorPath || typeof colorPath !== 'string') {
15
- return undefined;
16
- }
17
-
18
- // Check if it's a color path (contains dot) or a top-level theme color property
19
- const isThemeColorPath = colorPath.includes('.') || theme.colors.hasOwnProperty(colorPath);
20
-
21
- // Return early if it's not a theme color path
22
- if (!isThemeColorPath) {
23
- return colorPath; // Return as-is if it's not a theme color path
24
- }
25
-
26
- const parts = colorPath.split('.');
27
-
28
- if (parts.length === 1) {
29
- // For simple color keys like 'background', 'disable'
30
- return theme.colors[parts[0] as keyof typeof theme.colors] as string;
31
- } else if (parts.length === 2) {
32
- // For nested color keys like 'primary.main', 'text.light'
33
- const [category, variant] = parts;
34
- const colorCategory = theme.colors[category as keyof typeof theme.colors];
35
-
36
- if (colorCategory && typeof colorCategory === 'object') {
37
- return colorCategory[variant as keyof typeof colorCategory] as string;
38
- }
39
- }
40
-
41
- return undefined;
42
- };
43
-
44
- /**
45
- * Converts a pixel value to rem units
46
- *
47
- * @param pxValue - The pixel value to convert. Can be a number or a string with 'px' suffix
48
- * @param baseSize - Base font size in pixels. Default is 16px (browser default)
49
- * @returns The value in rem units as a string (e.g., "1.25rem")
50
- */
51
- export const pxToRem = (pxValue: number | string, baseSize: number = 16): string => {
52
- // If pxValue is a string with 'px' suffix, extract the numeric value
53
- const numericValue = typeof pxValue === 'string' ? parseFloat(pxValue.replace('px', '')) : pxValue;
54
-
55
- // Handle invalid values
56
- if (isNaN(numericValue)) {
57
- console.warn(`Invalid pixel value: ${pxValue}`);
58
- return '0';
59
- }
60
-
61
- // Convert to rem and round to 4 decimal places for precision
62
- const remValue = (numericValue / baseSize).toFixed(4).replace(/\.?0+$/, '');
63
-
64
- return `${remValue}rem`;
65
- };
66
-
67
- export const remToPx = (remValue: number | string, baseSize: number = 16): number => {
68
- // If remValue is a string with 'rem' suffix, extract the numeric value
69
- const numericValue = typeof remValue === 'string' ? parseFloat(remValue.replace('rem', '')) : remValue;
70
- if (isNaN(numericValue)) {
71
- return 0;
72
- }
73
-
74
- return numericValue * baseSize;
75
- };
76
-
77
- const IGNORE_CONVERT_KEYS: Record<string, string[] | boolean> = {
78
- contextMenu: ['padding'],
79
- baseSize: true,
80
- };
81
-
82
- /**
83
- * Converts a prop value to rem units if needed
84
- *
85
- * @param value - The pixel value to convert. Can be a number or a string with 'px' suffix
86
- * @param baseSize - Base font size in pixels. Default is 16px (browser default)
87
- * @returns The value in rem units as a string (e.g., "1.25rem")
88
- */
89
- export const propToRem = (value: number | string, baseSize: number = 16): string => {
90
- // Check if value ends with units that should not be converted to rem
91
- if (typeof value === 'string' && /(%|d?vh|d?vw|d?rem)$/.test(value.trim())) {
92
- return value; // Return percentage, viewport and rem values as-is
93
- }
94
-
95
- const numericValue = typeof value === 'string' ? parseFloat(value) : value;
96
-
97
- // Handle invalid values
98
- if (isNaN(numericValue)) {
99
- return `${value}`;
100
- }
101
-
102
- // Convert to rem and round to 4 decimal places for precision
103
- const remValue = (numericValue / baseSize).toFixed(4).replace(/\.?0+$/, '');
104
-
105
- return `${remValue}rem`;
106
- };
107
- /**
108
- * Recursively converts all pixel values in an object to rem units
109
- *
110
- * @param obj - The object containing values to convert
111
- * @param baseSize - Base font size in pixels. Default is 16px
112
- * @returns A new object with pixel values converted to rem
113
- */
114
- export const convertPaletteToRem = (
115
- obj: Record<string, any>,
116
- baseSize: number = 14,
117
- parentKey?: string
118
- ): Record<string, any> => {
119
- const result: Record<string, any> = {};
120
-
121
- Object.entries(obj).forEach(([key, value]) => {
122
- // If the value is an object and not null, recursively convert its properties
123
- if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
124
- result[key] = convertPaletteToRem(value, baseSize, key);
125
- }
126
- // If value is a string and contains 'px', convert it to rem
127
- else if (typeof value === 'string' && /^\d+(\.\d+)?px$/.test(value.trim())) {
128
- result[key] = pxToRem(value, baseSize);
129
- }
130
- // Handle numeric values that represent pixels for specific properties
131
- else if (
132
- typeof value === 'number' &&
133
- ['fontSize', 'width', 'height', 'padding', 'margin', 'gap', 'borderRadius', 'size'].some((prop) =>
134
- key.toLowerCase().includes(prop.toLowerCase())
135
- )
136
- ) {
137
- if (
138
- !(parentKey && Array.isArray(IGNORE_CONVERT_KEYS[parentKey]) && IGNORE_CONVERT_KEYS[parentKey].includes(key)) &&
139
- !IGNORE_CONVERT_KEYS[key]
140
- ) {
141
- result[key] = pxToRem(value, baseSize);
142
- } else {
143
- result[key] = value; // Keep original value if it's in the ignore list
144
- }
145
- }
146
- // Keep other values unchanged
147
- else {
148
- result[key] = value;
149
- }
150
- });
151
-
152
- return result;
153
- };
154
-
155
- // Вспоміжні функції для роботи з палітрою
156
- /**
157
- * Функція для отримання стилів кнопки за варіантом, кольором, станом та розміром
158
- */
159
- export const getButtonStyles = <V extends ButtonVariant>(
160
- theme: DefaultTheme,
161
- variant: ButtonVariant,
162
- color: ButtonColor,
163
- state: ButtonState
164
- ) => {
165
- return theme.button[variant][color][state];
166
- };
167
-
168
- export const getButtonSizeStyles = (theme: DefaultTheme, size: ButtonSize) => {
169
- return theme.button.sizes[size];
170
- };
171
-
172
- /**
173
- * Функція для отримання стилів інпута за варіантом та станом
174
- */
175
- export const getInputStyles = (theme: DefaultTheme, variant: InputVariant, state: InputState) => {
176
- return theme.input[variant][state];
177
- };
178
-
179
- /**
180
- * Функція для отримання типографічних стилів
181
- */
182
- export const getTypographyStyles = (theme: DefaultTheme, variant: string = 'body') => {
183
- return theme.typography.variants[variant as keyof typeof theme.typography.variants] || theme.typography.variants.body;
184
- };
185
-
186
- /**
187
- * Функція для отримання медіа-запитів для breakpoints
188
- */
189
- export const getBreakpoint = (theme: DefaultTheme, size: Breakpoint = 'm') => {
190
- return `@media (min-width: ${theme.breakpoints[size]}px)`;
191
- };
192
-
193
- /**
194
- * Функція для отримання rgba кольору з hex формату
195
- */
196
- export const hexToRgba = (hex: string, alpha: number): string => {
197
- try {
198
- const r = parseInt(hex.slice(1, 3), 16);
199
- const g = parseInt(hex.slice(3, 5), 16);
200
- const b = parseInt(hex.slice(5, 7), 16);
201
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
202
- } catch {
203
- return hex;
204
- }
205
- };
package/src/custom.d.ts DELETED
@@ -1,19 +0,0 @@
1
- declare module '*.png' {
2
- const content: string;
3
- export default content;
4
- }
5
-
6
- declare module '*.jpg' {
7
- const content: string;
8
- export default content;
9
- }
10
-
11
- declare module '*.jpeg' {
12
- const content: string;
13
- export default content;
14
- }
15
-
16
- declare module '*.gif' {
17
- const content: string;
18
- export default content;
19
- }
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './Core';
2
- export * from './Layouts';
3
- export * from './Theme';
4
- export * from './Graph2D';
5
- export * from './FullscreenCard';
package/src/utils.ts DELETED
@@ -1,30 +0,0 @@
1
- import { useEffect } from 'react';
2
-
3
- /**
4
- * Hook для блокування скролу body та збереження позиції контенту
5
- * Додає padding-right замість скролбару щоб уникнути стрибків контенту
6
- *
7
- * @param isLocked - чи заблоковано скрол
8
- */
9
- export const useBodyScrollLock = (isLocked: boolean) => {
10
- useEffect(() => {
11
- if (!isLocked) return;
12
-
13
- const originalStyle = window.getComputedStyle(document.body);
14
- const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
15
-
16
- // Зберігаємо оригінальні стилі
17
- const originalPaddingRight = originalStyle.paddingRight;
18
- const originalOverflow = originalStyle.overflow;
19
-
20
- // Блокуємо скрол та додаємо падінг замість скролбару
21
- document.body.style.overflow = 'hidden';
22
- document.body.style.paddingRight = `${parseInt(originalPaddingRight) + scrollBarWidth}px`;
23
-
24
- return () => {
25
- // Відновлюємо оригінальні стилі
26
- document.body.style.overflow = originalOverflow;
27
- document.body.style.paddingRight = originalPaddingRight;
28
- };
29
- }, [isLocked]);
30
- };
@@ -1,5 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": "."
4
- }
5
- }
package/tsup.config.ts DELETED
@@ -1,30 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
- import { resolve } from 'path';
3
-
4
- export default defineConfig({
5
- entry: ['src/index.ts'],
6
- format: ['esm', 'cjs'],
7
- dts: true,
8
- outDir: 'dist',
9
- clean: true,
10
- treeshake: {
11
- preset: 'recommended',
12
- },
13
- splitting: true,
14
- minify: process.env.NODE_ENV === 'production',
15
- sourcemap: true,
16
- external: ['react', 'react-dom', 'styled-components'],
17
- noExternal: [],
18
- target: 'es2020',
19
- platform: 'browser',
20
- skipNodeModulesBundle: true,
21
- esbuildOptions(options) {
22
- if (process.env.NODE_ENV === 'development') {
23
- options.drop = ['console', 'debugger'];
24
- options.pure = ['console.log', 'console.info', 'console.debug', 'console.warn'];
25
- }
26
- },
27
- shims: true,
28
- keepNames: true,
29
- injectStyle: true, // Додаємо підтримку для CSS/SCSS
30
- });
@@ -1,10 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
- import baseConfig from './tsup.config';
3
-
4
- // Розширюємо основну конфігурацію з оптимізаціями для розробки
5
- export default defineConfig({
6
- ...baseConfig,
7
- minify: false, // Пришвидшення збірки
8
- sourcemap: 'inline', // Вбудовані source maps для зручності
9
- watch: true, // Автоматична перезбірка при змінах
10
- });