@zag-js/tags-input
Advanced tools
Comparing version 0.0.0-dev-20240714214509 to 0.0.0-dev-20240714222614
@@ -209,9 +209,12 @@ "use strict"; | ||
const evt = (0, import_dom_event.getNativeEvent)(event); | ||
if (evt.inputType === "insertFromPaste") return; | ||
let value = event.target.value; | ||
const value = event.target.value; | ||
if (evt.inputType === "insertFromPaste") { | ||
send({ type: "PASTE", value }); | ||
return; | ||
} | ||
if (endsWith(value, state.context.delimiter)) { | ||
send("DELIMITER_KEY"); | ||
} else { | ||
send({ type: "TYPE", value, key: evt.inputType }); | ||
return; | ||
} | ||
send({ type: "TYPE", value, key: evt.inputType }); | ||
}, | ||
@@ -221,7 +224,2 @@ onFocus() { | ||
}, | ||
onPaste(event) { | ||
event.preventDefault(); | ||
const value = event.clipboardData.getData("text/plain"); | ||
send({ type: "PASTE", value }); | ||
}, | ||
onKeyDown(event) { | ||
@@ -228,0 +226,0 @@ if (event.defaultPrevented) return; |
{ | ||
"name": "@zag-js/tags-input", | ||
"version": "0.0.0-dev-20240714214509", | ||
"version": "0.0.0-dev-20240714222614", | ||
"description": "Core logic for the tags-input widget implemented as a state machine", | ||
@@ -30,12 +30,12 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/anatomy": "0.0.0-dev-20240714214509", | ||
"@zag-js/auto-resize": "0.0.0-dev-20240714214509", | ||
"@zag-js/core": "0.0.0-dev-20240714214509", | ||
"@zag-js/interact-outside": "0.0.0-dev-20240714214509", | ||
"@zag-js/live-region": "0.0.0-dev-20240714214509", | ||
"@zag-js/dom-query": "0.0.0-dev-20240714214509", | ||
"@zag-js/dom-event": "0.0.0-dev-20240714214509", | ||
"@zag-js/form-utils": "0.0.0-dev-20240714214509", | ||
"@zag-js/utils": "0.0.0-dev-20240714214509", | ||
"@zag-js/types": "0.0.0-dev-20240714214509" | ||
"@zag-js/anatomy": "0.0.0-dev-20240714222614", | ||
"@zag-js/auto-resize": "0.0.0-dev-20240714222614", | ||
"@zag-js/core": "0.0.0-dev-20240714222614", | ||
"@zag-js/interact-outside": "0.0.0-dev-20240714222614", | ||
"@zag-js/live-region": "0.0.0-dev-20240714222614", | ||
"@zag-js/dom-query": "0.0.0-dev-20240714222614", | ||
"@zag-js/dom-event": "0.0.0-dev-20240714222614", | ||
"@zag-js/form-utils": "0.0.0-dev-20240714222614", | ||
"@zag-js/utils": "0.0.0-dev-20240714222614", | ||
"@zag-js/types": "0.0.0-dev-20240714222614" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
@@ -122,11 +122,15 @@ import { getEventKey, getNativeEvent, type EventKeyMap } from "@zag-js/dom-event" | ||
const evt = getNativeEvent(event) | ||
const value = event.target.value | ||
if (evt.inputType === "insertFromPaste") return | ||
let value = event.target.value | ||
if (evt.inputType === "insertFromPaste") { | ||
send({ type: "PASTE", value }) | ||
return | ||
} | ||
if (endsWith(value, state.context.delimiter)) { | ||
send("DELIMITER_KEY") | ||
} else { | ||
send({ type: "TYPE", value, key: evt.inputType }) | ||
return | ||
} | ||
send({ type: "TYPE", value, key: evt.inputType }) | ||
}, | ||
@@ -136,7 +140,2 @@ onFocus() { | ||
}, | ||
onPaste(event) { | ||
event.preventDefault() | ||
const value = event.clipboardData.getData("text/plain") | ||
send({ type: "PASTE", value }) | ||
}, | ||
onKeyDown(event) { | ||
@@ -143,0 +142,0 @@ if (event.defaultPrevented) return |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256569
3658
+ Added@zag-js/anatomy@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/auto-resize@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/core@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/dom-event@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/dom-query@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/form-utils@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/interact-outside@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/live-region@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/store@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/text-selection@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/types@0.0.0-dev-20240714222614(transitive)
+ Added@zag-js/utils@0.0.0-dev-20240714222614(transitive)
- Removed@zag-js/anatomy@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/auto-resize@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/core@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/dom-event@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/dom-query@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/form-utils@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/interact-outside@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/live-region@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/store@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/text-selection@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/types@0.0.0-dev-20240714214509(transitive)
- Removed@zag-js/utils@0.0.0-dev-20240714214509(transitive)