@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.
package/dst/index.esm.js CHANGED
@@ -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,12 +41,10 @@ function _objectWithoutPropertiesLoose(source, excluded) {
40
41
  return target;
41
42
  }
42
43
 
43
- var _excluded$g = ["sx", "children"];
44
-
45
44
  var Badge = function Badge(_ref) {
46
45
  var sx = _ref.sx,
47
46
  children = _ref.children,
48
- props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
47
+ props = _objectWithoutPropertiesLoose(_ref, ["sx", "children"]);
49
48
 
50
49
  var color = sx && sx.color ? sx.color : 'primary';
51
50
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -70,8 +69,6 @@ var Badge = function Badge(_ref) {
70
69
  }, children));
71
70
  };
72
71
 
73
- var _excluded$f = ["href", "children", "internal", "tracking"];
74
-
75
72
  var event = function event(_ref) {
76
73
  var action = _ref.action,
77
74
  category = _ref.category,
@@ -90,20 +87,22 @@ var event = function event(_ref) {
90
87
  });
91
88
  };
92
89
 
93
- var Link = function Link(_ref2) {
90
+ var Link = function Link(_ref2, ref) {
94
91
  var href = _ref2.href,
95
92
  children = _ref2.children,
96
93
  _ref2$internal = _ref2.internal,
97
94
  internal = _ref2$internal === void 0 ? false : _ref2$internal,
98
95
  _ref2$tracking = _ref2.tracking,
99
96
  tracking = _ref2$tracking === void 0 ? false : _ref2$tracking,
100
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$f);
97
+ props = _objectWithoutPropertiesLoose(_ref2, ["href", "children", "internal", "tracking"]);
101
98
 
102
99
  if (internal || href && href.startsWith('/')) {
103
100
  return /*#__PURE__*/React.createElement(NextLink, {
104
101
  href: href,
105
102
  passHref: true
106
- }, /*#__PURE__*/React.createElement(Link$1, props, children));
103
+ }, /*#__PURE__*/React.createElement(Link$2, _extends({
104
+ ref: ref
105
+ }, props), children));
107
106
  } else if (tracking) {
108
107
  var action;
109
108
  var category;
@@ -124,18 +123,22 @@ var Link = function Link(_ref2) {
124
123
  });
125
124
  };
126
125
 
127
- return /*#__PURE__*/React.createElement(Link$1, _extends({
126
+ return /*#__PURE__*/React.createElement(Link$2, _extends({
127
+ ref: ref,
128
128
  onClick: track,
129
129
  onContextMenu: track,
130
130
  href: href
131
131
  }, props), children);
132
132
  } else {
133
- return /*#__PURE__*/React.createElement(Link$1, _extends({
133
+ return /*#__PURE__*/React.createElement(Link$2, _extends({
134
+ ref: ref,
134
135
  href: href
135
136
  }, props), children);
136
137
  }
137
138
  };
138
139
 
140
+ var Link$1 = forwardRef(Link);
141
+
139
142
  var getSizeStyles = function getSizeStyles(size) {
140
143
  if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
141
144
  throw new Error('Size must be xs, sm, md, lg, or xl');
@@ -186,9 +189,7 @@ var getSizeStyles = function getSizeStyles(size) {
186
189
  };
187
190
  };
188
191
 
189
- var _excluded$e = ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"];
190
-
191
- var Button = function Button(_ref) {
192
+ var Button = function Button(_ref, ref) {
192
193
  var _ref$size = _ref.size,
193
194
  size = _ref$size === void 0 ? 'sm' : _ref$size,
194
195
  prefix = _ref.prefix,
@@ -200,7 +201,7 @@ var Button = function Button(_ref) {
200
201
  href = _ref.href,
201
202
  internal = _ref.internal,
202
203
  tracking = _ref.tracking,
203
- props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
204
+ props = _objectWithoutPropertiesLoose(_ref, ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"]);
204
205
 
205
206
  if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
206
207
  throw new Error('Size must be xs, sm, md, lg, or xl');
@@ -358,7 +359,8 @@ var Button = function Button(_ref) {
358
359
  }, suffix && suffix));
359
360
 
360
361
  if (href) {
361
- return /*#__PURE__*/React.createElement(Link, _extends({
362
+ return /*#__PURE__*/React.createElement(Link$1, _extends({
363
+ ref: ref,
362
364
  href: href,
363
365
  internal: internal,
364
366
  tracking: tracking,
@@ -368,15 +370,16 @@ var Button = function Button(_ref) {
368
370
  }, props), Inner);
369
371
  } else {
370
372
  return /*#__PURE__*/React.createElement(Box, _extends({
373
+ ref: ref,
371
374
  as: "button",
372
375
  sx: style
373
376
  }, props), Inner);
374
377
  }
375
378
  };
376
379
 
377
- var _excluded$d = ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"];
380
+ var button = forwardRef(Button);
378
381
 
379
- var Callout = function Callout(_ref) {
382
+ var Callout = function Callout(_ref, ref) {
380
383
  var label = _ref.label,
381
384
  children = _ref.children,
382
385
  inverted = _ref.inverted,
@@ -385,7 +388,7 @@ var Callout = function Callout(_ref) {
385
388
  internal = _ref.internal,
386
389
  tracking = _ref.tracking,
387
390
  sx = _ref.sx,
388
- props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
391
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"]);
389
392
 
390
393
  var baseColor = color || (inverted ? 'secondary' : 'primary');
391
394
  var hoverColor = color ? 'primary' : inverted ? 'primary' : 'secondary';
@@ -450,7 +453,8 @@ var Callout = function Callout(_ref) {
450
453
  })));
451
454
 
452
455
  if (href) {
453
- return /*#__PURE__*/React.createElement(Link, _extends({
456
+ return /*#__PURE__*/React.createElement(Link$1, _extends({
457
+ ref: ref,
454
458
  href: href,
455
459
  internal: internal,
456
460
  tracking: tracking,
@@ -458,19 +462,42 @@ var Callout = function Callout(_ref) {
458
462
  }, props), Inner);
459
463
  } else {
460
464
  return /*#__PURE__*/React.createElement(Box, _extends({
465
+ ref: ref,
461
466
  as: "button",
462
467
  sx: style
463
468
  }, props), Inner);
464
469
  }
465
470
  };
466
471
 
467
- var _excluded$c = ["colormap", "label", "clim", "discrete", "units", "width", "height", "format", "horizontal"];
468
- var sx$2 = {
469
- clim: {
470
- fontFamily: 'mono',
471
- fontSize: ['9px', 0, 0, 1],
472
- letterSpacing: 'smallcaps',
473
- textTransform: 'uppercase'
472
+ var callout = forwardRef(Callout);
473
+
474
+ var styles = {
475
+ clim: function clim(setClim) {
476
+ return {
477
+ fontFamily: 'mono',
478
+ fontSize: ['9px', 0, 0, 1],
479
+ letterSpacing: 'smallcaps',
480
+ textTransform: 'uppercase',
481
+ '@media (hover: hover) and (pointer: fine)': {
482
+ '&:hover': {
483
+ borderBottom: setClim ? function (_ref) {
484
+ var colors = _ref.colors;
485
+ return "solid 1px " + colors.primary + " !important";
486
+ } : 'unset'
487
+ }
488
+ },
489
+ '&:focus': {
490
+ outline: 'none',
491
+ borderBottom: setClim ? function (_ref2) {
492
+ var colors = _ref2.colors;
493
+ return "solid 1px " + colors.primary + " !important";
494
+ } : 'unset'
495
+ },
496
+ transition: 'border 0.15s',
497
+ userSelect: setClim ? 'none !important' : 'unset',
498
+ width: 'fit-content',
499
+ minWidth: 'fit-content'
500
+ };
474
501
  }
475
502
  };
476
503
  var DIMENSIONS = {
@@ -478,12 +505,12 @@ var DIMENSIONS = {
478
505
  height: ['80px', '110px', '110px', '130px']
479
506
  };
480
507
 
481
- var Gradient = function Gradient(_ref) {
482
- var colormap = _ref.colormap,
483
- discrete = _ref.discrete,
484
- horizontal = _ref.horizontal,
485
- width = _ref.width,
486
- height = _ref.height;
508
+ var Gradient = function Gradient(_ref3) {
509
+ var colormap = _ref3.colormap,
510
+ discrete = _ref3.discrete,
511
+ horizontal = _ref3.horizontal,
512
+ width = _ref3.width,
513
+ height = _ref3.height;
487
514
  var step = 1 / colormap.length * 100;
488
515
  var values = colormap.map(function (d, i) {
489
516
  return "rgb(" + d + ") " + i * step + "% " + (discrete && i < colormap.length - 1 ? (i + 1) * step + "%" : '');
@@ -497,9 +524,9 @@ var Gradient = function Gradient(_ref) {
497
524
  width: width || DIMENSIONS.width,
498
525
  minHeight: height || DIMENSIONS.height
499
526
  }, {
500
- mt: horizontal ? [0, '1px', '1px', 0] : 0,
501
- border: function border(_ref2) {
502
- var colors = _ref2.colors;
527
+ mt: horizontal ? ['1px', '1px', '1px', 0] : 0,
528
+ border: function border(_ref4) {
529
+ var colors = _ref4.colors;
503
530
  return "solid 1px " + colors.hinted;
504
531
  },
505
532
  background: css
@@ -507,12 +534,13 @@ var Gradient = function Gradient(_ref) {
507
534
  });
508
535
  };
509
536
 
510
- var Label = function Label(_ref3) {
511
- var label = _ref3.label,
512
- units = _ref3.units,
513
- horizontal = _ref3.horizontal;
537
+ var Label = function Label(_ref5) {
538
+ var label = _ref5.label,
539
+ units = _ref5.units,
540
+ horizontal = _ref5.horizontal;
514
541
  return /*#__PURE__*/React.createElement(Box, {
515
542
  sx: !horizontal && {
543
+ width: ['13px', '17px', '17px', '19px'],
516
544
  alignSelf: 'flex-end'
517
545
  }
518
546
  }, /*#__PURE__*/React.createElement(Box, {
@@ -539,63 +567,230 @@ var Label = function Label(_ref3) {
539
567
  }, units)));
540
568
  };
541
569
 
542
- var Colorbar = function Colorbar(_ref4) {
543
- var colormap = _ref4.colormap,
544
- label = _ref4.label,
545
- clim = _ref4.clim,
546
- discrete = _ref4.discrete,
547
- units = _ref4.units,
548
- width = _ref4.width,
549
- height = _ref4.height,
550
- _ref4$format = _ref4.format,
551
- format = _ref4$format === void 0 ? function (d) {
570
+ var Colorbar = function Colorbar(_ref6) {
571
+ var colormap = _ref6.colormap,
572
+ label = _ref6.label,
573
+ clim = _ref6.clim,
574
+ setClim = _ref6.setClim,
575
+ _ref6$setClimStep = _ref6.setClimStep,
576
+ setClimStep = _ref6$setClimStep === void 0 ? 1 : _ref6$setClimStep,
577
+ discrete = _ref6.discrete,
578
+ units = _ref6.units,
579
+ width = _ref6.width,
580
+ height = _ref6.height,
581
+ _ref6$format = _ref6.format,
582
+ format = _ref6$format === void 0 ? function (d) {
552
583
  return d;
553
- } : _ref4$format,
554
- _ref4$horizontal = _ref4.horizontal,
555
- horizontal = _ref4$horizontal === void 0 ? false : _ref4$horizontal,
556
- props = _objectWithoutPropertiesLoose(_ref4, _excluded$c);
584
+ } : _ref6$format,
585
+ _ref6$horizontal = _ref6.horizontal,
586
+ horizontal = _ref6$horizontal === void 0 ? false : _ref6$horizontal,
587
+ _ref6$bottom = _ref6.bottom,
588
+ bottom = _ref6$bottom === void 0 ? false : _ref6$bottom,
589
+ sx = _ref6.sx,
590
+ sxClim = _ref6.sxClim,
591
+ props = _objectWithoutPropertiesLoose(_ref6, ["colormap", "label", "clim", "setClim", "setClimStep", "discrete", "units", "width", "height", "format", "horizontal", "bottom", "sx", "sxClim"]);
557
592
 
558
593
  if (!Array.isArray(colormap)) {
559
594
  throw new Error("expected array for colormap, got '" + colormap + "'.");
560
595
  }
561
596
 
597
+ var climRef = [useRef(), useRef()];
598
+
599
+ var _useState = useState(false),
600
+ climMinDragging = _useState[0],
601
+ setClimMinDragging = _useState[1];
602
+
603
+ var _useState2 = useState(false),
604
+ climMaxDragging = _useState2[0],
605
+ setClimMaxDragging = _useState2[1];
606
+
607
+ var x,
608
+ y,
609
+ dx,
610
+ dy = 0;
611
+ var id = null;
612
+ var init = [0, 0];
613
+ var scale = setClimStep;
614
+
615
+ var draggingFunction = function draggingFunction(e) {
616
+ if (id === 'min' && !climMinDragging) setClimMinDragging(true);
617
+ if (id === 'max' && !climMaxDragging) setClimMaxDragging(true);
618
+ dx = e.pageX - x;
619
+ dy = e.pageY - y;
620
+
621
+ if (horizontal) {
622
+ if (id === 'min') setClim(function (prev) {
623
+ return [Math.min(init[0] + dx * scale, init[1]), prev[1]];
624
+ });
625
+ if (id === 'max') setClim(function (prev) {
626
+ return [prev[0], Math.max(init[1] + dx * scale, init[0])];
627
+ });
628
+ } else {
629
+ if (id === 'min') setClim(function (prev) {
630
+ return [Math.min(init[0] - dy * scale, init[1]), prev[1]];
631
+ });
632
+ if (id === 'max') setClim(function (prev) {
633
+ return [prev[0], Math.max(init[1] - dy * scale, init[0])];
634
+ });
635
+ }
636
+ };
637
+
638
+ var handleMouseDown = function handleMouseDown(e) {
639
+ y = e.pageY;
640
+ x = e.pageX;
641
+ id = e.target.id;
642
+ init = clim;
643
+ document.body.setAttribute('style', horizontal ? 'cursor: ew-resize !important' : 'cursor: ns-resize !important');
644
+ document.addEventListener('mousemove', draggingFunction);
645
+
646
+ var updater = function updater() {
647
+ document.body.setAttribute('style', 'cursor: unset');
648
+ document.removeEventListener('mousemove', draggingFunction);
649
+ window.removeEventListener('mouseup', updater);
650
+ if (id === 'min') setClimMinDragging(false);
651
+ if (id === 'max') setClimMaxDragging(false);
652
+ };
653
+
654
+ window.addEventListener('mouseup', updater);
655
+ };
656
+
657
+ var increment = function increment(e) {
658
+ if (climRef[0].current === document.activeElement) {
659
+ e.preventDefault();
660
+ setClim(function (prev) {
661
+ return [Math.min(prev[0] + scale, prev[1]), prev[1]];
662
+ });
663
+ climRef[0].current.focus();
664
+ }
665
+
666
+ if (climRef[1].current === document.activeElement) {
667
+ e.preventDefault();
668
+ setClim(function (prev) {
669
+ return [prev[0], Math.max(prev[1] + scale, prev[0])];
670
+ });
671
+ climRef[1].current.focus();
672
+ }
673
+ };
674
+
675
+ var decrement = function decrement(e) {
676
+ if (climRef[0].current === document.activeElement) {
677
+ e.preventDefault();
678
+ setClim(function (prev) {
679
+ return [Math.min(prev[0] - scale, prev[1]), prev[1]];
680
+ });
681
+ climRef[0].current.focus();
682
+ }
683
+
684
+ if (climRef[1].current === document.activeElement) {
685
+ e.preventDefault();
686
+ setClim(function (prev) {
687
+ return [prev[0], Math.max(prev[1] - scale, prev[0])];
688
+ });
689
+ climRef[1].current.focus();
690
+ }
691
+ };
692
+
693
+ useEffect(function () {
694
+ var listener = function listener(e) {
695
+ if (['ArrowUp', 'ArrowRight'].includes(e.code) || ['ArrowUp', 'ArrowRight'].includes(e.key)) {
696
+ increment(e);
697
+ }
698
+
699
+ if (['ArrowDown', 'ArrowLeft'].includes(e.code) || ['ArrowDown', 'ArrowLeft'].includes(e.key)) {
700
+ decrement(e);
701
+ }
702
+ };
703
+
704
+ window.addEventListener('keydown', listener);
705
+ return function () {
706
+ window.removeEventListener('keydown', listener);
707
+ };
708
+ }, [clim]);
709
+
562
710
  var ClimMin = function ClimMin() {
563
711
  return /*#__PURE__*/React.createElement(Box, {
564
- sx: _extends({}, sx$2.clim, {
565
- ml: label ? horizontal ? '10px' : '2px' : 0,
712
+ id: "min",
713
+ ref: climRef[0],
714
+ tabIndex: 0,
715
+ sx: _extends({}, styles.clim(setClim), {
716
+ ml: label ? horizontal ? bottom ? '0px' : '10px' : ['2px', '1px', '1px', '2px'] : 0,
566
717
  mr: horizontal ? ['2px', '1px', '1px', '2px'] : 0,
567
- mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px']
568
- })
718
+ mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px'],
719
+ borderBottom: setClim ? climMinDragging ? function (_ref7) {
720
+ var colors = _ref7.colors;
721
+ return "solid 1px " + colors.primary;
722
+ } : function (_ref8) {
723
+ var colors = _ref8.colors;
724
+ return "solid 1px " + colors.secondary;
725
+ } : 'unset',
726
+ cursor: setClim ? horizontal ? 'ew-resize' : 'ns-resize' : 'default'
727
+ }, sxClim),
728
+ onMouseDown: setClim ? handleMouseDown : function () {},
729
+ onClick: function onClick() {
730
+ return climRef[0].current.focus();
731
+ }
569
732
  }, format(clim[0]));
570
733
  };
571
734
 
572
735
  var ClimMax = function ClimMax() {
573
736
  return /*#__PURE__*/React.createElement(Box, {
574
- sx: _extends({}, sx$2.clim, {
575
- ml: horizontal ? ['2px', '1px', '1px', '2px'] : '2px',
576
- mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px']
577
- })
737
+ id: "max",
738
+ ref: climRef[1],
739
+ tabIndex: 0,
740
+ sx: _extends({}, styles.clim(setClim), {
741
+ ml: horizontal ? ['2px', '1px', '1px', '2px'] : ['2px', '1px', '1px', '2px'],
742
+ mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px'],
743
+ borderBottom: setClim ? climMaxDragging ? function (_ref9) {
744
+ var colors = _ref9.colors;
745
+ return "solid 1px " + colors.primary;
746
+ } : function (_ref10) {
747
+ var colors = _ref10.colors;
748
+ return "solid 1px " + colors.secondary;
749
+ } : 'unset',
750
+ cursor: setClim ? horizontal ? 'ew-resize' : 'ns-resize' : 'default'
751
+ }, sxClim),
752
+ onMouseDown: setClim ? handleMouseDown : function () {},
753
+ onClick: function onClick() {
754
+ return climRef[1].current.focus();
755
+ }
578
756
  }, format(clim[1]));
579
757
  };
580
758
 
581
- return /*#__PURE__*/React.createElement(Flex, {
582
- sx: _extends({}, props.sx, {
759
+ return /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
760
+ sx: _extends({
583
761
  flexDirection: 'row',
584
- alignItems: 'center',
762
+ alignItems: 'start',
585
763
  justifyContent: 'flex-start',
586
- gap: ['3px', '6px', '6px', '7px']
587
- })
588
- }, label && /*#__PURE__*/React.createElement(Label, {
764
+ gap: ['3px', '6px', '6px', '7px'],
765
+ height: !horizontal ? '100%' : 'unset'
766
+ }, sx)
767
+ }), label && /*#__PURE__*/React.createElement(Label, {
589
768
  label: label,
590
769
  units: units,
591
770
  horizontal: horizontal
592
- }), horizontal && clim && /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(Gradient, {
771
+ }), /*#__PURE__*/React.createElement(Flex, {
772
+ sx: {
773
+ flexGrow: horizontal ? 1 : 'unset',
774
+ flexDirection: 'column',
775
+ ml: bottom && label ? '4px' : '0px',
776
+ height: !horizontal ? '100%' : 'unset'
777
+ }
778
+ }, /*#__PURE__*/React.createElement(Flex, {
779
+ sx: {
780
+ gap: ['3px', '6px', '6px', '7px'],
781
+ height: !horizontal ? '100%' : 'unset'
782
+ }
783
+ }, horizontal && clim && !bottom && /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(Gradient, {
593
784
  colormap: colormap,
594
785
  horizontal: horizontal,
595
786
  discrete: discrete,
596
787
  width: width,
597
788
  height: height
598
- }), horizontal && clim && /*#__PURE__*/React.createElement(ClimMax, null), !horizontal && /*#__PURE__*/React.createElement(Flex, {
789
+ }), horizontal && clim && !bottom && /*#__PURE__*/React.createElement(ClimMax, null)), horizontal && clim && bottom && /*#__PURE__*/React.createElement(Flex, {
790
+ sx: {
791
+ justifyContent: 'space-between'
792
+ }
793
+ }, /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(ClimMax, null))), !horizontal && /*#__PURE__*/React.createElement(Flex, {
599
794
  sx: {
600
795
  flexDirection: 'column-reverse',
601
796
  justifyContent: 'space-between',
@@ -604,8 +799,6 @@ var Colorbar = function Colorbar(_ref4) {
604
799
  }, clim && /*#__PURE__*/React.createElement(ClimMin, null), clim && /*#__PURE__*/React.createElement(ClimMax, null)));
605
800
  };
606
801
 
607
- var _excluded$b = ["start", "width", "dl", "dr", "children", "sx"];
608
-
609
802
  var Column = function Column(_ref) {
610
803
  var start = _ref.start,
611
804
  width = _ref.width,
@@ -613,7 +806,7 @@ var Column = function Column(_ref) {
613
806
  dr = _ref.dr,
614
807
  children = _ref.children,
615
808
  sx = _ref.sx,
616
- props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
809
+ props = _objectWithoutPropertiesLoose(_ref, ["start", "width", "dl", "dr", "children", "sx"]);
617
810
 
618
811
  start = start || 'auto';
619
812
  width = width || 'auto';
@@ -820,14 +1013,12 @@ var Logo = function Logo(_ref) {
820
1013
  })));
821
1014
  };
822
1015
 
823
- var _excluded$a = ["children", "sx", "columns", "gap"];
824
-
825
1016
  var Row = function Row(_ref) {
826
1017
  var children = _ref.children,
827
1018
  sx = _ref.sx,
828
1019
  columns = _ref.columns,
829
1020
  gap = _ref.gap,
830
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
1021
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "sx", "columns", "gap"]);
831
1022
 
832
1023
  var makeArray = function makeArray(input) {
833
1024
  if (!Array.isArray(input)) {
@@ -879,12 +1070,10 @@ var Row = function Row(_ref) {
879
1070
  }), children);
880
1071
  };
881
1072
 
882
- var _excluded$9 = ["value", "sx"];
883
-
884
1073
  var Menu = function Menu(_ref) {
885
1074
  var value = _ref.value,
886
1075
  sx = _ref.sx,
887
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
1076
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
888
1077
 
889
1078
  return /*#__PURE__*/React.createElement(IconButton, _extends({
890
1079
  sx: _extends({
@@ -972,150 +1161,7 @@ var Menu = function Menu(_ref) {
972
1161
  })));
973
1162
  };
974
1163
 
975
- var _excluded$8 = ["value", "sx"];
976
-
977
- var Settings = function Settings(_ref) {
978
- var value = _ref.value,
979
- sx = _ref.sx,
980
- props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
981
-
982
- return /*#__PURE__*/React.createElement(IconButton, _extends({
983
- sx: _extends({
984
- cursor: 'pointer',
985
- fill: 'none',
986
- strokeWidth: '2px',
987
- stroke: 'text',
988
- '.paren': {
989
- opacity: '0'
990
- },
991
- '@media (hover: hover) and (pointer: fine)': {
992
- '&:hover .paren': {
993
- opacity: '1'
994
- }
995
- }
996
- }, sx),
997
- "aria-label": "Toggle Menu"
998
- }, props), !value && /*#__PURE__*/React.createElement("svg", {
999
- style: {
1000
- width: '50px',
1001
- height: '30px',
1002
- transform: 'scale(2)',
1003
- marginTop: '-3px'
1004
- },
1005
- xmlns: "http://www.w3.org/2000/svg",
1006
- viewBox: "0 0 68 36"
1007
- }, /*#__PURE__*/React.createElement("line", {
1008
- x1: "24",
1009
- y1: "2.1",
1010
- x2: "24",
1011
- y2: "6.1"
1012
- }), /*#__PURE__*/React.createElement("line", {
1013
- x1: "24",
1014
- y1: "24.1",
1015
- x2: "24",
1016
- y2: "33.9"
1017
- }), /*#__PURE__*/React.createElement("line", {
1018
- x1: "44",
1019
- y1: "2.1",
1020
- x2: "44",
1021
- y2: "12.1"
1022
- }), /*#__PURE__*/React.createElement("line", {
1023
- x1: "44",
1024
- y1: "30.1",
1025
- x2: "44",
1026
- y2: "33.9"
1027
- }), /*#__PURE__*/React.createElement("circle", {
1028
- cx: "24",
1029
- cy: "15.1",
1030
- r: "5"
1031
- }), /*#__PURE__*/React.createElement("circle", {
1032
- cx: "44",
1033
- cy: "21.1",
1034
- r: "5"
1035
- }), /*#__PURE__*/React.createElement("path", {
1036
- style: {
1037
- transition: 'all 0.2s'
1038
- },
1039
- className: "paren",
1040
- d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1041
- }), /*#__PURE__*/React.createElement("path", {
1042
- style: {
1043
- transition: 'all 0.2s'
1044
- },
1045
- className: "paren",
1046
- d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1047
- })), value && /*#__PURE__*/React.createElement("svg", {
1048
- style: {
1049
- width: '50px',
1050
- height: '30px',
1051
- transform: 'scale(2)',
1052
- marginTop: '-3px'
1053
- },
1054
- xmlns: "http://www.w3.org/2000/svg",
1055
- viewBox: "0 0 68 36"
1056
- }, /*#__PURE__*/React.createElement("line", {
1057
- x1: "50.85",
1058
- y1: "29.79",
1059
- x2: "17.15",
1060
- y2: "6.21"
1061
- }), /*#__PURE__*/React.createElement("line", {
1062
- x1: "17.15",
1063
- y1: "29.79",
1064
- x2: "50.85",
1065
- y2: "6.21"
1066
- }), /*#__PURE__*/React.createElement("path", {
1067
- style: {
1068
- transition: 'all 0.2s'
1069
- },
1070
- className: "paren",
1071
- d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1072
- }), /*#__PURE__*/React.createElement("path", {
1073
- style: {
1074
- transition: 'all 0.2s'
1075
- },
1076
- className: "paren",
1077
- d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1078
- })));
1079
- };
1080
-
1081
- var _excluded$7 = ["sx"];
1082
-
1083
- var Dimmer = function Dimmer(_ref) {
1084
- var sx = _ref.sx,
1085
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
1086
-
1087
- var _useColorMode = useColorMode(),
1088
- colorMode = _useColorMode[0],
1089
- setColorMode = _useColorMode[1];
1090
-
1091
- var toggle = useCallback(function () {
1092
- setColorMode(colorMode === 'light' ? 'dark' : 'light');
1093
- }, [colorMode]);
1094
- return /*#__PURE__*/React.createElement(IconButton, _extends({
1095
- "aria-label": "Toggle dark mode",
1096
- onClick: toggle,
1097
- role: "checkbox",
1098
- sx: _extends({
1099
- width: 32,
1100
- height: 32,
1101
- display: 'inline-block',
1102
- cursor: 'pointer',
1103
- color: 'secondary'
1104
- }, sx)
1105
- }, props), /*#__PURE__*/React.createElement(Sun, {
1106
- sx: {
1107
- strokeWidth: '1.75',
1108
- transition: 'stroke 0.15s',
1109
- '@media (hover: hover) and (pointer: fine)': {
1110
- '&:hover': {
1111
- stroke: 'primary'
1112
- }
1113
- }
1114
- }
1115
- }));
1116
- };
1117
-
1118
- var sx$1 = {
1164
+ var sx = {
1119
1165
  link: function link(current, label, first) {
1120
1166
  if (first === void 0) {
1121
1167
  first = false;
@@ -1194,16 +1240,16 @@ var Nav = function Nav(_ref) {
1194
1240
  return /*#__PURE__*/React.createElement(NextLink, {
1195
1241
  href: href,
1196
1242
  passHref: true
1197
- }, /*#__PURE__*/React.createElement(Link$1, {
1243
+ }, /*#__PURE__*/React.createElement(Link$2, {
1198
1244
  onClick: function onClick() {
1199
1245
  if (nav === url) setExpanded(false);
1200
1246
  },
1201
- sx: sx$1.link(nav, url, first)
1247
+ sx: sx.link(nav, url, first)
1202
1248
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display));
1203
1249
  } else {
1204
- return /*#__PURE__*/React.createElement(Link$1, {
1250
+ return /*#__PURE__*/React.createElement(Link$2, {
1205
1251
  href: href,
1206
- sx: sx$1.link(nav, url, first)
1252
+ sx: sx.link(nav, url, first)
1207
1253
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display);
1208
1254
  }
1209
1255
  };
@@ -1229,8 +1275,7 @@ var Header = function Header(_ref3) {
1229
1275
  var status = _ref3.status,
1230
1276
  mode = _ref3.mode,
1231
1277
  nav = _ref3.nav,
1232
- dimmer = _ref3.dimmer,
1233
- settings = _ref3.settings;
1278
+ menuItems = _ref3.menuItems;
1234
1279
 
1235
1280
  var _useState = useState(false),
1236
1281
  expanded = _useState[0],
@@ -1242,7 +1287,6 @@ var Header = function Header(_ref3) {
1242
1287
 
1243
1288
  return /*#__PURE__*/React.createElement(Row, {
1244
1289
  sx: {
1245
- width: '100%',
1246
1290
  pt: ['12px'],
1247
1291
  pb: [3]
1248
1292
  }
@@ -1257,7 +1301,7 @@ var Header = function Header(_ref3) {
1257
1301
  }, (mode == 'homepage' || mode == 'local') && /*#__PURE__*/React.createElement(NextLink, {
1258
1302
  href: "/",
1259
1303
  passHref: true
1260
- }, /*#__PURE__*/React.createElement(Link$1, {
1304
+ }, /*#__PURE__*/React.createElement(Link$2, {
1261
1305
  "aria-label": "CarbonPlan Homepage",
1262
1306
  sx: {
1263
1307
  display: 'block'
@@ -1268,7 +1312,7 @@ var Header = function Header(_ref3) {
1268
1312
  cursor: 'pointer',
1269
1313
  color: 'primary'
1270
1314
  }
1271
- }))), (mode == null || mode == 'remote') && /*#__PURE__*/React.createElement(Link$1, {
1315
+ }))), (mode == null || mode == 'remote') && /*#__PURE__*/React.createElement(Link$2, {
1272
1316
  href: "https://carbonplan.org",
1273
1317
  "aria-label": "CarbonPlan Homepage",
1274
1318
  sx: {
@@ -1294,53 +1338,31 @@ var Header = function Header(_ref3) {
1294
1338
  top: ['-2px', '-3px', '-3px']
1295
1339
  }
1296
1340
  }, status ? "(" + status + ")" : '')), /*#__PURE__*/React.createElement(Column, {
1297
- start: [status ? 6 : 4, 6, 12, 12],
1341
+ start: [status ? 6 : 4, 6, 11, 11],
1298
1342
  width: [status ? 1 : 3, 3, 2, 2],
1299
1343
  sx: {
1300
- display: 'flex',
1301
- alignItems: 'center',
1302
- justifyContent: 'flex-end'
1303
- }
1304
- }, /*#__PURE__*/React.createElement(Box, {
1305
- sx: {
1306
- mr: ['18px'],
1307
- position: 'relative',
1308
- top: ['-1px'],
1309
- pointerEvents: expanded || settings && settings.value ? 'none' : 'all',
1310
- transition: 'opacity 0.15s',
1311
- display: [status ? 'none' : 'block', 'block', dimmer === 'top' ? 'block' : 'none', dimmer === 'top' ? 'block' : 'none']
1312
- }
1313
- }, /*#__PURE__*/React.createElement(Dimmer, {
1314
- sx: {
1315
- opacity: expanded || settings && settings.value ? 0 : 1,
1316
- color: 'primary'
1344
+ zIndex: 5000
1317
1345
  }
1318
- })), settings && /*#__PURE__*/React.createElement(Box, {
1346
+ }, /*#__PURE__*/React.createElement(Flex, {
1319
1347
  sx: {
1320
- mr: ['21px'],
1321
- position: 'relative',
1322
- pointerEvents: expanded ? 'none' : 'all',
1323
- transition: 'opacity 0.15s',
1324
- display: [status ? 'none' : 'block', 'block', 'none', 'none']
1348
+ justifyContent: 'flex-end'
1325
1349
  }
1326
- }, /*#__PURE__*/React.createElement(Settings, {
1327
- value: settings.value,
1328
- onClick: settings.onClick,
1350
+ }, /*#__PURE__*/React.createElement(Flex, {
1329
1351
  sx: {
1352
+ mr: '18px',
1353
+ gap: '18px',
1330
1354
  opacity: expanded ? 0 : 1,
1331
- stroke: 'primary'
1355
+ transition: 'opacity 0.15s',
1356
+ justifyContent: 'space-between',
1357
+ alignItems: 'center'
1332
1358
  }
1333
- })), /*#__PURE__*/React.createElement(Menu, {
1359
+ }, menuItems), /*#__PURE__*/React.createElement(Menu, {
1334
1360
  sx: {
1335
- transition: 'opacity 0.15s',
1336
- pointerEvents: settings && settings.value ? 'none' : 'all',
1337
- opacity: settings && settings.value ? 0 : 1,
1338
- mr: ['-2px'],
1339
- zIndex: 5000
1361
+ mr: ['-2px']
1340
1362
  },
1341
1363
  value: expanded,
1342
1364
  onClick: toggle
1343
- })), /*#__PURE__*/React.createElement(Box, {
1365
+ }))), /*#__PURE__*/React.createElement(Box, {
1344
1366
  sx: {
1345
1367
  opacity: expanded ? 1 : 0,
1346
1368
  pointerEvents: expanded ? 'all' : 'none',
@@ -1412,7 +1434,7 @@ var Footer = function Footer() {
1412
1434
  letterSpacing: 'mono',
1413
1435
  mb: [2]
1414
1436
  }
1415
- }, "EMAIL"), /*#__PURE__*/React.createElement(Link$1, {
1437
+ }, "EMAIL"), /*#__PURE__*/React.createElement(Link$2, {
1416
1438
  href: "mailto:hello@carbonplan.org",
1417
1439
  sx: {
1418
1440
  textDecoration: 'none',
@@ -1446,7 +1468,7 @@ var Footer = function Footer() {
1446
1468
  letterSpacing: 'mono',
1447
1469
  mb: [2]
1448
1470
  }
1449
- }, "FOLLOW"), /*#__PURE__*/React.createElement(Link$1, {
1471
+ }, "FOLLOW"), /*#__PURE__*/React.createElement(Link$2, {
1450
1472
  href: "https://twitter.com/carbonplanorg",
1451
1473
  sx: {
1452
1474
  textDecoration: 'none',
@@ -1540,6 +1562,41 @@ var Footer = function Footer() {
1540
1562
  }))));
1541
1563
  };
1542
1564
 
1565
+ var Dimmer = function Dimmer(_ref) {
1566
+ var sx = _ref.sx,
1567
+ props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
1568
+
1569
+ var _useColorMode = useColorMode(),
1570
+ colorMode = _useColorMode[0],
1571
+ setColorMode = _useColorMode[1];
1572
+
1573
+ var toggle = useCallback(function () {
1574
+ setColorMode(colorMode === 'light' ? 'dark' : 'light');
1575
+ }, [colorMode]);
1576
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1577
+ "aria-label": "Toggle dark mode",
1578
+ onClick: toggle,
1579
+ role: "checkbox",
1580
+ sx: _extends({
1581
+ width: 32,
1582
+ height: 32,
1583
+ display: 'inline-block',
1584
+ cursor: 'pointer',
1585
+ color: 'secondary'
1586
+ }, sx)
1587
+ }, props), /*#__PURE__*/React.createElement(Sun, {
1588
+ sx: {
1589
+ strokeWidth: '1.75',
1590
+ transition: 'stroke 0.15s',
1591
+ '@media (hover: hover) and (pointer: fine)': {
1592
+ '&:hover': {
1593
+ stroke: 'primary'
1594
+ }
1595
+ }
1596
+ }
1597
+ }));
1598
+ };
1599
+
1543
1600
  var GitSha = function GitSha() {
1544
1601
  var sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
1545
1602
  var owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
@@ -1559,7 +1616,7 @@ var GitSha = function GitSha() {
1559
1616
  }
1560
1617
  }, /*#__PURE__*/React.createElement(Separator, {
1561
1618
  color: color
1562
- }), /*#__PURE__*/React.createElement(Link$1, {
1619
+ }), /*#__PURE__*/React.createElement(Link$2, {
1563
1620
  href: href,
1564
1621
  sx: {
1565
1622
  whiteSpace: 'nowrap',
@@ -1693,7 +1750,6 @@ function scrollFraction(window, documnt) {
1693
1750
  return Math.min(window.scrollY / (document.body.offsetHeight - 770), 0.99);
1694
1751
  }
1695
1752
 
1696
- var _excluded$6 = ["duration", "delay", "children"];
1697
1753
  var fade = keyframes({
1698
1754
  from: {
1699
1755
  opacity: 0
@@ -1709,7 +1765,7 @@ var FadeIn = function FadeIn(_ref) {
1709
1765
  _ref$delay = _ref.delay,
1710
1766
  delay = _ref$delay === void 0 ? 0 : _ref$delay,
1711
1767
  children = _ref.children,
1712
- delegated = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1768
+ delegated = _objectWithoutPropertiesLoose(_ref, ["duration", "delay", "children"]);
1713
1769
 
1714
1770
  return /*#__PURE__*/React.createElement(Box, _extends({}, delegated, {
1715
1771
  sx: {
@@ -1852,6 +1908,110 @@ function GuideColumns(_ref2) {
1852
1908
  }));
1853
1909
  }
1854
1910
 
1911
+ var Settings = function Settings(_ref) {
1912
+ var value = _ref.value,
1913
+ sx = _ref.sx,
1914
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
1915
+
1916
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1917
+ sx: _extends({
1918
+ cursor: 'pointer',
1919
+ fill: 'none',
1920
+ strokeWidth: '2px',
1921
+ stroke: 'text',
1922
+ '.paren': {
1923
+ opacity: '0'
1924
+ },
1925
+ '@media (hover: hover) and (pointer: fine)': {
1926
+ '&:hover .paren': {
1927
+ opacity: '1'
1928
+ }
1929
+ }
1930
+ }, sx),
1931
+ "aria-label": "Toggle Menu"
1932
+ }, props), !value && /*#__PURE__*/React.createElement("svg", {
1933
+ style: {
1934
+ width: '50px',
1935
+ height: '30px',
1936
+ transform: 'scale(2)',
1937
+ marginTop: '-3px'
1938
+ },
1939
+ xmlns: "http://www.w3.org/2000/svg",
1940
+ viewBox: "0 0 68 36"
1941
+ }, /*#__PURE__*/React.createElement("line", {
1942
+ x1: "24",
1943
+ y1: "2.1",
1944
+ x2: "24",
1945
+ y2: "6.1"
1946
+ }), /*#__PURE__*/React.createElement("line", {
1947
+ x1: "24",
1948
+ y1: "24.1",
1949
+ x2: "24",
1950
+ y2: "33.9"
1951
+ }), /*#__PURE__*/React.createElement("line", {
1952
+ x1: "44",
1953
+ y1: "2.1",
1954
+ x2: "44",
1955
+ y2: "12.1"
1956
+ }), /*#__PURE__*/React.createElement("line", {
1957
+ x1: "44",
1958
+ y1: "30.1",
1959
+ x2: "44",
1960
+ y2: "33.9"
1961
+ }), /*#__PURE__*/React.createElement("circle", {
1962
+ cx: "24",
1963
+ cy: "15.1",
1964
+ r: "5"
1965
+ }), /*#__PURE__*/React.createElement("circle", {
1966
+ cx: "44",
1967
+ cy: "21.1",
1968
+ r: "5"
1969
+ }), /*#__PURE__*/React.createElement("path", {
1970
+ style: {
1971
+ transition: 'all 0.2s'
1972
+ },
1973
+ className: "paren",
1974
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1975
+ }), /*#__PURE__*/React.createElement("path", {
1976
+ style: {
1977
+ transition: 'all 0.2s'
1978
+ },
1979
+ className: "paren",
1980
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1981
+ })), value && /*#__PURE__*/React.createElement("svg", {
1982
+ style: {
1983
+ width: '50px',
1984
+ height: '30px',
1985
+ transform: 'scale(2)',
1986
+ marginTop: '-3px'
1987
+ },
1988
+ xmlns: "http://www.w3.org/2000/svg",
1989
+ viewBox: "0 0 68 36"
1990
+ }, /*#__PURE__*/React.createElement("line", {
1991
+ x1: "50.85",
1992
+ y1: "29.79",
1993
+ x2: "17.15",
1994
+ y2: "6.21"
1995
+ }), /*#__PURE__*/React.createElement("line", {
1996
+ x1: "17.15",
1997
+ y1: "29.79",
1998
+ x2: "50.85",
1999
+ y2: "6.21"
2000
+ }), /*#__PURE__*/React.createElement("path", {
2001
+ style: {
2002
+ transition: 'all 0.2s'
2003
+ },
2004
+ className: "paren",
2005
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
2006
+ }), /*#__PURE__*/React.createElement("path", {
2007
+ style: {
2008
+ transition: 'all 0.2s'
2009
+ },
2010
+ className: "paren",
2011
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
2012
+ })));
2013
+ };
2014
+
1855
2015
  var Layout = function Layout(_ref) {
1856
2016
  var title = _ref.title,
1857
2017
  description = _ref.description,
@@ -1879,6 +2039,7 @@ var Layout = function Layout(_ref) {
1879
2039
  _ref$container = _ref.container,
1880
2040
  container = _ref$container === void 0 ? true : _ref$container;
1881
2041
  var content = children;
2042
+ var index = useBreakpointIndex();
1882
2043
 
1883
2044
  if (fade) {
1884
2045
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -1887,7 +2048,34 @@ var Layout = function Layout(_ref) {
1887
2048
  }
1888
2049
 
1889
2050
  if (container) {
1890
- content = /*#__PURE__*/React.createElement(Container, null, content);
2051
+ content = /*#__PURE__*/React.createElement(Box, {
2052
+ sx: {
2053
+ mb: [8, 8, 9, 10]
2054
+ }
2055
+ }, /*#__PURE__*/React.createElement(Container, null, content));
2056
+ }
2057
+
2058
+ useEffect(function () {
2059
+ if (index > 2 && settings != null && settings.value && settings != null && settings.onClick) {
2060
+ settings == null ? void 0 : settings.onClick();
2061
+ }
2062
+ }, [index, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2063
+ var menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2064
+ key: "dimmer",
2065
+ sx: {
2066
+ color: 'primary',
2067
+ mt: '-2px',
2068
+ display: ['block', 'block', dimmer === 'top' ? 'block' : 'none', dimmer === 'top' ? 'block' : 'none']
2069
+ }
2070
+ })];
2071
+
2072
+ if (settings) {
2073
+ menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2074
+ key: "settings",
2075
+ sx: {
2076
+ display: ['inherit', 'inherit', 'none', 'none']
2077
+ }
2078
+ }, settings)));
1891
2079
  }
1892
2080
 
1893
2081
  return /*#__PURE__*/React.createElement(React.Fragment, null, guide && /*#__PURE__*/React.createElement(Guide, {
@@ -1919,8 +2107,7 @@ var Layout = function Layout(_ref) {
1919
2107
  mode: links,
1920
2108
  status: status,
1921
2109
  nav: nav,
1922
- settings: settings,
1923
- dimmer: dimmer
2110
+ menuItems: menuItems
1924
2111
  }))), /*#__PURE__*/React.createElement(Box, {
1925
2112
  sx: {
1926
2113
  width: '100%',
@@ -2031,14 +2218,12 @@ var Expander = function Expander(_ref) {
2031
2218
  })));
2032
2219
  };
2033
2220
 
2034
- var _excluded$5 = ["label", "value", "sx", "children"];
2035
-
2036
2221
  var Tag = function Tag(_ref) {
2037
2222
  var label = _ref.label,
2038
2223
  value = _ref.value,
2039
2224
  sx = _ref.sx,
2040
2225
  children = _ref.children,
2041
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2226
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "value", "sx", "children"]);
2042
2227
 
2043
2228
  var color = sx && sx.color ? sx.color : 'primary';
2044
2229
  var isClickable = props && (props.onClick || props.onDoubleClick);
@@ -2072,8 +2257,7 @@ var Tag = function Tag(_ref) {
2072
2257
  }, props), children);
2073
2258
  };
2074
2259
 
2075
- var _excluded$4 = ["values", "setValues", "label", "colors", "showAll", "multiSelect"];
2076
- var sx = {
2260
+ var sx$1 = {
2077
2261
  label: {
2078
2262
  fontFamily: 'mono',
2079
2263
  letterSpacing: 'mono',
@@ -2150,10 +2334,10 @@ var Filter = function Filter(_ref2) {
2150
2334
  showAll = _ref2$showAll === void 0 ? false : _ref2$showAll,
2151
2335
  _ref2$multiSelect = _ref2.multiSelect,
2152
2336
  multiSelect = _ref2$multiSelect === void 0 ? false : _ref2$multiSelect,
2153
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$4);
2337
+ props = _objectWithoutPropertiesLoose(_ref2, ["values", "setValues", "label", "colors", "showAll", "multiSelect"]);
2154
2338
 
2155
2339
  return /*#__PURE__*/React.createElement(Box, props, label && /*#__PURE__*/React.createElement(Box, {
2156
- sx: sx.label
2340
+ sx: sx$1.label
2157
2341
  }, label), /*#__PURE__*/React.createElement(Box, {
2158
2342
  sx: {
2159
2343
  mt: label ? [3] : 0
@@ -2248,16 +2432,14 @@ var Group = function Group(_ref) {
2248
2432
  }));
2249
2433
  };
2250
2434
 
2251
- var _excluded$3 = ["size", "inverted", "sx"];
2252
-
2253
- var Input = function Input(_ref) {
2435
+ var Input = function Input(_ref, ref) {
2254
2436
  var _extends2;
2255
2437
 
2256
2438
  var _ref$size = _ref.size,
2257
2439
  size = _ref$size === void 0 ? 'sm' : _ref$size,
2258
2440
  inverted = _ref.inverted,
2259
2441
  sx = _ref.sx,
2260
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
2442
+ props = _objectWithoutPropertiesLoose(_ref, ["size", "inverted", "sx"]);
2261
2443
 
2262
2444
  var defaultColor = inverted ? 'secondary' : 'primary';
2263
2445
 
@@ -2283,10 +2465,13 @@ var Input = function Input(_ref) {
2283
2465
  }, _extends2), getSizeStyles(size), sx);
2284
2466
 
2285
2467
  return /*#__PURE__*/React.createElement(Input$1, _extends({}, props, {
2468
+ ref: ref,
2286
2469
  sx: styles
2287
2470
  }));
2288
2471
  };
2289
2472
 
2473
+ var input = forwardRef(Input);
2474
+
2290
2475
  var getProps = function getProps(test) {
2291
2476
  return function (props) {
2292
2477
  var next = {};
@@ -2299,8 +2484,6 @@ var getProps = function getProps(test) {
2299
2484
  };
2300
2485
  };
2301
2486
 
2302
- var _excluded$2 = ["children", "size", "sx"];
2303
-
2304
2487
  var Select = function Select(_ref) {
2305
2488
  var _extends2;
2306
2489
 
@@ -2308,7 +2491,8 @@ var Select = function Select(_ref) {
2308
2491
  _ref$size = _ref.size,
2309
2492
  size = _ref$size === void 0 ? 'sm' : _ref$size,
2310
2493
  sx = _ref.sx,
2311
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2494
+ sxSelect = _ref.sxSelect,
2495
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "size", "sx", "sxSelect"]);
2312
2496
 
2313
2497
  var color = sx && sx.color ? sx.color : 'primary';
2314
2498
  var sizeStyles = getSizeStyles(size);
@@ -2379,7 +2563,7 @@ var Select = function Select(_ref) {
2379
2563
  outline: 'none !important',
2380
2564
  background: 'transparent !important'
2381
2565
  }
2382
- }, _extends2))
2566
+ }, _extends2), sxSelect)
2383
2567
  }, omitOnChange), children), /*#__PURE__*/React.createElement(Arrow, {
2384
2568
  sx: {
2385
2569
  width: width,
@@ -2394,11 +2578,9 @@ var Select = function Select(_ref) {
2394
2578
  }));
2395
2579
  };
2396
2580
 
2397
- var _excluded$1 = ["sx"];
2398
-
2399
- var Slider = function Slider(_ref) {
2581
+ var Slider = function Slider(_ref, ref) {
2400
2582
  var sx = _ref.sx,
2401
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2583
+ props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
2402
2584
 
2403
2585
  var color = sx && sx.color ? sx.color : 'primary';
2404
2586
 
@@ -2406,6 +2588,7 @@ var Slider = function Slider(_ref) {
2406
2588
  colors = _useThemeUI.theme.rawColors;
2407
2589
 
2408
2590
  return /*#__PURE__*/React.createElement(Slider$1, _extends({
2591
+ ref: ref,
2409
2592
  sx: _extends({
2410
2593
  '&::-webkit-slider-thumb': {
2411
2594
  height: [22, 18, 16],
@@ -2437,7 +2620,9 @@ var Slider = function Slider(_ref) {
2437
2620
  }, props));
2438
2621
  };
2439
2622
 
2440
- var styles = {
2623
+ var slider = forwardRef(Slider);
2624
+
2625
+ var styles$1 = {
2441
2626
  reset: {
2442
2627
  verticalAlign: 'baseline',
2443
2628
  border: 0,
@@ -2509,7 +2694,7 @@ var Table = function Table(_ref) {
2509
2694
  }
2510
2695
  }, header && /*#__PURE__*/React.createElement(Row, {
2511
2696
  as: "tr",
2512
- sx: _extends({}, styles.reset, styles.header, styles.row, {
2697
+ sx: _extends({}, styles$1.reset, styles$1.header, styles$1.row, {
2513
2698
  color: color,
2514
2699
  borderTopWidth: !borderTop ? '0px' : '1px'
2515
2700
  })
@@ -2517,13 +2702,13 @@ var Table = function Table(_ref) {
2517
2702
  as: "td",
2518
2703
  start: [1],
2519
2704
  width: columns,
2520
- sx: styles.index
2705
+ sx: styles$1.index
2521
2706
  }, header)), data.map(function (row, i) {
2522
2707
  return /*#__PURE__*/React.createElement(Row, {
2523
2708
  as: "tr",
2524
2709
  columns: columns,
2525
2710
  key: i,
2526
- sx: _extends({}, styles.reset, styles.row, {
2711
+ sx: _extends({}, styles$1.reset, styles$1.row, {
2527
2712
  pb: borderBottom && i === data.length - 1 ? ['18px', '18px', '18px', '22px'] : [3, 3, 3, '20px'],
2528
2713
  borderBottomWidth: borderBottom && i === data.length - 1 ? '1px' : '0px',
2529
2714
  borderTopWidth: !borderTop && i === 0 && !header ? '0px' : '1px'
@@ -2534,24 +2719,23 @@ var Table = function Table(_ref) {
2534
2719
  key: j,
2535
2720
  start: start[j],
2536
2721
  width: width[j],
2537
- sx: j == 0 && index ? _extends({}, styles.reset, styles.index) : _extends({}, styles.reset, styles.entry)
2722
+ sx: j == 0 && index ? _extends({}, styles$1.reset, styles$1.index) : _extends({}, styles$1.reset, styles$1.entry)
2538
2723
  }, column);
2539
2724
  }));
2540
2725
  })));
2541
2726
  };
2542
2727
 
2543
- var _excluded = ["value", "onClick", "disabled", "sx"];
2544
-
2545
- var Toggle = function Toggle(_ref) {
2728
+ var Toggle = function Toggle(_ref, ref) {
2546
2729
  var value = _ref.value,
2547
2730
  onClick = _ref.onClick,
2548
2731
  disabled = _ref.disabled,
2549
2732
  sx = _ref.sx,
2550
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
2733
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "onClick", "disabled", "sx"]);
2551
2734
 
2552
2735
  var color = sx && sx.color ? sx.color : 'primary';
2553
2736
  value = disabled ? false : value;
2554
2737
  return /*#__PURE__*/React.createElement(Box, _extends({
2738
+ ref: ref,
2555
2739
  as: "button",
2556
2740
  onClick: onClick,
2557
2741
  role: "checkbox",
@@ -2589,6 +2773,8 @@ var Toggle = function Toggle(_ref) {
2589
2773
  })));
2590
2774
  };
2591
2775
 
2776
+ var toggle = forwardRef(Toggle);
2777
+
2592
2778
  var Tracking = function Tracking(_ref) {
2593
2779
  var id = _ref.id;
2594
2780
 
@@ -2612,7 +2798,6 @@ var Tray = function Tray(_ref) {
2612
2798
  children = _ref.children;
2613
2799
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
2614
2800
  sx: {
2615
- display: ['initial', 'initial', 'none', 'none'],
2616
2801
  position: 'fixed',
2617
2802
  top: '56px',
2618
2803
  bottom: '0px',
@@ -2627,7 +2812,6 @@ var Tray = function Tray(_ref) {
2627
2812
  }
2628
2813
  }), /*#__PURE__*/React.createElement(Box, {
2629
2814
  sx: _extends({
2630
- display: ['initial', 'initial', 'none', 'none'],
2631
2815
  position: 'fixed',
2632
2816
  width: 'calc(100vw)',
2633
2817
  top: '0px',
@@ -2687,5 +2871,5 @@ var formatDate = function formatDate(date, options) {
2687
2871
  return [month, day, year].filter(Boolean).join(' ');
2688
2872
  };
2689
2873
 
2690
- 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 };
2874
+ 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 };
2691
2875
  //# sourceMappingURL=index.esm.js.map