@automattic/jetpack-components 1.12.16 → 2.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 (67) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/components/action-popover/index.js +1 -5
  3. package/build/components/alert/index.js +1 -2
  4. package/build/components/automattic-byline-logo/index.js +1 -3
  5. package/build/components/automattic-for-agencies-logo/index.d.ts +1 -1
  6. package/build/components/automattic-icon-logo/index.d.ts +1 -1
  7. package/build/components/automattic-icon-logo/index.js +1 -3
  8. package/build/components/boost-score-bar/index.js +1 -6
  9. package/build/components/boost-score-graph/background.js +1 -13
  10. package/build/components/boost-score-graph/tooltip.js +3 -23
  11. package/build/components/button/index.js +2 -4
  12. package/build/components/contextual-upgrade-trigger/index.js +1 -6
  13. package/build/components/decorative-card/index.js +1 -2
  14. package/build/components/details-viewer/index.js +2 -4
  15. package/build/components/dialog/index.js +1 -3
  16. package/build/components/diff-viewer/index.js +4 -10
  17. package/build/components/donut-meter/index.js +2 -4
  18. package/build/components/dot-pager/index.js +1 -3
  19. package/build/components/gravatar/index.d.ts +1 -1
  20. package/build/components/icon-tooltip/index.js +1 -3
  21. package/build/components/icons/index.js +4 -12
  22. package/build/components/jetpack-footer/index.js +2 -6
  23. package/build/components/jetpack-footer/style.scss +1 -0
  24. package/build/components/jetpack-logo/index.js +1 -4
  25. package/build/components/jetpack-protect-logo/index.js +1 -4
  26. package/build/components/jetpack-search-logo/index.js +1 -5
  27. package/build/components/jetpack-vaultpress-backup-logo/index.js +1 -6
  28. package/build/components/jetpack-videopress-logo/index.js +1 -4
  29. package/build/components/loading-placeholder/index.d.ts +1 -1
  30. package/build/components/marked-lines/index.js +2 -4
  31. package/build/components/navigator-modal/footer.js +1 -2
  32. package/build/components/navigator-modal/header.d.ts +1 -1
  33. package/build/components/navigator-modal/header.js +1 -3
  34. package/build/components/navigator-modal/screen.js +1 -3
  35. package/build/components/notice/index.js +1 -2
  36. package/build/components/popover/index.js +1 -3
  37. package/build/components/pricing-card/index.js +1 -7
  38. package/build/components/pricing-table/index.js +10 -18
  39. package/build/components/pricing-table/types.d.ts +8 -0
  40. package/build/components/product-offer/icons-card.js +1 -2
  41. package/build/components/product-offer/index.js +1 -6
  42. package/build/components/product-offer/product-offer-header.js +1 -3
  43. package/build/components/product-price/index.js +3 -11
  44. package/build/components/product-price/price.js +1 -2
  45. package/build/components/record-meter-bar/index.js +5 -20
  46. package/build/components/split-button/index.js +1 -3
  47. package/build/components/stat-card/index.js +1 -4
  48. package/build/components/status/index.js +1 -3
  49. package/build/components/swipeable/index.js +3 -7
  50. package/build/components/testimonials/testimonial.js +1 -11
  51. package/build/components/text/constants.d.ts +12 -12
  52. package/build/components/upsell-banner/index.js +2 -7
  53. package/build/index.d.ts +0 -1
  54. package/build/index.js +0 -1
  55. package/components/jetpack-footer/style.scss +1 -0
  56. package/components/pricing-table/index.tsx +5 -4
  57. package/components/pricing-table/types.ts +9 -0
  58. package/index.ts +0 -1
  59. package/package.json +17 -19
  60. package/build/components/number-slider/index.d.ts +0 -12
  61. package/build/components/number-slider/index.js +0 -43
  62. package/build/components/number-slider/style.scss +0 -68
  63. package/build/components/number-slider/types.d.ts +0 -50
  64. package/build/components/number-slider/types.js +0 -1
  65. package/components/number-slider/index.tsx +0 -86
  66. package/components/number-slider/style.scss +0 -68
  67. package/components/number-slider/types.ts +0 -58
@@ -1,68 +0,0 @@
1
- @use "@automattic/jetpack-base-styles/style";
2
-
3
- $thumb-height: 40px;
4
- $track-height: 8px;
5
-
6
- @mixin adjust-track-rail-styles {
7
- height: $track-height;
8
- border-radius: 8px;
9
- }
10
-
11
- // On holding thumb styling
12
- .jp-components-number-slider--is-holding {
13
-
14
- .jp-components-number-slider__thumb {
15
- box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 3px rgba(6, 158, 8, 0.25);
16
- }
17
- }
18
-
19
- // Base styles
20
- .jp-components-number-slider__control {
21
- width: 100%;
22
- height: $thumb-height;
23
- }
24
-
25
- .jp-components-number-slider__track {
26
-
27
- @include adjust-track-rail-styles;
28
- top: calc(($thumb-height / 2) - ($track-height / 2));
29
- background: var(--jp-gray);
30
-
31
- &.jp-components-number-slider__track-0 {
32
- background: var(--jp-green-40);
33
- }
34
-
35
- &.jp-components-number-slider__track-1 {
36
- background: var(--jp-gray);
37
- }
38
- }
39
-
40
- .jp-components-number-slider__thumb {
41
- display: flex;
42
- align-items: center;
43
- justify-content: center;
44
- padding: 8px 16px;
45
- height: $thumb-height;
46
- background-color: var(--jp-white);
47
- border: 1.5px solid var(--jp-green-50);
48
- box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
49
- border-radius: 4px;
50
- color: var(--jp-black);
51
- font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
52
- font-style: normal;
53
- font-weight: 600;
54
- font-size: var(--font-body);
55
- line-height: 24px;
56
- letter-spacing: -0.02em;
57
- white-space: nowrap;
58
- cursor: pointer;
59
-
60
- // On focus thumb styling
61
- &.jp-components-number-slider__thumb--is-active {
62
- outline: none;
63
- }
64
-
65
- &[aria-valuenow="0"] {
66
- border-color: var(--jp-gray);
67
- }
68
- }
@@ -1,50 +0,0 @@
1
- import type { HTMLProps, RefCallback, JSX } from 'react';
2
- interface HTMLPropsWithRefCallback<T> extends HTMLProps<T> {
3
- ref: RefCallback<T>;
4
- }
5
- export type NumberSliderProps = {
6
- /**
7
- * The wrapper class name of this NumberSlider component.
8
- */
9
- className?: string;
10
- /**
11
- * The maximum value of the slider.
12
- */
13
- maxValue?: number;
14
- /**
15
- * The minimum value of the slider.
16
- */
17
- minValue?: number;
18
- /**
19
- * The initial value of the slider.
20
- */
21
- value?: number;
22
- /**
23
- * The step value of the slider.
24
- */
25
- step?: number;
26
- /**
27
- * Callback called on every value change.
28
- * The function will be called with two arguments, the first being the new value(s) the second being thumb index.
29
- */
30
- onChange?: (value: number) => void;
31
- /**
32
- * Callback called before starting to move a thumb. The callback will only be called if the action will result in a change.
33
- * The function will be called with two arguments, the first being the initial value(s) the second being thumb index.
34
- */
35
- onBeforeChange?: (value: number) => void;
36
- /**
37
- * Callback called only after moving a thumb has ended. The callback will only be called if the action resulted in a change.
38
- * The function will be called with two arguments, the first being the result value(s) the second being thumb index.
39
- */
40
- onAfterChange?: (value: number) => void;
41
- /**
42
- * Node to render on the slider.
43
- */
44
- renderThumb?: (props: HTMLPropsWithRefCallback<HTMLDivElement>, state: {
45
- index: number;
46
- value: number | ReadonlyArray<number>;
47
- valueNow: number;
48
- }) => JSX.Element | null;
49
- };
50
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,86 +0,0 @@
1
- import clsx from 'clsx';
2
- import { useState } from 'react';
3
- import ReactSlider, { ReactSliderProps } from 'react-slider';
4
- import { NumberSliderProps } from './types.ts';
5
- import type { ComponentType, FC, ReactElement } from 'react';
6
- import './style.scss';
7
-
8
- /**
9
- * Generate Number Slider
10
- * More support from the original ReactSlider component: https://zillow.github.io/react-slider/
11
- *
12
- * @param {NumberSliderProps} props - Props
13
- * @return {ReactElement} - JSX element
14
- */
15
- const NumberSlider: FC< NumberSliderProps > = ( {
16
- className,
17
- maxValue = 100,
18
- minValue = 0,
19
- step = 1,
20
- value,
21
- onChange,
22
- onBeforeChange,
23
- onAfterChange,
24
- renderThumb,
25
- } ) => {
26
- const [ isThumbHolding, setIsThumbHolding ] = useState( false );
27
-
28
- const componentClassName = clsx( 'jp-components-number-slider', className, {
29
- 'jp-components-number-slider--is-holding': isThumbHolding,
30
- } );
31
-
32
- const onBeforeChangeCallback = beforeValue => {
33
- setIsThumbHolding( true );
34
-
35
- if ( typeof onBeforeChange === 'function' ) {
36
- onBeforeChange( beforeValue );
37
- }
38
- };
39
-
40
- const onAfterChangeCallback = afterValue => {
41
- setIsThumbHolding( false );
42
-
43
- if ( typeof onAfterChange === 'function' ) {
44
- onAfterChange( afterValue );
45
- }
46
- };
47
-
48
- const renderThumbCallback = renderThumb
49
- ? renderThumb
50
- : ( props, state ) => {
51
- const { key, ...otherProps } = props;
52
-
53
- return (
54
- <div key={ key } { ...otherProps }>
55
- { state.valueNow }
56
- </div>
57
- );
58
- };
59
-
60
- /**
61
- * Type casting to prevent TypeScript error:
62
- * TS2604: JSX element type 'ReactSlider' does not have any construct or call signatures.
63
- */
64
- const TypedReactSlider = ReactSlider as unknown as ComponentType< ReactSliderProps >;
65
-
66
- return (
67
- <div className={ componentClassName } data-testid="number-slider">
68
- <TypedReactSlider
69
- className="jp-components-number-slider__control"
70
- thumbClassName="jp-components-number-slider__thumb"
71
- thumbActiveClassName="jp-components-number-slider__thumb--is-active"
72
- trackClassName="jp-components-number-slider__track"
73
- value={ value }
74
- max={ maxValue }
75
- min={ minValue }
76
- step={ step }
77
- renderThumb={ renderThumbCallback } // eslint-disable-line react/jsx-no-bind
78
- onChange={ onChange }
79
- onBeforeChange={ onBeforeChangeCallback } // eslint-disable-line react/jsx-no-bind
80
- onAfterChange={ onAfterChangeCallback } // eslint-disable-line react/jsx-no-bind
81
- />
82
- </div>
83
- );
84
- };
85
-
86
- export default NumberSlider;
@@ -1,68 +0,0 @@
1
- @use "@automattic/jetpack-base-styles/style";
2
-
3
- $thumb-height: 40px;
4
- $track-height: 8px;
5
-
6
- @mixin adjust-track-rail-styles {
7
- height: $track-height;
8
- border-radius: 8px;
9
- }
10
-
11
- // On holding thumb styling
12
- .jp-components-number-slider--is-holding {
13
-
14
- .jp-components-number-slider__thumb {
15
- box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 3px rgba(6, 158, 8, 0.25);
16
- }
17
- }
18
-
19
- // Base styles
20
- .jp-components-number-slider__control {
21
- width: 100%;
22
- height: $thumb-height;
23
- }
24
-
25
- .jp-components-number-slider__track {
26
-
27
- @include adjust-track-rail-styles;
28
- top: calc(($thumb-height / 2) - ($track-height / 2));
29
- background: var(--jp-gray);
30
-
31
- &.jp-components-number-slider__track-0 {
32
- background: var(--jp-green-40);
33
- }
34
-
35
- &.jp-components-number-slider__track-1 {
36
- background: var(--jp-gray);
37
- }
38
- }
39
-
40
- .jp-components-number-slider__thumb {
41
- display: flex;
42
- align-items: center;
43
- justify-content: center;
44
- padding: 8px 16px;
45
- height: $thumb-height;
46
- background-color: var(--jp-white);
47
- border: 1.5px solid var(--jp-green-50);
48
- box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
49
- border-radius: 4px;
50
- color: var(--jp-black);
51
- font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
52
- font-style: normal;
53
- font-weight: 600;
54
- font-size: var(--font-body);
55
- line-height: 24px;
56
- letter-spacing: -0.02em;
57
- white-space: nowrap;
58
- cursor: pointer;
59
-
60
- // On focus thumb styling
61
- &.jp-components-number-slider__thumb--is-active {
62
- outline: none;
63
- }
64
-
65
- &[aria-valuenow="0"] {
66
- border-color: var(--jp-gray);
67
- }
68
- }
@@ -1,58 +0,0 @@
1
- import type { HTMLProps, RefCallback, JSX } from 'react';
2
-
3
- interface HTMLPropsWithRefCallback< T > extends HTMLProps< T > {
4
- ref: RefCallback< T >;
5
- }
6
-
7
- export type NumberSliderProps = {
8
- /**
9
- * The wrapper class name of this NumberSlider component.
10
- */
11
- className?: string;
12
-
13
- /**
14
- * The maximum value of the slider.
15
- */
16
- maxValue?: number;
17
-
18
- /**
19
- * The minimum value of the slider.
20
- */
21
- minValue?: number;
22
-
23
- /**
24
- * The initial value of the slider.
25
- */
26
- value?: number;
27
-
28
- /**
29
- * The step value of the slider.
30
- */
31
- step?: number;
32
-
33
- /**
34
- * Callback called on every value change.
35
- * The function will be called with two arguments, the first being the new value(s) the second being thumb index.
36
- */
37
- onChange?: ( value: number ) => void;
38
-
39
- /**
40
- * Callback called before starting to move a thumb. The callback will only be called if the action will result in a change.
41
- * The function will be called with two arguments, the first being the initial value(s) the second being thumb index.
42
- */
43
- onBeforeChange?: ( value: number ) => void;
44
-
45
- /**
46
- * Callback called only after moving a thumb has ended. The callback will only be called if the action resulted in a change.
47
- * The function will be called with two arguments, the first being the result value(s) the second being thumb index.
48
- */
49
- onAfterChange?: ( value: number ) => void;
50
-
51
- /**
52
- * Node to render on the slider.
53
- */
54
- renderThumb?: (
55
- props: HTMLPropsWithRefCallback< HTMLDivElement >,
56
- state: { index: number; value: number | ReadonlyArray< number >; valueNow: number }
57
- ) => JSX.Element | null;
58
- };