@true-engineering/true-react-common-ui-kit 3.57.0 → 3.59.0

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": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.57.0",
3
+ "version": "3.59.0",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -1,9 +1,5 @@
1
1
  import { ITweakStyles, animations, createThemedStyles } from '../../theme';
2
2
 
3
- const BUTTON_SIZE_S = 24;
4
- const BUTTON_SIZE_M = 32;
5
- const ICON_SIZE = 20;
6
-
7
3
  export const useStyles = createThemedStyles('IconButton', {
8
4
  root: {
9
5
  display: 'flex',
@@ -13,7 +9,7 @@ export const useStyles = createThemedStyles('IconButton', {
13
9
  outline: 'none',
14
10
  boxSizing: 'border-box',
15
11
  transition: animations.defaultTransition,
16
- transitionProperty: 'background-color, color, border-color',
12
+ transitionProperty: 'background-color, color, border-color, opacity, visibility',
17
13
  border: 'none',
18
14
  position: 'relative',
19
15
  boxShadow: 'none',
@@ -29,6 +25,10 @@ export const useStyles = createThemedStyles('IconButton', {
29
25
  '&:active': {
30
26
  extend: 'active',
31
27
  },
28
+
29
+ width: 'var(--icon-button-size)',
30
+ height: 'var(--icon-button-size)',
31
+ '--icon-button-icon-size': '20px',
32
32
  },
33
33
 
34
34
  'cancel-light': {},
@@ -55,8 +55,8 @@ export const useStyles = createThemedStyles('IconButton', {
55
55
  icon: {
56
56
  display: 'flex',
57
57
  alignItems: 'center',
58
- width: ICON_SIZE,
59
- height: ICON_SIZE,
58
+ width: 'var(--icon-button-icon-size)',
59
+ height: 'var(--icon-button-icon-size)',
60
60
  },
61
61
 
62
62
  loader: {
@@ -66,18 +66,20 @@ export const useStyles = createThemedStyles('IconButton', {
66
66
  top: '50%',
67
67
  transform: 'translate(-50%, -50%)',
68
68
 
69
- width: ICON_SIZE,
70
- height: ICON_SIZE,
69
+ width: 'var(--icon-button-icon-size)',
70
+ height: 'var(--icon-button-icon-size)',
71
71
  },
72
72
 
73
73
  s: {
74
- width: BUTTON_SIZE_S,
75
- height: BUTTON_SIZE_S,
74
+ '--icon-button-size': '24px',
76
75
  },
77
76
 
78
77
  m: {
79
- width: BUTTON_SIZE_M,
80
- height: BUTTON_SIZE_M,
78
+ '--icon-button-size': '32px',
79
+ },
80
+
81
+ l: {
82
+ '--icon-button-size': '40px',
81
83
  },
82
84
  });
83
85
 
@@ -1,3 +1,3 @@
1
- export const ICON_BUTTON_SIZES = ['s', 'm'] as const;
1
+ export const ICON_BUTTON_SIZES = ['s', 'm', 'l'] as const;
2
2
 
3
3
  export const ICON_BUTTON_VIEWS = ['cancel', 'cancel-light', 'main', 'custom'] as const;
@@ -80,7 +80,11 @@ export interface IInputProps
80
80
  shouldFocusOnMount?: boolean;
81
81
  /** @default false */
82
82
  shouldAlwaysShowPlaceholder?: boolean;
83
- onChange: (value: string, event: FormEvent<HTMLInputElement>) => void;
83
+ onChange: (
84
+ value: string,
85
+ event: FormEvent<HTMLInputElement>,
86
+ eventType: 'change' | 'clear',
87
+ ) => void;
84
88
  onIconClick?: () => void;
85
89
  }
86
90
 
@@ -139,7 +143,7 @@ export const Input = forwardRef<HTMLInputElement, IInputProps>(
139
143
  const inputRef = useRef<HTMLInputElement>(null);
140
144
 
141
145
  const handleChange = (event: FormEvent<HTMLInputElement>) => {
142
- onChange(event.currentTarget.value, event);
146
+ onChange(event.currentTarget.value, event, 'change');
143
147
  };
144
148
 
145
149
  const handleFocus = (event: FocusEvent<HTMLInputElement>) => {
@@ -155,7 +159,7 @@ export const Input = forwardRef<HTMLInputElement, IInputProps>(
155
159
  // для SmartInput нужен event, иначе onChange не вызовется
156
160
  const handleOnInputClear = async (event: MouseEvent<HTMLDivElement>) => {
157
161
  // await не убирать (важно для порядка выполнения (сначала onChange, затем focus)
158
- await onChange('', event as any);
162
+ await onChange('', event as any, 'clear');
159
163
  const input = (ref as MutableRefObject<HTMLInputElement>) ?? inputRef;
160
164
  input.current?.focus();
161
165
  };