@carbonplan/components 13.4.0-develop.1 → 13.4.0-develop.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/dst/index.mjs CHANGED
@@ -1284,7 +1284,7 @@ import { Box as Box22 } from "theme-ui";
1284
1284
  import { PoopSad } from "@carbonplan/emoji";
1285
1285
 
1286
1286
  // src/layout.tsx
1287
- import React31, { useEffect as useEffect8 } from "react";
1287
+ import React31, { useEffect as useEffect9 } from "react";
1288
1288
  import { useThemeUI as useThemeUI3, Container as Container3, Flex as Flex5, Box as Box21 } from "theme-ui";
1289
1289
 
1290
1290
  // src/meta.tsx
@@ -1405,7 +1405,7 @@ var Meta = ({ title, description, card, url }) => {
1405
1405
  var meta_default = Meta;
1406
1406
 
1407
1407
  // src/header/header.tsx
1408
- import React22, { useState as useState3 } from "react";
1408
+ import React22, { useState as useState3, useEffect as useEffect4 } from "react";
1409
1409
  import { default as NextLink3 } from "next/link";
1410
1410
  import { Box as Box14, Flex as Flex3, Container, Link as Link4 } from "theme-ui";
1411
1411
 
@@ -1786,7 +1786,6 @@ var RESOURCES = [
1786
1786
  var sx2 = {
1787
1787
  highlight: {
1788
1788
  mb: [2, 2, 3, 3],
1789
- mt: [3, 3, 0, 0],
1790
1789
  fontSize: [3, 3, 3, 4],
1791
1790
  fontFamily: "heading",
1792
1791
  letterSpacing: "smallcaps",
@@ -1802,7 +1801,7 @@ var SearchMenu = ({
1802
1801
  const destination = `/search?query=${value.trim()}`;
1803
1802
  useEffect3(() => {
1804
1803
  fetch("/resources.json").then((res) => res.json()).then((res) => {
1805
- if (res.length === 3 && res.every((el) => el.label && Array.isArray(el.links))) {
1804
+ if (res.every((el) => el.label && Array.isArray(el.links))) {
1806
1805
  setResources(res);
1807
1806
  }
1808
1807
  }).catch(() => {
@@ -1889,81 +1888,31 @@ var SearchMenu = ({
1889
1888
  row_default,
1890
1889
  {
1891
1890
  columns: [6, 6, 10, 10],
1892
- sx: { display: ["none", "grid", "grid", "grid"] }
1893
- },
1894
- /* @__PURE__ */ React21.createElement(column_default, { start: 1, width: 5, sx: { mt: [2, 2, 8, 8], mb: [1, 1, 4, 5] } }, /* @__PURE__ */ React21.createElement(Box13, { as: "h2", variant: "styles.h2", sx: { my: 0 } }, "Popular resources")),
1895
- /* @__PURE__ */ React21.createElement(column_default, { start: [1, 1, 2, 2], width: 3 }, /* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, resources[0].label), resources[0].links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
1896
- button_default,
1897
- {
1898
- key: href,
1899
- href,
1900
- size: "md",
1901
- sx: { mb: [1] },
1902
- suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
1903
- },
1904
- label
1905
- ))),
1906
- /* @__PURE__ */ React21.createElement(column_default, { start: [4, 4, 5, 5], width: 3 }, /* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, resources[1].label), resources[1].links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
1907
- button_default,
1908
- {
1909
- key: href,
1910
- href,
1911
- size: "md",
1912
- sx: { mb: [1] },
1913
- suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
1914
- },
1915
- label
1916
- ))),
1917
- /* @__PURE__ */ React21.createElement(column_default, { start: [1, 1, 8, 8], width: 3, sx: { mt: [0, 4, 0, 0] } }, /* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, resources[2].label), resources[2].links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
1918
- button_default,
1919
- {
1920
- key: href,
1921
- href,
1922
- size: "md",
1923
- sx: { mb: [1] },
1924
- suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
1925
- },
1926
- label
1927
- )))
1928
- ), /* @__PURE__ */ React21.createElement(
1929
- row_default,
1930
- {
1931
- columns: [6, 6, 10, 10],
1932
- sx: { display: ["grid", "none", "none", "none"] }
1891
+ sx: {
1892
+ mt: [6, 7, 8, 8],
1893
+ rowGap: [5, 4, 6, 7]
1894
+ }
1933
1895
  },
1934
- /* @__PURE__ */ React21.createElement(column_default, { start: 1, width: 6 }, /* @__PURE__ */ React21.createElement(Box13, { as: "h2", variant: "styles.h3", sx: { my: 4 } }, "Popular resources"), /* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, resources[0].label), resources[0].links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
1935
- button_default,
1936
- {
1937
- key: href,
1938
- href,
1939
- size: "xs",
1940
- sx: { mb: [1] },
1941
- suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
1942
- },
1943
- label
1944
- ))),
1945
- /* @__PURE__ */ React21.createElement(column_default, { start: 1, width: 6 }, /* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, resources[1].label), resources[1].links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
1946
- button_default,
1947
- {
1948
- key: href,
1949
- href,
1950
- size: "xs",
1951
- sx: { mb: [1] },
1952
- suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
1953
- },
1954
- label
1955
- ))),
1956
- /* @__PURE__ */ React21.createElement(column_default, { start: 1, width: 6 }, /* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, resources[2].label), resources[2].links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
1957
- button_default,
1896
+ resources.map((group, i) => /* @__PURE__ */ React21.createElement(
1897
+ column_default,
1958
1898
  {
1959
- key: href,
1960
- href,
1961
- size: "xs",
1962
- sx: { mb: [1] },
1963
- suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
1899
+ start: [1, 1 + i * 3 % 6, 2 + i * 3 % 9, 2 + i * 3 % 9],
1900
+ width: [6, 3, 3, 3],
1901
+ key: group.label
1964
1902
  },
1965
- label
1966
- )))
1903
+ /* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, group.label),
1904
+ group.links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
1905
+ button_default,
1906
+ {
1907
+ key: href,
1908
+ href,
1909
+ size: "md",
1910
+ sx: { mb: [1] },
1911
+ suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
1912
+ },
1913
+ label
1914
+ ))
1915
+ ))
1967
1916
  ));
1968
1917
  };
1969
1918
  var search_menu_default = SearchMenu;
@@ -1973,6 +1922,12 @@ var Header = ({ status, mode, nav, menuItems }) => {
1973
1922
  const [menuExpanded, setMenuExpanded] = useState3(false);
1974
1923
  const [searchExpanded, setSearchExpanded] = useState3(false);
1975
1924
  const expanded = searchExpanded || menuExpanded;
1925
+ useEffect4(() => {
1926
+ document.body.style.overflow = expanded ? "hidden" : "";
1927
+ return () => {
1928
+ document.body.style.overflow = "";
1929
+ };
1930
+ }, [expanded]);
1976
1931
  return /* @__PURE__ */ React22.createElement(
1977
1932
  row_default,
1978
1933
  {
@@ -2099,7 +2054,9 @@ var Header = ({ status, mode, nav, menuItems }) => {
2099
2054
  backgroundColor: "background",
2100
2055
  zIndex: 4e3,
2101
2056
  pt: ["79px"],
2102
- transition: "opacity 0.25s"
2057
+ transition: "opacity 0.25s",
2058
+ overflowY: "auto",
2059
+ overscrollBehavior: "contain"
2103
2060
  }
2104
2061
  },
2105
2062
  /* @__PURE__ */ React22.createElement(Container, null, /* @__PURE__ */ React22.createElement(row_default, null, menuExpanded && /* @__PURE__ */ React22.createElement(column_default, { start: [2, 4, 7, 7], width: [5, 4, 5, 5] }, /* @__PURE__ */ React22.createElement(Box14, { as: "nav", sx: { mt: [5, 5, 5, 6] } }, /* @__PURE__ */ React22.createElement(
@@ -2116,7 +2073,7 @@ var Header = ({ status, mode, nav, menuItems }) => {
2116
2073
  var header_default = Header;
2117
2074
 
2118
2075
  // src/footer.tsx
2119
- import React24, { useState as useState4, useEffect as useEffect4 } from "react";
2076
+ import React24, { useState as useState4, useEffect as useEffect5 } from "react";
2120
2077
  import { Box as Box16, Flex as Flex4, Link as Link5 } from "theme-ui";
2121
2078
  import { default as NextLink4 } from "next/link";
2122
2079
 
@@ -2145,7 +2102,7 @@ var monogram_default = Monogram;
2145
2102
  // src/footer.tsx
2146
2103
  var Footer = () => {
2147
2104
  const [year, setYear] = useState4(null);
2148
- useEffect4(() => {
2105
+ useEffect5(() => {
2149
2106
  setYear((/* @__PURE__ */ new Date()).getFullYear());
2150
2107
  }, []);
2151
2108
  return /* @__PURE__ */ React24.createElement(
@@ -2410,7 +2367,7 @@ var dimmer_default = Dimmer;
2410
2367
  // src/metadata.tsx
2411
2368
  import React27 from "react";
2412
2369
  import { Box as Box18, Text as Text2 } from "theme-ui";
2413
- import { useState as useState5, useEffect as useEffect5 } from "react";
2370
+ import { useState as useState5, useEffect as useEffect6 } from "react";
2414
2371
 
2415
2372
  // src/gitsha.tsx
2416
2373
  import React26 from "react";
@@ -2470,7 +2427,7 @@ var gitsha_default = GitSha;
2470
2427
  // src/metadata.tsx
2471
2428
  var Value = ({ mode }) => {
2472
2429
  const [display, setDisplay] = useState5(init(mode));
2473
- useEffect5(() => {
2430
+ useEffect6(() => {
2474
2431
  if (mode === "mouse") {
2475
2432
  const setFromEvent = (e) => {
2476
2433
  const x = format(e.clientX, 4);
@@ -2584,7 +2541,7 @@ var FadeIn = (_a) => {
2584
2541
  var fade_in_default = FadeIn;
2585
2542
 
2586
2543
  // src/scrollbar.tsx
2587
- import { useEffect as useEffect6 } from "react";
2544
+ import { useEffect as useEffect7 } from "react";
2588
2545
 
2589
2546
  // src/utils/get-scrollbar-width.ts
2590
2547
  var getScrollbarWidth = (document2) => {
@@ -2604,7 +2561,7 @@ var get_scrollbar_width_default = getScrollbarWidth;
2604
2561
 
2605
2562
  // src/scrollbar.tsx
2606
2563
  var Scrollbar = () => {
2607
- useEffect6(() => {
2564
+ useEffect7(() => {
2608
2565
  if (typeof document !== "undefined") {
2609
2566
  const delta = get_scrollbar_width_default(document);
2610
2567
  if (delta > 0) {
@@ -2618,11 +2575,11 @@ var Scrollbar = () => {
2618
2575
  var scrollbar_default = Scrollbar;
2619
2576
 
2620
2577
  // src/guide.tsx
2621
- import React29, { useState as useState6, useEffect as useEffect7 } from "react";
2578
+ import React29, { useState as useState6, useEffect as useEffect8 } from "react";
2622
2579
  import { Box as Box20, Container as Container2 } from "theme-ui";
2623
2580
  var Guide = ({ color = "muted" }) => {
2624
2581
  const [display, setDisplay] = useState6(false);
2625
- useEffect7(() => {
2582
+ useEffect8(() => {
2626
2583
  function handler(event) {
2627
2584
  const { key, metaKey } = event;
2628
2585
  if (key === ";" && metaKey) {
@@ -2758,7 +2715,7 @@ var Layout = ({
2758
2715
  display: "none"
2759
2716
  }
2760
2717
  } : {};
2761
- useEffect8(() => {
2718
+ useEffect9(() => {
2762
2719
  var _a;
2763
2720
  if (!theme) return;
2764
2721
  const handler = (e) => {
@@ -3698,10 +3655,10 @@ var formatDate = (date, options = defaultOptions) => {
3698
3655
  var format_date_default = formatDate;
3699
3656
 
3700
3657
  // src/utils/use-scrollbar-class.ts
3701
- import { useEffect as useEffect9, useState as useState7 } from "react";
3658
+ import { useEffect as useEffect10, useState as useState7 } from "react";
3702
3659
  var useScrollbarClass = () => {
3703
3660
  const [className, setClassName] = useState7(null);
3704
- useEffect9(() => {
3661
+ useEffect10(() => {
3705
3662
  if (document && get_scrollbar_width_default(document) > 0) {
3706
3663
  setClassName("custom-scrollbar");
3707
3664
  }