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.
- package/dist/CheckBox/index.d.mts +1 -1
- package/dist/CheckBox/index.d.ts +1 -1
- package/dist/NotificationCard/index.d.mts +3 -104
- package/dist/NotificationCard/index.d.ts +3 -104
- package/dist/NotificationCard/index.js +611 -43
- package/dist/NotificationCard/index.js.map +1 -1
- package/dist/NotificationCard/index.mjs +607 -43
- package/dist/NotificationCard/index.mjs.map +1 -1
- package/dist/NotificationCard-IYDURfYp.d.mts +402 -0
- package/dist/NotificationCard-IYDURfYp.d.ts +402 -0
- package/dist/Radio/index.d.mts +2 -2
- package/dist/Radio/index.d.ts +2 -2
- package/dist/Search/index.d.mts +1 -1
- package/dist/Search/index.d.ts +1 -1
- package/dist/index.css +28 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +126 -3
- package/dist/index.d.ts +126 -3
- package/dist/index.js +495 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +493 -29
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +28 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as Table } from './Table/index.mjs';
|
|
|
10
10
|
export { default as CheckBox } from './CheckBox/index.mjs';
|
|
11
11
|
import * as react from 'react';
|
|
12
12
|
import { ReactNode, HTMLAttributes, InputHTMLAttributes } from 'react';
|
|
13
|
+
import * as zustand from 'zustand';
|
|
13
14
|
import { StoreApi } from 'zustand';
|
|
14
15
|
export { default as Radio, RadioGroup, RadioGroupItem } from './Radio/index.mjs';
|
|
15
16
|
export { default as TextArea } from './TextArea/index.mjs';
|
|
@@ -46,7 +47,8 @@ export { useApiConfig } from './Auth/useApiConfig/index.mjs';
|
|
|
46
47
|
export { Quiz, QuizAlternative, QuizConnectDots, QuizContent, QuizDissertative, QuizFooter, QuizHeader, QuizHeaderResult, QuizImageQuestion, QuizListResult, QuizListResultByMateria, QuizMultipleChoice, QuizQuestionList, QuizResultHeaderTitle, QuizResultPerformance, QuizResultTitle, QuizTitle, QuizTrueOrFalse, getStatusBadge } from './Quiz/index.mjs';
|
|
47
48
|
export { ANSWER_STATUS, Activity, Lesson, QUESTION_DIFFICULTY, QUESTION_STATUS, QUESTION_TYPE, Question, QuestionResult, QuizState, SUBTYPE_ENUM, Simulated, UserAnswerItem, useQuizStore } from './Quiz/useQuizStore/index.mjs';
|
|
48
49
|
export { default as LoadingModal } from './LoadingModal/index.mjs';
|
|
49
|
-
|
|
50
|
+
import { N as NotificationApiClient, a as Notification, F as FetchNotificationsParams, b as NotificationGroup } from './NotificationCard-IYDURfYp.mjs';
|
|
51
|
+
export { B as BackendNotification, g as BackendNotificationsResponse, c as NotificationCard, e as NotificationEntityType, d as NotificationItem, f as NotificationType, h as NotificationsResponse } from './NotificationCard-IYDURfYp.mjs';
|
|
50
52
|
import 'react/jsx-runtime';
|
|
51
53
|
|
|
52
54
|
/**
|
|
@@ -134,6 +136,127 @@ declare const CheckboxListItem: react.ForwardRefExoticComponent<{
|
|
|
134
136
|
state?: CheckboxListState;
|
|
135
137
|
/** Additional CSS classes */
|
|
136
138
|
className?: string;
|
|
137
|
-
} & Omit<InputHTMLAttributes<HTMLInputElement>, "
|
|
139
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "name" | "type" | "size" | "value" | "checked"> & react.RefAttributes<HTMLInputElement>>;
|
|
138
140
|
|
|
139
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Notification store state interface
|
|
143
|
+
*/
|
|
144
|
+
interface NotificationState {
|
|
145
|
+
/**
|
|
146
|
+
* List of all notifications
|
|
147
|
+
*/
|
|
148
|
+
notifications: Notification[];
|
|
149
|
+
/**
|
|
150
|
+
* Number of unread notifications
|
|
151
|
+
*/
|
|
152
|
+
unreadCount: number;
|
|
153
|
+
/**
|
|
154
|
+
* Loading state
|
|
155
|
+
*/
|
|
156
|
+
loading: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Error state
|
|
159
|
+
*/
|
|
160
|
+
error: string | null;
|
|
161
|
+
/**
|
|
162
|
+
* Whether there are more notifications to load
|
|
163
|
+
*/
|
|
164
|
+
hasMore: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Current page for pagination
|
|
167
|
+
*/
|
|
168
|
+
currentPage: number;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Notification store actions interface
|
|
172
|
+
*/
|
|
173
|
+
interface NotificationActions {
|
|
174
|
+
/**
|
|
175
|
+
* Fetch notifications from API
|
|
176
|
+
*/
|
|
177
|
+
fetchNotifications: (params?: FetchNotificationsParams) => Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Mark a specific notification as read
|
|
180
|
+
*/
|
|
181
|
+
markAsRead: (id: string) => Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Mark all notifications as read
|
|
184
|
+
*/
|
|
185
|
+
markAllAsRead: () => Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Delete a notification
|
|
188
|
+
*/
|
|
189
|
+
deleteNotification: (id: string) => Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Clear all notifications
|
|
192
|
+
*/
|
|
193
|
+
clearNotifications: () => void;
|
|
194
|
+
/**
|
|
195
|
+
* Reset error state
|
|
196
|
+
*/
|
|
197
|
+
resetError: () => void;
|
|
198
|
+
/**
|
|
199
|
+
* Group notifications by time periods
|
|
200
|
+
*/
|
|
201
|
+
getGroupedNotifications: () => NotificationGroup[];
|
|
202
|
+
}
|
|
203
|
+
type NotificationStore = NotificationState & NotificationActions;
|
|
204
|
+
/**
|
|
205
|
+
* Format time relative to now
|
|
206
|
+
*/
|
|
207
|
+
declare const formatTimeAgo: (date: Date) => string;
|
|
208
|
+
/**
|
|
209
|
+
* Create notification store with injected API client
|
|
210
|
+
*/
|
|
211
|
+
declare const createNotificationStore: (apiClient: NotificationApiClient) => zustand.UseBoundStore<Omit<zustand.StoreApi<NotificationStore>, "setState" | "devtools"> & {
|
|
212
|
+
setState(partial: NotificationStore | Partial<NotificationStore> | ((state: NotificationStore) => NotificationStore | Partial<NotificationStore>), replace?: false | undefined, action?: (string | {
|
|
213
|
+
[x: string]: unknown;
|
|
214
|
+
[x: number]: unknown;
|
|
215
|
+
[x: symbol]: unknown;
|
|
216
|
+
type: string;
|
|
217
|
+
}) | undefined): void;
|
|
218
|
+
setState(state: NotificationStore | ((state: NotificationStore) => NotificationStore), replace: true, action?: (string | {
|
|
219
|
+
[x: string]: unknown;
|
|
220
|
+
[x: number]: unknown;
|
|
221
|
+
[x: symbol]: unknown;
|
|
222
|
+
type: string;
|
|
223
|
+
}) | undefined): void;
|
|
224
|
+
devtools: {
|
|
225
|
+
cleanup: () => void;
|
|
226
|
+
};
|
|
227
|
+
}>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Create a notification store hook with injected API client
|
|
231
|
+
* This allows different applications to provide their own API implementation
|
|
232
|
+
*
|
|
233
|
+
* @param apiClient - API client instance that implements NotificationApiClient interface
|
|
234
|
+
* @returns Zustand hook for notification store
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* import { createUseNotificationStore } from 'analytica-frontend-lib';
|
|
239
|
+
* import api from './services/apiService';
|
|
240
|
+
*
|
|
241
|
+
* const useNotificationStore = createUseNotificationStore(api);
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
declare const createUseNotificationStore: (apiClient: NotificationApiClient) => zustand.UseBoundStore<Omit<zustand.StoreApi<NotificationStore>, "setState" | "devtools"> & {
|
|
245
|
+
setState(partial: NotificationStore | Partial<NotificationStore> | ((state: NotificationStore) => NotificationStore | Partial<NotificationStore>), replace?: false | undefined, action?: (string | {
|
|
246
|
+
[x: string]: unknown;
|
|
247
|
+
[x: number]: unknown;
|
|
248
|
+
[x: symbol]: unknown;
|
|
249
|
+
type: string;
|
|
250
|
+
}) | undefined): void;
|
|
251
|
+
setState(state: NotificationStore | ((state: NotificationStore) => NotificationStore), replace: true, action?: (string | {
|
|
252
|
+
[x: string]: unknown;
|
|
253
|
+
[x: number]: unknown;
|
|
254
|
+
[x: symbol]: unknown;
|
|
255
|
+
type: string;
|
|
256
|
+
}) | undefined): void;
|
|
257
|
+
devtools: {
|
|
258
|
+
cleanup: () => void;
|
|
259
|
+
};
|
|
260
|
+
}>;
|
|
261
|
+
|
|
262
|
+
export { CheckboxList, CheckboxListItem, FetchNotificationsParams, Notification, type NotificationActions, NotificationApiClient, NotificationGroup, type NotificationState, type NotificationStore, createNotificationStore, createUseNotificationStore, formatTimeAgo };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as Table } from './Table/index.js';
|
|
|
10
10
|
export { default as CheckBox } from './CheckBox/index.js';
|
|
11
11
|
import * as react from 'react';
|
|
12
12
|
import { ReactNode, HTMLAttributes, InputHTMLAttributes } from 'react';
|
|
13
|
+
import * as zustand from 'zustand';
|
|
13
14
|
import { StoreApi } from 'zustand';
|
|
14
15
|
export { default as Radio, RadioGroup, RadioGroupItem } from './Radio/index.js';
|
|
15
16
|
export { default as TextArea } from './TextArea/index.js';
|
|
@@ -46,7 +47,8 @@ export { useApiConfig } from './Auth/useApiConfig/index.js';
|
|
|
46
47
|
export { Quiz, QuizAlternative, QuizConnectDots, QuizContent, QuizDissertative, QuizFooter, QuizHeader, QuizHeaderResult, QuizImageQuestion, QuizListResult, QuizListResultByMateria, QuizMultipleChoice, QuizQuestionList, QuizResultHeaderTitle, QuizResultPerformance, QuizResultTitle, QuizTitle, QuizTrueOrFalse, getStatusBadge } from './Quiz/index.js';
|
|
47
48
|
export { ANSWER_STATUS, Activity, Lesson, QUESTION_DIFFICULTY, QUESTION_STATUS, QUESTION_TYPE, Question, QuestionResult, QuizState, SUBTYPE_ENUM, Simulated, UserAnswerItem, useQuizStore } from './Quiz/useQuizStore/index.js';
|
|
48
49
|
export { default as LoadingModal } from './LoadingModal/index.js';
|
|
49
|
-
|
|
50
|
+
import { N as NotificationApiClient, a as Notification, F as FetchNotificationsParams, b as NotificationGroup } from './NotificationCard-IYDURfYp.js';
|
|
51
|
+
export { B as BackendNotification, g as BackendNotificationsResponse, c as NotificationCard, e as NotificationEntityType, d as NotificationItem, f as NotificationType, h as NotificationsResponse } from './NotificationCard-IYDURfYp.js';
|
|
50
52
|
import 'react/jsx-runtime';
|
|
51
53
|
|
|
52
54
|
/**
|
|
@@ -134,6 +136,127 @@ declare const CheckboxListItem: react.ForwardRefExoticComponent<{
|
|
|
134
136
|
state?: CheckboxListState;
|
|
135
137
|
/** Additional CSS classes */
|
|
136
138
|
className?: string;
|
|
137
|
-
} & Omit<InputHTMLAttributes<HTMLInputElement>, "
|
|
139
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "name" | "type" | "size" | "value" | "checked"> & react.RefAttributes<HTMLInputElement>>;
|
|
138
140
|
|
|
139
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Notification store state interface
|
|
143
|
+
*/
|
|
144
|
+
interface NotificationState {
|
|
145
|
+
/**
|
|
146
|
+
* List of all notifications
|
|
147
|
+
*/
|
|
148
|
+
notifications: Notification[];
|
|
149
|
+
/**
|
|
150
|
+
* Number of unread notifications
|
|
151
|
+
*/
|
|
152
|
+
unreadCount: number;
|
|
153
|
+
/**
|
|
154
|
+
* Loading state
|
|
155
|
+
*/
|
|
156
|
+
loading: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Error state
|
|
159
|
+
*/
|
|
160
|
+
error: string | null;
|
|
161
|
+
/**
|
|
162
|
+
* Whether there are more notifications to load
|
|
163
|
+
*/
|
|
164
|
+
hasMore: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Current page for pagination
|
|
167
|
+
*/
|
|
168
|
+
currentPage: number;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Notification store actions interface
|
|
172
|
+
*/
|
|
173
|
+
interface NotificationActions {
|
|
174
|
+
/**
|
|
175
|
+
* Fetch notifications from API
|
|
176
|
+
*/
|
|
177
|
+
fetchNotifications: (params?: FetchNotificationsParams) => Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Mark a specific notification as read
|
|
180
|
+
*/
|
|
181
|
+
markAsRead: (id: string) => Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Mark all notifications as read
|
|
184
|
+
*/
|
|
185
|
+
markAllAsRead: () => Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Delete a notification
|
|
188
|
+
*/
|
|
189
|
+
deleteNotification: (id: string) => Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Clear all notifications
|
|
192
|
+
*/
|
|
193
|
+
clearNotifications: () => void;
|
|
194
|
+
/**
|
|
195
|
+
* Reset error state
|
|
196
|
+
*/
|
|
197
|
+
resetError: () => void;
|
|
198
|
+
/**
|
|
199
|
+
* Group notifications by time periods
|
|
200
|
+
*/
|
|
201
|
+
getGroupedNotifications: () => NotificationGroup[];
|
|
202
|
+
}
|
|
203
|
+
type NotificationStore = NotificationState & NotificationActions;
|
|
204
|
+
/**
|
|
205
|
+
* Format time relative to now
|
|
206
|
+
*/
|
|
207
|
+
declare const formatTimeAgo: (date: Date) => string;
|
|
208
|
+
/**
|
|
209
|
+
* Create notification store with injected API client
|
|
210
|
+
*/
|
|
211
|
+
declare const createNotificationStore: (apiClient: NotificationApiClient) => zustand.UseBoundStore<Omit<zustand.StoreApi<NotificationStore>, "setState" | "devtools"> & {
|
|
212
|
+
setState(partial: NotificationStore | Partial<NotificationStore> | ((state: NotificationStore) => NotificationStore | Partial<NotificationStore>), replace?: false | undefined, action?: (string | {
|
|
213
|
+
[x: string]: unknown;
|
|
214
|
+
[x: number]: unknown;
|
|
215
|
+
[x: symbol]: unknown;
|
|
216
|
+
type: string;
|
|
217
|
+
}) | undefined): void;
|
|
218
|
+
setState(state: NotificationStore | ((state: NotificationStore) => NotificationStore), replace: true, action?: (string | {
|
|
219
|
+
[x: string]: unknown;
|
|
220
|
+
[x: number]: unknown;
|
|
221
|
+
[x: symbol]: unknown;
|
|
222
|
+
type: string;
|
|
223
|
+
}) | undefined): void;
|
|
224
|
+
devtools: {
|
|
225
|
+
cleanup: () => void;
|
|
226
|
+
};
|
|
227
|
+
}>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Create a notification store hook with injected API client
|
|
231
|
+
* This allows different applications to provide their own API implementation
|
|
232
|
+
*
|
|
233
|
+
* @param apiClient - API client instance that implements NotificationApiClient interface
|
|
234
|
+
* @returns Zustand hook for notification store
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* import { createUseNotificationStore } from 'analytica-frontend-lib';
|
|
239
|
+
* import api from './services/apiService';
|
|
240
|
+
*
|
|
241
|
+
* const useNotificationStore = createUseNotificationStore(api);
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
declare const createUseNotificationStore: (apiClient: NotificationApiClient) => zustand.UseBoundStore<Omit<zustand.StoreApi<NotificationStore>, "setState" | "devtools"> & {
|
|
245
|
+
setState(partial: NotificationStore | Partial<NotificationStore> | ((state: NotificationStore) => NotificationStore | Partial<NotificationStore>), replace?: false | undefined, action?: (string | {
|
|
246
|
+
[x: string]: unknown;
|
|
247
|
+
[x: number]: unknown;
|
|
248
|
+
[x: symbol]: unknown;
|
|
249
|
+
type: string;
|
|
250
|
+
}) | undefined): void;
|
|
251
|
+
setState(state: NotificationStore | ((state: NotificationStore) => NotificationStore), replace: true, action?: (string | {
|
|
252
|
+
[x: string]: unknown;
|
|
253
|
+
[x: number]: unknown;
|
|
254
|
+
[x: symbol]: unknown;
|
|
255
|
+
type: string;
|
|
256
|
+
}) | undefined): void;
|
|
257
|
+
devtools: {
|
|
258
|
+
cleanup: () => void;
|
|
259
|
+
};
|
|
260
|
+
}>;
|
|
261
|
+
|
|
262
|
+
export { CheckboxList, CheckboxListItem, FetchNotificationsParams, Notification, type NotificationActions, NotificationApiClient, NotificationGroup, type NotificationState, type NotificationStore, createNotificationStore, createUseNotificationStore, formatTimeAgo };
|