@carbonplan/components 13.4.0-develop.0 → 13.4.0-develop.2
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.js +46 -99
- package/dst/index.js.map +1 -1
- package/dst/index.mjs +61 -114
- package/dst/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
1287
|
+
import React31, { useEffect as useEffect8 } 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
|
|
@@ -1598,7 +1598,7 @@ var Menu = (props) => {
|
|
|
1598
1598
|
var menu_default = Menu;
|
|
1599
1599
|
|
|
1600
1600
|
// src/header/navigation-menu.tsx
|
|
1601
|
-
import React18 from "react";
|
|
1601
|
+
import React18, { useEffect as useEffect2 } from "react";
|
|
1602
1602
|
import { default as NextLink2 } from "next/link";
|
|
1603
1603
|
import { Link as Link2 } from "theme-ui";
|
|
1604
1604
|
import { Arrow as Arrow2 } from "@carbonplan/icons";
|
|
@@ -1677,6 +1677,13 @@ var Nav = ({ link, mode, nav, first, setExpanded }) => {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
};
|
|
1679
1679
|
var NavigationMenu = ({ nav, mode, setExpanded }) => {
|
|
1680
|
+
useEffect2(() => {
|
|
1681
|
+
const handler = (e) => {
|
|
1682
|
+
if (e.key === "Escape") setExpanded(false);
|
|
1683
|
+
};
|
|
1684
|
+
document.addEventListener("keydown", handler);
|
|
1685
|
+
return () => document.removeEventListener("keydown", handler);
|
|
1686
|
+
}, [setExpanded]);
|
|
1680
1687
|
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, links.map((d, i) => /* @__PURE__ */ React18.createElement(
|
|
1681
1688
|
Nav,
|
|
1682
1689
|
{
|
|
@@ -1700,7 +1707,7 @@ var Search = (props) => {
|
|
|
1700
1707
|
var search_default = Search;
|
|
1701
1708
|
|
|
1702
1709
|
// src/header/search-menu.tsx
|
|
1703
|
-
import React21, { useEffect as
|
|
1710
|
+
import React21, { useEffect as useEffect3, useState as useState2 } from "react";
|
|
1704
1711
|
import { Box as Box13, Flex as Flex2, Link as Link3 } from "theme-ui";
|
|
1705
1712
|
import { Arrow as Arrow3, RotatingArrow } from "@carbonplan/icons";
|
|
1706
1713
|
|
|
@@ -1779,7 +1786,6 @@ var RESOURCES = [
|
|
|
1779
1786
|
var sx2 = {
|
|
1780
1787
|
highlight: {
|
|
1781
1788
|
mb: [2, 2, 3, 3],
|
|
1782
|
-
mt: [3, 3, 0, 0],
|
|
1783
1789
|
fontSize: [3, 3, 3, 4],
|
|
1784
1790
|
fontFamily: "heading",
|
|
1785
1791
|
letterSpacing: "smallcaps",
|
|
@@ -1787,19 +1793,28 @@ var sx2 = {
|
|
|
1787
1793
|
color: "secondary"
|
|
1788
1794
|
}
|
|
1789
1795
|
};
|
|
1790
|
-
var SearchMenu = ({
|
|
1796
|
+
var SearchMenu = ({
|
|
1797
|
+
setExpanded
|
|
1798
|
+
}) => {
|
|
1791
1799
|
const [value, setValue] = useState2("");
|
|
1792
1800
|
const [resources, setResources] = useState2(RESOURCES);
|
|
1793
1801
|
const destination = `/search?query=${value.trim()}`;
|
|
1794
|
-
|
|
1802
|
+
useEffect3(() => {
|
|
1795
1803
|
fetch("/resources.json").then((res) => res.json()).then((res) => {
|
|
1796
|
-
if (res.
|
|
1804
|
+
if (res.every((el) => el.label && Array.isArray(el.links))) {
|
|
1797
1805
|
setResources(res);
|
|
1798
1806
|
}
|
|
1799
1807
|
}).catch(() => {
|
|
1800
1808
|
setResources(RESOURCES);
|
|
1801
1809
|
});
|
|
1802
1810
|
}, []);
|
|
1811
|
+
useEffect3(() => {
|
|
1812
|
+
const handler = (e) => {
|
|
1813
|
+
if (e.key === "Escape") setExpanded(false);
|
|
1814
|
+
};
|
|
1815
|
+
document.addEventListener("keydown", handler);
|
|
1816
|
+
return () => document.removeEventListener("keydown", handler);
|
|
1817
|
+
}, [setExpanded]);
|
|
1803
1818
|
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(row_default, { columns: [6, 6, 10, 10] }, /* @__PURE__ */ React21.createElement(column_default, { start: 1, width: [6, 6, 10, 10] }, /* @__PURE__ */ React21.createElement(
|
|
1804
1819
|
Flex2,
|
|
1805
1820
|
{
|
|
@@ -1847,6 +1862,7 @@ var SearchMenu = ({}) => {
|
|
|
1847
1862
|
/* @__PURE__ */ React21.createElement(
|
|
1848
1863
|
input_default,
|
|
1849
1864
|
{
|
|
1865
|
+
autoFocus: true,
|
|
1850
1866
|
id: "search",
|
|
1851
1867
|
size: "xl",
|
|
1852
1868
|
value,
|
|
@@ -1872,89 +1888,30 @@ var SearchMenu = ({}) => {
|
|
|
1872
1888
|
row_default,
|
|
1873
1889
|
{
|
|
1874
1890
|
columns: [6, 6, 10, 10],
|
|
1875
|
-
sx: {
|
|
1891
|
+
sx: {
|
|
1892
|
+
mt: [6, 7, 8, 8],
|
|
1893
|
+
rowGap: [5, 4, 6, 7]
|
|
1894
|
+
}
|
|
1876
1895
|
},
|
|
1877
|
-
/* @__PURE__ */ React21.createElement(
|
|
1896
|
+
resources.map((group, i) => /* @__PURE__ */ React21.createElement(
|
|
1878
1897
|
column_default,
|
|
1879
1898
|
{
|
|
1880
|
-
start: 1,
|
|
1881
|
-
width:
|
|
1882
|
-
sx: { mt: [2, 2, 8, 8], mb: [1, 1, , 6, 6] }
|
|
1899
|
+
start: [1, 1 + i * 3 % 6, 2 + i * 3 % 9, 2 + i * 3 % 9],
|
|
1900
|
+
width: [6, 3, 3, 3]
|
|
1883
1901
|
},
|
|
1884
|
-
/* @__PURE__ */ React21.createElement(Box13, {
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
))
|
|
1897
|
-
/* @__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(
|
|
1898
|
-
button_default,
|
|
1899
|
-
{
|
|
1900
|
-
key: href,
|
|
1901
|
-
href,
|
|
1902
|
-
size: "md",
|
|
1903
|
-
sx: { mb: [1] },
|
|
1904
|
-
suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
|
|
1905
|
-
},
|
|
1906
|
-
label
|
|
1907
|
-
))),
|
|
1908
|
-
/* @__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(
|
|
1909
|
-
button_default,
|
|
1910
|
-
{
|
|
1911
|
-
key: href,
|
|
1912
|
-
href,
|
|
1913
|
-
size: "md",
|
|
1914
|
-
sx: { mb: [1] },
|
|
1915
|
-
suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
|
|
1916
|
-
},
|
|
1917
|
-
label
|
|
1918
|
-
)))
|
|
1919
|
-
), /* @__PURE__ */ React21.createElement(
|
|
1920
|
-
row_default,
|
|
1921
|
-
{
|
|
1922
|
-
columns: [6, 6, 10, 10],
|
|
1923
|
-
sx: { display: ["grid", "none", "none", "none"] }
|
|
1924
|
-
},
|
|
1925
|
-
/* @__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(
|
|
1926
|
-
button_default,
|
|
1927
|
-
{
|
|
1928
|
-
key: href,
|
|
1929
|
-
href,
|
|
1930
|
-
size: "xs",
|
|
1931
|
-
sx: { mb: [1] },
|
|
1932
|
-
suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
|
|
1933
|
-
},
|
|
1934
|
-
label
|
|
1935
|
-
))),
|
|
1936
|
-
/* @__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(
|
|
1937
|
-
button_default,
|
|
1938
|
-
{
|
|
1939
|
-
key: href,
|
|
1940
|
-
href,
|
|
1941
|
-
size: "xs",
|
|
1942
|
-
sx: { mb: [1] },
|
|
1943
|
-
suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
|
|
1944
|
-
},
|
|
1945
|
-
label
|
|
1946
|
-
))),
|
|
1947
|
-
/* @__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(
|
|
1948
|
-
button_default,
|
|
1949
|
-
{
|
|
1950
|
-
key: href,
|
|
1951
|
-
href,
|
|
1952
|
-
size: "xs",
|
|
1953
|
-
sx: { mb: [1] },
|
|
1954
|
-
suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
|
|
1955
|
-
},
|
|
1956
|
-
label
|
|
1957
|
-
)))
|
|
1902
|
+
/* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, group.label),
|
|
1903
|
+
group.links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
|
|
1904
|
+
button_default,
|
|
1905
|
+
{
|
|
1906
|
+
key: href,
|
|
1907
|
+
href,
|
|
1908
|
+
size: "md",
|
|
1909
|
+
sx: { mb: [1] },
|
|
1910
|
+
suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
|
|
1911
|
+
},
|
|
1912
|
+
label
|
|
1913
|
+
))
|
|
1914
|
+
))
|
|
1958
1915
|
));
|
|
1959
1916
|
};
|
|
1960
1917
|
var search_menu_default = SearchMenu;
|
|
@@ -2093,31 +2050,21 @@ var Header = ({ status, mode, nav, menuItems }) => {
|
|
|
2093
2050
|
transition: "opacity 0.25s"
|
|
2094
2051
|
}
|
|
2095
2052
|
},
|
|
2096
|
-
/* @__PURE__ */ React22.createElement(Container, null, /* @__PURE__ */ React22.createElement(row_default, null, menuExpanded
|
|
2097
|
-
|
|
2053
|
+
/* @__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(
|
|
2054
|
+
navigation_menu_default,
|
|
2098
2055
|
{
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
},
|
|
2105
|
-
/* @__PURE__ */ React22.createElement(
|
|
2106
|
-
navigation_menu_default,
|
|
2107
|
-
{
|
|
2108
|
-
nav,
|
|
2109
|
-
mode,
|
|
2110
|
-
setExpanded: setMenuExpanded
|
|
2111
|
-
}
|
|
2112
|
-
)
|
|
2113
|
-
)) : /* @__PURE__ */ React22.createElement(column_default, { start: [1, 2, 2, 2], width: [6, 6, 10, 10] }, /* @__PURE__ */ React22.createElement(search_menu_default, { setExpanded: setSearchExpanded }))))
|
|
2056
|
+
nav,
|
|
2057
|
+
mode,
|
|
2058
|
+
setExpanded: setMenuExpanded
|
|
2059
|
+
}
|
|
2060
|
+
))), searchExpanded && !menuExpanded && /* @__PURE__ */ React22.createElement(column_default, { start: [1, 2, 2, 2], width: [6, 6, 10, 10] }, /* @__PURE__ */ React22.createElement(search_menu_default, { setExpanded: setSearchExpanded }))))
|
|
2114
2061
|
)
|
|
2115
2062
|
);
|
|
2116
2063
|
};
|
|
2117
2064
|
var header_default = Header;
|
|
2118
2065
|
|
|
2119
2066
|
// src/footer.tsx
|
|
2120
|
-
import React24, { useState as useState4, useEffect as
|
|
2067
|
+
import React24, { useState as useState4, useEffect as useEffect4 } from "react";
|
|
2121
2068
|
import { Box as Box16, Flex as Flex4, Link as Link5 } from "theme-ui";
|
|
2122
2069
|
import { default as NextLink4 } from "next/link";
|
|
2123
2070
|
|
|
@@ -2146,7 +2093,7 @@ var monogram_default = Monogram;
|
|
|
2146
2093
|
// src/footer.tsx
|
|
2147
2094
|
var Footer = () => {
|
|
2148
2095
|
const [year, setYear] = useState4(null);
|
|
2149
|
-
|
|
2096
|
+
useEffect4(() => {
|
|
2150
2097
|
setYear((/* @__PURE__ */ new Date()).getFullYear());
|
|
2151
2098
|
}, []);
|
|
2152
2099
|
return /* @__PURE__ */ React24.createElement(
|
|
@@ -2411,7 +2358,7 @@ var dimmer_default = Dimmer;
|
|
|
2411
2358
|
// src/metadata.tsx
|
|
2412
2359
|
import React27 from "react";
|
|
2413
2360
|
import { Box as Box18, Text as Text2 } from "theme-ui";
|
|
2414
|
-
import { useState as useState5, useEffect as
|
|
2361
|
+
import { useState as useState5, useEffect as useEffect5 } from "react";
|
|
2415
2362
|
|
|
2416
2363
|
// src/gitsha.tsx
|
|
2417
2364
|
import React26 from "react";
|
|
@@ -2471,7 +2418,7 @@ var gitsha_default = GitSha;
|
|
|
2471
2418
|
// src/metadata.tsx
|
|
2472
2419
|
var Value = ({ mode }) => {
|
|
2473
2420
|
const [display, setDisplay] = useState5(init(mode));
|
|
2474
|
-
|
|
2421
|
+
useEffect5(() => {
|
|
2475
2422
|
if (mode === "mouse") {
|
|
2476
2423
|
const setFromEvent = (e) => {
|
|
2477
2424
|
const x = format(e.clientX, 4);
|
|
@@ -2585,7 +2532,7 @@ var FadeIn = (_a) => {
|
|
|
2585
2532
|
var fade_in_default = FadeIn;
|
|
2586
2533
|
|
|
2587
2534
|
// src/scrollbar.tsx
|
|
2588
|
-
import { useEffect as
|
|
2535
|
+
import { useEffect as useEffect6 } from "react";
|
|
2589
2536
|
|
|
2590
2537
|
// src/utils/get-scrollbar-width.ts
|
|
2591
2538
|
var getScrollbarWidth = (document2) => {
|
|
@@ -2605,7 +2552,7 @@ var get_scrollbar_width_default = getScrollbarWidth;
|
|
|
2605
2552
|
|
|
2606
2553
|
// src/scrollbar.tsx
|
|
2607
2554
|
var Scrollbar = () => {
|
|
2608
|
-
|
|
2555
|
+
useEffect6(() => {
|
|
2609
2556
|
if (typeof document !== "undefined") {
|
|
2610
2557
|
const delta = get_scrollbar_width_default(document);
|
|
2611
2558
|
if (delta > 0) {
|
|
@@ -2619,11 +2566,11 @@ var Scrollbar = () => {
|
|
|
2619
2566
|
var scrollbar_default = Scrollbar;
|
|
2620
2567
|
|
|
2621
2568
|
// src/guide.tsx
|
|
2622
|
-
import React29, { useState as useState6, useEffect as
|
|
2569
|
+
import React29, { useState as useState6, useEffect as useEffect7 } from "react";
|
|
2623
2570
|
import { Box as Box20, Container as Container2 } from "theme-ui";
|
|
2624
2571
|
var Guide = ({ color = "muted" }) => {
|
|
2625
2572
|
const [display, setDisplay] = useState6(false);
|
|
2626
|
-
|
|
2573
|
+
useEffect7(() => {
|
|
2627
2574
|
function handler(event) {
|
|
2628
2575
|
const { key, metaKey } = event;
|
|
2629
2576
|
if (key === ";" && metaKey) {
|
|
@@ -2759,7 +2706,7 @@ var Layout = ({
|
|
|
2759
2706
|
display: "none"
|
|
2760
2707
|
}
|
|
2761
2708
|
} : {};
|
|
2762
|
-
|
|
2709
|
+
useEffect8(() => {
|
|
2763
2710
|
var _a;
|
|
2764
2711
|
if (!theme) return;
|
|
2765
2712
|
const handler = (e) => {
|
|
@@ -3699,10 +3646,10 @@ var formatDate = (date, options = defaultOptions) => {
|
|
|
3699
3646
|
var format_date_default = formatDate;
|
|
3700
3647
|
|
|
3701
3648
|
// src/utils/use-scrollbar-class.ts
|
|
3702
|
-
import { useEffect as
|
|
3649
|
+
import { useEffect as useEffect9, useState as useState7 } from "react";
|
|
3703
3650
|
var useScrollbarClass = () => {
|
|
3704
3651
|
const [className, setClassName] = useState7(null);
|
|
3705
|
-
|
|
3652
|
+
useEffect9(() => {
|
|
3706
3653
|
if (document && get_scrollbar_width_default(document) > 0) {
|
|
3707
3654
|
setClassName("custom-scrollbar");
|
|
3708
3655
|
}
|