Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui-library): #971 align casing of tokens (part 1) #1111

Merged
merged 23 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 2 additions & 69 deletions packages/figma-design-tokens/config/style-dictionary.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,6 @@ const themes = require('./themes.cjs');
const { registerTransforms } = sdTransforms;
registerTransforms(StyleDictionaryPackage);

const semanticTypes = ['buttons', 'selectables', 'forms', 'global', 'ui'];

const componentTypes = [
'ButtonGroup',
'ButtonText',
'ButtonIcon',
'CaptionComponent',
'CaptionGroup',
'Checkbox',
'Counter',
'Divider',
'FormLabel',
'Icon',
'IconDropdown',
'InputIcon',
'InputFieldNumber',
'InputFieldText',
'Loader',
'RadioGroup',
'Select',
'Slider',
'StepperButton',
'StepperCombo',
'Radio',
'TabBar',
'TextArea',
'ToggleSwitch',
'Tooltip',
];

StyleDictionaryPackage.registerFormat({
name: 'custom/format/semanticTokens',
formatter: ({ dictionary, file }) => {
Expand Down Expand Up @@ -73,41 +43,6 @@ const getStyleDictionaryConfig = (theme) => {
'input/tokens/cmp/*.json',
],
platforms: {
/*
scss: {
transforms: [
'attribute/cti',
'name/cti/kebab',
'transform/resolveMath',
'transform/size/px',
'transform/font-to-rem',
],
prefix: 'blr',
buildPath: '../ui-library/src/foundation/_tokens-generated/',
files: [
...types.map((type) => ({
format: 'css/variables',
destination: `_${kebabCase(type)}.generated.scss`,
filter: (token) => token.attributes.category === 'core' && token.attributes.type === type,
})),
{
format: 'css/variables',
destination: `_color.generated.scss`,
filter: (token) => {
const isCore = token.attributes.category === 'core';
const isColor = token.attributes.type === 'color';

// We want to filter out some base color values that the final colors are made of.
// We don't need them as css variables.
const isLgt = token.attributes.item === 'LGT';
const isSat = ['HUE', 'SAT'].includes(token.attributes.subitem);

return isCore && isColor && !isSat && !isLgt;
},
},
],
},
*/
js: {
transforms: [
'attribute/cti',
Expand All @@ -123,16 +58,14 @@ const getStyleDictionaryConfig = (theme) => {
format: 'custom/format/semanticTokens',
destination: `__semantic-tokens.${theme}.generated.mjs`,
filter: (token) => {
const typeToFilter = semanticTypes;
return typeToFilter.includes(token.attributes.type);
return token.attributes.category === 'sem';
},
},
{
format: 'custom/format/componentTokens',
destination: `__component-tokens.${theme}.generated.mjs`,
filter: (token) => {
const typeToFilter = componentTypes;
return typeToFilter.includes(token.attributes.type) && token.type !== 'componentConfig';
return token.attributes.category === 'cmp' && token.type !== 'componentConfig';
},
},
{
Expand Down
659 changes: 331 additions & 328 deletions packages/figma-design-tokens/input/tokens/$themes.json

Large diffs are not rendered by default.

Loading
Loading