@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.
Files changed (53) hide show
  1. package/button/lib/PrimaryButton.tsx +110 -32
  2. package/button/lib/SecondaryButton.tsx +31 -16
  3. package/button/lib/TertiaryButton.tsx +45 -36
  4. package/button/lib/parts/ButtonContainer.tsx +18 -5
  5. package/button/lib/parts/ButtonLabelIcon.tsx +34 -14
  6. package/button/lib/types.ts +11 -0
  7. package/dist/commonjs/button/lib/PrimaryButton.d.ts +80 -6
  8. package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
  9. package/dist/commonjs/button/lib/PrimaryButton.js +80 -26
  10. package/dist/commonjs/button/lib/SecondaryButton.d.ts +8 -5
  11. package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
  12. package/dist/commonjs/button/lib/SecondaryButton.js +22 -12
  13. package/dist/commonjs/button/lib/TertiaryButton.d.ts +8 -4
  14. package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
  15. package/dist/commonjs/button/lib/TertiaryButton.js +24 -20
  16. package/dist/commonjs/button/lib/parts/ButtonContainer.d.ts +5 -3
  17. package/dist/commonjs/button/lib/parts/ButtonContainer.d.ts.map +1 -1
  18. package/dist/commonjs/button/lib/parts/ButtonContainer.js +7 -9
  19. package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts +7 -4
  20. package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
  21. package/dist/commonjs/button/lib/parts/ButtonLabelIcon.js +28 -13
  22. package/dist/commonjs/button/lib/types.d.ts +9 -0
  23. package/dist/commonjs/button/lib/types.d.ts.map +1 -1
  24. package/dist/es6/button/lib/PrimaryButton.d.ts +80 -6
  25. package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
  26. package/dist/es6/button/lib/PrimaryButton.js +81 -27
  27. package/dist/es6/button/lib/SecondaryButton.d.ts +8 -5
  28. package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
  29. package/dist/es6/button/lib/SecondaryButton.js +22 -12
  30. package/dist/es6/button/lib/TertiaryButton.d.ts +8 -4
  31. package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
  32. package/dist/es6/button/lib/TertiaryButton.js +25 -21
  33. package/dist/es6/button/lib/parts/ButtonContainer.d.ts +5 -3
  34. package/dist/es6/button/lib/parts/ButtonContainer.d.ts.map +1 -1
  35. package/dist/es6/button/lib/parts/ButtonContainer.js +7 -9
  36. package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts +7 -4
  37. package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
  38. package/dist/es6/button/lib/parts/ButtonLabelIcon.js +28 -13
  39. package/dist/es6/button/lib/types.d.ts +9 -0
  40. package/dist/es6/button/lib/types.d.ts.map +1 -1
  41. package/package.json +5 -5
  42. package/ts3.5/dist/commonjs/button/lib/PrimaryButton.d.ts +80 -6
  43. package/ts3.5/dist/commonjs/button/lib/SecondaryButton.d.ts +8 -5
  44. package/ts3.5/dist/commonjs/button/lib/TertiaryButton.d.ts +8 -4
  45. package/ts3.5/dist/commonjs/button/lib/parts/ButtonContainer.d.ts +5 -3
  46. package/ts3.5/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts +7 -4
  47. package/ts3.5/dist/commonjs/button/lib/types.d.ts +9 -0
  48. package/ts3.5/dist/es6/button/lib/PrimaryButton.d.ts +80 -6
  49. package/ts3.5/dist/es6/button/lib/SecondaryButton.d.ts +8 -5
  50. package/ts3.5/dist/es6/button/lib/TertiaryButton.d.ts +8 -4
  51. package/ts3.5/dist/es6/button/lib/parts/ButtonContainer.d.ts +5 -3
  52. package/ts3.5/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts +7 -4
  53. package/ts3.5/dist/es6/button/lib/types.d.ts +9 -0
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../button/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,iBAAiB,GAAG;QACzB,SAAS,CAAC,EAAE,SAAS,CAAC;KACvB,CAAC;IACF,QAAQ,EAAE,iBAAiB,CAAC;CAC7B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../button/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,iBAAiB,GAAG;QACzB,SAAS,CAAC,EAAE,SAAS,CAAC;KACvB,CAAC;IACF,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED;;;;;GAKG;AACH,oBAAY,WAAW,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtE,oBAAY,mBAAmB,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAC;AACpE,oBAAY,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC"}
@@ -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 { ButtonColors } from './types';
4
+ import { ButtonSizes, IconPositions } from './types';
5
5
  export interface PrimaryButtonProps extends Themeable, GrowthBehavior {
6
6
  /**
7
- * The size of the Button.
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?: 'small' | 'medium' | 'large';
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
- * The position of the TertiaryButton icon.
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?: 'left' | 'right';
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: ({ canvas: { palette: { primary: themePrimary }, }, }: EmotionCanvasTheme) => ButtonColors;
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,EAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAGrC,MAAM,WAAW,kBAAmB,SAAQ,SAAS,EAAE,cAAc;IACnE;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,aAAa,uEA6CxB,CAAC;AAEH,eAAO,MAAM,sBAAsB,4FAsBjC,CAAC"}
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"}
@@ -21,8 +21,18 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import * as React from 'react';
24
- import { useTheme, createComponent, } from '@workday/canvas-kit-react/common';
24
+ import { useTheme, createComponent, focusRing, } from '@workday/canvas-kit-react/common';
25
+ import { colors } from '@workday/canvas-kit-react/tokens';
25
26
  import { ButtonContainer, ButtonLabel, ButtonLabelData, ButtonLabelIcon } from './parts';
27
+ // Button sizes where data labels are enabled
28
+ var dataLabelSizes = ['medium', 'large'];
29
+ // All disabled buttons are set to 40% opacity.
30
+ // This will eventually live in the ButtonContainer styles, but for now we're scoping it to Primary, Secondary, and Tertiary buttons.
31
+ var disabledButtonOpacity = {
32
+ '&:disabled, &:disabled:active': {
33
+ opacity: 0.4,
34
+ },
35
+ };
26
36
  export var PrimaryButton = createComponent('button')({
27
37
  displayName: 'PrimaryButton',
28
38
  Component: function (_a, ref, Element) {
@@ -32,33 +42,77 @@ export var PrimaryButton = createComponent('button')({
32
42
  _b = _a.theme,
33
43
  // TODO: Fix useTheme and make it a real hook
34
44
  // eslint-disable-next-line react-hooks/rules-of-hooks
35
- theme = _b === void 0 ? 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"]);
36
- return (React.createElement(ButtonContainer, __assign({ ref: ref, as: Element, colors: getPrimaryButtonColors(theme), size: size }, elemProps),
37
- icon && size !== 'small' && iconPosition === 'left' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon })),
45
+ theme = _b === void 0 ? 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(ButtonContainer, __assign({ ref: ref, as: Element, colors: getPrimaryButtonColors(variant, theme), size: size, extraStyles: disabledButtonOpacity }, elemProps),
47
+ icon && iconPosition === 'left' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon })),
38
48
  React.createElement(ButtonLabel, null, children),
39
- dataLabel && size !== 'small' && React.createElement(ButtonLabelData, null, dataLabel),
40
- icon && size !== 'small' && iconPosition === 'right' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon }))));
49
+ dataLabel && dataLabelSizes.includes(size) && React.createElement(ButtonLabelData, null, dataLabel),
50
+ icon && iconPosition === 'right' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon }))));
41
51
  },
42
52
  });
43
- export var getPrimaryButtonColors = function (_a) {
44
- var themePrimary = _a.canvas.palette.primary;
45
- return ({
46
- default: {
47
- background: themePrimary.main,
48
- icon: themePrimary.contrast,
49
- label: themePrimary.contrast,
50
- },
51
- hover: {
52
- background: themePrimary.dark,
53
- },
54
- active: {
55
- background: themePrimary.darkest,
56
- },
57
- focus: {
58
- background: themePrimary.main,
59
- },
60
- disabled: {
61
- background: themePrimary.light,
62
- },
63
- });
53
+ export var getPrimaryButtonColors = function (variant, theme) {
54
+ var themePrimary = theme.canvas.palette.primary;
55
+ switch (variant) {
56
+ case undefined:
57
+ default:
58
+ return {
59
+ default: {
60
+ background: themePrimary.main,
61
+ icon: themePrimary.contrast,
62
+ label: themePrimary.contrast,
63
+ },
64
+ hover: {
65
+ background: themePrimary.dark,
66
+ },
67
+ active: {
68
+ background: themePrimary.darkest,
69
+ },
70
+ focus: {
71
+ background: themePrimary.main,
72
+ },
73
+ disabled: {
74
+ background: themePrimary.main,
75
+ },
76
+ };
77
+ case 'inverse':
78
+ return {
79
+ default: {
80
+ background: colors.frenchVanilla100,
81
+ icon: colors.blackPepper400,
82
+ label: colors.blackPepper400,
83
+ labelData: colors.blackPepper400,
84
+ },
85
+ hover: {
86
+ background: colors.soap300,
87
+ icon: colors.blackPepper500,
88
+ label: colors.blackPepper500,
89
+ labelData: colors.blackPepper500,
90
+ },
91
+ active: {
92
+ background: colors.soap300,
93
+ icon: colors.blackPepper500,
94
+ label: colors.blackPepper500,
95
+ labelData: colors.blackPepper500,
96
+ },
97
+ focus: {
98
+ background: colors.frenchVanilla100,
99
+ border: colors.blackPepper400,
100
+ icon: colors.blackPepper400,
101
+ label: colors.blackPepper400,
102
+ labelData: colors.blackPepper400,
103
+ focusRing: focusRing({
104
+ separation: 1,
105
+ innerColor: colors.blackPepper500,
106
+ outerColor: colors.frenchVanilla100,
107
+ }, theme),
108
+ },
109
+ // Identical to inverse 'default' styles. ButtonContainer will set opacity to 40%
110
+ disabled: {
111
+ background: colors.frenchVanilla100,
112
+ icon: colors.blackPepper400,
113
+ label: colors.blackPepper400,
114
+ labelData: colors.blackPepper400,
115
+ },
116
+ };
117
+ }
64
118
  };
@@ -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
- * The size of the Button.
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?: 'small' | 'medium' | 'large';
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
- * The position of the TertiaryButton icon.
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?: 'left' | 'right';
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;AAGrC,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,yEA8C1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,6EA8FpC,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"}
@@ -24,6 +24,15 @@ import * as React from 'react';
24
24
  import { colors } from '@workday/canvas-kit-react/tokens';
25
25
  import { useTheme, createComponent, focusRing, } from '@workday/canvas-kit-react/common';
26
26
  import { ButtonContainer, ButtonLabel, ButtonLabelData, ButtonLabelIcon } from './parts';
27
+ // Button sizes where data labels are enabled
28
+ var dataLabelSizes = ['medium', 'large'];
29
+ // All disabled buttons are set to 40% opacity.
30
+ // This will eventually live in the ButtonContainer styles, but for now we're scoping it to Primary, Secondary, and Tertiary buttons.
31
+ var disabledButtonOpacity = {
32
+ '&:disabled, &:disabled:active': {
33
+ opacity: 0.4,
34
+ },
35
+ };
27
36
  export var SecondaryButton = createComponent('button')({
28
37
  displayName: 'SecondaryButton',
29
38
  Component: function (_a, ref, Element) {
@@ -34,11 +43,11 @@ export var SecondaryButton = createComponent('button')({
34
43
  // TODO: Fix useTheme and make it a real hook
35
44
  // eslint-disable-next-line react-hooks/rules-of-hooks
36
45
  theme = _b === void 0 ? 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"]);
37
- return (React.createElement(ButtonContainer, __assign({ ref: ref, as: Element, colors: getSecondaryButtonColors(variant, theme), size: size }, elemProps),
38
- icon && size !== 'small' && iconPosition === 'left' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon })),
46
+ return (React.createElement(ButtonContainer, __assign({ ref: ref, as: Element, colors: getSecondaryButtonColors(variant, theme), size: size, extraStyles: disabledButtonOpacity }, elemProps),
47
+ icon && iconPosition === 'left' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon })),
39
48
  React.createElement(ButtonLabel, null, children),
40
- dataLabel && size !== 'small' && React.createElement(ButtonLabelData, null, dataLabel),
41
- icon && size !== 'small' && iconPosition === 'right' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon }))));
49
+ dataLabel && dataLabelSizes.includes(size) && React.createElement(ButtonLabelData, null, dataLabel),
50
+ icon && iconPosition === 'right' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon }))));
42
51
  },
43
52
  });
44
53
  export var getSecondaryButtonColors = function (variant, theme) {
@@ -74,12 +83,13 @@ export var getSecondaryButtonColors = function (variant, theme) {
74
83
  label: colors.blackPepper400,
75
84
  labelData: colors.blackPepper400,
76
85
  },
86
+ // Identical to 'default' styles. ButtonContainer will set opacity to 40%
77
87
  disabled: {
78
88
  background: 'transparent',
79
- border: 'rgba(30, 30, 30, 0.4)',
80
- icon: 'rgba(30, 30, 30, 0.4)',
81
- label: 'rgba(30, 30, 30, 0.4)',
82
- labelData: 'rgba(30, 30, 30, 0.4)',
89
+ border: colors.blackPepper400,
90
+ icon: colors.blackPepper400,
91
+ label: colors.blackPepper400,
92
+ labelData: colors.blackPepper400,
83
93
  },
84
94
  };
85
95
  case 'inverse':
@@ -115,12 +125,12 @@ export var getSecondaryButtonColors = function (variant, theme) {
115
125
  outerColor: colors.frenchVanilla100,
116
126
  }, theme),
117
127
  },
128
+ // Identical to inverse 'default' styles. ButtonContainer will set opacity to 40%
118
129
  disabled: {
119
130
  background: 'transparent',
120
- border: 'rgba(255, 255, 255, 0.4)',
121
- icon: 'rgba(255, 255, 255, 0.4)',
122
- label: 'rgba(255, 255, 255, 0.4)',
123
- labelData: 'rgba(255, 255, 255, 0.4)',
131
+ border: colors.frenchVanilla100,
132
+ icon: colors.frenchVanilla100,
133
+ label: colors.frenchVanilla100,
124
134
  },
125
135
  };
126
136
  }
@@ -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
- * The size of the TertiaryButton.
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?: 'small' | 'medium';
17
+ size?: TertiaryButtonSizes;
15
18
  /**
16
- * The position of the TertiaryButton icon.
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?: 'left' | 'right';
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;AAI9D,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;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;AA8FD,eAAO,MAAM,cAAc,wEA8DzB,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"}
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import * as React from 'react';
24
24
  import { focusRing, useTheme, createComponent, } from '@workday/canvas-kit-react/common';
25
- import { colors, space, type, borderRadius } from '@workday/canvas-kit-react/tokens';
25
+ import { colors, space, borderRadius } from '@workday/canvas-kit-react/tokens';
26
26
  import { ButtonContainer, ButtonLabelIcon, ButtonLabel } from './parts';
27
27
  var getTertiaryButtonColors = function (variant, theme) {
28
28
  var themePrimary = theme.canvas.palette.primary;
@@ -56,8 +56,8 @@ var getTertiaryButtonColors = function (variant, theme) {
56
56
  },
57
57
  disabled: {
58
58
  background: 'transparent',
59
- icon: 'rgba(255, 255, 255, 0.5)',
60
- label: 'rgba(255, 255, 255, 0.5)',
59
+ icon: colors.frenchVanilla100,
60
+ label: colors.frenchVanilla100,
61
61
  },
62
62
  };
63
63
  }
@@ -83,25 +83,29 @@ var getTertiaryButtonColors = function (variant, theme) {
83
83
  focusRing: focusRing({}, theme),
84
84
  },
85
85
  disabled: {
86
- background: 'transparent',
87
- icon: themePrimary.light,
88
- label: themePrimary.light,
86
+ icon: themePrimary.main,
87
+ label: themePrimary.main,
89
88
  },
90
89
  };
91
90
  }
92
91
  };
93
- var containerStyles = {
94
- borderRadius: borderRadius.m,
95
- border: '0',
96
- padding: "0 " + space.xxs,
97
- minWidth: 'auto',
98
- '.wdc-text-button-label': {
99
- borderBottom: '2px solid transparent',
100
- paddingTop: '2px',
101
- transition: 'border-color 0.3s',
102
- },
103
- '&:hover:not([disabled]) .wdc-text-button-label': {
104
- borderBottomColor: 'currentColor',
92
+ var getPaddingStyles = function (icon, iconPosition) {
93
+ // if there is an icon on the left, add 4px extra padding to the right for visual balance
94
+ if (icon && iconPosition === 'left') {
95
+ return "0 " + space.xs + " 0 " + space.xxs;
96
+ }
97
+ // if there is an icon on the right, add 4px extra padding to the left for visual balance
98
+ if (icon && iconPosition === 'right') {
99
+ return "0 " + space.xxs + " 0 " + space.xs;
100
+ }
101
+ // if there is no icon, return the default padding
102
+ return "0 " + space.xxs;
103
+ };
104
+ // All disabled buttons are set to 40% opacity.
105
+ // This will eventually live in the ButtonContainer styles, but for now we're scoping it to Primary, Secondary, and Tertiary buttons.
106
+ var disabledButtonOpacity = {
107
+ '&:disabled, &:disabled:active': {
108
+ opacity: 0.4,
105
109
  },
106
110
  };
107
111
  export var TertiaryButton = createComponent('button')({
@@ -114,9 +118,9 @@ export var TertiaryButton = createComponent('button')({
114
118
  // TODO: Fix useTheme and make it a real hook
115
119
  // eslint-disable-next-line react-hooks/rules-of-hooks
116
120
  theme = _b === void 0 ? 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"]);
117
- // Note: We don't use ButtonLabel because the label styles differ from other button types
118
- var allContainerStyles = allCaps
119
- ? __assign(__assign({}, containerStyles), { textTransform: 'uppercase', fontWeight: type.properties.fontWeights.bold, fontSize: size === 'medium' ? type.properties.fontSizes[16] : undefined, letterSpacing: '.5px' }) : __assign(__assign({}, containerStyles), { fontSize: size === 'medium' ? type.properties.fontSizes[14] : undefined });
121
+ var allContainerStyles = __assign({ borderRadius: borderRadius.m, border: '0', padding: getPaddingStyles(icon, iconPosition), minWidth: 'auto', textTransform: allCaps ? 'uppercase' : undefined, '.wdc-text-button-label': {
122
+ textDecoration: 'underline',
123
+ } }, disabledButtonOpacity);
120
124
  return (React.createElement(ButtonContainer, __assign({ ref: ref, as: Element, colors: getTertiaryButtonColors(variant, theme), size: size, extraStyles: allContainerStyles }, elemProps),
121
125
  icon && iconPosition === 'left' && (React.createElement(ButtonLabelIcon, { size: size, iconPosition: iconPosition, icon: icon, shouldMirrorIcon: shouldMirrorIcon })),
122
126
  React.createElement(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
- * The size of the Button.
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?: 'small' | 'medium' | 'large';
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;AAGtC,MAAM,WAAW,oBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,cAAc;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;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,kMAqK3B,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"}
@@ -45,15 +45,9 @@ export var ButtonContainer = styled('button', {
45
45
  var size = _a.size;
46
46
  switch (size) {
47
47
  case 'large':
48
- return {
49
- fontSize: type.properties.fontSizes[16],
50
- minWidth: '112px',
51
- height: '48px',
52
- padding: "0 " + space.l,
53
- '& > * ': {
54
- margin: "0 " + spaceNumbers.xs / 2 + "px",
55
- },
56
- };
48
+ return __assign(__assign({}, type.levels.body.small), { fontWeight: type.properties.fontWeights.bold, minWidth: '112px', height: '48px', padding: "0 " + space.l, '& > * ': {
49
+ margin: "0 " + spaceNumbers.xxs / 2 + "px",
50
+ } });
57
51
  case 'medium':
58
52
  default:
59
53
  return {
@@ -73,6 +67,10 @@ export var ButtonContainer = styled('button', {
73
67
  margin: "0 " + spaceNumbers.xxxs / 2 + "px",
74
68
  },
75
69
  };
70
+ case 'extraSmall':
71
+ return __assign(__assign({}, type.levels.subtext.medium), { fontWeight: type.properties.fontWeights.bold, height: space.m, padding: "0 " + space.xs, '& > * ': {
72
+ margin: "0 " + spaceNumbers.xxxs / 2 + "px",
73
+ } });
76
74
  }
77
75
  }, function (_a) {
78
76
  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
- * The size of the Button.
5
+ * There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
6
+ *
5
7
  * @default 'medium'
6
8
  */
7
- size?: 'small' | 'medium' | 'large';
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
- * The position of the TertiaryButton icon.
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?: 'left' | 'right';
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;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAqBD,eAAO,MAAM,eAAe,4GAmB3B,CAAC"}
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"}
@@ -25,8 +25,30 @@ import { space } from '@workday/canvas-kit-react/tokens';
25
25
  import isPropValid from '@emotion/is-prop-valid';
26
26
  import { SystemIcon } from '@workday/canvas-kit-react/icon';
27
27
  import { styled } from '@workday/canvas-kit-react/common';
28
- var ICON_SIZE = 24;
29
- var SMALL_ICON_SIZE = 20;
28
+ var iconSizes = {
29
+ extraSmall: 18,
30
+ small: 20,
31
+ medium: 20,
32
+ large: 24,
33
+ };
34
+ var getIconPositionStyles = function (_a) {
35
+ var iconPosition = _a.iconPosition, size = _a.size;
36
+ // Adjust margin values for visual balance, large buttons require 8px
37
+ var balancingMargin = size === 'large' ? space.xxs : space.xxxs;
38
+ // iconPosition can only be "right", "left", or undefined (defaults to "left")
39
+ if (iconPosition === 'right') {
40
+ return {
41
+ marginLeft: undefined,
42
+ marginRight: "-" + balancingMargin + " !important",
43
+ };
44
+ }
45
+ else {
46
+ return {
47
+ marginLeft: "-" + balancingMargin + " !important",
48
+ marginRight: undefined,
49
+ };
50
+ }
51
+ };
30
52
  var ButtonLabelIconStyled = styled('span', {
31
53
  shouldForwardProp: function (prop) { return isPropValid(prop) && prop !== 'size'; },
32
54
  })({
@@ -34,23 +56,16 @@ var ButtonLabelIconStyled = styled('span', {
34
56
  }, function (_a) {
35
57
  var size = _a.size;
36
58
  return ({
37
- width: size === 'small' ? SMALL_ICON_SIZE : ICON_SIZE,
38
- height: size === 'small' ? SMALL_ICON_SIZE : ICON_SIZE,
39
- });
40
- }, function (_a) {
41
- var iconPosition = _a.iconPosition;
42
- return ({
43
- marginLeft: iconPosition === 'right' ? undefined : "-" + space.xxxs + " !important",
44
- marginRight: iconPosition === 'right' ? "-" + space.xxxs + " !important" : undefined,
59
+ width: size ? iconSizes[size] : iconSizes.medium,
60
+ height: size ? iconSizes[size] : iconSizes.medium,
45
61
  });
46
- });
62
+ }, getIconPositionStyles);
47
63
  export var ButtonLabelIcon = function (_a) {
48
64
  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"]);
49
- /* istanbul ignore next line for coverage */
50
65
  if (icon === undefined) {
51
66
  return null;
52
67
  }
53
- var iconSize = size === 'small' ? SMALL_ICON_SIZE : undefined;
68
+ var iconSize = size ? iconSizes[size] : undefined;
54
69
  return (React.createElement(ButtonLabelIconStyled, __assign({ iconPosition: iconPosition, size: size }, elemProps),
55
70
  React.createElement(SystemIcon, { size: iconSize, icon: icon, shouldMirror: shouldMirrorIcon })));
56
71
  };