@mirohq/design-system-base-button
Advanced tools
Comparing version 0.4.8 to 0.4.9-use-press.0
100
dist/main.js
@@ -6,9 +6,9 @@ 'use strict'; | ||
var React = require('react'); | ||
var button = require('@react-aria/button'); | ||
var utils = require('@react-aria/utils'); | ||
var designSystemUtils = require('@mirohq/design-system-utils'); | ||
var interactions = require('@react-aria/interactions'); | ||
var utils = require('@react-aria/utils'); | ||
var link = require('@react-aria/link'); | ||
var focus = require('@react-aria/focus'); | ||
var designSystemUsePress = require('@mirohq/design-system-use-press'); | ||
var designSystemPrimitive = require('@mirohq/design-system-primitive'); | ||
var designSystemStitches = require('@mirohq/design-system-stitches'); | ||
var designSystemStyles = require('@mirohq/design-system-styles'); | ||
@@ -34,13 +34,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
}, | ||
'&[aria-disabled="true"]': { | ||
"&[aria-disabled]": { | ||
cursor: "default" | ||
} | ||
}, | ||
...designSystemStyles.focus.defaults | ||
}); | ||
function eventHandler(callback, allowEvent) { | ||
if (allowEvent) { | ||
return callback; | ||
} | ||
return void 0; | ||
} | ||
const BaseButton = React__default["default"].forwardRef( | ||
@@ -50,76 +45,41 @@ ({ | ||
"aria-disabled": ariaDisabled, | ||
href, | ||
target, | ||
rel, | ||
children, | ||
onClick, | ||
asChild, | ||
role, | ||
onHoverStart, | ||
onHoverEnd, | ||
onHoverChange, | ||
onPress, | ||
onPressStart, | ||
onPressEnd, | ||
onPressChange, | ||
onFocus, | ||
onBlur, | ||
onFocusChange, | ||
...restProps | ||
}, forwardRef) => { | ||
const asLink = href != null; | ||
const ref = React.useRef(null); | ||
const refWithFallback = forwardRef != null ? forwardRef : ref; | ||
const allowPressEvents = ariaDisabled !== "true" && ariaDisabled !== true; | ||
const commonProps = { | ||
isDisabled: disabled, | ||
onPress: eventHandler(onPress != null ? onPress : onClick, allowPressEvents), | ||
onPressStart: eventHandler(onPressStart, allowPressEvents), | ||
onPressEnd: eventHandler(onPressEnd, allowPressEvents), | ||
onPressChange: eventHandler(onPressChange, allowPressEvents), | ||
onFocusChange, | ||
onFocus, | ||
onBlur | ||
}; | ||
const { buttonProps, isPressed } = button.useButton( | ||
{ | ||
href, | ||
allowFocusWhenDisabled: false, | ||
...commonProps, | ||
...restProps | ||
}, | ||
refWithFallback | ||
); | ||
const { linkProps } = link.useLink( | ||
{ ...commonProps, ...restProps }, | ||
refWithFallback | ||
); | ||
const tabIndexProp = disabled && { | ||
tabIndex: -1 | ||
}; | ||
const { isFocusVisible, focusProps: focusPropsRing } = focus.useFocusRing(); | ||
const asLink = "href" in restProps; | ||
const { href, target, rel = "" } = restProps; | ||
let elementProps = restProps; | ||
if (designSystemUtils.booleanify(ariaDisabled)) { | ||
elementProps = designSystemUtils.removeEventProps(elementProps, ["onBlur", "onFocus"]); | ||
} | ||
const { pressProps, isPressed } = designSystemUsePress.usePress({ | ||
preventFocusOnPress: true, | ||
disabled: disabled || designSystemUtils.booleanify(ariaDisabled), | ||
...elementProps | ||
}); | ||
const { hoverProps, isHovered } = interactions.useHover({ | ||
onHoverStart: (e) => onHoverStart == null ? void 0 : onHoverStart(e), | ||
onHoverEnd: (e) => onHoverEnd == null ? void 0 : onHoverEnd(e), | ||
onHoverChange: (e) => onHoverChange == null ? void 0 : onHoverChange(e) | ||
onHoverStart, | ||
onHoverEnd, | ||
onHoverChange | ||
}); | ||
const elementProps = utils.mergeProps( | ||
restProps, | ||
asLink ? linkProps : buttonProps, | ||
hoverProps, | ||
focusPropsRing | ||
); | ||
elementProps = utils.mergeProps(pressProps, hoverProps); | ||
return /* @__PURE__ */ React__default["default"].createElement(StyledBaseButton, { | ||
...elementProps, | ||
disabled, | ||
asChild: asLink || asChild, | ||
...tabIndexProp, | ||
"data-pressed": isPressed ? "" : void 0, | ||
"data-focused": isFocusVisible ? "" : void 0, | ||
"data-hovered": isHovered ? "" : void 0, | ||
"aria-disabled": ariaDisabled, | ||
ref: refWithFallback | ||
asChild: asLink || asChild, | ||
disabled, | ||
role: role != null ? role : asChild === true ? "button" : void 0, | ||
"aria-disabled": designSystemUtils.booleanify(ariaDisabled) ? "true" : void 0, | ||
tabIndex: disabled && (asLink || asChild === true) ? -1 : void 0, | ||
ref: forwardRef | ||
}, asLink ? /* @__PURE__ */ React__default["default"].createElement("a", { | ||
href, | ||
target, | ||
rel: target === "_blank" ? `noopener noreferrer ${rel}` : rel | ||
rel: target === "_blank" ? `noopener noreferrer ${rel}`.trim() : rel | ||
}, children) : children); | ||
@@ -126,0 +86,0 @@ } |
@@ -1,9 +0,9 @@ | ||
import React, { useRef } from 'react'; | ||
import { useButton } from '@react-aria/button'; | ||
import React from 'react'; | ||
import { mergeProps } from '@react-aria/utils'; | ||
import { booleanify, removeEventProps } from '@mirohq/design-system-utils'; | ||
import { useHover } from '@react-aria/interactions'; | ||
import { mergeProps } from '@react-aria/utils'; | ||
import { useLink } from '@react-aria/link'; | ||
import { useFocusRing } from '@react-aria/focus'; | ||
import { usePress } from '@mirohq/design-system-use-press'; | ||
import { Primitive } from '@mirohq/design-system-primitive'; | ||
import { styled } from '@mirohq/design-system-stitches'; | ||
import { focus } from '@mirohq/design-system-styles'; | ||
@@ -25,13 +25,8 @@ const sizes = { | ||
}, | ||
'&[aria-disabled="true"]': { | ||
"&[aria-disabled]": { | ||
cursor: "default" | ||
} | ||
}, | ||
...focus.defaults | ||
}); | ||
function eventHandler(callback, allowEvent) { | ||
if (allowEvent) { | ||
return callback; | ||
} | ||
return void 0; | ||
} | ||
const BaseButton = React.forwardRef( | ||
@@ -41,76 +36,41 @@ ({ | ||
"aria-disabled": ariaDisabled, | ||
href, | ||
target, | ||
rel, | ||
children, | ||
onClick, | ||
asChild, | ||
role, | ||
onHoverStart, | ||
onHoverEnd, | ||
onHoverChange, | ||
onPress, | ||
onPressStart, | ||
onPressEnd, | ||
onPressChange, | ||
onFocus, | ||
onBlur, | ||
onFocusChange, | ||
...restProps | ||
}, forwardRef) => { | ||
const asLink = href != null; | ||
const ref = useRef(null); | ||
const refWithFallback = forwardRef != null ? forwardRef : ref; | ||
const allowPressEvents = ariaDisabled !== "true" && ariaDisabled !== true; | ||
const commonProps = { | ||
isDisabled: disabled, | ||
onPress: eventHandler(onPress != null ? onPress : onClick, allowPressEvents), | ||
onPressStart: eventHandler(onPressStart, allowPressEvents), | ||
onPressEnd: eventHandler(onPressEnd, allowPressEvents), | ||
onPressChange: eventHandler(onPressChange, allowPressEvents), | ||
onFocusChange, | ||
onFocus, | ||
onBlur | ||
}; | ||
const { buttonProps, isPressed } = useButton( | ||
{ | ||
href, | ||
allowFocusWhenDisabled: false, | ||
...commonProps, | ||
...restProps | ||
}, | ||
refWithFallback | ||
); | ||
const { linkProps } = useLink( | ||
{ ...commonProps, ...restProps }, | ||
refWithFallback | ||
); | ||
const tabIndexProp = disabled && { | ||
tabIndex: -1 | ||
}; | ||
const { isFocusVisible, focusProps: focusPropsRing } = useFocusRing(); | ||
const asLink = "href" in restProps; | ||
const { href, target, rel = "" } = restProps; | ||
let elementProps = restProps; | ||
if (booleanify(ariaDisabled)) { | ||
elementProps = removeEventProps(elementProps, ["onBlur", "onFocus"]); | ||
} | ||
const { pressProps, isPressed } = usePress({ | ||
preventFocusOnPress: true, | ||
disabled: disabled || booleanify(ariaDisabled), | ||
...elementProps | ||
}); | ||
const { hoverProps, isHovered } = useHover({ | ||
onHoverStart: (e) => onHoverStart == null ? void 0 : onHoverStart(e), | ||
onHoverEnd: (e) => onHoverEnd == null ? void 0 : onHoverEnd(e), | ||
onHoverChange: (e) => onHoverChange == null ? void 0 : onHoverChange(e) | ||
onHoverStart, | ||
onHoverEnd, | ||
onHoverChange | ||
}); | ||
const elementProps = mergeProps( | ||
restProps, | ||
asLink ? linkProps : buttonProps, | ||
hoverProps, | ||
focusPropsRing | ||
); | ||
elementProps = mergeProps(pressProps, hoverProps); | ||
return /* @__PURE__ */ React.createElement(StyledBaseButton, { | ||
...elementProps, | ||
disabled, | ||
asChild: asLink || asChild, | ||
...tabIndexProp, | ||
"data-pressed": isPressed ? "" : void 0, | ||
"data-focused": isFocusVisible ? "" : void 0, | ||
"data-hovered": isHovered ? "" : void 0, | ||
"aria-disabled": ariaDisabled, | ||
ref: refWithFallback | ||
asChild: asLink || asChild, | ||
disabled, | ||
role: role != null ? role : asChild === true ? "button" : void 0, | ||
"aria-disabled": booleanify(ariaDisabled) ? "true" : void 0, | ||
tabIndex: disabled && (asLink || asChild === true) ? -1 : void 0, | ||
ref: forwardRef | ||
}, asLink ? /* @__PURE__ */ React.createElement("a", { | ||
href, | ||
target, | ||
rel: target === "_blank" ? `noopener noreferrer ${rel}` : rel | ||
rel: target === "_blank" ? `noopener noreferrer ${rel}`.trim() : rel | ||
}, children) : children); | ||
@@ -117,0 +77,0 @@ } |
@@ -0,7 +1,7 @@ | ||
import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches'; | ||
import * as react from 'react'; | ||
import react__default, { ComponentPropsWithRef, ReactNode } from 'react'; | ||
import { FocusEvents, HoverEvents } from '@react-types/shared'; | ||
import { AriaButtonProps } from '@react-types/button'; | ||
import react__default, { ComponentPropsWithRef, AnchorHTMLAttributes } from 'react'; | ||
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'; | ||
import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches'; | ||
import * as _stitches_react_types_css_util from '@stitches/react/types/css-util'; | ||
@@ -460,34 +460,12 @@ import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component'; | ||
children?: react.ReactNode; | ||
} & _mirohq_design_system_stitches.CustomStylesProps, "form" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "asChild" | keyof _mirohq_design_system_stitches.CustomStylesProps> & react.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"button">>, {}, {}>; | ||
} & _mirohq_design_system_stitches.CustomStylesProps, "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" | "key" | "form" | "slot" | "title" | "color" | "translate" | "hidden" | "prefix" | "id" | "role" | "tabIndex" | "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" | "disabled" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "asChild" | keyof _mirohq_design_system_stitches.CustomStylesProps> & react.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"button">>, {}, {}>; | ||
declare type StyledBaseButtonProps = ComponentPropsWithRef<typeof StyledBaseButton>; | ||
declare type ButtonPropsA11y = StyledBaseButtonProps & AriaButtonProps<'button'>; | ||
interface BaseButtonProps extends FocusEvents, HoverEvents, Omit<ButtonPropsA11y, 'onClick' | 'isDisabled' | 'elementType' | 'onBlur' | 'onFocus' | 'onPressUp'> { | ||
/** | ||
* The content | ||
*/ | ||
children: ReactNode; | ||
/** | ||
* Prevent pointer events | ||
*/ | ||
disabled?: boolean; | ||
/** | ||
* A URL to link when using the button as a link | ||
*/ | ||
href?: string; | ||
/** | ||
* The target window using the button as a link | ||
*/ | ||
target?: string; | ||
/** | ||
* The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel) | ||
*/ | ||
rel?: string; | ||
/** | ||
* Alias for onPress | ||
*/ | ||
onClick?: AriaButtonProps['onPress']; | ||
} | ||
declare const BaseButton: react__default.ForwardRefExoticComponent<Pick<BaseButtonProps, "form" | "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" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "target" | "href" | "rel" | "asChild" | "css" | "UNSAFE_style" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onFocusChange" | "excludeFromTabOrder" | "onHoverStart" | "onHoverEnd" | "onHoverChange"> & react__default.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>; | ||
declare type AsButtonProps = StyledBaseButtonProps & PressProps & HoverEvents; | ||
declare type AsLinkProps = AsButtonProps & AnchorHTMLAttributes<'a'> & { | ||
href: string; | ||
}; | ||
declare type BaseButtonProps = AsButtonProps | AsLinkProps; | ||
declare const BaseButton: react__default.ForwardRefExoticComponent<(Pick<AsButtonProps, "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" | "key" | "form" | "slot" | "title" | "color" | "translate" | "hidden" | "prefix" | "id" | "role" | "tabIndex" | "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" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "asChild" | keyof _mirohq_design_system_stitches.CustomStylesProps | keyof PressProps | keyof HoverEvents> | Pick<AsLinkProps, "key" | "form" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "asChild" | keyof _mirohq_design_system_stitches.CustomStylesProps | keyof PressProps | keyof HoverEvents | keyof react__default.AnchorHTMLAttributes<"a">>) & react__default.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>; | ||
export { BaseButton, BaseButtonProps, sizes }; |
{ | ||
"name": "@mirohq/design-system-base-button", | ||
"version": "0.4.8", | ||
"version": "0.4.9-use-press.0", | ||
"description": "", | ||
@@ -29,15 +29,8 @@ "author": "Miro", | ||
"dependencies": { | ||
"@react-aria/button": "^3.5.0", | ||
"@react-aria/focus": "^3.10.0", | ||
"@react-aria/interactions": "^3.13.0", | ||
"@react-aria/link": "^3.3.0", | ||
"@react-aria/utils": "^3.13.0", | ||
"@react-types/button": "^3.5.0", | ||
"@react-types/shared": "^3.16.0", | ||
"@mirohq/design-system-primitive": "^1.1.0", | ||
"@mirohq/design-system-stitches": "^2.3.1" | ||
"@mirohq/design-system-stitches": "^2.3.2-use-press.0" | ||
}, | ||
"devDependencies": { | ||
"@mirohq/design-system-icons": "^0.22.0" | ||
}, | ||
"scripts": { | ||
@@ -44,0 +37,0 @@ "build": "rollup -c ../../../../rollup.config.js", |
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
7
0
48210
660
- Removed@react-aria/button@^3.5.0
- Removed@react-aria/focus@^3.10.0
- Removed@react-aria/link@^3.3.0
- Removed@react-types/button@^3.5.0
- Removed@formatjs/ecma402-abstract@2.3.1(transitive)
- Removed@formatjs/fast-memoize@2.2.5(transitive)
- Removed@formatjs/icu-messageformat-parser@2.9.7(transitive)
- Removed@formatjs/icu-skeleton-parser@1.8.11(transitive)
- Removed@formatjs/intl-localematcher@0.5.9(transitive)
- Removed@internationalized/date@3.6.0(transitive)
- Removed@internationalized/message@3.1.6(transitive)
- Removed@internationalized/number@3.6.0(transitive)
- Removed@internationalized/string@3.2.5(transitive)
- Removed@react-aria/button@3.11.0(transitive)
- Removed@react-aria/focus@3.19.0(transitive)
- Removed@react-aria/i18n@3.12.4(transitive)
- Removed@react-aria/link@3.7.7(transitive)
- Removed@react-aria/toolbar@3.0.0-beta.11(transitive)
- Removed@react-stately/toggle@3.8.0(transitive)
- Removed@react-types/button@3.10.1(transitive)
- Removed@react-types/checkbox@3.9.0(transitive)
- Removed@react-types/link@3.5.9(transitive)
- Removeddecimal.js@10.4.3(transitive)
- Removedintl-messageformat@10.7.10(transitive)