@mui/material 5.14.0 → 5.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +155 -3
- package/Chip/Chip.js +0 -2
- package/CssBaseline/CssBaseline.js +2 -2
- package/FormControlLabel/FormControlLabel.js +11 -6
- package/README.md +1 -1
- package/Slider/SliderValueLabel.d.ts +1 -6
- package/SvgIcon/SvgIcon.js +9 -9
- package/Tabs/Tabs.js +39 -42
- package/index.js +1 -1
- package/legacy/Chip/Chip.js +0 -2
- package/legacy/CssBaseline/CssBaseline.js +2 -2
- package/legacy/FormControlLabel/FormControlLabel.js +11 -6
- package/legacy/SvgIcon/SvgIcon.js +9 -9
- package/legacy/Tabs/Tabs.js +48 -48
- package/legacy/index.js +1 -1
- package/legacy/useTouchRipple/useTouchRipple.js +2 -2
- package/modern/Chip/Chip.js +0 -2
- package/modern/FormControlLabel/FormControlLabel.js +11 -6
- package/modern/Tabs/Tabs.js +39 -42
- package/modern/index.js +1 -1
- package/node/Chip/Chip.js +0 -2
- package/node/CssBaseline/CssBaseline.js +2 -2
- package/node/FormControlLabel/FormControlLabel.js +11 -6
- package/node/SvgIcon/SvgIcon.js +9 -9
- package/node/Tabs/Tabs.js +39 -42
- package/node/index.js +1 -1
- package/node/useTouchRipple/useTouchRipple.js +2 -2
- package/package.json +6 -6
- package/styles/components.d.ts +5 -0
- package/styles/overrides.d.ts +2 -0
- package/umd/material-ui.development.js +132 -132
- package/umd/material-ui.production.min.js +14 -14
- package/useTouchRipple/useTouchRipple.js +2 -2
package/legacy/Tabs/Tabs.js
CHANGED
|
@@ -286,18 +286,21 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
286
286
|
var _React$useState2 = React.useState(defaultIndicatorStyle),
|
|
287
287
|
indicatorStyle = _React$useState2[0],
|
|
288
288
|
setIndicatorStyle = _React$useState2[1];
|
|
289
|
-
var _React$useState3 = React.useState(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
var _React$
|
|
289
|
+
var _React$useState3 = React.useState(false),
|
|
290
|
+
displayStartScroll = _React$useState3[0],
|
|
291
|
+
setDisplayStartScroll = _React$useState3[1];
|
|
292
|
+
var _React$useState4 = React.useState(false),
|
|
293
|
+
displayEndScroll = _React$useState4[0],
|
|
294
|
+
setDisplayEndScroll = _React$useState4[1];
|
|
295
|
+
var _React$useState5 = React.useState(false),
|
|
296
|
+
updateScrollObserver = _React$useState5[0],
|
|
297
|
+
setUpdateScrollObserver = _React$useState5[1];
|
|
298
|
+
var _React$useState6 = React.useState({
|
|
296
299
|
overflow: 'hidden',
|
|
297
300
|
scrollbarWidth: 0
|
|
298
301
|
}),
|
|
299
|
-
scrollerStyle = _React$
|
|
300
|
-
setScrollerStyle = _React$
|
|
302
|
+
scrollerStyle = _React$useState6[0],
|
|
303
|
+
setScrollerStyle = _React$useState6[1];
|
|
301
304
|
var valueToIndex = new Map();
|
|
302
305
|
var tabsRef = React.useRef(null);
|
|
303
306
|
var tabListRef = React.useRef(null);
|
|
@@ -441,7 +444,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
441
444
|
onChange: handleScrollbarSizeChange,
|
|
442
445
|
className: clsx(classes.scrollableX, classes.hideScrollbar)
|
|
443
446
|
}) : null;
|
|
444
|
-
var scrollButtonsActive =
|
|
447
|
+
var scrollButtonsActive = displayStartScroll || displayEndScroll;
|
|
445
448
|
var showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === true);
|
|
446
449
|
conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/_jsx(ScrollButtonComponent, _extends({
|
|
447
450
|
slots: {
|
|
@@ -453,7 +456,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
453
456
|
orientation: orientation,
|
|
454
457
|
direction: isRtl ? 'right' : 'left',
|
|
455
458
|
onClick: handleStartScrollClick,
|
|
456
|
-
disabled: !
|
|
459
|
+
disabled: !displayStartScroll
|
|
457
460
|
}, TabScrollButtonProps, {
|
|
458
461
|
className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
|
|
459
462
|
})) : null;
|
|
@@ -467,7 +470,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
467
470
|
orientation: orientation,
|
|
468
471
|
direction: isRtl ? 'left' : 'right',
|
|
469
472
|
onClick: handleEndScrollClick,
|
|
470
|
-
disabled: !
|
|
473
|
+
disabled: !displayEndScroll
|
|
471
474
|
}, TabScrollButtonProps, {
|
|
472
475
|
className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
|
|
473
476
|
})) : null;
|
|
@@ -496,29 +499,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
496
499
|
});
|
|
497
500
|
var updateScrollButtonState = useEventCallback(function () {
|
|
498
501
|
if (scrollable && scrollButtons !== false) {
|
|
499
|
-
|
|
500
|
-
scrollTop = _tabsRef$current.scrollTop,
|
|
501
|
-
scrollHeight = _tabsRef$current.scrollHeight,
|
|
502
|
-
clientHeight = _tabsRef$current.clientHeight,
|
|
503
|
-
scrollWidth = _tabsRef$current.scrollWidth,
|
|
504
|
-
clientWidth = _tabsRef$current.clientWidth;
|
|
505
|
-
var showStartScroll;
|
|
506
|
-
var showEndScroll;
|
|
507
|
-
if (vertical) {
|
|
508
|
-
showStartScroll = scrollTop > 1;
|
|
509
|
-
showEndScroll = scrollTop < scrollHeight - clientHeight - 1;
|
|
510
|
-
} else {
|
|
511
|
-
var scrollLeft = getNormalizedScrollLeft(tabsRef.current, theme.direction);
|
|
512
|
-
// use 1 for the potential rounding error with browser zooms.
|
|
513
|
-
showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
|
|
514
|
-
showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
|
|
515
|
-
}
|
|
516
|
-
if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
|
|
517
|
-
setDisplayScroll({
|
|
518
|
-
start: showStartScroll,
|
|
519
|
-
end: showEndScroll
|
|
520
|
-
});
|
|
521
|
-
}
|
|
502
|
+
setUpdateScrollObserver(!updateScrollObserver);
|
|
522
503
|
}
|
|
523
504
|
});
|
|
524
505
|
React.useEffect(function () {
|
|
@@ -531,7 +512,6 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
531
512
|
// replaced by Suspense with a fallback, once React is updated to version 18
|
|
532
513
|
if (tabsRef.current) {
|
|
533
514
|
updateIndicatorState();
|
|
534
|
-
updateScrollButtonState();
|
|
535
515
|
}
|
|
536
516
|
});
|
|
537
517
|
var win = ownerWindow(tabsRef.current);
|
|
@@ -550,23 +530,44 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
550
530
|
resizeObserver.disconnect();
|
|
551
531
|
}
|
|
552
532
|
};
|
|
553
|
-
}, [updateIndicatorState
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
533
|
+
}, [updateIndicatorState]);
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Toggle visibility of start and end scroll buttons
|
|
537
|
+
* Using IntersectionObserver on first and last Tabs.
|
|
538
|
+
*/
|
|
559
539
|
React.useEffect(function () {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
540
|
+
var tabListChildren = Array.from(tabListRef.current.children);
|
|
541
|
+
var length = tabListChildren.length;
|
|
542
|
+
if (typeof IntersectionObserver !== 'undefined' && length > 0 && scrollable && scrollButtons !== false) {
|
|
543
|
+
var firstTab = tabListChildren[0];
|
|
544
|
+
var lastTab = tabListChildren[length - 1];
|
|
545
|
+
var observerOptions = {
|
|
546
|
+
root: tabsRef.current,
|
|
547
|
+
threshold: 0.99
|
|
548
|
+
};
|
|
549
|
+
var handleScrollButtonStart = function handleScrollButtonStart(entries) {
|
|
550
|
+
setDisplayStartScroll(!entries[0].isIntersecting);
|
|
551
|
+
};
|
|
552
|
+
var firstObserver = new IntersectionObserver(handleScrollButtonStart, observerOptions);
|
|
553
|
+
firstObserver.observe(firstTab);
|
|
554
|
+
var handleScrollButtonEnd = function handleScrollButtonEnd(entries) {
|
|
555
|
+
setDisplayEndScroll(!entries[0].isIntersecting);
|
|
556
|
+
};
|
|
557
|
+
var lastObserver = new IntersectionObserver(handleScrollButtonEnd, observerOptions);
|
|
558
|
+
lastObserver.observe(lastTab);
|
|
559
|
+
return function () {
|
|
560
|
+
firstObserver.disconnect();
|
|
561
|
+
lastObserver.disconnect();
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
return undefined;
|
|
565
|
+
}, [scrollable, scrollButtons, updateScrollObserver, childrenProp == null ? void 0 : childrenProp.length]);
|
|
564
566
|
React.useEffect(function () {
|
|
565
567
|
setMounted(true);
|
|
566
568
|
}, []);
|
|
567
569
|
React.useEffect(function () {
|
|
568
570
|
updateIndicatorState();
|
|
569
|
-
updateScrollButtonState();
|
|
570
571
|
});
|
|
571
572
|
React.useEffect(function () {
|
|
572
573
|
// Don't animate on the first render.
|
|
@@ -661,7 +662,6 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
661
662
|
overflow: scrollerStyle.overflow
|
|
662
663
|
}, vertical ? "margin".concat(isRtl ? 'Left' : 'Right') : 'marginBottom', visibleScrollbar ? undefined : -scrollerStyle.scrollbarWidth),
|
|
663
664
|
ref: tabsRef,
|
|
664
|
-
onScroll: handleTabsScroll,
|
|
665
665
|
children: [/*#__PURE__*/_jsx(FlexContainer, {
|
|
666
666
|
"aria-label": ariaLabel,
|
|
667
667
|
"aria-labelledby": ariaLabelledBy,
|
package/legacy/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var useTouchRipple = function useTouchRipple(props) {
|
|
|
30
30
|
keydownRef.current = true;
|
|
31
31
|
rippleRef.current.stop(event, function () {
|
|
32
32
|
var _rippleRef$current2;
|
|
33
|
-
rippleRef == null
|
|
33
|
+
rippleRef == null || (_rippleRef$current2 = rippleRef.current) == null ? void 0 : _rippleRef$current2.start(event);
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
});
|
|
@@ -41,7 +41,7 @@ var useTouchRipple = function useTouchRipple(props) {
|
|
|
41
41
|
keydownRef.current = false;
|
|
42
42
|
rippleRef.current.stop(event, function () {
|
|
43
43
|
var _rippleRef$current3;
|
|
44
|
-
rippleRef == null
|
|
44
|
+
rippleRef == null || (_rippleRef$current3 = rippleRef.current) == null ? void 0 : _rippleRef$current3.pulsate(event);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
});
|
package/modern/Chip/Chip.js
CHANGED
|
@@ -93,8 +93,6 @@ const ChipRoot = styled('div', {
|
|
|
93
93
|
borderRadius: 32 / 2,
|
|
94
94
|
whiteSpace: 'nowrap',
|
|
95
95
|
transition: theme.transitions.create(['background-color', 'box-shadow']),
|
|
96
|
-
// label will inherit this from root, then `clickable` class overrides this for both
|
|
97
|
-
cursor: 'default',
|
|
98
96
|
// We disable the focus ring for mouse, touch and keyboard users.
|
|
99
97
|
outline: 0,
|
|
100
98
|
textDecoration: 'none',
|
|
@@ -9,6 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { refType } from '@mui/utils';
|
|
10
10
|
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
11
11
|
import { useFormControl } from '../FormControl';
|
|
12
|
+
import Stack from '../Stack';
|
|
12
13
|
import Typography from '../Typography';
|
|
13
14
|
import capitalize from '../utils/capitalize';
|
|
14
15
|
import styled from '../styles/styled';
|
|
@@ -149,12 +150,16 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
|
|
|
149
150
|
ownerState: ownerState,
|
|
150
151
|
ref: ref
|
|
151
152
|
}, other, {
|
|
152
|
-
children: [/*#__PURE__*/React.cloneElement(control, controlProps),
|
|
153
|
-
|
|
154
|
-
"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
children: [/*#__PURE__*/React.cloneElement(control, controlProps), required ? /*#__PURE__*/_jsxs(Stack, {
|
|
154
|
+
direction: "row",
|
|
155
|
+
alignItems: "center",
|
|
156
|
+
children: [label, /*#__PURE__*/_jsxs(AsteriskComponent, {
|
|
157
|
+
ownerState: ownerState,
|
|
158
|
+
"aria-hidden": true,
|
|
159
|
+
className: classes.asterisk,
|
|
160
|
+
children: ["\u2009", '*']
|
|
161
|
+
})]
|
|
162
|
+
}) : label]
|
|
158
163
|
}));
|
|
159
164
|
});
|
|
160
165
|
process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-proptypes */ = {
|
package/modern/Tabs/Tabs.js
CHANGED
|
@@ -280,10 +280,9 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
280
280
|
}
|
|
281
281
|
const [mounted, setMounted] = React.useState(false);
|
|
282
282
|
const [indicatorStyle, setIndicatorStyle] = React.useState(defaultIndicatorStyle);
|
|
283
|
-
const [
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
});
|
|
283
|
+
const [displayStartScroll, setDisplayStartScroll] = React.useState(false);
|
|
284
|
+
const [displayEndScroll, setDisplayEndScroll] = React.useState(false);
|
|
285
|
+
const [updateScrollObserver, setUpdateScrollObserver] = React.useState(false);
|
|
287
286
|
const [scrollerStyle, setScrollerStyle] = React.useState({
|
|
288
287
|
overflow: 'hidden',
|
|
289
288
|
scrollbarWidth: 0
|
|
@@ -434,7 +433,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
434
433
|
onChange: handleScrollbarSizeChange,
|
|
435
434
|
className: clsx(classes.scrollableX, classes.hideScrollbar)
|
|
436
435
|
}) : null;
|
|
437
|
-
const scrollButtonsActive =
|
|
436
|
+
const scrollButtonsActive = displayStartScroll || displayEndScroll;
|
|
438
437
|
const showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === true);
|
|
439
438
|
conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/_jsx(ScrollButtonComponent, _extends({
|
|
440
439
|
slots: {
|
|
@@ -446,7 +445,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
446
445
|
orientation: orientation,
|
|
447
446
|
direction: isRtl ? 'right' : 'left',
|
|
448
447
|
onClick: handleStartScrollClick,
|
|
449
|
-
disabled: !
|
|
448
|
+
disabled: !displayStartScroll
|
|
450
449
|
}, TabScrollButtonProps, {
|
|
451
450
|
className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
|
|
452
451
|
})) : null;
|
|
@@ -460,7 +459,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
460
459
|
orientation: orientation,
|
|
461
460
|
direction: isRtl ? 'left' : 'right',
|
|
462
461
|
onClick: handleEndScrollClick,
|
|
463
|
-
disabled: !
|
|
462
|
+
disabled: !displayEndScroll
|
|
464
463
|
}, TabScrollButtonProps, {
|
|
465
464
|
className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
|
|
466
465
|
})) : null;
|
|
@@ -490,30 +489,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
490
489
|
});
|
|
491
490
|
const updateScrollButtonState = useEventCallback(() => {
|
|
492
491
|
if (scrollable && scrollButtons !== false) {
|
|
493
|
-
|
|
494
|
-
scrollTop,
|
|
495
|
-
scrollHeight,
|
|
496
|
-
clientHeight,
|
|
497
|
-
scrollWidth,
|
|
498
|
-
clientWidth
|
|
499
|
-
} = tabsRef.current;
|
|
500
|
-
let showStartScroll;
|
|
501
|
-
let showEndScroll;
|
|
502
|
-
if (vertical) {
|
|
503
|
-
showStartScroll = scrollTop > 1;
|
|
504
|
-
showEndScroll = scrollTop < scrollHeight - clientHeight - 1;
|
|
505
|
-
} else {
|
|
506
|
-
const scrollLeft = getNormalizedScrollLeft(tabsRef.current, theme.direction);
|
|
507
|
-
// use 1 for the potential rounding error with browser zooms.
|
|
508
|
-
showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
|
|
509
|
-
showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
|
|
510
|
-
}
|
|
511
|
-
if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
|
|
512
|
-
setDisplayScroll({
|
|
513
|
-
start: showStartScroll,
|
|
514
|
-
end: showEndScroll
|
|
515
|
-
});
|
|
516
|
-
}
|
|
492
|
+
setUpdateScrollObserver(!updateScrollObserver);
|
|
517
493
|
}
|
|
518
494
|
});
|
|
519
495
|
React.useEffect(() => {
|
|
@@ -526,7 +502,6 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
526
502
|
// replaced by Suspense with a fallback, once React is updated to version 18
|
|
527
503
|
if (tabsRef.current) {
|
|
528
504
|
updateIndicatorState();
|
|
529
|
-
updateScrollButtonState();
|
|
530
505
|
}
|
|
531
506
|
});
|
|
532
507
|
const win = ownerWindow(tabsRef.current);
|
|
@@ -545,21 +520,44 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
545
520
|
resizeObserver.disconnect();
|
|
546
521
|
}
|
|
547
522
|
};
|
|
548
|
-
}, [updateIndicatorState
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
523
|
+
}, [updateIndicatorState]);
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Toggle visibility of start and end scroll buttons
|
|
527
|
+
* Using IntersectionObserver on first and last Tabs.
|
|
528
|
+
*/
|
|
552
529
|
React.useEffect(() => {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
530
|
+
const tabListChildren = Array.from(tabListRef.current.children);
|
|
531
|
+
const length = tabListChildren.length;
|
|
532
|
+
if (typeof IntersectionObserver !== 'undefined' && length > 0 && scrollable && scrollButtons !== false) {
|
|
533
|
+
const firstTab = tabListChildren[0];
|
|
534
|
+
const lastTab = tabListChildren[length - 1];
|
|
535
|
+
const observerOptions = {
|
|
536
|
+
root: tabsRef.current,
|
|
537
|
+
threshold: 0.99
|
|
538
|
+
};
|
|
539
|
+
const handleScrollButtonStart = entries => {
|
|
540
|
+
setDisplayStartScroll(!entries[0].isIntersecting);
|
|
541
|
+
};
|
|
542
|
+
const firstObserver = new IntersectionObserver(handleScrollButtonStart, observerOptions);
|
|
543
|
+
firstObserver.observe(firstTab);
|
|
544
|
+
const handleScrollButtonEnd = entries => {
|
|
545
|
+
setDisplayEndScroll(!entries[0].isIntersecting);
|
|
546
|
+
};
|
|
547
|
+
const lastObserver = new IntersectionObserver(handleScrollButtonEnd, observerOptions);
|
|
548
|
+
lastObserver.observe(lastTab);
|
|
549
|
+
return () => {
|
|
550
|
+
firstObserver.disconnect();
|
|
551
|
+
lastObserver.disconnect();
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
return undefined;
|
|
555
|
+
}, [scrollable, scrollButtons, updateScrollObserver, childrenProp?.length]);
|
|
557
556
|
React.useEffect(() => {
|
|
558
557
|
setMounted(true);
|
|
559
558
|
}, []);
|
|
560
559
|
React.useEffect(() => {
|
|
561
560
|
updateIndicatorState();
|
|
562
|
-
updateScrollButtonState();
|
|
563
561
|
});
|
|
564
562
|
React.useEffect(() => {
|
|
565
563
|
// Don't animate on the first render.
|
|
@@ -653,7 +651,6 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
653
651
|
[vertical ? `margin${isRtl ? 'Left' : 'Right'}` : 'marginBottom']: visibleScrollbar ? undefined : -scrollerStyle.scrollbarWidth
|
|
654
652
|
},
|
|
655
653
|
ref: tabsRef,
|
|
656
|
-
onScroll: handleTabsScroll,
|
|
657
654
|
children: [/*#__PURE__*/_jsx(FlexContainer, {
|
|
658
655
|
"aria-label": ariaLabel,
|
|
659
656
|
"aria-labelledby": ariaLabelledBy,
|
package/modern/index.js
CHANGED
package/node/Chip/Chip.js
CHANGED
|
@@ -100,8 +100,6 @@ const ChipRoot = (0, _styled.default)('div', {
|
|
|
100
100
|
borderRadius: 32 / 2,
|
|
101
101
|
whiteSpace: 'nowrap',
|
|
102
102
|
transition: theme.transitions.create(['background-color', 'box-shadow']),
|
|
103
|
-
// label will inherit this from root, then `clickable` class overrides this for both
|
|
104
|
-
cursor: 'default',
|
|
105
103
|
// We disable the focus ring for mouse, touch and keyboard users.
|
|
106
104
|
outline: 0,
|
|
107
105
|
textDecoration: 'none',
|
|
@@ -39,7 +39,7 @@ const body = theme => (0, _extends2.default)({
|
|
|
39
39
|
});
|
|
40
40
|
exports.body = body;
|
|
41
41
|
const styles = (theme, enableColorScheme = false) => {
|
|
42
|
-
var _theme$components
|
|
42
|
+
var _theme$components;
|
|
43
43
|
const colorSchemeStyles = {};
|
|
44
44
|
if (enableColorScheme && theme.colorSchemes) {
|
|
45
45
|
Object.entries(theme.colorSchemes).forEach(([key, scheme]) => {
|
|
@@ -67,7 +67,7 @@ const styles = (theme, enableColorScheme = false) => {
|
|
|
67
67
|
}
|
|
68
68
|
})
|
|
69
69
|
}, colorSchemeStyles);
|
|
70
|
-
const themeOverrides = (_theme$components = theme.components) == null
|
|
70
|
+
const themeOverrides = (_theme$components = theme.components) == null || (_theme$components = _theme$components.MuiCssBaseline) == null ? void 0 : _theme$components.styleOverrides;
|
|
71
71
|
if (themeOverrides) {
|
|
72
72
|
defaultStyles = [defaultStyles, themeOverrides];
|
|
73
73
|
}
|
|
@@ -14,6 +14,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
14
14
|
var _utils = require("@mui/utils");
|
|
15
15
|
var _base = require("@mui/base");
|
|
16
16
|
var _FormControl = require("../FormControl");
|
|
17
|
+
var _Stack = _interopRequireDefault(require("../Stack"));
|
|
17
18
|
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
18
19
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
19
20
|
var _styled = _interopRequireDefault(require("../styles/styled"));
|
|
@@ -158,12 +159,16 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
|
|
|
158
159
|
ownerState: ownerState,
|
|
159
160
|
ref: ref
|
|
160
161
|
}, other, {
|
|
161
|
-
children: [/*#__PURE__*/React.cloneElement(control, controlProps),
|
|
162
|
-
|
|
163
|
-
"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
children: [/*#__PURE__*/React.cloneElement(control, controlProps), required ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Stack.default, {
|
|
163
|
+
direction: "row",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
children: [label, /*#__PURE__*/(0, _jsxRuntime.jsxs)(AsteriskComponent, {
|
|
166
|
+
ownerState: ownerState,
|
|
167
|
+
"aria-hidden": true,
|
|
168
|
+
className: classes.asterisk,
|
|
169
|
+
children: ["\u2009", '*']
|
|
170
|
+
})]
|
|
171
|
+
}) : label]
|
|
167
172
|
}));
|
|
168
173
|
});
|
|
169
174
|
process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-proptypes */ = {
|
package/node/SvgIcon/SvgIcon.js
CHANGED
|
@@ -44,7 +44,7 @@ const SvgIconRoot = (0, _styled.default)('svg', {
|
|
|
44
44
|
theme,
|
|
45
45
|
ownerState
|
|
46
46
|
}) => {
|
|
47
|
-
var _theme$transitions, _theme$transitions$cr, _theme$transitions2, _theme$
|
|
47
|
+
var _theme$transitions, _theme$transitions$cr, _theme$transitions2, _theme$typography, _theme$typography$pxT, _theme$typography2, _theme$typography2$px, _theme$typography3, _theme$typography3$px, _palette$ownerState$c, _palette, _palette2, _palette3;
|
|
48
48
|
return {
|
|
49
49
|
userSelect: 'none',
|
|
50
50
|
width: '1em',
|
|
@@ -54,19 +54,19 @@ const SvgIconRoot = (0, _styled.default)('svg', {
|
|
|
54
54
|
// e.g. heroicons uses fill="none" and stroke="currentColor"
|
|
55
55
|
fill: ownerState.hasSvgAsChild ? undefined : 'currentColor',
|
|
56
56
|
flexShrink: 0,
|
|
57
|
-
transition: (_theme$transitions = theme.transitions) == null
|
|
58
|
-
duration: (_theme$transitions2 = theme.transitions) == null
|
|
57
|
+
transition: (_theme$transitions = theme.transitions) == null || (_theme$transitions$cr = _theme$transitions.create) == null ? void 0 : _theme$transitions$cr.call(_theme$transitions, 'fill', {
|
|
58
|
+
duration: (_theme$transitions2 = theme.transitions) == null || (_theme$transitions2 = _theme$transitions2.duration) == null ? void 0 : _theme$transitions2.shorter
|
|
59
59
|
}),
|
|
60
60
|
fontSize: {
|
|
61
61
|
inherit: 'inherit',
|
|
62
|
-
small: ((_theme$typography = theme.typography) == null
|
|
63
|
-
medium: ((_theme$typography2 = theme.typography) == null
|
|
64
|
-
large: ((_theme$typography3 = theme.typography) == null
|
|
62
|
+
small: ((_theme$typography = theme.typography) == null || (_theme$typography$pxT = _theme$typography.pxToRem) == null ? void 0 : _theme$typography$pxT.call(_theme$typography, 20)) || '1.25rem',
|
|
63
|
+
medium: ((_theme$typography2 = theme.typography) == null || (_theme$typography2$px = _theme$typography2.pxToRem) == null ? void 0 : _theme$typography2$px.call(_theme$typography2, 24)) || '1.5rem',
|
|
64
|
+
large: ((_theme$typography3 = theme.typography) == null || (_theme$typography3$px = _theme$typography3.pxToRem) == null ? void 0 : _theme$typography3$px.call(_theme$typography3, 35)) || '2.1875rem'
|
|
65
65
|
}[ownerState.fontSize],
|
|
66
66
|
// TODO v5 deprecate, v6 remove for sx
|
|
67
|
-
color: (_palette$ownerState$c = (_palette = (theme.vars || theme).palette) == null
|
|
68
|
-
action: (_palette2 = (theme.vars || theme).palette) == null
|
|
69
|
-
disabled: (_palette3 = (theme.vars || theme).palette) == null
|
|
67
|
+
color: (_palette$ownerState$c = (_palette = (theme.vars || theme).palette) == null || (_palette = _palette[ownerState.color]) == null ? void 0 : _palette.main) != null ? _palette$ownerState$c : {
|
|
68
|
+
action: (_palette2 = (theme.vars || theme).palette) == null || (_palette2 = _palette2.action) == null ? void 0 : _palette2.active,
|
|
69
|
+
disabled: (_palette3 = (theme.vars || theme).palette) == null || (_palette3 = _palette3.action) == null ? void 0 : _palette3.disabled,
|
|
70
70
|
inherit: undefined
|
|
71
71
|
}[ownerState.color]
|
|
72
72
|
};
|
package/node/Tabs/Tabs.js
CHANGED
|
@@ -287,10 +287,9 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
287
287
|
}
|
|
288
288
|
const [mounted, setMounted] = React.useState(false);
|
|
289
289
|
const [indicatorStyle, setIndicatorStyle] = React.useState(defaultIndicatorStyle);
|
|
290
|
-
const [
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
});
|
|
290
|
+
const [displayStartScroll, setDisplayStartScroll] = React.useState(false);
|
|
291
|
+
const [displayEndScroll, setDisplayEndScroll] = React.useState(false);
|
|
292
|
+
const [updateScrollObserver, setUpdateScrollObserver] = React.useState(false);
|
|
294
293
|
const [scrollerStyle, setScrollerStyle] = React.useState({
|
|
295
294
|
overflow: 'hidden',
|
|
296
295
|
scrollbarWidth: 0
|
|
@@ -441,7 +440,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
441
440
|
onChange: handleScrollbarSizeChange,
|
|
442
441
|
className: (0, _clsx.default)(classes.scrollableX, classes.hideScrollbar)
|
|
443
442
|
}) : null;
|
|
444
|
-
const scrollButtonsActive =
|
|
443
|
+
const scrollButtonsActive = displayStartScroll || displayEndScroll;
|
|
445
444
|
const showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === true);
|
|
446
445
|
conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ScrollButtonComponent, (0, _extends2.default)({
|
|
447
446
|
slots: {
|
|
@@ -453,7 +452,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
453
452
|
orientation: orientation,
|
|
454
453
|
direction: isRtl ? 'right' : 'left',
|
|
455
454
|
onClick: handleStartScrollClick,
|
|
456
|
-
disabled: !
|
|
455
|
+
disabled: !displayStartScroll
|
|
457
456
|
}, TabScrollButtonProps, {
|
|
458
457
|
className: (0, _clsx.default)(classes.scrollButtons, TabScrollButtonProps.className)
|
|
459
458
|
})) : null;
|
|
@@ -467,7 +466,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
467
466
|
orientation: orientation,
|
|
468
467
|
direction: isRtl ? 'left' : 'right',
|
|
469
468
|
onClick: handleEndScrollClick,
|
|
470
|
-
disabled: !
|
|
469
|
+
disabled: !displayEndScroll
|
|
471
470
|
}, TabScrollButtonProps, {
|
|
472
471
|
className: (0, _clsx.default)(classes.scrollButtons, TabScrollButtonProps.className)
|
|
473
472
|
})) : null;
|
|
@@ -497,30 +496,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
497
496
|
});
|
|
498
497
|
const updateScrollButtonState = (0, _useEventCallback.default)(() => {
|
|
499
498
|
if (scrollable && scrollButtons !== false) {
|
|
500
|
-
|
|
501
|
-
scrollTop,
|
|
502
|
-
scrollHeight,
|
|
503
|
-
clientHeight,
|
|
504
|
-
scrollWidth,
|
|
505
|
-
clientWidth
|
|
506
|
-
} = tabsRef.current;
|
|
507
|
-
let showStartScroll;
|
|
508
|
-
let showEndScroll;
|
|
509
|
-
if (vertical) {
|
|
510
|
-
showStartScroll = scrollTop > 1;
|
|
511
|
-
showEndScroll = scrollTop < scrollHeight - clientHeight - 1;
|
|
512
|
-
} else {
|
|
513
|
-
const scrollLeft = (0, _scrollLeft.getNormalizedScrollLeft)(tabsRef.current, theme.direction);
|
|
514
|
-
// use 1 for the potential rounding error with browser zooms.
|
|
515
|
-
showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
|
|
516
|
-
showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
|
|
517
|
-
}
|
|
518
|
-
if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
|
|
519
|
-
setDisplayScroll({
|
|
520
|
-
start: showStartScroll,
|
|
521
|
-
end: showEndScroll
|
|
522
|
-
});
|
|
523
|
-
}
|
|
499
|
+
setUpdateScrollObserver(!updateScrollObserver);
|
|
524
500
|
}
|
|
525
501
|
});
|
|
526
502
|
React.useEffect(() => {
|
|
@@ -533,7 +509,6 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
533
509
|
// replaced by Suspense with a fallback, once React is updated to version 18
|
|
534
510
|
if (tabsRef.current) {
|
|
535
511
|
updateIndicatorState();
|
|
536
|
-
updateScrollButtonState();
|
|
537
512
|
}
|
|
538
513
|
});
|
|
539
514
|
const win = (0, _ownerWindow.default)(tabsRef.current);
|
|
@@ -552,21 +527,44 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
552
527
|
resizeObserver.disconnect();
|
|
553
528
|
}
|
|
554
529
|
};
|
|
555
|
-
}, [updateIndicatorState
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
530
|
+
}, [updateIndicatorState]);
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Toggle visibility of start and end scroll buttons
|
|
534
|
+
* Using IntersectionObserver on first and last Tabs.
|
|
535
|
+
*/
|
|
559
536
|
React.useEffect(() => {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
537
|
+
const tabListChildren = Array.from(tabListRef.current.children);
|
|
538
|
+
const length = tabListChildren.length;
|
|
539
|
+
if (typeof IntersectionObserver !== 'undefined' && length > 0 && scrollable && scrollButtons !== false) {
|
|
540
|
+
const firstTab = tabListChildren[0];
|
|
541
|
+
const lastTab = tabListChildren[length - 1];
|
|
542
|
+
const observerOptions = {
|
|
543
|
+
root: tabsRef.current,
|
|
544
|
+
threshold: 0.99
|
|
545
|
+
};
|
|
546
|
+
const handleScrollButtonStart = entries => {
|
|
547
|
+
setDisplayStartScroll(!entries[0].isIntersecting);
|
|
548
|
+
};
|
|
549
|
+
const firstObserver = new IntersectionObserver(handleScrollButtonStart, observerOptions);
|
|
550
|
+
firstObserver.observe(firstTab);
|
|
551
|
+
const handleScrollButtonEnd = entries => {
|
|
552
|
+
setDisplayEndScroll(!entries[0].isIntersecting);
|
|
553
|
+
};
|
|
554
|
+
const lastObserver = new IntersectionObserver(handleScrollButtonEnd, observerOptions);
|
|
555
|
+
lastObserver.observe(lastTab);
|
|
556
|
+
return () => {
|
|
557
|
+
firstObserver.disconnect();
|
|
558
|
+
lastObserver.disconnect();
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
return undefined;
|
|
562
|
+
}, [scrollable, scrollButtons, updateScrollObserver, childrenProp == null ? void 0 : childrenProp.length]);
|
|
564
563
|
React.useEffect(() => {
|
|
565
564
|
setMounted(true);
|
|
566
565
|
}, []);
|
|
567
566
|
React.useEffect(() => {
|
|
568
567
|
updateIndicatorState();
|
|
569
|
-
updateScrollButtonState();
|
|
570
568
|
});
|
|
571
569
|
React.useEffect(() => {
|
|
572
570
|
// Don't animate on the first render.
|
|
@@ -660,7 +658,6 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
660
658
|
[vertical ? `margin${isRtl ? 'Left' : 'Right'}` : 'marginBottom']: visibleScrollbar ? undefined : -scrollerStyle.scrollbarWidth
|
|
661
659
|
},
|
|
662
660
|
ref: tabsRef,
|
|
663
|
-
onScroll: handleTabsScroll,
|
|
664
661
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(FlexContainer, {
|
|
665
662
|
"aria-label": ariaLabel,
|
|
666
663
|
"aria-labelledby": ariaLabelledBy,
|
package/node/index.js
CHANGED
|
@@ -38,7 +38,7 @@ const useTouchRipple = props => {
|
|
|
38
38
|
keydownRef.current = true;
|
|
39
39
|
rippleRef.current.stop(event, () => {
|
|
40
40
|
var _rippleRef$current2;
|
|
41
|
-
rippleRef == null
|
|
41
|
+
rippleRef == null || (_rippleRef$current2 = rippleRef.current) == null ? void 0 : _rippleRef$current2.start(event);
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
});
|
|
@@ -49,7 +49,7 @@ const useTouchRipple = props => {
|
|
|
49
49
|
keydownRef.current = false;
|
|
50
50
|
rippleRef.current.stop(event, () => {
|
|
51
51
|
var _rippleRef$current3;
|
|
52
|
-
rippleRef == null
|
|
52
|
+
rippleRef == null || (_rippleRef$current3 = rippleRef.current) == null ? void 0 : _rippleRef$current3.pulsate(event);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
});
|