@cloudflare/component-page 9.2.12 → 9.2.13

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,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.2.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 0b80625bc2: Pass through additional props to the Main Component from Page Component
8
+
9
+ This enable a user to provide props that override the default props used with the <Main /> component inside Page.tsx.
10
+
3
11
  ## 9.2.12
4
12
 
5
13
  ### Patch Changes
package/es/Page.js CHANGED
@@ -1,3 +1,11 @@
1
+ var _excluded = ["title", "parentPageLabel", "description", "documentationLabel", "documentationHref", "centerHeader", "beta", "testId", "className", "sidebar", "type", "sidebarPosition", "autofocus", "control", "titleRef", "parentPageLabelRef", "children", "navigation", "onDocumentationButtonClick", "documentationAsButton"];
2
+
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+
5
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
+
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
+
1
9
  import React, { useEffect, useRef } from 'react';
2
10
  import { useHistory } from 'react-router-dom';
3
11
  import { createStyledComponent } from '@cloudflare/style-container';
@@ -139,7 +147,9 @@ var Page = _ref2 => {
139
147
  navigation,
140
148
  onDocumentationButtonClick,
141
149
  documentationAsButton
142
- } = _ref2;
150
+ } = _ref2,
151
+ props = _objectWithoutProperties(_ref2, _excluded);
152
+
143
153
  var history = useHistory();
144
154
  var skipTargetRef = useRef(null);
145
155
  var path = history === null || history === void 0 ? void 0 : (_history$location = history.location) === null || _history$location === void 0 ? void 0 : _history$location.pathname;
@@ -156,13 +166,13 @@ var Page = _ref2 => {
156
166
  }
157
167
  }, [path]);
158
168
  var sidebarInside = sidebarPosition === 'inside';
159
- return /*#__PURE__*/React.createElement(Main, {
169
+ return /*#__PURE__*/React.createElement(Main, _extends({
160
170
  "data-testid": testId,
161
171
  className: className,
162
172
  display: sidebar && sidebarInside ? undefined : 'flex',
163
173
  py: 4,
164
174
  mb: 4
165
- }, /*#__PURE__*/React.createElement(Div, {
175
+ }, props), /*#__PURE__*/React.createElement(Div, {
166
176
  ml: "auto",
167
177
  mr: sidebar && !sidebarInside ? 0 : 'auto',
168
178
  display: sidebar && sidebarInside ? ['block', 'block', 'flex'] : undefined,
package/lib/Page.js CHANGED
@@ -29,10 +29,18 @@ var _componentIcon = require("@cloudflare/component-icon");
29
29
 
30
30
  var _componentButton = require("@cloudflare/component-button");
31
31
 
32
+ var _excluded = ["title", "parentPageLabel", "description", "documentationLabel", "documentationHref", "centerHeader", "beta", "testId", "className", "sidebar", "type", "sidebarPosition", "autofocus", "control", "titleRef", "parentPageLabelRef", "children", "navigation", "onDocumentationButtonClick", "documentationAsButton"];
33
+
32
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
35
 
34
36
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
37
 
38
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
39
+
40
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
41
+
42
+ 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; }
43
+
36
44
  var maxWidthByType = {
37
45
  narrow: '64em',
38
46
  wide: '79em',
@@ -164,7 +172,9 @@ var Page = function Page(_ref2) {
164
172
  children = _ref2.children,
165
173
  navigation = _ref2.navigation,
166
174
  onDocumentationButtonClick = _ref2.onDocumentationButtonClick,
167
- documentationAsButton = _ref2.documentationAsButton;
175
+ documentationAsButton = _ref2.documentationAsButton,
176
+ props = _objectWithoutProperties(_ref2, _excluded);
177
+
168
178
  var history = (0, _reactRouterDom.useHistory)();
169
179
  var skipTargetRef = (0, _react.useRef)(null);
170
180
  var path = history === null || history === void 0 ? void 0 : (_history$location = history.location) === null || _history$location === void 0 ? void 0 : _history$location.pathname;
@@ -181,13 +191,13 @@ var Page = function Page(_ref2) {
181
191
  }
182
192
  }, [path]);
183
193
  var sidebarInside = sidebarPosition === 'inside';
184
- return /*#__PURE__*/_react.default.createElement(_elements.Main, {
194
+ return /*#__PURE__*/_react.default.createElement(_elements.Main, _extends({
185
195
  "data-testid": testId,
186
196
  className: className,
187
197
  display: sidebar && sidebarInside ? undefined : 'flex',
188
198
  py: 4,
189
199
  mb: 4
190
- }, /*#__PURE__*/_react.default.createElement(_elements.Div, {
200
+ }, props), /*#__PURE__*/_react.default.createElement(_elements.Div, {
191
201
  ml: "auto",
192
202
  mr: sidebar && !sidebarInside ? 0 : 'auto',
193
203
  display: sidebar && sidebarInside ? ['block', 'block', 'flex'] : undefined,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudflare/component-page",
3
3
  "description": "Cloudflare Page Component",
4
- "version": "9.2.12",
4
+ "version": "9.2.13",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
7
  "author": "James Kyle <jkyle@cloudflare.com>",
package/src/Page.tsx CHANGED
@@ -195,7 +195,8 @@ const Page = ({
195
195
  children,
196
196
  navigation,
197
197
  onDocumentationButtonClick,
198
- documentationAsButton
198
+ documentationAsButton,
199
+ ...props
199
200
  }: Props) => {
200
201
  const history = useHistory();
201
202
  const skipTargetRef = useRef<HTMLAnchorElement>(null);
@@ -223,6 +224,7 @@ const Page = ({
223
224
  display={sidebar && sidebarInside ? undefined : 'flex'}
224
225
  py={4}
225
226
  mb={4}
227
+ {...props}
226
228
  >
227
229
  <Div
228
230
  ml="auto"