@classic-homes/theme-react 0.2.2 → 0.2.3

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/dist/index.js CHANGED
@@ -882,6 +882,9 @@ function useEscapeKey(callback, options) {
882
882
  // src/components/DataPanel.tsx
883
883
  var import_data_panel_core = require("@classic-homes/data-panel-core");
884
884
  var import_jsx_runtime12 = require("react/jsx-runtime");
885
+ function layoutViewportWidth() {
886
+ return document.documentElement.clientWidth;
887
+ }
885
888
  var DropdownTrigger = DropdownMenuPrimitive.Trigger;
886
889
  var DropdownContent = DropdownMenuPrimitive.Content;
887
890
  var DropdownLabel = DropdownMenuPrimitive.Label;
@@ -941,7 +944,7 @@ function useDataPanel(options = {}) {
941
944
  setMode(newMode);
942
945
  if (newMode === "detached" && typeof window !== "undefined" && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
943
946
  setDetachedPosition(
944
- (0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, window.innerWidth, window.innerHeight)
947
+ (0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, layoutViewportWidth(), window.innerHeight)
945
948
  );
946
949
  }
947
950
  },
@@ -954,7 +957,7 @@ function useDataPanel(options = {}) {
954
957
  return;
955
958
  }
956
959
  setDetachedPosition(
957
- (0, import_data_panel_core.constrainPosition)(position, detachedSize, window.innerWidth, window.innerHeight)
960
+ (0, import_data_panel_core.constrainPosition)(position, detachedSize, layoutViewportWidth(), window.innerHeight)
958
961
  );
959
962
  },
960
963
  [detachedSize]
@@ -972,7 +975,7 @@ function useDataPanel(options = {}) {
972
975
  return;
973
976
  }
974
977
  if ((0, import_data_panel_core.isHorizontalEdge)(edge)) {
975
- setPinnedSize((0, import_data_panel_core.constrainPinnedWidth)(size, resolvedConstraints, window.innerWidth));
978
+ setPinnedSize((0, import_data_panel_core.constrainPinnedWidth)(size, resolvedConstraints, layoutViewportWidth()));
976
979
  } else {
977
980
  setPinnedSize((0, import_data_panel_core.constrainPinnedHeight)(size, resolvedConstraints, window.innerHeight));
978
981
  }
@@ -1408,7 +1411,7 @@ var DataPanelTab = React14.forwardRef(
1408
1411
  d.startOffset + delta,
1409
1412
  edge,
1410
1413
  tabBounds,
1411
- window.innerWidth,
1414
+ layoutViewportWidth(),
1412
1415
  window.innerHeight
1413
1416
  )
1414
1417
  );
@@ -1450,7 +1453,7 @@ var DataPanelTab = React14.forwardRef(
1450
1453
  offset,
1451
1454
  edge,
1452
1455
  tabBounds,
1453
- window.innerWidth,
1456
+ layoutViewportWidth(),
1454
1457
  window.innerHeight
1455
1458
  );
1456
1459
  if (clamped !== offset) onOffsetChange(clamped);
@@ -1586,7 +1589,7 @@ function ResizeHandles({
1586
1589
  candidatePosition,
1587
1590
  { width, height },
1588
1591
  constraints,
1589
- typeof window === "undefined" ? 1024 : window.innerWidth,
1592
+ typeof window === "undefined" ? 1024 : layoutViewportWidth(),
1590
1593
  typeof window === "undefined" ? 768 : window.innerHeight,
1591
1594
  handle
1592
1595
  );
@@ -1770,7 +1773,7 @@ var DataPanel = React14.forwardRef(
1770
1773
  const [pinnedSize, setPinnedSize] = React14.useState(import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize);
1771
1774
  const [tabOffset, setTabOffset] = React14.useState(import_data_panel_core.DEFAULT_PANEL_STATE.tabOffset);
1772
1775
  const [viewportWidth, setViewportWidth] = React14.useState(
1773
- typeof window !== "undefined" ? window.innerWidth : 1024
1776
+ typeof window !== "undefined" ? layoutViewportWidth() : 1024
1774
1777
  );
1775
1778
  const [viewportHeight, setViewportHeight] = React14.useState(
1776
1779
  typeof window !== "undefined" ? window.innerHeight : 768
@@ -1891,7 +1894,7 @@ var DataPanel = React14.forwardRef(
1891
1894
  React14.useEffect(() => {
1892
1895
  if (mode === "detached" && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
1893
1896
  setDetachedPosition(
1894
- (0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, window.innerWidth, window.innerHeight)
1897
+ (0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, layoutViewportWidth(), window.innerHeight)
1895
1898
  );
1896
1899
  }
1897
1900
  }, [mode, detachedPosition, detachedSize]);
@@ -1985,13 +1988,13 @@ var DataPanel = React14.forwardRef(
1985
1988
  const snap = (0, import_data_panel_core.detectEdgeSnap)(
1986
1989
  newPosition,
1987
1990
  detachedSize,
1988
- window.innerWidth,
1991
+ layoutViewportWidth(),
1989
1992
  window.innerHeight,
1990
1993
  snapThreshold
1991
1994
  );
1992
1995
  setSnapPreview(snap.shouldSnap ? snap.edge : null);
1993
1996
  setDetachedPosition(
1994
- (0, import_data_panel_core.constrainPosition)(newPosition, detachedSize, window.innerWidth, window.innerHeight)
1997
+ (0, import_data_panel_core.constrainPosition)(newPosition, detachedSize, layoutViewportWidth(), window.innerHeight)
1995
1998
  );
1996
1999
  },
1997
2000
  [isDragging, detachedSize, snapThreshold]
@@ -2025,7 +2028,7 @@ var DataPanel = React14.forwardRef(
2025
2028
  pinnedSize,
2026
2029
  detachedSize,
2027
2030
  edge,
2028
- window.innerWidth,
2031
+ layoutViewportWidth(),
2029
2032
  window.innerHeight
2030
2033
  );
2031
2034
  setDetachedPosition(newPosition);
@@ -2085,7 +2088,7 @@ var DataPanel = React14.forwardRef(
2085
2088
  result.position,
2086
2089
  result.size,
2087
2090
  resolvedConstraints,
2088
- window.innerWidth,
2091
+ layoutViewportWidth(),
2089
2092
  window.innerHeight,
2090
2093
  handle
2091
2094
  );
@@ -2096,7 +2099,9 @@ var DataPanel = React14.forwardRef(
2096
2099
  const direction = edge === "left" || edge === "top" ? 1 : -1;
2097
2100
  const newSize = startSize.width + delta * direction;
2098
2101
  if ((0, import_data_panel_core.isHorizontalEdge)(edge)) {
2099
- setPinnedSize((0, import_data_panel_core.constrainPinnedWidth)(newSize, resolvedConstraints, window.innerWidth));
2102
+ setPinnedSize(
2103
+ (0, import_data_panel_core.constrainPinnedWidth)(newSize, resolvedConstraints, layoutViewportWidth())
2104
+ );
2100
2105
  } else {
2101
2106
  setPinnedSize((0, import_data_panel_core.constrainPinnedHeight)(newSize, resolvedConstraints, window.innerHeight));
2102
2107
  }
@@ -2444,7 +2449,7 @@ var DataPanel = React14.forwardRef(
2444
2449
  }, [isCardWidthResizing, handleCardWidthResizeMove, handleCardWidthResizeEnd]);
2445
2450
  React14.useEffect(() => {
2446
2451
  const onResize = () => {
2447
- setViewportWidth(window.innerWidth);
2452
+ setViewportWidth(layoutViewportWidth());
2448
2453
  setViewportHeight(window.innerHeight);
2449
2454
  setCardExpandedHeight(window.innerHeight * import_data_panel_core.CARD_EXPANDED_RATIO);
2450
2455
  };
@@ -2654,7 +2659,9 @@ var DataPanel = React14.forwardRef(
2654
2659
  return;
2655
2660
  }
2656
2661
  if ((0, import_data_panel_core.isHorizontalEdge)(edge)) {
2657
- setPinnedSize((0, import_data_panel_core.constrainPinnedWidth)(size, resolvedConstraints, window.innerWidth));
2662
+ setPinnedSize(
2663
+ (0, import_data_panel_core.constrainPinnedWidth)(size, resolvedConstraints, layoutViewportWidth())
2664
+ );
2658
2665
  } else {
2659
2666
  setPinnedSize(
2660
2667
  (0, import_data_panel_core.constrainPinnedHeight)(size, resolvedConstraints, window.innerHeight)
package/dist/index.mjs CHANGED
@@ -820,6 +820,9 @@ import {
820
820
  getPinnedPullTransform
821
821
  } from "@classic-homes/data-panel-core";
822
822
  import { Fragment, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
823
+ function layoutViewportWidth() {
824
+ return document.documentElement.clientWidth;
825
+ }
823
826
  var DropdownTrigger = DropdownMenuPrimitive.Trigger;
824
827
  var DropdownContent = DropdownMenuPrimitive.Content;
825
828
  var DropdownLabel = DropdownMenuPrimitive.Label;
@@ -879,7 +882,7 @@ function useDataPanel(options = {}) {
879
882
  setMode(newMode);
880
883
  if (newMode === "detached" && typeof window !== "undefined" && detachedPosition.x === DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === DEFAULT_PANEL_STATE.detachedPosition.y) {
881
884
  setDetachedPosition(
882
- getInitialDetachedPosition(detachedSize, window.innerWidth, window.innerHeight)
885
+ getInitialDetachedPosition(detachedSize, layoutViewportWidth(), window.innerHeight)
883
886
  );
884
887
  }
885
888
  },
@@ -892,7 +895,7 @@ function useDataPanel(options = {}) {
892
895
  return;
893
896
  }
894
897
  setDetachedPosition(
895
- constrainPosition(position, detachedSize, window.innerWidth, window.innerHeight)
898
+ constrainPosition(position, detachedSize, layoutViewportWidth(), window.innerHeight)
896
899
  );
897
900
  },
898
901
  [detachedSize]
@@ -910,7 +913,7 @@ function useDataPanel(options = {}) {
910
913
  return;
911
914
  }
912
915
  if (isHorizontalEdge(edge)) {
913
- setPinnedSize(constrainPinnedWidth(size, resolvedConstraints, window.innerWidth));
916
+ setPinnedSize(constrainPinnedWidth(size, resolvedConstraints, layoutViewportWidth()));
914
917
  } else {
915
918
  setPinnedSize(constrainPinnedHeight(size, resolvedConstraints, window.innerHeight));
916
919
  }
@@ -1346,7 +1349,7 @@ var DataPanelTab = React14.forwardRef(
1346
1349
  d.startOffset + delta,
1347
1350
  edge,
1348
1351
  tabBounds,
1349
- window.innerWidth,
1352
+ layoutViewportWidth(),
1350
1353
  window.innerHeight
1351
1354
  )
1352
1355
  );
@@ -1388,7 +1391,7 @@ var DataPanelTab = React14.forwardRef(
1388
1391
  offset,
1389
1392
  edge,
1390
1393
  tabBounds,
1391
- window.innerWidth,
1394
+ layoutViewportWidth(),
1392
1395
  window.innerHeight
1393
1396
  );
1394
1397
  if (clamped !== offset) onOffsetChange(clamped);
@@ -1524,7 +1527,7 @@ function ResizeHandles({
1524
1527
  candidatePosition,
1525
1528
  { width, height },
1526
1529
  constraints,
1527
- typeof window === "undefined" ? 1024 : window.innerWidth,
1530
+ typeof window === "undefined" ? 1024 : layoutViewportWidth(),
1528
1531
  typeof window === "undefined" ? 768 : window.innerHeight,
1529
1532
  handle
1530
1533
  );
@@ -1708,7 +1711,7 @@ var DataPanel = React14.forwardRef(
1708
1711
  const [pinnedSize, setPinnedSize] = React14.useState(DEFAULT_PANEL_STATE.pinnedSize);
1709
1712
  const [tabOffset, setTabOffset] = React14.useState(DEFAULT_PANEL_STATE.tabOffset);
1710
1713
  const [viewportWidth, setViewportWidth] = React14.useState(
1711
- typeof window !== "undefined" ? window.innerWidth : 1024
1714
+ typeof window !== "undefined" ? layoutViewportWidth() : 1024
1712
1715
  );
1713
1716
  const [viewportHeight, setViewportHeight] = React14.useState(
1714
1717
  typeof window !== "undefined" ? window.innerHeight : 768
@@ -1829,7 +1832,7 @@ var DataPanel = React14.forwardRef(
1829
1832
  React14.useEffect(() => {
1830
1833
  if (mode === "detached" && detachedPosition.x === DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === DEFAULT_PANEL_STATE.detachedPosition.y) {
1831
1834
  setDetachedPosition(
1832
- getInitialDetachedPosition(detachedSize, window.innerWidth, window.innerHeight)
1835
+ getInitialDetachedPosition(detachedSize, layoutViewportWidth(), window.innerHeight)
1833
1836
  );
1834
1837
  }
1835
1838
  }, [mode, detachedPosition, detachedSize]);
@@ -1923,13 +1926,13 @@ var DataPanel = React14.forwardRef(
1923
1926
  const snap = detectEdgeSnap(
1924
1927
  newPosition,
1925
1928
  detachedSize,
1926
- window.innerWidth,
1929
+ layoutViewportWidth(),
1927
1930
  window.innerHeight,
1928
1931
  snapThreshold
1929
1932
  );
1930
1933
  setSnapPreview(snap.shouldSnap ? snap.edge : null);
1931
1934
  setDetachedPosition(
1932
- constrainPosition(newPosition, detachedSize, window.innerWidth, window.innerHeight)
1935
+ constrainPosition(newPosition, detachedSize, layoutViewportWidth(), window.innerHeight)
1933
1936
  );
1934
1937
  },
1935
1938
  [isDragging, detachedSize, snapThreshold]
@@ -1963,7 +1966,7 @@ var DataPanel = React14.forwardRef(
1963
1966
  pinnedSize,
1964
1967
  detachedSize,
1965
1968
  edge,
1966
- window.innerWidth,
1969
+ layoutViewportWidth(),
1967
1970
  window.innerHeight
1968
1971
  );
1969
1972
  setDetachedPosition(newPosition);
@@ -2023,7 +2026,7 @@ var DataPanel = React14.forwardRef(
2023
2026
  result.position,
2024
2027
  result.size,
2025
2028
  resolvedConstraints,
2026
- window.innerWidth,
2029
+ layoutViewportWidth(),
2027
2030
  window.innerHeight,
2028
2031
  handle
2029
2032
  );
@@ -2034,7 +2037,9 @@ var DataPanel = React14.forwardRef(
2034
2037
  const direction = edge === "left" || edge === "top" ? 1 : -1;
2035
2038
  const newSize = startSize.width + delta * direction;
2036
2039
  if (isHorizontalEdge(edge)) {
2037
- setPinnedSize(constrainPinnedWidth(newSize, resolvedConstraints, window.innerWidth));
2040
+ setPinnedSize(
2041
+ constrainPinnedWidth(newSize, resolvedConstraints, layoutViewportWidth())
2042
+ );
2038
2043
  } else {
2039
2044
  setPinnedSize(constrainPinnedHeight(newSize, resolvedConstraints, window.innerHeight));
2040
2045
  }
@@ -2382,7 +2387,7 @@ var DataPanel = React14.forwardRef(
2382
2387
  }, [isCardWidthResizing, handleCardWidthResizeMove, handleCardWidthResizeEnd]);
2383
2388
  React14.useEffect(() => {
2384
2389
  const onResize = () => {
2385
- setViewportWidth(window.innerWidth);
2390
+ setViewportWidth(layoutViewportWidth());
2386
2391
  setViewportHeight(window.innerHeight);
2387
2392
  setCardExpandedHeight(window.innerHeight * CARD_EXPANDED_RATIO);
2388
2393
  };
@@ -2592,7 +2597,9 @@ var DataPanel = React14.forwardRef(
2592
2597
  return;
2593
2598
  }
2594
2599
  if (isHorizontalEdge(edge)) {
2595
- setPinnedSize(constrainPinnedWidth(size, resolvedConstraints, window.innerWidth));
2600
+ setPinnedSize(
2601
+ constrainPinnedWidth(size, resolvedConstraints, layoutViewportWidth())
2602
+ );
2596
2603
  } else {
2597
2604
  setPinnedSize(
2598
2605
  constrainPinnedHeight(size, resolvedConstraints, window.innerHeight)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/theme-react",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "React components for the Classic theme system",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",