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

42
node_modules/reakit/src/Grid/Grid.tsx generated vendored Normal file
View File

@@ -0,0 +1,42 @@
import { useWarning } from "reakit-warning";
import { createComponent } from "reakit-system/createComponent";
import { useCreateElement } from "reakit-system/useCreateElement";
import { createHook } from "reakit-system/createHook";
import {
CompositeOptions,
CompositeHTMLProps,
useComposite,
} from "../Composite/Composite";
import { GRID_KEYS } from "./__keys";
export type unstable_GridOptions = CompositeOptions;
export type unstable_GridHTMLProps = CompositeHTMLProps;
export type unstable_GridProps = unstable_GridOptions & unstable_GridHTMLProps;
export const unstable_useGrid = createHook<
unstable_GridOptions,
unstable_GridHTMLProps
>({
name: "Grid",
compose: useComposite,
keys: GRID_KEYS,
useProps(_, htmlProps) {
return { role: "grid", ...htmlProps };
},
});
export const unstable_Grid = createComponent({
as: "div",
useHook: unstable_useGrid,
useCreateElement: (type, props, children) => {
useWarning(
!props["aria-label"] && !props["aria-labelledby"],
"You should provide either `aria-label` or `aria-labelledby` props.",
"See https://reakit.io/docs/grid"
);
return useCreateElement(type, props, children);
},
});

36
node_modules/reakit/src/Grid/GridCell.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import * as React from "react";
import { createComponent } from "reakit-system/createComponent";
import { createHook } from "reakit-system/createHook";
import {
CompositeItemOptions,
CompositeItemHTMLProps,
useCompositeItem,
} from "../Composite/CompositeItem";
import { GRID_CELL_KEYS } from "./__keys";
export type unstable_GridCellOptions = CompositeItemOptions;
export type unstable_GridCellHTMLProps = CompositeItemHTMLProps &
React.TdHTMLAttributes<any>;
export type unstable_GridCellProps = unstable_GridCellOptions &
unstable_GridCellHTMLProps;
export const unstable_useGridCell = createHook<
unstable_GridCellOptions,
unstable_GridCellHTMLProps
>({
name: "GridCell",
compose: useCompositeItem,
keys: GRID_CELL_KEYS,
useProps(_, htmlProps) {
return { role: "gridcell", ...htmlProps };
},
});
export const unstable_GridCell = createComponent({
as: "span",
memo: true,
useHook: unstable_useGridCell,
});

33
node_modules/reakit/src/Grid/GridRow.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import { createComponent } from "reakit-system/createComponent";
import { createHook } from "reakit-system/createHook";
import {
CompositeGroupOptions,
CompositeGroupHTMLProps,
useCompositeGroup,
} from "../Composite/CompositeGroup";
import { GRID_ROW_KEYS } from "./__keys";
export type unstable_GridRowOptions = CompositeGroupOptions;
export type unstable_GridRowHTMLProps = CompositeGroupHTMLProps;
export type unstable_GridRowProps = unstable_GridRowOptions &
unstable_GridRowHTMLProps;
export const unstable_useGridRow = createHook<
unstable_GridRowOptions,
unstable_GridRowHTMLProps
>({
name: "GridRow",
compose: useCompositeGroup,
keys: GRID_ROW_KEYS,
useProps(_, htmlProps) {
return { role: "row", ...htmlProps };
},
});
export const unstable_GridRow = createComponent({
as: "div",
useHook: unstable_useGridRow,
});

26
node_modules/reakit/src/Grid/GridState.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import {
SealedInitialState,
useSealedState,
} from "reakit-utils/useSealedState";
import {
useCompositeState,
CompositeState,
CompositeActions,
CompositeInitialState,
} from "../Composite/CompositeState";
export type unstable_GridState = CompositeState;
export type unstable_GridActions = CompositeActions;
export type unstable_GridInitialState = CompositeInitialState;
export type unstable_GridStateReturn = unstable_GridState &
unstable_GridActions;
export function unstable_useGridState(
initialState: SealedInitialState<unstable_GridInitialState> = {}
): unstable_GridStateReturn {
const sealed = useSealedState(initialState);
return useCompositeState(sealed);
}

460
node_modules/reakit/src/Grid/README.md generated vendored Normal file
View File

@@ -0,0 +1,460 @@
---
path: /docs/grid/
experimental: true
---
# Grid
<blockquote experimental="true">
**This is experimental** and may introduce **breaking changes** or be **removed altogether** in patch and minor versions without notice. Learn more in [Experimental features](/docs/experimental/).
</blockquote>
Accessible `Grid` component that enables users to navigate the information or interactive elements it contains using directional navigation keys. The items are organized in a two-dimensional container. It follows the [WAI-ARIA Grid Pattern](https://www.w3.org/TR/wai-aria-practices/#grid).
<carbon-ad></carbon-ad>
## Installation
```sh
npm install reakit
```
Learn more in [Get started](/docs/get-started/).
## Usage
```jsx
import {
unstable_useGridState as useGridState,
unstable_Grid as Grid,
unstable_GridRow as GridRow,
unstable_GridCell as GridCell,
} from "reakit/Grid";
function Example() {
const grid = useGridState();
return (
<Grid {...grid} aria-label="My grid">
<GridRow {...grid}>
<GridCell {...grid}>cell</GridCell>
<GridCell {...grid}>cell</GridCell>
<GridCell {...grid}>cell</GridCell>
</GridRow>
<GridRow {...grid}>
<GridCell {...grid}>cell</GridCell>
<GridCell {...grid}>cell</GridCell>
<GridCell {...grid}>cell</GridCell>
</GridRow>
<GridRow {...grid}>
<GridCell {...grid}>cell</GridCell>
<GridCell {...grid}>cell</GridCell>
<GridCell {...grid}>cell</GridCell>
</GridRow>
</Grid>
);
}
```
## Accessibility
- `Grid` has role `grid`.
- `Grid` extends the accessibility features of [Composite](/docs/composite/#accessibility).
- `GridRow` has role `row`.
- `GridRow` extends the accessibility features of [CompositeGroup](/docs/composite/#accessibility).
- `GridCell` has role `gridcell`.
- `GridCell` extends the accessibility features of [CompositeItem](/docs/composite/#accessibility).
Learn more in [Accessibility](/docs/accessibility/).
## Composition
- `Grid` uses [Composite](/docs/composite/).
- `GridRow` uses [CompositeGroup](/docs/composite/).
- `GridCell` uses [CompositeItem](/docs/composite/).
Learn more in [Composition](/docs/composition/#props-hooks).
## Props
<!-- Automatically generated -->
### `useGridState`
- **`baseId`**
<code>string</code>
ID that will serve as a base for all the items IDs.
- **`unstable_virtual`** <span title="Experimental">⚠️</span>
<code>boolean</code>
If enabled, the composite element will act as an
[aria-activedescendant](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_focus_activedescendant)
container instead of
[roving tabindex](https://www.w3.org/TR/wai-aria-practices/#kbd_roving_tabindex).
DOM focus will remain on the composite while its items receive virtual focus.
- **`rtl`**
<code>boolean</code>
Determines how `next` and `previous` functions will behave. If `rtl` is
set to `true`, they will be inverted. This only affects the composite
widget behavior. You still need to set `dir="rtl"` on HTML/CSS.
- **`orientation`**
<code>&#34;horizontal&#34; | &#34;vertical&#34; | undefined</code>
Defines the orientation of the composite widget. If the composite has a
single row or column (one-dimensional), the `orientation` value determines
which arrow keys can be used to move focus:
- `undefined`: all arrow keys work.
- `horizontal`: only left and right arrow keys work.
- `vertical`: only up and down arrow keys work.
It doesn't have any effect on two-dimensional composites.
- **`currentId`**
<code>string | null | undefined</code>
The current focused item `id`.
- `undefined` will automatically focus the first enabled composite item.
- `null` will focus the base composite element and users will be able to
navigate out of it using arrow keys.
- If `currentId` is initially set to `null`, the base composite element
itself will have focus and users will be able to navigate to it using
arrow keys.
- **`loop`**
<code>boolean | &#34;horizontal&#34; | &#34;vertical&#34;</code>
On one-dimensional composites:
- `true` loops from the last item to the first item and vice-versa.
- `horizontal` loops only if `orientation` is `horizontal` or not set.
- `vertical` loops only if `orientation` is `vertical` or not set.
- If `currentId` is initially set to `null`, the composite element will
be focused in between the last and first items.
On two-dimensional composites:
- `true` loops from the last row/column item to the first item in the
same row/column and vice-versa. If it's the last item in the last row, it
moves to the first item in the first row and vice-versa.
- `horizontal` loops only from the last row item to the first item in
the same row.
- `vertical` loops only from the last column item to the first item in
the column row.
- If `currentId` is initially set to `null`, vertical loop will have no
effect as moving down from the last row or up from the first row will
focus the composite element.
- If `wrap` matches the value of `loop`, it'll wrap between the last
item in the last row or column and the first item in the first row or
column and vice-versa.
- **`wrap`**
<code>boolean | &#34;horizontal&#34; | &#34;vertical&#34;</code>
**Has effect only on two-dimensional composites**. If enabled, moving to
the next item from the last one in a row or column will focus the first
item in the next row or column and vice-versa.
- `true` wraps between rows and columns.
- `horizontal` wraps only between rows.
- `vertical` wraps only between columns.
- If `loop` matches the value of `wrap`, it'll wrap between the last
item in the last row or column and the first item in the first row or
column and vice-versa.
- **`shift`**
<code>boolean</code>
**Has effect only on two-dimensional composites**. If enabled, moving up
or down when there's no next item or the next item is disabled will shift
to the item right before it.
### `Grid`
- **`disabled`**
<code>boolean | undefined</code>
Same as the HTML attribute.
- **`focusable`**
<code>boolean | undefined</code>
When an element is `disabled`, it may still be `focusable`. It works
similarly to `readOnly` on form elements. In this case, only
`aria-disabled` will be set.
<details><summary>12 state props</summary>
> These props are returned by the state hook. You can spread them into this component (`{...state}`) or pass them separately. You can also provide these props from your own state logic.
- **`baseId`**
<code>string</code>
ID that will serve as a base for all the items IDs.
- **`unstable_virtual`** <span title="Experimental">⚠️</span>
<code>boolean</code>
If enabled, the composite element will act as an
[aria-activedescendant](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_focus_activedescendant)
container instead of
[roving tabindex](https://www.w3.org/TR/wai-aria-practices/#kbd_roving_tabindex).
DOM focus will remain on the composite while its items receive virtual focus.
- **`orientation`**
<code>&#34;horizontal&#34; | &#34;vertical&#34; | undefined</code>
Defines the orientation of the composite widget. If the composite has a
single row or column (one-dimensional), the `orientation` value determines
which arrow keys can be used to move focus:
- `undefined`: all arrow keys work.
- `horizontal`: only left and right arrow keys work.
- `vertical`: only up and down arrow keys work.
It doesn't have any effect on two-dimensional composites.
- **`currentId`**
<code>string | null | undefined</code>
The current focused item `id`.
- `undefined` will automatically focus the first enabled composite item.
- `null` will focus the base composite element and users will be able to
navigate out of it using arrow keys.
- If `currentId` is initially set to `null`, the base composite element
itself will have focus and users will be able to navigate to it using
arrow keys.
- **`wrap`**
<code>boolean | &#34;horizontal&#34; | &#34;vertical&#34;</code>
**Has effect only on two-dimensional composites**. If enabled, moving to
the next item from the last one in a row or column will focus the first
item in the next row or column and vice-versa.
- `true` wraps between rows and columns.
- `horizontal` wraps only between rows.
- `vertical` wraps only between columns.
- If `loop` matches the value of `wrap`, it'll wrap between the last
item in the last row or column and the first item in the first row or
column and vice-versa.
- **`unstable_moves`** <span title="Experimental">⚠️</span>
<code>number</code>
Stores the number of moves that have been performed by calling `move`,
`next`, `previous`, `up`, `down`, `first` or `last`.
- **`groups`**
<code>Group[]</code>
Lists all the composite groups with their `id` and DOM `ref`. This state
is automatically updated when `registerGroup` and `unregisterGroup` are
called.
- **`items`**
<code>Item[]</code>
Lists all the composite items with their `id`, DOM `ref`, `disabled` state
and `groupId` if any. This state is automatically updated when
`registerItem` and `unregisterItem` are called.
- **`setCurrentId`**
<code title="(value: SetStateAction&#60;string | null | undefined&#62;) =&#62; void">(value: SetStateAction&#60;string | null | undefine...</code>
Sets `currentId`. This is different from `composite.move` as this only
updates the `currentId` state without moving focus. When the composite
widget gets focused by the user, the item referred by the `currentId`
state will get focus.
- **`first`**
<code>() =&#62; void</code>
Moves focus to the first item.
- **`last`**
<code>() =&#62; void</code>
Moves focus to the last item.
- **`move`**
<code>(id: string | null) =&#62; void</code>
Moves focus to a given item ID.
</details>
### `GridCell`
- **`disabled`**
<code>boolean | undefined</code>
Same as the HTML attribute.
- **`focusable`**
<code>boolean | undefined</code>
When an element is `disabled`, it may still be `focusable`. It works
similarly to `readOnly` on form elements. In this case, only
`aria-disabled` will be set.
- **`id`**
<code>string | undefined</code>
Same as the HTML attribute.
<details><summary>15 state props</summary>
> These props are returned by the state hook. You can spread them into this component (`{...state}`) or pass them separately. You can also provide these props from your own state logic.
- **`baseId`**
<code>string</code>
ID that will serve as a base for all the items IDs.
- **`unstable_virtual`** <span title="Experimental">⚠️</span>
<code>boolean</code>
If enabled, the composite element will act as an
[aria-activedescendant](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_focus_activedescendant)
container instead of
[roving tabindex](https://www.w3.org/TR/wai-aria-practices/#kbd_roving_tabindex).
DOM focus will remain on the composite while its items receive virtual focus.
- **`orientation`**
<code>&#34;horizontal&#34; | &#34;vertical&#34; | undefined</code>
Defines the orientation of the composite widget. If the composite has a
single row or column (one-dimensional), the `orientation` value determines
which arrow keys can be used to move focus:
- `undefined`: all arrow keys work.
- `horizontal`: only left and right arrow keys work.
- `vertical`: only up and down arrow keys work.
It doesn't have any effect on two-dimensional composites.
- **`unstable_moves`** <span title="Experimental">⚠️</span>
<code>number</code>
Stores the number of moves that have been performed by calling `move`,
`next`, `previous`, `up`, `down`, `first` or `last`.
- **`currentId`**
<code>string | null | undefined</code>
The current focused item `id`.
- `undefined` will automatically focus the first enabled composite item.
- `null` will focus the base composite element and users will be able to
navigate out of it using arrow keys.
- If `currentId` is initially set to `null`, the base composite element
itself will have focus and users will be able to navigate to it using
arrow keys.
- **`items`**
<code>Item[]</code>
Lists all the composite items with their `id`, DOM `ref`, `disabled` state
and `groupId` if any. This state is automatically updated when
`registerItem` and `unregisterItem` are called.
- **`setCurrentId`**
<code title="(value: SetStateAction&#60;string | null | undefined&#62;) =&#62; void">(value: SetStateAction&#60;string | null | undefine...</code>
Sets `currentId`. This is different from `composite.move` as this only
updates the `currentId` state without moving focus. When the composite
widget gets focused by the user, the item referred by the `currentId`
state will get focus.
- **`first`**
<code>() =&#62; void</code>
Moves focus to the first item.
- **`last`**
<code>() =&#62; void</code>
Moves focus to the last item.
- **`registerItem`**
<code>(item: Item) =&#62; void</code>
Registers a composite item.
- **`unregisterItem`**
<code>(id: string) =&#62; void</code>
Unregisters a composite item.
- **`next`**
<code>(unstable_allTheWay?: boolean | undefined) =&#62; void</code>
Moves focus to the next item.
- **`previous`**
<code>(unstable_allTheWay?: boolean | undefined) =&#62; void</code>
Moves focus to the previous item.
- **`up`**
<code>(unstable_allTheWay?: boolean | undefined) =&#62; void</code>
Moves focus to the item above.
- **`down`**
<code>(unstable_allTheWay?: boolean | undefined) =&#62; void</code>
Moves focus to the item below.
</details>
### `GridRow`
- **`id`**
<code>string | undefined</code>
Same as the HTML attribute.
<details><summary>6 state props</summary>
> These props are returned by the state hook. You can spread them into this component (`{...state}`) or pass them separately. You can also provide these props from your own state logic.
- **`baseId`**
<code>string</code>
ID that will serve as a base for all the items IDs.
- **`registerGroup`**
<code>(group: Group) =&#62; void</code>
Registers a composite group.
- **`unregisterGroup`**
<code>(id: string) =&#62; void</code>
Unregisters a composite group.
- **`currentId`**
<code>string | null | undefined</code>
The current focused item `id`.
- `undefined` will automatically focus the first enabled composite item.
- `null` will focus the base composite element and users will be able to
navigate out of it using arrow keys.
- If `currentId` is initially set to `null`, the base composite element
itself will have focus and users will be able to navigate to it using
arrow keys.
- **`unstable_moves`** <span title="Experimental">⚠️</span>
<code>number</code>
Stores the number of moves that have been performed by calling `move`,
`next`, `previous`, `up`, `down`, `first` or `last`.
- **`items`**
<code>Item[]</code>
Lists all the composite items with their `id`, DOM `ref`, `disabled` state
and `groupId` if any. This state is automatically updated when
`registerItem` and `unregisterItem` are called.
</details>

43
node_modules/reakit/src/Grid/__keys.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
// Automatically generated
const GRID_STATE_KEYS = [
"baseId",
"unstable_idCountRef",
"unstable_virtual",
"rtl",
"orientation",
"items",
"groups",
"currentId",
"loop",
"wrap",
"shift",
"unstable_moves",
"unstable_hasActiveWidget",
"unstable_includesBaseElement",
"setBaseId",
"registerItem",
"unregisterItem",
"registerGroup",
"unregisterGroup",
"move",
"next",
"previous",
"up",
"down",
"first",
"last",
"sort",
"unstable_setVirtual",
"setRTL",
"setOrientation",
"setCurrentId",
"setLoop",
"setWrap",
"setShift",
"reset",
"unstable_setIncludesBaseElement",
"unstable_setHasActiveWidget",
] as const;
export const GRID_KEYS = GRID_STATE_KEYS;
export const GRID_CELL_KEYS = GRID_KEYS;
export const GRID_ROW_KEYS = GRID_CELL_KEYS;

47
node_modules/reakit/src/Grid/__tests__/Grid-test.tsx generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import * as React from "react";
import { render } from "reakit-test-utils";
import {
unstable_Grid as Grid,
unstable_GridProps as GridProps,
} from "../Grid";
const props: GridProps = {
id: "composite",
items: [
{ id: "1", ref: { current: null } },
{ id: "2", ref: { current: null } },
{ id: "3", ref: { current: null } },
],
currentId: "2",
setCurrentId: jest.fn(),
first: jest.fn(),
last: jest.fn(),
move: jest.fn(),
};
test("render", () => {
const { container } = render(<Grid {...props} />);
expect(console).toHaveWarned();
expect(container).toMatchInlineSnapshot(`
<div>
<div
id="composite"
role="grid"
/>
</div>
`);
});
test("render without state props", () => {
// @ts-ignore
const { container } = render(<Grid id="composite" />);
expect(console).toHaveWarned();
expect(container).toMatchInlineSnapshot(`
<div>
<div
id="composite"
role="grid"
/>
</div>
`);
});

View File

@@ -0,0 +1,47 @@
import * as React from "react";
import { render } from "reakit-test-utils";
import {
unstable_GridCell as GridCell,
unstable_GridCellProps as GridCellProps,
} from "../GridCell";
const props: GridCellProps = {
id: "gridcell",
items: [],
setCurrentId: jest.fn(),
next: jest.fn(),
previous: jest.fn(),
first: jest.fn(),
last: jest.fn(),
up: jest.fn(),
down: jest.fn(),
registerItem: jest.fn(),
unregisterItem: jest.fn(),
};
test("render", () => {
const { container } = render(<GridCell {...props} />);
expect(container).toMatchInlineSnapshot(`
<div>
<span
id="gridcell"
role="gridcell"
tabindex="0"
/>
</div>
`);
});
test("render without state props", () => {
// @ts-ignore
const { container } = render(<GridCell id="gridcell" />);
expect(container).toMatchInlineSnapshot(`
<div>
<span
id="gridcell"
role="gridcell"
tabindex="0"
/>
</div>
`);
});

View File

@@ -0,0 +1,37 @@
import * as React from "react";
import { render } from "reakit-test-utils";
import {
unstable_GridRow as GridRow,
unstable_GridRowProps as GridRowProps,
} from "../GridRow";
const props: GridRowProps = {
id: "row",
registerGroup: jest.fn(),
unregisterGroup: jest.fn(),
};
test("render", () => {
const { container } = render(<GridRow {...props} />);
expect(container).toMatchInlineSnapshot(`
<div>
<div
id="row"
role="row"
/>
</div>
`);
});
test("render without state props", () => {
// @ts-ignore
const { container } = render(<GridRow id="row" />);
expect(container).toMatchInlineSnapshot(`
<div>
<div
id="row"
role="row"
/>
</div>
`);
});

4
node_modules/reakit/src/Grid/index.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export * from "./Grid";
export * from "./GridCell";
export * from "./GridRow";
export * from "./GridState";