@mui/base
Advanced tools
Comparing version 5.0.0-alpha.94 to 5.0.0-alpha.95
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface BadgeUnstyledClasses { |
@@ -0,0 +0,0 @@ export { default } from './BadgeUnstyled'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -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'; |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import * as React from 'react'; | ||
import { unstable_setRef as setRef, unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils'; | ||
import { unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils'; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
@@ -10,3 +10,3 @@ export default function useButton(parameters) { | ||
href, | ||
ref, | ||
ref: externalRef, | ||
tabIndex, | ||
@@ -154,12 +154,8 @@ to, | ||
const handleOwnRef = useForkRef(focusVisibleRef, buttonRef); | ||
const handleRef = useForkRef(ref, handleOwnRef); | ||
const updateRef = instance => { | ||
const updateHostElementName = React.useCallback(instance => { | ||
var _instance$tagName; | ||
setHostElementName((_instance$tagName = instance == null ? void 0 : instance.tagName) != null ? _instance$tagName : ''); | ||
setRef(handleRef, instance); | ||
}; | ||
}, []); | ||
const handleRef = useForkRef(updateHostElementName, useForkRef(externalRef, useForkRef(focusVisibleRef, buttonRef))); | ||
const buttonProps = {}; | ||
@@ -206,3 +202,3 @@ | ||
onMouseUp: createHandleMouseUp(externalEventHandlers), | ||
ref: updateRef | ||
ref: handleRef | ||
}); | ||
@@ -209,0 +205,0 @@ }; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
export { unstable_ClassNameGenerator } from '@mui/utils'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
export { default } from './ClickAwayListener'; | ||
export * from './ClickAwayListener'; |
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'; |
export { unstable_generateUtilityClass as default } from '@mui/utils'; | ||
export type { GlobalStateSlot } from '@mui/utils'; |
export { unstable_generateUtilityClasses as default } from '@mui/utils'; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.94 | ||
/** @license MUI v5.0.0-alpha.95 | ||
* | ||
@@ -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 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface InputUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import * as React from 'react'; | ||
import { unstable_setRef as setRef, unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils'; | ||
import { unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils'; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
@@ -10,3 +10,3 @@ export default function useButton(parameters) { | ||
href = parameters.href, | ||
ref = parameters.ref, | ||
externalRef = parameters.ref, | ||
tabIndex = parameters.tabIndex, | ||
@@ -178,12 +178,8 @@ to = parameters.to, | ||
var handleOwnRef = useForkRef(focusVisibleRef, buttonRef); | ||
var handleRef = useForkRef(ref, handleOwnRef); | ||
var updateRef = function updateRef(instance) { | ||
var updateHostElementName = React.useCallback(function (instance) { | ||
var _instance$tagName; | ||
setHostElementName((_instance$tagName = instance == null ? void 0 : instance.tagName) != null ? _instance$tagName : ''); | ||
setRef(handleRef, instance); | ||
}; | ||
}, []); | ||
var handleRef = useForkRef(updateHostElementName, useForkRef(externalRef, useForkRef(focusVisibleRef, buttonRef))); | ||
var buttonProps = {}; | ||
@@ -231,3 +227,3 @@ | ||
onMouseUp: createHandleMouseUp(externalEventHandlers), | ||
ref: updateRef | ||
ref: handleRef | ||
}); | ||
@@ -234,0 +230,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.94 | ||
/** @license MUI v5.0.0-alpha.95 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -35,8 +35,10 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
function useStateChangeDetection(nextState, internalPreviousState, propsRef) { | ||
function useStateChangeDetection(nextState, internalPreviousState, propsRef, hasDispatchedActionRef) { | ||
React.useEffect(function () { | ||
if (!propsRef.current) { | ||
if (!propsRef.current || !hasDispatchedActionRef.current) { | ||
// Detect changes only if an action has been dispatched. | ||
return; | ||
} | ||
hasDispatchedActionRef.current = false; | ||
var previousState = getControlledState(internalPreviousState, propsRef.current); | ||
@@ -66,3 +68,3 @@ var _propsRef$current = propsRef.current, | ||
} | ||
}, [nextState.selectedValue, internalPreviousState, propsRef]); | ||
}, [nextState.selectedValue, internalPreviousState, propsRef, hasDispatchedActionRef]); | ||
React.useEffect(function () { | ||
@@ -89,2 +91,3 @@ if (!propsRef.current) { | ||
propsRef.current = props; | ||
var hasDispatchedActionRef = React.useRef(false); | ||
var initialSelectedValue = (_ref = value === undefined ? defaultValue : value) != null ? _ref : props.multiple ? [] : null; | ||
@@ -96,2 +99,4 @@ var initalState = { | ||
var combinedReducer = React.useCallback(function (state, action) { | ||
hasDispatchedActionRef.current = true; | ||
if (externalReducer) { | ||
@@ -112,4 +117,4 @@ return externalReducer(getControlledState(state, propsRef.current), action); | ||
}, [previousState, nextState]); | ||
useStateChangeDetection(nextState, previousState.current, propsRef); | ||
useStateChangeDetection(nextState, previousState.current, propsRef, hasDispatchedActionRef); | ||
return [getControlledState(nextState, propsRef.current), dispatch]; | ||
} |
@@ -69,3 +69,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
var MultiSelectUnstyled = /*#__PURE__*/React.forwardRef(function MultiSelectUnstyled(props, ref) { | ||
var MultiSelectUnstyled = /*#__PURE__*/React.forwardRef(function MultiSelectUnstyled(props, forwardedRef) { | ||
var _props$renderValue, _ref, _components$Listbox, _components$Popper; | ||
@@ -130,12 +130,6 @@ | ||
var Popper = (_components$Popper = components.Popper) != null ? _components$Popper : PopperUnstyled; | ||
var handleButtonRefChange = function handleButtonRefChange(element) { | ||
buttonRef.current = element; | ||
if (element != null) { | ||
setButtonDefined(true); | ||
} | ||
}; | ||
var handleButtonRef = useForkRef(ref, handleButtonRefChange); | ||
var handleButtonRefChange = React.useCallback(function (element) { | ||
setButtonDefined(element != null); | ||
}, []); | ||
var handleButtonRef = useForkRef(forwardedRef, useForkRef(buttonRef, handleButtonRefChange)); | ||
React.useEffect(function () { | ||
@@ -142,0 +136,0 @@ if (autoFocus) { |
@@ -61,3 +61,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
var SelectUnstyled = /*#__PURE__*/React.forwardRef(function SelectUnstyled(props, ref) { | ||
var SelectUnstyled = /*#__PURE__*/React.forwardRef(function SelectUnstyled(props, forwardedRef) { | ||
var _ref, _components$Listbox, _components$Popper; | ||
@@ -122,12 +122,6 @@ | ||
var Popper = (_components$Popper = components.Popper) != null ? _components$Popper : PopperUnstyled; | ||
var handleButtonRefChange = function handleButtonRefChange(element) { | ||
buttonRef.current = element; | ||
if (element != null) { | ||
setButtonDefined(true); | ||
} | ||
}; | ||
var handleButtonRef = useForkRef(ref, handleButtonRefChange); | ||
var handleButtonRefChange = React.useCallback(function (element) { | ||
setButtonDefined(element != null); | ||
}, []); | ||
var handleButtonRef = useForkRef(forwardedRef, useForkRef(buttonRef, handleButtonRefChange)); | ||
React.useEffect(function () { | ||
@@ -134,0 +128,0 @@ if (autoFocus) { |
@@ -157,5 +157,5 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
return function (event) { | ||
var _otherHandlers$blur; | ||
var _otherHandlers$onBlur; | ||
otherHandlers == null ? void 0 : (_otherHandlers$blur = otherHandlers.blur) == null ? void 0 : _otherHandlers$blur.call(otherHandlers, event); | ||
otherHandlers == null ? void 0 : (_otherHandlers$onBlur = otherHandlers.onBlur) == null ? void 0 : _otherHandlers$onBlur.call(otherHandlers, event); | ||
@@ -162,0 +162,0 @@ if (!event.defaultPrevented) { |
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, UseListboxPropsWithDefaults } from './useListbox.types'; | ||
export default function useControllableReducer<TOption>(internalReducer: ListboxReducer<TOption>, externalReducer: ListboxReducer<TOption> | undefined, props: UseListboxPropsWithDefaults<TOption>): [ListboxState<TOption>, (action: ListboxAction<TOption>) => void]; |
@@ -35,8 +35,10 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
function useStateChangeDetection(nextState, internalPreviousState, propsRef) { | ||
function useStateChangeDetection(nextState, internalPreviousState, propsRef, hasDispatchedActionRef) { | ||
React.useEffect(() => { | ||
if (!propsRef.current) { | ||
if (!propsRef.current || !hasDispatchedActionRef.current) { | ||
// Detect changes only if an action has been dispatched. | ||
return; | ||
} | ||
hasDispatchedActionRef.current = false; | ||
const previousState = getControlledState(internalPreviousState, propsRef.current); | ||
@@ -67,3 +69,3 @@ const { | ||
} | ||
}, [nextState.selectedValue, internalPreviousState, propsRef]); | ||
}, [nextState.selectedValue, internalPreviousState, propsRef, hasDispatchedActionRef]); | ||
React.useEffect(() => { | ||
@@ -92,2 +94,3 @@ if (!propsRef.current) { | ||
propsRef.current = props; | ||
const hasDispatchedActionRef = React.useRef(false); | ||
const initialSelectedValue = (_ref = value === undefined ? defaultValue : value) != null ? _ref : props.multiple ? [] : null; | ||
@@ -99,2 +102,4 @@ const initalState = { | ||
const combinedReducer = React.useCallback((state, action) => { | ||
hasDispatchedActionRef.current = true; | ||
if (externalReducer) { | ||
@@ -111,4 +116,4 @@ return externalReducer(getControlledState(state, propsRef.current), action); | ||
}, [previousState, nextState]); | ||
useStateChangeDetection(nextState, previousState.current, propsRef); | ||
useStateChangeDetection(nextState, previousState.current, propsRef, hasDispatchedActionRef); | ||
return [getControlledState(nextState, propsRef.current), dispatch]; | ||
} |
@@ -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 { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ import { OverrideProps } from '@mui/types'; |
@@ -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 { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ import { OverrideProps } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface MenuUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import { MenuItemMetadata, MenuItemState, UseMenuListboxSlotProps, UseMenuParameters } from './useMenu.types'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface ManagedModalProps { |
@@ -0,0 +0,0 @@ import { OverridableComponent, OverridableTypeMap, OverrideProps } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface ModalUnstyledClasses { |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import * as React from 'react'; | ||
import { unstable_setRef as setRef, unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils'; | ||
import { unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils'; | ||
import extractEventHandlers from '../utils/extractEventHandlers'; | ||
@@ -10,3 +10,3 @@ export default function useButton(parameters) { | ||
href, | ||
ref, | ||
ref: externalRef, | ||
tabIndex, | ||
@@ -132,10 +132,6 @@ to, | ||
const handleOwnRef = useForkRef(focusVisibleRef, buttonRef); | ||
const handleRef = useForkRef(ref, handleOwnRef); | ||
const updateRef = instance => { | ||
const updateHostElementName = React.useCallback(instance => { | ||
setHostElementName(instance?.tagName ?? ''); | ||
setRef(handleRef, instance); | ||
}; | ||
}, []); | ||
const handleRef = useForkRef(updateHostElementName, useForkRef(externalRef, useForkRef(focusVisibleRef, buttonRef))); | ||
const buttonProps = {}; | ||
@@ -182,3 +178,3 @@ | ||
onMouseUp: createHandleMouseUp(externalEventHandlers), | ||
ref: updateRef | ||
ref: handleRef | ||
}); | ||
@@ -185,0 +181,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.94 | ||
/** @license MUI v5.0.0-alpha.95 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -35,8 +35,10 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
function useStateChangeDetection(nextState, internalPreviousState, propsRef) { | ||
function useStateChangeDetection(nextState, internalPreviousState, propsRef, hasDispatchedActionRef) { | ||
React.useEffect(() => { | ||
if (!propsRef.current) { | ||
if (!propsRef.current || !hasDispatchedActionRef.current) { | ||
// Detect changes only if an action has been dispatched. | ||
return; | ||
} | ||
hasDispatchedActionRef.current = false; | ||
const previousState = getControlledState(internalPreviousState, propsRef.current); | ||
@@ -65,3 +67,3 @@ const { | ||
} | ||
}, [nextState.selectedValue, internalPreviousState, propsRef]); | ||
}, [nextState.selectedValue, internalPreviousState, propsRef, hasDispatchedActionRef]); | ||
React.useEffect(() => { | ||
@@ -86,2 +88,3 @@ if (!propsRef.current) { | ||
propsRef.current = props; | ||
const hasDispatchedActionRef = React.useRef(false); | ||
const initialSelectedValue = (value === undefined ? defaultValue : value) ?? (props.multiple ? [] : null); | ||
@@ -93,2 +96,4 @@ const initalState = { | ||
const combinedReducer = React.useCallback((state, action) => { | ||
hasDispatchedActionRef.current = true; | ||
if (externalReducer) { | ||
@@ -105,4 +110,4 @@ return externalReducer(getControlledState(state, propsRef.current), action); | ||
}, [previousState, nextState]); | ||
useStateChangeDetection(nextState, previousState.current, propsRef); | ||
useStateChangeDetection(nextState, previousState.current, propsRef, hasDispatchedActionRef); | ||
return [getControlledState(nextState, propsRef.current), dispatch]; | ||
} |
@@ -63,3 +63,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
const MultiSelectUnstyled = /*#__PURE__*/React.forwardRef(function MultiSelectUnstyled(props, ref) { | ||
const MultiSelectUnstyled = /*#__PURE__*/React.forwardRef(function MultiSelectUnstyled(props, forwardedRef) { | ||
const { | ||
@@ -103,12 +103,6 @@ autoFocus, | ||
const Popper = components.Popper ?? PopperUnstyled; | ||
const handleButtonRefChange = element => { | ||
buttonRef.current = element; | ||
if (element != null) { | ||
setButtonDefined(true); | ||
} | ||
}; | ||
const handleButtonRef = useForkRef(ref, handleButtonRefChange); | ||
const handleButtonRefChange = React.useCallback(element => { | ||
setButtonDefined(element != null); | ||
}, []); | ||
const handleButtonRef = useForkRef(forwardedRef, useForkRef(buttonRef, handleButtonRefChange)); | ||
React.useEffect(() => { | ||
@@ -115,0 +109,0 @@ if (autoFocus) { |
@@ -61,3 +61,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
const SelectUnstyled = /*#__PURE__*/React.forwardRef(function SelectUnstyled(props, ref) { | ||
const SelectUnstyled = /*#__PURE__*/React.forwardRef(function SelectUnstyled(props, forwardedRef) { | ||
const { | ||
@@ -102,12 +102,6 @@ autoFocus, | ||
const Popper = components.Popper ?? PopperUnstyled; | ||
const handleButtonRefChange = element => { | ||
buttonRef.current = element; | ||
if (element != null) { | ||
setButtonDefined(true); | ||
} | ||
}; | ||
const handleButtonRef = useForkRef(ref, handleButtonRefChange); | ||
const handleButtonRefChange = React.useCallback(element => { | ||
setButtonDefined(element != null); | ||
}, []); | ||
const handleButtonRef = useForkRef(forwardedRef, useForkRef(buttonRef, handleButtonRefChange)); | ||
React.useEffect(() => { | ||
@@ -114,0 +108,0 @@ if (autoFocus) { |
@@ -123,3 +123,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
const createHandleListboxBlur = otherHandlers => event => { | ||
otherHandlers?.blur?.(event); | ||
otherHandlers?.onBlur?.(event); | ||
@@ -126,0 +126,0 @@ if (!event.defaultPrevented) { |
export { default } from './MultiSelectUnstyled'; | ||
export * from './MultiSelectUnstyled.types'; |
@@ -0,0 +0,0 @@ import { MultiSelectUnstyledType } from './MultiSelectUnstyled.types'; |
@@ -63,3 +63,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
const MultiSelectUnstyled = /*#__PURE__*/React.forwardRef(function MultiSelectUnstyled(props, ref) { | ||
const MultiSelectUnstyled = /*#__PURE__*/React.forwardRef(function MultiSelectUnstyled(props, forwardedRef) { | ||
var _props$renderValue, _ref, _components$Listbox, _components$Popper; | ||
@@ -105,12 +105,6 @@ | ||
const Popper = (_components$Popper = components.Popper) != null ? _components$Popper : PopperUnstyled; | ||
const handleButtonRefChange = element => { | ||
buttonRef.current = element; | ||
if (element != null) { | ||
setButtonDefined(true); | ||
} | ||
}; | ||
const handleButtonRef = useForkRef(ref, handleButtonRefChange); | ||
const handleButtonRefChange = React.useCallback(element => { | ||
setButtonDefined(element != null); | ||
}, []); | ||
const handleButtonRef = useForkRef(forwardedRef, useForkRef(buttonRef, handleButtonRefChange)); | ||
React.useEffect(() => { | ||
@@ -117,0 +111,0 @@ if (autoFocus) { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -27,3 +27,3 @@ "use strict"; | ||
href, | ||
ref, | ||
ref: externalRef, | ||
tabIndex, | ||
@@ -171,12 +171,8 @@ to, | ||
const handleOwnRef = (0, _utils.unstable_useForkRef)(focusVisibleRef, buttonRef); | ||
const handleRef = (0, _utils.unstable_useForkRef)(ref, handleOwnRef); | ||
const updateRef = instance => { | ||
const updateHostElementName = React.useCallback(instance => { | ||
var _instance$tagName; | ||
setHostElementName((_instance$tagName = instance == null ? void 0 : instance.tagName) != null ? _instance$tagName : ''); | ||
(0, _utils.unstable_setRef)(handleRef, instance); | ||
}; | ||
}, []); | ||
const handleRef = (0, _utils.unstable_useForkRef)(updateHostElementName, (0, _utils.unstable_useForkRef)(externalRef, (0, _utils.unstable_useForkRef)(focusVisibleRef, buttonRef))); | ||
const buttonProps = {}; | ||
@@ -221,3 +217,3 @@ | ||
onMouseUp: createHandleMouseUp(externalEventHandlers), | ||
ref: updateRef | ||
ref: handleRef | ||
}); | ||
@@ -224,0 +220,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/** @license MUI v5.0.0-alpha.94 | ||
/** @license MUI v5.0.0-alpha.95 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -50,8 +50,10 @@ "use strict"; | ||
function useStateChangeDetection(nextState, internalPreviousState, propsRef) { | ||
function useStateChangeDetection(nextState, internalPreviousState, propsRef, hasDispatchedActionRef) { | ||
React.useEffect(() => { | ||
if (!propsRef.current) { | ||
if (!propsRef.current || !hasDispatchedActionRef.current) { | ||
// Detect changes only if an action has been dispatched. | ||
return; | ||
} | ||
hasDispatchedActionRef.current = false; | ||
const previousState = getControlledState(internalPreviousState, propsRef.current); | ||
@@ -82,3 +84,3 @@ const { | ||
} | ||
}, [nextState.selectedValue, internalPreviousState, propsRef]); | ||
}, [nextState.selectedValue, internalPreviousState, propsRef, hasDispatchedActionRef]); | ||
React.useEffect(() => { | ||
@@ -107,2 +109,3 @@ if (!propsRef.current) { | ||
propsRef.current = props; | ||
const hasDispatchedActionRef = React.useRef(false); | ||
const initialSelectedValue = (_ref = value === undefined ? defaultValue : value) != null ? _ref : props.multiple ? [] : null; | ||
@@ -114,2 +117,4 @@ const initalState = { | ||
const combinedReducer = React.useCallback((state, action) => { | ||
hasDispatchedActionRef.current = true; | ||
if (externalReducer) { | ||
@@ -126,4 +131,4 @@ return externalReducer(getControlledState(state, propsRef.current), action); | ||
}, [previousState, nextState]); | ||
useStateChangeDetection(nextState, previousState.current, propsRef); | ||
useStateChangeDetection(nextState, previousState.current, propsRef, hasDispatchedActionRef); | ||
return [getControlledState(nextState, propsRef.current), dispatch]; | ||
} |
@@ -89,3 +89,3 @@ "use strict"; | ||
const MultiSelectUnstyled = /*#__PURE__*/React.forwardRef(function MultiSelectUnstyled(props, ref) { | ||
const MultiSelectUnstyled = /*#__PURE__*/React.forwardRef(function MultiSelectUnstyled(props, forwardedRef) { | ||
var _props$renderValue, _ref, _components$Listbox, _components$Popper; | ||
@@ -130,12 +130,6 @@ | ||
const Popper = (_components$Popper = components.Popper) != null ? _components$Popper : _PopperUnstyled.default; | ||
const handleButtonRefChange = element => { | ||
buttonRef.current = element; | ||
if (element != null) { | ||
setButtonDefined(true); | ||
} | ||
}; | ||
const handleButtonRef = (0, _utils.unstable_useForkRef)(ref, handleButtonRefChange); | ||
const handleButtonRefChange = React.useCallback(element => { | ||
setButtonDefined(element != null); | ||
}, []); | ||
const handleButtonRef = (0, _utils.unstable_useForkRef)(forwardedRef, (0, _utils.unstable_useForkRef)(buttonRef, handleButtonRefChange)); | ||
React.useEffect(() => { | ||
@@ -142,0 +136,0 @@ if (autoFocus) { |
@@ -89,3 +89,3 @@ "use strict"; | ||
const SelectUnstyled = /*#__PURE__*/React.forwardRef(function SelectUnstyled(props, ref) { | ||
const SelectUnstyled = /*#__PURE__*/React.forwardRef(function SelectUnstyled(props, forwardedRef) { | ||
var _ref, _components$Listbox, _components$Popper; | ||
@@ -131,12 +131,6 @@ | ||
const Popper = (_components$Popper = components.Popper) != null ? _components$Popper : _PopperUnstyled.default; | ||
const handleButtonRefChange = element => { | ||
buttonRef.current = element; | ||
if (element != null) { | ||
setButtonDefined(true); | ||
} | ||
}; | ||
const handleButtonRef = (0, _utils.unstable_useForkRef)(ref, handleButtonRefChange); | ||
const handleButtonRefChange = React.useCallback(element => { | ||
setButtonDefined(element != null); | ||
}, []); | ||
const handleButtonRef = (0, _utils.unstable_useForkRef)(forwardedRef, (0, _utils.unstable_useForkRef)(buttonRef, handleButtonRefChange)); | ||
React.useEffect(() => { | ||
@@ -143,0 +137,0 @@ if (autoFocus) { |
@@ -153,5 +153,5 @@ "use strict"; | ||
const createHandleListboxBlur = otherHandlers => event => { | ||
var _otherHandlers$blur; | ||
var _otherHandlers$onBlur; | ||
otherHandlers == null ? void 0 : (_otherHandlers$blur = otherHandlers.blur) == null ? void 0 : _otherHandlers$blur.call(otherHandlers, event); | ||
otherHandlers == null ? void 0 : (_otherHandlers$onBlur = otherHandlers.onBlur) == null ? void 0 : _otherHandlers$onBlur.call(otherHandlers, event); | ||
@@ -158,0 +158,0 @@ if (!event.defaultPrevented) { |
@@ -0,0 +0,0 @@ export { default } from './OptionGroupUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ import { OverrideProps } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface OptionGroupUnstyledClasses { |
@@ -0,0 +0,0 @@ export { default } from './OptionUnstyled'; |
@@ -0,0 +0,0 @@ import { OptionUnstyledType } from './OptionUnstyled.types'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface OptionUnstyledClasses { |
{ | ||
"name": "@mui/base", | ||
"version": "5.0.0-alpha.94", | ||
"version": "5.0.0-alpha.95", | ||
"private": false, | ||
@@ -40,6 +40,6 @@ "author": "MUI Team", | ||
"dependencies": { | ||
"@babel/runtime": "^7.17.2", | ||
"@babel/runtime": "^7.18.9", | ||
"@emotion/is-prop-valid": "^1.2.0", | ||
"@mui/types": "^7.1.5", | ||
"@mui/utils": "^5.9.3", | ||
"@mui/types": "^7.2.0", | ||
"@mui/utils": "^5.10.3", | ||
"@popperjs/core": "^2.11.6", | ||
@@ -46,0 +46,0 @@ "clsx": "^1.2.1", |
@@ -0,0 +0,0 @@ export interface PopperUnstyledClasses { |
import { SelectOption } from './useSelect.types'; | ||
declare const defaultOptionStringifier: <TValue>(option: SelectOption<TValue>) => string; | ||
export default defaultOptionStringifier; |
@@ -0,0 +0,0 @@ export { default } from './SelectUnstyled'; |
@@ -0,0 +0,0 @@ import { SelectUnstyledType } from './SelectUnstyled.types'; |
@@ -63,3 +63,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
const SelectUnstyled = /*#__PURE__*/React.forwardRef(function SelectUnstyled(props, ref) { | ||
const SelectUnstyled = /*#__PURE__*/React.forwardRef(function SelectUnstyled(props, forwardedRef) { | ||
var _ref, _components$Listbox, _components$Popper; | ||
@@ -106,12 +106,6 @@ | ||
const Popper = (_components$Popper = components.Popper) != null ? _components$Popper : PopperUnstyled; | ||
const handleButtonRefChange = element => { | ||
buttonRef.current = element; | ||
if (element != null) { | ||
setButtonDefined(true); | ||
} | ||
}; | ||
const handleButtonRef = useForkRef(ref, handleButtonRefChange); | ||
const handleButtonRefChange = React.useCallback(element => { | ||
setButtonDefined(element != null); | ||
}, []); | ||
const handleButtonRef = useForkRef(forwardedRef, useForkRef(buttonRef, handleButtonRefChange)); | ||
React.useEffect(() => { | ||
@@ -118,0 +112,0 @@ if (autoFocus) { |
@@ -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'; |
@@ -135,5 +135,5 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
const createHandleListboxBlur = otherHandlers => event => { | ||
var _otherHandlers$blur; | ||
var _otherHandlers$onBlur; | ||
otherHandlers == null ? void 0 : (_otherHandlers$blur = otherHandlers.blur) == null ? void 0 : _otherHandlers$blur.call(otherHandlers, event); | ||
otherHandlers == null ? void 0 : (_otherHandlers$onBlur = otherHandlers.onBlur) == null ? void 0 : _otherHandlers$onBlur.call(otherHandlers, event); | ||
@@ -140,0 +140,0 @@ if (!event.defaultPrevented) { |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import { OverridableComponent, OverridableTypeMap, OverrideProps } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface SliderUnstyledClasses { |
@@ -0,0 +0,0 @@ import { Mark, UseSliderHiddenInputProps, UseSliderParameters, UseSliderRootSlotProps, UseSliderThumbSlotProps } from './useSlider.types'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export { default } from './SwitchUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ export interface SwitchUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ import React, { HTMLInputTypeAttribute } 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 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface TablePaginationUnstyledClasses { |
@@ -0,0 +0,0 @@ export { default } from './TabPanelUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -0,0 +0,0 @@ export interface TabPanelUnstyledClasses { |
@@ -0,0 +0,0 @@ import { UseTabPanelParameters } from './useTabPanel.types'; |
@@ -0,0 +0,0 @@ export interface UseTabPanelParameters { |
@@ -0,0 +0,0 @@ export { default } from './TabsListUnstyled'; |
@@ -0,0 +0,0 @@ import { OverridableComponent } from '@mui/types'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface TabsListUnstyledClasses { |
@@ -0,0 +0,0 @@ import * as 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 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ export interface TabsUnstyledClasses { |
@@ -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 @@ import { OverrideProps, Simplify } from '@mui/types'; |
@@ -0,0 +0,0 @@ export interface TabUnstyledClasses { |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import { Simplify } from '@mui/types'; |
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" /> |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
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
2150552
43196
Updated@babel/runtime@^7.18.9
Updated@mui/types@^7.2.0
Updated@mui/utils@^5.10.3