@astral/ui 4.0.0-alpha.28 → 4.0.0-alpha.29

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 (83) hide show
  1. package/components/Checkbox/Checkbox.js +1 -1
  2. package/components/Checkbox/constants.d.ts +3 -0
  3. package/components/Checkbox/constants.js +3 -0
  4. package/components/Checkbox/index.d.ts +1 -1
  5. package/components/Checkbox/index.js +1 -1
  6. package/components/Checkbox/styles.js +25 -25
  7. package/components/ScrollWrapper/ScrollWrapper.d.ts +7 -0
  8. package/components/ScrollWrapper/ScrollWrapper.js +3 -0
  9. package/components/ScrollWrapper/index.d.ts +1 -0
  10. package/components/ScrollWrapper/index.js +1 -0
  11. package/components/ScrollWrapper/styles.d.ts +7 -0
  12. package/components/ScrollWrapper/styles.js +7 -0
  13. package/components/Tree/MultipleTreeList/TreeItem/styles.js +16 -2
  14. package/components/Tree/MultipleTreeList/styles.d.ts +0 -6
  15. package/components/Tree/MultipleTreeList/styles.js +0 -3
  16. package/components/Tree/TreeItem/constants.d.ts +1 -0
  17. package/components/Tree/TreeItem/constants.js +2 -1
  18. package/components/Tree/TreeItem/styles.d.ts +0 -4
  19. package/components/Tree/TreeItem/styles.js +15 -8
  20. package/components/TreeAutocomplete/Input/Input.js +7 -5
  21. package/components/TreeAutocomplete/Input/constants.d.ts +1 -0
  22. package/components/TreeAutocomplete/Input/constants.js +1 -0
  23. package/components/TreeAutocomplete/Input/styles.d.ts +3 -10
  24. package/components/TreeAutocomplete/Input/styles.js +3 -18
  25. package/components/TreeAutocomplete/OptionsModal/ErrorMessage/ErrorMessage.js +1 -1
  26. package/components/TreeAutocomplete/OptionsModal/OptionsModal.js +2 -1
  27. package/components/TreeAutocomplete/OptionsModal/styles.js +3 -6
  28. package/components/TreeAutocomplete/TreeAutocomplete.d.ts +1 -57
  29. package/components/TreeAutocomplete/types.d.ts +56 -0
  30. package/components/TreeAutocomplete/useLogic/useLogic.d.ts +1 -1
  31. package/components/TreeLikeAutocomplete/Input/Input.js +5 -5
  32. package/components/TreeLikeAutocomplete/Input/styles.d.ts +1 -25
  33. package/components/TreeLikeAutocomplete/Input/styles.js +7 -20
  34. package/components/TreeLikeAutocomplete/OptionsModal/ErrorMessage/ErrorMessage.js +1 -1
  35. package/components/TreeLikeAutocomplete/OptionsModal/OptionsModal.js +2 -1
  36. package/components/TreeLikeAutocomplete/OptionsModal/styles.js +2 -6
  37. package/components/TreeLikeAutocomplete/TreeLikeAutocomplete.d.ts +1 -62
  38. package/components/TreeLikeAutocomplete/types.d.ts +61 -1
  39. package/components/TreeLikeAutocomplete/useLogic/useLogic.d.ts +2 -2
  40. package/node/components/Checkbox/Checkbox.js +1 -1
  41. package/node/components/Checkbox/constants.d.ts +3 -0
  42. package/node/components/Checkbox/constants.js +4 -1
  43. package/node/components/Checkbox/index.d.ts +1 -1
  44. package/node/components/Checkbox/index.js +3 -1
  45. package/node/components/Checkbox/styles.js +24 -24
  46. package/node/components/ScrollWrapper/ScrollWrapper.d.ts +7 -0
  47. package/node/components/ScrollWrapper/ScrollWrapper.js +7 -0
  48. package/node/components/ScrollWrapper/index.d.ts +1 -0
  49. package/node/components/ScrollWrapper/index.js +17 -0
  50. package/node/components/ScrollWrapper/styles.d.ts +7 -0
  51. package/node/components/ScrollWrapper/styles.js +10 -0
  52. package/node/components/Tree/MultipleTreeList/TreeItem/styles.js +15 -1
  53. package/node/components/Tree/MultipleTreeList/styles.d.ts +0 -6
  54. package/node/components/Tree/MultipleTreeList/styles.js +1 -4
  55. package/node/components/Tree/TreeItem/constants.d.ts +1 -0
  56. package/node/components/Tree/TreeItem/constants.js +2 -1
  57. package/node/components/Tree/TreeItem/styles.d.ts +0 -4
  58. package/node/components/Tree/TreeItem/styles.js +15 -8
  59. package/node/components/TreeAutocomplete/Input/Input.js +4 -2
  60. package/node/components/TreeAutocomplete/Input/constants.d.ts +1 -0
  61. package/node/components/TreeAutocomplete/Input/constants.js +4 -0
  62. package/node/components/TreeAutocomplete/Input/styles.d.ts +3 -10
  63. package/node/components/TreeAutocomplete/Input/styles.js +4 -19
  64. package/node/components/TreeAutocomplete/OptionsModal/ErrorMessage/ErrorMessage.js +1 -1
  65. package/node/components/TreeAutocomplete/OptionsModal/OptionsModal.js +2 -1
  66. package/node/components/TreeAutocomplete/OptionsModal/styles.js +3 -6
  67. package/node/components/TreeAutocomplete/TreeAutocomplete.d.ts +1 -57
  68. package/node/components/TreeAutocomplete/types.d.ts +56 -0
  69. package/node/components/TreeAutocomplete/useLogic/useLogic.d.ts +1 -1
  70. package/node/components/TreeLikeAutocomplete/Input/Input.js +3 -3
  71. package/node/components/TreeLikeAutocomplete/Input/styles.d.ts +1 -25
  72. package/node/components/TreeLikeAutocomplete/Input/styles.js +8 -21
  73. package/node/components/TreeLikeAutocomplete/OptionsModal/ErrorMessage/ErrorMessage.js +1 -1
  74. package/node/components/TreeLikeAutocomplete/OptionsModal/OptionsModal.js +2 -1
  75. package/node/components/TreeLikeAutocomplete/OptionsModal/styles.js +2 -6
  76. package/node/components/TreeLikeAutocomplete/TreeLikeAutocomplete.d.ts +1 -62
  77. package/node/components/TreeLikeAutocomplete/types.d.ts +61 -1
  78. package/node/components/TreeLikeAutocomplete/useLogic/useLogic.d.ts +2 -2
  79. package/package.json +1 -1
  80. package/components/TreeLikeList/faker.d.ts +0 -8
  81. package/components/TreeLikeList/faker.js +0 -17
  82. package/node/components/TreeLikeList/faker.d.ts +0 -8
  83. package/node/components/TreeLikeList/faker.js +0 -21
@@ -6,5 +6,5 @@ import { IconWrapper, Input, Wrapper } from './styles';
6
6
  import { useLogic } from './useLogic';
7
7
  export const Checkbox = forwardRef((props, ref) => {
8
8
  const { onChange, color, isChecked, indeterminate, isError, disabled, restProps, className, role, style, name, inputRef, value, id, } = useLogic(props);
9
- return (_jsxs(Wrapper, Object.assign({ role: role, "$isDisabled": disabled, "$isError": isError, "$isChecked": isChecked, "$isIndeterminate": indeterminate, className: className, style: style, ref: ref }, restProps, { children: [_jsx(Input, { type: "checkbox", checked: isChecked, disabled: disabled, onChange: onChange, "aria-checked": indeterminate ? 'mixed' : isChecked, "aria-disabled": disabled, name: name, ref: inputRef, value: value, id: id }), _jsx(IconWrapper, { className: checkboxClassnames.iconWrapper, children: _jsx(Icon, { className: checkboxClassnames.icon, color: color }) })] })));
9
+ return (_jsxs(Wrapper, Object.assign({ role: role, "$isDisabled": disabled, "$isError": isError, "$isChecked": isChecked, "$isIndeterminate": indeterminate, className: className, style: style, ref: ref }, restProps, { children: [_jsx(Input, { type: "checkbox", checked: isChecked, disabled: disabled, onChange: onChange, "aria-checked": indeterminate ? 'mixed' : isChecked, "aria-disabled": disabled, name: name, ref: inputRef, value: value, id: id, className: checkboxClassnames.input }), _jsx(IconWrapper, { className: checkboxClassnames.iconWrapper, children: _jsx(Icon, { className: checkboxClassnames.icon, color: color }) })] })));
10
10
  });
@@ -9,4 +9,7 @@ export declare const checkboxClassnames: {
9
9
  symbol: string;
10
10
  iconChecked: string;
11
11
  iconIndeterminate: string;
12
+ input: string;
12
13
  };
14
+ export declare const CHECKBOX_SIZE = "32px";
15
+ export declare const MOBILE_CHECKBOX_SIZE = "40px";
@@ -10,4 +10,7 @@ export const checkboxClassnames = {
10
10
  symbol: createUIKitClassname('checkbox__symbol'),
11
11
  iconChecked: createUIKitClassname('checkbox__icon_checked'),
12
12
  iconIndeterminate: createUIKitClassname('checkbox__icon_indeterminate'),
13
+ input: createUIKitClassname('checkbox__input'),
13
14
  };
15
+ export const CHECKBOX_SIZE = '32px';
16
+ export const MOBILE_CHECKBOX_SIZE = '40px';
@@ -1,3 +1,3 @@
1
1
  export * from './Checkbox';
2
2
  export type { CheckboxProps } from './types';
3
- export { checkboxClassnames } from './constants';
3
+ export { checkboxClassnames, CHECKBOX_SIZE, MOBILE_CHECKBOX_SIZE, } from './constants';
@@ -1,2 +1,2 @@
1
1
  export * from './Checkbox';
2
- export { checkboxClassnames } from './constants';
2
+ export { checkboxClassnames, CHECKBOX_SIZE, MOBILE_CHECKBOX_SIZE, } from './constants';
@@ -1,6 +1,6 @@
1
1
  import { styled } from '../styles';
2
2
  import { easeOutBackTransition } from '../styles/mixins';
3
- import { checkboxClassnames } from './constants';
3
+ import { CHECKBOX_SIZE, checkboxClassnames, MOBILE_CHECKBOX_SIZE, } from './constants';
4
4
  const getOutlineColor = ({ theme, isHover, isDisabled, isError, isChecked, isIndeterminate, }) => {
5
5
  if (isDisabled) {
6
6
  return theme.palette.grey[300];
@@ -19,19 +19,18 @@ export const Wrapper = styled('span', {
19
19
  display: flex;
20
20
  justify-content: center;
21
21
 
22
- .${checkboxClassnames.icon} {
22
+ .${checkboxClassnames.icon} {
23
23
  fill: ${({ $isDisabled, theme }) => $isDisabled && theme.palette.components.disabled};
24
24
  }
25
25
 
26
26
  .${checkboxClassnames.symbol} {
27
- fill: ${({ $isDisabled, theme }) => ($isDisabled ? theme.palette.grey[500] : 'white')};
27
+ fill: ${({ $isDisabled, theme }) => $isDisabled ? theme.palette.grey[500] : 'white'};
28
28
 
29
29
  ${easeOutBackTransition};
30
-
31
30
  }
32
-
31
+
33
32
  .${checkboxClassnames.outline} {
34
- fill: ${({ $isDisabled, $isChecked, $isIndeterminate }) => (!$isDisabled && !$isChecked && !$isIndeterminate) && 'white'};
33
+ fill: ${({ $isDisabled, $isChecked, $isIndeterminate }) => !$isDisabled && !$isChecked && !$isIndeterminate && 'white'};
35
34
  stroke: ${({ theme, $isDisabled, $isError, $isChecked, $isIndeterminate, }) => getOutlineColor({
36
35
  theme,
37
36
  isHover: false,
@@ -42,30 +41,31 @@ export const Wrapper = styled('span', {
42
41
  })};
43
42
 
44
43
  ${easeOutBackTransition};
45
-
46
44
  }
47
45
 
48
46
  .${checkboxClassnames.iconChecked} {
49
47
  transform-origin: bottom;
50
- transform: ${({ $isChecked, $isIndeterminate }) => ($isChecked && !$isIndeterminate ? 'scale(1)' : 'scale(0)')};
48
+ transform: ${({ $isChecked, $isIndeterminate }) => $isChecked && !$isIndeterminate ? 'scale(1)' : 'scale(0)'};
51
49
 
52
- opacity: ${({ $isChecked, $isIndeterminate }) => ($isChecked && !$isIndeterminate ? 1 : 0)};
50
+ opacity: ${({ $isChecked, $isIndeterminate }) => $isChecked && !$isIndeterminate ? 1 : 0};
53
51
  }
54
-
52
+
55
53
  .${checkboxClassnames.iconIndeterminate} {
56
54
  transform-origin: bottom;
57
- transform: ${({ $isIndeterminate }) => ($isIndeterminate ? 'scale(1)' : 'scale(0)')};
55
+ transform: ${({ $isIndeterminate }) => $isIndeterminate ? 'scale(1)' : 'scale(0)'};
58
56
 
59
57
  opacity: ${({ $isIndeterminate }) => ($isIndeterminate ? 1 : 0)};
60
58
  }
61
-
59
+
62
60
  &:hover {
63
61
  .${checkboxClassnames.icon} {
64
- color: ${({ $isError, theme }) => $isError ? theme.palette.error[700] : theme.palette.primary[700]}
62
+ color: ${({ $isError, theme }) => $isError ? theme.palette.error[700] : theme.palette.primary[700]};
65
63
  }
66
-
64
+
67
65
  .${checkboxClassnames.outline} {
68
- fill: ${({ theme, $isDisabled, $isChecked, $isIndeterminate }) => (!$isDisabled && !$isChecked && !$isIndeterminate) &&
66
+ fill: ${({ theme, $isDisabled, $isChecked, $isIndeterminate }) => !$isDisabled &&
67
+ !$isChecked &&
68
+ !$isIndeterminate &&
69
69
  theme.palette.background.elementHover};
70
70
  stroke: ${({ theme, $isDisabled, $isError, $isChecked, $isIndeterminate, }) => getOutlineColor({
71
71
  theme,
@@ -80,22 +80,22 @@ export const Wrapper = styled('span', {
80
80
  `;
81
81
  export const Input = styled.input `
82
82
  cursor: ${({ disabled }) => !disabled && 'pointer'};
83
-
83
+
84
84
  position: absolute;
85
85
 
86
- width: 32px;
87
- height: 32px;
86
+ width: ${CHECKBOX_SIZE};
87
+ height: ${CHECKBOX_SIZE};
88
88
  margin: 0;
89
89
 
90
90
  opacity: 0;
91
91
 
92
92
  ${({ theme }) => theme.breakpoints.down('sm')} {
93
- width: 40px;
94
- height: 40px;
93
+ width: ${MOBILE_CHECKBOX_SIZE};
94
+ height: ${MOBILE_CHECKBOX_SIZE};
95
95
  }
96
96
 
97
97
  &:focus-visible {
98
- ~.${checkboxClassnames.iconWrapper} > .${checkboxClassnames.icon} {
98
+ ~ .${checkboxClassnames.iconWrapper} > .${checkboxClassnames.icon} {
99
99
  border-radius: ${({ theme }) => theme.shape.small};
100
100
  outline: 2px solid ${({ theme }) => theme.palette.components.focused};
101
101
  outline-offset: -2px;
@@ -107,12 +107,12 @@ export const IconWrapper = styled.span `
107
107
  align-items: center;
108
108
  justify-content: center;
109
109
 
110
- width: 32px;
111
- height: 32px;
110
+ width: ${CHECKBOX_SIZE};
111
+ height: ${CHECKBOX_SIZE};
112
112
 
113
113
  ${({ theme }) => theme.breakpoints.down('sm')} {
114
- width: 40px;
115
- height: 40px;
114
+ width: ${MOBILE_CHECKBOX_SIZE};
115
+ height: ${MOBILE_CHECKBOX_SIZE};
116
116
 
117
117
  .${checkboxClassnames.icon} {
118
118
  width: 20px;
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from 'react';
2
+ type ScrollWrapperProps = {
3
+ children: ReactNode;
4
+ shape?: 'small' | 'medium' | 'large';
5
+ };
6
+ export declare const ScrollWrapper: ({ children, shape, }: ScrollWrapperProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Wrapper } from './styles';
3
+ export const ScrollWrapper = ({ children, shape = 'medium', }) => _jsx(Wrapper, { "$shape": shape, children: children });
@@ -0,0 +1 @@
1
+ export * from './ScrollWrapper';
@@ -0,0 +1 @@
1
+ export * from './ScrollWrapper';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const Wrapper: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ } & {
6
+ $shape: 'small' | 'medium' | 'large';
7
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,7 @@
1
+ import { styled } from '../styles';
2
+ export const Wrapper = styled.div `
3
+ overflow: hidden;
4
+
5
+ border: 1px solid ${({ theme }) => theme.palette.grey[300]};
6
+ border-radius: ${({ theme, $shape }) => theme.shape[$shape]};
7
+ `;
@@ -1,17 +1,31 @@
1
- import { Checkbox } from '../../../Checkbox';
1
+ import { formControlLabelClasses } from '@mui/material';
2
+ import { CHECKBOX_SIZE, Checkbox, checkboxClassnames } from '../../../Checkbox';
2
3
  import { styled } from '../../../styles';
3
4
  import { listContainer } from '../../../styles/mixins';
4
5
  import { TreeItem, treeClassnames } from '../../TreeItem';
5
6
  export const StyledCheckbox = styled(Checkbox) `
6
7
  padding-top: 0;
7
8
  padding-bottom: 0;
9
+
10
+ & > .${checkboxClassnames.input}, .${checkboxClassnames.iconWrapper} {
11
+ width: 32px;
12
+ height: 16px;
13
+
14
+ ${({ theme }) => theme.breakpoints.down('sm')} {
15
+ height: 20px;
16
+ }
17
+ }
8
18
  `;
9
19
  export const StyledTreeItem = styled(TreeItem) `
20
+ .${formControlLabelClasses.root} .${formControlLabelClasses.label} {
21
+ margin-left: 0;
22
+ }
23
+
10
24
  .${treeClassnames.note} {
11
25
  /* cSpell:ignore чекбоксом */
12
26
 
13
27
  /* Добавляем к отступу ширину контейнера с чекбоксом */
14
- margin-left: ${({ theme }) => `calc(${theme.spacing(1)} + 32px)`};
28
+ margin-left: ${CHECKBOX_SIZE};
15
29
  }
16
30
  `;
17
31
  export const List = styled.ul `
@@ -3,9 +3,3 @@ export declare const List: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  as?: import("react").ElementType<any> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
6
- export declare const InnerList: import("@emotion/styled").StyledComponent<{
7
- theme?: import("@emotion/react").Theme | undefined;
8
- as?: import("react").ElementType<any> | undefined;
9
- } & import("react").ClassAttributes<HTMLUListElement> & import("react").HTMLAttributes<HTMLUListElement> & {
10
- theme?: import("@emotion/react").Theme | undefined;
11
- }, {}, {}>;
@@ -4,6 +4,3 @@ export const List = styled.ul `
4
4
  ${listContainer};
5
5
  overflow: hidden;
6
6
  `;
7
- export const InnerList = styled(List) `
8
- overflow: unset;
9
- `;
@@ -5,4 +5,5 @@ export declare const HALF_PADDING_COLLAPSE_BUTTON_WIDTH = "14px";
5
5
  export declare const TOOLTIP_PLACEMENT = "bottom-start";
6
6
  export declare const treeClassnames: {
7
7
  note: string;
8
+ label: string;
8
9
  };
@@ -5,5 +5,6 @@ export const GAP_WIDTH = '4px';
5
5
  export const HALF_PADDING_COLLAPSE_BUTTON_WIDTH = '14px';
6
6
  export const TOOLTIP_PLACEMENT = 'bottom-start';
7
7
  export const treeClassnames = {
8
- note: createUIKitClassname('tree__item__note'),
8
+ note: createUIKitClassname('tree-item__note'),
9
+ label: createUIKitClassname('tree-item__label'),
9
10
  };
@@ -45,10 +45,6 @@ export declare const ChevronIcon: import("@emotion/styled").StyledComponent<{
45
45
  } & {
46
46
  $isActive?: boolean | undefined;
47
47
  }, {}, {}>;
48
- export declare const List: import("@emotion/styled").StyledComponent<{
49
- theme?: import("@emotion/react").Theme | undefined;
50
- as?: import("react").ElementType<any> | undefined;
51
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
52
48
  export declare const LabelWrapper: import("@emotion/styled").StyledComponent<{
53
49
  theme?: import("@emotion/react").Theme | undefined;
54
50
  as?: import("react").ElementType<any> | undefined;
@@ -1,13 +1,13 @@
1
- import { typographyClasses } from '@mui/material';
1
+ import { svgIconClasses, typographyClasses } from '@mui/material';
2
2
  import { ChevronROutlineMd } from '../../../icons';
3
+ import { buttonClasses } from '../../Button';
3
4
  import { descriptionClassnames } from '../../Description';
4
5
  import { IconButton } from '../../IconButton';
5
6
  import { OverflowTypography } from '../../OverflowTypography';
6
7
  import { styled } from '../../styles';
7
- import { listContainer } from '../../styles/mixins';
8
8
  import { Typography } from '../../Typography';
9
9
  import { COLLAPSE_BUTTON_WIDTH, GAP_WIDTH, HALF_PADDING_COLLAPSE_BUTTON_WIDTH, TREE_LINE_WIDTH, } from './constants';
10
- const getBackgroundColorOnHover = (theme, isSelected, isDisabled) => {
10
+ const getBackgroundColor = (theme, isSelected, isDisabled) => {
11
11
  if (isDisabled) {
12
12
  return 'transparent';
13
13
  }
@@ -58,11 +58,11 @@ export const ItemContent = styled('div', {
58
58
  })};
59
59
 
60
60
  &:hover {
61
- background-color: ${({ theme, $isSelected, $isDisabled }) => getBackgroundColorOnHover(theme, $isSelected, $isDisabled)};
61
+ background-color: ${({ theme, $isSelected, $isDisabled }) => getBackgroundColor(theme, $isSelected, $isDisabled)};
62
62
  }
63
63
 
64
64
  &:focus {
65
- background-color: ${({ theme }) => theme.palette.background.elementHover};
65
+ background-color: ${({ theme, $isSelected, $isDisabled }) => getBackgroundColor(theme, $isSelected, $isDisabled)};
66
66
  border: 0;
67
67
  outline: 0;
68
68
  }
@@ -79,6 +79,16 @@ export const CollapseButton = styled(IconButton, {
79
79
 
80
80
  color: ${({ theme, $isNotBlockingExpandList }) => $isNotBlockingExpandList ? theme.palette.text.primary : 'inherit'};
81
81
 
82
+ &.${buttonClasses.root} .${svgIconClasses.root}, &.${buttonClasses.root} {
83
+ width: 24px;
84
+ height: 24px;
85
+
86
+ ${({ theme }) => theme.breakpoints.down('sm')} {
87
+ width: 24px;
88
+ height: 24px;
89
+ }
90
+ }
91
+
82
92
  &:hover {
83
93
  background-color: ${({ theme }) => theme.palette.grey[300]};
84
94
  }
@@ -93,9 +103,6 @@ export const ChevronIcon = styled(ChevronROutlineMd, {
93
103
  duration: theme.transitions.duration.short,
94
104
  })};
95
105
  `;
96
- export const List = styled.ul `
97
- ${listContainer};
98
- `;
99
106
  export const LabelWrapper = styled('div', {
100
107
  shouldForwardProp: (prop) => prop !== '$level',
101
108
  }) `
@@ -9,15 +9,17 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { forwardRef } from 'react';
14
- import { ChevronDOutlineMd, CircleErrorFillSm } from '../../../icons';
14
+ import { CrossOutlineMd, DownOutlineMd } from '../../../icons';
15
+ import { IconButton } from '../../IconButton';
15
16
  import { TextField } from '../../TextField';
16
- import { StyledIconButton } from './styles';
17
+ import { CLEAR_TEXT } from './constants';
18
+ import { IconWrapper } from './styles';
17
19
  import { useLogic } from './useLogic';
18
- const ClearButton = ({ disabled, onClick }) => (_jsx(StyledIconButton, { variant: "text", disabled: disabled, onClick: onClick, children: _jsx(CircleErrorFillSm, {}) }));
20
+ const ClearButton = ({ disabled, onClick }) => (_jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, onClick: onClick, title: CLEAR_TEXT, "aria-label": CLEAR_TEXT, children: _jsx(CrossOutlineMd, {}) }));
19
21
  export const Input = forwardRef((props, forwardedRef) => {
20
22
  const { inputRef, isVisibleClearButton, handleClearAll } = useLogic(props);
21
23
  const { disabled, onChange } = props, restProps = __rest(props, ["disabled", "onChange"]);
22
- return (_jsx(TextField, Object.assign({}, restProps, { ref: forwardedRef, inputRef: inputRef, disabled: disabled, inputProps: { readOnly: true }, endAdornment: _jsxs(_Fragment, { children: [isVisibleClearButton && (_jsx(ClearButton, { disabled: disabled, onClick: handleClearAll })), _jsx(ChevronDOutlineMd, {})] }) })));
24
+ return (_jsx(TextField, Object.assign({}, restProps, { ref: forwardedRef, inputRef: inputRef, disabled: disabled, inputProps: { readOnly: true }, endAdornment: _jsxs(IconWrapper, { children: [isVisibleClearButton && (_jsx(ClearButton, { disabled: disabled, onClick: handleClearAll })), _jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, children: _jsx(DownOutlineMd, {}) })] }) })));
23
25
  });
@@ -0,0 +1 @@
1
+ export declare const CLEAR_TEXT = "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C";
@@ -0,0 +1 @@
1
+ export const CLEAR_TEXT = 'Очистить';
@@ -1,12 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const StyledIconButton: import("@emotion/styled").StyledComponent<Omit<import("../..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "variant"> & {
3
- variant?: "link" | "outlined" | "text" | "contained" | "light" | undefined;
4
- loading?: boolean | undefined;
5
- color?: "grey" | "primary" | "error" | "warning" | "success" | undefined;
6
- component?: import("react").ElementType | undefined;
7
- selected?: boolean | undefined;
8
- } & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
9
- ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
10
- }, ""> & import("react").RefAttributes<HTMLButtonElement> & {
2
+ export declare const IconWrapper: import("@emotion/styled").StyledComponent<{
11
3
  theme?: import("@emotion/react").Theme | undefined;
12
- }, {}, {}>;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,20 +1,5 @@
1
- import { IconButton } from '../../IconButton';
2
1
  import { styled } from '../../styles';
3
- export const StyledIconButton = styled(IconButton) `
4
- background-color: transparent;
5
-
6
- svg {
7
- width: 16px;
8
- height: 16px;
9
-
10
- fill: ${({ theme }) => theme.palette.grey['500']};
11
- }
12
-
13
- &:hover {
14
- background-color: transparent;
15
-
16
- svg {
17
- fill: ${({ theme }) => theme.palette.grey['700']};
18
- }
19
- }
2
+ export const IconWrapper = styled.div `
3
+ display: flex;
4
+ gap: ${({ theme }) => theme.spacing(1)};
20
5
  `;
@@ -3,4 +3,4 @@ import { Button } from '../../../Button';
3
3
  import { Typography } from '../../../Typography';
4
4
  import { Wrapper } from './styles';
5
5
  const DEFAULT_ERROR_MSG = 'Не удалось загрузить данные';
6
- export const ErrorMessage = ({ loadingErrorMsg = DEFAULT_ERROR_MSG, onRetry, }) => (_jsxs(Wrapper, { children: [_jsx(Typography, { color: "textSecondary", children: loadingErrorMsg }), onRetry && _jsx(Button, { onClick: onRetry, children: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430" })] }));
6
+ export const ErrorMessage = ({ loadingErrorMsg = DEFAULT_ERROR_MSG, onRetry, }) => (_jsxs(Wrapper, { children: [_jsx(Typography, { color: "grey", children: loadingErrorMsg }), onRetry && (_jsx(Button, { onClick: onRetry, variant: "light", color: "grey", children: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430" }))] }));
@@ -13,6 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Button } from '../../Button';
14
14
  import { Dialog } from '../../Dialog';
15
15
  import { DialogActions } from '../../DialogActions';
16
+ import { ScrollWrapper } from '../../ScrollWrapper';
16
17
  import { SearchField } from '../../SearchField';
17
18
  import { TreeList } from '../../Tree';
18
19
  import { ErrorMessage } from './ErrorMessage';
@@ -35,5 +36,5 @@ export const OptionsModal = (props) => {
35
36
  }
36
37
  return _jsx(TreeList, Object.assign({}, treeProps, treeListProps));
37
38
  };
38
- return (_jsxs(Dialog, Object.assign({}, externalDialogProps, { disableRestoreFocus: true, open: isOpen }, modalProps, { children: [_jsxs(StyledDialogContent, { children: [_jsx(SearchField, Object.assign({ fullWidth: true }, searchFieldProps)), _jsx(TreeListWrapper, { children: renderComponent() })] }), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ variant: "text" }, cancelButtonProps, { children: "\u041E\u0442\u043C\u0435\u043D\u0430" })), _jsx(Button, Object.assign({}, confirmButtonProps, { children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" }))] })] })));
39
+ return (_jsxs(Dialog, Object.assign({}, externalDialogProps, { disableRestoreFocus: true, open: isOpen }, modalProps, { children: [_jsxs(StyledDialogContent, { children: [_jsx(SearchField, Object.assign({ fullWidth: true }, searchFieldProps)), _jsx(ScrollWrapper, { children: _jsx(TreeListWrapper, { children: renderComponent() }) })] }), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ variant: "text" }, cancelButtonProps, { children: "\u041E\u0442\u043C\u0435\u043D\u0430" })), _jsx(Button, Object.assign({}, confirmButtonProps, { children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" }))] })] })));
39
40
  };
@@ -4,17 +4,14 @@ export const StyledDialogContent = styled(DialogContent) `
4
4
  display: grid;
5
5
  grid-template-columns: 100%;
6
6
  grid-template-rows: max-content 1fr;
7
- gap: ${({ theme }) => theme.spacing(5)};
7
+ gap: ${({ theme }) => theme.spacing(4)};
8
8
 
9
9
  width: 500px;
10
10
  height: 500px;
11
+ padding-bottom: ${({ theme }) => theme.spacing(4)};
11
12
  `;
12
13
  export const TreeListWrapper = styled.div `
13
14
  overflow: auto;
14
15
 
15
- padding: ${({ theme }) => theme.spacing(2, 0)};
16
-
17
- background-color: ${({ theme }) => theme.palette.background.element};
18
- border: 2px solid ${({ theme }) => theme.palette.grey[300]};
19
- border-radius: 3px;
16
+ height: 100%;
20
17
  `;
@@ -1,59 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { type DialogProps } from '../Dialog';
3
- import { type TextFieldProps } from '../TextField';
4
- import { type TreeListData, type TreeListProps } from '../Tree';
5
- import type { TreeAutocompleteValue } from './types';
6
- export type TreeAutocompleteTreeProps = Pick<TreeListProps, 'disabledItems' | 'renderItem'>;
7
- export type TreeAutocompleteProps = {
8
- /**
9
- * Выбранное значения
10
- */
11
- value?: TreeAutocompleteValue;
12
- /**
13
- * Опции, которые необходимо отобразить в виде дерева.
14
- */
15
- options: TreeListData[];
16
- /**
17
- * Если true, поля будут недоступны для взаимодействия
18
- */
19
- isDisabled?: boolean;
20
- /**
21
- * Если true, поля будут подсвечены, как содержащие ошибку
22
- */
23
- isError?: boolean;
24
- /**
25
- * Флаг загрузки options
26
- * Если true, вместо дерева options будет отображен лоадер
27
- */
28
- isLoading?: boolean;
29
- /**
30
- * Флаг ошибки загрузки options
31
- * Если true, вместо дерева options будет отображен плейсхолдер с ошибкой
32
- */
33
- isLoadingError?: boolean;
34
- /**
35
- * Текст ошибки при загрузке данных
36
- */
37
- loadingErrorMsg?: string;
38
- /**
39
- * Предназначен для конфигурации всплывающего окна
40
- */
41
- dialogProps: Omit<DialogProps, 'open' | 'onClose'>;
42
- /**
43
- * Предназначен для конфигурации дерева опций
44
- */
45
- treeProps?: TreeAutocompleteTreeProps;
46
- /**
47
- * Функция обработки нажатия на кнопку "Повторить запрос"
48
- */
49
- onRetry?: () => void;
50
- /**
51
- * Функция для поиска элементов по дереву, если не определено, то будет использован встроенный поиск
52
- */
53
- filterOptions?: (node: TreeListData, searchValue: string) => boolean;
54
- /**
55
- * Функция, которая запускается при выборе item
56
- */
57
- onChange?: (newValue: TreeAutocompleteValue | undefined) => void;
58
- } & Omit<TextFieldProps, 'autoComplete' | 'defaultValue' | 'select' | 'error' | 'disabled' | 'multiline' | 'rows' | 'maxRows' | 'minRows' | 'SelectProps' | 'endAdornment' | 'onChange'>;
2
+ import type { TreeAutocompleteProps } from './types';
59
3
  export declare const TreeAutocomplete: import("react").ForwardRefExoticComponent<Omit<TreeAutocompleteProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +1,57 @@
1
+ import type { DialogProps } from '../Dialog';
2
+ import type { TextFieldProps } from '../TextField';
3
+ import type { TreeListData, TreeListProps } from '../Tree';
1
4
  export type TreeAutocompleteValue = string;
5
+ export type TreeAutocompleteTreeProps = Pick<TreeListProps, 'disabledItems' | 'renderItem'>;
6
+ export type TreeAutocompleteProps = {
7
+ /**
8
+ * Выбранное значения
9
+ */
10
+ value?: TreeAutocompleteValue;
11
+ /**
12
+ * Опции, которые необходимо отобразить в виде дерева.
13
+ */
14
+ options: TreeListData[];
15
+ /**
16
+ * Если true, поля будут недоступны для взаимодействия
17
+ */
18
+ isDisabled?: boolean;
19
+ /**
20
+ * Если true, поля будут подсвечены, как содержащие ошибку
21
+ */
22
+ isError?: boolean;
23
+ /**
24
+ * Флаг загрузки options
25
+ * Если true, вместо дерева options будет отображен лоадер
26
+ */
27
+ isLoading?: boolean;
28
+ /**
29
+ * Флаг ошибки загрузки options
30
+ * Если true, вместо дерева options будет отображен плейсхолдер с ошибкой
31
+ */
32
+ isLoadingError?: boolean;
33
+ /**
34
+ * Текст ошибки при загрузке данных
35
+ */
36
+ loadingErrorMsg?: string;
37
+ /**
38
+ * Предназначен для конфигурации всплывающего окна
39
+ */
40
+ dialogProps: Omit<DialogProps, 'open' | 'onClose'>;
41
+ /**
42
+ * Предназначен для конфигурации дерева опций
43
+ */
44
+ treeProps?: TreeAutocompleteTreeProps;
45
+ /**
46
+ * Функция обработки нажатия на кнопку "Повторить запрос"
47
+ */
48
+ onRetry?: () => void;
49
+ /**
50
+ * Функция для поиска элементов по дереву, если не определено, то будет использован встроенный поиск
51
+ */
52
+ filterOptions?: (node: TreeListData, searchValue: string) => boolean;
53
+ /**
54
+ * Функция, которая запускается при выборе item
55
+ */
56
+ onChange?: (newValue: TreeAutocompleteValue | undefined) => void;
57
+ } & Omit<TextFieldProps, 'autoComplete' | 'defaultValue' | 'select' | 'error' | 'disabled' | 'multiline' | 'rows' | 'maxRows' | 'minRows' | 'SelectProps' | 'endAdornment' | 'onChange'>;
@@ -1,5 +1,5 @@
1
1
  import { type FocusEvent, type KeyboardEvent, type SyntheticEvent } from 'react';
2
- import { type TreeAutocompleteProps } from '../TreeAutocomplete';
2
+ import type { TreeAutocompleteProps } from '../types';
3
3
  type UseLogicProps = TreeAutocompleteProps;
4
4
  export declare const useLogic: ({ value, options, onBlur }: UseLogicProps) => {
5
5
  inputProps: {
@@ -11,14 +11,14 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { forwardRef } from 'react';
14
- import { ChevronDOutlineMd } from '../../../icons';
15
- import { Loader } from '../../Loader';
14
+ import { CrossOutlineMd, DownOutlineMd } from '../../../icons';
15
+ import { IconButton } from '../../IconButton';
16
16
  import { CLEAR_TEXT } from './constants';
17
- import { EndAdornmentWrapper, StyledCircleErrorFillSm, StyledIconButton, StyledTagsList, StyledTextField, } from './styles';
17
+ import { EndAdornmentWrapper, StyledLoader, StyledTagsList, StyledTextField, } from './styles';
18
18
  import { useLogic } from './useLogic';
19
- const ClearButton = ({ disabled, onClick }) => (_jsx(StyledIconButton, { variant: "text", disabled: disabled, title: CLEAR_TEXT, "aria-label": CLEAR_TEXT, onClick: onClick, children: _jsx(StyledCircleErrorFillSm, {}) }));
19
+ const ClearButton = ({ disabled, onClick }) => (_jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, title: CLEAR_TEXT, "aria-label": CLEAR_TEXT, onClick: onClick, children: _jsx(CrossOutlineMd, {}) }));
20
20
  export const Input = forwardRef((props, forwardedRef) => {
21
21
  const { textFieldProps, isVisibleTagsList, isVisibleClearButton, handleChange, handleClearAll, } = useLogic(props);
22
22
  const { value, valueToRender, disabled, isLoading, onChange, onClick } = props, restProps = __rest(props, ["value", "valueToRender", "disabled", "isLoading", "onChange", "onClick"]);
23
- return (_jsx(StyledTextField, Object.assign({}, restProps, { ref: forwardedRef, disabled: disabled, inputProps: { readOnly: true }, startAdornment: isVisibleTagsList && (_jsx(StyledTagsList, { data: valueToRender, keyId: "id", isDisabled: disabled, getOptionLabel: (option) => option.label, onClick: onClick, onChange: handleChange })), endAdornment: _jsxs(EndAdornmentWrapper, { children: [isLoading && _jsx(Loader, {}), isVisibleClearButton && (_jsx(ClearButton, { disabled: disabled, onClick: handleClearAll })), _jsx(StyledIconButton, { variant: "text", disabled: disabled, children: _jsx(ChevronDOutlineMd, {}) })] }), onClick: onClick }, textFieldProps)));
23
+ return (_jsx(StyledTextField, Object.assign({}, restProps, { ref: forwardedRef, disabled: disabled, inputProps: { readOnly: true }, startAdornment: isVisibleTagsList && (_jsx(StyledTagsList, { data: valueToRender, keyId: "id", isDisabled: disabled, getOptionLabel: (option) => option.label, onClick: onClick, onChange: handleChange })), endAdornment: _jsxs(EndAdornmentWrapper, { children: [isLoading && _jsx(StyledLoader, {}), isVisibleClearButton && (_jsx(ClearButton, { disabled: disabled, onClick: handleClearAll })), _jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, children: _jsx(DownOutlineMd, {}) })] }), onClick: onClick }, textFieldProps)));
24
24
  });