@speakapbv/dough-component-library 10.3.0 → 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.
@@ -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,
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,
@@ -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.3.0",
3
+ "version": "10.3.1",
4
4
  "description": "DOUGH: Speakap React Component Library",
5
5
  "author": "Speakap",
6
6
  "license": "MIT",