@workday/canvas-kit-react 6.0.0-alpha.0-next.27 → 6.0.0-alpha.0-next.31
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/PrimaryButton.tsx +110 -32
- package/button/lib/SecondaryButton.tsx +31 -16
- package/button/lib/TertiaryButton.tsx +45 -36
- package/button/lib/parts/ButtonContainer.tsx +18 -5
- package/button/lib/parts/ButtonLabelIcon.tsx +34 -14
- package/button/lib/types.ts +11 -0
- package/dist/commonjs/button/lib/PrimaryButton.d.ts +80 -6
- package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.js +80 -26
- package/dist/commonjs/button/lib/SecondaryButton.d.ts +8 -5
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.js +22 -12
- package/dist/commonjs/button/lib/TertiaryButton.d.ts +8 -4
- package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.js +24 -20
- package/dist/commonjs/button/lib/parts/ButtonContainer.d.ts +5 -3
- package/dist/commonjs/button/lib/parts/ButtonContainer.d.ts.map +1 -1
- package/dist/commonjs/button/lib/parts/ButtonContainer.js +7 -9
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts +7 -4
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.js +28 -13
- package/dist/commonjs/button/lib/types.d.ts +9 -0
- package/dist/commonjs/button/lib/types.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.d.ts +80 -6
- package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.js +81 -27
- package/dist/es6/button/lib/SecondaryButton.d.ts +8 -5
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.js +22 -12
- package/dist/es6/button/lib/TertiaryButton.d.ts +8 -4
- package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.js +25 -21
- package/dist/es6/button/lib/parts/ButtonContainer.d.ts +5 -3
- package/dist/es6/button/lib/parts/ButtonContainer.d.ts.map +1 -1
- package/dist/es6/button/lib/parts/ButtonContainer.js +7 -9
- package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts +7 -4
- package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
- package/dist/es6/button/lib/parts/ButtonLabelIcon.js +28 -13
- package/dist/es6/button/lib/types.d.ts +9 -0
- package/dist/es6/button/lib/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/ts3.5/dist/commonjs/button/lib/PrimaryButton.d.ts +80 -6
- package/ts3.5/dist/commonjs/button/lib/SecondaryButton.d.ts +8 -5
- package/ts3.5/dist/commonjs/button/lib/TertiaryButton.d.ts +8 -4
- package/ts3.5/dist/commonjs/button/lib/parts/ButtonContainer.d.ts +5 -3
- package/ts3.5/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts +7 -4
- package/ts3.5/dist/commonjs/button/lib/types.d.ts +9 -0
- package/ts3.5/dist/es6/button/lib/PrimaryButton.d.ts +80 -6
- package/ts3.5/dist/es6/button/lib/SecondaryButton.d.ts +8 -5
- package/ts3.5/dist/es6/button/lib/TertiaryButton.d.ts +8 -4
- package/ts3.5/dist/es6/button/lib/parts/ButtonContainer.d.ts +5 -3
- package/ts3.5/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts +7 -4
- package/ts3.5/dist/es6/button/lib/types.d.ts +9 -0
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GrowthBehavior, Themeable, EmotionCanvasTheme } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
|
-
import {
|
|
4
|
+
import { ButtonSizes, IconPositions } from './types';
|
|
5
5
|
export interface PrimaryButtonProps extends Themeable, GrowthBehavior {
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The variant of the PrimaryButton.
|
|
8
|
+
* @default undefined
|
|
9
|
+
*/
|
|
10
|
+
variant?: 'inverse';
|
|
11
|
+
/**
|
|
12
|
+
* There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
|
|
13
|
+
* If no size is provided, it will default to `medium`.
|
|
14
|
+
*
|
|
8
15
|
* @default 'medium'
|
|
9
16
|
*/
|
|
10
|
-
size?:
|
|
17
|
+
size?: ButtonSizes;
|
|
11
18
|
/**
|
|
12
19
|
* The data label of the Button.
|
|
13
20
|
* Note: not displayed at `small` size
|
|
@@ -19,10 +26,11 @@ export interface PrimaryButtonProps extends Themeable, GrowthBehavior {
|
|
|
19
26
|
*/
|
|
20
27
|
icon?: CanvasSystemIcon;
|
|
21
28
|
/**
|
|
22
|
-
*
|
|
29
|
+
* Button icon positions can either be `left` or `right`.
|
|
30
|
+
* If no value is provided, it defaults to `left`.
|
|
23
31
|
* @default 'left'
|
|
24
32
|
*/
|
|
25
|
-
iconPosition?:
|
|
33
|
+
iconPosition?: IconPositions;
|
|
26
34
|
/**
|
|
27
35
|
* If set to `true`, transform the icon's x-axis to mirror the graphic
|
|
28
36
|
* @default false
|
|
@@ -31,5 +39,71 @@ export interface PrimaryButtonProps extends Themeable, GrowthBehavior {
|
|
|
31
39
|
children?: React.ReactNode;
|
|
32
40
|
}
|
|
33
41
|
export declare const PrimaryButton: import("../../common").ElementComponent<"button", PrimaryButtonProps>;
|
|
34
|
-
export declare const getPrimaryButtonColors: (
|
|
42
|
+
export declare const getPrimaryButtonColors: (variant: "inverse" | undefined, theme: EmotionCanvasTheme) => {
|
|
43
|
+
default: {
|
|
44
|
+
background: string;
|
|
45
|
+
icon: string;
|
|
46
|
+
label: string;
|
|
47
|
+
labelData?: undefined;
|
|
48
|
+
};
|
|
49
|
+
hover: {
|
|
50
|
+
background: string;
|
|
51
|
+
icon?: undefined;
|
|
52
|
+
label?: undefined;
|
|
53
|
+
labelData?: undefined;
|
|
54
|
+
};
|
|
55
|
+
active: {
|
|
56
|
+
background: string;
|
|
57
|
+
icon?: undefined;
|
|
58
|
+
label?: undefined;
|
|
59
|
+
labelData?: undefined;
|
|
60
|
+
};
|
|
61
|
+
focus: {
|
|
62
|
+
background: string;
|
|
63
|
+
border?: undefined;
|
|
64
|
+
icon?: undefined;
|
|
65
|
+
label?: undefined;
|
|
66
|
+
labelData?: undefined;
|
|
67
|
+
focusRing?: undefined;
|
|
68
|
+
};
|
|
69
|
+
disabled: {
|
|
70
|
+
background: string;
|
|
71
|
+
icon?: undefined;
|
|
72
|
+
label?: undefined;
|
|
73
|
+
labelData?: undefined;
|
|
74
|
+
};
|
|
75
|
+
} | {
|
|
76
|
+
default: {
|
|
77
|
+
background: string;
|
|
78
|
+
icon: string;
|
|
79
|
+
label: string;
|
|
80
|
+
labelData: string;
|
|
81
|
+
};
|
|
82
|
+
hover: {
|
|
83
|
+
background: string;
|
|
84
|
+
icon: string;
|
|
85
|
+
label: string;
|
|
86
|
+
labelData: string;
|
|
87
|
+
};
|
|
88
|
+
active: {
|
|
89
|
+
background: string;
|
|
90
|
+
icon: string;
|
|
91
|
+
label: string;
|
|
92
|
+
labelData: string;
|
|
93
|
+
};
|
|
94
|
+
focus: {
|
|
95
|
+
background: string;
|
|
96
|
+
border: string;
|
|
97
|
+
icon: string;
|
|
98
|
+
label: string;
|
|
99
|
+
labelData: string;
|
|
100
|
+
focusRing: import("@emotion/serialize").CSSObject;
|
|
101
|
+
};
|
|
102
|
+
disabled: {
|
|
103
|
+
background: string;
|
|
104
|
+
icon: string;
|
|
105
|
+
label: string;
|
|
106
|
+
labelData: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
35
109
|
//# sourceMappingURL=PrimaryButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/PrimaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,cAAc,EAEd,SAAS,EACT,kBAAkB,
|
|
1
|
+
{"version":3,"file":"PrimaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/PrimaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,cAAc,EAEd,SAAS,EACT,kBAAkB,EAGnB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,kBAAmB,SAAQ,SAAS,EAAE,cAAc;IACnE;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAYD,eAAO,MAAM,aAAa,uEA+CxB,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ElC,CAAC"}
|
|
@@ -31,7 +31,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
var React = __importStar(require("react"));
|
|
33
33
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
34
|
+
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
34
35
|
var parts_1 = require("./parts");
|
|
36
|
+
// Button sizes where data labels are enabled
|
|
37
|
+
var dataLabelSizes = ['medium', 'large'];
|
|
38
|
+
// All disabled buttons are set to 40% opacity.
|
|
39
|
+
// This will eventually live in the ButtonContainer styles, but for now we're scoping it to Primary, Secondary, and Tertiary buttons.
|
|
40
|
+
var disabledButtonOpacity = {
|
|
41
|
+
'&:disabled, &:disabled:active': {
|
|
42
|
+
opacity: 0.4,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
35
45
|
exports.PrimaryButton = common_1.createComponent('button')({
|
|
36
46
|
displayName: 'PrimaryButton',
|
|
37
47
|
Component: function (_a, ref, Element) {
|
|
@@ -41,33 +51,77 @@ exports.PrimaryButton = common_1.createComponent('button')({
|
|
|
41
51
|
_b = _a.theme,
|
|
42
52
|
// TODO: Fix useTheme and make it a real hook
|
|
43
53
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
44
|
-
theme = _b === void 0 ? common_1.useTheme() : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, _d = _a.iconPosition, iconPosition = _d === void 0 ? 'left' : _d, dataLabel = _a.dataLabel, icon = _a.icon, _e = _a.shouldMirrorIcon, shouldMirrorIcon = _e === void 0 ? false : _e, children = _a.children, elemProps = __rest(_a, ["theme", "size", "iconPosition", "dataLabel", "icon", "shouldMirrorIcon", "children"]);
|
|
45
|
-
return (React.createElement(parts_1.ButtonContainer, __assign({ ref: ref, as: Element, colors: exports.getPrimaryButtonColors(theme), size: size }, elemProps),
|
|
46
|
-
icon &&
|
|
54
|
+
theme = _b === void 0 ? common_1.useTheme() : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, _d = _a.iconPosition, iconPosition = _d === void 0 ? 'left' : _d, variant = _a.variant, dataLabel = _a.dataLabel, icon = _a.icon, _e = _a.shouldMirrorIcon, shouldMirrorIcon = _e === void 0 ? false : _e, children = _a.children, elemProps = __rest(_a, ["theme", "size", "iconPosition", "variant", "dataLabel", "icon", "shouldMirrorIcon", "children"]);
|
|
55
|
+
return (React.createElement(parts_1.ButtonContainer, __assign({ ref: ref, as: Element, colors: exports.getPrimaryButtonColors(variant, theme), size: size, extraStyles: disabledButtonOpacity }, elemProps),
|
|
56
|
+
icon && iconPosition === 'left' && (React.createElement(parts_1.ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon })),
|
|
47
57
|
React.createElement(parts_1.ButtonLabel, null, children),
|
|
48
|
-
dataLabel && size
|
|
49
|
-
icon &&
|
|
58
|
+
dataLabel && dataLabelSizes.includes(size) && React.createElement(parts_1.ButtonLabelData, null, dataLabel),
|
|
59
|
+
icon && iconPosition === 'right' && (React.createElement(parts_1.ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon }))));
|
|
50
60
|
},
|
|
51
61
|
});
|
|
52
|
-
exports.getPrimaryButtonColors = function (
|
|
53
|
-
var themePrimary =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
exports.getPrimaryButtonColors = function (variant, theme) {
|
|
63
|
+
var themePrimary = theme.canvas.palette.primary;
|
|
64
|
+
switch (variant) {
|
|
65
|
+
case undefined:
|
|
66
|
+
default:
|
|
67
|
+
return {
|
|
68
|
+
default: {
|
|
69
|
+
background: themePrimary.main,
|
|
70
|
+
icon: themePrimary.contrast,
|
|
71
|
+
label: themePrimary.contrast,
|
|
72
|
+
},
|
|
73
|
+
hover: {
|
|
74
|
+
background: themePrimary.dark,
|
|
75
|
+
},
|
|
76
|
+
active: {
|
|
77
|
+
background: themePrimary.darkest,
|
|
78
|
+
},
|
|
79
|
+
focus: {
|
|
80
|
+
background: themePrimary.main,
|
|
81
|
+
},
|
|
82
|
+
disabled: {
|
|
83
|
+
background: themePrimary.main,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
case 'inverse':
|
|
87
|
+
return {
|
|
88
|
+
default: {
|
|
89
|
+
background: tokens_1.colors.frenchVanilla100,
|
|
90
|
+
icon: tokens_1.colors.blackPepper400,
|
|
91
|
+
label: tokens_1.colors.blackPepper400,
|
|
92
|
+
labelData: tokens_1.colors.blackPepper400,
|
|
93
|
+
},
|
|
94
|
+
hover: {
|
|
95
|
+
background: tokens_1.colors.soap300,
|
|
96
|
+
icon: tokens_1.colors.blackPepper500,
|
|
97
|
+
label: tokens_1.colors.blackPepper500,
|
|
98
|
+
labelData: tokens_1.colors.blackPepper500,
|
|
99
|
+
},
|
|
100
|
+
active: {
|
|
101
|
+
background: tokens_1.colors.soap300,
|
|
102
|
+
icon: tokens_1.colors.blackPepper500,
|
|
103
|
+
label: tokens_1.colors.blackPepper500,
|
|
104
|
+
labelData: tokens_1.colors.blackPepper500,
|
|
105
|
+
},
|
|
106
|
+
focus: {
|
|
107
|
+
background: tokens_1.colors.frenchVanilla100,
|
|
108
|
+
border: tokens_1.colors.blackPepper400,
|
|
109
|
+
icon: tokens_1.colors.blackPepper400,
|
|
110
|
+
label: tokens_1.colors.blackPepper400,
|
|
111
|
+
labelData: tokens_1.colors.blackPepper400,
|
|
112
|
+
focusRing: common_1.focusRing({
|
|
113
|
+
separation: 1,
|
|
114
|
+
innerColor: tokens_1.colors.blackPepper500,
|
|
115
|
+
outerColor: tokens_1.colors.frenchVanilla100,
|
|
116
|
+
}, theme),
|
|
117
|
+
},
|
|
118
|
+
// Identical to inverse 'default' styles. ButtonContainer will set opacity to 40%
|
|
119
|
+
disabled: {
|
|
120
|
+
background: tokens_1.colors.frenchVanilla100,
|
|
121
|
+
icon: tokens_1.colors.blackPepper400,
|
|
122
|
+
label: tokens_1.colors.blackPepper400,
|
|
123
|
+
labelData: tokens_1.colors.blackPepper400,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
73
127
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GrowthBehavior, Themeable, EmotionCanvasTheme } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
|
-
import { ButtonColors } from './types';
|
|
4
|
+
import { ButtonColors, ButtonSizes, IconPositions } from './types';
|
|
5
5
|
export interface SecondaryButtonProps extends Themeable, GrowthBehavior {
|
|
6
6
|
/**
|
|
7
7
|
* The variant of the SecondaryButton.
|
|
@@ -9,10 +9,12 @@ export interface SecondaryButtonProps extends Themeable, GrowthBehavior {
|
|
|
9
9
|
*/
|
|
10
10
|
variant?: 'inverse' | undefined;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
|
|
13
|
+
* If no size is provided, it will default to `medium`.
|
|
14
|
+
*
|
|
13
15
|
* @default 'medium'
|
|
14
16
|
*/
|
|
15
|
-
size?:
|
|
17
|
+
size?: ButtonSizes;
|
|
16
18
|
/**
|
|
17
19
|
* The data label of the Button.
|
|
18
20
|
* Note: not displayed at `small` size
|
|
@@ -24,10 +26,11 @@ export interface SecondaryButtonProps extends Themeable, GrowthBehavior {
|
|
|
24
26
|
*/
|
|
25
27
|
icon?: CanvasSystemIcon;
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
29
|
+
* Button icon positions can either be `left` or `right`.
|
|
30
|
+
* If no value is provided, it defaults to `left`.
|
|
28
31
|
* @default 'left'
|
|
29
32
|
*/
|
|
30
|
-
iconPosition?:
|
|
33
|
+
iconPosition?: IconPositions;
|
|
31
34
|
/**
|
|
32
35
|
* If set to `true`, transform the icon's x-axis to mirror the graphic
|
|
33
36
|
* @default false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/SecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,cAAc,EAEd,SAAS,EACT,kBAAkB,EAGnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/SecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,cAAc,EAEd,SAAS,EACT,kBAAkB,EAGnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAGjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAYD,eAAO,MAAM,eAAe,yEA+C1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,6EA+FpC,CAAC"}
|
|
@@ -33,6 +33,15 @@ var React = __importStar(require("react"));
|
|
|
33
33
|
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
34
34
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
35
35
|
var parts_1 = require("./parts");
|
|
36
|
+
// Button sizes where data labels are enabled
|
|
37
|
+
var dataLabelSizes = ['medium', 'large'];
|
|
38
|
+
// All disabled buttons are set to 40% opacity.
|
|
39
|
+
// This will eventually live in the ButtonContainer styles, but for now we're scoping it to Primary, Secondary, and Tertiary buttons.
|
|
40
|
+
var disabledButtonOpacity = {
|
|
41
|
+
'&:disabled, &:disabled:active': {
|
|
42
|
+
opacity: 0.4,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
36
45
|
exports.SecondaryButton = common_1.createComponent('button')({
|
|
37
46
|
displayName: 'SecondaryButton',
|
|
38
47
|
Component: function (_a, ref, Element) {
|
|
@@ -43,11 +52,11 @@ exports.SecondaryButton = common_1.createComponent('button')({
|
|
|
43
52
|
// TODO: Fix useTheme and make it a real hook
|
|
44
53
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
45
54
|
theme = _b === void 0 ? common_1.useTheme() : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, _d = _a.iconPosition, iconPosition = _d === void 0 ? 'left' : _d, variant = _a.variant, dataLabel = _a.dataLabel, icon = _a.icon, _e = _a.shouldMirrorIcon, shouldMirrorIcon = _e === void 0 ? false : _e, children = _a.children, elemProps = __rest(_a, ["theme", "size", "iconPosition", "variant", "dataLabel", "icon", "shouldMirrorIcon", "children"]);
|
|
46
|
-
return (React.createElement(parts_1.ButtonContainer, __assign({ ref: ref, as: Element, colors: exports.getSecondaryButtonColors(variant, theme), size: size }, elemProps),
|
|
47
|
-
icon &&
|
|
55
|
+
return (React.createElement(parts_1.ButtonContainer, __assign({ ref: ref, as: Element, colors: exports.getSecondaryButtonColors(variant, theme), size: size, extraStyles: disabledButtonOpacity }, elemProps),
|
|
56
|
+
icon && iconPosition === 'left' && (React.createElement(parts_1.ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon })),
|
|
48
57
|
React.createElement(parts_1.ButtonLabel, null, children),
|
|
49
|
-
dataLabel && size
|
|
50
|
-
icon &&
|
|
58
|
+
dataLabel && dataLabelSizes.includes(size) && React.createElement(parts_1.ButtonLabelData, null, dataLabel),
|
|
59
|
+
icon && iconPosition === 'right' && (React.createElement(parts_1.ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon }))));
|
|
51
60
|
},
|
|
52
61
|
});
|
|
53
62
|
exports.getSecondaryButtonColors = function (variant, theme) {
|
|
@@ -83,12 +92,13 @@ exports.getSecondaryButtonColors = function (variant, theme) {
|
|
|
83
92
|
label: tokens_1.colors.blackPepper400,
|
|
84
93
|
labelData: tokens_1.colors.blackPepper400,
|
|
85
94
|
},
|
|
95
|
+
// Identical to 'default' styles. ButtonContainer will set opacity to 40%
|
|
86
96
|
disabled: {
|
|
87
97
|
background: 'transparent',
|
|
88
|
-
border:
|
|
89
|
-
icon:
|
|
90
|
-
label:
|
|
91
|
-
labelData:
|
|
98
|
+
border: tokens_1.colors.blackPepper400,
|
|
99
|
+
icon: tokens_1.colors.blackPepper400,
|
|
100
|
+
label: tokens_1.colors.blackPepper400,
|
|
101
|
+
labelData: tokens_1.colors.blackPepper400,
|
|
92
102
|
},
|
|
93
103
|
};
|
|
94
104
|
case 'inverse':
|
|
@@ -124,12 +134,12 @@ exports.getSecondaryButtonColors = function (variant, theme) {
|
|
|
124
134
|
outerColor: tokens_1.colors.frenchVanilla100,
|
|
125
135
|
}, theme),
|
|
126
136
|
},
|
|
137
|
+
// Identical to inverse 'default' styles. ButtonContainer will set opacity to 40%
|
|
127
138
|
disabled: {
|
|
128
139
|
background: 'transparent',
|
|
129
|
-
border:
|
|
130
|
-
icon:
|
|
131
|
-
label:
|
|
132
|
-
labelData: 'rgba(255, 255, 255, 0.4)',
|
|
140
|
+
border: tokens_1.colors.frenchVanilla100,
|
|
141
|
+
icon: tokens_1.colors.frenchVanilla100,
|
|
142
|
+
label: tokens_1.colors.frenchVanilla100,
|
|
133
143
|
},
|
|
134
144
|
};
|
|
135
145
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Themeable } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
|
+
import { TertiaryButtonSizes, IconPositions } from './types';
|
|
4
5
|
export interface TertiaryButtonProps extends Themeable {
|
|
5
6
|
/**
|
|
6
7
|
* The variant of the TertiaryButton.
|
|
@@ -8,15 +9,18 @@ export interface TertiaryButtonProps extends Themeable {
|
|
|
8
9
|
*/
|
|
9
10
|
variant?: 'inverse' | undefined;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* There are three button sizes: `extraSmall`, `small`, and `medium`.
|
|
13
|
+
* If no size is provided, it will default to `medium`.
|
|
14
|
+
*
|
|
12
15
|
* @default 'medium'
|
|
13
16
|
*/
|
|
14
|
-
size?:
|
|
17
|
+
size?: TertiaryButtonSizes;
|
|
15
18
|
/**
|
|
16
|
-
*
|
|
19
|
+
* Button icon positions can either be `left` or `right`.
|
|
20
|
+
* If no value is provided, it defaults to `left`.
|
|
17
21
|
* @default 'left'
|
|
18
22
|
*/
|
|
19
|
-
iconPosition?:
|
|
23
|
+
iconPosition?: IconPositions;
|
|
20
24
|
/**
|
|
21
25
|
* The icon of the TertiaryButton.
|
|
22
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TertiaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/TertiaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAGL,SAAS,EAGV,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"TertiaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/TertiaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAGL,SAAS,EAGV,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAe,mBAAmB,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAGzE,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;OAEG;IACH;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAsGD,eAAO,MAAM,cAAc,wEA4DzB,CAAC"}
|
|
@@ -65,8 +65,8 @@ var getTertiaryButtonColors = function (variant, theme) {
|
|
|
65
65
|
},
|
|
66
66
|
disabled: {
|
|
67
67
|
background: 'transparent',
|
|
68
|
-
icon:
|
|
69
|
-
label:
|
|
68
|
+
icon: tokens_1.colors.frenchVanilla100,
|
|
69
|
+
label: tokens_1.colors.frenchVanilla100,
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
}
|
|
@@ -92,25 +92,29 @@ var getTertiaryButtonColors = function (variant, theme) {
|
|
|
92
92
|
focusRing: common_1.focusRing({}, theme),
|
|
93
93
|
},
|
|
94
94
|
disabled: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
label: themePrimary.light,
|
|
95
|
+
icon: themePrimary.main,
|
|
96
|
+
label: themePrimary.main,
|
|
98
97
|
},
|
|
99
98
|
};
|
|
100
99
|
}
|
|
101
100
|
};
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
var getPaddingStyles = function (icon, iconPosition) {
|
|
102
|
+
// if there is an icon on the left, add 4px extra padding to the right for visual balance
|
|
103
|
+
if (icon && iconPosition === 'left') {
|
|
104
|
+
return "0 " + tokens_1.space.xs + " 0 " + tokens_1.space.xxs;
|
|
105
|
+
}
|
|
106
|
+
// if there is an icon on the right, add 4px extra padding to the left for visual balance
|
|
107
|
+
if (icon && iconPosition === 'right') {
|
|
108
|
+
return "0 " + tokens_1.space.xxs + " 0 " + tokens_1.space.xs;
|
|
109
|
+
}
|
|
110
|
+
// if there is no icon, return the default padding
|
|
111
|
+
return "0 " + tokens_1.space.xxs;
|
|
112
|
+
};
|
|
113
|
+
// All disabled buttons are set to 40% opacity.
|
|
114
|
+
// This will eventually live in the ButtonContainer styles, but for now we're scoping it to Primary, Secondary, and Tertiary buttons.
|
|
115
|
+
var disabledButtonOpacity = {
|
|
116
|
+
'&:disabled, &:disabled:active': {
|
|
117
|
+
opacity: 0.4,
|
|
114
118
|
},
|
|
115
119
|
};
|
|
116
120
|
exports.TertiaryButton = common_1.createComponent('button')({
|
|
@@ -123,9 +127,9 @@ exports.TertiaryButton = common_1.createComponent('button')({
|
|
|
123
127
|
// TODO: Fix useTheme and make it a real hook
|
|
124
128
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
125
129
|
theme = _b === void 0 ? common_1.useTheme() : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, _d = _a.iconPosition, iconPosition = _d === void 0 ? 'left' : _d, variant = _a.variant, children = _a.children, icon = _a.icon, _e = _a.shouldMirrorIcon, shouldMirrorIcon = _e === void 0 ? false : _e, allCaps = _a.allCaps, elemProps = __rest(_a, ["theme", "size", "iconPosition", "variant", "children", "icon", "shouldMirrorIcon", "allCaps"]);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
var allContainerStyles = __assign({ borderRadius: tokens_1.borderRadius.m, border: '0', padding: getPaddingStyles(icon, iconPosition), minWidth: 'auto', textTransform: allCaps ? 'uppercase' : undefined, '.wdc-text-button-label': {
|
|
131
|
+
textDecoration: 'underline',
|
|
132
|
+
} }, disabledButtonOpacity);
|
|
129
133
|
return (React.createElement(parts_1.ButtonContainer, __assign({ ref: ref, as: Element, colors: getTertiaryButtonColors(variant, theme), size: size, extraStyles: allContainerStyles }, elemProps),
|
|
130
134
|
icon && iconPosition === 'left' && (React.createElement(parts_1.ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon })),
|
|
131
135
|
React.createElement(parts_1.ButtonLabel, { className: "wdc-text-button-label" }, children),
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { CSSObject } from '@emotion/core';
|
|
3
3
|
import { GrowthBehavior, EmotionCanvasTheme, StyledType } from '@workday/canvas-kit-react/common';
|
|
4
|
-
import { ButtonColors } from '../types';
|
|
4
|
+
import { ButtonColors, ButtonSizes } from '../types';
|
|
5
5
|
export interface ButtonContainerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, GrowthBehavior {
|
|
6
6
|
colors?: ButtonColors;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
|
|
9
|
+
* If no size is provided, it will default to `medium`.
|
|
10
|
+
*
|
|
9
11
|
* @default 'medium'
|
|
10
12
|
*/
|
|
11
|
-
size?:
|
|
13
|
+
size?: ButtonSizes;
|
|
12
14
|
/**
|
|
13
15
|
* The ref to the button that the styled component renders.
|
|
14
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonContainer.d.ts","sourceRoot":"","sources":["../../../../../button/lib/parts/ButtonContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EACL,cAAc,EAId,kBAAkB,EAClB,UAAU,EACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ButtonContainer.d.ts","sourceRoot":"","sources":["../../../../../button/lib/parts/ButtonContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EACL,cAAc,EAId,kBAAkB,EAClB,UAAU,EACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,UAAU,CAAC;AAGnD,MAAM,WAAW,oBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,cAAc;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AA8BD,eAAO,MAAM,eAAe,kMAgL3B,CAAC"}
|
|
@@ -50,15 +50,9 @@ exports.ButtonContainer = common_1.styled('button', {
|
|
|
50
50
|
var size = _a.size;
|
|
51
51
|
switch (size) {
|
|
52
52
|
case 'large':
|
|
53
|
-
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
height: '48px',
|
|
57
|
-
padding: "0 " + tokens_1.space.l,
|
|
58
|
-
'& > * ': {
|
|
59
|
-
margin: "0 " + tokens_1.spaceNumbers.xs / 2 + "px",
|
|
60
|
-
},
|
|
61
|
-
};
|
|
53
|
+
return __assign(__assign({}, tokens_1.type.levels.body.small), { fontWeight: tokens_1.type.properties.fontWeights.bold, minWidth: '112px', height: '48px', padding: "0 " + tokens_1.space.l, '& > * ': {
|
|
54
|
+
margin: "0 " + tokens_1.spaceNumbers.xxs / 2 + "px",
|
|
55
|
+
} });
|
|
62
56
|
case 'medium':
|
|
63
57
|
default:
|
|
64
58
|
return {
|
|
@@ -78,6 +72,10 @@ exports.ButtonContainer = common_1.styled('button', {
|
|
|
78
72
|
margin: "0 " + tokens_1.spaceNumbers.xxxs / 2 + "px",
|
|
79
73
|
},
|
|
80
74
|
};
|
|
75
|
+
case 'extraSmall':
|
|
76
|
+
return __assign(__assign({}, tokens_1.type.levels.subtext.medium), { fontWeight: tokens_1.type.properties.fontWeights.bold, height: tokens_1.space.m, padding: "0 " + tokens_1.space.xs, '& > * ': {
|
|
77
|
+
margin: "0 " + tokens_1.spaceNumbers.xxxs / 2 + "px",
|
|
78
|
+
} });
|
|
81
79
|
}
|
|
82
80
|
}, function (_a) {
|
|
83
81
|
var grow = _a.grow;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
2
|
+
import { ButtonSizes, IconPositions } from '../types';
|
|
2
3
|
export interface ButtonLabelIconProps {
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
|
|
6
|
+
*
|
|
5
7
|
* @default 'medium'
|
|
6
8
|
*/
|
|
7
|
-
size?:
|
|
9
|
+
size?: ButtonSizes;
|
|
8
10
|
/**
|
|
9
11
|
* The icon of the Button.
|
|
10
12
|
* Note: not displayed at `small` size
|
|
11
13
|
*/
|
|
12
14
|
icon?: CanvasSystemIcon;
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Button icon positions can either be `left` or `right`.
|
|
17
|
+
* If no value is provided, it defaults to `left`.
|
|
15
18
|
* @default 'left'
|
|
16
19
|
*/
|
|
17
|
-
iconPosition?:
|
|
20
|
+
iconPosition?: IconPositions;
|
|
18
21
|
/**
|
|
19
22
|
* If set to `true`, transform the icon's x-axis to mirror the graphic
|
|
20
23
|
* @default false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLabelIcon.d.ts","sourceRoot":"","sources":["../../../../../button/lib/parts/ButtonLabelIcon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAM9D,MAAM,WAAW,oBAAoB;IACnC
|
|
1
|
+
{"version":3,"file":"ButtonLabelIcon.d.ts","sourceRoot":"","sources":["../../../../../button/lib/parts/ButtonLabelIcon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAM9D,OAAO,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,UAAU,CAAC;AACpD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAuCD,eAAO,MAAM,eAAe,4GAkB3B,CAAC"}
|
|
@@ -37,8 +37,30 @@ var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
|
37
37
|
var is_prop_valid_1 = __importDefault(require("@emotion/is-prop-valid"));
|
|
38
38
|
var icon_1 = require("@workday/canvas-kit-react/icon");
|
|
39
39
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
40
|
-
var
|
|
41
|
-
|
|
40
|
+
var iconSizes = {
|
|
41
|
+
extraSmall: 18,
|
|
42
|
+
small: 20,
|
|
43
|
+
medium: 20,
|
|
44
|
+
large: 24,
|
|
45
|
+
};
|
|
46
|
+
var getIconPositionStyles = function (_a) {
|
|
47
|
+
var iconPosition = _a.iconPosition, size = _a.size;
|
|
48
|
+
// Adjust margin values for visual balance, large buttons require 8px
|
|
49
|
+
var balancingMargin = size === 'large' ? tokens_1.space.xxs : tokens_1.space.xxxs;
|
|
50
|
+
// iconPosition can only be "right", "left", or undefined (defaults to "left")
|
|
51
|
+
if (iconPosition === 'right') {
|
|
52
|
+
return {
|
|
53
|
+
marginLeft: undefined,
|
|
54
|
+
marginRight: "-" + balancingMargin + " !important",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return {
|
|
59
|
+
marginLeft: "-" + balancingMargin + " !important",
|
|
60
|
+
marginRight: undefined,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
};
|
|
42
64
|
var ButtonLabelIconStyled = common_1.styled('span', {
|
|
43
65
|
shouldForwardProp: function (prop) { return is_prop_valid_1.default(prop) && prop !== 'size'; },
|
|
44
66
|
})({
|
|
@@ -46,23 +68,16 @@ var ButtonLabelIconStyled = common_1.styled('span', {
|
|
|
46
68
|
}, function (_a) {
|
|
47
69
|
var size = _a.size;
|
|
48
70
|
return ({
|
|
49
|
-
width: size
|
|
50
|
-
height: size
|
|
51
|
-
});
|
|
52
|
-
}, function (_a) {
|
|
53
|
-
var iconPosition = _a.iconPosition;
|
|
54
|
-
return ({
|
|
55
|
-
marginLeft: iconPosition === 'right' ? undefined : "-" + tokens_1.space.xxxs + " !important",
|
|
56
|
-
marginRight: iconPosition === 'right' ? "-" + tokens_1.space.xxxs + " !important" : undefined,
|
|
71
|
+
width: size ? iconSizes[size] : iconSizes.medium,
|
|
72
|
+
height: size ? iconSizes[size] : iconSizes.medium,
|
|
57
73
|
});
|
|
58
|
-
});
|
|
74
|
+
}, getIconPositionStyles);
|
|
59
75
|
exports.ButtonLabelIcon = function (_a) {
|
|
60
76
|
var icon = _a.icon, size = _a.size, iconPosition = _a.iconPosition, _b = _a.shouldMirrorIcon, shouldMirrorIcon = _b === void 0 ? false : _b, elemProps = __rest(_a, ["icon", "size", "iconPosition", "shouldMirrorIcon"]);
|
|
61
|
-
/* istanbul ignore next line for coverage */
|
|
62
77
|
if (icon === undefined) {
|
|
63
78
|
return null;
|
|
64
79
|
}
|
|
65
|
-
var iconSize = size
|
|
80
|
+
var iconSize = size ? iconSizes[size] : undefined;
|
|
66
81
|
return (React.createElement(ButtonLabelIconStyled, __assign({ iconPosition: iconPosition, size: size }, elemProps),
|
|
67
82
|
React.createElement(icon_1.SystemIcon, { size: iconSize, icon: icon, shouldMirror: shouldMirrorIcon })));
|
|
68
83
|
};
|
|
@@ -19,4 +19,13 @@ export interface ButtonColors {
|
|
|
19
19
|
};
|
|
20
20
|
disabled: ButtonStateColors;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
|
|
24
|
+
* If no size is provided, it will default to `medium`.
|
|
25
|
+
*
|
|
26
|
+
* @default 'medium'
|
|
27
|
+
*/
|
|
28
|
+
export declare type ButtonSizes = 'extraSmall' | 'small' | 'medium' | 'large';
|
|
29
|
+
export declare type TertiaryButtonSizes = 'extraSmall' | 'small' | 'medium';
|
|
30
|
+
export declare type IconPositions = 'left' | 'right';
|
|
22
31
|
//# sourceMappingURL=types.d.ts.map
|