@workday/canvas-kit-react 8.1.1 → 8.1.3

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 (45) hide show
  1. package/action-bar/lib/ActionBarList.tsx +11 -7
  2. package/button/lib/TertiaryButton.tsx +1 -1
  3. package/common/lib/theming/getCanvasTheme.ts +40 -0
  4. package/common/lib/theming/getObjectProxy.ts +24 -0
  5. package/common/lib/theming/index.ts +2 -0
  6. package/dist/commonjs/action-bar/lib/ActionBarList.d.ts.map +1 -1
  7. package/dist/commonjs/action-bar/lib/ActionBarList.js +4 -3
  8. package/dist/commonjs/button/lib/TertiaryButton.d.ts +1 -1
  9. package/dist/commonjs/common/lib/theming/getCanvasTheme.d.ts +28 -0
  10. package/dist/commonjs/common/lib/theming/getCanvasTheme.d.ts.map +1 -0
  11. package/dist/commonjs/common/lib/theming/getCanvasTheme.js +42 -0
  12. package/dist/commonjs/common/lib/theming/getObjectProxy.d.ts +9 -0
  13. package/dist/commonjs/common/lib/theming/getObjectProxy.d.ts.map +1 -0
  14. package/dist/commonjs/common/lib/theming/getObjectProxy.js +30 -0
  15. package/dist/commonjs/common/lib/theming/index.d.ts +2 -0
  16. package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
  17. package/dist/commonjs/common/lib/theming/index.js +2 -0
  18. package/dist/commonjs/modal/lib/ModalCard.d.ts.map +1 -1
  19. package/dist/commonjs/modal/lib/ModalCard.js +4 -3
  20. package/dist/commonjs/modal/lib/ModalHeading.d.ts.map +1 -1
  21. package/dist/commonjs/modal/lib/ModalHeading.js +4 -3
  22. package/dist/commonjs/modal/lib/ModalOverlay.d.ts.map +1 -1
  23. package/dist/commonjs/modal/lib/ModalOverlay.js +4 -3
  24. package/dist/es6/action-bar/lib/ActionBarList.d.ts.map +1 -1
  25. package/dist/es6/action-bar/lib/ActionBarList.js +5 -4
  26. package/dist/es6/button/lib/TertiaryButton.d.ts +1 -1
  27. package/dist/es6/common/lib/theming/getCanvasTheme.d.ts +28 -0
  28. package/dist/es6/common/lib/theming/getCanvasTheme.d.ts.map +1 -0
  29. package/dist/es6/common/lib/theming/getCanvasTheme.js +37 -0
  30. package/dist/es6/common/lib/theming/getObjectProxy.d.ts +9 -0
  31. package/dist/es6/common/lib/theming/getObjectProxy.d.ts.map +1 -0
  32. package/dist/es6/common/lib/theming/getObjectProxy.js +26 -0
  33. package/dist/es6/common/lib/theming/index.d.ts +2 -0
  34. package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
  35. package/dist/es6/common/lib/theming/index.js +2 -0
  36. package/dist/es6/modal/lib/ModalCard.d.ts.map +1 -1
  37. package/dist/es6/modal/lib/ModalCard.js +5 -4
  38. package/dist/es6/modal/lib/ModalHeading.d.ts.map +1 -1
  39. package/dist/es6/modal/lib/ModalHeading.js +5 -4
  40. package/dist/es6/modal/lib/ModalOverlay.d.ts.map +1 -1
  41. package/dist/es6/modal/lib/ModalOverlay.js +5 -4
  42. package/modal/lib/ModalCard.tsx +12 -8
  43. package/modal/lib/ModalHeading.tsx +9 -5
  44. package/modal/lib/ModalOverlay.tsx +17 -13
  45. package/package.json +3 -3
@@ -4,6 +4,7 @@ import {commonColors, colors, space} from '@workday/canvas-kit-react/tokens';
4
4
  import {
5
5
  createSubcomponent,
6
6
  ExtractProps,
7
+ getCanvasTheme,
7
8
  styled,
8
9
  StyledType,
9
10
  } from '@workday/canvas-kit-react/common';
@@ -36,14 +37,17 @@ export interface ActionBarListProps<T = any>
36
37
  overflowButton?: React.ReactNode;
37
38
  }
38
39
 
39
- const ResponsiveHStack = styled(HStack)<ActionBarListProps & StyledType>(({theme}) => ({
40
- [theme.canvas.breakpoints.down('s')]: {
41
- padding: space.s,
42
- '> *': {
43
- flex: 1,
40
+ const ResponsiveHStack = styled(HStack)<ActionBarListProps & StyledType>(({theme}) => {
41
+ const canvasTheme = getCanvasTheme(theme);
42
+ return {
43
+ [canvasTheme.breakpoints.down('s')]: {
44
+ padding: space.s,
45
+ '> *': {
46
+ flex: 1,
47
+ },
44
48
  },
45
- },
46
- }));
49
+ };
50
+ });
47
51
 
48
52
  export const useActionBarList = useOverflowListMeasure;
49
53
 
@@ -20,7 +20,7 @@ export interface TertiaryButtonProps extends Themeable, BaseButtonProps {
20
20
  */
21
21
  variant?: 'inverse' | undefined;
22
22
  /**
23
- * There are three button sizes: `extraSmall`, `small`, and `medium`.
23
+ * There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
24
24
  * If no size is provided, it will default to `medium`.
25
25
  *
26
26
  * @default 'medium'
@@ -0,0 +1,40 @@
1
+ import {CanvasTheme} from '@workday/canvas-kit-react/common';
2
+ import {Theme, useTheme} from '@emotion/react';
3
+ import {getObjectProxy} from './getObjectProxy';
4
+ import {defaultCanvasTheme} from './theme';
5
+
6
+ /**
7
+ * Use this function when you have access to `theme` in styled components.
8
+ * This function ensures that a theme is defined via a proxy and allows access to properties on the theme object.
9
+ * @param theme Any partial or full theme object.
10
+ * @returns a theme object if it is defined, otherwise it will fall back on using defaultCanvasTheme
11
+ * @example
12
+ * const ResponsiveContainer = styled('div')(({theme}) => {
13
+ * const canvas = getCanvasTheme(theme);
14
+ * return {
15
+ * maxHeight: '100vh',
16
+ * display: 'flex',
17
+ * position: 'absolute',
18
+ * left: 0,
19
+ * top: 0,
20
+ * justifyContent: 'center',
21
+ * alignItems: 'center',
22
+ * height: '100vh',
23
+ * [canvas.breakpoints.down('s')]: {
24
+ * alignItems: 'end',
25
+ * },
26
+ * };
27
+ *});
28
+ */
29
+ export function getCanvasTheme(theme: any = {}): CanvasTheme {
30
+ // prettier-ignore
31
+ //@ts-ignore
32
+ const windowTheme = typeof window !== 'undefined' && window.workday && window.workday.canvas && window.workday.canvas.theme;
33
+ return getObjectProxy(theme.canvas || windowTheme || {}, defaultCanvasTheme);
34
+ }
35
+
36
+ export function useCanvasTheme(themeOverride?: Theme) {
37
+ const theme = useTheme();
38
+
39
+ return getCanvasTheme(themeOverride || theme);
40
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The functions gets a new object proxy. This is used for theme to ensure regardless of a partial theme object
3
+ * there will be a fallback theme object so that properties aren't undefined regardless of the `target` object.
4
+ * This function will also handle nested properties.
5
+ * @param target Any custom theme object
6
+ * @param fallback A fallback theme object
7
+ */
8
+ /* eslint-disable compat/compat */ // TODO: Revisit eslint rules that are no longer needed now that we don't support IE11
9
+ export function getObjectProxy<T extends {}>(target: unknown, fallback: T): T {
10
+ return new Proxy(target as any, {
11
+ get(target, prop: keyof T) {
12
+ if (typeof fallback[prop] === 'object' && typeof target[prop] === 'object') {
13
+ return getObjectProxy(target[prop] || {}, fallback[prop]);
14
+ } else if (target[prop] !== undefined) {
15
+ return target[prop];
16
+ } else {
17
+ return fallback[prop];
18
+ }
19
+ },
20
+ ownKeys(target) {
21
+ return Object.keys(fallback);
22
+ },
23
+ }) as T;
24
+ }
@@ -5,3 +5,5 @@ export {default as styled, StyleRewriteFn} from './styled';
5
5
  export * from './theme';
6
6
  export * from './useTheme';
7
7
  export * from './useIsRTL';
8
+ export * from './getCanvasTheme';
9
+ export * from './getObjectProxy';
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBarList.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAMxD,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG,CACzC,SAAQ,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC;IACrE;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IAC1E;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAWD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAyB,CAAC;AAEvD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBxB,CAAC"}
1
+ {"version":3,"file":"ActionBarList.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAMxD,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG,CACzC,SAAQ,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC;IACrE;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IAC1E;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAcD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAyB,CAAC;AAEvD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBxB,CAAC"}
@@ -51,14 +51,15 @@ var useActionBarModel_1 = require("./useActionBarModel");
51
51
  var ResponsiveHStack = common_1.styled(layout_1.HStack)(function (_a) {
52
52
  var _b;
53
53
  var theme = _a.theme;
54
- return (_b = {},
55
- _b[theme.canvas.breakpoints.down('s')] = {
54
+ var canvasTheme = common_1.getCanvasTheme(theme);
55
+ return _b = {},
56
+ _b[canvasTheme.breakpoints.down('s')] = {
56
57
  padding: tokens_1.space.s,
57
58
  '> *': {
58
59
  flex: 1,
59
60
  },
60
61
  },
61
- _b);
62
+ _b;
62
63
  });
63
64
  exports.useActionBarList = collection_1.useOverflowListMeasure;
64
65
  exports.ActionBarList = common_1.createSubcomponent('div')({
@@ -10,7 +10,7 @@ export interface TertiaryButtonProps extends Themeable, BaseButtonProps {
10
10
  */
11
11
  variant?: 'inverse' | undefined;
12
12
  /**
13
- * There are three button sizes: `extraSmall`, `small`, and `medium`.
13
+ * There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
14
14
  * If no size is provided, it will default to `medium`.
15
15
  *
16
16
  * @default 'medium'
@@ -0,0 +1,28 @@
1
+ import { CanvasTheme } from '@workday/canvas-kit-react/common';
2
+ import { Theme } from '@emotion/react';
3
+ /**
4
+ * Use this function when you have access to `theme` in styled components.
5
+ * This function ensures that a theme is defined via a proxy and allows access to properties on the theme object.
6
+ * @param theme Any partial or full theme object.
7
+ * @returns a theme object if it is defined, otherwise it will fall back on using defaultCanvasTheme
8
+ * @example
9
+ * const ResponsiveContainer = styled('div')(({theme}) => {
10
+ * const canvas = getCanvasTheme(theme);
11
+ * return {
12
+ * maxHeight: '100vh',
13
+ * display: 'flex',
14
+ * position: 'absolute',
15
+ * left: 0,
16
+ * top: 0,
17
+ * justifyContent: 'center',
18
+ * alignItems: 'center',
19
+ * height: '100vh',
20
+ * [canvas.breakpoints.down('s')]: {
21
+ * alignItems: 'end',
22
+ * },
23
+ * };
24
+ *});
25
+ */
26
+ export declare function getCanvasTheme(theme?: any): CanvasTheme;
27
+ export declare function useCanvasTheme(themeOverride?: Theme): CanvasTheme;
28
+ //# sourceMappingURL=getCanvasTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCanvasTheme.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/getCanvasTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAC,KAAK,EAAW,MAAM,gBAAgB,CAAC;AAI/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,KAAK,GAAE,GAAQ,GAAG,WAAW,CAK3D;AAED,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,KAAK,eAInD"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCanvasTheme = exports.getCanvasTheme = void 0;
4
+ var react_1 = require("@emotion/react");
5
+ var getObjectProxy_1 = require("./getObjectProxy");
6
+ var theme_1 = require("./theme");
7
+ /**
8
+ * Use this function when you have access to `theme` in styled components.
9
+ * This function ensures that a theme is defined via a proxy and allows access to properties on the theme object.
10
+ * @param theme Any partial or full theme object.
11
+ * @returns a theme object if it is defined, otherwise it will fall back on using defaultCanvasTheme
12
+ * @example
13
+ * const ResponsiveContainer = styled('div')(({theme}) => {
14
+ * const canvas = getCanvasTheme(theme);
15
+ * return {
16
+ * maxHeight: '100vh',
17
+ * display: 'flex',
18
+ * position: 'absolute',
19
+ * left: 0,
20
+ * top: 0,
21
+ * justifyContent: 'center',
22
+ * alignItems: 'center',
23
+ * height: '100vh',
24
+ * [canvas.breakpoints.down('s')]: {
25
+ * alignItems: 'end',
26
+ * },
27
+ * };
28
+ *});
29
+ */
30
+ function getCanvasTheme(theme) {
31
+ if (theme === void 0) { theme = {}; }
32
+ // prettier-ignore
33
+ //@ts-ignore
34
+ var windowTheme = typeof window !== 'undefined' && window.workday && window.workday.canvas && window.workday.canvas.theme;
35
+ return getObjectProxy_1.getObjectProxy(theme.canvas || windowTheme || {}, theme_1.defaultCanvasTheme);
36
+ }
37
+ exports.getCanvasTheme = getCanvasTheme;
38
+ function useCanvasTheme(themeOverride) {
39
+ var theme = react_1.useTheme();
40
+ return getCanvasTheme(themeOverride || theme);
41
+ }
42
+ exports.useCanvasTheme = useCanvasTheme;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The functions gets a new object proxy. This is used for theme to ensure regardless of a partial theme object
3
+ * there will be a fallback theme object so that properties aren't undefined regardless of the `target` object.
4
+ * This function will also handle nested properties.
5
+ * @param target Any custom theme object
6
+ * @param fallback A fallback theme object
7
+ */
8
+ export declare function getObjectProxy<T extends {}>(target: unknown, fallback: T): T;
9
+ //# sourceMappingURL=getObjectProxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getObjectProxy.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/getObjectProxy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,cAAc,CAAC,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAe5E"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getObjectProxy = void 0;
4
+ /**
5
+ * The functions gets a new object proxy. This is used for theme to ensure regardless of a partial theme object
6
+ * there will be a fallback theme object so that properties aren't undefined regardless of the `target` object.
7
+ * This function will also handle nested properties.
8
+ * @param target Any custom theme object
9
+ * @param fallback A fallback theme object
10
+ */
11
+ /* eslint-disable compat/compat */ // TODO: Revisit eslint rules that are no longer needed now that we don't support IE11
12
+ function getObjectProxy(target, fallback) {
13
+ return new Proxy(target, {
14
+ get: function (target, prop) {
15
+ if (typeof fallback[prop] === 'object' && typeof target[prop] === 'object') {
16
+ return getObjectProxy(target[prop] || {}, fallback[prop]);
17
+ }
18
+ else if (target[prop] !== undefined) {
19
+ return target[prop];
20
+ }
21
+ else {
22
+ return fallback[prop];
23
+ }
24
+ },
25
+ ownKeys: function (target) {
26
+ return Object.keys(fallback);
27
+ },
28
+ });
29
+ }
30
+ exports.getObjectProxy = getObjectProxy;
@@ -5,4 +5,6 @@ export { default as styled, StyleRewriteFn } from './styled';
5
5
  export * from './theme';
6
6
  export * from './useTheme';
7
7
  export * from './useIsRTL';
8
+ export * from './getCanvasTheme';
9
+ export * from './getObjectProxy';
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,OAAO,IAAI,MAAM,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAC3D,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,OAAO,IAAI,MAAM,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAC3D,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
@@ -23,3 +23,5 @@ Object.defineProperty(exports, "styled", { enumerable: true, get: function () {
23
23
  __exportStar(require("./theme"), exports);
24
24
  __exportStar(require("./useTheme"), exports);
25
25
  __exportStar(require("./useIsRTL"), exports);
26
+ __exportStar(require("./getCanvasTheme"), exports);
27
+ __exportStar(require("./getObjectProxy"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"ModalCard.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAItD,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;CAAG;AAWjF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;EAMpB,CAAC"}
1
+ {"version":3,"file":"ModalCard.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAItD,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;CAAG;AAcjF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;EAMpB,CAAC"}
@@ -39,15 +39,16 @@ var hooks_1 = require("./hooks");
39
39
  var ResponsiveModalCard = common_1.styled(popup_1.Popup.Card)(function (_a) {
40
40
  var _b;
41
41
  var theme = _a.theme;
42
- return (_b = {
42
+ var canvasTheme = common_1.getCanvasTheme(theme);
43
+ return _b = {
43
44
  margin: tokens_1.space.xl
44
45
  },
45
- _b[theme.canvas.breakpoints.down('s')] = {
46
+ _b[canvasTheme.breakpoints.down('s')] = {
46
47
  margin: tokens_1.space.s,
47
48
  padding: tokens_1.space.xxs,
48
49
  borderRadius: tokens_1.space.m,
49
50
  },
50
- _b);
51
+ _b;
51
52
  });
52
53
  exports.ModalCard = common_1.createSubcomponent('div')({
53
54
  displayName: 'Modal.Card',
@@ -1 +1 @@
1
- {"version":3,"file":"ModalHeading.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalHeading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAKtD,MAAM,WAAW,iBAAkB,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;CAAG;AAQvF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;EAMvB,CAAC"}
1
+ {"version":3,"file":"ModalHeading.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalHeading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAKtD,MAAM,WAAW,iBAAkB,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;CAAG;AAWvF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;EAMvB,CAAC"}
@@ -39,11 +39,12 @@ var hooks_1 = require("./hooks");
39
39
  var ResponsiveModalHeading = common_1.styled(popup_1.Popup.Heading)(function (_a) {
40
40
  var _b;
41
41
  var theme = _a.theme;
42
- return (_b = {},
43
- _b[theme.canvas.breakpoints.down('s')] = {
42
+ var canvasTheme = common_1.getCanvasTheme(theme);
43
+ return _b = {},
44
+ _b[canvasTheme.breakpoints.down('s')] = {
44
45
  marginBottom: tokens_1.space.zero,
45
46
  },
46
- _b);
47
+ _b;
47
48
  });
48
49
  exports.ModalHeading = common_1.createSubcomponent('h2')({
49
50
  displayName: 'Modal.Heading',
@@ -1 +1 @@
1
- {"version":3,"file":"ModalOverlay.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAM,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAG/D,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;CAAG;AA4CtD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;OAQ1B,CAAC"}
1
+ {"version":3,"file":"ModalOverlay.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAAM,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAG/D,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;CAAG;AA+CtD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;OAQ1B,CAAC"}
@@ -49,7 +49,8 @@ var Container = styled_1.default(layout_1.Box)({
49
49
  var ResponsiveContainer = styled_1.default('div')(function (_a) {
50
50
  var _b;
51
51
  var theme = _a.theme;
52
- return (_b = {
52
+ var canvasTheme = common_1.getCanvasTheme(theme);
53
+ return _b = {
53
54
  maxHeight: '100vh',
54
55
  display: 'flex',
55
56
  position: 'absolute',
@@ -59,10 +60,10 @@ var ResponsiveContainer = styled_1.default('div')(function (_a) {
59
60
  alignItems: 'center',
60
61
  height: '100vh'
61
62
  },
62
- _b[theme.canvas.breakpoints.down('s')] = {
63
+ _b[canvasTheme.breakpoints.down('s')] = {
63
64
  alignItems: 'end',
64
65
  },
65
- _b);
66
+ _b;
66
67
  });
67
68
  exports.ModalOverlay = common_1.createSubcomponent('div')({
68
69
  displayName: 'Modal.Overlay',
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBarList.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAMxD,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG,CACzC,SAAQ,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC;IACrE;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IAC1E;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAWD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAyB,CAAC;AAEvD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBxB,CAAC"}
1
+ {"version":3,"file":"ActionBarList.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAMxD,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG,CACzC,SAAQ,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC;IACrE;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IAC1E;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAcD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAyB,CAAC;AAEvD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBxB,CAAC"}
@@ -22,21 +22,22 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import * as React from 'react';
24
24
  import { commonColors, colors, space } from '@workday/canvas-kit-react/tokens';
25
- import { createSubcomponent, styled, } from '@workday/canvas-kit-react/common';
25
+ import { createSubcomponent, getCanvasTheme, styled, } from '@workday/canvas-kit-react/common';
26
26
  import { HStack } from '@workday/canvas-kit-react/layout';
27
27
  import { useOverflowListMeasure, useListRenderItems } from '@workday/canvas-kit-react/collection';
28
28
  import { useActionBarModel } from './useActionBarModel';
29
29
  var ResponsiveHStack = styled(HStack)(function (_a) {
30
30
  var _b;
31
31
  var theme = _a.theme;
32
- return (_b = {},
33
- _b[theme.canvas.breakpoints.down('s')] = {
32
+ var canvasTheme = getCanvasTheme(theme);
33
+ return _b = {},
34
+ _b[canvasTheme.breakpoints.down('s')] = {
34
35
  padding: space.s,
35
36
  '> *': {
36
37
  flex: 1,
37
38
  },
38
39
  },
39
- _b);
40
+ _b;
40
41
  });
41
42
  export var useActionBarList = useOverflowListMeasure;
42
43
  export var ActionBarList = createSubcomponent('div')({
@@ -10,7 +10,7 @@ export interface TertiaryButtonProps extends Themeable, BaseButtonProps {
10
10
  */
11
11
  variant?: 'inverse' | undefined;
12
12
  /**
13
- * There are three button sizes: `extraSmall`, `small`, and `medium`.
13
+ * There are four button sizes: `extraSmall`, `small`, `medium`, and `large`.
14
14
  * If no size is provided, it will default to `medium`.
15
15
  *
16
16
  * @default 'medium'
@@ -0,0 +1,28 @@
1
+ import { CanvasTheme } from '@workday/canvas-kit-react/common';
2
+ import { Theme } from '@emotion/react';
3
+ /**
4
+ * Use this function when you have access to `theme` in styled components.
5
+ * This function ensures that a theme is defined via a proxy and allows access to properties on the theme object.
6
+ * @param theme Any partial or full theme object.
7
+ * @returns a theme object if it is defined, otherwise it will fall back on using defaultCanvasTheme
8
+ * @example
9
+ * const ResponsiveContainer = styled('div')(({theme}) => {
10
+ * const canvas = getCanvasTheme(theme);
11
+ * return {
12
+ * maxHeight: '100vh',
13
+ * display: 'flex',
14
+ * position: 'absolute',
15
+ * left: 0,
16
+ * top: 0,
17
+ * justifyContent: 'center',
18
+ * alignItems: 'center',
19
+ * height: '100vh',
20
+ * [canvas.breakpoints.down('s')]: {
21
+ * alignItems: 'end',
22
+ * },
23
+ * };
24
+ *});
25
+ */
26
+ export declare function getCanvasTheme(theme?: any): CanvasTheme;
27
+ export declare function useCanvasTheme(themeOverride?: Theme): CanvasTheme;
28
+ //# sourceMappingURL=getCanvasTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCanvasTheme.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/getCanvasTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAC,KAAK,EAAW,MAAM,gBAAgB,CAAC;AAI/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,KAAK,GAAE,GAAQ,GAAG,WAAW,CAK3D;AAED,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,KAAK,eAInD"}
@@ -0,0 +1,37 @@
1
+ import { useTheme } from '@emotion/react';
2
+ import { getObjectProxy } from './getObjectProxy';
3
+ import { defaultCanvasTheme } from './theme';
4
+ /**
5
+ * Use this function when you have access to `theme` in styled components.
6
+ * This function ensures that a theme is defined via a proxy and allows access to properties on the theme object.
7
+ * @param theme Any partial or full theme object.
8
+ * @returns a theme object if it is defined, otherwise it will fall back on using defaultCanvasTheme
9
+ * @example
10
+ * const ResponsiveContainer = styled('div')(({theme}) => {
11
+ * const canvas = getCanvasTheme(theme);
12
+ * return {
13
+ * maxHeight: '100vh',
14
+ * display: 'flex',
15
+ * position: 'absolute',
16
+ * left: 0,
17
+ * top: 0,
18
+ * justifyContent: 'center',
19
+ * alignItems: 'center',
20
+ * height: '100vh',
21
+ * [canvas.breakpoints.down('s')]: {
22
+ * alignItems: 'end',
23
+ * },
24
+ * };
25
+ *});
26
+ */
27
+ export function getCanvasTheme(theme) {
28
+ if (theme === void 0) { theme = {}; }
29
+ // prettier-ignore
30
+ //@ts-ignore
31
+ var windowTheme = typeof window !== 'undefined' && window.workday && window.workday.canvas && window.workday.canvas.theme;
32
+ return getObjectProxy(theme.canvas || windowTheme || {}, defaultCanvasTheme);
33
+ }
34
+ export function useCanvasTheme(themeOverride) {
35
+ var theme = useTheme();
36
+ return getCanvasTheme(themeOverride || theme);
37
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The functions gets a new object proxy. This is used for theme to ensure regardless of a partial theme object
3
+ * there will be a fallback theme object so that properties aren't undefined regardless of the `target` object.
4
+ * This function will also handle nested properties.
5
+ * @param target Any custom theme object
6
+ * @param fallback A fallback theme object
7
+ */
8
+ export declare function getObjectProxy<T extends {}>(target: unknown, fallback: T): T;
9
+ //# sourceMappingURL=getObjectProxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getObjectProxy.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/getObjectProxy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,cAAc,CAAC,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAe5E"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The functions gets a new object proxy. This is used for theme to ensure regardless of a partial theme object
3
+ * there will be a fallback theme object so that properties aren't undefined regardless of the `target` object.
4
+ * This function will also handle nested properties.
5
+ * @param target Any custom theme object
6
+ * @param fallback A fallback theme object
7
+ */
8
+ /* eslint-disable compat/compat */ // TODO: Revisit eslint rules that are no longer needed now that we don't support IE11
9
+ export function getObjectProxy(target, fallback) {
10
+ return new Proxy(target, {
11
+ get: function (target, prop) {
12
+ if (typeof fallback[prop] === 'object' && typeof target[prop] === 'object') {
13
+ return getObjectProxy(target[prop] || {}, fallback[prop]);
14
+ }
15
+ else if (target[prop] !== undefined) {
16
+ return target[prop];
17
+ }
18
+ else {
19
+ return fallback[prop];
20
+ }
21
+ },
22
+ ownKeys: function (target) {
23
+ return Object.keys(fallback);
24
+ },
25
+ });
26
+ }
@@ -5,4 +5,6 @@ export { default as styled, StyleRewriteFn } from './styled';
5
5
  export * from './theme';
6
6
  export * from './useTheme';
7
7
  export * from './useIsRTL';
8
+ export * from './getCanvasTheme';
9
+ export * from './getObjectProxy';
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,OAAO,IAAI,MAAM,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAC3D,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,OAAO,IAAI,MAAM,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAC3D,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
@@ -5,3 +5,5 @@ export { default as styled } from './styled';
5
5
  export * from './theme';
6
6
  export * from './useTheme';
7
7
  export * from './useIsRTL';
8
+ export * from './getCanvasTheme';
9
+ export * from './getObjectProxy';
@@ -1 +1 @@
1
- {"version":3,"file":"ModalCard.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAItD,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;CAAG;AAWjF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;EAMpB,CAAC"}
1
+ {"version":3,"file":"ModalCard.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAItD,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;CAAG;AAcjF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;EAMpB,CAAC"}
@@ -10,22 +10,23 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import * as React from 'react';
13
- import { createSubcomponent, styled, } from '@workday/canvas-kit-react/common';
13
+ import { createSubcomponent, styled, getCanvasTheme, } from '@workday/canvas-kit-react/common';
14
14
  import { space } from '@workday/canvas-kit-react/tokens';
15
15
  import { Popup } from '@workday/canvas-kit-react/popup';
16
16
  import { useModalCard, useModalModel } from './hooks';
17
17
  var ResponsiveModalCard = styled(Popup.Card)(function (_a) {
18
18
  var _b;
19
19
  var theme = _a.theme;
20
- return (_b = {
20
+ var canvasTheme = getCanvasTheme(theme);
21
+ return _b = {
21
22
  margin: space.xl
22
23
  },
23
- _b[theme.canvas.breakpoints.down('s')] = {
24
+ _b[canvasTheme.breakpoints.down('s')] = {
24
25
  margin: space.s,
25
26
  padding: space.xxs,
26
27
  borderRadius: space.m,
27
28
  },
28
- _b);
29
+ _b;
29
30
  });
30
31
  export var ModalCard = createSubcomponent('div')({
31
32
  displayName: 'Modal.Card',
@@ -1 +1 @@
1
- {"version":3,"file":"ModalHeading.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalHeading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAKtD,MAAM,WAAW,iBAAkB,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;CAAG;AAQvF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;EAMvB,CAAC"}
1
+ {"version":3,"file":"ModalHeading.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalHeading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAKtD,MAAM,WAAW,iBAAkB,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;CAAG;AAWvF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;EAMvB,CAAC"}
@@ -10,18 +10,19 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import * as React from 'react';
13
- import { createSubcomponent, styled, } from '@workday/canvas-kit-react/common';
13
+ import { createSubcomponent, getCanvasTheme, styled, } from '@workday/canvas-kit-react/common';
14
14
  import { Popup } from '@workday/canvas-kit-react/popup';
15
15
  import { space } from '@workday/canvas-kit-react/tokens';
16
16
  import { useModalHeading, useModalModel } from './hooks';
17
17
  var ResponsiveModalHeading = styled(Popup.Heading)(function (_a) {
18
18
  var _b;
19
19
  var theme = _a.theme;
20
- return (_b = {},
21
- _b[theme.canvas.breakpoints.down('s')] = {
20
+ var canvasTheme = getCanvasTheme(theme);
21
+ return _b = {},
22
+ _b[canvasTheme.breakpoints.down('s')] = {
22
23
  marginBottom: space.zero,
23
24
  },
24
- _b);
25
+ _b;
25
26
  });
26
27
  export var ModalHeading = createSubcomponent('h2')({
27
28
  displayName: 'Modal.Heading',
@@ -1 +1 @@
1
- {"version":3,"file":"ModalOverlay.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAM,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAG/D,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;CAAG;AA4CtD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;OAQ1B,CAAC"}
1
+ {"version":3,"file":"ModalOverlay.d.ts","sourceRoot":"","sources":["../../../../modal/lib/ModalOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAAM,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAG/D,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;CAAG;AA+CtD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;OAQ1B,CAAC"}
@@ -15,7 +15,7 @@ var __assign = (this && this.__assign) || function () {
15
15
  };
16
16
  import React from 'react';
17
17
  import ReactDOM from 'react-dom';
18
- import { createSubcomponent, createElemPropsHook, useWindowSize, useForkRef, } from '@workday/canvas-kit-react/common';
18
+ import { createSubcomponent, createElemPropsHook, useWindowSize, useForkRef, getCanvasTheme, } from '@workday/canvas-kit-react/common';
19
19
  import { usePopupModel, usePopupStack } from '@workday/canvas-kit-react/popup';
20
20
  import { keyframes } from '@emotion/react';
21
21
  import styled from '@emotion/styled';
@@ -43,7 +43,8 @@ var Container = styled(Box)({
43
43
  var ResponsiveContainer = styled('div')(function (_a) {
44
44
  var _b;
45
45
  var theme = _a.theme;
46
- return (_b = {
46
+ var canvasTheme = getCanvasTheme(theme);
47
+ return _b = {
47
48
  maxHeight: '100vh',
48
49
  display: 'flex',
49
50
  position: 'absolute',
@@ -53,10 +54,10 @@ var ResponsiveContainer = styled('div')(function (_a) {
53
54
  alignItems: 'center',
54
55
  height: '100vh'
55
56
  },
56
- _b[theme.canvas.breakpoints.down('s')] = {
57
+ _b[canvasTheme.breakpoints.down('s')] = {
57
58
  alignItems: 'end',
58
59
  },
59
- _b);
60
+ _b;
60
61
  });
61
62
  export var ModalOverlay = createSubcomponent('div')({
62
63
  displayName: 'Modal.Overlay',
@@ -5,6 +5,7 @@ import {
5
5
  ExtractProps,
6
6
  StyledType,
7
7
  styled,
8
+ getCanvasTheme,
8
9
  } from '@workday/canvas-kit-react/common';
9
10
  import {space} from '@workday/canvas-kit-react/tokens';
10
11
  import {Popup} from '@workday/canvas-kit-react/popup';
@@ -13,14 +14,17 @@ import {useModalCard, useModalModel} from './hooks';
13
14
 
14
15
  export interface ModalCardProps extends ExtractProps<typeof Popup.Card, never> {}
15
16
 
16
- const ResponsiveModalCard = styled(Popup.Card)<ModalCardProps & StyledType>(({theme}) => ({
17
- margin: space.xl,
18
- [theme.canvas.breakpoints.down('s')]: {
19
- margin: space.s, // 16px all around margin on smaller screen sizes
20
- padding: space.xxs, // brings total padding between edge and content to 16px
21
- borderRadius: space.m, // 24px border radius on smaller devices.
22
- },
23
- }));
17
+ const ResponsiveModalCard = styled(Popup.Card)<ModalCardProps & StyledType>(({theme}) => {
18
+ const canvasTheme = getCanvasTheme(theme);
19
+ return {
20
+ margin: space.xl,
21
+ [canvasTheme.breakpoints.down('s')]: {
22
+ margin: space.s, // 16px all around margin on smaller screen sizes
23
+ padding: space.xxs, // brings total padding between edge and content to 16px
24
+ borderRadius: space.m, // 24px border radius on smaller devices.
25
+ },
26
+ };
27
+ });
24
28
 
25
29
  export const ModalCard = createSubcomponent('div')({
26
30
  displayName: 'Modal.Card',
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import {
4
4
  createSubcomponent,
5
5
  ExtractProps,
6
+ getCanvasTheme,
6
7
  styled,
7
8
  StyledType,
8
9
  } from '@workday/canvas-kit-react/common';
@@ -13,11 +14,14 @@ import {useModalHeading, useModalModel} from './hooks';
13
14
 
14
15
  export interface ModalHeadingProps extends ExtractProps<typeof Popup.Heading, never> {}
15
16
 
16
- const ResponsiveModalHeading = styled(Popup.Heading)<ModalHeadingProps & StyledType>(({theme}) => ({
17
- [theme.canvas.breakpoints.down('s')]: {
18
- marginBottom: space.zero,
19
- },
20
- }));
17
+ const ResponsiveModalHeading = styled(Popup.Heading)<ModalHeadingProps & StyledType>(({theme}) => {
18
+ const canvasTheme = getCanvasTheme(theme);
19
+ return {
20
+ [canvasTheme.breakpoints.down('s')]: {
21
+ marginBottom: space.zero,
22
+ },
23
+ };
24
+ });
21
25
 
22
26
  export const ModalHeading = createSubcomponent('h2')({
23
27
  displayName: 'Modal.Heading',
@@ -7,6 +7,7 @@ import {
7
7
  StyledType,
8
8
  useWindowSize,
9
9
  useForkRef,
10
+ getCanvasTheme,
10
11
  } from '@workday/canvas-kit-react/common';
11
12
  import {usePopupModel, usePopupStack} from '@workday/canvas-kit-react/popup';
12
13
  import {keyframes} from '@emotion/react';
@@ -44,19 +45,22 @@ const Container = styled(Box)<StyledType>({
44
45
  // positioning, but seems to when using flexbox centering. This messes up Popper calculations inside
45
46
  // the Modal. The centering container forces a "center" pixel calculation by making sure the width
46
47
  // is always an even number
47
- const ResponsiveContainer = styled('div')(({theme}) => ({
48
- maxHeight: '100vh',
49
- display: 'flex',
50
- position: 'absolute',
51
- left: 0,
52
- top: 0,
53
- justifyContent: 'center',
54
- alignItems: 'center',
55
- height: '100vh',
56
- [theme.canvas.breakpoints.down('s')]: {
57
- alignItems: 'end',
58
- },
59
- }));
48
+ const ResponsiveContainer = styled('div')(({theme}) => {
49
+ const canvasTheme = getCanvasTheme(theme);
50
+ return {
51
+ maxHeight: '100vh',
52
+ display: 'flex',
53
+ position: 'absolute',
54
+ left: 0,
55
+ top: 0,
56
+ justifyContent: 'center',
57
+ alignItems: 'center',
58
+ height: '100vh',
59
+ [canvasTheme.breakpoints.down('s')]: {
60
+ alignItems: 'end',
61
+ },
62
+ };
63
+ });
60
64
 
61
65
  export const ModalOverlay = createSubcomponent('div')({
62
66
  displayName: 'Modal.Overlay',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "8.1.1",
3
+ "version": "8.1.3",
4
4
  "description": "The parent module that contains all Workday Canvas Kit React components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -49,7 +49,7 @@
49
49
  "@emotion/styled": "^11.6.0",
50
50
  "@popperjs/core": "^2.5.4",
51
51
  "@workday/canvas-colors-web": "^2.0.0",
52
- "@workday/canvas-kit-popup-stack": "^8.1.1",
52
+ "@workday/canvas-kit-popup-stack": "^8.1.3",
53
53
  "@workday/canvas-system-icons-web": "^3.0.0",
54
54
  "@workday/design-assets-types": "^0.2.8",
55
55
  "chroma-js": "^2.1.0",
@@ -67,5 +67,5 @@
67
67
  "@workday/canvas-accent-icons-web": "^3.0.0",
68
68
  "@workday/canvas-applet-icons-web": "^2.0.0"
69
69
  },
70
- "gitHead": "142045dfa3915080b3740ac1964e835e85308461"
70
+ "gitHead": "cc1ee95c5ffd25476b8e0229000b72e7c966dad4"
71
71
  }