@inf-monkeys-tech/monkeys-design 0.4.32 → 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.
@@ -1,4 +1,4 @@
1
- import { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext } from 'react';
1
+ import { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext, useContext } from 'react';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import '@radix-ui/react-context-menu';
4
4
  import '@radix-ui/react-dropdown-menu';
@@ -8546,7 +8546,41 @@ var baseSlots = {
8546
8546
  tableEmptyActions: "mt-4 flex flex-wrap items-center justify-center gap-2",
8547
8547
  tableLoadingRow: "border-b border-border/60",
8548
8548
  tableLoadingCell: "px-3 py-2",
8549
- tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70"
8549
+ tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70",
8550
+ layoutRoot: cn(
8551
+ "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",
8552
+ motionBase
8553
+ ),
8554
+ layoutRootFull: "h-full min-h-0",
8555
+ layoutHeader: "min-w-0",
8556
+ layoutBody: "grid min-h-0 min-w-0 overflow-hidden gap-3",
8557
+ layoutSidebar: "min-h-0 min-w-0 overflow-hidden",
8558
+ layoutMain: "min-h-0 min-w-0 overflow-hidden",
8559
+ layoutAside: "min-h-0 min-w-0 overflow-hidden",
8560
+ layoutFooter: "min-w-0",
8561
+ layoutPane: cn(
8562
+ "h-full max-h-full min-h-0 min-w-0 overflow-hidden rounded-lg bg-background text-foreground",
8563
+ motionBase
8564
+ ),
8565
+ layoutPaneScrollable: "overflow-auto",
8566
+ layoutPaneBordered: "border border-border/70",
8567
+ layoutPaneMuted: "bg-muted/25",
8568
+ layoutPaneSoft: "bg-background/95 shadow-sm",
8569
+ layoutPaneTransparent: "bg-transparent shadow-none",
8570
+ layoutSplitRoot: "grid min-h-0 min-w-0 overflow-hidden",
8571
+ layoutSplitHorizontal: "grid-flow-col",
8572
+ layoutSplitVertical: "grid-flow-row",
8573
+ layoutSplitPane: "min-h-0 min-w-0 overflow-hidden",
8574
+ layoutSplitPrimary: "",
8575
+ layoutSplitSecondary: "",
8576
+ layoutResizeHandle: cn(
8577
+ "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",
8578
+ motionInteractive
8579
+ ),
8580
+ layoutResizeHandleHorizontal: "w-2 cursor-col-resize",
8581
+ layoutResizeHandleVertical: "h-2 cursor-row-resize",
8582
+ layoutResizeHandleDisabled: "cursor-default opacity-60",
8583
+ layoutResizeHandleIndicator: "rounded-full bg-muted-foreground/45 group-hover/resize:bg-primary/70"
8550
8584
  };
8551
8585
  var densitySlots = {
8552
8586
  compact: {
@@ -8620,7 +8654,12 @@ var densitySlots = {
8620
8654
  tableCell: "px-2 py-1.5 text-xs",
8621
8655
  tableHeadLabel: "text-[11px]",
8622
8656
  tableHeadDescription: "text-[10px] leading-3",
8623
- tableLoadingCell: "px-2 py-1.5"
8657
+ tableLoadingCell: "px-2 py-1.5",
8658
+ layoutRoot: "gap-2 p-2",
8659
+ layoutBody: "gap-2",
8660
+ layoutPane: "rounded-md text-xs",
8661
+ layoutResizeHandleHorizontal: "w-1.5",
8662
+ layoutResizeHandleVertical: "h-1.5"
8624
8663
  },
8625
8664
  default: {
8626
8665
  buttonBase: "h-9"
@@ -8671,7 +8710,12 @@ var densitySlots = {
8671
8710
  menuSubTrigger: "min-h-9 px-3 py-2",
8672
8711
  tableHead: "h-12 px-4 py-3",
8673
8712
  tableCell: "px-4 py-3",
8674
- tableLoadingCell: "px-4 py-3"
8713
+ tableLoadingCell: "px-4 py-3",
8714
+ layoutRoot: "gap-4 p-4",
8715
+ layoutBody: "gap-4",
8716
+ layoutPane: "rounded-xl",
8717
+ layoutResizeHandleHorizontal: "w-2.5",
8718
+ layoutResizeHandleVertical: "h-2.5"
8675
8719
  }
8676
8720
  };
8677
8721
  var radiusSlots = {
@@ -8715,7 +8759,9 @@ var radiusSlots = {
8715
8759
  menuSubContent: "rounded-none",
8716
8760
  tableContainer: "rounded-none",
8717
8761
  tableEmptyIcon: "rounded-none",
8718
- tableLoadingSkeleton: "rounded-none"
8762
+ tableLoadingSkeleton: "rounded-none",
8763
+ layoutRoot: "rounded-none",
8764
+ layoutPane: "rounded-none"
8719
8765
  },
8720
8766
  sm: {
8721
8767
  buttonBase: "rounded-sm",
@@ -8757,7 +8803,9 @@ var radiusSlots = {
8757
8803
  menuSubContent: "rounded-sm",
8758
8804
  tableContainer: "rounded-sm",
8759
8805
  tableEmptyIcon: "rounded-sm",
8760
- tableLoadingSkeleton: "rounded-sm"
8806
+ tableLoadingSkeleton: "rounded-sm",
8807
+ layoutRoot: "rounded-sm",
8808
+ layoutPane: "rounded-sm"
8761
8809
  },
8762
8810
  md: {},
8763
8811
  lg: {
@@ -8794,7 +8842,9 @@ var radiusSlots = {
8794
8842
  menuSubContent: "rounded-lg",
8795
8843
  tableContainer: "rounded-xl",
8796
8844
  tableEmptyIcon: "rounded-xl",
8797
- tableLoadingSkeleton: "rounded-lg"
8845
+ tableLoadingSkeleton: "rounded-lg",
8846
+ layoutRoot: "rounded-xl",
8847
+ layoutPane: "rounded-xl"
8798
8848
  },
8799
8849
  xl: {
8800
8850
  buttonBase: "rounded-xl",
@@ -8832,7 +8882,9 @@ var radiusSlots = {
8832
8882
  menuSubContent: "rounded-xl",
8833
8883
  tableContainer: "rounded-2xl",
8834
8884
  tableEmptyIcon: "rounded-2xl",
8835
- tableLoadingSkeleton: "rounded-xl"
8885
+ tableLoadingSkeleton: "rounded-xl",
8886
+ layoutRoot: "rounded-2xl",
8887
+ layoutPane: "rounded-2xl"
8836
8888
  },
8837
8889
  full: {
8838
8890
  buttonBase: "rounded-full",
@@ -8874,7 +8926,9 @@ var radiusSlots = {
8874
8926
  menuSubContent: "rounded-2xl",
8875
8927
  tableContainer: "rounded-2xl",
8876
8928
  tableEmptyIcon: "rounded-full",
8877
- tableLoadingSkeleton: "rounded-full"
8929
+ tableLoadingSkeleton: "rounded-full",
8930
+ layoutRoot: "rounded-2xl",
8931
+ layoutPane: "rounded-2xl"
8878
8932
  }
8879
8933
  };
8880
8934
  var borderSlots = {
@@ -8916,7 +8970,10 @@ var borderSlots = {
8916
8970
  tableFooterBarAttached: "border-t border-transparent",
8917
8971
  tableRow: "border-transparent",
8918
8972
  tableEmptyRow: "border-transparent",
8919
- tableLoadingRow: "border-transparent"
8973
+ tableLoadingRow: "border-transparent",
8974
+ layoutRoot: "border-transparent",
8975
+ layoutPaneBordered: "border-transparent",
8976
+ layoutResizeHandle: "bg-transparent hover:bg-transparent active:bg-transparent focus-visible:bg-transparent"
8920
8977
  },
8921
8978
  subtle: {
8922
8979
  buttonDefault: "border-border/60",
@@ -8956,7 +9013,9 @@ var borderSlots = {
8956
9013
  tableFooterBarAttached: "border-t border-border/60",
8957
9014
  tableRow: "border-border/50",
8958
9015
  tableEmptyRow: "border-border/50",
8959
- tableLoadingRow: "border-border/50"
9016
+ tableLoadingRow: "border-border/50",
9017
+ layoutRoot: "border-border/60",
9018
+ layoutPaneBordered: "border-border/60"
8960
9019
  },
8961
9020
  solid: {},
8962
9021
  strong: {
@@ -8997,7 +9056,10 @@ var borderSlots = {
8997
9056
  tableFooterBarAttached: "border-t border-foreground/20",
8998
9057
  tableRow: "border-foreground/15",
8999
9058
  tableEmptyRow: "border-foreground/15",
9000
- tableLoadingRow: "border-foreground/15"
9059
+ tableLoadingRow: "border-foreground/15",
9060
+ layoutRoot: "border-foreground/20",
9061
+ layoutPaneBordered: "border-foreground/20",
9062
+ layoutResizeHandle: "hover:bg-foreground/15 active:bg-foreground/20 focus-visible:bg-foreground/15"
9001
9063
  }
9002
9064
  };
9003
9065
  var backgroundSlots = {
@@ -9039,7 +9101,11 @@ var backgroundSlots = {
9039
9101
  tableFooter: "bg-muted/35",
9040
9102
  tableFooterBar: "bg-muted/30 shadow-none",
9041
9103
  tableRowInteractive: "cursor-pointer hover:bg-muted/45",
9042
- tableLoadingSkeleton: "bg-muted"
9104
+ tableLoadingSkeleton: "bg-muted",
9105
+ layoutRoot: "bg-card",
9106
+ layoutPane: "bg-card",
9107
+ layoutPaneMuted: "bg-muted/35",
9108
+ layoutResizeHandle: "hover:bg-border/70 active:bg-border/80 focus-visible:bg-border/70"
9043
9109
  },
9044
9110
  soft: {
9045
9111
  buttonDefault: "bg-muted/30 hover:bg-muted/55",
@@ -9075,7 +9141,10 @@ var backgroundSlots = {
9075
9141
  tableFooter: "bg-muted/25",
9076
9142
  tableFooterBar: "bg-muted/25 shadow-none",
9077
9143
  tableRowInteractive: "cursor-pointer hover:bg-muted/35",
9078
- tableLoadingSkeleton: "bg-muted/65"
9144
+ tableLoadingSkeleton: "bg-muted/65",
9145
+ layoutRoot: "bg-background/95 shadow-sm",
9146
+ layoutPane: "bg-background/95 shadow-sm",
9147
+ layoutPaneSoft: "bg-background/95 shadow-md"
9079
9148
  },
9080
9149
  glass: {
9081
9150
  buttonBase: "backdrop-blur-md",
@@ -9136,7 +9205,13 @@ var backgroundSlots = {
9136
9205
  tableRow: "border-white/10",
9137
9206
  tableRowInteractive: "cursor-pointer hover:bg-white/[0.08]",
9138
9207
  tableHeadLabel: "text-foreground",
9139
- tableLoadingSkeleton: "bg-white/[0.16]"
9208
+ tableLoadingSkeleton: "bg-white/[0.16]",
9209
+ layoutRoot: "border-white/10 bg-white/[0.05] shadow-none backdrop-blur-md",
9210
+ layoutPane: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
9211
+ layoutPaneMuted: "bg-white/[0.08]",
9212
+ layoutPaneSoft: "bg-white/[0.10] shadow-none backdrop-blur-md",
9213
+ layoutResizeHandle: "text-foreground/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
9214
+ layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
9140
9215
  },
9141
9216
  dark: {
9142
9217
  buttonBase: "border-white/15 text-white shadow-lg backdrop-blur",
@@ -9265,7 +9340,13 @@ var backgroundSlots = {
9265
9340
  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]",
9266
9341
  menuSubTriggerIcon: "text-white/55",
9267
9342
  menuSubContent: "border-white/10 bg-slate-950 text-white shadow-2xl",
9268
- tableLoadingSkeleton: "bg-white/[0.14]"
9343
+ tableLoadingSkeleton: "bg-white/[0.14]",
9344
+ layoutRoot: "border-white/10 bg-slate-950 text-white shadow-none",
9345
+ layoutPane: "border-white/10 bg-slate-950 text-white shadow-none",
9346
+ layoutPaneMuted: "bg-white/[0.06]",
9347
+ layoutPaneSoft: "bg-white/[0.08] shadow-none",
9348
+ layoutResizeHandle: "text-white/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
9349
+ layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
9269
9350
  }
9270
9351
  };
9271
9352
  var presetDefaults = {
@@ -10116,7 +10197,308 @@ forwardRef(
10116
10197
  );
10117
10198
  }
10118
10199
  );
10119
- createContext(null);
10200
+ var DATA_TRANSFER_COLUMN_TYPE = "application/x-monkeys-base-table-column";
10201
+ var BaseTableContext = createContext(null);
10202
+ function useBaseTableContext(appearance) {
10203
+ const context = useContext(BaseTableContext);
10204
+ if (context) {
10205
+ return {
10206
+ ...context,
10207
+ theme: appearance ? resolveBaseAppearance(appearance) : context.theme,
10208
+ appearance: appearance ?? context.appearance
10209
+ };
10210
+ }
10211
+ const theme = resolveBaseAppearance(appearance);
10212
+ return {
10213
+ appearance,
10214
+ theme,
10215
+ setDraggingColumnId: () => {
10216
+ }
10217
+ };
10218
+ }
10219
+ function toCssSize(value) {
10220
+ if (value === void 0) return void 0;
10221
+ return typeof value === "number" ? `${value}px` : value;
10222
+ }
10223
+ function clampWidth(value, minWidth, maxWidth) {
10224
+ const min5 = minWidth ?? 48;
10225
+ const max5 = maxWidth ?? Number.POSITIVE_INFINITY;
10226
+ return Math.min(Math.max(value, min5), max5);
10227
+ }
10228
+ function getNextColumnOrder(order, columnId, targetColumnId) {
10229
+ if (!order || columnId === targetColumnId) return void 0;
10230
+ const fromIndex = order.indexOf(columnId);
10231
+ const toIndex = order.indexOf(targetColumnId);
10232
+ if (fromIndex < 0 || toIndex < 0) return void 0;
10233
+ const next = [...order];
10234
+ const [moved] = next.splice(fromIndex, 1);
10235
+ next.splice(toIndex, 0, moved);
10236
+ return next;
10237
+ }
10238
+ function sortAriaValue(direction) {
10239
+ switch (direction) {
10240
+ case "asc":
10241
+ return "ascending";
10242
+ case "desc":
10243
+ return "descending";
10244
+ default:
10245
+ return void 0;
10246
+ }
10247
+ }
10248
+ function SortIndicator({
10249
+ direction,
10250
+ className
10251
+ }) {
10252
+ return /* @__PURE__ */ jsx(
10253
+ "span",
10254
+ {
10255
+ "aria-hidden": "true",
10256
+ className: cn(
10257
+ className,
10258
+ direction === "desc" && "rotate-180",
10259
+ (!direction || direction === "none") && "opacity-45"
10260
+ ),
10261
+ children: "\u25B2"
10262
+ }
10263
+ );
10264
+ }
10265
+ function DragHandleIcon() {
10266
+ return /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "grid gap-0.5", children: [
10267
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" }),
10268
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" }),
10269
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" })
10270
+ ] });
10271
+ }
10272
+ forwardRef(function BaseTableHead2({
10273
+ columnId,
10274
+ align = "left",
10275
+ icon,
10276
+ label,
10277
+ description,
10278
+ meta,
10279
+ actions,
10280
+ trailing,
10281
+ sortable,
10282
+ sortDirection = "none",
10283
+ sortLabel,
10284
+ onSort,
10285
+ draggable,
10286
+ dragLabel,
10287
+ resizable,
10288
+ resizeLabel,
10289
+ width,
10290
+ minWidth,
10291
+ maxWidth,
10292
+ appearance,
10293
+ className,
10294
+ classNames,
10295
+ style,
10296
+ children,
10297
+ onDragOver,
10298
+ onDrop,
10299
+ ...headProps
10300
+ }, forwardedRef) {
10301
+ const tableContext = useBaseTableContext(appearance);
10302
+ const { theme } = tableContext;
10303
+ const headRef = useRef(null);
10304
+ const setHeadRef = (node) => {
10305
+ headRef.current = node;
10306
+ if (typeof forwardedRef === "function") {
10307
+ forwardedRef(node);
10308
+ } else if (forwardedRef) {
10309
+ forwardedRef.current = node;
10310
+ }
10311
+ };
10312
+ const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
10313
+ const canDrag = Boolean(
10314
+ columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
10315
+ );
10316
+ const canResize = Boolean(
10317
+ columnId && resizable !== false && (resizable || tableContext.columnResizeEnabled) && tableContext.onColumnSizeChange
10318
+ );
10319
+ const interactiveSort = Boolean(sortable || onSort);
10320
+ const ariaSort = sortAriaValue(sortDirection);
10321
+ const content = hasRenderableNode(label) ? label : children;
10322
+ const usesRichHeader = canDrag || hasRenderableNode(icon) || hasRenderableNode(label) || hasRenderableNode(description) || hasRenderableNode(meta) || hasRenderableNode(actions) || hasRenderableNode(trailing) || interactiveSort;
10323
+ const renderedContent = usesRichHeader ? /* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadContent, classNames?.content), children: [
10324
+ /* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadMain, classNames?.main), children: [
10325
+ canDrag ? /* @__PURE__ */ jsx(
10326
+ "button",
10327
+ {
10328
+ type: "button",
10329
+ draggable: true,
10330
+ title: dragLabel,
10331
+ "aria-label": dragLabel ?? `Drag column ${columnId}`,
10332
+ className: cn(theme.slots.tableHeadDragHandle, classNames?.dragHandle),
10333
+ onClick: (event) => event.stopPropagation(),
10334
+ onDragStart: (event) => {
10335
+ event.stopPropagation();
10336
+ tableContext.setDraggingColumnId(columnId);
10337
+ event.dataTransfer.effectAllowed = "move";
10338
+ event.dataTransfer.setData(DATA_TRANSFER_COLUMN_TYPE, columnId);
10339
+ },
10340
+ onDragEnd: (event) => {
10341
+ event.stopPropagation();
10342
+ tableContext.setDraggingColumnId(void 0);
10343
+ },
10344
+ children: /* @__PURE__ */ jsx(DragHandleIcon, {})
10345
+ }
10346
+ ) : null,
10347
+ icon ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadIcon, classNames?.icon), children: icon }) : null,
10348
+ interactiveSort ? /* @__PURE__ */ jsxs(
10349
+ "button",
10350
+ {
10351
+ type: "button",
10352
+ disabled: !onSort,
10353
+ title: sortLabel,
10354
+ className: cn(theme.slots.tableHeadSortButton, classNames?.sortButton),
10355
+ onClick: (event) => {
10356
+ event.stopPropagation();
10357
+ onSort?.(columnId);
10358
+ },
10359
+ children: [
10360
+ /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.tableHeadText, classNames?.text), children: [
10361
+ hasRenderableNode(content) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadLabel, classNames?.label), children: content }) : null,
10362
+ hasRenderableNode(description) ? /* @__PURE__ */ jsx(
10363
+ "span",
10364
+ {
10365
+ className: cn(
10366
+ theme.slots.tableHeadDescription,
10367
+ classNames?.description
10368
+ ),
10369
+ children: description
10370
+ }
10371
+ ) : null
10372
+ ] }),
10373
+ /* @__PURE__ */ jsx(
10374
+ SortIndicator,
10375
+ {
10376
+ direction: sortDirection,
10377
+ className: cn(theme.slots.tableHeadSortIcon, classNames?.sortIcon)
10378
+ }
10379
+ )
10380
+ ]
10381
+ }
10382
+ ) : /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.tableHeadText, classNames?.text), children: [
10383
+ hasRenderableNode(content) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadLabel, classNames?.label), children: content }) : null,
10384
+ hasRenderableNode(description) ? /* @__PURE__ */ jsx(
10385
+ "span",
10386
+ {
10387
+ className: cn(
10388
+ theme.slots.tableHeadDescription,
10389
+ classNames?.description
10390
+ ),
10391
+ children: description
10392
+ }
10393
+ ) : null
10394
+ ] })
10395
+ ] }),
10396
+ hasRenderableNode(meta) || hasRenderableNode(actions) || hasRenderableNode(trailing) ? /* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadActions, classNames?.actions), children: [
10397
+ hasRenderableNode(meta) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadMeta, classNames?.meta), children: meta }) : null,
10398
+ actions,
10399
+ trailing
10400
+ ] }) : null
10401
+ ] }) : children;
10402
+ const handleDragOver = (event) => {
10403
+ onDragOver?.(event);
10404
+ if (!canDrag || !tableContext.draggingColumnId || tableContext.draggingColumnId === columnId) {
10405
+ return;
10406
+ }
10407
+ event.preventDefault();
10408
+ event.dataTransfer.dropEffect = "move";
10409
+ };
10410
+ const handleDrop = (event) => {
10411
+ onDrop?.(event);
10412
+ if (!canDrag || !columnId) return;
10413
+ const sourceColumnId = tableContext.draggingColumnId || event.dataTransfer.getData(DATA_TRANSFER_COLUMN_TYPE);
10414
+ if (!sourceColumnId || sourceColumnId === columnId) return;
10415
+ const nextOrder = getNextColumnOrder(
10416
+ tableContext.columnOrder,
10417
+ sourceColumnId,
10418
+ columnId
10419
+ );
10420
+ if (nextOrder) {
10421
+ event.preventDefault();
10422
+ tableContext.onColumnOrderChange?.(nextOrder, {
10423
+ columnId: sourceColumnId,
10424
+ targetColumnId: columnId
10425
+ });
10426
+ }
10427
+ tableContext.setDraggingColumnId(void 0);
10428
+ };
10429
+ const handleResizePointerDown = (event) => {
10430
+ if (!canResize || !columnId || !tableContext.onColumnSizeChange) return;
10431
+ event.preventDefault();
10432
+ event.stopPropagation();
10433
+ const startX = event.clientX;
10434
+ const currentWidth = typeof controlledWidth === "number" ? controlledWidth : headRef.current?.offsetWidth ?? minWidth ?? 96;
10435
+ const previousWidth = clampWidth(currentWidth, minWidth, maxWidth);
10436
+ const pointerId = event.pointerId;
10437
+ const target = event.currentTarget;
10438
+ target.setPointerCapture?.(pointerId);
10439
+ const handlePointerMove = (moveEvent) => {
10440
+ const nextWidth = clampWidth(
10441
+ previousWidth + moveEvent.clientX - startX,
10442
+ minWidth,
10443
+ maxWidth
10444
+ );
10445
+ tableContext.onColumnSizeChange?.(columnId, nextWidth, {
10446
+ columnId,
10447
+ previousWidth,
10448
+ minWidth,
10449
+ maxWidth
10450
+ });
10451
+ };
10452
+ const cleanup = () => {
10453
+ target.releasePointerCapture?.(pointerId);
10454
+ window.removeEventListener("pointermove", handlePointerMove);
10455
+ window.removeEventListener("pointerup", cleanup);
10456
+ window.removeEventListener("pointercancel", cleanup);
10457
+ };
10458
+ window.addEventListener("pointermove", handlePointerMove);
10459
+ window.addEventListener("pointerup", cleanup);
10460
+ window.addEventListener("pointercancel", cleanup);
10461
+ };
10462
+ return /* @__PURE__ */ jsxs(
10463
+ "th",
10464
+ {
10465
+ ...headProps,
10466
+ ref: setHeadRef,
10467
+ scope: headProps.scope ?? "col",
10468
+ "aria-sort": ariaSort,
10469
+ className: cn(
10470
+ theme.slots.tableHead,
10471
+ align === "center" && theme.slots.tableCellAlignCenter,
10472
+ align === "right" && theme.slots.tableCellAlignRight,
10473
+ classNames?.root,
10474
+ className
10475
+ ),
10476
+ style: {
10477
+ ...theme.styles.tableHead,
10478
+ width: toCssSize(controlledWidth),
10479
+ minWidth: toCssSize(minWidth),
10480
+ maxWidth: toCssSize(maxWidth),
10481
+ ...style
10482
+ },
10483
+ onDragOver: handleDragOver,
10484
+ onDrop: handleDrop,
10485
+ children: [
10486
+ renderedContent,
10487
+ canResize ? /* @__PURE__ */ jsx(
10488
+ "button",
10489
+ {
10490
+ type: "button",
10491
+ title: resizeLabel,
10492
+ "aria-label": resizeLabel ?? `Resize column ${columnId}`,
10493
+ className: cn(theme.slots.tableHeadResizeHandle, classNames?.resizeHandle),
10494
+ onClick: (event) => event.stopPropagation(),
10495
+ onPointerDown: handleResizePointerDown
10496
+ }
10497
+ ) : null
10498
+ ]
10499
+ }
10500
+ );
10501
+ });
10120
10502
  forwardRef(
10121
10503
  function BaseTextarea2({
10122
10504
  invalid = false,