@planningcenter/tapestry-react 2.6.0-rc.0 → 2.6.0-rc.1

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.
@@ -19,6 +19,10 @@ var React = _interopRequireWildcard(require("react"));
19
19
 
20
20
  var _reactDom = require("react-dom");
21
21
 
22
+ var _styles = require("../ThemeProvider/styles");
23
+
24
+ var _react2 = require("@emotion/react");
25
+
22
26
  /** Accepts any additional HTML attributes. */
23
27
  var Portal = /*#__PURE__*/function (_React$Component) {
24
28
  (0, _inheritsLoose2["default"])(Portal, _React$Component);
@@ -31,6 +35,7 @@ var Portal = /*#__PURE__*/function (_React$Component) {
31
35
  }
32
36
 
33
37
  _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
38
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "context", void 0);
34
39
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_portalNode", null);
35
40
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_needsUpdate", false);
36
41
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_updated", false);
@@ -125,6 +130,8 @@ var Portal = /*#__PURE__*/function (_React$Component) {
125
130
  _this2._portalNode.setAttribute(key, restProps[key]);
126
131
  });
127
132
 
133
+ this._portalNode.setAttribute((0, _styles.getThemeDataAttribute)(this.context.id), 'true');
134
+
128
135
  if (style) {
129
136
  Object.keys(style).forEach(function (key) {
130
137
  _this2._portalNode.style[key] = style[key];
@@ -163,4 +170,5 @@ exports.Portal = Portal;
163
170
  (0, _defineProperty2["default"])(Portal, "defaultProps", {
164
171
  renderTag: 'div',
165
172
  renderTo: null
166
- });
173
+ });
174
+ (0, _defineProperty2["default"])(Portal, "contextType", _react2.ThemeContext);
@@ -4,6 +4,8 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
5
  import * as React from 'react';
6
6
  import { createPortal } from 'react-dom';
7
+ import { getThemeDataAttribute } from '../ThemeProvider/styles';
8
+ import { ThemeContext } from '@emotion/react';
7
9
 
8
10
  /** Accepts any additional HTML attributes. */
9
11
  var Portal = /*#__PURE__*/function (_React$Component) {
@@ -18,6 +20,8 @@ var Portal = /*#__PURE__*/function (_React$Component) {
18
20
 
19
21
  _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
20
22
 
23
+ _defineProperty(_assertThisInitialized(_this), "context", void 0);
24
+
21
25
  _defineProperty(_assertThisInitialized(_this), "_portalNode", null);
22
26
 
23
27
  _defineProperty(_assertThisInitialized(_this), "_needsUpdate", false);
@@ -116,6 +120,8 @@ var Portal = /*#__PURE__*/function (_React$Component) {
116
120
  _this2._portalNode.setAttribute(key, restProps[key]);
117
121
  });
118
122
 
123
+ this._portalNode.setAttribute(getThemeDataAttribute(this.context.id), 'true');
124
+
119
125
  if (style) {
120
126
  Object.keys(style).forEach(function (key) {
121
127
  _this2._portalNode.style[key] = style[key];
@@ -155,4 +161,6 @@ _defineProperty(Portal, "defaultProps", {
155
161
  renderTo: null
156
162
  });
157
163
 
164
+ _defineProperty(Portal, "contextType", ThemeContext);
165
+
158
166
  export { Portal };
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { Theme } from '../index';
2
3
  export declare type PortalProps = {
3
4
  children: any;
4
5
  /** Styles to apply to the portal root element. */
@@ -18,6 +19,8 @@ declare class Portal extends React.Component<PortalProps> {
18
19
  renderTag: string;
19
20
  renderTo: any;
20
21
  };
22
+ static contextType: import("react").Context<object>;
23
+ context: React.ContextType<React.Context<Theme>>;
21
24
  _portalNode: HTMLElement;
22
25
  _needsUpdate: boolean;
23
26
  _updated: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/tapestry-react",
3
- "version": "2.6.0-rc.0",
3
+ "version": "2.6.0-rc.1",
4
4
  "description": "A collection of flexible React components to help you build resilient, accessible user interfaces quickly and effectively.",
5
5
  "author": "Front End Systems Engineering <frontend@pco.bz>",
6
6
  "main": "dist/cjs/index.js",
@@ -1,5 +1,8 @@
1
1
  import * as React from 'react'
2
2
  import { createPortal } from 'react-dom'
3
+ import { getThemeDataAttribute } from '../ThemeProvider/styles'
4
+ import { ThemeContext } from '@emotion/react'
5
+ import { Theme } from '../index'
3
6
 
4
7
  export type PortalProps = {
5
8
  children: any
@@ -27,6 +30,9 @@ class Portal extends React.Component<PortalProps> {
27
30
  renderTo: null,
28
31
  }
29
32
 
33
+ static contextType = ThemeContext
34
+ context: React.ContextType<React.Context<Theme>>
35
+
30
36
  _portalNode: HTMLElement = null
31
37
  _needsUpdate = false
32
38
  _updated = false
@@ -105,6 +111,11 @@ class Portal extends React.Component<PortalProps> {
105
111
  Object.keys(restProps).forEach((key) => {
106
112
  this._portalNode.setAttribute(key, restProps[key])
107
113
  })
114
+ this._portalNode.setAttribute(
115
+ getThemeDataAttribute(this.context.id),
116
+ 'true'
117
+ )
118
+
108
119
  if (style) {
109
120
  Object.keys(style).forEach((key) => {
110
121
  this._portalNode.style[key] = style[key]