@stratakit/mui 0.3.1 → 0.4.1
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 +52 -0
- package/dist/DEV/Root.js +20 -9
- package/dist/DEV/index.js +1 -3
- package/dist/DEV/styles.css.js +1 -1
- package/dist/DEV/~components/MuiAutocomplete.js +23 -0
- package/dist/DEV/~components/MuiAvatarGroup.js +16 -0
- package/dist/DEV/~components/MuiButtonBase.js +2 -2
- package/dist/DEV/~components/MuiIconButton.js +2 -2
- package/dist/DEV/~components/MuiInputLabel.js +21 -0
- package/dist/DEV/~components/MuiTable.js +26 -0
- package/dist/DEV/~components/MuiToggleButton.js +39 -0
- package/dist/DEV/~components/MuiTypography.js +44 -0
- package/dist/DEV/{createTheme.js → ~createTheme.js} +94 -31
- package/dist/Icon.d.ts +1 -1
- package/dist/Root.d.ts +2 -1
- package/dist/Root.js +10 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -3
- package/dist/styles.css.js +1 -1
- package/dist/types.d.ts +30 -0
- package/dist/~components/MuiAutocomplete.d.ts +3 -0
- package/dist/~components/MuiAutocomplete.js +22 -0
- package/dist/~components/MuiAvatarGroup.d.ts +6 -0
- package/dist/~components/MuiAvatarGroup.js +26 -0
- package/dist/~components/MuiButtonBase.js +2 -1
- package/dist/~components/MuiChip.d.ts +2 -2
- package/dist/~components/MuiIconButton.d.ts +1 -1
- package/dist/~components/MuiIconButton.js +2 -0
- package/dist/~components/MuiInputLabel.d.ts +6 -0
- package/dist/~components/MuiInputLabel.js +23 -0
- package/dist/~components/MuiTable.d.ts +2 -1
- package/dist/~components/MuiTable.js +24 -0
- package/dist/~components/MuiToggleButton.d.ts +6 -0
- package/dist/~components/MuiToggleButton.js +43 -0
- package/dist/~components/MuiTypography.d.ts +2 -0
- package/dist/~components/MuiTypography.js +40 -0
- package/dist/~createTheme.d.ts +3 -0
- package/dist/{createTheme.js → ~createTheme.js} +69 -35
- package/package.json +7 -7
- package/dist/createTheme.d.ts +0 -16
package/dist/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { IconButtonProps } from "@mui/material/IconButton";
|
|
|
4
4
|
import type { CommonProps } from "@mui/material/OverridableComponent";
|
|
5
5
|
import type { TableCellProps as MuiTableCellProps } from "@mui/material/TableCell";
|
|
6
6
|
import type { TextFieldProps, TextFieldVariants } from "@mui/material/TextField";
|
|
7
|
+
import type { TooltipProps } from "@mui/material/Tooltip";
|
|
7
8
|
import type { TypographyProps } from "@mui/material/Typography";
|
|
8
9
|
import type * as React from "react";
|
|
9
10
|
declare module "@mui/material/OverridableComponent" {
|
|
@@ -125,6 +126,12 @@ declare module "@mui/material/Chip" {
|
|
|
125
126
|
warning: false;
|
|
126
127
|
}
|
|
127
128
|
}
|
|
129
|
+
declare module "@mui/material/Dialog" {
|
|
130
|
+
interface DialogProps extends Pick<CommonProps, "render"> {
|
|
131
|
+
/** @deprecated Use `render` prop instead. */
|
|
132
|
+
component?: React.ElementType;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
128
135
|
declare module "@mui/material/Fab" {
|
|
129
136
|
interface FabPropsColorOverrides {
|
|
130
137
|
info: false;
|
|
@@ -179,6 +186,12 @@ declare module "@mui/material/IconButton" {
|
|
|
179
186
|
* If not specified, the accessible name and tooltip must be wired up manually.
|
|
180
187
|
*/
|
|
181
188
|
label?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Placement of the tooltip that is shown when the `label` prop is specified.
|
|
191
|
+
*
|
|
192
|
+
* @default 'top'
|
|
193
|
+
*/
|
|
194
|
+
labelPlacement?: TooltipProps["placement"];
|
|
182
195
|
}
|
|
183
196
|
}
|
|
184
197
|
declare module "@mui/material/InputBase" {
|
|
@@ -253,6 +266,12 @@ declare module "@mui/material/TableCell" {
|
|
|
253
266
|
component?: MuiTableCellProps["component"];
|
|
254
267
|
}
|
|
255
268
|
}
|
|
269
|
+
declare module "@mui/material/TableRow" {
|
|
270
|
+
interface TableRowOwnProps {
|
|
271
|
+
/** The default with `@stratakit/mui` is `true`, except when used inside `TableHead`. */
|
|
272
|
+
hover?: boolean;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
256
275
|
declare module "@mui/material/TextField" {
|
|
257
276
|
interface TextFieldPropsColorOverrides {
|
|
258
277
|
secondary: false;
|
|
@@ -268,7 +287,18 @@ declare module "@mui/material/TextField" {
|
|
|
268
287
|
declare module "@mui/material/ToggleButton" {
|
|
269
288
|
interface ToggleButtonOwnProps {
|
|
270
289
|
LinkComponent?: never;
|
|
290
|
+
/**
|
|
291
|
+
* The accessible name of the button, which is also shown as a tooltip on hover/focus.
|
|
292
|
+
*
|
|
293
|
+
* Should only be provided when the toggle button does not have visible text content that can serve as an accessible name.
|
|
294
|
+
*/
|
|
271
295
|
label?: IconButtonProps["label"];
|
|
296
|
+
/**
|
|
297
|
+
* Placement of the tooltip that is shown when the `label` prop is specified.
|
|
298
|
+
*
|
|
299
|
+
* @default 'top'
|
|
300
|
+
*/
|
|
301
|
+
labelPlacement?: TooltipProps["placement"];
|
|
272
302
|
}
|
|
273
303
|
}
|
|
274
304
|
declare module "@mui/material/Tooltip" {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const MuiAutocomplete: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
3
|
+
export { MuiAutocomplete };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
|
+
import { MuiInputLabelContext } from "./MuiInputLabel.js";
|
|
6
|
+
const MuiAutocomplete = forwardRef((props, forwardedRef) => {
|
|
7
|
+
const [labelId, setLabelId] = React.useState(void 0);
|
|
8
|
+
return /* @__PURE__ */ jsx(MuiInputLabelContext.Provider, {
|
|
9
|
+
value: {
|
|
10
|
+
setLabelId
|
|
11
|
+
},
|
|
12
|
+
children: /* @__PURE__ */ jsx(Role.div, {
|
|
13
|
+
role: "group",
|
|
14
|
+
"aria-labelledby": labelId,
|
|
15
|
+
...props,
|
|
16
|
+
ref: forwardedRef
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
MuiAutocomplete
|
|
22
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseProps } from "@stratakit/foundations/secret-internals";
|
|
3
|
+
interface MuiAvatarGroupProps extends BaseProps<"div"> {
|
|
4
|
+
}
|
|
5
|
+
declare const MuiAvatarGroup: React.ForwardRefExoticComponent<MuiAvatarGroupProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
6
|
+
export { MuiAvatarGroup };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
|
+
const MuiAvatarGroup = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const {
|
|
7
|
+
children: childrenProp,
|
|
8
|
+
...rest
|
|
9
|
+
} = props;
|
|
10
|
+
const children = React.Children.map(childrenProp, (child) => {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
className: "\u{1F95D}MuiAvatarGroupItem",
|
|
13
|
+
role: "listitem",
|
|
14
|
+
children: child
|
|
15
|
+
});
|
|
16
|
+
})?.reverse();
|
|
17
|
+
return /* @__PURE__ */ jsx(Role.div, {
|
|
18
|
+
role: "list",
|
|
19
|
+
...rest,
|
|
20
|
+
ref: forwardedRef,
|
|
21
|
+
children
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
MuiAvatarGroup
|
|
26
|
+
};
|
|
@@ -8,9 +8,10 @@ const MuiButtonBase = forwardRef((props, forwardedRef) => {
|
|
|
8
8
|
const {
|
|
9
9
|
href,
|
|
10
10
|
"aria-disabled": ariaDisabled,
|
|
11
|
+
disabled,
|
|
11
12
|
...rest
|
|
12
13
|
} = props;
|
|
13
|
-
const isDisabled = ariaDisabled === true || ariaDisabled === "true";
|
|
14
|
+
const isDisabled = disabled || ariaDisabled === true || ariaDisabled === "true";
|
|
14
15
|
const [tagName, setTagName] = React.useState(void 0);
|
|
15
16
|
let t0;
|
|
16
17
|
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -6,5 +6,5 @@ interface MuiChipProps extends BaseProps<"div">, Pick<ChipProps, "deleteLabel">
|
|
|
6
6
|
}
|
|
7
7
|
declare const MuiChip: React.ForwardRefExoticComponent<MuiChipProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
8
8
|
declare const MuiChipLabel: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
|
|
9
|
-
declare const MuiChipDeleteIcon: React.ForwardRefExoticComponent<Omit<import("@mui/material/IconButton").IconButtonOwnProps & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, "
|
|
10
|
-
export { MuiChip,
|
|
9
|
+
declare const MuiChipDeleteIcon: React.ForwardRefExoticComponent<Omit<import("@mui/material/IconButton").IconButtonOwnProps & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, keyof import("@mui/material/IconButton").IconButtonOwnProps> & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, "tabIndex" | "nativeButton" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | keyof import("@mui/material/IconButton").IconButtonOwnProps> & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "className" | "color" | "style" | "tabIndex" | "children" | "render" | "label" | "component" | "classes" | "sx" | "disabled" | "disableFocusRipple" | "loading" | "loadingIndicator" | "size" | "LinkComponent" | "nativeButton" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "edge" | "labelPlacement">, "ref"> & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
10
|
+
export { MuiChip, MuiChipDeleteIcon, MuiChipLabel };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IconButtonOwnProps } from "@mui/material/IconButton";
|
|
2
2
|
import type { BaseProps } from "@stratakit/foundations/secret-internals";
|
|
3
|
-
interface MuiIconButtonProps extends BaseProps<"button">, Pick<IconButtonOwnProps, "label"> {
|
|
3
|
+
interface MuiIconButtonProps extends BaseProps<"button">, Pick<IconButtonOwnProps, "label" | "labelPlacement"> {
|
|
4
4
|
}
|
|
5
5
|
declare const MuiIconButton: import("react").ForwardRefExoticComponent<MuiIconButtonProps & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
6
6
|
export { MuiIconButton };
|
|
@@ -5,12 +5,14 @@ import { MuiButtonBase } from "./MuiButtonBase.js";
|
|
|
5
5
|
const MuiIconButton = forwardRef((props, forwardedRef) => {
|
|
6
6
|
const {
|
|
7
7
|
label,
|
|
8
|
+
labelPlacement,
|
|
8
9
|
...rest
|
|
9
10
|
} = props;
|
|
10
11
|
if (label) {
|
|
11
12
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
12
13
|
title: label,
|
|
13
14
|
describeChild: false,
|
|
15
|
+
placement: labelPlacement,
|
|
14
16
|
children: /* @__PURE__ */ jsx(MuiButtonBase, {
|
|
15
17
|
...rest,
|
|
16
18
|
ref: forwardedRef
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const MuiInputLabelContext: React.Context<{
|
|
3
|
+
setLabelId: (id: string | undefined) => void;
|
|
4
|
+
} | undefined>;
|
|
5
|
+
declare const MuiInputLabel: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLLabelElement>>;
|
|
6
|
+
export { MuiInputLabel, MuiInputLabelContext };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
|
+
const MuiInputLabelContext = React.createContext(void 0);
|
|
6
|
+
const MuiInputLabel = forwardRef((props, forwardedRef) => {
|
|
7
|
+
const {
|
|
8
|
+
setLabelId
|
|
9
|
+
} = React.useContext(MuiInputLabelContext) ?? {};
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
if (!setLabelId) return;
|
|
12
|
+
setLabelId(props.id);
|
|
13
|
+
return () => setLabelId(void 0);
|
|
14
|
+
}, [props.id, setLabelId]);
|
|
15
|
+
return /* @__PURE__ */ jsx(Role.label, {
|
|
16
|
+
...props,
|
|
17
|
+
ref: forwardedRef
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
MuiInputLabel,
|
|
22
|
+
MuiInputLabelContext
|
|
23
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
declare const MuiTableHead: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLTableSectionElement>>;
|
|
3
|
+
declare const MuiTableBody: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLTableSectionElement>>;
|
|
3
4
|
declare const MuiTableCell: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLTableDataCellElement>>;
|
|
4
|
-
export {
|
|
5
|
+
export { MuiTableBody, MuiTableCell, MuiTableHead };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { ThemeProvider } from "@mui/material/styles";
|
|
4
5
|
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
6
|
const MuiTableHeadContext = React.createContext(false);
|
|
6
7
|
const MuiTableHead = forwardRef((props, forwardedRef) => {
|
|
@@ -13,6 +14,28 @@ const MuiTableHead = forwardRef((props, forwardedRef) => {
|
|
|
13
14
|
})
|
|
14
15
|
});
|
|
15
16
|
});
|
|
17
|
+
const MuiTableBody = forwardRef((props, forwardedRef) => {
|
|
18
|
+
return /* @__PURE__ */ jsx(ThemeProvider, {
|
|
19
|
+
theme: (outerTheme) => ({
|
|
20
|
+
...outerTheme,
|
|
21
|
+
components: {
|
|
22
|
+
...outerTheme.components,
|
|
23
|
+
MuiTableRow: {
|
|
24
|
+
defaultProps: {
|
|
25
|
+
...outerTheme.components?.MuiTableRow?.defaultProps,
|
|
26
|
+
hover: true
|
|
27
|
+
// Only enable `hover` for rows inside TableBody.
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
children: /* @__PURE__ */ jsx(Role, {
|
|
33
|
+
render: /* @__PURE__ */ jsx("tbody", {}),
|
|
34
|
+
...props,
|
|
35
|
+
ref: forwardedRef
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
});
|
|
16
39
|
const MuiTableCell = forwardRef((props, forwardedRef) => {
|
|
17
40
|
const inHeader = React.useContext(MuiTableHeadContext);
|
|
18
41
|
const Component = inHeader ? "th" : "td";
|
|
@@ -23,6 +46,7 @@ const MuiTableCell = forwardRef((props, forwardedRef) => {
|
|
|
23
46
|
});
|
|
24
47
|
});
|
|
25
48
|
export {
|
|
49
|
+
MuiTableBody,
|
|
26
50
|
MuiTableCell,
|
|
27
51
|
MuiTableHead
|
|
28
52
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ToggleButtonOwnProps } from "@mui/material/ToggleButton";
|
|
2
|
+
import type { BaseProps } from "@stratakit/foundations/secret-internals";
|
|
3
|
+
interface MuiToggleButtonProps extends BaseProps<"button">, Pick<ToggleButtonOwnProps, "label" | "labelPlacement"> {
|
|
4
|
+
}
|
|
5
|
+
declare const MuiToggleButton: import("react").ForwardRefExoticComponent<MuiToggleButtonProps & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
6
|
+
export { MuiToggleButton };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import IconButton from "@mui/material/IconButton";
|
|
3
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
4
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
|
+
import { MuiButtonBase } from "./MuiButtonBase.js";
|
|
6
|
+
const MuiToggleButton = forwardRef((props, forwardedRef) => {
|
|
7
|
+
const {
|
|
8
|
+
label,
|
|
9
|
+
labelPlacement,
|
|
10
|
+
...rest
|
|
11
|
+
} = props;
|
|
12
|
+
const classList = props.className?.split(" ") ?? [];
|
|
13
|
+
const size = (() => {
|
|
14
|
+
if (classList.includes("MuiToggleButton-sizeSmall")) return "small";
|
|
15
|
+
if (classList.includes("MuiToggleButton-sizeLarge")) return "large";
|
|
16
|
+
if (classList.includes("MuiToggleButton-sizeMedium")) return "medium";
|
|
17
|
+
return void 0;
|
|
18
|
+
})();
|
|
19
|
+
if (label) {
|
|
20
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
21
|
+
title: label,
|
|
22
|
+
describeChild: false,
|
|
23
|
+
placement: labelPlacement,
|
|
24
|
+
children: /* @__PURE__ */ jsx(MuiButtonBase, {
|
|
25
|
+
...rest,
|
|
26
|
+
render: props.render ?? /* @__PURE__ */ jsx(IconButton, {
|
|
27
|
+
size
|
|
28
|
+
}),
|
|
29
|
+
ref: forwardedRef
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return /* @__PURE__ */ jsx(MuiButtonBase, {
|
|
34
|
+
...rest,
|
|
35
|
+
render: props.render ?? /* @__PURE__ */ jsx(IconButton, {
|
|
36
|
+
size
|
|
37
|
+
}),
|
|
38
|
+
ref: forwardedRef
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
MuiToggleButton
|
|
43
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const MuiTypography: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref">, "render"> & import("react").RefAttributes<HTMLElement | HTMLParagraphElement>>;
|
|
2
|
+
export { MuiTypography };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
4
|
+
const variantMapping = {
|
|
5
|
+
h1: "h1",
|
|
6
|
+
h2: "h2",
|
|
7
|
+
h3: "h3",
|
|
8
|
+
h4: "h4",
|
|
9
|
+
h5: "h5",
|
|
10
|
+
h6: "h6",
|
|
11
|
+
subtitle1: "h6",
|
|
12
|
+
subtitle2: "h6",
|
|
13
|
+
body1: "p",
|
|
14
|
+
body2: "p",
|
|
15
|
+
inherit: "p",
|
|
16
|
+
button: "span",
|
|
17
|
+
caption: "span",
|
|
18
|
+
overline: "span"
|
|
19
|
+
};
|
|
20
|
+
const variants = Object.keys(variantMapping);
|
|
21
|
+
const headings = ["h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2"];
|
|
22
|
+
const MuiTypography = forwardRef((props, forwardedRef) => {
|
|
23
|
+
const classList = props.className?.split(" ").filter(Boolean);
|
|
24
|
+
const variant = (() => {
|
|
25
|
+
const variant2 = variants.find((name) => classList?.includes(`MuiTypography-${name}`));
|
|
26
|
+
return variant2 || "body2";
|
|
27
|
+
})();
|
|
28
|
+
const render = (() => {
|
|
29
|
+
const Element = variantMapping[variant] || "p";
|
|
30
|
+
return /* @__PURE__ */ jsx(Element, {});
|
|
31
|
+
})();
|
|
32
|
+
return /* @__PURE__ */ jsx(Role, {
|
|
33
|
+
render,
|
|
34
|
+
...props,
|
|
35
|
+
ref: forwardedRef
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
MuiTypography
|
|
40
|
+
};
|
|
@@ -2,7 +2,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Role } from "@ariakit/react/role";
|
|
4
4
|
import OutlinedInput from "@mui/material/OutlinedInput";
|
|
5
|
+
import StepConnector from "@mui/material/StepConnector";
|
|
5
6
|
import { createTheme as createMuiTheme } from "@mui/material/styles";
|
|
7
|
+
import cx from "classnames";
|
|
8
|
+
import { MuiAutocomplete } from "./~components/MuiAutocomplete.js";
|
|
9
|
+
import { MuiAvatarGroup } from "./~components/MuiAvatarGroup.js";
|
|
6
10
|
import { MuiBadge } from "./~components/MuiBadge.js";
|
|
7
11
|
import { MuiBottomNavigationAction } from "./~components/MuiBottomNavigation.js";
|
|
8
12
|
import { MuiButtonBase } from "./~components/MuiButtonBase.js";
|
|
@@ -10,9 +14,12 @@ import { MuiCard, MuiCardActionArea, MuiCardMedia } from "./~components/MuiCard.
|
|
|
10
14
|
import { MuiChip, MuiChipDeleteIcon, MuiChipLabel } from "./~components/MuiChip.js";
|
|
11
15
|
import { MuiDivider } from "./~components/MuiDivider.js";
|
|
12
16
|
import { MuiIconButton } from "./~components/MuiIconButton.js";
|
|
17
|
+
import { MuiInputLabel } from "./~components/MuiInputLabel.js";
|
|
13
18
|
import { MuiSnackbar } from "./~components/MuiSnackbar.js";
|
|
14
19
|
import { MuiStepIcon } from "./~components/MuiStepper.js";
|
|
15
|
-
import { MuiTableCell, MuiTableHead } from "./~components/MuiTable.js";
|
|
20
|
+
import { MuiTableBody, MuiTableCell, MuiTableHead } from "./~components/MuiTable.js";
|
|
21
|
+
import { MuiToggleButton } from "./~components/MuiToggleButton.js";
|
|
22
|
+
import { MuiTypography } from "./~components/MuiTypography.js";
|
|
16
23
|
import { ArrowDownIcon, CaretsUpDownIcon, ChevronDownIcon, ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, DismissIcon, ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from "./Icon.js";
|
|
17
24
|
function createTheme() {
|
|
18
25
|
const palette = {
|
|
@@ -127,6 +134,7 @@ function createTheme() {
|
|
|
127
134
|
MuiAccordionSummary: {
|
|
128
135
|
defaultProps: {
|
|
129
136
|
component: Role.div,
|
|
137
|
+
nativeButton: false,
|
|
130
138
|
expandIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
131
139
|
}
|
|
132
140
|
},
|
|
@@ -151,7 +159,18 @@ function createTheme() {
|
|
|
151
159
|
defaultProps: {
|
|
152
160
|
popupIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {}),
|
|
153
161
|
clearIcon: /* @__PURE__ */ jsx(DismissIcon, {}),
|
|
162
|
+
renderOption: ({
|
|
163
|
+
key,
|
|
164
|
+
...props
|
|
165
|
+
}, option, _, ownerState) => /* @__PURE__ */ jsx("li", {
|
|
166
|
+
...props,
|
|
167
|
+
className: cx("MuiMenuItem-root", props.className),
|
|
168
|
+
children: ownerState.getOptionLabel(option)
|
|
169
|
+
}, key),
|
|
154
170
|
slotProps: {
|
|
171
|
+
root: {
|
|
172
|
+
component: MuiAutocomplete
|
|
173
|
+
},
|
|
155
174
|
paper: {
|
|
156
175
|
elevation: 8
|
|
157
176
|
// match Menu elevation
|
|
@@ -173,8 +192,10 @@ function createTheme() {
|
|
|
173
192
|
MuiAvatar: {
|
|
174
193
|
defaultProps: {
|
|
175
194
|
component: Role.div,
|
|
176
|
-
|
|
177
|
-
|
|
195
|
+
slotProps: {
|
|
196
|
+
img: {
|
|
197
|
+
draggable: false
|
|
198
|
+
}
|
|
178
199
|
}
|
|
179
200
|
},
|
|
180
201
|
styleOverrides: {
|
|
@@ -186,7 +207,12 @@ function createTheme() {
|
|
|
186
207
|
},
|
|
187
208
|
MuiAvatarGroup: {
|
|
188
209
|
defaultProps: {
|
|
189
|
-
component:
|
|
210
|
+
component: MuiAvatarGroup,
|
|
211
|
+
slotProps: {
|
|
212
|
+
surplus: {
|
|
213
|
+
["data-_sk-surplus"]: ``
|
|
214
|
+
}
|
|
215
|
+
}
|
|
190
216
|
}
|
|
191
217
|
},
|
|
192
218
|
MuiBackdrop: {
|
|
@@ -258,6 +284,7 @@ function createTheme() {
|
|
|
258
284
|
component: Role.div,
|
|
259
285
|
slotProps: {
|
|
260
286
|
title: {
|
|
287
|
+
// biome-ignore lint/suspicious/noExplicitAny: MUI's CardHeader.title.component is hardcoded to "span"
|
|
261
288
|
component: Role.h2
|
|
262
289
|
}
|
|
263
290
|
}
|
|
@@ -301,7 +328,8 @@ function createTheme() {
|
|
|
301
328
|
},
|
|
302
329
|
MuiDialogContentText: {
|
|
303
330
|
defaultProps: {
|
|
304
|
-
component: Role.p
|
|
331
|
+
component: Role.p,
|
|
332
|
+
variant: "inherit"
|
|
305
333
|
}
|
|
306
334
|
},
|
|
307
335
|
MuiDialogTitle: {
|
|
@@ -345,11 +373,6 @@ function createTheme() {
|
|
|
345
373
|
component: Role.div
|
|
346
374
|
}
|
|
347
375
|
},
|
|
348
|
-
MuiGridLegacy: {
|
|
349
|
-
defaultProps: {
|
|
350
|
-
component: Role.div
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
376
|
MuiIcon: {
|
|
354
377
|
defaultProps: {
|
|
355
378
|
component: Role.span
|
|
@@ -378,7 +401,7 @@ function createTheme() {
|
|
|
378
401
|
},
|
|
379
402
|
MuiInputLabel: {
|
|
380
403
|
defaultProps: {
|
|
381
|
-
component:
|
|
404
|
+
component: MuiInputLabel,
|
|
382
405
|
shrink: true
|
|
383
406
|
// Removes label animation and masked border from TextField
|
|
384
407
|
}
|
|
@@ -444,7 +467,8 @@ function createTheme() {
|
|
|
444
467
|
},
|
|
445
468
|
MuiListItemButton: {
|
|
446
469
|
defaultProps: {
|
|
447
|
-
component: MuiButtonBase
|
|
470
|
+
component: MuiButtonBase,
|
|
471
|
+
nativeButton: true
|
|
448
472
|
}
|
|
449
473
|
},
|
|
450
474
|
MuiListItemText: {
|
|
@@ -516,7 +540,12 @@ function createTheme() {
|
|
|
516
540
|
},
|
|
517
541
|
MuiPopover: {
|
|
518
542
|
defaultProps: {
|
|
519
|
-
component: Role.div
|
|
543
|
+
component: Role.div,
|
|
544
|
+
slotProps: {
|
|
545
|
+
paper: {
|
|
546
|
+
role: "dialog"
|
|
547
|
+
}
|
|
548
|
+
}
|
|
520
549
|
}
|
|
521
550
|
},
|
|
522
551
|
MuiRadio: {
|
|
@@ -551,7 +580,12 @@ function createTheme() {
|
|
|
551
580
|
},
|
|
552
581
|
MuiSlider: {
|
|
553
582
|
defaultProps: {
|
|
554
|
-
component: Role.span
|
|
583
|
+
component: Role.span,
|
|
584
|
+
slotProps: {
|
|
585
|
+
valueLabel: {
|
|
586
|
+
className: "MuiTooltip-tooltip"
|
|
587
|
+
}
|
|
588
|
+
}
|
|
555
589
|
}
|
|
556
590
|
},
|
|
557
591
|
MuiSnackbar: {
|
|
@@ -575,7 +609,7 @@ function createTheme() {
|
|
|
575
609
|
},
|
|
576
610
|
MuiStep: {
|
|
577
611
|
defaultProps: {
|
|
578
|
-
component: Role.
|
|
612
|
+
component: Role.li
|
|
579
613
|
}
|
|
580
614
|
},
|
|
581
615
|
MuiSwitch: {
|
|
@@ -585,7 +619,11 @@ function createTheme() {
|
|
|
585
619
|
},
|
|
586
620
|
MuiStepper: {
|
|
587
621
|
defaultProps: {
|
|
588
|
-
component: Role.
|
|
622
|
+
component: Role.ol,
|
|
623
|
+
connector: /* @__PURE__ */ jsx(StepConnector, {
|
|
624
|
+
"aria-hidden": "true"
|
|
625
|
+
})
|
|
626
|
+
// hiding the connector to prevent invalid markup
|
|
589
627
|
}
|
|
590
628
|
},
|
|
591
629
|
MuiStepLabel: {
|
|
@@ -622,7 +660,7 @@ function createTheme() {
|
|
|
622
660
|
},
|
|
623
661
|
MuiTableBody: {
|
|
624
662
|
defaultProps: {
|
|
625
|
-
component:
|
|
663
|
+
component: MuiTableBody,
|
|
626
664
|
role: void 0
|
|
627
665
|
// Removing role="rowgroup". See https://github.com/iTwin/stratakit/pull/1361
|
|
628
666
|
}
|
|
@@ -686,7 +724,7 @@ function createTheme() {
|
|
|
686
724
|
},
|
|
687
725
|
MuiToggleButton: {
|
|
688
726
|
defaultProps: {
|
|
689
|
-
component:
|
|
727
|
+
component: MuiToggleButton
|
|
690
728
|
}
|
|
691
729
|
},
|
|
692
730
|
MuiToolbar: {
|
|
@@ -696,28 +734,24 @@ function createTheme() {
|
|
|
696
734
|
},
|
|
697
735
|
MuiTooltip: {
|
|
698
736
|
defaultProps: {
|
|
699
|
-
|
|
737
|
+
placement: "top",
|
|
738
|
+
describeChild: true,
|
|
739
|
+
slotProps: {
|
|
740
|
+
popper: {
|
|
741
|
+
modifiers: [{
|
|
742
|
+
name: "offset",
|
|
743
|
+
options: {
|
|
744
|
+
offset: [0, 2]
|
|
745
|
+
}
|
|
746
|
+
}]
|
|
747
|
+
}
|
|
748
|
+
}
|
|
700
749
|
}
|
|
701
750
|
},
|
|
702
751
|
MuiTypography: {
|
|
703
752
|
defaultProps: {
|
|
704
753
|
variant: "body2",
|
|
705
|
-
|
|
706
|
-
h1: Role.h1,
|
|
707
|
-
h2: Role.h2,
|
|
708
|
-
h3: Role.h3,
|
|
709
|
-
h4: Role.h4,
|
|
710
|
-
h5: Role.h5,
|
|
711
|
-
h6: Role.h6,
|
|
712
|
-
subtitle1: Role.h6,
|
|
713
|
-
subtitle2: Role.h6,
|
|
714
|
-
body1: Role.p,
|
|
715
|
-
body2: Role.p,
|
|
716
|
-
inherit: Role.p,
|
|
717
|
-
button: Role.span,
|
|
718
|
-
caption: Role.span,
|
|
719
|
-
overline: Role.span
|
|
720
|
-
}
|
|
754
|
+
component: MuiTypography
|
|
721
755
|
}
|
|
722
756
|
}
|
|
723
757
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratakit/mui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"design system"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ariakit/react": "^0.4.
|
|
48
|
+
"@ariakit/react": "^0.4.25",
|
|
49
49
|
"@emotion/cache": "^11.14.0",
|
|
50
50
|
"@emotion/react": "^11.14.0",
|
|
51
51
|
"@emotion/styled": "^11.14.1",
|
|
52
|
-
"@stratakit/foundations": "^0.4.
|
|
52
|
+
"@stratakit/foundations": "^0.4.8",
|
|
53
53
|
"@stratakit/icons": "^0.3.1",
|
|
54
54
|
"classnames": "^2.5.1",
|
|
55
55
|
"react-compiler-runtime": "^1.0.0"
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/react": "^19.2.14",
|
|
59
59
|
"@types/react-dom": "^19.2.3",
|
|
60
|
-
"esbuild": "^0.27.
|
|
61
|
-
"react": "^19.2.
|
|
62
|
-
"react-dom": "^19.2.
|
|
60
|
+
"esbuild": "^0.27.7",
|
|
61
|
+
"react": "^19.2.5",
|
|
62
|
+
"react-dom": "^19.2.5",
|
|
63
63
|
"typescript": "~5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@mui/material": "^
|
|
66
|
+
"@mui/material": "^9.0.0",
|
|
67
67
|
"react": ">=18.0.0",
|
|
68
68
|
"react-dom": ">=18.0.0"
|
|
69
69
|
},
|
package/dist/createTheme.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 };
|