@speakapbv/dough-component-library 10.2.1 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -113,7 +113,8 @@ export interface BoxProps {
113
113
  /** Event properties */
114
114
  onScrollReachedBottom?(e?: UIEvent): void;
115
115
  onMouseEnter?: MouseEventHandler<HTMLDivElement>;
116
+ onMouseMove?: MouseEventHandler<HTMLDivElement>;
116
117
  onMouseLeave?: MouseEventHandler<HTMLDivElement>;
117
118
  onClick?: MouseEventHandler<HTMLDivElement>;
118
119
  }
119
- export declare const Box: React.ForwardRefExoticComponent<Pick<BoxProps, "className" | "children" | "dataAttributes" | "width" | "height" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "absolute" | "zIndex" | "color" | "border" | "borderRadius" | "rounded" | "shadow" | "padding" | "transform" | "overflow" | "display" | "direction" | "flex" | "basis" | "grow" | "shrink" | "order" | "wrap" | "justifyContent" | "alignItems" | "alignContent" | "alignSelf" | "onScrollReachedBottom" | "onMouseEnter" | "onMouseLeave" | "onClick"> & React.RefAttributes<HTMLDivElement>>;
120
+ export declare const Box: React.ForwardRefExoticComponent<Pick<BoxProps, "className" | "children" | "dataAttributes" | "width" | "height" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "absolute" | "zIndex" | "color" | "border" | "borderRadius" | "rounded" | "shadow" | "padding" | "transform" | "overflow" | "display" | "direction" | "flex" | "basis" | "grow" | "shrink" | "order" | "wrap" | "justifyContent" | "alignItems" | "alignContent" | "alignSelf" | "onScrollReachedBottom" | "onMouseEnter" | "onMouseMove" | "onMouseLeave" | "onClick"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,4 @@
1
- import React, { ReactNode, MouseEvent, Ref } from "react";
1
+ import React, { ReactNode, MouseEvent, Ref, MouseEventHandler } from "react";
2
2
  import { ColorsText, DoughDataAttributes } from "../../utils/constants";
3
3
  import "./link.scss";
4
4
  export interface LinkProps {
@@ -8,6 +8,9 @@ export interface LinkProps {
8
8
  color?: ColorsText;
9
9
  children: ReactNode;
10
10
  onClick?(e: MouseEvent): void | boolean;
11
+ onMouseDown?: MouseEventHandler<HTMLAnchorElement>;
12
+ onPointerDown?: MouseEventHandler<HTMLAnchorElement>;
13
+ allEvents?: boolean;
11
14
  underline?: boolean;
12
15
  fullWidth?: boolean;
13
16
  disabled?: boolean;
@@ -19,4 +22,4 @@ export interface LinkProps {
19
22
  width?: string;
20
23
  flex?: string;
21
24
  }
22
- export declare const Link: React.ForwardRefExoticComponent<Pick<LinkProps, "className" | "dataAttributes" | "color" | "children" | "onClick" | "underline" | "fullWidth" | "disabled" | "colorOnlyOnHover" | "href" | "target" | "rel" | "download" | "width" | "flex"> & React.RefAttributes<HTMLAnchorElement>>;
25
+ export declare const Link: React.ForwardRefExoticComponent<Pick<LinkProps, "className" | "dataAttributes" | "color" | "children" | "onClick" | "onMouseDown" | "onPointerDown" | "allEvents" | "underline" | "fullWidth" | "disabled" | "colorOnlyOnHover" | "href" | "target" | "rel" | "download" | "width" | "flex"> & React.RefAttributes<HTMLAnchorElement>>;
package/dist/index.es.js CHANGED
@@ -593,8 +593,24 @@ var deRegisterBreakpointView = function (id) {
593
593
  };
594
594
 
595
595
  var Link = forwardRef(function (props, ref) {
596
- var _a = props.color, color = _a === void 0 ? ColorsText.LINK : _a, _b = props.underline, underline = _b === void 0 ? true : _b, _c = props.rel, rel = _c === void 0 ? "noopener noreferrer" : _c;
597
- return (React.createElement("a", __assign({ onMouseDown: cancelEvent, onPointerDown: cancelEvent, className: cn("dough-link", props.className, color, {
596
+ var _a = props.color, color = _a === void 0 ? ColorsText.LINK : _a, _b = props.underline, underline = _b === void 0 ? true : _b, _c = props.rel, rel = _c === void 0 ? "noopener noreferrer" : _c, onPointerDown = props.onPointerDown, onMouseDown = props.onMouseDown, _d = props.allEvents, allEvents = _d === void 0 ? false : _d;
597
+ function handleMouseDown(event) {
598
+ if (onMouseDown) {
599
+ onMouseDown(event);
600
+ }
601
+ else if (!allEvents) {
602
+ cancelEvent(event);
603
+ }
604
+ }
605
+ function handlePointerDown(event) {
606
+ if (onPointerDown) {
607
+ onPointerDown(event);
608
+ }
609
+ else if (!allEvents) {
610
+ cancelEvent(event);
611
+ }
612
+ }
613
+ return (React.createElement("a", __assign({ onMouseDown: handleMouseDown, onPointerDown: handlePointerDown, className: cn("dough-link", props.className, color, {
598
614
  "dough-link-color-only-on-hover": props.colorOnlyOnHover,
599
615
  "dough-link-no-underline": !underline,
600
616
  "dough-link-full-width": props.fullWidth,
@@ -1193,7 +1209,7 @@ var Box = forwardRef(function (props, ref) {
1193
1209
  _a["dough-flex-align-content-" + props.alignContent] = props.alignContent,
1194
1210
  _a["dough-flex-align-self-" + props.alignSelf] = props.alignSelf,
1195
1211
  _a)), style: __assign({ width: props.width, height: props.height, minWidth: props.minWidth, minHeight: props.minHeight, maxWidth: props.maxWidth, maxHeight: props.maxHeight, flexBasis: props.basis, flexGrow: props.grow, flexShrink: props.shrink, order: props.order, flex: props.flex, zIndex: props.zIndex, transform: props.transform }, (isTypeObject(props.absolute) &&
1196
- props.absolute)) }, props.dataAttributes, { onScroll: props.onScrollReachedBottom ? handleScroll : undefined, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, onClick: props.onClick }), props.children));
1212
+ props.absolute)) }, props.dataAttributes, { onScroll: props.onScrollReachedBottom ? handleScroll : undefined, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, onMouseMove: props.onMouseMove, onClick: props.onClick }), props.children));
1197
1213
  });
1198
1214
  Box.displayName = "Box";
1199
1215
 
package/dist/index.js CHANGED
@@ -588,8 +588,24 @@ var deRegisterBreakpointView = function (id) {
588
588
  };
589
589
 
590
590
  var Link = React.forwardRef(function (props, ref) {
591
- var _a = props.color, color = _a === void 0 ? exports.ColorsText.LINK : _a, _b = props.underline, underline = _b === void 0 ? true : _b, _c = props.rel, rel = _c === void 0 ? "noopener noreferrer" : _c;
592
- return (React__default.createElement("a", __assign({ onMouseDown: cancelEvent, onPointerDown: cancelEvent, className: cn("dough-link", props.className, color, {
591
+ var _a = props.color, color = _a === void 0 ? exports.ColorsText.LINK : _a, _b = props.underline, underline = _b === void 0 ? true : _b, _c = props.rel, rel = _c === void 0 ? "noopener noreferrer" : _c, onPointerDown = props.onPointerDown, onMouseDown = props.onMouseDown, _d = props.allEvents, allEvents = _d === void 0 ? false : _d;
592
+ function handleMouseDown(event) {
593
+ if (onMouseDown) {
594
+ onMouseDown(event);
595
+ }
596
+ else if (!allEvents) {
597
+ cancelEvent(event);
598
+ }
599
+ }
600
+ function handlePointerDown(event) {
601
+ if (onPointerDown) {
602
+ onPointerDown(event);
603
+ }
604
+ else if (!allEvents) {
605
+ cancelEvent(event);
606
+ }
607
+ }
608
+ return (React__default.createElement("a", __assign({ onMouseDown: handleMouseDown, onPointerDown: handlePointerDown, className: cn("dough-link", props.className, color, {
593
609
  "dough-link-color-only-on-hover": props.colorOnlyOnHover,
594
610
  "dough-link-no-underline": !underline,
595
611
  "dough-link-full-width": props.fullWidth,
@@ -1178,7 +1194,7 @@ var Box = React.forwardRef(function (props, ref) {
1178
1194
  _a["dough-flex-align-content-" + props.alignContent] = props.alignContent,
1179
1195
  _a["dough-flex-align-self-" + props.alignSelf] = props.alignSelf,
1180
1196
  _a)), style: __assign({ width: props.width, height: props.height, minWidth: props.minWidth, minHeight: props.minHeight, maxWidth: props.maxWidth, maxHeight: props.maxHeight, flexBasis: props.basis, flexGrow: props.grow, flexShrink: props.shrink, order: props.order, flex: props.flex, zIndex: props.zIndex, transform: props.transform }, (isTypeObject(props.absolute) &&
1181
- props.absolute)) }, props.dataAttributes, { onScroll: props.onScrollReachedBottom ? handleScroll : undefined, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, onClick: props.onClick }), props.children));
1197
+ props.absolute)) }, props.dataAttributes, { onScroll: props.onScrollReachedBottom ? handleScroll : undefined, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, onMouseMove: props.onMouseMove, onClick: props.onClick }), props.children));
1182
1198
  });
1183
1199
  Box.displayName = "Box";
1184
1200
 
@@ -14,6 +14,6 @@ export declare const ColorButton: import("@storybook/csf").AnnotatedStoryFn<impo
14
14
  export declare const ColorButtonWithoutBorder: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ButtonProps & {
15
15
  width: string;
16
16
  }>;
17
- export declare const ConstrainedButton: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, Pick<ButtonProps, "className" | "children" | "dataAttributes" | "type" | "size" | "color" | "border" | "rounded" | "shadow" | "padding" | "onClick" | "fullWidth" | "disabled" | "alignIconRight" | "linkProps" | "tabIndex" | "name" | "autoFocus" | "icon" | "onDoubleClick" | "onMouseDown" | "onPointerDown" | "allEvents" | "flat" | "busy" | "withoutBackground" | "colorPicker"> & {
17
+ export declare const ConstrainedButton: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, Pick<ButtonProps, "className" | "children" | "dataAttributes" | "type" | "size" | "color" | "border" | "rounded" | "shadow" | "padding" | "onClick" | "onMouseDown" | "onPointerDown" | "allEvents" | "fullWidth" | "disabled" | "alignIconRight" | "linkProps" | "tabIndex" | "name" | "autoFocus" | "icon" | "onDoubleClick" | "flat" | "busy" | "withoutBackground" | "colorPicker"> & {
18
18
  singleLabel: boolean;
19
19
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speakapbv/dough-component-library",
3
- "version": "10.2.1",
3
+ "version": "10.3.1",
4
4
  "description": "DOUGH: Speakap React Component Library",
5
5
  "author": "Speakap",
6
6
  "license": "MIT",