@mui/base
Advanced tools
Comparing version 5.0.0-alpha.80 to 5.0.0-alpha.81
@@ -311,3 +311,3 @@ import * as React from 'react'; | ||
getRootProps: () => React.HTMLAttributes<HTMLDivElement>; | ||
getInputProps: () => React.HTMLAttributes<HTMLInputElement>; | ||
getInputProps: () => React.InputHTMLAttributes<HTMLInputElement>; | ||
// We pass `getInputLabelProps()` to `@mui/material/InputLabel` which does not implement HTMLLabelElement#color. | ||
@@ -314,0 +314,0 @@ getInputLabelProps: () => Omit<React.HTMLAttributes<HTMLLabelElement>, 'color'>; |
@@ -0,0 +0,0 @@ export interface BadgeUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface ButtonUnstyledClasses { |
@@ -0,0 +0,0 @@ export { default } from './ButtonUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -1,1 +0,1 @@ | ||
export { unstable_ClassNameGenerator } from '@mui/private-classnames'; | ||
export { unstable_ClassNameGenerator } from '@mui/utils'; |
// eslint-disable-next-line import/prefer-default-export | ||
export { unstable_ClassNameGenerator } from '@mui/private-classnames'; | ||
export { unstable_ClassNameGenerator } from '@mui/utils'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
export { default } from './ClickAwayListener'; | ||
export * from './ClickAwayListener'; |
@@ -1,1 +0,1 @@ | ||
export { unstable_composeClasses as default } from '@mui/private-classnames'; | ||
export { unstable_composeClasses as default } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { unstable_composeClasses as default } from '@mui/private-classnames'; | ||
export { unstable_composeClasses as default } from '@mui/utils'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface FormControlUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export { default } from './FormControlUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -1,2 +0,2 @@ | ||
export { generateUtilityClass as default } from '@mui/private-classnames'; | ||
export type { GlobalStateSlot } from '@mui/private-classnames'; | ||
export { unstable_generateUtilityClass as default } from '@mui/utils'; | ||
export type { GlobalStateSlot } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { generateUtilityClass as default } from '@mui/private-classnames'; | ||
export { unstable_generateUtilityClass as default } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { generateUtilityClasses as default } from '@mui/private-classnames'; | ||
export { unstable_generateUtilityClasses as default } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { generateUtilityClasses as default } from '@mui/private-classnames'; | ||
export { unstable_generateUtilityClasses as default } from '@mui/utils'; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.80 | ||
/** @license MUI v5.0.0-alpha.81 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
export { default } from './InputUnstyled'; | ||
export type { default as InputUnstyledProps } from './InputUnstyledProps'; | ||
export * from './InputUnstyledProps'; | ||
export * from './InputUnstyled.types'; | ||
export { default as useInput } from './useInput'; | ||
export * from './useInput.types'; | ||
export { default as inputUnstyledClasses } from './inputUnstyledClasses'; | ||
export * from './inputUnstyledClasses'; |
export { default } from './InputUnstyled'; | ||
export * from './InputUnstyledProps'; | ||
export * from './InputUnstyled.types'; | ||
export { default as useInput } from './useInput'; | ||
export * from './useInput.types'; | ||
export { default as inputUnstyledClasses } from './inputUnstyledClasses'; | ||
export * from './inputUnstyledClasses'; |
import { OverridableComponent } from '@mui/types'; | ||
import { InputUnstyledTypeMap } from './InputUnstyledProps'; | ||
import { InputUnstyledTypeMap } from './InputUnstyled.types'; | ||
/** | ||
@@ -4,0 +4,0 @@ * |
@@ -8,6 +8,11 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import PropTypes from 'prop-types'; | ||
import { unstable_useForkRef as useForkRef } from '@mui/utils'; | ||
import appendOwnerState from '../utils/appendOwnerState'; | ||
import isHostComponent from '../utils/isHostComponent'; | ||
import resolveComponentProps from '../utils/resolveComponentProps'; | ||
import classes from './inputUnstyledClasses'; | ||
import useInput from './useInput'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
/** | ||
@@ -23,8 +28,5 @@ * | ||
*/ | ||
const InputUnstyled = /*#__PURE__*/React.forwardRef(function InputUnstyled(props, forwardedRef) { | ||
var _ref, _components$Input; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
const InputUnstyled = /*#__PURE__*/React.forwardRef(function InputUnstyled(props, ref) { | ||
var _componentsProps$inpu, _ref, _componentsProps$root, _components$Input, _componentsProps$inpu2; | ||
const { | ||
@@ -82,3 +84,3 @@ 'aria-describedby': ariaDescribedby, | ||
value | ||
}, (_componentsProps$inpu = componentsProps.input) == null ? void 0 : _componentsProps$inpu.ref); | ||
}); | ||
@@ -111,10 +113,13 @@ const ownerState = _extends({}, props, { | ||
const Root = (_ref = component != null ? component : components.Root) != null ? _ref : 'div'; | ||
const rootProps = appendOwnerState(Root, _extends({}, getRootProps(_extends({}, other, componentsProps.root)), { | ||
className: clsx(classes.root, rootStateClasses, className, (_componentsProps$root = componentsProps.root) == null ? void 0 : _componentsProps$root.className) | ||
const rootComponentsProps = resolveComponentProps(componentsProps.root, ownerState); | ||
const rootProps = appendOwnerState(Root, _extends({}, getRootProps(_extends({}, other, rootComponentsProps)), { | ||
className: clsx(classes.root, rootStateClasses, className, rootComponentsProps == null ? void 0 : rootComponentsProps.className) | ||
}), ownerState); | ||
let Input = (_components$Input = components.Input) != null ? _components$Input : 'input'; // TODO: type this properly | ||
let inputProps = appendOwnerState(Input, _extends({}, getInputProps(_extends({}, componentsProps.input, propsToForward)), { | ||
className: clsx(classes.input, inputStateClasses, (_componentsProps$inpu2 = componentsProps.input) == null ? void 0 : _componentsProps$inpu2.className) | ||
rootProps.ref = useForkRef(rootProps.ref, useForkRef(rootComponentsProps == null ? void 0 : rootComponentsProps.ref, forwardedRef)); | ||
let Input = (_components$Input = components.Input) != null ? _components$Input : 'input'; | ||
const inputComponentsProps = resolveComponentProps(componentsProps.input, ownerState); | ||
let inputProps = appendOwnerState(Input, _extends({}, getInputProps(_extends({}, inputComponentsProps, propsToForward)), { | ||
className: clsx(classes.input, inputStateClasses, inputComponentsProps == null ? void 0 : inputComponentsProps.className) | ||
}), ownerState); | ||
inputProps.ref = useForkRef(inputProps.ref, inputComponentsProps == null ? void 0 : inputComponentsProps.ref); | ||
@@ -136,8 +141,8 @@ if (multiline) { | ||
inputProps = _extends({ | ||
type: undefined | ||
}, !hasHostTextarea && { | ||
inputProps = _extends({}, !hasHostTextarea && { | ||
minRows: rows || minRows, | ||
maxRows: rows || maxRows | ||
}, hasHostTextarea ? inputPropsWithoutOwnerState : inputProps); | ||
}, hasHostTextarea ? inputPropsWithoutOwnerState : inputProps, { | ||
type: undefined | ||
}); | ||
Input = (_components$Textarea2 = components.Textarea) != null ? _components$Textarea2 : 'textarea'; | ||
@@ -147,3 +152,2 @@ } | ||
return /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, { | ||
ref: ref, | ||
children: [startAdornment, /*#__PURE__*/_jsx(Input, _extends({}, inputProps)), endAdornment] | ||
@@ -219,4 +223,4 @@ })); | ||
componentsProps: PropTypes.shape({ | ||
input: PropTypes.object, | ||
root: PropTypes.object | ||
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), | ||
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]) | ||
}), | ||
@@ -333,3 +337,5 @@ | ||
*/ | ||
type: PropTypes.string, | ||
type: PropTypes | ||
/* @typescript-to-proptypes-ignore */ | ||
.oneOf(['button', 'checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'hidden', 'image', 'month', 'number', 'password', 'radio', 'range', 'reset', 'search', 'submit', 'tel', 'text', 'time', 'url', 'week']), | ||
@@ -336,0 +342,0 @@ /** |
@@ -0,0 +0,0 @@ export interface InputUnstyledClasses { |
import * as React from 'react'; | ||
import { UseInputProps } from './InputUnstyledProps'; | ||
export default function useInput(props: UseInputProps, inputRef?: React.Ref<HTMLInputElement>): { | ||
import { UseInputInputSlotProps, UseInputParameters, UseInputRootSlotProps } from './useInput.types'; | ||
export default function useInput(parameters: UseInputParameters): { | ||
disabled: boolean; | ||
@@ -18,15 +18,6 @@ error: boolean; | ||
} | undefined; | ||
getInputProps: (externalProps?: Record<string, unknown> | undefined) => { | ||
'aria-invalid': true | undefined; | ||
defaultValue: string | number | readonly string[] | undefined; | ||
ref: React.Ref<any>; | ||
value: string | number | readonly string[] | undefined; | ||
required: boolean; | ||
disabled: boolean; | ||
}; | ||
getRootProps: (externalProps?: Record<string, unknown> | undefined) => { | ||
onClick: (event: React.MouseEvent<HTMLInputElement>) => void; | ||
}; | ||
getInputProps: <TOther extends Record<string, any> = {}>(externalProps?: TOther) => UseInputInputSlotProps<TOther>; | ||
getRootProps: <TOther_1 extends Record<string, any> = {}>(externalProps?: TOther_1) => UseInputRootSlotProps<TOther_1>; | ||
required: boolean; | ||
value: unknown; | ||
}; |
@@ -7,3 +7,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
export default function useInput(props, inputRef) { | ||
export default function useInput(parameters) { | ||
const { | ||
@@ -18,3 +18,3 @@ defaultValue: defaultValueProp, | ||
value: valueProp | ||
} = props; | ||
} = parameters; | ||
const formControlContext = useFormControlUnstyledContext(); | ||
@@ -37,3 +37,3 @@ let defaultValue; | ||
if (process.env.NODE_ENV !== 'production') { | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => props[prop] !== undefined); | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => parameters[prop] !== undefined); | ||
@@ -62,5 +62,4 @@ if (definedLocalProps.length > 0) { | ||
}, []); | ||
const internalInputRef = React.useRef(null); | ||
const handleIncomingRef = useForkRef(inputRef, handleInputRefWarning); | ||
const handleInputRef = useForkRef(internalInputRef, handleIncomingRef); | ||
const inputRef = React.useRef(null); | ||
const handleInputRef = useForkRef(inputRef, handleInputRefWarning); | ||
const [focused, setFocused] = React.useState(false); // The blur won't fire when the disabled state is set on a focused input. | ||
@@ -114,3 +113,3 @@ // We need to book keep the focused state manually. | ||
if (!isControlled) { | ||
const element = event.target || internalInputRef.current; | ||
const element = event.target || inputRef.current; | ||
@@ -130,4 +129,4 @@ if (element == null) { | ||
if (internalInputRef.current && event.currentTarget === event.target) { | ||
internalInputRef.current.focus(); | ||
if (inputRef.current && event.currentTarget === event.target) { | ||
inputRef.current.focus(); | ||
} | ||
@@ -138,5 +137,5 @@ | ||
const getRootProps = externalProps => { | ||
const getRootProps = (externalProps = {}) => { | ||
// onBlur, onChange and onFocus are forwarded to the input slot. | ||
const propsEventHandlers = extractEventHandlers(props, ['onBlur', 'onChange', 'onFocus']); | ||
const propsEventHandlers = extractEventHandlers(parameters, ['onBlur', 'onChange', 'onFocus']); | ||
@@ -150,3 +149,3 @@ const externalEventHandlers = _extends({}, propsEventHandlers, extractEventHandlers(externalProps)); | ||
const getInputProps = externalProps => { | ||
const getInputProps = (externalProps = {}) => { | ||
const propsEventHandlers = { | ||
@@ -153,0 +152,0 @@ onBlur, |
// eslint-disable-next-line import/prefer-default-export | ||
export { unstable_ClassNameGenerator } from '@mui/private-classnames'; | ||
export { unstable_ClassNameGenerator } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { unstable_composeClasses as default } from '@mui/private-classnames'; | ||
export { unstable_composeClasses as default } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { generateUtilityClass as default } from '@mui/private-classnames'; | ||
export { unstable_generateUtilityClass as default } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { generateUtilityClasses as default } from '@mui/private-classnames'; | ||
export { unstable_generateUtilityClasses as default } from '@mui/utils'; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.80 | ||
/** @license MUI v5.0.0-alpha.81 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
export { default } from './InputUnstyled'; | ||
export * from './InputUnstyledProps'; | ||
export * from './InputUnstyled.types'; | ||
export { default as useInput } from './useInput'; | ||
export * from './useInput.types'; | ||
export { default as inputUnstyledClasses } from './inputUnstyledClasses'; | ||
export * from './inputUnstyledClasses'; |
@@ -6,6 +6,11 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import PropTypes from 'prop-types'; | ||
import { unstable_useForkRef as useForkRef } from '@mui/utils'; | ||
import appendOwnerState from '../utils/appendOwnerState'; | ||
import isHostComponent from '../utils/isHostComponent'; | ||
import resolveComponentProps from '../utils/resolveComponentProps'; | ||
import classes from './inputUnstyledClasses'; | ||
import useInput from './useInput'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
/** | ||
@@ -21,8 +26,5 @@ * | ||
*/ | ||
var InputUnstyled = /*#__PURE__*/React.forwardRef(function InputUnstyled(props, forwardedRef) { | ||
var _ref, _components$Input; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
var InputUnstyled = /*#__PURE__*/React.forwardRef(function InputUnstyled(props, ref) { | ||
var _componentsProps$inpu, _ref, _componentsProps$root, _components$Input, _componentsProps$inpu2; | ||
var ariaDescribedby = props['aria-describedby'], | ||
@@ -75,3 +77,3 @@ ariaLabel = props['aria-label'], | ||
value: value | ||
}, (_componentsProps$inpu = componentsProps.input) == null ? void 0 : _componentsProps$inpu.ref), | ||
}), | ||
getRootProps = _useInput.getRootProps, | ||
@@ -110,10 +112,13 @@ getInputProps = _useInput.getInputProps, | ||
var Root = (_ref = component != null ? component : components.Root) != null ? _ref : 'div'; | ||
var rootProps = appendOwnerState(Root, _extends({}, getRootProps(_extends({}, other, componentsProps.root)), { | ||
className: clsx(classes.root, rootStateClasses, className, (_componentsProps$root = componentsProps.root) == null ? void 0 : _componentsProps$root.className) | ||
var rootComponentsProps = resolveComponentProps(componentsProps.root, ownerState); | ||
var rootProps = appendOwnerState(Root, _extends({}, getRootProps(_extends({}, other, rootComponentsProps)), { | ||
className: clsx(classes.root, rootStateClasses, className, rootComponentsProps == null ? void 0 : rootComponentsProps.className) | ||
}), ownerState); | ||
var Input = (_components$Input = components.Input) != null ? _components$Input : 'input'; // TODO: type this properly | ||
var inputProps = appendOwnerState(Input, _extends({}, getInputProps(_extends({}, componentsProps.input, propsToForward)), { | ||
className: clsx(classes.input, inputStateClasses, (_componentsProps$inpu2 = componentsProps.input) == null ? void 0 : _componentsProps$inpu2.className) | ||
rootProps.ref = useForkRef(rootProps.ref, useForkRef(rootComponentsProps == null ? void 0 : rootComponentsProps.ref, forwardedRef)); | ||
var Input = (_components$Input = components.Input) != null ? _components$Input : 'input'; | ||
var inputComponentsProps = resolveComponentProps(componentsProps.input, ownerState); | ||
var inputProps = appendOwnerState(Input, _extends({}, getInputProps(_extends({}, inputComponentsProps, propsToForward)), { | ||
className: clsx(classes.input, inputStateClasses, inputComponentsProps == null ? void 0 : inputComponentsProps.className) | ||
}), ownerState); | ||
inputProps.ref = useForkRef(inputProps.ref, inputComponentsProps == null ? void 0 : inputComponentsProps.ref); | ||
@@ -137,8 +142,8 @@ if (multiline) { | ||
inputProps = _extends({ | ||
type: undefined | ||
}, !hasHostTextarea && { | ||
inputProps = _extends({}, !hasHostTextarea && { | ||
minRows: rows || minRows, | ||
maxRows: rows || maxRows | ||
}, hasHostTextarea ? inputPropsWithoutOwnerState : inputProps); | ||
}, hasHostTextarea ? inputPropsWithoutOwnerState : inputProps, { | ||
type: undefined | ||
}); | ||
Input = (_components$Textarea2 = components.Textarea) != null ? _components$Textarea2 : 'textarea'; | ||
@@ -148,3 +153,2 @@ } | ||
return /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, { | ||
ref: ref, | ||
children: [startAdornment, /*#__PURE__*/_jsx(Input, _extends({}, inputProps)), endAdornment] | ||
@@ -220,4 +224,4 @@ })); | ||
componentsProps: PropTypes.shape({ | ||
input: PropTypes.object, | ||
root: PropTypes.object | ||
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), | ||
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]) | ||
}), | ||
@@ -334,3 +338,5 @@ | ||
*/ | ||
type: PropTypes.string, | ||
type: PropTypes | ||
/* @typescript-to-proptypes-ignore */ | ||
.oneOf(['button', 'checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'hidden', 'image', 'month', 'number', 'password', 'radio', 'range', 'reset', 'search', 'submit', 'tel', 'text', 'time', 'url', 'week']), | ||
@@ -337,0 +343,0 @@ /** |
@@ -7,14 +7,14 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
export default function useInput(props, inputRef) { | ||
var defaultValueProp = props.defaultValue, | ||
_props$disabled = props.disabled, | ||
disabledProp = _props$disabled === void 0 ? false : _props$disabled, | ||
_props$error = props.error, | ||
errorProp = _props$error === void 0 ? false : _props$error, | ||
onBlur = props.onBlur, | ||
onChange = props.onChange, | ||
onFocus = props.onFocus, | ||
_props$required = props.required, | ||
requiredProp = _props$required === void 0 ? false : _props$required, | ||
valueProp = props.value; | ||
export default function useInput(parameters) { | ||
var defaultValueProp = parameters.defaultValue, | ||
_parameters$disabled = parameters.disabled, | ||
disabledProp = _parameters$disabled === void 0 ? false : _parameters$disabled, | ||
_parameters$error = parameters.error, | ||
errorProp = _parameters$error === void 0 ? false : _parameters$error, | ||
onBlur = parameters.onBlur, | ||
onChange = parameters.onChange, | ||
onFocus = parameters.onFocus, | ||
_parameters$required = parameters.required, | ||
requiredProp = _parameters$required === void 0 ? false : _parameters$required, | ||
valueProp = parameters.value; | ||
var formControlContext = useFormControlUnstyledContext(); | ||
@@ -38,3 +38,3 @@ var defaultValue; | ||
var definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(function (prop) { | ||
return props[prop] !== undefined; | ||
return parameters[prop] !== undefined; | ||
}); | ||
@@ -64,5 +64,4 @@ | ||
}, []); | ||
var internalInputRef = React.useRef(null); | ||
var handleIncomingRef = useForkRef(inputRef, handleInputRefWarning); | ||
var handleInputRef = useForkRef(internalInputRef, handleIncomingRef); | ||
var inputRef = React.useRef(null); | ||
var handleInputRef = useForkRef(inputRef, handleInputRefWarning); | ||
@@ -125,3 +124,3 @@ var _React$useState = React.useState(false), | ||
if (!isControlled) { | ||
var element = event.target || internalInputRef.current; | ||
var element = event.target || inputRef.current; | ||
@@ -147,4 +146,4 @@ if (element == null) { | ||
if (internalInputRef.current && event.currentTarget === event.target) { | ||
internalInputRef.current.focus(); | ||
if (inputRef.current && event.currentTarget === event.target) { | ||
inputRef.current.focus(); | ||
} | ||
@@ -156,5 +155,6 @@ | ||
var getRootProps = function getRootProps(externalProps) { | ||
var getRootProps = function getRootProps() { | ||
var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
// onBlur, onChange and onFocus are forwarded to the input slot. | ||
var propsEventHandlers = extractEventHandlers(props, ['onBlur', 'onChange', 'onFocus']); | ||
var propsEventHandlers = extractEventHandlers(parameters, ['onBlur', 'onChange', 'onFocus']); | ||
@@ -168,3 +168,4 @@ var externalEventHandlers = _extends({}, propsEventHandlers, extractEventHandlers(externalProps)); | ||
var getInputProps = function getInputProps(externalProps) { | ||
var getInputProps = function getInputProps() { | ||
var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var propsEventHandlers = { | ||
@@ -171,0 +172,0 @@ onBlur: onBlur, |
@@ -38,3 +38,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
_props$disabled = props.disabled, | ||
disabled = _props$disabled === void 0 ? false : _props$disabled, | ||
disabledProp = _props$disabled === void 0 ? false : _props$disabled, | ||
component = props.component, | ||
@@ -51,3 +51,3 @@ _props$components = props.components, | ||
var _useMenuItem = useMenuItem({ | ||
disabled: disabled, | ||
disabled: disabledProp, | ||
ref: ref, | ||
@@ -57,10 +57,7 @@ label: label | ||
getRootProps = _useMenuItem.getRootProps, | ||
itemState = _useMenuItem.itemState, | ||
disabled = _useMenuItem.disabled, | ||
focusVisible = _useMenuItem.focusVisible; | ||
if (itemState == null) { | ||
return null; | ||
} | ||
var ownerState = _extends({}, props, itemState, { | ||
var ownerState = _extends({}, props, { | ||
disabled: disabled, | ||
focusVisible: focusVisible | ||
@@ -67,0 +64,0 @@ }); |
@@ -7,2 +7,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
export default function useMenuItem(props) { | ||
var _itemState$disabled; | ||
var _props$disabled = props.disabled, | ||
@@ -85,3 +87,3 @@ disabled = _props$disabled === void 0 ? false : _props$disabled, | ||
}, | ||
itemState: null, | ||
disabled: false, | ||
focusVisible: focusVisible | ||
@@ -100,5 +102,5 @@ }; | ||
}, | ||
itemState: itemState, | ||
disabled: (_itemState$disabled = itemState == null ? void 0 : itemState.disabled) != null ? _itemState$disabled : false, | ||
focusVisible: focusVisible | ||
}; | ||
} |
@@ -47,6 +47,8 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
componentsProps = _props$componentsProp === void 0 ? {} : _props$componentsProp, | ||
_props$keepMounted = props.keepMounted, | ||
keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted, | ||
onClose = props.onClose, | ||
_props$open = props.open, | ||
open = _props$open === void 0 ? false : _props$open, | ||
other = _objectWithoutProperties(props, ["actions", "anchorEl", "children", "className", "component", "components", "componentsProps", "onClose", "open"]); | ||
other = _objectWithoutProperties(props, ["actions", "anchorEl", "children", "className", "component", "components", "componentsProps", "keepMounted", "onClose", "open"]); | ||
@@ -83,3 +85,3 @@ var _useMenu = useMenu({ | ||
open: open, | ||
keepMounted: true, | ||
keepMounted: keepMounted, | ||
role: undefined | ||
@@ -165,2 +167,10 @@ }, componentsProps.root, { | ||
/** | ||
* Always keep the menu in the DOM. | ||
* This prop can be useful in SEO situation or when you want to maximize the responsiveness of the Menu. | ||
* | ||
* @default false | ||
*/ | ||
keepMounted: PropTypes.bool, | ||
/** | ||
* Triggered when focus leaves the menu and the menu should close. | ||
@@ -167,0 +177,0 @@ */ |
export { default } from './OptionGroupUnstyled'; | ||
export * from './OptionGroupUnstyledProps'; | ||
export * from './OptionGroupUnstyled.types'; | ||
export { default as optionGroupUnstyledClasses } from './optionGroupUnstyledClasses'; | ||
export * from './optionGroupUnstyledClasses'; |
export { default } from './OptionUnstyled'; | ||
export * from './OptionUnstyledProps'; | ||
export * from './OptionUnstyled.types'; | ||
export { default as optionUnstyledClasses } from './optionUnstyledClasses'; | ||
export * from './optionUnstyledClasses'; |
import { ListboxState, ListboxAction } from './useListbox.types'; | ||
export default function defaultListboxReducer<TOption>(state: Readonly<ListboxState<TOption>>, action: ListboxAction<TOption>): Readonly<ListboxState<TOption>>; |
export { default as useListbox } from './useListbox'; | ||
export { default as defaultListboxReducer } from './defaultListboxReducer'; | ||
export * from './useListbox.types'; |
import { ListboxAction, ListboxReducer, ListboxState, UseListboxStrictProps } from './useListbox.types'; | ||
export default function useControllableReducer<TOption>(internalReducer: ListboxReducer<TOption>, externalReducer: ListboxReducer<TOption> | undefined, props: UseListboxStrictProps<TOption>): [ListboxState<TOption>, (action: ListboxAction<TOption>) => void]; |
@@ -0,0 +0,0 @@ import { UseListboxParameters, OptionState, UseListboxOptionSlotProps, UseListboxRootSlotProps } from './useListbox.types'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export { default } from './MenuItemUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -41,3 +41,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
className, | ||
disabled = false, | ||
disabled: disabledProp = false, | ||
component, | ||
@@ -53,6 +53,6 @@ components = {}, | ||
getRootProps, | ||
itemState, | ||
disabled, | ||
focusVisible | ||
} = useMenuItem({ | ||
disabled, | ||
disabled: disabledProp, | ||
ref, | ||
@@ -62,7 +62,4 @@ label | ||
if (itemState == null) { | ||
return null; | ||
} | ||
const ownerState = _extends({}, props, itemState, { | ||
const ownerState = _extends({}, props, { | ||
disabled, | ||
focusVisible | ||
@@ -69,0 +66,0 @@ }); |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface MenuItemUnstyledClasses { |
@@ -19,3 +19,3 @@ import * as React from 'react'; | ||
}; | ||
itemState: null; | ||
disabled: boolean; | ||
focusVisible: boolean; | ||
@@ -39,4 +39,4 @@ } | { | ||
}; | ||
itemState: import("../MenuUnstyled").MenuItemState | undefined; | ||
disabled: boolean; | ||
focusVisible: boolean; | ||
}; |
@@ -7,2 +7,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
export default function useMenuItem(props) { | ||
var _itemState$disabled; | ||
const { | ||
@@ -79,3 +81,3 @@ disabled = false, | ||
}), | ||
itemState: null, | ||
disabled: false, | ||
focusVisible | ||
@@ -94,5 +96,5 @@ }; | ||
}, | ||
itemState, | ||
disabled: (_itemState$disabled = itemState == null ? void 0 : itemState.disabled) != null ? _itemState$disabled : false, | ||
focusVisible | ||
}; | ||
} |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ export { default } from './MenuUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
const _excluded = ["actions", "anchorEl", "children", "className", "component", "components", "componentsProps", "onClose", "open"]; | ||
const _excluded = ["actions", "anchorEl", "children", "className", "component", "components", "componentsProps", "keepMounted", "onClose", "open"]; | ||
import * as React from 'react'; | ||
@@ -49,2 +49,3 @@ import PropTypes from 'prop-types'; | ||
componentsProps = {}, | ||
keepMounted = false, | ||
onClose, | ||
@@ -83,3 +84,3 @@ open = false | ||
open, | ||
keepMounted: true, | ||
keepMounted, | ||
role: undefined | ||
@@ -165,2 +166,10 @@ }, componentsProps.root, { | ||
/** | ||
* Always keep the menu in the DOM. | ||
* This prop can be useful in SEO situation or when you want to maximize the responsiveness of the Menu. | ||
* | ||
* @default false | ||
*/ | ||
keepMounted: PropTypes.bool, | ||
/** | ||
* Triggered when focus leaves the menu and the menu should close. | ||
@@ -167,0 +176,0 @@ */ |
@@ -34,2 +34,9 @@ import React from 'react'; | ||
/** | ||
* Always keep the menu in the DOM. | ||
* This prop can be useful in SEO situation or when you want to maximize the responsiveness of the Menu. | ||
* | ||
* @default false | ||
*/ | ||
keepMounted?: boolean; | ||
/** | ||
* Triggered when focus leaves the menu and the menu should close. | ||
@@ -36,0 +43,0 @@ */ |
@@ -0,0 +0,0 @@ export interface MenuUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface ManagedModalProps { |
@@ -0,0 +0,0 @@ export interface ModalUnstyledClasses { |
// eslint-disable-next-line import/prefer-default-export | ||
export { unstable_ClassNameGenerator } from '@mui/private-classnames'; | ||
export { unstable_ClassNameGenerator } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { unstable_composeClasses as default } from '@mui/private-classnames'; | ||
export { unstable_composeClasses as default } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { generateUtilityClass as default } from '@mui/private-classnames'; | ||
export { unstable_generateUtilityClass as default } from '@mui/utils'; |
@@ -1,1 +0,1 @@ | ||
export { generateUtilityClasses as default } from '@mui/private-classnames'; | ||
export { unstable_generateUtilityClasses as default } from '@mui/utils'; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.80 | ||
/** @license MUI v5.0.0-alpha.81 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
export { default } from './InputUnstyled'; | ||
export * from './InputUnstyledProps'; | ||
export * from './InputUnstyled.types'; | ||
export { default as useInput } from './useInput'; | ||
export * from './useInput.types'; | ||
export { default as inputUnstyledClasses } from './inputUnstyledClasses'; | ||
export * from './inputUnstyledClasses'; |
@@ -8,6 +8,11 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import PropTypes from 'prop-types'; | ||
import { unstable_useForkRef as useForkRef } from '@mui/utils'; | ||
import appendOwnerState from '../utils/appendOwnerState'; | ||
import isHostComponent from '../utils/isHostComponent'; | ||
import resolveComponentProps from '../utils/resolveComponentProps'; | ||
import classes from './inputUnstyledClasses'; | ||
import useInput from './useInput'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
/** | ||
@@ -23,6 +28,3 @@ * | ||
*/ | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
const InputUnstyled = /*#__PURE__*/React.forwardRef(function InputUnstyled(props, ref) { | ||
const InputUnstyled = /*#__PURE__*/React.forwardRef(function InputUnstyled(props, forwardedRef) { | ||
const { | ||
@@ -80,3 +82,3 @@ 'aria-describedby': ariaDescribedby, | ||
value | ||
}, componentsProps.input?.ref); | ||
}); | ||
@@ -109,10 +111,13 @@ const ownerState = _extends({}, props, { | ||
const Root = component ?? components.Root ?? 'div'; | ||
const rootProps = appendOwnerState(Root, _extends({}, getRootProps(_extends({}, other, componentsProps.root)), { | ||
className: clsx(classes.root, rootStateClasses, className, componentsProps.root?.className) | ||
const rootComponentsProps = resolveComponentProps(componentsProps.root, ownerState); | ||
const rootProps = appendOwnerState(Root, _extends({}, getRootProps(_extends({}, other, rootComponentsProps)), { | ||
className: clsx(classes.root, rootStateClasses, className, rootComponentsProps?.className) | ||
}), ownerState); | ||
let Input = components.Input ?? 'input'; // TODO: type this properly | ||
let inputProps = appendOwnerState(Input, _extends({}, getInputProps(_extends({}, componentsProps.input, propsToForward)), { | ||
className: clsx(classes.input, inputStateClasses, componentsProps.input?.className) | ||
rootProps.ref = useForkRef(rootProps.ref, useForkRef(rootComponentsProps?.ref, forwardedRef)); | ||
let Input = components.Input ?? 'input'; | ||
const inputComponentsProps = resolveComponentProps(componentsProps.input, ownerState); | ||
let inputProps = appendOwnerState(Input, _extends({}, getInputProps(_extends({}, inputComponentsProps, propsToForward)), { | ||
className: clsx(classes.input, inputStateClasses, inputComponentsProps?.className) | ||
}), ownerState); | ||
inputProps.ref = useForkRef(inputProps.ref, inputComponentsProps?.ref); | ||
@@ -132,8 +137,8 @@ if (multiline) { | ||
inputProps = _extends({ | ||
type: undefined | ||
}, !hasHostTextarea && { | ||
inputProps = _extends({}, !hasHostTextarea && { | ||
minRows: rows || minRows, | ||
maxRows: rows || maxRows | ||
}, hasHostTextarea ? inputPropsWithoutOwnerState : inputProps); | ||
}, hasHostTextarea ? inputPropsWithoutOwnerState : inputProps, { | ||
type: undefined | ||
}); | ||
Input = components.Textarea ?? 'textarea'; | ||
@@ -143,3 +148,2 @@ } | ||
return /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, { | ||
ref: ref, | ||
children: [startAdornment, /*#__PURE__*/_jsx(Input, _extends({}, inputProps)), endAdornment] | ||
@@ -215,4 +219,4 @@ })); | ||
componentsProps: PropTypes.shape({ | ||
input: PropTypes.object, | ||
root: PropTypes.object | ||
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), | ||
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]) | ||
}), | ||
@@ -329,3 +333,5 @@ | ||
*/ | ||
type: PropTypes.string, | ||
type: PropTypes | ||
/* @typescript-to-proptypes-ignore */ | ||
.oneOf(['button', 'checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'hidden', 'image', 'month', 'number', 'password', 'radio', 'range', 'reset', 'search', 'submit', 'tel', 'text', 'time', 'url', 'week']), | ||
@@ -332,0 +338,0 @@ /** |
@@ -7,3 +7,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
export default function useInput(props, inputRef) { | ||
export default function useInput(parameters) { | ||
const { | ||
@@ -18,3 +18,3 @@ defaultValue: defaultValueProp, | ||
value: valueProp | ||
} = props; | ||
} = parameters; | ||
const formControlContext = useFormControlUnstyledContext(); | ||
@@ -35,3 +35,3 @@ let defaultValue; | ||
if (process.env.NODE_ENV !== 'production') { | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => props[prop] !== undefined); | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => parameters[prop] !== undefined); | ||
@@ -60,5 +60,4 @@ if (definedLocalProps.length > 0) { | ||
}, []); | ||
const internalInputRef = React.useRef(null); | ||
const handleIncomingRef = useForkRef(inputRef, handleInputRefWarning); | ||
const handleInputRef = useForkRef(internalInputRef, handleIncomingRef); | ||
const inputRef = React.useRef(null); | ||
const handleInputRef = useForkRef(inputRef, handleInputRefWarning); | ||
const [focused, setFocused] = React.useState(false); // The blur won't fire when the disabled state is set on a focused input. | ||
@@ -104,3 +103,3 @@ // We need to book keep the focused state manually. | ||
if (!isControlled) { | ||
const element = event.target || internalInputRef.current; | ||
const element = event.target || inputRef.current; | ||
@@ -118,4 +117,4 @@ if (element == null) { | ||
const handleClick = otherHandlers => event => { | ||
if (internalInputRef.current && event.currentTarget === event.target) { | ||
internalInputRef.current.focus(); | ||
if (inputRef.current && event.currentTarget === event.target) { | ||
inputRef.current.focus(); | ||
} | ||
@@ -126,5 +125,5 @@ | ||
const getRootProps = externalProps => { | ||
const getRootProps = (externalProps = {}) => { | ||
// onBlur, onChange and onFocus are forwarded to the input slot. | ||
const propsEventHandlers = extractEventHandlers(props, ['onBlur', 'onChange', 'onFocus']); | ||
const propsEventHandlers = extractEventHandlers(parameters, ['onBlur', 'onChange', 'onFocus']); | ||
@@ -138,3 +137,3 @@ const externalEventHandlers = _extends({}, propsEventHandlers, extractEventHandlers(externalProps)); | ||
const getInputProps = externalProps => { | ||
const getInputProps = (externalProps = {}) => { | ||
const propsEventHandlers = { | ||
@@ -141,0 +140,0 @@ onBlur, |
@@ -39,3 +39,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
className, | ||
disabled = false, | ||
disabled: disabledProp = false, | ||
component, | ||
@@ -51,6 +51,6 @@ components = {}, | ||
getRootProps, | ||
itemState, | ||
disabled, | ||
focusVisible | ||
} = useMenuItem({ | ||
disabled, | ||
disabled: disabledProp, | ||
ref, | ||
@@ -60,7 +60,4 @@ label | ||
if (itemState == null) { | ||
return null; | ||
} | ||
const ownerState = _extends({}, props, itemState, { | ||
const ownerState = _extends({}, props, { | ||
disabled, | ||
focusVisible | ||
@@ -67,0 +64,0 @@ }); |
@@ -78,3 +78,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
}), | ||
itemState: null, | ||
disabled: false, | ||
focusVisible | ||
@@ -93,5 +93,5 @@ }; | ||
}, | ||
itemState, | ||
disabled: itemState?.disabled ?? false, | ||
focusVisible | ||
}; | ||
} |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
const _excluded = ["actions", "anchorEl", "children", "className", "component", "components", "componentsProps", "onClose", "open"]; | ||
const _excluded = ["actions", "anchorEl", "children", "className", "component", "components", "componentsProps", "keepMounted", "onClose", "open"]; | ||
import * as React from 'react'; | ||
@@ -47,2 +47,3 @@ import PropTypes from 'prop-types'; | ||
componentsProps = {}, | ||
keepMounted = false, | ||
onClose, | ||
@@ -81,3 +82,3 @@ open = false | ||
open, | ||
keepMounted: true, | ||
keepMounted, | ||
role: undefined | ||
@@ -163,2 +164,10 @@ }, componentsProps.root, { | ||
/** | ||
* Always keep the menu in the DOM. | ||
* This prop can be useful in SEO situation or when you want to maximize the responsiveness of the Menu. | ||
* | ||
* @default false | ||
*/ | ||
keepMounted: PropTypes.bool, | ||
/** | ||
* Triggered when focus leaves the menu and the menu should close. | ||
@@ -165,0 +174,0 @@ */ |
export { default } from './OptionGroupUnstyled'; | ||
export * from './OptionGroupUnstyledProps'; | ||
export * from './OptionGroupUnstyled.types'; | ||
export { default as optionGroupUnstyledClasses } from './optionGroupUnstyledClasses'; | ||
export * from './optionGroupUnstyledClasses'; |
export { default } from './OptionUnstyled'; | ||
export * from './OptionUnstyledProps'; | ||
export * from './OptionUnstyled.types'; | ||
export { default as optionUnstyledClasses } from './optionUnstyledClasses'; | ||
export * from './optionUnstyledClasses'; |
export { default } from './MultiSelectUnstyled'; | ||
export * from './MultiSelectUnstyled.types'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -9,6 +9,6 @@ "use strict"; | ||
get: function () { | ||
return _privateClassnames.unstable_ClassNameGenerator; | ||
return _utils.unstable_ClassNameGenerator; | ||
} | ||
}); | ||
var _privateClassnames = require("@mui/private-classnames"); | ||
var _utils = require("@mui/utils"); |
@@ -9,6 +9,6 @@ "use strict"; | ||
get: function () { | ||
return _privateClassnames.unstable_composeClasses; | ||
return _utils.unstable_composeClasses; | ||
} | ||
}); | ||
var _privateClassnames = require("@mui/private-classnames"); | ||
var _utils = require("@mui/utils"); |
@@ -9,6 +9,6 @@ "use strict"; | ||
get: function () { | ||
return _privateClassnames.generateUtilityClass; | ||
return _utils.unstable_generateUtilityClass; | ||
} | ||
}); | ||
var _privateClassnames = require("@mui/private-classnames"); | ||
var _utils = require("@mui/utils"); |
@@ -9,6 +9,6 @@ "use strict"; | ||
get: function () { | ||
return _privateClassnames.generateUtilityClasses; | ||
return _utils.unstable_generateUtilityClasses; | ||
} | ||
}); | ||
var _privateClassnames = require("@mui/private-classnames"); | ||
var _utils = require("@mui/utils"); |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.80 | ||
/** @license MUI v5.0.0-alpha.81 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -33,12 +33,12 @@ "use strict"; | ||
var _InputUnstyledProps = require("./InputUnstyledProps"); | ||
var _InputUnstyled2 = require("./InputUnstyled.types"); | ||
Object.keys(_InputUnstyledProps).forEach(function (key) { | ||
Object.keys(_InputUnstyled2).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _InputUnstyledProps[key]) return; | ||
if (key in exports && exports[key] === _InputUnstyled2[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _InputUnstyledProps[key]; | ||
return _InputUnstyled2[key]; | ||
} | ||
@@ -50,2 +50,16 @@ }); | ||
var _useInput2 = require("./useInput.types"); | ||
Object.keys(_useInput2).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _useInput2[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _useInput2[key]; | ||
} | ||
}); | ||
}); | ||
var _inputUnstyledClasses = _interopRequireWildcard(require("./inputUnstyledClasses")); | ||
@@ -52,0 +66,0 @@ |
@@ -20,2 +20,4 @@ "use strict"; | ||
var _utils = require("@mui/utils"); | ||
var _appendOwnerState = _interopRequireDefault(require("../utils/appendOwnerState")); | ||
@@ -25,2 +27,4 @@ | ||
var _resolveComponentProps = _interopRequireDefault(require("../utils/resolveComponentProps")); | ||
var _inputUnstyledClasses = _interopRequireDefault(require("./inputUnstyledClasses")); | ||
@@ -49,4 +53,4 @@ | ||
*/ | ||
const InputUnstyled = /*#__PURE__*/React.forwardRef(function InputUnstyled(props, ref) { | ||
var _componentsProps$inpu, _ref, _componentsProps$root, _components$Input, _componentsProps$inpu2; | ||
const InputUnstyled = /*#__PURE__*/React.forwardRef(function InputUnstyled(props, forwardedRef) { | ||
var _ref, _components$Input; | ||
@@ -104,3 +108,3 @@ const { | ||
value | ||
}, (_componentsProps$inpu = componentsProps.input) == null ? void 0 : _componentsProps$inpu.ref); | ||
}); | ||
const ownerState = (0, _extends2.default)({}, props, { | ||
@@ -131,10 +135,13 @@ disabled: disabledState, | ||
const Root = (_ref = component != null ? component : components.Root) != null ? _ref : 'div'; | ||
const rootProps = (0, _appendOwnerState.default)(Root, (0, _extends2.default)({}, getRootProps((0, _extends2.default)({}, other, componentsProps.root)), { | ||
className: (0, _clsx.default)(_inputUnstyledClasses.default.root, rootStateClasses, className, (_componentsProps$root = componentsProps.root) == null ? void 0 : _componentsProps$root.className) | ||
const rootComponentsProps = (0, _resolveComponentProps.default)(componentsProps.root, ownerState); | ||
const rootProps = (0, _appendOwnerState.default)(Root, (0, _extends2.default)({}, getRootProps((0, _extends2.default)({}, other, rootComponentsProps)), { | ||
className: (0, _clsx.default)(_inputUnstyledClasses.default.root, rootStateClasses, className, rootComponentsProps == null ? void 0 : rootComponentsProps.className) | ||
}), ownerState); | ||
let Input = (_components$Input = components.Input) != null ? _components$Input : 'input'; // TODO: type this properly | ||
let inputProps = (0, _appendOwnerState.default)(Input, (0, _extends2.default)({}, getInputProps((0, _extends2.default)({}, componentsProps.input, propsToForward)), { | ||
className: (0, _clsx.default)(_inputUnstyledClasses.default.input, inputStateClasses, (_componentsProps$inpu2 = componentsProps.input) == null ? void 0 : _componentsProps$inpu2.className) | ||
rootProps.ref = (0, _utils.unstable_useForkRef)(rootProps.ref, (0, _utils.unstable_useForkRef)(rootComponentsProps == null ? void 0 : rootComponentsProps.ref, forwardedRef)); | ||
let Input = (_components$Input = components.Input) != null ? _components$Input : 'input'; | ||
const inputComponentsProps = (0, _resolveComponentProps.default)(componentsProps.input, ownerState); | ||
let inputProps = (0, _appendOwnerState.default)(Input, (0, _extends2.default)({}, getInputProps((0, _extends2.default)({}, inputComponentsProps, propsToForward)), { | ||
className: (0, _clsx.default)(_inputUnstyledClasses.default.input, inputStateClasses, inputComponentsProps == null ? void 0 : inputComponentsProps.className) | ||
}), ownerState); | ||
inputProps.ref = (0, _utils.unstable_useForkRef)(inputProps.ref, inputComponentsProps == null ? void 0 : inputComponentsProps.ref); | ||
@@ -155,8 +162,8 @@ if (multiline) { | ||
inputProps = (0, _extends2.default)({ | ||
type: undefined | ||
}, !hasHostTextarea && { | ||
inputProps = (0, _extends2.default)({}, !hasHostTextarea && { | ||
minRows: rows || minRows, | ||
maxRows: rows || maxRows | ||
}, hasHostTextarea ? inputPropsWithoutOwnerState : inputProps); | ||
}, hasHostTextarea ? inputPropsWithoutOwnerState : inputProps, { | ||
type: undefined | ||
}); | ||
Input = (_components$Textarea2 = components.Textarea) != null ? _components$Textarea2 : 'textarea'; | ||
@@ -166,3 +173,2 @@ } | ||
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, (0, _extends2.default)({}, rootProps, { | ||
ref: ref, | ||
children: [startAdornment, /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, (0, _extends2.default)({}, inputProps)), endAdornment] | ||
@@ -238,4 +244,4 @@ })); | ||
componentsProps: _propTypes.default.shape({ | ||
input: _propTypes.default.object, | ||
root: _propTypes.default.object | ||
input: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]), | ||
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]) | ||
}), | ||
@@ -352,3 +358,5 @@ | ||
*/ | ||
type: _propTypes.default.string, | ||
type: _propTypes.default | ||
/* @typescript-to-proptypes-ignore */ | ||
.oneOf(['button', 'checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'hidden', 'image', 'month', 'number', 'password', 'radio', 'range', 'reset', 'search', 'submit', 'tel', 'text', 'time', 'url', 'week']), | ||
@@ -355,0 +363,0 @@ /** |
@@ -24,3 +24,3 @@ "use strict"; | ||
function useInput(props, inputRef) { | ||
function useInput(parameters) { | ||
const { | ||
@@ -35,3 +35,3 @@ defaultValue: defaultValueProp, | ||
value: valueProp | ||
} = props; | ||
} = parameters; | ||
const formControlContext = (0, _FormControlUnstyled.useFormControlUnstyledContext)(); | ||
@@ -54,3 +54,3 @@ let defaultValue; | ||
if (process.env.NODE_ENV !== 'production') { | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => props[prop] !== undefined); | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => parameters[prop] !== undefined); | ||
@@ -79,5 +79,4 @@ if (definedLocalProps.length > 0) { | ||
}, []); | ||
const internalInputRef = React.useRef(null); | ||
const handleIncomingRef = (0, _utils.unstable_useForkRef)(inputRef, handleInputRefWarning); | ||
const handleInputRef = (0, _utils.unstable_useForkRef)(internalInputRef, handleIncomingRef); | ||
const inputRef = React.useRef(null); | ||
const handleInputRef = (0, _utils.unstable_useForkRef)(inputRef, handleInputRefWarning); | ||
const [focused, setFocused] = React.useState(false); // The blur won't fire when the disabled state is set on a focused input. | ||
@@ -131,3 +130,3 @@ // We need to book keep the focused state manually. | ||
if (!isControlled) { | ||
const element = event.target || internalInputRef.current; | ||
const element = event.target || inputRef.current; | ||
@@ -147,4 +146,4 @@ if (element == null) { | ||
if (internalInputRef.current && event.currentTarget === event.target) { | ||
internalInputRef.current.focus(); | ||
if (inputRef.current && event.currentTarget === event.target) { | ||
inputRef.current.focus(); | ||
} | ||
@@ -155,5 +154,5 @@ | ||
const getRootProps = externalProps => { | ||
const getRootProps = (externalProps = {}) => { | ||
// onBlur, onChange and onFocus are forwarded to the input slot. | ||
const propsEventHandlers = (0, _extractEventHandlers.default)(props, ['onBlur', 'onChange', 'onFocus']); | ||
const propsEventHandlers = (0, _extractEventHandlers.default)(parameters, ['onBlur', 'onChange', 'onFocus']); | ||
const externalEventHandlers = (0, _extends2.default)({}, propsEventHandlers, (0, _extractEventHandlers.default)(externalProps)); | ||
@@ -165,3 +164,3 @@ return (0, _extends2.default)({}, externalProps, externalEventHandlers, { | ||
const getInputProps = externalProps => { | ||
const getInputProps = (externalProps = {}) => { | ||
const propsEventHandlers = { | ||
@@ -168,0 +167,0 @@ onBlur, |
@@ -64,3 +64,3 @@ "use strict"; | ||
className, | ||
disabled = false, | ||
disabled: disabledProp = false, | ||
component, | ||
@@ -75,15 +75,11 @@ components = {}, | ||
getRootProps, | ||
itemState, | ||
disabled, | ||
focusVisible | ||
} = (0, _useMenuItem.default)({ | ||
disabled, | ||
disabled: disabledProp, | ||
ref, | ||
label | ||
}); | ||
if (itemState == null) { | ||
return null; | ||
} | ||
const ownerState = (0, _extends2.default)({}, props, itemState, { | ||
const ownerState = (0, _extends2.default)({}, props, { | ||
disabled, | ||
focusVisible | ||
@@ -90,0 +86,0 @@ }); |
@@ -25,2 +25,4 @@ "use strict"; | ||
function useMenuItem(props) { | ||
var _itemState$disabled; | ||
const { | ||
@@ -97,3 +99,3 @@ disabled = false, | ||
}), | ||
itemState: null, | ||
disabled: false, | ||
focusVisible | ||
@@ -112,5 +114,5 @@ }; | ||
}, | ||
itemState, | ||
disabled: (_itemState$disabled = itemState == null ? void 0 : itemState.disabled) != null ? _itemState$disabled : false, | ||
focusVisible | ||
}; | ||
} |
@@ -36,3 +36,3 @@ "use strict"; | ||
const _excluded = ["actions", "anchorEl", "children", "className", "component", "components", "componentsProps", "onClose", "open"]; | ||
const _excluded = ["actions", "anchorEl", "children", "className", "component", "components", "componentsProps", "keepMounted", "onClose", "open"]; | ||
@@ -76,2 +76,3 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
componentsProps = {}, | ||
keepMounted = false, | ||
onClose, | ||
@@ -107,3 +108,3 @@ open = false | ||
open, | ||
keepMounted: true, | ||
keepMounted, | ||
role: undefined | ||
@@ -189,2 +190,10 @@ }, componentsProps.root, { | ||
/** | ||
* Always keep the menu in the DOM. | ||
* This prop can be useful in SEO situation or when you want to maximize the responsiveness of the Menu. | ||
* | ||
* @default false | ||
*/ | ||
keepMounted: _propTypes.default.bool, | ||
/** | ||
* Triggered when focus leaves the menu and the menu should close. | ||
@@ -191,0 +200,0 @@ */ |
@@ -26,12 +26,12 @@ "use strict"; | ||
var _OptionGroupUnstyledProps = require("./OptionGroupUnstyledProps"); | ||
var _OptionGroupUnstyled2 = require("./OptionGroupUnstyled.types"); | ||
Object.keys(_OptionGroupUnstyledProps).forEach(function (key) { | ||
Object.keys(_OptionGroupUnstyled2).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _OptionGroupUnstyledProps[key]) return; | ||
if (key in exports && exports[key] === _OptionGroupUnstyled2[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _OptionGroupUnstyledProps[key]; | ||
return _OptionGroupUnstyled2[key]; | ||
} | ||
@@ -38,0 +38,0 @@ }); |
@@ -26,12 +26,12 @@ "use strict"; | ||
var _OptionUnstyledProps = require("./OptionUnstyledProps"); | ||
var _OptionUnstyled2 = require("./OptionUnstyled.types"); | ||
Object.keys(_OptionUnstyledProps).forEach(function (key) { | ||
Object.keys(_OptionUnstyled2).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _OptionUnstyledProps[key]) return; | ||
if (key in exports && exports[key] === _OptionUnstyled2[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _OptionUnstyledProps[key]; | ||
return _OptionUnstyled2[key]; | ||
} | ||
@@ -38,0 +38,0 @@ }); |
export { default } from './OptionGroupUnstyled'; | ||
export type { default as OptionGroupUnstyledProps } from './OptionGroupUnstyledProps'; | ||
export * from './OptionGroupUnstyledProps'; | ||
export * from './OptionGroupUnstyled.types'; | ||
export { default as optionGroupUnstyledClasses } from './optionGroupUnstyledClasses'; | ||
export * from './optionGroupUnstyledClasses'; |
export { default } from './OptionGroupUnstyled'; | ||
export * from './OptionGroupUnstyledProps'; | ||
export * from './OptionGroupUnstyled.types'; | ||
export { default as optionGroupUnstyledClasses } from './optionGroupUnstyledClasses'; | ||
export * from './optionGroupUnstyledClasses'; |
import React from 'react'; | ||
import OptionGroupUnstyledProps from './OptionGroupUnstyledProps'; | ||
import { OptionGroupUnstyledProps } from './OptionGroupUnstyled.types'; | ||
/** | ||
@@ -4,0 +4,0 @@ * An unstyled option group to be used within a SelectUnstyled. |
@@ -0,0 +0,0 @@ export interface OptionGroupUnstyledClasses { |
export { default } from './OptionUnstyled'; | ||
export type { default as OptionUnstyledProps } from './OptionUnstyledProps'; | ||
export * from './OptionUnstyledProps'; | ||
export * from './OptionUnstyled.types'; | ||
export { default as optionUnstyledClasses } from './optionUnstyledClasses'; | ||
export * from './optionUnstyledClasses'; |
export { default } from './OptionUnstyled'; | ||
export * from './OptionUnstyledProps'; | ||
export * from './OptionUnstyled.types'; | ||
export { default as optionUnstyledClasses } from './optionUnstyledClasses'; | ||
export * from './optionUnstyledClasses'; |
import React from 'react'; | ||
import OptionUnstyledProps from './OptionUnstyledProps'; | ||
import { OptionUnstyledProps } from './OptionUnstyled.types'; | ||
declare const _default: <TValue>(props: OptionUnstyledProps<TValue> & React.RefAttributes<HTMLElement>) => JSX.Element | null; | ||
@@ -4,0 +4,0 @@ /** |
@@ -0,0 +0,0 @@ export interface OptionUnstyledClasses { |
{ | ||
"name": "@mui/base", | ||
"version": "5.0.0-alpha.80", | ||
"version": "5.0.0-alpha.81", | ||
"private": false, | ||
@@ -42,5 +42,4 @@ "author": "MUI Team", | ||
"@emotion/is-prop-valid": "^1.1.2", | ||
"@mui/private-classnames": "^5.7.0", | ||
"@mui/types": "^7.1.3", | ||
"@mui/utils": "^5.7.0", | ||
"@mui/utils": "^5.8.0", | ||
"@popperjs/core": "^2.11.5", | ||
@@ -47,0 +46,0 @@ "clsx": "^1.1.1", |
@@ -0,0 +0,0 @@ export { default } from './SelectUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface SelectUnstyledClasses { |
import * as React from 'react'; | ||
import { OptionState } from '../ListboxUnstyled'; | ||
import { SelectOption } from './useSelect.types'; | ||
import { SelectOption, UseSelectOptionSlotProps } from './useSelect.types'; | ||
export interface SelectUnstyledContextType { | ||
getOptionState: (value: SelectOption<any>) => OptionState; | ||
getOptionProps: (option: SelectOption<any>) => Record<string, any>; | ||
getOptionProps: (option: SelectOption<any>) => UseSelectOptionSlotProps; | ||
listboxRef: React.RefObject<HTMLElement>; | ||
} | ||
export declare const SelectUnstyledContext: React.Context<SelectUnstyledContextType | undefined>; |
@@ -0,0 +0,0 @@ import { UseSelectMultiParameters, UseSelectMultiResult, UseSelectSingleParameters, UseSelectSingleResult } from './useSelect.types'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface SliderUnstyledClasses { |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ export { default } from './SwitchUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface SwitchUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export { default } from './TablePaginationUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface TablePaginationUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export { default } from './TabPanelUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface TabPanelUnstyledClasses { |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface UseTabPanelProps { |
@@ -0,0 +0,0 @@ export { default } from './TabsListUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface TabsListUnstyledClasses { |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export { default } from './TabsUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface TabsUnstyledClasses { |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export { default } from './TabUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface TabUnstyledClasses { |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
declare type ItemComparer<T> = (a: T, b: T) => boolean; | ||
export default function areArraysEqual<T>(array1: T[], array2: T[], itemComparer?: ItemComparer<T>): boolean; | ||
export {}; |
@@ -0,0 +0,0 @@ import { EventHandlers } from './types'; |
@@ -0,0 +0,0 @@ export { default as appendOwnerState } from './appendOwnerState'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -6,1 +6,2 @@ /// <reference types="react" /> | ||
}> = Omit<T, 'ownerState'> & Partial<Pick<T, 'ownerState'>>; | ||
export declare type SlotComponentProps<TSlotComponent extends React.ElementType, TOverrides, TOwnerState> = (React.ComponentPropsWithRef<TSlotComponent> & TOverrides) | ((ownerState: TOwnerState) => React.ComponentPropsWithRef<TSlotComponent> & TOverrides); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2074048
11
670
41086
- Removed@mui/private-classnames@^5.7.0
- Removed@mui/private-classnames@5.7.0(transitive)
Updated@mui/utils@^5.8.0