@workday/canvas-kit-react 6.3.0 → 7.0.0-alpha.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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/package.json +5 -5
- 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/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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {CanvasThemePalette, EmotionCanvasTheme, useTheme} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
3
|
+
import chroma from 'chroma-js';
|
|
4
|
+
|
|
5
|
+
type paletteSelection = Exclude<keyof EmotionCanvasTheme['canvas']['palette'], 'common'>;
|
|
6
|
+
|
|
7
|
+
interface BackgroundColors {
|
|
8
|
+
normal?: string;
|
|
9
|
+
hover?: string;
|
|
10
|
+
contrast?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const isAccessible = (foreground: string, background: string) => {
|
|
14
|
+
return chroma.contrast(foreground, background) >= 3;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const getPaletteColorsFromTheme = (
|
|
18
|
+
palette: CanvasThemePalette,
|
|
19
|
+
fallbackColors?: BackgroundColors
|
|
20
|
+
): BackgroundColors => {
|
|
21
|
+
return {
|
|
22
|
+
hover: palette.dark,
|
|
23
|
+
normal: palette.main,
|
|
24
|
+
contrast: isAccessible(palette.contrast, palette.main)
|
|
25
|
+
? palette.contrast
|
|
26
|
+
: fallbackColors?.contrast,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function getPaletteColors(
|
|
31
|
+
type: paletteSelection,
|
|
32
|
+
theme: EmotionCanvasTheme
|
|
33
|
+
): BackgroundColors {
|
|
34
|
+
const palette = theme.canvas.palette[type];
|
|
35
|
+
|
|
36
|
+
switch (type) {
|
|
37
|
+
case 'error': {
|
|
38
|
+
return getPaletteColorsFromTheme(palette, {contrast: colors.frenchVanilla100});
|
|
39
|
+
}
|
|
40
|
+
case 'alert': {
|
|
41
|
+
return getPaletteColorsFromTheme(palette, {contrast: colors.blackPepper400});
|
|
42
|
+
}
|
|
43
|
+
default: {
|
|
44
|
+
return getPaletteColorsFromTheme(palette);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const useThemedPalette = (type: paletteSelection) => {
|
|
50
|
+
const theme = useTheme();
|
|
51
|
+
|
|
52
|
+
return getPaletteColors(type, theme);
|
|
53
|
+
};
|
|
@@ -14,9 +14,12 @@ import {ButtonContainer} from './parts';
|
|
|
14
14
|
|
|
15
15
|
export interface IconButtonProps extends Themeable {
|
|
16
16
|
/**
|
|
17
|
-
* The accessibility label to indicate the action triggered by clicking the IconButton.
|
|
17
|
+
* The accessibility label to indicate the action triggered by clicking the IconButton. This is optional because there are
|
|
18
|
+
* instances where an Icon Button might already have an `aria-labelledby`. In a case where an `aria-labelledby` is provided
|
|
19
|
+
* 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
|
|
20
|
+
* We highly encourage consumers to either provide an `aria-label` OR an `aria-labelledby`
|
|
18
21
|
*/
|
|
19
|
-
'aria-label'
|
|
22
|
+
'aria-label'?: string;
|
|
20
23
|
/**
|
|
21
24
|
* The type of the IconButton.
|
|
22
25
|
* @default 'circle'
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Interpolation} from '@emotion/core';
|
|
2
|
+
import {CSSProperties} from '@workday/canvas-kit-react/tokens';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A utility to hide the default canvas style focus ring when using mouse input.
|
|
5
6
|
* Requires wrapping your components in an InputProvider component.
|
|
6
7
|
*/
|
|
7
|
-
export const hideMouseFocus:
|
|
8
|
+
export const hideMouseFocus: CSSProperties = {
|
|
8
9
|
[`[data-whatinput="mouse"] &:focus,
|
|
9
10
|
[data-whatinput="touch"] &:focus,
|
|
10
11
|
[data-whatinput="pointer"] &:focus`]: {
|
|
@@ -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"}
|
|
@@ -2,11 +2,5 @@
|
|
|
2
2
|
function __export(m) {
|
|
3
3
|
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
4
|
}
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
var ActionBar_1 = __importDefault(require("./lib/ActionBar"));
|
|
10
|
-
exports.ActionBar = ActionBar_1.default;
|
|
11
|
-
exports.default = ActionBar_1.default;
|
|
12
6
|
__export(require("./lib/ActionBar"));
|
|
@@ -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,17 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
var __assign = (this && this.__assign) || function () {
|
|
16
3
|
__assign = Object.assign || function(t) {
|
|
17
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -23,17 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
23
10
|
};
|
|
24
11
|
return __assign.apply(this, arguments);
|
|
25
12
|
};
|
|
26
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
27
|
-
var t = {};
|
|
28
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
29
|
-
t[p] = s[p];
|
|
30
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
31
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
32
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
33
|
-
t[p[i]] = s[p[i]];
|
|
34
|
-
}
|
|
35
|
-
return t;
|
|
36
|
-
};
|
|
37
13
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
38
14
|
if (mod && mod.__esModule) return mod;
|
|
39
15
|
var result = {};
|
|
@@ -45,64 +21,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
21
|
var React = __importStar(require("react"));
|
|
46
22
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
47
23
|
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return fixed
|
|
51
|
-
? {
|
|
52
|
-
position: 'fixed',
|
|
53
|
-
left: 0,
|
|
54
|
-
bottom: 0,
|
|
55
|
-
right: 0,
|
|
56
|
-
}
|
|
57
|
-
: {};
|
|
58
|
-
}
|
|
59
|
-
var ActionBarContainer = common_1.styled('div')({
|
|
60
|
-
borderTop: "solid 1px " + tokens_1.colors.soap400,
|
|
61
|
-
background: tokens_1.commonColors.background,
|
|
62
|
-
padding: tokens_1.space.s,
|
|
63
|
-
boxShadow: '0 -2px 4px rgba(0, 0, 0, 0.08)',
|
|
64
|
-
}, function (_a) {
|
|
65
|
-
var _b;
|
|
66
|
-
var fixed = _a.fixed, theme = _a.theme;
|
|
67
|
-
return __assign(__assign({}, getFixedStyles(fixed)), (_b = {}, _b[theme.canvas.breakpoints.down('s')] = {
|
|
68
|
-
padding: tokens_1.space.xxs,
|
|
69
|
-
}, _b));
|
|
70
|
-
});
|
|
71
|
-
var ChildrenContainer = common_1.styled('div')({
|
|
72
|
-
display: 'inline-block',
|
|
73
|
-
padding: "0 " + tokens_1.space.m,
|
|
74
|
-
'*:not(:first-of-type)': {
|
|
75
|
-
marginLeft: tokens_1.space.s,
|
|
76
|
-
},
|
|
77
|
-
}, function (_a) {
|
|
24
|
+
var canvas_kit_labs_react_1 = require("@workday/canvas-kit-labs-react");
|
|
25
|
+
var ResponsiveHStack = common_1.styled(canvas_kit_labs_react_1.HStack)(function (_a) {
|
|
78
26
|
var _b;
|
|
79
27
|
var theme = _a.theme;
|
|
80
28
|
return (_b = {},
|
|
81
29
|
_b[theme.canvas.breakpoints.down('s')] = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
justifyContent: 'center',
|
|
85
|
-
flexDirection: 'row-reverse',
|
|
86
|
-
'> *': {
|
|
30
|
+
padding: tokens_1.space.s,
|
|
31
|
+
'> *:not(div)': {
|
|
87
32
|
flex: 1,
|
|
88
|
-
'&:not(:first-of-type)': {
|
|
89
|
-
marginRight: tokens_1.space.s,
|
|
90
|
-
marginLeft: 0,
|
|
91
|
-
},
|
|
92
33
|
},
|
|
93
34
|
},
|
|
94
35
|
_b);
|
|
95
36
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
ActionBar.prototype.render = function () {
|
|
102
|
-
var _a = this.props, fixed = _a.fixed, children = _a.children, elemProps = __rest(_a, ["fixed", "children"]);
|
|
103
|
-
return (React.createElement(ActionBarContainer, __assign({}, elemProps, { fixed: fixed }),
|
|
104
|
-
React.createElement(ChildrenContainer, null, children)));
|
|
105
|
-
};
|
|
106
|
-
return ActionBar;
|
|
107
|
-
}(React.Component));
|
|
108
|
-
exports.default = ActionBar;
|
|
37
|
+
exports.ActionBar = common_1.createComponent('div')({
|
|
38
|
+
displayName: 'ActionBar',
|
|
39
|
+
Component: function (elemProps, ref, Element) { return (React.createElement(ResponsiveHStack, __assign({ ref: ref, as: Element, spacing: "s", depth: 1, background: tokens_1.commonColors.background, borderTop: "solid 1px " + tokens_1.colors.soap400, padding: tokens_1.space.s + " " + tokens_1.space.xl + " ", position: "fixed", bottom: 0, left: 0, right: 0 }, elemProps))); },
|
|
40
|
+
});
|
|
@@ -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"}
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
function __export(m) {
|
|
3
3
|
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
4
|
}
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
var Banner_1 = __importDefault(require("./lib/Banner"));
|
|
10
|
-
exports.Banner = Banner_1.default;
|
|
11
|
-
exports.default = Banner_1.default;
|
|
12
6
|
__export(require("./lib/Banner"));
|
|
7
|
+
__export(require("./lib/hooks/"));
|
|
@@ -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,17 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
var __assign = (this && this.__assign) || function () {
|
|
16
3
|
__assign = Object.assign || function(t) {
|
|
17
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -42,63 +29,51 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
42
29
|
return result;
|
|
43
30
|
};
|
|
44
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
/** @jsx jsx */
|
|
33
|
+
var core_1 = require("@emotion/core");
|
|
45
34
|
var React = __importStar(require("react"));
|
|
46
35
|
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
47
|
-
var icon_1 = require("@workday/canvas-kit-react/icon");
|
|
48
|
-
var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
|
|
49
36
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
37
|
+
var layout_1 = require("@workday/canvas-kit-labs-react/layout");
|
|
38
|
+
var hooks_1 = require("./hooks");
|
|
39
|
+
var BannerIcon_1 = require("./BannerIcon");
|
|
40
|
+
var BannerLabel_1 = require("./BannerLabel");
|
|
41
|
+
var BannerActionText_1 = require("./BannerActionText");
|
|
42
|
+
exports.BannerModelContext = React.createContext({});
|
|
43
|
+
// Remove color from our type since it is set on the Flex style attribute
|
|
44
|
+
var _a = tokens_1.type.levels.subtext.large, _color = _a.color, typeLevelsSubtextLarge = __rest(_a, ["color"]);
|
|
45
|
+
var styles = __assign(__assign(__assign({}, typeLevelsSubtextLarge), { cursor: 'pointer', fontWeight: tokens_1.type.properties.fontWeights.medium, textAlign: 'left', transition: 'background-color 120ms', '&:focus': __assign({ outline: 'none' }, common_1.focusRing({ separation: 2 })) }), common_1.hideMouseFocus);
|
|
46
|
+
exports.Banner = common_1.createComponent('button')({
|
|
47
|
+
displayName: 'Banner',
|
|
48
|
+
Component: function (_a, ref, Element) {
|
|
49
|
+
var _b;
|
|
50
|
+
var children = _a.children, model = _a.model, props = __rest(_a, ["children", "model"]);
|
|
51
|
+
var hasError = props.hasError, isSticky = props.isSticky, id = props.id, elemProps = __rest(props, ["hasError", "isSticky", "id"]);
|
|
52
|
+
var value = common_1.useDefaultModel(model, { hasError: hasError, isSticky: isSticky, id: id }, hooks_1.useBannerModel);
|
|
53
|
+
var palette = hooks_1.useThemedPalette(hasError ? 'error' : 'alert');
|
|
54
|
+
var themedBackgroundStyles = {
|
|
55
|
+
'&:hover': {
|
|
56
|
+
backgroundColor: palette.hover,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
var isRTL = common_1.useIsRTL();
|
|
60
|
+
var borderBottomLeftRadius = isRTL ? 'borderBottomRightRadius' : 'borderBottomLeftRadius';
|
|
61
|
+
var borderTopLeftRadius = isRTL ? 'borderTopRightRadius' : 'borderTopLeftRadius';
|
|
62
|
+
var borderBottomRightRadius = isRTL ? 'borderBottomLeftRadius' : 'borderBottomRightRadius';
|
|
63
|
+
var borderTopRightRadius = isRTL ? 'borderTopLeftRadius' : 'borderTopRightRadius';
|
|
64
|
+
var borderStyleProps = (_b = {},
|
|
65
|
+
_b[borderBottomLeftRadius] = tokens_1.borderRadius.m,
|
|
66
|
+
_b[borderTopLeftRadius] = tokens_1.borderRadius.m,
|
|
67
|
+
_b[borderBottomRightRadius] = isSticky ? 0 : tokens_1.borderRadius.m,
|
|
68
|
+
_b[borderTopRightRadius] = isSticky ? 0 : tokens_1.borderRadius.m,
|
|
69
|
+
_b);
|
|
70
|
+
var bannerProps = hooks_1.useBanner(value, elemProps, ref);
|
|
71
|
+
return (core_1.jsx(exports.BannerModelContext.Provider, { value: value },
|
|
72
|
+
core_1.jsx(layout_1.Flex, __assign({ as: Element, width: isSticky ? '222px' : '328px', backgroundColor: palette.normal, color: palette.contrast, padding: tokens_1.space.xxs + " " + tokens_1.space.s, border: "0", display: "flex", alignItems: "center" }, borderStyleProps, { css: [styles, themedBackgroundStyles] }, bannerProps), children)));
|
|
73
|
+
},
|
|
74
|
+
subComponents: {
|
|
75
|
+
Icon: BannerIcon_1.BannerIcon,
|
|
76
|
+
Label: BannerLabel_1.BannerLabel,
|
|
77
|
+
ActionText: BannerActionText_1.BannerActionText,
|
|
78
|
+
},
|
|
71
79
|
});
|
|
72
|
-
var BannerLabel = common_1.styled('div')({
|
|
73
|
-
flex: 1,
|
|
74
|
-
});
|
|
75
|
-
var BannerViewAll = common_1.styled('span')({
|
|
76
|
-
textDecoration: 'underline',
|
|
77
|
-
}, function (_a) {
|
|
78
|
-
var variant = _a.variant;
|
|
79
|
-
return ({
|
|
80
|
-
display: variant === BannerVariant.Sticky ? 'none' : undefined,
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
var Banner = /** @class */ (function (_super) {
|
|
84
|
-
__extends(Banner, _super);
|
|
85
|
-
function Banner() {
|
|
86
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
87
|
-
}
|
|
88
|
-
Banner.prototype.render = function () {
|
|
89
|
-
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 ? common_1.ErrorType.Alert : _d, label = _a.label, onClick = _a.onClick, props = __rest(_a, ["actionText", "variant", "error", "label", "onClick"]);
|
|
90
|
-
var bannerIcon = error === common_1.ErrorType.Error ? canvas_system_icons_web_1.exclamationCircleIcon : canvas_system_icons_web_1.exclamationTriangleIcon;
|
|
91
|
-
var iconColor = error === common_1.ErrorType.Error ? tokens_1.colors.frenchVanilla100 : tokens_1.colors.blackPepper400;
|
|
92
|
-
var iconSize = 24;
|
|
93
|
-
return (React.createElement(BannerWrapper, __assign({ "aria-label": actionText + ': ' + label, role: "button", variant: variant, tabIndex: 0, onClick: onClick, error: error }, props),
|
|
94
|
-
React.createElement(BannerIcon, { icon: bannerIcon, color: iconColor, colorHover: iconColor, size: iconSize }),
|
|
95
|
-
React.createElement(BannerLabel, null, label),
|
|
96
|
-
React.createElement(BannerViewAll, { variant: variant }, actionText)));
|
|
97
|
-
};
|
|
98
|
-
Banner.Variant = BannerVariant;
|
|
99
|
-
Banner.ErrorType = common_1.ErrorType;
|
|
100
|
-
return Banner;
|
|
101
|
-
}(React.Component));
|
|
102
|
-
Banner.Variant = BannerVariant;
|
|
103
|
-
Banner.ErrorType = common_1.ErrorType;
|
|
104
|
-
exports.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,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
/** @jsx jsx */
|
|
26
|
+
var core_1 = require("@emotion/core");
|
|
27
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
28
|
+
var common_2 = require("@workday/canvas-kit-labs-react/common");
|
|
29
|
+
var Banner_1 = require("./Banner");
|
|
30
|
+
var hooks_1 = require("./hooks");
|
|
31
|
+
var styles = {
|
|
32
|
+
textDecoration: 'underline',
|
|
33
|
+
};
|
|
34
|
+
exports.BannerActionText = common_1.createComponent('span')({
|
|
35
|
+
displayName: 'Banner.ActionTextText',
|
|
36
|
+
Component: function (_a, ref, Element) {
|
|
37
|
+
var _b = _a.children, children = _b === void 0 ? 'View All' : _b, model = _a.model, elemProps = __rest(_a, ["children", "model"]);
|
|
38
|
+
var localModel = common_1.useModelContext(Banner_1.BannerModelContext, model);
|
|
39
|
+
var props = hooks_1.useBannerActionText(localModel, elemProps, ref);
|
|
40
|
+
return (core_1.jsx(common_2.Box, __assign({ display: localModel.state.isSticky ? 'none' : 'inline', as: Element, css: [styles] }, props), children));
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -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,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
/** @jsx jsx */
|
|
26
|
+
var core_1 = require("@emotion/core");
|
|
27
|
+
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
28
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
29
|
+
var common_2 = require("@workday/canvas-kit-labs-react/common");
|
|
30
|
+
var icon_1 = require("@workday/canvas-kit-react/icon");
|
|
31
|
+
var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
|
|
32
|
+
var Banner_1 = require("./Banner");
|
|
33
|
+
var hooks_1 = require("./hooks");
|
|
34
|
+
var styles = {
|
|
35
|
+
marginRight: tokens_1.space.xs,
|
|
36
|
+
};
|
|
37
|
+
exports.BannerIcon = common_1.createComponent('span')({
|
|
38
|
+
displayName: 'Banner.Icon',
|
|
39
|
+
Component: function (_a, ref) {
|
|
40
|
+
var _b = _a.icon, icon = _b === void 0 ? canvas_system_icons_web_1.exclamationTriangleIcon : _b, model = _a.model, elemProps = __rest(_a, ["icon", "model"]);
|
|
41
|
+
var themeRTL = common_2.useThemeRTL().themeRTL;
|
|
42
|
+
var localModel = common_1.useModelContext(Banner_1.BannerModelContext, model);
|
|
43
|
+
// SystemIcon is still a class based component so we need to set ref manually.
|
|
44
|
+
var _c = hooks_1.useBannerIcon(localModel, elemProps, ref), iconRef = _c.ref, defaultIcon = _c.icon, props = __rest(_c, ["ref", "icon"]);
|
|
45
|
+
return (core_1.jsx(icon_1.SystemIcon, __assign({ icon: icon !== null && icon !== void 0 ? icon : defaultIcon, iconRef: iconRef, css: themeRTL(styles) }, props)));
|
|
46
|
+
},
|
|
47
|
+
});
|
|
@@ -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"}
|