jattac.libs.web.responsive-table 0.12.0 → 0.14.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.
package/README.md CHANGED
@@ -18,6 +18,19 @@ npm install jattac.libs.web.responsive-table jattac.libs.web.zest-textbox react-
18
18
 
19
19
  ---
20
20
 
21
+ ## Table of Contents
22
+
23
+ * [Built-in Filter](#built-in-filter)
24
+ * [Delightful Data Fetching: Smart Data Source](#delightful-data-fetching-smart-data-source)
25
+ * [Basic Implementation](#basic-implementation)
26
+ * [Handling Interactive Elements](#handling-interactive-elements)
27
+ * [Expandable Rows](#expandable-rows)
28
+ * [Row Interaction & Feedback](#row-interaction--feedback)
29
+ * [Loading States & Animations](#loading-states--animations)
30
+ * [Documentation Directory](#documentation-directory)
31
+
32
+ ---
33
+
21
34
  ## Built-in Filter
22
35
 
23
36
  Enable the search box with one prop. A clear (×) button appears automatically when the field has text.
@@ -144,7 +157,7 @@ For a deep dive into more complex scenarios, see the **[Handling Interactive Ele
144
157
 
145
158
  ## Expandable Rows
146
159
 
147
- Pass `expandRowRenderer` to reveal arbitrary content below any row. Each expandable row gets a solid chevron toggle (▶ collapsed, ▾ expanded) on a muted blue bar. Returning `null` or `undefined` for a row suppresses its toggle entirely — that row renders flat with no visual affordance.
160
+ Pass `expandRowRenderer` to reveal arbitrary content below any row. Each expandable row gets a chevron in a dedicated left column (▶ collapsed, ▾ expanded). Returning `null` or `undefined` for a row suppresses its toggle entirely — that row renders flat with no visual affordance.
148
161
 
149
162
  ```tsx
150
163
  <ResponsiveTable
@@ -174,7 +187,7 @@ expandRowRenderer={(row, rowIndex) => (
174
187
 
175
188
  > `rowIndex` is the **display-order** index (post-sort, post-filter) — it changes when the user re-sorts. For stable data correlation across renders, use the row's own identifier field (`row.id`, etc.).
176
189
 
177
- **Customising the chevron** — override color, size, or any other style via `expandChevronClassName`:
190
+ **Customising the chevron** — override color, size, or any other style via `expandChevronClassName`. Do not override `transform` or `transition` — these drive the rotation animation.
178
191
 
179
192
  ```tsx
180
193
  // Accent color from your design system
@@ -193,12 +206,17 @@ expandRowRenderer={(row, rowIndex) => (
193
206
  }
194
207
  ```
195
208
 
196
- **Recommendations**
197
- - Provide `selectionProps` with a `rowIdKey` when your data has a stable identifier. Expand state is keyed by row ID, so open panels survive re-sorts and filter changes.
198
- - Detail content is **lazy-mounted** the panel component is not created until first expand, then stays mounted so the collapse animation plays correctly. Heavy components are therefore only instantiated on demand.
199
- - Expand and `onRowClick` coexist safely — the chevron bar carries `data-rt-ignore-row-click` so tapping the toggle never fires the row click handler.
209
+ **Behaviour**
210
+ - Chevron sits in a dedicated 2rem left column not as an overlay or pseudo-element keeping the data columns aligned.
211
+ - **Idle:** chevron at 25% opacity, rotates right (`-90deg`). Quiet, non-intrusive.
212
+ - **Hover:** chevron smooths to 60% opacity, faint border accent on the row.
213
+ - **Expanded:** chevron rotates down (`0deg`), full opacity. A toggle bar slides in (0→2rem) at the top of the detail pane.
214
+ - **Greeting animation:** on mount, chevrons pop in with a staggered multi-pulse wave (2.2s), then settle to idle. Plays once per component lifecycle.
215
+ - Expand and `onRowClick` coexist safely — the chevron carries `data-rt-ignore-row-click`.
200
216
  - Works identically in both desktop (table row) and mobile (card) layouts.
201
217
 
218
+ For the full feature reference — expansion state keying, lazy mounting, keyboard accessibility, `dataSource` compatibility, common patterns, CSS customization, and pitfalls — see the **[Row Expansion and Collapse Guide](./docs/expand-collapse.md)**.
219
+
202
220
  ---
203
221
 
204
222
  ## Row Interaction & Feedback
@@ -267,6 +285,8 @@ The following technical documentation provides comprehensive implementation guid
267
285
  4. **[Configuration Specification](./docs/configuration.md)** - Detailed guidance on performance tuning and UI customization.
268
286
  5. **[Architecture and Contribution Guide](./docs/development.md)** - Internal system design and development environment setup.
269
287
  6. **[Handling Interactive Elements](./docs/handling-interactive-elements.md)** - Guide on preventing row click bubbling for buttons and custom components.
288
+ 7. **[Row Expansion and Collapse](./docs/expand-collapse.md)** - Comprehensive guide for expandable row detail panels.
289
+ 8. **[Recommendations and Pitfalls](./docs/recommendations.md)** - Best practices, anti-patterns, and ESM/CJS module compatibility guide.
270
290
 
271
291
  ---
272
292
  **Next Step:** [Review the Technical Implementation Guide](./docs/examples.md)
@@ -1,12 +1,5 @@
1
- import { ReactNode } from 'react';
2
1
  import { IResponsiveTablePlugin } from '../Plugins/IResponsiveTablePlugin';
3
2
  import { IResponsiveTableColumnDefinition, SortDirection } from '../Data/IResponsiveTableColumnDefinition';
4
- interface IInfiniteScrollProps<TData> {
5
- onLoadMore: (currentData: TData[]) => Promise<TData[] | null>;
6
- hasMore?: boolean;
7
- loadingMoreComponent?: ReactNode;
8
- noMoreDataComponent?: ReactNode;
9
- }
10
3
  interface UseTablePluginsProps<TData> {
11
4
  data: TData[];
12
5
  plugins?: IResponsiveTablePlugin<TData>[];
@@ -28,7 +21,6 @@ interface UseTablePluginsProps<TData> {
28
21
  };
29
22
  columnDefinitions: (IResponsiveTableColumnDefinition<TData> | ((data: TData, rowIndex?: number) => IResponsiveTableColumnDefinition<TData>))[];
30
23
  getScrollableElement: () => HTMLElement | null;
31
- infiniteScrollProps?: IInfiniteScrollProps<TData>;
32
24
  onFilterChange?: (filterText: string) => void;
33
25
  }
34
26
  interface UseTablePluginsReturn<TData> {
@@ -18,12 +18,6 @@ export interface IPluginAPI<TData> {
18
18
  forceUpdate: () => void;
19
19
  columnDefinitions: ColumnDefinition<TData>[];
20
20
  getScrollableElement?: () => HTMLElement | null;
21
- infiniteScrollProps?: {
22
- onLoadMore: (currentData: TData[]) => Promise<TData[] | null>;
23
- hasMore?: boolean;
24
- loadingMoreComponent?: ReactNode;
25
- noMoreDataComponent?: ReactNode;
26
- };
27
21
  filterProps?: {
28
22
  showFilter?: boolean;
29
23
  filterPlaceholder?: string;
@@ -6,7 +6,6 @@ interface DetailRowProps<TData> {
6
6
  expandRowRenderer: (row: TData, rowIndex: number) => React.ReactNode;
7
7
  isExpanded: boolean;
8
8
  onToggle: () => void;
9
- expandChevronClassName?: string;
10
9
  }
11
- export declare function DetailRow<TData>({ row, rowIndex, colSpan, expandRowRenderer, isExpanded, onToggle, expandChevronClassName }: DetailRowProps<TData>): React.JSX.Element;
10
+ export declare function DetailRow<TData>({ row, rowIndex, colSpan, expandRowRenderer, isExpanded, onToggle }: DetailRowProps<TData>): React.JSX.Element;
12
11
  export {};
@@ -10,12 +10,6 @@ export interface ResponsiveTableHandle<TData> {
10
10
  resetAndFetch: () => Promise<void>;
11
11
  getState: () => DataSourceState<TData>;
12
12
  }
13
- interface IInfiniteScrollProps<TData> {
14
- onLoadMore: (currentData: TData[]) => Promise<TData[] | null>;
15
- hasMore?: boolean;
16
- loadingMoreComponent?: ReactNode;
17
- noMoreDataComponent?: ReactNode;
18
- }
19
13
  interface ISortProps {
20
14
  initialSortColumn?: string;
21
15
  initialSortDirection?: SortDirection;
@@ -62,11 +56,6 @@ interface IProps<TData> {
62
56
  plugins?: IResponsiveTablePlugin<TData>[];
63
57
  /** If true, the header will stick to the top of the page when scrolling. */
64
58
  enablePageLevelStickyHeader?: boolean;
65
- /**
66
- * Props for manual infinite scroll handling.
67
- * NOTE: Prefer using `dataSource` for a more seamless experience.
68
- */
69
- infiniteScrollProps?: IInfiniteScrollProps<TData>;
70
59
  /** Configuration for the built-in filter plugin. */
71
60
  filterProps?: {
72
61
  showFilter?: boolean;
@@ -32,6 +32,12 @@ interface TableBodyRowProps<TData> {
32
32
  isLoading?: boolean;
33
33
  animateOnLoad?: boolean;
34
34
  };
35
+ /** Optional expand chevron cell rendered as the first column */
36
+ expandCell?: React.ReactNode;
37
+ /** Mouse enter handler for hover tracking */
38
+ onMouseEnter?: () => void;
39
+ /** Mouse leave handler for hover tracking */
40
+ onMouseLeave?: () => void;
35
41
  }
36
42
  export declare function TableBodyRow<TData>(props: TableBodyRowProps<TData>): React.JSX.Element;
37
43
  export {};
package/dist/index.d.ts CHANGED
@@ -5,9 +5,8 @@ import ResponsiveTable, { ResponsiveTableHandle } from './UI/ResponsiveTable';
5
5
  import { ColumnDefinition, DataSource, IDataSourceParams, DataSourceResult, useTableContext } from './Context/TableContext';
6
6
  import { DataSourceState } from './Hooks/useTableDataSource';
7
7
  import { FilterPlugin } from './Plugins/FilterPlugin';
8
- import { InfiniteScrollPlugin } from './Plugins/InfiniteScrollPlugin';
9
8
  import { IResponsiveTablePlugin } from './Plugins/IResponsiveTablePlugin';
10
9
  import { SortPlugin } from './Plugins/SortPlugin';
11
10
  import { SelectionPlugin } from './Plugins/SelectionPlugin';
12
- export { SortDirection, IResponsiveTableColumnDefinition, ColumnDefinition, DataSource, IDataSourceParams, DataSourceResult, IFooterColumnDefinition, IFooterRowDefinition, FilterPlugin, InfiniteScrollPlugin, IResponsiveTablePlugin, SortPlugin, SelectionPlugin, ResponsiveTableHandle, DataSourceState, useTableContext, };
11
+ export { SortDirection, IResponsiveTableColumnDefinition, ColumnDefinition, DataSource, IDataSourceParams, DataSourceResult, IFooterColumnDefinition, IFooterRowDefinition, FilterPlugin, IResponsiveTablePlugin, SortPlugin, SelectionPlugin, ResponsiveTableHandle, DataSourceState, useTableContext, };
13
12
  export default ResponsiveTable;