@automattic/jetpack-components 1.4.1 → 1.4.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.
- package/CHANGELOG.md +5 -0
- package/build/components/navigator-modal/header.d.ts +5 -1
- package/build/components/navigator-modal/header.js +2 -2
- package/build/components/navigator-modal/screen.d.ts +5 -1
- package/build/components/navigator-modal/screen.js +2 -2
- package/components/decorative-card/style.scss +0 -2
- package/components/navigator-modal/header.tsx +6 -1
- package/components/navigator-modal/screen.tsx +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
### This is a list detailing changes for the Jetpack RNA Components package releases.
|
|
4
4
|
|
|
5
|
+
## [1.4.2] - 2025-12-15
|
|
6
|
+
### Added
|
|
7
|
+
- NavigatorModal: Add header icon support for Screen component. [#46265]
|
|
8
|
+
|
|
5
9
|
## [1.4.1] - 2025-12-11
|
|
6
10
|
### Changed
|
|
7
11
|
- Improve scrolling for navigator modal sidebar and content. [#46252]
|
|
@@ -1587,6 +1591,7 @@
|
|
|
1587
1591
|
### Changed
|
|
1588
1592
|
- Update node version requirement to 14.16.1
|
|
1589
1593
|
|
|
1594
|
+
[1.4.2]: https://github.com/Automattic/jetpack-components/compare/1.4.1...1.4.2
|
|
1590
1595
|
[1.4.1]: https://github.com/Automattic/jetpack-components/compare/1.4.0...1.4.1
|
|
1591
1596
|
[1.4.0]: https://github.com/Automattic/jetpack-components/compare/1.3.13...1.4.0
|
|
1592
1597
|
[1.3.13]: https://github.com/Automattic/jetpack-components/compare/1.3.12...1.3.13
|
|
@@ -7,6 +7,10 @@ export type HeaderProps = {
|
|
|
7
7
|
* Whether the screen is locked, in which case to hide the back button.
|
|
8
8
|
*/
|
|
9
9
|
isScreenLocked?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Optional icon to display in the header.
|
|
12
|
+
*/
|
|
13
|
+
icon?: React.ReactNode;
|
|
10
14
|
};
|
|
11
15
|
/**
|
|
12
16
|
* Renders a header for the NavigatorModal.
|
|
@@ -14,4 +18,4 @@ export type HeaderProps = {
|
|
|
14
18
|
*
|
|
15
19
|
* @return component
|
|
16
20
|
*/
|
|
17
|
-
export declare function Header({ title, isScreenLocked }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function Header({ icon, title, isScreenLocked }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,11 +11,11 @@ import styles from './styles.module.scss';
|
|
|
11
11
|
*
|
|
12
12
|
* @return component
|
|
13
13
|
*/
|
|
14
|
-
export function Header({ title, isScreenLocked }) {
|
|
14
|
+
export function Header({ icon, title, isScreenLocked }) {
|
|
15
15
|
const context = useContext(NavigatorModalContext);
|
|
16
16
|
const navigator = useNavigator();
|
|
17
17
|
const onGoBack = useCallback(() => {
|
|
18
18
|
navigator.goBack();
|
|
19
19
|
}, [navigator]);
|
|
20
|
-
return (_jsxs("div", { className: styles.header, children: [_jsxs("div", { className: styles['title-wrap'], children: [!isScreenLocked ? (_jsx(Button, { label: __('Go back', 'jetpack-components'), icon: isRTL() ? chevronRight : chevronLeft, onClick: onGoBack, variant: "tertiary", size: "compact" })) : null, _jsx("h1", { children: title })] }), context.isDismissible ? (_jsx(Button, { size: "compact", onClick: context.onClose, icon: close, label: __('Close', 'jetpack-components'), variant: "tertiary" })) : null] }));
|
|
20
|
+
return (_jsxs("div", { className: styles.header, children: [_jsxs("div", { className: styles['title-wrap'], children: [!isScreenLocked ? (_jsx(Button, { label: __('Go back', 'jetpack-components'), icon: isRTL() ? chevronRight : chevronLeft, onClick: onGoBack, variant: "tertiary", size: "compact" })) : null, icon, _jsx("h1", { children: title })] }), context.isDismissible ? (_jsx(Button, { size: "compact", onClick: context.onClose, icon: close, label: __('Close', 'jetpack-components'), variant: "tertiary" })) : null] }));
|
|
21
21
|
}
|
|
@@ -4,6 +4,10 @@ export type ScreenProps = {
|
|
|
4
4
|
* The title of the screen.
|
|
5
5
|
*/
|
|
6
6
|
title?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional icon to display in the header.
|
|
9
|
+
*/
|
|
10
|
+
headerIcon?: React.ReactNode;
|
|
7
11
|
/**
|
|
8
12
|
* The path of the screen.
|
|
9
13
|
*/
|
|
@@ -48,4 +52,4 @@ export type ScreenProps = {
|
|
|
48
52
|
*
|
|
49
53
|
* @return The rendered screen.
|
|
50
54
|
*/
|
|
51
|
-
export declare function Screen({ path, className, title, sidebar, isScreenLocked, footerContent, footerActions, ...props }: ScreenProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export declare function Screen({ path, className, title, sidebar, headerIcon, isScreenLocked, footerContent, footerActions, ...props }: ScreenProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,7 +11,7 @@ import styles from './styles.module.scss';
|
|
|
11
11
|
*
|
|
12
12
|
* @return The rendered screen.
|
|
13
13
|
*/
|
|
14
|
-
export function Screen({ path, className, title, sidebar, isScreenLocked, footerContent, footerActions, ...props }) {
|
|
14
|
+
export function Screen({ path, className, title, sidebar, headerIcon, isScreenLocked, footerContent, footerActions, ...props }) {
|
|
15
15
|
const hasFooter = Boolean(footerContent || (footerActions && footerActions.length));
|
|
16
|
-
return (_jsx(Navigator.Screen, { path: path, className: clsx(styles.screen, className), children: _jsxs(Flex, { direction: "column", gap: 0, children: [_jsx(Header, { title: title, isScreenLocked: isScreenLocked }), _jsxs(Flex, { gap: 0, align: "start", className: styles.body, children: [sidebar ? _jsx("div", { className: styles.sidebar, children: sidebar }) : null, _jsx("div", { className: styles.content, children: ('children' in props && props.children) || ('content' in props && props.content) })] }), hasFooter ? (_jsx(Footer, { actions: footerActions, isScreenLocked: isScreenLocked, children: footerContent })) : null] }) }));
|
|
16
|
+
return (_jsx(Navigator.Screen, { path: path, className: clsx(styles.screen, className), children: _jsxs(Flex, { direction: "column", gap: 0, children: [_jsx(Header, { title: title, isScreenLocked: isScreenLocked, icon: headerIcon }), _jsxs(Flex, { gap: 0, align: "start", className: styles.body, children: [sidebar ? _jsx("div", { className: styles.sidebar, children: sidebar }) : null, _jsx("div", { className: styles.content, children: ('children' in props && props.children) || ('content' in props && props.content) })] }), hasFooter ? (_jsx(Footer, { actions: footerActions, isScreenLocked: isScreenLocked, children: footerContent })) : null] }) }));
|
|
17
17
|
}
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
left: 24px;
|
|
31
31
|
width: 38px;
|
|
32
32
|
height: 8px;
|
|
33
|
-
// stylelint-disable-next-line function-url-quotes -- quotes are required here. Bug report: https://github.com/stylelint/stylelint/issues/8544
|
|
34
33
|
background-image: url('data:image/svg+xml,<svg width="38" height="8" viewBox="0 0 38 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 7C1 7 2.37087 1 6.89831 1C11.4257 1 14.3709 7 18.8983 7C23.4257 7 26.7777 1 31.3051 1C35.912 1 37 7 37 7" stroke="white" stroke-width="1.5" stroke-linejoin="round"/></svg>');
|
|
35
34
|
}
|
|
36
35
|
}
|
|
@@ -62,7 +61,6 @@
|
|
|
62
61
|
background-repeat: no-repeat;
|
|
63
62
|
|
|
64
63
|
&--unlink {
|
|
65
|
-
// stylelint-disable-next-line function-url-quotes -- quotes are required here. Bug report: https://github.com/stylelint/stylelint/issues/8544
|
|
66
64
|
background-image: url('data:image/svg+xml,<svg width="34" height="37" viewBox="0 0 34 37" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M22.3335 10.001H25.0002C29.4184 10.001 33.0002 13.5827 33.0002 18.001V19.7788C33.0002 24.197 29.4184 27.7788 25.0002 27.7788H22.3335" stroke="white" stroke-width="1.5" stroke-linecap="square"/> <path d="M11.6675 27.7783L9.00082 27.7783C4.58254 27.7783 1.00081 24.1966 1.00081 19.7783L1.00081 18.0005C1.00081 13.5823 4.58253 10.0005 9.00081 10.0005L11.6675 10.0005" stroke="white" stroke-width="1.5" stroke-linecap="square"/> <path d="M10.9998 19.167L16.9998 19.167" stroke="white" stroke-width="1.5"/> <path d="M8.99951 35.998L24.9995 0.998048" stroke="white"/> </svg>');
|
|
67
65
|
}
|
|
68
66
|
}
|
|
@@ -14,6 +14,10 @@ export type HeaderProps = {
|
|
|
14
14
|
* Whether the screen is locked, in which case to hide the back button.
|
|
15
15
|
*/
|
|
16
16
|
isScreenLocked?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional icon to display in the header.
|
|
19
|
+
*/
|
|
20
|
+
icon?: React.ReactNode;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
/**
|
|
@@ -22,7 +26,7 @@ export type HeaderProps = {
|
|
|
22
26
|
*
|
|
23
27
|
* @return component
|
|
24
28
|
*/
|
|
25
|
-
export function Header( { title, isScreenLocked }: HeaderProps ) {
|
|
29
|
+
export function Header( { icon, title, isScreenLocked }: HeaderProps ) {
|
|
26
30
|
const context = useContext( NavigatorModalContext );
|
|
27
31
|
const navigator = useNavigator();
|
|
28
32
|
|
|
@@ -42,6 +46,7 @@ export function Header( { title, isScreenLocked }: HeaderProps ) {
|
|
|
42
46
|
size="compact"
|
|
43
47
|
/>
|
|
44
48
|
) : null }
|
|
49
|
+
{ icon }
|
|
45
50
|
<h1>{ title }</h1>
|
|
46
51
|
</div>
|
|
47
52
|
{ context.isDismissible ? (
|
|
@@ -10,6 +10,11 @@ export type ScreenProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
title?: string;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Optional icon to display in the header.
|
|
15
|
+
*/
|
|
16
|
+
headerIcon?: React.ReactNode;
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* The path of the screen.
|
|
15
20
|
*/
|
|
@@ -65,6 +70,7 @@ export function Screen( {
|
|
|
65
70
|
className,
|
|
66
71
|
title,
|
|
67
72
|
sidebar,
|
|
73
|
+
headerIcon,
|
|
68
74
|
isScreenLocked,
|
|
69
75
|
footerContent,
|
|
70
76
|
footerActions,
|
|
@@ -75,7 +81,7 @@ export function Screen( {
|
|
|
75
81
|
return (
|
|
76
82
|
<Navigator.Screen path={ path } className={ clsx( styles.screen, className ) }>
|
|
77
83
|
<Flex direction="column" gap={ 0 }>
|
|
78
|
-
<Header title={ title } isScreenLocked={ isScreenLocked } />
|
|
84
|
+
<Header title={ title } isScreenLocked={ isScreenLocked } icon={ headerIcon } />
|
|
79
85
|
|
|
80
86
|
<Flex gap={ 0 } align="start" className={ styles.body }>
|
|
81
87
|
{ sidebar ? <div className={ styles.sidebar }>{ sidebar }</div> : null }
|
package/package.json
CHANGED