@mirohq/design-system-utils
Advanced tools
Comparing version 0.14.0-use-press.0 to 0.14.0-use-press.1
@@ -35,2 +35,11 @@ 'use strict'; | ||
}; | ||
const removeEventProps = (props, exceptions) => Object.entries(props).reduce((result, [key, fn]) => { | ||
if (key.startsWith("on") && !exceptions.includes(key)) { | ||
return result; | ||
} | ||
return { | ||
...result, | ||
[key]: fn | ||
}; | ||
}, {}); | ||
@@ -93,2 +102,3 @@ const mapKeysToVariants = (map, prop) => Object.keys(map).reduce((acc, key) => { | ||
exports.mapKeysToVariants = mapKeysToVariants; | ||
exports.removeEventProps = removeEventProps; | ||
//# sourceMappingURL=main.js.map |
@@ -31,2 +31,11 @@ import { Fragment, Children, cloneElement } from 'react'; | ||
}; | ||
const removeEventProps = (props, exceptions) => Object.entries(props).reduce((result, [key, fn]) => { | ||
if (key.startsWith("on") && !exceptions.includes(key)) { | ||
return result; | ||
} | ||
return { | ||
...result, | ||
[key]: fn | ||
}; | ||
}, {}); | ||
@@ -81,3 +90,3 @@ const mapKeysToVariants = (map, prop) => Object.keys(map).reduce((acc, key) => { | ||
export { addPropsToChildren, areRectanglesOverlapping, booleanify, createConstants, getPointClientRect, isFragment, isOverTarget, mapKeysToVariants }; | ||
export { addPropsToChildren, areRectanglesOverlapping, booleanify, createConstants, getPointClientRect, isFragment, isOverTarget, mapKeysToVariants, removeEventProps }; | ||
//# sourceMappingURL=module.js.map |
@@ -17,2 +17,9 @@ import { ReactNode, ReactElement } from 'react'; | ||
declare const addPropsToChildren: <T>(children: ReactNode, containsComponent: (child: ReactElement) => boolean, props: Partial<T>) => ReactNode; | ||
/** | ||
* Remove any `on` prop from an object | ||
* @param props object | ||
* @param exceptions array string starting with `on` | ||
* @returns props without keys starting by `on` | ||
*/ | ||
declare const removeEventProps: <T extends {}, Exceptions extends ("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")[] = []>(props: T, exceptions: Exceptions) => { [K in keyof T as K extends Exceptions ? never : K]: T[K]; }; | ||
@@ -58,2 +65,2 @@ declare type KeyVariants<KeyMap, Prop extends keyof CSSProperties> = { | ||
export { addPropsToChildren, areRectanglesOverlapping, booleanify, createConstants, getPointClientRect, isFragment, isOverTarget, mapKeysToVariants }; | ||
export { addPropsToChildren, areRectanglesOverlapping, booleanify, createConstants, getPointClientRect, isFragment, isOverTarget, mapKeysToVariants, removeEventProps }; |
{ | ||
"name": "@mirohq/design-system-utils", | ||
"version": "0.14.0-use-press.0", | ||
"version": "0.14.0-use-press.1", | ||
"description": "", | ||
@@ -29,3 +29,3 @@ "author": "Miro", | ||
"dependencies": { | ||
"@mirohq/design-system-types": "^0.5.0" | ||
"@mirohq/design-system-types": "^0.6.0-use-press.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
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
28925
247
+ Added@mirohq/design-system-types@0.6.2(transitive)
- Removed@mirohq/design-system-types@0.5.0(transitive)