@mui/base
Advanced tools
Comparing version 5.0.0-alpha.76 to 5.0.0-alpha.77
@@ -139,2 +139,4 @@ import * as React from 'react'; | ||
* | ||
* If used in free solo mode, it must accept both the type of the options and a string. | ||
* | ||
* @param {T} option | ||
@@ -144,3 +146,3 @@ * @returns {string} | ||
*/ | ||
getOptionLabel?: (option: T) => string; | ||
getOptionLabel?: (option: T | AutocompleteFreeSoloValueMapping<FreeSolo>) => string; | ||
/** | ||
@@ -147,0 +149,0 @@ * Used to determine if the option represents the given value. |
@@ -10,3 +10,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import useBadge from './useBadge'; | ||
import { getBadgeUtilityClass } from './badgeUnstyledClasses'; | ||
import { getBadgeUnstyledUtilityClass } from './badgeUnstyledClasses'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
@@ -23,3 +23,3 @@ import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
}; | ||
return composeClasses(slots, getBadgeUtilityClass, undefined); | ||
return composeClasses(slots, getBadgeUnstyledUtilityClass, undefined); | ||
}; | ||
@@ -26,0 +26,0 @@ |
@@ -10,4 +10,4 @@ export interface BadgeUnstyledClasses { | ||
export declare type BadgeUnstyledClassKey = keyof BadgeUnstyledClasses; | ||
export declare function getBadgeUtilityClass(slot: string): string; | ||
export declare function getBadgeUnstyledUtilityClass(slot: string): string; | ||
declare const badgeUnstyledClasses: BadgeUnstyledClasses; | ||
export default badgeUnstyledClasses; |
import generateUtilityClasses from '../generateUtilityClasses'; | ||
import generateUtilityClass from '../generateUtilityClass'; | ||
export function getBadgeUtilityClass(slot) { | ||
export function getBadgeUnstyledUtilityClass(slot) { | ||
return generateUtilityClass('BaseBadge', slot); | ||
@@ -5,0 +5,0 @@ } |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
export { default } from './BadgeUnstyled'; | ||
export { default as useBadge } from './useBadge'; | ||
export { default as badgeUnstyledClasses, getBadgeUtilityClass } from './badgeUnstyledClasses'; | ||
export { default as badgeUnstyledClasses, getBadgeUnstyledUtilityClass } from './badgeUnstyledClasses'; |
@@ -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'; |
@@ -0,0 +0,0 @@ declare const ClassNameGenerator: { |
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator'; |
@@ -36,3 +36,3 @@ import * as React from 'react'; | ||
* | ||
* - [Click Away Listener](https://mui.com/base/react-click-away-listener/) | ||
* - [Click away listener](https://mui.com/base/react-click-away-listener/) | ||
* | ||
@@ -39,0 +39,0 @@ * API: |
@@ -21,3 +21,3 @@ import * as React from 'react'; | ||
* | ||
* - [Click Away Listener](https://mui.com/base/react-click-away-listener/) | ||
* - [Click away listener](https://mui.com/base/react-click-away-listener/) | ||
* | ||
@@ -24,0 +24,0 @@ * API: |
export { default } from './ClickAwayListener'; | ||
export * from './ClickAwayListener'; |
export default function composeClasses<ClassKey extends string>(slots: Record<ClassKey, ReadonlyArray<string | false | undefined | null>>, getUtilityClass: (slot: string) => string, classes: Record<string, string> | undefined): Record<ClassKey, string>; |
export { default } from './composeClasses'; |
import { OverridableComponent } from '@mui/types'; | ||
import FormControlUnstyledProps, { FormControlUnstyledOwnProps, FormControlUnstyledTypeMap } from './FormControlUnstyledProps'; | ||
declare type NonOptionalOwnerState = 'disabled' | 'error' | 'focused' | 'required'; | ||
export declare type FormControlUnstyledOwnerState = Omit<FormControlUnstyledOwnProps, NonOptionalOwnerState> & Required<Pick<FormControlUnstyledProps, NonOptionalOwnerState>> & { | ||
filled: boolean; | ||
}; | ||
import { FormControlUnstyledTypeMap } from './FormControlUnstyled.types'; | ||
/** | ||
@@ -33,3 +29,3 @@ * Provides context such as filled/focused/error/required for form inputs. | ||
* | ||
* - [Form Control](https://mui.com/base/react-form-control/) | ||
* - [Form control](https://mui.com/base/react-form-control/) | ||
* | ||
@@ -36,0 +32,0 @@ * API: |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
const _excluded = ["defaultValue", "children", "className", "component", "components", "componentsProps", "disabled", "error", "focused", "onChange", "required", "value"]; | ||
const _excluded = ["defaultValue", "children", "className", "component", "components", "componentsProps", "disabled", "error", "onChange", "required", "value"]; | ||
import * as React from 'react'; | ||
@@ -8,3 +8,3 @@ import PropTypes from 'prop-types'; | ||
import { unstable_useControlled as useControlled } from '@mui/utils'; | ||
import FormControlUnstyledContext from './FormControlContext'; | ||
import FormControlUnstyledContext from './FormControlUnstyledContext'; | ||
import appendOwnerState from '../utils/appendOwnerState'; | ||
@@ -17,3 +17,2 @@ import classes from './formControlUnstyledClasses'; | ||
} | ||
/** | ||
@@ -45,3 +44,3 @@ * Provides context such as filled/focused/error/required for form inputs. | ||
* | ||
* - [Form Control](https://mui.com/base/react-form-control/) | ||
* - [Form control](https://mui.com/base/react-form-control/) | ||
* | ||
@@ -52,2 +51,4 @@ * API: | ||
*/ | ||
const FormControlUnstyled = /*#__PURE__*/React.forwardRef(function FormControlUnstyled(props, ref) { | ||
@@ -65,3 +66,2 @@ var _ref; | ||
error = false, | ||
focused: visuallyFocused, | ||
onChange, | ||
@@ -80,10 +80,8 @@ required = false, | ||
const filled = hasValue(value); | ||
const [focusedState, setFocused] = React.useState(false); | ||
const [focused, setFocused] = React.useState(false); | ||
if (disabled && focusedState) { | ||
if (disabled && focused) { | ||
setFocused(false); | ||
} | ||
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState; | ||
const ownerState = _extends({}, props, { | ||
@@ -97,20 +95,2 @@ disabled, | ||
let registerEffect = () => {}; | ||
if (process.env.NODE_ENV !== 'production') { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const registeredInput = React.useRef(false); | ||
registerEffect = () => { | ||
if (registeredInput.current) { | ||
console.error(['MUI: There are multiple `Input` components inside a FormControl.', 'This creates visual inconsistencies, only use one `Input`.'].join('\n')); | ||
} | ||
registeredInput.current = true; | ||
return () => { | ||
registeredInput.current = false; | ||
}; | ||
}; | ||
} | ||
const handleChange = event => { | ||
@@ -133,3 +113,2 @@ setValue(event.target.value); | ||
}, | ||
registerEffect, | ||
required, | ||
@@ -140,2 +119,11 @@ value: value != null ? value : '' | ||
const rootProps = appendOwnerState(Root, _extends({}, other, componentsProps.root), ownerState); | ||
const renderChildren = () => { | ||
if (typeof children === 'function') { | ||
return children(childContext); | ||
} | ||
return children; | ||
}; | ||
return /*#__PURE__*/_jsx(FormControlUnstyledContext.Provider, { | ||
@@ -146,4 +134,4 @@ value: childContext, | ||
}, rootProps, { | ||
className: clsx(classes.root, className, rootProps == null ? void 0 : rootProps.className, disabled && classes.disabled), | ||
children: children | ||
className: clsx(classes.root, className, rootProps == null ? void 0 : rootProps.className, disabled && classes.disabled, error && classes.error, filled && classes.filled, focused && classes.focused, required && classes.required), | ||
children: renderChildren() | ||
})) | ||
@@ -163,3 +151,5 @@ }); | ||
*/ | ||
children: PropTypes.node, | ||
children: PropTypes | ||
/* @typescript-to-proptypes-ignore */ | ||
.oneOfType([PropTypes.node, PropTypes.func]), | ||
@@ -211,8 +201,2 @@ /** | ||
/** | ||
* If `true`, the component is displayed in focused state. | ||
* @default false | ||
*/ | ||
focused: PropTypes.bool, | ||
/** | ||
* @ignore | ||
@@ -219,0 +203,0 @@ */ |
@@ -6,2 +6,10 @@ export interface FormControlUnstyledClasses { | ||
disabled: string; | ||
/** Class applied to the root element if `error={true}`. */ | ||
error: string; | ||
/** Class applied to the root element if the inner input has value. */ | ||
filled: string; | ||
/** Class applied to the root element if the inner input is focused. */ | ||
focused: string; | ||
/** Class applied to the root element if `required={true}`. */ | ||
required: string; | ||
} | ||
@@ -8,0 +16,0 @@ export declare type FormControlUnstyledClassKey = keyof FormControlUnstyledClasses; |
import generateUtilityClass from '../generateUtilityClass'; | ||
import generateUtilityClasses from '../generateUtilityClasses'; | ||
export function getFormControlUnstyledUtilityClasses(slot) { | ||
return generateUtilityClass('MuiFormControl', slot); | ||
return generateUtilityClass('BaseFormControl', slot); | ||
} | ||
const formControlUnstyledClasses = generateUtilityClasses('MuiFormControl', ['root', 'disabled']); | ||
const formControlUnstyledClasses = generateUtilityClasses('BaseFormControl', ['root', 'disabled', 'error', 'filled', 'focused', 'required']); | ||
export default formControlUnstyledClasses; |
export { default } from './FormControlUnstyled'; | ||
export { default as FormControlUnstyledContext } from './FormControlContext'; | ||
export * from './FormControlContext'; | ||
export type { default as FormControlUnstyledProps } from './FormControlUnstyledProps'; | ||
export { default as FormControlUnstyledContext } from './FormControlUnstyledContext'; | ||
export type { FormControlUnstyledProps, FormControlUnstyledComponentsPropsOverrides, FormControlUnstyledState, } from './FormControlUnstyled.types'; | ||
export { default as formControlUnstyledClasses } from './formControlUnstyledClasses'; | ||
export * from './formControlUnstyledClasses'; | ||
export { default as useFormControlUnstyled } from './useFormControl'; | ||
export { default as useFormControlUnstyledContext } from './useFormControlUnstyledContext'; |
export { default } from './FormControlUnstyled'; | ||
export { default as FormControlUnstyledContext } from './FormControlContext'; | ||
export * from './FormControlContext'; | ||
export { default as FormControlUnstyledContext } from './FormControlUnstyledContext'; | ||
export { default as formControlUnstyledClasses } from './formControlUnstyledClasses'; | ||
export * from './formControlUnstyledClasses'; | ||
export { default as useFormControlUnstyled } from './useFormControl'; | ||
export { default as useFormControlUnstyledContext } from './useFormControlUnstyledContext'; |
export declare type GlobalStateSlot = 'active' | 'checked' | 'completed' | 'disabled' | 'error' | 'expanded' | 'focused' | 'focusVisible' | 'required' | 'selected'; | ||
export default function generateUtilityClass(componentName: string, slot: string): string; |
export { default } from './generateUtilityClass'; | ||
export * from './generateUtilityClass'; |
export default function generateUtilityClasses<T extends string>(componentName: string, slots: T[]): Record<T, string>; |
export { default } from './generateUtilityClasses'; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.76 | ||
/** @license MUI v5.0.0-alpha.77 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -0,0 +0,0 @@ export { default } from './InputUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface InputUnstyledClasses { |
import React from 'react'; | ||
import { OverrideProps } from '@mui/types'; | ||
import { FormControlUnstyledState } from '../FormControlUnstyled/FormControlContext'; | ||
import { FormControlUnstyledState } from '../FormControlUnstyled'; | ||
export interface InputOwnerState extends Omit<InputUnstyledProps, 'component' | 'components' | 'componentsProps'> { | ||
@@ -5,0 +5,0 @@ formControl: FormControlUnstyledState; |
@@ -7,3 +7,13 @@ import * as React from 'react'; | ||
focused: boolean; | ||
formControlContext: import("..").FormControlUnstyledState | undefined; | ||
formControlContext: { | ||
disabled?: boolean | undefined; | ||
required?: boolean | undefined; | ||
value?: unknown; | ||
onChange?: React.ChangeEventHandler<import("../FormControlUnstyled/FormControlUnstyled.types").NativeFormControlElement> | undefined; | ||
error?: boolean | undefined; | ||
filled: boolean; | ||
focused: boolean; | ||
onBlur: () => void; | ||
onFocus: () => void; | ||
} | undefined; | ||
getInputProps: (externalProps?: Record<string, unknown> | undefined) => { | ||
@@ -10,0 +20,0 @@ 'aria-invalid': true | undefined; |
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import { unstable_useForkRef as useForkRef } from '@mui/utils'; | ||
import useFormControl from '../FormControlUnstyled/useFormControl'; | ||
import { useFormControlUnstyledContext } from '../FormControlUnstyled'; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
export default function useInput(props, inputRef) { | ||
const { | ||
defaultValue, | ||
defaultValue: defaultValueProp, | ||
disabled: disabledProp = false, | ||
@@ -19,20 +19,31 @@ error: errorProp = false, | ||
} = props; | ||
const formControlContext = useFormControl(); | ||
let value; | ||
let required; | ||
const formControlContext = useFormControlUnstyledContext(); | ||
let defaultValue; | ||
let disabled; | ||
let error; | ||
let required; | ||
let value; | ||
if (formControlContext) { | ||
var _formControlContext$d, _formControlContext$r, _formControlContext$e; | ||
var _formControlContext$d, _formControlContext$e, _formControlContext$r; | ||
value = formControlContext.value; | ||
defaultValue = undefined; | ||
disabled = (_formControlContext$d = formControlContext.disabled) != null ? _formControlContext$d : false; | ||
error = (_formControlContext$e = formControlContext.error) != null ? _formControlContext$e : false; | ||
required = (_formControlContext$r = formControlContext.required) != null ? _formControlContext$r : false; | ||
error = (_formControlContext$e = formControlContext.error) != null ? _formControlContext$e : false; | ||
value = formControlContext.value; | ||
if (process.env.NODE_ENV !== 'production') { | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => props[prop] !== undefined); | ||
if (definedLocalProps.length > 0) { | ||
console.warn(['MUI: You have set props on an input that is inside a FormControlUnstyled.', 'Set these props on a FormControlUnstyled instead. Otherwise they will be ignored.', `Ignored props: ${definedLocalProps.join(', ')}`].join('\n')); | ||
} | ||
} | ||
} else { | ||
value = valueProp; | ||
defaultValue = defaultValueProp; | ||
disabled = disabledProp; | ||
error = errorProp; | ||
required = requiredProp; | ||
error = errorProp; | ||
value = valueProp; | ||
} | ||
@@ -39,0 +50,0 @@ |
@@ -9,3 +9,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import useBadge from './useBadge'; | ||
import { getBadgeUtilityClass } from './badgeUnstyledClasses'; | ||
import { getBadgeUnstyledUtilityClass } from './badgeUnstyledClasses'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
@@ -20,3 +20,3 @@ import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
}; | ||
return composeClasses(slots, getBadgeUtilityClass, undefined); | ||
return composeClasses(slots, getBadgeUnstyledUtilityClass, undefined); | ||
}; | ||
@@ -23,0 +23,0 @@ |
import generateUtilityClasses from '../generateUtilityClasses'; | ||
import generateUtilityClass from '../generateUtilityClass'; | ||
export function getBadgeUtilityClass(slot) { | ||
export function getBadgeUnstyledUtilityClass(slot) { | ||
return generateUtilityClass('BaseBadge', slot); | ||
@@ -5,0 +5,0 @@ } |
export { default } from './BadgeUnstyled'; | ||
export { default as useBadge } from './useBadge'; | ||
export { default as badgeUnstyledClasses, getBadgeUtilityClass } from './badgeUnstyledClasses'; | ||
export { default as badgeUnstyledClasses, getBadgeUnstyledUtilityClass } from './badgeUnstyledClasses'; |
@@ -21,3 +21,3 @@ import * as React from 'react'; | ||
* | ||
* - [Click Away Listener](https://mui.com/base/react-click-away-listener/) | ||
* - [Click away listener](https://mui.com/base/react-click-away-listener/) | ||
* | ||
@@ -24,0 +24,0 @@ * API: |
@@ -8,3 +8,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import { unstable_useControlled as useControlled } from '@mui/utils'; | ||
import FormControlUnstyledContext from './FormControlContext'; | ||
import FormControlUnstyledContext from './FormControlUnstyledContext'; | ||
import appendOwnerState from '../utils/appendOwnerState'; | ||
@@ -17,3 +17,2 @@ import classes from './formControlUnstyledClasses'; | ||
} | ||
/** | ||
@@ -45,3 +44,3 @@ * Provides context such as filled/focused/error/required for form inputs. | ||
* | ||
* - [Form Control](https://mui.com/base/react-form-control/) | ||
* - [Form control](https://mui.com/base/react-form-control/) | ||
* | ||
@@ -52,2 +51,4 @@ * API: | ||
*/ | ||
var FormControlUnstyled = /*#__PURE__*/React.forwardRef(function FormControlUnstyled(props, ref) { | ||
@@ -68,3 +69,2 @@ var _ref; | ||
error = _props$error === void 0 ? false : _props$error, | ||
visuallyFocused = props.focused, | ||
onChange = props.onChange, | ||
@@ -74,3 +74,3 @@ _props$required = props.required, | ||
incomingValue = props.value, | ||
other = _objectWithoutProperties(props, ["defaultValue", "children", "className", "component", "components", "componentsProps", "disabled", "error", "focused", "onChange", "required", "value"]); | ||
other = _objectWithoutProperties(props, ["defaultValue", "children", "className", "component", "components", "componentsProps", "disabled", "error", "onChange", "required", "value"]); | ||
@@ -90,11 +90,9 @@ var _useControlled = useControlled({ | ||
var _React$useState = React.useState(false), | ||
focusedState = _React$useState[0], | ||
focused = _React$useState[0], | ||
setFocused = _React$useState[1]; | ||
if (disabled && focusedState) { | ||
if (disabled && focused) { | ||
setFocused(false); | ||
} | ||
var focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState; | ||
var ownerState = _extends({}, props, { | ||
@@ -108,20 +106,2 @@ disabled: disabled, | ||
var registerEffect = function registerEffect() {}; | ||
if (process.env.NODE_ENV !== 'production') { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
var registeredInput = React.useRef(false); | ||
registerEffect = function registerEffect() { | ||
if (registeredInput.current) { | ||
console.error(['MUI: There are multiple `Input` components inside a FormControl.', 'This creates visual inconsistencies, only use one `Input`.'].join('\n')); | ||
} | ||
registeredInput.current = true; | ||
return function () { | ||
registeredInput.current = false; | ||
}; | ||
}; | ||
} | ||
var handleChange = function handleChange(event) { | ||
@@ -144,3 +124,2 @@ setValue(event.target.value); | ||
}, | ||
registerEffect: registerEffect, | ||
required: required, | ||
@@ -151,2 +130,11 @@ value: value != null ? value : '' | ||
var rootProps = appendOwnerState(Root, _extends({}, other, componentsProps.root), ownerState); | ||
var renderChildren = function renderChildren() { | ||
if (typeof children === 'function') { | ||
return children(childContext); | ||
} | ||
return children; | ||
}; | ||
return /*#__PURE__*/_jsx(FormControlUnstyledContext.Provider, { | ||
@@ -157,4 +145,4 @@ value: childContext, | ||
}, rootProps, { | ||
className: clsx(classes.root, className, rootProps == null ? void 0 : rootProps.className, disabled && classes.disabled), | ||
children: children | ||
className: clsx(classes.root, className, rootProps == null ? void 0 : rootProps.className, disabled && classes.disabled, error && classes.error, filled && classes.filled, focused && classes.focused, required && classes.required), | ||
children: renderChildren() | ||
})) | ||
@@ -174,3 +162,5 @@ }); | ||
*/ | ||
children: PropTypes.node, | ||
children: PropTypes | ||
/* @typescript-to-proptypes-ignore */ | ||
.oneOfType([PropTypes.node, PropTypes.func]), | ||
@@ -222,8 +212,2 @@ /** | ||
/** | ||
* If `true`, the component is displayed in focused state. | ||
* @default false | ||
*/ | ||
focused: PropTypes.bool, | ||
/** | ||
* @ignore | ||
@@ -230,0 +214,0 @@ */ |
import generateUtilityClass from '../generateUtilityClass'; | ||
import generateUtilityClasses from '../generateUtilityClasses'; | ||
export function getFormControlUnstyledUtilityClasses(slot) { | ||
return generateUtilityClass('MuiFormControl', slot); | ||
return generateUtilityClass('BaseFormControl', slot); | ||
} | ||
var formControlUnstyledClasses = generateUtilityClasses('MuiFormControl', ['root', 'disabled']); | ||
var formControlUnstyledClasses = generateUtilityClasses('BaseFormControl', ['root', 'disabled', 'error', 'filled', 'focused', 'required']); | ||
export default formControlUnstyledClasses; |
export { default } from './FormControlUnstyled'; | ||
export { default as FormControlUnstyledContext } from './FormControlContext'; | ||
export * from './FormControlContext'; | ||
export { default as FormControlUnstyledContext } from './FormControlUnstyledContext'; | ||
export { default as formControlUnstyledClasses } from './formControlUnstyledClasses'; | ||
export * from './formControlUnstyledClasses'; | ||
export { default as useFormControlUnstyled } from './useFormControl'; | ||
export { default as useFormControlUnstyledContext } from './useFormControlUnstyledContext'; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.76 | ||
/** @license MUI v5.0.0-alpha.77 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -5,6 +5,6 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import { unstable_useForkRef as useForkRef } from '@mui/utils'; | ||
import useFormControl from '../FormControlUnstyled/useFormControl'; | ||
import { useFormControlUnstyledContext } from '../FormControlUnstyled'; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
export default function useInput(props, inputRef) { | ||
var defaultValue = props.defaultValue, | ||
var defaultValueProp = props.defaultValue, | ||
_props$disabled = props.disabled, | ||
@@ -20,20 +20,33 @@ disabledProp = _props$disabled === void 0 ? false : _props$disabled, | ||
valueProp = props.value; | ||
var formControlContext = useFormControl(); | ||
var value; | ||
var required; | ||
var formControlContext = useFormControlUnstyledContext(); | ||
var defaultValue; | ||
var disabled; | ||
var error; | ||
var required; | ||
var value; | ||
if (formControlContext) { | ||
var _formControlContext$d, _formControlContext$r, _formControlContext$e; | ||
var _formControlContext$d, _formControlContext$e, _formControlContext$r; | ||
value = formControlContext.value; | ||
defaultValue = undefined; | ||
disabled = (_formControlContext$d = formControlContext.disabled) != null ? _formControlContext$d : false; | ||
error = (_formControlContext$e = formControlContext.error) != null ? _formControlContext$e : false; | ||
required = (_formControlContext$r = formControlContext.required) != null ? _formControlContext$r : false; | ||
error = (_formControlContext$e = formControlContext.error) != null ? _formControlContext$e : false; | ||
value = formControlContext.value; | ||
if (process.env.NODE_ENV !== 'production') { | ||
var definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(function (prop) { | ||
return props[prop] !== undefined; | ||
}); | ||
if (definedLocalProps.length > 0) { | ||
console.warn(['MUI: You have set props on an input that is inside a FormControlUnstyled.', 'Set these props on a FormControlUnstyled instead. Otherwise they will be ignored.', "Ignored props: ".concat(definedLocalProps.join(', '))].join('\n')); | ||
} | ||
} | ||
} else { | ||
value = valueProp; | ||
defaultValue = defaultValueProp; | ||
disabled = disabledProp; | ||
error = errorProp; | ||
required = requiredProp; | ||
error = errorProp; | ||
value = valueProp; | ||
} | ||
@@ -40,0 +53,0 @@ |
@@ -417,2 +417,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
* Callback fired when the backdrop is clicked. | ||
* @deprecated Use the `onClose` prop with the `reason` argument to handle the `backdropClick` events. | ||
*/ | ||
@@ -419,0 +420,0 @@ onBackdropClick: PropTypes.func, |
@@ -47,3 +47,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
* | ||
* - [Table Pagination](https://mui.com/base/react-table-pagination/) | ||
* - [Table pagination](https://mui.com/base/react-table-pagination/) | ||
* | ||
@@ -50,0 +50,0 @@ * API: |
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'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface MenuItemUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ export { default } from './MenuUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -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 { |
@@ -107,2 +107,3 @@ import * as React from 'react'; | ||
* Callback fired when the backdrop is clicked. | ||
* @deprecated Use the `onClose` prop with the `reason` argument to handle the `backdropClick` events. | ||
*/ | ||
@@ -109,0 +110,0 @@ onBackdropClick?: React.ReactEventHandler<{}>; |
@@ -406,2 +406,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
* Callback fired when the backdrop is clicked. | ||
* @deprecated Use the `onClose` prop with the `reason` argument to handle the `backdropClick` events. | ||
*/ | ||
@@ -408,0 +409,0 @@ onBackdropClick: PropTypes.func, |
@@ -0,0 +0,0 @@ export interface ModalUnstyledClasses { |
@@ -10,3 +10,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import useBadge from './useBadge'; | ||
import { getBadgeUtilityClass } from './badgeUnstyledClasses'; | ||
import { getBadgeUnstyledUtilityClass } from './badgeUnstyledClasses'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
@@ -23,3 +23,3 @@ import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
}; | ||
return composeClasses(slots, getBadgeUtilityClass, undefined); | ||
return composeClasses(slots, getBadgeUnstyledUtilityClass, undefined); | ||
}; | ||
@@ -26,0 +26,0 @@ |
import generateUtilityClasses from '../generateUtilityClasses'; | ||
import generateUtilityClass from '../generateUtilityClass'; | ||
export function getBadgeUtilityClass(slot) { | ||
export function getBadgeUnstyledUtilityClass(slot) { | ||
return generateUtilityClass('BaseBadge', slot); | ||
@@ -5,0 +5,0 @@ } |
export { default } from './BadgeUnstyled'; | ||
export { default as useBadge } from './useBadge'; | ||
export { default as badgeUnstyledClasses, getBadgeUtilityClass } from './badgeUnstyledClasses'; | ||
export { default as badgeUnstyledClasses, getBadgeUnstyledUtilityClass } from './badgeUnstyledClasses'; |
@@ -21,3 +21,3 @@ import * as React from 'react'; | ||
* | ||
* - [Click Away Listener](https://mui.com/base/react-click-away-listener/) | ||
* - [Click away listener](https://mui.com/base/react-click-away-listener/) | ||
* | ||
@@ -24,0 +24,0 @@ * API: |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
const _excluded = ["defaultValue", "children", "className", "component", "components", "componentsProps", "disabled", "error", "focused", "onChange", "required", "value"]; | ||
const _excluded = ["defaultValue", "children", "className", "component", "components", "componentsProps", "disabled", "error", "onChange", "required", "value"]; | ||
import * as React from 'react'; | ||
@@ -8,3 +8,3 @@ import PropTypes from 'prop-types'; | ||
import { unstable_useControlled as useControlled } from '@mui/utils'; | ||
import FormControlUnstyledContext from './FormControlContext'; | ||
import FormControlUnstyledContext from './FormControlUnstyledContext'; | ||
import appendOwnerState from '../utils/appendOwnerState'; | ||
@@ -17,3 +17,2 @@ import classes from './formControlUnstyledClasses'; | ||
} | ||
/** | ||
@@ -45,3 +44,3 @@ * Provides context such as filled/focused/error/required for form inputs. | ||
* | ||
* - [Form Control](https://mui.com/base/react-form-control/) | ||
* - [Form control](https://mui.com/base/react-form-control/) | ||
* | ||
@@ -52,2 +51,4 @@ * API: | ||
*/ | ||
const FormControlUnstyled = /*#__PURE__*/React.forwardRef(function FormControlUnstyled(props, ref) { | ||
@@ -63,3 +64,2 @@ const { | ||
error = false, | ||
focused: visuallyFocused, | ||
onChange, | ||
@@ -78,10 +78,8 @@ required = false, | ||
const filled = hasValue(value); | ||
const [focusedState, setFocused] = React.useState(false); | ||
const [focused, setFocused] = React.useState(false); | ||
if (disabled && focusedState) { | ||
if (disabled && focused) { | ||
setFocused(false); | ||
} | ||
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState; | ||
const ownerState = _extends({}, props, { | ||
@@ -95,20 +93,2 @@ disabled, | ||
let registerEffect = () => {}; | ||
if (process.env.NODE_ENV !== 'production') { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const registeredInput = React.useRef(false); | ||
registerEffect = () => { | ||
if (registeredInput.current) { | ||
console.error(['MUI: There are multiple `Input` components inside a FormControl.', 'This creates visual inconsistencies, only use one `Input`.'].join('\n')); | ||
} | ||
registeredInput.current = true; | ||
return () => { | ||
registeredInput.current = false; | ||
}; | ||
}; | ||
} | ||
const handleChange = event => { | ||
@@ -131,3 +111,2 @@ setValue(event.target.value); | ||
}, | ||
registerEffect, | ||
required, | ||
@@ -138,2 +117,11 @@ value: value ?? '' | ||
const rootProps = appendOwnerState(Root, _extends({}, other, componentsProps.root), ownerState); | ||
const renderChildren = () => { | ||
if (typeof children === 'function') { | ||
return children(childContext); | ||
} | ||
return children; | ||
}; | ||
return /*#__PURE__*/_jsx(FormControlUnstyledContext.Provider, { | ||
@@ -144,4 +132,4 @@ value: childContext, | ||
}, rootProps, { | ||
className: clsx(classes.root, className, rootProps?.className, disabled && classes.disabled), | ||
children: children | ||
className: clsx(classes.root, className, rootProps?.className, disabled && classes.disabled, error && classes.error, filled && classes.filled, focused && classes.focused, required && classes.required), | ||
children: renderChildren() | ||
})) | ||
@@ -161,3 +149,5 @@ }); | ||
*/ | ||
children: PropTypes.node, | ||
children: PropTypes | ||
/* @typescript-to-proptypes-ignore */ | ||
.oneOfType([PropTypes.node, PropTypes.func]), | ||
@@ -209,8 +199,2 @@ /** | ||
/** | ||
* If `true`, the component is displayed in focused state. | ||
* @default false | ||
*/ | ||
focused: PropTypes.bool, | ||
/** | ||
* @ignore | ||
@@ -217,0 +201,0 @@ */ |
import generateUtilityClass from '../generateUtilityClass'; | ||
import generateUtilityClasses from '../generateUtilityClasses'; | ||
export function getFormControlUnstyledUtilityClasses(slot) { | ||
return generateUtilityClass('MuiFormControl', slot); | ||
return generateUtilityClass('BaseFormControl', slot); | ||
} | ||
const formControlUnstyledClasses = generateUtilityClasses('MuiFormControl', ['root', 'disabled']); | ||
const formControlUnstyledClasses = generateUtilityClasses('BaseFormControl', ['root', 'disabled', 'error', 'filled', 'focused', 'required']); | ||
export default formControlUnstyledClasses; |
export { default } from './FormControlUnstyled'; | ||
export { default as FormControlUnstyledContext } from './FormControlContext'; | ||
export * from './FormControlContext'; | ||
export { default as FormControlUnstyledContext } from './FormControlUnstyledContext'; | ||
export { default as formControlUnstyledClasses } from './formControlUnstyledClasses'; | ||
export * from './formControlUnstyledClasses'; | ||
export { default as useFormControlUnstyled } from './useFormControl'; | ||
export { default as useFormControlUnstyledContext } from './useFormControlUnstyledContext'; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.76 | ||
/** @license MUI v5.0.0-alpha.77 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import { unstable_useForkRef as useForkRef } from '@mui/utils'; | ||
import useFormControl from '../FormControlUnstyled/useFormControl'; | ||
import { useFormControlUnstyledContext } from '../FormControlUnstyled'; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
export default function useInput(props, inputRef) { | ||
const { | ||
defaultValue, | ||
defaultValue: defaultValueProp, | ||
disabled: disabledProp = false, | ||
@@ -19,18 +19,29 @@ error: errorProp = false, | ||
} = props; | ||
const formControlContext = useFormControl(); | ||
let value; | ||
let required; | ||
const formControlContext = useFormControlUnstyledContext(); | ||
let defaultValue; | ||
let disabled; | ||
let error; | ||
let required; | ||
let value; | ||
if (formControlContext) { | ||
value = formControlContext.value; | ||
defaultValue = undefined; | ||
disabled = formControlContext.disabled ?? false; | ||
error = formControlContext.error ?? false; | ||
required = formControlContext.required ?? false; | ||
error = formControlContext.error ?? false; | ||
value = formControlContext.value; | ||
if (process.env.NODE_ENV !== 'production') { | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => props[prop] !== undefined); | ||
if (definedLocalProps.length > 0) { | ||
console.warn(['MUI: You have set props on an input that is inside a FormControlUnstyled.', 'Set these props on a FormControlUnstyled instead. Otherwise they will be ignored.', `Ignored props: ${definedLocalProps.join(', ')}`].join('\n')); | ||
} | ||
} | ||
} else { | ||
value = valueProp; | ||
defaultValue = defaultValueProp; | ||
disabled = disabledProp; | ||
error = errorProp; | ||
required = requiredProp; | ||
error = errorProp; | ||
value = valueProp; | ||
} | ||
@@ -37,0 +48,0 @@ |
@@ -406,2 +406,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
* Callback fired when the backdrop is clicked. | ||
* @deprecated Use the `onClose` prop with the `reason` argument to handle the `backdropClick` events. | ||
*/ | ||
@@ -408,0 +409,0 @@ onBackdropClick: PropTypes.func, |
@@ -49,3 +49,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
* | ||
* - [Table Pagination](https://mui.com/base/react-table-pagination/) | ||
* - [Table pagination](https://mui.com/base/react-table-pagination/) | ||
* | ||
@@ -52,0 +52,0 @@ * API: |
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'; |
@@ -44,3 +44,3 @@ "use strict"; | ||
}; | ||
return (0, _composeClasses.default)(slots, _badgeUnstyledClasses.getBadgeUtilityClass, undefined); | ||
return (0, _composeClasses.default)(slots, _badgeUnstyledClasses.getBadgeUnstyledUtilityClass, undefined); | ||
}; | ||
@@ -47,0 +47,0 @@ |
@@ -9,3 +9,3 @@ "use strict"; | ||
exports.default = void 0; | ||
exports.getBadgeUtilityClass = getBadgeUtilityClass; | ||
exports.getBadgeUnstyledUtilityClass = getBadgeUnstyledUtilityClass; | ||
@@ -16,3 +16,3 @@ var _generateUtilityClasses = _interopRequireDefault(require("../generateUtilityClasses")); | ||
function getBadgeUtilityClass(slot) { | ||
function getBadgeUnstyledUtilityClass(slot) { | ||
return (0, _generateUtilityClass.default)('BaseBadge', slot); | ||
@@ -19,0 +19,0 @@ } |
@@ -20,6 +20,6 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "getBadgeUtilityClass", { | ||
Object.defineProperty(exports, "getBadgeUnstyledUtilityClass", { | ||
enumerable: true, | ||
get: function () { | ||
return _badgeUnstyledClasses.getBadgeUtilityClass; | ||
return _badgeUnstyledClasses.getBadgeUnstyledUtilityClass; | ||
} | ||
@@ -26,0 +26,0 @@ }); |
@@ -37,3 +37,3 @@ "use strict"; | ||
* | ||
* - [Click Away Listener](https://mui.com/base/react-click-away-listener/) | ||
* - [Click away listener](https://mui.com/base/react-click-away-listener/) | ||
* | ||
@@ -40,0 +40,0 @@ * API: |
@@ -22,3 +22,3 @@ "use strict"; | ||
var _FormControlContext = _interopRequireDefault(require("./FormControlContext")); | ||
var _FormControlUnstyledContext = _interopRequireDefault(require("./FormControlUnstyledContext")); | ||
@@ -31,3 +31,3 @@ var _appendOwnerState = _interopRequireDefault(require("../utils/appendOwnerState")); | ||
const _excluded = ["defaultValue", "children", "className", "component", "components", "componentsProps", "disabled", "error", "focused", "onChange", "required", "value"]; | ||
const _excluded = ["defaultValue", "children", "className", "component", "components", "componentsProps", "disabled", "error", "onChange", "required", "value"]; | ||
@@ -41,3 +41,2 @@ 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); } | ||
} | ||
/** | ||
@@ -69,3 +68,3 @@ * Provides context such as filled/focused/error/required for form inputs. | ||
* | ||
* - [Form Control](https://mui.com/base/react-form-control/) | ||
* - [Form control](https://mui.com/base/react-form-control/) | ||
* | ||
@@ -76,2 +75,4 @@ * API: | ||
*/ | ||
const FormControlUnstyled = /*#__PURE__*/React.forwardRef(function FormControlUnstyled(props, ref) { | ||
@@ -89,3 +90,2 @@ var _ref; | ||
error = false, | ||
focused: visuallyFocused, | ||
onChange, | ||
@@ -103,9 +103,8 @@ required = false, | ||
const filled = hasValue(value); | ||
const [focusedState, setFocused] = React.useState(false); | ||
const [focused, setFocused] = React.useState(false); | ||
if (disabled && focusedState) { | ||
if (disabled && focused) { | ||
setFocused(false); | ||
} | ||
const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState; | ||
const ownerState = (0, _extends2.default)({}, props, { | ||
@@ -119,20 +118,2 @@ disabled, | ||
let registerEffect = () => {}; | ||
if (process.env.NODE_ENV !== 'production') { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const registeredInput = React.useRef(false); | ||
registerEffect = () => { | ||
if (registeredInput.current) { | ||
console.error(['MUI: There are multiple `Input` components inside a FormControl.', 'This creates visual inconsistencies, only use one `Input`.'].join('\n')); | ||
} | ||
registeredInput.current = true; | ||
return () => { | ||
registeredInput.current = false; | ||
}; | ||
}; | ||
} | ||
const handleChange = event => { | ||
@@ -155,3 +136,2 @@ setValue(event.target.value); | ||
}, | ||
registerEffect, | ||
required, | ||
@@ -162,3 +142,12 @@ value: value != null ? value : '' | ||
const rootProps = (0, _appendOwnerState.default)(Root, (0, _extends2.default)({}, other, componentsProps.root), ownerState); | ||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlContext.default.Provider, { | ||
const renderChildren = () => { | ||
if (typeof children === 'function') { | ||
return children(childContext); | ||
} | ||
return children; | ||
}; | ||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlUnstyledContext.default.Provider, { | ||
value: childContext, | ||
@@ -168,4 +157,4 @@ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, (0, _extends2.default)({ | ||
}, rootProps, { | ||
className: (0, _clsx.default)(_formControlUnstyledClasses.default.root, className, rootProps == null ? void 0 : rootProps.className, disabled && _formControlUnstyledClasses.default.disabled), | ||
children: children | ||
className: (0, _clsx.default)(_formControlUnstyledClasses.default.root, className, rootProps == null ? void 0 : rootProps.className, disabled && _formControlUnstyledClasses.default.disabled, error && _formControlUnstyledClasses.default.error, filled && _formControlUnstyledClasses.default.filled, focused && _formControlUnstyledClasses.default.focused, required && _formControlUnstyledClasses.default.required), | ||
children: renderChildren() | ||
})) | ||
@@ -185,3 +174,5 @@ }); | ||
*/ | ||
children: _propTypes.default.node, | ||
children: _propTypes.default | ||
/* @typescript-to-proptypes-ignore */ | ||
.oneOfType([_propTypes.default.node, _propTypes.default.func]), | ||
@@ -233,8 +224,2 @@ /** | ||
/** | ||
* If `true`, the component is displayed in focused state. | ||
* @default false | ||
*/ | ||
focused: _propTypes.default.bool, | ||
/** | ||
* @ignore | ||
@@ -241,0 +226,0 @@ */ |
@@ -16,7 +16,7 @@ "use strict"; | ||
function getFormControlUnstyledUtilityClasses(slot) { | ||
return (0, _generateUtilityClass.default)('MuiFormControl', slot); | ||
return (0, _generateUtilityClass.default)('BaseFormControl', slot); | ||
} | ||
const formControlUnstyledClasses = (0, _generateUtilityClasses.default)('MuiFormControl', ['root', 'disabled']); | ||
const formControlUnstyledClasses = (0, _generateUtilityClasses.default)('BaseFormControl', ['root', 'disabled', 'error', 'filled', 'focused', 'required']); | ||
var _default = formControlUnstyledClasses; | ||
exports.default = _default; |
@@ -11,3 +11,3 @@ "use strict"; | ||
formControlUnstyledClasses: true, | ||
useFormControlUnstyled: true | ||
useFormControlUnstyledContext: true | ||
}; | ||
@@ -17,3 +17,3 @@ Object.defineProperty(exports, "FormControlUnstyledContext", { | ||
get: function () { | ||
return _FormControlContext.default; | ||
return _FormControlUnstyledContext.default; | ||
} | ||
@@ -33,6 +33,6 @@ }); | ||
}); | ||
Object.defineProperty(exports, "useFormControlUnstyled", { | ||
Object.defineProperty(exports, "useFormControlUnstyledContext", { | ||
enumerable: true, | ||
get: function () { | ||
return _useFormControl.default; | ||
return _useFormControlUnstyledContext.default; | ||
} | ||
@@ -43,16 +43,4 @@ }); | ||
var _FormControlContext = _interopRequireWildcard(require("./FormControlContext")); | ||
var _FormControlUnstyledContext = _interopRequireDefault(require("./FormControlUnstyledContext")); | ||
Object.keys(_FormControlContext).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _FormControlContext[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _FormControlContext[key]; | ||
} | ||
}); | ||
}); | ||
var _formControlUnstyledClasses = _interopRequireWildcard(require("./formControlUnstyledClasses")); | ||
@@ -72,3 +60,3 @@ | ||
var _useFormControl = _interopRequireDefault(require("./useFormControl")); | ||
var _useFormControlUnstyledContext = _interopRequireDefault(require("./useFormControlUnstyledContext")); | ||
@@ -75,0 +63,0 @@ 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); } |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.76 | ||
/** @license MUI v5.0.0-alpha.77 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -16,3 +16,3 @@ "use strict"; | ||
var _useFormControl = _interopRequireDefault(require("../FormControlUnstyled/useFormControl")); | ||
var _FormControlUnstyled = require("../FormControlUnstyled"); | ||
@@ -27,3 +27,3 @@ var _extractEventHandlers = _interopRequireDefault(require("../utils/extractEventHandlers")); | ||
const { | ||
defaultValue, | ||
defaultValue: defaultValueProp, | ||
disabled: disabledProp = false, | ||
@@ -37,20 +37,31 @@ error: errorProp = false, | ||
} = props; | ||
const formControlContext = (0, _useFormControl.default)(); | ||
let value; | ||
let required; | ||
const formControlContext = (0, _FormControlUnstyled.useFormControlUnstyledContext)(); | ||
let defaultValue; | ||
let disabled; | ||
let error; | ||
let required; | ||
let value; | ||
if (formControlContext) { | ||
var _formControlContext$d, _formControlContext$r, _formControlContext$e; | ||
var _formControlContext$d, _formControlContext$e, _formControlContext$r; | ||
value = formControlContext.value; | ||
defaultValue = undefined; | ||
disabled = (_formControlContext$d = formControlContext.disabled) != null ? _formControlContext$d : false; | ||
error = (_formControlContext$e = formControlContext.error) != null ? _formControlContext$e : false; | ||
required = (_formControlContext$r = formControlContext.required) != null ? _formControlContext$r : false; | ||
error = (_formControlContext$e = formControlContext.error) != null ? _formControlContext$e : false; | ||
value = formControlContext.value; | ||
if (process.env.NODE_ENV !== 'production') { | ||
const definedLocalProps = ['defaultValue', 'disabled', 'error', 'required', 'value'].filter(prop => props[prop] !== undefined); | ||
if (definedLocalProps.length > 0) { | ||
console.warn(['MUI: You have set props on an input that is inside a FormControlUnstyled.', 'Set these props on a FormControlUnstyled instead. Otherwise they will be ignored.', `Ignored props: ${definedLocalProps.join(', ')}`].join('\n')); | ||
} | ||
} | ||
} else { | ||
value = valueProp; | ||
defaultValue = defaultValueProp; | ||
disabled = disabledProp; | ||
error = errorProp; | ||
required = requiredProp; | ||
error = errorProp; | ||
value = valueProp; | ||
} | ||
@@ -57,0 +68,0 @@ |
@@ -428,2 +428,3 @@ "use strict"; | ||
* Callback fired when the backdrop is clicked. | ||
* @deprecated Use the `onClose` prop with the `reason` argument to handle the `backdropClick` events. | ||
*/ | ||
@@ -430,0 +431,0 @@ onBackdropClick: _propTypes.default.func, |
@@ -72,3 +72,3 @@ "use strict"; | ||
* | ||
* - [Table Pagination](https://mui.com/base/react-table-pagination/) | ||
* - [Table pagination](https://mui.com/base/react-table-pagination/) | ||
* | ||
@@ -75,0 +75,0 @@ * API: |
@@ -33,3 +33,3 @@ import * as React from 'react'; | ||
* | ||
* - [No Ssr](https://mui.com/base/react-no-ssr/) | ||
* - [No ssr](https://mui.com/base/react-no-ssr/) | ||
* | ||
@@ -36,0 +36,0 @@ * API: |
@@ -0,0 +0,0 @@ export { default } from './OptionGroupUnstyled'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface OptionGroupUnstyledClasses { |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export { default } from './OptionUnstyled'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface OptionUnstyledClasses { |
@@ -0,0 +0,0 @@ import React from 'react'; |
{ | ||
"name": "@mui/base", | ||
"version": "5.0.0-alpha.76", | ||
"version": "5.0.0-alpha.77", | ||
"private": false, | ||
"author": "MUI Team", | ||
"description": "Unstyled React components with which to implement custom design systems.", | ||
"description": "Unstyled React components and low-level hooks.", | ||
"main": "./node/index.js", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -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 { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -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'; |
@@ -8,3 +8,3 @@ import { OverridableComponent } from '@mui/types'; | ||
* | ||
* - [Table Pagination](https://mui.com/base/react-table-pagination/) | ||
* - [Table pagination](https://mui.com/base/react-table-pagination/) | ||
* | ||
@@ -11,0 +11,0 @@ * API: |
@@ -49,3 +49,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
* | ||
* - [Table Pagination](https://mui.com/base/react-table-pagination/) | ||
* - [Table pagination](https://mui.com/base/react-table-pagination/) | ||
* | ||
@@ -52,0 +52,0 @@ * API: |
@@ -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" /> |
@@ -21,4 +21,4 @@ import * as React from 'react'; | ||
* | ||
* - [Textarea Autosize](https://mui.com/base/react-textarea-autosize/) | ||
* - [Textarea Autosize](https://mui.com/material-ui/react-textarea-autosize/) | ||
* - [Textarea autosize](https://mui.com/base/react-textarea-autosize/) | ||
* - [Textarea autosize](https://mui.com/material-ui/react-textarea-autosize/) | ||
* | ||
@@ -25,0 +25,0 @@ * API: |
@@ -59,3 +59,3 @@ import * as React from 'react'; | ||
* | ||
* - [Trap Focus](https://mui.com/base/react-trap-focus/) | ||
* - [Trap focus](https://mui.com/base/react-trap-focus/) | ||
* | ||
@@ -62,0 +62,0 @@ * API: |
@@ -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'; |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
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
2059076
41215
190