@postxl/ui-components 1.5.0 → 1.5.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/index.d.ts +368 -358
- package/dist/index.js +153 -83
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
|
70
70
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
71
71
|
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
72
72
|
import useEmblaCarousel from "embla-carousel-react";
|
|
73
|
-
import { BaselineIcon, BookmarkIcon, CalendarIcon as CalendarIcon$1, Check, CheckIcon as CheckIcon$1, CheckSquareIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronRightIcon as ChevronRightIcon$1, ChevronUpIcon as ChevronUpIcon$1, CircleCheckIcon, CopyIcon, EraserIcon, EyeIcon, EyeOffIcon, FilterX, GlobeIcon, GripHorizontalIcon, HashIcon, ListChecksIcon, ListIcon, ListTreeIcon, MessageSquareIcon, MinusIcon, PanelLeftIcon, PanelRightIcon, PencilIcon, PinIcon, PinOffIcon, PlusIcon, SaveIcon, Settings2Icon, SquareIcon, TagIcon, TextInitialIcon, Trash2Icon, TrashIcon, XIcon } from "lucide-react";
|
|
73
|
+
import { BaselineIcon, BookmarkIcon, CalendarIcon as CalendarIcon$1, Check, CheckIcon as CheckIcon$1, CheckSquareIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronRightIcon as ChevronRightIcon$1, ChevronUpIcon as ChevronUpIcon$1, CircleCheckIcon, CopyIcon, DownloadIcon, EraserIcon, EyeIcon, EyeOffIcon, FilterX, GlobeIcon, GripHorizontalIcon, HashIcon, ListChecksIcon, ListIcon, ListTreeIcon, MessageSquareIcon, MinusIcon, PanelLeftIcon, PanelRightIcon, PencilIcon, PinIcon, PinOffIcon, PlusIcon, SaveIcon, Settings2Icon, SquareIcon, TagIcon, TextInitialIcon, Trash2Icon, TrashIcon, XIcon } from "lucide-react";
|
|
74
74
|
import * as CollapsePrimitive from "@radix-ui/react-collapsible";
|
|
75
75
|
import { Command as Command$1 } from "cmdk";
|
|
76
76
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
@@ -3445,6 +3445,10 @@ function getColumnVariant(variant) {
|
|
|
3445
3445
|
icon: CalendarIcon$1,
|
|
3446
3446
|
label: "Date"
|
|
3447
3447
|
};
|
|
3448
|
+
case "download-file": return {
|
|
3449
|
+
icon: DownloadIcon,
|
|
3450
|
+
label: "File download"
|
|
3451
|
+
};
|
|
3448
3452
|
default: return null;
|
|
3449
3453
|
}
|
|
3450
3454
|
}
|
|
@@ -4547,6 +4551,47 @@ function DateCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSel
|
|
|
4547
4551
|
});
|
|
4548
4552
|
}
|
|
4549
4553
|
|
|
4554
|
+
//#endregion
|
|
4555
|
+
//#region src/data-grid/cell-variants/download-file-cell.tsx
|
|
4556
|
+
function DownloadFileCell({ cell, table, rowIndex, columnId, isEditing, isFocused, isSelected }) {
|
|
4557
|
+
const cellOpts = cell.column.columnDef.meta?.cell;
|
|
4558
|
+
const downloadCellOpts = cellOpts?.variant === "download-file" ? cellOpts : void 0;
|
|
4559
|
+
const cellValue = cell.getValue();
|
|
4560
|
+
const row = cell.row.original;
|
|
4561
|
+
const resolvedUrl = downloadCellOpts?.getUrl?.(cellValue, row) ?? (typeof cellValue === "string" ? cellValue : void 0);
|
|
4562
|
+
const resolvedFileName = typeof downloadCellOpts?.fileName === "function" ? downloadCellOpts.fileName(row, cellValue) : downloadCellOpts?.fileName;
|
|
4563
|
+
const label = downloadCellOpts?.label ?? "Download";
|
|
4564
|
+
return /* @__PURE__ */ jsx(DataGridCellWrapper, {
|
|
4565
|
+
cell,
|
|
4566
|
+
table,
|
|
4567
|
+
rowIndex,
|
|
4568
|
+
columnId,
|
|
4569
|
+
isEditing,
|
|
4570
|
+
isFocused,
|
|
4571
|
+
isSelected,
|
|
4572
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
4573
|
+
"data-slot": "grid-cell-content",
|
|
4574
|
+
className: "size-full overflow-hidden outline-none",
|
|
4575
|
+
children: resolvedUrl ? /* @__PURE__ */ jsx(Button, {
|
|
4576
|
+
asChild: true,
|
|
4577
|
+
variant: "ghost",
|
|
4578
|
+
size: "sm",
|
|
4579
|
+
className: "h-7 gap-1 px-2",
|
|
4580
|
+
children: /* @__PURE__ */ jsxs("a", {
|
|
4581
|
+
href: resolvedUrl,
|
|
4582
|
+
download: resolvedFileName,
|
|
4583
|
+
target: "_blank",
|
|
4584
|
+
rel: "noreferrer",
|
|
4585
|
+
children: [/* @__PURE__ */ jsx(DownloadIcon, { className: "size-3.5" }), label]
|
|
4586
|
+
})
|
|
4587
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
4588
|
+
className: "text-muted-foreground",
|
|
4589
|
+
children: "-"
|
|
4590
|
+
})
|
|
4591
|
+
})
|
|
4592
|
+
});
|
|
4593
|
+
}
|
|
4594
|
+
|
|
4550
4595
|
//#endregion
|
|
4551
4596
|
//#region src/data-grid/cell-variants/gantt-cell.tsx
|
|
4552
4597
|
function GanttCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSelected }) {
|
|
@@ -5584,6 +5629,15 @@ function DataGridCell({ cell, table }) {
|
|
|
5584
5629
|
isFocused,
|
|
5585
5630
|
isSelected
|
|
5586
5631
|
});
|
|
5632
|
+
case "download-file": return /* @__PURE__ */ jsx(DownloadFileCell, {
|
|
5633
|
+
cell,
|
|
5634
|
+
table,
|
|
5635
|
+
rowIndex,
|
|
5636
|
+
columnId,
|
|
5637
|
+
isEditing,
|
|
5638
|
+
isFocused,
|
|
5639
|
+
isSelected
|
|
5640
|
+
});
|
|
5587
5641
|
case "react-node": return /* @__PURE__ */ jsx(ReactNodeCell, {
|
|
5588
5642
|
cell,
|
|
5589
5643
|
table,
|
|
@@ -9020,13 +9074,12 @@ const SIDEBAR_MAX_WIDTH = 600;
|
|
|
9020
9074
|
* Internal store context. Exported for use by `Sidebar` component in the same
|
|
9021
9075
|
* package to build per-sidebar resize contexts.
|
|
9022
9076
|
*/
|
|
9023
|
-
const
|
|
9077
|
+
const SidebarContext = React$13.createContext(null);
|
|
9024
9078
|
/**
|
|
9025
9079
|
* Context that identifies which sidebar a component belongs to.
|
|
9026
9080
|
* Set by `<Sidebar sidebarId="...">`, consumed by `useSidebar()`.
|
|
9027
9081
|
*/
|
|
9028
9082
|
const SidebarIdContext = React$13.createContext("default");
|
|
9029
|
-
const SidebarResizeContext = React$13.createContext(null);
|
|
9030
9083
|
/**
|
|
9031
9084
|
* Returns the state and controls for a specific sidebar.
|
|
9032
9085
|
*
|
|
@@ -9034,7 +9087,7 @@ const SidebarResizeContext = React$13.createContext(null);
|
|
|
9034
9087
|
* `SidebarIdContext` (set by the parent `<Sidebar>`), then to `"default"`.
|
|
9035
9088
|
*/
|
|
9036
9089
|
function useSidebar(sidebarId) {
|
|
9037
|
-
const store = React$13.useContext(
|
|
9090
|
+
const store = React$13.useContext(SidebarContext);
|
|
9038
9091
|
const ctxId = React$13.useContext(SidebarIdContext);
|
|
9039
9092
|
const id = sidebarId ?? ctxId;
|
|
9040
9093
|
if (!store) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
@@ -9042,6 +9095,9 @@ function useSidebar(sidebarId) {
|
|
|
9042
9095
|
const openMobile = store.mobileStates[id] ?? false;
|
|
9043
9096
|
const width = store.widthStates[id];
|
|
9044
9097
|
const { isMobile, isResizing } = store;
|
|
9098
|
+
const registry = store.sidebarRegistry[id];
|
|
9099
|
+
const minWidth = registry?.minWidth ?? store.providerMinWidth;
|
|
9100
|
+
const maxWidth = registry?.maxWidth ?? store.providerMaxWidth;
|
|
9045
9101
|
const setOpen = React$13.useCallback((value) => store.setOpen(id, value), [store.setOpen, id]);
|
|
9046
9102
|
const setOpenMobile = React$13.useCallback((value) => store.setOpenMobile(id, value), [store.setOpenMobile, id]);
|
|
9047
9103
|
const setWidth = React$13.useCallback((value) => store.setWidth(id, value), [store.setWidth, id]);
|
|
@@ -9060,7 +9116,9 @@ function useSidebar(sidebarId) {
|
|
|
9060
9116
|
toggleSidebar,
|
|
9061
9117
|
width,
|
|
9062
9118
|
setWidth,
|
|
9063
|
-
isResizing
|
|
9119
|
+
isResizing,
|
|
9120
|
+
minWidth,
|
|
9121
|
+
maxWidth
|
|
9064
9122
|
}), [
|
|
9065
9123
|
state,
|
|
9066
9124
|
open,
|
|
@@ -9071,9 +9129,22 @@ function useSidebar(sidebarId) {
|
|
|
9071
9129
|
toggleSidebar,
|
|
9072
9130
|
width,
|
|
9073
9131
|
setWidth,
|
|
9074
|
-
isResizing
|
|
9132
|
+
isResizing,
|
|
9133
|
+
minWidth,
|
|
9134
|
+
maxWidth
|
|
9075
9135
|
]);
|
|
9076
9136
|
}
|
|
9137
|
+
/**
|
|
9138
|
+
* Returns a list of all registered sidebars with their IDs and sides.
|
|
9139
|
+
*/
|
|
9140
|
+
function useRegisteredSidebars() {
|
|
9141
|
+
const store = React$13.useContext(SidebarContext);
|
|
9142
|
+
if (!store) throw new Error("useRegisteredSidebars must be used within a SidebarProvider.");
|
|
9143
|
+
return React$13.useMemo(() => Object.entries(store.sidebarRegistry).map(([sidebarId, entry]) => ({
|
|
9144
|
+
sidebarId,
|
|
9145
|
+
side: entry.side
|
|
9146
|
+
})), [store.sidebarRegistry]);
|
|
9147
|
+
}
|
|
9077
9148
|
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, width: widthProp, onWidthChange, minWidth = SIDEBAR_MIN_WIDTH, maxWidth = SIDEBAR_MAX_WIDTH, storageKey, defaultOpenSidebars, defaultWidths, keyboardShortcuts, className, style, children,...props }) {
|
|
9078
9149
|
const isMobile = useIsMobile();
|
|
9079
9150
|
const [isResizing, setIsResizing] = React$13.useState(false);
|
|
@@ -9162,11 +9233,21 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
9162
9233
|
[id]: width
|
|
9163
9234
|
}));
|
|
9164
9235
|
}, [onWidthChange]);
|
|
9165
|
-
const [
|
|
9166
|
-
const
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9236
|
+
const [sidebarRegistry, setSidebarRegistry] = React$13.useState({});
|
|
9237
|
+
const registerSidebar = React$13.useCallback((id, config) => {
|
|
9238
|
+
setSidebarRegistry((prev) => {
|
|
9239
|
+
const existing = prev[id];
|
|
9240
|
+
if (existing && existing.side === config.side && existing.minWidth === config.minWidth && existing.maxWidth === config.maxWidth) return prev;
|
|
9241
|
+
return {
|
|
9242
|
+
...prev,
|
|
9243
|
+
[id]: config
|
|
9244
|
+
};
|
|
9245
|
+
});
|
|
9246
|
+
}, []);
|
|
9247
|
+
const unregisterSidebar = React$13.useCallback((id) => {
|
|
9248
|
+
setSidebarRegistry((prev) => {
|
|
9249
|
+
const { [id]: _,...rest } = prev;
|
|
9250
|
+
return rest;
|
|
9170
9251
|
});
|
|
9171
9252
|
}, []);
|
|
9172
9253
|
const effectiveOpenStatesRef = React$13.useRef(effectiveOpenStates);
|
|
@@ -9205,11 +9286,12 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
9205
9286
|
openStates: effectiveOpenStates,
|
|
9206
9287
|
mobileStates,
|
|
9207
9288
|
widthStates: effectiveWidthStates,
|
|
9208
|
-
|
|
9289
|
+
sidebarRegistry,
|
|
9209
9290
|
setOpen,
|
|
9210
9291
|
setOpenMobile,
|
|
9211
9292
|
setWidth,
|
|
9212
|
-
|
|
9293
|
+
registerSidebar,
|
|
9294
|
+
unregisterSidebar,
|
|
9213
9295
|
isMobile,
|
|
9214
9296
|
defaultOpen,
|
|
9215
9297
|
isResizing,
|
|
@@ -9220,11 +9302,12 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
9220
9302
|
effectiveOpenStates,
|
|
9221
9303
|
mobileStates,
|
|
9222
9304
|
effectiveWidthStates,
|
|
9223
|
-
|
|
9305
|
+
sidebarRegistry,
|
|
9224
9306
|
setOpen,
|
|
9225
9307
|
setOpenMobile,
|
|
9226
9308
|
setWidth,
|
|
9227
|
-
|
|
9309
|
+
registerSidebar,
|
|
9310
|
+
unregisterSidebar,
|
|
9228
9311
|
isMobile,
|
|
9229
9312
|
defaultOpen,
|
|
9230
9313
|
isResizing,
|
|
@@ -9233,7 +9316,7 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
9233
9316
|
]);
|
|
9234
9317
|
const defaultWidth = effectiveWidthStates["default"];
|
|
9235
9318
|
const sidebarWidthValue = defaultWidth ? `${defaultWidth}px` : SIDEBAR_WIDTH;
|
|
9236
|
-
return /* @__PURE__ */ jsx(
|
|
9319
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
9237
9320
|
value: storeValue,
|
|
9238
9321
|
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
9239
9322
|
delayDuration: 0,
|
|
@@ -9255,29 +9338,24 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
9255
9338
|
//#endregion
|
|
9256
9339
|
//#region src/sidebar/sidebar.tsx
|
|
9257
9340
|
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", sidebarId = "default", minWidth, maxWidth, className, children,...props }) {
|
|
9258
|
-
const { isMobile, state, openMobile, setOpenMobile, width,
|
|
9259
|
-
const store = React$12.useContext(
|
|
9341
|
+
const { isMobile, state, openMobile, setOpenMobile, width, isResizing } = useSidebar(sidebarId);
|
|
9342
|
+
const store = React$12.useContext(SidebarContext);
|
|
9343
|
+
const storeRef = React$12.useRef(store);
|
|
9344
|
+
storeRef.current = store;
|
|
9345
|
+
const effectiveMinWidth = minWidth ?? store?.providerMinWidth ?? SIDEBAR_MIN_WIDTH;
|
|
9346
|
+
const effectiveMaxWidth = maxWidth ?? store?.providerMaxWidth ?? SIDEBAR_MAX_WIDTH;
|
|
9260
9347
|
React$12.useEffect(() => {
|
|
9261
|
-
|
|
9348
|
+
storeRef.current?.registerSidebar(sidebarId, {
|
|
9349
|
+
side,
|
|
9350
|
+
minWidth: effectiveMinWidth,
|
|
9351
|
+
maxWidth: effectiveMaxWidth
|
|
9352
|
+
});
|
|
9353
|
+
return () => storeRef.current?.unregisterSidebar(sidebarId);
|
|
9262
9354
|
}, [
|
|
9263
|
-
store,
|
|
9264
9355
|
sidebarId,
|
|
9265
|
-
side
|
|
9266
|
-
]);
|
|
9267
|
-
const effectiveMinWidth = minWidth ?? store?.providerMinWidth ?? SIDEBAR_MIN_WIDTH;
|
|
9268
|
-
const effectiveMaxWidth = maxWidth ?? store?.providerMaxWidth ?? SIDEBAR_MAX_WIDTH;
|
|
9269
|
-
const resizeContextValue = React$12.useMemo(() => ({
|
|
9270
|
-
onWidthChange: setWidth,
|
|
9271
|
-
minWidth: effectiveMinWidth,
|
|
9272
|
-
maxWidth: effectiveMaxWidth,
|
|
9273
|
-
isResizing,
|
|
9274
|
-
setIsResizing: store?.setIsResizing ?? (() => {})
|
|
9275
|
-
}), [
|
|
9276
|
-
setWidth,
|
|
9356
|
+
side,
|
|
9277
9357
|
effectiveMinWidth,
|
|
9278
|
-
effectiveMaxWidth
|
|
9279
|
-
isResizing,
|
|
9280
|
-
store?.setIsResizing
|
|
9358
|
+
effectiveMaxWidth
|
|
9281
9359
|
]);
|
|
9282
9360
|
const sidebarWidthValue = width ? `${width}px` : SIDEBAR_WIDTH;
|
|
9283
9361
|
const sidebarStyle = {
|
|
@@ -9286,10 +9364,7 @@ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas"
|
|
|
9286
9364
|
};
|
|
9287
9365
|
const wrappedChildren = /* @__PURE__ */ jsx(SidebarIdContext.Provider, {
|
|
9288
9366
|
value: sidebarId,
|
|
9289
|
-
children
|
|
9290
|
-
value: resizeContextValue,
|
|
9291
|
-
children
|
|
9292
|
-
})
|
|
9367
|
+
children
|
|
9293
9368
|
});
|
|
9294
9369
|
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
9295
9370
|
"data-slot": "sidebar",
|
|
@@ -9351,10 +9426,10 @@ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas"
|
|
|
9351
9426
|
}
|
|
9352
9427
|
function SidebarTrigger({ className, onClick, sidebarId, children,...props }) {
|
|
9353
9428
|
const { toggleSidebar } = useSidebar(sidebarId);
|
|
9354
|
-
const store = React$12.useContext(
|
|
9429
|
+
const store = React$12.useContext(SidebarContext);
|
|
9355
9430
|
const ctxId = React$12.useContext(SidebarIdContext);
|
|
9356
9431
|
const resolvedId = sidebarId ?? ctxId;
|
|
9357
|
-
const side = store?.
|
|
9432
|
+
const side = store?.sidebarRegistry[resolvedId]?.side;
|
|
9358
9433
|
const Icon = side === "right" ? PanelRightIcon : PanelLeftIcon;
|
|
9359
9434
|
return /* @__PURE__ */ jsx(Button, {
|
|
9360
9435
|
"data-sidebar": "trigger",
|
|
@@ -9374,17 +9449,18 @@ function SidebarTrigger({ className, onClick, sidebarId, children,...props }) {
|
|
|
9374
9449
|
});
|
|
9375
9450
|
}
|
|
9376
9451
|
function SidebarRail({ className,...props }) {
|
|
9377
|
-
const { toggleSidebar } = useSidebar();
|
|
9378
|
-
const
|
|
9452
|
+
const { toggleSidebar, setWidth, minWidth, maxWidth } = useSidebar();
|
|
9453
|
+
const store = React$12.useContext(SidebarContext);
|
|
9379
9454
|
const startXRef = React$12.useRef(0);
|
|
9380
9455
|
const hasDraggedRef = React$12.useRef(false);
|
|
9381
|
-
const
|
|
9456
|
+
const sidebarId = React$12.useContext(SidebarIdContext);
|
|
9457
|
+
const isResizable = !!store?.sidebarRegistry[sidebarId];
|
|
9382
9458
|
const handleMouseDown = React$12.useCallback((e) => {
|
|
9383
|
-
if (!isResizable
|
|
9459
|
+
if (!isResizable) return;
|
|
9384
9460
|
e.preventDefault();
|
|
9385
9461
|
startXRef.current = e.clientX;
|
|
9386
9462
|
hasDraggedRef.current = false;
|
|
9387
|
-
|
|
9463
|
+
store?.setIsResizing(true);
|
|
9388
9464
|
const sidebarEl = e.target.closest("[data-slot=\"sidebar-container\"]");
|
|
9389
9465
|
const sidebarLeft = sidebarEl?.getBoundingClientRect().left ?? 0;
|
|
9390
9466
|
const side = e.target.closest("[data-side]")?.getAttribute("data-side");
|
|
@@ -9395,10 +9471,10 @@ function SidebarRail({ className,...props }) {
|
|
|
9395
9471
|
const sidebarRight = sidebarEl?.getBoundingClientRect().right ?? globalThis.innerWidth;
|
|
9396
9472
|
newWidth = sidebarRight - moveEvent.clientX;
|
|
9397
9473
|
} else newWidth = moveEvent.clientX - sidebarLeft;
|
|
9398
|
-
if (newWidth >=
|
|
9474
|
+
if (newWidth >= minWidth && newWidth <= maxWidth) setWidth(newWidth);
|
|
9399
9475
|
};
|
|
9400
9476
|
const handleMouseUp = () => {
|
|
9401
|
-
|
|
9477
|
+
store?.setIsResizing(false);
|
|
9402
9478
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
9403
9479
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
9404
9480
|
document.body.style.cursor = "";
|
|
@@ -9408,7 +9484,13 @@ function SidebarRail({ className,...props }) {
|
|
|
9408
9484
|
document.addEventListener("mouseup", handleMouseUp);
|
|
9409
9485
|
document.body.style.cursor = "col-resize";
|
|
9410
9486
|
document.body.style.userSelect = "none";
|
|
9411
|
-
}, [
|
|
9487
|
+
}, [
|
|
9488
|
+
isResizable,
|
|
9489
|
+
store,
|
|
9490
|
+
setWidth,
|
|
9491
|
+
minWidth,
|
|
9492
|
+
maxWidth
|
|
9493
|
+
]);
|
|
9412
9494
|
const handleClick = React$12.useCallback(() => {
|
|
9413
9495
|
if (hasDraggedRef.current) return;
|
|
9414
9496
|
toggleSidebar();
|
|
@@ -9648,14 +9730,8 @@ function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false,
|
|
|
9648
9730
|
//#region src/sidebar/sidebar-tab-context-provider.tsx
|
|
9649
9731
|
const SidebarTabsContext = React$11.createContext(null);
|
|
9650
9732
|
function SidebarTabsProvider({ children }) {
|
|
9651
|
-
const [tabsMap, setTabsMap] = React$11.useState({
|
|
9652
|
-
|
|
9653
|
-
right: new Map()
|
|
9654
|
-
});
|
|
9655
|
-
const [activeTab, setActiveTabState] = React$11.useState({
|
|
9656
|
-
left: null,
|
|
9657
|
-
right: null
|
|
9658
|
-
});
|
|
9733
|
+
const [tabsMap, setTabsMap] = React$11.useState({});
|
|
9734
|
+
const [activeTab, setActiveTabState] = React$11.useState({});
|
|
9659
9735
|
const register = React$11.useCallback((side, tab) => {
|
|
9660
9736
|
setTabsMap((prev) => {
|
|
9661
9737
|
const next = new Map(prev[side]);
|
|
@@ -9666,7 +9742,7 @@ function SidebarTabsProvider({ children }) {
|
|
|
9666
9742
|
};
|
|
9667
9743
|
});
|
|
9668
9744
|
setActiveTabState((prev) => {
|
|
9669
|
-
if (prev[side] === null) return {
|
|
9745
|
+
if (prev[side] === void 0 || prev[side] === null) return {
|
|
9670
9746
|
...prev,
|
|
9671
9747
|
[side]: tab.id
|
|
9672
9748
|
};
|
|
@@ -9701,10 +9777,9 @@ function SidebarTabsProvider({ children }) {
|
|
|
9701
9777
|
}, []);
|
|
9702
9778
|
const sortedTabs = React$11.useMemo(() => {
|
|
9703
9779
|
const sort = (map) => [...map.values()].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
};
|
|
9780
|
+
const result = {};
|
|
9781
|
+
for (const [side, map] of Object.entries(tabsMap)) result[side] = sort(map);
|
|
9782
|
+
return result;
|
|
9708
9783
|
}, [tabsMap]);
|
|
9709
9784
|
const value = React$11.useMemo(() => ({
|
|
9710
9785
|
tabs: sortedTabs,
|
|
@@ -9731,8 +9806,8 @@ function useSidebarTabs(side) {
|
|
|
9731
9806
|
if (side) ctx.setActiveTab(side, tabId);
|
|
9732
9807
|
}, [ctx.setActiveTab, side]);
|
|
9733
9808
|
const boundResult = React$11.useMemo(() => side ? {
|
|
9734
|
-
tabs: ctx.tabs[side],
|
|
9735
|
-
activeTab: ctx.activeTab[side],
|
|
9809
|
+
tabs: ctx.tabs[side] ?? [],
|
|
9810
|
+
activeTab: ctx.activeTab[side] ?? null,
|
|
9736
9811
|
setActiveTab: boundSetActiveTab
|
|
9737
9812
|
} : null, [
|
|
9738
9813
|
side,
|
|
@@ -9775,12 +9850,12 @@ function SidebarTab({ side, id, icon, label, render, order }) {
|
|
|
9775
9850
|
]);
|
|
9776
9851
|
return null;
|
|
9777
9852
|
}
|
|
9778
|
-
function DynamicTabbedSidebar({ side,
|
|
9853
|
+
function DynamicTabbedSidebar({ side, orientation = "horizontal", collapsible = "offcanvas", className,...sidebarProps }) {
|
|
9779
9854
|
const ctx = React$10.useContext(SidebarTabsContext);
|
|
9780
9855
|
if (!ctx) throw new Error("DynamicTabbedSidebar must be used within a SidebarTabsProvider.");
|
|
9781
9856
|
const { setActiveTab } = ctx;
|
|
9782
|
-
const tabs = ctx.tabs[side];
|
|
9783
|
-
const activeTabId = ctx.activeTab[side];
|
|
9857
|
+
const tabs = ctx.tabs[side] ?? [];
|
|
9858
|
+
const activeTabId = ctx.activeTab[side] ?? null;
|
|
9784
9859
|
const activeTab = tabs.find((t) => t.id === activeTabId);
|
|
9785
9860
|
React$10.useEffect(() => {
|
|
9786
9861
|
if (tabs.length > 0 && tabs[0] && !activeTab) setActiveTab(side, tabs[0].id);
|
|
@@ -9790,12 +9865,11 @@ function DynamicTabbedSidebar({ side, sidebarId, orientation = "horizontal", col
|
|
|
9790
9865
|
side,
|
|
9791
9866
|
setActiveTab
|
|
9792
9867
|
]);
|
|
9793
|
-
const effectiveSidebarId = sidebarId ?? side;
|
|
9794
9868
|
const isVertical = orientation === "vertical";
|
|
9795
9869
|
const effectiveCollapsible = isVertical && collapsible === "offcanvas" ? "icon" : collapsible;
|
|
9796
9870
|
return /* @__PURE__ */ jsxs(Sidebar, {
|
|
9797
9871
|
side,
|
|
9798
|
-
sidebarId:
|
|
9872
|
+
sidebarId: side,
|
|
9799
9873
|
collapsible: effectiveCollapsible,
|
|
9800
9874
|
className,
|
|
9801
9875
|
...sidebarProps,
|
|
@@ -9805,13 +9879,12 @@ function DynamicTabbedSidebar({ side, sidebarId, orientation = "horizontal", col
|
|
|
9805
9879
|
activeTabId,
|
|
9806
9880
|
activeTab,
|
|
9807
9881
|
isVertical,
|
|
9808
|
-
sidebarId: effectiveSidebarId,
|
|
9809
9882
|
collapsible: effectiveCollapsible
|
|
9810
9883
|
}), /* @__PURE__ */ jsx(SidebarRail, {})]
|
|
9811
9884
|
});
|
|
9812
9885
|
}
|
|
9813
|
-
function TabbedSidebarContent({ side, tabs, activeTabId, activeTab, isVertical,
|
|
9814
|
-
const { state } = useSidebar(
|
|
9886
|
+
function TabbedSidebarContent({ side, tabs, activeTabId, activeTab, isVertical, collapsible }) {
|
|
9887
|
+
const { state } = useSidebar(side);
|
|
9815
9888
|
const isCollapsed = state === "collapsed";
|
|
9816
9889
|
const isIconCollapsible = collapsible === "icon";
|
|
9817
9890
|
if (isCollapsed && isIconCollapsible) return /* @__PURE__ */ jsx("div", {
|
|
@@ -9819,8 +9892,7 @@ function TabbedSidebarContent({ side, tabs, activeTabId, activeTab, isVertical,
|
|
|
9819
9892
|
children: /* @__PURE__ */ jsx(VerticalTabBar, {
|
|
9820
9893
|
side,
|
|
9821
9894
|
tabs,
|
|
9822
|
-
activeTabId
|
|
9823
|
-
sidebarId
|
|
9895
|
+
activeTabId
|
|
9824
9896
|
})
|
|
9825
9897
|
});
|
|
9826
9898
|
if (isVertical) return /* @__PURE__ */ jsxs("div", {
|
|
@@ -9828,8 +9900,7 @@ function TabbedSidebarContent({ side, tabs, activeTabId, activeTab, isVertical,
|
|
|
9828
9900
|
children: [/* @__PURE__ */ jsx(VerticalTabBar, {
|
|
9829
9901
|
side,
|
|
9830
9902
|
tabs,
|
|
9831
|
-
activeTabId
|
|
9832
|
-
sidebarId
|
|
9903
|
+
activeTabId
|
|
9833
9904
|
}), /* @__PURE__ */ jsx("div", {
|
|
9834
9905
|
className: "flex min-w-0 flex-1 flex-col",
|
|
9835
9906
|
children: /* @__PURE__ */ jsx(SidebarContent, { children: activeTab?.render() })
|
|
@@ -9841,8 +9912,7 @@ function TabbedSidebarContent({ side, tabs, activeTabId, activeTab, isVertical,
|
|
|
9841
9912
|
/* @__PURE__ */ jsx(HorizontalTabBar, {
|
|
9842
9913
|
side,
|
|
9843
9914
|
tabs,
|
|
9844
|
-
activeTabId
|
|
9845
|
-
sidebarId
|
|
9915
|
+
activeTabId
|
|
9846
9916
|
}),
|
|
9847
9917
|
tabs.length > 0 && /* @__PURE__ */ jsx(SidebarSeparator, {}),
|
|
9848
9918
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -9852,9 +9922,9 @@ function TabbedSidebarContent({ side, tabs, activeTabId, activeTab, isVertical,
|
|
|
9852
9922
|
]
|
|
9853
9923
|
});
|
|
9854
9924
|
}
|
|
9855
|
-
function HorizontalTabBar({ side, tabs, activeTabId
|
|
9925
|
+
function HorizontalTabBar({ side, tabs, activeTabId }) {
|
|
9856
9926
|
const ctx = React$10.useContext(SidebarTabsContext);
|
|
9857
|
-
const { state, toggleSidebar } = useSidebar(
|
|
9927
|
+
const { state, toggleSidebar } = useSidebar(side);
|
|
9858
9928
|
if (tabs.length === 0) return null;
|
|
9859
9929
|
const handleTabClick = (tabId) => {
|
|
9860
9930
|
if (state === "collapsed") {
|
|
@@ -9885,9 +9955,9 @@ function HorizontalTabBar({ side, tabs, activeTabId, sidebarId }) {
|
|
|
9885
9955
|
})
|
|
9886
9956
|
}) });
|
|
9887
9957
|
}
|
|
9888
|
-
function VerticalTabBar({ side, tabs, activeTabId
|
|
9958
|
+
function VerticalTabBar({ side, tabs, activeTabId }) {
|
|
9889
9959
|
const ctx = React$10.useContext(SidebarTabsContext);
|
|
9890
|
-
const { state, toggleSidebar } = useSidebar(
|
|
9960
|
+
const { state, toggleSidebar } = useSidebar(side);
|
|
9891
9961
|
const isCollapsed = state === "collapsed";
|
|
9892
9962
|
if (tabs.length === 0) return null;
|
|
9893
9963
|
const handleTabClick = (tabId) => {
|
|
@@ -11299,5 +11369,5 @@ const TreeView = React$1.forwardRef(({ data, onNodeSelect, onGroupSelect, onTogg
|
|
|
11299
11369
|
TreeView.displayName = "TreeView";
|
|
11300
11370
|
|
|
11301
11371
|
//#endregion
|
|
11302
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, KanbanBoard as Board, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, CheckboxCell, Collapse, CollapseContent, CollapseTrigger, KanbanColumn as Column, KanbanColumnHandle as ColumnHandle, ComboboxDemo, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandPalette, CommandPaletteDialog, CommandPaletteEmpty, CommandPaletteGroup, CommandPaletteInput, CommandPaletteItem, CommandPaletteList, CommandPaletteSeparator, CommandPaletteShortcut, CommandSeparator, CommandShortcut, CommentCreate, CommentList, CommentThread, ContentFrame, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataGrid, DataGridCell, DataGridCellWrapper, DataGridColumnHeader, DataGridContextMenu, DataGridRow, DataGridSearch, DataGridViewMenu, DateCell, DatePickerDemo, DeferredInput, DeferredNumberInput, DeferredTextarea, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicTabbedSidebar, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GanttCell, GanttTimeline, GanttTimerangePicker, HeaderComponents, HierarchyCell, HierarchyItem, HoverCard, HoverCardContent, HoverCardTrigger, InfoCard, Input, KanbanItem as Item, KanbanItemHandle as ItemHandle, KanbanRoot as Kanban, KanbanBoard, KanbanColumn, KanbanColumnHandle, KanbanItem, KanbanItemHandle, KanbanOverlay, Label, Loader, LongTextCell, MarkValueRenderer, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Modal, MultiSelectCell, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NumberCell, NumberInput, KanbanOverlay as Overlay, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ReactNodeCell, ResizableHandle, ResizablePanel, ResizablePanelGroup, KanbanRoot as Root, SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_KEYBOARD_SHORTCUT_RIGHT, SIDEBAR_MAX_WIDTH, SIDEBAR_MIN_WIDTH, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON, SIDEBAR_WIDTH_MOBILE, ScrollArea, ScrollBar, Select, SelectCell, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShortTextCell, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarIdContext, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail,
|
|
11372
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, KanbanBoard as Board, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, CheckboxCell, Collapse, CollapseContent, CollapseTrigger, KanbanColumn as Column, KanbanColumnHandle as ColumnHandle, ComboboxDemo, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandPalette, CommandPaletteDialog, CommandPaletteEmpty, CommandPaletteGroup, CommandPaletteInput, CommandPaletteItem, CommandPaletteList, CommandPaletteSeparator, CommandPaletteShortcut, CommandSeparator, CommandShortcut, CommentCreate, CommentList, CommentThread, ContentFrame, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataGrid, DataGridCell, DataGridCellWrapper, DataGridColumnHeader, DataGridContextMenu, DataGridRow, DataGridSearch, DataGridViewMenu, DateCell, DatePickerDemo, DeferredInput, DeferredNumberInput, DeferredTextarea, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicTabbedSidebar, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GanttCell, GanttTimeline, GanttTimerangePicker, HeaderComponents, HierarchyCell, HierarchyItem, HoverCard, HoverCardContent, HoverCardTrigger, InfoCard, Input, KanbanItem as Item, KanbanItemHandle as ItemHandle, KanbanRoot as Kanban, KanbanBoard, KanbanColumn, KanbanColumnHandle, KanbanItem, KanbanItemHandle, KanbanOverlay, Label, Loader, LongTextCell, MarkValueRenderer, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Modal, MultiSelectCell, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NumberCell, NumberInput, KanbanOverlay as Overlay, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ReactNodeCell, ResizableHandle, ResizablePanel, ResizablePanelGroup, KanbanRoot as Root, SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_KEYBOARD_SHORTCUT_RIGHT, SIDEBAR_MAX_WIDTH, SIDEBAR_MIN_WIDTH, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON, SIDEBAR_WIDTH_MOBILE, ScrollArea, ScrollBar, Select, SelectCell, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShortTextCell, Sidebar, SidebarContent, SidebarContext, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarIdContext, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTab, SidebarTabsContext, SidebarTabsProvider, SidebarTrigger, Skeleton, Slicer, SlicerHierarchyItem, Slider, Spinner, Stepper, StepperContent, StepperDescription, StepperIndicator, StepperItem, StepperList, StepperNext, StepperPrev, StepperSeparator, StepperTitle, StepperTrigger, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TreeBranch, TreeView, badgeVariants, buildLabelMap, buttonVariants, checkboxVariants, cn, commandInputVariants, createSelectColumn, findOptionById, getAllDescendantIds, getAllDescendantValues, getAllIds, getAncestorIds, getCellKey, getCommonPinningStyles, getInitialExpandedIds, getLabelPath, getLineCount, getRowHeightValue, inputVariants, isoToLocalDate, knobVariants, matchesSearch, navigationMenuTriggerStyle, parseCellKey, sliderVariants, testId, toast, toggleVariants, useCallbackRef, useDataGrid, useDebouncedCallback, useIsMobile, useRegisteredSidebars, useSidebar, useSidebarTabs, useStore as useStepper };
|
|
11303
11373
|
//# sourceMappingURL=index.js.map
|