@zag-js/pin-input 0.1.14 → 0.1.15

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/dist/index.js CHANGED
@@ -225,17 +225,17 @@ function connect(state, send, normalize) {
225
225
  placeholder: focusedIndex === index ? "" : state.context.placeholder,
226
226
  onChange(event) {
227
227
  const evt = getNativeEvent(event);
228
- if (evt.isComposing)
229
- return;
230
228
  const { value } = event.currentTarget;
231
229
  if (evt.inputType === "insertFromPaste" || value.length > 2) {
232
230
  send({ type: "PASTE", value });
233
231
  event.preventDefault();
234
232
  return;
235
233
  }
236
- if (evt.inputType === "insertText") {
237
- send({ type: "INPUT", value });
234
+ if (evt.inputType === "deleteContentBackward") {
235
+ send("BACKSPACE");
236
+ return;
238
237
  }
238
+ send({ type: "INPUT", value });
239
239
  },
240
240
  onKeyDown(event) {
241
241
  const evt = getNativeEvent(event);
package/dist/index.mjs CHANGED
@@ -198,17 +198,17 @@ function connect(state, send, normalize) {
198
198
  placeholder: focusedIndex === index ? "" : state.context.placeholder,
199
199
  onChange(event) {
200
200
  const evt = getNativeEvent(event);
201
- if (evt.isComposing)
202
- return;
203
201
  const { value } = event.currentTarget;
204
202
  if (evt.inputType === "insertFromPaste" || value.length > 2) {
205
203
  send({ type: "PASTE", value });
206
204
  event.preventDefault();
207
205
  return;
208
206
  }
209
- if (evt.inputType === "insertText") {
210
- send({ type: "INPUT", value });
207
+ if (evt.inputType === "deleteContentBackward") {
208
+ send("BACKSPACE");
209
+ return;
211
210
  }
211
+ send({ type: "INPUT", value });
212
212
  },
213
213
  onKeyDown(event) {
214
214
  const evt = getNativeEvent(event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/pin-input",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Core logic for the pin-input widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",