@trackunit/react-components 1.8.21 → 1.8.22

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
@@ -1588,7 +1588,13 @@ const useSelfUpdatingRef = (initialState) => {
1588
1588
  * }
1589
1589
  */
1590
1590
  const useViewportBreakpoints = () => {
1591
- const [viewportSize, setViewportSize] = react.useState(() => defaultBreakpointState);
1591
+ const [viewportSize, setViewportSize] = react.useState(() => {
1592
+ const newViewportSize = sharedUtils.objectEntries(uiDesignTokens.themeScreenSizeAsNumber).reduce((acc, [size, minWidth]) => ({
1593
+ ...acc,
1594
+ [breakpointPropsMap[size]]: window.matchMedia(`(min-width: ${minWidth}px)`).matches,
1595
+ }), { ...defaultBreakpointState });
1596
+ return newViewportSize;
1597
+ });
1592
1598
  const updateViewportSize = react.useCallback(() => {
1593
1599
  const newViewportSize = sharedUtils.objectEntries(uiDesignTokens.themeScreenSizeAsNumber).reduce((acc, [size, minWidth]) => ({
1594
1600
  ...acc,
@@ -2766,7 +2772,7 @@ const Tooltip = ({ children, dataTestId, disabled, className, label, placement =
2766
2772
  const { isMounted } = react$1.useTransitionStatus(context);
2767
2773
  // Please don't try to move this into the component body directly
2768
2774
  // I tried and it caused infinite re-renders some places (for whatever reason)
2769
- const wrappedChildren = (jsxRuntime.jsx("div", { className: cvaTooltipContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : undefined, children: children }));
2775
+ const wrappedChildren = react.useMemo(() => (jsxRuntime.jsx("div", { className: cvaTooltipContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : undefined, children: children })), [children, className, dataTestId]);
2770
2776
  const openTooltip = react.useCallback(() => {
2771
2777
  if (disabled) {
2772
2778
  return;
package/index.esm.js CHANGED
@@ -1586,7 +1586,13 @@ const useSelfUpdatingRef = (initialState) => {
1586
1586
  * }
1587
1587
  */
1588
1588
  const useViewportBreakpoints = () => {
1589
- const [viewportSize, setViewportSize] = useState(() => defaultBreakpointState);
1589
+ const [viewportSize, setViewportSize] = useState(() => {
1590
+ const newViewportSize = objectEntries(themeScreenSizeAsNumber).reduce((acc, [size, minWidth]) => ({
1591
+ ...acc,
1592
+ [breakpointPropsMap[size]]: window.matchMedia(`(min-width: ${minWidth}px)`).matches,
1593
+ }), { ...defaultBreakpointState });
1594
+ return newViewportSize;
1595
+ });
1590
1596
  const updateViewportSize = useCallback(() => {
1591
1597
  const newViewportSize = objectEntries(themeScreenSizeAsNumber).reduce((acc, [size, minWidth]) => ({
1592
1598
  ...acc,
@@ -2764,7 +2770,7 @@ const Tooltip = ({ children, dataTestId, disabled, className, label, placement =
2764
2770
  const { isMounted } = useTransitionStatus(context);
2765
2771
  // Please don't try to move this into the component body directly
2766
2772
  // I tried and it caused infinite re-renders some places (for whatever reason)
2767
- const wrappedChildren = (jsx("div", { className: cvaTooltipContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : undefined, children: children }));
2773
+ const wrappedChildren = useMemo(() => (jsx("div", { className: cvaTooltipContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-parent` : undefined, children: children })), [children, className, dataTestId]);
2768
2774
  const openTooltip = useCallback(() => {
2769
2775
  if (disabled) {
2770
2776
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.8.21",
3
+ "version": "1.8.22",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -17,12 +17,12 @@
17
17
  "@floating-ui/react": "^0.26.25",
18
18
  "string-ts": "^2.0.0",
19
19
  "tailwind-merge": "^2.0.0",
20
- "@trackunit/ui-design-tokens": "1.6.50",
21
- "@trackunit/css-class-variance-utilities": "1.6.48",
22
- "@trackunit/shared-utils": "1.8.48",
23
- "@trackunit/ui-icons": "1.6.47",
24
- "@trackunit/react-table-pagination": "1.6.47",
25
- "@trackunit/react-test-setup": "1.3.48",
20
+ "@trackunit/ui-design-tokens": "1.6.51",
21
+ "@trackunit/css-class-variance-utilities": "1.6.49",
22
+ "@trackunit/shared-utils": "1.8.49",
23
+ "@trackunit/ui-icons": "1.6.48",
24
+ "@trackunit/react-table-pagination": "1.6.48",
25
+ "@trackunit/react-test-setup": "1.3.49",
26
26
  "@tanstack/react-router": "1.114.29"
27
27
  },
28
28
  "module": "./index.esm.js",