@trackunit/react-components 1.0.4 → 1.0.5

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 CHANGED
@@ -1135,6 +1135,18 @@ function getDevicePixelRatio(options) {
1135
1135
  return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
1136
1136
  }
1137
1137
 
1138
+ /**
1139
+ * Use this hook if you want to optionally elevate the state of a component.
1140
+ * Useful when you want to optionally be able to control the state of a component
1141
+ * from a parent componentbut keep the simplicity of not having to.
1142
+ *
1143
+ * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
1144
+ */
1145
+ const useElevatedState = (initialState, customState) => {
1146
+ const fallbackState = React.useState(initialState);
1147
+ return customState !== null && customState !== void 0 ? customState : fallbackState;
1148
+ };
1149
+
1138
1150
  /**
1139
1151
  * Custom hook to get the geometry of an element.
1140
1152
  * Size and position of the element relative to the viewport.
@@ -1251,18 +1263,6 @@ const useIsTextCutOff = (element) => {
1251
1263
  return isTextCutOff;
1252
1264
  };
1253
1265
 
1254
- /**
1255
- * Use this hook if you want to optionally elevate the state of a component.
1256
- * Useful when you want to optionally be able to control the state of a component
1257
- * from a parent componentbut keep the simplicity of not having to.
1258
- *
1259
- * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
1260
- */
1261
- const useOptionallyElevatedState = (initialState, customState) => {
1262
- const fallbackState = React.useState(initialState);
1263
- return customState !== null && customState !== void 0 ? customState : fallbackState;
1264
- };
1265
-
1266
1266
  /**
1267
1267
  * Custom hook to handle window resize events and provide the current window size.
1268
1268
  *
@@ -4965,12 +4965,12 @@ exports.useContainerBreakpoints = useContainerBreakpoints;
4965
4965
  exports.useContinuousTimeout = useContinuousTimeout;
4966
4966
  exports.useDebounce = useDebounce;
4967
4967
  exports.useDevicePixelRatio = useDevicePixelRatio;
4968
+ exports.useElevatedState = useElevatedState;
4968
4969
  exports.useGeometry = useGeometry;
4969
4970
  exports.useHover = useHover;
4970
4971
  exports.useIsFirstRender = useIsFirstRender;
4971
4972
  exports.useIsFullscreen = useIsFullscreen;
4972
4973
  exports.useIsTextCutOff = useIsTextCutOff;
4973
- exports.useOptionallyElevatedState = useOptionallyElevatedState;
4974
4974
  exports.useOverflowItems = useOverflowItems;
4975
4975
  exports.usePopoverContext = usePopoverContext;
4976
4976
  exports.usePrompt = usePrompt;
package/index.esm.js CHANGED
@@ -1115,6 +1115,18 @@ function getDevicePixelRatio(options) {
1115
1115
  return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
1116
1116
  }
1117
1117
 
1118
+ /**
1119
+ * Use this hook if you want to optionally elevate the state of a component.
1120
+ * Useful when you want to optionally be able to control the state of a component
1121
+ * from a parent componentbut keep the simplicity of not having to.
1122
+ *
1123
+ * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
1124
+ */
1125
+ const useElevatedState = (initialState, customState) => {
1126
+ const fallbackState = useState(initialState);
1127
+ return customState !== null && customState !== void 0 ? customState : fallbackState;
1128
+ };
1129
+
1118
1130
  /**
1119
1131
  * Custom hook to get the geometry of an element.
1120
1132
  * Size and position of the element relative to the viewport.
@@ -1231,18 +1243,6 @@ const useIsTextCutOff = (element) => {
1231
1243
  return isTextCutOff;
1232
1244
  };
1233
1245
 
1234
- /**
1235
- * Use this hook if you want to optionally elevate the state of a component.
1236
- * Useful when you want to optionally be able to control the state of a component
1237
- * from a parent componentbut keep the simplicity of not having to.
1238
- *
1239
- * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
1240
- */
1241
- const useOptionallyElevatedState = (initialState, customState) => {
1242
- const fallbackState = useState(initialState);
1243
- return customState !== null && customState !== void 0 ? customState : fallbackState;
1244
- };
1245
-
1246
1246
  /**
1247
1247
  * Custom hook to handle window resize events and provide the current window size.
1248
1248
  *
@@ -4862,4 +4862,4 @@ const cvaClickable = cvaMerge([
4862
4862
  },
4863
4863
  });
4864
4864
 
4865
- export { Alert, Badge, Breadcrumb, BreadcrumbContainer, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, EmptyState, EmptyValue, ExternalLink, Heading, Icon, IconButton, Indicator, KPICard, MenuDivider, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, Pagination, Polygon, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Portal, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, ToggleGroup, ToggleItem, Tooltip, ValueBar, VirtualizedList, WidgetBody, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaIconButton, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaInteractableItem, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemStyle, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, useClickOutside, useContainerBreakpoints, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useScrollDetection, useSelfUpdatingRef, useTimeout, useViewportBreakpoints, useWindowActivity };
4865
+ export { Alert, Badge, Breadcrumb, BreadcrumbContainer, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, EmptyState, EmptyValue, ExternalLink, Heading, Icon, IconButton, Indicator, KPICard, MenuDivider, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, Pagination, Polygon, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Portal, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, ToggleGroup, ToggleItem, Tooltip, ValueBar, VirtualizedList, WidgetBody, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaIconButton, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaInteractableItem, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemStyle, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, useClickOutside, useContainerBreakpoints, useContinuousTimeout, useDebounce, useDevicePixelRatio, useElevatedState, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useOverflowItems, usePopoverContext, usePrompt, useResize, useScrollDetection, useSelfUpdatingRef, useTimeout, useViewportBreakpoints, useWindowActivity };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -3,12 +3,12 @@ export * from "./useContainerBreakpoints";
3
3
  export * from "./useContinuousTimeout";
4
4
  export * from "./useDebounce";
5
5
  export * from "./useDevicePixelRatio";
6
+ export * from "./useElevatedState";
6
7
  export * from "./useGeometry";
7
8
  export * from "./useHover";
8
9
  export * from "./useIsFirstRender";
9
10
  export * from "./useIsFullScreen";
10
11
  export * from "./useIsTextCutOff";
11
- export * from "./useOptionallyElevatedState";
12
12
  export * from "./useResize";
13
13
  export * from "./useScrollDetection";
14
14
  export * from "./useSelfUpdatingRef";
@@ -6,4 +6,4 @@ import { Dispatch, SetStateAction } from "react";
6
6
  *
7
7
  * If no custom state is provided, the fallback state will be used and it works like a normal useState hook.
8
8
  */
9
- export declare const useOptionallyElevatedState: <TState>(initialState: TState, customState?: [TState, Dispatch<SetStateAction<TState>>]) => [TState, Dispatch<SetStateAction<TState>>];
9
+ export declare const useElevatedState: <TState>(initialState: TState, customState?: [TState, Dispatch<SetStateAction<TState>>]) => [TState, Dispatch<SetStateAction<TState>>];