@inf-monkeys-tech/monkeys-design 0.4.31 → 0.4.33

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.
@@ -385,7 +385,41 @@ var baseSlots = {
385
385
  tableEmptyActions: "mt-4 flex flex-wrap items-center justify-center gap-2",
386
386
  tableLoadingRow: "border-b border-border/60",
387
387
  tableLoadingCell: "px-3 py-2",
388
- tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70"
388
+ tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70",
389
+ layoutRoot: cn(
390
+ "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",
391
+ motionBase
392
+ ),
393
+ layoutRootFull: "h-full min-h-0",
394
+ layoutHeader: "min-w-0",
395
+ layoutBody: "grid min-h-0 min-w-0 overflow-hidden gap-3",
396
+ layoutSidebar: "min-h-0 min-w-0 overflow-hidden",
397
+ layoutMain: "min-h-0 min-w-0 overflow-hidden",
398
+ layoutAside: "min-h-0 min-w-0 overflow-hidden",
399
+ layoutFooter: "min-w-0",
400
+ layoutPane: cn(
401
+ "h-full max-h-full min-h-0 min-w-0 overflow-hidden rounded-lg bg-background text-foreground",
402
+ motionBase
403
+ ),
404
+ layoutPaneScrollable: "overflow-auto",
405
+ layoutPaneBordered: "border border-border/70",
406
+ layoutPaneMuted: "bg-muted/25",
407
+ layoutPaneSoft: "bg-background/95 shadow-sm",
408
+ layoutPaneTransparent: "bg-transparent shadow-none",
409
+ layoutSplitRoot: "grid min-h-0 min-w-0 overflow-hidden",
410
+ layoutSplitHorizontal: "grid-flow-col",
411
+ layoutSplitVertical: "grid-flow-row",
412
+ layoutSplitPane: "min-h-0 min-w-0 overflow-hidden",
413
+ layoutSplitPrimary: "",
414
+ layoutSplitSecondary: "",
415
+ layoutResizeHandle: cn(
416
+ "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",
417
+ motionInteractive
418
+ ),
419
+ layoutResizeHandleHorizontal: "w-2 cursor-col-resize",
420
+ layoutResizeHandleVertical: "h-2 cursor-row-resize",
421
+ layoutResizeHandleDisabled: "cursor-default opacity-60",
422
+ layoutResizeHandleIndicator: "rounded-full bg-muted-foreground/45 group-hover/resize:bg-primary/70"
389
423
  };
390
424
  var densitySlots = {
391
425
  compact: {
@@ -459,7 +493,12 @@ var densitySlots = {
459
493
  tableCell: "px-2 py-1.5 text-xs",
460
494
  tableHeadLabel: "text-[11px]",
461
495
  tableHeadDescription: "text-[10px] leading-3",
462
- tableLoadingCell: "px-2 py-1.5"
496
+ tableLoadingCell: "px-2 py-1.5",
497
+ layoutRoot: "gap-2 p-2",
498
+ layoutBody: "gap-2",
499
+ layoutPane: "rounded-md text-xs",
500
+ layoutResizeHandleHorizontal: "w-1.5",
501
+ layoutResizeHandleVertical: "h-1.5"
463
502
  },
464
503
  default: {
465
504
  buttonBase: "h-9"
@@ -510,7 +549,12 @@ var densitySlots = {
510
549
  menuSubTrigger: "min-h-9 px-3 py-2",
511
550
  tableHead: "h-12 px-4 py-3",
512
551
  tableCell: "px-4 py-3",
513
- tableLoadingCell: "px-4 py-3"
552
+ tableLoadingCell: "px-4 py-3",
553
+ layoutRoot: "gap-4 p-4",
554
+ layoutBody: "gap-4",
555
+ layoutPane: "rounded-xl",
556
+ layoutResizeHandleHorizontal: "w-2.5",
557
+ layoutResizeHandleVertical: "h-2.5"
514
558
  }
515
559
  };
516
560
  var radiusSlots = {
@@ -554,7 +598,9 @@ var radiusSlots = {
554
598
  menuSubContent: "rounded-none",
555
599
  tableContainer: "rounded-none",
556
600
  tableEmptyIcon: "rounded-none",
557
- tableLoadingSkeleton: "rounded-none"
601
+ tableLoadingSkeleton: "rounded-none",
602
+ layoutRoot: "rounded-none",
603
+ layoutPane: "rounded-none"
558
604
  },
559
605
  sm: {
560
606
  buttonBase: "rounded-sm",
@@ -596,7 +642,9 @@ var radiusSlots = {
596
642
  menuSubContent: "rounded-sm",
597
643
  tableContainer: "rounded-sm",
598
644
  tableEmptyIcon: "rounded-sm",
599
- tableLoadingSkeleton: "rounded-sm"
645
+ tableLoadingSkeleton: "rounded-sm",
646
+ layoutRoot: "rounded-sm",
647
+ layoutPane: "rounded-sm"
600
648
  },
601
649
  md: {},
602
650
  lg: {
@@ -633,7 +681,9 @@ var radiusSlots = {
633
681
  menuSubContent: "rounded-lg",
634
682
  tableContainer: "rounded-xl",
635
683
  tableEmptyIcon: "rounded-xl",
636
- tableLoadingSkeleton: "rounded-lg"
684
+ tableLoadingSkeleton: "rounded-lg",
685
+ layoutRoot: "rounded-xl",
686
+ layoutPane: "rounded-xl"
637
687
  },
638
688
  xl: {
639
689
  buttonBase: "rounded-xl",
@@ -671,7 +721,9 @@ var radiusSlots = {
671
721
  menuSubContent: "rounded-xl",
672
722
  tableContainer: "rounded-2xl",
673
723
  tableEmptyIcon: "rounded-2xl",
674
- tableLoadingSkeleton: "rounded-xl"
724
+ tableLoadingSkeleton: "rounded-xl",
725
+ layoutRoot: "rounded-2xl",
726
+ layoutPane: "rounded-2xl"
675
727
  },
676
728
  full: {
677
729
  buttonBase: "rounded-full",
@@ -713,7 +765,9 @@ var radiusSlots = {
713
765
  menuSubContent: "rounded-2xl",
714
766
  tableContainer: "rounded-2xl",
715
767
  tableEmptyIcon: "rounded-full",
716
- tableLoadingSkeleton: "rounded-full"
768
+ tableLoadingSkeleton: "rounded-full",
769
+ layoutRoot: "rounded-2xl",
770
+ layoutPane: "rounded-2xl"
717
771
  }
718
772
  };
719
773
  var borderSlots = {
@@ -755,7 +809,10 @@ var borderSlots = {
755
809
  tableFooterBarAttached: "border-t border-transparent",
756
810
  tableRow: "border-transparent",
757
811
  tableEmptyRow: "border-transparent",
758
- tableLoadingRow: "border-transparent"
812
+ tableLoadingRow: "border-transparent",
813
+ layoutRoot: "border-transparent",
814
+ layoutPaneBordered: "border-transparent",
815
+ layoutResizeHandle: "bg-transparent hover:bg-transparent active:bg-transparent focus-visible:bg-transparent"
759
816
  },
760
817
  subtle: {
761
818
  buttonDefault: "border-border/60",
@@ -795,7 +852,9 @@ var borderSlots = {
795
852
  tableFooterBarAttached: "border-t border-border/60",
796
853
  tableRow: "border-border/50",
797
854
  tableEmptyRow: "border-border/50",
798
- tableLoadingRow: "border-border/50"
855
+ tableLoadingRow: "border-border/50",
856
+ layoutRoot: "border-border/60",
857
+ layoutPaneBordered: "border-border/60"
799
858
  },
800
859
  solid: {},
801
860
  strong: {
@@ -836,7 +895,10 @@ var borderSlots = {
836
895
  tableFooterBarAttached: "border-t border-foreground/20",
837
896
  tableRow: "border-foreground/15",
838
897
  tableEmptyRow: "border-foreground/15",
839
- tableLoadingRow: "border-foreground/15"
898
+ tableLoadingRow: "border-foreground/15",
899
+ layoutRoot: "border-foreground/20",
900
+ layoutPaneBordered: "border-foreground/20",
901
+ layoutResizeHandle: "hover:bg-foreground/15 active:bg-foreground/20 focus-visible:bg-foreground/15"
840
902
  }
841
903
  };
842
904
  var backgroundSlots = {
@@ -878,7 +940,11 @@ var backgroundSlots = {
878
940
  tableFooter: "bg-muted/35",
879
941
  tableFooterBar: "bg-muted/30 shadow-none",
880
942
  tableRowInteractive: "cursor-pointer hover:bg-muted/45",
881
- tableLoadingSkeleton: "bg-muted"
943
+ tableLoadingSkeleton: "bg-muted",
944
+ layoutRoot: "bg-card",
945
+ layoutPane: "bg-card",
946
+ layoutPaneMuted: "bg-muted/35",
947
+ layoutResizeHandle: "hover:bg-border/70 active:bg-border/80 focus-visible:bg-border/70"
882
948
  },
883
949
  soft: {
884
950
  buttonDefault: "bg-muted/30 hover:bg-muted/55",
@@ -914,7 +980,10 @@ var backgroundSlots = {
914
980
  tableFooter: "bg-muted/25",
915
981
  tableFooterBar: "bg-muted/25 shadow-none",
916
982
  tableRowInteractive: "cursor-pointer hover:bg-muted/35",
917
- tableLoadingSkeleton: "bg-muted/65"
983
+ tableLoadingSkeleton: "bg-muted/65",
984
+ layoutRoot: "bg-background/95 shadow-sm",
985
+ layoutPane: "bg-background/95 shadow-sm",
986
+ layoutPaneSoft: "bg-background/95 shadow-md"
918
987
  },
919
988
  glass: {
920
989
  buttonBase: "backdrop-blur-md",
@@ -975,7 +1044,13 @@ var backgroundSlots = {
975
1044
  tableRow: "border-white/10",
976
1045
  tableRowInteractive: "cursor-pointer hover:bg-white/[0.08]",
977
1046
  tableHeadLabel: "text-foreground",
978
- tableLoadingSkeleton: "bg-white/[0.16]"
1047
+ tableLoadingSkeleton: "bg-white/[0.16]",
1048
+ layoutRoot: "border-white/10 bg-white/[0.05] shadow-none backdrop-blur-md",
1049
+ layoutPane: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
1050
+ layoutPaneMuted: "bg-white/[0.08]",
1051
+ layoutPaneSoft: "bg-white/[0.10] shadow-none backdrop-blur-md",
1052
+ layoutResizeHandle: "text-foreground/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
1053
+ layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
979
1054
  },
980
1055
  dark: {
981
1056
  buttonBase: "border-white/15 text-white shadow-lg backdrop-blur",
@@ -1104,7 +1179,13 @@ var backgroundSlots = {
1104
1179
  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]",
1105
1180
  menuSubTriggerIcon: "text-white/55",
1106
1181
  menuSubContent: "border-white/10 bg-slate-950 text-white shadow-2xl",
1107
- tableLoadingSkeleton: "bg-white/[0.14]"
1182
+ tableLoadingSkeleton: "bg-white/[0.14]",
1183
+ layoutRoot: "border-white/10 bg-slate-950 text-white shadow-none",
1184
+ layoutPane: "border-white/10 bg-slate-950 text-white shadow-none",
1185
+ layoutPaneMuted: "bg-white/[0.06]",
1186
+ layoutPaneSoft: "bg-white/[0.08] shadow-none",
1187
+ layoutResizeHandle: "text-white/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
1188
+ layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
1108
1189
  }
1109
1190
  };
1110
1191
  var presetDefaults = {
@@ -2962,6 +3043,432 @@ var BaseInput = react.forwardRef(
2962
3043
  );
2963
3044
  }
2964
3045
  );
3046
+ var DEFAULT_SPLIT_SIZE = 50;
3047
+ var DEFAULT_MIN_SIZE = 20;
3048
+ var DEFAULT_MAX_SIZE = 80;
3049
+ var DEFAULT_KEYBOARD_STEP = 2.5;
3050
+ function toCssSize(value, fallback) {
3051
+ if (typeof value === "number") {
3052
+ if (!Number.isFinite(value) || value < 0) {
3053
+ throw new Error("BaseLayout size and gap props must be finite, non-negative numbers.");
3054
+ }
3055
+ return `${value}px`;
3056
+ }
3057
+ return value ?? fallback;
3058
+ }
3059
+ function assertPercent(name, value) {
3060
+ if (!Number.isFinite(value)) {
3061
+ throw new Error(`BaseLayoutSplit ${name} must be a finite number.`);
3062
+ }
3063
+ if (value < 0 || value > 100) {
3064
+ throw new Error(`BaseLayoutSplit ${name} must be between 0 and 100.`);
3065
+ }
3066
+ return value;
3067
+ }
3068
+ function clamp(value, min, max) {
3069
+ return Math.min(Math.max(value, min), max);
3070
+ }
3071
+ function resolveSplitBounds({
3072
+ minSize = DEFAULT_MIN_SIZE,
3073
+ maxSize = DEFAULT_MAX_SIZE,
3074
+ keyboardStep = DEFAULT_KEYBOARD_STEP
3075
+ }) {
3076
+ const min = assertPercent("minSize", minSize);
3077
+ const max = assertPercent("maxSize", maxSize);
3078
+ if (min > max) {
3079
+ throw new Error("BaseLayoutSplit minSize cannot be greater than maxSize.");
3080
+ }
3081
+ if (!Number.isFinite(keyboardStep) || keyboardStep <= 0) {
3082
+ throw new Error("BaseLayoutSplit keyboardStep must be a finite positive number.");
3083
+ }
3084
+ return { min, max, keyboardStep };
3085
+ }
3086
+ function resolveSplitSize(name, value, fallback, min, max) {
3087
+ return clamp(assertPercent(name, value ?? fallback), min, max);
3088
+ }
3089
+ function getSeparatorOrientation(orientation) {
3090
+ return orientation === "horizontal" ? "vertical" : "horizontal";
3091
+ }
3092
+ function BaseLayout({
3093
+ header,
3094
+ sidebar,
3095
+ aside,
3096
+ footer,
3097
+ children,
3098
+ sidebarSize,
3099
+ asideSize,
3100
+ gap,
3101
+ fullHeight,
3102
+ appearance,
3103
+ className,
3104
+ classNames,
3105
+ style,
3106
+ ...layoutProps
3107
+ }) {
3108
+ const theme = resolveBaseAppearance(appearance);
3109
+ const hasHeader = hasRenderableNode(header);
3110
+ const hasSidebar = hasRenderableNode(sidebar);
3111
+ const hasAside = hasRenderableNode(aside);
3112
+ const hasFooter = hasRenderableNode(footer);
3113
+ const bodyColumns = [
3114
+ hasSidebar ? "var(--base-layout-sidebar-size)" : void 0,
3115
+ "minmax(0, 1fr)",
3116
+ hasAside ? "var(--base-layout-aside-size)" : void 0
3117
+ ].filter(Boolean).join(" ");
3118
+ const layoutRows = [
3119
+ hasHeader ? "auto" : void 0,
3120
+ "minmax(0, 1fr)",
3121
+ hasFooter ? "auto" : void 0
3122
+ ].filter(Boolean).join(" ");
3123
+ const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
3124
+ const layoutStyle = {
3125
+ ...theme.styles.layout,
3126
+ "--base-layout-sidebar-size": toCssSize(sidebarSize, "16rem"),
3127
+ "--base-layout-aside-size": toCssSize(asideSize, "20rem"),
3128
+ gridTemplateRows: layoutRows,
3129
+ ...resolvedGap !== void 0 ? { gap: resolvedGap } : {},
3130
+ ...style
3131
+ };
3132
+ const bodyStyle = {
3133
+ ...theme.styles.layoutBody,
3134
+ gridTemplateColumns: bodyColumns,
3135
+ ...resolvedGap !== void 0 ? { gap: resolvedGap } : {}
3136
+ };
3137
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3138
+ "div",
3139
+ {
3140
+ ...layoutProps,
3141
+ className: cn(
3142
+ theme.slots.layoutRoot,
3143
+ fullHeight && theme.slots.layoutRootFull,
3144
+ classNames?.root,
3145
+ className
3146
+ ),
3147
+ style: layoutStyle,
3148
+ children: [
3149
+ hasHeader ? /* @__PURE__ */ jsxRuntime.jsx(
3150
+ "div",
3151
+ {
3152
+ className: cn(theme.slots.layoutHeader, classNames?.header),
3153
+ style: theme.styles.layoutHeader,
3154
+ children: header
3155
+ }
3156
+ ) : null,
3157
+ /* @__PURE__ */ jsxRuntime.jsxs(
3158
+ "div",
3159
+ {
3160
+ className: cn(theme.slots.layoutBody, classNames?.body),
3161
+ style: bodyStyle,
3162
+ children: [
3163
+ hasSidebar ? /* @__PURE__ */ jsxRuntime.jsx(
3164
+ "aside",
3165
+ {
3166
+ className: cn(theme.slots.layoutSidebar, classNames?.sidebar),
3167
+ style: theme.styles.layoutSidebar,
3168
+ children: sidebar
3169
+ }
3170
+ ) : null,
3171
+ /* @__PURE__ */ jsxRuntime.jsx(
3172
+ "main",
3173
+ {
3174
+ className: cn(theme.slots.layoutMain, classNames?.main),
3175
+ style: theme.styles.layoutMain,
3176
+ children
3177
+ }
3178
+ ),
3179
+ hasAside ? /* @__PURE__ */ jsxRuntime.jsx(
3180
+ "aside",
3181
+ {
3182
+ className: cn(theme.slots.layoutAside, classNames?.aside),
3183
+ style: theme.styles.layoutAside,
3184
+ children: aside
3185
+ }
3186
+ ) : null
3187
+ ]
3188
+ }
3189
+ ),
3190
+ hasFooter ? /* @__PURE__ */ jsxRuntime.jsx(
3191
+ "div",
3192
+ {
3193
+ className: cn(theme.slots.layoutFooter, classNames?.footer),
3194
+ style: theme.styles.layoutFooter,
3195
+ children: footer
3196
+ }
3197
+ ) : null
3198
+ ]
3199
+ }
3200
+ );
3201
+ }
3202
+ function BaseLayoutPane({
3203
+ as = "div",
3204
+ scrollable = false,
3205
+ bordered = true,
3206
+ surface = "default",
3207
+ children,
3208
+ appearance,
3209
+ className,
3210
+ classNames,
3211
+ style,
3212
+ ...paneProps
3213
+ }) {
3214
+ const theme = resolveBaseAppearance(appearance);
3215
+ const Component = as;
3216
+ return /* @__PURE__ */ jsxRuntime.jsx(
3217
+ Component,
3218
+ {
3219
+ ...paneProps,
3220
+ className: cn(
3221
+ theme.slots.layoutPane,
3222
+ scrollable && theme.slots.layoutPaneScrollable,
3223
+ bordered && theme.slots.layoutPaneBordered,
3224
+ surface === "muted" && theme.slots.layoutPaneMuted,
3225
+ surface === "soft" && theme.slots.layoutPaneSoft,
3226
+ surface === "transparent" && theme.slots.layoutPaneTransparent,
3227
+ classNames?.root,
3228
+ className
3229
+ ),
3230
+ style: {
3231
+ ...theme.styles.layoutPane,
3232
+ ...style
3233
+ },
3234
+ children
3235
+ }
3236
+ );
3237
+ }
3238
+ function BaseLayoutResizeHandle({
3239
+ orientation = "horizontal",
3240
+ resizable = false,
3241
+ disabled = false,
3242
+ size,
3243
+ minSize,
3244
+ maxSize,
3245
+ label = "Resize panels",
3246
+ appearance,
3247
+ className,
3248
+ classNames,
3249
+ style,
3250
+ tabIndex,
3251
+ ...handleProps
3252
+ }) {
3253
+ const theme = resolveBaseAppearance(appearance);
3254
+ const interactive = resizable && !disabled;
3255
+ const separatorOrientation = getSeparatorOrientation(orientation);
3256
+ return /* @__PURE__ */ jsxRuntime.jsx(
3257
+ "div",
3258
+ {
3259
+ ...handleProps,
3260
+ role: interactive ? "separator" : void 0,
3261
+ "aria-label": interactive ? label : void 0,
3262
+ "aria-orientation": interactive ? separatorOrientation : void 0,
3263
+ "aria-valuemin": interactive ? minSize : void 0,
3264
+ "aria-valuemax": interactive ? maxSize : void 0,
3265
+ "aria-valuenow": interactive ? size : void 0,
3266
+ "aria-disabled": interactive ? void 0 : true,
3267
+ tabIndex: interactive ? tabIndex ?? 0 : void 0,
3268
+ className: cn(
3269
+ theme.slots.layoutResizeHandle,
3270
+ orientation === "horizontal" ? theme.slots.layoutResizeHandleHorizontal : theme.slots.layoutResizeHandleVertical,
3271
+ !interactive && theme.slots.layoutResizeHandleDisabled,
3272
+ classNames?.root,
3273
+ className
3274
+ ),
3275
+ style: {
3276
+ ...theme.styles.layoutResizeHandle,
3277
+ ...style
3278
+ },
3279
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3280
+ "span",
3281
+ {
3282
+ "aria-hidden": "true",
3283
+ className: cn(
3284
+ theme.slots.layoutResizeHandleIndicator,
3285
+ orientation === "horizontal" ? "h-8 w-px" : "h-px w-8",
3286
+ classNames?.indicator
3287
+ )
3288
+ }
3289
+ )
3290
+ }
3291
+ );
3292
+ }
3293
+ function BaseLayoutSplit({
3294
+ orientation = "horizontal",
3295
+ primary,
3296
+ secondary,
3297
+ children,
3298
+ resizable = false,
3299
+ size,
3300
+ defaultSize,
3301
+ minSize,
3302
+ maxSize,
3303
+ gap,
3304
+ keyboardStep,
3305
+ resizeLabel,
3306
+ appearance,
3307
+ className,
3308
+ classNames,
3309
+ style,
3310
+ onSizeChange,
3311
+ ...splitProps
3312
+ }) {
3313
+ const theme = resolveBaseAppearance(appearance);
3314
+ const bounds = resolveSplitBounds({ minSize, maxSize, keyboardStep });
3315
+ const initialSize = resolveSplitSize(
3316
+ "defaultSize",
3317
+ defaultSize,
3318
+ DEFAULT_SPLIT_SIZE,
3319
+ bounds.min,
3320
+ bounds.max
3321
+ );
3322
+ const [uncontrolledSize, setUncontrolledSize] = react.useState(initialSize);
3323
+ const rootRef = react.useRef(null);
3324
+ const cleanupRef = react.useRef(null);
3325
+ const controlled = size !== void 0;
3326
+ const renderedSize = resolveSplitSize(
3327
+ "size",
3328
+ controlled ? size : uncontrolledSize,
3329
+ initialSize,
3330
+ bounds.min,
3331
+ bounds.max
3332
+ );
3333
+ const commitSize = react.useCallback(
3334
+ (nextSize) => {
3335
+ const clampedSize = clamp(nextSize, bounds.min, bounds.max);
3336
+ if (!controlled) {
3337
+ setUncontrolledSize(clampedSize);
3338
+ }
3339
+ onSizeChange?.(clampedSize);
3340
+ },
3341
+ [bounds.max, bounds.min, controlled, onSizeChange]
3342
+ );
3343
+ const updateFromPointer = react.useCallback(
3344
+ (event) => {
3345
+ const root = rootRef.current;
3346
+ if (!root) return;
3347
+ const rect = root.getBoundingClientRect();
3348
+ const total = orientation === "horizontal" ? rect.width : rect.height;
3349
+ if (total <= 0) return;
3350
+ const offset = orientation === "horizontal" ? event.clientX - rect.left : event.clientY - rect.top;
3351
+ commitSize(offset / total * 100);
3352
+ },
3353
+ [commitSize, orientation]
3354
+ );
3355
+ const stopResize = react.useCallback(() => {
3356
+ cleanupRef.current?.();
3357
+ cleanupRef.current = null;
3358
+ }, []);
3359
+ react.useEffect(() => stopResize, [stopResize]);
3360
+ const handlePointerDown = (event) => {
3361
+ if (!resizable) return;
3362
+ event.preventDefault();
3363
+ stopResize();
3364
+ updateFromPointer(event);
3365
+ const handleMove = (nextEvent) => {
3366
+ updateFromPointer(nextEvent);
3367
+ };
3368
+ const handleStop = () => {
3369
+ stopResize();
3370
+ };
3371
+ window.addEventListener("pointermove", handleMove);
3372
+ window.addEventListener("pointerup", handleStop, { once: true });
3373
+ window.addEventListener("pointercancel", handleStop, { once: true });
3374
+ cleanupRef.current = () => {
3375
+ window.removeEventListener("pointermove", handleMove);
3376
+ window.removeEventListener("pointerup", handleStop);
3377
+ window.removeEventListener("pointercancel", handleStop);
3378
+ };
3379
+ };
3380
+ const handleKeyDown = (event) => {
3381
+ if (!resizable) return;
3382
+ const step = event.shiftKey ? bounds.keyboardStep * 4 : bounds.keyboardStep;
3383
+ let nextSize;
3384
+ if (event.key === "Home") nextSize = bounds.min;
3385
+ if (event.key === "End") nextSize = bounds.max;
3386
+ if (orientation === "horizontal" && event.key === "ArrowLeft") {
3387
+ nextSize = renderedSize - step;
3388
+ }
3389
+ if (orientation === "horizontal" && event.key === "ArrowRight") {
3390
+ nextSize = renderedSize + step;
3391
+ }
3392
+ if (orientation === "vertical" && event.key === "ArrowUp") {
3393
+ nextSize = renderedSize - step;
3394
+ }
3395
+ if (orientation === "vertical" && event.key === "ArrowDown") {
3396
+ nextSize = renderedSize + step;
3397
+ }
3398
+ if (nextSize === void 0) return;
3399
+ event.preventDefault();
3400
+ commitSize(nextSize);
3401
+ };
3402
+ const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
3403
+ const resizeTrack = resolvedGap !== void 0 ? "var(--base-layout-split-gap)" : "auto";
3404
+ const resizeHandleStyle = resolvedGap !== void 0 ? orientation === "horizontal" ? { width: "var(--base-layout-split-gap)" } : { height: "var(--base-layout-split-gap)" } : void 0;
3405
+ const splitStyle = {
3406
+ ...theme.styles.layoutSplit,
3407
+ [orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: resizable ? `${renderedSize}% ${resizeTrack} minmax(0, 1fr)` : `${renderedSize}% minmax(0, 1fr)`,
3408
+ ...resizable ? { gap: 0 } : {},
3409
+ ...resolvedGap !== void 0 ? {
3410
+ "--base-layout-split-gap": resolvedGap,
3411
+ ...resizable ? {} : { gap: resolvedGap }
3412
+ } : {},
3413
+ ...style
3414
+ };
3415
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3416
+ "div",
3417
+ {
3418
+ ...splitProps,
3419
+ ref: rootRef,
3420
+ className: cn(
3421
+ theme.slots.layoutSplitRoot,
3422
+ orientation === "horizontal" ? theme.slots.layoutSplitHorizontal : theme.slots.layoutSplitVertical,
3423
+ classNames?.root,
3424
+ className
3425
+ ),
3426
+ style: splitStyle,
3427
+ children: [
3428
+ /* @__PURE__ */ jsxRuntime.jsx(
3429
+ "div",
3430
+ {
3431
+ className: cn(
3432
+ theme.slots.layoutSplitPane,
3433
+ theme.slots.layoutSplitPrimary,
3434
+ classNames?.primary
3435
+ ),
3436
+ style: theme.styles.layoutSplitPane,
3437
+ children: hasRenderableNode(primary) ? primary : children
3438
+ }
3439
+ ),
3440
+ resizable ? /* @__PURE__ */ jsxRuntime.jsx(
3441
+ BaseLayoutResizeHandle,
3442
+ {
3443
+ orientation,
3444
+ resizable: true,
3445
+ size: renderedSize,
3446
+ minSize: bounds.min,
3447
+ maxSize: bounds.max,
3448
+ label: resizeLabel,
3449
+ appearance,
3450
+ className: classNames?.handle,
3451
+ style: resizeHandleStyle,
3452
+ onPointerDown: handlePointerDown,
3453
+ onKeyDown: handleKeyDown
3454
+ }
3455
+ ) : null,
3456
+ /* @__PURE__ */ jsxRuntime.jsx(
3457
+ "div",
3458
+ {
3459
+ className: cn(
3460
+ theme.slots.layoutSplitPane,
3461
+ theme.slots.layoutSplitSecondary,
3462
+ classNames?.secondary
3463
+ ),
3464
+ style: theme.styles.layoutSplitPane,
3465
+ children: secondary
3466
+ }
3467
+ )
3468
+ ]
3469
+ }
3470
+ );
3471
+ }
2965
3472
  function DefaultLoadingIcon({ className }) {
2966
3473
  return /* @__PURE__ */ jsxRuntime.jsxs(
2967
3474
  "svg",
@@ -3251,7 +3758,7 @@ function BasePagination({
3251
3758
  function toFiniteNumber(value, fallback) {
3252
3759
  return Number.isFinite(value) ? Number(value) : fallback;
3253
3760
  }
3254
- function clamp(value, min, max) {
3761
+ function clamp2(value, min, max) {
3255
3762
  return Math.min(Math.max(value, min), max);
3256
3763
  }
3257
3764
  function BaseProgress({
@@ -3269,7 +3776,7 @@ function BaseProgress({
3269
3776
  }) {
3270
3777
  const theme = resolveBaseAppearance(appearance);
3271
3778
  const safeMax = Math.max(toFiniteNumber(max, 100), 1);
3272
- const safeValue = clamp(toFiniteNumber(value, 0), 0, safeMax);
3779
+ const safeValue = clamp2(toFiniteNumber(value, 0), 0, safeMax);
3273
3780
  const percent = safeValue / safeMax * 100;
3274
3781
  const renderedValue = valueFormatter?.(safeValue, safeMax) ?? `${Math.round(percent)}%`;
3275
3782
  const hasLabelRow = hasRenderableNode(label) || showValue;
@@ -4035,7 +4542,7 @@ function useBaseTableContext(appearance) {
4035
4542
  }
4036
4543
  };
4037
4544
  }
4038
- function toCssSize(value) {
4545
+ function toCssSize2(value) {
4039
4546
  if (value === void 0) return void 0;
4040
4547
  return typeof value === "number" ? `${value}px` : value;
4041
4548
  }
@@ -4248,7 +4755,7 @@ function BaseTableRow({
4248
4755
  }
4249
4756
  );
4250
4757
  }
4251
- function BaseTableHead({
4758
+ var BaseTableHead = react.forwardRef(function BaseTableHead2({
4252
4759
  columnId,
4253
4760
  align = "left",
4254
4761
  icon,
@@ -4276,10 +4783,18 @@ function BaseTableHead({
4276
4783
  onDragOver,
4277
4784
  onDrop,
4278
4785
  ...headProps
4279
- }) {
4786
+ }, forwardedRef) {
4280
4787
  const tableContext = useBaseTableContext(appearance);
4281
4788
  const { theme } = tableContext;
4282
4789
  const headRef = react.useRef(null);
4790
+ const setHeadRef = (node) => {
4791
+ headRef.current = node;
4792
+ if (typeof forwardedRef === "function") {
4793
+ forwardedRef(node);
4794
+ } else if (forwardedRef) {
4795
+ forwardedRef.current = node;
4796
+ }
4797
+ };
4283
4798
  const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
4284
4799
  const canDrag = Boolean(
4285
4800
  columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
@@ -4434,7 +4949,7 @@ function BaseTableHead({
4434
4949
  "th",
4435
4950
  {
4436
4951
  ...headProps,
4437
- ref: headRef,
4952
+ ref: setHeadRef,
4438
4953
  scope: headProps.scope ?? "col",
4439
4954
  "aria-sort": ariaSort,
4440
4955
  className: cn(
@@ -4446,9 +4961,9 @@ function BaseTableHead({
4446
4961
  ),
4447
4962
  style: {
4448
4963
  ...theme.styles.tableHead,
4449
- width: toCssSize(controlledWidth),
4450
- minWidth: toCssSize(minWidth),
4451
- maxWidth: toCssSize(maxWidth),
4964
+ width: toCssSize2(controlledWidth),
4965
+ minWidth: toCssSize2(minWidth),
4966
+ maxWidth: toCssSize2(maxWidth),
4452
4967
  ...style
4453
4968
  },
4454
4969
  onDragOver: handleDragOver,
@@ -4469,7 +4984,7 @@ function BaseTableHead({
4469
4984
  ]
4470
4985
  }
4471
4986
  );
4472
- }
4987
+ });
4473
4988
  function BaseTableCell({
4474
4989
  align = "left",
4475
4990
  appearance,
@@ -4597,7 +5112,7 @@ function BaseTableLoading({
4597
5112
  classNames?.skeleton
4598
5113
  ),
4599
5114
  style: {
4600
- width: toCssSize(columnWidths[columnIndex])
5115
+ width: toCssSize2(columnWidths[columnIndex])
4601
5116
  }
4602
5117
  }
4603
5118
  )
@@ -4928,6 +5443,10 @@ exports.BaseDropdownMenu = BaseDropdownMenu;
4928
5443
  exports.BaseEmptyState = BaseEmptyState;
4929
5444
  exports.BaseField = BaseField;
4930
5445
  exports.BaseInput = BaseInput;
5446
+ exports.BaseLayout = BaseLayout;
5447
+ exports.BaseLayoutPane = BaseLayoutPane;
5448
+ exports.BaseLayoutResizeHandle = BaseLayoutResizeHandle;
5449
+ exports.BaseLayoutSplit = BaseLayoutSplit;
4931
5450
  exports.BaseLoadingState = BaseLoadingState;
4932
5451
  exports.BaseNotice = BaseNotice;
4933
5452
  exports.BasePagination = BasePagination;