kelt-ui-kit-react 2.0.4 → 2.0.5

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,7 +1,7 @@
1
1
  {
2
2
  "name": "kelt-ui-kit-react",
3
3
  "type": "module",
4
- "version": "2.0.4",
4
+ "version": "2.0.5",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -10,6 +10,7 @@ type ExpandProps = {
10
10
  currentItem?: ExpandInterface;
11
11
  showArrow?: boolean;
12
12
  catchfocusCapture?: boolean;
13
+ catchFocusCaptureId?: number;
13
14
  };
14
15
 
15
16
  export const Expands = (props: ExpandProps) => {
@@ -36,6 +37,7 @@ export const Expands = (props: ExpandProps) => {
36
37
  onChange={onChangeExpand}
37
38
  currentExpand={currentExpand}
38
39
  catchfocusCapture={props.catchfocusCapture}
40
+ catchFocusCaptureId={props.catchFocusCaptureId}
39
41
  />
40
42
  ))}
41
43
  </div>
@@ -8,7 +8,7 @@ export type ExpandProps = {
8
8
  className?: string;
9
9
  showArrow?: boolean;
10
10
  catchfocusCapture?: boolean
11
-
11
+ catchFocusCaptureId?: number;
12
12
  onChange: (item: ExpandInterface) => void;
13
13
  };
14
14
  export const Expand = ({
@@ -17,13 +17,13 @@ export const Expand = ({
17
17
  className,
18
18
  showArrow = true,
19
19
  catchfocusCapture = false,
20
+ catchFocusCaptureId,
20
21
  onChange,
21
22
  }: ExpandProps): JSX.Element => {
22
23
  const [active, setActive] = useState<boolean>(false);
23
24
  const expandRef = useRef<HTMLDivElement>(null);
24
25
 
25
26
  useEffect(() => {
26
-
27
27
  if (item && currentExpand) {
28
28
  if (currentExpand.id === item.id) {
29
29
  if (!active) {
@@ -70,7 +70,7 @@ export const Expand = ({
70
70
  }, []);
71
71
 
72
72
  useEffect(() => {
73
- if (!catchfocusCapture) return;
73
+ if (!catchfocusCapture || catchFocusCaptureId && catchFocusCaptureId !== currentExpand?.id) return;
74
74
  if (active) {
75
75
  const timer1 = setTimeout(() => {
76
76
  scrollToHeader();
@@ -83,11 +83,11 @@ export const Expand = ({
83
83
  clearTimeout(timer2);
84
84
  };
85
85
  }
86
- }, [active, scrollToHeader, catchfocusCapture]);
86
+ }, [active, scrollToHeader, catchfocusCapture, catchFocusCaptureId]);
87
87
 
88
88
  const handleFocusCapture = useCallback(
89
89
  (e: React.FocusEvent<HTMLDivElement>) => {
90
- if (!catchfocusCapture) return;
90
+ if (!catchfocusCapture || catchFocusCaptureId && catchFocusCaptureId !== currentExpand?.id) return;
91
91
  const target = e.target as HTMLElement;
92
92
  if (
93
93
  active &&
@@ -137,7 +137,7 @@ export const Expand = ({
137
137
  setTimeout(performScroll, 300);
138
138
  }
139
139
  },
140
- [active],
140
+ [active, catchfocusCapture, catchFocusCaptureId],
141
141
  );
142
142
 
143
143
  const handleChange = useCallback(