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

315
node_modules/reakit/es/Combobox/Combobox.js generated vendored Normal file
View File

@@ -0,0 +1,315 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import { useRef, useReducer, useMemo, useEffect, useCallback } from 'react';
import { useForkRef } from 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import { warning } from 'reakit-warning';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import { useUpdateEffect } from 'reakit-utils/useUpdateEffect';
import 'reakit-system/useCreateElement';
import 'reakit-utils/getDocument';
import 'reakit-utils/fireBlurEvent';
import 'reakit-utils/fireKeyboardEvent';
import 'reakit-utils/canUseDOM';
import 'reakit-utils/getNextActiveElementOnBlur';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../__keys-6742f591.js';
import '../userFocus-e16425e3.js';
import { useComposite } from '../Composite/Composite.js';
import { C as COMBOBOX_KEYS } from '../__keys-0f89298f.js';
import { g as getMenuId } from '../getMenuId-34730bd3.js';
function getControls(baseId, ariaControls) {
var menuId = getMenuId(baseId);
if (ariaControls) {
return ariaControls + " " + menuId;
}
return menuId;
}
function getAutocomplete(options) {
if (options.list && options.inline) return "both";
if (options.list) return "list";
if (options.inline) return "inline";
return "none";
}
function isFirstItemAutoSelected(items, autoSelect, currentId) {
if (!autoSelect) return false;
var firstItem = items.find(function (item) {
return !item.disabled;
});
return currentId && (firstItem === null || firstItem === void 0 ? void 0 : firstItem.id) === currentId;
}
function hasCompletionString(inputValue, currentValue) {
return !!currentValue && currentValue.length > inputValue.length && currentValue.toLowerCase().indexOf(inputValue.toLowerCase()) === 0;
}
function getCompletionString(inputValue, currentValue) {
if (!currentValue) return "";
var index = currentValue.toLowerCase().indexOf(inputValue.toLowerCase());
return currentValue.slice(index + inputValue.length);
}
function useValue(options) {
return useMemo(function () {
if (!options.inline) {
return options.inputValue;
}
var firstItemAutoSelected = isFirstItemAutoSelected(options.items, options.autoSelect, options.currentId);
if (firstItemAutoSelected) {
if (hasCompletionString(options.inputValue, options.currentValue)) {
return options.inputValue + getCompletionString(options.inputValue, options.currentValue);
}
return options.inputValue;
}
return options.currentValue || options.inputValue;
}, [options.inline, options.inputValue, options.autoSelect, options.items, options.currentId, options.currentValue]);
}
function getFirstEnabledItemId(items) {
var _items$find;
return (_items$find = items.find(function (item) {
return !item.disabled;
})) === null || _items$find === void 0 ? void 0 : _items$find.id;
}
var unstable_useCombobox = createHook({
name: "Combobox",
compose: useComposite,
keys: COMBOBOX_KEYS,
useOptions: function useOptions(_ref) {
var _ref$menuRole = _ref.menuRole,
menuRole = _ref$menuRole === void 0 ? "listbox" : _ref$menuRole,
_ref$hideOnEsc = _ref.hideOnEsc,
hideOnEsc = _ref$hideOnEsc === void 0 ? true : _ref$hideOnEsc,
options = _objectWithoutPropertiesLoose(_ref, ["menuRole", "hideOnEsc"]);
return _objectSpread2({
menuRole: menuRole,
hideOnEsc: hideOnEsc
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlRef = _ref2.ref,
htmlOnKeyDown = _ref2.onKeyDown,
htmlOnKeyPress = _ref2.onKeyPress,
htmlOnChange = _ref2.onChange,
htmlOnClick = _ref2.onClick,
htmlOnBlur = _ref2.onBlur,
ariaControls = _ref2["aria-controls"],
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["ref", "onKeyDown", "onKeyPress", "onChange", "onClick", "onBlur", "aria-controls"]);
var ref = useRef(null);
var _React$useReducer = useReducer(function () {
return {};
}, {}),
updated = _React$useReducer[0],
update = _React$useReducer[1];
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var onKeyPressRef = useLiveRef(htmlOnKeyPress);
var onChangeRef = useLiveRef(htmlOnChange);
var onClickRef = useLiveRef(htmlOnClick);
var onBlurRef = useLiveRef(htmlOnBlur);
var value = useValue(options);
var hasInsertedTextRef = useRef(false); // Completion string
useEffect(function () {
if (!options.inline) return;
if (!options.autoSelect) return;
if (!options.currentValue) return;
if (options.currentId !== getFirstEnabledItemId(options.items)) return;
if (!hasCompletionString(options.inputValue, options.currentValue)) {
return;
}
var element = ref.current;
process.env.NODE_ENV !== "production" ? warning(!element, "Can't auto select combobox because `ref` wasn't passed to the component", "See https://reakit.io/docs/combobox") : void 0;
element === null || element === void 0 ? void 0 : element.setSelectionRange(options.inputValue.length, options.currentValue.length);
}, [updated, options.inline, options.autoSelect, options.currentValue, options.inputValue, options.currentId, options.items]); // Auto select on type
useUpdateEffect(function () {
if (options.autoSelect && options.items.length && hasInsertedTextRef.current) {
// If autoSelect is set to true and the last change was a text
// insertion, we want to automatically focus on the first suggestion.
// This effect will run both when inputValue changes and when items
// change so we can also catch async items.
options.setCurrentId(undefined);
} else {
// Without autoSelect, we'll always blur the combobox option and move
// focus onto the combobox input.
options.setCurrentId(null);
}
}, [options.items, options.inputValue, options.autoSelect, options.setCurrentId]);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event); // Resets the reference on key down so we can figure it out later on
// key press.
hasInsertedTextRef.current = false;
if (event.defaultPrevented) return;
if (event.key === "Escape" && options.hideOnEsc) {
var _options$hide;
(_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
}
}, [options.hideOnEsc, options.hide]);
var onKeyPress = useCallback(function (event) {
var _onKeyPressRef$curren;
(_onKeyPressRef$curren = onKeyPressRef.current) === null || _onKeyPressRef$curren === void 0 ? void 0 : _onKeyPressRef$curren.call(onKeyPressRef, event); // onKeyPress will catch only printable character presses, so we skip
// text removal and paste.
hasInsertedTextRef.current = true;
}, []);
var onChange = useCallback(function (event) {
var _onChangeRef$current, _options$show, _options$setInputValu;
(_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, event);
if (event.defaultPrevented) return;
(_options$show = options.show) === null || _options$show === void 0 ? void 0 : _options$show.call(options);
(_options$setInputValu = options.setInputValue) === null || _options$setInputValu === void 0 ? void 0 : _options$setInputValu.call(options, event.target.value);
update();
if (!options.autoSelect || !hasInsertedTextRef.current) {
var _options$setCurrentId;
// If autoSelect is not set or it's not an insertion of text, focus
// on the combobox input after changing the value.
(_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, null);
} else {
var _options$setCurrentId2;
// Selects first item
(_options$setCurrentId2 = options.setCurrentId) === null || _options$setCurrentId2 === void 0 ? void 0 : _options$setCurrentId2.call(options, undefined);
}
}, [options.show, options.autoSelect, options.setCurrentId, options.setInputValue]);
var onClick = useCallback(function (event) {
var _onClickRef$current, _options$setCurrentId3;
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
if (event.defaultPrevented) return; // https://github.com/reakit/reakit/issues/808
if (!options.minValueLength || value.length >= options.minValueLength) {
var _options$show2;
(_options$show2 = options.show) === null || _options$show2 === void 0 ? void 0 : _options$show2.call(options);
}
(_options$setCurrentId3 = options.setCurrentId) === null || _options$setCurrentId3 === void 0 ? void 0 : _options$setCurrentId3.call(options, null);
options.setInputValue(value);
}, [options.show, options.setCurrentId, options.setInputValue, options.minValueLength, value]);
var onBlur = useCallback(function (event) {
var _onBlurRef$current;
(_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
if (event.defaultPrevented) return;
options.setInputValue(value);
}, [options.setInputValue, value]);
return _objectSpread2({
ref: useForkRef(ref, useForkRef(options.unstable_referenceRef, htmlRef)),
role: "combobox",
autoComplete: "off",
"aria-controls": getControls(options.baseId, ariaControls),
"aria-haspopup": options.menuRole,
"aria-expanded": options.visible,
"aria-autocomplete": getAutocomplete(options),
value: value,
onKeyDown: onKeyDown,
onKeyPress: onKeyPress,
onChange: onChange,
onClick: onClick,
onBlur: onBlur
}, htmlProps);
},
useComposeProps: function useComposeProps(options, _ref3) {
var onKeyUp = _ref3.onKeyUp,
htmlOnKeyDownCapture = _ref3.onKeyDownCapture,
htmlOnKeyDown = _ref3.onKeyDown,
htmlProps = _objectWithoutPropertiesLoose(_ref3, ["onKeyUp", "onKeyDownCapture", "onKeyDown"]);
var compositeHTMLProps = useComposite(options, htmlProps, true);
var onKeyDownCaptureRef = useLiveRef(htmlOnKeyDownCapture);
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var onKeyDownCapture = useCallback(function (event) {
var _onKeyDownCaptureRef$, _compositeHTMLProps$o;
(_onKeyDownCaptureRef$ = onKeyDownCaptureRef.current) === null || _onKeyDownCaptureRef$ === void 0 ? void 0 : _onKeyDownCaptureRef$.call(onKeyDownCaptureRef, event);
if (event.defaultPrevented) return;
if (options.menuRole !== "grid") {
// If menu is a one-dimensional list and there's an option with
// focus, we don't want Home/End and printable characters to perform
// actions on the option, only on the combobox input.
if (event.key === "Home") return;
if (event.key === "End") return;
}
if (event.key.length === 1) return; // Composite's onKeyDownCapture will proxy this event to the active
// item.
(_compositeHTMLProps$o = compositeHTMLProps.onKeyDownCapture) === null || _compositeHTMLProps$o === void 0 ? void 0 : _compositeHTMLProps$o.call(compositeHTMLProps, event);
}, [options.menuRole, compositeHTMLProps.onKeyDownCapture]);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current2, _compositeHTMLProps$o2;
(_onKeyDownRef$current2 = onKeyDownRef.current) === null || _onKeyDownRef$current2 === void 0 ? void 0 : _onKeyDownRef$current2.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
var onlyInputHasFocus = options.currentId === null;
if (!onlyInputHasFocus) return; // Do not perform list actions when pressing horizontal arrow keys when
// focusing the combobox input while no option has focus.
if (event.key === "ArrowLeft") return;
if (event.key === "ArrowRight") return;
if (event.key === "Home") return;
if (event.key === "End") return;
if (!event.ctrlKey && !event.altKey && !event.shiftKey && !event.metaKey && (event.key === "ArrowUp" || event.key === "ArrowDown" || event.key.length === 1)) {
var _options$show3;
// Up/Down arrow keys and printable characters should open the
// combobox popover.
(_options$show3 = options.show) === null || _options$show3 === void 0 ? void 0 : _options$show3.call(options);
}
(_compositeHTMLProps$o2 = compositeHTMLProps.onKeyDown) === null || _compositeHTMLProps$o2 === void 0 ? void 0 : _compositeHTMLProps$o2.call(compositeHTMLProps, event);
}, [options.currentId, options.show, compositeHTMLProps.onKeyDown]);
return _objectSpread2(_objectSpread2({}, compositeHTMLProps), {}, {
onKeyDownCapture: onKeyDownCapture,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp
});
}
});
var unstable_Combobox = createComponent({
as: "input",
memo: true,
useHook: unstable_useCombobox
});
export { unstable_Combobox, unstable_useCombobox };

47
node_modules/reakit/es/Combobox/ComboboxGridCell.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import '../Box/Box.js';
import 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import 'reakit-warning';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import '../Clickable/Clickable.js';
import 'reakit-utils/getDocument';
import '../getCurrentId-5aa9849e.js';
import '../__keys-6742f591.js';
import '../userFocus-e16425e3.js';
import { a as COMBOBOX_GRID_CELL_KEYS } from '../__keys-0f89298f.js';
import 'reakit-utils/isTextField';
import 'reakit-utils/ensureFocus';
import '../Id/IdProvider.js';
import '../Id/Id.js';
import 'reakit-utils/fireEvent';
import '../setTextFieldValue-0a221f4e.js';
import '../Composite/CompositeItem.js';
import '../__keys-08a69d36.js';
import { unstable_useGridCell } from '../Grid/GridCell.js';
import { unstable_useComboboxItem } from './ComboboxItem.js';
var unstable_useComboboxGridCell = createHook({
name: "ComboboxGridCell",
compose: [unstable_useComboboxItem, unstable_useGridCell],
keys: COMBOBOX_GRID_CELL_KEYS
});
var unstable_ComboboxGridCell = createComponent({
as: "span",
memo: true,
useHook: unstable_useComboboxGridCell
});
export { unstable_ComboboxGridCell, unstable_useComboboxGridCell };

29
node_modules/reakit/es/Combobox/ComboboxGridRow.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/useIsomorphicEffect';
import '../Role/Role.js';
import '../findEnabledItemById-8ddca752.js';
import '../__keys-6742f591.js';
import { b as COMBOBOX_GRID_ROW_KEYS } from '../__keys-0f89298f.js';
import '../Id/IdProvider.js';
import '../Id/Id.js';
import '../__keys-08a69d36.js';
import '../Group/Group.js';
import '../Composite/CompositeGroup.js';
import { unstable_useGridRow } from '../Grid/GridRow.js';
var unstable_useComboboxGridRow = createHook({
name: "ComboboxGridRow",
compose: unstable_useGridRow,
keys: COMBOBOX_GRID_ROW_KEYS
});
var unstable_ComboboxGridRow = createComponent({
as: "div",
useHook: unstable_useComboboxGridRow
});
export { unstable_ComboboxGridRow, unstable_useComboboxGridRow };

35
node_modules/reakit/es/Combobox/ComboboxGridState.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-utils/shallowEqual';
import 'react';
import 'reakit-warning';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/dom';
import { useSealedState } from 'reakit-utils/useSealedState';
import 'reakit-utils/getDocument';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../Id/IdProvider.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
import '../Grid/GridState.js';
import '../ComboboxBaseState-73fabcba.js';
import { unstable_useComboboxListGridState } from './ComboboxListGridState.js';
import '@popperjs/core';
import '../Disclosure/DisclosureState.js';
import '../Dialog/DialogState.js';
import '../Popover/PopoverState.js';
import { u as useComboboxPopoverState } from '../ComboboxPopoverState-fdc371b4.js';
function unstable_useComboboxGridState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var sealed = useSealedState(initialState);
var combobox = unstable_useComboboxListGridState(sealed);
return useComboboxPopoverState(combobox, sealed);
}
export { unstable_useComboboxGridState };

128
node_modules/reakit/es/Combobox/ComboboxItem.js generated vendored Normal file
View File

@@ -0,0 +1,128 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import { useBox } from '../Box/Box.js';
import { useCallback } from 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import 'reakit-warning';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import '../Clickable/Clickable.js';
import 'reakit-utils/getDocument';
import '../getCurrentId-5aa9849e.js';
import '../__keys-6742f591.js';
import '../userFocus-e16425e3.js';
import { c as COMBOBOX_ITEM_KEYS } from '../__keys-0f89298f.js';
import 'reakit-utils/isTextField';
import 'reakit-utils/ensureFocus';
import '../Id/IdProvider.js';
import '../Id/Id.js';
import 'reakit-utils/fireEvent';
import '../setTextFieldValue-0a221f4e.js';
import { useCompositeItem } from '../Composite/CompositeItem.js';
function kebabCase(string) {
return string.toLowerCase().replace(/[^a-z0-9]/g, "-");
}
function getItemId(baseId, value, id) {
return id || baseId + "-" + kebabCase(value);
}
var unstable_useComboboxItem = createHook({
name: "ComboboxItem",
compose: useBox,
keys: COMBOBOX_ITEM_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
if (prev.value !== next.value) return false;
if (!prev.value || !next.value || !prev.baseId || !next.baseId) {
return useCompositeItem.unstable_propsAreEqual(prev, next);
}
var prevCurrentValue = prev.currentValue,
prevInputValue = prev.inputValue,
prevMatches = prev.matches,
prevProps = _objectWithoutPropertiesLoose(prev, ["currentValue", "inputValue", "matches"]);
var nextCurrentValue = next.currentValue,
nextInputValue = next.inputValue,
nextMatches = next.matches,
nextProps = _objectWithoutPropertiesLoose(next, ["currentValue", "inputValue", "matches"]);
if (prevCurrentValue !== nextCurrentValue) {
if (next.value === prevCurrentValue || next.value === nextCurrentValue) {
return false;
}
}
var prevId = getItemId(prev.baseId, prev.value, prev.id);
var nextId = getItemId(next.baseId, next.value, prev.id);
return useCompositeItem.unstable_propsAreEqual(_objectSpread2(_objectSpread2({}, prevProps), {}, {
id: prevId
}), _objectSpread2(_objectSpread2({}, nextProps), {}, {
id: nextId
}));
},
useOptions: function useOptions(options) {
var trulyDisabled = options.disabled && !options.focusable;
var value = trulyDisabled ? undefined : options.value;
var registerItem = useCallback(function (item) {
if (options.visible) {
var _options$registerItem;
(_options$registerItem = options.registerItem) === null || _options$registerItem === void 0 ? void 0 : _options$registerItem.call(options, _objectSpread2(_objectSpread2({}, item), {}, {
value: value
}));
}
}, [options.registerItem, options.visible, value]);
if (options.id || !options.baseId || !options.value) {
return _objectSpread2(_objectSpread2({}, options), {}, {
registerItem: registerItem
});
}
var id = getItemId(options.baseId, options.value, options.id);
return _objectSpread2(_objectSpread2({}, options), {}, {
registerItem: registerItem,
id: id
});
},
useProps: function useProps(options, _ref) {
var htmlOnClick = _ref.onClick,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onClick"]);
var onClickRef = useLiveRef(htmlOnClick);
var onClick = useCallback(function (event) {
var _onClickRef$current, _options$hide, _options$setInputValu;
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
if (event.defaultPrevented) return;
if (!options.value) return;
(_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
(_options$setInputValu = options.setInputValue) === null || _options$setInputValu === void 0 ? void 0 : _options$setInputValu.call(options, options.value);
}, [options.hide, options.setInputValue, options.value]);
return _objectSpread2({
children: options.value,
onClick: onClick,
tabIndex: -1
}, htmlProps);
}
});
var unstable_ComboboxItem = createComponent({
as: "span",
memo: true,
useHook: unstable_useComboboxItem
});
export { unstable_ComboboxItem, unstable_useComboboxItem };

40
node_modules/reakit/es/Combobox/ComboboxList.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import { useBox } from '../Box/Box.js';
import { useWarning } from 'reakit-warning';
import { useCreateElement } from 'reakit-system/useCreateElement';
import { d as COMBOBOX_LIST_KEYS } from '../__keys-0f89298f.js';
import { g as getMenuId } from '../getMenuId-34730bd3.js';
var unstable_useComboboxList = createHook({
name: "ComboboxList",
compose: useBox,
keys: COMBOBOX_LIST_KEYS,
useOptions: function useOptions(_ref) {
var _ref$menuRole = _ref.menuRole,
menuRole = _ref$menuRole === void 0 ? "listbox" : _ref$menuRole,
options = _objectWithoutPropertiesLoose(_ref, ["menuRole"]);
return _objectSpread2({
menuRole: menuRole
}, options);
},
useProps: function useProps(options, htmlProps) {
return _objectSpread2({
role: options.menuRole,
id: getMenuId(options.baseId)
}, htmlProps);
}
});
var unstable_ComboboxList = createComponent({
as: "div",
useHook: unstable_useComboboxList,
useCreateElement: function useCreateElement$1(type, props, children) {
process.env.NODE_ENV !== "production" ? useWarning(!props["aria-label"] && !props["aria-labelledby"], "You should provide either `aria-label` or `aria-labelledby` props.", "See https://reakit.io/docs/combobox") : void 0;
return useCreateElement(type, props, children);
}
});
export { unstable_ComboboxList, unstable_useComboboxList };

View File

@@ -0,0 +1,63 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useState, useMemo } from 'react';
import 'reakit-utils/useIsomorphicEffect';
import { useSealedState } from 'reakit-utils/useSealedState';
import 'reakit-utils/getDocument';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../Id/IdProvider.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
import { unstable_useGridState } from '../Grid/GridState.js';
import { u as useComboboxBaseState } from '../ComboboxBaseState-73fabcba.js';
function chunk(array, size) {
var chunks = [];
for (var i = 0, j = array.length; i < j; i += size) {
chunks.push(array.slice(i, i + size));
}
return chunks;
}
function unstable_useComboboxListGridState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$colum = _useSealedState.columns,
initialColumns = _useSealedState$colum === void 0 ? 1 : _useSealedState$colum,
_useSealedState$curre = _useSealedState.currentId,
currentId = _useSealedState$curre === void 0 ? null : _useSealedState$curre,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? true : _useSealedState$loop,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["columns", "currentId", "loop"]);
var _React$useState = useState(initialColumns),
columns = _React$useState[0],
setColumns = _React$useState[1];
var grid = unstable_useGridState(_objectSpread2(_objectSpread2({
currentId: currentId,
loop: loop
}, sealed), {}, {
unstable_virtual: true,
unstable_includesBaseElement: true
}));
var combobox = useComboboxBaseState(grid, sealed);
var matches = useMemo(function () {
return chunk(combobox.matches, columns);
}, [combobox.matches, columns]);
return _objectSpread2(_objectSpread2({}, combobox), {}, {
menuRole: "grid",
columns: columns,
matches: matches,
setColumns: setColumns
});
}
export { unstable_useComboboxListGridState };

40
node_modules/reakit/es/Combobox/ComboboxListState.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'react';
import 'reakit-utils/useIsomorphicEffect';
import { useSealedState } from 'reakit-utils/useSealedState';
import 'reakit-utils/getDocument';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../Id/IdProvider.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import { useCompositeState } from '../Composite/CompositeState.js';
import { u as useComboboxBaseState } from '../ComboboxBaseState-73fabcba.js';
function unstable_useComboboxListState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$curre = _useSealedState.currentId,
currentId = _useSealedState$curre === void 0 ? null : _useSealedState$curre,
_useSealedState$orien = _useSealedState.orientation,
orientation = _useSealedState$orien === void 0 ? "vertical" : _useSealedState$orien,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? true : _useSealedState$loop,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["currentId", "orientation", "loop"]);
var composite = useCompositeState(_objectSpread2(_objectSpread2({
currentId: currentId,
orientation: orientation,
loop: loop
}, sealed), {}, {
unstable_virtual: true,
unstable_includesBaseElement: true
}));
return useComboboxBaseState(composite, sealed);
}
export { unstable_useComboboxListState };

50
node_modules/reakit/es/Combobox/ComboboxOption.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import { a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import '../Box/Box.js';
import 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import 'reakit-warning';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import '../Clickable/Clickable.js';
import 'reakit-utils/getDocument';
import '../getCurrentId-5aa9849e.js';
import '../__keys-6742f591.js';
import '../userFocus-e16425e3.js';
import { e as COMBOBOX_OPTION_KEYS } from '../__keys-0f89298f.js';
import 'reakit-utils/isTextField';
import 'reakit-utils/ensureFocus';
import '../Id/IdProvider.js';
import '../Id/Id.js';
import 'reakit-utils/fireEvent';
import '../setTextFieldValue-0a221f4e.js';
import { useCompositeItem } from '../Composite/CompositeItem.js';
import { unstable_useComboboxItem } from './ComboboxItem.js';
var unstable_useComboboxOption = createHook({
name: "ComboboxOption",
compose: [unstable_useComboboxItem, useCompositeItem],
keys: COMBOBOX_OPTION_KEYS,
useProps: function useProps(_, htmlProps) {
return _objectSpread2({
role: "option"
}, htmlProps);
}
});
var unstable_ComboboxOption = createComponent({
as: "div",
memo: true,
useHook: unstable_useComboboxOption
});
export { unstable_ComboboxOption, unstable_useComboboxOption };

73
node_modules/reakit/es/Combobox/ComboboxPopover.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
import { a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import '../Box/Box.js';
import 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import { useWarning } from 'reakit-warning';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import 'reakit-utils/useUpdateEffect';
import { useCreateElement } from 'reakit-system/useCreateElement';
import 'reakit-utils/getDocument';
import 'reakit-utils/canUseDOM';
import 'reakit-utils/getNextActiveElementOnBlur';
import { f as COMBOBOX_POPOVER_KEYS } from '../__keys-0f89298f.js';
import '../getMenuId-34730bd3.js';
import 'reakit-utils/ensureFocus';
import { unstable_useComboboxList } from './ComboboxList.js';
import '../__keys-e6a5cfbe.js';
import '../Disclosure/DisclosureContent.js';
import 'react-dom';
import '../Portal/Portal.js';
import 'reakit-utils/removeItemFromArray';
import '../MenuContext-6af6cf92.js';
import '../Dialog/Dialog.js';
import 'body-scroll-lock';
import 'reakit-utils/closest';
import 'reakit-utils/getActiveElement';
import 'reakit-utils/contains';
import '../DialogBackdropContext-8775f78b.js';
import 'reakit-utils/isEmpty';
import '../__keys-ed7b48af.js';
import '../__keys-26bb1730.js';
import { usePopover } from '../Popover/Popover.js';
var unstable_useComboboxPopover = createHook({
name: "ComboboxPopover",
compose: [unstable_useComboboxList, usePopover],
keys: COMBOBOX_POPOVER_KEYS,
useOptions: function useOptions(options) {
return _objectSpread2(_objectSpread2({}, options), {}, {
unstable_disclosureRef: options.unstable_referenceRef,
unstable_autoFocusOnShow: false,
unstable_autoFocusOnHide: false
});
},
useComposeProps: function useComposeProps(options, _ref) {
var tabIndex = _ref.tabIndex,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["tabIndex"]);
htmlProps = unstable_useComboboxList(options, htmlProps, true);
htmlProps = usePopover(options, htmlProps, true);
return _objectSpread2(_objectSpread2({}, htmlProps), {}, {
tabIndex: tabIndex != null ? tabIndex : undefined
});
}
});
var unstable_ComboboxPopover = createComponent({
as: "div",
useHook: unstable_useComboboxPopover,
useCreateElement: function useCreateElement$1(type, props, children) {
process.env.NODE_ENV !== "production" ? useWarning(!props["aria-label"] && !props["aria-labelledby"], "You should provide either `aria-label` or `aria-labelledby` props.", "See https://reakit.io/docs/combobox") : void 0;
return useCreateElement(type, props, children);
}
});
export { unstable_ComboboxPopover, unstable_useComboboxPopover };

34
node_modules/reakit/es/Combobox/ComboboxState.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-utils/shallowEqual';
import 'react';
import 'reakit-warning';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/dom';
import { useSealedState } from 'reakit-utils/useSealedState';
import 'reakit-utils/getDocument';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../Id/IdProvider.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
import '../ComboboxBaseState-73fabcba.js';
import '@popperjs/core';
import '../Disclosure/DisclosureState.js';
import '../Dialog/DialogState.js';
import '../Popover/PopoverState.js';
import { u as useComboboxPopoverState } from '../ComboboxPopoverState-fdc371b4.js';
import { unstable_useComboboxListState } from './ComboboxListState.js';
function unstable_useComboboxState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var sealed = useSealedState(initialState);
var combobox = unstable_useComboboxListState(sealed);
return useComboboxPopoverState(combobox, sealed);
}
export { unstable_useComboboxState };

84
node_modules/reakit/es/Combobox/index.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-system/createComponent';
import 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import '../Box/Box.js';
import 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import 'reakit-warning';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import '../Clickable/Clickable.js';
import 'reakit-utils/useSealedState';
import 'reakit-utils/useUpdateEffect';
import 'reakit-system/useCreateElement';
import 'reakit-utils/getDocument';
import 'reakit-utils/fireBlurEvent';
import 'reakit-utils/fireKeyboardEvent';
import 'reakit-utils/canUseDOM';
import 'reakit-utils/getNextActiveElementOnBlur';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../__keys-6742f591.js';
import '../userFocus-e16425e3.js';
import '../Composite/Composite.js';
import '../__keys-0f89298f.js';
import '../getMenuId-34730bd3.js';
export { unstable_Combobox, unstable_useCombobox } from './Combobox.js';
import 'reakit-utils/isTextField';
import 'reakit-utils/ensureFocus';
import '../Id/IdProvider.js';
import '../Id/Id.js';
import 'reakit-utils/fireEvent';
import '../setTextFieldValue-0a221f4e.js';
import '../Composite/CompositeItem.js';
import '../__keys-08a69d36.js';
import '../Grid/GridCell.js';
export { unstable_ComboboxItem, unstable_useComboboxItem } from './ComboboxItem.js';
export { unstable_ComboboxGridCell, unstable_useComboboxGridCell } from './ComboboxGridCell.js';
import '../Group/Group.js';
import '../Composite/CompositeGroup.js';
import '../Grid/GridRow.js';
export { unstable_ComboboxGridRow, unstable_useComboboxGridRow } from './ComboboxGridRow.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
import '../Grid/GridState.js';
import '../ComboboxBaseState-73fabcba.js';
export { unstable_useComboboxListGridState } from './ComboboxListGridState.js';
import '@popperjs/core';
import '../Disclosure/DisclosureState.js';
import '../Dialog/DialogState.js';
import '../Popover/PopoverState.js';
import '../ComboboxPopoverState-fdc371b4.js';
export { unstable_useComboboxGridState } from './ComboboxGridState.js';
export { unstable_ComboboxList, unstable_useComboboxList } from './ComboboxList.js';
export { unstable_useComboboxListState } from './ComboboxListState.js';
export { unstable_ComboboxOption, unstable_useComboboxOption } from './ComboboxOption.js';
import '../__keys-e6a5cfbe.js';
import '../Disclosure/DisclosureContent.js';
import 'react-dom';
import '../Portal/Portal.js';
import 'reakit-utils/removeItemFromArray';
import '../MenuContext-6af6cf92.js';
import '../Dialog/Dialog.js';
import 'body-scroll-lock';
import 'reakit-utils/closest';
import 'reakit-utils/getActiveElement';
import 'reakit-utils/contains';
import '../DialogBackdropContext-8775f78b.js';
import 'reakit-utils/isEmpty';
import '../__keys-ed7b48af.js';
import '../__keys-26bb1730.js';
import '../Popover/Popover.js';
export { unstable_ComboboxPopover, unstable_useComboboxPopover } from './ComboboxPopover.js';
export { unstable_useComboboxState } from './ComboboxState.js';