@workday/canvas-kit-react 6.3.1 → 7.0.0-alpha.0-next.1
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/action-bar/README.md +4 -53
- package/action-bar/index.ts +0 -4
- package/action-bar/lib/ActionBar.tsx +29 -68
- 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/action-bar/index.d.ts +0 -3
- package/dist/commonjs/action-bar/index.d.ts.map +1 -1
- package/dist/commonjs/action-bar/index.js +0 -6
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts +5 -10
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/ActionBar.js +8 -76
- 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/dialog/lib/Dialog.d.ts +1 -1
- package/dist/commonjs/modal/lib/Modal.d.ts +1 -1
- package/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +1 -1
- package/dist/commonjs/pagination/lib/Pagination/common/Stack.d.ts +1 -1
- package/dist/commonjs/popup/lib/Popup.d.ts +1 -1
- package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts +5 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts.map +1 -1
- package/dist/commonjs/status-indicator/lib/StatusIndicator.js +5 -5
- package/dist/es6/action-bar/index.d.ts +0 -3
- package/dist/es6/action-bar/index.d.ts.map +1 -1
- package/dist/es6/action-bar/index.js +0 -3
- package/dist/es6/action-bar/lib/ActionBar.d.ts +5 -10
- package/dist/es6/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBar.js +10 -78
- 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/dialog/lib/Dialog.d.ts +1 -1
- package/dist/es6/modal/lib/Modal.d.ts +1 -1
- package/dist/es6/pagination/lib/Pagination/Pagination.d.ts +1 -1
- package/dist/es6/pagination/lib/Pagination/common/Stack.d.ts +1 -1
- package/dist/es6/popup/lib/Popup.d.ts +1 -1
- package/dist/es6/status-indicator/lib/StatusIndicator.d.ts +5 -0
- package/dist/es6/status-indicator/lib/StatusIndicator.d.ts.map +1 -1
- package/dist/es6/status-indicator/lib/StatusIndicator.js +5 -5
- package/package.json +5 -5
- package/status-indicator/lib/StatusIndicator.tsx +20 -9
- package/ts3.5/dist/commonjs/action-bar/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/action-bar/lib/ActionBar.d.ts +5 -10
- 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/dialog/lib/Dialog.d.ts +1 -1
- package/ts3.5/dist/commonjs/modal/lib/Modal.d.ts +1 -1
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +1 -1
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/Stack.d.ts +1 -1
- package/ts3.5/dist/commonjs/popup/lib/Popup.d.ts +1 -1
- package/ts3.5/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts +5 -0
- package/ts3.5/dist/es6/action-bar/index.d.ts +0 -3
- package/ts3.5/dist/es6/action-bar/lib/ActionBar.d.ts +5 -10
- 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/dialog/lib/Dialog.d.ts +1 -1
- package/ts3.5/dist/es6/modal/lib/Modal.d.ts +1 -1
- package/ts3.5/dist/es6/pagination/lib/Pagination/Pagination.d.ts +1 -1
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/Stack.d.ts +1 -1
- package/ts3.5/dist/es6/popup/lib/Popup.d.ts +1 -1
- package/ts3.5/dist/es6/status-indicator/lib/StatusIndicator.d.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../action-bar/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../action-bar/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* If true, fix the ActionBar to the bottom of the screen.
|
|
5
|
-
* @default false
|
|
6
|
-
*/
|
|
7
|
-
fixed?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export default class ActionBar extends React.Component<ActionBarProps> {
|
|
10
|
-
render(): JSX.Element;
|
|
1
|
+
import { HStackProps, StackSpacing } from '@workday/canvas-kit-labs-react';
|
|
2
|
+
interface ActionBarProps extends Omit<HStackProps, 'spacing'> {
|
|
3
|
+
spacing?: StackSpacing;
|
|
11
4
|
}
|
|
5
|
+
export declare const ActionBar: import("../../common").ElementComponent<"div", ActionBarProps>;
|
|
6
|
+
export {};
|
|
12
7
|
//# sourceMappingURL=ActionBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAS,WAAW,EAAE,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAEjF,UAAU,cAAe,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;IAC3D,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAWD,eAAO,MAAM,SAAS,gEAkBpB,CAAC"}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
1
|
var __assign = (this && this.__assign) || function () {
|
|
15
2
|
__assign = Object.assign || function(t) {
|
|
16
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -22,78 +9,23 @@ var __assign = (this && this.__assign) || function () {
|
|
|
22
9
|
};
|
|
23
10
|
return __assign.apply(this, arguments);
|
|
24
11
|
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
12
|
import * as React from 'react';
|
|
37
|
-
import { styled } from '@workday/canvas-kit-react/common';
|
|
38
|
-
import {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return fixed
|
|
42
|
-
? {
|
|
43
|
-
position: 'fixed',
|
|
44
|
-
left: 0,
|
|
45
|
-
bottom: 0,
|
|
46
|
-
right: 0,
|
|
47
|
-
}
|
|
48
|
-
: {};
|
|
49
|
-
}
|
|
50
|
-
var ActionBarContainer = styled('div')({
|
|
51
|
-
borderTop: "solid 1px " + colors.soap400,
|
|
52
|
-
background: commonColors.background,
|
|
53
|
-
padding: space.s,
|
|
54
|
-
boxShadow: '0 -2px 4px rgba(0, 0, 0, 0.08)',
|
|
55
|
-
}, function (_a) {
|
|
56
|
-
var _b;
|
|
57
|
-
var fixed = _a.fixed, theme = _a.theme;
|
|
58
|
-
return __assign(__assign({}, getFixedStyles(fixed)), (_b = {}, _b[theme.canvas.breakpoints.down('s')] = {
|
|
59
|
-
padding: space.xxs,
|
|
60
|
-
}, _b));
|
|
61
|
-
});
|
|
62
|
-
var ChildrenContainer = styled('div')({
|
|
63
|
-
display: 'inline-block',
|
|
64
|
-
padding: "0 " + space.m,
|
|
65
|
-
'*:not(:first-of-type)': {
|
|
66
|
-
marginLeft: space.s,
|
|
67
|
-
},
|
|
68
|
-
}, function (_a) {
|
|
13
|
+
import { createComponent, styled } from '@workday/canvas-kit-react/common';
|
|
14
|
+
import { commonColors, colors, space } from '@workday/canvas-kit-react/tokens';
|
|
15
|
+
import { HStack } from '@workday/canvas-kit-labs-react';
|
|
16
|
+
var ResponsiveHStack = styled(HStack)(function (_a) {
|
|
69
17
|
var _b;
|
|
70
18
|
var theme = _a.theme;
|
|
71
19
|
return (_b = {},
|
|
72
20
|
_b[theme.canvas.breakpoints.down('s')] = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
justifyContent: 'center',
|
|
76
|
-
flexDirection: 'row-reverse',
|
|
77
|
-
'> *': {
|
|
21
|
+
padding: space.s,
|
|
22
|
+
'> *:not(div)': {
|
|
78
23
|
flex: 1,
|
|
79
|
-
'&:not(:first-of-type)': {
|
|
80
|
-
marginRight: space.s,
|
|
81
|
-
marginLeft: 0,
|
|
82
|
-
},
|
|
83
24
|
},
|
|
84
25
|
},
|
|
85
26
|
_b);
|
|
86
27
|
});
|
|
87
|
-
var ActionBar =
|
|
88
|
-
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
ActionBar.prototype.render = function () {
|
|
93
|
-
var _a = this.props, fixed = _a.fixed, children = _a.children, elemProps = __rest(_a, ["fixed", "children"]);
|
|
94
|
-
return (React.createElement(ActionBarContainer, __assign({}, elemProps, { fixed: fixed }),
|
|
95
|
-
React.createElement(ChildrenContainer, null, children)));
|
|
96
|
-
};
|
|
97
|
-
return ActionBar;
|
|
98
|
-
}(React.Component));
|
|
99
|
-
export default ActionBar;
|
|
28
|
+
export var ActionBar = createComponent('div')({
|
|
29
|
+
displayName: 'ActionBar',
|
|
30
|
+
Component: function (elemProps, ref, Element) { return (React.createElement(ResponsiveHStack, __assign({ ref: ref, as: Element, spacing: "s", depth: 1, background: commonColors.background, borderTop: "solid 1px " + colors.soap400, padding: space.s + " " + space.xl + " ", position: "fixed", bottom: 0, left: 0, right: 0 }, elemProps))); },
|
|
31
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../banner/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../banner/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
package/dist/es6/banner/index.js
CHANGED
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../../banner/lib/Banner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../../banner/lib/Banner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEL,YAAY,EAKb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,IAAI,EAAC,MAAM,uCAAuC,CAAC;AAE3D,OAAO,EAAC,WAAW,EAAE,iBAAiB,EAA8C,MAAM,SAAS,CAAC;AAMpG,eAAO,MAAM,kBAAkB;;;;OAA8C,CAAC;AAE9E,MAAM,WAAW,WAAY,SAAQ,iBAAiB,EAAE,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC;IACtF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAkBD,eAAO,MAAM,MAAM;;;;CAqDjB,CAAC"}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
1
|
var __assign = (this && this.__assign) || function () {
|
|
15
2
|
__assign = Object.assign || function(t) {
|
|
16
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -33,63 +20,51 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
33
20
|
}
|
|
34
21
|
return t;
|
|
35
22
|
};
|
|
23
|
+
/** @jsx jsx */
|
|
24
|
+
import { jsx } from '@emotion/core';
|
|
36
25
|
import * as React from 'react';
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
26
|
+
import { borderRadius, space, type } from '@workday/canvas-kit-react/tokens';
|
|
27
|
+
import { createComponent, focusRing, hideMouseFocus, useDefaultModel, useIsRTL, } from '@workday/canvas-kit-react/common';
|
|
28
|
+
import { Flex } from '@workday/canvas-kit-labs-react/layout';
|
|
29
|
+
import { useBanner, useBannerModel, useThemedPalette } from './hooks';
|
|
30
|
+
import { BannerIcon } from './BannerIcon';
|
|
31
|
+
import { BannerLabel } from './BannerLabel';
|
|
32
|
+
import { BannerActionText } from './BannerActionText';
|
|
33
|
+
export var BannerModelContext = React.createContext({});
|
|
34
|
+
// Remove color from our type since it is set on the Flex style attribute
|
|
35
|
+
var _a = type.levels.subtext.large, _color = _a.color, typeLevelsSubtextLarge = __rest(_a, ["color"]);
|
|
36
|
+
var styles = __assign(__assign(__assign({}, typeLevelsSubtextLarge), { cursor: 'pointer', fontWeight: type.properties.fontWeights.medium, textAlign: 'left', transition: 'background-color 120ms', '&:focus': __assign({ outline: 'none' }, focusRing({ separation: 2 })) }), hideMouseFocus);
|
|
37
|
+
export var Banner = createComponent('button')({
|
|
38
|
+
displayName: 'Banner',
|
|
39
|
+
Component: function (_a, ref, Element) {
|
|
40
|
+
var _b;
|
|
41
|
+
var children = _a.children, model = _a.model, props = __rest(_a, ["children", "model"]);
|
|
42
|
+
var hasError = props.hasError, isSticky = props.isSticky, id = props.id, elemProps = __rest(props, ["hasError", "isSticky", "id"]);
|
|
43
|
+
var value = useDefaultModel(model, { hasError: hasError, isSticky: isSticky, id: id }, useBannerModel);
|
|
44
|
+
var palette = useThemedPalette(hasError ? 'error' : 'alert');
|
|
45
|
+
var themedBackgroundStyles = {
|
|
46
|
+
'&:hover': {
|
|
47
|
+
backgroundColor: palette.hover,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
var isRTL = useIsRTL();
|
|
51
|
+
var borderBottomLeftRadius = isRTL ? 'borderBottomRightRadius' : 'borderBottomLeftRadius';
|
|
52
|
+
var borderTopLeftRadius = isRTL ? 'borderTopRightRadius' : 'borderTopLeftRadius';
|
|
53
|
+
var borderBottomRightRadius = isRTL ? 'borderBottomLeftRadius' : 'borderBottomRightRadius';
|
|
54
|
+
var borderTopRightRadius = isRTL ? 'borderTopLeftRadius' : 'borderTopRightRadius';
|
|
55
|
+
var borderStyleProps = (_b = {},
|
|
56
|
+
_b[borderBottomLeftRadius] = borderRadius.m,
|
|
57
|
+
_b[borderTopLeftRadius] = borderRadius.m,
|
|
58
|
+
_b[borderBottomRightRadius] = isSticky ? 0 : borderRadius.m,
|
|
59
|
+
_b[borderTopRightRadius] = isSticky ? 0 : borderRadius.m,
|
|
60
|
+
_b);
|
|
61
|
+
var bannerProps = useBanner(value, elemProps, ref);
|
|
62
|
+
return (jsx(BannerModelContext.Provider, { value: value },
|
|
63
|
+
jsx(Flex, __assign({ as: Element, width: isSticky ? '222px' : '328px', backgroundColor: palette.normal, color: palette.contrast, padding: space.xxs + " " + space.s, border: "0", display: "flex", alignItems: "center" }, borderStyleProps, { css: [styles, themedBackgroundStyles] }, bannerProps), children)));
|
|
64
|
+
},
|
|
65
|
+
subComponents: {
|
|
66
|
+
Icon: BannerIcon,
|
|
67
|
+
Label: BannerLabel,
|
|
68
|
+
ActionText: BannerActionText,
|
|
69
|
+
},
|
|
62
70
|
});
|
|
63
|
-
var BannerLabel = styled('div')({
|
|
64
|
-
flex: 1,
|
|
65
|
-
});
|
|
66
|
-
var BannerViewAll = styled('span')({
|
|
67
|
-
textDecoration: 'underline',
|
|
68
|
-
}, function (_a) {
|
|
69
|
-
var variant = _a.variant;
|
|
70
|
-
return ({
|
|
71
|
-
display: variant === BannerVariant.Sticky ? 'none' : undefined,
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
var Banner = /** @class */ (function (_super) {
|
|
75
|
-
__extends(Banner, _super);
|
|
76
|
-
function Banner() {
|
|
77
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
78
|
-
}
|
|
79
|
-
Banner.prototype.render = function () {
|
|
80
|
-
var _a = this.props, _b = _a.actionText, actionText = _b === void 0 ? 'View All' : _b, _c = _a.variant, variant = _c === void 0 ? BannerVariant.Full : _c, _d = _a.error, error = _d === void 0 ? ErrorType.Alert : _d, label = _a.label, onClick = _a.onClick, props = __rest(_a, ["actionText", "variant", "error", "label", "onClick"]);
|
|
81
|
-
var bannerIcon = error === ErrorType.Error ? exclamationCircleIcon : exclamationTriangleIcon;
|
|
82
|
-
var iconColor = error === ErrorType.Error ? colors.frenchVanilla100 : colors.blackPepper400;
|
|
83
|
-
var iconSize = 24;
|
|
84
|
-
return (React.createElement(BannerWrapper, __assign({ "aria-label": actionText + ': ' + label, role: "button", variant: variant, tabIndex: 0, onClick: onClick, error: error }, props),
|
|
85
|
-
React.createElement(BannerIcon, { icon: bannerIcon, color: iconColor, colorHover: iconColor, size: iconSize }),
|
|
86
|
-
React.createElement(BannerLabel, null, label),
|
|
87
|
-
React.createElement(BannerViewAll, { variant: variant }, actionText)));
|
|
88
|
-
};
|
|
89
|
-
Banner.Variant = BannerVariant;
|
|
90
|
-
Banner.ErrorType = ErrorType;
|
|
91
|
-
return Banner;
|
|
92
|
-
}(React.Component));
|
|
93
|
-
Banner.Variant = BannerVariant;
|
|
94
|
-
Banner.ErrorType = ErrorType;
|
|
95
|
-
export default Banner;
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"BannerActionText.d.ts","sourceRoot":"","sources":["../../../../banner/lib/BannerActionText.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,YAAY,EAAmC,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAC,GAAG,EAAC,MAAM,uCAAuC,CAAC;AAI1D,OAAO,EAAC,WAAW,EAAsB,MAAM,SAAS,CAAC;AAEzD,MAAM,WAAW,qBAAsB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IAC5E,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAMD,eAAO,MAAM,gBAAgB,wEAqB3B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/** @jsx jsx */
|
|
24
|
+
import { jsx } from '@emotion/core';
|
|
25
|
+
import { createComponent, useModelContext } from '@workday/canvas-kit-react/common';
|
|
26
|
+
import { Box } from '@workday/canvas-kit-labs-react/common';
|
|
27
|
+
import { BannerModelContext } from './Banner';
|
|
28
|
+
import { useBannerActionText } from './hooks';
|
|
29
|
+
var styles = {
|
|
30
|
+
textDecoration: 'underline',
|
|
31
|
+
};
|
|
32
|
+
export var BannerActionText = createComponent('span')({
|
|
33
|
+
displayName: 'Banner.ActionTextText',
|
|
34
|
+
Component: function (_a, ref, Element) {
|
|
35
|
+
var _b = _a.children, children = _b === void 0 ? 'View All' : _b, model = _a.model, elemProps = __rest(_a, ["children", "model"]);
|
|
36
|
+
var localModel = useModelContext(BannerModelContext, model);
|
|
37
|
+
var props = useBannerActionText(localModel, elemProps, ref);
|
|
38
|
+
return (jsx(Box, __assign({ display: localModel.state.isSticky ? 'none' : 'inline', as: Element, css: [styles] }, props), children));
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"BannerIcon.d.ts","sourceRoot":"","sources":["../../../../banner/lib/BannerIcon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAmC,MAAM,kCAAkC,CAAC;AAEhG,OAAO,EAAC,UAAU,EAAC,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAC,WAAW,EAAgB,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAC3F,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAMD,eAAO,MAAM,UAAU,kEAarB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/** @jsx jsx */
|
|
24
|
+
import { jsx } from '@emotion/core';
|
|
25
|
+
import { space } from '@workday/canvas-kit-react/tokens';
|
|
26
|
+
import { createComponent, useModelContext } from '@workday/canvas-kit-react/common';
|
|
27
|
+
import { useThemeRTL } from '@workday/canvas-kit-labs-react/common';
|
|
28
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
29
|
+
import { exclamationTriangleIcon } from '@workday/canvas-system-icons-web';
|
|
30
|
+
import { BannerModelContext } from './Banner';
|
|
31
|
+
import { useBannerIcon } from './hooks';
|
|
32
|
+
var styles = {
|
|
33
|
+
marginRight: space.xs,
|
|
34
|
+
};
|
|
35
|
+
export var BannerIcon = createComponent('span')({
|
|
36
|
+
displayName: 'Banner.Icon',
|
|
37
|
+
Component: function (_a, ref) {
|
|
38
|
+
var _b = _a.icon, icon = _b === void 0 ? exclamationTriangleIcon : _b, model = _a.model, elemProps = __rest(_a, ["icon", "model"]);
|
|
39
|
+
var themeRTL = useThemeRTL().themeRTL;
|
|
40
|
+
var localModel = useModelContext(BannerModelContext, model);
|
|
41
|
+
// SystemIcon is still a class based component so we need to set ref manually.
|
|
42
|
+
var _c = useBannerIcon(localModel, elemProps, ref), iconRef = _c.ref, defaultIcon = _c.icon, props = __rest(_c, ["ref", "icon"]);
|
|
43
|
+
return (jsx(SystemIcon, __assign({ icon: icon !== null && icon !== void 0 ? icon : defaultIcon, iconRef: iconRef, css: themeRTL(styles) }, props)));
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"BannerLabel.d.ts","sourceRoot":"","sources":["../../../../banner/lib/BannerLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,YAAY,EAAmC,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAC,IAAI,EAAC,MAAM,uCAAuC,CAAC;AAG3D,OAAO,EAAC,WAAW,EAAiB,MAAM,SAAS,CAAC;AAEpD,MAAM,WAAW,gBAAiB,SAAQ,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC;IACxE,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,WAAW,kEAYtB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import * as React from 'react';
|
|
24
|
+
import { createComponent, useModelContext } from '@workday/canvas-kit-react/common';
|
|
25
|
+
import { Flex } from '@workday/canvas-kit-labs-react/layout';
|
|
26
|
+
import { BannerModelContext } from './Banner';
|
|
27
|
+
import { useBannerLabel } from './hooks';
|
|
28
|
+
export var BannerLabel = createComponent('div')({
|
|
29
|
+
displayName: 'Banner.Label',
|
|
30
|
+
Component: function (_a, ref, Element) {
|
|
31
|
+
var children = _a.children, model = _a.model, elemProps = __rest(_a, ["children", "model"]);
|
|
32
|
+
var localModel = useModelContext(BannerModelContext, model);
|
|
33
|
+
var props = useBannerLabel(localModel, elemProps, ref);
|
|
34
|
+
return (React.createElement(Flex, __assign({ as: Element, flex: "1 1 0%" }, props), children));
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../banner/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"useBanner.d.ts","sourceRoot":"","sources":["../../../../../banner/lib/hooks/useBanner.tsx"],"names":[],"mappings":";AAGA;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;OAKpB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Banner` component.
|
|
4
|
+
* Used by the Banner component
|
|
5
|
+
*/
|
|
6
|
+
export var useBanner = createHook(function (_a) {
|
|
7
|
+
var state = _a.state;
|
|
8
|
+
return {
|
|
9
|
+
'aria-describedby': "label-" + state.id,
|
|
10
|
+
'aria-labelledby': "action-" + state.id,
|
|
11
|
+
};
|
|
12
|
+
});
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"useBannerActionText.d.ts","sourceRoot":"","sources":["../../../../../banner/lib/hooks/useBannerActionText.tsx"],"names":[],"mappings":";AAGA;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;OAI9B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `ActionText` component.
|
|
4
|
+
* Used by the Banner.ActionText subcomponent
|
|
5
|
+
*/
|
|
6
|
+
export var useBannerActionText = createHook(function (_a) {
|
|
7
|
+
var state = _a.state;
|
|
8
|
+
return {
|
|
9
|
+
id: "action-" + state.id,
|
|
10
|
+
};
|
|
11
|
+
});
|