@uiwwsw/virtual-keyboard 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type Dispatch, type SetStateAction, type RefObject } from "react";
|
|
2
2
|
import type { VirtualInputHandle } from "./Input";
|
|
3
|
+
import type { InputPolicy } from "../types/inputPolicy";
|
|
3
4
|
interface VirtualInputContextValue {
|
|
4
5
|
inputRef: RefObject<VirtualInputHandle | null>;
|
|
5
6
|
isCompositionRef: RefObject<boolean | undefined>;
|
|
6
|
-
onFocus: (id: string, target?: HTMLElement | null) => void;
|
|
7
|
+
onFocus: (id: string, target?: HTMLElement | null, policy?: InputPolicy) => void;
|
|
7
8
|
onBlur: (e?: React.FocusEvent | boolean) => void;
|
|
8
9
|
focusId: string | undefined;
|
|
9
10
|
setHangulMode: Dispatch<SetStateAction<boolean>>;
|
|
@@ -19,6 +20,7 @@ interface VirtualInputContextValue {
|
|
|
19
20
|
selectionAdjusting: boolean;
|
|
20
21
|
toggleSelectionAdjust: () => void;
|
|
21
22
|
toggleKorean: () => void;
|
|
23
|
+
activeInputPolicy: Required<InputPolicy>;
|
|
22
24
|
}
|
|
23
25
|
export declare const VirtualInputContext: import("react").Context<VirtualInputContextValue | null>;
|
|
24
26
|
export declare function useVirtualInputContext(): VirtualInputContextValue;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { InputMode } from "../types/inputPolicy";
|
|
3
|
+
import type { KeypadLayout } from "../hooks/useKeypadLayout";
|
|
2
4
|
export interface VirtualInputHandle {
|
|
3
5
|
handleKeyDown: (e: KeyboardEvent | React.KeyboardEvent) => void;
|
|
4
6
|
scrollIntoView: () => void;
|
|
@@ -12,5 +14,9 @@ export interface VirtualInputProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
12
14
|
defaultValue?: string;
|
|
13
15
|
placeholder?: string;
|
|
14
16
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
mode?: InputMode;
|
|
18
|
+
layout?: KeypadLayout;
|
|
19
|
+
filterKey?: (key: string) => boolean;
|
|
20
|
+
sanitizeValue?: (value: string) => string;
|
|
15
21
|
}
|
|
16
|
-
export declare function VirtualInput({ value: controlledValue, defaultValue, placeholder, onChange, ...props }: VirtualInputProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function VirtualInput({ value: controlledValue, defaultValue, placeholder, onChange, mode, layout, filterKey, sanitizeValue, ...props }: VirtualInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { KeypadLayout } from "../hooks/useKeypadLayout";
|
|
2
|
+
export type InputMode = "text" | "number" | "tel" | "hangul" | "alpha" | "alphanumeric" | "custom";
|
|
3
|
+
export type InputPolicy = {
|
|
4
|
+
mode: InputMode;
|
|
5
|
+
layout?: KeypadLayout;
|
|
6
|
+
filterKey?: (key: string) => boolean;
|
|
7
|
+
sanitizeValue?: (value: string) => string;
|
|
8
|
+
};
|