@automattic/jetpack-components 0.54.4 → 0.55.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  ### This is a list detailing changes for the Jetpack RNA Components package releases.
4
4
 
5
+ ## [0.55.1] - 2024-07-25
6
+ ### Added
7
+ - Added `className` prop to `Alert` component [#38450]
8
+
9
+ ### Changed
10
+ - React compatibility: Ensuring createRoot is not called more than once. [#38495]
11
+
12
+ ## [0.55.0] - 2024-07-22
13
+ ### Removed
14
+ - Remove compatibility with WordPress 6.4. [#38386]
15
+
5
16
  ## [0.54.4] - 2024-07-18
6
17
  ### Changed
7
18
  - Internal updates.
@@ -1087,6 +1098,8 @@
1087
1098
  ### Changed
1088
1099
  - Update node version requirement to 14.16.1
1089
1100
 
1101
+ [0.55.1]: https://github.com/Automattic/jetpack-components/compare/0.55.0...0.55.1
1102
+ [0.55.0]: https://github.com/Automattic/jetpack-components/compare/0.54.4...0.55.0
1090
1103
  [0.54.4]: https://github.com/Automattic/jetpack-components/compare/0.54.3...0.54.4
1091
1104
  [0.54.3]: https://github.com/Automattic/jetpack-components/compare/0.54.2...0.54.3
1092
1105
  [0.54.2]: https://github.com/Automattic/jetpack-components/compare/0.54.1...0.54.2
@@ -12,6 +12,9 @@ type AlertProps = {
12
12
 
13
13
  /** Children to be rendered inside the alert. */
14
14
  children: React.ReactNode;
15
+
16
+ /** Wrapper class name */
17
+ className?: string;
15
18
  };
16
19
 
17
20
  const getIconByLevel = ( level: AlertProps[ 'level' ] ) => {
@@ -35,11 +38,17 @@ const getIconByLevel = ( level: AlertProps[ 'level' ] ) => {
35
38
  * @param {object} props - The component properties.
36
39
  * @param {string} props.level - The alert level: error, warning, info, success.
37
40
  * @param {boolean} props.showIcon - Whether to show the alert icon.
41
+ * @param {string} props.className - The wrapper class name.
38
42
  * @param {React.Component} props.children - The alert content.
39
43
  * @returns {React.ReactElement} The `Alert` component.
40
44
  */
41
- const Alert: React.FC< AlertProps > = ( { level = 'warning', children, showIcon = true } ) => {
42
- const classes = clsx( styles.container, styles[ `is-${ level }` ] );
45
+ const Alert: React.FC< AlertProps > = ( {
46
+ level = 'warning',
47
+ children,
48
+ showIcon = true,
49
+ className,
50
+ } ) => {
51
+ const classes = clsx( styles.container, styles[ `is-${ level }` ], className );
43
52
 
44
53
  return (
45
54
  <div className={ classes }>
@@ -22,8 +22,9 @@ export function tooltipsPlugin( periods ) {
22
22
  */
23
23
  function init( u: uPlot, _opts: object ) {
24
24
  container.classList.add( 'jb-score-tooltips-container' );
25
-
26
- reactDom = ReactDOM.createRoot( reactRoot );
25
+ if ( ! reactDom ) {
26
+ reactDom = ReactDOM.createRoot( reactRoot );
27
+ }
27
28
  reactRoot.style.position = 'absolute';
28
29
  reactRoot.style.bottom = -20 + 'px';
29
30
  reactRoot.style.translate = '-50% calc( 100% - 20px )';
@@ -31,8 +31,7 @@ const StatCard = ( { className, icon, label, value, variant = 'square' }: StatCa
31
31
  <div className={ clsx( styles.info ) }>
32
32
  <Text className={ styles.label }>{ label }</Text>
33
33
  { variant === 'square' ? (
34
- // @todo Switch to `placement` once WordPress 6.4 is the minimum.
35
- <Tooltip text={ formattedValue } position="top center">
34
+ <Tooltip text={ formattedValue } placement="top">
36
35
  <Text variant="headline-small" className={ clsx( styles.value ) }>
37
36
  { compactValue }
38
37
  </Text>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-components",
3
- "version": "0.54.4",
3
+ "version": "0.55.1",
4
4
  "description": "Jetpack Components Package",
5
5
  "author": "Automattic",
6
6
  "license": "GPL-2.0-or-later",