@teamturing/react-kit 2.56.4 → 2.57.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.
@@ -8,6 +8,7 @@ type Props = {
8
8
  size?: ResponsiveValue<OverlaySizeType>;
9
9
  ignoreOutsideClickRefs?: RefObject<HTMLElement>[];
10
10
  dismissFocusRef?: RefObject<HTMLElement>;
11
+ initialFocusRef?: RefObject<HTMLElement>;
11
12
  } & MaxHeightProps & SxProp & HTMLAttributes<HTMLElement>;
12
13
  declare const _default: import("react").ForwardRefExoticComponent<{
13
14
  isOpen?: boolean | undefined;
@@ -15,6 +16,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
15
16
  size?: ResponsiveValue<OverlaySizeType> | undefined;
16
17
  ignoreOutsideClickRefs?: RefObject<HTMLElement>[] | undefined;
17
18
  dismissFocusRef?: RefObject<HTMLElement> | undefined;
19
+ initialFocusRef?: RefObject<HTMLElement> | undefined;
18
20
  } & MaxHeightProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxHeight<import("styled-system").TLengthStyledSystem>> & SxProp & HTMLAttributes<HTMLElement> & {
19
21
  children?: import("react").ReactNode;
20
22
  } & import("react").RefAttributes<HTMLDivElement>>;
package/dist/index.js CHANGED
@@ -1876,6 +1876,7 @@ const Overlay = ({
1876
1876
  size = 'm',
1877
1877
  ignoreOutsideClickRefs = [],
1878
1878
  dismissFocusRef,
1879
+ initialFocusRef,
1879
1880
  maxHeight = utils.forcePixelValue(600),
1880
1881
  ...props
1881
1882
  }, ref) => {
@@ -1903,6 +1904,10 @@ const Overlay = ({
1903
1904
  }
1904
1905
  }, [handleDismiss]);
1905
1906
  React.useEffect(() => {
1907
+ if (initialFocusRef && initialFocusRef.current) {
1908
+ initialFocusRef.current.focus();
1909
+ return;
1910
+ }
1906
1911
  if (overlayRef.current) {
1907
1912
  const firstItem = utils$1.iterateFocusableElements(overlayRef.current).next().value;
1908
1913
  firstItem?.focus();
@@ -14,6 +14,7 @@ const Overlay = ({
14
14
  size = 'm',
15
15
  ignoreOutsideClickRefs = [],
16
16
  dismissFocusRef,
17
+ initialFocusRef,
17
18
  maxHeight = forcePixelValue(600),
18
19
  ...props
19
20
  }, ref) => {
@@ -41,6 +42,10 @@ const Overlay = ({
41
42
  }
42
43
  }, [handleDismiss]);
43
44
  useEffect(() => {
45
+ if (initialFocusRef && initialFocusRef.current) {
46
+ initialFocusRef.current.focus();
47
+ return;
48
+ }
44
49
  if (overlayRef.current) {
45
50
  const firstItem = iterateFocusableElements(overlayRef.current).next().value;
46
51
  firstItem?.focus();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.56.4",
3
+ "version": "2.57.0",
4
4
  "description": "React components, hooks for create teamturing web application",
5
5
  "author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
6
6
  "homepage": "https://github.com/weareteamturing/bombe#readme",
@@ -66,5 +66,5 @@
66
66
  "react-textarea-autosize": "^8.5.3",
67
67
  "styled-system": "^5.1.5"
68
68
  },
69
- "gitHead": "7b0bbc8a30f3c0e177603c66c8c9a045e8026883"
69
+ "gitHead": "2b676d45d4e06d8f6345da9f2e69c2afe80320f5"
70
70
  }