Skip to content

Commit cc812e2

Browse files
Amarnath510Ravki
andauthored
feat: wcag 2.1 new color system (#5055)
* feat: update requires token colors with wcag 2.1 standards * chore: generate hooks for all sds files * chore: add styling hooks path * chore: update styling hooks version * chore: update styling hook path * chore: add license * chore: update with new styling-hooks version * chore: wcag 2.1 color update for combo, datepic, form-element * chore(wcag-2.1): sass tokens replaced with appropriate sds tokens * chore: wcag 2.1 color update for btn-icons, chk-btn, dtables, due-picklist * chore(wcag-2.1): chunk2-partb.sass tokens replaced with appropriate sds tokens * chore(wcag-2.1): chunk2-partc.sass tokens replaced with appropriate sds tokens * chore(wcag-2.1): chunk3-parta. sass tokens replaced with appropriate slds tokens * chore(wcag-2.1): chunk3-partb. sass tokens replaced with appropriate slds tokens * chore(wcag-2.1): chunk3-partc.sass tokens replaced with appropriate slds hooks * chore(wcag-2.1): chunk3-partd. sass tokens replaced with appropriate slds hooks * chore(wcag-2.1): chunk3-parte. sass tokens replaced with appropriate slds hooks * chore(wcag-2.1): replacing palette notation hooks to colors * chore(wcag2.1): update tokens with hooks for buttons, tabs, checkbox-button-group, lookups * chore(wcag2.1): update tokens with hooks for tabs * chore(components): update all color tokens in resp components * chore(components): update tokens with styling hooks and add fallbacks * chore: add fallback to stylinghooks * chore: add fallback to stylinghooks - new set * chore: add fallback to stylinghooks - new set with neutral-95 * chore: wcag2.1 add fallback values for styling hooks - neutral-95 * chore: wcag2.1 add fallback values for styling hooks - neutral-100 * chore(tokens): revert wcag tokens changes in SLDS * chore(tokens): add tokens to lwc file * chore: update missing fallback values * chore: add scss extension to props and tokens * chore: fix linter issue while generating template * chore: revert lwc hooks from the gulpfile * chore: update more tokens with styling hooks * chore: replace brand n theme tokens with shooks * chore: update missing token * chore: update class name to slds-wcag * chore: replace hard coded hex colors with appropriate slds hooks * chore: typo error fix for a slds hook * chore: revert brand related tokens to previous state * chore: revert brand token update with slds * chore: fix gulpfile for build Co-authored-by: Ravi Kiran Kudupudi <[email protected]>
1 parent ace0d32 commit cc812e2

File tree

173 files changed

+1300
-1160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+1300
-1160
lines changed

RELEASENOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
## Release 2.20.0 - Upcoming
55

66
- Updated background colors for Standard and Actions icons
7+
- Added two new dependencies for SLDS global styling hooks generation,
8+
- `@salesforce-ux/sds-styling-aliases`
9+
- `@salesforce-ux/sds-styling-hooks`
10+
- Updated `gulpfile` to include SLDS global hooks generation as part of build and dist jobs
11+
- Updated design tokens in every component and utility with SLDS global styling hooks (except Brand related tokens)
712

813
## Release 2.19.0 - August 11, 2022
914

formats/custom-props.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const theo = require('theo');
2+
3+
const SLDS = 'slds';
4+
const SCOPED_NAMESPACE = 'slds-wcag';
5+
6+
theo.registerFormat(
7+
'custom-props.scss',
8+
`.${SCOPED_NAMESPACE} {
9+
{{#each props as |prop|}}
10+
{{#if prop.comment}}/* {{{prop.comment}}} */{{/if}}
11+
--${SLDS}-{{#eq prop.scope "global"}}g-{{/eq}}{{#eq prop.scope "shared"}}s-{{/eq}}{{kebabcase prop.name}}: {{#eq prop.type "string"}}"{{/eq}}{{{prop.value}}}{{#eq prop.type "string"}}"{{/eq}};
12+
{{/each}}
13+
}
14+
`,
15+
);

gulpfile.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ gulp.task('generate:tokens:components:imports', tokens.componentsImports);
9393
// Generate package specific tokens
9494
gulp.task('generate:tokens:package', tokens.packages);
9595

96+
// Generate SLDS Styling Hooks
97+
gulp.task('generate:stylingHooks', tokens.stylingHooks);
98+
9699
// Generate all tokens - [Primitive, Component Specific, Package]
97100
gulp.task(
98101
'generate:tokens:all',
@@ -102,7 +105,8 @@ gulp.task(
102105
),
103106
withName('generate:tokens:primitive')(tokens.copyDesignPrimitiveTokens),
104107
withName('generate:tokens:components:imports')(tokens.componentsImports),
105-
withName('generate:tokens:package')(tokens.packages)
108+
withName('generate:tokens:package')(tokens.packages),
109+
withName('generate:stylingHooks')(tokens.stylingHooks)
106110
)
107111
);
108112

package-lock.json

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
"@salesforce-ux/postcss-annotations-parser": "0.1.1",
5555
"@salesforce-ux/postcss-css-variable-value": "0.2.0",
5656
"@salesforce-ux/scss-parser-aura": "^3.1.1",
57+
"@salesforce-ux/sds-styling-aliases": "0.2.3",
58+
"@salesforce-ux/sds-styling-hooks": "1.0.0-alpha.1",
5759
"@storybook/addon-a11y": "^5.3.21",
5860
"@storybook/addon-backgrounds": "^5.3.21",
5961
"@storybook/addon-docs": "^5.3.21",

scripts/gulp/generate/tokens.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import through from 'through2';
1111
import Vinyl from 'vinyl';
1212
import paths from '../../helpers/paths';
1313

14+
require('../../../formats/custom-props');
15+
1416
// Some transforms are commented out because the use cases are lacking
1517
let formatTransforms = _({
1618
web: [
@@ -35,6 +37,29 @@ let formatTransforms = _({
3537
.flatten()
3638
.value();
3739

40+
const formatsForSdsProps = [
41+
{
42+
format: 'json',
43+
transform: 'web',
44+
},
45+
{
46+
format: 'common.js',
47+
transform: 'web',
48+
},
49+
{
50+
format: 'module.js',
51+
transform: 'web',
52+
},
53+
{
54+
format: 'custom-props.scss',
55+
transform: 'raw',
56+
},
57+
{
58+
format: 'raw.json',
59+
transform: 'raw',
60+
}
61+
];
62+
3863
// Pipe through every YAML file and generate a platform specific token file
3964
export const packages = (done) => {
4065
const convert = ({ name, transform }, done) =>
@@ -51,6 +76,21 @@ export const packages = (done) => {
5176
async.each(formatTransforms, convert, done);
5277
};
5378

79+
export const stylingHooks = (done) => {
80+
const convert = ({ format, transform }, done) =>
81+
gulp
82+
.src(path.resolve(paths.sdsStylingHooksProps, '*.json'))
83+
.pipe(
84+
gulpTheo({
85+
transform: { type: transform },
86+
format: { type: format }
87+
})
88+
)
89+
.pipe(gulp.dest(path.resolve(paths.designTokens, 'dist')))
90+
.on('finish', done);
91+
async.each(formatsForSdsProps, convert, done);
92+
};
93+
5494
// Pipe through every component specific YAML file and generate a file of imports
5595
//
5696
// components.yml

scripts/helpers/paths.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ module.exports = {
3737
node_modules,
3838
'@salesforce-ux/design-system-primitive-tokens'
3939
),
40-
40+
sdsStylingHooksProps: path.resolve(
41+
node_modules,
42+
'@salesforce-ux/sds-styling-hooks/src/props'
43+
),
4144
icons: path.resolve(
4245
node_modules,
4346
'@salesforce-ux/icons/dist/salesforce-lightning-design-system-icons'

ui/_init.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// Reserved for mixins, functions, variables
99
// Importing this file MUST NOT output any CSS
1010
@use "sass:math";
11+
@import 'styling-hooks';
1112
@import 'design-tokens';
1213
@import 'config';
1314
@import 'vendor/deprecate';

ui/_styling-hooks.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
2+
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
3+
4+
// ----------------------------------------------------------------------------
5+
// Imports
6+
// ----------------------------------------------------------------------------
7+
8+
@import '../design-tokens/dist/palettes.custom-props';
9+
@import '../design-tokens/dist/colors.custom-props';

ui/components/accordion/base/_index.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
.slds-accordion__list-item {
2323
border-top-width: var(--slds-c-accordion-sizing-border, var(--sds-c-accordion-sizing-border, $border-width-thin));
2424
border-top-style: solid;
25-
border-top-color: var(--slds-c-accordion-color-border, var(--sds-c-accordion-color-border, $color-border));
25+
border-top-color: var(--slds-c-accordion-color-border, var(--sds-c-accordion-color-border, var(--slds-g-color-border-base-1, #{$color-border})));
2626

2727
&:first-child {
2828
border-top: 0;
@@ -68,7 +68,8 @@
6868
display: flex;
6969
flex-grow: 1;
7070
min-width: 0;
71-
color: var(--slds-c-accordion-heading-text-color, var(--sds-c-accordion-heading-text-color, $color-text-default));
71+
color: var(--slds-c-accordion-heading-text-color, var(--sds-c-accordion-heading-text-color,
72+
var(--slds-g-color-neutral-base-10, #{$color-text-default})));
7273
font-size: var(--slds-c-accordion-heading-font-size, var(--sds-c-accordion-heading-font-size, $var-font-size-5));
7374
line-height: var(--slds-c-accordion-heading-line-height, var(--sds-c-accordion-heading-line-height, $line-height-heading));
7475

0 commit comments

Comments
 (0)