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>
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import { createElement } from "react";
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
import { hasConnectNamespace, useContextSystem } from '../context';
|
|
import { FlexItem, useFlex } from '../flex';
|
|
import { getAlignmentProps } from './utils';
|
|
import { getValidChildren } from '../utils/get-valid-children';
|
|
export function useHStack(props) {
|
|
const {
|
|
alignment = 'edge',
|
|
children,
|
|
direction,
|
|
spacing = 2,
|
|
...otherProps
|
|
} = useContextSystem(props, 'HStack');
|
|
const align = getAlignmentProps(alignment, direction);
|
|
const validChildren = getValidChildren(children);
|
|
const clonedChildren = validChildren.map((child, index) => {
|
|
const _isSpacer = hasConnectNamespace(child, ['Spacer']);
|
|
if (_isSpacer) {
|
|
const childElement = child;
|
|
const _key = childElement.key || `hstack-${index}`;
|
|
return createElement(FlexItem, {
|
|
isBlock: true,
|
|
key: _key,
|
|
...childElement.props
|
|
});
|
|
}
|
|
return child;
|
|
});
|
|
const propsForFlex = {
|
|
children: clonedChildren,
|
|
direction,
|
|
justify: 'center',
|
|
...align,
|
|
...otherProps,
|
|
gap: spacing
|
|
};
|
|
const flexProps = useFlex(propsForFlex);
|
|
return flexProps;
|
|
}
|
|
//# sourceMappingURL=hook.js.map
|