Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
76 lines
2.0 KiB
JavaScript
76 lines
2.0 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = exports.ZStack = void 0;
|
|
var _react = require("react");
|
|
var _element = require("@wordpress/element");
|
|
var _getValidChildren = require("../utils/get-valid-children");
|
|
var _context = require("../context");
|
|
var _styles = require("./styles");
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
function UnconnectedZStack(props, forwardedRef) {
|
|
const {
|
|
children,
|
|
className,
|
|
isLayered = true,
|
|
isReversed = false,
|
|
offset = 0,
|
|
...otherProps
|
|
} = (0, _context.useContextSystem)(props, 'ZStack');
|
|
const validChildren = (0, _getValidChildren.getValidChildren)(children);
|
|
const childrenLastIndex = validChildren.length - 1;
|
|
const clonedChildren = validChildren.map((child, index) => {
|
|
const zIndex = isReversed ? childrenLastIndex - index : index;
|
|
// Only when the component is layered, the offset needs to be multiplied by
|
|
// the item's index, so that items can correctly stack at the right distance
|
|
const offsetAmount = isLayered ? offset * index : offset;
|
|
const key = (0, _element.isValidElement)(child) ? child.key : index;
|
|
return (0, _react.createElement)(_styles.ZStackChildView, {
|
|
offsetAmount: offsetAmount,
|
|
zIndex: zIndex,
|
|
key: key
|
|
}, child);
|
|
});
|
|
return (0, _react.createElement)(_styles.ZStackView, {
|
|
...otherProps,
|
|
className: className,
|
|
isLayered: isLayered,
|
|
ref: forwardedRef
|
|
}, clonedChildren);
|
|
}
|
|
|
|
/**
|
|
* `ZStack` allows you to stack things along the Z-axis.
|
|
*
|
|
* ```jsx
|
|
* import { __experimentalZStack as ZStack } from '@wordpress/components';
|
|
*
|
|
* function Example() {
|
|
* return (
|
|
* <ZStack offset={ 20 } isLayered>
|
|
* <ExampleImage />
|
|
* <ExampleImage />
|
|
* <ExampleImage />
|
|
* </ZStack>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
const ZStack = (0, _context.contextConnect)(UnconnectedZStack, 'ZStack');
|
|
exports.ZStack = ZStack;
|
|
var _default = ZStack;
|
|
exports.default = _default;
|
|
//# sourceMappingURL=component.js.map
|