Jesus sucks
This commit is contained in:
291
backend/frontend/node_modules/@mui/material/legacy/Select/Select.js
generated
vendored
Normal file
291
backend/frontend/node_modules/@mui/material/legacy/Select/Select.js
generated
vendored
Normal file
@@ -0,0 +1,291 @@
|
||||
'use client';
|
||||
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import clsx from 'clsx';
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
import getReactElementRef from '@mui/utils/getReactElementRef';
|
||||
import SelectInput from './SelectInput';
|
||||
import formControlState from '../FormControl/formControlState';
|
||||
import useFormControl from '../FormControl/useFormControl';
|
||||
import ArrowDropDownIcon from '../internal/svg-icons/ArrowDropDown';
|
||||
import Input from '../Input';
|
||||
import NativeSelectInput from '../NativeSelect/NativeSelectInput';
|
||||
import FilledInput from '../FilledInput';
|
||||
import OutlinedInput from '../OutlinedInput';
|
||||
import { useDefaultProps } from '../DefaultPropsProvider';
|
||||
import useForkRef from '../utils/useForkRef';
|
||||
import styled, { rootShouldForwardProp } from '../styles/styled';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
||||
var classes = ownerState.classes;
|
||||
return classes;
|
||||
};
|
||||
var styledRootConfig = {
|
||||
name: 'MuiSelect',
|
||||
overridesResolver: function overridesResolver(props, styles) {
|
||||
return styles.root;
|
||||
},
|
||||
shouldForwardProp: function shouldForwardProp(prop) {
|
||||
return rootShouldForwardProp(prop) && prop !== 'variant';
|
||||
},
|
||||
slot: 'Root'
|
||||
};
|
||||
var StyledInput = styled(Input, styledRootConfig)('');
|
||||
var StyledOutlinedInput = styled(OutlinedInput, styledRootConfig)('');
|
||||
var StyledFilledInput = styled(FilledInput, styledRootConfig)('');
|
||||
var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
||||
var props = useDefaultProps({
|
||||
name: 'MuiSelect',
|
||||
props: inProps
|
||||
});
|
||||
var _props$autoWidth = props.autoWidth,
|
||||
autoWidth = _props$autoWidth === void 0 ? false : _props$autoWidth,
|
||||
children = props.children,
|
||||
_props$classes = props.classes,
|
||||
classesProp = _props$classes === void 0 ? {} : _props$classes,
|
||||
className = props.className,
|
||||
_props$defaultOpen = props.defaultOpen,
|
||||
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
||||
_props$displayEmpty = props.displayEmpty,
|
||||
displayEmpty = _props$displayEmpty === void 0 ? false : _props$displayEmpty,
|
||||
_props$IconComponent = props.IconComponent,
|
||||
IconComponent = _props$IconComponent === void 0 ? ArrowDropDownIcon : _props$IconComponent,
|
||||
id = props.id,
|
||||
input = props.input,
|
||||
inputProps = props.inputProps,
|
||||
label = props.label,
|
||||
labelId = props.labelId,
|
||||
MenuProps = props.MenuProps,
|
||||
_props$multiple = props.multiple,
|
||||
multiple = _props$multiple === void 0 ? false : _props$multiple,
|
||||
_props$native = props.native,
|
||||
native = _props$native === void 0 ? false : _props$native,
|
||||
onClose = props.onClose,
|
||||
onOpen = props.onOpen,
|
||||
open = props.open,
|
||||
renderValue = props.renderValue,
|
||||
SelectDisplayProps = props.SelectDisplayProps,
|
||||
_props$variant = props.variant,
|
||||
variantProp = _props$variant === void 0 ? 'outlined' : _props$variant,
|
||||
other = _objectWithoutProperties(props, ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"]);
|
||||
var inputComponent = native ? NativeSelectInput : SelectInput;
|
||||
var muiFormControl = useFormControl();
|
||||
var fcs = formControlState({
|
||||
props: props,
|
||||
muiFormControl: muiFormControl,
|
||||
states: ['variant', 'error']
|
||||
});
|
||||
var variant = fcs.variant || variantProp;
|
||||
var ownerState = _extends({}, props, {
|
||||
variant: variant,
|
||||
classes: classesProp
|
||||
});
|
||||
var classes = useUtilityClasses(ownerState);
|
||||
var root = classes.root,
|
||||
restOfClasses = _objectWithoutProperties(classes, ["root"]);
|
||||
var InputComponent = input || {
|
||||
standard: /*#__PURE__*/_jsx(StyledInput, {
|
||||
ownerState: ownerState
|
||||
}),
|
||||
outlined: /*#__PURE__*/_jsx(StyledOutlinedInput, {
|
||||
label: label,
|
||||
ownerState: ownerState
|
||||
}),
|
||||
filled: /*#__PURE__*/_jsx(StyledFilledInput, {
|
||||
ownerState: ownerState
|
||||
})
|
||||
}[variant];
|
||||
var inputComponentRef = useForkRef(ref, getReactElementRef(InputComponent));
|
||||
return /*#__PURE__*/_jsx(React.Fragment, {
|
||||
children: /*#__PURE__*/React.cloneElement(InputComponent, _extends({
|
||||
// Most of the logic is implemented in `SelectInput`.
|
||||
// The `Select` component is a simple API wrapper to expose something better to play with.
|
||||
inputComponent: inputComponent,
|
||||
inputProps: _extends({
|
||||
children: children,
|
||||
error: fcs.error,
|
||||
IconComponent: IconComponent,
|
||||
variant: variant,
|
||||
type: undefined,
|
||||
// We render a select. We can ignore the type provided by the `Input`.
|
||||
multiple: multiple
|
||||
}, native ? {
|
||||
id: id
|
||||
} : {
|
||||
autoWidth: autoWidth,
|
||||
defaultOpen: defaultOpen,
|
||||
displayEmpty: displayEmpty,
|
||||
labelId: labelId,
|
||||
MenuProps: MenuProps,
|
||||
onClose: onClose,
|
||||
onOpen: onOpen,
|
||||
open: open,
|
||||
renderValue: renderValue,
|
||||
SelectDisplayProps: _extends({
|
||||
id: id
|
||||
}, SelectDisplayProps)
|
||||
}, inputProps, {
|
||||
classes: inputProps ? deepmerge(restOfClasses, inputProps.classes) : restOfClasses
|
||||
}, input ? input.props.inputProps : {})
|
||||
}, (multiple && native || displayEmpty) && variant === 'outlined' ? {
|
||||
notched: true
|
||||
} : {}, {
|
||||
ref: inputComponentRef,
|
||||
className: clsx(InputComponent.props.className, className, classes.root)
|
||||
}, !input && {
|
||||
variant: variant
|
||||
}, other))
|
||||
});
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Select.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* If `true`, the width of the popover will automatically be set according to the items inside the
|
||||
* menu, otherwise it will be at least the width of the select input.
|
||||
* @default false
|
||||
*/
|
||||
autoWidth: PropTypes.bool,
|
||||
/**
|
||||
* The option elements to populate the select with.
|
||||
* Can be some `MenuItem` when `native` is false and `option` when `native` is true.
|
||||
*
|
||||
* ⚠️The `MenuItem` elements **must** be direct descendants when `native` is false.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
* @default {}
|
||||
*/
|
||||
classes: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* If `true`, the component is initially open. Use when the component open state is not controlled (i.e. the `open` prop is not defined).
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
* @default false
|
||||
*/
|
||||
defaultOpen: PropTypes.bool,
|
||||
/**
|
||||
* The default value. Use when the component is not controlled.
|
||||
*/
|
||||
defaultValue: PropTypes.any,
|
||||
/**
|
||||
* If `true`, a value is displayed even if no items are selected.
|
||||
*
|
||||
* In order to display a meaningful value, a function can be passed to the `renderValue` prop which
|
||||
* returns the value to be displayed when no items are selected.
|
||||
*
|
||||
* ⚠️ When using this prop, make sure the label doesn't overlap with the empty displayed value.
|
||||
* The label should either be hidden or forced to a shrunk state.
|
||||
* @default false
|
||||
*/
|
||||
displayEmpty: PropTypes.bool,
|
||||
/**
|
||||
* The icon that displays the arrow.
|
||||
* @default ArrowDropDownIcon
|
||||
*/
|
||||
IconComponent: PropTypes.elementType,
|
||||
/**
|
||||
* The `id` of the wrapper element or the `select` element when `native`.
|
||||
*/
|
||||
id: PropTypes.string,
|
||||
/**
|
||||
* An `Input` element; does not have to be a material-ui specific `Input`.
|
||||
*/
|
||||
input: PropTypes.element,
|
||||
/**
|
||||
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
||||
* When `native` is `true`, the attributes are applied on the `select` element.
|
||||
*/
|
||||
inputProps: PropTypes.object,
|
||||
/**
|
||||
* See [OutlinedInput#label](/material-ui/api/outlined-input/#props)
|
||||
*/
|
||||
label: PropTypes.node,
|
||||
/**
|
||||
* The ID of an element that acts as an additional label. The Select will
|
||||
* be labelled by the additional label and the selected value.
|
||||
*/
|
||||
labelId: PropTypes.string,
|
||||
/**
|
||||
* Props applied to the [`Menu`](/material-ui/api/menu/) element.
|
||||
*/
|
||||
MenuProps: PropTypes.object,
|
||||
/**
|
||||
* If `true`, `value` must be an array and the menu will support multiple selections.
|
||||
* @default false
|
||||
*/
|
||||
multiple: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the component uses a native `select` element.
|
||||
* @default false
|
||||
*/
|
||||
native: PropTypes.bool,
|
||||
/**
|
||||
* Callback fired when a menu item is selected.
|
||||
*
|
||||
* @param {SelectChangeEvent<Value>} event The event source of the callback.
|
||||
* You can pull out the new value by accessing `event.target.value` (any).
|
||||
* **Warning**: This is a generic event, not a change event, unless the change event is caused by browser autofill.
|
||||
* @param {object} [child] The react element that was selected when `native` is `false` (default).
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select collapses).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onClose: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the component requests to be opened.
|
||||
* Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select expands).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onOpen: PropTypes.func,
|
||||
/**
|
||||
* If `true`, the component is shown.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*/
|
||||
open: PropTypes.bool,
|
||||
/**
|
||||
* Render the selected value.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*
|
||||
* @param {any} value The `value` provided to the component.
|
||||
* @returns {ReactNode}
|
||||
*/
|
||||
renderValue: PropTypes.func,
|
||||
/**
|
||||
* Props applied to the clickable div element.
|
||||
*/
|
||||
SelectDisplayProps: PropTypes.object,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
||||
/**
|
||||
* The `input` value. Providing an empty string will select no options.
|
||||
* Set to an empty string `''` if you don't want any of the available options to be selected.
|
||||
*
|
||||
* If the value is an object it must have reference equality with the option in order to be selected.
|
||||
* If the value is not an object, the string representation must match with the string representation of the option in order to be selected.
|
||||
*/
|
||||
value: PropTypes.oneOfType([PropTypes.oneOf(['']), PropTypes.any]),
|
||||
/**
|
||||
* The variant to use.
|
||||
* @default 'outlined'
|
||||
*/
|
||||
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
||||
} : void 0;
|
||||
Select.muiName = 'Select';
|
||||
export default Select;
|
||||
668
backend/frontend/node_modules/@mui/material/legacy/Select/SelectInput.js
generated
vendored
Normal file
668
backend/frontend/node_modules/@mui/material/legacy/Select/SelectInput.js
generated
vendored
Normal file
@@ -0,0 +1,668 @@
|
||||
'use client';
|
||||
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
||||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
||||
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
||||
var _span;
|
||||
import * as React from 'react';
|
||||
import { isFragment } from 'react-is';
|
||||
import PropTypes from 'prop-types';
|
||||
import clsx from 'clsx';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import useId from '@mui/utils/useId';
|
||||
import refType from '@mui/utils/refType';
|
||||
import ownerDocument from '../utils/ownerDocument';
|
||||
import capitalize from '../utils/capitalize';
|
||||
import Menu from '../Menu/Menu';
|
||||
import { nativeSelectSelectStyles, nativeSelectIconStyles } from '../NativeSelect/NativeSelectInput';
|
||||
import { isFilled } from '../InputBase/utils';
|
||||
import styled, { slotShouldForwardProp } from '../styles/styled';
|
||||
import useForkRef from '../utils/useForkRef';
|
||||
import useControlled from '../utils/useControlled';
|
||||
import selectClasses, { getSelectUtilityClasses } from './selectClasses';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
var SelectSelect = styled('div', {
|
||||
name: 'MuiSelect',
|
||||
slot: 'Select',
|
||||
overridesResolver: function overridesResolver(props, styles) {
|
||||
var ownerState = props.ownerState;
|
||||
return [// Win specificity over the input base
|
||||
_defineProperty({}, "&.".concat(selectClasses.select), styles.select), _defineProperty({}, "&.".concat(selectClasses.select), styles[ownerState.variant]), _defineProperty({}, "&.".concat(selectClasses.error), styles.error), _defineProperty({}, "&.".concat(selectClasses.multiple), styles.multiple)];
|
||||
}
|
||||
})(nativeSelectSelectStyles, _defineProperty({}, "&.".concat(selectClasses.select), {
|
||||
height: 'auto',
|
||||
// Resets for multiple select with chips
|
||||
minHeight: '1.4375em',
|
||||
// Required for select\text-field height consistency
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
overflow: 'hidden'
|
||||
}));
|
||||
var SelectIcon = styled('svg', {
|
||||
name: 'MuiSelect',
|
||||
slot: 'Icon',
|
||||
overridesResolver: function overridesResolver(props, styles) {
|
||||
var ownerState = props.ownerState;
|
||||
return [styles.icon, ownerState.variant && styles["icon".concat(capitalize(ownerState.variant))], ownerState.open && styles.iconOpen];
|
||||
}
|
||||
})(nativeSelectIconStyles);
|
||||
var SelectNativeInput = styled('input', {
|
||||
shouldForwardProp: function shouldForwardProp(prop) {
|
||||
return slotShouldForwardProp(prop) && prop !== 'classes';
|
||||
},
|
||||
name: 'MuiSelect',
|
||||
slot: 'NativeInput',
|
||||
overridesResolver: function overridesResolver(props, styles) {
|
||||
return styles.nativeInput;
|
||||
}
|
||||
})({
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
position: 'absolute',
|
||||
opacity: 0,
|
||||
pointerEvents: 'none',
|
||||
width: '100%',
|
||||
boxSizing: 'border-box'
|
||||
});
|
||||
function areEqualValues(a, b) {
|
||||
if (_typeof(b) === 'object' && b !== null) {
|
||||
return a === b;
|
||||
}
|
||||
|
||||
// The value could be a number, the DOM will stringify it anyway.
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function isEmpty(display) {
|
||||
return display == null || typeof display === 'string' && !display.trim();
|
||||
}
|
||||
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
||||
var classes = ownerState.classes,
|
||||
variant = ownerState.variant,
|
||||
disabled = ownerState.disabled,
|
||||
multiple = ownerState.multiple,
|
||||
open = ownerState.open,
|
||||
error = ownerState.error;
|
||||
var slots = {
|
||||
select: ['select', variant, disabled && 'disabled', multiple && 'multiple', error && 'error'],
|
||||
icon: ['icon', "icon".concat(capitalize(variant)), open && 'iconOpen', disabled && 'disabled'],
|
||||
nativeInput: ['nativeInput']
|
||||
};
|
||||
return composeClasses(slots, getSelectUtilityClasses, classes);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref) {
|
||||
var _MenuProps$slotProps;
|
||||
var ariaDescribedby = props['aria-describedby'],
|
||||
ariaLabel = props['aria-label'],
|
||||
autoFocus = props.autoFocus,
|
||||
autoWidth = props.autoWidth,
|
||||
children = props.children,
|
||||
className = props.className,
|
||||
defaultOpen = props.defaultOpen,
|
||||
defaultValue = props.defaultValue,
|
||||
disabled = props.disabled,
|
||||
displayEmpty = props.displayEmpty,
|
||||
_props$error = props.error,
|
||||
error = _props$error === void 0 ? false : _props$error,
|
||||
IconComponent = props.IconComponent,
|
||||
inputRefProp = props.inputRef,
|
||||
labelId = props.labelId,
|
||||
_props$MenuProps = props.MenuProps,
|
||||
MenuProps = _props$MenuProps === void 0 ? {} : _props$MenuProps,
|
||||
multiple = props.multiple,
|
||||
name = props.name,
|
||||
onBlur = props.onBlur,
|
||||
onChange = props.onChange,
|
||||
onClose = props.onClose,
|
||||
onFocus = props.onFocus,
|
||||
onOpen = props.onOpen,
|
||||
openProp = props.open,
|
||||
readOnly = props.readOnly,
|
||||
renderValue = props.renderValue,
|
||||
_props$SelectDisplayP = props.SelectDisplayProps,
|
||||
SelectDisplayProps = _props$SelectDisplayP === void 0 ? {} : _props$SelectDisplayP,
|
||||
tabIndexProp = props.tabIndex,
|
||||
type = props.type,
|
||||
valueProp = props.value,
|
||||
_props$variant = props.variant,
|
||||
variant = _props$variant === void 0 ? 'standard' : _props$variant,
|
||||
other = _objectWithoutProperties(props, ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultOpen", "defaultValue", "disabled", "displayEmpty", "error", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"]);
|
||||
var _useControlled = useControlled({
|
||||
controlled: valueProp,
|
||||
default: defaultValue,
|
||||
name: 'Select'
|
||||
}),
|
||||
_useControlled2 = _slicedToArray(_useControlled, 2),
|
||||
value = _useControlled2[0],
|
||||
setValueState = _useControlled2[1];
|
||||
var _useControlled3 = useControlled({
|
||||
controlled: openProp,
|
||||
default: defaultOpen,
|
||||
name: 'Select'
|
||||
}),
|
||||
_useControlled4 = _slicedToArray(_useControlled3, 2),
|
||||
openState = _useControlled4[0],
|
||||
setOpenState = _useControlled4[1];
|
||||
var inputRef = React.useRef(null);
|
||||
var displayRef = React.useRef(null);
|
||||
var _React$useState = React.useState(null),
|
||||
displayNode = _React$useState[0],
|
||||
setDisplayNode = _React$useState[1];
|
||||
var _React$useRef = React.useRef(openProp != null),
|
||||
isOpenControlled = _React$useRef.current;
|
||||
var _React$useState2 = React.useState(),
|
||||
menuMinWidthState = _React$useState2[0],
|
||||
setMenuMinWidthState = _React$useState2[1];
|
||||
var handleRef = useForkRef(ref, inputRefProp);
|
||||
var handleDisplayRef = React.useCallback(function (node) {
|
||||
displayRef.current = node;
|
||||
if (node) {
|
||||
setDisplayNode(node);
|
||||
}
|
||||
}, []);
|
||||
var anchorElement = displayNode == null ? void 0 : displayNode.parentNode;
|
||||
React.useImperativeHandle(handleRef, function () {
|
||||
return {
|
||||
focus: function focus() {
|
||||
displayRef.current.focus();
|
||||
},
|
||||
node: inputRef.current,
|
||||
value: value
|
||||
};
|
||||
}, [value]);
|
||||
|
||||
// Resize menu on `defaultOpen` automatic toggle.
|
||||
React.useEffect(function () {
|
||||
if (defaultOpen && openState && displayNode && !isOpenControlled) {
|
||||
setMenuMinWidthState(autoWidth ? null : anchorElement.clientWidth);
|
||||
displayRef.current.focus();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [displayNode, autoWidth]);
|
||||
// `isOpenControlled` is ignored because the component should never switch between controlled and uncontrolled modes.
|
||||
// `defaultOpen` and `openState` are ignored to avoid unnecessary callbacks.
|
||||
React.useEffect(function () {
|
||||
if (autoFocus) {
|
||||
displayRef.current.focus();
|
||||
}
|
||||
}, [autoFocus]);
|
||||
React.useEffect(function () {
|
||||
if (!labelId) {
|
||||
return undefined;
|
||||
}
|
||||
var label = ownerDocument(displayRef.current).getElementById(labelId);
|
||||
if (label) {
|
||||
var handler = function handler() {
|
||||
if (getSelection().isCollapsed) {
|
||||
displayRef.current.focus();
|
||||
}
|
||||
};
|
||||
label.addEventListener('click', handler);
|
||||
return function () {
|
||||
label.removeEventListener('click', handler);
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
}, [labelId]);
|
||||
var update = function update(open, event) {
|
||||
if (open) {
|
||||
if (onOpen) {
|
||||
onOpen(event);
|
||||
}
|
||||
} else if (onClose) {
|
||||
onClose(event);
|
||||
}
|
||||
if (!isOpenControlled) {
|
||||
setMenuMinWidthState(autoWidth ? null : anchorElement.clientWidth);
|
||||
setOpenState(open);
|
||||
}
|
||||
};
|
||||
var handleMouseDown = function handleMouseDown(event) {
|
||||
// Ignore everything but left-click
|
||||
if (event.button !== 0) {
|
||||
return;
|
||||
}
|
||||
// Hijack the default focus behavior.
|
||||
event.preventDefault();
|
||||
displayRef.current.focus();
|
||||
update(true, event);
|
||||
};
|
||||
var handleClose = function handleClose(event) {
|
||||
update(false, event);
|
||||
};
|
||||
var childrenArray = React.Children.toArray(children);
|
||||
|
||||
// Support autofill.
|
||||
var handleChange = function handleChange(event) {
|
||||
var child = childrenArray.find(function (childItem) {
|
||||
return childItem.props.value === event.target.value;
|
||||
});
|
||||
if (child === undefined) {
|
||||
return;
|
||||
}
|
||||
setValueState(child.props.value);
|
||||
if (onChange) {
|
||||
onChange(event, child);
|
||||
}
|
||||
};
|
||||
var handleItemClick = function handleItemClick(child) {
|
||||
return function (event) {
|
||||
var newValue;
|
||||
|
||||
// We use the tabindex attribute to signal the available options.
|
||||
if (!event.currentTarget.hasAttribute('tabindex')) {
|
||||
return;
|
||||
}
|
||||
if (multiple) {
|
||||
newValue = Array.isArray(value) ? value.slice() : [];
|
||||
var itemIndex = value.indexOf(child.props.value);
|
||||
if (itemIndex === -1) {
|
||||
newValue.push(child.props.value);
|
||||
} else {
|
||||
newValue.splice(itemIndex, 1);
|
||||
}
|
||||
} else {
|
||||
newValue = child.props.value;
|
||||
}
|
||||
if (child.props.onClick) {
|
||||
child.props.onClick(event);
|
||||
}
|
||||
if (value !== newValue) {
|
||||
setValueState(newValue);
|
||||
if (onChange) {
|
||||
// Redefine target to allow name and value to be read.
|
||||
// This allows seamless integration with the most popular form libraries.
|
||||
// https://github.com/mui/material-ui/issues/13485#issuecomment-676048492
|
||||
// Clone the event to not override `target` of the original event.
|
||||
var nativeEvent = event.nativeEvent || event;
|
||||
var clonedEvent = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
|
||||
Object.defineProperty(clonedEvent, 'target', {
|
||||
writable: true,
|
||||
value: {
|
||||
value: newValue,
|
||||
name: name
|
||||
}
|
||||
});
|
||||
onChange(clonedEvent, child);
|
||||
}
|
||||
}
|
||||
if (!multiple) {
|
||||
update(false, event);
|
||||
}
|
||||
};
|
||||
};
|
||||
var handleKeyDown = function handleKeyDown(event) {
|
||||
if (!readOnly) {
|
||||
var validKeys = [' ', 'ArrowUp', 'ArrowDown',
|
||||
// The native select doesn't respond to enter on macOS, but it's recommended by
|
||||
// https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
|
||||
'Enter'];
|
||||
if (validKeys.indexOf(event.key) !== -1) {
|
||||
event.preventDefault();
|
||||
update(true, event);
|
||||
}
|
||||
}
|
||||
};
|
||||
var open = displayNode !== null && openState;
|
||||
var handleBlur = function handleBlur(event) {
|
||||
// if open event.stopImmediatePropagation
|
||||
if (!open && onBlur) {
|
||||
// Preact support, target is read only property on a native event.
|
||||
Object.defineProperty(event, 'target', {
|
||||
writable: true,
|
||||
value: {
|
||||
value: value,
|
||||
name: name
|
||||
}
|
||||
});
|
||||
onBlur(event);
|
||||
}
|
||||
};
|
||||
delete other['aria-invalid'];
|
||||
var display;
|
||||
var displaySingle;
|
||||
var displayMultiple = [];
|
||||
var computeDisplay = false;
|
||||
var foundMatch = false;
|
||||
|
||||
// No need to display any value if the field is empty.
|
||||
if (isFilled({
|
||||
value: value
|
||||
}) || displayEmpty) {
|
||||
if (renderValue) {
|
||||
display = renderValue(value);
|
||||
} else {
|
||||
computeDisplay = true;
|
||||
}
|
||||
}
|
||||
var items = childrenArray.map(function (child) {
|
||||
if (! /*#__PURE__*/React.isValidElement(child)) {
|
||||
return null;
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (isFragment(child)) {
|
||||
console.error(["MUI: The Select component doesn't accept a Fragment as a child.", 'Consider providing an array instead.'].join('\n'));
|
||||
}
|
||||
}
|
||||
var selected;
|
||||
if (multiple) {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: The `value` prop must be an array when using the `Select` component with `multiple`." : _formatMuiErrorMessage(2));
|
||||
}
|
||||
selected = value.some(function (v) {
|
||||
return areEqualValues(v, child.props.value);
|
||||
});
|
||||
if (selected && computeDisplay) {
|
||||
displayMultiple.push(child.props.children);
|
||||
}
|
||||
} else {
|
||||
selected = areEqualValues(value, child.props.value);
|
||||
if (selected && computeDisplay) {
|
||||
displaySingle = child.props.children;
|
||||
}
|
||||
}
|
||||
if (selected) {
|
||||
foundMatch = true;
|
||||
}
|
||||
return /*#__PURE__*/React.cloneElement(child, {
|
||||
'aria-selected': selected ? 'true' : 'false',
|
||||
onClick: handleItemClick(child),
|
||||
onKeyUp: function onKeyUp(event) {
|
||||
if (event.key === ' ') {
|
||||
// otherwise our MenuItems dispatches a click event
|
||||
// it's not behavior of the native <option> and causes
|
||||
// the select to close immediately since we open on space keydown
|
||||
event.preventDefault();
|
||||
}
|
||||
if (child.props.onKeyUp) {
|
||||
child.props.onKeyUp(event);
|
||||
}
|
||||
},
|
||||
role: 'option',
|
||||
selected: selected,
|
||||
value: undefined,
|
||||
// The value is most likely not a valid HTML attribute.
|
||||
'data-value': child.props.value // Instead, we provide it as a data attribute.
|
||||
});
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
React.useEffect(function () {
|
||||
if (!foundMatch && !multiple && value !== '') {
|
||||
var values = childrenArray.map(function (child) {
|
||||
return child.props.value;
|
||||
});
|
||||
console.warn(["MUI: You have provided an out-of-range value `".concat(value, "` for the select ").concat(name ? "(name=\"".concat(name, "\") ") : '', "component."), "Consider providing a value that matches one of the available options or ''.", "The available values are ".concat(values.filter(function (x) {
|
||||
return x != null;
|
||||
}).map(function (x) {
|
||||
return "`".concat(x, "`");
|
||||
}).join(', ') || '""', ".")].join('\n'));
|
||||
}
|
||||
}, [foundMatch, childrenArray, multiple, name, value]);
|
||||
}
|
||||
if (computeDisplay) {
|
||||
if (multiple) {
|
||||
if (displayMultiple.length === 0) {
|
||||
display = null;
|
||||
} else {
|
||||
display = displayMultiple.reduce(function (output, child, index) {
|
||||
output.push(child);
|
||||
if (index < displayMultiple.length - 1) {
|
||||
output.push(', ');
|
||||
}
|
||||
return output;
|
||||
}, []);
|
||||
}
|
||||
} else {
|
||||
display = displaySingle;
|
||||
}
|
||||
}
|
||||
|
||||
// Avoid performing a layout computation in the render method.
|
||||
var menuMinWidth = menuMinWidthState;
|
||||
if (!autoWidth && isOpenControlled && displayNode) {
|
||||
menuMinWidth = anchorElement.clientWidth;
|
||||
}
|
||||
var tabIndex;
|
||||
if (typeof tabIndexProp !== 'undefined') {
|
||||
tabIndex = tabIndexProp;
|
||||
} else {
|
||||
tabIndex = disabled ? null : 0;
|
||||
}
|
||||
var buttonId = SelectDisplayProps.id || (name ? "mui-component-select-".concat(name) : undefined);
|
||||
var ownerState = _extends({}, props, {
|
||||
variant: variant,
|
||||
value: value,
|
||||
open: open,
|
||||
error: error
|
||||
});
|
||||
var classes = useUtilityClasses(ownerState);
|
||||
var paperProps = _extends({}, MenuProps.PaperProps, (_MenuProps$slotProps = MenuProps.slotProps) == null ? void 0 : _MenuProps$slotProps.paper);
|
||||
var listboxId = useId();
|
||||
return /*#__PURE__*/_jsxs(React.Fragment, {
|
||||
children: [/*#__PURE__*/_jsx(SelectSelect, _extends({
|
||||
ref: handleDisplayRef,
|
||||
tabIndex: tabIndex,
|
||||
role: "combobox",
|
||||
"aria-controls": listboxId,
|
||||
"aria-disabled": disabled ? 'true' : undefined,
|
||||
"aria-expanded": open ? 'true' : 'false',
|
||||
"aria-haspopup": "listbox",
|
||||
"aria-label": ariaLabel,
|
||||
"aria-labelledby": [labelId, buttonId].filter(Boolean).join(' ') || undefined,
|
||||
"aria-describedby": ariaDescribedby,
|
||||
onKeyDown: handleKeyDown,
|
||||
onMouseDown: disabled || readOnly ? null : handleMouseDown,
|
||||
onBlur: handleBlur,
|
||||
onFocus: onFocus
|
||||
}, SelectDisplayProps, {
|
||||
ownerState: ownerState,
|
||||
className: clsx(SelectDisplayProps.className, classes.select, className)
|
||||
// The id is required for proper a11y
|
||||
,
|
||||
id: buttonId,
|
||||
children: isEmpty(display) ? // notranslate needed while Google Translate will not fix zero-width space issue
|
||||
_span || (_span = /*#__PURE__*/_jsx("span", {
|
||||
className: "notranslate",
|
||||
children: "\u200B"
|
||||
})) : display
|
||||
})), /*#__PURE__*/_jsx(SelectNativeInput, _extends({
|
||||
"aria-invalid": error,
|
||||
value: Array.isArray(value) ? value.join(',') : value,
|
||||
name: name,
|
||||
ref: inputRef,
|
||||
"aria-hidden": true,
|
||||
onChange: handleChange,
|
||||
tabIndex: -1,
|
||||
disabled: disabled,
|
||||
className: classes.nativeInput,
|
||||
autoFocus: autoFocus,
|
||||
ownerState: ownerState
|
||||
}, other)), /*#__PURE__*/_jsx(SelectIcon, {
|
||||
as: IconComponent,
|
||||
className: classes.icon,
|
||||
ownerState: ownerState
|
||||
}), /*#__PURE__*/_jsx(Menu, _extends({
|
||||
id: "menu-".concat(name || ''),
|
||||
anchorEl: anchorElement,
|
||||
open: open,
|
||||
onClose: handleClose,
|
||||
anchorOrigin: {
|
||||
vertical: 'bottom',
|
||||
horizontal: 'center'
|
||||
},
|
||||
transformOrigin: {
|
||||
vertical: 'top',
|
||||
horizontal: 'center'
|
||||
}
|
||||
}, MenuProps, {
|
||||
MenuListProps: _extends({
|
||||
'aria-labelledby': labelId,
|
||||
role: 'listbox',
|
||||
'aria-multiselectable': multiple ? 'true' : undefined,
|
||||
disableListWrap: true,
|
||||
id: listboxId
|
||||
}, MenuProps.MenuListProps),
|
||||
slotProps: _extends({}, MenuProps.slotProps, {
|
||||
paper: _extends({}, paperProps, {
|
||||
style: _extends({
|
||||
minWidth: menuMinWidth
|
||||
}, paperProps != null ? paperProps.style : null)
|
||||
})
|
||||
}),
|
||||
children: items
|
||||
}))]
|
||||
});
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
'aria-describedby': PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
'aria-label': PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
autoFocus: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the width of the popover will automatically be set according to the items inside the
|
||||
* menu, otherwise it will be at least the width of the select input.
|
||||
*/
|
||||
autoWidth: PropTypes.bool,
|
||||
/**
|
||||
* The option elements to populate the select with.
|
||||
* Can be some `<MenuItem>` elements.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: PropTypes.object,
|
||||
/**
|
||||
* The CSS class name of the select element.
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* If `true`, the component is toggled on mount. Use when the component open state is not controlled.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*/
|
||||
defaultOpen: PropTypes.bool,
|
||||
/**
|
||||
* The default value. Use when the component is not controlled.
|
||||
*/
|
||||
defaultValue: PropTypes.any,
|
||||
/**
|
||||
* If `true`, the select is disabled.
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the selected item is displayed even if its value is empty.
|
||||
*/
|
||||
displayEmpty: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the `select input` will indicate an error.
|
||||
*/
|
||||
error: PropTypes.bool,
|
||||
/**
|
||||
* The icon that displays the arrow.
|
||||
*/
|
||||
IconComponent: PropTypes.elementType.isRequired,
|
||||
/**
|
||||
* Imperative handle implementing `{ value: T, node: HTMLElement, focus(): void }`
|
||||
* Equivalent to `ref`
|
||||
*/
|
||||
inputRef: refType,
|
||||
/**
|
||||
* The ID of an element that acts as an additional label. The Select will
|
||||
* be labelled by the additional label and the selected value.
|
||||
*/
|
||||
labelId: PropTypes.string,
|
||||
/**
|
||||
* Props applied to the [`Menu`](/material-ui/api/menu/) element.
|
||||
*/
|
||||
MenuProps: PropTypes.object,
|
||||
/**
|
||||
* If `true`, `value` must be an array and the menu will support multiple selections.
|
||||
*/
|
||||
multiple: PropTypes.bool,
|
||||
/**
|
||||
* Name attribute of the `select` or hidden `input` element.
|
||||
*/
|
||||
name: PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onBlur: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when a menu item is selected.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
* You can pull out the new value by accessing `event.target.value` (any).
|
||||
* @param {object} [child] The react element that was selected.
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Use in controlled mode (see open).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onClose: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onFocus: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the component requests to be opened.
|
||||
* Use in controlled mode (see open).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onOpen: PropTypes.func,
|
||||
/**
|
||||
* If `true`, the component is shown.
|
||||
*/
|
||||
open: PropTypes.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
readOnly: PropTypes.bool,
|
||||
/**
|
||||
* Render the selected value.
|
||||
*
|
||||
* @param {any} value The `value` provided to the component.
|
||||
* @returns {ReactNode}
|
||||
*/
|
||||
renderValue: PropTypes.func,
|
||||
/**
|
||||
* Props applied to the clickable div element.
|
||||
*/
|
||||
SelectDisplayProps: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
type: PropTypes.any,
|
||||
/**
|
||||
* The input value.
|
||||
*/
|
||||
value: PropTypes.any,
|
||||
/**
|
||||
* The variant to use.
|
||||
*/
|
||||
variant: PropTypes.oneOf(['standard', 'outlined', 'filled'])
|
||||
} : void 0;
|
||||
export default SelectInput;
|
||||
5
backend/frontend/node_modules/@mui/material/legacy/Select/index.js
generated
vendored
Normal file
5
backend/frontend/node_modules/@mui/material/legacy/Select/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use client';
|
||||
|
||||
export { default } from './Select';
|
||||
export { default as selectClasses } from './selectClasses';
|
||||
export * from './selectClasses';
|
||||
7
backend/frontend/node_modules/@mui/material/legacy/Select/selectClasses.js
generated
vendored
Normal file
7
backend/frontend/node_modules/@mui/material/legacy/Select/selectClasses.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
export function getSelectUtilityClasses(slot) {
|
||||
return generateUtilityClass('MuiSelect', slot);
|
||||
}
|
||||
var selectClasses = generateUtilityClasses('MuiSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
||||
export default selectClasses;
|
||||
Reference in New Issue
Block a user