@undefine-ui/design-system 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.cjs +87 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -2
- package/dist/index.d.ts +53 -2
- package/dist/index.js +63 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
import { SetStateAction, ElementType } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { Breakpoint, Shadows, Components, Theme, SxProps as SxProps$1 } from '@mui/material/styles';
|
|
5
5
|
import * as _mui_material from '@mui/material';
|
|
6
6
|
import { SxProps, Theme as Theme$1 } from '@mui/material';
|
|
@@ -82,6 +82,13 @@ declare const fShortenNumber: (inputValue: unknown, locale?: string, options?: F
|
|
|
82
82
|
*/
|
|
83
83
|
declare const fData: (inputValue: unknown) => string;
|
|
84
84
|
|
|
85
|
+
declare const getInitials: (name: string) => string;
|
|
86
|
+
declare const splitFullname: (name: string) => {
|
|
87
|
+
firstname: string;
|
|
88
|
+
lastname: string;
|
|
89
|
+
};
|
|
90
|
+
declare const formatFullname: (firstname: string, lastname: string) => string;
|
|
91
|
+
|
|
85
92
|
interface UseBooleanReturnType {
|
|
86
93
|
value: boolean;
|
|
87
94
|
onTrue: () => void;
|
|
@@ -108,6 +115,50 @@ interface UseBooleanReturnType {
|
|
|
108
115
|
*/
|
|
109
116
|
declare const useBoolean: (defaultValue?: boolean) => UseBooleanReturnType;
|
|
110
117
|
|
|
118
|
+
/**
|
|
119
|
+
* A custom hook for managing popover state and interactions.
|
|
120
|
+
*
|
|
121
|
+
* Provides utilities to control the open/close state of a popover component,
|
|
122
|
+
* track the anchor element, and handle user interactions.
|
|
123
|
+
*
|
|
124
|
+
* @returns An object containing:
|
|
125
|
+
* - `open` (boolean): Whether the popover is currently open
|
|
126
|
+
* - `anchorEl` (HTMLElement | null): The element the popover is anchored to
|
|
127
|
+
* - `onOpen` (function): Handler to open the popover on a mouse event
|
|
128
|
+
* - `onClose` (function): Handler to close the popover
|
|
129
|
+
* - `setAnchorEl` (function): Direct setter for the anchor element
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```tsx
|
|
133
|
+
* function MyComponent() {
|
|
134
|
+
* const popover = usePopover();
|
|
135
|
+
*
|
|
136
|
+
* return (
|
|
137
|
+
* <>
|
|
138
|
+
* <Button onClick={popover.onOpen}>
|
|
139
|
+
* Open Menu
|
|
140
|
+
* </Button>
|
|
141
|
+
* <Popover
|
|
142
|
+
* open={popover.open}
|
|
143
|
+
* anchorEl={popover.anchorEl}
|
|
144
|
+
* onClose={popover.onClose}
|
|
145
|
+
* >
|
|
146
|
+
* <MenuItem onClick={popover.onClose}>Option 1</MenuItem>
|
|
147
|
+
* <MenuItem onClick={popover.onClose}>Option 2</MenuItem>
|
|
148
|
+
* </Popover>
|
|
149
|
+
* </>
|
|
150
|
+
* );
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
declare const usePopover: () => {
|
|
155
|
+
open: boolean;
|
|
156
|
+
anchorEl: HTMLElement | null;
|
|
157
|
+
onOpen: (event: React.MouseEvent<HTMLElement>) => void;
|
|
158
|
+
onClose: () => void;
|
|
159
|
+
setAnchorEl: react.Dispatch<react.SetStateAction<HTMLElement | null>>;
|
|
160
|
+
};
|
|
161
|
+
|
|
111
162
|
declare const STORAGE_KEY = "app-settings";
|
|
112
163
|
type SettingsValueProps = {
|
|
113
164
|
colorScheme: 'light' | 'dark';
|
|
@@ -1752,4 +1803,4 @@ interface LoadingScreenProps extends BoxProps {
|
|
|
1752
1803
|
declare const LoadingScreen: ({ portal, sx, ...rest }: LoadingScreenProps) => react_jsx_runtime.JSX.Element;
|
|
1753
1804
|
declare const SplashScreen: ({ portal, sx, ...rest }: LoadingScreenProps) => react_jsx_runtime.JSX.Element;
|
|
1754
1805
|
|
|
1755
|
-
export { AnimatedLogo, BellNotification, CheckboxDefault, CheckboxIndeterminate, CheckboxSelect, ClipboardCheck, CloudUpload, type ColorSchema, Copy, CopyButton, type CustomShadowOptions, type CustomSpacingOptions, Eye, EyeClosed, Field, Form, Icon, type IconProps, type IconType, InfoCircleFill, InfoCircleOutline, KeyCommand, 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, Settings, SettingsConsumer, SettingsContext, type SettingsContextProps, SettingsProvider, type SettingsValueProps, SplashScreen, Table, type TableNoRowsProps, TablePagination, ThemeProvider, Trash, Upload, type UploadProps, type UseBooleanReturnType, type UseSetStateReturnType, 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, useScrollOffSetTop, useSetState, useSettings, useWidth, varAlpha, warning };
|
|
1806
|
+
export { AnimatedLogo, BellNotification, CheckboxDefault, CheckboxIndeterminate, CheckboxSelect, ClipboardCheck, CloudUpload, type ColorSchema, Copy, CopyButton, type CustomShadowOptions, type CustomSpacingOptions, Eye, EyeClosed, Field, Form, Icon, type IconProps, type IconType, InfoCircleFill, InfoCircleOutline, KeyCommand, 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, Settings, SettingsConsumer, SettingsContext, type SettingsContextProps, SettingsProvider, type SettingsValueProps, SplashScreen, Table, type TableNoRowsProps, TablePagination, ThemeProvider, Trash, Upload, type UploadProps, type UseBooleanReturnType, type UseSetStateReturnType, 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, formatFullname, getCurrencySymbol, getInitColorSchemeScript, getInitials, 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, splitFullname, stylesMode, success, surface, tertiaryFont, text, textGradient, typography, updateComponentsWithSettings, updateCoreWithSettings, useBoolean, useCopyToClipboard, useEventListener, useLocalStorage, usePopover, useResponsive, useScrollOffSetTop, useSetState, useSettings, useWidth, varAlpha, warning };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
import { SetStateAction, ElementType } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { Breakpoint, Shadows, Components, Theme, SxProps as SxProps$1 } from '@mui/material/styles';
|
|
5
5
|
import * as _mui_material from '@mui/material';
|
|
6
6
|
import { SxProps, Theme as Theme$1 } from '@mui/material';
|
|
@@ -82,6 +82,13 @@ declare const fShortenNumber: (inputValue: unknown, locale?: string, options?: F
|
|
|
82
82
|
*/
|
|
83
83
|
declare const fData: (inputValue: unknown) => string;
|
|
84
84
|
|
|
85
|
+
declare const getInitials: (name: string) => string;
|
|
86
|
+
declare const splitFullname: (name: string) => {
|
|
87
|
+
firstname: string;
|
|
88
|
+
lastname: string;
|
|
89
|
+
};
|
|
90
|
+
declare const formatFullname: (firstname: string, lastname: string) => string;
|
|
91
|
+
|
|
85
92
|
interface UseBooleanReturnType {
|
|
86
93
|
value: boolean;
|
|
87
94
|
onTrue: () => void;
|
|
@@ -108,6 +115,50 @@ interface UseBooleanReturnType {
|
|
|
108
115
|
*/
|
|
109
116
|
declare const useBoolean: (defaultValue?: boolean) => UseBooleanReturnType;
|
|
110
117
|
|
|
118
|
+
/**
|
|
119
|
+
* A custom hook for managing popover state and interactions.
|
|
120
|
+
*
|
|
121
|
+
* Provides utilities to control the open/close state of a popover component,
|
|
122
|
+
* track the anchor element, and handle user interactions.
|
|
123
|
+
*
|
|
124
|
+
* @returns An object containing:
|
|
125
|
+
* - `open` (boolean): Whether the popover is currently open
|
|
126
|
+
* - `anchorEl` (HTMLElement | null): The element the popover is anchored to
|
|
127
|
+
* - `onOpen` (function): Handler to open the popover on a mouse event
|
|
128
|
+
* - `onClose` (function): Handler to close the popover
|
|
129
|
+
* - `setAnchorEl` (function): Direct setter for the anchor element
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```tsx
|
|
133
|
+
* function MyComponent() {
|
|
134
|
+
* const popover = usePopover();
|
|
135
|
+
*
|
|
136
|
+
* return (
|
|
137
|
+
* <>
|
|
138
|
+
* <Button onClick={popover.onOpen}>
|
|
139
|
+
* Open Menu
|
|
140
|
+
* </Button>
|
|
141
|
+
* <Popover
|
|
142
|
+
* open={popover.open}
|
|
143
|
+
* anchorEl={popover.anchorEl}
|
|
144
|
+
* onClose={popover.onClose}
|
|
145
|
+
* >
|
|
146
|
+
* <MenuItem onClick={popover.onClose}>Option 1</MenuItem>
|
|
147
|
+
* <MenuItem onClick={popover.onClose}>Option 2</MenuItem>
|
|
148
|
+
* </Popover>
|
|
149
|
+
* </>
|
|
150
|
+
* );
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
declare const usePopover: () => {
|
|
155
|
+
open: boolean;
|
|
156
|
+
anchorEl: HTMLElement | null;
|
|
157
|
+
onOpen: (event: React.MouseEvent<HTMLElement>) => void;
|
|
158
|
+
onClose: () => void;
|
|
159
|
+
setAnchorEl: react.Dispatch<react.SetStateAction<HTMLElement | null>>;
|
|
160
|
+
};
|
|
161
|
+
|
|
111
162
|
declare const STORAGE_KEY = "app-settings";
|
|
112
163
|
type SettingsValueProps = {
|
|
113
164
|
colorScheme: 'light' | 'dark';
|
|
@@ -1752,4 +1803,4 @@ interface LoadingScreenProps extends BoxProps {
|
|
|
1752
1803
|
declare const LoadingScreen: ({ portal, sx, ...rest }: LoadingScreenProps) => react_jsx_runtime.JSX.Element;
|
|
1753
1804
|
declare const SplashScreen: ({ portal, sx, ...rest }: LoadingScreenProps) => react_jsx_runtime.JSX.Element;
|
|
1754
1805
|
|
|
1755
|
-
export { AnimatedLogo, BellNotification, CheckboxDefault, CheckboxIndeterminate, CheckboxSelect, ClipboardCheck, CloudUpload, type ColorSchema, Copy, CopyButton, type CustomShadowOptions, type CustomSpacingOptions, Eye, EyeClosed, Field, Form, Icon, type IconProps, type IconType, InfoCircleFill, InfoCircleOutline, KeyCommand, 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, Settings, SettingsConsumer, SettingsContext, type SettingsContextProps, SettingsProvider, type SettingsValueProps, SplashScreen, Table, type TableNoRowsProps, TablePagination, ThemeProvider, Trash, Upload, type UploadProps, type UseBooleanReturnType, type UseSetStateReturnType, 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, useScrollOffSetTop, useSetState, useSettings, useWidth, varAlpha, warning };
|
|
1806
|
+
export { AnimatedLogo, BellNotification, CheckboxDefault, CheckboxIndeterminate, CheckboxSelect, ClipboardCheck, CloudUpload, type ColorSchema, Copy, CopyButton, type CustomShadowOptions, type CustomSpacingOptions, Eye, EyeClosed, Field, Form, Icon, type IconProps, type IconType, InfoCircleFill, InfoCircleOutline, KeyCommand, 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, Settings, SettingsConsumer, SettingsContext, type SettingsContextProps, SettingsProvider, type SettingsValueProps, SplashScreen, Table, type TableNoRowsProps, TablePagination, ThemeProvider, Trash, Upload, type UploadProps, type UseBooleanReturnType, type UseSetStateReturnType, 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, formatFullname, getCurrencySymbol, getInitColorSchemeScript, getInitials, 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, splitFullname, stylesMode, success, surface, tertiaryFont, text, textGradient, typography, updateComponentsWithSettings, updateCoreWithSettings, useBoolean, useCopyToClipboard, useEventListener, useLocalStorage, usePopover, useResponsive, useScrollOffSetTop, useSetState, useSettings, useWidth, varAlpha, warning };
|
package/dist/index.js
CHANGED
|
@@ -133,6 +133,25 @@ var fData = (inputValue) => {
|
|
|
133
133
|
return fm;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
+
// src/libs/fullname-utils.ts
|
|
137
|
+
var getInitials = (name) => {
|
|
138
|
+
const names = name?.split(" ");
|
|
139
|
+
const initials = names?.map((n) => n.charAt(0)?.toUpperCase())?.join("");
|
|
140
|
+
return initials;
|
|
141
|
+
};
|
|
142
|
+
var splitFullname = (name) => {
|
|
143
|
+
if (!name) {
|
|
144
|
+
return { firstname: "", lastname: "" };
|
|
145
|
+
}
|
|
146
|
+
const names = name.split(" ");
|
|
147
|
+
const firstname = names[0];
|
|
148
|
+
const lastname = names[names.length - 1];
|
|
149
|
+
return { firstname, lastname };
|
|
150
|
+
};
|
|
151
|
+
var formatFullname = (firstname, lastname) => {
|
|
152
|
+
return `${firstname} ${lastname}`;
|
|
153
|
+
};
|
|
154
|
+
|
|
136
155
|
// src/hooks/useBoolean.ts
|
|
137
156
|
import { useMemo, useState, useCallback } from "react";
|
|
138
157
|
var useBoolean = (defaultValue) => {
|
|
@@ -159,6 +178,25 @@ var useBoolean = (defaultValue) => {
|
|
|
159
178
|
return memoizedValue;
|
|
160
179
|
};
|
|
161
180
|
|
|
181
|
+
// src/hooks/usePopover.ts
|
|
182
|
+
import { useState as useState2, useCallback as useCallback2 } from "react";
|
|
183
|
+
var usePopover = () => {
|
|
184
|
+
const [anchorEl, setAnchorEl] = useState2(null);
|
|
185
|
+
const onOpen = useCallback2((event) => {
|
|
186
|
+
setAnchorEl(event.currentTarget);
|
|
187
|
+
}, []);
|
|
188
|
+
const onClose = useCallback2(() => {
|
|
189
|
+
setAnchorEl(null);
|
|
190
|
+
}, []);
|
|
191
|
+
return {
|
|
192
|
+
open: !!anchorEl,
|
|
193
|
+
anchorEl,
|
|
194
|
+
onOpen,
|
|
195
|
+
onClose,
|
|
196
|
+
setAnchorEl
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
|
|
162
200
|
// src/hooks/useSettings.ts
|
|
163
201
|
import { useContext } from "react";
|
|
164
202
|
|
|
@@ -406,12 +444,12 @@ var defaultSettings = {
|
|
|
406
444
|
};
|
|
407
445
|
|
|
408
446
|
// src/contexts/settings/context.tsx
|
|
409
|
-
import { useMemo as useMemo3, useState as
|
|
447
|
+
import { useMemo as useMemo3, useState as useState4, useCallback as useCallback4, createContext } from "react";
|
|
410
448
|
|
|
411
449
|
// src/hooks/useLocalStorage.ts
|
|
412
|
-
import { useMemo as useMemo2, useState as
|
|
450
|
+
import { useMemo as useMemo2, useState as useState3, useEffect, useCallback as useCallback3 } from "react";
|
|
413
451
|
var useLocalStorage = (key, initialState) => {
|
|
414
|
-
const [state, set] =
|
|
452
|
+
const [state, set] = useState3(initialState);
|
|
415
453
|
const multiValue = initialState && typeof initialState === "object";
|
|
416
454
|
const canReset = !isEqual(state, initialState);
|
|
417
455
|
useEffect(() => {
|
|
@@ -424,7 +462,7 @@ var useLocalStorage = (key, initialState) => {
|
|
|
424
462
|
}
|
|
425
463
|
}
|
|
426
464
|
}, [key, multiValue]);
|
|
427
|
-
const setState =
|
|
465
|
+
const setState = useCallback3(
|
|
428
466
|
(updateState) => {
|
|
429
467
|
if (multiValue) {
|
|
430
468
|
set((prevValue) => {
|
|
@@ -438,7 +476,7 @@ var useLocalStorage = (key, initialState) => {
|
|
|
438
476
|
},
|
|
439
477
|
[key, multiValue]
|
|
440
478
|
);
|
|
441
|
-
const setField =
|
|
479
|
+
const setField = useCallback3(
|
|
442
480
|
(name, updateValue) => {
|
|
443
481
|
if (multiValue) {
|
|
444
482
|
setState({ [name]: updateValue });
|
|
@@ -446,7 +484,7 @@ var useLocalStorage = (key, initialState) => {
|
|
|
446
484
|
},
|
|
447
485
|
[multiValue, setState]
|
|
448
486
|
);
|
|
449
|
-
const resetState =
|
|
487
|
+
const resetState = useCallback3(() => {
|
|
450
488
|
set(initialState);
|
|
451
489
|
removeStorage(key);
|
|
452
490
|
}, [initialState, key]);
|
|
@@ -515,11 +553,11 @@ var SettingsConsumer = SettingsContext.Consumer;
|
|
|
515
553
|
var SettingsProvider = ({ children, settings }) => {
|
|
516
554
|
const localStorage2 = useLocalStorage(STORAGE_KEY, settings);
|
|
517
555
|
const values = localStorage2;
|
|
518
|
-
const [openDrawer, setOpenDrawer] =
|
|
519
|
-
const onToggleDrawer =
|
|
556
|
+
const [openDrawer, setOpenDrawer] = useState4(false);
|
|
557
|
+
const onToggleDrawer = useCallback4(() => {
|
|
520
558
|
setOpenDrawer((prev) => !prev);
|
|
521
559
|
}, []);
|
|
522
|
-
const onCloseDrawer =
|
|
560
|
+
const onCloseDrawer = useCallback4(() => {
|
|
523
561
|
setOpenDrawer(false);
|
|
524
562
|
}, []);
|
|
525
563
|
const memoizedValue = useMemo3(
|
|
@@ -555,20 +593,20 @@ var useSettings = () => {
|
|
|
555
593
|
};
|
|
556
594
|
|
|
557
595
|
// src/hooks/useSetState.ts
|
|
558
|
-
import { useMemo as useMemo4, useState as
|
|
596
|
+
import { useMemo as useMemo4, useState as useState5, useCallback as useCallback5 } from "react";
|
|
559
597
|
var useSetState = (initialState) => {
|
|
560
|
-
const [state, set] =
|
|
598
|
+
const [state, set] = useState5(initialState);
|
|
561
599
|
const canReset = !isEqual(state, initialState);
|
|
562
|
-
const setState =
|
|
600
|
+
const setState = useCallback5((updateState) => {
|
|
563
601
|
set((prevValue) => ({ ...prevValue, ...updateState }));
|
|
564
602
|
}, []);
|
|
565
|
-
const setField =
|
|
603
|
+
const setField = useCallback5(
|
|
566
604
|
(name, updateValue) => {
|
|
567
605
|
setState({ [name]: updateValue });
|
|
568
606
|
},
|
|
569
607
|
[setState]
|
|
570
608
|
);
|
|
571
|
-
const onResetState =
|
|
609
|
+
const onResetState = useCallback5(() => {
|
|
572
610
|
set(initialState);
|
|
573
611
|
}, [initialState]);
|
|
574
612
|
const memoizedValue = useMemo4(
|
|
@@ -644,11 +682,11 @@ var useEventListener = ({
|
|
|
644
682
|
};
|
|
645
683
|
|
|
646
684
|
// src/hooks/useCopyToClipboard.ts
|
|
647
|
-
import { useMemo as useMemo6, useState as
|
|
685
|
+
import { useMemo as useMemo6, useState as useState6, useCallback as useCallback6 } from "react";
|
|
648
686
|
var useCopyToClipboard = () => {
|
|
649
|
-
const [copiedText, setCopiedText] =
|
|
650
|
-
const [isCopied, setIsCopied] =
|
|
651
|
-
const copy =
|
|
687
|
+
const [copiedText, setCopiedText] = useState6("");
|
|
688
|
+
const [isCopied, setIsCopied] = useState6(false);
|
|
689
|
+
const copy = useCallback6(
|
|
652
690
|
async (text2) => {
|
|
653
691
|
if (!navigator?.clipboard) {
|
|
654
692
|
console.warn("Clipboard not supported");
|
|
@@ -676,11 +714,11 @@ var useCopyToClipboard = () => {
|
|
|
676
714
|
};
|
|
677
715
|
|
|
678
716
|
// src/hooks/useScrollOffsetTop.ts
|
|
679
|
-
import { useRef as useRef2, useMemo as useMemo7, useState as
|
|
717
|
+
import { useRef as useRef2, useMemo as useMemo7, useState as useState7, useEffect as useEffect3, useCallback as useCallback7 } from "react";
|
|
680
718
|
var useScrollOffSetTop = (top = 0) => {
|
|
681
719
|
const elementRef = useRef2(null);
|
|
682
|
-
const [offsetTop, setOffsetTop] =
|
|
683
|
-
const handleScrollChange =
|
|
720
|
+
const [offsetTop, setOffsetTop] = useState7(false);
|
|
721
|
+
const handleScrollChange = useCallback7(() => {
|
|
684
722
|
const scrollHeight = Math.round(window.scrollY);
|
|
685
723
|
if (elementRef?.current) {
|
|
686
724
|
const rect = elementRef.current.getBoundingClientRect();
|
|
@@ -7127,8 +7165,10 @@ export {
|
|
|
7127
7165
|
fNumber,
|
|
7128
7166
|
fPercent,
|
|
7129
7167
|
fShortenNumber,
|
|
7168
|
+
formatFullname,
|
|
7130
7169
|
getCurrencySymbol,
|
|
7131
7170
|
getInitColorSchemeScript,
|
|
7171
|
+
getInitials,
|
|
7132
7172
|
getStorage,
|
|
7133
7173
|
grey,
|
|
7134
7174
|
hexToRgbChannel,
|
|
@@ -7161,6 +7201,7 @@ export {
|
|
|
7161
7201
|
setStorage,
|
|
7162
7202
|
shadows,
|
|
7163
7203
|
snakeCase,
|
|
7204
|
+
splitFullname,
|
|
7164
7205
|
stylesMode,
|
|
7165
7206
|
success,
|
|
7166
7207
|
surface,
|
|
@@ -7174,6 +7215,7 @@ export {
|
|
|
7174
7215
|
useCopyToClipboard,
|
|
7175
7216
|
useEventListener,
|
|
7176
7217
|
useLocalStorage,
|
|
7218
|
+
usePopover,
|
|
7177
7219
|
useResponsive,
|
|
7178
7220
|
useScrollOffSetTop,
|
|
7179
7221
|
useSetState,
|