@bsuite/page-builder 0.3.0 → 0.4.0

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 +1 @@
1
- {"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AAIA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAIxC,OAAO,KAAK,EAAe,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAqJnE,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,SAAS,EAMT,WAAkB,EAClB,aAAsC,EACtC,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,GACvB,EAAE,mBAAmB,2CA4frB"}
1
+ {"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AAIA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAIxC,OAAO,KAAK,EAAe,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA+KnE,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,SAAS,EAMT,WAAkB,EAClB,aAAsC,EACtC,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,GACvB,EAAE,mBAAmB,2CA+frB"}
@@ -2,24 +2,31 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArrowDown, ArrowUp, Eye, EyeOff, Layers, LayoutGrid, Lock, Plus, RotateCcw, Save, Settings2, Unlock } from 'lucide-react';
3
3
  import React, { startTransition, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { Responsive } from 'react-grid-layout';
5
- import { gridBounds, maxSize, minMaxSize, minSize } from 'react-grid-layout/core';
5
+ import { gridBounds, minMaxSize, minSize } from 'react-grid-layout/core';
6
6
  import 'react-grid-layout/css/styles.css';
7
7
  import 'react-resizable/css/styles.css';
8
8
  import { defaultPreferenceAdapter } from './preferences.js';
9
9
  import { usePageGridLayout } from './usePageGridLayout.js';
10
10
  import { cn } from './utils.js';
11
11
  /**
12
- * Resize bounds for the bottom-right handle.
12
+ * Default resize bounds applied as a *global* constraint to ALL grid items.
13
13
  *
14
- * `maxH` was 16 (≈512px at rowHeight=32) which clipped data tables holding
15
- * more than ~7 rows — operators reported "the resize handle hits a wall
16
- * before all my data fits". Bumped to 48 (≈1536px) which comfortably fits
17
- * ~20–30 list rows of any density and matches the maximum viewport height
18
- * on common displays. Cards that still need to show more data should rely
19
- * on their own internal scroll container (we apply `min-h-0 overflow-auto`
20
- * to the card body wrapper below) rather than growing without bound.
14
+ * History
15
+ * -------
16
+ * - 0.2.x: maxH=16 (≈512px) — clipped data tables.
17
+ * - 0.3.0: bumped to maxH=48 (≈1536px) — still a hard ceiling. Operators
18
+ * reported "the handle hits a wall before all my data fits" on tall
19
+ * data-table cards even after the bump.
20
+ * - 0.4.0 (this version): **removed the global maxW and maxH ceilings
21
+ * entirely.** Width is bounded by `gridBounds` (the active column count)
22
+ * so no separate global `maxSize(...)` is needed; per-item
23
+ * `LayoutItem.maxW` / `maxH` is honoured via `minMaxSize`. Combined
24
+ * with the new internal scroll wrapper around `{content}` (see GridItem
25
+ * render below), cards now grow to their bounds and content scrolls
26
+ * inside. Per-item `maxH` on `LayoutItem` remains the right knob for
27
+ * "this widget shouldn't grow past N rows".
21
28
  */
22
- const DEFAULT_RESIZE_BOUNDS = { minW: 2, minH: 1, maxW: 12, maxH: 48 };
29
+ const DEFAULT_RESIZE_BOUNDS = { minW: 2, minH: 1 };
23
30
  const DEFAULT_RESIZE_HANDLES = ['se'];
24
31
  const DEFAULT_ADD_ENTITY_WIDGET_EVENT_NAMES = ['bsu-add-entity-widget', 'crm7-add-entity-widget'];
25
32
  /**
@@ -66,7 +73,7 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
66
73
  return (_jsxs("div", { ref: ref, className: outerClass, style: injectedStyle, ...rest, children: [_jsxs("div", { className: "h-full w-full relative", children: [isEditing && (_jsx("div", { className: "absolute inset-0 z-10 pointer-events-none rounded-3xl border-2 border-transparent group-hover:border-primary/50 transition-colors bg-black/5" })), isEditing && (_jsx("div", { className: "absolute top-2 left-2 z-30 flex items-center gap-1 pointer-events-none", children: _jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-md opacity-80 font-medium bg-muted text-muted-foreground", children: label }) })), isEditing && (_jsx("button", { className: "absolute top-2 right-2 z-30 h-6 w-6 rounded-full flex items-center justify-center bg-destructive/80 hover:bg-destructive text-white shadow transition-colors", "data-no-drag": true, onPointerDown: (event) => event.stopPropagation(), onClick: (event) => {
67
74
  event.stopPropagation();
68
75
  onHide(id);
69
- }, title: `Hide ${label}`, "aria-label": `Hide ${label}`, children: _jsx(EyeOff, { className: "h-3 w-3", "aria-hidden": "true" }) })), _jsx("div", { className: "h-full w-full rounded-3xl transition-all flex flex-col bg-card shadow-sm", style: { contain: 'paint' }, children: content })] }), injectedChildren] }));
76
+ }, title: `Hide ${label}`, "aria-label": `Hide ${label}`, children: _jsx(EyeOff, { className: "h-3 w-3", "aria-hidden": "true" }) })), _jsx("div", { className: "h-full w-full rounded-3xl transition-all flex flex-col bg-card shadow-sm", style: { contain: 'paint' }, children: _jsx("div", { className: "flex-1 min-h-0 overflow-auto", children: content }) })] }), injectedChildren] }));
70
77
  }));
71
78
  export function PageGridLayout({ pageKey, defaultLayouts, defaultCols, layoutVersion, canEditPage, editorEventNames, preferenceAdapter, widgets, widgetMeta, className,
72
79
  // Resize default flipped 2026-05-12: rgl v2 dropped auto-handle rendering
@@ -86,10 +93,13 @@ isResizable = true, resizeHandles = DEFAULT_RESIZE_HANDLES, addEntityWidgetEvent
86
93
  });
87
94
  const resizeEnabled = isEditing && isResizable;
88
95
  const resizeConstraints = useMemo(() => [
96
+ // `gridBounds` caps width at the active column count, so we don't need
97
+ // a global maxSize(...). Width and height are unbounded by default;
98
+ // consumers cap individual widgets via LayoutItem.maxW / maxH which
99
+ // `minMaxSize` reads per-item.
89
100
  gridBounds,
90
101
  minMaxSize,
91
102
  minSize(DEFAULT_RESIZE_BOUNDS.minW, DEFAULT_RESIZE_BOUNDS.minH),
92
- maxSize(DEFAULT_RESIZE_BOUNDS.maxW, DEFAULT_RESIZE_BOUNDS.maxH),
93
103
  ], []);
94
104
  const [extraWidgetConfigs, setExtraWidgetConfigs] = useState({});
95
105
  const { value: layerNames, setValue: setLayerNames } = (preferenceAdapter ?? defaultPreferenceAdapter)(`page:${pageKey}_grid_layer_names`, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsuite/page-builder",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared BSuite responsive page-builder grid and layout persistence primitives",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",