@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.
Files changed (114) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build/components/action-button/index.d.ts +1 -1
  3. package/build/components/action-popover/index.d.ts +1 -1
  4. package/build/components/admin-page/style.module.scss +3 -3
  5. package/build/components/boost-score-graph/uplot-line-chart.d.ts +1 -1
  6. package/build/components/decorative-card/index.d.ts +1 -1
  7. package/build/components/details-viewer/index.d.ts +1 -1
  8. package/build/components/diff-viewer/index.d.ts +1 -1
  9. package/build/components/dot-pager/index.d.ts +1 -1
  10. package/build/components/global-notices/global-notices.d.ts +1 -1
  11. package/build/components/loading-placeholder/index.d.ts +1 -1
  12. package/build/components/marked-lines/index.d.ts +1 -1
  13. package/build/components/navigator-modal/footer.d.ts +1 -1
  14. package/build/components/navigator-modal/header.d.ts +1 -1
  15. package/build/components/navigator-modal/index.d.ts +1 -1
  16. package/build/components/navigator-modal/screen.d.ts +1 -1
  17. package/build/components/stat-card/index.d.ts +1 -1
  18. package/build/components/swipeable/index.d.ts +1 -1
  19. package/build/components/upsell-banner/index.d.ts +1 -0
  20. package/build/components/upsell-banner/index.js +8 -2
  21. package/build/components/upsell-banner/style.scss +8 -0
  22. package/build/components/upsell-banner/types.d.ts +4 -0
  23. package/build/index.d.ts +0 -12
  24. package/build/index.js +0 -12
  25. package/components/admin-page/style.module.scss +3 -3
  26. package/components/upsell-banner/index.tsx +19 -0
  27. package/components/upsell-banner/style.scss +8 -0
  28. package/components/upsell-banner/types.ts +4 -0
  29. package/index.ts +0 -12
  30. package/package.json +19 -19
  31. package/build/components/alert/index.d.ts +0 -23
  32. package/build/components/alert/index.js +0 -33
  33. package/build/components/alert/style.module.scss +0 -47
  34. package/build/components/chip/index.d.ts +0 -17
  35. package/build/components/chip/index.js +0 -18
  36. package/build/components/chip/style.module.scss +0 -14
  37. package/build/components/contextual-upgrade-trigger/index.d.ts +0 -19
  38. package/build/components/contextual-upgrade-trigger/index.js +0 -27
  39. package/build/components/contextual-upgrade-trigger/style.module.scss +0 -77
  40. package/build/components/contextual-upgrade-trigger/types.d.ts +0 -9
  41. package/build/components/contextual-upgrade-trigger/types.js +0 -1
  42. package/build/components/dialog/index.d.ts +0 -20
  43. package/build/components/dialog/index.js +0 -32
  44. package/build/components/dialog/style.module.scss +0 -31
  45. package/build/components/jetpack-protect-logo/index.d.ts +0 -4
  46. package/build/components/jetpack-protect-logo/index.js +0 -10
  47. package/build/components/jetpack-protect-logo/types.d.ts +0 -7
  48. package/build/components/jetpack-protect-logo/types.js +0 -1
  49. package/build/components/jetpack-search-logo/index.d.ts +0 -4
  50. package/build/components/jetpack-search-logo/index.js +0 -7
  51. package/build/components/jetpack-search-logo/types.d.ts +0 -7
  52. package/build/components/jetpack-search-logo/types.js +0 -1
  53. package/build/components/jetpack-videopress-logo/index.d.ts +0 -4
  54. package/build/components/jetpack-videopress-logo/index.js +0 -8
  55. package/build/components/jetpack-videopress-logo/types.d.ts +0 -6
  56. package/build/components/jetpack-videopress-logo/types.js +0 -1
  57. package/build/components/product-offer/icons-card.d.ts +0 -10
  58. package/build/components/product-offer/icons-card.js +0 -23
  59. package/build/components/product-offer/index.d.ts +0 -11
  60. package/build/components/product-offer/index.js +0 -31
  61. package/build/components/product-offer/product-offer-header.d.ts +0 -9
  62. package/build/components/product-offer/product-offer-header.js +0 -14
  63. package/build/components/product-offer/style.module.scss +0 -93
  64. package/build/components/product-offer/types.d.ts +0 -102
  65. package/build/components/product-offer/types.js +0 -1
  66. package/build/components/radio-control/index.d.ts +0 -24
  67. package/build/components/radio-control/index.js +0 -7
  68. package/build/components/split-button/index.d.ts +0 -4
  69. package/build/components/split-button/index.js +0 -14
  70. package/build/components/split-button/style.module.scss +0 -26
  71. package/build/components/split-button/types.d.ts +0 -5
  72. package/build/components/split-button/types.js +0 -1
  73. package/build/components/status/index.d.ts +0 -19
  74. package/build/components/status/index.js +0 -29
  75. package/build/components/status/style.module.scss +0 -82
  76. package/build/components/toggle-control/index.d.ts +0 -23
  77. package/build/components/toggle-control/index.js +0 -21
  78. package/build/components/toggle-control/styles.module.scss +0 -24
  79. package/components/alert/index.tsx +0 -60
  80. package/components/alert/style.module.scss +0 -47
  81. package/components/chip/README.md +0 -21
  82. package/components/chip/index.tsx +0 -25
  83. package/components/chip/style.module.scss +0 -14
  84. package/components/contextual-upgrade-trigger/README.md +0 -81
  85. package/components/contextual-upgrade-trigger/index.tsx +0 -59
  86. package/components/contextual-upgrade-trigger/style.module.scss +0 -77
  87. package/components/contextual-upgrade-trigger/types.ts +0 -9
  88. package/components/dialog/index.tsx +0 -70
  89. package/components/dialog/style.module.scss +0 -31
  90. package/components/jetpack-protect-logo/README.md +0 -20
  91. package/components/jetpack-protect-logo/index.tsx +0 -60
  92. package/components/jetpack-protect-logo/types.ts +0 -7
  93. package/components/jetpack-search-logo/README.md +0 -20
  94. package/components/jetpack-search-logo/index.tsx +0 -93
  95. package/components/jetpack-search-logo/types.ts +0 -7
  96. package/components/jetpack-videopress-logo/README.md +0 -19
  97. package/components/jetpack-videopress-logo/index.tsx +0 -95
  98. package/components/jetpack-videopress-logo/types.tsx +0 -6
  99. package/components/product-offer/icons-card.tsx +0 -48
  100. package/components/product-offer/index.tsx +0 -115
  101. package/components/product-offer/product-offer-header.tsx +0 -23
  102. package/components/product-offer/style.module.scss +0 -93
  103. package/components/product-offer/types.ts +0 -126
  104. package/components/radio-control/README.md +0 -5
  105. package/components/radio-control/index.tsx +0 -55
  106. package/components/split-button/index.tsx +0 -48
  107. package/components/split-button/style.module.scss +0 -26
  108. package/components/split-button/types.ts +0 -12
  109. package/components/status/README.md +0 -42
  110. package/components/status/index.tsx +0 -52
  111. package/components/status/style.module.scss +0 -82
  112. package/components/toggle-control/README.md +0 -5
  113. package/components/toggle-control/index.tsx +0 -80
  114. package/components/toggle-control/styles.module.scss +0 -24
@@ -1,42 +0,0 @@
1
- = Status
2
-
3
- A simple component to display a status indicator.
4
-
5
- ## Usage
6
-
7
- ```jsx
8
- import { Status } from '@automattic/jetpack-components';
9
-
10
- function MyComponent() {
11
- return (
12
- <>
13
- { /* Default status is "inactive". */}
14
- <Status />
15
-
16
- { /* You can also pass a status prop to display a different status. */}
17
- <Status status="active" />
18
-
19
- { /* You can also pass a label prop to display a label beside the status indicator. */}
20
- <Status status="error" label="Connection Error" />
21
- </>
22
- );
23
- }
24
- ```
25
-
26
- ## Props
27
-
28
- ### status
29
-
30
- Optional. The status to display. It can be one of the following:
31
-
32
- - `active`
33
- - `inactive`
34
- - `error`
35
-
36
- Defaults to `inactive`.
37
-
38
- ### label
39
-
40
- Optional. The label to display beside the status indicator.
41
-
42
- If none is provided, the name of the status will be used by default (i.e. "Active"). Pass an empty string to hide the label.
@@ -1,52 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import clsx from 'clsx';
3
- import Text from '../text/index.tsx';
4
- import styles from './style.module.scss';
5
- import type { JSX } from 'react';
6
-
7
- export interface StatusProps {
8
- status?: 'active' | 'error' | 'inactive' | 'action' | 'initializing';
9
- label?: string;
10
- className?: string;
11
- }
12
-
13
- /**
14
- * Status component.
15
- *
16
- * @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).
17
- *
18
- * @param {StatusProps} props - The component properties.
19
- * @param {string} props.className - Optional className forwarded to the outer element.
20
- * @param {string} props.label - Status label. Defaults to a status-derived string.
21
- * @param {string} props.status - Status key: `active | error | inactive | action | initializing`.
22
- * @return {JSX.Element} The `Status` component.
23
- */
24
- const Status = ( { className, label, status = 'inactive' }: StatusProps ): JSX.Element => {
25
- const defaultLabels: Record< string, string > = {
26
- active: __( 'Active', 'jetpack-components' ),
27
- error: __( 'Error', 'jetpack-components' ),
28
- action: __( 'Action needed', 'jetpack-components' ),
29
- inactive: __( 'Inactive', 'jetpack-components' ),
30
- initializing: __( 'Setting up', 'jetpack-components' ),
31
- };
32
-
33
- return (
34
- <Text
35
- variant="body-extra-small"
36
- className={ clsx(
37
- styles.status,
38
- {
39
- [ styles[ `is-${ status }` ] ]: status,
40
- },
41
- className
42
- ) }
43
- >
44
- <span className={ styles.status__indicator } />
45
- <span className={ styles.status__label }>
46
- { label || label === '' ? label : defaultLabels[ status ] }
47
- </span>
48
- </Text>
49
- );
50
- };
51
-
52
- 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,5 +0,0 @@
1
- # Toggle Control
2
-
3
- A wrapper component for applying Jetpack Emerald styles to the [ToggleControl](https://github.com/WordPress/gutenberg/tree/trunk/packages/components/src/form-toggle) component from `@wordpress/components`.
4
-
5
- The documentation for the base `ToggleControl` component can be found via the [Gutenberg Handbook](https://developer.wordpress.org/block-editor/components/toggle-control/).
@@ -1,80 +0,0 @@
1
- import { ToggleControl as WPToggleControl } from '@wordpress/components';
2
- import clsx from 'clsx';
3
- import { useCallback } from 'react';
4
- import styles from './styles.module.scss';
5
- import type { FC, ReactNode } from 'react';
6
-
7
- export interface ToggleControlProps {
8
- /** Whether or not the toggle is currently enabled. */
9
- checked?: boolean;
10
-
11
- /** Custom class name to append to the component. */
12
- className?: string;
13
-
14
- /** Whether or not the toggle is currently disabled. */
15
- disabled?: boolean;
16
-
17
- /** Additional information to display below the toggle. */
18
- help?: ReactNode;
19
-
20
- /** Whether or not the toggling is currently toggling. */
21
- toggling?: boolean;
22
-
23
- /** The label for the toggle. */
24
- label?: ReactNode;
25
-
26
- /** Accessible name for the underlying checkbox. Use when no visible `label` is rendered. */
27
- 'aria-label'?: string;
28
-
29
- /** The size of the toggle. */
30
- size?: 'small' | 'normal';
31
-
32
- /** A callback function invoked when the toggle is clicked. */
33
- onChange: ( value: boolean ) => void;
34
- }
35
-
36
- const ToggleControl: FC< ToggleControlProps > = ( {
37
- checked,
38
- className,
39
- disabled,
40
- help,
41
- toggling,
42
- label,
43
- 'aria-label': ariaLabel,
44
- size = 'normal',
45
- onChange,
46
- } ) => {
47
- const showChecked =
48
- toggling !== undefined ? ( checked && ! toggling ) || ( ! checked && toggling ) : checked;
49
-
50
- const handleOnChange = useCallback(
51
- ( value: boolean ) => {
52
- // Don't toggle if the toggle is already toggling.
53
- if ( toggling ) {
54
- return;
55
- }
56
-
57
- onChange( value );
58
- },
59
- [ toggling, onChange ]
60
- );
61
-
62
- return (
63
- <WPToggleControl
64
- __nextHasNoMarginBottom={ true }
65
- checked={ showChecked }
66
- className={ clsx( styles.toggle, className, {
67
- [ styles[ 'is-toggling' ] ]: toggling,
68
- [ styles[ 'is-small' ] ]: size === 'small',
69
- [ styles[ 'no-label' ] ]: ! label,
70
- } ) }
71
- disabled={ disabled }
72
- help={ help }
73
- label={ label }
74
- aria-label={ ariaLabel }
75
- onChange={ handleOnChange }
76
- />
77
- );
78
- };
79
-
80
- 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
- }