@automattic/jetpack-components 2.3.0 → 3.0.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/build/components/admin-page/style.module.scss +3 -3
  3. package/build/index.d.ts +0 -12
  4. package/build/index.js +0 -12
  5. package/components/admin-page/style.module.scss +3 -3
  6. package/index.ts +0 -12
  7. package/package.json +16 -16
  8. package/build/components/alert/index.d.ts +0 -23
  9. package/build/components/alert/index.js +0 -33
  10. package/build/components/alert/style.module.scss +0 -47
  11. package/build/components/chip/index.d.ts +0 -17
  12. package/build/components/chip/index.js +0 -18
  13. package/build/components/chip/style.module.scss +0 -14
  14. package/build/components/contextual-upgrade-trigger/index.d.ts +0 -19
  15. package/build/components/contextual-upgrade-trigger/index.js +0 -27
  16. package/build/components/contextual-upgrade-trigger/style.module.scss +0 -77
  17. package/build/components/contextual-upgrade-trigger/types.d.ts +0 -9
  18. package/build/components/contextual-upgrade-trigger/types.js +0 -1
  19. package/build/components/dialog/index.d.ts +0 -20
  20. package/build/components/dialog/index.js +0 -32
  21. package/build/components/dialog/style.module.scss +0 -31
  22. package/build/components/jetpack-protect-logo/index.d.ts +0 -4
  23. package/build/components/jetpack-protect-logo/index.js +0 -10
  24. package/build/components/jetpack-protect-logo/types.d.ts +0 -7
  25. package/build/components/jetpack-protect-logo/types.js +0 -1
  26. package/build/components/jetpack-search-logo/index.d.ts +0 -4
  27. package/build/components/jetpack-search-logo/index.js +0 -7
  28. package/build/components/jetpack-search-logo/types.d.ts +0 -7
  29. package/build/components/jetpack-search-logo/types.js +0 -1
  30. package/build/components/jetpack-videopress-logo/index.d.ts +0 -4
  31. package/build/components/jetpack-videopress-logo/index.js +0 -8
  32. package/build/components/jetpack-videopress-logo/types.d.ts +0 -6
  33. package/build/components/jetpack-videopress-logo/types.js +0 -1
  34. package/build/components/product-offer/icons-card.d.ts +0 -10
  35. package/build/components/product-offer/icons-card.js +0 -23
  36. package/build/components/product-offer/index.d.ts +0 -11
  37. package/build/components/product-offer/index.js +0 -31
  38. package/build/components/product-offer/product-offer-header.d.ts +0 -9
  39. package/build/components/product-offer/product-offer-header.js +0 -14
  40. package/build/components/product-offer/style.module.scss +0 -93
  41. package/build/components/product-offer/types.d.ts +0 -102
  42. package/build/components/product-offer/types.js +0 -1
  43. package/build/components/radio-control/index.d.ts +0 -24
  44. package/build/components/radio-control/index.js +0 -7
  45. package/build/components/split-button/index.d.ts +0 -4
  46. package/build/components/split-button/index.js +0 -14
  47. package/build/components/split-button/style.module.scss +0 -26
  48. package/build/components/split-button/types.d.ts +0 -5
  49. package/build/components/split-button/types.js +0 -1
  50. package/build/components/status/index.d.ts +0 -19
  51. package/build/components/status/index.js +0 -29
  52. package/build/components/status/style.module.scss +0 -82
  53. package/build/components/toggle-control/index.d.ts +0 -23
  54. package/build/components/toggle-control/index.js +0 -21
  55. package/build/components/toggle-control/styles.module.scss +0 -24
  56. package/components/alert/index.tsx +0 -60
  57. package/components/alert/style.module.scss +0 -47
  58. package/components/chip/README.md +0 -21
  59. package/components/chip/index.tsx +0 -25
  60. package/components/chip/style.module.scss +0 -14
  61. package/components/contextual-upgrade-trigger/README.md +0 -81
  62. package/components/contextual-upgrade-trigger/index.tsx +0 -59
  63. package/components/contextual-upgrade-trigger/style.module.scss +0 -77
  64. package/components/contextual-upgrade-trigger/types.ts +0 -9
  65. package/components/dialog/index.tsx +0 -70
  66. package/components/dialog/style.module.scss +0 -31
  67. package/components/jetpack-protect-logo/README.md +0 -20
  68. package/components/jetpack-protect-logo/index.tsx +0 -60
  69. package/components/jetpack-protect-logo/types.ts +0 -7
  70. package/components/jetpack-search-logo/README.md +0 -20
  71. package/components/jetpack-search-logo/index.tsx +0 -93
  72. package/components/jetpack-search-logo/types.ts +0 -7
  73. package/components/jetpack-videopress-logo/README.md +0 -19
  74. package/components/jetpack-videopress-logo/index.tsx +0 -95
  75. package/components/jetpack-videopress-logo/types.tsx +0 -6
  76. package/components/product-offer/icons-card.tsx +0 -48
  77. package/components/product-offer/index.tsx +0 -115
  78. package/components/product-offer/product-offer-header.tsx +0 -23
  79. package/components/product-offer/style.module.scss +0 -93
  80. package/components/product-offer/types.ts +0 -126
  81. package/components/radio-control/README.md +0 -5
  82. package/components/radio-control/index.tsx +0 -55
  83. package/components/split-button/index.tsx +0 -48
  84. package/components/split-button/style.module.scss +0 -26
  85. package/components/split-button/types.ts +0 -12
  86. package/components/status/README.md +0 -42
  87. package/components/status/index.tsx +0 -52
  88. package/components/status/style.module.scss +0 -82
  89. package/components/toggle-control/README.md +0 -5
  90. package/components/toggle-control/index.tsx +0 -80
  91. package/components/toggle-control/styles.module.scss +0 -24
@@ -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
- }
@@ -1,81 +0,0 @@
1
- # Contextual Upgrade Trigger
2
-
3
- The CUT component is designed to push users to upgrade from a Free plan to a Paid one, or from lower tier paid plans to higher ones.
4
-
5
- **Design Specs for Contextual Upgrade Trigger:** PbJqbW-5k-p2
6
-
7
- [ Storybook Reference ](https://automattic.github.io/jetpack-storybook/?path=/story/js-packages-components-contextual-upgrade-trigger--default)
8
-
9
- ## Usage
10
-
11
- ```jsx
12
- import { ContextualUpgradeTrigger } from '@automattic/jetpack-components';
13
-
14
- <ContextualUpgradeTrigger
15
- description="Current status of the product"
16
- cta="Text action line, recommending the next tier"
17
- onClick={ () => ... }
18
- />
19
- ```
20
-
21
- To use as a link:
22
-
23
- ```jsx
24
- import { ContextualUpgradeTrigger } from '@automattic/jetpack-components';
25
-
26
- <ContextualUpgradeTrigger
27
- description="Current status of the product"
28
- cta="Text action line, recommending the next tier"
29
- href="https://jetpack.com"
30
- />
31
- ```
32
-
33
- ## Props
34
-
35
- ### className
36
-
37
- A custom class to append with the default ones.
38
-
39
- - Type: `String`
40
- - Default: `undefined`
41
- - Required: `false`
42
-
43
- ### description
44
-
45
- A text giving context for a user about the current status of the product (i.e., how many updates per day).
46
-
47
- - Type: `String`
48
- - Default: `""`
49
- - Required: `true`
50
-
51
- ### cta
52
-
53
- Text action line, recommending the next tier
54
-
55
- - Type: `String`
56
- - Default: `""`
57
- - Required: `true`
58
-
59
- ### onClick
60
-
61
- Callback that will be called when the user click/tap into the CUT
62
-
63
- - Type: `Function`
64
- - Default: `undefined`
65
- - Required: `false`
66
-
67
- ### href
68
-
69
- URL to link to
70
-
71
- - Type: `String`
72
- - Default: `undefined`
73
- - Required: `false`
74
-
75
- ### openInNewTab
76
-
77
- Indicate if the link should open in a new tab
78
-
79
- - Type: `Boolean`
80
- - Default: `false`
81
- - Required: `false`
@@ -1,59 +0,0 @@
1
- import { Icon, arrowRight } from '@wordpress/icons';
2
- import clsx from 'clsx';
3
- import IconTooltip from '../icon-tooltip/index.tsx';
4
- import Text from '../text/index.tsx';
5
- import styles from './style.module.scss';
6
- import { CutBaseProps } from './types.ts';
7
- import type { FC } from 'react';
8
-
9
- /**
10
- * ContextualUpgradeTrigger component.
11
- *
12
- * @deprecated Use `Notice` from `@wordpress/ui` instead. Compose with `Notice.Root` (`intent="info"`), `Notice.Description` for the body, and `Notice.Actions` + `Notice.ActionLink` / `Notice.ActionButton` for the CTA. See https://github.com/Automattic/jetpack/issues/48160 for migration guidance.
13
- *
14
- * @param props - The component properties.
15
- * @param props.description - The body copy describing the upgrade context.
16
- * @param props.cta - The CTA label.
17
- * @param props.onClick - Click handler when rendered as a button.
18
- * @param props.href - When provided, renders as an anchor instead of a button.
19
- * @param props.openInNewTab - Whether to open the link in a new tab.
20
- * @param props.className - Optional class for the root element.
21
- * @param props.tooltipText - Optional tooltip body shown next to the description.
22
- * @return The rendered upgrade trigger.
23
- */
24
- const ContextualUpgradeTrigger: FC< CutBaseProps > = ( {
25
- description,
26
- cta,
27
- onClick,
28
- href,
29
- openInNewTab = false,
30
- className,
31
- tooltipText = '',
32
- } ) => {
33
- const Tag = href !== undefined ? 'a' : 'button';
34
- const tagProps =
35
- Tag === 'a' ? { href, ...( openInNewTab && { target: '_blank' } ) } : { onClick };
36
-
37
- return (
38
- <div className={ clsx( styles.cut, className ) }>
39
- <div>
40
- <div>
41
- <Text className={ styles.description }>{ description }</Text>
42
- { tooltipText && (
43
- <IconTooltip className={ styles.iconContainer } iconSize={ 16 } offset={ 4 }>
44
- <Text variant="body-small">{ tooltipText }</Text>
45
- </IconTooltip>
46
- ) }
47
- </div>
48
- <div>
49
- <Tag { ...tagProps }>
50
- <Text className={ styles.cta }>{ cta }</Text>
51
- </Tag>
52
- </div>
53
- </div>
54
- <Icon icon={ arrowRight } className={ styles.icon } size={ 30 } />
55
- </div>
56
- );
57
- };
58
-
59
- export default ContextualUpgradeTrigger;
@@ -1,77 +0,0 @@
1
- .cut {
2
- border: 2px solid var(--jp-green-40);
3
- border-radius: var(--jp-border-radius);
4
- padding: calc(var(--spacing-base) * 2) calc(var(--spacing-base) * 3);
5
- display: flex;
6
- justify-content: space-between;
7
- align-items: center;
8
- gap: calc(var(--spacing-base) * 3);
9
- text-align: left;
10
- background: none;
11
- width: 100%;
12
- position: relative;
13
- color: var(--jp-gray-80);
14
-
15
- button,
16
- a {
17
- all: unset;
18
- color: var(--jp-gray-80);
19
- cursor: pointer;
20
-
21
- &::after {
22
- content: "";
23
- position: absolute;
24
- top: 0;
25
- left: 0;
26
- width: 100%;
27
- height: 100%;
28
- }
29
- }
30
-
31
- &:focus-within {
32
- border-color: var(--jp-black);
33
- }
34
-
35
- &:focus-within,
36
- &:hover {
37
-
38
- .icon {
39
- transform: translateX(calc(var(--spacing-base) * 2));
40
- }
41
-
42
- .cta {
43
- text-decoration: underline;
44
- text-decoration-thickness: 2px;
45
- }
46
- }
47
-
48
- // Overwrite styles in Text component
49
- .cta {
50
- font-weight: 700;
51
- }
52
- }
53
-
54
- .cta {
55
- font-weight: 700;
56
- }
57
-
58
- .icon {
59
- fill: var(--jp-green-40);
60
- transition: transform 0.1s ease-out;
61
- pointer-events: none;
62
- }
63
-
64
- .iconContainer {
65
- margin: 0 0 0 calc(var(--spacing-base) / 3);
66
- display: inline;
67
- vertical-align: middle;
68
-
69
- svg {
70
- z-index: 10;
71
- position: relative;
72
- }
73
- }
74
-
75
- .description {
76
- display: inline;
77
- }
@@ -1,9 +0,0 @@
1
- export type CutBaseProps = {
2
- description: string;
3
- cta: string;
4
- className?: string;
5
- href?: string;
6
- openInNewTab?: boolean;
7
- onClick?: () => void;
8
- tooltipText?: string;
9
- };
@@ -1,70 +0,0 @@
1
- import { useViewportMatch } from '@wordpress/compose';
2
- import clsx from 'clsx';
3
- import Col from '../layout/col/index.tsx';
4
- import Container from '../layout/container/index.tsx';
5
- import styles from './style.module.scss';
6
- import type { ReactNode, FC } from 'react';
7
-
8
- type DialogProps = {
9
- primary: ReactNode;
10
- secondary?: ReactNode;
11
- isTwoSections?: boolean;
12
- isCard?: boolean;
13
- containerProps: object;
14
- };
15
-
16
- /**
17
- * Dialog component.
18
- *
19
- * @param {object} props - React component props.
20
- * @param {ReactNode} props.primary - Primary-section content.
21
- * @param {ReactNode} props.secondary - Secondary-section content.
22
- * @param {boolean} props.isTwoSections - Handle two sections layout when true.
23
- * @param {object} props.containerProps - Props to pass to the container component.
24
- * @return {ReactNode} Rendered dialog
25
- */
26
- const Dialog: FC< DialogProps > = ( {
27
- primary,
28
- secondary,
29
- isTwoSections = false,
30
- ...containerProps
31
- } ) => {
32
- const isSmall = useViewportMatch( 'small', '<' );
33
- const isLowerThanLarge = useViewportMatch( 'large', '<' );
34
-
35
- /*
36
- * By convention, secondary section is not shown when:
37
- * - layout is a two-sections setup
38
- * - on mobile breakpoint (sm)
39
- */
40
- const hideSecondarySection = ! isTwoSections && isSmall;
41
-
42
- const classNames = clsx( {
43
- [ styles[ 'one-section-style' ] ]: ! isTwoSections,
44
- [ styles[ 'is-viewport-small' ] ]: isSmall,
45
- } );
46
-
47
- return (
48
- <Container
49
- className={ classNames }
50
- horizontalSpacing={ 0 }
51
- horizontalGap={ 0 }
52
- fluid={ false }
53
- { ...containerProps }
54
- >
55
- { ! hideSecondarySection && (
56
- <>
57
- <Col sm={ 4 } md={ isLowerThanLarge ? 4 : 5 } lg={ 7 } className={ styles.primary }>
58
- { primary }
59
- </Col>
60
- <Col sm={ 4 } md={ isLowerThanLarge ? 4 : 3 } lg={ 5 } className={ styles.secondary }>
61
- { secondary }
62
- </Col>
63
- </>
64
- ) }
65
- { hideSecondarySection && <Col>{ primary }</Col> }
66
- </Container>
67
- );
68
- };
69
-
70
- export default Dialog;
@@ -1,31 +0,0 @@
1
- .one-section-style {
2
- --product-card-shadow: rgb(0 0 0 / 3%);
3
- background-color: var(--jp-white);
4
- border: 1px solid var(--jp-gray);
5
- border-radius: var(--jp-border-radius);
6
- box-shadow: 0 2px 6px var(--product-card-shadow), 0 1px 2px var(--product-card-shadow);
7
- }
8
-
9
- .primary,
10
- .secondary {
11
- display: flex;
12
- }
13
-
14
- // Fit images in secondary section.
15
- .secondary {
16
- align-items: center;
17
-
18
- img {
19
- // let's fit images
20
- object-fit: cover;
21
- width: 100%;
22
- }
23
- }
24
-
25
- // Viewport breakpoints.
26
- .is-viewport-small {
27
- // Add spacing between primary and secondary in "sm" viewport size
28
- .primary {
29
- margin-bottom: calc(var(--spacing-base) * 3);
30
- }
31
- }