@workday/canvas-kit-react 5.3.0-next.18 → 5.3.0-next.32
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/loading-animation/lib/LoadingDots.js +3 -6
- package/dist/commonjs/popup/lib/PopupCard.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/PopupCard.js +3 -9
- 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/useReturnFocus.d.ts +1 -1
- package/dist/commonjs/popup/lib/hooks/useReturnFocus.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/tabs/lib/menu/MenuList.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/menu/MenuList.js +1 -1
- package/dist/commonjs/tabs/lib/overflow/useOverflowModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/overflow/useOverflowModel.js +9 -0
- package/dist/commonjs/tabs/lib/overflow/useOverflowTarget.js +1 -1
- package/dist/commonjs/tooltip/lib/Tooltip.d.ts +9 -1
- package/dist/commonjs/tooltip/lib/Tooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/Tooltip.js +7 -2
- package/dist/commonjs/tooltip/lib/useTooltip.d.ts +9 -1
- package/dist/commonjs/tooltip/lib/useTooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/useTooltip.js +16 -13
- 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/loading-animation/lib/LoadingDots.js +1 -1
- package/dist/es6/popup/lib/PopupCard.d.ts.map +1 -1
- package/dist/es6/popup/lib/PopupCard.js +3 -9
- 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/useReturnFocus.d.ts +1 -1
- package/dist/es6/popup/lib/hooks/useReturnFocus.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/tabs/lib/menu/MenuList.d.ts.map +1 -1
- package/dist/es6/tabs/lib/menu/MenuList.js +1 -1
- package/dist/es6/tabs/lib/overflow/useOverflowModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/overflow/useOverflowModel.js +9 -0
- package/dist/es6/tabs/lib/overflow/useOverflowTarget.js +1 -1
- package/dist/es6/tooltip/lib/Tooltip.d.ts +9 -1
- package/dist/es6/tooltip/lib/Tooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/Tooltip.js +7 -2
- package/dist/es6/tooltip/lib/useTooltip.d.ts +9 -1
- package/dist/es6/tooltip/lib/useTooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/useTooltip.js +17 -11
- package/form-field/lib/FormField.tsx +8 -3
- package/loading-animation/lib/LoadingDots.tsx +1 -1
- package/package.json +9 -8
- package/popup/lib/PopupCard.tsx +19 -30
- 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/useReturnFocus.tsx +1 -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/tabs/lib/menu/MenuList.tsx +2 -3
- package/tabs/lib/overflow/useOverflowModel.tsx +22 -0
- package/tabs/lib/overflow/useOverflowTarget.tsx +1 -1
- package/tooltip/lib/Tooltip.tsx +16 -1
- package/tooltip/lib/useTooltip.tsx +25 -8
- 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/useReturnFocus.d.ts +1 -1
- 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/commonjs/tooltip/lib/Tooltip.d.ts +9 -1
- package/ts3.5/dist/commonjs/tooltip/lib/useTooltip.d.ts +9 -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/useReturnFocus.d.ts +1 -1
- 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
- package/ts3.5/dist/es6/tooltip/lib/Tooltip.d.ts +9 -1
- package/ts3.5/dist/es6/tooltip/lib/useTooltip.d.ts +9 -1
|
@@ -56,8 +56,8 @@ export var usePopupStack = function (ref, target) {
|
|
|
56
56
|
? target.current || undefined
|
|
57
57
|
: target
|
|
58
58
|
: undefined;
|
|
59
|
-
PopupStack.add({ element: localRef.current, owner: targetEl });
|
|
60
59
|
var element = localRef.current;
|
|
60
|
+
PopupStack.add({ element: element, owner: targetEl });
|
|
61
61
|
return function () {
|
|
62
62
|
PopupStack.remove(element);
|
|
63
63
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `useInitialFocus`. This should be used with `useFocusRedirect` or `useFocusTrap` for a complete
|
|
4
4
|
* focus management solution.
|
|
5
5
|
*
|
|
6
|
-
* This should
|
|
6
|
+
* This should be used on popup elements that use `useInitialFocus`.
|
|
7
7
|
*/
|
|
8
8
|
export declare const useReturnFocus: (model: import("../../../common").Model<import("./usePopupModel").PopupState, import("./usePopupModel").PopupEvents>, elemProps?: {}) => {};
|
|
9
9
|
//# sourceMappingURL=useReturnFocus.d.ts.map
|
|
@@ -5,7 +5,7 @@ import { changeFocus } from '@workday/canvas-kit-react/common';
|
|
|
5
5
|
* `useInitialFocus`. This should be used with `useFocusRedirect` or `useFocusTrap` for a complete
|
|
6
6
|
* focus management solution.
|
|
7
7
|
*
|
|
8
|
-
* This should
|
|
8
|
+
* This should be used on popup elements that use `useInitialFocus`.
|
|
9
9
|
*/
|
|
10
10
|
export var useReturnFocus = function (model, elemProps) {
|
|
11
11
|
if (elemProps === void 0) { elemProps = {}; }
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"useTransferOnFullscreenEnter.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useTransferOnFullscreenEnter.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,sIA6BxC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import screenfull from 'screenfull';
|
|
3
|
+
import { PopupStack } from '@workday/canvas-kit-popup-stack';
|
|
4
|
+
/**
|
|
5
|
+
* Makes the popup transfer to the fullscreen element when fullscreen is entered. Without this, the
|
|
6
|
+
* popup would seem to disappear because the popup container element is not a child of the
|
|
7
|
+
* fullscreen element.
|
|
8
|
+
*
|
|
9
|
+
* Don't use this in conjunction with a hook that will close the popup when entering fullscreen.
|
|
10
|
+
* Doing so would open the popup when the intention was to close it.
|
|
11
|
+
*/
|
|
12
|
+
export var useTransferOnFullscreenEnter = function (model, elemProps) {
|
|
13
|
+
if (elemProps === void 0) { elemProps = {}; }
|
|
14
|
+
var handler = React.useCallback(function (event) {
|
|
15
|
+
if (screenfull.isFullscreen && model.state.stackRef.current) {
|
|
16
|
+
PopupStack.transferToCurrentContext({
|
|
17
|
+
element: model.state.stackRef.current,
|
|
18
|
+
owner: model.state.targetRef.current,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}, [model.state.stackRef, model.state.targetRef]);
|
|
22
|
+
var visible = model.state.visibility !== 'hidden';
|
|
23
|
+
React.useEffect(function () {
|
|
24
|
+
if (!visible) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (screenfull.isEnabled) {
|
|
28
|
+
screenfull.on('change', handler);
|
|
29
|
+
return function () {
|
|
30
|
+
screenfull.off('change', handler);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}, [handler, visible]);
|
|
35
|
+
return elemProps;
|
|
36
|
+
};
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTransferOnFullscreenExit.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useTransferOnFullscreenExit.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,sIA6BvC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import screenfull from 'screenfull';
|
|
3
|
+
import { PopupStack } from '@workday/canvas-kit-popup-stack';
|
|
4
|
+
/**
|
|
5
|
+
* Makes the popup transfer to fullscreen when fullscreen is exited. Without this hook, the popup
|
|
6
|
+
* would not operate correctly with other popups on the screen.
|
|
7
|
+
*
|
|
8
|
+
* Don't use this in conjunction with a hook that will close the popup when exiting fullscreen.
|
|
9
|
+
* Doing so would open the popup when the intention was to close it.
|
|
10
|
+
*/
|
|
11
|
+
export var useTransferOnFullscreenExit = function (model, elemProps) {
|
|
12
|
+
if (elemProps === void 0) { elemProps = {}; }
|
|
13
|
+
var handler = React.useCallback(function (event) {
|
|
14
|
+
if (!screenfull.isFullscreen && model.state.stackRef.current) {
|
|
15
|
+
PopupStack.transferToCurrentContext({
|
|
16
|
+
element: model.state.stackRef.current,
|
|
17
|
+
owner: model.state.targetRef.current,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}, [model.state.stackRef, model.state.targetRef]);
|
|
21
|
+
var visible = model.state.visibility !== 'hidden';
|
|
22
|
+
React.useEffect(function () {
|
|
23
|
+
if (!visible) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (screenfull.isEnabled) {
|
|
27
|
+
screenfull.on('change', handler);
|
|
28
|
+
return function () {
|
|
29
|
+
screenfull.off('change', handler);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}, [handler, visible]);
|
|
34
|
+
return elemProps;
|
|
35
|
+
};
|
|
@@ -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
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuList.d.ts","sourceRoot":"","sources":["../../../../../tabs/lib/menu/MenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,uCAAuC,CAAC;AAE5D,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,OAAO,CAAC,YAAY,CAAC,OAAO,KAAK,EAAE,KAAK,CAAC,CAAC;IAC5F;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACtB;AAED,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"MenuList.d.ts","sourceRoot":"","sources":["../../../../../tabs/lib/menu/MenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,uCAAuC,CAAC;AAE5D,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,OAAO,CAAC,YAAY,CAAC,OAAO,KAAK,EAAE,KAAK,CAAC,CAAC;IAC5F;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACtB;AAED,eAAO,MAAM,QAAQ,2EAuBnB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;OAKtB,CAAC"}
|
|
@@ -32,7 +32,7 @@ export var MenuList = createComponent('div')({
|
|
|
32
32
|
var model = _a.model, children = _a.children, elemProps = __rest(_a, ["model", "children"]);
|
|
33
33
|
var localModel = useModelContext(MenuModelContext, model);
|
|
34
34
|
var props = useMenuList(localModel, elemProps, ref);
|
|
35
|
-
return (React.createElement(Stack, __assign({ as: Element, background: commonColors.background, borderRadius: "
|
|
35
|
+
return (React.createElement(Stack, __assign({ as: Element, background: commonColors.background, borderRadius: "zero", padding: "zero", marginY: "xxs", spacing: "zero", overflowY: "auto", flexDirection: localModel.state.orientation === 'vertical' ? 'column' : 'row' }, props), useRenderItems(localModel, children)));
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
export var useMenuList = createHook(function (model) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflowModel.d.ts","sourceRoot":"","sources":["../../../../../tabs/lib/overflow/useOverflowModel.tsx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E,MAAM,EAC3B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,GAC5B,MAAM,EAAE,CAwCV;AAED,eAAO,MAAM,gBAAgB,0EAgG5B,CAAC"}
|
|
@@ -41,6 +41,9 @@ export function getHiddenIds(containerWidth, overflowTargetWidth, itemWidthCache
|
|
|
41
41
|
itemWidth += itemWidthCache[selectedKey] + overflowTargetWidth;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
else {
|
|
45
|
+
itemWidth += overflowTargetWidth;
|
|
46
|
+
}
|
|
44
47
|
for (var key in itemWidthCache) {
|
|
45
48
|
if (key !== selectedKey) {
|
|
46
49
|
itemWidth += itemWidthCache[key];
|
|
@@ -91,6 +94,8 @@ export var useOverflowModel = function (config) {
|
|
|
91
94
|
var id = _a.id, width = _a.width;
|
|
92
95
|
itemWidthCacheRef.current = __assign(__assign({}, itemWidthCacheRef.current), (_b = {}, _b[id] = width, _b));
|
|
93
96
|
setItemWidthCache(itemWidthCacheRef.current);
|
|
97
|
+
var ids = getHiddenIds(containerWidthRef.current, overflowTargetWidthRef.current, itemWidthCacheRef.current, state.selectedIds);
|
|
98
|
+
setHiddenIds(ids);
|
|
94
99
|
},
|
|
95
100
|
removeItemWidth: function (_a) {
|
|
96
101
|
var id = _a.id;
|
|
@@ -98,6 +103,10 @@ export var useOverflowModel = function (config) {
|
|
|
98
103
|
delete newCache[id];
|
|
99
104
|
itemWidthCacheRef.current = newCache;
|
|
100
105
|
setItemWidthCache(itemWidthCacheRef.current);
|
|
106
|
+
var ids = getHiddenIds(containerWidthRef.current, overflowTargetWidthRef.current, itemWidthCacheRef.current, state.selectedIds !== 'all'
|
|
107
|
+
? state.selectedIds.filter(function (sId) { return id !== sId; })
|
|
108
|
+
: state.selectedIds);
|
|
109
|
+
setHiddenIds(ids);
|
|
101
110
|
},
|
|
102
111
|
addHiddenKey: function (_a) {
|
|
103
112
|
var id = _a.id;
|
|
@@ -37,6 +37,14 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
37
37
|
* @default 'label'
|
|
38
38
|
*/
|
|
39
39
|
type?: 'label' | 'describe' | 'muted';
|
|
40
|
+
/**
|
|
41
|
+
* Amount of time (in ms) to delay before showing the tooltip
|
|
42
|
+
*/
|
|
43
|
+
showDelay?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Amount of time (in ms) to delay before hiding the tooltip
|
|
46
|
+
*/
|
|
47
|
+
hideDelay?: number;
|
|
40
48
|
}
|
|
41
|
-
export declare const Tooltip: ({ type, placement, title, children, ...elemProps }: TooltipProps) => JSX.Element;
|
|
49
|
+
export declare const Tooltip: ({ type, placement, title, children, showDelay, hideDelay, ...elemProps }: TooltipProps) => JSX.Element;
|
|
42
50
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAA4B,SAAS,EAAS,MAAM,iCAAiC,CAAC;AAM7F,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IACvF;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAA4B,SAAS,EAAS,MAAM,iCAAiC,CAAC;AAM7F,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IACvF;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;IACtC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD,eAAO,MAAM,OAAO,yGAsCnB,CAAC"}
|
|
@@ -39,9 +39,14 @@ function mergeCallbacks(elemProps, componentProps, keys) {
|
|
|
39
39
|
}, {});
|
|
40
40
|
}
|
|
41
41
|
export var Tooltip = function (_a) {
|
|
42
|
-
var _b = _a.type, type = _b === void 0 ? 'label' : _b, _c = _a.placement, placement = _c === void 0 ? 'top' : _c, title = _a.title, children = _a.children, elemProps = __rest(_a, ["type", "placement", "title", "children"]);
|
|
42
|
+
var _b = _a.type, type = _b === void 0 ? 'label' : _b, _c = _a.placement, placement = _c === void 0 ? 'top' : _c, title = _a.title, children = _a.children, _d = _a.showDelay, showDelay = _d === void 0 ? 300 : _d, _e = _a.hideDelay, hideDelay = _e === void 0 ? 100 : _e, elemProps = __rest(_a, ["type", "placement", "title", "children", "showDelay", "hideDelay"]);
|
|
43
43
|
var titleText = innerText(title);
|
|
44
|
-
var
|
|
44
|
+
var _f = useTooltip({
|
|
45
|
+
type: type,
|
|
46
|
+
titleText: titleText,
|
|
47
|
+
showDelay: showDelay,
|
|
48
|
+
hideDelay: hideDelay,
|
|
49
|
+
}), targetProps = _f.targetProps, popperProps = _f.popperProps, tooltipProps = _f.tooltipProps;
|
|
45
50
|
return (React.createElement(React.Fragment, null,
|
|
46
51
|
React.cloneElement(children, __assign(__assign(__assign({}, targetProps), mergeCallbacks(children.props, targetProps)), (type === 'muted' && children.props['aria-label']
|
|
47
52
|
? { 'aria-label': children.props['aria-label'] }
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
* Convenience hook for creating components with tooltips. It will return an object of properties to mix
|
|
4
4
|
* into a target, popper and tooltip
|
|
5
5
|
*/
|
|
6
|
-
export declare function useTooltip<T extends Element = Element>({ type, titleText, }?: {
|
|
6
|
+
export declare function useTooltip<T extends Element = Element>({ type, titleText, showDelay, hideDelay, }?: {
|
|
7
7
|
/**
|
|
8
8
|
* Determines the tooltip type for accessibility.
|
|
9
9
|
*
|
|
@@ -25,6 +25,14 @@ export declare function useTooltip<T extends Element = Element>({ type, titleTex
|
|
|
25
25
|
* The content of the `aria-label` if `type` is `label.
|
|
26
26
|
*/
|
|
27
27
|
titleText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Amount of time (in ms) to delay before showing the tooltip
|
|
30
|
+
*/
|
|
31
|
+
showDelay?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Amount of time (in ms) to delay before hiding the tooltip
|
|
34
|
+
*/
|
|
35
|
+
hideDelay?: number;
|
|
28
36
|
}): {
|
|
29
37
|
/** Mix these properties into the target element. **Must be an Element** */
|
|
30
38
|
targetProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/useTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/useTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkD/B;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,EACtD,IAAc,EACd,SAAc,EACd,SAAe,EACf,SAAe,GAChB,GAAE;IACD;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;IACtC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACf;IA6CF,2EAA2E;;;;;;;;;;IAY3E,uDAAuD;;;;;;IAMvD,iEAAiE;;;;;;;EAQpE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { useCloseOnEscape, useAlwaysCloseOnOutsideClick, usePopupModel, useCloseOnFullscreenExit, } from '@workday/canvas-kit-react/popup';
|
|
3
|
+
import { useUniqueId } from '@workday/canvas-kit-react/common';
|
|
4
4
|
var useIntentTimer = function (fn, waitMs) {
|
|
5
5
|
if (waitMs === void 0) { waitMs = 0; }
|
|
6
6
|
var timer = React.useRef();
|
|
@@ -41,15 +41,20 @@ var isInteractiveElement = function (element) {
|
|
|
41
41
|
* into a target, popper and tooltip
|
|
42
42
|
*/
|
|
43
43
|
export function useTooltip(_a) {
|
|
44
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.type, type = _c === void 0 ? 'label' : _c, _d = _b.titleText, titleText = _d === void 0 ? '' : _d;
|
|
44
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.type, type = _c === void 0 ? 'label' : _c, _d = _b.titleText, titleText = _d === void 0 ? '' : _d, _e = _b.showDelay, showDelay = _e === void 0 ? 300 : _e, _f = _b.hideDelay, hideDelay = _f === void 0 ? 100 : _f;
|
|
45
45
|
var mouseDownRef = React.useRef(false); // use to prevent newly focused from making tooltip flash
|
|
46
46
|
var popupModel = usePopupModel();
|
|
47
|
-
var
|
|
48
|
-
var id =
|
|
49
|
-
var
|
|
47
|
+
var _g = React.useState(null), anchorElement = _g[0], setAnchorElement = _g[1];
|
|
48
|
+
var id = useUniqueId();
|
|
49
|
+
var intentTimerHide = useIntentTimer(popupModel.events.hide, hideDelay);
|
|
50
|
+
var intentTimerShow = useIntentTimer(popupModel.events.show, showDelay);
|
|
51
|
+
var onHide = function () {
|
|
52
|
+
intentTimerHide.start();
|
|
53
|
+
intentTimerShow.clear();
|
|
54
|
+
};
|
|
50
55
|
var onOpen = function () {
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
intentTimerShow.start();
|
|
57
|
+
intentTimerHide.clear();
|
|
53
58
|
};
|
|
54
59
|
var onOpenFromTarget = function (event) {
|
|
55
60
|
setAnchorElement(event.currentTarget);
|
|
@@ -69,6 +74,7 @@ export function useTooltip(_a) {
|
|
|
69
74
|
};
|
|
70
75
|
useCloseOnEscape(popupModel);
|
|
71
76
|
useAlwaysCloseOnOutsideClick(popupModel);
|
|
77
|
+
useCloseOnFullscreenExit(popupModel);
|
|
72
78
|
var visible = popupModel.state.visibility !== 'hidden';
|
|
73
79
|
return {
|
|
74
80
|
/** Mix these properties into the target element. **Must be an Element** */
|
|
@@ -78,10 +84,10 @@ export function useTooltip(_a) {
|
|
|
78
84
|
// This will replace the accessible name of the target element
|
|
79
85
|
'aria-label': type === 'label' ? titleText : undefined,
|
|
80
86
|
onMouseEnter: onOpenFromTarget,
|
|
81
|
-
onMouseLeave:
|
|
87
|
+
onMouseLeave: onHide,
|
|
82
88
|
onMouseDown: onMouseDown,
|
|
83
89
|
onFocus: onFocus,
|
|
84
|
-
onBlur:
|
|
90
|
+
onBlur: onHide,
|
|
85
91
|
},
|
|
86
92
|
/** Mix these properties into the `Popper` component */
|
|
87
93
|
popperProps: {
|
|
@@ -94,7 +100,7 @@ export function useTooltip(_a) {
|
|
|
94
100
|
id: type === 'describe' && visible ? id : undefined,
|
|
95
101
|
role: 'tooltip',
|
|
96
102
|
onMouseEnter: onOpen,
|
|
97
|
-
onMouseLeave:
|
|
103
|
+
onMouseLeave: onHide,
|
|
98
104
|
},
|
|
99
105
|
};
|
|
100
106
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {space} from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
GrowthBehavior,
|
|
5
|
+
ErrorType,
|
|
6
|
+
styled,
|
|
7
|
+
Themeable,
|
|
8
|
+
generateUniqueId,
|
|
9
|
+
} from '@workday/canvas-kit-react/common';
|
|
4
10
|
import Hint from './Hint';
|
|
5
11
|
import Label from './Label';
|
|
6
12
|
import {FormFieldLabelPosition, FormFieldLabelPositionBehavior} from './types';
|
|
7
|
-
import uuid from 'uuid/v4';
|
|
8
13
|
|
|
9
14
|
export interface FormFieldProps
|
|
10
15
|
extends Themeable,
|
|
@@ -135,7 +140,7 @@ class FormField extends React.Component<FormFieldProps> {
|
|
|
135
140
|
static LabelPosition = FormFieldLabelPosition;
|
|
136
141
|
static ErrorType = ErrorType;
|
|
137
142
|
|
|
138
|
-
private inputId: string = this.props.inputId ||
|
|
143
|
+
private inputId: string = this.props.inputId || generateUniqueId();
|
|
139
144
|
|
|
140
145
|
private renderChildren = (child: React.ReactNode): React.ReactNode => {
|
|
141
146
|
if (React.isValidElement(child)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {keyframes} from '@emotion/core';
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
3
|
import canvas, {borderRadius} from '@workday/canvas-kit-react/tokens';
|
|
4
|
+
import {styled} from '@workday/canvas-kit-react/common';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Keyframe for the dots loading animation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "5.3.0-next.
|
|
3
|
+
"version": "5.3.0-next.32+a02de5eb",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"build": "npm-run-all --parallel build:cjs build:es6 --sequential build:downlevel-dts",
|
|
39
39
|
"prepack": "node ../../utils/publish.js pre react",
|
|
40
40
|
"postpack": "node ../../utils/publish.js post react",
|
|
41
|
-
"depcheck": "node ../../utils/check-dependencies-exist.js"
|
|
41
|
+
"depcheck": "node ../../utils/check-dependencies-exist.js",
|
|
42
|
+
"typecheck:src": "tsc -p . --noEmit --incremental false"
|
|
42
43
|
},
|
|
43
44
|
"keywords": [
|
|
44
45
|
"canvas",
|
|
@@ -56,9 +57,9 @@
|
|
|
56
57
|
"@emotion/styled": "^10.0.27",
|
|
57
58
|
"@popperjs/core": "^2.5.4",
|
|
58
59
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
59
|
-
"@workday/canvas-kit-labs-react": "^5.3.0-next.
|
|
60
|
-
"@workday/canvas-kit-popup-stack": "^5.3.0-next.
|
|
61
|
-
"@workday/canvas-kit-preview-react": "^5.3.0-next.
|
|
60
|
+
"@workday/canvas-kit-labs-react": "^5.3.0-next.32+a02de5eb",
|
|
61
|
+
"@workday/canvas-kit-popup-stack": "^5.3.0-next.32+a02de5eb",
|
|
62
|
+
"@workday/canvas-kit-preview-react": "^5.3.0-next.32+a02de5eb",
|
|
62
63
|
"@workday/canvas-system-icons-web": "1.0.41",
|
|
63
64
|
"@workday/design-assets-types": "^0.2.4",
|
|
64
65
|
"chroma-js": "^2.1.0",
|
|
@@ -69,12 +70,12 @@
|
|
|
69
70
|
"react-innertext": "^1.1.5",
|
|
70
71
|
"resize-observer-polyfill": "^1.5.1",
|
|
71
72
|
"rtl-css-js": "^1.14.1",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
73
|
+
"screenfull": "^5.2.0",
|
|
74
|
+
"use-resize-observer": "~7.0.1"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
77
|
"@workday/canvas-accent-icons-web": "^1.0.0",
|
|
77
78
|
"@workday/canvas-applet-icons-web": "^0.17.50"
|
|
78
79
|
},
|
|
79
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "a02de5eb284c706211aa55ef3554b11f52668b28"
|
|
80
81
|
}
|
package/popup/lib/PopupCard.tsx
CHANGED
|
@@ -42,37 +42,25 @@ const popupAnimation = (transformOrigin: TransformOrigin) => {
|
|
|
42
42
|
|
|
43
43
|
const StyledPopupCard = styled(Card)<
|
|
44
44
|
StyledType & {width?: number | string; transformOrigin?: TransformOrigin}
|
|
45
|
-
>(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
position: 'relative',
|
|
49
|
-
maxWidth: `calc(100vw - ${space.l})`,
|
|
50
|
-
},
|
|
51
|
-
({width}) => width && {width},
|
|
52
|
-
({transformOrigin}) => {
|
|
53
|
-
if (transformOrigin == null) {
|
|
54
|
-
return {};
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
animation: popupAnimation(transformOrigin),
|
|
58
|
-
animationDuration: '150ms',
|
|
59
|
-
animationTimingFunction: 'ease-out',
|
|
60
|
-
transformOrigin: `${transformOrigin.vertical} ${transformOrigin.horizontal}`,
|
|
61
|
-
// Allow overriding of animation in special cases
|
|
62
|
-
'.wd-no-animation &': {
|
|
63
|
-
animation: 'none',
|
|
64
|
-
},
|
|
65
|
-
};
|
|
45
|
+
>(type.levels.subtext.large, ({transformOrigin}) => {
|
|
46
|
+
if (transformOrigin == null) {
|
|
47
|
+
return {};
|
|
66
48
|
}
|
|
67
|
-
|
|
49
|
+
return {
|
|
50
|
+
animation: popupAnimation(transformOrigin),
|
|
51
|
+
animationDuration: '150ms',
|
|
52
|
+
animationTimingFunction: 'ease-out',
|
|
53
|
+
transformOrigin: `${transformOrigin.vertical} ${transformOrigin.horizontal}`,
|
|
54
|
+
// Allow overriding of animation in special cases
|
|
55
|
+
'.wd-no-animation &': {
|
|
56
|
+
animation: 'none',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
});
|
|
68
60
|
|
|
69
61
|
export const PopupCard = createComponent('div')({
|
|
70
62
|
displayName: 'Popup.Card',
|
|
71
|
-
Component: (
|
|
72
|
-
{children, model, padding = 'l', depth = 2, width, ...elemProps}: PopupCardProps,
|
|
73
|
-
ref,
|
|
74
|
-
Element
|
|
75
|
-
) => {
|
|
63
|
+
Component: ({children, model, ...elemProps}: PopupCardProps, ref, Element) => {
|
|
76
64
|
const localModel = useModelContext(PopupModelContext, model);
|
|
77
65
|
const props = usePopupCard(localModel, elemProps, ref);
|
|
78
66
|
const transformOrigin = React.useMemo(() => {
|
|
@@ -83,9 +71,10 @@ export const PopupCard = createComponent('div')({
|
|
|
83
71
|
<StyledPopupCard
|
|
84
72
|
as={Element}
|
|
85
73
|
transformOrigin={transformOrigin}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
position="relative"
|
|
75
|
+
padding="l"
|
|
76
|
+
depth={2}
|
|
77
|
+
maxWidth={`calc(100vw - ${space.l})`}
|
|
89
78
|
{...props}
|
|
90
79
|
>
|
|
91
80
|
{children}
|
package/popup/lib/hooks/index.ts
CHANGED
|
@@ -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,3 +16,5 @@ 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';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import screenfull from 'screenfull';
|
|
3
|
+
|
|
4
|
+
import {PopupModel} from './usePopupModel';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Closes the popup when fullscreen is exited. Entering/exiting fullscreen changes the context of
|
|
8
|
+
* the entire screen. This should be added to popup types that are very context sensitive like
|
|
9
|
+
* Tooltips.
|
|
10
|
+
*/
|
|
11
|
+
export const useCloseOnFullscreenExit = (model: PopupModel, elemProps = {}) => {
|
|
12
|
+
const handler = React.useCallback(
|
|
13
|
+
event => {
|
|
14
|
+
if (!screenfull.isFullscreen) {
|
|
15
|
+
model.events.hide({event});
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
[model.events]
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const visible = model.state.visibility !== 'hidden';
|
|
22
|
+
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
if (!visible) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (screenfull.isEnabled) {
|
|
28
|
+
screenfull.on('change', handler);
|
|
29
|
+
return () => {
|
|
30
|
+
screenfull.off('change', handler);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}, [handler, visible]);
|
|
35
|
+
|
|
36
|
+
return elemProps;
|
|
37
|
+
};
|
|
@@ -64,8 +64,9 @@ export const usePopupStack = <E extends HTMLElement>(
|
|
|
64
64
|
? target.current || undefined
|
|
65
65
|
: target
|
|
66
66
|
: undefined;
|
|
67
|
-
PopupStack.add({element: localRef.current!, owner: targetEl});
|
|
68
67
|
const element = localRef.current!;
|
|
68
|
+
|
|
69
|
+
PopupStack.add({element: element, owner: targetEl});
|
|
69
70
|
return () => {
|
|
70
71
|
PopupStack.remove(element);
|
|
71
72
|
};
|
|
@@ -8,7 +8,7 @@ import {changeFocus} from '@workday/canvas-kit-react/common';
|
|
|
8
8
|
* `useInitialFocus`. This should be used with `useFocusRedirect` or `useFocusTrap` for a complete
|
|
9
9
|
* focus management solution.
|
|
10
10
|
*
|
|
11
|
-
* This should
|
|
11
|
+
* This should be used on popup elements that use `useInitialFocus`.
|
|
12
12
|
*/
|
|
13
13
|
export const useReturnFocus = (model: PopupModel, elemProps = {}) => {
|
|
14
14
|
const visible = model.state.visibility !== 'hidden';
|
|
@@ -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
|
+
};
|