@undefine-ui/design-system 2.1.0 → 2.3.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 +73 -11
- package/dist/index.cjs +134 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +144 -1
- package/dist/index.d.ts +144 -1
- package/dist/index.js +169 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -89,6 +89,23 @@ interface UseBooleanReturnType {
|
|
|
89
89
|
onToggle: () => void;
|
|
90
90
|
setValue: React.Dispatch<React.SetStateAction<boolean>>;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Custom hook for managing boolean state with helper functions.
|
|
94
|
+
*
|
|
95
|
+
* @param {boolean} [defaultValue=false] - The initial boolean value
|
|
96
|
+
* @returns {UseBooleanReturnType} Object containing:
|
|
97
|
+
* - value: Current boolean state
|
|
98
|
+
* - onTrue: Function to set value to true
|
|
99
|
+
* - onFalse: Function to set value to false
|
|
100
|
+
* - onToggle: Function to toggle the value
|
|
101
|
+
* - setValue: Direct state setter
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* const modal = useBoolean();
|
|
105
|
+
*
|
|
106
|
+
* <Button onClick={modal.onTrue}>Open Modal</Button>
|
|
107
|
+
* <Modal open={modal.value} onClose={modal.onFalse} />
|
|
108
|
+
*/
|
|
92
109
|
declare const useBoolean: (defaultValue?: boolean) => UseBooleanReturnType;
|
|
93
110
|
|
|
94
111
|
declare const STORAGE_KEY = "app-settings";
|
|
@@ -118,14 +135,73 @@ interface SettingsProviderProps {
|
|
|
118
135
|
}
|
|
119
136
|
declare const SettingsProvider: ({ children, settings }: SettingsProviderProps) => react_jsx_runtime.JSX.Element;
|
|
120
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Custom hook for accessing the design system settings context.
|
|
140
|
+
* Must be used within a SettingsProvider.
|
|
141
|
+
*
|
|
142
|
+
* @returns {SettingsContextValue} The settings context value containing:
|
|
143
|
+
* - Current theme settings (colorScheme, contrast, direction, etc.)
|
|
144
|
+
* - Functions to update settings (onUpdate, onUpdateField, onReset)
|
|
145
|
+
*
|
|
146
|
+
* @throws {Error} If used outside of SettingsProvider
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* const { colorScheme, onUpdateField } = useSettings();
|
|
150
|
+
*
|
|
151
|
+
* <Button onClick={() => onUpdateField('colorScheme', 'dark')}>
|
|
152
|
+
* Toggle Dark Mode
|
|
153
|
+
* </Button>
|
|
154
|
+
*/
|
|
121
155
|
declare const useSettings: () => SettingsContextProps;
|
|
122
156
|
|
|
123
157
|
type ReturnType = boolean;
|
|
124
158
|
type Query = 'up' | 'down' | 'between' | 'only';
|
|
125
159
|
type Value = Breakpoint | number;
|
|
160
|
+
/**
|
|
161
|
+
* Custom hook for responsive design with MUI breakpoints.
|
|
162
|
+
*
|
|
163
|
+
* @param {Query} query - The type of breakpoint query ('up' | 'down' | 'between' | 'only')
|
|
164
|
+
* @param {Value} [start] - The starting breakpoint or number
|
|
165
|
+
* @param {Value} [end] - The ending breakpoint (only used with 'between')
|
|
166
|
+
* @returns {boolean} True if the media query matches
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* const isMobile = useResponsive('down', 'sm');
|
|
170
|
+
* const isDesktop = useResponsive('up', 'md');
|
|
171
|
+
* const isTablet = useResponsive('between', 'sm', 'md');
|
|
172
|
+
*/
|
|
126
173
|
declare const useResponsive: (query: Query, start?: Value, end?: Value) => ReturnType;
|
|
174
|
+
/**
|
|
175
|
+
* Custom hook that returns the current MUI breakpoint.
|
|
176
|
+
*
|
|
177
|
+
* @returns {Breakpoint} The current breakpoint ('xs' | 'sm' | 'md' | 'lg' | 'xl')
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* const width = useWidth();
|
|
181
|
+
* // Returns 'xs', 'sm', 'md', 'lg', or 'xl' based on viewport
|
|
182
|
+
*/
|
|
127
183
|
declare const useWidth: () => "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
|
|
128
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Custom hook for managing state synchronized with localStorage.
|
|
187
|
+
* Supports both primitive values and objects with field-level updates.
|
|
188
|
+
*
|
|
189
|
+
* @template T - The type of the state value
|
|
190
|
+
* @param {string} key - The localStorage key
|
|
191
|
+
* @param {T} initialState - The initial state value
|
|
192
|
+
* @returns {Object} Object containing:
|
|
193
|
+
* - state: Current state value
|
|
194
|
+
* - setState: Function to update the entire state
|
|
195
|
+
* - setField: Function to update a single field (for objects)
|
|
196
|
+
* - resetState: Function to reset to initial state
|
|
197
|
+
* - canReset: Boolean indicating if state differs from initial
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* const { state, setState, setField } = useLocalStorage('user', { name: '', age: 0 });
|
|
201
|
+
*
|
|
202
|
+
* setField('name', 'John');
|
|
203
|
+
* setState({ name: 'Jane', age: 25 });
|
|
204
|
+
*/
|
|
129
205
|
declare const useLocalStorage: <T>(key: string, initialState: T) => {
|
|
130
206
|
state: T;
|
|
131
207
|
setState: (updateState: SetStateAction<T>) => void;
|
|
@@ -133,10 +209,41 @@ declare const useLocalStorage: <T>(key: string, initialState: T) => {
|
|
|
133
209
|
resetState: () => void;
|
|
134
210
|
canReset: boolean;
|
|
135
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Retrieves a value from localStorage and parses it as JSON.
|
|
214
|
+
*
|
|
215
|
+
* @template T - The expected return type
|
|
216
|
+
* @param {string} key - The localStorage key
|
|
217
|
+
* @returns {T | null} The parsed value or null if not found or error occurs
|
|
218
|
+
*/
|
|
136
219
|
declare const getStorage: <T>(key: string) => T | null;
|
|
220
|
+
/**
|
|
221
|
+
* Stores a value in localStorage as JSON string.
|
|
222
|
+
*
|
|
223
|
+
* @template T - The type of value to store
|
|
224
|
+
* @param {string} key - The localStorage key
|
|
225
|
+
* @param {T} value - The value to store
|
|
226
|
+
*/
|
|
137
227
|
declare const setStorage: <T>(key: string, value: T) => void;
|
|
228
|
+
/**
|
|
229
|
+
* Removes a value from localStorage.
|
|
230
|
+
*
|
|
231
|
+
* @param {string} key - The localStorage key to remove
|
|
232
|
+
*/
|
|
138
233
|
declare const removeStorage: (key: string) => void;
|
|
234
|
+
/**
|
|
235
|
+
* Checks if localStorage is available in the current environment.
|
|
236
|
+
*
|
|
237
|
+
* @returns {boolean} True if localStorage is available, false otherwise
|
|
238
|
+
*/
|
|
139
239
|
declare const LocalStorageAvailable: () => boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Gets an item from localStorage with fallback to default value.
|
|
242
|
+
*
|
|
243
|
+
* @param {string} key - The localStorage key
|
|
244
|
+
* @param {string} [defaultValue=''] - The default value if key doesn't exist
|
|
245
|
+
* @returns {string | undefined} The stored value or default value
|
|
246
|
+
*/
|
|
140
247
|
declare const LocalStorageGetItem: (key: string, defaultValue?: string) => string | undefined;
|
|
141
248
|
|
|
142
249
|
type useEventListenerOptions = {
|
|
@@ -145,8 +252,42 @@ type useEventListenerOptions = {
|
|
|
145
252
|
element?: React.RefObject<HTMLElement>;
|
|
146
253
|
options?: AddEventListenerOptions;
|
|
147
254
|
};
|
|
255
|
+
/**
|
|
256
|
+
* Custom hook for adding event listeners with automatic cleanup.
|
|
257
|
+
* Uses isomorphic layout effect for SSR compatibility.
|
|
258
|
+
*
|
|
259
|
+
* @param {Object} params - Hook parameters
|
|
260
|
+
* @param {string} params.eventName - The name of the event to listen for
|
|
261
|
+
* @param {Function} params.handler - The event handler function
|
|
262
|
+
* @param {React.RefObject<HTMLElement>} [params.element] - Optional element ref (defaults to window)
|
|
263
|
+
* @param {AddEventListenerOptions} [params.options] - Optional event listener options
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
267
|
+
*
|
|
268
|
+
* useEventListener({
|
|
269
|
+
* eventName: 'click',
|
|
270
|
+
* handler: (e) => console.log('Clicked!'),
|
|
271
|
+
* element: ref
|
|
272
|
+
* });
|
|
273
|
+
*/
|
|
148
274
|
declare const useEventListener: ({ eventName, handler, element, options }: useEventListenerOptions) => void;
|
|
149
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Custom hook for copying text to clipboard with status tracking.
|
|
278
|
+
*
|
|
279
|
+
* @returns {Object} Object containing:
|
|
280
|
+
* - copy: Async function to copy text to clipboard
|
|
281
|
+
* - copiedText: The last successfully copied text
|
|
282
|
+
* - isCopied: Boolean indicating if text was recently copied (resets after 2s)
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* const { copy, isCopied } = useCopyToClipboard();
|
|
286
|
+
*
|
|
287
|
+
* <Button onClick={() => copy('Hello World')}>
|
|
288
|
+
* {isCopied ? 'Copied!' : 'Copy'}
|
|
289
|
+
* </Button>
|
|
290
|
+
*/
|
|
150
291
|
declare const useCopyToClipboard: () => {
|
|
151
292
|
copy: (text: string) => Promise<boolean>;
|
|
152
293
|
copiedText: string;
|
|
@@ -1395,6 +1536,7 @@ interface LogoProps extends BoxProps {
|
|
|
1395
1536
|
alt?: string;
|
|
1396
1537
|
}
|
|
1397
1538
|
declare const Logo: ({ sx, isFull, isWhite, isBlack, disableLink, LinkComponent, href, src, alt, ...rest }: LogoProps) => react_jsx_runtime.JSX.Element;
|
|
1539
|
+
declare const AnimatedLogo: () => react_jsx_runtime.JSX.Element;
|
|
1398
1540
|
|
|
1399
1541
|
interface UploadProps extends DropzoneOptions {
|
|
1400
1542
|
error?: boolean;
|
|
@@ -1549,5 +1691,6 @@ interface LoadingScreenProps extends BoxProps {
|
|
|
1549
1691
|
portal?: boolean;
|
|
1550
1692
|
}
|
|
1551
1693
|
declare const LoadingScreen: ({ portal, sx, ...rest }: LoadingScreenProps) => react_jsx_runtime.JSX.Element;
|
|
1694
|
+
declare const SplashScreen: ({ portal, sx, ...rest }: LoadingScreenProps) => react_jsx_runtime.JSX.Element;
|
|
1552
1695
|
|
|
1553
|
-
export { CheckboxDefault, CheckboxIndeterminate, CheckboxSelect, ClipboardCheck, CloudUpload, type ColorSchema, Copy, CopyButton, type CustomShadowOptions, type CustomSpacingOptions, Eye, EyeClosed, Field, Form, Icon, type IconProps, type IconType, InfoCircleFill, InfoCircleOutline, Loader, LoadingScreen, LocalStorageAvailable, LocalStorageGetItem, Logo, LongArrowUpLeftSolid, NavArrowDown, NavArrowLeft, NavArrowRight, RHFAutocomplete, type RHFAutocompleteProps, RHFCheckbox, type RHFCheckboxProps, RHFMultiCheckbox, type RHFMultiCheckboxOption, type RHFMultiCheckboxProps, RHFMultiSwitch, RHFRadioGroup, type RHFRadioGroupProps, RHFSwitch, RHFTextField, RHFUpload, type RHFUploadProps, RadioDefault, RadioSelect, type RadiusOptions, STORAGE_KEY, Search, SettingsConsumer, SettingsContext, type SettingsContextProps, SettingsProvider, type SettingsValueProps, Table, type TableNoRowsProps, TablePagination, ThemeProvider, Trash, Upload, type UploadProps, type UseBooleanReturnType, UserFill, UserOutline, XMark, XMarkSolid, action, background, baseAction, basePalette, bgBlur, bgGradient, border, borderGradient, breakpoints, colorSchemes, common, components, createPaletteChannel, createShadowColor, createTheme, customShadows, customSpacing, darkPalette, defaultSettings, error, fCurrency, fData, fNumber, fPercent, fShortenNumber, getCurrencySymbol, getInitColorSchemeScript, getStorage, grey, hexToRgbChannel, hideScrollX, hideScrollY, icon, iconClasses, info, isEqual, lightPalette, maxLine, mediaQueries, menuItem, neutral, orderBy, paper, paramCase, primary, primaryFont, pxToRem, radius, remToPx, removeStorage, responsiveFontSizes, schemeConfig, secondary, secondaryFont, sentenceCase, setFont, setStorage, shadows, snakeCase, stylesMode, success, surface, tertiaryFont, text, textGradient, typography, updateComponentsWithSettings, updateCoreWithSettings, useBoolean, useCopyToClipboard, useEventListener, useLocalStorage, useResponsive, useSettings, useWidth, varAlpha, warning };
|
|
1696
|
+
export { AnimatedLogo, CheckboxDefault, CheckboxIndeterminate, CheckboxSelect, ClipboardCheck, CloudUpload, type ColorSchema, Copy, CopyButton, type CustomShadowOptions, type CustomSpacingOptions, Eye, EyeClosed, Field, Form, Icon, type IconProps, type IconType, InfoCircleFill, InfoCircleOutline, Loader, LoadingScreen, LocalStorageAvailable, LocalStorageGetItem, Logo, LongArrowUpLeftSolid, NavArrowDown, NavArrowLeft, NavArrowRight, RHFAutocomplete, type RHFAutocompleteProps, RHFCheckbox, type RHFCheckboxProps, RHFMultiCheckbox, type RHFMultiCheckboxOption, type RHFMultiCheckboxProps, RHFMultiSwitch, RHFRadioGroup, type RHFRadioGroupProps, RHFSwitch, RHFTextField, RHFUpload, type RHFUploadProps, RadioDefault, RadioSelect, type RadiusOptions, STORAGE_KEY, Search, SettingsConsumer, SettingsContext, type SettingsContextProps, SettingsProvider, type SettingsValueProps, SplashScreen, Table, type TableNoRowsProps, TablePagination, ThemeProvider, Trash, Upload, type UploadProps, type UseBooleanReturnType, UserFill, UserOutline, XMark, XMarkSolid, action, background, baseAction, basePalette, bgBlur, bgGradient, border, borderGradient, breakpoints, colorSchemes, common, components, createPaletteChannel, createShadowColor, createTheme, customShadows, customSpacing, darkPalette, defaultSettings, error, fCurrency, fData, fNumber, fPercent, fShortenNumber, getCurrencySymbol, getInitColorSchemeScript, getStorage, grey, hexToRgbChannel, hideScrollX, hideScrollY, icon, iconClasses, info, isEqual, lightPalette, maxLine, mediaQueries, menuItem, neutral, orderBy, paper, paramCase, primary, primaryFont, pxToRem, radius, remToPx, removeStorage, responsiveFontSizes, schemeConfig, secondary, secondaryFont, sentenceCase, setFont, setStorage, shadows, snakeCase, stylesMode, success, surface, tertiaryFont, text, textGradient, typography, updateComponentsWithSettings, updateCoreWithSettings, useBoolean, useCopyToClipboard, useEventListener, useLocalStorage, useResponsive, useSettings, useWidth, varAlpha, warning };
|
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,23 @@ interface UseBooleanReturnType {
|
|
|
89
89
|
onToggle: () => void;
|
|
90
90
|
setValue: React.Dispatch<React.SetStateAction<boolean>>;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Custom hook for managing boolean state with helper functions.
|
|
94
|
+
*
|
|
95
|
+
* @param {boolean} [defaultValue=false] - The initial boolean value
|
|
96
|
+
* @returns {UseBooleanReturnType} Object containing:
|
|
97
|
+
* - value: Current boolean state
|
|
98
|
+
* - onTrue: Function to set value to true
|
|
99
|
+
* - onFalse: Function to set value to false
|
|
100
|
+
* - onToggle: Function to toggle the value
|
|
101
|
+
* - setValue: Direct state setter
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* const modal = useBoolean();
|
|
105
|
+
*
|
|
106
|
+
* <Button onClick={modal.onTrue}>Open Modal</Button>
|
|
107
|
+
* <Modal open={modal.value} onClose={modal.onFalse} />
|
|
108
|
+
*/
|
|
92
109
|
declare const useBoolean: (defaultValue?: boolean) => UseBooleanReturnType;
|
|
93
110
|
|
|
94
111
|
declare const STORAGE_KEY = "app-settings";
|
|
@@ -118,14 +135,73 @@ interface SettingsProviderProps {
|
|
|
118
135
|
}
|
|
119
136
|
declare const SettingsProvider: ({ children, settings }: SettingsProviderProps) => react_jsx_runtime.JSX.Element;
|
|
120
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Custom hook for accessing the design system settings context.
|
|
140
|
+
* Must be used within a SettingsProvider.
|
|
141
|
+
*
|
|
142
|
+
* @returns {SettingsContextValue} The settings context value containing:
|
|
143
|
+
* - Current theme settings (colorScheme, contrast, direction, etc.)
|
|
144
|
+
* - Functions to update settings (onUpdate, onUpdateField, onReset)
|
|
145
|
+
*
|
|
146
|
+
* @throws {Error} If used outside of SettingsProvider
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* const { colorScheme, onUpdateField } = useSettings();
|
|
150
|
+
*
|
|
151
|
+
* <Button onClick={() => onUpdateField('colorScheme', 'dark')}>
|
|
152
|
+
* Toggle Dark Mode
|
|
153
|
+
* </Button>
|
|
154
|
+
*/
|
|
121
155
|
declare const useSettings: () => SettingsContextProps;
|
|
122
156
|
|
|
123
157
|
type ReturnType = boolean;
|
|
124
158
|
type Query = 'up' | 'down' | 'between' | 'only';
|
|
125
159
|
type Value = Breakpoint | number;
|
|
160
|
+
/**
|
|
161
|
+
* Custom hook for responsive design with MUI breakpoints.
|
|
162
|
+
*
|
|
163
|
+
* @param {Query} query - The type of breakpoint query ('up' | 'down' | 'between' | 'only')
|
|
164
|
+
* @param {Value} [start] - The starting breakpoint or number
|
|
165
|
+
* @param {Value} [end] - The ending breakpoint (only used with 'between')
|
|
166
|
+
* @returns {boolean} True if the media query matches
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* const isMobile = useResponsive('down', 'sm');
|
|
170
|
+
* const isDesktop = useResponsive('up', 'md');
|
|
171
|
+
* const isTablet = useResponsive('between', 'sm', 'md');
|
|
172
|
+
*/
|
|
126
173
|
declare const useResponsive: (query: Query, start?: Value, end?: Value) => ReturnType;
|
|
174
|
+
/**
|
|
175
|
+
* Custom hook that returns the current MUI breakpoint.
|
|
176
|
+
*
|
|
177
|
+
* @returns {Breakpoint} The current breakpoint ('xs' | 'sm' | 'md' | 'lg' | 'xl')
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* const width = useWidth();
|
|
181
|
+
* // Returns 'xs', 'sm', 'md', 'lg', or 'xl' based on viewport
|
|
182
|
+
*/
|
|
127
183
|
declare const useWidth: () => "sm" | "md" | "lg" | "xs" | "xl" | "2xl";
|
|
128
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Custom hook for managing state synchronized with localStorage.
|
|
187
|
+
* Supports both primitive values and objects with field-level updates.
|
|
188
|
+
*
|
|
189
|
+
* @template T - The type of the state value
|
|
190
|
+
* @param {string} key - The localStorage key
|
|
191
|
+
* @param {T} initialState - The initial state value
|
|
192
|
+
* @returns {Object} Object containing:
|
|
193
|
+
* - state: Current state value
|
|
194
|
+
* - setState: Function to update the entire state
|
|
195
|
+
* - setField: Function to update a single field (for objects)
|
|
196
|
+
* - resetState: Function to reset to initial state
|
|
197
|
+
* - canReset: Boolean indicating if state differs from initial
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* const { state, setState, setField } = useLocalStorage('user', { name: '', age: 0 });
|
|
201
|
+
*
|
|
202
|
+
* setField('name', 'John');
|
|
203
|
+
* setState({ name: 'Jane', age: 25 });
|
|
204
|
+
*/
|
|
129
205
|
declare const useLocalStorage: <T>(key: string, initialState: T) => {
|
|
130
206
|
state: T;
|
|
131
207
|
setState: (updateState: SetStateAction<T>) => void;
|
|
@@ -133,10 +209,41 @@ declare const useLocalStorage: <T>(key: string, initialState: T) => {
|
|
|
133
209
|
resetState: () => void;
|
|
134
210
|
canReset: boolean;
|
|
135
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Retrieves a value from localStorage and parses it as JSON.
|
|
214
|
+
*
|
|
215
|
+
* @template T - The expected return type
|
|
216
|
+
* @param {string} key - The localStorage key
|
|
217
|
+
* @returns {T | null} The parsed value or null if not found or error occurs
|
|
218
|
+
*/
|
|
136
219
|
declare const getStorage: <T>(key: string) => T | null;
|
|
220
|
+
/**
|
|
221
|
+
* Stores a value in localStorage as JSON string.
|
|
222
|
+
*
|
|
223
|
+
* @template T - The type of value to store
|
|
224
|
+
* @param {string} key - The localStorage key
|
|
225
|
+
* @param {T} value - The value to store
|
|
226
|
+
*/
|
|
137
227
|
declare const setStorage: <T>(key: string, value: T) => void;
|
|
228
|
+
/**
|
|
229
|
+
* Removes a value from localStorage.
|
|
230
|
+
*
|
|
231
|
+
* @param {string} key - The localStorage key to remove
|
|
232
|
+
*/
|
|
138
233
|
declare const removeStorage: (key: string) => void;
|
|
234
|
+
/**
|
|
235
|
+
* Checks if localStorage is available in the current environment.
|
|
236
|
+
*
|
|
237
|
+
* @returns {boolean} True if localStorage is available, false otherwise
|
|
238
|
+
*/
|
|
139
239
|
declare const LocalStorageAvailable: () => boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Gets an item from localStorage with fallback to default value.
|
|
242
|
+
*
|
|
243
|
+
* @param {string} key - The localStorage key
|
|
244
|
+
* @param {string} [defaultValue=''] - The default value if key doesn't exist
|
|
245
|
+
* @returns {string | undefined} The stored value or default value
|
|
246
|
+
*/
|
|
140
247
|
declare const LocalStorageGetItem: (key: string, defaultValue?: string) => string | undefined;
|
|
141
248
|
|
|
142
249
|
type useEventListenerOptions = {
|
|
@@ -145,8 +252,42 @@ type useEventListenerOptions = {
|
|
|
145
252
|
element?: React.RefObject<HTMLElement>;
|
|
146
253
|
options?: AddEventListenerOptions;
|
|
147
254
|
};
|
|
255
|
+
/**
|
|
256
|
+
* Custom hook for adding event listeners with automatic cleanup.
|
|
257
|
+
* Uses isomorphic layout effect for SSR compatibility.
|
|
258
|
+
*
|
|
259
|
+
* @param {Object} params - Hook parameters
|
|
260
|
+
* @param {string} params.eventName - The name of the event to listen for
|
|
261
|
+
* @param {Function} params.handler - The event handler function
|
|
262
|
+
* @param {React.RefObject<HTMLElement>} [params.element] - Optional element ref (defaults to window)
|
|
263
|
+
* @param {AddEventListenerOptions} [params.options] - Optional event listener options
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
267
|
+
*
|
|
268
|
+
* useEventListener({
|
|
269
|
+
* eventName: 'click',
|
|
270
|
+
* handler: (e) => console.log('Clicked!'),
|
|
271
|
+
* element: ref
|
|
272
|
+
* });
|
|
273
|
+
*/
|
|
148
274
|
declare const useEventListener: ({ eventName, handler, element, options }: useEventListenerOptions) => void;
|
|
149
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Custom hook for copying text to clipboard with status tracking.
|
|
278
|
+
*
|
|
279
|
+
* @returns {Object} Object containing:
|
|
280
|
+
* - copy: Async function to copy text to clipboard
|
|
281
|
+
* - copiedText: The last successfully copied text
|
|
282
|
+
* - isCopied: Boolean indicating if text was recently copied (resets after 2s)
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* const { copy, isCopied } = useCopyToClipboard();
|
|
286
|
+
*
|
|
287
|
+
* <Button onClick={() => copy('Hello World')}>
|
|
288
|
+
* {isCopied ? 'Copied!' : 'Copy'}
|
|
289
|
+
* </Button>
|
|
290
|
+
*/
|
|
150
291
|
declare const useCopyToClipboard: () => {
|
|
151
292
|
copy: (text: string) => Promise<boolean>;
|
|
152
293
|
copiedText: string;
|
|
@@ -1395,6 +1536,7 @@ interface LogoProps extends BoxProps {
|
|
|
1395
1536
|
alt?: string;
|
|
1396
1537
|
}
|
|
1397
1538
|
declare const Logo: ({ sx, isFull, isWhite, isBlack, disableLink, LinkComponent, href, src, alt, ...rest }: LogoProps) => react_jsx_runtime.JSX.Element;
|
|
1539
|
+
declare const AnimatedLogo: () => react_jsx_runtime.JSX.Element;
|
|
1398
1540
|
|
|
1399
1541
|
interface UploadProps extends DropzoneOptions {
|
|
1400
1542
|
error?: boolean;
|
|
@@ -1549,5 +1691,6 @@ interface LoadingScreenProps extends BoxProps {
|
|
|
1549
1691
|
portal?: boolean;
|
|
1550
1692
|
}
|
|
1551
1693
|
declare const LoadingScreen: ({ portal, sx, ...rest }: LoadingScreenProps) => react_jsx_runtime.JSX.Element;
|
|
1694
|
+
declare const SplashScreen: ({ portal, sx, ...rest }: LoadingScreenProps) => react_jsx_runtime.JSX.Element;
|
|
1552
1695
|
|
|
1553
|
-
export { CheckboxDefault, CheckboxIndeterminate, CheckboxSelect, ClipboardCheck, CloudUpload, type ColorSchema, Copy, CopyButton, type CustomShadowOptions, type CustomSpacingOptions, Eye, EyeClosed, Field, Form, Icon, type IconProps, type IconType, InfoCircleFill, InfoCircleOutline, Loader, LoadingScreen, LocalStorageAvailable, LocalStorageGetItem, Logo, LongArrowUpLeftSolid, NavArrowDown, NavArrowLeft, NavArrowRight, RHFAutocomplete, type RHFAutocompleteProps, RHFCheckbox, type RHFCheckboxProps, RHFMultiCheckbox, type RHFMultiCheckboxOption, type RHFMultiCheckboxProps, RHFMultiSwitch, RHFRadioGroup, type RHFRadioGroupProps, RHFSwitch, RHFTextField, RHFUpload, type RHFUploadProps, RadioDefault, RadioSelect, type RadiusOptions, STORAGE_KEY, Search, SettingsConsumer, SettingsContext, type SettingsContextProps, SettingsProvider, type SettingsValueProps, Table, type TableNoRowsProps, TablePagination, ThemeProvider, Trash, Upload, type UploadProps, type UseBooleanReturnType, UserFill, UserOutline, XMark, XMarkSolid, action, background, baseAction, basePalette, bgBlur, bgGradient, border, borderGradient, breakpoints, colorSchemes, common, components, createPaletteChannel, createShadowColor, createTheme, customShadows, customSpacing, darkPalette, defaultSettings, error, fCurrency, fData, fNumber, fPercent, fShortenNumber, getCurrencySymbol, getInitColorSchemeScript, getStorage, grey, hexToRgbChannel, hideScrollX, hideScrollY, icon, iconClasses, info, isEqual, lightPalette, maxLine, mediaQueries, menuItem, neutral, orderBy, paper, paramCase, primary, primaryFont, pxToRem, radius, remToPx, removeStorage, responsiveFontSizes, schemeConfig, secondary, secondaryFont, sentenceCase, setFont, setStorage, shadows, snakeCase, stylesMode, success, surface, tertiaryFont, text, textGradient, typography, updateComponentsWithSettings, updateCoreWithSettings, useBoolean, useCopyToClipboard, useEventListener, useLocalStorage, useResponsive, useSettings, useWidth, varAlpha, warning };
|
|
1696
|
+
export { AnimatedLogo, CheckboxDefault, CheckboxIndeterminate, CheckboxSelect, ClipboardCheck, CloudUpload, type ColorSchema, Copy, CopyButton, type CustomShadowOptions, type CustomSpacingOptions, Eye, EyeClosed, Field, Form, Icon, type IconProps, type IconType, InfoCircleFill, InfoCircleOutline, Loader, LoadingScreen, LocalStorageAvailable, LocalStorageGetItem, Logo, LongArrowUpLeftSolid, NavArrowDown, NavArrowLeft, NavArrowRight, RHFAutocomplete, type RHFAutocompleteProps, RHFCheckbox, type RHFCheckboxProps, RHFMultiCheckbox, type RHFMultiCheckboxOption, type RHFMultiCheckboxProps, RHFMultiSwitch, RHFRadioGroup, type RHFRadioGroupProps, RHFSwitch, RHFTextField, RHFUpload, type RHFUploadProps, RadioDefault, RadioSelect, type RadiusOptions, STORAGE_KEY, Search, SettingsConsumer, SettingsContext, type SettingsContextProps, SettingsProvider, type SettingsValueProps, SplashScreen, Table, type TableNoRowsProps, TablePagination, ThemeProvider, Trash, Upload, type UploadProps, type UseBooleanReturnType, UserFill, UserOutline, XMark, XMarkSolid, action, background, baseAction, basePalette, bgBlur, bgGradient, border, borderGradient, breakpoints, colorSchemes, common, components, createPaletteChannel, createShadowColor, createTheme, customShadows, customSpacing, darkPalette, defaultSettings, error, fCurrency, fData, fNumber, fPercent, fShortenNumber, getCurrencySymbol, getInitColorSchemeScript, getStorage, grey, hexToRgbChannel, hideScrollX, hideScrollY, icon, iconClasses, info, isEqual, lightPalette, maxLine, mediaQueries, menuItem, neutral, orderBy, paper, paramCase, primary, primaryFont, pxToRem, radius, remToPx, removeStorage, responsiveFontSizes, schemeConfig, secondary, secondaryFont, sentenceCase, setFont, setStorage, shadows, snakeCase, stylesMode, success, surface, tertiaryFont, text, textGradient, typography, updateComponentsWithSettings, updateCoreWithSettings, useBoolean, useCopyToClipboard, useEventListener, useLocalStorage, useResponsive, useSettings, useWidth, varAlpha, warning };
|