@opencxh/ui-kit 3.105.0 → 3.106.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.
@@ -1,4 +1,14 @@
1
1
  import { default as React } from 'react';
2
+ export interface ListGroup {
3
+ /** Group key — must match what `groupBy` returns */
4
+ id: string;
5
+ /** Header label; defaults to `id` */
6
+ title?: string;
7
+ /** Override the row count shown on the right */
8
+ count?: number;
9
+ /** Start collapsed (only with `collapsible`) */
10
+ defaultCollapsed?: boolean;
11
+ }
2
12
  export interface ListProps<T> {
3
13
  /** Rows to render */
4
14
  items: T[];
@@ -20,6 +30,21 @@ export interface ListProps<T> {
20
30
  unread?: (item: T, index: number) => boolean;
21
31
  /** Deprioritised noise (opacity) */
22
32
  dimmed?: (item: T, index: number) => boolean;
33
+ /** Group rows under headers. Return the group id for each row. */
34
+ groupBy?: (item: T, index: number) => string;
35
+ /**
36
+ * Group order and labels. Groups missing here are appended in order of first
37
+ * appearance; groups listed here but empty are skipped.
38
+ */
39
+ groups?: ListGroup[];
40
+ /** Header renderer; defaults to label + count */
41
+ renderGroupHeader?: (group: ListGroup, items: T[]) => React.ReactNode;
42
+ /** Headers stick to the top of the scroll container */
43
+ stickyGroupHeaders?: boolean;
44
+ /** Headers become a toggle that folds the group */
45
+ collapsibleGroups?: boolean;
46
+ /** Hide the count on the right of the header */
47
+ hideGroupCount?: boolean;
23
48
  /** Checkbox column + bulk bar */
24
49
  selectable?: boolean;
25
50
  /** Selected rows (controlled) */
@@ -28,6 +53,13 @@ export interface ListProps<T> {
28
53
  onSelectionChange?: (selected: T[]) => void;
29
54
  /** Actions shown in the bulk bar when a selection exists */
30
55
  bulkActions?: React.ReactNode;
56
+ /**
57
+ * Column-label strip above the rows ("Van · Gesprek · tijd"), like the inbox.
58
+ * Align it with the row by reusing the same widths as `renderItem`.
59
+ */
60
+ header?: React.ReactNode;
61
+ /** Keep the column-label strip visible while scrolling */
62
+ stickyHeader?: boolean;
31
63
  /** Wrap the list in a bordered container */
32
64
  bordered?: boolean;
33
65
  /** Empty state content */
@@ -47,30 +79,27 @@ export interface ListProps<T> {
47
79
  * Use `Table` instead when you compare values between rows (sortable columns,
48
80
  * aligned amounts, select-all in a header).
49
81
  *
82
+ * Grouped, like the inbox and task views:
83
+ *
50
84
  * @example
51
85
  * ```tsx
52
86
  * <List
53
- * items={threads}
87
+ * items={tasks}
54
88
  * getRowKey={(t) => t.id}
55
- * variant="divided"
56
89
  * bordered
90
+ * groupBy={(t) => t.bucket} // "today" | "tomorrow" | "later"
91
+ * groups={[
92
+ * { id: "today", title: "Vandaag" },
93
+ * { id: "tomorrow", title: "Morgen" },
94
+ * { id: "later", title: "Later" },
95
+ * ]}
96
+ * stickyGroupHeaders
97
+ * collapsibleGroups
57
98
  * leading={(t) => <ChannelBadge channel={t.channel} size="sm" />}
58
- * renderItem={(t) => (
59
- * <>
60
- * <span className="w-30 shrink-0 truncate">{t.sender}</span>
61
- * <span className="min-w-0 flex-1 truncate">
62
- * <strong>{t.subject}</strong>
63
- * <span className="text-text-muted"> — {t.preview}</span>
64
- * </span>
65
- * </>
66
- * )}
67
- * trailing={(t) => <span className="text-xs text-text-subtle">{t.time}</span>}
99
+ * renderItem={(t) => <span className="truncate">{t.title}</span>}
100
+ * trailing={(t) => t.due}
68
101
  * unread={(t) => !t.read}
69
- * selectable
70
- * selectedItems={selection}
71
- * onSelectionChange={setSelection}
72
- * bulkActions={<Button size="sm" variant="secondary">Archiveren</Button>}
73
102
  * />
74
103
  * ```
75
104
  */
76
- export declare function List<T>({ items, getRowKey, variant, leading, renderItem, trailing, onSelect, isActive, unread, dimmed, selectable, selectedItems, onSelectionChange, bulkActions, bordered, emptyContent, loading, loadingRows, className, "aria-label": ariaLabel, }: ListProps<T>): React.JSX.Element;
105
+ export declare function List<T>({ items, getRowKey, variant, leading, renderItem, trailing, onSelect, isActive, unread, dimmed, groupBy, groups, renderGroupHeader, stickyGroupHeaders, collapsibleGroups, hideGroupCount, selectable, selectedItems, onSelectionChange, bulkActions, header, stickyHeader, bordered, emptyContent, loading, loadingRows, className, "aria-label": ariaLabel, }: ListProps<T>): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/ui-kit",
3
- "version": "3.105.0",
3
+ "version": "3.106.0",
4
4
  "description": "Theme-aware UI component library for OpenCXH platform",
5
5
  "type": "module",
6
6
  "exports": {