@papernote/ui 1.7.2 → 1.7.4
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 +3 -0
- package/dist/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/Calendar.d.ts +3 -1
- package/dist/components/Calendar.d.ts.map +1 -1
- package/dist/components/FormWizard.d.ts.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.esm.js +48 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +46 -16
- package/dist/index.js.map +1 -1
- package/dist/styles.css +0 -4
- package/package.json +1 -1
- package/src/components/Breadcrumbs.tsx +66 -22
- package/src/components/Calendar.tsx +21 -10
- package/src/components/FormWizard.tsx +1 -2
|
@@ -10,6 +10,9 @@ export interface BreadcrumbNavigationState {
|
|
|
10
10
|
* Hook to detect breadcrumb navigation and trigger callbacks.
|
|
11
11
|
* Use this in host components to reset state when a breadcrumb is clicked.
|
|
12
12
|
*
|
|
13
|
+
* Note: This hook requires React Router context. If used outside a Router,
|
|
14
|
+
* it will be a no-op (the callback will never be called).
|
|
15
|
+
*
|
|
13
16
|
* @param onReset - Callback fired when breadcrumb navigation is detected
|
|
14
17
|
*
|
|
15
18
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/components/Breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,gDAAgD;AAChD,MAAM,WAAW,yBAAyB;IACxC,oEAAoE;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,IAAI,EAAE,YAAY,CAAC;CACpB;AAED
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/components/Breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,gDAAgD;AAChD,MAAM,WAAW,yBAAyB;IACxC,oEAAoE;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAiB5D;AAED,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gDAAgD;IAChD,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,QAAe,EAAE,EAAE,gBAAgB,2CAyJ/E"}
|
|
@@ -9,6 +9,8 @@ export interface CalendarProps {
|
|
|
9
9
|
value?: Date;
|
|
10
10
|
/** Callback when date is selected */
|
|
11
11
|
onChange?: (date: Date) => void;
|
|
12
|
+
/** Callback when displayed month changes (via navigation buttons or goToToday) */
|
|
13
|
+
onMonthChange?: (date: Date) => void;
|
|
12
14
|
/** Events to display on calendar */
|
|
13
15
|
events?: CalendarEvent[];
|
|
14
16
|
/** Callback when event marker is clicked */
|
|
@@ -38,5 +40,5 @@ export interface CalendarProps {
|
|
|
38
40
|
/** Custom class name */
|
|
39
41
|
className?: string;
|
|
40
42
|
}
|
|
41
|
-
export default function Calendar({ value, onChange, events, onEventClick, rangeMode, rangeValue, onRangeChange, minDate, maxDate, disabledDates, showWeekNumbers, firstDayOfWeek, className, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export default function Calendar({ value, onChange, onMonthChange, events, onEventClick, rangeMode, rangeValue, onRangeChange, minDate, maxDate, disabledDates, showWeekNumbers, firstDayOfWeek, className, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
42
44
|
//# sourceMappingURL=Calendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/components/Calendar.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,oBAAoB;IACpB,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,qCAAqC;IACrC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,oCAAoC;IACpC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,kCAAkC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;QAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,CAAC;IACtD,sCAAsC;IACtC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;QAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1E,8BAA8B;IAC9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E,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,UAAU,EACV,YAAY,EACZ,eAAsB,EACtB,SAAiB,EACjB,SAAc,GACf,EAAE,eAAe,2CA4KjB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1746,6 +1746,8 @@ interface CalendarProps {
|
|
|
1746
1746
|
value?: Date;
|
|
1747
1747
|
/** Callback when date is selected */
|
|
1748
1748
|
onChange?: (date: Date) => void;
|
|
1749
|
+
/** Callback when displayed month changes (via navigation buttons or goToToday) */
|
|
1750
|
+
onMonthChange?: (date: Date) => void;
|
|
1749
1751
|
/** Events to display on calendar */
|
|
1750
1752
|
events?: CalendarEvent[];
|
|
1751
1753
|
/** Callback when event marker is clicked */
|
|
@@ -1775,7 +1777,7 @@ interface CalendarProps {
|
|
|
1775
1777
|
/** Custom class name */
|
|
1776
1778
|
className?: string;
|
|
1777
1779
|
}
|
|
1778
|
-
declare function Calendar({ value, onChange, events, onEventClick, rangeMode, rangeValue, onRangeChange, minDate, maxDate, disabledDates, showWeekNumbers, firstDayOfWeek, className, }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
1780
|
+
declare function Calendar({ value, onChange, onMonthChange, events, onEventClick, rangeMode, rangeValue, onRangeChange, minDate, maxDate, disabledDates, showWeekNumbers, firstDayOfWeek, className, }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
1779
1781
|
|
|
1780
1782
|
interface TimelineItem {
|
|
1781
1783
|
id: string;
|
|
@@ -2729,6 +2731,9 @@ interface BreadcrumbNavigationState {
|
|
|
2729
2731
|
* Hook to detect breadcrumb navigation and trigger callbacks.
|
|
2730
2732
|
* Use this in host components to reset state when a breadcrumb is clicked.
|
|
2731
2733
|
*
|
|
2734
|
+
* Note: This hook requires React Router context. If used outside a Router,
|
|
2735
|
+
* it will be a no-op (the callback will never be called).
|
|
2736
|
+
*
|
|
2732
2737
|
* @param onReset - Callback fired when breadcrumb navigation is detected
|
|
2733
2738
|
*
|
|
2734
2739
|
* @example
|
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, useId, useImperativeHandle, useMemo, Children, isValidElement, cloneElement, Component, createContext as createContext$1, useLayoutEffect, createElement, useContext, useReducer } from 'react';
|
|
4
|
-
import { Loader2, X, EyeOff, Eye, AlertTriangle, CheckCircle, AlertCircle, ChevronDown, Search, Check, Minus, Star, Calendar as Calendar$1, ChevronLeft, ChevronRight, Clock, ChevronUp, Plus, TrendingUp, TrendingDown, Info, Trash2,
|
|
4
|
+
import { Loader2, X, EyeOff, Eye, AlertTriangle, CheckCircle, AlertCircle, ChevronDown, Search, Check, Minus, Star, Calendar as Calendar$1, ChevronLeft, ChevronRight, Clock, ChevronUp, Plus, TrendingUp, TrendingDown, Info, Trash2, ChevronsLeft, ChevronsRight, Circle, MoreVertical, GripVertical, Upload, Bold, Italic, Underline, List, ListOrdered, Code, Link, Home, FileText, Image, File as File$1, Menu as Menu$1, ArrowDown, User, Settings, LogOut, Moon, Sun, Bell, Edit, Trash, Pin, PinOff, Download, Save, ArrowUpDown, Filter, XCircle, BarChart3, MessageSquare } from 'lucide-react';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
|
-
import { useNavigate, useLocation, Link as Link$1 } from 'react-router-dom';
|
|
6
|
+
import { useInRouterContext, useNavigate, useLocation, Link as Link$1 } from 'react-router-dom';
|
|
7
7
|
|
|
8
8
|
function _mergeNamespaces(n, m) {
|
|
9
9
|
m.forEach(function (e) {
|
|
@@ -4220,7 +4220,7 @@ function Stepper({ steps, activeStep, completedSteps = [], orientation = 'horizo
|
|
|
4220
4220
|
`, children: steps.map((step, index) => renderStep(step, index)) }));
|
|
4221
4221
|
}
|
|
4222
4222
|
|
|
4223
|
-
function Calendar({ value, onChange, events = [], onEventClick, rangeMode = false, rangeValue, onRangeChange, minDate, maxDate, disabledDates = [], showWeekNumbers = false, firstDayOfWeek = 0, className = '', }) {
|
|
4223
|
+
function Calendar({ value, onChange, onMonthChange, events = [], onEventClick, rangeMode = false, rangeValue, onRangeChange, minDate, maxDate, disabledDates = [], showWeekNumbers = false, firstDayOfWeek = 0, className = '', }) {
|
|
4224
4224
|
const [currentMonth, setCurrentMonth] = useState(value || new Date());
|
|
4225
4225
|
const [hoverDate, setHoverDate] = useState(null);
|
|
4226
4226
|
// Generate calendar grid for current month
|
|
@@ -4344,21 +4344,31 @@ function Calendar({ value, onChange, events = [], onEventClick, rangeMode = fals
|
|
|
4344
4344
|
};
|
|
4345
4345
|
// Navigate months
|
|
4346
4346
|
const previousMonth = () => {
|
|
4347
|
-
|
|
4347
|
+
const newMonth = new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1);
|
|
4348
|
+
setCurrentMonth(newMonth);
|
|
4349
|
+
onMonthChange?.(newMonth);
|
|
4348
4350
|
};
|
|
4349
4351
|
const nextMonth = () => {
|
|
4350
|
-
|
|
4352
|
+
const newMonth = new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1);
|
|
4353
|
+
setCurrentMonth(newMonth);
|
|
4354
|
+
onMonthChange?.(newMonth);
|
|
4351
4355
|
};
|
|
4352
4356
|
// Navigate years
|
|
4353
4357
|
const previousYear = () => {
|
|
4354
|
-
|
|
4358
|
+
const newMonth = new Date(currentMonth.getFullYear() - 1, currentMonth.getMonth(), 1);
|
|
4359
|
+
setCurrentMonth(newMonth);
|
|
4360
|
+
onMonthChange?.(newMonth);
|
|
4355
4361
|
};
|
|
4356
4362
|
const nextYear = () => {
|
|
4357
|
-
|
|
4363
|
+
const newMonth = new Date(currentMonth.getFullYear() + 1, currentMonth.getMonth(), 1);
|
|
4364
|
+
setCurrentMonth(newMonth);
|
|
4365
|
+
onMonthChange?.(newMonth);
|
|
4358
4366
|
};
|
|
4359
4367
|
// Go to today
|
|
4360
4368
|
const goToToday = () => {
|
|
4361
|
-
|
|
4369
|
+
const today = new Date();
|
|
4370
|
+
setCurrentMonth(today);
|
|
4371
|
+
onMonthChange?.(today);
|
|
4362
4372
|
};
|
|
4363
4373
|
// Day names
|
|
4364
4374
|
const dayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
@@ -4371,7 +4381,7 @@ function Calendar({ value, onChange, events = [], onEventClick, rangeMode = fals
|
|
|
4371
4381
|
error: 'bg-error-500',
|
|
4372
4382
|
accent: 'bg-accent-500',
|
|
4373
4383
|
};
|
|
4374
|
-
return (jsxs("div", { className: `bg-white rounded-lg border border-paper-200 shadow-sm ${className}`, children: [jsxs("div", { className: "flex items-center justify-between p-4 border-b border-paper-200", children: [jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4384
|
+
return (jsxs("div", { className: `bg-white rounded-lg border border-paper-200 shadow-sm ${className}`, children: [jsxs("div", { className: "flex items-center justify-between p-4 border-b border-paper-200", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("button", { onClick: previousYear, className: "p-1.5 hover:bg-paper-100 rounded transition-colors", "aria-label": "Previous year", children: jsx(ChevronsLeft, { className: "h-4 w-4 text-ink-600" }) }), jsx("button", { onClick: previousMonth, className: "p-1.5 hover:bg-paper-100 rounded transition-colors", "aria-label": "Previous month", children: jsx(ChevronLeft, { className: "h-4 w-4 text-ink-600" }) })] }), jsxs("div", { className: "flex items-center gap-3", children: [jsx("h2", { className: "text-lg font-semibold text-ink-900", children: currentMonth.toLocaleDateString('en-US', { month: 'long', year: 'numeric' }) }), jsx("button", { onClick: goToToday, className: "px-3 py-1 text-sm font-medium text-accent-700 hover:bg-accent-50 rounded transition-colors", children: "Today" })] }), jsxs("div", { className: "flex items-center gap-2", children: [jsx("button", { onClick: nextMonth, className: "p-1.5 hover:bg-paper-100 rounded transition-colors", "aria-label": "Next month", children: jsx(ChevronRight, { className: "h-4 w-4 text-ink-600" }) }), jsx("button", { onClick: nextYear, className: "p-1.5 hover:bg-paper-100 rounded transition-colors", "aria-label": "Next year", children: jsx(ChevronsRight, { className: "h-4 w-4 text-ink-600" }) })] })] }), jsx("div", { className: "p-4", children: jsxs("div", { className: "grid grid-cols-7 gap-1", children: [showWeekNumbers && jsx("div", { className: "h-8" }), adjustedDayNames.map((day) => (jsx("div", { className: "h-8 flex items-center justify-center text-xs font-semibold text-ink-600", children: day }, day))), Array.from({ length: 6 }).map((_, weekIndex) => (jsxs(React__default.Fragment, { children: [showWeekNumbers && (jsx("div", { className: "flex items-center justify-center text-xs text-ink-500 font-medium", children: getWeekNumber(calendarDays[weekIndex * 7]) })), calendarDays.slice(weekIndex * 7, weekIndex * 7 + 7).map((date, dayIndex) => {
|
|
4375
4385
|
const dateEvents = getEventsForDate(date);
|
|
4376
4386
|
const selected = isSelected(date);
|
|
4377
4387
|
const inRange = isInRange(date);
|
|
@@ -5358,7 +5368,6 @@ function FormWizard({ steps, onComplete, onStepChange, showStepNumbers = true, a
|
|
|
5358
5368
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
5359
5369
|
const isFirstStep = currentStep === 0;
|
|
5360
5370
|
const isLastStep = currentStep === steps.length - 1;
|
|
5361
|
-
const canGoNext = allowSkip || completedSteps.has(currentStep);
|
|
5362
5371
|
// Go to specific step
|
|
5363
5372
|
const goToStep = (stepIndex) => {
|
|
5364
5373
|
if (stepIndex < 0 || stepIndex >= steps.length)
|
|
@@ -5430,7 +5439,7 @@ function FormWizard({ steps, onComplete, onStepChange, showStepNumbers = true, a
|
|
|
5430
5439
|
? 'bg-accent-500'
|
|
5431
5440
|
: 'bg-paper-200'}
|
|
5432
5441
|
` }) }))] }, step.id));
|
|
5433
|
-
}) }) }), jsx("div", { className: "mb-8", children: steps.map((step, index) => (jsx("div", { hidden: index !== currentStep, children: step.content }, step.id))) }), jsxs("div", { className: "flex items-center justify-between pt-6 border-t border-paper-200", children: [jsx("button", { type: "button", onClick: prevStep, disabled: isFirstStep, className: "px-4 py-2 text-sm font-medium text-ink-700 bg-white border border-paper-300 rounded-lg hover:bg-paper-50 disabled:opacity-40 disabled:cursor-not-allowed transition-all", children: "Previous" }), jsxs("div", { className: "text-sm text-ink-600", children: ["Step ", currentStep + 1, " of ", steps.length] }), jsx("button", { type: "button", onClick: nextStep, disabled:
|
|
5442
|
+
}) }) }), jsx("div", { className: "mb-8", children: steps.map((step, index) => (jsx("div", { hidden: index !== currentStep, children: step.content }, step.id))) }), jsxs("div", { className: "flex items-center justify-between pt-6 border-t border-paper-200", children: [jsx("button", { type: "button", onClick: prevStep, disabled: isFirstStep, className: "px-4 py-2 text-sm font-medium text-ink-700 bg-white border border-paper-300 rounded-lg hover:bg-paper-50 disabled:opacity-40 disabled:cursor-not-allowed transition-all", children: "Previous" }), jsxs("div", { className: "text-sm text-ink-600", children: ["Step ", currentStep + 1, " of ", steps.length] }), jsx("button", { type: "button", onClick: nextStep, disabled: isSubmitting, className: "px-4 py-2 text-sm font-medium text-white bg-accent-500 rounded-lg hover:bg-accent-600 disabled:opacity-40 disabled:cursor-not-allowed transition-all", children: isSubmitting ? 'Submitting...' : isLastStep ? 'Complete' : 'Next' })] })] }));
|
|
5434
5443
|
}
|
|
5435
5444
|
|
|
5436
5445
|
function InfiniteScroll({ loadMore, hasMore, loading = false, children, threshold = 200, loader, scrollContainer, reverse = false, className = '', }) {
|
|
@@ -7263,6 +7272,9 @@ function Hide({ children, above, below, only, className = '' }) {
|
|
|
7263
7272
|
* Hook to detect breadcrumb navigation and trigger callbacks.
|
|
7264
7273
|
* Use this in host components to reset state when a breadcrumb is clicked.
|
|
7265
7274
|
*
|
|
7275
|
+
* Note: This hook requires React Router context. If used outside a Router,
|
|
7276
|
+
* it will be a no-op (the callback will never be called).
|
|
7277
|
+
*
|
|
7266
7278
|
* @param onReset - Callback fired when breadcrumb navigation is detected
|
|
7267
7279
|
*
|
|
7268
7280
|
* @example
|
|
@@ -7276,15 +7288,19 @@ function Hide({ children, above, below, only, className = '' }) {
|
|
|
7276
7288
|
* }
|
|
7277
7289
|
*/
|
|
7278
7290
|
function useBreadcrumbReset(onReset) {
|
|
7279
|
-
const
|
|
7291
|
+
const inRouter = useInRouterContext();
|
|
7280
7292
|
const lastResetRef = useRef(null);
|
|
7293
|
+
// Only use useLocation when inside Router context
|
|
7294
|
+
const location = inRouter ? useLocation() : null;
|
|
7281
7295
|
useEffect(() => {
|
|
7296
|
+
if (!location)
|
|
7297
|
+
return;
|
|
7282
7298
|
const state = location.state;
|
|
7283
7299
|
if (state?.breadcrumbReset && state.breadcrumbReset !== lastResetRef.current) {
|
|
7284
7300
|
lastResetRef.current = state.breadcrumbReset;
|
|
7285
7301
|
onReset();
|
|
7286
7302
|
}
|
|
7287
|
-
}, [location
|
|
7303
|
+
}, [location?.state, onReset, location]);
|
|
7288
7304
|
}
|
|
7289
7305
|
/**
|
|
7290
7306
|
* Breadcrumbs navigation component.
|
|
@@ -7319,8 +7335,10 @@ function useBreadcrumbReset(onReset) {
|
|
|
7319
7335
|
* }
|
|
7320
7336
|
*/
|
|
7321
7337
|
function Breadcrumbs({ items, showHome = true }) {
|
|
7322
|
-
const
|
|
7323
|
-
|
|
7338
|
+
const inRouter = useInRouterContext();
|
|
7339
|
+
// Only use router hooks when inside Router context
|
|
7340
|
+
const navigate = inRouter ? useNavigate() : null;
|
|
7341
|
+
const location = inRouter ? useLocation() : null;
|
|
7324
7342
|
/**
|
|
7325
7343
|
* Handle breadcrumb click with same-route detection.
|
|
7326
7344
|
* When clicking a breadcrumb that points to the current route,
|
|
@@ -7329,6 +7347,9 @@ function Breadcrumbs({ items, showHome = true }) {
|
|
|
7329
7347
|
const handleBreadcrumbClick = (e, href, onClick) => {
|
|
7330
7348
|
// Always call onClick if provided (for custom actions)
|
|
7331
7349
|
onClick?.();
|
|
7350
|
+
// If not in router context, let the browser handle navigation naturally
|
|
7351
|
+
if (!navigate || !location)
|
|
7352
|
+
return;
|
|
7332
7353
|
// Check if we're navigating to the same base path
|
|
7333
7354
|
const targetPath = href.split('?')[0].split('#')[0];
|
|
7334
7355
|
const currentPath = location.pathname;
|
|
@@ -7345,7 +7366,16 @@ function Breadcrumbs({ items, showHome = true }) {
|
|
|
7345
7366
|
}
|
|
7346
7367
|
// Different route - let the Link handle it normally
|
|
7347
7368
|
};
|
|
7348
|
-
|
|
7369
|
+
// Helper to render a link - uses Link when in router, <a> when not
|
|
7370
|
+
const renderLink = (href, children, className, onClick, ariaLabel) => {
|
|
7371
|
+
if (inRouter) {
|
|
7372
|
+
return (jsx(Link$1, { to: href, className: className, onClick: onClick, "aria-label": ariaLabel, children: children }));
|
|
7373
|
+
}
|
|
7374
|
+
return (jsx("a", { href: href, className: className, onClick: (e) => {
|
|
7375
|
+
onClick?.(e);
|
|
7376
|
+
}, "aria-label": ariaLabel, children: children }));
|
|
7377
|
+
};
|
|
7378
|
+
return (jsxs("nav", { "aria-label": "Breadcrumb", className: "flex items-center space-x-2 text-sm", children: [showHome && (jsxs(Fragment, { children: [renderLink('/', jsx(Home, { className: "h-4 w-4" }), 'text-ink-500 hover:text-ink-900 transition-colors', (e) => handleBreadcrumbClick(e, '/'), 'Home'), items.length > 0 && jsx(ChevronRight, { className: "h-4 w-4 text-ink-400" })] })), items.map((item, index) => {
|
|
7349
7379
|
const isLast = index === items.length - 1;
|
|
7350
7380
|
const isActive = isLast;
|
|
7351
7381
|
const content = (jsxs(Fragment, { children: [item.icon && jsx("span", { className: "flex-shrink-0", children: item.icon }), jsx("span", { children: item.label })] }));
|
|
@@ -7354,9 +7384,9 @@ function Breadcrumbs({ items, showHome = true }) {
|
|
|
7354
7384
|
if (isActive) {
|
|
7355
7385
|
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 }));
|
|
7356
7386
|
}
|
|
7357
|
-
// Has href - render as Link with same-route detection
|
|
7387
|
+
// Has href - render as Link (or <a> if no router) with same-route detection
|
|
7358
7388
|
if (item.href) {
|
|
7359
|
-
return (
|
|
7389
|
+
return renderLink(item.href, content, 'flex items-center gap-2 text-ink-500 hover:text-ink-900 hover:underline transition-colors', (e) => handleBreadcrumbClick(e, item.href, item.onClick));
|
|
7360
7390
|
}
|
|
7361
7391
|
// Only onClick (no href) - render as button
|
|
7362
7392
|
if (item.onClick) {
|