Skip to content

Commit

Permalink
fix: support optional props border tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed May 31, 2024
1 parent 04c3377 commit 8d6fac5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/witty-glasses-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Allow border type tokens to be empty, every property is optional.
4 changes: 4 additions & 0 deletions __tests__/common/transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,10 @@ describe('common', () => {
}),
).to.equal('5px dashed #000000');
});

it('allows every property to be optional', () => {
expect(borderTransform({})).to.equal('solid');
});
});

describe('strokeStyle/css/shorthand', () => {
Expand Down
4 changes: 3 additions & 1 deletion lib/common/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,9 @@ export default {
if (typeof style === 'object') {
style = 'dashed';
}
return `${width} ${style} ${color}`;
return `${width ? `${width} ` : ''}${style ? `${style}` : 'solid'}${
color ? ` ${color}` : ''
}`;
},
},

Expand Down

0 comments on commit 8d6fac5

Please sign in to comment.