@carbonplan/components 11.0.0-alpha.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 = {
@@ -557,61 +568,195 @@ const Label = ({
557
568
  }
558
569
  }, units)));
559
570
 
560
- const Colorbar = _ref => {
571
+ const Colorbar = (_ref) => {
561
572
  let {
562
573
  colormap,
563
574
  label,
564
575
  clim,
576
+ setClim,
577
+ setClimStep = 1,
565
578
  discrete,
566
579
  units,
567
580
  width,
568
581
  height,
569
582
  format = d => d,
570
- horizontal = false
583
+ horizontal = false,
584
+ bottom = false,
585
+ sx,
586
+ sxClim
571
587
  } = _ref,
572
- props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
588
+ props = _objectWithoutPropertiesLoose(_ref, ["colormap", "label", "clim", "setClim", "setClimStep", "discrete", "units", "width", "height", "format", "horizontal", "bottom", "sx", "sxClim"]);
573
589
 
574
590
  if (!Array.isArray(colormap)) {
575
591
  throw new Error(`expected array for colormap, got '${colormap}'.`);
576
592
  }
577
593
 
594
+ const climRef = [useRef(), useRef()];
595
+ const [climMinDragging, setClimMinDragging] = useState(false);
596
+ const [climMaxDragging, setClimMaxDragging] = useState(false);
597
+ let x,
598
+ y,
599
+ dx,
600
+ dy = 0;
601
+ let id = null;
602
+ let init = [0, 0];
603
+ let scale = setClimStep;
604
+
605
+ const draggingFunction = e => {
606
+ if (id === 'min' && !climMinDragging) setClimMinDragging(true);
607
+ if (id === 'max' && !climMaxDragging) setClimMaxDragging(true);
608
+ dx = e.pageX - x;
609
+ dy = e.pageY - y;
610
+
611
+ if (horizontal) {
612
+ if (id === 'min') setClim(prev => [Math.min(init[0] + dx * scale, init[1]), prev[1]]);
613
+ if (id === 'max') setClim(prev => [prev[0], Math.max(init[1] + dx * scale, init[0])]);
614
+ } else {
615
+ if (id === 'min') setClim(prev => [Math.min(init[0] - dy * scale, init[1]), prev[1]]);
616
+ if (id === 'max') setClim(prev => [prev[0], Math.max(init[1] - dy * scale, init[0])]);
617
+ }
618
+ };
619
+
620
+ const handleMouseDown = e => {
621
+ y = e.pageY;
622
+ x = e.pageX;
623
+ id = e.target.id;
624
+ init = clim;
625
+ document.body.setAttribute('style', horizontal ? 'cursor: ew-resize !important' : 'cursor: ns-resize !important');
626
+ document.addEventListener('mousemove', draggingFunction);
627
+
628
+ const updater = () => {
629
+ document.body.setAttribute('style', 'cursor: unset');
630
+ document.removeEventListener('mousemove', draggingFunction);
631
+ window.removeEventListener('mouseup', updater);
632
+ if (id === 'min') setClimMinDragging(false);
633
+ if (id === 'max') setClimMaxDragging(false);
634
+ };
635
+
636
+ window.addEventListener('mouseup', updater);
637
+ };
638
+
639
+ const increment = e => {
640
+ if (climRef[0].current === document.activeElement) {
641
+ e.preventDefault();
642
+ setClim(prev => [Math.min(prev[0] + scale, prev[1]), prev[1]]);
643
+ climRef[0].current.focus();
644
+ }
645
+
646
+ if (climRef[1].current === document.activeElement) {
647
+ e.preventDefault();
648
+ setClim(prev => [prev[0], Math.max(prev[1] + scale, prev[0])]);
649
+ climRef[1].current.focus();
650
+ }
651
+ };
652
+
653
+ const decrement = e => {
654
+ if (climRef[0].current === document.activeElement) {
655
+ e.preventDefault();
656
+ setClim(prev => [Math.min(prev[0] - scale, prev[1]), prev[1]]);
657
+ climRef[0].current.focus();
658
+ }
659
+
660
+ if (climRef[1].current === document.activeElement) {
661
+ e.preventDefault();
662
+ setClim(prev => [prev[0], Math.max(prev[1] - scale, prev[0])]);
663
+ climRef[1].current.focus();
664
+ }
665
+ };
666
+
667
+ useEffect(() => {
668
+ const listener = e => {
669
+ if (['ArrowUp', 'ArrowRight'].includes(e.code) || ['ArrowUp', 'ArrowRight'].includes(e.key)) {
670
+ increment(e);
671
+ }
672
+
673
+ if (['ArrowDown', 'ArrowLeft'].includes(e.code) || ['ArrowDown', 'ArrowLeft'].includes(e.key)) {
674
+ decrement(e);
675
+ }
676
+ };
677
+
678
+ window.addEventListener('keydown', listener);
679
+ return () => {
680
+ window.removeEventListener('keydown', listener);
681
+ };
682
+ }, [clim]);
683
+
578
684
  const ClimMin = () => {
579
685
  return /*#__PURE__*/React.createElement(Box, {
580
- sx: _extends({}, sx$2.clim, {
581
- ml: label ? horizontal ? '10px' : '2px' : 0,
686
+ id: "min",
687
+ ref: climRef[0],
688
+ tabIndex: 0,
689
+ sx: _extends({}, styles.clim(setClim), {
690
+ ml: label ? horizontal ? bottom ? '0px' : '10px' : '2px' : 0,
582
691
  mr: horizontal ? ['2px', '1px', '1px', '2px'] : 0,
583
- mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px']
584
- })
692
+ mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px'],
693
+ borderBottom: setClim ? climMinDragging ? ({
694
+ colors
695
+ }) => `solid 1px ${colors.primary}` : ({
696
+ colors
697
+ }) => `solid 1px ${colors.secondary}` : 'unset',
698
+ cursor: setClim ? horizontal ? 'ew-resize' : 'ns-resize' : 'default'
699
+ }, sxClim),
700
+ onMouseDown: setClim ? handleMouseDown : () => {},
701
+ onClick: () => climRef[0].current.focus()
585
702
  }, format(clim[0]));
586
703
  };
587
704
 
588
705
  const ClimMax = () => {
589
706
  return /*#__PURE__*/React.createElement(Box, {
590
- sx: _extends({}, sx$2.clim, {
707
+ id: "max",
708
+ ref: climRef[1],
709
+ tabIndex: 0,
710
+ sx: _extends({}, styles.clim(setClim), {
591
711
  ml: horizontal ? ['2px', '1px', '1px', '2px'] : '2px',
592
- mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px']
593
- })
712
+ mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px'],
713
+ borderBottom: setClim ? climMaxDragging ? ({
714
+ colors
715
+ }) => `solid 1px ${colors.primary}` : ({
716
+ colors
717
+ }) => `solid 1px ${colors.secondary}` : 'unset',
718
+ cursor: setClim ? horizontal ? 'ew-resize' : 'ns-resize' : 'default'
719
+ }, sxClim),
720
+ onMouseDown: setClim ? handleMouseDown : () => {},
721
+ onClick: () => climRef[1].current.focus()
594
722
  }, format(clim[1]));
595
723
  };
596
724
 
597
- return /*#__PURE__*/React.createElement(Flex, {
598
- sx: _extends({}, props.sx, {
725
+ return /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
726
+ sx: _extends({
599
727
  flexDirection: 'row',
600
- alignItems: 'center',
728
+ alignItems: 'start',
601
729
  justifyContent: 'flex-start',
602
- gap: ['3px', '6px', '6px', '7px']
603
- })
604
- }, label && /*#__PURE__*/React.createElement(Label, {
730
+ gap: ['3px', '6px', '6px', '7px'],
731
+ height: !horizontal ? '100%' : 'unset'
732
+ }, sx)
733
+ }), label && /*#__PURE__*/React.createElement(Label, {
605
734
  label: label,
606
735
  units: units,
607
736
  horizontal: horizontal
608
- }), horizontal && clim && /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(Gradient, {
737
+ }), /*#__PURE__*/React.createElement(Flex, {
738
+ sx: {
739
+ flexGrow: horizontal ? 1 : 'unset',
740
+ flexDirection: 'column',
741
+ ml: bottom && label ? '4px' : '0px',
742
+ height: !horizontal ? '100%' : 'unset'
743
+ }
744
+ }, /*#__PURE__*/React.createElement(Flex, {
745
+ sx: {
746
+ gap: ['3px', '6px', '6px', '7px'],
747
+ height: !horizontal ? '100%' : 'unset'
748
+ }
749
+ }, horizontal && clim && !bottom && /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(Gradient, {
609
750
  colormap: colormap,
610
751
  horizontal: horizontal,
611
752
  discrete: discrete,
612
753
  width: width,
613
754
  height: height
614
- }), horizontal && clim && /*#__PURE__*/React.createElement(ClimMax, null), !horizontal && /*#__PURE__*/React.createElement(Flex, {
755
+ }), horizontal && clim && !bottom && /*#__PURE__*/React.createElement(ClimMax, null)), horizontal && clim && bottom && /*#__PURE__*/React.createElement(Flex, {
756
+ sx: {
757
+ justifyContent: 'space-between'
758
+ }
759
+ }, /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(ClimMax, null))), !horizontal && /*#__PURE__*/React.createElement(Flex, {
615
760
  sx: {
616
761
  flexDirection: 'column-reverse',
617
762
  justifyContent: 'space-between',
@@ -620,9 +765,7 @@ const Colorbar = _ref => {
620
765
  }, clim && /*#__PURE__*/React.createElement(ClimMin, null), clim && /*#__PURE__*/React.createElement(ClimMax, null)));
621
766
  };
622
767
 
623
- const _excluded$b = ["start", "width", "dl", "dr", "children", "sx"];
624
-
625
- const Column = _ref => {
768
+ const Column = (_ref) => {
626
769
  let {
627
770
  start,
628
771
  width,
@@ -631,7 +774,7 @@ const Column = _ref => {
631
774
  children,
632
775
  sx
633
776
  } = _ref,
634
- props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
777
+ props = _objectWithoutPropertiesLoose(_ref, ["start", "width", "dl", "dr", "children", "sx"]);
635
778
 
636
779
  start = start || 'auto';
637
780
  width = width || 'auto';
@@ -799,7 +942,7 @@ const Meta = ({
799
942
  }));
800
943
  };
801
944
 
802
- const Logo = _ref => {
945
+ const Logo = (_ref) => {
803
946
  let props = _extends({}, _ref);
804
947
 
805
948
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -835,16 +978,14 @@ const Logo = _ref => {
835
978
  })));
836
979
  };
837
980
 
838
- const _excluded$a = ["children", "sx", "columns", "gap"];
839
-
840
- const Row = _ref => {
981
+ const Row = (_ref) => {
841
982
  let {
842
983
  children,
843
984
  sx,
844
985
  columns,
845
986
  gap
846
987
  } = _ref,
847
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
988
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "sx", "columns", "gap"]);
848
989
 
849
990
  const makeArray = input => {
850
991
  if (!Array.isArray(input)) {
@@ -892,14 +1033,12 @@ const Row = _ref => {
892
1033
  }), children);
893
1034
  };
894
1035
 
895
- const _excluded$9 = ["value", "sx"];
896
-
897
- const Menu = _ref => {
1036
+ const Menu = (_ref) => {
898
1037
  let {
899
1038
  value,
900
1039
  sx
901
1040
  } = _ref,
902
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
1041
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
903
1042
 
904
1043
  return /*#__PURE__*/React.createElement(IconButton, _extends({
905
1044
  sx: _extends({
@@ -987,151 +1126,7 @@ const Menu = _ref => {
987
1126
  })));
988
1127
  };
989
1128
 
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 = {
1129
+ const sx = {
1135
1130
  link: (current, label, first = false) => {
1136
1131
  return {
1137
1132
  width: 'auto',
@@ -1197,7 +1192,6 @@ const Nav = ({
1197
1192
  mode,
1198
1193
  nav,
1199
1194
  first,
1200
- dimmer,
1201
1195
  setExpanded
1202
1196
  }) => {
1203
1197
  const {
@@ -1214,12 +1208,12 @@ const Nav = ({
1214
1208
  onClick: () => {
1215
1209
  if (nav === url) setExpanded(false);
1216
1210
  },
1217
- sx: sx$1.link(nav, url, first)
1211
+ sx: sx.link(nav, url, first)
1218
1212
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display));
1219
1213
  } else {
1220
1214
  return /*#__PURE__*/React.createElement(Link$2, {
1221
1215
  href: href,
1222
- sx: sx$1.link(nav, url, first)
1216
+ sx: sx.link(nav, url, first)
1223
1217
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display);
1224
1218
  }
1225
1219
  };
@@ -1246,8 +1240,7 @@ const Header = ({
1246
1240
  status,
1247
1241
  mode,
1248
1242
  nav,
1249
- dimmer,
1250
- settings
1243
+ menuItems
1251
1244
  }) => {
1252
1245
  const [expanded, setExpanded] = useState(false);
1253
1246
 
@@ -1257,7 +1250,6 @@ const Header = ({
1257
1250
 
1258
1251
  return /*#__PURE__*/React.createElement(Row, {
1259
1252
  sx: {
1260
- width: '100%',
1261
1253
  pt: ['12px'],
1262
1254
  pb: [3]
1263
1255
  }
@@ -1309,53 +1301,31 @@ const Header = ({
1309
1301
  top: ['-2px', '-3px', '-3px']
1310
1302
  }
1311
1303
  }, status ? `(${status})` : '')), /*#__PURE__*/React.createElement(Column, {
1312
- start: [status ? 6 : 4, 6, 12, 12],
1304
+ start: [status ? 6 : 4, 6, 11, 11],
1313
1305
  width: [status ? 1 : 3, 3, 2, 2],
1314
1306
  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'
1307
+ zIndex: 5000
1332
1308
  }
1333
- })), settings && /*#__PURE__*/React.createElement(Box, {
1309
+ }, /*#__PURE__*/React.createElement(Flex, {
1334
1310
  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']
1311
+ justifyContent: 'flex-end'
1340
1312
  }
1341
- }, /*#__PURE__*/React.createElement(Settings, {
1342
- value: settings.value,
1343
- onClick: settings.onClick,
1313
+ }, /*#__PURE__*/React.createElement(Flex, {
1344
1314
  sx: {
1315
+ mr: '18px',
1316
+ gap: '18px',
1345
1317
  opacity: expanded ? 0 : 1,
1346
- stroke: 'primary'
1318
+ transition: 'opacity 0.15s',
1319
+ justifyContent: 'space-between',
1320
+ alignItems: 'center'
1347
1321
  }
1348
- })), /*#__PURE__*/React.createElement(Menu, {
1322
+ }, menuItems), /*#__PURE__*/React.createElement(Menu, {
1349
1323
  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
1324
+ mr: ['-2px']
1355
1325
  },
1356
1326
  value: expanded,
1357
1327
  onClick: toggle
1358
- })), /*#__PURE__*/React.createElement(Box, {
1328
+ }))), /*#__PURE__*/React.createElement(Box, {
1359
1329
  sx: {
1360
1330
  opacity: expanded ? 1 : 0,
1361
1331
  pointerEvents: expanded ? 'all' : 'none',
@@ -1388,7 +1358,7 @@ const Header = ({
1388
1358
  })))))));
1389
1359
  };
1390
1360
 
1391
- const Monogram = _ref => {
1361
+ const Monogram = (_ref) => {
1392
1362
  let props = _extends({}, _ref);
1393
1363
 
1394
1364
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -1555,6 +1525,40 @@ const Footer = () => {
1555
1525
  }))));
1556
1526
  };
1557
1527
 
1528
+ const Dimmer = (_ref) => {
1529
+ let {
1530
+ sx
1531
+ } = _ref,
1532
+ props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
1533
+
1534
+ const [colorMode, setColorMode] = useColorMode();
1535
+ const toggle = useCallback(() => {
1536
+ setColorMode(colorMode === 'light' ? 'dark' : 'light');
1537
+ }, [colorMode]);
1538
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1539
+ "aria-label": "Toggle dark mode",
1540
+ onClick: toggle,
1541
+ role: "checkbox",
1542
+ sx: _extends({
1543
+ width: 32,
1544
+ height: 32,
1545
+ display: 'inline-block',
1546
+ cursor: 'pointer',
1547
+ color: 'secondary'
1548
+ }, sx)
1549
+ }, props), /*#__PURE__*/React.createElement(Sun, {
1550
+ sx: {
1551
+ strokeWidth: '1.75',
1552
+ transition: 'stroke 0.15s',
1553
+ '@media (hover: hover) and (pointer: fine)': {
1554
+ '&:hover': {
1555
+ stroke: 'primary'
1556
+ }
1557
+ }
1558
+ }
1559
+ }));
1560
+ };
1561
+
1558
1562
  const GitSha = () => {
1559
1563
  const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
1560
1564
  const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
@@ -1706,7 +1710,6 @@ function scrollFraction(window, documnt) {
1706
1710
  return Math.min(window.scrollY / (document.body.offsetHeight - 770), 0.99);
1707
1711
  }
1708
1712
 
1709
- const _excluded$6 = ["duration", "delay", "children"];
1710
1713
  const fade = keyframes({
1711
1714
  from: {
1712
1715
  opacity: 0
@@ -1716,13 +1719,13 @@ const fade = keyframes({
1716
1719
  }
1717
1720
  });
1718
1721
 
1719
- const FadeIn = _ref => {
1722
+ const FadeIn = (_ref) => {
1720
1723
  let {
1721
1724
  duration = 300,
1722
1725
  delay = 0,
1723
1726
  children
1724
1727
  } = _ref,
1725
- delegated = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1728
+ delegated = _objectWithoutPropertiesLoose(_ref, ["duration", "delay", "children"]);
1726
1729
 
1727
1730
  return /*#__PURE__*/React.createElement(Box, _extends({}, delegated, {
1728
1731
  sx: {
@@ -1863,6 +1866,112 @@ function GuideColumns({
1863
1866
  }));
1864
1867
  }
1865
1868
 
1869
+ const Settings = (_ref) => {
1870
+ let {
1871
+ value,
1872
+ sx
1873
+ } = _ref,
1874
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
1875
+
1876
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1877
+ sx: _extends({
1878
+ cursor: 'pointer',
1879
+ fill: 'none',
1880
+ strokeWidth: '2px',
1881
+ stroke: 'text',
1882
+ '.paren': {
1883
+ opacity: '0'
1884
+ },
1885
+ '@media (hover: hover) and (pointer: fine)': {
1886
+ '&:hover .paren': {
1887
+ opacity: '1'
1888
+ }
1889
+ }
1890
+ }, sx),
1891
+ "aria-label": "Toggle Menu"
1892
+ }, props), !value && /*#__PURE__*/React.createElement("svg", {
1893
+ style: {
1894
+ width: '50px',
1895
+ height: '30px',
1896
+ transform: 'scale(2)',
1897
+ marginTop: '-3px'
1898
+ },
1899
+ xmlns: "http://www.w3.org/2000/svg",
1900
+ viewBox: "0 0 68 36"
1901
+ }, /*#__PURE__*/React.createElement("line", {
1902
+ x1: "24",
1903
+ y1: "2.1",
1904
+ x2: "24",
1905
+ y2: "6.1"
1906
+ }), /*#__PURE__*/React.createElement("line", {
1907
+ x1: "24",
1908
+ y1: "24.1",
1909
+ x2: "24",
1910
+ y2: "33.9"
1911
+ }), /*#__PURE__*/React.createElement("line", {
1912
+ x1: "44",
1913
+ y1: "2.1",
1914
+ x2: "44",
1915
+ y2: "12.1"
1916
+ }), /*#__PURE__*/React.createElement("line", {
1917
+ x1: "44",
1918
+ y1: "30.1",
1919
+ x2: "44",
1920
+ y2: "33.9"
1921
+ }), /*#__PURE__*/React.createElement("circle", {
1922
+ cx: "24",
1923
+ cy: "15.1",
1924
+ r: "5"
1925
+ }), /*#__PURE__*/React.createElement("circle", {
1926
+ cx: "44",
1927
+ cy: "21.1",
1928
+ r: "5"
1929
+ }), /*#__PURE__*/React.createElement("path", {
1930
+ style: {
1931
+ transition: 'all 0.2s'
1932
+ },
1933
+ className: "paren",
1934
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1935
+ }), /*#__PURE__*/React.createElement("path", {
1936
+ style: {
1937
+ transition: 'all 0.2s'
1938
+ },
1939
+ className: "paren",
1940
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1941
+ })), value && /*#__PURE__*/React.createElement("svg", {
1942
+ style: {
1943
+ width: '50px',
1944
+ height: '30px',
1945
+ transform: 'scale(2)',
1946
+ marginTop: '-3px'
1947
+ },
1948
+ xmlns: "http://www.w3.org/2000/svg",
1949
+ viewBox: "0 0 68 36"
1950
+ }, /*#__PURE__*/React.createElement("line", {
1951
+ x1: "50.85",
1952
+ y1: "29.79",
1953
+ x2: "17.15",
1954
+ y2: "6.21"
1955
+ }), /*#__PURE__*/React.createElement("line", {
1956
+ x1: "17.15",
1957
+ y1: "29.79",
1958
+ x2: "50.85",
1959
+ y2: "6.21"
1960
+ }), /*#__PURE__*/React.createElement("path", {
1961
+ style: {
1962
+ transition: 'all 0.2s'
1963
+ },
1964
+ className: "paren",
1965
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1966
+ }), /*#__PURE__*/React.createElement("path", {
1967
+ style: {
1968
+ transition: 'all 0.2s'
1969
+ },
1970
+ className: "paren",
1971
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1972
+ })));
1973
+ };
1974
+
1866
1975
  const Layout = ({
1867
1976
  title,
1868
1977
  description,
@@ -1882,6 +1991,7 @@ const Layout = ({
1882
1991
  container: _container = true
1883
1992
  }) => {
1884
1993
  let content = children;
1994
+ const index = useBreakpointIndex();
1885
1995
 
1886
1996
  if (_fade) {
1887
1997
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -1890,7 +2000,34 @@ const Layout = ({
1890
2000
  }
1891
2001
 
1892
2002
  if (_container) {
1893
- content = /*#__PURE__*/React.createElement(Container, null, content);
2003
+ content = /*#__PURE__*/React.createElement(Box, {
2004
+ sx: {
2005
+ mb: [8, 8, 9, 10]
2006
+ }
2007
+ }, /*#__PURE__*/React.createElement(Container, null, content));
2008
+ }
2009
+
2010
+ useEffect(() => {
2011
+ if (index > 2 && settings != null && settings.value && settings != null && settings.onClick) {
2012
+ settings == null ? void 0 : settings.onClick();
2013
+ }
2014
+ }, [index, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2015
+ const menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2016
+ key: "dimmer",
2017
+ sx: {
2018
+ color: 'primary',
2019
+ mt: '-2px',
2020
+ display: ['block', 'block', _dimmer === 'top' ? 'block' : 'none', _dimmer === 'top' ? 'block' : 'none']
2021
+ }
2022
+ })];
2023
+
2024
+ if (settings) {
2025
+ menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2026
+ key: "settings",
2027
+ sx: {
2028
+ display: ['inherit', 'inherit', 'none', 'none']
2029
+ }
2030
+ }, settings)));
1894
2031
  }
1895
2032
 
1896
2033
  return /*#__PURE__*/React.createElement(React.Fragment, null, _guide && /*#__PURE__*/React.createElement(Guide, {
@@ -1922,8 +2059,7 @@ const Layout = ({
1922
2059
  mode: _links,
1923
2060
  status: status,
1924
2061
  nav: nav,
1925
- settings: settings,
1926
- dimmer: _dimmer
2062
+ menuItems: menuItems
1927
2063
  }))), /*#__PURE__*/React.createElement(Box, {
1928
2064
  sx: {
1929
2065
  width: '100%',
@@ -2035,16 +2171,14 @@ const Expander = ({
2035
2171
  })));
2036
2172
  };
2037
2173
 
2038
- const _excluded$5 = ["label", "value", "sx", "children"];
2039
-
2040
- const Tag = _ref => {
2174
+ const Tag = (_ref) => {
2041
2175
  let {
2042
2176
  label,
2043
2177
  value,
2044
2178
  sx,
2045
2179
  children
2046
2180
  } = _ref,
2047
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2181
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "value", "sx", "children"]);
2048
2182
 
2049
2183
  const color = sx && sx.color ? sx.color : 'primary';
2050
2184
  const isClickable = props && (props.onClick || props.onDoubleClick);
@@ -2078,8 +2212,7 @@ const Tag = _ref => {
2078
2212
  }, props), children);
2079
2213
  };
2080
2214
 
2081
- const _excluded$4 = ["values", "setValues", "label", "colors", "showAll", "multiSelect"];
2082
- const sx = {
2215
+ const sx$1 = {
2083
2216
  label: {
2084
2217
  fontFamily: 'mono',
2085
2218
  letterSpacing: 'mono',
@@ -2140,7 +2273,7 @@ const updateValues = ({
2140
2273
  }
2141
2274
  };
2142
2275
 
2143
- const Filter = _ref => {
2276
+ const Filter = (_ref) => {
2144
2277
  let {
2145
2278
  values,
2146
2279
  setValues,
@@ -2149,10 +2282,10 @@ const Filter = _ref => {
2149
2282
  showAll = false,
2150
2283
  multiSelect = false
2151
2284
  } = _ref,
2152
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2285
+ props = _objectWithoutPropertiesLoose(_ref, ["values", "setValues", "label", "colors", "showAll", "multiSelect"]);
2153
2286
 
2154
2287
  return /*#__PURE__*/React.createElement(Box, props, label && /*#__PURE__*/React.createElement(Box, {
2155
- sx: sx.label
2288
+ sx: sx$1.label
2156
2289
  }, label), /*#__PURE__*/React.createElement(Box, {
2157
2290
  sx: {
2158
2291
  mt: label ? [3] : 0
@@ -2236,15 +2369,13 @@ const Group = ({
2236
2369
  }));
2237
2370
  };
2238
2371
 
2239
- const _excluded$3 = ["size", "inverted", "sx"];
2240
-
2241
2372
  const Input = (_ref, ref) => {
2242
2373
  let {
2243
2374
  size = 'sm',
2244
2375
  inverted,
2245
2376
  sx
2246
2377
  } = _ref,
2247
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
2378
+ props = _objectWithoutPropertiesLoose(_ref, ["size", "inverted", "sx"]);
2248
2379
 
2249
2380
  const defaultColor = inverted ? 'secondary' : 'primary';
2250
2381
 
@@ -2295,15 +2426,14 @@ const getProps = test => props => {
2295
2426
  return next;
2296
2427
  };
2297
2428
 
2298
- const _excluded$2 = ["children", "size", "sx"];
2299
-
2300
- const Select = _ref => {
2429
+ const Select = (_ref) => {
2301
2430
  let {
2302
2431
  children,
2303
2432
  size = 'sm',
2304
- sx
2433
+ sx,
2434
+ sxSelect
2305
2435
  } = _ref,
2306
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2436
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "size", "sx", "sxSelect"]);
2307
2437
 
2308
2438
  const color = sx && sx.color ? sx.color : 'primary';
2309
2439
  const sizeStyles = getSizeStyles(size);
@@ -2375,7 +2505,7 @@ const Select = _ref => {
2375
2505
  background: 'transparent !important'
2376
2506
  }
2377
2507
  }
2378
- })
2508
+ }, sxSelect)
2379
2509
  }, omitOnChange), children), /*#__PURE__*/React.createElement(Arrow, {
2380
2510
  sx: {
2381
2511
  width: width,
@@ -2390,13 +2520,11 @@ const Select = _ref => {
2390
2520
  }));
2391
2521
  };
2392
2522
 
2393
- const _excluded$1 = ["sx"];
2394
-
2395
2523
  const Slider = (_ref, ref) => {
2396
2524
  let {
2397
2525
  sx
2398
2526
  } = _ref,
2399
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2527
+ props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
2400
2528
 
2401
2529
  const color = sx && sx.color ? sx.color : 'primary';
2402
2530
  const {
@@ -2439,7 +2567,7 @@ const Slider = (_ref, ref) => {
2439
2567
 
2440
2568
  var slider = forwardRef(Slider);
2441
2569
 
2442
- const styles = {
2570
+ const styles$1 = {
2443
2571
  reset: {
2444
2572
  verticalAlign: 'baseline',
2445
2573
  border: 0,
@@ -2508,7 +2636,7 @@ const Table = ({
2508
2636
  }
2509
2637
  }, header && /*#__PURE__*/React.createElement(Row, {
2510
2638
  as: "tr",
2511
- sx: _extends({}, styles.reset, styles.header, styles.row, {
2639
+ sx: _extends({}, styles$1.reset, styles$1.header, styles$1.row, {
2512
2640
  color: color,
2513
2641
  borderTopWidth: !_borderTop ? '0px' : '1px'
2514
2642
  })
@@ -2516,13 +2644,13 @@ const Table = ({
2516
2644
  as: "td",
2517
2645
  start: [1],
2518
2646
  width: columns,
2519
- sx: styles.index
2647
+ sx: styles$1.index
2520
2648
  }, header)), data.map((row, i) => {
2521
2649
  return /*#__PURE__*/React.createElement(Row, {
2522
2650
  as: "tr",
2523
2651
  columns: columns,
2524
2652
  key: i,
2525
- sx: _extends({}, styles.reset, styles.row, {
2653
+ sx: _extends({}, styles$1.reset, styles$1.row, {
2526
2654
  pb: _borderBottom && i === data.length - 1 ? ['18px', '18px', '18px', '22px'] : [3, 3, 3, '20px'],
2527
2655
  borderBottomWidth: _borderBottom && i === data.length - 1 ? '1px' : '0px',
2528
2656
  borderTopWidth: !_borderTop && i === 0 && !header ? '0px' : '1px'
@@ -2533,14 +2661,12 @@ const Table = ({
2533
2661
  key: j,
2534
2662
  start: start[j],
2535
2663
  width: width[j],
2536
- sx: j == 0 && _index ? _extends({}, styles.reset, styles.index) : _extends({}, styles.reset, styles.entry)
2664
+ sx: j == 0 && _index ? _extends({}, styles$1.reset, styles$1.index) : _extends({}, styles$1.reset, styles$1.entry)
2537
2665
  }, column);
2538
2666
  }));
2539
2667
  })));
2540
2668
  };
2541
2669
 
2542
- const _excluded = ["value", "onClick", "disabled", "sx"];
2543
-
2544
2670
  const Toggle = (_ref, ref) => {
2545
2671
  let {
2546
2672
  value,
@@ -2548,7 +2674,7 @@ const Toggle = (_ref, ref) => {
2548
2674
  disabled,
2549
2675
  sx
2550
2676
  } = _ref,
2551
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
2677
+ props = _objectWithoutPropertiesLoose(_ref, ["value", "onClick", "disabled", "sx"]);
2552
2678
 
2553
2679
  const color = sx && sx.color ? sx.color : 'primary';
2554
2680
  value = disabled ? false : value;
@@ -2624,7 +2750,6 @@ const Tray = ({
2624
2750
  }) => {
2625
2751
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
2626
2752
  sx: {
2627
- display: ['initial', 'initial', 'none', 'none'],
2628
2753
  position: 'fixed',
2629
2754
  top: '56px',
2630
2755
  bottom: '0px',
@@ -2639,7 +2764,6 @@ const Tray = ({
2639
2764
  }
2640
2765
  }), /*#__PURE__*/React.createElement(Box, {
2641
2766
  sx: _extends({
2642
- display: ['initial', 'initial', 'none', 'none'],
2643
2767
  position: 'fixed',
2644
2768
  width: 'calc(100vw)',
2645
2769
  top: '0px',