@particle-academy/react-fancy 4.16.0 → 4.17.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
@@ -1831,10 +1831,19 @@ interface BreadcrumbsItemProps {
1831
1831
  children: ReactNode;
1832
1832
  href?: string;
1833
1833
  active?: boolean;
1834
+ /**
1835
+ * Navigate by callback instead of by URL, for a crumb with no href.
1836
+ *
1837
+ * Controlled components own their own navigation — a repository browser
1838
+ * walking directories, a wizard stepping back — and have no address to link
1839
+ * to. Renders the crumb as a `<button>`. Ignored when `active`, since the
1840
+ * current crumb is not a destination, and `href` wins if both are given.
1841
+ */
1842
+ onClick?: () => void;
1834
1843
  className?: string;
1835
1844
  }
1836
1845
 
1837
- declare function BreadcrumbsItem({ children, href, active, className, }: BreadcrumbsItemProps): react.JSX.Element;
1846
+ declare function BreadcrumbsItem({ children, href, active, onClick, className, }: BreadcrumbsItemProps): react.JSX.Element;
1838
1847
  declare namespace BreadcrumbsItem {
1839
1848
  var displayName: string;
1840
1849
  }
package/dist/index.d.ts CHANGED
@@ -1831,10 +1831,19 @@ interface BreadcrumbsItemProps {
1831
1831
  children: ReactNode;
1832
1832
  href?: string;
1833
1833
  active?: boolean;
1834
+ /**
1835
+ * Navigate by callback instead of by URL, for a crumb with no href.
1836
+ *
1837
+ * Controlled components own their own navigation — a repository browser
1838
+ * walking directories, a wizard stepping back — and have no address to link
1839
+ * to. Renders the crumb as a `<button>`. Ignored when `active`, since the
1840
+ * current crumb is not a destination, and `href` wins if both are given.
1841
+ */
1842
+ onClick?: () => void;
1834
1843
  className?: string;
1835
1844
  }
1836
1845
 
1837
- declare function BreadcrumbsItem({ children, href, active, className, }: BreadcrumbsItemProps): react.JSX.Element;
1846
+ declare function BreadcrumbsItem({ children, href, active, onClick, className, }: BreadcrumbsItemProps): react.JSX.Element;
1838
1847
  declare namespace BreadcrumbsItem {
1839
1848
  var displayName: string;
1840
1849
  }
package/dist/index.js CHANGED
@@ -9349,6 +9349,7 @@ function BreadcrumbsItem({
9349
9349
  children,
9350
9350
  href,
9351
9351
  active = false,
9352
+ onClick,
9352
9353
  className
9353
9354
  }) {
9354
9355
  const baseClass = cn(
@@ -9359,6 +9360,18 @@ function BreadcrumbsItem({
9359
9360
  if (href && !active) {
9360
9361
  return /* @__PURE__ */ jsx("a", { "data-react-fancy-breadcrumbs-item": "", href, className: baseClass, children });
9361
9362
  }
9363
+ if (onClick && !active) {
9364
+ return /* @__PURE__ */ jsx(
9365
+ "button",
9366
+ {
9367
+ type: "button",
9368
+ "data-react-fancy-breadcrumbs-item": "",
9369
+ onClick,
9370
+ className: cn(baseClass, "cursor-pointer border-0 bg-transparent p-0"),
9371
+ children
9372
+ }
9373
+ );
9374
+ }
9362
9375
  return /* @__PURE__ */ jsx("span", { "data-react-fancy-breadcrumbs-item": "", className: baseClass, "aria-current": active ? "page" : void 0, children });
9363
9376
  }
9364
9377
  BreadcrumbsItem.displayName = "BreadcrumbsItem";