@versini/ui-button 11.1.1 → 11.2.0

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,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
@@ -1,18 +1,2 @@
1
- import React from "react";
2
- export declare const Button: React.ForwardRefExoticComponent<{
3
- children: React.ReactNode;
4
- disabled?: boolean;
5
- truncate?: boolean;
6
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
7
- variant?: "primary" | "secondary" | "danger" | "selected";
8
- } & {
9
- className?: string;
10
- focusMode?: "dark" | "light" | "system" | "alt-system";
11
- fullWidth?: boolean;
12
- mode?: "dark" | "light" | "system" | "alt-system";
13
- noBorder?: boolean;
14
- noInternalClick?: boolean;
15
- raw?: boolean;
16
- size?: "small" | "medium" | "large";
17
- radius?: "small" | "medium" | "large";
18
- } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
1
+ import type { ButtonTypes } from "@versini/ui-types";
2
+ export declare function Button({ children, disabled, mode, focusMode, fullWidth, className, size, raw, noBorder, variant, truncate, radius, ref, ...otherProps }: ButtonTypes.Props): import("react/jsx-runtime").JSX.Element;
@@ -1,17 +1,14 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
6
6
  import { jsx } from "react/jsx-runtime";
7
- import react from "react";
8
7
  import { BaseButton_private } from "../private/BaseButton.js";
9
8
  import { TYPE_BUTTON, getButtonClasses } from "./utilities.js";
10
9
 
11
10
  ;// CONCATENATED MODULE: external "react/jsx-runtime"
12
11
 
13
- ;// CONCATENATED MODULE: external "react"
14
-
15
12
  ;// CONCATENATED MODULE: external "../private/BaseButton.js"
16
13
 
17
14
  ;// CONCATENATED MODULE: external "./utilities.js"
@@ -20,8 +17,7 @@ import { TYPE_BUTTON, getButtonClasses } from "./utilities.js";
20
17
 
21
18
 
22
19
 
23
-
24
- const Button = /*#__PURE__*/ react.forwardRef(({ children, disabled = false, mode = "system", focusMode = "system", fullWidth = false, className, size = "medium", raw = false, noBorder = false, variant = "primary", truncate = false, radius = "large", ...otherProps }, ref)=>{
20
+ function Button({ children, disabled = false, mode = "system", focusMode = "system", fullWidth = false, className, size = "medium", raw = false, noBorder = false, variant = "primary", truncate = false, radius = "large", ref, ...otherProps }) {
25
21
  const buttonClass = getButtonClasses({
26
22
  type: TYPE_BUTTON,
27
23
  mode,
@@ -43,7 +39,6 @@ const Button = /*#__PURE__*/ react.forwardRef(({ children, disabled = false, mod
43
39
  ...otherProps,
44
40
  children: children
45
41
  });
46
- });
47
- Button.displayName = "Button";
42
+ }
48
43
 
49
44
  export { Button };
@@ -1,4 +1,2 @@
1
- import React from "react";
2
- export declare const ButtonCopy: React.ForwardRefExoticComponent<{
3
- copyToClipboard: string | (() => string);
4
- } & Omit<import("@versini/ui-types").ButtonIconTypes.Props, "children" | "fullWidth" | "size" | "label" | "align"> & React.RefAttributes<HTMLButtonElement>>;
1
+ import type { ButtonCopyTypes } from "@versini/ui-types";
2
+ export declare function ButtonCopy({ copyToClipboard, ref, ...otherProps }: ButtonCopyTypes.Props): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { IconCopied, IconCopy } from "@versini/ui-icons";
8
- import react, { useEffect, useState } from "react";
8
+ import { useEffect, useState } from "react";
9
9
  import { ButtonIcon } from "./ButtonIcon.js";
10
10
 
11
11
  ;// CONCATENATED MODULE: external "react/jsx-runtime"
@@ -21,7 +21,7 @@ import { ButtonIcon } from "./ButtonIcon.js";
21
21
 
22
22
 
23
23
 
24
- const ButtonCopy = /*#__PURE__*/ react.forwardRef(({ copyToClipboard, ...otherProps }, ref)=>{
24
+ function ButtonCopy({ copyToClipboard, ref, ...otherProps }) {
25
25
  const [copied, setCopied] = useState(false);
26
26
  const handleCopyToClipboard = ()=>{
27
27
  if (typeof copyToClipboard === "string") {
@@ -60,7 +60,6 @@ const ButtonCopy = /*#__PURE__*/ react.forwardRef(({ copyToClipboard, ...otherPr
60
60
  size: "size-3"
61
61
  })
62
62
  });
63
- });
64
- ButtonCopy.displayName = "ButtonCopy";
63
+ }
65
64
 
66
65
  export { ButtonCopy };
@@ -1,3 +1,2 @@
1
1
  import type { ButtonIconTypes } from "@versini/ui-types";
2
- import React from "react";
3
- export declare const ButtonIcon: React.ForwardRefExoticComponent<ButtonIconTypes.Props & React.RefAttributes<HTMLButtonElement>>;
2
+ export declare function ButtonIcon({ children, disabled, mode, focusMode, fullWidth, className, type, raw, noBorder, "aria-label": ariaLabel, label, size, labelRight, labelLeft, noBackground, align, radius, variant, iconClassName, animated, ref, ...otherProps }: ButtonIconTypes.Props): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useMergeRefs } from "@versini/ui-hooks/use-merge-refs";
8
8
  import { useResizeObserver } from "@versini/ui-hooks/use-resize-observer";
9
- import react, { useEffect, useLayoutEffect, useRef } from "react";
9
+ import { useEffect, useLayoutEffect, useRef } from "react";
10
10
  import { BaseButton_private } from "../private/BaseButton.js";
11
11
  import { TYPE_ICON, getButtonClasses, getButtonIconLabelClasses, getIconClasses } from "./utilities.js";
12
12
 
@@ -41,7 +41,7 @@ const PADDINGS = {
41
41
  };
42
42
  const BORDERS = 2; // border x 2
43
43
  const ANIMATION_DURATION = 300; // ms - should match the CSS transition duration
44
- const ButtonIcon = /*#__PURE__*/ react.forwardRef(({ children, disabled = false, mode = "system", focusMode = "system", fullWidth = false, className, type = "button", raw = false, noBorder = false, "aria-label": ariaLabel, label, size = "medium", labelRight, labelLeft, noBackground = false, align = "center", radius = "large", variant = "secondary", iconClassName, animated = false, ...otherProps }, ref)=>{
44
+ function ButtonIcon({ children, disabled = false, mode = "system", focusMode = "system", fullWidth = false, className, type = "button", raw = false, noBorder = false, "aria-label": ariaLabel, label, size = "medium", labelRight, labelLeft, noBackground = false, align = "center", radius = "large", variant = "secondary", iconClassName, animated = false, ref, ...otherProps }) {
45
45
  const buttonClass = getButtonClasses({
46
46
  type: TYPE_ICON,
47
47
  mode,
@@ -82,9 +82,9 @@ const ButtonIcon = /*#__PURE__*/ react.forwardRef(({ children, disabled = false,
82
82
  buttonRef
83
83
  ]);
84
84
  /**
85
- * Effect to calculate the buffer to add to the width of the button to
86
- * account for the icon, paddings and borders.
87
- */ useLayoutEffect(()=>{
85
+ * Effect to calculate the buffer to add to the width of the button to
86
+ * account for the icon, paddings and borders.
87
+ */ useLayoutEffect(()=>{
88
88
  /* v8 ignore start */ if (iconRef && iconRef.current && animated) {
89
89
  bufferRef.current = rectIcon.width + PADDINGS[size] + (noBorder ? 0 : BORDERS);
90
90
  // Set initial button width if it hasn't been set yet
@@ -100,9 +100,9 @@ const ButtonIcon = /*#__PURE__*/ react.forwardRef(({ children, disabled = false,
100
100
  animated
101
101
  ]);
102
102
  /**
103
- * Effect to update the width of the button based on the visibility of
104
- * the right and left labels.
105
- */ useLayoutEffect(()=>{
103
+ * Effect to update the width of the button based on the visibility of
104
+ * the right and left labels.
105
+ */ useLayoutEffect(()=>{
106
106
  /* v8 ignore start */ if (buttonRef && buttonRef.current && animated) {
107
107
  // Calculate the target width first
108
108
  let newWidth = WIDTH[size];
@@ -199,7 +199,7 @@ const ButtonIcon = /*#__PURE__*/ react.forwardRef(({ children, disabled = false,
199
199
  ]
200
200
  })
201
201
  });
202
- });
202
+ }
203
203
  const ButtonLabel = ({ labelRef, labelClass, label, labelInnerClass, initiallyHidden = false })=>{
204
204
  return /*#__PURE__*/ jsx("span", {
205
205
  ref: labelRef,
@@ -213,6 +213,5 @@ const ButtonLabel = ({ labelRef, labelClass, label, labelInnerClass, initiallyHi
213
213
  })
214
214
  });
215
215
  };
216
- ButtonIcon.displayName = "ButtonIcon";
217
216
 
218
217
  export { ButtonIcon };
@@ -1,22 +1,2 @@
1
- import React from "react";
2
- export declare const ButtonLink: React.ForwardRefExoticComponent<{
3
- noNewWindowIcon?: boolean;
4
- href?: string;
5
- target?: "_blank" | "_self" | "_parent" | "_top";
6
- } & {
7
- children: React.ReactNode;
8
- disabled?: boolean;
9
- truncate?: boolean;
10
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
11
- variant?: "primary" | "secondary" | "danger" | "selected";
12
- } & {
13
- className?: string;
14
- focusMode?: "dark" | "light" | "system" | "alt-system";
15
- fullWidth?: boolean;
16
- mode?: "dark" | "light" | "system" | "alt-system";
17
- noBorder?: boolean;
18
- noInternalClick?: boolean;
19
- raw?: boolean;
20
- size?: "small" | "medium" | "large";
21
- radius?: "small" | "medium" | "large";
22
- } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
1
+ import type { ButtonLinkTypes } from "@versini/ui-types";
2
+ export declare function ButtonLink({ children, mode, focusMode, fullWidth, className, size, raw, noBorder, target, truncate, noNewWindowIcon, radius, ref, ...otherProps }: ButtonLinkTypes.Props): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +1,23 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import clsx from "clsx";
8
- import react from "react";
9
8
  import { TYPE_LINK, getButtonClasses } from "./utilities.js";
10
9
 
11
10
  ;// CONCATENATED MODULE: external "react/jsx-runtime"
12
11
 
13
12
  ;// CONCATENATED MODULE: external "clsx"
14
13
 
15
- ;// CONCATENATED MODULE: external "react"
16
-
17
14
  ;// CONCATENATED MODULE: external "./utilities.js"
18
15
 
19
16
  ;// CONCATENATED MODULE: ./src/components/Button/ButtonLink.tsx
20
17
 
21
18
 
22
19
 
23
-
24
- const ButtonLink = /*#__PURE__*/ react.forwardRef(({ children, mode = "system", focusMode = "system", fullWidth = false, className, size = "small", raw = false, noBorder = false, target, truncate = false, noNewWindowIcon = false, radius = "large", ...otherProps }, ref)=>{
20
+ function ButtonLink({ children, mode = "system", focusMode = "system", fullWidth = false, className, size = "small", raw = false, noBorder = false, target, truncate = false, noNewWindowIcon = false, radius = "large", ref, ...otherProps }) {
25
21
  const buttonClass = getButtonClasses({
26
22
  type: TYPE_LINK,
27
23
  mode,
@@ -80,7 +76,6 @@ const ButtonLink = /*#__PURE__*/ react.forwardRef(({ children, mode = "system",
80
76
  ]
81
77
  })
82
78
  });
83
- });
84
- ButtonLink.displayName = "ButtonLink";
79
+ }
85
80
 
86
81
  export { ButtonLink };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
@@ -1,18 +1,2 @@
1
- import React from "react";
2
- export declare const BaseButton_private: React.ForwardRefExoticComponent<{
3
- children: React.ReactNode;
4
- disabled?: boolean;
5
- truncate?: boolean;
6
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
7
- variant?: "primary" | "secondary" | "danger" | "selected";
8
- } & {
9
- className?: string;
10
- focusMode?: "dark" | "light" | "system" | "alt-system";
11
- fullWidth?: boolean;
12
- mode?: "dark" | "light" | "system" | "alt-system";
13
- noBorder?: boolean;
14
- noInternalClick?: boolean;
15
- raw?: boolean;
16
- size?: "small" | "medium" | "large";
17
- radius?: "small" | "medium" | "large";
18
- } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
1
+ import type { ButtonTypes } from "@versini/ui-types";
2
+ export declare function BaseButton_private(buttonProps: ButtonTypes.Props): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
6
6
  import { jsx } from "react/jsx-runtime";
7
- import react from "react";
7
+ import "react";
8
8
 
9
9
  ;// CONCATENATED MODULE: external "react/jsx-runtime"
10
10
 
@@ -33,8 +33,8 @@ import react from "react";
33
33
  }
34
34
  typeof onClick === "function" && onClick(e);
35
35
  };
36
- /* c8 ignore end */ const BaseButton_private = /*#__PURE__*/ react.forwardRef((buttonProps, ref)=>{
37
- const { onClick, noInternalClick = false, ...otherProps } = buttonProps;
36
+ /* c8 ignore end */ function BaseButton_private(buttonProps) {
37
+ const { onClick, noInternalClick = false, ref, ...otherProps } = buttonProps;
38
38
  return /*#__PURE__*/ jsx("button", {
39
39
  ref: ref,
40
40
  onClick: (e)=>{
@@ -42,7 +42,6 @@ import react from "react";
42
42
  },
43
43
  ...otherProps
44
44
  });
45
- });
46
- BaseButton_private.displayName = "BaseButton";
45
+ }
47
46
 
48
47
  export { BaseButton_private };
@@ -1,3 +1,2 @@
1
1
  import type { ButtonSortTypes } from "@versini/ui-types";
2
- import React from "react";
3
- export declare const ButtonSort_private: React.ForwardRefExoticComponent<ButtonSortTypes.Props & React.RefAttributes<HTMLButtonElement>>;
2
+ export declare function ButtonSort_private({ children, mode, className, active, ref, ...otherProps }: ButtonSortTypes.Props): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +1,23 @@
1
1
  /*!
2
- @versini/ui-button v11.1.1
2
+ @versini/ui-button v11.2.0
3
3
  © 2025 gizmette.com
4
4
  */
5
5
 
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import clsx from "clsx";
8
- import react from "react";
9
8
  import { ButtonIcon } from "../Button/ButtonIcon.js";
10
9
 
11
10
  ;// CONCATENATED MODULE: external "react/jsx-runtime"
12
11
 
13
12
  ;// CONCATENATED MODULE: external "clsx"
14
13
 
15
- ;// CONCATENATED MODULE: external "react"
16
-
17
14
  ;// CONCATENATED MODULE: external "../Button/ButtonIcon.js"
18
15
 
19
16
  ;// CONCATENATED MODULE: ./src/components/private/ButtonSort.tsx
20
17
 
21
18
 
22
19
 
23
-
24
- const ButtonSort_private = /*#__PURE__*/ react.forwardRef(({ children, mode = "system", className, active = false, ...otherProps }, ref)=>{
20
+ function ButtonSort_private({ children, mode = "system", className, active = false, ref, ...otherProps }) {
25
21
  const activeClass = active ? clsx("relative", "focus-within:static", "focus-within:after:border-transparent", "after:absolute", "after:content-['']", "after:border-b-2", "after:-bottom-1", "after:left-0", "after:right-0", {
26
22
  "after:border-table-light": mode === "dark",
27
23
  "after:border-table-dark": mode === "light",
@@ -41,7 +37,6 @@ const ButtonSort_private = /*#__PURE__*/ react.forwardRef(({ children, mode = "s
41
37
  children: children
42
38
  })
43
39
  });
44
- });
45
- ButtonSort_private.displayName = "ButtonSort";
40
+ }
46
41
 
47
42
  export { ButtonSort_private };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-button",
3
- "version": "11.1.1",
3
+ "version": "11.2.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@testing-library/jest-dom": "6.9.1",
66
- "@versini/ui-types": "8.1.1"
66
+ "@versini/ui-types": "8.2.0"
67
67
  },
68
68
  "dependencies": {
69
69
  "@tailwindcss/typography": "0.5.19",
@@ -75,5 +75,5 @@
75
75
  "sideEffects": [
76
76
  "**/*.css"
77
77
  ],
78
- "gitHead": "a3730974df8fcea3c016bd83844c4243dbb10208"
78
+ "gitHead": "5cc3c9aaf61ca3843f16a3d6b322a92f7fb210ca"
79
79
  }