@homebound/beam 2.417.5 → 2.417.7

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/dist/index.d.cts CHANGED
@@ -5314,7 +5314,7 @@ declare function applyRowFn<R extends Kinded>(column: GridColumnWithId<R>, row:
5314
5314
  declare const ASC: "ASC";
5315
5315
  declare const DESC: "DESC";
5316
5316
  declare const emptyCell: GridCellContent;
5317
- declare function getFirstOrLastCellCss<R extends Kinded>(style: GridStyle, columnIndex: number, columns: GridColumnWithId<R>[]): Properties;
5317
+ declare function getFirstOrLastCellCss<R extends Kinded>(style: GridStyle, columnIndex: number, columns: GridColumnWithId<R>[], colspan?: number): Properties;
5318
5318
  /** A heuristic to detect the result of `React.createElement` / i.e. JSX. */
5319
5319
  declare function isJSX(content: any): boolean;
5320
5320
  declare function getAlignment(column: GridColumnWithId<any>, maybeContent: ReactNode | GridCellContent): GridCellAlignment;
@@ -5392,23 +5392,27 @@ type LabelSuffixStyle = {
5392
5392
  interface GridStyle {
5393
5393
  /** Applied to the base div element. */
5394
5394
  rootCss?: Properties;
5395
- /** Applied with the owl operator between rows for rendering border lines. */
5395
+ /**
5396
+ * Applied as the base body-row cell styling (commonly used for row separators).
5397
+ * This is applied to body rows broadly (including the last body row); use
5398
+ * `lastRowCellCss`/`lastRowCss` to adjust/cancel any final-row treatment.
5399
+ */
5396
5400
  betweenRowsCss?: Properties;
5397
- /** Applied on the last row of the table. */
5401
+ /** Applied on the last row of the table, typically to override/cancel `betweenRowsCss`. */
5398
5402
  lastRowCss?: Properties;
5399
5403
  /** Applied on the first row of the table (could be the Header or Totals row). */
5400
5404
  firstRowCss?: Properties;
5401
5405
  /** Applied to every non-header row of the table */
5402
5406
  nonHeaderRowCss?: Properties;
5403
- /** Applied to the first non-header row, i.e. if you want to cancel out `betweenRowsCss`. */
5404
- firstNonHeaderRowCss?: Properties;
5407
+ /** Applied to the first body row, i.e. if you want to cancel out `betweenRowsCss`. */
5408
+ firstBodyRowCss?: Properties;
5405
5409
  /** Applied to all cell divs (via a selector off the base div). */
5406
5410
  cellCss?: Properties;
5407
5411
  /**
5408
5412
  * Applied to the header row divs.
5409
5413
  *
5410
5414
  * NOTE `as=virtual`: When using a virtual table with the goal of adding space
5411
- * between the header and the first row use `firstNonHeaderRowCss` with a
5415
+ * between the header and the first row use `firstBodyRowCss` with a
5412
5416
  * margin-top instead. Using `headerCellCss` will not work since the header
5413
5417
  * rows are wrapper with Chrome rows.
5414
5418
  */
@@ -5423,6 +5427,18 @@ interface GridStyle {
5423
5427
  firstCellCss?: Properties;
5424
5428
  /** Applied to the last cell of all rows, i.e. for table-wide padding or right-side borders. */
5425
5429
  lastCellCss?: Properties;
5430
+ /** Applied to every cell in the first table-head row (expandableHeader/header/totals). */
5431
+ firstRowCellCss?: Properties;
5432
+ /** Applied to the first cell in the first table-head row. */
5433
+ firstRowFirstCellCss?: Properties;
5434
+ /** Applied to the last cell in the first table-head row. */
5435
+ firstRowLastCellCss?: Properties;
5436
+ /** Applied to every cell in the last table-body row. */
5437
+ lastRowCellCss?: Properties;
5438
+ /** Applied to the first cell in the last table-body row. */
5439
+ lastRowFirstCellCss?: Properties;
5440
+ /** Applied to the last cell in the last table-body row. */
5441
+ lastRowLastCellCss?: Properties;
5426
5442
  /** Applied if there is a fallback/overflow message showing. */
5427
5443
  firstRowMessageCss?: Properties;
5428
5444
  /** Applied on hover if a row has a rowLink/onClick set. */
@@ -5510,6 +5526,9 @@ interface RowProps<R extends Kinded> {
5510
5526
  cellHighlight: boolean;
5511
5527
  omitRowHover: boolean;
5512
5528
  hasExpandableHeader: boolean;
5529
+ isFirstHeadRow: boolean;
5530
+ isFirstBodyRow: boolean;
5531
+ isLastBodyRow: boolean;
5513
5532
  resizedWidths: ResizedWidths;
5514
5533
  setResizedWidth: (columnId: string, width: number, columnIndex: number) => void;
5515
5534
  disableColumnResizing: boolean;
@@ -7155,22 +7174,60 @@ interface useResponsiveGridProps {
7155
7174
  /**
7156
7175
  * Returns container styles for a responsive CSS grid.
7157
7176
  *
7158
- * Callers must provide the grid config via `ResponsiveGridContext` (or use the
7159
- * `ResponsiveGrid` component) so that each item can call `useResponsiveGridItem`
7160
- * and apply the returned `gridItemStyles` to achieve container-query-based
7161
- * breakpoint behavior for multi-column spans.
7177
+ * ## Layout algorithm
7178
+ *
7179
+ * The grid uses `auto-fill` columns with a clamped width:
7180
+ *
7181
+ * ```
7182
+ * grid-template-columns: repeat(auto-fill, minmax(max(minColumnWidth, maxColumnWidth), 1fr))
7183
+ * ```
7184
+ *
7185
+ * where `maxColumnWidth = (100% - totalGapWidth) / columns`.
7186
+ *
7187
+ * - The `max(minColumnWidth, maxColumnWidth)` clamp means each column is *at
7188
+ * least* `minColumnWidth` wide, but when the container is wide enough to fit
7189
+ * all `columns`, each column grows to fill the space equally.
7190
+ * - `auto-fill` lets the browser drop columns automatically as the container
7191
+ * shrinks — once there isn't room for the next column at `minColumnWidth`,
7192
+ * the grid reflows to fewer columns.
7193
+ * - The grid is also a CSS `container` (`container-type: inline-size`) so that
7194
+ * child items can use `@container` queries to adapt their `grid-column` span
7195
+ * based on the grid's current width. See `useResponsiveGridItem`.
7196
+ *
7197
+ * ### Trade-offs
7198
+ *
7199
+ * **Pros**
7200
+ * - Fully CSS-driven reflow — no JS resize observers or manual breakpoint
7201
+ * bookkeeping; the browser handles column count changes natively.
7202
+ * - Container queries keep span adjustments scoped to the grid's own width
7203
+ * rather than the viewport, so the grid works correctly inside any layout
7204
+ * (sidebars, split panes, etc.).
7205
+ *
7206
+ * **Cons**
7207
+ * - `auto-fill` can produce an empty trailing column when the container is
7208
+ * slightly wider than `columns * minColumnWidth` but not wide enough for
7209
+ * `columns + 1` full columns.
7210
+ * - Items that span multiple columns need coordinated `@container` queries
7211
+ * (via `useResponsiveGridItem`) to gracefully reduce their span — without
7212
+ * those styles an item requesting e.g. `span 3` will overflow or leave
7213
+ * blank tracks when only 2 columns fit.
7214
+ *
7215
+ * ## Usage
7216
+ *
7217
+ * When using the hooks directly (without `ResponsiveGrid`), pass the same
7218
+ * config object to both hooks so that items can compute their container query
7219
+ * breakpoints:
7220
+ *
7221
+ * ```tsx
7222
+ * const gridConfig = { minColumnWidth: 276, columns: 4, gap: 24 };
7223
+ * const { gridStyles } = useResponsiveGrid(gridConfig);
7224
+ * const { gridItemProps, gridItemStyles } = useResponsiveGridItem({ colSpan: 3, gridConfig });
7225
+ * ```
7162
7226
  */
7163
7227
  declare function useResponsiveGrid(props: useResponsiveGridProps): {
7164
7228
  gridStyles: Properties;
7165
7229
  };
7166
7230
 
7167
- declare function useResponsiveGridItem({ colSpan }: {
7168
- colSpan?: number;
7169
- }): {
7170
- gridItemProps: Record<string, number>;
7171
- gridItemStyles: Properties;
7172
- };
7173
-
7174
7231
  interface ResponsiveGridConfig {
7175
7232
  minColumnWidth: number;
7176
7233
  gap: number;
@@ -7178,6 +7235,47 @@ interface ResponsiveGridConfig {
7178
7235
  }
7179
7236
  declare const ResponsiveGridContext: React$1.Context<ResponsiveGridConfig | undefined>;
7180
7237
 
7238
+ interface UseResponsiveGridItemProps {
7239
+ /** How many grid columns this item should span. Defaults to 1. */
7240
+ colSpan?: number;
7241
+ /**
7242
+ * The grid configuration for computing container-query breakpoints.
7243
+ *
7244
+ * When items are rendered inside a `ResponsiveGrid` (or a manual
7245
+ * `ResponsiveGridContext.Provider`), this is picked up from context
7246
+ * automatically and can be omitted.
7247
+ *
7248
+ * When using the hooks directly (i.e. `useResponsiveGrid` +
7249
+ * `useResponsiveGridItem` without a Provider), this **must** be supplied
7250
+ * so the item can generate the correct `@container` query styles.
7251
+ * Pass the same config object you gave to `useResponsiveGrid`:
7252
+ *
7253
+ * ```tsx
7254
+ * const gridConfig = { minColumnWidth: 276, columns: 4, gap: 24 };
7255
+ * const { gridStyles } = useResponsiveGrid(gridConfig);
7256
+ * const { gridItemProps, gridItemStyles } = useResponsiveGridItem({ colSpan: 3, gridConfig });
7257
+ * ```
7258
+ */
7259
+ gridConfig?: ResponsiveGridConfig;
7260
+ }
7261
+ /**
7262
+ * Returns props and styles for a responsive grid item.
7263
+ *
7264
+ * - `gridItemProps` — a data attribute used to identify the item's requested
7265
+ * column span. Spread this onto the item's root element.
7266
+ * - `gridItemStyles` — `@container` query CSS that gracefully reduces the
7267
+ * item's `grid-column` span as the grid container shrinks. Apply these to
7268
+ * the item's `css` prop.
7269
+ *
7270
+ * The container query breakpoints are derived from the grid config (see
7271
+ * `UseResponsiveGridItemProps.gridConfig`). When `colSpan` is 1 or the
7272
+ * config is unavailable, `gridItemStyles` will be an empty object.
7273
+ */
7274
+ declare function useResponsiveGridItem(props: UseResponsiveGridItemProps): {
7275
+ gridItemProps: Record<string, number>;
7276
+ gridItemStyles: Properties;
7277
+ };
7278
+
7181
7279
  interface HbLoadingSpinnerProps {
7182
7280
  /** Reverts loading text to `Loading...` if true. May override global noQuips by passing in noQuips={false}. */
7183
7281
  noQuips?: boolean;
package/dist/index.d.ts CHANGED
@@ -5314,7 +5314,7 @@ declare function applyRowFn<R extends Kinded>(column: GridColumnWithId<R>, row:
5314
5314
  declare const ASC: "ASC";
5315
5315
  declare const DESC: "DESC";
5316
5316
  declare const emptyCell: GridCellContent;
5317
- declare function getFirstOrLastCellCss<R extends Kinded>(style: GridStyle, columnIndex: number, columns: GridColumnWithId<R>[]): Properties;
5317
+ declare function getFirstOrLastCellCss<R extends Kinded>(style: GridStyle, columnIndex: number, columns: GridColumnWithId<R>[], colspan?: number): Properties;
5318
5318
  /** A heuristic to detect the result of `React.createElement` / i.e. JSX. */
5319
5319
  declare function isJSX(content: any): boolean;
5320
5320
  declare function getAlignment(column: GridColumnWithId<any>, maybeContent: ReactNode | GridCellContent): GridCellAlignment;
@@ -5392,23 +5392,27 @@ type LabelSuffixStyle = {
5392
5392
  interface GridStyle {
5393
5393
  /** Applied to the base div element. */
5394
5394
  rootCss?: Properties;
5395
- /** Applied with the owl operator between rows for rendering border lines. */
5395
+ /**
5396
+ * Applied as the base body-row cell styling (commonly used for row separators).
5397
+ * This is applied to body rows broadly (including the last body row); use
5398
+ * `lastRowCellCss`/`lastRowCss` to adjust/cancel any final-row treatment.
5399
+ */
5396
5400
  betweenRowsCss?: Properties;
5397
- /** Applied on the last row of the table. */
5401
+ /** Applied on the last row of the table, typically to override/cancel `betweenRowsCss`. */
5398
5402
  lastRowCss?: Properties;
5399
5403
  /** Applied on the first row of the table (could be the Header or Totals row). */
5400
5404
  firstRowCss?: Properties;
5401
5405
  /** Applied to every non-header row of the table */
5402
5406
  nonHeaderRowCss?: Properties;
5403
- /** Applied to the first non-header row, i.e. if you want to cancel out `betweenRowsCss`. */
5404
- firstNonHeaderRowCss?: Properties;
5407
+ /** Applied to the first body row, i.e. if you want to cancel out `betweenRowsCss`. */
5408
+ firstBodyRowCss?: Properties;
5405
5409
  /** Applied to all cell divs (via a selector off the base div). */
5406
5410
  cellCss?: Properties;
5407
5411
  /**
5408
5412
  * Applied to the header row divs.
5409
5413
  *
5410
5414
  * NOTE `as=virtual`: When using a virtual table with the goal of adding space
5411
- * between the header and the first row use `firstNonHeaderRowCss` with a
5415
+ * between the header and the first row use `firstBodyRowCss` with a
5412
5416
  * margin-top instead. Using `headerCellCss` will not work since the header
5413
5417
  * rows are wrapper with Chrome rows.
5414
5418
  */
@@ -5423,6 +5427,18 @@ interface GridStyle {
5423
5427
  firstCellCss?: Properties;
5424
5428
  /** Applied to the last cell of all rows, i.e. for table-wide padding or right-side borders. */
5425
5429
  lastCellCss?: Properties;
5430
+ /** Applied to every cell in the first table-head row (expandableHeader/header/totals). */
5431
+ firstRowCellCss?: Properties;
5432
+ /** Applied to the first cell in the first table-head row. */
5433
+ firstRowFirstCellCss?: Properties;
5434
+ /** Applied to the last cell in the first table-head row. */
5435
+ firstRowLastCellCss?: Properties;
5436
+ /** Applied to every cell in the last table-body row. */
5437
+ lastRowCellCss?: Properties;
5438
+ /** Applied to the first cell in the last table-body row. */
5439
+ lastRowFirstCellCss?: Properties;
5440
+ /** Applied to the last cell in the last table-body row. */
5441
+ lastRowLastCellCss?: Properties;
5426
5442
  /** Applied if there is a fallback/overflow message showing. */
5427
5443
  firstRowMessageCss?: Properties;
5428
5444
  /** Applied on hover if a row has a rowLink/onClick set. */
@@ -5510,6 +5526,9 @@ interface RowProps<R extends Kinded> {
5510
5526
  cellHighlight: boolean;
5511
5527
  omitRowHover: boolean;
5512
5528
  hasExpandableHeader: boolean;
5529
+ isFirstHeadRow: boolean;
5530
+ isFirstBodyRow: boolean;
5531
+ isLastBodyRow: boolean;
5513
5532
  resizedWidths: ResizedWidths;
5514
5533
  setResizedWidth: (columnId: string, width: number, columnIndex: number) => void;
5515
5534
  disableColumnResizing: boolean;
@@ -7155,22 +7174,60 @@ interface useResponsiveGridProps {
7155
7174
  /**
7156
7175
  * Returns container styles for a responsive CSS grid.
7157
7176
  *
7158
- * Callers must provide the grid config via `ResponsiveGridContext` (or use the
7159
- * `ResponsiveGrid` component) so that each item can call `useResponsiveGridItem`
7160
- * and apply the returned `gridItemStyles` to achieve container-query-based
7161
- * breakpoint behavior for multi-column spans.
7177
+ * ## Layout algorithm
7178
+ *
7179
+ * The grid uses `auto-fill` columns with a clamped width:
7180
+ *
7181
+ * ```
7182
+ * grid-template-columns: repeat(auto-fill, minmax(max(minColumnWidth, maxColumnWidth), 1fr))
7183
+ * ```
7184
+ *
7185
+ * where `maxColumnWidth = (100% - totalGapWidth) / columns`.
7186
+ *
7187
+ * - The `max(minColumnWidth, maxColumnWidth)` clamp means each column is *at
7188
+ * least* `minColumnWidth` wide, but when the container is wide enough to fit
7189
+ * all `columns`, each column grows to fill the space equally.
7190
+ * - `auto-fill` lets the browser drop columns automatically as the container
7191
+ * shrinks — once there isn't room for the next column at `minColumnWidth`,
7192
+ * the grid reflows to fewer columns.
7193
+ * - The grid is also a CSS `container` (`container-type: inline-size`) so that
7194
+ * child items can use `@container` queries to adapt their `grid-column` span
7195
+ * based on the grid's current width. See `useResponsiveGridItem`.
7196
+ *
7197
+ * ### Trade-offs
7198
+ *
7199
+ * **Pros**
7200
+ * - Fully CSS-driven reflow — no JS resize observers or manual breakpoint
7201
+ * bookkeeping; the browser handles column count changes natively.
7202
+ * - Container queries keep span adjustments scoped to the grid's own width
7203
+ * rather than the viewport, so the grid works correctly inside any layout
7204
+ * (sidebars, split panes, etc.).
7205
+ *
7206
+ * **Cons**
7207
+ * - `auto-fill` can produce an empty trailing column when the container is
7208
+ * slightly wider than `columns * minColumnWidth` but not wide enough for
7209
+ * `columns + 1` full columns.
7210
+ * - Items that span multiple columns need coordinated `@container` queries
7211
+ * (via `useResponsiveGridItem`) to gracefully reduce their span — without
7212
+ * those styles an item requesting e.g. `span 3` will overflow or leave
7213
+ * blank tracks when only 2 columns fit.
7214
+ *
7215
+ * ## Usage
7216
+ *
7217
+ * When using the hooks directly (without `ResponsiveGrid`), pass the same
7218
+ * config object to both hooks so that items can compute their container query
7219
+ * breakpoints:
7220
+ *
7221
+ * ```tsx
7222
+ * const gridConfig = { minColumnWidth: 276, columns: 4, gap: 24 };
7223
+ * const { gridStyles } = useResponsiveGrid(gridConfig);
7224
+ * const { gridItemProps, gridItemStyles } = useResponsiveGridItem({ colSpan: 3, gridConfig });
7225
+ * ```
7162
7226
  */
7163
7227
  declare function useResponsiveGrid(props: useResponsiveGridProps): {
7164
7228
  gridStyles: Properties;
7165
7229
  };
7166
7230
 
7167
- declare function useResponsiveGridItem({ colSpan }: {
7168
- colSpan?: number;
7169
- }): {
7170
- gridItemProps: Record<string, number>;
7171
- gridItemStyles: Properties;
7172
- };
7173
-
7174
7231
  interface ResponsiveGridConfig {
7175
7232
  minColumnWidth: number;
7176
7233
  gap: number;
@@ -7178,6 +7235,47 @@ interface ResponsiveGridConfig {
7178
7235
  }
7179
7236
  declare const ResponsiveGridContext: React$1.Context<ResponsiveGridConfig | undefined>;
7180
7237
 
7238
+ interface UseResponsiveGridItemProps {
7239
+ /** How many grid columns this item should span. Defaults to 1. */
7240
+ colSpan?: number;
7241
+ /**
7242
+ * The grid configuration for computing container-query breakpoints.
7243
+ *
7244
+ * When items are rendered inside a `ResponsiveGrid` (or a manual
7245
+ * `ResponsiveGridContext.Provider`), this is picked up from context
7246
+ * automatically and can be omitted.
7247
+ *
7248
+ * When using the hooks directly (i.e. `useResponsiveGrid` +
7249
+ * `useResponsiveGridItem` without a Provider), this **must** be supplied
7250
+ * so the item can generate the correct `@container` query styles.
7251
+ * Pass the same config object you gave to `useResponsiveGrid`:
7252
+ *
7253
+ * ```tsx
7254
+ * const gridConfig = { minColumnWidth: 276, columns: 4, gap: 24 };
7255
+ * const { gridStyles } = useResponsiveGrid(gridConfig);
7256
+ * const { gridItemProps, gridItemStyles } = useResponsiveGridItem({ colSpan: 3, gridConfig });
7257
+ * ```
7258
+ */
7259
+ gridConfig?: ResponsiveGridConfig;
7260
+ }
7261
+ /**
7262
+ * Returns props and styles for a responsive grid item.
7263
+ *
7264
+ * - `gridItemProps` — a data attribute used to identify the item's requested
7265
+ * column span. Spread this onto the item's root element.
7266
+ * - `gridItemStyles` — `@container` query CSS that gracefully reduces the
7267
+ * item's `grid-column` span as the grid container shrinks. Apply these to
7268
+ * the item's `css` prop.
7269
+ *
7270
+ * The container query breakpoints are derived from the grid config (see
7271
+ * `UseResponsiveGridItemProps.gridConfig`). When `colSpan` is 1 or the
7272
+ * config is unavailable, `gridItemStyles` will be an empty object.
7273
+ */
7274
+ declare function useResponsiveGridItem(props: UseResponsiveGridItemProps): {
7275
+ gridItemProps: Record<string, number>;
7276
+ gridItemStyles: Properties;
7277
+ };
7278
+
7181
7279
  interface HbLoadingSpinnerProps {
7182
7280
  /** Reverts loading text to `Loading...` if true. May override global noQuips by passing in noQuips={false}. */
7183
7281
  noQuips?: boolean;