@automattic/jetpack-components 2.2.0 → 3.0.0
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 +20 -0
- package/build/components/action-button/index.d.ts +1 -1
- package/build/components/action-popover/index.d.ts +1 -1
- package/build/components/admin-page/style.module.scss +3 -3
- package/build/components/boost-score-graph/uplot-line-chart.d.ts +1 -1
- package/build/components/decorative-card/index.d.ts +1 -1
- package/build/components/details-viewer/index.d.ts +1 -1
- package/build/components/diff-viewer/index.d.ts +1 -1
- package/build/components/dot-pager/index.d.ts +1 -1
- package/build/components/global-notices/global-notices.d.ts +1 -1
- package/build/components/loading-placeholder/index.d.ts +1 -1
- package/build/components/marked-lines/index.d.ts +1 -1
- package/build/components/navigator-modal/footer.d.ts +1 -1
- package/build/components/navigator-modal/header.d.ts +1 -1
- package/build/components/navigator-modal/index.d.ts +1 -1
- package/build/components/navigator-modal/screen.d.ts +1 -1
- package/build/components/stat-card/index.d.ts +1 -1
- package/build/components/swipeable/index.d.ts +1 -1
- package/build/components/upsell-banner/index.d.ts +1 -0
- package/build/components/upsell-banner/index.js +8 -2
- package/build/components/upsell-banner/style.scss +8 -0
- package/build/components/upsell-banner/types.d.ts +4 -0
- package/build/index.d.ts +0 -12
- package/build/index.js +0 -12
- package/components/admin-page/style.module.scss +3 -3
- package/components/upsell-banner/index.tsx +19 -0
- package/components/upsell-banner/style.scss +8 -0
- package/components/upsell-banner/types.ts +4 -0
- package/index.ts +0 -12
- package/package.json +19 -19
- package/build/components/alert/index.d.ts +0 -23
- package/build/components/alert/index.js +0 -33
- package/build/components/alert/style.module.scss +0 -47
- package/build/components/chip/index.d.ts +0 -17
- package/build/components/chip/index.js +0 -18
- package/build/components/chip/style.module.scss +0 -14
- package/build/components/contextual-upgrade-trigger/index.d.ts +0 -19
- package/build/components/contextual-upgrade-trigger/index.js +0 -27
- package/build/components/contextual-upgrade-trigger/style.module.scss +0 -77
- package/build/components/contextual-upgrade-trigger/types.d.ts +0 -9
- package/build/components/contextual-upgrade-trigger/types.js +0 -1
- package/build/components/dialog/index.d.ts +0 -20
- package/build/components/dialog/index.js +0 -32
- package/build/components/dialog/style.module.scss +0 -31
- package/build/components/jetpack-protect-logo/index.d.ts +0 -4
- package/build/components/jetpack-protect-logo/index.js +0 -10
- package/build/components/jetpack-protect-logo/types.d.ts +0 -7
- package/build/components/jetpack-protect-logo/types.js +0 -1
- package/build/components/jetpack-search-logo/index.d.ts +0 -4
- package/build/components/jetpack-search-logo/index.js +0 -7
- package/build/components/jetpack-search-logo/types.d.ts +0 -7
- package/build/components/jetpack-search-logo/types.js +0 -1
- package/build/components/jetpack-videopress-logo/index.d.ts +0 -4
- package/build/components/jetpack-videopress-logo/index.js +0 -8
- package/build/components/jetpack-videopress-logo/types.d.ts +0 -6
- package/build/components/jetpack-videopress-logo/types.js +0 -1
- package/build/components/product-offer/icons-card.d.ts +0 -10
- package/build/components/product-offer/icons-card.js +0 -23
- package/build/components/product-offer/index.d.ts +0 -11
- package/build/components/product-offer/index.js +0 -31
- package/build/components/product-offer/product-offer-header.d.ts +0 -9
- package/build/components/product-offer/product-offer-header.js +0 -14
- package/build/components/product-offer/style.module.scss +0 -93
- package/build/components/product-offer/types.d.ts +0 -102
- package/build/components/product-offer/types.js +0 -1
- package/build/components/radio-control/index.d.ts +0 -24
- package/build/components/radio-control/index.js +0 -7
- package/build/components/split-button/index.d.ts +0 -4
- package/build/components/split-button/index.js +0 -14
- package/build/components/split-button/style.module.scss +0 -26
- package/build/components/split-button/types.d.ts +0 -5
- package/build/components/split-button/types.js +0 -1
- package/build/components/status/index.d.ts +0 -19
- package/build/components/status/index.js +0 -29
- package/build/components/status/style.module.scss +0 -82
- package/build/components/toggle-control/index.d.ts +0 -23
- package/build/components/toggle-control/index.js +0 -21
- package/build/components/toggle-control/styles.module.scss +0 -24
- package/components/alert/index.tsx +0 -60
- package/components/alert/style.module.scss +0 -47
- package/components/chip/README.md +0 -21
- package/components/chip/index.tsx +0 -25
- package/components/chip/style.module.scss +0 -14
- package/components/contextual-upgrade-trigger/README.md +0 -81
- package/components/contextual-upgrade-trigger/index.tsx +0 -59
- package/components/contextual-upgrade-trigger/style.module.scss +0 -77
- package/components/contextual-upgrade-trigger/types.ts +0 -9
- package/components/dialog/index.tsx +0 -70
- package/components/dialog/style.module.scss +0 -31
- package/components/jetpack-protect-logo/README.md +0 -20
- package/components/jetpack-protect-logo/index.tsx +0 -60
- package/components/jetpack-protect-logo/types.ts +0 -7
- package/components/jetpack-search-logo/README.md +0 -20
- package/components/jetpack-search-logo/index.tsx +0 -93
- package/components/jetpack-search-logo/types.ts +0 -7
- package/components/jetpack-videopress-logo/README.md +0 -19
- package/components/jetpack-videopress-logo/index.tsx +0 -95
- package/components/jetpack-videopress-logo/types.tsx +0 -6
- package/components/product-offer/icons-card.tsx +0 -48
- package/components/product-offer/index.tsx +0 -115
- package/components/product-offer/product-offer-header.tsx +0 -23
- package/components/product-offer/style.module.scss +0 -93
- package/components/product-offer/types.ts +0 -126
- package/components/radio-control/README.md +0 -5
- package/components/radio-control/index.tsx +0 -55
- package/components/split-button/index.tsx +0 -48
- package/components/split-button/style.module.scss +0 -26
- package/components/split-button/types.ts +0 -12
- package/components/status/README.md +0 -42
- package/components/status/index.tsx +0 -52
- package/components/status/style.module.scss +0 -82
- package/components/toggle-control/README.md +0 -5
- package/components/toggle-control/index.tsx +0 -80
- package/components/toggle-control/styles.module.scss +0 -24
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
.wrapper {
|
|
2
|
-
padding: calc(var(--spacing-base) * 8);
|
|
3
|
-
position: relative;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.is-card {
|
|
7
|
-
background-color: var(--jp-white);
|
|
8
|
-
border: 1px solid var(--jp-gray);
|
|
9
|
-
border-radius: var(--jp-border-radius);
|
|
10
|
-
box-shadow: 0 2px 6px var(--product-card-shadow), 0 1px 2px var(--product-card-shadow);
|
|
11
|
-
|
|
12
|
-
.card-header {
|
|
13
|
-
border-radius: var(--jp-border-radius) var(--jp-border-radius) 0 0;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.card-header {
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
background: var(--jp-black);
|
|
21
|
-
color: var(--jp-white);
|
|
22
|
-
padding: calc(var(--spacing-base) / 2) var(--spacing-base);
|
|
23
|
-
line-height: calc(var(--spacing-base) * 3);
|
|
24
|
-
position: absolute;
|
|
25
|
-
top: 0;
|
|
26
|
-
left: 0;
|
|
27
|
-
width: 100%;
|
|
28
|
-
box-sizing: border-box;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.card-container {
|
|
32
|
-
height: 100%;
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.product-bundle-icon {
|
|
38
|
-
fill: var(--jp-white);
|
|
39
|
-
margin-right: var(--spacing-base);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.product-bundle-icons,
|
|
43
|
-
.product-icon {
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
margin-bottom: calc(var(--spacing-base) * 4);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.plus-icon {
|
|
50
|
-
fill: rgb(140, 143, 148);
|
|
51
|
-
height: 24px;
|
|
52
|
-
line-height: 24px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.features {
|
|
56
|
-
margin: 0;
|
|
57
|
-
padding: 0;
|
|
58
|
-
flex-grow: 1;
|
|
59
|
-
margin-bottom: calc(var(--spacing-base) * 2);
|
|
60
|
-
|
|
61
|
-
li {
|
|
62
|
-
list-style: none;
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: flex-start;
|
|
65
|
-
margin-bottom: var(--spacing-base);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.check {
|
|
69
|
-
fill: var(--jp-green-primary);
|
|
70
|
-
margin-right: var(--spacing-base);
|
|
71
|
-
flex-shrink: 0;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.product-has-required-plan {
|
|
76
|
-
display: flex;
|
|
77
|
-
justify-content: center;
|
|
78
|
-
align-items: center;
|
|
79
|
-
|
|
80
|
-
svg {
|
|
81
|
-
margin-right: var(--spacing-base);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.add-button {
|
|
86
|
-
width: 100%;
|
|
87
|
-
justify-content: center;
|
|
88
|
-
|
|
89
|
-
&:global(.is-primary):disabled {
|
|
90
|
-
opacity: 1;
|
|
91
|
-
background-color: var(--jp-black);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { ProductPriceProps } from '../product-price/types.ts';
|
|
2
|
-
import type { JetpackIconSlug } from '../icons/index.tsx';
|
|
3
|
-
import type { ReactNode } from 'react';
|
|
4
|
-
export type ProductOfferProps = {
|
|
5
|
-
/**
|
|
6
|
-
* Product slug.
|
|
7
|
-
*/
|
|
8
|
-
slug?: JetpackIconSlug;
|
|
9
|
-
/**
|
|
10
|
-
* Product name.
|
|
11
|
-
*/
|
|
12
|
-
name?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Custom Icon slug.
|
|
15
|
-
*/
|
|
16
|
-
icon?: JetpackIconSlug;
|
|
17
|
-
/**
|
|
18
|
-
* Product title.
|
|
19
|
-
*/
|
|
20
|
-
title?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Product sub-title.
|
|
23
|
-
*/
|
|
24
|
-
subTitle?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Product description.
|
|
27
|
-
*/
|
|
28
|
-
description?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Features list of the product.
|
|
31
|
-
*/
|
|
32
|
-
features?: Array<string>;
|
|
33
|
-
/**
|
|
34
|
-
* Add the styles to look like a card.
|
|
35
|
-
*/
|
|
36
|
-
isCard?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Whether or not the product is a bundle.
|
|
39
|
-
*/
|
|
40
|
-
isBundle?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* List of supported products (for bundles).
|
|
43
|
-
*/
|
|
44
|
-
supportedProducts?: Array<JetpackIconSlug>;
|
|
45
|
-
/**
|
|
46
|
-
* Product Pricing object.
|
|
47
|
-
*/
|
|
48
|
-
pricing?: Pricing;
|
|
49
|
-
/**
|
|
50
|
-
* Whether or not the product has the required plan.
|
|
51
|
-
*/
|
|
52
|
-
hasRequiredPlan?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Applies the isLoading style to the component.
|
|
55
|
-
*/
|
|
56
|
-
isLoading?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* A className to be concat with default ones.
|
|
59
|
-
*/
|
|
60
|
-
className?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Callback function to be executed on click on Add button.
|
|
63
|
-
*/
|
|
64
|
-
onAdd?: VoidFunction;
|
|
65
|
-
/**
|
|
66
|
-
* The checkout URL to add/buy the product.
|
|
67
|
-
*/
|
|
68
|
-
addProductUrl?: string;
|
|
69
|
-
/**
|
|
70
|
-
* The text to be displayed on the Add button.
|
|
71
|
-
*/
|
|
72
|
-
buttonText?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Content displayed below the Add button.
|
|
75
|
-
*/
|
|
76
|
-
buttonDisclaimer?: ReactNode;
|
|
77
|
-
/**
|
|
78
|
-
* Error message.
|
|
79
|
-
*/
|
|
80
|
-
error?: string;
|
|
81
|
-
};
|
|
82
|
-
export type Pricing = Pick<ProductPriceProps, 'currency' | 'offPrice' | 'price'> & {
|
|
83
|
-
/**
|
|
84
|
-
* Whether it is a free product
|
|
85
|
-
*/
|
|
86
|
-
isFree?: boolean;
|
|
87
|
-
};
|
|
88
|
-
export type IconsCardProps = {
|
|
89
|
-
/**
|
|
90
|
-
* Custom icon slug.
|
|
91
|
-
*/
|
|
92
|
-
icon: JetpackIconSlug;
|
|
93
|
-
/**
|
|
94
|
-
* List of supported products.
|
|
95
|
-
*/
|
|
96
|
-
products: Array<JetpackIconSlug>;
|
|
97
|
-
/**
|
|
98
|
-
* Icon size.
|
|
99
|
-
*/
|
|
100
|
-
size: number;
|
|
101
|
-
};
|
|
102
|
-
export type ProductOfferHeaderProps = Pick<ProductOfferProps, 'title'>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { FC, ReactNode } from 'react';
|
|
2
|
-
export interface RadioControlProps {
|
|
3
|
-
/** The current value. */
|
|
4
|
-
selected: string;
|
|
5
|
-
/** Custom class name to append to the component. */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** Whether or not the radio control is currently disabled. */
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
/** Additional information to display below the radio control. */
|
|
10
|
-
help?: ReactNode;
|
|
11
|
-
/** The label for the radio control. */
|
|
12
|
-
label?: ReactNode;
|
|
13
|
-
/** If true, the label will only be visible to screen readers. */
|
|
14
|
-
hideLabelFromVision?: boolean;
|
|
15
|
-
/** A list of options to show. */
|
|
16
|
-
options: {
|
|
17
|
-
label: string;
|
|
18
|
-
value: string;
|
|
19
|
-
}[];
|
|
20
|
-
/** A callback function invoked when the value is changed. */
|
|
21
|
-
onChange: (value: string) => void;
|
|
22
|
-
}
|
|
23
|
-
declare const RadioControl: FC<RadioControlProps>;
|
|
24
|
-
export default RadioControl;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { RadioControl as WPRadioControl } from '@wordpress/components';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
const RadioControl = ({ selected, className, disabled, help, label, hideLabelFromVision, options, onChange, }) => {
|
|
5
|
-
return (_jsx(WPRadioControl, { selected: selected, className: clsx('radio', className), disabled: disabled, help: help, label: label, hideLabelFromVision: hideLabelFromVision, options: options, onChange: onChange }));
|
|
6
|
-
};
|
|
7
|
-
export default RadioControl;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Flex, DropdownMenu } from '@wordpress/components';
|
|
3
|
-
import styles from './style.module.scss';
|
|
4
|
-
const DownIcon = () => (_jsx("svg", { width: "15", height: "9", fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "10 9 4 7", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "m18.004 10.555-6.005 5.459-6.004-5.459 1.009-1.11 4.995 4.542 4.996-4.542 1.009 1.11Z" }) }));
|
|
5
|
-
const SplitButton = ({ variant, controls, popoverProps, toggleProps, label, ...buttonProps }) => {
|
|
6
|
-
// Cast to work around WPButton's strict union type
|
|
7
|
-
const wpButtonProps = {
|
|
8
|
-
variant,
|
|
9
|
-
className: styles.button,
|
|
10
|
-
...buttonProps,
|
|
11
|
-
};
|
|
12
|
-
return (_jsx(Flex, { className: styles['split-button'], children: _jsxs("div", { role: "group", className: "components-button-group", children: [_jsx(Button, { ...wpButtonProps }), _jsx(DropdownMenu, { toggleProps: { variant, className: styles.button, ...toggleProps }, popoverProps: { noArrow: false, ...popoverProps }, icon: _jsx(DownIcon, {}), disableOpenOnArrowDown: true, controls: controls, label: label })] }) }));
|
|
13
|
-
};
|
|
14
|
-
export default SplitButton;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.split-button {
|
|
2
|
-
--actions-size: 28px;
|
|
3
|
-
display: flex;
|
|
4
|
-
height: var(--actions-size);
|
|
5
|
-
border-radius: var(--jp-border-radius);
|
|
6
|
-
|
|
7
|
-
:global(.components-button-group) {
|
|
8
|
-
display: flex;
|
|
9
|
-
height: 100%;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
> .button:first-child {
|
|
13
|
-
border-radius: var(--jp-border-radius) 0 0 var(--jp-border-radius);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
> :global(.components-dropdown) > .button {
|
|
17
|
-
border-radius: 0 var(--jp-border-radius) var(--jp-border-radius) 0;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.button {
|
|
22
|
-
font-size: var(--font-body-extra-small);
|
|
23
|
-
border-radius: var(--jp-border-radius);
|
|
24
|
-
height: var(--actions-size);
|
|
25
|
-
line-height: var(--actions-size);
|
|
26
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Button, DropdownMenu } from '@wordpress/components';
|
|
2
|
-
import type { ComponentProps } from 'react';
|
|
3
|
-
type AllowedDropdownMenuProps = Pick<ComponentProps<typeof DropdownMenu>, 'controls' | 'popoverProps' | 'toggleProps' | 'label'>;
|
|
4
|
-
export type SplitButtonProps = Omit<ComponentProps<typeof Button>, 'controls'> & AllowedDropdownMenuProps & Required<Pick<AllowedDropdownMenuProps, 'controls'>>;
|
|
5
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react';
|
|
2
|
-
export interface StatusProps {
|
|
3
|
-
status?: 'active' | 'error' | 'inactive' | 'action' | 'initializing';
|
|
4
|
-
label?: string;
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Status component.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated Inline the equivalent JSX using `Text` from `@wordpress/ui` and a small color-coded indicator span. The wrapper renders a flex container at `body-sm` size with `font-weight: 600` and a `0.666em` round indicator coloured by status using WPDS design tokens (`var(--wpds-color-foreground-content-success-weak)` for `active`, `--wpds-color-foreground-content-error-weak` for `error`, `--wpds-color-foreground-content-neutral-weak` for `inactive`, `--wpds-color-foreground-content-warning-weak` for `action`, `--wpds-color-foreground-content-info-weak` for `initializing`). Include a fallback hex for surfaces that don't load `@wordpress/theme/design-tokens.css` (e.g. the legacy Jetpack settings dashboard).
|
|
11
|
-
*
|
|
12
|
-
* @param {StatusProps} props - The component properties.
|
|
13
|
-
* @param {string} props.className - Optional className forwarded to the outer element.
|
|
14
|
-
* @param {string} props.label - Status label. Defaults to a status-derived string.
|
|
15
|
-
* @param {string} props.status - Status key: `active | error | inactive | action | initializing`.
|
|
16
|
-
* @return {JSX.Element} The `Status` component.
|
|
17
|
-
*/
|
|
18
|
-
declare const Status: ({ className, label, status }: StatusProps) => JSX.Element;
|
|
19
|
-
export default Status;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { __ } from '@wordpress/i18n';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import Text from '../text/index.js';
|
|
5
|
-
import styles from './style.module.scss';
|
|
6
|
-
/**
|
|
7
|
-
* Status component.
|
|
8
|
-
*
|
|
9
|
-
* @deprecated Inline the equivalent JSX using `Text` from `@wordpress/ui` and a small color-coded indicator span. The wrapper renders a flex container at `body-sm` size with `font-weight: 600` and a `0.666em` round indicator coloured by status using WPDS design tokens (`var(--wpds-color-foreground-content-success-weak)` for `active`, `--wpds-color-foreground-content-error-weak` for `error`, `--wpds-color-foreground-content-neutral-weak` for `inactive`, `--wpds-color-foreground-content-warning-weak` for `action`, `--wpds-color-foreground-content-info-weak` for `initializing`). Include a fallback hex for surfaces that don't load `@wordpress/theme/design-tokens.css` (e.g. the legacy Jetpack settings dashboard).
|
|
10
|
-
*
|
|
11
|
-
* @param {StatusProps} props - The component properties.
|
|
12
|
-
* @param {string} props.className - Optional className forwarded to the outer element.
|
|
13
|
-
* @param {string} props.label - Status label. Defaults to a status-derived string.
|
|
14
|
-
* @param {string} props.status - Status key: `active | error | inactive | action | initializing`.
|
|
15
|
-
* @return {JSX.Element} The `Status` component.
|
|
16
|
-
*/
|
|
17
|
-
const Status = ({ className, label, status = 'inactive' }) => {
|
|
18
|
-
const defaultLabels = {
|
|
19
|
-
active: __('Active', 'jetpack-components'),
|
|
20
|
-
error: __('Error', 'jetpack-components'),
|
|
21
|
-
action: __('Action needed', 'jetpack-components'),
|
|
22
|
-
inactive: __('Inactive', 'jetpack-components'),
|
|
23
|
-
initializing: __('Setting up', 'jetpack-components'),
|
|
24
|
-
};
|
|
25
|
-
return (_jsxs(Text, { variant: "body-extra-small", className: clsx(styles.status, {
|
|
26
|
-
[styles[`is-${status}`]]: status,
|
|
27
|
-
}, className), children: [_jsx("span", { className: styles.status__indicator }), _jsx("span", { className: styles.status__label, children: label || label === '' ? label : defaultLabels[status] })] }));
|
|
28
|
-
};
|
|
29
|
-
export default Status;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
.status {
|
|
2
|
-
--spacing-base: 8px;
|
|
3
|
-
--wp-admin-border-width-focus: 1.5px;
|
|
4
|
-
|
|
5
|
-
align-items: center;
|
|
6
|
-
display: flex;
|
|
7
|
-
white-space: nowrap;
|
|
8
|
-
|
|
9
|
-
&__indicator {
|
|
10
|
-
background-color: var(--jp-gray-50);
|
|
11
|
-
border-radius: 50%;
|
|
12
|
-
flex-shrink: 0;
|
|
13
|
-
height: 0.666em;
|
|
14
|
-
width: 0.666em;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&__label {
|
|
18
|
-
font-weight: 600;
|
|
19
|
-
line-height: 1.666;
|
|
20
|
-
margin-left: calc(var(--spacing-base) / 2); // 4px
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&.is-active {
|
|
24
|
-
|
|
25
|
-
span,
|
|
26
|
-
a {
|
|
27
|
-
color: var(--jp-green-50);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.status__indicator {
|
|
31
|
-
background-color: var(--jp-green-50);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&.is-inactive {
|
|
36
|
-
|
|
37
|
-
span,
|
|
38
|
-
a {
|
|
39
|
-
color: var(--jp-gray-50);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.status__indicator {
|
|
43
|
-
background-color: var(--jp-gray-50);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&.is-error {
|
|
48
|
-
|
|
49
|
-
span,
|
|
50
|
-
a {
|
|
51
|
-
color: var(--jp-red-50);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.status__indicator {
|
|
55
|
-
background-color: var(--jp-red-50);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&.is-action {
|
|
60
|
-
|
|
61
|
-
span,
|
|
62
|
-
a {
|
|
63
|
-
color: var(--jp-yellow-30);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.status__indicator {
|
|
67
|
-
background-color: var(--jp-yellow-30);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&.is-initializing {
|
|
72
|
-
|
|
73
|
-
span,
|
|
74
|
-
a {
|
|
75
|
-
color: var(--jp-blue-40);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.status__indicator {
|
|
79
|
-
background-color: var(--jp-blue-40);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { FC, ReactNode } from 'react';
|
|
2
|
-
export interface ToggleControlProps {
|
|
3
|
-
/** Whether or not the toggle is currently enabled. */
|
|
4
|
-
checked?: boolean;
|
|
5
|
-
/** Custom class name to append to the component. */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** Whether or not the toggle is currently disabled. */
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
/** Additional information to display below the toggle. */
|
|
10
|
-
help?: ReactNode;
|
|
11
|
-
/** Whether or not the toggling is currently toggling. */
|
|
12
|
-
toggling?: boolean;
|
|
13
|
-
/** The label for the toggle. */
|
|
14
|
-
label?: ReactNode;
|
|
15
|
-
/** Accessible name for the underlying checkbox. Use when no visible `label` is rendered. */
|
|
16
|
-
'aria-label'?: string;
|
|
17
|
-
/** The size of the toggle. */
|
|
18
|
-
size?: 'small' | 'normal';
|
|
19
|
-
/** A callback function invoked when the toggle is clicked. */
|
|
20
|
-
onChange: (value: boolean) => void;
|
|
21
|
-
}
|
|
22
|
-
declare const ToggleControl: FC<ToggleControlProps>;
|
|
23
|
-
export default ToggleControl;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ToggleControl as WPToggleControl } from '@wordpress/components';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { useCallback } from 'react';
|
|
5
|
-
import styles from './styles.module.scss';
|
|
6
|
-
const ToggleControl = ({ checked, className, disabled, help, toggling, label, 'aria-label': ariaLabel, size = 'normal', onChange, }) => {
|
|
7
|
-
const showChecked = toggling !== undefined ? (checked && !toggling) || (!checked && toggling) : checked;
|
|
8
|
-
const handleOnChange = useCallback((value) => {
|
|
9
|
-
// Don't toggle if the toggle is already toggling.
|
|
10
|
-
if (toggling) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
onChange(value);
|
|
14
|
-
}, [toggling, onChange]);
|
|
15
|
-
return (_jsx(WPToggleControl, { __nextHasNoMarginBottom: true, checked: showChecked, className: clsx(styles.toggle, className, {
|
|
16
|
-
[styles['is-toggling']]: toggling,
|
|
17
|
-
[styles['is-small']]: size === 'small',
|
|
18
|
-
[styles['no-label']]: !label,
|
|
19
|
-
}), disabled: disabled, help: help, label: label, "aria-label": ariaLabel, onChange: handleOnChange }));
|
|
20
|
-
};
|
|
21
|
-
export default ToggleControl;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// Toggle Control
|
|
2
|
-
///
|
|
3
|
-
/// Overrides the @wordpress/components ToggleControl component.
|
|
4
|
-
/// @link https://github.com/WordPress/gutenberg/tree/trunk/packages/components/src/form-toggle
|
|
5
|
-
.toggle {
|
|
6
|
-
|
|
7
|
-
&.is-small {
|
|
8
|
-
--base-width: 6px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
&.no-label :global(.components-toggle-control__label) {
|
|
12
|
-
display: none;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.toggle.is-toggling {
|
|
17
|
-
|
|
18
|
-
:global {
|
|
19
|
-
|
|
20
|
-
.components-form-toggle {
|
|
21
|
-
opacity: 0.6;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Icon, cautionFilled as warning, info, check } from '@wordpress/icons';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import styles from './style.module.scss';
|
|
4
|
-
import type { ReactNode, Component, ReactElement, FC } from 'react';
|
|
5
|
-
|
|
6
|
-
type AlertProps = {
|
|
7
|
-
/** The severity of the alert. */
|
|
8
|
-
level: 'error' | 'warning' | 'info' | 'success';
|
|
9
|
-
|
|
10
|
-
/** Show/Hide icon */
|
|
11
|
-
showIcon?: boolean;
|
|
12
|
-
|
|
13
|
-
/** Children to be rendered inside the alert. */
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
|
|
16
|
-
/** Wrapper class name */
|
|
17
|
-
className?: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const getIconByLevel = ( level: AlertProps[ 'level' ] ) => {
|
|
21
|
-
switch ( level ) {
|
|
22
|
-
case 'error':
|
|
23
|
-
return warning;
|
|
24
|
-
case 'warning':
|
|
25
|
-
return warning;
|
|
26
|
-
case 'info':
|
|
27
|
-
return info;
|
|
28
|
-
case 'success':
|
|
29
|
-
return check;
|
|
30
|
-
default:
|
|
31
|
-
return warning;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Alert component
|
|
37
|
-
*
|
|
38
|
-
* @param {object} props - The component properties.
|
|
39
|
-
* @param {string} props.level - The alert level: error, warning, info, success.
|
|
40
|
-
* @param {boolean} props.showIcon - Whether to show the alert icon.
|
|
41
|
-
* @param {string} props.className - The wrapper class name.
|
|
42
|
-
* @param {Component} props.children - The alert content.
|
|
43
|
-
* @return {ReactElement} The `Alert` component.
|
|
44
|
-
*/
|
|
45
|
-
const Alert: FC< AlertProps > = ( { level = 'warning', children, showIcon = true, className } ) => {
|
|
46
|
-
const classes = clsx( styles.container, styles[ `is-${ level }` ], className );
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div className={ classes }>
|
|
50
|
-
{ showIcon && (
|
|
51
|
-
<div className={ styles[ 'icon-wrapper' ] }>
|
|
52
|
-
<Icon icon={ getIconByLevel( level ) } className={ styles.icon } />
|
|
53
|
-
</div>
|
|
54
|
-
) }
|
|
55
|
-
<div>{ children }</div>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default Alert;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
display: flex;
|
|
3
|
-
font-size: var(--font-body);
|
|
4
|
-
line-height: calc(var(--spacing-base) * 3);
|
|
5
|
-
min-height: calc(var(--spacing-base) * 3);
|
|
6
|
-
align-items: center;
|
|
7
|
-
margin: calc(var(--spacing-base) * 2) 0;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.icon-wrapper {
|
|
11
|
-
margin-right: calc(var(--spacing-base) / 2);
|
|
12
|
-
width: calc(var(--spacing-base) * 3);
|
|
13
|
-
height: calc(var(--spacing-base) * 3);
|
|
14
|
-
align-self: flex-start;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.is-error {
|
|
18
|
-
color: var(--jp-red);
|
|
19
|
-
|
|
20
|
-
.icon {
|
|
21
|
-
fill: var(--jp-red);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.is-warning {
|
|
26
|
-
color: var(--jp-yellow-40);
|
|
27
|
-
|
|
28
|
-
.icon {
|
|
29
|
-
fill: var(--jp-yellow-40);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.is-info {
|
|
34
|
-
color: var(--jp-blue-40);
|
|
35
|
-
|
|
36
|
-
.icon {
|
|
37
|
-
fill: var(--jp-blue-40);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.is-success {
|
|
42
|
-
color: var(--jp-green);
|
|
43
|
-
|
|
44
|
-
.icon {
|
|
45
|
-
fill: var(--jp-green);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Chip
|
|
2
|
-
=========
|
|
3
|
-
|
|
4
|
-
> **Deprecated.** Use `Badge` from `@wordpress/ui` instead. Map `type="new"` to `intent="stable"` and `type="info"` to the default `intent`. This component is retained as a compatibility shim for downstream consumers and will be removed in the next major version.
|
|
5
|
-
|
|
6
|
-
This component is useful to indicate something is new.
|
|
7
|
-
|
|
8
|
-
## General Usage:
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
import { Chip } from '@automattic/jetpack-components';
|
|
12
|
-
render() {
|
|
13
|
-
return (
|
|
14
|
-
<Chip type="new" text="New" />
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Props
|
|
20
|
-
|
|
21
|
-
- `className`: an optional class name.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import styles from './style.module.scss';
|
|
3
|
-
import type { ReactElement, FC } from 'react';
|
|
4
|
-
|
|
5
|
-
type ChipProps = {
|
|
6
|
-
text?: string;
|
|
7
|
-
type?: 'new' | 'info';
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Chip component
|
|
12
|
-
*
|
|
13
|
-
* @deprecated Use `Badge` from `@wordpress/ui` instead. Map `type="new"` to `intent="stable"` and `type="info"` to the default `intent`.
|
|
14
|
-
*
|
|
15
|
-
* @param {object} props - The component properties.
|
|
16
|
-
* @param {string} props.type - The type new or info
|
|
17
|
-
* @param {string} props.text - Chip text
|
|
18
|
-
* @return {ReactElement} The `Chip` component.
|
|
19
|
-
*/
|
|
20
|
-
const Chip: FC< ChipProps > = ( { type = 'info', text } ) => {
|
|
21
|
-
const classes = clsx( styles.chip, styles[ `is-${ type }` ] );
|
|
22
|
-
return <span className={ classes }>{ text }</span>;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default Chip;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.chip {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
border-radius: 3px;
|
|
4
|
-
background-color: var(--jp-gray-5);
|
|
5
|
-
color: var(--jp-gray-50);
|
|
6
|
-
padding: 0 6px;
|
|
7
|
-
margin: 0 8px;
|
|
8
|
-
text-transform: uppercase;
|
|
9
|
-
font-size: 10px;
|
|
10
|
-
font-weight: 700;
|
|
11
|
-
line-height: 20px;
|
|
12
|
-
font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
13
|
-
|
|
14
|
-
}
|