@cloudflare/component-page 10.1.21 → 11.0.1
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 +17 -0
- package/README.md +21 -4
- package/es/Heading.js +1 -3
- package/es/Page.js +30 -53
- package/es/Page.stories.js +98 -170
- package/lib/Heading.js +1 -3
- package/lib/Page.js +32 -54
- package/lib/Page.stories.js +102 -173
- package/package.json +7 -7
- package/src/Page.stories.tsx +31 -9
- package/src/Page.tsx +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 11.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fc455fa761: Require explicit opt-in before injecting source-file debug attributes into package build artifacts.
|
|
8
|
+
- Updated dependencies [fc455fa761]
|
|
9
|
+
- @cloudflare/component-label@6.0.7
|
|
10
|
+
- @cloudflare/component-link@10.0.6
|
|
11
|
+
- @cloudflare/elements@4.0.7
|
|
12
|
+
- @cloudflare/util-cl1-compat-router@3.0.1
|
|
13
|
+
|
|
14
|
+
## 11.0.0
|
|
15
|
+
|
|
16
|
+
### Major Changes
|
|
17
|
+
|
|
18
|
+
- 7ecedcf71d: Use router location from the CL1 compat router context and use it for page autofocus behavior while removing the `react-router-dom` peer dependency from the page component.
|
|
19
|
+
|
|
3
20
|
## 10.1.21
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -15,17 +15,34 @@ $ yarn add @cloudflare/component-page
|
|
|
15
15
|
|
|
16
16
|
```jsx
|
|
17
17
|
import React from 'react';
|
|
18
|
-
import { Page } from '
|
|
18
|
+
import { Page } from '@cloudflare/component-page';
|
|
19
|
+
import { CL1CompatRouterProvider } from '@cloudflare/util-cl1-compat-router';
|
|
20
|
+
|
|
21
|
+
const RouterLink = ({ to, ...props }) => <a {...props} href={to} />;
|
|
22
|
+
const navigate = to => {
|
|
23
|
+
window.location.assign(to);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const location = {
|
|
27
|
+
pathname: window.location.pathname,
|
|
28
|
+
search: window.location.search,
|
|
29
|
+
hash: window.location.hash
|
|
30
|
+
};
|
|
19
31
|
|
|
20
32
|
const PageComponent = () => (
|
|
21
|
-
<
|
|
33
|
+
<CL1CompatRouterProvider
|
|
34
|
+
location={location}
|
|
35
|
+
navigate={navigate}
|
|
36
|
+
linkComponent={RouterLink}
|
|
37
|
+
>
|
|
38
|
+
<Page type="wide" title="Title" description="Subtitle" beta>
|
|
22
39
|
<div>Awesome page content.</div>
|
|
23
40
|
<div>Please buy our things.</div>
|
|
24
|
-
|
|
41
|
+
</Page>
|
|
42
|
+
</CL1CompatRouterProvider>
|
|
25
43
|
);
|
|
26
44
|
|
|
27
45
|
export default PageComponent;
|
|
28
46
|
|
|
29
47
|
```
|
|
30
48
|
|
|
31
|
-
|
package/es/Heading.js
CHANGED
package/es/Page.js
CHANGED
|
@@ -7,7 +7,6 @@ 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 { useLocation } from 'react-router-dom';
|
|
11
10
|
import { createStyledComponent } from '@cloudflare/style-container';
|
|
12
11
|
import { Main, Header, Div, P, Span } from '@cloudflare/elements';
|
|
13
12
|
import { Label } from '@cloudflare/component-label';
|
|
@@ -18,6 +17,7 @@ import { useIsMobile } from '@cloudflare/util-responsive';
|
|
|
18
17
|
import { Icon } from '@cloudflare/component-icon';
|
|
19
18
|
import { Button } from '@cloudflare/component-button';
|
|
20
19
|
import { Tooltip } from '@cloudflare/component-tooltip';
|
|
20
|
+
import { useLocation } from '@cloudflare/util-cl1-compat-router';
|
|
21
21
|
var maxWidthByType = {
|
|
22
22
|
narrow: '64em',
|
|
23
23
|
wide: '79em',
|
|
@@ -46,68 +46,55 @@ var PageHeader = _ref => {
|
|
|
46
46
|
var titlesCount = Math.min([title, description].filter(Boolean).length, 2);
|
|
47
47
|
var isMobile = useIsMobile();
|
|
48
48
|
return /*#__PURE__*/React.createElement(React.Fragment, null, navigation && !isMobile && /*#__PURE__*/React.createElement(Div, {
|
|
49
|
-
mb: 4
|
|
50
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:72"
|
|
49
|
+
mb: 4
|
|
51
50
|
}, navigation), /*#__PURE__*/React.createElement(Div, {
|
|
52
51
|
display: control ? ['block', 'flex'] : 'block',
|
|
53
52
|
justifyContent: "space-between",
|
|
54
|
-
mb: headerVisible ? 3 : 0
|
|
55
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:73"
|
|
53
|
+
mb: headerVisible ? 3 : 0
|
|
56
54
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
57
|
-
textAlign: centerHeader ? 'center' : undefined
|
|
58
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:78"
|
|
55
|
+
textAlign: centerHeader ? 'center' : undefined
|
|
59
56
|
}, parentPageLabel && /*#__PURE__*/React.createElement(P, {
|
|
60
57
|
my: 0,
|
|
61
58
|
lineHeight: 1.5,
|
|
62
59
|
color: "gray.3",
|
|
63
60
|
fontWeight: 600,
|
|
64
|
-
innerRef: parentPageLabelRef
|
|
65
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:80"
|
|
61
|
+
innerRef: parentPageLabelRef
|
|
66
62
|
}, parentPageLabel), title && /*#__PURE__*/React.createElement(Div, {
|
|
67
63
|
display: "flex",
|
|
68
|
-
alignItems: "center"
|
|
69
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:91"
|
|
64
|
+
alignItems: "center"
|
|
70
65
|
}, /*#__PURE__*/React.createElement(Heading, {
|
|
71
66
|
mt: 0,
|
|
72
67
|
mb: 2,
|
|
73
|
-
innerRef: titleRef
|
|
74
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:92"
|
|
68
|
+
innerRef: titleRef
|
|
75
69
|
}, isMobile && navigation && /*#__PURE__*/React.isValidElement(navigation) && /*#__PURE__*/React.createElement(Link, {
|
|
76
70
|
mr: 2,
|
|
77
|
-
onClick: navigation.props.onClick
|
|
78
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:94"
|
|
71
|
+
onClick: navigation.props.onClick
|
|
79
72
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
80
|
-
type: "backward"
|
|
81
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:95"
|
|
73
|
+
type: "backward"
|
|
82
74
|
})), title), beta && /*#__PURE__*/React.createElement(Label, {
|
|
83
75
|
hue: "orange",
|
|
84
76
|
mx: 2,
|
|
85
|
-
verticalAlign: "middle"
|
|
86
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:101"
|
|
77
|
+
verticalAlign: "middle"
|
|
87
78
|
}, /*#__PURE__*/React.createElement(Trans, {
|
|
88
79
|
_: "Beta",
|
|
89
|
-
id: "common.beta"
|
|
90
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:102"
|
|
80
|
+
id: "common.beta"
|
|
91
81
|
}))), description && /*#__PURE__*/React.createElement(P, {
|
|
92
82
|
color: "gray.3",
|
|
93
83
|
mt: 0,
|
|
94
84
|
mb: documentationHref ? 2 : 3,
|
|
95
85
|
lineHeight: 1.25,
|
|
96
86
|
fontWeight: 400,
|
|
97
|
-
wordBreak: "break-word"
|
|
98
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:108"
|
|
87
|
+
wordBreak: "break-word"
|
|
99
88
|
}, description), documentationAsButton && !isMobile ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
100
89
|
place: "right",
|
|
101
90
|
message: /*#__PURE__*/React.createElement(Trans, {
|
|
102
91
|
id: "common.open_documentation",
|
|
103
|
-
_: 'Open documentation'
|
|
104
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:123"
|
|
92
|
+
_: 'Open documentation'
|
|
105
93
|
}),
|
|
106
94
|
Component: Span,
|
|
107
95
|
buttonProps: {
|
|
108
96
|
width: 'fit-content'
|
|
109
|
-
}
|
|
110
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:120"
|
|
97
|
+
}
|
|
111
98
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
112
99
|
type: "primary",
|
|
113
100
|
borderRadius: '20vh',
|
|
@@ -116,23 +103,19 @@ var PageHeader = _ref => {
|
|
|
116
103
|
onClick: onDocumentationButtonClick,
|
|
117
104
|
px: 3,
|
|
118
105
|
py: 1,
|
|
119
|
-
ariaLabel: "open documentation - ".concat(documentationLabel)
|
|
120
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:131"
|
|
106
|
+
ariaLabel: "open documentation - ".concat(documentationLabel)
|
|
121
107
|
}, documentationLabel)) : documentationHref && /*#__PURE__*/React.createElement(DocumentationLink, {
|
|
122
108
|
fontSize: 2,
|
|
123
109
|
iconSize: 14,
|
|
124
110
|
mb: [3, 0],
|
|
125
111
|
href: documentationHref,
|
|
126
|
-
display: "inline-block"
|
|
127
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:146"
|
|
112
|
+
display: "inline-block"
|
|
128
113
|
}, documentationLabel ? documentationLabel : /*#__PURE__*/React.createElement(Trans, {
|
|
129
114
|
id: "common.documentation",
|
|
130
|
-
_: 'Documentation'
|
|
131
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:156"
|
|
115
|
+
_: 'Documentation'
|
|
132
116
|
}))), control), /*#__PURE__*/React.createElement(Section, {
|
|
133
117
|
level: titlesCount,
|
|
134
|
-
offset: maxPageTitles - titlesCount
|
|
135
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:164"
|
|
118
|
+
offset: maxPageTitles - titlesCount
|
|
136
119
|
}, children));
|
|
137
120
|
};
|
|
138
121
|
|
|
@@ -180,21 +163,22 @@ var Page = _ref2 => {
|
|
|
180
163
|
} = _ref2,
|
|
181
164
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
182
165
|
|
|
183
|
-
var location = useLocation();
|
|
184
166
|
var skipTargetRef = useRef(null);
|
|
185
|
-
var
|
|
167
|
+
var {
|
|
168
|
+
pathname
|
|
169
|
+
} = useLocation();
|
|
186
170
|
useEffect(() => {
|
|
187
171
|
// If autofocus is enabled, then focus will move to the title block when
|
|
188
172
|
// the page is navigated to (but not when the dash is first loaded)
|
|
189
173
|
if (autofocus) {
|
|
190
174
|
if (!firstPage) {
|
|
191
|
-
firstPage =
|
|
192
|
-
} else if (firstPage !==
|
|
175
|
+
firstPage = pathname;
|
|
176
|
+
} else if (firstPage !== pathname || !firstLoad) {
|
|
193
177
|
focus(skipTargetRef.current);
|
|
194
178
|
firstLoad = false;
|
|
195
179
|
}
|
|
196
180
|
}
|
|
197
|
-
}, [
|
|
181
|
+
}, [pathname]);
|
|
198
182
|
var sidebarInside = sidebarPosition === 'inside';
|
|
199
183
|
return /*#__PURE__*/React.createElement(Main, _extends({
|
|
200
184
|
"data-testid": testId,
|
|
@@ -202,25 +186,20 @@ var Page = _ref2 => {
|
|
|
202
186
|
display: sidebar && sidebarInside ? undefined : 'flex',
|
|
203
187
|
py: 4,
|
|
204
188
|
mb: 4
|
|
205
|
-
}, props, {
|
|
206
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:237"
|
|
207
|
-
}), /*#__PURE__*/React.createElement(Div, {
|
|
189
|
+
}, props), /*#__PURE__*/React.createElement(Div, {
|
|
208
190
|
ml: "auto",
|
|
209
191
|
mr: sidebar && !sidebarInside ? 0 : 'auto',
|
|
210
192
|
display: sidebar && sidebarInside ? ['block', 'block', 'flex'] : undefined,
|
|
211
193
|
width: type === 'unbounded' ? '100%' : '90%',
|
|
212
|
-
maxWidth: maxWidthByType[type] || maxWidthByType.narrow
|
|
213
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:245"
|
|
194
|
+
maxWidth: maxWidthByType[type] || maxWidthByType.narrow
|
|
214
195
|
}, /*#__PURE__*/React.createElement(Div, {
|
|
215
196
|
width: sidebar && sidebarInside ? [1, 1, 2 / 3] : undefined,
|
|
216
197
|
pr: sidebar && sidebarInside ? [0, 0, 3] : undefined,
|
|
217
|
-
mt: 0
|
|
218
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:254"
|
|
198
|
+
mt: 0
|
|
219
199
|
}, /*#__PURE__*/React.createElement("a", {
|
|
220
200
|
id: "skipTarget",
|
|
221
201
|
ref: skipTargetRef,
|
|
222
|
-
tabIndex: -1
|
|
223
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:259"
|
|
202
|
+
tabIndex: -1
|
|
224
203
|
}), /*#__PURE__*/React.createElement(PageHeader, {
|
|
225
204
|
title: title,
|
|
226
205
|
parentPageLabel: parentPageLabel,
|
|
@@ -235,13 +214,11 @@ var Page = _ref2 => {
|
|
|
235
214
|
parentPageLabelRef: parentPageLabelRef,
|
|
236
215
|
navigation: navigation,
|
|
237
216
|
onDocumentationButtonClick: onDocumentationButtonClick,
|
|
238
|
-
documentationAsButton: documentationAsButton
|
|
239
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:261"
|
|
217
|
+
documentationAsButton: documentationAsButton
|
|
240
218
|
})), sidebar && sidebarInside && /*#__PURE__*/React.createElement(Div, {
|
|
241
219
|
width: [1, 1, 1 / 3],
|
|
242
220
|
pl: [0, 0, 3],
|
|
243
|
-
pt: [4, 4, 0]
|
|
244
|
-
"data-source-file": "@cloudflare/component-page:src/Page.tsx:279"
|
|
221
|
+
pt: [4, 4, 0]
|
|
245
222
|
}, sidebar)), !sidebarInside && sidebar);
|
|
246
223
|
};
|
|
247
224
|
|
package/es/Page.stories.js
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
|
+
var _excluded = ["to", "children"];
|
|
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 from 'react';
|
|
2
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
3
10
|
import { Button } from '@cloudflare/component-button';
|
|
4
11
|
import { Card } from '@cloudflare/component-card';
|
|
5
12
|
import { Div, P } from '@cloudflare/elements';
|
|
13
|
+
import { CL1CompatRouterProvider } from '@cloudflare/util-cl1-compat-router';
|
|
6
14
|
import Page from './Page';
|
|
15
|
+
var StoryLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
16
|
+
var {
|
|
17
|
+
to,
|
|
18
|
+
children
|
|
19
|
+
} = _ref,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
|
|
22
|
+
return /*#__PURE__*/React.createElement("a", _extends({}, props, {
|
|
23
|
+
href: to,
|
|
24
|
+
ref: ref
|
|
25
|
+
}), children);
|
|
26
|
+
});
|
|
27
|
+
StoryLink.displayName = 'StoryLink';
|
|
28
|
+
var storyLocation = {
|
|
29
|
+
pathname: '/'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var storyNavigate = () => undefined;
|
|
33
|
+
|
|
7
34
|
export default {
|
|
8
35
|
title: 'Dash/Core/Page',
|
|
9
36
|
component: Page,
|
|
10
|
-
decorators: [Story => /*#__PURE__*/React.createElement(BrowserRouter, {
|
|
11
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:14"
|
|
12
|
-
}, /*#__PURE__*/React.createElement(Story, {
|
|
13
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:15"
|
|
14
|
-
}))],
|
|
15
37
|
parameters: {
|
|
16
38
|
layout: 'fullscreen',
|
|
17
39
|
docs: {
|
|
@@ -19,208 +41,137 @@ export default {
|
|
|
19
41
|
component: 'A flexible page layout component with header, optional sidebar, and content area. Supports different width configurations and responsive behavior.'
|
|
20
42
|
}
|
|
21
43
|
}
|
|
22
|
-
}
|
|
44
|
+
},
|
|
45
|
+
decorators: [Story => /*#__PURE__*/React.createElement(CL1CompatRouterProvider, {
|
|
46
|
+
location: storyLocation,
|
|
47
|
+
navigate: storyNavigate,
|
|
48
|
+
linkComponent: StoryLink
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Story, null))]
|
|
23
50
|
}; // Sample content components for stories
|
|
24
51
|
|
|
25
|
-
var SampleContent = () => /*#__PURE__*/React.createElement(Div, {
|
|
26
|
-
|
|
27
|
-
}, /*#__PURE__*/React.createElement(
|
|
28
|
-
mb: 4,
|
|
29
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:33"
|
|
30
|
-
}, "This is sample page content. The Page component provides a consistent layout structure with header, optional sidebar, and main content area."), /*#__PURE__*/React.createElement(Card, {
|
|
31
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:37"
|
|
32
|
-
}, /*#__PURE__*/React.createElement(Div, {
|
|
52
|
+
var SampleContent = () => /*#__PURE__*/React.createElement(Div, null, /*#__PURE__*/React.createElement(P, {
|
|
53
|
+
mb: 4
|
|
54
|
+
}, "This is sample page content. The Page component provides a consistent layout structure with header, optional sidebar, and main content area."), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Div, {
|
|
33
55
|
p: 4,
|
|
34
|
-
mb: 4
|
|
35
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:38"
|
|
56
|
+
mb: 4
|
|
36
57
|
}, /*#__PURE__*/React.createElement(P, {
|
|
37
58
|
mb: 2,
|
|
38
|
-
fontWeight: "bold"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:42"
|
|
42
|
-
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."))), /*#__PURE__*/React.createElement(Card, {
|
|
43
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:48"
|
|
44
|
-
}, /*#__PURE__*/React.createElement(Div, {
|
|
45
|
-
p: 4,
|
|
46
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:49"
|
|
59
|
+
fontWeight: "bold"
|
|
60
|
+
}, "Sample Card Content"), /*#__PURE__*/React.createElement(P, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."))), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Div, {
|
|
61
|
+
p: 4
|
|
47
62
|
}, /*#__PURE__*/React.createElement(P, {
|
|
48
63
|
mb: 2,
|
|
49
|
-
fontWeight: "bold"
|
|
50
|
-
|
|
51
|
-
}, "Another Card"), /*#__PURE__*/React.createElement(P, {
|
|
52
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:53"
|
|
53
|
-
}, "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."))));
|
|
64
|
+
fontWeight: "bold"
|
|
65
|
+
}, "Another Card"), /*#__PURE__*/React.createElement(P, null, "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."))));
|
|
54
66
|
|
|
55
|
-
var SampleSidebar = () => /*#__PURE__*/React.createElement(Card, {
|
|
56
|
-
|
|
57
|
-
}, /*#__PURE__*/React.createElement(Div, {
|
|
58
|
-
p: 4,
|
|
59
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:64"
|
|
67
|
+
var SampleSidebar = () => /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Div, {
|
|
68
|
+
p: 4
|
|
60
69
|
}, /*#__PURE__*/React.createElement(P, {
|
|
61
70
|
mb: 3,
|
|
62
|
-
fontWeight: "bold"
|
|
63
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:65"
|
|
71
|
+
fontWeight: "bold"
|
|
64
72
|
}, "Sidebar Content"), /*#__PURE__*/React.createElement(P, {
|
|
65
|
-
mb: 2
|
|
66
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:68"
|
|
73
|
+
mb: 2
|
|
67
74
|
}, "Quick Actions:"), /*#__PURE__*/React.createElement(Div, {
|
|
68
|
-
mb: 2
|
|
69
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:69"
|
|
75
|
+
mb: 2
|
|
70
76
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
71
77
|
type: "primary",
|
|
72
|
-
width: "100%"
|
|
73
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:70"
|
|
78
|
+
width: "100%"
|
|
74
79
|
}, "Primary Action")), /*#__PURE__*/React.createElement(Div, {
|
|
75
|
-
mb: 2
|
|
76
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:74"
|
|
80
|
+
mb: 2
|
|
77
81
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
78
82
|
type: "default",
|
|
79
|
-
width: "100%"
|
|
80
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:75"
|
|
83
|
+
width: "100%"
|
|
81
84
|
}, "Secondary Action")), /*#__PURE__*/React.createElement(P, {
|
|
82
85
|
mt: 3,
|
|
83
86
|
fontSize: 1,
|
|
84
|
-
color: "gray.3"
|
|
85
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:79"
|
|
87
|
+
color: "gray.3"
|
|
86
88
|
}, "Additional sidebar information and links can go here.")));
|
|
87
89
|
|
|
88
90
|
var SampleControl = () => /*#__PURE__*/React.createElement(Div, {
|
|
89
91
|
display: "flex",
|
|
90
|
-
alignItems: "center"
|
|
91
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:87"
|
|
92
|
+
alignItems: "center"
|
|
92
93
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
93
94
|
type: "primary",
|
|
94
|
-
mr: 2
|
|
95
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:88"
|
|
95
|
+
mr: 2
|
|
96
96
|
}, "Create New"), /*#__PURE__*/React.createElement(Button, {
|
|
97
|
-
type: "default"
|
|
98
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:91"
|
|
97
|
+
type: "default"
|
|
99
98
|
}, "Settings"));
|
|
100
99
|
|
|
101
100
|
var SampleNavigation = () => /*#__PURE__*/React.createElement(Button, {
|
|
102
101
|
type: "plain",
|
|
103
102
|
iconType: "backward",
|
|
104
|
-
onClick: () => console.log('Navigate back')
|
|
105
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:96"
|
|
103
|
+
onClick: () => console.log('Navigate back')
|
|
106
104
|
}, "Back to Dashboard");
|
|
107
105
|
|
|
108
106
|
export var Default = () => /*#__PURE__*/React.createElement(Page, {
|
|
109
107
|
title: "Page Title",
|
|
110
|
-
description: "This is a description of what this page is about and what users can expect to find here."
|
|
111
|
-
|
|
112
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
113
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:110"
|
|
114
|
-
}));
|
|
108
|
+
description: "This is a description of what this page is about and what users can expect to find here."
|
|
109
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
115
110
|
export var WithParentLabel = () => /*#__PURE__*/React.createElement(Page, {
|
|
116
111
|
title: "Settings",
|
|
117
112
|
parentPageLabel: "Account Management",
|
|
118
|
-
description: "Configure your account settings and preferences."
|
|
119
|
-
|
|
120
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
121
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:120"
|
|
122
|
-
}));
|
|
113
|
+
description: "Configure your account settings and preferences."
|
|
114
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
123
115
|
export var WithBeta = () => /*#__PURE__*/React.createElement(Page, {
|
|
124
116
|
title: "New Feature",
|
|
125
117
|
description: "This is a beta feature that is still in development.",
|
|
126
|
-
beta: true
|
|
127
|
-
|
|
128
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
129
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:130"
|
|
130
|
-
}));
|
|
118
|
+
beta: true
|
|
119
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
131
120
|
export var WithDocumentation = () => /*#__PURE__*/React.createElement(Page, {
|
|
132
121
|
title: "API Documentation",
|
|
133
122
|
description: "Learn how to integrate with our API endpoints.",
|
|
134
123
|
documentationLabel: "View API Docs",
|
|
135
|
-
documentationHref: "https://developers.cloudflare.com"
|
|
136
|
-
|
|
137
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
138
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:141"
|
|
139
|
-
}));
|
|
124
|
+
documentationHref: "https://developers.cloudflare.com"
|
|
125
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
140
126
|
export var WithDocumentationButton = () => /*#__PURE__*/React.createElement(Page, {
|
|
141
127
|
title: "Advanced Configuration",
|
|
142
128
|
description: "Configure advanced settings for your application.",
|
|
143
129
|
documentationLabel: "Help",
|
|
144
130
|
documentationAsButton: true,
|
|
145
|
-
onDocumentationButtonClick: () => console.log('Documentation button clicked')
|
|
146
|
-
|
|
147
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
148
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:155"
|
|
149
|
-
}));
|
|
131
|
+
onDocumentationButtonClick: () => console.log('Documentation button clicked')
|
|
132
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
150
133
|
export var WithSidebarInside = () => /*#__PURE__*/React.createElement(Page, {
|
|
151
134
|
title: "Dashboard",
|
|
152
135
|
description: "Overview of your account activity and quick actions.",
|
|
153
|
-
sidebar: /*#__PURE__*/React.createElement(SampleSidebar,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
sidebarPosition: "inside",
|
|
157
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:160"
|
|
158
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
159
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:166"
|
|
160
|
-
}));
|
|
136
|
+
sidebar: /*#__PURE__*/React.createElement(SampleSidebar, null),
|
|
137
|
+
sidebarPosition: "inside"
|
|
138
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
161
139
|
export var WithSidebarOutside = () => /*#__PURE__*/React.createElement(Page, {
|
|
162
140
|
title: "Analytics",
|
|
163
141
|
description: "View detailed analytics and performance metrics.",
|
|
164
|
-
sidebar: /*#__PURE__*/React.createElement(SampleSidebar,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
sidebarPosition: "outside",
|
|
168
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:171"
|
|
169
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
170
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:177"
|
|
171
|
-
}));
|
|
142
|
+
sidebar: /*#__PURE__*/React.createElement(SampleSidebar, null),
|
|
143
|
+
sidebarPosition: "outside"
|
|
144
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
172
145
|
export var WithControl = () => /*#__PURE__*/React.createElement(Page, {
|
|
173
146
|
title: "User Management",
|
|
174
147
|
description: "Manage users and their permissions.",
|
|
175
|
-
control: /*#__PURE__*/React.createElement(SampleControl,
|
|
176
|
-
|
|
177
|
-
}),
|
|
178
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:182"
|
|
179
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
180
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:187"
|
|
181
|
-
}));
|
|
148
|
+
control: /*#__PURE__*/React.createElement(SampleControl, null)
|
|
149
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
182
150
|
export var WithNavigation = () => /*#__PURE__*/React.createElement(Page, {
|
|
183
151
|
title: "Project Details",
|
|
184
152
|
description: "View and edit project configuration.",
|
|
185
|
-
navigation: /*#__PURE__*/React.createElement(SampleNavigation,
|
|
186
|
-
|
|
187
|
-
}),
|
|
188
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:192"
|
|
189
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
190
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:197"
|
|
191
|
-
}));
|
|
153
|
+
navigation: /*#__PURE__*/React.createElement(SampleNavigation, null)
|
|
154
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
192
155
|
export var CenteredHeader = () => /*#__PURE__*/React.createElement(Page, {
|
|
193
156
|
title: "Welcome",
|
|
194
157
|
description: "Welcome to your dashboard. Get started by exploring the features below.",
|
|
195
|
-
centerHeader: true
|
|
196
|
-
|
|
197
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
198
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:207"
|
|
199
|
-
}));
|
|
158
|
+
centerHeader: true
|
|
159
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
200
160
|
export var NarrowWidth = () => /*#__PURE__*/React.createElement(Page, {
|
|
201
161
|
title: "Narrow Page",
|
|
202
162
|
description: "This page uses the narrow width configuration for focused content.",
|
|
203
|
-
type: "narrow"
|
|
204
|
-
|
|
205
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
206
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:217"
|
|
207
|
-
}));
|
|
163
|
+
type: "narrow"
|
|
164
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
208
165
|
export var WideWidth = () => /*#__PURE__*/React.createElement(Page, {
|
|
209
166
|
title: "Wide Page",
|
|
210
167
|
description: "This page uses the wide width configuration for more content.",
|
|
211
|
-
type: "wide"
|
|
212
|
-
|
|
213
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
214
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:227"
|
|
215
|
-
}));
|
|
168
|
+
type: "wide"
|
|
169
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
216
170
|
export var UnboundedWidth = () => /*#__PURE__*/React.createElement(Page, {
|
|
217
171
|
title: "Unbounded Page",
|
|
218
172
|
description: "This page uses the unbounded width configuration for full-width content.",
|
|
219
|
-
type: "unbounded"
|
|
220
|
-
|
|
221
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
222
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:237"
|
|
223
|
-
}));
|
|
173
|
+
type: "unbounded"
|
|
174
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
224
175
|
export var ComplexExample = () => /*#__PURE__*/React.createElement(Page, {
|
|
225
176
|
title: "Complex Page Example",
|
|
226
177
|
parentPageLabel: "Advanced Features",
|
|
@@ -228,51 +179,28 @@ export var ComplexExample = () => /*#__PURE__*/React.createElement(Page, {
|
|
|
228
179
|
beta: true,
|
|
229
180
|
documentationLabel: "Learn More",
|
|
230
181
|
documentationHref: "https://developers.cloudflare.com",
|
|
231
|
-
control: /*#__PURE__*/React.createElement(SampleControl,
|
|
232
|
-
|
|
233
|
-
}),
|
|
234
|
-
sidebar: /*#__PURE__*/React.createElement(SampleSidebar, {
|
|
235
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:250"
|
|
236
|
-
}),
|
|
182
|
+
control: /*#__PURE__*/React.createElement(SampleControl, null),
|
|
183
|
+
sidebar: /*#__PURE__*/React.createElement(SampleSidebar, null),
|
|
237
184
|
sidebarPosition: "inside",
|
|
238
|
-
navigation: /*#__PURE__*/React.createElement(SampleNavigation,
|
|
239
|
-
|
|
240
|
-
}),
|
|
241
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:242"
|
|
242
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
243
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:254"
|
|
244
|
-
}));
|
|
185
|
+
navigation: /*#__PURE__*/React.createElement(SampleNavigation, null)
|
|
186
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
245
187
|
export var MinimalExample = () => /*#__PURE__*/React.createElement(Page, {
|
|
246
|
-
title: "Minimal Page"
|
|
247
|
-
|
|
248
|
-
}, /*#__PURE__*/React.createElement(P, {
|
|
249
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:260"
|
|
250
|
-
}, "This is a minimal page with just a title and simple content."));
|
|
188
|
+
title: "Minimal Page"
|
|
189
|
+
}, /*#__PURE__*/React.createElement(P, null, "This is a minimal page with just a title and simple content."));
|
|
251
190
|
export var NoTitle = () => /*#__PURE__*/React.createElement(Page, {
|
|
252
|
-
description: "A page without a title, showing just the description."
|
|
253
|
-
|
|
254
|
-
}, /*#__PURE__*/React.createElement(SampleContent, {
|
|
255
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:266"
|
|
256
|
-
}));
|
|
191
|
+
description: "A page without a title, showing just the description."
|
|
192
|
+
}, /*#__PURE__*/React.createElement(SampleContent, null));
|
|
257
193
|
export var LongContent = () => /*#__PURE__*/React.createElement(Page, {
|
|
258
194
|
title: "Long Content Example",
|
|
259
|
-
description: "This page demonstrates how the component handles longer content."
|
|
260
|
-
|
|
261
|
-
}, /*#__PURE__*/React.createElement(Div, {
|
|
262
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:275"
|
|
263
|
-
}, Array.from({
|
|
195
|
+
description: "This page demonstrates how the component handles longer content."
|
|
196
|
+
}, /*#__PURE__*/React.createElement(Div, null, Array.from({
|
|
264
197
|
length: 10
|
|
265
198
|
}, (_, i) => /*#__PURE__*/React.createElement(Card, {
|
|
266
|
-
key: i
|
|
267
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:277"
|
|
199
|
+
key: i
|
|
268
200
|
}, /*#__PURE__*/React.createElement(Div, {
|
|
269
201
|
p: 4,
|
|
270
|
-
mb: 4
|
|
271
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:278"
|
|
202
|
+
mb: 4
|
|
272
203
|
}, /*#__PURE__*/React.createElement(P, {
|
|
273
204
|
mb: 2,
|
|
274
|
-
fontWeight: "bold"
|
|
275
|
-
|
|
276
|
-
}, "Section ", i + 1), /*#__PURE__*/React.createElement(P, {
|
|
277
|
-
"data-source-file": "@cloudflare/component-page:src/Page.stories.tsx:282"
|
|
278
|
-
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."))))));
|
|
205
|
+
fontWeight: "bold"
|
|
206
|
+
}, "Section ", i + 1), /*#__PURE__*/React.createElement(P, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."))))));
|