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

@mirohq/design-system-link

Package Overview
Dependencies
Maintainers
2
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mirohq/design-system-link - npm Package Compare versions

Comparing version 1.2.14 to 1.2.15-use-press.2

88

dist/main.js

@@ -5,6 +5,8 @@ 'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var link = require('@react-aria/link');
var utils = require('@react-aria/utils');
var button = require('@react-aria/button');
var designSystemUtils = require('@mirohq/design-system-utils');
var interactions = require('@react-aria/interactions');
var designSystemUsePress = require('@mirohq/design-system-use-press');
var designSystemPrimitive = require('@mirohq/design-system-primitive');

@@ -25,2 +27,3 @@ var designSystemStitches = require('@mirohq/design-system-stitches');

transition: `border ${TRANSITION_TIME}, color ${TRANSITION_TIME}`,
// asButton
background: "none",

@@ -76,3 +79,5 @@ padding: "$0",

disabled = false,
"aria-disabled": ariaDisabled,
dashed = false,
asChild,
rel = "",

@@ -85,29 +90,27 @@ target,

tabIndex,
onHoverStart,
onHoverEnd,
onHoverChange,
...restProps
}, forwardRef) => {
const ref = React.useRef(null);
const refWithFallback = forwardRef != null ? forwardRef : ref;
const { linkProps } = link.useLink(
{
isDisabled: disabled,
onPress: onPress != null ? onPress : onClick,
...restProps
},
refWithFallback
);
const { buttonProps } = button.useButton(
{
isDisabled: disabled,
href,
onPress: onPress != null ? onPress : onClick,
allowFocusWhenDisabled: false,
...restProps
},
refWithFallback
);
const asButton = href == null && (onPress != null ? onPress : onClick) != null;
const elementProps = utils.mergeProps(
restProps,
asButton ? buttonProps : linkProps
);
const asButton = href === void 0 && Boolean(onPress != null ? onPress : onClick);
let elementProps = { ...restProps, onClick };
if (disabled || designSystemUtils.booleanify(ariaDisabled)) {
elementProps = designSystemUtils.removeEventProps(
elementProps,
disabled ? [] : ["onBlur", "onFocus"]
);
}
const { pressProps, isPressed } = designSystemUsePress.usePress({
preventFocusOnPress: true,
disabled: disabled || designSystemUtils.booleanify(ariaDisabled),
onPress,
...elementProps
});
const { hoverProps, isHovered } = interactions.useHover({
onHoverStart,
onHoverEnd,
onHoverChange
});
elementProps = utils.mergeProps(pressProps, hoverProps);
let relProp = rel;

@@ -122,14 +125,21 @@ if (!asButton && target === "_blank") {

}
return /* @__PURE__ */ React__default["default"].createElement(StyledLink, {
...elementProps,
ref: refWithFallback,
href,
variant,
disabled,
dashed,
asChild: asButton,
tabIndex: tabIndex != null ? tabIndex : disabled ? -1 : href != null ? void 0 : onClick != null || onPress != null ? 0 : void 0,
rel: relProp.trim(),
target
}, asButton ? /* @__PURE__ */ React__default["default"].createElement("button", null, children) : children);
return /* @__PURE__ */ jsxRuntime.jsx(
StyledLink,
{
...elementProps,
"data-pressed": isPressed ? "" : void 0,
"data-hovered": isHovered ? "" : void 0,
asChild: asButton || asChild,
href,
variant,
disabled,
"aria-disabled": !asButton && (disabled || designSystemUtils.booleanify(ariaDisabled)) ? "true" : void 0,
dashed,
tabIndex: tabIndex != null ? tabIndex : disabled && !asButton ? -1 : asChild === true && !asButton ? tabIndex != null ? tabIndex : 0 : void 0,
rel: relProp.trim(),
target,
ref: forwardRef,
children: asButton ? /* @__PURE__ */ jsxRuntime.jsx("button", { disabled, children }) : children
}
);
}

@@ -136,0 +146,0 @@ );

@@ -1,5 +0,7 @@

import React, { useRef } from 'react';
import { useLink } from '@react-aria/link';
import { jsx } from 'react/jsx-runtime';
import React from 'react';
import { mergeProps } from '@react-aria/utils';
import { useButton } from '@react-aria/button';
import { booleanify, removeEventProps } from '@mirohq/design-system-utils';
import { useHover } from '@react-aria/interactions';
import { usePress } from '@mirohq/design-system-use-press';
import { Primitive } from '@mirohq/design-system-primitive';

@@ -16,2 +18,3 @@ import { styled } from '@mirohq/design-system-stitches';

transition: `border ${TRANSITION_TIME}, color ${TRANSITION_TIME}`,
// asButton
background: "none",

@@ -67,3 +70,5 @@ padding: "$0",

disabled = false,
"aria-disabled": ariaDisabled,
dashed = false,
asChild,
rel = "",

@@ -76,29 +81,27 @@ target,

tabIndex,
onHoverStart,
onHoverEnd,
onHoverChange,
...restProps
}, forwardRef) => {
const ref = useRef(null);
const refWithFallback = forwardRef != null ? forwardRef : ref;
const { linkProps } = useLink(
{
isDisabled: disabled,
onPress: onPress != null ? onPress : onClick,
...restProps
},
refWithFallback
);
const { buttonProps } = useButton(
{
isDisabled: disabled,
href,
onPress: onPress != null ? onPress : onClick,
allowFocusWhenDisabled: false,
...restProps
},
refWithFallback
);
const asButton = href == null && (onPress != null ? onPress : onClick) != null;
const elementProps = mergeProps(
restProps,
asButton ? buttonProps : linkProps
);
const asButton = href === void 0 && Boolean(onPress != null ? onPress : onClick);
let elementProps = { ...restProps, onClick };
if (disabled || booleanify(ariaDisabled)) {
elementProps = removeEventProps(
elementProps,
disabled ? [] : ["onBlur", "onFocus"]
);
}
const { pressProps, isPressed } = usePress({
preventFocusOnPress: true,
disabled: disabled || booleanify(ariaDisabled),
onPress,
...elementProps
});
const { hoverProps, isHovered } = useHover({
onHoverStart,
onHoverEnd,
onHoverChange
});
elementProps = mergeProps(pressProps, hoverProps);
let relProp = rel;

@@ -113,14 +116,21 @@ if (!asButton && target === "_blank") {

}
return /* @__PURE__ */ React.createElement(StyledLink, {
...elementProps,
ref: refWithFallback,
href,
variant,
disabled,
dashed,
asChild: asButton,
tabIndex: tabIndex != null ? tabIndex : disabled ? -1 : href != null ? void 0 : onClick != null || onPress != null ? 0 : void 0,
rel: relProp.trim(),
target
}, asButton ? /* @__PURE__ */ React.createElement("button", null, children) : children);
return /* @__PURE__ */ jsx(
StyledLink,
{
...elementProps,
"data-pressed": isPressed ? "" : void 0,
"data-hovered": isHovered ? "" : void 0,
asChild: asButton || asChild,
href,
variant,
disabled,
"aria-disabled": !asButton && (disabled || booleanify(ariaDisabled)) ? "true" : void 0,
dashed,
tabIndex: tabIndex != null ? tabIndex : disabled && !asButton ? -1 : asChild === true && !asButton ? tabIndex != null ? tabIndex : 0 : void 0,
rel: relProp.trim(),
target,
ref: forwardRef,
children: asButton ? /* @__PURE__ */ jsx("button", { disabled, children }) : children
}
);
}

@@ -127,0 +137,0 @@ );

import * as react from 'react';
import react__default, { ComponentPropsWithRef, ReactNode } from 'react';
import { AriaLinkProps } from '@react-types/link';
import { HoverEvents } from '@react-types/shared';
import { PressProps } from '@mirohq/design-system-use-press';
import * as _mirohq_design_system_primitive from '@mirohq/design-system-primitive';

@@ -9,11 +10,11 @@ import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches';

declare const StyledLink: react.ForwardRefExoticComponent<Pick<Omit<{
declare const StyledLink: react.ForwardRefExoticComponent<Omit<Omit<{
variant?: "primary" | "secondary" | undefined;
dashed?: boolean | "true" | undefined;
disabled?: boolean | "true" | undefined;
}, "disabled" | "dashed" | "variant"> & _stitches_react_types_styled_component.TransformProps<{
}, "dashed" | "disabled" | "variant"> & _stitches_react_types_styled_component.TransformProps<{
variant?: "primary" | "secondary" | undefined;
dashed?: boolean | "true" | undefined;
disabled?: boolean | "true" | undefined;
}, {}> & _mirohq_design_system_stitches.SafeProps<Omit<Pick<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof react.AnchorHTMLAttributes<HTMLAnchorElement>> & {
}, {}> & _mirohq_design_system_stitches.SafeProps<Omit<Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
ref?: ((instance: HTMLAnchorElement | null) => void) | react.RefObject<HTMLAnchorElement> | null | undefined;

@@ -469,3 +470,3 @@ } & {

children?: react.ReactNode;
} & _mirohq_design_system_stitches.CustomStylesProps, "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "type" | "referrerPolicy" | "media" | "target" | "href" | "download" | "hrefLang" | "ping" | "rel" | "asChild" | "dashed" | keyof _mirohq_design_system_stitches.CustomStylesProps | "variant"> & react.RefAttributes<HTMLAnchorElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"a">>, {
} & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLAnchorElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"a">>, {
variant?: "primary" | "secondary" | undefined;

@@ -477,4 +478,3 @@ dashed?: boolean | "true" | undefined;

declare type LinkPropsA11y = StyledLinkProps & AriaLinkProps;
interface LinkProps extends Omit<LinkPropsA11y, 'onClick' | 'isDisabled' | 'elementType'> {
interface LinkProps extends StyledLinkProps, PressProps, HoverEvents {
/**

@@ -489,6 +489,2 @@ * The content

/**
* Disable the mouse events
*/
disabled?: boolean;
/**
* Set the underline to dashed mode

@@ -498,8 +494,8 @@ */

/**
* Alias for onPress
* Make the link non-interactive
*/
onClick?: AriaLinkProps['onPress'];
disabled?: boolean;
}
declare const Link: react__default.ForwardRefExoticComponent<Pick<LinkProps, "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "disabled" | "type" | "referrerPolicy" | "media" | "target" | "href" | "download" | "hrefLang" | "ping" | "rel" | "asChild" | "css" | "UNSAFE_style" | "dashed" | "variant" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onPressUp" | "onFocusChange"> & react__default.RefAttributes<HTMLAnchorElement>>;
declare const Link: react__default.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & react__default.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
export { Link, LinkProps };
{
"name": "@mirohq/design-system-link",
"version": "1.2.14",
"version": "1.2.15-use-press.2",
"description": "",

@@ -29,10 +29,9 @@ "author": "Miro",

"dependencies": {
"@react-aria/button": "^3.5.0",
"@react-aria/link": "^3.3.0",
"@react-aria/interactions": "^3.13.0",
"@react-aria/utils": "^3.13.0",
"@react-types/link": "^3.3.0",
"@react-types/shared": "^3.16.0",
"@mirohq/design-system-primitive": "^1.1.0",
"@mirohq/design-system-utils": "^0.14.0",
"@mirohq/design-system-styles": "^1.0.25",
"@mirohq/design-system-stitches": "^2.3.3"
"@mirohq/design-system-stitches": "^2.3.4-use-press.0",
"@mirohq/design-system-styles": "^1.1.0-use-press.0",
"@mirohq/design-system-utils": "^0.14.0-use-press.2"
},

@@ -39,0 +38,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