@mui/base
Advanced tools
Comparing version 5.0.0-beta.56 to 5.0.0-beta.57
@@ -45,3 +45,3 @@ 'use client'; | ||
} = props; | ||
const buttonRef = React.useRef(); | ||
const buttonRef = React.useRef(null); | ||
let rootElementName = rootElementNameProp; | ||
@@ -48,0 +48,0 @@ if (typeof slots.root === 'string') { |
/** | ||
* @mui/base v5.0.0-beta.56 | ||
* @mui/base v5.0.0-beta.57 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MIT |
@@ -45,3 +45,3 @@ 'use client'; | ||
} = props; | ||
const buttonRef = React.useRef(); | ||
const buttonRef = React.useRef(null); | ||
let rootElementName = rootElementNameProp; | ||
@@ -48,0 +48,0 @@ if (typeof slots.root === 'string') { |
/** | ||
* @mui/base v5.0.0-beta.56 | ||
* @mui/base v5.0.0-beta.57 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MIT |
@@ -45,3 +45,3 @@ 'use client'; | ||
} = props; | ||
const tabRef = React.useRef(); | ||
const tabRef = React.useRef(null); | ||
const handleRef = useForkRef(tabRef, forwardedRef); | ||
@@ -48,0 +48,0 @@ const { |
@@ -28,3 +28,3 @@ 'use client'; | ||
} = parameters; | ||
const buttonRef = React.useRef(); | ||
const buttonRef = React.useRef(null); | ||
const [active, setActive] = React.useState(false); | ||
@@ -31,0 +31,0 @@ const [focusVisible, setFocusVisible] = React.useState(false); |
@@ -179,3 +179,3 @@ 'use client'; | ||
} = parameters; | ||
const touchId = React.useRef(); | ||
const touchId = React.useRef(undefined); | ||
// We can't use the :active browser pseudo-classes. | ||
@@ -218,3 +218,3 @@ // - The active state isn't triggered when clicking on the rail. | ||
const [focusedThumbIndex, setFocusedThumbIndex] = React.useState(-1); | ||
const sliderRef = React.useRef(); | ||
const sliderRef = React.useRef(null); | ||
const handleRef = useForkRef(ref, sliderRef); | ||
@@ -322,3 +322,3 @@ const createHandleHiddenInputFocus = otherHandlers => event => { | ||
}; | ||
const previousIndex = React.useRef(); | ||
const previousIndex = React.useRef(undefined); | ||
let axis = orientation; | ||
@@ -325,0 +325,0 @@ if (isRtl && orientation === 'horizontal') { |
@@ -37,3 +37,3 @@ 'use client'; | ||
export function useMessageBus() { | ||
const bus = React.useRef(); | ||
const bus = React.useRef(undefined); | ||
if (!bus.current) { | ||
@@ -40,0 +40,0 @@ bus.current = createMessageBus(); |
@@ -40,3 +40,2 @@ "use strict"; | ||
const Badge = exports.Badge = /*#__PURE__*/React.forwardRef(function Badge(props, forwardedRef) { | ||
var _slots$root, _slots$badge; | ||
const { | ||
@@ -69,3 +68,3 @@ badgeContent: badgeContentProp, | ||
const classes = useUtilityClasses(ownerState); | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'span'; | ||
const Root = slots.root ?? 'span'; | ||
const rootProps = (0, _utils.useSlotProps)({ | ||
@@ -81,3 +80,3 @@ elementType: Root, | ||
}); | ||
const BadgeComponent = (_slots$badge = slots.badge) != null ? _slots$badge : 'span'; | ||
const BadgeComponent = slots.badge ?? 'span'; | ||
const badgeProps = (0, _utils.useSlotProps)({ | ||
@@ -84,0 +83,0 @@ elementType: BadgeComponent, |
@@ -42,3 +42,2 @@ "use strict"; | ||
const Button = exports.Button = /*#__PURE__*/React.forwardRef(function Button(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -55,3 +54,3 @@ action, | ||
} = props; | ||
const buttonRef = React.useRef(); | ||
const buttonRef = React.useRef(null); | ||
let rootElementName = rootElementNameProp; | ||
@@ -87,3 +86,3 @@ if (typeof slots.root === 'string') { | ||
const defaultElement = other.href || other.to ? 'a' : 'button'; | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : defaultElement; | ||
const Root = slots.root ?? defaultElement; | ||
const rootProps = (0, _utils.useSlotProps)({ | ||
@@ -90,0 +89,0 @@ elementType: Root, |
@@ -218,4 +218,3 @@ "use strict"; | ||
if (tabbable.length > 0) { | ||
var _lastKeydown$current, _lastKeydown$current2; | ||
const isShiftTab = Boolean(((_lastKeydown$current = lastKeydown.current) == null ? void 0 : _lastKeydown$current.shiftKey) && ((_lastKeydown$current2 = lastKeydown.current) == null ? void 0 : _lastKeydown$current2.key) === 'Tab'); | ||
const isShiftTab = Boolean(lastKeydown.current?.shiftKey && lastKeydown.current?.key === 'Tab'); | ||
const focusNext = tabbable[0]; | ||
@@ -222,0 +221,0 @@ const focusPrevious = tabbable[tabbable.length - 1]; |
@@ -75,3 +75,2 @@ "use strict"; | ||
const FormControl = exports.FormControl = /*#__PURE__*/React.forwardRef(function FormControl(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -118,3 +117,3 @@ defaultValue, | ||
setValue(event.target.value); | ||
onChange == null || onChange(event); | ||
onChange?.(event); | ||
}, | ||
@@ -125,3 +124,3 @@ onFocus: () => { | ||
required, | ||
value: value != null ? value : '' | ||
value: value ?? '' | ||
}; | ||
@@ -136,3 +135,3 @@ }, [disabled, error, filled, focused, onChange, required, setValue, value]); | ||
}; | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const Root = slots.root ?? 'div'; | ||
const rootProps = (0, _utils.useSlotProps)({ | ||
@@ -139,0 +138,0 @@ elementType: Root, |
/** | ||
* @mui/base v5.0.0-beta.56 | ||
* @mui/base v5.0.0-beta.57 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MIT |
@@ -48,3 +48,2 @@ "use strict"; | ||
const Input = exports.Input = /*#__PURE__*/React.forwardRef(function Input(props, forwardedRef) { | ||
var _slots$root, _slots$textarea, _slots$input; | ||
const { | ||
@@ -101,3 +100,3 @@ 'aria-describedby': ariaDescribedby, | ||
}); | ||
const type = !multiline ? typeProp != null ? typeProp : 'text' : undefined; | ||
const type = !multiline ? typeProp ?? 'text' : undefined; | ||
const ownerState = { | ||
@@ -127,3 +126,3 @@ ...props, | ||
}; | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const Root = slots.root ?? 'div'; | ||
const rootProps = (0, _utils.useSlotProps)({ | ||
@@ -140,3 +139,3 @@ elementType: Root, | ||
}); | ||
const InputComponent = multiline ? (_slots$textarea = slots.textarea) != null ? _slots$textarea : 'textarea' : (_slots$input = slots.input) != null ? _slots$input : 'input'; | ||
const InputComponent = multiline ? slots.textarea ?? 'textarea' : slots.input ?? 'input'; | ||
const inputProps = (0, _utils.useSlotProps)({ | ||
@@ -143,0 +142,0 @@ elementType: InputComponent, |
@@ -45,3 +45,2 @@ "use strict"; | ||
const Menu = exports.Menu = /*#__PURE__*/React.forwardRef(function Menu(props, forwardedRef) { | ||
var _slots$root, _slots$listbox; | ||
const { | ||
@@ -66,3 +65,3 @@ actions, | ||
}); | ||
const anchor = anchorProp != null ? anchorProp : triggerElement; | ||
const anchor = anchorProp ?? triggerElement; | ||
React.useImperativeHandle(actions, () => ({ | ||
@@ -80,3 +79,3 @@ dispatch, | ||
const classes = useUtilityClasses(ownerState); | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const Root = slots.root ?? 'div'; | ||
const rootProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -93,3 +92,3 @@ elementType: Root, | ||
}); | ||
const Listbox = (_slots$listbox = slots.listbox) != null ? _slots$listbox : 'ul'; | ||
const Listbox = slots.listbox ?? 'ul'; | ||
const listboxProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -96,0 +95,0 @@ elementType: Listbox, |
@@ -31,3 +31,2 @@ "use strict"; | ||
const InnerMenuItem = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function MenuItem(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -60,3 +59,3 @@ children, | ||
const classes = useUtilityClasses(ownerState); | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'li'; | ||
const Root = slots.root ?? 'li'; | ||
const rootProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -63,0 +62,0 @@ elementType: Root, |
@@ -56,3 +56,2 @@ "use strict"; | ||
const Modal = exports.Modal = /*#__PURE__*/React.forwardRef(function Modal(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -124,3 +123,3 @@ children, | ||
} | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const Root = slots.root ?? 'div'; | ||
const rootProps = (0, _utils2.useSlotProps)({ | ||
@@ -145,3 +144,3 @@ elementType: Root, | ||
} | ||
if (otherHandlers != null && otherHandlers.onClick) { | ||
if (otherHandlers?.onClick) { | ||
otherHandlers.onClick(e); | ||
@@ -148,0 +147,0 @@ } |
@@ -33,3 +33,2 @@ "use strict"; | ||
const InnerOption = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Option(props, forwardedRef) { | ||
var _slots$root, _optionRef$current; | ||
const { | ||
@@ -44,3 +43,3 @@ children, | ||
} = props; | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'li'; | ||
const Root = slots.root ?? 'li'; | ||
const optionRef = React.useRef(null); | ||
@@ -51,3 +50,3 @@ const combinedRef = (0, _utils.unstable_useForkRef)(optionRef, forwardedRef); | ||
// This is used to populate the select's trigger with the selected option's label. | ||
const computedLabel = label != null ? label : typeof children === 'string' ? children : (_optionRef$current = optionRef.current) == null || (_optionRef$current = _optionRef$current.textContent) == null ? void 0 : _optionRef$current.trim(); | ||
const computedLabel = label ?? (typeof children === 'string' ? children : optionRef.current?.textContent?.trim()); | ||
const { | ||
@@ -54,0 +53,0 @@ getRootProps, |
@@ -45,5 +45,5 @@ "use strict"; | ||
} = props; | ||
const Root = (slots == null ? void 0 : slots.root) || 'li'; | ||
const Label = (slots == null ? void 0 : slots.label) || 'span'; | ||
const List = (slots == null ? void 0 : slots.list) || 'ul'; | ||
const Root = slots?.root || 'li'; | ||
const Label = slots?.label || 'span'; | ||
const List = slots?.list || 'ul'; | ||
const classes = useUtilityClasses(disabled); | ||
@@ -50,0 +50,0 @@ const rootProps = (0, _utils.useSlotProps)({ |
@@ -55,3 +55,2 @@ "use strict"; | ||
const PopperTooltip = /*#__PURE__*/React.forwardRef(function PopperTooltip(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -160,3 +159,3 @@ anchorEl, | ||
const classes = useUtilityClasses(); | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const Root = slots.root ?? 'div'; | ||
const rootProps = (0, _utils2.useSlotProps)({ | ||
@@ -163,0 +162,0 @@ elementType: Root, |
@@ -25,3 +25,2 @@ "use strict"; | ||
function defaultRenderValue(selectedOptions) { | ||
var _selectedOptions$labe; | ||
if (Array.isArray(selectedOptions)) { | ||
@@ -32,3 +31,3 @@ return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, { | ||
} | ||
return (_selectedOptions$labe = selectedOptions == null ? void 0 : selectedOptions.label) != null ? _selectedOptions$labe : null; | ||
return selectedOptions?.label ?? null; | ||
} | ||
@@ -62,3 +61,2 @@ function useUtilityClasses(ownerState) { | ||
const Select = exports.Select = /*#__PURE__*/React.forwardRef(function Select(props, forwardedRef) { | ||
var _slots$root, _slots$listbox, _slots$popup, _ref, _renderValue; | ||
const { | ||
@@ -88,9 +86,9 @@ areOptionsEqual, | ||
} = props; | ||
const renderValue = renderValueProp != null ? renderValueProp : defaultRenderValue; | ||
const renderValue = renderValueProp ?? defaultRenderValue; | ||
const [buttonDefined, setButtonDefined] = React.useState(false); | ||
const buttonRef = React.useRef(null); | ||
const listboxRef = React.useRef(null); | ||
const Button = (_slots$root = slots.root) != null ? _slots$root : 'button'; | ||
const ListboxRoot = (_slots$listbox = slots.listbox) != null ? _slots$listbox : 'ul'; | ||
const PopupComponent = (_slots$popup = slots.popup) != null ? _slots$popup : 'div'; | ||
const Button = slots.root ?? 'button'; | ||
const ListboxRoot = slots.listbox ?? 'ul'; | ||
const PopupComponent = slots.popup ?? 'div'; | ||
const handleButtonRefChange = React.useCallback(element => { | ||
@@ -181,4 +179,3 @@ setButtonDefined(element != null); | ||
} else { | ||
var _getOptionMetadata; | ||
selectedOptionsMetadata = (_getOptionMetadata = getOptionMetadata(value)) != null ? _getOptionMetadata : null; | ||
selectedOptionsMetadata = getOptionMetadata(value) ?? null; | ||
} | ||
@@ -188,3 +185,3 @@ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, { | ||
...buttonProps, | ||
children: (_ref = (_renderValue = renderValue(selectedOptionsMetadata)) != null ? _renderValue : placeholder) != null ? _ref : // fall back to a zero-width space to prevent layout shift | ||
children: renderValue(selectedOptionsMetadata) ?? placeholder ?? ( // fall back to a zero-width space to prevent layout shift | ||
// from https://github.com/mui/material-ui/pull/24563 | ||
@@ -194,3 +191,3 @@ _span || (_span = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", { | ||
children: "\u200B" | ||
})) | ||
}))) | ||
}), buttonDefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popup.Popup, { | ||
@@ -197,0 +194,0 @@ slots: { |
@@ -63,3 +63,2 @@ "use strict"; | ||
const Slider = exports.Slider = /*#__PURE__*/React.forwardRef(function Slider(props, forwardedRef) { | ||
var _slots$root, _slots$rail, _slots$track, _slots$thumb, _slots$mark, _slots$markLabel; | ||
const { | ||
@@ -140,3 +139,3 @@ 'aria-label': ariaLabel, | ||
const classes = useUtilityClasses(ownerState); | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'span'; | ||
const Root = slots.root ?? 'span'; | ||
const rootProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -150,3 +149,3 @@ elementType: Root, | ||
}); | ||
const Rail = (_slots$rail = slots.rail) != null ? _slots$rail : 'span'; | ||
const Rail = slots.rail ?? 'span'; | ||
const railProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -158,3 +157,3 @@ elementType: Rail, | ||
}); | ||
const Track = (_slots$track = slots.track) != null ? _slots$track : 'span'; | ||
const Track = slots.track ?? 'span'; | ||
const trackProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -172,3 +171,3 @@ elementType: Track, | ||
}); | ||
const Thumb = (_slots$thumb = slots.thumb) != null ? _slots$thumb : 'span'; | ||
const Thumb = slots.thumb ?? 'span'; | ||
const thumbProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -187,3 +186,3 @@ elementType: Thumb, | ||
}); | ||
const Mark = (_slots$mark = slots.mark) != null ? _slots$mark : 'span'; | ||
const Mark = slots.mark ?? 'span'; | ||
const markProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -195,3 +194,3 @@ elementType: Mark, | ||
}); | ||
const MarkLabel = (_slots$markLabel = slots.markLabel) != null ? _slots$markLabel : 'span'; | ||
const MarkLabel = slots.markLabel ?? 'span'; | ||
const markLabelProps = (0, _useSlotProps.useSlotProps)({ | ||
@@ -263,3 +262,3 @@ elementType: MarkLabel, | ||
...resolvedSlotProps, | ||
className: (0, _clsx.default)(classes.thumb, thumbProps.className, resolvedSlotProps == null ? void 0 : resolvedSlotProps.className, active === index && classes.active, focusedThumbIndex === index && classes.focusVisible), | ||
className: (0, _clsx.default)(classes.thumb, thumbProps.className, resolvedSlotProps?.className, active === index && classes.active, focusedThumbIndex === index && classes.focusVisible), | ||
style: { | ||
@@ -269,3 +268,3 @@ ...style, | ||
...thumbProps.style, | ||
...(resolvedSlotProps == null ? void 0 : resolvedSlotProps.style) | ||
...resolvedSlotProps?.style | ||
}, | ||
@@ -272,0 +271,0 @@ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Input, { |
@@ -47,3 +47,2 @@ "use strict"; | ||
const Switch = exports.Switch = /*#__PURE__*/React.forwardRef(function Switch(props, forwardedRef) { | ||
var _slots$root, _slots$thumb, _slots$input, _slots$track; | ||
const { | ||
@@ -78,3 +77,3 @@ checked: checkedProp, | ||
const classes = useUtilityClasses(ownerState); | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'span'; | ||
const Root = slots.root ?? 'span'; | ||
const rootProps = (0, _utils.useSlotProps)({ | ||
@@ -90,3 +89,3 @@ elementType: Root, | ||
}); | ||
const Thumb = (_slots$thumb = slots.thumb) != null ? _slots$thumb : 'span'; | ||
const Thumb = slots.thumb ?? 'span'; | ||
const thumbProps = (0, _utils.useSlotProps)({ | ||
@@ -98,3 +97,3 @@ elementType: Thumb, | ||
}); | ||
const Input = (_slots$input = slots.input) != null ? _slots$input : 'input'; | ||
const Input = slots.input ?? 'input'; | ||
const inputProps = (0, _utils.useSlotProps)({ | ||
@@ -107,3 +106,3 @@ elementType: Input, | ||
}); | ||
const Track = slots.track === null ? () => null : (_slots$track = slots.track) != null ? _slots$track : 'span'; | ||
const Track = slots.track === null ? () => null : slots.track ?? 'span'; | ||
const trackProps = (0, _utils.useSlotProps)({ | ||
@@ -110,0 +109,0 @@ elementType: Track, |
@@ -41,3 +41,2 @@ "use strict"; | ||
const Tab = exports.Tab = /*#__PURE__*/React.forwardRef(function Tab(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -55,3 +54,3 @@ action, | ||
} = props; | ||
const tabRef = React.useRef(); | ||
const tabRef = React.useRef(null); | ||
const handleRef = (0, _utils.unstable_useForkRef)(tabRef, forwardedRef); | ||
@@ -76,3 +75,3 @@ const { | ||
const classes = useUtilityClasses(ownerState); | ||
const TabRoot = (_slots$root = slots.root) != null ? _slots$root : 'button'; | ||
const TabRoot = slots.root ?? 'button'; | ||
const tabRootProps = (0, _utils2.useSlotProps)({ | ||
@@ -79,0 +78,0 @@ elementType: TabRoot, |
@@ -60,3 +60,2 @@ "use strict"; | ||
const TablePagination = exports.TablePagination = /*#__PURE__*/React.forwardRef(function TablePagination(props, forwardedRef) { | ||
var _slots$root, _slots$select, _slots$actions, _slots$menuItem, _slots$selectLabel, _slots$displayedRows, _slots$toolbar, _slots$spacer; | ||
const { | ||
@@ -82,3 +81,3 @@ colSpan: colSpanProp, | ||
let colSpan; | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'td'; | ||
const Root = slots.root ?? 'td'; | ||
if (Root === 'td' || !(0, _isHostComponent.isHostComponent)(Root)) { | ||
@@ -106,3 +105,3 @@ colSpan = colSpanProp || 1000; // col-span over everything | ||
}); | ||
const Select = (_slots$select = slots.select) != null ? _slots$select : 'select'; | ||
const Select = slots.select ?? 'select'; | ||
const selectProps = (0, _utils2.useSlotProps)({ | ||
@@ -121,3 +120,3 @@ elementType: Select, | ||
}); | ||
const Actions = (_slots$actions = slots.actions) != null ? _slots$actions : _TablePaginationActions.TablePaginationActions; | ||
const Actions = slots.actions ?? _TablePaginationActions.TablePaginationActions; | ||
const actionsProps = (0, _utils2.useSlotProps)({ | ||
@@ -136,3 +135,3 @@ elementType: Actions, | ||
}); | ||
const MenuItem = (_slots$menuItem = slots.menuItem) != null ? _slots$menuItem : 'option'; | ||
const MenuItem = slots.menuItem ?? 'option'; | ||
const menuItemProps = (0, _utils2.useSlotProps)({ | ||
@@ -147,3 +146,3 @@ elementType: MenuItem, | ||
}); | ||
const SelectLabel = (_slots$selectLabel = slots.selectLabel) != null ? _slots$selectLabel : 'p'; | ||
const SelectLabel = slots.selectLabel ?? 'p'; | ||
const selectLabelProps = (0, _utils2.useSlotProps)({ | ||
@@ -158,3 +157,3 @@ elementType: SelectLabel, | ||
}); | ||
const DisplayedRows = (_slots$displayedRows = slots.displayedRows) != null ? _slots$displayedRows : 'p'; | ||
const DisplayedRows = slots.displayedRows ?? 'p'; | ||
const displayedRowsProps = (0, _utils2.useSlotProps)({ | ||
@@ -166,3 +165,3 @@ elementType: DisplayedRows, | ||
}); | ||
const Toolbar = (_slots$toolbar = slots.toolbar) != null ? _slots$toolbar : 'div'; | ||
const Toolbar = slots.toolbar ?? 'div'; | ||
const toolbarProps = (0, _utils2.useSlotProps)({ | ||
@@ -174,3 +173,3 @@ elementType: Toolbar, | ||
}); | ||
const Spacer = (_slots$spacer = slots.spacer) != null ? _slots$spacer : 'div'; | ||
const Spacer = slots.spacer ?? 'div'; | ||
const spacerProps = (0, _utils2.useSlotProps)({ | ||
@@ -177,0 +176,0 @@ elementType: Spacer, |
@@ -42,3 +42,2 @@ "use strict"; | ||
const TablePaginationActions = exports.TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginationActions(props, forwardedRef) { | ||
var _slots$root, _slots$firstButton, _slots$lastButton, _slots$nextButton, _slots$backButton, _slots$lastPageIcon, _slots$firstPageIcon, _slots$nextPageIcon, _slots$backPageIcon; | ||
const { | ||
@@ -72,3 +71,3 @@ count, | ||
}; | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const Root = slots.root ?? 'div'; | ||
const rootProps = (0, _utils.useSlotProps)({ | ||
@@ -83,3 +82,3 @@ elementType: Root, | ||
}); | ||
const FirstButton = (_slots$firstButton = slots.firstButton) != null ? _slots$firstButton : 'button'; | ||
const FirstButton = slots.firstButton ?? 'button'; | ||
const firstButtonProps = (0, _utils.useSlotProps)({ | ||
@@ -96,3 +95,3 @@ elementType: FirstButton, | ||
}); | ||
const LastButton = (_slots$lastButton = slots.lastButton) != null ? _slots$lastButton : 'button'; | ||
const LastButton = slots.lastButton ?? 'button'; | ||
const lastButtonProps = (0, _utils.useSlotProps)({ | ||
@@ -109,3 +108,3 @@ elementType: LastButton, | ||
}); | ||
const NextButton = (_slots$nextButton = slots.nextButton) != null ? _slots$nextButton : 'button'; | ||
const NextButton = slots.nextButton ?? 'button'; | ||
const nextButtonProps = (0, _utils.useSlotProps)({ | ||
@@ -122,3 +121,3 @@ elementType: NextButton, | ||
}); | ||
const BackButton = (_slots$backButton = slots.backButton) != null ? _slots$backButton : 'button'; | ||
const BackButton = slots.backButton ?? 'button'; | ||
const backButtonProps = (0, _utils.useSlotProps)({ | ||
@@ -135,6 +134,6 @@ elementType: BackButton, | ||
}); | ||
const LastPageIcon = (_slots$lastPageIcon = slots.lastPageIcon) != null ? _slots$lastPageIcon : LastPageIconDefault; | ||
const FirstPageIcon = (_slots$firstPageIcon = slots.firstPageIcon) != null ? _slots$firstPageIcon : FirstPageIconDefault; | ||
const NextPageIcon = (_slots$nextPageIcon = slots.nextPageIcon) != null ? _slots$nextPageIcon : NextPageIconDefault; | ||
const BackPageIcon = (_slots$backPageIcon = slots.backPageIcon) != null ? _slots$backPageIcon : BackPageIconDefault; | ||
const LastPageIcon = slots.lastPageIcon ?? LastPageIconDefault; | ||
const FirstPageIcon = slots.firstPageIcon ?? FirstPageIconDefault; | ||
const NextPageIcon = slots.nextPageIcon ?? NextPageIconDefault; | ||
const BackPageIcon = slots.backPageIcon ?? BackPageIconDefault; | ||
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, { | ||
@@ -141,0 +140,0 @@ ...rootProps, |
@@ -39,3 +39,2 @@ "use strict"; | ||
const TabPanel = exports.TabPanel = /*#__PURE__*/React.forwardRef(function TabPanel(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -57,3 +56,3 @@ children, | ||
const classes = useUtilityClasses(ownerState); | ||
const TabPanelRoot = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const TabPanelRoot = slots.root ?? 'div'; | ||
const tabPanelRootProps = (0, _utils.useSlotProps)({ | ||
@@ -60,0 +59,0 @@ elementType: TabPanelRoot, |
@@ -41,3 +41,2 @@ "use strict"; | ||
const Tabs = exports.Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -64,3 +63,3 @@ children, | ||
const classes = useUtilityClasses(ownerState); | ||
const TabsRoot = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const TabsRoot = slots.root ?? 'div'; | ||
const tabsRootProps = (0, _utils.useSlotProps)({ | ||
@@ -67,0 +66,0 @@ elementType: TabsRoot, |
@@ -41,3 +41,2 @@ "use strict"; | ||
const TabsList = exports.TabsList = /*#__PURE__*/React.forwardRef(function TabsList(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -63,3 +62,3 @@ children, | ||
const classes = useUtilityClasses(ownerState); | ||
const TabsListRoot = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const TabsListRoot = slots.root ?? 'div'; | ||
const tabsListRootProps = (0, _utils.useSlotProps)({ | ||
@@ -66,0 +65,0 @@ elementType: TabsListRoot, |
@@ -51,3 +51,2 @@ "use strict"; | ||
const NumberInput = exports.NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, forwardedRef) { | ||
var _slots$root, _slots$input, _slots$incrementButto, _slots$decrementButto; | ||
const { | ||
@@ -120,3 +119,3 @@ className, | ||
}; | ||
const Root = (_slots$root = slots.root) != null ? _slots$root : 'div'; | ||
const Root = slots.root ?? 'div'; | ||
const rootProps = (0, _utils.useSlotProps)({ | ||
@@ -133,3 +132,3 @@ elementType: Root, | ||
}); | ||
const Input = (_slots$input = slots.input) != null ? _slots$input : 'input'; | ||
const Input = slots.input ?? 'input'; | ||
const inputProps = (0, _utils.useSlotProps)({ | ||
@@ -145,3 +144,3 @@ elementType: Input, | ||
}); | ||
const IncrementButton = (_slots$incrementButto = slots.incrementButton) != null ? _slots$incrementButto : 'button'; | ||
const IncrementButton = slots.incrementButton ?? 'button'; | ||
const incrementButtonProps = (0, _utils.useSlotProps)({ | ||
@@ -154,3 +153,3 @@ elementType: IncrementButton, | ||
}); | ||
const DecrementButton = (_slots$decrementButto = slots.decrementButton) != null ? _slots$decrementButto : 'button'; | ||
const DecrementButton = slots.decrementButton ?? 'button'; | ||
const decrementButtonProps = (0, _utils.useSlotProps)({ | ||
@@ -157,0 +156,0 @@ elementType: DecrementButton, |
@@ -47,3 +47,2 @@ "use strict"; | ||
const Popup = exports.Popup = /*#__PURE__*/React.forwardRef(function Popup(props, forwardedRef) { | ||
var _slots$root; | ||
const { | ||
@@ -75,3 +74,3 @@ anchor: anchorProp, | ||
open, | ||
middleware: middleware != null ? middleware : [(0, _reactDom.offset)(offsetProp != null ? offsetProp : 0), (0, _reactDom.flip)(), (0, _reactDom.shift)()], | ||
middleware: middleware ?? [(0, _reactDom.offset)(offsetProp ?? 0), (0, _reactDom.flip)(), (0, _reactDom.shift)()], | ||
placement, | ||
@@ -105,3 +104,3 @@ strategy, | ||
const classes = useUtilityClasses(ownerState); | ||
const Root = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : 'div'; | ||
const Root = slots?.root ?? 'div'; | ||
const rootProps = (0, _utils2.useSlotProps)({ | ||
@@ -108,0 +107,0 @@ elementType: Root, |
@@ -91,3 +91,3 @@ "use strict"; | ||
const containerWindow = (0, _utils.unstable_ownerWindow)(container); | ||
scrollContainer = (parent == null ? void 0 : parent.nodeName) === 'HTML' && containerWindow.getComputedStyle(parent).overflowY === 'scroll' ? parent : container; | ||
scrollContainer = parent?.nodeName === 'HTML' && containerWindow.getComputedStyle(parent).overflowY === 'scroll' ? parent : container; | ||
} | ||
@@ -94,0 +94,0 @@ |
@@ -114,4 +114,3 @@ "use strict"; | ||
const createHandleKeyDown = otherHandlers => event => { | ||
var _otherHandlers$onKeyD; | ||
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event); | ||
otherHandlers.onKeyDown?.(event); | ||
@@ -138,4 +137,3 @@ // The handler doesn't take event.defaultPrevented into account: | ||
const createHandleBackdropClick = otherHandlers => event => { | ||
var _otherHandlers$onClic; | ||
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event); | ||
otherHandlers.onClick?.(event); | ||
if (event.target !== event.currentTarget) { | ||
@@ -191,4 +189,4 @@ return; | ||
return { | ||
onEnter: (0, _utils.unstable_createChainedFunction)(handleEnter, children == null ? void 0 : children.props.onEnter), | ||
onExited: (0, _utils.unstable_createChainedFunction)(handleExited, children == null ? void 0 : children.props.onExited) | ||
onEnter: (0, _utils.unstable_createChainedFunction)(handleEnter, children?.props.onEnter), | ||
onExited: (0, _utils.unstable_createChainedFunction)(handleExited, children?.props.onExited) | ||
}; | ||
@@ -195,0 +193,0 @@ }; |
@@ -33,9 +33,9 @@ "use strict"; | ||
return { | ||
up: value + (step != null ? step : 1) * multiplier, | ||
down: value - (step != null ? step : 1) * multiplier | ||
up: value + (step ?? 1) * multiplier, | ||
down: value - (step ?? 1) * multiplier | ||
}[direction]; | ||
} | ||
return { | ||
up: min != null ? min : 1, | ||
down: max != null ? max : -1 | ||
up: min ?? 1, | ||
down: max ?? -1 | ||
}[direction]; | ||
@@ -42,0 +42,0 @@ } |
@@ -38,3 +38,2 @@ "use strict"; | ||
function useNumberInput(parameters) { | ||
var _ref; | ||
const { | ||
@@ -81,3 +80,3 @@ min, | ||
case 'numberInput:clamp': | ||
onChange == null || onChange(event, fieldValue); | ||
onChange?.(event, fieldValue); | ||
break; | ||
@@ -88,3 +87,3 @@ case 'numberInput:increment': | ||
case 'numberInput:decrementToMin': | ||
onChange == null || onChange(event, fieldValue); | ||
onChange?.(event, fieldValue); | ||
break; | ||
@@ -105,3 +104,3 @@ default: | ||
}, [min, max, step, shiftMultiplier]); | ||
const initialValue = (_ref = valueProp != null ? valueProp : defaultValueProp) != null ? _ref : null; | ||
const initialValue = valueProp ?? defaultValueProp ?? null; | ||
const initialState = { | ||
@@ -129,3 +128,3 @@ value: initialValue, | ||
setFocused(false); | ||
onBlur == null || onBlur(); | ||
onBlur?.(); | ||
} | ||
@@ -141,4 +140,3 @@ }, [formControlContext, disabledProp, focused, onBlur]); | ||
const createHandleFocus = otherHandlers => event => { | ||
var _otherHandlers$onFocu; | ||
(_otherHandlers$onFocu = otherHandlers.onFocus) == null || _otherHandlers$onFocu.call(otherHandlers, event); | ||
otherHandlers.onFocus?.(event); | ||
if (event.defaultMuiPrevented || event.defaultPrevented) { | ||
@@ -148,4 +146,3 @@ return; | ||
if (formControlContext && formControlContext.onFocus) { | ||
var _formControlContext$o; | ||
formControlContext == null || (_formControlContext$o = formControlContext.onFocus) == null || _formControlContext$o.call(formControlContext); | ||
formControlContext?.onFocus?.(); | ||
} | ||
@@ -155,8 +152,7 @@ setFocused(true); | ||
const createHandleInputChange = otherHandlers => event => { | ||
var _formControlContext$o2, _otherHandlers$onInpu; | ||
if (!isControlled && event.target === null) { | ||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Expected valid input target. Did you use a custom \`slots.input\` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info.` : (0, _formatMuiErrorMessage2.default)(17)); | ||
} | ||
formControlContext == null || (_formControlContext$o2 = formControlContext.onChange) == null || _formControlContext$o2.call(formControlContext, event); | ||
(_otherHandlers$onInpu = otherHandlers.onInputChange) == null || _otherHandlers$onInpu.call(otherHandlers, event); | ||
formControlContext?.onChange?.(event); | ||
otherHandlers.onInputChange?.(event); | ||
if (event.defaultMuiPrevented || event.defaultPrevented) { | ||
@@ -172,5 +168,4 @@ return; | ||
const createHandleBlur = otherHandlers => event => { | ||
var _otherHandlers$onBlur; | ||
formControlContext == null || formControlContext.onBlur(); | ||
(_otherHandlers$onBlur = otherHandlers.onBlur) == null || _otherHandlers$onBlur.call(otherHandlers, event); | ||
formControlContext?.onBlur(); | ||
otherHandlers.onBlur?.(event); | ||
if (event.defaultMuiPrevented || event.defaultPrevented) { | ||
@@ -187,4 +182,3 @@ return; | ||
const createHandleClick = otherHandlers => event => { | ||
var _otherHandlers$onClic; | ||
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event); | ||
otherHandlers.onClick?.(event); | ||
if (event.defaultMuiPrevented || event.defaultPrevented) { | ||
@@ -210,4 +204,3 @@ return; | ||
const createHandleKeyDown = otherHandlers => event => { | ||
var _otherHandlers$onKeyD; | ||
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event); | ||
otherHandlers.onKeyDown?.(event); | ||
if (event.defaultMuiPrevented || event.defaultPrevented) { | ||
@@ -281,3 +274,2 @@ return; | ||
const getInputProps = (externalProps = {}) => { | ||
var _ref2; | ||
const propsEventHandlers = { | ||
@@ -308,3 +300,3 @@ onBlur, | ||
}; | ||
const displayValue = (_ref2 = focused ? inputValue : value) != null ? _ref2 : ''; | ||
const displayValue = (focused ? inputValue : value) ?? ''; | ||
@@ -346,3 +338,3 @@ // get rid of slotProps.input.onInputChange before returning to prevent it from entering the DOM | ||
}; | ||
const isIncrementDisabled = disabledProp || ((0, _utils2.isNumber)(value) ? value >= (max != null ? max : Number.MAX_SAFE_INTEGER) : false); | ||
const isIncrementDisabled = disabledProp || ((0, _utils2.isNumber)(value) ? value >= (max ?? Number.MAX_SAFE_INTEGER) : false); | ||
const getIncrementButtonProps = (externalProps = {}) => { | ||
@@ -358,3 +350,3 @@ return { | ||
}; | ||
const isDecrementDisabled = disabledProp || ((0, _utils2.isNumber)(value) ? value <= (min != null ? min : Number.MIN_SAFE_INTEGER) : false); | ||
const isDecrementDisabled = disabledProp || ((0, _utils2.isNumber)(value) ? value <= (min ?? Number.MIN_SAFE_INTEGER) : false); | ||
const getDecrementButtonProps = (externalProps = {}) => { | ||
@@ -361,0 +353,0 @@ return { |
@@ -55,6 +55,3 @@ "use strict"; | ||
const pageSize = 5; | ||
const defaultIsActiveElementInListbox = listboxRef => { | ||
var _listboxRef$current$p; | ||
return listboxRef.current !== null && ((_listboxRef$current$p = listboxRef.current.parentElement) == null ? void 0 : _listboxRef$current$p.contains(document.activeElement)); | ||
}; | ||
const defaultIsActiveElementInListbox = listboxRef => listboxRef.current !== null && listboxRef.current.parentElement?.contains(document.activeElement); | ||
const MULTIPLE_DEFAULT_VALUE = []; | ||
@@ -85,6 +82,3 @@ function useAutocomplete(props) { | ||
getOptionKey, | ||
getOptionLabel: getOptionLabelProp = option => { | ||
var _option$label; | ||
return (_option$label = option.label) != null ? _option$label : option; | ||
}, | ||
getOptionLabel: getOptionLabelProp = option => option.label ?? option, | ||
groupBy, | ||
@@ -966,7 +960,6 @@ handleHomeEndKeys = !props.freeSolo, | ||
}) => { | ||
var _getOptionKey; | ||
const selected = (multiple ? value : [value]).some(value2 => value2 != null && isOptionEqualToValue(option, value2)); | ||
const disabled = getOptionDisabled ? getOptionDisabled(option) : false; | ||
return { | ||
key: (_getOptionKey = getOptionKey == null ? void 0 : getOptionKey(option)) != null ? _getOptionKey : getOptionLabel(option), | ||
key: getOptionKey?.(option) ?? getOptionLabel(option), | ||
tabIndex: -1, | ||
@@ -973,0 +966,0 @@ role: 'option', |
@@ -35,3 +35,3 @@ "use strict"; | ||
} = parameters; | ||
const buttonRef = React.useRef(); | ||
const buttonRef = React.useRef(null); | ||
const [active, setActive] = React.useState(false); | ||
@@ -43,21 +43,18 @@ const [focusVisible, setFocusVisible] = React.useState(false); | ||
const [rootElementName, updateRootElementName] = (0, _useRootElementName.useRootElementName)({ | ||
rootElementName: rootElementNameProp != null ? rootElementNameProp : href || to ? 'a' : undefined, | ||
rootElementName: rootElementNameProp ?? (href || to ? 'a' : undefined), | ||
componentName: 'Button' | ||
}); | ||
const createHandleMouseLeave = otherHandlers => event => { | ||
var _otherHandlers$onMous; | ||
if (focusVisible) { | ||
event.preventDefault(); | ||
} | ||
(_otherHandlers$onMous = otherHandlers.onMouseLeave) == null || _otherHandlers$onMous.call(otherHandlers, event); | ||
otherHandlers.onMouseLeave?.(event); | ||
}; | ||
const createHandleBlur = otherHandlers => event => { | ||
var _otherHandlers$onBlur; | ||
if (!(0, _utils.unstable_isFocusVisible)(event.target)) { | ||
setFocusVisible(false); | ||
} | ||
(_otherHandlers$onBlur = otherHandlers.onBlur) == null || _otherHandlers$onBlur.call(otherHandlers, event); | ||
otherHandlers.onBlur?.(event); | ||
}; | ||
const createHandleFocus = otherHandlers => event => { | ||
var _otherHandlers$onFocu2; | ||
// Fix for https://github.com/facebook/react/issues/7769 | ||
@@ -68,20 +65,17 @@ if (!buttonRef.current) { | ||
if ((0, _utils.unstable_isFocusVisible)(event.target)) { | ||
var _otherHandlers$onFocu; | ||
setFocusVisible(true); | ||
(_otherHandlers$onFocu = otherHandlers.onFocusVisible) == null || _otherHandlers$onFocu.call(otherHandlers, event); | ||
otherHandlers.onFocusVisible?.(event); | ||
} | ||
(_otherHandlers$onFocu2 = otherHandlers.onFocus) == null || _otherHandlers$onFocu2.call(otherHandlers, event); | ||
otherHandlers.onFocus?.(event); | ||
}; | ||
const isNativeButton = () => { | ||
const button = buttonRef.current; | ||
return rootElementName === 'BUTTON' || rootElementName === 'INPUT' && ['button', 'submit', 'reset'].includes(button == null ? void 0 : button.type) || rootElementName === 'A' && (button == null ? void 0 : button.href); | ||
return rootElementName === 'BUTTON' || rootElementName === 'INPUT' && ['button', 'submit', 'reset'].includes(button?.type) || rootElementName === 'A' && button?.href; | ||
}; | ||
const createHandleClick = otherHandlers => event => { | ||
if (!disabled) { | ||
var _otherHandlers$onClic; | ||
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event); | ||
otherHandlers.onClick?.(event); | ||
} | ||
}; | ||
const createHandleMouseDown = otherHandlers => event => { | ||
var _otherHandlers$onMous2; | ||
if (!disabled) { | ||
@@ -95,7 +89,6 @@ setActive(true); | ||
} | ||
(_otherHandlers$onMous2 = otherHandlers.onMouseDown) == null || _otherHandlers$onMous2.call(otherHandlers, event); | ||
otherHandlers.onMouseDown?.(event); | ||
}; | ||
const createHandleKeyDown = otherHandlers => event => { | ||
var _otherHandlers$onKeyD; | ||
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event); | ||
otherHandlers.onKeyDown?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -113,4 +106,3 @@ return; | ||
if (event.target === event.currentTarget && !isNativeButton() && event.key === 'Enter' && !disabled) { | ||
var _otherHandlers$onClic2; | ||
(_otherHandlers$onClic2 = otherHandlers.onClick) == null || _otherHandlers$onClic2.call(otherHandlers, event); | ||
otherHandlers.onClick?.(event); | ||
event.preventDefault(); | ||
@@ -120,3 +112,2 @@ } | ||
const createHandleKeyUp = otherHandlers => event => { | ||
var _otherHandlers$onKeyU; | ||
// calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed | ||
@@ -128,8 +119,7 @@ // https://codesandbox.io/p/sandbox/button-keyup-preventdefault-dn7f0 | ||
} | ||
(_otherHandlers$onKeyU = otherHandlers.onKeyUp) == null || _otherHandlers$onKeyU.call(otherHandlers, event); | ||
otherHandlers.onKeyUp?.(event); | ||
// Keyboard accessibility for non interactive elements | ||
if (event.target === event.currentTarget && !isNativeButton() && !disabled && event.key === ' ' && !event.defaultMuiPrevented) { | ||
var _otherHandlers$onClic3; | ||
(_otherHandlers$onClic3 = otherHandlers.onClick) == null || _otherHandlers$onClic3.call(otherHandlers, event); | ||
otherHandlers.onClick?.(event); | ||
} | ||
@@ -143,3 +133,3 @@ }; | ||
if (rootElementName === 'BUTTON') { | ||
buttonProps.type = type != null ? type : 'button'; | ||
buttonProps.type = type ?? 'button'; | ||
if (focusableWhenDisabled) { | ||
@@ -161,7 +151,7 @@ buttonProps['aria-disabled'] = disabled; | ||
buttonProps.role = 'button'; | ||
buttonProps.tabIndex = tabIndex != null ? tabIndex : 0; | ||
buttonProps.tabIndex = tabIndex ?? 0; | ||
} | ||
if (disabled) { | ||
buttonProps['aria-disabled'] = disabled; | ||
buttonProps.tabIndex = focusableWhenDisabled ? tabIndex != null ? tabIndex : 0 : -1; | ||
buttonProps.tabIndex = focusableWhenDisabled ? tabIndex ?? 0 : -1; | ||
} | ||
@@ -168,0 +158,0 @@ } |
@@ -36,3 +36,3 @@ "use strict"; | ||
if (field === 'open') { | ||
onOpenChange == null || onOpenChange(event, value); | ||
onOpenChange?.(event, value); | ||
} | ||
@@ -59,3 +59,3 @@ lastActionType.current = reason; | ||
if (!state.open && lastActionType.current !== null && lastActionType.current !== _useDropdown.DropdownActionTypes.blur) { | ||
triggerElement == null || triggerElement.focus(); | ||
triggerElement?.focus(); | ||
} | ||
@@ -62,0 +62,0 @@ }, [state.open, triggerElement]); |
@@ -45,7 +45,6 @@ "use strict"; | ||
if (formControlContext) { | ||
var _formControlContext$d, _formControlContext$e, _formControlContext$r; | ||
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; | ||
disabled = formControlContext.disabled ?? false; | ||
error = formControlContext.error ?? false; | ||
required = formControlContext.required ?? false; | ||
value = formControlContext.value; | ||
@@ -86,17 +85,15 @@ if (process.env.NODE_ENV !== 'production') { | ||
// @ts-ignore | ||
onBlur == null || onBlur(); | ||
onBlur?.(); | ||
} | ||
}, [formControlContext, disabled, focused, onBlur]); | ||
const handleFocus = otherHandlers => event => { | ||
var _otherHandlers$onFocu; | ||
// Fix a bug with IE11 where the focus/blur events are triggered | ||
// while the component is disabled. | ||
if (formControlContext != null && formControlContext.disabled) { | ||
if (formControlContext?.disabled) { | ||
event.stopPropagation(); | ||
return; | ||
} | ||
(_otherHandlers$onFocu = otherHandlers.onFocus) == null || _otherHandlers$onFocu.call(otherHandlers, event); | ||
otherHandlers.onFocus?.(event); | ||
if (formControlContext && formControlContext.onFocus) { | ||
var _formControlContext$o; | ||
formControlContext == null || (_formControlContext$o = formControlContext.onFocus) == null || _formControlContext$o.call(formControlContext); | ||
formControlContext?.onFocus?.(); | ||
} else { | ||
@@ -107,4 +104,3 @@ setFocused(true); | ||
const handleBlur = otherHandlers => event => { | ||
var _otherHandlers$onBlur; | ||
(_otherHandlers$onBlur = otherHandlers.onBlur) == null || _otherHandlers$onBlur.call(otherHandlers, event); | ||
otherHandlers.onBlur?.(event); | ||
if (formControlContext && formControlContext.onBlur) { | ||
@@ -117,3 +113,2 @@ formControlContext.onBlur(); | ||
const handleChange = otherHandlers => (event, ...args) => { | ||
var _formControlContext$o2, _otherHandlers$onChan; | ||
if (!isControlled) { | ||
@@ -125,13 +120,12 @@ const element = event.target || inputRef.current; | ||
} | ||
formControlContext == null || (_formControlContext$o2 = formControlContext.onChange) == null || _formControlContext$o2.call(formControlContext, event); | ||
formControlContext?.onChange?.(event); | ||
// @ts-ignore | ||
(_otherHandlers$onChan = otherHandlers.onChange) == null || _otherHandlers$onChan.call(otherHandlers, event, ...args); | ||
otherHandlers.onChange?.(event, ...args); | ||
}; | ||
const handleClick = otherHandlers => event => { | ||
var _otherHandlers$onClic; | ||
if (inputRef.current && event.currentTarget === event.target) { | ||
inputRef.current.focus(); | ||
} | ||
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event); | ||
otherHandlers.onClick?.(event); | ||
}; | ||
@@ -138,0 +132,0 @@ const getRootProps = (externalProps = {}) => { |
@@ -54,3 +54,2 @@ "use strict"; | ||
function moveHighlight(previouslyHighlightedValue, offset, context) { | ||
var _items$nextIndex; | ||
const { | ||
@@ -124,3 +123,3 @@ items, | ||
} | ||
return (_items$nextIndex = items[nextIndex]) != null ? _items$nextIndex : null; | ||
return items[nextIndex] ?? null; | ||
} | ||
@@ -276,4 +275,3 @@ | ||
function textCriteriaMatches(nextFocus, searchString, stringifyItem) { | ||
var _stringifyItem; | ||
const text = (_stringifyItem = stringifyItem(nextFocus)) == null ? void 0 : _stringifyItem.trim().toLowerCase(); | ||
const text = stringifyItem(nextFocus)?.trim().toLowerCase(); | ||
if (!text || text.length === 0) { | ||
@@ -314,3 +312,2 @@ // Make item not navigable if stringification fails or results in empty string. | ||
function handleItemsChange(items, previousItems, state, context) { | ||
var _state$selectedValues; | ||
const { | ||
@@ -322,4 +319,3 @@ itemComparer, | ||
if (state.highlightedValue != null) { | ||
var _items$find; | ||
newHighlightedValue = (_items$find = items.find(item => itemComparer(item, state.highlightedValue))) != null ? _items$find : null; | ||
newHighlightedValue = items.find(item => itemComparer(item, state.highlightedValue)) ?? null; | ||
} else if (focusManagement === 'DOM' && previousItems.length === 0) { | ||
@@ -330,3 +326,3 @@ newHighlightedValue = moveHighlight(null, 'reset', context); | ||
// exclude selected values that are no longer in the items list | ||
const selectedValues = (_state$selectedValues = state.selectedValues) != null ? _state$selectedValues : []; | ||
const selectedValues = state.selectedValues ?? []; | ||
const newSelectedValues = selectedValues.filter(selectedValue => items.some(item => itemComparer(item, selectedValue))); | ||
@@ -333,0 +329,0 @@ return { |
@@ -83,6 +83,5 @@ "use strict"; | ||
const handleHighlightChange = React.useCallback((event, value, reason) => { | ||
onHighlightChange == null || onHighlightChange(event, value, reason); | ||
onHighlightChange?.(event, value, reason); | ||
if (focusManagement === 'DOM' && value != null && (reason === _listActions.ListActionTypes.itemClick || reason === _listActions.ListActionTypes.keyDown || reason === _listActions.ListActionTypes.textNavigation)) { | ||
var _getItemDomElement; | ||
getItemDomElement == null || (_getItemDomElement = getItemDomElement(value)) == null || _getItemDomElement.focus(); | ||
getItemDomElement?.(value)?.focus(); | ||
} | ||
@@ -97,3 +96,3 @@ }, [getItemDomElement, onHighlightChange, focusManagement]); | ||
const handleStateChange = React.useCallback((event, field, value, reason, state) => { | ||
onStateChange == null || onStateChange(event, field, value, reason, state); | ||
onStateChange?.(event, field, value, reason, state); | ||
switch (field) { | ||
@@ -104,3 +103,3 @@ case 'highlightedValue': | ||
case 'selectedValues': | ||
onChange == null || onChange(event, value, reason); | ||
onChange?.(event, value, reason); | ||
break; | ||
@@ -131,3 +130,3 @@ default: | ||
const initialState = getInitialState(); | ||
const reducer = externalReducer != null ? externalReducer : _listReducer.listReducer; | ||
const reducer = externalReducer ?? _listReducer.listReducer; | ||
const actionContext = React.useMemo(() => ({ | ||
@@ -169,7 +168,6 @@ ...reducerActionContext, | ||
previousItems.current = items; | ||
onItemsChange == null || onItemsChange(items); | ||
onItemsChange?.(items); | ||
}, [items, itemComparer, dispatch, onItemsChange]); | ||
const createHandleKeyDown = externalHandlers => event => { | ||
var _externalHandlers$onK; | ||
(_externalHandlers$onK = externalHandlers.onKeyDown) == null || _externalHandlers$onK.call(externalHandlers, event); | ||
externalHandlers.onKeyDown?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -202,8 +200,7 @@ return; | ||
const createHandleBlur = externalHandlers => event => { | ||
var _externalHandlers$onB, _listRef$current; | ||
(_externalHandlers$onB = externalHandlers.onBlur) == null || _externalHandlers$onB.call(externalHandlers, event); | ||
externalHandlers.onBlur?.(event); | ||
if (event.defaultMuiPrevented) { | ||
return; | ||
} | ||
if ((_listRef$current = listRef.current) != null && _listRef$current.contains(event.relatedTarget)) { | ||
if (listRef.current?.contains(event.relatedTarget)) { | ||
// focus remains within the list | ||
@@ -230,3 +227,3 @@ return; | ||
const getItemState = React.useCallback(item => { | ||
const selected = (selectedValues != null ? selectedValues : []).some(value => value != null && itemComparer(item, value)); | ||
const selected = (selectedValues ?? []).some(value => value != null && itemComparer(item, value)); | ||
const highlighted = highlightedValue != null && itemComparer(item, highlightedValue); | ||
@@ -233,0 +230,0 @@ const focusable = focusManagement === 'DOM'; |
@@ -40,4 +40,3 @@ "use strict"; | ||
const createHandleClick = React.useCallback(externalHandlers => event => { | ||
var _externalHandlers$onC; | ||
(_externalHandlers$onC = externalHandlers.onClick) == null || _externalHandlers$onC.call(externalHandlers, event); | ||
externalHandlers.onClick?.(event); | ||
if (event.defaultPrevented) { | ||
@@ -58,4 +57,3 @@ return; | ||
const createHandlePointerOver = React.useCallback(externalHandlers => event => { | ||
var _externalHandlers$onM; | ||
(_externalHandlers$onM = externalHandlers.onMouseOver) == null || _externalHandlers$onM.call(externalHandlers, event); | ||
externalHandlers.onMouseOver?.(event); | ||
if (event.defaultPrevented) { | ||
@@ -62,0 +60,0 @@ return; |
@@ -33,9 +33,7 @@ "use strict"; | ||
if (action.type === _useList.ListActionTypes.blur) { | ||
var _action$context$listb; | ||
if (!((_action$context$listb = action.context.listboxRef.current) != null && _action$context$listb.contains(action.event.relatedTarget))) { | ||
var _action$context$listb2, _action$event$related; | ||
if (!action.context.listboxRef.current?.contains(action.event.relatedTarget)) { | ||
// To prevent the menu from closing when the focus leaves the menu to the button. | ||
// For more details, see https://github.com/mui/material-ui/pull/36917#issuecomment-1566992698 | ||
const listboxId = (_action$context$listb2 = action.context.listboxRef.current) == null ? void 0 : _action$context$listb2.getAttribute('id'); | ||
const controlledBy = (_action$event$related = action.event.relatedTarget) == null ? void 0 : _action$event$related.getAttribute('aria-controls'); | ||
const listboxId = action.context.listboxRef.current?.getAttribute('id'); | ||
const controlledBy = action.event.relatedTarget?.getAttribute('aria-controls'); | ||
if (listboxId && controlledBy && listboxId === controlledBy) { | ||
@@ -42,0 +40,0 @@ return newState; |
@@ -42,3 +42,2 @@ "use strict"; | ||
function useMenu(parameters = {}) { | ||
var _useId, _React$useContext; | ||
const { | ||
@@ -55,3 +54,3 @@ listboxRef: listboxRefProp, | ||
const handleRef = (0, _utils.unstable_useForkRef)(rootRef, listboxRefProp); | ||
const listboxId = (_useId = (0, _utils.unstable_useId)(idParam)) != null ? _useId : ''; | ||
const listboxId = (0, _utils.unstable_useId)(idParam) ?? ''; | ||
const { | ||
@@ -65,3 +64,3 @@ state: { | ||
registerPopup | ||
} = (_React$useContext = React.useContext(_DropdownContext.DropdownContext)) != null ? _React$useContext : FALLBACK_MENU_CONTEXT; | ||
} = React.useContext(_DropdownContext.DropdownContext) ?? FALLBACK_MENU_CONTEXT; | ||
@@ -77,16 +76,9 @@ // store the initial open state to prevent focus stealing | ||
const getItemDomElement = React.useCallback(itemId => { | ||
var _subitems$get$ref$cur, _subitems$get; | ||
if (itemId == null) { | ||
return null; | ||
} | ||
return (_subitems$get$ref$cur = (_subitems$get = subitems.get(itemId)) == null ? void 0 : _subitems$get.ref.current) != null ? _subitems$get$ref$cur : null; | ||
return subitems.get(itemId)?.ref.current ?? null; | ||
}, [subitems]); | ||
const isItemDisabled = React.useCallback(id => { | ||
var _subitems$get2; | ||
return (subitems == null || (_subitems$get2 = subitems.get(id)) == null ? void 0 : _subitems$get2.disabled) || false; | ||
}, [subitems]); | ||
const getItemAsString = React.useCallback(id => { | ||
var _subitems$get3, _subitems$get4; | ||
return ((_subitems$get3 = subitems.get(id)) == null ? void 0 : _subitems$get3.label) || ((_subitems$get4 = subitems.get(id)) == null || (_subitems$get4 = _subitems$get4.ref.current) == null ? void 0 : _subitems$get4.innerText); | ||
}, [subitems]); | ||
const isItemDisabled = React.useCallback(id => subitems?.get(id)?.disabled || false, [subitems]); | ||
const getItemAsString = React.useCallback(id => subitems.get(id)?.label || subitems.get(id)?.ref.current?.innerText, [subitems]); | ||
const reducerActionContext = React.useMemo(() => ({ | ||
@@ -126,3 +118,3 @@ listboxRef: rootRef | ||
(0, _utils.unstable_useEnhancedEffect)(() => { | ||
if (open && (changeReason == null ? void 0 : changeReason.type) === 'keydown' && changeReason.key === 'ArrowUp') { | ||
if (open && changeReason?.type === 'keydown' && changeReason.key === 'ArrowUp') { | ||
listDispatch({ | ||
@@ -136,21 +128,17 @@ type: _useList.ListActionTypes.highlightLast, | ||
if (open && autoFocus && highlightedValue && !isInitiallyOpen.current) { | ||
var _subitems$get5; | ||
(_subitems$get5 = subitems.get(highlightedValue)) == null || (_subitems$get5 = _subitems$get5.ref) == null || (_subitems$get5 = _subitems$get5.current) == null || _subitems$get5.focus(); | ||
subitems.get(highlightedValue)?.ref?.current?.focus(); | ||
} | ||
}, [open, autoFocus, highlightedValue, subitems, subitemKeys]); | ||
React.useEffect(() => { | ||
var _rootRef$current; | ||
// set focus to the highlighted item (but prevent stealing focus from other elements on the page) | ||
if ((_rootRef$current = rootRef.current) != null && _rootRef$current.contains(document.activeElement) && highlightedValue !== null) { | ||
var _subitems$get6; | ||
subitems == null || (_subitems$get6 = subitems.get(highlightedValue)) == null || (_subitems$get6 = _subitems$get6.ref.current) == null || _subitems$get6.focus(); | ||
if (rootRef.current?.contains(document.activeElement) && highlightedValue !== null) { | ||
subitems?.get(highlightedValue)?.ref.current?.focus(); | ||
} | ||
}, [highlightedValue, subitems]); | ||
const createHandleBlur = otherHandlers => event => { | ||
var _otherHandlers$onBlur, _rootRef$current2; | ||
(_otherHandlers$onBlur = otherHandlers.onBlur) == null || _otherHandlers$onBlur.call(otherHandlers, event); | ||
otherHandlers.onBlur?.(event); | ||
if (event.defaultMuiPrevented) { | ||
return; | ||
} | ||
if ((_rootRef$current2 = rootRef.current) != null && _rootRef$current2.contains(event.relatedTarget) || event.relatedTarget === triggerElement) { | ||
if (rootRef.current?.contains(event.relatedTarget) || event.relatedTarget === triggerElement) { | ||
return; | ||
@@ -164,4 +152,3 @@ } | ||
const createHandleKeyDown = otherHandlers => event => { | ||
var _otherHandlers$onKeyD; | ||
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event); | ||
otherHandlers.onKeyDown?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -168,0 +155,0 @@ return; |
@@ -54,4 +54,3 @@ "use strict"; | ||
const createHandleClick = otherHandlers => event => { | ||
var _otherHandlers$onClic; | ||
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event); | ||
otherHandlers.onClick?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -66,4 +65,3 @@ return; | ||
const createHandleKeyDown = otherHandlers => event => { | ||
var _otherHandlers$onKeyD; | ||
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event); | ||
otherHandlers.onKeyDown?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -70,0 +68,0 @@ return; |
@@ -45,3 +45,2 @@ "use strict"; | ||
function useMenuItem(params) { | ||
var _React$useContext; | ||
const { | ||
@@ -58,3 +57,3 @@ disabled = false, | ||
disabled, | ||
id: id != null ? id : '', | ||
id: id ?? '', | ||
label, | ||
@@ -65,3 +64,3 @@ ref: itemRef | ||
dispatch | ||
} = (_React$useContext = React.useContext(_DropdownContext.DropdownContext)) != null ? _React$useContext : FALLBACK_MENU_CONTEXT; | ||
} = React.useContext(_DropdownContext.DropdownContext) ?? FALLBACK_MENU_CONTEXT; | ||
const { | ||
@@ -77,3 +76,3 @@ getRootProps: getListRootProps, | ||
totalItemCount | ||
} = (0, _useCompound.useCompoundItem)(id != null ? id : idGenerator, itemMetadata); | ||
} = (0, _useCompound.useCompoundItem)(id ?? idGenerator, itemMetadata); | ||
const { | ||
@@ -95,4 +94,3 @@ getRootProps: getButtonProps, | ||
const createHandleClick = otherHandlers => event => { | ||
var _otherHandlers$onClic; | ||
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event); | ||
otherHandlers.onClick?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -99,0 +97,0 @@ return; |
@@ -63,4 +63,3 @@ "use strict"; | ||
const createHandleKeyDown = otherHandlers => event => { | ||
var _otherHandlers$onKeyD; | ||
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event); | ||
otherHandlers.onKeyDown?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -67,0 +66,0 @@ return; |
@@ -19,4 +19,3 @@ "use strict"; | ||
if (action.type === _useSelect.SelectActionTypes.buttonClick) { | ||
var _state$selectedValues; | ||
const itemToHighlight = (_state$selectedValues = state.selectedValues[0]) != null ? _state$selectedValues : (0, _useList.moveHighlight)(null, 'start', action.context); | ||
const itemToHighlight = state.selectedValues[0] ?? (0, _useList.moveHighlight)(null, 'start', action.context); | ||
return { | ||
@@ -43,15 +42,13 @@ ...state, | ||
if (action.event.key === 'ArrowDown') { | ||
var _state$selectedValues2; | ||
return { | ||
...state, | ||
open: true, | ||
highlightedValue: (_state$selectedValues2 = state.selectedValues[0]) != null ? _state$selectedValues2 : (0, _useList.moveHighlight)(null, 'start', action.context) | ||
highlightedValue: state.selectedValues[0] ?? (0, _useList.moveHighlight)(null, 'start', action.context) | ||
}; | ||
} | ||
if (action.event.key === 'ArrowUp') { | ||
var _state$selectedValues3; | ||
return { | ||
...state, | ||
open: true, | ||
highlightedValue: (_state$selectedValues3 = state.selectedValues[0]) != null ? _state$selectedValues3 : (0, _useList.moveHighlight)(null, 'end', action.context) | ||
highlightedValue: state.selectedValues[0] ?? (0, _useList.moveHighlight)(null, 'end', action.context) | ||
}; | ||
@@ -58,0 +55,0 @@ } |
@@ -27,3 +27,3 @@ "use strict"; | ||
} | ||
if ((selectedOption == null ? void 0 : selectedOption.value) == null) { | ||
if (selectedOption?.value == null) { | ||
return ''; | ||
@@ -129,5 +129,4 @@ } | ||
const isItemDisabled = React.useCallback(valueToCheck => { | ||
var _option$disabled; | ||
const option = getOptionByValue(valueToCheck); | ||
return (_option$disabled = option == null ? void 0 : option.disabled) != null ? _option$disabled : false; | ||
return option?.disabled ?? false; | ||
}, [getOptionByValue]); | ||
@@ -145,23 +144,18 @@ const stringifyOption = React.useCallback(valueToCheck => { | ||
}), [value, openProp]); | ||
const getItemId = React.useCallback(itemValue => { | ||
var _options$get; | ||
return (_options$get = options.get(itemValue)) == null ? void 0 : _options$get.id; | ||
}, [options]); | ||
const getItemId = React.useCallback(itemValue => options.get(itemValue)?.id, [options]); | ||
const handleSelectionChange = React.useCallback((event, newValues) => { | ||
if (multiple) { | ||
onChange == null || onChange(event, newValues); | ||
onChange?.(event, newValues); | ||
} else { | ||
var _newValues$; | ||
onChange == null || onChange(event, (_newValues$ = newValues[0]) != null ? _newValues$ : null); | ||
onChange?.(event, newValues[0] ?? null); | ||
} | ||
}, [multiple, onChange]); | ||
const handleHighlightChange = React.useCallback((event, newValue) => { | ||
onHighlightChange == null || onHighlightChange(event, newValue != null ? newValue : null); | ||
onHighlightChange?.(event, newValue ?? null); | ||
}, [onHighlightChange]); | ||
const handleStateChange = React.useCallback((event, field, fieldValue) => { | ||
if (field === 'open') { | ||
onOpenChange == null || onOpenChange(fieldValue); | ||
if (fieldValue === false && (event == null ? void 0 : event.type) !== 'blur') { | ||
var _buttonRef$current; | ||
(_buttonRef$current = buttonRef.current) == null || _buttonRef$current.focus(); | ||
onOpenChange?.(fieldValue); | ||
if (fieldValue === false && event?.type !== 'blur') { | ||
buttonRef.current?.focus(); | ||
} | ||
@@ -171,17 +165,13 @@ } | ||
const getItemDomElement = React.useCallback(itemId => { | ||
var _subitems$get$ref$cur, _subitems$get; | ||
if (itemId == null) { | ||
return null; | ||
} | ||
return (_subitems$get$ref$cur = (_subitems$get = subitems.get(itemId)) == null ? void 0 : _subitems$get.ref.current) != null ? _subitems$get$ref$cur : null; | ||
return subitems.get(itemId)?.ref.current ?? null; | ||
}, [subitems]); | ||
const useListParameters = { | ||
getInitialState: () => { | ||
var _defaultValue; | ||
return { | ||
highlightedValue: null, | ||
selectedValues: (_defaultValue = defaultValue) != null ? _defaultValue : [], | ||
open: defaultOpen | ||
}; | ||
}, | ||
getInitialState: () => ({ | ||
highlightedValue: null, | ||
selectedValues: defaultValue ?? [], | ||
open: defaultOpen | ||
}), | ||
getItemId, | ||
@@ -223,5 +213,4 @@ controlledProps: controlledState, | ||
if (open && highlightedOption !== null) { | ||
var _getOptionByValue; | ||
const optionRef = (_getOptionByValue = getOptionByValue(highlightedOption)) == null ? void 0 : _getOptionByValue.ref; | ||
if (!listboxRef.current || !(optionRef != null && optionRef.current)) { | ||
const optionRef = getOptionByValue(highlightedOption)?.ref; | ||
if (!listboxRef.current || !optionRef?.current) { | ||
return; | ||
@@ -245,4 +234,3 @@ } | ||
const createHandleButtonClick = externalEventHandlers => event => { | ||
var _externalEventHandler; | ||
externalEventHandlers == null || (_externalEventHandler = externalEventHandlers.onClick) == null || _externalEventHandler.call(externalEventHandlers, event); | ||
externalEventHandlers?.onClick?.(event); | ||
if (!event.defaultMuiPrevented) { | ||
@@ -257,4 +245,3 @@ const action = { | ||
const createHandleButtonKeyDown = otherHandlers => event => { | ||
var _otherHandlers$onKeyD; | ||
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event); | ||
otherHandlers.onKeyDown?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -294,8 +281,7 @@ return; | ||
const createListboxHandleBlur = otherHandlers => event => { | ||
var _otherHandlers$onBlur, _listboxRef$current; | ||
(_otherHandlers$onBlur = otherHandlers.onBlur) == null || _otherHandlers$onBlur.call(otherHandlers, event); | ||
otherHandlers.onBlur?.(event); | ||
if (event.defaultMuiPrevented) { | ||
return; | ||
} | ||
if ((_listboxRef$current = listboxRef.current) != null && _listboxRef$current.contains(event.relatedTarget) || event.relatedTarget === buttonRef.current) { | ||
if (listboxRef.current?.contains(event.relatedTarget) || event.relatedTarget === buttonRef.current) { | ||
event.defaultMuiPrevented = true; | ||
@@ -337,8 +323,6 @@ } | ||
} else { | ||
var _getOptionMetadata; | ||
selectedOptionsMetadata = (_getOptionMetadata = getOptionMetadata(selectValue)) != null ? _getOptionMetadata : null; | ||
selectedOptionsMetadata = getOptionMetadata(selectValue) ?? null; | ||
} | ||
const createHandleHiddenInputChange = externalEventHandlers => event => { | ||
var _externalEventHandler2; | ||
externalEventHandlers == null || (_externalEventHandler2 = externalEventHandlers.onChange) == null || _externalEventHandler2.call(externalEventHandlers, event); | ||
externalEventHandlers?.onChange?.(event); | ||
if (event.defaultMuiPrevented) { | ||
@@ -345,0 +329,0 @@ return; |
@@ -20,6 +20,5 @@ "use strict"; | ||
function findClosest(values, currentValue) { | ||
var _values$reduce; | ||
const { | ||
index: closestIndex | ||
} = (_values$reduce = values.reduce((acc, value, index) => { | ||
} = values.reduce((acc, value, index) => { | ||
const distance = Math.abs(currentValue - value); | ||
@@ -33,3 +32,3 @@ if (acc === null || distance < acc.distance || distance === acc.distance) { | ||
return acc; | ||
}, null)) != null ? _values$reduce : {}; | ||
}, null) ?? {}; | ||
return closestIndex; | ||
@@ -94,7 +93,5 @@ } | ||
}) { | ||
var _sliderRef$current, _doc$activeElement; | ||
const doc = (0, _utils.unstable_ownerDocument)(sliderRef.current); | ||
if (!((_sliderRef$current = sliderRef.current) != null && _sliderRef$current.contains(doc.activeElement)) || Number(doc == null || (_doc$activeElement = doc.activeElement) == null ? void 0 : _doc$activeElement.getAttribute('data-index')) !== activeIndex) { | ||
var _sliderRef$current2; | ||
(_sliderRef$current2 = sliderRef.current) == null || _sliderRef$current2.querySelector(`[type="range"][data-index="${activeIndex}"]`).focus(); | ||
if (!sliderRef.current?.contains(doc.activeElement) || Number(doc?.activeElement?.getAttribute('data-index')) !== activeIndex) { | ||
sliderRef.current?.querySelector(`[type="range"][data-index="${activeIndex}"]`).focus(); | ||
} | ||
@@ -195,3 +192,3 @@ if (setActive) { | ||
} = parameters; | ||
const touchId = React.useRef(); | ||
const touchId = React.useRef(undefined); | ||
// We can't use the :active browser pseudo-classes. | ||
@@ -206,3 +203,3 @@ // - The active state isn't triggered when clicking on the rail. | ||
controlled: valueProp, | ||
default: defaultValue != null ? defaultValue : min, | ||
default: defaultValue ?? min, | ||
name: 'Slider' | ||
@@ -235,6 +232,5 @@ }); | ||
const [focusedThumbIndex, setFocusedThumbIndex] = React.useState(-1); | ||
const sliderRef = React.useRef(); | ||
const sliderRef = React.useRef(null); | ||
const handleRef = (0, _utils.unstable_useForkRef)(ref, sliderRef); | ||
const createHandleHiddenInputFocus = otherHandlers => event => { | ||
var _otherHandlers$onFocu; | ||
const index = Number(event.currentTarget.getAttribute('data-index')); | ||
@@ -245,6 +241,5 @@ if ((0, _utils.unstable_isFocusVisible)(event.target)) { | ||
setOpen(index); | ||
otherHandlers == null || (_otherHandlers$onFocu = otherHandlers.onFocus) == null || _otherHandlers$onFocu.call(otherHandlers, event); | ||
otherHandlers?.onFocus?.(event); | ||
}; | ||
const createHandleHiddenInputBlur = otherHandlers => event => { | ||
var _otherHandlers$onBlur; | ||
if (!(0, _utils.unstable_isFocusVisible)(event.target)) { | ||
@@ -254,3 +249,3 @@ setFocusedThumbIndex(-1); | ||
setOpen(-1); | ||
otherHandlers == null || (_otherHandlers$onBlur = otherHandlers.onBlur) == null || _otherHandlers$onBlur.call(otherHandlers, event); | ||
otherHandlers?.onBlur?.(event); | ||
}; | ||
@@ -305,3 +300,2 @@ const changeValue = (event, valueInput) => { | ||
const createHandleHiddenInputKeyDown = otherHandlers => event => { | ||
var _otherHandlers$onKeyD; | ||
// The Shift + Up/Down keyboard shortcuts for moving the slider makes sense to be supported | ||
@@ -323,7 +317,6 @@ // only if the step is defined. If the step is null, this means tha the marks are used for specifying the valid values. | ||
} | ||
otherHandlers == null || (_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event); | ||
otherHandlers?.onKeyDown?.(event); | ||
}; | ||
(0, _utils.unstable_useEnhancedEffect)(() => { | ||
if (disabled && sliderRef.current.contains(document.activeElement)) { | ||
var _document$activeEleme; | ||
// This is necessary because Firefox and Safari will keep focus | ||
@@ -333,3 +326,3 @@ // on a disabled element: | ||
// @ts-ignore | ||
(_document$activeEleme = document.activeElement) == null || _document$activeEleme.blur(); | ||
document.activeElement?.blur(); | ||
} | ||
@@ -344,8 +337,7 @@ }, [disabled]); | ||
const createHandleHiddenInputChange = otherHandlers => event => { | ||
var _otherHandlers$onChan; | ||
(_otherHandlers$onChan = otherHandlers.onChange) == null || _otherHandlers$onChan.call(otherHandlers, event); | ||
otherHandlers.onChange?.(event); | ||
// @ts-ignore | ||
changeValue(event, event.target.valueAsNumber); | ||
}; | ||
const previousIndex = React.useRef(); | ||
const previousIndex = React.useRef(undefined); | ||
let axis = orientation; | ||
@@ -539,4 +531,3 @@ if (isRtl && orientation === 'horizontal') { | ||
const createHandleMouseDown = otherHandlers => event => { | ||
var _otherHandlers$onMous; | ||
(_otherHandlers$onMous = otherHandlers.onMouseDown) == null || _otherHandlers$onMous.call(otherHandlers, event); | ||
otherHandlers.onMouseDown?.(event); | ||
if (disabled) { | ||
@@ -599,4 +590,3 @@ return; | ||
const createHandleMouseOver = otherHandlers => event => { | ||
var _otherHandlers$onMous2; | ||
(_otherHandlers$onMous2 = otherHandlers.onMouseOver) == null || _otherHandlers$onMous2.call(otherHandlers, event); | ||
otherHandlers.onMouseOver?.(event); | ||
const index = Number(event.currentTarget.getAttribute('data-index')); | ||
@@ -606,4 +596,3 @@ setOpen(index); | ||
const createHandleMouseLeave = otherHandlers => event => { | ||
var _otherHandlers$onMous3; | ||
(_otherHandlers$onMous3 = otherHandlers.onMouseLeave) == null || _otherHandlers$onMous3.call(otherHandlers, event); | ||
otherHandlers.onMouseLeave?.(event); | ||
setOpen(-1); | ||
@@ -630,3 +619,2 @@ }; | ||
const getHiddenInputProps = (externalProps = {}) => { | ||
var _parameters$step; | ||
const externalHandlers = (0, _utils2.extractEventHandlers)(externalProps); | ||
@@ -653,3 +641,3 @@ const ownEventHandlers = { | ||
max: parameters.max, | ||
step: parameters.step === null && parameters.marks ? 'any' : (_parameters$step = parameters.step) != null ? _parameters$step : undefined, | ||
step: parameters.step === null && parameters.marks ? 'any' : parameters.step ?? undefined, | ||
disabled, | ||
@@ -656,0 +644,0 @@ ...externalProps, |
@@ -45,3 +45,3 @@ "use strict"; | ||
// not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar | ||
onClose == null || onClose(nativeEvent, 'escapeKeyDown'); | ||
onClose?.(nativeEvent, 'escapeKeyDown'); | ||
} | ||
@@ -56,3 +56,3 @@ } | ||
const handleClose = (0, _utils.unstable_useEventCallback)((event, reason) => { | ||
onClose == null || onClose(event, reason); | ||
onClose?.(event, reason); | ||
}); | ||
@@ -74,3 +74,3 @@ const setAutoHideTimer = (0, _utils.unstable_useEventCallback)(autoHideDurationParam => { | ||
const handleClickAway = event => { | ||
onClose == null || onClose(event, 'clickaway'); | ||
onClose?.(event, 'clickaway'); | ||
}; | ||
@@ -91,3 +91,3 @@ | ||
const onBlurCallback = otherHandlers.onBlur; | ||
onBlurCallback == null || onBlurCallback(event); | ||
onBlurCallback?.(event); | ||
handleResume(); | ||
@@ -97,3 +97,3 @@ }; | ||
const onFocusCallback = otherHandlers.onFocus; | ||
onFocusCallback == null || onFocusCallback(event); | ||
onFocusCallback?.(event); | ||
handlePause(); | ||
@@ -103,3 +103,3 @@ }; | ||
const onMouseEnterCallback = otherHandlers.onMouseEnter; | ||
onMouseEnterCallback == null || onMouseEnterCallback(event); | ||
onMouseEnterCallback?.(event); | ||
handlePause(); | ||
@@ -109,3 +109,3 @@ }; | ||
const onMouseLeaveCallback = otherHandlers.onMouseLeave; | ||
onMouseLeaveCallback == null || onMouseLeaveCallback(event); | ||
onMouseLeaveCallback?.(event); | ||
handleResume(); | ||
@@ -112,0 +112,0 @@ }; |
@@ -42,3 +42,2 @@ "use strict"; | ||
const createHandleInputChange = otherProps => event => { | ||
var _otherProps$onChange; | ||
// Workaround for https://github.com/facebook/react/issues/9023 | ||
@@ -49,4 +48,4 @@ if (event.nativeEvent.defaultPrevented) { | ||
setCheckedState(event.target.checked); | ||
onChange == null || onChange(event); | ||
(_otherProps$onChange = otherProps.onChange) == null || _otherProps$onChange.call(otherProps, event); | ||
onChange?.(event); | ||
otherProps.onChange?.(event); | ||
}; | ||
@@ -59,3 +58,2 @@ const [focusVisible, setFocusVisible] = React.useState(false); | ||
const createHandleFocus = otherProps => event => { | ||
var _otherProps$onFocus; | ||
// Fix for https://github.com/facebook/react/issues/7769 | ||
@@ -67,14 +65,13 @@ if (!inputRef.current) { | ||
setFocusVisible(true); | ||
onFocusVisible == null || onFocusVisible(event); | ||
onFocusVisible?.(event); | ||
} | ||
onFocus == null || onFocus(event); | ||
(_otherProps$onFocus = otherProps.onFocus) == null || _otherProps$onFocus.call(otherProps, event); | ||
onFocus?.(event); | ||
otherProps.onFocus?.(event); | ||
}; | ||
const createHandleBlur = otherProps => event => { | ||
var _otherProps$onBlur; | ||
if (!(0, _utils.unstable_isFocusVisible)(event.target)) { | ||
setFocusVisible(false); | ||
} | ||
onBlur == null || onBlur(event); | ||
(_otherProps$onBlur = otherProps.onBlur) == null || _otherProps$onBlur.call(otherProps, event); | ||
onBlur?.(event); | ||
otherProps.onBlur?.(event); | ||
}; | ||
@@ -81,0 +78,0 @@ const handleInputRef = (0, _utils.unstable_useForkRef)(inputRef); |
@@ -55,3 +55,3 @@ "use strict"; | ||
totalItemCount: totalTabsCount | ||
} = (0, _useCompound.useCompoundItem)(valueParam != null ? valueParam : tabValueGenerator, tabMetadata); | ||
} = (0, _useCompound.useCompoundItem)(valueParam ?? tabValueGenerator, tabMetadata); | ||
const { | ||
@@ -58,0 +58,0 @@ getRootProps: getTabProps, |
@@ -51,3 +51,3 @@ "use strict"; | ||
id: value | ||
} = (0, _useCompound.useCompoundItem)(valueParam != null ? valueParam : tabPanelValueGenerator, metadata); | ||
} = (0, _useCompound.useCompoundItem)(valueParam ?? tabPanelValueGenerator, metadata); | ||
const hidden = value !== selectedTabValue; | ||
@@ -57,5 +57,5 @@ const correspondingTabId = value !== undefined ? getTabId(value) : undefined; | ||
return { | ||
'aria-labelledby': correspondingTabId != null ? correspondingTabId : undefined, | ||
'aria-labelledby': correspondingTabId ?? undefined, | ||
hidden, | ||
id: id != null ? id : undefined, | ||
id: id ?? undefined, | ||
...externalProps, | ||
@@ -62,0 +62,0 @@ ref: handleRef |
@@ -40,3 +40,3 @@ "use strict"; | ||
setValue(newValue); | ||
onChange == null || onChange(event, newValue); | ||
onChange?.(event, newValue); | ||
}, [onChange, setValue]); | ||
@@ -49,4 +49,3 @@ const { | ||
const getTabPanelId = React.useCallback(tabValue => { | ||
var _tabPanels$get; | ||
return (_tabPanels$get = tabPanels.get(tabValue)) == null ? void 0 : _tabPanels$get.id; | ||
return tabPanels.get(tabValue)?.id; | ||
}, [tabPanels]); | ||
@@ -53,0 +52,0 @@ const getTabId = React.useCallback(tabPanelId => { |
@@ -27,3 +27,2 @@ "use strict"; | ||
function useTabsList(parameters) { | ||
var _selectedValues$; | ||
const { | ||
@@ -45,4 +44,3 @@ rootRef: externalRef | ||
const tabIdLookup = React.useCallback(tabValue => { | ||
var _subitems$get; | ||
return (_subitems$get = subitems.get(tabValue)) == null ? void 0 : _subitems$get.id; | ||
return subitems.get(tabValue)?.id; | ||
}, [subitems]); | ||
@@ -52,7 +50,6 @@ registerTabIdLookup(tabIdLookup); | ||
const getTabElement = React.useCallback(tabValue => { | ||
var _subitems$get$ref$cur, _subitems$get2; | ||
if (tabValue == null) { | ||
return null; | ||
} | ||
return (_subitems$get$ref$cur = (_subitems$get2 = subitems.get(tabValue)) == null ? void 0 : _subitems$get2.ref.current) != null ? _subitems$get$ref$cur : null; | ||
return subitems.get(tabValue)?.ref.current ?? null; | ||
}, [subitems]); | ||
@@ -67,4 +64,3 @@ const isRtl = direction === 'rtl'; | ||
const handleChange = React.useCallback((event, newValue) => { | ||
var _newValue$; | ||
onSelected(event, (_newValue$ = newValue[0]) != null ? _newValue$ : null); | ||
onSelected(event, newValue[0] ?? null); | ||
}, [onSelected]); | ||
@@ -81,6 +77,3 @@ const controlledProps = React.useMemo(() => { | ||
}, [value]); | ||
const isItemDisabled = React.useCallback(item => { | ||
var _subitems$get$disable, _subitems$get3; | ||
return (_subitems$get$disable = (_subitems$get3 = subitems.get(item)) == null ? void 0 : _subitems$get3.disabled) != null ? _subitems$get$disable : false; | ||
}, [subitems]); | ||
const isItemDisabled = React.useCallback(item => subitems.get(item)?.disabled ?? false, [subitems]); | ||
const { | ||
@@ -144,4 +137,4 @@ contextValue: listContextValue, | ||
rootRef: mergedRootRef, | ||
selectedValue: (_selectedValues$ = selectedValues[0]) != null ? _selectedValues$ : null | ||
selectedValue: selectedValues[0] ?? null | ||
}; | ||
} |
@@ -49,3 +49,3 @@ "use strict"; | ||
const contextValue = React.useMemo(() => ({ | ||
disableDefaultClasses: disableDefaultClasses != null ? disableDefaultClasses : false | ||
disableDefaultClasses: disableDefaultClasses ?? false | ||
}), [disableDefaultClasses]); | ||
@@ -52,0 +52,0 @@ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ClassNameConfiguratorContext.Provider, { |
@@ -35,7 +35,7 @@ "use strict"; | ||
// so we can simply merge all the props without having to worry about extracting event handlers. | ||
const joinedClasses = (0, _clsx.default)(additionalProps == null ? void 0 : additionalProps.className, className, externalForwardedProps == null ? void 0 : externalForwardedProps.className, externalSlotProps == null ? void 0 : externalSlotProps.className); | ||
const joinedClasses = (0, _clsx.default)(additionalProps?.className, className, externalForwardedProps?.className, externalSlotProps?.className); | ||
const mergedStyle = { | ||
...(additionalProps == null ? void 0 : additionalProps.style), | ||
...(externalForwardedProps == null ? void 0 : externalForwardedProps.style), | ||
...(externalSlotProps == null ? void 0 : externalSlotProps.style) | ||
...additionalProps?.style, | ||
...externalForwardedProps?.style, | ||
...externalSlotProps?.style | ||
}; | ||
@@ -74,8 +74,8 @@ const props = { | ||
// (see https://github.com/mui/material-ui/pull/33205) for the related discussion. | ||
const joinedClasses = (0, _clsx.default)(internalSlotProps == null ? void 0 : internalSlotProps.className, additionalProps == null ? void 0 : additionalProps.className, className, externalForwardedProps == null ? void 0 : externalForwardedProps.className, externalSlotProps == null ? void 0 : externalSlotProps.className); | ||
const joinedClasses = (0, _clsx.default)(internalSlotProps?.className, additionalProps?.className, className, externalForwardedProps?.className, externalSlotProps?.className); | ||
const mergedStyle = { | ||
...(internalSlotProps == null ? void 0 : internalSlotProps.style), | ||
...(additionalProps == null ? void 0 : additionalProps.style), | ||
...(externalForwardedProps == null ? void 0 : externalForwardedProps.style), | ||
...(externalSlotProps == null ? void 0 : externalSlotProps.style) | ||
...internalSlotProps?.style, | ||
...additionalProps?.style, | ||
...externalForwardedProps?.style, | ||
...externalSlotProps?.style | ||
}; | ||
@@ -82,0 +82,0 @@ const props = { |
@@ -54,10 +54,8 @@ "use strict"; | ||
Object.keys(nextState).forEach(key => { | ||
var _stateComparers$key; | ||
// go through all state keys and compare them with the previous state | ||
const stateComparer = (_stateComparers$key = stateComparers[key]) != null ? _stateComparers$key : areEqual; | ||
const stateComparer = stateComparers[key] ?? areEqual; | ||
const nextStateItem = nextState[key]; | ||
const previousStateItem = previousState[key]; | ||
if (previousStateItem == null && nextStateItem != null || previousStateItem != null && nextStateItem == null || previousStateItem != null && nextStateItem != null && !stateComparer(nextStateItem, previousStateItem)) { | ||
var _event, _type; | ||
onStateChange == null || onStateChange((_event = lastActionRef.current.event) != null ? _event : null, key, nextStateItem, (_type = lastActionRef.current.type) != null ? _type : '', nextState); | ||
onStateChange?.(lastActionRef.current.event ?? null, key, nextStateItem, lastActionRef.current.type ?? '', nextState); | ||
} | ||
@@ -139,4 +137,4 @@ }); | ||
initialState, | ||
stateComparers: stateComparers != null ? stateComparers : EMPTY_OBJECT, | ||
onStateChange: onStateChange != null ? onStateChange : NOOP, | ||
stateComparers: stateComparers ?? EMPTY_OBJECT, | ||
onStateChange: onStateChange ?? NOOP, | ||
controlledProps, | ||
@@ -143,0 +141,0 @@ lastActionRef |
@@ -45,3 +45,3 @@ "use strict"; | ||
function useMessageBus() { | ||
const bus = React.useRef(); | ||
const bus = React.useRef(undefined); | ||
if (!bus.current) { | ||
@@ -48,0 +48,0 @@ bus.current = createMessageBus(); |
@@ -31,6 +31,5 @@ "use strict"; | ||
const updateRootElementName = React.useCallback(instance => { | ||
var _instance$tagName; | ||
setRootElementName((_instance$tagName = instance == null ? void 0 : instance.tagName) != null ? _instance$tagName : ''); | ||
setRootElementName(instance?.tagName ?? ''); | ||
}, []); | ||
return [rootElementName, updateRootElementName]; | ||
} |
{ | ||
"name": "@mui/base", | ||
"version": "5.0.0-beta.56", | ||
"version": "5.0.0-beta.57", | ||
"private": false, | ||
@@ -31,8 +31,8 @@ "author": "MUI Team", | ||
"@babel/runtime": "^7.25.0", | ||
"@floating-ui/react-dom": "^2.1.0", | ||
"@floating-ui/react-dom": "^2.1.1", | ||
"@popperjs/core": "^2.11.8", | ||
"clsx": "^2.1.1", | ||
"prop-types": "^15.8.1", | ||
"@mui/types": "^7.2.14", | ||
"@mui/utils": "6.0.0-beta.5" | ||
"@mui/types": "^7.2.15", | ||
"@mui/utils": "6.0.0-beta.6" | ||
}, | ||
@@ -39,0 +39,0 @@ "peerDependencies": { |
@@ -45,3 +45,3 @@ 'use client'; | ||
} = props; | ||
const tabRef = React.useRef(); | ||
const tabRef = React.useRef(null); | ||
const handleRef = useForkRef(tabRef, forwardedRef); | ||
@@ -48,0 +48,0 @@ const { |
@@ -52,3 +52,3 @@ import * as React from 'react'; | ||
*/ | ||
unstable_isActiveElementInListbox?: (listbox: React.RefObject<HTMLElement>) => boolean; | ||
unstable_isActiveElementInListbox?: (listbox: React.RefObject<HTMLElement | null>) => boolean; | ||
/** | ||
@@ -55,0 +55,0 @@ * If `true`, the portion of the selected suggestion that the user hasn't typed, |
@@ -28,3 +28,3 @@ 'use client'; | ||
} = parameters; | ||
const buttonRef = React.useRef(); | ||
const buttonRef = React.useRef(null); | ||
const [active, setActive] = React.useState(false); | ||
@@ -31,0 +31,0 @@ const [focusVisible, setFocusVisible] = React.useState(false); |
@@ -38,3 +38,3 @@ import * as React from 'react'; | ||
export interface UseCompoundParentReturnValue<Key, Subitem extends { | ||
ref: React.RefObject<Node>; | ||
ref: React.RefObject<Node | null>; | ||
}> { | ||
@@ -65,4 +65,4 @@ /** | ||
export declare function useCompoundParent<Key, Subitem extends { | ||
ref: React.RefObject<Node>; | ||
ref: React.RefObject<Node | null>; | ||
}>(): UseCompoundParentReturnValue<Key, Subitem>; | ||
export {}; |
@@ -6,3 +6,3 @@ /// <reference types="react" /> | ||
export type MenuActionContext = ListActionContext<string> & { | ||
listboxRef: React.RefObject<HTMLElement>; | ||
listboxRef: React.RefObject<HTMLElement | null>; | ||
}; | ||
@@ -9,0 +9,0 @@ export declare function menuReducer(state: MenuInternalState, action: ActionWithContext<ListAction<string>, MenuActionContext>): MenuInternalState | { |
@@ -13,3 +13,3 @@ /// <reference types="react" /> | ||
label?: string; | ||
ref: React.RefObject<HTMLElement>; | ||
ref: React.RefObject<HTMLElement | null>; | ||
} | ||
@@ -16,0 +16,0 @@ export type UseMenuItemRootSlotProps<ExternalProps = {}> = ExternalProps & UseMenuItemRootSlotOwnProps & UseButtonRootSlotProps<ExternalProps> & { |
@@ -7,3 +7,3 @@ /// <reference types="react" /> | ||
disabled?: boolean; | ||
ref: React.RefObject<HTMLElement>; | ||
ref: React.RefObject<HTMLElement | null>; | ||
id?: string; | ||
@@ -10,0 +10,0 @@ } |
@@ -179,3 +179,3 @@ 'use client'; | ||
} = parameters; | ||
const touchId = React.useRef(); | ||
const touchId = React.useRef(undefined); | ||
// We can't use the :active browser pseudo-classes. | ||
@@ -218,3 +218,3 @@ // - The active state isn't triggered when clicking on the rail. | ||
const [focusedThumbIndex, setFocusedThumbIndex] = React.useState(-1); | ||
const sliderRef = React.useRef(); | ||
const sliderRef = React.useRef(null); | ||
const handleRef = useForkRef(ref, sliderRef); | ||
@@ -322,3 +322,3 @@ const createHandleHiddenInputFocus = otherHandlers => event => { | ||
}; | ||
const previousIndex = React.useRef(); | ||
const previousIndex = React.useRef(undefined); | ||
let axis = orientation; | ||
@@ -325,0 +325,0 @@ if (isRtl && orientation === 'horizontal') { |
@@ -6,3 +6,3 @@ import * as React from 'react'; | ||
id: string | undefined; | ||
ref: React.RefObject<HTMLElement>; | ||
ref: React.RefObject<HTMLElement | null>; | ||
}; | ||
@@ -9,0 +9,0 @@ export type TabsProviderValue = CompoundComponentContextValue<string | number, TabPanelMetadata> & TabsContextValue; |
@@ -6,3 +6,3 @@ import * as React from 'react'; | ||
id: string | undefined; | ||
ref: React.RefObject<HTMLElement>; | ||
ref: React.RefObject<HTMLElement | null>; | ||
} | ||
@@ -9,0 +9,0 @@ /** |
@@ -37,3 +37,3 @@ 'use client'; | ||
export function useMessageBus() { | ||
const bus = React.useRef(); | ||
const bus = React.useRef(undefined); | ||
if (!bus.current) { | ||
@@ -40,0 +40,0 @@ bus.current = createMessageBus(); |
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
2524339
47164
+ Added@mui/utils@6.0.0-beta.6(transitive)
- Removed@mui/utils@6.0.0-beta.5(transitive)
Updated@mui/types@^7.2.15
Updated@mui/utils@6.0.0-beta.6