@bsuite/page-builder 2.7.1-next.3 → 2.7.1-next.4

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":"AAEA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAsBxC,OAAO,KAAK,EAAe,mBAAmB,EAA4B,MAAM,YAAY,CAAC;AA4pB7F,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,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAKhB,UAAkB,EAClB,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,+BAA6E,EAC7E,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,GAC7B,EAAE,mBAAmB,qBAmgCrB"}
1
+ {"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAsBxC,OAAO,KAAK,EAAe,mBAAmB,EAA4B,MAAM,YAAY,CAAC;AAyqB7F,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,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAKhB,UAAkB,EAClB,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,+BAA6E,EAC7E,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,GAC7B,EAAE,mBAAmB,qBAmgCrB"}
@@ -187,6 +187,7 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
187
187
  */
188
188
  const scopedContent = (_jsx(ElementScopeProvider, { scope: { pageKey, cardKey: id, cardLabel: label, isEditing }, children: content }));
189
189
  const measureRef = useRef(null);
190
+ const surfaceRef = useRef(null);
190
191
  const lastReportedRowsRef = useRef(null);
191
192
  const measureRafRef = useRef(null);
192
193
  /**
@@ -216,9 +217,17 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
216
217
  const reportRows = useCallback((contentPx) => {
217
218
  if (!onAutoHeightChange)
218
219
  return;
220
+ // Chrome lives outside the observed content box. Count its actual
221
+ // padding and borders so appearance changes cannot overlap the next
222
+ // card. A consumer-owned Card is already inside the measured content.
223
+ const surfaceStyle = chrome && surfaceRef.current ? getComputedStyle(surfaceRef.current) : null;
224
+ const cardChromePx = surfaceStyle
225
+ ? [surfaceStyle.paddingTop, surfaceStyle.paddingBottom, surfaceStyle.borderTopWidth, surfaceStyle.borderBottomWidth]
226
+ .reduce((total, value) => total + (Number.parseFloat(value) || 0), 0)
227
+ : DEFAULT_CARD_CHROME_PX;
219
228
  const rows = computeAutoHeightRows({
220
229
  contentPx,
221
- cardChromePx: DEFAULT_CARD_CHROME_PX,
230
+ cardChromePx,
222
231
  rowHeightPx: DEFAULT_ROW_HEIGHT,
223
232
  marginYPx: DEFAULT_MARGIN[1],
224
233
  });
@@ -226,7 +235,7 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
226
235
  return;
227
236
  lastReportedRowsRef.current = rows;
228
237
  onAutoHeightChange(id, rows);
229
- }, [id, onAutoHeightChange]);
238
+ }, [chrome, id, onAutoHeightChange]);
230
239
  /**
231
240
  * First measurement BEFORE paint (second half of D-76).
232
241
  *
@@ -257,7 +266,7 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
257
266
  warnOnceAboutCollapsedContent(el);
258
267
  // Re-measure when edit chrome mounts/unmounts so the strip is in the
259
268
  // row count in edit mode and gone again on lossless return.
260
- }, [autoHeight, onAutoHeightChange, reportRows, isEditing]);
269
+ }, [autoHeight, onAutoHeightChange, reportRows, isEditing, cardStyleVars]);
261
270
  useEffect(() => {
262
271
  if (!autoHeight || !onAutoHeightChange)
263
272
  return;
@@ -307,7 +316,7 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
307
316
  // (buttons, inputs, textarea, select, links, [data-no-drag]) are still
308
317
  // protected via the `cancel` selector below in the <Responsive> render.
309
318
  const outerClass = cn('relative group overflow-visible', isEditing && 'drag-handle cursor-move', injectedClassName);
310
- 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-primary/5" })), _jsx("div", { "data-slot": "grid-item-surface", "data-chrome": chrome ? 'on' : 'off', "data-grid-slot-key": id, className: chrome
319
+ 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-primary/5" })), _jsx("div", { "data-slot": "grid-item-surface", "data-chrome": chrome ? 'on' : 'off', "data-grid-slot-key": id, ref: surfaceRef, "data-card-padding": !chrome && cardStyleVars && '--card-padding' in cardStyleVars ? '' : undefined, className: chrome
311
320
  ? // ONE radius token, read by the grid item AND available to any
312
321
  // app card that opts into the same surface. Two surfaces
313
322
  // reading the SAME var is what makes their corners align, and
@@ -360,7 +369,9 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
360
369
  * this attribute is identical to what it was before the card editor
361
370
  * existed. A chrome-owning surface applies `boxShadow` directly
362
371
  * to beat its default class. Layout-only wrappers pass the token
363
- * to the painted consumer without drawing a second shadow.
372
+ * to the painted consumer without drawing a second shadow. The
373
+ * padding marker lets consumer Cards distinguish an explicit page
374
+ * inset from an app's unrelated default --card-padding token.
364
375
  */
365
376
  style: {
366
377
  contain: 'layout style',
@@ -368,7 +379,7 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
368
379
  ...(chrome && cardStyleVars && '--card-shadow' in cardStyleVars
369
380
  ? { boxShadow: cardStyleVars['--card-shadow'] }
370
381
  : null),
371
- ...(cardStyleVars && '--card-padding' in cardStyleVars
382
+ ...(chrome && cardStyleVars && '--card-padding' in cardStyleVars
372
383
  ? { padding: cardStyleVars['--card-padding'] }
373
384
  : null),
374
385
  }, children: autoHeight ? (_jsx("div", { "data-slot": "grid-item-body", className: "min-h-0 flex-none overflow-visible", children: _jsxs("div", { ref: measureRef, className: "flow-root", children: [isEditing ? (_jsx(GridItemEditorChrome, { id: id, label: label, onHide: onHide })) : null, scopedContent] }) })) : (_jsxs(_Fragment, { children: [isEditing ? (_jsx(GridItemEditorChrome, { id: id, label: label, onHide: onHide })) : null, _jsx("div", { "data-slot": "grid-item-body", className: "min-h-0 flex-1 overflow-auto", children: scopedContent })] })) })] }), injectedChildren] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsuite/page-builder",
3
- "version": "2.7.1-next.3",
3
+ "version": "2.7.1-next.4",
4
4
  "description": "Shared BSuite responsive page-builder grid and layout persistence primitives",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",