@cyber-harbour/ui 1.0.37 → 1.0.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyber-harbour/ui",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { CSSProperties, forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  export type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
@@ -22,20 +22,23 @@ export interface FlexContainerProps {
22
22
  as?: any; // TODO: fix type to styled component or intrinsic element
23
23
  }
24
24
 
25
- export const FlexContainer = ({
26
- children,
27
- direction = 'row',
28
- wrap = 'nowrap',
29
- justify = 'flex-start',
30
- align = 'stretch',
31
- alignContent,
32
- gap,
33
- rowGap,
34
- columnGap,
35
- className,
36
- style,
37
- as = 'div',
38
- }: FlexContainerProps) => {
25
+ export const FlexContainer: any = forwardRef<HTMLElement, FlexContainerProps>(function FlexContainer(
26
+ {
27
+ children,
28
+ direction = 'row',
29
+ wrap = 'nowrap',
30
+ justify = 'flex-start',
31
+ align = 'stretch',
32
+ alignContent,
33
+ gap,
34
+ rowGap,
35
+ columnGap,
36
+ className,
37
+ style,
38
+ as = 'div',
39
+ },
40
+ ref
41
+ ) {
39
42
  return (
40
43
  <StyledFlexContainer
41
44
  as={as}
@@ -49,11 +52,12 @@ export const FlexContainer = ({
49
52
  $columnGap={columnGap}
50
53
  className={className}
51
54
  style={style}
55
+ ref={ref}
52
56
  >
53
57
  {children}
54
58
  </StyledFlexContainer>
55
59
  );
56
- };
60
+ });
57
61
 
58
62
  interface StyledFlexContainerProps {
59
63
  $direction: FlexDirection;
@@ -1,6 +1,6 @@
1
1
  import ForceGraph2D, { ForceGraphMethods, LinkObject, NodeObject } from 'react-force-graph-2d';
2
2
  import { Graph2DProps } from './types';
3
- import { useEffect, useRef, useState, useCallback, useLayoutEffect } from 'react';
3
+ import { useEffect, useRef, useState, useCallback } from 'react';
4
4
  import { forceCollide } from 'd3-force';
5
5
  import { styled, useTheme } from 'styled-components';
6
6
  import eyeLightIcon from './eye_light.png';
@@ -11,16 +11,16 @@ import GraphLoader from './GraphLoader';
11
11
 
12
12
  // Створюємо та налаштовуємо об'єкти зображень
13
13
  const imgEyeLightIcon = new Image();
14
- imgEyeLightIcon.src = eyeLightIcon;
14
+ imgEyeLightIcon.src = eyeLightIcon.replace('./', '/');
15
15
 
16
16
  const imgEyeLightHoverIcon = new Image();
17
- imgEyeLightHoverIcon.src = eyeLightHoverIcon;
17
+ imgEyeLightHoverIcon.src = eyeLightHoverIcon.replace('./', '/');
18
18
 
19
19
  const imgGroupLightIcon = new Image();
20
- imgGroupLightIcon.src = groupLightIcon;
20
+ imgGroupLightIcon.src = groupLightIcon.replace('./', '/');
21
21
 
22
22
  const imgGroupLightHoverIcon = new Image();
23
- imgGroupLightHoverIcon.src = groupLightHoverIcon;
23
+ imgGroupLightHoverIcon.src = groupLightHoverIcon.replace('./', '/');
24
24
 
25
25
  export const Graph2D = ({
26
26
  graphData,
@@ -274,9 +274,9 @@ export const Graph2D = ({
274
274
  const iconSize = buttonRadius * 0.3; // Розмір іконки відносно радіуса кнопки (зменшено вдвічі)
275
275
 
276
276
  // Вибір іконки в залежності від стану наведення для верхньої кнопки (сховати)
277
- const groupIcon = hoverTopButton ? imgGroupLightHoverIcon : imgGroupLightIcon;
277
+ const groupIcon = hoverBottomButton ? imgGroupLightHoverIcon : imgGroupLightIcon;
278
278
  // Додаємо іконку ока для кнопки "згорнути дочірні вузли"
279
- const eyeIcon = hoverBottomButton ? imgEyeLightHoverIcon : imgEyeLightIcon;
279
+ const eyeIcon = hoverTopButton ? imgEyeLightHoverIcon : imgEyeLightIcon;
280
280
 
281
281
  const renderEyeIcon = () => {
282
282
  try {
@@ -308,17 +308,17 @@ export const Graph2D = ({
308
308
  }
309
309
  };
310
310
  // Використовуємо безпосередньо зображення, якщо воно вже завантажене
311
- if (eyeIcon.complete) {
311
+ if (groupIcon.complete) {
312
312
  // Розміщуємо іконку в центрі нижньої половини кнопки
313
313
 
314
314
  renderGroupIcon();
315
315
  } else {
316
316
  // Якщо зображення ще не завантажене, додаємо обробник завершення завантаження
317
- eyeIcon.onload = () => {
317
+ groupIcon.onload = () => {
318
318
  renderGroupIcon();
319
319
  };
320
320
 
321
- eyeIcon.onerror = () => {
321
+ groupIcon.onerror = () => {
322
322
  console.warn('Error loading eye icon image');
323
323
  };
324
324
  }
@@ -560,7 +560,7 @@ export const Graph2D = ({
560
560
  };
561
561
 
562
562
  const renderGrid = (ctx: CanvasRenderingContext2D, globalScale: number) => {
563
- if (isRendering) return; // Не малюємо сітку під час рендерингу
563
+ if (isRendering || loading) return; // Не малюємо сітку під час рендерингу
564
564
  // This will be called before each rendering frame
565
565
  ctx.getTransform();
566
566
  ctx.save();
@@ -14,7 +14,7 @@ export const darkThemePx: Theme = {
14
14
  baseSize: 14, // Базовий розмір шрифту для конвертації px в rem
15
15
  // Секція кольорів з теми
16
16
  colors: {
17
- background: '#0A0A0A',
17
+ background: '#0F1317',
18
18
  backgroundBase: '#000000',
19
19
  primary: {
20
20
  main: '#158EFF',
@@ -318,7 +318,7 @@ export const darkThemePx: Theme = {
318
318
  boxShadow: 'none',
319
319
  filledIcon: {
320
320
  background: '#158EFF',
321
- color: '#0A0A0A',
321
+ color: '#0F1317',
322
322
  },
323
323
  },
324
324
  active: {
@@ -328,7 +328,7 @@ export const darkThemePx: Theme = {
328
328
  boxShadow: 'none',
329
329
  filledIcon: {
330
330
  background: '#158EFF',
331
- color: '#0A0A0A',
331
+ color: '#0F1317',
332
332
  },
333
333
  },
334
334
  disabled: {
@@ -423,7 +423,7 @@ export const darkThemePx: Theme = {
423
423
 
424
424
  // Компонент Sidebar
425
425
  sidebar: {
426
- background: '#0A0A0A',
426
+ background: '#0F1317',
427
427
  border: '#1E2226',
428
428
  width: 224,
429
429
  collapsedWidth: 65,
@@ -674,7 +674,7 @@ export const darkThemePx: Theme = {
674
674
  style: 'solid',
675
675
  color: '#1E2226',
676
676
  },
677
- background: '#0A0A0A',
677
+ background: '#0F1317',
678
678
  },
679
679
  // Graph2D
680
680
  graph2D: {
@@ -698,8 +698,8 @@ export const lightThemePx: Theme = {
698
698
  },
699
699
  },
700
700
  contentLoader: {
701
- foreground: '#535353',
702
- background: '#99989C',
701
+ foreground: '#E2E2E2E2',
702
+ background: '#F3F3F3',
703
703
  },
704
704
  };
705
705