@stratakit/mui 0.1.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.
- package/CHANGELOG.md +5 -0
- package/LICENSE.md +9 -0
- package/README.md +85 -0
- package/dist/DEV/Icon.js +49 -0
- package/dist/DEV/Root.js +71 -0
- package/dist/DEV/createTheme.js +147 -0
- package/dist/DEV/index.js +9 -0
- package/dist/DEV/styles.css.js +8 -0
- package/dist/Icon.d.ts +15 -0
- package/dist/Icon.js +51 -0
- package/dist/Root.d.ts +20 -0
- package/dist/Root.js +115 -0
- package/dist/createTheme.d.ts +16 -0
- package/dist/createTheme.js +134 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -0
- package/dist/styles.css.d.ts +2 -0
- package/dist/styles.css.js +8 -0
- package/package.json +120 -0
package/CHANGELOG.md
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @stratakit/mui
|
|
2
|
+
|
|
3
|
+
StrataKit theme for [MUI](https://mui.com/material-ui/).
|
|
4
|
+
|
|
5
|
+
## Installation and setup
|
|
6
|
+
|
|
7
|
+
Using your package manager of choice, install the latest version of [`@stratakit/mui`](https://www.npmjs.com/package/@stratakit/mui?activeTab=versions).
|
|
8
|
+
|
|
9
|
+
```console
|
|
10
|
+
npm add @stratakit/mui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Additional setup/considerations:
|
|
14
|
+
|
|
15
|
+
- `@stratakit/mui` has a direct dependency on [`@stratakit/foundations`](https://www.npmjs.com/package/@stratakit/foundations) and [`@stratakit/icons`](https://www.npmjs.com/package/@stratakit/icons), the latter of which requires [bundler configuration](https://github.com/iTwin/design-system/tree/main/packages/icons#bundler-configuration) to ensure that `.svg` files are not inlined.
|
|
16
|
+
- You should ensure that [StrataKit fonts](#fonts) are loaded in your application.
|
|
17
|
+
- If you are trying to use this package alongside iTwinUI, you will also need to set up the [theme bridge](https://github.com/iTwin/iTwinUI/wiki/StrataKit-theme-bridge).
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
To use the StrataKit MUI theme, you’ll need to wrap your application's entrypoint with the `<Root>` component and set its `colorScheme` (to `"light"` or `"dark"`). This component will automatically configure MUI's `ThemeProvider` with the StrataKit theme.
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
import { Root } from "@stratakit/mui";
|
|
25
|
+
|
|
26
|
+
export function App() {
|
|
27
|
+
return <Root colorScheme={…}>{/* Use @mui/material components here */}</Root>;
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Now you can use any components directly from `@mui/material`, and they will be automatically themed to use StrataKit's visual language.
|
|
32
|
+
|
|
33
|
+
> [!CAUTION]
|
|
34
|
+
> Do not use MUI's `ThemeProvider`, `StyledEngineProvider`, or `CssBaseline` components directly. The `Root` component will handle all global configuration for you.
|
|
35
|
+
|
|
36
|
+
### Icon component
|
|
37
|
+
|
|
38
|
+
`@stratakit/mui` also exports an `Icon` component that makes it easy to use `.svg` icons from [`@stratakit/icons`](https://www.npmjs.com/package/@stratakit/icons).
|
|
39
|
+
|
|
40
|
+
```jsx
|
|
41
|
+
import { Icon } from "@stratakit/mui";
|
|
42
|
+
import svgPlaceholder from "@stratakit/icons/placeholder.svg";
|
|
43
|
+
|
|
44
|
+
<Icon href={svgPlaceholder} />;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
> [!NOTE]
|
|
48
|
+
> `@stratakit/icons` requires [bundler configuration](https://github.com/iTwin/design-system/tree/main/packages/icons#bundler-configuration) to ensure that `.svg` files are not inlined.
|
|
49
|
+
|
|
50
|
+
## Fonts
|
|
51
|
+
|
|
52
|
+
StrataKit uses [InterVariable](https://rsms.me/inter/) as its interface font. In the future, other fonts may also be added for different purposes. We recommend self-hosting all fonts for robustness, security and performance reasons.
|
|
53
|
+
|
|
54
|
+
To self-host `InterVariable`, download the [`InterVariable.woff2`](https://rsms.me/inter/font-files/InterVariable.woff2) and [`InterVariable-Italic.woff2`](https://rsms.me/inter/font-files/InterVariable-Italic.woff2) font files from the official website, and serve them alongside your other assets. Then include the following CSS in the `<head>` of your document, replacing the placeholder paths with the correct path to where the fonts are located:
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<style>
|
|
58
|
+
@font-face {
|
|
59
|
+
font-family: InterVariable;
|
|
60
|
+
font-style: normal;
|
|
61
|
+
font-weight: 100 900;
|
|
62
|
+
font-display: swap;
|
|
63
|
+
src: url("/path/to/InterVariable.woff2") format("woff2");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@font-face {
|
|
67
|
+
font-family: InterVariable;
|
|
68
|
+
font-style: italic;
|
|
69
|
+
font-weight: 100 900;
|
|
70
|
+
font-display: swap;
|
|
71
|
+
src: url("/path/to/InterVariable-Italic.woff2") format("woff2");
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Build tools such as [Vite](https://vite.dev/guide/assets.html#importing-asset-as-url) can handle `url()` references and automatically copy these files into your output directory with hashed file names. These files can then be safely served with [HTTP caching](https://developer.chrome.com/docs/lighthouse/performance/uses-long-cache-ttl/#how_to_cache_static_resources_using_http_caching) without blocking upgrades to newer versions of the fonts.
|
|
77
|
+
|
|
78
|
+
> [!NOTE]
|
|
79
|
+
> If the `<Root>` component cannot find `InterVariable` as a font in the document, it will automatically add a fallback which uses [Inter’s CDN](https://rsms.me/inter/#faq-cdn). In all cases, we recommend self-hosting to avoid any potential security and reliability issues that may arise from the use of a third-party CDN.
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
Are you interested in helping StrataKit grow? You can submit feature requests or bugs by creating [issues](https://github.com/iTwin/design-system/issues).
|
|
84
|
+
|
|
85
|
+
If you're interested in contributing code, please read [`CONTRIBUTING.md`](https://github.com/iTwin/design-system/blob/main/CONTRIBUTING.md) for more information.
|
package/dist/DEV/Icon.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Icon } from "@stratakit/foundations";
|
|
4
|
+
import svgArrowDown from "@stratakit/icons/arrow-down.svg";
|
|
5
|
+
import svgCaretsUpDown from "@stratakit/icons/carets-up-down.svg";
|
|
6
|
+
import svgChevronDown from "@stratakit/icons/chevron-down.svg";
|
|
7
|
+
import svgChevronLeft from "@stratakit/icons/chevron-left.svg";
|
|
8
|
+
import svgChevronLeftDouble from "@stratakit/icons/chevron-left-double.svg";
|
|
9
|
+
import svgChevronRight from "@stratakit/icons/chevron-right.svg";
|
|
10
|
+
import svgChevronRightDouble from "@stratakit/icons/chevron-right-double.svg";
|
|
11
|
+
import svgDismiss from "@stratakit/icons/dismiss.svg";
|
|
12
|
+
import svgError from "@stratakit/icons/error.svg";
|
|
13
|
+
import svgInfo from "@stratakit/icons/info.svg";
|
|
14
|
+
import svgStatusSuccess from "@stratakit/icons/status-success.svg";
|
|
15
|
+
import svgWarning from "@stratakit/icons/warning.svg";
|
|
16
|
+
function createIconComponent(href) {
|
|
17
|
+
return React.forwardRef(
|
|
18
|
+
function IconComponent(props, forwardedRef) {
|
|
19
|
+
return /* @__PURE__ */ jsx(Icon, { ...props, href, ref: forwardedRef });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
const ArrowDownIcon = createIconComponent(svgArrowDown);
|
|
24
|
+
const CaretsUpDownIcon = createIconComponent(svgCaretsUpDown);
|
|
25
|
+
const ChevronDownIcon = createIconComponent(svgChevronDown);
|
|
26
|
+
const ChevronLeftIcon = createIconComponent(svgChevronLeft);
|
|
27
|
+
const ChevronLeftDoubleIcon = createIconComponent(svgChevronLeftDouble);
|
|
28
|
+
const ChevronRightIcon = createIconComponent(svgChevronRight);
|
|
29
|
+
const ChevronRightDoubleIcon = createIconComponent(svgChevronRightDouble);
|
|
30
|
+
const DismissIcon = createIconComponent(svgDismiss);
|
|
31
|
+
const ErrorIcon = createIconComponent(svgError);
|
|
32
|
+
const InfoIcon = createIconComponent(svgInfo);
|
|
33
|
+
const SuccessIcon = createIconComponent(svgStatusSuccess);
|
|
34
|
+
const WarningIcon = createIconComponent(svgWarning);
|
|
35
|
+
export {
|
|
36
|
+
ArrowDownIcon,
|
|
37
|
+
CaretsUpDownIcon,
|
|
38
|
+
ChevronDownIcon,
|
|
39
|
+
ChevronLeftDoubleIcon,
|
|
40
|
+
ChevronLeftIcon,
|
|
41
|
+
ChevronRightDoubleIcon,
|
|
42
|
+
ChevronRightIcon,
|
|
43
|
+
DismissIcon,
|
|
44
|
+
ErrorIcon,
|
|
45
|
+
Icon,
|
|
46
|
+
InfoIcon,
|
|
47
|
+
SuccessIcon,
|
|
48
|
+
WarningIcon
|
|
49
|
+
};
|
package/dist/DEV/Root.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
StyledEngineProvider,
|
|
5
|
+
ThemeProvider,
|
|
6
|
+
useColorScheme
|
|
7
|
+
} from "@mui/material/styles";
|
|
8
|
+
import { Root as StrataKitRoot } from "@stratakit/foundations";
|
|
9
|
+
import {
|
|
10
|
+
RootContext,
|
|
11
|
+
useSafeContext
|
|
12
|
+
} from "@stratakit/foundations/secret-internals";
|
|
13
|
+
import cx from "classnames";
|
|
14
|
+
import { createTheme } from "./createTheme.js";
|
|
15
|
+
import css from "./styles.css.js";
|
|
16
|
+
const theme = createTheme();
|
|
17
|
+
const packageName = "@stratakit/mui";
|
|
18
|
+
const key = `${packageName}@${"0.1.0"}`;
|
|
19
|
+
const Root = React.forwardRef(
|
|
20
|
+
(props, forwardedRef) => {
|
|
21
|
+
const { children, colorScheme, ...rest } = props;
|
|
22
|
+
return /* @__PURE__ */ jsx(StyledEngineProvider, { enableCssLayer: true, children: /* @__PURE__ */ jsxs(ThemeProvider, { theme, defaultMode: colorScheme, children: [
|
|
23
|
+
/* @__PURE__ */ jsx(ColorScheme, { colorScheme }),
|
|
24
|
+
/* @__PURE__ */ jsxs(RootInner, { ...rest, colorScheme, ref: forwardedRef, children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Styles, {}),
|
|
26
|
+
children
|
|
27
|
+
] })
|
|
28
|
+
] }) });
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
DEV: Root.displayName = "Root";
|
|
32
|
+
const RootInner = React.forwardRef(
|
|
33
|
+
(props, forwardedRef) => {
|
|
34
|
+
const { children, colorScheme, ...rest } = props;
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
StrataKitRoot,
|
|
37
|
+
{
|
|
38
|
+
...rest,
|
|
39
|
+
className: cx("\u{1F95D}MuiRoot", props.className),
|
|
40
|
+
colorScheme,
|
|
41
|
+
synchronizeColorScheme: true,
|
|
42
|
+
ref: forwardedRef,
|
|
43
|
+
children
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
DEV: RootInner.displayName = "RootInner";
|
|
49
|
+
function ColorScheme({ colorScheme }) {
|
|
50
|
+
const { setColorScheme } = useColorScheme();
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
setColorScheme(colorScheme);
|
|
53
|
+
}, [colorScheme, setColorScheme]);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
DEV: ColorScheme.displayName = "ColorScheme";
|
|
57
|
+
function Styles() {
|
|
58
|
+
const rootContext = useSafeContext(RootContext);
|
|
59
|
+
if (!rootContext.versions?.has(packageName))
|
|
60
|
+
rootContext.versions?.set(packageName, "0.1.0");
|
|
61
|
+
const { rootNode, loadStyles } = rootContext;
|
|
62
|
+
React.useInsertionEffect(() => {
|
|
63
|
+
if (!rootNode || !loadStyles) return;
|
|
64
|
+
const { cleanup } = loadStyles(rootNode, { css, key });
|
|
65
|
+
return cleanup;
|
|
66
|
+
}, [rootNode, loadStyles]);
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
Root
|
|
71
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createTheme as createMuiTheme } from "@mui/material/styles";
|
|
3
|
+
import {
|
|
4
|
+
ArrowDownIcon,
|
|
5
|
+
CaretsUpDownIcon,
|
|
6
|
+
ChevronDownIcon,
|
|
7
|
+
ChevronLeftDoubleIcon,
|
|
8
|
+
ChevronLeftIcon,
|
|
9
|
+
ChevronRightDoubleIcon,
|
|
10
|
+
ChevronRightIcon,
|
|
11
|
+
DismissIcon,
|
|
12
|
+
ErrorIcon,
|
|
13
|
+
InfoIcon,
|
|
14
|
+
SuccessIcon,
|
|
15
|
+
WarningIcon
|
|
16
|
+
} from "./Icon.js";
|
|
17
|
+
function createTheme() {
|
|
18
|
+
return createMuiTheme({
|
|
19
|
+
cssVariables: {
|
|
20
|
+
nativeColor: true,
|
|
21
|
+
colorSchemeSelector: "[data-color-scheme='%s']",
|
|
22
|
+
cssVarPrefix: "stratakit-mui"
|
|
23
|
+
},
|
|
24
|
+
colorSchemes: {
|
|
25
|
+
light: true,
|
|
26
|
+
dark: true
|
|
27
|
+
},
|
|
28
|
+
typography: {
|
|
29
|
+
fontFamily: "var(--stratakit-font-family-sans)",
|
|
30
|
+
fontSize: 14,
|
|
31
|
+
button: {
|
|
32
|
+
textTransform: "none"
|
|
33
|
+
// Disable all-caps on buttons and tabs
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
shadows: [
|
|
37
|
+
"none",
|
|
38
|
+
// 0
|
|
39
|
+
"none",
|
|
40
|
+
// 1
|
|
41
|
+
"var(--stratakit-shadow-surface-xs)",
|
|
42
|
+
// 2
|
|
43
|
+
"var(--stratakit-shadow-surface-sm)",
|
|
44
|
+
// 3
|
|
45
|
+
...new Array(4).fill("var(--stratakit-shadow-surface-md)"),
|
|
46
|
+
// 4-7
|
|
47
|
+
...new Array(17).fill("var(--stratakit-shadow-surface-lg)")
|
|
48
|
+
// 8-24
|
|
49
|
+
// biome-ignore lint/suspicious/noExplicitAny: MUI expects 25 items in the shadows array
|
|
50
|
+
],
|
|
51
|
+
components: {
|
|
52
|
+
MuiAccordionSummary: {
|
|
53
|
+
defaultProps: {
|
|
54
|
+
expandIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
MuiAlert: {
|
|
58
|
+
defaultProps: {
|
|
59
|
+
iconMapping: {
|
|
60
|
+
error: /* @__PURE__ */ jsx(ErrorIcon, {}),
|
|
61
|
+
info: /* @__PURE__ */ jsx(InfoIcon, {}),
|
|
62
|
+
success: /* @__PURE__ */ jsx(SuccessIcon, {}),
|
|
63
|
+
warning: /* @__PURE__ */ jsx(WarningIcon, {})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
MuiAutocomplete: {
|
|
68
|
+
defaultProps: {
|
|
69
|
+
popupIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {}),
|
|
70
|
+
clearIcon: /* @__PURE__ */ jsx(DismissIcon, {}),
|
|
71
|
+
slotProps: {
|
|
72
|
+
paper: {
|
|
73
|
+
elevation: 8
|
|
74
|
+
// match Menu elevation
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
MuiBreadcrumbs: {
|
|
80
|
+
defaultProps: {
|
|
81
|
+
separator: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
MuiButtonBase: {
|
|
85
|
+
defaultProps: {
|
|
86
|
+
disableRipple: true
|
|
87
|
+
// https://mui.com/material-ui/getting-started/faq/#how-can-i-disable-the-ripple-effect-globally
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
MuiButton: {
|
|
91
|
+
defaultProps: {
|
|
92
|
+
color: "secondary"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
MuiChip: {
|
|
96
|
+
defaultProps: {
|
|
97
|
+
deleteIcon: /* @__PURE__ */ jsx(DismissIcon, {})
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
MuiCheckbox: {
|
|
101
|
+
defaultProps: {
|
|
102
|
+
disableRipple: true
|
|
103
|
+
// Checkbox doesn't inherit from ButtonBase
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
MuiLink: {
|
|
107
|
+
defaultProps: {
|
|
108
|
+
color: "textPrimary"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
MuiPaginationItem: {
|
|
112
|
+
defaultProps: {
|
|
113
|
+
slots: {
|
|
114
|
+
previous: ChevronLeftIcon,
|
|
115
|
+
next: ChevronRightIcon,
|
|
116
|
+
first: ChevronLeftDoubleIcon,
|
|
117
|
+
last: ChevronRightDoubleIcon
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
MuiSelect: {
|
|
122
|
+
defaultProps: {
|
|
123
|
+
IconComponent: CaretsUpDownIcon
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
MuiTablePaginationActions: {
|
|
127
|
+
defaultProps: {
|
|
128
|
+
slots: {
|
|
129
|
+
previousButtonIcon: ChevronLeftIcon,
|
|
130
|
+
nextButtonIcon: ChevronRightIcon,
|
|
131
|
+
firstButtonIcon: ChevronLeftDoubleIcon,
|
|
132
|
+
lastButtonIcon: ChevronRightDoubleIcon
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
MuiTableSortLabel: {
|
|
137
|
+
defaultProps: {
|
|
138
|
+
// TODO: This should use sort-ascending and sort-descending icons, but that requires disabling MUI's built-in icon rotation.
|
|
139
|
+
IconComponent: ArrowDownIcon
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
export {
|
|
146
|
+
createTheme
|
|
147
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// inline-css:/home/runner/work/design-system/design-system/packages/mui/src/styles.css
|
|
2
|
+
var styles_default = String.raw`@layer stratakit{[data-color-scheme],.🥝MuiRoot{--stratakit-mui-palette-background-default:var(--stratakit-color-bg-page-depth);--stratakit-mui-palette-background-paper:var(--stratakit-color-bg-page-depth);--stratakit-mui-palette-divider:var(--stratakit-color-border-page-base);--stratakit-mui-palette-text-primary:var(--stratakit-color-text-neutral-primary);--stratakit-mui-palette-text-secondary:var(--stratakit-color-text-neutral-secondary);--stratakit-mui-palette-text-disabled:var(--stratakit-color-text-neutral-disabled);--stratakit-mui-palette-primary-main:var(--stratakit-color-bg-accent-base);--stratakit-mui-palette-primary-dark:var(--stratakit-color-bg-accent-faded);--stratakit-mui-palette-primary-light:var(--stratakit-color-bg-accent-muted);--stratakit-mui-palette-primary-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-secondary-main:var(--stratakit-color-bg-mono-base);--stratakit-mui-palette-secondary-dark:var(--stratakit-color-bg-mono-faded);--stratakit-mui-palette-secondary-light:var(--stratakit-color-bg-mono-muted);--stratakit-mui-palette-secondary-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-action-active:var(--stratakit-color-icon-neutral-primary);--stratakit-mui-palette-action-disabled:var(--stratakit-color-icon-neutral-disabled);--stratakit-mui-palette-action-disabledBackground:var(--stratakit-color-bg-glow-on-surface-disabled);--stratakit-mui-palette-error-main:var(--stratakit-color-bg-critical-base);--stratakit-mui-palette-error-dark:var(--stratakit-color-bg-critical-faded);--stratakit-mui-palette-error-light:var(--stratakit-color-bg-critical-muted);--stratakit-mui-palette-error-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-warning-main:var(--stratakit-color-bg-severe-base);--stratakit-mui-palette-warning-dark:var(--stratakit-color-bg-severe-faded);--stratakit-mui-palette-warning-light:var(--stratakit-color-bg-severe-muted);--stratakit-mui-palette-warning-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-success-main:var(--stratakit-color-bg-positive-base);--stratakit-mui-palette-success-dark:var(--stratakit-color-bg-positive-faded);--stratakit-mui-palette-success-light:var(--stratakit-color-bg-positive-muted);--stratakit-mui-palette-success-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-info-main:var(--stratakit-color-bg-info-base);--stratakit-mui-palette-info-dark:var(--stratakit-color-bg-info-faded);--stratakit-mui-palette-info-light:var(--stratakit-color-bg-info-muted);--stratakit-mui-palette-info-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-grey-50:oklch(85.95% .006 255.48);--stratakit-mui-palette-grey-100:oklch(79.56% .008 241.69);--stratakit-mui-palette-grey-200:oklch(75.82% .01 252.83);--stratakit-mui-palette-grey-300:oklch(69.04% .014 255.53);--stratakit-mui-palette-grey-400:oklch(62.09% .017 257.22);--stratakit-mui-palette-grey-500:oklch(55.22% .018 253.99);--stratakit-mui-palette-grey-600:oklch(48.26% .017 254.7);--stratakit-mui-palette-grey-700:oklch(41.45% .013 256.75);--stratakit-mui-palette-grey-800:oklch(34.4% .011 264.42);--stratakit-mui-palette-grey-900:oklch(26.92% .008 268.32);--stratakit-mui-palette-grey-A100:oklch(79.56% .008 241.69);--stratakit-mui-palette-grey-A200:oklch(75.82% .01 252.83);--stratakit-mui-palette-grey-A400:oklch(62.09% .017 257.22);--stratakit-mui-palette-grey-A700:oklch(48.26% .017 254.7)}.MuiAlert-icon{align-items:center}.MuiButton-root:where(.MuiButton-colorSecondary){--variant-containedBg:var(--stratakit-color-bg-neutral-base);--variant-containedColor:var(--stratakit-color-text-neutral-primary);--variant-outlinedColor:var(--stratakit-color-text-neutral-primary);--variant-textColor:var(--stratakit-color-text-neutral-primary)}.MuiButton-root:where(.MuiButton-colorSecondary):where(:hover){--variant-containedBg:color-mix(in oklch,var(--stratakit-color-bg-neutral-base)100%,var(--stratakit-color-glow-hue)var(--stratakit-color-bg-glow-base-hover-\%))}.MuiButton-root:where(.MuiButton-colorPrimary){--variant-outlinedColor:var(--stratakit-color-text-accent-strong);--variant-textColor:var(--stratakit-color-text-accent-strong)}.MuiCheckbox-root:where(.MuiCheckbox-colorPrimary):where(.Mui-checked,.MuiCheckbox-indeterminate):where(:not(.Mui-disabled)){color:var(--stratakit-mui-palette-primary-dark)}.MuiCheckbox-root:where(.Mui-focusVisible){outline:2px solid var(--stratakit-color-border-accent-strong)}.MuiFormLabel-colorPrimary.Mui-focused{color:var(--stratakit-mui-palette-primary-dark)}.MuiLink-root{text-underline-offset:var(--stratakit-space-x05);font-weight:500;text-decoration-color:currentColor;transition:text-underline-offset .15s ease-out}.MuiLink-root:where(:hover,:focus-visible){text-underline-offset:var(--stratakit-space-x1)}.MuiMenuItem-root:where(.Mui-focusVisible){outline-offset:-2px}.MuiPaper-root{--Paper-overlay:unset!important}.MuiPaper-root:where(.MuiPaper-elevation1){--stratakit-mui-palette-background-paper:var(--stratakit-color-bg-page-base)}.MuiPaper-root:where(.MuiPaper-elevation2,.MuiPaper-elevation3,.MuiPaper-elevation4,.MuiPaper-elevation5,.MuiPaper-elevation6,.MuiPaper-elevation7){--stratakit-mui-palette-background-paper:var(--stratakit-color-bg-elevation-base)}.MuiPaper-root:where(.MuiPaper-elevation8,.MuiPaper-elevation9,.MuiPaper-elevation10,.MuiPaper-elevation11,.MuiPaper-elevation12,.MuiPaper-elevation13,.MuiPaper-elevation14,.MuiPaper-elevation15,.MuiPaper-elevation16,.MuiPaper-elevation17,.MuiPaper-elevation18,.MuiPaper-elevation19,.MuiPaper-elevation20,.MuiPaper-elevation21,.MuiPaper-elevation22,.MuiPaper-elevation23,.MuiPaper-elevation24){--stratakit-mui-palette-background-paper:var(--stratakit-color-bg-elevation-level-1)}.MuiTab-root:where(.Mui-selected){color:var(--stratakit-color-text-accent-strong)}.MuiTab-root:where(:focus-visible){outline-offset:-4px}.MuiTabs-indicator{background-color:var(--stratakit-color-border-accent-strong)}.MuiTooltip-tooltip{--stratakit-mui-palette-Tooltip-bg:var(--stratakit-color-bg-elevation-emphasis);box-shadow:var(--stratakit-shadow-control-tooltip-base)}.MuiSwitch-root .MuiSwitch-switchBase:where(.MuiSwitch-colorPrimary):where(.Mui-checked):where(:not(.Mui-disabled)){color:var(--stratakit-mui-palette-primary-dark)}.MuiSwitch-root:where(:has(.MuiSwitch-switchBase.Mui-focusVisible)){outline:2px solid var(--stratakit-color-border-accent-strong)}}`;
|
|
3
|
+
|
|
4
|
+
// src/styles.css.ts
|
|
5
|
+
var styles_css_default = styles_default;
|
|
6
|
+
export {
|
|
7
|
+
styles_css_default as default
|
|
8
|
+
};
|
package/dist/Icon.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Icon } from "@stratakit/foundations";
|
|
3
|
+
declare const ArrowDownIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
4
|
+
declare const CaretsUpDownIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
5
|
+
declare const ChevronDownIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
6
|
+
declare const ChevronLeftIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
7
|
+
declare const ChevronLeftDoubleIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
8
|
+
declare const ChevronRightIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
9
|
+
declare const ChevronRightDoubleIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
10
|
+
declare const DismissIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
11
|
+
declare const ErrorIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
12
|
+
declare const InfoIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
13
|
+
declare const SuccessIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
14
|
+
declare const WarningIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
15
|
+
export { Icon, ArrowDownIcon, CaretsUpDownIcon, ChevronDownIcon, ChevronLeftIcon, ChevronLeftDoubleIcon, ChevronRightIcon, ChevronRightDoubleIcon, DismissIcon, InfoIcon, SuccessIcon, WarningIcon, ErrorIcon, };
|
package/dist/Icon.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Icon } from "@stratakit/foundations";
|
|
4
|
+
import svgArrowDown from "@stratakit/icons/arrow-down.svg";
|
|
5
|
+
import svgCaretsUpDown from "@stratakit/icons/carets-up-down.svg";
|
|
6
|
+
import svgChevronDown from "@stratakit/icons/chevron-down.svg";
|
|
7
|
+
import svgChevronLeft from "@stratakit/icons/chevron-left.svg";
|
|
8
|
+
import svgChevronLeftDouble from "@stratakit/icons/chevron-left-double.svg";
|
|
9
|
+
import svgChevronRight from "@stratakit/icons/chevron-right.svg";
|
|
10
|
+
import svgChevronRightDouble from "@stratakit/icons/chevron-right-double.svg";
|
|
11
|
+
import svgDismiss from "@stratakit/icons/dismiss.svg";
|
|
12
|
+
import svgError from "@stratakit/icons/error.svg";
|
|
13
|
+
import svgInfo from "@stratakit/icons/info.svg";
|
|
14
|
+
import svgStatusSuccess from "@stratakit/icons/status-success.svg";
|
|
15
|
+
import svgWarning from "@stratakit/icons/warning.svg";
|
|
16
|
+
function createIconComponent(href) {
|
|
17
|
+
return React.forwardRef(function IconComponent(props, forwardedRef) {
|
|
18
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
19
|
+
...props,
|
|
20
|
+
href,
|
|
21
|
+
ref: forwardedRef
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const ArrowDownIcon = createIconComponent(svgArrowDown);
|
|
26
|
+
const CaretsUpDownIcon = createIconComponent(svgCaretsUpDown);
|
|
27
|
+
const ChevronDownIcon = createIconComponent(svgChevronDown);
|
|
28
|
+
const ChevronLeftIcon = createIconComponent(svgChevronLeft);
|
|
29
|
+
const ChevronLeftDoubleIcon = createIconComponent(svgChevronLeftDouble);
|
|
30
|
+
const ChevronRightIcon = createIconComponent(svgChevronRight);
|
|
31
|
+
const ChevronRightDoubleIcon = createIconComponent(svgChevronRightDouble);
|
|
32
|
+
const DismissIcon = createIconComponent(svgDismiss);
|
|
33
|
+
const ErrorIcon = createIconComponent(svgError);
|
|
34
|
+
const InfoIcon = createIconComponent(svgInfo);
|
|
35
|
+
const SuccessIcon = createIconComponent(svgStatusSuccess);
|
|
36
|
+
const WarningIcon = createIconComponent(svgWarning);
|
|
37
|
+
export {
|
|
38
|
+
ArrowDownIcon,
|
|
39
|
+
CaretsUpDownIcon,
|
|
40
|
+
ChevronDownIcon,
|
|
41
|
+
ChevronLeftDoubleIcon,
|
|
42
|
+
ChevronLeftIcon,
|
|
43
|
+
ChevronRightDoubleIcon,
|
|
44
|
+
ChevronRightIcon,
|
|
45
|
+
DismissIcon,
|
|
46
|
+
ErrorIcon,
|
|
47
|
+
Icon,
|
|
48
|
+
InfoIcon,
|
|
49
|
+
SuccessIcon,
|
|
50
|
+
WarningIcon
|
|
51
|
+
};
|
package/dist/Root.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface RootProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* The color scheme to use for all components on the page.
|
|
6
|
+
*/
|
|
7
|
+
colorScheme: "light" | "dark";
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Component to be used at the root of your application. It ensures that StrataKit theme for MUI is applied correctly.
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Root colorScheme="dark">
|
|
15
|
+
* <App />
|
|
16
|
+
* </Root>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export { Root };
|
package/dist/Root.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { StyledEngineProvider, ThemeProvider, useColorScheme } from "@mui/material/styles";
|
|
5
|
+
import { Root as StrataKitRoot } from "@stratakit/foundations";
|
|
6
|
+
import { RootContext, useSafeContext } from "@stratakit/foundations/secret-internals";
|
|
7
|
+
import cx from "classnames";
|
|
8
|
+
import { createTheme } from "./createTheme.js";
|
|
9
|
+
import css from "./styles.css.js";
|
|
10
|
+
const theme = createTheme();
|
|
11
|
+
const packageName = "@stratakit/mui";
|
|
12
|
+
const key = `${packageName}@${"0.1.0"}`;
|
|
13
|
+
const Root = React.forwardRef((props, forwardedRef) => {
|
|
14
|
+
const {
|
|
15
|
+
children,
|
|
16
|
+
colorScheme,
|
|
17
|
+
...rest
|
|
18
|
+
} = props;
|
|
19
|
+
return /* @__PURE__ */ jsx(StyledEngineProvider, {
|
|
20
|
+
enableCssLayer: true,
|
|
21
|
+
children: /* @__PURE__ */ jsxs(ThemeProvider, {
|
|
22
|
+
theme,
|
|
23
|
+
defaultMode: colorScheme,
|
|
24
|
+
children: [/* @__PURE__ */ jsx(ColorScheme, {
|
|
25
|
+
colorScheme
|
|
26
|
+
}), /* @__PURE__ */ jsxs(RootInner, {
|
|
27
|
+
...rest,
|
|
28
|
+
colorScheme,
|
|
29
|
+
ref: forwardedRef,
|
|
30
|
+
children: [/* @__PURE__ */ jsx(Styles, {}), children]
|
|
31
|
+
})]
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
const RootInner = React.forwardRef((props, forwardedRef) => {
|
|
36
|
+
const {
|
|
37
|
+
children,
|
|
38
|
+
colorScheme,
|
|
39
|
+
...rest
|
|
40
|
+
} = props;
|
|
41
|
+
return /* @__PURE__ */ jsx(StrataKitRoot, {
|
|
42
|
+
...rest,
|
|
43
|
+
className: cx("\u{1F95D}MuiRoot", props.className),
|
|
44
|
+
colorScheme,
|
|
45
|
+
synchronizeColorScheme: true,
|
|
46
|
+
ref: forwardedRef,
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
function ColorScheme(t0) {
|
|
51
|
+
const $ = _c(4);
|
|
52
|
+
const {
|
|
53
|
+
colorScheme
|
|
54
|
+
} = t0;
|
|
55
|
+
const {
|
|
56
|
+
setColorScheme
|
|
57
|
+
} = useColorScheme();
|
|
58
|
+
let t1;
|
|
59
|
+
let t2;
|
|
60
|
+
if ($[0] !== colorScheme || $[1] !== setColorScheme) {
|
|
61
|
+
t1 = () => {
|
|
62
|
+
setColorScheme(colorScheme);
|
|
63
|
+
};
|
|
64
|
+
t2 = [colorScheme, setColorScheme];
|
|
65
|
+
$[0] = colorScheme;
|
|
66
|
+
$[1] = setColorScheme;
|
|
67
|
+
$[2] = t1;
|
|
68
|
+
$[3] = t2;
|
|
69
|
+
} else {
|
|
70
|
+
t1 = $[2];
|
|
71
|
+
t2 = $[3];
|
|
72
|
+
}
|
|
73
|
+
React.useEffect(t1, t2);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
function Styles() {
|
|
77
|
+
const $ = _c(4);
|
|
78
|
+
const rootContext = useSafeContext(RootContext);
|
|
79
|
+
if (!rootContext.versions?.has(packageName)) {
|
|
80
|
+
rootContext.versions?.set(packageName, "0.1.0");
|
|
81
|
+
}
|
|
82
|
+
const {
|
|
83
|
+
rootNode,
|
|
84
|
+
loadStyles
|
|
85
|
+
} = rootContext;
|
|
86
|
+
let t0;
|
|
87
|
+
let t1;
|
|
88
|
+
if ($[0] !== loadStyles || $[1] !== rootNode) {
|
|
89
|
+
t0 = () => {
|
|
90
|
+
if (!rootNode || !loadStyles) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const {
|
|
94
|
+
cleanup
|
|
95
|
+
} = loadStyles(rootNode, {
|
|
96
|
+
css,
|
|
97
|
+
key
|
|
98
|
+
});
|
|
99
|
+
return cleanup;
|
|
100
|
+
};
|
|
101
|
+
t1 = [rootNode, loadStyles];
|
|
102
|
+
$[0] = loadStyles;
|
|
103
|
+
$[1] = rootNode;
|
|
104
|
+
$[2] = t0;
|
|
105
|
+
$[3] = t1;
|
|
106
|
+
} else {
|
|
107
|
+
t0 = $[2];
|
|
108
|
+
t1 = $[3];
|
|
109
|
+
}
|
|
110
|
+
React.useInsertionEffect(t0, t1);
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
Root
|
|
115
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a StrataKit theme for MUI. Should be used with MUI's `ThemeProvider`.
|
|
3
|
+
*
|
|
4
|
+
* Example:
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import { ThemeProvider } from "@mui/material/styles";
|
|
7
|
+
* import { createTheme } from "@stratakit/mui";
|
|
8
|
+
*
|
|
9
|
+
* const theme = createTheme();
|
|
10
|
+
* <ThemeProvider theme={theme}>
|
|
11
|
+
* <App />
|
|
12
|
+
* </ThemeProvider>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare function createTheme(): import("@mui/material/styles").Theme;
|
|
16
|
+
export { createTheme };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createTheme as createMuiTheme } from "@mui/material/styles";
|
|
3
|
+
import { ArrowDownIcon, CaretsUpDownIcon, ChevronDownIcon, ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, DismissIcon, ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from "./Icon.js";
|
|
4
|
+
function createTheme() {
|
|
5
|
+
return createMuiTheme({
|
|
6
|
+
cssVariables: {
|
|
7
|
+
nativeColor: true,
|
|
8
|
+
colorSchemeSelector: "[data-color-scheme='%s']",
|
|
9
|
+
cssVarPrefix: "stratakit-mui"
|
|
10
|
+
},
|
|
11
|
+
colorSchemes: {
|
|
12
|
+
light: true,
|
|
13
|
+
dark: true
|
|
14
|
+
},
|
|
15
|
+
typography: {
|
|
16
|
+
fontFamily: "var(--stratakit-font-family-sans)",
|
|
17
|
+
fontSize: 14,
|
|
18
|
+
button: {
|
|
19
|
+
textTransform: "none"
|
|
20
|
+
// Disable all-caps on buttons and tabs
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
shadows: [
|
|
24
|
+
"none",
|
|
25
|
+
// 0
|
|
26
|
+
"none",
|
|
27
|
+
// 1
|
|
28
|
+
"var(--stratakit-shadow-surface-xs)",
|
|
29
|
+
// 2
|
|
30
|
+
"var(--stratakit-shadow-surface-sm)",
|
|
31
|
+
// 3
|
|
32
|
+
...new Array(4).fill("var(--stratakit-shadow-surface-md)"),
|
|
33
|
+
// 4-7
|
|
34
|
+
...new Array(17).fill("var(--stratakit-shadow-surface-lg)")
|
|
35
|
+
// 8-24
|
|
36
|
+
// biome-ignore lint/suspicious/noExplicitAny: MUI expects 25 items in the shadows array
|
|
37
|
+
],
|
|
38
|
+
components: {
|
|
39
|
+
MuiAccordionSummary: {
|
|
40
|
+
defaultProps: {
|
|
41
|
+
expandIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
MuiAlert: {
|
|
45
|
+
defaultProps: {
|
|
46
|
+
iconMapping: {
|
|
47
|
+
error: /* @__PURE__ */ jsx(ErrorIcon, {}),
|
|
48
|
+
info: /* @__PURE__ */ jsx(InfoIcon, {}),
|
|
49
|
+
success: /* @__PURE__ */ jsx(SuccessIcon, {}),
|
|
50
|
+
warning: /* @__PURE__ */ jsx(WarningIcon, {})
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
MuiAutocomplete: {
|
|
55
|
+
defaultProps: {
|
|
56
|
+
popupIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {}),
|
|
57
|
+
clearIcon: /* @__PURE__ */ jsx(DismissIcon, {}),
|
|
58
|
+
slotProps: {
|
|
59
|
+
paper: {
|
|
60
|
+
elevation: 8
|
|
61
|
+
// match Menu elevation
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
MuiBreadcrumbs: {
|
|
67
|
+
defaultProps: {
|
|
68
|
+
separator: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
MuiButtonBase: {
|
|
72
|
+
defaultProps: {
|
|
73
|
+
disableRipple: true
|
|
74
|
+
// https://mui.com/material-ui/getting-started/faq/#how-can-i-disable-the-ripple-effect-globally
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
MuiButton: {
|
|
78
|
+
defaultProps: {
|
|
79
|
+
color: "secondary"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
MuiChip: {
|
|
83
|
+
defaultProps: {
|
|
84
|
+
deleteIcon: /* @__PURE__ */ jsx(DismissIcon, {})
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
MuiCheckbox: {
|
|
88
|
+
defaultProps: {
|
|
89
|
+
disableRipple: true
|
|
90
|
+
// Checkbox doesn't inherit from ButtonBase
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
MuiLink: {
|
|
94
|
+
defaultProps: {
|
|
95
|
+
color: "textPrimary"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
MuiPaginationItem: {
|
|
99
|
+
defaultProps: {
|
|
100
|
+
slots: {
|
|
101
|
+
previous: ChevronLeftIcon,
|
|
102
|
+
next: ChevronRightIcon,
|
|
103
|
+
first: ChevronLeftDoubleIcon,
|
|
104
|
+
last: ChevronRightDoubleIcon
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
MuiSelect: {
|
|
109
|
+
defaultProps: {
|
|
110
|
+
IconComponent: CaretsUpDownIcon
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
MuiTablePaginationActions: {
|
|
114
|
+
defaultProps: {
|
|
115
|
+
slots: {
|
|
116
|
+
previousButtonIcon: ChevronLeftIcon,
|
|
117
|
+
nextButtonIcon: ChevronRightIcon,
|
|
118
|
+
firstButtonIcon: ChevronLeftDoubleIcon,
|
|
119
|
+
lastButtonIcon: ChevronRightDoubleIcon
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
MuiTableSortLabel: {
|
|
124
|
+
defaultProps: {
|
|
125
|
+
// TODO: This should use sort-ascending and sort-descending icons, but that requires disabling MUI's built-in icon rotation.
|
|
126
|
+
IconComponent: ArrowDownIcon
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
createTheme
|
|
134
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// inline-css:/home/runner/work/design-system/design-system/packages/mui/src/styles.css
|
|
2
|
+
var styles_default = String.raw`@layer stratakit{[data-color-scheme],.🥝MuiRoot{--stratakit-mui-palette-background-default:var(--stratakit-color-bg-page-depth);--stratakit-mui-palette-background-paper:var(--stratakit-color-bg-page-depth);--stratakit-mui-palette-divider:var(--stratakit-color-border-page-base);--stratakit-mui-palette-text-primary:var(--stratakit-color-text-neutral-primary);--stratakit-mui-palette-text-secondary:var(--stratakit-color-text-neutral-secondary);--stratakit-mui-palette-text-disabled:var(--stratakit-color-text-neutral-disabled);--stratakit-mui-palette-primary-main:var(--stratakit-color-bg-accent-base);--stratakit-mui-palette-primary-dark:var(--stratakit-color-bg-accent-faded);--stratakit-mui-palette-primary-light:var(--stratakit-color-bg-accent-muted);--stratakit-mui-palette-primary-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-secondary-main:var(--stratakit-color-bg-mono-base);--stratakit-mui-palette-secondary-dark:var(--stratakit-color-bg-mono-faded);--stratakit-mui-palette-secondary-light:var(--stratakit-color-bg-mono-muted);--stratakit-mui-palette-secondary-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-action-active:var(--stratakit-color-icon-neutral-primary);--stratakit-mui-palette-action-disabled:var(--stratakit-color-icon-neutral-disabled);--stratakit-mui-palette-action-disabledBackground:var(--stratakit-color-bg-glow-on-surface-disabled);--stratakit-mui-palette-error-main:var(--stratakit-color-bg-critical-base);--stratakit-mui-palette-error-dark:var(--stratakit-color-bg-critical-faded);--stratakit-mui-palette-error-light:var(--stratakit-color-bg-critical-muted);--stratakit-mui-palette-error-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-warning-main:var(--stratakit-color-bg-severe-base);--stratakit-mui-palette-warning-dark:var(--stratakit-color-bg-severe-faded);--stratakit-mui-palette-warning-light:var(--stratakit-color-bg-severe-muted);--stratakit-mui-palette-warning-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-success-main:var(--stratakit-color-bg-positive-base);--stratakit-mui-palette-success-dark:var(--stratakit-color-bg-positive-faded);--stratakit-mui-palette-success-light:var(--stratakit-color-bg-positive-muted);--stratakit-mui-palette-success-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-info-main:var(--stratakit-color-bg-info-base);--stratakit-mui-palette-info-dark:var(--stratakit-color-bg-info-faded);--stratakit-mui-palette-info-light:var(--stratakit-color-bg-info-muted);--stratakit-mui-palette-info-contrastText:var(--stratakit-color-text-neutral-emphasis);--stratakit-mui-palette-grey-50:oklch(85.95% .006 255.48);--stratakit-mui-palette-grey-100:oklch(79.56% .008 241.69);--stratakit-mui-palette-grey-200:oklch(75.82% .01 252.83);--stratakit-mui-palette-grey-300:oklch(69.04% .014 255.53);--stratakit-mui-palette-grey-400:oklch(62.09% .017 257.22);--stratakit-mui-palette-grey-500:oklch(55.22% .018 253.99);--stratakit-mui-palette-grey-600:oklch(48.26% .017 254.7);--stratakit-mui-palette-grey-700:oklch(41.45% .013 256.75);--stratakit-mui-palette-grey-800:oklch(34.4% .011 264.42);--stratakit-mui-palette-grey-900:oklch(26.92% .008 268.32);--stratakit-mui-palette-grey-A100:oklch(79.56% .008 241.69);--stratakit-mui-palette-grey-A200:oklch(75.82% .01 252.83);--stratakit-mui-palette-grey-A400:oklch(62.09% .017 257.22);--stratakit-mui-palette-grey-A700:oklch(48.26% .017 254.7)}.MuiAlert-icon{align-items:center}.MuiButton-root:where(.MuiButton-colorSecondary){--variant-containedBg:var(--stratakit-color-bg-neutral-base);--variant-containedColor:var(--stratakit-color-text-neutral-primary);--variant-outlinedColor:var(--stratakit-color-text-neutral-primary);--variant-textColor:var(--stratakit-color-text-neutral-primary)}.MuiButton-root:where(.MuiButton-colorSecondary):where(:hover){--variant-containedBg:color-mix(in oklch,var(--stratakit-color-bg-neutral-base)100%,var(--stratakit-color-glow-hue)var(--stratakit-color-bg-glow-base-hover-\%))}.MuiButton-root:where(.MuiButton-colorPrimary){--variant-outlinedColor:var(--stratakit-color-text-accent-strong);--variant-textColor:var(--stratakit-color-text-accent-strong)}.MuiCheckbox-root:where(.MuiCheckbox-colorPrimary):where(.Mui-checked,.MuiCheckbox-indeterminate):where(:not(.Mui-disabled)){color:var(--stratakit-mui-palette-primary-dark)}.MuiCheckbox-root:where(.Mui-focusVisible){outline:2px solid var(--stratakit-color-border-accent-strong)}.MuiFormLabel-colorPrimary.Mui-focused{color:var(--stratakit-mui-palette-primary-dark)}.MuiLink-root{text-underline-offset:var(--stratakit-space-x05);font-weight:500;text-decoration-color:currentColor;transition:text-underline-offset .15s ease-out}.MuiLink-root:where(:hover,:focus-visible){text-underline-offset:var(--stratakit-space-x1)}.MuiMenuItem-root:where(.Mui-focusVisible){outline-offset:-2px}.MuiPaper-root{--Paper-overlay:unset!important}.MuiPaper-root:where(.MuiPaper-elevation1){--stratakit-mui-palette-background-paper:var(--stratakit-color-bg-page-base)}.MuiPaper-root:where(.MuiPaper-elevation2,.MuiPaper-elevation3,.MuiPaper-elevation4,.MuiPaper-elevation5,.MuiPaper-elevation6,.MuiPaper-elevation7){--stratakit-mui-palette-background-paper:var(--stratakit-color-bg-elevation-base)}.MuiPaper-root:where(.MuiPaper-elevation8,.MuiPaper-elevation9,.MuiPaper-elevation10,.MuiPaper-elevation11,.MuiPaper-elevation12,.MuiPaper-elevation13,.MuiPaper-elevation14,.MuiPaper-elevation15,.MuiPaper-elevation16,.MuiPaper-elevation17,.MuiPaper-elevation18,.MuiPaper-elevation19,.MuiPaper-elevation20,.MuiPaper-elevation21,.MuiPaper-elevation22,.MuiPaper-elevation23,.MuiPaper-elevation24){--stratakit-mui-palette-background-paper:var(--stratakit-color-bg-elevation-level-1)}.MuiTab-root:where(.Mui-selected){color:var(--stratakit-color-text-accent-strong)}.MuiTab-root:where(:focus-visible){outline-offset:-4px}.MuiTabs-indicator{background-color:var(--stratakit-color-border-accent-strong)}.MuiTooltip-tooltip{--stratakit-mui-palette-Tooltip-bg:var(--stratakit-color-bg-elevation-emphasis);box-shadow:var(--stratakit-shadow-control-tooltip-base)}.MuiSwitch-root .MuiSwitch-switchBase:where(.MuiSwitch-colorPrimary):where(.Mui-checked):where(:not(.Mui-disabled)){color:var(--stratakit-mui-palette-primary-dark)}.MuiSwitch-root:where(:has(.MuiSwitch-switchBase.Mui-focusVisible)){outline:2px solid var(--stratakit-color-border-accent-strong)}}`;
|
|
3
|
+
|
|
4
|
+
// src/styles.css.ts
|
|
5
|
+
var styles_css_default = styles_default;
|
|
6
|
+
export {
|
|
7
|
+
styles_css_default as default
|
|
8
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stratakit/mui",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"@stratakit/source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"development": "./dist/DEV/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"CHANGELOG.md",
|
|
20
|
+
"LICENSE.md"
|
|
21
|
+
],
|
|
22
|
+
"description": "StrataKit theme for Material UI",
|
|
23
|
+
"author": "Bentley Systems",
|
|
24
|
+
"homepage": "https://github.com/iTwin/design-system",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/iTwin/design-system.git",
|
|
28
|
+
"directory": "packages/mui"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"frontend",
|
|
32
|
+
"itwin",
|
|
33
|
+
"itwinui",
|
|
34
|
+
"strata",
|
|
35
|
+
"stratakit",
|
|
36
|
+
"react",
|
|
37
|
+
"react-component",
|
|
38
|
+
"mui",
|
|
39
|
+
"material-ui",
|
|
40
|
+
"design system"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@stratakit/foundations": "^0.4.4",
|
|
44
|
+
"@stratakit/icons": "^0.2.2",
|
|
45
|
+
"classnames": "^2.5.1",
|
|
46
|
+
"react-compiler-runtime": "^1.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/react": "^19.2.7",
|
|
50
|
+
"@types/react-dom": "^19.2.3",
|
|
51
|
+
"esbuild": "^0.27.0",
|
|
52
|
+
"react": "^19.2.1",
|
|
53
|
+
"react-dom": "^19.2.1",
|
|
54
|
+
"typescript": "~5.9.3"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@mui/material": "^7.3.6",
|
|
58
|
+
"react": ">=18.0.0",
|
|
59
|
+
"react-dom": ">=18.0.0"
|
|
60
|
+
},
|
|
61
|
+
"wireit": {
|
|
62
|
+
"build": {
|
|
63
|
+
"dependencies": [
|
|
64
|
+
"build:js",
|
|
65
|
+
"build:DEV",
|
|
66
|
+
"build:types",
|
|
67
|
+
"../foundations:build"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"build:js": {
|
|
71
|
+
"command": "node scripts/build.js",
|
|
72
|
+
"files": [
|
|
73
|
+
"src",
|
|
74
|
+
"scripts",
|
|
75
|
+
"../../internal"
|
|
76
|
+
],
|
|
77
|
+
"output": [
|
|
78
|
+
"dist/**/*.js",
|
|
79
|
+
"!dist/DEV"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"build:DEV": {
|
|
83
|
+
"command": "node scripts/build.js",
|
|
84
|
+
"files": [
|
|
85
|
+
"src",
|
|
86
|
+
"scripts",
|
|
87
|
+
"../../internal"
|
|
88
|
+
],
|
|
89
|
+
"output": [
|
|
90
|
+
"dist/DEV/**/*.js"
|
|
91
|
+
],
|
|
92
|
+
"env": {
|
|
93
|
+
"NODE_ENV": "development"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"build:types": {
|
|
97
|
+
"command": "tsc --outDir dist",
|
|
98
|
+
"files": [
|
|
99
|
+
"src"
|
|
100
|
+
],
|
|
101
|
+
"output": [
|
|
102
|
+
"dist/**/*.d.ts"
|
|
103
|
+
],
|
|
104
|
+
"dependencies": [
|
|
105
|
+
"../foundations:build:types"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"dev": {
|
|
109
|
+
"command": "tsc --watch --outDir dist",
|
|
110
|
+
"files": [
|
|
111
|
+
"src"
|
|
112
|
+
],
|
|
113
|
+
"service": true
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"scripts": {
|
|
117
|
+
"build": "wireit",
|
|
118
|
+
"dev": "wireit"
|
|
119
|
+
}
|
|
120
|
+
}
|