mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-26 20:12:38 +08:00
feat(input): add new input component and update eslint config
Add new custom input component to replace antd and heroui inputs Update eslint config to enforce using the new input component
This commit is contained in:
parent
14706ec4d7
commit
13cacaba7f
@ -148,15 +148,16 @@ export default defineConfig([
|
||||
paths: [
|
||||
{
|
||||
name: 'antd',
|
||||
importNames: ['Flex', 'Switch', 'message', 'Button', 'Tooltip'],
|
||||
importNames: ['Flex', 'Switch', 'message', 'Button', 'Tooltip', 'Input'],
|
||||
message:
|
||||
'❌ Do not import this component from antd. Use our custom components instead: import { ... } from "@cherrystudio/ui"'
|
||||
},
|
||||
// {
|
||||
// name: '@heroui/react',
|
||||
// message:
|
||||
// '❌ Do not import components from heroui directly. Use our wrapped components instead: import { ... } from "@cherrystudio/ui"'
|
||||
// }
|
||||
{
|
||||
name: '@heroui/react',
|
||||
importNames: ['Input'],
|
||||
message:
|
||||
'❌ Do not import components from heroui directly. Use our wrapped components instead: import { ... } from "@cherrystudio/ui"'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -84,6 +84,7 @@ export { Sortable } from './composites/Sortable'
|
||||
export * from './primitives/button'
|
||||
export * from './primitives/command'
|
||||
export * from './primitives/dialog'
|
||||
export * from './primitives/input'
|
||||
export * from './primitives/popover'
|
||||
export * from './primitives/radioGroup'
|
||||
export * from './primitives/shadcn-io/dropzone'
|
||||
|
||||
20
packages/ui/src/components/primitives/input.tsx
Normal file
20
packages/ui/src/components/primitives/input.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import { cn } from '@cherrystudio/ui/utils'
|
||||
import * as React from 'react'
|
||||
|
||||
function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
||||
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
||||
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Input }
|
||||
Loading…
Reference in New Issue
Block a user