@carbonplan/components 10.5.0 → 11.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,10 @@
1
- import React, { cloneElement, useCallback, useState, useEffect, useRef } from 'react';
2
- import { Box, Link as Link$1, Flex, Grid, IconButton, useColorMode, Container, useThemeUI, Text, Styled, Input as Input$1, Slider as Slider$1 } from 'theme-ui';
1
+ import React, { forwardRef, cloneElement, useRef, useState, useEffect, useCallback } from 'react';
2
+ import { Box, Link as Link$2, Flex, Grid, IconButton, Container, useColorMode, useThemeUI, Text, Styled, Input as Input$1, Slider as Slider$1 } from 'theme-ui';
3
3
  import { transparentize } from '@theme-ui/color';
4
4
  import NextLink from 'next/link';
5
5
  import { Arrow, Sun } from '@carbonplan/icons';
6
6
  import { PoopSad } from '@carbonplan/emoji';
7
+ import { useBreakpointIndex } from '@theme-ui/match-media';
7
8
  import Head from 'next/head';
8
9
  import { keyframes } from '@emotion/react';
9
10
 
@@ -40,14 +41,12 @@ function _objectWithoutPropertiesLoose(source, excluded) {
40
41
  return target;
41
42
  }
42
43
 
43
- const _excluded$g = ["sx", "children"];
44
-
45
- const Badge = _ref => {
44
+ const Badge = (_ref) => {
46
45
  let {
47
46
  sx,
48
47
  children
49
48
  } = _ref,
50
- props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
49
+ props = _objectWithoutPropertiesLoose(_ref, ["sx", "children"]);
51
50
 
52
51
  const color = sx && sx.color ? sx.color : 'primary';
53
52
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -72,8 +71,6 @@ const Badge = _ref => {
72
71
  }, children));
73
72
  };
74
73
 
75
- const _excluded$f = ["href", "children", "internal", "tracking"];
76
-
77
74
  const event = ({
78
75
  action,
79
76
  category,
@@ -92,20 +89,22 @@ const event = ({
92
89
  });
93
90
  };
94
91
 
95
- const Link = _ref => {
92
+ const Link = (_ref, ref) => {
96
93
  let {
97
94
  href,
98
95
  children,
99
96
  internal = false,
100
97
  tracking = false
101
98
  } = _ref,
102
- props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
99
+ props = _objectWithoutPropertiesLoose(_ref, ["href", "children", "internal", "tracking"]);
103
100
 
104
101
  if (internal || href && href.startsWith('/')) {
105
102
  return /*#__PURE__*/React.createElement(NextLink, {
106
103
  href: href,
107
104
  passHref: true
108
- }, /*#__PURE__*/React.createElement(Link$1, props, children));
105
+ }, /*#__PURE__*/React.createElement(Link$2, _extends({
106
+ ref: ref
107
+ }, props), children));
109
108
  } else if (tracking) {
110
109
  let action;
111
110
  let category;
@@ -126,18 +125,22 @@ const Link = _ref => {
126
125
  });
127
126
  };
128
127
 
129
- return /*#__PURE__*/React.createElement(Link$1, _extends({
128
+ return /*#__PURE__*/React.createElement(Link$2, _extends({
129
+ ref: ref,
130
130
  onClick: track,
131
131
  onContextMenu: track,
132
132
  href: href
133
133
  }, props), children);
134
134
  } else {
135
- return /*#__PURE__*/React.createElement(Link$1, _extends({
135
+ return /*#__PURE__*/React.createElement(Link$2, _extends({
136
+ ref: ref,
136
137
  href: href
137
138
  }, props), children);
138
139
  }
139
140
  };
140
141
 
142
+ var Link$1 = forwardRef(Link);
143
+
141
144
  const getSizeStyles = size => {
142
145
  if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
143
146
  throw new Error('Size must be xs, sm, md, lg, or xl');
@@ -188,9 +191,7 @@ const getSizeStyles = size => {
188
191
  };
189
192
  };
190
193
 
191
- const _excluded$e = ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"];
192
-
193
- const Button = _ref => {
194
+ const Button = (_ref, ref) => {
194
195
  let {
195
196
  size = 'sm',
196
197
  prefix,
@@ -203,7 +204,7 @@ const Button = _ref => {
203
204
  internal,
204
205
  tracking
205
206
  } = _ref,
206
- props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
207
+ props = _objectWithoutPropertiesLoose(_ref, ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"]);
207
208
 
208
209
  if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
209
210
  throw new Error('Size must be xs, sm, md, lg, or xl');
@@ -361,7 +362,8 @@ const Button = _ref => {
361
362
  }, suffix && suffix));
362
363
 
363
364
  if (href) {
364
- return /*#__PURE__*/React.createElement(Link, _extends({
365
+ return /*#__PURE__*/React.createElement(Link$1, _extends({
366
+ ref: ref,
365
367
  href: href,
366
368
  internal: internal,
367
369
  tracking: tracking,
@@ -371,15 +373,16 @@ const Button = _ref => {
371
373
  }, props), Inner);
372
374
  } else {
373
375
  return /*#__PURE__*/React.createElement(Box, _extends({
376
+ ref: ref,
374
377
  as: "button",
375
378
  sx: style
376
379
  }, props), Inner);
377
380
  }
378
381
  };
379
382
 
380
- const _excluded$d = ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"];
383
+ var button = forwardRef(Button);
381
384
 
382
- const Callout = _ref => {
385
+ const Callout = (_ref, ref) => {
383
386
  let {
384
387
  label,
385
388
  children,
@@ -390,7 +393,7 @@ const Callout = _ref => {
390
393
  tracking,
391
394
  sx
392
395
  } = _ref,
393
- props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
396
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"]);
394
397
 
395
398
  const baseColor = color || (inverted ? 'secondary' : 'primary');
396
399
  const hoverColor = color ? 'primary' : inverted ? 'primary' : 'secondary';
@@ -455,7 +458,8 @@ const Callout = _ref => {
455
458
  })));
456
459
 
457
460
  if (href) {
458
- return /*#__PURE__*/React.createElement(Link, _extends({
461
+ return /*#__PURE__*/React.createElement(Link$1, _extends({
462
+ ref: ref,
459
463
  href: href,
460
464
  internal: internal,
461
465
  tracking: tracking,
@@ -463,19 +467,40 @@ const Callout = _ref => {
463
467
  }, props), Inner);
464
468
  } else {
465
469
  return /*#__PURE__*/React.createElement(Box, _extends({
470
+ ref: ref,
466
471
  as: "button",
467
472
  sx: style
468
473
  }, props), Inner);
469
474
  }
470
475
  };
471
476
 
472
- const _excluded$c = ["colormap", "label", "clim", "discrete", "units", "width", "height", "format", "horizontal"];
473
- const sx$2 = {
474
- clim: {
475
- fontFamily: 'mono',
476
- fontSize: ['9px', 0, 0, 1],
477
- letterSpacing: 'smallcaps',
478
- textTransform: 'uppercase'
477
+ var callout = forwardRef(Callout);
478
+
479
+ const styles = {
480
+ clim: setClim => {
481
+ return {
482
+ fontFamily: 'mono',
483
+ fontSize: ['9px', 0, 0, 1],
484
+ letterSpacing: 'smallcaps',
485
+ textTransform: 'uppercase',
486
+ '@media (hover: hover) and (pointer: fine)': {
487
+ '&:hover': {
488
+ borderBottom: setClim ? ({
489
+ colors
490
+ }) => `solid 1px ${colors.primary} !important` : 'unset'
491
+ }
492
+ },
493
+ '&:focus': {
494
+ outline: 'none',
495
+ borderBottom: setClim ? ({
496
+ colors
497
+ }) => `solid 1px ${colors.primary} !important` : 'unset'
498
+ },
499
+ transition: 'border 0.15s',
500
+ userSelect: setClim ? 'none !important' : 'unset',
501
+ width: 'fit-content',
502
+ minWidth: 'fit-content'
503
+ };
479
504
  }
480
505
  };
481
506
  const DIMENSIONS = {
@@ -503,7 +528,7 @@ const Gradient = ({
503
528
  width: width || DIMENSIONS.width,
504
529
  minHeight: height || DIMENSIONS.height
505
530
  }, {
506
- mt: horizontal ? [0, '1px', '1px', 0] : 0,
531
+ mt: horizontal ? ['1px', '1px', '1px', 0] : 0,
507
532
  border: ({
508
533
  colors
509
534
  }) => `solid 1px ${colors.hinted}`,
@@ -518,6 +543,7 @@ const Label = ({
518
543
  horizontal
519
544
  }) => /*#__PURE__*/React.createElement(Box, {
520
545
  sx: !horizontal && {
546
+ width: ['13px', '17px', '17px', '19px'],
521
547
  alignSelf: 'flex-end'
522
548
  }
523
549
  }, /*#__PURE__*/React.createElement(Box, {
@@ -543,61 +569,195 @@ const Label = ({
543
569
  }
544
570
  }, units)));
545
571
 
546
- const Colorbar = _ref => {
572
+ const Colorbar = (_ref) => {
547
573
  let {
548
574
  colormap,
549
575
  label,
550
576
  clim,
577
+ setClim,
578
+ setClimStep = 1,
551
579
  discrete,
552
580
  units,
553
581
  width,
554
582
  height,
555
583
  format = d => d,
556
- horizontal = false
584
+ horizontal = false,
585
+ bottom = false,
586
+ sx,
587
+ sxClim
557
588
  } = _ref,
558
- props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
589
+ props = _objectWithoutPropertiesLoose(_ref, ["colormap", "label", "clim", "setClim", "setClimStep", "discrete", "units", "width", "height", "format", "horizontal", "bottom", "sx", "sxClim"]);
559
590
 
560
591
  if (!Array.isArray(colormap)) {
561
592
  throw new Error(`expected array for colormap, got '${colormap}'.`);
562
593
  }
563
594
 
595
+ const climRef = [useRef(), useRef()];
596
+ const [climMinDragging, setClimMinDragging] = useState(false);
597
+ const [climMaxDragging, setClimMaxDragging] = useState(false);
598
+ let x,
599
+ y,
600
+ dx,
601
+ dy = 0;
602
+ let id = null;
603
+ let init = [0, 0];
604
+ let scale = setClimStep;
605
+
606
+ const draggingFunction = e => {
607
+ if (id === 'min' && !climMinDragging) setClimMinDragging(true);
608
+ if (id === 'max' && !climMaxDragging) setClimMaxDragging(true);
609
+ dx = e.pageX - x;
610
+ dy = e.pageY - y;
611
+
612
+ if (horizontal) {
613
+ if (id === 'min') setClim(prev => [Math.min(init[0] + dx * scale, init[1]), prev[1]]);
614
+ if (id === 'max') setClim(prev => [prev[0], Math.max(init[1] + dx * scale, init[0])]);
615
+ } else {
616
+ if (id === 'min') setClim(prev => [Math.min(init[0] - dy * scale, init[1]), prev[1]]);
617
+ if (id === 'max') setClim(prev => [prev[0], Math.max(init[1] - dy * scale, init[0])]);
618
+ }
619
+ };
620
+
621
+ const handleMouseDown = e => {
622
+ y = e.pageY;
623
+ x = e.pageX;
624
+ id = e.target.id;
625
+ init = clim;
626
+ document.body.setAttribute('style', horizontal ? 'cursor: ew-resize !important' : 'cursor: ns-resize !important');
627
+ document.addEventListener('mousemove', draggingFunction);
628
+
629
+ const updater = () => {
630
+ document.body.setAttribute('style', 'cursor: unset');
631
+ document.removeEventListener('mousemove', draggingFunction);
632
+ window.removeEventListener('mouseup', updater);
633
+ if (id === 'min') setClimMinDragging(false);
634
+ if (id === 'max') setClimMaxDragging(false);
635
+ };
636
+
637
+ window.addEventListener('mouseup', updater);
638
+ };
639
+
640
+ const increment = e => {
641
+ if (climRef[0].current === document.activeElement) {
642
+ e.preventDefault();
643
+ setClim(prev => [Math.min(prev[0] + scale, prev[1]), prev[1]]);
644
+ climRef[0].current.focus();
645
+ }
646
+
647
+ if (climRef[1].current === document.activeElement) {
648
+ e.preventDefault();
649
+ setClim(prev => [prev[0], Math.max(prev[1] + scale, prev[0])]);
650
+ climRef[1].current.focus();
651
+ }
652
+ };
653
+
654
+ const decrement = e => {
655
+ if (climRef[0].current === document.activeElement) {
656
+ e.preventDefault();
657
+ setClim(prev => [Math.min(prev[0] - scale, prev[1]), prev[1]]);
658
+ climRef[0].current.focus();
659
+ }
660
+
661
+ if (climRef[1].current === document.activeElement) {
662
+ e.preventDefault();
663
+ setClim(prev => [prev[0], Math.max(prev[1] - scale, prev[0])]);
664
+ climRef[1].current.focus();
665
+ }
666
+ };
667
+
668
+ useEffect(() => {
669
+ const listener = e => {
670
+ if (['ArrowUp', 'ArrowRight'].includes(e.code) || ['ArrowUp', 'ArrowRight'].includes(e.key)) {
671
+ increment(e);
672
+ }
673
+
674
+ if (['ArrowDown', 'ArrowLeft'].includes(e.code) || ['ArrowDown', 'ArrowLeft'].includes(e.key)) {
675
+ decrement(e);
676
+ }
677
+ };
678
+
679
+ window.addEventListener('keydown', listener);
680
+ return () => {
681
+ window.removeEventListener('keydown', listener);
682
+ };
683
+ }, [clim]);
684
+
564
685
  const ClimMin = () => {
565
686
  return /*#__PURE__*/React.createElement(Box, {
566
- sx: _extends({}, sx$2.clim, {
567
- ml: label ? horizontal ? '10px' : '2px' : 0,
687
+ id: "min",
688
+ ref: climRef[0],
689
+ tabIndex: 0,
690
+ sx: _extends({}, styles.clim(setClim), {
691
+ ml: label ? horizontal ? bottom ? '0px' : '10px' : ['2px', '1px', '1px', '2px'] : 0,
568
692
  mr: horizontal ? ['2px', '1px', '1px', '2px'] : 0,
569
- mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px']
570
- })
693
+ mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px'],
694
+ borderBottom: setClim ? climMinDragging ? ({
695
+ colors
696
+ }) => `solid 1px ${colors.primary}` : ({
697
+ colors
698
+ }) => `solid 1px ${colors.secondary}` : 'unset',
699
+ cursor: setClim ? horizontal ? 'ew-resize' : 'ns-resize' : 'default'
700
+ }, sxClim),
701
+ onMouseDown: setClim ? handleMouseDown : () => {},
702
+ onClick: () => climRef[0].current.focus()
571
703
  }, format(clim[0]));
572
704
  };
573
705
 
574
706
  const ClimMax = () => {
575
707
  return /*#__PURE__*/React.createElement(Box, {
576
- sx: _extends({}, sx$2.clim, {
577
- ml: horizontal ? ['2px', '1px', '1px', '2px'] : '2px',
578
- mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px']
579
- })
708
+ id: "max",
709
+ ref: climRef[1],
710
+ tabIndex: 0,
711
+ sx: _extends({}, styles.clim(setClim), {
712
+ ml: horizontal ? ['2px', '1px', '1px', '2px'] : ['2px', '1px', '1px', '2px'],
713
+ mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px'],
714
+ borderBottom: setClim ? climMaxDragging ? ({
715
+ colors
716
+ }) => `solid 1px ${colors.primary}` : ({
717
+ colors
718
+ }) => `solid 1px ${colors.secondary}` : 'unset',
719
+ cursor: setClim ? horizontal ? 'ew-resize' : 'ns-resize' : 'default'
720
+ }, sxClim),
721
+ onMouseDown: setClim ? handleMouseDown : () => {},
722
+ onClick: () => climRef[1].current.focus()
580
723
  }, format(clim[1]));
581
724
  };
582
725
 
583
- return /*#__PURE__*/React.createElement(Flex, {
584
- sx: _extends({}, props.sx, {
726
+ return /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
727
+ sx: _extends({
585
728
  flexDirection: 'row',
586
- alignItems: 'center',
729
+ alignItems: 'start',
587
730
  justifyContent: 'flex-start',
588
- gap: ['3px', '6px', '6px', '7px']
589
- })
590
- }, label && /*#__PURE__*/React.createElement(Label, {
731
+ gap: ['3px', '6px', '6px', '7px'],
732
+ height: !horizontal ? '100%' : 'unset'
733
+ }, sx)
734
+ }), label && /*#__PURE__*/React.createElement(Label, {
591
735
  label: label,
592
736
  units: units,
593
737
  horizontal: horizontal
594
- }), horizontal && clim && /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(Gradient, {
738
+ }), /*#__PURE__*/React.createElement(Flex, {
739
+ sx: {
740
+ flexGrow: horizontal ? 1 : 'unset',
741
+ flexDirection: 'column',
742
+ ml: bottom && label ? '4px' : '0px',
743
+ height: !horizontal ? '100%' : 'unset'
744
+ }
745
+ }, /*#__PURE__*/React.createElement(Flex, {
746
+ sx: {
747
+ gap: ['3px', '6px', '6px', '7px'],
748
+ height: !horizontal ? '100%' : 'unset'
749
+ }
750
+ }, horizontal && clim && !bottom && /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(Gradient, {
595
751
  colormap: colormap,
596
752
  horizontal: horizontal,
597
753
  discrete: discrete,
598
754
  width: width,
599
755
  height: height
600
- }), horizontal && clim && /*#__PURE__*/React.createElement(ClimMax, null), !horizontal && /*#__PURE__*/React.createElement(Flex, {
756
+ }), horizontal && clim && !bottom && /*#__PURE__*/React.createElement(ClimMax, null)), horizontal && clim && bottom && /*#__PURE__*/React.createElement(Flex, {
757
+ sx: {
758
+ justifyContent: 'space-between'
759
+ }
760
+ }, /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(ClimMax, null))), !horizontal && /*#__PURE__*/React.createElement(Flex, {
601
761
  sx: {
602
762
  flexDirection: 'column-reverse',
603
763
  justifyContent: 'space-between',
@@ -606,9 +766,7 @@ const Colorbar = _ref => {
606
766
  }, clim && /*#__PURE__*/React.createElement(ClimMin, null), clim && /*#__PURE__*/React.createElement(ClimMax, null)));
607
767
  };
608
768
 
609
- const _excluded$b = ["start", "width", "dl", "dr", "children", "sx"];
610
-
611
- const Column = _ref => {
769
+ const Column = (_ref) => {
612
770
  let {
613
771
  start,
614
772
  width,
@@ -617,7 +775,7 @@ const Column = _ref => {
617
775
  children,
618
776
  sx
619
777
  } = _ref,
620
- props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
778
+ props = _objectWithoutPropertiesLoose(_ref, ["start", "width", "dl", "dr", "children", "sx"]);
621
779
 
622
780
  start = start || 'auto';
623
781
  width = width || 'auto';
@@ -785,7 +943,7 @@ const Meta = ({
785
943
  }));
786
944
  };
787
945
 
788
- const Logo = _ref => {
946
+ const Logo = (_ref) => {
789
947
  let props = _extends({}, _ref);
790
948
 
791
949
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -821,16 +979,14 @@ const Logo = _ref => {
821
979
  })));
822
980
  };
823
981
 
824
- const _excluded$a = ["children", "sx", "columns", "gap"];
825
-
826
- const Row = _ref => {
982
+ const Row = (_ref) => {
827
983
  let {
828
984
  children,
829
985
  sx,
830
986
  columns,
831
987
  gap
832
988
  } = _ref,
833
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
989
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "sx", "columns", "gap"]);
834
990
 
835
991
  const makeArray = input => {
836
992
  if (!Array.isArray(input)) {
@@ -878,14 +1034,12 @@ const Row = _ref => {
878
1034
  }), children);
879
1035
  };
880
1036
 
881
- const _excluded$9 = ["value", "sx"];
882
-
883
- const Menu = _ref => {
1037
+ const Menu = (_ref) => {
884
1038
  let {
885
1039
  value,
886
1040
  sx
887
1041
  } = _ref,
888
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
1042
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
889
1043
 
890
1044
  return /*#__PURE__*/React.createElement(IconButton, _extends({
891
1045
  sx: _extends({
@@ -973,151 +1127,7 @@ const Menu = _ref => {
973
1127
  })));
974
1128
  };
975
1129
 
976
- const _excluded$8 = ["value", "sx"];
977
-
978
- const Settings = _ref => {
979
- let {
980
- value,
981
- sx
982
- } = _ref,
983
- props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
984
-
985
- return /*#__PURE__*/React.createElement(IconButton, _extends({
986
- sx: _extends({
987
- cursor: 'pointer',
988
- fill: 'none',
989
- strokeWidth: '2px',
990
- stroke: 'text',
991
- '.paren': {
992
- opacity: '0'
993
- },
994
- '@media (hover: hover) and (pointer: fine)': {
995
- '&:hover .paren': {
996
- opacity: '1'
997
- }
998
- }
999
- }, sx),
1000
- "aria-label": "Toggle Menu"
1001
- }, props), !value && /*#__PURE__*/React.createElement("svg", {
1002
- style: {
1003
- width: '50px',
1004
- height: '30px',
1005
- transform: 'scale(2)',
1006
- marginTop: '-3px'
1007
- },
1008
- xmlns: "http://www.w3.org/2000/svg",
1009
- viewBox: "0 0 68 36"
1010
- }, /*#__PURE__*/React.createElement("line", {
1011
- x1: "24",
1012
- y1: "2.1",
1013
- x2: "24",
1014
- y2: "6.1"
1015
- }), /*#__PURE__*/React.createElement("line", {
1016
- x1: "24",
1017
- y1: "24.1",
1018
- x2: "24",
1019
- y2: "33.9"
1020
- }), /*#__PURE__*/React.createElement("line", {
1021
- x1: "44",
1022
- y1: "2.1",
1023
- x2: "44",
1024
- y2: "12.1"
1025
- }), /*#__PURE__*/React.createElement("line", {
1026
- x1: "44",
1027
- y1: "30.1",
1028
- x2: "44",
1029
- y2: "33.9"
1030
- }), /*#__PURE__*/React.createElement("circle", {
1031
- cx: "24",
1032
- cy: "15.1",
1033
- r: "5"
1034
- }), /*#__PURE__*/React.createElement("circle", {
1035
- cx: "44",
1036
- cy: "21.1",
1037
- r: "5"
1038
- }), /*#__PURE__*/React.createElement("path", {
1039
- style: {
1040
- transition: 'all 0.2s'
1041
- },
1042
- className: "paren",
1043
- d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1044
- }), /*#__PURE__*/React.createElement("path", {
1045
- style: {
1046
- transition: 'all 0.2s'
1047
- },
1048
- className: "paren",
1049
- d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1050
- })), value && /*#__PURE__*/React.createElement("svg", {
1051
- style: {
1052
- width: '50px',
1053
- height: '30px',
1054
- transform: 'scale(2)',
1055
- marginTop: '-3px'
1056
- },
1057
- xmlns: "http://www.w3.org/2000/svg",
1058
- viewBox: "0 0 68 36"
1059
- }, /*#__PURE__*/React.createElement("line", {
1060
- x1: "50.85",
1061
- y1: "29.79",
1062
- x2: "17.15",
1063
- y2: "6.21"
1064
- }), /*#__PURE__*/React.createElement("line", {
1065
- x1: "17.15",
1066
- y1: "29.79",
1067
- x2: "50.85",
1068
- y2: "6.21"
1069
- }), /*#__PURE__*/React.createElement("path", {
1070
- style: {
1071
- transition: 'all 0.2s'
1072
- },
1073
- className: "paren",
1074
- d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1075
- }), /*#__PURE__*/React.createElement("path", {
1076
- style: {
1077
- transition: 'all 0.2s'
1078
- },
1079
- className: "paren",
1080
- d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1081
- })));
1082
- };
1083
-
1084
- const _excluded$7 = ["sx"];
1085
-
1086
- const Dimmer = _ref => {
1087
- let {
1088
- sx
1089
- } = _ref,
1090
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
1091
-
1092
- const [colorMode, setColorMode] = useColorMode();
1093
- const toggle = useCallback(() => {
1094
- setColorMode(colorMode === 'light' ? 'dark' : 'light');
1095
- }, [colorMode]);
1096
- return /*#__PURE__*/React.createElement(IconButton, _extends({
1097
- "aria-label": "Toggle dark mode",
1098
- onClick: toggle,
1099
- role: "checkbox",
1100
- sx: _extends({
1101
- width: 32,
1102
- height: 32,
1103
- display: 'inline-block',
1104
- cursor: 'pointer',
1105
- color: 'secondary'
1106
- }, sx)
1107
- }, props), /*#__PURE__*/React.createElement(Sun, {
1108
- sx: {
1109
- strokeWidth: '1.75',
1110
- transition: 'stroke 0.15s',
1111
- '@media (hover: hover) and (pointer: fine)': {
1112
- '&:hover': {
1113
- stroke: 'primary'
1114
- }
1115
- }
1116
- }
1117
- }));
1118
- };
1119
-
1120
- const sx$1 = {
1130
+ const sx = {
1121
1131
  link: (current, label, first = false) => {
1122
1132
  return {
1123
1133
  width: 'auto',
@@ -1183,7 +1193,6 @@ const Nav = ({
1183
1193
  mode,
1184
1194
  nav,
1185
1195
  first,
1186
- dimmer,
1187
1196
  setExpanded
1188
1197
  }) => {
1189
1198
  const {
@@ -1196,16 +1205,16 @@ const Nav = ({
1196
1205
  return /*#__PURE__*/React.createElement(NextLink, {
1197
1206
  href: href,
1198
1207
  passHref: true
1199
- }, /*#__PURE__*/React.createElement(Link$1, {
1208
+ }, /*#__PURE__*/React.createElement(Link$2, {
1200
1209
  onClick: () => {
1201
1210
  if (nav === url) setExpanded(false);
1202
1211
  },
1203
- sx: sx$1.link(nav, url, first)
1212
+ sx: sx.link(nav, url, first)
1204
1213
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display));
1205
1214
  } else {
1206
- return /*#__PURE__*/React.createElement(Link$1, {
1215
+ return /*#__PURE__*/React.createElement(Link$2, {
1207
1216
  href: href,
1208
- sx: sx$1.link(nav, url, first)
1217
+ sx: sx.link(nav, url, first)
1209
1218
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display);
1210
1219
  }
1211
1220
  };
@@ -1232,8 +1241,7 @@ const Header = ({
1232
1241
  status,
1233
1242
  mode,
1234
1243
  nav,
1235
- dimmer,
1236
- settings
1244
+ menuItems
1237
1245
  }) => {
1238
1246
  const [expanded, setExpanded] = useState(false);
1239
1247
 
@@ -1243,7 +1251,6 @@ const Header = ({
1243
1251
 
1244
1252
  return /*#__PURE__*/React.createElement(Row, {
1245
1253
  sx: {
1246
- width: '100%',
1247
1254
  pt: ['12px'],
1248
1255
  pb: [3]
1249
1256
  }
@@ -1258,7 +1265,7 @@ const Header = ({
1258
1265
  }, (mode == 'homepage' || mode == 'local') && /*#__PURE__*/React.createElement(NextLink, {
1259
1266
  href: "/",
1260
1267
  passHref: true
1261
- }, /*#__PURE__*/React.createElement(Link$1, {
1268
+ }, /*#__PURE__*/React.createElement(Link$2, {
1262
1269
  "aria-label": "CarbonPlan Homepage",
1263
1270
  sx: {
1264
1271
  display: 'block'
@@ -1269,7 +1276,7 @@ const Header = ({
1269
1276
  cursor: 'pointer',
1270
1277
  color: 'primary'
1271
1278
  }
1272
- }))), (mode == null || mode == 'remote') && /*#__PURE__*/React.createElement(Link$1, {
1279
+ }))), (mode == null || mode == 'remote') && /*#__PURE__*/React.createElement(Link$2, {
1273
1280
  href: "https://carbonplan.org",
1274
1281
  "aria-label": "CarbonPlan Homepage",
1275
1282
  sx: {
@@ -1295,53 +1302,31 @@ const Header = ({
1295
1302
  top: ['-2px', '-3px', '-3px']
1296
1303
  }
1297
1304
  }, status ? `(${status})` : '')), /*#__PURE__*/React.createElement(Column, {
1298
- start: [status ? 6 : 4, 6, 12, 12],
1305
+ start: [status ? 6 : 4, 6, 11, 11],
1299
1306
  width: [status ? 1 : 3, 3, 2, 2],
1300
1307
  sx: {
1301
- display: 'flex',
1302
- alignItems: 'center',
1303
- justifyContent: 'flex-end'
1304
- }
1305
- }, /*#__PURE__*/React.createElement(Box, {
1306
- sx: {
1307
- mr: ['18px'],
1308
- position: 'relative',
1309
- top: ['-1px'],
1310
- pointerEvents: expanded || settings && settings.value ? 'none' : 'all',
1311
- transition: 'opacity 0.15s',
1312
- display: [status ? 'none' : 'block', 'block', dimmer === 'top' ? 'block' : 'none', dimmer === 'top' ? 'block' : 'none']
1313
- }
1314
- }, /*#__PURE__*/React.createElement(Dimmer, {
1315
- sx: {
1316
- opacity: expanded || settings && settings.value ? 0 : 1,
1317
- color: 'primary'
1308
+ zIndex: 5000
1318
1309
  }
1319
- })), settings && /*#__PURE__*/React.createElement(Box, {
1310
+ }, /*#__PURE__*/React.createElement(Flex, {
1320
1311
  sx: {
1321
- mr: ['21px'],
1322
- position: 'relative',
1323
- pointerEvents: expanded ? 'none' : 'all',
1324
- transition: 'opacity 0.15s',
1325
- display: [status ? 'none' : 'block', 'block', 'none', 'none']
1312
+ justifyContent: 'flex-end'
1326
1313
  }
1327
- }, /*#__PURE__*/React.createElement(Settings, {
1328
- value: settings.value,
1329
- onClick: settings.onClick,
1314
+ }, /*#__PURE__*/React.createElement(Flex, {
1330
1315
  sx: {
1316
+ mr: '18px',
1317
+ gap: '18px',
1331
1318
  opacity: expanded ? 0 : 1,
1332
- stroke: 'primary'
1319
+ transition: 'opacity 0.15s',
1320
+ justifyContent: 'space-between',
1321
+ alignItems: 'center'
1333
1322
  }
1334
- })), /*#__PURE__*/React.createElement(Menu, {
1323
+ }, menuItems), /*#__PURE__*/React.createElement(Menu, {
1335
1324
  sx: {
1336
- transition: 'opacity 0.15s',
1337
- pointerEvents: settings && settings.value ? 'none' : 'all',
1338
- opacity: settings && settings.value ? 0 : 1,
1339
- mr: ['-2px'],
1340
- zIndex: 5000
1325
+ mr: ['-2px']
1341
1326
  },
1342
1327
  value: expanded,
1343
1328
  onClick: toggle
1344
- })), /*#__PURE__*/React.createElement(Box, {
1329
+ }))), /*#__PURE__*/React.createElement(Box, {
1345
1330
  sx: {
1346
1331
  opacity: expanded ? 1 : 0,
1347
1332
  pointerEvents: expanded ? 'all' : 'none',
@@ -1374,7 +1359,7 @@ const Header = ({
1374
1359
  })))))));
1375
1360
  };
1376
1361
 
1377
- const Monogram = _ref => {
1362
+ const Monogram = (_ref) => {
1378
1363
  let props = _extends({}, _ref);
1379
1364
 
1380
1365
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -1413,7 +1398,7 @@ const Footer = () => {
1413
1398
  letterSpacing: 'mono',
1414
1399
  mb: [2]
1415
1400
  }
1416
- }, "EMAIL"), /*#__PURE__*/React.createElement(Link$1, {
1401
+ }, "EMAIL"), /*#__PURE__*/React.createElement(Link$2, {
1417
1402
  href: "mailto:hello@carbonplan.org",
1418
1403
  sx: {
1419
1404
  textDecoration: 'none',
@@ -1447,7 +1432,7 @@ const Footer = () => {
1447
1432
  letterSpacing: 'mono',
1448
1433
  mb: [2]
1449
1434
  }
1450
- }, "FOLLOW"), /*#__PURE__*/React.createElement(Link$1, {
1435
+ }, "FOLLOW"), /*#__PURE__*/React.createElement(Link$2, {
1451
1436
  href: "https://twitter.com/carbonplanorg",
1452
1437
  sx: {
1453
1438
  textDecoration: 'none',
@@ -1541,6 +1526,40 @@ const Footer = () => {
1541
1526
  }))));
1542
1527
  };
1543
1528
 
1529
+ const Dimmer = (_ref) => {
1530
+ let {
1531
+ sx
1532
+ } = _ref,
1533
+ props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
1534
+
1535
+ const [colorMode, setColorMode] = useColorMode();
1536
+ const toggle = useCallback(() => {
1537
+ setColorMode(colorMode === 'light' ? 'dark' : 'light');
1538
+ }, [colorMode]);
1539
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1540
+ "aria-label": "Toggle dark mode",
1541
+ onClick: toggle,
1542
+ role: "checkbox",
1543
+ sx: _extends({
1544
+ width: 32,
1545
+ height: 32,
1546
+ display: 'inline-block',
1547
+ cursor: 'pointer',
1548
+ color: 'secondary'
1549
+ }, sx)
1550
+ }, props), /*#__PURE__*/React.createElement(Sun, {
1551
+ sx: {
1552
+ strokeWidth: '1.75',
1553
+ transition: 'stroke 0.15s',
1554
+ '@media (hover: hover) and (pointer: fine)': {
1555
+ '&:hover': {
1556
+ stroke: 'primary'
1557
+ }
1558
+ }
1559
+ }
1560
+ }));
1561
+ };
1562
+
1544
1563
  const GitSha = () => {
1545
1564
  const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
1546
1565
  const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
@@ -1559,7 +1578,7 @@ const GitSha = () => {
1559
1578
  }
1560
1579
  }, /*#__PURE__*/React.createElement(Separator, {
1561
1580
  color: color
1562
- }), /*#__PURE__*/React.createElement(Link$1, {
1581
+ }), /*#__PURE__*/React.createElement(Link$2, {
1563
1582
  href: href,
1564
1583
  sx: {
1565
1584
  whiteSpace: 'nowrap',
@@ -1692,7 +1711,6 @@ function scrollFraction(window, documnt) {
1692
1711
  return Math.min(window.scrollY / (document.body.offsetHeight - 770), 0.99);
1693
1712
  }
1694
1713
 
1695
- const _excluded$6 = ["duration", "delay", "children"];
1696
1714
  const fade = keyframes({
1697
1715
  from: {
1698
1716
  opacity: 0
@@ -1702,13 +1720,13 @@ const fade = keyframes({
1702
1720
  }
1703
1721
  });
1704
1722
 
1705
- const FadeIn = _ref => {
1723
+ const FadeIn = (_ref) => {
1706
1724
  let {
1707
1725
  duration = 300,
1708
1726
  delay = 0,
1709
1727
  children
1710
1728
  } = _ref,
1711
- delegated = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1729
+ delegated = _objectWithoutPropertiesLoose(_ref, ["duration", "delay", "children"]);
1712
1730
 
1713
1731
  return /*#__PURE__*/React.createElement(Box, _extends({}, delegated, {
1714
1732
  sx: {
@@ -1849,6 +1867,112 @@ function GuideColumns({
1849
1867
  }));
1850
1868
  }
1851
1869
 
1870
+ const Settings = (_ref) => {
1871
+ let {
1872
+ value,
1873
+ sx
1874
+ } = _ref,
1875
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
1876
+
1877
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1878
+ sx: _extends({
1879
+ cursor: 'pointer',
1880
+ fill: 'none',
1881
+ strokeWidth: '2px',
1882
+ stroke: 'text',
1883
+ '.paren': {
1884
+ opacity: '0'
1885
+ },
1886
+ '@media (hover: hover) and (pointer: fine)': {
1887
+ '&:hover .paren': {
1888
+ opacity: '1'
1889
+ }
1890
+ }
1891
+ }, sx),
1892
+ "aria-label": "Toggle Menu"
1893
+ }, props), !value && /*#__PURE__*/React.createElement("svg", {
1894
+ style: {
1895
+ width: '50px',
1896
+ height: '30px',
1897
+ transform: 'scale(2)',
1898
+ marginTop: '-3px'
1899
+ },
1900
+ xmlns: "http://www.w3.org/2000/svg",
1901
+ viewBox: "0 0 68 36"
1902
+ }, /*#__PURE__*/React.createElement("line", {
1903
+ x1: "24",
1904
+ y1: "2.1",
1905
+ x2: "24",
1906
+ y2: "6.1"
1907
+ }), /*#__PURE__*/React.createElement("line", {
1908
+ x1: "24",
1909
+ y1: "24.1",
1910
+ x2: "24",
1911
+ y2: "33.9"
1912
+ }), /*#__PURE__*/React.createElement("line", {
1913
+ x1: "44",
1914
+ y1: "2.1",
1915
+ x2: "44",
1916
+ y2: "12.1"
1917
+ }), /*#__PURE__*/React.createElement("line", {
1918
+ x1: "44",
1919
+ y1: "30.1",
1920
+ x2: "44",
1921
+ y2: "33.9"
1922
+ }), /*#__PURE__*/React.createElement("circle", {
1923
+ cx: "24",
1924
+ cy: "15.1",
1925
+ r: "5"
1926
+ }), /*#__PURE__*/React.createElement("circle", {
1927
+ cx: "44",
1928
+ cy: "21.1",
1929
+ r: "5"
1930
+ }), /*#__PURE__*/React.createElement("path", {
1931
+ style: {
1932
+ transition: 'all 0.2s'
1933
+ },
1934
+ className: "paren",
1935
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1936
+ }), /*#__PURE__*/React.createElement("path", {
1937
+ style: {
1938
+ transition: 'all 0.2s'
1939
+ },
1940
+ className: "paren",
1941
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1942
+ })), value && /*#__PURE__*/React.createElement("svg", {
1943
+ style: {
1944
+ width: '50px',
1945
+ height: '30px',
1946
+ transform: 'scale(2)',
1947
+ marginTop: '-3px'
1948
+ },
1949
+ xmlns: "http://www.w3.org/2000/svg",
1950
+ viewBox: "0 0 68 36"
1951
+ }, /*#__PURE__*/React.createElement("line", {
1952
+ x1: "50.85",
1953
+ y1: "29.79",
1954
+ x2: "17.15",
1955
+ y2: "6.21"
1956
+ }), /*#__PURE__*/React.createElement("line", {
1957
+ x1: "17.15",
1958
+ y1: "29.79",
1959
+ x2: "50.85",
1960
+ y2: "6.21"
1961
+ }), /*#__PURE__*/React.createElement("path", {
1962
+ style: {
1963
+ transition: 'all 0.2s'
1964
+ },
1965
+ className: "paren",
1966
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1967
+ }), /*#__PURE__*/React.createElement("path", {
1968
+ style: {
1969
+ transition: 'all 0.2s'
1970
+ },
1971
+ className: "paren",
1972
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1973
+ })));
1974
+ };
1975
+
1852
1976
  const Layout = ({
1853
1977
  title,
1854
1978
  description,
@@ -1868,6 +1992,7 @@ const Layout = ({
1868
1992
  container: _container = true
1869
1993
  }) => {
1870
1994
  let content = children;
1995
+ const index = useBreakpointIndex();
1871
1996
 
1872
1997
  if (_fade) {
1873
1998
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -1876,7 +2001,34 @@ const Layout = ({
1876
2001
  }
1877
2002
 
1878
2003
  if (_container) {
1879
- content = /*#__PURE__*/React.createElement(Container, null, content);
2004
+ content = /*#__PURE__*/React.createElement(Box, {
2005
+ sx: {
2006
+ mb: [8, 8, 9, 10]
2007
+ }
2008
+ }, /*#__PURE__*/React.createElement(Container, null, content));
2009
+ }
2010
+
2011
+ useEffect(() => {
2012
+ if (index > 2 && settings != null && settings.value && settings != null && settings.onClick) {
2013
+ settings == null ? void 0 : settings.onClick();
2014
+ }
2015
+ }, [index, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2016
+ const menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2017
+ key: "dimmer",
2018
+ sx: {
2019
+ color: 'primary',
2020
+ mt: '-2px',
2021
+ display: ['block', 'block', _dimmer === 'top' ? 'block' : 'none', _dimmer === 'top' ? 'block' : 'none']
2022
+ }
2023
+ })];
2024
+
2025
+ if (settings) {
2026
+ menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2027
+ key: "settings",
2028
+ sx: {
2029
+ display: ['inherit', 'inherit', 'none', 'none']
2030
+ }
2031
+ }, settings)));
1880
2032
  }
1881
2033
 
1882
2034
  return /*#__PURE__*/React.createElement(React.Fragment, null, _guide && /*#__PURE__*/React.createElement(Guide, {
@@ -1908,8 +2060,7 @@ const Layout = ({
1908
2060
  mode: _links,
1909
2061
  status: status,
1910
2062
  nav: nav,
1911
- settings: settings,
1912
- dimmer: _dimmer
2063
+ menuItems: menuItems
1913
2064
  }))), /*#__PURE__*/React.createElement(Box, {
1914
2065
  sx: {
1915
2066
  width: '100%',
@@ -2021,16 +2172,14 @@ const Expander = ({
2021
2172
  })));
2022
2173
  };
2023
2174
 
2024
- const _excluded$5 = ["label", "value", "sx", "children"];
2025
-
2026
- const Tag = _ref => {
2175
+ const Tag = (_ref) => {
2027
2176
  let {
2028
2177
  label,
2029
2178
  value,
2030
2179
  sx,
2031
2180
  children
2032
2181
  } = _ref,
2033
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2182
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "value", "sx", "children"]);
2034
2183
 
2035
2184
  const color = sx && sx.color ? sx.color : 'primary';
2036
2185
  const isClickable = props && (props.onClick || props.onDoubleClick);
@@ -2064,8 +2213,7 @@ const Tag = _ref => {
2064
2213
  }, props), children);
2065
2214
  };
2066
2215
 
2067
- const _excluded$4 = ["values", "setValues", "label", "colors", "showAll", "multiSelect"];
2068
- const sx = {
2216
+ const sx$1 = {
2069
2217
  label: {
2070
2218
  fontFamily: 'mono',
2071
2219
  letterSpacing: 'mono',
@@ -2126,7 +2274,7 @@ const updateValues = ({
2126
2274
  }
2127
2275
  };
2128
2276
 
2129
- const Filter = _ref => {
2277
+ const Filter = (_ref) => {
2130
2278
  let {
2131
2279
  values,
2132
2280
  setValues,
@@ -2135,10 +2283,10 @@ const Filter = _ref => {
2135
2283
  showAll = false,
2136
2284
  multiSelect = false
2137
2285
  } = _ref,
2138
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2286
+ props = _objectWithoutPropertiesLoose(_ref, ["values", "setValues", "label", "colors", "showAll", "multiSelect"]);
2139
2287
 
2140
2288
  return /*#__PURE__*/React.createElement(Box, props, label && /*#__PURE__*/React.createElement(Box, {
2141
- sx: sx.label
2289
+ sx: sx$1.label
2142
2290
  }, label), /*#__PURE__*/React.createElement(Box, {
2143
2291
  sx: {
2144
2292
  mt: label ? [3] : 0
@@ -2222,15 +2370,13 @@ const Group = ({
2222
2370
  }));
2223
2371
  };
2224
2372
 
2225
- const _excluded$3 = ["size", "inverted", "sx"];
2226
-
2227
- const Input = _ref => {
2373
+ const Input = (_ref, ref) => {
2228
2374
  let {
2229
2375
  size = 'sm',
2230
2376
  inverted,
2231
2377
  sx
2232
2378
  } = _ref,
2233
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
2379
+ props = _objectWithoutPropertiesLoose(_ref, ["size", "inverted", "sx"]);
2234
2380
 
2235
2381
  const defaultColor = inverted ? 'secondary' : 'primary';
2236
2382
 
@@ -2264,10 +2410,13 @@ const Input = _ref => {
2264
2410
  }, getSizeStyles(size), sx);
2265
2411
 
2266
2412
  return /*#__PURE__*/React.createElement(Input$1, _extends({}, props, {
2413
+ ref: ref,
2267
2414
  sx: styles
2268
2415
  }));
2269
2416
  };
2270
2417
 
2418
+ var input = forwardRef(Input);
2419
+
2271
2420
  const getProps = test => props => {
2272
2421
  const next = {};
2273
2422
 
@@ -2278,15 +2427,14 @@ const getProps = test => props => {
2278
2427
  return next;
2279
2428
  };
2280
2429
 
2281
- const _excluded$2 = ["children", "size", "sx"];
2282
-
2283
- const Select = _ref => {
2430
+ const Select = (_ref) => {
2284
2431
  let {
2285
2432
  children,
2286
2433
  size = 'sm',
2287
- sx
2434
+ sx,
2435
+ sxSelect
2288
2436
  } = _ref,
2289
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2437
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "size", "sx", "sxSelect"]);
2290
2438
 
2291
2439
  const color = sx && sx.color ? sx.color : 'primary';
2292
2440
  const sizeStyles = getSizeStyles(size);
@@ -2358,7 +2506,7 @@ const Select = _ref => {
2358
2506
  background: 'transparent !important'
2359
2507
  }
2360
2508
  }
2361
- })
2509
+ }, sxSelect)
2362
2510
  }, omitOnChange), children), /*#__PURE__*/React.createElement(Arrow, {
2363
2511
  sx: {
2364
2512
  width: width,
@@ -2373,13 +2521,11 @@ const Select = _ref => {
2373
2521
  }));
2374
2522
  };
2375
2523
 
2376
- const _excluded$1 = ["sx"];
2377
-
2378
- const Slider = _ref => {
2524
+ const Slider = (_ref, ref) => {
2379
2525
  let {
2380
2526
  sx
2381
2527
  } = _ref,
2382
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2528
+ props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
2383
2529
 
2384
2530
  const color = sx && sx.color ? sx.color : 'primary';
2385
2531
  const {
@@ -2388,6 +2534,7 @@ const Slider = _ref => {
2388
2534
  }
2389
2535
  } = useThemeUI();
2390
2536
  return /*#__PURE__*/React.createElement(Slider$1, _extends({
2537
+ ref: ref,
2391
2538
  sx: _extends({
2392
2539
  '&::-webkit-slider-thumb': {
2393
2540
  height: [22, 18, 16],
@@ -2419,7 +2566,9 @@ const Slider = _ref => {
2419
2566
  }, props));
2420
2567
  };
2421
2568
 
2422
- const styles = {
2569
+ var slider = forwardRef(Slider);
2570
+
2571
+ const styles$1 = {
2423
2572
  reset: {
2424
2573
  verticalAlign: 'baseline',
2425
2574
  border: 0,
@@ -2488,7 +2637,7 @@ const Table = ({
2488
2637
  }
2489
2638
  }, header && /*#__PURE__*/React.createElement(Row, {
2490
2639
  as: "tr",
2491
- sx: _extends({}, styles.reset, styles.header, styles.row, {
2640
+ sx: _extends({}, styles$1.reset, styles$1.header, styles$1.row, {
2492
2641
  color: color,
2493
2642
  borderTopWidth: !_borderTop ? '0px' : '1px'
2494
2643
  })
@@ -2496,13 +2645,13 @@ const Table = ({
2496
2645
  as: "td",
2497
2646
  start: [1],
2498
2647
  width: columns,
2499
- sx: styles.index
2648
+ sx: styles$1.index
2500
2649
  }, header)), data.map((row, i) => {
2501
2650
  return /*#__PURE__*/React.createElement(Row, {
2502
2651
  as: "tr",
2503
2652
  columns: columns,
2504
2653
  key: i,
2505
- sx: _extends({}, styles.reset, styles.row, {
2654
+ sx: _extends({}, styles$1.reset, styles$1.row, {
2506
2655
  pb: _borderBottom && i === data.length - 1 ? ['18px', '18px', '18px', '22px'] : [3, 3, 3, '20px'],
2507
2656
  borderBottomWidth: _borderBottom && i === data.length - 1 ? '1px' : '0px',
2508
2657
  borderTopWidth: !_borderTop && i === 0 && !header ? '0px' : '1px'
@@ -2513,26 +2662,25 @@ const Table = ({
2513
2662
  key: j,
2514
2663
  start: start[j],
2515
2664
  width: width[j],
2516
- sx: j == 0 && _index ? _extends({}, styles.reset, styles.index) : _extends({}, styles.reset, styles.entry)
2665
+ sx: j == 0 && _index ? _extends({}, styles$1.reset, styles$1.index) : _extends({}, styles$1.reset, styles$1.entry)
2517
2666
  }, column);
2518
2667
  }));
2519
2668
  })));
2520
2669
  };
2521
2670
 
2522
- const _excluded = ["value", "onClick", "disabled", "sx"];
2523
-
2524
- const Toggle = _ref => {
2671
+ const Toggle = (_ref, ref) => {
2525
2672
  let {
2526
2673
  value,
2527
2674
  onClick,
2528
2675
  disabled,
2529
2676
  sx
2530
2677
  } = _ref,
2531
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
2678
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "onClick", "disabled", "sx"]);
2532
2679
 
2533
2680
  const color = sx && sx.color ? sx.color : 'primary';
2534
2681
  value = disabled ? false : value;
2535
2682
  return /*#__PURE__*/React.createElement(Box, _extends({
2683
+ ref: ref,
2536
2684
  as: "button",
2537
2685
  onClick: onClick,
2538
2686
  role: "checkbox",
@@ -2570,6 +2718,8 @@ const Toggle = _ref => {
2570
2718
  })));
2571
2719
  };
2572
2720
 
2721
+ var toggle = forwardRef(Toggle);
2722
+
2573
2723
  const Tracking = ({
2574
2724
  id
2575
2725
  }) => {
@@ -2601,7 +2751,6 @@ const Tray = ({
2601
2751
  }) => {
2602
2752
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
2603
2753
  sx: {
2604
- display: ['initial', 'initial', 'none', 'none'],
2605
2754
  position: 'fixed',
2606
2755
  top: '56px',
2607
2756
  bottom: '0px',
@@ -2616,7 +2765,6 @@ const Tray = ({
2616
2765
  }
2617
2766
  }), /*#__PURE__*/React.createElement(Box, {
2618
2767
  sx: _extends({
2619
- display: ['initial', 'initial', 'none', 'none'],
2620
2768
  position: 'fixed',
2621
2769
  width: 'calc(100vw)',
2622
2770
  top: '0px',
@@ -2672,5 +2820,5 @@ const formatDate = (date, options = defaultOptions) => {
2672
2820
  return [month, day, year].filter(Boolean).join(' ');
2673
2821
  };
2674
2822
 
2675
- export { Badge, Button, Callout, Colorbar, Column, Custom404, Dimmer, Expander, FadeIn, Filter, Footer, Group, Guide, Header, Input, Layout, Link, Logo, Menu, Meta, Monogram, Row, Scrollbar, Select, Settings, Slider, Table, Tag, Toggle, Tracking, Tray, formatDate, getScrollbarWidth };
2823
+ export { Badge, button as Button, callout as Callout, Colorbar, Column, Custom404, Dimmer, Expander, FadeIn, Filter, Footer, Group, Guide, Header, input as Input, Layout, Link$1 as Link, Logo, Menu, Meta, Monogram, Row, Scrollbar, Select, Settings, slider as Slider, Table, Tag, toggle as Toggle, Tracking, Tray, formatDate, getScrollbarWidth };
2676
2824
  //# sourceMappingURL=index.modern.js.map