@planningcenter/tapestry-react 2.5.0 → 2.5.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.
@@ -260,7 +260,7 @@ function Button(_ref) {
260
260
  }
261
261
 
262
262
  if (type && restProps.as && restProps.as !== "button") {
263
- throw Error("Tapestry-React: <Button/> type prop is only supported by <button> and not <" + restProps.as + ">.");
263
+ console.log("Tapestry-React: <Button/> type prop is only supported by <button> and not <" + restProps.as + ">.");
264
264
  }
265
265
  }
266
266
 
@@ -85,24 +85,8 @@ function Checkbox(_ref) {
85
85
  wrapperProps = _useAccessibilityViol.wrapperProps;
86
86
 
87
87
  (0, _react.useLayoutEffect)(function () {
88
- function findParent(node, findMatch) {
89
- if (node && node !== document.documentElement) {
90
- var matchFound = findMatch(node.parentNode);
91
-
92
- if (matchFound) {
93
- return node.parentNode;
94
- } else {
95
- return findParent(node.parentNode, findMatch);
96
- }
97
- } else {
98
- return null;
99
- }
100
- }
101
-
102
88
  if (label === undefined) {
103
- var labelParent = findParent(ref.current, function (parentNode) {
104
- return parentNode.tagName === 'LABEL';
105
- });
89
+ var labelParent = ref.current.closest('label') !== null;
106
90
 
107
91
  if (!labelParent) {
108
92
  setNeedsParentLabel(true);
@@ -75,9 +75,7 @@ var NavButton = function NavButton(_ref) {
75
75
  };
76
76
 
77
77
  function Pagination(_ref2) {
78
- var _ref2$activeColor = _ref2.activeColor,
79
- activeColor = _ref2$activeColor === void 0 ? '#5b8bf7' : _ref2$activeColor,
80
- currentPage = _ref2.currentPage,
78
+ var currentPage = _ref2.currentPage,
81
79
  _ref2$onPageChange = _ref2.onPageChange,
82
80
  onPageChange = _ref2$onPageChange === void 0 ? function () {
83
81
  return null;
@@ -85,11 +83,19 @@ function Pagination(_ref2) {
85
83
  visiblePages = _ref2.visiblePages,
86
84
  _ref2$totalPages = _ref2.totalPages,
87
85
  totalPages = _ref2$totalPages === void 0 ? 0 : _ref2$totalPages,
88
- restProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref2, ["activeColor", "currentPage", "onPageChange", "visiblePages", "totalPages"]);
86
+ restProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref2, ["currentPage", "onPageChange", "visiblePages", "totalPages"]);
89
87
 
90
88
  var _useThemeValue = (0, _system.useThemeValue)('breakpoints'),
91
89
  xsBreakpoint = _useThemeValue.xs;
92
90
 
91
+ var _useThemeProps = (0, _system.useThemeProps)('pagination', _objectSpread({}, restProps)),
92
+ _useThemeProps$active = _useThemeProps.activeColor,
93
+ activeColor = _useThemeProps$active === void 0 ? '#5b8bf7' : _useThemeProps$active,
94
+ navButtonProps = _useThemeProps.navButtonProps,
95
+ pageLinkProps = _useThemeProps.pageLinkProps,
96
+ activePageLinkProps = _useThemeProps.activePageLinkProps,
97
+ themeProps = (0, _objectWithoutPropertiesLoose2["default"])(_useThemeProps, ["activeColor", "navButtonProps", "pageLinkProps", "activePageLinkProps"]);
98
+
93
99
  var currentWidth = (0, _windowSize.useWindowWidth)();
94
100
 
95
101
  function renderGap(key) {
@@ -125,10 +131,10 @@ function Pagination(_ref2) {
125
131
  square: true,
126
132
  title: number,
127
133
  variant: isCurrentPage ? 'fill' : 'naked'
128
- }, isCurrentPage && {
134
+ }, pageLinkProps, isCurrentPage && _objectSpread({
129
135
  backgroundColor: activeColor,
130
136
  color: '#fff'
131
- }));
137
+ }, activePageLinkProps)));
132
138
  }
133
139
 
134
140
  function renderPageLinks() {
@@ -151,22 +157,22 @@ function Pagination(_ref2) {
151
157
  shrink: 0,
152
158
  spacing: 0.5,
153
159
  width: "100%"
154
- }, restProps), /*#__PURE__*/_react["default"].createElement(_Group["default"], {
160
+ }, themeProps), /*#__PURE__*/_react["default"].createElement(_Group["default"], {
155
161
  spacing: 0.5
156
- }, /*#__PURE__*/_react["default"].createElement(NavButton, {
162
+ }, /*#__PURE__*/_react["default"].createElement(NavButton, (0, _extends2["default"])({
157
163
  disabled: currentPage === 1,
158
164
  iconName: "general.leftChevron",
159
165
  onClick: onPageChange.bind(null, currentPage - 1),
160
166
  tooltip: {
161
167
  title: 'Previous Page'
162
168
  }
163
- }), /*#__PURE__*/_react["default"].createElement(NavButton, {
169
+ }, navButtonProps)), /*#__PURE__*/_react["default"].createElement(NavButton, (0, _extends2["default"])({
164
170
  disabled: currentPage === totalPages,
165
171
  iconName: "general.rightChevron",
166
172
  onClick: onPageChange.bind(null, currentPage + 1),
167
173
  tooltip: {
168
174
  title: 'Next Page'
169
175
  }
170
- })), renderPageLinks());
176
+ }, navButtonProps))), renderPageLinks());
171
177
  }
172
178
  }
@@ -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
  });
@@ -245,7 +245,7 @@ export function Button(_ref) {
245
245
  }
246
246
 
247
247
  if (type && restProps.as && restProps.as !== "button") {
248
- throw Error("Tapestry-React: <Button/> type prop is only supported by <button> and not <" + restProps.as + ">.");
248
+ console.log("Tapestry-React: <Button/> type prop is only supported by <button> and not <" + restProps.as + ">.");
249
249
  }
250
250
  }
251
251
 
@@ -65,24 +65,8 @@ function Checkbox(_ref) {
65
65
  wrapperProps = _useAccessibilityViol.wrapperProps;
66
66
 
67
67
  useLayoutEffect(function () {
68
- function findParent(node, findMatch) {
69
- if (node && node !== document.documentElement) {
70
- var matchFound = findMatch(node.parentNode);
71
-
72
- if (matchFound) {
73
- return node.parentNode;
74
- } else {
75
- return findParent(node.parentNode, findMatch);
76
- }
77
- } else {
78
- return null;
79
- }
80
- }
81
-
82
68
  if (label === undefined) {
83
- var labelParent = findParent(ref.current, function (parentNode) {
84
- return parentNode.tagName === 'LABEL';
85
- });
69
+ var labelParent = ref.current.closest('label') !== null;
86
70
 
87
71
  if (!labelParent) {
88
72
  setNeedsParentLabel(true);
@@ -14,7 +14,7 @@ import StackView from '../StackView';
14
14
  import { range } from '../utils';
15
15
  import { parseColor } from '../system/utils';
16
16
  import { useWindowWidth } from '@react-hook/window-size';
17
- import { useThemeValue } from '../system';
17
+ import { useThemeValue, useThemeProps } from '../system';
18
18
 
19
19
  function getVisiblePages(currentPage, totalPages, visiblePages) {
20
20
  var start = Math.max(1, Math.min(totalPages - visiblePages + 1, Math.floor(currentPage - visiblePages / 2 + 1)));
@@ -59,9 +59,7 @@ var NavButton = function NavButton(_ref) {
59
59
  };
60
60
 
61
61
  export default function Pagination(_ref2) {
62
- var _ref2$activeColor = _ref2.activeColor,
63
- activeColor = _ref2$activeColor === void 0 ? '#5b8bf7' : _ref2$activeColor,
64
- currentPage = _ref2.currentPage,
62
+ var currentPage = _ref2.currentPage,
65
63
  _ref2$onPageChange = _ref2.onPageChange,
66
64
  onPageChange = _ref2$onPageChange === void 0 ? function () {
67
65
  return null;
@@ -69,11 +67,19 @@ export default function Pagination(_ref2) {
69
67
  visiblePages = _ref2.visiblePages,
70
68
  _ref2$totalPages = _ref2.totalPages,
71
69
  totalPages = _ref2$totalPages === void 0 ? 0 : _ref2$totalPages,
72
- restProps = _objectWithoutPropertiesLoose(_ref2, ["activeColor", "currentPage", "onPageChange", "visiblePages", "totalPages"]);
70
+ restProps = _objectWithoutPropertiesLoose(_ref2, ["currentPage", "onPageChange", "visiblePages", "totalPages"]);
73
71
 
74
72
  var _useThemeValue = useThemeValue('breakpoints'),
75
73
  xsBreakpoint = _useThemeValue.xs;
76
74
 
75
+ var _useThemeProps = useThemeProps('pagination', _objectSpread({}, restProps)),
76
+ _useThemeProps$active = _useThemeProps.activeColor,
77
+ activeColor = _useThemeProps$active === void 0 ? '#5b8bf7' : _useThemeProps$active,
78
+ navButtonProps = _useThemeProps.navButtonProps,
79
+ pageLinkProps = _useThemeProps.pageLinkProps,
80
+ activePageLinkProps = _useThemeProps.activePageLinkProps,
81
+ themeProps = _objectWithoutPropertiesLoose(_useThemeProps, ["activeColor", "navButtonProps", "pageLinkProps", "activePageLinkProps"]);
82
+
77
83
  var currentWidth = useWindowWidth();
78
84
 
79
85
  function renderGap(key) {
@@ -109,10 +115,10 @@ export default function Pagination(_ref2) {
109
115
  square: true,
110
116
  title: number,
111
117
  variant: isCurrentPage ? 'fill' : 'naked'
112
- }, isCurrentPage && {
118
+ }, pageLinkProps, isCurrentPage && _objectSpread({
113
119
  backgroundColor: activeColor,
114
120
  color: '#fff'
115
- }));
121
+ }, activePageLinkProps)));
116
122
  }
117
123
 
118
124
  function renderPageLinks() {
@@ -135,22 +141,22 @@ export default function Pagination(_ref2) {
135
141
  shrink: 0,
136
142
  spacing: 0.5,
137
143
  width: "100%"
138
- }, restProps), /*#__PURE__*/React.createElement(Group, {
144
+ }, themeProps), /*#__PURE__*/React.createElement(Group, {
139
145
  spacing: 0.5
140
- }, /*#__PURE__*/React.createElement(NavButton, {
146
+ }, /*#__PURE__*/React.createElement(NavButton, _extends({
141
147
  disabled: currentPage === 1,
142
148
  iconName: "general.leftChevron",
143
149
  onClick: onPageChange.bind(null, currentPage - 1),
144
150
  tooltip: {
145
151
  title: 'Previous Page'
146
152
  }
147
- }), /*#__PURE__*/React.createElement(NavButton, {
153
+ }, navButtonProps)), /*#__PURE__*/React.createElement(NavButton, _extends({
148
154
  disabled: currentPage === totalPages,
149
155
  iconName: "general.rightChevron",
150
156
  onClick: onPageChange.bind(null, currentPage + 1),
151
157
  tooltip: {
152
158
  title: 'Next Page'
153
159
  }
154
- })), renderPageLinks());
160
+ }, navButtonProps))), renderPageLinks());
155
161
  }
156
162
  }
@@ -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
  });
@@ -2,15 +2,27 @@ export declare type PaginationProps = {
2
2
  /**
3
3
  * Change the color of the active page
4
4
  */
5
- activeColor: string;
5
+ activeColor?: string;
6
+ /**
7
+ * Accepts any valid [Button](/button) props.
8
+ */
9
+ activePageLinkProps?: object;
6
10
  /**
7
11
  * Current visible page number
8
12
  */
9
13
  currentPage: number;
14
+ /**
15
+ * Accepts any valid [Button](/button) props.
16
+ */
17
+ navButtonProps?: object;
10
18
  /**
11
19
  * Callback when new page is requested
12
20
  */
13
21
  onPageChange: (nextPage: number) => undefined;
22
+ /**
23
+ * Accepts any valid [Button](/button) props.
24
+ */
25
+ pageLinkProps?: object;
14
26
  /**
15
27
  * Total available pages
16
28
  */
@@ -20,4 +32,4 @@ export declare type PaginationProps = {
20
32
  */
21
33
  visiblePages?: number;
22
34
  };
23
- export default function Pagination({ activeColor, currentPage, onPageChange, visiblePages, totalPages, ...restProps }: PaginationProps): JSX.Element;
35
+ export default function Pagination({ currentPage, onPageChange, visiblePages, totalPages, ...restProps }: PaginationProps): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/tapestry-react",
3
- "version": "2.5.0",
3
+ "version": "2.5.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",
package/src/.DS_Store ADDED
Binary file
@@ -346,7 +346,7 @@ export function Button({
346
346
  (restProps as any).as &&
347
347
  (restProps as any).as !== "button"
348
348
  ) {
349
- throw Error(
349
+ console.log(
350
350
  `Tapestry-React: <Button/> type prop is only supported by <button> and not <${(restProps as any).as}>.`
351
351
  )
352
352
  }
@@ -120,23 +120,9 @@ function Checkbox({
120
120
  `Tapestry-React: <Checkbox/> must define a "label" prop or have a parent that renders a label for proper accessibility.`
121
121
  )
122
122
  useLayoutEffect(() => {
123
- function findParent(node, findMatch) {
124
- if (node && node !== document.documentElement) {
125
- const matchFound = findMatch(node.parentNode)
126
- if (matchFound) {
127
- return node.parentNode
128
- } else {
129
- return findParent(node.parentNode, findMatch)
130
- }
131
- } else {
132
- return null
133
- }
134
- }
135
123
  if (label === undefined) {
136
- const labelParent = findParent(
137
- ref.current,
138
- (parentNode) => parentNode.tagName === 'LABEL'
139
- )
124
+ const labelParent = ref.current.closest('label') !== null
125
+
140
126
  if (!labelParent) {
141
127
  setNeedsParentLabel(true)
142
128
  }
@@ -2,6 +2,7 @@
2
2
  title: Pagination
3
3
  category: General
4
4
  propsSummary: Accepts [StackView](/stackview) props.
5
+ themeKey: pagination
5
6
  ---
6
7
 
7
8
  ```jsx live
@@ -7,7 +7,7 @@ import StackView from '../StackView'
7
7
  import { range } from '../utils'
8
8
  import { parseColor } from '../system/utils'
9
9
  import { useWindowWidth } from '@react-hook/window-size'
10
- import { useThemeValue } from '../system'
10
+ import { useThemeValue, useThemeProps } from '../system'
11
11
 
12
12
  function getVisiblePages(currentPage, totalPages, visiblePages) {
13
13
  const start = Math.max(
@@ -40,18 +40,33 @@ export type PaginationProps = {
40
40
  /**
41
41
  * Change the color of the active page
42
42
  */
43
- activeColor: string
43
+ activeColor?: string
44
+
45
+ /**
46
+ * Accepts any valid [Button](/button) props.
47
+ */
48
+ activePageLinkProps?: object
44
49
 
45
50
  /**
46
51
  * Current visible page number
47
52
  */
48
53
  currentPage: number
49
54
 
55
+ /**
56
+ * Accepts any valid [Button](/button) props.
57
+ */
58
+ navButtonProps?: object
59
+
50
60
  /**
51
61
  * Callback when new page is requested
52
62
  */
53
63
  onPageChange: (nextPage: number) => undefined
54
64
 
65
+ /**
66
+ * Accepts any valid [Button](/button) props.
67
+ */
68
+ pageLinkProps?: object
69
+
55
70
  /**
56
71
  * Total available pages
57
72
  */
@@ -83,7 +98,6 @@ const NavButton = ({ disabled, iconName, ...props }) => {
83
98
  }
84
99
 
85
100
  export default function Pagination({
86
- activeColor = '#5b8bf7',
87
101
  currentPage,
88
102
  onPageChange = () => null,
89
103
  visiblePages,
@@ -91,6 +105,13 @@ export default function Pagination({
91
105
  ...restProps
92
106
  }: PaginationProps) {
93
107
  const { xs: xsBreakpoint } = useThemeValue('breakpoints')
108
+ const {
109
+ activeColor = '#5b8bf7',
110
+ navButtonProps,
111
+ pageLinkProps,
112
+ activePageLinkProps,
113
+ ...themeProps
114
+ } = useThemeProps('pagination', { ...restProps })
94
115
 
95
116
  const currentWidth = useWindowWidth()
96
117
 
@@ -123,7 +144,12 @@ export default function Pagination({
123
144
  square
124
145
  title={number}
125
146
  variant={isCurrentPage ? 'fill' : 'naked'}
126
- {...(isCurrentPage && { backgroundColor: activeColor, color: '#fff' })}
147
+ {...pageLinkProps}
148
+ {...(isCurrentPage && {
149
+ backgroundColor: activeColor,
150
+ color: '#fff',
151
+ ...activePageLinkProps,
152
+ })}
127
153
  />
128
154
  )
129
155
  }
@@ -150,7 +176,7 @@ export default function Pagination({
150
176
  shrink={0}
151
177
  spacing={0.5}
152
178
  width="100%"
153
- {...restProps}
179
+ {...themeProps}
154
180
  >
155
181
  <Group spacing={0.5}>
156
182
  <NavButton
@@ -158,12 +184,14 @@ export default function Pagination({
158
184
  iconName="general.leftChevron"
159
185
  onClick={onPageChange.bind(null, currentPage - 1)}
160
186
  tooltip={{ title: 'Previous Page' }}
187
+ {...navButtonProps}
161
188
  />
162
189
  <NavButton
163
190
  disabled={currentPage === totalPages}
164
191
  iconName="general.rightChevron"
165
192
  onClick={onPageChange.bind(null, currentPage + 1)}
166
193
  tooltip={{ title: 'Next Page' }}
194
+ {...navButtonProps}
167
195
  />
168
196
  </Group>
169
197
  {renderPageLinks()}
@@ -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(() => open(), instantDelay ? 0 : openDelay)
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