@particle-academy/react-fancy 4.4.6 → 4.4.7

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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
2
+ import { ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
3
3
  import { ClassValue } from 'clsx';
4
4
 
5
5
  type Size = "xs" | "sm" | "md" | "lg" | "xl";
@@ -59,6 +59,12 @@ interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "col
59
59
  disabled?: boolean;
60
60
  /** Render as anchor tag */
61
61
  href?: string;
62
+ /** Anchor `target` — only applies in `href` (anchor) mode. */
63
+ target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
64
+ /** Anchor `rel` — only applies in `href` (anchor) mode. */
65
+ rel?: AnchorHTMLAttributes<HTMLAnchorElement>["rel"];
66
+ /** Anchor `download` — only applies in `href` (anchor) mode. */
67
+ download?: AnchorHTMLAttributes<HTMLAnchorElement>["download"];
62
68
  /**
63
69
  * Collapse to icon-only when squeezed — injects the minimal Tailwind classes
64
70
  * (`sr-only sm:not-sr-only`) onto the label so it stays screen-reader
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
2
+ import { ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
3
3
  import { ClassValue } from 'clsx';
4
4
 
5
5
  type Size = "xs" | "sm" | "md" | "lg" | "xl";
@@ -59,6 +59,12 @@ interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "col
59
59
  disabled?: boolean;
60
60
  /** Render as anchor tag */
61
61
  href?: string;
62
+ /** Anchor `target` — only applies in `href` (anchor) mode. */
63
+ target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
64
+ /** Anchor `rel` — only applies in `href` (anchor) mode. */
65
+ rel?: AnchorHTMLAttributes<HTMLAnchorElement>["rel"];
66
+ /** Anchor `download` — only applies in `href` (anchor) mode. */
67
+ download?: AnchorHTMLAttributes<HTMLAnchorElement>["download"];
62
68
  /**
63
69
  * Collapse to icon-only when squeezed — injects the minimal Tailwind classes
64
70
  * (`sr-only sm:not-sr-only`) onto the label so it stays screen-reader
package/dist/index.js CHANGED
@@ -2567,7 +2567,22 @@ var Button = forwardRef(
2567
2567
  trailingElements
2568
2568
  ] });
2569
2569
  const safeHref = sanitizeHref(href);
2570
- const buttonEl = safeHref && !disabled ? /* @__PURE__ */ jsx("a", { href: safeHref, className: classes, "data-react-fancy-button": "", "data-react-fancy-action": "", children: content }) : /* @__PURE__ */ jsx(
2570
+ const buttonEl = safeHref && !disabled ? (
2571
+ // Anchor mode forwards the same rest props as the <button> branch so
2572
+ // onClick / target / rel / ref / ARIA / data-* reach the <a> (issue #7).
2573
+ /* @__PURE__ */ jsx(
2574
+ "a",
2575
+ {
2576
+ ref,
2577
+ href: safeHref,
2578
+ className: classes,
2579
+ "data-react-fancy-button": "",
2580
+ "data-react-fancy-action": "",
2581
+ ...props,
2582
+ children: content
2583
+ }
2584
+ )
2585
+ ) : /* @__PURE__ */ jsx(
2571
2586
  "button",
2572
2587
  {
2573
2588
  ref,