@workday/canvas-kit-react 6.1.5 → 6.3.0-next.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/checkbox/lib/Checkbox.tsx +1 -1
- package/common/README.md +78 -0
- package/common/lib/utils/index.ts +1 -0
- package/common/lib/utils/useIsFullscreen.ts +20 -0
- package/common/lib/utils/useUniqueId.ts +44 -3
- package/dist/commonjs/checkbox/lib/Checkbox.d.ts +1 -1
- package/dist/commonjs/common/lib/utils/index.d.ts +1 -0
- package/dist/commonjs/common/lib/utils/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/index.js +1 -0
- package/dist/commonjs/common/lib/utils/useIsFullscreen.d.ts +2 -0
- package/dist/commonjs/common/lib/utils/useIsFullscreen.d.ts.map +1 -0
- package/dist/commonjs/common/lib/utils/useIsFullscreen.js +20 -0
- package/dist/commonjs/common/lib/utils/useUniqueId.d.ts +28 -0
- package/dist/commonjs/common/lib/utils/useUniqueId.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/useUniqueId.js +40 -5
- package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormField.js +1 -2
- package/dist/commonjs/popup/lib/hooks/focus-trap-js.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/focus-trap-js.js +1 -0
- package/dist/commonjs/popup/lib/hooks/index.d.ts +3 -0
- package/dist/commonjs/popup/lib/hooks/index.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/index.js +3 -0
- package/dist/commonjs/popup/lib/hooks/useCloseOnFullscreenExit.d.ts +7 -0
- package/dist/commonjs/popup/lib/hooks/useCloseOnFullscreenExit.d.ts.map +1 -0
- package/dist/commonjs/popup/lib/hooks/useCloseOnFullscreenExit.js +34 -0
- package/dist/commonjs/popup/lib/hooks/usePopupStack.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/usePopupStack.js +1 -1
- package/dist/commonjs/popup/lib/hooks/useTransferOnFullscreenEnter.d.ts +10 -0
- package/dist/commonjs/popup/lib/hooks/useTransferOnFullscreenEnter.d.ts.map +1 -0
- package/dist/commonjs/popup/lib/hooks/useTransferOnFullscreenEnter.js +41 -0
- package/dist/commonjs/popup/lib/hooks/useTransferOnFullscreenExit.d.ts +9 -0
- package/dist/commonjs/popup/lib/hooks/useTransferOnFullscreenExit.d.ts.map +1 -0
- package/dist/commonjs/popup/lib/hooks/useTransferOnFullscreenExit.js +40 -0
- package/dist/commonjs/radio/lib/Radio.d.ts +1 -1
- package/dist/commonjs/switch/lib/Switch.d.ts +1 -1
- package/dist/commonjs/tooltip/lib/useTooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/useTooltip.js +3 -5
- package/dist/es6/checkbox/lib/Checkbox.d.ts +1 -1
- package/dist/es6/common/lib/utils/index.d.ts +1 -0
- package/dist/es6/common/lib/utils/index.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/index.js +1 -0
- package/dist/es6/common/lib/utils/useIsFullscreen.d.ts +2 -0
- package/dist/es6/common/lib/utils/useIsFullscreen.d.ts.map +1 -0
- package/dist/es6/common/lib/utils/useIsFullscreen.js +15 -0
- package/dist/es6/common/lib/utils/useUniqueId.d.ts +28 -0
- package/dist/es6/common/lib/utils/useUniqueId.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/useUniqueId.js +40 -2
- package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormField.js +2 -3
- package/dist/es6/popup/lib/hooks/focus-trap-js.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/focus-trap-js.js +1 -0
- package/dist/es6/popup/lib/hooks/index.d.ts +3 -0
- package/dist/es6/popup/lib/hooks/index.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/index.js +3 -0
- package/dist/es6/popup/lib/hooks/useCloseOnFullscreenExit.d.ts +7 -0
- package/dist/es6/popup/lib/hooks/useCloseOnFullscreenExit.d.ts.map +1 -0
- package/dist/es6/popup/lib/hooks/useCloseOnFullscreenExit.js +29 -0
- package/dist/es6/popup/lib/hooks/usePopupStack.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/usePopupStack.js +1 -1
- package/dist/es6/popup/lib/hooks/useTransferOnFullscreenEnter.d.ts +10 -0
- package/dist/es6/popup/lib/hooks/useTransferOnFullscreenEnter.d.ts.map +1 -0
- package/dist/es6/popup/lib/hooks/useTransferOnFullscreenEnter.js +36 -0
- package/dist/es6/popup/lib/hooks/useTransferOnFullscreenExit.d.ts +9 -0
- package/dist/es6/popup/lib/hooks/useTransferOnFullscreenExit.d.ts.map +1 -0
- package/dist/es6/popup/lib/hooks/useTransferOnFullscreenExit.js +35 -0
- package/dist/es6/radio/lib/Radio.d.ts +1 -1
- package/dist/es6/switch/lib/Switch.d.ts +1 -1
- package/dist/es6/tooltip/lib/useTooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/useTooltip.js +4 -3
- package/form-field/lib/FormField.tsx +8 -3
- package/package.json +7 -7
- package/popup/lib/hooks/focus-trap-js.ts +1 -0
- package/popup/lib/hooks/index.ts +3 -0
- package/popup/lib/hooks/useCloseOnFullscreenExit.ts +37 -0
- package/popup/lib/hooks/usePopupStack.ts +2 -1
- package/popup/lib/hooks/useTransferOnFullscreenEnter.ts +44 -0
- package/popup/lib/hooks/useTransferOnFullscreenExit.ts +43 -0
- package/radio/lib/Radio.tsx +1 -1
- package/switch/lib/Switch.tsx +1 -1
- package/tooltip/lib/useTooltip.tsx +4 -2
- package/ts3.5/dist/commonjs/checkbox/lib/Checkbox.d.ts +1 -1
- package/ts3.5/dist/commonjs/common/lib/utils/index.d.ts +1 -0
- package/ts3.5/dist/commonjs/common/lib/utils/useIsFullscreen.d.ts +2 -0
- package/ts3.5/dist/commonjs/common/lib/utils/useUniqueId.d.ts +28 -0
- package/ts3.5/dist/commonjs/popup/lib/hooks/index.d.ts +3 -0
- package/ts3.5/dist/commonjs/popup/lib/hooks/useCloseOnFullscreenExit.d.ts +7 -0
- package/ts3.5/dist/commonjs/popup/lib/hooks/useTransferOnFullscreenEnter.d.ts +10 -0
- package/ts3.5/dist/commonjs/popup/lib/hooks/useTransferOnFullscreenExit.d.ts +9 -0
- package/ts3.5/dist/commonjs/radio/lib/Radio.d.ts +1 -1
- package/ts3.5/dist/commonjs/switch/lib/Switch.d.ts +1 -1
- package/ts3.5/dist/es6/checkbox/lib/Checkbox.d.ts +1 -1
- package/ts3.5/dist/es6/common/lib/utils/index.d.ts +1 -0
- package/ts3.5/dist/es6/common/lib/utils/useIsFullscreen.d.ts +2 -0
- package/ts3.5/dist/es6/common/lib/utils/useUniqueId.d.ts +28 -0
- package/ts3.5/dist/es6/popup/lib/hooks/index.d.ts +3 -0
- package/ts3.5/dist/es6/popup/lib/hooks/useCloseOnFullscreenExit.d.ts +7 -0
- package/ts3.5/dist/es6/popup/lib/hooks/useTransferOnFullscreenEnter.d.ts +10 -0
- package/ts3.5/dist/es6/popup/lib/hooks/useTransferOnFullscreenExit.d.ts +9 -0
- package/ts3.5/dist/es6/radio/lib/Radio.d.ts +1 -1
- package/ts3.5/dist/es6/switch/lib/Switch.d.ts +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import screenfull from 'screenfull';
|
|
3
|
+
|
|
4
|
+
import {PopupModel} from './usePopupModel';
|
|
5
|
+
import {PopupStack} from '@workday/canvas-kit-popup-stack';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Makes the popup transfer to the fullscreen element when fullscreen is entered. Without this, the
|
|
9
|
+
* popup would seem to disappear because the popup container element is not a child of the
|
|
10
|
+
* fullscreen element.
|
|
11
|
+
*
|
|
12
|
+
* Don't use this in conjunction with a hook that will close the popup when entering fullscreen.
|
|
13
|
+
* Doing so would open the popup when the intention was to close it.
|
|
14
|
+
*/
|
|
15
|
+
export const useTransferOnFullscreenEnter = (model: PopupModel, elemProps = {}) => {
|
|
16
|
+
const handler = React.useCallback(
|
|
17
|
+
event => {
|
|
18
|
+
if (screenfull.isFullscreen && model.state.stackRef.current) {
|
|
19
|
+
PopupStack.transferToCurrentContext({
|
|
20
|
+
element: model.state.stackRef.current,
|
|
21
|
+
owner: model.state.targetRef.current!,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
[model.state.stackRef, model.state.targetRef]
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const visible = model.state.visibility !== 'hidden';
|
|
29
|
+
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (!visible) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (screenfull.isEnabled) {
|
|
35
|
+
screenfull.on('change', handler);
|
|
36
|
+
return () => {
|
|
37
|
+
screenfull.off('change', handler);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}, [handler, visible]);
|
|
42
|
+
|
|
43
|
+
return elemProps;
|
|
44
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import screenfull from 'screenfull';
|
|
3
|
+
|
|
4
|
+
import {PopupModel} from './usePopupModel';
|
|
5
|
+
import {PopupStack} from '@workday/canvas-kit-popup-stack';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Makes the popup transfer to fullscreen when fullscreen is exited. Without this hook, the popup
|
|
9
|
+
* would not operate correctly with other popups on the screen.
|
|
10
|
+
*
|
|
11
|
+
* Don't use this in conjunction with a hook that will close the popup when exiting fullscreen.
|
|
12
|
+
* Doing so would open the popup when the intention was to close it.
|
|
13
|
+
*/
|
|
14
|
+
export const useTransferOnFullscreenExit = (model: PopupModel, elemProps = {}) => {
|
|
15
|
+
const handler = React.useCallback(
|
|
16
|
+
event => {
|
|
17
|
+
if (!screenfull.isFullscreen && model.state.stackRef.current) {
|
|
18
|
+
PopupStack.transferToCurrentContext({
|
|
19
|
+
element: model.state.stackRef.current,
|
|
20
|
+
owner: model.state.targetRef.current!,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
[model.state.stackRef, model.state.targetRef]
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const visible = model.state.visibility !== 'hidden';
|
|
28
|
+
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
if (!visible) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (screenfull.isEnabled) {
|
|
34
|
+
screenfull.on('change', handler);
|
|
35
|
+
return () => {
|
|
36
|
+
screenfull.off('change', handler);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}, [handler, visible]);
|
|
41
|
+
|
|
42
|
+
return elemProps;
|
|
43
|
+
};
|
package/radio/lib/Radio.tsx
CHANGED
|
@@ -28,7 +28,7 @@ export interface RadioProps extends Themeable {
|
|
|
28
28
|
disabled?: boolean;
|
|
29
29
|
/**
|
|
30
30
|
* The HTML `id` of the underlying radio input element. This is required if `label` is defined as a non-empty string.
|
|
31
|
-
* @default A uniquely generated id
|
|
31
|
+
* @default A uniquely generated id
|
|
32
32
|
*/
|
|
33
33
|
id?: string;
|
|
34
34
|
/**
|
package/switch/lib/Switch.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import uuid from 'uuid/v4';
|
|
3
2
|
import {
|
|
4
3
|
useCloseOnEscape,
|
|
5
4
|
useAlwaysCloseOnOutsideClick,
|
|
6
5
|
usePopupModel,
|
|
6
|
+
useCloseOnFullscreenExit,
|
|
7
7
|
} from '@workday/canvas-kit-react/popup';
|
|
8
|
+
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
8
9
|
|
|
9
10
|
const useIntentTimer = (fn: Function, waitMs: number = 0): {start(): void; clear(): void} => {
|
|
10
11
|
const timer = React.useRef() as React.MutableRefObject<number | undefined>;
|
|
@@ -90,7 +91,7 @@ export function useTooltip<T extends Element = Element>({
|
|
|
90
91
|
const mouseDownRef = React.useRef(false); // use to prevent newly focused from making tooltip flash
|
|
91
92
|
const popupModel = usePopupModel();
|
|
92
93
|
const [anchorElement, setAnchorElement] = React.useState<T | null>(null);
|
|
93
|
-
const
|
|
94
|
+
const id = useUniqueId();
|
|
94
95
|
const intentTimerHide = useIntentTimer(popupModel.events.hide, hideDelay);
|
|
95
96
|
const intentTimerShow = useIntentTimer(popupModel.events.show, showDelay);
|
|
96
97
|
|
|
@@ -126,6 +127,7 @@ export function useTooltip<T extends Element = Element>({
|
|
|
126
127
|
|
|
127
128
|
useCloseOnEscape(popupModel);
|
|
128
129
|
useAlwaysCloseOnOutsideClick(popupModel);
|
|
130
|
+
useCloseOnFullscreenExit(popupModel);
|
|
129
131
|
|
|
130
132
|
const visible = popupModel.state.visibility !== 'hidden';
|
|
131
133
|
|
|
@@ -13,7 +13,7 @@ export interface CheckboxProps extends Themeable {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* The HTML `id` of the underlying checkbox input element. This is required if `label` is defined as a non-empty string.
|
|
16
|
-
* @default A uniquely generated id
|
|
16
|
+
* @default A uniquely generated id
|
|
17
17
|
*/
|
|
18
18
|
id?: string;
|
|
19
19
|
/**
|
|
@@ -10,6 +10,7 @@ export * from './useMount';
|
|
|
10
10
|
export * from './components';
|
|
11
11
|
export * from './models';
|
|
12
12
|
export * from './elements';
|
|
13
|
+
export * from './useIsFullscreen';
|
|
13
14
|
export * from './useWindowSize';
|
|
14
15
|
export * from './useResizeObserver';
|
|
15
16
|
export * from './StaticStates';
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a unique and HTML5 compliant identifier every time it is called. Internally it uses a 4
|
|
3
|
+
* character random seed starting with a letter. This seed is unique to each instance of this
|
|
4
|
+
* package meaning different versions of Canvas Kit on the page will have a different seed. Each
|
|
5
|
+
* call will use a Base 36 string (10 numbers + 26 letters) based on an incremented number. The
|
|
6
|
+
* incremented number always starts at 0 and can be reset for testing purposes using
|
|
7
|
+
* [resetUniqueIdCount](#resetuniqueidcount). [setUniqueSeed](#setuniqueseed) can also be used for
|
|
8
|
+
* testing or server side rendering to get the same results during hydration.
|
|
9
|
+
*/
|
|
1
10
|
export declare const generateUniqueId: () => string;
|
|
2
11
|
/**
|
|
3
12
|
* Generate a unique ID if one is not provided. The generated ID will be stable across renders
|
|
@@ -10,4 +19,23 @@ export declare const useUniqueId: (id?: string | undefined) => string;
|
|
|
10
19
|
* TODO: Remove in major release
|
|
11
20
|
*/
|
|
12
21
|
export declare const uniqueId: (id?: string | undefined) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Update the seed used by the id generator. This is useful for snapshot tests to help stabilize ids
|
|
24
|
+
* generated each run. This could also be used for server-side hydration - if you choose the same
|
|
25
|
+
* seed for server and set that on the client before components are rendered, the ids generated will
|
|
26
|
+
* be the same.
|
|
27
|
+
* @example
|
|
28
|
+
* // set in a script tag from the server
|
|
29
|
+
* setSeed(window.__ID_SEED); // set in a script tag from the server
|
|
30
|
+
*
|
|
31
|
+
* // jest setup
|
|
32
|
+
* before(() => {
|
|
33
|
+
* setSeed('a')
|
|
34
|
+
* })
|
|
35
|
+
*/
|
|
36
|
+
export declare const setUniqueSeed: (s: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* This should only be called for tests in an `beforeEach`
|
|
39
|
+
*/
|
|
40
|
+
export declare const resetUniqueIdCount: () => void;
|
|
13
41
|
//# sourceMappingURL=useUniqueId.d.ts.map
|
|
@@ -2,6 +2,7 @@ export * from './useAlwaysCloseOnOutsideClick';
|
|
|
2
2
|
export * from './useAssistiveHideSiblings';
|
|
3
3
|
export * from './useBringToTopOnClick';
|
|
4
4
|
export * from './useCloseOnEscape';
|
|
5
|
+
export * from './useCloseOnFullscreenExit';
|
|
5
6
|
export * from './useCloseOnOutsideClick';
|
|
6
7
|
export * from './useDisableBodyScroll';
|
|
7
8
|
export * from './useFocusRedirect';
|
|
@@ -15,4 +16,6 @@ export * from './usePopupPopper';
|
|
|
15
16
|
export * from './usePopupStack';
|
|
16
17
|
export * from './usePopupTarget';
|
|
17
18
|
export * from './useReturnFocus';
|
|
19
|
+
export * from './useTransferOnFullscreenEnter';
|
|
20
|
+
export * from './useTransferOnFullscreenExit';
|
|
18
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Closes the popup when fullscreen is exited. Entering/exiting fullscreen changes the context of
|
|
3
|
+
* the entire screen. This should be added to popup types that are very context sensitive like
|
|
4
|
+
* Tooltips.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useCloseOnFullscreenExit: (model: import("../../..").Model<import("./usePopupModel").PopupState, import("./usePopupModel").PopupEvents>, elemProps?: {}) => {};
|
|
7
|
+
//# sourceMappingURL=useCloseOnFullscreenExit.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes the popup transfer to the fullscreen element when fullscreen is entered. Without this, the
|
|
3
|
+
* popup would seem to disappear because the popup container element is not a child of the
|
|
4
|
+
* fullscreen element.
|
|
5
|
+
*
|
|
6
|
+
* Don't use this in conjunction with a hook that will close the popup when entering fullscreen.
|
|
7
|
+
* Doing so would open the popup when the intention was to close it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTransferOnFullscreenEnter: (model: import("../../..").Model<import("./usePopupModel").PopupState, import("./usePopupModel").PopupEvents>, elemProps?: {}) => {};
|
|
10
|
+
//# sourceMappingURL=useTransferOnFullscreenEnter.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes the popup transfer to fullscreen when fullscreen is exited. Without this hook, the popup
|
|
3
|
+
* would not operate correctly with other popups on the screen.
|
|
4
|
+
*
|
|
5
|
+
* Don't use this in conjunction with a hook that will close the popup when exiting fullscreen.
|
|
6
|
+
* Doing so would open the popup when the intention was to close it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useTransferOnFullscreenExit: (model: import("../../..").Model<import("./usePopupModel").PopupState, import("./usePopupModel").PopupEvents>, elemProps?: {}) => {};
|
|
9
|
+
//# sourceMappingURL=useTransferOnFullscreenExit.d.ts.map
|
|
@@ -13,7 +13,7 @@ export interface RadioProps extends Themeable {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* The HTML `id` of the underlying radio input element. This is required if `label` is defined as a non-empty string.
|
|
16
|
-
* @default A uniquely generated id
|
|
16
|
+
* @default A uniquely generated id
|
|
17
17
|
*/
|
|
18
18
|
id?: string;
|
|
19
19
|
/**
|
|
@@ -13,7 +13,7 @@ export interface CheckboxProps extends Themeable {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* The HTML `id` of the underlying checkbox input element. This is required if `label` is defined as a non-empty string.
|
|
16
|
-
* @default A uniquely generated id
|
|
16
|
+
* @default A uniquely generated id
|
|
17
17
|
*/
|
|
18
18
|
id?: string;
|
|
19
19
|
/**
|
|
@@ -10,6 +10,7 @@ export * from './useMount';
|
|
|
10
10
|
export * from './components';
|
|
11
11
|
export * from './models';
|
|
12
12
|
export * from './elements';
|
|
13
|
+
export * from './useIsFullscreen';
|
|
13
14
|
export * from './useWindowSize';
|
|
14
15
|
export * from './useResizeObserver';
|
|
15
16
|
export * from './StaticStates';
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a unique and HTML5 compliant identifier every time it is called. Internally it uses a 4
|
|
3
|
+
* character random seed starting with a letter. This seed is unique to each instance of this
|
|
4
|
+
* package meaning different versions of Canvas Kit on the page will have a different seed. Each
|
|
5
|
+
* call will use a Base 36 string (10 numbers + 26 letters) based on an incremented number. The
|
|
6
|
+
* incremented number always starts at 0 and can be reset for testing purposes using
|
|
7
|
+
* [resetUniqueIdCount](#resetuniqueidcount). [setUniqueSeed](#setuniqueseed) can also be used for
|
|
8
|
+
* testing or server side rendering to get the same results during hydration.
|
|
9
|
+
*/
|
|
1
10
|
export declare const generateUniqueId: () => string;
|
|
2
11
|
/**
|
|
3
12
|
* Generate a unique ID if one is not provided. The generated ID will be stable across renders
|
|
@@ -10,4 +19,23 @@ export declare const useUniqueId: (id?: string | undefined) => string;
|
|
|
10
19
|
* TODO: Remove in major release
|
|
11
20
|
*/
|
|
12
21
|
export declare const uniqueId: (id?: string | undefined) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Update the seed used by the id generator. This is useful for snapshot tests to help stabilize ids
|
|
24
|
+
* generated each run. This could also be used for server-side hydration - if you choose the same
|
|
25
|
+
* seed for server and set that on the client before components are rendered, the ids generated will
|
|
26
|
+
* be the same.
|
|
27
|
+
* @example
|
|
28
|
+
* // set in a script tag from the server
|
|
29
|
+
* setSeed(window.__ID_SEED); // set in a script tag from the server
|
|
30
|
+
*
|
|
31
|
+
* // jest setup
|
|
32
|
+
* before(() => {
|
|
33
|
+
* setSeed('a')
|
|
34
|
+
* })
|
|
35
|
+
*/
|
|
36
|
+
export declare const setUniqueSeed: (s: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* This should only be called for tests in an `beforeEach`
|
|
39
|
+
*/
|
|
40
|
+
export declare const resetUniqueIdCount: () => void;
|
|
13
41
|
//# sourceMappingURL=useUniqueId.d.ts.map
|
|
@@ -2,6 +2,7 @@ export * from './useAlwaysCloseOnOutsideClick';
|
|
|
2
2
|
export * from './useAssistiveHideSiblings';
|
|
3
3
|
export * from './useBringToTopOnClick';
|
|
4
4
|
export * from './useCloseOnEscape';
|
|
5
|
+
export * from './useCloseOnFullscreenExit';
|
|
5
6
|
export * from './useCloseOnOutsideClick';
|
|
6
7
|
export * from './useDisableBodyScroll';
|
|
7
8
|
export * from './useFocusRedirect';
|
|
@@ -15,4 +16,6 @@ export * from './usePopupPopper';
|
|
|
15
16
|
export * from './usePopupStack';
|
|
16
17
|
export * from './usePopupTarget';
|
|
17
18
|
export * from './useReturnFocus';
|
|
19
|
+
export * from './useTransferOnFullscreenEnter';
|
|
20
|
+
export * from './useTransferOnFullscreenExit';
|
|
18
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Closes the popup when fullscreen is exited. Entering/exiting fullscreen changes the context of
|
|
3
|
+
* the entire screen. This should be added to popup types that are very context sensitive like
|
|
4
|
+
* Tooltips.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useCloseOnFullscreenExit: (model: import("../../..").Model<import("./usePopupModel").PopupState, import("./usePopupModel").PopupEvents>, elemProps?: {}) => {};
|
|
7
|
+
//# sourceMappingURL=useCloseOnFullscreenExit.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes the popup transfer to the fullscreen element when fullscreen is entered. Without this, the
|
|
3
|
+
* popup would seem to disappear because the popup container element is not a child of the
|
|
4
|
+
* fullscreen element.
|
|
5
|
+
*
|
|
6
|
+
* Don't use this in conjunction with a hook that will close the popup when entering fullscreen.
|
|
7
|
+
* Doing so would open the popup when the intention was to close it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTransferOnFullscreenEnter: (model: import("../../..").Model<import("./usePopupModel").PopupState, import("./usePopupModel").PopupEvents>, elemProps?: {}) => {};
|
|
10
|
+
//# sourceMappingURL=useTransferOnFullscreenEnter.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes the popup transfer to fullscreen when fullscreen is exited. Without this hook, the popup
|
|
3
|
+
* would not operate correctly with other popups on the screen.
|
|
4
|
+
*
|
|
5
|
+
* Don't use this in conjunction with a hook that will close the popup when exiting fullscreen.
|
|
6
|
+
* Doing so would open the popup when the intention was to close it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useTransferOnFullscreenExit: (model: import("../../..").Model<import("./usePopupModel").PopupState, import("./usePopupModel").PopupEvents>, elemProps?: {}) => {};
|
|
9
|
+
//# sourceMappingURL=useTransferOnFullscreenExit.d.ts.map
|
|
@@ -13,7 +13,7 @@ export interface RadioProps extends Themeable {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* The HTML `id` of the underlying radio input element. This is required if `label` is defined as a non-empty string.
|
|
16
|
-
* @default A uniquely generated id
|
|
16
|
+
* @default A uniquely generated id
|
|
17
17
|
*/
|
|
18
18
|
id?: string;
|
|
19
19
|
/**
|