@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
|
@@ -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,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var screenfull_1 = __importDefault(require("screenfull"));
|
|
8
|
+
var canvas_kit_popup_stack_1 = require("@workday/canvas-kit-popup-stack");
|
|
9
|
+
/**
|
|
10
|
+
* Makes the popup transfer to fullscreen when fullscreen is exited. Without this hook, the popup
|
|
11
|
+
* would not operate correctly with other popups on the screen.
|
|
12
|
+
*
|
|
13
|
+
* Don't use this in conjunction with a hook that will close the popup when exiting fullscreen.
|
|
14
|
+
* Doing so would open the popup when the intention was to close it.
|
|
15
|
+
*/
|
|
16
|
+
exports.useTransferOnFullscreenExit = function (model, elemProps) {
|
|
17
|
+
if (elemProps === void 0) { elemProps = {}; }
|
|
18
|
+
var handler = react_1.default.useCallback(function (event) {
|
|
19
|
+
if (!screenfull_1.default.isFullscreen && model.state.stackRef.current) {
|
|
20
|
+
canvas_kit_popup_stack_1.PopupStack.transferToCurrentContext({
|
|
21
|
+
element: model.state.stackRef.current,
|
|
22
|
+
owner: model.state.targetRef.current,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}, [model.state.stackRef, model.state.targetRef]);
|
|
26
|
+
var visible = model.state.visibility !== 'hidden';
|
|
27
|
+
react_1.default.useEffect(function () {
|
|
28
|
+
if (!visible) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (screenfull_1.default.isEnabled) {
|
|
32
|
+
screenfull_1.default.on('change', handler);
|
|
33
|
+
return function () {
|
|
34
|
+
screenfull_1.default.off('change', handler);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}, [handler, visible]);
|
|
39
|
+
return elemProps;
|
|
40
|
+
};
|
|
@@ -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"}
|
|
@@ -41,7 +41,7 @@ exports.MenuList = common_1.createComponent('div')({
|
|
|
41
41
|
var model = _a.model, children = _a.children, elemProps = __rest(_a, ["model", "children"]);
|
|
42
42
|
var localModel = common_1.useModelContext(Menu_1.MenuModelContext, model);
|
|
43
43
|
var props = exports.useMenuList(localModel, elemProps, ref);
|
|
44
|
-
return (React.createElement(layout_1.Stack, __assign({ as: Element, background: tokens_1.commonColors.background, borderRadius: "
|
|
44
|
+
return (React.createElement(layout_1.Stack, __assign({ as: Element, background: tokens_1.commonColors.background, borderRadius: "zero", padding: "zero", marginY: "xxs", spacing: "zero", overflowY: "auto", flexDirection: localModel.state.orientation === 'vertical' ? 'column' : 'row' }, props), list_1.useRenderItems(localModel, children)));
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
47
|
exports.useMenuList = common_1.createHook(function (model) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflowModel.d.ts","sourceRoot":"","sources":["../../../../../tabs/lib/overflow/useOverflowModel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,aAAa,EAAc,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACL,cAAc,EACd,eAAe,EACf,wBAAwB,EAGxB,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,oBAAY,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG;IAC3D,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,oBAAY,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG;IAC7D,iBAAiB,CAAC,IAAI,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,CAAC;IAChD,sBAAsB,CAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,CAAC;IACpD,YAAY,CAAC,IAAI,EAAE;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,CAAC;IACtD,eAAe,CAAC,IAAI,EAAE;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,CAAC;IAC1C,YAAY,CAAC,IAAI,EAAE;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,CAAC;IACvC,eAAe,CAAC,IAAI,EAAE;QAAC,EAAE,EAAE,MAAM,CAA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AuB,CAAC,CAAC,CAAC,GAC7D,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAExF,wBAAgB,YAAY,CAC1B,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,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"}
|
|
@@ -46,6 +46,9 @@ function getHiddenIds(containerWidth, overflowTargetWidth, itemWidthCache, selec
|
|
|
46
46
|
itemWidth += itemWidthCache[selectedKey] + overflowTargetWidth;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
else {
|
|
50
|
+
itemWidth += overflowTargetWidth;
|
|
51
|
+
}
|
|
49
52
|
for (var key in itemWidthCache) {
|
|
50
53
|
if (key !== selectedKey) {
|
|
51
54
|
itemWidth += itemWidthCache[key];
|
|
@@ -97,6 +100,8 @@ exports.useOverflowModel = function (config) {
|
|
|
97
100
|
var id = _a.id, width = _a.width;
|
|
98
101
|
itemWidthCacheRef.current = __assign(__assign({}, itemWidthCacheRef.current), (_b = {}, _b[id] = width, _b));
|
|
99
102
|
setItemWidthCache(itemWidthCacheRef.current);
|
|
103
|
+
var ids = getHiddenIds(containerWidthRef.current, overflowTargetWidthRef.current, itemWidthCacheRef.current, state.selectedIds);
|
|
104
|
+
setHiddenIds(ids);
|
|
100
105
|
},
|
|
101
106
|
removeItemWidth: function (_a) {
|
|
102
107
|
var id = _a.id;
|
|
@@ -104,6 +109,10 @@ exports.useOverflowModel = function (config) {
|
|
|
104
109
|
delete newCache[id];
|
|
105
110
|
itemWidthCacheRef.current = newCache;
|
|
106
111
|
setItemWidthCache(itemWidthCacheRef.current);
|
|
112
|
+
var ids = getHiddenIds(containerWidthRef.current, overflowTargetWidthRef.current, itemWidthCacheRef.current, state.selectedIds !== 'all'
|
|
113
|
+
? state.selectedIds.filter(function (sId) { return id !== sId; })
|
|
114
|
+
: state.selectedIds);
|
|
115
|
+
setHiddenIds(ids);
|
|
107
116
|
},
|
|
108
117
|
addHiddenKey: function (_a) {
|
|
109
118
|
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"}
|
|
@@ -51,9 +51,14 @@ function mergeCallbacks(elemProps, componentProps, keys) {
|
|
|
51
51
|
}, {});
|
|
52
52
|
}
|
|
53
53
|
exports.Tooltip = function (_a) {
|
|
54
|
-
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"]);
|
|
54
|
+
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"]);
|
|
55
55
|
var titleText = react_innertext_1.default(title);
|
|
56
|
-
var
|
|
56
|
+
var _f = useTooltip_1.useTooltip({
|
|
57
|
+
type: type,
|
|
58
|
+
titleText: titleText,
|
|
59
|
+
showDelay: showDelay,
|
|
60
|
+
hideDelay: hideDelay,
|
|
61
|
+
}), targetProps = _f.targetProps, popperProps = _f.popperProps, tooltipProps = _f.tooltipProps;
|
|
57
62
|
return (React.createElement(React.Fragment, null,
|
|
58
63
|
React.cloneElement(children, __assign(__assign(__assign({}, targetProps), mergeCallbacks(children.props, targetProps)), (type === 'muted' && children.props['aria-label']
|
|
59
64
|
? { '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"}
|
|
@@ -6,13 +6,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
6
6
|
result["default"] = mod;
|
|
7
7
|
return result;
|
|
8
8
|
};
|
|
9
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
10
|
var React = __importStar(require("react"));
|
|
14
|
-
var v4_1 = __importDefault(require("uuid/v4"));
|
|
15
11
|
var popup_1 = require("@workday/canvas-kit-react/popup");
|
|
12
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
16
13
|
var useIntentTimer = function (fn, waitMs) {
|
|
17
14
|
if (waitMs === void 0) { waitMs = 0; }
|
|
18
15
|
var timer = React.useRef();
|
|
@@ -53,15 +50,20 @@ var isInteractiveElement = function (element) {
|
|
|
53
50
|
* into a target, popper and tooltip
|
|
54
51
|
*/
|
|
55
52
|
function useTooltip(_a) {
|
|
56
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.type, type = _c === void 0 ? 'label' : _c, _d = _b.titleText, titleText = _d === void 0 ? '' : _d;
|
|
53
|
+
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;
|
|
57
54
|
var mouseDownRef = React.useRef(false); // use to prevent newly focused from making tooltip flash
|
|
58
55
|
var popupModel = popup_1.usePopupModel();
|
|
59
|
-
var
|
|
60
|
-
var id =
|
|
61
|
-
var
|
|
56
|
+
var _g = React.useState(null), anchorElement = _g[0], setAnchorElement = _g[1];
|
|
57
|
+
var id = common_1.useUniqueId();
|
|
58
|
+
var intentTimerHide = useIntentTimer(popupModel.events.hide, hideDelay);
|
|
59
|
+
var intentTimerShow = useIntentTimer(popupModel.events.show, showDelay);
|
|
60
|
+
var onHide = function () {
|
|
61
|
+
intentTimerHide.start();
|
|
62
|
+
intentTimerShow.clear();
|
|
63
|
+
};
|
|
62
64
|
var onOpen = function () {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
intentTimerShow.start();
|
|
66
|
+
intentTimerHide.clear();
|
|
65
67
|
};
|
|
66
68
|
var onOpenFromTarget = function (event) {
|
|
67
69
|
setAnchorElement(event.currentTarget);
|
|
@@ -81,6 +83,7 @@ function useTooltip(_a) {
|
|
|
81
83
|
};
|
|
82
84
|
popup_1.useCloseOnEscape(popupModel);
|
|
83
85
|
popup_1.useAlwaysCloseOnOutsideClick(popupModel);
|
|
86
|
+
popup_1.useCloseOnFullscreenExit(popupModel);
|
|
84
87
|
var visible = popupModel.state.visibility !== 'hidden';
|
|
85
88
|
return {
|
|
86
89
|
/** Mix these properties into the target element. **Must be an Element** */
|
|
@@ -90,10 +93,10 @@ function useTooltip(_a) {
|
|
|
90
93
|
// This will replace the accessible name of the target element
|
|
91
94
|
'aria-label': type === 'label' ? titleText : undefined,
|
|
92
95
|
onMouseEnter: onOpenFromTarget,
|
|
93
|
-
onMouseLeave:
|
|
96
|
+
onMouseLeave: onHide,
|
|
94
97
|
onMouseDown: onMouseDown,
|
|
95
98
|
onFocus: onFocus,
|
|
96
|
-
onBlur:
|
|
99
|
+
onBlur: onHide,
|
|
97
100
|
},
|
|
98
101
|
/** Mix these properties into the `Popper` component */
|
|
99
102
|
popperProps: {
|
|
@@ -106,7 +109,7 @@ function useTooltip(_a) {
|
|
|
106
109
|
id: type === 'describe' && visible ? id : undefined,
|
|
107
110
|
role: 'tooltip',
|
|
108
111
|
onMouseEnter: onOpen,
|
|
109
|
-
onMouseLeave:
|
|
112
|
+
onMouseLeave: onHide,
|
|
110
113
|
},
|
|
111
114
|
};
|
|
112
115
|
}
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
|
@@ -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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsFullscreen.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/useIsFullscreen.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,eAgB3B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import screenfull from 'screenfull';
|
|
3
|
+
export var useIsFullscreen = function () {
|
|
4
|
+
var _a = React.useState(false), isFullscreen = _a[0], setIsFullscreen = _a[1];
|
|
5
|
+
var handler = React.useCallback(function () {
|
|
6
|
+
setIsFullscreen(screenfull.isFullscreen);
|
|
7
|
+
}, []);
|
|
8
|
+
React.useEffect(function () {
|
|
9
|
+
screenfull.on('change', handler);
|
|
10
|
+
return function () {
|
|
11
|
+
screenfull.off('change', handler);
|
|
12
|
+
};
|
|
13
|
+
}, [handler]);
|
|
14
|
+
return isFullscreen;
|
|
15
|
+
};
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniqueId.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/useUniqueId.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useUniqueId.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/useUniqueId.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,cAAkC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,WAAW,qCAIvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,qCAAc,CAAC;AAEpC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,qBAEzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAE9B,CAAC"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
import uuid from 'uuid/v4';
|
|
2
1
|
import { useConstant } from './useConstant';
|
|
3
|
-
|
|
2
|
+
// Create a unique seed per import to prevent collisions from other versions of `useUniqueId`
|
|
3
|
+
var seed = Math.random()
|
|
4
|
+
.toString(36)
|
|
5
|
+
.slice(2)
|
|
6
|
+
.replace(/[0-9]*/, '')
|
|
7
|
+
.substr(0, 4);
|
|
8
|
+
var c = 0;
|
|
9
|
+
/**
|
|
10
|
+
* Generates a unique and HTML5 compliant identifier every time it is called. Internally it uses a 4
|
|
11
|
+
* character random seed starting with a letter. This seed is unique to each instance of this
|
|
12
|
+
* package meaning different versions of Canvas Kit on the page will have a different seed. Each
|
|
13
|
+
* call will use a Base 36 string (10 numbers + 26 letters) based on an incremented number. The
|
|
14
|
+
* incremented number always starts at 0 and can be reset for testing purposes using
|
|
15
|
+
* [resetUniqueIdCount](#resetuniqueidcount). [setUniqueSeed](#setuniqueseed) can also be used for
|
|
16
|
+
* testing or server side rendering to get the same results during hydration.
|
|
17
|
+
*/
|
|
18
|
+
export var generateUniqueId = function () { return seed + (c++).toString(36); };
|
|
4
19
|
/**
|
|
5
20
|
* Generate a unique ID if one is not provided. The generated ID will be stable across renders
|
|
6
21
|
* @param id Optional ID provided that will be used instead of a unique ID
|
|
@@ -16,3 +31,26 @@ export var useUniqueId = function (id) {
|
|
|
16
31
|
* TODO: Remove in major release
|
|
17
32
|
*/
|
|
18
33
|
export var uniqueId = useUniqueId;
|
|
34
|
+
/**
|
|
35
|
+
* Update the seed used by the id generator. This is useful for snapshot tests to help stabilize ids
|
|
36
|
+
* generated each run. This could also be used for server-side hydration - if you choose the same
|
|
37
|
+
* seed for server and set that on the client before components are rendered, the ids generated will
|
|
38
|
+
* be the same.
|
|
39
|
+
* @example
|
|
40
|
+
* // set in a script tag from the server
|
|
41
|
+
* setSeed(window.__ID_SEED); // set in a script tag from the server
|
|
42
|
+
*
|
|
43
|
+
* // jest setup
|
|
44
|
+
* before(() => {
|
|
45
|
+
* setSeed('a')
|
|
46
|
+
* })
|
|
47
|
+
*/
|
|
48
|
+
export var setUniqueSeed = function (s) {
|
|
49
|
+
seed = s;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* This should only be called for tests in an `beforeEach`
|
|
53
|
+
*/
|
|
54
|
+
export var resetUniqueIdCount = function () {
|
|
55
|
+
c = 0;
|
|
56
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MA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P;AAKD,eAAe,SAAS,CAAC"}
|
|
@@ -35,11 +35,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
35
35
|
};
|
|
36
36
|
import * as React from 'react';
|
|
37
37
|
import { space } from '@workday/canvas-kit-react/tokens';
|
|
38
|
-
import { ErrorType, styled } from '@workday/canvas-kit-react/common';
|
|
38
|
+
import { ErrorType, styled, generateUniqueId, } from '@workday/canvas-kit-react/common';
|
|
39
39
|
import Hint from './Hint';
|
|
40
40
|
import Label from './Label';
|
|
41
41
|
import { FormFieldLabelPosition } from './types';
|
|
42
|
-
import uuid from 'uuid/v4';
|
|
43
42
|
// Use a fieldset element for accessible radio groups
|
|
44
43
|
var FormFieldFieldsetContainer = styled('fieldset')(function (_a) {
|
|
45
44
|
var grow = _a.grow, labelPosition = _a.labelPosition;
|
|
@@ -99,7 +98,7 @@ var FormField = /** @class */ (function (_super) {
|
|
|
99
98
|
__extends(FormField, _super);
|
|
100
99
|
function FormField() {
|
|
101
100
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
102
|
-
_this.inputId = _this.props.inputId ||
|
|
101
|
+
_this.inputId = _this.props.inputId || generateUniqueId();
|
|
103
102
|
_this.renderChildren = function (child) {
|
|
104
103
|
if (React.isValidElement(child)) {
|
|
105
104
|
var props = __assign({}, child.props);
|
|
@@ -26,8 +26,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
26
26
|
};
|
|
27
27
|
import * as React from 'react';
|
|
28
28
|
import { keyframes } from '@emotion/core';
|
|
29
|
-
import styled from '@emotion/styled';
|
|
30
29
|
import canvas, { borderRadius } from '@workday/canvas-kit-react/tokens';
|
|
30
|
+
import { styled } from '@workday/canvas-kit-react/common';
|
|
31
31
|
/**
|
|
32
32
|
* Keyframe for the dots loading animation.
|
|
33
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupCard.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,IAAI,EAAC,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAOL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAe,UAAU,EAAoB,MAAM,SAAS,CAAC;AAEpE,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC;IACtE;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"PopupCard.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,IAAI,EAAC,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAOL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAe,UAAU,EAAoB,MAAM,SAAS,CAAC;AAEpE,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC;IACtE;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAmCD,eAAO,MAAM,SAAS,gEAuBpB,CAAC"}
|
|
@@ -35,13 +35,7 @@ var popupAnimation = function (transformOrigin) {
|
|
|
35
35
|
var translate = getTranslateFromOrigin(transformOrigin, space.xxs);
|
|
36
36
|
return keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {\n opacity: 0;\n transform: translate(", "px, ", "px);\n }\n 100% {\n opacity: 1;\n transform: translate(0);\n }\n "], ["\n 0% {\n opacity: 0;\n transform: translate(", "px, ", "px);\n }\n 100% {\n opacity: 1;\n transform: translate(0);\n }\n "])), translate.x, translate.y);
|
|
37
37
|
};
|
|
38
|
-
var StyledPopupCard = styled(Card)(type.levels.subtext.large, {
|
|
39
|
-
position: 'relative',
|
|
40
|
-
maxWidth: "calc(100vw - " + space.l + ")",
|
|
41
|
-
}, function (_a) {
|
|
42
|
-
var width = _a.width;
|
|
43
|
-
return width && { width: width };
|
|
44
|
-
}, function (_a) {
|
|
38
|
+
var StyledPopupCard = styled(Card)(type.levels.subtext.large, function (_a) {
|
|
45
39
|
var transformOrigin = _a.transformOrigin;
|
|
46
40
|
if (transformOrigin == null) {
|
|
47
41
|
return {};
|
|
@@ -60,13 +54,13 @@ var StyledPopupCard = styled(Card)(type.levels.subtext.large, {
|
|
|
60
54
|
export var PopupCard = createComponent('div')({
|
|
61
55
|
displayName: 'Popup.Card',
|
|
62
56
|
Component: function (_a, ref, Element) {
|
|
63
|
-
var children = _a.children, model = _a.model,
|
|
57
|
+
var children = _a.children, model = _a.model, elemProps = __rest(_a, ["children", "model"]);
|
|
64
58
|
var localModel = useModelContext(PopupModelContext, model);
|
|
65
59
|
var props = usePopupCard(localModel, elemProps, ref);
|
|
66
60
|
var transformOrigin = React.useMemo(function () {
|
|
67
61
|
return getTransformFromPlacement(localModel.state.placement || 'bottom');
|
|
68
62
|
}, [localModel.state.placement]);
|
|
69
|
-
return (React.createElement(StyledPopupCard, __assign({ as: Element, transformOrigin: transformOrigin,
|
|
63
|
+
return (React.createElement(StyledPopupCard, __assign({ as: Element, transformOrigin: transformOrigin, position: "relative", padding: "l", depth: 2, maxWidth: "calc(100vw - " + space.l + ")" }, props), children));
|
|
70
64
|
},
|
|
71
65
|
});
|
|
72
66
|
var templateObject_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-trap-js.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/focus-trap-js.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"focus-trap-js.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/focus-trap-js.ts"],"names":[],"mappings":"AAkFA,iBAAS,cAAc,CACrB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,WAAW,GAAG,QAAQ,EAClC,YAAY,GAAE,WAAW,EAAE,GAAG,IAAW,uBAgC1C;kBAnCQ,cAAc;;;AA0DvB,OAAO,EAAC,cAAc,EAAC,CAAC"}
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC"}
|
|
@@ -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,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 @@
|
|
|
1
|
+
{"version":3,"file":"useCloseOnFullscreenExit.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useCloseOnFullscreenExit.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,sIA0BpC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import screenfull from 'screenfull';
|
|
3
|
+
/**
|
|
4
|
+
* Closes the popup when fullscreen is exited. Entering/exiting fullscreen changes the context of
|
|
5
|
+
* the entire screen. This should be added to popup types that are very context sensitive like
|
|
6
|
+
* Tooltips.
|
|
7
|
+
*/
|
|
8
|
+
export var useCloseOnFullscreenExit = function (model, elemProps) {
|
|
9
|
+
if (elemProps === void 0) { elemProps = {}; }
|
|
10
|
+
var handler = React.useCallback(function (event) {
|
|
11
|
+
if (!screenfull.isFullscreen) {
|
|
12
|
+
model.events.hide({ event: event });
|
|
13
|
+
}
|
|
14
|
+
}, [model.events]);
|
|
15
|
+
var visible = model.state.visibility !== 'hidden';
|
|
16
|
+
React.useEffect(function () {
|
|
17
|
+
if (!visible) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (screenfull.isEnabled) {
|
|
21
|
+
screenfull.on('change', handler);
|
|
22
|
+
return function () {
|
|
23
|
+
screenfull.off('change', handler);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}, [handler, visible]);
|
|
28
|
+
return elemProps;
|
|
29
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopupStack.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/usePopupStack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"usePopupStack.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/usePopupStack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,aAAa,wMA8CzB,CAAC"}
|