@planningcenter/tapestry-react 2.6.0-rc.0 → 2.6.0-rc.2
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/dist/cjs/DataTable/DataTable.js +3 -3
- package/dist/cjs/DataTable/components/BodyRows.js +2 -2
- package/dist/cjs/DataTable/components/BodySubRows.js +2 -2
- package/dist/cjs/DataTable/components/CheckboxCell.js +4 -4
- package/dist/cjs/DataTable/components/Icon.js +1 -1
- package/dist/cjs/Portal/Portal.js +9 -1
- package/dist/cjs/ThemeProvider/styles.js +1 -4
- package/dist/cjs/Tooltip/Tooltip.js +17 -17
- package/dist/cjs/system/split-styles.js +3 -3
- package/dist/esm/DataTable/DataTable.js +3 -3
- package/dist/esm/DataTable/components/BodyRows.js +2 -2
- package/dist/esm/DataTable/components/BodySubRows.js +2 -2
- package/dist/esm/DataTable/components/CheckboxCell.js +4 -4
- package/dist/esm/DataTable/components/Icon.js +1 -1
- package/dist/esm/Portal/Portal.js +8 -0
- package/dist/esm/ThemeProvider/styles.js +1 -4
- package/dist/esm/Tooltip/Tooltip.js +18 -18
- package/dist/esm/system/split-styles.js +2 -2
- package/dist/types/Portal/Portal.d.ts +3 -0
- package/package.json +1 -1
- package/src/DataTable/DataTable.js +3 -9
- package/src/DataTable/components/BodyRows.js +2 -2
- package/src/DataTable/components/BodySubRows.js +2 -5
- package/src/DataTable/components/CheckboxCell.js +4 -5
- package/src/DataTable/components/Icon.js +1 -1
- package/src/Portal/Portal.tsx +11 -0
- package/src/ThemeProvider/styles.ts +14 -14
- package/src/Tooltip/Tooltip.js +20 -18
- package/src/system/split-styles.js +2 -2
|
@@ -205,7 +205,7 @@ var DataTable = function DataTable(props) {
|
|
|
205
205
|
style: isLoadingOrEmpty ? {
|
|
206
206
|
display: 'none'
|
|
207
207
|
} : undefined,
|
|
208
|
-
className:
|
|
208
|
+
className: css({
|
|
209
209
|
position: 'relative'
|
|
210
210
|
})
|
|
211
211
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -226,7 +226,7 @@ var DataTable = function DataTable(props) {
|
|
|
226
226
|
column: column,
|
|
227
227
|
columnIndex: columnIndex,
|
|
228
228
|
columnSort: columnSort,
|
|
229
|
-
className:
|
|
229
|
+
className: css([].concat(cellVariantClassName, [column.css]))
|
|
230
230
|
});
|
|
231
231
|
}))), bodyToRender, hasFooterColumns && /*#__PURE__*/_react["default"].createElement("div", {
|
|
232
232
|
ref: footerRef,
|
|
@@ -244,7 +244,7 @@ var DataTable = function DataTable(props) {
|
|
|
244
244
|
key: columnIndex,
|
|
245
245
|
role: "cell",
|
|
246
246
|
ref: getColumnRef(columnIndex + "." + (data.length + 1)),
|
|
247
|
-
className:
|
|
247
|
+
className: css([].concat(cellVariantClassName, [column.css]))
|
|
248
248
|
}, typeof column.footer === 'string' || /*#__PURE__*/_react["default"].isValidElement(column.footer) ? column.footer : column.footer ? /*#__PURE__*/_react["default"].createElement(column.footer, {
|
|
249
249
|
columnIndex: columnIndex
|
|
250
250
|
}) : null);
|
|
@@ -57,7 +57,7 @@ function BodyRows(_ref) {
|
|
|
57
57
|
ref: getColumnRef(columnIndex + "." + (rowIndex + 1)) // offset by 1 to account for header row
|
|
58
58
|
,
|
|
59
59
|
role: "cell",
|
|
60
|
-
className:
|
|
60
|
+
className: css([].concat(cellVariantStyles, [column.css]))
|
|
61
61
|
}, (0, _utils.getCell)(column.cell, {
|
|
62
62
|
columnIndex: columnIndex,
|
|
63
63
|
rowData: rowData,
|
|
@@ -83,7 +83,7 @@ function BodyRows(_ref) {
|
|
|
83
83
|
rowIndex: rowIndex,
|
|
84
84
|
keyboardShortcuts: keyboardShortcuts,
|
|
85
85
|
onRowClick: onRowClick,
|
|
86
|
-
className:
|
|
86
|
+
className: css(rowVariantClassName)
|
|
87
87
|
}, (0, _utils.getRowLinkProps)({
|
|
88
88
|
getRowLink: getRowLink,
|
|
89
89
|
data: rowData,
|
|
@@ -71,7 +71,7 @@ var BodySubRows = function BodySubRows(_ref2) {
|
|
|
71
71
|
rowIndex: rowIndex,
|
|
72
72
|
keyboardShortcuts: keyboardShortcuts,
|
|
73
73
|
onRowClick: onRowClick,
|
|
74
|
-
className:
|
|
74
|
+
className: css(rowVariantClassName)
|
|
75
75
|
}, (0, _utils.getRowLinkProps)({
|
|
76
76
|
getRowLink: getRowLink,
|
|
77
77
|
data: rowData,
|
|
@@ -90,7 +90,7 @@ var BodySubRows = function BodySubRows(_ref2) {
|
|
|
90
90
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
91
91
|
key: columnIndex,
|
|
92
92
|
ref: getColumnRef(columnIndex + "." + (parentRowIndex + 1) + "." + rowIndex),
|
|
93
|
-
className:
|
|
93
|
+
className: css([].concat(cellVariantClassName, [column.css]))
|
|
94
94
|
}, (0, _utils.getCell)(column.subCell !== undefined ? column.subCell : column.cell, {
|
|
95
95
|
columnIndex: columnIndex,
|
|
96
96
|
rowData: rowData,
|
|
@@ -96,19 +96,19 @@ function CheckboxCell(_ref) {
|
|
|
96
96
|
onKeyDown: function onKeyDown(event) {
|
|
97
97
|
return event.key === ' ' && handleChange(event);
|
|
98
98
|
},
|
|
99
|
-
className: "tapestry-react-
|
|
99
|
+
className: "tapestry-react-Checkbox",
|
|
100
100
|
css: cssStyles
|
|
101
101
|
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"].Path, {
|
|
102
102
|
name: iconPaths.fill,
|
|
103
|
-
className: "tapestry-react-
|
|
103
|
+
className: "tapestry-react-Checkbox-Fill",
|
|
104
104
|
fill: checked || indeterminate ? 'primary' : 'surfaceTertiary',
|
|
105
105
|
stroke: checked || indeterminate ? 'primary' : 'separatorSecondary'
|
|
106
106
|
}), /*#__PURE__*/_react["default"].createElement(_Icon["default"].Path, {
|
|
107
107
|
name: iconPaths.minus,
|
|
108
|
-
className: "tapestry-react-
|
|
108
|
+
className: "tapestry-react-Checkbox-Minus"
|
|
109
109
|
}), /*#__PURE__*/_react["default"].createElement(_Icon["default"].Path, {
|
|
110
110
|
name: iconPaths.checked,
|
|
111
|
-
className: "tapestry-react-
|
|
111
|
+
className: "tapestry-react-Checkbox-Checked"
|
|
112
112
|
}));
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -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);
|
|
@@ -35,7 +35,7 @@ var setRootStyles = function setRootStyles(themeId, styles) {
|
|
|
35
35
|
exports.setRootStyles = setRootStyles;
|
|
36
36
|
var defaultColorProperties = (0, _utils.objectToCSSProperties)('colors', (0, _system.flattenPalette)(_system.defaultTheme.colors));
|
|
37
37
|
exports.defaultColorProperties = defaultColorProperties;
|
|
38
|
-
var styleReset = ("\n" + getRootStyles(null, defaultColorProperties) + "\n\n
|
|
38
|
+
var styleReset = ("\n" + getRootStyles(null, defaultColorProperties) + "\n\n[class^=\"tapestry-react\"] {\n appearance: none;\n border-width: 0px;\n border-style: solid;\n border-color: transparent;\n box-sizing: border-box;\n color: inherit;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: auto;\n font-weight: 400;\n margin: 0px;\n min-height: 0px;\n min-width: 0px;\n padding: 0px;\n text-decoration: none;\n}\n\n[class^=\"tapestry-react\"]::-moz-focus-inner {\n border: none;\n padding: 0px;\n}\n\n[class^=\"tapestry-react\"]:focus:not(.focus-visible) {\n outline: 0px;\n}\n" // minify string
|
|
39
39
|
).replace(/\n/g, '').replace(/\s\s+/g, ' '); // we use our own global style implementation in place of Emotion Global
|
|
40
40
|
// so we can have more control over when styles are injected since multiple
|
|
41
41
|
// Providers can be used on a page
|
|
@@ -43,9 +43,6 @@ var styleReset = ("\n" + getRootStyles(null, defaultColorProperties) + "\n\n.tap
|
|
|
43
43
|
exports.styleReset = styleReset;
|
|
44
44
|
|
|
45
45
|
function ensureStyleElement(themeId) {
|
|
46
|
-
// we use our own global style implementation in place of Emotion Global
|
|
47
|
-
// so we can have more control over when styles are injected since multiple
|
|
48
|
-
// Providers can be used on a page
|
|
49
46
|
if (typeof window !== 'undefined' && !document.getElementById("tapestry-react-style-" + themeId)) {
|
|
50
47
|
var styleElement = document.createElement('style');
|
|
51
48
|
styleElement.id = "tapestry-react-style-" + themeId;
|
|
@@ -60,8 +60,8 @@ function Tooltip(props, ref) {
|
|
|
60
60
|
var isPageInView = true;
|
|
61
61
|
var isFocused = false;
|
|
62
62
|
var isMouseDown = false;
|
|
63
|
-
var openTimeoutId = null;
|
|
64
|
-
var closeTimeoutId = null; // prevents tooltips showing when focused and navigating back to a page after leaving
|
|
63
|
+
var openTimeoutId = (0, _react.useRef)(null);
|
|
64
|
+
var closeTimeoutId = (0, _react.useRef)(null); // prevents tooltips showing when focused and navigating back to a page after leaving
|
|
65
65
|
|
|
66
66
|
var cleanupPageViewChange = (0, _react.useCallback)((0, _utils.pageViewChange)(function (inView) {
|
|
67
67
|
return setTimeout(function () {
|
|
@@ -77,21 +77,21 @@ function Tooltip(props, ref) {
|
|
|
77
77
|
emitter.on('CLOSE_OPEN_TOOLTIPS', close);
|
|
78
78
|
return function () {
|
|
79
79
|
emitter.off('CLOSE_OPEN_TOOLTIPS', close);
|
|
80
|
-
clearTimeout(openTimeoutId);
|
|
81
|
-
clearTimeout(closeTimeoutId);
|
|
80
|
+
clearTimeout(openTimeoutId.current);
|
|
81
|
+
clearTimeout(closeTimeoutId.current);
|
|
82
82
|
cleanupPageViewChange();
|
|
83
83
|
};
|
|
84
84
|
}, []);
|
|
85
85
|
|
|
86
86
|
var open = function open() {
|
|
87
|
-
clearTimeout(closeTimeoutId);
|
|
88
|
-
closeTimeoutId = null;
|
|
87
|
+
clearTimeout(closeTimeoutId.current);
|
|
88
|
+
closeTimeoutId.current = null;
|
|
89
89
|
setIsPopoverOpen(true);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
var close = function close() {
|
|
93
|
-
clearTimeout(openTimeoutId);
|
|
94
|
-
openTimeoutId = null;
|
|
93
|
+
clearTimeout(openTimeoutId.current);
|
|
94
|
+
openTimeoutId.current = null;
|
|
95
95
|
setIsPopoverOpen(false);
|
|
96
96
|
};
|
|
97
97
|
|
|
@@ -119,13 +119,13 @@ function Tooltip(props, ref) {
|
|
|
119
119
|
var createOpenTimeout = (0, _react.useCallback)(function () {
|
|
120
120
|
clearGlobalTimeout();
|
|
121
121
|
|
|
122
|
-
if (openTimeoutId === null) {
|
|
123
|
-
clearTimeout(closeTimeoutId);
|
|
124
|
-
closeTimeoutId = null;
|
|
122
|
+
if (openTimeoutId.current === null) {
|
|
123
|
+
clearTimeout(closeTimeoutId.current);
|
|
124
|
+
closeTimeoutId.current = null;
|
|
125
125
|
|
|
126
126
|
if (isPopoverOpen === false) {
|
|
127
127
|
emitter.emit('CLOSE_OPEN_TOOLTIPS');
|
|
128
|
-
openTimeoutId = setTimeout(function () {
|
|
128
|
+
openTimeoutId.current = setTimeout(function () {
|
|
129
129
|
return open();
|
|
130
130
|
}, instantDelay ? 0 : openDelay);
|
|
131
131
|
}
|
|
@@ -134,11 +134,11 @@ function Tooltip(props, ref) {
|
|
|
134
134
|
var createCloseTimeout = (0, _react.useCallback)(function () {
|
|
135
135
|
startGlobalTimeout();
|
|
136
136
|
|
|
137
|
-
if (closeTimeoutId === null) {
|
|
138
|
-
clearTimeout(openTimeoutId);
|
|
139
|
-
openTimeoutId = null;
|
|
140
|
-
closeTimeoutId = setTimeout(function () {
|
|
141
|
-
close();
|
|
137
|
+
if (closeTimeoutId.current === null) {
|
|
138
|
+
clearTimeout(openTimeoutId.current);
|
|
139
|
+
openTimeoutId.current = null;
|
|
140
|
+
closeTimeoutId.current = setTimeout(function () {
|
|
141
|
+
return close();
|
|
142
142
|
}, closeDelay);
|
|
143
143
|
}
|
|
144
144
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports["default"] =
|
|
6
|
+
exports["default"] = SplitStyles;
|
|
7
7
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
|
|
@@ -17,7 +17,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
17
17
|
|
|
18
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
function SplitStyles(_ref) {
|
|
21
21
|
var className = _ref.className,
|
|
22
22
|
_ref$mediaQueries = _ref.mediaQueries,
|
|
23
23
|
mediaQueries = _ref$mediaQueries === void 0 ? {} : _ref$mediaQueries,
|
|
@@ -46,7 +46,7 @@ function _default(_ref) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return _objectSpread(_objectSpread({}, restProps), {}, {
|
|
49
|
-
className: className
|
|
49
|
+
className: className,
|
|
50
50
|
css: function css(theme) {
|
|
51
51
|
var propStyles = {};
|
|
52
52
|
|
|
@@ -182,7 +182,7 @@ var DataTable = function DataTable(props) {
|
|
|
182
182
|
style: isLoadingOrEmpty ? {
|
|
183
183
|
display: 'none'
|
|
184
184
|
} : undefined,
|
|
185
|
-
className:
|
|
185
|
+
className: css({
|
|
186
186
|
position: 'relative'
|
|
187
187
|
})
|
|
188
188
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -203,7 +203,7 @@ var DataTable = function DataTable(props) {
|
|
|
203
203
|
column: column,
|
|
204
204
|
columnIndex: columnIndex,
|
|
205
205
|
columnSort: columnSort,
|
|
206
|
-
className:
|
|
206
|
+
className: css([].concat(cellVariantClassName, [column.css]))
|
|
207
207
|
});
|
|
208
208
|
}))), bodyToRender, hasFooterColumns && /*#__PURE__*/React.createElement("div", {
|
|
209
209
|
ref: footerRef,
|
|
@@ -221,7 +221,7 @@ var DataTable = function DataTable(props) {
|
|
|
221
221
|
key: columnIndex,
|
|
222
222
|
role: "cell",
|
|
223
223
|
ref: getColumnRef(columnIndex + "." + (data.length + 1)),
|
|
224
|
-
className:
|
|
224
|
+
className: css([].concat(cellVariantClassName, [column.css]))
|
|
225
225
|
}, typeof column.footer === 'string' || /*#__PURE__*/React.isValidElement(column.footer) ? column.footer : column.footer ? /*#__PURE__*/React.createElement(column.footer, {
|
|
226
226
|
columnIndex: columnIndex
|
|
227
227
|
}) : null);
|
|
@@ -42,7 +42,7 @@ function BodyRows(_ref) {
|
|
|
42
42
|
ref: getColumnRef(columnIndex + "." + (rowIndex + 1)) // offset by 1 to account for header row
|
|
43
43
|
,
|
|
44
44
|
role: "cell",
|
|
45
|
-
className:
|
|
45
|
+
className: css([].concat(cellVariantStyles, [column.css]))
|
|
46
46
|
}, getCell(column.cell, {
|
|
47
47
|
columnIndex: columnIndex,
|
|
48
48
|
rowData: rowData,
|
|
@@ -68,7 +68,7 @@ function BodyRows(_ref) {
|
|
|
68
68
|
rowIndex: rowIndex,
|
|
69
69
|
keyboardShortcuts: keyboardShortcuts,
|
|
70
70
|
onRowClick: onRowClick,
|
|
71
|
-
className:
|
|
71
|
+
className: css(rowVariantClassName)
|
|
72
72
|
}, getRowLinkProps({
|
|
73
73
|
getRowLink: getRowLink,
|
|
74
74
|
data: rowData,
|
|
@@ -58,7 +58,7 @@ var BodySubRows = function BodySubRows(_ref2) {
|
|
|
58
58
|
rowIndex: rowIndex,
|
|
59
59
|
keyboardShortcuts: keyboardShortcuts,
|
|
60
60
|
onRowClick: onRowClick,
|
|
61
|
-
className:
|
|
61
|
+
className: css(rowVariantClassName)
|
|
62
62
|
}, getRowLinkProps({
|
|
63
63
|
getRowLink: getRowLink,
|
|
64
64
|
data: rowData,
|
|
@@ -77,7 +77,7 @@ var BodySubRows = function BodySubRows(_ref2) {
|
|
|
77
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
78
78
|
key: columnIndex,
|
|
79
79
|
ref: getColumnRef(columnIndex + "." + (parentRowIndex + 1) + "." + rowIndex),
|
|
80
|
-
className:
|
|
80
|
+
className: css([].concat(cellVariantClassName, [column.css]))
|
|
81
81
|
}, getCell(column.subCell !== undefined ? column.subCell : column.cell, {
|
|
82
82
|
columnIndex: columnIndex,
|
|
83
83
|
rowData: rowData,
|
|
@@ -85,19 +85,19 @@ function CheckboxCell(_ref) {
|
|
|
85
85
|
onKeyDown: function onKeyDown(event) {
|
|
86
86
|
return event.key === ' ' && handleChange(event);
|
|
87
87
|
},
|
|
88
|
-
className: "tapestry-react-
|
|
88
|
+
className: "tapestry-react-Checkbox",
|
|
89
89
|
css: cssStyles
|
|
90
90
|
}, /*#__PURE__*/React.createElement(Icon.Path, {
|
|
91
91
|
name: iconPaths.fill,
|
|
92
|
-
className: "tapestry-react-
|
|
92
|
+
className: "tapestry-react-Checkbox-Fill",
|
|
93
93
|
fill: checked || indeterminate ? 'primary' : 'surfaceTertiary',
|
|
94
94
|
stroke: checked || indeterminate ? 'primary' : 'separatorSecondary'
|
|
95
95
|
}), /*#__PURE__*/React.createElement(Icon.Path, {
|
|
96
96
|
name: iconPaths.minus,
|
|
97
|
-
className: "tapestry-react-
|
|
97
|
+
className: "tapestry-react-Checkbox-Minus"
|
|
98
98
|
}), /*#__PURE__*/React.createElement(Icon.Path, {
|
|
99
99
|
name: iconPaths.checked,
|
|
100
|
-
className: "tapestry-react-
|
|
100
|
+
className: "tapestry-react-Checkbox-Checked"
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -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 };
|
|
@@ -24,15 +24,12 @@ export var setRootStyles = function setRootStyles(themeId, styles) {
|
|
|
24
24
|
sheet.insertRule(styleString, 0);
|
|
25
25
|
};
|
|
26
26
|
export var defaultColorProperties = objectToCSSProperties('colors', flattenPalette(defaultTheme.colors));
|
|
27
|
-
export var styleReset = ("\n" + getRootStyles(null, defaultColorProperties) + "\n\n
|
|
27
|
+
export var styleReset = ("\n" + getRootStyles(null, defaultColorProperties) + "\n\n[class^=\"tapestry-react\"] {\n appearance: none;\n border-width: 0px;\n border-style: solid;\n border-color: transparent;\n box-sizing: border-box;\n color: inherit;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: auto;\n font-weight: 400;\n margin: 0px;\n min-height: 0px;\n min-width: 0px;\n padding: 0px;\n text-decoration: none;\n}\n\n[class^=\"tapestry-react\"]::-moz-focus-inner {\n border: none;\n padding: 0px;\n}\n\n[class^=\"tapestry-react\"]:focus:not(.focus-visible) {\n outline: 0px;\n}\n" // minify string
|
|
28
28
|
).replace(/\n/g, '').replace(/\s\s+/g, ' '); // we use our own global style implementation in place of Emotion Global
|
|
29
29
|
// so we can have more control over when styles are injected since multiple
|
|
30
30
|
// Providers can be used on a page
|
|
31
31
|
|
|
32
32
|
function ensureStyleElement(themeId) {
|
|
33
|
-
// we use our own global style implementation in place of Emotion Global
|
|
34
|
-
// so we can have more control over when styles are injected since multiple
|
|
35
|
-
// Providers can be used on a page
|
|
36
33
|
if (typeof window !== 'undefined' && !document.getElementById("tapestry-react-style-" + themeId)) {
|
|
37
34
|
var styleElement = document.createElement('style');
|
|
38
35
|
styleElement.id = "tapestry-react-style-" + themeId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { Children, cloneElement, forwardRef, useState, useCallback, useImperativeHandle, useEffect } from 'react';
|
|
3
|
+
import React, { Children, cloneElement, forwardRef, useRef, useState, useCallback, useImperativeHandle, useEffect } from 'react';
|
|
4
4
|
import mitt from 'mitt';
|
|
5
5
|
import Popover from '../Popover';
|
|
6
6
|
import { composeEvents, pageViewChange } from '../utils';
|
|
@@ -44,8 +44,8 @@ function Tooltip(props, ref) {
|
|
|
44
44
|
var isPageInView = true;
|
|
45
45
|
var isFocused = false;
|
|
46
46
|
var isMouseDown = false;
|
|
47
|
-
var openTimeoutId = null;
|
|
48
|
-
var closeTimeoutId = null; // prevents tooltips showing when focused and navigating back to a page after leaving
|
|
47
|
+
var openTimeoutId = useRef(null);
|
|
48
|
+
var closeTimeoutId = useRef(null); // prevents tooltips showing when focused and navigating back to a page after leaving
|
|
49
49
|
|
|
50
50
|
var cleanupPageViewChange = useCallback(pageViewChange(function (inView) {
|
|
51
51
|
return setTimeout(function () {
|
|
@@ -61,21 +61,21 @@ function Tooltip(props, ref) {
|
|
|
61
61
|
emitter.on('CLOSE_OPEN_TOOLTIPS', close);
|
|
62
62
|
return function () {
|
|
63
63
|
emitter.off('CLOSE_OPEN_TOOLTIPS', close);
|
|
64
|
-
clearTimeout(openTimeoutId);
|
|
65
|
-
clearTimeout(closeTimeoutId);
|
|
64
|
+
clearTimeout(openTimeoutId.current);
|
|
65
|
+
clearTimeout(closeTimeoutId.current);
|
|
66
66
|
cleanupPageViewChange();
|
|
67
67
|
};
|
|
68
68
|
}, []);
|
|
69
69
|
|
|
70
70
|
var open = function open() {
|
|
71
|
-
clearTimeout(closeTimeoutId);
|
|
72
|
-
closeTimeoutId = null;
|
|
71
|
+
clearTimeout(closeTimeoutId.current);
|
|
72
|
+
closeTimeoutId.current = null;
|
|
73
73
|
setIsPopoverOpen(true);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
var close = function close() {
|
|
77
|
-
clearTimeout(openTimeoutId);
|
|
78
|
-
openTimeoutId = null;
|
|
77
|
+
clearTimeout(openTimeoutId.current);
|
|
78
|
+
openTimeoutId.current = null;
|
|
79
79
|
setIsPopoverOpen(false);
|
|
80
80
|
};
|
|
81
81
|
|
|
@@ -103,13 +103,13 @@ function Tooltip(props, ref) {
|
|
|
103
103
|
var createOpenTimeout = useCallback(function () {
|
|
104
104
|
clearGlobalTimeout();
|
|
105
105
|
|
|
106
|
-
if (openTimeoutId === null) {
|
|
107
|
-
clearTimeout(closeTimeoutId);
|
|
108
|
-
closeTimeoutId = null;
|
|
106
|
+
if (openTimeoutId.current === null) {
|
|
107
|
+
clearTimeout(closeTimeoutId.current);
|
|
108
|
+
closeTimeoutId.current = null;
|
|
109
109
|
|
|
110
110
|
if (isPopoverOpen === false) {
|
|
111
111
|
emitter.emit('CLOSE_OPEN_TOOLTIPS');
|
|
112
|
-
openTimeoutId = setTimeout(function () {
|
|
112
|
+
openTimeoutId.current = setTimeout(function () {
|
|
113
113
|
return open();
|
|
114
114
|
}, instantDelay ? 0 : openDelay);
|
|
115
115
|
}
|
|
@@ -118,11 +118,11 @@ function Tooltip(props, ref) {
|
|
|
118
118
|
var createCloseTimeout = useCallback(function () {
|
|
119
119
|
startGlobalTimeout();
|
|
120
120
|
|
|
121
|
-
if (closeTimeoutId === null) {
|
|
122
|
-
clearTimeout(openTimeoutId);
|
|
123
|
-
openTimeoutId = null;
|
|
124
|
-
closeTimeoutId = setTimeout(function () {
|
|
125
|
-
close();
|
|
121
|
+
if (closeTimeoutId.current === null) {
|
|
122
|
+
clearTimeout(openTimeoutId.current);
|
|
123
|
+
openTimeoutId.current = null;
|
|
124
|
+
closeTimeoutId.current = setTimeout(function () {
|
|
125
|
+
return close();
|
|
126
126
|
}, closeDelay);
|
|
127
127
|
}
|
|
128
128
|
});
|
|
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
|
|
8
8
|
import { stylePropNames, pseudoPropNames } from './style-names';
|
|
9
9
|
import { parsePluginStyles } from './parse-styles';
|
|
10
|
-
export default function (_ref) {
|
|
10
|
+
export default function SplitStyles(_ref) {
|
|
11
11
|
var className = _ref.className,
|
|
12
12
|
_ref$mediaQueries = _ref.mediaQueries,
|
|
13
13
|
mediaQueries = _ref$mediaQueries === void 0 ? {} : _ref$mediaQueries,
|
|
@@ -37,7 +37,7 @@ export default function (_ref) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
return _objectSpread(_objectSpread({}, restProps), {}, {
|
|
40
|
-
className: className
|
|
40
|
+
className: className,
|
|
41
41
|
css: function css(theme) {
|
|
42
42
|
var propStyles = {};
|
|
43
43
|
|
|
@@ -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.
|
|
3
|
+
"version": "2.6.0-rc.2",
|
|
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",
|
|
@@ -480,7 +480,7 @@ const DataTable = (props: Props) => {
|
|
|
480
480
|
<div
|
|
481
481
|
role={getRowLink ? undefined : 'grid'}
|
|
482
482
|
style={isLoadingOrEmpty ? { display: 'none' } : undefined}
|
|
483
|
-
className={
|
|
483
|
+
className={css({ position: 'relative' })}
|
|
484
484
|
>
|
|
485
485
|
<div
|
|
486
486
|
ref={headerRef}
|
|
@@ -500,10 +500,7 @@ const DataTable = (props: Props) => {
|
|
|
500
500
|
column={column}
|
|
501
501
|
columnIndex={columnIndex}
|
|
502
502
|
columnSort={columnSort}
|
|
503
|
-
className={
|
|
504
|
-
...cellVariantClassName,
|
|
505
|
-
column.css,
|
|
506
|
-
])}`}
|
|
503
|
+
className={css([...cellVariantClassName, column.css])}
|
|
507
504
|
/>
|
|
508
505
|
)
|
|
509
506
|
})}
|
|
@@ -527,10 +524,7 @@ const DataTable = (props: Props) => {
|
|
|
527
524
|
key={columnIndex}
|
|
528
525
|
role="cell"
|
|
529
526
|
ref={getColumnRef(`${columnIndex}.${data.length + 1}`)}
|
|
530
|
-
className={
|
|
531
|
-
...cellVariantClassName,
|
|
532
|
-
column.css,
|
|
533
|
-
])}`}
|
|
527
|
+
className={css([...cellVariantClassName, column.css])}
|
|
534
528
|
>
|
|
535
529
|
{typeof column.footer === 'string' ||
|
|
536
530
|
React.isValidElement(column.footer)
|
|
@@ -38,7 +38,7 @@ function BodyRows({
|
|
|
38
38
|
key={columnIndex}
|
|
39
39
|
ref={getColumnRef(`${columnIndex}.${rowIndex + 1}`)} // offset by 1 to account for header row
|
|
40
40
|
role="cell"
|
|
41
|
-
className={
|
|
41
|
+
className={css([...cellVariantStyles, column.css])}
|
|
42
42
|
>
|
|
43
43
|
{getCell(column.cell, {
|
|
44
44
|
columnIndex,
|
|
@@ -64,7 +64,7 @@ function BodyRows({
|
|
|
64
64
|
rowIndex,
|
|
65
65
|
keyboardShortcuts,
|
|
66
66
|
onRowClick,
|
|
67
|
-
className:
|
|
67
|
+
className: css(rowVariantClassName),
|
|
68
68
|
...getRowLinkProps({ getRowLink, data: rowData, isSubRow: false }),
|
|
69
69
|
}
|
|
70
70
|
const subRowData = getSubData ? getSubData(rowData) : null
|
|
@@ -57,7 +57,7 @@ const BodySubRows = ({
|
|
|
57
57
|
rowIndex={rowIndex}
|
|
58
58
|
keyboardShortcuts={keyboardShortcuts}
|
|
59
59
|
onRowClick={onRowClick}
|
|
60
|
-
className={
|
|
60
|
+
className={css(rowVariantClassName)}
|
|
61
61
|
{...getRowLinkProps({ getRowLink, data: rowData, isSubRow: true })}
|
|
62
62
|
>
|
|
63
63
|
{columns.map((column, columnIndex) => {
|
|
@@ -77,10 +77,7 @@ const BodySubRows = ({
|
|
|
77
77
|
ref={getColumnRef(
|
|
78
78
|
`${columnIndex}.${parentRowIndex + 1}.${rowIndex}`
|
|
79
79
|
)}
|
|
80
|
-
className={
|
|
81
|
-
...cellVariantClassName,
|
|
82
|
-
column.css,
|
|
83
|
-
])}`}
|
|
80
|
+
className={css([...cellVariantClassName, column.css])}
|
|
84
81
|
>
|
|
85
82
|
{getCell(
|
|
86
83
|
column.subCell !== undefined ? column.subCell : column.cell,
|
|
@@ -2,7 +2,6 @@ import React, { useCallback } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import Icon from '../../Icon'
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
const iconPaths = {
|
|
7
6
|
fill: 'tapestry.checkbox0',
|
|
8
7
|
minus: 'tapestry.checkbox1',
|
|
@@ -88,22 +87,22 @@ function CheckboxCell({
|
|
|
88
87
|
onFocus={onFocus}
|
|
89
88
|
onClick={handleChange}
|
|
90
89
|
onKeyDown={(event) => event.key === ' ' && handleChange(event)}
|
|
91
|
-
className="tapestry-react-
|
|
90
|
+
className="tapestry-react-Checkbox"
|
|
92
91
|
css={cssStyles}
|
|
93
92
|
>
|
|
94
93
|
<Icon.Path
|
|
95
94
|
name={iconPaths.fill}
|
|
96
|
-
className="tapestry-react-
|
|
95
|
+
className="tapestry-react-Checkbox-Fill"
|
|
97
96
|
fill={checked || indeterminate ? 'primary' : 'surfaceTertiary'}
|
|
98
97
|
stroke={checked || indeterminate ? 'primary' : 'separatorSecondary'}
|
|
99
98
|
/>
|
|
100
99
|
<Icon.Path
|
|
101
100
|
name={iconPaths.minus}
|
|
102
|
-
className="tapestry-react-
|
|
101
|
+
className="tapestry-react-Checkbox-Minus"
|
|
103
102
|
/>
|
|
104
103
|
<Icon.Path
|
|
105
104
|
name={iconPaths.checked}
|
|
106
|
-
className="tapestry-react-
|
|
105
|
+
className="tapestry-react-Checkbox-Checked"
|
|
107
106
|
/>
|
|
108
107
|
</Icon>
|
|
109
108
|
)
|
package/src/Portal/Portal.tsx
CHANGED
|
@@ -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]
|
|
@@ -37,28 +37,31 @@ export const defaultColorProperties = objectToCSSProperties(
|
|
|
37
37
|
export const styleReset = `
|
|
38
38
|
${getRootStyles(null, defaultColorProperties)}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
[class^="tapestry-react"] {
|
|
41
41
|
appearance: none;
|
|
42
|
+
border-width: 0px;
|
|
43
|
+
border-style: solid;
|
|
44
|
+
border-color: transparent;
|
|
42
45
|
box-sizing: border-box;
|
|
46
|
+
color: inherit;
|
|
43
47
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
48
|
+
flex-grow: 0;
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
flex-basis: auto;
|
|
44
51
|
font-weight: 400;
|
|
45
|
-
|
|
46
|
-
flex: 0 0 auto;
|
|
47
|
-
min-width: 0px;
|
|
52
|
+
margin: 0px;
|
|
48
53
|
min-height: 0px;
|
|
54
|
+
min-width: 0px;
|
|
49
55
|
padding: 0px;
|
|
50
|
-
|
|
51
|
-
border: 0px solid transparent;
|
|
52
|
-
background-color: transparent;
|
|
53
|
-
color: inherit;
|
|
56
|
+
text-decoration: none;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
[class^="tapestry-react"]::-moz-focus-inner {
|
|
60
|
+
border: none;
|
|
57
61
|
padding: 0px;
|
|
58
|
-
border: 0px;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
[class^="tapestry-react"]:focus:not(.focus-visible) {
|
|
62
65
|
outline: 0px;
|
|
63
66
|
}
|
|
64
67
|
`
|
|
@@ -70,9 +73,6 @@ ${getRootStyles(null, defaultColorProperties)}
|
|
|
70
73
|
// so we can have more control over when styles are injected since multiple
|
|
71
74
|
// Providers can be used on a page
|
|
72
75
|
function ensureStyleElement(themeId) {
|
|
73
|
-
// we use our own global style implementation in place of Emotion Global
|
|
74
|
-
// so we can have more control over when styles are injected since multiple
|
|
75
|
-
// Providers can be used on a page
|
|
76
76
|
if (
|
|
77
77
|
typeof window !== 'undefined' &&
|
|
78
78
|
!document.getElementById(`tapestry-react-style-${themeId}`)
|
package/src/Tooltip/Tooltip.js
CHANGED
|
@@ -3,6 +3,7 @@ import React, {
|
|
|
3
3
|
Children,
|
|
4
4
|
cloneElement,
|
|
5
5
|
forwardRef,
|
|
6
|
+
useRef,
|
|
6
7
|
useState,
|
|
7
8
|
useCallback,
|
|
8
9
|
useImperativeHandle,
|
|
@@ -124,8 +125,8 @@ function Tooltip(props: Props, ref) {
|
|
|
124
125
|
let isPageInView = true
|
|
125
126
|
let isFocused = false
|
|
126
127
|
let isMouseDown = false
|
|
127
|
-
let openTimeoutId = null
|
|
128
|
-
let closeTimeoutId = null
|
|
128
|
+
let openTimeoutId = useRef(null)
|
|
129
|
+
let closeTimeoutId = useRef(null)
|
|
129
130
|
|
|
130
131
|
// prevents tooltips showing when focused and navigating back to a page after leaving
|
|
131
132
|
const cleanupPageViewChange = useCallback(
|
|
@@ -137,21 +138,21 @@ function Tooltip(props: Props, ref) {
|
|
|
137
138
|
emitter.on('CLOSE_OPEN_TOOLTIPS', close)
|
|
138
139
|
return () => {
|
|
139
140
|
emitter.off('CLOSE_OPEN_TOOLTIPS', close)
|
|
140
|
-
clearTimeout(openTimeoutId)
|
|
141
|
-
clearTimeout(closeTimeoutId)
|
|
141
|
+
clearTimeout(openTimeoutId.current)
|
|
142
|
+
clearTimeout(closeTimeoutId.current)
|
|
142
143
|
cleanupPageViewChange()
|
|
143
144
|
}
|
|
144
145
|
}, [])
|
|
145
146
|
|
|
146
147
|
const open = () => {
|
|
147
|
-
clearTimeout(closeTimeoutId)
|
|
148
|
-
closeTimeoutId = null
|
|
148
|
+
clearTimeout(closeTimeoutId.current)
|
|
149
|
+
closeTimeoutId.current = null
|
|
149
150
|
setIsPopoverOpen(true)
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
const close = () => {
|
|
153
|
-
clearTimeout(openTimeoutId)
|
|
154
|
-
openTimeoutId = null
|
|
154
|
+
clearTimeout(openTimeoutId.current)
|
|
155
|
+
openTimeoutId.current = null
|
|
155
156
|
setIsPopoverOpen(false)
|
|
156
157
|
}
|
|
157
158
|
|
|
@@ -179,24 +180,25 @@ function Tooltip(props: Props, ref) {
|
|
|
179
180
|
|
|
180
181
|
const createOpenTimeout = useCallback(() => {
|
|
181
182
|
clearGlobalTimeout()
|
|
182
|
-
if (openTimeoutId === null) {
|
|
183
|
-
clearTimeout(closeTimeoutId)
|
|
184
|
-
closeTimeoutId = null
|
|
183
|
+
if (openTimeoutId.current === null) {
|
|
184
|
+
clearTimeout(closeTimeoutId.current)
|
|
185
|
+
closeTimeoutId.current = null
|
|
185
186
|
if (isPopoverOpen === false) {
|
|
186
187
|
emitter.emit('CLOSE_OPEN_TOOLTIPS')
|
|
187
|
-
openTimeoutId = setTimeout(
|
|
188
|
+
openTimeoutId.current = setTimeout(
|
|
189
|
+
() => open(),
|
|
190
|
+
instantDelay ? 0 : openDelay
|
|
191
|
+
)
|
|
188
192
|
}
|
|
189
193
|
}
|
|
190
194
|
})
|
|
191
195
|
|
|
192
196
|
const createCloseTimeout = useCallback(() => {
|
|
193
197
|
startGlobalTimeout()
|
|
194
|
-
if (closeTimeoutId === null) {
|
|
195
|
-
clearTimeout(openTimeoutId)
|
|
196
|
-
openTimeoutId = null
|
|
197
|
-
closeTimeoutId = setTimeout(() =>
|
|
198
|
-
close()
|
|
199
|
-
}, closeDelay)
|
|
198
|
+
if (closeTimeoutId.current === null) {
|
|
199
|
+
clearTimeout(openTimeoutId.current)
|
|
200
|
+
openTimeoutId.current = null
|
|
201
|
+
closeTimeoutId.current = setTimeout(() => close(), closeDelay)
|
|
200
202
|
}
|
|
201
203
|
})
|
|
202
204
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { stylePropNames, pseudoPropNames } from './style-names'
|
|
2
2
|
import { parsePluginStyles } from './parse-styles'
|
|
3
3
|
|
|
4
|
-
export default function ({
|
|
4
|
+
export default function SplitStyles({
|
|
5
5
|
className,
|
|
6
6
|
mediaQueries = {},
|
|
7
7
|
plugin,
|
|
@@ -26,7 +26,7 @@ export default function ({
|
|
|
26
26
|
}
|
|
27
27
|
return {
|
|
28
28
|
...restProps,
|
|
29
|
-
className
|
|
29
|
+
className,
|
|
30
30
|
css: (theme) => {
|
|
31
31
|
const propStyles = {}
|
|
32
32
|
for (const prop in styleProps) {
|