@carbonplan/components 13.4.0-develop.2 → 13.4.0
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 +21 -8
- package/dst/index.js.map +1 -1
- package/dst/index.mjs +34 -21
- 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 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
|
|
|
@@ -1702,7 +1702,7 @@ var navigation_menu_default = NavigationMenu;
|
|
|
1702
1702
|
import React19 from "react";
|
|
1703
1703
|
import { Search as SearchIcon } from "@carbonplan/icons";
|
|
1704
1704
|
var Search = (props) => {
|
|
1705
|
-
return /* @__PURE__ */ React19.createElement(header_icon_default, __spreadProps(__spreadValues({}, props), { label: "Toggle Search" }), /* @__PURE__ */ React19.createElement(SearchIcon, { width: 50, height: 30, x: 8 }));
|
|
1705
|
+
return /* @__PURE__ */ React19.createElement(header_icon_default, __spreadProps(__spreadValues({}, props), { label: "Toggle Search" }), /* @__PURE__ */ React19.createElement(SearchIcon, { width: 50, height: 30, x: 8, y: 1 }));
|
|
1706
1706
|
};
|
|
1707
1707
|
var search_default = Search;
|
|
1708
1708
|
|
|
@@ -1794,13 +1794,17 @@ var sx2 = {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
};
|
|
1796
1796
|
var SearchMenu = ({
|
|
1797
|
-
setExpanded
|
|
1797
|
+
setExpanded,
|
|
1798
|
+
mode
|
|
1798
1799
|
}) => {
|
|
1799
1800
|
const [value, setValue] = useState2("");
|
|
1800
1801
|
const [resources, setResources] = useState2(RESOURCES);
|
|
1801
|
-
const
|
|
1802
|
+
const baseUrl = mode === "remote" ? "https://carbonplan.org" : "";
|
|
1803
|
+
const destination = `${baseUrl}/search?query=${encodeURIComponent(
|
|
1804
|
+
value.trim()
|
|
1805
|
+
)}`;
|
|
1802
1806
|
useEffect3(() => {
|
|
1803
|
-
fetch(
|
|
1807
|
+
fetch(`${baseUrl}/resources.json`).then((res) => res.json()).then((res) => {
|
|
1804
1808
|
if (res.every((el) => el.label && Array.isArray(el.links))) {
|
|
1805
1809
|
setResources(res);
|
|
1806
1810
|
}
|
|
@@ -1897,7 +1901,8 @@ var SearchMenu = ({
|
|
|
1897
1901
|
column_default,
|
|
1898
1902
|
{
|
|
1899
1903
|
start: [1, 1 + i * 3 % 6, 2 + i * 3 % 9, 2 + i * 3 % 9],
|
|
1900
|
-
width: [6, 3, 3, 3]
|
|
1904
|
+
width: [6, 3, 3, 3],
|
|
1905
|
+
key: group.label
|
|
1901
1906
|
},
|
|
1902
1907
|
/* @__PURE__ */ React21.createElement(Box13, { sx: sx2.highlight }, group.label),
|
|
1903
1908
|
group.links.map(({ label, href }) => /* @__PURE__ */ React21.createElement(
|
|
@@ -1921,6 +1926,12 @@ var Header = ({ status, mode, nav, menuItems }) => {
|
|
|
1921
1926
|
const [menuExpanded, setMenuExpanded] = useState3(false);
|
|
1922
1927
|
const [searchExpanded, setSearchExpanded] = useState3(false);
|
|
1923
1928
|
const expanded = searchExpanded || menuExpanded;
|
|
1929
|
+
useEffect4(() => {
|
|
1930
|
+
document.body.style.overflow = expanded ? "hidden" : "";
|
|
1931
|
+
return () => {
|
|
1932
|
+
document.body.style.overflow = "";
|
|
1933
|
+
};
|
|
1934
|
+
}, [expanded]);
|
|
1924
1935
|
return /* @__PURE__ */ React22.createElement(
|
|
1925
1936
|
row_default,
|
|
1926
1937
|
{
|
|
@@ -2047,7 +2058,9 @@ var Header = ({ status, mode, nav, menuItems }) => {
|
|
|
2047
2058
|
backgroundColor: "background",
|
|
2048
2059
|
zIndex: 4e3,
|
|
2049
2060
|
pt: ["79px"],
|
|
2050
|
-
transition: "opacity 0.25s"
|
|
2061
|
+
transition: "opacity 0.25s",
|
|
2062
|
+
overflowY: "auto",
|
|
2063
|
+
overscrollBehavior: "contain"
|
|
2051
2064
|
}
|
|
2052
2065
|
},
|
|
2053
2066
|
/* @__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(
|
|
@@ -2057,14 +2070,14 @@ var Header = ({ status, mode, nav, menuItems }) => {
|
|
|
2057
2070
|
mode,
|
|
2058
2071
|
setExpanded: setMenuExpanded
|
|
2059
2072
|
}
|
|
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 }))))
|
|
2073
|
+
))), searchExpanded && !menuExpanded && /* @__PURE__ */ React22.createElement(column_default, { start: [1, 2, 2, 2], width: [6, 6, 10, 10] }, /* @__PURE__ */ React22.createElement(search_menu_default, { mode, setExpanded: setSearchExpanded }))))
|
|
2061
2074
|
)
|
|
2062
2075
|
);
|
|
2063
2076
|
};
|
|
2064
2077
|
var header_default = Header;
|
|
2065
2078
|
|
|
2066
2079
|
// src/footer.tsx
|
|
2067
|
-
import React24, { useState as useState4, useEffect as
|
|
2080
|
+
import React24, { useState as useState4, useEffect as useEffect5 } from "react";
|
|
2068
2081
|
import { Box as Box16, Flex as Flex4, Link as Link5 } from "theme-ui";
|
|
2069
2082
|
import { default as NextLink4 } from "next/link";
|
|
2070
2083
|
|
|
@@ -2093,7 +2106,7 @@ var monogram_default = Monogram;
|
|
|
2093
2106
|
// src/footer.tsx
|
|
2094
2107
|
var Footer = () => {
|
|
2095
2108
|
const [year, setYear] = useState4(null);
|
|
2096
|
-
|
|
2109
|
+
useEffect5(() => {
|
|
2097
2110
|
setYear((/* @__PURE__ */ new Date()).getFullYear());
|
|
2098
2111
|
}, []);
|
|
2099
2112
|
return /* @__PURE__ */ React24.createElement(
|
|
@@ -2358,7 +2371,7 @@ var dimmer_default = Dimmer;
|
|
|
2358
2371
|
// src/metadata.tsx
|
|
2359
2372
|
import React27 from "react";
|
|
2360
2373
|
import { Box as Box18, Text as Text2 } from "theme-ui";
|
|
2361
|
-
import { useState as useState5, useEffect as
|
|
2374
|
+
import { useState as useState5, useEffect as useEffect6 } from "react";
|
|
2362
2375
|
|
|
2363
2376
|
// src/gitsha.tsx
|
|
2364
2377
|
import React26 from "react";
|
|
@@ -2418,7 +2431,7 @@ var gitsha_default = GitSha;
|
|
|
2418
2431
|
// src/metadata.tsx
|
|
2419
2432
|
var Value = ({ mode }) => {
|
|
2420
2433
|
const [display, setDisplay] = useState5(init(mode));
|
|
2421
|
-
|
|
2434
|
+
useEffect6(() => {
|
|
2422
2435
|
if (mode === "mouse") {
|
|
2423
2436
|
const setFromEvent = (e) => {
|
|
2424
2437
|
const x = format(e.clientX, 4);
|
|
@@ -2523,7 +2536,7 @@ var FadeIn = (_a) => {
|
|
|
2523
2536
|
animationDelay: delay + "ms",
|
|
2524
2537
|
animationName: fade.toString(),
|
|
2525
2538
|
animationFillMode: "backwards",
|
|
2526
|
-
|
|
2539
|
+
willChange: "opacity"
|
|
2527
2540
|
}
|
|
2528
2541
|
}),
|
|
2529
2542
|
children
|
|
@@ -2532,7 +2545,7 @@ var FadeIn = (_a) => {
|
|
|
2532
2545
|
var fade_in_default = FadeIn;
|
|
2533
2546
|
|
|
2534
2547
|
// src/scrollbar.tsx
|
|
2535
|
-
import { useEffect as
|
|
2548
|
+
import { useEffect as useEffect7 } from "react";
|
|
2536
2549
|
|
|
2537
2550
|
// src/utils/get-scrollbar-width.ts
|
|
2538
2551
|
var getScrollbarWidth = (document2) => {
|
|
@@ -2552,7 +2565,7 @@ var get_scrollbar_width_default = getScrollbarWidth;
|
|
|
2552
2565
|
|
|
2553
2566
|
// src/scrollbar.tsx
|
|
2554
2567
|
var Scrollbar = () => {
|
|
2555
|
-
|
|
2568
|
+
useEffect7(() => {
|
|
2556
2569
|
if (typeof document !== "undefined") {
|
|
2557
2570
|
const delta = get_scrollbar_width_default(document);
|
|
2558
2571
|
if (delta > 0) {
|
|
@@ -2566,11 +2579,11 @@ var Scrollbar = () => {
|
|
|
2566
2579
|
var scrollbar_default = Scrollbar;
|
|
2567
2580
|
|
|
2568
2581
|
// src/guide.tsx
|
|
2569
|
-
import React29, { useState as useState6, useEffect as
|
|
2582
|
+
import React29, { useState as useState6, useEffect as useEffect8 } from "react";
|
|
2570
2583
|
import { Box as Box20, Container as Container2 } from "theme-ui";
|
|
2571
2584
|
var Guide = ({ color = "muted" }) => {
|
|
2572
2585
|
const [display, setDisplay] = useState6(false);
|
|
2573
|
-
|
|
2586
|
+
useEffect8(() => {
|
|
2574
2587
|
function handler(event) {
|
|
2575
2588
|
const { key, metaKey } = event;
|
|
2576
2589
|
if (key === ";" && metaKey) {
|
|
@@ -2706,7 +2719,7 @@ var Layout = ({
|
|
|
2706
2719
|
display: "none"
|
|
2707
2720
|
}
|
|
2708
2721
|
} : {};
|
|
2709
|
-
|
|
2722
|
+
useEffect9(() => {
|
|
2710
2723
|
var _a;
|
|
2711
2724
|
if (!theme) return;
|
|
2712
2725
|
const handler = (e) => {
|
|
@@ -3646,10 +3659,10 @@ var formatDate = (date, options = defaultOptions) => {
|
|
|
3646
3659
|
var format_date_default = formatDate;
|
|
3647
3660
|
|
|
3648
3661
|
// src/utils/use-scrollbar-class.ts
|
|
3649
|
-
import { useEffect as
|
|
3662
|
+
import { useEffect as useEffect10, useState as useState7 } from "react";
|
|
3650
3663
|
var useScrollbarClass = () => {
|
|
3651
3664
|
const [className, setClassName] = useState7(null);
|
|
3652
|
-
|
|
3665
|
+
useEffect10(() => {
|
|
3653
3666
|
if (document && get_scrollbar_width_default(document) > 0) {
|
|
3654
3667
|
setClassName("custom-scrollbar");
|
|
3655
3668
|
}
|