@carbonplan/components 11.0.0-alpha.0 → 11.0.3

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, { forwardRef, cloneElement, useCallback, useState, useEffect, useRef } from 'react';
2
- import { Box, Link as Link$2, 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,
@@ -99,7 +96,7 @@ const Link = (_ref, ref) => {
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, {
@@ -194,8 +191,6 @@ const getSizeStyles = size => {
194
191
  };
195
192
  };
196
193
 
197
- const _excluded$e = ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"];
198
-
199
194
  const Button = (_ref, ref) => {
200
195
  let {
201
196
  size = 'sm',
@@ -209,7 +204,7 @@ const Button = (_ref, ref) => {
209
204
  internal,
210
205
  tracking
211
206
  } = _ref,
212
- props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
207
+ props = _objectWithoutPropertiesLoose(_ref, ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"]);
213
208
 
214
209
  if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
215
210
  throw new Error('Size must be xs, sm, md, lg, or xl');
@@ -387,8 +382,6 @@ const Button = (_ref, ref) => {
387
382
 
388
383
  var button = forwardRef(Button);
389
384
 
390
- const _excluded$d = ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"];
391
-
392
385
  const Callout = (_ref, ref) => {
393
386
  let {
394
387
  label,
@@ -400,7 +393,7 @@ const Callout = (_ref, ref) => {
400
393
  tracking,
401
394
  sx
402
395
  } = _ref,
403
- props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
396
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"]);
404
397
 
405
398
  const baseColor = color || (inverted ? 'secondary' : 'primary');
406
399
  const hoverColor = color ? 'primary' : inverted ? 'primary' : 'secondary';
@@ -483,13 +476,31 @@ const Callout = (_ref, ref) => {
483
476
 
484
477
  var callout = forwardRef(Callout);
485
478
 
486
- const _excluded$c = ["colormap", "label", "clim", "discrete", "units", "width", "height", "format", "horizontal"];
487
- const sx$2 = {
488
- clim: {
489
- fontFamily: 'mono',
490
- fontSize: ['9px', 0, 0, 1],
491
- letterSpacing: 'smallcaps',
492
- textTransform: 'uppercase'
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
+ };
493
504
  }
494
505
  };
495
506
  const DIMENSIONS = {
@@ -517,7 +528,7 @@ const Gradient = ({
517
528
  width: width || DIMENSIONS.width,
518
529
  minHeight: height || DIMENSIONS.height
519
530
  }, {
520
- mt: horizontal ? [0, '1px', '1px', 0] : 0,
531
+ mt: horizontal ? ['1px', '1px', '1px', 0] : 0,
521
532
  border: ({
522
533
  colors
523
534
  }) => `solid 1px ${colors.hinted}`,
@@ -532,6 +543,7 @@ const Label = ({
532
543
  horizontal
533
544
  }) => /*#__PURE__*/React.createElement(Box, {
534
545
  sx: !horizontal && {
546
+ width: ['13px', '17px', '17px', '19px'],
535
547
  alignSelf: 'flex-end'
536
548
  }
537
549
  }, /*#__PURE__*/React.createElement(Box, {
@@ -557,61 +569,195 @@ const Label = ({
557
569
  }
558
570
  }, units)));
559
571
 
560
- const Colorbar = _ref => {
572
+ const Colorbar = (_ref) => {
561
573
  let {
562
574
  colormap,
563
575
  label,
564
576
  clim,
577
+ setClim,
578
+ setClimStep = 1,
565
579
  discrete,
566
580
  units,
567
581
  width,
568
582
  height,
569
583
  format = d => d,
570
- horizontal = false
584
+ horizontal = false,
585
+ bottom = false,
586
+ sx,
587
+ sxClim
571
588
  } = _ref,
572
- props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
589
+ props = _objectWithoutPropertiesLoose(_ref, ["colormap", "label", "clim", "setClim", "setClimStep", "discrete", "units", "width", "height", "format", "horizontal", "bottom", "sx", "sxClim"]);
573
590
 
574
591
  if (!Array.isArray(colormap)) {
575
592
  throw new Error(`expected array for colormap, got '${colormap}'.`);
576
593
  }
577
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
+
578
685
  const ClimMin = () => {
579
686
  return /*#__PURE__*/React.createElement(Box, {
580
- sx: _extends({}, sx$2.clim, {
581
- 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,
582
692
  mr: horizontal ? ['2px', '1px', '1px', '2px'] : 0,
583
- mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px']
584
- })
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()
585
703
  }, format(clim[0]));
586
704
  };
587
705
 
588
706
  const ClimMax = () => {
589
707
  return /*#__PURE__*/React.createElement(Box, {
590
- sx: _extends({}, sx$2.clim, {
591
- ml: horizontal ? ['2px', '1px', '1px', '2px'] : '2px',
592
- mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px']
593
- })
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()
594
723
  }, format(clim[1]));
595
724
  };
596
725
 
597
- return /*#__PURE__*/React.createElement(Flex, {
598
- sx: _extends({}, props.sx, {
726
+ return /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
727
+ sx: _extends({
599
728
  flexDirection: 'row',
600
- alignItems: 'center',
729
+ alignItems: 'start',
601
730
  justifyContent: 'flex-start',
602
- gap: ['3px', '6px', '6px', '7px']
603
- })
604
- }, label && /*#__PURE__*/React.createElement(Label, {
731
+ gap: ['3px', '6px', '6px', '7px'],
732
+ height: !horizontal ? '100%' : 'unset'
733
+ }, sx)
734
+ }), label && /*#__PURE__*/React.createElement(Label, {
605
735
  label: label,
606
736
  units: units,
607
737
  horizontal: horizontal
608
- }), 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, {
609
751
  colormap: colormap,
610
752
  horizontal: horizontal,
611
753
  discrete: discrete,
612
754
  width: width,
613
755
  height: height
614
- }), 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, {
615
761
  sx: {
616
762
  flexDirection: 'column-reverse',
617
763
  justifyContent: 'space-between',
@@ -620,9 +766,7 @@ const Colorbar = _ref => {
620
766
  }, clim && /*#__PURE__*/React.createElement(ClimMin, null), clim && /*#__PURE__*/React.createElement(ClimMax, null)));
621
767
  };
622
768
 
623
- const _excluded$b = ["start", "width", "dl", "dr", "children", "sx"];
624
-
625
- const Column = _ref => {
769
+ const Column = (_ref) => {
626
770
  let {
627
771
  start,
628
772
  width,
@@ -631,7 +775,7 @@ const Column = _ref => {
631
775
  children,
632
776
  sx
633
777
  } = _ref,
634
- props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
778
+ props = _objectWithoutPropertiesLoose(_ref, ["start", "width", "dl", "dr", "children", "sx"]);
635
779
 
636
780
  start = start || 'auto';
637
781
  width = width || 'auto';
@@ -799,7 +943,7 @@ const Meta = ({
799
943
  }));
800
944
  };
801
945
 
802
- const Logo = _ref => {
946
+ const Logo = (_ref) => {
803
947
  let props = _extends({}, _ref);
804
948
 
805
949
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -835,16 +979,14 @@ const Logo = _ref => {
835
979
  })));
836
980
  };
837
981
 
838
- const _excluded$a = ["children", "sx", "columns", "gap"];
839
-
840
- const Row = _ref => {
982
+ const Row = (_ref) => {
841
983
  let {
842
984
  children,
843
985
  sx,
844
986
  columns,
845
987
  gap
846
988
  } = _ref,
847
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
989
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "sx", "columns", "gap"]);
848
990
 
849
991
  const makeArray = input => {
850
992
  if (!Array.isArray(input)) {
@@ -892,14 +1034,12 @@ const Row = _ref => {
892
1034
  }), children);
893
1035
  };
894
1036
 
895
- const _excluded$9 = ["value", "sx"];
896
-
897
- const Menu = _ref => {
1037
+ const Menu = (_ref) => {
898
1038
  let {
899
1039
  value,
900
1040
  sx
901
1041
  } = _ref,
902
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
1042
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
903
1043
 
904
1044
  return /*#__PURE__*/React.createElement(IconButton, _extends({
905
1045
  sx: _extends({
@@ -987,151 +1127,7 @@ const Menu = _ref => {
987
1127
  })));
988
1128
  };
989
1129
 
990
- const _excluded$8 = ["value", "sx"];
991
-
992
- const Settings = _ref => {
993
- let {
994
- value,
995
- sx
996
- } = _ref,
997
- props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
998
-
999
- return /*#__PURE__*/React.createElement(IconButton, _extends({
1000
- sx: _extends({
1001
- cursor: 'pointer',
1002
- fill: 'none',
1003
- strokeWidth: '2px',
1004
- stroke: 'text',
1005
- '.paren': {
1006
- opacity: '0'
1007
- },
1008
- '@media (hover: hover) and (pointer: fine)': {
1009
- '&:hover .paren': {
1010
- opacity: '1'
1011
- }
1012
- }
1013
- }, sx),
1014
- "aria-label": "Toggle Menu"
1015
- }, props), !value && /*#__PURE__*/React.createElement("svg", {
1016
- style: {
1017
- width: '50px',
1018
- height: '30px',
1019
- transform: 'scale(2)',
1020
- marginTop: '-3px'
1021
- },
1022
- xmlns: "http://www.w3.org/2000/svg",
1023
- viewBox: "0 0 68 36"
1024
- }, /*#__PURE__*/React.createElement("line", {
1025
- x1: "24",
1026
- y1: "2.1",
1027
- x2: "24",
1028
- y2: "6.1"
1029
- }), /*#__PURE__*/React.createElement("line", {
1030
- x1: "24",
1031
- y1: "24.1",
1032
- x2: "24",
1033
- y2: "33.9"
1034
- }), /*#__PURE__*/React.createElement("line", {
1035
- x1: "44",
1036
- y1: "2.1",
1037
- x2: "44",
1038
- y2: "12.1"
1039
- }), /*#__PURE__*/React.createElement("line", {
1040
- x1: "44",
1041
- y1: "30.1",
1042
- x2: "44",
1043
- y2: "33.9"
1044
- }), /*#__PURE__*/React.createElement("circle", {
1045
- cx: "24",
1046
- cy: "15.1",
1047
- r: "5"
1048
- }), /*#__PURE__*/React.createElement("circle", {
1049
- cx: "44",
1050
- cy: "21.1",
1051
- r: "5"
1052
- }), /*#__PURE__*/React.createElement("path", {
1053
- style: {
1054
- transition: 'all 0.2s'
1055
- },
1056
- className: "paren",
1057
- d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1058
- }), /*#__PURE__*/React.createElement("path", {
1059
- style: {
1060
- transition: 'all 0.2s'
1061
- },
1062
- className: "paren",
1063
- d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1064
- })), value && /*#__PURE__*/React.createElement("svg", {
1065
- style: {
1066
- width: '50px',
1067
- height: '30px',
1068
- transform: 'scale(2)',
1069
- marginTop: '-3px'
1070
- },
1071
- xmlns: "http://www.w3.org/2000/svg",
1072
- viewBox: "0 0 68 36"
1073
- }, /*#__PURE__*/React.createElement("line", {
1074
- x1: "50.85",
1075
- y1: "29.79",
1076
- x2: "17.15",
1077
- y2: "6.21"
1078
- }), /*#__PURE__*/React.createElement("line", {
1079
- x1: "17.15",
1080
- y1: "29.79",
1081
- x2: "50.85",
1082
- y2: "6.21"
1083
- }), /*#__PURE__*/React.createElement("path", {
1084
- style: {
1085
- transition: 'all 0.2s'
1086
- },
1087
- className: "paren",
1088
- d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1089
- }), /*#__PURE__*/React.createElement("path", {
1090
- style: {
1091
- transition: 'all 0.2s'
1092
- },
1093
- className: "paren",
1094
- d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1095
- })));
1096
- };
1097
-
1098
- const _excluded$7 = ["sx"];
1099
-
1100
- const Dimmer = _ref => {
1101
- let {
1102
- sx
1103
- } = _ref,
1104
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
1105
-
1106
- const [colorMode, setColorMode] = useColorMode();
1107
- const toggle = useCallback(() => {
1108
- setColorMode(colorMode === 'light' ? 'dark' : 'light');
1109
- }, [colorMode]);
1110
- return /*#__PURE__*/React.createElement(IconButton, _extends({
1111
- "aria-label": "Toggle dark mode",
1112
- onClick: toggle,
1113
- role: "checkbox",
1114
- sx: _extends({
1115
- width: 32,
1116
- height: 32,
1117
- display: 'inline-block',
1118
- cursor: 'pointer',
1119
- color: 'secondary'
1120
- }, sx)
1121
- }, props), /*#__PURE__*/React.createElement(Sun, {
1122
- sx: {
1123
- strokeWidth: '1.75',
1124
- transition: 'stroke 0.15s',
1125
- '@media (hover: hover) and (pointer: fine)': {
1126
- '&:hover': {
1127
- stroke: 'primary'
1128
- }
1129
- }
1130
- }
1131
- }));
1132
- };
1133
-
1134
- const sx$1 = {
1130
+ const sx = {
1135
1131
  link: (current, label, first = false) => {
1136
1132
  return {
1137
1133
  width: 'auto',
@@ -1197,7 +1193,6 @@ const Nav = ({
1197
1193
  mode,
1198
1194
  nav,
1199
1195
  first,
1200
- dimmer,
1201
1196
  setExpanded
1202
1197
  }) => {
1203
1198
  const {
@@ -1214,12 +1209,12 @@ const Nav = ({
1214
1209
  onClick: () => {
1215
1210
  if (nav === url) setExpanded(false);
1216
1211
  },
1217
- sx: sx$1.link(nav, url, first)
1212
+ sx: sx.link(nav, url, first)
1218
1213
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display));
1219
1214
  } else {
1220
1215
  return /*#__PURE__*/React.createElement(Link$2, {
1221
1216
  href: href,
1222
- sx: sx$1.link(nav, url, first)
1217
+ sx: sx.link(nav, url, first)
1223
1218
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display);
1224
1219
  }
1225
1220
  };
@@ -1246,8 +1241,7 @@ const Header = ({
1246
1241
  status,
1247
1242
  mode,
1248
1243
  nav,
1249
- dimmer,
1250
- settings
1244
+ menuItems
1251
1245
  }) => {
1252
1246
  const [expanded, setExpanded] = useState(false);
1253
1247
 
@@ -1257,7 +1251,6 @@ const Header = ({
1257
1251
 
1258
1252
  return /*#__PURE__*/React.createElement(Row, {
1259
1253
  sx: {
1260
- width: '100%',
1261
1254
  pt: ['12px'],
1262
1255
  pb: [3]
1263
1256
  }
@@ -1309,53 +1302,31 @@ const Header = ({
1309
1302
  top: ['-2px', '-3px', '-3px']
1310
1303
  }
1311
1304
  }, status ? `(${status})` : '')), /*#__PURE__*/React.createElement(Column, {
1312
- start: [status ? 6 : 4, 6, 12, 12],
1305
+ start: [status ? 6 : 4, 6, 11, 11],
1313
1306
  width: [status ? 1 : 3, 3, 2, 2],
1314
1307
  sx: {
1315
- display: 'flex',
1316
- alignItems: 'center',
1317
- justifyContent: 'flex-end'
1318
- }
1319
- }, /*#__PURE__*/React.createElement(Box, {
1320
- sx: {
1321
- mr: ['18px'],
1322
- position: 'relative',
1323
- top: ['-1px'],
1324
- pointerEvents: expanded || settings && settings.value ? 'none' : 'all',
1325
- transition: 'opacity 0.15s',
1326
- display: [status ? 'none' : 'block', 'block', dimmer === 'top' ? 'block' : 'none', dimmer === 'top' ? 'block' : 'none']
1327
- }
1328
- }, /*#__PURE__*/React.createElement(Dimmer, {
1329
- sx: {
1330
- opacity: expanded || settings && settings.value ? 0 : 1,
1331
- color: 'primary'
1308
+ zIndex: 5000
1332
1309
  }
1333
- })), settings && /*#__PURE__*/React.createElement(Box, {
1310
+ }, /*#__PURE__*/React.createElement(Flex, {
1334
1311
  sx: {
1335
- mr: ['21px'],
1336
- position: 'relative',
1337
- pointerEvents: expanded ? 'none' : 'all',
1338
- transition: 'opacity 0.15s',
1339
- display: [status ? 'none' : 'block', 'block', 'none', 'none']
1312
+ justifyContent: 'flex-end'
1340
1313
  }
1341
- }, /*#__PURE__*/React.createElement(Settings, {
1342
- value: settings.value,
1343
- onClick: settings.onClick,
1314
+ }, /*#__PURE__*/React.createElement(Flex, {
1344
1315
  sx: {
1316
+ mr: '18px',
1317
+ gap: '18px',
1345
1318
  opacity: expanded ? 0 : 1,
1346
- stroke: 'primary'
1319
+ transition: 'opacity 0.15s',
1320
+ justifyContent: 'space-between',
1321
+ alignItems: 'center'
1347
1322
  }
1348
- })), /*#__PURE__*/React.createElement(Menu, {
1323
+ }, menuItems), /*#__PURE__*/React.createElement(Menu, {
1349
1324
  sx: {
1350
- transition: 'opacity 0.15s',
1351
- pointerEvents: settings && settings.value ? 'none' : 'all',
1352
- opacity: settings && settings.value ? 0 : 1,
1353
- mr: ['-2px'],
1354
- zIndex: 5000
1325
+ mr: ['-2px']
1355
1326
  },
1356
1327
  value: expanded,
1357
1328
  onClick: toggle
1358
- })), /*#__PURE__*/React.createElement(Box, {
1329
+ }))), /*#__PURE__*/React.createElement(Box, {
1359
1330
  sx: {
1360
1331
  opacity: expanded ? 1 : 0,
1361
1332
  pointerEvents: expanded ? 'all' : 'none',
@@ -1388,7 +1359,7 @@ const Header = ({
1388
1359
  })))))));
1389
1360
  };
1390
1361
 
1391
- const Monogram = _ref => {
1362
+ const Monogram = (_ref) => {
1392
1363
  let props = _extends({}, _ref);
1393
1364
 
1394
1365
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -1555,6 +1526,40 @@ const Footer = () => {
1555
1526
  }))));
1556
1527
  };
1557
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
+
1558
1563
  const GitSha = () => {
1559
1564
  const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
1560
1565
  const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
@@ -1706,7 +1711,6 @@ function scrollFraction(window, documnt) {
1706
1711
  return Math.min(window.scrollY / (document.body.offsetHeight - 770), 0.99);
1707
1712
  }
1708
1713
 
1709
- const _excluded$6 = ["duration", "delay", "children"];
1710
1714
  const fade = keyframes({
1711
1715
  from: {
1712
1716
  opacity: 0
@@ -1716,13 +1720,13 @@ const fade = keyframes({
1716
1720
  }
1717
1721
  });
1718
1722
 
1719
- const FadeIn = _ref => {
1723
+ const FadeIn = (_ref) => {
1720
1724
  let {
1721
1725
  duration = 300,
1722
1726
  delay = 0,
1723
1727
  children
1724
1728
  } = _ref,
1725
- delegated = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1729
+ delegated = _objectWithoutPropertiesLoose(_ref, ["duration", "delay", "children"]);
1726
1730
 
1727
1731
  return /*#__PURE__*/React.createElement(Box, _extends({}, delegated, {
1728
1732
  sx: {
@@ -1863,6 +1867,112 @@ function GuideColumns({
1863
1867
  }));
1864
1868
  }
1865
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
+
1866
1976
  const Layout = ({
1867
1977
  title,
1868
1978
  description,
@@ -1882,6 +1992,7 @@ const Layout = ({
1882
1992
  container: _container = true
1883
1993
  }) => {
1884
1994
  let content = children;
1995
+ const index = useBreakpointIndex();
1885
1996
 
1886
1997
  if (_fade) {
1887
1998
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -1890,7 +2001,34 @@ const Layout = ({
1890
2001
  }
1891
2002
 
1892
2003
  if (_container) {
1893
- 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)));
1894
2032
  }
1895
2033
 
1896
2034
  return /*#__PURE__*/React.createElement(React.Fragment, null, _guide && /*#__PURE__*/React.createElement(Guide, {
@@ -1922,8 +2060,7 @@ const Layout = ({
1922
2060
  mode: _links,
1923
2061
  status: status,
1924
2062
  nav: nav,
1925
- settings: settings,
1926
- dimmer: _dimmer
2063
+ menuItems: menuItems
1927
2064
  }))), /*#__PURE__*/React.createElement(Box, {
1928
2065
  sx: {
1929
2066
  width: '100%',
@@ -2035,16 +2172,14 @@ const Expander = ({
2035
2172
  })));
2036
2173
  };
2037
2174
 
2038
- const _excluded$5 = ["label", "value", "sx", "children"];
2039
-
2040
- const Tag = _ref => {
2175
+ const Tag = (_ref) => {
2041
2176
  let {
2042
2177
  label,
2043
2178
  value,
2044
2179
  sx,
2045
2180
  children
2046
2181
  } = _ref,
2047
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2182
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "value", "sx", "children"]);
2048
2183
 
2049
2184
  const color = sx && sx.color ? sx.color : 'primary';
2050
2185
  const isClickable = props && (props.onClick || props.onDoubleClick);
@@ -2078,8 +2213,7 @@ const Tag = _ref => {
2078
2213
  }, props), children);
2079
2214
  };
2080
2215
 
2081
- const _excluded$4 = ["values", "setValues", "label", "colors", "showAll", "multiSelect"];
2082
- const sx = {
2216
+ const sx$1 = {
2083
2217
  label: {
2084
2218
  fontFamily: 'mono',
2085
2219
  letterSpacing: 'mono',
@@ -2140,7 +2274,7 @@ const updateValues = ({
2140
2274
  }
2141
2275
  };
2142
2276
 
2143
- const Filter = _ref => {
2277
+ const Filter = (_ref) => {
2144
2278
  let {
2145
2279
  values,
2146
2280
  setValues,
@@ -2149,10 +2283,10 @@ const Filter = _ref => {
2149
2283
  showAll = false,
2150
2284
  multiSelect = false
2151
2285
  } = _ref,
2152
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2286
+ props = _objectWithoutPropertiesLoose(_ref, ["values", "setValues", "label", "colors", "showAll", "multiSelect"]);
2153
2287
 
2154
2288
  return /*#__PURE__*/React.createElement(Box, props, label && /*#__PURE__*/React.createElement(Box, {
2155
- sx: sx.label
2289
+ sx: sx$1.label
2156
2290
  }, label), /*#__PURE__*/React.createElement(Box, {
2157
2291
  sx: {
2158
2292
  mt: label ? [3] : 0
@@ -2236,15 +2370,13 @@ const Group = ({
2236
2370
  }));
2237
2371
  };
2238
2372
 
2239
- const _excluded$3 = ["size", "inverted", "sx"];
2240
-
2241
2373
  const Input = (_ref, ref) => {
2242
2374
  let {
2243
2375
  size = 'sm',
2244
2376
  inverted,
2245
2377
  sx
2246
2378
  } = _ref,
2247
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
2379
+ props = _objectWithoutPropertiesLoose(_ref, ["size", "inverted", "sx"]);
2248
2380
 
2249
2381
  const defaultColor = inverted ? 'secondary' : 'primary';
2250
2382
 
@@ -2295,15 +2427,14 @@ const getProps = test => props => {
2295
2427
  return next;
2296
2428
  };
2297
2429
 
2298
- const _excluded$2 = ["children", "size", "sx"];
2299
-
2300
- const Select = _ref => {
2430
+ const Select = (_ref) => {
2301
2431
  let {
2302
2432
  children,
2303
2433
  size = 'sm',
2304
- sx
2434
+ sx,
2435
+ sxSelect
2305
2436
  } = _ref,
2306
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2437
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "size", "sx", "sxSelect"]);
2307
2438
 
2308
2439
  const color = sx && sx.color ? sx.color : 'primary';
2309
2440
  const sizeStyles = getSizeStyles(size);
@@ -2375,7 +2506,7 @@ const Select = _ref => {
2375
2506
  background: 'transparent !important'
2376
2507
  }
2377
2508
  }
2378
- })
2509
+ }, sxSelect)
2379
2510
  }, omitOnChange), children), /*#__PURE__*/React.createElement(Arrow, {
2380
2511
  sx: {
2381
2512
  width: width,
@@ -2390,13 +2521,11 @@ const Select = _ref => {
2390
2521
  }));
2391
2522
  };
2392
2523
 
2393
- const _excluded$1 = ["sx"];
2394
-
2395
2524
  const Slider = (_ref, ref) => {
2396
2525
  let {
2397
2526
  sx
2398
2527
  } = _ref,
2399
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2528
+ props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
2400
2529
 
2401
2530
  const color = sx && sx.color ? sx.color : 'primary';
2402
2531
  const {
@@ -2439,7 +2568,7 @@ const Slider = (_ref, ref) => {
2439
2568
 
2440
2569
  var slider = forwardRef(Slider);
2441
2570
 
2442
- const styles = {
2571
+ const styles$1 = {
2443
2572
  reset: {
2444
2573
  verticalAlign: 'baseline',
2445
2574
  border: 0,
@@ -2508,7 +2637,7 @@ const Table = ({
2508
2637
  }
2509
2638
  }, header && /*#__PURE__*/React.createElement(Row, {
2510
2639
  as: "tr",
2511
- sx: _extends({}, styles.reset, styles.header, styles.row, {
2640
+ sx: _extends({}, styles$1.reset, styles$1.header, styles$1.row, {
2512
2641
  color: color,
2513
2642
  borderTopWidth: !_borderTop ? '0px' : '1px'
2514
2643
  })
@@ -2516,13 +2645,13 @@ const Table = ({
2516
2645
  as: "td",
2517
2646
  start: [1],
2518
2647
  width: columns,
2519
- sx: styles.index
2648
+ sx: styles$1.index
2520
2649
  }, header)), data.map((row, i) => {
2521
2650
  return /*#__PURE__*/React.createElement(Row, {
2522
2651
  as: "tr",
2523
2652
  columns: columns,
2524
2653
  key: i,
2525
- sx: _extends({}, styles.reset, styles.row, {
2654
+ sx: _extends({}, styles$1.reset, styles$1.row, {
2526
2655
  pb: _borderBottom && i === data.length - 1 ? ['18px', '18px', '18px', '22px'] : [3, 3, 3, '20px'],
2527
2656
  borderBottomWidth: _borderBottom && i === data.length - 1 ? '1px' : '0px',
2528
2657
  borderTopWidth: !_borderTop && i === 0 && !header ? '0px' : '1px'
@@ -2533,14 +2662,12 @@ const Table = ({
2533
2662
  key: j,
2534
2663
  start: start[j],
2535
2664
  width: width[j],
2536
- 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)
2537
2666
  }, column);
2538
2667
  }));
2539
2668
  })));
2540
2669
  };
2541
2670
 
2542
- const _excluded = ["value", "onClick", "disabled", "sx"];
2543
-
2544
2671
  const Toggle = (_ref, ref) => {
2545
2672
  let {
2546
2673
  value,
@@ -2548,7 +2675,7 @@ const Toggle = (_ref, ref) => {
2548
2675
  disabled,
2549
2676
  sx
2550
2677
  } = _ref,
2551
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
2678
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "onClick", "disabled", "sx"]);
2552
2679
 
2553
2680
  const color = sx && sx.color ? sx.color : 'primary';
2554
2681
  value = disabled ? false : value;
@@ -2624,7 +2751,6 @@ const Tray = ({
2624
2751
  }) => {
2625
2752
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
2626
2753
  sx: {
2627
- display: ['initial', 'initial', 'none', 'none'],
2628
2754
  position: 'fixed',
2629
2755
  top: '56px',
2630
2756
  bottom: '0px',
@@ -2639,7 +2765,6 @@ const Tray = ({
2639
2765
  }
2640
2766
  }), /*#__PURE__*/React.createElement(Box, {
2641
2767
  sx: _extends({
2642
- display: ['initial', 'initial', 'none', 'none'],
2643
2768
  position: 'fixed',
2644
2769
  width: 'calc(100vw)',
2645
2770
  top: '0px',