Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mirohq/design-system-use-press

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mirohq/design-system-use-press - npm Package Compare versions

Comparing version 0.1.0-use-press.2 to 0.1.0

21

dist/main.js

@@ -154,3 +154,6 @@ 'use strict';

};
const shouldPreventDefault$1 = (target) => !(target instanceof HTMLElement) || !target.draggable;
const shouldPreventDefault$1 = (target) => (
// We cannot prevent default if the target is a draggable element.
!(target instanceof HTMLElement) || !target.draggable
);

@@ -252,3 +255,6 @@ const getEvents$2 = ({

const isHTMLAnchorLink = (target) => target.tagName === "A" && target.hasAttribute("href");
const isValidInputKey = (target, key) => target.type === "checkbox" || target.type === "radio" ? key === " " : nonTextInputTypes.has(target.type);
const isValidInputKey = (target, key) => (
// Only space should toggle checkboxes and radios, not enter.
target.type === "checkbox" || target.type === "radio" ? key === " " : nonTextInputTypes.has(target.type)
);
const isEnterOrSpaceEvent = (e) => e.key === "Enter" || e.key === " " || e.code === "Space";

@@ -259,3 +265,7 @@ const isValidKeyboardEvent = (event, currentTarget) => {

const role = element.getAttribute("role");
return isEnterOrSpaceEvent(event) && !(element instanceof HTMLInputElement && !isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && (!isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && !(role === "link" && key !== "Enter");
return isEnterOrSpaceEvent(event) && // Inputs
!(element instanceof HTMLInputElement && !isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && // A link with a valid href should be handled natively,
// unless it also has role='button' and was triggered using Space.
(!isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && // An element with role='link' should only trigger with Enter key
!(role === "link" && key !== "Enter");
};

@@ -587,3 +597,6 @@

};
const shouldPreventDefault = (target) => !(target instanceof HTMLElement) || !target.draggable;
const shouldPreventDefault = (target) => (
// We cannot prevent default if the target is a draggable element.
!(target instanceof HTMLElement) || !target.draggable
);

@@ -590,0 +603,0 @@ const usePress = (props) => {

@@ -150,3 +150,6 @@ import { useRef, useState, useEffect } from 'react';

};
const shouldPreventDefault$1 = (target) => !(target instanceof HTMLElement) || !target.draggable;
const shouldPreventDefault$1 = (target) => (
// We cannot prevent default if the target is a draggable element.
!(target instanceof HTMLElement) || !target.draggable
);

@@ -248,3 +251,6 @@ const getEvents$2 = ({

const isHTMLAnchorLink = (target) => target.tagName === "A" && target.hasAttribute("href");
const isValidInputKey = (target, key) => target.type === "checkbox" || target.type === "radio" ? key === " " : nonTextInputTypes.has(target.type);
const isValidInputKey = (target, key) => (
// Only space should toggle checkboxes and radios, not enter.
target.type === "checkbox" || target.type === "radio" ? key === " " : nonTextInputTypes.has(target.type)
);
const isEnterOrSpaceEvent = (e) => e.key === "Enter" || e.key === " " || e.code === "Space";

@@ -255,3 +261,7 @@ const isValidKeyboardEvent = (event, currentTarget) => {

const role = element.getAttribute("role");
return isEnterOrSpaceEvent(event) && !(element instanceof HTMLInputElement && !isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && (!isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && !(role === "link" && key !== "Enter");
return isEnterOrSpaceEvent(event) && // Inputs
!(element instanceof HTMLInputElement && !isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && // A link with a valid href should be handled natively,
// unless it also has role='button' and was triggered using Space.
(!isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && // An element with role='link' should only trigger with Enter key
!(role === "link" && key !== "Enter");
};

@@ -583,3 +593,6 @@

};
const shouldPreventDefault = (target) => !(target instanceof HTMLElement) || !target.draggable;
const shouldPreventDefault = (target) => (
// We cannot prevent default if the target is a draggable element.
!(target instanceof HTMLElement) || !target.draggable
);

@@ -586,0 +599,0 @@ const usePress = (props) => {

8

package.json
{
"name": "@mirohq/design-system-use-press",
"version": "0.1.0-use-press.2",
"version": "0.1.0",
"description": "",

@@ -29,5 +29,5 @@ "author": "Miro",

"@react-aria/utils": "^3.14.2",
"@mirohq/design-system-use-listeners": "^0.1.0-use-press.0",
"@mirohq/design-system-utils": "^0.14.0-use-press.2",
"@mirohq/design-system-use-logger": "^0.1.0-use-press.2"
"@mirohq/design-system-use-listeners": "^0.1.0",
"@mirohq/design-system-use-logger": "^0.1.0",
"@mirohq/design-system-utils": "^0.14.0"
},

@@ -34,0 +34,0 @@ "scripts": {

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