@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
|
@@ -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,
|
|
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
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
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
|
|