@zvndev/yable-react 0.5.1 → 0.6.1

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
@@ -1,11 +1,11 @@
1
- import { RowData, ColumnDefBase, ColumnDefExtensions, Row, ColumnDef, Table as Table$1, Cell, Header, TableOptions, SortingState, ColumnFiltersState, PaginationState, TableState, Updater, Column, SortDirection, CellContext, ClipboardOptions, CellFlashInfo } from '@zvndev/yable-core';
1
+ import { RowData, ColumnDefBase, ColumnDefExtensions, Row, ColumnDef, Table as Table$1, Cell, Column, Header, TableOptions, SortingState, ColumnFiltersState, PaginationState, TableState, Updater, SortDirection, CellContext, ClipboardOptions, CellFlashInfo } from '@zvndev/yable-core';
2
2
  export { AccessorFnColumnDef, AccessorKeyColumnDef, AggregationFn, Cell, CellStatus as CellCommitStatus, CellContext, CellFlashEvent, CellPatch, ClipboardOptions, Column, ColumnDef, ColumnDefBase, ColumnFiltersState, ColumnMeta, ColumnOrderState, ColumnPinningState, ColumnSizingInfoState, ColumnSizingState, CommitError, CommitErrorCells, CommitRecord, CommitResult, CommitsSlice, DisplayColumnDef, EditingState, ExpandedState, FillHandleState, FilterFn, FormulaEngine, FormulaError, FormulaFunction, FormulaState, GroupColumnDef, Header, HeaderContext, HeaderGroup, KeyboardNavigationAction, KeyboardNavigationCell, KeyboardNavigationDirection, KeyboardNavigationState, OnChangeFn, OnCommitFn, PaginationState, PartialLocale, PivotColumn, PivotConfig, PivotEngine, PivotFieldConfig, PivotRow, PivotState, PivotValueConfig, Row, RowData, RowDragEndEvent, RowDragEvent, RowDragState, RowEditCommitEvent, RowEditEvent, RowPinningState, RowReorderEvent, RowSelectionState, SortDirection, SortingFn, SortingState, Table as TableInstance, TableOptions, TableOptionsResolved, TableState, UndoAction, UndoRedoOptions, UndoRedoState, UndoStack, Updater, VisibilityState, YableLocale, aggregationFns, createColumnHelper, createLocale, createUndoRedoIntegration, en, filterFns, formulaFunctions, functionalUpdate, generatePivotColumnDefs, getDefaultLocale, getInitialPivotState, getPivotRowModel, resetLocale, setDefaultLocale, sortingFns } from '@zvndev/yable-core';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { CSSProperties, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { RowDragState } from '@zvndev/yable-core/features/rowDragging';
7
7
 
8
- type YableTableVisualConfig = Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel' | 'clickableRows' | 'floatingFilters' | 'columnVirtualization' | 'columnVirtualizationOverscan' | 'statusBar' | 'sidebar' | 'sidebarPanels' | 'defaultSidebarPanel'>>;
8
+ type YableTableVisualConfig = Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel' | 'clickableRows' | 'floatingFilters' | 'columnVirtualization' | 'columnVirtualizationOverscan' | 'adaptiveLayout' | 'statusBar' | 'sidebar' | 'sidebarPanels' | 'defaultSidebarPanel'>>;
9
9
  type YableColumnConfig<TData extends RowData = any, TValue = unknown> = Partial<ColumnDefBase<TData, TValue>> & Partial<ColumnDefExtensions<TData, TValue>>;
10
10
  interface YableRowConfig<TData extends RowData = any> {
11
11
  className?: string | ((row: Row<TData>) => string | undefined);
@@ -38,6 +38,35 @@ declare function resolveYableProfile<TData extends RowData = any>(config?: Yable
38
38
  declare function getYableDefaultColumnDef<TData extends RowData>(profile?: YableTableProfile<TData>): YableColumnConfig<TData> | undefined;
39
39
  declare function applyYableConfigToColumns<TData extends RowData>(columns: ColumnDef<TData, any>[], profile?: YableTableProfile<TData>): ColumnDef<TData, any>[];
40
40
 
41
+ type AdaptiveTableLayoutMode = 'auto' | 'table' | 'cards';
42
+ interface AdaptiveTableCardContext<TData extends RowData> {
43
+ table: Table$1<TData>;
44
+ row: Row<TData>;
45
+ rowIndex: number;
46
+ cells: Cell<TData, unknown>[];
47
+ primaryCell?: Cell<TData, unknown>;
48
+ secondaryCells: Cell<TData, unknown>[];
49
+ visibleColumns: Column<TData, unknown>[];
50
+ }
51
+ interface AdaptiveTableLayoutOptions<TData extends RowData> {
52
+ /**
53
+ * `auto` switches at the configured container breakpoint, `cards` forces the
54
+ * adaptive card surface, and `table` keeps the desktop grid surface.
55
+ */
56
+ mode?: AdaptiveTableLayoutMode;
57
+ /** Container width in px where `auto` switches to cards. Default: 720. */
58
+ breakpoint?: number;
59
+ /** Column shown as the card title. Defaults to the first visible column. */
60
+ primaryColumnId?: string;
61
+ /** Ordered secondary columns. Defaults to all remaining visible columns. */
62
+ secondaryColumnIds?: string[];
63
+ /** Columns omitted from the adaptive card surface. */
64
+ hiddenColumnIds?: string[];
65
+ /** Caps secondary fields when no explicit `secondaryColumnIds` are provided. Default: 8. */
66
+ maxSecondaryColumns?: number;
67
+ /** Fully custom card renderer for product-specific mobile/tablet layouts. */
68
+ renderCard?: (context: AdaptiveTableCardContext<TData>) => React.ReactNode;
69
+ }
41
70
  interface TableProps<TData extends RowData> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
42
71
  table: Table$1<TData>;
43
72
  /** Enable sticky header */
@@ -96,6 +125,8 @@ interface TableProps<TData extends RowData> extends Omit<HTMLAttributes<HTMLDivE
96
125
  columnVirtualization?: boolean;
97
126
  /** Additional columns rendered beyond the viewport when column virtualization is enabled */
98
127
  columnVirtualizationOverscan?: number;
128
+ /** Render a structural card layout for tablet/mobile while reusing this table instance */
129
+ adaptiveLayout?: boolean | AdaptiveTableLayoutOptions<TData>;
99
130
  /** Accessible label for the grid container. Default: "Data table" */
100
131
  ariaLabel?: string;
101
132
  }
@@ -582,7 +613,7 @@ interface YableDefaults {
582
613
  /** Named config profile used by descendants unless overridden */
583
614
  tableProfile?: string;
584
615
  /** Default props applied to every `<Table>` in the subtree */
585
- tableProps?: Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel'>>;
616
+ tableProps?: Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel' | 'adaptiveLayout'>>;
586
617
  /** Default column definition merged under every table's own `defaultColumnDef` */
587
618
  defaultColumnDef?: Partial<ColumnDefBase<any, unknown>> & Partial<ColumnDefExtensions<any, unknown>>;
588
619
  }
@@ -619,7 +650,7 @@ declare function YableProvider({ children, config, tableProfile, defaultColumnDe
619
650
  ariaLabel?: string;
620
651
  }): react_jsx_runtime.JSX.Element;
621
652
 
622
- declare function Table<TData extends RowData>({ table, stickyHeader: stickyHeaderProp, striped: stripedProp, bordered: borderedProp, compact: compactProp, theme: themeProp, config, configProfile, clickableRows, footer, loading, loadingComponent, loadingText, emptyMessage, emptyComponent, emptyIcon, emptyDetail, renderEmpty, renderLoading, children, className, direction: directionProp, statusBar, statusBarPanels, sidebar, sidebarPanels, defaultSidebarPanel, floatingFilters, columnVirtualization, columnVirtualizationOverscan, ariaLabel: ariaLabelProp, ...rest }: TableProps<TData>): react_jsx_runtime.JSX.Element;
653
+ declare function Table<TData extends RowData>({ table, stickyHeader: stickyHeaderProp, striped: stripedProp, bordered: borderedProp, compact: compactProp, theme: themeProp, config, configProfile, clickableRows, footer, loading, loadingComponent, loadingText, emptyMessage, emptyComponent, emptyIcon, emptyDetail, renderEmpty, renderLoading, children, className, direction: directionProp, statusBar, statusBarPanels, sidebar, sidebarPanels, defaultSidebarPanel, floatingFilters, columnVirtualization, columnVirtualizationOverscan, adaptiveLayout: adaptiveLayoutProp, ariaLabel: ariaLabelProp, ...rest }: TableProps<TData>): react_jsx_runtime.JSX.Element;
623
654
 
624
655
  interface TableHeaderProps<TData extends RowData> {
625
656
  table: Table$1<TData>;
@@ -1335,4 +1366,4 @@ declare function CellText({ children, variant, bold, truncate, size, }: CellText
1335
1366
  */
1336
1367
  declare function mergeEditChanges<TData>(data: TData[], changes: Record<string, Partial<TData>>, getRowId?: (row: TData, index: number) => string): TData[];
1337
1368
 
1338
- export { type ActionItem, type ActionsColumnOptions, type AutoMeasurementsOptions, CellBadge, type CellBadgeProps, CellBoolean, type CellBooleanProps, CellCheckbox, CellCurrency, type CellCurrencyProps, CellDate, CellDatePicker, type CellDateProps, CellErrorBoundary, CellInput, CellLink, type CellLinkProps, type CellMeasureRecipe, type CellMeasurement, CellNumeric, type CellNumericProps, CellProgress, type CellProgressProps, CellRating, type CellRatingProps, CellRow, type CellRowProps, CellSelect, CellStack, type CellStackProps, CellStatus, CellStatusBadge, type CellStatusBadgeProps, type CellStatusProps, CellText, type CellTextProps, CellToggle, CellWithIcon, type CellWithIconProps, ColumnsPanel, ContextMenu, ContextMenuItem, type ContextMenuItemDef, DEFAULT_TEXT_RECIPE, DragHandle, ErrorBoundary, type ExpandColumnOptions, ExpandIcon, FillHandle, type FillHandleDragState, type FillHandleProps, FiltersPanel, FlashCell, FloatingFilter, GlobalFilter, LoadingOverlay, type LoadingOverlayProps, MasterDetail, NoRowsOverlay, type NoRowsOverlayProps, Pagination, PivotConfigPanel, type PivotConfigProps, type PivotFieldItem, type PivotValueItem, PrintLayout, type ResolvedYableProfile, type RowNumberColumnOptions, type SelectColumnOptions, type ServerTableController, type ServerTableFetchArgs, type ServerTableFetchResult, type ServerTableUpdateArgs, SetFilter, Sidebar, SortIndicator, StatusBar, StatusBarPanelComponent, type StatusBarPanelComponentProps, type StatusBarPanelConfig, type StatusBarPanelProps, Table, TableBody, TableCell, type TableCellProps$1 as TableCellProps, TableFooter, TableHeader, type TableHeaderCellProps, type TableProps, TableProvider, type TableRowProps, Tooltip, type TooltipPosition, type TooltipProps, TreeToggle, type UseCellFlashOptions, type UseClipboardOptions, type UseColumnVirtualizationOptions, type UseColumnVirtualizationResult, type UseFillHandleOptions, type UseFillHandleReturn, type UseKeyboardNavigationOptions, type UsePretextMeasurementOptions, type UsePretextMeasurementResult, type UsePrintLayoutOptions, type UseRowAnimationOptions, type UseRowDragOptions, type UseRowDragReturn, type UseServerTableOptions, type UseTableOptions, type UseTablePersistenceOptions, type UseTablePersistenceReturn, type UseTableRowHeightsOptions, type UseThemeOptions, type UseTooltipOptions, type UseVirtualizationOptions, type UseVirtualizationResult, type VirtualColumn, type VirtualRow, type YableCellConfig, type YableCellConfigSet, type YableColumnConfig, type YableColumnConfigSet, type YableConfig, type YableDefaults, YableProvider, type YableRowConfig, type YableTableProfile, type YableTableVisualConfig, actionsColumn, applyYableConfigToColumns, createYableConfig, expandColumn, getMeasureRecipeForCellType, getRegisteredCellTypes, getYableDefaultColumnDef, mergeEditChanges, resolveMeasureRecipe, resolveYableProfile, rowNumberColumn, selectColumn, useAutoMeasurements, useCellFlash, useClipboard, useColumnVirtualization, useContextMenu, useFillHandle, useKeyboardNavigation, usePretextMeasurement, usePrintLayout, useRowAnimation, useRowDrag, useServerTable, useTable, useTableContext, useTablePersistence, useTableRowHeights, useTheme, useTooltip, useVirtualization, useYableDefaults };
1369
+ export { type ActionItem, type ActionsColumnOptions, type AdaptiveTableCardContext, type AdaptiveTableLayoutMode, type AdaptiveTableLayoutOptions, type AutoMeasurementsOptions, CellBadge, type CellBadgeProps, CellBoolean, type CellBooleanProps, CellCheckbox, CellCurrency, type CellCurrencyProps, CellDate, CellDatePicker, type CellDateProps, CellErrorBoundary, CellInput, CellLink, type CellLinkProps, type CellMeasureRecipe, type CellMeasurement, CellNumeric, type CellNumericProps, CellProgress, type CellProgressProps, CellRating, type CellRatingProps, CellRow, type CellRowProps, CellSelect, CellStack, type CellStackProps, CellStatus, CellStatusBadge, type CellStatusBadgeProps, type CellStatusProps, CellText, type CellTextProps, CellToggle, CellWithIcon, type CellWithIconProps, ColumnsPanel, ContextMenu, ContextMenuItem, type ContextMenuItemDef, DEFAULT_TEXT_RECIPE, DragHandle, ErrorBoundary, type ExpandColumnOptions, ExpandIcon, FillHandle, type FillHandleDragState, type FillHandleProps, FiltersPanel, FlashCell, FloatingFilter, GlobalFilter, LoadingOverlay, type LoadingOverlayProps, MasterDetail, NoRowsOverlay, type NoRowsOverlayProps, Pagination, PivotConfigPanel, type PivotConfigProps, type PivotFieldItem, type PivotValueItem, PrintLayout, type ResolvedYableProfile, type RowNumberColumnOptions, type SelectColumnOptions, type ServerTableController, type ServerTableFetchArgs, type ServerTableFetchResult, type ServerTableUpdateArgs, SetFilter, Sidebar, SortIndicator, StatusBar, StatusBarPanelComponent, type StatusBarPanelComponentProps, type StatusBarPanelConfig, type StatusBarPanelProps, Table, TableBody, TableCell, type TableCellProps$1 as TableCellProps, TableFooter, TableHeader, type TableHeaderCellProps, type TableProps, TableProvider, type TableRowProps, Tooltip, type TooltipPosition, type TooltipProps, TreeToggle, type UseCellFlashOptions, type UseClipboardOptions, type UseColumnVirtualizationOptions, type UseColumnVirtualizationResult, type UseFillHandleOptions, type UseFillHandleReturn, type UseKeyboardNavigationOptions, type UsePretextMeasurementOptions, type UsePretextMeasurementResult, type UsePrintLayoutOptions, type UseRowAnimationOptions, type UseRowDragOptions, type UseRowDragReturn, type UseServerTableOptions, type UseTableOptions, type UseTablePersistenceOptions, type UseTablePersistenceReturn, type UseTableRowHeightsOptions, type UseThemeOptions, type UseTooltipOptions, type UseVirtualizationOptions, type UseVirtualizationResult, type VirtualColumn, type VirtualRow, type YableCellConfig, type YableCellConfigSet, type YableColumnConfig, type YableColumnConfigSet, type YableConfig, type YableDefaults, YableProvider, type YableRowConfig, type YableTableProfile, type YableTableVisualConfig, actionsColumn, applyYableConfigToColumns, createYableConfig, expandColumn, getMeasureRecipeForCellType, getRegisteredCellTypes, getYableDefaultColumnDef, mergeEditChanges, resolveMeasureRecipe, resolveYableProfile, rowNumberColumn, selectColumn, useAutoMeasurements, useCellFlash, useClipboard, useColumnVirtualization, useContextMenu, useFillHandle, useKeyboardNavigation, usePretextMeasurement, usePrintLayout, useRowAnimation, useRowDrag, useServerTable, useTable, useTableContext, useTablePersistence, useTableRowHeights, useTheme, useTooltip, useVirtualization, useYableDefaults };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { RowData, ColumnDefBase, ColumnDefExtensions, Row, ColumnDef, Table as Table$1, Cell, Header, TableOptions, SortingState, ColumnFiltersState, PaginationState, TableState, Updater, Column, SortDirection, CellContext, ClipboardOptions, CellFlashInfo } from '@zvndev/yable-core';
1
+ import { RowData, ColumnDefBase, ColumnDefExtensions, Row, ColumnDef, Table as Table$1, Cell, Column, Header, TableOptions, SortingState, ColumnFiltersState, PaginationState, TableState, Updater, SortDirection, CellContext, ClipboardOptions, CellFlashInfo } from '@zvndev/yable-core';
2
2
  export { AccessorFnColumnDef, AccessorKeyColumnDef, AggregationFn, Cell, CellStatus as CellCommitStatus, CellContext, CellFlashEvent, CellPatch, ClipboardOptions, Column, ColumnDef, ColumnDefBase, ColumnFiltersState, ColumnMeta, ColumnOrderState, ColumnPinningState, ColumnSizingInfoState, ColumnSizingState, CommitError, CommitErrorCells, CommitRecord, CommitResult, CommitsSlice, DisplayColumnDef, EditingState, ExpandedState, FillHandleState, FilterFn, FormulaEngine, FormulaError, FormulaFunction, FormulaState, GroupColumnDef, Header, HeaderContext, HeaderGroup, KeyboardNavigationAction, KeyboardNavigationCell, KeyboardNavigationDirection, KeyboardNavigationState, OnChangeFn, OnCommitFn, PaginationState, PartialLocale, PivotColumn, PivotConfig, PivotEngine, PivotFieldConfig, PivotRow, PivotState, PivotValueConfig, Row, RowData, RowDragEndEvent, RowDragEvent, RowDragState, RowEditCommitEvent, RowEditEvent, RowPinningState, RowReorderEvent, RowSelectionState, SortDirection, SortingFn, SortingState, Table as TableInstance, TableOptions, TableOptionsResolved, TableState, UndoAction, UndoRedoOptions, UndoRedoState, UndoStack, Updater, VisibilityState, YableLocale, aggregationFns, createColumnHelper, createLocale, createUndoRedoIntegration, en, filterFns, formulaFunctions, functionalUpdate, generatePivotColumnDefs, getDefaultLocale, getInitialPivotState, getPivotRowModel, resetLocale, setDefaultLocale, sortingFns } from '@zvndev/yable-core';
3
3
  import * as React$1 from 'react';
4
4
  import React__default, { CSSProperties, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { RowDragState } from '@zvndev/yable-core/features/rowDragging';
7
7
 
8
- type YableTableVisualConfig = Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel' | 'clickableRows' | 'floatingFilters' | 'columnVirtualization' | 'columnVirtualizationOverscan' | 'statusBar' | 'sidebar' | 'sidebarPanels' | 'defaultSidebarPanel'>>;
8
+ type YableTableVisualConfig = Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel' | 'clickableRows' | 'floatingFilters' | 'columnVirtualization' | 'columnVirtualizationOverscan' | 'adaptiveLayout' | 'statusBar' | 'sidebar' | 'sidebarPanels' | 'defaultSidebarPanel'>>;
9
9
  type YableColumnConfig<TData extends RowData = any, TValue = unknown> = Partial<ColumnDefBase<TData, TValue>> & Partial<ColumnDefExtensions<TData, TValue>>;
10
10
  interface YableRowConfig<TData extends RowData = any> {
11
11
  className?: string | ((row: Row<TData>) => string | undefined);
@@ -38,6 +38,35 @@ declare function resolveYableProfile<TData extends RowData = any>(config?: Yable
38
38
  declare function getYableDefaultColumnDef<TData extends RowData>(profile?: YableTableProfile<TData>): YableColumnConfig<TData> | undefined;
39
39
  declare function applyYableConfigToColumns<TData extends RowData>(columns: ColumnDef<TData, any>[], profile?: YableTableProfile<TData>): ColumnDef<TData, any>[];
40
40
 
41
+ type AdaptiveTableLayoutMode = 'auto' | 'table' | 'cards';
42
+ interface AdaptiveTableCardContext<TData extends RowData> {
43
+ table: Table$1<TData>;
44
+ row: Row<TData>;
45
+ rowIndex: number;
46
+ cells: Cell<TData, unknown>[];
47
+ primaryCell?: Cell<TData, unknown>;
48
+ secondaryCells: Cell<TData, unknown>[];
49
+ visibleColumns: Column<TData, unknown>[];
50
+ }
51
+ interface AdaptiveTableLayoutOptions<TData extends RowData> {
52
+ /**
53
+ * `auto` switches at the configured container breakpoint, `cards` forces the
54
+ * adaptive card surface, and `table` keeps the desktop grid surface.
55
+ */
56
+ mode?: AdaptiveTableLayoutMode;
57
+ /** Container width in px where `auto` switches to cards. Default: 720. */
58
+ breakpoint?: number;
59
+ /** Column shown as the card title. Defaults to the first visible column. */
60
+ primaryColumnId?: string;
61
+ /** Ordered secondary columns. Defaults to all remaining visible columns. */
62
+ secondaryColumnIds?: string[];
63
+ /** Columns omitted from the adaptive card surface. */
64
+ hiddenColumnIds?: string[];
65
+ /** Caps secondary fields when no explicit `secondaryColumnIds` are provided. Default: 8. */
66
+ maxSecondaryColumns?: number;
67
+ /** Fully custom card renderer for product-specific mobile/tablet layouts. */
68
+ renderCard?: (context: AdaptiveTableCardContext<TData>) => React.ReactNode;
69
+ }
41
70
  interface TableProps<TData extends RowData> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
42
71
  table: Table$1<TData>;
43
72
  /** Enable sticky header */
@@ -96,6 +125,8 @@ interface TableProps<TData extends RowData> extends Omit<HTMLAttributes<HTMLDivE
96
125
  columnVirtualization?: boolean;
97
126
  /** Additional columns rendered beyond the viewport when column virtualization is enabled */
98
127
  columnVirtualizationOverscan?: number;
128
+ /** Render a structural card layout for tablet/mobile while reusing this table instance */
129
+ adaptiveLayout?: boolean | AdaptiveTableLayoutOptions<TData>;
99
130
  /** Accessible label for the grid container. Default: "Data table" */
100
131
  ariaLabel?: string;
101
132
  }
@@ -582,7 +613,7 @@ interface YableDefaults {
582
613
  /** Named config profile used by descendants unless overridden */
583
614
  tableProfile?: string;
584
615
  /** Default props applied to every `<Table>` in the subtree */
585
- tableProps?: Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel'>>;
616
+ tableProps?: Partial<Pick<TableProps<any>, 'striped' | 'bordered' | 'compact' | 'stickyHeader' | 'theme' | 'direction' | 'ariaLabel' | 'adaptiveLayout'>>;
586
617
  /** Default column definition merged under every table's own `defaultColumnDef` */
587
618
  defaultColumnDef?: Partial<ColumnDefBase<any, unknown>> & Partial<ColumnDefExtensions<any, unknown>>;
588
619
  }
@@ -619,7 +650,7 @@ declare function YableProvider({ children, config, tableProfile, defaultColumnDe
619
650
  ariaLabel?: string;
620
651
  }): react_jsx_runtime.JSX.Element;
621
652
 
622
- declare function Table<TData extends RowData>({ table, stickyHeader: stickyHeaderProp, striped: stripedProp, bordered: borderedProp, compact: compactProp, theme: themeProp, config, configProfile, clickableRows, footer, loading, loadingComponent, loadingText, emptyMessage, emptyComponent, emptyIcon, emptyDetail, renderEmpty, renderLoading, children, className, direction: directionProp, statusBar, statusBarPanels, sidebar, sidebarPanels, defaultSidebarPanel, floatingFilters, columnVirtualization, columnVirtualizationOverscan, ariaLabel: ariaLabelProp, ...rest }: TableProps<TData>): react_jsx_runtime.JSX.Element;
653
+ declare function Table<TData extends RowData>({ table, stickyHeader: stickyHeaderProp, striped: stripedProp, bordered: borderedProp, compact: compactProp, theme: themeProp, config, configProfile, clickableRows, footer, loading, loadingComponent, loadingText, emptyMessage, emptyComponent, emptyIcon, emptyDetail, renderEmpty, renderLoading, children, className, direction: directionProp, statusBar, statusBarPanels, sidebar, sidebarPanels, defaultSidebarPanel, floatingFilters, columnVirtualization, columnVirtualizationOverscan, adaptiveLayout: adaptiveLayoutProp, ariaLabel: ariaLabelProp, ...rest }: TableProps<TData>): react_jsx_runtime.JSX.Element;
623
654
 
624
655
  interface TableHeaderProps<TData extends RowData> {
625
656
  table: Table$1<TData>;
@@ -1335,4 +1366,4 @@ declare function CellText({ children, variant, bold, truncate, size, }: CellText
1335
1366
  */
1336
1367
  declare function mergeEditChanges<TData>(data: TData[], changes: Record<string, Partial<TData>>, getRowId?: (row: TData, index: number) => string): TData[];
1337
1368
 
1338
- export { type ActionItem, type ActionsColumnOptions, type AutoMeasurementsOptions, CellBadge, type CellBadgeProps, CellBoolean, type CellBooleanProps, CellCheckbox, CellCurrency, type CellCurrencyProps, CellDate, CellDatePicker, type CellDateProps, CellErrorBoundary, CellInput, CellLink, type CellLinkProps, type CellMeasureRecipe, type CellMeasurement, CellNumeric, type CellNumericProps, CellProgress, type CellProgressProps, CellRating, type CellRatingProps, CellRow, type CellRowProps, CellSelect, CellStack, type CellStackProps, CellStatus, CellStatusBadge, type CellStatusBadgeProps, type CellStatusProps, CellText, type CellTextProps, CellToggle, CellWithIcon, type CellWithIconProps, ColumnsPanel, ContextMenu, ContextMenuItem, type ContextMenuItemDef, DEFAULT_TEXT_RECIPE, DragHandle, ErrorBoundary, type ExpandColumnOptions, ExpandIcon, FillHandle, type FillHandleDragState, type FillHandleProps, FiltersPanel, FlashCell, FloatingFilter, GlobalFilter, LoadingOverlay, type LoadingOverlayProps, MasterDetail, NoRowsOverlay, type NoRowsOverlayProps, Pagination, PivotConfigPanel, type PivotConfigProps, type PivotFieldItem, type PivotValueItem, PrintLayout, type ResolvedYableProfile, type RowNumberColumnOptions, type SelectColumnOptions, type ServerTableController, type ServerTableFetchArgs, type ServerTableFetchResult, type ServerTableUpdateArgs, SetFilter, Sidebar, SortIndicator, StatusBar, StatusBarPanelComponent, type StatusBarPanelComponentProps, type StatusBarPanelConfig, type StatusBarPanelProps, Table, TableBody, TableCell, type TableCellProps$1 as TableCellProps, TableFooter, TableHeader, type TableHeaderCellProps, type TableProps, TableProvider, type TableRowProps, Tooltip, type TooltipPosition, type TooltipProps, TreeToggle, type UseCellFlashOptions, type UseClipboardOptions, type UseColumnVirtualizationOptions, type UseColumnVirtualizationResult, type UseFillHandleOptions, type UseFillHandleReturn, type UseKeyboardNavigationOptions, type UsePretextMeasurementOptions, type UsePretextMeasurementResult, type UsePrintLayoutOptions, type UseRowAnimationOptions, type UseRowDragOptions, type UseRowDragReturn, type UseServerTableOptions, type UseTableOptions, type UseTablePersistenceOptions, type UseTablePersistenceReturn, type UseTableRowHeightsOptions, type UseThemeOptions, type UseTooltipOptions, type UseVirtualizationOptions, type UseVirtualizationResult, type VirtualColumn, type VirtualRow, type YableCellConfig, type YableCellConfigSet, type YableColumnConfig, type YableColumnConfigSet, type YableConfig, type YableDefaults, YableProvider, type YableRowConfig, type YableTableProfile, type YableTableVisualConfig, actionsColumn, applyYableConfigToColumns, createYableConfig, expandColumn, getMeasureRecipeForCellType, getRegisteredCellTypes, getYableDefaultColumnDef, mergeEditChanges, resolveMeasureRecipe, resolveYableProfile, rowNumberColumn, selectColumn, useAutoMeasurements, useCellFlash, useClipboard, useColumnVirtualization, useContextMenu, useFillHandle, useKeyboardNavigation, usePretextMeasurement, usePrintLayout, useRowAnimation, useRowDrag, useServerTable, useTable, useTableContext, useTablePersistence, useTableRowHeights, useTheme, useTooltip, useVirtualization, useYableDefaults };
1369
+ export { type ActionItem, type ActionsColumnOptions, type AdaptiveTableCardContext, type AdaptiveTableLayoutMode, type AdaptiveTableLayoutOptions, type AutoMeasurementsOptions, CellBadge, type CellBadgeProps, CellBoolean, type CellBooleanProps, CellCheckbox, CellCurrency, type CellCurrencyProps, CellDate, CellDatePicker, type CellDateProps, CellErrorBoundary, CellInput, CellLink, type CellLinkProps, type CellMeasureRecipe, type CellMeasurement, CellNumeric, type CellNumericProps, CellProgress, type CellProgressProps, CellRating, type CellRatingProps, CellRow, type CellRowProps, CellSelect, CellStack, type CellStackProps, CellStatus, CellStatusBadge, type CellStatusBadgeProps, type CellStatusProps, CellText, type CellTextProps, CellToggle, CellWithIcon, type CellWithIconProps, ColumnsPanel, ContextMenu, ContextMenuItem, type ContextMenuItemDef, DEFAULT_TEXT_RECIPE, DragHandle, ErrorBoundary, type ExpandColumnOptions, ExpandIcon, FillHandle, type FillHandleDragState, type FillHandleProps, FiltersPanel, FlashCell, FloatingFilter, GlobalFilter, LoadingOverlay, type LoadingOverlayProps, MasterDetail, NoRowsOverlay, type NoRowsOverlayProps, Pagination, PivotConfigPanel, type PivotConfigProps, type PivotFieldItem, type PivotValueItem, PrintLayout, type ResolvedYableProfile, type RowNumberColumnOptions, type SelectColumnOptions, type ServerTableController, type ServerTableFetchArgs, type ServerTableFetchResult, type ServerTableUpdateArgs, SetFilter, Sidebar, SortIndicator, StatusBar, StatusBarPanelComponent, type StatusBarPanelComponentProps, type StatusBarPanelConfig, type StatusBarPanelProps, Table, TableBody, TableCell, type TableCellProps$1 as TableCellProps, TableFooter, TableHeader, type TableHeaderCellProps, type TableProps, TableProvider, type TableRowProps, Tooltip, type TooltipPosition, type TooltipProps, TreeToggle, type UseCellFlashOptions, type UseClipboardOptions, type UseColumnVirtualizationOptions, type UseColumnVirtualizationResult, type UseFillHandleOptions, type UseFillHandleReturn, type UseKeyboardNavigationOptions, type UsePretextMeasurementOptions, type UsePretextMeasurementResult, type UsePrintLayoutOptions, type UseRowAnimationOptions, type UseRowDragOptions, type UseRowDragReturn, type UseServerTableOptions, type UseTableOptions, type UseTablePersistenceOptions, type UseTablePersistenceReturn, type UseTableRowHeightsOptions, type UseThemeOptions, type UseTooltipOptions, type UseVirtualizationOptions, type UseVirtualizationResult, type VirtualColumn, type VirtualRow, type YableCellConfig, type YableCellConfigSet, type YableColumnConfig, type YableColumnConfigSet, type YableConfig, type YableDefaults, YableProvider, type YableRowConfig, type YableTableProfile, type YableTableVisualConfig, actionsColumn, applyYableConfigToColumns, createYableConfig, expandColumn, getMeasureRecipeForCellType, getRegisteredCellTypes, getYableDefaultColumnDef, mergeEditChanges, resolveMeasureRecipe, resolveYableProfile, rowNumberColumn, selectColumn, useAutoMeasurements, useCellFlash, useClipboard, useColumnVirtualization, useContextMenu, useFillHandle, useKeyboardNavigation, usePretextMeasurement, usePrintLayout, useRowAnimation, useRowDrag, useServerTable, useTable, useTableContext, useTablePersistence, useTableRowHeights, useTheme, useTooltip, useVirtualization, useYableDefaults };
package/dist/index.js CHANGED
@@ -2213,6 +2213,62 @@ function FillHandle({
2213
2213
  }
2214
2214
  );
2215
2215
  }
2216
+ function renderCellContent(cell, table) {
2217
+ const column = cell.column;
2218
+ const isEditing = cell.getIsEditing();
2219
+ const isAlwaysEditable = cell.getIsAlwaysEditable();
2220
+ const cellStatus = table.getCellStatus(cell.row.id, column.id);
2221
+ const overrideValue = cellStatus !== "idle" ? table.getCellRenderValue(cell.row.id, column.id) : void 0;
2222
+ let content;
2223
+ const cellDef = column.columnDef.cell;
2224
+ const cellType = column.columnDef.cellType;
2225
+ if (typeof cellDef === "function") {
2226
+ const ctx = cell.getContext();
2227
+ if (overrideValue !== void 0) {
2228
+ const overriddenCtx = {
2229
+ ...ctx,
2230
+ getValue: () => overrideValue,
2231
+ renderValue: () => overrideValue
2232
+ };
2233
+ content = cellDef(overriddenCtx);
2234
+ } else {
2235
+ content = cellDef(ctx);
2236
+ }
2237
+ } else if (cellType && !(isEditing || isAlwaysEditable)) {
2238
+ content = resolveCellType(cellType, cell.getContext(), column.columnDef.cellTypeProps);
2239
+ } else {
2240
+ content = overrideValue !== void 0 ? overrideValue : cell.renderValue();
2241
+ }
2242
+ if (!cell.row.getIsGrouped()) return content;
2243
+ if (column.id === cell.row.groupingColumnId) {
2244
+ const expanded = cell.row.getIsExpanded();
2245
+ return /* @__PURE__ */ jsxs("span", { className: "yable-group-cell", style: { paddingLeft: cell.row.depth * 16 }, children: [
2246
+ /* @__PURE__ */ jsx(
2247
+ "button",
2248
+ {
2249
+ type: "button",
2250
+ className: "yable-group-toggle",
2251
+ "aria-label": expanded ? "Collapse group" : "Expand group",
2252
+ "aria-expanded": expanded,
2253
+ onClick: cell.row.getToggleExpandedHandler(),
2254
+ children: expanded ? "\u25BE" : "\u25B8"
2255
+ }
2256
+ ),
2257
+ /* @__PURE__ */ jsx("span", { className: "yable-group-value", children: String(cell.row.groupingValue ?? "") }),
2258
+ /* @__PURE__ */ jsxs("span", { className: "yable-group-count", children: [
2259
+ "(",
2260
+ cell.row.getLeafRows().length,
2261
+ ")"
2262
+ ] })
2263
+ ] });
2264
+ }
2265
+ const aggDef = column.columnDef.aggregatedCell;
2266
+ if (typeof aggDef === "function") {
2267
+ return aggDef(cell.getContext());
2268
+ }
2269
+ const aggVal = cell.getValue();
2270
+ return aggVal == null ? null : aggVal;
2271
+ }
2216
2272
  function TableCell({
2217
2273
  cell,
2218
2274
  table,
@@ -2248,29 +2304,11 @@ function TableCell({
2248
2304
  const selectionEdges = table.getCellSelectionEdges(rowIndex, columnIndex);
2249
2305
  const isCellSelected = selectionEdges !== null;
2250
2306
  const isMultiCellSelection = selectionRange !== null && (selectionRange.start.rowIndex !== selectionRange.end.rowIndex || selectionRange.start.columnIndex !== selectionRange.end.columnIndex);
2251
- const overrideValue = cellStatus !== "idle" ? table.getCellRenderValue(cell.row.id, column.id) : void 0;
2252
- let content;
2253
- const cellDef = column.columnDef.cell;
2254
- const cellType = column.columnDef.cellType;
2255
- if (typeof cellDef === "function") {
2256
- const ctx = cell.getContext();
2257
- if (overrideValue !== void 0) {
2258
- const overriddenCtx = {
2259
- ...ctx,
2260
- getValue: () => overrideValue,
2261
- renderValue: () => overrideValue
2262
- };
2263
- content = cellDef(overriddenCtx);
2264
- } else {
2265
- content = cellDef(ctx);
2266
- }
2267
- } else if (cellType && !(isEditing || isAlwaysEditable)) {
2268
- content = resolveCellType(cellType, cell.getContext(), column.columnDef.cellTypeProps);
2269
- } else {
2270
- content = overrideValue !== void 0 ? overrideValue : cell.renderValue();
2271
- }
2307
+ const isGroupRow = cell.row.getIsGrouped();
2308
+ const content = renderCellContent(cell, table);
2272
2309
  const handleClick = useCallback(
2273
2310
  (e) => {
2311
+ if (cell.row.getIsGrouped()) return;
2274
2312
  table.events.emit("cell:click", {
2275
2313
  cell,
2276
2314
  row: cell.row,
@@ -2336,7 +2374,7 @@ function TableCell({
2336
2374
  const cellStyleDef = column.columnDef.cellStyle;
2337
2375
  const userStyle = typeof cellStyleDef === "function" ? cellStyleDef(cell.getContext()) : cellStyleDef;
2338
2376
  const mergedStyle = userStyle ? { ...style, ...userStyle } : style;
2339
- const showFillHandle = isFocused && Boolean(table.options.enableFillHandle) && onFillHandleMouseDown != null;
2377
+ const showFillHandle = isFocused && Boolean(table.options.enableFillHandle) && onFillHandleMouseDown != null && !isGroupRow;
2340
2378
  const classNames = [
2341
2379
  "yable-td",
2342
2380
  isFocused && "yable-cell--focused",
@@ -2357,6 +2395,7 @@ function TableCell({
2357
2395
  "data-pinned": pinned || void 0,
2358
2396
  "data-cell-status": cellStatus !== "idle" ? cellStatus : void 0,
2359
2397
  "data-column-id": column.id,
2398
+ "data-grouped": isGroupRow || void 0,
2360
2399
  "data-row-index": rowIndex,
2361
2400
  "data-column-index": columnIndex,
2362
2401
  "data-cell-selected": isCellSelected || void 0,
@@ -2831,6 +2870,202 @@ function isInteractiveClickTarget2(target) {
2831
2870
  target.closest('input, textarea, select, button, a[href], [contenteditable="true"]')
2832
2871
  );
2833
2872
  }
2873
+ function AdaptiveTableCards({
2874
+ table,
2875
+ layout,
2876
+ clickableRows
2877
+ }) {
2878
+ const rows = table.getRowModel().rows;
2879
+ const visibleColumns = table.getVisibleLeafColumns();
2880
+ return /* @__PURE__ */ jsx("div", { className: "yable-adaptive-cards", role: "rowgroup", children: rows.map((row, rowIndex) => /* @__PURE__ */ jsx(
2881
+ AdaptiveTableCard,
2882
+ {
2883
+ row,
2884
+ table,
2885
+ rowIndex,
2886
+ visibleColumns,
2887
+ layout,
2888
+ clickable: clickableRows
2889
+ },
2890
+ row.id
2891
+ )) });
2892
+ }
2893
+ function AdaptiveTableCard({
2894
+ row,
2895
+ table,
2896
+ rowIndex,
2897
+ visibleColumns,
2898
+ layout,
2899
+ clickable
2900
+ }) {
2901
+ const { cells, primaryCell, secondaryCells } = getAdaptiveCells(row, visibleColumns, layout);
2902
+ return /* @__PURE__ */ jsx(
2903
+ "article",
2904
+ {
2905
+ className: "yable-adaptive-card",
2906
+ role: "row",
2907
+ "data-selected": row.getIsSelected() || void 0,
2908
+ "data-expanded": row.getIsExpanded() || void 0,
2909
+ "data-clickable": clickable || void 0,
2910
+ "data-row-id": row.id,
2911
+ "data-row-index": rowIndex,
2912
+ "aria-selected": table.options.enableRowSelection ? row.getIsSelected() : void 0,
2913
+ onClick: (e) => {
2914
+ if (table.options.enableRowClickSelection && row.getCanSelect() && !isInteractiveClickTarget3(e.target)) {
2915
+ row.toggleSelected();
2916
+ }
2917
+ if (clickable) emitRowEvent(table, "row:click", row, e.nativeEvent);
2918
+ },
2919
+ onDoubleClick: (e) => emitRowEvent(table, "row:dblclick", row, e.nativeEvent),
2920
+ onContextMenu: (e) => emitRowEvent(table, "row:contextmenu", row, e.nativeEvent),
2921
+ children: layout.renderCard ? layout.renderCard({
2922
+ table,
2923
+ row,
2924
+ rowIndex,
2925
+ cells,
2926
+ primaryCell,
2927
+ secondaryCells,
2928
+ visibleColumns
2929
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2930
+ primaryCell && /* @__PURE__ */ jsx("div", { className: "yable-adaptive-card-header", children: /* @__PURE__ */ jsx("div", { className: "yable-adaptive-card-title", children: /* @__PURE__ */ jsx(
2931
+ AdaptiveTableCardCell,
2932
+ {
2933
+ cell: primaryCell,
2934
+ table,
2935
+ rowIndex,
2936
+ columnIndex: 0,
2937
+ primary: true
2938
+ }
2939
+ ) }) }),
2940
+ secondaryCells.length > 0 && /* @__PURE__ */ jsx("div", { className: "yable-adaptive-card-fields", children: secondaryCells.map((cell, index) => /* @__PURE__ */ jsx(
2941
+ AdaptiveTableCardCell,
2942
+ {
2943
+ cell,
2944
+ table,
2945
+ rowIndex,
2946
+ columnIndex: index + 1
2947
+ },
2948
+ cell.id
2949
+ )) })
2950
+ ] })
2951
+ }
2952
+ );
2953
+ }
2954
+ function emitRowEvent(table, event, row, originalEvent) {
2955
+ table.events.emit(event, {
2956
+ row,
2957
+ cells: row.getAllCells(),
2958
+ originalEvent
2959
+ });
2960
+ }
2961
+ function emitCellEvent(table, event, cell, originalEvent) {
2962
+ table.events.emit(event, {
2963
+ cell,
2964
+ row: cell.row,
2965
+ column: cell.column,
2966
+ originalEvent
2967
+ });
2968
+ }
2969
+ function AdaptiveTableCardCell({
2970
+ cell,
2971
+ table,
2972
+ rowIndex,
2973
+ columnIndex,
2974
+ primary
2975
+ }) {
2976
+ const column = cell.column;
2977
+ const isEditing = cell.getIsEditing();
2978
+ const isAlwaysEditable = cell.getIsAlwaysEditable();
2979
+ const cellStatus = table.getCellStatus(cell.row.id, column.id);
2980
+ const cellErrorMessage = table.getCellErrorMessage(cell.row.id, column.id);
2981
+ const cellConflictWith = table.getCellConflictWith(cell.row.id, column.id);
2982
+ const content = renderCellContent(cell, table);
2983
+ const header = column.columnDef.header;
2984
+ const label = typeof header === "string" ? header : column.id;
2985
+ return /* @__PURE__ */ jsx(CellErrorBoundary, { resetKeys: [cell.getValue(), cellStatus], children: /* @__PURE__ */ jsxs(
2986
+ "div",
2987
+ {
2988
+ className: primary ? "yable-adaptive-card-primary" : "yable-adaptive-card-cell",
2989
+ "data-column-id": column.id,
2990
+ "data-cell-status": cellStatus !== "idle" ? cellStatus : void 0,
2991
+ "data-row-index": rowIndex,
2992
+ "data-column-index": columnIndex,
2993
+ role: "gridcell",
2994
+ "aria-colindex": columnIndex + 1,
2995
+ onClick: (e) => {
2996
+ if (cell.row.getIsGrouped()) return;
2997
+ emitCellEvent(table, "cell:click", cell, e.nativeEvent);
2998
+ if (canCellEnterEditMode(table, cell.row, column) && !isAlwaysEditable && !isEditing && !e.shiftKey && !e.metaKey && !e.ctrlKey) {
2999
+ table.startEditing(cell.row.id, column.id);
3000
+ }
3001
+ },
3002
+ onDoubleClick: (e) => emitCellEvent(table, "cell:dblclick", cell, e.nativeEvent),
3003
+ onContextMenu: (e) => emitCellEvent(table, "cell:contextmenu", cell, e.nativeEvent),
3004
+ children: [
3005
+ !primary && /* @__PURE__ */ jsx("span", { className: "yable-adaptive-card-label", children: label }),
3006
+ /* @__PURE__ */ jsxs("span", { className: "yable-adaptive-card-value", children: [
3007
+ content,
3008
+ cellStatus === "error" && /* @__PURE__ */ jsx(
3009
+ CellStatusBadge,
3010
+ {
3011
+ status: "error",
3012
+ message: cellErrorMessage,
3013
+ onRetry: () => void table.retryCommit(cell.row.id, column.id),
3014
+ onDismiss: () => table.dismissCommit(cell.row.id, column.id)
3015
+ }
3016
+ ),
3017
+ cellStatus === "conflict" && /* @__PURE__ */ jsx(
3018
+ CellStatusBadge,
3019
+ {
3020
+ status: "conflict",
3021
+ conflictWith: cellConflictWith,
3022
+ onRetry: () => void table.retryCommit(cell.row.id, column.id),
3023
+ onDismiss: () => table.dismissCommit(cell.row.id, column.id)
3024
+ }
3025
+ )
3026
+ ] })
3027
+ ]
3028
+ }
3029
+ ) });
3030
+ }
3031
+ function getAdaptiveCells(row, visibleColumns, layout) {
3032
+ const hidden = new Set(layout.hiddenColumnIds ?? []);
3033
+ const allCellsByColumn = new Map(row.getAllCells().map((cell) => [cell.column.id, cell]));
3034
+ const visibleCells = [];
3035
+ for (const column of visibleColumns) {
3036
+ if (hidden.has(column.id)) continue;
3037
+ const cell = allCellsByColumn.get(column.id);
3038
+ if (cell) visibleCells.push(cell);
3039
+ }
3040
+ const cellsByColumn = new Map(visibleCells.map((cell) => [cell.column.id, cell]));
3041
+ const primaryCell = (layout.primaryColumnId ? cellsByColumn.get(layout.primaryColumnId) : void 0) ?? visibleCells[0];
3042
+ const primaryColumnId = primaryCell?.column.id;
3043
+ let secondaryCells;
3044
+ if (layout.secondaryColumnIds) {
3045
+ secondaryCells = [];
3046
+ for (const columnId of layout.secondaryColumnIds) {
3047
+ if (hidden.has(columnId) || columnId === primaryColumnId) continue;
3048
+ const cell = cellsByColumn.get(columnId);
3049
+ if (cell) secondaryCells.push(cell);
3050
+ }
3051
+ } else {
3052
+ secondaryCells = visibleCells.filter((cell) => cell.column.id !== primaryColumnId);
3053
+ if (secondaryCells.length > layout.maxSecondaryColumns) {
3054
+ secondaryCells = secondaryCells.slice(0, layout.maxSecondaryColumns);
3055
+ }
3056
+ }
3057
+ return {
3058
+ cells: visibleCells,
3059
+ primaryCell,
3060
+ secondaryCells
3061
+ };
3062
+ }
3063
+ function isInteractiveClickTarget3(target) {
3064
+ if (!(target instanceof HTMLElement)) return false;
3065
+ return Boolean(
3066
+ target.closest('input, textarea, select, button, a[href], [contenteditable="true"]')
3067
+ );
3068
+ }
2834
3069
  function TableFooter({ table }) {
2835
3070
  const footerGroups = table.getFooterGroups();
2836
3071
  if (!footerGroups.length) return null;
@@ -4158,6 +4393,7 @@ function Table({
4158
4393
  floatingFilters,
4159
4394
  columnVirtualization,
4160
4395
  columnVirtualizationOverscan,
4396
+ adaptiveLayout: adaptiveLayoutProp,
4161
4397
  ariaLabel: ariaLabelProp,
4162
4398
  ...rest
4163
4399
  }) {
@@ -4183,6 +4419,7 @@ function Table({
4183
4419
  const resolvedFloatingFilters = floatingFilters ?? profileTableProps?.floatingFilters;
4184
4420
  const resolvedColumnVirtualization = columnVirtualization ?? profileTableProps?.columnVirtualization;
4185
4421
  const resolvedColumnVirtualizationOverscan = columnVirtualizationOverscan ?? profileTableProps?.columnVirtualizationOverscan;
4422
+ const resolvedAdaptiveLayout = adaptiveLayoutProp ?? profileTableProps?.adaptiveLayout ?? providerTableProps?.adaptiveLayout;
4186
4423
  const [sidebarOpen, setSidebarOpen] = useState(false);
4187
4424
  const [sidebarPanel, setSidebarPanel] = useState(
4188
4425
  resolvedDefaultSidebarPanel ?? "columns"
@@ -4190,6 +4427,11 @@ function Table({
4190
4427
  const containerRef = useRef(null);
4191
4428
  const horizontalScrollRef = useRef(null);
4192
4429
  const isRtl = direction === "rtl";
4430
+ const adaptiveLayout = useMemo(
4431
+ () => normalizeAdaptiveLayout(resolvedAdaptiveLayout),
4432
+ [resolvedAdaptiveLayout]
4433
+ );
4434
+ const adaptiveLayoutActive = useAdaptiveLayoutActive(containerRef, adaptiveLayout);
4193
4435
  const classNames = [
4194
4436
  "yable",
4195
4437
  theme && `yable-theme-${theme}`,
@@ -4200,6 +4442,8 @@ function Table({
4200
4442
  loading && "yable-loading",
4201
4443
  isRtl && "yable--rtl",
4202
4444
  sidebarOpen && "yable--sidebar-open",
4445
+ adaptiveLayout && adaptiveLayout.mode !== "table" && "yable--adaptive-layout",
4446
+ adaptiveLayoutActive && "yable--adaptive-cards-active",
4203
4447
  className
4204
4448
  ].filter(Boolean).join(" ");
4205
4449
  const rows = table.getRowModel().rows;
@@ -4209,7 +4453,7 @@ function Table({
4209
4453
  const allVisibleColumns = table.getVisibleLeafColumns();
4210
4454
  const hasPinnedColumns = table.getLeftVisibleLeafColumns().length > 0 || table.getRightVisibleLeafColumns().length > 0;
4211
4455
  const hasGroupedHeaders = table.getHeaderGroups().length > 1;
4212
- const canVirtualizeColumns = Boolean(resolvedColumnVirtualization) && !hasPinnedColumns && !hasGroupedHeaders && allVisibleColumns.length > 0;
4456
+ const canVirtualizeColumns = !adaptiveLayoutActive && Boolean(resolvedColumnVirtualization) && !hasPinnedColumns && !hasGroupedHeaders && allVisibleColumns.length > 0;
4213
4457
  const allVisibleColumnSizeSignature = allVisibleColumns.map((column) => `${column.id}:${column.getSize()}`).join("|");
4214
4458
  const columnVirtualState = useColumnVirtualization({
4215
4459
  containerRef: horizontalScrollRef,
@@ -4325,7 +4569,7 @@ function Table({
4325
4569
  columnVirtualState.startOffset,
4326
4570
  visibleColumnTotalSize
4327
4571
  ]);
4328
- const tableNode = /* @__PURE__ */ jsxs(
4572
+ const desktopTableNode = /* @__PURE__ */ jsxs(
4329
4573
  "table",
4330
4574
  {
4331
4575
  className: "yable-table",
@@ -4347,6 +4591,14 @@ function Table({
4347
4591
  ]
4348
4592
  }
4349
4593
  );
4594
+ const tableNode = adaptiveLayoutActive && adaptiveLayout ? /* @__PURE__ */ jsx(
4595
+ AdaptiveTableCards,
4596
+ {
4597
+ table,
4598
+ layout: adaptiveLayout,
4599
+ clickableRows: resolvedClickableRows
4600
+ }
4601
+ ) : desktopTableNode;
4350
4602
  return /* @__PURE__ */ jsx(TableProvider, { value: table, children: /* @__PURE__ */ jsxs(
4351
4603
  "div",
4352
4604
  {
@@ -4362,7 +4614,7 @@ function Table({
4362
4614
  ...rest,
4363
4615
  children: [
4364
4616
  /* @__PURE__ */ jsxs("div", { className: "yable-main", children: [
4365
- showColumnVirtualizationShell ? /* @__PURE__ */ jsx(
4617
+ showColumnVirtualizationShell && !adaptiveLayoutActive ? /* @__PURE__ */ jsx(
4366
4618
  "div",
4367
4619
  {
4368
4620
  ref: horizontalScrollRef,
@@ -4478,6 +4730,58 @@ function Table({
4478
4730
  }
4479
4731
  ) });
4480
4732
  }
4733
+ var DEFAULT_ADAPTIVE_BREAKPOINT = 720;
4734
+ var DEFAULT_ADAPTIVE_SECONDARY_COLUMNS = 8;
4735
+ function normalizeAdaptiveLayout(layout) {
4736
+ if (!layout) return null;
4737
+ if (layout === true) {
4738
+ return {
4739
+ mode: "auto",
4740
+ breakpoint: DEFAULT_ADAPTIVE_BREAKPOINT,
4741
+ maxSecondaryColumns: DEFAULT_ADAPTIVE_SECONDARY_COLUMNS
4742
+ };
4743
+ }
4744
+ return {
4745
+ mode: layout.mode ?? "auto",
4746
+ breakpoint: layout.breakpoint ?? DEFAULT_ADAPTIVE_BREAKPOINT,
4747
+ primaryColumnId: layout.primaryColumnId,
4748
+ secondaryColumnIds: layout.secondaryColumnIds,
4749
+ hiddenColumnIds: layout.hiddenColumnIds,
4750
+ maxSecondaryColumns: layout.maxSecondaryColumns ?? DEFAULT_ADAPTIVE_SECONDARY_COLUMNS,
4751
+ renderCard: layout.renderCard
4752
+ };
4753
+ }
4754
+ function useAdaptiveLayoutActive(containerRef, layout) {
4755
+ const [active, setActive] = useState(() => layout?.mode === "cards");
4756
+ useEffect(() => {
4757
+ if (!layout) {
4758
+ setActive(false);
4759
+ return;
4760
+ }
4761
+ if (layout.mode === "cards" || layout.mode === "table") {
4762
+ setActive(layout.mode === "cards");
4763
+ return;
4764
+ }
4765
+ const node = containerRef.current;
4766
+ if (!node) return;
4767
+ const update = (width) => {
4768
+ setActive(width <= layout.breakpoint);
4769
+ };
4770
+ update(node.getBoundingClientRect().width || node.clientWidth);
4771
+ if (typeof ResizeObserver === "undefined") {
4772
+ const handleResize = () => update(node.getBoundingClientRect().width || node.clientWidth);
4773
+ window.addEventListener("resize", handleResize);
4774
+ return () => window.removeEventListener("resize", handleResize);
4775
+ }
4776
+ const observer = new ResizeObserver((entries) => {
4777
+ const width = entries[0]?.contentRect.width ?? node.getBoundingClientRect().width;
4778
+ update(width);
4779
+ });
4780
+ observer.observe(node);
4781
+ return () => observer.disconnect();
4782
+ }, [containerRef, layout]);
4783
+ return active;
4784
+ }
4481
4785
  function ChevronLeftIcon() {
4482
4786
  return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M8.5 3L4.5 7L8.5 11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
4483
4787
  }