@workday/canvas-kit-react 10.0.5 → 10.0.6
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/button/lib/BaseButton.tsx +11 -15
- package/button/lib/DeleteButton.tsx +3 -2
- package/button/lib/PrimaryButton.tsx +3 -10
- package/button/lib/SecondaryButton.tsx +3 -9
- package/button/lib/TertiaryButton.tsx +3 -5
- package/common/lib/CanvasProvider.tsx +14 -10
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +31 -34
- package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/DeleteButton.js +4 -3
- package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.js +5 -4
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.js +5 -4
- package/dist/commonjs/button/lib/TertiaryButton.d.ts +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.js +25 -25
- package/dist/commonjs/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +6 -3
- package/dist/commonjs/layout/index.d.ts +2 -1
- package/dist/commonjs/layout/index.d.ts.map +1 -1
- package/dist/commonjs/layout/index.js +4 -1
- package/dist/commonjs/layout/lib/utils/mergeStyles.d.ts +61 -0
- package/dist/commonjs/layout/lib/utils/mergeStyles.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/mergeStyles.js +160 -0
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/es6/button/lib/BaseButton.js +31 -34
- package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/es6/button/lib/DeleteButton.js +4 -3
- package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.js +5 -4
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.js +5 -4
- package/dist/es6/button/lib/TertiaryButton.d.ts +1 -1
- package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.js +25 -25
- package/dist/es6/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +7 -4
- package/dist/es6/layout/index.d.ts +2 -1
- package/dist/es6/layout/index.d.ts.map +1 -1
- package/dist/es6/layout/index.js +2 -0
- package/dist/es6/layout/lib/utils/mergeStyles.d.ts +61 -0
- package/dist/es6/layout/lib/utils/mergeStyles.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/mergeStyles.js +156 -0
- package/dist/es6/menu/lib/MenuItem.d.ts +1 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
- package/layout/index.ts +4 -3
- package/layout/lib/utils/mergeStyles.ts +178 -0
- package/package.json +6 -4
|
@@ -25,6 +25,8 @@ const react_1 = require("@emotion/react");
|
|
|
25
25
|
const InputProvider_1 = require("./InputProvider");
|
|
26
26
|
const theming_1 = require("./theming");
|
|
27
27
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
28
|
+
// eslint-disable-next-line @emotion/no-vanilla
|
|
29
|
+
const css_1 = require("@emotion/css");
|
|
28
30
|
const mappedKeys = {
|
|
29
31
|
lightest: 'lightest',
|
|
30
32
|
light: 'light',
|
|
@@ -52,8 +54,9 @@ const useCanvasThemeToCssVars = (theme, elemProps) => {
|
|
|
52
54
|
const CanvasProvider = ({ children, theme = { canvas: theming_1.defaultCanvasTheme }, ...props }) => {
|
|
53
55
|
var _a;
|
|
54
56
|
const elemProps = useCanvasThemeToCssVars(theme, props);
|
|
55
|
-
return (React.createElement(react_1.
|
|
56
|
-
React.createElement(
|
|
57
|
-
|
|
57
|
+
return (React.createElement(react_1.CacheProvider, { value: css_1.cache },
|
|
58
|
+
React.createElement(react_1.ThemeProvider, { theme: theme },
|
|
59
|
+
React.createElement(InputProvider_1.InputProvider, null),
|
|
60
|
+
React.createElement("div", Object.assign({ dir: ((_a = theme === null || theme === void 0 ? void 0 : theme.canvas) === null || _a === void 0 ? void 0 : _a.direction) || theming_1.defaultCanvasTheme.direction }, elemProps), children))));
|
|
58
61
|
};
|
|
59
62
|
exports.CanvasProvider = CanvasProvider;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './lib/Box';
|
|
2
|
+
export * from './lib/utils/mergeStyles';
|
|
2
3
|
export * from './lib/utils/background';
|
|
3
4
|
export * from './lib/utils/border';
|
|
4
5
|
export * from './lib/utils/color';
|
|
@@ -18,6 +19,6 @@ export * from './lib/Flex';
|
|
|
18
19
|
export * from './lib/Grid';
|
|
19
20
|
export type { FlexStyleProps } from './lib/utils/flex';
|
|
20
21
|
export type { GridStyleProps } from './lib/utils/grid';
|
|
21
|
-
export
|
|
22
|
+
export { GridItemStyleProps, gridItemStyleFnConfigs } from './lib/utils/gridItem';
|
|
22
23
|
export * from './lib/utils/systemProps';
|
|
23
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;AAChF,cAAc,yBAAyB,CAAC"}
|
|
@@ -10,8 +10,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.spaceStyleFnConfigs = exports.depthStyleFnConfigs = void 0;
|
|
13
|
+
exports.gridItemStyleFnConfigs = exports.spaceStyleFnConfigs = exports.depthStyleFnConfigs = void 0;
|
|
14
14
|
__exportStar(require("./lib/Box"), exports);
|
|
15
|
+
__exportStar(require("./lib/utils/mergeStyles"), exports);
|
|
15
16
|
__exportStar(require("./lib/utils/background"), exports);
|
|
16
17
|
__exportStar(require("./lib/utils/border"), exports);
|
|
17
18
|
__exportStar(require("./lib/utils/color"), exports);
|
|
@@ -30,4 +31,6 @@ Object.defineProperty(exports, "spaceStyleFnConfigs", { enumerable: true, get: f
|
|
|
30
31
|
__exportStar(require("./lib/utils/text"), exports);
|
|
31
32
|
__exportStar(require("./lib/Flex"), exports);
|
|
32
33
|
__exportStar(require("./lib/Grid"), exports);
|
|
34
|
+
var gridItem_1 = require("./lib/utils/gridItem");
|
|
35
|
+
Object.defineProperty(exports, "gridItemStyleFnConfigs", { enumerable: true, get: function () { return gridItem_1.gridItemStyleFnConfigs; } });
|
|
33
36
|
__exportStar(require("./lib/utils/systemProps"), exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { CSToPropsInput } from '@workday/canvas-kit-styling';
|
|
2
|
+
import { CommonStyleProps } from './styleProps';
|
|
3
|
+
/**
|
|
4
|
+
* This is an opinionated function that will force style merging with Emotion's runtime APIs,
|
|
5
|
+
* including [styled components](https://emotion.sh/docs/styled) and the [css
|
|
6
|
+
* prop](https://emotion.sh/docs/css-prop). It will also handle style props for as long as those are
|
|
7
|
+
* supported. `mergeStyles` is exported from the layout package since it supports style props
|
|
8
|
+
* defined in the layout packages.
|
|
9
|
+
*
|
|
10
|
+
* It works by detecting styles added via Emotion's runtime APIs and forcing styling merging if use
|
|
11
|
+
* of runtime APIs have been detected. If only `createStyles` were used to style a component, the
|
|
12
|
+
* faster non-runtime styling will be used.
|
|
13
|
+
*
|
|
14
|
+
* You can use `mergeStyles` if you wish to use {@link createStyles} on your own components and want
|
|
15
|
+
* your components to be compatible with Emotion's runtime styling APIs.
|
|
16
|
+
*
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import {createStyles, CSProps} from '@workday/canvas-kit-styling';
|
|
19
|
+
* import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
20
|
+
*
|
|
21
|
+
* interface MyComponentProps extends CSProps {
|
|
22
|
+
* // other props
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* const myStyles = createStyles({
|
|
26
|
+
* background: 'green',
|
|
27
|
+
* height: 40,
|
|
28
|
+
* width: 40
|
|
29
|
+
* })
|
|
30
|
+
*
|
|
31
|
+
* const MyComponent = ({children, ...elemProps}: MyComponentProps) => {
|
|
32
|
+
* return (
|
|
33
|
+
* <div
|
|
34
|
+
* {...mergeStyles(elemProps, [myStyles])}
|
|
35
|
+
* >
|
|
36
|
+
* {children}
|
|
37
|
+
* </div>
|
|
38
|
+
* )
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* const StyledMyComponent(MyComponent)({
|
|
42
|
+
* background: 'red'
|
|
43
|
+
* })
|
|
44
|
+
*
|
|
45
|
+
* const myOverridingStyles = createStyles({
|
|
46
|
+
* background: 'blue'
|
|
47
|
+
* })
|
|
48
|
+
*
|
|
49
|
+
* // now everything works. Without `mergeStyles`, the last component would be a red box
|
|
50
|
+
* export default () => (
|
|
51
|
+
* <>
|
|
52
|
+
* <MyComponent>Green box</MyComponent>
|
|
53
|
+
* <StyledMyComponent>Red box</StyledMyComponent>
|
|
54
|
+
* <StyledMyComponent cs={myOverridingStyles}>Blue box</StyledMyComponent>
|
|
55
|
+
* </>
|
|
56
|
+
* )
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
export declare function mergeStyles<T extends {}>(allProps: T, cs: CSToPropsInput): Omit<T, 'cs' | keyof CommonStyleProps>;
|
|
61
|
+
//# sourceMappingURL=mergeStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeStyles.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/mergeStyles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,cAAc,EAAoB,MAAM,6BAA6B,CAAC;AAYzF,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AA0B9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,EAAE,EACtC,QAAQ,EAAE,CAAC,EACX,EAAE,EAAE,cAAc,GACjB,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,gBAAgB,CAAC,CA4ExC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeStyles = void 0;
|
|
4
|
+
const utils_1 = require("@emotion/utils");
|
|
5
|
+
// eslint-disable-next-line @emotion/no-vanilla
|
|
6
|
+
const css_1 = require("@emotion/css");
|
|
7
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
8
|
+
const Box_1 = require("../Box");
|
|
9
|
+
const background_1 = require("./background");
|
|
10
|
+
const border_1 = require("./border");
|
|
11
|
+
const color_1 = require("./color");
|
|
12
|
+
const depth_1 = require("./depth");
|
|
13
|
+
const flexItem_1 = require("./flexItem");
|
|
14
|
+
const gridItem_1 = require("./gridItem");
|
|
15
|
+
const layout_1 = require("./layout");
|
|
16
|
+
const other_1 = require("./other");
|
|
17
|
+
const position_1 = require("./position");
|
|
18
|
+
const space_1 = require("./space");
|
|
19
|
+
const text_1 = require("./text");
|
|
20
|
+
// get a hash of all the style props for a faster lookup
|
|
21
|
+
const stylePropHash = [
|
|
22
|
+
...background_1.backgroundStyleFnConfigs,
|
|
23
|
+
...border_1.borderStyleFnConfigs,
|
|
24
|
+
...color_1.colorStyleFnConfigs,
|
|
25
|
+
...depth_1.depthStyleFnConfigs,
|
|
26
|
+
...flexItem_1.flexItemStyleFnConfigs,
|
|
27
|
+
...gridItem_1.gridItemStyleFnConfigs,
|
|
28
|
+
...layout_1.layoutStyleFnConfigs,
|
|
29
|
+
...other_1.otherStyleFnConfigs,
|
|
30
|
+
...position_1.positionStyleFnConfigs,
|
|
31
|
+
...space_1.spaceStyleFnConfigs,
|
|
32
|
+
...text_1.textStyleFnConfigs,
|
|
33
|
+
].reduce((result, prop) => {
|
|
34
|
+
//@ts-ignore
|
|
35
|
+
result[prop.name] = true;
|
|
36
|
+
return result;
|
|
37
|
+
}, {});
|
|
38
|
+
function isStyleProps(prop) {
|
|
39
|
+
return stylePropHash[prop] || false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* This is an opinionated function that will force style merging with Emotion's runtime APIs,
|
|
43
|
+
* including [styled components](https://emotion.sh/docs/styled) and the [css
|
|
44
|
+
* prop](https://emotion.sh/docs/css-prop). It will also handle style props for as long as those are
|
|
45
|
+
* supported. `mergeStyles` is exported from the layout package since it supports style props
|
|
46
|
+
* defined in the layout packages.
|
|
47
|
+
*
|
|
48
|
+
* It works by detecting styles added via Emotion's runtime APIs and forcing styling merging if use
|
|
49
|
+
* of runtime APIs have been detected. If only `createStyles` were used to style a component, the
|
|
50
|
+
* faster non-runtime styling will be used.
|
|
51
|
+
*
|
|
52
|
+
* You can use `mergeStyles` if you wish to use {@link createStyles} on your own components and want
|
|
53
|
+
* your components to be compatible with Emotion's runtime styling APIs.
|
|
54
|
+
*
|
|
55
|
+
* ```tsx
|
|
56
|
+
* import {createStyles, CSProps} from '@workday/canvas-kit-styling';
|
|
57
|
+
* import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
58
|
+
*
|
|
59
|
+
* interface MyComponentProps extends CSProps {
|
|
60
|
+
* // other props
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* const myStyles = createStyles({
|
|
64
|
+
* background: 'green',
|
|
65
|
+
* height: 40,
|
|
66
|
+
* width: 40
|
|
67
|
+
* })
|
|
68
|
+
*
|
|
69
|
+
* const MyComponent = ({children, ...elemProps}: MyComponentProps) => {
|
|
70
|
+
* return (
|
|
71
|
+
* <div
|
|
72
|
+
* {...mergeStyles(elemProps, [myStyles])}
|
|
73
|
+
* >
|
|
74
|
+
* {children}
|
|
75
|
+
* </div>
|
|
76
|
+
* )
|
|
77
|
+
* }
|
|
78
|
+
*
|
|
79
|
+
* const StyledMyComponent(MyComponent)({
|
|
80
|
+
* background: 'red'
|
|
81
|
+
* })
|
|
82
|
+
*
|
|
83
|
+
* const myOverridingStyles = createStyles({
|
|
84
|
+
* background: 'blue'
|
|
85
|
+
* })
|
|
86
|
+
*
|
|
87
|
+
* // now everything works. Without `mergeStyles`, the last component would be a red box
|
|
88
|
+
* export default () => (
|
|
89
|
+
* <>
|
|
90
|
+
* <MyComponent>Green box</MyComponent>
|
|
91
|
+
* <StyledMyComponent>Red box</StyledMyComponent>
|
|
92
|
+
* <StyledMyComponent cs={myOverridingStyles}>Blue box</StyledMyComponent>
|
|
93
|
+
* </>
|
|
94
|
+
* )
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
function mergeStyles(allProps, cs) {
|
|
99
|
+
const styleProps = {};
|
|
100
|
+
let shouldRuntimeMergeStyles = false;
|
|
101
|
+
// TypeScript can't handle a type where I declare T extends `{className?: string}` for some
|
|
102
|
+
// reason, so we'll do a `as any` any time we check for possible props on `allProps`
|
|
103
|
+
let className = allProps.className || '';
|
|
104
|
+
// separate style props from all other props. `cs` is special and should be forwarded to the
|
|
105
|
+
// `handleCsProp` function.
|
|
106
|
+
const elemProps = Object.keys(allProps).reduce((result, prop) => {
|
|
107
|
+
if (isStyleProps(prop)) {
|
|
108
|
+
shouldRuntimeMergeStyles = true;
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
styleProps[prop] = allProps[prop];
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
if (prop !== 'cs') {
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
result[prop] = allProps[prop];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}, {});
|
|
120
|
+
// We need to determine if style props have been used. If they have, we need to merge all the CSS
|
|
121
|
+
// classes into a single class name in the order that the class names are listed. This variable
|
|
122
|
+
// will collect the CSS class name created by Emotion if we detect style props.
|
|
123
|
+
let stylePropsClassName = '';
|
|
124
|
+
// We have style props. We need to create style and merge with our `csToProps` to get the correct
|
|
125
|
+
// merging order for styles
|
|
126
|
+
if (shouldRuntimeMergeStyles) {
|
|
127
|
+
const styles = Box_1.boxStyleFn(styleProps);
|
|
128
|
+
stylePropsClassName = css_1.css(styles);
|
|
129
|
+
}
|
|
130
|
+
const returnProps = canvas_kit_styling_1.csToProps([
|
|
131
|
+
cs,
|
|
132
|
+
stylePropsClassName,
|
|
133
|
+
className,
|
|
134
|
+
allProps.cs,
|
|
135
|
+
allProps.style, // doesn't matter if `style` is undefined. csToProps will handle undefined. Thanks anyways, TypeScript
|
|
136
|
+
]);
|
|
137
|
+
// see if we need to do style merging based off use of Emotion runtime APIs. We do this by testing
|
|
138
|
+
// the Emotion cache for a match to any class names we find, filtering out those created via
|
|
139
|
+
// `createStyles`. If only `createStyles` is detected, there is no reason to merge styles
|
|
140
|
+
(returnProps.className || '').split(' ').forEach(name => {
|
|
141
|
+
if (!canvas_kit_styling_1.createStylesCache[name] && css_1.cache.registered[name]) {
|
|
142
|
+
shouldRuntimeMergeStyles = true;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
if (shouldRuntimeMergeStyles) {
|
|
146
|
+
const registeredStyles = [];
|
|
147
|
+
// We are using the raw `css` instead of `createStyles` because `css` uses style hashing and
|
|
148
|
+
// `createStyles` generates a new ID every time. We could use `createStyles` here, but it
|
|
149
|
+
// would be more wasteful and new styles would be generated each React render cycle. `css` is
|
|
150
|
+
// safe to use inside a render function while `createStyles` should always be used outside the
|
|
151
|
+
// React render cycle.
|
|
152
|
+
className = utils_1.getRegisteredStyles(css_1.cache.registered, registeredStyles, returnProps.className || '');
|
|
153
|
+
className += css_1.css(registeredStyles);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
className = returnProps.className;
|
|
157
|
+
}
|
|
158
|
+
return { ...elemProps, ...returnProps, ...{ className } };
|
|
159
|
+
}
|
|
160
|
+
exports.mergeStyles = mergeStyles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/BaseButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAkB,cAAc,EAAY,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/BaseButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAkB,cAAc,EAAY,MAAM,kCAAkC,CAAC;AAG5F,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AACjE,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,MAAM,WAAW,oBAAqB,SAAQ,OAAO,CAAC,eAAe,CAAC,EAAE,cAAc;IACpF;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC;CAAG;AAE7E;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;CAmDtB,CAAC;AAqGF;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;cA4E1B,CAAC;AAEH,wBAAgB,UAAU,CAAC,MAAM,GAAE,MAAW,UAE7C;AAED,wBAAgB,eAAe,CAC7B,IAAI,CAAC,EAAE,MAAM,OAAO,eAAe,CAAC,IAAI,EACxC,YAAY,CAAC,EAAE,aAAa,EAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GACzB,MAAM,OAAO,eAAe,CAAC,YAAY,CAE3C;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAyCrB,CAAC"}
|
|
@@ -2,8 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { ButtonLabelIcon } from '../lib/parts/ButtonLabelIcon';
|
|
3
3
|
import { ButtonLabel } from '../lib/parts/ButtonLabel';
|
|
4
4
|
import { createComponent, focusRing } from '@workday/canvas-kit-react/common';
|
|
5
|
+
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
5
6
|
import { createStyles, createVars, cssVar, createModifiers } from '@workday/canvas-kit-styling';
|
|
6
|
-
import { Box } from '@workday/canvas-kit-react/layout';
|
|
7
7
|
import { base, brand, system } from '@workday/canvas-tokens-web';
|
|
8
8
|
/**
|
|
9
9
|
* Temporary css variables to be used across all Buttons.
|
|
@@ -18,7 +18,7 @@ export const buttonVars = {
|
|
|
18
18
|
/**
|
|
19
19
|
* Base styles for Buttons.
|
|
20
20
|
*/
|
|
21
|
-
const baseButtonStyles = createStyles({ name: "
|
|
21
|
+
const baseButtonStyles = createStyles({ name: "q08l0", styles: "font-family:\"Roboto\", \"Helvetica Neue\", \"Helvetica\", Arial, sans-serif;font-size:0.875rem;line-height:normal;letter-spacing:0.015rem;font-weight:bold;background-color:var(--css-button-vars-default-background, transparent);color:var(--css-button-vars-default-label, var(--cnvs-base-palette-black-pepper-400, #333333));border-width:1px;border-style:solid;gap:var(--cnvs-sys-space-x2, 0.5rem);border-color:var(--css-button-vars-default-border, transparent);cursor:pointer;display:inline-flex;box-shadow:none;align-items:center;justify-content:center;box-sizing:border-box;outline:2px transparent;white-space:nowrap;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;border-radius:var(--css-button-vars-default-borderRadius, var(--cnvs-sys-shape-round, 62.5rem));position:relative;vertical-align:middle;overflow:hidden;transition:box-shadow 120ms linear, border 120ms linear, background-color 120ms linear, color 120ms linear;&:disabled, &:disabled:active{cursor:default;box-shadow:none;opacity:var(--css-button-vars-disabled-opacity, 1);}& span .wd-icon-fill{transition-duration:40ms;fill:var(--css-button-vars-default-icon, var(--cnvs-base-palette-black-pepper-400, #333333));}.wd-icon-background ~ .wd-icon-accent, .wd-icon-background ~ .wd-icon-accent2{fill:var(--css-button-vars-default-icon, var(--cnvs-base-palette-black-pepper-400, #333333));}&:focus-visible, &.focus{background-color:var(--css-button-vars-focus-background, transparent);border-color:var(--css-button-vars-focus-border, transparent);color:var(--css-button-vars-focus-label, var(--cnvs-base-palette-black-pepper-400, #333333));& span .wd-icon-fill{fill:var(--css-button-vars-focus-icon, var(--cnvs-base-palette-black-pepper-400, #333333));}.wd-icon-background ~ .wd-icon-accent, .wd-icon-background ~ .wd-icon-accent2{fill:var(--css-button-vars-focus-icon, var(--cnvs-base-palette-black-pepper-400, #333333));}box-shadow:0 0 0 2px var(--css-button-vars-focus-boxShadowInner, var(--cnvs-base-palette-french-vanilla-100, #fff)), 0 0 0 calc(2px + 2px) var(--css-button-vars-focus-boxShadowOuter, var(--cnvs-brand-primary-base, rgba(0,92,184,1)));}&:hover, &.hover{background-color:var(--css-button-vars-hover-background, var(--cnvs-base-palette-black-pepper-500, #1e1e1e));border-color:var(--css-button-vars-hover-border, transparent);color:var(--css-button-vars-hover-label, var(--cnvs-base-palette-black-pepper-500, #1e1e1e));& span .wd-icon-fill{fill:var(--css-button-vars-hover-icon, var(--cnvs-base-palette-black-pepper-500, #1e1e1e));}.wd-icon-background ~ .wd-icon-accent, .wd-icon-background ~ .wd-icon-accent2{fill:var(--css-button-vars-hover-icon, var(--cnvs-base-palette-black-pepper-500, #1e1e1e));}}&:hover:active{transition-duration:40ms;}&:active, &.active{background-color:var(--css-button-vars-active-background, transparent);border-color:var(--css-button-vars-active-border, transparent);color:var(--css-button-vars-active-label, var(--cnvs-base-palette-black-pepper-400, #333333));& span .wd-icon-fill{fill:var(--css-button-vars-active-icon, var(--cnvs-base-palette-black-pepper-400, #333333));}.wd-icon-background ~ .wd-icon-accent, .wd-icon-background ~ .wd-icon-accent2{fill:var(--css-button-vars-active-icon);}}&:disabled{background-color:var(--css-button-vars-disabled-background, transparent);border-color:var(--css-button-vars-disabled-border, transparent);color:var(--css-button-vars-disabled-label, var(--cnvs-base-palette-black-pepper-400, #333333));& span .wd-icon-fill{fill:var(--css-button-vars-disabled-icon, var(--cnvs-base-palette-black-pepper-400, #333333));}.wd-icon-background ~ .wd-icon-accent, .wd-icon-background ~ .wd-icon-accent2{fill:var(--css-button-vars-disabled-icon, var(--cnvs-base-palette-black-pepper-400, #333333));}}" });
|
|
22
22
|
/**
|
|
23
23
|
* Button modifiers that will overwrite the base styles of Buttons.
|
|
24
24
|
* - `Size`: These modifiers will dictate a size of a Button and has a set of styles to associated with it.
|
|
@@ -27,24 +27,24 @@ const baseButtonStyles = createStyles({ name: "ncae0", styles: "font-family:\"Ro
|
|
|
27
27
|
*/
|
|
28
28
|
export const buttonModifiers = createModifiers({
|
|
29
29
|
size: {
|
|
30
|
-
large: createStyles({ name: "
|
|
31
|
-
medium: createStyles({ name: "
|
|
32
|
-
small: createStyles({ name: "
|
|
33
|
-
extraSmall: createStyles({ name: "
|
|
30
|
+
large: createStyles({ name: "q08l1", styles: "font-size:var(--cnvs-sys-space-x4, 1rem);line-height:var(--cnvs-sys-space-x6, 1.5rem);letter-spacing:0.01rem;height:48px;padding-inline:var(--cnvs-sys-space-x8, 2rem);min-width:112px;" }),
|
|
31
|
+
medium: createStyles({ name: "q08l2", styles: "font-size:0.875rem;letter-spacing:0.015rem;min-width:96px;padding-inline:var(--cnvs-sys-space-x6, 1.5rem);height:var(--cnvs-sys-space-x10, 2.5rem);" }),
|
|
32
|
+
small: createStyles({ name: "q08l3", styles: "font-size:0.875rem;letter-spacing:0.015rem;height:var(--cnvs-sys-space-x8, 2rem);min-width:var(--cnvs-sys-space-x20, 5rem);padding-inline:var(--cnvs-sys-space-x4, 1rem);gap:var(--cnvs-sys-space-x1, 0.25rem);" }),
|
|
33
|
+
extraSmall: createStyles({ name: "q08l4", styles: "font-size:0.75rem;line-height:var(--cnvs-sys-space-x4, 1rem);letter-spacing:0.02rem;height:var(--cnvs-sys-space-x6, 1.5rem);min-width:auto;padding-inline:var(--cnvs-sys-space-x3, 0.75rem);gap:var(--cnvs-sys-space-x1, 0.25rem);" }),
|
|
34
34
|
},
|
|
35
35
|
iconPosition: {
|
|
36
|
-
largeOnly: createStyles({ name: "
|
|
37
|
-
largeStart: createStyles({ name: "
|
|
38
|
-
largeEnd: createStyles({ name: "
|
|
39
|
-
mediumOnly: createStyles({ name: "
|
|
40
|
-
mediumStart: createStyles({ name: "
|
|
41
|
-
mediumEnd: createStyles({ name: "
|
|
42
|
-
smallOnly: createStyles({ name: "
|
|
43
|
-
smallStart: createStyles({ name: "
|
|
44
|
-
smallEnd: createStyles({ name: "
|
|
45
|
-
extraSmallOnly: createStyles({ name: "
|
|
46
|
-
extraSmallStart: createStyles({ name: "
|
|
47
|
-
extraSmallEnd: createStyles({ name: "
|
|
36
|
+
largeOnly: createStyles({ name: "q08l5", styles: "padding:0;min-width:calc(var(--cnvs-sys-space-x4, 1rem) * 3);" }),
|
|
37
|
+
largeStart: createStyles({ name: "q08l6", styles: "padding-inline-start:var(--cnvs-sys-space-x6, 1.5rem);padding-inline-end:var(--cnvs-sys-space-x8, 2rem);" }),
|
|
38
|
+
largeEnd: createStyles({ name: "q08l7", styles: "padding-inline-start:var(--cnvs-sys-space-x8, 2rem);padding-inline-end:var(--cnvs-sys-space-x6, 1.5rem);" }),
|
|
39
|
+
mediumOnly: createStyles({ name: "q08l8", styles: "padding:0;min-width:var(--cnvs-sys-space-x10, 2.5rem);" }),
|
|
40
|
+
mediumStart: createStyles({ name: "q08l9", styles: "padding-inline-start:calc(var(--cnvs-sys-space-x1, 0.25rem) * 5);padding-inline-end:var(--cnvs-sys-space-x6, 1.5rem);" }),
|
|
41
|
+
mediumEnd: createStyles({ name: "q08la", styles: "padding-inline-start:var(--cnvs-sys-space-x6, 1.5rem);padding-inline-end:calc(var(--cnvs-sys-space-x1, 0.25rem) * 5);" }),
|
|
42
|
+
smallOnly: createStyles({ name: "q08lb", styles: "padding:0;min-width:var(--cnvs-sys-space-x8, 2rem);" }),
|
|
43
|
+
smallStart: createStyles({ name: "q08lc", styles: "padding-inline-start:var(--cnvs-sys-space-x3, 0.75rem);padding-inline-end:var(--cnvs-sys-space-x4, 1rem);" }),
|
|
44
|
+
smallEnd: createStyles({ name: "q08ld", styles: "padding-inline-start:var(--cnvs-sys-space-x4, 1rem);padding-inline-end:var(--cnvs-sys-space-x3, 0.75rem);" }),
|
|
45
|
+
extraSmallOnly: createStyles({ name: "q08le", styles: "padding:0;min-width:var(--cnvs-sys-space-x6, 1.5rem);" }),
|
|
46
|
+
extraSmallStart: createStyles({ name: "q08lf", styles: "padding-inline-start:var(--cnvs-sys-space-x2, 0.5rem);padding-inline-end:var(--cnvs-sys-space-x3, 0.75rem);" }),
|
|
47
|
+
extraSmallEnd: createStyles({ name: "q08lg", styles: "padding-inline-start:var(--cnvs-sys-space-x3, 0.75rem);padding-inline-end:var(--cnvs-sys-space-x2, 0.5rem);" }),
|
|
48
48
|
},
|
|
49
49
|
});
|
|
50
50
|
export function capitalize(string = '') {
|
|
@@ -58,22 +58,19 @@ export function getIconPosition(size, iconPosition, children) {
|
|
|
58
58
|
*/
|
|
59
59
|
export const BaseButton = createComponent('button')({
|
|
60
60
|
displayName: 'BaseButton',
|
|
61
|
-
Component: ({ children,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
buttonVars.disabled(((_e = elemProps.colors) === null || _e === void 0 ? void 0 : _e.disabled) || {}),
|
|
75
|
-
cs,
|
|
76
|
-
] }, elemProps), children));
|
|
61
|
+
Component: ({ children, size, fillIcon, iconPosition, icon, colors, shouldMirrorIcon = false, ...elemProps }, ref, Element) => {
|
|
62
|
+
return (React.createElement(Element, Object.assign({ ref: ref, type: "button" }, mergeStyles(elemProps, [
|
|
63
|
+
baseButtonStyles,
|
|
64
|
+
buttonModifiers({
|
|
65
|
+
size: size,
|
|
66
|
+
iconPosition: getIconPosition(size, iconPosition, children),
|
|
67
|
+
}),
|
|
68
|
+
buttonVars.default((colors === null || colors === void 0 ? void 0 : colors.default) || {}),
|
|
69
|
+
buttonVars.focus((colors === null || colors === void 0 ? void 0 : colors.focus) || {}),
|
|
70
|
+
buttonVars.hover((colors === null || colors === void 0 ? void 0 : colors.hover) || {}),
|
|
71
|
+
buttonVars.active((colors === null || colors === void 0 ? void 0 : colors.active) || {}),
|
|
72
|
+
buttonVars.disabled((colors === null || colors === void 0 ? void 0 : colors.disabled) || {}),
|
|
73
|
+
])), children));
|
|
77
74
|
},
|
|
78
75
|
subComponents: {
|
|
79
76
|
Icon: ButtonLabelIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/DeleteButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DeleteButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/DeleteButton.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAS,WAAW,EAAC,MAAM,UAAU,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;CAAG;AA+BzD;;;;GAIG;AACH,eAAO,MAAM,YAAY,0FASvB,CAAC"}
|
|
@@ -2,9 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { buttonVars } from './BaseButton';
|
|
3
3
|
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
4
4
|
import { createStyles, cssVar } from '@workday/canvas-kit-styling';
|
|
5
|
+
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
5
6
|
import { base, brand, system } from '@workday/canvas-tokens-web';
|
|
6
7
|
import { Button } from './Button';
|
|
7
|
-
const deleteStyles = createStyles({ name: "
|
|
8
|
+
const deleteStyles = createStyles({ name: "q08l10", styles: "--css-button-vars-default-background:var(--cnvs-brand-error-base, #de2e21);--css-button-vars-default-border:transparent;--css-button-vars-default-borderRadius:var(--cnvs-sys-shape-round, 62.5rem);--css-button-vars-default-label:var(--cnvs-brand-error-accent, #ffffff);&:hover, &.hover{--css-button-vars-hover-background:var(--cnvs-brand-error-dark, #a31b12);--css-button-vars-hover-border:transparent;--css-button-vars-hover-label:var(--cnvs-brand-error-accent, #ffffff);}&:focus-visible, &.focus{--css-button-vars-focus-background:var(--cnvs-brand-error-base, #de2e21);--css-button-vars-focus-border:transparent;--css-button-vars-focus-label:var(--cnvs-brand-error-accent, #ffffff);--css-button-vars-focus-boxShadowInner:var(--cnvs-base-palette-french-vanilla-100, #ffffff);--css-button-vars-focus-boxShadowOuter:var(--cnvs-brand-common-focus-outline, #0875e1);}&:active, &.active{--css-button-vars-active-background:var(--cnvs-brand-error-darkest, rgba(128,22,14,1));--css-button-vars-active-border:transparent;--css-button-vars-active-label:var(--cnvs-brand-error-accent, #ffffff);}&:disabled, &:active:disabled, &:focus:disabled, &:hover:disabled{--css-button-vars-disabled-background:var(--cnvs-brand-error-light, #fcc9c5);--css-button-vars-disabled-label:var(--cnvs-brand-error-accent, #ffffff);opacity:1px;}" });
|
|
8
9
|
/**
|
|
9
10
|
* Use sparingly for destructive actions that will result in data loss, can’t be undone, or will
|
|
10
11
|
* have significant consequences. They commonly appear in confirmation dialogs as the final
|
|
@@ -12,7 +13,7 @@ const deleteStyles = createStyles({ name: "ncae10", styles: "--css-button-vars-d
|
|
|
12
13
|
*/
|
|
13
14
|
export const DeleteButton = createComponent('button')({
|
|
14
15
|
displayName: 'DeleteButton',
|
|
15
|
-
Component: ({ children,
|
|
16
|
-
return (React.createElement(Button, Object.assign({ as: Element, ref: ref, size: size,
|
|
16
|
+
Component: ({ children, size, ...elemProps }, ref, Element) => {
|
|
17
|
+
return (React.createElement(Button, Object.assign({ as: Element, ref: ref, size: size }, mergeStyles(elemProps, [deleteStyles])), children));
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/PrimaryButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/PrimaryButton.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAS,WAAW,EAAC,MAAM,UAAU,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAkCD,eAAO,MAAM,sBAAsB;;;;;;cA4BjC,CAAC;AAEH,eAAO,MAAM,aAAa,2FAaxB,CAAC"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { buttonVars } from './BaseButton';
|
|
3
3
|
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
4
|
+
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
4
5
|
import { createStyles, cssVar, createModifiers } from '@workday/canvas-kit-styling';
|
|
5
6
|
import { base, brand, system } from '@workday/canvas-tokens-web';
|
|
6
7
|
import { Button } from './Button';
|
|
7
|
-
const primaryStyles = createStyles({ name: "
|
|
8
|
+
const primaryStyles = createStyles({ name: "q08lw", styles: "--css-button-vars-default-background:var(--cnvs-brand-primary-base, var(--cnvs-base-palette-blueberry-400, #0875e1));--css-button-vars-default-border:transparent;--css-button-vars-default-borderRadius:var(--cnvs-sys-shape-round, 62.5rem);--css-button-vars-default-label:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-default-icon:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-hover-background:var(--cnvs-brand-primary-dark, rgba(0,92,184,1));--css-button-vars-hover-border:transparent;--css-button-vars-hover-label:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-hover-icon:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-focus-background:var(--cnvs-brand-primary-base, rgba(8,117,226,1));--css-button-vars-focus-border:transparent;--css-button-vars-focus-label:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-focus-icon:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-focus-boxShadowInner:var(--cnvs-base-palette-french-vanilla-100, #ffffff);--css-button-vars-focus-boxShadowOuter:var(--cnvs-brand-common-focus-outline, rgba(8,117,226,1));--css-button-vars-active-background:var(--cnvs-brand-primary-darkest, rgba(0,66,133,1));--css-button-vars-active-border:transparent;--css-button-vars-active-label:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-active-icon:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-disabled-background:var(--cnvs-brand-primary-base, rgba(8,117,226,1));--css-button-vars-disabled-border:transparent;--css-button-vars-disabled-label:var(--cnvs-brand-primary-accent, #ffffff);--css-button-vars-disabled-opacity:0.4;--css-button-vars-disabled-icon:var(--cnvs-brand-primary-accent, #ffffff);" });
|
|
8
9
|
export const primaryButtonModifiers = createModifiers({
|
|
9
10
|
variant: {
|
|
10
|
-
inverse: createStyles({ name: "
|
|
11
|
+
inverse: createStyles({ name: "q08lx", styles: "--css-button-vars-default-background:var(--cnvs-base-palette-french-vanilla-100, #ffffff);--css-button-vars-default-borderRadius:var(--cnvs-sys-shape-round, 62.5rem);--css-button-vars-default-label:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-default-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-hover-background:var(--cnvs-base-palette-soap-300, rgba(232,235,237,1));--css-button-vars-hover-label:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-hover-icon:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-focus-background:var(--cnvs-base-palette-french-vanilla-100, #ffffff);--css-button-vars-focus-label:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-focus-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-focus-boxShadowInner:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-focus-boxShadowOuter:var(--cnvs-base-palette-french-vanilla-100, #ffffff);--css-button-vars-active-background:var(--cnvs-base-palette-soap-400, rgba(224,227,230,1));--css-button-vars-active-label:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-active-icon:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-disabled-background:var(--cnvs-base-palette-french-vanilla-100, #ffffff);--css-button-vars-disabled-label:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-disabled-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));" }),
|
|
11
12
|
},
|
|
12
13
|
});
|
|
13
14
|
export const PrimaryButton = createComponent('button')({
|
|
14
15
|
displayName: 'PrimaryButton',
|
|
15
|
-
Component: ({ children,
|
|
16
|
-
return (React.createElement(Button, Object.assign({ as: Element, ref: ref
|
|
16
|
+
Component: ({ children, variant, ...elemProps }, ref, Element) => {
|
|
17
|
+
return (React.createElement(Button, Object.assign({ as: Element, ref: ref }, mergeStyles(elemProps, [primaryStyles, primaryButtonModifiers({ variant: variant })])), children));
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/SecondaryButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/SecondaryButton.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAS,WAAW,EAAC,MAAM,UAAU,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAkCD,eAAO,MAAM,wBAAwB;;;;;;cAgCnC,CAAC;AAEH,eAAO,MAAM,eAAe,6FAa1B,CAAC"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { buttonVars } from './BaseButton';
|
|
3
3
|
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
4
|
+
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
4
5
|
import { createStyles, cssVar, createModifiers } from '@workday/canvas-kit-styling';
|
|
5
6
|
import { base, brand, system } from '@workday/canvas-tokens-web';
|
|
6
7
|
import { Button } from './Button';
|
|
7
|
-
const secondaryStyles = createStyles({ name: "
|
|
8
|
+
const secondaryStyles = createStyles({ name: "q08ly", styles: "--css-button-vars-default-background:transparent;--css-button-vars-default-border:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-default-borderRadius:var(--cnvs-sys-shape-round, 62.5rem);--css-button-vars-default-label:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-default-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-hover-background:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-hover-border:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-hover-label:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--css-button-vars-hover-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--css-button-vars-focus-background:transparent;--css-button-vars-focus-border:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-focus-label:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-focus-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-focus-boxShadowInner:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-focus-boxShadowOuter:var(--cnvs-brand-common-focus-outline, rgba(8,117,226,1));--css-button-vars-active-background:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-active-border:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-active-label:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--css-button-vars-active-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--css-button-vars-disabled-background:transparent;--css-button-vars-disabled-border:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-disabled-label:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--css-button-vars-disabled-opacity:0.4;--css-button-vars-disabled-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));" });
|
|
8
9
|
export const secondaryButtonModifiers = createModifiers({
|
|
9
10
|
variant: {
|
|
10
|
-
inverse: createStyles({ name: "
|
|
11
|
+
inverse: createStyles({ name: "q08lz", styles: "--css-button-vars-default-background:transparent;--css-button-vars-default-border:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-default-label:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-default-icon:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-hover-background:var(--cnvs-base-palette-soap-300, rgba(232,235,237,1));--css-button-vars-hover-border:var(--cnvs-base-palette-soap-300, rgba(232,235,237,1));--css-button-vars-hover-label:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-hover-icon:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-focus-background:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-focus-border:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-focus-label:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-focus-icon:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-focus-boxShadowInner:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-focus-boxShadowOuter:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-active-background:var(--cnvs-base-palette-soap-400, rgba(224,227,230,1));--css-button-vars-active-border:var(--cnvs-base-palette-soap-400, rgba(224,227,230,1));--css-button-vars-active-label:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-active-icon:var(--cnvs-base-palette-black-pepper-500, rgba(31,31,31,1));--css-button-vars-disabled-background:transparent;--css-button-vars-disabled-border:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-disabled-label:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--css-button-vars-disabled-icon:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));" }),
|
|
11
12
|
},
|
|
12
13
|
});
|
|
13
14
|
export const SecondaryButton = createComponent('button')({
|
|
14
15
|
displayName: 'SecondaryButton',
|
|
15
|
-
Component: ({ children,
|
|
16
|
-
return (React.createElement(Button, Object.assign({ as: Element, ref: ref
|
|
16
|
+
Component: ({ children, variant, ...elemProps }, ref, Element) => {
|
|
17
|
+
return (React.createElement(Button, Object.assign({ as: Element, ref: ref }, mergeStyles(elemProps, [secondaryStyles, secondaryButtonModifiers({ variant: variant })])), children));
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -33,7 +33,7 @@ export declare const tertiaryButtonModifiers: {
|
|
|
33
33
|
extraSmallEnd: string;
|
|
34
34
|
};
|
|
35
35
|
} & ((modifiers: Partial<{
|
|
36
|
-
isThemeable:
|
|
36
|
+
isThemeable: true;
|
|
37
37
|
variant: "inverse";
|
|
38
38
|
iconPosition: "largeOnly" | "largeStart" | "largeEnd" | "mediumOnly" | "mediumStart" | "mediumEnd" | "smallOnly" | "smallStart" | "smallEnd" | "extraSmallOnly" | "extraSmallStart" | "extraSmallEnd";
|
|
39
39
|
}>) => string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TertiaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/TertiaryButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TertiaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/TertiaryButton.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAS,WAAW,EAAC,MAAM,UAAU,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA+CD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;cA0ElC,CAAC;AAEH,eAAO,MAAM,cAAc,4FA4CzB,CAAC"}
|