@exyconn/common 1.0.0 → 2.1.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 +121 -36
- package/dist/client/index.d.mts +3 -2
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.js +5059 -231
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +4951 -232
- package/dist/client/index.mjs.map +1 -1
- package/dist/client/utils/index.d.mts +123 -1
- package/dist/client/utils/index.d.ts +123 -1
- package/dist/client/utils/index.js +207 -0
- package/dist/client/utils/index.js.map +1 -1
- package/dist/client/utils/index.mjs +204 -1
- package/dist/client/utils/index.mjs.map +1 -1
- package/dist/index-BcxL4_V4.d.ts +2946 -0
- package/dist/{index-iTKxFa78.d.ts → index-DEzgM15j.d.ts} +10 -2
- package/dist/{index-ClWtDfwk.d.ts → index-DNFVgQx8.d.ts} +544 -2
- package/dist/{index-CcrANHAQ.d.mts → index-DbV04Dx8.d.mts} +10 -2
- package/dist/{index-DSW6JfD-.d.mts → index-DfqEP6Oe.d.mts} +544 -2
- package/dist/index-bvvCev9Q.d.mts +2946 -0
- package/dist/index.d.mts +433 -7
- package/dist/index.d.ts +433 -7
- package/dist/index.js +6101 -220
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6083 -221
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +197 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +194 -2
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/utils/index.d.mts +73 -1
- package/dist/server/utils/index.d.ts +73 -1
- package/dist/server/utils/index.js +199 -0
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/index.mjs +195 -1
- package/dist/server/utils/index.mjs.map +1 -1
- package/dist/shared/index.d.mts +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +296 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +274 -1
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +41 -4
- package/dist/index-BNdT-2X4.d.ts +0 -229
- package/dist/index-Du0LLt9f.d.mts +0 -229
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exyconn/common",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Common utilities shared across all Exyconn projects - includes server utilities, client hooks, shared types, data modules, and validation helpers",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -120,6 +120,26 @@
|
|
|
120
120
|
"import": "./dist/data/logos.mjs",
|
|
121
121
|
"require": "./dist/data/logos.js",
|
|
122
122
|
"types": "./dist/data/logos.d.ts"
|
|
123
|
+
},
|
|
124
|
+
"./client/web": {
|
|
125
|
+
"import": "./dist/client/web/index.mjs",
|
|
126
|
+
"require": "./dist/client/web/index.js",
|
|
127
|
+
"types": "./dist/client/web/index.d.ts"
|
|
128
|
+
},
|
|
129
|
+
"./client/web/theme": {
|
|
130
|
+
"import": "./dist/client/web/theme/index.mjs",
|
|
131
|
+
"require": "./dist/client/web/theme/index.js",
|
|
132
|
+
"types": "./dist/client/web/theme/index.d.ts"
|
|
133
|
+
},
|
|
134
|
+
"./client/web/astro": {
|
|
135
|
+
"import": "./dist/client/web/astro/index.mjs",
|
|
136
|
+
"require": "./dist/client/web/astro/index.js",
|
|
137
|
+
"types": "./dist/client/web/astro/index.d.ts"
|
|
138
|
+
},
|
|
139
|
+
"./client/web/forms": {
|
|
140
|
+
"import": "./dist/client/web/forms/index.mjs",
|
|
141
|
+
"require": "./dist/client/web/forms/index.js",
|
|
142
|
+
"types": "./dist/client/web/forms/index.d.ts"
|
|
123
143
|
}
|
|
124
144
|
},
|
|
125
145
|
"scripts": {
|
|
@@ -127,7 +147,14 @@
|
|
|
127
147
|
"dev": "tsup --watch",
|
|
128
148
|
"lint": "eslint src/",
|
|
129
149
|
"test": "jest",
|
|
130
|
-
"prepublishOnly": "npm run build"
|
|
150
|
+
"prepublishOnly": "npm run build",
|
|
151
|
+
"publish:patch": "npm version patch && npm publish --access public",
|
|
152
|
+
"publish:minor": "npm version minor && npm publish --access public",
|
|
153
|
+
"publish:major": "npm version major && npm publish --access public",
|
|
154
|
+
"release": "npm run build && npm publish --access public",
|
|
155
|
+
"release:patch": "npm run build && npm version patch && npm publish --access public",
|
|
156
|
+
"release:minor": "npm run build && npm version minor && npm publish --access public",
|
|
157
|
+
"release:major": "npm run build && npm version major && npm publish --access public"
|
|
131
158
|
},
|
|
132
159
|
"keywords": [
|
|
133
160
|
"common",
|
|
@@ -147,24 +174,28 @@
|
|
|
147
174
|
"date-fns": "^3.0.0",
|
|
148
175
|
"date-fns-tz": "^3.0.0",
|
|
149
176
|
"express": "^4.18.0",
|
|
177
|
+
"formik": "^2.4.0",
|
|
150
178
|
"jsonwebtoken": "^9.0.0",
|
|
151
179
|
"mongoose": "^8.0.0",
|
|
152
180
|
"react": "^18.2.0",
|
|
153
181
|
"tsup": "^8.0.1",
|
|
154
182
|
"typescript": "^5.3.0",
|
|
155
183
|
"winston": "^3.11.0",
|
|
156
|
-
"winston-daily-rotate-file": "^4.7.0"
|
|
184
|
+
"winston-daily-rotate-file": "^4.7.0",
|
|
185
|
+
"yup": "^1.4.0"
|
|
157
186
|
},
|
|
158
187
|
"peerDependencies": {
|
|
159
188
|
"axios": "^1.6.0",
|
|
160
189
|
"date-fns": "^3.0.0",
|
|
161
190
|
"date-fns-tz": "^3.0.0",
|
|
162
191
|
"express": "^4.18.0 || ^5.0.0",
|
|
192
|
+
"formik": "^2.4.0",
|
|
163
193
|
"jsonwebtoken": "^9.0.0",
|
|
164
194
|
"mongoose": "^8.0.0",
|
|
165
195
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
166
196
|
"winston": "^3.11.0",
|
|
167
|
-
"winston-daily-rotate-file": "^4.7.0"
|
|
197
|
+
"winston-daily-rotate-file": "^4.7.0",
|
|
198
|
+
"yup": "^1.4.0"
|
|
168
199
|
},
|
|
169
200
|
"peerDependenciesMeta": {
|
|
170
201
|
"axios": {
|
|
@@ -193,6 +224,12 @@
|
|
|
193
224
|
},
|
|
194
225
|
"winston-daily-rotate-file": {
|
|
195
226
|
"optional": true
|
|
227
|
+
},
|
|
228
|
+
"formik": {
|
|
229
|
+
"optional": true
|
|
230
|
+
},
|
|
231
|
+
"yup": {
|
|
232
|
+
"optional": true
|
|
196
233
|
}
|
|
197
234
|
},
|
|
198
235
|
"files": [
|
package/dist/index-BNdT-2X4.d.ts
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { ApiResponse, HttpClientOptions, PaginatedResponse, createHttpClient, isForbidden, isNotFound, isServerError, isStatusError, isSuccess, isUnauthorized, parseError, parseFullResponse, parseResponse, withAbortSignal, withFormData, withTimeout } from './client/http/index.js';
|
|
2
|
-
import { ClientLogger, ClientLoggerConfig, LogLevel, clientLogger, createClientLogger } from './client/logger/index.js';
|
|
3
|
-
import { ApiUrlBuilder, ApiUrlConfig, EventEmitter, addDays, appEvents, camelToKebab, capitalize, capitalizeWords, copyToClipboard, createApiEndpoints, createApiUrlBuilder, createEmptyPaginationMeta, createErrorResponse, createEventEmitter, createSuccessResponse, endOfDay, formatDate, formatDateForInput, formatDateTime, formatDateTimeForInput, formatRelativeTime, getErrorMessage, getNextPage, getPrevPage, getResponseData, hasData, hasMorePages, isClipboardAvailable, isErrorResponse, isFuture, isPast, isSuccessResponse, isToday, kebabToCamel, readFromClipboard, slugify, slugifyUnique, startOfDay, truncate, truncateWords, unslugify } from './client/utils/index.js';
|
|
4
|
-
import { RefObject } from 'react';
|
|
5
|
-
|
|
6
|
-
type SetValue<T> = T | ((prevValue: T) => T);
|
|
7
|
-
interface UseLocalStorageOptions<T> {
|
|
8
|
-
/** Serialize function (default: JSON.stringify) */
|
|
9
|
-
serializer?: (value: T) => string;
|
|
10
|
-
/** Deserialize function (default: JSON.parse) */
|
|
11
|
-
deserializer?: (value: string) => T;
|
|
12
|
-
/** Enable cross-tab synchronization (default: true) */
|
|
13
|
-
syncTabs?: boolean;
|
|
14
|
-
/** Enable logging (default: false) */
|
|
15
|
-
debug?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Hook to persist state in localStorage with cross-tab sync
|
|
19
|
-
* @param key - localStorage key
|
|
20
|
-
* @param initialValue - initial/fallback value
|
|
21
|
-
* @param options - configuration options
|
|
22
|
-
*/
|
|
23
|
-
declare function useLocalStorage<T>(key: string, initialValue: T, options?: UseLocalStorageOptions<T>): [T, (value: SetValue<T>) => void, () => void];
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Debounce a value with configurable delay
|
|
27
|
-
* @param value - Value to debounce
|
|
28
|
-
* @param delay - Delay in milliseconds (default: 500)
|
|
29
|
-
*/
|
|
30
|
-
declare function useDebounce<T>(value: T, delay?: number): T;
|
|
31
|
-
|
|
32
|
-
interface UseCopyToClipboardReturn {
|
|
33
|
-
/** Copy text to clipboard */
|
|
34
|
-
copy: (text: string) => Promise<boolean>;
|
|
35
|
-
/** Whether copy was successful (resets after timeout) */
|
|
36
|
-
copied: boolean;
|
|
37
|
-
/** Error message if copy failed */
|
|
38
|
-
error: string | null;
|
|
39
|
-
/** Reset state */
|
|
40
|
-
reset: () => void;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Copy text to clipboard with feedback
|
|
44
|
-
* @param resetDelay - Time in ms before copied state resets (default: 2000)
|
|
45
|
-
*/
|
|
46
|
-
declare function useCopyToClipboard(resetDelay?: number): UseCopyToClipboardReturn;
|
|
47
|
-
|
|
48
|
-
interface UsePageTitleOptions {
|
|
49
|
-
/** Suffix to append to the title (e.g., organization name) */
|
|
50
|
-
suffix?: string;
|
|
51
|
-
/** Separator between title and suffix (default: ' | ') */
|
|
52
|
-
separator?: string;
|
|
53
|
-
/** Whether to restore original title on unmount (default: true) */
|
|
54
|
-
restoreOnUnmount?: boolean;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Set the document title with optional suffix
|
|
58
|
-
* @param title - Page title
|
|
59
|
-
* @param options - Configuration options
|
|
60
|
-
*/
|
|
61
|
-
declare function usePageTitle(title: string, options?: UsePageTitleOptions): void;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Run a callback on an interval
|
|
65
|
-
* @param callback - Function to call on each interval
|
|
66
|
-
* @param delay - Interval delay in ms (null to pause)
|
|
67
|
-
*/
|
|
68
|
-
declare function useInterval(callback: () => void, delay: number | null): void;
|
|
69
|
-
|
|
70
|
-
type ThemeMode = 'light' | 'dark';
|
|
71
|
-
/**
|
|
72
|
-
* Detect and track system color scheme preference
|
|
73
|
-
* @returns Current theme mode based on system preference
|
|
74
|
-
*/
|
|
75
|
-
declare function useThemeDetector(): ThemeMode;
|
|
76
|
-
|
|
77
|
-
type SnackbarSeverity = 'success' | 'error' | 'warning' | 'info';
|
|
78
|
-
interface SnackbarState {
|
|
79
|
-
open: boolean;
|
|
80
|
-
message: string;
|
|
81
|
-
severity: SnackbarSeverity;
|
|
82
|
-
autoHideDuration?: number;
|
|
83
|
-
}
|
|
84
|
-
interface UseSnackbarReturn {
|
|
85
|
-
/** Current snackbar state */
|
|
86
|
-
state: SnackbarState;
|
|
87
|
-
/** Show snackbar with message */
|
|
88
|
-
show: (message: string, severity?: SnackbarSeverity, duration?: number) => void;
|
|
89
|
-
/** Show success snackbar */
|
|
90
|
-
success: (message: string, duration?: number) => void;
|
|
91
|
-
/** Show error snackbar */
|
|
92
|
-
error: (message: string, duration?: number) => void;
|
|
93
|
-
/** Show warning snackbar */
|
|
94
|
-
warning: (message: string, duration?: number) => void;
|
|
95
|
-
/** Show info snackbar */
|
|
96
|
-
info: (message: string, duration?: number) => void;
|
|
97
|
-
/** Close snackbar */
|
|
98
|
-
close: () => void;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Manage snackbar/toast notification state
|
|
102
|
-
* @param defaultDuration - Default auto-hide duration in ms
|
|
103
|
-
*/
|
|
104
|
-
declare function useSnackbar(defaultDuration?: number): UseSnackbarReturn;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Track a media query match
|
|
108
|
-
* @param query - CSS media query string (e.g., '(min-width: 768px)')
|
|
109
|
-
*/
|
|
110
|
-
declare function useMediaQuery(query: string): boolean;
|
|
111
|
-
declare const useIsMobile: () => boolean;
|
|
112
|
-
declare const useIsTablet: () => boolean;
|
|
113
|
-
declare const useIsDesktop: () => boolean;
|
|
114
|
-
declare const useIsMobileOrTablet: () => boolean;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* useOnClickOutside Hook
|
|
118
|
-
* Detect clicks outside of a referenced element
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
type Handler = (event: MouseEvent | TouchEvent) => void;
|
|
122
|
-
/**
|
|
123
|
-
* Detect clicks outside of a referenced element
|
|
124
|
-
* @param ref - React ref to the element
|
|
125
|
-
* @param handler - Callback when click outside occurs
|
|
126
|
-
* @param enabled - Whether the hook is enabled (default: true)
|
|
127
|
-
*/
|
|
128
|
-
declare function useOnClickOutside<T extends HTMLElement = HTMLElement>(ref: RefObject<T>, handler: Handler, enabled?: boolean): void;
|
|
129
|
-
|
|
130
|
-
interface WindowSize {
|
|
131
|
-
width: number;
|
|
132
|
-
height: number;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Track window dimensions with resize updates
|
|
136
|
-
* @param debounceMs - Debounce resize events (default: 100ms)
|
|
137
|
-
*/
|
|
138
|
-
declare function useWindowSize(debounceMs?: number): WindowSize;
|
|
139
|
-
|
|
140
|
-
declare const index_ApiResponse: typeof ApiResponse;
|
|
141
|
-
declare const index_ApiUrlBuilder: typeof ApiUrlBuilder;
|
|
142
|
-
declare const index_ApiUrlConfig: typeof ApiUrlConfig;
|
|
143
|
-
declare const index_ClientLogger: typeof ClientLogger;
|
|
144
|
-
declare const index_ClientLoggerConfig: typeof ClientLoggerConfig;
|
|
145
|
-
declare const index_EventEmitter: typeof EventEmitter;
|
|
146
|
-
declare const index_HttpClientOptions: typeof HttpClientOptions;
|
|
147
|
-
declare const index_LogLevel: typeof LogLevel;
|
|
148
|
-
declare const index_PaginatedResponse: typeof PaginatedResponse;
|
|
149
|
-
type index_SetValue<T> = SetValue<T>;
|
|
150
|
-
type index_SnackbarSeverity = SnackbarSeverity;
|
|
151
|
-
type index_SnackbarState = SnackbarState;
|
|
152
|
-
type index_ThemeMode = ThemeMode;
|
|
153
|
-
type index_UseCopyToClipboardReturn = UseCopyToClipboardReturn;
|
|
154
|
-
type index_UseLocalStorageOptions<T> = UseLocalStorageOptions<T>;
|
|
155
|
-
type index_UsePageTitleOptions = UsePageTitleOptions;
|
|
156
|
-
type index_UseSnackbarReturn = UseSnackbarReturn;
|
|
157
|
-
type index_WindowSize = WindowSize;
|
|
158
|
-
declare const index_addDays: typeof addDays;
|
|
159
|
-
declare const index_appEvents: typeof appEvents;
|
|
160
|
-
declare const index_camelToKebab: typeof camelToKebab;
|
|
161
|
-
declare const index_capitalize: typeof capitalize;
|
|
162
|
-
declare const index_capitalizeWords: typeof capitalizeWords;
|
|
163
|
-
declare const index_clientLogger: typeof clientLogger;
|
|
164
|
-
declare const index_copyToClipboard: typeof copyToClipboard;
|
|
165
|
-
declare const index_createApiEndpoints: typeof createApiEndpoints;
|
|
166
|
-
declare const index_createApiUrlBuilder: typeof createApiUrlBuilder;
|
|
167
|
-
declare const index_createClientLogger: typeof createClientLogger;
|
|
168
|
-
declare const index_createEmptyPaginationMeta: typeof createEmptyPaginationMeta;
|
|
169
|
-
declare const index_createErrorResponse: typeof createErrorResponse;
|
|
170
|
-
declare const index_createEventEmitter: typeof createEventEmitter;
|
|
171
|
-
declare const index_createHttpClient: typeof createHttpClient;
|
|
172
|
-
declare const index_createSuccessResponse: typeof createSuccessResponse;
|
|
173
|
-
declare const index_endOfDay: typeof endOfDay;
|
|
174
|
-
declare const index_formatDate: typeof formatDate;
|
|
175
|
-
declare const index_formatDateForInput: typeof formatDateForInput;
|
|
176
|
-
declare const index_formatDateTime: typeof formatDateTime;
|
|
177
|
-
declare const index_formatDateTimeForInput: typeof formatDateTimeForInput;
|
|
178
|
-
declare const index_formatRelativeTime: typeof formatRelativeTime;
|
|
179
|
-
declare const index_getErrorMessage: typeof getErrorMessage;
|
|
180
|
-
declare const index_getNextPage: typeof getNextPage;
|
|
181
|
-
declare const index_getPrevPage: typeof getPrevPage;
|
|
182
|
-
declare const index_getResponseData: typeof getResponseData;
|
|
183
|
-
declare const index_hasData: typeof hasData;
|
|
184
|
-
declare const index_hasMorePages: typeof hasMorePages;
|
|
185
|
-
declare const index_isClipboardAvailable: typeof isClipboardAvailable;
|
|
186
|
-
declare const index_isErrorResponse: typeof isErrorResponse;
|
|
187
|
-
declare const index_isForbidden: typeof isForbidden;
|
|
188
|
-
declare const index_isFuture: typeof isFuture;
|
|
189
|
-
declare const index_isNotFound: typeof isNotFound;
|
|
190
|
-
declare const index_isPast: typeof isPast;
|
|
191
|
-
declare const index_isServerError: typeof isServerError;
|
|
192
|
-
declare const index_isStatusError: typeof isStatusError;
|
|
193
|
-
declare const index_isSuccess: typeof isSuccess;
|
|
194
|
-
declare const index_isSuccessResponse: typeof isSuccessResponse;
|
|
195
|
-
declare const index_isToday: typeof isToday;
|
|
196
|
-
declare const index_isUnauthorized: typeof isUnauthorized;
|
|
197
|
-
declare const index_kebabToCamel: typeof kebabToCamel;
|
|
198
|
-
declare const index_parseError: typeof parseError;
|
|
199
|
-
declare const index_parseFullResponse: typeof parseFullResponse;
|
|
200
|
-
declare const index_parseResponse: typeof parseResponse;
|
|
201
|
-
declare const index_readFromClipboard: typeof readFromClipboard;
|
|
202
|
-
declare const index_slugify: typeof slugify;
|
|
203
|
-
declare const index_slugifyUnique: typeof slugifyUnique;
|
|
204
|
-
declare const index_startOfDay: typeof startOfDay;
|
|
205
|
-
declare const index_truncate: typeof truncate;
|
|
206
|
-
declare const index_truncateWords: typeof truncateWords;
|
|
207
|
-
declare const index_unslugify: typeof unslugify;
|
|
208
|
-
declare const index_useCopyToClipboard: typeof useCopyToClipboard;
|
|
209
|
-
declare const index_useDebounce: typeof useDebounce;
|
|
210
|
-
declare const index_useInterval: typeof useInterval;
|
|
211
|
-
declare const index_useIsDesktop: typeof useIsDesktop;
|
|
212
|
-
declare const index_useIsMobile: typeof useIsMobile;
|
|
213
|
-
declare const index_useIsMobileOrTablet: typeof useIsMobileOrTablet;
|
|
214
|
-
declare const index_useIsTablet: typeof useIsTablet;
|
|
215
|
-
declare const index_useLocalStorage: typeof useLocalStorage;
|
|
216
|
-
declare const index_useMediaQuery: typeof useMediaQuery;
|
|
217
|
-
declare const index_useOnClickOutside: typeof useOnClickOutside;
|
|
218
|
-
declare const index_usePageTitle: typeof usePageTitle;
|
|
219
|
-
declare const index_useSnackbar: typeof useSnackbar;
|
|
220
|
-
declare const index_useThemeDetector: typeof useThemeDetector;
|
|
221
|
-
declare const index_useWindowSize: typeof useWindowSize;
|
|
222
|
-
declare const index_withAbortSignal: typeof withAbortSignal;
|
|
223
|
-
declare const index_withFormData: typeof withFormData;
|
|
224
|
-
declare const index_withTimeout: typeof withTimeout;
|
|
225
|
-
declare namespace index {
|
|
226
|
-
export { index_ApiResponse as ApiResponse, index_ApiUrlBuilder as ApiUrlBuilder, index_ApiUrlConfig as ApiUrlConfig, index_ClientLogger as ClientLogger, index_ClientLoggerConfig as ClientLoggerConfig, index_EventEmitter as EventEmitter, index_HttpClientOptions as HttpClientOptions, index_LogLevel as LogLevel, index_PaginatedResponse as PaginatedResponse, type index_SetValue as SetValue, type index_SnackbarSeverity as SnackbarSeverity, type index_SnackbarState as SnackbarState, type index_ThemeMode as ThemeMode, type index_UseCopyToClipboardReturn as UseCopyToClipboardReturn, type index_UseLocalStorageOptions as UseLocalStorageOptions, type index_UsePageTitleOptions as UsePageTitleOptions, type index_UseSnackbarReturn as UseSnackbarReturn, type index_WindowSize as WindowSize, index_addDays as addDays, index_appEvents as appEvents, index_camelToKebab as camelToKebab, index_capitalize as capitalize, index_capitalizeWords as capitalizeWords, index_clientLogger as clientLogger, index_copyToClipboard as copyToClipboard, index_createApiEndpoints as createApiEndpoints, index_createApiUrlBuilder as createApiUrlBuilder, index_createClientLogger as createClientLogger, index_createEmptyPaginationMeta as createEmptyPaginationMeta, index_createErrorResponse as createErrorResponse, index_createEventEmitter as createEventEmitter, index_createHttpClient as createHttpClient, index_createSuccessResponse as createSuccessResponse, index_endOfDay as endOfDay, index_formatDate as formatDate, index_formatDateForInput as formatDateForInput, index_formatDateTime as formatDateTime, index_formatDateTimeForInput as formatDateTimeForInput, index_formatRelativeTime as formatRelativeTime, index_getErrorMessage as getErrorMessage, index_getNextPage as getNextPage, index_getPrevPage as getPrevPage, index_getResponseData as getResponseData, index_hasData as hasData, index_hasMorePages as hasMorePages, index_isClipboardAvailable as isClipboardAvailable, index_isErrorResponse as isErrorResponse, index_isForbidden as isForbidden, index_isFuture as isFuture, index_isNotFound as isNotFound, index_isPast as isPast, index_isServerError as isServerError, index_isStatusError as isStatusError, index_isSuccess as isSuccess, index_isSuccessResponse as isSuccessResponse, index_isToday as isToday, index_isUnauthorized as isUnauthorized, index_kebabToCamel as kebabToCamel, index_parseError as parseError, index_parseFullResponse as parseFullResponse, index_parseResponse as parseResponse, index_readFromClipboard as readFromClipboard, index_slugify as slugify, index_slugifyUnique as slugifyUnique, index_startOfDay as startOfDay, index_truncate as truncate, index_truncateWords as truncateWords, index_unslugify as unslugify, index_useCopyToClipboard as useCopyToClipboard, index_useDebounce as useDebounce, index_useInterval as useInterval, index_useIsDesktop as useIsDesktop, index_useIsMobile as useIsMobile, index_useIsMobileOrTablet as useIsMobileOrTablet, index_useIsTablet as useIsTablet, index_useLocalStorage as useLocalStorage, index_useMediaQuery as useMediaQuery, index_useOnClickOutside as useOnClickOutside, index_usePageTitle as usePageTitle, index_useSnackbar as useSnackbar, index_useThemeDetector as useThemeDetector, index_useWindowSize as useWindowSize, index_withAbortSignal as withAbortSignal, index_withFormData as withFormData, index_withTimeout as withTimeout };
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export { type SetValue as S, type ThemeMode as T, type UseLocalStorageOptions as U, type WindowSize as W, useDebounce as a, useCopyToClipboard as b, usePageTitle as c, useInterval as d, useThemeDetector as e, useSnackbar as f, useMediaQuery as g, useOnClickOutside as h, index as i, useWindowSize as j, type UseCopyToClipboardReturn as k, type UsePageTitleOptions as l, type SnackbarSeverity as m, type SnackbarState as n, type UseSnackbarReturn as o, useIsMobile as p, useIsTablet as q, useIsDesktop as r, useIsMobileOrTablet as s, useLocalStorage as u };
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { ApiResponse, HttpClientOptions, PaginatedResponse, createHttpClient, isForbidden, isNotFound, isServerError, isStatusError, isSuccess, isUnauthorized, parseError, parseFullResponse, parseResponse, withAbortSignal, withFormData, withTimeout } from './client/http/index.mjs';
|
|
2
|
-
import { ClientLogger, ClientLoggerConfig, LogLevel, clientLogger, createClientLogger } from './client/logger/index.mjs';
|
|
3
|
-
import { ApiUrlBuilder, ApiUrlConfig, EventEmitter, addDays, appEvents, camelToKebab, capitalize, capitalizeWords, copyToClipboard, createApiEndpoints, createApiUrlBuilder, createEmptyPaginationMeta, createErrorResponse, createEventEmitter, createSuccessResponse, endOfDay, formatDate, formatDateForInput, formatDateTime, formatDateTimeForInput, formatRelativeTime, getErrorMessage, getNextPage, getPrevPage, getResponseData, hasData, hasMorePages, isClipboardAvailable, isErrorResponse, isFuture, isPast, isSuccessResponse, isToday, kebabToCamel, readFromClipboard, slugify, slugifyUnique, startOfDay, truncate, truncateWords, unslugify } from './client/utils/index.mjs';
|
|
4
|
-
import { RefObject } from 'react';
|
|
5
|
-
|
|
6
|
-
type SetValue<T> = T | ((prevValue: T) => T);
|
|
7
|
-
interface UseLocalStorageOptions<T> {
|
|
8
|
-
/** Serialize function (default: JSON.stringify) */
|
|
9
|
-
serializer?: (value: T) => string;
|
|
10
|
-
/** Deserialize function (default: JSON.parse) */
|
|
11
|
-
deserializer?: (value: string) => T;
|
|
12
|
-
/** Enable cross-tab synchronization (default: true) */
|
|
13
|
-
syncTabs?: boolean;
|
|
14
|
-
/** Enable logging (default: false) */
|
|
15
|
-
debug?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Hook to persist state in localStorage with cross-tab sync
|
|
19
|
-
* @param key - localStorage key
|
|
20
|
-
* @param initialValue - initial/fallback value
|
|
21
|
-
* @param options - configuration options
|
|
22
|
-
*/
|
|
23
|
-
declare function useLocalStorage<T>(key: string, initialValue: T, options?: UseLocalStorageOptions<T>): [T, (value: SetValue<T>) => void, () => void];
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Debounce a value with configurable delay
|
|
27
|
-
* @param value - Value to debounce
|
|
28
|
-
* @param delay - Delay in milliseconds (default: 500)
|
|
29
|
-
*/
|
|
30
|
-
declare function useDebounce<T>(value: T, delay?: number): T;
|
|
31
|
-
|
|
32
|
-
interface UseCopyToClipboardReturn {
|
|
33
|
-
/** Copy text to clipboard */
|
|
34
|
-
copy: (text: string) => Promise<boolean>;
|
|
35
|
-
/** Whether copy was successful (resets after timeout) */
|
|
36
|
-
copied: boolean;
|
|
37
|
-
/** Error message if copy failed */
|
|
38
|
-
error: string | null;
|
|
39
|
-
/** Reset state */
|
|
40
|
-
reset: () => void;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Copy text to clipboard with feedback
|
|
44
|
-
* @param resetDelay - Time in ms before copied state resets (default: 2000)
|
|
45
|
-
*/
|
|
46
|
-
declare function useCopyToClipboard(resetDelay?: number): UseCopyToClipboardReturn;
|
|
47
|
-
|
|
48
|
-
interface UsePageTitleOptions {
|
|
49
|
-
/** Suffix to append to the title (e.g., organization name) */
|
|
50
|
-
suffix?: string;
|
|
51
|
-
/** Separator between title and suffix (default: ' | ') */
|
|
52
|
-
separator?: string;
|
|
53
|
-
/** Whether to restore original title on unmount (default: true) */
|
|
54
|
-
restoreOnUnmount?: boolean;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Set the document title with optional suffix
|
|
58
|
-
* @param title - Page title
|
|
59
|
-
* @param options - Configuration options
|
|
60
|
-
*/
|
|
61
|
-
declare function usePageTitle(title: string, options?: UsePageTitleOptions): void;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Run a callback on an interval
|
|
65
|
-
* @param callback - Function to call on each interval
|
|
66
|
-
* @param delay - Interval delay in ms (null to pause)
|
|
67
|
-
*/
|
|
68
|
-
declare function useInterval(callback: () => void, delay: number | null): void;
|
|
69
|
-
|
|
70
|
-
type ThemeMode = 'light' | 'dark';
|
|
71
|
-
/**
|
|
72
|
-
* Detect and track system color scheme preference
|
|
73
|
-
* @returns Current theme mode based on system preference
|
|
74
|
-
*/
|
|
75
|
-
declare function useThemeDetector(): ThemeMode;
|
|
76
|
-
|
|
77
|
-
type SnackbarSeverity = 'success' | 'error' | 'warning' | 'info';
|
|
78
|
-
interface SnackbarState {
|
|
79
|
-
open: boolean;
|
|
80
|
-
message: string;
|
|
81
|
-
severity: SnackbarSeverity;
|
|
82
|
-
autoHideDuration?: number;
|
|
83
|
-
}
|
|
84
|
-
interface UseSnackbarReturn {
|
|
85
|
-
/** Current snackbar state */
|
|
86
|
-
state: SnackbarState;
|
|
87
|
-
/** Show snackbar with message */
|
|
88
|
-
show: (message: string, severity?: SnackbarSeverity, duration?: number) => void;
|
|
89
|
-
/** Show success snackbar */
|
|
90
|
-
success: (message: string, duration?: number) => void;
|
|
91
|
-
/** Show error snackbar */
|
|
92
|
-
error: (message: string, duration?: number) => void;
|
|
93
|
-
/** Show warning snackbar */
|
|
94
|
-
warning: (message: string, duration?: number) => void;
|
|
95
|
-
/** Show info snackbar */
|
|
96
|
-
info: (message: string, duration?: number) => void;
|
|
97
|
-
/** Close snackbar */
|
|
98
|
-
close: () => void;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Manage snackbar/toast notification state
|
|
102
|
-
* @param defaultDuration - Default auto-hide duration in ms
|
|
103
|
-
*/
|
|
104
|
-
declare function useSnackbar(defaultDuration?: number): UseSnackbarReturn;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Track a media query match
|
|
108
|
-
* @param query - CSS media query string (e.g., '(min-width: 768px)')
|
|
109
|
-
*/
|
|
110
|
-
declare function useMediaQuery(query: string): boolean;
|
|
111
|
-
declare const useIsMobile: () => boolean;
|
|
112
|
-
declare const useIsTablet: () => boolean;
|
|
113
|
-
declare const useIsDesktop: () => boolean;
|
|
114
|
-
declare const useIsMobileOrTablet: () => boolean;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* useOnClickOutside Hook
|
|
118
|
-
* Detect clicks outside of a referenced element
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
type Handler = (event: MouseEvent | TouchEvent) => void;
|
|
122
|
-
/**
|
|
123
|
-
* Detect clicks outside of a referenced element
|
|
124
|
-
* @param ref - React ref to the element
|
|
125
|
-
* @param handler - Callback when click outside occurs
|
|
126
|
-
* @param enabled - Whether the hook is enabled (default: true)
|
|
127
|
-
*/
|
|
128
|
-
declare function useOnClickOutside<T extends HTMLElement = HTMLElement>(ref: RefObject<T>, handler: Handler, enabled?: boolean): void;
|
|
129
|
-
|
|
130
|
-
interface WindowSize {
|
|
131
|
-
width: number;
|
|
132
|
-
height: number;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Track window dimensions with resize updates
|
|
136
|
-
* @param debounceMs - Debounce resize events (default: 100ms)
|
|
137
|
-
*/
|
|
138
|
-
declare function useWindowSize(debounceMs?: number): WindowSize;
|
|
139
|
-
|
|
140
|
-
declare const index_ApiResponse: typeof ApiResponse;
|
|
141
|
-
declare const index_ApiUrlBuilder: typeof ApiUrlBuilder;
|
|
142
|
-
declare const index_ApiUrlConfig: typeof ApiUrlConfig;
|
|
143
|
-
declare const index_ClientLogger: typeof ClientLogger;
|
|
144
|
-
declare const index_ClientLoggerConfig: typeof ClientLoggerConfig;
|
|
145
|
-
declare const index_EventEmitter: typeof EventEmitter;
|
|
146
|
-
declare const index_HttpClientOptions: typeof HttpClientOptions;
|
|
147
|
-
declare const index_LogLevel: typeof LogLevel;
|
|
148
|
-
declare const index_PaginatedResponse: typeof PaginatedResponse;
|
|
149
|
-
type index_SetValue<T> = SetValue<T>;
|
|
150
|
-
type index_SnackbarSeverity = SnackbarSeverity;
|
|
151
|
-
type index_SnackbarState = SnackbarState;
|
|
152
|
-
type index_ThemeMode = ThemeMode;
|
|
153
|
-
type index_UseCopyToClipboardReturn = UseCopyToClipboardReturn;
|
|
154
|
-
type index_UseLocalStorageOptions<T> = UseLocalStorageOptions<T>;
|
|
155
|
-
type index_UsePageTitleOptions = UsePageTitleOptions;
|
|
156
|
-
type index_UseSnackbarReturn = UseSnackbarReturn;
|
|
157
|
-
type index_WindowSize = WindowSize;
|
|
158
|
-
declare const index_addDays: typeof addDays;
|
|
159
|
-
declare const index_appEvents: typeof appEvents;
|
|
160
|
-
declare const index_camelToKebab: typeof camelToKebab;
|
|
161
|
-
declare const index_capitalize: typeof capitalize;
|
|
162
|
-
declare const index_capitalizeWords: typeof capitalizeWords;
|
|
163
|
-
declare const index_clientLogger: typeof clientLogger;
|
|
164
|
-
declare const index_copyToClipboard: typeof copyToClipboard;
|
|
165
|
-
declare const index_createApiEndpoints: typeof createApiEndpoints;
|
|
166
|
-
declare const index_createApiUrlBuilder: typeof createApiUrlBuilder;
|
|
167
|
-
declare const index_createClientLogger: typeof createClientLogger;
|
|
168
|
-
declare const index_createEmptyPaginationMeta: typeof createEmptyPaginationMeta;
|
|
169
|
-
declare const index_createErrorResponse: typeof createErrorResponse;
|
|
170
|
-
declare const index_createEventEmitter: typeof createEventEmitter;
|
|
171
|
-
declare const index_createHttpClient: typeof createHttpClient;
|
|
172
|
-
declare const index_createSuccessResponse: typeof createSuccessResponse;
|
|
173
|
-
declare const index_endOfDay: typeof endOfDay;
|
|
174
|
-
declare const index_formatDate: typeof formatDate;
|
|
175
|
-
declare const index_formatDateForInput: typeof formatDateForInput;
|
|
176
|
-
declare const index_formatDateTime: typeof formatDateTime;
|
|
177
|
-
declare const index_formatDateTimeForInput: typeof formatDateTimeForInput;
|
|
178
|
-
declare const index_formatRelativeTime: typeof formatRelativeTime;
|
|
179
|
-
declare const index_getErrorMessage: typeof getErrorMessage;
|
|
180
|
-
declare const index_getNextPage: typeof getNextPage;
|
|
181
|
-
declare const index_getPrevPage: typeof getPrevPage;
|
|
182
|
-
declare const index_getResponseData: typeof getResponseData;
|
|
183
|
-
declare const index_hasData: typeof hasData;
|
|
184
|
-
declare const index_hasMorePages: typeof hasMorePages;
|
|
185
|
-
declare const index_isClipboardAvailable: typeof isClipboardAvailable;
|
|
186
|
-
declare const index_isErrorResponse: typeof isErrorResponse;
|
|
187
|
-
declare const index_isForbidden: typeof isForbidden;
|
|
188
|
-
declare const index_isFuture: typeof isFuture;
|
|
189
|
-
declare const index_isNotFound: typeof isNotFound;
|
|
190
|
-
declare const index_isPast: typeof isPast;
|
|
191
|
-
declare const index_isServerError: typeof isServerError;
|
|
192
|
-
declare const index_isStatusError: typeof isStatusError;
|
|
193
|
-
declare const index_isSuccess: typeof isSuccess;
|
|
194
|
-
declare const index_isSuccessResponse: typeof isSuccessResponse;
|
|
195
|
-
declare const index_isToday: typeof isToday;
|
|
196
|
-
declare const index_isUnauthorized: typeof isUnauthorized;
|
|
197
|
-
declare const index_kebabToCamel: typeof kebabToCamel;
|
|
198
|
-
declare const index_parseError: typeof parseError;
|
|
199
|
-
declare const index_parseFullResponse: typeof parseFullResponse;
|
|
200
|
-
declare const index_parseResponse: typeof parseResponse;
|
|
201
|
-
declare const index_readFromClipboard: typeof readFromClipboard;
|
|
202
|
-
declare const index_slugify: typeof slugify;
|
|
203
|
-
declare const index_slugifyUnique: typeof slugifyUnique;
|
|
204
|
-
declare const index_startOfDay: typeof startOfDay;
|
|
205
|
-
declare const index_truncate: typeof truncate;
|
|
206
|
-
declare const index_truncateWords: typeof truncateWords;
|
|
207
|
-
declare const index_unslugify: typeof unslugify;
|
|
208
|
-
declare const index_useCopyToClipboard: typeof useCopyToClipboard;
|
|
209
|
-
declare const index_useDebounce: typeof useDebounce;
|
|
210
|
-
declare const index_useInterval: typeof useInterval;
|
|
211
|
-
declare const index_useIsDesktop: typeof useIsDesktop;
|
|
212
|
-
declare const index_useIsMobile: typeof useIsMobile;
|
|
213
|
-
declare const index_useIsMobileOrTablet: typeof useIsMobileOrTablet;
|
|
214
|
-
declare const index_useIsTablet: typeof useIsTablet;
|
|
215
|
-
declare const index_useLocalStorage: typeof useLocalStorage;
|
|
216
|
-
declare const index_useMediaQuery: typeof useMediaQuery;
|
|
217
|
-
declare const index_useOnClickOutside: typeof useOnClickOutside;
|
|
218
|
-
declare const index_usePageTitle: typeof usePageTitle;
|
|
219
|
-
declare const index_useSnackbar: typeof useSnackbar;
|
|
220
|
-
declare const index_useThemeDetector: typeof useThemeDetector;
|
|
221
|
-
declare const index_useWindowSize: typeof useWindowSize;
|
|
222
|
-
declare const index_withAbortSignal: typeof withAbortSignal;
|
|
223
|
-
declare const index_withFormData: typeof withFormData;
|
|
224
|
-
declare const index_withTimeout: typeof withTimeout;
|
|
225
|
-
declare namespace index {
|
|
226
|
-
export { index_ApiResponse as ApiResponse, index_ApiUrlBuilder as ApiUrlBuilder, index_ApiUrlConfig as ApiUrlConfig, index_ClientLogger as ClientLogger, index_ClientLoggerConfig as ClientLoggerConfig, index_EventEmitter as EventEmitter, index_HttpClientOptions as HttpClientOptions, index_LogLevel as LogLevel, index_PaginatedResponse as PaginatedResponse, type index_SetValue as SetValue, type index_SnackbarSeverity as SnackbarSeverity, type index_SnackbarState as SnackbarState, type index_ThemeMode as ThemeMode, type index_UseCopyToClipboardReturn as UseCopyToClipboardReturn, type index_UseLocalStorageOptions as UseLocalStorageOptions, type index_UsePageTitleOptions as UsePageTitleOptions, type index_UseSnackbarReturn as UseSnackbarReturn, type index_WindowSize as WindowSize, index_addDays as addDays, index_appEvents as appEvents, index_camelToKebab as camelToKebab, index_capitalize as capitalize, index_capitalizeWords as capitalizeWords, index_clientLogger as clientLogger, index_copyToClipboard as copyToClipboard, index_createApiEndpoints as createApiEndpoints, index_createApiUrlBuilder as createApiUrlBuilder, index_createClientLogger as createClientLogger, index_createEmptyPaginationMeta as createEmptyPaginationMeta, index_createErrorResponse as createErrorResponse, index_createEventEmitter as createEventEmitter, index_createHttpClient as createHttpClient, index_createSuccessResponse as createSuccessResponse, index_endOfDay as endOfDay, index_formatDate as formatDate, index_formatDateForInput as formatDateForInput, index_formatDateTime as formatDateTime, index_formatDateTimeForInput as formatDateTimeForInput, index_formatRelativeTime as formatRelativeTime, index_getErrorMessage as getErrorMessage, index_getNextPage as getNextPage, index_getPrevPage as getPrevPage, index_getResponseData as getResponseData, index_hasData as hasData, index_hasMorePages as hasMorePages, index_isClipboardAvailable as isClipboardAvailable, index_isErrorResponse as isErrorResponse, index_isForbidden as isForbidden, index_isFuture as isFuture, index_isNotFound as isNotFound, index_isPast as isPast, index_isServerError as isServerError, index_isStatusError as isStatusError, index_isSuccess as isSuccess, index_isSuccessResponse as isSuccessResponse, index_isToday as isToday, index_isUnauthorized as isUnauthorized, index_kebabToCamel as kebabToCamel, index_parseError as parseError, index_parseFullResponse as parseFullResponse, index_parseResponse as parseResponse, index_readFromClipboard as readFromClipboard, index_slugify as slugify, index_slugifyUnique as slugifyUnique, index_startOfDay as startOfDay, index_truncate as truncate, index_truncateWords as truncateWords, index_unslugify as unslugify, index_useCopyToClipboard as useCopyToClipboard, index_useDebounce as useDebounce, index_useInterval as useInterval, index_useIsDesktop as useIsDesktop, index_useIsMobile as useIsMobile, index_useIsMobileOrTablet as useIsMobileOrTablet, index_useIsTablet as useIsTablet, index_useLocalStorage as useLocalStorage, index_useMediaQuery as useMediaQuery, index_useOnClickOutside as useOnClickOutside, index_usePageTitle as usePageTitle, index_useSnackbar as useSnackbar, index_useThemeDetector as useThemeDetector, index_useWindowSize as useWindowSize, index_withAbortSignal as withAbortSignal, index_withFormData as withFormData, index_withTimeout as withTimeout };
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export { type SetValue as S, type ThemeMode as T, type UseLocalStorageOptions as U, type WindowSize as W, useDebounce as a, useCopyToClipboard as b, usePageTitle as c, useInterval as d, useThemeDetector as e, useSnackbar as f, useMediaQuery as g, useOnClickOutside as h, index as i, useWindowSize as j, type UseCopyToClipboardReturn as k, type UsePageTitleOptions as l, type SnackbarSeverity as m, type SnackbarState as n, type UseSnackbarReturn as o, useIsMobile as p, useIsTablet as q, useIsDesktop as r, useIsMobileOrTablet as s, useLocalStorage as u };
|