@true-engineering/true-react-common-ui-kit 3.10.0 → 3.12.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.
Files changed (35) hide show
  1. package/README.md +16 -0
  2. package/dist/components/Checkbox/Checkbox.d.ts +8 -7
  3. package/dist/components/Checkbox/Checkbox.stories.d.ts +8 -5
  4. package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -1
  5. package/dist/theme/common.d.ts +2 -0
  6. package/dist/true-react-common-ui-kit.js +102 -161
  7. package/dist/true-react-common-ui-kit.js.map +1 -1
  8. package/dist/true-react-common-ui-kit.umd.cjs +102 -161
  9. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  10. package/package.json +1 -1
  11. package/src/components/AccountInfo/AccountInfo.styles.ts +3 -2
  12. package/src/components/Button/Button.styles.ts +2 -2
  13. package/src/components/Checkbox/Checkbox.stories.tsx +40 -14
  14. package/src/components/Checkbox/Checkbox.styles.ts +4 -2
  15. package/src/components/Checkbox/Checkbox.tsx +21 -25
  16. package/src/components/CloseButton/CloseButton.styles.ts +3 -2
  17. package/src/components/FiltersPane/FiltersPane.styles.ts +3 -2
  18. package/src/components/FiltersPane/components/FilterSelect/FilterSelect.styles.ts +3 -2
  19. package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.ts +2 -2
  20. package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.ts +8 -2
  21. package/src/components/FlexibleTable/FlexibleTable.styles.ts +3 -2
  22. package/src/components/Icon/icons-list.ts +5 -13
  23. package/src/components/IconButton/IconButton.styles.ts +2 -2
  24. package/src/components/IncrementInput/IncrementInput.styles.ts +3 -2
  25. package/src/components/Input/Input.styles.ts +6 -5
  26. package/src/components/List/List.styles.ts +3 -2
  27. package/src/components/List/components/ListItem/ListItem.styles.ts +3 -2
  28. package/src/components/MoreMenu/MoreMenu.styles.ts +3 -2
  29. package/src/components/MultiSelectList/MultiSelectList.tsx +9 -6
  30. package/src/components/NewMoreMenu/NewMoreMenu.styles.ts +3 -2
  31. package/src/components/Selector/Selector.styles.ts +4 -3
  32. package/src/components/Switch/Switch.styles.ts +4 -4
  33. package/src/components/TextArea/TextArea.styles.ts +4 -4
  34. package/src/components/TextButton/TextButton.styles.ts +4 -3
  35. package/src/theme/common.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.10.0",
3
+ "version": "3.12.0",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -16,7 +16,8 @@ export const useStyles = createThemedStyles('AccountInfo', {
16
16
  accountName: {
17
17
  margin: [0, 2, 0, 10],
18
18
  fontSize: 14,
19
- transition: 'color 0.25s ease-in-out',
19
+ transition: animations.defaultTransition,
20
+ transitionProperty: 'color',
20
21
  },
21
22
 
22
23
  accountNameOpened: {},
@@ -24,7 +25,7 @@ export const useStyles = createThemedStyles('AccountInfo', {
24
25
  accountChevron: {
25
26
  width: 16,
26
27
  height: 16,
27
- transition: 'ease-in-out 0.25s',
28
+ transition: animations.defaultTransition,
28
29
  transitionProperty: 'transform, color',
29
30
  },
30
31
 
@@ -1,4 +1,4 @@
1
- import { createThemedStyles, ITweakStyles } from '../../theme';
1
+ import { animations, createThemedStyles, ITweakStyles } from '../../theme';
2
2
  import { IThemedPreloaderStyles } from '../ThemedPreloader';
3
3
  import { IButtonSize } from './types';
4
4
 
@@ -10,7 +10,7 @@ export const useStyles = createThemedStyles('Button', {
10
10
  cursor: 'pointer',
11
11
  outline: 'none',
12
12
  boxSizing: 'border-box',
13
- transition: '0.25s ease-in-out',
13
+ transition: animations.defaultTransition,
14
14
  transitionProperty: 'background-color, color, box-shadow, border-color',
15
15
  maxWidth: '100%',
16
16
  border: [1, 'solid', 'transparent'],
@@ -1,28 +1,54 @@
1
- import { ComponentStory, ComponentMeta } from '@storybook/react';
2
- import { Checkbox } from './Checkbox';
1
+ import { useState, FC } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { Checkbox as CheckboxComponent, ICheckboxProps } from './Checkbox';
3
4
 
4
- export default {
5
+ const CheckboxComponentWithData: FC<ICheckboxProps<string>> = (props) => {
6
+ const [isChecked, setIsChecked] = useState(false);
7
+ const [isSemiChecked, setIsSemiChecked] = useState(false);
8
+
9
+ return (
10
+ <div style={{ gap: 10, display: 'grid' }}>
11
+ <CheckboxComponent
12
+ isChecked={isChecked}
13
+ isSemiChecked={isSemiChecked}
14
+ onSelect={({ isSelected }) => {
15
+ setIsChecked(isSelected);
16
+ setIsSemiChecked(false);
17
+ }}
18
+ {...props}
19
+ >
20
+ Use wrapping paper
21
+ </CheckboxComponent>
22
+ <CheckboxComponent
23
+ value={undefined}
24
+ isChecked={isSemiChecked}
25
+ onSelect={({ isSelected }) => setIsSemiChecked(isSelected)}
26
+ >
27
+ Is Semi Checked
28
+ </CheckboxComponent>
29
+ </div>
30
+ );
31
+ };
32
+
33
+ const meta: Meta<typeof CheckboxComponentWithData> = {
5
34
  title: 'Controls/Checkbox',
6
- component: Checkbox,
35
+ component: CheckboxComponentWithData,
7
36
  args: {
8
37
  value: 'value',
9
38
  labelPosition: 'right',
10
- isReadonly: false,
11
39
  isInvalid: false,
12
40
  isDisabled: false,
13
- isSemiChecked: false,
41
+ isReadonly: false,
14
42
  },
15
43
  parameters: {
16
44
  controls: {
17
45
  exclude: ['data', 'tweakStyles', 'testId', 'onSelect'],
18
46
  },
19
47
  },
20
- } as ComponentMeta<typeof Checkbox>;
48
+ };
49
+
50
+ export default meta;
51
+
52
+ type Story = StoryObj<typeof CheckboxComponent>;
21
53
 
22
- export const Default: ComponentStory<typeof Checkbox> = (args) => (
23
- <div style={{ width: 200 }}>
24
- <Checkbox {...args} onSelect={(value) => console.log('Value was selected', value)}>
25
- <div>Some text</div>
26
- </Checkbox>
27
- </div>
28
- );
54
+ export const Default: Story = {};
@@ -9,6 +9,10 @@ export const useStyles = createThemedStyles('Checkbox', {
9
9
  width: 'fit-content',
10
10
  },
11
11
 
12
+ checked: {},
13
+
14
+ invalid: {},
15
+
12
16
  disabled: {
13
17
  cursor: 'default',
14
18
  pointerEvents: 'none',
@@ -37,8 +41,6 @@ export const useStyles = createThemedStyles('Checkbox', {
37
41
  boxSizing: 'border-box',
38
42
  },
39
43
 
40
- checked: {},
41
-
42
44
  labelPositionLeft: {
43
45
  flexDirection: 'row-reverse',
44
46
  },
@@ -1,4 +1,4 @@
1
- import { useEffect, useState, ReactNode, ChangeEvent, KeyboardEvent } from 'react';
1
+ import { ReactNode, ChangeEvent, KeyboardEvent } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import {
4
4
  addDataTestId,
@@ -11,57 +11,53 @@ import { Icon } from '../Icon';
11
11
  import { useStyles, ICheckboxStyles } from './Checkbox.styles';
12
12
 
13
13
  export interface ICheckboxProps<V> extends ICommonProps<ICheckboxStyles> {
14
+ value?: V;
14
15
  children?: ReactNode;
15
- isChecked: boolean | undefined;
16
+ /** @default false */
17
+ isChecked?: boolean;
16
18
  /** @default false */
17
19
  isSemiChecked?: boolean;
18
20
  /** @default false */
21
+ isInvalid?: boolean;
22
+ /** @default false */
19
23
  isDisabled?: boolean;
20
24
  /** @default false */
21
25
  isReadonly?: boolean;
22
- /** @default false */
23
- isInvalid?: boolean;
24
- value: V;
25
26
  /** @default 'right' */
26
27
  labelPosition?: 'right' | 'left';
27
- onSelect: (
28
- value: { value: V; isSelected: boolean },
28
+ onSelect?: (
29
+ value: { value?: V; isSelected: boolean },
29
30
  event: ChangeEvent<HTMLInputElement> | KeyboardEvent,
30
31
  ) => void;
31
32
  }
32
33
 
33
34
  export function Checkbox<V>({
35
+ value,
34
36
  children,
37
+ isChecked = false,
38
+ isSemiChecked = false,
39
+ isInvalid = false,
35
40
  isDisabled = false,
36
41
  isReadonly = false,
37
- isChecked = false,
38
- value,
42
+ labelPosition = 'right',
39
43
  data,
40
44
  testId,
41
- isSemiChecked = false,
42
- labelPosition = 'right',
43
45
  tweakStyles,
44
46
  onSelect,
45
47
  }: ICheckboxProps<V>): JSX.Element {
46
48
  const classes = useStyles({ theme: tweakStyles });
47
49
 
48
- const [isSelected, setIsSelected] = useState(false);
49
-
50
50
  const hasAction = !isDisabled && !isReadonly;
51
+ const isSelected = isChecked || isSemiChecked;
51
52
 
52
- const onToggle = (event: ChangeEvent<HTMLInputElement> | KeyboardEvent) => {
53
- const isSelectedNext = !isSelected;
54
- onSelect({ value, isSelected: isSelectedNext }, event);
55
- setIsSelected(isSelectedNext);
56
- };
57
-
58
- useEffect(() => {
59
- setIsSelected(isChecked);
60
- }, [isChecked]);
53
+ const onToggle = (event: ChangeEvent<HTMLInputElement> | KeyboardEvent) =>
54
+ onSelect?.({ value, isSelected: !isSelected }, event);
61
55
 
62
56
  return (
63
57
  <label
64
58
  className={clsx(classes.root, {
59
+ [classes.checked]: isSelected,
60
+ [classes.invalid]: isInvalid,
65
61
  [classes.disabled]: isDisabled,
66
62
  [classes.labelPositionLeft]: labelPosition === 'left',
67
63
  })}
@@ -69,8 +65,8 @@ export function Checkbox<V>({
69
65
  {...addDataAttributes(data)}
70
66
  >
71
67
  <input
72
- type="checkbox"
73
68
  className={classes.input}
69
+ type="checkbox"
74
70
  checked={isSelected}
75
71
  disabled={isDisabled}
76
72
  readOnly={isReadonly}
@@ -79,8 +75,8 @@ export function Checkbox<V>({
79
75
  onKeyDown: getSelectKeyHandler(onToggle),
80
76
  })}
81
77
  />
82
- <div className={clsx(classes.check, isSelected && classes.checked)}>
83
- <Icon type={isSemiChecked ? 'minus' : 'check'} />
78
+ <div className={classes.check}>
79
+ {isSelected && <Icon type={isSemiChecked ? 'minus' : 'check'} />}
84
80
  </div>
85
81
  {isReactNodeNotEmpty(children) && <div className={classes.children}>{children}</div>}
86
82
  </label>
@@ -1,5 +1,5 @@
1
1
  import { rgba } from '../../helpers';
2
- import { colors, createThemedStyles, ITweakStyles } from '../../theme';
2
+ import { animations, colors, createThemedStyles, ITweakStyles } from '../../theme';
3
3
 
4
4
  export const useStyles = createThemedStyles('CloseButton', {
5
5
  root: {
@@ -14,7 +14,8 @@ export const useStyles = createThemedStyles('CloseButton', {
14
14
  appearance: 'none',
15
15
  backgroundColor: 'transparent',
16
16
  cursor: 'pointer',
17
- transition: 'background-color 0.25s ease-in-out',
17
+ transition: animations.defaultTransition,
18
+ transitionProperty: 'background-color',
18
19
 
19
20
  '&:hover': {
20
21
  backgroundColor: rgba(colors.BORDER_MAIN, 0.5),
@@ -1,4 +1,4 @@
1
- import { colors, ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { colors, ITweakStyles, createThemedStyles, animations } from '../../theme';
2
2
  import { IButtonStyles } from '../Button';
3
3
 
4
4
  export const FILTER_HEIGHT = 36;
@@ -20,7 +20,8 @@ export const useStyles = createThemedStyles('FiltersPane', {
20
20
  width: 40,
21
21
  height: FILTER_HEIGHT,
22
22
  cursor: 'pointer',
23
- transition: 'background-color 0.25s ease-in-out',
23
+ transition: animations.defaultTransition,
24
+ transitionProperty: 'background-color',
24
25
  },
25
26
 
26
27
  settingsIcon: {
@@ -1,5 +1,5 @@
1
1
  import cloneDeep from 'lodash-es/cloneDeep';
2
- import { colors, createThemedStyles, helpers, ITweakStyles } from '../../../../theme';
2
+ import { animations, colors, createThemedStyles, helpers, ITweakStyles } from '../../../../theme';
3
3
  import { IButtonStyles } from '../../../Button';
4
4
  import { ISearchInputStyles } from '../../../SearchInput';
5
5
  import { innerTextButtonStyles } from '../../FiltersPane.styles';
@@ -55,7 +55,8 @@ export const useStyles = createThemedStyles('FilterSelect', {
55
55
  cursor: 'pointer',
56
56
  fontSize: 14,
57
57
  minHeight: ITEM_HEIGHT,
58
- transition: 'background-color 0.25s ease-in-out',
58
+ transition: animations.defaultTransition,
59
+ transitionProperty: 'background-color',
59
60
  boxSizing: 'border-box',
60
61
  },
61
62
 
@@ -1,11 +1,11 @@
1
- import { colors, createThemedStyles, ITweakStyles } from '../../../../theme';
1
+ import { animations, colors, createThemedStyles, ITweakStyles } from '../../../../theme';
2
2
  import type { IFilterValueViewStyles } from '../FilterValueView';
3
3
  import { FILTER_HEIGHT } from '../../FiltersPane.styles';
4
4
 
5
5
  export const useStyles = createThemedStyles('FilterWrapper', {
6
6
  root: {
7
7
  position: 'relative',
8
- transition: '0.25s ease-in-out',
8
+ transition: animations.defaultTransition,
9
9
  transitionProperty: 'background-color, border-color',
10
10
  border: [1, 'solid', colors.BORDER_MAIN],
11
11
  borderRadius: 18,
@@ -1,5 +1,11 @@
1
1
  import { rgba } from '../../../../helpers';
2
- import { colors, createThemedStyles, dimensions, ITweakStyles } from '../../../../theme';
2
+ import {
3
+ animations,
4
+ colors,
5
+ createThemedStyles,
6
+ dimensions,
7
+ ITweakStyles,
8
+ } from '../../../../theme';
3
9
  import { ISearchInputStyles } from '../../../SearchInput';
4
10
  import { ISelectStyles } from '../../../Select';
5
11
  import { FILTER_HEIGHT } from '../../FiltersPane.styles';
@@ -12,7 +18,7 @@ export const useStyles = createThemedStyles('FiltersPaneSearch', {
12
18
  border: [1, 'transparent', 'solid'],
13
19
  borderRadius: 18,
14
20
  paddingRight: 8,
15
- transition: '0.25s ease-in-out',
21
+ transition: animations.defaultTransition,
16
22
  transitionProperty: 'background-color, border-color',
17
23
  },
18
24
 
@@ -1,5 +1,5 @@
1
1
  import { rgba } from '../../helpers';
2
- import { colors, ITweakStyles, createThemedStyles } from '../../theme';
2
+ import { colors, ITweakStyles, createThemedStyles, animations } from '../../theme';
3
3
  import type { IFlexibleTableRowStyles } from './components';
4
4
 
5
5
  export const STICKY_SHADOW_PADDING = 12;
@@ -72,7 +72,8 @@ export const useStyles = createThemedStyles('FlexibleTable', {
72
72
  background: 'transparent',
73
73
  pointerEvents: 'none',
74
74
  zIndex: 1,
75
- transition: ['box-shadow', '0.25s', 'ease-in-out'],
75
+ transition: animations.defaultTransition,
76
+ transitionProperty: 'box-shadow',
76
77
 
77
78
  '[data-scrolled] &': {
78
79
  boxShadow: '4px 0 4px rgba(0, 0, 0, 0.05)',
@@ -123,10 +123,11 @@ export const iconsList = checkIcons({
123
123
  check: {
124
124
  paths: [
125
125
  {
126
- d: 'M9.333 11.252l4.96-4.96a1 1 0 011.414 1.415l-5.667 5.667a1 1 0 01-1.414 0L6.293 11.04a1 1 0 111.414-1.414l1.626 1.626z',
126
+ d: 'm7.5 13.086 7.793-7.793a1 1 0 1 1 1.414 1.414l-8.5 8.5a1 1 0 0 1-1.414 0l-3.5-3.5a1 1 0 1 1 1.414-1.414L7.5 13.086Z',
127
127
  },
128
128
  ],
129
129
  },
130
+ /** @deprecated */
130
131
  'check-big': {
131
132
  paths: [
132
133
  {
@@ -138,17 +139,8 @@ export const iconsList = checkIcons({
138
139
  viewBox: '0 0 20 20',
139
140
  paths: [
140
141
  {
141
- d: 'M3 10.5L5.92929 13.4293C5.96834 13.4683 6.03166 13.4683 6.07071 13.4293L13.5 6',
142
- strokeWidth: 2,
143
- strokeLinecap: 'round' as const,
144
- stroke: 'currentColor',
145
- fill: 'none',
146
- },
147
- {
148
- d: 'M10.2071 13.2929L9.5 12.5858L8.08579 14L8.79289 14.7071L10.2071 13.2929ZM18.2071 7.70711C18.5976 7.31658 18.5976 6.68342 18.2071 6.29289C17.8166 5.90237 17.1834 5.90237 16.7929 6.29289L18.2071 7.70711ZM9.92929 14.4293L10.6364 13.7222L9.92929 14.4293ZM10.0707 14.4293L9.3636 13.7222L10.0707 14.4293ZM8.79289 14.7071L9.22218 15.1364L10.6364 13.7222L10.2071 13.2929L8.79289 14.7071ZM10.7778 15.1364L18.2071 7.70711L16.7929 6.29289L9.3636 13.7222L10.7778 15.1364ZM9.22218 15.1364C9.65176 15.566 10.3482 15.566 10.7778 15.1364L9.3636 13.7222C9.71508 13.3707 10.2849 13.3707 10.6364 13.7222L9.22218 15.1364Z',
149
- fill: 'currentColor',
150
- stroke: 'none',
151
- fillRule: undefined,
142
+ d: 'M14.207 6.707a1 1 0 0 0-1.414-1.414L6 12.086 3.707 9.793a1 1 0 0 0-1.414 1.414l2.93 2.93a1.1 1.1 0 0 0 1.555 0l7.43-7.43Zm4 1a1 1 0 0 0-1.414-1.414L10 13.086l-.5-.5L8.086 14l1.136 1.136a1.1 1.1 0 0 0 1.556 0l7.43-7.429Z',
143
+ fillRule: 'evenodd',
152
144
  },
153
145
  ],
154
146
  },
@@ -466,7 +458,7 @@ export const iconsList = checkIcons({
466
458
  minus: {
467
459
  paths: [
468
460
  {
469
- d: 'M16 11H4c-.552 0-1-.448-1-1s.448-1 1-1h12c.552 0 1 .448 1 1s-.448 1-1 1z',
461
+ d: 'M16 11H4a1 1 0 1 1 0-2h12a1 1 0 1 1 0 2Z',
470
462
  },
471
463
  ],
472
464
  },
@@ -1,4 +1,4 @@
1
- import { ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { ITweakStyles, animations, createThemedStyles } from '../../theme';
2
2
 
3
3
  const BUTTON_SIZE_S = 24;
4
4
  const BUTTON_SIZE_M = 32;
@@ -12,7 +12,7 @@ export const useStyles = createThemedStyles('IconButton', {
12
12
  cursor: 'pointer',
13
13
  outline: 'none',
14
14
  boxSizing: 'border-box',
15
- transition: '0.25s ease-in-out',
15
+ transition: animations.defaultTransition,
16
16
  transitionProperty: 'background-color, color, border-color',
17
17
  border: 'none',
18
18
  position: 'relative',
@@ -1,4 +1,4 @@
1
- import { colors, dimensions, ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { colors, dimensions, ITweakStyles, createThemedStyles, animations } from '../../theme';
2
2
  import { IInputStyles } from '../Input';
3
3
 
4
4
  export const BUTTONS_WIDTH = 36;
@@ -28,7 +28,8 @@ export const useStyles = createThemedStyles('IncrementInput', {
28
28
  border: 'none',
29
29
  outline: 'none',
30
30
  backgroundColor: colors.GREY_BACKGROUND,
31
- transition: 'background-color 0.25s ease-in-out',
31
+ transition: animations.defaultTransition,
32
+ transitionProperty: 'background-color',
32
33
  color: colors.FONT_MEDIUM,
33
34
  cursor: 'pointer',
34
35
  display: 'flex',
@@ -1,4 +1,4 @@
1
- import { dimensions, ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { dimensions, ITweakStyles, createThemedStyles, animations } from '../../theme';
2
2
  import { IThemedPreloaderStyles } from '../ThemedPreloader';
3
3
 
4
4
  const PADDING_X = 12;
@@ -16,7 +16,7 @@ export const useStyles = createThemedStyles('Input', {
16
16
  width: '100%',
17
17
  height: dimensions.CONTROL_HEIGHT,
18
18
  boxSizing: 'border-box',
19
- transition: '0.25s ease-in-out',
19
+ transition: animations.defaultTransition,
20
20
  transitionProperty: 'border-color',
21
21
  backgroundColor: 'white',
22
22
  position: 'relative',
@@ -35,7 +35,7 @@ export const useStyles = createThemedStyles('Input', {
35
35
  outline: 'none',
36
36
  boxSizing: 'border-box',
37
37
  outlineStyle: 'none',
38
- transition: '0.25s ease-in-out',
38
+ transition: animations.defaultTransition,
39
39
  transitionProperty: 'background-color',
40
40
  border: 'none',
41
41
  background: 'none',
@@ -137,7 +137,7 @@ export const useStyles = createThemedStyles('Input', {
137
137
  top: '50%',
138
138
  transformOrigin: 'top left',
139
139
  transform: 'translateY(-50%)',
140
- transition: '0.25s ease-in-out',
140
+ transition: animations.defaultTransition,
141
141
  transitionProperty: 'transform, color',
142
142
  fontSize: 16,
143
143
  },
@@ -241,7 +241,8 @@ export const useStyles = createThemedStyles('Input', {
241
241
  alignItems: 'center',
242
242
  padding: [0, 4],
243
243
  width: 20,
244
- transition: 'color 0.25s ease-in-out',
244
+ transition: animations.defaultTransition,
245
+ transitionProperty: 'color',
245
246
  boxSizing: 'content-box',
246
247
 
247
248
  '&:last-child': {
@@ -1,4 +1,4 @@
1
- import { colors, ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { colors, ITweakStyles, createThemedStyles, animations } from '../../theme';
2
2
 
3
3
  const ITEM_HORIZONTAL_PADDING = 16;
4
4
  const ICON_SIZE = 20;
@@ -21,7 +21,8 @@ export const useStyles = createThemedStyles('List', {
21
21
  whiteSpace: 'nowrap',
22
22
  minHeight: 40,
23
23
  padding: [0, ITEM_HORIZONTAL_PADDING],
24
- transition: 'background-color 0.25s ease-in-out',
24
+ transition: animations.defaultTransition,
25
+ transitionProperty: 'background-color',
25
26
  cursor: 'pointer',
26
27
  },
27
28
 
@@ -1,4 +1,4 @@
1
- import { colors, createThemedStyles, ITweakStyles } from '../../../../theme';
1
+ import { animations, colors, createThemedStyles, ITweakStyles } from '../../../../theme';
2
2
 
3
3
  const ITEM_HORIZONTAL_PADDING = 16;
4
4
  const ICON_SIZE = 20;
@@ -13,7 +13,8 @@ export const useStyles = createThemedStyles('ListItem', {
13
13
  whiteSpace: 'nowrap',
14
14
  minHeight: 40,
15
15
  padding: [0, ITEM_HORIZONTAL_PADDING],
16
- transition: 'background-color 0.25s ease-in-out',
16
+ transition: animations.defaultTransition,
17
+ transitionProperty: 'background-color',
17
18
  cursor: 'pointer',
18
19
  },
19
20
 
@@ -1,5 +1,5 @@
1
1
  import { rgba } from '../../helpers';
2
- import { colors, ITweakStyles, createThemedStyles } from '../../theme';
2
+ import { colors, ITweakStyles, createThemedStyles, animations } from '../../theme';
3
3
  import { IListStyles } from '../List';
4
4
 
5
5
  export const useStyles = createThemedStyles('MoreMenu', {
@@ -21,7 +21,8 @@ export const useStyles = createThemedStyles('MoreMenu', {
21
21
  borderRadius: '50%',
22
22
  border: 'none',
23
23
  cursor: 'pointer',
24
- transition: 'background-color 0.25s ease-in-out',
24
+ transition: animations.defaultTransition,
25
+ transitionProperty: 'background-color',
25
26
 
26
27
  '&$hasCircle': {
27
28
  backgroundColor: rgba(colors.GREY_HOVER, 0.5),
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useState, useMemo, useRef, useCallback, ReactNode } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import { debounce } from 'ts-debounce';
4
+ import { isNotEmpty } from '@true-engineering/true-react-platform-helpers';
4
5
  import { addDataAttributes } from '../../helpers';
5
6
  import { useIsMounted, useTweakStyles } from '../../hooks';
6
7
  import { ICommonProps } from '../../types';
@@ -167,12 +168,14 @@ export function MultiSelectList<Value extends IMultiSelectListValues<Option>, Op
167
168
  onChange(undefined);
168
169
  };
169
170
 
170
- const onSelect: ICheckboxProps<Option>['onSelect'] = (val) => {
171
- handleSelectValue(
172
- val.isSelected
173
- ? [...(chosenValues ?? []), val.value]
174
- : chosenValues?.filter((v) => getValueId(v) !== getValueId(val.value)) ?? [],
175
- );
171
+ const onSelect: ICheckboxProps<Option>['onSelect'] = ({ value: checkboxValue, isSelected }) => {
172
+ if (isNotEmpty(checkboxValue)) {
173
+ handleSelectValue(
174
+ isSelected
175
+ ? [...(chosenValues ?? []), checkboxValue]
176
+ : chosenValues?.filter((v) => getValueId(v) !== getValueId(checkboxValue)) ?? [],
177
+ );
178
+ }
176
179
  };
177
180
 
178
181
  const handleKeyDown = (event: KeyboardEvent) => {
@@ -1,4 +1,4 @@
1
- import { colors, ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { colors, ITweakStyles, createThemedStyles, animations } from '../../theme';
2
2
  import { IListStyles } from '../List';
3
3
  import { IWithPopupStyles } from '../WithPopup';
4
4
 
@@ -17,7 +17,8 @@ export const useStyles = createThemedStyles('NewMoreMenu', {
17
17
  borderRadius: '50%',
18
18
  border: 'none',
19
19
  cursor: 'pointer',
20
- transition: 'background-color 0.25s ease-in-out',
20
+ transition: animations.defaultTransition,
21
+ transitionProperty: 'background-color',
21
22
  },
22
23
 
23
24
  icon: {
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { isNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
- import { colors, dimensions, ITweakStyles, createThemedStyles } from '../../theme';
3
+ import { colors, dimensions, ITweakStyles, createThemedStyles, animations } from '../../theme';
4
4
 
5
5
  const SELECTOR_TOTAL_GAP = 4;
6
6
  const SELECTOR_BORDER_WIDTH = 1;
@@ -107,7 +107,7 @@ export const useStyles = createThemedStyles('Selector', {
107
107
  height: `calc(100% - ${SELECTOR_GAP * 2}px)`,
108
108
  backgroundColor: colors.CLASSIC_WHITE,
109
109
  borderRadius: dimensions.BORDER_RADIUS_SMALL,
110
- transition: '0.25s ease-in-out',
110
+ transition: animations.defaultTransition,
111
111
  transitionProperty: 'transform, width',
112
112
  },
113
113
 
@@ -122,7 +122,8 @@ export const useStyles = createThemedStyles('Selector', {
122
122
  height: '100%',
123
123
  color: colors.FONT_MEDIUM,
124
124
  fontSize: 16,
125
- transition: 'color 0.25s ease-in-out',
125
+ transition: animations.defaultTransition,
126
+ transitionProperty: 'color',
126
127
  background: 'none',
127
128
 
128
129
  '&$s': {
@@ -1,4 +1,4 @@
1
- import { ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { ITweakStyles, animations, createThemedStyles } from '../../theme';
2
2
 
3
3
  export const useStyles = createThemedStyles('Switch', {
4
4
  root: {
@@ -33,8 +33,8 @@ export const useStyles = createThemedStyles('Switch', {
33
33
  backgroundColor: '#333',
34
34
  borderRadius: 10,
35
35
  boxSizing: 'border-box',
36
+ transition: animations.defaultTransition,
36
37
  transitionProperty: 'opacity, background-color',
37
- transition: '0.25s ease-in-out',
38
38
 
39
39
  '&::before': {
40
40
  content: '""',
@@ -48,8 +48,8 @@ export const useStyles = createThemedStyles('Switch', {
48
48
  backgroundColor: '#fff',
49
49
  borderRadius: '50%',
50
50
  zIndex: 1,
51
+ transition: animations.defaultTransition,
51
52
  transitionProperty: 'left, background-color',
52
- transition: '0.25s ease-in-out',
53
53
  },
54
54
  },
55
55
 
@@ -58,8 +58,8 @@ export const useStyles = createThemedStyles('Switch', {
58
58
  },
59
59
 
60
60
  label: {
61
+ transition: animations.defaultTransition,
61
62
  transitionProperty: 'opacity, color',
62
- transition: '0.25s ease-in-out',
63
63
  },
64
64
 
65
65
  labelLeft: {
@@ -1,4 +1,4 @@
1
- import { ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { ITweakStyles, animations, createThemedStyles } from '../../theme';
2
2
 
3
3
  const PADDING_X = 12;
4
4
 
@@ -16,7 +16,7 @@ export const useStyles = createThemedStyles('TextArea', {
16
16
  width: '100%',
17
17
  flexGrow: 1,
18
18
  boxSizing: 'border-box',
19
- transition: '0.25s ease-in-out',
19
+ transition: animations.defaultTransition,
20
20
  transitionProperty: 'border-color',
21
21
  backgroundColor: 'white',
22
22
  border: ['solid', 1, 'lightgray'],
@@ -31,7 +31,7 @@ export const useStyles = createThemedStyles('TextArea', {
31
31
  fontFamily: 'inherit',
32
32
  fontSize: 16,
33
33
  padding: [14, PADDING_X, 8],
34
- transition: '0.25s ease-in-out',
34
+ transition: animations.defaultTransition,
35
35
  transitionProperty: 'background-color',
36
36
  border: 'none',
37
37
  resize: 'none',
@@ -95,7 +95,7 @@ export const useStyles = createThemedStyles('TextArea', {
95
95
  top: PADDING_X * 2,
96
96
  transformOrigin: 'top left',
97
97
  transform: 'translateY(-50%)',
98
- transition: '0.25s ease-in-out',
98
+ transition: animations.defaultTransition,
99
99
  transitionProperty: 'transform, color',
100
100
  fontSize: 16,
101
101
  },