@automattic/jetpack-components 6.0.0 → 6.1.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 +19 -2
- package/build/components/admin-page/index.js +1 -1
- package/build/components/automattic-icon-logo/index.d.ts +4 -2
- package/build/components/automattic-icon-logo/index.js +6 -4
- package/build/components/checkbox-card/style.scss +10 -38
- package/build/components/dot-pager/style.scss +2 -2
- package/build/components/global-notices/styles.module.scss +3 -3
- package/build/components/icons/style.module.scss +2 -2
- package/build/components/navigator-modal/styles.scss +11 -9
- package/build/components/period-selector/index.d.ts +9 -0
- package/build/components/period-selector/index.js +21 -0
- package/build/components/period-selector/types.d.ts +28 -0
- package/build/components/period-selector/types.js +1 -0
- package/build/components/radio-card/index.d.ts +19 -0
- package/build/components/radio-card/index.js +29 -0
- package/build/components/radio-card/style.scss +26 -0
- package/build/components/radio-card/types.d.ts +41 -0
- package/build/components/radio-card/types.js +1 -0
- package/build/components/selectable-card/_selectable-card.scss +57 -0
- package/build/components/swipeable/style.scss +2 -2
- package/build/index.d.ts +4 -0
- package/build/index.js +2 -0
- package/components/admin-page/index.tsx +1 -1
- package/components/automattic-icon-logo/index.tsx +9 -7
- package/components/checkbox-card/style.scss +10 -38
- package/components/dot-pager/style.scss +2 -2
- package/components/global-notices/styles.module.scss +3 -3
- package/components/icons/style.module.scss +2 -2
- package/components/navigator-modal/styles.scss +11 -9
- package/components/period-selector/index.tsx +84 -0
- package/components/period-selector/types.ts +29 -0
- package/components/radio-card/index.tsx +72 -0
- package/components/radio-card/style.scss +26 -0
- package/components/radio-card/types.ts +43 -0
- package/components/selectable-card/_selectable-card.scss +57 -0
- package/components/swipeable/style.scss +2 -2
- package/index.ts +4 -0
- package/package.json +27 -22
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
### This is a list detailing changes for the Jetpack RNA Components package releases.
|
|
4
4
|
|
|
5
|
+
## [6.1.1] - 2026-11-02
|
|
6
|
+
### Changed
|
|
7
|
+
- Update package dependencies. [#53869]
|
|
8
|
+
|
|
9
|
+
## [6.1.0] - 2026-10-28
|
|
10
|
+
### Added
|
|
11
|
+
- Add a PeriodSelector component: a dropdown of period presets with optional previous and next buttons. [#54149]
|
|
12
|
+
- Add a RadioCard component. [#54212]
|
|
13
|
+
- AdminPage: Add a `jp-admin-page__content` class to the content container. [#54105]
|
|
14
|
+
- PeriodSelector: Add a disabled prop. [#54202]
|
|
15
|
+
- Period Selector: Add a label that screen readers announce with the selected period. [#54209]
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- AutomatticIconLogo: Use the black Automattic symbol by default, without blue. [#54208]
|
|
19
|
+
- Update package dependencies. [#54118]
|
|
20
|
+
|
|
5
21
|
## [6.0.0] - 2026-10-26
|
|
6
22
|
### Added
|
|
7
23
|
- AdminPage: Add an ariaLabel prop that names the page region when the header shows breadcrumbs instead of a title. [#54055]
|
|
@@ -247,8 +263,7 @@
|
|
|
247
263
|
## [1.11.3] - 2026-05-21
|
|
248
264
|
### Changed
|
|
249
265
|
- Mark ContextualUpgradeTrigger as @deprecated. Use Notice from @wordpress/ui instead. The implementation is unchanged. [#48909]
|
|
250
|
-
- Update package dependencies. [#48405]
|
|
251
|
-
- Update package dependencies. [#49012]
|
|
266
|
+
- Update package dependencies. [#48405] [#49012]
|
|
252
267
|
|
|
253
268
|
## [1.11.2] - 2026-05-19
|
|
254
269
|
### Changed
|
|
@@ -2036,6 +2051,8 @@
|
|
|
2036
2051
|
### Changed
|
|
2037
2052
|
- Update node version requirement to 14.16.1
|
|
2038
2053
|
|
|
2054
|
+
[6.1.1]: https://github.com/Automattic/jetpack-components/compare/6.1.0...6.1.1
|
|
2055
|
+
[6.1.0]: https://github.com/Automattic/jetpack-components/compare/6.0.0...6.1.0
|
|
2039
2056
|
[6.0.0]: https://github.com/Automattic/jetpack-components/compare/5.0.1...6.0.0
|
|
2040
2057
|
[5.0.1]: https://github.com/Automattic/jetpack-components/compare/5.0.0...5.0.1
|
|
2041
2058
|
[5.0.0]: https://github.com/Automattic/jetpack-components/compare/4.0.4...5.0.0
|
|
@@ -49,7 +49,7 @@ const AdminPage = ({ children, className, showHeader = true, showFooter = true,
|
|
|
49
49
|
}, []);
|
|
50
50
|
// When title or breadcrumbs are provided, use admin-ui Page for the full page layout.
|
|
51
51
|
if (showHeader && (title || breadcrumbs)) {
|
|
52
|
-
return (_jsx("div", { className: rootClassName, children: _jsxs(Page, { className: "jp-admin-page__page", visual: logo || _jsx(JetpackLogo, { showText: false, height: 20 }), breadcrumbs: breadcrumbs, title: title, ariaLabel: ariaLabel, subTitle: subTitle, actions: globalControls ? (_jsxs(_Fragment, { children: [actions, actions && (_jsx("span", { role: "separator", "aria-orientation": "vertical", className: styles['global-controls-separator'] })), globalControls] })) : (actions), showSidebarToggle: false, children: [tabs, unwrapped ? (children) : (_jsx(Container, { fluid: true, horizontalSpacing: 0, children: _jsx(Col, { children: children }) })), showFooter && _jsx(JetpackFooter, { menu: optionalMenuItems })] }) }));
|
|
52
|
+
return (_jsx("div", { className: rootClassName, children: _jsxs(Page, { className: "jp-admin-page__page", visual: logo || _jsx(JetpackLogo, { showText: false, height: 20 }), breadcrumbs: breadcrumbs, title: title, ariaLabel: ariaLabel, subTitle: subTitle, actions: globalControls ? (_jsxs(_Fragment, { children: [actions, actions && (_jsx("span", { role: "separator", "aria-orientation": "vertical", className: styles['global-controls-separator'] })), globalControls] })) : (actions), showSidebarToggle: false, children: [tabs, unwrapped ? (children) : (_jsx(Container, { className: "jp-admin-page__content", fluid: true, horizontalSpacing: 0, children: _jsx(Col, { children: children }) })), showFooter && _jsx(JetpackFooter, { menu: optionalMenuItems })] }) }));
|
|
53
53
|
}
|
|
54
54
|
// Legacy path: no title provided, render the classic header.
|
|
55
55
|
return (_jsxs("div", { className: rootClassName, children: [showHeader && (_jsx(Container, { horizontalSpacing: 5, children: _jsxs(Col, { className: clsx(styles['admin-page-header'], 'jp-admin-page-header'), children: [header ? header : _jsx(JetpackLogo, {}), sandboxedDomain && (_jsx("code", { className: styles['sandbox-domain-badge'], onClick: testConnection, onKeyDown: testConnection,
|
|
@@ -2,9 +2,11 @@ import type { ReactElement } from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Automattic Icon Logo component
|
|
4
4
|
*
|
|
5
|
+
* The Automattic logo is black or white only: pass white for both colors on dark backgrounds.
|
|
6
|
+
*
|
|
5
7
|
* @param {object} props - Component props
|
|
6
|
-
* @param {string} props.innerColor - Color code for the
|
|
7
|
-
* @param {string} props.outerColor - Color code for the
|
|
8
|
+
* @param {string} props.innerColor - Color code for the logo's ring.
|
|
9
|
+
* @param {string} props.outerColor - Color code for the slash inside the ring.
|
|
8
10
|
* @return {ReactElement} Component template
|
|
9
11
|
*/
|
|
10
12
|
export default function AutomatticIconLogo({ innerColor, outerColor, }: {
|
|
@@ -3,11 +3,13 @@ import { Path, SVG } from '@wordpress/components';
|
|
|
3
3
|
/**
|
|
4
4
|
* Automattic Icon Logo component
|
|
5
5
|
*
|
|
6
|
+
* The Automattic logo is black or white only: pass white for both colors on dark backgrounds.
|
|
7
|
+
*
|
|
6
8
|
* @param {object} props - Component props
|
|
7
|
-
* @param {string} props.innerColor - Color code for the
|
|
8
|
-
* @param {string} props.outerColor - Color code for the
|
|
9
|
+
* @param {string} props.innerColor - Color code for the logo's ring.
|
|
10
|
+
* @param {string} props.outerColor - Color code for the slash inside the ring.
|
|
9
11
|
* @return {ReactElement} Component template
|
|
10
12
|
*/
|
|
11
|
-
export default function AutomatticIconLogo({ innerColor = '#
|
|
12
|
-
return (_jsxs(SVG, { clipRule: "evenodd", fill: "none", fillRule: "evenodd", height: "43", viewBox: "0 0
|
|
13
|
+
export default function AutomatticIconLogo({ innerColor = '#000000', outerColor = '#000000', }) {
|
|
14
|
+
return (_jsxs(SVG, { clipRule: "evenodd", fill: "none", fillRule: "evenodd", height: "43", viewBox: "0 0 171 156", width: "47", xmlns: "http://www.w3.org/2000/svg", children: [_jsx(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M85.398 155.632C34.1992 155.632 1.01562 118.788 1.01562 80.3993V75.6007C1.01562 36.5611 34.1992 0.368164 85.398 0.368164C136.597 0.368164 169.984 36.5611 169.984 75.6007V80.3993C169.984 118.666 136.8 155.632 85.398 155.632ZM145.191 76.048C145.191 48.0696 122.323 23.1819 85.398 23.1819C48.4731 23.1819 25.9304 48.1103 25.9304 76.048V79.5047C25.9304 107.483 48.7984 132.859 85.398 132.859C121.998 132.859 145.191 107.483 145.191 79.5047V76.048Z", fill: innerColor }), _jsx(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M62.7978 91.4965L87.6364 53.0284C91.1593 47.5724 98.4381 46.0054 103.894 49.5283L103.928 49.5504C109.384 53.0732 110.951 60.352 107.428 65.808L82.5899 104.276C79.067 109.732 71.7882 111.299 66.3322 107.776L66.298 107.754C60.842 104.231 59.275 96.9525 62.7978 91.4965Z", fill: outerColor })] }));
|
|
13
15
|
}
|
|
@@ -1,54 +1,26 @@
|
|
|
1
|
-
@use "
|
|
1
|
+
@use "../selectable-card/selectable-card";
|
|
2
2
|
|
|
3
3
|
.jp-checkbox-card-grid {
|
|
4
|
-
|
|
5
|
-
grid
|
|
6
|
-
column-gap: var(--wpds-dimension-gap-md);
|
|
7
|
-
row-gap: var(--wpds-dimension-gap-2xl);
|
|
8
|
-
|
|
9
|
-
@media (max-width: 720px) {
|
|
10
|
-
grid-template-columns: minmax(0, 1fr);
|
|
11
|
-
}
|
|
4
|
+
|
|
5
|
+
@include selectable-card.grid;
|
|
12
6
|
}
|
|
13
7
|
|
|
14
8
|
.jp-checkbox-card {
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
border-color: var(--wpds-color-stroke-interactive-brand-active);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&:hover:not([data-checked="true"]) {
|
|
21
|
-
border-color: var(--wpds-color-stroke-surface-neutral-strong);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&:has(:focus-visible) {
|
|
25
|
-
|
|
26
|
-
@include gb.outset-ring__focus();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
30
|
-
transition: border-color 0.15s ease-out;
|
|
31
|
-
}
|
|
10
|
+
@include selectable-card.card('[data-checked="true"]');
|
|
32
11
|
}
|
|
33
12
|
|
|
34
13
|
.jp-checkbox-card__surface {
|
|
35
|
-
|
|
14
|
+
|
|
15
|
+
@include selectable-card.surface;
|
|
36
16
|
}
|
|
37
17
|
|
|
38
18
|
.jp-checkbox-card__illustration {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
background: var(--wpds-color-background-surface-neutral-weak);
|
|
42
|
-
cursor: var(--wpds-cursor-control);
|
|
43
|
-
|
|
44
|
-
> svg {
|
|
45
|
-
inline-size: 100%;
|
|
46
|
-
block-size: 100%;
|
|
47
|
-
}
|
|
19
|
+
|
|
20
|
+
@include selectable-card.illustration;
|
|
48
21
|
}
|
|
49
22
|
|
|
50
23
|
.jp-checkbox-card__checkbox {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
inset-inline-start: var(--wpds-dimension-padding-md);
|
|
24
|
+
|
|
25
|
+
@include selectable-card.control;
|
|
54
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "@
|
|
1
|
+
@use "@wordpress/base-styles/mixins";
|
|
2
2
|
@use "@automattic/jetpack-base-styles/root-variables";
|
|
3
3
|
|
|
4
4
|
.dot-pager {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
opacity: 1;
|
|
14
14
|
visibility: visible;
|
|
15
15
|
|
|
16
|
-
@include
|
|
16
|
+
@include mixins.reduce-motion( "transition" );
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.dot-pager__controls {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "@
|
|
1
|
+
@use "@wordpress/base-styles/mixins";
|
|
2
2
|
|
|
3
3
|
.global-notices {
|
|
4
4
|
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
// Modals have 100000, so this needs to be above them
|
|
11
11
|
z-index: 100001;
|
|
12
12
|
|
|
13
|
-
@include
|
|
13
|
+
@include mixins.break-small {
|
|
14
14
|
width: auto;
|
|
15
15
|
inset-inline: unset; // left and right
|
|
16
16
|
inset-block-start: 4rem;
|
|
17
17
|
inset-inline-end: 1rem;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
@include
|
|
20
|
+
@include mixins.break-medium {
|
|
21
21
|
inset-block-start: 3rem;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "@
|
|
1
|
+
@use "@wordpress/base-styles/colors";
|
|
2
2
|
|
|
3
3
|
.star-icon {
|
|
4
4
|
fill: #000;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.socialIcon {
|
|
13
|
-
fill:
|
|
13
|
+
fill: colors.$gray-700;
|
|
14
14
|
|
|
15
15
|
&.bluesky {
|
|
16
16
|
fill: var(--jetpack-social-logo-color-bluesky);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
@use "@
|
|
1
|
+
@use "@wordpress/base-styles/breakpoints";
|
|
2
|
+
@use "@wordpress/base-styles/colors";
|
|
3
|
+
@use "@wordpress/base-styles/mixins";
|
|
2
4
|
|
|
3
5
|
.components-modal__screen-overlay:has(.jp-navigator-modal) {
|
|
4
6
|
z-index: 99999; // Slightly lower than snackbar z-index (100001) so snackbars remain visible above the modal
|
|
@@ -9,7 +11,7 @@
|
|
|
9
11
|
container-name: navigator-modal;
|
|
10
12
|
width: 100%;
|
|
11
13
|
|
|
12
|
-
@include
|
|
14
|
+
@include mixins.break-medium() {
|
|
13
15
|
max-height: 90%;
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
justify-content: space-between;
|
|
38
40
|
padding: 1.5rem;
|
|
39
41
|
height: 4.5rem;
|
|
40
|
-
border-bottom: 1px solid
|
|
42
|
+
border-bottom: 1px solid colors.$gray-200;
|
|
41
43
|
flex-shrink: 0;
|
|
42
44
|
|
|
43
45
|
h1 {
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
font-size: 15px;
|
|
46
48
|
font-weight: 500;
|
|
47
49
|
line-height: 24px;
|
|
48
|
-
color:
|
|
50
|
+
color: colors.$gray-900;
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -60,7 +62,7 @@
|
|
|
60
62
|
overflow: auto;
|
|
61
63
|
flex-direction: column;
|
|
62
64
|
|
|
63
|
-
@container navigator-modal (width >= #{
|
|
65
|
+
@container navigator-modal (width >= #{breakpoints.$break-small}) {
|
|
64
66
|
flex-direction: row;
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -71,11 +73,11 @@
|
|
|
71
73
|
flex-direction: column;
|
|
72
74
|
gap: 1.5rem;
|
|
73
75
|
|
|
74
|
-
@container navigator-modal (width >= #{
|
|
76
|
+
@container navigator-modal (width >= #{breakpoints.$break-small}) {
|
|
75
77
|
flex-basis: 30%;
|
|
76
78
|
height: 100%;
|
|
77
79
|
flex-shrink: 0;
|
|
78
|
-
border-inline-end: 1px solid
|
|
80
|
+
border-inline-end: 1px solid colors.$gray-300;
|
|
79
81
|
overflow: auto;
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -85,14 +87,14 @@
|
|
|
85
87
|
height: 100%;
|
|
86
88
|
flex: 1;
|
|
87
89
|
|
|
88
|
-
@container navigator-modal (width >= #{
|
|
90
|
+
@container navigator-modal (width >= #{breakpoints.$break-small}) {
|
|
89
91
|
overflow: auto;
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
&__footer {
|
|
94
96
|
padding: 1rem 1.5rem;
|
|
95
|
-
border-top: 1px solid
|
|
97
|
+
border-top: 1px solid colors.$gray-300;
|
|
96
98
|
height: 4.5rem;
|
|
97
99
|
flex-shrink: 0;
|
|
98
100
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PeriodSelectorProps } from './types.ts';
|
|
2
|
+
import type { JSX } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* A dropdown of period presets, with optional buttons to step to the previous or next period.
|
|
5
|
+
*
|
|
6
|
+
* @param {PeriodSelectorProps} props - Component props.
|
|
7
|
+
* @return {JSX.Element} The selector.
|
|
8
|
+
*/
|
|
9
|
+
export default function PeriodSelector<Value extends string>({ presets, value, label, onChange, onPrevious, onNext, isPreviousDisabled, isNextDisabled, disabled, className, }: PeriodSelectorProps<Value>): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { __, isRTL, sprintf } from '@wordpress/i18n';
|
|
3
|
+
import { calendar, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
4
|
+
import { Button, IconButton, Menu, Stack } from '@wordpress/ui';
|
|
5
|
+
/**
|
|
6
|
+
* A dropdown of period presets, with optional buttons to step to the previous or next period.
|
|
7
|
+
*
|
|
8
|
+
* @param {PeriodSelectorProps} props - Component props.
|
|
9
|
+
* @return {JSX.Element} The selector.
|
|
10
|
+
*/
|
|
11
|
+
export default function PeriodSelector({ presets, value, label, onChange, onPrevious, onNext, isPreviousDisabled = false, isNextDisabled = false, disabled = false, className, }) {
|
|
12
|
+
const selected = presets.find(preset => preset.value === value);
|
|
13
|
+
const selectedLabel = selected?.label ?? __('Select period', 'jetpack-components');
|
|
14
|
+
const [previousIcon, nextIcon] = isRTL()
|
|
15
|
+
? [chevronRight, chevronLeft]
|
|
16
|
+
: [chevronLeft, chevronRight];
|
|
17
|
+
return (_jsxs(Stack, { direction: "row", align: "center", gap: "xs", className: className, children: [_jsxs(Menu.Root, { children: [_jsxs(Menu.Trigger, { render: _jsx(Button, { variant: "outline", tone: "neutral", size: "compact" }), disabled: disabled, "aria-label": label &&
|
|
18
|
+
sprintf(
|
|
19
|
+
/* translators: %1$s: What the control picks, such as "Date range". %2$s: The selected period, such as "Last 30 days". */
|
|
20
|
+
__('%1$s: %2$s', 'jetpack-components'), label, selectedLabel), children: [_jsx(Button.Icon, { icon: calendar }), selectedLabel] }), _jsx(Menu.Popup, { positioner: _jsx(Menu.Positioner, { align: "end" }), "aria-label": label, children: _jsx(Menu.RadioGroup, { value: value, onValueChange: onChange, children: presets.map(preset => (_jsx(Menu.RadioItem, { value: preset.value, closeOnClick: true, children: _jsx(Menu.ItemLabel, { children: preset.label }) }, preset.value))) }) })] }), onPrevious && (_jsx(IconButton, { variant: "outline", tone: "neutral", size: "compact", icon: previousIcon, label: __('Previous period', 'jetpack-components'), onClick: onPrevious, disabled: disabled || isPreviousDisabled })), onNext && (_jsx(IconButton, { variant: "outline", tone: "neutral", size: "compact", icon: nextIcon, label: __('Next period', 'jetpack-components'), onClick: onNext, disabled: disabled || isNextDisabled }))] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type PeriodPreset<Value extends string = string> = {
|
|
2
|
+
/** Identifies the preset; passed to `onChange`. */
|
|
3
|
+
value: Value;
|
|
4
|
+
/** The preset's name, such as "Last 7 days". */
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export type PeriodSelectorProps<Value extends string = string> = {
|
|
8
|
+
/** The presets the dropdown offers, in order. */
|
|
9
|
+
presets: PeriodPreset<Value>[];
|
|
10
|
+
/** Names what the control picks, such as "Date range"; screen readers hear it before the selected period. */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** The selected preset's value. */
|
|
13
|
+
value: Value;
|
|
14
|
+
/** Called with the chosen preset's value. */
|
|
15
|
+
onChange: (value: Value) => void;
|
|
16
|
+
/** Steps to the previous period; the button shows only when set. */
|
|
17
|
+
onPrevious?: () => void;
|
|
18
|
+
/** Steps to the next period; the button shows only when set. */
|
|
19
|
+
onNext?: () => void;
|
|
20
|
+
/** Whether there is no previous period to step to. */
|
|
21
|
+
isPreviousDisabled?: boolean;
|
|
22
|
+
/** Whether there is no next period to step to, such as on the latest one. */
|
|
23
|
+
isNextDisabled?: boolean;
|
|
24
|
+
/** Whether the dropdown and both step buttons are disabled. */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Class name for the wrapper. */
|
|
27
|
+
className?: string;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './style.scss';
|
|
2
|
+
import type { RadioCardGridProps, RadioCardProps } from './types.ts';
|
|
3
|
+
import type { JSX } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Lays out radio cards in two columns, or one on narrow screens.
|
|
6
|
+
*
|
|
7
|
+
* @param {RadioCardGridProps} props - Component props.
|
|
8
|
+
* @return {JSX.Element} The grid.
|
|
9
|
+
*/
|
|
10
|
+
export declare function RadioCardGrid({ children, className }: RadioCardGridProps): JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* A card with a radio, picked by a click on its illustration. Render it in a `RadioGroup` inside a `Field.Root`.
|
|
13
|
+
*
|
|
14
|
+
* @param {RadioCardProps} props - Component props.
|
|
15
|
+
* @return {JSX.Element} The card.
|
|
16
|
+
*/
|
|
17
|
+
export default function RadioCard({ id, value, title, illustration, previewUrl, onPreviewClick, disabled, }: RadioCardProps): JSX.Element;
|
|
18
|
+
export { RadioCard };
|
|
19
|
+
export type { RadioCardProps, RadioCardGridProps };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from '@wordpress/element';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { Card, Field, Link, Radio, Stack, Text } from '@wordpress/ui';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import './style.scss';
|
|
7
|
+
/**
|
|
8
|
+
* Lays out radio cards in two columns, or one on narrow screens.
|
|
9
|
+
*
|
|
10
|
+
* @param {RadioCardGridProps} props - Component props.
|
|
11
|
+
* @return {JSX.Element} The grid.
|
|
12
|
+
*/
|
|
13
|
+
export function RadioCardGrid({ children, className }) {
|
|
14
|
+
return _jsx("div", { className: clsx('jp-radio-card-grid', className), children: children });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A card with a radio, picked by a click on its illustration. Render it in a `RadioGroup` inside a `Field.Root`.
|
|
18
|
+
*
|
|
19
|
+
* @param {RadioCardProps} props - Component props.
|
|
20
|
+
* @return {JSX.Element} The card.
|
|
21
|
+
*/
|
|
22
|
+
export default function RadioCard({ id, value, title, illustration, previewUrl, onPreviewClick, disabled, }) {
|
|
23
|
+
const titleId = `${id}__title`;
|
|
24
|
+
const handlePreviewClick = useCallback(() => {
|
|
25
|
+
onPreviewClick?.(value);
|
|
26
|
+
}, [value, onPreviewClick]);
|
|
27
|
+
return (_jsxs(Field.Item, { disabled: disabled, children: [_jsx(Card.Root, { className: "jp-radio-card", children: _jsx(Card.Content, { children: _jsxs(Card.FullBleed, { className: "jp-radio-card__surface", children: [_jsx(Field.Label, { className: "jp-radio-card__illustration", children: illustration }), _jsx(Radio, { id: id, className: "jp-radio-card__radio", value: value, disabled: disabled, "aria-labelledby": titleId })] }) }) }), _jsxs(Stack, { gap: "xs", direction: "column", children: [_jsx(Text, { id: titleId, variant: "body-sm", children: title }), previewUrl && (_jsx(Link, { href: previewUrl, onClick: handlePreviewClick, children: __('Preview and edit', 'jetpack-components') }))] })] }));
|
|
28
|
+
}
|
|
29
|
+
export { RadioCard };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@use "../selectable-card/selectable-card";
|
|
2
|
+
|
|
3
|
+
.jp-radio-card-grid {
|
|
4
|
+
|
|
5
|
+
@include selectable-card.grid;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.jp-radio-card {
|
|
9
|
+
|
|
10
|
+
@include selectable-card.card( ":has(.jp-radio-card__radio[data-checked])" );
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.jp-radio-card__surface {
|
|
14
|
+
|
|
15
|
+
@include selectable-card.surface;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.jp-radio-card__illustration {
|
|
19
|
+
|
|
20
|
+
@include selectable-card.illustration;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.jp-radio-card__radio {
|
|
24
|
+
|
|
25
|
+
@include selectable-card.control;
|
|
26
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type RadioCardProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Id of the radio; the title's id is built from it.
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* The value the surrounding `RadioGroup` takes when this card is picked. Also passed to `onPreviewClick`.
|
|
9
|
+
*/
|
|
10
|
+
value: string;
|
|
11
|
+
/**
|
|
12
|
+
* Caption under the card, and the radio's accessible name.
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
/**
|
|
16
|
+
* Picture filling the card, drawn at a 294×192 aspect ratio.
|
|
17
|
+
*/
|
|
18
|
+
illustration?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Shows a "Preview and edit" link to this URL under the title.
|
|
21
|
+
*/
|
|
22
|
+
previewUrl?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Called with the card's `value` when the "Preview and edit" link is clicked.
|
|
25
|
+
*/
|
|
26
|
+
onPreviewClick?: (value: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Disables the radio.
|
|
29
|
+
*/
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type RadioCardGridProps = {
|
|
33
|
+
/**
|
|
34
|
+
* The `RadioCard`s to lay out.
|
|
35
|
+
*/
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Extra class for the grid.
|
|
39
|
+
*/
|
|
40
|
+
className?: string;
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/mixins";
|
|
2
|
+
|
|
3
|
+
// Shared by CheckboxCard and RadioCard, which differ only in their control.
|
|
4
|
+
|
|
5
|
+
@mixin grid {
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
8
|
+
column-gap: var(--wpds-dimension-gap-md);
|
|
9
|
+
row-gap: var(--wpds-dimension-gap-2xl);
|
|
10
|
+
|
|
11
|
+
@media (max-width: 720px) {
|
|
12
|
+
grid-template-columns: minmax(0, 1fr);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// $selected matches the card while its control is selected.
|
|
17
|
+
@mixin card($selected) {
|
|
18
|
+
|
|
19
|
+
&#{$selected} {
|
|
20
|
+
border-color: var(--wpds-color-stroke-interactive-brand-active);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:hover:not(#{$selected}) {
|
|
24
|
+
border-color: var(--wpds-color-stroke-surface-neutral-strong);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:has(:focus-visible) {
|
|
28
|
+
|
|
29
|
+
@include mixins.outset-ring__focus();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
33
|
+
transition: border-color 0.15s ease-out;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@mixin surface {
|
|
38
|
+
position: relative;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@mixin illustration {
|
|
42
|
+
display: flex;
|
|
43
|
+
aspect-ratio: 294 / 192;
|
|
44
|
+
background: var(--wpds-color-background-surface-neutral-weak);
|
|
45
|
+
cursor: var(--wpds-cursor-control);
|
|
46
|
+
|
|
47
|
+
> svg {
|
|
48
|
+
inline-size: 100%;
|
|
49
|
+
block-size: 100%;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@mixin control {
|
|
54
|
+
position: absolute;
|
|
55
|
+
inset-block-start: var(--wpds-dimension-padding-md);
|
|
56
|
+
inset-inline-start: var(--wpds-dimension-padding-md);
|
|
57
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "@
|
|
1
|
+
@use "@wordpress/base-styles/mixins";
|
|
2
2
|
|
|
3
3
|
.swipeable__container {
|
|
4
4
|
width: 100%;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
transition: all 0.5s ease-in-out;
|
|
20
20
|
transition-property: transform, height;
|
|
21
21
|
|
|
22
|
-
@include
|
|
22
|
+
@include mixins.reduce-motion( "transition" );
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.swipeable__page {
|
package/build/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export { default as Gravatar } from './components/gravatar/index.tsx';
|
|
|
11
11
|
export type { GravatarProps } from './components/gravatar/index.tsx';
|
|
12
12
|
export { default as CheckboxCard, CheckboxCardGrid } from './components/checkbox-card/index.tsx';
|
|
13
13
|
export type { CheckboxCardProps, CheckboxCardGridProps } from './components/checkbox-card/types.ts';
|
|
14
|
+
export { default as RadioCard, RadioCardGrid } from './components/radio-card/index.tsx';
|
|
15
|
+
export type { RadioCardProps, RadioCardGridProps } from './components/radio-card/types.ts';
|
|
14
16
|
export { default as IconTooltip } from './components/icon-tooltip/index.tsx';
|
|
15
17
|
export { default as ActionButton } from './components/action-button/index.tsx';
|
|
16
18
|
export { default as PricingCard } from './components/pricing-card/index.tsx';
|
|
@@ -45,6 +47,8 @@ export { default as ActionPopover } from './components/action-popover/index.tsx'
|
|
|
45
47
|
export { default as UpsellBanner } from './components/upsell-banner/index.tsx';
|
|
46
48
|
export { getUserLocale, cleanLocale } from './lib/locale/index.ts';
|
|
47
49
|
export { default as StatCard } from './components/stat-card/index.tsx';
|
|
50
|
+
export { default as PeriodSelector } from './components/period-selector/index.tsx';
|
|
51
|
+
export type { PeriodPreset, PeriodSelectorProps } from './components/period-selector/types.ts';
|
|
48
52
|
export { default as DiffViewer } from './components/diff-viewer/index.tsx';
|
|
49
53
|
export { default as MarkedLines } from './components/marked-lines/index.tsx';
|
|
50
54
|
export { default as DetailsViewer } from './components/details-viewer/index.tsx';
|
package/build/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export { default as AutomatticForAgenciesLogo } from './components/automattic-fo
|
|
|
23
23
|
export { default as JetpackFooter } from './components/jetpack-footer/index.js';
|
|
24
24
|
export { default as Gravatar } from './components/gravatar/index.js';
|
|
25
25
|
export { default as CheckboxCard, CheckboxCardGrid } from './components/checkbox-card/index.js';
|
|
26
|
+
export { default as RadioCard, RadioCardGrid } from './components/radio-card/index.js';
|
|
26
27
|
export { default as IconTooltip } from './components/icon-tooltip/index.js';
|
|
27
28
|
export { default as ActionButton } from './components/action-button/index.js';
|
|
28
29
|
export { default as PricingCard } from './components/pricing-card/index.js';
|
|
@@ -56,6 +57,7 @@ export { default as ActionPopover } from './components/action-popover/index.js';
|
|
|
56
57
|
export { default as UpsellBanner } from './components/upsell-banner/index.js';
|
|
57
58
|
export { getUserLocale, cleanLocale } from './lib/locale/index.js';
|
|
58
59
|
export { default as StatCard } from './components/stat-card/index.js';
|
|
60
|
+
export { default as PeriodSelector } from './components/period-selector/index.js';
|
|
59
61
|
export { default as DiffViewer } from './components/diff-viewer/index.js';
|
|
60
62
|
export { default as MarkedLines } from './components/marked-lines/index.js';
|
|
61
63
|
export { default as DetailsViewer } from './components/details-viewer/index.js';
|
|
@@ -111,7 +111,7 @@ const AdminPage: FC< AdminPageProps > = ( {
|
|
|
111
111
|
{ unwrapped ? (
|
|
112
112
|
children
|
|
113
113
|
) : (
|
|
114
|
-
<Container fluid horizontalSpacing={ 0 }>
|
|
114
|
+
<Container className="jp-admin-page__content" fluid horizontalSpacing={ 0 }>
|
|
115
115
|
<Col>{ children }</Col>
|
|
116
116
|
</Container>
|
|
117
117
|
) }
|
|
@@ -4,14 +4,16 @@ import type { ReactElement } from 'react';
|
|
|
4
4
|
/**
|
|
5
5
|
* Automattic Icon Logo component
|
|
6
6
|
*
|
|
7
|
+
* The Automattic logo is black or white only: pass white for both colors on dark backgrounds.
|
|
8
|
+
*
|
|
7
9
|
* @param {object} props - Component props
|
|
8
|
-
* @param {string} props.innerColor - Color code for the
|
|
9
|
-
* @param {string} props.outerColor - Color code for the
|
|
10
|
+
* @param {string} props.innerColor - Color code for the logo's ring.
|
|
11
|
+
* @param {string} props.outerColor - Color code for the slash inside the ring.
|
|
10
12
|
* @return {ReactElement} Component template
|
|
11
13
|
*/
|
|
12
14
|
export default function AutomatticIconLogo( {
|
|
13
|
-
innerColor = '#
|
|
14
|
-
outerColor = '#
|
|
15
|
+
innerColor = '#000000',
|
|
16
|
+
outerColor = '#000000',
|
|
15
17
|
}: {
|
|
16
18
|
innerColor: string;
|
|
17
19
|
outerColor: string;
|
|
@@ -22,20 +24,20 @@ export default function AutomatticIconLogo( {
|
|
|
22
24
|
fill="none"
|
|
23
25
|
fillRule="evenodd"
|
|
24
26
|
height="43"
|
|
25
|
-
viewBox="0 0
|
|
27
|
+
viewBox="0 0 171 156"
|
|
26
28
|
width="47"
|
|
27
29
|
xmlns="http://www.w3.org/2000/svg"
|
|
28
30
|
>
|
|
29
31
|
<Path
|
|
30
32
|
fillRule="evenodd"
|
|
31
33
|
clipRule="evenodd"
|
|
32
|
-
d="
|
|
34
|
+
d="M85.398 155.632C34.1992 155.632 1.01562 118.788 1.01562 80.3993V75.6007C1.01562 36.5611 34.1992 0.368164 85.398 0.368164C136.597 0.368164 169.984 36.5611 169.984 75.6007V80.3993C169.984 118.666 136.8 155.632 85.398 155.632ZM145.191 76.048C145.191 48.0696 122.323 23.1819 85.398 23.1819C48.4731 23.1819 25.9304 48.1103 25.9304 76.048V79.5047C25.9304 107.483 48.7984 132.859 85.398 132.859C121.998 132.859 145.191 107.483 145.191 79.5047V76.048Z"
|
|
33
35
|
fill={ innerColor }
|
|
34
36
|
/>
|
|
35
37
|
<Path
|
|
36
38
|
fillRule="evenodd"
|
|
37
39
|
clipRule="evenodd"
|
|
38
|
-
d="
|
|
40
|
+
d="M62.7978 91.4965L87.6364 53.0284C91.1593 47.5724 98.4381 46.0054 103.894 49.5283L103.928 49.5504C109.384 53.0732 110.951 60.352 107.428 65.808L82.5899 104.276C79.067 109.732 71.7882 111.299 66.3322 107.776L66.298 107.754C60.842 104.231 59.275 96.9525 62.7978 91.4965Z"
|
|
39
41
|
fill={ outerColor }
|
|
40
42
|
/>
|
|
41
43
|
</SVG>
|