@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
|
@@ -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,84 @@
|
|
|
1
|
+
import { __, isRTL, sprintf } from '@wordpress/i18n';
|
|
2
|
+
import { calendar, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
3
|
+
import { Button, IconButton, Menu, Stack } from '@wordpress/ui';
|
|
4
|
+
import type { PeriodSelectorProps } from './types.ts';
|
|
5
|
+
import type { JSX } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A dropdown of period presets, with optional buttons to step to the previous or next period.
|
|
9
|
+
*
|
|
10
|
+
* @param {PeriodSelectorProps} props - Component props.
|
|
11
|
+
* @return {JSX.Element} The selector.
|
|
12
|
+
*/
|
|
13
|
+
export default function PeriodSelector< Value extends string >( {
|
|
14
|
+
presets,
|
|
15
|
+
value,
|
|
16
|
+
label,
|
|
17
|
+
onChange,
|
|
18
|
+
onPrevious,
|
|
19
|
+
onNext,
|
|
20
|
+
isPreviousDisabled = false,
|
|
21
|
+
isNextDisabled = false,
|
|
22
|
+
disabled = false,
|
|
23
|
+
className,
|
|
24
|
+
}: PeriodSelectorProps< Value > ): JSX.Element {
|
|
25
|
+
const selected = presets.find( preset => preset.value === value );
|
|
26
|
+
const selectedLabel = selected?.label ?? __( 'Select period', 'jetpack-components' );
|
|
27
|
+
const [ previousIcon, nextIcon ] = isRTL()
|
|
28
|
+
? [ chevronRight, chevronLeft ]
|
|
29
|
+
: [ chevronLeft, chevronRight ];
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Stack direction="row" align="center" gap="xs" className={ className }>
|
|
33
|
+
<Menu.Root>
|
|
34
|
+
<Menu.Trigger
|
|
35
|
+
render={ <Button variant="outline" tone="neutral" size="compact" /> }
|
|
36
|
+
disabled={ disabled }
|
|
37
|
+
aria-label={
|
|
38
|
+
label &&
|
|
39
|
+
sprintf(
|
|
40
|
+
/* translators: %1$s: What the control picks, such as "Date range". %2$s: The selected period, such as "Last 30 days". */
|
|
41
|
+
__( '%1$s: %2$s', 'jetpack-components' ),
|
|
42
|
+
label,
|
|
43
|
+
selectedLabel
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
>
|
|
47
|
+
<Button.Icon icon={ calendar } />
|
|
48
|
+
{ selectedLabel }
|
|
49
|
+
</Menu.Trigger>
|
|
50
|
+
<Menu.Popup positioner={ <Menu.Positioner align="end" /> } aria-label={ label }>
|
|
51
|
+
<Menu.RadioGroup value={ value } onValueChange={ onChange }>
|
|
52
|
+
{ presets.map( preset => (
|
|
53
|
+
<Menu.RadioItem key={ preset.value } value={ preset.value } closeOnClick>
|
|
54
|
+
<Menu.ItemLabel>{ preset.label }</Menu.ItemLabel>
|
|
55
|
+
</Menu.RadioItem>
|
|
56
|
+
) ) }
|
|
57
|
+
</Menu.RadioGroup>
|
|
58
|
+
</Menu.Popup>
|
|
59
|
+
</Menu.Root>
|
|
60
|
+
{ onPrevious && (
|
|
61
|
+
<IconButton
|
|
62
|
+
variant="outline"
|
|
63
|
+
tone="neutral"
|
|
64
|
+
size="compact"
|
|
65
|
+
icon={ previousIcon }
|
|
66
|
+
label={ __( 'Previous period', 'jetpack-components' ) }
|
|
67
|
+
onClick={ onPrevious }
|
|
68
|
+
disabled={ disabled || isPreviousDisabled }
|
|
69
|
+
/>
|
|
70
|
+
) }
|
|
71
|
+
{ onNext && (
|
|
72
|
+
<IconButton
|
|
73
|
+
variant="outline"
|
|
74
|
+
tone="neutral"
|
|
75
|
+
size="compact"
|
|
76
|
+
icon={ nextIcon }
|
|
77
|
+
label={ __( 'Next period', 'jetpack-components' ) }
|
|
78
|
+
onClick={ onNext }
|
|
79
|
+
disabled={ disabled || isNextDisabled }
|
|
80
|
+
/>
|
|
81
|
+
) }
|
|
82
|
+
</Stack>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
|
|
8
|
+
export type PeriodSelectorProps< Value extends string = string > = {
|
|
9
|
+
/** The presets the dropdown offers, in order. */
|
|
10
|
+
presets: PeriodPreset< Value >[];
|
|
11
|
+
/** Names what the control picks, such as "Date range"; screen readers hear it before the selected period. */
|
|
12
|
+
label?: string;
|
|
13
|
+
/** The selected preset's value. */
|
|
14
|
+
value: Value;
|
|
15
|
+
/** Called with the chosen preset's value. */
|
|
16
|
+
onChange: ( value: Value ) => void;
|
|
17
|
+
/** Steps to the previous period; the button shows only when set. */
|
|
18
|
+
onPrevious?: () => void;
|
|
19
|
+
/** Steps to the next period; the button shows only when set. */
|
|
20
|
+
onNext?: () => void;
|
|
21
|
+
/** Whether there is no previous period to step to. */
|
|
22
|
+
isPreviousDisabled?: boolean;
|
|
23
|
+
/** Whether there is no next period to step to, such as on the latest one. */
|
|
24
|
+
isNextDisabled?: boolean;
|
|
25
|
+
/** Whether the dropdown and both step buttons are disabled. */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Class name for the wrapper. */
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useCallback } from '@wordpress/element';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Card, Field, Link, Radio, Stack, Text } from '@wordpress/ui';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import './style.scss';
|
|
6
|
+
import type { RadioCardGridProps, RadioCardProps } from './types.ts';
|
|
7
|
+
import type { JSX } from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Lays out radio cards in two columns, or one on narrow screens.
|
|
11
|
+
*
|
|
12
|
+
* @param {RadioCardGridProps} props - Component props.
|
|
13
|
+
* @return {JSX.Element} The grid.
|
|
14
|
+
*/
|
|
15
|
+
export function RadioCardGrid( { children, className }: RadioCardGridProps ): JSX.Element {
|
|
16
|
+
return <div className={ clsx( 'jp-radio-card-grid', className ) }>{ children }</div>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A card with a radio, picked by a click on its illustration. Render it in a `RadioGroup` inside a `Field.Root`.
|
|
21
|
+
*
|
|
22
|
+
* @param {RadioCardProps} props - Component props.
|
|
23
|
+
* @return {JSX.Element} The card.
|
|
24
|
+
*/
|
|
25
|
+
export default function RadioCard( {
|
|
26
|
+
id,
|
|
27
|
+
value,
|
|
28
|
+
title,
|
|
29
|
+
illustration,
|
|
30
|
+
previewUrl,
|
|
31
|
+
onPreviewClick,
|
|
32
|
+
disabled,
|
|
33
|
+
}: RadioCardProps ): JSX.Element {
|
|
34
|
+
const titleId = `${ id }__title`;
|
|
35
|
+
|
|
36
|
+
const handlePreviewClick = useCallback( () => {
|
|
37
|
+
onPreviewClick?.( value );
|
|
38
|
+
}, [ value, onPreviewClick ] );
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Field.Item disabled={ disabled }>
|
|
42
|
+
<Card.Root className="jp-radio-card">
|
|
43
|
+
<Card.Content>
|
|
44
|
+
<Card.FullBleed className="jp-radio-card__surface">
|
|
45
|
+
{ /* Only the illustration picks the card: the title and link sit outside the label. */ }
|
|
46
|
+
<Field.Label className="jp-radio-card__illustration">{ illustration }</Field.Label>
|
|
47
|
+
<Radio
|
|
48
|
+
id={ id }
|
|
49
|
+
className="jp-radio-card__radio"
|
|
50
|
+
value={ value }
|
|
51
|
+
disabled={ disabled }
|
|
52
|
+
aria-labelledby={ titleId }
|
|
53
|
+
/>
|
|
54
|
+
</Card.FullBleed>
|
|
55
|
+
</Card.Content>
|
|
56
|
+
</Card.Root>
|
|
57
|
+
<Stack gap="xs" direction="column">
|
|
58
|
+
<Text id={ titleId } variant="body-sm">
|
|
59
|
+
{ title }
|
|
60
|
+
</Text>
|
|
61
|
+
{ previewUrl && (
|
|
62
|
+
<Link href={ previewUrl } onClick={ handlePreviewClick }>
|
|
63
|
+
{ __( 'Preview and edit', 'jetpack-components' ) }
|
|
64
|
+
</Link>
|
|
65
|
+
) }
|
|
66
|
+
</Stack>
|
|
67
|
+
</Field.Item>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { RadioCard };
|
|
72
|
+
export type { RadioCardProps, RadioCardGridProps };
|
|
@@ -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,43 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type RadioCardProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Id of the radio; the title's id is built from it.
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* The value the surrounding `RadioGroup` takes when this card is picked. Also passed to `onPreviewClick`.
|
|
10
|
+
*/
|
|
11
|
+
value: string;
|
|
12
|
+
/**
|
|
13
|
+
* Caption under the card, and the radio's accessible name.
|
|
14
|
+
*/
|
|
15
|
+
title: string;
|
|
16
|
+
/**
|
|
17
|
+
* Picture filling the card, drawn at a 294×192 aspect ratio.
|
|
18
|
+
*/
|
|
19
|
+
illustration?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Shows a "Preview and edit" link to this URL under the title.
|
|
22
|
+
*/
|
|
23
|
+
previewUrl?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Called with the card's `value` when the "Preview and edit" link is clicked.
|
|
26
|
+
*/
|
|
27
|
+
onPreviewClick?: ( value: string ) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Disables the radio.
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type RadioCardGridProps = {
|
|
35
|
+
/**
|
|
36
|
+
* The `RadioCard`s to lay out.
|
|
37
|
+
*/
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Extra class for the grid.
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
};
|
|
@@ -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/index.ts
CHANGED
|
@@ -26,6 +26,8 @@ export { default as Gravatar } from './components/gravatar/index.tsx';
|
|
|
26
26
|
export type { GravatarProps } from './components/gravatar/index.tsx';
|
|
27
27
|
export { default as CheckboxCard, CheckboxCardGrid } from './components/checkbox-card/index.tsx';
|
|
28
28
|
export type { CheckboxCardProps, CheckboxCardGridProps } from './components/checkbox-card/types.ts';
|
|
29
|
+
export { default as RadioCard, RadioCardGrid } from './components/radio-card/index.tsx';
|
|
30
|
+
export type { RadioCardProps, RadioCardGridProps } from './components/radio-card/types.ts';
|
|
29
31
|
export { default as IconTooltip } from './components/icon-tooltip/index.tsx';
|
|
30
32
|
export { default as ActionButton } from './components/action-button/index.tsx';
|
|
31
33
|
export { default as PricingCard } from './components/pricing-card/index.tsx';
|
|
@@ -65,6 +67,8 @@ export { default as ActionPopover } from './components/action-popover/index.tsx'
|
|
|
65
67
|
export { default as UpsellBanner } from './components/upsell-banner/index.tsx';
|
|
66
68
|
export { getUserLocale, cleanLocale } from './lib/locale/index.ts';
|
|
67
69
|
export { default as StatCard } from './components/stat-card/index.tsx';
|
|
70
|
+
export { default as PeriodSelector } from './components/period-selector/index.tsx';
|
|
71
|
+
export type { PeriodPreset, PeriodSelectorProps } from './components/period-selector/types.ts';
|
|
68
72
|
export { default as DiffViewer } from './components/diff-viewer/index.tsx';
|
|
69
73
|
export { default as MarkedLines } from './components/marked-lines/index.tsx';
|
|
70
74
|
export { default as DetailsViewer } from './components/details-viewer/index.tsx';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Jetpack Components Package",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/components/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -67,6 +67,10 @@
|
|
|
67
67
|
"types": "./build/components/product-price/index.d.ts",
|
|
68
68
|
"default": "./build/components/product-price/index.js"
|
|
69
69
|
},
|
|
70
|
+
"./radio-card": {
|
|
71
|
+
"types": "./build/components/radio-card/index.d.ts",
|
|
72
|
+
"default": "./build/components/radio-card/index.js"
|
|
73
|
+
},
|
|
70
74
|
"./tools/jp-redirect": {
|
|
71
75
|
"types": "./build/tools/jp-redirect/index.d.ts",
|
|
72
76
|
"default": "./build/tools/jp-redirect/index.js"
|
|
@@ -85,36 +89,36 @@
|
|
|
85
89
|
"extends @wordpress/browserslist-config"
|
|
86
90
|
],
|
|
87
91
|
"dependencies": {
|
|
88
|
-
"@automattic/jetpack-api": "^2.2.
|
|
89
|
-
"@automattic/jetpack-boost-score-api": "^1.3.
|
|
90
|
-
"@automattic/jetpack-script-data": "^0.6.
|
|
91
|
-
"@automattic/number-formatters": "^1.
|
|
92
|
+
"@automattic/jetpack-api": "^2.2.4",
|
|
93
|
+
"@automattic/jetpack-boost-score-api": "^1.3.1",
|
|
94
|
+
"@automattic/jetpack-script-data": "^0.6.12",
|
|
95
|
+
"@automattic/number-formatters": "^1.3.0",
|
|
92
96
|
"@babel/runtime": "^7",
|
|
93
97
|
"@gravatar-com/hovercards": "0.16.0",
|
|
94
|
-
"@wordpress/a11y": "
|
|
95
|
-
"@wordpress/admin-ui": "
|
|
96
|
-
"@wordpress/browserslist-config": "
|
|
97
|
-
"@wordpress/components": "
|
|
98
|
-
"@wordpress/compose": "
|
|
99
|
-
"@wordpress/data": "
|
|
100
|
-
"@wordpress/date": "
|
|
101
|
-
"@wordpress/dom": "
|
|
102
|
-
"@wordpress/element": "
|
|
103
|
-
"@wordpress/i18n": "
|
|
104
|
-
"@wordpress/icons": "
|
|
105
|
-
"@wordpress/notices": "
|
|
106
|
-
"@wordpress/theme": "
|
|
107
|
-
"@wordpress/ui": "0.
|
|
98
|
+
"@wordpress/a11y": "5.0.0",
|
|
99
|
+
"@wordpress/admin-ui": "3.0.0",
|
|
100
|
+
"@wordpress/browserslist-config": "7.0.0",
|
|
101
|
+
"@wordpress/components": "43.0.0",
|
|
102
|
+
"@wordpress/compose": "9.0.0",
|
|
103
|
+
"@wordpress/data": "11.0.0",
|
|
104
|
+
"@wordpress/date": "6.0.0",
|
|
105
|
+
"@wordpress/dom": "5.0.0",
|
|
106
|
+
"@wordpress/element": "10.0.0",
|
|
107
|
+
"@wordpress/i18n": "7.0.0",
|
|
108
|
+
"@wordpress/icons": "19.0.0",
|
|
109
|
+
"@wordpress/notices": "6.0.0",
|
|
110
|
+
"@wordpress/theme": "3.0.0",
|
|
111
|
+
"@wordpress/ui": "0.25.0",
|
|
108
112
|
"clsx": "2.1.1",
|
|
109
113
|
"js-sha256": "0.11.1",
|
|
110
114
|
"prop-types": "^15.7.2",
|
|
111
115
|
"qrcode.react": "4.2.0",
|
|
112
|
-
"social-logos": "^3.4.
|
|
116
|
+
"social-logos": "^3.4.3",
|
|
113
117
|
"uplot": "1.6.31",
|
|
114
118
|
"uplot-react": "1.1.4"
|
|
115
119
|
},
|
|
116
120
|
"devDependencies": {
|
|
117
|
-
"@automattic/jetpack-base-styles": "^
|
|
121
|
+
"@automattic/jetpack-base-styles": "^2.0.0",
|
|
118
122
|
"@babel/core": "7.29.7",
|
|
119
123
|
"@jest/globals": "30.5.2",
|
|
120
124
|
"@storybook/addon-docs": "10.6.3",
|
|
@@ -126,6 +130,7 @@
|
|
|
126
130
|
"@types/react": "19.3.0",
|
|
127
131
|
"@types/react-dom": "19.3.0",
|
|
128
132
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
133
|
+
"@wordpress/base-styles": "14.0.0",
|
|
129
134
|
"jest": "30.5.2",
|
|
130
135
|
"react": "19.3.0",
|
|
131
136
|
"react-dom": "19.3.0",
|
|
@@ -133,7 +138,7 @@
|
|
|
133
138
|
"storybook": "10.6.3",
|
|
134
139
|
"ts-dedent": "2.2.0",
|
|
135
140
|
"typescript": "6.0.3",
|
|
136
|
-
"webpack": "5.
|
|
141
|
+
"webpack": "5.112.2",
|
|
137
142
|
"webpack-cli": "7.2.1"
|
|
138
143
|
},
|
|
139
144
|
"peerDependencies": {
|