Skip to content

Commit

Permalink
chore: add inputmode prop, update changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgarciadev committed Dec 22, 2024
1 parent 6ae4db7 commit 3862259
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .changeset/cyan-donkeys-swim.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
"@nextui-org/input-otp": patch
"@nextui-org/shared-utils": patch
---

Fix virtual keyboard to display the keys based on allowedKeys(#4408)
10 changes: 6 additions & 4 deletions packages/components/input-otp/src/use-input-otp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export function useInputOtp(originalProps: UseInputOtpProps) {
containerClassName,
noScriptCSSFallback,
onChange,
inputMode,
...otherProps
} = props;

Expand Down Expand Up @@ -237,23 +238,24 @@ export function useInputOtp(originalProps: UseInputOtpProps) {
minLength: minLength ?? length,
textAlign,
ref: inputRef,
name: name,
value: value,
name,
value,
autoFocus,
onChange: setValue,
onBlur: chain(focusProps.onBlur, props?.onBlur),
onComplete: onComplete,
onComplete,
pushPasswordManagerStrategy,
pasteTransformer,
noScriptCSSFallback,
inputMode: isPatternNumeric(allowedKeys) ? "numeric" : "text",
inputMode: inputMode ?? (isPatternNumeric(allowedKeys) ? "numeric" : "text"),
containerClassName: slots.wrapper?.({class: clsx(classNames?.wrapper, containerClassName)}),
...props,
};

return otpProps;
},
[
inputMode,
isRequired,
isDisabled,
isReadOnly,
Expand Down

0 comments on commit 3862259

Please sign in to comment.