@mui/system 5.9.3 → 5.10.0

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.
Files changed (65) hide show
  1. package/Box/Box.spec.d.ts +1 -1
  2. package/CHANGELOG.md +65 -4
  3. package/Container/Container.d.ts +13 -13
  4. package/Container/ContainerProps.d.ts +40 -40
  5. package/Container/containerClasses.d.ts +22 -22
  6. package/Container/createContainer.d.ts +18 -18
  7. package/README.md +1 -1
  8. package/Stack/Stack.d.ts +12 -0
  9. package/Stack/Stack.js +62 -0
  10. package/Stack/StackProps.d.ts +42 -0
  11. package/Stack/StackProps.js +5 -0
  12. package/Stack/createStack.d.ts +21 -0
  13. package/Stack/createStack.js +209 -0
  14. package/Stack/index.d.ts +5 -0
  15. package/Stack/index.js +65 -0
  16. package/Stack/package.json +6 -0
  17. package/Stack/stackClasses.d.ts +8 -0
  18. package/Stack/stackClasses.js +17 -0
  19. package/Unstable_Grid/Grid.d.ts +12 -12
  20. package/Unstable_Grid/GridProps.d.ts +162 -162
  21. package/Unstable_Grid/createGrid.d.ts +11 -11
  22. package/Unstable_Grid/gridClasses.d.ts +20 -20
  23. package/Unstable_Grid/gridGenerator.d.ts +26 -26
  24. package/Unstable_Grid/index.d.ts +5 -5
  25. package/breakpoints.d.ts +21 -0
  26. package/createBox.js +3 -1
  27. package/createBox.spec.d.ts +1 -1
  28. package/createStyled.js +30 -11
  29. package/createTheme/createSpacing.d.ts +10 -10
  30. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  31. package/cssVars/createGetCssVar.d.ts +5 -5
  32. package/cssVars/cssVarsParser.d.ts +65 -65
  33. package/cssVars/getInitColorSchemeScript.d.ts +45 -45
  34. package/cssVars/index.d.ts +3 -3
  35. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  36. package/esm/Stack/Stack.js +51 -0
  37. package/esm/Stack/StackProps.js +1 -0
  38. package/esm/Stack/createStack.js +179 -0
  39. package/esm/Stack/index.js +5 -0
  40. package/esm/Stack/stackClasses.js +6 -0
  41. package/esm/createBox.js +3 -1
  42. package/esm/createStyled.js +28 -10
  43. package/esm/index.js +3 -1
  44. package/index.d.ts +4 -6
  45. package/index.js +25 -2
  46. package/index.spec.d.ts +1 -1
  47. package/legacy/Stack/Stack.js +51 -0
  48. package/legacy/Stack/StackProps.js +1 -0
  49. package/legacy/Stack/createStack.js +187 -0
  50. package/legacy/Stack/index.js +5 -0
  51. package/legacy/Stack/stackClasses.js +6 -0
  52. package/legacy/createBox.js +5 -1
  53. package/legacy/createStyled.js +31 -10
  54. package/legacy/index.js +4 -2
  55. package/modern/Stack/Stack.js +51 -0
  56. package/modern/Stack/StackProps.js +1 -0
  57. package/modern/Stack/createStack.js +179 -0
  58. package/modern/Stack/index.js +5 -0
  59. package/modern/Stack/stackClasses.js +6 -0
  60. package/modern/createBox.js +3 -1
  61. package/modern/createStyled.js +28 -10
  62. package/modern/index.js +4 -2
  63. package/package.json +3 -3
  64. package/spacing.d.ts +6 -0
  65. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
package/Box/Box.spec.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/CHANGELOG.md CHANGED
@@ -1,5 +1,66 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.10.0
4
+
5
+ <!-- generated comparing v5.9.3..master -->
6
+
7
+ _Aug 8, 2022_
8
+
9
+ A big thanks to the 16 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - ✨ [Stack](https://mui.com/system/react-stack/) component is added to MUI System and Joy UI #33760 #33800 @mnajdova
12
+ - ✨ [Breadcrumbs](https://mui.com/joy-ui/react-breadcrumbs/) component is added to Joy UI (#32697) @hbjORbj
13
+ - Many other 🐛 bug fixes, 📚 documentation, and ⚙️ infrastructure improvements
14
+
15
+ ### `@mui/material@5.10.0`
16
+
17
+ - [Grid] Prevent crash if spacing is set to zero in theme (#33777) @PunitSoniME
18
+ - [Grid] Export interface `RegularBreakpoints` to fix type error (#33751) @ZeeshanTamboli
19
+ - [Skeleton] Add `rounded` variant (#33687) @siriwatknp
20
+ - [Stepper] Fix classes for icon container (#33734) @pratikkarad
21
+ - [TableCell] Enable size prop overrides via module augmentation (#33816) @brentertz
22
+ - [Tooltip] Fix tooltip arrow css var background (#33753) @TimoWilhelm
23
+ - [useScrollTrigger] Add passive flag to scroll trigger event listener #32437 (#33749) @Dsalazar1685
24
+
25
+ ### `@mui/system@5.10.0`
26
+
27
+ - Fix unnecessary styles created from `sx` (#33752) @siriwatknp
28
+ - Fix duplicated styles in Box (#33774) @iamxukai
29
+ - Don't spread props to DOM for string tags (#33761) @siriwatknp
30
+ - Add `Stack` component (#33760) @mnajdova
31
+
32
+ ### `@mui/joy@5.0.0-alpha.40`
33
+
34
+ - [Stack] Add new component (#33800) @mnajdova
35
+ - [Breadcrumbs] Add `Breadcrumbs` component (#32697) @hbjORbj
36
+ - [Card] Fix wrong api description for `size` prop (#33862) @hbjORbj
37
+ - Miscellaneous fixes (#33796, #33750) @siriwatknp
38
+
39
+ ### Docs
40
+
41
+ - [docs] Create, revise, and expand System "Getting started" docs (#33503) @samuelsycamore
42
+ - [docs] Test new image best practice @oliviertassinari
43
+ - [docs] Fix typo in the ClickAwayListerner name (#33813) @pawelsmigielski
44
+ - [docs] Fix link to `Basics` section in `Trap Focus` docs (#33772) @ZeeshanTamboli
45
+ - [docs] z-index added in popper when used by split button (#33763) @PunitSoniME
46
+ - [docs] Improve the guide for using @mui/base with Tailwind CSS (#33670) @mnajdova
47
+ - [docs] Fix warnings related to Next.js' links (#33693) @mnajdova
48
+ - [docs] Add notification to aggregation blogpost (#33745) @joserodolfofreitas
49
+ - [docs] Add Grid version 2 docs (#33554) @siriwatknp
50
+ - [examples] Fix `NextLinkComposedProps` type error (#33842) @adham618
51
+
52
+ ### Core
53
+
54
+ - [blog] Add social card to Tenerife retreat post (#33764)
55
+ - [blog] Fix blue outline bug (#33707) @oliviertassinari
56
+ - [blog] Improve the width of the layout (#33706) @oliviertassinari@samuelsycamore
57
+ - [core] Remove unnecessary packageName attribute from pages (#33488) @cherniavskii
58
+ - [core] Remove duplicated CODE_OF_CONDUCT (#33702) @oliviertassinari
59
+ - [core] Update Playwright packages together (#33737) @michaldudak
60
+ - [website] Fix notifications not being marked as read in production (#33756) @cherniavskii
61
+
62
+ All contributors of this release in alphabetical order: @adham618, @brentertz, @cherniavskii, @Dsalazar1685, @hbjORbj, @iamxukai, @joserodolfofreitas, @michaldudak, @mnajdova, @oliviertassinari, @pawelsmigielski, @pratikkarad, @PunitSoniME, @siriwatknp, @TimoWilhelm, @ZeeshanTamboli
63
+
3
64
  ## 5.9.3
4
65
 
5
66
  <!-- generated comparing v5.9.2..master -->
@@ -6880,7 +6941,7 @@ A big thanks to the 34 contributors who made this release possible. Here are som
6880
6941
 
6881
6942
  While the source code is currently hosted in the [main repository](https://github.com/mui/material-ui), we might move it to the [x repository](https://github.com/mui/mui-x) in the future, depending on what is easier for the commercial date range picker. The date picker will stay open source no matter what.
6882
6943
 
6883
- - 📚 Revamp the documentation for [the system](https://mui.com/system/basics/). The System contains CSS utilities. The documentation now promotes the use of the `sx` prop. It's ideal for adding one-off styles, e.g. padding, but when pushed to its limits, it can be used to implement quickly a complete page.
6944
+ - 📚 Revamp the documentation for [the system](https://mui.com/system/getting-started/overview/). The System contains CSS utilities. The documentation now promotes the use of the `sx` prop. It's ideal for adding one-off styles, e.g. padding, but when pushed to its limits, it can be used to implement quickly a complete page.
6884
6945
  - 👩‍🎨 Upgrade emotion to v11 (#23007) @mnajdova.
6885
6946
  - And many more 🐛 bug fixes and 📚 improvements.
6886
6947
 
@@ -7282,7 +7343,7 @@ Here are some highlights ✨:
7282
7343
  If you target IE11, you need to use the new bundle (`legacy`). We are treating IE11 as a second class-citizen, which is a continuation of the direction taken in #22873.
7283
7344
 
7284
7345
  - 🚀 Improve the internal benchmark suite (#22923, #23058) @mnajdova.
7285
- This was a prerequisite step to improve the [system](https://mui.com/system/basics/). We needed to be able to measure performance. After #22945, we have measured that the `Box` component is x3 faster in v5-alpha compared to v4.
7346
+ This was a prerequisite step to improve the [system](https://mui.com/system/getting-started/overview/). We needed to be able to measure performance. After #22945, we have measured that the `Box` component is x3 faster in v5-alpha compared to v4.
7286
7347
  - ✏️ A new blog post: [Q3 2020 Update](https://mui.com/blog/2020-q3-update/) (#23055) @oliviertassinari.
7287
7348
  - 🐙 Migrate more tests to react-testing-library @deiga, @Morteza-Jenabzadeh, @nicholas-l.
7288
7349
  - And many more 🐛 bug fixes and 📚 improvements.
@@ -7623,7 +7684,7 @@ Here are some highlights ✨:
7623
7684
 
7624
7685
  The new styling solution saves 2kB gzipped in the bundle compared to JSS, and about 14 kB gzipped if you were already using emotion or styled-components.
7625
7686
 
7626
- Last but not least, the change allows us to take advantage dynamic style props. We will use them for dynamic color props, variant props, and new style props (an improved [system](https://mui.com/system/basics/)).
7687
+ Last but not least, the change allows us to take advantage dynamic style props. We will use them for dynamic color props, variant props, and new style props (an improved [system](https://mui.com/system/getting-started/overview/)).
7627
7688
 
7628
7689
  This change has been in our roadmap for more than a year.
7629
7690
  We announced it in the [v4 release blog post](https://mui.com/blog/material-ui-v4-is-out/) as a direction v5 would take.
@@ -8876,7 +8937,7 @@ A big thanks to the 33 contributors who made this release possible. Here are som
8876
8937
  />
8877
8938
  ```
8878
8939
 
8879
- - [Typography] Replace the `srOnly` prop so as to not duplicate the capabilities of [System](https://mui.com/system/basics/) (#21413) @mnajdova.
8940
+ - [Typography] Replace the `srOnly` prop so as to not duplicate the capabilities of [System](https://mui.com/system/getting-started/overview/) (#21413) @mnajdova.
8880
8941
 
8881
8942
  ```diff
8882
8943
  -import Typography from '@material-ui/core/Typography';
@@ -1,13 +1,13 @@
1
- /**
2
- *
3
- * Demos:
4
- *
5
- * - [Container (Material UI)](https://mui.com/material-ui/react-container/)
6
- * - [Container (MUI System)](https://mui.com/system/react-container/)
7
- *
8
- * API:
9
- *
10
- * - [Container API](https://mui.com/system/api/container/)
11
- */
12
- declare const Container: import("@mui/types").OverridableComponent<import("./ContainerProps").ContainerTypeMap<{}, "div">>;
13
- export default Container;
1
+ /**
2
+ *
3
+ * Demos:
4
+ *
5
+ * - [Container (Material UI)](https://mui.com/material-ui/react-container/)
6
+ * - [Container (MUI System)](https://mui.com/system/react-container/)
7
+ *
8
+ * API:
9
+ *
10
+ * - [Container API](https://mui.com/system/api/container/)
11
+ */
12
+ declare const Container: import("@mui/types").OverridableComponent<import("./ContainerProps").ContainerTypeMap<{}, "div">>;
13
+ export default Container;
@@ -1,40 +1,40 @@
1
- import * as React from 'react';
2
- import { OverrideProps } from '@mui/types';
3
- import { SxProps } from '../styleFunctionSx';
4
- import { Theme, Breakpoint } from '../createTheme';
5
- import { ContainerClasses } from './containerClasses';
6
- export interface ContainerTypeMap<P = {}, D extends React.ElementType = 'div'> {
7
- props: P & {
8
- children?: React.ReactNode;
9
- /**
10
- * Override or extend the styles applied to the component.
11
- */
12
- classes?: Partial<ContainerClasses>;
13
- /**
14
- * If `true`, the left and right padding is removed.
15
- * @default false
16
- */
17
- disableGutters?: boolean;
18
- /**
19
- * Set the max-width to match the min-width of the current breakpoint.
20
- * This is useful if you'd prefer to design for a fixed set of sizes
21
- * instead of trying to accommodate a fully fluid viewport.
22
- * It's fluid by default.
23
- * @default false
24
- */
25
- fixed?: boolean;
26
- /**
27
- * Determine the max-width of the container.
28
- * The container width grows with the size of the screen.
29
- * Set to `false` to disable `maxWidth`.
30
- * @default 'lg'
31
- */
32
- maxWidth?: Breakpoint | false;
33
- /**
34
- * The system prop that allows defining system overrides as well as additional CSS styles.
35
- */
36
- sx?: SxProps<Theme>;
37
- };
38
- defaultComponent: D;
39
- }
40
- export declare type ContainerProps<D extends React.ElementType = ContainerTypeMap['defaultComponent'], P = {}> = OverrideProps<ContainerTypeMap<P, D>, D>;
1
+ import * as React from 'react';
2
+ import { OverrideProps } from '@mui/types';
3
+ import { SxProps } from '../styleFunctionSx';
4
+ import { Theme, Breakpoint } from '../createTheme';
5
+ import { ContainerClasses } from './containerClasses';
6
+ export interface ContainerTypeMap<P = {}, D extends React.ElementType = 'div'> {
7
+ props: P & {
8
+ children?: React.ReactNode;
9
+ /**
10
+ * Override or extend the styles applied to the component.
11
+ */
12
+ classes?: Partial<ContainerClasses>;
13
+ /**
14
+ * If `true`, the left and right padding is removed.
15
+ * @default false
16
+ */
17
+ disableGutters?: boolean;
18
+ /**
19
+ * Set the max-width to match the min-width of the current breakpoint.
20
+ * This is useful if you'd prefer to design for a fixed set of sizes
21
+ * instead of trying to accommodate a fully fluid viewport.
22
+ * It's fluid by default.
23
+ * @default false
24
+ */
25
+ fixed?: boolean;
26
+ /**
27
+ * Determine the max-width of the container.
28
+ * The container width grows with the size of the screen.
29
+ * Set to `false` to disable `maxWidth`.
30
+ * @default 'lg'
31
+ */
32
+ maxWidth?: Breakpoint | false;
33
+ /**
34
+ * The system prop that allows defining system overrides as well as additional CSS styles.
35
+ */
36
+ sx?: SxProps<Theme>;
37
+ };
38
+ defaultComponent: D;
39
+ }
40
+ export declare type ContainerProps<D extends React.ElementType = ContainerTypeMap['defaultComponent'], P = {}> = OverrideProps<ContainerTypeMap<P, D>, D>;
@@ -1,22 +1,22 @@
1
- export interface ContainerClasses {
2
- /** Styles applied to the root element. */
3
- root: string;
4
- /** Styles applied to the root element if `disableGutters={true}`. */
5
- disableGutters: string;
6
- /** Styles applied to the root element if `fixed={true}`. */
7
- fixed: string;
8
- /** Styles applied to the root element if `maxWidth="xs"`. */
9
- maxWidthXs: string;
10
- /** Styles applied to the root element if `maxWidth="sm"`. */
11
- maxWidthSm: string;
12
- /** Styles applied to the root element if `maxWidth="md"`. */
13
- maxWidthMd: string;
14
- /** Styles applied to the root element if `maxWidth="lg"`. */
15
- maxWidthLg: string;
16
- /** Styles applied to the root element if `maxWidth="xl"`. */
17
- maxWidthXl: string;
18
- }
19
- export declare type ContainerClassKey = keyof ContainerClasses;
20
- export declare function getContainerUtilityClass(slot: string): string;
21
- declare const containerClasses: ContainerClasses;
22
- export default containerClasses;
1
+ export interface ContainerClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ /** Styles applied to the root element if `disableGutters={true}`. */
5
+ disableGutters: string;
6
+ /** Styles applied to the root element if `fixed={true}`. */
7
+ fixed: string;
8
+ /** Styles applied to the root element if `maxWidth="xs"`. */
9
+ maxWidthXs: string;
10
+ /** Styles applied to the root element if `maxWidth="sm"`. */
11
+ maxWidthSm: string;
12
+ /** Styles applied to the root element if `maxWidth="md"`. */
13
+ maxWidthMd: string;
14
+ /** Styles applied to the root element if `maxWidth="lg"`. */
15
+ maxWidthLg: string;
16
+ /** Styles applied to the root element if `maxWidth="xl"`. */
17
+ maxWidthXl: string;
18
+ }
19
+ export declare type ContainerClassKey = keyof ContainerClasses;
20
+ export declare function getContainerUtilityClass(slot: string): string;
21
+ declare const containerClasses: ContainerClasses;
22
+ export default containerClasses;
@@ -1,18 +1,18 @@
1
- import * as React from 'react';
2
- import { Interpolation, StyledComponent } from '@mui/styled-engine';
3
- import { OverridableComponent } from '@mui/types';
4
- import { ContainerProps, ContainerTypeMap } from './ContainerProps';
5
- import { Theme as DefaultTheme } from '../createTheme';
6
- interface StyleFnProps<Theme> extends ContainerProps {
7
- theme: Theme;
8
- ownerState: ContainerProps;
9
- }
10
- declare type RequiredThemeStructure = Pick<DefaultTheme, 'breakpoints' | 'spacing'>;
11
- export default function createContainer<Theme extends RequiredThemeStructure = DefaultTheme>(options?: {
12
- createStyledComponent?: (...styles: Array<Interpolation<StyleFnProps<Theme>>>) => StyledComponent<ContainerProps>;
13
- useThemeProps?: (inProps: ContainerProps) => ContainerProps & {
14
- component?: React.ElementType;
15
- };
16
- componentName?: string;
17
- }): OverridableComponent<ContainerTypeMap<{}, "div">>;
18
- export {};
1
+ import * as React from 'react';
2
+ import { Interpolation, StyledComponent } from '@mui/styled-engine';
3
+ import { OverridableComponent } from '@mui/types';
4
+ import { ContainerProps, ContainerTypeMap } from './ContainerProps';
5
+ import { Theme as DefaultTheme } from '../createTheme';
6
+ interface StyleFnProps<Theme> extends ContainerProps {
7
+ theme: Theme;
8
+ ownerState: ContainerProps;
9
+ }
10
+ declare type RequiredThemeStructure = Pick<DefaultTheme, 'breakpoints' | 'spacing'>;
11
+ export default function createContainer<Theme extends RequiredThemeStructure = DefaultTheme>(options?: {
12
+ createStyledComponent?: (...styles: Array<Interpolation<StyleFnProps<Theme>>>) => StyledComponent<ContainerProps>;
13
+ useThemeProps?: (inProps: ContainerProps) => ContainerProps & {
14
+ component?: React.ElementType;
15
+ };
16
+ componentName?: string;
17
+ }): OverridableComponent<ContainerTypeMap<{}, "div">>;
18
+ export {};
package/README.md CHANGED
@@ -20,4 +20,4 @@ yarn add @mui/system @emotion/react @emotion/styled
20
20
 
21
21
  <!-- #default-branch-switch -->
22
22
 
23
- [The documentation](https://mui.com/system/basics/)
23
+ [The documentation](https://mui.com/system/getting-started/overview/)
@@ -0,0 +1,12 @@
1
+ /**
2
+ *
3
+ * Demos:
4
+ *
5
+ * - [Stack (Material UI)](https://mui.com/material-ui/react-stack/)
6
+ *
7
+ * API:
8
+ *
9
+ * - [Stack API](https://mui.com/system/api/stack/)
10
+ */
11
+ declare const Stack: import("@mui/types").OverridableComponent<import("./StackProps").StackTypeMap<{}, "div">>;
12
+ export default Stack;
package/Stack/Stack.js ADDED
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _createStack = _interopRequireDefault(require("./createStack"));
13
+
14
+ /**
15
+ *
16
+ * Demos:
17
+ *
18
+ * - [Stack (Material UI)](https://mui.com/material-ui/react-stack/)
19
+ *
20
+ * API:
21
+ *
22
+ * - [Stack API](https://mui.com/system/api/stack/)
23
+ */
24
+ const Stack = (0, _createStack.default)();
25
+ process.env.NODE_ENV !== "production" ? Stack.propTypes
26
+ /* remove-proptypes */
27
+ = {
28
+ // ----------------------------- Warning --------------------------------
29
+ // | These PropTypes are generated from the TypeScript type definitions |
30
+ // | To update them edit TypeScript types and run "yarn proptypes" |
31
+ // ----------------------------------------------------------------------
32
+
33
+ /**
34
+ * The content of the component.
35
+ */
36
+ children: _propTypes.default.node,
37
+
38
+ /**
39
+ * Defines the `flex-direction` style property.
40
+ * It is applied for all screen sizes.
41
+ * @default 'column'
42
+ */
43
+ direction: _propTypes.default.oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
44
+
45
+ /**
46
+ * Add an element between each child.
47
+ */
48
+ divider: _propTypes.default.node,
49
+
50
+ /**
51
+ * Defines the space between immediate children.
52
+ * @default 0
53
+ */
54
+ spacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
55
+
56
+ /**
57
+ * The system prop, which allows defining system overrides as well as additional CSS styles.
58
+ */
59
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
60
+ } : void 0;
61
+ var _default = Stack;
62
+ exports.default = _default;
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ import { OverrideProps } from '@mui/types';
3
+ import { ResponsiveStyleValue, SxProps } from '../styleFunctionSx';
4
+ import { SystemProps } from '../Box';
5
+ import { Theme } from '../createTheme';
6
+ export interface StackBaseProps {
7
+ /**
8
+ * The content of the component.
9
+ */
10
+ children?: React.ReactNode;
11
+ /**
12
+ * Defines the `flex-direction` style property.
13
+ * It is applied for all screen sizes.
14
+ * @default 'column'
15
+ */
16
+ direction?: ResponsiveStyleValue<'row' | 'row-reverse' | 'column' | 'column-reverse'>;
17
+ /**
18
+ * Defines the space between immediate children.
19
+ * @default 0
20
+ */
21
+ spacing?: ResponsiveStyleValue<number | string>;
22
+ /**
23
+ * Add an element between each child.
24
+ */
25
+ divider?: React.ReactNode;
26
+ }
27
+ export interface StackTypeMap<P = {}, D extends React.ElementType = 'div'> {
28
+ props: P & StackBaseProps & {
29
+ /**
30
+ * The system prop, which allows defining system overrides as well as additional CSS styles.
31
+ */
32
+ sx?: SxProps<Theme>;
33
+ } & SystemProps<Theme>;
34
+ defaultComponent: D;
35
+ }
36
+ export declare type StackProps<D extends React.ElementType = StackTypeMap['defaultComponent'], P = {
37
+ component?: React.ElementType;
38
+ }> = OverrideProps<StackTypeMap<P, D>, D>;
39
+ export interface StackOwnerState {
40
+ direction: StackProps['direction'];
41
+ spacing: StackProps['spacing'];
42
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { OverridableComponent } from '@mui/types';
3
+ import { StackTypeMap, StackOwnerState } from './StackProps';
4
+ import { Breakpoints } from '../createTheme/createBreakpoints';
5
+ import { Spacing } from '../createTheme/createSpacing';
6
+ interface StyleFunctionProps {
7
+ theme: {
8
+ breakpoints: Breakpoints;
9
+ spacing: Spacing;
10
+ };
11
+ ownerState: StackOwnerState;
12
+ }
13
+ declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
14
+ declare function useThemePropsDefault<T>(props: T): T & {};
15
+ export declare const style: ({ ownerState, theme }: StyleFunctionProps) => any;
16
+ export default function createStack(options?: {
17
+ createStyledComponent?: typeof defaultCreateStyledComponent;
18
+ useThemeProps?: typeof useThemePropsDefault;
19
+ componentName?: string;
20
+ }): OverridableComponent<StackTypeMap<{}, "div">>;
21
+ export {};
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = createStack;
9
+ exports.style = void 0;
10
+
11
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
+
13
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
+
15
+ var React = _interopRequireWildcard(require("react"));
16
+
17
+ var _propTypes = _interopRequireDefault(require("prop-types"));
18
+
19
+ var _clsx = _interopRequireDefault(require("clsx"));
20
+
21
+ var _utils = require("@mui/utils");
22
+
23
+ var _styled = _interopRequireDefault(require("../styled"));
24
+
25
+ var _useThemeProps = _interopRequireDefault(require("../useThemeProps"));
26
+
27
+ var _styleFunctionSx = require("../styleFunctionSx");
28
+
29
+ var _createTheme = _interopRequireDefault(require("../createTheme"));
30
+
31
+ var _breakpoints = require("../breakpoints");
32
+
33
+ var _spacing = require("../spacing");
34
+
35
+ var _jsxRuntime = require("react/jsx-runtime");
36
+
37
+ const _excluded = ["component", "direction", "spacing", "divider", "children", "className"];
38
+
39
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
40
+
41
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
42
+
43
+ const defaultTheme = (0, _createTheme.default)();
44
+ // widening Theme to any so that the consumer can own the theme structure.
45
+ const defaultCreateStyledComponent = (0, _styled.default)('div', {
46
+ name: 'MuiStack',
47
+ slot: 'Root',
48
+ overridesResolver: (props, styles) => styles.root
49
+ });
50
+
51
+ function useThemePropsDefault(props) {
52
+ return (0, _useThemeProps.default)({
53
+ props,
54
+ name: 'MuiStack',
55
+ defaultTheme
56
+ });
57
+ }
58
+ /**
59
+ * Return an array with the separator React element interspersed between
60
+ * each React node of the input children.
61
+ *
62
+ * > joinChildren([1,2,3], 0)
63
+ * [1,0,2,0,3]
64
+ */
65
+
66
+
67
+ function joinChildren(children, separator) {
68
+ const childrenArray = React.Children.toArray(children).filter(Boolean);
69
+ return childrenArray.reduce((output, child, index) => {
70
+ output.push(child);
71
+
72
+ if (index < childrenArray.length - 1) {
73
+ output.push( /*#__PURE__*/React.cloneElement(separator, {
74
+ key: `separator-${index}`
75
+ }));
76
+ }
77
+
78
+ return output;
79
+ }, []);
80
+ }
81
+
82
+ const getSideFromDirection = direction => {
83
+ return {
84
+ row: 'Left',
85
+ 'row-reverse': 'Right',
86
+ column: 'Top',
87
+ 'column-reverse': 'Bottom'
88
+ }[direction];
89
+ };
90
+
91
+ const style = ({
92
+ ownerState,
93
+ theme
94
+ }) => {
95
+ let styles = (0, _extends2.default)({
96
+ display: 'flex',
97
+ flexDirection: 'column'
98
+ }, (0, _breakpoints.handleBreakpoints)({
99
+ theme
100
+ }, (0, _breakpoints.resolveBreakpointValues)({
101
+ values: ownerState.direction,
102
+ breakpoints: theme.breakpoints.values
103
+ }), propValue => ({
104
+ flexDirection: propValue
105
+ })));
106
+
107
+ if (ownerState.spacing) {
108
+ const transformer = (0, _spacing.createUnarySpacing)(theme);
109
+ const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
110
+ if (typeof ownerState.spacing === 'object' && ownerState.spacing[breakpoint] != null || typeof ownerState.direction === 'object' && ownerState.direction[breakpoint] != null) {
111
+ acc[breakpoint] = true;
112
+ }
113
+
114
+ return acc;
115
+ }, {});
116
+ const directionValues = (0, _breakpoints.resolveBreakpointValues)({
117
+ values: ownerState.direction,
118
+ base
119
+ });
120
+ const spacingValues = (0, _breakpoints.resolveBreakpointValues)({
121
+ values: ownerState.spacing,
122
+ base
123
+ });
124
+
125
+ if (typeof directionValues === 'object') {
126
+ Object.keys(directionValues).forEach((breakpoint, index, breakpoints) => {
127
+ const directionValue = directionValues[breakpoint];
128
+
129
+ if (!directionValue) {
130
+ const previousDirectionValue = index > 0 ? directionValues[breakpoints[index - 1]] : 'column';
131
+ directionValues[breakpoint] = previousDirectionValue;
132
+ }
133
+ });
134
+ }
135
+
136
+ const styleFromPropValue = (propValue, breakpoint) => {
137
+ return {
138
+ '& > :not(style) + :not(style)': {
139
+ margin: 0,
140
+ [`margin${getSideFromDirection(breakpoint ? directionValues[breakpoint] : ownerState.direction)}`]: (0, _spacing.getValue)(transformer, propValue)
141
+ }
142
+ };
143
+ };
144
+
145
+ styles = (0, _utils.deepmerge)(styles, (0, _breakpoints.handleBreakpoints)({
146
+ theme
147
+ }, spacingValues, styleFromPropValue));
148
+ }
149
+
150
+ styles = (0, _breakpoints.mergeBreakpointsInOrder)(theme.breakpoints, styles);
151
+ return styles;
152
+ };
153
+
154
+ exports.style = style;
155
+
156
+ function createStack(options = {}) {
157
+ const {
158
+ // This will allow adding custom styled fn (for example for custom sx style function)
159
+ createStyledComponent = defaultCreateStyledComponent,
160
+ useThemeProps = useThemePropsDefault,
161
+ componentName = 'MuiStack'
162
+ } = options;
163
+
164
+ const useUtilityClasses = () => {
165
+ const slots = {
166
+ root: ['root']
167
+ };
168
+ return (0, _utils.unstable_composeClasses)(slots, slot => (0, _utils.unstable_generateUtilityClass)(componentName, slot), {});
169
+ };
170
+
171
+ const StackRoot = createStyledComponent(style);
172
+ const Stack = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
173
+ const themeProps = useThemeProps(inProps);
174
+ const props = (0, _styleFunctionSx.extendSxProp)(themeProps); // `color` type conflicts with html color attribute.
175
+
176
+ const {
177
+ component = 'div',
178
+ direction = 'column',
179
+ spacing = 0,
180
+ divider,
181
+ children,
182
+ className
183
+ } = props,
184
+ other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
185
+ const ownerState = {
186
+ direction,
187
+ spacing
188
+ };
189
+ const classes = useUtilityClasses();
190
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StackRoot, (0, _extends2.default)({
191
+ as: component,
192
+ ownerState: ownerState,
193
+ ref: ref,
194
+ className: (0, _clsx.default)(classes.root, className)
195
+ }, other, {
196
+ children: divider ? joinChildren(children, divider) : children
197
+ }));
198
+ });
199
+ process.env.NODE_ENV !== "production" ? Stack.propTypes
200
+ /* remove-proptypes */
201
+ = {
202
+ children: _propTypes.default.node,
203
+ direction: _propTypes.default.oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
204
+ divider: _propTypes.default.node,
205
+ spacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
206
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
207
+ } : void 0;
208
+ return Stack;
209
+ }