Skip to content

Commit

Permalink
fix: Add ref to TextInput component, fixed components styles, fixed s…
Browse files Browse the repository at this point in the history
…tyles folder location
  • Loading branch information
rcrdk committed Mar 12, 2024
1 parent c6e13c0 commit 5a9d8cf
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "turbo run build",
"changeset": "changeset",
"version-packages": "changeset version",
"release": "turbo run build --filter=@rcrdk-ignite-ui/docs && changeset publish"
"release": "turbo run build --filter=!docs && changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
Expand Down
1 change: 1 addition & 0 deletions packages/docs/src/stories/text-input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const Primary: StoryObj<TextInputProps> = {
export const WithPrefix: StoryObj<TextInputProps> = {
args: {
prefix: 'cal.com/',
placeholder: 'your-username',
},
}

Expand Down
8 changes: 8 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rcrdk-ignite-ui/react

## 2.0.1

### Patch Changes

- - Fixed components styles.
- Add ref to TextInput component.
- Fixed styles folder location.

## 2.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rcrdk-ignite-ui/react",
"version": "2.0.0",
"version": "2.0.1",
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/avatar/styles.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as Avatar from '@radix-ui/react-avatar'

import { styled } from '../../../styles'
import { styled } from '../../styles'

export const AvatarContainer = styled(Avatar.Root, {
borderRadius: '$full',
display: 'inline-block',
width: '$12',
height: '$12',
width: '$16',
height: '$16',
overflow: 'hidden',
})

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/box.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentProps, ElementType } from 'react'

import { styled } from '../../styles'
import { styled } from '../styles'

export const Box = styled('div', {
padding: '$6',
Expand Down
9 changes: 8 additions & 1 deletion packages/react/src/components/button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentProps, ElementType } from 'react'

import { styled } from '../../styles'
import { styled } from '../styles'

export const Button = styled('button', {
all: 'unset',
Expand All @@ -25,6 +25,10 @@ export const Button = styled('button', {
cursor: 'not-allowed',
},

'&:focus-visible': {
boxShadow: '0 0 0 2px $colors$gray8300, 0 0 0 4px $colors$ignite500',
},

svg: {
width: '$4',
height: '$4',
Expand Down Expand Up @@ -62,6 +66,9 @@ export const Button = styled('button', {
'&:disabled': {
color: '$gray600',
},
'&:focus-visible': {
boxShadow: '0 0 0 2px $colors$ignite500',
},
},
},

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/checkbox/styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Checkbox from '@radix-ui/react-checkbox'

import { keyframes, styled } from '../../../styles'
import { keyframes, styled } from '../../styles'

export const CheckboxContainer = styled(Checkbox.Root, {
all: 'unset',
Expand All @@ -26,7 +26,7 @@ export const CheckboxContainer = styled(Checkbox.Root, {
borderColor: '$ignite500',

'&:focus-visible': {
boxShadow: `0 0 0 1px var(--colors-gray800) inset`,
boxShadow: `0 0 0 1px $colors$gray900 inset`,
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/heading.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentProps, ElementType } from 'react'

import { styled } from '../../styles'
import { styled } from '../styles'

export const Heading = styled('h2', {
fontFamily: '$default',
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/multi-step/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from '../../../styles'
import { styled } from '../../styles'
import { Text } from '../text'

export const MultiStepContainer = styled('div', {})
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/text-area.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentProps, ElementType } from 'react'

import { styled } from '../../styles'
import { styled } from '../styles'

export const TextArea = styled('textarea', {
background: '$gray900',
Expand Down
21 changes: 12 additions & 9 deletions packages/react/src/components/text-input/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import { ComponentProps } from 'react'
import { ComponentProps, ElementRef, forwardRef } from 'react'

import { Input, Prefix, TextInputContainer } from './styles'

export interface TextInputProps extends ComponentProps<typeof Input> {
prefix?: string
containerProps?: ComponentProps<typeof TextInputContainer>
}

export function TextInput({ prefix, ...props }: TextInputProps) {
return (
<TextInputContainer>
{!!prefix && <Prefix>{prefix}</Prefix>}
<Input {...props} />
</TextInputContainer>
)
}
export const TextInput = forwardRef<ElementRef<typeof Input>, TextInputProps>(
({ prefix, containerProps, ...props }: TextInputProps, ref) => {
return (
<TextInputContainer {...containerProps}>
{!!prefix && <Prefix>{prefix}</Prefix>}
<Input ref={ref} {...props} />
</TextInputContainer>
)
},
)

TextInput.displayName = 'TextInput'
21 changes: 18 additions & 3 deletions packages/react/src/components/text-input/styles.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
import { styled } from '../../../styles'
import { styled } from '../../styles'

export const TextInputContainer = styled('div', {
background: '$gray900',
padding: '$3 $4',
borderRadius: '$sm',
boxSizing: 'border-box',
border: '2px solid $gray900',
display: 'flex',
alignItems: 'baseline',
alignItems: 'center',
cursor: 'text',

variants: {
size: {
small: {
padding: '$2 $3',
},
medium: {
padding: '$3 $4',
},
},
},

defaultVariants: {
size: 'medium',
},

'&:has(input:focus)': {
borderColor: '$ignite300',
},
Expand Down Expand Up @@ -43,5 +57,6 @@ export const Input = styled('input', {

'&::placeholder': {
color: '$gray400',
fontStyle: 'italic',
},
})
2 changes: 1 addition & 1 deletion packages/react/src/components/text.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentProps, ElementType } from 'react'

import { styled } from '../../styles'
import { styled } from '../styles'

export const Text = styled('p', {
fontFamily: '$default',
Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ export * from './components/text-input'
export * from './components/text-area'
export * from './components/checkbox'
export * from './components/multi-step'

export * from './styles'
File renamed without changes.

0 comments on commit 5a9d8cf

Please sign in to comment.