@mui/material 5.14.8 → 5.14.9
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/AlertTitle/AlertTitle.d.ts +1 -0
- package/Breadcrumbs/Breadcrumbs.d.ts +1 -0
- package/Button/Button.js +4 -1
- package/ButtonGroup/ButtonGroup.js +86 -54
- package/ButtonGroup/ButtonGroupButtonContext.d.ts +6 -0
- package/ButtonGroup/ButtonGroupButtonContext.js +9 -0
- package/ButtonGroup/buttonGroupClasses.d.ts +6 -0
- package/ButtonGroup/buttonGroupClasses.js +1 -1
- package/CHANGELOG.md +124 -19
- package/DialogTitle/DialogTitle.d.ts +1 -0
- package/Modal/Modal.js +1 -1
- package/README.md +9 -198
- package/Slider/Slider.js +9 -86
- package/Tabs/Tabs.js +1 -4
- package/index.js +1 -1
- package/legacy/Button/Button.js +4 -1
- package/legacy/ButtonGroup/ButtonGroup.js +81 -56
- package/legacy/ButtonGroup/ButtonGroupButtonContext.js +9 -0
- package/legacy/ButtonGroup/buttonGroupClasses.js +1 -1
- package/legacy/Modal/Modal.js +3 -1
- package/legacy/Slider/Slider.js +9 -86
- package/legacy/Tabs/Tabs.js +1 -4
- package/legacy/index.js +1 -1
- package/legacy/useTouchRipple/useTouchRipple.js +4 -4
- package/modern/Button/Button.js +4 -1
- package/modern/ButtonGroup/ButtonGroup.js +86 -54
- package/modern/ButtonGroup/ButtonGroupButtonContext.js +9 -0
- package/modern/ButtonGroup/buttonGroupClasses.js +1 -1
- package/modern/Modal/Modal.js +1 -1
- package/modern/Slider/Slider.js +9 -86
- package/modern/Tabs/Tabs.js +1 -4
- package/modern/index.js +1 -1
- package/node/Button/Button.js +4 -1
- package/node/ButtonGroup/ButtonGroup.js +86 -54
- package/node/ButtonGroup/ButtonGroupButtonContext.js +18 -0
- package/node/ButtonGroup/buttonGroupClasses.js +1 -1
- package/node/Modal/Modal.js +1 -1
- package/node/Slider/Slider.js +3 -73
- package/node/Tabs/Tabs.js +1 -4
- package/node/index.js +1 -1
- package/node/useTouchRipple/useTouchRipple.js +4 -4
- package/package.json +16 -16
- package/umd/material-ui.development.js +209 -232
- package/umd/material-ui.production.min.js +18 -18
- package/useTouchRipple/useTouchRipple.js +4 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @ignore - internal component.
|
|
4
|
+
*/
|
|
5
|
+
var ButtonGroupButtonContext = /*#__PURE__*/React.createContext(undefined);
|
|
6
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
+
ButtonGroupButtonContext.displayName = 'ButtonGroupButtonContext';
|
|
8
|
+
}
|
|
9
|
+
export default ButtonGroupButtonContext;
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getButtonGroupUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiButtonGroup', slot);
|
|
5
5
|
}
|
|
6
|
-
var buttonGroupClasses = generateUtilityClasses('MuiButtonGroup', ['root', 'contained', 'outlined', 'text', 'disableElevation', 'disabled', 'fullWidth', 'vertical', 'grouped', 'groupedHorizontal', 'groupedVertical', 'groupedText', 'groupedTextHorizontal', 'groupedTextVertical', 'groupedTextPrimary', 'groupedTextSecondary', 'groupedOutlined', 'groupedOutlinedHorizontal', 'groupedOutlinedVertical', 'groupedOutlinedPrimary', 'groupedOutlinedSecondary', 'groupedContained', 'groupedContainedHorizontal', 'groupedContainedVertical', 'groupedContainedPrimary', 'groupedContainedSecondary']);
|
|
6
|
+
var buttonGroupClasses = generateUtilityClasses('MuiButtonGroup', ['root', 'contained', 'outlined', 'text', 'disableElevation', 'disabled', 'firstButton', 'fullWidth', 'vertical', 'grouped', 'groupedHorizontal', 'groupedVertical', 'groupedText', 'groupedTextHorizontal', 'groupedTextVertical', 'groupedTextPrimary', 'groupedTextSecondary', 'groupedOutlined', 'groupedOutlinedHorizontal', 'groupedOutlinedVertical', 'groupedOutlinedPrimary', 'groupedOutlinedSecondary', 'groupedContained', 'groupedContainedHorizontal', 'groupedContainedVertical', 'groupedContainedPrimary', 'groupedContainedSecondary', 'lastButton', 'middleButton']);
|
|
7
7
|
export default buttonGroupClasses;
|
package/legacy/Modal/Modal.js
CHANGED
|
@@ -109,11 +109,13 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
109
109
|
keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted,
|
|
110
110
|
onBackdropClick = props.onBackdropClick,
|
|
111
111
|
onClose = props.onClose,
|
|
112
|
+
onTransitionEnter = props.onTransitionEnter,
|
|
113
|
+
onTransitionExited = props.onTransitionExited,
|
|
112
114
|
open = props.open,
|
|
113
115
|
slotProps = props.slotProps,
|
|
114
116
|
slots = props.slots,
|
|
115
117
|
theme = props.theme,
|
|
116
|
-
other = _objectWithoutProperties(props, ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "container", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "onBackdropClick", "onClose", "open", "slotProps", "slots", "theme"]);
|
|
118
|
+
other = _objectWithoutProperties(props, ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "container", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "onBackdropClick", "onClose", "onTransitionEnter", "onTransitionExited", "open", "slotProps", "slots", "theme"]);
|
|
117
119
|
var propsWithDefaults = _extends({}, props, {
|
|
118
120
|
closeAfterTransition: closeAfterTransition,
|
|
119
121
|
disableAutoFocus: disableAutoFocus,
|
package/legacy/Slider/Slider.js
CHANGED
|
@@ -15,14 +15,14 @@ import styled, { slotShouldForwardProp } from '../styles/styled';
|
|
|
15
15
|
import useTheme from '../styles/useTheme';
|
|
16
16
|
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
17
17
|
import capitalize from '../utils/capitalize';
|
|
18
|
-
import
|
|
18
|
+
import BaseSliderValueLabel from './SliderValueLabel';
|
|
19
19
|
import sliderClasses, { getSliderUtilityClass } from './sliderClasses';
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
function Identity(x) {
|
|
23
23
|
return x;
|
|
24
24
|
}
|
|
25
|
-
var SliderRoot = styled('span', {
|
|
25
|
+
export var SliderRoot = styled('span', {
|
|
26
26
|
name: 'MuiSlider',
|
|
27
27
|
slot: 'Root',
|
|
28
28
|
overridesResolver: function overridesResolver(props, styles) {
|
|
@@ -80,18 +80,7 @@ var SliderRoot = styled('span', {
|
|
|
80
80
|
transition: 'none'
|
|
81
81
|
})), _extends2));
|
|
82
82
|
});
|
|
83
|
-
|
|
84
|
-
// ----------------------------- Warning --------------------------------
|
|
85
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
86
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
87
|
-
// ----------------------------------------------------------------------
|
|
88
|
-
/**
|
|
89
|
-
* @ignore
|
|
90
|
-
*/
|
|
91
|
-
children: PropTypes.node
|
|
92
|
-
} : void 0;
|
|
93
|
-
export { SliderRoot };
|
|
94
|
-
var SliderRail = styled('span', {
|
|
83
|
+
export var SliderRail = styled('span', {
|
|
95
84
|
name: 'MuiSlider',
|
|
96
85
|
slot: 'Rail',
|
|
97
86
|
overridesResolver: function overridesResolver(props, styles) {
|
|
@@ -119,18 +108,7 @@ var SliderRail = styled('span', {
|
|
|
119
108
|
opacity: 1
|
|
120
109
|
});
|
|
121
110
|
});
|
|
122
|
-
|
|
123
|
-
// ----------------------------- Warning --------------------------------
|
|
124
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
125
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
126
|
-
// ----------------------------------------------------------------------
|
|
127
|
-
/**
|
|
128
|
-
* @ignore
|
|
129
|
-
*/
|
|
130
|
-
children: PropTypes.node
|
|
131
|
-
} : void 0;
|
|
132
|
-
export { SliderRail };
|
|
133
|
-
var SliderTrack = styled('span', {
|
|
111
|
+
export var SliderTrack = styled('span', {
|
|
134
112
|
name: 'MuiSlider',
|
|
135
113
|
slot: 'Track',
|
|
136
114
|
overridesResolver: function overridesResolver(props, styles) {
|
|
@@ -168,18 +146,7 @@ var SliderTrack = styled('span', {
|
|
|
168
146
|
borderColor: theme.vars ? theme.vars.palette.Slider["".concat(ownerState.color, "Track")] : color
|
|
169
147
|
});
|
|
170
148
|
});
|
|
171
|
-
|
|
172
|
-
// ----------------------------- Warning --------------------------------
|
|
173
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
174
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
175
|
-
// ----------------------------------------------------------------------
|
|
176
|
-
/**
|
|
177
|
-
* @ignore
|
|
178
|
-
*/
|
|
179
|
-
children: PropTypes.node
|
|
180
|
-
} : void 0;
|
|
181
|
-
export { SliderTrack };
|
|
182
|
-
var SliderThumb = styled('span', {
|
|
149
|
+
export var SliderThumb = styled('span', {
|
|
183
150
|
name: 'MuiSlider',
|
|
184
151
|
slot: 'Thumb',
|
|
185
152
|
overridesResolver: function overridesResolver(props, styles) {
|
|
@@ -248,18 +215,7 @@ var SliderThumb = styled('span', {
|
|
|
248
215
|
}
|
|
249
216
|
}), _extends3));
|
|
250
217
|
});
|
|
251
|
-
|
|
252
|
-
// ----------------------------- Warning --------------------------------
|
|
253
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
254
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
255
|
-
// ----------------------------------------------------------------------
|
|
256
|
-
/**
|
|
257
|
-
* @ignore
|
|
258
|
-
*/
|
|
259
|
-
children: PropTypes.node
|
|
260
|
-
} : void 0;
|
|
261
|
-
export { SliderThumb };
|
|
262
|
-
var StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
218
|
+
export var SliderValueLabel = styled(BaseSliderValueLabel, {
|
|
263
219
|
name: 'MuiSlider',
|
|
264
220
|
slot: 'ValueLabel',
|
|
265
221
|
overridesResolver: function overridesResolver(props, styles) {
|
|
@@ -317,18 +273,7 @@ var StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
|
317
273
|
padding: '0.25rem 0.5rem'
|
|
318
274
|
});
|
|
319
275
|
});
|
|
320
|
-
|
|
321
|
-
// ----------------------------- Warning --------------------------------
|
|
322
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
323
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
324
|
-
// ----------------------------------------------------------------------
|
|
325
|
-
/**
|
|
326
|
-
* @ignore
|
|
327
|
-
*/
|
|
328
|
-
children: PropTypes.node
|
|
329
|
-
} : void 0;
|
|
330
|
-
export { StyledSliderValueLabel as SliderValueLabel };
|
|
331
|
-
var SliderMark = styled('span', {
|
|
276
|
+
export var SliderMark = styled('span', {
|
|
332
277
|
name: 'MuiSlider',
|
|
333
278
|
slot: 'Mark',
|
|
334
279
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
@@ -359,18 +304,7 @@ var SliderMark = styled('span', {
|
|
|
359
304
|
opacity: 0.8
|
|
360
305
|
});
|
|
361
306
|
});
|
|
362
|
-
|
|
363
|
-
// ----------------------------- Warning --------------------------------
|
|
364
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
365
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
366
|
-
// ----------------------------------------------------------------------
|
|
367
|
-
/**
|
|
368
|
-
* @ignore
|
|
369
|
-
*/
|
|
370
|
-
children: PropTypes.node
|
|
371
|
-
} : void 0;
|
|
372
|
-
export { SliderMark };
|
|
373
|
-
var SliderMarkLabel = styled('span', {
|
|
307
|
+
export var SliderMarkLabel = styled('span', {
|
|
374
308
|
name: 'MuiSlider',
|
|
375
309
|
slot: 'MarkLabel',
|
|
376
310
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
@@ -403,17 +337,6 @@ var SliderMarkLabel = styled('span', {
|
|
|
403
337
|
color: (theme.vars || theme).palette.text.primary
|
|
404
338
|
});
|
|
405
339
|
});
|
|
406
|
-
process.env.NODE_ENV !== "production" ? SliderMarkLabel.propTypes /* remove-proptypes */ = {
|
|
407
|
-
// ----------------------------- Warning --------------------------------
|
|
408
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
409
|
-
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
410
|
-
// ----------------------------------------------------------------------
|
|
411
|
-
/**
|
|
412
|
-
* @ignore
|
|
413
|
-
*/
|
|
414
|
-
children: PropTypes.node
|
|
415
|
-
} : void 0;
|
|
416
|
-
export { SliderMarkLabel };
|
|
417
340
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
418
341
|
var disabled = ownerState.disabled,
|
|
419
342
|
dragging = ownerState.dragging,
|
|
@@ -545,7 +468,7 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
545
468
|
var RailSlot = (_ref10 = (_slots$rail = slots == null ? void 0 : slots.rail) != null ? _slots$rail : components.Rail) != null ? _ref10 : SliderRail;
|
|
546
469
|
var TrackSlot = (_ref11 = (_slots$track = slots == null ? void 0 : slots.track) != null ? _slots$track : components.Track) != null ? _ref11 : SliderTrack;
|
|
547
470
|
var ThumbSlot = (_ref12 = (_slots$thumb = slots == null ? void 0 : slots.thumb) != null ? _slots$thumb : components.Thumb) != null ? _ref12 : SliderThumb;
|
|
548
|
-
var ValueLabelSlot = (_ref13 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref13 :
|
|
471
|
+
var ValueLabelSlot = (_ref13 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref13 : SliderValueLabel;
|
|
549
472
|
var MarkSlot = (_ref14 = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : components.Mark) != null ? _ref14 : SliderMark;
|
|
550
473
|
var MarkLabelSlot = (_ref15 = (_slots$markLabel = slots == null ? void 0 : slots.markLabel) != null ? _slots$markLabel : components.MarkLabel) != null ? _ref15 : SliderMarkLabel;
|
|
551
474
|
var InputSlot = (_ref16 = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input) != null ? _ref16 : 'input';
|
package/legacy/Tabs/Tabs.js
CHANGED
|
@@ -180,10 +180,7 @@ var TabsIndicator = styled('span', {
|
|
|
180
180
|
right: 0
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
|
-
var TabsScrollbarSize = styled(ScrollbarSize
|
|
184
|
-
name: 'MuiTabs',
|
|
185
|
-
slot: 'ScrollbarSize'
|
|
186
|
-
})({
|
|
183
|
+
var TabsScrollbarSize = styled(ScrollbarSize)({
|
|
187
184
|
overflowX: 'auto',
|
|
188
185
|
overflowY: 'hidden',
|
|
189
186
|
// Hide dimensionless scrollbar on macOS
|
package/legacy/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var useTouchRipple = function useTouchRipple(props) {
|
|
|
12
12
|
React.useEffect(function () {
|
|
13
13
|
if (focusVisible && !disableFocusRipple && !disableRipple) {
|
|
14
14
|
var _rippleRef$current;
|
|
15
|
-
(_rippleRef$current = rippleRef.current) == null
|
|
15
|
+
(_rippleRef$current = rippleRef.current) == null || _rippleRef$current.pulsate();
|
|
16
16
|
}
|
|
17
17
|
}, [rippleRef, focusVisible, disableFocusRipple, disableRipple]);
|
|
18
18
|
function useRippleHandler(rippleAction) {
|
|
@@ -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 || (_rippleRef$current2 = rippleRef.current) == null
|
|
33
|
+
rippleRef == null || (_rippleRef$current2 = rippleRef.current) == null || _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 || (_rippleRef$current3 = rippleRef.current) == null
|
|
44
|
+
rippleRef == null || (_rippleRef$current3 = rippleRef.current) == null || _rippleRef$current3.pulsate(event);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
});
|
|
@@ -83,7 +83,7 @@ var useTouchRipple = function useTouchRipple(props) {
|
|
|
83
83
|
name: eventName,
|
|
84
84
|
handler: function handler(ev) {
|
|
85
85
|
var _otherEvents$eventNam;
|
|
86
|
-
(_otherEvents$eventNam = otherEvents[eventName]) == null
|
|
86
|
+
(_otherEvents$eventNam = otherEvents[eventName]) == null || _otherEvents$eventNam.call(otherEvents, ev);
|
|
87
87
|
rippleHandlers[eventName](ev);
|
|
88
88
|
}
|
|
89
89
|
};
|
package/modern/Button/Button.js
CHANGED
|
@@ -15,6 +15,7 @@ import ButtonBase from '../ButtonBase';
|
|
|
15
15
|
import capitalize from '../utils/capitalize';
|
|
16
16
|
import buttonClasses, { getButtonUtilityClass } from './buttonClasses';
|
|
17
17
|
import ButtonGroupContext from '../ButtonGroup/ButtonGroupContext';
|
|
18
|
+
import ButtonGroupButtonContext from '../ButtonGroup/ButtonGroupButtonContext';
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
const useUtilityClasses = ownerState => {
|
|
@@ -220,6 +221,7 @@ const ButtonEndIcon = styled('span', {
|
|
|
220
221
|
const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
|
|
221
222
|
// props priority: `inProps` > `contextProps` > `themeDefaultProps`
|
|
222
223
|
const contextProps = React.useContext(ButtonGroupContext);
|
|
224
|
+
const buttonGroupButtonContextPositionClassName = React.useContext(ButtonGroupButtonContext);
|
|
223
225
|
const resolvedProps = resolveProps(contextProps, inProps);
|
|
224
226
|
const props = useThemeProps({
|
|
225
227
|
props: resolvedProps,
|
|
@@ -264,9 +266,10 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
|
|
|
264
266
|
ownerState: ownerState,
|
|
265
267
|
children: endIconProp
|
|
266
268
|
});
|
|
269
|
+
const positionClassName = buttonGroupButtonContextPositionClassName || '';
|
|
267
270
|
return /*#__PURE__*/_jsxs(ButtonRoot, _extends({
|
|
268
271
|
ownerState: ownerState,
|
|
269
|
-
className: clsx(contextProps.className, classes.root, className),
|
|
272
|
+
className: clsx(contextProps.className, classes.root, className, positionClassName),
|
|
270
273
|
component: component,
|
|
271
274
|
disabled: disabled,
|
|
272
275
|
focusRipple: !disableFocusRipple,
|
|
@@ -13,6 +13,7 @@ import styled from '../styles/styled';
|
|
|
13
13
|
import useThemeProps from '../styles/useThemeProps';
|
|
14
14
|
import buttonGroupClasses, { getButtonGroupUtilityClass } from './buttonGroupClasses';
|
|
15
15
|
import ButtonGroupContext from './ButtonGroupContext';
|
|
16
|
+
import ButtonGroupButtonContext from './ButtonGroupButtonContext';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
const overridesResolver = (props, styles) => {
|
|
18
19
|
const {
|
|
@@ -28,6 +29,12 @@ const overridesResolver = (props, styles) => {
|
|
|
28
29
|
[`& .${buttonGroupClasses.grouped}`]: styles[`grouped${capitalize(ownerState.variant)}${capitalize(ownerState.orientation)}`]
|
|
29
30
|
}, {
|
|
30
31
|
[`& .${buttonGroupClasses.grouped}`]: styles[`grouped${capitalize(ownerState.variant)}${capitalize(ownerState.color)}`]
|
|
32
|
+
}, {
|
|
33
|
+
[`& .${buttonGroupClasses.firstButton}`]: styles.firstButton
|
|
34
|
+
}, {
|
|
35
|
+
[`& .${buttonGroupClasses.lastButton}`]: styles.lastButton
|
|
36
|
+
}, {
|
|
37
|
+
[`& .${buttonGroupClasses.middleButton}`]: styles.middleButton
|
|
31
38
|
}, styles.root, styles[ownerState.variant], ownerState.disableElevation === true && styles.disableElevation, ownerState.fullWidth && styles.fullWidth, ownerState.orientation === 'vertical' && styles.vertical];
|
|
32
39
|
};
|
|
33
40
|
const useUtilityClasses = ownerState => {
|
|
@@ -42,7 +49,10 @@ const useUtilityClasses = ownerState => {
|
|
|
42
49
|
} = ownerState;
|
|
43
50
|
const slots = {
|
|
44
51
|
root: ['root', variant, orientation === 'vertical' && 'vertical', fullWidth && 'fullWidth', disableElevation && 'disableElevation'],
|
|
45
|
-
grouped: ['grouped', `grouped${capitalize(orientation)}`, `grouped${capitalize(variant)}`, `grouped${capitalize(variant)}${capitalize(orientation)}`, `grouped${capitalize(variant)}${capitalize(color)}`, disabled && 'disabled']
|
|
52
|
+
grouped: ['grouped', `grouped${capitalize(orientation)}`, `grouped${capitalize(variant)}`, `grouped${capitalize(variant)}${capitalize(orientation)}`, `grouped${capitalize(variant)}${capitalize(color)}`, disabled && 'disabled'],
|
|
53
|
+
firstButton: ['firstButton'],
|
|
54
|
+
lastButton: ['lastButton'],
|
|
55
|
+
middleButton: ['middleButton']
|
|
46
56
|
};
|
|
47
57
|
return composeClasses(slots, getButtonGroupUtilityClass, classes);
|
|
48
58
|
};
|
|
@@ -67,63 +77,63 @@ const ButtonGroupRoot = styled('div', {
|
|
|
67
77
|
}, {
|
|
68
78
|
[`& .${buttonGroupClasses.grouped}`]: _extends({
|
|
69
79
|
minWidth: 40,
|
|
70
|
-
'&:not(:first-of-type)': _extends({}, ownerState.orientation === 'horizontal' && {
|
|
71
|
-
borderTopLeftRadius: 0,
|
|
72
|
-
borderBottomLeftRadius: 0
|
|
73
|
-
}, ownerState.orientation === 'vertical' && {
|
|
74
|
-
borderTopRightRadius: 0,
|
|
75
|
-
borderTopLeftRadius: 0
|
|
76
|
-
}, ownerState.variant === 'outlined' && ownerState.orientation === 'horizontal' && {
|
|
77
|
-
marginLeft: -1
|
|
78
|
-
}, ownerState.variant === 'outlined' && ownerState.orientation === 'vertical' && {
|
|
79
|
-
marginTop: -1
|
|
80
|
-
}),
|
|
81
|
-
'&:not(:last-of-type)': _extends({}, ownerState.orientation === 'horizontal' && {
|
|
82
|
-
borderTopRightRadius: 0,
|
|
83
|
-
borderBottomRightRadius: 0
|
|
84
|
-
}, ownerState.orientation === 'vertical' && {
|
|
85
|
-
borderBottomRightRadius: 0,
|
|
86
|
-
borderBottomLeftRadius: 0
|
|
87
|
-
}, ownerState.variant === 'text' && ownerState.orientation === 'horizontal' && {
|
|
88
|
-
borderRight: theme.vars ? `1px solid rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : `1px solid ${theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'}`,
|
|
89
|
-
[`&.${buttonGroupClasses.disabled}`]: {
|
|
90
|
-
borderRight: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
91
|
-
}
|
|
92
|
-
}, ownerState.variant === 'text' && ownerState.orientation === 'vertical' && {
|
|
93
|
-
borderBottom: theme.vars ? `1px solid rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : `1px solid ${theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'}`,
|
|
94
|
-
[`&.${buttonGroupClasses.disabled}`]: {
|
|
95
|
-
borderBottom: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
96
|
-
}
|
|
97
|
-
}, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
|
|
98
|
-
borderColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.5)` : alpha(theme.palette[ownerState.color].main, 0.5)
|
|
99
|
-
}, ownerState.variant === 'outlined' && ownerState.orientation === 'horizontal' && {
|
|
100
|
-
borderRightColor: 'transparent'
|
|
101
|
-
}, ownerState.variant === 'outlined' && ownerState.orientation === 'vertical' && {
|
|
102
|
-
borderBottomColor: 'transparent'
|
|
103
|
-
}, ownerState.variant === 'contained' && ownerState.orientation === 'horizontal' && {
|
|
104
|
-
borderRight: `1px solid ${(theme.vars || theme).palette.grey[400]}`,
|
|
105
|
-
[`&.${buttonGroupClasses.disabled}`]: {
|
|
106
|
-
borderRight: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
107
|
-
}
|
|
108
|
-
}, ownerState.variant === 'contained' && ownerState.orientation === 'vertical' && {
|
|
109
|
-
borderBottom: `1px solid ${(theme.vars || theme).palette.grey[400]}`,
|
|
110
|
-
[`&.${buttonGroupClasses.disabled}`]: {
|
|
111
|
-
borderBottom: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
112
|
-
}
|
|
113
|
-
}, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
|
|
114
|
-
borderColor: (theme.vars || theme).palette[ownerState.color].dark
|
|
115
|
-
}, {
|
|
116
|
-
'&:hover': _extends({}, ownerState.variant === 'outlined' && ownerState.orientation === 'horizontal' && {
|
|
117
|
-
borderRightColor: 'currentColor'
|
|
118
|
-
}, ownerState.variant === 'outlined' && ownerState.orientation === 'vertical' && {
|
|
119
|
-
borderBottomColor: 'currentColor'
|
|
120
|
-
})
|
|
121
|
-
}),
|
|
122
80
|
'&:hover': _extends({}, ownerState.variant === 'contained' && {
|
|
123
81
|
boxShadow: 'none'
|
|
124
82
|
})
|
|
125
83
|
}, ownerState.variant === 'contained' && {
|
|
126
84
|
boxShadow: 'none'
|
|
85
|
+
}),
|
|
86
|
+
[`& .${buttonGroupClasses.firstButton},& .${buttonGroupClasses.middleButton}`]: _extends({}, ownerState.orientation === 'horizontal' && {
|
|
87
|
+
borderTopRightRadius: 0,
|
|
88
|
+
borderBottomRightRadius: 0
|
|
89
|
+
}, ownerState.orientation === 'vertical' && {
|
|
90
|
+
borderBottomRightRadius: 0,
|
|
91
|
+
borderBottomLeftRadius: 0
|
|
92
|
+
}, ownerState.variant === 'text' && ownerState.orientation === 'horizontal' && {
|
|
93
|
+
borderRight: theme.vars ? `1px solid rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : `1px solid ${theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'}`,
|
|
94
|
+
[`&.${buttonGroupClasses.disabled}`]: {
|
|
95
|
+
borderRight: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
96
|
+
}
|
|
97
|
+
}, ownerState.variant === 'text' && ownerState.orientation === 'vertical' && {
|
|
98
|
+
borderBottom: theme.vars ? `1px solid rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : `1px solid ${theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'}`,
|
|
99
|
+
[`&.${buttonGroupClasses.disabled}`]: {
|
|
100
|
+
borderBottom: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
101
|
+
}
|
|
102
|
+
}, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
|
|
103
|
+
borderColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.5)` : alpha(theme.palette[ownerState.color].main, 0.5)
|
|
104
|
+
}, ownerState.variant === 'outlined' && ownerState.orientation === 'horizontal' && {
|
|
105
|
+
borderRightColor: 'transparent'
|
|
106
|
+
}, ownerState.variant === 'outlined' && ownerState.orientation === 'vertical' && {
|
|
107
|
+
borderBottomColor: 'transparent'
|
|
108
|
+
}, ownerState.variant === 'contained' && ownerState.orientation === 'horizontal' && {
|
|
109
|
+
borderRight: `1px solid ${(theme.vars || theme).palette.grey[400]}`,
|
|
110
|
+
[`&.${buttonGroupClasses.disabled}`]: {
|
|
111
|
+
borderRight: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
112
|
+
}
|
|
113
|
+
}, ownerState.variant === 'contained' && ownerState.orientation === 'vertical' && {
|
|
114
|
+
borderBottom: `1px solid ${(theme.vars || theme).palette.grey[400]}`,
|
|
115
|
+
[`&.${buttonGroupClasses.disabled}`]: {
|
|
116
|
+
borderBottom: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
117
|
+
}
|
|
118
|
+
}, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
|
|
119
|
+
borderColor: (theme.vars || theme).palette[ownerState.color].dark
|
|
120
|
+
}, {
|
|
121
|
+
'&:hover': _extends({}, ownerState.variant === 'outlined' && ownerState.orientation === 'horizontal' && {
|
|
122
|
+
borderRightColor: 'currentColor'
|
|
123
|
+
}, ownerState.variant === 'outlined' && ownerState.orientation === 'vertical' && {
|
|
124
|
+
borderBottomColor: 'currentColor'
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
[`& .${buttonGroupClasses.lastButton},& .${buttonGroupClasses.middleButton}`]: _extends({}, ownerState.orientation === 'horizontal' && {
|
|
128
|
+
borderTopLeftRadius: 0,
|
|
129
|
+
borderBottomLeftRadius: 0
|
|
130
|
+
}, ownerState.orientation === 'vertical' && {
|
|
131
|
+
borderTopRightRadius: 0,
|
|
132
|
+
borderTopLeftRadius: 0
|
|
133
|
+
}, ownerState.variant === 'outlined' && ownerState.orientation === 'horizontal' && {
|
|
134
|
+
marginLeft: -1
|
|
135
|
+
}, ownerState.variant === 'outlined' && ownerState.orientation === 'vertical' && {
|
|
136
|
+
marginTop: -1
|
|
127
137
|
})
|
|
128
138
|
}));
|
|
129
139
|
const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(inProps, ref) {
|
|
@@ -170,6 +180,20 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(inProps,
|
|
|
170
180
|
size,
|
|
171
181
|
variant
|
|
172
182
|
}), [color, disabled, disableElevation, disableFocusRipple, disableRipple, fullWidth, size, variant, classes.grouped]);
|
|
183
|
+
const getButtonPositionClassName = (index, childrenParam) => {
|
|
184
|
+
const isFirstButton = index === 0;
|
|
185
|
+
const isLastButton = index === React.Children.count(childrenParam) - 1;
|
|
186
|
+
if (isFirstButton && isLastButton) {
|
|
187
|
+
return '';
|
|
188
|
+
}
|
|
189
|
+
if (isFirstButton) {
|
|
190
|
+
return classes.firstButton;
|
|
191
|
+
}
|
|
192
|
+
if (isLastButton) {
|
|
193
|
+
return classes.lastButton;
|
|
194
|
+
}
|
|
195
|
+
return classes.middleButton;
|
|
196
|
+
};
|
|
173
197
|
return /*#__PURE__*/_jsx(ButtonGroupRoot, _extends({
|
|
174
198
|
as: component,
|
|
175
199
|
role: "group",
|
|
@@ -179,7 +203,15 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(inProps,
|
|
|
179
203
|
}, other, {
|
|
180
204
|
children: /*#__PURE__*/_jsx(ButtonGroupContext.Provider, {
|
|
181
205
|
value: context,
|
|
182
|
-
children: children
|
|
206
|
+
children: React.Children.map(children, (child, index) => {
|
|
207
|
+
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
208
|
+
return child;
|
|
209
|
+
}
|
|
210
|
+
return /*#__PURE__*/_jsx(ButtonGroupButtonContext.Provider, {
|
|
211
|
+
value: getButtonPositionClassName(index, children),
|
|
212
|
+
children: child
|
|
213
|
+
});
|
|
214
|
+
})
|
|
183
215
|
})
|
|
184
216
|
}));
|
|
185
217
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @ignore - internal component.
|
|
4
|
+
*/
|
|
5
|
+
const ButtonGroupButtonContext = /*#__PURE__*/React.createContext(undefined);
|
|
6
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
+
ButtonGroupButtonContext.displayName = 'ButtonGroupButtonContext';
|
|
8
|
+
}
|
|
9
|
+
export default ButtonGroupButtonContext;
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getButtonGroupUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiButtonGroup', slot);
|
|
5
5
|
}
|
|
6
|
-
const buttonGroupClasses = generateUtilityClasses('MuiButtonGroup', ['root', 'contained', 'outlined', 'text', 'disableElevation', 'disabled', 'fullWidth', 'vertical', 'grouped', 'groupedHorizontal', 'groupedVertical', 'groupedText', 'groupedTextHorizontal', 'groupedTextVertical', 'groupedTextPrimary', 'groupedTextSecondary', 'groupedOutlined', 'groupedOutlinedHorizontal', 'groupedOutlinedVertical', 'groupedOutlinedPrimary', 'groupedOutlinedSecondary', 'groupedContained', 'groupedContainedHorizontal', 'groupedContainedVertical', 'groupedContainedPrimary', 'groupedContainedSecondary']);
|
|
6
|
+
const buttonGroupClasses = generateUtilityClasses('MuiButtonGroup', ['root', 'contained', 'outlined', 'text', 'disableElevation', 'disabled', 'firstButton', 'fullWidth', 'vertical', 'grouped', 'groupedHorizontal', 'groupedVertical', 'groupedText', 'groupedTextHorizontal', 'groupedTextVertical', 'groupedTextPrimary', 'groupedTextSecondary', 'groupedOutlined', 'groupedOutlinedHorizontal', 'groupedOutlinedVertical', 'groupedOutlinedPrimary', 'groupedOutlinedSecondary', 'groupedContained', 'groupedContainedHorizontal', 'groupedContainedVertical', 'groupedContainedPrimary', 'groupedContainedSecondary', 'lastButton', 'middleButton']);
|
|
7
7
|
export default buttonGroupClasses;
|
package/modern/Modal/Modal.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "container", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "onBackdropClick", "onClose", "open", "slotProps", "slots", "theme"];
|
|
5
|
+
const _excluded = ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "container", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "onBackdropClick", "onClose", "onTransitionEnter", "onTransitionExited", "open", "slotProps", "slots", "theme"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|