@carbonplan/components 11.0.4 → 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
 
@@ -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: {