hs-uix 1.6.5 → 1.7.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.
@@ -0,0 +1,261 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ export type FeedPlacement = "title" | "subtitle" | "meta" | "body" | "footer";
4
+ export type FeedFieldType = "text" | "tag" | "status";
5
+ export type FeedContainer = "none" | "tile" | "card";
6
+ export type FeedFilterType = "select" | "multiselect" | "dateRange";
7
+ export type FeedSortDirection = "asc" | "desc" | "ascending" | "descending";
8
+ export type FeedStatusVariant = "default" | "info" | "success" | "warning" | "danger";
9
+ export type FeedTagVariant = "default" | "info" | "success" | "warning" | "error";
10
+
11
+ export interface FeedOption<T = string | number | boolean> {
12
+ label: string;
13
+ value: T;
14
+ }
15
+
16
+ export interface FeedDateValue {
17
+ year: number;
18
+ month: number;
19
+ date: number;
20
+ formattedDate?: string;
21
+ }
22
+
23
+ export interface FeedDateRangeValue {
24
+ from?: FeedDateValue | Date | string | null;
25
+ to?: FeedDateValue | Date | string | null;
26
+ }
27
+
28
+ export interface FeedAction {
29
+ key?: string;
30
+ label: string;
31
+ icon?: string;
32
+ size?: "sm" | "small" | "md" | "medium";
33
+ variant?: "primary" | "secondary" | "destructive" | "transparent";
34
+ disabled?: boolean;
35
+ href?: string | { url: string; external?: boolean };
36
+ onClick?: (...args: unknown[]) => void;
37
+ }
38
+
39
+ export interface FeedActor {
40
+ name?: ReactNode;
41
+ label?: ReactNode;
42
+ email?: ReactNode;
43
+ avatar?: string;
44
+ avatarUrl?: string;
45
+ src?: string;
46
+ initials?: string;
47
+ href?: string | { url: string; external?: boolean };
48
+ }
49
+
50
+ export interface FeedItem {
51
+ id?: string | number;
52
+ key?: string | number;
53
+ type?: string;
54
+ typeLabel?: ReactNode;
55
+ typeVariant?: FeedStatusVariant;
56
+ title?: ReactNode;
57
+ subject?: ReactNode;
58
+ subtitle?: ReactNode;
59
+ body?: ReactNode;
60
+ description?: ReactNode;
61
+ content?: ReactNode;
62
+ preview?: ReactNode;
63
+ notePreview?: ReactNode;
64
+ timestamp?: ReactNode;
65
+ time?: ReactNode;
66
+ date?: ReactNode;
67
+ dateLabel?: ReactNode;
68
+ createdAt?: ReactNode;
69
+ actor?: ReactNode | FeedActor;
70
+ actorName?: ReactNode;
71
+ author?: ReactNode | FeedActor;
72
+ avatar?: string;
73
+ avatarAlt?: string;
74
+ avatarSize?: string | number;
75
+ icon?: ReactNode | string;
76
+ iconName?: string;
77
+ href?: string | { url: string; external?: boolean };
78
+ meta?: ReactNode | ReactNode[];
79
+ metadata?: ReactNode | ReactNode[];
80
+ actions?: ReactNode | FeedAction[];
81
+ footer?: ReactNode;
82
+ [key: string]: unknown;
83
+ }
84
+
85
+ export interface FeedField<Row = FeedItem> {
86
+ key?: string;
87
+ field?: string | ((item: Row) => unknown);
88
+ label?: string;
89
+ placement?: FeedPlacement;
90
+ type?: FeedFieldType;
91
+ variant?: FeedTagVariant | FeedStatusVariant | ((value: unknown, item: Row) => string);
92
+ href?: string | { url: string; external?: boolean } | ((item: Row) => string | { url: string; external?: boolean });
93
+ visible?: (item: Row) => boolean;
94
+ render?: (value: unknown, item: Row, index: number) => ReactNode;
95
+ }
96
+
97
+ export interface FeedFilterConfig<Row = FeedItem> {
98
+ name: string;
99
+ field?: string | ((item: Row) => unknown);
100
+ type?: FeedFilterType;
101
+ label?: string;
102
+ placeholder?: string;
103
+ variant?: "transparent" | "input";
104
+ options?: FeedOption[];
105
+ defaultValue?: unknown;
106
+ includeAll?: boolean;
107
+ allLabel?: string;
108
+ fromLabel?: string;
109
+ toLabel?: string;
110
+ filterFn?: (item: Row, value: unknown) => boolean;
111
+ }
112
+
113
+ export interface FeedSortOption<Row = FeedItem> {
114
+ value: string;
115
+ label: string;
116
+ field?: string | ((item: Row) => unknown);
117
+ direction?: FeedSortDirection;
118
+ comparator?: (a: Row, b: Row) => number;
119
+ }
120
+
121
+ export interface FeedLabels {
122
+ search?: string;
123
+ sort?: string;
124
+ all?: string;
125
+ clearAll?: string;
126
+ dateFrom?: string;
127
+ dateTo?: string;
128
+ loading?: string;
129
+ loadingMessage?: string;
130
+ loadingMore?: string;
131
+ loadMore?: string;
132
+ emptyTitle?: string;
133
+ emptyMessage?: string;
134
+ collapseAll?: string;
135
+ expandAll?: string;
136
+ errorTitle?: string;
137
+ errorMessage?: string;
138
+ itemCount?: (shown: number, total: number, label: string) => string;
139
+ }
140
+
141
+ export interface FeedTabOption<T = string | number | boolean> {
142
+ label: string;
143
+ value: T;
144
+ disabled?: boolean;
145
+ tooltip?: string;
146
+ }
147
+
148
+ export interface FeedParams {
149
+ tab?: string | number | boolean | null;
150
+ search: string;
151
+ filters: Record<string, unknown>;
152
+ sort: string | null;
153
+ }
154
+
155
+ export interface FeedToolbarRenderContext {
156
+ tab?: string | number | boolean | null;
157
+ tabs?: FeedTabOption[];
158
+ search: string;
159
+ filters: Record<string, unknown>;
160
+ sort: string | null;
161
+ totalCount: number;
162
+ visibleCount: number;
163
+ onTabChange: (value: string | number | boolean | null) => void;
164
+ onSearchChange: (value: string) => void;
165
+ onFilterChange: (name: string, value: unknown) => void;
166
+ onSortChange: (value: string | null) => void;
167
+ }
168
+
169
+ export interface FeedEmptyStateRenderContext {
170
+ title: string;
171
+ message: string;
172
+ }
173
+
174
+ export interface FeedLoadingStateRenderContext {
175
+ label: string;
176
+ }
177
+
178
+ export interface FeedErrorStateRenderContext {
179
+ error: string | boolean;
180
+ title: string;
181
+ message: string;
182
+ }
183
+
184
+ export interface FeedRecordLabel {
185
+ singular?: string;
186
+ plural?: string;
187
+ }
188
+
189
+ export interface FeedProps<Row = FeedItem> {
190
+ items?: Row[];
191
+ fields?: FeedField<Row>[];
192
+ title?: ReactNode;
193
+ description?: ReactNode;
194
+ actions?: ReactNode;
195
+ children?: ReactNode;
196
+ loading?: boolean;
197
+ error?: string | boolean | null;
198
+ labels?: FeedLabels;
199
+ renderItem?: (item: Row, index: number) => ReactNode;
200
+ renderActor?: (item: Row, index: number) => ReactNode;
201
+ renderTimestamp?: (item: Row, index: number) => ReactNode;
202
+ renderMeta?: (item: Row, index: number) => ReactNode;
203
+ renderActions?: (item: Row, index: number) => ReactNode;
204
+ renderFooter?: (item: Row, index: number) => ReactNode;
205
+ renderToolbar?: (ctx: FeedToolbarRenderContext) => ReactNode;
206
+ renderEmptyState?: (ctx: FeedEmptyStateRenderContext) => ReactNode;
207
+ renderLoadingState?: (ctx: FeedLoadingStateRenderContext) => ReactNode;
208
+ renderErrorState?: (ctx: FeedErrorStateRenderContext) => ReactNode;
209
+ getKey?: (item: Row, index: number) => string | number;
210
+ groupBy?: string | ((item: Row) => unknown);
211
+ groupByDate?: boolean;
212
+ getGroupLabel?: (groupValue: unknown, firstItem: Row) => ReactNode;
213
+ bordered?: boolean;
214
+ container?: FeedContainer;
215
+ showDividers?: boolean;
216
+ itemContainer?: FeedContainer;
217
+ compact?: boolean;
218
+ gap?: string;
219
+ avatarSize?: string | number;
220
+ iconSize?: "sm" | "small" | "md" | "medium" | "lg" | "large";
221
+ tabs?: FeedTabOption[];
222
+ showTabs?: boolean;
223
+ tabField?: string | ((item: Row) => unknown);
224
+ tabVariant?: "default" | "enclosed";
225
+ tabValue?: string | number | boolean | null;
226
+ defaultTab?: string | number | boolean | null;
227
+ onTabChange?: (value: string | number | boolean | null) => void;
228
+ searchFields?: Array<string | ((item: Row) => unknown)>;
229
+ showSearch?: boolean;
230
+ searchPlaceholder?: string;
231
+ searchValue?: string;
232
+ onSearchChange?: (value: string) => void;
233
+ filters?: FeedFilterConfig<Row>[];
234
+ filterValues?: Record<string, unknown>;
235
+ defaultFilterValues?: Record<string, unknown>;
236
+ onFilterChange?: (values: Record<string, unknown>) => void;
237
+ sortOptions?: FeedSortOption<Row>[];
238
+ sort?: string | null;
239
+ defaultSort?: string | null;
240
+ onSortChange?: (value: string | null) => void;
241
+ onParamsChange?: (params: FeedParams) => void;
242
+ serverSide?: boolean;
243
+ showToolbar?: boolean;
244
+ filterInlineLimit?: number;
245
+ showItemCount?: boolean;
246
+ itemCountText?: (shown: number, total: number) => string;
247
+ recordLabel?: FeedRecordLabel;
248
+ pageSize?: number;
249
+ initialItemCount?: number;
250
+ maxItems?: number;
251
+ hasMore?: boolean;
252
+ loadingMore?: boolean;
253
+ onLoadMore?: (...args: unknown[]) => void;
254
+ collapsible?: boolean | "auto";
255
+ defaultCollapsed?: "all" | "none" | (string | number)[];
256
+ collapsedIds?: (string | number)[];
257
+ onCollapsedIdsChange?: (next: (string | number)[]) => void;
258
+ showCollapseToggle?: boolean;
259
+ }
260
+
261
+ export declare function Feed<Row = FeedItem>(props: FeedProps<Row>): ReactNode;