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

39
node_modules/reakit/es/Form/Form.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
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 { useCallback } from 'react';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import { useRole } from '../Role/Role.js';
import { F as FORM_KEYS } from '../__keys-54ad6269.js';
var unstable_useForm = createHook({
name: "Form",
compose: useRole,
keys: FORM_KEYS,
useProps: function useProps(options, _ref) {
var htmlOnSubmit = _ref.onSubmit,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onSubmit"]);
var onSubmitRef = useLiveRef(htmlOnSubmit);
var onSubmit = useCallback(function (event) {
var _onSubmitRef$current, _options$submit;
(_onSubmitRef$current = onSubmitRef.current) === null || _onSubmitRef$current === void 0 ? void 0 : _onSubmitRef$current.call(onSubmitRef, event);
if (event.defaultPrevented) return;
event.preventDefault();
(_options$submit = options.submit) === null || _options$submit === void 0 ? void 0 : _options$submit.call(options);
}, [options.submit]);
return _objectSpread2({
role: "form",
noValidate: true,
onSubmit: onSubmit
}, htmlProps);
}
});
var unstable_Form = createComponent({
as: "form",
useHook: unstable_useForm
});
export { unstable_Form, unstable_useForm };

78
node_modules/reakit/es/Form/FormCheckbox.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
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 { 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/removeIndexFromArray';
import 'reakit-utils/createEvent';
import { useCheckbox } from '../Checkbox/Checkbox.js';
import { a as FORM_CHECKBOX_KEYS } from '../__keys-54ad6269.js';
import { f as formatInputName, g as getInputId } from '../getInputId-aa144169.js';
import { g as getLabelId } from '../getLabelId-3db05e97.js';
import { unstable_getIn } from './utils/getIn.js';
import { s as shouldShowError, g as getMessageId } from '../shouldShowError-e8a86b53.js';
var unstable_useFormCheckbox = createHook({
name: "FormCheckbox",
compose: useCheckbox,
keys: FORM_CHECKBOX_KEYS,
useOptions: function useOptions(options, htmlProps) {
var name = options.name || htmlProps.name;
var value = typeof options.value !== "undefined" ? options.value : htmlProps.value;
var state = unstable_getIn(options.values, name);
var setState = function setState(val) {
return options.update(name, val);
};
return _objectSpread2(_objectSpread2({}, options), {}, {
state: state,
setState: setState,
name: name,
value: value
});
},
useProps: function useProps(options, _ref) {
var htmlOnBlur = _ref.onBlur,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onBlur"]);
var onBlurRef = useLiveRef(htmlOnBlur);
var isBoolean = typeof options.value === "undefined";
var onBlur = useCallback(function (event) {
var _onBlurRef$current, _options$blur;
(_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
if (event.defaultPrevented) return;
(_options$blur = options.blur) === null || _options$blur === void 0 ? void 0 : _options$blur.call(options, options.name);
}, [options.blur, options.name]);
return _objectSpread2(_objectSpread2({
"aria-invalid": shouldShowError(options, options.name),
name: formatInputName(options.name),
onBlur: onBlur
}, isBoolean ? {
id: getInputId(options.name, options.baseId),
"aria-describedby": getMessageId(options.name, options.baseId),
"aria-labelledby": getLabelId(options.name, options.baseId)
} : {}), htmlProps);
}
});
var unstable_FormCheckbox = createComponent({
as: "input",
memo: true,
useHook: unstable_useFormCheckbox
});
export { unstable_FormCheckbox, unstable_useFormCheckbox };

32
node_modules/reakit/es/Form/FormGroup.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
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 '../Role/Role.js';
import { useGroup } from '../Group/Group.js';
import { b as FORM_GROUP_KEYS } from '../__keys-54ad6269.js';
import { g as getInputId } from '../getInputId-aa144169.js';
import { g as getLabelId } from '../getLabelId-3db05e97.js';
import './utils/getIn.js';
import { g as getMessageId, s as shouldShowError } from '../shouldShowError-e8a86b53.js';
var unstable_useFormGroup = createHook({
name: "FormGroup",
compose: useGroup,
keys: FORM_GROUP_KEYS,
useProps: function useProps(options, htmlProps) {
return _objectSpread2({
id: getInputId(options.name, options.baseId),
tabIndex: -1,
"aria-describedby": getMessageId(options.name, options.baseId),
"aria-labelledby": getLabelId(options.name, options.baseId),
"aria-invalid": shouldShowError(options, options.name)
}, htmlProps);
}
});
var unstable_FormGroup = createComponent({
as: "fieldset",
useHook: unstable_useFormGroup
});
export { unstable_FormGroup, unstable_useFormGroup };

73
node_modules/reakit/es/Form/FormInput.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 { useCallback } from 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import 'reakit-warning';
import { useLiveRef } from 'reakit-utils/useLiveRef';
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 { c as FORM_INPUT_KEYS } from '../__keys-54ad6269.js';
import { g as getInputId, f as formatInputName } from '../getInputId-aa144169.js';
import { g as getLabelId } from '../getLabelId-3db05e97.js';
import { unstable_getIn } from './utils/getIn.js';
import { g as getMessageId, s as shouldShowError } from '../shouldShowError-e8a86b53.js';
import { useInput } from '../Input/Input.js';
var unstable_useFormInput = createHook({
name: "FormInput",
compose: useInput,
keys: FORM_INPUT_KEYS,
useOptions: function useOptions(options, _ref) {
var name = _ref.name;
return _objectSpread2(_objectSpread2({}, options), {}, {
name: options.name || name
});
},
useProps: function useProps(options, _ref2) {
var htmlOnChange = _ref2.onChange,
htmlOnBlur = _ref2.onBlur,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["onChange", "onBlur"]);
var onChangeRef = useLiveRef(htmlOnChange);
var onBlurRef = useLiveRef(htmlOnBlur);
var onChange = useCallback(function (event) {
var _onChangeRef$current, _options$update;
(_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, event);
if (event.defaultPrevented) return;
(_options$update = options.update) === null || _options$update === void 0 ? void 0 : _options$update.call(options, options.name, event.target.value);
}, [options.update, options.name]);
var onBlur = useCallback(function (event) {
var _onBlurRef$current, _options$blur;
(_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
if (event.defaultPrevented) return;
(_options$blur = options.blur) === null || _options$blur === void 0 ? void 0 : _options$blur.call(options, options.name);
}, [options.blur, options.name]);
return _objectSpread2({
id: getInputId(options.name, options.baseId),
name: formatInputName(options.name),
value: unstable_getIn(options.values, options.name, ""),
"aria-describedby": getMessageId(options.name, options.baseId),
"aria-labelledby": getLabelId(options.name, options.baseId),
"aria-invalid": shouldShowError(options, options.name),
onChange: onChange,
onBlur: onBlur
}, htmlProps);
}
});
var unstable_FormInput = createComponent({
as: "input",
memo: true,
useHook: unstable_useFormInput
});
export { unstable_FormInput, unstable_useFormInput };

28
node_modules/reakit/es/Form/FormLabel.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
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 { useRole } from '../Role/Role.js';
import { d as FORM_LABEL_KEYS } from '../__keys-54ad6269.js';
import { g as getInputId } from '../getInputId-aa144169.js';
import { g as getLabelId } from '../getLabelId-3db05e97.js';
var unstable_useFormLabel = createHook({
name: "FormLabel",
compose: useRole,
keys: FORM_LABEL_KEYS,
useProps: function useProps(options, htmlProps) {
return _objectSpread2({
children: options.label,
id: getLabelId(options.name, options.baseId),
htmlFor: getInputId(options.name, options.baseId)
}, htmlProps);
}
});
var unstable_FormLabel = createComponent({
as: "label",
memo: true,
useHook: unstable_useFormLabel
});
export { unstable_FormLabel, unstable_useFormLabel };

37
node_modules/reakit/es/Form/FormMessage.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
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 { useRole } from '../Role/Role.js';
import { e as FORM_MESSAGE_KEYS } from '../__keys-54ad6269.js';
import '../getInputId-aa144169.js';
import { unstable_getIn } from './utils/getIn.js';
import { s as shouldShowError, g as getMessageId } from '../shouldShowError-e8a86b53.js';
function shouldShowMessage(_ref, name) {
var touched = _ref.touched,
messages = _ref.messages;
return !!(unstable_getIn(touched, name) && unstable_getIn(messages, name));
}
var unstable_useFormMessage = createHook({
name: "FormMessage",
compose: useRole,
keys: FORM_MESSAGE_KEYS,
useProps: function useProps(options, htmlProps) {
var children = shouldShowError(options, options.name) ? unstable_getIn(options.errors, options.name) : undefined;
children = children || (shouldShowMessage(options, options.name) ? unstable_getIn(options.messages, options.name) : undefined);
return _objectSpread2({
role: "alert",
id: getMessageId(options.name, options.baseId),
children: children
}, htmlProps);
}
});
var unstable_FormMessage = createComponent({
as: "div",
memo: true,
useHook: unstable_useFormMessage
});
export { unstable_FormMessage, unstable_useFormMessage };

77
node_modules/reakit/es/Form/FormPushButton.js generated vendored Normal file
View File

@@ -0,0 +1,77 @@
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 { 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 { useButton } from '../Button/Button.js';
import { getDocument } from 'reakit-utils/getDocument';
import { f as FORM_PUSH_BUTTON_KEYS } from '../__keys-54ad6269.js';
import { g as getInputId, f as formatInputName } from '../getInputId-aa144169.js';
import { unstable_getIn } from './utils/getIn.js';
import { g as getPushButtonId } from '../getPushButtonId-9f434755.js';
var unstable_useFormPushButton = createHook({
name: "FormPushButton",
compose: useButton,
keys: FORM_PUSH_BUTTON_KEYS,
useOptions: function useOptions(options, _ref) {
var _options$value;
var name = _ref.name,
value = _ref.value;
return _objectSpread2(_objectSpread2({}, options), {}, {
name: options.name || name,
value: (_options$value = options.value) != null ? _options$value : value
});
},
useProps: function useProps(options, _ref2) {
var htmlOnClick = _ref2.onClick,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["onClick"]);
var onClickRef = useLiveRef(htmlOnClick);
var onClick = useCallback(function (event) {
var _onClickRef$current, _options$push;
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
if (event.defaultPrevented) return;
(_options$push = options.push) === null || _options$push === void 0 ? void 0 : _options$push.call(options, options.name, options.value);
var _unstable_getIn = unstable_getIn(options.values, options.name, []),
length = _unstable_getIn.length;
var inputId = getInputId(formatInputName(options.name, "-") + "-" + length, options.baseId);
if (!inputId) return;
var element = event.currentTarget;
window.requestAnimationFrame(function () {
var selector = "[id^=\"" + inputId + "\"]";
var document = getDocument(element);
var input = document.querySelector(selector);
input === null || input === void 0 ? void 0 : input.focus();
});
}, [options.push, options.name, options.value, options.values, options.baseId]);
return _objectSpread2({
id: getPushButtonId(options.name, options.baseId),
onClick: onClick
}, htmlProps);
}
});
var unstable_FormPushButton = createComponent({
as: "button",
memo: true,
useHook: unstable_useFormPushButton
});
export { unstable_FormPushButton, unstable_useFormPushButton };

105
node_modules/reakit/es/Form/FormRadio.js generated vendored Normal file
View File

@@ -0,0 +1,105 @@
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 { useContext, 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/createEvent';
import 'reakit-utils/useSealedState';
import 'reakit-utils/getDocument';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../__keys-6742f591.js';
import '../userFocus-e16425e3.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 '../Group/Group.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
import { g as FORM_RADIO_KEYS } from '../__keys-54ad6269.js';
import { f as formatInputName } from '../getInputId-aa144169.js';
import '../getLabelId-3db05e97.js';
import { unstable_getIn } from './utils/getIn.js';
import '../shouldShowError-e8a86b53.js';
import './FormGroup.js';
import 'reakit-warning/warning';
import '../__keys-d251e56b.js';
import { useRadio } from '../Radio/Radio.js';
import { FormRadioGroupContext } from './FormRadioGroup.js';
var unstable_useFormRadio = createHook({
name: "FormRadio",
compose: useRadio,
keys: FORM_RADIO_KEYS,
useOptions: function useOptions(options, htmlProps) {
var name = options.name || htmlProps.name;
var value = typeof options.value !== "undefined" ? options.value : htmlProps.value;
var composite = useContext(FormRadioGroupContext);
var currentChecked = unstable_getIn(options.values, name);
var checked = currentChecked === value;
if (!composite) {
// TODO: Better error
throw new Error("Missing FormRadioGroup");
}
return _objectSpread2(_objectSpread2(_objectSpread2({}, options), composite), {}, {
checked: checked,
name: name,
value: value
});
},
useProps: function useProps(options, _ref) {
var htmlOnChange = _ref.onChange,
htmlOnBlur = _ref.onBlur,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onChange", "onBlur"]);
var onChangeRef = useLiveRef(htmlOnChange);
var onBlurRef = useLiveRef(htmlOnBlur);
var onChange = useCallback(function (event) {
var _onChangeRef$current, _options$update;
(_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, event);
if (event.defaultPrevented) return;
(_options$update = options.update) === null || _options$update === void 0 ? void 0 : _options$update.call(options, options.name, options.value);
}, [options.update, options.name, options.value]);
var onBlur = useCallback(function (event) {
var _onBlurRef$current, _options$blur;
(_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
if (event.defaultPrevented) return;
(_options$blur = options.blur) === null || _options$blur === void 0 ? void 0 : _options$blur.call(options, options.name);
}, [options.blur, options.name]);
return _objectSpread2({
name: formatInputName(options.name),
onChange: onChange,
onBlur: onBlur
}, htmlProps);
}
});
var unstable_FormRadio = createComponent({
as: "input",
memo: true,
useHook: unstable_useFormRadio
});
export { unstable_FormRadio, unstable_useFormRadio };

70
node_modules/reakit/es/Form/FormRadioGroup.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
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 { createContext, useMemo, useCallback, createElement } from 'react';
import 'reakit-utils/useIsomorphicEffect';
import '../Role/Role.js';
import 'reakit-utils/useSealedState';
import 'reakit-utils/getDocument';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../Id/IdProvider.js';
import '../Group/Group.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import { useCompositeState } from '../Composite/CompositeState.js';
import { h as FORM_RADIO_GROUP_KEYS } from '../__keys-54ad6269.js';
import { g as getInputId } from '../getInputId-aa144169.js';
import '../getLabelId-3db05e97.js';
import './utils/getIn.js';
import '../shouldShowError-e8a86b53.js';
import { unstable_useFormGroup } from './FormGroup.js';
var FormRadioGroupContext = /*#__PURE__*/createContext(null);
var unstable_useFormRadioGroup = createHook({
name: "FormRadioGroup",
compose: unstable_useFormGroup,
keys: FORM_RADIO_GROUP_KEYS,
useOptions: function useOptions(options, _ref) {
var name = _ref.name;
return _objectSpread2(_objectSpread2({}, options), {}, {
name: options.name || name
});
},
useProps: function useProps(options, _ref2) {
var htmlWrapElement = _ref2.wrapElement,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["wrapElement"]);
var id = getInputId(options.name, options.baseId);
var composite = useCompositeState({
baseId: id,
loop: true
});
var providerValue = useMemo(function () {
return composite;
}, Object.values(composite));
var wrapElement = useCallback(function (element) {
element = /*#__PURE__*/createElement(FormRadioGroupContext.Provider, {
value: providerValue
}, element);
if (htmlWrapElement) {
return htmlWrapElement(element);
}
return element;
}, [providerValue, htmlWrapElement]);
return _objectSpread2({
role: "radiogroup",
wrapElement: wrapElement
}, htmlProps);
}
});
var unstable_FormRadioGroup = createComponent({
as: "fieldset",
useHook: unstable_useFormRadioGroup
});
export { FormRadioGroupContext, unstable_FormRadioGroup, unstable_useFormRadioGroup };

94
node_modules/reakit/es/Form/FormRemoveButton.js generated vendored Normal file
View File

@@ -0,0 +1,94 @@
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 { 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 { useButton } from '../Button/Button.js';
import { getDocument } from 'reakit-utils/getDocument';
import { i as FORM_REMOVE_BUTTON_KEYS } from '../__keys-54ad6269.js';
import { g as getInputId } from '../getInputId-aa144169.js';
import { g as getPushButtonId } from '../getPushButtonId-9f434755.js';
var unstable_useFormRemoveButton = createHook({
name: "FormRemoveButton",
compose: useButton,
keys: FORM_REMOVE_BUTTON_KEYS,
useOptions: function useOptions(options, _ref) {
var name = _ref.name;
return _objectSpread2(_objectSpread2({}, options), {}, {
name: options.name || name
});
},
useProps: function useProps(options, _ref2) {
var htmlOnClick = _ref2.onClick,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["onClick"]);
var onClickRef = useLiveRef(htmlOnClick);
var onClick = useCallback(function (event) {
var _onClickRef$current, _options$remove;
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
if (event.defaultPrevented) return;
(_options$remove = options.remove) === null || _options$remove === void 0 ? void 0 : _options$remove.call(options, options.name, options.index);
var inputId = getInputId(options.name, options.baseId);
if (!inputId) return;
var document = getDocument(event.currentTarget);
window.requestAnimationFrame(function () {
var selector = "[id^=\"" + inputId + "-\"]";
var inputs = document.querySelectorAll(selector);
if (inputs.length) {
var inputsArray = Array.from(inputs);
var nextIdx = inputsArray.reduce(function (final, input) {
var match = input.id.match(new RegExp(inputId + "-([0-9]+)"));
if (!match) return final;
var idx = match[1];
if (Number(idx) > final && options.index >= final) {
return Number(idx);
}
return final;
}, 0);
var nextSelector = "[id^=\"" + inputId + "-" + nextIdx + "\"]";
var input = document.querySelector(nextSelector);
if (input) {
input.focus();
return;
}
}
var pushButtonId = getPushButtonId(options.name, options.baseId);
if (pushButtonId) {
var pushButton = document.getElementById(pushButtonId);
pushButton === null || pushButton === void 0 ? void 0 : pushButton.focus();
}
});
}, [options.remove, options.name, options.index, options.baseId]);
return _objectSpread2({
onClick: onClick
}, htmlProps);
}
});
var unstable_FormRemoveButton = createComponent({
as: "button",
memo: true,
useHook: unstable_useFormRemoveButton
});
export { unstable_FormRemoveButton, unstable_useFormRemoveButton };

313
node_modules/reakit/es/Form/FormState.js generated vendored Normal file
View File

@@ -0,0 +1,313 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useReducer, useCallback, useEffect } from 'react';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import { useSealedState } from 'reakit-utils/useSealedState';
import { useUpdateEffect } from 'reakit-utils/useUpdateEffect';
import '../Id/IdProvider.js';
import { unstable_useIdState } from '../Id/IdState.js';
import { isEmpty } from 'reakit-utils/isEmpty';
import { unstable_getIn } from './utils/getIn.js';
import { isPromise } from 'reakit-utils/isPromise';
import { isPlainObject } from 'reakit-utils/isPlainObject';
import { isObject } from 'reakit-utils/isObject';
import { unstable_setAllIn } from './utils/setAllIn.js';
import 'reakit-utils/toArray';
import 'reakit-utils/isInteger';
import { unstable_setIn } from './utils/setIn.js';
function filterAllEmpty(object) {
if (Array.isArray(object)) {
return object.filter(function (value) {
if (isPlainObject(value) || Array.isArray(value)) {
return filterAllEmpty(value);
}
return true;
});
}
var result = {};
var keys = Object.keys(object);
for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
var key = _keys[_i];
var k = key;
var value = object[k];
result[k] = isPlainObject(value) || Array.isArray(value) ? filterAllEmpty(value) : object[k];
}
return result;
}
function hasMessages(errors) {
return isObject(errors) && !isEmpty(errors);
}
function getMessages(stateMessages, actionMessages) {
return !isEmpty(actionMessages) ? actionMessages : isEmpty(stateMessages) ? stateMessages : {};
}
function reducer(state, action) {
switch (action.type) {
case "reset":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
values: state.initialValues,
touched: {},
errors: {},
messages: {},
valid: true,
validating: false,
submitting: false,
submitFailed: 0,
submitSucceed: 0
});
}
case "startValidate":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
validating: true
});
}
case "endValidate":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
validating: false,
errors: getMessages(state.errors, action.errors),
messages: getMessages(state.messages, action.messages),
valid: !hasMessages(action.errors)
});
}
case "startSubmit":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
// @ts-ignore TS bug
touched: unstable_setAllIn(state.values, true),
submitting: true
});
}
case "endSubmit":
{
var valid = !hasMessages(action.errors);
return _objectSpread2(_objectSpread2({}, state), {}, {
valid: valid,
submitting: false,
errors: getMessages(state.errors, action.errors),
messages: getMessages(state.messages, action.messages),
submitSucceed: valid ? state.submitSucceed + 1 : state.submitSucceed,
submitFailed: valid ? state.submitFailed : state.submitFailed + 1
});
}
case "update":
{
var _name = action.name,
_value = action.value;
var nextValue = typeof _value === "function" ? _value(unstable_getIn(state.values, _name)) : _value;
return _objectSpread2(_objectSpread2({}, state), {}, {
values: unstable_setIn(state.values, _name, nextValue != null ? nextValue : "")
});
}
case "blur":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
touched: unstable_setIn(state.touched, action.name, true)
});
}
case "push":
{
var array = unstable_getIn(state.values, action.name, []);
return _objectSpread2(_objectSpread2({}, state), {}, {
values: unstable_setIn(state.values, action.name, [].concat(array, [action.value]))
});
}
case "remove":
{
var _array = unstable_getIn(state.values, action.name, []).slice();
delete _array[action.index];
return _objectSpread2(_objectSpread2({}, state), {}, {
values: unstable_setIn(state.values, action.name, _array)
});
}
default:
{
throw new Error();
}
}
}
function unstable_useFormState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$value = _useSealedState.values,
initialValues = _useSealedState$value === void 0 ? {} : _useSealedState$value,
_useSealedState$valid = _useSealedState.validateOnBlur,
validateOnBlur = _useSealedState$valid === void 0 ? true : _useSealedState$valid,
_useSealedState$valid2 = _useSealedState.validateOnChange,
validateOnChange = _useSealedState$valid2 === void 0 ? true : _useSealedState$valid2,
_useSealedState$reset = _useSealedState.resetOnSubmitSucceed,
resetOnSubmitSucceed = _useSealedState$reset === void 0 ? false : _useSealedState$reset,
_useSealedState$reset2 = _useSealedState.resetOnUnmount,
resetOnUnmount = _useSealedState$reset2 === void 0 ? true : _useSealedState$reset2,
onValidate = _useSealedState.onValidate,
onSubmit = _useSealedState.onSubmit,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["values", "validateOnBlur", "validateOnChange", "resetOnSubmitSucceed", "resetOnUnmount", "onValidate", "onSubmit"]);
var onValidateRef = useLiveRef(typeof initialState !== "function" ? initialState.onValidate : onValidate);
var onSubmitRef = useLiveRef(typeof initialState !== "function" ? initialState.onSubmit : onSubmit);
var id = unstable_useIdState(sealed);
var _React$useReducer = useReducer(reducer, {
initialValues: initialValues,
values: initialValues,
touched: {},
errors: {},
messages: {},
valid: true,
validating: false,
submitting: false,
submitFailed: 0,
submitSucceed: 0
}),
_React$useReducer$ = _React$useReducer[0],
_ = _React$useReducer$.initialValues,
state = _objectWithoutPropertiesLoose(_React$useReducer$, ["initialValues"]),
dispatch = _React$useReducer[1];
var validate = useCallback(function (vals) {
if (vals === void 0) {
vals = state.values;
}
return new Promise(function (resolve) {
if (onValidateRef.current) {
var response = onValidateRef.current(vals);
if (isPromise(response)) {
dispatch({
type: "startValidate"
});
}
resolve(Promise.resolve(response).then(function (messages) {
dispatch({
type: "endValidate",
messages: messages
});
return messages;
}));
} else {
resolve(undefined);
}
}).catch(function (errors) {
dispatch({
type: "endValidate",
errors: errors
});
throw errors;
});
}, [state.values]);
useUpdateEffect(function () {
if (validateOnChange) {
validate().catch(function () {});
}
}, [validate, validateOnChange]);
useEffect(function () {
if (resetOnUnmount) {
return function () {
dispatch({
type: "reset"
});
};
}
return undefined;
}, [resetOnUnmount]);
return _objectSpread2(_objectSpread2(_objectSpread2({}, id), state), {}, {
values: state.values,
validate: validate,
reset: useCallback(function () {
return dispatch({
type: "reset"
});
}, []),
submit: useCallback(function () {
dispatch({
type: "startSubmit"
});
return validate().then(function (validateMessages) {
if (onSubmitRef.current) {
return Promise.resolve(onSubmitRef.current(filterAllEmpty(state.values))).then(function (submitMessages) {
var messages = _objectSpread2(_objectSpread2({}, validateMessages), submitMessages);
dispatch({
type: "endSubmit",
messages: messages
});
});
}
return dispatch({
type: "endSubmit",
messages: validateMessages
});
}).then(function () {
if (resetOnSubmitSucceed) {
dispatch({
type: "reset"
});
}
}).catch(function (errors) {
dispatch({
type: "endSubmit",
errors: errors
});
});
}, [validate]),
update: useCallback(function (name, value) {
return dispatch({
type: "update",
name: name,
value: value
});
}, []),
blur: useCallback(function (name) {
dispatch({
type: "blur",
name: name
});
if (validateOnBlur) {
validate().catch(function () {});
}
}, [validate]),
push: useCallback(function (name, value) {
return dispatch({
type: "push",
name: name,
value: value
});
}, []),
remove: useCallback(function (name, index) {
return dispatch({
type: "remove",
name: name,
index: index
});
}, [])
});
}
export { unstable_useFormState };

70
node_modules/reakit/es/Form/FormSubmitButton.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
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 { 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 { useButton } from '../Button/Button.js';
import { getDocument } from 'reakit-utils/getDocument';
import { j as FORM_SUBMIT_BUTTON_KEYS } from '../__keys-54ad6269.js';
function getFirstInvalidInput(baseId, target) {
var document = getDocument(target);
var selector = "[aria-invalid=true][id^=" + baseId + "]";
return document.querySelector(selector);
}
var unstable_useFormSubmitButton = createHook({
name: "FormSubmitButton",
compose: useButton,
keys: FORM_SUBMIT_BUTTON_KEYS,
useOptions: function useOptions(options) {
return _objectSpread2({
disabled: options.submitting
}, options);
},
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;
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
if (event.defaultPrevented) return;
var element = event.currentTarget;
window.requestAnimationFrame(function () {
var input = getFirstInvalidInput(options.baseId, element);
input === null || input === void 0 ? void 0 : input.focus();
if (input && "select" in input) {
input.select();
}
});
}, [options.baseId]);
return _objectSpread2({
type: "submit",
onClick: onClick
}, htmlProps);
}
});
var unstable_FormSubmitButton = createComponent({
as: "button",
memo: true,
useHook: unstable_useFormSubmitButton
});
export { unstable_FormSubmitButton, unstable_useFormSubmitButton };

71
node_modules/reakit/es/Form/index.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-system/createComponent';
import 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
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 '../Button/Button.js';
import 'reakit-utils/removeIndexFromArray';
import 'reakit-utils/createEvent';
import '../Checkbox/Checkbox.js';
import 'reakit-utils/useSealedState';
import 'reakit-utils/useUpdateEffect';
import 'reakit-utils/getDocument';
import '../reverse-30eaa122.js';
import '../getCurrentId-5aa9849e.js';
import '../findEnabledItemById-8ddca752.js';
import '../__keys-6742f591.js';
import '../userFocus-e16425e3.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 '../Group/Group.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
import 'reakit-utils/isEmpty';
import '../__keys-54ad6269.js';
export { unstable_Form, unstable_useForm } from './Form.js';
import '../getInputId-aa144169.js';
import '../getLabelId-3db05e97.js';
import './utils/getIn.js';
import '../shouldShowError-e8a86b53.js';
export { unstable_FormCheckbox, unstable_useFormCheckbox } from './FormCheckbox.js';
export { unstable_FormGroup, unstable_useFormGroup } from './FormGroup.js';
import '../Input/Input.js';
export { unstable_FormInput, unstable_useFormInput } from './FormInput.js';
export { unstable_FormLabel, unstable_useFormLabel } from './FormLabel.js';
export { unstable_FormMessage, unstable_useFormMessage } from './FormMessage.js';
import '../getPushButtonId-9f434755.js';
export { unstable_FormPushButton, unstable_useFormPushButton } from './FormPushButton.js';
import 'reakit-warning/warning';
import '../__keys-d251e56b.js';
import '../Radio/Radio.js';
export { FormRadioGroupContext, unstable_FormRadioGroup, unstable_useFormRadioGroup } from './FormRadioGroup.js';
export { unstable_FormRadio, unstable_useFormRadio } from './FormRadio.js';
export { unstable_FormRemoveButton, unstable_useFormRemoveButton } from './FormRemoveButton.js';
import 'reakit-utils/isPromise';
import 'reakit-utils/isPlainObject';
export { unstable_useFormState } from './FormState.js';
import 'reakit-utils/isObject';
import './utils/setAllIn.js';
import 'reakit-utils/toArray';
import 'reakit-utils/isInteger';
import './utils/setIn.js';
export { unstable_FormSubmitButton, unstable_useFormSubmitButton } from './FormSubmitButton.js';

23
node_modules/reakit/es/Form/utils/getIn.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import { b as _createForOfIteratorHelperLoose } from '../../_rollupPluginBabelHelpers-1f0bf8c2.js';
function unstable_getIn(object, path, defaultValue) {
if (typeof path === "string") {
return object[path] == null ? defaultValue : object[path];
}
var result = object;
for (var _iterator = _createForOfIteratorHelperLoose(path), _step; !(_step = _iterator()).done;) {
var key = _step.value;
if (!(key in result)) return defaultValue;
result = result[key];
}
if (result == null) {
return defaultValue;
}
return result;
}
export { unstable_getIn };

7
node_modules/reakit/es/Form/utils/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import '../../_rollupPluginBabelHelpers-1f0bf8c2.js';
export { unstable_getIn } from './getIn.js';
import 'reakit-utils/isObject';
export { unstable_setAllIn } from './setAllIn.js';
import 'reakit-utils/toArray';
import 'reakit-utils/isInteger';
export { unstable_setIn } from './setIn.js';

30
node_modules/reakit/es/Form/utils/setAllIn.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import { isObject } from 'reakit-utils/isObject';
function unstable_setAllIn(object, value) {
var typedObject = object;
var result = {};
var keys = Object.keys(object);
for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
var key = _keys[_i];
var val = typedObject[key];
if (Array.isArray(val)) {
result[key] = val.map(function (v) {
if (isObject(v)) {
return unstable_setAllIn(v, value);
}
return value;
});
} else if (isObject(val)) {
result[key] = unstable_setAllIn(val, value);
} else {
result[key] = value;
}
}
return result;
}
export { unstable_setAllIn };

26
node_modules/reakit/es/Form/utils/setIn.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import { a as _objectSpread2 } from '../../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { toArray } from 'reakit-utils/toArray';
import { isInteger } from 'reakit-utils/isInteger';
function unstable_setIn(object, path, value) {
var _objectSpread2$1;
var pathArray = toArray(path);
var key = pathArray[0],
keys = pathArray.slice(1);
if (key == null) return object;
var obj = isInteger(key) ? object || [] : object || {};
var result = keys.length ? unstable_setIn(obj[key], keys, value) : value;
if (isInteger(key)) {
if (object) {
return [].concat(object.slice(0, Number(key)), [result], object.slice(Number(key) + 1));
}
return [result];
}
return _objectSpread2(_objectSpread2({}, object), {}, (_objectSpread2$1 = {}, _objectSpread2$1[key] = result, _objectSpread2$1));
}
export { unstable_setIn };