@particle-academy/react-fancy 4.10.0 → 4.11.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
2
+ import { ButtonHTMLAttributes, ElementType, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, 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,14 @@ interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "col
59
59
  disabled?: boolean;
60
60
  /** Render as anchor tag */
61
61
  href?: string;
62
+ /**
63
+ * Anchor-mode element override — the component to render INSTEAD of the
64
+ * plain `<a>` when `href` is set, e.g. a router's `<Link>` (Inertia, React
65
+ * Router, Next) so the button navigates client-side. Receives `href`,
66
+ * `className`, and the forwarded rest props. Ignored without `href` or when
67
+ * `disabled` (the plain `<button>` renders as always).
68
+ */
69
+ as?: ElementType;
62
70
  /** Anchor `target` — only applies in `href` (anchor) mode. */
63
71
  target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
64
72
  /** Anchor `rel` — only applies in `href` (anchor) mode. */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, TdHTMLAttributes, HTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
2
+ import { ButtonHTMLAttributes, ElementType, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, 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,14 @@ interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "col
59
59
  disabled?: boolean;
60
60
  /** Render as anchor tag */
61
61
  href?: string;
62
+ /**
63
+ * Anchor-mode element override — the component to render INSTEAD of the
64
+ * plain `<a>` when `href` is set, e.g. a router's `<Link>` (Inertia, React
65
+ * Router, Next) so the button navigates client-side. Receives `href`,
66
+ * `className`, and the forwarded rest props. Ignored without `href` or when
67
+ * `disabled` (the plain `<button>` renders as always).
68
+ */
69
+ as?: ElementType;
62
70
  /** Anchor `target` — only applies in `href` (anchor) mode. */
63
71
  target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
64
72
  /** Anchor `rel` — only applies in `href` (anchor) mode. */
package/dist/index.js CHANGED
@@ -2419,6 +2419,7 @@ var Button = forwardRef(
2419
2419
  loading = false,
2420
2420
  disabled,
2421
2421
  href,
2422
+ as: As,
2422
2423
  responsive,
2423
2424
  labelClassName,
2424
2425
  ...props
@@ -2581,11 +2582,12 @@ var Button = forwardRef(
2581
2582
  trailingElements
2582
2583
  ] });
2583
2584
  const safeHref = sanitizeHref(href);
2585
+ const Anchor = As ?? "a";
2584
2586
  const buttonEl = safeHref && !disabled ? (
2585
2587
  // Anchor mode forwards the same rest props as the <button> branch so
2586
2588
  // onClick / target / rel / ref / ARIA / data-* reach the <a> (issue #7).
2587
2589
  /* @__PURE__ */ jsx(
2588
- "a",
2590
+ Anchor,
2589
2591
  {
2590
2592
  ref,
2591
2593
  href: safeHref,