@cyber-harbour/ui 1.0.64 → 1.0.66

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.64",
3
+ "version": "1.0.66",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,28 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ interface FolderInfoIconProps extends SVGProps<SVGSVGElement> {
4
+ fill?: string;
5
+ }
6
+
7
+ export const FolderInfoIcon = ({ fill = 'currentColor', ...props }: FolderInfoIconProps) => {
8
+ return (
9
+ <svg viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
10
+ <path
11
+ d="M14.9123 2.84018H9.23227C8.97227 2.06018 8.61227 1.54018 7.73227 1.47018C7.39227 1.49018 7.07227 1.49018 6.73227 1.49018C6.20227 1.49018 5.66227 1.49018 5.12227 1.46018C4.59227 1.44018 4.04227 1.43018 3.52227 1.43018C3.09227 1.43018 2.66227 1.43018 2.24227 1.47018C1.20227 1.54018 0.452274 2.29018 0.372274 3.33018C0.392274 4.72018 0.372274 6.10018 0.372274 7.49018C0.372274 9.65018 0.352274 11.9002 0.422274 14.1202C0.652274 14.9902 1.31227 15.5102 2.23227 15.5702H13.2723C14.9923 15.4602 16.2623 14.2002 16.3623 12.4802V4.39018C16.3023 3.56018 15.7323 2.96018 14.9023 2.84018H14.9123ZM15.3523 5.32018H10.1723L9.61227 3.86018H14.9323C15.0423 3.86018 15.3423 4.17018 15.3423 4.27018V5.32018H15.3523ZM2.00227 12.0402L1.42227 13.9602C1.42227 13.9602 1.40227 13.8502 1.39227 13.8102V3.30018C1.41227 2.89018 1.75227 2.53018 2.16227 2.47018H7.73227C7.90227 2.47018 8.03227 2.57018 8.14227 2.78018C8.35227 3.16018 8.51227 3.64018 8.65227 4.10018C8.79227 4.52018 8.93227 4.97018 9.10227 5.32018H5.47227C4.82227 5.32018 4.01227 5.85018 3.70227 6.51018C3.10227 8.35018 2.54227 10.1902 1.99227 12.0402H2.00227ZM15.3523 12.6702C15.3523 13.4802 14.2523 14.5702 13.4323 14.5702H2.26227L4.58227 6.98018C4.68227 6.70018 5.15227 6.33018 5.40227 6.33018H15.3523V12.6702Z"
12
+ fill={fill}
13
+ />
14
+ <path
15
+ d="M7.85237 12.4204C6.54237 11.1004 6.94236 8.6304 8.69236 7.9004C10.9824 6.9504 13.2024 9.0304 12.4224 11.3804C11.7924 13.2804 9.24237 13.8204 7.85237 12.4204ZM9.68237 8.4704C8.23237 8.5704 7.33237 10.2504 8.17237 11.5004C9.01237 12.7504 10.7724 12.7404 11.5324 11.4204C12.2924 10.1004 11.1824 8.3704 9.68237 8.4704Z"
16
+ fill={fill}
17
+ />
18
+ <path
19
+ d="M9.7724 8.93011C10.0324 8.90011 10.1924 9.11011 10.2224 9.35011C10.2424 9.55011 10.2524 10.2001 10.2224 10.3801C10.1424 10.7501 9.5824 10.8001 9.4524 10.4401C9.3824 10.2601 9.3824 9.39011 9.4524 9.20011C9.5024 9.07011 9.6424 8.95011 9.7824 8.93011H9.7724Z"
20
+ fill={fill}
21
+ />
22
+ <path
23
+ d="M9.71242 10.9701C10.3924 10.8301 10.3424 11.9101 9.65242 11.7001C9.36242 11.6101 9.36242 11.0401 9.71242 10.9701Z"
24
+ fill={fill}
25
+ />
26
+ </svg>
27
+ );
28
+ };
@@ -61,3 +61,4 @@ export { PointIcon } from './PointIcon';
61
61
  export { PencilIcon } from './PencilIcon';
62
62
  export { UserInCircleIcon } from './UserInCircle';
63
63
  export { FlashIcon } from './FlashIcon';
64
+ export { FolderInfoIcon } from './FolderInfoIcon';
@@ -1,35 +1,39 @@
1
1
  import { styled } from 'styled-components';
2
2
  import React from 'react';
3
3
  import { SidebarContext } from './SidebarContext';
4
+ import { createComponent } from '../../Theme';
4
5
 
5
6
  export interface SidebarProps {
6
7
  defaultCollapsed?: boolean;
7
8
  children: any;
9
+ canGrow: boolean;
8
10
  }
9
11
 
10
12
  interface StyledProps {
11
13
  $collapsed: boolean;
14
+ $canGrow: boolean;
12
15
  }
13
16
 
14
- export const Sidebar = ({ defaultCollapsed, children }: SidebarProps) => {
17
+ export const Sidebar = createComponent<SidebarProps>(({ defaultCollapsed, canGrow, children }) => {
15
18
  const [collapsed, setCollapsed] = React.useState(!!defaultCollapsed);
16
19
 
17
20
  return (
18
- <StyledContainer $collapsed={collapsed}>
21
+ <StyledContainer $collapsed={collapsed} $canGrow={canGrow}>
19
22
  <SidebarContext.Provider
20
23
  value={{
21
24
  collapsed,
22
25
  setCollapsed,
26
+ canGrow,
23
27
  }}
24
28
  >
25
29
  {children}
26
30
  </SidebarContext.Provider>
27
31
  </StyledContainer>
28
32
  );
29
- };
33
+ });
30
34
 
31
35
  const StyledContainer = styled.aside<StyledProps>(
32
- ({ theme, $collapsed }) => `
36
+ ({ theme, $collapsed, $canGrow }) => `
33
37
  display: flex;
34
38
  flex-direction: column;
35
39
  justify-content: space-between;
@@ -40,10 +44,11 @@ const StyledContainer = styled.aside<StyledProps>(
40
44
  width: ${theme.sidebar.width};
41
45
  padding: 12px;
42
46
  height: 100%;
47
+ overflow: hidden auto;
43
48
  border-right: 1px solid ${theme.sidebar.border};
44
49
  background: ${theme.sidebar.background};
45
50
  ${
46
- $collapsed
51
+ $collapsed || !$canGrow
47
52
  ? `
48
53
  width: 65px;
49
54
  `
@@ -64,7 +69,7 @@ const StyledContainer = styled.aside<StyledProps>(
64
69
 
65
70
  width: ${theme.sidebar.width};
66
71
  ${
67
- $collapsed
72
+ $collapsed || !$canGrow
68
73
  ? `
69
74
  width: 65px;
70
75
  `
@@ -3,9 +3,11 @@ import { createContext } from 'react';
3
3
  interface SidebarContext {
4
4
  collapsed: boolean;
5
5
  setCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
6
+ canGrow: boolean;
6
7
  }
7
8
 
8
9
  export const SidebarContext = createContext<SidebarContext>({
9
10
  collapsed: false,
10
11
  setCollapsed: () => {},
12
+ canGrow: false,
11
13
  });
@@ -4,15 +4,16 @@ import { styled } from 'styled-components';
4
4
 
5
5
  type StyledProps = {
6
6
  $collapsed: boolean;
7
+ $canGrow: boolean;
7
8
  };
8
9
 
9
10
  export const SidebarDelimeter = () => {
10
- const { collapsed } = useContext(SidebarContext);
11
- return <StyledDelimeter $collapsed={collapsed} />;
11
+ const { collapsed, canGrow } = useContext(SidebarContext);
12
+ return <StyledDelimeter $collapsed={collapsed} $canGrow={canGrow} />;
12
13
  };
13
14
 
14
15
  const StyledDelimeter = styled.div<StyledProps>(
15
- ({ $collapsed, theme }) => `
16
+ ({ $collapsed, $canGrow, theme }) => `
16
17
  min-width: 32px;
17
18
  width: 0;
18
19
 
@@ -22,6 +23,7 @@ const StyledDelimeter = styled.div<StyledProps>(
22
23
 
23
24
  ${
24
25
  !$collapsed &&
26
+ $canGrow &&
25
27
  `
26
28
  & {
27
29
  width: 100%;
@@ -17,6 +17,7 @@ interface SidebarItemAnchor {
17
17
  type StyledProps = {
18
18
  $active: SidebarItemBase['active'];
19
19
  $collapsed: boolean;
20
+ $canGrow: boolean;
20
21
  };
21
22
 
22
23
  interface SidebarItemButton {
@@ -27,7 +28,7 @@ interface SidebarItemButton {
27
28
  export type SidebarItemProps = SidebarItemBase & (SidebarItemAnchor | SidebarItemButton);
28
29
 
29
30
  export const SidebarItem = ({ active, icon: Icon, label, ...props }: SidebarItemProps) => {
30
- const { collapsed } = useContext(SidebarContext);
31
+ const { collapsed, canGrow } = useContext(SidebarContext);
31
32
 
32
33
  const isAnchor = 'href' in props;
33
34
 
@@ -37,10 +38,11 @@ export const SidebarItem = ({ active, icon: Icon, label, ...props }: SidebarItem
37
38
  as={isAnchor ? 'a' : 'button'}
38
39
  $collapsed={collapsed}
39
40
  $active={active}
41
+ $canGrow={canGrow}
40
42
  {...props}
41
43
  >
42
44
  {Icon && <Icon aria-label={label} width={16} height={16} />}
43
- <StyledText $collapsed={collapsed} $active={active}>
45
+ <StyledText $collapsed={collapsed} $active={active} $canGrow={canGrow}>
44
46
  {label}
45
47
  </StyledText>
46
48
  </StyledItem>
@@ -48,7 +50,7 @@ export const SidebarItem = ({ active, icon: Icon, label, ...props }: SidebarItem
48
50
  };
49
51
 
50
52
  const StyledText = styled.span<StyledProps>(
51
- ({ $collapsed }) => `
53
+ ({ $collapsed, $canGrow }) => `
52
54
  margin-top: 2px;
53
55
  overflow: hidden;
54
56
  white-space: nowrap;
@@ -62,18 +64,19 @@ const StyledText = styled.span<StyledProps>(
62
64
  font-family: Inter;
63
65
 
64
66
  ${
65
- $collapsed &&
66
- `
67
+ $collapsed || !$canGrow
68
+ ? `
67
69
  & {
68
70
  width: 0;
69
71
  }
70
72
  `
73
+ : ''
71
74
  }
72
75
  `
73
76
  );
74
77
 
75
78
  const StyledItem = styled.a<StyledProps>(
76
- ({ $active, $collapsed, theme }) => `
79
+ ({ $active, $collapsed, $canGrow, theme }) => `
77
80
  display: flex;
78
81
  align-items: center;
79
82
  gap: 12px;
@@ -96,7 +99,7 @@ const StyledItem = styled.a<StyledProps>(
96
99
  `
97
100
  : ''
98
101
  }
99
- ${$collapsed ? `gap: 0;` : ''}
102
+ ${$collapsed || !$canGrow ? `gap: 0;` : ''}
100
103
 
101
104
 
102
105