@workday/canvas-kit-react 6.0.0-alpha.0-next.33 → 6.0.0-alpha.0-next.39
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/banner/index.ts +1 -4
- package/banner/lib/Banner.tsx +85 -111
- package/banner/lib/BannerActionText.tsx +46 -0
- package/banner/lib/BannerIcon.tsx +40 -0
- package/banner/lib/BannerLabel.tsx +29 -0
- package/banner/lib/hooks/index.ts +6 -0
- package/banner/lib/hooks/useBanner.tsx +13 -0
- package/banner/lib/hooks/useBannerActionText.tsx +12 -0
- package/banner/lib/hooks/useBannerIcon.tsx +19 -0
- package/banner/lib/hooks/useBannerLabel.tsx +12 -0
- package/banner/lib/hooks/useBannerModel.tsx +63 -0
- package/banner/lib/hooks/useThemedPalette.ts +53 -0
- package/button/lib/IconButton.tsx +5 -2
- package/common/lib/styles/hideMouseFocus.ts +3 -2
- package/dist/commonjs/banner/index.d.ts +1 -3
- package/dist/commonjs/banner/index.d.ts.map +1 -1
- package/dist/commonjs/banner/index.js +1 -6
- package/dist/commonjs/banner/lib/Banner.d.ts +17 -33
- package/dist/commonjs/banner/lib/Banner.d.ts.map +1 -1
- package/dist/commonjs/banner/lib/Banner.js +44 -69
- package/dist/commonjs/banner/lib/BannerActionText.d.ts +14 -0
- package/dist/commonjs/banner/lib/BannerActionText.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/BannerActionText.js +42 -0
- package/dist/commonjs/banner/lib/BannerIcon.d.ts +14 -0
- package/dist/commonjs/banner/lib/BannerIcon.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/BannerIcon.js +47 -0
- package/dist/commonjs/banner/lib/BannerLabel.d.ts +13 -0
- package/dist/commonjs/banner/lib/BannerLabel.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/BannerLabel.js +45 -0
- package/dist/commonjs/banner/lib/hooks/index.d.ts +7 -0
- package/dist/commonjs/banner/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/hooks/index.js +11 -0
- package/dist/commonjs/banner/lib/hooks/useBanner.d.ts +16 -0
- package/dist/commonjs/banner/lib/hooks/useBanner.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/hooks/useBanner.js +14 -0
- package/dist/commonjs/banner/lib/hooks/useBannerActionText.d.ts +15 -0
- package/dist/commonjs/banner/lib/hooks/useBannerActionText.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/hooks/useBannerActionText.js +13 -0
- package/dist/commonjs/banner/lib/hooks/useBannerIcon.d.ts +18 -0
- package/dist/commonjs/banner/lib/hooks/useBannerIcon.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/hooks/useBannerIcon.js +19 -0
- package/dist/commonjs/banner/lib/hooks/useBannerLabel.d.ts +15 -0
- package/dist/commonjs/banner/lib/hooks/useBannerLabel.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/hooks/useBannerLabel.js +13 -0
- package/dist/commonjs/banner/lib/hooks/useBannerModel.d.ts +37 -0
- package/dist/commonjs/banner/lib/hooks/useBannerModel.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/hooks/useBannerModel.js +22 -0
- package/dist/commonjs/banner/lib/hooks/useThemedPalette.d.ts +11 -0
- package/dist/commonjs/banner/lib/hooks/useThemedPalette.d.ts.map +1 -0
- package/dist/commonjs/banner/lib/hooks/useThemedPalette.js +39 -0
- package/dist/commonjs/button/lib/IconButton.d.ts +5 -2
- package/dist/commonjs/button/lib/IconButton.d.ts.map +1 -1
- package/dist/commonjs/common/lib/styles/hideMouseFocus.d.ts +3 -2
- package/dist/commonjs/common/lib/styles/hideMouseFocus.d.ts.map +1 -1
- package/dist/commonjs/loading-animation/lib/LoadingDots.js +3 -6
- package/dist/commonjs/pagination/lib/Pagination/common/Stack.d.ts +1 -1
- 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/useReturnFocus.d.ts +1 -1
- package/dist/commonjs/popup/lib/hooks/useReturnFocus.js +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 +13 -8
- package/dist/es6/banner/index.d.ts +1 -3
- package/dist/es6/banner/index.d.ts.map +1 -1
- package/dist/es6/banner/index.js +1 -3
- package/dist/es6/banner/lib/Banner.d.ts +17 -33
- package/dist/es6/banner/lib/Banner.d.ts.map +1 -1
- package/dist/es6/banner/lib/Banner.js +46 -71
- package/dist/es6/banner/lib/BannerActionText.d.ts +14 -0
- package/dist/es6/banner/lib/BannerActionText.d.ts.map +1 -0
- package/dist/es6/banner/lib/BannerActionText.js +40 -0
- package/dist/es6/banner/lib/BannerIcon.d.ts +14 -0
- package/dist/es6/banner/lib/BannerIcon.d.ts.map +1 -0
- package/dist/es6/banner/lib/BannerIcon.js +45 -0
- package/dist/es6/banner/lib/BannerLabel.d.ts +13 -0
- package/dist/es6/banner/lib/BannerLabel.d.ts.map +1 -0
- package/dist/es6/banner/lib/BannerLabel.js +36 -0
- package/dist/es6/banner/lib/hooks/index.d.ts +7 -0
- package/dist/es6/banner/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/banner/lib/hooks/index.js +6 -0
- package/dist/es6/banner/lib/hooks/useBanner.d.ts +16 -0
- package/dist/es6/banner/lib/hooks/useBanner.d.ts.map +1 -0
- package/dist/es6/banner/lib/hooks/useBanner.js +12 -0
- package/dist/es6/banner/lib/hooks/useBannerActionText.d.ts +15 -0
- package/dist/es6/banner/lib/hooks/useBannerActionText.d.ts.map +1 -0
- package/dist/es6/banner/lib/hooks/useBannerActionText.js +11 -0
- package/dist/es6/banner/lib/hooks/useBannerIcon.d.ts +18 -0
- package/dist/es6/banner/lib/hooks/useBannerIcon.d.ts.map +1 -0
- package/dist/es6/banner/lib/hooks/useBannerIcon.js +17 -0
- package/dist/es6/banner/lib/hooks/useBannerLabel.d.ts +15 -0
- package/dist/es6/banner/lib/hooks/useBannerLabel.d.ts.map +1 -0
- package/dist/es6/banner/lib/hooks/useBannerLabel.js +11 -0
- package/dist/es6/banner/lib/hooks/useBannerModel.d.ts +37 -0
- package/dist/es6/banner/lib/hooks/useBannerModel.d.ts.map +1 -0
- package/dist/es6/banner/lib/hooks/useBannerModel.js +20 -0
- package/dist/es6/banner/lib/hooks/useThemedPalette.d.ts +11 -0
- package/dist/es6/banner/lib/hooks/useThemedPalette.d.ts.map +1 -0
- package/dist/es6/banner/lib/hooks/useThemedPalette.js +33 -0
- package/dist/es6/button/lib/IconButton.d.ts +5 -2
- package/dist/es6/button/lib/IconButton.d.ts.map +1 -1
- package/dist/es6/common/lib/styles/hideMouseFocus.d.ts +3 -2
- package/dist/es6/common/lib/styles/hideMouseFocus.d.ts.map +1 -1
- package/dist/es6/loading-animation/lib/LoadingDots.js +1 -1
- package/dist/es6/pagination/lib/Pagination/common/Stack.d.ts +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/useReturnFocus.d.ts +1 -1
- package/dist/es6/popup/lib/hooks/useReturnFocus.js +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 +13 -8
- package/loading-animation/lib/LoadingDots.tsx +1 -1
- package/package.json +7 -6
- package/popup/lib/PopupCard.tsx +19 -30
- package/popup/lib/hooks/useReturnFocus.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 +21 -6
- package/ts3.5/dist/commonjs/banner/index.d.ts +1 -3
- package/ts3.5/dist/commonjs/banner/lib/Banner.d.ts +17 -33
- package/ts3.5/dist/commonjs/banner/lib/BannerActionText.d.ts +14 -0
- package/ts3.5/dist/commonjs/banner/lib/BannerIcon.d.ts +14 -0
- package/ts3.5/dist/commonjs/banner/lib/BannerLabel.d.ts +13 -0
- package/ts3.5/dist/commonjs/banner/lib/hooks/index.d.ts +7 -0
- package/ts3.5/dist/commonjs/banner/lib/hooks/useBanner.d.ts +16 -0
- package/ts3.5/dist/commonjs/banner/lib/hooks/useBannerActionText.d.ts +15 -0
- package/ts3.5/dist/commonjs/banner/lib/hooks/useBannerIcon.d.ts +18 -0
- package/ts3.5/dist/commonjs/banner/lib/hooks/useBannerLabel.d.ts +15 -0
- package/ts3.5/dist/commonjs/banner/lib/hooks/useBannerModel.d.ts +37 -0
- package/ts3.5/dist/commonjs/banner/lib/hooks/useThemedPalette.d.ts +11 -0
- package/ts3.5/dist/commonjs/button/lib/IconButton.d.ts +5 -2
- package/ts3.5/dist/commonjs/common/lib/styles/hideMouseFocus.d.ts +3 -2
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/Stack.d.ts +1 -1
- package/ts3.5/dist/commonjs/popup/lib/hooks/useReturnFocus.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/banner/index.d.ts +1 -3
- package/ts3.5/dist/es6/banner/lib/Banner.d.ts +17 -33
- package/ts3.5/dist/es6/banner/lib/BannerActionText.d.ts +14 -0
- package/ts3.5/dist/es6/banner/lib/BannerIcon.d.ts +14 -0
- package/ts3.5/dist/es6/banner/lib/BannerLabel.d.ts +13 -0
- package/ts3.5/dist/es6/banner/lib/hooks/index.d.ts +7 -0
- package/ts3.5/dist/es6/banner/lib/hooks/useBanner.d.ts +16 -0
- package/ts3.5/dist/es6/banner/lib/hooks/useBannerActionText.d.ts +15 -0
- package/ts3.5/dist/es6/banner/lib/hooks/useBannerIcon.d.ts +18 -0
- package/ts3.5/dist/es6/banner/lib/hooks/useBannerLabel.d.ts +15 -0
- package/ts3.5/dist/es6/banner/lib/hooks/useBannerModel.d.ts +37 -0
- package/ts3.5/dist/es6/banner/lib/hooks/useThemedPalette.d.ts +11 -0
- package/ts3.5/dist/es6/button/lib/IconButton.d.ts +5 -2
- package/ts3.5/dist/es6/common/lib/styles/hideMouseFocus.d.ts +3 -2
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/Stack.d.ts +1 -1
- package/ts3.5/dist/es6/popup/lib/hooks/useReturnFocus.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
|
@@ -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;AAiD/B;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,EACtD,IAAc,EACd,SAAc,
|
|
1
|
+
{"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/useTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiD/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;IA4CF,2EAA2E;;;;;;;;;;IAY3E,uDAAuD;;;;;;IAMvD,iEAAiE;;;;;;;EAQpE"}
|
|
@@ -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
|
|
47
|
+
var _g = React.useState(null), anchorElement = _g[0], setAnchorElement = _g[1];
|
|
48
48
|
var id = React.useState(function () { return uuid(); })[0];
|
|
49
|
-
var
|
|
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);
|
|
@@ -78,10 +83,10 @@ export function useTooltip(_a) {
|
|
|
78
83
|
// This will replace the accessible name of the target element
|
|
79
84
|
'aria-label': type === 'label' ? titleText : undefined,
|
|
80
85
|
onMouseEnter: onOpenFromTarget,
|
|
81
|
-
onMouseLeave:
|
|
86
|
+
onMouseLeave: onHide,
|
|
82
87
|
onMouseDown: onMouseDown,
|
|
83
88
|
onFocus: onFocus,
|
|
84
|
-
onBlur:
|
|
89
|
+
onBlur: onHide,
|
|
85
90
|
},
|
|
86
91
|
/** Mix these properties into the `Popper` component */
|
|
87
92
|
popperProps: {
|
|
@@ -94,7 +99,7 @@ export function useTooltip(_a) {
|
|
|
94
99
|
id: type === 'describe' && visible ? id : undefined,
|
|
95
100
|
role: 'tooltip',
|
|
96
101
|
onMouseEnter: onOpen,
|
|
97
|
-
onMouseLeave:
|
|
102
|
+
onMouseLeave: onHide,
|
|
98
103
|
},
|
|
99
104
|
};
|
|
100
105
|
}
|
|
@@ -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": "6.0.0-alpha.0-next.
|
|
3
|
+
"version": "6.0.0-alpha.0-next.39+ac7c09b9",
|
|
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": "^6.0.0-alpha.0-next.
|
|
60
|
-
"@workday/canvas-kit-popup-stack": "^6.0.0-alpha.0-next.
|
|
61
|
-
"@workday/canvas-kit-preview-react": "^6.0.0-alpha.0-next.
|
|
60
|
+
"@workday/canvas-kit-labs-react": "^6.0.0-alpha.0-next.39+ac7c09b9",
|
|
61
|
+
"@workday/canvas-kit-popup-stack": "^6.0.0-alpha.0-next.39+ac7c09b9",
|
|
62
|
+
"@workday/canvas-kit-preview-react": "^6.0.0-alpha.0-next.39+ac7c09b9",
|
|
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",
|
|
@@ -76,5 +77,5 @@
|
|
|
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": "ac7c09b97add635f256ffc4103478fab55da55c2"
|
|
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}
|
|
@@ -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';
|
|
@@ -36,10 +36,9 @@ export const MenuList = createComponent('div')({
|
|
|
36
36
|
<Stack
|
|
37
37
|
as={Element}
|
|
38
38
|
background={commonColors.background}
|
|
39
|
-
borderRadius="
|
|
39
|
+
borderRadius="zero"
|
|
40
40
|
padding="zero"
|
|
41
|
-
marginY="
|
|
42
|
-
marginX="xxs"
|
|
41
|
+
marginY="xxs"
|
|
43
42
|
spacing="zero"
|
|
44
43
|
overflowY="auto"
|
|
45
44
|
flexDirection={localModel.state.orientation === 'vertical' ? 'column' : 'row'}
|
|
@@ -92,6 +92,8 @@ export function getHiddenIds(
|
|
|
92
92
|
// at least the selected item and overflow target fit. Update our itemWidth with the sum
|
|
93
93
|
itemWidth += itemWidthCache[selectedKey] + overflowTargetWidth;
|
|
94
94
|
}
|
|
95
|
+
} else {
|
|
96
|
+
itemWidth += overflowTargetWidth;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
for (const key in itemWidthCache) {
|
|
@@ -166,12 +168,32 @@ export const useOverflowModel = <T extends unknown>(
|
|
|
166
168
|
itemWidthCacheRef.current = {...itemWidthCacheRef.current, [id]: width};
|
|
167
169
|
|
|
168
170
|
setItemWidthCache(itemWidthCacheRef.current);
|
|
171
|
+
|
|
172
|
+
const ids = getHiddenIds(
|
|
173
|
+
containerWidthRef.current,
|
|
174
|
+
overflowTargetWidthRef.current,
|
|
175
|
+
itemWidthCacheRef.current,
|
|
176
|
+
state.selectedIds
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
setHiddenIds(ids);
|
|
169
180
|
},
|
|
170
181
|
removeItemWidth({id}) {
|
|
171
182
|
const newCache = {...itemWidthCacheRef.current};
|
|
172
183
|
delete newCache[id];
|
|
173
184
|
itemWidthCacheRef.current = newCache;
|
|
174
185
|
setItemWidthCache(itemWidthCacheRef.current);
|
|
186
|
+
|
|
187
|
+
const ids = getHiddenIds(
|
|
188
|
+
containerWidthRef.current,
|
|
189
|
+
overflowTargetWidthRef.current,
|
|
190
|
+
itemWidthCacheRef.current,
|
|
191
|
+
state.selectedIds !== 'all'
|
|
192
|
+
? state.selectedIds.filter(sId => id !== sId)
|
|
193
|
+
: state.selectedIds
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
setHiddenIds(ids);
|
|
175
197
|
},
|
|
176
198
|
addHiddenKey({id}) {
|
|
177
199
|
setHiddenIds(ids => ids.concat(id));
|
package/tooltip/lib/Tooltip.tsx
CHANGED
|
@@ -44,6 +44,14 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
44
44
|
* @default 'label'
|
|
45
45
|
*/
|
|
46
46
|
type?: 'label' | 'describe' | 'muted';
|
|
47
|
+
/**
|
|
48
|
+
* Amount of time (in ms) to delay before showing the tooltip
|
|
49
|
+
*/
|
|
50
|
+
showDelay?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Amount of time (in ms) to delay before hiding the tooltip
|
|
53
|
+
*/
|
|
54
|
+
hideDelay?: number;
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
function mergeCallbacks<T extends {[key: string]: any}>(
|
|
@@ -66,10 +74,17 @@ export const Tooltip = ({
|
|
|
66
74
|
placement = 'top',
|
|
67
75
|
title,
|
|
68
76
|
children,
|
|
77
|
+
showDelay = 300,
|
|
78
|
+
hideDelay = 100,
|
|
69
79
|
...elemProps
|
|
70
80
|
}: TooltipProps) => {
|
|
71
81
|
const titleText = innerText(title);
|
|
72
|
-
const {targetProps, popperProps, tooltipProps} = useTooltip({
|
|
82
|
+
const {targetProps, popperProps, tooltipProps} = useTooltip({
|
|
83
|
+
type,
|
|
84
|
+
titleText,
|
|
85
|
+
showDelay,
|
|
86
|
+
hideDelay,
|
|
87
|
+
});
|
|
73
88
|
|
|
74
89
|
return (
|
|
75
90
|
<React.Fragment>
|
|
@@ -54,6 +54,8 @@ const isInteractiveElement = (element: Element) => {
|
|
|
54
54
|
export function useTooltip<T extends Element = Element>({
|
|
55
55
|
type = 'label',
|
|
56
56
|
titleText = '',
|
|
57
|
+
showDelay = 300,
|
|
58
|
+
hideDelay = 100,
|
|
57
59
|
}: {
|
|
58
60
|
/**
|
|
59
61
|
* Determines the tooltip type for accessibility.
|
|
@@ -76,17 +78,30 @@ export function useTooltip<T extends Element = Element>({
|
|
|
76
78
|
* The content of the `aria-label` if `type` is `label.
|
|
77
79
|
*/
|
|
78
80
|
titleText?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Amount of time (in ms) to delay before showing the tooltip
|
|
83
|
+
*/
|
|
84
|
+
showDelay?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Amount of time (in ms) to delay before hiding the tooltip
|
|
87
|
+
*/
|
|
88
|
+
hideDelay?: number;
|
|
79
89
|
} = {}) {
|
|
80
90
|
const mouseDownRef = React.useRef(false); // use to prevent newly focused from making tooltip flash
|
|
81
91
|
const popupModel = usePopupModel();
|
|
82
92
|
const [anchorElement, setAnchorElement] = React.useState<T | null>(null);
|
|
83
93
|
const [id] = React.useState(() => uuid());
|
|
94
|
+
const intentTimerHide = useIntentTimer(popupModel.events.hide, hideDelay);
|
|
95
|
+
const intentTimerShow = useIntentTimer(popupModel.events.show, showDelay);
|
|
84
96
|
|
|
85
|
-
const
|
|
97
|
+
const onHide = () => {
|
|
98
|
+
intentTimerHide.start();
|
|
99
|
+
intentTimerShow.clear();
|
|
100
|
+
};
|
|
86
101
|
|
|
87
102
|
const onOpen = () => {
|
|
88
|
-
|
|
89
|
-
|
|
103
|
+
intentTimerShow.start();
|
|
104
|
+
intentTimerHide.clear();
|
|
90
105
|
};
|
|
91
106
|
|
|
92
107
|
const onOpenFromTarget = (event: React.SyntheticEvent) => {
|
|
@@ -122,10 +137,10 @@ export function useTooltip<T extends Element = Element>({
|
|
|
122
137
|
// This will replace the accessible name of the target element
|
|
123
138
|
'aria-label': type === 'label' ? titleText : undefined,
|
|
124
139
|
onMouseEnter: onOpenFromTarget,
|
|
125
|
-
onMouseLeave:
|
|
140
|
+
onMouseLeave: onHide,
|
|
126
141
|
onMouseDown,
|
|
127
142
|
onFocus,
|
|
128
|
-
onBlur:
|
|
143
|
+
onBlur: onHide,
|
|
129
144
|
},
|
|
130
145
|
/** Mix these properties into the `Popper` component */
|
|
131
146
|
popperProps: {
|
|
@@ -138,7 +153,7 @@ export function useTooltip<T extends Element = Element>({
|
|
|
138
153
|
id: type === 'describe' && visible ? id : undefined,
|
|
139
154
|
role: 'tooltip',
|
|
140
155
|
onMouseEnter: onOpen,
|
|
141
|
-
onMouseLeave:
|
|
156
|
+
onMouseLeave: onHide,
|
|
142
157
|
},
|
|
143
158
|
};
|
|
144
159
|
}
|
|
@@ -1,38 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The label of the Banner.
|
|
14
|
-
*/
|
|
15
|
-
label?: React.ReactNode;
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Flex } from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
+
import { BannerModel, BannerModelConfig } from './hooks';
|
|
5
|
+
export declare const BannerModelContext: React.Context<import("../../common").Model<{
|
|
6
|
+
hasError?: boolean | undefined;
|
|
7
|
+
isSticky?: boolean | undefined;
|
|
8
|
+
id?: string | undefined;
|
|
9
|
+
}, {}>>;
|
|
10
|
+
export interface BannerProps extends BannerModelConfig, ExtractProps<typeof Flex, never> {
|
|
11
|
+
model?: BannerModel;
|
|
16
12
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @default BannerVariant.Full
|
|
13
|
+
* Children of the Banner. Should contain a `<Banner.Label>` a <Banner.Icon> and an optional `<Banner.ActionText>`
|
|
19
14
|
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The type of error associated with the Banner (if applicable).
|
|
23
|
-
* @default ErrorType.Alert
|
|
24
|
-
*/
|
|
25
|
-
error?: ErrorType;
|
|
26
|
-
/**
|
|
27
|
-
* The text of the Banner action. This prop is also used as the aria-label for the action in the banner
|
|
28
|
-
* @default 'View All'
|
|
29
|
-
*/
|
|
30
|
-
actionText?: string;
|
|
31
|
-
}
|
|
32
|
-
declare class Banner extends React.Component<BannerProps> {
|
|
33
|
-
static Variant: typeof BannerVariant;
|
|
34
|
-
static ErrorType: typeof ErrorType;
|
|
35
|
-
render(): JSX.Element;
|
|
15
|
+
children?: React.ReactNode;
|
|
36
16
|
}
|
|
37
|
-
export
|
|
17
|
+
export declare const Banner: import("../../common").ElementComponent<"button", BannerProps> & {
|
|
18
|
+
Icon: import("../../common").ElementComponent<"span", import("./BannerIcon").BannerIconProps>;
|
|
19
|
+
Label: import("../../common").ElementComponent<"div", import("./BannerLabel").BannerLabelProps>;
|
|
20
|
+
ActionText: import("../../common").ElementComponent<"span", import("./BannerActionText").BannerActionTextProps>;
|
|
21
|
+
};
|
|
38
22
|
//# sourceMappingURL=Banner.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Box } from '@workday/canvas-kit-labs-react/common';
|
|
4
|
+
import { BannerModel } from './hooks';
|
|
5
|
+
export interface BannerActionTextProps extends ExtractProps<typeof Box, never> {
|
|
6
|
+
model?: BannerModel;
|
|
7
|
+
/**
|
|
8
|
+
* The text of the Banner action.
|
|
9
|
+
* @default 'View All'
|
|
10
|
+
*/
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const BannerActionText: import("../../common").ElementComponent<"span", BannerActionTextProps>;
|
|
14
|
+
//# sourceMappingURL=BannerActionText.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
3
|
+
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
|
+
import { BannerModel } from './hooks';
|
|
5
|
+
export interface BannerIconProps extends Omit<ExtractProps<typeof SystemIcon, never>, 'icon'> {
|
|
6
|
+
model?: BannerModel;
|
|
7
|
+
/**
|
|
8
|
+
* Icon to show next to label
|
|
9
|
+
* @default exclamationTriangleIcon or exclamationCircleIcon when hasError is true
|
|
10
|
+
*/
|
|
11
|
+
icon?: CanvasSystemIcon;
|
|
12
|
+
}
|
|
13
|
+
export declare const BannerIcon: import("../../common").ElementComponent<"span", BannerIconProps>;
|
|
14
|
+
//# sourceMappingURL=BannerIcon.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Flex } from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
+
import { BannerModel } from './hooks';
|
|
5
|
+
export interface BannerLabelProps extends ExtractProps<typeof Flex, never> {
|
|
6
|
+
model?: BannerModel;
|
|
7
|
+
/**
|
|
8
|
+
* The text of the Banner.
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const BannerLabel: import("../../common").ElementComponent<"div", BannerLabelProps>;
|
|
13
|
+
//# sourceMappingURL=BannerLabel.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Banner` component.
|
|
4
|
+
* Used by the Banner component
|
|
5
|
+
*/
|
|
6
|
+
export declare const useBanner: <P extends {}, R>(model: import("../../../common").Model<{
|
|
7
|
+
hasError?: boolean | undefined;
|
|
8
|
+
isSticky?: boolean | undefined;
|
|
9
|
+
id?: string | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
'aria-describedby': string;
|
|
12
|
+
'aria-labelledby': string;
|
|
13
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
14
|
+
ref: import("react").Ref<R>;
|
|
15
|
+
} : {});
|
|
16
|
+
//# sourceMappingURL=useBanner.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `ActionText` component.
|
|
4
|
+
* Used by the Banner.ActionText subcomponent
|
|
5
|
+
*/
|
|
6
|
+
export declare const useBannerActionText: <P extends {}, R>(model: import("../../../common").Model<{
|
|
7
|
+
hasError?: boolean | undefined;
|
|
8
|
+
isSticky?: boolean | undefined;
|
|
9
|
+
id?: string | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
id: string;
|
|
12
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
13
|
+
ref: import("react").Ref<R>;
|
|
14
|
+
} : {});
|
|
15
|
+
//# sourceMappingURL=useBannerActionText.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Icon` component.
|
|
4
|
+
* Used by the Banner.Icon subcomponent
|
|
5
|
+
*/
|
|
6
|
+
export declare const useBannerIcon: <P extends {}, R>(model: import("../../../common").Model<{
|
|
7
|
+
hasError?: boolean | undefined;
|
|
8
|
+
isSticky?: boolean | undefined;
|
|
9
|
+
id?: string | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
icon: import("@workday/design-assets-types").CanvasSystemIcon;
|
|
12
|
+
color: string | undefined;
|
|
13
|
+
colorHover: string | undefined;
|
|
14
|
+
size: number;
|
|
15
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
16
|
+
ref: import("react").Ref<R>;
|
|
17
|
+
} : {});
|
|
18
|
+
//# sourceMappingURL=useBannerIcon.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Label` component.
|
|
4
|
+
* Used by the Banner.Label subcomponent
|
|
5
|
+
*/
|
|
6
|
+
export declare const useBannerLabel: <P extends {}, R>(model: import("../../../common").Model<{
|
|
7
|
+
hasError?: boolean | undefined;
|
|
8
|
+
isSticky?: boolean | undefined;
|
|
9
|
+
id?: string | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
id: string;
|
|
12
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
13
|
+
ref: import("react").Ref<R>;
|
|
14
|
+
} : {});
|
|
15
|
+
//# sourceMappingURL=useBannerLabel.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Model, ToModelConfig } from '@workday/canvas-kit-react/common';
|
|
2
|
+
declare type BannerState = {
|
|
3
|
+
/**
|
|
4
|
+
* Optional flag to denote the banner has an error to display. When true the default `Banner.Icon`
|
|
5
|
+
* will be `exclamationCircleIcon`, and a themed error color will be applied.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
hasError?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Optional flag to denote the banner is stuck to the side of the screen. When true the default `Banner.ActionText`
|
|
11
|
+
* will be hidden, and some basic styles will be applied.
|
|
12
|
+
* You will still need to manually set the css `position` value.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
isSticky?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Optional `id` provided to `Banner`'s subcomponents as HTML attributes:
|
|
18
|
+
* - `Banner` will set `aria-describedby` to `label-${id}`
|
|
19
|
+
* - `Banner` will set `aria-label` to `action-${id}`
|
|
20
|
+
* - `Banner.Label` will set `id` to `label-${id}`
|
|
21
|
+
* - `Banner.ActionText` will set `id` to `action-${id}`
|
|
22
|
+
*
|
|
23
|
+
* If a value is not provided, a unique id will be automatically created by `useUniqueId()`.
|
|
24
|
+
* @default `useUniqueId()`
|
|
25
|
+
*/
|
|
26
|
+
id?: string;
|
|
27
|
+
};
|
|
28
|
+
declare type BannerEvents = {};
|
|
29
|
+
export declare type BannerModel = Model<BannerState, BannerEvents>;
|
|
30
|
+
declare const BannerEventMap: {
|
|
31
|
+
guards: {};
|
|
32
|
+
callbacks: {};
|
|
33
|
+
};
|
|
34
|
+
export declare type BannerModelConfig = BannerState & Partial<ToModelConfig<BannerState, BannerEvents, typeof BannerEventMap>>;
|
|
35
|
+
export declare const useBannerModel: (config?: BannerModelConfig) => Model<BannerState, BannerEvents>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=useBannerModel.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EmotionCanvasTheme } from '@workday/canvas-kit-react/common';
|
|
2
|
+
declare type paletteSelection = Exclude<keyof EmotionCanvasTheme['canvas']['palette'], 'common'>;
|
|
3
|
+
interface BackgroundColors {
|
|
4
|
+
normal?: string;
|
|
5
|
+
hover?: string;
|
|
6
|
+
contrast?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getPaletteColors(type: paletteSelection, theme: EmotionCanvasTheme): BackgroundColors;
|
|
9
|
+
export declare const useThemedPalette: (type: "alert" | "error" | "primary" | "success" | "neutral") => BackgroundColors;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=useThemedPalette.d.ts.map
|
|
@@ -3,9 +3,12 @@ import { Themeable } from '@workday/canvas-kit-react/common';
|
|
|
3
3
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
4
|
export interface IconButtonProps extends Themeable {
|
|
5
5
|
/**
|
|
6
|
-
* The accessibility label to indicate the action triggered by clicking the IconButton.
|
|
6
|
+
* The accessibility label to indicate the action triggered by clicking the IconButton. This is optional because there are
|
|
7
|
+
* instances where an Icon Button might already have an `aria-labelledby`. In a case where an `aria-labelledby` is provided
|
|
8
|
+
* it will take precedence over the `aria-label` as explained here: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-labelledby_attribute
|
|
9
|
+
* We highly encourage consumers to either provide an `aria-label` OR an `aria-labelledby`
|
|
7
10
|
*/
|
|
8
|
-
'aria-label'
|
|
11
|
+
'aria-label'?: string;
|
|
9
12
|
/**
|
|
10
13
|
* The type of the IconButton.
|
|
11
14
|
* @default 'circle'
|