@carbonplan/components 11.0.1 → 11.0.5-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.
package/dst/index.esm.js CHANGED
@@ -4,7 +4,6 @@ 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';
8
7
  import Head from 'next/head';
9
8
  import { keyframes } from '@emotion/react';
10
9
 
@@ -540,7 +539,7 @@ var Label = function Label(_ref5) {
540
539
  horizontal = _ref5.horizontal;
541
540
  return /*#__PURE__*/React.createElement(Box, {
542
541
  sx: !horizontal && {
543
- width: ['12px', '17px', '17px', '19px'],
542
+ width: ['13px', '17px', '17px', '19px'],
544
543
  alignSelf: 'flex-end'
545
544
  }
546
545
  }, /*#__PURE__*/React.createElement(Box, {
@@ -2039,7 +2038,6 @@ var Layout = function Layout(_ref) {
2039
2038
  _ref$container = _ref.container,
2040
2039
  container = _ref$container === void 0 ? true : _ref$container;
2041
2040
  var content = children;
2042
- var index = useBreakpointIndex();
2043
2041
 
2044
2042
  if (fade) {
2045
2043
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -2055,11 +2053,24 @@ var Layout = function Layout(_ref) {
2055
2053
  }, /*#__PURE__*/React.createElement(Container, null, content));
2056
2054
  }
2057
2055
 
2056
+ var _useThemeUI = useThemeUI(),
2057
+ theme = _useThemeUI.theme;
2058
+
2058
2059
  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]);
2060
+ if (!theme) return;
2061
+
2062
+ var handler = function handler() {
2063
+ if (settings != null && settings.value && settings != null && settings.onClick) {
2064
+ settings == null ? void 0 : settings.onClick();
2065
+ }
2066
+ };
2067
+
2068
+ var query = window.matchMedia("(max-width: " + theme.breakpoints[1] + ")");
2069
+ query.addListener(handler);
2070
+ return function () {
2071
+ query.removeListener(handler);
2072
+ };
2073
+ }, [theme, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2063
2074
  var menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2064
2075
  key: "dimmer",
2065
2076
  sx: {
@@ -2073,6 +2084,7 @@ var Layout = function Layout(_ref) {
2073
2084
  menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2074
2085
  key: "settings",
2075
2086
  sx: {
2087
+ mr: ['2px'],
2076
2088
  display: ['inherit', 'inherit', 'none', 'none']
2077
2089
  }
2078
2090
  }, settings)));