Skip to content

Commit

Permalink
fix: remove empty string in value (#1832)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemoya authored Jan 3, 2025
1 parent 6392cb6 commit 593b6c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
3 changes: 1 addition & 2 deletions core/vibes/soul/form/input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Input = React.forwardRef<
label?: string;
errors?: string[];
}
>(({ prepend, label, className, required, errors, value, ...rest }, ref) => {
>(({ prepend, label, className, required, errors, ...rest }, ref) => {
const id = React.useId();

return (
Expand All @@ -36,7 +36,6 @@ export const Input = React.forwardRef<
)}
id={id}
ref={ref}
value={value ?? ''}
/>
</div>
{errors?.map((error) => <FieldError key={error}>{error}</FieldError>)}
Expand Down
18 changes: 8 additions & 10 deletions core/vibes/soul/form/number-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export const NumberInput = React.forwardRef<
errors,
decrementLabel,
incrementLabel,
disabled,
value,
disabled = false,
...rest
},
ref,
Expand All @@ -40,8 +39,8 @@ export const NumberInput = React.forwardRef<
aria-label={decrementLabel}
className={clsx(
'group rounded-l-lg p-3.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary',
disabled === false && 'hover:bg-contrast-100/50',
disabled === true && 'cursor-not-allowed opacity-30',
!disabled && 'hover:bg-contrast-100/50',
disabled && 'cursor-not-allowed opacity-30',
)}
disabled={disabled}
onClick={(e) => {
Expand All @@ -56,7 +55,7 @@ export const NumberInput = React.forwardRef<
<Minus
className={clsx(
'text-contrast-300 transition-colors duration-300',
disabled === false && 'group-hover:text-foreground',
!disabled && 'group-hover:text-foreground',
)}
size={18}
strokeWidth={1.5}
Expand All @@ -66,20 +65,19 @@ export const NumberInput = React.forwardRef<
{...rest}
className={clsx(
'w-8 flex-1 select-none justify-center text-center [appearance:textfield] focus-visible:outline-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none',
disabled === true && 'cursor-not-allowed opacity-30',
disabled && 'cursor-not-allowed opacity-30',
)}
disabled={disabled}
id={id}
ref={ref}
type="number"
value={value ?? ''}
/>
<button
aria-label={incrementLabel}
className={clsx(
'group rounded-r-lg p-3.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary',
disabled === false && 'hover:bg-contrast-100/50',
disabled === true && 'cursor-not-allowed opacity-30',
!disabled && 'hover:bg-contrast-100/50',
disabled && 'cursor-not-allowed opacity-30',
)}
disabled={disabled}
onClick={(e) => {
Expand All @@ -94,7 +92,7 @@ export const NumberInput = React.forwardRef<
<Plus
className={clsx(
'text-contrast-300 transition-colors duration-300',
disabled === false && 'group-hover:text-foreground',
!disabled && 'group-hover:text-foreground',
)}
size={18}
strokeWidth={1.5}
Expand Down

0 comments on commit 593b6c9

Please sign in to comment.