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,169 @@
import { SetState } from "reakit-utils/types";
import { CompositeStateReturn, CompositeState, CompositeActions } from "../../Composite/CompositeState";
import { Item } from "./types";
export declare function useComboboxBaseState<T extends CompositeStateReturn>(composite: T, { inputValue: initialInputValue, minValueLength: initialMinValueLength, values: initialValues, limit: initialLimit, list: initialList, inline: initialInline, autoSelect: initialAutoSelect, }?: ComboboxBaseInitialState): ComboboxBaseStateReturn<T>;
export declare type ComboboxBaseState<T extends CompositeState = CompositeState> = Omit<T, "items"> & {
/**
* Lists all the combobox items with their `id`, DOM `ref`, `disabled` state,
* `value` and `groupId` if any. This state is automatically updated when
* `registerItem` and `unregisterItem` are called.
* @example
* const combobox = useComboboxState();
* combobox.items.forEach((item) => {
* console.log(item.value);
* });
*/
items: Item[];
/**
* Indicates the type of the suggestions popup.
*/
menuRole: "listbox" | "tree" | "grid" | "dialog";
/**
* Combobox input value that will be used to filter `values` and populate
* the `matches` property.
*/
inputValue: string;
/**
* How many characters are needed for opening the combobox popover and
* populating `matches` with filtered values.
* @default 0
* @example
* const combobox = useComboboxState({
* values: ["Red", "Green"],
* minValueLength: 2,
* });
* combobox.matches; // []
* combobox.setInputValue("g");
* // On next render
* combobox.matches; // []
* combobox.setInputValue("gr");
* // On next render
* combobox.matches; // ["Green"]
*/
minValueLength: number;
/**
* Value of the item that is currently selected.
*/
currentValue?: string;
/**
* Values that will be used to produce `matches`.
* @default []
* @example
* const combobox = useComboboxState({ values: ["Red", "Green"] });
* combobox.matches; // ["Red", "Green"]
* combobox.setInputValue("g");
* // On next render
* combobox.matches; // ["Green"]
*/
values: string[];
/**
* Maximum number of `matches`. If it's set to `false`, there will be no
* limit.
* @default 10
*/
limit: number | false;
/**
* Result of filtering `values` based on `inputValue`.
* @default []
* @example
* const combobox = useComboboxState({ values: ["Red", "Green"] });
* combobox.matches; // ["Red", "Green"]
* combobox.setInputValue("g");
* // On next render
* combobox.matches; // ["Green"]
*/
matches: string[];
/**
* Determines how the combobox options behave: dynamically or statically.
* By default, it's `true` if `values` are provided. Otherwise, it's `false`:
* - If it's `true` and `values` are provided, then they will be
* automatically filtered based on `inputValue` and will populate `matches`.
* - If it's `true` and `values` aren't provided, this means that you'll
* provide and filter values by yourself. `matches` will be empty.
* - If it's `false` and `values` are provided, then they won't be
* automatically filtered and `matches` will be the same as `values`.
* @example
* const withoutValues = useComboboxState();
* withValues.list; // false;
* const withValues = useComboboxState({ values: ["Red", "Green"] });
* withValues.list; // true;
* const withList = useComboboxState({ list: true });
* withValues.list; // true;
* <Combobox list={true} /> // <input aria-autocomplete="list">
*/
list: boolean;
/**
* Determines whether focusing on an option will temporarily change the value
* of the combobox. If it's `true`, focusing on an option will temporarily
* change the combobox value to the option's value.
* @default false
*/
inline: boolean;
/**
* Determines whether the first option will be automatically selected. When
* it's set to `true`, the exact behavior will depend on the value of
* `inline`:
* - If `inline` is `true`, the first option is automatically focused when
* the combobox popover opens and the input value changes to reflect this.
* The inline completion string will be highlighted and will have a selected
* state.
* - If `inline` is `false`, the first option is automatically focused when
* the combobox popover opens, but the input value remains the same.
* @default false
*/
autoSelect: boolean;
/**
* Whether the suggestions popup is visible or not.
*/
visible: boolean;
};
export declare type ComboboxBaseActions<T extends CompositeActions = CompositeActions> = Omit<T, "registerItem"> & {
/**
* Registers a combobox item.
* @example
* const ref = React.useRef();
* const combobox = useComboboxState();
* React.useEffect(() => {
* combobox.registerItem({ ref, id: "id" });
* return () => combobox.unregisterItem("id");
* });
*/
registerItem: (item: Item) => void;
/**
* Sets `inputValue`.
* @example
* const combobox = useComboboxState();
* combobox.setInputValue("new value");
*/
setInputValue: SetState<ComboboxBaseState["inputValue"]>;
/**
* Sets `minValueLength`.
*/
setMinValueLength: SetState<ComboboxBaseState["minValueLength"]>;
/**
* Sets `values`.
* @example
* const combobox = useComboboxState();
* combobox.setValues(["Red", "Green"]);
* combobox.setValues((prevValues) => [...prevValues, "Blue"]);
*/
setValues: SetState<ComboboxBaseState["values"]>;
/**
* Sets `limit`.
*/
setLimit: SetState<ComboboxBaseState["limit"]>;
/**
* Sets `list`.
*/
setList: SetState<ComboboxBaseState["list"]>;
/**
* Sets `inline`.
*/
setInline: SetState<ComboboxBaseState["inline"]>;
/**
* Sets `autoSelect`.
*/
setAutoSelect: SetState<ComboboxBaseState["autoSelect"]>;
};
export declare type ComboboxBaseInitialState = Pick<Partial<ComboboxBaseState>, "inputValue" | "minValueLength" | "values" | "limit" | "list" | "inline" | "autoSelect">;
export declare type ComboboxBaseStateReturn<T extends CompositeStateReturn> = ComboboxBaseState<T> & ComboboxBaseActions<T>;

View File

@@ -0,0 +1,37 @@
import * as React from "react";
import { PopoverState, PopoverActions, PopoverInitialState } from "../../Popover/PopoverState";
import { unstable_ComboboxListStateReturn as ComboboxListStateReturn } from "../ComboboxListState";
import { unstable_ComboboxListGridStateReturn as ComboboxListGridStateReturn } from "../ComboboxListGridState";
export declare function useComboboxPopoverState<T extends ComboboxListStateReturn | ComboboxListGridStateReturn>(combobox: T, { gutter, placement, ...initialState }?: ComboboxPopoverInitialState): T & import("../..").unstable_IdState & {
visible: boolean;
animated: number | boolean;
animating: boolean;
} & import("../..").unstable_IdActions & {
show: () => void;
hide: () => void;
toggle: () => void;
setVisible: React.Dispatch<React.SetStateAction<boolean>>;
setAnimated: React.Dispatch<React.SetStateAction<number | boolean>>;
stopAnimation: () => void;
} & {
modal: boolean;
unstable_disclosureRef: React.MutableRefObject<HTMLElement | null>;
} & {
setModal: React.Dispatch<React.SetStateAction<boolean>>;
} & {
unstable_referenceRef: React.RefObject<HTMLElement | null>;
unstable_popoverRef: React.RefObject<HTMLElement | null>;
unstable_arrowRef: React.RefObject<HTMLElement | null>;
unstable_popoverStyles: React.CSSProperties;
unstable_arrowStyles: React.CSSProperties;
unstable_originalPlacement: import("@popperjs/core").Placement;
unstable_update: () => boolean;
placement: import("@popperjs/core").Placement;
} & {
visible: boolean;
place: React.Dispatch<React.SetStateAction<import("@popperjs/core").Placement>>;
};
export declare type ComboboxPopoverState = PopoverState;
export declare type ComboboxPopoverActions = PopoverActions;
export declare type ComboboxPopoverInitialState = PopoverInitialState;
export declare type ComboboxPopoverStateReturn = ComboboxPopoverState & ComboboxPopoverActions;

View File

@@ -0,0 +1 @@
export declare function getItemId(baseId: string, value: string, id?: string): string;

View File

@@ -0,0 +1 @@
export declare function getMenuId(baseId: string): string;

12
node_modules/reakit/ts/Combobox/__utils/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/// <reference types="react" />
export declare type Group = {
id: string;
ref: React.RefObject<HTMLElement>;
};
export declare type Item = {
id: string | null;
ref: React.RefObject<HTMLElement>;
groupId?: Group["id"];
disabled?: boolean;
value?: string;
};