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

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.
Files changed (77) hide show
  1. package/dist/cjs/Button/Button.js +8 -1
  2. package/dist/cjs/Button/Button.test.js +51 -8
  3. package/dist/cjs/DataTable/components/BodyRow.js +2 -2
  4. package/dist/cjs/DataTable/components/CheckboxCell.js +1 -1
  5. package/dist/cjs/DataTable/hooks/useCollapsibleRows.js +2 -2
  6. package/dist/cjs/DragDrop/DragDrop.js +7 -0
  7. package/dist/cjs/Dropdown/Dropdown.js +5 -3
  8. package/dist/cjs/Dropdown/Link.js +2 -4
  9. package/dist/cjs/Input/InputLabel.js +40 -63
  10. package/dist/cjs/Modal/Modal.js +18 -8
  11. package/dist/cjs/Popover/Popover.js +10 -2
  12. package/dist/cjs/Portal/Portal.js +11 -1
  13. package/dist/cjs/Scrim/Scrim.js +16 -4
  14. package/dist/cjs/ThemeProvider/ThemeProvider.js +24 -6
  15. package/dist/cjs/ThemeProvider/styles.js +1 -4
  16. package/dist/cjs/TimeField/TimeField.js +1 -1
  17. package/dist/cjs/Tooltip/Tooltip.js +17 -17
  18. package/dist/cjs/index.d.js +70 -25
  19. package/dist/cjs/system/split-styles.js +2 -2
  20. package/dist/esm/Button/Button.js +8 -1
  21. package/dist/esm/Button/Button.test.js +67 -9
  22. package/dist/esm/DataTable/components/BodyRow.js +2 -2
  23. package/dist/esm/DataTable/components/CheckboxCell.js +1 -1
  24. package/dist/esm/DataTable/hooks/useCollapsibleRows.js +1 -1
  25. package/dist/esm/DragDrop/DragDrop.js +5 -0
  26. package/dist/esm/Dropdown/Dropdown.js +6 -4
  27. package/dist/esm/Dropdown/Link.js +1 -2
  28. package/dist/esm/Input/InputLabel.js +40 -63
  29. package/dist/esm/Modal/Modal.js +16 -8
  30. package/dist/esm/Popover/Popover.js +8 -2
  31. package/dist/esm/Portal/Portal.js +10 -0
  32. package/dist/esm/Scrim/Scrim.js +15 -4
  33. package/dist/esm/ThemeProvider/ThemeProvider.js +21 -6
  34. package/dist/esm/ThemeProvider/styles.js +1 -4
  35. package/dist/esm/TimeField/TimeField.js +1 -1
  36. package/dist/esm/Tooltip/Tooltip.js +18 -18
  37. package/dist/esm/index.d.js +39 -6
  38. package/dist/esm/system/split-styles.js +1 -1
  39. package/dist/types/Button/Button.d.ts +4 -0
  40. package/dist/types/Divider/Divider.d.ts +2 -2
  41. package/dist/types/Portal/Portal.d.ts +3 -0
  42. package/dist/types/Spinner/Spinner.d.ts +3 -1
  43. package/dist/types/ThemeProvider/ThemeProvider.d.ts +4 -2
  44. package/dist/types/index.d.ts +74 -5
  45. package/package.json +3 -3
  46. package/src/Button/Button.test.tsx +30 -0
  47. package/src/Button/Button.tsx +14 -1
  48. package/src/DataTable/DataTable.js +1 -1
  49. package/src/DataTable/components/BodyRow.js +1 -1
  50. package/src/DataTable/components/BodyRows.js +4 -1
  51. package/src/DataTable/components/CheckboxCell.js +1 -2
  52. package/src/DataTable/hooks/useCollapsibleRows.js +1 -1
  53. package/src/Divider/Divider.tsx +2 -2
  54. package/src/DragDrop/DragDrop.js +5 -0
  55. package/src/Dropdown/Dropdown.js +7 -4
  56. package/src/Dropdown/Dropdown.mdx +3 -3
  57. package/src/Dropdown/Link.js +1 -7
  58. package/src/Icon/Icon.mdx +45 -47
  59. package/src/Input/InputLabel.js +39 -36
  60. package/src/Input/InputLabel.mdx +1 -0
  61. package/src/Modal/Modal.js +16 -6
  62. package/src/Modal/Modal.mdx +2 -1
  63. package/src/Popover/Popover.mdx +1 -0
  64. package/src/Popover/Popover.tsx +8 -2
  65. package/src/Portal/Portal.tsx +14 -0
  66. package/src/RangeSlider/RangeSlider.mdx +10 -12
  67. package/src/Scrim/Scrim.mdx +1 -0
  68. package/src/Scrim/Scrim.tsx +11 -6
  69. package/src/Sidebar/Sidebar.mdx +0 -1
  70. package/src/Spinner/Spinner.tsx +2 -1
  71. package/src/ThemeProvider/ThemeProvider.tsx +22 -10
  72. package/src/ThemeProvider/styles.ts +23 -12
  73. package/src/TimeField/TimeField.js +1 -1
  74. package/src/Tooltip/Tooltip.js +20 -18
  75. package/src/index.d.ts +74 -5
  76. package/src/system/split-styles.js +4 -2
  77. package/src/.DS_Store +0 -0
@@ -5,6 +5,7 @@ import Box from '../Box';
5
5
  import Scrim from '../Scrim';
6
6
  import { useDocumentEvent } from '../hooks';
7
7
  import { trapFocus } from '../utils';
8
+ import { useThemeProps } from '../system';
8
9
 
9
10
  function Modal(_ref) {
10
11
  var children = _ref.children,
@@ -13,6 +14,11 @@ function Modal(_ref) {
13
14
  open = _ref.open,
14
15
  restProps = _objectWithoutPropertiesLoose(_ref, ["children", "closeOnOutsideClick", "onRequestClose", "open"]);
15
16
 
17
+ var _useThemeProps = useThemeProps('modal', restProps),
18
+ _useThemeProps$scrimP = _useThemeProps.scrimProps,
19
+ scrimProps = _useThemeProps$scrimP === void 0 ? {} : _useThemeProps$scrimP,
20
+ themeProps = _objectWithoutPropertiesLoose(_useThemeProps, ["scrimProps"]);
21
+
16
22
  var modalRef = useRef(null);
17
23
  useLayoutEffect(function () {
18
24
  if (open) {
@@ -29,22 +35,24 @@ function Modal(_ref) {
29
35
  return null;
30
36
  }
31
37
 
32
- return /*#__PURE__*/React.createElement(Scrim, {
38
+ return /*#__PURE__*/React.createElement(Scrim, _extends({
33
39
  alignment: "center",
34
40
  onMouseDown: function onMouseDown(event) {
35
41
  if (closeOnOutsideClick && event.currentTarget === event.target) {
36
42
  onRequestClose();
37
43
  }
38
44
  }
39
- }, /*#__PURE__*/React.createElement(Box, _extends({
45
+ }, scrimProps), /*#__PURE__*/React.createElement(Box, _extends({
46
+ backgroundColor: "surface",
47
+ boxShadow: "0 0 20px rgba(0, 0, 0, 0.15)",
40
48
  innerRef: modalRef,
41
- width: "100%",
42
- maxWidth: 60,
43
- padding: 2,
44
49
  margin: 4,
45
- backgroundColor: "surface",
46
- radius: 3
47
- }, restProps), children));
50
+ maxWidth: 60,
51
+ padding: 4,
52
+ paddingBottom: 3,
53
+ radius: 8,
54
+ width: "100%"
55
+ }, themeProps), children));
48
56
  }
49
57
 
50
58
  export default Modal;
@@ -12,6 +12,7 @@ import Portal from '../Portal';
12
12
  import { lockScroll } from '../utils';
13
13
  import rewireTabOrder from './rewireTabOrder';
14
14
  import { getFixedParent, getModifiers } from './utils';
15
+ import { useThemeProps } from '../system';
15
16
  export var Popover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
16
17
  var anchorElement = _ref.anchorElement,
17
18
  _ref$as = _ref.as,
@@ -34,6 +35,11 @@ export var Popover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
34
35
  shouldFlip = _ref$shouldFlip === void 0 ? false : _ref$shouldFlip,
35
36
  restProps = _objectWithoutPropertiesLoose(_ref, ["anchorElement", "as", "innerRef", "keepInView", "lockScrollWhileOpen", "matchWidths", "offset", "open", "onKeyDown", "onRequestClose", "placement", "relativeTo", "renderTo", "shouldFlip"]);
36
37
 
38
+ var _useThemeProps = useThemeProps('popover', restProps),
39
+ _useThemeProps$zIndex = _useThemeProps.zIndex,
40
+ zIndex = _useThemeProps$zIndex === void 0 ? 10000 : _useThemeProps$zIndex,
41
+ themeProps = _objectWithoutPropertiesLoose(_useThemeProps, ["zIndex"]);
42
+
37
43
  var anchorRef = React.useRef(null);
38
44
  var popperRef = React.useRef(null);
39
45
  var unlockScroll = React.useRef(null);
@@ -194,8 +200,8 @@ export var Popover = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
194
200
  }),
195
201
  // ideally this should be pulled out to something like ThemeProvider for predictable z indices
196
202
  style: {
197
- zIndex: 10000
203
+ zIndex: zIndex
198
204
  }
199
- }, restProps)) : null);
205
+ }, themeProps)) : null);
200
206
  });
201
207
  Popover.displayName = 'Popover';
@@ -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,10 @@ var Portal = /*#__PURE__*/function (_React$Component) {
116
120
  _this2._portalNode.setAttribute(key, restProps[key]);
117
121
  });
118
122
 
123
+ this._portalNode.classList.add('tapestry-react-reset');
124
+
125
+ this._portalNode.setAttribute(getThemeDataAttribute(this.context.id), 'true');
126
+
119
127
  if (style) {
120
128
  Object.keys(style).forEach(function (key) {
121
129
  _this2._portalNode.style[key] = style[key];
@@ -155,4 +163,6 @@ _defineProperty(Portal, "defaultProps", {
155
163
  renderTo: null
156
164
  });
157
165
 
166
+ _defineProperty(Portal, "contextType", ThemeContext);
167
+
158
168
  export { Portal };
@@ -1,24 +1,35 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
3
  import * as React from 'react';
3
4
  import StackView from '../StackView';
4
- var Scrim = /*#__PURE__*/React.forwardRef(function (props, _ref) {
5
+ import { useThemeProps } from '../system';
6
+ var Scrim = /*#__PURE__*/React.forwardRef(function (_ref2, _ref) {
7
+ var ref = _ref2.ref,
8
+ restProps = _objectWithoutPropertiesLoose(_ref2, ["ref"]);
9
+
5
10
  React.useLayoutEffect(function () {
6
11
  document.body.style.overflow = 'hidden';
7
12
  return function () {
8
13
  document.body.style.overflow = '';
9
14
  };
10
15
  }, []);
16
+
17
+ var _useThemeProps = useThemeProps('scrim', restProps),
18
+ _useThemeProps$zIndex = _useThemeProps.zIndex,
19
+ zIndex = _useThemeProps$zIndex === void 0 ? 10000 : _useThemeProps$zIndex,
20
+ themeProps = _objectWithoutPropertiesLoose(_useThemeProps, ["zIndex"]);
21
+
11
22
  return /*#__PURE__*/React.createElement(StackView, _extends({
12
- innerRef: props.ref,
23
+ innerRef: ref,
13
24
  position: "fixed",
14
25
  top: 0,
15
26
  right: 0,
16
27
  bottom: 0,
17
28
  left: 0,
18
- zIndex: 10000,
29
+ zIndex: zIndex,
19
30
  overflow: "auto" // @ts-ignore
20
31
  ,
21
32
  backgroundColor: "hsla(0,0%,0%,0.4)"
22
- }, props));
33
+ }, themeProps));
23
34
  });
24
35
  export { Scrim };
@@ -1,3 +1,5 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
1
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
4
 
3
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
@@ -9,6 +11,7 @@ import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
9
11
  import { CacheProvider } from '@emotion/react';
10
12
  import createCache from '@emotion/cache';
11
13
  import { merge } from 'lodash';
14
+ import { Box } from '../Box';
12
15
  import defaultTheme from '../system/default-theme';
13
16
  import { flattenPalette } from '../system';
14
17
  import { objectToCSSProperties, shallowEqual } from '../utils';
@@ -17,6 +20,15 @@ var STORAGE_KEY = 'tapestry-react-theme';
17
20
  export var cache = createCache({
18
21
  key: 'tapestry-react'
19
22
  });
23
+
24
+ function mergeIntoNewObject() {
25
+ for (var _len = arguments.length, merges = new Array(_len), _key = 0; _key < _len; _key++) {
26
+ merges[_key] = arguments[_key];
27
+ }
28
+
29
+ return merge.apply(void 0, [{}].concat(merges));
30
+ }
31
+
20
32
  export var themeStorage = {
21
33
  get: function get() {
22
34
  return window.localStorage.getItem(STORAGE_KEY);
@@ -41,12 +53,12 @@ function mergeThemes(a, b) {
41
53
 
42
54
  return _objectSpread(_objectSpread(_objectSpread({}, a), b), {}, {
43
55
  button: _objectSpread(_objectSpread(_objectSpread({}, a.button), b.button), {}, {
44
- themes: merge(((_a$button = a.button) == null ? void 0 : _a$button.themes) || {}, ((_b$button = b.button) == null ? void 0 : _b$button.themes) || {})
56
+ themes: mergeIntoNewObject(((_a$button = a.button) == null ? void 0 : _a$button.themes) || {}, ((_b$button = b.button) == null ? void 0 : _b$button.themes) || {})
45
57
  }),
46
- colors: merge(flattenPalette(a.colors || {}), flattenPalette(b.colors || {})),
58
+ colors: mergeIntoNewObject(flattenPalette(a.colors || {}), flattenPalette(b.colors || {})),
47
59
  spinner: _objectSpread(_objectSpread(_objectSpread({}, a.spinner), b.spinner), {}, {
48
- sizes: merge(((_a$spinner = a.spinner) == null ? void 0 : _a$spinner.sizes) || {}, ((_b$spinner = b.spinner) == null ? void 0 : _b$spinner.sizes) || {}),
49
- thickness: merge(((_a$spinner2 = a.spinner) == null ? void 0 : _a$spinner2.thickness) || {}, ((_b$spinner2 = b.spinner) == null ? void 0 : _b$spinner2.thickness) || {})
60
+ sizes: mergeIntoNewObject(((_a$spinner = a.spinner) == null ? void 0 : _a$spinner.sizes) || {}, ((_b$spinner = b.spinner) == null ? void 0 : _b$spinner.sizes) || {}),
61
+ thickness: mergeIntoNewObject(((_a$spinner2 = a.spinner) == null ? void 0 : _a$spinner2.thickness) || {}, ((_b$spinner2 = b.spinner) == null ? void 0 : _b$spinner2.thickness) || {})
50
62
  })
51
63
  });
52
64
  }
@@ -56,7 +68,8 @@ export function ThemeProvider(_ref) {
56
68
 
57
69
  var _ref$theme = _ref.theme,
58
70
  theme = _ref$theme === void 0 ? emptyTheme : _ref$theme,
59
- children = _ref.children;
71
+ children = _ref.children,
72
+ boxProps = _objectWithoutPropertiesLoose(_ref, ["theme", "children"]);
60
73
 
61
74
  var _useState = useState(function () {
62
75
  return mergeThemes(defaultTheme, theme);
@@ -76,7 +89,9 @@ export function ThemeProvider(_ref) {
76
89
  value: cache
77
90
  }, /*#__PURE__*/React.createElement(EmotionThemeProvider, {
78
91
  theme: mergedTheme
79
- }, /*#__PURE__*/React.createElement("div", (_ref2 = {}, _ref2["" + getThemeDataAttribute(mergedTheme.id)] = true, _ref2), children)));
92
+ }, /*#__PURE__*/React.createElement(Box, _extends({
93
+ className: "tapestry-react-reset"
94
+ }, boxProps, (_ref2 = {}, _ref2["" + getThemeDataAttribute(mergedTheme.id)] = true, _ref2)), children)));
80
95
  }
81
96
  ThemeProvider.cache = cache;
82
97
  ThemeProvider.setRootStyles = setRootStyles;
@@ -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.tapestry-react-reset {\n appearance: none;\n box-sizing: border-box;\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 font-weight: 400;\n text-decoration: none;\n flex: 0 0 auto;\n min-width: 0px;\n min-height: 0px;\n padding: 0px;\n margin: 0px;\n border: 0px solid transparent;\n background-color: transparent;\n color: inherit;\n}\n\n.tapestry-react-reset::-moz-focus-inner {\n padding: 0px;\n border: 0px;\n}\n\n.tapestry-react-reset:focus:not(.focus-visible) {\n outline: 0px;\n}\n" // minify string
27
+ export var styleReset = ("\n" + getRootStyles(null, defaultColorProperties) + "\n\n.tapestry-react-reset {\n appearance: none;\n background-color: transparent;\n border-width: 0px;\n border-style: solid;\n border-color: transparent;\n box-sizing: border-box;\n color: inherit;\n box-sizing: border-box;\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: auto;\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 font-weight: 400;\n margin-top: 0;\n margin-right: 0;\n margin-bottom: 0;\n margin-left: 0;\n min-width: 0px;\n min-height: 0px;\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n padding-left: 0;\n text-decoration: none;\n}\n\n.tapestry-react-reset::-moz-focus-inner {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n padding-left: 0;\n border: none;\n}\n\n.tapestry-react-reset: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;
@@ -208,7 +208,7 @@ var TimeField = /*#__PURE__*/function (_Component) {
208
208
  highlightOnInteraction: true,
209
209
  value: this.state.meridiem,
210
210
  grow: 0,
211
- width: 3,
211
+ width: "2em",
212
212
  textAlign: "center",
213
213
  "aria-label": "AM/PM",
214
214
  onChange: noop // prevent React warnings
@@ -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
  });
@@ -5,7 +5,6 @@ export var utils;
5
5
  export var Avatar;
6
6
  export var Badge;
7
7
  export var Calendar;
8
- export var Checkbox;
9
8
  export var CheckboxCard;
10
9
  export var CheckboxGroup;
11
10
  export var ChurchCenterStatus;
@@ -27,11 +26,19 @@ export var Highlight;
27
26
  export var Icon;
28
27
  export var Link;
29
28
  export var LinkList;
30
- export var List;
31
29
  export var Logo;
32
30
  export var Menu;
33
31
  export var Modal;
34
32
  export var NumberField;
33
+ export var PageActions;
34
+ export var PageBody;
35
+ export var PageButton;
36
+ export var PageDropdown;
37
+ export var PageHeader;
38
+ export var PageTab;
39
+ export var PageTabList;
40
+ export var PageTitle;
41
+ export var PageToolbar;
35
42
  export var PagerView;
36
43
  export var Pagination;
37
44
  export var Progress;
@@ -42,9 +49,7 @@ export var Section;
42
49
  export var HeadingUppercase;
43
50
  export var SegmentedControl;
44
51
  export var SegmentedTabs;
45
- export var Select;
46
52
  export var Sidebar;
47
- export var Sortable;
48
53
  export var StepperField;
49
54
  export var StepperProgress;
50
55
  export var Summary;
@@ -56,7 +61,36 @@ export var Toolbar;
56
61
  export var TokenInput;
57
62
  export var Tooltip;
58
63
  export var VariantProvider;
59
- export var Wizard;
64
+ export var Wizard; // ============
65
+ // Manual Types
66
+ // ===========
67
+ // These are components written in JS, where we can provide very small (one prop at a time) useful
68
+ // typings for consumers.
69
+ // ============
70
+
71
+ // ========
72
+ // Checkbox
73
+ // ========
74
+ export var Checkbox; // =====
75
+ // Input
76
+ // =====
77
+
78
+ export var Input; // ====
79
+ // List
80
+ // ====
81
+
82
+ export var List; // ======
83
+ // Select
84
+ // ======
85
+
86
+ export var Select; // ========
87
+ // Sortable
88
+ // ========
89
+
90
+ export var Sortable; // =====================
91
+ // Typescript Components
92
+ // =====================
93
+
60
94
  export * from './Alert';
61
95
  export * from './Box';
62
96
  export * from './Button';
@@ -65,7 +99,6 @@ export * from './Divider';
65
99
  export * from './FilterLayout';
66
100
  export * from './GridView';
67
101
  export * from './Group';
68
- export * from './Input';
69
102
  export * from './Popover';
70
103
  export * from './Portal';
71
104
  export * from './Scrim';
@@ -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,
@@ -60,6 +60,10 @@ declare type ButtonProps = {
60
60
  * Where the browser should navigate to when pressed. If you need any element here other than `<a>`, remember to use the `as` prop.
61
61
  */
62
62
  to?: string;
63
+ /**
64
+ * Where the browser should navigate to when pressed. If you need any element here other than `<a>`, remember to use the `as` prop.
65
+ */
66
+ href?: string;
63
67
  /**
64
68
  * Wraps button in a [`<Tooltip />`](./tooltip). Accepts any valid Tooltip props.
65
69
  */
@@ -1,4 +1,4 @@
1
- import { ColorProp } from '../index';
1
+ import { ColorProp, StyleProps } from '../index';
2
2
  export declare type DividerProps = {
3
3
  /**
4
4
  * The direction the dividing line should span.
@@ -16,7 +16,7 @@ export declare type DividerProps = {
16
16
  * The size of the line in pixels
17
17
  */
18
18
  size?: number;
19
- };
19
+ } & StyleProps;
20
20
  /**
21
21
  * Used to break up content
22
22
  */
@@ -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;
@@ -1,3 +1,5 @@
1
+ import React from 'react';
2
+ import { StyleProps } from '../index';
1
3
  export declare type SpinnerProps = {
2
4
  /**
3
5
  * Uses position absolute and transforms to position in the center of a relative parent.
@@ -19,5 +21,5 @@ export declare type SpinnerProps = {
19
21
  * Secondary color of spinner.
20
22
  */
21
23
  trackColor?: string;
22
- };
24
+ } & StyleProps & React.HTMLAttributes<HTMLElement>;
23
25
  export declare function Spinner({ center, size, thickness, ...props }: SpinnerProps): JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { BoxProps } from '../Box';
2
3
  import { Theme } from '../index';
3
4
  import { setRootStyles, styleReset } from './styles';
4
5
  export declare const cache: import("@emotion/utils").EmotionCache;
@@ -7,10 +8,11 @@ export declare const themeStorage: {
7
8
  set: (value: any) => void;
8
9
  };
9
10
  export declare const themeInitializerScript: string;
10
- export declare function ThemeProvider({ theme, children, }: {
11
+ declare type Props = {
11
12
  theme?: Theme;
12
13
  children: React.ReactNode;
13
- }): JSX.Element;
14
+ } & BoxProps;
15
+ export declare function ThemeProvider({ theme, children, ...boxProps }: Props): JSX.Element;
14
16
  export declare namespace ThemeProvider {
15
17
  var cache: import("@emotion/utils").EmotionCache;
16
18
  var setRootStyles: (themeId: any, styles: any) => void;
@@ -259,6 +259,10 @@ export type CommonProps = React.RefAttributes<any> &
259
259
  React.HTMLAttributes<any> &
260
260
  any
261
261
 
262
+ export type CommonComponent = React.FC<CommonProps>
263
+ export type CommonPropsWith<T extends object> = Omit<CommonProps, keyof T> & T
264
+ export type CommonComponentWith<T extends object> = React.FC<CommonPropsWith<T>>
265
+
262
266
  export const designSystem: any
263
267
  export const hooks: any
264
268
  export const server: any
@@ -267,7 +271,6 @@ export const utils: any
267
271
  export const Avatar: React.FC<CommonProps>
268
272
  export const Badge: React.FC<CommonProps>
269
273
  export const Calendar: React.FC<CommonProps>
270
- export const Checkbox: React.FC<CommonProps>
271
274
  export const CheckboxCard: React.FC<CommonProps>
272
275
  export const CheckboxGroup: React.FC<CommonProps>
273
276
  export const ChurchCenterStatus: React.FC<CommonProps>
@@ -289,11 +292,19 @@ export const Highlight: React.FC<CommonProps>
289
292
  export const Icon: React.FC<CommonProps>
290
293
  export const Link: React.FC<CommonProps>
291
294
  export const LinkList: React.FC<CommonProps>
292
- export const List: React.FC<CommonProps>
293
295
  export const Logo: React.FC<CommonProps>
294
296
  export const Menu: React.FC<CommonProps>
295
297
  export const Modal: React.FC<CommonProps>
296
298
  export const NumberField: React.FC<CommonProps>
299
+ export const PageActions: CommonComponent
300
+ export const PageBody: CommonComponent
301
+ export const PageButton: CommonComponent
302
+ export const PageDropdown: CommonComponent
303
+ export const PageHeader: CommonComponent
304
+ export const PageTab: CommonComponent
305
+ export const PageTabList: CommonComponent
306
+ export const PageTitle: CommonComponent
307
+ export const PageToolbar: CommonComponent
297
308
  export const PagerView: React.FC<CommonProps>
298
309
  export const Pagination: React.FC<CommonProps>
299
310
  export const Progress: React.FC<CommonProps>
@@ -304,9 +315,7 @@ export const Section: React.FC<CommonProps>
304
315
  export const HeadingUppercase: React.FC<CommonProps>
305
316
  export const SegmentedControl: React.FC<CommonProps>
306
317
  export const SegmentedTabs: React.FC<CommonProps>
307
- export const Select: React.FC<CommonProps>
308
318
  export const Sidebar: React.FC<CommonProps>
309
- export const Sortable: React.FC<CommonProps>
310
319
  export const StepperField: React.FC<CommonProps>
311
320
  export const StepperProgress: React.FC<CommonProps>
312
321
  export const Summary: React.FC<CommonProps>
@@ -320,6 +329,67 @@ export const Tooltip: React.FC<CommonProps>
320
329
  export const VariantProvider: React.FC<CommonProps>
321
330
  export const Wizard: React.FC<CommonProps>
322
331
 
332
+ // ============
333
+ // Manual Types
334
+ // ===========
335
+ // These are components written in JS, where we can provide very small (one prop at a time) useful
336
+ // typings for consumers.
337
+ // ============
338
+
339
+ type HTMLInputWrapperComponent = CommonComponentWith<{
340
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
341
+ }>
342
+
343
+ // ========
344
+ // Checkbox
345
+ // ========
346
+
347
+ export const Checkbox: HTMLInputWrapperComponent
348
+
349
+ // =====
350
+ // Input
351
+ // =====
352
+
353
+ export const Input: HTMLInputWrapperComponent & {
354
+ Inline: HTMLInputWrapperComponent
355
+ Input: HTMLInputWrapperComponent
356
+ InputBox: CommonComponent
357
+ InputField: HTMLInputWrapperComponent
358
+ InputLabel: CommonComponent
359
+ }
360
+
361
+ // ====
362
+ // List
363
+ // ====
364
+
365
+ export const List: CommonComponent & { Item: CommonComponent }
366
+
367
+ // ======
368
+ // Select
369
+ // ======
370
+
371
+ export const Select: CommonComponent & {
372
+ Inline: CommonComponent
373
+ Option: CommonComponent
374
+ OptionGroup: CommonComponent
375
+ Value: CommonComponent
376
+ toggleValue: (...args: unknown) => unknown
377
+ }
378
+
379
+ // ========
380
+ // Sortable
381
+ // ========
382
+
383
+ export const Sortable: CommonComponent & {
384
+ SortableManager: CommonComponent
385
+ SortableList: CommonComponent
386
+ SortableItem: CommonComponent
387
+ }
388
+
389
+ // =====================
390
+ // Typescript Components
391
+ // =====================
392
+
323
393
  export * from './Alert'
324
394
  export * from './Box'
325
395
  export * from './Button'
@@ -328,7 +398,6 @@ export * from './Divider'
328
398
  export * from './FilterLayout'
329
399
  export * from './GridView'
330
400
  export * from './Group'
331
- export * from './Input'
332
401
  export * from './Popover'
333
402
  export * from './Portal'
334
403
  export * from './Scrim'
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.10",
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",
@@ -76,7 +76,7 @@
76
76
  "husky": "^4.3.8",
77
77
  "is-ci-cli": "^2.2.0",
78
78
  "jest": "^26.6.3",
79
- "jest-canvas-mock": "2.3.1",
79
+ "jest-canvas-mock": "^2.5.0",
80
80
  "jest-watch-typeahead": "0.6.1",
81
81
  "react": "^17.0.1",
82
82
  "react-dom": "^17.0.1",
@@ -106,6 +106,6 @@
106
106
  "stylefire": "^7.0.3",
107
107
  "tabbable": "^6.0.0",
108
108
  "tiny-spring": "^1.0.0",
109
- "zustand": "^4.1.1"
109
+ "zustand": "^4.3.7"
110
110
  }
111
111
  }