@cloudflare/component-page 10.1.13 → 10.1.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.1.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 21e3904266: Get location from useLocation instead of useHistory
8
+
9
+ ## 10.1.14
10
+
11
+ ### Patch Changes
12
+
13
+ - @cloudflare/component-link@9.0.30
14
+
3
15
  ## 10.1.13
4
16
 
5
17
  ### Patch Changes
package/es/Page.js CHANGED
@@ -7,7 +7,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
7
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
8
 
9
9
  import React, { useEffect, useRef } from 'react';
10
- import { useHistory } from 'react-router-dom';
10
+ import { useLocation } from 'react-router-dom';
11
11
  import { createStyledComponent } from '@cloudflare/style-container';
12
12
  import { Main, Header, Div, P, Span } from '@cloudflare/elements';
13
13
  import { Label } from '@cloudflare/component-label';
@@ -139,8 +139,6 @@ var focus = function focus(el) {
139
139
  };
140
140
 
141
141
  var Page = _ref2 => {
142
- var _history$location;
143
-
144
142
  var {
145
143
  title,
146
144
  parentPageLabel,
@@ -165,9 +163,9 @@ var Page = _ref2 => {
165
163
  } = _ref2,
166
164
  props = _objectWithoutProperties(_ref2, _excluded);
167
165
 
168
- var history = useHistory();
166
+ var location = useLocation();
169
167
  var skipTargetRef = useRef(null);
170
- var path = history === null || history === void 0 ? void 0 : (_history$location = history.location) === null || _history$location === void 0 ? void 0 : _history$location.pathname;
168
+ var path = location === null || location === void 0 ? void 0 : location.pathname;
171
169
  useEffect(() => {
172
170
  // If autofocus is enabled, then focus will move to the title block when
173
171
  // the page is navigated to (but not when the dash is first loaded)
package/lib/Page.js CHANGED
@@ -164,8 +164,6 @@ var focus = function focus(el) {
164
164
  };
165
165
 
166
166
  var Page = function Page(_ref2) {
167
- var _history$location;
168
-
169
167
  var title = _ref2.title,
170
168
  parentPageLabel = _ref2.parentPageLabel,
171
169
  description = _ref2.description,
@@ -191,9 +189,9 @@ var Page = function Page(_ref2) {
191
189
  documentationAsButton = _ref2.documentationAsButton,
192
190
  props = _objectWithoutProperties(_ref2, _excluded);
193
191
 
194
- var history = (0, _reactRouterDom.useHistory)();
192
+ var location = (0, _reactRouterDom.useLocation)();
195
193
  var skipTargetRef = (0, _react.useRef)(null);
196
- var path = history === null || history === void 0 ? void 0 : (_history$location = history.location) === null || _history$location === void 0 ? void 0 : _history$location.pathname;
194
+ var path = location === null || location === void 0 ? void 0 : location.pathname;
197
195
  (0, _react.useEffect)(function () {
198
196
  // If autofocus is enabled, then focus will move to the title block when
199
197
  // the page is navigated to (but not when the dash is first loaded)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudflare/component-page",
3
3
  "description": "Cloudflare Page Component",
4
- "version": "10.1.13",
4
+ "version": "10.1.15",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
7
  "author": "James Kyle <jkyle@cloudflare.com>",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@cloudflare/component-label": "^6.0.4",
17
- "@cloudflare/component-link": "^9.0.29",
17
+ "@cloudflare/component-link": "^9.0.30",
18
18
  "@cloudflare/elements": "^4.0.4",
19
19
  "@cloudflare/intl-react": "^1.9.80"
20
20
  },
package/src/Page.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { useHistory } from 'react-router-dom';
2
+ import { useLocation } from 'react-router-dom';
3
3
  import { createStyledComponent } from '@cloudflare/style-container';
4
4
  import { Main, Header, Div, P, Span } from '@cloudflare/elements';
5
5
  import { Label } from '@cloudflare/component-label';
@@ -214,9 +214,9 @@ const Page = ({
214
214
  documentationAsButton,
215
215
  ...props
216
216
  }: Props) => {
217
- const history = useHistory();
217
+ const location = useLocation();
218
218
  const skipTargetRef = useRef<HTMLAnchorElement>(null);
219
- const path = history?.location?.pathname;
219
+ const path = location?.pathname;
220
220
 
221
221
  useEffect(() => {
222
222
  // If autofocus is enabled, then focus will move to the title block when