@upbound/monarch-blocks 0.4.1 → 0.5.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.
@@ -77,9 +77,8 @@ type DataTableValueCellProps = {
77
77
  /**
78
78
  * A generic cell renderer: a link (when `href` is set), a dashed-underline
79
79
  * value with a hover tooltip (when `title` is set), or plain content — with
80
- * an em-dash placeholder when `content` is empty. Legacy injected its router
81
- * `Link` via a DI hook (`useLink()`); Monarch has no such layer, so the link
82
- * branch renders a plain `<a>`.
80
+ * an em-dash placeholder when `content` is empty. Consumers who need router
81
+ * navigation wrap their own router link with `Link asChild` at the call site.
83
82
  */
84
83
  declare function DataTableValueCell({ content, title, className, href, onClick }: DataTableValueCellProps): React$1.JSX.Element;
85
84
  /** A timestamp cell — relative time in the cell, absolute time on hover (via Monarch's `RelativeTime`); an em-dash when absent. */
@@ -385,6 +384,16 @@ interface TableHookOptions<TData extends RowData> extends Omit<TableOptions<TDat
385
384
  enablePagination?: boolean;
386
385
  rowCountRelation?: RowCountRelation;
387
386
  }
387
+ /**
388
+ * Configures the "Filter" toolbar toggle that shows/hides the filter row
389
+ */
390
+ type DataTableFilterVisibilityConfig = {
391
+ /** Controlled visibility. Omit for an uncontrolled toggle (DataTable owns the state). */
392
+ visible?: boolean;
393
+ onVisibleChange?: (visible: boolean) => void;
394
+ /** Initial visibility when uncontrolled. @default false */
395
+ defaultVisible?: boolean;
396
+ };
388
397
  /** Wires the CEL filter builder into the filter row in place of plain column filters. */
389
398
  type DataTableCelFilterConfig<TData extends RowData> = {
390
399
  schema: CelFilterSchema;
@@ -479,6 +488,22 @@ interface DataTableProps<TData extends RowData> {
479
488
  stickyHeader?: StickyHeaderConfig;
480
489
  /** When set, renders the CEL filter builder in the filter row instead of column filters. */
481
490
  celFilterConfig?: DataTableCelFilterConfig<TData>;
491
+ /**
492
+ * Controls the "Filter" toggle button in the toolbar, immediately to the left of
493
+ * `ActionsComponent`, that shows/hides the filter row (CEL filter bar or plain
494
+ * `ViewFilter`) without touching filter state — only the row's presence changes.
495
+ * The toggle renders by default (whether this prop is omitted or set to `true`),
496
+ * with the filter row starting hidden. Pass an object for a controlled toggle
497
+ * (e.g. to persist the preference in the consumer) or to change the uncontrolled
498
+ * initial state via `defaultVisible`. Pass `false` to disable the toggle entirely
499
+ * and always show the filter row whenever filtering is enabled — the pre-toggle
500
+ * behavior.
501
+ *
502
+ * The button never renders if there's nothing to filter — no column has a
503
+ * `meta.filter` and no `celFilterConfig` is set — or if `disableFilters` is
504
+ * `true`, regardless of this prop's value.
505
+ */
506
+ filterVisibility?: boolean | DataTableFilterVisibilityConfig;
482
507
  }
483
508
 
484
509
  /**
@@ -488,7 +513,7 @@ interface DataTableProps<TData extends RowData> {
488
513
  * difference is that columns, headers, rows, cells, and menus render through
489
514
  * Monarch's own primitives instead of legacy's hand-rolled ones.
490
515
  */
491
- declare function DataTable<TData extends RowData>({ id, config, title, description, emptyView, showError, className, fitContent, loading, renderSkeletonCell, serverSidePagination, ActionsComponent: Actions, onRowRender, renderExpandedRow, expanded: parentExpanded, onExpandedChange: parentOnExpandedChange, disableSearch, disableFilters, disableSorting, paginationConfig, disableColumnReordering, disableColumnVisibility, disableColumnResizing, disableColumnPinning, searchTerm: parentGlobalFilter, onSearchTermChange: parentSetGlobalFilter, filters: parentColumnFilters, onFiltersChange: parentSetColumnFilters, pagination: parentPagination, onPaginationChange: parentSetPagination, sorting: parentSorting, onSortingChange: parentSetSorting, columnOrdering: parentColumnOrdering, onColumnOrderingChange: parentSetColumnOrdering, columnVisibility: parentColumnVisibility, onColumnVisibilityChange: parentSetColumnVisibility, columnPinning: parentColumnPinning, onColumnPinningChange: parentSetColumnPinning, grouping: parentGrouping, onGroupingChange: parentSetGrouping, celFilterClassName, showContextualFilter, onContextCell, contextualMenuActions, layout, initialColumnSizing, onColumnSizingPersist, stickyHeader, celFilterConfig, }: DataTableProps<TData>): React$1.JSX.Element;
516
+ declare function DataTable<TData extends RowData>({ id, config, title, description, emptyView, showError, className, fitContent, loading, renderSkeletonCell, serverSidePagination, ActionsComponent: Actions, onRowRender, renderExpandedRow, expanded: parentExpanded, onExpandedChange: parentOnExpandedChange, disableSearch, disableFilters, disableSorting, paginationConfig, disableColumnReordering, disableColumnVisibility, disableColumnResizing, disableColumnPinning, searchTerm: parentGlobalFilter, onSearchTermChange: parentSetGlobalFilter, filters: parentColumnFilters, onFiltersChange: parentSetColumnFilters, pagination: parentPagination, onPaginationChange: parentSetPagination, sorting: parentSorting, onSortingChange: parentSetSorting, columnOrdering: parentColumnOrdering, onColumnOrderingChange: parentSetColumnOrdering, columnVisibility: parentColumnVisibility, onColumnVisibilityChange: parentSetColumnVisibility, columnPinning: parentColumnPinning, onColumnPinningChange: parentSetColumnPinning, grouping: parentGrouping, onGroupingChange: parentSetGrouping, celFilterClassName, showContextualFilter, onContextCell, contextualMenuActions, layout, initialColumnSizing, onColumnSizingPersist, stickyHeader, celFilterConfig, filterVisibility, }: DataTableProps<TData>): React$1.JSX.Element;
492
517
 
493
518
  type ViewFilterProps<TData extends RowData> = {
494
519
  columns: Column<TData, unknown>[];
@@ -508,4 +533,4 @@ type ViewFilterProps<TData extends RowData> = {
508
533
  */
509
534
  declare function ViewFilter<TData extends RowData>({ columns, columnFilters, onColumnFiltersChange, className, }: ViewFilterProps<TData>): React$1.JSX.Element;
510
535
 
511
- export { CellContextualFilter, type CellContextualFilterProps, ColumnOptions, type ColumnOptionsProps, type ContextualMenuAction, DataTable, DataTableBody, type DataTableCelFilterConfig, DataTableCell, type DataTableEmptyConfig, DataTableEmptyView, DataTableExpandedRow, DataTableGroupRow, DataTableHeader, DataTablePagination, type DataTablePaginationConfig, type DataTablePaginationProps, type DataTableProps, DataTableRow, type DataTableRowProps, DataTableSkeletonBody, DataTableValueCell, type DataTableValueCellProps, ExpandButton, RowActionItem, RowActions, type RowCountRelation, type StickyHeaderConfig, type TableHookOptions, type TableLayout, TimestampCell, ViewFilter, type ViewFilterProps, defaultEmptyConfig, defaultErrorConfig, defaultNoFilterFoundConfig, getActionsColumnDefinition, getExpandColumnDefinition, normalizePageSizeOptions };
536
+ export { CellContextualFilter, type CellContextualFilterProps, ColumnOptions, type ColumnOptionsProps, type ContextualMenuAction, DataTable, DataTableBody, type DataTableCelFilterConfig, DataTableCell, type DataTableEmptyConfig, DataTableEmptyView, DataTableExpandedRow, type DataTableFilterVisibilityConfig, DataTableGroupRow, DataTableHeader, DataTablePagination, type DataTablePaginationConfig, type DataTablePaginationProps, type DataTableProps, DataTableRow, type DataTableRowProps, DataTableSkeletonBody, DataTableValueCell, type DataTableValueCellProps, ExpandButton, RowActionItem, RowActions, type RowCountRelation, type StickyHeaderConfig, type TableHookOptions, type TableLayout, TimestampCell, ViewFilter, type ViewFilterProps, defaultEmptyConfig, defaultErrorConfig, defaultNoFilterFoundConfig, getActionsColumnDefinition, getExpandColumnDefinition, normalizePageSizeOptions };