Skip to content

Commit 41b5b56

Browse files
fix: add ref to TextInput and adjust styles
1 parent 8b8bb59 commit 41b5b56

File tree

11 files changed

+48
-19
lines changed

11 files changed

+48
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "turbo run build",
99
"changeset": "changeset",
1010
"version-packages": "changeset version",
11-
"release": "turbo run build --filter=packages/docs && changeset publish"
11+
"release": "turbo run build --filter=!docs && changeset publish"
1212
},
1313
"devDependencies": {
1414
"@changesets/cli": "^2.26.2",

packages/docs/src/stories/TextInput.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const Disabled: StoryObj<TextInputProps> = {
3131

3232
export const WithPrefix: StoryObj<TextInputProps> = {
3333
args: {
34-
prefix: 'cal.com/'
34+
prefix: 'cal.com/',
35+
placeholder: 'your-username'
3536
}
3637
};

packages/react/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @ign-ui/react
22

3+
## 2.0.1
4+
5+
### Patch Changes
6+
7+
- Add option to pass reference to TextInput and adjust some styles
8+
39
## 2.0.0
410

511
### Major Changes

packages/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ign-ui/react",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

packages/react/src/components/Avatar/styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { styled } from '../../styles'
44
export const AvatarContainer = styled(Avatar.Root, {
55
borderRadius: '$full',
66
display: 'inline-block',
7-
width: '$12',
8-
height: '$12',
7+
width: '$16',
8+
height: '$16',
99
overflow: 'hidden',
1010
})
1111

packages/react/src/components/Box.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ComponentProps } from 'react'
22
import { styled } from '../styles'
33

44
export const Box = styled('div', {
5-
padding: '$4',
5+
padding: '$6',
66
borderRadius: '$sm',
77
backgroundColor: '$gray800',
88
border: '1px solid $gray600',

packages/react/src/components/Button.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export const Button = styled('button', {
2828
cursor: 'not-allowed',
2929
},
3030

31+
'&:focus': {
32+
boxShadow: '0 0 0 2px $color$gray100',
33+
},
34+
3135
variants: {
3236
variant: {
3337
primary: {

packages/react/src/components/Checkbox/styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const CheckboxContainer = styled(Checkbox.Root, {
2020
backgroundColor: '$ignite300',
2121
},
2222

23-
'&:focus': {
23+
'&:focus, &[data-state="checked"]': {
2424
border: '2px solid $ignite300',
2525
},
2626
})
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
import { ComponentProps } from 'react'
1+
import { ComponentProps, ElementRef, forwardRef } from 'react'
22
import { Input, Prefix, TextInputContainer } from './styles'
33

44
export interface TextInputProps extends ComponentProps<typeof Input> {
55
prefix?: string
66
}
77

8-
export function TextInput({ prefix, ...props }: TextInputProps) {
9-
return (
10-
<TextInputContainer>
11-
{!!prefix && <Prefix>{prefix}</Prefix>}
12-
<Input {...props} />
13-
</TextInputContainer>
14-
)
15-
}
8+
export const TextInput = forwardRef<ElementRef<typeof Input>, TextInputProps>(
9+
({ prefix, ...props }: TextInputProps, ref) => {
10+
return (
11+
<TextInputContainer>
12+
{!!prefix && <Prefix>{prefix}</Prefix>}
13+
<Input ref={ref} {...props} />
14+
</TextInputContainer>
15+
)
16+
},
17+
)
1618

1719
TextInput.displayName = 'TextInput'

packages/react/src/components/TextInput/styles.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@ import { styled } from '../../styles'
22

33
export const TextInputContainer = styled('div', {
44
backgroundColor: '$gray900',
5-
padding: '$3 $4',
65
borderRadius: '$sm',
76
boxSizing: 'border-box',
87
border: '2px solid $gray900',
98
display: 'flex',
10-
alignItems: 'baseline',
9+
alignItems: 'center',
10+
11+
variants: {
12+
size: {
13+
sm: {
14+
padding: '$2 $3',
15+
},
16+
md: {
17+
padding: '$3 $4',
18+
},
19+
},
20+
},
1121

1222
'&:has(input:focus)': {
1323
borderColor: '$ignite300',
@@ -17,6 +27,10 @@ export const TextInputContainer = styled('div', {
1727
opacity: 0.5,
1828
cursor: 'not-allowed',
1929
},
30+
31+
defaultVariants: {
32+
size: 'md',
33+
},
2034
})
2135

2236
export const Prefix = styled('span', {
@@ -43,7 +57,7 @@ export const Input = styled('input', {
4357
cursor: 'not-allowed',
4458
},
4559

46-
'&:placeholder': {
60+
'&::placeholder': {
4761
color: '$gray400',
4862
},
4963
})

0 commit comments

Comments
 (0)