@teamturing/react-kit 2.12.0 → 2.13.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.
- package/dist/core/Overlay/index.d.ts +18 -0
- package/dist/core/OverlayPopper/index.d.ts +16 -0
- package/dist/hook/useFocusTrap.d.ts +13 -0
- package/dist/hook/useFocusZone.d.ts +15 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2521 -162
- package/esm/core/Dialog/index.js +8 -36
- package/esm/core/Overlay/index.js +92 -0
- package/esm/core/OverlayPopper/index.js +69 -0
- package/esm/hook/useFocusTrap.js +39 -0
- package/esm/hook/useFocusZone.js +35 -0
- package/esm/index.js +6 -0
- package/esm/node_modules/@floating-ui/core/dist/floating-ui.core.js +475 -0
- package/esm/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +599 -0
- package/esm/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +229 -0
- package/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +121 -0
- package/esm/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +128 -0
- package/esm/node_modules/@primer/behaviors/dist/esm/focus-trap.js +105 -0
- package/esm/node_modules/@primer/behaviors/dist/esm/focus-zone.js +436 -0
- package/esm/node_modules/@primer/behaviors/dist/esm/polyfills/event-listener-signal.js +38 -0
- package/esm/node_modules/@primer/behaviors/dist/esm/utils/iterate-focusable-elements.js +65 -0
- package/esm/node_modules/@primer/behaviors/dist/esm/utils/unique-id.js +6 -0
- package/esm/node_modules/@primer/behaviors/dist/esm/utils/user-agent.js +9 -0
- package/package.json +5 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTMLAttributes, RefObject } from 'react';
|
|
2
|
+
import { ResponsiveValue } from 'styled-system';
|
|
3
|
+
type Props = {
|
|
4
|
+
isOpen?: boolean;
|
|
5
|
+
onDismiss?: () => void;
|
|
6
|
+
size?: ResponsiveValue<'m'>;
|
|
7
|
+
ignoreOutsideClickRefs?: RefObject<HTMLElement>[];
|
|
8
|
+
} & HTMLAttributes<HTMLElement>;
|
|
9
|
+
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
10
|
+
isOpen?: boolean | undefined;
|
|
11
|
+
onDismiss?: (() => void) | undefined;
|
|
12
|
+
size?: ResponsiveValue<"m"> | undefined;
|
|
13
|
+
ignoreOutsideClickRefs?: RefObject<HTMLElement>[] | undefined;
|
|
14
|
+
} & HTMLAttributes<HTMLElement> & {
|
|
15
|
+
children?: import("react").ReactNode;
|
|
16
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export default _default;
|
|
18
|
+
export type { Props as OverlayProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Placement } from '@floating-ui/react-dom';
|
|
2
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
+
import { FocusTrapHookSettings } from '../../hook/useFocusTrap';
|
|
4
|
+
import { FocusZoneHookSettings } from '../../hook/useFocusZone';
|
|
5
|
+
type Props = {
|
|
6
|
+
renderOverlay: ({ isOpen, closeOverlay }: {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
closeOverlay: () => void;
|
|
9
|
+
}) => ReactNode;
|
|
10
|
+
placement?: Placement;
|
|
11
|
+
focusZoneSettings?: Partial<FocusZoneHookSettings>;
|
|
12
|
+
focusTrapSettings?: Partial<FocusTrapHookSettings>;
|
|
13
|
+
};
|
|
14
|
+
declare const OverlayPopper: ({ children: propChildren, renderOverlay, placement, focusZoneSettings, focusTrapSettings, }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default OverlayPopper;
|
|
16
|
+
export type { Props as OverlayPopperProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FocusTrapHookSettings {
|
|
3
|
+
containerRef?: React.RefObject<HTMLElement>;
|
|
4
|
+
initialFocusRef?: React.RefObject<HTMLElement>;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
restoreFocusOnCleanUp?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const useFocusTrap: (settings?: FocusTrapHookSettings, dependencies?: React.DependencyList) => {
|
|
9
|
+
containerRef: React.RefObject<HTMLElement>;
|
|
10
|
+
initialFocusRef: React.RefObject<HTMLElement>;
|
|
11
|
+
};
|
|
12
|
+
export default useFocusTrap;
|
|
13
|
+
export type { FocusTrapHookSettings };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FocusZoneSettings } from '@primer/behaviors';
|
|
3
|
+
export { FocusKeys } from '@primer/behaviors';
|
|
4
|
+
export type { Direction } from '@primer/behaviors';
|
|
5
|
+
interface FocusZoneHookSettings extends Omit<FocusZoneSettings, 'activeDescendantControl'> {
|
|
6
|
+
containerRef?: React.RefObject<HTMLElement>;
|
|
7
|
+
activeDescendantFocus?: boolean | React.RefObject<HTMLElement>;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const useFocusZone: (settings?: FocusZoneHookSettings, dependencies?: import("react").DependencyList) => {
|
|
11
|
+
containerRef: React.RefObject<HTMLElement>;
|
|
12
|
+
activeDescendantControlRef: React.RefObject<HTMLElement>;
|
|
13
|
+
};
|
|
14
|
+
export default useFocusZone;
|
|
15
|
+
export type { FocusZoneHookSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,10 @@ export type { ImageProps } from './core/Image';
|
|
|
27
27
|
export { default as ItemList } from './core/ItemList';
|
|
28
28
|
export type { ItemListProps } from './core/ItemList';
|
|
29
29
|
export { default as MotionView } from './core/MotionView';
|
|
30
|
+
export { default as Overlay } from './core/Overlay';
|
|
31
|
+
export type { OverlayProps } from './core/Overlay';
|
|
32
|
+
export { default as OverlayPopper } from './core/OverlayPopper';
|
|
33
|
+
export type { OverlayPopperProps } from './core/OverlayPopper';
|
|
30
34
|
export { default as Space } from './core/Space';
|
|
31
35
|
export type { SpaceProps } from './core/Space';
|
|
32
36
|
export { default as Spinner } from './core/Spinner';
|
|
@@ -60,6 +64,10 @@ export { default as EnigmaUI } from './enigma/EnigmaUI';
|
|
|
60
64
|
* hooks
|
|
61
65
|
*/
|
|
62
66
|
export { default as useDevice } from './hook/useDevice';
|
|
67
|
+
export { default as useDialogHandler } from './hook/useDialogHandler';
|
|
68
|
+
export { default as useFocusTrap } from './hook/useFocusTrap';
|
|
69
|
+
export { default as useFocusZone } from './hook/useFocusZone';
|
|
70
|
+
export { default as useMediaQuery } from './hook/useMediaQuery';
|
|
63
71
|
export { default as useOutsideClick } from './hook/useOutsideClick';
|
|
64
72
|
export { default as useProvidedOrCreatedRef } from './hook/useProvidedOrCreatedRef';
|
|
65
73
|
export { default as useResize } from './hook/useResize';
|