-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: type * feat: setting scales
- Loading branch information
Showing
11 changed files
with
674 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/graphic-walker/src/components/ui/number-input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as React from 'react'; | ||
|
||
import { cn } from '@/utils'; | ||
import { useRefControledState } from '@/hooks'; | ||
|
||
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {} | ||
|
||
const NumberInput = React.forwardRef<HTMLInputElement, InputProps>(({ className, type, value, onChange, ...props }, ref) => { | ||
const [uncontrolledValue, setUncontrolledValue] = useRefControledState(value); | ||
|
||
return ( | ||
<input | ||
type="number" | ||
className={cn( | ||
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50', | ||
className | ||
)} | ||
ref={ref} | ||
value={uncontrolledValue} | ||
onChange={(e) => { | ||
setUncontrolledValue(e.target.value); | ||
}} | ||
onBlur={(e) => { | ||
onChange?.(e); | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}); | ||
NumberInput.displayName = 'NumberInput'; | ||
|
||
export { NumberInput }; |
Oops, something went wrong.