@carbonplan/components 11.0.5-develop.2 → 11.0.6-develop.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,12 +40,14 @@ function _objectWithoutPropertiesLoose(source, excluded) {
40
40
  return target;
41
41
  }
42
42
 
43
- const Badge = (_ref) => {
43
+ const _excluded$g = ["sx", "children"];
44
+
45
+ const Badge = _ref => {
44
46
  let {
45
47
  sx,
46
48
  children
47
49
  } = _ref,
48
- props = _objectWithoutPropertiesLoose(_ref, ["sx", "children"]);
50
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
49
51
 
50
52
  const color = sx && sx.color ? sx.color : 'primary';
51
53
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -70,6 +72,8 @@ const Badge = (_ref) => {
70
72
  }, children));
71
73
  };
72
74
 
75
+ const _excluded$f = ["href", "children", "internal", "tracking"];
76
+
73
77
  const event = ({
74
78
  action,
75
79
  category,
@@ -95,7 +99,7 @@ const Link = (_ref, ref) => {
95
99
  internal = false,
96
100
  tracking = false
97
101
  } = _ref,
98
- props = _objectWithoutPropertiesLoose(_ref, ["href", "children", "internal", "tracking"]);
102
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
99
103
 
100
104
  if (internal || href && href.startsWith('/')) {
101
105
  return /*#__PURE__*/React.createElement(NextLink, {
@@ -190,6 +194,8 @@ const getSizeStyles = size => {
190
194
  };
191
195
  };
192
196
 
197
+ const _excluded$e = ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"];
198
+
193
199
  const Button = (_ref, ref) => {
194
200
  let {
195
201
  size = 'sm',
@@ -203,7 +209,7 @@ const Button = (_ref, ref) => {
203
209
  internal,
204
210
  tracking
205
211
  } = _ref,
206
- props = _objectWithoutPropertiesLoose(_ref, ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"]);
212
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
207
213
 
208
214
  if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
209
215
  throw new Error('Size must be xs, sm, md, lg, or xl');
@@ -381,6 +387,8 @@ const Button = (_ref, ref) => {
381
387
 
382
388
  var button = forwardRef(Button);
383
389
 
390
+ const _excluded$d = ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"];
391
+
384
392
  const Callout = (_ref, ref) => {
385
393
  let {
386
394
  label,
@@ -392,7 +400,7 @@ const Callout = (_ref, ref) => {
392
400
  tracking,
393
401
  sx
394
402
  } = _ref,
395
- props = _objectWithoutPropertiesLoose(_ref, ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"]);
403
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
396
404
 
397
405
  const baseColor = color || (inverted ? 'secondary' : 'primary');
398
406
  const hoverColor = color ? 'primary' : inverted ? 'primary' : 'secondary';
@@ -475,7 +483,8 @@ const Callout = (_ref, ref) => {
475
483
 
476
484
  var callout = forwardRef(Callout);
477
485
 
478
- const styles = {
486
+ const _excluded$c = ["colormap", "label", "clim", "setClim", "setClimStep", "discrete", "units", "width", "height", "format", "horizontal", "bottom", "sx", "sxClim"];
487
+ const styles$1 = {
479
488
  clim: setClim => {
480
489
  return {
481
490
  fontFamily: 'mono',
@@ -568,7 +577,7 @@ const Label = ({
568
577
  }
569
578
  }, units)));
570
579
 
571
- const Colorbar = (_ref) => {
580
+ const Colorbar = _ref => {
572
581
  let {
573
582
  colormap,
574
583
  label,
@@ -585,7 +594,7 @@ const Colorbar = (_ref) => {
585
594
  sx,
586
595
  sxClim
587
596
  } = _ref,
588
- props = _objectWithoutPropertiesLoose(_ref, ["colormap", "label", "clim", "setClim", "setClimStep", "discrete", "units", "width", "height", "format", "horizontal", "bottom", "sx", "sxClim"]);
597
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
589
598
 
590
599
  if (!Array.isArray(colormap)) {
591
600
  throw new Error(`expected array for colormap, got '${colormap}'.`);
@@ -686,7 +695,7 @@ const Colorbar = (_ref) => {
686
695
  id: "min",
687
696
  ref: climRef[0],
688
697
  tabIndex: 0,
689
- sx: _extends({}, styles.clim(setClim), {
698
+ sx: _extends({}, styles$1.clim(setClim), {
690
699
  ml: label ? horizontal ? bottom ? '0px' : '10px' : ['2px', '1px', '1px', '2px'] : 0,
691
700
  mr: horizontal ? ['2px', '1px', '1px', '2px'] : 0,
692
701
  mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px'],
@@ -707,7 +716,7 @@ const Colorbar = (_ref) => {
707
716
  id: "max",
708
717
  ref: climRef[1],
709
718
  tabIndex: 0,
710
- sx: _extends({}, styles.clim(setClim), {
719
+ sx: _extends({}, styles$1.clim(setClim), {
711
720
  ml: horizontal ? ['2px', '1px', '1px', '2px'] : ['2px', '1px', '1px', '2px'],
712
721
  mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px'],
713
722
  borderBottom: setClim ? climMaxDragging ? ({
@@ -765,7 +774,9 @@ const Colorbar = (_ref) => {
765
774
  }, clim && /*#__PURE__*/React.createElement(ClimMin, null), clim && /*#__PURE__*/React.createElement(ClimMax, null)));
766
775
  };
767
776
 
768
- const Column = (_ref) => {
777
+ const _excluded$b = ["start", "width", "dl", "dr", "children", "sx"];
778
+
779
+ const Column = _ref => {
769
780
  let {
770
781
  start,
771
782
  width,
@@ -774,7 +785,7 @@ const Column = (_ref) => {
774
785
  children,
775
786
  sx
776
787
  } = _ref,
777
- props = _objectWithoutPropertiesLoose(_ref, ["start", "width", "dl", "dr", "children", "sx"]);
788
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
778
789
 
779
790
  start = start || 'auto';
780
791
  width = width || 'auto';
@@ -942,7 +953,7 @@ const Meta = ({
942
953
  }));
943
954
  };
944
955
 
945
- const Logo = (_ref) => {
956
+ const Logo = _ref => {
946
957
  let props = _extends({}, _ref);
947
958
 
948
959
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -978,14 +989,16 @@ const Logo = (_ref) => {
978
989
  })));
979
990
  };
980
991
 
981
- const Row = (_ref) => {
992
+ const _excluded$a = ["children", "sx", "columns", "gap"];
993
+
994
+ const Row = _ref => {
982
995
  let {
983
996
  children,
984
997
  sx,
985
998
  columns,
986
999
  gap
987
1000
  } = _ref,
988
- props = _objectWithoutPropertiesLoose(_ref, ["children", "sx", "columns", "gap"]);
1001
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
989
1002
 
990
1003
  const makeArray = input => {
991
1004
  if (!Array.isArray(input)) {
@@ -1033,12 +1046,14 @@ const Row = (_ref) => {
1033
1046
  }), children);
1034
1047
  };
1035
1048
 
1036
- const Menu = (_ref) => {
1049
+ const _excluded$9 = ["value", "sx"];
1050
+
1051
+ const Menu = _ref => {
1037
1052
  let {
1038
1053
  value,
1039
1054
  sx
1040
1055
  } = _ref,
1041
- props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
1056
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
1042
1057
 
1043
1058
  return /*#__PURE__*/React.createElement(IconButton, _extends({
1044
1059
  sx: _extends({
@@ -1126,7 +1141,7 @@ const Menu = (_ref) => {
1126
1141
  })));
1127
1142
  };
1128
1143
 
1129
- const sx = {
1144
+ const sx$1 = {
1130
1145
  link: (current, label, first = false) => {
1131
1146
  return {
1132
1147
  width: 'auto',
@@ -1208,12 +1223,12 @@ const Nav = ({
1208
1223
  onClick: () => {
1209
1224
  if (nav === url) setExpanded(false);
1210
1225
  },
1211
- sx: sx.link(nav, url, first)
1226
+ sx: sx$1.link(nav, url, first)
1212
1227
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display));
1213
1228
  } else {
1214
1229
  return /*#__PURE__*/React.createElement(Link$2, {
1215
1230
  href: href,
1216
- sx: sx.link(nav, url, first)
1231
+ sx: sx$1.link(nav, url, first)
1217
1232
  }, /*#__PURE__*/React.createElement(HoverArrow, null), display);
1218
1233
  }
1219
1234
  };
@@ -1358,7 +1373,7 @@ const Header = ({
1358
1373
  })))))));
1359
1374
  };
1360
1375
 
1361
- const Monogram = (_ref) => {
1376
+ const Monogram = _ref => {
1362
1377
  let props = _extends({}, _ref);
1363
1378
 
1364
1379
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -1525,11 +1540,13 @@ const Footer = () => {
1525
1540
  }))));
1526
1541
  };
1527
1542
 
1528
- const Dimmer = (_ref) => {
1543
+ const _excluded$8 = ["sx"];
1544
+
1545
+ const Dimmer = _ref => {
1529
1546
  let {
1530
1547
  sx
1531
1548
  } = _ref,
1532
- props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
1549
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
1533
1550
 
1534
1551
  const [colorMode, setColorMode] = useColorMode();
1535
1552
  const toggle = useCallback(() => {
@@ -1712,6 +1729,7 @@ function scrollFraction(window, documnt) {
1712
1729
  return Math.min(window.scrollY / (document.body.offsetHeight - 770), 0.99);
1713
1730
  }
1714
1731
 
1732
+ const _excluded$7 = ["duration", "delay", "children"];
1715
1733
  const fade = keyframes({
1716
1734
  from: {
1717
1735
  opacity: 0
@@ -1721,13 +1739,13 @@ const fade = keyframes({
1721
1739
  }
1722
1740
  });
1723
1741
 
1724
- const FadeIn = (_ref) => {
1742
+ const FadeIn = _ref => {
1725
1743
  let {
1726
1744
  duration = 300,
1727
1745
  delay = 0,
1728
1746
  children
1729
1747
  } = _ref,
1730
- delegated = _objectWithoutPropertiesLoose(_ref, ["duration", "delay", "children"]);
1748
+ delegated = _objectWithoutPropertiesLoose(_ref, _excluded$7);
1731
1749
 
1732
1750
  return /*#__PURE__*/React.createElement(Box, _extends({}, delegated, {
1733
1751
  sx: {
@@ -1868,12 +1886,14 @@ function GuideColumns({
1868
1886
  }));
1869
1887
  }
1870
1888
 
1871
- const Settings = (_ref) => {
1889
+ const _excluded$6 = ["value", "sx"];
1890
+
1891
+ const Settings = _ref => {
1872
1892
  let {
1873
1893
  value,
1874
1894
  sx
1875
1895
  } = _ref,
1876
- props = _objectWithoutPropertiesLoose(_ref, ["value", "sx"]);
1896
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1877
1897
 
1878
1898
  return /*#__PURE__*/React.createElement(IconButton, _extends({
1879
1899
  sx: _extends({
@@ -2014,18 +2034,18 @@ const Layout = ({
2014
2034
  useEffect(() => {
2015
2035
  if (!theme) return;
2016
2036
 
2017
- const handler = () => {
2018
- if (settings != null && settings.value && settings != null && settings.onClick) {
2037
+ const handler = e => {
2038
+ if (e.matches && settings != null && settings.value && settings != null && settings.onClick) {
2019
2039
  settings == null ? void 0 : settings.onClick();
2020
2040
  }
2021
2041
  };
2022
2042
 
2023
- const query = window.matchMedia(`(max-width: ${theme.breakpoints[1]})`);
2024
- query.addListener(handler);
2043
+ const query = window.matchMedia(`(min-width: ${theme.breakpoints[1]})`);
2044
+ query.onchange = handler;
2025
2045
  return () => {
2026
- query.removeListener(handler);
2046
+ query.onchange = null;
2027
2047
  };
2028
- }, [theme, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2048
+ }, [theme == null ? void 0 : theme.breakpoints, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2029
2049
  const menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2030
2050
  key: "dimmer",
2031
2051
  sx: {
@@ -2186,14 +2206,16 @@ const Expander = ({
2186
2206
  })));
2187
2207
  };
2188
2208
 
2189
- const Tag = (_ref) => {
2209
+ const _excluded$5 = ["label", "value", "sx", "children"];
2210
+
2211
+ const Tag = _ref => {
2190
2212
  let {
2191
2213
  label,
2192
2214
  value,
2193
2215
  sx,
2194
2216
  children
2195
2217
  } = _ref,
2196
- props = _objectWithoutPropertiesLoose(_ref, ["label", "value", "sx", "children"]);
2218
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2197
2219
 
2198
2220
  const color = sx && sx.color ? sx.color : 'primary';
2199
2221
  const isClickable = props && (props.onClick || props.onDoubleClick);
@@ -2227,7 +2249,8 @@ const Tag = (_ref) => {
2227
2249
  }, props), children);
2228
2250
  };
2229
2251
 
2230
- const sx$1 = {
2252
+ const _excluded$4 = ["values", "setValues", "label", "colors", "showAll", "multiSelect"];
2253
+ const sx = {
2231
2254
  label: {
2232
2255
  fontFamily: 'mono',
2233
2256
  letterSpacing: 'mono',
@@ -2288,7 +2311,7 @@ const updateValues = ({
2288
2311
  }
2289
2312
  };
2290
2313
 
2291
- const Filter = (_ref) => {
2314
+ const Filter = _ref => {
2292
2315
  let {
2293
2316
  values,
2294
2317
  setValues,
@@ -2297,10 +2320,10 @@ const Filter = (_ref) => {
2297
2320
  showAll = false,
2298
2321
  multiSelect = false
2299
2322
  } = _ref,
2300
- props = _objectWithoutPropertiesLoose(_ref, ["values", "setValues", "label", "colors", "showAll", "multiSelect"]);
2323
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2301
2324
 
2302
2325
  return /*#__PURE__*/React.createElement(Box, props, label && /*#__PURE__*/React.createElement(Box, {
2303
- sx: sx$1.label
2326
+ sx: sx.label
2304
2327
  }, label), /*#__PURE__*/React.createElement(Box, {
2305
2328
  sx: {
2306
2329
  mt: label ? [3] : 0
@@ -2384,13 +2407,15 @@ const Group = ({
2384
2407
  }));
2385
2408
  };
2386
2409
 
2410
+ const _excluded$3 = ["size", "inverted", "sx"];
2411
+
2387
2412
  const Input = (_ref, ref) => {
2388
2413
  let {
2389
2414
  size = 'sm',
2390
2415
  inverted,
2391
2416
  sx
2392
2417
  } = _ref,
2393
- props = _objectWithoutPropertiesLoose(_ref, ["size", "inverted", "sx"]);
2418
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
2394
2419
 
2395
2420
  const defaultColor = inverted ? 'secondary' : 'primary';
2396
2421
 
@@ -2441,14 +2466,16 @@ const getProps = test => props => {
2441
2466
  return next;
2442
2467
  };
2443
2468
 
2444
- const Select = (_ref) => {
2469
+ const _excluded$2 = ["children", "size", "sx", "sxSelect"];
2470
+
2471
+ const Select = _ref => {
2445
2472
  let {
2446
2473
  children,
2447
2474
  size = 'sm',
2448
2475
  sx,
2449
2476
  sxSelect
2450
2477
  } = _ref,
2451
- props = _objectWithoutPropertiesLoose(_ref, ["children", "size", "sx", "sxSelect"]);
2478
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2452
2479
 
2453
2480
  const color = sx && sx.color ? sx.color : 'primary';
2454
2481
  const sizeStyles = getSizeStyles(size);
@@ -2535,11 +2562,13 @@ const Select = (_ref) => {
2535
2562
  }));
2536
2563
  };
2537
2564
 
2565
+ const _excluded$1 = ["sx"];
2566
+
2538
2567
  const Slider = (_ref, ref) => {
2539
2568
  let {
2540
2569
  sx
2541
2570
  } = _ref,
2542
- props = _objectWithoutPropertiesLoose(_ref, ["sx"]);
2571
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2543
2572
 
2544
2573
  const color = sx && sx.color ? sx.color : 'primary';
2545
2574
  const {
@@ -2582,7 +2611,7 @@ const Slider = (_ref, ref) => {
2582
2611
 
2583
2612
  var slider = forwardRef(Slider);
2584
2613
 
2585
- const styles$1 = {
2614
+ const styles = {
2586
2615
  reset: {
2587
2616
  verticalAlign: 'baseline',
2588
2617
  border: 0,
@@ -2651,7 +2680,7 @@ const Table = ({
2651
2680
  }
2652
2681
  }, header && /*#__PURE__*/React.createElement(Row, {
2653
2682
  as: "tr",
2654
- sx: _extends({}, styles$1.reset, styles$1.header, styles$1.row, {
2683
+ sx: _extends({}, styles.reset, styles.header, styles.row, {
2655
2684
  color: color,
2656
2685
  borderTopWidth: !_borderTop ? '0px' : '1px'
2657
2686
  })
@@ -2659,13 +2688,13 @@ const Table = ({
2659
2688
  as: "td",
2660
2689
  start: [1],
2661
2690
  width: columns,
2662
- sx: styles$1.index
2691
+ sx: styles.index
2663
2692
  }, header)), data.map((row, i) => {
2664
2693
  return /*#__PURE__*/React.createElement(Row, {
2665
2694
  as: "tr",
2666
2695
  columns: columns,
2667
2696
  key: i,
2668
- sx: _extends({}, styles$1.reset, styles$1.row, {
2697
+ sx: _extends({}, styles.reset, styles.row, {
2669
2698
  pb: _borderBottom && i === data.length - 1 ? ['18px', '18px', '18px', '22px'] : [3, 3, 3, '20px'],
2670
2699
  borderBottomWidth: _borderBottom && i === data.length - 1 ? '1px' : '0px',
2671
2700
  borderTopWidth: !_borderTop && i === 0 && !header ? '0px' : '1px'
@@ -2676,12 +2705,14 @@ const Table = ({
2676
2705
  key: j,
2677
2706
  start: start[j],
2678
2707
  width: width[j],
2679
- sx: j == 0 && _index ? _extends({}, styles$1.reset, styles$1.index) : _extends({}, styles$1.reset, styles$1.entry)
2708
+ sx: j == 0 && _index ? _extends({}, styles.reset, styles.index) : _extends({}, styles.reset, styles.entry)
2680
2709
  }, column);
2681
2710
  }));
2682
2711
  })));
2683
2712
  };
2684
2713
 
2714
+ const _excluded = ["value", "onClick", "disabled", "sx"];
2715
+
2685
2716
  const Toggle = (_ref, ref) => {
2686
2717
  let {
2687
2718
  value,
@@ -2689,7 +2720,7 @@ const Toggle = (_ref, ref) => {
2689
2720
  disabled,
2690
2721
  sx
2691
2722
  } = _ref,
2692
- props = _objectWithoutPropertiesLoose(_ref, ["value", "onClick", "disabled", "sx"]);
2723
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
2693
2724
 
2694
2725
  const color = sx && sx.color ? sx.color : 'primary';
2695
2726
  value = disabled ? false : value;