@papernote/ui 1.7.0 → 1.7.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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  export interface BreadcrumbItem {
3
3
  label: string;
4
4
  href?: string;
5
+ onClick?: () => void;
5
6
  icon?: React.ReactNode;
6
7
  }
7
8
  export interface BreadcrumbsProps {
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/components/Breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,QAAe,EAAE,EAAE,gBAAgB,2CAoD/E"}
1
+ {"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/components/Breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,QAAe,EAAE,EAAE,gBAAgB,2CAkF/E"}
package/dist/index.d.ts CHANGED
@@ -2721,6 +2721,7 @@ declare function Hide({ children, above, below, only, className }: ResponsivePro
2721
2721
  interface BreadcrumbItem {
2722
2722
  label: string;
2723
2723
  href?: string;
2724
+ onClick?: () => void;
2724
2725
  icon?: React__default.ReactNode;
2725
2726
  }
2726
2727
  interface BreadcrumbsProps {
package/dist/index.esm.js CHANGED
@@ -7263,12 +7263,24 @@ function Breadcrumbs({ items, showHome = true }) {
7263
7263
  return (jsxs("nav", { "aria-label": "Breadcrumb", className: "flex items-center space-x-2 text-sm", children: [showHome && (jsxs(Fragment, { children: [jsx(Link$1, { to: "/", className: "text-ink-500 hover:text-ink-900 transition-colors", "aria-label": "Home", children: jsx(Home, { className: "h-4 w-4" }) }), items.length > 0 && jsx(ChevronRight, { className: "h-4 w-4 text-ink-400" })] })), items.map((item, index) => {
7264
7264
  const isLast = index === items.length - 1;
7265
7265
  const isActive = isLast;
7266
- return (jsxs(React__default.Fragment, { children: [item.href && !isActive ? (jsxs(Link$1, { to: item.href, className: "flex items-center gap-2 text-ink-500 hover:text-ink-900 hover:underline transition-colors", children: [item.icon && jsx("span", { className: "flex-shrink-0", children: item.icon }), jsx("span", { children: item.label })] })) : (jsxs("span", { className: `
7267
- flex items-center gap-2 px-2 py-1 rounded-md transition-colors
7268
- ${isActive
7269
- ? 'bg-accent-50 text-accent-900 font-semibold'
7270
- : 'text-ink-700 font-medium'}
7271
- `, "aria-current": isActive ? 'page' : undefined, children: [item.icon && jsx("span", { className: "flex-shrink-0", children: item.icon }), jsx("span", { children: item.label })] })), !isLast && jsx(ChevronRight, { className: "h-4 w-4 text-ink-400" })] }, index));
7266
+ const content = (jsxs(Fragment, { children: [item.icon && jsx("span", { className: "flex-shrink-0", children: item.icon }), jsx("span", { children: item.label })] }));
7267
+ const renderBreadcrumb = () => {
7268
+ // Active item (last item) - always render as non-clickable span
7269
+ if (isActive) {
7270
+ return (jsx("span", { className: "flex items-center gap-2 px-2 py-1 rounded-md bg-accent-50 text-accent-900 font-semibold transition-colors", "aria-current": "page", children: content }));
7271
+ }
7272
+ // Has href - render as Link, also call onClick if provided
7273
+ if (item.href) {
7274
+ return (jsx(Link$1, { to: item.href, onClick: item.onClick, className: "flex items-center gap-2 text-ink-500 hover:text-ink-900 hover:underline transition-colors", children: content }));
7275
+ }
7276
+ // Only onClick (no href) - render as button
7277
+ if (item.onClick) {
7278
+ return (jsx("button", { type: "button", onClick: item.onClick, className: "flex items-center gap-2 text-ink-500 hover:text-ink-900 hover:underline transition-colors bg-transparent border-none cursor-pointer p-0", children: content }));
7279
+ }
7280
+ // Neither href nor onClick - render as non-clickable span
7281
+ return (jsx("span", { className: "flex items-center gap-2 text-ink-700 font-medium", children: content }));
7282
+ };
7283
+ return (jsxs(React__default.Fragment, { children: [renderBreadcrumb(), !isLast && jsx(ChevronRight, { className: "h-4 w-4 text-ink-400" })] }, index));
7272
7284
  })] }));
7273
7285
  }
7274
7286