Socket
Socket
Sign inDemoInstall

@zag-js/file-upload

Package Overview
Dependencies
Maintainers
1
Versions
561
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/file-upload - npm Package Compare versions

Comparing version 0.56.0 to 0.56.1

54

dist/index.js

@@ -74,4 +74,3 @@ "use strict";

function isEventWithFiles(event) {
if (!event.dataTransfer)
return !!event.target && "files" in event.target;
if (!event.dataTransfer) return !!event.target && "files" in event.target;
return event.dataTransfer.types.some((type) => {

@@ -82,8 +81,5 @@ return type === "Files" || type === "application/x-moz-file";

function isFilesWithinRange(ctx, incomingCount) {
if (!ctx.multiple && incomingCount > 1)
return false;
if (!ctx.multiple && incomingCount + ctx.acceptedFiles.length === 2)
return true;
if (incomingCount + ctx.acceptedFiles.length > ctx.maxFiles)
return false;
if (!ctx.multiple && incomingCount > 1) return false;
if (!ctx.multiple && incomingCount + ctx.acceptedFiles.length === 2) return true;
if (incomingCount + ctx.acceptedFiles.length > ctx.maxFiles) return false;
return true;

@@ -103,4 +99,3 @@ }

const errors = [acceptError, sizeError];
if (!valid)
errors.push(...validateErrors ?? []);
if (!valid) errors.push(...validateErrors ?? []);
rejectedFiles.push({ file, errors: errors.filter(Boolean) });

@@ -176,8 +171,5 @@ }

onKeyDown(event) {
if (event.defaultPrevented)
return;
if (!(0, import_dom_query2.isSelfTarget)(event))
return;
if (event.key !== "Enter" && event.key !== " ")
return;
if (event.defaultPrevented) return;
if (!(0, import_dom_query2.isSelfTarget)(event)) return;
if (event.key !== "Enter" && event.key !== " ") return;
send({ type: "DROPZONE.CLICK", src: "keydown" });

@@ -187,9 +179,7 @@ },

const isLabel = event.currentTarget.localName === "label";
if (isLabel)
event.preventDefault();
if (isLabel) event.preventDefault();
send("DROPZONE.CLICK");
},
onDragOver(event) {
if (!allowDrop)
return;
if (!allowDrop) return;
event.preventDefault();

@@ -202,4 +192,3 @@ event.stopPropagation();

const hasFiles = isEventWithFiles(event);
if (!hasFiles)
return;
if (!hasFiles) return;
const count = event.dataTransfer.items.length;

@@ -209,6 +198,4 @@ send({ type: "DROPZONE.DRAG_OVER", count });

onDragLeave(event) {
if (!allowDrop || disabled)
return;
if ((0, import_dom_query2.contains)(event.currentTarget, event.relatedTarget))
return;
if (!allowDrop || disabled) return;
if ((0, import_dom_query2.contains)(event.currentTarget, event.relatedTarget)) return;
send({ type: "DROPZONE.DRAG_LEAVE" });

@@ -222,4 +209,3 @@ },

const hasFiles = isEventWithFiles(event);
if (disabled || !hasFiles)
return;
if (disabled || !hasFiles) return;
send({ type: "DROPZONE.DROP", files: Array.from(event.dataTransfer.files) });

@@ -244,4 +230,3 @@ },

onClick(event) {
if (disabled)
return;
if (disabled) return;
if ((0, import_dom_query2.contains)(dom.getDropzoneEl(state.context), event.currentTarget)) {

@@ -270,4 +255,3 @@ event.stopPropagation();

onChange(event) {
if (disabled)
return;
if (disabled) return;
const { files } = event.currentTarget;

@@ -345,4 +329,3 @@ send({ type: "FILES.SET", files: files ? Array.from(files) : [] });

onClick() {
if (disabled)
return;
if (disabled) return;
send({ type: "FILE.DELETE", file });

@@ -466,4 +449,3 @@ }

const inputEl = dom.getHiddenInputEl(ctx2);
if (!inputEl)
return;
if (!inputEl) return;
const win = dom.getWin(ctx2);

@@ -470,0 +452,0 @@ const dataTransfer = new win.DataTransfer();

{
"name": "@zag-js/file-upload",
"version": "0.56.0",
"version": "0.56.1",
"description": "Core logic for the file-upload widget implemented as a state machine",

@@ -31,9 +31,9 @@ "keywords": [

"dependencies": {
"@zag-js/anatomy": "0.56.0",
"@zag-js/core": "0.56.0",
"@zag-js/dom-query": "0.56.0",
"@zag-js/file-utils": "0.56.0",
"@zag-js/i18n-utils": "0.56.0",
"@zag-js/utils": "0.56.0",
"@zag-js/types": "0.56.0"
"@zag-js/anatomy": "0.56.1",
"@zag-js/core": "0.56.1",
"@zag-js/dom-query": "0.56.1",
"@zag-js/file-utils": "0.56.1",
"@zag-js/i18n-utils": "0.56.1",
"@zag-js/utils": "0.56.1",
"@zag-js/types": "0.56.1"
},

@@ -40,0 +40,0 @@ "devDependencies": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc