@automattic/jetpack-shared-extension-utils 0.1.1 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.0] - 2022-03-15
9
+ ### Added
10
+ - Moved with-has-warning-is-interactive-class-names folder from jetpack plugin shared extensions
11
+
8
12
  ## [0.1.1] - 2022-03-02
9
13
  ### Changed
10
14
  - Updated package dependencies
@@ -21,4 +25,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
25
  ### Changed
22
26
  - Core: prepare utility for release
23
27
 
28
+ [0.2.0]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.1.1...0.2.0
24
29
  [0.1.1]: https://github.com/Automattic/jetpack-shared-extension-utils/compare/0.1.0...0.1.1
package/index.js CHANGED
@@ -3,3 +3,4 @@ export { default as getSiteFragment } from './src/get-site-fragment';
3
3
  export { isSimpleSite, isAtomicSite, isPrivateSite } from './src/site-type-utils';
4
4
  export { default as getJetpackExtensionAvailability } from './src/get-jetpack-extension-availability';
5
5
  export { default as registerJetpackPlugin } from './src/register-jetpack-plugin';
6
+ export { default as withHasWarningIsInteractiveClassNames } from './src/with-has-warning-is-interactive-class-names';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-shared-extension-utils",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Utility functions used by the block editor extensions",
5
5
  "homepage": "https://jetpack.com",
6
6
  "bugs": {
@@ -16,9 +16,12 @@
16
16
  "test": "NODE_ENV=test NODE_PATH=tests:. js-test-runner --jsdom --initfile=test-main.jsx 'glob:./!(node_modules)/**/test/*.@(jsx|js)'"
17
17
  },
18
18
  "dependencies": {
19
- "@wordpress/plugins": "4.1.3"
19
+ "@wordpress/compose": "5.1.2",
20
+ "@wordpress/plugins": "4.1.1"
20
21
  },
21
22
  "devDependencies": {
23
+ "@babel/core": "7.16.0",
24
+ "@babel/preset-react": "7.16.0",
22
25
  "jetpack-js-test-runner": "workspace:*",
23
26
  "nyc": "15.1.0"
24
27
  },
@@ -0,0 +1,23 @@
1
+ /* eslint-disable react/react-in-jsx-scope */
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import { createHigherOrderComponent } from '@wordpress/compose';
7
+
8
+ import './style.scss';
9
+
10
+ // Injecting the `has-warning` class into the block wrapper component gives us
11
+ // the right kind of borders around the block, both visually and conceptually.
12
+ // However, it also adds styling to prevent user interaction with that block.
13
+ // We thus add a new `is-interactive` class to be able to override that behavior.
14
+ export default name =>
15
+ createHigherOrderComponent(
16
+ BlockListBlock => props => (
17
+ <BlockListBlock
18
+ { ...props }
19
+ className={ props.name === name ? 'has-warning is-interactive' : props.className }
20
+ />
21
+ ),
22
+ 'withHasWarningIsInteractiveClassNames'
23
+ );
@@ -0,0 +1,13 @@
1
+ .block-editor-block-list__layout
2
+ // Override core styles inherited from `.has-warning`:
3
+ // we do want blocks with upgrade nudge warning to be interactive
4
+ .block-editor-block-list__block.has-warning.is-interactive {
5
+ > * {
6
+ pointer-events: auto;
7
+ user-select: auto;
8
+ }
9
+
10
+ &:after {
11
+ content: none;
12
+ }
13
+ }