@uiwwsw/virtual-keyboard 0.3.5 → 0.3.6
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.
- package/README.md +6 -10
- package/dist/index.js +45 -10
- package/dist/types/components/Keypad.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
1
|
# virtual-keyboard
|
|
4
2
|
|
|
5
3
|
**A revolutionary virtual keyboard solution for React that solves the Korean `composition` issue.**
|
|
@@ -9,8 +7,6 @@
|
|
|
9
7
|
[](https://github.com/uiwwsw/virtual-keyboard/blob/main/LICENSE)
|
|
10
8
|
[](https://github.com/uiwwsw/virtual-keyboard/stargazers)
|
|
11
9
|
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
10
|

|
|
15
11
|
|
|
16
12
|
[**Visit the Demo →**](https://composed-input-y46p.vercel.app/)
|
|
@@ -41,7 +37,7 @@ Wrap your input fields with the `VirtualInputProvider`. This provider manages th
|
|
|
41
37
|
Use the default QWERTY keyboard for Korean and English input.
|
|
42
38
|
|
|
43
39
|
```tsx
|
|
44
|
-
import { VirtualInput, VirtualInputProvider } from
|
|
40
|
+
import { VirtualInput, VirtualInputProvider } from "@uiwwsw/virtual-keyboard";
|
|
45
41
|
|
|
46
42
|
function App() {
|
|
47
43
|
return (
|
|
@@ -58,7 +54,7 @@ function App() {
|
|
|
58
54
|
You can provide a custom layout for specialized inputs, such as a number pad for phone numbers.
|
|
59
55
|
|
|
60
56
|
```tsx
|
|
61
|
-
import { VirtualInput, VirtualInputProvider } from
|
|
57
|
+
import { VirtualInput, VirtualInputProvider } from "@uiwwsw/virtual-keyboard";
|
|
62
58
|
|
|
63
59
|
const numberPadLayout = [
|
|
64
60
|
[{ value: "1" }, { value: "2" }, { value: "3" }],
|
|
@@ -84,10 +80,10 @@ function App() {
|
|
|
84
80
|
|
|
85
81
|
The main provider that manages the keyboard state and UI.
|
|
86
82
|
|
|
87
|
-
| Prop
|
|
88
|
-
|
|
|
89
|
-
| `layout`
|
|
90
|
-
| `children
|
|
83
|
+
| Prop | Type | Description |
|
|
84
|
+
| :--------- | :--------------------- | :-------------------------------------------------- |
|
|
85
|
+
| `layout` | `Key[][][]` (optional) | A 2D array to define a custom keyboard layout. |
|
|
86
|
+
| `children` | `ReactNode` | Must contain at least one `VirtualInput` component. |
|
|
91
87
|
|
|
92
88
|
### `<VirtualInput />`
|
|
93
89
|
|
package/dist/index.js
CHANGED
|
@@ -1009,7 +1009,22 @@ function VirtualKeypad({
|
|
|
1009
1009
|
flex: 1;
|
|
1010
1010
|
gap: calc(8px / var(--scale-factor));
|
|
1011
1011
|
}
|
|
1012
|
+
@keyframes key-pop {
|
|
1013
|
+
from {
|
|
1014
|
+
opacity: 0.9;
|
|
1015
|
+
transform: translate(-50%, 5px) scale(1);
|
|
1016
|
+
}
|
|
1017
|
+
to {
|
|
1018
|
+
opacity: 1;
|
|
1019
|
+
transform: translate(-50%, calc(-15px / var(--scale-factor))) scale(1.4);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
@keyframes key-press {
|
|
1023
|
+
from { transform: scale(1); }
|
|
1024
|
+
to { transform: scale(0.96); }
|
|
1025
|
+
}
|
|
1012
1026
|
.keypad-button {
|
|
1027
|
+
position: relative;
|
|
1013
1028
|
flex: 1;
|
|
1014
1029
|
display: flex;
|
|
1015
1030
|
justify-content: center;
|
|
@@ -1024,17 +1039,31 @@ function VirtualKeypad({
|
|
|
1024
1039
|
box-shadow: 0 calc(2px / var(--scale-factor)) calc(2px / var(--scale-factor)) rgba(0, 0, 0, 0.05);
|
|
1025
1040
|
}
|
|
1026
1041
|
.keypad-button:active {
|
|
1027
|
-
|
|
1028
|
-
transform: scale(0.98);
|
|
1029
|
-
box-shadow: 0 calc(1px / var(--scale-factor)) calc(1px / var(--scale-factor)) rgba(0, 0, 0, 0.1);
|
|
1030
|
-
transition: all 0.1s ease-in-out;
|
|
1042
|
+
animation: key-press 0.05s forwards;
|
|
1031
1043
|
}
|
|
1032
|
-
.
|
|
1033
|
-
|
|
1044
|
+
.key-popup {
|
|
1045
|
+
display: none;
|
|
1046
|
+
position: absolute;
|
|
1047
|
+
left: 50%;
|
|
1048
|
+
bottom: 80%;
|
|
1049
|
+
min-width: 100%;
|
|
1050
|
+
padding: calc(8px / var(--scale-factor)) calc(12px / var(--scale-factor));
|
|
1051
|
+
background-color: #f9fafb;
|
|
1052
|
+
color: #333;
|
|
1053
|
+
border-radius: calc(10px / var(--scale-factor));
|
|
1054
|
+
box-shadow: 0 calc(-2px / var(--scale-factor)) calc(10px / var(--scale-factor)) rgba(0, 0, 0, 0.15);
|
|
1055
|
+
pointer-events: none;
|
|
1056
|
+
font-size: calc(26px / var(--scale-factor));
|
|
1057
|
+
font-weight: 500;
|
|
1058
|
+
text-align: center;
|
|
1059
|
+
z-index: 10;
|
|
1060
|
+
line-height: 1.2;
|
|
1034
1061
|
}
|
|
1035
|
-
.keypad-button
|
|
1036
|
-
|
|
1062
|
+
.keypad-button:active .key-popup {
|
|
1063
|
+
display: block;
|
|
1064
|
+
animation: key-pop 0.1s ease-out forwards;
|
|
1037
1065
|
}
|
|
1066
|
+
|
|
1038
1067
|
`,
|
|
1039
1068
|
children: /* @__PURE__ */ jsxDEV4("div", {
|
|
1040
1069
|
onFocus: handleFocus,
|
|
@@ -1056,8 +1085,14 @@ function VirtualKeypad({
|
|
|
1056
1085
|
"data-type": cell.type,
|
|
1057
1086
|
onClick: insertCharacter,
|
|
1058
1087
|
className: `keypad-button ${cell.type === "action" ? "action" : ""}`,
|
|
1059
|
-
children:
|
|
1060
|
-
|
|
1088
|
+
children: [
|
|
1089
|
+
getTransformedValue(cell),
|
|
1090
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
1091
|
+
className: "key-popup",
|
|
1092
|
+
children: getTransformedValue(cell)
|
|
1093
|
+
}, undefined, false, undefined, this)
|
|
1094
|
+
]
|
|
1095
|
+
}, `${i}-${j}`, true, undefined, this))
|
|
1061
1096
|
}, i, false, undefined, this))
|
|
1062
1097
|
}, undefined, false, undefined, this)
|
|
1063
1098
|
}, undefined, false, undefined, this);
|