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

31
node_modules/reakit/es/Box/Box.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import { _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import { shallowEqual } from 'reakit-utils/shallowEqual';
// Automatically generated
var BOX_KEYS = ["unstable_system"];
var useBox = createHook({
name: "Box",
keys: BOX_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
var prevSystem = prev.unstable_system,
prevProps = _objectWithoutPropertiesLoose(prev, ["unstable_system"]);
var nextSystem = next.unstable_system,
nextProps = _objectWithoutPropertiesLoose(next, ["unstable_system"]);
if (prevSystem !== nextSystem && !shallowEqual(prevSystem, nextSystem)) {
return false;
}
return shallowEqual(prevProps, nextProps);
}
});
var Box = createComponent({
as: "div",
useHook: useBox
});
export { Box, useBox };

5
node_modules/reakit/es/Box/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-system/createComponent';
import 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
export { Box, useBox } from './Box.js';

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

@@ -0,0 +1,70 @@
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, useState, useEffect } from 'react';
import { useForkRef } from 'reakit-utils/useForkRef';
import { isButton } from 'reakit-utils/isButton';
import { warning } from '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 { useClickable } from '../Clickable/Clickable.js';
// Automatically generated
var BUTTON_KEYS = [];
var useButton = createHook({
name: "Button",
compose: useClickable,
keys: BUTTON_KEYS,
useProps: function useProps(_, _ref) {
var htmlRef = _ref.ref,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref"]);
var ref = useRef(null);
var _React$useState = useState(undefined),
role = _React$useState[0],
setRole = _React$useState[1];
var _React$useState2 = useState("button"),
type = _React$useState2[0],
setType = _React$useState2[1];
useEffect(function () {
var element = ref.current;
if (!element) {
process.env.NODE_ENV !== "production" ? warning(true, "Can't determine whether the element is a native button because `ref` wasn't passed to the component", "See https://reakit.io/docs/button") : void 0;
return;
}
if (!isButton(element)) {
if (element.tagName !== "A") {
setRole("button");
}
setType(undefined);
}
}, []);
return _objectSpread2({
ref: useForkRef(ref, htmlRef),
role: role,
type: type
}, htmlProps);
}
});
var Button = createComponent({
as: "button",
memo: true,
useHook: useButton
});
export { Button, useButton };

19
node_modules/reakit/es/Button/index.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
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';
export { Button, useButton } from './Button.js';

179
node_modules/reakit/es/Checkbox/Checkbox.js generated vendored Normal file
View File

@@ -0,0 +1,179 @@
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, useState, 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 { useClickable } from '../Clickable/Clickable.js';
import { removeIndexFromArray } from 'reakit-utils/removeIndexFromArray';
import { createEvent } from 'reakit-utils/createEvent';
// Automatically generated
var CHECKBOX_STATE_KEYS = ["state", "setState"];
var CHECKBOX_KEYS = [].concat(CHECKBOX_STATE_KEYS, ["value", "checked"]);
function getChecked(options) {
if (typeof options.checked !== "undefined") {
return options.checked;
}
if (typeof options.value === "undefined") {
return !!options.state;
}
var state = Array.isArray(options.state) ? options.state : [];
return state.indexOf(options.value) !== -1;
}
function fireChange(element, onChange) {
var event = createEvent(element, "change");
Object.defineProperties(event, {
type: {
value: "change"
},
target: {
value: element
},
currentTarget: {
value: element
}
});
onChange === null || onChange === void 0 ? void 0 : onChange(event);
}
function useIndeterminateState(ref, options) {
useEffect(function () {
var element = ref.current;
if (!element) {
process.env.NODE_ENV !== "production" ? warning(options.state === "indeterminate", "Can't set indeterminate state because `ref` wasn't passed to component.", "See https://reakit.io/docs/checkbox/#indeterminate-state") : void 0;
return;
}
if (options.state === "indeterminate") {
element.indeterminate = true;
} else if (element.indeterminate) {
element.indeterminate = false;
}
}, [options.state, ref]);
}
var useCheckbox = createHook({
name: "Checkbox",
compose: useClickable,
keys: CHECKBOX_KEYS,
useOptions: function useOptions(_ref, _ref2) {
var value = _ref2.value,
checked = _ref2.checked;
var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? false : _ref$unstable_clickOn,
options = _objectWithoutPropertiesLoose(_ref, ["unstable_clickOnEnter"]);
return _objectSpread2({
unstable_clickOnEnter: unstable_clickOnEnter,
value: value,
checked: getChecked(_objectSpread2({
checked: checked
}, options))
}, options);
},
useProps: function useProps(options, _ref3) {
var htmlRef = _ref3.ref,
htmlOnChange = _ref3.onChange,
htmlOnClick = _ref3.onClick,
htmlProps = _objectWithoutPropertiesLoose(_ref3, ["ref", "onChange", "onClick"]);
var ref = useRef(null);
var _React$useState = useState(true),
isNativeCheckbox = _React$useState[0],
setIsNativeCheckbox = _React$useState[1];
var onChangeRef = useLiveRef(htmlOnChange);
var onClickRef = useLiveRef(htmlOnClick);
useEffect(function () {
var element = ref.current;
if (!element) {
process.env.NODE_ENV !== "production" ? warning(true, "Can't determine whether the element is a native checkbox because `ref` wasn't passed to the component", "See https://reakit.io/docs/checkbox") : void 0;
return;
}
if (element.tagName !== "INPUT" || element.type !== "checkbox") {
setIsNativeCheckbox(false);
}
}, []);
useIndeterminateState(ref, options);
var onChange = useCallback(function (event) {
var element = event.currentTarget;
if (options.disabled) {
event.stopPropagation();
event.preventDefault();
return;
}
if (onChangeRef.current) {
// If component is NOT rendered as a native input, it will not have
// the `checked` property. So we assign it for consistency.
if (!isNativeCheckbox) {
element.checked = !element.checked;
}
onChangeRef.current(event);
}
if (!options.setState) return;
if (typeof options.value === "undefined") {
options.setState(!options.checked);
} else {
var state = Array.isArray(options.state) ? options.state : [];
var index = state.indexOf(options.value);
if (index === -1) {
options.setState([].concat(state, [options.value]));
} else {
options.setState(removeIndexFromArray(state, index));
}
}
}, [options.disabled, isNativeCheckbox, options.setState, options.value, options.checked, options.state]);
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;
if (isNativeCheckbox) return;
fireChange(event.currentTarget, onChange);
}, [isNativeCheckbox, onChange]);
return _objectSpread2({
ref: useForkRef(ref, htmlRef),
role: !isNativeCheckbox ? "checkbox" : undefined,
type: isNativeCheckbox ? "checkbox" : undefined,
value: isNativeCheckbox ? options.value : undefined,
checked: options.checked,
"aria-checked": options.state === "indeterminate" ? "mixed" : options.checked,
onChange: onChange,
onClick: onClick
}, htmlProps);
}
});
var Checkbox = createComponent({
as: "input",
memo: true,
useHook: useCheckbox
});
export { Checkbox, useCheckbox };

26
node_modules/reakit/es/Checkbox/CheckboxState.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import { useState } from 'react';
import { useSealedState } from 'reakit-utils/useSealedState';
/**
* As simple as `React.useState(false)`
*/
function useCheckboxState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$state = _useSealedState.state,
initialValue = _useSealedState$state === void 0 ? false : _useSealedState$state;
var _React$useState = useState(initialValue),
state = _React$useState[0],
setState = _React$useState[1];
return {
state: state,
setState: setState
};
}
export { useCheckboxState };

23
node_modules/reakit/es/Checkbox/index.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
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 'reakit-utils/removeIndexFromArray';
import 'reakit-utils/createEvent';
export { Checkbox, useCheckbox } from './Checkbox.js';
import 'reakit-utils/useSealedState';
export { useCheckboxState } from './CheckboxState.js';

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

@@ -0,0 +1,105 @@
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 { useState, useCallback } from 'react';
import 'reakit-utils/useForkRef';
import { isButton } from 'reakit-utils/isButton';
import 'reakit-warning';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import { isSelfTarget } from '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 { useTabbable } from '../Tabbable/Tabbable.js';
// Automatically generated
var CLICKABLE_KEYS = ["unstable_clickOnEnter", "unstable_clickOnSpace"];
function isNativeClick(event) {
var element = event.currentTarget;
if (!event.isTrusted) return false; // istanbul ignore next: can't test trusted events yet
return isButton(element) || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "SELECT";
}
var useClickable = createHook({
name: "Clickable",
compose: useTabbable,
keys: CLICKABLE_KEYS,
useOptions: function useOptions(_ref) {
var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? true : _ref$unstable_clickOn,
_ref$unstable_clickOn2 = _ref.unstable_clickOnSpace,
unstable_clickOnSpace = _ref$unstable_clickOn2 === void 0 ? true : _ref$unstable_clickOn2,
options = _objectWithoutPropertiesLoose(_ref, ["unstable_clickOnEnter", "unstable_clickOnSpace"]);
return _objectSpread2({
unstable_clickOnEnter: unstable_clickOnEnter,
unstable_clickOnSpace: unstable_clickOnSpace
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlOnKeyDown = _ref2.onKeyDown,
htmlOnKeyUp = _ref2.onKeyUp,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["onKeyDown", "onKeyUp"]);
var _React$useState = useState(false),
active = _React$useState[0],
setActive = _React$useState[1];
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var onKeyUpRef = useLiveRef(htmlOnKeyUp);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (options.disabled) return;
if (event.metaKey) return;
if (!isSelfTarget(event)) return;
var isEnter = options.unstable_clickOnEnter && event.key === "Enter";
var isSpace = options.unstable_clickOnSpace && event.key === " ";
if (isEnter || isSpace) {
if (isNativeClick(event)) return;
event.preventDefault();
if (isEnter) {
event.currentTarget.click();
} else if (isSpace) {
setActive(true);
}
}
}, [options.disabled, options.unstable_clickOnEnter, options.unstable_clickOnSpace]);
var onKeyUp = useCallback(function (event) {
var _onKeyUpRef$current;
(_onKeyUpRef$current = onKeyUpRef.current) === null || _onKeyUpRef$current === void 0 ? void 0 : _onKeyUpRef$current.call(onKeyUpRef, event);
if (event.defaultPrevented) return;
if (options.disabled) return;
if (event.metaKey) return;
var isSpace = options.unstable_clickOnSpace && event.key === " ";
if (active && isSpace) {
setActive(false);
event.currentTarget.click();
}
}, [options.disabled, options.unstable_clickOnSpace, active]);
return _objectSpread2({
"data-active": active || undefined,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp
}, htmlProps);
}
});
var Clickable = createComponent({
as: "button",
memo: true,
useHook: useClickable
});
export { Clickable, useClickable };

18
node_modules/reakit/es/Clickable/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
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';
export { Clickable, useClickable } from './Clickable.js';

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';

148
node_modules/reakit/es/ComboboxBaseState-73fabcba.js generated vendored Normal file
View File

@@ -0,0 +1,148 @@
import { a as _objectSpread2, b as _createForOfIteratorHelperLoose } from './_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useRef, useState, useMemo, useCallback } from 'react';
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function getMatches(inputValue, values, limit, list, autoSelect, minValueLength) {
if (limit === 0 || inputValue.length < minValueLength) {
// We don't want to populate combobox.matches if inputValue doesn't have
// enough characters.
return [];
}
var length = limit === false ? undefined : limit;
if (!list) {
// If list is false, this means that values aren't expected to be filtered.
return values.slice(0, length);
}
var regex = new RegExp(escapeRegExp(inputValue), "i");
var matches = [];
if (autoSelect) {
var match = values.find(function (value) {
return value.search(regex) === 0;
});
if (match) {
matches.push(match);
}
}
for (var _iterator = _createForOfIteratorHelperLoose(values), _step; !(_step = _iterator()).done;) {
var value = _step.value;
if (length && matches.length >= length) {
break;
} // Excludes first match, that can be auto selected
if (value !== matches[0] && value.search(regex) !== -1) {
matches.push(value);
}
}
return matches;
}
function useComboboxBaseState(composite, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$inputValue = _ref.inputValue,
initialInputValue = _ref$inputValue === void 0 ? "" : _ref$inputValue,
_ref$minValueLength = _ref.minValueLength,
initialMinValueLength = _ref$minValueLength === void 0 ? 0 : _ref$minValueLength,
_ref$values = _ref.values,
initialValues = _ref$values === void 0 ? [] : _ref$values,
_ref$limit = _ref.limit,
initialLimit = _ref$limit === void 0 ? 10 : _ref$limit,
_ref$list = _ref.list,
initialList = _ref$list === void 0 ? !!initialValues.length : _ref$list,
_ref$inline = _ref.inline,
initialInline = _ref$inline === void 0 ? false : _ref$inline,
_ref$autoSelect = _ref.autoSelect,
initialAutoSelect = _ref$autoSelect === void 0 ? false : _ref$autoSelect;
var valuesById = useRef({});
var _React$useState = useState(initialInputValue),
inputValue = _React$useState[0],
setInputValue = _React$useState[1];
var _React$useState2 = useState(initialMinValueLength),
minValueLength = _React$useState2[0],
setMinValueLength = _React$useState2[1];
var _React$useState3 = useState(initialValues),
values = _React$useState3[0],
setValues = _React$useState3[1];
var _React$useState4 = useState(initialLimit),
limit = _React$useState4[0],
setLimit = _React$useState4[1];
var _React$useState5 = useState(initialList),
list = _React$useState5[0],
setList = _React$useState5[1];
var _React$useState6 = useState(initialInline),
inline = _React$useState6[0],
setInline = _React$useState6[1];
var _React$useState7 = useState(initialAutoSelect),
autoSelect = _React$useState7[0],
setAutoSelect = _React$useState7[1];
var matches = useMemo(function () {
return getMatches(inputValue, values, limit, list, autoSelect, minValueLength);
}, [inputValue, values, limit, list, autoSelect, minValueLength]);
var currentValue = useMemo(function () {
return composite.currentId ? valuesById.current[composite.currentId] : undefined;
}, [valuesById, composite.currentId]);
var items = useMemo(function () {
composite.items.forEach(function (item) {
if (item.id) {
item.value = valuesById.current[item.id];
}
});
return composite.items;
}, [composite.items]);
var registerItem = useCallback(function (item) {
composite.registerItem(item);
if (item.id) {
valuesById.current[item.id] = item.value;
}
}, [composite.registerItem]);
var unregisterItem = useCallback(function (id) {
composite.unregisterItem(id);
delete valuesById.current[id];
}, [composite.unregisterItem]);
return _objectSpread2(_objectSpread2({}, composite), {}, {
menuRole: "listbox",
items: items,
registerItem: registerItem,
unregisterItem: unregisterItem,
visible: true,
inputValue: inputValue,
minValueLength: minValueLength,
currentValue: currentValue,
values: values,
limit: limit,
matches: matches,
list: list,
inline: inline,
autoSelect: autoSelect,
setInputValue: setInputValue,
setMinValueLength: setMinValueLength,
setValues: setValues,
setLimit: setLimit,
setList: setList,
setInline: setInline,
setAutoSelect: setAutoSelect
});
}
export { useComboboxBaseState as u };

View File

@@ -0,0 +1,33 @@
import { a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useEffect } from 'react';
import { usePopoverState } from './Popover/PopoverState.js';
function useComboboxPopoverState(combobox, _ref) {
if (_ref === void 0) {
_ref = {};
}
var _ref2 = _ref,
_ref2$gutter = _ref2.gutter,
gutter = _ref2$gutter === void 0 ? 0 : _ref2$gutter,
_ref2$placement = _ref2.placement,
placement = _ref2$placement === void 0 ? "bottom-start" : _ref2$placement,
initialState = _objectWithoutPropertiesLoose(_ref2, ["gutter", "placement"]);
var popover = usePopoverState(_objectSpread2({
gutter: gutter,
placement: placement
}, initialState));
var visible = popover.visible && combobox.inputValue.length >= combobox.minValueLength;
useEffect(function () {
if (!visible) {
// We need to reset combobox.moves
combobox.reset();
}
}, [visible, combobox.reset]);
return _objectSpread2(_objectSpread2(_objectSpread2({}, combobox), popover), {}, {
visible: visible
});
}
export { useComboboxPopoverState as u };

358
node_modules/reakit/es/Composite/Composite.js generated vendored Normal file
View File

@@ -0,0 +1,358 @@
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 { useRef, useEffect, useCallback, useReducer } from 'react';
import { useForkRef } from 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import { warning, useWarning } from 'reakit-warning';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import { isSelfTarget } from 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import { useRole } from '../Role/Role.js';
import { useTabbable } from '../Tabbable/Tabbable.js';
import { useCreateElement } from 'reakit-system/useCreateElement';
import { getDocument } from 'reakit-utils/getDocument';
import { fireBlurEvent } from 'reakit-utils/fireBlurEvent';
import { fireKeyboardEvent } from 'reakit-utils/fireKeyboardEvent';
import { canUseDOM } from 'reakit-utils/canUseDOM';
import { getNextActiveElementOnBlur } from 'reakit-utils/getNextActiveElementOnBlur';
import { f as flatten, r as reverse, g as groupItems } from '../reverse-30eaa122.js';
import { g as getCurrentId, f as findFirstEnabledItem } from '../getCurrentId-5aa9849e.js';
import { f as findEnabledItemById } from '../findEnabledItemById-8ddca752.js';
import { C as COMPOSITE_KEYS } from '../__keys-6742f591.js';
import { u as userFocus } from '../userFocus-e16425e3.js';
var isIE11 = canUseDOM && "msCrypto" in window;
function canProxyKeyboardEvent(event) {
if (!isSelfTarget(event)) return false;
if (event.metaKey) return false;
if (event.key === "Tab") return false;
return true;
}
function useKeyboardEventProxy(virtual, currentItem, htmlEventHandler) {
var eventHandlerRef = useLiveRef(htmlEventHandler);
return useCallback(function (event) {
var _eventHandlerRef$curr;
(_eventHandlerRef$curr = eventHandlerRef.current) === null || _eventHandlerRef$curr === void 0 ? void 0 : _eventHandlerRef$curr.call(eventHandlerRef, event);
if (event.defaultPrevented) return;
if (virtual && canProxyKeyboardEvent(event)) {
var currentElement = currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current;
if (currentElement) {
if (!fireKeyboardEvent(currentElement, event.type, event)) {
event.preventDefault();
} // The event will be triggered on the composite item and then
// propagated up to this composite element again, so we can pretend
// that it wasn't called on this component in the first place.
if (event.currentTarget.contains(currentElement)) {
event.stopPropagation();
}
}
}
}, [virtual, currentItem]);
} // istanbul ignore next
function useActiveElementRef(elementRef) {
var activeElementRef = useRef(null);
useEffect(function () {
var document = getDocument(elementRef.current);
var onFocus = function onFocus(event) {
var target = event.target;
activeElementRef.current = target;
};
document.addEventListener("focus", onFocus, true);
return function () {
document.removeEventListener("focus", onFocus, true);
};
}, []);
return activeElementRef;
}
function findFirstEnabledItemInTheLastRow(items) {
return findFirstEnabledItem(flatten(reverse(groupItems(items))));
}
function isItem(items, element) {
return items === null || items === void 0 ? void 0 : items.some(function (item) {
return !!element && item.ref.current === element;
});
}
function useScheduleUserFocus(currentItem) {
var currentItemRef = useLiveRef(currentItem);
var _React$useReducer = useReducer(function (n) {
return n + 1;
}, 0),
scheduled = _React$useReducer[0],
schedule = _React$useReducer[1];
useEffect(function () {
var _currentItemRef$curre;
var currentElement = (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.ref.current;
if (scheduled && currentElement) {
userFocus(currentElement);
}
}, [scheduled]);
return schedule;
}
var useComposite = createHook({
name: "Composite",
compose: [useTabbable],
keys: COMPOSITE_KEYS,
useOptions: function useOptions(options) {
return _objectSpread2(_objectSpread2({}, options), {}, {
currentId: getCurrentId(options)
});
},
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlOnFocusCapture = _ref.onFocusCapture,
htmlOnFocus = _ref.onFocus,
htmlOnBlurCapture = _ref.onBlurCapture,
htmlOnKeyDown = _ref.onKeyDown,
htmlOnKeyDownCapture = _ref.onKeyDownCapture,
htmlOnKeyUpCapture = _ref.onKeyUpCapture,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "onFocusCapture", "onFocus", "onBlurCapture", "onKeyDown", "onKeyDownCapture", "onKeyUpCapture"]);
var ref = useRef(null);
var currentItem = findEnabledItemById(options.items, options.currentId);
var previousElementRef = useRef(null);
var onFocusCaptureRef = useLiveRef(htmlOnFocusCapture);
var onFocusRef = useLiveRef(htmlOnFocus);
var onBlurCaptureRef = useLiveRef(htmlOnBlurCapture);
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var scheduleUserFocus = useScheduleUserFocus(currentItem); // IE 11 doesn't support event.relatedTarget, so we use the active element
// ref instead.
var activeElementRef = isIE11 ? useActiveElementRef(ref) : undefined;
useEffect(function () {
var element = ref.current;
if (options.unstable_moves && !currentItem) {
process.env.NODE_ENV !== "production" ? warning(!element, "Can't focus composite component because `ref` wasn't passed to component.", "See https://reakit.io/docs/composite") : void 0; // If composite.move(null) has been called, the composite container
// will receive focus.
element === null || element === void 0 ? void 0 : element.focus();
}
}, [options.unstable_moves, currentItem]);
var onKeyDownCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyDownCapture);
var onKeyUpCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyUpCapture);
var onFocusCapture = useCallback(function (event) {
var _onFocusCaptureRef$cu;
(_onFocusCaptureRef$cu = onFocusCaptureRef.current) === null || _onFocusCaptureRef$cu === void 0 ? void 0 : _onFocusCaptureRef$cu.call(onFocusCaptureRef, event);
if (event.defaultPrevented) return;
if (!options.unstable_virtual) return; // IE11 doesn't support event.relatedTarget, so we use the active
// element ref instead.
var previousActiveElement = (activeElementRef === null || activeElementRef === void 0 ? void 0 : activeElementRef.current) || event.relatedTarget;
var previousActiveElementWasItem = isItem(options.items, previousActiveElement);
if (isSelfTarget(event) && previousActiveElementWasItem) {
// Composite has been focused as a result of an item receiving focus.
// The composite item will move focus back to the composite
// container. In this case, we don't want to propagate this
// additional event nor call the onFocus handler passed to
// <Composite onFocus={...} />.
event.stopPropagation(); // We keep track of the previous active item element so we can
// manually fire a blur event on it later when the focus is moved to
// another item on the onBlurCapture event below.
previousElementRef.current = previousActiveElement;
}
}, [options.unstable_virtual, options.items]);
var onFocus = useCallback(function (event) {
var _onFocusRef$current;
(_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
if (event.defaultPrevented) return;
if (options.unstable_virtual) {
if (isSelfTarget(event)) {
// This means that the composite element has been focused while the
// composite item has not. For example, by clicking on the
// composite element without touching any item, or by tabbing into
// the composite element. In this case, we want to trigger focus on
// the item, just like it would happen with roving tabindex.
// When it receives focus, the composite item will put focus back
// on the composite element, in which case hasItemWithFocus will be
// true.
scheduleUserFocus();
}
} else if (isSelfTarget(event)) {
var _options$setCurrentId;
// When the roving tabindex composite gets intentionally focused (for
// example, by clicking directly on it, and not on an item), we make
// sure to set the current id to null (which means the composite
// itself is focused).
(_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, null);
}
}, [options.unstable_virtual, options.setCurrentId]);
var onBlurCapture = useCallback(function (event) {
var _onBlurCaptureRef$cur;
(_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
if (event.defaultPrevented) return;
if (!options.unstable_virtual) return; // When virtual is set to true, we move focus from the composite
// container (this component) to the composite item that is being
// selected. Then we move focus back to the composite container. This
// is so we can provide the same API as the roving tabindex method,
// which means people can attach onFocus/onBlur handlers on the
// CompositeItem component regardless of whether it's virtual or not.
// This sequence of blurring and focusing items and composite may be
// confusing, so we ignore intermediate focus and blurs by stopping its
// propagation and not calling the passed onBlur handler (htmlOnBlur).
var currentElement = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current) || null;
var nextActiveElement = getNextActiveElementOnBlur(event);
var nextActiveElementIsItem = isItem(options.items, nextActiveElement);
if (isSelfTarget(event) && nextActiveElementIsItem) {
// This is an intermediate blur event: blurring the composite
// container to focus an item (nextActiveElement).
if (nextActiveElement === currentElement) {
// The next active element will be the same as the current item in
// the state in two scenarios:
// - Moving focus with keyboard: the state is updated before the
// blur event is triggered, so here the current item is already
// pointing to the next active element.
// - Clicking on the current active item with a pointer: this
// will trigger blur on the composite element and then the next
// active element will be the same as the current item. Clicking on
// an item other than the current one doesn't end up here as the
// currentItem state will be updated only after it.
if (previousElementRef.current && previousElementRef.current !== nextActiveElement) {
// If there's a previous active item and it's not a click action,
// then we fire a blur event on it so it will work just like if
// it had DOM focus before (like when using roving tabindex).
fireBlurEvent(previousElementRef.current, event);
}
} else if (currentElement) {
// This will be true when the next active element is not the
// current element, but there's a current item. This will only
// happen when clicking with a pointer on a different item, when
// there's already an item selected, in which case currentElement
// is the item that is getting blurred, and nextActiveElement is
// the item that is being clicked.
fireBlurEvent(currentElement, event);
} // We want to ignore intermediate blur events, so we stop its
// propagation and return early so onFocus will not be called.
event.stopPropagation();
} else {
var targetIsItem = isItem(options.items, event.target);
if (!targetIsItem && currentElement) {
// If target is not a composite item, it may be the composite
// element itself (isSelfTarget) or a tabbable element inside the
// composite widget. This may be triggered by clicking outside the
// composite widget or by tabbing out of it. In either cases we
// want to fire a blur event on the current item.
fireBlurEvent(currentElement, event);
}
}
}, [options.unstable_virtual, options.items, currentItem]);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current, _options$groups;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (options.currentId !== null) return;
if (!isSelfTarget(event)) return;
var isVertical = options.orientation !== "horizontal";
var isHorizontal = options.orientation !== "vertical";
var isGrid = !!((_options$groups = options.groups) !== null && _options$groups !== void 0 && _options$groups.length);
var up = function up() {
if (isGrid) {
var item = findFirstEnabledItemInTheLastRow(options.items);
if (item !== null && item !== void 0 && item.id) {
var _options$move;
(_options$move = options.move) === null || _options$move === void 0 ? void 0 : _options$move.call(options, item.id);
}
} else {
var _options$last;
(_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
}
};
var keyMap = {
ArrowUp: (isGrid || isVertical) && up,
ArrowRight: (isGrid || isHorizontal) && options.first,
ArrowDown: (isGrid || isVertical) && options.first,
ArrowLeft: (isGrid || isHorizontal) && options.last,
Home: options.first,
End: options.last,
PageUp: options.first,
PageDown: options.last
};
var action = keyMap[event.key];
if (action) {
event.preventDefault();
action();
}
}, [options.currentId, options.orientation, options.groups, options.items, options.move, options.last, options.first]);
return _objectSpread2({
ref: useForkRef(ref, htmlRef),
id: options.baseId,
onFocus: onFocus,
onFocusCapture: onFocusCapture,
onBlurCapture: onBlurCapture,
onKeyDownCapture: onKeyDownCapture,
onKeyDown: onKeyDown,
onKeyUpCapture: onKeyUpCapture,
"aria-activedescendant": options.unstable_virtual ? (currentItem === null || currentItem === void 0 ? void 0 : currentItem.id) || undefined : undefined
}, htmlProps);
},
useComposeProps: function useComposeProps(options, htmlProps) {
htmlProps = useRole(options, htmlProps, true);
var tabbableHTMLProps = useTabbable(options, htmlProps, true);
if (options.unstable_virtual || options.currentId === null) {
// Composite will only be tabbable by default if the focus is managed
// using aria-activedescendant, which requires DOM focus on the container
// element (the composite)
return _objectSpread2({
tabIndex: 0
}, tabbableHTMLProps);
}
return _objectSpread2(_objectSpread2({}, htmlProps), {}, {
ref: tabbableHTMLProps.ref
});
}
});
var Composite = createComponent({
as: "div",
useHook: useComposite,
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/composite") : void 0;
return useCreateElement(type, props, children);
}
});
export { Composite, useComposite };

76
node_modules/reakit/es/Composite/CompositeGroup.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
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 } from 'react';
import { useForkRef } from 'reakit-utils/useForkRef';
import { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';
import '../Role/Role.js';
import { f as findEnabledItemById } from '../findEnabledItemById-8ddca752.js';
import { a as COMPOSITE_GROUP_KEYS } from '../__keys-6742f591.js';
import '../Id/IdProvider.js';
import { unstable_useId } from '../Id/Id.js';
import { useGroup } from '../Group/Group.js';
var useCompositeGroup = createHook({
name: "CompositeGroup",
compose: [useGroup, unstable_useId],
keys: COMPOSITE_GROUP_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
if (!next.id || prev.id !== next.id) {
return useGroup.unstable_propsAreEqual(prev, next);
}
var prevCurrentId = prev.currentId,
prevMoves = prev.unstable_moves,
prevProps = _objectWithoutPropertiesLoose(prev, ["currentId", "unstable_moves"]);
var nextCurrentId = next.currentId,
nextMoves = next.unstable_moves,
nextProps = _objectWithoutPropertiesLoose(next, ["currentId", "unstable_moves"]);
if (prev.items && next.items) {
var prevCurrentItem = findEnabledItemById(prev.items, prevCurrentId);
var nextCurrentItem = findEnabledItemById(next.items, nextCurrentId);
var prevGroupId = prevCurrentItem === null || prevCurrentItem === void 0 ? void 0 : prevCurrentItem.groupId;
var nextGroupId = nextCurrentItem === null || nextCurrentItem === void 0 ? void 0 : nextCurrentItem.groupId;
if (next.id === nextGroupId || next.id === prevGroupId) {
return false;
}
}
return useGroup.unstable_propsAreEqual(prevProps, nextProps);
},
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref"]);
var ref = useRef(null);
var id = options.id; // We need this to be called before CompositeItems' register
useIsomorphicEffect(function () {
var _options$registerGrou;
if (!id) return undefined;
(_options$registerGrou = options.registerGroup) === null || _options$registerGrou === void 0 ? void 0 : _options$registerGrou.call(options, {
id: id,
ref: ref
});
return function () {
var _options$unregisterGr;
(_options$unregisterGr = options.unregisterGroup) === null || _options$unregisterGr === void 0 ? void 0 : _options$unregisterGr.call(options, id);
};
}, [id, options.registerGroup, options.unregisterGroup]);
return _objectSpread2({
ref: useForkRef(ref, htmlRef)
}, htmlProps);
}
});
var CompositeGroup = createComponent({
as: "div",
useHook: useCompositeGroup
});
export { CompositeGroup, useCompositeGroup };

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

@@ -0,0 +1,315 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2, b as _createForOfIteratorHelperLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import { useRef, 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 { isSelfTarget } from 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import { hasFocusWithin } from 'reakit-utils/hasFocusWithin';
import { isPortalEvent } from 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import { useClickable } from '../Clickable/Clickable.js';
import { getDocument } from 'reakit-utils/getDocument';
import { g as getCurrentId } from '../getCurrentId-5aa9849e.js';
import { b as COMPOSITE_ITEM_KEYS } from '../__keys-6742f591.js';
import { u as userFocus, s as setUserFocus, h as hasUserFocus } from '../userFocus-e16425e3.js';
import { isTextField } from 'reakit-utils/isTextField';
import { ensureFocus } from 'reakit-utils/ensureFocus';
import '../Id/IdProvider.js';
import { unstable_useId } from '../Id/Id.js';
import 'reakit-utils/fireEvent';
import { s as setTextFieldValue } from '../setTextFieldValue-0a221f4e.js';
function getWidget(itemElement) {
return itemElement.querySelector("[data-composite-item-widget]");
}
function useItem(options) {
return useMemo(function () {
var _options$items;
return (_options$items = options.items) === null || _options$items === void 0 ? void 0 : _options$items.find(function (item) {
return options.id && item.id === options.id;
});
}, [options.items, options.id]);
}
function targetIsAnotherItem(event, items) {
if (isSelfTarget(event)) return false;
for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
var item = _step.value;
if (item.ref.current === event.target) {
return true;
}
}
return false;
}
var useCompositeItem = createHook({
name: "CompositeItem",
compose: [useClickable, unstable_useId],
keys: COMPOSITE_ITEM_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
if (!next.id || prev.id !== next.id) {
return useClickable.unstable_propsAreEqual(prev, next);
}
var prevCurrentId = prev.currentId,
prevMoves = prev.unstable_moves,
prevProps = _objectWithoutPropertiesLoose(prev, ["currentId", "unstable_moves"]);
var nextCurrentId = next.currentId,
nextMoves = next.unstable_moves,
nextProps = _objectWithoutPropertiesLoose(next, ["currentId", "unstable_moves"]);
if (nextCurrentId !== prevCurrentId) {
if (next.id === nextCurrentId || next.id === prevCurrentId) {
return false;
}
} else if (prevMoves !== nextMoves) {
return false;
}
return useClickable.unstable_propsAreEqual(prevProps, nextProps);
},
useOptions: function useOptions(options) {
return _objectSpread2(_objectSpread2({}, options), {}, {
id: options.id,
currentId: getCurrentId(options),
unstable_clickOnSpace: options.unstable_hasActiveWidget ? false : options.unstable_clickOnSpace
});
},
useProps: function useProps(options, _ref) {
var _options$items2;
var htmlRef = _ref.ref,
_ref$tabIndex = _ref.tabIndex,
htmlTabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
htmlOnMouseDown = _ref.onMouseDown,
htmlOnFocus = _ref.onFocus,
htmlOnBlurCapture = _ref.onBlurCapture,
htmlOnKeyDown = _ref.onKeyDown,
htmlOnClick = _ref.onClick,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "tabIndex", "onMouseDown", "onFocus", "onBlurCapture", "onKeyDown", "onClick"]);
var ref = useRef(null);
var id = options.id;
var trulyDisabled = options.disabled && !options.focusable;
var isCurrentItem = options.currentId === id;
var isCurrentItemRef = useLiveRef(isCurrentItem);
var hasFocusedComposite = useRef(false);
var item = useItem(options);
var onMouseDownRef = useLiveRef(htmlOnMouseDown);
var onFocusRef = useLiveRef(htmlOnFocus);
var onBlurCaptureRef = useLiveRef(htmlOnBlurCapture);
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var onClickRef = useLiveRef(htmlOnClick);
var shouldTabIndex = !options.unstable_virtual && !options.unstable_hasActiveWidget && isCurrentItem || // We don't want to set tabIndex="-1" when using CompositeItem as a
// standalone component, without state props.
!((_options$items2 = options.items) !== null && _options$items2 !== void 0 && _options$items2.length);
useEffect(function () {
var _options$registerItem;
if (!id) return undefined;
(_options$registerItem = options.registerItem) === null || _options$registerItem === void 0 ? void 0 : _options$registerItem.call(options, {
id: id,
ref: ref,
disabled: !!trulyDisabled
});
return function () {
var _options$unregisterIt;
(_options$unregisterIt = options.unregisterItem) === null || _options$unregisterIt === void 0 ? void 0 : _options$unregisterIt.call(options, id);
};
}, [id, trulyDisabled, options.registerItem, options.unregisterItem]);
useEffect(function () {
var element = ref.current;
if (!element) {
process.env.NODE_ENV !== "production" ? warning(true, "Can't focus composite item component because `ref` wasn't passed to component.", "See https://reakit.io/docs/composite") : void 0;
return;
} // `moves` will be incremented whenever next, previous, up, down, first,
// last or move have been called. This means that the composite item will
// be focused whenever some of these functions are called. We're using
// isCurrentItemRef instead of isCurrentItem because we don't want to
// focus the item if isCurrentItem changes (and options.moves doesn't).
if (options.unstable_moves && isCurrentItemRef.current) {
userFocus(element);
}
}, [options.unstable_moves]);
var onMouseDown = useCallback(function (event) {
var _onMouseDownRef$curre;
(_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
setUserFocus(event.currentTarget, true);
}, []);
var onFocus = useCallback(function (event) {
var _onFocusRef$current, _options$setCurrentId;
var shouldFocusComposite = hasUserFocus(event.currentTarget);
setUserFocus(event.currentTarget, false);
(_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
if (event.defaultPrevented) return;
if (isPortalEvent(event)) return;
if (!id) return;
if (targetIsAnotherItem(event, options.items)) return;
(_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, id); // When using aria-activedescendant, we want to make sure that the
// composite container receives focus, not the composite item.
// But we don't want to do this if the target is another focusable
// element inside the composite item, such as CompositeItemWidget.
if (shouldFocusComposite && options.unstable_virtual && options.baseId && isSelfTarget(event)) {
var target = event.target;
var composite = getDocument(target).getElementById(options.baseId);
if (composite) {
hasFocusedComposite.current = true;
ensureFocus(composite);
}
}
}, [id, options.items, options.setCurrentId, options.unstable_virtual, options.baseId]);
var onBlurCapture = useCallback(function (event) {
var _onBlurCaptureRef$cur;
(_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
if (event.defaultPrevented) return;
if (options.unstable_virtual && hasFocusedComposite.current) {
// When hasFocusedComposite is true, composite has been focused right
// after focusing this item. This is an intermediate blur event, so
// we ignore it.
hasFocusedComposite.current = false;
event.preventDefault();
event.stopPropagation();
}
}, [options.unstable_virtual]);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current;
if (!isSelfTarget(event)) return;
var isVertical = options.orientation !== "horizontal";
var isHorizontal = options.orientation !== "vertical";
var isGrid = !!(item !== null && item !== void 0 && item.groupId);
var keyMap = {
ArrowUp: (isGrid || isVertical) && options.up,
ArrowRight: (isGrid || isHorizontal) && options.next,
ArrowDown: (isGrid || isVertical) && options.down,
ArrowLeft: (isGrid || isHorizontal) && options.previous,
Home: function Home() {
if (!isGrid || event.ctrlKey) {
var _options$first;
(_options$first = options.first) === null || _options$first === void 0 ? void 0 : _options$first.call(options);
} else {
var _options$previous;
(_options$previous = options.previous) === null || _options$previous === void 0 ? void 0 : _options$previous.call(options, true);
}
},
End: function End() {
if (!isGrid || event.ctrlKey) {
var _options$last;
(_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
} else {
var _options$next;
(_options$next = options.next) === null || _options$next === void 0 ? void 0 : _options$next.call(options, true);
}
},
PageUp: function PageUp() {
if (isGrid) {
var _options$up;
(_options$up = options.up) === null || _options$up === void 0 ? void 0 : _options$up.call(options, true);
} else {
var _options$first2;
(_options$first2 = options.first) === null || _options$first2 === void 0 ? void 0 : _options$first2.call(options);
}
},
PageDown: function PageDown() {
if (isGrid) {
var _options$down;
(_options$down = options.down) === null || _options$down === void 0 ? void 0 : _options$down.call(options, true);
} else {
var _options$last2;
(_options$last2 = options.last) === null || _options$last2 === void 0 ? void 0 : _options$last2.call(options);
}
}
};
var action = keyMap[event.key];
if (action) {
event.preventDefault();
action();
return;
}
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (event.key.length === 1 && event.key !== " ") {
var widget = getWidget(event.currentTarget);
if (widget && isTextField(widget)) {
widget.focus();
setTextFieldValue(widget, "");
}
} else if (event.key === "Delete" || event.key === "Backspace") {
var _widget = getWidget(event.currentTarget);
if (_widget && isTextField(_widget)) {
event.preventDefault();
setTextFieldValue(_widget, "");
}
}
}, [options.orientation, item, options.up, options.next, options.down, options.previous, options.first, options.last]);
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;
var widget = getWidget(element);
if (widget && !hasFocusWithin(widget)) {
// If there's a widget inside the composite item, we make sure it's
// focused when pressing enter, space or clicking on the composite item.
widget.focus();
}
}, []);
return _objectSpread2({
ref: useForkRef(ref, htmlRef),
id: id,
tabIndex: shouldTabIndex ? htmlTabIndex : -1,
"aria-selected": options.unstable_virtual && isCurrentItem ? true : undefined,
onMouseDown: onMouseDown,
onFocus: onFocus,
onBlurCapture: onBlurCapture,
onKeyDown: onKeyDown,
onClick: onClick
}, htmlProps);
}
});
var CompositeItem = createComponent({
as: "button",
memo: true,
useHook: useCompositeItem
});
export { CompositeItem, useCompositeItem };

View File

@@ -0,0 +1,97 @@
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, useCallback } from 'react';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import { isSelfTarget } from 'reakit-utils/isSelfTarget';
import { useRole } from '../Role/Role.js';
import { getDocument } from 'reakit-utils/getDocument';
import { c as COMPOSITE_ITEM_WIDGET_KEYS } from '../__keys-6742f591.js';
import { isTextField } from 'reakit-utils/isTextField';
import 'reakit-utils/fireEvent';
import { s as setTextFieldValue } from '../setTextFieldValue-0a221f4e.js';
function focusCurrentItem(widget, currentId) {
if (currentId) {
var _getDocument$getEleme;
(_getDocument$getEleme = getDocument(widget).getElementById(currentId)) === null || _getDocument$getEleme === void 0 ? void 0 : _getDocument$getEleme.focus();
}
}
function getTextFieldValue(element) {
return element.value;
}
var unstable_useCompositeItemWidget = createHook({
name: "CompositeItemWidget",
compose: useRole,
keys: COMPOSITE_ITEM_WIDGET_KEYS,
useProps: function useProps(options, _ref) {
var htmlOnFocus = _ref.onFocus,
htmlOnBlur = _ref.onBlur,
htmlOnKeyDown = _ref.onKeyDown,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onFocus", "onBlur", "onKeyDown"]);
var initialValue = useRef("");
var onFocusRef = useLiveRef(htmlOnFocus);
var onBlurRef = useLiveRef(htmlOnBlur);
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var onFocus = useCallback(function (event) {
var _onFocusRef$current, _options$unstable_set;
(_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
(_options$unstable_set = options.unstable_setHasActiveWidget) === null || _options$unstable_set === void 0 ? void 0 : _options$unstable_set.call(options, true);
if (isTextField(event.currentTarget)) {
initialValue.current = getTextFieldValue(event.currentTarget);
}
}, [options.unstable_setHasActiveWidget]);
var onBlur = useCallback(function (event) {
var _onBlurRef$current, _options$unstable_set2;
(_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
(_options$unstable_set2 = options.unstable_setHasActiveWidget) === null || _options$unstable_set2 === void 0 ? void 0 : _options$unstable_set2.call(options, false);
}, [options.unstable_setHasActiveWidget]);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (!isSelfTarget(event)) return;
if (event.nativeEvent.isComposing) return;
var element = event.currentTarget;
if (event.key === "Enter") {
if (isTextField(element)) {
var isMultilineTextField = element.tagName === "TEXTAREA"; // Make sure we can create new lines using Shift+Enter
if (isMultilineTextField && event.shiftKey) return; // Make sure it'll not trigger a click on the parent button
event.preventDefault();
focusCurrentItem(element, options.currentId);
}
} else if (event.key === "Escape") {
focusCurrentItem(element, options.currentId);
if (isTextField(element)) {
setTextFieldValue(element, initialValue.current);
}
}
}, [options.currentId]);
return _objectSpread2({
tabIndex: options.unstable_hasActiveWidget ? 0 : -1,
"data-composite-item-widget": true,
onFocus: onFocus,
onBlur: onBlur,
onKeyDown: onKeyDown
}, htmlProps);
}
});
var unstable_CompositeItemWidget = createComponent({
as: "div",
useHook: unstable_useCompositeItemWidget
});
export { unstable_CompositeItemWidget, unstable_useCompositeItemWidget };

935
node_modules/reakit/es/Composite/CompositeState.js generated vendored Normal file
View File

@@ -0,0 +1,935 @@
import { b as _createForOfIteratorHelperLoose, a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useRef, useEffect, useReducer, useState, useCallback } from 'react';
import { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';
import { useSealedState } from 'reakit-utils/useSealedState';
import { getDocument } from 'reakit-utils/getDocument';
import { g as groupItems, r as reverse, f as flatten } from '../reverse-30eaa122.js';
import { f as findFirstEnabledItem, g as getCurrentId } from '../getCurrentId-5aa9849e.js';
import { f as findEnabledItemById } from '../findEnabledItemById-8ddca752.js';
import '../Id/IdProvider.js';
import { applyState } from 'reakit-utils/applyState';
import { unstable_useIdState } from '../Id/IdState.js';
function isElementPreceding(element1, element2) {
return Boolean(element2.compareDocumentPosition(element1) & Node.DOCUMENT_POSITION_PRECEDING);
}
function findDOMIndex(items, item) {
return items.findIndex(function (currentItem) {
if (!currentItem.ref.current || !item.ref.current) {
return false;
}
return isElementPreceding(item.ref.current, currentItem.ref.current);
});
}
function getMaxLength(rows) {
var maxLength = 0;
for (var _iterator = _createForOfIteratorHelperLoose(rows), _step; !(_step = _iterator()).done;) {
var length = _step.value.length;
if (length > maxLength) {
maxLength = length;
}
}
return maxLength;
}
/**
* Turns [row1, row1, row2, row2] into [row1, row2, row1, row2]
*/
function verticalizeItems(items) {
var groups = groupItems(items);
var maxLength = getMaxLength(groups);
var verticalized = [];
for (var i = 0; i < maxLength; i += 1) {
for (var _iterator = _createForOfIteratorHelperLoose(groups), _step; !(_step = _iterator()).done;) {
var group = _step.value;
if (group[i]) {
verticalized.push(_objectSpread2(_objectSpread2({}, group[i]), {}, {
// If there's no groupId, it means that it's not a grid composite,
// but a single row instead. So, instead of verticalizing it, that
// is, assigning a different groupId based on the column index, we
// keep it undefined so they will be part of the same group.
// It's useful when using up/down on one-dimensional composites.
groupId: group[i].groupId ? "" + i : undefined
}));
}
}
}
return verticalized;
}
function createEmptyItem(groupId) {
return {
id: "__EMPTY_ITEM__",
disabled: true,
ref: {
current: null
},
groupId: groupId
};
}
/**
* Turns [[row1, row1], [row2]] into [[row1, row1], [row2, row2]]
*/
function fillGroups(groups, currentId, shift) {
var maxLength = getMaxLength(groups);
for (var _iterator = _createForOfIteratorHelperLoose(groups), _step; !(_step = _iterator()).done;) {
var group = _step.value;
for (var i = 0; i < maxLength; i += 1) {
var item = group[i];
if (!item || shift && item.disabled) {
var isFrist = i === 0;
var previousItem = isFrist && shift ? findFirstEnabledItem(group) : group[i - 1];
group[i] = previousItem && currentId !== (previousItem === null || previousItem === void 0 ? void 0 : previousItem.id) && shift ? previousItem : createEmptyItem(previousItem === null || previousItem === void 0 ? void 0 : previousItem.groupId);
}
}
}
return groups;
}
var nullItem = {
id: null,
ref: {
current: null
}
};
function placeItemsAfter(items, id, shouldInsertNullItem) {
var index = items.findIndex(function (item) {
return item.id === id;
});
return [].concat(items.slice(index + 1), shouldInsertNullItem ? [nullItem] : [], items.slice(0, index));
}
function getItemsInGroup(items, groupId) {
return items.filter(function (item) {
return item.groupId === groupId;
});
}
var map = {
horizontal: "vertical",
vertical: "horizontal"
};
function getOppositeOrientation(orientation) {
return orientation && map[orientation];
}
function addItemAtIndex(array, item, index) {
if (!(index in array)) {
return [].concat(array, [item]);
}
return [].concat(array.slice(0, index), [item], array.slice(index));
}
function sortBasedOnDOMPosition(items) {
var pairs = items.map(function (item, index) {
return [index, item];
});
var isOrderDifferent = false;
pairs.sort(function (_ref, _ref2) {
var indexA = _ref[0],
a = _ref[1];
var indexB = _ref2[0],
b = _ref2[1];
var elementA = a.ref.current;
var elementB = b.ref.current;
if (!elementA || !elementB) return 0; // a before b
if (isElementPreceding(elementA, elementB)) {
if (indexA > indexB) {
isOrderDifferent = true;
}
return -1;
} // a after b
if (indexA < indexB) {
isOrderDifferent = true;
}
return 1;
});
if (isOrderDifferent) {
return pairs.map(function (_ref3) {
var _ = _ref3[0],
item = _ref3[1];
return item;
});
}
return items;
}
function setItemsBasedOnDOMPosition(items, setItems) {
var sortedItems = sortBasedOnDOMPosition(items);
if (items !== sortedItems) {
setItems(sortedItems);
}
}
function getCommonParent(items) {
var _firstItem$ref$curren;
var firstItem = items[0],
nextItems = items.slice(1);
var parentElement = firstItem === null || firstItem === void 0 ? void 0 : (_firstItem$ref$curren = firstItem.ref.current) === null || _firstItem$ref$curren === void 0 ? void 0 : _firstItem$ref$curren.parentElement;
var _loop = function _loop() {
var parent = parentElement;
if (nextItems.every(function (item) {
return parent.contains(item.ref.current);
})) {
return {
v: parentElement
};
}
parentElement = parentElement.parentElement;
};
while (parentElement) {
var _ret = _loop();
if (typeof _ret === "object") return _ret.v;
}
return getDocument(parentElement).body;
} // istanbul ignore next: JSDOM doesn't support IntersectionObverser
// See https://github.com/jsdom/jsdom/issues/2032
function useIntersectionObserver(items, setItems) {
var previousItems = useRef([]);
useEffect(function () {
var callback = function callback() {
var hasPreviousItems = !!previousItems.current.length; // We don't want to sort items if items have been just registered.
if (hasPreviousItems) {
setItemsBasedOnDOMPosition(items, setItems);
}
previousItems.current = items;
};
var root = getCommonParent(items);
var observer = new IntersectionObserver(callback, {
root: root
});
for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
var item = _step.value;
if (item.ref.current) {
observer.observe(item.ref.current);
}
}
return function () {
observer.disconnect();
};
}, [items]);
}
function useTimeoutObserver(items, setItems) {
useEffect(function () {
var callback = function callback() {
return setItemsBasedOnDOMPosition(items, setItems);
};
var timeout = setTimeout(callback, 250);
return function () {
return clearTimeout(timeout);
};
});
}
function useSortBasedOnDOMPosition(items, setItems) {
if (typeof IntersectionObserver === "function") {
useIntersectionObserver(items, setItems);
} else {
useTimeoutObserver(items, setItems);
}
}
function reducer(state, action) {
var virtual = state.unstable_virtual,
rtl = state.rtl,
orientation = state.orientation,
items = state.items,
groups = state.groups,
currentId = state.currentId,
loop = state.loop,
wrap = state.wrap,
pastIds = state.pastIds,
shift = state.shift,
moves = state.unstable_moves,
includesBaseElement = state.unstable_includesBaseElement,
initialVirtual = state.initialVirtual,
initialRTL = state.initialRTL,
initialOrientation = state.initialOrientation,
initialCurrentId = state.initialCurrentId,
initialLoop = state.initialLoop,
initialWrap = state.initialWrap,
initialShift = state.initialShift,
hasSetCurrentId = state.hasSetCurrentId;
switch (action.type) {
case "registerGroup":
{
var _group = action.group; // If there are no groups yet, just add it as the first one
if (groups.length === 0) {
return _objectSpread2(_objectSpread2({}, state), {}, {
groups: [_group]
});
} // Finds the group index based on DOM position
var index = findDOMIndex(groups, _group);
return _objectSpread2(_objectSpread2({}, state), {}, {
groups: addItemAtIndex(groups, _group, index)
});
}
case "unregisterGroup":
{
var _id = action.id;
var nextGroups = groups.filter(function (group) {
return group.id !== _id;
}); // The group isn't registered, so do nothing
if (nextGroups.length === groups.length) {
return state;
}
return _objectSpread2(_objectSpread2({}, state), {}, {
groups: nextGroups
});
}
case "registerItem":
{
var _item = action.item; // Finds the item group based on the DOM hierarchy
var _group2 = groups.find(function (r) {
var _r$ref$current;
return (_r$ref$current = r.ref.current) === null || _r$ref$current === void 0 ? void 0 : _r$ref$current.contains(_item.ref.current);
}); // Group will be null if it's a one-dimensional composite
var nextItem = _objectSpread2({
groupId: _group2 === null || _group2 === void 0 ? void 0 : _group2.id
}, _item);
var _index = findDOMIndex(items, nextItem);
var nextState = _objectSpread2(_objectSpread2({}, state), {}, {
items: addItemAtIndex(items, nextItem, _index)
});
if (!hasSetCurrentId && !moves && initialCurrentId === undefined) {
var _findFirstEnabledItem;
// Sets currentId to the first enabled item. This runs whenever an item
// is registered because the first enabled item may be registered
// asynchronously.
return _objectSpread2(_objectSpread2({}, nextState), {}, {
currentId: (_findFirstEnabledItem = findFirstEnabledItem(nextState.items)) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id
});
}
return nextState;
}
case "unregisterItem":
{
var _id2 = action.id;
var nextItems = items.filter(function (item) {
return item.id !== _id2;
}); // The item isn't registered, so do nothing
if (nextItems.length === items.length) {
return state;
} // Filters out the item that is being removed from the pastIds list
var nextPastIds = pastIds.filter(function (pastId) {
return pastId !== _id2;
});
var _nextState = _objectSpread2(_objectSpread2({}, state), {}, {
pastIds: nextPastIds,
items: nextItems
}); // If the current item is the item that is being removed, focus pastId
if (currentId && currentId === _id2) {
var nextId = includesBaseElement ? null : getCurrentId(_objectSpread2(_objectSpread2({}, _nextState), {}, {
currentId: nextPastIds[0]
}));
return _objectSpread2(_objectSpread2({}, _nextState), {}, {
currentId: nextId
});
}
return _nextState;
}
case "move":
{
var _id3 = action.id; // move() does nothing
if (_id3 === undefined) {
return state;
} // Removes the current item and the item that is receiving focus from the
// pastIds list
var filteredPastIds = pastIds.filter(function (pastId) {
return pastId !== currentId && pastId !== _id3;
}); // If there's a currentId, add it to the pastIds list so it can be focused
// if the new item gets removed or disabled
var _nextPastIds = currentId ? [currentId].concat(filteredPastIds) : filteredPastIds;
var _nextState2 = _objectSpread2(_objectSpread2({}, state), {}, {
pastIds: _nextPastIds
}); // move(null) will focus the composite element itself, not an item
if (_id3 === null) {
return _objectSpread2(_objectSpread2({}, _nextState2), {}, {
unstable_moves: moves + 1,
currentId: getCurrentId(_nextState2, _id3)
});
}
var _item2 = findEnabledItemById(items, _id3);
return _objectSpread2(_objectSpread2({}, _nextState2), {}, {
unstable_moves: _item2 ? moves + 1 : moves,
currentId: getCurrentId(_nextState2, _item2 === null || _item2 === void 0 ? void 0 : _item2.id)
});
}
case "next":
{
// If there's no item focused, we just move the first one
if (currentId == null) {
return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
type: "first"
}));
} // RTL doesn't make sense on vertical navigation
var isHorizontal = orientation !== "vertical";
var isRTL = rtl && isHorizontal;
var allItems = isRTL ? reverse(items) : items;
var currentItem = allItems.find(function (item) {
return item.id === currentId;
}); // If there's no item focused, we just move the first one
if (!currentItem) {
return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
type: "first"
}));
}
var isGrid = !!currentItem.groupId;
var currentIndex = allItems.indexOf(currentItem);
var _nextItems = allItems.slice(currentIndex + 1);
var nextItemsInGroup = getItemsInGroup(_nextItems, currentItem.groupId); // Home, End
if (action.allTheWay) {
// We reverse so we can get the last enabled item in the group. If it's
// RTL, nextItems and nextItemsInGroup are already reversed and don't
// have the items before the current one anymore. So we have to get
// items in group again with allItems.
var _nextItem2 = findFirstEnabledItem(isRTL ? getItemsInGroup(allItems, currentItem.groupId) : reverse(nextItemsInGroup));
return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
type: "move",
id: _nextItem2 === null || _nextItem2 === void 0 ? void 0 : _nextItem2.id
}));
}
var oppositeOrientation = getOppositeOrientation( // If it's a grid and orientation is not set, it's a next/previous
// call, which is inherently horizontal. up/down will call next with
// orientation set to vertical by default (see below on up/down cases).
isGrid ? orientation || "horizontal" : orientation);
var canLoop = loop && loop !== oppositeOrientation;
var canWrap = isGrid && wrap && wrap !== oppositeOrientation;
var hasNullItem = // `previous` and `up` will set action.hasNullItem, but when calling
// next directly, hasNullItem will only be true if it's not a grid and
// loop is set to true, which means that pressing right or down keys on
// grids will never focus the composite element. On one-dimensional
// composites that don't loop, pressing right or down keys also doesn't
// focus the composite element.
action.hasNullItem || !isGrid && canLoop && includesBaseElement;
if (canLoop) {
var loopItems = canWrap && !hasNullItem ? allItems : getItemsInGroup(allItems, currentItem.groupId); // Turns [0, 1, current, 3, 4] into [3, 4, 0, 1]
var sortedItems = placeItemsAfter(loopItems, currentId, hasNullItem);
var _nextItem3 = findFirstEnabledItem(sortedItems, currentId);
return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
type: "move",
id: _nextItem3 === null || _nextItem3 === void 0 ? void 0 : _nextItem3.id
}));
}
if (canWrap) {
var _nextItem4 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including
// items from other groups, to wrap between groups. However, if there
// is a null item (the composite element), we'll only use the next
// items in the group. So moving next from the last item will focus
// the composite element (null). On grid composites, horizontal
// navigation never focuses the composite element, only vertical.
hasNullItem ? nextItemsInGroup : _nextItems, currentId);
var _nextId = hasNullItem ? (_nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id) || null : _nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id;
return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
type: "move",
id: _nextId
}));
}
var _nextItem = findFirstEnabledItem(nextItemsInGroup, currentId);
if (!_nextItem && hasNullItem) {
return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
type: "move",
id: null
}));
}
return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
type: "move",
id: _nextItem === null || _nextItem === void 0 ? void 0 : _nextItem.id
}));
}
case "previous":
{
// If currentId is initially set to null, the composite element will be
// focusable while navigating with arrow keys. But, if it's a grid, we
// don't want to focus the composite element with horizontal navigation.
var _isGrid = !!groups.length;
var _hasNullItem = !_isGrid && includesBaseElement;
var _nextState3 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
items: reverse(items)
}), _objectSpread2(_objectSpread2({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem
}));
return _objectSpread2(_objectSpread2({}, _nextState3), {}, {
items: items
});
}
case "down":
{
var shouldShift = shift && !action.allTheWay; // First, we make sure groups have the same number of items by filling it
// with disabled fake items. Then, we reorganize the items list so
// [1-1, 1-2, 2-1, 2-2] becomes [1-1, 2-1, 1-2, 2-2].
var verticalItems = verticalizeItems(flatten(fillGroups(groupItems(items), currentId, shouldShift)));
var _canLoop = loop && loop !== "horizontal"; // Pressing down arrow key will only focus the composite element if loop
// is true or vertical.
var _hasNullItem2 = _canLoop && includesBaseElement;
var _nextState4 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
orientation: "vertical",
items: verticalItems
}), _objectSpread2(_objectSpread2({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem2
}));
return _objectSpread2(_objectSpread2({}, _nextState4), {}, {
orientation: orientation,
items: items
});
}
case "up":
{
var _shouldShift = shift && !action.allTheWay;
var _verticalItems = verticalizeItems(reverse(flatten(fillGroups(groupItems(items), currentId, _shouldShift)))); // If currentId is initially set to null, we'll always focus the
// composite element when the up arrow key is pressed in the first row.
var _hasNullItem3 = includesBaseElement;
var _nextState5 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
orientation: "vertical",
items: _verticalItems
}), _objectSpread2(_objectSpread2({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem3
}));
return _objectSpread2(_objectSpread2({}, _nextState5), {}, {
orientation: orientation,
items: items
});
}
case "first":
{
var firstItem = findFirstEnabledItem(items);
return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
type: "move",
id: firstItem === null || firstItem === void 0 ? void 0 : firstItem.id
}));
}
case "last":
{
var _nextState6 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
items: reverse(items)
}), _objectSpread2(_objectSpread2({}, action), {}, {
type: "first"
}));
return _objectSpread2(_objectSpread2({}, _nextState6), {}, {
items: items
});
}
case "sort":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
items: sortBasedOnDOMPosition(items),
groups: sortBasedOnDOMPosition(groups)
});
}
case "setVirtual":
return _objectSpread2(_objectSpread2({}, state), {}, {
unstable_virtual: applyState(action.virtual, virtual)
});
case "setRTL":
return _objectSpread2(_objectSpread2({}, state), {}, {
rtl: applyState(action.rtl, rtl)
});
case "setOrientation":
return _objectSpread2(_objectSpread2({}, state), {}, {
orientation: applyState(action.orientation, orientation)
});
case "setCurrentId":
{
var nextCurrentId = getCurrentId(_objectSpread2(_objectSpread2({}, state), {}, {
currentId: applyState(action.currentId, currentId)
}));
return _objectSpread2(_objectSpread2({}, state), {}, {
currentId: nextCurrentId,
hasSetCurrentId: true
});
}
case "setLoop":
return _objectSpread2(_objectSpread2({}, state), {}, {
loop: applyState(action.loop, loop)
});
case "setWrap":
return _objectSpread2(_objectSpread2({}, state), {}, {
wrap: applyState(action.wrap, wrap)
});
case "setShift":
return _objectSpread2(_objectSpread2({}, state), {}, {
shift: applyState(action.shift, shift)
});
case "setIncludesBaseElement":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
unstable_includesBaseElement: applyState(action.includesBaseElement, includesBaseElement)
});
}
case "reset":
return _objectSpread2(_objectSpread2({}, state), {}, {
unstable_virtual: initialVirtual,
rtl: initialRTL,
orientation: initialOrientation,
currentId: getCurrentId(_objectSpread2(_objectSpread2({}, state), {}, {
currentId: initialCurrentId
})),
loop: initialLoop,
wrap: initialWrap,
shift: initialShift,
unstable_moves: 0,
pastIds: []
});
case "setItems":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
items: action.items
});
}
default:
throw new Error();
}
}
function useAction(fn) {
return useCallback(fn, []);
}
function useIsUnmountedRef() {
var isUnmountedRef = useRef(false);
useIsomorphicEffect(function () {
return function () {
isUnmountedRef.current = true;
};
}, []);
return isUnmountedRef;
}
function useCompositeState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$unsta = _useSealedState.unstable_virtual,
virtual = _useSealedState$unsta === void 0 ? false : _useSealedState$unsta,
_useSealedState$rtl = _useSealedState.rtl,
rtl = _useSealedState$rtl === void 0 ? false : _useSealedState$rtl,
orientation = _useSealedState.orientation,
currentId = _useSealedState.currentId,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop,
_useSealedState$wrap = _useSealedState.wrap,
wrap = _useSealedState$wrap === void 0 ? false : _useSealedState$wrap,
_useSealedState$shift = _useSealedState.shift,
shift = _useSealedState$shift === void 0 ? false : _useSealedState$shift,
unstable_includesBaseElement = _useSealedState.unstable_includesBaseElement,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["unstable_virtual", "rtl", "orientation", "currentId", "loop", "wrap", "shift", "unstable_includesBaseElement"]);
var idState = unstable_useIdState(sealed);
var _React$useReducer = useReducer(reducer, {
unstable_virtual: virtual,
rtl: rtl,
orientation: orientation,
items: [],
groups: [],
currentId: currentId,
loop: loop,
wrap: wrap,
shift: shift,
unstable_moves: 0,
pastIds: [],
unstable_includesBaseElement: unstable_includesBaseElement != null ? unstable_includesBaseElement : currentId === null,
initialVirtual: virtual,
initialRTL: rtl,
initialOrientation: orientation,
initialCurrentId: currentId,
initialLoop: loop,
initialWrap: wrap,
initialShift: shift
}),
_React$useReducer$ = _React$useReducer[0],
pastIds = _React$useReducer$.pastIds,
initialVirtual = _React$useReducer$.initialVirtual,
initialRTL = _React$useReducer$.initialRTL,
initialOrientation = _React$useReducer$.initialOrientation,
initialCurrentId = _React$useReducer$.initialCurrentId,
initialLoop = _React$useReducer$.initialLoop,
initialWrap = _React$useReducer$.initialWrap,
initialShift = _React$useReducer$.initialShift,
hasSetCurrentId = _React$useReducer$.hasSetCurrentId,
state = _objectWithoutPropertiesLoose(_React$useReducer$, ["pastIds", "initialVirtual", "initialRTL", "initialOrientation", "initialCurrentId", "initialLoop", "initialWrap", "initialShift", "hasSetCurrentId"]),
dispatch = _React$useReducer[1];
var _React$useState = useState(false),
hasActiveWidget = _React$useState[0],
setHasActiveWidget = _React$useState[1]; // register/unregister may be called when this component is unmounted. We
// store the unmounted state here so we don't update the state if it's true.
// This only happens in a very specific situation.
// See https://github.com/reakit/reakit/issues/650
var isUnmountedRef = useIsUnmountedRef();
var setItems = useCallback(function (items) {
return dispatch({
type: "setItems",
items: items
});
}, []);
useSortBasedOnDOMPosition(state.items, setItems);
return _objectSpread2(_objectSpread2(_objectSpread2({}, idState), state), {}, {
unstable_hasActiveWidget: hasActiveWidget,
unstable_setHasActiveWidget: setHasActiveWidget,
registerItem: useAction(function (item) {
if (isUnmountedRef.current) return;
dispatch({
type: "registerItem",
item: item
});
}),
unregisterItem: useAction(function (id) {
if (isUnmountedRef.current) return;
dispatch({
type: "unregisterItem",
id: id
});
}),
registerGroup: useAction(function (group) {
if (isUnmountedRef.current) return;
dispatch({
type: "registerGroup",
group: group
});
}),
unregisterGroup: useAction(function (id) {
if (isUnmountedRef.current) return;
dispatch({
type: "unregisterGroup",
id: id
});
}),
move: useAction(function (id) {
return dispatch({
type: "move",
id: id
});
}),
next: useAction(function (allTheWay) {
return dispatch({
type: "next",
allTheWay: allTheWay
});
}),
previous: useAction(function (allTheWay) {
return dispatch({
type: "previous",
allTheWay: allTheWay
});
}),
up: useAction(function (allTheWay) {
return dispatch({
type: "up",
allTheWay: allTheWay
});
}),
down: useAction(function (allTheWay) {
return dispatch({
type: "down",
allTheWay: allTheWay
});
}),
first: useAction(function () {
return dispatch({
type: "first"
});
}),
last: useAction(function () {
return dispatch({
type: "last"
});
}),
sort: useAction(function () {
return dispatch({
type: "sort"
});
}),
unstable_setVirtual: useAction(function (value) {
return dispatch({
type: "setVirtual",
virtual: value
});
}),
setRTL: useAction(function (value) {
return dispatch({
type: "setRTL",
rtl: value
});
}),
setOrientation: useAction(function (value) {
return dispatch({
type: "setOrientation",
orientation: value
});
}),
setCurrentId: useAction(function (value) {
return dispatch({
type: "setCurrentId",
currentId: value
});
}),
setLoop: useAction(function (value) {
return dispatch({
type: "setLoop",
loop: value
});
}),
setWrap: useAction(function (value) {
return dispatch({
type: "setWrap",
wrap: value
});
}),
setShift: useAction(function (value) {
return dispatch({
type: "setShift",
shift: value
});
}),
unstable_setIncludesBaseElement: useAction(function (value) {
return dispatch({
type: "setIncludesBaseElement",
includesBaseElement: value
});
}),
reset: useAction(function () {
return dispatch({
type: "reset"
});
})
});
}
export { useCompositeState };

44
node_modules/reakit/es/Composite/index.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
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 'reakit-utils/useSealedState';
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';
export { Composite, Composite as unstable_Composite, useComposite } from './Composite.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';
export { CompositeItem, CompositeItem as unstable_CompositeItem, useCompositeItem } from './CompositeItem.js';
import '../Group/Group.js';
export { CompositeGroup, CompositeGroup as unstable_CompositeGroup, useCompositeGroup } from './CompositeGroup.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
export { useCompositeState as unstable_useCompositeState, useCompositeState } from './CompositeState.js';
export { unstable_CompositeItemWidget, unstable_useCompositeItemWidget } from './CompositeItemWidget.js';

697
node_modules/reakit/es/Dialog/Dialog.js generated vendored Normal file
View File

@@ -0,0 +1,697 @@
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, useEffect, useContext, useState, useCallback, useMemo, createElement, createContext, useReducer } from 'react';
import { useForkRef } from 'reakit-utils/useForkRef';
import { isButton } from 'reakit-utils/isButton';
import { warning, useWarning } from 'reakit-warning';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';
import { hasFocusWithin } from 'reakit-utils/hasFocusWithin';
import { getFirstTabbableIn, getLastTabbableIn, isTabbable } from 'reakit-utils/tabbable';
import '../Role/Role.js';
import { useUpdateEffect } from 'reakit-utils/useUpdateEffect';
import { useCreateElement } from 'reakit-system/useCreateElement';
import { getDocument } from 'reakit-utils/getDocument';
import 'reakit-utils/canUseDOM';
import { getNextActiveElementOnBlur } from 'reakit-utils/getNextActiveElementOnBlur';
import { ensureFocus } from 'reakit-utils/ensureFocus';
import '../__keys-e6a5cfbe.js';
import { useDisclosureContent } from '../Disclosure/DisclosureContent.js';
import 'react-dom';
import { Portal } from '../Portal/Portal.js';
import { removeItemFromArray } from 'reakit-utils/removeItemFromArray';
import { M as MenuContext } from '../MenuContext-6af6cf92.js';
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
import { closest } from 'reakit-utils/closest';
import { getActiveElement } from 'reakit-utils/getActiveElement';
import { contains } from 'reakit-utils/contains';
import { D as DialogBackdropContext } from '../DialogBackdropContext-8775f78b.js';
import { isEmpty } from 'reakit-utils/isEmpty';
import { D as DIALOG_KEYS } from '../__keys-ed7b48af.js';
function useDisclosureRef(dialogRef, options) {
var ref = useRef(null);
var animating = !!(options.animated && options.animating);
useEffect(function () {
if (options.visible || animating) return undefined; // We get the last focused element before the dialog opens, so we can move
// focus back to it when the dialog closes.
var onFocus = function onFocus(event) {
var target = event.target;
if ("focus" in target) {
ref.current = target;
if (options.unstable_disclosureRef) {
options.unstable_disclosureRef.current = target;
}
}
};
var document = getDocument(dialogRef.current);
document.addEventListener("focusin", onFocus);
return function () {
return document.removeEventListener("focusin", onFocus);
};
}, [options.visible, animating, options.unstable_disclosureRef, dialogRef]);
useEffect(function () {
var _options$unstable_dis;
if (!options.visible || animating) return undefined; // Safari and Firefox on MacOS don't focus on buttons on mouse down.
// Instead, they focus on the closest focusable parent (ultimately, the
// body element). This works around that by preventing that behavior and
// forcing focus on the disclosure button. Otherwise, we wouldn't be able
// to close the dialog by clicking again on the disclosure.
var onMouseDown = function onMouseDown(event) {
var element = event.currentTarget;
if (!isButton(element)) return;
event.preventDefault();
element.focus();
};
var disclosure = ((_options$unstable_dis = options.unstable_disclosureRef) === null || _options$unstable_dis === void 0 ? void 0 : _options$unstable_dis.current) || ref.current;
disclosure === null || disclosure === void 0 ? void 0 : disclosure.addEventListener("mousedown", onMouseDown);
return function () {
return disclosure === null || disclosure === void 0 ? void 0 : disclosure.removeEventListener("mousedown", onMouseDown);
};
}, [options.visible, animating, options.unstable_disclosureRef]);
return options.unstable_disclosureRef || ref;
}
function usePreventBodyScroll(targetRef, options) {
var shouldPrevent = Boolean(options.preventBodyScroll && options.visible);
useEffect(function () {
var element = targetRef.current;
if (!element || !shouldPrevent) return undefined;
disableBodyScroll(element, {
reserveScrollBarGap: true
});
return function () {
return enableBodyScroll(element);
};
}, [targetRef, shouldPrevent]);
}
function useFocusOnShow(dialogRef, nestedDialogs, options) {
var initialFocusRef = options.unstable_initialFocusRef;
var shouldFocus = options.visible && options.unstable_autoFocusOnShow;
var animating = !!(options.animated && options.animating);
useUpdateEffect(function () {
var dialog = dialogRef.current;
process.env.NODE_ENV !== "production" ? warning(!!shouldFocus && !dialog, "[reakit/Dialog]", "Can't set initial focus on dialog because `ref` wasn't passed to the dialog element.", "See https://reakit.io/docs/dialog") : void 0;
if (!shouldFocus) return;
if (!dialog) return;
if (animating) return; // If there're nested open dialogs, let them handle focus
if (nestedDialogs.some(function (child) {
return child.current && !child.current.hidden;
})) {
return;
}
if (initialFocusRef !== null && initialFocusRef !== void 0 && initialFocusRef.current) {
initialFocusRef.current.focus({
preventScroll: true
});
} else {
var tabbable = getFirstTabbableIn(dialog, true);
var isActive = function isActive() {
return hasFocusWithin(dialog);
};
if (tabbable) {
ensureFocus(tabbable, {
preventScroll: true,
isActive: isActive
});
} else {
ensureFocus(dialog, {
preventScroll: true,
isActive: isActive
});
process.env.NODE_ENV !== "production" ? warning(dialog.tabIndex === undefined || dialog.tabIndex < 0, "It's recommended to have at least one tabbable element inside dialog. The dialog element has been automatically focused.", "If this is the intended behavior, pass `tabIndex={0}` to the dialog element to disable this warning.", "See https://reakit.io/docs/dialog/#initial-focus", dialog) : void 0;
}
}
}, [dialogRef, shouldFocus, animating, nestedDialogs, initialFocusRef]);
}
function usePortalRef(dialogRef, options) {
var portalRef = useRef(null);
useEffect(function () {
var dialog = dialogRef.current;
if (!dialog || !options.visible) return;
portalRef.current = closest(dialog, Portal.__selector);
}, [dialogRef, options.visible]);
return portalRef;
}
function removeFromDOM(element) {
if (element.parentNode == null) return;
element.parentNode.removeChild(element);
}
var focusTrapClassName = "__reakit-focus-trap";
function isFocusTrap(element) {
var _element$classList;
return (_element$classList = element.classList) === null || _element$classList === void 0 ? void 0 : _element$classList.contains(focusTrapClassName);
}
function useFocusTrap(dialogRef, visibleModals, options) {
var portalRef = usePortalRef(dialogRef, options);
var shouldTrap = options.visible && options.modal;
var beforeElement = useRef(null);
var afterElement = useRef(null); // Create before and after elements
// https://github.com/w3c/aria-practices/issues/545
useEffect(function () {
if (!shouldTrap) return undefined;
var portal = portalRef.current;
if (!portal) {
process.env.NODE_ENV !== "production" ? warning(true, "Can't trap focus within modal dialog because either `ref` wasn't passed to component or the component wasn't rendered within a portal", "See https://reakit.io/docs/dialog") : void 0;
return undefined;
}
if (!beforeElement.current) {
var document = getDocument(portal);
beforeElement.current = document.createElement("div");
beforeElement.current.className = focusTrapClassName;
beforeElement.current.tabIndex = 0;
beforeElement.current.style.position = "fixed";
beforeElement.current.setAttribute("aria-hidden", "true");
}
if (!afterElement.current) {
afterElement.current = beforeElement.current.cloneNode();
}
portal.insertAdjacentElement("beforebegin", beforeElement.current);
portal.insertAdjacentElement("afterend", afterElement.current);
return function () {
if (beforeElement.current) removeFromDOM(beforeElement.current);
if (afterElement.current) removeFromDOM(afterElement.current);
};
}, [portalRef, shouldTrap]); // Focus trap
useEffect(function () {
var before = beforeElement.current;
var after = afterElement.current;
if (!shouldTrap || !before || !after) return undefined;
var handleFocus = function handleFocus(event) {
var dialog = dialogRef.current;
if (!dialog || visibleModals.length) return;
event.preventDefault();
var isAfter = event.target === after;
var tabbable = isAfter ? getFirstTabbableIn(dialog) : getLastTabbableIn(dialog);
if (tabbable) {
tabbable.focus();
} else {
// fallback to dialog
dialog.focus();
}
};
before.addEventListener("focus", handleFocus);
after.addEventListener("focus", handleFocus);
return function () {
before.removeEventListener("focus", handleFocus);
after.removeEventListener("focus", handleFocus);
};
}, [dialogRef, visibleModals, shouldTrap]);
}
function hidByFocusingAnotherElement(dialogRef) {
var dialog = dialogRef.current;
if (!dialog) return false;
var activeElement = getActiveElement(dialog);
if (!activeElement) return false;
if (contains(dialog, activeElement)) return false;
if (isTabbable(activeElement)) return true;
if (activeElement.getAttribute("data-dialog") === "true") return true;
return false;
}
function useFocusOnHide(dialogRef, disclosureRef, options) {
var shouldFocus = options.unstable_autoFocusOnHide && !options.visible;
var animating = !!(options.animated && options.animating);
useUpdateEffect(function () {
var _options$unstable_fin;
if (!shouldFocus) return;
if (animating) return; // Hide was triggered by a click/focus on a tabbable element outside
// the dialog or on another dialog. We won't change focus then.
if (hidByFocusingAnotherElement(dialogRef)) {
return;
}
var finalFocusEl = ((_options$unstable_fin = options.unstable_finalFocusRef) === null || _options$unstable_fin === void 0 ? void 0 : _options$unstable_fin.current) || disclosureRef.current;
if (finalFocusEl) {
if (finalFocusEl.id) {
var document = getDocument(finalFocusEl);
var compositeElement = document.querySelector("[aria-activedescendant='" + finalFocusEl.id + "']");
if (compositeElement) {
ensureFocus(compositeElement);
return;
}
}
ensureFocus(finalFocusEl);
return;
}
process.env.NODE_ENV !== "production" ? warning(true, "Can't return focus after closing dialog. Either render a disclosure component or provide a `unstable_finalFocusRef` prop.", "See https://reakit.io/docs/dialog", dialogRef.current) : void 0;
}, [shouldFocus, animating, dialogRef, disclosureRef]);
}
var DialogContext = /*#__PURE__*/createContext({});
function useNestedDialogs(dialogRef, options) {
var context = useContext(DialogContext);
var _React$useState = useState([]),
dialogs = _React$useState[0],
setDialogs = _React$useState[1];
var _React$useState2 = useState(dialogs),
visibleModals = _React$useState2[0],
setVisibleModals = _React$useState2[1];
var addDialog = useCallback(function (ref) {
var _context$addDialog;
(_context$addDialog = context.addDialog) === null || _context$addDialog === void 0 ? void 0 : _context$addDialog.call(context, ref);
setDialogs(function (prevDialogs) {
return [].concat(prevDialogs, [ref]);
});
}, [context.addDialog]);
var removeDialog = useCallback(function (ref) {
var _context$removeDialog;
(_context$removeDialog = context.removeDialog) === null || _context$removeDialog === void 0 ? void 0 : _context$removeDialog.call(context, ref);
setDialogs(function (prevDialogs) {
return removeItemFromArray(prevDialogs, ref);
});
}, [context.removeDialog]);
var showDialog = useCallback(function (ref) {
var _context$showDialog;
(_context$showDialog = context.showDialog) === null || _context$showDialog === void 0 ? void 0 : _context$showDialog.call(context, ref);
setVisibleModals(function (prevDialogs) {
return [].concat(prevDialogs, [ref]);
});
}, [context.showDialog]);
var hideDialog = useCallback(function (ref) {
var _context$hideDialog;
(_context$hideDialog = context.hideDialog) === null || _context$hideDialog === void 0 ? void 0 : _context$hideDialog.call(context, ref);
setVisibleModals(function (prevDialogs) {
return removeItemFromArray(prevDialogs, ref);
});
}, [context.hideDialog]); // If it's a nested dialog, add it to context
useEffect(function () {
var _context$addDialog2;
if (options.unstable_orphan) return undefined;
(_context$addDialog2 = context.addDialog) === null || _context$addDialog2 === void 0 ? void 0 : _context$addDialog2.call(context, dialogRef);
return function () {
var _context$removeDialog2;
(_context$removeDialog2 = context.removeDialog) === null || _context$removeDialog2 === void 0 ? void 0 : _context$removeDialog2.call(context, dialogRef);
};
}, [options.unstable_orphan, context.addDialog, dialogRef, context.removeDialog]);
useEffect(function () {
var _context$showDialog2;
if (options.unstable_orphan) return undefined;
if (!options.modal) return undefined;
if (!options.visible) return undefined;
(_context$showDialog2 = context.showDialog) === null || _context$showDialog2 === void 0 ? void 0 : _context$showDialog2.call(context, dialogRef);
return function () {
var _context$hideDialog2;
(_context$hideDialog2 = context.hideDialog) === null || _context$hideDialog2 === void 0 ? void 0 : _context$hideDialog2.call(context, dialogRef);
};
}, [options.unstable_orphan, options.modal, options.visible, context.showDialog, dialogRef, context.hideDialog]); // Close all nested dialogs when parent dialog closes
useEffect(function () {
if (context.visible === false && options.visible && !options.unstable_orphan) {
var _options$hide;
(_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
}
}, [context.visible, options.visible, options.hide, options.unstable_orphan]); // Provider
var providerValue = useMemo(function () {
return {
visible: options.visible,
addDialog: addDialog,
removeDialog: removeDialog,
showDialog: showDialog,
hideDialog: hideDialog
};
}, [options.visible, addDialog, removeDialog, showDialog, hideDialog]);
var wrap = useCallback(function (element) {
return /*#__PURE__*/createElement(DialogContext.Provider, {
value: providerValue
}, element);
}, [providerValue]);
return {
dialogs: dialogs,
visibleModals: visibleModals,
wrap: wrap
};
}
function dialogContains(target) {
return function (dialogRef) {
var dialog = dialogRef.current;
if (!dialog) return false;
if (contains(dialog, target)) return true;
var document = getDocument(dialog);
var backdrop = document.querySelector("[data-dialog-ref=\"" + dialog.id + "\"]");
if (backdrop) {
return contains(backdrop, target);
}
return false;
};
}
function isDisclosure(target, disclosure) {
return contains(disclosure, target);
}
function isInDocument(target) {
var document = getDocument(target);
if (target.tagName === "HTML") {
return true;
}
return contains(document.body, target);
}
function useEventListenerOutside(containerRef, disclosureRef, nestedDialogs, eventType, listener, shouldListen, capture) {
var listenerRef = useLiveRef(listener);
useEffect(function () {
if (!shouldListen) return undefined;
var onEvent = function onEvent(event) {
if (!listenerRef.current) return;
var container = containerRef.current;
var disclosure = disclosureRef.current;
var target = event.target;
if (!container) {
process.env.NODE_ENV !== "production" ? warning(true, "Can't detect events outside dialog because `ref` wasn't passed to component.", "See https://reakit.io/docs/dialog") : void 0;
return;
} // When an element is unmounted right after it receives focus, the focus
// event is triggered after that, when the element isn't part of the
// current document anymore. So we ignore it.
if (!isInDocument(target)) return; // Event inside dialog
if (contains(container, target)) return; // Event on disclosure
if (disclosure && isDisclosure(target, disclosure)) return; // Event inside a nested dialog or focus trap
if (isFocusTrap(target) || nestedDialogs.some(dialogContains(target))) {
return;
}
listenerRef.current(event);
};
var document = getDocument(containerRef.current);
document.addEventListener(eventType, onEvent, capture);
return function () {
return document.removeEventListener(eventType, onEvent, capture);
};
}, [containerRef, disclosureRef, nestedDialogs, eventType, shouldListen, listenerRef]);
}
function useMouseDownRef(dialogRef, options) {
var mouseDownRef = useRef();
useEffect(function () {
if (!options.visible) return undefined;
if (!options.hideOnClickOutside) return undefined;
var document = getDocument(dialogRef.current);
var onMouseDown = function onMouseDown(event) {
mouseDownRef.current = event.target;
};
document.addEventListener("mousedown", onMouseDown);
return function () {
return document.removeEventListener("mousedown", onMouseDown);
};
}, [options.visible, options.hideOnClickOutside, dialogRef]);
return mouseDownRef;
}
function useHideOnClickOutside(dialogRef, disclosureRef, nestedDialogs, options) {
var mouseDownRef = useMouseDownRef(dialogRef, options);
useEventListenerOutside(dialogRef, disclosureRef, nestedDialogs, "click", function (event) {
// Make sure the element that has been clicked is the same that last
// triggered the mousedown event. This prevents the dialog from closing
// by dragging the cursor (for example, selecting some text inside the
// dialog and releasing the mouse outside of it).
if (mouseDownRef.current === event.target) {
var _options$hide;
(_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
}
}, options.visible && options.hideOnClickOutside);
useEventListenerOutside(dialogRef, disclosureRef, nestedDialogs, "focusin", function (event) {
var document = getDocument(dialogRef.current); // Fix for https://github.com/reakit/reakit/issues/619
// On IE11, calling element.blur() triggers the focus event on
// document.body, so we make sure to ignore it as well.
if (event.target !== document && event.target !== document.body) {
var _options$hide2;
(_options$hide2 = options.hide) === null || _options$hide2 === void 0 ? void 0 : _options$hide2.call(options);
}
}, options.visible && options.hideOnClickOutside);
}
function useDisableHoverOutside(portalRef, nestedDialogs, options) {
var useEvent = function useEvent(eventType) {
return useEventListenerOutside(portalRef, {
current: null
}, nestedDialogs, eventType, function (event) {
event.stopPropagation();
event.preventDefault();
}, options.visible && options.modal, true);
};
useEvent("mouseover");
useEvent("mousemove");
useEvent("mouseout");
}
/**
* When the focused child gets removed from the DOM, we make sure to move focus
* to the dialog.
*/
function useFocusOnChildUnmount(dialogRef, options) {
useEffect(function () {
var dialog = dialogRef.current;
if (!options.visible || !dialog) return undefined;
var observer = new MutationObserver(function (mutations) {
var target = mutations[0].target; // If target is not this dialog, then this observer was triggered by a
// nested dialog, so we just ignore it here and let the nested dialog
// handle it there.
if (target !== dialog) return;
var document = getDocument(dialog);
var activeElement = getActiveElement(dialog); // We can check if the current focused element is the document body. On
// IE 11, it's an empty object when the current document is in a frame or
// iframe.
if (activeElement === document.body || isEmpty(activeElement)) {
dialog.focus();
}
});
observer.observe(dialog, {
childList: true,
subtree: true
});
return function () {
observer.disconnect();
};
}, [options.visible, dialogRef]);
}
function isActualElement(element) {
return element && element.tagName && element.tagName !== "HTML" && element !== getDocument(element).body;
}
function useFocusOnBlur(dialogRef, options) {
var _React$useReducer = useReducer(function (n) {
return n + 1;
}, 0),
blurred = _React$useReducer[0],
scheduleFocus = _React$useReducer[1];
useIsomorphicEffect(function () {
var dialog = dialogRef.current;
if (!options.visible) return;
if (!blurred) return; // After blur, if the active element isn't an actual element, this probably
// means that element.blur() was called on an element inside the dialog.
// In this case, the browser will automatically focus the body element.
// So we move focus back to the dialog.
if (!isActualElement(getActiveElement(dialog))) {
process.env.NODE_ENV !== "production" ? warning(!dialog, "Can't focus dialog after a nested element got blurred because `ref` wasn't passed to the component", "See https://reakit.io/docs/dialog") : void 0;
dialog === null || dialog === void 0 ? void 0 : dialog.focus();
}
}, [blurred, dialogRef]);
var onBlur = useCallback(function (event) {
if (!options.visible) return;
var nextActiveElement = getNextActiveElementOnBlur(event);
if (!isActualElement(nextActiveElement)) {
scheduleFocus();
}
}, [options.visible]);
return onBlur;
}
var useDialog = createHook({
name: "Dialog",
compose: useDisclosureContent,
keys: DIALOG_KEYS,
useOptions: function useOptions(_ref) {
var _ref$modal = _ref.modal,
modal = _ref$modal === void 0 ? true : _ref$modal,
_ref$hideOnEsc = _ref.hideOnEsc,
hideOnEsc = _ref$hideOnEsc === void 0 ? true : _ref$hideOnEsc,
_ref$hideOnClickOutsi = _ref.hideOnClickOutside,
hideOnClickOutside = _ref$hideOnClickOutsi === void 0 ? true : _ref$hideOnClickOutsi,
_ref$preventBodyScrol = _ref.preventBodyScroll,
preventBodyScroll = _ref$preventBodyScrol === void 0 ? modal : _ref$preventBodyScrol,
_ref$unstable_autoFoc = _ref.unstable_autoFocusOnShow,
unstable_autoFocusOnShow = _ref$unstable_autoFoc === void 0 ? true : _ref$unstable_autoFoc,
_ref$unstable_autoFoc2 = _ref.unstable_autoFocusOnHide,
unstable_autoFocusOnHide = _ref$unstable_autoFoc2 === void 0 ? true : _ref$unstable_autoFoc2,
unstable_orphan = _ref.unstable_orphan,
options = _objectWithoutPropertiesLoose(_ref, ["modal", "hideOnEsc", "hideOnClickOutside", "preventBodyScroll", "unstable_autoFocusOnShow", "unstable_autoFocusOnHide", "unstable_orphan"]);
return _objectSpread2({
modal: modal,
hideOnEsc: hideOnEsc,
hideOnClickOutside: hideOnClickOutside,
preventBodyScroll: modal && preventBodyScroll,
unstable_autoFocusOnShow: unstable_autoFocusOnShow,
unstable_autoFocusOnHide: unstable_autoFocusOnHide,
unstable_orphan: modal && unstable_orphan
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlRef = _ref2.ref,
htmlOnKeyDown = _ref2.onKeyDown,
htmlOnBlur = _ref2.onBlur,
htmlWrapElement = _ref2.wrapElement,
tabIndex = _ref2.tabIndex,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["ref", "onKeyDown", "onBlur", "wrapElement", "tabIndex"]);
var dialog = useRef(null);
var backdrop = useContext(DialogBackdropContext);
var hasBackdrop = backdrop && backdrop === options.baseId;
var disclosure = useDisclosureRef(dialog, options);
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var onBlurRef = useLiveRef(htmlOnBlur);
var focusOnBlur = useFocusOnBlur(dialog, options);
var _useNestedDialogs = useNestedDialogs(dialog, options),
dialogs = _useNestedDialogs.dialogs,
visibleModals = _useNestedDialogs.visibleModals,
wrap = _useNestedDialogs.wrap; // VoiceOver/Safari accepts only one `aria-modal` container, so if there
// are visible child modals, then we don't want to set aria-modal on the
// parent modal (this component).
var modal = options.modal && !visibleModals.length ? true : undefined;
usePreventBodyScroll(dialog, options);
useFocusTrap(dialog, visibleModals, options);
useFocusOnChildUnmount(dialog, options);
useFocusOnShow(dialog, dialogs, options);
useFocusOnHide(dialog, disclosure, options);
useHideOnClickOutside(dialog, disclosure, dialogs, options);
useDisableHoverOutside(dialog, dialogs, options);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (event.key !== "Escape") return;
if (!options.hideOnEsc) return;
if (!options.hide) {
process.env.NODE_ENV !== "production" ? warning(true, "`hideOnEsc` prop is truthy, but `hide` prop wasn't provided.", "See https://reakit.io/docs/dialog", dialog.current) : void 0;
return;
}
event.stopPropagation();
options.hide();
}, [options.hideOnEsc, options.hide]);
var onBlur = useCallback(function (event) {
var _onBlurRef$current;
(_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
focusOnBlur(event);
}, [focusOnBlur]);
var wrapElement = useCallback(function (element) {
element = wrap(element);
if (options.modal && !hasBackdrop) {
element = /*#__PURE__*/createElement(Portal, null, element);
}
if (htmlWrapElement) {
element = htmlWrapElement(element);
}
return (
/*#__PURE__*/
// Prevents Menu > Dialog > Menu to behave as a sub menu
createElement(MenuContext.Provider, {
value: null
}, element)
);
}, [wrap, options.modal, hasBackdrop, htmlWrapElement]);
return _objectSpread2({
ref: useForkRef(dialog, htmlRef),
role: "dialog",
tabIndex: tabIndex != null ? tabIndex : -1,
"aria-modal": modal,
"data-dialog": true,
onKeyDown: onKeyDown,
onBlur: onBlur,
wrapElement: wrapElement
}, htmlProps);
}
});
var Dialog = createComponent({
as: "div",
useHook: useDialog,
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/dialog") : void 0;
return useCreateElement(type, props, children);
}
});
export { Dialog, useDialog };

61
node_modules/reakit/es/Dialog/DialogBackdrop.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
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, createElement } from 'react';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import '../Role/Role.js';
import 'reakit-utils/canUseDOM';
import '../__keys-e6a5cfbe.js';
import { useDisclosureContent } from '../Disclosure/DisclosureContent.js';
import 'react-dom';
import { Portal } from '../Portal/Portal.js';
import { D as DialogBackdropContext } from '../DialogBackdropContext-8775f78b.js';
import { a as DIALOG_BACKDROP_KEYS } from '../__keys-ed7b48af.js';
var useDialogBackdrop = createHook({
name: "DialogBackdrop",
compose: useDisclosureContent,
keys: DIALOG_BACKDROP_KEYS,
useOptions: function useOptions(_ref) {
var _ref$modal = _ref.modal,
modal = _ref$modal === void 0 ? true : _ref$modal,
options = _objectWithoutPropertiesLoose(_ref, ["modal"]);
return _objectSpread2({
modal: modal
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlWrapElement = _ref2.wrapElement,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["wrapElement"]);
var wrapElement = useCallback(function (element) {
if (options.modal) {
element = /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(DialogBackdropContext.Provider, {
value: options.baseId
}, element));
}
if (htmlWrapElement) {
return htmlWrapElement(element);
}
return element;
}, [options.modal, htmlWrapElement]);
return _objectSpread2({
id: undefined,
"data-dialog-ref": options.baseId,
wrapElement: wrapElement
}, htmlProps);
}
});
var DialogBackdrop = createComponent({
as: "div",
memo: true,
useHook: useDialogBackdrop
});
export { DialogBackdrop, useDialogBackdrop };

77
node_modules/reakit/es/Dialog/DialogDisclosure.js generated vendored Normal file
View File

@@ -0,0 +1,77 @@
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, useState, 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 { useIsomorphicEffect } from '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 '../__keys-e6a5cfbe.js';
import { b as DIALOG_DISCLOSURE_KEYS } from '../__keys-ed7b48af.js';
import { useDisclosure } from '../Disclosure/Disclosure.js';
var useDialogDisclosure = createHook({
name: "DialogDisclosure",
compose: useDisclosure,
keys: DIALOG_DISCLOSURE_KEYS,
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlOnClick = _ref.onClick,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "onClick"]);
var ref = useRef(null);
var onClickRef = useLiveRef(htmlOnClick);
var _React$useState = useState(false),
expanded = _React$useState[0],
setExpanded = _React$useState[1];
var disclosureRef = options.unstable_disclosureRef; // aria-expanded may be used for styling purposes, so we useLayoutEffect
useIsomorphicEffect(function () {
var element = ref.current;
process.env.NODE_ENV !== "production" ? warning(!element, "Can't determine whether the element is the current disclosure because `ref` wasn't passed to the component", "See https://reakit.io/docs/dialog") : void 0;
if (disclosureRef && !disclosureRef.current) {
disclosureRef.current = element;
}
var isCurrentDisclosure = !(disclosureRef !== null && disclosureRef !== void 0 && disclosureRef.current) || disclosureRef.current === element;
setExpanded(!!options.visible && isCurrentDisclosure);
}, [options.visible, disclosureRef]);
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;
if (disclosureRef) {
disclosureRef.current = event.currentTarget;
}
}, [disclosureRef]);
return _objectSpread2({
ref: useForkRef(ref, htmlRef),
"aria-haspopup": "dialog",
"aria-expanded": expanded,
onClick: onClick
}, htmlProps);
}
});
var DialogDisclosure = createComponent({
as: "button",
memo: true,
useHook: useDialogDisclosure
});
export { DialogDisclosure, useDialogDisclosure };

34
node_modules/reakit/es/Dialog/DialogState.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useState, useRef } from 'react';
import 'reakit-warning';
import 'reakit-utils/useIsomorphicEffect';
import { useSealedState } from 'reakit-utils/useSealedState';
import '../Id/IdProvider.js';
import '../Id/IdState.js';
import { useDisclosureState } from '../Disclosure/DisclosureState.js';
function useDialogState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$modal = _useSealedState.modal,
initialModal = _useSealedState$modal === void 0 ? true : _useSealedState$modal,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["modal"]);
var disclosure = useDisclosureState(sealed);
var _React$useState = useState(initialModal),
modal = _React$useState[0],
setModal = _React$useState[1];
var disclosureRef = useRef(null);
return _objectSpread2(_objectSpread2({}, disclosure), {}, {
modal: modal,
setModal: setModal,
unstable_disclosureRef: disclosureRef
});
}
export { useDialogState };

47
node_modules/reakit/es/Dialog/index.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
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/useSealedState';
import 'reakit-utils/useUpdateEffect';
import 'reakit-system/useCreateElement';
import 'reakit-utils/getDocument';
import 'reakit-utils/canUseDOM';
import 'reakit-utils/getNextActiveElementOnBlur';
import 'reakit-utils/ensureFocus';
import '../Id/IdProvider.js';
import '../Id/IdState.js';
import '../Disclosure/DisclosureState.js';
export { useDialogState } from './DialogState.js';
import '../__keys-e6a5cfbe.js';
import '../Disclosure/DisclosureContent.js';
import 'react-dom';
import '../Portal/Portal.js';
import 'reakit-utils/removeItemFromArray';
import '../MenuContext-6af6cf92.js';
export { Dialog, useDialog } from './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';
export { DialogBackdrop, useDialogBackdrop } from './DialogBackdrop.js';
import '../Disclosure/Disclosure.js';
export { DialogDisclosure, useDialogDisclosure } from './DialogDisclosure.js';

View File

@@ -0,0 +1,5 @@
import { createContext } from 'react';
var DialogBackdropContext = /*#__PURE__*/createContext(undefined);
export { DialogBackdropContext as D };

53
node_modules/reakit/es/Disclosure/Disclosure.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
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 '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 { D as DISCLOSURE_KEYS } from '../__keys-e6a5cfbe.js';
var useDisclosure = createHook({
name: "Disclosure",
compose: useButton,
keys: DISCLOSURE_KEYS,
useProps: function useProps(options, _ref) {
var htmlOnClick = _ref.onClick,
ariaControls = _ref["aria-controls"],
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onClick", "aria-controls"]);
var onClickRef = useLiveRef(htmlOnClick);
var controls = ariaControls ? ariaControls + " " + options.baseId : options.baseId;
var onClick = useCallback(function (event) {
var _onClickRef$current, _options$toggle;
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
if (event.defaultPrevented) return;
(_options$toggle = options.toggle) === null || _options$toggle === void 0 ? void 0 : _options$toggle.call(options);
}, [options.toggle]);
return _objectSpread2({
"aria-expanded": !!options.visible,
"aria-controls": controls,
onClick: onClick
}, htmlProps);
}
});
var Disclosure = createComponent({
as: "button",
memo: true,
useHook: useDisclosure
});
export { Disclosure, useDisclosure };

93
node_modules/reakit/es/Disclosure/DisclosureContent.js generated vendored Normal file
View File

@@ -0,0 +1,93 @@
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 { useState, useRef, useEffect, useCallback } from 'react';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import { isSelfTarget } from 'reakit-utils/isSelfTarget';
import { useRole } from '../Role/Role.js';
import { a as DISCLOSURE_CONTENT_KEYS } from '../__keys-e6a5cfbe.js';
var useDisclosureContent = createHook({
name: "DisclosureContent",
compose: useRole,
keys: DISCLOSURE_CONTENT_KEYS,
useProps: function useProps(options, _ref) {
var htmlOnTransitionEnd = _ref.onTransitionEnd,
htmlOnAnimationEnd = _ref.onAnimationEnd,
htmlStyle = _ref.style,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onTransitionEnd", "onAnimationEnd", "style"]);
var animating = options.animated && options.animating;
var _React$useState = useState(null),
transition = _React$useState[0],
setTransition = _React$useState[1];
var hidden = !options.visible && !animating;
var style = hidden ? _objectSpread2({
display: "none"
}, htmlStyle) : htmlStyle;
var onTransitionEndRef = useLiveRef(htmlOnTransitionEnd);
var onAnimationEndRef = useLiveRef(htmlOnAnimationEnd);
var raf = useRef(0);
useEffect(function () {
if (!options.animated) return undefined; // Double RAF is needed so the browser has enough time to paint the
// default styles before processing the `data-enter` attribute. Otherwise
// it wouldn't be considered a transition.
// See https://github.com/reakit/reakit/issues/643
raf.current = window.requestAnimationFrame(function () {
raf.current = window.requestAnimationFrame(function () {
if (options.visible) {
setTransition("enter");
} else if (animating) {
setTransition("leave");
} else {
setTransition(null);
}
});
});
return function () {
return window.cancelAnimationFrame(raf.current);
};
}, [options.animated, options.visible, animating]);
var onEnd = useCallback(function (event) {
if (!isSelfTarget(event)) return;
if (!animating) return; // Ignores number animated
if (options.animated === true) {
var _options$stopAnimatio;
(_options$stopAnimatio = options.stopAnimation) === null || _options$stopAnimatio === void 0 ? void 0 : _options$stopAnimatio.call(options);
}
}, [options.animated, animating, options.stopAnimation]);
var onTransitionEnd = useCallback(function (event) {
var _onTransitionEndRef$c;
(_onTransitionEndRef$c = onTransitionEndRef.current) === null || _onTransitionEndRef$c === void 0 ? void 0 : _onTransitionEndRef$c.call(onTransitionEndRef, event);
onEnd(event);
}, [onEnd]);
var onAnimationEnd = useCallback(function (event) {
var _onAnimationEndRef$cu;
(_onAnimationEndRef$cu = onAnimationEndRef.current) === null || _onAnimationEndRef$cu === void 0 ? void 0 : _onAnimationEndRef$cu.call(onAnimationEndRef, event);
onEnd(event);
}, [onEnd]);
return _objectSpread2({
id: options.baseId,
"data-enter": transition === "enter" ? "" : undefined,
"data-leave": transition === "leave" ? "" : undefined,
onTransitionEnd: onTransitionEnd,
onAnimationEnd: onAnimationEnd,
hidden: hidden,
style: style
}, htmlProps);
}
});
var DisclosureContent = createComponent({
as: "div",
useHook: useDisclosureContent
});
export { DisclosureContent, useDisclosureContent };

100
node_modules/reakit/es/Disclosure/DisclosureState.js generated vendored Normal file
View File

@@ -0,0 +1,100 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useState, useEffect, useCallback, useRef } from 'react';
import { warning } from 'reakit-warning';
import { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';
import { useSealedState } from 'reakit-utils/useSealedState';
import '../Id/IdProvider.js';
import { unstable_useIdState } from '../Id/IdState.js';
function useLastValue(value) {
var lastValue = useRef(null);
useIsomorphicEffect(function () {
lastValue.current = value;
}, [value]);
return lastValue;
}
function useDisclosureState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$visib = _useSealedState.visible,
initialVisible = _useSealedState$visib === void 0 ? false : _useSealedState$visib,
_useSealedState$anima = _useSealedState.animated,
initialAnimated = _useSealedState$anima === void 0 ? false : _useSealedState$anima,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["visible", "animated"]);
var id = unstable_useIdState(sealed);
var _React$useState = useState(initialVisible),
visible = _React$useState[0],
setVisible = _React$useState[1];
var _React$useState2 = useState(initialAnimated),
animated = _React$useState2[0],
setAnimated = _React$useState2[1];
var _React$useState3 = useState(false),
animating = _React$useState3[0],
setAnimating = _React$useState3[1];
var lastVisible = useLastValue(visible);
var visibleHasChanged = lastVisible.current != null && lastVisible.current !== visible;
if (animated && !animating && visibleHasChanged) {
// Sets animating to true when when visible is updated
setAnimating(true);
}
useEffect(function () {
if (typeof animated === "number" && animating) {
var timeout = setTimeout(function () {
return setAnimating(false);
}, animated);
return function () {
clearTimeout(timeout);
};
}
if (animated && animating && process.env.NODE_ENV === "development") {
var _timeout = setTimeout(function () {
process.env.NODE_ENV !== "production" ? warning(animating, "It's been 8 seconds but stopAnimation has not been called. Does the disclousure element have a CSS transition?") : void 0;
}, 8000);
return function () {
clearTimeout(_timeout);
};
}
return function () {};
}, [animated, animating]);
var show = useCallback(function () {
return setVisible(true);
}, []);
var hide = useCallback(function () {
return setVisible(false);
}, []);
var toggle = useCallback(function () {
return setVisible(function (v) {
return !v;
});
}, []);
var stopAnimation = useCallback(function () {
return setAnimating(false);
}, []);
return _objectSpread2(_objectSpread2({}, id), {}, {
visible: visible,
animated: animated,
animating: animating,
show: show,
hide: hide,
toggle: toggle,
setVisible: setVisible,
setAnimated: setAnimated,
stopAnimation: stopAnimation
});
}
export { useDisclosureState };

26
node_modules/reakit/es/Disclosure/index.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
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/useSealedState';
import '../Id/IdProvider.js';
import '../Id/IdState.js';
export { useDisclosureState } from './DisclosureState.js';
import '../__keys-e6a5cfbe.js';
export { DisclosureContent, useDisclosureContent } from './DisclosureContent.js';
export { Disclosure, useDisclosure } from './Disclosure.js';

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 };

51
node_modules/reakit/es/Grid/Grid.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
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 '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/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import { useCreateElement } from '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 { G as GRID_KEYS } from '../__keys-08a69d36.js';
var unstable_useGrid = createHook({
name: "Grid",
compose: useComposite,
keys: GRID_KEYS,
useProps: function useProps(_, htmlProps) {
return _objectSpread2({
role: "grid"
}, htmlProps);
}
});
var unstable_Grid = createComponent({
as: "div",
useHook: unstable_useGrid,
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/grid") : void 0;
return useCreateElement(type, props, children);
}
});
export { unstable_Grid, unstable_useGrid };

48
node_modules/reakit/es/Grid/GridCell.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
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 '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 '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 { a as GRID_CELL_KEYS } from '../__keys-08a69d36.js';
var unstable_useGridCell = createHook({
name: "GridCell",
compose: useCompositeItem,
keys: GRID_CELL_KEYS,
useProps: function useProps(_, htmlProps) {
return _objectSpread2({
role: "gridcell"
}, htmlProps);
}
});
var unstable_GridCell = createComponent({
as: "span",
memo: true,
useHook: unstable_useGridCell
});
export { unstable_GridCell, unstable_useGridCell };

32
node_modules/reakit/es/Grid/GridRow.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 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/useIsomorphicEffect';
import '../Role/Role.js';
import '../findEnabledItemById-8ddca752.js';
import '../__keys-6742f591.js';
import '../Id/IdProvider.js';
import '../Id/Id.js';
import { b as GRID_ROW_KEYS } from '../__keys-08a69d36.js';
import '../Group/Group.js';
import { useCompositeGroup } from '../Composite/CompositeGroup.js';
var unstable_useGridRow = createHook({
name: "GridRow",
compose: useCompositeGroup,
keys: GRID_ROW_KEYS,
useProps: function useProps(_, htmlProps) {
return _objectSpread2({
role: "row"
}, htmlProps);
}
});
var unstable_GridRow = createComponent({
as: "div",
useHook: unstable_useGridRow
});
export { unstable_GridRow, unstable_useGridRow };

23
node_modules/reakit/es/Grid/GridState.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import '../_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';
function unstable_useGridState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var sealed = useSealedState(initialState);
return useCompositeState(sealed);
}
export { unstable_useGridState };

48
node_modules/reakit/es/Grid/index.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
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 'reakit-utils/useSealedState';
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 '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';
export { unstable_GridCell, unstable_useGridCell } from './GridCell.js';
import '../Group/Group.js';
import '../Composite/CompositeGroup.js';
export { unstable_GridRow, unstable_useGridRow } from './GridRow.js';
import 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
export { unstable_useGridState } from './GridState.js';
export { unstable_Grid, unstable_useGrid } from './Grid.js';

25
node_modules/reakit/es/Group/Group.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
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';
// Automatically generated
var GROUP_KEYS = [];
var useGroup = createHook({
name: "Group",
compose: useRole,
keys: GROUP_KEYS,
useProps: function useProps(_, htmlProps) {
return _objectSpread2({
role: "group"
}, htmlProps);
}
});
var Group = createComponent({
as: "div",
useHook: useGroup
});
export { Group, useGroup };

6
node_modules/reakit/es/Group/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-system/createComponent';
import 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import '../Role/Role.js';
export { Group, useGroup } from './Group.js';

56
node_modules/reakit/es/Id/Id.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
import { a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import { useContext, useState, useMemo } from 'react';
import { unstable_IdContext } from './IdProvider.js';
// Automatically generated
var ID_STATE_KEYS = ["baseId", "unstable_idCountRef", "setBaseId"];
var ID_KEYS = [].concat(ID_STATE_KEYS, ["id"]);
var unstable_useId = createHook({
keys: ID_KEYS,
useOptions: function useOptions(options, htmlProps) {
var generateId = useContext(unstable_IdContext);
var _React$useState = useState(function () {
// This comes from useIdState
if (options.unstable_idCountRef) {
options.unstable_idCountRef.current += 1;
return "-" + options.unstable_idCountRef.current;
} // If there's no useIdState, we check if `baseId` was passed (as a prop,
// not from useIdState).
if (options.baseId) {
return "-" + generateId("");
}
return "";
}),
suffix = _React$useState[0]; // `baseId` will be the prop passed directly as a prop or via useIdState.
// If there's neither, then it'll fallback to Context's generateId.
// This generateId can result in a sequential ID (if there's a Provider)
// or a random string (without Provider).
var baseId = useMemo(function () {
return options.baseId || generateId();
}, [options.baseId, generateId]);
var id = htmlProps.id || options.id || "" + baseId + suffix;
return _objectSpread2(_objectSpread2({}, options), {}, {
id: id
});
},
useProps: function useProps(options, htmlProps) {
return _objectSpread2({
id: options.id
}, htmlProps);
}
});
var unstable_Id = createComponent({
as: "div",
useHook: unstable_useId
});
export { unstable_Id, unstable_useId };

30
node_modules/reakit/es/Id/IdProvider.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import { createContext, useRef, useCallback, createElement } from 'react';
var defaultPrefix = "id";
function generateRandomString(prefix) {
if (prefix === void 0) {
prefix = defaultPrefix;
}
return "" + (prefix ? prefix + "-" : "") + Math.random().toString(32).substr(2, 6);
}
var unstable_IdContext = /*#__PURE__*/createContext(generateRandomString);
function unstable_IdProvider(_ref) {
var children = _ref.children,
_ref$prefix = _ref.prefix,
prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix;
var count = useRef(0);
var generateId = useCallback(function (localPrefix) {
if (localPrefix === void 0) {
localPrefix = prefix;
}
return "" + (localPrefix ? localPrefix + "-" : "") + ++count.current;
}, [prefix]);
return /*#__PURE__*/createElement(unstable_IdContext.Provider, {
value: generateId
}, children);
}
export { unstable_IdContext, unstable_IdProvider };

29
node_modules/reakit/es/Id/IdState.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import { useContext, useRef, useState } from 'react';
import { useSealedState } from 'reakit-utils/useSealedState';
import { unstable_IdContext } from './IdProvider.js';
function unstable_useIdState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
initialBaseId = _useSealedState.baseId;
var generateId = useContext(unstable_IdContext);
var idCountRef = useRef(0);
var _React$useState = useState(function () {
return initialBaseId || generateId();
}),
baseId = _React$useState[0],
setBaseId = _React$useState[1];
return {
baseId: baseId,
setBaseId: setBaseId,
unstable_idCountRef: idCountRef
};
}
export { unstable_useIdState };

8
node_modules/reakit/es/Id/index.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-system/createComponent';
import 'reakit-system/createHook';
import 'react';
import 'reakit-utils/useSealedState';
export { unstable_IdContext, unstable_IdProvider } from './IdProvider.js';
export { unstable_Id, unstable_useId } from './Id.js';
export { unstable_useIdState } from './IdState.js';

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

@@ -0,0 +1,32 @@
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/isButton';
import 'reakit-warning';
import '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 { useTabbable } from '../Tabbable/Tabbable.js';
// Automatically generated
var INPUT_KEYS = [];
var useInput = createHook({
name: "Input",
compose: useTabbable,
keys: INPUT_KEYS
});
var Input = createComponent({
as: "input",
memo: true,
useHook: useInput
});
export { Input, useInput };

17
node_modules/reakit/es/Input/index.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
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/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';
export { Input, useInput } from './Input.js';

149
node_modules/reakit/es/Menu/Menu.js generated vendored Normal file
View File

@@ -0,0 +1,149 @@
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, useMemo, useCallback } from 'react';
import 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import { useWarning } from 'reakit-warning';
import { useLiveRef } from 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/hasFocusWithin';
import { isPortalEvent } from 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import 'reakit-utils/useUpdateEffect';
import { useCreateElement } from '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 'reakit-utils/ensureFocus';
import '../__keys-e6a5cfbe.js';
import '../Disclosure/DisclosureContent.js';
import 'react-dom';
import '../Portal/Portal.js';
import 'reakit-utils/removeItemFromArray';
import { M as MenuContext } from '../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';
import { useMenuBar } from './MenuBar.js';
import { M as MENU_KEYS } from '../__keys-f74df4e0.js';
function usePlacementDir(placement) {
return useMemo(function () {
var _placement$split;
return placement === null || placement === void 0 ? void 0 : (_placement$split = placement.split("-")) === null || _placement$split === void 0 ? void 0 : _placement$split[0];
}, [placement]);
}
var useMenu = createHook({
name: "Menu",
compose: [useMenuBar, usePopover],
keys: MENU_KEYS,
useOptions: function useOptions(options) {
var parent = useContext(MenuContext);
var parentIsMenuBar = (parent === null || parent === void 0 ? void 0 : parent.role) === "menubar";
return _objectSpread2(_objectSpread2({
unstable_autoFocusOnHide: !parentIsMenuBar,
modal: false
}, options), {}, {
// will be handled by MenuButton
unstable_autoFocusOnShow: false,
// will be handled differently from usePopover/useDialog
hideOnEsc: false
});
},
useProps: function useProps(options, _ref) {
var htmlOnKeyDown = _ref.onKeyDown,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onKeyDown"]);
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var parent = useContext(MenuContext);
var hasParent = !!parent;
var ancestorMenuBar = parent;
while (ancestorMenuBar && ancestorMenuBar.role !== "menubar") {
ancestorMenuBar = ancestorMenuBar.parent;
}
var _ref2 = ancestorMenuBar || {},
next = _ref2.next,
previous = _ref2.previous,
orientation = _ref2.orientation;
var ancestorIsHorizontal = orientation === "horizontal";
var dir = usePlacementDir(options.placement);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (event.key === "Escape") {
var _options$hide;
if (!hasParent) {
// On Esc, only stop propagation if there's no parent menu.
// Otherwise, pressing Esc should close all menus
event.stopPropagation();
}
(_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
} else if (hasParent && !isPortalEvent(event)) {
// Moves to the next menu button in a horizontal menu bar or close
// the menu if it's a sub menu
var ArrowRight = ancestorIsHorizontal && dir !== "left" ? next : dir === "left" && options.hide;
var ArrowLeft = ancestorIsHorizontal && dir !== "right" ? previous : dir === "right" && options.hide;
var keyMap = {
ArrowRight: ArrowRight,
ArrowLeft: ArrowLeft
};
var action = keyMap[event.key];
if (action) {
event.preventDefault();
if (hasParent) {
event.stopPropagation();
}
action();
}
}
}, [hasParent, ancestorIsHorizontal, next, previous, dir, options.hide]);
return _objectSpread2({
role: "menu",
onKeyDown: onKeyDown
}, htmlProps);
}
});
var Menu = createComponent({
as: "div",
useHook: useMenu,
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/menu") : void 0;
return useCreateElement(type, props, children);
}
});
export { Menu, useMenu };

23
node_modules/reakit/es/Menu/MenuArrow.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
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 '../Role/Role.js';
import '../__keys-26bb1730.js';
import { a as MENU_ARROW_KEYS } from '../__keys-f74df4e0.js';
import { usePopoverArrow } from '../Popover/PopoverArrow.js';
var useMenuArrow = createHook({
name: "MenuArrow",
compose: usePopoverArrow,
keys: MENU_ARROW_KEYS
});
var MenuArrow = createComponent({
as: "div",
memo: true,
useHook: useMenuArrow
});
export { MenuArrow, useMenuArrow };

140
node_modules/reakit/es/Menu/MenuBar.js generated vendored Normal file
View File

@@ -0,0 +1,140 @@
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 { useState, useEffect, useRef, useCallback } from 'react';
import { useForkRef } from '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/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import { useCreateElement } from '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 'reakit-utils/removeItemFromArray';
import { u as useMenuContext } from '../MenuContext-6af6cf92.js';
import { closest } from 'reakit-utils/closest';
import { b as MENU_BAR_KEYS } from '../__keys-f74df4e0.js';
function useShortcuts(menuRef, _ref, timeout) {
var _ref$items = _ref.items,
items = _ref$items === void 0 ? [] : _ref$items,
move = _ref.move;
if (timeout === void 0) {
timeout = 500;
}
var _React$useState = useState(""),
keys = _React$useState[0],
setKeys = _React$useState[1];
useEffect(function () {
if (!keys) return undefined;
var timeoutId = setTimeout(function () {
return setKeys("");
}, timeout);
var stop = items.find(function (s) {
return Boolean(s.ref.current && s.ref.current.textContent && s.ref.current.textContent.toLowerCase().startsWith(keys));
});
if (stop) {
move(stop.id);
}
return function () {
return clearTimeout(timeoutId);
};
}, [keys, items, move, timeout]);
useEffect(function () {
var menu = menuRef.current;
if (!menu) return undefined;
var onKeyDown = function onKeyDown(event) {
var _target$getAttribute;
if (event.key.length > 1) return;
if (event.shiftKey) return;
if (event.metaKey) return;
if (event.ctrlKey) return;
if (event.altKey) return;
var target = event.target;
var role = (_target$getAttribute = target.getAttribute) === null || _target$getAttribute === void 0 ? void 0 : _target$getAttribute.call(target, "role");
var targetIsMenu = target === menu;
var targetIsMenuItem = role && role.indexOf("menuitem") !== -1 && closest(target, "[role=menu],[role=menubar]") === menu;
if (!targetIsMenu && !targetIsMenuItem) return;
if (/^[a-z0-9_-]$/i.test(event.key)) {
event.stopPropagation();
event.preventDefault();
setKeys(function (k) {
return "" + k + event.key;
});
}
}; // https://github.com/facebook/react/issues/11387#issuecomment-524113945
menu.addEventListener("keydown", onKeyDown);
return function () {
return menu.removeEventListener("keydown", onKeyDown);
};
}, [menuRef, setKeys]);
}
var useMenuBar = createHook({
name: "MenuBar",
compose: useComposite,
keys: MENU_BAR_KEYS,
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlWrapElement = _ref.wrapElement,
_ref$role = _ref.role,
role = _ref$role === void 0 ? "menubar" : _ref$role,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "wrapElement", "role"]);
var ref = useRef(null);
var wrap = useMenuContext(ref, role, options);
useShortcuts(ref, options);
var wrapElement = useCallback(function (element) {
element = wrap(element);
if (htmlWrapElement) {
return htmlWrapElement(element);
}
return element;
}, [wrap, htmlWrapElement]);
return _objectSpread2({
ref: useForkRef(ref, htmlRef),
role: role,
"aria-orientation": options.orientation,
wrapElement: wrapElement
}, htmlProps);
}
});
var MenuBar = createComponent({
as: "div",
useHook: useMenuBar,
useCreateElement: function useCreateElement$1(type, props, children) {
process.env.NODE_ENV !== "production" ? useWarning(!props["aria-label"] && !props["aria-labelledby"] && props.role !== "menubar", "You should provide either `aria-label` or `aria-labelledby` props.", "See https://reakit.io/docs/menu") : void 0;
return useCreateElement(type, props, children);
}
});
export { MenuBar, useMenuBar };

45
node_modules/reakit/es/Menu/MenuBarState.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useState, useCallback } 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 { useCompositeState } from '../Composite/CompositeState.js';
function useMenuBarState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$orien = _useSealedState.orientation,
orientation = _useSealedState$orien === void 0 ? "horizontal" : _useSealedState$orien,
_useSealedState$unsta = _useSealedState.unstable_values,
initialValues = _useSealedState$unsta === void 0 ? {} : _useSealedState$unsta,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["orientation", "unstable_values"]);
var _React$useState = useState(initialValues),
values = _React$useState[0],
setValues = _React$useState[1];
var composite = useCompositeState(_objectSpread2(_objectSpread2({}, sealed), {}, {
orientation: orientation
}));
return _objectSpread2(_objectSpread2({}, composite), {}, {
unstable_values: values,
unstable_setValue: useCallback(function (name, value) {
setValues(function (vals) {
var _objectSpread2$1;
return _objectSpread2(_objectSpread2({}, vals), {}, (_objectSpread2$1 = {}, _objectSpread2$1[name] = typeof value === "function" ? value(vals) : value, _objectSpread2$1));
});
}, [])
});
}
export { useMenuBarState };

224
node_modules/reakit/es/Menu/MenuButton.js generated vendored Normal file
View File

@@ -0,0 +1,224 @@
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 { useContext, useRef, useCallback } from 'react';
import { useForkRef } from '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 { hasFocusWithin } from '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 '../__keys-e6a5cfbe.js';
import 'reakit-utils/removeItemFromArray';
import { M as MenuContext } from '../MenuContext-6af6cf92.js';
import '../__keys-ed7b48af.js';
import '../__keys-26bb1730.js';
import '../Disclosure/Disclosure.js';
import '../Dialog/DialogDisclosure.js';
import { c as MENU_BUTTON_KEYS } from '../__keys-f74df4e0.js';
import { usePopoverDisclosure } from '../Popover/PopoverDisclosure.js';
import { f as findVisibleSubmenu } from '../findVisibleSubmenu-1553e354.js';
var noop = function noop() {};
var useMenuButton = createHook({
name: "MenuButton",
compose: usePopoverDisclosure,
keys: MENU_BUTTON_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
var prevPopoverStyles = prev.unstable_popoverStyles,
prevArrowStyles = prev.unstable_arrowStyles,
prevCurrentId = prev.currentId,
prevMoves = prev.unstable_moves,
prevProps = _objectWithoutPropertiesLoose(prev, ["unstable_popoverStyles", "unstable_arrowStyles", "currentId", "unstable_moves"]);
var nextPopoverStyles = next.unstable_popoverStyles,
nextArrowStyles = next.unstable_arrowStyles,
nextCurrentId = next.currentId,
nextMoves = next.unstable_moves,
nextProps = _objectWithoutPropertiesLoose(next, ["unstable_popoverStyles", "unstable_arrowStyles", "currentId", "unstable_moves"]);
return usePopoverDisclosure.unstable_propsAreEqual(prevProps, nextProps);
},
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlOnClick = _ref.onClick,
htmlOnKeyDown = _ref.onKeyDown,
htmlOnFocus = _ref.onFocus,
htmlOnMouseEnter = _ref.onMouseEnter,
htmlOnMouseDown = _ref.onMouseDown,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "onClick", "onKeyDown", "onFocus", "onMouseEnter", "onMouseDown"]);
var parent = useContext(MenuContext);
var ref = useRef(null);
var hasPressedMouse = useRef(false);
var _options$placement$sp = options.placement.split("-"),
dir = _options$placement$sp[0];
var hasParent = !!parent;
var parentIsMenuBar = (parent === null || parent === void 0 ? void 0 : parent.role) === "menubar";
var disabled = options.disabled || htmlProps["aria-disabled"];
var onClickRef = useLiveRef(htmlOnClick);
var onKeyDownRef = useLiveRef(htmlOnKeyDown);
var onFocusRef = useLiveRef(htmlOnFocus);
var onMouseEnterRef = useLiveRef(htmlOnMouseEnter);
var onMouseDownRef = useLiveRef(htmlOnMouseDown);
var onKeyDown = useCallback(function (event) {
var _onKeyDownRef$current;
if (event.key === "Escape") {
var _options$hide;
// Doesn't prevent default on Escape, otherwise we can't close
// dialogs when MenuButton is focused
(_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
} else if (!disabled) {
// setTimeout prevents scroll jump
var first = options.first && function () {
return setTimeout(options.first);
};
var last = options.last && function () {
return setTimeout(options.last);
};
var keyMap = {
Enter: first,
" ": first,
ArrowUp: (dir === "top" || dir === "bottom") && last,
ArrowRight: dir === "right" && first,
ArrowDown: (dir === "bottom" || dir === "top") && first,
ArrowLeft: dir === "left" && first
};
var action = keyMap[event.key];
if (action) {
var _options$show;
event.preventDefault();
event.stopPropagation();
(_options$show = options.show) === null || _options$show === void 0 ? void 0 : _options$show.call(options);
action();
return;
}
}
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
}, [disabled, options.hide, options.first, options.last, dir, options.show]);
var onMouseEnter = useCallback(function (event) {
var _onMouseEnterRef$curr;
(_onMouseEnterRef$curr = onMouseEnterRef.current) === null || _onMouseEnterRef$curr === void 0 ? void 0 : _onMouseEnterRef$curr.call(onMouseEnterRef, event);
if (event.defaultPrevented) return; // MenuButton's don't do anything on mouse over when they aren't
// cointained within a Menu/MenuBar
if (!parent) return;
var element = event.currentTarget;
if (parentIsMenuBar) {
// if MenuButton is an item inside a MenuBar, it'll only open
// if there's already another sibling expanded MenuButton
if (findVisibleSubmenu(parent.children)) {
element.focus();
}
} else {
// If it's in a Menu, open after a short delay
// TODO: Make the delay a prop?
setTimeout(function () {
if (hasFocusWithin(element)) {
var _options$show2;
(_options$show2 = options.show) === null || _options$show2 === void 0 ? void 0 : _options$show2.call(options);
}
}, 200);
}
}, [parent, parentIsMenuBar, options.show]);
var onMouseDown = useCallback(function (event) {
var _onMouseDownRef$curre;
// When in menu bar, the menu button can be activated either by focus
// or click, but we don't want both to trigger sequentially.
// Otherwise, onClick would toggle (hide) the menu right after it got
// shown on focus.
// This is also useful so we know if the menu button has been clicked
// using mouse or keyboard. On mouse click, we don't automatically
// focus the first menu item.
hasPressedMouse.current = true;
(_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
}, []);
var onFocus = useCallback(function (event) {
var _onFocusRef$current;
(_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
if (event.defaultPrevented) return;
if (disabled) return;
if (parentIsMenuBar && !hasPressedMouse.current) {
var _options$show3;
(_options$show3 = options.show) === null || _options$show3 === void 0 ? void 0 : _options$show3.call(options);
}
}, [parentIsMenuBar, disabled, options.show]); // If disclosure is rendered as a menu bar item, it's toggable
// That is, you can click on the expanded disclosure to close its menu.
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; // If menu button is a menu item inside a menu (not menu bar), you
// can't close it by clicking on it again.
if (hasParent && !parentIsMenuBar) {
var _options$show4;
(_options$show4 = options.show) === null || _options$show4 === void 0 ? void 0 : _options$show4.call(options);
} else {
var _options$toggle;
// Otherwise, if menu button is a menu bar item or an orphan menu
// button, it's toggable.
(_options$toggle = options.toggle) === null || _options$toggle === void 0 ? void 0 : _options$toggle.call(options); // Focus the menu popover when it's opened with mouse click.
if (hasPressedMouse.current && !parentIsMenuBar && !options.visible) {
var _options$move;
(_options$move = options.move) === null || _options$move === void 0 ? void 0 : _options$move.call(options, null);
}
}
hasPressedMouse.current = false;
}, [hasParent, parentIsMenuBar, options.show, options.toggle, options.visible, options.move]);
return _objectSpread2({
ref: useForkRef(ref, htmlRef),
"aria-haspopup": "menu",
onKeyDown: onKeyDown,
onMouseEnter: onMouseEnter,
onMouseDown: onMouseDown,
onFocus: onFocus,
onClick: onClick
}, htmlProps);
},
useComposeOptions: function useComposeOptions(options) {
return _objectSpread2(_objectSpread2({}, options), {}, {
// Toggling is handled by MenuButton
toggle: noop
});
}
});
var MenuButton = createComponent({
as: "button",
memo: true,
useHook: useMenuButton
});
export { MenuButton, useMenuButton };

45
node_modules/reakit/es/Menu/MenuDisclosure.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
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/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/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 '../__keys-e6a5cfbe.js';
import 'reakit-utils/removeItemFromArray';
import '../MenuContext-6af6cf92.js';
import '../__keys-ed7b48af.js';
import '../__keys-26bb1730.js';
import '../Disclosure/Disclosure.js';
import '../Dialog/DialogDisclosure.js';
import '../__keys-f74df4e0.js';
import '../Popover/PopoverDisclosure.js';
import '../findVisibleSubmenu-1553e354.js';
import { useMenuButton } from './MenuButton.js';
var useMenuDisclosure = createHook({
name: "MenuDisclosure",
compose: useMenuButton,
useProps: function useProps(_, htmlProps) {
process.env.NODE_ENV !== "production" ? useWarning(true, "`MenuDisclosure` has been renamed to `MenuButton`. Using `<MenuDisclosure />` will no longer work in future versions.", "See https://reakit.io/docs/menu") : void 0;
return htmlProps;
}
});
var MenuDisclosure = createComponent({
as: "button",
useHook: useMenuDisclosure
});
export { MenuDisclosure, useMenuDisclosure };

23
node_modules/reakit/es/Menu/MenuGroup.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
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 MENU_GROUP_KEYS } from '../__keys-f74df4e0.js';
var useMenuGroup = createHook({
name: "MenuGroup",
compose: useRole,
keys: MENU_GROUP_KEYS,
useProps: function useProps(_, htmlProps) {
return _objectSpread2({
role: "group"
}, htmlProps);
}
});
var MenuGroup = createComponent({
as: "div",
useHook: useMenuGroup
});
export { MenuGroup, useMenuGroup };

236
node_modules/reakit/es/Menu/MenuItem.js generated vendored Normal file
View File

@@ -0,0 +1,236 @@
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, useCallback, useContext } 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 { hasFocusWithin } from '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 '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 'reakit-utils/removeItemFromArray';
import { M as MenuContext } from '../MenuContext-6af6cf92.js';
import { contains } from 'reakit-utils/contains';
import { e as MENU_ITEM_KEYS } from '../__keys-f74df4e0.js';
import { f as findVisibleSubmenu } from '../findVisibleSubmenu-1553e354.js';
function getTriangleArea(a, b, c) {
return Math.abs((a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y)) / 2);
}
function isPointInTriangle(point, a, b, c) {
var A = getTriangleArea(a, b, c);
var A1 = getTriangleArea(point, b, c);
var A2 = getTriangleArea(a, point, c);
var A3 = getTriangleArea(a, b, point);
return A === A1 + A2 + A3;
}
function getSubmenuAnchorPoints(event, visibleSubmenu) {
var _visibleSubmenu$getBo = visibleSubmenu.getBoundingClientRect(),
top = _visibleSubmenu$getBo.top,
right = _visibleSubmenu$getBo.right,
bottom = _visibleSubmenu$getBo.bottom,
left = _visibleSubmenu$getBo.left; // If left is bigger than mouse's clientX, than the submenu is visible on
// the left side
var x = left > event.clientX ? left : right;
return [{
x: x,
y: top
}, {
x: x,
y: bottom
}];
}
function useTransitToSubmenu(menu, htmlOnMouseEnter) {
var onMouseEnterRef = useLiveRef(htmlOnMouseEnter);
var enterPointRef = useRef(null);
var submenuTopPointRef = useRef(null);
var submenuBottomPointRef = useRef(null);
var previousClientX = useRef(0);
var previousClientY = useRef(0);
var assignSubmenuAnchorPoints = useCallback(function (event) {
if (!(menu !== null && menu !== void 0 && menu.children.length)) return;
submenuTopPointRef.current = null;
submenuBottomPointRef.current = null;
var visibleSubmenu = findVisibleSubmenu(menu.children);
if (!visibleSubmenu) return;
var _getSubmenuAnchorPoin = getSubmenuAnchorPoints(event, visibleSubmenu);
submenuTopPointRef.current = _getSubmenuAnchorPoin[0];
submenuBottomPointRef.current = _getSubmenuAnchorPoin[1];
}, [menu === null || menu === void 0 ? void 0 : menu.children]);
var isMouseInTransitToSubmenu = useCallback(function (event) {
var isMoving = previousClientX.current !== event.clientX || previousClientY.current !== event.clientY;
if (event.isTrusted && !isMoving) {
// Safari sometimes triggers mousemove without a mouse movement
return true;
}
var movementX = Math.abs(previousClientX.current - event.clientX);
previousClientX.current = event.clientX;
previousClientY.current = event.clientY;
var hasAnchorPoints = function hasAnchorPoints() {
return submenuTopPointRef.current && submenuBottomPointRef.current;
};
if (event.type === "mouseleave" && !hasAnchorPoints()) {
assignSubmenuAnchorPoints(event);
}
if (!hasAnchorPoints()) return false;
return movementX && enterPointRef.current && isPointInTriangle({
x: event.clientX,
y: event.clientY
}, enterPointRef.current, submenuTopPointRef.current, submenuBottomPointRef.current);
}, [assignSubmenuAnchorPoints]);
var onMouseEnter = useCallback(function (event) {
var _onMouseEnterRef$curr;
(_onMouseEnterRef$curr = onMouseEnterRef.current) === null || _onMouseEnterRef$curr === void 0 ? void 0 : _onMouseEnterRef$curr.call(onMouseEnterRef, event);
if (event.defaultPrevented) return;
if ((menu === null || menu === void 0 ? void 0 : menu.role) === "menubar") return;
enterPointRef.current = {
x: event.clientX,
y: event.clientY
};
assignSubmenuAnchorPoints(event);
}, [menu === null || menu === void 0 ? void 0 : menu.role, assignSubmenuAnchorPoints]);
return {
onMouseEnter: onMouseEnter,
isMouseInTransitToSubmenu: isMouseInTransitToSubmenu
};
}
function getMouseDestination(event) {
var relatedTarget = event.relatedTarget;
if ((relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
return event.relatedTarget;
} // IE 11
return event.toElement || null;
}
function hoveringInside(event) {
var nextElement = getMouseDestination(event);
if (!nextElement) return false;
return contains(event.currentTarget, nextElement);
}
function hoveringExpandedMenu(event, children) {
if (!(children !== null && children !== void 0 && children.length)) return false;
var nextElement = getMouseDestination(event);
if (!nextElement) return false;
var visibleSubmenu = findVisibleSubmenu(children);
return visibleSubmenu && contains(visibleSubmenu, nextElement);
}
function hoveringAnotherMenuItem(event, items) {
var nextElement = getMouseDestination(event);
if (!nextElement) return false;
return items === null || items === void 0 ? void 0 : items.some(function (item) {
return item.ref.current && contains(item.ref.current, nextElement);
});
}
var useMenuItem = createHook({
name: "MenuItem",
compose: useCompositeItem,
keys: MENU_ITEM_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
var prevPopoverStyles = prev.unstable_popoverStyles,
prevArrowStyles = prev.unstable_arrowStyles,
prevVisible = prev.visible,
prevProps = _objectWithoutPropertiesLoose(prev, ["unstable_popoverStyles", "unstable_arrowStyles", "visible"]);
var nextPopoverStyles = next.unstable_popoverStyles,
nextArrowStyles = next.unstable_arrowStyles,
nextVisible = next.visible,
nextProps = _objectWithoutPropertiesLoose(next, ["unstable_popoverStyles", "unstable_arrowStyles", "visible"]);
return useCompositeItem.unstable_propsAreEqual(prevProps, nextProps);
},
useProps: function useProps(options, _ref) {
var htmlOnMouseEnter = _ref.onMouseEnter,
htmlOnMouseMove = _ref.onMouseMove,
htmlOnMouseLeave = _ref.onMouseLeave,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["onMouseEnter", "onMouseMove", "onMouseLeave"]);
var menu = useContext(MenuContext);
var onMouseMoveRef = useLiveRef(htmlOnMouseMove);
var onMouseLeaveRef = useLiveRef(htmlOnMouseLeave);
var _useTransitToSubmenu = useTransitToSubmenu(menu, htmlOnMouseEnter),
onMouseEnter = _useTransitToSubmenu.onMouseEnter,
isMouseInTransitToSubmenu = _useTransitToSubmenu.isMouseInTransitToSubmenu;
var onMouseMove = useCallback(function (event) {
var _onMouseMoveRef$curre, _options$move;
(_onMouseMoveRef$curre = onMouseMoveRef.current) === null || _onMouseMoveRef$curre === void 0 ? void 0 : _onMouseMoveRef$curre.call(onMouseMoveRef, event);
if (event.defaultPrevented) return;
if ((menu === null || menu === void 0 ? void 0 : menu.role) === "menubar") return;
if (isMouseInTransitToSubmenu(event)) return;
if (hasFocusWithin(event.currentTarget)) return;
(_options$move = options.move) === null || _options$move === void 0 ? void 0 : _options$move.call(options, event.currentTarget.id);
}, [options.move]);
var onMouseLeave = useCallback(function (event) {
var _onMouseLeaveRef$curr;
(_onMouseLeaveRef$curr = onMouseLeaveRef.current) === null || _onMouseLeaveRef$curr === void 0 ? void 0 : _onMouseLeaveRef$curr.call(onMouseLeaveRef, event);
if (event.defaultPrevented) return;
if ((menu === null || menu === void 0 ? void 0 : menu.role) === "menubar") return;
if (hoveringInside(event)) return; // If this item is a menu disclosure and mouse is leaving it to focus
// its respective submenu, we don't want to do anything.
if (hoveringExpandedMenu(event, menu === null || menu === void 0 ? void 0 : menu.children)) return; // Move focus to menu after blurring
if (!hoveringAnotherMenuItem(event, options.items)) {
var _options$move2;
if (isMouseInTransitToSubmenu(event)) return;
(_options$move2 = options.move) === null || _options$move2 === void 0 ? void 0 : _options$move2.call(options, null);
}
}, [menu === null || menu === void 0 ? void 0 : menu.role, menu === null || menu === void 0 ? void 0 : menu.children, options.items, options.move]);
return _objectSpread2({
role: "menuitem",
onMouseEnter: onMouseEnter,
onMouseMove: onMouseMove,
onMouseLeave: onMouseLeave
}, htmlProps);
}
});
var MenuItem = createComponent({
as: "button",
memo: true,
useHook: useMenuItem
});
export { MenuItem, useMenuItem };

83
node_modules/reakit/es/Menu/MenuItemCheckbox.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
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 '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/removeIndexFromArray';
import 'reakit-utils/createEvent';
import { useCheckbox } from '../Checkbox/Checkbox.js';
import 'reakit-utils/getDocument';
import '../getCurrentId-5aa9849e.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 'reakit-utils/removeItemFromArray';
import '../MenuContext-6af6cf92.js';
import 'reakit-utils/contains';
import { f as MENU_ITEM_CHECKBOX_KEYS } from '../__keys-f74df4e0.js';
import '../findVisibleSubmenu-1553e354.js';
import { useMenuItem } from './MenuItem.js';
var useMenuItemCheckbox = createHook({
name: "MenuItemCheckbox",
compose: [useMenuItem, useCheckbox],
keys: MENU_ITEM_CHECKBOX_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
if (prev.name !== next.name) {
return useMenuItem.unstable_propsAreEqual(prev, next);
}
var prevValues = prev.unstable_values,
prevProps = _objectWithoutPropertiesLoose(prev, ["unstable_values"]);
var nextValues = next.unstable_values,
nextProps = _objectWithoutPropertiesLoose(next, ["unstable_values"]);
if (prevValues[next.name] !== nextValues[next.name]) {
return false;
}
return useMenuItem.unstable_propsAreEqual(prevProps, nextProps);
},
useOptions: function useOptions(options) {
var setState = useCallback(function (value) {
return options.unstable_setValue(options.name, value);
}, [options.unstable_setValue, options.name]);
return _objectSpread2(_objectSpread2({}, options), {}, {
state: options.unstable_values[options.name],
setState: setState
});
},
useProps: function useProps(options, htmlProps) {
return _objectSpread2({
role: "menuitemcheckbox",
name: options.name
}, htmlProps);
}
});
var MenuItemCheckbox = createComponent({
as: "button",
memo: true,
useHook: useMenuItemCheckbox
});
export { MenuItemCheckbox, useMenuItemCheckbox };

84
node_modules/reakit/es/Menu/MenuItemRadio.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
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 '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/createEvent';
import 'reakit-utils/getDocument';
import '../getCurrentId-5aa9849e.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 'reakit-utils/removeItemFromArray';
import '../MenuContext-6af6cf92.js';
import 'reakit-utils/contains';
import 'reakit-warning/warning';
import '../__keys-d251e56b.js';
import { useRadio } from '../Radio/Radio.js';
import { g as MENU_ITEM_RADIO_KEYS } from '../__keys-f74df4e0.js';
import '../findVisibleSubmenu-1553e354.js';
import { useMenuItem } from './MenuItem.js';
var useMenuItemRadio = createHook({
name: "MenuItemRadio",
compose: [useMenuItem, useRadio],
keys: MENU_ITEM_RADIO_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
if (prev.name !== next.name) {
return useMenuItem.unstable_propsAreEqual(prev, next);
}
var prevValues = prev.unstable_values,
prevProps = _objectWithoutPropertiesLoose(prev, ["unstable_values"]);
var nextValues = next.unstable_values,
nextProps = _objectWithoutPropertiesLoose(next, ["unstable_values"]);
if (prevValues[next.name] !== nextValues[next.name]) {
return false;
}
return useMenuItem.unstable_propsAreEqual(prevProps, nextProps);
},
useOptions: function useOptions(options) {
var setState = useCallback(function (value) {
return options.unstable_setValue(options.name, value);
}, [options.unstable_setValue, options.name]);
return _objectSpread2(_objectSpread2({}, options), {}, {
unstable_checkOnFocus: false,
state: options.unstable_values[options.name],
setState: setState
});
},
useProps: function useProps(_, htmlProps) {
return _objectSpread2({
role: "menuitemradio"
}, htmlProps);
}
});
var MenuItemRadio = createComponent({
as: "button",
memo: true,
useHook: useMenuItemRadio
});
export { MenuItemRadio, useMenuItemRadio };

29
node_modules/reakit/es/Menu/MenuSeparator.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
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 '../Role/Role.js';
import { h as MENU_SEPARATOR_KEYS } from '../__keys-f74df4e0.js';
import { useSeparator } from '../Separator/Separator.js';
var useMenuSeparator = createHook({
name: "MenuSeparator",
compose: useSeparator,
keys: MENU_SEPARATOR_KEYS,
useOptions: function useOptions(_ref) {
var _ref$orientation = _ref.orientation,
orientation = _ref$orientation === void 0 ? "vertical" : _ref$orientation,
options = _objectWithoutPropertiesLoose(_ref, ["orientation"]);
return _objectSpread2({
orientation: orientation === "vertical" ? "horizontal" : "vertical"
}, options);
}
});
var MenuSeparator = createComponent({
as: "hr",
memo: true,
useHook: useMenuSeparator
});
export { MenuSeparator, useMenuSeparator };

54
node_modules/reakit/es/Menu/MenuState.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-utils/shallowEqual';
import { useContext, useEffect } from '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 '@popperjs/core';
import '../Disclosure/DisclosureState.js';
import '../Dialog/DialogState.js';
import { usePopoverState } from '../Popover/PopoverState.js';
import 'reakit-utils/removeItemFromArray';
import { M as MenuContext } from '../MenuContext-6af6cf92.js';
import { useMenuBarState } from './MenuBarState.js';
function useMenuState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var parent = useContext(MenuContext);
var _useSealedState = useSealedState(initialState),
_useSealedState$orien = _useSealedState.orientation,
orientation = _useSealedState$orien === void 0 ? "vertical" : _useSealedState$orien,
_useSealedState$gutte = _useSealedState.gutter,
gutter = _useSealedState$gutte === void 0 ? 0 : _useSealedState$gutte,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["orientation", "gutter"]);
var placement = sealed.placement || (parent && parent.orientation === "vertical" ? "right-start" : "bottom-start");
var menuBar = useMenuBarState(_objectSpread2(_objectSpread2({}, sealed), {}, {
orientation: orientation
}));
var popover = usePopoverState(_objectSpread2(_objectSpread2({}, sealed), {}, {
placement: placement,
gutter: gutter
}));
useEffect(function () {
if (!popover.visible) {
menuBar.reset();
}
}, [popover.visible, menuBar.reset]);
return _objectSpread2(_objectSpread2({}, menuBar), popover);
}
export { useMenuState };

88
node_modules/reakit/es/Menu/index.js generated vendored Normal file
View File

@@ -0,0 +1,88 @@
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-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 '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 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
import '@popperjs/core';
import '../Disclosure/DisclosureState.js';
import '../Dialog/DialogState.js';
import '../Popover/PopoverState.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';
import '../Disclosure/Disclosure.js';
import '../Dialog/DialogDisclosure.js';
import 'reakit-warning/warning';
import '../__keys-d251e56b.js';
import '../Radio/Radio.js';
export { MenuBar, useMenuBar } from './MenuBar.js';
import '../__keys-f74df4e0.js';
export { Menu, useMenu } from './Menu.js';
import '../Popover/PopoverArrow.js';
export { MenuArrow, useMenuArrow } from './MenuArrow.js';
export { useMenuBarState } from './MenuBarState.js';
import '../Popover/PopoverDisclosure.js';
import '../findVisibleSubmenu-1553e354.js';
export { MenuButton, useMenuButton } from './MenuButton.js';
export { MenuDisclosure, useMenuDisclosure } from './MenuDisclosure.js';
export { MenuGroup, useMenuGroup } from './MenuGroup.js';
export { MenuItem, useMenuItem } from './MenuItem.js';
export { MenuItemCheckbox, useMenuItemCheckbox } from './MenuItemCheckbox.js';
export { MenuItemRadio, useMenuItemRadio } from './MenuItemRadio.js';
import '../Separator/Separator.js';
export { MenuSeparator, useMenuSeparator } from './MenuSeparator.js';
export { useMenuState } from './MenuState.js';

56
node_modules/reakit/es/MenuContext-6af6cf92.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
import { createContext, useContext, useState, useCallback, useEffect, useMemo, createElement } from 'react';
import { removeItemFromArray } from 'reakit-utils/removeItemFromArray';
var MenuContext = /*#__PURE__*/createContext(null);
function useMenuContext(menuRef, role, options) {
var orphan = "unstable_orphan" in options && options.unstable_orphan;
var parent = useContext(MenuContext);
var _React$useState = useState([]),
children = _React$useState[0],
setChildren = _React$useState[1];
var _ref = parent || {},
addChildToParent = _ref.addChild,
removeChildFromParent = _ref.removeChild;
var addChild = useCallback(function (ref) {
return setChildren(function (refs) {
return [].concat(refs, [ref]);
});
}, []);
var removeChild = useCallback(function (ref) {
return setChildren(function (refs) {
return removeItemFromArray(refs, ref);
});
}, []); // If it's a nested menu, add it to parent
useEffect(function () {
if (!addChildToParent || orphan) return undefined;
addChildToParent(menuRef);
return function () {
removeChildFromParent === null || removeChildFromParent === void 0 ? void 0 : removeChildFromParent(menuRef);
};
}, [menuRef, addChildToParent, removeChildFromParent, orphan]);
var providerValue = useMemo(function () {
return {
orientation: options.orientation,
next: options.next,
previous: options.previous,
ref: menuRef,
role: role,
parent: parent,
children: children,
addChild: addChild,
removeChild: removeChild
};
}, [options.orientation, options.next, options.previous, menuRef, role, parent, children, addChild, removeChild]);
var wrapElement = useCallback(function (element) {
return /*#__PURE__*/createElement(MenuContext.Provider, {
value: providerValue
}, element);
}, [providerValue]);
return wrapElement;
}
export { MenuContext as M, useMenuContext as u };

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

@@ -0,0 +1,70 @@
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 'react';
import { useForkRef } from '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 'reakit-utils/ensureFocus';
import '../__keys-e6a5cfbe.js';
import '../Disclosure/DisclosureContent.js';
import 'react-dom';
import '../Portal/Portal.js';
import 'reakit-utils/removeItemFromArray';
import '../MenuContext-6af6cf92.js';
import { useDialog } from '../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 { P as POPOVER_KEYS } from '../__keys-26bb1730.js';
var usePopover = createHook({
name: "Popover",
compose: useDialog,
keys: POPOVER_KEYS,
useOptions: function useOptions(_ref) {
var _ref$modal = _ref.modal,
modal = _ref$modal === void 0 ? false : _ref$modal,
options = _objectWithoutPropertiesLoose(_ref, ["modal"]);
return _objectSpread2({
modal: modal
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlRef = _ref2.ref,
htmlStyle = _ref2.style,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["ref", "style"]);
return _objectSpread2({
ref: useForkRef(options.unstable_popoverRef, htmlRef),
style: _objectSpread2(_objectSpread2({}, options.unstable_popoverStyles), htmlStyle)
}, htmlProps);
}
});
var Popover = createComponent({
as: "div",
useHook: usePopover,
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/popover") : void 0;
return useCreateElement(type, props, children);
}
});
export { Popover, usePopover };

73
node_modules/reakit/es/Popover/PopoverArrow.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
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 { useMemo, createElement } from 'react';
import { useForkRef } from 'reakit-utils/useForkRef';
import { useRole } from '../Role/Role.js';
import { a as POPOVER_ARROW_KEYS } from '../__keys-26bb1730.js';
var usePopoverArrow = createHook({
name: "PopoverArrow",
compose: useRole,
keys: POPOVER_ARROW_KEYS,
useOptions: function useOptions(_ref) {
var _ref$size = _ref.size,
size = _ref$size === void 0 ? 30 : _ref$size,
options = _objectWithoutPropertiesLoose(_ref, ["size"]);
return _objectSpread2({
size: size
}, options);
},
useProps: function useProps(options, _ref2) {
var _objectSpread2$1;
var htmlRef = _ref2.ref,
htmlStyle = _ref2.style,
htmlProps = _objectWithoutPropertiesLoose(_ref2, ["ref", "style"]);
var _options$placement$sp = options.placement.split("-"),
placement = _options$placement$sp[0];
var transformMap = {
top: "rotateZ(180deg)",
right: "rotateZ(-90deg)",
bottom: "rotateZ(360deg)",
left: "rotateZ(90deg)"
};
var arrowStyles = options.unstable_arrowStyles;
var transform = transformMap[placement];
var children = useMemo(function () {
return /*#__PURE__*/createElement("svg", {
viewBox: "0 0 30 30",
style: {
transform: transform
}
}, /*#__PURE__*/createElement("path", {
className: "stroke",
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
}), /*#__PURE__*/createElement("path", {
className: "fill",
d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
}));
}, [transform]);
return _objectSpread2({
ref: useForkRef(options.unstable_arrowRef, htmlRef),
style: _objectSpread2(_objectSpread2({}, arrowStyles), {}, (_objectSpread2$1 = {
fontSize: options.size,
width: "1em",
height: "1em",
pointerEvents: "none"
}, _objectSpread2$1[placement] = "100%", _objectSpread2$1), htmlStyle),
children: children
}, htmlProps);
}
});
var PopoverArrow = createComponent({
as: "div",
memo: true,
useHook: usePopoverArrow
});
export { PopoverArrow, usePopoverArrow };

40
node_modules/reakit/es/Popover/PopoverBackdrop.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 'react';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import '../Role/Role.js';
import 'reakit-utils/canUseDOM';
import '../__keys-e6a5cfbe.js';
import '../Disclosure/DisclosureContent.js';
import 'react-dom';
import '../Portal/Portal.js';
import '../DialogBackdropContext-8775f78b.js';
import '../__keys-ed7b48af.js';
import { b as POPOVER_BACKDROP_KEYS } from '../__keys-26bb1730.js';
import { useDialogBackdrop } from '../Dialog/DialogBackdrop.js';
var usePopoverBackdrop = createHook({
name: "PopoverBackdrop",
compose: useDialogBackdrop,
keys: POPOVER_BACKDROP_KEYS,
useOptions: function useOptions(_ref) {
var _ref$modal = _ref.modal,
modal = _ref$modal === void 0 ? false : _ref$modal,
options = _objectWithoutPropertiesLoose(_ref, ["modal"]);
return _objectSpread2({
modal: modal
}, options);
}
});
var PopoverBackdrop = createComponent({
as: "div",
memo: true,
useHook: usePopoverBackdrop
});
export { PopoverBackdrop, usePopoverBackdrop };

45
node_modules/reakit/es/Popover/PopoverDisclosure.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
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 'react';
import { useForkRef } from '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 '../__keys-e6a5cfbe.js';
import '../__keys-ed7b48af.js';
import { c as POPOVER_DISCLOSURE_KEYS } from '../__keys-26bb1730.js';
import '../Disclosure/Disclosure.js';
import { useDialogDisclosure } from '../Dialog/DialogDisclosure.js';
var usePopoverDisclosure = createHook({
name: "PopoverDisclosure",
compose: useDialogDisclosure,
keys: POPOVER_DISCLOSURE_KEYS,
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref"]);
return _objectSpread2({
ref: useForkRef(options.unstable_referenceRef, htmlRef)
}, htmlProps);
}
});
var PopoverDisclosure = createComponent({
as: "button",
memo: true,
useHook: usePopoverDisclosure
});
export { PopoverDisclosure, usePopoverDisclosure };

195
node_modules/reakit/es/Popover/PopoverState.js generated vendored Normal file
View File

@@ -0,0 +1,195 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { shallowEqual } from 'reakit-utils/shallowEqual';
import { useRef, useState, useCallback, useEffect } from 'react';
import 'reakit-warning';
import { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';
import { isUA } from 'reakit-utils/dom';
import { useSealedState } from 'reakit-utils/useSealedState';
import '../Id/IdProvider.js';
import '../Id/IdState.js';
import { createPopper } from '@popperjs/core';
import '../Disclosure/DisclosureState.js';
import { useDialogState } from '../Dialog/DialogState.js';
var isSafari = isUA("Mac") && !isUA("Chrome") && isUA("Safari");
function applyStyles(styles) {
return function (prevStyles) {
if (styles && !shallowEqual(prevStyles, styles)) {
return styles;
}
return prevStyles;
};
}
function usePopoverState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$gutte = _useSealedState.gutter,
gutter = _useSealedState$gutte === void 0 ? 12 : _useSealedState$gutte,
_useSealedState$place = _useSealedState.placement,
sealedPlacement = _useSealedState$place === void 0 ? "bottom" : _useSealedState$place,
_useSealedState$unsta = _useSealedState.unstable_flip,
flip = _useSealedState$unsta === void 0 ? true : _useSealedState$unsta,
sealedOffset = _useSealedState.unstable_offset,
_useSealedState$unsta2 = _useSealedState.unstable_preventOverflow,
preventOverflow = _useSealedState$unsta2 === void 0 ? true : _useSealedState$unsta2,
_useSealedState$unsta3 = _useSealedState.unstable_fixed,
fixed = _useSealedState$unsta3 === void 0 ? false : _useSealedState$unsta3,
_useSealedState$modal = _useSealedState.modal,
modal = _useSealedState$modal === void 0 ? false : _useSealedState$modal,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["gutter", "placement", "unstable_flip", "unstable_offset", "unstable_preventOverflow", "unstable_fixed", "modal"]);
var popper = useRef(null);
var referenceRef = useRef(null);
var popoverRef = useRef(null);
var arrowRef = useRef(null);
var _React$useState = useState(sealedPlacement),
originalPlacement = _React$useState[0],
place = _React$useState[1];
var _React$useState2 = useState(sealedPlacement),
placement = _React$useState2[0],
setPlacement = _React$useState2[1];
var _React$useState3 = useState(sealedOffset || [0, gutter]),
offset = _React$useState3[0];
var _React$useState4 = useState({
position: "fixed",
left: "100%",
top: "100%"
}),
popoverStyles = _React$useState4[0],
setPopoverStyles = _React$useState4[1];
var _React$useState5 = useState({}),
arrowStyles = _React$useState5[0],
setArrowStyles = _React$useState5[1];
var dialog = useDialogState(_objectSpread2({
modal: modal
}, sealed));
var update = useCallback(function () {
if (popper.current) {
popper.current.forceUpdate();
return true;
}
return false;
}, []);
var updateState = useCallback(function (state) {
if (state.placement) {
setPlacement(state.placement);
}
if (state.styles) {
setPopoverStyles(applyStyles(state.styles.popper));
if (arrowRef.current) {
setArrowStyles(applyStyles(state.styles.arrow));
}
}
}, []);
useIsomorphicEffect(function () {
if (referenceRef.current && popoverRef.current) {
popper.current = createPopper(referenceRef.current, popoverRef.current, {
// https://popper.js.org/docs/v2/constructors/#options
placement: originalPlacement,
strategy: fixed ? "fixed" : "absolute",
// Safari needs styles to be applied in the first render, otherwise
// hovering over the popover when it gets visible for the first time
// will change its dimensions unexpectedly.
onFirstUpdate: isSafari ? updateState : undefined,
modifiers: [{
// https://popper.js.org/docs/v2/modifiers/event-listeners/
name: "eventListeners",
enabled: dialog.visible
}, {
// https://popper.js.org/docs/v2/modifiers/apply-styles/
name: "applyStyles",
enabled: false
}, {
// https://popper.js.org/docs/v2/modifiers/flip/
name: "flip",
enabled: flip,
options: {
padding: 8
}
}, {
// https://popper.js.org/docs/v2/modifiers/offset/
name: "offset",
options: {
offset: offset
}
}, {
// https://popper.js.org/docs/v2/modifiers/prevent-overflow/
name: "preventOverflow",
enabled: preventOverflow,
options: {
tetherOffset: function tetherOffset() {
var _arrowRef$current;
return ((_arrowRef$current = arrowRef.current) === null || _arrowRef$current === void 0 ? void 0 : _arrowRef$current.clientWidth) || 0;
}
}
}, {
// https://popper.js.org/docs/v2/modifiers/arrow/
name: "arrow",
enabled: !!arrowRef.current,
options: {
element: arrowRef.current
}
}, {
// https://popper.js.org/docs/v2/modifiers/#custom-modifiers
name: "updateState",
phase: "write",
requires: ["computeStyles"],
enabled: dialog.visible && process.env.NODE_ENV !== "test",
fn: function fn(_ref) {
var state = _ref.state;
return updateState(state);
}
}]
});
}
return function () {
if (popper.current) {
popper.current.destroy();
popper.current = null;
}
};
}, [originalPlacement, fixed, dialog.visible, flip, offset, preventOverflow]); // Ensure that the popover will be correctly positioned with an additional
// update.
useEffect(function () {
if (!dialog.visible) return undefined;
var id = window.requestAnimationFrame(function () {
var _popper$current;
(_popper$current = popper.current) === null || _popper$current === void 0 ? void 0 : _popper$current.forceUpdate();
});
return function () {
window.cancelAnimationFrame(id);
};
}, [dialog.visible]);
return _objectSpread2(_objectSpread2({}, dialog), {}, {
unstable_referenceRef: referenceRef,
unstable_popoverRef: popoverRef,
unstable_arrowRef: arrowRef,
unstable_popoverStyles: popoverStyles,
unstable_arrowStyles: arrowStyles,
unstable_update: update,
unstable_originalPlacement: originalPlacement,
placement: placement,
place: place
});
}
export { usePopoverState };

54
node_modules/reakit/es/Popover/index.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
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/useSealedState';
import 'reakit-utils/useUpdateEffect';
import 'reakit-system/useCreateElement';
import 'reakit-utils/getDocument';
import 'reakit-utils/canUseDOM';
import 'reakit-utils/getNextActiveElementOnBlur';
import 'reakit-utils/ensureFocus';
import '../Id/IdProvider.js';
import '../Id/IdState.js';
import '@popperjs/core';
import '../Disclosure/DisclosureState.js';
import '../Dialog/DialogState.js';
export { usePopoverState } from './PopoverState.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';
export { Popover, usePopover } from './Popover.js';
import '../Dialog/DialogBackdrop.js';
import '../Disclosure/Disclosure.js';
import '../Dialog/DialogDisclosure.js';
export { PopoverArrow, usePopoverArrow } from './PopoverArrow.js';
export { PopoverDisclosure, usePopoverDisclosure } from './PopoverDisclosure.js';
export { PopoverBackdrop, usePopoverBackdrop } from './PopoverBackdrop.js';

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

@@ -0,0 +1,50 @@
import { createContext, useContext, useState, createElement } from 'react';
import { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';
import { canUseDOM } from 'reakit-utils/canUseDOM';
import { createPortal } from 'react-dom';
function getBodyElement() {
return canUseDOM ? document.body : null;
}
var PortalContext = /*#__PURE__*/createContext(getBodyElement());
function Portal(_ref) {
var children = _ref.children;
// if it's a nested portal, context is the parent portal
// otherwise it's document.body
// https://github.com/reakit/reakit/issues/513
var context = useContext(PortalContext) || getBodyElement();
var _React$useState = useState(function () {
if (canUseDOM) {
var element = document.createElement("div");
element.className = Portal.__className;
return element;
} // ssr
return null;
}),
hostNode = _React$useState[0];
useIsomorphicEffect(function () {
if (!hostNode || !context) return undefined;
context.appendChild(hostNode);
return function () {
context.removeChild(hostNode);
};
}, [hostNode, context]);
if (hostNode) {
return /*#__PURE__*/createPortal( /*#__PURE__*/createElement(PortalContext.Provider, {
value: hostNode
}, children), hostNode);
} // ssr
return null;
}
Portal.__className = "__reakit-portal";
Portal.__selector = "." + Portal.__className;
export { Portal, PortalContext };

5
node_modules/reakit/es/Portal/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import 'react';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/canUseDOM';
import 'react-dom';
export { Portal, PortalContext } from './Portal.js';

18
node_modules/reakit/es/Provider.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import { createElement } from 'react';
import { unstable_IdProvider } from './Id/IdProvider.js';
import { SystemProvider } from 'reakit-system/SystemProvider';
var defaultSystem = {};
function Provider(_ref) {
var prefix = _ref.unstable_prefix,
_ref$unstable_system = _ref.unstable_system,
system = _ref$unstable_system === void 0 ? defaultSystem : _ref$unstable_system,
children = _ref.children;
return /*#__PURE__*/createElement(unstable_IdProvider, {
prefix: prefix
}, /*#__PURE__*/createElement(SystemProvider, {
unstable_system: system
}, children));
}
export { Provider };

172
node_modules/reakit/es/Radio/Radio.js generated vendored Normal file
View File

@@ -0,0 +1,172 @@
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, useState, useEffect, useCallback } from 'react';
import { useForkRef } from '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 { createEvent } from 'reakit-utils/createEvent';
import 'reakit-utils/getDocument';
import '../getCurrentId-5aa9849e.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 { useCompositeItem } from '../Composite/CompositeItem.js';
import { warning } from 'reakit-warning/warning';
import { R as RADIO_KEYS } from '../__keys-d251e56b.js';
function getChecked(options) {
if (typeof options.checked !== "undefined") {
return options.checked;
}
return typeof options.value !== "undefined" && options.state === options.value;
}
function useInitialChecked(options) {
var _React$useState = useState(function () {
return getChecked(options);
}),
initialChecked = _React$useState[0];
var _React$useState2 = useState(options.currentId),
initialCurrentId = _React$useState2[0];
var id = options.id,
setCurrentId = options.setCurrentId;
useEffect(function () {
if (initialChecked && id && initialCurrentId !== id) {
setCurrentId === null || setCurrentId === void 0 ? void 0 : setCurrentId(id);
}
}, [initialChecked, id, setCurrentId, initialCurrentId]);
}
function fireChange(element, onChange) {
var event = createEvent(element, "change");
Object.defineProperties(event, {
type: {
value: "change"
},
target: {
value: element
},
currentTarget: {
value: element
}
});
onChange === null || onChange === void 0 ? void 0 : onChange(event);
}
var useRadio = createHook({
name: "Radio",
compose: useCompositeItem,
keys: RADIO_KEYS,
useOptions: function useOptions(_ref, _ref2) {
var _options$value;
var value = _ref2.value,
checked = _ref2.checked;
var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? false : _ref$unstable_clickOn,
_ref$unstable_checkOn = _ref.unstable_checkOnFocus,
unstable_checkOnFocus = _ref$unstable_checkOn === void 0 ? true : _ref$unstable_checkOn,
options = _objectWithoutPropertiesLoose(_ref, ["unstable_clickOnEnter", "unstable_checkOnFocus"]);
return _objectSpread2(_objectSpread2({
checked: checked,
unstable_clickOnEnter: unstable_clickOnEnter,
unstable_checkOnFocus: unstable_checkOnFocus
}, options), {}, {
value: (_options$value = options.value) != null ? _options$value : value
});
},
useProps: function useProps(options, _ref3) {
var htmlRef = _ref3.ref,
htmlOnChange = _ref3.onChange,
htmlOnClick = _ref3.onClick,
htmlProps = _objectWithoutPropertiesLoose(_ref3, ["ref", "onChange", "onClick"]);
var ref = useRef(null);
var _React$useState3 = useState(true),
isNativeRadio = _React$useState3[0],
setIsNativeRadio = _React$useState3[1];
var checked = getChecked(options);
var isCurrentItemRef = useLiveRef(options.currentId === options.id);
var onChangeRef = useLiveRef(htmlOnChange);
var onClickRef = useLiveRef(htmlOnClick);
useInitialChecked(options);
useEffect(function () {
var element = ref.current;
if (!element) {
process.env.NODE_ENV !== "production" ? warning(true, "Can't determine whether the element is a native radio because `ref` wasn't passed to the component", "See https://reakit.io/docs/radio") : void 0;
return;
}
if (element.tagName !== "INPUT" || element.type !== "radio") {
setIsNativeRadio(false);
}
}, []);
var onChange = useCallback(function (event) {
var _onChangeRef$current, _options$setState;
(_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, event);
if (event.defaultPrevented) return;
if (options.disabled) return;
(_options$setState = options.setState) === null || _options$setState === void 0 ? void 0 : _options$setState.call(options, options.value);
}, [options.disabled, options.setState, options.value]);
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;
if (isNativeRadio) return;
fireChange(event.currentTarget, onChange);
}, [onChange, isNativeRadio]);
useEffect(function () {
var element = ref.current;
if (!element) return;
if (options.unstable_moves && isCurrentItemRef.current && options.unstable_checkOnFocus) {
fireChange(element, onChange);
}
}, [options.unstable_moves, options.unstable_checkOnFocus, onChange]);
return _objectSpread2({
ref: useForkRef(ref, htmlRef),
role: !isNativeRadio ? "radio" : undefined,
type: isNativeRadio ? "radio" : undefined,
value: isNativeRadio ? options.value : undefined,
name: isNativeRadio ? options.baseId : undefined,
"aria-checked": checked,
checked: checked,
onChange: onChange,
onClick: onClick
}, htmlProps);
}
});
var Radio = createComponent({
as: "input",
memo: true,
useHook: useRadio
});
export { Radio, useRadio };

51
node_modules/reakit/es/Radio/RadioGroup.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
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 '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/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import { useCreateElement } from '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 { a as RADIO_GROUP_KEYS } from '../__keys-d251e56b.js';
var useRadioGroup = createHook({
name: "RadioGroup",
compose: useComposite,
keys: RADIO_GROUP_KEYS,
useProps: function useProps(_, htmlProps) {
return _objectSpread2({
role: "radiogroup"
}, htmlProps);
}
});
var RadioGroup = createComponent({
as: "div",
useHook: useRadioGroup,
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/radio") : void 0;
return useCreateElement(type, props, children);
}
});
export { RadioGroup, useRadioGroup };

38
node_modules/reakit/es/Radio/RadioState.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useState } 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 { useCompositeState } from '../Composite/CompositeState.js';
function useRadioState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
initialValue = _useSealedState.state,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? true : _useSealedState$loop,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["state", "loop"]);
var _React$useState = useState(initialValue),
state = _React$useState[0],
setState = _React$useState[1];
var composite = useCompositeState(_objectSpread2(_objectSpread2({}, sealed), {}, {
loop: loop
}));
return _objectSpread2(_objectSpread2({}, composite), {}, {
state: state,
setState: setState
});
}
export { useRadioState };

47
node_modules/reakit/es/Radio/index.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
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 'reakit-utils/createEvent';
import 'reakit-utils/useSealedState';
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 '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 'reakit-utils/applyState';
import '../Id/IdState.js';
import '../Composite/CompositeState.js';
import 'reakit-warning/warning';
import '../__keys-d251e56b.js';
export { Radio, useRadio } from './Radio.js';
export { RadioGroup, useRadioGroup } from './RadioGroup.js';
export { useRadioState } from './RadioState.js';

31
node_modules/reakit/es/Role/Role.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import { _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import { shallowEqual } from 'reakit-utils/shallowEqual';
// Automatically generated
var ROLE_KEYS = ["unstable_system"];
var useRole = createHook({
name: "Role",
keys: ROLE_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
var prevSystem = prev.unstable_system,
prevProps = _objectWithoutPropertiesLoose(prev, ["unstable_system"]);
var nextSystem = next.unstable_system,
nextProps = _objectWithoutPropertiesLoose(next, ["unstable_system"]);
if (prevSystem !== nextSystem && !shallowEqual(prevSystem, nextSystem)) {
return false;
}
return shallowEqual(prevProps, nextProps);
}
});
var Role = createComponent({
as: "div",
useHook: useRole
});
export { Role, useRole };

5
node_modules/reakit/es/Role/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-system/createComponent';
import 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
export { Role, useRole } from './Role.js';

121
node_modules/reakit/es/Rover/Rover.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2, b as _createForOfIteratorHelperLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { createComponent } from 'reakit-system/createComponent';
import { createHook } from 'reakit-system/createHook';
import 'reakit-utils/shallowEqual';
import { useRef, useEffect, useCallback, useMemo } from 'react';
import { useForkRef } from 'reakit-utils/useForkRef';
import 'reakit-utils/isButton';
import { warning } from 'reakit-warning';
import 'reakit-utils/useLiveRef';
import 'reakit-utils/isSelfTarget';
import 'reakit-utils/useIsomorphicEffect';
import { hasFocusWithin } from 'reakit-utils/hasFocusWithin';
import 'reakit-utils/isPortalEvent';
import 'reakit-utils/dom';
import 'reakit-utils/tabbable';
import '../Role/Role.js';
import '../Tabbable/Tabbable.js';
import { useClickable } from '../Clickable/Clickable.js';
import '../Id/IdProvider.js';
import { unstable_useId } from '../Id/Id.js';
import { createOnKeyDown } from 'reakit-utils/createOnKeyDown';
// Automatically generated
var ROVER_STATE_KEYS = ["baseId", "unstable_idCountRef", "orientation", "stops", "currentId", "unstable_pastId", "unstable_moves", "loop", "setBaseId", "register", "unregister", "move", "next", "previous", "first", "last", "unstable_reset", "unstable_orientate"];
var ROVER_KEYS = [].concat(ROVER_STATE_KEYS, ["stopId"]);
function useAllCallbacks() {
for (var _len = arguments.length, callbacks = new Array(_len), _key = 0; _key < _len; _key++) {
callbacks[_key] = arguments[_key];
}
return useCallback(function () {
var fns = callbacks.filter(Boolean);
for (var _iterator = _createForOfIteratorHelperLoose(fns), _step; !(_step = _iterator()).done;) {
var callback = _step.value;
callback.apply(void 0, arguments);
}
}, callbacks);
}
var useRover = createHook({
name: "Rover",
compose: [useClickable, unstable_useId],
keys: ROVER_KEYS,
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
_ref$tabIndex = _ref.tabIndex,
htmlTabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
htmlOnFocus = _ref.onFocus,
htmlOnKeyDown = _ref.onKeyDown,
htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "tabIndex", "onFocus", "onKeyDown"]);
var ref = useRef(null);
var id = options.stopId || options.id;
var trulyDisabled = options.disabled && !options.focusable;
var noFocused = options.currentId == null;
var focused = options.currentId === id;
var isFirst = (options.stops || [])[0] && options.stops[0].id === id;
var shouldTabIndex = focused || isFirst && noFocused;
useEffect(function () {
if (trulyDisabled || !id) return undefined;
options.register && options.register(id, ref);
return function () {
return options.unregister && options.unregister(id);
};
}, [id, trulyDisabled, options.register, options.unregister]);
useEffect(function () {
var rover = ref.current;
if (!rover) {
process.env.NODE_ENV !== "production" ? warning(true, "Can't focus rover component because `ref` wasn't passed to component.", "See https://reakit.io/docs/rover") : void 0;
return;
}
if (options.unstable_moves && focused && !hasFocusWithin(rover)) {
rover.focus();
}
}, [focused, options.unstable_moves]);
var onFocus = useCallback(function (event) {
if (!id || !event.currentTarget.contains(event.target)) return; // this is already focused, so we move silently
options.move(id, true);
}, [options.move, id]);
var onKeyDown = useMemo(function () {
return createOnKeyDown({
onKeyDown: htmlOnKeyDown,
stopPropagation: true,
shouldKeyDown: function shouldKeyDown(event) {
return (// Ignore portals
// https://github.com/facebook/react/issues/11387
event.currentTarget.contains(event.target)
);
},
keyMap: {
ArrowUp: options.orientation !== "horizontal" && options.previous,
ArrowRight: options.orientation !== "vertical" && options.next,
ArrowDown: options.orientation !== "horizontal" && options.next,
ArrowLeft: options.orientation !== "vertical" && options.previous,
Home: options.first,
End: options.last,
PageUp: options.first,
PageDown: options.last
}
});
}, [htmlOnKeyDown, options.orientation, options.previous, options.next, options.first, options.last]);
return _objectSpread2({
id: id,
ref: useForkRef(ref, htmlRef),
tabIndex: shouldTabIndex ? htmlTabIndex : -1,
onFocus: useAllCallbacks(onFocus, htmlOnFocus),
onKeyDown: onKeyDown
}, htmlProps);
}
});
var Rover = createComponent({
as: "button",
useHook: useRover
});
export { Rover, useRover };

275
node_modules/reakit/es/Rover/RoverState.js generated vendored Normal file
View File

@@ -0,0 +1,275 @@
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import { useReducer, useCallback } from 'react';
import { useSealedState } from 'reakit-utils/useSealedState';
import '../Id/IdProvider.js';
import { unstable_useIdState } from '../Id/IdState.js';
function reducer(state, action) {
var stops = state.stops,
currentId = state.currentId,
pastId = state.unstable_pastId,
moves = state.unstable_moves,
loop = state.loop;
switch (action.type) {
case "register":
{
var _id = action.id,
_ref = action.ref;
if (stops.length === 0) {
return _objectSpread2(_objectSpread2({}, state), {}, {
stops: [{
id: _id,
ref: _ref
}]
});
}
var index = stops.findIndex(function (stop) {
return stop.id === _id;
});
if (index >= 0) {
return state;
}
var indexToInsertAt = stops.findIndex(function (stop) {
if (!stop.ref.current || !_ref.current) return false; // Return true if the new rover element is located earlier in the DOM
// than stop's element, else false:
return Boolean(stop.ref.current.compareDocumentPosition(_ref.current) & Node.DOCUMENT_POSITION_PRECEDING);
}); // findIndex returns -1 when the new rover should be inserted
// at the end of stops (the compareDocumentPosition test
// always returns false in that case).
if (indexToInsertAt === -1) {
return _objectSpread2(_objectSpread2({}, state), {}, {
stops: [].concat(stops, [{
id: _id,
ref: _ref
}])
});
}
return _objectSpread2(_objectSpread2({}, state), {}, {
stops: [].concat(stops.slice(0, indexToInsertAt), [{
id: _id,
ref: _ref
}], stops.slice(indexToInsertAt))
});
}
case "unregister":
{
var _id2 = action.id;
var nextStops = stops.filter(function (stop) {
return stop.id !== _id2;
});
if (nextStops.length === stops.length) {
return state;
}
return _objectSpread2(_objectSpread2({}, state), {}, {
stops: nextStops,
unstable_pastId: pastId && pastId === _id2 ? null : pastId,
currentId: currentId && currentId === _id2 ? null : currentId
});
}
case "move":
{
var _id3 = action.id,
silent = action.silent;
var nextMoves = silent ? moves : moves + 1;
if (_id3 === null) {
return _objectSpread2(_objectSpread2({}, state), {}, {
currentId: null,
unstable_pastId: currentId,
unstable_moves: nextMoves
});
}
var _index = stops.findIndex(function (stop) {
return stop.id === _id3;
}); // Item doesn't exist, so we don't count a move
if (_index === -1) {
return state;
}
if (stops[_index].id === currentId) {
return _objectSpread2(_objectSpread2({}, state), {}, {
unstable_moves: nextMoves
});
}
return _objectSpread2(_objectSpread2({}, state), {}, {
currentId: stops[_index].id,
unstable_pastId: currentId,
unstable_moves: nextMoves
});
}
case "next":
{
if (currentId == null) {
return reducer(state, {
type: "move",
id: stops[0] && stops[0].id
});
}
var _index2 = stops.findIndex(function (stop) {
return stop.id === currentId;
}); // If loop is truthy, turns [0, currentId, 2, 3] into [currentId, 2, 3, 0]
// Otherwise turns into [currentId, 2, 3]
var reorderedStops = [].concat(stops.slice(_index2 + 1), loop ? stops.slice(0, _index2) : []);
var nextIndex = reorderedStops.findIndex(function (stop) {
return stop.id === currentId;
}) + 1;
return reducer(state, {
type: "move",
id: reorderedStops[nextIndex] && reorderedStops[nextIndex].id
});
}
case "previous":
{
var _reducer = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
stops: stops.slice().reverse()
}), {
type: "next"
}),
_ = _reducer.stops,
nextState = _objectWithoutPropertiesLoose(_reducer, ["stops"]);
return _objectSpread2(_objectSpread2({}, state), nextState);
}
case "first":
{
var stop = stops[0];
return reducer(state, {
type: "move",
id: stop && stop.id
});
}
case "last":
{
var _stop = stops[stops.length - 1];
return reducer(state, {
type: "move",
id: _stop && _stop.id
});
}
case "reset":
{
return _objectSpread2(_objectSpread2({}, state), {}, {
currentId: null,
unstable_pastId: null
});
}
case "orientate":
return _objectSpread2(_objectSpread2({}, state), {}, {
orientation: action.orientation
});
default:
throw new Error();
}
}
function useRoverState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
orientation = _useSealedState.orientation,
_useSealedState$curre = _useSealedState.currentId,
currentId = _useSealedState$curre === void 0 ? null : _useSealedState$curre,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["orientation", "currentId", "loop"]);
var _React$useReducer = useReducer(reducer, {
orientation: orientation,
stops: [],
currentId: currentId,
unstable_pastId: null,
unstable_moves: 0,
loop: loop
}),
state = _React$useReducer[0],
dispatch = _React$useReducer[1];
var idState = unstable_useIdState(sealed);
return _objectSpread2(_objectSpread2(_objectSpread2({}, idState), state), {}, {
register: useAction(function (id, ref) {
return dispatch({
type: "register",
id: id,
ref: ref
});
}),
unregister: useAction(function (id) {
return dispatch({
type: "unregister",
id: id
});
}),
move: useAction(function (id, silent) {
return dispatch({
type: "move",
id: id,
silent: silent
});
}),
next: useAction(function () {
return dispatch({
type: "next"
});
}),
previous: useAction(function () {
return dispatch({
type: "previous"
});
}),
first: useAction(function () {
return dispatch({
type: "first"
});
}),
last: useAction(function () {
return dispatch({
type: "last"
});
}),
unstable_reset: useAction(function () {
return dispatch({
type: "reset"
});
}),
unstable_orientate: useAction(function (o) {
return dispatch({
type: "orientate",
orientation: o
});
})
});
}
function useAction(fn) {
return useCallback(fn, []);
}
export { useRoverState };

Some files were not shown because too many files have changed in this diff Show More