@papernote/ui 1.7.2 → 1.7.3
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/index.d.ts +6 -1
- package/dist/index.esm.js +91 -52
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +89 -50
- 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
|
@@ -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;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,oCAAoC;IACpC,aAAa,CAAC,EAAE,IAAI,EAAE,CAAC;IACvB,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iDAAiD;IACjD,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAW,EACX,YAAY,EACZ,SAAiB,EACjB,UAAU,EACV,aAAa,EACb,OAAO,EACP,OAAO,EACP,aAAkB,EAClB,eAAuB,EACvB,cAAkB,EAClB,SAAc,GACf,EAAE,aAAa,
|
|
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,kFAAkF;IAClF,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,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;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,oCAAoC;IACpC,aAAa,CAAC,EAAE,IAAI,EAAE,CAAC;IACvB,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iDAAiD;IACjD,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,aAAa,EACb,MAAW,EACX,YAAY,EACZ,SAAiB,EACjB,UAAU,EACV,aAAa,EACb,OAAO,EACP,OAAO,EACP,aAAkB,EAClB,eAAuB,EACvB,cAAkB,EAClB,SAAc,GACf,EAAE,aAAa,2CAwUf"}
|
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);
|
|
@@ -7263,6 +7273,9 @@ function Hide({ children, above, below, only, className = '' }) {
|
|
|
7263
7273
|
* Hook to detect breadcrumb navigation and trigger callbacks.
|
|
7264
7274
|
* Use this in host components to reset state when a breadcrumb is clicked.
|
|
7265
7275
|
*
|
|
7276
|
+
* Note: This hook requires React Router context. If used outside a Router,
|
|
7277
|
+
* it will be a no-op (the callback will never be called).
|
|
7278
|
+
*
|
|
7266
7279
|
* @param onReset - Callback fired when breadcrumb navigation is detected
|
|
7267
7280
|
*
|
|
7268
7281
|
* @example
|
|
@@ -7276,15 +7289,19 @@ function Hide({ children, above, below, only, className = '' }) {
|
|
|
7276
7289
|
* }
|
|
7277
7290
|
*/
|
|
7278
7291
|
function useBreadcrumbReset(onReset) {
|
|
7279
|
-
const
|
|
7292
|
+
const inRouter = useInRouterContext();
|
|
7280
7293
|
const lastResetRef = useRef(null);
|
|
7294
|
+
// Only use useLocation when inside Router context
|
|
7295
|
+
const location = inRouter ? useLocation() : null;
|
|
7281
7296
|
useEffect(() => {
|
|
7297
|
+
if (!location)
|
|
7298
|
+
return;
|
|
7282
7299
|
const state = location.state;
|
|
7283
7300
|
if (state?.breadcrumbReset && state.breadcrumbReset !== lastResetRef.current) {
|
|
7284
7301
|
lastResetRef.current = state.breadcrumbReset;
|
|
7285
7302
|
onReset();
|
|
7286
7303
|
}
|
|
7287
|
-
}, [location
|
|
7304
|
+
}, [location?.state, onReset, location]);
|
|
7288
7305
|
}
|
|
7289
7306
|
/**
|
|
7290
7307
|
* Breadcrumbs navigation component.
|
|
@@ -7319,8 +7336,10 @@ function useBreadcrumbReset(onReset) {
|
|
|
7319
7336
|
* }
|
|
7320
7337
|
*/
|
|
7321
7338
|
function Breadcrumbs({ items, showHome = true }) {
|
|
7322
|
-
const
|
|
7323
|
-
|
|
7339
|
+
const inRouter = useInRouterContext();
|
|
7340
|
+
// Only use router hooks when inside Router context
|
|
7341
|
+
const navigate = inRouter ? useNavigate() : null;
|
|
7342
|
+
const location = inRouter ? useLocation() : null;
|
|
7324
7343
|
/**
|
|
7325
7344
|
* Handle breadcrumb click with same-route detection.
|
|
7326
7345
|
* When clicking a breadcrumb that points to the current route,
|
|
@@ -7329,6 +7348,9 @@ function Breadcrumbs({ items, showHome = true }) {
|
|
|
7329
7348
|
const handleBreadcrumbClick = (e, href, onClick) => {
|
|
7330
7349
|
// Always call onClick if provided (for custom actions)
|
|
7331
7350
|
onClick?.();
|
|
7351
|
+
// If not in router context, let the browser handle navigation naturally
|
|
7352
|
+
if (!navigate || !location)
|
|
7353
|
+
return;
|
|
7332
7354
|
// Check if we're navigating to the same base path
|
|
7333
7355
|
const targetPath = href.split('?')[0].split('#')[0];
|
|
7334
7356
|
const currentPath = location.pathname;
|
|
@@ -7345,7 +7367,16 @@ function Breadcrumbs({ items, showHome = true }) {
|
|
|
7345
7367
|
}
|
|
7346
7368
|
// Different route - let the Link handle it normally
|
|
7347
7369
|
};
|
|
7348
|
-
|
|
7370
|
+
// Helper to render a link - uses Link when in router, <a> when not
|
|
7371
|
+
const renderLink = (href, children, className, onClick, ariaLabel) => {
|
|
7372
|
+
if (inRouter) {
|
|
7373
|
+
return (jsx(Link$1, { to: href, className: className, onClick: onClick, "aria-label": ariaLabel, children: children }));
|
|
7374
|
+
}
|
|
7375
|
+
return (jsx("a", { href: href, className: className, onClick: (e) => {
|
|
7376
|
+
onClick?.(e);
|
|
7377
|
+
}, "aria-label": ariaLabel, children: children }));
|
|
7378
|
+
};
|
|
7379
|
+
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
7380
|
const isLast = index === items.length - 1;
|
|
7350
7381
|
const isActive = isLast;
|
|
7351
7382
|
const content = (jsxs(Fragment, { children: [item.icon && jsx("span", { className: "flex-shrink-0", children: item.icon }), jsx("span", { children: item.label })] }));
|
|
@@ -7354,9 +7385,9 @@ function Breadcrumbs({ items, showHome = true }) {
|
|
|
7354
7385
|
if (isActive) {
|
|
7355
7386
|
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
7387
|
}
|
|
7357
|
-
// Has href - render as Link with same-route detection
|
|
7388
|
+
// Has href - render as Link (or <a> if no router) with same-route detection
|
|
7358
7389
|
if (item.href) {
|
|
7359
|
-
return (
|
|
7390
|
+
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
7391
|
}
|
|
7361
7392
|
// Only onClick (no href) - render as button
|
|
7362
7393
|
if (item.onClick) {
|
|
@@ -10301,44 +10332,52 @@ function getAugmentedNamespace(n) {
|
|
|
10301
10332
|
* (A1, A1:C5, ...)
|
|
10302
10333
|
*/
|
|
10303
10334
|
|
|
10304
|
-
|
|
10335
|
+
var collection;
|
|
10336
|
+
var hasRequiredCollection;
|
|
10337
|
+
|
|
10338
|
+
function requireCollection () {
|
|
10339
|
+
if (hasRequiredCollection) return collection;
|
|
10340
|
+
hasRequiredCollection = 1;
|
|
10341
|
+
class Collection {
|
|
10305
10342
|
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10343
|
+
constructor(data, refs) {
|
|
10344
|
+
if (data == null && refs == null) {
|
|
10345
|
+
this._data = [];
|
|
10346
|
+
this._refs = [];
|
|
10347
|
+
} else {
|
|
10348
|
+
if (data.length !== refs.length)
|
|
10349
|
+
throw Error('Collection: data length should match references length.');
|
|
10350
|
+
this._data = data;
|
|
10351
|
+
this._refs = refs;
|
|
10352
|
+
}
|
|
10353
|
+
}
|
|
10317
10354
|
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10355
|
+
get data() {
|
|
10356
|
+
return this._data;
|
|
10357
|
+
}
|
|
10321
10358
|
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10359
|
+
get refs() {
|
|
10360
|
+
return this._refs;
|
|
10361
|
+
}
|
|
10325
10362
|
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10363
|
+
get length() {
|
|
10364
|
+
return this._data.length;
|
|
10365
|
+
}
|
|
10329
10366
|
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
}
|
|
10367
|
+
/**
|
|
10368
|
+
* Add data and references to this collection.
|
|
10369
|
+
* @param {{}} obj - data
|
|
10370
|
+
* @param {{}} ref - reference
|
|
10371
|
+
*/
|
|
10372
|
+
add(obj, ref) {
|
|
10373
|
+
this._data.push(obj);
|
|
10374
|
+
this._refs.push(ref);
|
|
10375
|
+
}
|
|
10376
|
+
}
|
|
10340
10377
|
|
|
10341
|
-
|
|
10378
|
+
collection = Collection;
|
|
10379
|
+
return collection;
|
|
10380
|
+
}
|
|
10342
10381
|
|
|
10343
10382
|
var helpers;
|
|
10344
10383
|
var hasRequiredHelpers;
|
|
@@ -10347,7 +10386,7 @@ function requireHelpers () {
|
|
|
10347
10386
|
if (hasRequiredHelpers) return helpers;
|
|
10348
10387
|
hasRequiredHelpers = 1;
|
|
10349
10388
|
const FormulaError = requireError();
|
|
10350
|
-
const Collection =
|
|
10389
|
+
const Collection = requireCollection();
|
|
10351
10390
|
|
|
10352
10391
|
const Types = {
|
|
10353
10392
|
NUMBER: 0,
|
|
@@ -20001,7 +20040,7 @@ var engineering = EngineeringFunctions;
|
|
|
20001
20040
|
|
|
20002
20041
|
const FormulaError$b = requireError();
|
|
20003
20042
|
const {FormulaHelpers: FormulaHelpers$8, Types: Types$6, WildCard, Address: Address$3} = requireHelpers();
|
|
20004
|
-
const Collection$2 =
|
|
20043
|
+
const Collection$2 = requireCollection();
|
|
20005
20044
|
const H$5 = FormulaHelpers$8;
|
|
20006
20045
|
|
|
20007
20046
|
const ReferenceFunctions$1 = {
|
|
@@ -31629,7 +31668,7 @@ var parsing = {
|
|
|
31629
31668
|
const FormulaError$4 = requireError();
|
|
31630
31669
|
const {Address: Address$1} = requireHelpers();
|
|
31631
31670
|
const {Prefix: Prefix$1, Postfix: Postfix$1, Infix: Infix$1, Operators: Operators$1} = operators;
|
|
31632
|
-
const Collection$1 =
|
|
31671
|
+
const Collection$1 = requireCollection();
|
|
31633
31672
|
const MAX_ROW$1 = 1048576, MAX_COLUMN$1 = 16384;
|
|
31634
31673
|
const {NotAllInputParsedException} = require$$4;
|
|
31635
31674
|
|
|
@@ -32391,7 +32430,7 @@ var hooks$1 = {
|
|
|
32391
32430
|
const FormulaError$2 = requireError();
|
|
32392
32431
|
const {FormulaHelpers: FormulaHelpers$1, Types, Address} = requireHelpers();
|
|
32393
32432
|
const {Prefix, Postfix, Infix, Operators} = operators;
|
|
32394
|
-
const Collection =
|
|
32433
|
+
const Collection = requireCollection();
|
|
32395
32434
|
const MAX_ROW = 1048576, MAX_COLUMN = 16384;
|
|
32396
32435
|
|
|
32397
32436
|
let Utils$1 = class Utils {
|