@automattic/jetpack-components 0.68.2 → 0.69.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 (257) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/components/action-button/index.d.ts +25 -0
  3. package/build/components/action-button/index.js +48 -0
  4. package/build/components/action-popover/index.d.ts +6 -0
  5. package/build/components/action-popover/index.js +38 -0
  6. package/build/components/action-popover/types.d.ts +20 -0
  7. package/build/components/action-popover/types.js +1 -0
  8. package/build/components/admin-page/index.d.ts +12 -0
  9. package/build/components/admin-page/index.js +44 -0
  10. package/build/components/admin-page/types.d.ts +56 -0
  11. package/build/components/admin-page/types.js +1 -0
  12. package/build/components/admin-section/basic/index.d.ts +10 -0
  13. package/build/components/admin-section/basic/index.js +12 -0
  14. package/build/components/admin-section/hero/index.d.ts +10 -0
  15. package/build/components/admin-section/hero/index.js +12 -0
  16. package/build/components/admin-section/types.d.ts +8 -0
  17. package/build/components/admin-section/types.js +1 -0
  18. package/build/components/alert/index.d.ts +23 -0
  19. package/build/components/alert/index.js +33 -0
  20. package/build/components/automattic-byline-logo/index.d.ts +10 -0
  21. package/build/components/automattic-byline-logo/index.js +13 -0
  22. package/build/components/automattic-byline-logo/types.d.ts +15 -0
  23. package/build/components/automattic-byline-logo/types.js +1 -0
  24. package/build/components/automattic-for-agencies-logo/index.d.ts +11 -0
  25. package/build/components/automattic-for-agencies-logo/index.js +12 -0
  26. package/build/components/automattic-icon-logo/index.d.ts +13 -0
  27. package/build/components/automattic-icon-logo/index.js +13 -0
  28. package/build/components/badge/index.d.ts +19 -0
  29. package/build/components/badge/index.js +22 -0
  30. package/build/components/boost-score-bar/index.d.ts +5 -0
  31. package/build/components/boost-score-bar/index.js +35 -0
  32. package/build/components/boost-score-bar/types.d.ts +9 -0
  33. package/build/components/boost-score-bar/types.js +1 -0
  34. package/build/components/boost-score-graph/annotations-plugin.d.ts +16 -0
  35. package/build/components/boost-score-graph/annotations-plugin.js +58 -0
  36. package/build/components/boost-score-graph/background.d.ts +3 -0
  37. package/build/components/boost-score-graph/background.js +5 -0
  38. package/build/components/boost-score-graph/day-highlight-plugin.d.ts +13 -0
  39. package/build/components/boost-score-graph/day-highlight-plugin.js +69 -0
  40. package/build/components/boost-score-graph/get-date-format.d.ts +9 -0
  41. package/build/components/boost-score-graph/get-date-format.js +52 -0
  42. package/build/components/boost-score-graph/index.d.ts +44 -0
  43. package/build/components/boost-score-graph/index.js +42 -0
  44. package/build/components/boost-score-graph/tooltip.d.ts +3 -0
  45. package/build/components/boost-score-graph/tooltip.js +22 -0
  46. package/build/components/boost-score-graph/tooltips-plugin.d.ts +15 -0
  47. package/build/components/boost-score-graph/tooltips-plugin.js +78 -0
  48. package/build/components/boost-score-graph/uplot-line-chart.d.ts +27 -0
  49. package/build/components/boost-score-graph/uplot-line-chart.js +187 -0
  50. package/build/components/boost-score-graph/use-boost-score-transform.d.ts +14 -0
  51. package/build/components/boost-score-graph/use-boost-score-transform.js +26 -0
  52. package/build/components/boost-score-graph/use-resize.d.ts +9 -0
  53. package/build/components/boost-score-graph/use-resize.js +31 -0
  54. package/build/components/button/index.d.ts +10 -0
  55. package/build/components/button/index.js +45 -0
  56. package/build/components/button/types.d.ts +19 -0
  57. package/build/components/button/types.js +1 -0
  58. package/build/components/chip/index.d.ts +15 -0
  59. package/build/components/chip/index.js +16 -0
  60. package/build/components/contextual-upgrade-trigger/index.d.ts +4 -0
  61. package/build/components/contextual-upgrade-trigger/index.js +12 -0
  62. package/build/components/contextual-upgrade-trigger/types.d.ts +9 -0
  63. package/build/components/contextual-upgrade-trigger/types.js +1 -0
  64. package/build/components/copy-to-clipboard/index.d.ts +4 -0
  65. package/build/components/copy-to-clipboard/index.js +40 -0
  66. package/build/components/copy-to-clipboard/types.d.ts +6 -0
  67. package/build/components/copy-to-clipboard/types.js +1 -0
  68. package/build/components/decorative-card/index.d.ts +11 -0
  69. package/build/components/decorative-card/index.js +13 -0
  70. package/build/components/decorative-card/types.d.ts +14 -0
  71. package/build/components/decorative-card/types.js +1 -0
  72. package/build/components/dialog/index.d.ts +20 -0
  73. package/build/components/dialog/index.js +31 -0
  74. package/build/components/diff-viewer/index.d.ts +4 -0
  75. package/build/components/diff-viewer/index.js +33 -0
  76. package/build/components/diff-viewer/parse-filename.d.ts +29 -0
  77. package/build/components/diff-viewer/parse-filename.js +61 -0
  78. package/build/components/diff-viewer/parse-patch.d.ts +9 -0
  79. package/build/components/diff-viewer/parse-patch.js +148 -0
  80. package/build/components/donut-meter/index.d.ts +58 -0
  81. package/build/components/donut-meter/index.js +36 -0
  82. package/build/components/global-notices/global-notices.d.ts +11 -0
  83. package/build/components/global-notices/global-notices.js +19 -0
  84. package/build/components/global-notices/index.d.ts +3 -0
  85. package/build/components/global-notices/index.js +3 -0
  86. package/build/components/global-notices/use-global-notices.d.ts +10 -0
  87. package/build/components/global-notices/use-global-notices.js +30 -0
  88. package/build/components/gridicon/index.d.ts +14 -0
  89. package/build/components/gridicon/index.js +167 -0
  90. package/build/components/gridicon/types.d.ts +39 -0
  91. package/build/components/gridicon/types.js +1 -0
  92. package/build/components/icon-tooltip/index.d.ts +11 -0
  93. package/build/components/icon-tooltip/index.js +75 -0
  94. package/build/components/icon-tooltip/types.d.ts +69 -0
  95. package/build/components/icon-tooltip/types.js +1 -0
  96. package/build/components/icons/index.d.ts +70 -0
  97. package/build/components/icons/index.js +86 -0
  98. package/build/components/icons/types.d.ts +27 -0
  99. package/build/components/icons/types.js +1 -0
  100. package/build/components/indeterminate-progress-bar/index.d.ts +10 -0
  101. package/build/components/indeterminate-progress-bar/index.js +20 -0
  102. package/build/components/indeterminate-progress-bar/types.d.ts +6 -0
  103. package/build/components/indeterminate-progress-bar/types.js +1 -0
  104. package/build/components/jetpack-footer/index.d.ts +11 -0
  105. package/build/components/jetpack-footer/index.js +71 -0
  106. package/build/components/jetpack-footer/types.d.ts +47 -0
  107. package/build/components/jetpack-footer/types.js +1 -0
  108. package/build/components/jetpack-logo/index.d.ts +4 -0
  109. package/build/components/jetpack-logo/index.js +10 -0
  110. package/build/components/jetpack-logo/types.d.ts +7 -0
  111. package/build/components/jetpack-logo/types.js +1 -0
  112. package/build/components/jetpack-protect-logo/index.d.ts +4 -0
  113. package/build/components/jetpack-protect-logo/index.js +10 -0
  114. package/build/components/jetpack-protect-logo/types.d.ts +7 -0
  115. package/build/components/jetpack-protect-logo/types.js +1 -0
  116. package/build/components/jetpack-search-logo/index.d.ts +4 -0
  117. package/build/components/jetpack-search-logo/index.js +7 -0
  118. package/build/components/jetpack-search-logo/types.d.ts +7 -0
  119. package/build/components/jetpack-search-logo/types.js +1 -0
  120. package/build/components/jetpack-vaultpress-backup-logo/index.d.ts +4 -0
  121. package/build/components/jetpack-vaultpress-backup-logo/index.js +8 -0
  122. package/build/components/jetpack-vaultpress-backup-logo/types.d.ts +6 -0
  123. package/build/components/jetpack-vaultpress-backup-logo/types.js +1 -0
  124. package/build/components/jetpack-videopress-logo/index.d.ts +4 -0
  125. package/build/components/jetpack-videopress-logo/index.js +8 -0
  126. package/build/components/jetpack-videopress-logo/types.d.ts +6 -0
  127. package/build/components/jetpack-videopress-logo/types.js +1 -0
  128. package/build/components/layout/col/index.d.ts +10 -0
  129. package/build/components/layout/col/index.js +42 -0
  130. package/build/components/layout/container/index.d.ts +4 -0
  131. package/build/components/layout/container/index.js +30 -0
  132. package/build/components/layout/types.d.ts +58 -0
  133. package/build/components/layout/types.js +1 -0
  134. package/build/components/layout/use-breakpoint-match/index.d.ts +19 -0
  135. package/build/components/layout/use-breakpoint-match/index.js +50 -0
  136. package/build/components/loading-placeholder/index.d.ts +8 -0
  137. package/build/components/loading-placeholder/index.js +7 -0
  138. package/build/components/marked-lines/index.d.ts +4 -0
  139. package/build/components/marked-lines/index.js +50 -0
  140. package/build/components/notice/index.d.ts +29 -0
  141. package/build/components/notice/index.js +35 -0
  142. package/build/components/number-control/index.d.ts +10 -0
  143. package/build/components/number-control/index.js +16 -0
  144. package/build/components/number-format/index.d.ts +9 -0
  145. package/build/components/number-format/index.js +13 -0
  146. package/build/components/number-slider/index.d.ts +12 -0
  147. package/build/components/number-slider/index.js +43 -0
  148. package/build/components/number-slider/types.d.ts +50 -0
  149. package/build/components/number-slider/types.js +1 -0
  150. package/build/components/popover/index.d.ts +9 -0
  151. package/build/components/popover/index.js +6 -0
  152. package/build/components/pricing-card/index.d.ts +11 -0
  153. package/build/components/pricing-card/index.js +32 -0
  154. package/build/components/pricing-card/types.d.ts +51 -0
  155. package/build/components/pricing-card/types.js +1 -0
  156. package/build/components/pricing-table/index.d.ts +7 -0
  157. package/build/components/pricing-table/index.js +66 -0
  158. package/build/components/pricing-table/types.d.ts +68 -0
  159. package/build/components/pricing-table/types.js +1 -0
  160. package/build/components/product-offer/icons-card.d.ts +10 -0
  161. package/build/components/product-offer/icons-card.js +23 -0
  162. package/build/components/product-offer/index.d.ts +11 -0
  163. package/build/components/product-offer/index.js +31 -0
  164. package/build/components/product-offer/product-offer-header.d.ts +9 -0
  165. package/build/components/product-offer/product-offer-header.js +14 -0
  166. package/build/components/product-offer/types.d.ts +102 -0
  167. package/build/components/product-offer/types.js +1 -0
  168. package/build/components/product-price/index.d.ts +11 -0
  169. package/build/components/product-price/index.js +32 -0
  170. package/build/components/product-price/price.d.ts +9 -0
  171. package/build/components/product-price/price.js +19 -0
  172. package/build/components/product-price/types.d.ts +61 -0
  173. package/build/components/product-price/types.js +1 -0
  174. package/build/components/progress-bar/index.d.ts +10 -0
  175. package/build/components/progress-bar/index.js +26 -0
  176. package/build/components/progress-bar/types.d.ts +18 -0
  177. package/build/components/progress-bar/types.js +1 -0
  178. package/build/components/qr-code/index.d.ts +46 -0
  179. package/build/components/qr-code/index.js +21 -0
  180. package/build/components/radio-control/index.d.ts +24 -0
  181. package/build/components/radio-control/index.js +8 -0
  182. package/build/components/record-meter-bar/index.d.ts +62 -0
  183. package/build/components/record-meter-bar/index.js +40 -0
  184. package/build/components/spinner/index.d.ts +13 -0
  185. package/build/components/spinner/index.js +27 -0
  186. package/build/components/split-button/index.d.ts +4 -0
  187. package/build/components/split-button/index.js +8 -0
  188. package/build/components/split-button/types.d.ts +8 -0
  189. package/build/components/split-button/types.js +1 -0
  190. package/build/components/stat-card/index.d.ts +9 -0
  191. package/build/components/stat-card/index.js +27 -0
  192. package/build/components/stat-card/types.d.ts +29 -0
  193. package/build/components/stat-card/types.js +1 -0
  194. package/build/components/status/index.d.ts +8 -0
  195. package/build/components/status/index.js +18 -0
  196. package/build/components/terms-of-service/index.d.ts +5 -0
  197. package/build/components/terms-of-service/index.js +32 -0
  198. package/build/components/terms-of-service/types.d.ts +23 -0
  199. package/build/components/terms-of-service/types.js +1 -0
  200. package/build/components/testimonials/index.d.ts +3 -0
  201. package/build/components/testimonials/index.js +18 -0
  202. package/build/components/testimonials/testimonial.d.ts +4 -0
  203. package/build/components/testimonials/testimonial.js +7 -0
  204. package/build/components/testimonials/types.d.ts +13 -0
  205. package/build/components/testimonials/types.js +1 -0
  206. package/build/components/text/constants.d.ts +14 -0
  207. package/build/components/text/constants.js +29 -0
  208. package/build/components/text/index.d.ts +32 -0
  209. package/build/components/text/index.js +53 -0
  210. package/build/components/text/types.d.ts +50 -0
  211. package/build/components/text/types.js +1 -0
  212. package/build/components/theme-provider/index.d.ts +80 -0
  213. package/build/components/theme-provider/index.js +129 -0
  214. package/build/components/theme-provider/types.d.ts +23 -0
  215. package/build/components/theme-provider/types.js +1 -0
  216. package/build/components/threat-fixer-button/index.d.ts +17 -0
  217. package/build/components/threat-fixer-button/index.js +56 -0
  218. package/build/components/threat-severity-badge/index.d.ts +4 -0
  219. package/build/components/threat-severity-badge/index.js +13 -0
  220. package/build/components/threats-data-views/constants.d.ts +33 -0
  221. package/build/components/threats-data-views/constants.js +37 -0
  222. package/build/components/threats-data-views/index.d.ts +30 -0
  223. package/build/components/threats-data-views/index.js +413 -0
  224. package/build/components/threats-data-views/threats-status-toggle-group-control.d.ts +16 -0
  225. package/build/components/threats-data-views/threats-status-toggle-group-control.js +95 -0
  226. package/build/components/toggle-control/index.d.ts +21 -0
  227. package/build/components/toggle-control/index.js +21 -0
  228. package/build/components/upsell-banner/index.d.ts +14 -0
  229. package/build/components/upsell-banner/index.js +21 -0
  230. package/build/components/upsell-banner/types.d.ts +13 -0
  231. package/build/components/upsell-banner/types.js +1 -0
  232. package/build/components/zendesk-chat/constants.d.ts +1 -0
  233. package/build/components/zendesk-chat/constants.js +2 -0
  234. package/build/components/zendesk-chat/index.d.ts +3 -0
  235. package/build/components/zendesk-chat/index.js +27 -0
  236. package/build/components/zendesk-chat/types.d.ts +11 -0
  237. package/build/components/zendesk-chat/types.js +1 -0
  238. package/build/index.d.ts +67 -0
  239. package/build/index.js +81 -0
  240. package/build/lib/locale/index.d.ts +13 -0
  241. package/build/lib/locale/index.js +34 -0
  242. package/build/tools/get-product-checkout-url/index.d.ts +10 -0
  243. package/build/tools/get-product-checkout-url/index.js +22 -0
  244. package/build/tools/get-site-admin-url/index.d.ts +6 -0
  245. package/build/tools/get-site-admin-url/index.js +13 -0
  246. package/build/tools/jp-redirect/index.d.ts +20 -0
  247. package/build/tools/jp-redirect/index.js +50 -0
  248. package/build/tools/jp-redirect/types.d.ts +39 -0
  249. package/build/tools/jp-redirect/types.js +1 -0
  250. package/build/tools/pricing-utils/index.d.ts +8 -0
  251. package/build/tools/pricing-utils/index.js +9 -0
  252. package/build/tools/pricing-utils/types.d.ts +12 -0
  253. package/build/tools/pricing-utils/types.js +1 -0
  254. package/components/boost-score-graph/uplot-line-chart.tsx +16 -1
  255. package/components/jetpack-footer/style.scss +5 -0
  256. package/components/number-slider/index.tsx +8 -2
  257. package/package.json +19 -12
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getCurrencyObject } from '@automattic/format-currency';
3
+ import clsx from 'clsx';
4
+ import Text from '../text/index.js';
5
+ import styles from './style.module.scss';
6
+ /**
7
+ * React component to render a Price composition.
8
+ *
9
+ * @param {PriceProps} props - Component props.
10
+ * @return {React.ReactNode} -Price react component.
11
+ */
12
+ export const Price = ({ value, currency, isOff, hidePriceFraction }) => {
13
+ const classNames = clsx(styles.price, 'product-price_price', {
14
+ [styles['is-not-off-price']]: !isOff,
15
+ });
16
+ const { symbol, integer, fraction } = getCurrencyObject(value, currency);
17
+ const showPriceFraction = !hidePriceFraction || !fraction.endsWith('00');
18
+ return (_jsxs(Text, { className: classNames, variant: "headline-medium", component: "p", children: [_jsx(Text, { className: styles.symbol, component: "sup", variant: "title-medium", children: symbol }), integer, showPriceFraction && (_jsx(Text, { component: "sup", variant: "body-small", "data-testid": "PriceFraction", children: _jsx("strong", { children: fraction }) }))] }));
19
+ };
@@ -0,0 +1,61 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ export type ProductPriceProps = {
3
+ /**
4
+ * Product price.
5
+ */
6
+ price?: number;
7
+ /**
8
+ * Product price with discount.
9
+ */
10
+ offPrice?: number;
11
+ /**
12
+ * Product currency code.
13
+ */
14
+ currency?: string;
15
+ /**
16
+ * Product legend.
17
+ */
18
+ legend?: string;
19
+ /**
20
+ * Show the not off price.
21
+ */
22
+ showNotOffPrice?: boolean;
23
+ /**
24
+ * Force the price as a not off price.
25
+ */
26
+ isNotConvenientPrice?: boolean;
27
+ /**
28
+ * Hides the price fraction if fraction is zero.
29
+ */
30
+ hidePriceFraction?: boolean;
31
+ /**
32
+ * Hides discount label
33
+ */
34
+ hideDiscountLabel?: boolean;
35
+ /**
36
+ * Custom promo label
37
+ */
38
+ promoLabel?: string;
39
+ /**
40
+ * Alternative legend with HTML syntax
41
+ */
42
+ children?: React.ReactNode;
43
+ };
44
+ export type PriceProps = {
45
+ /**
46
+ * Price value.
47
+ */
48
+ value: number;
49
+ /**
50
+ * Price currency code.
51
+ */
52
+ currency: string;
53
+ /**
54
+ * True when it is an off price.
55
+ */
56
+ isOff: boolean;
57
+ /**
58
+ * Hides the price fraction if fraction is zero.
59
+ */
60
+ hidePriceFraction?: boolean;
61
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ProgressBarProps } from './types.js';
2
+ import type React from 'react';
3
+ /**
4
+ * Progress Bar component
5
+ *
6
+ * @param {ProgressBarProps} props - Component props.
7
+ * @return {React.ReactNode} - ProgressBar react component.
8
+ */
9
+ declare const ProgressBar: React.FC<ProgressBarProps>;
10
+ export default ProgressBar;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import clsx from 'clsx';
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import styles from './style.module.scss';
10
+ /**
11
+ * Progress Bar component
12
+ *
13
+ * @param {ProgressBarProps} props - Component props.
14
+ * @return {React.ReactNode} - ProgressBar react component.
15
+ */
16
+ const ProgressBar = ({ className, progressClassName, progress, size = 'normal', }) => {
17
+ if (progress == null) {
18
+ return null;
19
+ }
20
+ const normalizedProgress = Math.max(Math.min(progress, 1), 0);
21
+ const style = {
22
+ width: `${normalizedProgress * 100}%`,
23
+ };
24
+ return (_jsx("div", { className: clsx(className, styles.wrapper, { [styles.small]: size === 'small' }), children: _jsx("div", { className: clsx(progressClassName, styles.progress), style: style }) }));
25
+ };
26
+ export default ProgressBar;
@@ -0,0 +1,18 @@
1
+ export type ProgressBarProps = {
2
+ /**
3
+ * Optional classname to apply to the root element.
4
+ */
5
+ className?: string;
6
+ /**
7
+ * Optional classname to apply to the progress element.
8
+ */
9
+ progressClassName?: string;
10
+ /**
11
+ * The current progress percentage, from 0 to 1.
12
+ */
13
+ progress: number;
14
+ /**
15
+ * The progress bar height.
16
+ */
17
+ size?: 'normal' | 'small';
18
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ import { QRCodeCanvas, QRCodeSVG } from 'qrcode.react';
2
+ import type React from 'react';
3
+ type QRCodeCanvasProps = React.ComponentProps<typeof QRCodeCanvas>;
4
+ type QRCodeSVGProps = React.ComponentProps<typeof QRCodeSVG>;
5
+ export type QRCodeProps = {
6
+ /**
7
+ * The value to encode.
8
+ */
9
+ value?: string;
10
+ /**
11
+ * Background color of the QR code.
12
+ */
13
+ bgColor?: string;
14
+ /**
15
+ * Foreground color of the QR code.
16
+ */
17
+ fgColor?: string;
18
+ /**
19
+ * Error correction level of the QR code.
20
+ */
21
+ level?: QRCodeCanvasProps['level'] | QRCodeSVGProps['level'];
22
+ /**
23
+ * Whether to include margin in the QR code.
24
+ */
25
+ includeMargin?: boolean;
26
+ /**
27
+ * Render the QR code as a `canvas` or `svg`.
28
+ */
29
+ renderAs?: 'canvas' | 'svg';
30
+ /**
31
+ * Size of the QR code.
32
+ */
33
+ size?: number;
34
+ /**
35
+ * Image settings for the QR code.
36
+ */
37
+ imageSettings?: QRCodeCanvasProps['imageSettings'] | QRCodeSVGProps['imageSettings'];
38
+ };
39
+ /**
40
+ * Renders a QR Code.
41
+ *
42
+ * @param {QRCodeProps} props - Component props
43
+ * @return {React.ReactNode} - React component.
44
+ */
45
+ declare const QRCode: React.FC<QRCodeProps>;
46
+ export default QRCode;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { QRCodeCanvas, QRCodeSVG } from 'qrcode.react';
3
+ /**
4
+ * Renders a QR Code.
5
+ *
6
+ * @param {QRCodeProps} props - Component props
7
+ * @return {React.ReactNode} - React component.
8
+ */
9
+ const QRCode = ({ value = 'https://jetpack.com', size = 248, bgColor, fgColor, level, includeMargin, imageSettings, renderAs = 'canvas', }) => {
10
+ const commonProps = {
11
+ value,
12
+ size,
13
+ bgColor,
14
+ fgColor,
15
+ level,
16
+ includeMargin,
17
+ imageSettings,
18
+ };
19
+ return renderAs === 'svg' ? (_jsx(QRCodeSVG, { ...commonProps })) : (_jsx(QRCodeCanvas, { ...commonProps }));
20
+ };
21
+ export default QRCode;
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ 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?: React.ReactNode;
11
+ /** The label for the radio control. */
12
+ label?: React.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: React.FC<RadioControlProps>;
24
+ export default RadioControl;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { RadioControl as WPRadioControl } from '@wordpress/components';
3
+ import clsx from 'clsx';
4
+ import styles from './styles.module.scss';
5
+ const RadioControl = ({ selected, className, disabled, help, label, hideLabelFromVision, options, onChange, }) => {
6
+ return (_jsx(WPRadioControl, { selected: selected, className: clsx(styles.radio, className), disabled: disabled, help: help, label: label, hideLabelFromVision: hideLabelFromVision, options: options, onChange: onChange }));
7
+ };
8
+ export default RadioControl;
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import './style.scss';
3
+ type RecordMeterBarItem = {
4
+ /**
5
+ * Count for the given item
6
+ */
7
+ count: number;
8
+ /**
9
+ * Label to be used for the given item
10
+ */
11
+ label: string;
12
+ /**
13
+ * Color code for the background color for the item
14
+ */
15
+ backgroundColor: string;
16
+ };
17
+ export type RecordMeterBarProps = {
18
+ /**
19
+ * Total number of items for the record meter. If not provided, its is the sum of item.count of all items.
20
+ */
21
+ totalCount?: number;
22
+ /**
23
+ * The items to display in Record meter.
24
+ */
25
+ items: Array<RecordMeterBarItem>;
26
+ /**
27
+ * The formatting style for legend item display. If not provided, it defaults to showing legend label after count
28
+ */
29
+ showLegendLabelBeforeCount?: boolean;
30
+ /**
31
+ * The sort style for legend item. If not provided, it defaults to no sorting.
32
+ */
33
+ sortByCount?: 'ascending' | 'descending';
34
+ /**
35
+ * Additional class name to be added to the component
36
+ */
37
+ className?: string;
38
+ /**
39
+ * Table caption
40
+ */
41
+ tableCaption?: string;
42
+ /**
43
+ * Title/label for the legend
44
+ */
45
+ legendTitle?: string;
46
+ /**
47
+ * Recorc type label for screen readers
48
+ */
49
+ recordTypeLabel?: string;
50
+ /**
51
+ * Record count label for screen readers
52
+ */
53
+ recordCountLabel?: string;
54
+ };
55
+ /**
56
+ * Generate Record Meter bar
57
+ *
58
+ * @param {RecordMeterBarProps} props - Props
59
+ * @return {React.ReactElement} - JSX element
60
+ */
61
+ declare const RecordMeterBar: React.FC<RecordMeterBarProps>;
62
+ export default RecordMeterBar;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { __ } from '@wordpress/i18n';
3
+ import clsx from 'clsx';
4
+ import { useMemo } from 'react';
5
+ import numberFormat from '../number-format/index.js';
6
+ import './style.scss';
7
+ /**
8
+ * Generate Record Meter bar
9
+ *
10
+ * @param {RecordMeterBarProps} props - Props
11
+ * @return {React.ReactElement} - JSX element
12
+ */
13
+ const RecordMeterBar = ({ totalCount, items = [], showLegendLabelBeforeCount = false, sortByCount, className, tableCaption, legendTitle, recordTypeLabel, recordCountLabel, }) => {
14
+ const total = useMemo(() => {
15
+ // If total count is not given, then compute it from items' count
16
+ return (totalCount ||
17
+ items.reduce((currentTotal, { count }) => {
18
+ return currentTotal + count;
19
+ }, 0));
20
+ }, [items, totalCount]);
21
+ const itemsToRender = useMemo(() => {
22
+ if (sortByCount) {
23
+ // create a new array because .sort() updates the array in place.
24
+ return [...items].sort((a, z) => {
25
+ return 'ascending' === sortByCount ? a.count - z.count : z.count - a.count;
26
+ });
27
+ }
28
+ return items;
29
+ }, [items, sortByCount]);
30
+ return (_jsxs("div", { className: clsx('record-meter-bar', className), children: [_jsx("div", { className: "record-meter-bar__items", "aria-hidden": "true", children: itemsToRender.map(({ count, label, backgroundColor }) => {
31
+ const widthPercent = ((count / total) * 100).toPrecision(2);
32
+ return (_jsx("div", { style: { backgroundColor, flexBasis: `${widthPercent}%` } }, label));
33
+ }) }), _jsxs("div", { className: "record-meter-bar__legend", "aria-hidden": "true", children: [legendTitle && _jsx("div", { className: "record-meter-bar__legend--title", children: legendTitle }), _jsx("ul", { className: "record-meter-bar__legend--items", children: itemsToRender.map(({ count, label, backgroundColor }) => {
34
+ const formattedCount = numberFormat(count);
35
+ return (_jsxs("li", { className: "record-meter-bar__legend--item", children: [_jsx("div", { className: "record-meter-bar__legend--item-circle", style: { backgroundColor } }), !showLegendLabelBeforeCount && (_jsxs("span", { children: [_jsx("span", { className: "record-meter-bar__legend--item-count", children: formattedCount }), _jsx("span", { className: "record-meter-bar__legend--item-label", children: label })] })), showLegendLabelBeforeCount && (_jsxs("span", { children: [_jsx("span", { className: "record-meter-bar__legend--item-label record-meter-bar__legend--item-label-first", children: label }), _jsxs("span", { className: "record-meter-bar__legend--item-count", children: ["(", formattedCount, ")"] })] }))] }, label));
36
+ }) })] }), _jsxs("table", { className: "screen-reader-text", children: [_jsx("caption", { children: tableCaption || __('Summary of the records', 'jetpack-components') }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("th", { scope: "col", children: recordTypeLabel || __('Record type', 'jetpack-components') }), _jsx("th", { scope: "col", children: recordCountLabel || __('Record count', 'jetpack-components') })] }), itemsToRender.map(({ label, count }) => {
37
+ return (_jsxs("tr", { children: [_jsx("td", { children: label }), _jsx("td", { children: count })] }, label));
38
+ })] })] })] }));
39
+ };
40
+ export default RecordMeterBar;
@@ -0,0 +1,13 @@
1
+ export default Spinner;
2
+ declare function Spinner({ color, className, size }: {
3
+ color?: string;
4
+ className?: string;
5
+ size?: number;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ declare namespace Spinner {
8
+ namespace propTypes {
9
+ const color: any;
10
+ const className: any;
11
+ const size: any;
12
+ }
13
+ }
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import PropTypes from 'prop-types';
3
+ import React from 'react';
4
+ import './style.scss';
5
+ const Spinner = ({ color = '#FFFFFF', className = '', size = 20 }) => {
6
+ const theClassName = className + ' jp-components-spinner';
7
+ const styleOuter = {
8
+ width: size,
9
+ height: size,
10
+ fontSize: size,
11
+ borderTopColor: color,
12
+ };
13
+ const styleInner = {
14
+ borderTopColor: color,
15
+ borderRightColor: color,
16
+ };
17
+ return (_jsx("div", { className: theClassName, children: _jsx("div", { className: "jp-components-spinner__outer", style: styleOuter, children: _jsx("div", { className: "jp-components-spinner__inner", style: styleInner }) }) }));
18
+ };
19
+ Spinner.propTypes = {
20
+ /** The spinner color. */
21
+ color: PropTypes.string,
22
+ /** CSS class names. */
23
+ className: PropTypes.string,
24
+ /** The spinner size. */
25
+ size: PropTypes.number,
26
+ };
27
+ export default Spinner;
@@ -0,0 +1,4 @@
1
+ import { SplitButtonProps } from './types.js';
2
+ import type React from 'react';
3
+ declare const SplitButton: React.FC<SplitButtonProps>;
4
+ export default SplitButton;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ButtonGroup, Button, 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
+ return (_jsxs(ButtonGroup, { className: styles['split-button'], children: [_jsx(Button, { variant: variant, ...buttonProps, className: styles.button }), _jsx(DropdownMenu, { toggleProps: { variant, className: styles.button, ...toggleProps }, popoverProps: { noArrow: false, ...popoverProps }, icon: _jsx(DownIcon, {}), disableOpenOnArrowDown: true, controls: controls, label: label })] }));
7
+ };
8
+ export default SplitButton;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import type { Button, DropdownMenu } from '@wordpress/components';
6
+ type AllowedDropdownMenuProps = Pick<React.ComponentProps<typeof DropdownMenu>, 'controls' | 'popoverProps' | 'toggleProps' | 'label'>;
7
+ export type SplitButtonProps = Omit<React.ComponentProps<typeof Button>, 'controls'> & AllowedDropdownMenuProps & Required<Pick<AllowedDropdownMenuProps, 'controls'>>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { StatCardProps } from './types.js';
2
+ /**
3
+ * StatCard component
4
+ *
5
+ * @param {StatCardProps} props - Component props.
6
+ * @return {React.ReactNode} - StatCard react component.
7
+ */
8
+ declare const StatCard: ({ className, hideValue, icon, label, value, variant, }: StatCardProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default StatCard;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import { Tooltip } from '@wordpress/components';
6
+ import clsx from 'clsx';
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import numberFormat from '../number-format/index.js';
11
+ import Text from '../text/index.js';
12
+ import styles from './style.module.scss';
13
+ /**
14
+ * StatCard component
15
+ *
16
+ * @param {StatCardProps} props - Component props.
17
+ * @return {React.ReactNode} - StatCard react component.
18
+ */
19
+ const StatCard = ({ className, hideValue, icon, label, value, variant = 'square', }) => {
20
+ const formattedValue = numberFormat(value);
21
+ const compactValue = numberFormat(value, {
22
+ notation: 'compact',
23
+ compactDisplay: 'short',
24
+ });
25
+ return (_jsxs("div", { className: clsx(className, styles.wrapper, styles[variant]), children: [_jsx("div", { className: clsx(styles.icon), children: icon }), _jsxs("div", { className: clsx(styles.info), children: [_jsx(Text, { className: styles.label, children: label }), variant === 'square' ? (_jsx(Tooltip, { text: formattedValue, placement: "top", children: _jsx(Text, { variant: "headline-small", className: clsx(styles.value), children: hideValue ? '-' : compactValue }) })) : (_jsx(Text, { variant: "title-medium-semi-bold", className: clsx(styles.value), children: hideValue ? '-' : formattedValue }))] })] }));
26
+ };
27
+ export default StatCard;
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ export type StatCardProps = {
3
+ /**
4
+ * Custom className to be inserted.
5
+ */
6
+ className?: string;
7
+ /**
8
+ * Whether to hide the value.
9
+ */
10
+ hideValue?: boolean;
11
+ /**
12
+ * The stat card icon.
13
+ */
14
+ icon: React.JSX.Element;
15
+ /**
16
+ * The stat label.
17
+ */
18
+ label: string;
19
+ /**
20
+ * The stat value.
21
+ */
22
+ value: number;
23
+ /**
24
+ * The component variant.
25
+ *
26
+ * @default 'square'
27
+ */
28
+ variant?: 'square' | 'horizontal';
29
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ interface StatusProps {
3
+ status?: 'active' | 'error' | 'inactive' | 'action' | 'initializing';
4
+ label?: string;
5
+ className?: string;
6
+ }
7
+ declare const Status: ({ className, label, status }: StatusProps) => React.JSX.Element;
8
+ export default Status;
@@ -0,0 +1,18 @@
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
+ const Status = ({ className, label, status = 'inactive' }) => {
7
+ const defaultLabels = {
8
+ active: __('Active', 'jetpack-components'),
9
+ error: __('Error', 'jetpack-components'),
10
+ action: __('Action needed', 'jetpack-components'),
11
+ inactive: __('Inactive', 'jetpack-components'),
12
+ initializing: __('Setting up', 'jetpack-components'),
13
+ };
14
+ return (_jsxs(Text, { variant: "body-extra-small", className: clsx(styles.status, {
15
+ [styles[`is-${status}`]]: status,
16
+ }, className), children: [_jsx("span", { className: styles.status__indicator }), _jsx("span", { className: styles.status__label, children: label || label === '' ? label : defaultLabels[status] })] }));
17
+ };
18
+ export default Status;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import type { TermsOfServiceProps } from './types.js';
3
+ import './styles.scss';
4
+ declare const TermsOfService: React.FC<TermsOfServiceProps>;
5
+ export default TermsOfService;
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createInterpolateElement } from '@wordpress/element';
3
+ import { __, sprintf } from '@wordpress/i18n';
4
+ import clsx from 'clsx';
5
+ import { getRedirectUrl } from '../../../components/index.js';
6
+ import Text from '../text/index.js';
7
+ import './styles.scss';
8
+ const TermsOfService = ({ className, multipleButtons, agreeButtonLabel, ...textProps }) => (_jsx(Text, { className: clsx(className, 'terms-of-service'), ...textProps, children: multipleButtons ? (_jsx(MultipleButtonsText, { multipleButtonsLabels: multipleButtons })) : (_jsx(SingleButtonText, { agreeButtonLabel: agreeButtonLabel })) }));
9
+ const MultipleButtonsText = ({ multipleButtonsLabels }) => {
10
+ if (Array.isArray(multipleButtonsLabels) && multipleButtonsLabels.length > 1) {
11
+ return createInterpolateElement(sprintf(
12
+ /* translators: %1$s is button label 1 and %2$s is button label 2 */
13
+ __('By clicking <strong>%1$s</strong> or <strong>%2$s</strong>, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.', 'jetpack-components'), multipleButtonsLabels[0], multipleButtonsLabels[1]), {
14
+ strong: _jsx("strong", {}),
15
+ tosLink: _jsx(Link, { slug: "wpcom-tos" }),
16
+ shareDetailsLink: _jsx(Link, { slug: "jetpack-support-what-data-does-jetpack-sync" }),
17
+ });
18
+ }
19
+ return createInterpolateElement(__('By clicking the buttons above, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.', 'jetpack-components'), {
20
+ tosLink: _jsx(Link, { slug: "wpcom-tos" }),
21
+ shareDetailsLink: _jsx(Link, { slug: "jetpack-support-what-data-does-jetpack-sync" }),
22
+ });
23
+ };
24
+ const SingleButtonText = ({ agreeButtonLabel }) => createInterpolateElement(sprintf(
25
+ /* translators: %s is a button label */
26
+ __('By clicking <strong>%s</strong>, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.', 'jetpack-components'), agreeButtonLabel), {
27
+ strong: _jsx("strong", {}),
28
+ tosLink: _jsx(Link, { slug: "wpcom-tos" }),
29
+ shareDetailsLink: _jsx(Link, { slug: "jetpack-support-what-data-does-jetpack-sync" }),
30
+ });
31
+ const Link = ({ slug, children }) => (_jsx("a", { className: "terms-of-service__link", href: getRedirectUrl(slug), rel: "noopener noreferrer", target: "_blank", children: children }));
32
+ export default TermsOfService;
@@ -0,0 +1,23 @@
1
+ import { TextProps } from '../text/types.js';
2
+ type MultipleButtonsProps = {
3
+ /**
4
+ * Indicates whether there are multiple buttons present that would imply agreement if clicked.
5
+ */
6
+ multipleButtons: true;
7
+ /**
8
+ * The text label of the button someone would click to agree to the terms.
9
+ */
10
+ agreeButtonLabel?: undefined;
11
+ };
12
+ type SingleButtonProps = {
13
+ /**
14
+ * Indicates whether there are multiple buttons present that would imply agreement if clicked.
15
+ */
16
+ multipleButtons?: false;
17
+ /**
18
+ * The text label of the button someone would click to agree to the terms.
19
+ */
20
+ agreeButtonLabel: string;
21
+ };
22
+ export type TermsOfServiceProps = Pick<TextProps, 'variant' | 'm' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx' | 'my' | 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'className' | 'component'> & (MultipleButtonsProps | SingleButtonProps);
23
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { TestimonialsType } from './types.js';
2
+ declare const Testimonials: TestimonialsType;
3
+ export default Testimonials;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useCallback } from '@wordpress/element';
3
+ import Gridicon from '../gridicon/index.js';
4
+ import { Testimonial } from './testimonial.js';
5
+ const Testimonials = ({ testimonials }) => {
6
+ const [currentTestimonialIndex, setcurrentTestimonialIndex] = useState(0);
7
+ const incrementTestimonial = useCallback(() => {
8
+ const newIndex = currentTestimonialIndex === testimonials.length - 1 ? 0 : currentTestimonialIndex + 1;
9
+ setcurrentTestimonialIndex(newIndex);
10
+ }, [currentTestimonialIndex, testimonials]);
11
+ const decrementTestimonial = useCallback(() => {
12
+ const newIndex = currentTestimonialIndex === 0 ? testimonials.length - 1 : currentTestimonialIndex - 1;
13
+ setcurrentTestimonialIndex(newIndex);
14
+ }, [currentTestimonialIndex, testimonials]);
15
+ const shouldShowArrows = testimonials.length > 1;
16
+ return (_jsxs("div", { className: "testimonials", children: [shouldShowArrows && (_jsx("button", { "data-testid": "left-arrow", className: "testimonials__left-arrow", onClick: decrementTestimonial, children: _jsx(Gridicon, { icon: "chevron-left", size: 48 }) })), testimonials.map((testimonial, index) => (_jsx(Testimonial, { ...testimonial, hidden: currentTestimonialIndex !== index }, index))), shouldShowArrows && (_jsx("button", { "data-testid": "right-arrow", className: "testimonials__right-arrow", onClick: incrementTestimonial, children: _jsx(Gridicon, { icon: "chevron-right", size: 48 }) }))] }));
17
+ };
18
+ export default Testimonials;
@@ -0,0 +1,4 @@
1
+ import type { TestimonialType } from './types.js';
2
+ import './style.scss';
3
+ declare const Testimonial: TestimonialType;
4
+ export { Testimonial };
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ import './style.scss';
4
+ const Testimonial = ({ quote, author, profession, img, hidden }) => {
5
+ return (_jsxs("div", { className: clsx('testimonial', hidden ? 'hidden' : 'show'), children: [_jsx("img", { className: "testimonial__author-img", src: img, alt: author }), _jsxs("div", { className: "testimonial__content", children: [_jsxs("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "testimonial__quote-icon", children: [_jsx("path", { d: "M14.6667 24L6.66675 24L6.66675 16L14.6667 16L14.6667 24Z", fill: "#1E1E1E" }), _jsx("path", { d: "M26.6667 24L18.6667 24L18.6667 16L26.6667 16L26.6667 24Z", fill: "#1E1E1E" }), _jsx("path", { d: "M6.66675 24.0001C6.66675 19.5573 6.66675 14.9337 6.66675 10.6686C6.66675 6.40254 10.0001 6.67016 12.0001 6.66987", stroke: "#1E1E1E", strokeWidth: "1.5" }), _jsx("path", { d: "M18.6668 24.0001C18.6667 19.5573 18.6667 14.9337 18.6667 10.6686C18.6667 6.40254 22.0001 6.67016 24.0001 6.66987", stroke: "#1E1E1E", strokeWidth: "1.5" })] }), _jsxs("div", { className: "testimonial__text-block", children: [_jsxs("blockquote", { className: "testimonial__quote", children: ["\u201C", quote, "\u201D"] }), _jsxs("figcaption", { children: [_jsx("span", { className: "testimonial__author", children: author }), _jsx("span", { className: "testimonial__profession", children: profession })] })] })] })] }, author));
6
+ };
7
+ export { Testimonial };