@trackunit/react-components 0.1.179 → 0.1.181
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/index.cjs.js +17 -0
- package/index.esm.js +17 -1
- package/package.json +1 -1
- package/src/hooks/index.d.ts +1 -0
- package/src/hooks/localStorage/types.d.ts +4 -4
- package/src/hooks/useIsFullScreen.d.ts +4 -0
package/index.cjs.js
CHANGED
|
@@ -39194,6 +39194,22 @@ const useIsFirstRender = () => {
|
|
|
39194
39194
|
return renderRef.current;
|
|
39195
39195
|
};
|
|
39196
39196
|
|
|
39197
|
+
/**
|
|
39198
|
+
* Custom hook for checking if the browser is in fullscreen mode.
|
|
39199
|
+
*/
|
|
39200
|
+
const useIsFullscreen = () => {
|
|
39201
|
+
const [isFullScreen, setIsFullScreen] = React.useState(false);
|
|
39202
|
+
document.addEventListener("fullscreenchange", () => {
|
|
39203
|
+
if (document.fullscreenElement) {
|
|
39204
|
+
setIsFullScreen(true);
|
|
39205
|
+
}
|
|
39206
|
+
else {
|
|
39207
|
+
setIsFullScreen(false);
|
|
39208
|
+
}
|
|
39209
|
+
});
|
|
39210
|
+
return isFullScreen;
|
|
39211
|
+
};
|
|
39212
|
+
|
|
39197
39213
|
/**
|
|
39198
39214
|
* Check if text is cut off.
|
|
39199
39215
|
*
|
|
@@ -39338,6 +39354,7 @@ exports.useDebounce = useDebounce;
|
|
|
39338
39354
|
exports.useDevicePixelRatio = useDevicePixelRatio;
|
|
39339
39355
|
exports.useHover = useHover;
|
|
39340
39356
|
exports.useIsFirstRender = useIsFirstRender;
|
|
39357
|
+
exports.useIsFullscreen = useIsFullscreen;
|
|
39341
39358
|
exports.useIsTextCutOff = useIsTextCutOff;
|
|
39342
39359
|
exports.useLocalStorage = useLocalStorage;
|
|
39343
39360
|
exports.useLocalStorageReducer = useLocalStorageReducer;
|
package/index.esm.js
CHANGED
|
@@ -39165,6 +39165,22 @@ const useIsFirstRender = () => {
|
|
|
39165
39165
|
return renderRef.current;
|
|
39166
39166
|
};
|
|
39167
39167
|
|
|
39168
|
+
/**
|
|
39169
|
+
* Custom hook for checking if the browser is in fullscreen mode.
|
|
39170
|
+
*/
|
|
39171
|
+
const useIsFullscreen = () => {
|
|
39172
|
+
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
39173
|
+
document.addEventListener("fullscreenchange", () => {
|
|
39174
|
+
if (document.fullscreenElement) {
|
|
39175
|
+
setIsFullScreen(true);
|
|
39176
|
+
}
|
|
39177
|
+
else {
|
|
39178
|
+
setIsFullScreen(false);
|
|
39179
|
+
}
|
|
39180
|
+
});
|
|
39181
|
+
return isFullScreen;
|
|
39182
|
+
};
|
|
39183
|
+
|
|
39168
39184
|
/**
|
|
39169
39185
|
* Check if text is cut off.
|
|
39170
39186
|
*
|
|
@@ -39236,4 +39252,4 @@ const useVisibilityChange = ({ onChange, targetState }) => {
|
|
|
39236
39252
|
}, [onChange, targetState]);
|
|
39237
39253
|
};
|
|
39238
39254
|
|
|
39239
|
-
export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PackageNameStoryComponent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, WidgetBody, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };
|
|
39255
|
+
export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PackageNameStoryComponent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, WidgetBody, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };
|
package/package.json
CHANGED
package/src/hooks/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./useDebounce";
|
|
|
7
7
|
export * from "./useDevicePixelRatio";
|
|
8
8
|
export * from "./useHover";
|
|
9
9
|
export * from "./useIsFirstRender";
|
|
10
|
+
export * from "./useIsFullScreen";
|
|
10
11
|
export * from "./useIsTextCutOff";
|
|
11
12
|
export * from "./useResize";
|
|
12
13
|
export * from "./useTimeout";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface LocalStorageParams<
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export interface LocalStorageParams<TState> {
|
|
3
3
|
/**
|
|
4
4
|
* The key used to store the value in local storage.
|
|
5
5
|
*/
|
|
@@ -7,11 +7,11 @@ export interface LocalStorageParams<State> {
|
|
|
7
7
|
/**
|
|
8
8
|
* The default state value.
|
|
9
9
|
*/
|
|
10
|
-
defaultState:
|
|
10
|
+
defaultState: TState;
|
|
11
11
|
/**
|
|
12
12
|
* Optional schema for validating the state.
|
|
13
13
|
*/
|
|
14
|
-
schema?:
|
|
14
|
+
schema?: z.Schema<TState>;
|
|
15
15
|
}
|
|
16
16
|
export interface LocalStorageCallbacks {
|
|
17
17
|
/**
|