analytica-frontend-lib 1.1.35 → 1.1.36

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,402 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * Types for notification system
6
+ */
7
+ /**
8
+ * Notification type enum
9
+ */
10
+ type NotificationType = 'ACTIVITY' | 'TRAIL' | 'GOAL' | 'ANNOUNCEMENT' | 'GENERAL';
11
+ /**
12
+ * Entity type for navigation
13
+ */
14
+ declare enum NotificationEntityType {
15
+ ACTIVITY = "ACTIVITY",
16
+ TRAIL = "TRAIL",
17
+ GOAL = "GOAL"
18
+ }
19
+ /**
20
+ * Notification interface
21
+ */
22
+ interface Notification {
23
+ /**
24
+ * Unique identifier for the notification
25
+ */
26
+ id: string;
27
+ /**
28
+ * Notification title
29
+ */
30
+ title: string;
31
+ /**
32
+ * Notification message content
33
+ */
34
+ message: string;
35
+ /**
36
+ * Type of notification
37
+ */
38
+ type: NotificationType;
39
+ /**
40
+ * Whether the notification has been read
41
+ */
42
+ isRead: boolean;
43
+ /**
44
+ * When the notification was created
45
+ */
46
+ createdAt: Date;
47
+ /**
48
+ * Type of entity this notification refers to (optional)
49
+ */
50
+ entityType?: NotificationEntityType | null;
51
+ /**
52
+ * ID of the entity this notification refers to (optional)
53
+ */
54
+ entityId?: string | null;
55
+ /**
56
+ * Sender information (optional)
57
+ */
58
+ sender?: {
59
+ id: string;
60
+ user: {
61
+ id: string;
62
+ name: string;
63
+ email: string;
64
+ };
65
+ } | null;
66
+ /**
67
+ * Activity information (optional)
68
+ */
69
+ activity?: {
70
+ id: string;
71
+ title: string;
72
+ type: string;
73
+ } | null;
74
+ /**
75
+ * Goal information (optional)
76
+ */
77
+ goal?: {
78
+ id: string;
79
+ title: string;
80
+ } | null;
81
+ }
82
+ /**
83
+ * Backend notification response from API
84
+ */
85
+ interface BackendNotification {
86
+ id: string;
87
+ senderUserInstitutionId: string | null;
88
+ receiverUserInstitutionId: string;
89
+ title: string;
90
+ description: string;
91
+ entityType: string | null;
92
+ entityId: string | null;
93
+ read: boolean;
94
+ createdAt: string;
95
+ updatedAt: string;
96
+ sender?: {
97
+ id: string;
98
+ user: {
99
+ id: string;
100
+ name: string;
101
+ email: string;
102
+ };
103
+ } | null;
104
+ activity?: {
105
+ id: string;
106
+ title: string;
107
+ type: string;
108
+ } | null;
109
+ goal?: {
110
+ id: string;
111
+ title: string;
112
+ } | null;
113
+ }
114
+ /**
115
+ * API response for fetching notifications from backend
116
+ */
117
+ interface BackendNotificationsResponse {
118
+ notifications: BackendNotification[];
119
+ pagination: {
120
+ page: number;
121
+ limit: number;
122
+ total: number;
123
+ totalPages: number;
124
+ };
125
+ }
126
+ /**
127
+ * API response for fetching notifications (frontend format)
128
+ */
129
+ interface NotificationsResponse {
130
+ /**
131
+ * List of notifications
132
+ */
133
+ notifications: Notification[];
134
+ /**
135
+ * Total count of notifications
136
+ */
137
+ totalCount: number;
138
+ /**
139
+ * Count of unread notifications
140
+ */
141
+ unreadCount: number;
142
+ /**
143
+ * Whether there are more notifications to load
144
+ */
145
+ hasMore: boolean;
146
+ }
147
+ /**
148
+ * Parameters for fetching notifications
149
+ */
150
+ interface FetchNotificationsParams {
151
+ /**
152
+ * Page number for pagination
153
+ */
154
+ page?: number;
155
+ /**
156
+ * Number of items per page
157
+ */
158
+ limit?: number;
159
+ /**
160
+ * Filter by read status
161
+ */
162
+ read?: boolean;
163
+ /**
164
+ * Filter by entity type
165
+ */
166
+ entityType?: string;
167
+ }
168
+ /**
169
+ * Notification grouped by time period
170
+ */
171
+ interface NotificationGroup {
172
+ /**
173
+ * Group label (e.g., "Hoje", "Última semana")
174
+ */
175
+ label: string;
176
+ /**
177
+ * Notifications in this group
178
+ */
179
+ notifications: Notification[];
180
+ }
181
+ /**
182
+ * API client interface for dependency injection
183
+ */
184
+ interface NotificationApiClient {
185
+ get: <T>(url: string, config?: {
186
+ params?: Record<string, unknown>;
187
+ }) => Promise<{
188
+ data: T;
189
+ }>;
190
+ patch: <T>(url: string, data?: Record<string, unknown>) => Promise<{
191
+ data: T;
192
+ }>;
193
+ delete: <T>(url: string) => Promise<{
194
+ data: T;
195
+ }>;
196
+ }
197
+
198
+ interface NotificationItem extends Omit<Notification, 'createdAt'> {
199
+ time: string;
200
+ createdAt: string | Date;
201
+ }
202
+ interface BaseNotificationProps {
203
+ /**
204
+ * Additional CSS classes
205
+ */
206
+ className?: string;
207
+ /**
208
+ * Empty state image path
209
+ */
210
+ emptyStateImage?: string;
211
+ /**
212
+ * Empty state title
213
+ */
214
+ emptyStateTitle?: string;
215
+ /**
216
+ * Empty state description
217
+ */
218
+ emptyStateDescription?: string;
219
+ }
220
+ interface SingleNotificationCardMode extends BaseNotificationProps {
221
+ /**
222
+ * Component mode - single card
223
+ */
224
+ mode: 'single';
225
+ /**
226
+ * The notification title
227
+ */
228
+ title: string;
229
+ /**
230
+ * The notification message content
231
+ */
232
+ message: string;
233
+ /**
234
+ * Time displayed (e.g., "Há 3h", "12 Fev")
235
+ */
236
+ time: string;
237
+ /**
238
+ * Whether the notification has been read
239
+ */
240
+ isRead: boolean;
241
+ /**
242
+ * Callback when user marks notification as read
243
+ */
244
+ onMarkAsRead: () => void;
245
+ /**
246
+ * Callback when user deletes notification
247
+ */
248
+ onDelete: () => void;
249
+ /**
250
+ * Optional callback for navigation action
251
+ */
252
+ onNavigate?: () => void;
253
+ /**
254
+ * Label for the action button (only shown if onNavigate is provided)
255
+ */
256
+ actionLabel?: string;
257
+ }
258
+ interface NotificationListMode extends BaseNotificationProps {
259
+ /**
260
+ * Component mode - list
261
+ */
262
+ mode: 'list';
263
+ /**
264
+ * Array of notifications for list mode
265
+ */
266
+ notifications?: NotificationItem[];
267
+ /**
268
+ * Array of grouped notifications
269
+ */
270
+ groupedNotifications?: NotificationGroup[];
271
+ /**
272
+ * Loading state for list mode
273
+ */
274
+ loading?: boolean;
275
+ /**
276
+ * Error state for list mode
277
+ */
278
+ error?: string | null;
279
+ /**
280
+ * Callback for retry when error occurs
281
+ */
282
+ onRetry?: () => void;
283
+ /**
284
+ * Callback when user marks a notification as read in list mode
285
+ */
286
+ onMarkAsReadById?: (id: string) => void;
287
+ /**
288
+ * Callback when user deletes a notification in list mode
289
+ */
290
+ onDeleteById?: (id: string) => void;
291
+ /**
292
+ * Callback when user navigates from a notification in list mode
293
+ */
294
+ onNavigateById?: (entityType?: NotificationEntityType, entityId?: string) => void;
295
+ /**
296
+ * Function to get action label for a notification
297
+ */
298
+ getActionLabel?: (entityType?: NotificationEntityType) => string | undefined;
299
+ /**
300
+ * Custom empty state component
301
+ */
302
+ renderEmpty?: () => ReactNode;
303
+ }
304
+ interface NotificationCenterMode extends BaseNotificationProps {
305
+ /**
306
+ * Component mode - center
307
+ */
308
+ mode: 'center';
309
+ /**
310
+ * Array of grouped notifications
311
+ */
312
+ groupedNotifications?: NotificationGroup[];
313
+ /**
314
+ * Loading state for center mode
315
+ */
316
+ loading?: boolean;
317
+ /**
318
+ * Error state for center mode
319
+ */
320
+ error?: string | null;
321
+ /**
322
+ * Callback for retry when error occurs
323
+ */
324
+ onRetry?: () => void;
325
+ /**
326
+ * Whether center mode is currently active (controls dropdown/modal visibility)
327
+ */
328
+ isActive?: boolean;
329
+ /**
330
+ * Callback when center mode is toggled
331
+ */
332
+ onToggleActive?: () => void;
333
+ /**
334
+ * Number of unread notifications for badge display
335
+ */
336
+ unreadCount?: number;
337
+ /**
338
+ * Callback when all notifications should be marked as read
339
+ */
340
+ onMarkAllAsRead?: () => void;
341
+ /**
342
+ * Callback to fetch notifications (called when center opens)
343
+ */
344
+ onFetchNotifications?: () => void;
345
+ /**
346
+ * Callback when user marks a notification as read in center mode
347
+ */
348
+ onMarkAsReadById?: (id: string) => void;
349
+ /**
350
+ * Callback when user deletes a notification in center mode
351
+ */
352
+ onDeleteById?: (id: string) => void;
353
+ /**
354
+ * Callback when user navigates from a notification in center mode
355
+ */
356
+ onNavigateById?: (entityType?: NotificationEntityType, entityId?: string) => void;
357
+ /**
358
+ * Function to get action label for a notification
359
+ */
360
+ getActionLabel?: (entityType?: NotificationEntityType) => string | undefined;
361
+ }
362
+ type NotificationCardProps = SingleNotificationCardMode | NotificationListMode | NotificationCenterMode;
363
+ interface LegacyNotificationCardProps extends BaseNotificationProps {
364
+ title?: string;
365
+ message?: string;
366
+ time?: string;
367
+ isRead?: boolean;
368
+ onMarkAsRead?: () => void;
369
+ onDelete?: () => void;
370
+ onNavigate?: () => void;
371
+ actionLabel?: string;
372
+ notifications?: NotificationItem[];
373
+ groupedNotifications?: NotificationGroup[];
374
+ loading?: boolean;
375
+ error?: string | null;
376
+ onRetry?: () => void;
377
+ onMarkAsReadById?: (id: string) => void;
378
+ onDeleteById?: (id: string) => void;
379
+ onNavigateById?: (entityType?: NotificationEntityType, entityId?: string) => void;
380
+ getActionLabel?: (entityType?: NotificationEntityType) => string | undefined;
381
+ renderEmpty?: () => ReactNode;
382
+ variant?: 'card' | 'center';
383
+ isActive?: boolean;
384
+ onToggleActive?: () => void;
385
+ unreadCount?: number;
386
+ onMarkAllAsRead?: () => void;
387
+ onFetchNotifications?: () => void;
388
+ }
389
+ /**
390
+ * NotificationCard component - can display single notification, list of notifications, or center mode
391
+ *
392
+ * @param props - The notification card properties
393
+ * @returns JSX element representing the notification card, list, or center
394
+ */
395
+ declare const NotificationCard: (props: NotificationCardProps) => react_jsx_runtime.JSX.Element;
396
+ /**
397
+ * Legacy NotificationCard component for backward compatibility
398
+ * Automatically detects mode based on provided props
399
+ */
400
+ declare const LegacyNotificationCard: (props: LegacyNotificationCardProps) => react_jsx_runtime.JSX.Element;
401
+
402
+ export { type BackendNotification as B, type FetchNotificationsParams as F, type LegacyNotificationCardProps as L, type NotificationApiClient as N, type Notification as a, type NotificationGroup as b, NotificationCard as c, type NotificationItem as d, NotificationEntityType as e, type NotificationType as f, type BackendNotificationsResponse as g, type NotificationsResponse as h, type NotificationCardProps as i, LegacyNotificationCard as j };
@@ -81,7 +81,7 @@ declare const Radio: react.ForwardRefExoticComponent<{
81
81
  value?: string;
82
82
  /** Default checked state for uncontrolled radios */
83
83
  defaultChecked?: boolean;
84
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "defaultChecked" | "type"> & react.RefAttributes<HTMLInputElement>>;
84
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "type" | "size"> & react.RefAttributes<HTMLInputElement>>;
85
85
  /**
86
86
  * RadioGroup store interface
87
87
  */
@@ -198,6 +198,6 @@ declare const RadioGroupItem: react.ForwardRefExoticComponent<{
198
198
  state?: RadioState;
199
199
  /** Additional CSS classes */
200
200
  className?: string;
201
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "checked" | "type" | "name" | "onChange"> & react.RefAttributes<HTMLInputElement>>;
201
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "name" | "type" | "size" | "value" | "checked"> & react.RefAttributes<HTMLInputElement>>;
202
202
 
203
203
  export { RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, type RadioProps, Radio as default, useRadioGroupStore };
@@ -81,7 +81,7 @@ declare const Radio: react.ForwardRefExoticComponent<{
81
81
  value?: string;
82
82
  /** Default checked state for uncontrolled radios */
83
83
  defaultChecked?: boolean;
84
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "defaultChecked" | "type"> & react.RefAttributes<HTMLInputElement>>;
84
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "type" | "size"> & react.RefAttributes<HTMLInputElement>>;
85
85
  /**
86
86
  * RadioGroup store interface
87
87
  */
@@ -198,6 +198,6 @@ declare const RadioGroupItem: react.ForwardRefExoticComponent<{
198
198
  state?: RadioState;
199
199
  /** Additional CSS classes */
200
200
  className?: string;
201
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "checked" | "type" | "name" | "onChange"> & react.RefAttributes<HTMLInputElement>>;
201
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "name" | "type" | "size" | "value" | "checked"> & react.RefAttributes<HTMLInputElement>>;
202
202
 
203
203
  export { RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, type RadioProps, Radio as default, useRadioGroupStore };
@@ -22,6 +22,6 @@ declare const Search: react.ForwardRefExoticComponent<{
22
22
  containerClassName?: string;
23
23
  /** Callback when clear button is clicked */
24
24
  onClear?: () => void;
25
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onSelect"> & react.RefAttributes<HTMLInputElement>>;
25
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "onSelect" | "size"> & react.RefAttributes<HTMLInputElement>>;
26
26
 
27
27
  export { Search as default };
@@ -22,6 +22,6 @@ declare const Search: react.ForwardRefExoticComponent<{
22
22
  containerClassName?: string;
23
23
  /** Callback when clear button is clicked */
24
24
  onClear?: () => void;
25
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onSelect"> & react.RefAttributes<HTMLInputElement>>;
25
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "onSelect" | "size"> & react.RefAttributes<HTMLInputElement>>;
26
26
 
27
27
  export { Search as default };
package/dist/index.css CHANGED
@@ -820,6 +820,9 @@
820
820
  .h-14 {
821
821
  height: calc(var(--spacing) * 14);
822
822
  }
823
+ .h-16 {
824
+ height: calc(var(--spacing) * 16);
825
+ }
823
826
  .h-20 {
824
827
  height: calc(var(--spacing) * 20);
825
828
  }
@@ -895,12 +898,21 @@
895
898
  .max-h-32 {
896
899
  max-height: calc(var(--spacing) * 32);
897
900
  }
901
+ .max-h-\[80vh\] {
902
+ max-height: 80vh;
903
+ }
898
904
  .max-h-\[300px\] {
899
905
  max-height: 300px;
900
906
  }
907
+ .max-h-\[350px\] {
908
+ max-height: 350px;
909
+ }
901
910
  .max-h-\[400px\] {
902
911
  max-height: 400px;
903
912
  }
913
+ .max-h-\[500px\] {
914
+ max-height: 500px;
915
+ }
904
916
  .max-h-\[600px\] {
905
917
  max-height: 600px;
906
918
  }
@@ -994,6 +1006,9 @@
994
1006
  .w-11 {
995
1007
  width: calc(var(--spacing) * 11);
996
1008
  }
1009
+ .w-16 {
1010
+ width: calc(var(--spacing) * 16);
1011
+ }
997
1012
  .w-20 {
998
1013
  width: calc(var(--spacing) * 20);
999
1014
  }
@@ -1088,6 +1103,9 @@
1088
1103
  .max-w-\[266px\] {
1089
1104
  max-width: 266px;
1090
1105
  }
1106
+ .max-w-\[316px\] {
1107
+ max-width: 316px;
1108
+ }
1091
1109
  .max-w-\[324px\] {
1092
1110
  max-width: 324px;
1093
1111
  }
@@ -1103,6 +1121,9 @@
1103
1121
  .max-w-\[390px\] {
1104
1122
  max-width: 390px;
1105
1123
  }
1124
+ .max-w-\[400px\] {
1125
+ max-width: 400px;
1126
+ }
1106
1127
  .max-w-\[420px\] {
1107
1128
  max-width: 420px;
1108
1129
  }
@@ -2914,6 +2935,10 @@
2914
2935
  --tw-leading: 21px;
2915
2936
  line-height: 21px;
2916
2937
  }
2938
+ .leading-\[23px\] {
2939
+ --tw-leading: 23px;
2940
+ line-height: 23px;
2941
+ }
2917
2942
  .leading-\[150\%\] {
2918
2943
  --tw-leading: 150%;
2919
2944
  line-height: 150%;
@@ -3484,6 +3509,9 @@
3484
3509
  .capitalize {
3485
3510
  text-transform: capitalize;
3486
3511
  }
3512
+ .lowercase {
3513
+ text-transform: lowercase;
3514
+ }
3487
3515
  .uppercase {
3488
3516
  text-transform: uppercase;
3489
3517
  }