@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.js
CHANGED
|
@@ -4,6 +4,7 @@ var React = require('react');
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var ContextMenu = require('@radix-ui/react-context-menu');
|
|
6
6
|
var DropdownMenu3 = require('@radix-ui/react-dropdown-menu');
|
|
7
|
+
var core = require('@dnd-kit/core');
|
|
7
8
|
var Tooltip = require('@radix-ui/react-tooltip');
|
|
8
9
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -4548,7 +4549,7 @@ var require_lodash = __commonJS({
|
|
|
4548
4549
|
function valuesIn(object) {
|
|
4549
4550
|
return object == null ? [] : baseValues(object, keysIn(object));
|
|
4550
4551
|
}
|
|
4551
|
-
function
|
|
4552
|
+
function clamp5(number, lower, upper) {
|
|
4552
4553
|
if (upper === undefined2) {
|
|
4553
4554
|
upper = lower;
|
|
4554
4555
|
lower = undefined2;
|
|
@@ -5225,7 +5226,7 @@ var require_lodash = __commonJS({
|
|
|
5225
5226
|
lodash.camelCase = camelCase;
|
|
5226
5227
|
lodash.capitalize = capitalize;
|
|
5227
5228
|
lodash.ceil = ceil;
|
|
5228
|
-
lodash.clamp =
|
|
5229
|
+
lodash.clamp = clamp5;
|
|
5229
5230
|
lodash.clone = clone;
|
|
5230
5231
|
lodash.cloneDeep = cloneDeep;
|
|
5231
5232
|
lodash.cloneDeepWith = cloneDeepWith;
|
|
@@ -8580,7 +8581,41 @@ var baseSlots = {
|
|
|
8580
8581
|
tableEmptyActions: "mt-4 flex flex-wrap items-center justify-center gap-2",
|
|
8581
8582
|
tableLoadingRow: "border-b border-border/60",
|
|
8582
8583
|
tableLoadingCell: "px-3 py-2",
|
|
8583
|
-
tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70"
|
|
8584
|
+
tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70",
|
|
8585
|
+
layoutRoot: cn(
|
|
8586
|
+
"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",
|
|
8587
|
+
motionBase
|
|
8588
|
+
),
|
|
8589
|
+
layoutRootFull: "h-full min-h-0",
|
|
8590
|
+
layoutHeader: "min-w-0",
|
|
8591
|
+
layoutBody: "grid min-h-0 min-w-0 overflow-hidden gap-3",
|
|
8592
|
+
layoutSidebar: "min-h-0 min-w-0 overflow-hidden",
|
|
8593
|
+
layoutMain: "min-h-0 min-w-0 overflow-hidden",
|
|
8594
|
+
layoutAside: "min-h-0 min-w-0 overflow-hidden",
|
|
8595
|
+
layoutFooter: "min-w-0",
|
|
8596
|
+
layoutPane: cn(
|
|
8597
|
+
"h-full max-h-full min-h-0 min-w-0 overflow-hidden rounded-lg bg-background text-foreground",
|
|
8598
|
+
motionBase
|
|
8599
|
+
),
|
|
8600
|
+
layoutPaneScrollable: "overflow-auto",
|
|
8601
|
+
layoutPaneBordered: "border border-border/70",
|
|
8602
|
+
layoutPaneMuted: "bg-muted/25",
|
|
8603
|
+
layoutPaneSoft: "bg-background/95 shadow-sm",
|
|
8604
|
+
layoutPaneTransparent: "bg-transparent shadow-none",
|
|
8605
|
+
layoutSplitRoot: "grid min-h-0 min-w-0 overflow-hidden",
|
|
8606
|
+
layoutSplitHorizontal: "grid-flow-col",
|
|
8607
|
+
layoutSplitVertical: "grid-flow-row",
|
|
8608
|
+
layoutSplitPane: "min-h-0 min-w-0 overflow-hidden",
|
|
8609
|
+
layoutSplitPrimary: "",
|
|
8610
|
+
layoutSplitSecondary: "",
|
|
8611
|
+
layoutResizeHandle: cn(
|
|
8612
|
+
"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",
|
|
8613
|
+
motionInteractive
|
|
8614
|
+
),
|
|
8615
|
+
layoutResizeHandleHorizontal: "w-2 cursor-col-resize",
|
|
8616
|
+
layoutResizeHandleVertical: "h-2 cursor-row-resize",
|
|
8617
|
+
layoutResizeHandleDisabled: "cursor-default opacity-60",
|
|
8618
|
+
layoutResizeHandleIndicator: "rounded-full bg-muted-foreground/45 group-hover/resize:bg-primary/70"
|
|
8584
8619
|
};
|
|
8585
8620
|
var densitySlots = {
|
|
8586
8621
|
compact: {
|
|
@@ -8654,7 +8689,12 @@ var densitySlots = {
|
|
|
8654
8689
|
tableCell: "px-2 py-1.5 text-xs",
|
|
8655
8690
|
tableHeadLabel: "text-[11px]",
|
|
8656
8691
|
tableHeadDescription: "text-[10px] leading-3",
|
|
8657
|
-
tableLoadingCell: "px-2 py-1.5"
|
|
8692
|
+
tableLoadingCell: "px-2 py-1.5",
|
|
8693
|
+
layoutRoot: "gap-2 p-2",
|
|
8694
|
+
layoutBody: "gap-2",
|
|
8695
|
+
layoutPane: "rounded-md text-xs",
|
|
8696
|
+
layoutResizeHandleHorizontal: "w-1.5",
|
|
8697
|
+
layoutResizeHandleVertical: "h-1.5"
|
|
8658
8698
|
},
|
|
8659
8699
|
default: {
|
|
8660
8700
|
buttonBase: "h-9"
|
|
@@ -8705,7 +8745,12 @@ var densitySlots = {
|
|
|
8705
8745
|
menuSubTrigger: "min-h-9 px-3 py-2",
|
|
8706
8746
|
tableHead: "h-12 px-4 py-3",
|
|
8707
8747
|
tableCell: "px-4 py-3",
|
|
8708
|
-
tableLoadingCell: "px-4 py-3"
|
|
8748
|
+
tableLoadingCell: "px-4 py-3",
|
|
8749
|
+
layoutRoot: "gap-4 p-4",
|
|
8750
|
+
layoutBody: "gap-4",
|
|
8751
|
+
layoutPane: "rounded-xl",
|
|
8752
|
+
layoutResizeHandleHorizontal: "w-2.5",
|
|
8753
|
+
layoutResizeHandleVertical: "h-2.5"
|
|
8709
8754
|
}
|
|
8710
8755
|
};
|
|
8711
8756
|
var radiusSlots = {
|
|
@@ -8749,7 +8794,9 @@ var radiusSlots = {
|
|
|
8749
8794
|
menuSubContent: "rounded-none",
|
|
8750
8795
|
tableContainer: "rounded-none",
|
|
8751
8796
|
tableEmptyIcon: "rounded-none",
|
|
8752
|
-
tableLoadingSkeleton: "rounded-none"
|
|
8797
|
+
tableLoadingSkeleton: "rounded-none",
|
|
8798
|
+
layoutRoot: "rounded-none",
|
|
8799
|
+
layoutPane: "rounded-none"
|
|
8753
8800
|
},
|
|
8754
8801
|
sm: {
|
|
8755
8802
|
buttonBase: "rounded-sm",
|
|
@@ -8791,7 +8838,9 @@ var radiusSlots = {
|
|
|
8791
8838
|
menuSubContent: "rounded-sm",
|
|
8792
8839
|
tableContainer: "rounded-sm",
|
|
8793
8840
|
tableEmptyIcon: "rounded-sm",
|
|
8794
|
-
tableLoadingSkeleton: "rounded-sm"
|
|
8841
|
+
tableLoadingSkeleton: "rounded-sm",
|
|
8842
|
+
layoutRoot: "rounded-sm",
|
|
8843
|
+
layoutPane: "rounded-sm"
|
|
8795
8844
|
},
|
|
8796
8845
|
md: {},
|
|
8797
8846
|
lg: {
|
|
@@ -8828,7 +8877,9 @@ var radiusSlots = {
|
|
|
8828
8877
|
menuSubContent: "rounded-lg",
|
|
8829
8878
|
tableContainer: "rounded-xl",
|
|
8830
8879
|
tableEmptyIcon: "rounded-xl",
|
|
8831
|
-
tableLoadingSkeleton: "rounded-lg"
|
|
8880
|
+
tableLoadingSkeleton: "rounded-lg",
|
|
8881
|
+
layoutRoot: "rounded-xl",
|
|
8882
|
+
layoutPane: "rounded-xl"
|
|
8832
8883
|
},
|
|
8833
8884
|
xl: {
|
|
8834
8885
|
buttonBase: "rounded-xl",
|
|
@@ -8866,7 +8917,9 @@ var radiusSlots = {
|
|
|
8866
8917
|
menuSubContent: "rounded-xl",
|
|
8867
8918
|
tableContainer: "rounded-2xl",
|
|
8868
8919
|
tableEmptyIcon: "rounded-2xl",
|
|
8869
|
-
tableLoadingSkeleton: "rounded-xl"
|
|
8920
|
+
tableLoadingSkeleton: "rounded-xl",
|
|
8921
|
+
layoutRoot: "rounded-2xl",
|
|
8922
|
+
layoutPane: "rounded-2xl"
|
|
8870
8923
|
},
|
|
8871
8924
|
full: {
|
|
8872
8925
|
buttonBase: "rounded-full",
|
|
@@ -8908,7 +8961,9 @@ var radiusSlots = {
|
|
|
8908
8961
|
menuSubContent: "rounded-2xl",
|
|
8909
8962
|
tableContainer: "rounded-2xl",
|
|
8910
8963
|
tableEmptyIcon: "rounded-full",
|
|
8911
|
-
tableLoadingSkeleton: "rounded-full"
|
|
8964
|
+
tableLoadingSkeleton: "rounded-full",
|
|
8965
|
+
layoutRoot: "rounded-2xl",
|
|
8966
|
+
layoutPane: "rounded-2xl"
|
|
8912
8967
|
}
|
|
8913
8968
|
};
|
|
8914
8969
|
var borderSlots = {
|
|
@@ -8950,7 +9005,10 @@ var borderSlots = {
|
|
|
8950
9005
|
tableFooterBarAttached: "border-t border-transparent",
|
|
8951
9006
|
tableRow: "border-transparent",
|
|
8952
9007
|
tableEmptyRow: "border-transparent",
|
|
8953
|
-
tableLoadingRow: "border-transparent"
|
|
9008
|
+
tableLoadingRow: "border-transparent",
|
|
9009
|
+
layoutRoot: "border-transparent",
|
|
9010
|
+
layoutPaneBordered: "border-transparent",
|
|
9011
|
+
layoutResizeHandle: "bg-transparent hover:bg-transparent active:bg-transparent focus-visible:bg-transparent"
|
|
8954
9012
|
},
|
|
8955
9013
|
subtle: {
|
|
8956
9014
|
buttonDefault: "border-border/60",
|
|
@@ -8990,7 +9048,9 @@ var borderSlots = {
|
|
|
8990
9048
|
tableFooterBarAttached: "border-t border-border/60",
|
|
8991
9049
|
tableRow: "border-border/50",
|
|
8992
9050
|
tableEmptyRow: "border-border/50",
|
|
8993
|
-
tableLoadingRow: "border-border/50"
|
|
9051
|
+
tableLoadingRow: "border-border/50",
|
|
9052
|
+
layoutRoot: "border-border/60",
|
|
9053
|
+
layoutPaneBordered: "border-border/60"
|
|
8994
9054
|
},
|
|
8995
9055
|
solid: {},
|
|
8996
9056
|
strong: {
|
|
@@ -9031,7 +9091,10 @@ var borderSlots = {
|
|
|
9031
9091
|
tableFooterBarAttached: "border-t border-foreground/20",
|
|
9032
9092
|
tableRow: "border-foreground/15",
|
|
9033
9093
|
tableEmptyRow: "border-foreground/15",
|
|
9034
|
-
tableLoadingRow: "border-foreground/15"
|
|
9094
|
+
tableLoadingRow: "border-foreground/15",
|
|
9095
|
+
layoutRoot: "border-foreground/20",
|
|
9096
|
+
layoutPaneBordered: "border-foreground/20",
|
|
9097
|
+
layoutResizeHandle: "hover:bg-foreground/15 active:bg-foreground/20 focus-visible:bg-foreground/15"
|
|
9035
9098
|
}
|
|
9036
9099
|
};
|
|
9037
9100
|
var backgroundSlots = {
|
|
@@ -9073,7 +9136,11 @@ var backgroundSlots = {
|
|
|
9073
9136
|
tableFooter: "bg-muted/35",
|
|
9074
9137
|
tableFooterBar: "bg-muted/30 shadow-none",
|
|
9075
9138
|
tableRowInteractive: "cursor-pointer hover:bg-muted/45",
|
|
9076
|
-
tableLoadingSkeleton: "bg-muted"
|
|
9139
|
+
tableLoadingSkeleton: "bg-muted",
|
|
9140
|
+
layoutRoot: "bg-card",
|
|
9141
|
+
layoutPane: "bg-card",
|
|
9142
|
+
layoutPaneMuted: "bg-muted/35",
|
|
9143
|
+
layoutResizeHandle: "hover:bg-border/70 active:bg-border/80 focus-visible:bg-border/70"
|
|
9077
9144
|
},
|
|
9078
9145
|
soft: {
|
|
9079
9146
|
buttonDefault: "bg-muted/30 hover:bg-muted/55",
|
|
@@ -9109,7 +9176,10 @@ var backgroundSlots = {
|
|
|
9109
9176
|
tableFooter: "bg-muted/25",
|
|
9110
9177
|
tableFooterBar: "bg-muted/25 shadow-none",
|
|
9111
9178
|
tableRowInteractive: "cursor-pointer hover:bg-muted/35",
|
|
9112
|
-
tableLoadingSkeleton: "bg-muted/65"
|
|
9179
|
+
tableLoadingSkeleton: "bg-muted/65",
|
|
9180
|
+
layoutRoot: "bg-background/95 shadow-sm",
|
|
9181
|
+
layoutPane: "bg-background/95 shadow-sm",
|
|
9182
|
+
layoutPaneSoft: "bg-background/95 shadow-md"
|
|
9113
9183
|
},
|
|
9114
9184
|
glass: {
|
|
9115
9185
|
buttonBase: "backdrop-blur-md",
|
|
@@ -9170,7 +9240,13 @@ var backgroundSlots = {
|
|
|
9170
9240
|
tableRow: "border-white/10",
|
|
9171
9241
|
tableRowInteractive: "cursor-pointer hover:bg-white/[0.08]",
|
|
9172
9242
|
tableHeadLabel: "text-foreground",
|
|
9173
|
-
tableLoadingSkeleton: "bg-white/[0.16]"
|
|
9243
|
+
tableLoadingSkeleton: "bg-white/[0.16]",
|
|
9244
|
+
layoutRoot: "border-white/10 bg-white/[0.05] shadow-none backdrop-blur-md",
|
|
9245
|
+
layoutPane: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
|
|
9246
|
+
layoutPaneMuted: "bg-white/[0.08]",
|
|
9247
|
+
layoutPaneSoft: "bg-white/[0.10] shadow-none backdrop-blur-md",
|
|
9248
|
+
layoutResizeHandle: "text-foreground/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
|
|
9249
|
+
layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
|
|
9174
9250
|
},
|
|
9175
9251
|
dark: {
|
|
9176
9252
|
buttonBase: "border-white/15 text-white shadow-lg backdrop-blur",
|
|
@@ -9299,7 +9375,13 @@ var backgroundSlots = {
|
|
|
9299
9375
|
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]",
|
|
9300
9376
|
menuSubTriggerIcon: "text-white/55",
|
|
9301
9377
|
menuSubContent: "border-white/10 bg-slate-950 text-white shadow-2xl",
|
|
9302
|
-
tableLoadingSkeleton: "bg-white/[0.14]"
|
|
9378
|
+
tableLoadingSkeleton: "bg-white/[0.14]",
|
|
9379
|
+
layoutRoot: "border-white/10 bg-slate-950 text-white shadow-none",
|
|
9380
|
+
layoutPane: "border-white/10 bg-slate-950 text-white shadow-none",
|
|
9381
|
+
layoutPaneMuted: "bg-white/[0.06]",
|
|
9382
|
+
layoutPaneSoft: "bg-white/[0.08] shadow-none",
|
|
9383
|
+
layoutResizeHandle: "text-white/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
|
|
9384
|
+
layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
|
|
9303
9385
|
}
|
|
9304
9386
|
};
|
|
9305
9387
|
var presetDefaults = {
|
|
@@ -11157,6 +11239,432 @@ var BaseInput = React.forwardRef(
|
|
|
11157
11239
|
);
|
|
11158
11240
|
}
|
|
11159
11241
|
);
|
|
11242
|
+
var DEFAULT_SPLIT_SIZE = 50;
|
|
11243
|
+
var DEFAULT_MIN_SIZE = 20;
|
|
11244
|
+
var DEFAULT_MAX_SIZE = 80;
|
|
11245
|
+
var DEFAULT_KEYBOARD_STEP = 2.5;
|
|
11246
|
+
function toCssSize(value, fallback) {
|
|
11247
|
+
if (typeof value === "number") {
|
|
11248
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
11249
|
+
throw new Error("BaseLayout size and gap props must be finite, non-negative numbers.");
|
|
11250
|
+
}
|
|
11251
|
+
return `${value}px`;
|
|
11252
|
+
}
|
|
11253
|
+
return value ?? fallback;
|
|
11254
|
+
}
|
|
11255
|
+
function assertPercent(name, value) {
|
|
11256
|
+
if (!Number.isFinite(value)) {
|
|
11257
|
+
throw new Error(`BaseLayoutSplit ${name} must be a finite number.`);
|
|
11258
|
+
}
|
|
11259
|
+
if (value < 0 || value > 100) {
|
|
11260
|
+
throw new Error(`BaseLayoutSplit ${name} must be between 0 and 100.`);
|
|
11261
|
+
}
|
|
11262
|
+
return value;
|
|
11263
|
+
}
|
|
11264
|
+
function clamp(value, min5, max5) {
|
|
11265
|
+
return Math.min(Math.max(value, min5), max5);
|
|
11266
|
+
}
|
|
11267
|
+
function resolveSplitBounds({
|
|
11268
|
+
minSize = DEFAULT_MIN_SIZE,
|
|
11269
|
+
maxSize = DEFAULT_MAX_SIZE,
|
|
11270
|
+
keyboardStep = DEFAULT_KEYBOARD_STEP
|
|
11271
|
+
}) {
|
|
11272
|
+
const min5 = assertPercent("minSize", minSize);
|
|
11273
|
+
const max5 = assertPercent("maxSize", maxSize);
|
|
11274
|
+
if (min5 > max5) {
|
|
11275
|
+
throw new Error("BaseLayoutSplit minSize cannot be greater than maxSize.");
|
|
11276
|
+
}
|
|
11277
|
+
if (!Number.isFinite(keyboardStep) || keyboardStep <= 0) {
|
|
11278
|
+
throw new Error("BaseLayoutSplit keyboardStep must be a finite positive number.");
|
|
11279
|
+
}
|
|
11280
|
+
return { min: min5, max: max5, keyboardStep };
|
|
11281
|
+
}
|
|
11282
|
+
function resolveSplitSize(name, value, fallback, min5, max5) {
|
|
11283
|
+
return clamp(assertPercent(name, value ?? fallback), min5, max5);
|
|
11284
|
+
}
|
|
11285
|
+
function getSeparatorOrientation(orientation) {
|
|
11286
|
+
return orientation === "horizontal" ? "vertical" : "horizontal";
|
|
11287
|
+
}
|
|
11288
|
+
function BaseLayout({
|
|
11289
|
+
header,
|
|
11290
|
+
sidebar,
|
|
11291
|
+
aside,
|
|
11292
|
+
footer,
|
|
11293
|
+
children,
|
|
11294
|
+
sidebarSize,
|
|
11295
|
+
asideSize,
|
|
11296
|
+
gap,
|
|
11297
|
+
fullHeight,
|
|
11298
|
+
appearance,
|
|
11299
|
+
className,
|
|
11300
|
+
classNames,
|
|
11301
|
+
style,
|
|
11302
|
+
...layoutProps
|
|
11303
|
+
}) {
|
|
11304
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11305
|
+
const hasHeader = hasRenderableNode(header);
|
|
11306
|
+
const hasSidebar = hasRenderableNode(sidebar);
|
|
11307
|
+
const hasAside = hasRenderableNode(aside);
|
|
11308
|
+
const hasFooter = hasRenderableNode(footer);
|
|
11309
|
+
const bodyColumns = [
|
|
11310
|
+
hasSidebar ? "var(--base-layout-sidebar-size)" : void 0,
|
|
11311
|
+
"minmax(0, 1fr)",
|
|
11312
|
+
hasAside ? "var(--base-layout-aside-size)" : void 0
|
|
11313
|
+
].filter(Boolean).join(" ");
|
|
11314
|
+
const layoutRows = [
|
|
11315
|
+
hasHeader ? "auto" : void 0,
|
|
11316
|
+
"minmax(0, 1fr)",
|
|
11317
|
+
hasFooter ? "auto" : void 0
|
|
11318
|
+
].filter(Boolean).join(" ");
|
|
11319
|
+
const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
|
|
11320
|
+
const layoutStyle = {
|
|
11321
|
+
...theme.styles.layout,
|
|
11322
|
+
"--base-layout-sidebar-size": toCssSize(sidebarSize, "16rem"),
|
|
11323
|
+
"--base-layout-aside-size": toCssSize(asideSize, "20rem"),
|
|
11324
|
+
gridTemplateRows: layoutRows,
|
|
11325
|
+
...resolvedGap !== void 0 ? { gap: resolvedGap } : {},
|
|
11326
|
+
...style
|
|
11327
|
+
};
|
|
11328
|
+
const bodyStyle = {
|
|
11329
|
+
...theme.styles.layoutBody,
|
|
11330
|
+
gridTemplateColumns: bodyColumns,
|
|
11331
|
+
...resolvedGap !== void 0 ? { gap: resolvedGap } : {}
|
|
11332
|
+
};
|
|
11333
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11334
|
+
"div",
|
|
11335
|
+
{
|
|
11336
|
+
...layoutProps,
|
|
11337
|
+
className: cn(
|
|
11338
|
+
theme.slots.layoutRoot,
|
|
11339
|
+
fullHeight && theme.slots.layoutRootFull,
|
|
11340
|
+
classNames?.root,
|
|
11341
|
+
className
|
|
11342
|
+
),
|
|
11343
|
+
style: layoutStyle,
|
|
11344
|
+
children: [
|
|
11345
|
+
hasHeader ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11346
|
+
"div",
|
|
11347
|
+
{
|
|
11348
|
+
className: cn(theme.slots.layoutHeader, classNames?.header),
|
|
11349
|
+
style: theme.styles.layoutHeader,
|
|
11350
|
+
children: header
|
|
11351
|
+
}
|
|
11352
|
+
) : null,
|
|
11353
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11354
|
+
"div",
|
|
11355
|
+
{
|
|
11356
|
+
className: cn(theme.slots.layoutBody, classNames?.body),
|
|
11357
|
+
style: bodyStyle,
|
|
11358
|
+
children: [
|
|
11359
|
+
hasSidebar ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11360
|
+
"aside",
|
|
11361
|
+
{
|
|
11362
|
+
className: cn(theme.slots.layoutSidebar, classNames?.sidebar),
|
|
11363
|
+
style: theme.styles.layoutSidebar,
|
|
11364
|
+
children: sidebar
|
|
11365
|
+
}
|
|
11366
|
+
) : null,
|
|
11367
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11368
|
+
"main",
|
|
11369
|
+
{
|
|
11370
|
+
className: cn(theme.slots.layoutMain, classNames?.main),
|
|
11371
|
+
style: theme.styles.layoutMain,
|
|
11372
|
+
children
|
|
11373
|
+
}
|
|
11374
|
+
),
|
|
11375
|
+
hasAside ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11376
|
+
"aside",
|
|
11377
|
+
{
|
|
11378
|
+
className: cn(theme.slots.layoutAside, classNames?.aside),
|
|
11379
|
+
style: theme.styles.layoutAside,
|
|
11380
|
+
children: aside
|
|
11381
|
+
}
|
|
11382
|
+
) : null
|
|
11383
|
+
]
|
|
11384
|
+
}
|
|
11385
|
+
),
|
|
11386
|
+
hasFooter ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11387
|
+
"div",
|
|
11388
|
+
{
|
|
11389
|
+
className: cn(theme.slots.layoutFooter, classNames?.footer),
|
|
11390
|
+
style: theme.styles.layoutFooter,
|
|
11391
|
+
children: footer
|
|
11392
|
+
}
|
|
11393
|
+
) : null
|
|
11394
|
+
]
|
|
11395
|
+
}
|
|
11396
|
+
);
|
|
11397
|
+
}
|
|
11398
|
+
function BaseLayoutPane({
|
|
11399
|
+
as = "div",
|
|
11400
|
+
scrollable = false,
|
|
11401
|
+
bordered = true,
|
|
11402
|
+
surface = "default",
|
|
11403
|
+
children,
|
|
11404
|
+
appearance,
|
|
11405
|
+
className,
|
|
11406
|
+
classNames,
|
|
11407
|
+
style,
|
|
11408
|
+
...paneProps
|
|
11409
|
+
}) {
|
|
11410
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11411
|
+
const Component = as;
|
|
11412
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11413
|
+
Component,
|
|
11414
|
+
{
|
|
11415
|
+
...paneProps,
|
|
11416
|
+
className: cn(
|
|
11417
|
+
theme.slots.layoutPane,
|
|
11418
|
+
scrollable && theme.slots.layoutPaneScrollable,
|
|
11419
|
+
bordered && theme.slots.layoutPaneBordered,
|
|
11420
|
+
surface === "muted" && theme.slots.layoutPaneMuted,
|
|
11421
|
+
surface === "soft" && theme.slots.layoutPaneSoft,
|
|
11422
|
+
surface === "transparent" && theme.slots.layoutPaneTransparent,
|
|
11423
|
+
classNames?.root,
|
|
11424
|
+
className
|
|
11425
|
+
),
|
|
11426
|
+
style: {
|
|
11427
|
+
...theme.styles.layoutPane,
|
|
11428
|
+
...style
|
|
11429
|
+
},
|
|
11430
|
+
children
|
|
11431
|
+
}
|
|
11432
|
+
);
|
|
11433
|
+
}
|
|
11434
|
+
function BaseLayoutResizeHandle({
|
|
11435
|
+
orientation = "horizontal",
|
|
11436
|
+
resizable = false,
|
|
11437
|
+
disabled = false,
|
|
11438
|
+
size,
|
|
11439
|
+
minSize,
|
|
11440
|
+
maxSize,
|
|
11441
|
+
label = "Resize panels",
|
|
11442
|
+
appearance,
|
|
11443
|
+
className,
|
|
11444
|
+
classNames,
|
|
11445
|
+
style,
|
|
11446
|
+
tabIndex,
|
|
11447
|
+
...handleProps
|
|
11448
|
+
}) {
|
|
11449
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11450
|
+
const interactive = resizable && !disabled;
|
|
11451
|
+
const separatorOrientation = getSeparatorOrientation(orientation);
|
|
11452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11453
|
+
"div",
|
|
11454
|
+
{
|
|
11455
|
+
...handleProps,
|
|
11456
|
+
role: interactive ? "separator" : void 0,
|
|
11457
|
+
"aria-label": interactive ? label : void 0,
|
|
11458
|
+
"aria-orientation": interactive ? separatorOrientation : void 0,
|
|
11459
|
+
"aria-valuemin": interactive ? minSize : void 0,
|
|
11460
|
+
"aria-valuemax": interactive ? maxSize : void 0,
|
|
11461
|
+
"aria-valuenow": interactive ? size : void 0,
|
|
11462
|
+
"aria-disabled": interactive ? void 0 : true,
|
|
11463
|
+
tabIndex: interactive ? tabIndex ?? 0 : void 0,
|
|
11464
|
+
className: cn(
|
|
11465
|
+
theme.slots.layoutResizeHandle,
|
|
11466
|
+
orientation === "horizontal" ? theme.slots.layoutResizeHandleHorizontal : theme.slots.layoutResizeHandleVertical,
|
|
11467
|
+
!interactive && theme.slots.layoutResizeHandleDisabled,
|
|
11468
|
+
classNames?.root,
|
|
11469
|
+
className
|
|
11470
|
+
),
|
|
11471
|
+
style: {
|
|
11472
|
+
...theme.styles.layoutResizeHandle,
|
|
11473
|
+
...style
|
|
11474
|
+
},
|
|
11475
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11476
|
+
"span",
|
|
11477
|
+
{
|
|
11478
|
+
"aria-hidden": "true",
|
|
11479
|
+
className: cn(
|
|
11480
|
+
theme.slots.layoutResizeHandleIndicator,
|
|
11481
|
+
orientation === "horizontal" ? "h-8 w-px" : "h-px w-8",
|
|
11482
|
+
classNames?.indicator
|
|
11483
|
+
)
|
|
11484
|
+
}
|
|
11485
|
+
)
|
|
11486
|
+
}
|
|
11487
|
+
);
|
|
11488
|
+
}
|
|
11489
|
+
function BaseLayoutSplit({
|
|
11490
|
+
orientation = "horizontal",
|
|
11491
|
+
primary,
|
|
11492
|
+
secondary,
|
|
11493
|
+
children,
|
|
11494
|
+
resizable = false,
|
|
11495
|
+
size,
|
|
11496
|
+
defaultSize,
|
|
11497
|
+
minSize,
|
|
11498
|
+
maxSize,
|
|
11499
|
+
gap,
|
|
11500
|
+
keyboardStep,
|
|
11501
|
+
resizeLabel,
|
|
11502
|
+
appearance,
|
|
11503
|
+
className,
|
|
11504
|
+
classNames,
|
|
11505
|
+
style,
|
|
11506
|
+
onSizeChange,
|
|
11507
|
+
...splitProps
|
|
11508
|
+
}) {
|
|
11509
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11510
|
+
const bounds = resolveSplitBounds({ minSize, maxSize, keyboardStep });
|
|
11511
|
+
const initialSize = resolveSplitSize(
|
|
11512
|
+
"defaultSize",
|
|
11513
|
+
defaultSize,
|
|
11514
|
+
DEFAULT_SPLIT_SIZE,
|
|
11515
|
+
bounds.min,
|
|
11516
|
+
bounds.max
|
|
11517
|
+
);
|
|
11518
|
+
const [uncontrolledSize, setUncontrolledSize] = React.useState(initialSize);
|
|
11519
|
+
const rootRef = React.useRef(null);
|
|
11520
|
+
const cleanupRef = React.useRef(null);
|
|
11521
|
+
const controlled = size !== void 0;
|
|
11522
|
+
const renderedSize = resolveSplitSize(
|
|
11523
|
+
"size",
|
|
11524
|
+
controlled ? size : uncontrolledSize,
|
|
11525
|
+
initialSize,
|
|
11526
|
+
bounds.min,
|
|
11527
|
+
bounds.max
|
|
11528
|
+
);
|
|
11529
|
+
const commitSize = React.useCallback(
|
|
11530
|
+
(nextSize) => {
|
|
11531
|
+
const clampedSize = clamp(nextSize, bounds.min, bounds.max);
|
|
11532
|
+
if (!controlled) {
|
|
11533
|
+
setUncontrolledSize(clampedSize);
|
|
11534
|
+
}
|
|
11535
|
+
onSizeChange?.(clampedSize);
|
|
11536
|
+
},
|
|
11537
|
+
[bounds.max, bounds.min, controlled, onSizeChange]
|
|
11538
|
+
);
|
|
11539
|
+
const updateFromPointer = React.useCallback(
|
|
11540
|
+
(event) => {
|
|
11541
|
+
const root = rootRef.current;
|
|
11542
|
+
if (!root) return;
|
|
11543
|
+
const rect = root.getBoundingClientRect();
|
|
11544
|
+
const total = orientation === "horizontal" ? rect.width : rect.height;
|
|
11545
|
+
if (total <= 0) return;
|
|
11546
|
+
const offset = orientation === "horizontal" ? event.clientX - rect.left : event.clientY - rect.top;
|
|
11547
|
+
commitSize(offset / total * 100);
|
|
11548
|
+
},
|
|
11549
|
+
[commitSize, orientation]
|
|
11550
|
+
);
|
|
11551
|
+
const stopResize = React.useCallback(() => {
|
|
11552
|
+
cleanupRef.current?.();
|
|
11553
|
+
cleanupRef.current = null;
|
|
11554
|
+
}, []);
|
|
11555
|
+
React.useEffect(() => stopResize, [stopResize]);
|
|
11556
|
+
const handlePointerDown = (event) => {
|
|
11557
|
+
if (!resizable) return;
|
|
11558
|
+
event.preventDefault();
|
|
11559
|
+
stopResize();
|
|
11560
|
+
updateFromPointer(event);
|
|
11561
|
+
const handleMove = (nextEvent) => {
|
|
11562
|
+
updateFromPointer(nextEvent);
|
|
11563
|
+
};
|
|
11564
|
+
const handleStop = () => {
|
|
11565
|
+
stopResize();
|
|
11566
|
+
};
|
|
11567
|
+
window.addEventListener("pointermove", handleMove);
|
|
11568
|
+
window.addEventListener("pointerup", handleStop, { once: true });
|
|
11569
|
+
window.addEventListener("pointercancel", handleStop, { once: true });
|
|
11570
|
+
cleanupRef.current = () => {
|
|
11571
|
+
window.removeEventListener("pointermove", handleMove);
|
|
11572
|
+
window.removeEventListener("pointerup", handleStop);
|
|
11573
|
+
window.removeEventListener("pointercancel", handleStop);
|
|
11574
|
+
};
|
|
11575
|
+
};
|
|
11576
|
+
const handleKeyDown = (event) => {
|
|
11577
|
+
if (!resizable) return;
|
|
11578
|
+
const step = event.shiftKey ? bounds.keyboardStep * 4 : bounds.keyboardStep;
|
|
11579
|
+
let nextSize;
|
|
11580
|
+
if (event.key === "Home") nextSize = bounds.min;
|
|
11581
|
+
if (event.key === "End") nextSize = bounds.max;
|
|
11582
|
+
if (orientation === "horizontal" && event.key === "ArrowLeft") {
|
|
11583
|
+
nextSize = renderedSize - step;
|
|
11584
|
+
}
|
|
11585
|
+
if (orientation === "horizontal" && event.key === "ArrowRight") {
|
|
11586
|
+
nextSize = renderedSize + step;
|
|
11587
|
+
}
|
|
11588
|
+
if (orientation === "vertical" && event.key === "ArrowUp") {
|
|
11589
|
+
nextSize = renderedSize - step;
|
|
11590
|
+
}
|
|
11591
|
+
if (orientation === "vertical" && event.key === "ArrowDown") {
|
|
11592
|
+
nextSize = renderedSize + step;
|
|
11593
|
+
}
|
|
11594
|
+
if (nextSize === void 0) return;
|
|
11595
|
+
event.preventDefault();
|
|
11596
|
+
commitSize(nextSize);
|
|
11597
|
+
};
|
|
11598
|
+
const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
|
|
11599
|
+
const resizeTrack = resolvedGap !== void 0 ? "var(--base-layout-split-gap)" : "auto";
|
|
11600
|
+
const resizeHandleStyle = resolvedGap !== void 0 ? orientation === "horizontal" ? { width: "var(--base-layout-split-gap)" } : { height: "var(--base-layout-split-gap)" } : void 0;
|
|
11601
|
+
const splitStyle = {
|
|
11602
|
+
...theme.styles.layoutSplit,
|
|
11603
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: resizable ? `${renderedSize}% ${resizeTrack} minmax(0, 1fr)` : `${renderedSize}% minmax(0, 1fr)`,
|
|
11604
|
+
...resizable ? { gap: 0 } : {},
|
|
11605
|
+
...resolvedGap !== void 0 ? {
|
|
11606
|
+
"--base-layout-split-gap": resolvedGap,
|
|
11607
|
+
...resizable ? {} : { gap: resolvedGap }
|
|
11608
|
+
} : {},
|
|
11609
|
+
...style
|
|
11610
|
+
};
|
|
11611
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11612
|
+
"div",
|
|
11613
|
+
{
|
|
11614
|
+
...splitProps,
|
|
11615
|
+
ref: rootRef,
|
|
11616
|
+
className: cn(
|
|
11617
|
+
theme.slots.layoutSplitRoot,
|
|
11618
|
+
orientation === "horizontal" ? theme.slots.layoutSplitHorizontal : theme.slots.layoutSplitVertical,
|
|
11619
|
+
classNames?.root,
|
|
11620
|
+
className
|
|
11621
|
+
),
|
|
11622
|
+
style: splitStyle,
|
|
11623
|
+
children: [
|
|
11624
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11625
|
+
"div",
|
|
11626
|
+
{
|
|
11627
|
+
className: cn(
|
|
11628
|
+
theme.slots.layoutSplitPane,
|
|
11629
|
+
theme.slots.layoutSplitPrimary,
|
|
11630
|
+
classNames?.primary
|
|
11631
|
+
),
|
|
11632
|
+
style: theme.styles.layoutSplitPane,
|
|
11633
|
+
children: hasRenderableNode(primary) ? primary : children
|
|
11634
|
+
}
|
|
11635
|
+
),
|
|
11636
|
+
resizable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11637
|
+
BaseLayoutResizeHandle,
|
|
11638
|
+
{
|
|
11639
|
+
orientation,
|
|
11640
|
+
resizable: true,
|
|
11641
|
+
size: renderedSize,
|
|
11642
|
+
minSize: bounds.min,
|
|
11643
|
+
maxSize: bounds.max,
|
|
11644
|
+
label: resizeLabel,
|
|
11645
|
+
appearance,
|
|
11646
|
+
className: classNames?.handle,
|
|
11647
|
+
style: resizeHandleStyle,
|
|
11648
|
+
onPointerDown: handlePointerDown,
|
|
11649
|
+
onKeyDown: handleKeyDown
|
|
11650
|
+
}
|
|
11651
|
+
) : null,
|
|
11652
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11653
|
+
"div",
|
|
11654
|
+
{
|
|
11655
|
+
className: cn(
|
|
11656
|
+
theme.slots.layoutSplitPane,
|
|
11657
|
+
theme.slots.layoutSplitSecondary,
|
|
11658
|
+
classNames?.secondary
|
|
11659
|
+
),
|
|
11660
|
+
style: theme.styles.layoutSplitPane,
|
|
11661
|
+
children: secondary
|
|
11662
|
+
}
|
|
11663
|
+
)
|
|
11664
|
+
]
|
|
11665
|
+
}
|
|
11666
|
+
);
|
|
11667
|
+
}
|
|
11160
11668
|
function DefaultLoadingIcon({ className }) {
|
|
11161
11669
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11162
11670
|
"svg",
|
|
@@ -11234,67 +11742,509 @@ function BaseLoadingState({
|
|
|
11234
11742
|
}
|
|
11235
11743
|
);
|
|
11236
11744
|
}
|
|
11237
|
-
function
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
|
|
11254
|
-
{
|
|
11255
|
-
...noticeProps,
|
|
11256
|
-
className: cn(
|
|
11257
|
-
theme.slots.noticeBase,
|
|
11258
|
-
getBaseNoticeToneClassName(theme, tone),
|
|
11259
|
-
classNames?.root,
|
|
11260
|
-
className
|
|
11261
|
-
),
|
|
11262
|
-
style: {
|
|
11263
|
-
...theme.styles.notice,
|
|
11264
|
-
...style
|
|
11265
|
-
},
|
|
11266
|
-
children: [
|
|
11267
|
-
hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(theme.slots.noticeIcon, classNames?.icon), children: icon }) : null,
|
|
11268
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
11269
|
-
hasRenderableNode(title) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(theme.slots.noticeTitle, classNames?.title), children: title }) : null,
|
|
11270
|
-
hasRenderableNode(resolvedDescription) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11271
|
-
"div",
|
|
11272
|
-
{
|
|
11273
|
-
className: cn(
|
|
11274
|
-
theme.slots.noticeDescription,
|
|
11275
|
-
classNames?.description
|
|
11276
|
-
),
|
|
11277
|
-
children: resolvedDescription
|
|
11278
|
-
}
|
|
11279
|
-
) : null,
|
|
11280
|
-
hasRenderableNode(actions) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(theme.slots.noticeActions, classNames?.actions), children: actions }) : null
|
|
11281
|
-
] })
|
|
11282
|
-
]
|
|
11745
|
+
function normalizeValues(values) {
|
|
11746
|
+
const nextValues = [];
|
|
11747
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11748
|
+
values?.forEach((value) => {
|
|
11749
|
+
if (seen.has(value)) return;
|
|
11750
|
+
seen.add(value);
|
|
11751
|
+
nextValues.push(value);
|
|
11752
|
+
});
|
|
11753
|
+
return nextValues;
|
|
11754
|
+
}
|
|
11755
|
+
function getNextEnabledIndex(options, currentIndex, direction) {
|
|
11756
|
+
if (!options.length) return -1;
|
|
11757
|
+
const startIndex = currentIndex >= 0 ? currentIndex : 0;
|
|
11758
|
+
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
11759
|
+
const nextIndex = (startIndex + offset * direction + options.length) % options.length;
|
|
11760
|
+
if (!options[nextIndex]?.disabled) {
|
|
11761
|
+
return nextIndex;
|
|
11283
11762
|
}
|
|
11284
|
-
|
|
11763
|
+
}
|
|
11764
|
+
return -1;
|
|
11285
11765
|
}
|
|
11286
|
-
function
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11766
|
+
function getFirstEnabledIndex(options) {
|
|
11767
|
+
return options.findIndex((option) => !option.disabled);
|
|
11768
|
+
}
|
|
11769
|
+
function getSafeTagCount(maxTagCount, total) {
|
|
11770
|
+
if (maxTagCount === void 0) return total;
|
|
11771
|
+
if (!Number.isFinite(maxTagCount)) return total;
|
|
11772
|
+
return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
|
|
11773
|
+
}
|
|
11774
|
+
function getDefaultRemoveLabel(option) {
|
|
11775
|
+
return `Remove ${option.value}`;
|
|
11776
|
+
}
|
|
11777
|
+
var BaseMultiSelect = React.forwardRef(
|
|
11778
|
+
function BaseMultiSelect2({
|
|
11779
|
+
options,
|
|
11780
|
+
value,
|
|
11781
|
+
defaultValue,
|
|
11782
|
+
name,
|
|
11783
|
+
placeholder = "Select options",
|
|
11784
|
+
icon,
|
|
11785
|
+
invalid = false,
|
|
11786
|
+
disabled = false,
|
|
11787
|
+
required = false,
|
|
11788
|
+
openForPreview = false,
|
|
11789
|
+
maxTagCount,
|
|
11790
|
+
removeLabel = getDefaultRemoveLabel,
|
|
11791
|
+
emptyLabel = "No options",
|
|
11792
|
+
appearance,
|
|
11793
|
+
className,
|
|
11794
|
+
classNames,
|
|
11795
|
+
style,
|
|
11796
|
+
id,
|
|
11797
|
+
"aria-invalid": nativeAriaInvalid,
|
|
11798
|
+
"aria-label": nativeAriaLabel,
|
|
11799
|
+
"aria-labelledby": nativeAriaLabelledBy,
|
|
11800
|
+
onValueChange,
|
|
11801
|
+
...rootProps
|
|
11802
|
+
}, ref) {
|
|
11803
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11804
|
+
const generatedId = React.useId();
|
|
11805
|
+
const multiSelectId = id ?? generatedId;
|
|
11806
|
+
const controlId = `${multiSelectId}-control`;
|
|
11807
|
+
const listboxId = `${multiSelectId}-listbox`;
|
|
11808
|
+
const rootRef = React.useRef(null);
|
|
11809
|
+
const optionList = options ?? [];
|
|
11810
|
+
const forceOpen = openForPreview;
|
|
11811
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
|
|
11812
|
+
const open = forceOpen || uncontrolledOpen;
|
|
11813
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(
|
|
11814
|
+
() => normalizeValues(defaultValue)
|
|
11815
|
+
);
|
|
11816
|
+
const [activeIndex, setActiveIndex] = React.useState(
|
|
11817
|
+
() => getFirstEnabledIndex(optionList)
|
|
11818
|
+
);
|
|
11819
|
+
const isControlled = value !== void 0;
|
|
11820
|
+
const selectedValues = React.useMemo(
|
|
11821
|
+
() => normalizeValues(isControlled ? value : uncontrolledValue),
|
|
11822
|
+
[isControlled, uncontrolledValue, value]
|
|
11823
|
+
);
|
|
11824
|
+
const selectedValueSet = React.useMemo(
|
|
11825
|
+
() => new Set(selectedValues),
|
|
11826
|
+
[selectedValues]
|
|
11827
|
+
);
|
|
11828
|
+
const optionByValue = React.useMemo(() => {
|
|
11829
|
+
const map = /* @__PURE__ */ new Map();
|
|
11830
|
+
optionList.forEach((option) => {
|
|
11831
|
+
if (!map.has(option.value)) {
|
|
11832
|
+
map.set(option.value, option);
|
|
11833
|
+
}
|
|
11834
|
+
});
|
|
11835
|
+
return map;
|
|
11836
|
+
}, [optionList]);
|
|
11837
|
+
const selectedOptions = React.useMemo(
|
|
11838
|
+
() => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
|
|
11839
|
+
(option) => option !== void 0
|
|
11840
|
+
),
|
|
11841
|
+
[optionByValue, selectedValues]
|
|
11842
|
+
);
|
|
11843
|
+
const firstEnabledIndex = React.useMemo(
|
|
11844
|
+
() => getFirstEnabledIndex(optionList),
|
|
11845
|
+
[optionList]
|
|
11846
|
+
);
|
|
11847
|
+
const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
|
|
11848
|
+
const visibleTagCount = getSafeTagCount(
|
|
11849
|
+
maxTagCount,
|
|
11850
|
+
selectedOptions.length
|
|
11851
|
+
);
|
|
11852
|
+
const visibleOptions = selectedOptions.slice(0, visibleTagCount);
|
|
11853
|
+
const overflowCount = selectedOptions.length - visibleOptions.length;
|
|
11854
|
+
const isPlaceholder = selectedOptions.length === 0;
|
|
11855
|
+
const setRootRef = (node) => {
|
|
11856
|
+
rootRef.current = node;
|
|
11857
|
+
if (typeof ref === "function") {
|
|
11858
|
+
ref(node);
|
|
11859
|
+
} else if (ref) {
|
|
11860
|
+
ref.current = node;
|
|
11861
|
+
}
|
|
11862
|
+
};
|
|
11863
|
+
const setOpen = (nextOpen) => {
|
|
11864
|
+
if (disabled || forceOpen) return;
|
|
11865
|
+
setUncontrolledOpen(nextOpen);
|
|
11866
|
+
if (nextOpen) {
|
|
11867
|
+
setActiveIndex(resolvedActiveIndex);
|
|
11868
|
+
}
|
|
11869
|
+
};
|
|
11870
|
+
React.useEffect(() => {
|
|
11871
|
+
if (!open || forceOpen) return void 0;
|
|
11872
|
+
const handlePointerDown = (event) => {
|
|
11873
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
11874
|
+
setUncontrolledOpen(false);
|
|
11875
|
+
}
|
|
11876
|
+
};
|
|
11877
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
11878
|
+
return () => {
|
|
11879
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
11880
|
+
};
|
|
11881
|
+
}, [forceOpen, open]);
|
|
11882
|
+
React.useEffect(() => {
|
|
11883
|
+
if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
|
|
11884
|
+
setActiveIndex(resolvedActiveIndex);
|
|
11885
|
+
}
|
|
11886
|
+
}, [activeIndex, resolvedActiveIndex]);
|
|
11887
|
+
const commitValues = (nextValues) => {
|
|
11888
|
+
const normalizedValues = normalizeValues(nextValues);
|
|
11889
|
+
if (!isControlled) {
|
|
11890
|
+
setUncontrolledValue(normalizedValues);
|
|
11891
|
+
}
|
|
11892
|
+
onValueChange?.(normalizedValues);
|
|
11893
|
+
};
|
|
11894
|
+
const toggleOption = (option) => {
|
|
11895
|
+
if (!option || option.disabled || disabled) return;
|
|
11896
|
+
const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
|
|
11897
|
+
commitValues(nextValues);
|
|
11898
|
+
};
|
|
11899
|
+
const removeOption = (option) => {
|
|
11900
|
+
if (disabled) return;
|
|
11901
|
+
commitValues(
|
|
11902
|
+
selectedValues.filter((selectedValue) => selectedValue !== option.value)
|
|
11903
|
+
);
|
|
11904
|
+
};
|
|
11905
|
+
const focusOption = (direction) => {
|
|
11906
|
+
const nextIndex = getNextEnabledIndex(
|
|
11907
|
+
optionList,
|
|
11908
|
+
resolvedActiveIndex,
|
|
11909
|
+
direction
|
|
11910
|
+
);
|
|
11911
|
+
if (nextIndex >= 0) {
|
|
11912
|
+
setActiveIndex(nextIndex);
|
|
11913
|
+
}
|
|
11914
|
+
};
|
|
11915
|
+
const handleKeyDown = (event) => {
|
|
11916
|
+
if (disabled) return;
|
|
11917
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
11918
|
+
event.preventDefault();
|
|
11919
|
+
if (!open) {
|
|
11920
|
+
setOpen(true);
|
|
11921
|
+
setActiveIndex(firstEnabledIndex);
|
|
11922
|
+
return;
|
|
11923
|
+
}
|
|
11924
|
+
focusOption(event.key === "ArrowDown" ? 1 : -1);
|
|
11925
|
+
return;
|
|
11926
|
+
}
|
|
11927
|
+
if (event.key === "Home") {
|
|
11928
|
+
event.preventDefault();
|
|
11929
|
+
setOpen(true);
|
|
11930
|
+
setActiveIndex(firstEnabledIndex);
|
|
11931
|
+
return;
|
|
11932
|
+
}
|
|
11933
|
+
if (event.key === "End") {
|
|
11934
|
+
event.preventDefault();
|
|
11935
|
+
setOpen(true);
|
|
11936
|
+
for (let index = optionList.length - 1; index >= 0; index -= 1) {
|
|
11937
|
+
if (!optionList[index]?.disabled) {
|
|
11938
|
+
setActiveIndex(index);
|
|
11939
|
+
break;
|
|
11940
|
+
}
|
|
11941
|
+
}
|
|
11942
|
+
return;
|
|
11943
|
+
}
|
|
11944
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
11945
|
+
event.preventDefault();
|
|
11946
|
+
if (!open) {
|
|
11947
|
+
setOpen(true);
|
|
11948
|
+
return;
|
|
11949
|
+
}
|
|
11950
|
+
toggleOption(optionList[resolvedActiveIndex]);
|
|
11951
|
+
return;
|
|
11952
|
+
}
|
|
11953
|
+
if (event.key === "Escape") {
|
|
11954
|
+
setOpen(false);
|
|
11955
|
+
}
|
|
11956
|
+
};
|
|
11957
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11958
|
+
"div",
|
|
11959
|
+
{
|
|
11960
|
+
...rootProps,
|
|
11961
|
+
id,
|
|
11962
|
+
ref: setRootRef,
|
|
11963
|
+
className: cn(
|
|
11964
|
+
theme.slots.controlWrapper,
|
|
11965
|
+
"overflow-visible",
|
|
11966
|
+
open && "z-50",
|
|
11967
|
+
invalid && theme.slots.controlInvalid,
|
|
11968
|
+
disabled && theme.slots.controlDisabled,
|
|
11969
|
+
classNames?.root,
|
|
11970
|
+
className
|
|
11971
|
+
),
|
|
11972
|
+
style: {
|
|
11973
|
+
...theme.styles.control,
|
|
11974
|
+
...invalid ? theme.styles.controlInvalid : void 0,
|
|
11975
|
+
...disabled ? theme.styles.controlDisabled : void 0,
|
|
11976
|
+
...style
|
|
11977
|
+
},
|
|
11978
|
+
children: [
|
|
11979
|
+
hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
|
|
11980
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11981
|
+
"div",
|
|
11982
|
+
{
|
|
11983
|
+
id: controlId,
|
|
11984
|
+
role: "combobox",
|
|
11985
|
+
tabIndex: disabled ? -1 : 0,
|
|
11986
|
+
"aria-haspopup": "listbox",
|
|
11987
|
+
"aria-expanded": open,
|
|
11988
|
+
"aria-controls": listboxId,
|
|
11989
|
+
"aria-disabled": disabled || void 0,
|
|
11990
|
+
"aria-required": required || void 0,
|
|
11991
|
+
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
11992
|
+
"aria-label": nativeAriaLabel,
|
|
11993
|
+
"aria-labelledby": nativeAriaLabelledBy,
|
|
11994
|
+
className: cn(
|
|
11995
|
+
theme.slots.controlBase,
|
|
11996
|
+
"flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
|
|
11997
|
+
disabled && "!cursor-not-allowed",
|
|
11998
|
+
classNames?.control
|
|
11999
|
+
),
|
|
12000
|
+
onClick: () => setOpen(!open),
|
|
12001
|
+
onKeyDown: handleKeyDown,
|
|
12002
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12003
|
+
"span",
|
|
12004
|
+
{
|
|
12005
|
+
className: cn(
|
|
12006
|
+
"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
|
|
12007
|
+
classNames?.tagList
|
|
12008
|
+
),
|
|
12009
|
+
children: [
|
|
12010
|
+
visibleOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12011
|
+
"span",
|
|
12012
|
+
{
|
|
12013
|
+
className: cn(
|
|
12014
|
+
"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",
|
|
12015
|
+
classNames?.tag
|
|
12016
|
+
),
|
|
12017
|
+
children: [
|
|
12018
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12019
|
+
"span",
|
|
12020
|
+
{
|
|
12021
|
+
className: cn(
|
|
12022
|
+
"max-w-40 truncate",
|
|
12023
|
+
classNames?.tagLabel
|
|
12024
|
+
),
|
|
12025
|
+
children: option.label
|
|
12026
|
+
}
|
|
12027
|
+
),
|
|
12028
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12029
|
+
"button",
|
|
12030
|
+
{
|
|
12031
|
+
type: "button",
|
|
12032
|
+
"aria-label": removeLabel(option),
|
|
12033
|
+
disabled,
|
|
12034
|
+
className: cn(
|
|
12035
|
+
"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",
|
|
12036
|
+
classNames?.tagRemove
|
|
12037
|
+
),
|
|
12038
|
+
onClick: (event) => {
|
|
12039
|
+
event.preventDefault();
|
|
12040
|
+
event.stopPropagation();
|
|
12041
|
+
removeOption(option);
|
|
12042
|
+
},
|
|
12043
|
+
onMouseDown: (event) => {
|
|
12044
|
+
event.preventDefault();
|
|
12045
|
+
event.stopPropagation();
|
|
12046
|
+
},
|
|
12047
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
12048
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "x" })
|
|
12049
|
+
}
|
|
12050
|
+
)
|
|
12051
|
+
]
|
|
12052
|
+
},
|
|
12053
|
+
option.value
|
|
12054
|
+
)),
|
|
12055
|
+
overflowCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12056
|
+
"span",
|
|
12057
|
+
{
|
|
12058
|
+
className: cn(
|
|
12059
|
+
"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",
|
|
12060
|
+
classNames?.tag
|
|
12061
|
+
),
|
|
12062
|
+
children: [
|
|
12063
|
+
"+",
|
|
12064
|
+
overflowCount
|
|
12065
|
+
]
|
|
12066
|
+
}
|
|
12067
|
+
) : null,
|
|
12068
|
+
isPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12069
|
+
"span",
|
|
12070
|
+
{
|
|
12071
|
+
className: cn(
|
|
12072
|
+
"min-w-0 truncate",
|
|
12073
|
+
theme.slots.selectPlaceholder,
|
|
12074
|
+
classNames?.placeholder
|
|
12075
|
+
),
|
|
12076
|
+
children: placeholder
|
|
12077
|
+
}
|
|
12078
|
+
) : null
|
|
12079
|
+
]
|
|
12080
|
+
}
|
|
12081
|
+
)
|
|
12082
|
+
}
|
|
12083
|
+
),
|
|
12084
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12085
|
+
"span",
|
|
12086
|
+
{
|
|
12087
|
+
className: cn(
|
|
12088
|
+
theme.slots.selectChevron,
|
|
12089
|
+
open && "rotate-[225deg]",
|
|
12090
|
+
classNames?.chevron
|
|
12091
|
+
)
|
|
12092
|
+
}
|
|
12093
|
+
),
|
|
12094
|
+
name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12095
|
+
"input",
|
|
12096
|
+
{
|
|
12097
|
+
type: "hidden",
|
|
12098
|
+
name,
|
|
12099
|
+
value: selectedValue,
|
|
12100
|
+
className: classNames?.hiddenInput
|
|
12101
|
+
},
|
|
12102
|
+
selectedValue
|
|
12103
|
+
)) : null,
|
|
12104
|
+
open ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12105
|
+
"div",
|
|
12106
|
+
{
|
|
12107
|
+
id: listboxId,
|
|
12108
|
+
role: "listbox",
|
|
12109
|
+
"aria-multiselectable": "true",
|
|
12110
|
+
"aria-labelledby": controlId,
|
|
12111
|
+
className: cn(theme.slots.selectMenu, classNames?.menu),
|
|
12112
|
+
style: theme.styles.selectMenu,
|
|
12113
|
+
children: optionList.length > 0 ? optionList.map((option, index) => {
|
|
12114
|
+
const selected = selectedValueSet.has(option.value);
|
|
12115
|
+
const active = index === resolvedActiveIndex;
|
|
12116
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12117
|
+
"button",
|
|
12118
|
+
{
|
|
12119
|
+
type: "button",
|
|
12120
|
+
role: "option",
|
|
12121
|
+
"aria-selected": selected,
|
|
12122
|
+
disabled: option.disabled,
|
|
12123
|
+
className: cn(
|
|
12124
|
+
theme.slots.selectOption,
|
|
12125
|
+
"gap-2",
|
|
12126
|
+
active && theme.slots.selectOptionActive,
|
|
12127
|
+
selected && theme.slots.selectOptionSelected,
|
|
12128
|
+
option.disabled && theme.slots.selectOptionDisabled,
|
|
12129
|
+
classNames?.option
|
|
12130
|
+
),
|
|
12131
|
+
style: {
|
|
12132
|
+
...theme.styles.selectOption,
|
|
12133
|
+
...active ? theme.styles.selectOptionActive : void 0,
|
|
12134
|
+
...selected ? theme.styles.selectOptionSelected : void 0
|
|
12135
|
+
},
|
|
12136
|
+
onMouseEnter: () => {
|
|
12137
|
+
if (!option.disabled) {
|
|
12138
|
+
setActiveIndex(index);
|
|
12139
|
+
}
|
|
12140
|
+
},
|
|
12141
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
12142
|
+
onClick: () => toggleOption(option),
|
|
12143
|
+
children: [
|
|
12144
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12145
|
+
"span",
|
|
12146
|
+
{
|
|
12147
|
+
"aria-hidden": "true",
|
|
12148
|
+
className: cn(
|
|
12149
|
+
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
|
|
12150
|
+
selected && "border-primary/40 bg-primary text-primary-foreground",
|
|
12151
|
+
classNames?.optionIndicator
|
|
12152
|
+
),
|
|
12153
|
+
children: selected ? "\u2713" : null
|
|
12154
|
+
}
|
|
12155
|
+
),
|
|
12156
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12157
|
+
"span",
|
|
12158
|
+
{
|
|
12159
|
+
className: cn(
|
|
12160
|
+
"min-w-0 flex-1 truncate",
|
|
12161
|
+
classNames?.optionLabel
|
|
12162
|
+
),
|
|
12163
|
+
children: option.label
|
|
12164
|
+
}
|
|
12165
|
+
)
|
|
12166
|
+
]
|
|
12167
|
+
},
|
|
12168
|
+
option.value
|
|
12169
|
+
);
|
|
12170
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
12171
|
+
"div",
|
|
12172
|
+
{
|
|
12173
|
+
className: cn(
|
|
12174
|
+
"px-2.5 py-2 text-sm text-muted-foreground",
|
|
12175
|
+
classNames?.empty
|
|
12176
|
+
),
|
|
12177
|
+
children: emptyLabel
|
|
12178
|
+
}
|
|
12179
|
+
)
|
|
12180
|
+
}
|
|
12181
|
+
) : null
|
|
12182
|
+
]
|
|
12183
|
+
}
|
|
12184
|
+
);
|
|
12185
|
+
}
|
|
12186
|
+
);
|
|
12187
|
+
function BaseNotice({
|
|
12188
|
+
tone,
|
|
12189
|
+
icon,
|
|
12190
|
+
title,
|
|
12191
|
+
description,
|
|
12192
|
+
actions,
|
|
12193
|
+
children,
|
|
12194
|
+
appearance,
|
|
12195
|
+
className,
|
|
12196
|
+
classNames,
|
|
12197
|
+
style,
|
|
12198
|
+
...noticeProps
|
|
12199
|
+
}) {
|
|
12200
|
+
const theme = resolveBaseAppearance(appearance);
|
|
12201
|
+
const resolvedDescription = children ?? description;
|
|
12202
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12203
|
+
"div",
|
|
12204
|
+
{
|
|
12205
|
+
...noticeProps,
|
|
12206
|
+
className: cn(
|
|
12207
|
+
theme.slots.noticeBase,
|
|
12208
|
+
getBaseNoticeToneClassName(theme, tone),
|
|
12209
|
+
classNames?.root,
|
|
12210
|
+
className
|
|
12211
|
+
),
|
|
12212
|
+
style: {
|
|
12213
|
+
...theme.styles.notice,
|
|
12214
|
+
...style
|
|
12215
|
+
},
|
|
12216
|
+
children: [
|
|
12217
|
+
hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(theme.slots.noticeIcon, classNames?.icon), children: icon }) : null,
|
|
12218
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
12219
|
+
hasRenderableNode(title) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(theme.slots.noticeTitle, classNames?.title), children: title }) : null,
|
|
12220
|
+
hasRenderableNode(resolvedDescription) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12221
|
+
"div",
|
|
12222
|
+
{
|
|
12223
|
+
className: cn(
|
|
12224
|
+
theme.slots.noticeDescription,
|
|
12225
|
+
classNames?.description
|
|
12226
|
+
),
|
|
12227
|
+
children: resolvedDescription
|
|
12228
|
+
}
|
|
12229
|
+
) : null,
|
|
12230
|
+
hasRenderableNode(actions) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(theme.slots.noticeActions, classNames?.actions), children: actions }) : null
|
|
12231
|
+
] })
|
|
12232
|
+
]
|
|
12233
|
+
}
|
|
12234
|
+
);
|
|
12235
|
+
}
|
|
12236
|
+
function BasePanel({
|
|
12237
|
+
as = "article",
|
|
12238
|
+
title,
|
|
12239
|
+
description,
|
|
12240
|
+
media,
|
|
12241
|
+
header,
|
|
12242
|
+
footer,
|
|
12243
|
+
children,
|
|
12244
|
+
interactive,
|
|
12245
|
+
selected,
|
|
12246
|
+
disabled,
|
|
12247
|
+
appearance,
|
|
11298
12248
|
className,
|
|
11299
12249
|
classNames,
|
|
11300
12250
|
style,
|
|
@@ -11446,7 +12396,7 @@ function BasePagination({
|
|
|
11446
12396
|
function toFiniteNumber(value, fallback) {
|
|
11447
12397
|
return Number.isFinite(value) ? Number(value) : fallback;
|
|
11448
12398
|
}
|
|
11449
|
-
function
|
|
12399
|
+
function clamp2(value, min5, max5) {
|
|
11450
12400
|
return Math.min(Math.max(value, min5), max5);
|
|
11451
12401
|
}
|
|
11452
12402
|
function BaseProgress({
|
|
@@ -11464,7 +12414,7 @@ function BaseProgress({
|
|
|
11464
12414
|
}) {
|
|
11465
12415
|
const theme = resolveBaseAppearance(appearance);
|
|
11466
12416
|
const safeMax = Math.max(toFiniteNumber(max5, 100), 1);
|
|
11467
|
-
const safeValue =
|
|
12417
|
+
const safeValue = clamp2(toFiniteNumber(value, 0), 0, safeMax);
|
|
11468
12418
|
const percent = safeValue / safeMax * 100;
|
|
11469
12419
|
const renderedValue = valueFormatter?.(safeValue, safeMax) ?? `${Math.round(percent)}%`;
|
|
11470
12420
|
const hasLabelRow = hasRenderableNode(label) || showValue;
|
|
@@ -11635,7 +12585,7 @@ function getInitialValue2(options, defaultValue) {
|
|
|
11635
12585
|
}
|
|
11636
12586
|
return "";
|
|
11637
12587
|
}
|
|
11638
|
-
function
|
|
12588
|
+
function getNextEnabledIndex2(options, currentIndex, direction) {
|
|
11639
12589
|
if (!options.length) return -1;
|
|
11640
12590
|
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
11641
12591
|
const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
|
|
@@ -11737,7 +12687,7 @@ var BaseSelect = React.forwardRef(
|
|
|
11737
12687
|
};
|
|
11738
12688
|
const focusOption = (direction) => {
|
|
11739
12689
|
const currentIndex = activeIndex >= 0 ? activeIndex : 0;
|
|
11740
|
-
const nextIndex =
|
|
12690
|
+
const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
|
|
11741
12691
|
if (nextIndex >= 0) {
|
|
11742
12692
|
commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
|
|
11743
12693
|
}
|
|
@@ -12230,7 +13180,7 @@ function useBaseTableContext(appearance) {
|
|
|
12230
13180
|
}
|
|
12231
13181
|
};
|
|
12232
13182
|
}
|
|
12233
|
-
function
|
|
13183
|
+
function toCssSize2(value) {
|
|
12234
13184
|
if (value === void 0) return void 0;
|
|
12235
13185
|
return typeof value === "number" ? `${value}px` : value;
|
|
12236
13186
|
}
|
|
@@ -12443,7 +13393,7 @@ function BaseTableRow({
|
|
|
12443
13393
|
}
|
|
12444
13394
|
);
|
|
12445
13395
|
}
|
|
12446
|
-
|
|
13396
|
+
var BaseTableHead = React.forwardRef(function BaseTableHead2({
|
|
12447
13397
|
columnId,
|
|
12448
13398
|
align = "left",
|
|
12449
13399
|
icon,
|
|
@@ -12471,10 +13421,18 @@ function BaseTableHead({
|
|
|
12471
13421
|
onDragOver,
|
|
12472
13422
|
onDrop,
|
|
12473
13423
|
...headProps
|
|
12474
|
-
}) {
|
|
13424
|
+
}, forwardedRef) {
|
|
12475
13425
|
const tableContext = useBaseTableContext(appearance);
|
|
12476
13426
|
const { theme } = tableContext;
|
|
12477
13427
|
const headRef = React.useRef(null);
|
|
13428
|
+
const setHeadRef = (node) => {
|
|
13429
|
+
headRef.current = node;
|
|
13430
|
+
if (typeof forwardedRef === "function") {
|
|
13431
|
+
forwardedRef(node);
|
|
13432
|
+
} else if (forwardedRef) {
|
|
13433
|
+
forwardedRef.current = node;
|
|
13434
|
+
}
|
|
13435
|
+
};
|
|
12478
13436
|
const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
|
|
12479
13437
|
const canDrag = Boolean(
|
|
12480
13438
|
columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
|
|
@@ -12629,7 +13587,7 @@ function BaseTableHead({
|
|
|
12629
13587
|
"th",
|
|
12630
13588
|
{
|
|
12631
13589
|
...headProps,
|
|
12632
|
-
ref:
|
|
13590
|
+
ref: setHeadRef,
|
|
12633
13591
|
scope: headProps.scope ?? "col",
|
|
12634
13592
|
"aria-sort": ariaSort,
|
|
12635
13593
|
className: cn(
|
|
@@ -12641,9 +13599,9 @@ function BaseTableHead({
|
|
|
12641
13599
|
),
|
|
12642
13600
|
style: {
|
|
12643
13601
|
...theme.styles.tableHead,
|
|
12644
|
-
width:
|
|
12645
|
-
minWidth:
|
|
12646
|
-
maxWidth:
|
|
13602
|
+
width: toCssSize2(controlledWidth),
|
|
13603
|
+
minWidth: toCssSize2(minWidth),
|
|
13604
|
+
maxWidth: toCssSize2(maxWidth),
|
|
12647
13605
|
...style
|
|
12648
13606
|
},
|
|
12649
13607
|
onDragOver: handleDragOver,
|
|
@@ -12664,7 +13622,7 @@ function BaseTableHead({
|
|
|
12664
13622
|
]
|
|
12665
13623
|
}
|
|
12666
13624
|
);
|
|
12667
|
-
}
|
|
13625
|
+
});
|
|
12668
13626
|
function BaseTableCell({
|
|
12669
13627
|
align = "left",
|
|
12670
13628
|
appearance,
|
|
@@ -12792,7 +13750,7 @@ function BaseTableLoading({
|
|
|
12792
13750
|
classNames?.skeleton
|
|
12793
13751
|
),
|
|
12794
13752
|
style: {
|
|
12795
|
-
width:
|
|
13753
|
+
width: toCssSize2(columnWidths[columnIndex])
|
|
12796
13754
|
}
|
|
12797
13755
|
}
|
|
12798
13756
|
)
|
|
@@ -15807,7 +16765,7 @@ var DEFAULT_ZOOM_STEP = 1.18;
|
|
|
15807
16765
|
var DEFAULT_STAGE_PADDING = 16;
|
|
15808
16766
|
var MAX_SAFE_SCALE = 1e6;
|
|
15809
16767
|
var MIN_SAFE_SCALE = 1e-6;
|
|
15810
|
-
var
|
|
16768
|
+
var clamp3 = (value, min5, max5) => Math.min(max5, Math.max(min5, value));
|
|
15811
16769
|
var isNoDragTarget = (target) => target instanceof Element && Boolean(target.closest('[data-no-drag="true"]'));
|
|
15812
16770
|
function ResetIcon() {
|
|
15813
16771
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -15931,7 +16889,7 @@ function DataExplorerImagePreview({
|
|
|
15931
16889
|
availableWidth / size.width,
|
|
15932
16890
|
availableHeight / size.height
|
|
15933
16891
|
);
|
|
15934
|
-
const nextScale =
|
|
16892
|
+
const nextScale = clamp3(
|
|
15935
16893
|
fitScale,
|
|
15936
16894
|
normalizedMinScale,
|
|
15937
16895
|
normalizedMaxScale
|
|
@@ -15985,7 +16943,7 @@ function DataExplorerImagePreview({
|
|
|
15985
16943
|
if (!Number.isFinite(factor) || factor === 1) return;
|
|
15986
16944
|
if (!Number.isFinite(stageX) || !Number.isFinite(stageY)) return;
|
|
15987
16945
|
setView((current) => {
|
|
15988
|
-
const nextScale =
|
|
16946
|
+
const nextScale = clamp3(
|
|
15989
16947
|
current.scale * factor,
|
|
15990
16948
|
normalizedMinScale,
|
|
15991
16949
|
normalizedMaxScale
|
|
@@ -21326,7 +22284,7 @@ function getWorkbenchIconComponent(icon) {
|
|
|
21326
22284
|
if (!icon || !isWorkbenchIconComponent(icon)) return null;
|
|
21327
22285
|
return icon;
|
|
21328
22286
|
}
|
|
21329
|
-
function
|
|
22287
|
+
function toCssSize3(value) {
|
|
21330
22288
|
if (value === void 0) return void 0;
|
|
21331
22289
|
return typeof value === "number" ? `${value}px` : value;
|
|
21332
22290
|
}
|
|
@@ -21475,7 +22433,7 @@ function WorkbenchTableView({
|
|
|
21475
22433
|
"div",
|
|
21476
22434
|
{
|
|
21477
22435
|
className: cn("w-full overflow-auto", classNames?.scrollArea),
|
|
21478
|
-
style: { maxHeight:
|
|
22436
|
+
style: { maxHeight: toCssSize3(bodyMaxHeight) },
|
|
21479
22437
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21480
22438
|
BaseTable,
|
|
21481
22439
|
{
|
|
@@ -21510,117 +22468,770 @@ function WorkbenchTableView({
|
|
|
21510
22468
|
appearance,
|
|
21511
22469
|
columnId: column.key,
|
|
21512
22470
|
align: column.align,
|
|
21513
|
-
icon: renderColumnHeader ? void 0 : columnIcon,
|
|
22471
|
+
icon: renderColumnHeader ? void 0 : columnIcon,
|
|
22472
|
+
label: headerContent,
|
|
22473
|
+
description: renderColumnHeader ? void 0 : formatLabel(column.description, { column }),
|
|
22474
|
+
meta: renderColumnHeader ? void 0 : formatLabel(column.meta, { column }),
|
|
22475
|
+
actions: renderColumnHeader ? void 0 : column.actions,
|
|
22476
|
+
trailing: headerTrailing,
|
|
22477
|
+
sortable,
|
|
22478
|
+
sortDirection: column.sortDirection,
|
|
22479
|
+
sortLabel: column.sortLabel,
|
|
22480
|
+
onSort: handleSort,
|
|
22481
|
+
draggable: column.draggable,
|
|
22482
|
+
dragLabel: column.dragLabel,
|
|
22483
|
+
resizable: column.resizable,
|
|
22484
|
+
resizeLabel: column.resizeLabel,
|
|
22485
|
+
width: column.width,
|
|
22486
|
+
minWidth: typeof column.minWidth === "number" ? column.minWidth : void 0,
|
|
22487
|
+
maxWidth: typeof column.maxWidth === "number" ? column.maxWidth : void 0,
|
|
22488
|
+
className: cn(
|
|
22489
|
+
"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",
|
|
22490
|
+
stickyFirstColumn && columnIndex === 0 && "left-0 z-30 shadow-[1px_0_0_0_hsl(var(--border)/0.35)]",
|
|
22491
|
+
column.compactHeaderClassName,
|
|
22492
|
+
column.headerClassName,
|
|
22493
|
+
column.renderType === "icon" && "pl-3 pr-1",
|
|
22494
|
+
followsRecordIcon && "pl-2",
|
|
22495
|
+
classNames?.headerCell
|
|
22496
|
+
),
|
|
22497
|
+
style: {
|
|
22498
|
+
minWidth: typeof column.minWidth === "string" ? column.minWidth : void 0,
|
|
22499
|
+
maxWidth: typeof column.maxWidth === "string" ? column.maxWidth : void 0
|
|
22500
|
+
}
|
|
22501
|
+
},
|
|
22502
|
+
column.key
|
|
22503
|
+
);
|
|
22504
|
+
}) }) }),
|
|
22505
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseTableBody, { appearance, className: cn("divide-y divide-border/35 dark:divide-border/30", classNames?.body), children: rows.length ? rows.map((row, rowIndex) => {
|
|
22506
|
+
const key = getRowKey(row, rowIndex);
|
|
22507
|
+
const disabled = isDisabled(row, rowIndex);
|
|
22508
|
+
const selectionKey = getRowSelectionKey(row, rowIndex);
|
|
22509
|
+
const selected = Boolean(resolvedSelectedKey && String(selectionKey) === String(resolvedSelectedKey));
|
|
22510
|
+
const resolvedRowClassName = typeof rowClassName === "function" ? rowClassName(row, rowIndex) : rowClassName;
|
|
22511
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22512
|
+
BaseTableRow,
|
|
22513
|
+
{
|
|
22514
|
+
appearance,
|
|
22515
|
+
interactive: Boolean(onRowClick) && !disabled,
|
|
22516
|
+
selected,
|
|
22517
|
+
disabled,
|
|
22518
|
+
onClick: () => {
|
|
22519
|
+
if (!disabled) {
|
|
22520
|
+
onRowClick?.(row, rowIndex);
|
|
22521
|
+
}
|
|
22522
|
+
},
|
|
22523
|
+
className: cn(
|
|
22524
|
+
onRowClick && !disabled ? "cursor-pointer" : "cursor-default",
|
|
22525
|
+
selected ? "bg-primary/10 hover:bg-primary/15" : disabled ? "" : "hover:bg-muted/25 dark:hover:bg-muted/15",
|
|
22526
|
+
classNames?.row,
|
|
22527
|
+
resolvedRowClassName
|
|
22528
|
+
),
|
|
22529
|
+
children: orderedColumns.map((column, columnIndex) => {
|
|
22530
|
+
const shouldWrap = isAction(column) || column.wrap === true;
|
|
22531
|
+
const previousColumn = orderedColumns[columnIndex - 1];
|
|
22532
|
+
const followsRecordIcon = previousColumn?.renderType === "icon" && column.key === resolvedActivePrimaryColumn?.key;
|
|
22533
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22534
|
+
BaseTableCell,
|
|
22535
|
+
{
|
|
22536
|
+
appearance,
|
|
22537
|
+
align: column.align,
|
|
22538
|
+
className: cn(
|
|
22539
|
+
shouldWrap ? "align-top whitespace-normal" : "whitespace-nowrap",
|
|
22540
|
+
"px-4 py-3 text-muted-foreground",
|
|
22541
|
+
stickyFirstColumn && columnIndex === 0 && "sticky left-0 z-10 bg-card/95 text-foreground shadow-[1px_0_0_0_hsl(var(--border)/0.3)]",
|
|
22542
|
+
column.compactCellClassName,
|
|
22543
|
+
column.cellClassName,
|
|
22544
|
+
column.renderType === "icon" && "pl-3 pr-1",
|
|
22545
|
+
followsRecordIcon && "pl-2",
|
|
22546
|
+
classNames?.cell
|
|
22547
|
+
),
|
|
22548
|
+
children: renderValue(column, row, {
|
|
22549
|
+
row,
|
|
22550
|
+
rowIndex,
|
|
22551
|
+
column,
|
|
22552
|
+
columnIndex,
|
|
22553
|
+
compact: true,
|
|
22554
|
+
surface: "list"
|
|
22555
|
+
})
|
|
22556
|
+
},
|
|
22557
|
+
`${key}-${column.key}`
|
|
22558
|
+
);
|
|
22559
|
+
})
|
|
22560
|
+
},
|
|
22561
|
+
key
|
|
22562
|
+
);
|
|
22563
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
22564
|
+
BaseTableEmpty,
|
|
22565
|
+
{
|
|
22566
|
+
appearance,
|
|
22567
|
+
colSpan: Math.max(orderedColumns.length, 1),
|
|
22568
|
+
classNames: { cell: "px-4 py-10 text-center text-sm text-muted-foreground" },
|
|
22569
|
+
children: emptyState
|
|
22570
|
+
}
|
|
22571
|
+
) })
|
|
22572
|
+
]
|
|
22573
|
+
}
|
|
22574
|
+
)
|
|
22575
|
+
}
|
|
22576
|
+
),
|
|
22577
|
+
footer ? /* @__PURE__ */ jsxRuntime.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
|
|
22578
|
+
]
|
|
22579
|
+
}
|
|
22580
|
+
);
|
|
22581
|
+
}
|
|
22582
|
+
function toCssSize4(value) {
|
|
22583
|
+
if (value === void 0) return void 0;
|
|
22584
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
22585
|
+
}
|
|
22586
|
+
function isBrowser() {
|
|
22587
|
+
return typeof window !== "undefined";
|
|
22588
|
+
}
|
|
22589
|
+
function defaultGetRowKey2(row, rowIndex) {
|
|
22590
|
+
return row?.id ?? row?.key ?? rowIndex;
|
|
22591
|
+
}
|
|
22592
|
+
function getColumnDefaultSize(column) {
|
|
22593
|
+
if (typeof column.width === "number") return column.width;
|
|
22594
|
+
if (typeof column.minWidth === "number") return column.minWidth;
|
|
22595
|
+
return 160;
|
|
22596
|
+
}
|
|
22597
|
+
function buildDefaultColumnSizes(columns, explicit) {
|
|
22598
|
+
return columns.reduce((acc, column) => {
|
|
22599
|
+
acc[column.key] = explicit?.[column.key] ?? getColumnDefaultSize(column);
|
|
22600
|
+
return acc;
|
|
22601
|
+
}, {});
|
|
22602
|
+
}
|
|
22603
|
+
function loadStoredColumnSizes(storageKey, defaults) {
|
|
22604
|
+
if (!storageKey || !isBrowser()) return defaults;
|
|
22605
|
+
try {
|
|
22606
|
+
const parsed = JSON.parse(window.localStorage.getItem(storageKey) || "{}");
|
|
22607
|
+
return Object.keys(defaults).reduce((acc, key) => {
|
|
22608
|
+
const value = Number(parsed?.[key]);
|
|
22609
|
+
acc[key] = Number.isFinite(value) ? value : defaults[key];
|
|
22610
|
+
return acc;
|
|
22611
|
+
}, {});
|
|
22612
|
+
} catch {
|
|
22613
|
+
return defaults;
|
|
22614
|
+
}
|
|
22615
|
+
}
|
|
22616
|
+
function persistColumnSizes(storageKey, sizes) {
|
|
22617
|
+
if (!storageKey || !isBrowser()) return;
|
|
22618
|
+
window.localStorage.setItem(storageKey, JSON.stringify(sizes));
|
|
22619
|
+
}
|
|
22620
|
+
function getFrozenColumnStorageKey(storageKey) {
|
|
22621
|
+
return storageKey ? `${storageKey}.frozenColumnCount` : void 0;
|
|
22622
|
+
}
|
|
22623
|
+
function getFrozenEndColumnStorageKey(storageKey) {
|
|
22624
|
+
return storageKey ? `${storageKey}.frozenEndColumnCount` : void 0;
|
|
22625
|
+
}
|
|
22626
|
+
function clampFrozenColumnCount(count, columnCount) {
|
|
22627
|
+
if (!Number.isFinite(count)) return 0;
|
|
22628
|
+
return Math.max(0, Math.min(Math.round(count), columnCount));
|
|
22629
|
+
}
|
|
22630
|
+
function normalizeFrozenColumnCounts(startCount, endCount, columnCount) {
|
|
22631
|
+
const normalizedStartCount = clampFrozenColumnCount(startCount, columnCount);
|
|
22632
|
+
const normalizedEndCount = clampFrozenColumnCount(endCount, Math.max(0, columnCount - normalizedStartCount));
|
|
22633
|
+
return {
|
|
22634
|
+
startCount: normalizedStartCount,
|
|
22635
|
+
endCount: normalizedEndCount
|
|
22636
|
+
};
|
|
22637
|
+
}
|
|
22638
|
+
function loadStoredFrozenColumnCount(storageKey, defaultCount, columnCount) {
|
|
22639
|
+
const fallback = clampFrozenColumnCount(defaultCount, columnCount);
|
|
22640
|
+
const frozenStorageKey = getFrozenColumnStorageKey(storageKey);
|
|
22641
|
+
if (!frozenStorageKey || !isBrowser()) return fallback;
|
|
22642
|
+
try {
|
|
22643
|
+
const storedValue = window.localStorage.getItem(frozenStorageKey);
|
|
22644
|
+
if (storedValue === null) return fallback;
|
|
22645
|
+
const value = Number(storedValue);
|
|
22646
|
+
return Number.isFinite(value) ? clampFrozenColumnCount(value, columnCount) : fallback;
|
|
22647
|
+
} catch {
|
|
22648
|
+
return fallback;
|
|
22649
|
+
}
|
|
22650
|
+
}
|
|
22651
|
+
function persistFrozenColumnCount(storageKey, count) {
|
|
22652
|
+
const frozenStorageKey = getFrozenColumnStorageKey(storageKey);
|
|
22653
|
+
if (!frozenStorageKey || !isBrowser()) return;
|
|
22654
|
+
window.localStorage.setItem(frozenStorageKey, String(count));
|
|
22655
|
+
}
|
|
22656
|
+
function loadStoredFrozenEndColumnCount(storageKey, defaultCount, columnCount) {
|
|
22657
|
+
const fallback = clampFrozenColumnCount(defaultCount, columnCount);
|
|
22658
|
+
const frozenStorageKey = getFrozenEndColumnStorageKey(storageKey);
|
|
22659
|
+
if (!frozenStorageKey || !isBrowser()) return fallback;
|
|
22660
|
+
try {
|
|
22661
|
+
const storedValue = window.localStorage.getItem(frozenStorageKey);
|
|
22662
|
+
if (storedValue === null) return fallback;
|
|
22663
|
+
const value = Number(storedValue);
|
|
22664
|
+
return Number.isFinite(value) ? clampFrozenColumnCount(value, columnCount) : fallback;
|
|
22665
|
+
} catch {
|
|
22666
|
+
return fallback;
|
|
22667
|
+
}
|
|
22668
|
+
}
|
|
22669
|
+
function persistFrozenEndColumnCount(storageKey, count) {
|
|
22670
|
+
const frozenStorageKey = getFrozenEndColumnStorageKey(storageKey);
|
|
22671
|
+
if (!frozenStorageKey || !isBrowser()) return;
|
|
22672
|
+
window.localStorage.setItem(frozenStorageKey, String(count));
|
|
22673
|
+
}
|
|
22674
|
+
function normalizeColumnOrder2(columnKeys, columnOrder) {
|
|
22675
|
+
const validColumnKeys = new Set(columnKeys);
|
|
22676
|
+
const orderedKeys = (columnOrder || []).filter((columnKey) => validColumnKeys.has(columnKey));
|
|
22677
|
+
const orderedKeySet = new Set(orderedKeys);
|
|
22678
|
+
const remainingKeys = columnKeys.filter((columnKey) => !orderedKeySet.has(columnKey));
|
|
22679
|
+
return [...orderedKeys, ...remainingKeys];
|
|
22680
|
+
}
|
|
22681
|
+
function getOrderedColumns2(columns, columnOrder) {
|
|
22682
|
+
const normalizedOrder = normalizeColumnOrder2(columns.map((column) => column.key), columnOrder);
|
|
22683
|
+
const columnMap = new Map(columns.map((column) => [column.key, column]));
|
|
22684
|
+
return normalizedOrder.map((columnKey) => columnMap.get(columnKey)).filter(Boolean);
|
|
22685
|
+
}
|
|
22686
|
+
function getColumnNumericWidth(column, columnSizes) {
|
|
22687
|
+
const controlledWidth = columnSizes[column.key];
|
|
22688
|
+
if (typeof controlledWidth === "number") return controlledWidth;
|
|
22689
|
+
return getColumnDefaultSize(column);
|
|
22690
|
+
}
|
|
22691
|
+
function buildFrozenOffsets(columns, columnSizes, frozenColumnCount) {
|
|
22692
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
22693
|
+
let left = 0;
|
|
22694
|
+
columns.slice(0, Math.max(0, frozenColumnCount)).forEach((column) => {
|
|
22695
|
+
offsets.set(column.key, left);
|
|
22696
|
+
left += getColumnNumericWidth(column, columnSizes);
|
|
22697
|
+
});
|
|
22698
|
+
return offsets;
|
|
22699
|
+
}
|
|
22700
|
+
function buildFrozenEndOffsets(columns, columnSizes, frozenEndColumnCount) {
|
|
22701
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
22702
|
+
let right = 0;
|
|
22703
|
+
columns.slice(Math.max(0, columns.length - frozenEndColumnCount)).reverse().forEach((column) => {
|
|
22704
|
+
offsets.set(column.key, right);
|
|
22705
|
+
right += getColumnNumericWidth(column, columnSizes);
|
|
22706
|
+
});
|
|
22707
|
+
return offsets;
|
|
22708
|
+
}
|
|
22709
|
+
function resolveRowClassName(rowClassName, row, rowIndex) {
|
|
22710
|
+
return typeof rowClassName === "function" ? rowClassName(row, rowIndex) : rowClassName;
|
|
22711
|
+
}
|
|
22712
|
+
function renderDefaultCell(column, row) {
|
|
22713
|
+
const value = row?.[column.key];
|
|
22714
|
+
if (value === void 0 || value === null || value === "") return "\u2014";
|
|
22715
|
+
return String(value);
|
|
22716
|
+
}
|
|
22717
|
+
function InteractiveTableCellContent({
|
|
22718
|
+
children,
|
|
22719
|
+
wrap
|
|
22720
|
+
}) {
|
|
22721
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22722
|
+
"div",
|
|
22723
|
+
{
|
|
22724
|
+
className: cn(
|
|
22725
|
+
"min-w-0 max-w-full overflow-auto overscroll-contain [scrollbar-width:thin]",
|
|
22726
|
+
wrap ? "max-h-20 whitespace-pre-wrap break-words leading-5" : "whitespace-nowrap"
|
|
22727
|
+
),
|
|
22728
|
+
children
|
|
22729
|
+
}
|
|
22730
|
+
);
|
|
22731
|
+
}
|
|
22732
|
+
function PinIcon({ className }) {
|
|
22733
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
22734
|
+
"svg",
|
|
22735
|
+
{
|
|
22736
|
+
"aria-hidden": "true",
|
|
22737
|
+
viewBox: "0 0 16 16",
|
|
22738
|
+
className,
|
|
22739
|
+
fill: "none",
|
|
22740
|
+
stroke: "currentColor",
|
|
22741
|
+
strokeLinecap: "round",
|
|
22742
|
+
strokeLinejoin: "round",
|
|
22743
|
+
strokeWidth: "1.75",
|
|
22744
|
+
children: [
|
|
22745
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.25 2.75h5.5" }),
|
|
22746
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.25 2.75v4L4.5 9.25h7L9.75 6.75v-4" }),
|
|
22747
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 9.25v4" })
|
|
22748
|
+
]
|
|
22749
|
+
}
|
|
22750
|
+
);
|
|
22751
|
+
}
|
|
22752
|
+
function InteractiveTable({
|
|
22753
|
+
rows = [],
|
|
22754
|
+
columns = [],
|
|
22755
|
+
pinnedTopRows = [],
|
|
22756
|
+
getRowKey = defaultGetRowKey2,
|
|
22757
|
+
getPinnedTopRowKey = defaultGetRowKey2,
|
|
22758
|
+
renderCell,
|
|
22759
|
+
renderPinnedTopCell,
|
|
22760
|
+
renderColumnHeader,
|
|
22761
|
+
onRowClick,
|
|
22762
|
+
getRowState,
|
|
22763
|
+
rowClassName,
|
|
22764
|
+
pinnedTopRowClassName,
|
|
22765
|
+
emptyState = "\u2014",
|
|
22766
|
+
columnMenuLabels,
|
|
22767
|
+
columnStorageKey,
|
|
22768
|
+
columnOrder,
|
|
22769
|
+
columnSizes,
|
|
22770
|
+
defaultColumnSizes,
|
|
22771
|
+
columnDragEnabled = false,
|
|
22772
|
+
columnResizeEnabled = true,
|
|
22773
|
+
frozenColumnCount = 0,
|
|
22774
|
+
frozenEndColumnCount = 0,
|
|
22775
|
+
tableMinWidth,
|
|
22776
|
+
bodyMaxHeight = "min(60vh, 42rem)",
|
|
22777
|
+
appearance,
|
|
22778
|
+
className,
|
|
22779
|
+
tableClassName,
|
|
22780
|
+
classNames,
|
|
22781
|
+
style,
|
|
22782
|
+
onColumnOrderChange,
|
|
22783
|
+
onColumnSizeChange,
|
|
22784
|
+
onResetColumnSizes,
|
|
22785
|
+
onFrozenColumnCountChange,
|
|
22786
|
+
onFrozenEndColumnCountChange,
|
|
22787
|
+
onSort
|
|
22788
|
+
}) {
|
|
22789
|
+
const columnKeySignature = columns.map((column) => column.key).join("");
|
|
22790
|
+
const defaultOrder = React.useMemo(
|
|
22791
|
+
() => columnKeySignature ? columnKeySignature.split("") : [],
|
|
22792
|
+
[columnKeySignature]
|
|
22793
|
+
);
|
|
22794
|
+
const defaultSizes = React.useMemo(
|
|
22795
|
+
() => buildDefaultColumnSizes(columns, defaultColumnSizes),
|
|
22796
|
+
[columns, defaultColumnSizes]
|
|
22797
|
+
);
|
|
22798
|
+
const [internalColumnOrder, setInternalColumnOrder] = React.useState(defaultOrder);
|
|
22799
|
+
const [internalColumnSizes, setInternalColumnSizes] = React.useState(() => loadStoredColumnSizes(columnStorageKey, defaultSizes));
|
|
22800
|
+
const [internalFrozenColumnCount, setInternalFrozenColumnCount] = React.useState(() => loadStoredFrozenColumnCount(columnStorageKey, frozenColumnCount, columns.length));
|
|
22801
|
+
const [internalFrozenEndColumnCount, setInternalFrozenEndColumnCount] = React.useState(() => loadStoredFrozenEndColumnCount(columnStorageKey, frozenEndColumnCount, columns.length));
|
|
22802
|
+
React.useEffect(() => {
|
|
22803
|
+
setInternalColumnOrder((current) => normalizeColumnOrder2(defaultOrder, current));
|
|
22804
|
+
}, [defaultOrder]);
|
|
22805
|
+
React.useEffect(() => {
|
|
22806
|
+
if (columnSizes) return;
|
|
22807
|
+
setInternalColumnSizes(loadStoredColumnSizes(columnStorageKey, defaultSizes));
|
|
22808
|
+
}, [columnSizes, columnStorageKey, defaultSizes]);
|
|
22809
|
+
React.useEffect(() => {
|
|
22810
|
+
setInternalFrozenColumnCount(loadStoredFrozenColumnCount(columnStorageKey, frozenColumnCount, columns.length));
|
|
22811
|
+
}, [columnStorageKey, columns.length, frozenColumnCount]);
|
|
22812
|
+
React.useEffect(() => {
|
|
22813
|
+
setInternalFrozenEndColumnCount(loadStoredFrozenEndColumnCount(columnStorageKey, frozenEndColumnCount, columns.length));
|
|
22814
|
+
}, [columnStorageKey, columns.length, frozenEndColumnCount]);
|
|
22815
|
+
const resolvedColumnOrder = columnOrder ? normalizeColumnOrder2(defaultOrder, columnOrder) : internalColumnOrder;
|
|
22816
|
+
const resolvedColumnSizes = columnSizes ?? internalColumnSizes;
|
|
22817
|
+
const orderedColumns = getOrderedColumns2(columns, resolvedColumnOrder);
|
|
22818
|
+
const {
|
|
22819
|
+
startCount: resolvedFrozenColumnCount,
|
|
22820
|
+
endCount: resolvedFrozenEndColumnCount
|
|
22821
|
+
} = normalizeFrozenColumnCounts(internalFrozenColumnCount, internalFrozenEndColumnCount, orderedColumns.length);
|
|
22822
|
+
const frozenOffsets = buildFrozenOffsets(orderedColumns, resolvedColumnSizes, resolvedFrozenColumnCount);
|
|
22823
|
+
const frozenEndOffsets = buildFrozenEndOffsets(orderedColumns, resolvedColumnSizes, resolvedFrozenEndColumnCount);
|
|
22824
|
+
const resolvedMinWidth = tableMinWidth ?? Math.max(760, orderedColumns.reduce((total, column) => total + getColumnNumericWidth(column, resolvedColumnSizes), 0));
|
|
22825
|
+
const labels = {
|
|
22826
|
+
columnActions: columnMenuLabels?.columnActions ?? "Column actions",
|
|
22827
|
+
freezeColumn: columnMenuLabels?.freezeColumn ?? "Freeze to left",
|
|
22828
|
+
freezeEndColumn: columnMenuLabels?.freezeEndColumn ?? "Freeze to right",
|
|
22829
|
+
unfreezeColumn: columnMenuLabels?.unfreezeColumn ?? "Unfreeze from left",
|
|
22830
|
+
unfreezeEndColumn: columnMenuLabels?.unfreezeEndColumn ?? "Unfreeze from right",
|
|
22831
|
+
unfreezeAllColumns: columnMenuLabels?.unfreezeAllColumns ?? "Unfreeze all columns",
|
|
22832
|
+
resetColumnWidth: columnMenuLabels?.resetColumnWidth ?? "Reset column width",
|
|
22833
|
+
frozenColumnTitle: columnMenuLabels?.frozenColumnTitle ?? "Frozen column"
|
|
22834
|
+
};
|
|
22835
|
+
const handleColumnOrderChange = React.useCallback((nextOrder, detail) => {
|
|
22836
|
+
const normalizedOrder = normalizeColumnOrder2(defaultOrder, nextOrder);
|
|
22837
|
+
if (!columnOrder) {
|
|
22838
|
+
setInternalColumnOrder(normalizedOrder);
|
|
22839
|
+
}
|
|
22840
|
+
onColumnOrderChange?.(normalizedOrder, detail);
|
|
22841
|
+
}, [columnOrder, defaultOrder, onColumnOrderChange]);
|
|
22842
|
+
const handleColumnSizeChange = React.useCallback((columnId, width, detail) => {
|
|
22843
|
+
const column = columns.find((item) => item.key === columnId);
|
|
22844
|
+
const minWidth = column?.minWidth;
|
|
22845
|
+
const maxWidth = column?.maxWidth;
|
|
22846
|
+
const nextWidth = Math.max(
|
|
22847
|
+
typeof minWidth === "number" ? minWidth : 0,
|
|
22848
|
+
Math.min(width, typeof maxWidth === "number" ? maxWidth : Number.POSITIVE_INFINITY)
|
|
22849
|
+
);
|
|
22850
|
+
const nextSizes = {
|
|
22851
|
+
...resolvedColumnSizes,
|
|
22852
|
+
[columnId]: nextWidth
|
|
22853
|
+
};
|
|
22854
|
+
if (!columnSizes) {
|
|
22855
|
+
setInternalColumnSizes(nextSizes);
|
|
22856
|
+
}
|
|
22857
|
+
persistColumnSizes(columnStorageKey, nextSizes);
|
|
22858
|
+
onColumnSizeChange?.(columnId, nextWidth, detail);
|
|
22859
|
+
}, [columnSizes, columnStorageKey, columns, onColumnSizeChange, resolvedColumnSizes]);
|
|
22860
|
+
const handleResetColumnSize = React.useCallback((column) => {
|
|
22861
|
+
const nextWidth = defaultSizes[column.key] ?? getColumnDefaultSize(column);
|
|
22862
|
+
const previousWidth = getColumnNumericWidth(column, resolvedColumnSizes);
|
|
22863
|
+
const nextSizes = {
|
|
22864
|
+
...resolvedColumnSizes,
|
|
22865
|
+
[column.key]: nextWidth
|
|
22866
|
+
};
|
|
22867
|
+
if (!columnSizes) {
|
|
22868
|
+
setInternalColumnSizes(nextSizes);
|
|
22869
|
+
}
|
|
22870
|
+
persistColumnSizes(columnStorageKey, nextSizes);
|
|
22871
|
+
onColumnSizeChange?.(column.key, nextWidth, {
|
|
22872
|
+
columnId: column.key,
|
|
22873
|
+
previousWidth,
|
|
22874
|
+
minWidth: column.minWidth,
|
|
22875
|
+
maxWidth: column.maxWidth
|
|
22876
|
+
});
|
|
22877
|
+
onResetColumnSizes?.(nextSizes);
|
|
22878
|
+
}, [columnSizes, columnStorageKey, defaultSizes, onColumnSizeChange, onResetColumnSizes, resolvedColumnSizes]);
|
|
22879
|
+
const setFrozenColumnCount = React.useCallback((nextCount) => {
|
|
22880
|
+
const normalizedCount = clampFrozenColumnCount(nextCount, Math.max(0, orderedColumns.length - resolvedFrozenEndColumnCount));
|
|
22881
|
+
setInternalFrozenColumnCount(normalizedCount);
|
|
22882
|
+
persistFrozenColumnCount(columnStorageKey, normalizedCount);
|
|
22883
|
+
onFrozenColumnCountChange?.(normalizedCount);
|
|
22884
|
+
}, [columnStorageKey, onFrozenColumnCountChange, orderedColumns.length, resolvedFrozenEndColumnCount]);
|
|
22885
|
+
const setFrozenEndColumnCount = React.useCallback((nextCount) => {
|
|
22886
|
+
const normalizedCount = clampFrozenColumnCount(nextCount, Math.max(0, orderedColumns.length - resolvedFrozenColumnCount));
|
|
22887
|
+
setInternalFrozenEndColumnCount(normalizedCount);
|
|
22888
|
+
persistFrozenEndColumnCount(columnStorageKey, normalizedCount);
|
|
22889
|
+
onFrozenEndColumnCountChange?.(normalizedCount);
|
|
22890
|
+
}, [columnStorageKey, onFrozenEndColumnCountChange, orderedColumns.length, resolvedFrozenColumnCount]);
|
|
22891
|
+
const getFrozenPosition = (columnIndex) => {
|
|
22892
|
+
if (columnIndex < resolvedFrozenColumnCount) return "start";
|
|
22893
|
+
if (columnIndex >= orderedColumns.length - resolvedFrozenEndColumnCount) return "end";
|
|
22894
|
+
return void 0;
|
|
22895
|
+
};
|
|
22896
|
+
const getFrozenClassName = (column, columnIndex, isHeader = false) => {
|
|
22897
|
+
const position = getFrozenPosition(columnIndex);
|
|
22898
|
+
if (!position) return void 0;
|
|
22899
|
+
return cn(
|
|
22900
|
+
"sticky",
|
|
22901
|
+
position === "start" ? "shadow-[1px_0_0_0_hsl(var(--border)/0.45)]" : "shadow-[-1px_0_0_0_hsl(var(--border)/0.45)]",
|
|
22902
|
+
isHeader ? "bg-muted/60" : "bg-inherit",
|
|
22903
|
+
isHeader ? "z-40" : "z-20",
|
|
22904
|
+
(columnIndex === 0 || columnIndex === orderedColumns.length - 1) && (isHeader ? "z-50" : "z-30")
|
|
22905
|
+
);
|
|
22906
|
+
};
|
|
22907
|
+
const getFrozenStyle = (column, columnIndex) => {
|
|
22908
|
+
const position = getFrozenPosition(columnIndex);
|
|
22909
|
+
if (position === "start") return { left: frozenOffsets.get(column.key) ?? 0 };
|
|
22910
|
+
if (position === "end") return { right: frozenEndOffsets.get(column.key) ?? 0 };
|
|
22911
|
+
return void 0;
|
|
22912
|
+
};
|
|
22913
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22914
|
+
BaseTableContainer,
|
|
22915
|
+
{
|
|
22916
|
+
appearance,
|
|
22917
|
+
className: cn("flex h-full min-h-0 flex-col overflow-hidden rounded-lg border border-border/60 bg-card", classNames?.root, className),
|
|
22918
|
+
style,
|
|
22919
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22920
|
+
"div",
|
|
22921
|
+
{
|
|
22922
|
+
className: cn("min-h-0 flex-1 overflow-auto", classNames?.scrollArea),
|
|
22923
|
+
style: { maxHeight: toCssSize4(bodyMaxHeight) },
|
|
22924
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
22925
|
+
BaseTable,
|
|
22926
|
+
{
|
|
22927
|
+
appearance,
|
|
22928
|
+
columnOrder: resolvedColumnOrder,
|
|
22929
|
+
columnSizes: resolvedColumnSizes,
|
|
22930
|
+
columnDragEnabled,
|
|
22931
|
+
columnResizeEnabled,
|
|
22932
|
+
onColumnOrderChange: handleColumnOrderChange,
|
|
22933
|
+
onColumnSizeChange: handleColumnSizeChange,
|
|
22934
|
+
className: cn("w-full table-fixed text-left text-xs", classNames?.table, tableClassName),
|
|
22935
|
+
style: { minWidth: resolvedMinWidth },
|
|
22936
|
+
children: [
|
|
22937
|
+
/* @__PURE__ */ jsxRuntime.jsx("colgroup", { children: orderedColumns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
22938
|
+
"col",
|
|
22939
|
+
{
|
|
22940
|
+
style: {
|
|
22941
|
+
width: toCssSize4(resolvedColumnSizes[column.key] ?? column.width),
|
|
22942
|
+
minWidth: toCssSize4(column.minWidth)
|
|
22943
|
+
}
|
|
22944
|
+
},
|
|
22945
|
+
column.key
|
|
22946
|
+
)) }),
|
|
22947
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseTableHeader, { appearance, className: cn("border-b border-border/60 bg-muted/60 text-[11px] font-medium text-muted-foreground", classNames?.tableHeader), children: /* @__PURE__ */ jsxRuntime.jsx(BaseTableRow, { appearance, className: cn("hover:bg-transparent", classNames?.headerRow), children: orderedColumns.map((column, columnIndex) => {
|
|
22948
|
+
const headerContent = renderColumnHeader ? renderColumnHeader(column, { column, columnIndex, columns: orderedColumns, rows }) : column.label;
|
|
22949
|
+
const sortable = Boolean(column.sortable);
|
|
22950
|
+
const handleSort = sortable && onSort ? () => onSort(column.key, column) : void 0;
|
|
22951
|
+
const isFrozenStart = columnIndex < resolvedFrozenColumnCount;
|
|
22952
|
+
const isFrozenEnd = columnIndex >= orderedColumns.length - resolvedFrozenEndColumnCount;
|
|
22953
|
+
const isFrozen = isFrozenStart || isFrozenEnd;
|
|
22954
|
+
const isColumnAtDefaultWidth = getColumnNumericWidth(column, resolvedColumnSizes) === (defaultSizes[column.key] ?? getColumnDefaultSize(column));
|
|
22955
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(BaseContextMenu, { modal: false, children: [
|
|
22956
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseContextMenuTrigger, { asChild: true, appearance, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22957
|
+
BaseTableHead,
|
|
22958
|
+
{
|
|
22959
|
+
appearance,
|
|
22960
|
+
columnId: column.key,
|
|
22961
|
+
align: column.align,
|
|
21514
22962
|
label: headerContent,
|
|
21515
|
-
description:
|
|
21516
|
-
|
|
21517
|
-
actions: renderColumnHeader ? void 0 : column.actions,
|
|
21518
|
-
trailing: headerTrailing,
|
|
22963
|
+
description: column.description,
|
|
22964
|
+
trailing: isFrozen ? /* @__PURE__ */ jsxRuntime.jsx("span", { title: labels.frozenColumnTitle, className: "inline-flex h-5 w-5 items-center justify-center rounded text-primary", children: /* @__PURE__ */ jsxRuntime.jsx(PinIcon, { className: "h-3.5 w-3.5" }) }) : null,
|
|
21519
22965
|
sortable,
|
|
21520
22966
|
sortDirection: column.sortDirection,
|
|
21521
22967
|
sortLabel: column.sortLabel,
|
|
21522
22968
|
onSort: handleSort,
|
|
21523
22969
|
draggable: column.draggable,
|
|
21524
|
-
dragLabel: column.dragLabel,
|
|
21525
22970
|
resizable: column.resizable,
|
|
21526
|
-
resizeLabel: column.resizeLabel,
|
|
21527
22971
|
width: column.width,
|
|
21528
|
-
minWidth:
|
|
21529
|
-
maxWidth:
|
|
22972
|
+
minWidth: column.minWidth,
|
|
22973
|
+
maxWidth: column.maxWidth,
|
|
21530
22974
|
className: cn(
|
|
21531
|
-
"sticky top-0
|
|
21532
|
-
|
|
21533
|
-
column.compactHeaderClassName,
|
|
22975
|
+
"sticky top-0 h-9 whitespace-nowrap border-r border-border/50 bg-muted/60 px-2.5 py-2 backdrop-blur",
|
|
22976
|
+
getFrozenClassName(column, columnIndex, true),
|
|
21534
22977
|
column.headerClassName,
|
|
21535
|
-
column.
|
|
21536
|
-
followsRecordIcon && "pl-2",
|
|
22978
|
+
column.className,
|
|
21537
22979
|
classNames?.headerCell
|
|
21538
22980
|
),
|
|
21539
|
-
style:
|
|
21540
|
-
|
|
21541
|
-
|
|
22981
|
+
style: getFrozenStyle(column, columnIndex)
|
|
22982
|
+
}
|
|
22983
|
+
) }),
|
|
22984
|
+
/* @__PURE__ */ jsxRuntime.jsxs(BaseContextMenuContent, { appearance, alignOffset: -4, className: "min-w-44", children: [
|
|
22985
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseContextMenuLabel, { appearance, children: labels.columnActions }),
|
|
22986
|
+
isFrozen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
22987
|
+
BaseContextMenuItem,
|
|
22988
|
+
{
|
|
22989
|
+
appearance,
|
|
22990
|
+
onSelect: () => {
|
|
22991
|
+
if (isFrozenEnd) setFrozenEndColumnCount(orderedColumns.length - columnIndex - 1);
|
|
22992
|
+
else setFrozenColumnCount(columnIndex);
|
|
22993
|
+
},
|
|
22994
|
+
children: isFrozenEnd ? labels.unfreezeEndColumn : labels.unfreezeColumn
|
|
22995
|
+
}
|
|
22996
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
22997
|
+
BaseContextMenuItem,
|
|
22998
|
+
{
|
|
22999
|
+
appearance,
|
|
23000
|
+
onSelect: () => setFrozenColumnCount(columnIndex + 1),
|
|
23001
|
+
children: labels.freezeColumn
|
|
21542
23002
|
}
|
|
23003
|
+
),
|
|
23004
|
+
!isFrozen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
23005
|
+
BaseContextMenuItem,
|
|
23006
|
+
{
|
|
23007
|
+
appearance,
|
|
23008
|
+
onSelect: () => setFrozenEndColumnCount(orderedColumns.length - columnIndex),
|
|
23009
|
+
children: labels.freezeEndColumn
|
|
23010
|
+
}
|
|
23011
|
+
) : null,
|
|
23012
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
23013
|
+
BaseContextMenuItem,
|
|
23014
|
+
{
|
|
23015
|
+
appearance,
|
|
23016
|
+
disabled: resolvedFrozenColumnCount === 0 && resolvedFrozenEndColumnCount === 0,
|
|
23017
|
+
onSelect: () => {
|
|
23018
|
+
setFrozenColumnCount(0);
|
|
23019
|
+
setFrozenEndColumnCount(0);
|
|
23020
|
+
},
|
|
23021
|
+
children: labels.unfreezeAllColumns
|
|
23022
|
+
}
|
|
23023
|
+
),
|
|
23024
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseContextMenuSeparator, { appearance }),
|
|
23025
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
23026
|
+
BaseContextMenuItem,
|
|
23027
|
+
{
|
|
23028
|
+
appearance,
|
|
23029
|
+
disabled: isColumnAtDefaultWidth,
|
|
23030
|
+
onSelect: () => handleResetColumnSize(column),
|
|
23031
|
+
children: labels.resetColumnWidth
|
|
23032
|
+
}
|
|
23033
|
+
)
|
|
23034
|
+
] })
|
|
23035
|
+
] }, column.key);
|
|
23036
|
+
}) }) }),
|
|
23037
|
+
/* @__PURE__ */ jsxRuntime.jsxs(BaseTableBody, { appearance, className: cn("divide-y divide-border/50", classNames?.body), children: [
|
|
23038
|
+
pinnedTopRows.map((row, rowIndex) => {
|
|
23039
|
+
const key = getPinnedTopRowKey(row, rowIndex);
|
|
23040
|
+
const resolvedRowClassName = resolveRowClassName(pinnedTopRowClassName, row, rowIndex);
|
|
23041
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
23042
|
+
BaseTableRow,
|
|
23043
|
+
{
|
|
23044
|
+
appearance,
|
|
23045
|
+
className: cn("bg-card/95", classNames?.pinnedTopRow, resolvedRowClassName),
|
|
23046
|
+
children: orderedColumns.map((column, columnIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
23047
|
+
BaseTableCell,
|
|
23048
|
+
{
|
|
23049
|
+
appearance,
|
|
23050
|
+
align: column.align,
|
|
23051
|
+
className: cn(
|
|
23052
|
+
"h-[52px] border-r border-border/50 px-2.5 py-1.5 align-middle",
|
|
23053
|
+
column.wrap ? "whitespace-normal" : "whitespace-nowrap",
|
|
23054
|
+
getFrozenClassName(column, columnIndex),
|
|
23055
|
+
column.cellClassName,
|
|
23056
|
+
classNames?.cell
|
|
23057
|
+
),
|
|
23058
|
+
style: getFrozenStyle(column, columnIndex),
|
|
23059
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(InteractiveTableCellContent, { wrap: column.wrap, children: renderPinnedTopCell ? renderPinnedTopCell(column, row, { row, rowIndex, column, columnIndex, isPinnedTopRow: true }) : renderDefaultCell(column, row) })
|
|
23060
|
+
},
|
|
23061
|
+
`pinned-${key}-${column.key}`
|
|
23062
|
+
))
|
|
21543
23063
|
},
|
|
21544
|
-
|
|
23064
|
+
`pinned-${key}`
|
|
21545
23065
|
);
|
|
21546
|
-
})
|
|
21547
|
-
|
|
23066
|
+
}),
|
|
23067
|
+
rows.length ? rows.map((row, rowIndex) => {
|
|
21548
23068
|
const key = getRowKey(row, rowIndex);
|
|
21549
|
-
const
|
|
21550
|
-
const
|
|
21551
|
-
const selected = Boolean(resolvedSelectedKey && String(selectionKey) === String(resolvedSelectedKey));
|
|
21552
|
-
const resolvedRowClassName = typeof rowClassName === "function" ? rowClassName(row, rowIndex) : rowClassName;
|
|
23069
|
+
const state = getRowState?.(row, rowIndex) || {};
|
|
23070
|
+
const resolvedRowClassName = resolveRowClassName(rowClassName, row, rowIndex);
|
|
21553
23071
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21554
23072
|
BaseTableRow,
|
|
21555
23073
|
{
|
|
21556
23074
|
appearance,
|
|
21557
|
-
interactive: Boolean(onRowClick) && !disabled,
|
|
21558
|
-
selected,
|
|
21559
|
-
disabled,
|
|
23075
|
+
interactive: Boolean(onRowClick) && !state.disabled,
|
|
23076
|
+
selected: state.selected,
|
|
23077
|
+
disabled: state.disabled,
|
|
21560
23078
|
onClick: () => {
|
|
21561
|
-
if (!disabled)
|
|
21562
|
-
onRowClick?.(row, rowIndex);
|
|
21563
|
-
}
|
|
23079
|
+
if (!state.disabled) onRowClick?.(row, rowIndex);
|
|
21564
23080
|
},
|
|
21565
23081
|
className: cn(
|
|
21566
|
-
|
|
21567
|
-
|
|
23082
|
+
"min-h-[52px] bg-card transition-colors",
|
|
23083
|
+
state.saving && "bg-primary/5",
|
|
23084
|
+
state.pending && "opacity-80",
|
|
23085
|
+
onRowClick && !state.disabled ? "cursor-pointer hover:bg-muted/30" : "hover:bg-muted/30",
|
|
21568
23086
|
classNames?.row,
|
|
21569
23087
|
resolvedRowClassName
|
|
21570
23088
|
),
|
|
21571
|
-
children: orderedColumns.map((column, columnIndex) =>
|
|
21572
|
-
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
|
|
21578
|
-
|
|
21579
|
-
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
|
|
21584
|
-
|
|
21585
|
-
|
|
21586
|
-
|
|
21587
|
-
|
|
21588
|
-
classNames?.cell
|
|
21589
|
-
),
|
|
21590
|
-
children: renderValue(column, row, {
|
|
21591
|
-
row,
|
|
21592
|
-
rowIndex,
|
|
21593
|
-
column,
|
|
21594
|
-
columnIndex,
|
|
21595
|
-
compact: true,
|
|
21596
|
-
surface: "list"
|
|
21597
|
-
})
|
|
21598
|
-
},
|
|
21599
|
-
`${key}-${column.key}`
|
|
21600
|
-
);
|
|
21601
|
-
})
|
|
23089
|
+
children: orderedColumns.map((column, columnIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
23090
|
+
BaseTableCell,
|
|
23091
|
+
{
|
|
23092
|
+
appearance,
|
|
23093
|
+
align: column.align,
|
|
23094
|
+
className: cn(
|
|
23095
|
+
"h-[52px] border-r border-border/50 px-2.5 py-1.5 align-middle",
|
|
23096
|
+
column.wrap ? "whitespace-normal" : "whitespace-nowrap",
|
|
23097
|
+
getFrozenClassName(column, columnIndex),
|
|
23098
|
+
column.cellClassName,
|
|
23099
|
+
classNames?.cell
|
|
23100
|
+
),
|
|
23101
|
+
style: getFrozenStyle(column, columnIndex),
|
|
23102
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(InteractiveTableCellContent, { wrap: column.wrap, children: renderCell ? renderCell(column, row, { row, rowIndex, column, columnIndex, isPinnedTopRow: false }) : renderDefaultCell(column, row) })
|
|
23103
|
+
},
|
|
23104
|
+
`${key}-${column.key}`
|
|
23105
|
+
))
|
|
21602
23106
|
},
|
|
21603
23107
|
key
|
|
21604
23108
|
);
|
|
21605
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
23109
|
+
}) : pinnedTopRows.length ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
21606
23110
|
BaseTableEmpty,
|
|
21607
23111
|
{
|
|
21608
23112
|
appearance,
|
|
21609
23113
|
colSpan: Math.max(orderedColumns.length, 1),
|
|
21610
|
-
|
|
23114
|
+
className: classNames?.empty,
|
|
21611
23115
|
children: emptyState
|
|
21612
23116
|
}
|
|
21613
|
-
)
|
|
21614
|
-
]
|
|
21615
|
-
|
|
21616
|
-
|
|
23117
|
+
)
|
|
23118
|
+
] })
|
|
23119
|
+
]
|
|
23120
|
+
}
|
|
23121
|
+
)
|
|
23122
|
+
}
|
|
23123
|
+
)
|
|
23124
|
+
}
|
|
23125
|
+
);
|
|
23126
|
+
}
|
|
23127
|
+
function InteractiveTableEditableTextCell({
|
|
23128
|
+
value,
|
|
23129
|
+
placeholder,
|
|
23130
|
+
disabled,
|
|
23131
|
+
multiline = false,
|
|
23132
|
+
commitOnBlur = true,
|
|
23133
|
+
className,
|
|
23134
|
+
inputClassName,
|
|
23135
|
+
onCommit
|
|
23136
|
+
}) {
|
|
23137
|
+
const initialValue = String(value || "");
|
|
23138
|
+
const [draft, setDraft] = React.useState(initialValue);
|
|
23139
|
+
React.useEffect(() => {
|
|
23140
|
+
setDraft(initialValue);
|
|
23141
|
+
}, [initialValue]);
|
|
23142
|
+
const commit = React.useCallback(async () => {
|
|
23143
|
+
const nextValue = String(draft || "").trim();
|
|
23144
|
+
const previousValue = String(initialValue || "").trim();
|
|
23145
|
+
if (nextValue === previousValue) return;
|
|
23146
|
+
try {
|
|
23147
|
+
await onCommit?.(nextValue);
|
|
23148
|
+
} catch {
|
|
23149
|
+
setDraft(initialValue);
|
|
23150
|
+
}
|
|
23151
|
+
}, [draft, initialValue, onCommit]);
|
|
23152
|
+
const controlClassName = cn(
|
|
23153
|
+
"w-full resize-none rounded-sm border border-transparent bg-transparent px-1.5 py-1 text-xs text-foreground outline-none transition-colors",
|
|
23154
|
+
"placeholder:text-muted-foreground/70 hover:border-border/60 hover:bg-background focus:border-primary/45 focus:bg-background",
|
|
23155
|
+
multiline ? "min-h-[42px] leading-5" : "h-8",
|
|
23156
|
+
disabled && "cursor-not-allowed text-muted-foreground hover:border-transparent hover:bg-transparent",
|
|
23157
|
+
inputClassName
|
|
23158
|
+
);
|
|
23159
|
+
if (multiline) {
|
|
23160
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
23161
|
+
"textarea",
|
|
23162
|
+
{
|
|
23163
|
+
className: cn(controlClassName, className),
|
|
23164
|
+
disabled,
|
|
23165
|
+
value: draft,
|
|
23166
|
+
placeholder,
|
|
23167
|
+
onChange: (event) => setDraft(event.target.value),
|
|
23168
|
+
onBlur: () => {
|
|
23169
|
+
if (commitOnBlur) void commit();
|
|
23170
|
+
},
|
|
23171
|
+
onKeyDown: (event) => {
|
|
23172
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
|
23173
|
+
event.currentTarget.blur();
|
|
21617
23174
|
}
|
|
21618
|
-
|
|
21619
|
-
|
|
21620
|
-
|
|
23175
|
+
if (event.key === "Escape") {
|
|
23176
|
+
setDraft(initialValue);
|
|
23177
|
+
event.currentTarget.blur();
|
|
23178
|
+
}
|
|
23179
|
+
}
|
|
23180
|
+
}
|
|
23181
|
+
);
|
|
23182
|
+
}
|
|
23183
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
23184
|
+
"input",
|
|
23185
|
+
{
|
|
23186
|
+
className: cn(controlClassName, className),
|
|
23187
|
+
disabled,
|
|
23188
|
+
value: draft,
|
|
23189
|
+
placeholder,
|
|
23190
|
+
onChange: (event) => setDraft(event.target.value),
|
|
23191
|
+
onBlur: () => {
|
|
23192
|
+
if (commitOnBlur) void commit();
|
|
23193
|
+
},
|
|
23194
|
+
onKeyDown: (event) => {
|
|
23195
|
+
if (event.key === "Enter") event.currentTarget.blur();
|
|
23196
|
+
if (event.key === "Escape") {
|
|
23197
|
+
setDraft(initialValue);
|
|
23198
|
+
event.currentTarget.blur();
|
|
23199
|
+
}
|
|
23200
|
+
}
|
|
21621
23201
|
}
|
|
21622
23202
|
);
|
|
21623
23203
|
}
|
|
23204
|
+
function InteractiveTableReadonlyCell({
|
|
23205
|
+
children,
|
|
23206
|
+
mono = false,
|
|
23207
|
+
className
|
|
23208
|
+
}) {
|
|
23209
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("min-w-0 text-xs text-muted-foreground", mono && "font-mono", className), children: hasRenderableNode(children) ? children : "\u2014" });
|
|
23210
|
+
}
|
|
23211
|
+
function InteractiveTableSelectCell({
|
|
23212
|
+
value,
|
|
23213
|
+
options,
|
|
23214
|
+
disabled,
|
|
23215
|
+
ariaLabel,
|
|
23216
|
+
children,
|
|
23217
|
+
className,
|
|
23218
|
+
onChange
|
|
23219
|
+
}) {
|
|
23220
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative flex w-full items-center", className), children: [
|
|
23221
|
+
children,
|
|
23222
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
23223
|
+
"select",
|
|
23224
|
+
{
|
|
23225
|
+
"aria-label": ariaLabel,
|
|
23226
|
+
disabled,
|
|
23227
|
+
value,
|
|
23228
|
+
onChange: (event) => onChange?.(event.target.value),
|
|
23229
|
+
className: "absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
|
|
23230
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
|
|
23231
|
+
}
|
|
23232
|
+
)
|
|
23233
|
+
] });
|
|
23234
|
+
}
|
|
21624
23235
|
var imageExtPattern = /\.(png|jpe?g|webp|gif|svg|bmp|avif)$/i;
|
|
21625
23236
|
var audioExtPattern = /\.(wav|mp3|ogg|m4a|flac|aac)$/i;
|
|
21626
23237
|
var isLikelyUrl = (value) => /^https?:\/\//i.test(String(value || ""));
|
|
@@ -21947,7 +23558,7 @@ var DEFAULT_MASONRY_GAP_PX = 12;
|
|
|
21947
23558
|
var DEFAULT_MASONRY_ROW_HEIGHT_PX = 8;
|
|
21948
23559
|
var DEFAULT_MASONRY_COLUMN_WIDTH_PX = 280;
|
|
21949
23560
|
var DEFAULT_MASONRY_ITEM_HEIGHT_PX = 240;
|
|
21950
|
-
function
|
|
23561
|
+
function clamp4(value, min5, max5) {
|
|
21951
23562
|
return Math.min(Math.max(value, min5), max5);
|
|
21952
23563
|
}
|
|
21953
23564
|
function getRootFontSize(node) {
|
|
@@ -22022,10 +23633,10 @@ function getItemColumnSpan({
|
|
|
22022
23633
|
gap
|
|
22023
23634
|
}) {
|
|
22024
23635
|
if (Number.isFinite(size?.columnSpan) && Number(size?.columnSpan) > 0) {
|
|
22025
|
-
return
|
|
23636
|
+
return clamp4(Math.round(Number(size?.columnSpan)), 1, columnCount);
|
|
22026
23637
|
}
|
|
22027
23638
|
const itemWidth = resolveLengthToPixels(size?.width, columnWidth, null);
|
|
22028
|
-
return
|
|
23639
|
+
return clamp4(Math.ceil((itemWidth + gap) / (columnWidth + gap)), 1, columnCount);
|
|
22029
23640
|
}
|
|
22030
23641
|
function getItemRowSpan({
|
|
22031
23642
|
size,
|
|
@@ -22202,7 +23813,7 @@ function WorkbenchMasonryLayout({
|
|
|
22202
23813
|
let nextColumnIndex = 0;
|
|
22203
23814
|
let maxBottom = 0;
|
|
22204
23815
|
const positionedItems = layoutItems.map(({ key, item, columnSpan, rowSpan, size }) => {
|
|
22205
|
-
const resolvedSpan =
|
|
23816
|
+
const resolvedSpan = clamp4(columnSpan, 1, columnCount);
|
|
22206
23817
|
let startColumn = nextColumnIndex;
|
|
22207
23818
|
if (startColumn + resolvedSpan > columnCount) {
|
|
22208
23819
|
startColumn = 0;
|
|
@@ -22807,6 +24418,173 @@ function WorkbenchGalleryView({
|
|
|
22807
24418
|
}
|
|
22808
24419
|
);
|
|
22809
24420
|
}
|
|
24421
|
+
function toCssSize5(value) {
|
|
24422
|
+
if (value === void 0) return void 0;
|
|
24423
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
24424
|
+
}
|
|
24425
|
+
function defaultGetRowId(row, rowIndex) {
|
|
24426
|
+
return String(row?.id ?? row?.key ?? rowIndex);
|
|
24427
|
+
}
|
|
24428
|
+
function defaultGetColumnId(row) {
|
|
24429
|
+
return String(row?.columnId ?? row?.status ?? "");
|
|
24430
|
+
}
|
|
24431
|
+
function defaultRenderCard(row) {
|
|
24432
|
+
const value = row?.title ?? row?.name ?? row?.id ?? "Untitled";
|
|
24433
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-border/70 bg-card px-3 py-2 text-sm text-foreground shadow-sm", children: String(value) });
|
|
24434
|
+
}
|
|
24435
|
+
function WorkbenchLaneDraggableCard({
|
|
24436
|
+
row,
|
|
24437
|
+
rowId,
|
|
24438
|
+
rowIndex,
|
|
24439
|
+
column,
|
|
24440
|
+
classNames,
|
|
24441
|
+
renderCard
|
|
24442
|
+
}) {
|
|
24443
|
+
const { attributes, listeners, setNodeRef, isDragging } = core.useDraggable({ id: rowId });
|
|
24444
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24445
|
+
"div",
|
|
24446
|
+
{
|
|
24447
|
+
ref: setNodeRef,
|
|
24448
|
+
...listeners,
|
|
24449
|
+
...attributes,
|
|
24450
|
+
className: cn("touch-none", classNames?.cardWrapper),
|
|
24451
|
+
children: renderCard(row, { row, rowIndex, column, isDragging, isOverlay: false })
|
|
24452
|
+
}
|
|
24453
|
+
);
|
|
24454
|
+
}
|
|
24455
|
+
function WorkbenchLaneColumnView({
|
|
24456
|
+
column,
|
|
24457
|
+
columnRows,
|
|
24458
|
+
columnWidth,
|
|
24459
|
+
columnMinHeight,
|
|
24460
|
+
emptyColumn,
|
|
24461
|
+
classNames,
|
|
24462
|
+
renderCard
|
|
24463
|
+
}) {
|
|
24464
|
+
const { setNodeRef, isOver } = core.useDroppable({ id: column.id });
|
|
24465
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24466
|
+
"section",
|
|
24467
|
+
{
|
|
24468
|
+
className: cn(
|
|
24469
|
+
"flex shrink-0 flex-col rounded-xl border border-border/60 bg-card p-2 shadow-sm",
|
|
24470
|
+
classNames?.column,
|
|
24471
|
+
column.className
|
|
24472
|
+
),
|
|
24473
|
+
style: { width: toCssSize5(columnWidth) ?? "280px" },
|
|
24474
|
+
children: [
|
|
24475
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex h-10 items-center gap-2 px-1", classNames?.columnHeader, column.headerClassName), children: [
|
|
24476
|
+
column.icon ? /* @__PURE__ */ jsxRuntime.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,
|
|
24477
|
+
/* @__PURE__ */ jsxRuntime.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 }),
|
|
24478
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs text-muted-foreground", classNames?.columnCount), children: columnRows.length })
|
|
24479
|
+
] }),
|
|
24480
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24481
|
+
"div",
|
|
24482
|
+
{
|
|
24483
|
+
ref: setNodeRef,
|
|
24484
|
+
className: cn(
|
|
24485
|
+
"mt-1 flex min-h-[200px] flex-1 flex-col gap-2 overflow-y-auto rounded-lg p-1 transition-colors [scrollbar-width:thin]",
|
|
24486
|
+
isOver && "bg-accent/60",
|
|
24487
|
+
classNames?.columnBody,
|
|
24488
|
+
column.bodyClassName
|
|
24489
|
+
),
|
|
24490
|
+
style: { minHeight: toCssSize5(columnMinHeight) },
|
|
24491
|
+
children: columnRows.length ? columnRows.map(({ row, rowIndex, rowId }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24492
|
+
WorkbenchLaneDraggableCard,
|
|
24493
|
+
{
|
|
24494
|
+
row,
|
|
24495
|
+
rowId,
|
|
24496
|
+
rowIndex,
|
|
24497
|
+
column,
|
|
24498
|
+
classNames,
|
|
24499
|
+
renderCard
|
|
24500
|
+
},
|
|
24501
|
+
rowId
|
|
24502
|
+
)) : emptyColumn ? /* @__PURE__ */ jsxRuntime.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
|
|
24503
|
+
}
|
|
24504
|
+
)
|
|
24505
|
+
]
|
|
24506
|
+
}
|
|
24507
|
+
);
|
|
24508
|
+
}
|
|
24509
|
+
function WorkbenchLaneView({
|
|
24510
|
+
rows = [],
|
|
24511
|
+
columns = [],
|
|
24512
|
+
getRowId = defaultGetRowId,
|
|
24513
|
+
getColumnId = defaultGetColumnId,
|
|
24514
|
+
renderCard = defaultRenderCard,
|
|
24515
|
+
renderOverlayCard,
|
|
24516
|
+
onMoveRow,
|
|
24517
|
+
emptyColumn,
|
|
24518
|
+
activationDistance = 5,
|
|
24519
|
+
columnWidth = 280,
|
|
24520
|
+
columnMinHeight,
|
|
24521
|
+
className,
|
|
24522
|
+
classNames,
|
|
24523
|
+
style
|
|
24524
|
+
}) {
|
|
24525
|
+
const [activeRowId, setActiveRowId] = React.useState(null);
|
|
24526
|
+
const sensors = core.useSensors(core.useSensor(core.PointerSensor, { activationConstraint: { distance: activationDistance } }));
|
|
24527
|
+
const columnMap = React.useMemo(() => new Map(columns.map((column) => [column.id, column])), [columns]);
|
|
24528
|
+
const rowEntries = React.useMemo(() => rows.map((row, rowIndex) => ({
|
|
24529
|
+
row,
|
|
24530
|
+
rowIndex,
|
|
24531
|
+
rowId: getRowId(row, rowIndex),
|
|
24532
|
+
columnId: getColumnId(row, rowIndex)
|
|
24533
|
+
})), [getColumnId, getRowId, rows]);
|
|
24534
|
+
const activeEntry = activeRowId ? rowEntries.find((entry) => entry.rowId === activeRowId) : void 0;
|
|
24535
|
+
const rowsByColumn = React.useMemo(() => {
|
|
24536
|
+
const next = /* @__PURE__ */ new Map();
|
|
24537
|
+
columns.forEach((column) => next.set(column.id, []));
|
|
24538
|
+
rowEntries.forEach(({ row, rowIndex, rowId, columnId }) => {
|
|
24539
|
+
next.get(columnId)?.push({ row, rowIndex, rowId });
|
|
24540
|
+
});
|
|
24541
|
+
return next;
|
|
24542
|
+
}, [columns, rowEntries]);
|
|
24543
|
+
const activeColumn = activeEntry ? columnMap.get(activeEntry.columnId) : void 0;
|
|
24544
|
+
const handleDragStart = React.useCallback((event) => {
|
|
24545
|
+
setActiveRowId(String(event.active.id));
|
|
24546
|
+
}, []);
|
|
24547
|
+
const handleDragEnd = React.useCallback((event) => {
|
|
24548
|
+
setActiveRowId(null);
|
|
24549
|
+
const rowId = String(event.active.id);
|
|
24550
|
+
const nextColumnId = String(event.over?.id ?? "");
|
|
24551
|
+
const activeRow = rowEntries.find((entry) => entry.rowId === rowId);
|
|
24552
|
+
if (!activeRow || !columnMap.has(nextColumnId) || activeRow.columnId === nextColumnId) return;
|
|
24553
|
+
onMoveRow?.(rowId, nextColumnId, activeRow.row);
|
|
24554
|
+
}, [columnMap, onMoveRow, rowEntries]);
|
|
24555
|
+
const handleDragCancel = React.useCallback(() => {
|
|
24556
|
+
setActiveRowId(null);
|
|
24557
|
+
}, []);
|
|
24558
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.DndContext, { sensors, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDragCancel: handleDragCancel, children: [
|
|
24559
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24560
|
+
"div",
|
|
24561
|
+
{
|
|
24562
|
+
className: cn("flex min-h-0 flex-1 gap-4 overflow-x-auto p-4 [scrollbar-width:thin]", classNames?.root, className),
|
|
24563
|
+
style,
|
|
24564
|
+
children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24565
|
+
WorkbenchLaneColumnView,
|
|
24566
|
+
{
|
|
24567
|
+
column,
|
|
24568
|
+
columnRows: rowsByColumn.get(column.id) || [],
|
|
24569
|
+
columnWidth,
|
|
24570
|
+
columnMinHeight,
|
|
24571
|
+
emptyColumn,
|
|
24572
|
+
classNames,
|
|
24573
|
+
renderCard
|
|
24574
|
+
},
|
|
24575
|
+
column.id
|
|
24576
|
+
))
|
|
24577
|
+
}
|
|
24578
|
+
),
|
|
24579
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.DragOverlay, { children: activeEntry && activeColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(classNames?.overlayWrapper), children: (renderOverlayCard || renderCard)(activeEntry.row, {
|
|
24580
|
+
row: activeEntry.row,
|
|
24581
|
+
rowIndex: activeEntry.rowIndex,
|
|
24582
|
+
column: activeColumn,
|
|
24583
|
+
isDragging: false,
|
|
24584
|
+
isOverlay: true
|
|
24585
|
+
}) }) : null })
|
|
24586
|
+
] });
|
|
24587
|
+
}
|
|
22810
24588
|
function cn4(...inputs) {
|
|
22811
24589
|
return inputs.filter(Boolean).join(" ");
|
|
22812
24590
|
}
|
|
@@ -23134,7 +24912,12 @@ exports.BaseDropdownMenu = BaseDropdownMenu;
|
|
|
23134
24912
|
exports.BaseEmptyState = BaseEmptyState;
|
|
23135
24913
|
exports.BaseField = BaseField;
|
|
23136
24914
|
exports.BaseInput = BaseInput;
|
|
24915
|
+
exports.BaseLayout = BaseLayout;
|
|
24916
|
+
exports.BaseLayoutPane = BaseLayoutPane;
|
|
24917
|
+
exports.BaseLayoutResizeHandle = BaseLayoutResizeHandle;
|
|
24918
|
+
exports.BaseLayoutSplit = BaseLayoutSplit;
|
|
23137
24919
|
exports.BaseLoadingState = BaseLoadingState;
|
|
24920
|
+
exports.BaseMultiSelect = BaseMultiSelect;
|
|
23138
24921
|
exports.BaseNotice = BaseNotice;
|
|
23139
24922
|
exports.BasePagination = BasePagination;
|
|
23140
24923
|
exports.BasePanel = BasePanel;
|
|
@@ -23198,6 +24981,10 @@ exports.DefaultLandingPage = DefaultLandingPage;
|
|
|
23198
24981
|
exports.DynamicComponent = DynamicComponent;
|
|
23199
24982
|
exports.EmailAuth = EmailAuth;
|
|
23200
24983
|
exports.I18nSelector = I18nSelector;
|
|
24984
|
+
exports.InteractiveTable = InteractiveTable;
|
|
24985
|
+
exports.InteractiveTableEditableTextCell = InteractiveTableEditableTextCell;
|
|
24986
|
+
exports.InteractiveTableReadonlyCell = InteractiveTableReadonlyCell;
|
|
24987
|
+
exports.InteractiveTableSelectCell = InteractiveTableSelectCell;
|
|
23201
24988
|
exports.LoginLayout = LoginLayout;
|
|
23202
24989
|
exports.NavButton = NavButton;
|
|
23203
24990
|
exports.OAuthButton = OAuthButton;
|
|
@@ -23210,6 +24997,7 @@ exports.WorkbenchGalleryCard = WorkbenchGalleryCard;
|
|
|
23210
24997
|
exports.WorkbenchGallerySettingsButton = WorkbenchGallerySettingsButton;
|
|
23211
24998
|
exports.WorkbenchGallerySettingsPanel = WorkbenchGallerySettingsPanel;
|
|
23212
24999
|
exports.WorkbenchGalleryView = WorkbenchGalleryView;
|
|
25000
|
+
exports.WorkbenchLaneView = WorkbenchLaneView;
|
|
23213
25001
|
exports.WorkbenchMasonryLayout = WorkbenchMasonryLayout;
|
|
23214
25002
|
exports.WorkbenchResizableSidebar = WorkbenchResizableSidebar;
|
|
23215
25003
|
exports.WorkbenchTableView = WorkbenchTableView;
|