@workday/canvas-kit-react 14.2.0-0050-next.0 → 14.2.0-0052-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/lib/CanvasProvider.tsx +4 -1
- package/common/lib/theming/types.ts +0 -3
- package/common/lib/theming/useTheme.ts +5 -2
- package/dist/commonjs/common/lib/CanvasProvider.d.ts +4 -1
- package/dist/commonjs/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +1 -1
- package/dist/commonjs/common/lib/theming/types.d.ts +0 -3
- package/dist/commonjs/common/lib/theming/types.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/useTheme.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/useTheme.js +5 -2
- package/dist/es6/common/lib/CanvasProvider.d.ts +4 -1
- package/dist/es6/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +1 -1
- package/dist/es6/common/lib/theming/types.d.ts +0 -3
- package/dist/es6/common/lib/theming/types.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/useTheme.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/useTheme.js +5 -2
- package/package.json +5 -5
|
@@ -6,7 +6,10 @@ import {getCache, maybeWrapCSSVariables, createStyles} from '@workday/canvas-kit
|
|
|
6
6
|
|
|
7
7
|
export interface CanvasProviderProps {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* ⚠️ Only use this prop if you intent to to theme a part of your application that is different from global theming.
|
|
10
|
+
* For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#global-vs-scoped-theming).
|
|
11
|
+
*
|
|
12
|
+
* While we support theme overrides, we advise to use global theming via CSS Variables.
|
|
10
13
|
*/
|
|
11
14
|
theme?: PartialEmotionCanvasTheme;
|
|
12
15
|
}
|
|
@@ -269,9 +269,6 @@ export type PartialCanvasTheme = RecursivePartial<CanvasTheme>;
|
|
|
269
269
|
*/
|
|
270
270
|
export type PartialCanvasThemePalette = RecursivePartial<CanvasThemePalette>;
|
|
271
271
|
|
|
272
|
-
/**
|
|
273
|
-
* @deprecated ⚠️ `PartialEmotionCanvasTheme` is deprecated. In previous versions of Canvas Kit, we allowed teams to pass a theme object, this supported [Emotion's theming](https://emotion.sh/docs/theming). Now that we're shifting to a global theming approach based on CSS variables, we advise to no longer using the theme prop. For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
274
|
-
*/
|
|
275
272
|
export type PartialEmotionCanvasTheme = {canvas?: PartialCanvasTheme};
|
|
276
273
|
|
|
277
274
|
declare module '@emotion/react' {
|
|
@@ -12,11 +12,14 @@ import {cssVar} from '@workday/canvas-kit-styling';
|
|
|
12
12
|
import {base} from '@workday/canvas-tokens-web';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Attempt to match chroma-js's darken/brighten behavior using OKLCH.
|
|
16
|
+
* Chroma's darken(1) reduces LAB lightness by ~18 units (out of 100).
|
|
17
|
+
* In OKLCH, lightness is 0-1, so we scale: value/100 * 0.18 = value * 0.0018
|
|
16
18
|
* @deprecated ⚠️ `shiftColor` is deprecated and will be removed in a future major version. While we work on an algorithm for color shifting, you can use [`oklch from`](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch) to generate a palette.
|
|
17
19
|
*/
|
|
18
20
|
const shiftColor = (color: string, value: number) => {
|
|
19
|
-
|
|
21
|
+
const shift = Math.abs(value) * 0.0018;
|
|
22
|
+
return `oklch(from ${color} calc(l ${value > 0 ? '+' : '-'} ${shift}) c h)`;
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
const generatePalette = (
|
|
@@ -2,7 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { PartialEmotionCanvasTheme } from './theming';
|
|
3
3
|
export interface CanvasProviderProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* ⚠️ Only use this prop if you intent to to theme a part of your application that is different from global theming.
|
|
6
|
+
* For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#global-vs-scoped-theming).
|
|
7
|
+
*
|
|
8
|
+
* While we support theme overrides, we advise to use global theming via CSS Variables.
|
|
6
9
|
*/
|
|
7
10
|
theme?: PartialEmotionCanvasTheme;
|
|
8
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasProvider.d.ts","sourceRoot":"","sources":["../../../../common/lib/CanvasProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAqB,yBAAyB,EAAW,MAAM,WAAW,CAAC;AAIlF,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"CanvasProvider.d.ts","sourceRoot":"","sources":["../../../../common/lib/CanvasProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAqB,yBAAyB,EAAW,MAAM,WAAW,CAAC;AAIlF,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,yBAAyB,CAAC;CACnC;AAYD;;GAEG;AACH,eAAO,MAAM,eAAe,QA0C1B,CAAC;AAEH,eAAO,MAAM,uBAAuB,UAI3B,yBAAyB,GAAG,SAAS,aACjC,MAAM,cAAc,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC7C,CAAC;AAEF,eAAO,MAAM,cAAc,kCAIxB,mBAAmB,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,4CAgBzD,CAAC"}
|
|
@@ -18,7 +18,7 @@ const mappedKeys = {
|
|
|
18
18
|
/**
|
|
19
19
|
* If you wish to reset the theme to the default, apply this class on the CanvasProvider.
|
|
20
20
|
*/
|
|
21
|
-
exports.defaultBranding = (0, canvas_kit_styling_1.createStyles)({ name: "
|
|
21
|
+
exports.defaultBranding = (0, canvas_kit_styling_1.createStyles)({ name: "cqln", styles: "--cnvs-brand-common-alert-inner:var(--cnvs-base-palette-amber-400);--cnvs-brand-common-alert-outer:var(--cnvs-base-palette-amber-500);--cnvs-brand-common-error-inner:var(--cnvs-base-palette-red-500);--cnvs-brand-common-focus-outline:var(--cnvs-base-palette-blue-500);--cnvs-brand-neutral-accent:var(--cnvs-base-palette-neutral-0);--cnvs-brand-neutral-darkest:var(--cnvs-base-palette-slate-800);--cnvs-brand-neutral-dark:var(--cnvs-base-palette-slate-700);--cnvs-brand-neutral-base:var(--cnvs-base-palette-slate-600);--cnvs-brand-neutral-light:var(--cnvs-base-palette-slate-200);--cnvs-brand-neutral-lighter:var(--cnvs-base-palette-slate-50);--cnvs-brand-neutral-lightest:var(--cnvs-base-palette-slate-25);--cnvs-brand-success-accent:var(--cnvs-base-palette-neutral-0);--cnvs-brand-success-darkest:var(--cnvs-base-palette-green-800);--cnvs-brand-success-dark:var(--cnvs-base-palette-green-700);--cnvs-brand-success-base:var(--cnvs-base-palette-green-600);--cnvs-brand-success-light:var(--cnvs-base-palette-green-200);--cnvs-brand-success-lighter:var(--cnvs-base-palette-green-50);--cnvs-brand-success-lightest:var(--cnvs-base-palette-green-25);--cnvs-brand-error-accent:var(--cnvs-base-palette-neutral-0);--cnvs-brand-error-darkest:var(--cnvs-base-palette-red-800);--cnvs-brand-error-dark:var(--cnvs-base-palette-red-700);--cnvs-brand-error-base:var(--cnvs-base-palette-red-600);--cnvs-brand-error-light:var(--cnvs-base-palette-red-200);--cnvs-brand-error-lighter:var(--cnvs-base-palette-red-50);--cnvs-brand-error-lightest:var(--cnvs-base-palette-red-25);--cnvs-brand-alert-accent:var(--cnvs-base-palette-neutral-900);--cnvs-brand-alert-darkest:var(--cnvs-base-palette-amber-600);--cnvs-brand-alert-dark:var(--cnvs-base-palette-amber-500);--cnvs-brand-alert-base:var(--cnvs-base-palette-amber-400);--cnvs-brand-alert-light:var(--cnvs-base-palette-amber-200);--cnvs-brand-alert-lighter:var(--cnvs-base-palette-amber-50);--cnvs-brand-alert-lightest:var(--cnvs-base-palette-amber-25);--cnvs-brand-primary-accent:var(--cnvs-base-palette-neutral-0);--cnvs-brand-primary-darkest:var(--cnvs-base-palette-blue-800);--cnvs-brand-primary-dark:var(--cnvs-base-palette-blue-700);--cnvs-brand-primary-base:var(--cnvs-base-palette-blue-600);--cnvs-brand-primary-light:var(--cnvs-base-palette-blue-200);--cnvs-brand-primary-lighter:var(--cnvs-base-palette-blue-50);--cnvs-brand-primary-lightest:var(--cnvs-base-palette-blue-25);--cnvs-brand-gradient-primary:linear-gradient(90deg, var(--cnvs-brand-primary-base) 0%, var(--cnvs-brand-primary-dark) 100%);" });
|
|
22
22
|
const useCanvasThemeToCssVars = (
|
|
23
23
|
/**
|
|
24
24
|
* @deprecated ⚠️ `theme` is deprecated. In previous versions of Canvas Kit, we allowed teams to pass a theme object, this supported [Emotion's theming](https://emotion.sh/docs/theming). Now that we're shifting to a global theming approach based on CSS variables, we advise to no longer using the theme prop. For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
@@ -259,9 +259,6 @@ export type PartialCanvasTheme = RecursivePartial<CanvasTheme>;
|
|
|
259
259
|
* @deprecated ⚠️ `PartialCanvasThemePalette` is deprecated. In previous versions of Canvas Kit, we allowed teams to pass a theme object, this supported [Emotion's theming](https://emotion.sh/docs/theming). Now that we're shifting to a global theming approach based on CSS variables, we advise to no longer using the theme prop. For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
260
260
|
*/
|
|
261
261
|
export type PartialCanvasThemePalette = RecursivePartial<CanvasThemePalette>;
|
|
262
|
-
/**
|
|
263
|
-
* @deprecated ⚠️ `PartialEmotionCanvasTheme` is deprecated. In previous versions of Canvas Kit, we allowed teams to pass a theme object, this supported [Emotion's theming](https://emotion.sh/docs/theming). Now that we're shifting to a global theming approach based on CSS variables, we advise to no longer using the theme prop. For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
264
|
-
*/
|
|
265
262
|
export type PartialEmotionCanvasTheme = {
|
|
266
263
|
canvas?: PartialCanvasTheme;
|
|
267
264
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAEnE;;GAEG;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW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AAyB,EAE1B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useTheme.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,kBAAkB,EAClB,yBAAyB,EAE1B,MAAM,SAAS,CAAC;AAyEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,yBAAyB,GAAG,kBAAkB,CAY9E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,yBAAyB,GAAG,kBAAkB,CAkB9E"}
|
|
@@ -8,11 +8,14 @@ const index_1 = require("./index");
|
|
|
8
8
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
9
9
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Attempt to match chroma-js's darken/brighten behavior using OKLCH.
|
|
12
|
+
* Chroma's darken(1) reduces LAB lightness by ~18 units (out of 100).
|
|
13
|
+
* In OKLCH, lightness is 0-1, so we scale: value/100 * 0.18 = value * 0.0018
|
|
12
14
|
* @deprecated ⚠️ `shiftColor` is deprecated and will be removed in a future major version. While we work on an algorithm for color shifting, you can use [`oklch from`](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch) to generate a palette.
|
|
13
15
|
*/
|
|
14
16
|
const shiftColor = (color, value) => {
|
|
15
|
-
|
|
17
|
+
const shift = Math.abs(value) * 0.0018;
|
|
18
|
+
return `oklch(from ${color} calc(l ${value > 0 ? '+' : '-'} ${shift}) c h)`;
|
|
16
19
|
};
|
|
17
20
|
const generatePalette = (key, palette) => {
|
|
18
21
|
const colorPalette = palette === null || palette === void 0 ? void 0 : palette[key];
|
|
@@ -2,7 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { PartialEmotionCanvasTheme } from './theming';
|
|
3
3
|
export interface CanvasProviderProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* ⚠️ Only use this prop if you intent to to theme a part of your application that is different from global theming.
|
|
6
|
+
* For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#global-vs-scoped-theming).
|
|
7
|
+
*
|
|
8
|
+
* While we support theme overrides, we advise to use global theming via CSS Variables.
|
|
6
9
|
*/
|
|
7
10
|
theme?: PartialEmotionCanvasTheme;
|
|
8
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasProvider.d.ts","sourceRoot":"","sources":["../../../../common/lib/CanvasProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAqB,yBAAyB,EAAW,MAAM,WAAW,CAAC;AAIlF,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"CanvasProvider.d.ts","sourceRoot":"","sources":["../../../../common/lib/CanvasProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAqB,yBAAyB,EAAW,MAAM,WAAW,CAAC;AAIlF,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,yBAAyB,CAAC;CACnC;AAYD;;GAEG;AACH,eAAO,MAAM,eAAe,QA0C1B,CAAC;AAEH,eAAO,MAAM,uBAAuB,UAI3B,yBAAyB,GAAG,SAAS,aACjC,MAAM,cAAc,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC7C,CAAC;AAEF,eAAO,MAAM,cAAc,kCAIxB,mBAAmB,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,4CAgBzD,CAAC"}
|
|
@@ -15,7 +15,7 @@ const mappedKeys = {
|
|
|
15
15
|
/**
|
|
16
16
|
* If you wish to reset the theme to the default, apply this class on the CanvasProvider.
|
|
17
17
|
*/
|
|
18
|
-
export const defaultBranding = createStyles({ name: "
|
|
18
|
+
export const defaultBranding = createStyles({ name: "cqln", styles: "--cnvs-brand-common-alert-inner:var(--cnvs-base-palette-amber-400);--cnvs-brand-common-alert-outer:var(--cnvs-base-palette-amber-500);--cnvs-brand-common-error-inner:var(--cnvs-base-palette-red-500);--cnvs-brand-common-focus-outline:var(--cnvs-base-palette-blue-500);--cnvs-brand-neutral-accent:var(--cnvs-base-palette-neutral-0);--cnvs-brand-neutral-darkest:var(--cnvs-base-palette-slate-800);--cnvs-brand-neutral-dark:var(--cnvs-base-palette-slate-700);--cnvs-brand-neutral-base:var(--cnvs-base-palette-slate-600);--cnvs-brand-neutral-light:var(--cnvs-base-palette-slate-200);--cnvs-brand-neutral-lighter:var(--cnvs-base-palette-slate-50);--cnvs-brand-neutral-lightest:var(--cnvs-base-palette-slate-25);--cnvs-brand-success-accent:var(--cnvs-base-palette-neutral-0);--cnvs-brand-success-darkest:var(--cnvs-base-palette-green-800);--cnvs-brand-success-dark:var(--cnvs-base-palette-green-700);--cnvs-brand-success-base:var(--cnvs-base-palette-green-600);--cnvs-brand-success-light:var(--cnvs-base-palette-green-200);--cnvs-brand-success-lighter:var(--cnvs-base-palette-green-50);--cnvs-brand-success-lightest:var(--cnvs-base-palette-green-25);--cnvs-brand-error-accent:var(--cnvs-base-palette-neutral-0);--cnvs-brand-error-darkest:var(--cnvs-base-palette-red-800);--cnvs-brand-error-dark:var(--cnvs-base-palette-red-700);--cnvs-brand-error-base:var(--cnvs-base-palette-red-600);--cnvs-brand-error-light:var(--cnvs-base-palette-red-200);--cnvs-brand-error-lighter:var(--cnvs-base-palette-red-50);--cnvs-brand-error-lightest:var(--cnvs-base-palette-red-25);--cnvs-brand-alert-accent:var(--cnvs-base-palette-neutral-900);--cnvs-brand-alert-darkest:var(--cnvs-base-palette-amber-600);--cnvs-brand-alert-dark:var(--cnvs-base-palette-amber-500);--cnvs-brand-alert-base:var(--cnvs-base-palette-amber-400);--cnvs-brand-alert-light:var(--cnvs-base-palette-amber-200);--cnvs-brand-alert-lighter:var(--cnvs-base-palette-amber-50);--cnvs-brand-alert-lightest:var(--cnvs-base-palette-amber-25);--cnvs-brand-primary-accent:var(--cnvs-base-palette-neutral-0);--cnvs-brand-primary-darkest:var(--cnvs-base-palette-blue-800);--cnvs-brand-primary-dark:var(--cnvs-base-palette-blue-700);--cnvs-brand-primary-base:var(--cnvs-base-palette-blue-600);--cnvs-brand-primary-light:var(--cnvs-base-palette-blue-200);--cnvs-brand-primary-lighter:var(--cnvs-base-palette-blue-50);--cnvs-brand-primary-lightest:var(--cnvs-base-palette-blue-25);--cnvs-brand-gradient-primary:linear-gradient(90deg, var(--cnvs-brand-primary-base) 0%, var(--cnvs-brand-primary-dark) 100%);" });
|
|
19
19
|
export const useCanvasThemeToCssVars = (
|
|
20
20
|
/**
|
|
21
21
|
* @deprecated ⚠️ `theme` is deprecated. In previous versions of Canvas Kit, we allowed teams to pass a theme object, this supported [Emotion's theming](https://emotion.sh/docs/theming). Now that we're shifting to a global theming approach based on CSS variables, we advise to no longer using the theme prop. For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
@@ -259,9 +259,6 @@ export type PartialCanvasTheme = RecursivePartial<CanvasTheme>;
|
|
|
259
259
|
* @deprecated ⚠️ `PartialCanvasThemePalette` is deprecated. In previous versions of Canvas Kit, we allowed teams to pass a theme object, this supported [Emotion's theming](https://emotion.sh/docs/theming). Now that we're shifting to a global theming approach based on CSS variables, we advise to no longer using the theme prop. For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
260
260
|
*/
|
|
261
261
|
export type PartialCanvasThemePalette = RecursivePartial<CanvasThemePalette>;
|
|
262
|
-
/**
|
|
263
|
-
* @deprecated ⚠️ `PartialEmotionCanvasTheme` is deprecated. In previous versions of Canvas Kit, we allowed teams to pass a theme object, this supported [Emotion's theming](https://emotion.sh/docs/theming). Now that we're shifting to a global theming approach based on CSS variables, we advise to no longer using the theme prop. For more information, view our [Theming Docs](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs#-preferred-approach-v14).
|
|
264
|
-
*/
|
|
265
262
|
export type PartialEmotionCanvasTheme = {
|
|
266
263
|
canvas?: PartialCanvasTheme;
|
|
267
264
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAEnE;;GAEG;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED;;;G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AO,EAEL,kBAAkB,EAClB,yBAAyB,EAE1B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useTheme.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,kBAAkB,EAClB,yBAAyB,EAE1B,MAAM,SAAS,CAAC;AAyEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,yBAAyB,GAAG,kBAAkB,CAY9E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,yBAAyB,GAAG,kBAAkB,CAkB9E"}
|
|
@@ -5,11 +5,14 @@ import { defaultCanvasTheme, } from './index';
|
|
|
5
5
|
import { cssVar } from '@workday/canvas-kit-styling';
|
|
6
6
|
import { base } from '@workday/canvas-tokens-web';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Attempt to match chroma-js's darken/brighten behavior using OKLCH.
|
|
9
|
+
* Chroma's darken(1) reduces LAB lightness by ~18 units (out of 100).
|
|
10
|
+
* In OKLCH, lightness is 0-1, so we scale: value/100 * 0.18 = value * 0.0018
|
|
9
11
|
* @deprecated ⚠️ `shiftColor` is deprecated and will be removed in a future major version. While we work on an algorithm for color shifting, you can use [`oklch from`](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch) to generate a palette.
|
|
10
12
|
*/
|
|
11
13
|
const shiftColor = (color, value) => {
|
|
12
|
-
|
|
14
|
+
const shift = Math.abs(value) * 0.0018;
|
|
15
|
+
return `oklch(from ${color} calc(l ${value > 0 ? '+' : '-'} ${shift}) c h)`;
|
|
13
16
|
};
|
|
14
17
|
const generatePalette = (key, palette) => {
|
|
15
18
|
const colorPalette = palette === null || palette === void 0 ? void 0 : palette[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "14.2.0-
|
|
3
|
+
"version": "14.2.0-0052-next.0",
|
|
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",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@popperjs/core": "^2.5.4",
|
|
53
53
|
"@tanstack/react-virtual": "^3.13.9",
|
|
54
54
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
55
|
-
"@workday/canvas-kit-popup-stack": "^14.2.0-
|
|
56
|
-
"@workday/canvas-kit-preview-react": "^14.2.0-
|
|
57
|
-
"@workday/canvas-kit-styling": "^14.2.0-
|
|
55
|
+
"@workday/canvas-kit-popup-stack": "^14.2.0-0052-next.0",
|
|
56
|
+
"@workday/canvas-kit-preview-react": "^14.2.0-0052-next.0",
|
|
57
|
+
"@workday/canvas-kit-styling": "^14.2.0-0052-next.0",
|
|
58
58
|
"@workday/canvas-system-icons-web": "^3.0.36",
|
|
59
59
|
"@workday/canvas-tokens-web": "^3.1.1",
|
|
60
60
|
"@workday/design-assets-types": "^0.2.10",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
70
70
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "b1fc1f892afd637a9840c355759407aa0b579878"
|
|
73
73
|
}
|