Skip to content

Commit

Permalink
feat: Add action tokens to PrimaryButton with brand base as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel.carrera committed Dec 19, 2024
1 parent 66db2d0 commit e71fff8
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 54 deletions.
2 changes: 1 addition & 1 deletion modules/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@workday/canvas-kit-react": "^12.1.15",
"@workday/canvas-kit-styling": "^12.1.15",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.0.1",
"@workday/canvas-tokens-web": "^2.1.0",
"markdown-to-jsx": "^7.2.0",
"react-syntax-highlighter": "^15.5.0",
"ts-node": "^10.9.1"
Expand Down
2 changes: 1 addition & 1 deletion modules/labs-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@workday/canvas-kit-react": "^12.1.15",
"@workday/canvas-kit-styling": "^12.1.15",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.0.1",
"@workday/canvas-tokens-web": "^2.1.0",
"@workday/design-assets-types": "^0.2.8",
"chroma-js": "^2.2.0",
"lodash.flatten": "^4.4.0",
Expand Down
2 changes: 1 addition & 1 deletion modules/preview-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@workday/canvas-kit-react": "^12.1.15",
"@workday/canvas-kit-styling": "^12.1.15",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.0.1",
"@workday/canvas-tokens-web": "^2.1.0",
"@workday/design-assets-types": "^0.2.8"
},
"devDependencies": {
Expand Down
42 changes: 27 additions & 15 deletions modules/react/button/lib/PrimaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,50 @@ const primaryButtonStencil = createStencil({
extends: buttonStencil,
base: {
// Base Styles
[buttonStencil.vars.background]: brand.primary.base,
[buttonStencil.vars.background]: cssVar(brand.action.base, brand.primary.base),
[buttonStencil.vars.borderRadius]: system.shape.round,
[buttonStencil.vars.label]: brand.primary.accent,
[systemIconStencil.vars.color]: cssVar(buttonColorPropVars.default.icon, brand.primary.accent),
[buttonStencil.vars.label]: cssVar(brand.action.accent, brand.primary.accent),
[systemIconStencil.vars.color]: cssVar(
buttonColorPropVars.default.icon,
cssVar(brand.action.accent, brand.primary.accent)
),
// Focus Styles
'&:focus-visible, &.focus': {
[buttonStencil.vars.background]: brand.primary.base,
[buttonStencil.vars.label]: brand.primary.accent,
[buttonStencil.vars.background]: cssVar(brand.action.base, brand.primary.base),
[buttonStencil.vars.label]: cssVar(brand.action.accent, brand.primary.accent),
[buttonStencil.vars.boxShadowInner]: system.color.border.inverse,
[buttonStencil.vars.boxShadowOuter]: brand.common.focusOutline,
[systemIconStencil.vars.color]: cssVar(buttonColorPropVars.focus.icon, brand.primary.accent),
[systemIconStencil.vars.color]: cssVar(
buttonColorPropVars.focus.icon,
cssVar(brand.action.accent, brand.primary.accent)
),
},
// Hover Styles
'&:hover, &.hover': {
[buttonStencil.vars.background]: brand.primary.dark,
[buttonStencil.vars.label]: brand.primary.accent,
[systemIconStencil.vars.color]: cssVar(buttonColorPropVars.hover.icon, brand.primary.accent),
[buttonStencil.vars.background]: cssVar(brand.action.dark, brand.primary.dark),
[buttonStencil.vars.label]: cssVar(brand.action.accent, brand.primary.accent),
[systemIconStencil.vars.color]: cssVar(
buttonColorPropVars.hover.icon,
cssVar(brand.action.accent, brand.primary.accent)
),
},
// Active Styles
'&:active, &.active': {
[buttonStencil.vars.background]: brand.primary.darkest,
[buttonStencil.vars.label]: brand.primary.accent,
[systemIconStencil.vars.color]: cssVar(buttonColorPropVars.active.icon, brand.primary.accent),
[buttonStencil.vars.background]: cssVar(brand.action.darkest, brand.primary.darkest),
[buttonStencil.vars.label]: cssVar(brand.action.accent, brand.primary.accent),
[systemIconStencil.vars.color]: cssVar(
buttonColorPropVars.active.icon,
cssVar(brand.action.accent, brand.primary.accent)
),
},
// Disabled Styles
'&:disabled, &.disabled': {
[buttonStencil.vars.background]: brand.primary.base,
[buttonStencil.vars.label]: brand.primary.accent,
[buttonStencil.vars.background]: cssVar(brand.action.base, brand.primary.base),
[buttonStencil.vars.label]: cssVar(brand.action.accent, brand.primary.accent),
[buttonStencil.vars.opacity]: system.opacity.disabled,
[systemIconStencil.vars.color]: cssVar(
buttonColorPropVars.disabled.icon,
brand.primary.accent
cssVar(brand.action.accent, brand.primary.accent)
),
},
},
Expand Down
6 changes: 6 additions & 0 deletions modules/react/common/lib/CanvasProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ const defaultBranding = createStyles({
[brand.primary.base]: base.blueberry400,
[brand.primary.light]: base.blueberry200,
[brand.primary.lightest]: base.blueberry100,
[brand.action.accent]: base.frenchVanilla100,
[brand.action.darkest]: base.blueberry600,
[brand.action.dark]: base.blueberry500,
[brand.action.base]: base.blueberry400,
[brand.action.light]: base.blueberry200,
[brand.action.lightest]: base.blueberry100,
[brand.gradient
.primary]: `linear-gradient(90deg, ${brand.primary.base} 0%, ${brand.primary.dark} 100%)`,
});
Expand Down
2 changes: 1 addition & 1 deletion modules/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@workday/canvas-kit-popup-stack": "^12.1.15",
"@workday/canvas-kit-styling": "^12.1.15",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.0.1",
"@workday/canvas-tokens-web": "^2.1.0",
"@workday/design-assets-types": "^0.2.8",
"chroma-js": "^2.2.0",
"csstype": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion modules/styling-transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@emotion/serialize": "^1.0.2",
"@workday/canvas-kit-styling": "^12.1.15",
"@workday/canvas-tokens-web": "^2.0.1",
"@workday/canvas-tokens-web": "^2.1.0",
"stylis": "4.0.13",
"ts-node": "^10.9.1",
"typescript": "5.0"
Expand Down
2 changes: 1 addition & 1 deletion modules/styling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@emotion/styled": "^11.6.0",
"@workday/canvas-kit-react": "^12.1.15",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.0.1",
"@workday/canvas-tokens-web": "^2.1.0",
"typescript": "5.0"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"@workday/canvas-accent-icons-web": "^3.0.9",
"@workday/canvas-applet-icons-web": "^2.0.9",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.0.1",
"@workday/canvas-tokens-web": "^2.1.0",
"jest-environment-jsdom": "^29.7.0",
"ts-jest": "^29.2.4"
},
Expand Down
41 changes: 9 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6158,10 +6158,10 @@
dependencies:
"@workday/design-assets-types" "0.2.8"

"@workday/canvas-tokens-web@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@workday/canvas-tokens-web/-/canvas-tokens-web-2.0.1.tgz#b7d3df6849a869b0adf57e9b9ab924c6a4f778da"
integrity sha512-PRfhnqFEe08kjn0vQPicfHh5zCCIYgunnCLYfSpVkwBX1OZHEFvCpB0pmz67P3313sty0/BmYWgzPmv3VT9mkA==
"@workday/canvas-tokens-web@^2.1.0":
version "2.1.0"
resolved "https://registry.npmjs.org/@workday/canvas-tokens-web/-/canvas-tokens-web-2.1.0.tgz#3fa68416c003dd84a217909db556ab385360a34e"
integrity sha512-qDkhronvKRmautzHWLAlGYwI0UsrXmRN07EFCHPROFAbVglMdd1D3LIeP2ECtQ76qOcEVJM79vQJdwai4B9K7g==

"@workday/design-assets-types@0.2.10":
version "0.2.10"
Expand Down Expand Up @@ -15683,16 +15683,8 @@ string-replace-loader@^3.1.0:
loader-utils "^2.0.0"
schema-utils "^3.0.0"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3:
name string-width-cjs
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -15779,7 +15771,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand All @@ -15800,13 +15792,6 @@ strip-ansi@^6.0.0:
dependencies:
ansi-regex "^5.0.0"

strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -17002,7 +16987,8 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
name wrap-ansi-cjs
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -17020,15 +17006,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.0.1, wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit e71fff8

Please sign in to comment.