@hh.ru/magritte-ui-tree-selector 4.6.51 → 4.6.53

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/Item.js CHANGED
@@ -10,7 +10,7 @@ import '@hh.ru/magritte-ui-checkbox-radio';
10
10
  import './TreeSelectorItemBase.js';
11
11
  import '@hh.ru/magritte-ui-cell';
12
12
  import '@hh.ru/magritte-ui-typography';
13
- import './tree-selector-item-CQzSk_CL.js';
13
+ import './tree-selector-item-CCSiAwdh.js';
14
14
 
15
15
  const ONE_BOX_MARGIN = 36;
16
16
  const getMargin = (allBoxesCount, hasShift, hasIndent) => {
package/ItemContent.js CHANGED
@@ -7,7 +7,7 @@ import { DotFilledSize24, ChevronRightOutlinedSize24 } from '@hh.ru/magritte-ui-
7
7
  import { Action } from './Action.js';
8
8
  import { TreeSelectorItemBase } from './TreeSelectorItemBase.js';
9
9
  import { Text } from '@hh.ru/magritte-ui-typography';
10
- import { s as styles } from './tree-selector-item-CQzSk_CL.js';
10
+ import { s as styles } from './tree-selector-item-CCSiAwdh.js';
11
11
  import '@hh.ru/magritte-ui-checkbox-radio';
12
12
  import '@hh.ru/magritte-ui-cell';
13
13
 
package/ItemsList.js CHANGED
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { useRef, useMemo, useCallback, useEffect } from 'react';
4
4
  import { useVirtualizer } from '@tanstack/react-virtual';
5
5
  import { Item } from './Item.js';
6
- import { s as styles } from './tree-selector-item-CQzSk_CL.js';
6
+ import { s as styles } from './tree-selector-item-CCSiAwdh.js';
7
7
  import 'classnames';
8
8
  import './ItemContent.js';
9
9
  import '@hh.ru/magritte-common-keyboard';
@@ -10,7 +10,7 @@ import { Action } from './Action.js';
10
10
  import { MobileDelimiter } from './MobileDelimiter.js';
11
11
  import { MobileItem } from './MobileItem.js';
12
12
  import { MobileParentItem } from './MobileParentItem.js';
13
- import { s as styles } from './tree-selector-item-CQzSk_CL.js';
13
+ import { s as styles } from './tree-selector-item-CCSiAwdh.js';
14
14
  import '@hh.ru/magritte-ui-checkbox-radio';
15
15
  import '@hh.ru/magritte-ui-card';
16
16
  import '@hh.ru/magritte-ui-typography';
package/TreeSelector.js CHANGED
@@ -19,7 +19,7 @@ import '@hh.ru/magritte-ui-checkbox-radio';
19
19
  import './TreeSelectorItemBase.js';
20
20
  import '@hh.ru/magritte-ui-cell';
21
21
  import '@hh.ru/magritte-ui-typography';
22
- import './tree-selector-item-CQzSk_CL.js';
22
+ import './tree-selector-item-CCSiAwdh.js';
23
23
  import './MobileItemsList.js';
24
24
  import '@hh.ru/magritte-common-func-utils';
25
25
  import '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';
@@ -21,7 +21,7 @@ import '@hh.ru/magritte-ui-checkbox-radio';
21
21
  import './TreeSelectorItemBase.js';
22
22
  import '@hh.ru/magritte-ui-cell';
23
23
  import '@hh.ru/magritte-ui-typography';
24
- import './tree-selector-item-CQzSk_CL.js';
24
+ import './tree-selector-item-CCSiAwdh.js';
25
25
  import '@hh.ru/magritte-common-func-utils';
26
26
  import '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';
27
27
  import './MobileDelimiter.js';
package/index.css CHANGED
@@ -4,7 +4,7 @@
4
4
  --magritte-semantic-animation-ease-in-out-200-timing-function-v21-4-6:cubic-bezier(0.25, 0.1, 0.25, 1);
5
5
  --magritte-semantic-animation-ease-in-out-200-duration-v21-4-6:200ms;
6
6
  }
7
- @keyframes magritte-fade-in___yS4Ja_4-6-51{
7
+ @keyframes magritte-fade-in___yS4Ja_4-6-53{
8
8
  0%{
9
9
  opacity:0;
10
10
  }
@@ -12,24 +12,24 @@
12
12
  opacity:1;
13
13
  }
14
14
  }
15
- .magritte-item-animation-timeout___pbOyZ_4-6-51{
16
- animation-name:magritte-fade-in___yS4Ja_4-6-51;
15
+ .magritte-item-animation-timeout___pbOyZ_4-6-53{
16
+ animation-name:magritte-fade-in___yS4Ja_4-6-53;
17
17
  animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v21-4-6);
18
18
  --animation-duration:0ms;
19
19
  animation-duration:var(--animation-duration);
20
20
  }
21
21
  @media (prefers-reduced-motion: no-preference){
22
- .magritte-item-animation-timeout___pbOyZ_4-6-51{
22
+ .magritte-item-animation-timeout___pbOyZ_4-6-53{
23
23
  --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v21-4-6);
24
24
  }
25
25
  }
26
- .magritte-wrapper___GHKV6_4-6-51{
26
+ .magritte-wrapper___GHKV6_4-6-53{
27
27
  display:flex;
28
28
  padding:12px 0;
29
29
  gap:12px;
30
30
  align-items:flex-start;
31
31
  }
32
- .magritte-letter___yZOCU_4-6-51{
32
+ .magritte-letter___yZOCU_4-6-53{
33
33
  width:24px;
34
34
  height:24px;
35
35
  display:flex;
@@ -37,59 +37,59 @@
37
37
  justify-content:center;
38
38
  flex-shrink:0;
39
39
  }
40
- .magritte-icon___kO3Fj_4-6-51,
41
- .magritte-space___xTO79_4-6-51{
40
+ .magritte-icon___kO3Fj_4-6-53,
41
+ .magritte-space___xTO79_4-6-53{
42
42
  flex-shrink:0;
43
43
  line-height:0;
44
44
  width:24px;
45
45
  }
46
- .magritte-icon___kO3Fj_4-6-51{
46
+ .magritte-icon___kO3Fj_4-6-53{
47
47
  transform:rotate(0);
48
48
  }
49
- .magritte-wrapperActive___Hwk8p_4-6-51,
50
- .magritte-iconActive___4yrG5_4-6-51{
49
+ .magritte-wrapperActive___Hwk8p_4-6-53,
50
+ .magritte-iconActive___4yrG5_4-6-53{
51
51
  cursor:pointer;
52
52
  }
53
- .magritte-iconUp___mpXV6_4-6-51{
53
+ .magritte-iconUp___mpXV6_4-6-53{
54
54
  transform:rotate(90deg);
55
55
  }
56
56
  @media (prefers-reduced-motion: no-preference){
57
- .magritte-icon___kO3Fj_4-6-51{
57
+ .magritte-icon___kO3Fj_4-6-53{
58
58
  transition-property:transform;
59
59
  transition-duration:var(--magritte-semantic-animation-ease-in-out-100-duration-v21-4-6);
60
60
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-100-timing-function-v21-4-6);
61
61
  }
62
62
  }
63
- .magritte-content___ZRc6R_4-6-51{
63
+ .magritte-content___ZRc6R_4-6-53{
64
64
  flex-grow:1;
65
65
  }
66
- .magritte-mobile-item___ynALC_4-6-51{
66
+ .magritte-mobile-item___ynALC_4-6-53{
67
67
  display:flex;
68
68
  gap:12px;
69
69
  flex-wrap:wrap;
70
70
  }
71
- .magritte-with-gap___gbvGO_4-6-51{
71
+ .magritte-with-gap___gbvGO_4-6-53{
72
72
  padding-top:12px;
73
73
  }
74
- .magritte-virtualized-list___qt2E6_4-6-51{
74
+ .magritte-virtualized-list___qt2E6_4-6-53{
75
75
  width:100%;
76
76
  position:relative;
77
77
  will-change:transform;
78
78
  }
79
- .magritte-virtualized-item___qAYVN_4-6-51{
79
+ .magritte-virtualized-item___qAYVN_4-6-53{
80
80
  position:absolute;
81
81
  top:0;
82
82
  left:0;
83
83
  width:100%;
84
84
  }
85
- .magritte-was-expanded___uCFbW_4-6-51{
86
- animation-name:magritte-fade-in___yS4Ja_4-6-51;
85
+ .magritte-was-expanded___uCFbW_4-6-53{
86
+ animation-name:magritte-fade-in___yS4Ja_4-6-53;
87
87
  animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v21-4-6);
88
88
  --animation-duration:0ms;
89
89
  animation-duration:var(--animation-duration);
90
90
  }
91
91
  @media (prefers-reduced-motion: no-preference){
92
- .magritte-was-expanded___uCFbW_4-6-51{
92
+ .magritte-was-expanded___uCFbW_4-6-53{
93
93
  --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v21-4-6);
94
94
  }
95
95
  }
@@ -98,7 +98,7 @@
98
98
  --magritte-semantic-animation-ease-in-out-200-timing-function-v21-4-6:cubic-bezier(0.25, 0.1, 0.25, 1);
99
99
  --magritte-semantic-animation-ease-in-out-200-duration-v21-4-6:200ms;
100
100
  }
101
- @keyframes magritte-fade-in___FDoho_4-6-51{
101
+ @keyframes magritte-fade-in___FDoho_4-6-53{
102
102
  0%{
103
103
  opacity:0;
104
104
  }
@@ -106,14 +106,14 @@
106
106
  opacity:1;
107
107
  }
108
108
  }
109
- .magritte-item-animation-timeout___Pdli9_4-6-51{
110
- animation-name:magritte-fade-in___FDoho_4-6-51;
109
+ .magritte-item-animation-timeout___Pdli9_4-6-53{
110
+ animation-name:magritte-fade-in___FDoho_4-6-53;
111
111
  animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v21-4-6);
112
112
  --animation-duration:0ms;
113
113
  animation-duration:var(--animation-duration);
114
114
  }
115
115
  @media (prefers-reduced-motion: no-preference){
116
- .magritte-item-animation-timeout___Pdli9_4-6-51{
116
+ .magritte-item-animation-timeout___Pdli9_4-6-53{
117
117
  --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v21-4-6);
118
118
  }
119
119
  }
package/index.js CHANGED
@@ -27,7 +27,7 @@ import '@hh.ru/magritte-ui-icon/icon';
27
27
  import './Action.js';
28
28
  import '@hh.ru/magritte-ui-checkbox-radio';
29
29
  import '@hh.ru/magritte-ui-typography';
30
- import './tree-selector-item-CQzSk_CL.js';
30
+ import './tree-selector-item-CCSiAwdh.js';
31
31
  import './MobileItemsList.js';
32
32
  import '@hh.ru/magritte-common-func-utils';
33
33
  import '@hh.ru/magritte-ui-cell';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-tree-selector",
3
- "version": "4.6.51",
3
+ "version": "4.6.53",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -26,19 +26,19 @@
26
26
  "@hh.ru/magritte-common-use-multiple-refs": "1.1.7",
27
27
  "@hh.ru/magritte-design-tokens": "21.4.6",
28
28
  "@hh.ru/magritte-internal-custom-scroll": "1.4.3",
29
- "@hh.ru/magritte-types": "5.0.3",
29
+ "@hh.ru/magritte-types": "5.0.4",
30
30
  "@hh.ru/magritte-ui-badge": "2.4.6",
31
31
  "@hh.ru/magritte-ui-breakpoint": "5.0.3",
32
- "@hh.ru/magritte-ui-card": "7.0.17",
33
- "@hh.ru/magritte-ui-cell": "5.0.2",
34
- "@hh.ru/magritte-ui-checkable-card": "3.0.91",
35
- "@hh.ru/magritte-ui-checkbox-radio": "3.0.56",
36
- "@hh.ru/magritte-ui-icon": "11.0.7",
37
- "@hh.ru/magritte-ui-input": "7.2.13",
32
+ "@hh.ru/magritte-ui-card": "7.0.18",
33
+ "@hh.ru/magritte-ui-cell": "5.0.3",
34
+ "@hh.ru/magritte-ui-checkable-card": "3.0.93",
35
+ "@hh.ru/magritte-ui-checkbox-radio": "3.0.57",
36
+ "@hh.ru/magritte-ui-icon": "11.0.8",
37
+ "@hh.ru/magritte-ui-input": "7.2.14",
38
38
  "@hh.ru/magritte-ui-mock-component": "1.1.4",
39
39
  "@hh.ru/magritte-ui-spacing": "2.0.53",
40
40
  "@hh.ru/magritte-ui-theme-provider": "1.1.48",
41
- "@hh.ru/magritte-ui-typography": "3.0.41",
41
+ "@hh.ru/magritte-ui-typography": "3.0.42",
42
42
  "@tanstack/react-virtual": "3.8.3"
43
43
  },
44
44
  "peerDependencies": {
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "f551eacaa72d0bd7488497247d560d007f6a6e81"
52
+ "gitHead": "d82dc3520dc1a6a0584a8682991ad653e56730ed"
53
53
  }
@@ -0,0 +1,5 @@
1
+ import './index.css';
2
+ var styles = {"item-animation-timeout":"magritte-item-animation-timeout___pbOyZ_4-6-53","itemAnimationTimeout":"magritte-item-animation-timeout___pbOyZ_4-6-53","fade-in":"magritte-fade-in___yS4Ja_4-6-53","fadeIn":"magritte-fade-in___yS4Ja_4-6-53","wrapper":"magritte-wrapper___GHKV6_4-6-53","letter":"magritte-letter___yZOCU_4-6-53","icon":"magritte-icon___kO3Fj_4-6-53","space":"magritte-space___xTO79_4-6-53","wrapperActive":"magritte-wrapperActive___Hwk8p_4-6-53","iconActive":"magritte-iconActive___4yrG5_4-6-53","iconUp":"magritte-iconUp___mpXV6_4-6-53","content":"magritte-content___ZRc6R_4-6-53","mobile-item":"magritte-mobile-item___ynALC_4-6-53","mobileItem":"magritte-mobile-item___ynALC_4-6-53","with-gap":"magritte-with-gap___gbvGO_4-6-53","withGap":"magritte-with-gap___gbvGO_4-6-53","virtualized-list":"magritte-virtualized-list___qt2E6_4-6-53","virtualizedList":"magritte-virtualized-list___qt2E6_4-6-53","virtualized-item":"magritte-virtualized-item___qAYVN_4-6-53","virtualizedItem":"magritte-virtualized-item___qAYVN_4-6-53","was-expanded":"magritte-was-expanded___uCFbW_4-6-53","wasExpanded":"magritte-was-expanded___uCFbW_4-6-53"};
3
+
4
+ export { styles as s };
5
+ //# sourceMappingURL=tree-selector-item-CCSiAwdh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-selector-item-CCSiAwdh.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/types.d.ts CHANGED
@@ -1,10 +1,13 @@
1
- import { ReactElement, ReactNode, RefAttributes } from 'react';
1
+ import { ReactElement, ReactNode } from 'react';
2
2
  import { SearchInputProps } from '@hh.ru/magritte-ui-input';
3
3
  import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';
4
4
  import { AdditionalDefault, IdCollectionPredicate, TreeFilter, TreeModel } from '@hh.ru/magritte-ui-tree-selector/collection/types';
5
+ export type SearchInputPropsWithRef = SearchInputProps & {
6
+ ref?: React.Ref<HTMLInputElement>;
7
+ };
5
8
  interface ChildrenProps {
6
9
  renderTreeSelector: () => ReactElement;
7
- renderInput: (props?: SearchInputProps & RefAttributes<HTMLInputElement>) => ReactElement;
10
+ renderInput: (props?: SearchInputPropsWithRef) => ReactElement;
8
11
  }
9
12
  interface Children {
10
13
  (props: ChildrenProps): ReactNode;
@@ -1,7 +1,7 @@
1
1
  import './index.css';
2
2
  import { useState, useLayoutEffect } from 'react';
3
3
 
4
- var styles = {"item-animation-timeout":"magritte-item-animation-timeout___Pdli9_4-6-51","itemAnimationTimeout":"magritte-item-animation-timeout___Pdli9_4-6-51","fade-in":"magritte-fade-in___FDoho_4-6-51","fadeIn":"magritte-fade-in___FDoho_4-6-51"};
4
+ var styles = {"item-animation-timeout":"magritte-item-animation-timeout___Pdli9_4-6-53","itemAnimationTimeout":"magritte-item-animation-timeout___Pdli9_4-6-53","fade-in":"magritte-fade-in___FDoho_4-6-53","fadeIn":"magritte-fade-in___FDoho_4-6-53"};
5
5
 
6
6
  const useAnimationTimeout = () => {
7
7
  const [animationTimeout, setAnimationTimeout] = useState(0);
@@ -1,11 +1,11 @@
1
- import { ReactElement, RefObject, RefAttributes } from 'react';
2
- import { SearchInputProps } from '@hh.ru/magritte-ui-input';
1
+ import { ReactElement, RefObject } from 'react';
2
+ import { SearchInputPropsWithRef } from '@hh.ru/magritte-ui-tree-selector/types';
3
3
  export interface UseRenderInputHook {
4
4
  (inputRef: RefObject<HTMLInputElement>): {
5
5
  contentFilterQuery: string;
6
6
  setInputValue: (newValue: string) => void;
7
7
  handleChangeInput: (newValue: string) => void;
8
- renderInput: (props?: SearchInputProps & RefAttributes<HTMLInputElement>) => ReactElement;
8
+ renderInput: (props?: SearchInputPropsWithRef) => ReactElement;
9
9
  };
10
10
  }
11
11
  export declare const useRenderInput: UseRenderInputHook;
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderInput.js","sources":["../src/useRenderInput.tsx"],"sourcesContent":["import {\n ReactElement,\n RefCallback,\n useCallback,\n useEffect,\n useState,\n RefObject,\n RefAttributes,\n forwardRef,\n} from 'react';\n\nimport { useDebounce } from '@hh.ru/magritte-common-func-utils';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { SearchInput, SearchInputProps } from '@hh.ru/magritte-ui-input';\nimport { useAnimationTimeout } from '@hh.ru/magritte-ui-tree-selector/useAnimationTimeout';\n\ntype WrapperInputProps = SearchInputProps & {\n value: string;\n onChange: (newValue: string) => void;\n parentRef: RefCallback<HTMLInputElement>;\n};\n\nconst WrapperInput = forwardRef<HTMLInputElement, WrapperInputProps>(({ parentRef, ...props }, ref) => {\n const multiRef = useMultipleRefs(ref, parentRef);\n return <SearchInput {...props} ref={multiRef} data-qa=\"tree-selector-search-input\" />;\n});\n\nWrapperInput.displayName = 'TreeSelectorInput';\n\nexport interface UseRenderInputHook {\n (inputRef: RefObject<HTMLInputElement>): {\n contentFilterQuery: string;\n setInputValue: (newValue: string) => void;\n handleChangeInput: (newValue: string) => void;\n renderInput: (props?: SearchInputProps & RefAttributes<HTMLInputElement>) => ReactElement;\n };\n}\n\nexport const useRenderInput: UseRenderInputHook = (inputRef) => {\n const [contentFilterQuery, setContentFilterQuery] = useState('');\n const { animationTimeout } = useAnimationTimeout();\n const [value, setValue] = useState('');\n const { isMobile } = useBreakpoint();\n\n const inputRefCallback: RefCallback<HTMLInputElement> = useCallback((node) => {\n if (!node) {\n setValue('');\n setContentFilterQuery('');\n }\n }, []);\n\n const ref = useMultipleRefs(inputRef, inputRefCallback);\n\n useEffect(() => {\n setValue('');\n setContentFilterQuery('');\n }, [isMobile]);\n\n const debouncedContentFilterQuery = useDebounce(\n useCallback((newValue: string) => {\n setContentFilterQuery(newValue);\n }, []),\n animationTimeout\n );\n\n const handleChangeInput = useCallback(\n (newValue: string) => {\n debouncedContentFilterQuery(newValue);\n setValue(newValue);\n },\n [debouncedContentFilterQuery]\n );\n\n const setInputValue = useCallback(\n (newValue: string) => {\n setValue(newValue);\n },\n [setValue]\n );\n\n const renderInput = useCallback(\n (props?: SearchInputProps & RefAttributes<HTMLInputElement>) => {\n return <WrapperInput {...props} value={value} onChange={handleChangeInput} parentRef={ref} />;\n },\n [ref, value, handleChangeInput]\n );\n\n return { contentFilterQuery, setInputValue, handleChangeInput, renderInput };\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;AA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ACpC,KAAC,EAAE,EAAE,CAAC,EACN,gBAAgB,CACnB,CAAC;AAEF,IAAA,MAAM,iBAAiB,GAAG,WAAW,CACjC,CAAC,QAAgB,KAAI;QACjB,2BAA2B,CAAC,QAAQ,CAAC,CAAC;QACtC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,KAAC,EACD,CAAC,2BAA2B,CAAC,CAChC,CAAC;AAEF,IAAA,MAAM,aAAa,GAAG,WAAW,CAC7B,CAAC,QAAgB,KAAI;QACjB,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,KAAC,EACD,CAAC,QAAQ,CAAC,CACb,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,WAAW,CAC3B,CAAC,KAA0D,KAAI;AAC3D,QAAA,OAAOA,IAAC,YAAY,EAAA,EAAA,GAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,GAAI,CAAC;KACjG,EACD,CAAC,GAAG,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAClC,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC;AACjF;;;;"}
1
+ {"version":3,"file":"useRenderInput.js","sources":["../src/useRenderInput.tsx"],"sourcesContent":["import { ReactElement, RefCallback, useCallback, useEffect, useState, RefObject, forwardRef } from 'react';\n\nimport { useDebounce } from '@hh.ru/magritte-common-func-utils';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { SearchInput, SearchInputProps } from '@hh.ru/magritte-ui-input';\nimport { SearchInputPropsWithRef } from '@hh.ru/magritte-ui-tree-selector/types';\nimport { useAnimationTimeout } from '@hh.ru/magritte-ui-tree-selector/useAnimationTimeout';\n\ntype WrapperInputProps = SearchInputProps & {\n value: string;\n onChange: (newValue: string) => void;\n parentRef: RefCallback<HTMLInputElement>;\n};\n\nconst WrapperInput = forwardRef<HTMLInputElement, WrapperInputProps>(({ parentRef, ...props }, ref) => {\n const multiRef = useMultipleRefs(ref, parentRef);\n return <SearchInput {...props} ref={multiRef} data-qa=\"tree-selector-search-input\" />;\n});\n\nWrapperInput.displayName = 'TreeSelectorInput';\n\nexport interface UseRenderInputHook {\n (inputRef: RefObject<HTMLInputElement>): {\n contentFilterQuery: string;\n setInputValue: (newValue: string) => void;\n handleChangeInput: (newValue: string) => void;\n renderInput: (props?: SearchInputPropsWithRef) => ReactElement;\n };\n}\n\nexport const useRenderInput: UseRenderInputHook = (inputRef) => {\n const [contentFilterQuery, setContentFilterQuery] = useState('');\n const { animationTimeout } = useAnimationTimeout();\n const [value, setValue] = useState('');\n const { isMobile } = useBreakpoint();\n\n const inputRefCallback: RefCallback<HTMLInputElement> = useCallback((node) => {\n if (!node) {\n setValue('');\n setContentFilterQuery('');\n }\n }, []);\n\n const ref = useMultipleRefs(inputRef, inputRefCallback);\n\n useEffect(() => {\n setValue('');\n setContentFilterQuery('');\n }, [isMobile]);\n\n const debouncedContentFilterQuery = useDebounce(\n useCallback((newValue: string) => {\n setContentFilterQuery(newValue);\n }, []),\n animationTimeout\n );\n\n const handleChangeInput = useCallback(\n (newValue: string) => {\n debouncedContentFilterQuery(newValue);\n setValue(newValue);\n },\n [debouncedContentFilterQuery]\n );\n\n const setInputValue = useCallback(\n (newValue: string) => {\n setValue(newValue);\n },\n [setValue]\n );\n\n const renderInput = useCallback(\n (props?: SearchInputPropsWithRef) => {\n return <WrapperInput {...props} value={value} onChange={handleChangeInput} parentRef={ref} />;\n },\n [ref, value, handleChangeInput]\n );\n\n return { contentFilterQuery, setInputValue, handleChangeInput, renderInput };\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;AAeA,MAAM,YAAY,GAAG,UAAU,CAAsC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;IAClG,MAAM,QAAQ,GAAG,eAAe,CAAC,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AAC,QAAQ,CAAC,CAAC;QACtC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,KAAC,EACD,CAAC,2BAA2B,CAAC,CAChC,CAAC;AAEF,IAAA,MAAM,aAAa,GAAG,WAAW,CAC7B,CAAC,QAAgB,KAAI;QACjB,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,KAAC,EACD,CAAC,QAAQ,CAAC,CACb,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,WAAW,CAC3B,CAAC,KAA+B,KAAI;AAChC,QAAA,OAAOA,IAAC,YAAY,EAAA,EAAA,GAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,GAAI,CAAC;KACjG,EACD,CAAC,GAAG,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAClC,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC;AACjF;;;;"}
@@ -1,5 +0,0 @@
1
- import './index.css';
2
- var styles = {"item-animation-timeout":"magritte-item-animation-timeout___pbOyZ_4-6-51","itemAnimationTimeout":"magritte-item-animation-timeout___pbOyZ_4-6-51","fade-in":"magritte-fade-in___yS4Ja_4-6-51","fadeIn":"magritte-fade-in___yS4Ja_4-6-51","wrapper":"magritte-wrapper___GHKV6_4-6-51","letter":"magritte-letter___yZOCU_4-6-51","icon":"magritte-icon___kO3Fj_4-6-51","space":"magritte-space___xTO79_4-6-51","wrapperActive":"magritte-wrapperActive___Hwk8p_4-6-51","iconActive":"magritte-iconActive___4yrG5_4-6-51","iconUp":"magritte-iconUp___mpXV6_4-6-51","content":"magritte-content___ZRc6R_4-6-51","mobile-item":"magritte-mobile-item___ynALC_4-6-51","mobileItem":"magritte-mobile-item___ynALC_4-6-51","with-gap":"magritte-with-gap___gbvGO_4-6-51","withGap":"magritte-with-gap___gbvGO_4-6-51","virtualized-list":"magritte-virtualized-list___qt2E6_4-6-51","virtualizedList":"magritte-virtualized-list___qt2E6_4-6-51","virtualized-item":"magritte-virtualized-item___qAYVN_4-6-51","virtualizedItem":"magritte-virtualized-item___qAYVN_4-6-51","was-expanded":"magritte-was-expanded___uCFbW_4-6-51","wasExpanded":"magritte-was-expanded___uCFbW_4-6-51"};
3
-
4
- export { styles as s };
5
- //# sourceMappingURL=tree-selector-item-CQzSk_CL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tree-selector-item-CQzSk_CL.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}