@cyber-harbour/ui 1.0.54 → 1.0.56
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/dist/index.d.mts +35 -2
- package/dist/index.d.ts +35 -2
- package/dist/index.js +261 -236
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +198 -173
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/src/Core/Drawer/Drawer.tsx +97 -0
- package/src/Core/Drawer/index.ts +1 -0
- package/src/Core/IconComponents/FolderAlertIcon.tsx +32 -0
- package/src/Core/IconComponents/RelationIcon.tsx +28 -0
- package/src/Core/IconComponents/RelationPointsIcon.tsx +36 -0
- package/src/Core/IconComponents/index.ts +3 -0
- package/src/Core/index.ts +1 -0
- package/src/Theme/index.ts +1 -0
- package/src/Theme/themes/dark.ts +167 -0
- package/src/Theme/themes/light.ts +167 -0
- package/src/Theme/types.ts +6 -1
- package/src/Theme/useTheme.tsx +7 -0
- package/src/Theme/utils.ts +6 -11
- package/src/utils.ts +30 -0
package/src/Theme/utils.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { DefaultTheme } from 'styled-components';
|
|
2
|
-
import {
|
|
3
|
-
Breakpoint,
|
|
4
|
-
ButtonColor,
|
|
5
|
-
ButtonSize,
|
|
6
|
-
ButtonState,
|
|
7
|
-
ButtonVariant,
|
|
8
|
-
InputSize,
|
|
9
|
-
InputState,
|
|
10
|
-
InputVariant,
|
|
11
|
-
} from './types';
|
|
2
|
+
import { Breakpoint, ButtonColor, ButtonSize, ButtonState, ButtonVariant, InputState, InputVariant } from './types';
|
|
12
3
|
|
|
13
4
|
/**
|
|
14
5
|
* Helper function to resolve nested color paths from theme
|
|
@@ -96,7 +87,11 @@ const IGNORE_CONVERT_KEYS: Record<string, string[] | boolean> = {
|
|
|
96
87
|
* @returns The value in rem units as a string (e.g., "1.25rem")
|
|
97
88
|
*/
|
|
98
89
|
export const propToRem = (value: number | string, baseSize: number = 16): string => {
|
|
99
|
-
if
|
|
90
|
+
// Check if value ends with units that should not be converted to rem
|
|
91
|
+
if (typeof value === 'string' && /(%|d?vh|d?vw)$/.test(value.trim())) {
|
|
92
|
+
return value; // Return percentage and viewport values as-is
|
|
93
|
+
}
|
|
94
|
+
|
|
100
95
|
const numericValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
101
96
|
|
|
102
97
|
// Handle invalid values
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
};
|