Skip to content

Commit

Permalink
feat(react): add component input
Browse files Browse the repository at this point in the history
  • Loading branch information
johancs.mm@gmail.com committed May 4, 2024
1 parent fca0019 commit 1da826a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/components/react/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export * from './separator'

export * from './checkbox'
export * from './dialog'
export * from './input'
4 changes: 4 additions & 0 deletions packages/components/react/input/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Input from './input'

export type { Comp as InputComponent, Props as InputProps } from './input'
export { Input }
21 changes: 21 additions & 0 deletions packages/components/react/input/input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { cn, input } from '@openui-org/theme'
import * as React from 'react'

export interface Comp extends HTMLInputElement {}
export interface Props extends React.InputHTMLAttributes<HTMLInputElement> {}

const Input = React.forwardRef<Comp, Props>(({ className, type, ...props }, ref) => {
return (
<input
type={type}
className={cn(input(), className)}
ref={ref}
{...props}
/>
)
},
)

Input.displayName = 'Input'

export default Input
24 changes: 0 additions & 24 deletions packages/components/react/src/components/input.tsx

This file was deleted.

1 change: 1 addition & 0 deletions packages/theme/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ export * from './separator'

export * from './checkbox'
export * from './dialog'
export * from './input'
11 changes: 11 additions & 0 deletions packages/theme/src/components/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { cva } from 'class-variance-authority'

/**
* Input wrapper **Class Variants** component
*
* const styles = input({})
*
* @example
* <Input className={styles())} />
*/
export const input = cva('flex h-10 w-full rounded-medium px-3 py-2 text-small file:border-0 file:bg-transparent file:text-small file:font-medium disabled:cursor-not-allowed disabled:opacity-50')

0 comments on commit 1da826a

Please sign in to comment.