@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.
- package/dist/components/Breadcrumbs.d.ts +1 -0
- package/dist/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +18 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Breadcrumbs.tsx +50 -19
package/dist/index.js
CHANGED
|
@@ -7283,12 +7283,24 @@ function Breadcrumbs({ items, showHome = true }) {
|
|
|
7283
7283
|
return (jsxRuntime.jsxs("nav", { "aria-label": "Breadcrumb", className: "flex items-center space-x-2 text-sm", children: [showHome && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(reactRouterDom.Link, { to: "/", className: "text-ink-500 hover:text-ink-900 transition-colors", "aria-label": "Home", children: jsxRuntime.jsx(lucideReact.Home, { className: "h-4 w-4" }) }), items.length > 0 && jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4 text-ink-400" })] })), items.map((item, index) => {
|
|
7284
7284
|
const isLast = index === items.length - 1;
|
|
7285
7285
|
const isActive = isLast;
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7286
|
+
const content = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.icon && jsxRuntime.jsx("span", { className: "flex-shrink-0", children: item.icon }), jsxRuntime.jsx("span", { children: item.label })] }));
|
|
7287
|
+
const renderBreadcrumb = () => {
|
|
7288
|
+
// Active item (last item) - always render as non-clickable span
|
|
7289
|
+
if (isActive) {
|
|
7290
|
+
return (jsxRuntime.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 }));
|
|
7291
|
+
}
|
|
7292
|
+
// Has href - render as Link, also call onClick if provided
|
|
7293
|
+
if (item.href) {
|
|
7294
|
+
return (jsxRuntime.jsx(reactRouterDom.Link, { 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 }));
|
|
7295
|
+
}
|
|
7296
|
+
// Only onClick (no href) - render as button
|
|
7297
|
+
if (item.onClick) {
|
|
7298
|
+
return (jsxRuntime.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 }));
|
|
7299
|
+
}
|
|
7300
|
+
// Neither href nor onClick - render as non-clickable span
|
|
7301
|
+
return (jsxRuntime.jsx("span", { className: "flex items-center gap-2 text-ink-700 font-medium", children: content }));
|
|
7302
|
+
};
|
|
7303
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [renderBreadcrumb(), !isLast && jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4 text-ink-400" })] }, index));
|
|
7292
7304
|
})] }));
|
|
7293
7305
|
}
|
|
7294
7306
|
|