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>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,37 @@
import { createElement } from "react";
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import * as Ariakit from '@ariakit/react';
/**
* WordPress dependencies
*/
import { forwardRef } from '@wordpress/element';
/**
* Internal dependencies
*/
/**
* Accessible Disclosure component that controls visibility of a section of
* content. It follows the WAI-ARIA Disclosure Pattern.
*/
const UnforwardedDisclosureContent = ({
visible,
children,
...props
}, ref) => {
const disclosure = Ariakit.useDisclosureStore({
open: visible
});
return createElement(Ariakit.DisclosureContent, {
store: disclosure,
ref: ref,
...props
}, children);
};
export const DisclosureContent = forwardRef(UnforwardedDisclosureContent);
export default DisclosureContent;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["Ariakit","forwardRef","UnforwardedDisclosureContent","visible","children","props","ref","disclosure","useDisclosureStore","open","createElement","DisclosureContent","store"],"sources":["@wordpress/components/src/disclosure/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DisclosureContentProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\n/**\n * Accessible Disclosure component that controls visibility of a section of\n * content. It follows the WAI-ARIA Disclosure Pattern.\n */\nconst UnforwardedDisclosureContent = (\n\t{\n\t\tvisible,\n\t\tchildren,\n\t\t...props\n\t}: WordPressComponentProps< DisclosureContentProps, 'div', false >,\n\tref: React.ForwardedRef< any >\n) => {\n\tconst disclosure = Ariakit.useDisclosureStore( { open: visible } );\n\n\treturn (\n\t\t<Ariakit.DisclosureContent\n\t\t\tstore={ disclosure }\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Ariakit.DisclosureContent>\n\t);\n};\n\nexport const DisclosureContent = forwardRef( UnforwardedDisclosureContent );\nexport default DisclosureContent;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,MAAMC,4BAA4B,GAAGA,CACpC;EACCC,OAAO;EACPC,QAAQ;EACR,GAAGC;AAC6D,CAAC,EAClEC,GAA8B,KAC1B;EACJ,MAAMC,UAAU,GAAGP,OAAO,CAACQ,kBAAkB,CAAE;IAAEC,IAAI,EAAEN;EAAQ,CAAE,CAAC;EAElE,OACCO,aAAA,CAACV,OAAO,CAACW,iBAAiB;IACzBC,KAAK,EAAGL,UAAY;IACpBD,GAAG,EAAGA,GAAK;IAAA,GACND;EAAK,GAERD,QACwB,CAAC;AAE9B,CAAC;AAED,OAAO,MAAMO,iBAAiB,GAAGV,UAAU,CAAEC,4BAA6B,CAAC;AAC3E,eAAeS,iBAAiB"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sources":["@wordpress/components/src/disclosure/types.tsx"],"sourcesContent":["export type DisclosureContentProps = {\n\t/**\n\t * If set to `true` the content will be shown, otherwise it's hidden.\n\t */\n\tvisible?: boolean;\n\t/**\n\t * The content to display within the component.\n\t */\n\tchildren: React.ReactNode;\n};\n"],"mappings":""}