@automattic/jetpack-components 1.4.14 → 1.4.16

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,19 @@
2
2
 
3
3
  ### This is a list detailing changes for the Jetpack RNA Components package releases.
4
4
 
5
+ ## [1.4.16] - 2026-02-26
6
+ ### Changed
7
+ - Container: Adjust maximum width to 1040px. [#47308]
8
+ - Update package dependencies. [#47285] [#47300] [#47309]
9
+
10
+ ### Fixed
11
+ - Button: Loosen `ref` type from `HTMLInputElement` to `HTMLElement`. [#47300]
12
+ - NavigatorModal: Guard against WordPress Modal dismisser mechanism to prevent the modal from being closed when an external modal (e.g. Image Studio) opens. [#47180]
13
+
14
+ ## [1.4.15] - 2026-02-23
15
+ ### Changed
16
+ - Update dependencies.
17
+
5
18
  ## [1.4.14] - 2026-02-18
6
19
  ### Changed
7
20
  - Set `.repository.url` in `package.json` to the mirror repo rather than the monorepo. [#47149]
@@ -1659,6 +1672,8 @@
1659
1672
  ### Changed
1660
1673
  - Update node version requirement to 14.16.1
1661
1674
 
1675
+ [1.4.16]: https://github.com/Automattic/jetpack-components/compare/1.4.15...1.4.16
1676
+ [1.4.15]: https://github.com/Automattic/jetpack-components/compare/1.4.14...1.4.15
1662
1677
  [1.4.14]: https://github.com/Automattic/jetpack-components/compare/1.4.13...1.4.14
1663
1678
  [1.4.13]: https://github.com/Automattic/jetpack-components/compare/1.4.12...1.4.13
1664
1679
  [1.4.12]: https://github.com/Automattic/jetpack-components/compare/1.4.11...1.4.12
@@ -5,5 +5,5 @@ import type { ButtonProps } from './types.ts';
5
5
  * @param {ButtonProps} props - Component Props
6
6
  * @return {ReactNode} Rendered button
7
7
  */
8
- declare const Button: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
8
+ declare const Button: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
9
9
  export default Button;
@@ -8,11 +8,12 @@
8
8
  @include breakpoints.media(#{$size}) using ($columns) {
9
9
  padding: 0 #{$padding};
10
10
  grid-template-columns: repeat(#{$columns}, minmax(0, 1fr));
11
+ max-width: calc(var(--max-container-width) + 2 * #{$padding});
11
12
  }
12
13
  }
13
14
 
14
15
  .container {
15
- --max-container-width: 1128px;
16
+ --max-container-width: 1040px;
16
17
  // vertical spacing
17
18
  --vertical-gutter: 24px;
18
19
  // horizontal spacing
@@ -20,7 +21,6 @@
20
21
 
21
22
  display: grid;
22
23
  column-gap: var(--vertical-gutter);
23
- max-width: var(--max-container-width);
24
24
  margin: 0 auto;
25
25
  width: 100%;
26
26
 
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Modal, Navigator } from '@wordpress/components';
3
3
  import clsx from 'clsx';
4
- import { useContext } from 'react';
4
+ import { useCallback, useContext } from 'react';
5
5
  import { NavigatorModalContext } from "./context.js";
6
6
  import { Screen } from "./screen.js";
7
7
  import './styles.scss';
@@ -13,8 +13,19 @@ import './styles.scss';
13
13
  * @return Component
14
14
  */
15
15
  function InternalNavigatorModal({ children, className, ...props }) {
16
- const context = useContext(NavigatorModalContext);
17
- return (_jsx(Modal, { __experimentalHideHeader: true, onRequestClose: context.onClose, className: clsx('jp-navigator-modal', className), ...props, children: _jsx(Navigator, { initialPath: context.initialPath, className: "jp-navigator-modal__navigator", children: children }) }));
16
+ const { onClose, initialPath } = useContext(NavigatorModalContext);
17
+ // WordPress Modal's dismisser mechanism (ModalContext) calls onRequestClose()
18
+ // without arguments when another non-nested Modal mounts. We guard against
19
+ // this so that external modals (e.g. Image Studio) don't destroy this one.
20
+ // User-initiated closes (Escape, close button) always pass an event.
21
+ // The NavigatorModal's own Header/Footer close buttons call context.onClose
22
+ // directly and are unaffected by this guard.
23
+ const onRequestClose = useCallback((event) => {
24
+ if (event) {
25
+ onClose?.();
26
+ }
27
+ }, [onClose]);
28
+ return (_jsx(Modal, { __experimentalHideHeader: true, onRequestClose: onRequestClose, className: clsx('jp-navigator-modal', className), ...props, children: _jsx(Navigator, { initialPath: initialPath, className: "jp-navigator-modal__navigator", children: children }) }));
18
29
  }
19
30
  /**
20
31
  * Renders a modal with navigator capabilities.
@@ -12,7 +12,7 @@ import type { ButtonProps } from './types.ts';
12
12
  * @param {ButtonProps} props - Component Props
13
13
  * @return {ReactNode} Rendered button
14
14
  */
15
- const Button = forwardRef< HTMLInputElement, ButtonProps >( ( props, ref ) => {
15
+ const Button = forwardRef< HTMLElement, ButtonProps >( ( props, ref ) => {
16
16
  const {
17
17
  children,
18
18
  variant = 'primary',
@@ -8,11 +8,12 @@
8
8
  @include breakpoints.media(#{$size}) using ($columns) {
9
9
  padding: 0 #{$padding};
10
10
  grid-template-columns: repeat(#{$columns}, minmax(0, 1fr));
11
+ max-width: calc(var(--max-container-width) + 2 * #{$padding});
11
12
  }
12
13
  }
13
14
 
14
15
  .container {
15
- --max-container-width: 1128px;
16
+ --max-container-width: 1040px;
16
17
  // vertical spacing
17
18
  --vertical-gutter: 24px;
18
19
  // horizontal spacing
@@ -20,7 +21,6 @@
20
21
 
21
22
  display: grid;
22
23
  column-gap: var(--vertical-gutter);
23
- max-width: var(--max-container-width);
24
24
  margin: 0 auto;
25
25
  width: 100%;
26
26
 
@@ -1,6 +1,6 @@
1
1
  import { Modal, Navigator } from '@wordpress/components';
2
2
  import clsx from 'clsx';
3
- import { useContext } from 'react';
3
+ import { useCallback, useContext } from 'react';
4
4
  import { NavigatorModalContext } from './context.ts';
5
5
  import { Screen } from './screen.tsx';
6
6
  import './styles.scss';
@@ -23,16 +23,31 @@ function InternalNavigatorModal( {
23
23
  className,
24
24
  ...props
25
25
  }: Omit< ModalProps, 'onRequestClose' > ) {
26
- const context = useContext( NavigatorModalContext );
26
+ const { onClose, initialPath } = useContext( NavigatorModalContext );
27
+
28
+ // WordPress Modal's dismisser mechanism (ModalContext) calls onRequestClose()
29
+ // without arguments when another non-nested Modal mounts. We guard against
30
+ // this so that external modals (e.g. Image Studio) don't destroy this one.
31
+ // User-initiated closes (Escape, close button) always pass an event.
32
+ // The NavigatorModal's own Header/Footer close buttons call context.onClose
33
+ // directly and are unaffected by this guard.
34
+ const onRequestClose = useCallback(
35
+ ( event?: React.SyntheticEvent ) => {
36
+ if ( event ) {
37
+ onClose?.();
38
+ }
39
+ },
40
+ [ onClose ]
41
+ );
27
42
 
28
43
  return (
29
44
  <Modal
30
45
  __experimentalHideHeader
31
- onRequestClose={ context.onClose }
46
+ onRequestClose={ onRequestClose }
32
47
  className={ clsx( 'jp-navigator-modal', className ) }
33
48
  { ...props }
34
49
  >
35
- <Navigator initialPath={ context.initialPath } className="jp-navigator-modal__navigator">
50
+ <Navigator initialPath={ initialPath } className="jp-navigator-modal__navigator">
36
51
  { children }
37
52
  </Navigator>
38
53
  </Modal>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-components",
3
- "version": "1.4.14",
3
+ "version": "1.4.16",
4
4
  "description": "Jetpack Components Package",
5
5
  "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/components/#readme",
6
6
  "bugs": {
@@ -45,47 +45,47 @@
45
45
  ],
46
46
  "dependencies": {
47
47
  "@automattic/format-currency": "1.0.1",
48
- "@automattic/jetpack-api": "^1.0.17",
49
- "@automattic/jetpack-boost-score-api": "^1.0.30",
50
- "@automattic/jetpack-script-data": "^0.5.5",
51
- "@automattic/number-formatters": "^1.0.18",
48
+ "@automattic/jetpack-api": "^1.0.18",
49
+ "@automattic/jetpack-boost-score-api": "^1.0.31",
50
+ "@automattic/jetpack-script-data": "^0.6.0",
51
+ "@automattic/number-formatters": "^1.1.0",
52
52
  "@babel/runtime": "^7",
53
- "@wordpress/browserslist-config": "6.39.0",
54
- "@wordpress/components": "32.1.0",
55
- "@wordpress/compose": "7.39.0",
56
- "@wordpress/data": "10.39.0",
57
- "@wordpress/date": "5.39.0",
58
- "@wordpress/element": "6.39.0",
59
- "@wordpress/i18n": "6.12.0",
60
- "@wordpress/icons": "11.6.0",
61
- "@wordpress/notices": "5.39.0",
53
+ "@wordpress/browserslist-config": "6.40.0",
54
+ "@wordpress/components": "32.2.0",
55
+ "@wordpress/compose": "7.40.0",
56
+ "@wordpress/data": "10.40.0",
57
+ "@wordpress/date": "5.40.0",
58
+ "@wordpress/element": "6.40.0",
59
+ "@wordpress/i18n": "6.13.0",
60
+ "@wordpress/icons": "11.7.0",
61
+ "@wordpress/notices": "5.40.0",
62
62
  "clsx": "2.1.1",
63
63
  "prop-types": "^15.7.2",
64
64
  "qrcode.react": "4.2.0",
65
65
  "react-slider": "2.0.5",
66
- "social-logos": "^3.3.8",
66
+ "social-logos": "^3.3.10",
67
67
  "uplot": "1.6.31",
68
68
  "uplot-react": "1.1.4"
69
69
  },
70
70
  "devDependencies": {
71
- "@automattic/jetpack-base-styles": "^1.0.17",
71
+ "@automattic/jetpack-base-styles": "^1.0.18",
72
72
  "@babel/core": "7.29.0",
73
73
  "@babel/preset-react": "7.28.5",
74
74
  "@jest/globals": "30.2.0",
75
- "@storybook/addon-docs": "10.2.3",
76
- "@storybook/react": "10.2.3",
75
+ "@storybook/addon-docs": "10.2.11",
76
+ "@storybook/react": "10.2.11",
77
77
  "@testing-library/dom": "10.4.1",
78
78
  "@testing-library/react": "16.3.0",
79
79
  "@testing-library/user-event": "14.6.1",
80
80
  "@types/jest": "30.0.0",
81
- "@types/react": "18.3.27",
81
+ "@types/react": "18.3.28",
82
82
  "@types/react-dom": "18.3.7",
83
83
  "@types/react-slider": "1.3.6",
84
84
  "jest": "30.2.0",
85
85
  "react": "18.3.1",
86
86
  "react-dom": "18.3.1",
87
87
  "require-from-string": "2.0.2",
88
- "storybook": "10.2.3",
88
+ "storybook": "10.2.11",
89
89
  "ts-dedent": "2.2.0",
90
90
  "typescript": "5.9.3",
91
91
  "webpack": "5.105.2",