@carbonplan/components 13.2.2 → 13.4.0-develop.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.mjs ADDED
@@ -0,0 +1,3760 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __export = (target, all) => {
33
+ for (var name in all)
34
+ __defProp(target, name, { get: all[name], enumerable: true });
35
+ };
36
+
37
+ // src/avatar.tsx
38
+ import React from "react";
39
+ import { Box, Image } from "theme-ui";
40
+ var Avatar = (_a) => {
41
+ var _b = _a, {
42
+ color = "transparent",
43
+ width = "90px",
44
+ maxWidth,
45
+ name,
46
+ github,
47
+ alt,
48
+ src,
49
+ sx: sx4
50
+ } = _b, props = __objRest(_b, [
51
+ "color",
52
+ "width",
53
+ "maxWidth",
54
+ "name",
55
+ "github",
56
+ "alt",
57
+ "src",
58
+ "sx"
59
+ ]);
60
+ if (!name && !src && !github) {
61
+ console.warn("must specify either name, github, or src");
62
+ }
63
+ let srcProp, altProp;
64
+ if (name) {
65
+ srcProp = `https://images.carbonplan.org/team/${name.toLowerCase().replaceAll(" ", "-")}.png`;
66
+ altProp = alt || name;
67
+ } else if (github) {
68
+ srcProp = `https://github.com/${github}.png`;
69
+ altProp = alt || github;
70
+ } else {
71
+ srcProp = src;
72
+ altProp = alt;
73
+ }
74
+ return /* @__PURE__ */ React.createElement(
75
+ Box,
76
+ __spreadValues({
77
+ sx: __spreadValues({
78
+ width,
79
+ maxWidth,
80
+ height: "auto",
81
+ borderRadius: "50%",
82
+ overflow: "hidden",
83
+ position: "relative",
84
+ display: "inline-block",
85
+ verticalAlign: "top"
86
+ }, sx4)
87
+ }, props),
88
+ /* @__PURE__ */ React.createElement(
89
+ Image,
90
+ {
91
+ alt: altProp,
92
+ src: srcProp,
93
+ sx: {
94
+ filter: color && color !== "transparent" ? "grayscale(100%) contrast(200%) brightness(100%)" : "none",
95
+ width: "100%",
96
+ display: "block"
97
+ }
98
+ }
99
+ ),
100
+ color && color !== "transparent" && /* @__PURE__ */ React.createElement(
101
+ Box,
102
+ {
103
+ sx: {
104
+ position: "absolute",
105
+ top: 0,
106
+ bg: color,
107
+ width: "100%",
108
+ height: "100%",
109
+ opacity: 0.75,
110
+ pointerEvents: "none"
111
+ }
112
+ }
113
+ )
114
+ );
115
+ };
116
+ var avatar_default = Avatar;
117
+
118
+ // src/avatar-group.tsx
119
+ import React5 from "react";
120
+ import { Box as Box4 } from "theme-ui";
121
+
122
+ // src/row.tsx
123
+ import React2 from "react";
124
+ import { Grid } from "theme-ui";
125
+ var Row = (_a) => {
126
+ var _b = _a, { children, sx: sx4, columns, gap } = _b, props = __objRest(_b, ["children", "sx", "columns", "gap"]);
127
+ const makeArray = (input) => {
128
+ if (!Array.isArray(input)) {
129
+ input = [input, input, input, input];
130
+ }
131
+ if (Array.isArray(input) && ![1, 2, 4].includes(input.length)) {
132
+ throw new Error("Array length must be 1, 2, or 4");
133
+ }
134
+ if (Array.isArray(input) && input.length === 1) {
135
+ input = input.map((d) => [d]).flat();
136
+ }
137
+ if (Array.isArray(input) && input.length === 2) {
138
+ input = input.map((d) => [d, d]).flat();
139
+ }
140
+ return input;
141
+ };
142
+ let columnGap, rowGap;
143
+ if (Number.isInteger(gap) || Array.isArray(gap)) {
144
+ gap = makeArray(gap);
145
+ columnGap = gap;
146
+ rowGap = gap;
147
+ } else {
148
+ columnGap = [4, 5, 5, 6];
149
+ rowGap = [0, 0, 0, 0];
150
+ }
151
+ if (Number.isInteger(columns) || Array.isArray(columns)) {
152
+ columns = makeArray(columns);
153
+ } else {
154
+ columns = [6, 8, 12, 12];
155
+ }
156
+ return /* @__PURE__ */ React2.createElement(
157
+ Grid,
158
+ __spreadProps(__spreadValues({}, props), {
159
+ columns,
160
+ sx: __spreadValues({
161
+ columnGap,
162
+ rowGap
163
+ }, sx4)
164
+ }),
165
+ children
166
+ );
167
+ };
168
+ var row_default = Row;
169
+
170
+ // src/column.tsx
171
+ import React3 from "react";
172
+ import { Box as Box2 } from "theme-ui";
173
+ var Column = (_a) => {
174
+ var _b = _a, {
175
+ start,
176
+ width,
177
+ dl,
178
+ dr,
179
+ children,
180
+ sx: sx4
181
+ } = _b, props = __objRest(_b, [
182
+ "start",
183
+ "width",
184
+ "dl",
185
+ "dr",
186
+ "children",
187
+ "sx"
188
+ ]);
189
+ start = start || "auto";
190
+ width = width || "auto";
191
+ const makeArray = (input) => {
192
+ let arr = Array.isArray(input) ? input : [input];
193
+ if (![1, 2, 4].includes(arr.length)) {
194
+ throw new Error("Array length must be 1, 2, or 4");
195
+ }
196
+ if (arr.length === 1) {
197
+ arr = arr.map((d) => [d, d, d, d]).flat();
198
+ } else if (arr.length === 2) {
199
+ arr = arr.map((d) => [d, d]).flat();
200
+ }
201
+ return arr;
202
+ };
203
+ const startArray = makeArray(start);
204
+ const widthArray = makeArray(width);
205
+ const end = startArray.map((d, i) => {
206
+ if (d === "auto" || widthArray[i] === "auto") return "auto";
207
+ return d + widthArray[i];
208
+ });
209
+ let ml, mr;
210
+ if (dl) {
211
+ if (![0.5, 1].includes(dl)) {
212
+ throw new Error("dl must be 0.5 or 1");
213
+ }
214
+ if (dl === 0.5) {
215
+ ml = ["-12px", -3, -3, -4];
216
+ }
217
+ if (dl === 1) {
218
+ ml = [-4, -5, -5, -6];
219
+ }
220
+ }
221
+ if (dr) {
222
+ if (![0.5, 1].includes(dr)) {
223
+ throw new Error("dr must be 0.5 or 1");
224
+ }
225
+ if (dr === 0.5) {
226
+ mr = ["-12px", -3, -3, -4];
227
+ }
228
+ if (dr === 1) {
229
+ mr = [-4, -5, -5, -6];
230
+ }
231
+ }
232
+ return /* @__PURE__ */ React3.createElement(
233
+ Box2,
234
+ __spreadProps(__spreadValues({}, props), {
235
+ sx: __spreadValues({
236
+ gridColumnStart: startArray,
237
+ gridColumnEnd: end,
238
+ ml,
239
+ mr
240
+ }, sx4)
241
+ }),
242
+ children
243
+ );
244
+ };
245
+ var column_default = Column;
246
+
247
+ // src/group.tsx
248
+ import React4 from "react";
249
+ import { Box as Box3 } from "theme-ui";
250
+ var sizes = {
251
+ xs: [1],
252
+ sm: [3],
253
+ md: [5],
254
+ lg: [7],
255
+ xl: [9]
256
+ };
257
+ var Group = ({
258
+ children,
259
+ direction = "vertical",
260
+ spacing = "md",
261
+ sx: sx4
262
+ }) => {
263
+ let marginValue;
264
+ if (typeof spacing === "string" && spacing in sizes) {
265
+ marginValue = sizes[spacing];
266
+ } else {
267
+ marginValue = spacing;
268
+ }
269
+ if (!["horizontal", "vertical"].includes(direction)) {
270
+ throw new Error(
271
+ "Invalid direction value. Must be either horizontal or vertical"
272
+ );
273
+ }
274
+ const marginProperty = direction === "vertical" ? "mb" : "mr";
275
+ const additionalStyles = direction === "horizontal" ? { display: "inline-block" } : {};
276
+ return /* @__PURE__ */ React4.createElement(Box3, { sx: sx4 }, React4.Children.map(children, (child, i) => {
277
+ const childrenCount = React4.Children.count(children);
278
+ return /* @__PURE__ */ React4.createElement(
279
+ Box3,
280
+ {
281
+ sx: __spreadValues({
282
+ [marginProperty]: i < childrenCount - 1 ? marginValue : 0
283
+ }, additionalStyles)
284
+ },
285
+ child
286
+ );
287
+ }));
288
+ };
289
+ var group_default = Group;
290
+
291
+ // src/avatar-group.tsx
292
+ var sizes2 = {
293
+ xs: [1],
294
+ sm: [3],
295
+ md: [5],
296
+ lg: [7],
297
+ xl: [9]
298
+ };
299
+ var Blank = ({ overflow, maxWidth }) => {
300
+ return /* @__PURE__ */ React5.createElement(
301
+ Box4,
302
+ {
303
+ sx: {
304
+ bg: "muted",
305
+ height: "100%",
306
+ maxWidth,
307
+ borderRadius: "50%"
308
+ }
309
+ },
310
+ /* @__PURE__ */ React5.createElement(
311
+ Box4,
312
+ {
313
+ sx: {
314
+ display: "flex",
315
+ justifyContent: "center",
316
+ alignItems: "center",
317
+ height: "100%"
318
+ }
319
+ },
320
+ /* @__PURE__ */ React5.createElement(
321
+ Box4,
322
+ {
323
+ sx: {
324
+ fontFamily: "mono",
325
+ letterSpacing: "mono",
326
+ fontSize: [3, 3, 3, 4]
327
+ }
328
+ },
329
+ "+",
330
+ overflow
331
+ )
332
+ )
333
+ );
334
+ };
335
+ var AvatarGroup = (_a) => {
336
+ var _b = _a, {
337
+ members,
338
+ direction = "horizontal",
339
+ align,
340
+ spacing = "md",
341
+ limit,
342
+ width,
343
+ maxWidth,
344
+ fixedCount,
345
+ sx: sx4
346
+ } = _b, props = __objRest(_b, [
347
+ "members",
348
+ "direction",
349
+ "align",
350
+ "spacing",
351
+ "limit",
352
+ "width",
353
+ "maxWidth",
354
+ "fixedCount",
355
+ "sx"
356
+ ]);
357
+ let gap;
358
+ if (typeof spacing === "string" && spacing in sizes2) {
359
+ gap = sizes2[spacing];
360
+ } else {
361
+ gap = spacing;
362
+ }
363
+ let start = (_idx) => "auto";
364
+ if (align) {
365
+ const alignArray = Array.isArray(align) ? align : [align];
366
+ start = (idx) => {
367
+ return alignArray.map((d) => {
368
+ if (d === "left") {
369
+ return "auto";
370
+ } else if (d === "right") {
371
+ const offset = Math.max(0, (fixedCount != null ? fixedCount : 0) - members.length);
372
+ return (offset + idx) % (fixedCount != null ? fixedCount : 1) + 1;
373
+ } else {
374
+ throw Error(`alignment '${d}' not recognized`);
375
+ }
376
+ });
377
+ };
378
+ }
379
+ const excess = limit !== void 0 && members.length > limit;
380
+ const overflow = limit !== void 0 ? members.length - limit + 1 : 0;
381
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, fixedCount && /* @__PURE__ */ React5.createElement(row_default, __spreadValues({ columns: fixedCount, gap, sx: sx4 }, props), members.map((props2, idx) => /* @__PURE__ */ React5.createElement(column_default, { key: idx, start: start(idx) }, (!excess || limit !== void 0 && idx < limit - 1) && /* @__PURE__ */ React5.createElement(avatar_default, __spreadProps(__spreadValues({}, props2), { width, maxWidth })), excess && limit !== void 0 && idx === limit - 1 && /* @__PURE__ */ React5.createElement(Blank, { overflow, maxWidth })))), !fixedCount && /* @__PURE__ */ React5.createElement(group_default, __spreadValues({ direction, spacing, sx: sx4 }, props), members.map((props2, idx) => /* @__PURE__ */ React5.createElement(avatar_default, __spreadProps(__spreadValues({ key: idx }, props2), { width, maxWidth })))));
382
+ };
383
+ var avatar_group_default = AvatarGroup;
384
+
385
+ // src/badge.tsx
386
+ import React6 from "react";
387
+ import { Box as Box5 } from "theme-ui";
388
+ import { transparentize } from "@theme-ui/color";
389
+
390
+ // src/utils/get-sx-color.ts
391
+ var getSxColor = (sx4, fallback = "primary") => sx4 && typeof sx4 === "object" && "color" in sx4 && typeof sx4.color === "string" ? sx4.color : fallback;
392
+ var get_sx_color_default = getSxColor;
393
+
394
+ // src/badge.tsx
395
+ var Badge = (_a) => {
396
+ var _b = _a, { sx: sx4, children } = _b, props = __objRest(_b, ["sx", "children"]);
397
+ const color = get_sx_color_default(sx4);
398
+ return /* @__PURE__ */ React6.createElement(
399
+ Box5,
400
+ __spreadValues({
401
+ sx: __spreadValues({
402
+ display: "inline-block",
403
+ width: "fit-content",
404
+ height: ["24px", "24px", "24px", "26px"],
405
+ borderRadius: "5px",
406
+ backgroundColor: color === "primary" || color === "secondary" ? "muted" : transparentize(color, 0.7),
407
+ textAlign: "center",
408
+ userSelect: "none",
409
+ fontSize: [2, 2, 2, 3]
410
+ }, sx4)
411
+ }, props),
412
+ /* @__PURE__ */ React6.createElement(
413
+ Box5,
414
+ {
415
+ sx: {
416
+ letterSpacing: "0.02em",
417
+ fontFamily: "mono",
418
+ mt: ["1px", "1px", "1px", "0px"],
419
+ px: [1, 1, 1, "5px"],
420
+ color
421
+ }
422
+ },
423
+ children
424
+ )
425
+ );
426
+ };
427
+ var badge_default = Badge;
428
+
429
+ // src/blockquote.tsx
430
+ import React7, { Children } from "react";
431
+ import { Box as Box6 } from "theme-ui";
432
+ var specialChars = ["\u201C", '"', "'", "\u2018"];
433
+ var Blockquote = ({ children }) => {
434
+ return /* @__PURE__ */ React7.createElement(Box6, { variant: "styles.blockquote" }, Children.map(children, (d) => {
435
+ let firstChar = "";
436
+ let remaining = d;
437
+ if (React7.isValidElement(d) && typeof d.props.children === "string") {
438
+ firstChar = d.props.children.slice(0, 1);
439
+ remaining = d.props.children.slice(1);
440
+ } else if (typeof d === "string") {
441
+ firstChar = d.slice(0, 1);
442
+ remaining = d.slice(1);
443
+ }
444
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, specialChars.includes(firstChar) && /* @__PURE__ */ React7.createElement(Box6, { as: "span", sx: { position: "absolute", ml: "-0.4em" } }, firstChar), specialChars.includes(firstChar) ? remaining : d);
445
+ }));
446
+ };
447
+ var blockquote_default = Blockquote;
448
+
449
+ // src/button.tsx
450
+ import React9, { forwardRef as forwardRef2, cloneElement } from "react";
451
+ import { Box as Box7 } from "theme-ui";
452
+
453
+ // src/link.tsx
454
+ import React8, { forwardRef } from "react";
455
+ import { Link as ThemedLink } from "theme-ui";
456
+ import { default as NextLink } from "next/link";
457
+ var Link = (_a, ref) => {
458
+ var _b = _a, { href, children, internal = false } = _b, props = __objRest(_b, ["href", "children", "internal"]);
459
+ if (href && (internal || href.startsWith("/"))) {
460
+ return /* @__PURE__ */ React8.createElement(NextLink, { href, passHref: true, legacyBehavior: true }, /* @__PURE__ */ React8.createElement(ThemedLink, __spreadValues({ ref }, props), children));
461
+ } else {
462
+ return /* @__PURE__ */ React8.createElement(ThemedLink, __spreadValues({ ref, href }, props), children);
463
+ }
464
+ };
465
+ var link_default = forwardRef(Link);
466
+
467
+ // src/utils/get-size-styles.ts
468
+ var getSizeStyles = (size) => {
469
+ if (!["xs", "sm", "md", "lg", "xl"].includes(size)) {
470
+ throw new Error("Size must be xs, sm, md, lg, or xl");
471
+ }
472
+ let fontSize, fontFamily, letterSpacing, lineHeight;
473
+ if (size === "xs") {
474
+ fontSize = [2, 2, 2, 3];
475
+ fontFamily = "body";
476
+ letterSpacing = "body";
477
+ lineHeight = [1.2];
478
+ }
479
+ if (size === "sm") {
480
+ fontSize = [3, 3, 3, 4];
481
+ fontFamily = "body";
482
+ letterSpacing = "body";
483
+ lineHeight = [1.2];
484
+ }
485
+ if (size === "md") {
486
+ fontSize = [4, 4, 4, 5];
487
+ fontFamily = "body";
488
+ letterSpacing = "body";
489
+ lineHeight = [1.2];
490
+ }
491
+ if (size === "lg") {
492
+ fontSize = [5, 5, 6, 7];
493
+ fontFamily = "heading";
494
+ letterSpacing = "heading";
495
+ lineHeight = [1.2, 1.2, 1.25, 1.25];
496
+ }
497
+ if (size === "xl") {
498
+ fontSize = [6, 7, 8, 9];
499
+ fontFamily = "heading";
500
+ letterSpacing = "heading";
501
+ lineHeight = [1.25];
502
+ }
503
+ return { fontSize, fontFamily, letterSpacing, lineHeight };
504
+ };
505
+ var get_size_styles_default = getSizeStyles;
506
+
507
+ // src/button.tsx
508
+ var hasHoverProp = (comp) => {
509
+ if (comp == null) return false;
510
+ const isObjectOrFunction = typeof comp === "object" || typeof comp === "function";
511
+ return isObjectOrFunction && "hover" in comp;
512
+ };
513
+ var Button = (_a, ref) => {
514
+ var _b = _a, {
515
+ size = "sm",
516
+ prefix,
517
+ suffix,
518
+ inverted,
519
+ sx: sx4,
520
+ children,
521
+ align,
522
+ href,
523
+ internal
524
+ } = _b, props = __objRest(_b, [
525
+ "size",
526
+ "prefix",
527
+ "suffix",
528
+ "inverted",
529
+ "sx",
530
+ "children",
531
+ "align",
532
+ "href",
533
+ "internal"
534
+ ]);
535
+ var _b2, _c;
536
+ if (!["xs", "sm", "md", "lg", "xl"].includes(size)) {
537
+ throw new Error("Size must be xs, sm, md, lg, or xl");
538
+ }
539
+ const _a2 = sx4 && typeof sx4 === "object" ? sx4 : {}, { color: sxColor } = _a2, sxProp = __objRest(_a2, ["color"]);
540
+ const baseColor = typeof sxColor === "string" && sxColor || (inverted ? "secondary" : "primary");
541
+ const hoverColor = sxColor ? "primary" : inverted ? "primary" : "secondary";
542
+ const sizeConfig = {
543
+ xs: {
544
+ margin: ["6px", "6px", "6px", "6px"],
545
+ height: [12, 12, 12, 13],
546
+ width: [12, 12, 12, 13],
547
+ strokeWidth: [1.5, 1.5, 1.5, 1.5],
548
+ offset: { transform: "translateY(0.25px)" }
549
+ },
550
+ sm: {
551
+ margin: ["7px", "7px", "7px", "7px"],
552
+ height: [13, 13, 13, 18],
553
+ width: [13, 13, 13, 18],
554
+ strokeWidth: [1.5, 1.5, 1.5, 2],
555
+ offset: { transform: "translateY(0.25px)" }
556
+ },
557
+ md: {
558
+ margin: ["8px", "8px", "8px", "8px"],
559
+ height: [18, 18, 18, 24],
560
+ width: [18, 18, 18, 24],
561
+ strokeWidth: [2, 2, 2, 3],
562
+ offset: {}
563
+ },
564
+ lg: {
565
+ margin: ["10px", "10px", "12px", "16px"],
566
+ height: [24, 24, 34, 46],
567
+ width: [24, 24, 34, 46],
568
+ strokeWidth: [3, 3, 4, 5],
569
+ offset: {}
570
+ },
571
+ xl: {
572
+ margin: ["12px", "16px", "18px", "20px"],
573
+ height: [34, 46, 56, 68],
574
+ width: [34, 46, 56, 68],
575
+ strokeWidth: [4, 5, 6, 7],
576
+ offset: {}
577
+ }
578
+ };
579
+ const { margin, height, width, strokeWidth, offset } = sizeConfig[size];
580
+ let prefixHover, suffixHover, prefixAlign, suffixAlign, prefixOffset, suffixOffset;
581
+ if (align) {
582
+ prefixAlign = align;
583
+ suffixAlign = align;
584
+ } else {
585
+ if (prefix && suffix) {
586
+ prefixAlign = "initial";
587
+ suffixAlign = "initial";
588
+ } else if (prefix) {
589
+ prefixAlign = "initial";
590
+ } else if (suffix) {
591
+ suffixAlign = "middle";
592
+ }
593
+ }
594
+ if (prefixAlign === "middle") {
595
+ prefixOffset = {};
596
+ } else {
597
+ prefixOffset = offset;
598
+ }
599
+ if (suffixAlign === "middle") {
600
+ suffixOffset = {};
601
+ } else {
602
+ suffixOffset = offset;
603
+ }
604
+ let clonedPrefix, clonedSuffix;
605
+ if (prefix) {
606
+ prefixHover = {
607
+ "&:hover > #prefix-span > #prefix": __spreadValues({
608
+ color: hoverColor
609
+ }, hasHoverProp(prefix.type) ? prefix.type.hover : {})
610
+ };
611
+ clonedPrefix = cloneElement(prefix, {
612
+ id: "prefix",
613
+ sx: __spreadValues({
614
+ position: "relative",
615
+ height,
616
+ width,
617
+ mr: children ? margin : [0],
618
+ strokeWidth,
619
+ verticalAlign: prefixAlign,
620
+ transition: "color 0.15s, transform 0.15s"
621
+ }, (_b2 = prefix.props) == null ? void 0 : _b2.sx)
622
+ });
623
+ }
624
+ if (suffix) {
625
+ suffixHover = {
626
+ "&:hover > #suffix-span >#suffix": __spreadValues({
627
+ color: hoverColor
628
+ }, hasHoverProp(suffix.type) ? suffix.type.hover : {})
629
+ };
630
+ clonedSuffix = cloneElement(suffix, {
631
+ id: "suffix",
632
+ sx: __spreadValues({
633
+ height,
634
+ width,
635
+ ml: children ? margin : [0],
636
+ strokeWidth,
637
+ verticalAlign: suffixAlign,
638
+ transition: "color 0.15s, transform 0.15s"
639
+ }, (_c = suffix.props) == null ? void 0 : _c.sx)
640
+ });
641
+ }
642
+ let sizeStyles = get_size_styles_default(size);
643
+ const style = __spreadValues(__spreadProps(__spreadValues({}, sizeStyles), {
644
+ lineHeight: 1.05,
645
+ border: "none",
646
+ background: "transparent",
647
+ display: "block",
648
+ color: baseColor,
649
+ padding: [0],
650
+ textAlign: "left",
651
+ cursor: "pointer",
652
+ width: "fit-content",
653
+ "@media (hover: hover) and (pointer: fine)": __spreadValues(__spreadValues({
654
+ "&:hover": {
655
+ color: hoverColor
656
+ }
657
+ }, suffixHover), prefixHover)
658
+ }), sxProp);
659
+ const Inner = /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
660
+ Box7,
661
+ {
662
+ as: "span",
663
+ id: "prefix-span",
664
+ sx: __spreadValues({ display: "inline-block" }, prefixOffset)
665
+ },
666
+ clonedPrefix
667
+ ), /* @__PURE__ */ React9.createElement(Box7, { as: "span", sx: { transition: "color 0.15s" } }, children), /* @__PURE__ */ React9.createElement(
668
+ Box7,
669
+ {
670
+ as: "span",
671
+ id: "suffix-span",
672
+ sx: __spreadValues({ display: "inline-block" }, suffixOffset)
673
+ },
674
+ clonedSuffix
675
+ ));
676
+ if (href) {
677
+ return /* @__PURE__ */ React9.createElement(
678
+ link_default,
679
+ __spreadProps(__spreadValues({
680
+ ref,
681
+ internal,
682
+ sx: __spreadProps(__spreadValues({}, style), {
683
+ textDecoration: "none"
684
+ })
685
+ }, props), {
686
+ href
687
+ }),
688
+ Inner
689
+ );
690
+ } else {
691
+ return /* @__PURE__ */ React9.createElement(
692
+ Box7,
693
+ __spreadValues({
694
+ ref,
695
+ as: "button",
696
+ sx: style
697
+ }, props),
698
+ Inner
699
+ );
700
+ }
701
+ };
702
+ var button_default = forwardRef2(
703
+ Button
704
+ );
705
+
706
+ // src/callout.tsx
707
+ import React10, { forwardRef as forwardRef3 } from "react";
708
+ import { Box as Box8 } from "theme-ui";
709
+ import { Arrow } from "@carbonplan/icons";
710
+ var Callout = (_a, ref) => {
711
+ var _b = _a, {
712
+ label,
713
+ children,
714
+ inverted,
715
+ color,
716
+ href,
717
+ internal,
718
+ sx: sx4
719
+ } = _b, props = __objRest(_b, [
720
+ "label",
721
+ "children",
722
+ "inverted",
723
+ "color",
724
+ "href",
725
+ "internal",
726
+ "sx"
727
+ ]);
728
+ const baseColor = color || (inverted ? "secondary" : "primary");
729
+ const hoverColor = color ? "primary" : inverted ? "primary" : "secondary";
730
+ const style = __spreadValues({
731
+ border: "none",
732
+ padding: [0],
733
+ fontSize: [3, 3, 3, 4],
734
+ color: baseColor,
735
+ background: "transparent",
736
+ textDecoration: "none",
737
+ fontFamily: "body",
738
+ lineHeight: "h3",
739
+ letterSpacing: "body",
740
+ width: "fit-content",
741
+ cursor: "pointer",
742
+ textAlign: "left",
743
+ mb: [1],
744
+ "@media (hover: hover) and (pointer: fine)": {
745
+ "&:hover > #container > #arrow": {
746
+ transform: "rotate(45deg)",
747
+ fill: hoverColor
748
+ },
749
+ "&:hover": {
750
+ color: hoverColor
751
+ }
752
+ }
753
+ }, sx4);
754
+ const Inner = /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(Box8, { sx: { transition: "0.15s", letterSpacing: "body", pb: ["6px"] } }, children), /* @__PURE__ */ React10.createElement(
755
+ Box8,
756
+ {
757
+ sx: {
758
+ transition: "0.15s",
759
+ display: "inline-block",
760
+ textTransform: "uppercase",
761
+ letterSpacing: "smallcaps",
762
+ fontFamily: "heading",
763
+ fontSize: [2, 2, 2, 3]
764
+ }
765
+ },
766
+ label
767
+ ), /* @__PURE__ */ React10.createElement(
768
+ Box8,
769
+ {
770
+ as: "span",
771
+ id: "container",
772
+ sx: {
773
+ ml: [2],
774
+ display: "inline-block"
775
+ }
776
+ },
777
+ /* @__PURE__ */ React10.createElement(
778
+ Arrow,
779
+ {
780
+ id: "arrow",
781
+ sx: {
782
+ transition: "fill 0.15s, transform 0.15s",
783
+ position: "relative",
784
+ top: ["2px"],
785
+ color: baseColor,
786
+ height: [15, 15, 15, 17],
787
+ width: [15, 15, 15, 17]
788
+ }
789
+ }
790
+ )
791
+ ));
792
+ if (href) {
793
+ return /* @__PURE__ */ React10.createElement(
794
+ link_default,
795
+ __spreadValues({
796
+ ref,
797
+ href,
798
+ internal,
799
+ sx: style
800
+ }, props),
801
+ Inner
802
+ );
803
+ } else {
804
+ return /* @__PURE__ */ React10.createElement(
805
+ Box8,
806
+ __spreadValues({
807
+ ref,
808
+ as: "button",
809
+ sx: style
810
+ }, props),
811
+ Inner
812
+ );
813
+ }
814
+ };
815
+ var callout_default = forwardRef3(
816
+ Callout
817
+ );
818
+
819
+ // src/caption.tsx
820
+ import React11 from "react";
821
+ import { Box as Box9 } from "theme-ui";
822
+ var Caption = ({
823
+ as = "figcaption",
824
+ number,
825
+ children,
826
+ label = "figure"
827
+ }) => {
828
+ return /* @__PURE__ */ React11.createElement(
829
+ Box9,
830
+ {
831
+ as,
832
+ sx: {
833
+ color: "secondary",
834
+ display: "block",
835
+ textAlign: "left",
836
+ fontSize: [2, 2, 2, 3],
837
+ "& a": { color: "secondary" },
838
+ "& a:hover": { color: "primary" },
839
+ "& > p": {
840
+ display: "inline",
841
+ fontSize: [2, 2, 2, 3]
842
+ }
843
+ }
844
+ },
845
+ number && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
846
+ Box9,
847
+ {
848
+ sx: {
849
+ textTransform: "uppercase",
850
+ letterSpacing: "smallcaps",
851
+ display: "inline-block"
852
+ }
853
+ },
854
+ label,
855
+ " ",
856
+ number
857
+ ), " ", /* @__PURE__ */ React11.createElement(Box9, { sx: { display: "inline-block", mx: [1], pr: [1] } }, "/")),
858
+ children
859
+ );
860
+ };
861
+ var caption_default = Caption;
862
+
863
+ // src/colorbar.tsx
864
+ import React12, {
865
+ useState,
866
+ useEffect,
867
+ useRef
868
+ } from "react";
869
+ import {
870
+ Box as Box10,
871
+ Flex,
872
+ get
873
+ } from "theme-ui";
874
+ var styles = {
875
+ clim: (setClim) => {
876
+ return {
877
+ bg: "unset",
878
+ border: "none",
879
+ color: "primary",
880
+ px: 0,
881
+ fontFamily: "mono",
882
+ fontSize: ["9px", 0, 0, 1],
883
+ letterSpacing: "smallcaps",
884
+ textTransform: "uppercase",
885
+ transition: "border 0.15s",
886
+ // !important suffix isn't representable in CSS property types
887
+ userSelect: setClim ? "none !important" : "unset",
888
+ width: "fit-content",
889
+ minWidth: "fit-content"
890
+ };
891
+ }
892
+ };
893
+ var DIMENSIONS = {
894
+ width: ["10px", "16px", "16px", "17px"],
895
+ height: ["80px", "110px", "110px", "130px"]
896
+ };
897
+ var hexToRgb = (hex) => {
898
+ let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
899
+ return result ? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(
900
+ result[3],
901
+ 16
902
+ )}` : null;
903
+ };
904
+ var Gradient = ({
905
+ colormap,
906
+ discrete,
907
+ horizontal,
908
+ width,
909
+ height
910
+ }) => {
911
+ const hasColors = colormap.length > 0;
912
+ const step = hasColors ? 1 / colormap.length * 100 : 0;
913
+ const firstColor = colormap[0];
914
+ const isHex = typeof firstColor === "string" && firstColor.startsWith("#");
915
+ const values = colormap.map((color, i) => {
916
+ const normalizedColor = String(color);
917
+ const rgbColor = isHex ? hexToRgb(normalizedColor) : normalizedColor;
918
+ const position = `${i * step}% ${discrete && i < colormap.length - 1 ? `${(i + 1) * step}%` : ""}`;
919
+ return `rgb(${rgbColor}) ${position}`;
920
+ });
921
+ const css = values.length > 0 ? `linear-gradient(to ${horizontal ? "right" : "top"}, ${values.join(
922
+ ","
923
+ )})` : "none";
924
+ return /* @__PURE__ */ React12.createElement(
925
+ Box10,
926
+ {
927
+ sx: __spreadProps(__spreadValues({}, horizontal ? {
928
+ width: width || DIMENSIONS.height,
929
+ height: height || DIMENSIONS.width
930
+ } : {
931
+ width: width || DIMENSIONS.width,
932
+ minHeight: height || DIMENSIONS.height
933
+ }), {
934
+ mt: horizontal ? ["1px", "1px", "1px", 0] : 0,
935
+ border: (t) => `solid 1px ${get(t, "colors.hinted")}`,
936
+ background: css
937
+ })
938
+ }
939
+ );
940
+ };
941
+ var Label = ({
942
+ label,
943
+ units,
944
+ horizontal
945
+ }) => /* @__PURE__ */ React12.createElement(
946
+ Box10,
947
+ {
948
+ sx: horizontal ? void 0 : {
949
+ width: ["13px", "17px", "17px", "19px"],
950
+ alignSelf: "flex-end"
951
+ }
952
+ },
953
+ /* @__PURE__ */ React12.createElement(
954
+ Box10,
955
+ {
956
+ sx: __spreadValues({
957
+ mb: horizontal ? 0 : ["-4px", "-4px", "-4px", "-3px"],
958
+ fontFamily: "mono",
959
+ fontSize: ["9px", 0, 0, 1],
960
+ letterSpacing: "smallcaps",
961
+ textTransform: "uppercase"
962
+ }, horizontal ? {} : {
963
+ writingMode: "vertical-rl",
964
+ transform: "rotate(180deg)",
965
+ whiteSpace: "nowrap",
966
+ display: "inline-block",
967
+ overflow: "visible"
968
+ })
969
+ },
970
+ label,
971
+ " ",
972
+ /* @__PURE__ */ React12.createElement(
973
+ Box10,
974
+ {
975
+ as: "span",
976
+ sx: {
977
+ textTransform: "none",
978
+ color: "secondary",
979
+ display: "inline-block"
980
+ }
981
+ },
982
+ units
983
+ )
984
+ )
985
+ );
986
+ var Colorbar = (_a) => {
987
+ var _b = _a, {
988
+ colormap,
989
+ label,
990
+ clim,
991
+ setClim,
992
+ setClimStep = 1,
993
+ discrete,
994
+ units,
995
+ width,
996
+ height,
997
+ format: format2 = (d) => d,
998
+ horizontal = false,
999
+ bottom = false,
1000
+ sx: sx4,
1001
+ sxClim
1002
+ } = _b, props = __objRest(_b, [
1003
+ "colormap",
1004
+ "label",
1005
+ "clim",
1006
+ "setClim",
1007
+ "setClimStep",
1008
+ "discrete",
1009
+ "units",
1010
+ "width",
1011
+ "height",
1012
+ "format",
1013
+ "horizontal",
1014
+ "bottom",
1015
+ "sx",
1016
+ "sxClim"
1017
+ ]);
1018
+ if (!Array.isArray(colormap)) {
1019
+ throw new Error(`expected array for colormap, got '${colormap}'.`);
1020
+ }
1021
+ const climRef = [useRef(), useRef()];
1022
+ const [climMinDragging, setClimMinDragging] = useState(false);
1023
+ const [climMaxDragging, setClimMaxDragging] = useState(false);
1024
+ let x, y, dx, dy = 0;
1025
+ let id = null;
1026
+ let init2 = [0, 0];
1027
+ let scale = setClimStep;
1028
+ const draggingFunction = (e) => {
1029
+ if (!setClim) return;
1030
+ if (id === "min" && !climMinDragging) setClimMinDragging(true);
1031
+ if (id === "max" && !climMaxDragging) setClimMaxDragging(true);
1032
+ dx = e.pageX - x;
1033
+ dy = e.pageY - y;
1034
+ if (horizontal) {
1035
+ if (id === "min")
1036
+ setClim((prev) => [Math.min(init2[0] + dx * scale, init2[1]), prev[1]]);
1037
+ if (id === "max")
1038
+ setClim((prev) => [prev[0], Math.max(init2[1] + dx * scale, init2[0])]);
1039
+ } else {
1040
+ if (id === "min")
1041
+ setClim((prev) => [Math.min(init2[0] - dy * scale, init2[1]), prev[1]]);
1042
+ if (id === "max")
1043
+ setClim((prev) => [prev[0], Math.max(init2[1] - dy * scale, init2[0])]);
1044
+ }
1045
+ };
1046
+ const handleMouseDown = (e) => {
1047
+ y = e.pageY;
1048
+ x = e.pageX;
1049
+ id = e.currentTarget.id;
1050
+ init2 = clim;
1051
+ document.body.setAttribute(
1052
+ "style",
1053
+ horizontal ? "cursor: ew-resize !important" : "cursor: ns-resize !important"
1054
+ );
1055
+ document.addEventListener("mousemove", draggingFunction);
1056
+ const updater = () => {
1057
+ document.body.setAttribute("style", "cursor: unset");
1058
+ document.removeEventListener("mousemove", draggingFunction);
1059
+ window.removeEventListener("mouseup", updater);
1060
+ if (id === "min") setClimMinDragging(false);
1061
+ if (id === "max") setClimMaxDragging(false);
1062
+ };
1063
+ window.addEventListener("mouseup", updater);
1064
+ };
1065
+ const increment = (e) => {
1066
+ if (!setClim) return;
1067
+ if (climRef[0].current === document.activeElement) {
1068
+ e.preventDefault();
1069
+ setClim((prev) => [Math.min(prev[0] + scale, prev[1]), prev[1]]);
1070
+ climRef[0].current.focus();
1071
+ }
1072
+ if (climRef[1].current === document.activeElement) {
1073
+ e.preventDefault();
1074
+ setClim((prev) => [prev[0], Math.max(prev[1] + scale, prev[0])]);
1075
+ climRef[1].current.focus();
1076
+ }
1077
+ };
1078
+ const decrement = (e) => {
1079
+ if (!setClim) return;
1080
+ if (climRef[0].current === document.activeElement) {
1081
+ e.preventDefault();
1082
+ setClim((prev) => [Math.min(prev[0] - scale, prev[1]), prev[1]]);
1083
+ climRef[0].current.focus();
1084
+ }
1085
+ if (climRef[1].current === document.activeElement) {
1086
+ e.preventDefault();
1087
+ setClim((prev) => [prev[0], Math.max(prev[1] - scale, prev[0])]);
1088
+ climRef[1].current.focus();
1089
+ }
1090
+ };
1091
+ useEffect(() => {
1092
+ const listener = (e) => {
1093
+ if (["ArrowUp", "ArrowRight"].includes(e.code) || ["ArrowUp", "ArrowRight"].includes(e.key)) {
1094
+ increment(e);
1095
+ }
1096
+ if (["ArrowDown", "ArrowLeft"].includes(e.code) || ["ArrowDown", "ArrowLeft"].includes(e.key)) {
1097
+ decrement(e);
1098
+ }
1099
+ };
1100
+ window.addEventListener("keydown", listener);
1101
+ return () => {
1102
+ window.removeEventListener("keydown", listener);
1103
+ };
1104
+ }, [clim]);
1105
+ const ClimMin = () => {
1106
+ return /* @__PURE__ */ React12.createElement(
1107
+ Box10,
1108
+ {
1109
+ id: "min",
1110
+ as: setClim ? "button" : "div",
1111
+ ref: climRef[0],
1112
+ tabIndex: 0,
1113
+ sx: __spreadValues(__spreadProps(__spreadValues({}, styles.clim(setClim)), {
1114
+ ml: label ? horizontal ? bottom ? "0px" : "10px" : ["2px", "1px", "1px", "2px"] : 0,
1115
+ mr: horizontal ? ["2px", "1px", "1px", "2px"] : 0,
1116
+ mb: horizontal ? 0 : ["-2px", "-2px", "-2px", "-3px"],
1117
+ borderBottom: setClim ? (t) => `solid 1px ${get(t, "colors.primary")}` : "unset",
1118
+ cursor: setClim ? horizontal ? "ew-resize" : "ns-resize" : "default"
1119
+ }), sxClim),
1120
+ onMouseDown: setClim ? handleMouseDown : () => {
1121
+ },
1122
+ onClick: () => {
1123
+ var _a2;
1124
+ return (_a2 = climRef[0].current) == null ? void 0 : _a2.focus();
1125
+ }
1126
+ },
1127
+ format2(clim[0])
1128
+ );
1129
+ };
1130
+ const ClimMax = () => {
1131
+ return /* @__PURE__ */ React12.createElement(
1132
+ Box10,
1133
+ {
1134
+ id: "max",
1135
+ as: setClim ? "button" : "div",
1136
+ ref: climRef[1],
1137
+ tabIndex: 0,
1138
+ sx: __spreadValues(__spreadProps(__spreadValues({}, styles.clim(setClim)), {
1139
+ ml: horizontal ? ["2px", "1px", "1px", "2px"] : ["2px", "1px", "1px", "2px"],
1140
+ mt: horizontal ? 0 : ["-2px", "-3px", "-3px", "-3px"],
1141
+ borderBottom: setClim ? (t) => `solid 1px ${get(t, "colors.primary")}` : "unset",
1142
+ cursor: setClim ? horizontal ? "ew-resize" : "ns-resize" : "default"
1143
+ }), sxClim),
1144
+ onMouseDown: setClim ? handleMouseDown : () => {
1145
+ },
1146
+ onClick: () => {
1147
+ var _a2;
1148
+ return (_a2 = climRef[1].current) == null ? void 0 : _a2.focus();
1149
+ }
1150
+ },
1151
+ format2(clim[1])
1152
+ );
1153
+ };
1154
+ return /* @__PURE__ */ React12.createElement(
1155
+ Flex,
1156
+ __spreadProps(__spreadValues({}, props), {
1157
+ sx: __spreadValues({
1158
+ flexDirection: "row",
1159
+ alignItems: "start",
1160
+ justifyContent: "flex-start",
1161
+ gap: ["3px", "6px", "6px", "7px"],
1162
+ height: !horizontal ? "100%" : "unset"
1163
+ }, sx4)
1164
+ }),
1165
+ label && /* @__PURE__ */ React12.createElement(Label, { label, units, horizontal }),
1166
+ /* @__PURE__ */ React12.createElement(
1167
+ Flex,
1168
+ {
1169
+ sx: {
1170
+ flexGrow: horizontal ? 1 : "unset",
1171
+ flexDirection: "column",
1172
+ ml: bottom && label ? "4px" : "0px",
1173
+ height: !horizontal ? "100%" : "unset"
1174
+ }
1175
+ },
1176
+ /* @__PURE__ */ React12.createElement(
1177
+ Flex,
1178
+ {
1179
+ sx: {
1180
+ gap: ["3px", "6px", "6px", "7px"],
1181
+ height: !horizontal ? "100%" : "unset"
1182
+ }
1183
+ },
1184
+ horizontal && clim && !bottom && /* @__PURE__ */ React12.createElement(ClimMin, null),
1185
+ /* @__PURE__ */ React12.createElement(
1186
+ Gradient,
1187
+ {
1188
+ colormap,
1189
+ horizontal,
1190
+ discrete,
1191
+ width,
1192
+ height
1193
+ }
1194
+ ),
1195
+ horizontal && clim && !bottom && /* @__PURE__ */ React12.createElement(ClimMax, null)
1196
+ ),
1197
+ horizontal && clim && bottom && /* @__PURE__ */ React12.createElement(Flex, { sx: { justifyContent: "space-between" } }, /* @__PURE__ */ React12.createElement(ClimMin, null), /* @__PURE__ */ React12.createElement(ClimMax, null))
1198
+ ),
1199
+ !horizontal && /* @__PURE__ */ React12.createElement(
1200
+ Flex,
1201
+ {
1202
+ sx: {
1203
+ flexDirection: "column-reverse",
1204
+ justifyContent: "space-between",
1205
+ height: height || DIMENSIONS.height
1206
+ }
1207
+ },
1208
+ clim && /* @__PURE__ */ React12.createElement(ClimMin, null),
1209
+ clim && /* @__PURE__ */ React12.createElement(ClimMax, null)
1210
+ )
1211
+ );
1212
+ };
1213
+ var colorbar_default = Colorbar;
1214
+
1215
+ // src/colors.tsx
1216
+ var colors_exports = {};
1217
+ __export(colors_exports, {
1218
+ Background: () => Background,
1219
+ Blue: () => Blue,
1220
+ Green: () => Green,
1221
+ Grey: () => Grey,
1222
+ Orange: () => Orange,
1223
+ Pink: () => Pink,
1224
+ Primary: () => Primary,
1225
+ Purple: () => Purple,
1226
+ Red: () => Red,
1227
+ Secondary: () => Secondary,
1228
+ Teal: () => Teal,
1229
+ Yellow: () => Yellow
1230
+ });
1231
+ import React13 from "react";
1232
+ import { Box as Box11 } from "theme-ui";
1233
+ var InlineColor = (_a) => {
1234
+ var _b = _a, { sx: sx4, color, children } = _b, props = __objRest(_b, ["sx", "color", "children"]);
1235
+ return /* @__PURE__ */ React13.createElement(
1236
+ Box11,
1237
+ __spreadValues({
1238
+ as: "span",
1239
+ sx: __spreadValues({ display: "inline-block", color }, sx4)
1240
+ }, props),
1241
+ children
1242
+ );
1243
+ };
1244
+ var Primary = (props) => {
1245
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "primary" }, props));
1246
+ };
1247
+ var Secondary = (props) => {
1248
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "secondary" }, props));
1249
+ };
1250
+ var Background = (props) => {
1251
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "background" }, props));
1252
+ };
1253
+ var Red = (props) => {
1254
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "red" }, props));
1255
+ };
1256
+ var Orange = (props) => {
1257
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "orange" }, props));
1258
+ };
1259
+ var Yellow = (props) => {
1260
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "yellow" }, props));
1261
+ };
1262
+ var Green = (props) => {
1263
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "green" }, props));
1264
+ };
1265
+ var Teal = (props) => {
1266
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "teal" }, props));
1267
+ };
1268
+ var Blue = (props) => {
1269
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "blue" }, props));
1270
+ };
1271
+ var Purple = (props) => {
1272
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "purple" }, props));
1273
+ };
1274
+ var Pink = (props) => {
1275
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "pink" }, props));
1276
+ };
1277
+ var Grey = (props) => {
1278
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "grey" }, props));
1279
+ };
1280
+
1281
+ // src/custom-404.tsx
1282
+ import React32 from "react";
1283
+ import { Box as Box22 } from "theme-ui";
1284
+ import { PoopSad } from "@carbonplan/emoji";
1285
+
1286
+ // src/layout.tsx
1287
+ import React31, { useEffect as useEffect7 } from "react";
1288
+ import { useThemeUI as useThemeUI3, Container as Container3, Flex as Flex5, Box as Box21 } from "theme-ui";
1289
+
1290
+ // src/meta.tsx
1291
+ import React14 from "react";
1292
+ import Head from "next/head";
1293
+ import { useThemeUI } from "theme-ui";
1294
+ var Meta = ({ title, description, card, url }) => {
1295
+ var _a, _b;
1296
+ const { theme, colorMode } = useThemeUI();
1297
+ if (!description) {
1298
+ console.warn(
1299
+ "a custom description should be used for search engine optimization"
1300
+ );
1301
+ }
1302
+ if (!title) {
1303
+ console.warn("a custom title should be used for search engine optimization");
1304
+ }
1305
+ const titleProp = title || "CarbonPlan";
1306
+ const descriptionProp = description || "Improving the transparency and scientific integrity of climate solutions with open data and tools.";
1307
+ const cardProp = card || "https://images.carbonplan.org/social/homepage.png";
1308
+ const urlProp = url || "https://carbonplan.org";
1309
+ return /* @__PURE__ */ React14.createElement(Head, null, /* @__PURE__ */ React14.createElement("title", null, titleProp), /* @__PURE__ */ React14.createElement("meta", { name: "description", content: descriptionProp }), /* @__PURE__ */ React14.createElement("meta", { name: "viewport", content: "initial-scale=1.0, width=device-width" }), url && /* @__PURE__ */ React14.createElement("link", { rel: "canonical", href: url }), /* @__PURE__ */ React14.createElement(
1310
+ "link",
1311
+ {
1312
+ rel: "alternate icon",
1313
+ type: "image/png",
1314
+ href: "https://images.carbonplan.org/favicon.png"
1315
+ }
1316
+ ), /* @__PURE__ */ React14.createElement(
1317
+ "link",
1318
+ {
1319
+ rel: "icon",
1320
+ type: "image/svg+xml",
1321
+ href: "https://images.carbonplan.org/favicon.svg"
1322
+ }
1323
+ ), /* @__PURE__ */ React14.createElement(
1324
+ "link",
1325
+ {
1326
+ rel: "preload",
1327
+ href: "https://fonts.carbonplan.org/relative/relative-book-pro.woff2",
1328
+ as: "font",
1329
+ type: "font/woff2",
1330
+ crossOrigin: "anonymous"
1331
+ }
1332
+ ), /* @__PURE__ */ React14.createElement(
1333
+ "link",
1334
+ {
1335
+ rel: "preload",
1336
+ href: "https://fonts.carbonplan.org/relative/relative-medium-pro.woff2",
1337
+ as: "font",
1338
+ type: "font/woff2",
1339
+ crossOrigin: "anonymous"
1340
+ }
1341
+ ), /* @__PURE__ */ React14.createElement(
1342
+ "link",
1343
+ {
1344
+ rel: "preload",
1345
+ href: "https://fonts.carbonplan.org/relative/relative-mono-11-pitch-pro.woff2",
1346
+ as: "font",
1347
+ type: "font/woff2",
1348
+ crossOrigin: "anonymous"
1349
+ }
1350
+ ), /* @__PURE__ */ React14.createElement(
1351
+ "link",
1352
+ {
1353
+ rel: "preload",
1354
+ href: "https://fonts.carbonplan.org/relative/relative-faux-book-pro.woff2",
1355
+ as: "font",
1356
+ type: "font/woff2",
1357
+ crossOrigin: "anonymous"
1358
+ }
1359
+ ), /* @__PURE__ */ React14.createElement("link", { rel: "manifest", href: "https://images.carbonplan.org/manifest.json" }), /* @__PURE__ */ React14.createElement(
1360
+ "meta",
1361
+ {
1362
+ name: "theme-color",
1363
+ content: typeof ((_a = theme.colors) == null ? void 0 : _a.background) === "string" ? theme.colors.background : ""
1364
+ }
1365
+ ), /* @__PURE__ */ React14.createElement(
1366
+ "meta",
1367
+ {
1368
+ name: "color-scheme",
1369
+ content: colorMode === "light" ? "light" : "dark"
1370
+ }
1371
+ ), /* @__PURE__ */ React14.createElement(
1372
+ "link",
1373
+ {
1374
+ rel: "mask-icon",
1375
+ href: "https://images.carbonplan.org/safari-pinned-tab.svg",
1376
+ color: "#000000"
1377
+ }
1378
+ ), /* @__PURE__ */ React14.createElement(
1379
+ "link",
1380
+ {
1381
+ rel: "apple-touch-icon",
1382
+ sizes: "180x180",
1383
+ href: "https://images.carbonplan.org/apple-touch-icon.png"
1384
+ }
1385
+ ), /* @__PURE__ */ React14.createElement(
1386
+ "meta",
1387
+ {
1388
+ name: "msapplication-TileColor",
1389
+ content: typeof ((_b = theme.colors) == null ? void 0 : _b.background) === "string" ? theme.colors.background : ""
1390
+ }
1391
+ ), /* @__PURE__ */ React14.createElement(
1392
+ "meta",
1393
+ {
1394
+ name: "msapplication-TileImage",
1395
+ content: "https://images.carbonplan.org/mstile-144x144.png"
1396
+ }
1397
+ ), /* @__PURE__ */ React14.createElement(
1398
+ "meta",
1399
+ {
1400
+ name: "msapplication-config",
1401
+ content: "https://images.carbonplan.org/browserconfig.xml"
1402
+ }
1403
+ ), /* @__PURE__ */ React14.createElement("meta", { property: "og:title", content: titleProp }), /* @__PURE__ */ React14.createElement("meta", { property: "og:description", content: descriptionProp }), /* @__PURE__ */ React14.createElement("meta", { property: "og:image", content: cardProp }), /* @__PURE__ */ React14.createElement("meta", { property: "og:url", content: urlProp }), /* @__PURE__ */ React14.createElement("meta", { name: "twitter:title", content: titleProp }), /* @__PURE__ */ React14.createElement("meta", { name: "twitter:description", content: descriptionProp }), /* @__PURE__ */ React14.createElement("meta", { name: "twitter:image", content: cardProp }), /* @__PURE__ */ React14.createElement("meta", { name: "twitter:card", content: "summary_large_image" }), /* @__PURE__ */ React14.createElement("meta", { name: "format-detection", content: "telephone=no" }));
1404
+ };
1405
+ var meta_default = Meta;
1406
+
1407
+ // src/header/header.tsx
1408
+ import React22, { useState as useState3 } from "react";
1409
+ import { default as NextLink3 } from "next/link";
1410
+ import { Box as Box14, Flex as Flex3, Container, Link as Link4 } from "theme-ui";
1411
+
1412
+ // src/logo.tsx
1413
+ import React15 from "react";
1414
+ import { Box as Box12 } from "theme-ui";
1415
+ var Logo = (_a) => {
1416
+ var props = __objRest(_a, []);
1417
+ return /* @__PURE__ */ React15.createElement(
1418
+ Box12,
1419
+ __spreadValues(__spreadValues({
1420
+ as: "svg"
1421
+ }, {
1422
+ width: "150",
1423
+ fill: "currentColor",
1424
+ stroke: "none",
1425
+ viewBox: "0 0 151.1 28.8"
1426
+ }), props),
1427
+ /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1428
+ "path",
1429
+ {
1430
+ d: "M9.7,20.1c-1.3-1.4-2-3.1-2-5.2c0-2.1,0.7-3.9,2-5.2c1.3-1.4,3-2,5.1-2c1.7,0,3.1,0.4,4.3,1.3\n c1.1,0.9,1.8,2.1,2.1,3.5c0,0.1,0,0.2,0,0.3s-0.1,0.2-0.2,0.2h-2.3c-0.2,0-0.3-0.1-0.4-0.2c-0.3-0.8-0.7-1.4-1.3-1.8\n c-0.6-0.4-1.4-0.6-2.2-0.6c-1.3,0-2.3,0.4-3,1.2c-0.8,0.8-1.1,1.9-1.1,3.4c0,1.5,0.4,2.6,1.1,3.4c0.8,0.8,1.8,1.2,3,1.2\n c0.8,0,1.6-0.2,2.2-0.6c0.6-0.4,1.1-1,1.3-1.8c0.1-0.2,0.2-0.2,0.4-0.3H21c0.1,0,0.2,0.1,0.2,0.2c0,0.1,0,0.2,0,0.3\n c-0.3,1.4-1,2.6-2.1,3.5c-1.1,0.9-2.5,1.3-4.3,1.3C12.7,22.1,11,21.4,9.7,20.1z"
1431
+ }
1432
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1433
+ "path",
1434
+ {
1435
+ d: "M22.5,17.6c0-1.5,0.5-2.6,1.6-3.5c1.1-0.8,2.4-1.2,4.1-1.2c1.1,0,2.4,0.2,3.7,0.6V13c0-0.9-0.3-1.6-0.8-2.1\n c-0.5-0.5-1.2-0.8-2.2-0.8c-1.4,0-2.4,0.6-2.9,1.8c-0.1,0.2-0.2,0.2-0.4,0.2h-2.3c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0-0.3\n c0.3-1.2,0.9-2.2,1.9-2.9c1-0.8,2.3-1.1,3.8-1.1C30.6,7.6,32,8.1,33,9c1,0.9,1.5,2.2,1.5,3.8V19c0,1.1,0.2,1.9,0.5,2.6\n c0,0.1,0.1,0.1,0.1,0.1c0,0.1-0.1,0.1-0.3,0.1h-2.8c-0.2,0-0.3-0.1-0.3-0.3v-1c-1.1,1.1-2.5,1.6-4.3,1.6c-1.4,0-2.6-0.4-3.6-1.2\n C23,20.1,22.5,19,22.5,17.6z M25.4,17.5c0,0.6,0.2,1.1,0.7,1.5c0.4,0.4,1.1,0.5,1.9,0.5c1.1,0,2-0.3,2.8-0.9\n c0.8-0.6,1.1-1.5,1.1-2.6c-1.3-0.4-2.5-0.6-3.6-0.6c-0.8,0-1.5,0.2-2.1,0.5C25.7,16.3,25.4,16.8,25.4,17.5z"
1436
+ }
1437
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1438
+ "path",
1439
+ {
1440
+ d: "M37,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.1c1-1.1,2.3-1.6,3.7-1.6\n c0.8,0,1.7,0.1,2.5,0.4c0.2,0.1,0.3,0.3,0.3,0.5v2.2c0,0.2-0.1,0.3-0.2,0.3c0,0-0.1,0-0.2-0.1c-1.1-0.5-2-0.8-2.9-0.8\n c-0.9,0-1.7,0.4-2.3,1.1c-0.6,0.7-0.9,1.7-0.9,3v7.3c0,0.2-0.1,0.3-0.3,0.3h-2.2C37.1,21.8,37,21.7,37,21.6z"
1441
+ }
1442
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1443
+ "path",
1444
+ {
1445
+ d: "M47.6,21.6V2.7c0-0.2,0.1-0.3,0.3-0.3H50c0.2,0,0.3,0.1,0.3,0.3v6.5c1.3-1.1,2.7-1.6,4.3-1.6\n c1.9,0,3.4,0.7,4.6,2c1.1,1.3,1.7,3.1,1.7,5.3c0,2.2-0.6,4-1.7,5.3c-1.1,1.3-2.7,2-4.6,2c-1.8,0-3.2-0.5-4.3-1.6v1\n c0,0.2-0.1,0.3-0.3,0.3h-2.2C47.7,21.8,47.6,21.7,47.6,21.6z M51.2,11.5c-0.7,0.9-1.1,2-1.1,3.3c0,1.4,0.4,2.5,1.1,3.3\n s1.7,1.3,2.9,1.3c1.2,0,2.2-0.4,2.9-1.3c0.7-0.9,1.1-2,1.1-3.3c0-1.4-0.4-2.5-1.1-3.3c-0.7-0.9-1.7-1.3-2.9-1.3\n C52.9,10.2,51.9,10.7,51.2,11.5z"
1446
+ }
1447
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1448
+ "path",
1449
+ {
1450
+ d: "M64.3,20.1c-1.4-1.4-2.1-3.1-2.1-5.2c0-2.1,0.7-3.9,2.1-5.2c1.4-1.4,3.1-2,5.2-2c2.1,0,3.8,0.7,5.2,2\n c1.4,1.4,2.1,3.1,2.1,5.2c0,2.1-0.7,3.9-2.1,5.2c-1.4,1.4-3.1,2-5.2,2C67.4,22.1,65.7,21.4,64.3,20.1z M66.4,11.5\n c-0.8,0.8-1.2,2-1.2,3.4c0,1.4,0.4,2.5,1.2,3.4s1.9,1.3,3.1,1.3c1.3,0,2.3-0.4,3.1-1.3c0.8-0.8,1.2-2,1.2-3.4\n c0-1.4-0.4-2.5-1.2-3.4c-0.8-0.8-1.9-1.3-3.1-1.3C68.2,10.2,67.2,10.7,66.4,11.5z"
1451
+ }
1452
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1453
+ "path",
1454
+ {
1455
+ d: "M78.7,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.3c1.3-1.2,2.7-1.8,4.4-1.8\n c1.5,0,2.7,0.4,3.5,1.3c0.8,0.9,1.3,2,1.3,3.6v9.1c0,0.2-0.1,0.3-0.3,0.3h-2.2c-0.2,0-0.3-0.1-0.3-0.3v-8.3c0-2-0.9-3.1-2.8-3.1\n c-1.1,0-1.9,0.4-2.7,1.2c-0.7,0.8-1.1,2-1.1,3.5v6.6c0,0.2-0.1,0.3-0.3,0.3h-2.2C78.7,21.8,78.7,21.7,78.7,21.6z"
1456
+ }
1457
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1458
+ "path",
1459
+ {
1460
+ d: "M101.7,27.1V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1c1.1-1.1,2.5-1.6,4.3-1.6\n c1.9,0,3.4,0.7,4.6,2s1.7,3.1,1.7,5.3c0,2.2-0.6,4-1.7,5.3c-1.1,1.3-2.7,2-4.6,2c-1.5,0-3-0.5-4.3-1.6v6.6c0,0.2-0.1,0.3-0.3,0.3\n H102C101.8,27.3,101.7,27.2,101.7,27.1z M105.3,11.5c-0.7,0.9-1.1,2-1.1,3.3c0,1.4,0.4,2.5,1.1,3.3s1.7,1.3,2.9,1.3\n c1.2,0,2.2-0.4,2.9-1.3c0.7-0.9,1.1-2,1.1-3.3c0-1.4-0.4-2.5-1.1-3.3c-0.7-0.9-1.7-1.3-2.9-1.3C107,10.2,106,10.7,105.3,11.5z"
1461
+ }
1462
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1463
+ "path",
1464
+ {
1465
+ d: "M117.2,21.6V2.7c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v18.9c0,0.2-0.1,0.3-0.3,0.3h-2.2\n C117.3,21.8,117.2,21.7,117.2,21.6z"
1466
+ }
1467
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1468
+ "path",
1469
+ {
1470
+ d: "M122,17.6c0-1.5,0.5-2.6,1.6-3.5c1.1-0.8,2.4-1.2,4.1-1.2c1.1,0,2.4,0.2,3.7,0.6V13c0-0.9-0.3-1.6-0.8-2.1\n c-0.5-0.5-1.2-0.8-2.2-0.8c-1.4,0-2.4,0.6-2.9,1.8c-0.1,0.2-0.2,0.2-0.4,0.2h-2.3c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0-0.3\n c0.3-1.2,0.9-2.2,1.9-2.9c1-0.8,2.3-1.1,3.8-1.1c1.7,0,3.1,0.5,4.2,1.4s1.5,2.2,1.5,3.8V19c0,1.1,0.2,1.9,0.5,2.6\n c0,0.1,0.1,0.1,0.1,0.1c0,0.1-0.1,0.1-0.3,0.1h-2.8c-0.2,0-0.3-0.1-0.3-0.3v-1c-1.1,1.1-2.5,1.6-4.3,1.6c-1.4,0-2.6-0.4-3.6-1.2\n C122.5,20.1,122,19,122,17.6z M124.9,17.5c0,0.6,0.2,1.1,0.7,1.5c0.4,0.4,1.1,0.5,1.9,0.5c1.1,0,2-0.3,2.8-0.9\n c0.8-0.6,1.1-1.5,1.1-2.6c-1.3-0.4-2.5-0.6-3.6-0.6c-0.8,0-1.5,0.2-2.1,0.5C125.2,16.3,124.9,16.8,124.9,17.5z"
1471
+ }
1472
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1473
+ "path",
1474
+ {
1475
+ d: "M136.9,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.3c1.3-1.2,2.7-1.8,4.4-1.8\n c1.5,0,2.7,0.4,3.5,1.3c0.8,0.9,1.3,2,1.3,3.6v9.1c0,0.2-0.1,0.3-0.3,0.3h-2.2c-0.2,0-0.3-0.1-0.3-0.3v-8.3c0-2-0.9-3.1-2.8-3.1\n c-1.1,0-1.9,0.4-2.7,1.2c-0.7,0.8-1.1,2-1.1,3.5v6.6c0,0.2-0.1,0.3-0.3,0.3h-2.2C137,21.8,136.9,21.7,136.9,21.6z"
1476
+ }
1477
+ )), /* @__PURE__ */ React15.createElement(
1478
+ "path",
1479
+ {
1480
+ d: "M97.6,14.9c0,4.2-0.6,8.3-1.6,12.3c0,0.1-0.1,0.2-0.2,0.2h-2.4c-0.1,0-0.2-0.1-0.2-0.3c1.1-3.9,1.7-8,1.7-12.2\n s-0.6-8.3-1.7-12.2c0-0.1,0.1-0.3,0.2-0.3l2.4,0c0.1,0,0.2,0.1,0.2,0.2C97.1,6.5,97.6,10.6,97.6,14.9z"
1481
+ }
1482
+ ), /* @__PURE__ */ React15.createElement(
1483
+ "path",
1484
+ {
1485
+ d: "M1.4,14.9C1.4,10.6,2,6.5,3,2.6c0-0.1,0.1-0.2,0.2-0.2l2.4,0c0.1,0,0.2,0.1,0.2,0.3c-1.1,3.9-1.7,8-1.7,12.2\n s0.6,8.3,1.7,12.2c0,0.1-0.1,0.3-0.2,0.3H3.3c-0.1,0-0.2-0.1-0.2-0.2C2,23.2,1.4,19.1,1.4,14.9z"
1486
+ }
1487
+ ))
1488
+ );
1489
+ };
1490
+ var logo_default = Logo;
1491
+
1492
+ // src/header/menu.tsx
1493
+ import React17 from "react";
1494
+
1495
+ // src/header/header-icon.tsx
1496
+ import React16 from "react";
1497
+ import { IconButton } from "theme-ui";
1498
+ var HeaderIcon = (_a) => {
1499
+ var _b = _a, {
1500
+ label = "Toggle Menu",
1501
+ children,
1502
+ value,
1503
+ sx: sx4
1504
+ } = _b, props = __objRest(_b, [
1505
+ "label",
1506
+ "children",
1507
+ "value",
1508
+ "sx"
1509
+ ]);
1510
+ return /* @__PURE__ */ React16.createElement(
1511
+ IconButton,
1512
+ __spreadValues({
1513
+ sx: __spreadValues({
1514
+ cursor: "pointer",
1515
+ fill: "none",
1516
+ strokeWidth: "2px",
1517
+ stroke: "text",
1518
+ ".paren": {
1519
+ opacity: "0"
1520
+ },
1521
+ "@media (hover: hover) and (pointer: fine)": {
1522
+ "&:hover .paren": {
1523
+ opacity: "1"
1524
+ }
1525
+ }
1526
+ }, sx4),
1527
+ "aria-label": label
1528
+ }, props),
1529
+ !value && /* @__PURE__ */ React16.createElement(
1530
+ "svg",
1531
+ {
1532
+ style: {
1533
+ width: "50px",
1534
+ height: "30px",
1535
+ marginTop: "-3px",
1536
+ flexShrink: 0
1537
+ },
1538
+ xmlns: "http://www.w3.org/2000/svg",
1539
+ viewBox: "0 0 68 36"
1540
+ },
1541
+ children,
1542
+ /* @__PURE__ */ React16.createElement(
1543
+ "path",
1544
+ {
1545
+ style: { transition: "all 0.2s" },
1546
+ className: "paren",
1547
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1548
+ }
1549
+ ),
1550
+ /* @__PURE__ */ React16.createElement(
1551
+ "path",
1552
+ {
1553
+ style: { transition: "all 0.2s" },
1554
+ className: "paren",
1555
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1556
+ }
1557
+ )
1558
+ ),
1559
+ value && /* @__PURE__ */ React16.createElement(
1560
+ "svg",
1561
+ {
1562
+ style: {
1563
+ width: "50px",
1564
+ height: "30px",
1565
+ marginTop: "-3px",
1566
+ flexShrink: 0
1567
+ },
1568
+ xmlns: "http://www.w3.org/2000/svg",
1569
+ viewBox: "0 0 68 36"
1570
+ },
1571
+ /* @__PURE__ */ React16.createElement("line", { x1: "50.85", y1: "29.79", x2: "17.15", y2: "6.21" }),
1572
+ /* @__PURE__ */ React16.createElement("line", { x1: "17.15", y1: "29.79", x2: "50.85", y2: "6.21" }),
1573
+ /* @__PURE__ */ React16.createElement(
1574
+ "path",
1575
+ {
1576
+ style: { transition: "all 0.2s" },
1577
+ className: "paren",
1578
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1579
+ }
1580
+ ),
1581
+ /* @__PURE__ */ React16.createElement(
1582
+ "path",
1583
+ {
1584
+ style: { transition: "all 0.2s" },
1585
+ className: "paren",
1586
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1587
+ }
1588
+ )
1589
+ )
1590
+ );
1591
+ };
1592
+ var header_icon_default = HeaderIcon;
1593
+
1594
+ // src/header/menu.tsx
1595
+ var Menu = (props) => {
1596
+ return /* @__PURE__ */ React17.createElement(header_icon_default, __spreadValues({}, props), /* @__PURE__ */ React17.createElement("line", { x1: "52", y1: "29.9", x2: "16", y2: "29.9" }), /* @__PURE__ */ React17.createElement("line", { x1: "52", y1: "6.1", x2: "16", y2: "6.1" }), /* @__PURE__ */ React17.createElement("line", { x1: "52", y1: "18", x2: "16", y2: "18" }));
1597
+ };
1598
+ var menu_default = Menu;
1599
+
1600
+ // src/header/navigation-menu.tsx
1601
+ import React18 from "react";
1602
+ import { default as NextLink2 } from "next/link";
1603
+ import { Link as Link2 } from "theme-ui";
1604
+ import { Arrow as Arrow2 } from "@carbonplan/icons";
1605
+ var sx = {
1606
+ link: (current, label, first = false) => {
1607
+ return {
1608
+ width: "auto",
1609
+ color: current === label ? "secondary" : "text",
1610
+ fontSize: [6, 6, 7, 8],
1611
+ fontFamily: "heading",
1612
+ letterSpacing: "heading",
1613
+ borderStyle: "solid",
1614
+ borderColor: "muted",
1615
+ borderWidth: "0px",
1616
+ borderBottomWidth: "1px",
1617
+ borderTopWidth: first ? "1px" : "0px",
1618
+ py: [3, 3, 4, 5],
1619
+ textDecoration: "none",
1620
+ display: "block",
1621
+ position: "relative",
1622
+ transition: "color 0.15s",
1623
+ "@media (hover: hover) and (pointer: fine)": {
1624
+ "&:hover > #arrow": {
1625
+ opacity: 1
1626
+ }
1627
+ },
1628
+ "&:hover": {
1629
+ color: current == label ? "secondary" : "text"
1630
+ }
1631
+ };
1632
+ }
1633
+ };
1634
+ var links = [
1635
+ { url: "about", display: "About" },
1636
+ { url: "research", display: "Research" },
1637
+ { url: "blog", display: "Blog" },
1638
+ { url: "press", display: "Press" }
1639
+ ];
1640
+ var HoverArrow = () => {
1641
+ return /* @__PURE__ */ React18.createElement(
1642
+ Arrow2,
1643
+ {
1644
+ id: "arrow",
1645
+ sx: {
1646
+ pointerEvents: "none",
1647
+ display: "inline-block",
1648
+ position: "absolute",
1649
+ left: ["-60px", "-68px", "-80px", "-104px"],
1650
+ top: ["32px", "32px", "46px", "62px"],
1651
+ opacity: 0,
1652
+ transition: "opacity 0.2s ease-out",
1653
+ transform: "rotate(45deg)",
1654
+ width: [36, 36, 48, 56],
1655
+ height: [36, 36, 48, 56]
1656
+ }
1657
+ }
1658
+ );
1659
+ };
1660
+ var Nav = ({ link, mode, nav, first, setExpanded }) => {
1661
+ const { url, display } = link;
1662
+ const href = mode === "remote" ? "https://carbonplan.org/" + url : "/" + url;
1663
+ if (mode === "homepage" || mode === "local" && nav === url) {
1664
+ return /* @__PURE__ */ React18.createElement(NextLink2, { href, passHref: true, legacyBehavior: true }, /* @__PURE__ */ React18.createElement(
1665
+ Link2,
1666
+ {
1667
+ onClick: () => {
1668
+ if (nav === url) setExpanded(false);
1669
+ },
1670
+ sx: sx.link(nav, url, first)
1671
+ },
1672
+ /* @__PURE__ */ React18.createElement(HoverArrow, null),
1673
+ display
1674
+ ));
1675
+ } else {
1676
+ return /* @__PURE__ */ React18.createElement(Link2, { href, sx: sx.link(nav, url, first) }, /* @__PURE__ */ React18.createElement(HoverArrow, null), display);
1677
+ }
1678
+ };
1679
+ var NavigationMenu = ({ nav, mode, setExpanded }) => {
1680
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, links.map((d, i) => /* @__PURE__ */ React18.createElement(
1681
+ Nav,
1682
+ {
1683
+ key: i,
1684
+ link: d,
1685
+ mode,
1686
+ nav,
1687
+ first: i === 0,
1688
+ setExpanded
1689
+ }
1690
+ )));
1691
+ };
1692
+ var navigation_menu_default = NavigationMenu;
1693
+
1694
+ // src/header/search.tsx
1695
+ import React19 from "react";
1696
+ import { Search as SearchIcon } from "@carbonplan/icons";
1697
+ var Search = (props) => {
1698
+ return /* @__PURE__ */ React19.createElement(header_icon_default, __spreadProps(__spreadValues({}, props), { label: "Toggle Search" }), /* @__PURE__ */ React19.createElement(SearchIcon, { width: 50, height: 30, x: 8 }));
1699
+ };
1700
+ var search_default = Search;
1701
+
1702
+ // src/header/search-menu.tsx
1703
+ import React21, { useEffect as useEffect2, useState as useState2 } from "react";
1704
+ import { Box as Box13, Flex as Flex2, Link as Link3 } from "theme-ui";
1705
+ import { Arrow as Arrow3, RotatingArrow } from "@carbonplan/icons";
1706
+
1707
+ // src/input.tsx
1708
+ import React20, { forwardRef as forwardRef4 } from "react";
1709
+ import { Input as ThemedInput } from "theme-ui";
1710
+ var Input = (_a, ref) => {
1711
+ var _b = _a, { size = "sm", inverted, sx: sx4 } = _b, props = __objRest(_b, ["size", "inverted", "sx"]);
1712
+ const defaultColor = inverted ? "secondary" : "primary";
1713
+ const styles3 = __spreadValues(__spreadValues({
1714
+ color: defaultColor,
1715
+ borderColor: "secondary",
1716
+ borderStyle: "solid",
1717
+ borderWidth: "0px",
1718
+ borderBottomWidth: "1px",
1719
+ borderRadius: "0px",
1720
+ transition: "border 0.15s",
1721
+ width: "calc(min(15ch, 100%))",
1722
+ p: [0],
1723
+ py: ["2px"],
1724
+ "input::-webkit-outer-spin-button": {
1725
+ WebkitAppearance: "none",
1726
+ margin: 0
1727
+ },
1728
+ "input::-webkit-inner-spin-button": {
1729
+ WebkitAppearance: "none",
1730
+ margin: 0
1731
+ },
1732
+ ":focus": {
1733
+ borderColor: "primary"
1734
+ },
1735
+ ":focus-visible": {
1736
+ outline: "none !important",
1737
+ background: "none !important"
1738
+ }
1739
+ }, get_size_styles_default(size)), sx4);
1740
+ return /* @__PURE__ */ React20.createElement(ThemedInput, __spreadProps(__spreadValues({}, props), { ref, sx: styles3 }));
1741
+ };
1742
+ var input_default = forwardRef4(Input);
1743
+
1744
+ // src/header/search-menu.tsx
1745
+ var HoverArrow2 = ({ sx: sx4 }) => {
1746
+ return /* @__PURE__ */ React21.createElement(
1747
+ Arrow3,
1748
+ {
1749
+ id: "arrow",
1750
+ sx: __spreadValues({
1751
+ display: "inline-block",
1752
+ position: "absolute",
1753
+ right: ["4px", "-68px", "-80px", "-104px"],
1754
+ top: [void 0, void 0, "46px", "62px"],
1755
+ bottom: ["4px", "4px", void 0, void 0],
1756
+ opacity: 0,
1757
+ transition: "opacity 0.2s ease-out",
1758
+ transform: "rotate(45deg)",
1759
+ width: [24, 36, 48, 56],
1760
+ height: [24, 36, 48, 56]
1761
+ }, sx4)
1762
+ }
1763
+ );
1764
+ };
1765
+ var RESOURCES = [
1766
+ {
1767
+ label: "Carbon accounting",
1768
+ links: []
1769
+ },
1770
+ {
1771
+ label: "Climate impacts",
1772
+ links: []
1773
+ },
1774
+ {
1775
+ label: "Organization",
1776
+ links: []
1777
+ }
1778
+ ];
1779
+ var sx2 = {
1780
+ highlight: {
1781
+ mb: [2, 2, 3, 3],
1782
+ mt: [3, 3, 0, 0],
1783
+ fontSize: [3, 3, 3, 4],
1784
+ fontFamily: "heading",
1785
+ letterSpacing: "smallcaps",
1786
+ textTransform: "uppercase",
1787
+ color: "secondary"
1788
+ }
1789
+ };
1790
+ var SearchMenu = ({}) => {
1791
+ const [value, setValue] = useState2("");
1792
+ const [resources, setResources] = useState2(RESOURCES);
1793
+ const destination = `/search?query=${value.trim()}`;
1794
+ useEffect2(() => {
1795
+ fetch("/resources.json").then((res) => res.json()).then((res) => {
1796
+ if (res.length === 3 && res.every((el) => el.label && Array.isArray(el.links))) {
1797
+ setResources(res);
1798
+ }
1799
+ }).catch(() => {
1800
+ setResources(RESOURCES);
1801
+ });
1802
+ }, []);
1803
+ 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
+ Flex2,
1805
+ {
1806
+ as: "form",
1807
+ onSubmit: (e) => {
1808
+ e.preventDefault();
1809
+ if (value.trim()) {
1810
+ window.location.href = destination;
1811
+ }
1812
+ },
1813
+ sx: {
1814
+ flexDirection: ["column", "column", "row", "row"],
1815
+ gap: [0, 0, 7, 7],
1816
+ mt: ["1px", 0, 2, "29px"],
1817
+ position: "relative",
1818
+ borderStyle: "solid",
1819
+ borderColor: ["secondary", "secondary", "muted", "muted"],
1820
+ borderWidth: "0px",
1821
+ borderBottomWidth: "1px",
1822
+ "@media (hover: hover) and (pointer: fine)": {
1823
+ "&:hover #arrow": {
1824
+ opacity: 1
1825
+ }
1826
+ }
1827
+ }
1828
+ },
1829
+ /* @__PURE__ */ React21.createElement(
1830
+ Box13,
1831
+ __spreadProps(__spreadValues({
1832
+ as: "label"
1833
+ }, { htmlFor: "search" }), {
1834
+ sx: {
1835
+ color: "primary",
1836
+ fontSize: [6, 6, 7, 8],
1837
+ fontFamily: "heading",
1838
+ letterSpacing: "heading",
1839
+ py: [0, 3, 4, 5],
1840
+ textDecoration: "none",
1841
+ display: "block",
1842
+ transition: "color 0.15s"
1843
+ }
1844
+ }),
1845
+ "Search"
1846
+ ),
1847
+ /* @__PURE__ */ React21.createElement(
1848
+ input_default,
1849
+ {
1850
+ id: "search",
1851
+ size: "xl",
1852
+ value,
1853
+ onChange: (e) => setValue(e.target.value),
1854
+ sx: {
1855
+ borderBottomWidth: 0,
1856
+ fontSize: [4, 6, 7, 8],
1857
+ flexShrink: 0
1858
+ },
1859
+ color: "secondary"
1860
+ }
1861
+ ),
1862
+ /* @__PURE__ */ React21.createElement(Link3, { href: destination }, /* @__PURE__ */ React21.createElement(
1863
+ HoverArrow2,
1864
+ {
1865
+ sx: {
1866
+ opacity: value ? 1 : [1, 1, 0, 0],
1867
+ pointerEvents: value ? "all" : "none"
1868
+ }
1869
+ }
1870
+ ))
1871
+ ))), /* @__PURE__ */ React21.createElement(
1872
+ row_default,
1873
+ {
1874
+ columns: [6, 6, 10, 10],
1875
+ sx: { display: ["none", "grid", "grid", "grid"] }
1876
+ },
1877
+ /* @__PURE__ */ React21.createElement(
1878
+ column_default,
1879
+ {
1880
+ start: 1,
1881
+ width: 5,
1882
+ sx: { mt: [2, 2, 8, 8], mb: [1, 1, , 6, 6] }
1883
+ },
1884
+ /* @__PURE__ */ React21.createElement(Box13, { as: "h2", variant: "styles.h2", sx: { my: 0 } }, "Popular resources")
1885
+ ),
1886
+ /* @__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(
1887
+ button_default,
1888
+ {
1889
+ key: href,
1890
+ href,
1891
+ size: "md",
1892
+ sx: { mb: [1] },
1893
+ suffix: /* @__PURE__ */ React21.createElement(RotatingArrow, null)
1894
+ },
1895
+ label
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
+ )))
1958
+ ));
1959
+ };
1960
+ var search_menu_default = SearchMenu;
1961
+
1962
+ // src/header/header.tsx
1963
+ var Header = ({ status, mode, nav, menuItems }) => {
1964
+ const [menuExpanded, setMenuExpanded] = useState3(false);
1965
+ const [searchExpanded, setSearchExpanded] = useState3(false);
1966
+ const expanded = searchExpanded || menuExpanded;
1967
+ return /* @__PURE__ */ React22.createElement(
1968
+ row_default,
1969
+ {
1970
+ sx: {
1971
+ pt: ["12px"],
1972
+ pb: [3]
1973
+ }
1974
+ },
1975
+ /* @__PURE__ */ React22.createElement(column_default, { start: [1], width: [2] }, /* @__PURE__ */ React22.createElement(
1976
+ Box14,
1977
+ {
1978
+ sx: { pointerEvents: "all", display: "block", width: "fit-content" }
1979
+ },
1980
+ (mode == "homepage" || mode == "local") && /* @__PURE__ */ React22.createElement(NextLink3, { href: "/", passHref: true, legacyBehavior: true }, /* @__PURE__ */ React22.createElement(
1981
+ Link4,
1982
+ {
1983
+ "aria-label": "CarbonPlan Homepage",
1984
+ sx: {
1985
+ display: "block"
1986
+ }
1987
+ },
1988
+ /* @__PURE__ */ React22.createElement(
1989
+ logo_default,
1990
+ {
1991
+ id: "logo",
1992
+ sx: {
1993
+ cursor: "pointer",
1994
+ color: "primary"
1995
+ }
1996
+ }
1997
+ )
1998
+ )),
1999
+ (mode == null || mode == "remote") && /* @__PURE__ */ React22.createElement(
2000
+ Link4,
2001
+ {
2002
+ href: "https://carbonplan.org",
2003
+ "aria-label": "CarbonPlan Homepage",
2004
+ sx: { display: "block" }
2005
+ },
2006
+ /* @__PURE__ */ React22.createElement(logo_default, { sx: { cursor: "pointer", color: "primary" } })
2007
+ )
2008
+ )),
2009
+ /* @__PURE__ */ React22.createElement(
2010
+ column_default,
2011
+ {
2012
+ start: [4, 9],
2013
+ width: [2, 2],
2014
+ dr: 1,
2015
+ sx: {
2016
+ display: [status ? "flex" : "none", "flex", "flex", "flex"],
2017
+ alignItems: "center"
2018
+ }
2019
+ },
2020
+ /* @__PURE__ */ React22.createElement(
2021
+ Box14,
2022
+ {
2023
+ sx: {
2024
+ fontSize: [1, 2, 3],
2025
+ position: "relative",
2026
+ top: ["-2px", "-3px", "-3px"]
2027
+ }
2028
+ },
2029
+ status ? `(${status})` : ""
2030
+ )
2031
+ ),
2032
+ /* @__PURE__ */ React22.createElement(
2033
+ column_default,
2034
+ {
2035
+ start: [status ? 6 : 4, 6, 11, 11],
2036
+ width: [status ? 1 : 3, 3, 2, 2],
2037
+ sx: { zIndex: 5e3 }
2038
+ },
2039
+ /* @__PURE__ */ React22.createElement(Flex3, { sx: { pointerEvents: "all", justifyContent: "flex-end" } }, /* @__PURE__ */ React22.createElement(
2040
+ Box14,
2041
+ {
2042
+ sx: {
2043
+ display: [status ? "none" : "flex", "flex", "flex", "flex"],
2044
+ mr: "18px",
2045
+ gap: "18px",
2046
+ opacity: expanded ? 0 : 1,
2047
+ transition: "opacity 0.15s",
2048
+ justifyContent: "space-between",
2049
+ alignItems: "center"
2050
+ }
2051
+ },
2052
+ menuItems
2053
+ ), /* @__PURE__ */ React22.createElement(Flex3, { sx: { gap: 4 } }, /* @__PURE__ */ React22.createElement(
2054
+ search_default,
2055
+ {
2056
+ value: searchExpanded,
2057
+ onClick: () => {
2058
+ setSearchExpanded(!searchExpanded);
2059
+ !searchExpanded && setMenuExpanded(false);
2060
+ }
2061
+ }
2062
+ ), /* @__PURE__ */ React22.createElement(
2063
+ menu_default,
2064
+ {
2065
+ sx: {
2066
+ flexShrink: 0,
2067
+ mr: ["-2px"]
2068
+ },
2069
+ value: menuExpanded,
2070
+ onClick: () => {
2071
+ setMenuExpanded(!menuExpanded);
2072
+ !menuExpanded && setSearchExpanded(false);
2073
+ }
2074
+ }
2075
+ )))
2076
+ ),
2077
+ /* @__PURE__ */ React22.createElement(
2078
+ Box14,
2079
+ {
2080
+ sx: {
2081
+ opacity: expanded ? 1 : 0,
2082
+ pointerEvents: expanded ? "all" : "none",
2083
+ position: "fixed",
2084
+ top: "0px",
2085
+ right: "0px",
2086
+ bottom: "0px",
2087
+ minWidth: "0px",
2088
+ maxHeight: "100vh",
2089
+ width: "100vw",
2090
+ backgroundColor: "background",
2091
+ zIndex: 4e3,
2092
+ pt: ["79px"],
2093
+ transition: "opacity 0.25s"
2094
+ }
2095
+ },
2096
+ /* @__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(
2097
+ Box14,
2098
+ {
2099
+ as: "nav",
2100
+ sx: {
2101
+ display: menuExpanded ? "inherit" : "none",
2102
+ mt: [5, 5, 5, 6]
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 }))))
2114
+ )
2115
+ );
2116
+ };
2117
+ var header_default = Header;
2118
+
2119
+ // src/footer.tsx
2120
+ import React24, { useState as useState4, useEffect as useEffect3 } from "react";
2121
+ import { Box as Box16, Flex as Flex4, Link as Link5 } from "theme-ui";
2122
+ import { default as NextLink4 } from "next/link";
2123
+
2124
+ // src/monogram.tsx
2125
+ import React23 from "react";
2126
+ import { Box as Box15 } from "theme-ui";
2127
+ var Monogram = (_a) => {
2128
+ var props = __objRest(_a, []);
2129
+ return /* @__PURE__ */ React23.createElement(
2130
+ Box15,
2131
+ __spreadValues(__spreadValues({
2132
+ as: "svg"
2133
+ }, {
2134
+ width: "80",
2135
+ stroke: "none",
2136
+ fill: "currentColor",
2137
+ viewBox: "0 0 32 32"
2138
+ }), props),
2139
+ /* @__PURE__ */ React23.createElement("path", { d: "M21.9395,14.9395 L17.5005,19.3785 L17.5005,7.0005 L14.5005,7.0005 L14.5005,19.3785 L10.0605,14.9395 L7.9395,17.0605 L14.9395,24.0605 C15.2325,24.3535 15.6165,24.5005 16.0005,24.5005 C16.3835,24.5005 16.7675,24.3535 17.0605,24.0605 L24.0605,17.0605 L21.9395,14.9395 Z" }),
2140
+ /* @__PURE__ */ React23.createElement("path", { d: "M27.5986,4 L22.8966,4 C26.5556,6.303 28.9996,10.366 28.9996,15 C28.9996,20.4 25.6896,25.039 20.9926,27 L26.5586,27 C29.8886,24.068 31.9996,19.785 31.9996,15 C31.9996,10.734 30.3196,6.868 27.5986,4" }),
2141
+ /* @__PURE__ */ React23.createElement("path", { d: "M3,15 C3,10.366 5.444,6.303 9.104,4 L4.401,4 C1.68,6.868 0,10.734 0,15 C0,19.785 2.112,24.068 5.441,27 L11.008,27 C6.311,25.039 3,20.4 3,15" })
2142
+ );
2143
+ };
2144
+ var monogram_default = Monogram;
2145
+
2146
+ // src/footer.tsx
2147
+ var Footer = () => {
2148
+ const [year, setYear] = useState4(null);
2149
+ useEffect3(() => {
2150
+ setYear((/* @__PURE__ */ new Date()).getFullYear());
2151
+ }, []);
2152
+ return /* @__PURE__ */ React24.createElement(
2153
+ Box16,
2154
+ {
2155
+ sx: {
2156
+ mt: [7, 7, 7, 8],
2157
+ mb: [7, 7, 7, 8],
2158
+ pb: [2, 1, 0, 0]
2159
+ }
2160
+ },
2161
+ /* @__PURE__ */ React24.createElement(row_default, { sx: { mb: [0, 0, 4, 5] } }, /* @__PURE__ */ React24.createElement(column_default, { start: [1, 2], width: [3, 3] }, /* @__PURE__ */ React24.createElement(Box16, null, /* @__PURE__ */ React24.createElement(
2162
+ Box16,
2163
+ {
2164
+ sx: {
2165
+ fontSize: [2, 2, 2, 3],
2166
+ fontFamily: "heading",
2167
+ letterSpacing: "mono",
2168
+ mb: [2]
2169
+ }
2170
+ },
2171
+ "EMAIL"
2172
+ ), /* @__PURE__ */ React24.createElement(
2173
+ Link5,
2174
+ {
2175
+ href: "mailto:hello@carbonplan.org",
2176
+ sx: {
2177
+ textDecoration: "none",
2178
+ fontSize: [2, 2, 2, 3]
2179
+ }
2180
+ },
2181
+ "hello@carbonplan.org"
2182
+ ))), /* @__PURE__ */ React24.createElement(
2183
+ column_default,
2184
+ {
2185
+ start: [5],
2186
+ width: [1],
2187
+ dl: 1,
2188
+ dr: 1,
2189
+ sx: {
2190
+ display: ["flex", "none", "none", "none"],
2191
+ justifyContent: ["center"]
2192
+ }
2193
+ },
2194
+ /* @__PURE__ */ React24.createElement(monogram_default, { sx: { mt: ["-4px"], width: "60px", height: "60px" } })
2195
+ ), /* @__PURE__ */ React24.createElement(column_default, { start: [1, 5, 5, 5], width: [3, 3], sx: { mt: [3, 0, 0, 0] } }, /* @__PURE__ */ React24.createElement(Box16, null, /* @__PURE__ */ React24.createElement(
2196
+ Box16,
2197
+ {
2198
+ sx: {
2199
+ fontSize: [2, 2, 2, 3],
2200
+ fontFamily: "heading",
2201
+ letterSpacing: "mono",
2202
+ mb: [2]
2203
+ }
2204
+ },
2205
+ "NEWSLETTER"
2206
+ ), /* @__PURE__ */ React24.createElement(
2207
+ Link5,
2208
+ {
2209
+ href: "https://carbonplan.org/newsletter",
2210
+ sx: {
2211
+ textDecoration: "none",
2212
+ fontSize: [2, 2, 2, 3]
2213
+ }
2214
+ },
2215
+ "Subscribe"
2216
+ ))), /* @__PURE__ */ React24.createElement(
2217
+ column_default,
2218
+ {
2219
+ start: [1, 9],
2220
+ width: [5, 4, 3, 3],
2221
+ sx: { mt: ["42px", "42px", 0, 0], mb: [3, 3, 0, 0] }
2222
+ },
2223
+ /* @__PURE__ */ React24.createElement(Box16, null, /* @__PURE__ */ React24.createElement(
2224
+ Box16,
2225
+ {
2226
+ sx: {
2227
+ fontSize: [2, 2, 2, 3],
2228
+ fontFamily: "body",
2229
+ color: "secondary"
2230
+ }
2231
+ },
2232
+ "CarbonPlan is a registered nonprofit public benefit corporation in California with 501(c)(3) status."
2233
+ ))
2234
+ )),
2235
+ /* @__PURE__ */ React24.createElement(row_default, { sx: { mb: ["2px"], mt: [5, 5, 4] } }, /* @__PURE__ */ React24.createElement(
2236
+ column_default,
2237
+ {
2238
+ start: [1, 1, 2, 2],
2239
+ width: [3, 2, 3, 3],
2240
+ sx: {
2241
+ display: "flex",
2242
+ alignItems: ["flex-start", "flex-start", "flex-end"]
2243
+ }
2244
+ },
2245
+ /* @__PURE__ */ React24.createElement(
2246
+ Box16,
2247
+ {
2248
+ sx: {
2249
+ bottom: "0px",
2250
+ borderStyle: "solid",
2251
+ borderColor: "muted",
2252
+ borderWidth: "0px",
2253
+ borderTopWidth: "1px",
2254
+ display: "inline-block",
2255
+ pt: [2]
2256
+ }
2257
+ },
2258
+ /* @__PURE__ */ React24.createElement(
2259
+ Box16,
2260
+ {
2261
+ sx: {
2262
+ color: "secondary",
2263
+ fontSize: [1, 1, 1, 2],
2264
+ fontFamily: "mono",
2265
+ letterSpacing: "mono"
2266
+ }
2267
+ },
2268
+ /* @__PURE__ */ React24.createElement(
2269
+ Flex4,
2270
+ {
2271
+ sx: {
2272
+ flexDirection: ["column", "column", "row", "row"],
2273
+ gap: [0, 0, "10px", "12px"]
2274
+ }
2275
+ },
2276
+ /* @__PURE__ */ React24.createElement(Box16, null, "(c) ", year),
2277
+ /* @__PURE__ */ React24.createElement(Box16, null, "CARBONPLAN")
2278
+ )
2279
+ )
2280
+ )
2281
+ ), /* @__PURE__ */ React24.createElement(
2282
+ column_default,
2283
+ {
2284
+ start: [4, 3, 5, 5],
2285
+ width: [3, 3, 4, 4],
2286
+ sx: {
2287
+ display: "flex",
2288
+ alignItems: ["flex-start", "flex-start", "flex-end"],
2289
+ mt: [0, 0, 0, 0]
2290
+ }
2291
+ },
2292
+ /* @__PURE__ */ React24.createElement(
2293
+ Box16,
2294
+ {
2295
+ sx: {
2296
+ bottom: "0px",
2297
+ borderStyle: "solid",
2298
+ borderColor: "muted",
2299
+ borderWidth: "0px",
2300
+ borderTopWidth: "1px",
2301
+ pt: [2]
2302
+ }
2303
+ },
2304
+ /* @__PURE__ */ React24.createElement(
2305
+ Flex4,
2306
+ {
2307
+ sx: {
2308
+ color: "secondary",
2309
+ fontSize: [1, 1, 1, 2],
2310
+ fontFamily: "mono",
2311
+ letterSpacing: "mono",
2312
+ flexDirection: ["column", "column", "row", "row"],
2313
+ gap: [0, 0, "10px", "12px"]
2314
+ }
2315
+ },
2316
+ /* @__PURE__ */ React24.createElement(NextLink4, { href: "/terms", passHref: true, legacyBehavior: true }, /* @__PURE__ */ React24.createElement(
2317
+ Box16,
2318
+ {
2319
+ as: "a",
2320
+ sx: {
2321
+ color: "secondary",
2322
+ "&:hover": {
2323
+ color: "primary"
2324
+ }
2325
+ }
2326
+ },
2327
+ "TERMS OF USE"
2328
+ )),
2329
+ /* @__PURE__ */ React24.createElement(Box16, { sx: { display: ["none", "none", "initial", "initial"] } }, " / "),
2330
+ /* @__PURE__ */ React24.createElement(NextLink4, { href: "/privacy", passHref: true, legacyBehavior: true }, /* @__PURE__ */ React24.createElement(
2331
+ Box16,
2332
+ {
2333
+ as: "a",
2334
+ sx: {
2335
+ color: "secondary",
2336
+ "&:hover": {
2337
+ color: "primary"
2338
+ }
2339
+ }
2340
+ },
2341
+ "PRIVACY POLICY"
2342
+ ))
2343
+ )
2344
+ )
2345
+ ), /* @__PURE__ */ React24.createElement(
2346
+ column_default,
2347
+ {
2348
+ start: [5, 7, 9, 9],
2349
+ width: [2, 2, 3, 3],
2350
+ sx: { display: ["none", "initial", "initial", "initial"] }
2351
+ },
2352
+ /* @__PURE__ */ React24.createElement(
2353
+ monogram_default,
2354
+ {
2355
+ sx: {
2356
+ width: 80,
2357
+ height: 80,
2358
+ mt: [0, "-10px", 4, 5],
2359
+ mb: ["-12px"]
2360
+ }
2361
+ }
2362
+ )
2363
+ ))
2364
+ );
2365
+ };
2366
+ var footer_default = Footer;
2367
+
2368
+ // src/dimmer.tsx
2369
+ import React25 from "react";
2370
+ import { IconButton as IconButton2, useColorMode } from "theme-ui";
2371
+ import { useCallback } from "react";
2372
+ import { Sun } from "@carbonplan/icons";
2373
+ var Dimmer = (_a) => {
2374
+ var _b = _a, { sx: sx4 = {} } = _b, props = __objRest(_b, ["sx"]);
2375
+ const [colorMode, setColorMode] = useColorMode();
2376
+ const toggle = useCallback(() => {
2377
+ setColorMode(colorMode === "light" ? "dark" : "light");
2378
+ }, [colorMode]);
2379
+ return /* @__PURE__ */ React25.createElement(
2380
+ IconButton2,
2381
+ __spreadValues({
2382
+ "aria-label": "Toggle dark mode",
2383
+ onClick: toggle,
2384
+ role: "checkbox",
2385
+ sx: __spreadValues({
2386
+ width: 32,
2387
+ height: 32,
2388
+ display: "inline-block",
2389
+ cursor: "pointer",
2390
+ color: "secondary"
2391
+ }, sx4)
2392
+ }, props),
2393
+ /* @__PURE__ */ React25.createElement(
2394
+ Sun,
2395
+ {
2396
+ sx: {
2397
+ strokeWidth: "1.75",
2398
+ transition: "stroke 0.15s",
2399
+ "@media (hover: hover) and (pointer: fine)": {
2400
+ "&:hover": {
2401
+ stroke: "primary"
2402
+ }
2403
+ }
2404
+ }
2405
+ }
2406
+ )
2407
+ );
2408
+ };
2409
+ var dimmer_default = Dimmer;
2410
+
2411
+ // src/metadata.tsx
2412
+ import React27 from "react";
2413
+ import { Box as Box18, Text as Text2 } from "theme-ui";
2414
+ import { useState as useState5, useEffect as useEffect4 } from "react";
2415
+
2416
+ // src/gitsha.tsx
2417
+ import React26 from "react";
2418
+ import { Box as Box17, Text, Link as Link6, useThemeUI as useThemeUI2 } from "theme-ui";
2419
+ var GitSha = () => {
2420
+ var _a;
2421
+ const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
2422
+ const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
2423
+ const slug = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG;
2424
+ const { theme } = useThemeUI2();
2425
+ const color = (_a = theme.rawColors) == null ? void 0 : _a.secondary;
2426
+ if (sha && owner && slug) {
2427
+ const shortSha = sha.substring(0, 7);
2428
+ const href = "https://github.com/" + owner + "/" + slug + "/tree/" + sha;
2429
+ return /* @__PURE__ */ React26.createElement(Box17, { sx: { display: "inline-block", width: "87px" } }, /* @__PURE__ */ React26.createElement(Separator, { color: typeof color === "string" ? color : void 0 }), /* @__PURE__ */ React26.createElement(
2430
+ Link6,
2431
+ {
2432
+ href,
2433
+ sx: {
2434
+ whiteSpace: "nowrap",
2435
+ display: "inline-block",
2436
+ ml: [2],
2437
+ fontFamily: "mono",
2438
+ letterSpacing: "body",
2439
+ color,
2440
+ fontSize: [1],
2441
+ textTransform: "uppercase",
2442
+ textDecoration: "none"
2443
+ }
2444
+ },
2445
+ shortSha
2446
+ ));
2447
+ } else {
2448
+ return /* @__PURE__ */ React26.createElement(Box17, { sx: { display: "inline-block", width: "87px" } }, /* @__PURE__ */ React26.createElement(Separator, { color: typeof color === "string" ? color : void 0 }), /* @__PURE__ */ React26.createElement(
2449
+ Text,
2450
+ {
2451
+ sx: {
2452
+ whiteSpace: "nowrap",
2453
+ display: "inline-block",
2454
+ ml: [2],
2455
+ fontFamily: "mono",
2456
+ letterSpacing: "body",
2457
+ color,
2458
+ fontSize: [1],
2459
+ textTransform: "uppercase"
2460
+ }
2461
+ },
2462
+ typeof color === "string" ? color : ""
2463
+ ));
2464
+ }
2465
+ };
2466
+ var Separator = ({ color = "secondary" }) => {
2467
+ return /* @__PURE__ */ React26.createElement("svg", { fill: color, opacity: "0.8", viewBox: "0 0 24 24", width: "24", height: "24" }, /* @__PURE__ */ React26.createElement("circle", { r: 5, cx: 19, cy: 19 }));
2468
+ };
2469
+ var gitsha_default = GitSha;
2470
+
2471
+ // src/metadata.tsx
2472
+ var Value = ({ mode }) => {
2473
+ const [display, setDisplay] = useState5(init(mode));
2474
+ useEffect4(() => {
2475
+ if (mode === "mouse") {
2476
+ const setFromEvent = (e) => {
2477
+ const x = format(e.clientX, 4);
2478
+ const y = format(e.clientY, 4);
2479
+ setDisplay(`X,Y: ${x},${y}`);
2480
+ };
2481
+ window.addEventListener("mousemove", setFromEvent);
2482
+ return () => {
2483
+ window.removeEventListener("mousemove", setFromEvent);
2484
+ };
2485
+ }
2486
+ if (mode === "scroll") {
2487
+ const setFromEvent = () => {
2488
+ const y = scrollFraction(window, document);
2489
+ setDisplay(`SCROLL: 0.${format((y * 100).toFixed(0), 2)}`);
2490
+ };
2491
+ window.addEventListener("scroll", setFromEvent);
2492
+ return () => {
2493
+ window.removeEventListener("scroll", setFromEvent);
2494
+ };
2495
+ }
2496
+ }, []);
2497
+ return /* @__PURE__ */ React27.createElement(
2498
+ Text2,
2499
+ {
2500
+ sx: {
2501
+ whiteSpace: "nowrap",
2502
+ display: "inline-block",
2503
+ mr: "-6px",
2504
+ fontFamily: "mono",
2505
+ letterSpacing: "body",
2506
+ color: "secondary",
2507
+ fontSize: [1],
2508
+ textTransform: "uppercase"
2509
+ }
2510
+ },
2511
+ display
2512
+ );
2513
+ };
2514
+ var Metadata = ({ mode }) => {
2515
+ return /* @__PURE__ */ React27.createElement(
2516
+ Box18,
2517
+ {
2518
+ sx: {
2519
+ userSelect: "none",
2520
+ position: "fixed",
2521
+ bottom: "42px",
2522
+ right: "24px",
2523
+ transformOrigin: "right",
2524
+ transform: "rotate(90deg)",
2525
+ display: ["none", "none", "initial"]
2526
+ }
2527
+ },
2528
+ /* @__PURE__ */ React27.createElement(Value, { mode }),
2529
+ /* @__PURE__ */ React27.createElement(gitsha_default, null)
2530
+ );
2531
+ };
2532
+ function init(mode) {
2533
+ if (mode === "mouse") {
2534
+ return `X,Y: ${format(0, 4)},${format(0, 4)}`;
2535
+ } else if (mode === "scroll") {
2536
+ return `SCROLL: 0.${format(0 .toFixed(0), 2)}`;
2537
+ } else {
2538
+ return mode;
2539
+ }
2540
+ }
2541
+ function format(num, pad) {
2542
+ return num.toString().padStart(pad, "0");
2543
+ }
2544
+ function scrollFraction(window2, document2) {
2545
+ return Math.min(window2.scrollY / (document2.body.offsetHeight - 770), 0.99);
2546
+ }
2547
+ var metadata_default = Metadata;
2548
+
2549
+ // src/fade-in.tsx
2550
+ import React28 from "react";
2551
+ import { Box as Box19 } from "theme-ui";
2552
+ import { keyframes } from "@emotion/react";
2553
+ var fade = keyframes({
2554
+ from: {
2555
+ opacity: 0
2556
+ },
2557
+ to: {
2558
+ opacity: 1
2559
+ }
2560
+ });
2561
+ var FadeIn = (_a) => {
2562
+ var _b = _a, {
2563
+ duration = 300,
2564
+ delay = 0,
2565
+ children
2566
+ } = _b, delegated = __objRest(_b, [
2567
+ "duration",
2568
+ "delay",
2569
+ "children"
2570
+ ]);
2571
+ return /* @__PURE__ */ React28.createElement(
2572
+ Box19,
2573
+ __spreadProps(__spreadValues({}, delegated), {
2574
+ sx: {
2575
+ animationDuration: duration + "ms",
2576
+ animationDelay: delay + "ms",
2577
+ animationName: fade.toString(),
2578
+ animationFillMode: "backwards",
2579
+ WebkitTransform: "translateZ(0)"
2580
+ }
2581
+ }),
2582
+ children
2583
+ );
2584
+ };
2585
+ var fade_in_default = FadeIn;
2586
+
2587
+ // src/scrollbar.tsx
2588
+ import { useEffect as useEffect5 } from "react";
2589
+
2590
+ // src/utils/get-scrollbar-width.ts
2591
+ var getScrollbarWidth = (document2) => {
2592
+ const outer = document2.createElement("div");
2593
+ outer.style.visibility = "hidden";
2594
+ outer.style.width = "100px";
2595
+ document2.body.appendChild(outer);
2596
+ outer.style.overflow = "scroll";
2597
+ const inner = document2.createElement("div");
2598
+ inner.style.width = "100%";
2599
+ outer.appendChild(inner);
2600
+ const delta = outer.offsetWidth - inner.offsetWidth;
2601
+ document2.body.removeChild(outer);
2602
+ return delta;
2603
+ };
2604
+ var get_scrollbar_width_default = getScrollbarWidth;
2605
+
2606
+ // src/scrollbar.tsx
2607
+ var Scrollbar = () => {
2608
+ useEffect5(() => {
2609
+ if (typeof document !== "undefined") {
2610
+ const delta = get_scrollbar_width_default(document);
2611
+ if (delta > 0) {
2612
+ document.body.classList.add("custom-scrollbar");
2613
+ document.getElementsByTagName("html")[0].classList.add("custom-scrollbar");
2614
+ }
2615
+ }
2616
+ }, []);
2617
+ return null;
2618
+ };
2619
+ var scrollbar_default = Scrollbar;
2620
+
2621
+ // src/guide.tsx
2622
+ import React29, { useState as useState6, useEffect as useEffect6 } from "react";
2623
+ import { Box as Box20, Container as Container2 } from "theme-ui";
2624
+ var Guide = ({ color = "muted" }) => {
2625
+ const [display, setDisplay] = useState6(false);
2626
+ useEffect6(() => {
2627
+ function handler(event) {
2628
+ const { key, metaKey } = event;
2629
+ if (key === ";" && metaKey) {
2630
+ setDisplay((prev) => !prev);
2631
+ }
2632
+ }
2633
+ document.addEventListener("keydown", handler);
2634
+ return () => {
2635
+ document.removeEventListener("keydown", handler);
2636
+ };
2637
+ }, []);
2638
+ return /* @__PURE__ */ React29.createElement(
2639
+ Box20,
2640
+ {
2641
+ sx: {
2642
+ position: "fixed",
2643
+ width: "100%",
2644
+ left: 0,
2645
+ top: 0,
2646
+ zIndex: color === "teal" ? 5e3 : -1,
2647
+ pointerEvents: "none",
2648
+ display: display ? "initial" : "none"
2649
+ }
2650
+ },
2651
+ /* @__PURE__ */ React29.createElement(Container2, null, /* @__PURE__ */ React29.createElement(Box20, { sx: { display: ["none", "none", "initial", "initial"] } }, /* @__PURE__ */ React29.createElement(
2652
+ GuideColumns,
2653
+ {
2654
+ indices: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
2655
+ color
2656
+ }
2657
+ )), /* @__PURE__ */ React29.createElement(Box20, { sx: { display: ["none", "initial", "none", "none"] } }, /* @__PURE__ */ React29.createElement(GuideColumns, { indices: [1, 2, 3, 4, 5, 6, 7, 8], color })), /* @__PURE__ */ React29.createElement(Box20, { sx: { display: ["initial", "none", "none", "none"] } }, /* @__PURE__ */ React29.createElement(GuideColumns, { indices: [1, 2, 3, 4, 5, 6], color })))
2658
+ );
2659
+ };
2660
+ var colorCycle = [
2661
+ "red",
2662
+ "orange",
2663
+ "yellow",
2664
+ "green",
2665
+ "teal",
2666
+ "blue",
2667
+ "purple",
2668
+ "pink"
2669
+ ];
2670
+ function GuideColumns({
2671
+ indices,
2672
+ color
2673
+ }) {
2674
+ const sx4 = {
2675
+ outerGuideColumn: {
2676
+ borderStyle: "solid",
2677
+ borderWidth: "0px",
2678
+ borderLeftWidth: color === "teal" ? "0px" : "1px",
2679
+ borderRightWidth: color === "teal" ? "0px" : "1px",
2680
+ opacity: color === "teal" ? 0.4 : 1
2681
+ },
2682
+ innerGuideColumn: {
2683
+ borderStyle: "solid",
2684
+ borderWidth: "0px",
2685
+ borderLeftWidth: "0px",
2686
+ borderRightWidth: "0px",
2687
+ opacity: color === "teal" ? 0.4 : 1
2688
+ }
2689
+ };
2690
+ return /* @__PURE__ */ React29.createElement(row_default, null, indices.map((i) => {
2691
+ return /* @__PURE__ */ React29.createElement(
2692
+ column_default,
2693
+ {
2694
+ key: i,
2695
+ start: [i],
2696
+ width: [1, 1],
2697
+ dl: 0.5,
2698
+ dr: 0.5,
2699
+ sx: __spreadValues({
2700
+ bg: color === "teal" ? "teal" : "transparent",
2701
+ height: "100vh"
2702
+ }, sx4.innerGuideColumn)
2703
+ },
2704
+ /* @__PURE__ */ React29.createElement(
2705
+ Box20,
2706
+ {
2707
+ sx: __spreadValues({
2708
+ mx: ["12px", 3, 3, 4],
2709
+ bg: color === "teal" ? "background" : "transparent",
2710
+ height: "100%",
2711
+ borderLeftColor: color === "rainbow" ? colorCycle[i % 8] : "muted",
2712
+ borderRightColor: color === "rainbow" ? colorCycle[i % 8] : "muted"
2713
+ }, sx4.outerGuideColumn)
2714
+ }
2715
+ )
2716
+ );
2717
+ }));
2718
+ }
2719
+ var guide_default = Guide;
2720
+
2721
+ // src/settings.tsx
2722
+ import React30 from "react";
2723
+ var Settings = (props) => {
2724
+ return /* @__PURE__ */ React30.createElement(header_icon_default, __spreadValues({ label: "Toggle Settings" }, props), /* @__PURE__ */ React30.createElement("line", { x1: "24", y1: "2.1", x2: "24", y2: "6.1" }), /* @__PURE__ */ React30.createElement("line", { x1: "24", y1: "24.1", x2: "24", y2: "33.9" }), /* @__PURE__ */ React30.createElement("line", { x1: "44", y1: "2.1", x2: "44", y2: "12.1" }), /* @__PURE__ */ React30.createElement("line", { x1: "44", y1: "30.1", x2: "44", y2: "33.9" }), /* @__PURE__ */ React30.createElement("circle", { cx: "24", cy: "15.1", r: "5" }), /* @__PURE__ */ React30.createElement("circle", { cx: "44", cy: "21.1", r: "5" }));
2725
+ };
2726
+ var settings_default = Settings;
2727
+
2728
+ // src/layout.tsx
2729
+ var Layout = ({
2730
+ title,
2731
+ description,
2732
+ url,
2733
+ card,
2734
+ children,
2735
+ status,
2736
+ nav,
2737
+ settings,
2738
+ footer = true,
2739
+ header = true,
2740
+ metadata = "mouse",
2741
+ links: links2 = "remote",
2742
+ dimmer = "bottom",
2743
+ guide = true,
2744
+ scrollbar = false,
2745
+ fade: fade2 = true,
2746
+ container = true,
2747
+ printable = false
2748
+ }) => {
2749
+ let content = children;
2750
+ if (fade2) {
2751
+ content = /* @__PURE__ */ React31.createElement(fade_in_default, { duration: 250 }, content);
2752
+ }
2753
+ if (container) {
2754
+ content = /* @__PURE__ */ React31.createElement(Box21, { sx: { mb: [8, 8, 9, 10] } }, /* @__PURE__ */ React31.createElement(Container3, null, content));
2755
+ }
2756
+ const { theme } = useThemeUI3();
2757
+ const hideOnPrint = printable ? {
2758
+ "@media print": {
2759
+ display: "none"
2760
+ }
2761
+ } : {};
2762
+ useEffect7(() => {
2763
+ var _a;
2764
+ if (!theme) return;
2765
+ const handler = (e) => {
2766
+ if (e.matches && (settings == null ? void 0 : settings.value) && (settings == null ? void 0 : settings.onClick)) {
2767
+ settings.onClick();
2768
+ }
2769
+ };
2770
+ const query = window.matchMedia(
2771
+ `(min-width: ${((_a = theme == null ? void 0 : theme.breakpoints) == null ? void 0 : _a[1]) || "64em"})`
2772
+ );
2773
+ query.onchange = handler;
2774
+ return () => {
2775
+ query.onchange = null;
2776
+ };
2777
+ }, [theme == null ? void 0 : theme.breakpoints, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2778
+ const menuItems = [
2779
+ /* @__PURE__ */ React31.createElement(
2780
+ dimmer_default,
2781
+ {
2782
+ key: "dimmer",
2783
+ sx: {
2784
+ color: "primary",
2785
+ mt: "-2px",
2786
+ display: [
2787
+ "block",
2788
+ "block",
2789
+ dimmer === "top" ? "block" : "none",
2790
+ dimmer === "top" ? "block" : "none"
2791
+ ]
2792
+ }
2793
+ }
2794
+ )
2795
+ ];
2796
+ if (settings) {
2797
+ menuItems.push(
2798
+ /* @__PURE__ */ React31.createElement(
2799
+ settings_default,
2800
+ __spreadValues({
2801
+ key: "settings",
2802
+ sx: { mr: ["2px"], display: ["inherit", "inherit", "none", "none"] }
2803
+ }, settings)
2804
+ )
2805
+ );
2806
+ }
2807
+ return /* @__PURE__ */ React31.createElement(React31.Fragment, null, guide && /* @__PURE__ */ React31.createElement(guide_default, { color: typeof guide === "string" ? guide : void 0 }), scrollbar && /* @__PURE__ */ React31.createElement(scrollbar_default, null), /* @__PURE__ */ React31.createElement(meta_default, { card, description, title, url }), /* @__PURE__ */ React31.createElement(
2808
+ Flex5,
2809
+ {
2810
+ sx: {
2811
+ flexDirection: "column",
2812
+ minHeight: "100vh"
2813
+ }
2814
+ },
2815
+ header && /* @__PURE__ */ React31.createElement(
2816
+ Box21,
2817
+ {
2818
+ as: "header",
2819
+ sx: __spreadValues({
2820
+ width: "100%",
2821
+ borderStyle: "solid",
2822
+ borderColor: "muted",
2823
+ borderWidth: "0px",
2824
+ borderBottomWidth: "1px",
2825
+ position: "sticky",
2826
+ top: 0,
2827
+ bg: "background",
2828
+ height: "56px",
2829
+ zIndex: 2e3
2830
+ }, hideOnPrint)
2831
+ },
2832
+ /* @__PURE__ */ React31.createElement(Container3, null, /* @__PURE__ */ React31.createElement(
2833
+ header_default,
2834
+ {
2835
+ mode: links2,
2836
+ status,
2837
+ nav,
2838
+ menuItems
2839
+ }
2840
+ ))
2841
+ ),
2842
+ /* @__PURE__ */ React31.createElement(
2843
+ Box21,
2844
+ {
2845
+ sx: {
2846
+ width: "100%",
2847
+ flex: "1 1 auto"
2848
+ }
2849
+ },
2850
+ content
2851
+ ),
2852
+ footer && /* @__PURE__ */ React31.createElement(
2853
+ Box21,
2854
+ {
2855
+ as: "footer",
2856
+ sx: __spreadValues({
2857
+ width: "100%",
2858
+ borderStyle: "solid",
2859
+ borderColor: "muted",
2860
+ borderWidth: "0px",
2861
+ borderTopWidth: "1px"
2862
+ }, hideOnPrint)
2863
+ },
2864
+ /* @__PURE__ */ React31.createElement(Container3, null, /* @__PURE__ */ React31.createElement(footer_default, null))
2865
+ ),
2866
+ dimmer === "bottom" && /* @__PURE__ */ React31.createElement(
2867
+ Box21,
2868
+ {
2869
+ sx: {
2870
+ display: ["none", "none", "initial", "initial"],
2871
+ position: ["fixed"],
2872
+ right: [13],
2873
+ bottom: [17, 17, 15, 15]
2874
+ }
2875
+ },
2876
+ /* @__PURE__ */ React31.createElement(dimmer_default, null)
2877
+ ),
2878
+ metadata && /* @__PURE__ */ React31.createElement(metadata_default, { mode: typeof metadata === "string" ? metadata : "mouse" })
2879
+ ));
2880
+ };
2881
+ var layout_default = Layout;
2882
+
2883
+ // src/custom-404.tsx
2884
+ var Custom404 = () => {
2885
+ return /* @__PURE__ */ React32.createElement(
2886
+ layout_default,
2887
+ {
2888
+ footer: false,
2889
+ title: "404 \u2013 CarbonPlan",
2890
+ description: "Sorry but we can't seem to find the page you are looking for."
2891
+ },
2892
+ /* @__PURE__ */ React32.createElement(row_default, { sx: { mb: [5, 0, 0], pt: [0, 0, 6] } }, /* @__PURE__ */ React32.createElement(column_default, { start: [1, 1, 3, 3], width: [6, 4, 4, 4] }, /* @__PURE__ */ React32.createElement(Box22, { as: "h1", variant: "styles.h1" }, "Oops!"), /* @__PURE__ */ React32.createElement(
2893
+ Box22,
2894
+ {
2895
+ sx: {
2896
+ fontSize: [4, 4, 4, 5],
2897
+ lineHeight: "h3",
2898
+ mt: [3, 4, 4],
2899
+ mb: [2, 3, 3],
2900
+ maxWidth: ["90%", "90%", "400px"]
2901
+ }
2902
+ },
2903
+ "Sorry but we can't seem to find the page you are looking for."
2904
+ ), /* @__PURE__ */ React32.createElement(
2905
+ Box22,
2906
+ {
2907
+ sx: {
2908
+ color: "secondary",
2909
+ fontFamily: "mono",
2910
+ letterSpacing: "mono",
2911
+ fontSize: [2, 2, 2, 3],
2912
+ mt: [4, 5, 5]
2913
+ }
2914
+ },
2915
+ "ERROR CODE 404"
2916
+ )), /* @__PURE__ */ React32.createElement(column_default, { start: [2, 5, 7, 7], width: [4, 4, 4, 4] }, /* @__PURE__ */ React32.createElement(
2917
+ Box22,
2918
+ {
2919
+ sx: {
2920
+ width: ["100%"],
2921
+ mt: [2, 4, 4, 5],
2922
+ fill: "primary"
2923
+ }
2924
+ },
2925
+ /* @__PURE__ */ React32.createElement(PoopSad, { sx: { width: "100%", height: "auto" } })
2926
+ )))
2927
+ );
2928
+ };
2929
+ var custom_404_default = Custom404;
2930
+
2931
+ // src/expander.tsx
2932
+ import React33 from "react";
2933
+ import { IconButton as IconButton3 } from "theme-ui";
2934
+ var Expander = ({ value, id, onClick, sx: sx4 }) => {
2935
+ return /* @__PURE__ */ React33.createElement(
2936
+ IconButton3,
2937
+ {
2938
+ onClick,
2939
+ id,
2940
+ role: "checkbox",
2941
+ "aria-checked": value,
2942
+ "aria-label": "Expand",
2943
+ sx: __spreadValues({
2944
+ display: "inline-block",
2945
+ width: 24,
2946
+ height: 24,
2947
+ p: [1],
2948
+ cursor: "pointer",
2949
+ fill: "secondary",
2950
+ stroke: "secondary",
2951
+ "@media (hover: hover) and (pointer: fine)": {
2952
+ "&:hover": {
2953
+ fill: "primary",
2954
+ stroke: "primary"
2955
+ }
2956
+ }
2957
+ }, sx4)
2958
+ },
2959
+ /* @__PURE__ */ React33.createElement("svg", { viewBox: "0 0 16 16" }, /* @__PURE__ */ React33.createElement(
2960
+ "path",
2961
+ {
2962
+ d: "M8,0 V16 M0,8 H16",
2963
+ style: {
2964
+ strokeWidth: 2,
2965
+ transition: "0.25s all",
2966
+ transformOrigin: "8px 8px",
2967
+ transform: value ? "rotate(45deg)" : "rotate(0deg)"
2968
+ }
2969
+ }
2970
+ ))
2971
+ );
2972
+ };
2973
+ var expander_default = Expander;
2974
+
2975
+ // src/figure.tsx
2976
+ import React34 from "react";
2977
+ import { Box as Box23 } from "theme-ui";
2978
+ var Figure = ({ as = "figure", children, sx: sx4 }) => {
2979
+ const childrenArray = React34.Children.toArray(children);
2980
+ const captionElement = childrenArray.find((child) => {
2981
+ if (!React34.isValidElement(child)) return false;
2982
+ const type = child.type;
2983
+ return typeof type !== "string" && "displayName" in type && (type.displayName === "FigureCaption" || type.displayName === "TableCaption");
2984
+ });
2985
+ const captionProps = React34.isValidElement(captionElement) ? captionElement.props : void 0;
2986
+ const captionType = React34.isValidElement(captionElement) ? captionElement.type : void 0;
2987
+ const elementNumber = captionProps == null ? void 0 : captionProps.number;
2988
+ const elementType = typeof captionType !== "string" && captionType && "displayName" in captionType && captionType.displayName === "TableCaption" ? "table" : "figure";
2989
+ const id = elementNumber ? `${elementType}-${elementNumber}` : void 0;
2990
+ return /* @__PURE__ */ React34.createElement(
2991
+ Box23,
2992
+ {
2993
+ as,
2994
+ id,
2995
+ sx: __spreadValues({
2996
+ my: [6, 6, 6, 7],
2997
+ scrollMarginTop: "60px",
2998
+ // account for header height
2999
+ "@media print": {
3000
+ breakInside: "avoid"
3001
+ }
3002
+ }, sx4)
3003
+ },
3004
+ /* @__PURE__ */ React34.createElement(group_default, { spacing: [4, 4, 4, 5] }, children)
3005
+ );
3006
+ };
3007
+ var figure_default = Figure;
3008
+
3009
+ // src/figure-caption.tsx
3010
+ import React35 from "react";
3011
+ var FigureCaption = ({
3012
+ as = "figcaption",
3013
+ number,
3014
+ children
3015
+ }) => {
3016
+ return /* @__PURE__ */ React35.createElement(caption_default, { as, number, label: "figure" }, children);
3017
+ };
3018
+ FigureCaption.displayName = "FigureCaption";
3019
+ var figure_caption_default = FigureCaption;
3020
+
3021
+ // src/filter.tsx
3022
+ import React37, { useMemo } from "react";
3023
+ import { Box as Box25 } from "theme-ui";
3024
+
3025
+ // src/tag.tsx
3026
+ import React36 from "react";
3027
+ import { Box as Box24 } from "theme-ui";
3028
+ var Tag = (_a) => {
3029
+ var _b = _a, { label, value, sx: sx4, children } = _b, props = __objRest(_b, ["label", "value", "sx", "children"]);
3030
+ const color = get_sx_color_default(sx4);
3031
+ const isClickable = props && (props.onClick || props.onDoubleClick);
3032
+ return /* @__PURE__ */ React36.createElement(
3033
+ Box24,
3034
+ __spreadValues({
3035
+ as: isClickable ? "button" : "span",
3036
+ role: "checkbox",
3037
+ "aria-checked": value,
3038
+ "aria-label": label,
3039
+ sx: __spreadValues({
3040
+ display: "inline-block",
3041
+ fontSize: [1, 1, 1, 2],
3042
+ fontFamily: "mono",
3043
+ letterSpacing: "mono",
3044
+ cursor: isClickable ? "pointer" : "inherit",
3045
+ color,
3046
+ backgroundColor: "transparent",
3047
+ borderStyle: "solid",
3048
+ borderColor: color,
3049
+ lineHeight: "body",
3050
+ borderWidth: "0px",
3051
+ borderBottomWidth: "1px",
3052
+ textTransform: "uppercase",
3053
+ userSelect: "none",
3054
+ transition: "opacity 0.05s",
3055
+ pt: ["1px"],
3056
+ pb: ["2px"],
3057
+ px: [0],
3058
+ m: [0],
3059
+ opacity: value == null || value ? 1 : color === "primary" ? 0.24 : 0.33
3060
+ }, sx4)
3061
+ }, props),
3062
+ children
3063
+ );
3064
+ };
3065
+ var tag_default = Tag;
3066
+
3067
+ // src/filter.tsx
3068
+ var sx3 = {
3069
+ label: {
3070
+ fontFamily: "mono",
3071
+ letterSpacing: "mono",
3072
+ fontSize: [1, 1, 1, 2],
3073
+ color: "secondary",
3074
+ userSelect: "none",
3075
+ textTransform: "uppercase"
3076
+ }
3077
+ };
3078
+ var duplicateOptions = (options, defaultValue, overrides = {}) => {
3079
+ let result = __spreadValues({}, options);
3080
+ Object.keys(options).forEach((key) => {
3081
+ result[key] = !!overrides[key] || defaultValue;
3082
+ });
3083
+ return result;
3084
+ };
3085
+ var isAll = (option) => {
3086
+ return Object.keys(option).filter((d) => option[d]).length === Object.keys(option).length;
3087
+ };
3088
+ var updateValues = ({
3089
+ values,
3090
+ multiSelect,
3091
+ setValues,
3092
+ value
3093
+ }) => {
3094
+ const isAllAlreadySelected = isAll(values);
3095
+ let updatedToggle;
3096
+ if (value === "all") {
3097
+ if (!isAllAlreadySelected) {
3098
+ updatedToggle = duplicateOptions(values, true);
3099
+ } else if (multiSelect) {
3100
+ updatedToggle = duplicateOptions(values, false);
3101
+ }
3102
+ } else if (multiSelect) {
3103
+ updatedToggle = __spreadProps(__spreadValues({}, values), { [value]: !values[value] });
3104
+ } else {
3105
+ updatedToggle = duplicateOptions(values, false, {
3106
+ [value]: true
3107
+ });
3108
+ }
3109
+ if (updatedToggle) {
3110
+ setValues(updatedToggle);
3111
+ }
3112
+ };
3113
+ var Filter = (_a) => {
3114
+ var _b = _a, {
3115
+ values,
3116
+ setValues,
3117
+ label,
3118
+ colors,
3119
+ order,
3120
+ labels,
3121
+ showAll = false,
3122
+ multiSelect = false
3123
+ } = _b, props = __objRest(_b, [
3124
+ "values",
3125
+ "setValues",
3126
+ "label",
3127
+ "colors",
3128
+ "order",
3129
+ "labels",
3130
+ "showAll",
3131
+ "multiSelect"
3132
+ ]);
3133
+ const keys = useMemo(() => {
3134
+ if (order) {
3135
+ return order;
3136
+ } else {
3137
+ return Object.keys(values);
3138
+ }
3139
+ }, [order, ...Object.keys(values).sort()]);
3140
+ return /* @__PURE__ */ React37.createElement(Box25, __spreadValues({}, props), label && /* @__PURE__ */ React37.createElement(Box25, { sx: sx3.label }, label), /* @__PURE__ */ React37.createElement(Box25, { sx: { mt: label ? [3] : 0 } }, showAll && /* @__PURE__ */ React37.createElement(
3141
+ tag_default,
3142
+ {
3143
+ label: "all",
3144
+ onClick: () => updateValues({
3145
+ values,
3146
+ multiSelect,
3147
+ setValues,
3148
+ value: "all"
3149
+ }),
3150
+ value: isAll(values),
3151
+ sx: { mr: [2] }
3152
+ },
3153
+ "All"
3154
+ ), keys.map((d, i) => /* @__PURE__ */ React37.createElement(
3155
+ tag_default,
3156
+ {
3157
+ label: String(d),
3158
+ onClick: () => updateValues({
3159
+ values,
3160
+ multiSelect,
3161
+ setValues,
3162
+ value: d
3163
+ }),
3164
+ onDoubleClick: () => updateValues({
3165
+ values,
3166
+ multiSelect: false,
3167
+ setValues,
3168
+ value: d
3169
+ }),
3170
+ key: i,
3171
+ value: values[d],
3172
+ sx: {
3173
+ width: "max-content",
3174
+ color: colors ? colors[d] : "primary",
3175
+ mr: [2],
3176
+ mb: [1]
3177
+ }
3178
+ },
3179
+ labels ? labels[d] : String(d)
3180
+ ))));
3181
+ };
3182
+ var filter_default = Filter;
3183
+
3184
+ // src/heading.tsx
3185
+ import React39 from "react";
3186
+ import { Box as Box27 } from "theme-ui";
3187
+
3188
+ // src/sidenote.tsx
3189
+ import React38 from "react";
3190
+ import { Box as Box26 } from "theme-ui";
3191
+ var Sidenote = ({ children, variant = "h1" }) => {
3192
+ let mt;
3193
+ if (variant === "h1") mt = [4, "27px", "42px", "54px"];
3194
+ if (variant === "h2") mt = [4, 4, "14px", "25px"];
3195
+ return /* @__PURE__ */ React38.createElement(React38.Fragment, null, /* @__PURE__ */ React38.createElement(column_default, { start: [1, 4, 8, 8], width: [1, 1, 1, 1] }, /* @__PURE__ */ React38.createElement(
3196
+ Box26,
3197
+ {
3198
+ sx: {
3199
+ mt,
3200
+ fontFamily: "faux",
3201
+ letterSpacing: "faux",
3202
+ fontSize: [2, 2, 2, 3],
3203
+ textAlign: "right"
3204
+ }
3205
+ },
3206
+ "/"
3207
+ )), /* @__PURE__ */ React38.createElement(column_default, { start: [2, 5, 9, 9], width: [3, 3, 2, 2] }, /* @__PURE__ */ React38.createElement(
3208
+ Box26,
3209
+ {
3210
+ sx: {
3211
+ mt,
3212
+ fontFamily: "faux",
3213
+ letterSpacing: "faux",
3214
+ fontSize: [2, 2, 2, 3],
3215
+ height: ["100%", "0px", "0px", "0px"]
3216
+ }
3217
+ },
3218
+ children
3219
+ )));
3220
+ };
3221
+ var sidenote_default = Sidenote;
3222
+
3223
+ // src/heading.tsx
3224
+ var Heading = ({
3225
+ children,
3226
+ sidenote,
3227
+ variant = "h1",
3228
+ description,
3229
+ descriptionStart = [1, 3, 5, 5],
3230
+ descriptionWidth = [5, 5, 5, 4],
3231
+ sx: sx4
3232
+ }) => {
3233
+ let titleWidth = [6, 6, 6, 6];
3234
+ if (description) {
3235
+ titleWidth[1] = descriptionStart[1] - 1;
3236
+ titleWidth[2] = descriptionStart[2] - 2;
3237
+ titleWidth[3] = descriptionStart[3] - 2;
3238
+ }
3239
+ if (!["h1", "h2"].includes(variant)) {
3240
+ throw new Error(`variant must be 'h1' or 'h2' but got '${variant}'`);
3241
+ }
3242
+ return /* @__PURE__ */ React39.createElement(row_default, { sx: __spreadValues({ mt: [5, 6, 7, 8], mb: [5, 6, 7, 8] }, sx4) }, /* @__PURE__ */ React39.createElement(column_default, { start: [1, 1, 2, 2], width: titleWidth }, variant === "h1" && /* @__PURE__ */ React39.createElement(Box27, { as: "h1", variant: "styles.h1", sx: { my: [0, 0, 0, 0] } }, children), variant === "h2" && /* @__PURE__ */ React39.createElement(Box27, { as: "h2", variant: "styles.h2", sx: { my: [0, 0, 0, 0] } }, children)), sidenote && /* @__PURE__ */ React39.createElement(sidenote_default, { variant }, sidenote), description && /* @__PURE__ */ React39.createElement(column_default, { start: descriptionStart, width: descriptionWidth }, /* @__PURE__ */ React39.createElement(
3243
+ Box27,
3244
+ {
3245
+ sx: {
3246
+ mt: [4, "5px", "20px", "31px"],
3247
+ fontSize: [2, 2, 2, 3]
3248
+ }
3249
+ },
3250
+ description
3251
+ )));
3252
+ };
3253
+ var heading_default = Heading;
3254
+
3255
+ // src/link-group.tsx
3256
+ import React40 from "react";
3257
+ import { Flex as Flex6 } from "theme-ui";
3258
+ import { RotatingArrow as RotatingArrow2 } from "@carbonplan/icons";
3259
+ var LinkGroup = ({
3260
+ members,
3261
+ color,
3262
+ inverted,
3263
+ size = "xs",
3264
+ rowGap = [2, 2, 2, 3],
3265
+ columnGap = [3, 3, 3, 4],
3266
+ direction = "horizontal",
3267
+ sx: sx4
3268
+ }) => {
3269
+ return /* @__PURE__ */ React40.createElement(
3270
+ Flex6,
3271
+ {
3272
+ sx: __spreadValues({
3273
+ flexDirection: direction === "horizontal" ? "row" : "column",
3274
+ rowGap,
3275
+ columnGap,
3276
+ flexWrap: "wrap"
3277
+ }, sx4)
3278
+ },
3279
+ members.map((d, i) => {
3280
+ return /* @__PURE__ */ React40.createElement(
3281
+ button_default,
3282
+ {
3283
+ key: i,
3284
+ href: d.href,
3285
+ size,
3286
+ sx: { color },
3287
+ inverted,
3288
+ suffix: /* @__PURE__ */ React40.createElement(RotatingArrow2, null)
3289
+ },
3290
+ d.label
3291
+ );
3292
+ })
3293
+ );
3294
+ };
3295
+ var link_group_default = LinkGroup;
3296
+
3297
+ // src/select.tsx
3298
+ import React41, { useRef as useRef2 } from "react";
3299
+ import { Box as Box28 } from "theme-ui";
3300
+ import { Arrow as Arrow4 } from "@carbonplan/icons";
3301
+ var Select = (_a) => {
3302
+ var _b = _a, {
3303
+ children,
3304
+ size = "sm",
3305
+ sx: sx4,
3306
+ sxSelect,
3307
+ onChange
3308
+ } = _b, props = __objRest(_b, [
3309
+ "children",
3310
+ "size",
3311
+ "sx",
3312
+ "sxSelect",
3313
+ "onChange"
3314
+ ]);
3315
+ const color = get_sx_color_default(sx4);
3316
+ const sizeStyles = get_size_styles_default(size);
3317
+ const ref = useRef2(null);
3318
+ if (!["xs", "sm", "md"].includes(size)) {
3319
+ throw new Error("Size must be xs, sm, or md");
3320
+ }
3321
+ const sizeConfig = {
3322
+ xs: {
3323
+ height: [14, 14, 14, 16],
3324
+ width: [14, 14, 14, 14],
3325
+ top: ["1px"],
3326
+ ml: ["-14px", "-14px", "-14px", "-16px"]
3327
+ },
3328
+ sm: {
3329
+ height: [15, 15, 15, 20],
3330
+ width: [15, 15, 15, 20],
3331
+ top: ["1px"],
3332
+ ml: ["-16px", "-16px", "-16px", "-20px"]
3333
+ },
3334
+ md: {
3335
+ height: [20, 20, 20, 20],
3336
+ width: [20, 20, 20, 20],
3337
+ top: ["2px"],
3338
+ ml: ["-20px", "-20px", "-20px", "-20px"]
3339
+ }
3340
+ };
3341
+ const { height, width, top, ml } = sizeConfig[size];
3342
+ const pr = width.map((d) => d + 12);
3343
+ return /* @__PURE__ */ React41.createElement(
3344
+ Box28,
3345
+ {
3346
+ sx: __spreadValues({
3347
+ display: "inline-block"
3348
+ }, sx4)
3349
+ },
3350
+ /* @__PURE__ */ React41.createElement(
3351
+ Box28,
3352
+ __spreadValues({
3353
+ as: "select",
3354
+ ref,
3355
+ onChange: (e) => {
3356
+ var _a2;
3357
+ (_a2 = ref.current) == null ? void 0 : _a2.blur();
3358
+ if (onChange)
3359
+ onChange(e);
3360
+ },
3361
+ sx: __spreadValues(__spreadProps(__spreadValues({}, sizeStyles), {
3362
+ lineHeight: "normal",
3363
+ cursor: "pointer",
3364
+ WebkitAppearance: "none",
3365
+ MozAppearance: "none",
3366
+ pb: ["5px"],
3367
+ bg: "background",
3368
+ pr,
3369
+ border: "none",
3370
+ borderBottomStyle: "solid",
3371
+ borderBottomWidth: "1px",
3372
+ borderBottomColor: "primary",
3373
+ borderRadius: "0px",
3374
+ width: "fit-content",
3375
+ color,
3376
+ userSelect: "none",
3377
+ "@media (hover: none) and (pointer: coarse)": {
3378
+ "&:focus-visible": {
3379
+ outline: "none !important",
3380
+ background: "transparent !important"
3381
+ }
3382
+ }
3383
+ }), sxSelect)
3384
+ }, props),
3385
+ children
3386
+ ),
3387
+ /* @__PURE__ */ React41.createElement(
3388
+ Arrow4,
3389
+ {
3390
+ sx: {
3391
+ width,
3392
+ height,
3393
+ position: "relative",
3394
+ ml,
3395
+ top,
3396
+ fill: "secondary",
3397
+ transform: "rotate(135deg)",
3398
+ pointerEvents: "none"
3399
+ }
3400
+ }
3401
+ )
3402
+ );
3403
+ };
3404
+ var select_default = Select;
3405
+
3406
+ // src/slider.tsx
3407
+ import React42, { forwardRef as forwardRef5 } from "react";
3408
+ import { useThemeUI as useThemeUI4, Slider as ThemeSlider } from "theme-ui";
3409
+ var Slider = (_a, ref) => {
3410
+ var _b = _a, { sx: sx4 } = _b, props = __objRest(_b, ["sx"]);
3411
+ const color = get_sx_color_default(sx4);
3412
+ const {
3413
+ theme: { rawColors: colors }
3414
+ } = useThemeUI4();
3415
+ return /* @__PURE__ */ React42.createElement(
3416
+ ThemeSlider,
3417
+ __spreadValues({
3418
+ ref,
3419
+ sx: __spreadValues({
3420
+ "&::-webkit-slider-thumb": {
3421
+ height: [22, 18, 16],
3422
+ width: [22, 18, 16],
3423
+ boxShadow: `0 0 0 0px ${colors == null ? void 0 : colors.secondary}`,
3424
+ transition: "box-shadow .15s ease"
3425
+ },
3426
+ "&::-moz-range-thumb": {
3427
+ height: [22, 18, 16],
3428
+ width: [22, 18, 16],
3429
+ boxShadow: `0 0 0 0px ${colors == null ? void 0 : colors.secondary}`,
3430
+ transition: "box-shadow .15s ease"
3431
+ },
3432
+ ":focus-visible": {
3433
+ outline: "none !important",
3434
+ background: `${colors == null ? void 0 : colors.secondary} !important`
3435
+ },
3436
+ ":focus": {
3437
+ color,
3438
+ "&::-webkit-slider-thumb": {
3439
+ boxShadow: `0 0 0 4px ${colors == null ? void 0 : colors.secondary}`
3440
+ },
3441
+ "&::-moz-range-thumb": {
3442
+ boxShadow: `0 0 0 4px ${colors == null ? void 0 : colors.secondary}`
3443
+ }
3444
+ },
3445
+ color
3446
+ }, sx4)
3447
+ }, props)
3448
+ );
3449
+ };
3450
+ var slider_default = forwardRef5(Slider);
3451
+
3452
+ // src/table.tsx
3453
+ import React43 from "react";
3454
+ import { Box as Box29 } from "theme-ui";
3455
+ var styles2 = {
3456
+ reset: {
3457
+ verticalAlign: "baseline",
3458
+ border: 0,
3459
+ outline: 0,
3460
+ margin: 0,
3461
+ padding: 0
3462
+ },
3463
+ row: {
3464
+ borderStyle: "solid",
3465
+ borderWidth: "0px",
3466
+ borderTopWidth: "1px",
3467
+ borderColor: "muted",
3468
+ pt: [3, 3, 3, "20px"],
3469
+ pb: [3, 3, 3, "20px"],
3470
+ mb: ["2px"]
3471
+ },
3472
+ header: {
3473
+ display: "block",
3474
+ textTransform: "uppercase",
3475
+ letterSpacing: "smallcaps",
3476
+ fontFamily: "heading",
3477
+ fontSize: [2, 2, 2, 3]
3478
+ },
3479
+ index: {
3480
+ display: "block",
3481
+ textTransform: "uppercase",
3482
+ letterSpacing: "smallcaps",
3483
+ fontFamily: "heading",
3484
+ fontSize: [2, 2, 2, 3]
3485
+ },
3486
+ entry: {
3487
+ display: "block",
3488
+ fontSize: [2, 2, 2, 3],
3489
+ fontFamily: "faux",
3490
+ letterSpacing: "faux",
3491
+ mb: ["1px"],
3492
+ mt: [2, 0, 0, 0]
3493
+ }
3494
+ };
3495
+ var Table = ({
3496
+ data,
3497
+ sx: sx4,
3498
+ color,
3499
+ header,
3500
+ columns,
3501
+ start,
3502
+ width,
3503
+ index = true,
3504
+ borderBottom = true,
3505
+ borderTop = true
3506
+ }) => {
3507
+ if (!start || !columns || !width) {
3508
+ throw new Error("Must provide columns, start, and width");
3509
+ }
3510
+ return /* @__PURE__ */ React43.createElement(Box29, { as: "table", sx: __spreadValues({ display: "block" }, sx4) }, /* @__PURE__ */ React43.createElement(Box29, { as: "tbody", sx: { display: "block" } }, header && /* @__PURE__ */ React43.createElement(
3511
+ row_default,
3512
+ {
3513
+ as: "tr",
3514
+ sx: __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, styles2.reset), styles2.header), styles2.row), {
3515
+ color,
3516
+ borderTopWidth: !borderTop ? "0px" : "1px"
3517
+ })
3518
+ },
3519
+ /* @__PURE__ */ React43.createElement(column_default, { as: "td", start: [1], width: columns, sx: styles2.index }, header)
3520
+ ), data.map((row, i) => {
3521
+ return /* @__PURE__ */ React43.createElement(
3522
+ row_default,
3523
+ {
3524
+ as: "tr",
3525
+ columns,
3526
+ key: i,
3527
+ sx: __spreadProps(__spreadValues(__spreadValues({}, styles2.reset), styles2.row), {
3528
+ pb: borderBottom && i === data.length - 1 ? ["18px", "18px", "18px", "22px"] : [3, 3, 3, "20px"],
3529
+ borderBottomWidth: borderBottom && i === data.length - 1 ? "1px" : "0px",
3530
+ borderTopWidth: !borderTop && i === 0 && !header ? "0px" : "1px"
3531
+ })
3532
+ },
3533
+ row.map((column, j) => {
3534
+ return /* @__PURE__ */ React43.createElement(
3535
+ column_default,
3536
+ {
3537
+ as: "td",
3538
+ key: j,
3539
+ start: start[j],
3540
+ width: width[j],
3541
+ sx: j === 0 && index ? __spreadValues(__spreadValues({}, styles2.reset), styles2.index) : __spreadValues(__spreadValues({}, styles2.reset), styles2.entry)
3542
+ },
3543
+ column
3544
+ );
3545
+ })
3546
+ );
3547
+ })));
3548
+ };
3549
+ var table_default = Table;
3550
+
3551
+ // src/table-caption.tsx
3552
+ import React44 from "react";
3553
+ var TableCaption = ({
3554
+ as = "figcaption",
3555
+ number,
3556
+ children
3557
+ }) => {
3558
+ return /* @__PURE__ */ React44.createElement(caption_default, { as, number, label: "table" }, children);
3559
+ };
3560
+ TableCaption.displayName = "TableCaption";
3561
+ var table_caption_default = TableCaption;
3562
+
3563
+ // src/toggle.tsx
3564
+ import React45, { forwardRef as forwardRef6 } from "react";
3565
+ import { Box as Box30 } from "theme-ui";
3566
+ import { transparentize as transparentize2 } from "@theme-ui/color";
3567
+ var Toggle = (_a, ref) => {
3568
+ var _b = _a, { value, onClick, disabled, sx: sx4 } = _b, props = __objRest(_b, ["value", "onClick", "disabled", "sx"]);
3569
+ const color = get_sx_color_default(sx4);
3570
+ const active = disabled ? false : value;
3571
+ return /* @__PURE__ */ React45.createElement(
3572
+ Box30,
3573
+ __spreadValues({
3574
+ ref,
3575
+ as: "button",
3576
+ onClick,
3577
+ role: "checkbox",
3578
+ "aria-checked": active,
3579
+ "aria-label": "Toggle",
3580
+ sx: __spreadValues({
3581
+ border: "none",
3582
+ background: "none",
3583
+ cursor: disabled ? "default" : "pointer",
3584
+ p: [0],
3585
+ m: [0],
3586
+ display: "inline-block"
3587
+ }, sx4)
3588
+ }, props),
3589
+ /* @__PURE__ */ React45.createElement(
3590
+ Box30,
3591
+ {
3592
+ sx: {
3593
+ width: "50px",
3594
+ height: "20px",
3595
+ borderRadius: "20px",
3596
+ backgroundColor: active ? transparentize2(color, color === "primary" ? 0.5 : 0.45) : "muted",
3597
+ position: "relative",
3598
+ transition: "0.15s",
3599
+ display: "inline-block"
3600
+ }
3601
+ },
3602
+ /* @__PURE__ */ React45.createElement(
3603
+ Box30,
3604
+ {
3605
+ sx: {
3606
+ width: "14px",
3607
+ height: "14px",
3608
+ borderRadius: "7px",
3609
+ position: "absolute",
3610
+ left: active ? "32px" : "4px",
3611
+ top: "3px",
3612
+ backgroundColor: active ? color : "secondary",
3613
+ transition: "0.15s"
3614
+ }
3615
+ }
3616
+ )
3617
+ )
3618
+ );
3619
+ };
3620
+ var toggle_default = forwardRef6(Toggle);
3621
+
3622
+ // src/tray.tsx
3623
+ import React46 from "react";
3624
+ import { Box as Box31 } from "theme-ui";
3625
+ var Tray = ({ expanded, sx: sx4, children }) => {
3626
+ return /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(
3627
+ Box31,
3628
+ {
3629
+ sx: {
3630
+ position: "fixed",
3631
+ top: "56px",
3632
+ bottom: "0px",
3633
+ left: "0px",
3634
+ width: "calc(100vw)",
3635
+ mt: ["56px"],
3636
+ bg: "background",
3637
+ zIndex: 1e3,
3638
+ transition: "opacity 0.15s",
3639
+ opacity: expanded ? 0.9 : 0,
3640
+ pointerEvents: expanded ? "all" : "none"
3641
+ }
3642
+ }
3643
+ ), /* @__PURE__ */ React46.createElement(
3644
+ Box31,
3645
+ {
3646
+ sx: __spreadValues({
3647
+ position: "fixed",
3648
+ width: "calc(100vw)",
3649
+ top: "0px",
3650
+ mt: ["56px"],
3651
+ pb: [6, 7, 7, 8],
3652
+ pt: [5, 6, 7, 8],
3653
+ bg: "background",
3654
+ zIndex: 1100,
3655
+ borderStyle: "solid",
3656
+ borderColor: "muted",
3657
+ borderWidth: "0px",
3658
+ borderBottomWidth: "1px",
3659
+ transition: "transform 0.15s",
3660
+ ml: [-3, -4, -5, -6],
3661
+ pl: [3, 4, 5, 6],
3662
+ pr: [3, 4, 5, 6],
3663
+ transform: expanded ? "translateY(0)" : "translateY(-100%)"
3664
+ }, sx4)
3665
+ },
3666
+ /* @__PURE__ */ React46.createElement(row_default, null, /* @__PURE__ */ React46.createElement(column_default, { start: [1, 1, 1, 1], width: [6, 8, 10, 10] }, children))
3667
+ ));
3668
+ };
3669
+ var tray_default = Tray;
3670
+
3671
+ // src/utils/format-date.ts
3672
+ var defaultOptions = {
3673
+ month: "short",
3674
+ day: "numeric",
3675
+ year: "numeric"
3676
+ };
3677
+ var formatDateElement = (date, element, option) => {
3678
+ if (!option) {
3679
+ return null;
3680
+ }
3681
+ const format2 = typeof option === "string" ? option : defaultOptions[element];
3682
+ const result = date.toLocaleString("default", {
3683
+ [element]: format2
3684
+ });
3685
+ if (format2 === "numeric" && ["day", "month"].includes(element)) {
3686
+ return result.padStart(2, "0");
3687
+ } else {
3688
+ return result;
3689
+ }
3690
+ };
3691
+ var formatDate = (date, options = defaultOptions) => {
3692
+ var _a;
3693
+ const d = new Date(date.replace(/-/g, "/"));
3694
+ const month = formatDateElement(d, "month", options.month);
3695
+ const day = formatDateElement(d, "day", options.day);
3696
+ const year = formatDateElement(d, "year", options.year);
3697
+ return [month, day, year].filter(Boolean).join((_a = options.separator) != null ? _a : " ");
3698
+ };
3699
+ var format_date_default = formatDate;
3700
+
3701
+ // src/utils/use-scrollbar-class.ts
3702
+ import { useEffect as useEffect8, useState as useState7 } from "react";
3703
+ var useScrollbarClass = () => {
3704
+ const [className, setClassName] = useState7(null);
3705
+ useEffect8(() => {
3706
+ if (document && get_scrollbar_width_default(document) > 0) {
3707
+ setClassName("custom-scrollbar");
3708
+ }
3709
+ }, []);
3710
+ return className;
3711
+ };
3712
+ var use_scrollbar_class_default = useScrollbarClass;
3713
+ export {
3714
+ avatar_default as Avatar,
3715
+ avatar_group_default as AvatarGroup,
3716
+ badge_default as Badge,
3717
+ blockquote_default as Blockquote,
3718
+ button_default as Button,
3719
+ callout_default as Callout,
3720
+ caption_default as Caption,
3721
+ colorbar_default as Colorbar,
3722
+ colors_exports as Colors,
3723
+ column_default as Column,
3724
+ custom_404_default as Custom404,
3725
+ dimmer_default as Dimmer,
3726
+ expander_default as Expander,
3727
+ fade_in_default as FadeIn,
3728
+ figure_default as Figure,
3729
+ figure_caption_default as FigureCaption,
3730
+ filter_default as Filter,
3731
+ footer_default as Footer,
3732
+ group_default as Group,
3733
+ guide_default as Guide,
3734
+ header_default as Header,
3735
+ heading_default as Heading,
3736
+ input_default as Input,
3737
+ layout_default as Layout,
3738
+ link_default as Link,
3739
+ link_group_default as LinkGroup,
3740
+ logo_default as Logo,
3741
+ menu_default as Menu,
3742
+ meta_default as Meta,
3743
+ metadata_default as Metadata,
3744
+ monogram_default as Monogram,
3745
+ row_default as Row,
3746
+ scrollbar_default as Scrollbar,
3747
+ select_default as Select,
3748
+ settings_default as Settings,
3749
+ sidenote_default as Sidenote,
3750
+ slider_default as Slider,
3751
+ table_default as Table,
3752
+ table_caption_default as TableCaption,
3753
+ tag_default as Tag,
3754
+ toggle_default as Toggle,
3755
+ tray_default as Tray,
3756
+ format_date_default as formatDate,
3757
+ get_scrollbar_width_default as getScrollbarWidth,
3758
+ use_scrollbar_class_default as useScrollbarClass
3759
+ };
3760
+ //# sourceMappingURL=index.mjs.map