@wordpress/components 21.1.0 → 21.1.2-next.4d3b314fd5.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 +18 -0
- package/build/draggable/index.js +3 -6
- package/build/draggable/index.js.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/menu-item/index.js +4 -3
- package/build/menu-item/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +10 -3
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -3
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/sub-sheet/index.native.js +4 -1
- package/build/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build/mobile/color-settings/index.native.js +3 -1
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/color-settings/picker-screen.native.js +3 -1
- package/build/mobile/color-settings/picker-screen.native.js.map +1 -1
- package/build/mobile/image/index.native.js +3 -1
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-avoiding-view/index.ios.js +3 -1
- package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +3 -1
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +3 -1
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-screen.native.js +3 -1
- package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build/mobile/link-settings/index.native.js +24 -6
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-screen.native.js +3 -1
- package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +6 -2
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js +6 -2
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build/notice/index.native.js +15 -19
- package/build/notice/index.native.js.map +1 -1
- package/build/notice/list.native.js +2 -3
- package/build/notice/list.native.js.map +1 -1
- package/build/palette-edit/index.js +1 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/popover/index.js +29 -32
- package/build/popover/index.js.map +1 -1
- package/build/popover/limit-shift.js +145 -0
- package/build/popover/limit-shift.js.map +1 -0
- package/build/popover/utils.js +55 -15
- package/build/popover/utils.js.map +1 -1
- package/build/tools-panel/styles.js +27 -12
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +19 -6
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/hook.js +4 -0
- package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build-module/draggable/index.js +2 -5
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/menu-item/index.js +4 -3
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +10 -3
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -3
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +4 -1
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +3 -1
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/picker-screen.native.js +3 -1
- package/build-module/mobile/color-settings/picker-screen.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +3 -1
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js +3 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +3 -1
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +3 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-screen.native.js +3 -1
- package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +24 -6
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js +3 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +6 -2
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +6 -2
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build-module/notice/index.native.js +16 -21
- package/build-module/notice/index.native.js.map +1 -1
- package/build-module/notice/list.native.js +3 -3
- package/build-module/notice/list.native.js.map +1 -1
- package/build-module/palette-edit/index.js +1 -1
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/popover/index.js +31 -35
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/limit-shift.js +136 -0
- package/build-module/popover/limit-shift.js.map +1 -0
- package/build-module/popover/utils.js +55 -15
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/tools-panel/styles.js +23 -12
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +19 -7
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/hook.js +4 -0
- package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build-style/style-rtl.css +13 -2
- package/build-style/style.css +13 -2
- package/build-types/draggable/index.d.ts.map +1 -1
- package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts +3 -3
- package/build-types/menu-item/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/limit-shift.d.ts +87 -0
- package/build-types/popover/limit-shift.d.ts.map +1 -0
- package/build-types/popover/test/index.d.ts +2 -0
- package/build-types/popover/test/index.d.ts.map +1 -0
- package/build-types/popover/types.d.ts +1 -1
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +0 -32
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts +1 -1
- package/build-types/tools-panel/styles.d.ts +6 -0
- package/build-types/tools-panel/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -0
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +1 -0
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/draggable/index.js +2 -5
- package/src/index.js +1 -1
- package/src/menu-item/README.md +7 -0
- package/src/menu-item/index.js +11 -5
- package/src/menu-item/style.scss +1 -0
- package/src/menu-item/test/index.js +36 -0
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +9 -0
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +11 -0
- package/src/mobile/bottom-sheet/sub-sheet/index.native.js +3 -0
- package/src/mobile/color-settings/index.native.js +3 -0
- package/src/mobile/color-settings/picker-screen.native.js +3 -0
- package/src/mobile/image/index.native.js +3 -0
- package/src/mobile/keyboard-avoiding-view/index.ios.js +3 -0
- package/src/mobile/link-picker/index.native.js +3 -0
- package/src/mobile/link-picker/link-picker-results.native.js +3 -0
- package/src/mobile/link-picker/link-picker-screen.native.js +3 -0
- package/src/mobile/link-settings/index.native.js +18 -0
- package/src/mobile/link-settings/link-settings-screen.native.js +3 -0
- package/src/mobile/segmented-control/index.native.js +6 -0
- package/src/mobile/utils/use-unit-converter-to-mobile.native.js +6 -0
- package/src/notice/index.native.js +17 -20
- package/src/notice/list.native.js +7 -3
- package/src/palette-edit/index.js +1 -1
- package/src/placeholder/style.scss +1 -1
- package/src/popover/index.tsx +26 -42
- package/src/popover/limit-shift.ts +205 -0
- package/src/popover/test/index.tsx +230 -0
- package/src/popover/types.ts +1 -0
- package/src/popover/utils.ts +58 -16
- package/src/range-control/types.ts +0 -33
- package/src/tools-panel/stories/index.js +27 -0
- package/src/tools-panel/styles.ts +28 -1
- package/src/tools-panel/tools-panel-header/component.tsx +12 -5
- package/src/tools-panel/tools-panel-header/hook.ts +5 -0
- package/src/tools-panel/types.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/popover/test/__snapshots__/index.js.snap +0 -34
- package/src/popover/test/index.js +0 -164
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 21.1.1-next.0 (2022-09-27)
|
|
6
|
+
|
|
7
|
+
### Bug Fix
|
|
8
|
+
|
|
9
|
+
- `Popover`: fix limitShift logic by adding iframe offset correctly [#42950](https://github.com/WordPress/gutenberg/pull/42950)).
|
|
10
|
+
- `Popover`: refine position-to-placement conversion logic, add tests ([#44377](https://github.com/WordPress/gutenberg/pull/44377)).
|
|
11
|
+
|
|
12
|
+
### Internal
|
|
13
|
+
|
|
14
|
+
- `Mobile` updated to ignore `react/exhaustive-deps` eslint rule ([#44207](https://github.com/WordPress/gutenberg/pull/44207)).
|
|
15
|
+
- `Popover`: refactor unit tests to TypeScript and modern RTL assertions ([#44373](https://github.com/WordPress/gutenberg/pull/44373)).
|
|
16
|
+
|
|
5
17
|
## 21.1.0 (2022-09-21)
|
|
6
18
|
|
|
7
19
|
### Deprecations
|
|
@@ -13,11 +25,17 @@
|
|
|
13
25
|
- `Button`: Remove unexpected `has-text` class when empty children are passed ([#44198](https://github.com/WordPress/gutenberg/pull/44198)).
|
|
14
26
|
- The `LinkedButton` to unlink sides in `BoxControl`, `BorderBoxControl` and `BorderRadiusControl` have changed from a rectangular primary button to an icon-only button, with a sentence case tooltip, and default-size icon for better legibility. The `Button` component has been fixed so when `isSmall` and `icon` props are set, and no text is present, the button shape is square rather than rectangular.
|
|
15
27
|
|
|
28
|
+
### New Features
|
|
29
|
+
|
|
30
|
+
- `MenuItem`: Add suffix prop for injecting non-icon and non-shortcut content to menu items ([#44260](https://github.com/WordPress/gutenberg/pull/44260)).
|
|
31
|
+
- `ToolsPanel`: Add subheadings to ellipsis menu and reset text to default control menu items ([#44260](https://github.com/WordPress/gutenberg/pull/44260)).
|
|
32
|
+
|
|
16
33
|
### Internal
|
|
17
34
|
|
|
18
35
|
- `NavigationMenu` updated to ignore `react/exhaustive-deps` eslint rule ([#44090](https://github.com/WordPress/gutenberg/pull/44090)).
|
|
19
36
|
- `RangeControl`: updated to pass `react/exhaustive-deps` eslint rule ([#44271](https://github.com/WordPress/gutenberg/pull/44271)).
|
|
20
37
|
- `UnitControl` updated to pass the `react/exhaustive-deps` eslint rule ([#44161](https://github.com/WordPress/gutenberg/pull/44161)).
|
|
38
|
+
- `Notice`: updated to satisfy `react/exhaustive-deps` eslint rule ([#44157](https://github.com/WordPress/gutenberg/pull/44157))
|
|
21
39
|
|
|
22
40
|
## 21.0.0 (2022-09-13)
|
|
23
41
|
|
package/build/draggable/index.js
CHANGED
|
@@ -7,15 +7,11 @@ exports.default = Draggable;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _compose = require("@wordpress/compose");
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* External dependencies
|
|
18
|
-
*/
|
|
19
15
|
const dragImageClass = 'components-draggable__invisible-drag-image';
|
|
20
16
|
const cloneWrapperClass = 'components-draggable__clone';
|
|
21
17
|
const clonePadding = 0;
|
|
@@ -173,9 +169,10 @@ function Draggable(_ref) {
|
|
|
173
169
|
}
|
|
174
170
|
} // Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,
|
|
175
171
|
// note that browsers may throttle raf below 60fps in certain conditions.
|
|
172
|
+
// @ts-ignore
|
|
176
173
|
|
|
177
174
|
|
|
178
|
-
const throttledDragOver = (0,
|
|
175
|
+
const throttledDragOver = (0, _compose.throttle)(over, 16);
|
|
179
176
|
ownerDocument.addEventListener('dragover', throttledDragOver); // Update cursor to 'grabbing', document wide.
|
|
180
177
|
|
|
181
178
|
ownerDocument.body.classList.add(bodyClass); // Allow the Synthetic Event to be accessed from asynchronous code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/draggable/index.js"],"names":["dragImageClass","cloneWrapperClass","clonePadding","bodyClass","Draggable","children","onDragStart","onDragOver","onDragEnd","cloneClassname","elementId","transferData","__experimentalTransferDataType","transferDataType","__experimentalDragComponent","dragComponent","dragComponentRef","cleanup","end","event","preventDefault","current","start","ownerDocument","target","dataTransfer","setData","JSON","stringify","cloneWrapper","createElement","style","top","left","dragImage","setDragImage","classList","add","body","appendChild","x","y","clientX","clientY","transform","clonedDragComponent","innerHTML","element","getElementById","elementRect","getBoundingClientRect","elementWrapper","parentNode","elementTopOffset","parseInt","elementLeftOffset","width","clone","cloneNode","id","Array","from","querySelectorAll","forEach","child","removeChild","cursorLeft","cursorTop","over","e","nextX","nextY","throttledDragOver","addEventListener","persist","timerId","setTimeout","remove","removeEventListener","clearTimeout","onDraggableStart","onDraggableEnd","display"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,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,UAAb,CAAwBa,WAAxB,CAAqCpC,YAArC;AACA;;AAED,UAAKK,SAAS,IAAIA,SAAS,CAACkB,UAA5B,EAAyC;AACxClB,QAAAA,SAAS,CAACkB,UAAV,CAAqBa,WAArB,CAAkC/B,SAAlC;AACA,OARsB,CAUvB;;;AACAX,MAAAA,aAAa,CAACe,IAAd,CAAmBF,SAAnB,CAA6ByC,MAA7B,CAAqC1E,SAArC;AAEAoB,MAAAA,aAAa,CAACuD,mBAAd,CAAmC,UAAnC,EAA+CN,iBAA/C;AAEAO,MAAAA,YAAY,CAAEJ,OAAF,CAAZ;AACA,KAhBD;AAiBA;;AAED,0BACC,MAAM,MAAM;AACX1D,IAAAA,OAAO,CAACI,OAAR;AACA,GAHF,EAIC,EAJD;AAOA,SACC,qDACGhB,QAAQ,CAAE;AACX2E,IAAAA,gBAAgB,EAAE1D,KADP;AAEX2D,IAAAA,cAAc,EAAE/D;AAFL,GAAF,CADX,EAKGH,aAAa,IACd;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,KAAK,EAAG;AAAEmE,MAAAA,OAAO,EAAE;AAAX,KAFT;AAGC,IAAA,GAAG,EAAGlE;AAHP,KAKGD,aALH,CANF,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport { throttle } from 'lodash';\n\nconst dragImageClass = 'components-draggable__invisible-drag-image';\nconst cloneWrapperClass = 'components-draggable__clone';\nconst clonePadding = 0;\nconst bodyClass = 'is-dragging-components-draggable';\n\n/**\n * @typedef RenderProp\n * @property {(event: import('react').DragEvent) => void} onDraggableStart `onDragStart` handler.\n * @property {(event: import('react').DragEvent) => void} onDraggableEnd `onDragEnd` handler.\n */\n\n/**\n * @typedef Props\n * @property {(props: RenderProp) => JSX.Element | null} children Children.\n * @property {(event: import('react').DragEvent) => void} [onDragStart] Callback when dragging starts.\n * @property {(event: import('react').DragEvent) => void} [onDragOver] Callback when dragging happens over the document.\n * @property {(event: import('react').DragEvent) => void} [onDragEnd] Callback when dragging ends.\n * @property {string} [cloneClassname] Classname for the cloned element.\n * @property {string} [elementId] ID for the element.\n * @property {any} [transferData] Transfer data for the drag event.\n * @property {string} [__experimentalTransferDataType] The transfer data type to set.\n * @property {import('react').ReactNode} __experimentalDragComponent Component to show when dragging.\n */\n\n/**\n * @param {Props} props\n * @return {JSX.Element} A draggable component.\n */\nexport default function Draggable( {\n\tchildren,\n\tonDragStart,\n\tonDragOver,\n\tonDragEnd,\n\tcloneClassname,\n\telementId,\n\ttransferData,\n\t__experimentalTransferDataType: transferDataType = 'text',\n\t__experimentalDragComponent: dragComponent,\n} ) {\n\t/** @type {import('react').MutableRefObject<HTMLDivElement | null>} */\n\tconst dragComponentRef = useRef( null );\n\tconst cleanup = useRef( () => {} );\n\n\t/**\n\t * Removes the element clone, resets cursor, and removes drag listener.\n\t *\n\t * @param {import('react').DragEvent} event The non-custom DragEvent.\n\t */\n\tfunction end( event ) {\n\t\tevent.preventDefault();\n\t\tcleanup.current();\n\n\t\tif ( onDragEnd ) {\n\t\t\tonDragEnd( event );\n\t\t}\n\t}\n\n\t/**\n\t * This method does a couple of things:\n\t *\n\t * - Clones the current element and spawns clone over original element.\n\t * - Adds a fake temporary drag image to avoid browser defaults.\n\t * - Sets transfer data.\n\t * - Adds dragover listener.\n\t *\n\t * @param {import('react').DragEvent} event The non-custom DragEvent.\n\t */\n\tfunction start( event ) {\n\t\t// @ts-ignore We know that ownerDocument does exist on an Element\n\t\tconst { ownerDocument } = event.target;\n\n\t\tevent.dataTransfer.setData(\n\t\t\ttransferDataType,\n\t\t\tJSON.stringify( transferData )\n\t\t);\n\n\t\tconst cloneWrapper = ownerDocument.createElement( 'div' );\n\t\t// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n\t\tcloneWrapper.style.top = 0;\n\t\tcloneWrapper.style.left = 0;\n\n\t\tconst dragImage = ownerDocument.createElement( 'div' );\n\n\t\t// Set a fake drag image to avoid browser defaults. Remove from DOM\n\t\t// right after. event.dataTransfer.setDragImage is not supported yet in\n\t\t// IE, we need to check for its existence first.\n\t\tif ( 'function' === typeof event.dataTransfer.setDragImage ) {\n\t\t\tdragImage.classList.add( dragImageClass );\n\t\t\townerDocument.body.appendChild( dragImage );\n\t\t\tevent.dataTransfer.setDragImage( dragImage, 0, 0 );\n\t\t}\n\n\t\tcloneWrapper.classList.add( cloneWrapperClass );\n\n\t\tif ( cloneClassname ) {\n\t\t\tcloneWrapper.classList.add( cloneClassname );\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\t// If a dragComponent is defined, the following logic will clone the\n\t\t// HTML node and inject it into the cloneWrapper.\n\t\tif ( dragComponentRef.current ) {\n\t\t\t// Position dragComponent at the same position as the cursor.\n\t\t\tx = event.clientX;\n\t\t\ty = event.clientY;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\tconst clonedDragComponent = ownerDocument.createElement( 'div' );\n\t\t\tclonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n\t\t\tcloneWrapper.appendChild( clonedDragComponent );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t} else {\n\t\t\tconst element = ownerDocument.getElementById( elementId );\n\n\t\t\t// Prepare element clone and append to element wrapper.\n\t\t\tconst elementRect = element.getBoundingClientRect();\n\t\t\tconst elementWrapper = element.parentNode;\n\t\t\tconst elementTopOffset = parseInt( elementRect.top, 10 );\n\t\t\tconst elementLeftOffset = parseInt( elementRect.left, 10 );\n\n\t\t\tcloneWrapper.style.width = `${\n\t\t\t\telementRect.width + clonePadding * 2\n\t\t\t}px`;\n\n\t\t\tconst clone = element.cloneNode( true );\n\t\t\tclone.id = `clone-${ elementId }`;\n\n\t\t\t// Position clone right over the original element (20px padding).\n\t\t\tx = elementLeftOffset - clonePadding;\n\t\t\ty = elementTopOffset - clonePadding;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\t// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n\t\t\tArray.from( clone.querySelectorAll( 'iframe' ) ).forEach(\n\t\t\t\t( child ) => child.parentNode.removeChild( child )\n\t\t\t);\n\n\t\t\tcloneWrapper.appendChild( clone );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\telementWrapper.appendChild( cloneWrapper );\n\t\t}\n\n\t\t// Mark the current cursor coordinates.\n\t\tlet cursorLeft = event.clientX;\n\t\tlet cursorTop = event.clientY;\n\n\t\t/**\n\t\t * @param {import('react').DragEvent<Element>} e\n\t\t */\n\t\tfunction over( e ) {\n\t\t\t// Skip doing any work if mouse has not moved.\n\t\t\tif ( cursorLeft === e.clientX && cursorTop === e.clientY ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextX = x + e.clientX - cursorLeft;\n\t\t\tconst nextY = y + e.clientY - cursorTop;\n\t\t\tcloneWrapper.style.transform = `translate( ${ nextX }px, ${ nextY }px )`;\n\t\t\tcursorLeft = e.clientX;\n\t\t\tcursorTop = e.clientY;\n\t\t\tx = nextX;\n\t\t\ty = nextY;\n\t\t\tif ( onDragOver ) {\n\t\t\t\tonDragOver( e );\n\t\t\t}\n\t\t}\n\n\t\t// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n\t\t// note that browsers may throttle raf below 60fps in certain conditions.\n\t\tconst throttledDragOver = throttle( over, 16 );\n\n\t\townerDocument.addEventListener( 'dragover', throttledDragOver );\n\n\t\t// Update cursor to 'grabbing', document wide.\n\t\townerDocument.body.classList.add( bodyClass );\n\n\t\t// Allow the Synthetic Event to be accessed from asynchronous code.\n\t\t// https://reactjs.org/docs/events.html#event-pooling\n\t\tevent.persist();\n\n\t\t/** @type {number | undefined} */\n\t\tlet timerId;\n\n\t\tif ( onDragStart ) {\n\t\t\ttimerId = setTimeout( () => onDragStart( event ) );\n\t\t}\n\n\t\tcleanup.current = () => {\n\t\t\t// Remove drag clone.\n\t\t\tif ( cloneWrapper && cloneWrapper.parentNode ) {\n\t\t\t\tcloneWrapper.parentNode.removeChild( cloneWrapper );\n\t\t\t}\n\n\t\t\tif ( dragImage && dragImage.parentNode ) {\n\t\t\t\tdragImage.parentNode.removeChild( dragImage );\n\t\t\t}\n\n\t\t\t// Reset cursor.\n\t\t\townerDocument.body.classList.remove( bodyClass );\n\n\t\t\townerDocument.removeEventListener( 'dragover', throttledDragOver );\n\n\t\t\tclearTimeout( timerId );\n\t\t};\n\t}\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tcleanup.current();\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ children( {\n\t\t\t\tonDraggableStart: start,\n\t\t\t\tonDraggableEnd: end,\n\t\t\t} ) }\n\t\t\t{ dragComponent && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-draggable-drag-component-root\"\n\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\tref={ dragComponentRef }\n\t\t\t\t>\n\t\t\t\t\t{ dragComponent }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/draggable/index.js"],"names":["dragImageClass","cloneWrapperClass","clonePadding","bodyClass","Draggable","children","onDragStart","onDragOver","onDragEnd","cloneClassname","elementId","transferData","__experimentalTransferDataType","transferDataType","__experimentalDragComponent","dragComponent","dragComponentRef","cleanup","end","event","preventDefault","current","start","ownerDocument","target","dataTransfer","setData","JSON","stringify","cloneWrapper","createElement","style","top","left","dragImage","setDragImage","classList","add","body","appendChild","x","y","clientX","clientY","transform","clonedDragComponent","innerHTML","element","getElementById","elementRect","getBoundingClientRect","elementWrapper","parentNode","elementTopOffset","parseInt","elementLeftOffset","width","clone","cloneNode","id","Array","from","querySelectorAll","forEach","child","removeChild","cursorLeft","cursorTop","over","e","nextX","nextY","throttledDragOver","addEventListener","persist","timerId","setTimeout","remove","removeEventListener","clearTimeout","onDraggableStart","onDraggableEnd","display"],"mappings":";;;;;;;AAIA;;AADA;;AAHA;AACA;AACA;AAIA,MAAMA,cAAc,GAAG,4CAAvB;AACA,MAAMC,iBAAiB,GAAG,6BAA1B;AACA,MAAMC,YAAY,GAAG,CAArB;AACA,MAAMC,SAAS,GAAG,kCAAlB;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AACe,SAASC,SAAT,OAUX;AAAA,MAV+B;AAClCC,IAAAA,QADkC;AAElCC,IAAAA,WAFkC;AAGlCC,IAAAA,UAHkC;AAIlCC,IAAAA,SAJkC;AAKlCC,IAAAA,cALkC;AAMlCC,IAAAA,SANkC;AAOlCC,IAAAA,YAPkC;AAQlCC,IAAAA,8BAA8B,EAAEC,gBAAgB,GAAG,MARjB;AASlCC,IAAAA,2BAA2B,EAAEC;AATK,GAU/B;;AACH;AACA,QAAMC,gBAAgB,GAAG,qBAAQ,IAAR,CAAzB;AACA,QAAMC,OAAO,GAAG,qBAAQ,MAAM,CAAE,CAAhB,CAAhB;AAEA;AACD;AACA;AACA;AACA;;AACC,WAASC,GAAT,CAAcC,KAAd,EAAsB;AACrBA,IAAAA,KAAK,CAACC,cAAN;AACAH,IAAAA,OAAO,CAACI,OAAR;;AAEA,QAAKb,SAAL,EAAiB;AAChBA,MAAAA,SAAS,CAAEW,KAAF,CAAT;AACA;AACD;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACC,WAASG,KAAT,CAAgBH,KAAhB,EAAwB;AACvB;AACA,UAAM;AAAEI,MAAAA;AAAF,QAAoBJ,KAAK,CAACK,MAAhC;AAEAL,IAAAA,KAAK,CAACM,YAAN,CAAmBC,OAAnB,CACCb,gBADD,EAECc,IAAI,CAACC,SAAL,CAAgBjB,YAAhB,CAFD;AAKA,UAAMkB,YAAY,GAAGN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AAO,CAACI,OAAR,GAAkB,MAAM;AACvB;AACA,UAAKQ,YAAY,IAAIA,YAAY,CAACuB,UAAlC,EAA+C;AAC9CvB,QAAAA,YAAY,CAACuB,UAAb,CAAwBa,WAAxB,CAAqCpC,YAArC;AACA;;AAED,UAAKK,SAAS,IAAIA,SAAS,CAACkB,UAA5B,EAAyC;AACxClB,QAAAA,SAAS,CAACkB,UAAV,CAAqBa,WAArB,CAAkC/B,SAAlC;AACA,OARsB,CAUvB;;;AACAX,MAAAA,aAAa,CAACe,IAAd,CAAmBF,SAAnB,CAA6ByC,MAA7B,CAAqC1E,SAArC;AAEAoB,MAAAA,aAAa,CAACuD,mBAAd,CAAmC,UAAnC,EAA+CN,iBAA/C;AAEAO,MAAAA,YAAY,CAAEJ,OAAF,CAAZ;AACA,KAhBD;AAiBA;;AAED,0BACC,MAAM,MAAM;AACX1D,IAAAA,OAAO,CAACI,OAAR;AACA,GAHF,EAIC,EAJD;AAOA,SACC,qDACGhB,QAAQ,CAAE;AACX2E,IAAAA,gBAAgB,EAAE1D,KADP;AAEX2D,IAAAA,cAAc,EAAE/D;AAFL,GAAF,CADX,EAKGH,aAAa,IACd;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,KAAK,EAAG;AAAEmE,MAAAA,OAAO,EAAE;AAAX,KAFT;AAGC,IAAA,GAAG,EAAGlE;AAHP,KAKGD,aALH,CANF,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\n\nconst dragImageClass = 'components-draggable__invisible-drag-image';\nconst cloneWrapperClass = 'components-draggable__clone';\nconst clonePadding = 0;\nconst bodyClass = 'is-dragging-components-draggable';\n\n/**\n * @typedef RenderProp\n * @property {(event: import('react').DragEvent) => void} onDraggableStart `onDragStart` handler.\n * @property {(event: import('react').DragEvent) => void} onDraggableEnd `onDragEnd` handler.\n */\n\n/**\n * @typedef Props\n * @property {(props: RenderProp) => JSX.Element | null} children Children.\n * @property {(event: import('react').DragEvent) => void} [onDragStart] Callback when dragging starts.\n * @property {(event: import('react').DragEvent) => void} [onDragOver] Callback when dragging happens over the document.\n * @property {(event: import('react').DragEvent) => void} [onDragEnd] Callback when dragging ends.\n * @property {string} [cloneClassname] Classname for the cloned element.\n * @property {string} [elementId] ID for the element.\n * @property {any} [transferData] Transfer data for the drag event.\n * @property {string} [__experimentalTransferDataType] The transfer data type to set.\n * @property {import('react').ReactNode} __experimentalDragComponent Component to show when dragging.\n */\n\n/**\n * @param {Props} props\n * @return {JSX.Element} A draggable component.\n */\nexport default function Draggable( {\n\tchildren,\n\tonDragStart,\n\tonDragOver,\n\tonDragEnd,\n\tcloneClassname,\n\telementId,\n\ttransferData,\n\t__experimentalTransferDataType: transferDataType = 'text',\n\t__experimentalDragComponent: dragComponent,\n} ) {\n\t/** @type {import('react').MutableRefObject<HTMLDivElement | null>} */\n\tconst dragComponentRef = useRef( null );\n\tconst cleanup = useRef( () => {} );\n\n\t/**\n\t * Removes the element clone, resets cursor, and removes drag listener.\n\t *\n\t * @param {import('react').DragEvent} event The non-custom DragEvent.\n\t */\n\tfunction end( event ) {\n\t\tevent.preventDefault();\n\t\tcleanup.current();\n\n\t\tif ( onDragEnd ) {\n\t\t\tonDragEnd( event );\n\t\t}\n\t}\n\n\t/**\n\t * This method does a couple of things:\n\t *\n\t * - Clones the current element and spawns clone over original element.\n\t * - Adds a fake temporary drag image to avoid browser defaults.\n\t * - Sets transfer data.\n\t * - Adds dragover listener.\n\t *\n\t * @param {import('react').DragEvent} event The non-custom DragEvent.\n\t */\n\tfunction start( event ) {\n\t\t// @ts-ignore We know that ownerDocument does exist on an Element\n\t\tconst { ownerDocument } = event.target;\n\n\t\tevent.dataTransfer.setData(\n\t\t\ttransferDataType,\n\t\t\tJSON.stringify( transferData )\n\t\t);\n\n\t\tconst cloneWrapper = ownerDocument.createElement( 'div' );\n\t\t// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n\t\tcloneWrapper.style.top = 0;\n\t\tcloneWrapper.style.left = 0;\n\n\t\tconst dragImage = ownerDocument.createElement( 'div' );\n\n\t\t// Set a fake drag image to avoid browser defaults. Remove from DOM\n\t\t// right after. event.dataTransfer.setDragImage is not supported yet in\n\t\t// IE, we need to check for its existence first.\n\t\tif ( 'function' === typeof event.dataTransfer.setDragImage ) {\n\t\t\tdragImage.classList.add( dragImageClass );\n\t\t\townerDocument.body.appendChild( dragImage );\n\t\t\tevent.dataTransfer.setDragImage( dragImage, 0, 0 );\n\t\t}\n\n\t\tcloneWrapper.classList.add( cloneWrapperClass );\n\n\t\tif ( cloneClassname ) {\n\t\t\tcloneWrapper.classList.add( cloneClassname );\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\t// If a dragComponent is defined, the following logic will clone the\n\t\t// HTML node and inject it into the cloneWrapper.\n\t\tif ( dragComponentRef.current ) {\n\t\t\t// Position dragComponent at the same position as the cursor.\n\t\t\tx = event.clientX;\n\t\t\ty = event.clientY;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\tconst clonedDragComponent = ownerDocument.createElement( 'div' );\n\t\t\tclonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n\t\t\tcloneWrapper.appendChild( clonedDragComponent );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t} else {\n\t\t\tconst element = ownerDocument.getElementById( elementId );\n\n\t\t\t// Prepare element clone and append to element wrapper.\n\t\t\tconst elementRect = element.getBoundingClientRect();\n\t\t\tconst elementWrapper = element.parentNode;\n\t\t\tconst elementTopOffset = parseInt( elementRect.top, 10 );\n\t\t\tconst elementLeftOffset = parseInt( elementRect.left, 10 );\n\n\t\t\tcloneWrapper.style.width = `${\n\t\t\t\telementRect.width + clonePadding * 2\n\t\t\t}px`;\n\n\t\t\tconst clone = element.cloneNode( true );\n\t\t\tclone.id = `clone-${ elementId }`;\n\n\t\t\t// Position clone right over the original element (20px padding).\n\t\t\tx = elementLeftOffset - clonePadding;\n\t\t\ty = elementTopOffset - clonePadding;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\t// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n\t\t\tArray.from( clone.querySelectorAll( 'iframe' ) ).forEach(\n\t\t\t\t( child ) => child.parentNode.removeChild( child )\n\t\t\t);\n\n\t\t\tcloneWrapper.appendChild( clone );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\telementWrapper.appendChild( cloneWrapper );\n\t\t}\n\n\t\t// Mark the current cursor coordinates.\n\t\tlet cursorLeft = event.clientX;\n\t\tlet cursorTop = event.clientY;\n\n\t\t/**\n\t\t * @param {import('react').DragEvent<Element>} e\n\t\t */\n\t\tfunction over( e ) {\n\t\t\t// Skip doing any work if mouse has not moved.\n\t\t\tif ( cursorLeft === e.clientX && cursorTop === e.clientY ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextX = x + e.clientX - cursorLeft;\n\t\t\tconst nextY = y + e.clientY - cursorTop;\n\t\t\tcloneWrapper.style.transform = `translate( ${ nextX }px, ${ nextY }px )`;\n\t\t\tcursorLeft = e.clientX;\n\t\t\tcursorTop = e.clientY;\n\t\t\tx = nextX;\n\t\t\ty = nextY;\n\t\t\tif ( onDragOver ) {\n\t\t\t\tonDragOver( e );\n\t\t\t}\n\t\t}\n\n\t\t// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n\t\t// note that browsers may throttle raf below 60fps in certain conditions.\n\t\t// @ts-ignore\n\t\tconst throttledDragOver = throttle( over, 16 );\n\n\t\townerDocument.addEventListener( 'dragover', throttledDragOver );\n\n\t\t// Update cursor to 'grabbing', document wide.\n\t\townerDocument.body.classList.add( bodyClass );\n\n\t\t// Allow the Synthetic Event to be accessed from asynchronous code.\n\t\t// https://reactjs.org/docs/events.html#event-pooling\n\t\tevent.persist();\n\n\t\t/** @type {number | undefined} */\n\t\tlet timerId;\n\n\t\tif ( onDragStart ) {\n\t\t\ttimerId = setTimeout( () => onDragStart( event ) );\n\t\t}\n\n\t\tcleanup.current = () => {\n\t\t\t// Remove drag clone.\n\t\t\tif ( cloneWrapper && cloneWrapper.parentNode ) {\n\t\t\t\tcloneWrapper.parentNode.removeChild( cloneWrapper );\n\t\t\t}\n\n\t\t\tif ( dragImage && dragImage.parentNode ) {\n\t\t\t\tdragImage.parentNode.removeChild( dragImage );\n\t\t\t}\n\n\t\t\t// Reset cursor.\n\t\t\townerDocument.body.classList.remove( bodyClass );\n\n\t\t\townerDocument.removeEventListener( 'dragover', throttledDragOver );\n\n\t\t\tclearTimeout( timerId );\n\t\t};\n\t}\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tcleanup.current();\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ children( {\n\t\t\t\tonDraggableStart: start,\n\t\t\t\tonDraggableEnd: end,\n\t\t\t} ) }\n\t\t\t{ dragComponent && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-draggable-drag-component-root\"\n\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\tref={ dragComponentRef }\n\t\t\t\t>\n\t\t\t\t\t{ dragComponent }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -965,6 +965,12 @@ Object.defineProperty(exports, "__experimentalZStack", {
|
|
|
965
965
|
return _zStack.ZStack;
|
|
966
966
|
}
|
|
967
967
|
});
|
|
968
|
+
Object.defineProperty(exports, "__unstableAnimatePresence", {
|
|
969
|
+
enumerable: true,
|
|
970
|
+
get: function () {
|
|
971
|
+
return _animation.__unstableAnimatePresence;
|
|
972
|
+
}
|
|
973
|
+
});
|
|
968
974
|
Object.defineProperty(exports, "__unstableComposite", {
|
|
969
975
|
enumerable: true,
|
|
970
976
|
get: function () {
|
package/build/index.js.map
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAYA;;AACA;;AAIA;;AACA;;AACA;;AAIA;;AACA;;AAMA;;AACA;;AAIA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA","sourcesContent":["// Primitives.\nexport {\n\tSVG,\n\tPath,\n\tCircle,\n\tPolygon,\n\tRect,\n\tG,\n\tHorizontalRule,\n\tBlockQuotation,\n} from '@wordpress/primitives';\n\n// Components.\nexport { default as __experimentalAlignmentMatrixControl } from './alignment-matrix-control';\nexport {\n\tdefault as Animate,\n\tgetAnimateClassName as __unstableGetAnimateClassName,\n} from './animate';\nexport { __unstableMotion } from './animation';\nexport { default as AnglePickerControl } from './angle-picker-control';\nexport {\n\tdefault as Autocomplete,\n\tuseAutocompleteProps as __unstableUseAutocompleteProps,\n} from './autocomplete';\nexport { default as BaseControl } from './base-control';\nexport {\n\tBorderBoxControl as __experimentalBorderBoxControl,\n\thasSplitBorders as __experimentalHasSplitBorders,\n\tisDefinedBorder as __experimentalIsDefinedBorder,\n\tisEmptyBorder as __experimentalIsEmptyBorder,\n} from './border-box-control';\nexport { BorderControl as __experimentalBorderControl } from './border-control';\nexport {\n\tdefault as __experimentalBoxControl,\n\tapplyValueToSides as __experimentalApplyValueToSides,\n} from './box-control';\nexport { default as Button } from './button';\nexport { default as ButtonGroup } from './button-group';\nexport {\n\tCard,\n\tCardBody,\n\tCardDivider,\n\tCardFooter,\n\tCardHeader,\n\tCardMedia,\n} from './card';\nexport { default as CheckboxControl } from './checkbox-control';\nexport { default as ClipboardButton } from './clipboard-button';\nexport { default as __experimentalPaletteEdit } from './palette-edit';\nexport { default as ColorIndicator } from './color-indicator';\nexport { default as ColorPalette } from './color-palette';\nexport { ColorPicker } from './color-picker';\nexport { default as ComboboxControl } from './combobox-control';\nexport {\n\tComposite as __unstableComposite,\n\tCompositeGroup as __unstableCompositeGroup,\n\tCompositeItem as __unstableCompositeItem,\n\tuseCompositeState as __unstableUseCompositeState,\n} from './composite';\nexport { ConfirmDialog as __experimentalConfirmDialog } from './confirm-dialog';\nexport { default as CustomSelectControl } from './custom-select-control';\nexport { default as Dashicon } from './dashicon';\nexport { default as DateTimePicker, DatePicker, TimePicker } from './date-time';\nexport { default as __experimentalDimensionControl } from './dimension-control';\nexport { default as Disabled } from './disabled';\nexport { DisclosureContent as __unstableDisclosureContent } from './disclosure';\nexport { Divider as __experimentalDivider } from './divider';\nexport { default as Draggable } from './draggable';\nexport { default as DropZone } from './drop-zone';\nexport { default as DropZoneProvider } from './drop-zone/provider';\nexport { default as Dropdown } from './dropdown';\nexport { default as __experimentalDropdownContentWrapper } from './dropdown/dropdown-content-wrapper';\nexport { default as DropdownMenu } from './dropdown-menu';\nexport { DuotoneSwatch, DuotonePicker } from './duotone-picker';\nexport { Elevation as __experimentalElevation } from './elevation';\nexport { default as ExternalLink } from './external-link';\nexport { Flex, FlexBlock, FlexItem } from './flex';\nexport { default as FocalPointPicker } from './focal-point-picker';\nexport { default as FocusableIframe } from './focusable-iframe';\nexport { default as FontSizePicker } from './font-size-picker';\nexport { default as FormFileUpload } from './form-file-upload';\nexport { default as FormToggle } from './form-toggle';\nexport { default as FormTokenField } from './form-token-field';\nexport { default as GradientPicker } from './gradient-picker';\nexport { default as CustomGradientPicker } from './custom-gradient-picker';\nexport { Grid as __experimentalGrid } from './grid';\nexport { default as Guide } from './guide';\nexport { default as GuidePage } from './guide/page';\nexport { Heading as __experimentalHeading } from './heading';\nexport { HStack as __experimentalHStack } from './h-stack';\nexport { default as Icon } from './icon';\nexport { default as IconButton } from './button/deprecated';\nexport {\n\tItemGroup as __experimentalItemGroup,\n\tItem as __experimentalItem,\n} from './item-group';\nexport { default as __experimentalInputControl } from './input-control';\nexport { default as __experimentalInputControlPrefixWrapper } from './input-control/input-prefix-wrapper';\nexport { default as __experimentalInputControlSuffixWrapper } from './input-control/input-suffix-wrapper';\nexport { default as KeyboardShortcuts } from './keyboard-shortcuts';\nexport { default as MenuGroup } from './menu-group';\nexport { default as MenuItem } from './menu-item';\nexport { default as MenuItemsChoice } from './menu-items-choice';\nexport { default as Modal } from './modal';\nexport { default as ScrollLock } from './scroll-lock';\nexport { NavigableMenu, TabbableContainer } from './navigable-container';\nexport { default as __experimentalNavigation } from './navigation';\nexport { default as __experimentalNavigationBackButton } from './navigation/back-button';\nexport { default as __experimentalNavigationGroup } from './navigation/group';\nexport { default as __experimentalNavigationItem } from './navigation/item';\nexport { default as __experimentalNavigationMenu } from './navigation/menu';\nexport {\n\tNavigatorProvider as __experimentalNavigatorProvider,\n\tNavigatorScreen as __experimentalNavigatorScreen,\n\tNavigatorButton as __experimentalNavigatorButton,\n\tNavigatorBackButton as __experimentalNavigatorBackButton,\n\tuseNavigator as __experimentalUseNavigator,\n} from './navigator';\nexport { default as Notice } from './notice';\nexport { default as __experimentalNumberControl } from './number-control';\nexport { default as NoticeList } from './notice/list';\nexport { default as Panel } from './panel';\nexport { default as PanelBody } from './panel/body';\nexport { default as PanelHeader } from './panel/header';\nexport { default as PanelRow } from './panel/row';\nexport { default as Placeholder } from './placeholder';\nexport { default as Popover } from './popover';\nexport { default as QueryControls } from './query-controls';\nexport { default as __experimentalRadio } from './radio';\nexport { default as __experimentalRadioGroup } from './radio-group';\nexport { default as RadioControl } from './radio-control';\nexport { default as RangeControl } from './range-control';\nexport { default as ResizableBox } from './resizable-box';\nexport { default as ResponsiveWrapper } from './responsive-wrapper';\nexport { default as SandBox } from './sandbox';\nexport { default as SearchControl } from './search-control';\nexport { default as SelectControl } from './select-control';\nexport { default as Snackbar } from './snackbar';\nexport { default as SnackbarList } from './snackbar/list';\nexport { Spacer as __experimentalSpacer } from './spacer';\nexport { Scrollable as __experimentalScrollable } from './scrollable';\nexport { default as Spinner } from './spinner';\nexport { Surface as __experimentalSurface } from './surface';\nexport { default as TabPanel } from './tab-panel';\nexport { Text as __experimentalText } from './text';\nexport { default as TextControl } from './text-control';\nexport { default as TextareaControl } from './textarea-control';\nexport { default as TextHighlight } from './text-highlight';\nexport { default as Tip } from './tip';\nexport { default as ToggleControl } from './toggle-control';\nexport {\n\tToggleGroupControl as __experimentalToggleGroupControl,\n\tToggleGroupControlOption as __experimentalToggleGroupControlOption,\n\tToggleGroupControlOptionIcon as __experimentalToggleGroupControlOptionIcon,\n} from './toggle-group-control';\nexport { default as Toolbar } from './toolbar';\nexport { default as ToolbarButton } from './toolbar-button';\nexport { default as ToolbarDropdownMenu } from './toolbar-dropdown-menu';\nexport { default as __experimentalToolbarContext } from './toolbar-context';\nexport { default as ToolbarGroup } from './toolbar-group';\nexport { default as ToolbarItem } from './toolbar-item';\nexport {\n\tToolsPanel as __experimentalToolsPanel,\n\tToolsPanelItem as __experimentalToolsPanelItem,\n\tToolsPanelContext as __experimentalToolsPanelContext,\n} from './tools-panel';\nexport { default as Tooltip } from './tooltip';\nexport {\n\tdefault as __experimentalTreeGrid,\n\tTreeGridRow as __experimentalTreeGridRow,\n\tTreeGridCell as __experimentalTreeGridCell,\n\tTreeGridItem as __experimentalTreeGridItem,\n} from './tree-grid';\nexport { default as TreeSelect } from './tree-select';\nexport { Truncate as __experimentalTruncate } from './truncate';\nexport {\n\tdefault as __experimentalUnitControl,\n\tuseCustomUnits as __experimentalUseCustomUnits,\n\tparseQuantityAndUnitFromRawValue as __experimentalParseQuantityAndUnitFromRawValue,\n} from './unit-control';\nexport { View as __experimentalView } from './view';\nexport { VisuallyHidden } from './visually-hidden';\nexport { VStack as __experimentalVStack } from './v-stack';\nexport { default as IsolatedEventContainer } from './isolated-event-container';\nexport {\n\tcreateSlotFill,\n\tSlot,\n\tFill,\n\tProvider as SlotFillProvider,\n\tuseSlot as __experimentalUseSlot,\n} from './slot-fill';\nexport { default as __experimentalStyleProvider } from './style-provider';\nexport { ZStack as __experimentalZStack } from './z-stack';\n\n// Higher-Order Components.\nexport {\n\tdefault as navigateRegions,\n\tuseNavigateRegions as __unstableUseNavigateRegions,\n} from './higher-order/navigate-regions';\nexport { default as withConstrainedTabbing } from './higher-order/with-constrained-tabbing';\nexport { default as withFallbackStyles } from './higher-order/with-fallback-styles';\nexport { default as withFilters } from './higher-order/with-filters';\nexport { default as withFocusOutside } from './higher-order/with-focus-outside';\nexport {\n\tdefault as withFocusReturn,\n\tProvider as FocusReturnProvider,\n} from './higher-order/with-focus-return';\nexport { default as withNotices } from './higher-order/with-notices';\nexport { default as withSpokenMessages } from './higher-order/with-spoken-messages';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AACA;;AAIA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA","sourcesContent":["// Primitives.\nexport {\n\tSVG,\n\tPath,\n\tCircle,\n\tPolygon,\n\tRect,\n\tG,\n\tHorizontalRule,\n\tBlockQuotation,\n} from '@wordpress/primitives';\n\n// Components.\nexport { default as __experimentalAlignmentMatrixControl } from './alignment-matrix-control';\nexport {\n\tdefault as Animate,\n\tgetAnimateClassName as __unstableGetAnimateClassName,\n} from './animate';\nexport { __unstableMotion, __unstableAnimatePresence } from './animation';\nexport { default as AnglePickerControl } from './angle-picker-control';\nexport {\n\tdefault as Autocomplete,\n\tuseAutocompleteProps as __unstableUseAutocompleteProps,\n} from './autocomplete';\nexport { default as BaseControl } from './base-control';\nexport {\n\tBorderBoxControl as __experimentalBorderBoxControl,\n\thasSplitBorders as __experimentalHasSplitBorders,\n\tisDefinedBorder as __experimentalIsDefinedBorder,\n\tisEmptyBorder as __experimentalIsEmptyBorder,\n} from './border-box-control';\nexport { BorderControl as __experimentalBorderControl } from './border-control';\nexport {\n\tdefault as __experimentalBoxControl,\n\tapplyValueToSides as __experimentalApplyValueToSides,\n} from './box-control';\nexport { default as Button } from './button';\nexport { default as ButtonGroup } from './button-group';\nexport {\n\tCard,\n\tCardBody,\n\tCardDivider,\n\tCardFooter,\n\tCardHeader,\n\tCardMedia,\n} from './card';\nexport { default as CheckboxControl } from './checkbox-control';\nexport { default as ClipboardButton } from './clipboard-button';\nexport { default as __experimentalPaletteEdit } from './palette-edit';\nexport { default as ColorIndicator } from './color-indicator';\nexport { default as ColorPalette } from './color-palette';\nexport { ColorPicker } from './color-picker';\nexport { default as ComboboxControl } from './combobox-control';\nexport {\n\tComposite as __unstableComposite,\n\tCompositeGroup as __unstableCompositeGroup,\n\tCompositeItem as __unstableCompositeItem,\n\tuseCompositeState as __unstableUseCompositeState,\n} from './composite';\nexport { ConfirmDialog as __experimentalConfirmDialog } from './confirm-dialog';\nexport { default as CustomSelectControl } from './custom-select-control';\nexport { default as Dashicon } from './dashicon';\nexport { default as DateTimePicker, DatePicker, TimePicker } from './date-time';\nexport { default as __experimentalDimensionControl } from './dimension-control';\nexport { default as Disabled } from './disabled';\nexport { DisclosureContent as __unstableDisclosureContent } from './disclosure';\nexport { Divider as __experimentalDivider } from './divider';\nexport { default as Draggable } from './draggable';\nexport { default as DropZone } from './drop-zone';\nexport { default as DropZoneProvider } from './drop-zone/provider';\nexport { default as Dropdown } from './dropdown';\nexport { default as __experimentalDropdownContentWrapper } from './dropdown/dropdown-content-wrapper';\nexport { default as DropdownMenu } from './dropdown-menu';\nexport { DuotoneSwatch, DuotonePicker } from './duotone-picker';\nexport { Elevation as __experimentalElevation } from './elevation';\nexport { default as ExternalLink } from './external-link';\nexport { Flex, FlexBlock, FlexItem } from './flex';\nexport { default as FocalPointPicker } from './focal-point-picker';\nexport { default as FocusableIframe } from './focusable-iframe';\nexport { default as FontSizePicker } from './font-size-picker';\nexport { default as FormFileUpload } from './form-file-upload';\nexport { default as FormToggle } from './form-toggle';\nexport { default as FormTokenField } from './form-token-field';\nexport { default as GradientPicker } from './gradient-picker';\nexport { default as CustomGradientPicker } from './custom-gradient-picker';\nexport { Grid as __experimentalGrid } from './grid';\nexport { default as Guide } from './guide';\nexport { default as GuidePage } from './guide/page';\nexport { Heading as __experimentalHeading } from './heading';\nexport { HStack as __experimentalHStack } from './h-stack';\nexport { default as Icon } from './icon';\nexport { default as IconButton } from './button/deprecated';\nexport {\n\tItemGroup as __experimentalItemGroup,\n\tItem as __experimentalItem,\n} from './item-group';\nexport { default as __experimentalInputControl } from './input-control';\nexport { default as __experimentalInputControlPrefixWrapper } from './input-control/input-prefix-wrapper';\nexport { default as __experimentalInputControlSuffixWrapper } from './input-control/input-suffix-wrapper';\nexport { default as KeyboardShortcuts } from './keyboard-shortcuts';\nexport { default as MenuGroup } from './menu-group';\nexport { default as MenuItem } from './menu-item';\nexport { default as MenuItemsChoice } from './menu-items-choice';\nexport { default as Modal } from './modal';\nexport { default as ScrollLock } from './scroll-lock';\nexport { NavigableMenu, TabbableContainer } from './navigable-container';\nexport { default as __experimentalNavigation } from './navigation';\nexport { default as __experimentalNavigationBackButton } from './navigation/back-button';\nexport { default as __experimentalNavigationGroup } from './navigation/group';\nexport { default as __experimentalNavigationItem } from './navigation/item';\nexport { default as __experimentalNavigationMenu } from './navigation/menu';\nexport {\n\tNavigatorProvider as __experimentalNavigatorProvider,\n\tNavigatorScreen as __experimentalNavigatorScreen,\n\tNavigatorButton as __experimentalNavigatorButton,\n\tNavigatorBackButton as __experimentalNavigatorBackButton,\n\tuseNavigator as __experimentalUseNavigator,\n} from './navigator';\nexport { default as Notice } from './notice';\nexport { default as __experimentalNumberControl } from './number-control';\nexport { default as NoticeList } from './notice/list';\nexport { default as Panel } from './panel';\nexport { default as PanelBody } from './panel/body';\nexport { default as PanelHeader } from './panel/header';\nexport { default as PanelRow } from './panel/row';\nexport { default as Placeholder } from './placeholder';\nexport { default as Popover } from './popover';\nexport { default as QueryControls } from './query-controls';\nexport { default as __experimentalRadio } from './radio';\nexport { default as __experimentalRadioGroup } from './radio-group';\nexport { default as RadioControl } from './radio-control';\nexport { default as RangeControl } from './range-control';\nexport { default as ResizableBox } from './resizable-box';\nexport { default as ResponsiveWrapper } from './responsive-wrapper';\nexport { default as SandBox } from './sandbox';\nexport { default as SearchControl } from './search-control';\nexport { default as SelectControl } from './select-control';\nexport { default as Snackbar } from './snackbar';\nexport { default as SnackbarList } from './snackbar/list';\nexport { Spacer as __experimentalSpacer } from './spacer';\nexport { Scrollable as __experimentalScrollable } from './scrollable';\nexport { default as Spinner } from './spinner';\nexport { Surface as __experimentalSurface } from './surface';\nexport { default as TabPanel } from './tab-panel';\nexport { Text as __experimentalText } from './text';\nexport { default as TextControl } from './text-control';\nexport { default as TextareaControl } from './textarea-control';\nexport { default as TextHighlight } from './text-highlight';\nexport { default as Tip } from './tip';\nexport { default as ToggleControl } from './toggle-control';\nexport {\n\tToggleGroupControl as __experimentalToggleGroupControl,\n\tToggleGroupControlOption as __experimentalToggleGroupControlOption,\n\tToggleGroupControlOptionIcon as __experimentalToggleGroupControlOptionIcon,\n} from './toggle-group-control';\nexport { default as Toolbar } from './toolbar';\nexport { default as ToolbarButton } from './toolbar-button';\nexport { default as ToolbarDropdownMenu } from './toolbar-dropdown-menu';\nexport { default as __experimentalToolbarContext } from './toolbar-context';\nexport { default as ToolbarGroup } from './toolbar-group';\nexport { default as ToolbarItem } from './toolbar-item';\nexport {\n\tToolsPanel as __experimentalToolsPanel,\n\tToolsPanelItem as __experimentalToolsPanelItem,\n\tToolsPanelContext as __experimentalToolsPanelContext,\n} from './tools-panel';\nexport { default as Tooltip } from './tooltip';\nexport {\n\tdefault as __experimentalTreeGrid,\n\tTreeGridRow as __experimentalTreeGridRow,\n\tTreeGridCell as __experimentalTreeGridCell,\n\tTreeGridItem as __experimentalTreeGridItem,\n} from './tree-grid';\nexport { default as TreeSelect } from './tree-select';\nexport { Truncate as __experimentalTruncate } from './truncate';\nexport {\n\tdefault as __experimentalUnitControl,\n\tuseCustomUnits as __experimentalUseCustomUnits,\n\tparseQuantityAndUnitFromRawValue as __experimentalParseQuantityAndUnitFromRawValue,\n} from './unit-control';\nexport { View as __experimentalView } from './view';\nexport { VisuallyHidden } from './visually-hidden';\nexport { VStack as __experimentalVStack } from './v-stack';\nexport { default as IsolatedEventContainer } from './isolated-event-container';\nexport {\n\tcreateSlotFill,\n\tSlot,\n\tFill,\n\tProvider as SlotFillProvider,\n\tuseSlot as __experimentalUseSlot,\n} from './slot-fill';\nexport { default as __experimentalStyleProvider } from './style-provider';\nexport { ZStack as __experimentalZStack } from './z-stack';\n\n// Higher-Order Components.\nexport {\n\tdefault as navigateRegions,\n\tuseNavigateRegions as __unstableUseNavigateRegions,\n} from './higher-order/navigate-regions';\nexport { default as withConstrainedTabbing } from './higher-order/with-constrained-tabbing';\nexport { default as withFallbackStyles } from './higher-order/with-fallback-styles';\nexport { default as withFilters } from './higher-order/with-filters';\nexport { default as withFocusOutside } from './higher-order/with-focus-outside';\nexport {\n\tdefault as withFocusReturn,\n\tProvider as FocusReturnProvider,\n} from './higher-order/with-focus-return';\nexport { default as withNotices } from './higher-order/with-notices';\nexport { default as withSpokenMessages } from './higher-order/with-spoken-messages';\n"]}
|
package/build/menu-item/index.js
CHANGED
|
@@ -43,6 +43,7 @@ function MenuItem(props, ref) {
|
|
|
43
43
|
shortcut,
|
|
44
44
|
isSelected,
|
|
45
45
|
role = 'menuitem',
|
|
46
|
+
suffix,
|
|
46
47
|
...buttonProps
|
|
47
48
|
} = props;
|
|
48
49
|
className = (0, _classnames.default)('components-menu-item__button', className);
|
|
@@ -74,12 +75,12 @@ function MenuItem(props, ref) {
|
|
|
74
75
|
className: className
|
|
75
76
|
}, buttonProps), (0, _element.createElement)("span", {
|
|
76
77
|
className: "components-menu-item__item"
|
|
77
|
-
}, children), (0, _element.createElement)(_shortcut.default, {
|
|
78
|
+
}, children), !suffix && (0, _element.createElement)(_shortcut.default, {
|
|
78
79
|
className: "components-menu-item__shortcut",
|
|
79
80
|
shortcut: shortcut
|
|
80
|
-
}), icon && iconPosition === 'right' && (0, _element.createElement)(_icon.default, {
|
|
81
|
+
}), !suffix && icon && iconPosition === 'right' && (0, _element.createElement)(_icon.default, {
|
|
81
82
|
icon: icon
|
|
82
|
-
}));
|
|
83
|
+
}), suffix);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
var _default = (0, _element.forwardRef)(MenuItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/menu-item/index.js"],"names":["MenuItem","props","ref","children","info","className","icon","iconPosition","shortcut","isSelected","role","buttonProps","undefined"],"mappings":";;;;;;;;;;AASA;;;;AALA;;AAUA;;AACA;;AACA;;AAhBA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAKO,SAASA,QAAT,CAAmBC,KAAnB,EAA0BC,GAA1B,EAAgC;AACtC,MAAI;AACHC,IAAAA,QADG;AAEHC,IAAAA,IAFG;AAGHC,IAAAA,SAHG;AAIHC,IAAAA,IAJG;AAKHC,IAAAA,YAAY,GAAG,OALZ;AAMHC,IAAAA,QANG;AAOHC,IAAAA,UAPG;AAQHC,IAAAA,IAAI,GAAG,UARJ;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/menu-item/index.js"],"names":["MenuItem","props","ref","children","info","className","icon","iconPosition","shortcut","isSelected","role","suffix","buttonProps","undefined"],"mappings":";;;;;;;;;;AASA;;;;AALA;;AAUA;;AACA;;AACA;;AAhBA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAKO,SAASA,QAAT,CAAmBC,KAAnB,EAA0BC,GAA1B,EAAgC;AACtC,MAAI;AACHC,IAAAA,QADG;AAEHC,IAAAA,IAFG;AAGHC,IAAAA,SAHG;AAIHC,IAAAA,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Ab,IArBF,EAuBGK,MAvBH,CADD;AA2BA;;eAEc,yBAAYX,QAAZ,C","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from '../shortcut';\nimport Button from '../button';\nimport Icon from '../icon';\n\nexport function MenuItem( props, ref ) {\n\tlet {\n\t\tchildren,\n\t\tinfo,\n\t\tclassName,\n\t\ticon,\n\t\ticonPosition = 'right',\n\t\tshortcut,\n\t\tisSelected,\n\t\trole = 'menuitem',\n\t\tsuffix,\n\t\t...buttonProps\n\t} = props;\n\n\tclassName = classnames( 'components-menu-item__button', className );\n\n\tif ( info ) {\n\t\tchildren = (\n\t\t\t<span className=\"components-menu-item__info-wrapper\">\n\t\t\t\t<span className=\"components-menu-item__item\">{ children }</span>\n\t\t\t\t<span className=\"components-menu-item__info\">{ info }</span>\n\t\t\t</span>\n\t\t);\n\t}\n\n\tif ( icon && typeof icon !== 'string' ) {\n\t\ticon = cloneElement( icon, {\n\t\t\tclassName: classnames( 'components-menu-items__item-icon', {\n\t\t\t\t'has-icon-right': iconPosition === 'right',\n\t\t\t} ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tref={ ref }\n\t\t\t// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n\t\t\taria-checked={\n\t\t\t\trole === 'menuitemcheckbox' || role === 'menuitemradio'\n\t\t\t\t\t? isSelected\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\trole={ role }\n\t\t\ticon={ iconPosition === 'left' ? icon : undefined }\n\t\t\tclassName={ className }\n\t\t\t{ ...buttonProps }\n\t\t>\n\t\t\t<span className=\"components-menu-item__item\">{ children }</span>\n\t\t\t{ ! suffix && (\n\t\t\t\t<Shortcut\n\t\t\t\t\tclassName=\"components-menu-item__shortcut\"\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! suffix && icon && iconPosition === 'right' && (\n\t\t\t\t<Icon icon={ icon } />\n\t\t\t) }\n\t\t\t{ suffix }\n\t\t</Button>\n\t);\n}\n\nexport default forwardRef( MenuItem );\n"]}
|
|
@@ -103,7 +103,10 @@ function BottomSheetNavigationContainer(_ref2) {
|
|
|
103
103
|
setCurrentHeight(height);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
},
|
|
106
|
+
}, // Disable reason: deferring this refactor to the native team.
|
|
107
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
+
[currentHeight]);
|
|
107
110
|
const screens = (0, _element.useMemo)(() => {
|
|
108
111
|
return _element.Children.map(children, child => {
|
|
109
112
|
let screen = child;
|
|
@@ -123,7 +126,9 @@ function BottomSheetNavigationContainer(_ref2) {
|
|
|
123
126
|
}, otherProps, {
|
|
124
127
|
children: () => screen
|
|
125
128
|
}));
|
|
126
|
-
});
|
|
129
|
+
}); // Disable reason: deferring this refactor to the native team.
|
|
130
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
131
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
132
|
}, [children]);
|
|
128
133
|
return (0, _element.useMemo)(() => {
|
|
129
134
|
return (0, _element.createElement)(_reactNative.View, {
|
|
@@ -141,7 +146,9 @@ function BottomSheetNavigationContainer(_ref2) {
|
|
|
141
146
|
screenOptions: options
|
|
142
147
|
}, screens)) : (0, _element.createElement)(Stack.Navigator, {
|
|
143
148
|
screenOptions: options
|
|
144
|
-
}, screens)));
|
|
149
|
+
}, screens))); // Disable reason: deferring this refactor to the native team.
|
|
150
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
151
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
145
152
|
}, [currentHeight, _theme]);
|
|
146
153
|
}
|
|
147
154
|
|
package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js"],"names":["AnimationSpec","animation","config","duration","easing","Easing","ease","fadeConfig","current","cardStyle","opacity","progress","options","transitionSpec","open","close","headerShown","gestureEnabled","cardStyleInterpolator","ANIMATION_DURATION","BottomSheetNavigationContainer","children","animate","main","theme","style","Stack","context","BottomSheetNavigationContext","currentHeight","setCurrentHeight","backgroundStyle","styles","background","backgroundDark","_theme","DefaultTheme","colors","backgroundColor","setHeight","height","Math","round","screens","Children","map","child","screen","name","otherProps","props","isNested"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AACA;;AAeA;;AAKA;;AACA;;AAKA;;AA/BA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;AASA,MAAMA,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE,QADU;AAErBC,EAAAA,MAAM,EAAE;AACPC,IAAAA,QAAQ,EAAE,GADH;AAEPC,IAAAA,MAAM,EAAEC,oBAAOC;AAFR;AAFa,CAAtB;;AAQA,MAAMC,UAAU,GAAG,QAAmB;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACrC,SAAO;AACNC,IAAAA,SAAS,EAAE;AACVC,MAAAA,OAAO,EAAEF,OAAO,CAACG;AADP;AADL,GAAP;AAKA,CAND;;AAQA,MAAMC,OAAO,GAAG;AACfC,EAAAA,cAAc,EAAE;AACfC,IAAAA,IAAI,EAAEd,aADS;AAEfe,IAAAA,KAAK,EAAEf;AAFQ,GADD;AAKfgB,EAAAA,WAAW,EAAE,KALE;AAMfC,EAAAA,cAAc,EAAE,KAND;AAOfC,EAAAA,qBAAqB,EAAEX;AAPR,CAAhB;AAUA,MAAMY,kBAAkB,GAAG,GAA3B;;AAEA,SAASC,8BAAT,QAMI;AAAA,MANqC;AACxCC,IAAAA,QADwC;AAExCC,IAAAA,OAFwC;AAGxCC,IAAAA,IAHwC;AAIxCC,IAAAA,KAJwC;AAKxCC,IAAAA;AALwC,GAMrC;AACH,QAAMC,KAAK,GAAG,qBAAQ,kCAAR,EAAiClB,OAA/C;AACA,QAAMmB,OAAO,GAAG,yBAAYC,0DAAZ,CAAhB;AACA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAC3CH,OAAO,CAACE,aAAR,IAAyB,CADkB,CAA5C;AAIA,QAAME,eAAe,GAAG,2CACvBC,gBAAOC,UADgB,EAEvBD,gBAAOE,cAFgB,CAAxB;;AAKA,QAAMC,MAAM,GAAGX,KAAK,IAAI,EACvB,GAAGY,oBADoB;AAEvBC,IAAAA,MAAM,EAAE,EACP,GAAGD,qBAAaC,MADT;AAEPJ,MAAAA,UAAU,EAAEF,eAAe,CAACO;AAFrB;AAFe,GAAxB;;AAQA,QAAMC,SAAS,GAAG,0BACfC,MAAF,IAAc;AACb;AACA,QACC,OAAOA,MAAP,KAAkB,QAAlB,IACA,OAAOA,MAAP,KAAkB,OAAOX,aAF1B,EAGE;AACD,mDAAwBV,kBAAxB;AACAW,MAAAA,gBAAgB,CAAEU,MAAF,CAAhB;AAEA;AACA;;AAED,QACCA,MAAM,GAAG,CAAT,IACAC,IAAI,CAACC,KAAL,CAAYF,MAAZ,MAAyBC,IAAI,CAACC,KAAL,CAAYb,aAAZ,CAF1B,EAGE;AACD,UAAKA,aAAa,KAAK,CAAvB,EAA2B;AAC1BC,QAAAA,gBAAgB,CAAEU,MAAF,CAAhB;AACA,OAFD,MAEO,IAAKlB,OAAL,EAAe;AACrB,qDAAwBH,kBAAxB;AACAW,QAAAA,gBAAgB,CAAEU,MAAF,CAAhB;AACA,OAHM,MAGA;AACNV,QAAAA,gBAAgB,CAAEU,MAAF,CAAhB;AACA;AACD;AACD,GA1BgB,EA2BjB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js"],"names":["AnimationSpec","animation","config","duration","easing","Easing","ease","fadeConfig","current","cardStyle","opacity","progress","options","transitionSpec","open","close","headerShown","gestureEnabled","cardStyleInterpolator","ANIMATION_DURATION","BottomSheetNavigationContainer","children","animate","main","theme","style","Stack","context","BottomSheetNavigationContext","currentHeight","setCurrentHeight","backgroundStyle","styles","background","backgroundDark","_theme","DefaultTheme","colors","backgroundColor","setHeight","height","Math","round","screens","Children","map","child","screen","name","otherProps","props","isNested"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AACA;;AAeA;;AAKA;;AACA;;AAKA;;AA/BA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;AASA,MAAMA,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE,QADU;AAErBC,EAAAA,MAAM,EAAE;AACPC,IAAAA,QAAQ,EAAE,GADH;AAEPC,IAAAA,MAAM,EAAEC,oBAAOC;AAFR;AAFa,CAAtB;;AAQA,MAAMC,UAAU,GAAG,QAAmB;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACrC,SAAO;AACNC,IAAAA,SAAS,EAAE;AACVC,MAAAA,OAAO,EAAEF,OAAO,CAACG;AADP;AADL,GAAP;AAKA,CAND;;AAQA,MAAMC,OAAO,GAAG;AACfC,EAAAA,cAAc,EAAE;AACfC,IAAAA,IAAI,EAAEd,aADS;AAEfe,IAAAA,KAAK,EAAEf;AAFQ,GADD;AAKfgB,EAAAA,WAAW,EAAE,KALE;AAMfC,EAAAA,cAAc,EAAE,KAND;AAOfC,EAAAA,qBAAqB,EAAEX;AAPR,CAAhB;AAUA,MAAMY,kBAAkB,GAAG,GAA3B;;AAEA,SAASC,8BAAT,QAMI;AAAA,MANqC;AACxCC,IAAAA,QADwC;AAExCC,IAAAA,OAFwC;AAGxCC,IAAAA,IAHwC;AAIxCC,IAAAA,KAJwC;AAKxCC,IAAAA;AALwC,GAMrC;AACH,QAAMC,KAAK,GAAG,qBAAQ,kCAAR,EAAiClB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,WAAGC;AAAX,UAA0BH,KAAK,CAACI,KAAtC;;AACA,UAAK,CAAE3B,IAAP,EAAc;AACbwB,QAAAA,MAAM,GAAG,2BAAcD,KAAd,EAAqB,EAC7B,GAAGA,KAAK,CAACI,KADoB;AAE7BC,UAAAA,QAAQ,EAAE;AAFmB,SAArB,CAAT;AAIA;;AACD,aACC,4BAAC,KAAD,CAAO,MAAP;AACC,QAAA,IAAI,EAAGH;AADR,SAEMC,UAFN;AAGC,QAAA,QAAQ,EAAG,MAAMF;AAHlB,SADD;AAOA,KAhBM,CAAP,CAD8B,CAkB9B;AACA;AACA;AACA,GArBe,EAqBb,CAAE1B,QAAF,CArBa,CAAhB;AAuBA,SAAO,sBAAS,MAAM;AACrB,WACC,4BAAC,iBAAD;AAAM,MAAA,KAAK,EAAG,CAAEI,KAAF,EAAS;AAAEe,QAAAA,MAAM,EAAEX;AAAV,OAAT;AAAd,OACC,4BAAC,2DAAD;AACC,MAAA,KAAK,EAAG;AACPU,QAAAA,SADO;AAEPV,QAAAA;AAFO;AADT,OAMGN,IAAI,GACL,4BAAC,2BAAD;AAAqB,MAAA,KAAK,EAAGY;AAA7B,OACC,4BAAC,KAAD,CAAO,SAAP;AAAiB,MAAA,aAAa,EAAGvB;AAAjC,OACG+B,OADH,CADD,CADK,GAOL,4BAAC,KAAD,CAAO,SAAP;AAAiB,MAAA,aAAa,EAAG/B;AAAjC,OACG+B,OADH,CAbF,CADD,CADD,CADqB,CAuBrB;AACA;AACA;AACA,GA1BM,EA0BJ,CAAEd,aAAF,EAAiBM,MAAjB,CA1BI,CAAP;AA2BA;;eAEcf,8B","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Easing } from 'react-native';\nimport { NavigationContainer, DefaultTheme } from '@react-navigation/native';\nimport { createStackNavigator } from '@react-navigation/stack';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseContext,\n\tuseMemo,\n\tuseCallback,\n\tChildren,\n\tuseRef,\n\tcloneElement,\n} from '@wordpress/element';\n\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { performLayoutAnimation } from '../../layout-animation';\nimport {\n\tBottomSheetNavigationContext,\n\tBottomSheetNavigationProvider,\n} from './bottom-sheet-navigation-context';\n\nimport styles from './styles.scss';\n\nconst AnimationSpec = {\n\tanimation: 'timing',\n\tconfig: {\n\t\tduration: 200,\n\t\teasing: Easing.ease,\n\t},\n};\n\nconst fadeConfig = ( { current } ) => {\n\treturn {\n\t\tcardStyle: {\n\t\t\topacity: current.progress,\n\t\t},\n\t};\n};\n\nconst options = {\n\ttransitionSpec: {\n\t\topen: AnimationSpec,\n\t\tclose: AnimationSpec,\n\t},\n\theaderShown: false,\n\tgestureEnabled: false,\n\tcardStyleInterpolator: fadeConfig,\n};\n\nconst ANIMATION_DURATION = 190;\n\nfunction BottomSheetNavigationContainer( {\n\tchildren,\n\tanimate,\n\tmain,\n\ttheme,\n\tstyle,\n} ) {\n\tconst Stack = useRef( createStackNavigator() ).current;\n\tconst context = useContext( BottomSheetNavigationContext );\n\tconst [ currentHeight, setCurrentHeight ] = useState(\n\t\tcontext.currentHeight || 1\n\t);\n\n\tconst backgroundStyle = usePreferredColorSchemeStyle(\n\t\tstyles.background,\n\t\tstyles.backgroundDark\n\t);\n\n\tconst _theme = theme || {\n\t\t...DefaultTheme,\n\t\tcolors: {\n\t\t\t...DefaultTheme.colors,\n\t\t\tbackground: backgroundStyle.backgroundColor,\n\t\t},\n\t};\n\n\tconst setHeight = useCallback(\n\t\t( height ) => {\n\t\t\t// The screen is fullHeight.\n\t\t\tif (\n\t\t\t\ttypeof height === 'string' &&\n\t\t\t\ttypeof height !== typeof currentHeight\n\t\t\t) {\n\t\t\t\tperformLayoutAnimation( ANIMATION_DURATION );\n\t\t\t\tsetCurrentHeight( height );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\theight > 1 &&\n\t\t\t\tMath.round( height ) !== Math.round( currentHeight )\n\t\t\t) {\n\t\t\t\tif ( currentHeight === 1 ) {\n\t\t\t\t\tsetCurrentHeight( height );\n\t\t\t\t} else if ( animate ) {\n\t\t\t\t\tperformLayoutAnimation( ANIMATION_DURATION );\n\t\t\t\t\tsetCurrentHeight( height );\n\t\t\t\t} else {\n\t\t\t\t\tsetCurrentHeight( height );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ currentHeight ]\n\t);\n\n\tconst screens = useMemo( () => {\n\t\treturn Children.map( children, ( child ) => {\n\t\t\tlet screen = child;\n\t\t\tconst { name, ...otherProps } = child.props;\n\t\t\tif ( ! main ) {\n\t\t\t\tscreen = cloneElement( child, {\n\t\t\t\t\t...child.props,\n\t\t\t\t\tisNested: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<Stack.Screen\n\t\t\t\t\tname={ name }\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\tchildren={ () => screen }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ children ] );\n\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<View style={ [ style, { height: currentHeight } ] }>\n\t\t\t\t<BottomSheetNavigationProvider\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\tsetHeight,\n\t\t\t\t\t\tcurrentHeight,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ main ? (\n\t\t\t\t\t\t<NavigationContainer theme={ _theme }>\n\t\t\t\t\t\t\t<Stack.Navigator screenOptions={ options }>\n\t\t\t\t\t\t\t\t{ screens }\n\t\t\t\t\t\t\t</Stack.Navigator>\n\t\t\t\t\t\t</NavigationContainer>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Stack.Navigator screenOptions={ options }>\n\t\t\t\t\t\t\t{ screens }\n\t\t\t\t\t\t</Stack.Navigator>\n\t\t\t\t\t) }\n\t\t\t\t</BottomSheetNavigationProvider>\n\t\t\t</View>\n\t\t);\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ currentHeight, _theme ] );\n}\n\nexport default BottomSheetNavigationContainer;\n"]}
|
|
@@ -54,7 +54,10 @@ const BottomSheetNavigationScreen = _ref => {
|
|
|
54
54
|
} = (0, _element.useContext)(_components.BottomSheetContext);
|
|
55
55
|
const {
|
|
56
56
|
setHeight
|
|
57
|
-
} = (0, _element.useContext)(_bottomSheetNavigationContext.BottomSheetNavigationContext);
|
|
57
|
+
} = (0, _element.useContext)(_bottomSheetNavigationContext.BottomSheetNavigationContext); // Disable reason: deferring this refactor to the native team.
|
|
58
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
59
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
+
|
|
58
61
|
const setHeightDebounce = (0, _element.useCallback)((0, _compose.debounce)(setHeight, 10), [setHeight]);
|
|
59
62
|
(0, _native.useFocusEffect)((0, _element.useCallback)(() => {
|
|
60
63
|
onHandleHardwareButtonPress(() => {
|
|
@@ -81,6 +84,8 @@ const BottomSheetNavigationScreen = _ref => {
|
|
|
81
84
|
*
|
|
82
85
|
* Related: https://github.com/WordPress/gutenberg/pull/36328#discussion_r768897546
|
|
83
86
|
*/
|
|
87
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
88
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
89
|
}, []));
|
|
85
90
|
(0, _native.useFocusEffect)((0, _element.useCallback)(() => {
|
|
86
91
|
if (fullScreen) {
|
|
@@ -91,7 +96,9 @@ const BottomSheetNavigationScreen = _ref => {
|
|
|
91
96
|
setHeight(heightRef.current.maxHeight);
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
return () => {};
|
|
99
|
+
return () => {}; // Disable reason: deferring this refactor to the native team.
|
|
100
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
101
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
95
102
|
}, [setHeight]));
|
|
96
103
|
|
|
97
104
|
const onLayout = _ref2 => {
|
|
@@ -126,7 +133,9 @@ const BottomSheetNavigationScreen = _ref => {
|
|
|
126
133
|
style: {
|
|
127
134
|
height: safeAreaBottomInset || _styles.default.scrollableContent.paddingBottom
|
|
128
135
|
}
|
|
129
|
-
}))));
|
|
136
|
+
})))); // Disable reason: deferring this refactor to the native team.
|
|
137
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
138
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
139
|
}, [children, isFocused, safeAreaBottomInset, listProps, name, isScrollable, isNested, onLayout]);
|
|
131
140
|
};
|
|
132
141
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js"],"names":["BottomSheetNavigationScreen","children","fullScreen","isScrollable","isNested","name","navigation","heightRef","maxHeight","isFocused","onHandleHardwareButtonPress","shouldEnableBottomSheetMaxHeight","setIsFullScreen","listProps","safeAreaBottomInset","BottomSheetContext","setHeight","BottomSheetNavigationContext","setHeightDebounce","canGoBack","goBack","current","onLayout","nativeEvent","height","layout","styles","scrollableContent","paddingBottom"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AAKA;;AACA;;AAMA;;AACA;;AArBA;AACA;AACA;;AAQA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAMA,2BAA2B,GAAG,QAM7B;AAAA,MAN+B;AACrCC,IAAAA,QADqC;AAErCC,IAAAA,UAFqC;AAGrCC,IAAAA,YAHqC;AAIrCC,IAAAA,QAJqC;AAKrCC,IAAAA;AALqC,GAM/B;AACN,QAAMC,UAAU,GAAG,4BAAnB;AACA,QAAMC,SAAS,GAAG,qBAAQ;AAAEC,IAAAA,SAAS,EAAE;AAAb,GAAR,CAAlB;AACA,QAAMC,SAAS,GAAG,2BAAlB;AACA,QAAM;AACLC,IAAAA,2BADK;AAELC,IAAAA,gCAFK;AAGLC,IAAAA,eAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA;AALK,MAMF,yBAAYC,8BAAZ,CANJ;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,yBAAYC,0DAAZ,CAAtB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js"],"names":["BottomSheetNavigationScreen","children","fullScreen","isScrollable","isNested","name","navigation","heightRef","maxHeight","isFocused","onHandleHardwareButtonPress","shouldEnableBottomSheetMaxHeight","setIsFullScreen","listProps","safeAreaBottomInset","BottomSheetContext","setHeight","BottomSheetNavigationContext","setHeightDebounce","canGoBack","goBack","current","onLayout","nativeEvent","height","layout","styles","scrollableContent","paddingBottom"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AAKA;;AACA;;AAMA;;AACA;;AArBA;AACA;AACA;;AAQA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAMA,2BAA2B,GAAG,QAM7B;AAAA,MAN+B;AACrCC,IAAAA,QADqC;AAErCC,IAAAA,UAFqC;AAGrCC,IAAAA,YAHqC;AAIrCC,IAAAA,QAJqC;AAKrCC,IAAAA;AALqC,GAM/B;AACN,QAAMC,UAAU,GAAG,4BAAnB;AACA,QAAMC,SAAS,GAAG,qBAAQ;AAAEC,IAAAA,SAAS,EAAE;AAAb,GAAR,CAAlB;AACA,QAAMC,SAAS,GAAG,2BAAlB;AACA,QAAM;AACLC,IAAAA,2BADK;AAELC,IAAAA,gCAFK;AAGLC,IAAAA,eAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA;AALK,MAMF,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lB,KAAgCgB,MAAhC,IAA0Cf,SAA/C,EAA2D;AAC1DF,MAAAA,SAAS,CAACc,OAAV,CAAkBb,SAAlB,GAA8BgB,MAA9B;AACAN,MAAAA,iBAAiB,CAAEM,MAAF,CAAjB;AACA;AACD,GAVD;;AAYA,SAAO,sBAAS,MAAM;AACrB,WAAOrB,YAAY,IAAIC,QAAhB,GACN,4BAAC,iBAAD;AACC,MAAA,QAAQ,EAAGkB,QADZ;AAEC,MAAA,MAAM,EAAI,qBAAqBjB,IAAM;AAFtC,OAIGJ,QAJH,CADM,GAQN,4BAAC,uBAAD,EAAiBY,SAAjB,EACC,4BAAC,+BAAD;AAAoB,MAAA,UAAU,EAAG;AAAjC,OACC,4BAAC,iBAAD;AACC,MAAA,QAAQ,EAAGS,QADZ;AAEC,MAAA,MAAM,EAAI,qBAAqBjB,IAAM;AAFtC,OAIGJ,QAJH,EAKG,CAAEG,QAAF,IACD,4BAAC,iBAAD;AACC,MAAA,KAAK,EAAG;AACPoB,QAAAA,MAAM,EACLV,mBAAmB,IACnBY,gBAAOC,iBAAP,CAAyBC;AAHnB;AADT,MANF,CADD,CADD,CARD,CADqB,CA6BrB;AACA;AACA;AACA,GAhCM,EAgCJ,CACF3B,QADE,EAEFQ,SAFE,EAGFK,mBAHE,EAIFD,SAJE,EAKFR,IALE,EAMFF,YANE,EAOFC,QAPE,EAQFkB,QARE,CAhCI,CAAP;AA0CA,CA/HD;;eAiIetB,2B","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tuseIsFocused,\n\tuseNavigation,\n\tuseFocusEffect,\n} from '@react-navigation/native';\nimport { View, ScrollView, TouchableHighlight } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { BottomSheetContext } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useRef, useCallback, useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { BottomSheetNavigationContext } from './bottom-sheet-navigation-context';\nimport styles from './styles.scss';\n\nconst BottomSheetNavigationScreen = ( {\n\tchildren,\n\tfullScreen,\n\tisScrollable,\n\tisNested,\n\tname,\n} ) => {\n\tconst navigation = useNavigation();\n\tconst heightRef = useRef( { maxHeight: 0 } );\n\tconst isFocused = useIsFocused();\n\tconst {\n\t\tonHandleHardwareButtonPress,\n\t\tshouldEnableBottomSheetMaxHeight,\n\t\tsetIsFullScreen,\n\t\tlistProps,\n\t\tsafeAreaBottomInset,\n\t} = useContext( BottomSheetContext );\n\n\tconst { setHeight } = useContext( BottomSheetNavigationContext );\n\n\t// Disable reason: deferring this refactor to the native team.\n\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst setHeightDebounce = useCallback( debounce( setHeight, 10 ), [\n\t\tsetHeight,\n\t] );\n\n\tuseFocusEffect(\n\t\tuseCallback( () => {\n\t\t\tonHandleHardwareButtonPress( () => {\n\t\t\t\tif ( navigation.canGoBack() ) {\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight( true );\n\t\t\t\t\tnavigation.goBack();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tonHandleHardwareButtonPress( null );\n\t\t\t\treturn false;\n\t\t\t} );\n\t\t\t/**\n\t\t\t * TODO: onHandleHardwareButtonPress stores a single value, which means\n\t\t\t * future invocations from sibling screens can replace the callback for\n\t\t\t * the currently active screen. Currently, the empty dependency array\n\t\t\t * passed to useCallback here is what prevents erroneous callback\n\t\t\t * replacements, but leveraging memoization to achieve this is brittle and\n\t\t\t * explicitly discouraged in the React documentation.\n\t\t\t * https://reactjs.org/docs/hooks-reference.html#usememo\n\t\t\t *\n\t\t\t * Ideally, we refactor onHandleHardwareButtonPress to manage multiple\n\t\t\t * callbacks triggered based upon which screen is currently active.\n\t\t\t *\n\t\t\t * Related: https://github.com/WordPress/gutenberg/pull/36328#discussion_r768897546\n\t\t\t */\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [] )\n\t);\n\n\tuseFocusEffect(\n\t\tuseCallback( () => {\n\t\t\tif ( fullScreen ) {\n\t\t\t\tsetHeight( '100%' );\n\t\t\t\tsetIsFullScreen( true );\n\t\t\t} else if ( heightRef.current.maxHeight !== 0 ) {\n\t\t\t\tsetIsFullScreen( false );\n\t\t\t\tsetHeight( heightRef.current.maxHeight );\n\t\t\t}\n\t\t\treturn () => {};\n\t\t\t// Disable reason: deferring this refactor to the native team.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [ setHeight ] )\n\t);\n\n\tconst onLayout = ( { nativeEvent } ) => {\n\t\tif ( fullScreen ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { height } = nativeEvent.layout;\n\n\t\tif ( heightRef.current.maxHeight !== height && isFocused ) {\n\t\t\theightRef.current.maxHeight = height;\n\t\t\tsetHeightDebounce( height );\n\t\t}\n\t};\n\n\treturn useMemo( () => {\n\t\treturn isScrollable || isNested ? (\n\t\t\t<View\n\t\t\t\tonLayout={ onLayout }\n\t\t\t\ttestID={ `navigation-screen-${ name }` }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t) : (\n\t\t\t<ScrollView { ...listProps }>\n\t\t\t\t<TouchableHighlight accessible={ false }>\n\t\t\t\t\t<View\n\t\t\t\t\t\tonLayout={ onLayout }\n\t\t\t\t\t\ttestID={ `navigation-screen-${ name }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t{ ! isNested && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\tsafeAreaBottomInset ||\n\t\t\t\t\t\t\t\t\t\tstyles.scrollableContent.paddingBottom,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableHighlight>\n\t\t\t</ScrollView>\n\t\t);\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tchildren,\n\t\tisFocused,\n\t\tsafeAreaBottomInset,\n\t\tlistProps,\n\t\tname,\n\t\tisScrollable,\n\t\tisNested,\n\t\tonLayout,\n\t] );\n};\n\nexport default BottomSheetNavigationScreen;\n"]}
|
|
@@ -36,7 +36,10 @@ const BottomSheetSubSheet = _ref => {
|
|
|
36
36
|
(0, _element.useEffect)(() => {
|
|
37
37
|
if (showSheet) {
|
|
38
38
|
setIsFullScreen(isFullScreen);
|
|
39
|
-
}
|
|
39
|
+
} // Disable reason: deferring this refactor to the native team.
|
|
40
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
|
|
40
43
|
}, [showSheet, isFullScreen]);
|
|
41
44
|
return (0, _element.createElement)(_element.Fragment, null, showSheet && (0, _element.createElement)(Fill, null, (0, _element.createElement)(_reactNative.SafeAreaView, null, children)), _element.Children.count(children) > 0 && navigationButton);
|
|
42
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/sub-sheet/index.native.js"],"names":["Fill","Slot","BottomSheetSubSheet","children","navigationButton","showSheet","isFullScreen","setIsFullScreen","BottomSheetContext","Children","count","screenName"],"mappings":";;;;;;;AAQA;;AALA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IAAiB,gCAAgB,qBAAhB,CAAvB;;AAEA,MAAMC,mBAAmB,GAAG,QAKrB;AAAA,MALuB;AAC7BC,IAAAA,QAD6B;AAE7BC,IAAAA,gBAF6B;AAG7BC,IAAAA,SAH6B;AAI7BC,IAAAA;AAJ6B,GAKvB;AACN,QAAM;AAAEC,IAAAA;AAAF,MAAsB,yBAAYC,8BAAZ,CAA5B;AAEA,0BAAW,MAAM;AAChB,QAAKH,SAAL,EAAiB;AAChBE,MAAAA,eAAe,CAAED,YAAF,CAAf;AACA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/sub-sheet/index.native.js"],"names":["Fill","Slot","BottomSheetSubSheet","children","navigationButton","showSheet","isFullScreen","setIsFullScreen","BottomSheetContext","Children","count","screenName"],"mappings":";;;;;;;AAQA;;AALA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IAAiB,gCAAgB,qBAAhB,CAAvB;;AAEA,MAAMC,mBAAmB,GAAG,QAKrB;AAAA,MALuB;AAC7BC,IAAAA,QAD6B;AAE7BC,IAAAA,gBAF6B;AAG7BC,IAAAA,SAH6B;AAI7BC,IAAAA;AAJ6B,GAKvB;AACN,QAAM;AAAEC,IAAAA;AAAF,MAAsB,yBAAYC,8BAAZ,CAA5B;AAEA,0BAAW,MAAM;AAChB,QAAKH,SAAL,EAAiB;AAChBE,MAAAA,eAAe,CAAED,YAAF,CAAf;AACA,KAHe,CAIhB;AACA;AACA;;AACA,GAPD,EAOG,CAAED,SAAF,EAAaC,YAAb,CAPH;AASA,SACC,qDACGD,SAAS,IACV,4BAAC,IAAD,QACC,4BAAC,yBAAD,QAAgBF,QAAhB,CADD,CAFF,EAMGM,kBAASC,KAAT,CAAgBP,QAAhB,IAA6B,CAA7B,IAAkCC,gBANrC,CADD;AAUA,CA3BD;;AA6BAF,mBAAmB,CAACD,IAApB,GAA2BA,IAA3B;AACAC,mBAAmB,CAACS,UAApB,GAAiC,qBAAjC;eAEeT,mB","sourcesContent":["/**\n * External dependencies\n */\nimport { SafeAreaView } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Children, useEffect, useContext } from '@wordpress/element';\nimport { createSlotFill, BottomSheetContext } from '@wordpress/components';\n\nconst { Fill, Slot } = createSlotFill( 'BottomSheetSubSheet' );\n\nconst BottomSheetSubSheet = ( {\n\tchildren,\n\tnavigationButton,\n\tshowSheet,\n\tisFullScreen,\n} ) => {\n\tconst { setIsFullScreen } = useContext( BottomSheetContext );\n\n\tuseEffect( () => {\n\t\tif ( showSheet ) {\n\t\t\tsetIsFullScreen( isFullScreen );\n\t\t}\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ showSheet, isFullScreen ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ showSheet && (\n\t\t\t\t<Fill>\n\t\t\t\t\t<SafeAreaView>{ children }</SafeAreaView>\n\t\t\t\t</Fill>\n\t\t\t) }\n\t\t\t{ Children.count( children ) > 0 && navigationButton }\n\t\t</>\n\t);\n};\n\nBottomSheetSubSheet.Slot = Slot;\nBottomSheetSubSheet.screenName = 'BottomSheetSubSheet';\n\nexport default BottomSheetSubSheet;\n"]}
|
|
@@ -49,7 +49,9 @@ const ColorSettingsMemo = (0, _element.memo)(_ref => {
|
|
|
49
49
|
} = _ref;
|
|
50
50
|
(0, _element.useEffect)(() => {
|
|
51
51
|
shouldEnableBottomSheetMaxHeight(true);
|
|
52
|
-
onHandleClosingBottomSheet(null);
|
|
52
|
+
onHandleClosingBottomSheet(null); // Disable reason: deferring this refactor to the native team.
|
|
53
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
54
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
55
|
}, []);
|
|
54
56
|
return (0, _element.createElement)(_components.BottomSheet.NavigationContainer, null, (0, _element.createElement)(_components.BottomSheet.NavigationScreen, {
|
|
55
57
|
name: _utils.colorsUtils.screens.palette,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/color-settings/index.native.js"],"names":["ColorSettingsMemo","defaultSettings","onHandleClosingBottomSheet","shouldEnableBottomSheetMaxHeight","onColorChange","colorValue","gradientValue","onGradientChange","onColorCleared","label","hideNavigation","colorsUtils","screens","palette","picker","gradientPicker","ColorSettings","props","route","BottomSheetContext","params"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AAKA;;AACA;;AACA;;AAEA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAOA,MAAMA,iBAAiB,GAAG,mBACzB,QAWO;AAAA,MAXL;AACDC,IAAAA,eADC;AAEDC,IAAAA,0BAFC;AAGDC,IAAAA,gCAHC;AAIDC,IAAAA,aAJC;AAKDC,IAAAA,UALC;AAMDC,IAAAA,aANC;AAODC,IAAAA,gBAPC;AAQDC,IAAAA,cARC;AASDC,IAAAA,KATC;AAUDC,IAAAA;AAVC,GAWK;AACN,0BAAW,MAAM;AAChBP,IAAAA,gCAAgC,CAAE,IAAF,CAAhC;AACAD,IAAAA,0BAA0B,CAAE,IAAF,CAA1B;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/color-settings/index.native.js"],"names":["ColorSettingsMemo","defaultSettings","onHandleClosingBottomSheet","shouldEnableBottomSheetMaxHeight","onColorChange","colorValue","gradientValue","onGradientChange","onColorCleared","label","hideNavigation","colorsUtils","screens","palette","picker","gradientPicker","ColorSettings","props","route","BottomSheetContext","params"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AAKA;;AACA;;AACA;;AAEA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAOA,MAAMA,iBAAiB,GAAG,mBACzB,QAWO;AAAA,MAXL;AACDC,IAAAA,eADC;AAEDC,IAAAA,0BAFC;AAGDC,IAAAA,gCAHC;AAIDC,IAAAA,aAJC;AAKDC,IAAAA,UALC;AAMDC,IAAAA,aANC;AAODC,IAAAA,gBAPC;AAQDC,IAAAA,cARC;AASDC,IAAAA,KATC;AAUDC,IAAAA;AAVC,GAWK;AACN,0BAAW,MAAM;AAChBP,IAAAA,gCAAgC,CAAE,IAAF,CAAhC;AACAD,IAAAA,0BAA0B,CAAE,IAAF,CAA1B,CAFgB,CAGhB;AACA;AACA;AACA,GAND,EAMG,EANH;AAOA,SACC,4BAAC,uBAAD,CAAa,mBAAb,QACC,4BAAC,uBAAD,CAAa,gBAAb;AACC,IAAA,IAAI,EAAGS,mBAAYC,OAAZ,CAAoBC,OAD5B;AAEC,IAAA,aAAa,EAAG;AACfZ,MAAAA,eADe;AAEfG,MAAAA,aAFe;AAGfC,MAAAA,UAHe;AAIfC,MAAAA,aAJe;AAKfC,MAAAA,gBALe;AAMfC,MAAAA,cANe;AAOfC,MAAAA,KAPe;AAQfC,MAAAA;AARe;AAFjB,KAaC,4BAAC,gBAAD,OAbD,CADD,EAgBC,4BAAC,uBAAD,CAAa,gBAAb;AACC,IAAA,IAAI,EAAGC,mBAAYC,OAAZ,CAAoBE;AAD5B,KAGC,4BAAC,qBAAD,OAHD,CAhBD,EAqBC,4BAAC,uBAAD,CAAa,gBAAb;AACC,IAAA,IAAI,EAAGH,mBAAYC,OAAZ,CAAoBG;AAD5B,KAGC,4BAAC,6BAAD,OAHD,CArBD,CADD;AA6BA,CAjDwB,CAA1B;;AAmDA,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAMC,KAAK,GAAG,uBAAd;AACA,QAAM;AAAEhB,IAAAA,0BAAF;AAA8BC,IAAAA;AAA9B,MACL,yBAAYgB,8BAAZ,CADD;AAGA,SACC,4BAAC,iBAAD;AACC,IAAA,0BAA0B,EAAGjB,0BAD9B;AAEC,IAAA,gCAAgC,EAC/BC;AAHF,KAKMc,KALN,EAMMC,KAAK,CAACE,MANZ,EADD;AAUA;;eAEcJ,a","sourcesContent":["/**\n * External dependencies\n */\nimport { useRoute } from '@react-navigation/native';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useEffect, useContext } from '@wordpress/element';\nimport { BottomSheetContext, BottomSheet } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport PickerScreen from './picker-screen';\nimport GradientPickerScreen from './gradient-picker-screen';\nimport PaletteScreen from './palette.screen';\n\nimport { colorsUtils } from './utils';\n\nconst ColorSettingsMemo = memo(\n\t( {\n\t\tdefaultSettings,\n\t\tonHandleClosingBottomSheet,\n\t\tshouldEnableBottomSheetMaxHeight,\n\t\tonColorChange,\n\t\tcolorValue,\n\t\tgradientValue,\n\t\tonGradientChange,\n\t\tonColorCleared,\n\t\tlabel,\n\t\thideNavigation,\n\t} ) => {\n\t\tuseEffect( () => {\n\t\t\tshouldEnableBottomSheetMaxHeight( true );\n\t\t\tonHandleClosingBottomSheet( null );\n\t\t\t// Disable reason: deferring this refactor to the native team.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [] );\n\t\treturn (\n\t\t\t<BottomSheet.NavigationContainer>\n\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\tname={ colorsUtils.screens.palette }\n\t\t\t\t\tinitialParams={ {\n\t\t\t\t\t\tdefaultSettings,\n\t\t\t\t\t\tonColorChange,\n\t\t\t\t\t\tcolorValue,\n\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\tonGradientChange,\n\t\t\t\t\t\tonColorCleared,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\thideNavigation,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<PaletteScreen />\n\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\tname={ colorsUtils.screens.picker }\n\t\t\t\t>\n\t\t\t\t\t<PickerScreen />\n\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\tname={ colorsUtils.screens.gradientPicker }\n\t\t\t\t>\n\t\t\t\t\t<GradientPickerScreen />\n\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t</BottomSheet.NavigationContainer>\n\t\t);\n\t}\n);\nfunction ColorSettings( props ) {\n\tconst route = useRoute();\n\tconst { onHandleClosingBottomSheet, shouldEnableBottomSheetMaxHeight } =\n\t\tuseContext( BottomSheetContext );\n\n\treturn (\n\t\t<ColorSettingsMemo\n\t\t\tonHandleClosingBottomSheet={ onHandleClosingBottomSheet }\n\t\t\tshouldEnableBottomSheetMaxHeight={\n\t\t\t\tshouldEnableBottomSheetMaxHeight\n\t\t\t}\n\t\t\t{ ...props }\n\t\t\t{ ...route.params }\n\t\t/>\n\t);\n}\n\nexport default ColorSettings;\n"]}
|
|
@@ -52,7 +52,9 @@ const PickerScreen = () => {
|
|
|
52
52
|
isBottomSheetContentScrolling: isBottomSheetContentScrolling,
|
|
53
53
|
shouldEnableBottomSheetScroll: shouldEnableBottomSheetScroll,
|
|
54
54
|
onHandleHardwareButtonPress: onHandleHardwareButtonPress
|
|
55
|
-
});
|
|
55
|
+
}); // Disable reason: deferring this refactor to the native team.
|
|
56
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
58
|
}, [setColor, currentValue, isGradientColor, onShouldEnableInnerHandling, shouldEnableBottomSheetMaxHeight, onHandleClosingBottomSheet, isBottomSheetContentScrolling, shouldEnableBottomSheetScroll, onHandleHardwareButtonPress]);
|
|
57
59
|
};
|
|
58
60
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/color-settings/picker-screen.native.js"],"names":["PickerScreen","route","navigation","onShouldEnableInnerHandling","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","isBottomSheetContentScrolling","shouldEnableBottomSheetScroll","onHandleHardwareButtonPress","BottomSheetContext","setColor","currentValue","isGradientColor","params","goBack"],"mappings":";;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,YAAY,GAAG,MAAM;AAC1B,QAAMC,KAAK,GAAG,uBAAd;AACA,QAAMC,UAAU,GAAG,4BAAnB;AACA,QAAM;AACLC,IAAAA,2BADK;AAELC,IAAAA,gCAFK;AAGLC,IAAAA,0BAHK;AAILC,IAAAA,6BAJK;AAKLC,IAAAA,6BALK;AAMLC,IAAAA;AANK,MAOF,yBAAYC,8BAAZ,CAPJ;AAQA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,YAAZ;AAA0BC,IAAAA;AAA1B,MAA8CX,KAAK,CAACY,MAA1D;AACA,SAAO,sBAAS,MAAM;AACrB,WACC,4BAAC,wBAAD;AACC,MAAA,2BAA2B,EAAGV,2BAD/B;AAEC,MAAA,gCAAgC,EAC/BC,gCAHF;AAKC,MAAA,QAAQ,EAAGM,QALZ;AAMC,MAAA,WAAW,EAAGC,YANf;AAOC,MAAA,eAAe,EAAGC,eAPnB;AAQC,MAAA,gBAAgB,EAAGV,UAAU,CAACY,MAR/B;AASC,MAAA,0BAA0B,EAAGT,0BAT9B;AAUC,MAAA,6BAA6B,EAAGC,6BAVjC;AAWC,MAAA,6BAA6B,EAAGC,6BAXjC;AAYC,MAAA,2BAA2B,EAAGC;AAZ/B,MADD;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/color-settings/picker-screen.native.js"],"names":["PickerScreen","route","navigation","onShouldEnableInnerHandling","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","isBottomSheetContentScrolling","shouldEnableBottomSheetScroll","onHandleHardwareButtonPress","BottomSheetContext","setColor","currentValue","isGradientColor","params","goBack"],"mappings":";;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,YAAY,GAAG,MAAM;AAC1B,QAAMC,KAAK,GAAG,uBAAd;AACA,QAAMC,UAAU,GAAG,4BAAnB;AACA,QAAM;AACLC,IAAAA,2BADK;AAELC,IAAAA,gCAFK;AAGLC,IAAAA,0BAHK;AAILC,IAAAA,6BAJK;AAKLC,IAAAA,6BALK;AAMLC,IAAAA;AANK,MAOF,yBAAYC,8BAAZ,CAPJ;AAQA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,YAAZ;AAA0BC,IAAAA;AAA1B,MAA8CX,KAAK,CAACY,MAA1D;AACA,SAAO,sBAAS,MAAM;AACrB,WACC,4BAAC,wBAAD;AACC,MAAA,2BAA2B,EAAGV,2BAD/B;AAEC,MAAA,gCAAgC,EAC/BC,gCAHF;AAKC,MAAA,QAAQ,EAAGM,QALZ;AAMC,MAAA,WAAW,EAAGC,YANf;AAOC,MAAA,eAAe,EAAGC,eAPnB;AAQC,MAAA,gBAAgB,EAAGV,UAAU,CAACY,MAR/B;AASC,MAAA,0BAA0B,EAAGT,0BAT9B;AAUC,MAAA,6BAA6B,EAAGC,6BAVjC;AAWC,MAAA,6BAA6B,EAAGC,6BAXjC;AAYC,MAAA,2BAA2B,EAAGC;AAZ/B,MADD,CADqB,CAiBrB;AACA;AACA;AACA,GApBM,EAoBJ,CACFE,QADE,EAEFC,YAFE,EAGFC,eAHE,EAIFT,2BAJE,EAKFC,gCALE,EAMFC,0BANE,EAOFC,6BAPE,EAQFC,6BARE,EASFC,2BATE,CApBI,CAAP;AA+BA,CA3CD;;eA6CeR,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { useRoute, useNavigation } from '@react-navigation/native';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo } from '@wordpress/element';\nimport { BottomSheetContext } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { ColorPicker } from '../../color-picker';\n\nconst PickerScreen = () => {\n\tconst route = useRoute();\n\tconst navigation = useNavigation();\n\tconst {\n\t\tonShouldEnableInnerHandling,\n\t\tshouldEnableBottomSheetMaxHeight,\n\t\tonHandleClosingBottomSheet,\n\t\tisBottomSheetContentScrolling,\n\t\tshouldEnableBottomSheetScroll,\n\t\tonHandleHardwareButtonPress,\n\t} = useContext( BottomSheetContext );\n\tconst { setColor, currentValue, isGradientColor } = route.params;\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<ColorPicker\n\t\t\t\tonShouldEnableInnerHandling={ onShouldEnableInnerHandling }\n\t\t\t\tshouldEnableBottomSheetMaxHeight={\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight\n\t\t\t\t}\n\t\t\t\tsetColor={ setColor }\n\t\t\t\tactiveColor={ currentValue }\n\t\t\t\tisGradientColor={ isGradientColor }\n\t\t\t\tonNavigationBack={ navigation.goBack }\n\t\t\t\tonHandleClosingBottomSheet={ onHandleClosingBottomSheet }\n\t\t\t\tisBottomSheetContentScrolling={ isBottomSheetContentScrolling }\n\t\t\t\tshouldEnableBottomSheetScroll={ shouldEnableBottomSheetScroll }\n\t\t\t\tonHandleHardwareButtonPress={ onHandleHardwareButtonPress }\n\t\t\t/>\n\t\t);\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tsetColor,\n\t\tcurrentValue,\n\t\tisGradientColor,\n\t\tonShouldEnableInnerHandling,\n\t\tshouldEnableBottomSheetMaxHeight,\n\t\tonHandleClosingBottomSheet,\n\t\tisBottomSheetContentScrolling,\n\t\tshouldEnableBottomSheetScroll,\n\t\tonHandleHardwareButtonPress,\n\t] );\n};\n\nexport default PickerScreen;\n"]}
|
|
@@ -106,7 +106,9 @@ const ImageComponent = _ref => {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
return () => isCurrent = false;
|
|
109
|
+
return () => isCurrent = false; // Disable reason: deferring this refactor to the native team.
|
|
110
|
+
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
111
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
112
|
}, [url]);
|
|
111
113
|
|
|
112
114
|
const onContainerLayout = event => {
|