Skip to content

Commit

Permalink
feat: move tabular nums to variant
Browse files Browse the repository at this point in the history
  • Loading branch information
smeijer committed Jan 30, 2025
1 parent 9342408 commit 771e01e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-turkeys-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@darkmagic/react': minor
---

move tabular nums to a variant
8 changes: 6 additions & 2 deletions packages/react/src/components/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const StyledRoot = styled('div', {
fontFamily: 'inherit',
width: '100%',
WebkitTapHighlightColor: 'rgba(0,0,0,0)',
fontVariantNumeric: 'tabular-nums',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'space-between',
Expand All @@ -34,6 +33,11 @@ const StyledRoot = styled('div', {
'&:-webkit-autofill::first-line': { color: '$text-highlight' },

variants: {
numeric: {
true: {
fontVariantNumeric: 'tabular-nums',
},
},
size: {
sm: {
height: '$8',
Expand Down Expand Up @@ -67,7 +71,7 @@ const StyledInput = styled('input', {
width: '100%',
height: '100%',
WebkitTapHighlightColor: 'rgba(0,0,0,0)',
fontVariantNumeric: 'tabular-nums',
fontVariantNumeric: 'inherit',
backgroundColor: 'transparent',
color: 'inherit',
padding: '0 $1',
Expand Down
6 changes: 5 additions & 1 deletion packages/react/src/components/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const StyledTextArea = styled('textarea', {
width: '100%',
WebkitTapHighlightColor: 'rgba(0,0,0,0)',
boxShadow: 'none',
fontVariantNumeric: 'tabular-nums',
position: 'relative',
resize: 'none',
border: '1px solid transparent',
Expand All @@ -39,6 +38,11 @@ const StyledTextArea = styled('textarea', {
},

variants: {
numeric: {
true: {
fontVariantNumeric: 'tabular-nums',
},
},
size: {
xs: {
minHeight: '$10',
Expand Down
6 changes: 5 additions & 1 deletion packages/react/src/components/typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ const StyledTypography = styled('div', {
lineHeight: '1',
margin: '0',
fontWeight: 400,
fontVariantNumeric: 'tabular-nums',
display: 'block',

variants: {
numeric: {
true: {
fontVariantNumeric: 'tabular-nums',
},
},
noWrap: {
true: {
whiteSpace: 'nowrap',
Expand Down

0 comments on commit 771e01e

Please sign in to comment.