Files
formipay/node_modules/@wordpress/components/build/placeholder/index.js
dwindown e8fbfb14c1 fix: prevent asset conflicts between React and Grid.js versions
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>
2026-04-18 17:02:14 +07:00

102 lines
3.0 KiB
JavaScript

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Placeholder = Placeholder;
exports.default = void 0;
var _react = require("react");
var _classnames = _interopRequireDefault(require("classnames"));
var _compose = require("@wordpress/compose");
var _primitives = require("@wordpress/primitives");
var _element = require("@wordpress/element");
var _a11y = require("@wordpress/a11y");
var _icon = _interopRequireDefault(require("../icon"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const PlaceholderIllustration = (0, _react.createElement)(_primitives.SVG, {
className: "components-placeholder__illustration",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 60 60",
preserveAspectRatio: "none"
}, (0, _react.createElement)(_primitives.Path, {
vectorEffect: "non-scaling-stroke",
d: "M60 60 0 0"
}));
/**
* Renders a placeholder. Normally used by blocks to render their empty state.
*
* ```jsx
* import { Placeholder } from '@wordpress/components';
* import { more } from '@wordpress/icons';
*
* const MyPlaceholder = () => <Placeholder icon={ more } label="Placeholder" />;
* ```
*/
function Placeholder(props) {
const {
icon,
children,
label,
instructions,
className,
notices,
preview,
isColumnLayout,
withIllustration,
...additionalProps
} = props;
const [resizeListener, {
width
}] = (0, _compose.useResizeObserver)();
// Since `useResizeObserver` will report a width of `null` until after the
// first render, avoid applying any modifier classes until width is known.
let modifierClassNames;
if (typeof width === 'number') {
modifierClassNames = {
'is-large': width >= 480,
'is-medium': width >= 160 && width < 480,
'is-small': width < 160
};
}
const classes = (0, _classnames.default)('components-placeholder', className, modifierClassNames, withIllustration ? 'has-illustration' : null);
const fieldsetClasses = (0, _classnames.default)('components-placeholder__fieldset', {
'is-column-layout': isColumnLayout
});
(0, _element.useEffect)(() => {
if (instructions) {
(0, _a11y.speak)(instructions);
}
}, [instructions]);
return (0, _react.createElement)("div", {
...additionalProps,
className: classes
}, withIllustration ? PlaceholderIllustration : null, resizeListener, notices, preview && (0, _react.createElement)("div", {
className: "components-placeholder__preview"
}, preview), (0, _react.createElement)("div", {
className: "components-placeholder__label"
}, (0, _react.createElement)(_icon.default, {
icon: icon
}), label), !!instructions && (0, _react.createElement)("div", {
className: "components-placeholder__instructions"
}, instructions), (0, _react.createElement)("div", {
className: fieldsetClasses
}, children));
}
var _default = Placeholder;
exports.default = _default;
//# sourceMappingURL=index.js.map