@inf-monkeys-tech/monkeys-design 0.4.32 → 0.4.34
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/LICENSE +21 -21
- package/README.md +226 -226
- package/dist/components/base/index.d.mts +2 -2
- package/dist/components/base/index.d.ts +2 -2
- package/dist/components/base/index.js +990 -28
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/base/index.mjs +987 -30
- package/dist/components/base/index.mjs.map +1 -1
- package/dist/components/data-explorer/index.js.map +1 -1
- package/dist/components/data-explorer/index.mjs.map +1 -1
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/components/login/index.js.map +1 -1
- package/dist/components/login/index.mjs.map +1 -1
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/toolbar/index.mjs.map +1 -1
- package/dist/components/workbench/index.d.mts +193 -2
- package/dist/components/workbench/index.d.ts +193 -2
- package/dist/components/workbench/index.js +2164 -585
- package/dist/components/workbench/index.js.map +1 -1
- package/dist/components/workbench/index.mjs +2367 -813
- package/dist/components/workbench/index.mjs.map +1 -1
- package/dist/icons/oauth/index.js.map +1 -1
- package/dist/icons/oauth/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1958 -170
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1950 -172
- package/dist/index.mjs.map +1 -1
- package/dist/palette/index.js.map +1 -1
- package/dist/palette/index.mjs.map +1 -1
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/index.mjs.map +1 -1
- package/dist/styles/artist-login.scss +374 -374
- package/dist/styles/global.scss +21 -21
- package/dist/styles/workflow-board.scss +440 -440
- package/dist/styles/workflow-nodes.css +340 -340
- package/dist/{theme-CvbotXXr.d.ts → theme-Clm5dVb0.d.mts} +10 -3
- package/dist/{theme-6RDum855.d.mts → theme-sIoU5-YC.d.ts} +10 -3
- package/dist/theme-system/index.d.mts +1 -1
- package/dist/theme-system/index.d.ts +1 -1
- package/dist/theme-system/index.js +842 -18
- package/dist/theme-system/index.js.map +1 -1
- package/dist/theme-system/index.mjs +843 -19
- package/dist/theme-system/index.mjs.map +1 -1
- package/dist/themes/artist/index.js.map +1 -1
- package/dist/themes/artist/index.mjs.map +1 -1
- package/dist/themes/bsd/index.js.map +1 -1
- package/dist/themes/bsd/index.mjs.map +1 -1
- package/dist/themes/concept/index.js.map +1 -1
- package/dist/themes/concept/index.mjs.map +1 -1
- package/dist/themes/default/index.js.map +1 -1
- package/dist/themes/default/index.mjs.map +1 -1
- package/dist/{types-BgEEUqSm.d.mts → types-Bn6PEDsX.d.mts} +163 -1
- package/dist/{types-BgEEUqSm.d.ts → types-Bn6PEDsX.d.ts} +163 -1
- package/package.json +139 -138
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext, useCallback, useLayoutEffect, Children, isValidElement, Fragment as Fragment$1
|
|
1
|
+
import React, { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext, useCallback, useContext, useLayoutEffect, Children, isValidElement, Fragment as Fragment$1 } from 'react';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as ContextMenu from '@radix-ui/react-context-menu';
|
|
4
4
|
import * as DropdownMenu3 from '@radix-ui/react-dropdown-menu';
|
|
5
|
+
import { useSensors, useSensor, PointerSensor, DndContext, DragOverlay, useDroppable, useDraggable } from '@dnd-kit/core';
|
|
5
6
|
import * as Tooltip from '@radix-ui/react-tooltip';
|
|
6
7
|
|
|
7
8
|
var __create = Object.create;
|
|
@@ -4521,7 +4522,7 @@ var require_lodash = __commonJS({
|
|
|
4521
4522
|
function valuesIn(object) {
|
|
4522
4523
|
return object == null ? [] : baseValues(object, keysIn(object));
|
|
4523
4524
|
}
|
|
4524
|
-
function
|
|
4525
|
+
function clamp5(number, lower, upper) {
|
|
4525
4526
|
if (upper === undefined2) {
|
|
4526
4527
|
upper = lower;
|
|
4527
4528
|
lower = undefined2;
|
|
@@ -5198,7 +5199,7 @@ var require_lodash = __commonJS({
|
|
|
5198
5199
|
lodash.camelCase = camelCase;
|
|
5199
5200
|
lodash.capitalize = capitalize;
|
|
5200
5201
|
lodash.ceil = ceil;
|
|
5201
|
-
lodash.clamp =
|
|
5202
|
+
lodash.clamp = clamp5;
|
|
5202
5203
|
lodash.clone = clone;
|
|
5203
5204
|
lodash.cloneDeep = cloneDeep;
|
|
5204
5205
|
lodash.cloneDeepWith = cloneDeepWith;
|
|
@@ -8553,7 +8554,41 @@ var baseSlots = {
|
|
|
8553
8554
|
tableEmptyActions: "mt-4 flex flex-wrap items-center justify-center gap-2",
|
|
8554
8555
|
tableLoadingRow: "border-b border-border/60",
|
|
8555
8556
|
tableLoadingCell: "px-3 py-2",
|
|
8556
|
-
tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70"
|
|
8557
|
+
tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70",
|
|
8558
|
+
layoutRoot: cn(
|
|
8559
|
+
"grid min-w-0 overflow-hidden grid-rows-[auto_minmax(0,1fr)_auto] gap-3 rounded-lg border border-border/70 bg-background p-3 text-foreground",
|
|
8560
|
+
motionBase
|
|
8561
|
+
),
|
|
8562
|
+
layoutRootFull: "h-full min-h-0",
|
|
8563
|
+
layoutHeader: "min-w-0",
|
|
8564
|
+
layoutBody: "grid min-h-0 min-w-0 overflow-hidden gap-3",
|
|
8565
|
+
layoutSidebar: "min-h-0 min-w-0 overflow-hidden",
|
|
8566
|
+
layoutMain: "min-h-0 min-w-0 overflow-hidden",
|
|
8567
|
+
layoutAside: "min-h-0 min-w-0 overflow-hidden",
|
|
8568
|
+
layoutFooter: "min-w-0",
|
|
8569
|
+
layoutPane: cn(
|
|
8570
|
+
"h-full max-h-full min-h-0 min-w-0 overflow-hidden rounded-lg bg-background text-foreground",
|
|
8571
|
+
motionBase
|
|
8572
|
+
),
|
|
8573
|
+
layoutPaneScrollable: "overflow-auto",
|
|
8574
|
+
layoutPaneBordered: "border border-border/70",
|
|
8575
|
+
layoutPaneMuted: "bg-muted/25",
|
|
8576
|
+
layoutPaneSoft: "bg-background/95 shadow-sm",
|
|
8577
|
+
layoutPaneTransparent: "bg-transparent shadow-none",
|
|
8578
|
+
layoutSplitRoot: "grid min-h-0 min-w-0 overflow-hidden",
|
|
8579
|
+
layoutSplitHorizontal: "grid-flow-col",
|
|
8580
|
+
layoutSplitVertical: "grid-flow-row",
|
|
8581
|
+
layoutSplitPane: "min-h-0 min-w-0 overflow-hidden",
|
|
8582
|
+
layoutSplitPrimary: "",
|
|
8583
|
+
layoutSplitSecondary: "",
|
|
8584
|
+
layoutResizeHandle: cn(
|
|
8585
|
+
"group/resize relative z-10 flex shrink-0 items-center justify-center bg-transparent text-muted-foreground hover:bg-border/60 active:bg-border/70 focus-visible:bg-border/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
8586
|
+
motionInteractive
|
|
8587
|
+
),
|
|
8588
|
+
layoutResizeHandleHorizontal: "w-2 cursor-col-resize",
|
|
8589
|
+
layoutResizeHandleVertical: "h-2 cursor-row-resize",
|
|
8590
|
+
layoutResizeHandleDisabled: "cursor-default opacity-60",
|
|
8591
|
+
layoutResizeHandleIndicator: "rounded-full bg-muted-foreground/45 group-hover/resize:bg-primary/70"
|
|
8557
8592
|
};
|
|
8558
8593
|
var densitySlots = {
|
|
8559
8594
|
compact: {
|
|
@@ -8627,7 +8662,12 @@ var densitySlots = {
|
|
|
8627
8662
|
tableCell: "px-2 py-1.5 text-xs",
|
|
8628
8663
|
tableHeadLabel: "text-[11px]",
|
|
8629
8664
|
tableHeadDescription: "text-[10px] leading-3",
|
|
8630
|
-
tableLoadingCell: "px-2 py-1.5"
|
|
8665
|
+
tableLoadingCell: "px-2 py-1.5",
|
|
8666
|
+
layoutRoot: "gap-2 p-2",
|
|
8667
|
+
layoutBody: "gap-2",
|
|
8668
|
+
layoutPane: "rounded-md text-xs",
|
|
8669
|
+
layoutResizeHandleHorizontal: "w-1.5",
|
|
8670
|
+
layoutResizeHandleVertical: "h-1.5"
|
|
8631
8671
|
},
|
|
8632
8672
|
default: {
|
|
8633
8673
|
buttonBase: "h-9"
|
|
@@ -8678,7 +8718,12 @@ var densitySlots = {
|
|
|
8678
8718
|
menuSubTrigger: "min-h-9 px-3 py-2",
|
|
8679
8719
|
tableHead: "h-12 px-4 py-3",
|
|
8680
8720
|
tableCell: "px-4 py-3",
|
|
8681
|
-
tableLoadingCell: "px-4 py-3"
|
|
8721
|
+
tableLoadingCell: "px-4 py-3",
|
|
8722
|
+
layoutRoot: "gap-4 p-4",
|
|
8723
|
+
layoutBody: "gap-4",
|
|
8724
|
+
layoutPane: "rounded-xl",
|
|
8725
|
+
layoutResizeHandleHorizontal: "w-2.5",
|
|
8726
|
+
layoutResizeHandleVertical: "h-2.5"
|
|
8682
8727
|
}
|
|
8683
8728
|
};
|
|
8684
8729
|
var radiusSlots = {
|
|
@@ -8722,7 +8767,9 @@ var radiusSlots = {
|
|
|
8722
8767
|
menuSubContent: "rounded-none",
|
|
8723
8768
|
tableContainer: "rounded-none",
|
|
8724
8769
|
tableEmptyIcon: "rounded-none",
|
|
8725
|
-
tableLoadingSkeleton: "rounded-none"
|
|
8770
|
+
tableLoadingSkeleton: "rounded-none",
|
|
8771
|
+
layoutRoot: "rounded-none",
|
|
8772
|
+
layoutPane: "rounded-none"
|
|
8726
8773
|
},
|
|
8727
8774
|
sm: {
|
|
8728
8775
|
buttonBase: "rounded-sm",
|
|
@@ -8764,7 +8811,9 @@ var radiusSlots = {
|
|
|
8764
8811
|
menuSubContent: "rounded-sm",
|
|
8765
8812
|
tableContainer: "rounded-sm",
|
|
8766
8813
|
tableEmptyIcon: "rounded-sm",
|
|
8767
|
-
tableLoadingSkeleton: "rounded-sm"
|
|
8814
|
+
tableLoadingSkeleton: "rounded-sm",
|
|
8815
|
+
layoutRoot: "rounded-sm",
|
|
8816
|
+
layoutPane: "rounded-sm"
|
|
8768
8817
|
},
|
|
8769
8818
|
md: {},
|
|
8770
8819
|
lg: {
|
|
@@ -8801,7 +8850,9 @@ var radiusSlots = {
|
|
|
8801
8850
|
menuSubContent: "rounded-lg",
|
|
8802
8851
|
tableContainer: "rounded-xl",
|
|
8803
8852
|
tableEmptyIcon: "rounded-xl",
|
|
8804
|
-
tableLoadingSkeleton: "rounded-lg"
|
|
8853
|
+
tableLoadingSkeleton: "rounded-lg",
|
|
8854
|
+
layoutRoot: "rounded-xl",
|
|
8855
|
+
layoutPane: "rounded-xl"
|
|
8805
8856
|
},
|
|
8806
8857
|
xl: {
|
|
8807
8858
|
buttonBase: "rounded-xl",
|
|
@@ -8839,7 +8890,9 @@ var radiusSlots = {
|
|
|
8839
8890
|
menuSubContent: "rounded-xl",
|
|
8840
8891
|
tableContainer: "rounded-2xl",
|
|
8841
8892
|
tableEmptyIcon: "rounded-2xl",
|
|
8842
|
-
tableLoadingSkeleton: "rounded-xl"
|
|
8893
|
+
tableLoadingSkeleton: "rounded-xl",
|
|
8894
|
+
layoutRoot: "rounded-2xl",
|
|
8895
|
+
layoutPane: "rounded-2xl"
|
|
8843
8896
|
},
|
|
8844
8897
|
full: {
|
|
8845
8898
|
buttonBase: "rounded-full",
|
|
@@ -8881,7 +8934,9 @@ var radiusSlots = {
|
|
|
8881
8934
|
menuSubContent: "rounded-2xl",
|
|
8882
8935
|
tableContainer: "rounded-2xl",
|
|
8883
8936
|
tableEmptyIcon: "rounded-full",
|
|
8884
|
-
tableLoadingSkeleton: "rounded-full"
|
|
8937
|
+
tableLoadingSkeleton: "rounded-full",
|
|
8938
|
+
layoutRoot: "rounded-2xl",
|
|
8939
|
+
layoutPane: "rounded-2xl"
|
|
8885
8940
|
}
|
|
8886
8941
|
};
|
|
8887
8942
|
var borderSlots = {
|
|
@@ -8923,7 +8978,10 @@ var borderSlots = {
|
|
|
8923
8978
|
tableFooterBarAttached: "border-t border-transparent",
|
|
8924
8979
|
tableRow: "border-transparent",
|
|
8925
8980
|
tableEmptyRow: "border-transparent",
|
|
8926
|
-
tableLoadingRow: "border-transparent"
|
|
8981
|
+
tableLoadingRow: "border-transparent",
|
|
8982
|
+
layoutRoot: "border-transparent",
|
|
8983
|
+
layoutPaneBordered: "border-transparent",
|
|
8984
|
+
layoutResizeHandle: "bg-transparent hover:bg-transparent active:bg-transparent focus-visible:bg-transparent"
|
|
8927
8985
|
},
|
|
8928
8986
|
subtle: {
|
|
8929
8987
|
buttonDefault: "border-border/60",
|
|
@@ -8963,7 +9021,9 @@ var borderSlots = {
|
|
|
8963
9021
|
tableFooterBarAttached: "border-t border-border/60",
|
|
8964
9022
|
tableRow: "border-border/50",
|
|
8965
9023
|
tableEmptyRow: "border-border/50",
|
|
8966
|
-
tableLoadingRow: "border-border/50"
|
|
9024
|
+
tableLoadingRow: "border-border/50",
|
|
9025
|
+
layoutRoot: "border-border/60",
|
|
9026
|
+
layoutPaneBordered: "border-border/60"
|
|
8967
9027
|
},
|
|
8968
9028
|
solid: {},
|
|
8969
9029
|
strong: {
|
|
@@ -9004,7 +9064,10 @@ var borderSlots = {
|
|
|
9004
9064
|
tableFooterBarAttached: "border-t border-foreground/20",
|
|
9005
9065
|
tableRow: "border-foreground/15",
|
|
9006
9066
|
tableEmptyRow: "border-foreground/15",
|
|
9007
|
-
tableLoadingRow: "border-foreground/15"
|
|
9067
|
+
tableLoadingRow: "border-foreground/15",
|
|
9068
|
+
layoutRoot: "border-foreground/20",
|
|
9069
|
+
layoutPaneBordered: "border-foreground/20",
|
|
9070
|
+
layoutResizeHandle: "hover:bg-foreground/15 active:bg-foreground/20 focus-visible:bg-foreground/15"
|
|
9008
9071
|
}
|
|
9009
9072
|
};
|
|
9010
9073
|
var backgroundSlots = {
|
|
@@ -9046,7 +9109,11 @@ var backgroundSlots = {
|
|
|
9046
9109
|
tableFooter: "bg-muted/35",
|
|
9047
9110
|
tableFooterBar: "bg-muted/30 shadow-none",
|
|
9048
9111
|
tableRowInteractive: "cursor-pointer hover:bg-muted/45",
|
|
9049
|
-
tableLoadingSkeleton: "bg-muted"
|
|
9112
|
+
tableLoadingSkeleton: "bg-muted",
|
|
9113
|
+
layoutRoot: "bg-card",
|
|
9114
|
+
layoutPane: "bg-card",
|
|
9115
|
+
layoutPaneMuted: "bg-muted/35",
|
|
9116
|
+
layoutResizeHandle: "hover:bg-border/70 active:bg-border/80 focus-visible:bg-border/70"
|
|
9050
9117
|
},
|
|
9051
9118
|
soft: {
|
|
9052
9119
|
buttonDefault: "bg-muted/30 hover:bg-muted/55",
|
|
@@ -9082,7 +9149,10 @@ var backgroundSlots = {
|
|
|
9082
9149
|
tableFooter: "bg-muted/25",
|
|
9083
9150
|
tableFooterBar: "bg-muted/25 shadow-none",
|
|
9084
9151
|
tableRowInteractive: "cursor-pointer hover:bg-muted/35",
|
|
9085
|
-
tableLoadingSkeleton: "bg-muted/65"
|
|
9152
|
+
tableLoadingSkeleton: "bg-muted/65",
|
|
9153
|
+
layoutRoot: "bg-background/95 shadow-sm",
|
|
9154
|
+
layoutPane: "bg-background/95 shadow-sm",
|
|
9155
|
+
layoutPaneSoft: "bg-background/95 shadow-md"
|
|
9086
9156
|
},
|
|
9087
9157
|
glass: {
|
|
9088
9158
|
buttonBase: "backdrop-blur-md",
|
|
@@ -9143,7 +9213,13 @@ var backgroundSlots = {
|
|
|
9143
9213
|
tableRow: "border-white/10",
|
|
9144
9214
|
tableRowInteractive: "cursor-pointer hover:bg-white/[0.08]",
|
|
9145
9215
|
tableHeadLabel: "text-foreground",
|
|
9146
|
-
tableLoadingSkeleton: "bg-white/[0.16]"
|
|
9216
|
+
tableLoadingSkeleton: "bg-white/[0.16]",
|
|
9217
|
+
layoutRoot: "border-white/10 bg-white/[0.05] shadow-none backdrop-blur-md",
|
|
9218
|
+
layoutPane: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
|
|
9219
|
+
layoutPaneMuted: "bg-white/[0.08]",
|
|
9220
|
+
layoutPaneSoft: "bg-white/[0.10] shadow-none backdrop-blur-md",
|
|
9221
|
+
layoutResizeHandle: "text-foreground/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
|
|
9222
|
+
layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
|
|
9147
9223
|
},
|
|
9148
9224
|
dark: {
|
|
9149
9225
|
buttonBase: "border-white/15 text-white shadow-lg backdrop-blur",
|
|
@@ -9272,7 +9348,13 @@ var backgroundSlots = {
|
|
|
9272
9348
|
menuSubTrigger: "text-white focus:bg-white/[0.10] focus:text-white data-[highlighted]:bg-white/[0.10] data-[highlighted]:text-white data-[state=open]:bg-white/[0.12]",
|
|
9273
9349
|
menuSubTriggerIcon: "text-white/55",
|
|
9274
9350
|
menuSubContent: "border-white/10 bg-slate-950 text-white shadow-2xl",
|
|
9275
|
-
tableLoadingSkeleton: "bg-white/[0.14]"
|
|
9351
|
+
tableLoadingSkeleton: "bg-white/[0.14]",
|
|
9352
|
+
layoutRoot: "border-white/10 bg-slate-950 text-white shadow-none",
|
|
9353
|
+
layoutPane: "border-white/10 bg-slate-950 text-white shadow-none",
|
|
9354
|
+
layoutPaneMuted: "bg-white/[0.06]",
|
|
9355
|
+
layoutPaneSoft: "bg-white/[0.08] shadow-none",
|
|
9356
|
+
layoutResizeHandle: "text-white/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
|
|
9357
|
+
layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
|
|
9276
9358
|
}
|
|
9277
9359
|
};
|
|
9278
9360
|
var presetDefaults = {
|
|
@@ -11130,6 +11212,432 @@ var BaseInput = forwardRef(
|
|
|
11130
11212
|
);
|
|
11131
11213
|
}
|
|
11132
11214
|
);
|
|
11215
|
+
var DEFAULT_SPLIT_SIZE = 50;
|
|
11216
|
+
var DEFAULT_MIN_SIZE = 20;
|
|
11217
|
+
var DEFAULT_MAX_SIZE = 80;
|
|
11218
|
+
var DEFAULT_KEYBOARD_STEP = 2.5;
|
|
11219
|
+
function toCssSize(value, fallback) {
|
|
11220
|
+
if (typeof value === "number") {
|
|
11221
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
11222
|
+
throw new Error("BaseLayout size and gap props must be finite, non-negative numbers.");
|
|
11223
|
+
}
|
|
11224
|
+
return `${value}px`;
|
|
11225
|
+
}
|
|
11226
|
+
return value ?? fallback;
|
|
11227
|
+
}
|
|
11228
|
+
function assertPercent(name, value) {
|
|
11229
|
+
if (!Number.isFinite(value)) {
|
|
11230
|
+
throw new Error(`BaseLayoutSplit ${name} must be a finite number.`);
|
|
11231
|
+
}
|
|
11232
|
+
if (value < 0 || value > 100) {
|
|
11233
|
+
throw new Error(`BaseLayoutSplit ${name} must be between 0 and 100.`);
|
|
11234
|
+
}
|
|
11235
|
+
return value;
|
|
11236
|
+
}
|
|
11237
|
+
function clamp(value, min5, max5) {
|
|
11238
|
+
return Math.min(Math.max(value, min5), max5);
|
|
11239
|
+
}
|
|
11240
|
+
function resolveSplitBounds({
|
|
11241
|
+
minSize = DEFAULT_MIN_SIZE,
|
|
11242
|
+
maxSize = DEFAULT_MAX_SIZE,
|
|
11243
|
+
keyboardStep = DEFAULT_KEYBOARD_STEP
|
|
11244
|
+
}) {
|
|
11245
|
+
const min5 = assertPercent("minSize", minSize);
|
|
11246
|
+
const max5 = assertPercent("maxSize", maxSize);
|
|
11247
|
+
if (min5 > max5) {
|
|
11248
|
+
throw new Error("BaseLayoutSplit minSize cannot be greater than maxSize.");
|
|
11249
|
+
}
|
|
11250
|
+
if (!Number.isFinite(keyboardStep) || keyboardStep <= 0) {
|
|
11251
|
+
throw new Error("BaseLayoutSplit keyboardStep must be a finite positive number.");
|
|
11252
|
+
}
|
|
11253
|
+
return { min: min5, max: max5, keyboardStep };
|
|
11254
|
+
}
|
|
11255
|
+
function resolveSplitSize(name, value, fallback, min5, max5) {
|
|
11256
|
+
return clamp(assertPercent(name, value ?? fallback), min5, max5);
|
|
11257
|
+
}
|
|
11258
|
+
function getSeparatorOrientation(orientation) {
|
|
11259
|
+
return orientation === "horizontal" ? "vertical" : "horizontal";
|
|
11260
|
+
}
|
|
11261
|
+
function BaseLayout({
|
|
11262
|
+
header,
|
|
11263
|
+
sidebar,
|
|
11264
|
+
aside,
|
|
11265
|
+
footer,
|
|
11266
|
+
children,
|
|
11267
|
+
sidebarSize,
|
|
11268
|
+
asideSize,
|
|
11269
|
+
gap,
|
|
11270
|
+
fullHeight,
|
|
11271
|
+
appearance,
|
|
11272
|
+
className,
|
|
11273
|
+
classNames,
|
|
11274
|
+
style,
|
|
11275
|
+
...layoutProps
|
|
11276
|
+
}) {
|
|
11277
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11278
|
+
const hasHeader = hasRenderableNode(header);
|
|
11279
|
+
const hasSidebar = hasRenderableNode(sidebar);
|
|
11280
|
+
const hasAside = hasRenderableNode(aside);
|
|
11281
|
+
const hasFooter = hasRenderableNode(footer);
|
|
11282
|
+
const bodyColumns = [
|
|
11283
|
+
hasSidebar ? "var(--base-layout-sidebar-size)" : void 0,
|
|
11284
|
+
"minmax(0, 1fr)",
|
|
11285
|
+
hasAside ? "var(--base-layout-aside-size)" : void 0
|
|
11286
|
+
].filter(Boolean).join(" ");
|
|
11287
|
+
const layoutRows = [
|
|
11288
|
+
hasHeader ? "auto" : void 0,
|
|
11289
|
+
"minmax(0, 1fr)",
|
|
11290
|
+
hasFooter ? "auto" : void 0
|
|
11291
|
+
].filter(Boolean).join(" ");
|
|
11292
|
+
const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
|
|
11293
|
+
const layoutStyle = {
|
|
11294
|
+
...theme.styles.layout,
|
|
11295
|
+
"--base-layout-sidebar-size": toCssSize(sidebarSize, "16rem"),
|
|
11296
|
+
"--base-layout-aside-size": toCssSize(asideSize, "20rem"),
|
|
11297
|
+
gridTemplateRows: layoutRows,
|
|
11298
|
+
...resolvedGap !== void 0 ? { gap: resolvedGap } : {},
|
|
11299
|
+
...style
|
|
11300
|
+
};
|
|
11301
|
+
const bodyStyle = {
|
|
11302
|
+
...theme.styles.layoutBody,
|
|
11303
|
+
gridTemplateColumns: bodyColumns,
|
|
11304
|
+
...resolvedGap !== void 0 ? { gap: resolvedGap } : {}
|
|
11305
|
+
};
|
|
11306
|
+
return /* @__PURE__ */ jsxs(
|
|
11307
|
+
"div",
|
|
11308
|
+
{
|
|
11309
|
+
...layoutProps,
|
|
11310
|
+
className: cn(
|
|
11311
|
+
theme.slots.layoutRoot,
|
|
11312
|
+
fullHeight && theme.slots.layoutRootFull,
|
|
11313
|
+
classNames?.root,
|
|
11314
|
+
className
|
|
11315
|
+
),
|
|
11316
|
+
style: layoutStyle,
|
|
11317
|
+
children: [
|
|
11318
|
+
hasHeader ? /* @__PURE__ */ jsx(
|
|
11319
|
+
"div",
|
|
11320
|
+
{
|
|
11321
|
+
className: cn(theme.slots.layoutHeader, classNames?.header),
|
|
11322
|
+
style: theme.styles.layoutHeader,
|
|
11323
|
+
children: header
|
|
11324
|
+
}
|
|
11325
|
+
) : null,
|
|
11326
|
+
/* @__PURE__ */ jsxs(
|
|
11327
|
+
"div",
|
|
11328
|
+
{
|
|
11329
|
+
className: cn(theme.slots.layoutBody, classNames?.body),
|
|
11330
|
+
style: bodyStyle,
|
|
11331
|
+
children: [
|
|
11332
|
+
hasSidebar ? /* @__PURE__ */ jsx(
|
|
11333
|
+
"aside",
|
|
11334
|
+
{
|
|
11335
|
+
className: cn(theme.slots.layoutSidebar, classNames?.sidebar),
|
|
11336
|
+
style: theme.styles.layoutSidebar,
|
|
11337
|
+
children: sidebar
|
|
11338
|
+
}
|
|
11339
|
+
) : null,
|
|
11340
|
+
/* @__PURE__ */ jsx(
|
|
11341
|
+
"main",
|
|
11342
|
+
{
|
|
11343
|
+
className: cn(theme.slots.layoutMain, classNames?.main),
|
|
11344
|
+
style: theme.styles.layoutMain,
|
|
11345
|
+
children
|
|
11346
|
+
}
|
|
11347
|
+
),
|
|
11348
|
+
hasAside ? /* @__PURE__ */ jsx(
|
|
11349
|
+
"aside",
|
|
11350
|
+
{
|
|
11351
|
+
className: cn(theme.slots.layoutAside, classNames?.aside),
|
|
11352
|
+
style: theme.styles.layoutAside,
|
|
11353
|
+
children: aside
|
|
11354
|
+
}
|
|
11355
|
+
) : null
|
|
11356
|
+
]
|
|
11357
|
+
}
|
|
11358
|
+
),
|
|
11359
|
+
hasFooter ? /* @__PURE__ */ jsx(
|
|
11360
|
+
"div",
|
|
11361
|
+
{
|
|
11362
|
+
className: cn(theme.slots.layoutFooter, classNames?.footer),
|
|
11363
|
+
style: theme.styles.layoutFooter,
|
|
11364
|
+
children: footer
|
|
11365
|
+
}
|
|
11366
|
+
) : null
|
|
11367
|
+
]
|
|
11368
|
+
}
|
|
11369
|
+
);
|
|
11370
|
+
}
|
|
11371
|
+
function BaseLayoutPane({
|
|
11372
|
+
as = "div",
|
|
11373
|
+
scrollable = false,
|
|
11374
|
+
bordered = true,
|
|
11375
|
+
surface = "default",
|
|
11376
|
+
children,
|
|
11377
|
+
appearance,
|
|
11378
|
+
className,
|
|
11379
|
+
classNames,
|
|
11380
|
+
style,
|
|
11381
|
+
...paneProps
|
|
11382
|
+
}) {
|
|
11383
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11384
|
+
const Component = as;
|
|
11385
|
+
return /* @__PURE__ */ jsx(
|
|
11386
|
+
Component,
|
|
11387
|
+
{
|
|
11388
|
+
...paneProps,
|
|
11389
|
+
className: cn(
|
|
11390
|
+
theme.slots.layoutPane,
|
|
11391
|
+
scrollable && theme.slots.layoutPaneScrollable,
|
|
11392
|
+
bordered && theme.slots.layoutPaneBordered,
|
|
11393
|
+
surface === "muted" && theme.slots.layoutPaneMuted,
|
|
11394
|
+
surface === "soft" && theme.slots.layoutPaneSoft,
|
|
11395
|
+
surface === "transparent" && theme.slots.layoutPaneTransparent,
|
|
11396
|
+
classNames?.root,
|
|
11397
|
+
className
|
|
11398
|
+
),
|
|
11399
|
+
style: {
|
|
11400
|
+
...theme.styles.layoutPane,
|
|
11401
|
+
...style
|
|
11402
|
+
},
|
|
11403
|
+
children
|
|
11404
|
+
}
|
|
11405
|
+
);
|
|
11406
|
+
}
|
|
11407
|
+
function BaseLayoutResizeHandle({
|
|
11408
|
+
orientation = "horizontal",
|
|
11409
|
+
resizable = false,
|
|
11410
|
+
disabled = false,
|
|
11411
|
+
size,
|
|
11412
|
+
minSize,
|
|
11413
|
+
maxSize,
|
|
11414
|
+
label = "Resize panels",
|
|
11415
|
+
appearance,
|
|
11416
|
+
className,
|
|
11417
|
+
classNames,
|
|
11418
|
+
style,
|
|
11419
|
+
tabIndex,
|
|
11420
|
+
...handleProps
|
|
11421
|
+
}) {
|
|
11422
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11423
|
+
const interactive = resizable && !disabled;
|
|
11424
|
+
const separatorOrientation = getSeparatorOrientation(orientation);
|
|
11425
|
+
return /* @__PURE__ */ jsx(
|
|
11426
|
+
"div",
|
|
11427
|
+
{
|
|
11428
|
+
...handleProps,
|
|
11429
|
+
role: interactive ? "separator" : void 0,
|
|
11430
|
+
"aria-label": interactive ? label : void 0,
|
|
11431
|
+
"aria-orientation": interactive ? separatorOrientation : void 0,
|
|
11432
|
+
"aria-valuemin": interactive ? minSize : void 0,
|
|
11433
|
+
"aria-valuemax": interactive ? maxSize : void 0,
|
|
11434
|
+
"aria-valuenow": interactive ? size : void 0,
|
|
11435
|
+
"aria-disabled": interactive ? void 0 : true,
|
|
11436
|
+
tabIndex: interactive ? tabIndex ?? 0 : void 0,
|
|
11437
|
+
className: cn(
|
|
11438
|
+
theme.slots.layoutResizeHandle,
|
|
11439
|
+
orientation === "horizontal" ? theme.slots.layoutResizeHandleHorizontal : theme.slots.layoutResizeHandleVertical,
|
|
11440
|
+
!interactive && theme.slots.layoutResizeHandleDisabled,
|
|
11441
|
+
classNames?.root,
|
|
11442
|
+
className
|
|
11443
|
+
),
|
|
11444
|
+
style: {
|
|
11445
|
+
...theme.styles.layoutResizeHandle,
|
|
11446
|
+
...style
|
|
11447
|
+
},
|
|
11448
|
+
children: /* @__PURE__ */ jsx(
|
|
11449
|
+
"span",
|
|
11450
|
+
{
|
|
11451
|
+
"aria-hidden": "true",
|
|
11452
|
+
className: cn(
|
|
11453
|
+
theme.slots.layoutResizeHandleIndicator,
|
|
11454
|
+
orientation === "horizontal" ? "h-8 w-px" : "h-px w-8",
|
|
11455
|
+
classNames?.indicator
|
|
11456
|
+
)
|
|
11457
|
+
}
|
|
11458
|
+
)
|
|
11459
|
+
}
|
|
11460
|
+
);
|
|
11461
|
+
}
|
|
11462
|
+
function BaseLayoutSplit({
|
|
11463
|
+
orientation = "horizontal",
|
|
11464
|
+
primary,
|
|
11465
|
+
secondary,
|
|
11466
|
+
children,
|
|
11467
|
+
resizable = false,
|
|
11468
|
+
size,
|
|
11469
|
+
defaultSize,
|
|
11470
|
+
minSize,
|
|
11471
|
+
maxSize,
|
|
11472
|
+
gap,
|
|
11473
|
+
keyboardStep,
|
|
11474
|
+
resizeLabel,
|
|
11475
|
+
appearance,
|
|
11476
|
+
className,
|
|
11477
|
+
classNames,
|
|
11478
|
+
style,
|
|
11479
|
+
onSizeChange,
|
|
11480
|
+
...splitProps
|
|
11481
|
+
}) {
|
|
11482
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11483
|
+
const bounds = resolveSplitBounds({ minSize, maxSize, keyboardStep });
|
|
11484
|
+
const initialSize = resolveSplitSize(
|
|
11485
|
+
"defaultSize",
|
|
11486
|
+
defaultSize,
|
|
11487
|
+
DEFAULT_SPLIT_SIZE,
|
|
11488
|
+
bounds.min,
|
|
11489
|
+
bounds.max
|
|
11490
|
+
);
|
|
11491
|
+
const [uncontrolledSize, setUncontrolledSize] = useState(initialSize);
|
|
11492
|
+
const rootRef = useRef(null);
|
|
11493
|
+
const cleanupRef = useRef(null);
|
|
11494
|
+
const controlled = size !== void 0;
|
|
11495
|
+
const renderedSize = resolveSplitSize(
|
|
11496
|
+
"size",
|
|
11497
|
+
controlled ? size : uncontrolledSize,
|
|
11498
|
+
initialSize,
|
|
11499
|
+
bounds.min,
|
|
11500
|
+
bounds.max
|
|
11501
|
+
);
|
|
11502
|
+
const commitSize = useCallback(
|
|
11503
|
+
(nextSize) => {
|
|
11504
|
+
const clampedSize = clamp(nextSize, bounds.min, bounds.max);
|
|
11505
|
+
if (!controlled) {
|
|
11506
|
+
setUncontrolledSize(clampedSize);
|
|
11507
|
+
}
|
|
11508
|
+
onSizeChange?.(clampedSize);
|
|
11509
|
+
},
|
|
11510
|
+
[bounds.max, bounds.min, controlled, onSizeChange]
|
|
11511
|
+
);
|
|
11512
|
+
const updateFromPointer = useCallback(
|
|
11513
|
+
(event) => {
|
|
11514
|
+
const root = rootRef.current;
|
|
11515
|
+
if (!root) return;
|
|
11516
|
+
const rect = root.getBoundingClientRect();
|
|
11517
|
+
const total = orientation === "horizontal" ? rect.width : rect.height;
|
|
11518
|
+
if (total <= 0) return;
|
|
11519
|
+
const offset = orientation === "horizontal" ? event.clientX - rect.left : event.clientY - rect.top;
|
|
11520
|
+
commitSize(offset / total * 100);
|
|
11521
|
+
},
|
|
11522
|
+
[commitSize, orientation]
|
|
11523
|
+
);
|
|
11524
|
+
const stopResize = useCallback(() => {
|
|
11525
|
+
cleanupRef.current?.();
|
|
11526
|
+
cleanupRef.current = null;
|
|
11527
|
+
}, []);
|
|
11528
|
+
useEffect(() => stopResize, [stopResize]);
|
|
11529
|
+
const handlePointerDown = (event) => {
|
|
11530
|
+
if (!resizable) return;
|
|
11531
|
+
event.preventDefault();
|
|
11532
|
+
stopResize();
|
|
11533
|
+
updateFromPointer(event);
|
|
11534
|
+
const handleMove = (nextEvent) => {
|
|
11535
|
+
updateFromPointer(nextEvent);
|
|
11536
|
+
};
|
|
11537
|
+
const handleStop = () => {
|
|
11538
|
+
stopResize();
|
|
11539
|
+
};
|
|
11540
|
+
window.addEventListener("pointermove", handleMove);
|
|
11541
|
+
window.addEventListener("pointerup", handleStop, { once: true });
|
|
11542
|
+
window.addEventListener("pointercancel", handleStop, { once: true });
|
|
11543
|
+
cleanupRef.current = () => {
|
|
11544
|
+
window.removeEventListener("pointermove", handleMove);
|
|
11545
|
+
window.removeEventListener("pointerup", handleStop);
|
|
11546
|
+
window.removeEventListener("pointercancel", handleStop);
|
|
11547
|
+
};
|
|
11548
|
+
};
|
|
11549
|
+
const handleKeyDown = (event) => {
|
|
11550
|
+
if (!resizable) return;
|
|
11551
|
+
const step = event.shiftKey ? bounds.keyboardStep * 4 : bounds.keyboardStep;
|
|
11552
|
+
let nextSize;
|
|
11553
|
+
if (event.key === "Home") nextSize = bounds.min;
|
|
11554
|
+
if (event.key === "End") nextSize = bounds.max;
|
|
11555
|
+
if (orientation === "horizontal" && event.key === "ArrowLeft") {
|
|
11556
|
+
nextSize = renderedSize - step;
|
|
11557
|
+
}
|
|
11558
|
+
if (orientation === "horizontal" && event.key === "ArrowRight") {
|
|
11559
|
+
nextSize = renderedSize + step;
|
|
11560
|
+
}
|
|
11561
|
+
if (orientation === "vertical" && event.key === "ArrowUp") {
|
|
11562
|
+
nextSize = renderedSize - step;
|
|
11563
|
+
}
|
|
11564
|
+
if (orientation === "vertical" && event.key === "ArrowDown") {
|
|
11565
|
+
nextSize = renderedSize + step;
|
|
11566
|
+
}
|
|
11567
|
+
if (nextSize === void 0) return;
|
|
11568
|
+
event.preventDefault();
|
|
11569
|
+
commitSize(nextSize);
|
|
11570
|
+
};
|
|
11571
|
+
const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
|
|
11572
|
+
const resizeTrack = resolvedGap !== void 0 ? "var(--base-layout-split-gap)" : "auto";
|
|
11573
|
+
const resizeHandleStyle = resolvedGap !== void 0 ? orientation === "horizontal" ? { width: "var(--base-layout-split-gap)" } : { height: "var(--base-layout-split-gap)" } : void 0;
|
|
11574
|
+
const splitStyle = {
|
|
11575
|
+
...theme.styles.layoutSplit,
|
|
11576
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: resizable ? `${renderedSize}% ${resizeTrack} minmax(0, 1fr)` : `${renderedSize}% minmax(0, 1fr)`,
|
|
11577
|
+
...resizable ? { gap: 0 } : {},
|
|
11578
|
+
...resolvedGap !== void 0 ? {
|
|
11579
|
+
"--base-layout-split-gap": resolvedGap,
|
|
11580
|
+
...resizable ? {} : { gap: resolvedGap }
|
|
11581
|
+
} : {},
|
|
11582
|
+
...style
|
|
11583
|
+
};
|
|
11584
|
+
return /* @__PURE__ */ jsxs(
|
|
11585
|
+
"div",
|
|
11586
|
+
{
|
|
11587
|
+
...splitProps,
|
|
11588
|
+
ref: rootRef,
|
|
11589
|
+
className: cn(
|
|
11590
|
+
theme.slots.layoutSplitRoot,
|
|
11591
|
+
orientation === "horizontal" ? theme.slots.layoutSplitHorizontal : theme.slots.layoutSplitVertical,
|
|
11592
|
+
classNames?.root,
|
|
11593
|
+
className
|
|
11594
|
+
),
|
|
11595
|
+
style: splitStyle,
|
|
11596
|
+
children: [
|
|
11597
|
+
/* @__PURE__ */ jsx(
|
|
11598
|
+
"div",
|
|
11599
|
+
{
|
|
11600
|
+
className: cn(
|
|
11601
|
+
theme.slots.layoutSplitPane,
|
|
11602
|
+
theme.slots.layoutSplitPrimary,
|
|
11603
|
+
classNames?.primary
|
|
11604
|
+
),
|
|
11605
|
+
style: theme.styles.layoutSplitPane,
|
|
11606
|
+
children: hasRenderableNode(primary) ? primary : children
|
|
11607
|
+
}
|
|
11608
|
+
),
|
|
11609
|
+
resizable ? /* @__PURE__ */ jsx(
|
|
11610
|
+
BaseLayoutResizeHandle,
|
|
11611
|
+
{
|
|
11612
|
+
orientation,
|
|
11613
|
+
resizable: true,
|
|
11614
|
+
size: renderedSize,
|
|
11615
|
+
minSize: bounds.min,
|
|
11616
|
+
maxSize: bounds.max,
|
|
11617
|
+
label: resizeLabel,
|
|
11618
|
+
appearance,
|
|
11619
|
+
className: classNames?.handle,
|
|
11620
|
+
style: resizeHandleStyle,
|
|
11621
|
+
onPointerDown: handlePointerDown,
|
|
11622
|
+
onKeyDown: handleKeyDown
|
|
11623
|
+
}
|
|
11624
|
+
) : null,
|
|
11625
|
+
/* @__PURE__ */ jsx(
|
|
11626
|
+
"div",
|
|
11627
|
+
{
|
|
11628
|
+
className: cn(
|
|
11629
|
+
theme.slots.layoutSplitPane,
|
|
11630
|
+
theme.slots.layoutSplitSecondary,
|
|
11631
|
+
classNames?.secondary
|
|
11632
|
+
),
|
|
11633
|
+
style: theme.styles.layoutSplitPane,
|
|
11634
|
+
children: secondary
|
|
11635
|
+
}
|
|
11636
|
+
)
|
|
11637
|
+
]
|
|
11638
|
+
}
|
|
11639
|
+
);
|
|
11640
|
+
}
|
|
11133
11641
|
function DefaultLoadingIcon({ className }) {
|
|
11134
11642
|
return /* @__PURE__ */ jsxs(
|
|
11135
11643
|
"svg",
|
|
@@ -11207,67 +11715,509 @@ function BaseLoadingState({
|
|
|
11207
11715
|
}
|
|
11208
11716
|
);
|
|
11209
11717
|
}
|
|
11210
|
-
function
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
{
|
|
11228
|
-
...noticeProps,
|
|
11229
|
-
className: cn(
|
|
11230
|
-
theme.slots.noticeBase,
|
|
11231
|
-
getBaseNoticeToneClassName(theme, tone),
|
|
11232
|
-
classNames?.root,
|
|
11233
|
-
className
|
|
11234
|
-
),
|
|
11235
|
-
style: {
|
|
11236
|
-
...theme.styles.notice,
|
|
11237
|
-
...style
|
|
11238
|
-
},
|
|
11239
|
-
children: [
|
|
11240
|
-
hasRenderableNode(icon) ? /* @__PURE__ */ jsx("div", { className: cn(theme.slots.noticeIcon, classNames?.icon), children: icon }) : null,
|
|
11241
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
11242
|
-
hasRenderableNode(title) ? /* @__PURE__ */ jsx("div", { className: cn(theme.slots.noticeTitle, classNames?.title), children: title }) : null,
|
|
11243
|
-
hasRenderableNode(resolvedDescription) ? /* @__PURE__ */ jsx(
|
|
11244
|
-
"div",
|
|
11245
|
-
{
|
|
11246
|
-
className: cn(
|
|
11247
|
-
theme.slots.noticeDescription,
|
|
11248
|
-
classNames?.description
|
|
11249
|
-
),
|
|
11250
|
-
children: resolvedDescription
|
|
11251
|
-
}
|
|
11252
|
-
) : null,
|
|
11253
|
-
hasRenderableNode(actions) ? /* @__PURE__ */ jsx("div", { className: cn(theme.slots.noticeActions, classNames?.actions), children: actions }) : null
|
|
11254
|
-
] })
|
|
11255
|
-
]
|
|
11718
|
+
function normalizeValues(values) {
|
|
11719
|
+
const nextValues = [];
|
|
11720
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11721
|
+
values?.forEach((value) => {
|
|
11722
|
+
if (seen.has(value)) return;
|
|
11723
|
+
seen.add(value);
|
|
11724
|
+
nextValues.push(value);
|
|
11725
|
+
});
|
|
11726
|
+
return nextValues;
|
|
11727
|
+
}
|
|
11728
|
+
function getNextEnabledIndex(options, currentIndex, direction) {
|
|
11729
|
+
if (!options.length) return -1;
|
|
11730
|
+
const startIndex = currentIndex >= 0 ? currentIndex : 0;
|
|
11731
|
+
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
11732
|
+
const nextIndex = (startIndex + offset * direction + options.length) % options.length;
|
|
11733
|
+
if (!options[nextIndex]?.disabled) {
|
|
11734
|
+
return nextIndex;
|
|
11256
11735
|
}
|
|
11257
|
-
|
|
11736
|
+
}
|
|
11737
|
+
return -1;
|
|
11258
11738
|
}
|
|
11259
|
-
function
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11739
|
+
function getFirstEnabledIndex(options) {
|
|
11740
|
+
return options.findIndex((option) => !option.disabled);
|
|
11741
|
+
}
|
|
11742
|
+
function getSafeTagCount(maxTagCount, total) {
|
|
11743
|
+
if (maxTagCount === void 0) return total;
|
|
11744
|
+
if (!Number.isFinite(maxTagCount)) return total;
|
|
11745
|
+
return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
|
|
11746
|
+
}
|
|
11747
|
+
function getDefaultRemoveLabel(option) {
|
|
11748
|
+
return `Remove ${option.value}`;
|
|
11749
|
+
}
|
|
11750
|
+
var BaseMultiSelect = forwardRef(
|
|
11751
|
+
function BaseMultiSelect2({
|
|
11752
|
+
options,
|
|
11753
|
+
value,
|
|
11754
|
+
defaultValue,
|
|
11755
|
+
name,
|
|
11756
|
+
placeholder = "Select options",
|
|
11757
|
+
icon,
|
|
11758
|
+
invalid = false,
|
|
11759
|
+
disabled = false,
|
|
11760
|
+
required = false,
|
|
11761
|
+
openForPreview = false,
|
|
11762
|
+
maxTagCount,
|
|
11763
|
+
removeLabel = getDefaultRemoveLabel,
|
|
11764
|
+
emptyLabel = "No options",
|
|
11765
|
+
appearance,
|
|
11766
|
+
className,
|
|
11767
|
+
classNames,
|
|
11768
|
+
style,
|
|
11769
|
+
id,
|
|
11770
|
+
"aria-invalid": nativeAriaInvalid,
|
|
11771
|
+
"aria-label": nativeAriaLabel,
|
|
11772
|
+
"aria-labelledby": nativeAriaLabelledBy,
|
|
11773
|
+
onValueChange,
|
|
11774
|
+
...rootProps
|
|
11775
|
+
}, ref) {
|
|
11776
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11777
|
+
const generatedId = useId();
|
|
11778
|
+
const multiSelectId = id ?? generatedId;
|
|
11779
|
+
const controlId = `${multiSelectId}-control`;
|
|
11780
|
+
const listboxId = `${multiSelectId}-listbox`;
|
|
11781
|
+
const rootRef = useRef(null);
|
|
11782
|
+
const optionList = options ?? [];
|
|
11783
|
+
const forceOpen = openForPreview;
|
|
11784
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
11785
|
+
const open = forceOpen || uncontrolledOpen;
|
|
11786
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
11787
|
+
() => normalizeValues(defaultValue)
|
|
11788
|
+
);
|
|
11789
|
+
const [activeIndex, setActiveIndex] = useState(
|
|
11790
|
+
() => getFirstEnabledIndex(optionList)
|
|
11791
|
+
);
|
|
11792
|
+
const isControlled = value !== void 0;
|
|
11793
|
+
const selectedValues = useMemo(
|
|
11794
|
+
() => normalizeValues(isControlled ? value : uncontrolledValue),
|
|
11795
|
+
[isControlled, uncontrolledValue, value]
|
|
11796
|
+
);
|
|
11797
|
+
const selectedValueSet = useMemo(
|
|
11798
|
+
() => new Set(selectedValues),
|
|
11799
|
+
[selectedValues]
|
|
11800
|
+
);
|
|
11801
|
+
const optionByValue = useMemo(() => {
|
|
11802
|
+
const map = /* @__PURE__ */ new Map();
|
|
11803
|
+
optionList.forEach((option) => {
|
|
11804
|
+
if (!map.has(option.value)) {
|
|
11805
|
+
map.set(option.value, option);
|
|
11806
|
+
}
|
|
11807
|
+
});
|
|
11808
|
+
return map;
|
|
11809
|
+
}, [optionList]);
|
|
11810
|
+
const selectedOptions = useMemo(
|
|
11811
|
+
() => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
|
|
11812
|
+
(option) => option !== void 0
|
|
11813
|
+
),
|
|
11814
|
+
[optionByValue, selectedValues]
|
|
11815
|
+
);
|
|
11816
|
+
const firstEnabledIndex = useMemo(
|
|
11817
|
+
() => getFirstEnabledIndex(optionList),
|
|
11818
|
+
[optionList]
|
|
11819
|
+
);
|
|
11820
|
+
const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
|
|
11821
|
+
const visibleTagCount = getSafeTagCount(
|
|
11822
|
+
maxTagCount,
|
|
11823
|
+
selectedOptions.length
|
|
11824
|
+
);
|
|
11825
|
+
const visibleOptions = selectedOptions.slice(0, visibleTagCount);
|
|
11826
|
+
const overflowCount = selectedOptions.length - visibleOptions.length;
|
|
11827
|
+
const isPlaceholder = selectedOptions.length === 0;
|
|
11828
|
+
const setRootRef = (node) => {
|
|
11829
|
+
rootRef.current = node;
|
|
11830
|
+
if (typeof ref === "function") {
|
|
11831
|
+
ref(node);
|
|
11832
|
+
} else if (ref) {
|
|
11833
|
+
ref.current = node;
|
|
11834
|
+
}
|
|
11835
|
+
};
|
|
11836
|
+
const setOpen = (nextOpen) => {
|
|
11837
|
+
if (disabled || forceOpen) return;
|
|
11838
|
+
setUncontrolledOpen(nextOpen);
|
|
11839
|
+
if (nextOpen) {
|
|
11840
|
+
setActiveIndex(resolvedActiveIndex);
|
|
11841
|
+
}
|
|
11842
|
+
};
|
|
11843
|
+
useEffect(() => {
|
|
11844
|
+
if (!open || forceOpen) return void 0;
|
|
11845
|
+
const handlePointerDown = (event) => {
|
|
11846
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
11847
|
+
setUncontrolledOpen(false);
|
|
11848
|
+
}
|
|
11849
|
+
};
|
|
11850
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
11851
|
+
return () => {
|
|
11852
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
11853
|
+
};
|
|
11854
|
+
}, [forceOpen, open]);
|
|
11855
|
+
useEffect(() => {
|
|
11856
|
+
if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
|
|
11857
|
+
setActiveIndex(resolvedActiveIndex);
|
|
11858
|
+
}
|
|
11859
|
+
}, [activeIndex, resolvedActiveIndex]);
|
|
11860
|
+
const commitValues = (nextValues) => {
|
|
11861
|
+
const normalizedValues = normalizeValues(nextValues);
|
|
11862
|
+
if (!isControlled) {
|
|
11863
|
+
setUncontrolledValue(normalizedValues);
|
|
11864
|
+
}
|
|
11865
|
+
onValueChange?.(normalizedValues);
|
|
11866
|
+
};
|
|
11867
|
+
const toggleOption = (option) => {
|
|
11868
|
+
if (!option || option.disabled || disabled) return;
|
|
11869
|
+
const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
|
|
11870
|
+
commitValues(nextValues);
|
|
11871
|
+
};
|
|
11872
|
+
const removeOption = (option) => {
|
|
11873
|
+
if (disabled) return;
|
|
11874
|
+
commitValues(
|
|
11875
|
+
selectedValues.filter((selectedValue) => selectedValue !== option.value)
|
|
11876
|
+
);
|
|
11877
|
+
};
|
|
11878
|
+
const focusOption = (direction) => {
|
|
11879
|
+
const nextIndex = getNextEnabledIndex(
|
|
11880
|
+
optionList,
|
|
11881
|
+
resolvedActiveIndex,
|
|
11882
|
+
direction
|
|
11883
|
+
);
|
|
11884
|
+
if (nextIndex >= 0) {
|
|
11885
|
+
setActiveIndex(nextIndex);
|
|
11886
|
+
}
|
|
11887
|
+
};
|
|
11888
|
+
const handleKeyDown = (event) => {
|
|
11889
|
+
if (disabled) return;
|
|
11890
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
11891
|
+
event.preventDefault();
|
|
11892
|
+
if (!open) {
|
|
11893
|
+
setOpen(true);
|
|
11894
|
+
setActiveIndex(firstEnabledIndex);
|
|
11895
|
+
return;
|
|
11896
|
+
}
|
|
11897
|
+
focusOption(event.key === "ArrowDown" ? 1 : -1);
|
|
11898
|
+
return;
|
|
11899
|
+
}
|
|
11900
|
+
if (event.key === "Home") {
|
|
11901
|
+
event.preventDefault();
|
|
11902
|
+
setOpen(true);
|
|
11903
|
+
setActiveIndex(firstEnabledIndex);
|
|
11904
|
+
return;
|
|
11905
|
+
}
|
|
11906
|
+
if (event.key === "End") {
|
|
11907
|
+
event.preventDefault();
|
|
11908
|
+
setOpen(true);
|
|
11909
|
+
for (let index = optionList.length - 1; index >= 0; index -= 1) {
|
|
11910
|
+
if (!optionList[index]?.disabled) {
|
|
11911
|
+
setActiveIndex(index);
|
|
11912
|
+
break;
|
|
11913
|
+
}
|
|
11914
|
+
}
|
|
11915
|
+
return;
|
|
11916
|
+
}
|
|
11917
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
11918
|
+
event.preventDefault();
|
|
11919
|
+
if (!open) {
|
|
11920
|
+
setOpen(true);
|
|
11921
|
+
return;
|
|
11922
|
+
}
|
|
11923
|
+
toggleOption(optionList[resolvedActiveIndex]);
|
|
11924
|
+
return;
|
|
11925
|
+
}
|
|
11926
|
+
if (event.key === "Escape") {
|
|
11927
|
+
setOpen(false);
|
|
11928
|
+
}
|
|
11929
|
+
};
|
|
11930
|
+
return /* @__PURE__ */ jsxs(
|
|
11931
|
+
"div",
|
|
11932
|
+
{
|
|
11933
|
+
...rootProps,
|
|
11934
|
+
id,
|
|
11935
|
+
ref: setRootRef,
|
|
11936
|
+
className: cn(
|
|
11937
|
+
theme.slots.controlWrapper,
|
|
11938
|
+
"overflow-visible",
|
|
11939
|
+
open && "z-50",
|
|
11940
|
+
invalid && theme.slots.controlInvalid,
|
|
11941
|
+
disabled && theme.slots.controlDisabled,
|
|
11942
|
+
classNames?.root,
|
|
11943
|
+
className
|
|
11944
|
+
),
|
|
11945
|
+
style: {
|
|
11946
|
+
...theme.styles.control,
|
|
11947
|
+
...invalid ? theme.styles.controlInvalid : void 0,
|
|
11948
|
+
...disabled ? theme.styles.controlDisabled : void 0,
|
|
11949
|
+
...style
|
|
11950
|
+
},
|
|
11951
|
+
children: [
|
|
11952
|
+
hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
|
|
11953
|
+
/* @__PURE__ */ jsx(
|
|
11954
|
+
"div",
|
|
11955
|
+
{
|
|
11956
|
+
id: controlId,
|
|
11957
|
+
role: "combobox",
|
|
11958
|
+
tabIndex: disabled ? -1 : 0,
|
|
11959
|
+
"aria-haspopup": "listbox",
|
|
11960
|
+
"aria-expanded": open,
|
|
11961
|
+
"aria-controls": listboxId,
|
|
11962
|
+
"aria-disabled": disabled || void 0,
|
|
11963
|
+
"aria-required": required || void 0,
|
|
11964
|
+
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
11965
|
+
"aria-label": nativeAriaLabel,
|
|
11966
|
+
"aria-labelledby": nativeAriaLabelledBy,
|
|
11967
|
+
className: cn(
|
|
11968
|
+
theme.slots.controlBase,
|
|
11969
|
+
"flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
|
|
11970
|
+
disabled && "!cursor-not-allowed",
|
|
11971
|
+
classNames?.control
|
|
11972
|
+
),
|
|
11973
|
+
onClick: () => setOpen(!open),
|
|
11974
|
+
onKeyDown: handleKeyDown,
|
|
11975
|
+
children: /* @__PURE__ */ jsxs(
|
|
11976
|
+
"span",
|
|
11977
|
+
{
|
|
11978
|
+
className: cn(
|
|
11979
|
+
"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
|
|
11980
|
+
classNames?.tagList
|
|
11981
|
+
),
|
|
11982
|
+
children: [
|
|
11983
|
+
visibleOptions.map((option) => /* @__PURE__ */ jsxs(
|
|
11984
|
+
"span",
|
|
11985
|
+
{
|
|
11986
|
+
className: cn(
|
|
11987
|
+
"inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-muted/65 px-2 py-0.5 text-xs font-medium text-foreground",
|
|
11988
|
+
classNames?.tag
|
|
11989
|
+
),
|
|
11990
|
+
children: [
|
|
11991
|
+
/* @__PURE__ */ jsx(
|
|
11992
|
+
"span",
|
|
11993
|
+
{
|
|
11994
|
+
className: cn(
|
|
11995
|
+
"max-w-40 truncate",
|
|
11996
|
+
classNames?.tagLabel
|
|
11997
|
+
),
|
|
11998
|
+
children: option.label
|
|
11999
|
+
}
|
|
12000
|
+
),
|
|
12001
|
+
/* @__PURE__ */ jsx(
|
|
12002
|
+
"button",
|
|
12003
|
+
{
|
|
12004
|
+
type: "button",
|
|
12005
|
+
"aria-label": removeLabel(option),
|
|
12006
|
+
disabled,
|
|
12007
|
+
className: cn(
|
|
12008
|
+
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background/80 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed",
|
|
12009
|
+
classNames?.tagRemove
|
|
12010
|
+
),
|
|
12011
|
+
onClick: (event) => {
|
|
12012
|
+
event.preventDefault();
|
|
12013
|
+
event.stopPropagation();
|
|
12014
|
+
removeOption(option);
|
|
12015
|
+
},
|
|
12016
|
+
onMouseDown: (event) => {
|
|
12017
|
+
event.preventDefault();
|
|
12018
|
+
event.stopPropagation();
|
|
12019
|
+
},
|
|
12020
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
12021
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "x" })
|
|
12022
|
+
}
|
|
12023
|
+
)
|
|
12024
|
+
]
|
|
12025
|
+
},
|
|
12026
|
+
option.value
|
|
12027
|
+
)),
|
|
12028
|
+
overflowCount > 0 ? /* @__PURE__ */ jsxs(
|
|
12029
|
+
"span",
|
|
12030
|
+
{
|
|
12031
|
+
className: cn(
|
|
12032
|
+
"inline-flex max-w-full items-center rounded-full border border-border/70 bg-muted/45 px-2 py-0.5 text-xs font-medium text-muted-foreground",
|
|
12033
|
+
classNames?.tag
|
|
12034
|
+
),
|
|
12035
|
+
children: [
|
|
12036
|
+
"+",
|
|
12037
|
+
overflowCount
|
|
12038
|
+
]
|
|
12039
|
+
}
|
|
12040
|
+
) : null,
|
|
12041
|
+
isPlaceholder ? /* @__PURE__ */ jsx(
|
|
12042
|
+
"span",
|
|
12043
|
+
{
|
|
12044
|
+
className: cn(
|
|
12045
|
+
"min-w-0 truncate",
|
|
12046
|
+
theme.slots.selectPlaceholder,
|
|
12047
|
+
classNames?.placeholder
|
|
12048
|
+
),
|
|
12049
|
+
children: placeholder
|
|
12050
|
+
}
|
|
12051
|
+
) : null
|
|
12052
|
+
]
|
|
12053
|
+
}
|
|
12054
|
+
)
|
|
12055
|
+
}
|
|
12056
|
+
),
|
|
12057
|
+
/* @__PURE__ */ jsx(
|
|
12058
|
+
"span",
|
|
12059
|
+
{
|
|
12060
|
+
className: cn(
|
|
12061
|
+
theme.slots.selectChevron,
|
|
12062
|
+
open && "rotate-[225deg]",
|
|
12063
|
+
classNames?.chevron
|
|
12064
|
+
)
|
|
12065
|
+
}
|
|
12066
|
+
),
|
|
12067
|
+
name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsx(
|
|
12068
|
+
"input",
|
|
12069
|
+
{
|
|
12070
|
+
type: "hidden",
|
|
12071
|
+
name,
|
|
12072
|
+
value: selectedValue,
|
|
12073
|
+
className: classNames?.hiddenInput
|
|
12074
|
+
},
|
|
12075
|
+
selectedValue
|
|
12076
|
+
)) : null,
|
|
12077
|
+
open ? /* @__PURE__ */ jsx(
|
|
12078
|
+
"div",
|
|
12079
|
+
{
|
|
12080
|
+
id: listboxId,
|
|
12081
|
+
role: "listbox",
|
|
12082
|
+
"aria-multiselectable": "true",
|
|
12083
|
+
"aria-labelledby": controlId,
|
|
12084
|
+
className: cn(theme.slots.selectMenu, classNames?.menu),
|
|
12085
|
+
style: theme.styles.selectMenu,
|
|
12086
|
+
children: optionList.length > 0 ? optionList.map((option, index) => {
|
|
12087
|
+
const selected = selectedValueSet.has(option.value);
|
|
12088
|
+
const active = index === resolvedActiveIndex;
|
|
12089
|
+
return /* @__PURE__ */ jsxs(
|
|
12090
|
+
"button",
|
|
12091
|
+
{
|
|
12092
|
+
type: "button",
|
|
12093
|
+
role: "option",
|
|
12094
|
+
"aria-selected": selected,
|
|
12095
|
+
disabled: option.disabled,
|
|
12096
|
+
className: cn(
|
|
12097
|
+
theme.slots.selectOption,
|
|
12098
|
+
"gap-2",
|
|
12099
|
+
active && theme.slots.selectOptionActive,
|
|
12100
|
+
selected && theme.slots.selectOptionSelected,
|
|
12101
|
+
option.disabled && theme.slots.selectOptionDisabled,
|
|
12102
|
+
classNames?.option
|
|
12103
|
+
),
|
|
12104
|
+
style: {
|
|
12105
|
+
...theme.styles.selectOption,
|
|
12106
|
+
...active ? theme.styles.selectOptionActive : void 0,
|
|
12107
|
+
...selected ? theme.styles.selectOptionSelected : void 0
|
|
12108
|
+
},
|
|
12109
|
+
onMouseEnter: () => {
|
|
12110
|
+
if (!option.disabled) {
|
|
12111
|
+
setActiveIndex(index);
|
|
12112
|
+
}
|
|
12113
|
+
},
|
|
12114
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
12115
|
+
onClick: () => toggleOption(option),
|
|
12116
|
+
children: [
|
|
12117
|
+
/* @__PURE__ */ jsx(
|
|
12118
|
+
"span",
|
|
12119
|
+
{
|
|
12120
|
+
"aria-hidden": "true",
|
|
12121
|
+
className: cn(
|
|
12122
|
+
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
|
|
12123
|
+
selected && "border-primary/40 bg-primary text-primary-foreground",
|
|
12124
|
+
classNames?.optionIndicator
|
|
12125
|
+
),
|
|
12126
|
+
children: selected ? "\u2713" : null
|
|
12127
|
+
}
|
|
12128
|
+
),
|
|
12129
|
+
/* @__PURE__ */ jsx(
|
|
12130
|
+
"span",
|
|
12131
|
+
{
|
|
12132
|
+
className: cn(
|
|
12133
|
+
"min-w-0 flex-1 truncate",
|
|
12134
|
+
classNames?.optionLabel
|
|
12135
|
+
),
|
|
12136
|
+
children: option.label
|
|
12137
|
+
}
|
|
12138
|
+
)
|
|
12139
|
+
]
|
|
12140
|
+
},
|
|
12141
|
+
option.value
|
|
12142
|
+
);
|
|
12143
|
+
}) : /* @__PURE__ */ jsx(
|
|
12144
|
+
"div",
|
|
12145
|
+
{
|
|
12146
|
+
className: cn(
|
|
12147
|
+
"px-2.5 py-2 text-sm text-muted-foreground",
|
|
12148
|
+
classNames?.empty
|
|
12149
|
+
),
|
|
12150
|
+
children: emptyLabel
|
|
12151
|
+
}
|
|
12152
|
+
)
|
|
12153
|
+
}
|
|
12154
|
+
) : null
|
|
12155
|
+
]
|
|
12156
|
+
}
|
|
12157
|
+
);
|
|
12158
|
+
}
|
|
12159
|
+
);
|
|
12160
|
+
function BaseNotice({
|
|
12161
|
+
tone,
|
|
12162
|
+
icon,
|
|
12163
|
+
title,
|
|
12164
|
+
description,
|
|
12165
|
+
actions,
|
|
12166
|
+
children,
|
|
12167
|
+
appearance,
|
|
12168
|
+
className,
|
|
12169
|
+
classNames,
|
|
12170
|
+
style,
|
|
12171
|
+
...noticeProps
|
|
12172
|
+
}) {
|
|
12173
|
+
const theme = resolveBaseAppearance(appearance);
|
|
12174
|
+
const resolvedDescription = children ?? description;
|
|
12175
|
+
return /* @__PURE__ */ jsxs(
|
|
12176
|
+
"div",
|
|
12177
|
+
{
|
|
12178
|
+
...noticeProps,
|
|
12179
|
+
className: cn(
|
|
12180
|
+
theme.slots.noticeBase,
|
|
12181
|
+
getBaseNoticeToneClassName(theme, tone),
|
|
12182
|
+
classNames?.root,
|
|
12183
|
+
className
|
|
12184
|
+
),
|
|
12185
|
+
style: {
|
|
12186
|
+
...theme.styles.notice,
|
|
12187
|
+
...style
|
|
12188
|
+
},
|
|
12189
|
+
children: [
|
|
12190
|
+
hasRenderableNode(icon) ? /* @__PURE__ */ jsx("div", { className: cn(theme.slots.noticeIcon, classNames?.icon), children: icon }) : null,
|
|
12191
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
12192
|
+
hasRenderableNode(title) ? /* @__PURE__ */ jsx("div", { className: cn(theme.slots.noticeTitle, classNames?.title), children: title }) : null,
|
|
12193
|
+
hasRenderableNode(resolvedDescription) ? /* @__PURE__ */ jsx(
|
|
12194
|
+
"div",
|
|
12195
|
+
{
|
|
12196
|
+
className: cn(
|
|
12197
|
+
theme.slots.noticeDescription,
|
|
12198
|
+
classNames?.description
|
|
12199
|
+
),
|
|
12200
|
+
children: resolvedDescription
|
|
12201
|
+
}
|
|
12202
|
+
) : null,
|
|
12203
|
+
hasRenderableNode(actions) ? /* @__PURE__ */ jsx("div", { className: cn(theme.slots.noticeActions, classNames?.actions), children: actions }) : null
|
|
12204
|
+
] })
|
|
12205
|
+
]
|
|
12206
|
+
}
|
|
12207
|
+
);
|
|
12208
|
+
}
|
|
12209
|
+
function BasePanel({
|
|
12210
|
+
as = "article",
|
|
12211
|
+
title,
|
|
12212
|
+
description,
|
|
12213
|
+
media,
|
|
12214
|
+
header,
|
|
12215
|
+
footer,
|
|
12216
|
+
children,
|
|
12217
|
+
interactive,
|
|
12218
|
+
selected,
|
|
12219
|
+
disabled,
|
|
12220
|
+
appearance,
|
|
11271
12221
|
className,
|
|
11272
12222
|
classNames,
|
|
11273
12223
|
style,
|
|
@@ -11419,7 +12369,7 @@ function BasePagination({
|
|
|
11419
12369
|
function toFiniteNumber(value, fallback) {
|
|
11420
12370
|
return Number.isFinite(value) ? Number(value) : fallback;
|
|
11421
12371
|
}
|
|
11422
|
-
function
|
|
12372
|
+
function clamp2(value, min5, max5) {
|
|
11423
12373
|
return Math.min(Math.max(value, min5), max5);
|
|
11424
12374
|
}
|
|
11425
12375
|
function BaseProgress({
|
|
@@ -11437,7 +12387,7 @@ function BaseProgress({
|
|
|
11437
12387
|
}) {
|
|
11438
12388
|
const theme = resolveBaseAppearance(appearance);
|
|
11439
12389
|
const safeMax = Math.max(toFiniteNumber(max5, 100), 1);
|
|
11440
|
-
const safeValue =
|
|
12390
|
+
const safeValue = clamp2(toFiniteNumber(value, 0), 0, safeMax);
|
|
11441
12391
|
const percent = safeValue / safeMax * 100;
|
|
11442
12392
|
const renderedValue = valueFormatter?.(safeValue, safeMax) ?? `${Math.round(percent)}%`;
|
|
11443
12393
|
const hasLabelRow = hasRenderableNode(label) || showValue;
|
|
@@ -11608,7 +12558,7 @@ function getInitialValue2(options, defaultValue) {
|
|
|
11608
12558
|
}
|
|
11609
12559
|
return "";
|
|
11610
12560
|
}
|
|
11611
|
-
function
|
|
12561
|
+
function getNextEnabledIndex2(options, currentIndex, direction) {
|
|
11612
12562
|
if (!options.length) return -1;
|
|
11613
12563
|
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
11614
12564
|
const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
|
|
@@ -11710,7 +12660,7 @@ var BaseSelect = forwardRef(
|
|
|
11710
12660
|
};
|
|
11711
12661
|
const focusOption = (direction) => {
|
|
11712
12662
|
const currentIndex = activeIndex >= 0 ? activeIndex : 0;
|
|
11713
|
-
const nextIndex =
|
|
12663
|
+
const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
|
|
11714
12664
|
if (nextIndex >= 0) {
|
|
11715
12665
|
commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
|
|
11716
12666
|
}
|
|
@@ -12203,7 +13153,7 @@ function useBaseTableContext(appearance) {
|
|
|
12203
13153
|
}
|
|
12204
13154
|
};
|
|
12205
13155
|
}
|
|
12206
|
-
function
|
|
13156
|
+
function toCssSize2(value) {
|
|
12207
13157
|
if (value === void 0) return void 0;
|
|
12208
13158
|
return typeof value === "number" ? `${value}px` : value;
|
|
12209
13159
|
}
|
|
@@ -12416,7 +13366,7 @@ function BaseTableRow({
|
|
|
12416
13366
|
}
|
|
12417
13367
|
);
|
|
12418
13368
|
}
|
|
12419
|
-
|
|
13369
|
+
var BaseTableHead = forwardRef(function BaseTableHead2({
|
|
12420
13370
|
columnId,
|
|
12421
13371
|
align = "left",
|
|
12422
13372
|
icon,
|
|
@@ -12444,10 +13394,18 @@ function BaseTableHead({
|
|
|
12444
13394
|
onDragOver,
|
|
12445
13395
|
onDrop,
|
|
12446
13396
|
...headProps
|
|
12447
|
-
}) {
|
|
13397
|
+
}, forwardedRef) {
|
|
12448
13398
|
const tableContext = useBaseTableContext(appearance);
|
|
12449
13399
|
const { theme } = tableContext;
|
|
12450
13400
|
const headRef = useRef(null);
|
|
13401
|
+
const setHeadRef = (node) => {
|
|
13402
|
+
headRef.current = node;
|
|
13403
|
+
if (typeof forwardedRef === "function") {
|
|
13404
|
+
forwardedRef(node);
|
|
13405
|
+
} else if (forwardedRef) {
|
|
13406
|
+
forwardedRef.current = node;
|
|
13407
|
+
}
|
|
13408
|
+
};
|
|
12451
13409
|
const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
|
|
12452
13410
|
const canDrag = Boolean(
|
|
12453
13411
|
columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
|
|
@@ -12602,7 +13560,7 @@ function BaseTableHead({
|
|
|
12602
13560
|
"th",
|
|
12603
13561
|
{
|
|
12604
13562
|
...headProps,
|
|
12605
|
-
ref:
|
|
13563
|
+
ref: setHeadRef,
|
|
12606
13564
|
scope: headProps.scope ?? "col",
|
|
12607
13565
|
"aria-sort": ariaSort,
|
|
12608
13566
|
className: cn(
|
|
@@ -12614,9 +13572,9 @@ function BaseTableHead({
|
|
|
12614
13572
|
),
|
|
12615
13573
|
style: {
|
|
12616
13574
|
...theme.styles.tableHead,
|
|
12617
|
-
width:
|
|
12618
|
-
minWidth:
|
|
12619
|
-
maxWidth:
|
|
13575
|
+
width: toCssSize2(controlledWidth),
|
|
13576
|
+
minWidth: toCssSize2(minWidth),
|
|
13577
|
+
maxWidth: toCssSize2(maxWidth),
|
|
12620
13578
|
...style
|
|
12621
13579
|
},
|
|
12622
13580
|
onDragOver: handleDragOver,
|
|
@@ -12637,7 +13595,7 @@ function BaseTableHead({
|
|
|
12637
13595
|
]
|
|
12638
13596
|
}
|
|
12639
13597
|
);
|
|
12640
|
-
}
|
|
13598
|
+
});
|
|
12641
13599
|
function BaseTableCell({
|
|
12642
13600
|
align = "left",
|
|
12643
13601
|
appearance,
|
|
@@ -12765,7 +13723,7 @@ function BaseTableLoading({
|
|
|
12765
13723
|
classNames?.skeleton
|
|
12766
13724
|
),
|
|
12767
13725
|
style: {
|
|
12768
|
-
width:
|
|
13726
|
+
width: toCssSize2(columnWidths[columnIndex])
|
|
12769
13727
|
}
|
|
12770
13728
|
}
|
|
12771
13729
|
)
|
|
@@ -15780,7 +16738,7 @@ var DEFAULT_ZOOM_STEP = 1.18;
|
|
|
15780
16738
|
var DEFAULT_STAGE_PADDING = 16;
|
|
15781
16739
|
var MAX_SAFE_SCALE = 1e6;
|
|
15782
16740
|
var MIN_SAFE_SCALE = 1e-6;
|
|
15783
|
-
var
|
|
16741
|
+
var clamp3 = (value, min5, max5) => Math.min(max5, Math.max(min5, value));
|
|
15784
16742
|
var isNoDragTarget = (target) => target instanceof Element && Boolean(target.closest('[data-no-drag="true"]'));
|
|
15785
16743
|
function ResetIcon() {
|
|
15786
16744
|
return /* @__PURE__ */ jsxs(
|
|
@@ -15904,7 +16862,7 @@ function DataExplorerImagePreview({
|
|
|
15904
16862
|
availableWidth / size.width,
|
|
15905
16863
|
availableHeight / size.height
|
|
15906
16864
|
);
|
|
15907
|
-
const nextScale =
|
|
16865
|
+
const nextScale = clamp3(
|
|
15908
16866
|
fitScale,
|
|
15909
16867
|
normalizedMinScale,
|
|
15910
16868
|
normalizedMaxScale
|
|
@@ -15958,7 +16916,7 @@ function DataExplorerImagePreview({
|
|
|
15958
16916
|
if (!Number.isFinite(factor) || factor === 1) return;
|
|
15959
16917
|
if (!Number.isFinite(stageX) || !Number.isFinite(stageY)) return;
|
|
15960
16918
|
setView((current) => {
|
|
15961
|
-
const nextScale =
|
|
16919
|
+
const nextScale = clamp3(
|
|
15962
16920
|
current.scale * factor,
|
|
15963
16921
|
normalizedMinScale,
|
|
15964
16922
|
normalizedMaxScale
|
|
@@ -21299,7 +22257,7 @@ function getWorkbenchIconComponent(icon) {
|
|
|
21299
22257
|
if (!icon || !isWorkbenchIconComponent(icon)) return null;
|
|
21300
22258
|
return icon;
|
|
21301
22259
|
}
|
|
21302
|
-
function
|
|
22260
|
+
function toCssSize3(value) {
|
|
21303
22261
|
if (value === void 0) return void 0;
|
|
21304
22262
|
return typeof value === "number" ? `${value}px` : value;
|
|
21305
22263
|
}
|
|
@@ -21448,7 +22406,7 @@ function WorkbenchTableView({
|
|
|
21448
22406
|
"div",
|
|
21449
22407
|
{
|
|
21450
22408
|
className: cn("w-full overflow-auto", classNames?.scrollArea),
|
|
21451
|
-
style: { maxHeight:
|
|
22409
|
+
style: { maxHeight: toCssSize3(bodyMaxHeight) },
|
|
21452
22410
|
children: /* @__PURE__ */ jsxs(
|
|
21453
22411
|
BaseTable,
|
|
21454
22412
|
{
|
|
@@ -21483,117 +22441,770 @@ function WorkbenchTableView({
|
|
|
21483
22441
|
appearance,
|
|
21484
22442
|
columnId: column.key,
|
|
21485
22443
|
align: column.align,
|
|
21486
|
-
icon: renderColumnHeader ? void 0 : columnIcon,
|
|
22444
|
+
icon: renderColumnHeader ? void 0 : columnIcon,
|
|
22445
|
+
label: headerContent,
|
|
22446
|
+
description: renderColumnHeader ? void 0 : formatLabel(column.description, { column }),
|
|
22447
|
+
meta: renderColumnHeader ? void 0 : formatLabel(column.meta, { column }),
|
|
22448
|
+
actions: renderColumnHeader ? void 0 : column.actions,
|
|
22449
|
+
trailing: headerTrailing,
|
|
22450
|
+
sortable,
|
|
22451
|
+
sortDirection: column.sortDirection,
|
|
22452
|
+
sortLabel: column.sortLabel,
|
|
22453
|
+
onSort: handleSort,
|
|
22454
|
+
draggable: column.draggable,
|
|
22455
|
+
dragLabel: column.dragLabel,
|
|
22456
|
+
resizable: column.resizable,
|
|
22457
|
+
resizeLabel: column.resizeLabel,
|
|
22458
|
+
width: column.width,
|
|
22459
|
+
minWidth: typeof column.minWidth === "number" ? column.minWidth : void 0,
|
|
22460
|
+
maxWidth: typeof column.maxWidth === "number" ? column.maxWidth : void 0,
|
|
22461
|
+
className: cn(
|
|
22462
|
+
"sticky top-0 z-20 h-auto whitespace-nowrap bg-card/95 px-4 py-3 font-medium backdrop-blur-sm supports-[backdrop-filter]:bg-card/90",
|
|
22463
|
+
stickyFirstColumn && columnIndex === 0 && "left-0 z-30 shadow-[1px_0_0_0_hsl(var(--border)/0.35)]",
|
|
22464
|
+
column.compactHeaderClassName,
|
|
22465
|
+
column.headerClassName,
|
|
22466
|
+
column.renderType === "icon" && "pl-3 pr-1",
|
|
22467
|
+
followsRecordIcon && "pl-2",
|
|
22468
|
+
classNames?.headerCell
|
|
22469
|
+
),
|
|
22470
|
+
style: {
|
|
22471
|
+
minWidth: typeof column.minWidth === "string" ? column.minWidth : void 0,
|
|
22472
|
+
maxWidth: typeof column.maxWidth === "string" ? column.maxWidth : void 0
|
|
22473
|
+
}
|
|
22474
|
+
},
|
|
22475
|
+
column.key
|
|
22476
|
+
);
|
|
22477
|
+
}) }) }),
|
|
22478
|
+
/* @__PURE__ */ jsx(BaseTableBody, { appearance, className: cn("divide-y divide-border/35 dark:divide-border/30", classNames?.body), children: rows.length ? rows.map((row, rowIndex) => {
|
|
22479
|
+
const key = getRowKey(row, rowIndex);
|
|
22480
|
+
const disabled = isDisabled(row, rowIndex);
|
|
22481
|
+
const selectionKey = getRowSelectionKey(row, rowIndex);
|
|
22482
|
+
const selected = Boolean(resolvedSelectedKey && String(selectionKey) === String(resolvedSelectedKey));
|
|
22483
|
+
const resolvedRowClassName = typeof rowClassName === "function" ? rowClassName(row, rowIndex) : rowClassName;
|
|
22484
|
+
return /* @__PURE__ */ jsx(
|
|
22485
|
+
BaseTableRow,
|
|
22486
|
+
{
|
|
22487
|
+
appearance,
|
|
22488
|
+
interactive: Boolean(onRowClick) && !disabled,
|
|
22489
|
+
selected,
|
|
22490
|
+
disabled,
|
|
22491
|
+
onClick: () => {
|
|
22492
|
+
if (!disabled) {
|
|
22493
|
+
onRowClick?.(row, rowIndex);
|
|
22494
|
+
}
|
|
22495
|
+
},
|
|
22496
|
+
className: cn(
|
|
22497
|
+
onRowClick && !disabled ? "cursor-pointer" : "cursor-default",
|
|
22498
|
+
selected ? "bg-primary/10 hover:bg-primary/15" : disabled ? "" : "hover:bg-muted/25 dark:hover:bg-muted/15",
|
|
22499
|
+
classNames?.row,
|
|
22500
|
+
resolvedRowClassName
|
|
22501
|
+
),
|
|
22502
|
+
children: orderedColumns.map((column, columnIndex) => {
|
|
22503
|
+
const shouldWrap = isAction(column) || column.wrap === true;
|
|
22504
|
+
const previousColumn = orderedColumns[columnIndex - 1];
|
|
22505
|
+
const followsRecordIcon = previousColumn?.renderType === "icon" && column.key === resolvedActivePrimaryColumn?.key;
|
|
22506
|
+
return /* @__PURE__ */ jsx(
|
|
22507
|
+
BaseTableCell,
|
|
22508
|
+
{
|
|
22509
|
+
appearance,
|
|
22510
|
+
align: column.align,
|
|
22511
|
+
className: cn(
|
|
22512
|
+
shouldWrap ? "align-top whitespace-normal" : "whitespace-nowrap",
|
|
22513
|
+
"px-4 py-3 text-muted-foreground",
|
|
22514
|
+
stickyFirstColumn && columnIndex === 0 && "sticky left-0 z-10 bg-card/95 text-foreground shadow-[1px_0_0_0_hsl(var(--border)/0.3)]",
|
|
22515
|
+
column.compactCellClassName,
|
|
22516
|
+
column.cellClassName,
|
|
22517
|
+
column.renderType === "icon" && "pl-3 pr-1",
|
|
22518
|
+
followsRecordIcon && "pl-2",
|
|
22519
|
+
classNames?.cell
|
|
22520
|
+
),
|
|
22521
|
+
children: renderValue(column, row, {
|
|
22522
|
+
row,
|
|
22523
|
+
rowIndex,
|
|
22524
|
+
column,
|
|
22525
|
+
columnIndex,
|
|
22526
|
+
compact: true,
|
|
22527
|
+
surface: "list"
|
|
22528
|
+
})
|
|
22529
|
+
},
|
|
22530
|
+
`${key}-${column.key}`
|
|
22531
|
+
);
|
|
22532
|
+
})
|
|
22533
|
+
},
|
|
22534
|
+
key
|
|
22535
|
+
);
|
|
22536
|
+
}) : /* @__PURE__ */ jsx(
|
|
22537
|
+
BaseTableEmpty,
|
|
22538
|
+
{
|
|
22539
|
+
appearance,
|
|
22540
|
+
colSpan: Math.max(orderedColumns.length, 1),
|
|
22541
|
+
classNames: { cell: "px-4 py-10 text-center text-sm text-muted-foreground" },
|
|
22542
|
+
children: emptyState
|
|
22543
|
+
}
|
|
22544
|
+
) })
|
|
22545
|
+
]
|
|
22546
|
+
}
|
|
22547
|
+
)
|
|
22548
|
+
}
|
|
22549
|
+
),
|
|
22550
|
+
footer ? /* @__PURE__ */ jsx("div", { className: cn("border-t border-border/40 px-4 py-2 text-[11px] text-muted-foreground dark:border-border/30", classNames?.footer), children: footer }) : null
|
|
22551
|
+
]
|
|
22552
|
+
}
|
|
22553
|
+
);
|
|
22554
|
+
}
|
|
22555
|
+
function toCssSize4(value) {
|
|
22556
|
+
if (value === void 0) return void 0;
|
|
22557
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
22558
|
+
}
|
|
22559
|
+
function isBrowser() {
|
|
22560
|
+
return typeof window !== "undefined";
|
|
22561
|
+
}
|
|
22562
|
+
function defaultGetRowKey2(row, rowIndex) {
|
|
22563
|
+
return row?.id ?? row?.key ?? rowIndex;
|
|
22564
|
+
}
|
|
22565
|
+
function getColumnDefaultSize(column) {
|
|
22566
|
+
if (typeof column.width === "number") return column.width;
|
|
22567
|
+
if (typeof column.minWidth === "number") return column.minWidth;
|
|
22568
|
+
return 160;
|
|
22569
|
+
}
|
|
22570
|
+
function buildDefaultColumnSizes(columns, explicit) {
|
|
22571
|
+
return columns.reduce((acc, column) => {
|
|
22572
|
+
acc[column.key] = explicit?.[column.key] ?? getColumnDefaultSize(column);
|
|
22573
|
+
return acc;
|
|
22574
|
+
}, {});
|
|
22575
|
+
}
|
|
22576
|
+
function loadStoredColumnSizes(storageKey, defaults) {
|
|
22577
|
+
if (!storageKey || !isBrowser()) return defaults;
|
|
22578
|
+
try {
|
|
22579
|
+
const parsed = JSON.parse(window.localStorage.getItem(storageKey) || "{}");
|
|
22580
|
+
return Object.keys(defaults).reduce((acc, key) => {
|
|
22581
|
+
const value = Number(parsed?.[key]);
|
|
22582
|
+
acc[key] = Number.isFinite(value) ? value : defaults[key];
|
|
22583
|
+
return acc;
|
|
22584
|
+
}, {});
|
|
22585
|
+
} catch {
|
|
22586
|
+
return defaults;
|
|
22587
|
+
}
|
|
22588
|
+
}
|
|
22589
|
+
function persistColumnSizes(storageKey, sizes) {
|
|
22590
|
+
if (!storageKey || !isBrowser()) return;
|
|
22591
|
+
window.localStorage.setItem(storageKey, JSON.stringify(sizes));
|
|
22592
|
+
}
|
|
22593
|
+
function getFrozenColumnStorageKey(storageKey) {
|
|
22594
|
+
return storageKey ? `${storageKey}.frozenColumnCount` : void 0;
|
|
22595
|
+
}
|
|
22596
|
+
function getFrozenEndColumnStorageKey(storageKey) {
|
|
22597
|
+
return storageKey ? `${storageKey}.frozenEndColumnCount` : void 0;
|
|
22598
|
+
}
|
|
22599
|
+
function clampFrozenColumnCount(count, columnCount) {
|
|
22600
|
+
if (!Number.isFinite(count)) return 0;
|
|
22601
|
+
return Math.max(0, Math.min(Math.round(count), columnCount));
|
|
22602
|
+
}
|
|
22603
|
+
function normalizeFrozenColumnCounts(startCount, endCount, columnCount) {
|
|
22604
|
+
const normalizedStartCount = clampFrozenColumnCount(startCount, columnCount);
|
|
22605
|
+
const normalizedEndCount = clampFrozenColumnCount(endCount, Math.max(0, columnCount - normalizedStartCount));
|
|
22606
|
+
return {
|
|
22607
|
+
startCount: normalizedStartCount,
|
|
22608
|
+
endCount: normalizedEndCount
|
|
22609
|
+
};
|
|
22610
|
+
}
|
|
22611
|
+
function loadStoredFrozenColumnCount(storageKey, defaultCount, columnCount) {
|
|
22612
|
+
const fallback = clampFrozenColumnCount(defaultCount, columnCount);
|
|
22613
|
+
const frozenStorageKey = getFrozenColumnStorageKey(storageKey);
|
|
22614
|
+
if (!frozenStorageKey || !isBrowser()) return fallback;
|
|
22615
|
+
try {
|
|
22616
|
+
const storedValue = window.localStorage.getItem(frozenStorageKey);
|
|
22617
|
+
if (storedValue === null) return fallback;
|
|
22618
|
+
const value = Number(storedValue);
|
|
22619
|
+
return Number.isFinite(value) ? clampFrozenColumnCount(value, columnCount) : fallback;
|
|
22620
|
+
} catch {
|
|
22621
|
+
return fallback;
|
|
22622
|
+
}
|
|
22623
|
+
}
|
|
22624
|
+
function persistFrozenColumnCount(storageKey, count) {
|
|
22625
|
+
const frozenStorageKey = getFrozenColumnStorageKey(storageKey);
|
|
22626
|
+
if (!frozenStorageKey || !isBrowser()) return;
|
|
22627
|
+
window.localStorage.setItem(frozenStorageKey, String(count));
|
|
22628
|
+
}
|
|
22629
|
+
function loadStoredFrozenEndColumnCount(storageKey, defaultCount, columnCount) {
|
|
22630
|
+
const fallback = clampFrozenColumnCount(defaultCount, columnCount);
|
|
22631
|
+
const frozenStorageKey = getFrozenEndColumnStorageKey(storageKey);
|
|
22632
|
+
if (!frozenStorageKey || !isBrowser()) return fallback;
|
|
22633
|
+
try {
|
|
22634
|
+
const storedValue = window.localStorage.getItem(frozenStorageKey);
|
|
22635
|
+
if (storedValue === null) return fallback;
|
|
22636
|
+
const value = Number(storedValue);
|
|
22637
|
+
return Number.isFinite(value) ? clampFrozenColumnCount(value, columnCount) : fallback;
|
|
22638
|
+
} catch {
|
|
22639
|
+
return fallback;
|
|
22640
|
+
}
|
|
22641
|
+
}
|
|
22642
|
+
function persistFrozenEndColumnCount(storageKey, count) {
|
|
22643
|
+
const frozenStorageKey = getFrozenEndColumnStorageKey(storageKey);
|
|
22644
|
+
if (!frozenStorageKey || !isBrowser()) return;
|
|
22645
|
+
window.localStorage.setItem(frozenStorageKey, String(count));
|
|
22646
|
+
}
|
|
22647
|
+
function normalizeColumnOrder2(columnKeys, columnOrder) {
|
|
22648
|
+
const validColumnKeys = new Set(columnKeys);
|
|
22649
|
+
const orderedKeys = (columnOrder || []).filter((columnKey) => validColumnKeys.has(columnKey));
|
|
22650
|
+
const orderedKeySet = new Set(orderedKeys);
|
|
22651
|
+
const remainingKeys = columnKeys.filter((columnKey) => !orderedKeySet.has(columnKey));
|
|
22652
|
+
return [...orderedKeys, ...remainingKeys];
|
|
22653
|
+
}
|
|
22654
|
+
function getOrderedColumns2(columns, columnOrder) {
|
|
22655
|
+
const normalizedOrder = normalizeColumnOrder2(columns.map((column) => column.key), columnOrder);
|
|
22656
|
+
const columnMap = new Map(columns.map((column) => [column.key, column]));
|
|
22657
|
+
return normalizedOrder.map((columnKey) => columnMap.get(columnKey)).filter(Boolean);
|
|
22658
|
+
}
|
|
22659
|
+
function getColumnNumericWidth(column, columnSizes) {
|
|
22660
|
+
const controlledWidth = columnSizes[column.key];
|
|
22661
|
+
if (typeof controlledWidth === "number") return controlledWidth;
|
|
22662
|
+
return getColumnDefaultSize(column);
|
|
22663
|
+
}
|
|
22664
|
+
function buildFrozenOffsets(columns, columnSizes, frozenColumnCount) {
|
|
22665
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
22666
|
+
let left = 0;
|
|
22667
|
+
columns.slice(0, Math.max(0, frozenColumnCount)).forEach((column) => {
|
|
22668
|
+
offsets.set(column.key, left);
|
|
22669
|
+
left += getColumnNumericWidth(column, columnSizes);
|
|
22670
|
+
});
|
|
22671
|
+
return offsets;
|
|
22672
|
+
}
|
|
22673
|
+
function buildFrozenEndOffsets(columns, columnSizes, frozenEndColumnCount) {
|
|
22674
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
22675
|
+
let right = 0;
|
|
22676
|
+
columns.slice(Math.max(0, columns.length - frozenEndColumnCount)).reverse().forEach((column) => {
|
|
22677
|
+
offsets.set(column.key, right);
|
|
22678
|
+
right += getColumnNumericWidth(column, columnSizes);
|
|
22679
|
+
});
|
|
22680
|
+
return offsets;
|
|
22681
|
+
}
|
|
22682
|
+
function resolveRowClassName(rowClassName, row, rowIndex) {
|
|
22683
|
+
return typeof rowClassName === "function" ? rowClassName(row, rowIndex) : rowClassName;
|
|
22684
|
+
}
|
|
22685
|
+
function renderDefaultCell(column, row) {
|
|
22686
|
+
const value = row?.[column.key];
|
|
22687
|
+
if (value === void 0 || value === null || value === "") return "\u2014";
|
|
22688
|
+
return String(value);
|
|
22689
|
+
}
|
|
22690
|
+
function InteractiveTableCellContent({
|
|
22691
|
+
children,
|
|
22692
|
+
wrap
|
|
22693
|
+
}) {
|
|
22694
|
+
return /* @__PURE__ */ jsx(
|
|
22695
|
+
"div",
|
|
22696
|
+
{
|
|
22697
|
+
className: cn(
|
|
22698
|
+
"min-w-0 max-w-full overflow-auto overscroll-contain [scrollbar-width:thin]",
|
|
22699
|
+
wrap ? "max-h-20 whitespace-pre-wrap break-words leading-5" : "whitespace-nowrap"
|
|
22700
|
+
),
|
|
22701
|
+
children
|
|
22702
|
+
}
|
|
22703
|
+
);
|
|
22704
|
+
}
|
|
22705
|
+
function PinIcon({ className }) {
|
|
22706
|
+
return /* @__PURE__ */ jsxs(
|
|
22707
|
+
"svg",
|
|
22708
|
+
{
|
|
22709
|
+
"aria-hidden": "true",
|
|
22710
|
+
viewBox: "0 0 16 16",
|
|
22711
|
+
className,
|
|
22712
|
+
fill: "none",
|
|
22713
|
+
stroke: "currentColor",
|
|
22714
|
+
strokeLinecap: "round",
|
|
22715
|
+
strokeLinejoin: "round",
|
|
22716
|
+
strokeWidth: "1.75",
|
|
22717
|
+
children: [
|
|
22718
|
+
/* @__PURE__ */ jsx("path", { d: "M5.25 2.75h5.5" }),
|
|
22719
|
+
/* @__PURE__ */ jsx("path", { d: "M6.25 2.75v4L4.5 9.25h7L9.75 6.75v-4" }),
|
|
22720
|
+
/* @__PURE__ */ jsx("path", { d: "M8 9.25v4" })
|
|
22721
|
+
]
|
|
22722
|
+
}
|
|
22723
|
+
);
|
|
22724
|
+
}
|
|
22725
|
+
function InteractiveTable({
|
|
22726
|
+
rows = [],
|
|
22727
|
+
columns = [],
|
|
22728
|
+
pinnedTopRows = [],
|
|
22729
|
+
getRowKey = defaultGetRowKey2,
|
|
22730
|
+
getPinnedTopRowKey = defaultGetRowKey2,
|
|
22731
|
+
renderCell,
|
|
22732
|
+
renderPinnedTopCell,
|
|
22733
|
+
renderColumnHeader,
|
|
22734
|
+
onRowClick,
|
|
22735
|
+
getRowState,
|
|
22736
|
+
rowClassName,
|
|
22737
|
+
pinnedTopRowClassName,
|
|
22738
|
+
emptyState = "\u2014",
|
|
22739
|
+
columnMenuLabels,
|
|
22740
|
+
columnStorageKey,
|
|
22741
|
+
columnOrder,
|
|
22742
|
+
columnSizes,
|
|
22743
|
+
defaultColumnSizes,
|
|
22744
|
+
columnDragEnabled = false,
|
|
22745
|
+
columnResizeEnabled = true,
|
|
22746
|
+
frozenColumnCount = 0,
|
|
22747
|
+
frozenEndColumnCount = 0,
|
|
22748
|
+
tableMinWidth,
|
|
22749
|
+
bodyMaxHeight = "min(60vh, 42rem)",
|
|
22750
|
+
appearance,
|
|
22751
|
+
className,
|
|
22752
|
+
tableClassName,
|
|
22753
|
+
classNames,
|
|
22754
|
+
style,
|
|
22755
|
+
onColumnOrderChange,
|
|
22756
|
+
onColumnSizeChange,
|
|
22757
|
+
onResetColumnSizes,
|
|
22758
|
+
onFrozenColumnCountChange,
|
|
22759
|
+
onFrozenEndColumnCountChange,
|
|
22760
|
+
onSort
|
|
22761
|
+
}) {
|
|
22762
|
+
const columnKeySignature = columns.map((column) => column.key).join("");
|
|
22763
|
+
const defaultOrder = useMemo(
|
|
22764
|
+
() => columnKeySignature ? columnKeySignature.split("") : [],
|
|
22765
|
+
[columnKeySignature]
|
|
22766
|
+
);
|
|
22767
|
+
const defaultSizes = useMemo(
|
|
22768
|
+
() => buildDefaultColumnSizes(columns, defaultColumnSizes),
|
|
22769
|
+
[columns, defaultColumnSizes]
|
|
22770
|
+
);
|
|
22771
|
+
const [internalColumnOrder, setInternalColumnOrder] = useState(defaultOrder);
|
|
22772
|
+
const [internalColumnSizes, setInternalColumnSizes] = useState(() => loadStoredColumnSizes(columnStorageKey, defaultSizes));
|
|
22773
|
+
const [internalFrozenColumnCount, setInternalFrozenColumnCount] = useState(() => loadStoredFrozenColumnCount(columnStorageKey, frozenColumnCount, columns.length));
|
|
22774
|
+
const [internalFrozenEndColumnCount, setInternalFrozenEndColumnCount] = useState(() => loadStoredFrozenEndColumnCount(columnStorageKey, frozenEndColumnCount, columns.length));
|
|
22775
|
+
useEffect(() => {
|
|
22776
|
+
setInternalColumnOrder((current) => normalizeColumnOrder2(defaultOrder, current));
|
|
22777
|
+
}, [defaultOrder]);
|
|
22778
|
+
useEffect(() => {
|
|
22779
|
+
if (columnSizes) return;
|
|
22780
|
+
setInternalColumnSizes(loadStoredColumnSizes(columnStorageKey, defaultSizes));
|
|
22781
|
+
}, [columnSizes, columnStorageKey, defaultSizes]);
|
|
22782
|
+
useEffect(() => {
|
|
22783
|
+
setInternalFrozenColumnCount(loadStoredFrozenColumnCount(columnStorageKey, frozenColumnCount, columns.length));
|
|
22784
|
+
}, [columnStorageKey, columns.length, frozenColumnCount]);
|
|
22785
|
+
useEffect(() => {
|
|
22786
|
+
setInternalFrozenEndColumnCount(loadStoredFrozenEndColumnCount(columnStorageKey, frozenEndColumnCount, columns.length));
|
|
22787
|
+
}, [columnStorageKey, columns.length, frozenEndColumnCount]);
|
|
22788
|
+
const resolvedColumnOrder = columnOrder ? normalizeColumnOrder2(defaultOrder, columnOrder) : internalColumnOrder;
|
|
22789
|
+
const resolvedColumnSizes = columnSizes ?? internalColumnSizes;
|
|
22790
|
+
const orderedColumns = getOrderedColumns2(columns, resolvedColumnOrder);
|
|
22791
|
+
const {
|
|
22792
|
+
startCount: resolvedFrozenColumnCount,
|
|
22793
|
+
endCount: resolvedFrozenEndColumnCount
|
|
22794
|
+
} = normalizeFrozenColumnCounts(internalFrozenColumnCount, internalFrozenEndColumnCount, orderedColumns.length);
|
|
22795
|
+
const frozenOffsets = buildFrozenOffsets(orderedColumns, resolvedColumnSizes, resolvedFrozenColumnCount);
|
|
22796
|
+
const frozenEndOffsets = buildFrozenEndOffsets(orderedColumns, resolvedColumnSizes, resolvedFrozenEndColumnCount);
|
|
22797
|
+
const resolvedMinWidth = tableMinWidth ?? Math.max(760, orderedColumns.reduce((total, column) => total + getColumnNumericWidth(column, resolvedColumnSizes), 0));
|
|
22798
|
+
const labels = {
|
|
22799
|
+
columnActions: columnMenuLabels?.columnActions ?? "Column actions",
|
|
22800
|
+
freezeColumn: columnMenuLabels?.freezeColumn ?? "Freeze to left",
|
|
22801
|
+
freezeEndColumn: columnMenuLabels?.freezeEndColumn ?? "Freeze to right",
|
|
22802
|
+
unfreezeColumn: columnMenuLabels?.unfreezeColumn ?? "Unfreeze from left",
|
|
22803
|
+
unfreezeEndColumn: columnMenuLabels?.unfreezeEndColumn ?? "Unfreeze from right",
|
|
22804
|
+
unfreezeAllColumns: columnMenuLabels?.unfreezeAllColumns ?? "Unfreeze all columns",
|
|
22805
|
+
resetColumnWidth: columnMenuLabels?.resetColumnWidth ?? "Reset column width",
|
|
22806
|
+
frozenColumnTitle: columnMenuLabels?.frozenColumnTitle ?? "Frozen column"
|
|
22807
|
+
};
|
|
22808
|
+
const handleColumnOrderChange = useCallback((nextOrder, detail) => {
|
|
22809
|
+
const normalizedOrder = normalizeColumnOrder2(defaultOrder, nextOrder);
|
|
22810
|
+
if (!columnOrder) {
|
|
22811
|
+
setInternalColumnOrder(normalizedOrder);
|
|
22812
|
+
}
|
|
22813
|
+
onColumnOrderChange?.(normalizedOrder, detail);
|
|
22814
|
+
}, [columnOrder, defaultOrder, onColumnOrderChange]);
|
|
22815
|
+
const handleColumnSizeChange = useCallback((columnId, width, detail) => {
|
|
22816
|
+
const column = columns.find((item) => item.key === columnId);
|
|
22817
|
+
const minWidth = column?.minWidth;
|
|
22818
|
+
const maxWidth = column?.maxWidth;
|
|
22819
|
+
const nextWidth = Math.max(
|
|
22820
|
+
typeof minWidth === "number" ? minWidth : 0,
|
|
22821
|
+
Math.min(width, typeof maxWidth === "number" ? maxWidth : Number.POSITIVE_INFINITY)
|
|
22822
|
+
);
|
|
22823
|
+
const nextSizes = {
|
|
22824
|
+
...resolvedColumnSizes,
|
|
22825
|
+
[columnId]: nextWidth
|
|
22826
|
+
};
|
|
22827
|
+
if (!columnSizes) {
|
|
22828
|
+
setInternalColumnSizes(nextSizes);
|
|
22829
|
+
}
|
|
22830
|
+
persistColumnSizes(columnStorageKey, nextSizes);
|
|
22831
|
+
onColumnSizeChange?.(columnId, nextWidth, detail);
|
|
22832
|
+
}, [columnSizes, columnStorageKey, columns, onColumnSizeChange, resolvedColumnSizes]);
|
|
22833
|
+
const handleResetColumnSize = useCallback((column) => {
|
|
22834
|
+
const nextWidth = defaultSizes[column.key] ?? getColumnDefaultSize(column);
|
|
22835
|
+
const previousWidth = getColumnNumericWidth(column, resolvedColumnSizes);
|
|
22836
|
+
const nextSizes = {
|
|
22837
|
+
...resolvedColumnSizes,
|
|
22838
|
+
[column.key]: nextWidth
|
|
22839
|
+
};
|
|
22840
|
+
if (!columnSizes) {
|
|
22841
|
+
setInternalColumnSizes(nextSizes);
|
|
22842
|
+
}
|
|
22843
|
+
persistColumnSizes(columnStorageKey, nextSizes);
|
|
22844
|
+
onColumnSizeChange?.(column.key, nextWidth, {
|
|
22845
|
+
columnId: column.key,
|
|
22846
|
+
previousWidth,
|
|
22847
|
+
minWidth: column.minWidth,
|
|
22848
|
+
maxWidth: column.maxWidth
|
|
22849
|
+
});
|
|
22850
|
+
onResetColumnSizes?.(nextSizes);
|
|
22851
|
+
}, [columnSizes, columnStorageKey, defaultSizes, onColumnSizeChange, onResetColumnSizes, resolvedColumnSizes]);
|
|
22852
|
+
const setFrozenColumnCount = useCallback((nextCount) => {
|
|
22853
|
+
const normalizedCount = clampFrozenColumnCount(nextCount, Math.max(0, orderedColumns.length - resolvedFrozenEndColumnCount));
|
|
22854
|
+
setInternalFrozenColumnCount(normalizedCount);
|
|
22855
|
+
persistFrozenColumnCount(columnStorageKey, normalizedCount);
|
|
22856
|
+
onFrozenColumnCountChange?.(normalizedCount);
|
|
22857
|
+
}, [columnStorageKey, onFrozenColumnCountChange, orderedColumns.length, resolvedFrozenEndColumnCount]);
|
|
22858
|
+
const setFrozenEndColumnCount = useCallback((nextCount) => {
|
|
22859
|
+
const normalizedCount = clampFrozenColumnCount(nextCount, Math.max(0, orderedColumns.length - resolvedFrozenColumnCount));
|
|
22860
|
+
setInternalFrozenEndColumnCount(normalizedCount);
|
|
22861
|
+
persistFrozenEndColumnCount(columnStorageKey, normalizedCount);
|
|
22862
|
+
onFrozenEndColumnCountChange?.(normalizedCount);
|
|
22863
|
+
}, [columnStorageKey, onFrozenEndColumnCountChange, orderedColumns.length, resolvedFrozenColumnCount]);
|
|
22864
|
+
const getFrozenPosition = (columnIndex) => {
|
|
22865
|
+
if (columnIndex < resolvedFrozenColumnCount) return "start";
|
|
22866
|
+
if (columnIndex >= orderedColumns.length - resolvedFrozenEndColumnCount) return "end";
|
|
22867
|
+
return void 0;
|
|
22868
|
+
};
|
|
22869
|
+
const getFrozenClassName = (column, columnIndex, isHeader = false) => {
|
|
22870
|
+
const position = getFrozenPosition(columnIndex);
|
|
22871
|
+
if (!position) return void 0;
|
|
22872
|
+
return cn(
|
|
22873
|
+
"sticky",
|
|
22874
|
+
position === "start" ? "shadow-[1px_0_0_0_hsl(var(--border)/0.45)]" : "shadow-[-1px_0_0_0_hsl(var(--border)/0.45)]",
|
|
22875
|
+
isHeader ? "bg-muted/60" : "bg-inherit",
|
|
22876
|
+
isHeader ? "z-40" : "z-20",
|
|
22877
|
+
(columnIndex === 0 || columnIndex === orderedColumns.length - 1) && (isHeader ? "z-50" : "z-30")
|
|
22878
|
+
);
|
|
22879
|
+
};
|
|
22880
|
+
const getFrozenStyle = (column, columnIndex) => {
|
|
22881
|
+
const position = getFrozenPosition(columnIndex);
|
|
22882
|
+
if (position === "start") return { left: frozenOffsets.get(column.key) ?? 0 };
|
|
22883
|
+
if (position === "end") return { right: frozenEndOffsets.get(column.key) ?? 0 };
|
|
22884
|
+
return void 0;
|
|
22885
|
+
};
|
|
22886
|
+
return /* @__PURE__ */ jsx(
|
|
22887
|
+
BaseTableContainer,
|
|
22888
|
+
{
|
|
22889
|
+
appearance,
|
|
22890
|
+
className: cn("flex h-full min-h-0 flex-col overflow-hidden rounded-lg border border-border/60 bg-card", classNames?.root, className),
|
|
22891
|
+
style,
|
|
22892
|
+
children: /* @__PURE__ */ jsx(
|
|
22893
|
+
"div",
|
|
22894
|
+
{
|
|
22895
|
+
className: cn("min-h-0 flex-1 overflow-auto", classNames?.scrollArea),
|
|
22896
|
+
style: { maxHeight: toCssSize4(bodyMaxHeight) },
|
|
22897
|
+
children: /* @__PURE__ */ jsxs(
|
|
22898
|
+
BaseTable,
|
|
22899
|
+
{
|
|
22900
|
+
appearance,
|
|
22901
|
+
columnOrder: resolvedColumnOrder,
|
|
22902
|
+
columnSizes: resolvedColumnSizes,
|
|
22903
|
+
columnDragEnabled,
|
|
22904
|
+
columnResizeEnabled,
|
|
22905
|
+
onColumnOrderChange: handleColumnOrderChange,
|
|
22906
|
+
onColumnSizeChange: handleColumnSizeChange,
|
|
22907
|
+
className: cn("w-full table-fixed text-left text-xs", classNames?.table, tableClassName),
|
|
22908
|
+
style: { minWidth: resolvedMinWidth },
|
|
22909
|
+
children: [
|
|
22910
|
+
/* @__PURE__ */ jsx("colgroup", { children: orderedColumns.map((column) => /* @__PURE__ */ jsx(
|
|
22911
|
+
"col",
|
|
22912
|
+
{
|
|
22913
|
+
style: {
|
|
22914
|
+
width: toCssSize4(resolvedColumnSizes[column.key] ?? column.width),
|
|
22915
|
+
minWidth: toCssSize4(column.minWidth)
|
|
22916
|
+
}
|
|
22917
|
+
},
|
|
22918
|
+
column.key
|
|
22919
|
+
)) }),
|
|
22920
|
+
/* @__PURE__ */ jsx(BaseTableHeader, { appearance, className: cn("border-b border-border/60 bg-muted/60 text-[11px] font-medium text-muted-foreground", classNames?.tableHeader), children: /* @__PURE__ */ jsx(BaseTableRow, { appearance, className: cn("hover:bg-transparent", classNames?.headerRow), children: orderedColumns.map((column, columnIndex) => {
|
|
22921
|
+
const headerContent = renderColumnHeader ? renderColumnHeader(column, { column, columnIndex, columns: orderedColumns, rows }) : column.label;
|
|
22922
|
+
const sortable = Boolean(column.sortable);
|
|
22923
|
+
const handleSort = sortable && onSort ? () => onSort(column.key, column) : void 0;
|
|
22924
|
+
const isFrozenStart = columnIndex < resolvedFrozenColumnCount;
|
|
22925
|
+
const isFrozenEnd = columnIndex >= orderedColumns.length - resolvedFrozenEndColumnCount;
|
|
22926
|
+
const isFrozen = isFrozenStart || isFrozenEnd;
|
|
22927
|
+
const isColumnAtDefaultWidth = getColumnNumericWidth(column, resolvedColumnSizes) === (defaultSizes[column.key] ?? getColumnDefaultSize(column));
|
|
22928
|
+
return /* @__PURE__ */ jsxs(BaseContextMenu, { modal: false, children: [
|
|
22929
|
+
/* @__PURE__ */ jsx(BaseContextMenuTrigger, { asChild: true, appearance, children: /* @__PURE__ */ jsx(
|
|
22930
|
+
BaseTableHead,
|
|
22931
|
+
{
|
|
22932
|
+
appearance,
|
|
22933
|
+
columnId: column.key,
|
|
22934
|
+
align: column.align,
|
|
21487
22935
|
label: headerContent,
|
|
21488
|
-
description:
|
|
21489
|
-
|
|
21490
|
-
actions: renderColumnHeader ? void 0 : column.actions,
|
|
21491
|
-
trailing: headerTrailing,
|
|
22936
|
+
description: column.description,
|
|
22937
|
+
trailing: isFrozen ? /* @__PURE__ */ jsx("span", { title: labels.frozenColumnTitle, className: "inline-flex h-5 w-5 items-center justify-center rounded text-primary", children: /* @__PURE__ */ jsx(PinIcon, { className: "h-3.5 w-3.5" }) }) : null,
|
|
21492
22938
|
sortable,
|
|
21493
22939
|
sortDirection: column.sortDirection,
|
|
21494
22940
|
sortLabel: column.sortLabel,
|
|
21495
22941
|
onSort: handleSort,
|
|
21496
22942
|
draggable: column.draggable,
|
|
21497
|
-
dragLabel: column.dragLabel,
|
|
21498
22943
|
resizable: column.resizable,
|
|
21499
|
-
resizeLabel: column.resizeLabel,
|
|
21500
22944
|
width: column.width,
|
|
21501
|
-
minWidth:
|
|
21502
|
-
maxWidth:
|
|
22945
|
+
minWidth: column.minWidth,
|
|
22946
|
+
maxWidth: column.maxWidth,
|
|
21503
22947
|
className: cn(
|
|
21504
|
-
"sticky top-0
|
|
21505
|
-
|
|
21506
|
-
column.compactHeaderClassName,
|
|
22948
|
+
"sticky top-0 h-9 whitespace-nowrap border-r border-border/50 bg-muted/60 px-2.5 py-2 backdrop-blur",
|
|
22949
|
+
getFrozenClassName(column, columnIndex, true),
|
|
21507
22950
|
column.headerClassName,
|
|
21508
|
-
column.
|
|
21509
|
-
followsRecordIcon && "pl-2",
|
|
22951
|
+
column.className,
|
|
21510
22952
|
classNames?.headerCell
|
|
21511
22953
|
),
|
|
21512
|
-
style:
|
|
21513
|
-
|
|
21514
|
-
|
|
22954
|
+
style: getFrozenStyle(column, columnIndex)
|
|
22955
|
+
}
|
|
22956
|
+
) }),
|
|
22957
|
+
/* @__PURE__ */ jsxs(BaseContextMenuContent, { appearance, alignOffset: -4, className: "min-w-44", children: [
|
|
22958
|
+
/* @__PURE__ */ jsx(BaseContextMenuLabel, { appearance, children: labels.columnActions }),
|
|
22959
|
+
isFrozen ? /* @__PURE__ */ jsx(
|
|
22960
|
+
BaseContextMenuItem,
|
|
22961
|
+
{
|
|
22962
|
+
appearance,
|
|
22963
|
+
onSelect: () => {
|
|
22964
|
+
if (isFrozenEnd) setFrozenEndColumnCount(orderedColumns.length - columnIndex - 1);
|
|
22965
|
+
else setFrozenColumnCount(columnIndex);
|
|
22966
|
+
},
|
|
22967
|
+
children: isFrozenEnd ? labels.unfreezeEndColumn : labels.unfreezeColumn
|
|
22968
|
+
}
|
|
22969
|
+
) : /* @__PURE__ */ jsx(
|
|
22970
|
+
BaseContextMenuItem,
|
|
22971
|
+
{
|
|
22972
|
+
appearance,
|
|
22973
|
+
onSelect: () => setFrozenColumnCount(columnIndex + 1),
|
|
22974
|
+
children: labels.freezeColumn
|
|
21515
22975
|
}
|
|
22976
|
+
),
|
|
22977
|
+
!isFrozen ? /* @__PURE__ */ jsx(
|
|
22978
|
+
BaseContextMenuItem,
|
|
22979
|
+
{
|
|
22980
|
+
appearance,
|
|
22981
|
+
onSelect: () => setFrozenEndColumnCount(orderedColumns.length - columnIndex),
|
|
22982
|
+
children: labels.freezeEndColumn
|
|
22983
|
+
}
|
|
22984
|
+
) : null,
|
|
22985
|
+
/* @__PURE__ */ jsx(
|
|
22986
|
+
BaseContextMenuItem,
|
|
22987
|
+
{
|
|
22988
|
+
appearance,
|
|
22989
|
+
disabled: resolvedFrozenColumnCount === 0 && resolvedFrozenEndColumnCount === 0,
|
|
22990
|
+
onSelect: () => {
|
|
22991
|
+
setFrozenColumnCount(0);
|
|
22992
|
+
setFrozenEndColumnCount(0);
|
|
22993
|
+
},
|
|
22994
|
+
children: labels.unfreezeAllColumns
|
|
22995
|
+
}
|
|
22996
|
+
),
|
|
22997
|
+
/* @__PURE__ */ jsx(BaseContextMenuSeparator, { appearance }),
|
|
22998
|
+
/* @__PURE__ */ jsx(
|
|
22999
|
+
BaseContextMenuItem,
|
|
23000
|
+
{
|
|
23001
|
+
appearance,
|
|
23002
|
+
disabled: isColumnAtDefaultWidth,
|
|
23003
|
+
onSelect: () => handleResetColumnSize(column),
|
|
23004
|
+
children: labels.resetColumnWidth
|
|
23005
|
+
}
|
|
23006
|
+
)
|
|
23007
|
+
] })
|
|
23008
|
+
] }, column.key);
|
|
23009
|
+
}) }) }),
|
|
23010
|
+
/* @__PURE__ */ jsxs(BaseTableBody, { appearance, className: cn("divide-y divide-border/50", classNames?.body), children: [
|
|
23011
|
+
pinnedTopRows.map((row, rowIndex) => {
|
|
23012
|
+
const key = getPinnedTopRowKey(row, rowIndex);
|
|
23013
|
+
const resolvedRowClassName = resolveRowClassName(pinnedTopRowClassName, row, rowIndex);
|
|
23014
|
+
return /* @__PURE__ */ jsx(
|
|
23015
|
+
BaseTableRow,
|
|
23016
|
+
{
|
|
23017
|
+
appearance,
|
|
23018
|
+
className: cn("bg-card/95", classNames?.pinnedTopRow, resolvedRowClassName),
|
|
23019
|
+
children: orderedColumns.map((column, columnIndex) => /* @__PURE__ */ jsx(
|
|
23020
|
+
BaseTableCell,
|
|
23021
|
+
{
|
|
23022
|
+
appearance,
|
|
23023
|
+
align: column.align,
|
|
23024
|
+
className: cn(
|
|
23025
|
+
"h-[52px] border-r border-border/50 px-2.5 py-1.5 align-middle",
|
|
23026
|
+
column.wrap ? "whitespace-normal" : "whitespace-nowrap",
|
|
23027
|
+
getFrozenClassName(column, columnIndex),
|
|
23028
|
+
column.cellClassName,
|
|
23029
|
+
classNames?.cell
|
|
23030
|
+
),
|
|
23031
|
+
style: getFrozenStyle(column, columnIndex),
|
|
23032
|
+
children: /* @__PURE__ */ jsx(InteractiveTableCellContent, { wrap: column.wrap, children: renderPinnedTopCell ? renderPinnedTopCell(column, row, { row, rowIndex, column, columnIndex, isPinnedTopRow: true }) : renderDefaultCell(column, row) })
|
|
23033
|
+
},
|
|
23034
|
+
`pinned-${key}-${column.key}`
|
|
23035
|
+
))
|
|
21516
23036
|
},
|
|
21517
|
-
|
|
23037
|
+
`pinned-${key}`
|
|
21518
23038
|
);
|
|
21519
|
-
})
|
|
21520
|
-
|
|
23039
|
+
}),
|
|
23040
|
+
rows.length ? rows.map((row, rowIndex) => {
|
|
21521
23041
|
const key = getRowKey(row, rowIndex);
|
|
21522
|
-
const
|
|
21523
|
-
const
|
|
21524
|
-
const selected = Boolean(resolvedSelectedKey && String(selectionKey) === String(resolvedSelectedKey));
|
|
21525
|
-
const resolvedRowClassName = typeof rowClassName === "function" ? rowClassName(row, rowIndex) : rowClassName;
|
|
23042
|
+
const state = getRowState?.(row, rowIndex) || {};
|
|
23043
|
+
const resolvedRowClassName = resolveRowClassName(rowClassName, row, rowIndex);
|
|
21526
23044
|
return /* @__PURE__ */ jsx(
|
|
21527
23045
|
BaseTableRow,
|
|
21528
23046
|
{
|
|
21529
23047
|
appearance,
|
|
21530
|
-
interactive: Boolean(onRowClick) && !disabled,
|
|
21531
|
-
selected,
|
|
21532
|
-
disabled,
|
|
23048
|
+
interactive: Boolean(onRowClick) && !state.disabled,
|
|
23049
|
+
selected: state.selected,
|
|
23050
|
+
disabled: state.disabled,
|
|
21533
23051
|
onClick: () => {
|
|
21534
|
-
if (!disabled)
|
|
21535
|
-
onRowClick?.(row, rowIndex);
|
|
21536
|
-
}
|
|
23052
|
+
if (!state.disabled) onRowClick?.(row, rowIndex);
|
|
21537
23053
|
},
|
|
21538
23054
|
className: cn(
|
|
21539
|
-
|
|
21540
|
-
|
|
23055
|
+
"min-h-[52px] bg-card transition-colors",
|
|
23056
|
+
state.saving && "bg-primary/5",
|
|
23057
|
+
state.pending && "opacity-80",
|
|
23058
|
+
onRowClick && !state.disabled ? "cursor-pointer hover:bg-muted/30" : "hover:bg-muted/30",
|
|
21541
23059
|
classNames?.row,
|
|
21542
23060
|
resolvedRowClassName
|
|
21543
23061
|
),
|
|
21544
|
-
children: orderedColumns.map((column, columnIndex) =>
|
|
21545
|
-
|
|
21546
|
-
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
|
|
21554
|
-
|
|
21555
|
-
|
|
21556
|
-
|
|
21557
|
-
|
|
21558
|
-
|
|
21559
|
-
|
|
21560
|
-
|
|
21561
|
-
classNames?.cell
|
|
21562
|
-
),
|
|
21563
|
-
children: renderValue(column, row, {
|
|
21564
|
-
row,
|
|
21565
|
-
rowIndex,
|
|
21566
|
-
column,
|
|
21567
|
-
columnIndex,
|
|
21568
|
-
compact: true,
|
|
21569
|
-
surface: "list"
|
|
21570
|
-
})
|
|
21571
|
-
},
|
|
21572
|
-
`${key}-${column.key}`
|
|
21573
|
-
);
|
|
21574
|
-
})
|
|
23062
|
+
children: orderedColumns.map((column, columnIndex) => /* @__PURE__ */ jsx(
|
|
23063
|
+
BaseTableCell,
|
|
23064
|
+
{
|
|
23065
|
+
appearance,
|
|
23066
|
+
align: column.align,
|
|
23067
|
+
className: cn(
|
|
23068
|
+
"h-[52px] border-r border-border/50 px-2.5 py-1.5 align-middle",
|
|
23069
|
+
column.wrap ? "whitespace-normal" : "whitespace-nowrap",
|
|
23070
|
+
getFrozenClassName(column, columnIndex),
|
|
23071
|
+
column.cellClassName,
|
|
23072
|
+
classNames?.cell
|
|
23073
|
+
),
|
|
23074
|
+
style: getFrozenStyle(column, columnIndex),
|
|
23075
|
+
children: /* @__PURE__ */ jsx(InteractiveTableCellContent, { wrap: column.wrap, children: renderCell ? renderCell(column, row, { row, rowIndex, column, columnIndex, isPinnedTopRow: false }) : renderDefaultCell(column, row) })
|
|
23076
|
+
},
|
|
23077
|
+
`${key}-${column.key}`
|
|
23078
|
+
))
|
|
21575
23079
|
},
|
|
21576
23080
|
key
|
|
21577
23081
|
);
|
|
21578
|
-
}) : /* @__PURE__ */ jsx(
|
|
23082
|
+
}) : pinnedTopRows.length ? null : /* @__PURE__ */ jsx(
|
|
21579
23083
|
BaseTableEmpty,
|
|
21580
23084
|
{
|
|
21581
23085
|
appearance,
|
|
21582
23086
|
colSpan: Math.max(orderedColumns.length, 1),
|
|
21583
|
-
|
|
23087
|
+
className: classNames?.empty,
|
|
21584
23088
|
children: emptyState
|
|
21585
23089
|
}
|
|
21586
|
-
)
|
|
21587
|
-
]
|
|
21588
|
-
|
|
21589
|
-
|
|
23090
|
+
)
|
|
23091
|
+
] })
|
|
23092
|
+
]
|
|
23093
|
+
}
|
|
23094
|
+
)
|
|
23095
|
+
}
|
|
23096
|
+
)
|
|
23097
|
+
}
|
|
23098
|
+
);
|
|
23099
|
+
}
|
|
23100
|
+
function InteractiveTableEditableTextCell({
|
|
23101
|
+
value,
|
|
23102
|
+
placeholder,
|
|
23103
|
+
disabled,
|
|
23104
|
+
multiline = false,
|
|
23105
|
+
commitOnBlur = true,
|
|
23106
|
+
className,
|
|
23107
|
+
inputClassName,
|
|
23108
|
+
onCommit
|
|
23109
|
+
}) {
|
|
23110
|
+
const initialValue = String(value || "");
|
|
23111
|
+
const [draft, setDraft] = useState(initialValue);
|
|
23112
|
+
useEffect(() => {
|
|
23113
|
+
setDraft(initialValue);
|
|
23114
|
+
}, [initialValue]);
|
|
23115
|
+
const commit = useCallback(async () => {
|
|
23116
|
+
const nextValue = String(draft || "").trim();
|
|
23117
|
+
const previousValue = String(initialValue || "").trim();
|
|
23118
|
+
if (nextValue === previousValue) return;
|
|
23119
|
+
try {
|
|
23120
|
+
await onCommit?.(nextValue);
|
|
23121
|
+
} catch {
|
|
23122
|
+
setDraft(initialValue);
|
|
23123
|
+
}
|
|
23124
|
+
}, [draft, initialValue, onCommit]);
|
|
23125
|
+
const controlClassName = cn(
|
|
23126
|
+
"w-full resize-none rounded-sm border border-transparent bg-transparent px-1.5 py-1 text-xs text-foreground outline-none transition-colors",
|
|
23127
|
+
"placeholder:text-muted-foreground/70 hover:border-border/60 hover:bg-background focus:border-primary/45 focus:bg-background",
|
|
23128
|
+
multiline ? "min-h-[42px] leading-5" : "h-8",
|
|
23129
|
+
disabled && "cursor-not-allowed text-muted-foreground hover:border-transparent hover:bg-transparent",
|
|
23130
|
+
inputClassName
|
|
23131
|
+
);
|
|
23132
|
+
if (multiline) {
|
|
23133
|
+
return /* @__PURE__ */ jsx(
|
|
23134
|
+
"textarea",
|
|
23135
|
+
{
|
|
23136
|
+
className: cn(controlClassName, className),
|
|
23137
|
+
disabled,
|
|
23138
|
+
value: draft,
|
|
23139
|
+
placeholder,
|
|
23140
|
+
onChange: (event) => setDraft(event.target.value),
|
|
23141
|
+
onBlur: () => {
|
|
23142
|
+
if (commitOnBlur) void commit();
|
|
23143
|
+
},
|
|
23144
|
+
onKeyDown: (event) => {
|
|
23145
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
|
23146
|
+
event.currentTarget.blur();
|
|
21590
23147
|
}
|
|
21591
|
-
|
|
21592
|
-
|
|
21593
|
-
|
|
23148
|
+
if (event.key === "Escape") {
|
|
23149
|
+
setDraft(initialValue);
|
|
23150
|
+
event.currentTarget.blur();
|
|
23151
|
+
}
|
|
23152
|
+
}
|
|
23153
|
+
}
|
|
23154
|
+
);
|
|
23155
|
+
}
|
|
23156
|
+
return /* @__PURE__ */ jsx(
|
|
23157
|
+
"input",
|
|
23158
|
+
{
|
|
23159
|
+
className: cn(controlClassName, className),
|
|
23160
|
+
disabled,
|
|
23161
|
+
value: draft,
|
|
23162
|
+
placeholder,
|
|
23163
|
+
onChange: (event) => setDraft(event.target.value),
|
|
23164
|
+
onBlur: () => {
|
|
23165
|
+
if (commitOnBlur) void commit();
|
|
23166
|
+
},
|
|
23167
|
+
onKeyDown: (event) => {
|
|
23168
|
+
if (event.key === "Enter") event.currentTarget.blur();
|
|
23169
|
+
if (event.key === "Escape") {
|
|
23170
|
+
setDraft(initialValue);
|
|
23171
|
+
event.currentTarget.blur();
|
|
23172
|
+
}
|
|
23173
|
+
}
|
|
21594
23174
|
}
|
|
21595
23175
|
);
|
|
21596
23176
|
}
|
|
23177
|
+
function InteractiveTableReadonlyCell({
|
|
23178
|
+
children,
|
|
23179
|
+
mono = false,
|
|
23180
|
+
className
|
|
23181
|
+
}) {
|
|
23182
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-w-0 text-xs text-muted-foreground", mono && "font-mono", className), children: hasRenderableNode(children) ? children : "\u2014" });
|
|
23183
|
+
}
|
|
23184
|
+
function InteractiveTableSelectCell({
|
|
23185
|
+
value,
|
|
23186
|
+
options,
|
|
23187
|
+
disabled,
|
|
23188
|
+
ariaLabel,
|
|
23189
|
+
children,
|
|
23190
|
+
className,
|
|
23191
|
+
onChange
|
|
23192
|
+
}) {
|
|
23193
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative flex w-full items-center", className), children: [
|
|
23194
|
+
children,
|
|
23195
|
+
/* @__PURE__ */ jsx(
|
|
23196
|
+
"select",
|
|
23197
|
+
{
|
|
23198
|
+
"aria-label": ariaLabel,
|
|
23199
|
+
disabled,
|
|
23200
|
+
value,
|
|
23201
|
+
onChange: (event) => onChange?.(event.target.value),
|
|
23202
|
+
className: "absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
|
|
23203
|
+
children: options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
|
|
23204
|
+
}
|
|
23205
|
+
)
|
|
23206
|
+
] });
|
|
23207
|
+
}
|
|
21597
23208
|
var imageExtPattern = /\.(png|jpe?g|webp|gif|svg|bmp|avif)$/i;
|
|
21598
23209
|
var audioExtPattern = /\.(wav|mp3|ogg|m4a|flac|aac)$/i;
|
|
21599
23210
|
var isLikelyUrl = (value) => /^https?:\/\//i.test(String(value || ""));
|
|
@@ -21920,7 +23531,7 @@ var DEFAULT_MASONRY_GAP_PX = 12;
|
|
|
21920
23531
|
var DEFAULT_MASONRY_ROW_HEIGHT_PX = 8;
|
|
21921
23532
|
var DEFAULT_MASONRY_COLUMN_WIDTH_PX = 280;
|
|
21922
23533
|
var DEFAULT_MASONRY_ITEM_HEIGHT_PX = 240;
|
|
21923
|
-
function
|
|
23534
|
+
function clamp4(value, min5, max5) {
|
|
21924
23535
|
return Math.min(Math.max(value, min5), max5);
|
|
21925
23536
|
}
|
|
21926
23537
|
function getRootFontSize(node) {
|
|
@@ -21995,10 +23606,10 @@ function getItemColumnSpan({
|
|
|
21995
23606
|
gap
|
|
21996
23607
|
}) {
|
|
21997
23608
|
if (Number.isFinite(size?.columnSpan) && Number(size?.columnSpan) > 0) {
|
|
21998
|
-
return
|
|
23609
|
+
return clamp4(Math.round(Number(size?.columnSpan)), 1, columnCount);
|
|
21999
23610
|
}
|
|
22000
23611
|
const itemWidth = resolveLengthToPixels(size?.width, columnWidth, null);
|
|
22001
|
-
return
|
|
23612
|
+
return clamp4(Math.ceil((itemWidth + gap) / (columnWidth + gap)), 1, columnCount);
|
|
22002
23613
|
}
|
|
22003
23614
|
function getItemRowSpan({
|
|
22004
23615
|
size,
|
|
@@ -22175,7 +23786,7 @@ function WorkbenchMasonryLayout({
|
|
|
22175
23786
|
let nextColumnIndex = 0;
|
|
22176
23787
|
let maxBottom = 0;
|
|
22177
23788
|
const positionedItems = layoutItems.map(({ key, item, columnSpan, rowSpan, size }) => {
|
|
22178
|
-
const resolvedSpan =
|
|
23789
|
+
const resolvedSpan = clamp4(columnSpan, 1, columnCount);
|
|
22179
23790
|
let startColumn = nextColumnIndex;
|
|
22180
23791
|
if (startColumn + resolvedSpan > columnCount) {
|
|
22181
23792
|
startColumn = 0;
|
|
@@ -22780,6 +24391,173 @@ function WorkbenchGalleryView({
|
|
|
22780
24391
|
}
|
|
22781
24392
|
);
|
|
22782
24393
|
}
|
|
24394
|
+
function toCssSize5(value) {
|
|
24395
|
+
if (value === void 0) return void 0;
|
|
24396
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
24397
|
+
}
|
|
24398
|
+
function defaultGetRowId(row, rowIndex) {
|
|
24399
|
+
return String(row?.id ?? row?.key ?? rowIndex);
|
|
24400
|
+
}
|
|
24401
|
+
function defaultGetColumnId(row) {
|
|
24402
|
+
return String(row?.columnId ?? row?.status ?? "");
|
|
24403
|
+
}
|
|
24404
|
+
function defaultRenderCard(row) {
|
|
24405
|
+
const value = row?.title ?? row?.name ?? row?.id ?? "Untitled";
|
|
24406
|
+
return /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border/70 bg-card px-3 py-2 text-sm text-foreground shadow-sm", children: String(value) });
|
|
24407
|
+
}
|
|
24408
|
+
function WorkbenchLaneDraggableCard({
|
|
24409
|
+
row,
|
|
24410
|
+
rowId,
|
|
24411
|
+
rowIndex,
|
|
24412
|
+
column,
|
|
24413
|
+
classNames,
|
|
24414
|
+
renderCard
|
|
24415
|
+
}) {
|
|
24416
|
+
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({ id: rowId });
|
|
24417
|
+
return /* @__PURE__ */ jsx(
|
|
24418
|
+
"div",
|
|
24419
|
+
{
|
|
24420
|
+
ref: setNodeRef,
|
|
24421
|
+
...listeners,
|
|
24422
|
+
...attributes,
|
|
24423
|
+
className: cn("touch-none", classNames?.cardWrapper),
|
|
24424
|
+
children: renderCard(row, { row, rowIndex, column, isDragging, isOverlay: false })
|
|
24425
|
+
}
|
|
24426
|
+
);
|
|
24427
|
+
}
|
|
24428
|
+
function WorkbenchLaneColumnView({
|
|
24429
|
+
column,
|
|
24430
|
+
columnRows,
|
|
24431
|
+
columnWidth,
|
|
24432
|
+
columnMinHeight,
|
|
24433
|
+
emptyColumn,
|
|
24434
|
+
classNames,
|
|
24435
|
+
renderCard
|
|
24436
|
+
}) {
|
|
24437
|
+
const { setNodeRef, isOver } = useDroppable({ id: column.id });
|
|
24438
|
+
return /* @__PURE__ */ jsxs(
|
|
24439
|
+
"section",
|
|
24440
|
+
{
|
|
24441
|
+
className: cn(
|
|
24442
|
+
"flex shrink-0 flex-col rounded-xl border border-border/60 bg-card p-2 shadow-sm",
|
|
24443
|
+
classNames?.column,
|
|
24444
|
+
column.className
|
|
24445
|
+
),
|
|
24446
|
+
style: { width: toCssSize5(columnWidth) ?? "280px" },
|
|
24447
|
+
children: [
|
|
24448
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex h-10 items-center gap-2 px-1", classNames?.columnHeader, column.headerClassName), children: [
|
|
24449
|
+
column.icon ? /* @__PURE__ */ jsx("span", { className: cn("inline-flex h-4 w-4 items-center justify-center text-muted-foreground", classNames?.columnIcon, column.iconClassName), children: column.icon }) : null,
|
|
24450
|
+
/* @__PURE__ */ jsx("span", { className: cn("inline-flex items-center rounded px-2 py-0.5 text-xs font-semibold bg-muted text-muted-foreground", classNames?.columnBadge, column.badgeClassName), children: column.label ?? column.id }),
|
|
24451
|
+
/* @__PURE__ */ jsx("span", { className: cn("text-xs text-muted-foreground", classNames?.columnCount), children: columnRows.length })
|
|
24452
|
+
] }),
|
|
24453
|
+
/* @__PURE__ */ jsx(
|
|
24454
|
+
"div",
|
|
24455
|
+
{
|
|
24456
|
+
ref: setNodeRef,
|
|
24457
|
+
className: cn(
|
|
24458
|
+
"mt-1 flex min-h-[200px] flex-1 flex-col gap-2 overflow-y-auto rounded-lg p-1 transition-colors [scrollbar-width:thin]",
|
|
24459
|
+
isOver && "bg-accent/60",
|
|
24460
|
+
classNames?.columnBody,
|
|
24461
|
+
column.bodyClassName
|
|
24462
|
+
),
|
|
24463
|
+
style: { minHeight: toCssSize5(columnMinHeight) },
|
|
24464
|
+
children: columnRows.length ? columnRows.map(({ row, rowIndex, rowId }) => /* @__PURE__ */ jsx(
|
|
24465
|
+
WorkbenchLaneDraggableCard,
|
|
24466
|
+
{
|
|
24467
|
+
row,
|
|
24468
|
+
rowId,
|
|
24469
|
+
rowIndex,
|
|
24470
|
+
column,
|
|
24471
|
+
classNames,
|
|
24472
|
+
renderCard
|
|
24473
|
+
},
|
|
24474
|
+
rowId
|
|
24475
|
+
)) : emptyColumn ? /* @__PURE__ */ jsx("div", { className: cn("flex min-h-24 items-center justify-center rounded-lg border border-dashed border-border/60 px-3 py-4 text-xs text-muted-foreground", classNames?.emptyColumn), children: emptyColumn }) : null
|
|
24476
|
+
}
|
|
24477
|
+
)
|
|
24478
|
+
]
|
|
24479
|
+
}
|
|
24480
|
+
);
|
|
24481
|
+
}
|
|
24482
|
+
function WorkbenchLaneView({
|
|
24483
|
+
rows = [],
|
|
24484
|
+
columns = [],
|
|
24485
|
+
getRowId = defaultGetRowId,
|
|
24486
|
+
getColumnId = defaultGetColumnId,
|
|
24487
|
+
renderCard = defaultRenderCard,
|
|
24488
|
+
renderOverlayCard,
|
|
24489
|
+
onMoveRow,
|
|
24490
|
+
emptyColumn,
|
|
24491
|
+
activationDistance = 5,
|
|
24492
|
+
columnWidth = 280,
|
|
24493
|
+
columnMinHeight,
|
|
24494
|
+
className,
|
|
24495
|
+
classNames,
|
|
24496
|
+
style
|
|
24497
|
+
}) {
|
|
24498
|
+
const [activeRowId, setActiveRowId] = useState(null);
|
|
24499
|
+
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: activationDistance } }));
|
|
24500
|
+
const columnMap = useMemo(() => new Map(columns.map((column) => [column.id, column])), [columns]);
|
|
24501
|
+
const rowEntries = useMemo(() => rows.map((row, rowIndex) => ({
|
|
24502
|
+
row,
|
|
24503
|
+
rowIndex,
|
|
24504
|
+
rowId: getRowId(row, rowIndex),
|
|
24505
|
+
columnId: getColumnId(row, rowIndex)
|
|
24506
|
+
})), [getColumnId, getRowId, rows]);
|
|
24507
|
+
const activeEntry = activeRowId ? rowEntries.find((entry) => entry.rowId === activeRowId) : void 0;
|
|
24508
|
+
const rowsByColumn = useMemo(() => {
|
|
24509
|
+
const next = /* @__PURE__ */ new Map();
|
|
24510
|
+
columns.forEach((column) => next.set(column.id, []));
|
|
24511
|
+
rowEntries.forEach(({ row, rowIndex, rowId, columnId }) => {
|
|
24512
|
+
next.get(columnId)?.push({ row, rowIndex, rowId });
|
|
24513
|
+
});
|
|
24514
|
+
return next;
|
|
24515
|
+
}, [columns, rowEntries]);
|
|
24516
|
+
const activeColumn = activeEntry ? columnMap.get(activeEntry.columnId) : void 0;
|
|
24517
|
+
const handleDragStart = useCallback((event) => {
|
|
24518
|
+
setActiveRowId(String(event.active.id));
|
|
24519
|
+
}, []);
|
|
24520
|
+
const handleDragEnd = useCallback((event) => {
|
|
24521
|
+
setActiveRowId(null);
|
|
24522
|
+
const rowId = String(event.active.id);
|
|
24523
|
+
const nextColumnId = String(event.over?.id ?? "");
|
|
24524
|
+
const activeRow = rowEntries.find((entry) => entry.rowId === rowId);
|
|
24525
|
+
if (!activeRow || !columnMap.has(nextColumnId) || activeRow.columnId === nextColumnId) return;
|
|
24526
|
+
onMoveRow?.(rowId, nextColumnId, activeRow.row);
|
|
24527
|
+
}, [columnMap, onMoveRow, rowEntries]);
|
|
24528
|
+
const handleDragCancel = useCallback(() => {
|
|
24529
|
+
setActiveRowId(null);
|
|
24530
|
+
}, []);
|
|
24531
|
+
return /* @__PURE__ */ jsxs(DndContext, { sensors, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDragCancel: handleDragCancel, children: [
|
|
24532
|
+
/* @__PURE__ */ jsx(
|
|
24533
|
+
"div",
|
|
24534
|
+
{
|
|
24535
|
+
className: cn("flex min-h-0 flex-1 gap-4 overflow-x-auto p-4 [scrollbar-width:thin]", classNames?.root, className),
|
|
24536
|
+
style,
|
|
24537
|
+
children: columns.map((column) => /* @__PURE__ */ jsx(
|
|
24538
|
+
WorkbenchLaneColumnView,
|
|
24539
|
+
{
|
|
24540
|
+
column,
|
|
24541
|
+
columnRows: rowsByColumn.get(column.id) || [],
|
|
24542
|
+
columnWidth,
|
|
24543
|
+
columnMinHeight,
|
|
24544
|
+
emptyColumn,
|
|
24545
|
+
classNames,
|
|
24546
|
+
renderCard
|
|
24547
|
+
},
|
|
24548
|
+
column.id
|
|
24549
|
+
))
|
|
24550
|
+
}
|
|
24551
|
+
),
|
|
24552
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: activeEntry && activeColumn ? /* @__PURE__ */ jsx("div", { className: cn(classNames?.overlayWrapper), children: (renderOverlayCard || renderCard)(activeEntry.row, {
|
|
24553
|
+
row: activeEntry.row,
|
|
24554
|
+
rowIndex: activeEntry.rowIndex,
|
|
24555
|
+
column: activeColumn,
|
|
24556
|
+
isDragging: false,
|
|
24557
|
+
isOverlay: true
|
|
24558
|
+
}) }) : null })
|
|
24559
|
+
] });
|
|
24560
|
+
}
|
|
22783
24561
|
function cn4(...inputs) {
|
|
22784
24562
|
return inputs.filter(Boolean).join(" ");
|
|
22785
24563
|
}
|
|
@@ -23073,6 +24851,6 @@ lodash/lodash.js:
|
|
|
23073
24851
|
*)
|
|
23074
24852
|
*/
|
|
23075
24853
|
|
|
23076
|
-
export { ARTIST_CONFIG, ARTIST_DEFAULT_QUICK_ACTIONS, AppHeader, AppLayout, AppSidebar, ArtistLandingPage, AuthDivider, BSD_CONFIG, BSD_DEFAULT_FEATURE_CARDS, BaseAccordion, BaseAvatar, BaseBadge, BaseBreadcrumb, BaseButton, BaseCheckbox, BaseContextMenu, BaseContextMenuCheckboxItem, BaseContextMenuContent, BaseContextMenuItem, BaseContextMenuLabel, BaseContextMenuRadioGroup, BaseContextMenuRadioItem, BaseContextMenuSeparator, BaseContextMenuSub, BaseContextMenuSubContent, BaseContextMenuSubTrigger, BaseContextMenuTrigger, BaseDescriptionList, BaseDialog, BaseDivider, BaseDropdownMenu, BaseEmptyState, BaseField, BaseInput, BaseLoadingState, BaseNotice, BasePagination, BasePanel, BaseProgress, BaseRadioGroup, BaseSectionHeader, BaseSegmentedControl, BaseSelect, BaseSkeleton, BaseSwitch, BaseTable, BaseTableBody, BaseTableCaption, BaseTableCell, BaseTableContainer, BaseTableEmpty, BaseTableFooter, BaseTableFooterBar, BaseTableHead, BaseTableHeader, BaseTableLoading, BaseTableRow, BaseTabs, BaseTextarea, BaseToolbar, BaseTooltip, BsdLandingPage, BsdToolboxPanel, CONCEPT_CONFIG, CONCEPT_DEFAULT_QUICK_ACTIONS, ConceptDesignLandingPage, DarkModeSelector, DarkModeSubMenu, DataExplorerActionBar, DataExplorerButton, DataExplorerCheckbox, DataExplorerCollectionFooter, DataExplorerDetailField, DataExplorerDetailSection, DataExplorerDetailShell, DataExplorerDisplayActionMenu, DataExplorerDisplayCard, DataExplorerDisplayCollectionView, DataExplorerDisplayListItem, DataExplorerDisplayMedia, DataExplorerImagePreview, DataExplorerPage, DataExplorerRecordCard, DataExplorerSelect, DataExplorerToolbarActions, DataExplorerToolbarShell, DataExplorerTree, DataExplorerTreeShell, DataExplorerView, DataExplorerViewCollection, DataExplorerViewItem, DataExplorerViewItemShell, DataExplorerViewShell, DataExplorerViewTree, DefaultLandingPage, DynamicComponent, EmailAuth, I18nSelector, LoginLayout, NavButton, OAuthButton, OIDCButton, PendingApproval, WorkbenchContentPane, WorkbenchContentToolbar, WorkbenchDetailSidebar, WorkbenchGalleryCard, WorkbenchGallerySettingsButton, WorkbenchGallerySettingsPanel, WorkbenchGalleryView, WorkbenchMasonryLayout, WorkbenchResizableSidebar, WorkbenchTableView, applyMonkeysTheme, calculateHue, calculateLightness, calculateSaturation, clearRegistry, cn3 as cn, createSolidColorScale, genTailwindTheme, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, getDataExplorerActionToneClassName, getDataExplorerMenuItemToneClassName, getRegisteredComponents, getRegisteredThemes, getThemeConfig, hasCustomComponent, markDarkColor, registerComponent, registerTheme, resolveBaseAppearance, resolveComponent, resolveDataExplorerAppearance, resolveMonkeysTheme, setNeocardTheme, setTailwindTheme, useDarkMode };
|
|
24854
|
+
export { ARTIST_CONFIG, ARTIST_DEFAULT_QUICK_ACTIONS, AppHeader, AppLayout, AppSidebar, ArtistLandingPage, AuthDivider, BSD_CONFIG, BSD_DEFAULT_FEATURE_CARDS, BaseAccordion, BaseAvatar, BaseBadge, BaseBreadcrumb, BaseButton, BaseCheckbox, BaseContextMenu, BaseContextMenuCheckboxItem, BaseContextMenuContent, BaseContextMenuItem, BaseContextMenuLabel, BaseContextMenuRadioGroup, BaseContextMenuRadioItem, BaseContextMenuSeparator, BaseContextMenuSub, BaseContextMenuSubContent, BaseContextMenuSubTrigger, BaseContextMenuTrigger, BaseDescriptionList, BaseDialog, BaseDivider, BaseDropdownMenu, BaseEmptyState, BaseField, BaseInput, BaseLayout, BaseLayoutPane, BaseLayoutResizeHandle, BaseLayoutSplit, BaseLoadingState, BaseMultiSelect, BaseNotice, BasePagination, BasePanel, BaseProgress, BaseRadioGroup, BaseSectionHeader, BaseSegmentedControl, BaseSelect, BaseSkeleton, BaseSwitch, BaseTable, BaseTableBody, BaseTableCaption, BaseTableCell, BaseTableContainer, BaseTableEmpty, BaseTableFooter, BaseTableFooterBar, BaseTableHead, BaseTableHeader, BaseTableLoading, BaseTableRow, BaseTabs, BaseTextarea, BaseToolbar, BaseTooltip, BsdLandingPage, BsdToolboxPanel, CONCEPT_CONFIG, CONCEPT_DEFAULT_QUICK_ACTIONS, ConceptDesignLandingPage, DarkModeSelector, DarkModeSubMenu, DataExplorerActionBar, DataExplorerButton, DataExplorerCheckbox, DataExplorerCollectionFooter, DataExplorerDetailField, DataExplorerDetailSection, DataExplorerDetailShell, DataExplorerDisplayActionMenu, DataExplorerDisplayCard, DataExplorerDisplayCollectionView, DataExplorerDisplayListItem, DataExplorerDisplayMedia, DataExplorerImagePreview, DataExplorerPage, DataExplorerRecordCard, DataExplorerSelect, DataExplorerToolbarActions, DataExplorerToolbarShell, DataExplorerTree, DataExplorerTreeShell, DataExplorerView, DataExplorerViewCollection, DataExplorerViewItem, DataExplorerViewItemShell, DataExplorerViewShell, DataExplorerViewTree, DefaultLandingPage, DynamicComponent, EmailAuth, I18nSelector, InteractiveTable, InteractiveTableEditableTextCell, InteractiveTableReadonlyCell, InteractiveTableSelectCell, LoginLayout, NavButton, OAuthButton, OIDCButton, PendingApproval, WorkbenchContentPane, WorkbenchContentToolbar, WorkbenchDetailSidebar, WorkbenchGalleryCard, WorkbenchGallerySettingsButton, WorkbenchGallerySettingsPanel, WorkbenchGalleryView, WorkbenchLaneView, WorkbenchMasonryLayout, WorkbenchResizableSidebar, WorkbenchTableView, applyMonkeysTheme, calculateHue, calculateLightness, calculateSaturation, clearRegistry, cn3 as cn, createSolidColorScale, genTailwindTheme, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, getDataExplorerActionToneClassName, getDataExplorerMenuItemToneClassName, getRegisteredComponents, getRegisteredThemes, getThemeConfig, hasCustomComponent, markDarkColor, registerComponent, registerTheme, resolveBaseAppearance, resolveComponent, resolveDataExplorerAppearance, resolveMonkeysTheme, setNeocardTheme, setTailwindTheme, useDarkMode };
|
|
23077
24855
|
//# sourceMappingURL=index.mjs.map
|
|
23078
24856
|
//# sourceMappingURL=index.mjs.map
|