@cyber-harbour/ui 1.0.23 → 1.0.25

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.23",
3
+ "version": "1.0.25",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -6,8 +6,11 @@ interface InfoCircleIconProps extends SVGProps<SVGSVGElement> {
6
6
 
7
7
  export const CheckIcon = ({ fill = 'currentColor', ...props }: InfoCircleIconProps) => {
8
8
  return (
9
- <svg viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
10
- <path d="M14.4983 1L5.34428 11L1.18338 6.45455" stroke={fill} stroke-width="1.5" stroke-linejoin="round" />;
9
+ <svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
10
+ <path
11
+ d="M9.796 6.706c-3.438 3.638-4.457 4.698-4.481 4.671l-3.552-3.768c-0.026-0.028-0.193 0.115-0.792 0.678-0.418 0.394-0.759 0.727-0.759 0.739 0 0.011 1.010 1.091 2.245 2.396 2.080 2.2 2.258 2.381 2.425 2.462 0.32 0.158 0.729 0.142 1.015-0.038 0.149-0.094-0.051 0.115 5.257-5.502l4.634-4.902-0.752-0.715c-0.233-0.223-0.484-0.458-0.738-0.691l-0.034-0.030c-1.295 1.344-2.752 2.874-4.201 4.413l-0.268 0.287z"
12
+ fill={fill}
13
+ ></path>
11
14
  </svg>
12
15
  );
13
16
  };
@@ -0,0 +1,16 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ interface DataSetsIconProps extends SVGProps<SVGSVGElement> {
4
+ fill?: string;
5
+ }
6
+
7
+ export const CrossIcon = ({ fill = 'currentColor', ...props }: DataSetsIconProps) => {
8
+ return (
9
+ <svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
10
+ <path
11
+ d="M15.595 13.176c0.282 0.282 0.376 0.565 0.376 0.941s-0.188 0.753-0.376 0.941c-0.471 0.565-1.412 0.565-1.882 0l-5.176-5.176-5.176 5.176c-0.471 0.471-1.412 0.471-1.882 0s-0.376-0.565-0.376-0.941c0-0.376 0.188-0.659 0.376-0.941l5.176-5.176-0.376-0.376-4.988-4.8c-0.282-0.282-0.376-0.565-0.376-0.941s0.188-0.753 0.376-1.035c0.282-0.282 0.659-0.376 0.941-0.376s0.659 0.094 0.941 0.376l5.176 5.176 0.376-0.376 4.894-4.8c0.282-0.282 0.659-0.376 0.941-0.376s0.659 0.094 0.941 0.376c0.282 0.282 0.376 0.565 0.376 0.941s-0.188 0.753-0.376 0.941l-5.176 5.176 5.271 5.271z"
12
+ fill={fill}
13
+ ></path>
14
+ </svg>
15
+ );
16
+ };
@@ -0,0 +1,18 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ interface InfoCircleIconProps extends SVGProps<SVGSVGElement> {
4
+ fill?: string;
5
+ }
6
+
7
+ export const InfoCircleFilledIcon = ({ fill = 'currentColor', ...props }: InfoCircleIconProps) => {
8
+ return (
9
+ <svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
10
+ <path
11
+ fill-rule="evenodd"
12
+ clip-rule="evenodd"
13
+ d="M8 15C9.85652 15 11.637 14.2625 12.9497 12.9497C14.2625 11.637 15 9.85652 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1C6.14348 1 4.36301 1.7375 3.05025 3.05025C1.7375 4.36301 1 6.14348 1 8C1 9.85652 1.7375 11.637 3.05025 12.9497C4.36301 14.2625 6.14348 15 8 15ZM8 4C8.19891 4 8.38968 4.07902 8.53033 4.21967C8.67098 4.36032 8.75 4.55109 8.75 4.75V7.75C8.75 7.94891 8.67098 8.13968 8.53033 8.28033C8.38968 8.42098 8.19891 8.5 8 8.5C7.80109 8.5 7.61032 8.42098 7.46967 8.28033C7.32902 8.13968 7.25 7.94891 7.25 7.75V4.75C7.25 4.55109 7.32902 4.36032 7.46967 4.21967C7.61032 4.07902 7.80109 4 8 4ZM8 12C8.26522 12 8.51957 11.8946 8.70711 11.7071C8.89464 11.5196 9 11.2652 9 11C9 10.7348 8.89464 10.4804 8.70711 10.2929C8.51957 10.1054 8.26522 10 8 10C7.73478 10 7.48043 10.1054 7.29289 10.2929C7.10536 10.4804 7 10.7348 7 11C7 11.2652 7.10536 11.5196 7.29289 11.7071C7.48043 11.8946 7.73478 12 8 12Z"
14
+ fill={fill}
15
+ />
16
+ </svg>
17
+ );
18
+ };
@@ -0,0 +1,20 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ interface DataSetsIconProps extends SVGProps<SVGSVGElement> {
4
+ fill?: string;
5
+ }
6
+
7
+ export const UnfoldIcon = ({ fill = 'currentColor', ...props }: DataSetsIconProps) => {
8
+ return (
9
+ <svg viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
10
+ <path
11
+ d="M3.765 3.97l3.109-3.219c0.362-0.375 0.949-0.375 1.311 0l3.109 3.219-0.983 1.018-2.781-2.879-2.781 2.879-0.983-1.018z"
12
+ fill={fill}
13
+ ></path>
14
+ <path
15
+ d="M11.294 12.029l-3.109 3.219c-0.362 0.375-0.949 0.375-1.311 0l-3.109-3.219 0.983-1.018 2.781 2.879 2.781-2.879 0.983 1.018z"
16
+ fill={fill}
17
+ ></path>
18
+ </svg>
19
+ );
20
+ };
@@ -38,3 +38,6 @@ export { ChevronDownIcon } from './ChevronDown';
38
38
  export { ChevronUpIcon } from './ChevronUp';
39
39
  export { PlusIcon } from './Plus';
40
40
  export { UsersIcon } from './Users';
41
+ export { InfoCircleFilledIcon } from './InfoCircleFilled';
42
+ export { UnfoldIcon } from './Unfold';
43
+ export { CrossIcon } from './Cross';
@@ -0,0 +1,133 @@
1
+ import { InputSize, InputSizeStyle } from '../../Theme';
2
+ import { InputHTMLAttributes } from 'react';
3
+ import { styled } from 'styled-components';
4
+ import { InfoCircleFilledIcon } from '../IconComponents';
5
+
6
+ type StyledProps = {
7
+ $error?: boolean;
8
+ $sizes: InputSizeStyle;
9
+ };
10
+
11
+ type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
12
+ error?: boolean;
13
+ append?: any;
14
+ prepend?: any;
15
+ size?: InputSize;
16
+ };
17
+
18
+ export const Input = ({ error, append, prepend, size = 'small', disabled, className, ...props }: InputProps) => {
19
+ return (
20
+ <Group className={className} $error={error} $size={size} $disabled={!!disabled}>
21
+ {!!prepend && prepend}
22
+ <InputGroup $size={size}>
23
+ <input {...props} disabled={disabled} />
24
+ {!!error && (
25
+ <IconWrapper>
26
+ <InfoCircleFilledIcon />
27
+ </IconWrapper>
28
+ )}
29
+ </InputGroup>
30
+ {!!append && append}
31
+ </Group>
32
+ );
33
+ };
34
+
35
+ const InputGroup = styled.div<{ $size: InputSize }>(
36
+ ({ theme, $size }) => `
37
+ display: inline-flex;
38
+ align-items: center;
39
+ width: 100%;
40
+ color: currentColor;
41
+
42
+ svg {
43
+ width: ${theme.input.sizes[$size].iconSize};
44
+ height: ${theme.input.sizes[$size].iconSize};
45
+ }
46
+
47
+ & input {
48
+ font-size: ${theme.input.sizes[$size].fontSize};
49
+ color: inherit;
50
+ background: transparent;
51
+ padding-block: ${theme.input.sizes[$size].paddingBlock};
52
+ padding-inline: ${theme.input.sizes[$size].paddingInline};
53
+ position: relative;
54
+ width: 100%;
55
+ outline: none;
56
+ border: none;
57
+
58
+ &::placeholder {
59
+ color: ${theme.input.outlined.default.placeholder};
60
+ font-size: ${theme.input.sizes[$size].fontSize};
61
+ }
62
+
63
+ &:disabled {
64
+ cursor: not-allowed;
65
+ color: inherit;
66
+ }
67
+ }
68
+ `
69
+ );
70
+
71
+ const IconWrapper = styled.span(
72
+ ({ theme }) => `
73
+ display: inline-flex;
74
+ flex: 0 0 auto;
75
+ align-items: center;
76
+ color: ${theme.input.outlined.error.icon};
77
+ margin-right: 10px;
78
+
79
+ `
80
+ );
81
+
82
+ const Group = styled.div<{ $disabled: boolean; $error?: boolean; $size: InputSize }>(
83
+ ({ theme, $disabled, $error, $size }) => `
84
+ display: inline-flex;
85
+ align-items: center;
86
+ width: 100%;
87
+ border: 1px solid;
88
+ border-radius: ${theme.input.sizes[$size].borderRadius};
89
+ height: ${theme.input.sizes[$size].height};
90
+ overflow: hidden;
91
+ transition: all 0.2s ease;
92
+
93
+ ${
94
+ $error
95
+ ? `
96
+ border-color: ${theme.input.outlined.error.border};
97
+ color: ${theme.input.outlined.error.text};
98
+ background: ${theme.input.outlined.error.background};
99
+ `
100
+ : `
101
+ border-color: ${theme.input.outlined.default.border};
102
+ color: ${theme.input.outlined.default.text};
103
+ background: ${theme.input.outlined.default.background};
104
+ `
105
+ }
106
+
107
+ ${
108
+ !$disabled &&
109
+ !$error &&
110
+ `
111
+ &:hover {
112
+ border-color: ${theme.input.outlined.focus.border};
113
+ }
114
+
115
+ &:focus-within {
116
+ border-color: ${theme.input.outlined.focus.border};
117
+ color: ${theme.input.outlined.focus.text};
118
+ background: ${theme.input.outlined.focus.background};
119
+ }
120
+ `
121
+ }
122
+
123
+ ${
124
+ $disabled &&
125
+ `
126
+ border-color: ${theme.input.outlined.disabled.border};
127
+ color: ${theme.input.outlined.disabled.text};
128
+ background: ${theme.input.outlined.disabled.background};
129
+ cursor: not-allowed;
130
+ `
131
+ }
132
+ `
133
+ );
@@ -0,0 +1 @@
1
+ export * from './Input';
package/src/Core/index.ts CHANGED
@@ -9,3 +9,4 @@ export * from './Pagination';
9
9
  export * from './ContextMenu';
10
10
  export * from './Select';
11
11
  export * from './RowActionsMenu';
12
+ export * from './Input';
@@ -578,6 +578,61 @@ export const lightThemePx: Theme = {
578
578
  size: 16,
579
579
  },
580
580
  },
581
+ // Компонент Input
582
+ input: {
583
+ sizes: {
584
+ small: {
585
+ fontSize: 14,
586
+ paddingInline: 10,
587
+ paddingBlock: 10,
588
+ borderRadius: 5,
589
+ iconSize: 14,
590
+ height: 40,
591
+ },
592
+ medium: {
593
+ fontSize: 16,
594
+ paddingInline: 10,
595
+ paddingBlock: 10,
596
+ borderRadius: 5,
597
+ iconSize: 16,
598
+ height: 40,
599
+ },
600
+ },
601
+ outlined: {
602
+ default: {
603
+ background: 'transparent',
604
+ text: '#101010',
605
+ placeholder: '#99989C',
606
+ border: ' #EBEBEB',
607
+ boxShadow: 'none',
608
+ icon: '#101010',
609
+ },
610
+ focus: {
611
+ background: 'transparent',
612
+ text: '#101010',
613
+ placeholder: '#99989C',
614
+ border: ' #0042EC',
615
+ boxShadow: 'none',
616
+ icon: '#101010',
617
+ },
618
+ error: {
619
+ background: 'transparent',
620
+ text: '#101010',
621
+ placeholder: '#99989C',
622
+ border: ' #C93939',
623
+ boxShadow: 'none',
624
+ icon: '#C93939',
625
+ },
626
+ disabled: {
627
+ background: '#FAFAFA',
628
+ text: '#99989C',
629
+ placeholder: '#99989C',
630
+ border: ' #EBEBEB',
631
+ boxShadow: 'none',
632
+ icon: '#99989C',
633
+ },
634
+ },
635
+ },
581
636
  };
582
637
 
583
638
  // Конвертуємо всі розміри з px в rem
@@ -6,9 +6,9 @@ export type ButtonColor = 'default' | 'primary' | 'secondary' | 'error';
6
6
  export type ButtonState = 'default' | 'hover' | 'active' | 'disabled';
7
7
  export type ButtonSize = 'small' | 'medium';
8
8
 
9
- export type InputVariant = 'default' | 'outlined' | 'filled';
9
+ export type InputVariant = 'outlined';
10
10
  export type InputState = 'default' | 'focus' | 'error' | 'disabled';
11
- export type InputSize = 'small' | 'medium' | 'large';
11
+ export type InputSize = 'small' | 'medium';
12
12
 
13
13
  // Типи для spacing та breakpoints
14
14
  export type Breakpoint = 'xs' | 's' | 'm' | 'l' | 'xl';
@@ -32,6 +32,26 @@ export type ButtonSizeStyle = {
32
32
  iconSize: number | string;
33
33
  };
34
34
 
35
+ // Тип для стилів елементів інпута
36
+ export type InputElementStyle = {
37
+ background: string;
38
+ text: string;
39
+ placeholder: string;
40
+ border: string;
41
+ boxShadow: string;
42
+ icon: string;
43
+ };
44
+
45
+ // Тип для розмірів інпута
46
+ export type InputSizeStyle = {
47
+ fontSize: number | string;
48
+ paddingInline: number | string;
49
+ paddingBlock: number | string;
50
+ borderRadius: number | string;
51
+ iconSize: number | string;
52
+ height: number | string;
53
+ };
54
+
35
55
  // Тип для палітри
36
56
  export type Theme = {
37
57
  mode: 'light' | 'dark';
@@ -151,6 +171,7 @@ export type Theme = {
151
171
  select: {
152
172
  item: Record<ButtonState, ButtonElementStyle>;
153
173
  };
174
+ // RowActionsMenu
154
175
  rowActionsMenu: {
155
176
  button: Record<ButtonState, ButtonElementStyle>;
156
177
  delimiterColor: string;
@@ -158,6 +179,11 @@ export type Theme = {
158
179
  size: number | string;
159
180
  };
160
181
  };
182
+ //Input
183
+ input: {
184
+ sizes: Record<InputSize, InputSizeStyle>;
185
+ outlined: Record<InputState, InputElementStyle>;
186
+ };
161
187
  };
162
188
 
163
189
  //TODO check and refactoring
@@ -1,5 +1,5 @@
1
1
  import { DefaultTheme } from 'styled-components';
2
- import { Breakpoint, ButtonColor, ButtonSize, ButtonState, ButtonVariant } from './types';
2
+ import { Breakpoint, ButtonColor, ButtonSize, ButtonState, ButtonVariant, InputSize, InputState } from './types';
3
3
 
4
4
  /**
5
5
  * Helper function to resolve nested color paths from theme