@stratakit/mui 0.4.1 → 0.5.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 (41) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/dist/DEV/Root.js +43 -21
  3. package/dist/DEV/styles.css.js +1 -1
  4. package/dist/DEV/~components/MuiAccordion.js +36 -0
  5. package/dist/DEV/~components/MuiAlert.js +37 -0
  6. package/dist/DEV/~components/MuiAutocomplete.js +134 -11
  7. package/dist/DEV/~components/MuiBadge.js +22 -4
  8. package/dist/DEV/~components/MuiCard.js +52 -8
  9. package/dist/DEV/~components/MuiDivider.js +2 -1
  10. package/dist/DEV/~components/MuiMenu.js +22 -0
  11. package/dist/DEV/~components/MuiPopover.js +40 -0
  12. package/dist/DEV/~components/MuiTabs.js +43 -0
  13. package/dist/DEV/~components/MuiTypography.js +16 -13
  14. package/dist/DEV/~createTheme.js +146 -53
  15. package/dist/Root.internal.d.ts +1 -1
  16. package/dist/Root.js +13 -4
  17. package/dist/styles.css.js +1 -1
  18. package/dist/types.d.ts +137 -5
  19. package/dist/~components/MuiAccordion.d.ts +11 -0
  20. package/dist/~components/MuiAccordion.js +30 -0
  21. package/dist/~components/MuiAlert.d.ts +4 -0
  22. package/dist/~components/MuiAlert.js +38 -0
  23. package/dist/~components/MuiAutocomplete.d.ts +4 -1
  24. package/dist/~components/MuiAutocomplete.js +132 -12
  25. package/dist/~components/MuiBadge.d.ts +5 -3
  26. package/dist/~components/MuiBadge.js +22 -4
  27. package/dist/~components/MuiCard.d.ts +2 -1
  28. package/dist/~components/MuiCard.js +66 -11
  29. package/dist/~components/MuiChip.d.ts +1 -1
  30. package/dist/~components/MuiDivider.js +1 -1
  31. package/dist/~components/MuiMenu.d.ts +7 -0
  32. package/dist/~components/MuiMenu.js +25 -0
  33. package/dist/~components/MuiPopover.d.ts +10 -0
  34. package/dist/~components/MuiPopover.js +62 -0
  35. package/dist/~components/MuiTabs.d.ts +8 -0
  36. package/dist/~components/MuiTabs.js +33 -0
  37. package/dist/~components/MuiTypography.d.ts +17 -1
  38. package/dist/~components/MuiTypography.js +13 -12
  39. package/dist/~createTheme.d.ts +4 -1
  40. package/dist/~createTheme.js +153 -70
  41. package/package.json +9 -9
@@ -1,22 +1,142 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react-compiler-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import * as React from "react";
4
+ import * as ReactDOM from "react-dom";
3
5
  import { Role } from "@ariakit/react/role";
4
- import { forwardRef } from "@stratakit/foundations/secret-internals";
6
+ import { ThemeProvider } from "@mui/material/styles";
7
+ import { forwardRef, useEventHandlers, useMergedRefs } from "@stratakit/foundations/secret-internals";
8
+ import { MuiChip, MuiChipDeleteIcon } from "./MuiChip.js";
5
9
  import { MuiInputLabelContext } from "./MuiInputLabel.js";
10
+ const MuiAutocompleteContext = React.createContext(void 0);
6
11
  const MuiAutocomplete = forwardRef((props, forwardedRef) => {
7
12
  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
13
+ const [inputRootRef, setInputRootRef] = React.useState(null);
14
+ return /* @__PURE__ */ jsx(ThemeProvider, {
15
+ theme: (outerTheme) => ({
16
+ ...outerTheme,
17
+ components: {
18
+ ...outerTheme.components,
19
+ MuiTextField: {
20
+ defaultProps: {
21
+ slotProps: {
22
+ input: {
23
+ component: MuiAutocompleteTextFieldInput
24
+ },
25
+ htmlInput: {
26
+ slot: "input"
27
+ // Assign input element to the slot named "input"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }),
34
+ children: /* @__PURE__ */ jsx(MuiAutocompleteContext.Provider, {
35
+ value: {
36
+ inputRootRef,
37
+ setInputRootRef
38
+ },
39
+ children: /* @__PURE__ */ jsx(MuiInputLabelContext.Provider, {
40
+ value: {
41
+ setLabelId
42
+ },
43
+ children: /* @__PURE__ */ jsx(Role.div, {
44
+ role: "group",
45
+ "aria-labelledby": labelId,
46
+ ...props,
47
+ onKeyDown: useEventHandlers((e) => {
48
+ if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
49
+ e.defaultMuiPrevented = true;
50
+ }
51
+ }, props.onKeyDown),
52
+ ref: forwardedRef
53
+ })
54
+ })
17
55
  })
18
56
  });
19
57
  });
58
+ const MuiAutocompleteClearIndicator = forwardRef((props, forwardedRef) => {
59
+ return /* @__PURE__ */ jsx(Role.button, {
60
+ ...props,
61
+ onKeyDown: useEventHandlers(props.onKeyDown, (e) => {
62
+ e.stopPropagation();
63
+ }),
64
+ ref: forwardedRef
65
+ });
66
+ });
67
+ const MuiAutocompleteChip = forwardRef((props, forwardedRef) => {
68
+ return /* @__PURE__ */ jsx(MuiChip, {
69
+ slot: "chips",
70
+ ...props,
71
+ role: "listitem",
72
+ ref: forwardedRef
73
+ });
74
+ });
75
+ const MuiAutocompleteChipDeleteIcon = forwardRef((props, forwardedRef) => {
76
+ const {
77
+ inputRootRef
78
+ } = React.useContext(MuiAutocompleteContext) ?? {};
79
+ return /* @__PURE__ */ jsx(MuiChipDeleteIcon, {
80
+ ...props,
81
+ onKeyDown: useEventHandlers(props.onKeyDown, (e) => {
82
+ e.stopPropagation();
83
+ }),
84
+ onClick: useEventHandlers(props.onClick, () => {
85
+ if (!inputRootRef) return;
86
+ const htmlInput = inputRootRef.getElementsByClassName("MuiAutocomplete-input")[0];
87
+ if (!htmlInput) return;
88
+ htmlInput.focus();
89
+ }),
90
+ ref: forwardedRef
91
+ });
92
+ });
93
+ const MuiAutocompleteTextFieldInput = forwardRef((props, forwardedRef) => {
94
+ const $ = _c(3);
95
+ const {
96
+ setInputRootRef
97
+ } = React.useContext(MuiAutocompleteContext) ?? {};
98
+ const [host, setHost] = React.useState(null);
99
+ const [shadow, setShadow] = React.useState(null);
100
+ let t0;
101
+ let t1;
102
+ if ($[0] !== host) {
103
+ t0 = () => {
104
+ if (!host) {
105
+ return;
106
+ }
107
+ if (!host.shadowRoot) {
108
+ host.attachShadow({
109
+ mode: "open"
110
+ });
111
+ }
112
+ setShadow(host.shadowRoot);
113
+ };
114
+ t1 = [host];
115
+ $[0] = host;
116
+ $[1] = t0;
117
+ $[2] = t1;
118
+ } else {
119
+ t0 = $[1];
120
+ t1 = $[2];
121
+ }
122
+ React.useEffect(t0, t1);
123
+ return jsxs(Fragment, {
124
+ children: [jsx(Role, {
125
+ ...props,
126
+ ref: useMergedRefs(setHost, setInputRootRef, forwardedRef)
127
+ }), shadow && ReactDOM.createPortal(jsxs(Fragment, {
128
+ children: [jsx("slot", {
129
+ name: "input"
130
+ }), jsx("slot", {
131
+ role: "list",
132
+ name: "chips"
133
+ }), jsx("slot", {}), " "]
134
+ }), shadow)]
135
+ });
136
+ });
20
137
  export {
21
- MuiAutocomplete
138
+ MuiAutocomplete,
139
+ MuiAutocompleteChip,
140
+ MuiAutocompleteChipDeleteIcon,
141
+ MuiAutocompleteClearIndicator
22
142
  };
@@ -1,7 +1,9 @@
1
- import { type BaseProps } from "@stratakit/foundations/secret-internals";
1
+ import * as React from "react";
2
2
  import type Badge from "@mui/material/Badge";
3
+ import type { BaseProps } from "@stratakit/foundations/secret-internals";
3
4
  type BadgeProps = React.ComponentProps<typeof Badge>;
4
5
  interface MuiBadgeProps extends BaseProps<"span">, Pick<BadgeProps, "inline"> {
5
6
  }
6
- declare const MuiBadge: import("react").ForwardRefExoticComponent<MuiBadgeProps & import("react").RefAttributes<HTMLElement | HTMLSpanElement>>;
7
- export { MuiBadge };
7
+ declare const MuiBadge: React.ForwardRefExoticComponent<MuiBadgeProps & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
8
+ declare const MuiBadgeBadge: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
9
+ export { MuiBadge, MuiBadgeBadge };
@@ -1,17 +1,35 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
2
3
  import { Role } from "@ariakit/react/role";
3
- import { forwardRef } from "@stratakit/foundations/secret-internals";
4
+ import { forwardRef, useSafeContext } from "@stratakit/foundations/secret-internals";
5
+ const MuiBadgeContext = React.createContext(void 0);
4
6
  const MuiBadge = forwardRef((props, forwardedRef) => {
5
7
  const {
6
8
  inline,
7
9
  ...rest
8
10
  } = props;
11
+ return /* @__PURE__ */ jsx(MuiBadgeContext.Provider, {
12
+ value: {
13
+ inline
14
+ },
15
+ children: /* @__PURE__ */ jsx(Role.span, {
16
+ ...rest,
17
+ "data-_sk-inline": inline ? "" : void 0,
18
+ ref: forwardedRef
19
+ })
20
+ });
21
+ });
22
+ const MuiBadgeBadge = forwardRef((props, forwardedRef) => {
23
+ const {
24
+ inline
25
+ } = useSafeContext(MuiBadgeContext);
9
26
  return /* @__PURE__ */ jsx(Role.span, {
10
- ...rest,
11
- "data-_sk-inline": inline ? "" : void 0,
27
+ ...props,
28
+ "aria-hidden": inline ? void 0 : props["aria-hidden"],
12
29
  ref: forwardedRef
13
30
  });
14
31
  });
15
32
  export {
16
- MuiBadge
33
+ MuiBadge,
34
+ MuiBadgeBadge
17
35
  };
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  declare const MuiCard: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "render"> & React.RefAttributes<HTMLElement>>;
3
+ declare const MuiCardHeaderTitle: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLHeadingElement>>;
3
4
  declare const MuiCardActionArea: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
4
5
  declare const MuiCardMedia: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLDivElement>>;
5
- export { MuiCard, MuiCardActionArea, MuiCardMedia };
6
+ export { MuiCard, MuiCardActionArea, MuiCardHeaderTitle, MuiCardMedia };
@@ -1,15 +1,12 @@
1
1
  import { c as _c } from "react-compiler-runtime";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
+ import * as ReactDOM from "react-dom";
4
5
  import { Role } from "@ariakit/react/role";
5
6
  import { forwardRef, useEventHandlers, useMergedRefs } from "@stratakit/foundations/secret-internals";
6
7
  import { MuiButtonBase } from "./MuiButtonBase.js";
7
8
  const MuiCardContext = React.createContext(void 0);
8
9
  const MuiCard = forwardRef((props, forwardedRef) => {
9
- const {
10
- role,
11
- ...rest
12
- } = props;
13
10
  const [actionAreaElement, setActionAreaElement] = React.useState(void 0);
14
11
  const handleActionAreaClick = (event) => {
15
12
  if (!actionAreaElement) return;
@@ -26,24 +23,81 @@ const MuiCard = forwardRef((props, forwardedRef) => {
26
23
  },
27
24
  children: /* @__PURE__ */ jsx(Role, {
28
25
  render: /* @__PURE__ */ jsx("article", {}),
29
- ...rest,
26
+ ...props,
30
27
  "data-_sk-actionable": actionAreaElement ? "" : void 0,
31
28
  onClick: useEventHandlers(props.onClick, handleActionAreaClick),
32
29
  ref: forwardedRef
33
30
  })
34
31
  });
35
32
  });
36
- const MuiCardActionArea = forwardRef((props, forwardedRef) => {
33
+ const MuiCardHeaderTitle = forwardRef((props, forwardedRef) => {
34
+ const cardContext = React.useContext(MuiCardContext);
35
+ const cardActionAreaContext = React.useContext(MuiCardActionAreaContext);
37
36
  const {
38
- role,
37
+ children,
39
38
  ...rest
40
39
  } = props;
41
- const context = React.useContext(MuiCardContext);
42
- return jsx(MuiButtonBase, {
40
+ const t0 = useMergedRefs(cardActionAreaContext?.setTitleElement, forwardedRef);
41
+ let t1;
42
+ bb0: {
43
+ if (cardActionAreaContext) {
44
+ t1 = cardContext?.actionAreaElement ? ReactDOM.createPortal(children, cardContext.actionAreaElement) : null;
45
+ break bb0;
46
+ }
47
+ t1 = children;
48
+ }
49
+ return jsx(Role.h2, {
43
50
  ...rest,
44
- ref: useMergedRefs(context?.setActionAreaElement, forwardedRef)
51
+ ref: t0,
52
+ children: t1
53
+ });
54
+ });
55
+ const MuiCardActionAreaContext = React.createContext(void 0);
56
+ const MuiCardActionArea = forwardRef((props, forwardedRef) => {
57
+ const {
58
+ children,
59
+ ...rest
60
+ } = props;
61
+ const [titleElement, setTitleElement] = React.useState(void 0);
62
+ return /* @__PURE__ */ jsx(MuiCardActionAreaContext.Provider, {
63
+ value: {
64
+ setTitleElement
65
+ },
66
+ children: (() => {
67
+ if (titleElement) {
68
+ return /* @__PURE__ */ jsxs(Fragment, {
69
+ children: [children, ReactDOM.createPortal(/* @__PURE__ */ jsx(MuiCardActionAreaButton, {
70
+ ...rest,
71
+ ref: forwardedRef
72
+ }), titleElement)]
73
+ });
74
+ }
75
+ return /* @__PURE__ */ jsx(MuiCardActionAreaButton, {
76
+ ...rest,
77
+ ref: forwardedRef,
78
+ children
79
+ });
80
+ })()
45
81
  });
46
82
  });
83
+ const MuiCardActionAreaButton = forwardRef((props, forwardedRef) => {
84
+ const $ = _c(3);
85
+ const cardContext = React.useContext(MuiCardContext);
86
+ const t0 = useMergedRefs(cardContext?.setActionAreaElement, forwardedRef);
87
+ let t1;
88
+ if ($[0] !== props || $[1] !== t0) {
89
+ t1 = jsx(MuiButtonBase, {
90
+ ...props,
91
+ ref: t0
92
+ });
93
+ $[0] = props;
94
+ $[1] = t0;
95
+ $[2] = t1;
96
+ } else {
97
+ t1 = $[2];
98
+ }
99
+ return t1;
100
+ });
47
101
  const MEDIA_COMPONENTS = ["audio", "iframe", "img", "picture", "video"];
48
102
  function extractBackgroundImageUrl(style) {
49
103
  const backgroundImage = style?.backgroundImage;
@@ -108,5 +162,6 @@ const MuiCardMedia = forwardRef((props, forwardedRef) => {
108
162
  export {
109
163
  MuiCard,
110
164
  MuiCardActionArea,
165
+ MuiCardHeaderTitle,
111
166
  MuiCardMedia
112
167
  };
@@ -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, 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>>;
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, "type" | "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" | "type" | "tabIndex" | "children" | "render" | "label" | "classes" | "sx" | "component" | "disabled" | "disableFocusRipple" | "loading" | "loadingIndicator" | "size" | "LinkComponent" | "nativeButton" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "edge" | "labelPlacement">, "ref"> & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
10
10
  export { MuiChip, MuiChipDeleteIcon, MuiChipLabel };
@@ -7,7 +7,7 @@ const MuiDivider = forwardRef((props, forwardedRef) => {
7
7
  ...rest
8
8
  } = props;
9
9
  const defaultRender = (() => {
10
- if (children || props["aria-orientation"] === "vertical") return /* @__PURE__ */ jsx("div", {});
10
+ if (children || props["aria-orientation"] === "vertical" || props.role === "presentation") return /* @__PURE__ */ jsx("div", {});
11
11
  return /* @__PURE__ */ jsx("hr", {});
12
12
  })();
13
13
  return /* @__PURE__ */ jsx(Role, {
@@ -0,0 +1,7 @@
1
+ import type { MenuOwnerState } from "@mui/material/Menu";
2
+ import type { MenuListProps } from "@mui/material/MenuList";
3
+ interface MuiMenuListSlotProps extends MenuListProps {
4
+ ownerState?: Pick<MenuOwnerState, "anchorEl">;
5
+ }
6
+ declare const MuiMenuListSlot: import("react").ForwardRefExoticComponent<Omit<MuiMenuListSlotProps, "ref"> & import("react").RefAttributes<HTMLElement | HTMLUListElement>>;
7
+ export { MuiMenuListSlot };
@@ -0,0 +1,25 @@
1
+ import { c as _c } from "react-compiler-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import MenuList from "@mui/material/MenuList";
4
+ import { forwardRef, useMergedRefs } from "@stratakit/foundations/secret-internals";
5
+ import { useFallbackLabel } from "./MuiPopover.js";
6
+ const MuiMenuListSlot = forwardRef((props, forwardedRef) => {
7
+ const $ = _c(3);
8
+ const t0 = useMergedRefs(forwardedRef, useFallbackLabel(props));
9
+ let t1;
10
+ if ($[0] !== props || $[1] !== t0) {
11
+ t1 = jsx(MenuList, {
12
+ ...props,
13
+ ref: t0
14
+ });
15
+ $[0] = props;
16
+ $[1] = t0;
17
+ $[2] = t1;
18
+ } else {
19
+ t1 = $[2];
20
+ }
21
+ return t1;
22
+ });
23
+ export {
24
+ MuiMenuListSlot
25
+ };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import type { PopoverOwnerState } from "@mui/material/Popover";
3
+ import type { BaseProps } from "@stratakit/foundations/secret-internals";
4
+ /** Returns a callback ref that sets a fallback value for `ariaLabelledByElements` using `ownerState.anchorEl`. */
5
+ export declare function useFallbackLabel(props: Pick<MuiPopoverPaperSlotProps, "aria-label" | "aria-labelledby" | "ownerState">): (element?: HTMLElement) => void;
6
+ interface MuiPopoverPaperSlotProps extends BaseProps {
7
+ ownerState?: Pick<PopoverOwnerState, "anchorEl">;
8
+ }
9
+ declare const MuiPopoverPaperSlot: React.ForwardRefExoticComponent<MuiPopoverPaperSlotProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
10
+ export { MuiPopoverPaperSlot };
@@ -0,0 +1,62 @@
1
+ import { c as _c } from "react-compiler-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { PopoverPaper } from "@mui/material/Popover";
5
+ import { forwardRef, useMergedRefs } from "@stratakit/foundations/secret-internals";
6
+ function useFallbackLabel(props) {
7
+ const $ = _c(6);
8
+ const {
9
+ "aria-label": ariaLabel,
10
+ "aria-labelledby": ariaLabelledBy,
11
+ ownerState: t0
12
+ } = props;
13
+ let t1;
14
+ if ($[0] !== t0) {
15
+ t1 = t0 === void 0 ? {} : t0;
16
+ $[0] = t0;
17
+ $[1] = t1;
18
+ } else {
19
+ t1 = $[1];
20
+ }
21
+ const ownerState = t1;
22
+ let t2;
23
+ if ($[2] !== ariaLabel || $[3] !== ariaLabelledBy || $[4] !== ownerState.anchorEl) {
24
+ t2 = (element) => {
25
+ if (!element || !(ownerState.anchorEl instanceof HTMLElement)) {
26
+ return;
27
+ }
28
+ if (ariaLabel || ariaLabelledBy || element.ariaLabel || element.ariaLabelledByElements?.length) {
29
+ return;
30
+ }
31
+ element.ariaLabelledByElements = [ownerState.anchorEl];
32
+ };
33
+ $[2] = ariaLabel;
34
+ $[3] = ariaLabelledBy;
35
+ $[4] = ownerState.anchorEl;
36
+ $[5] = t2;
37
+ } else {
38
+ t2 = $[5];
39
+ }
40
+ return t2;
41
+ }
42
+ const MuiPopoverPaperSlot = forwardRef((props, forwardedRef) => {
43
+ const $ = _c(3);
44
+ const t0 = useMergedRefs(forwardedRef, useFallbackLabel(props));
45
+ let t1;
46
+ if ($[0] !== props || $[1] !== t0) {
47
+ t1 = jsx(PopoverPaper, {
48
+ ...props,
49
+ ref: t0
50
+ });
51
+ $[0] = props;
52
+ $[1] = t0;
53
+ $[2] = t1;
54
+ } else {
55
+ t1 = $[2];
56
+ }
57
+ return t1;
58
+ });
59
+ export {
60
+ MuiPopoverPaperSlot,
61
+ useFallbackLabel
62
+ };
@@ -0,0 +1,8 @@
1
+ import { type BaseProps } from "@stratakit/foundations/secret-internals";
2
+ import type Tabs from "@mui/material/Tabs";
3
+ type TabsProps = React.ComponentProps<typeof Tabs>;
4
+ interface MuiTabsProps extends BaseProps<"div">, Pick<TabsProps, "size"> {
5
+ }
6
+ declare const MuiTabs: import("react").ForwardRefExoticComponent<MuiTabsProps & import("react").RefAttributes<HTMLElement | HTMLDivElement>>;
7
+ declare const MuiTab: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "render"> & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
8
+ export { MuiTab, MuiTabs };
@@ -0,0 +1,33 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Role } from "@ariakit/react/role";
3
+ import useMediaQuery from "@mui/material/useMediaQuery";
4
+ import { forwardRef, useEventHandlers } from "@stratakit/foundations/secret-internals";
5
+ const MuiTabs = forwardRef((props, forwardedRef) => {
6
+ const {
7
+ size = "medium",
8
+ ...rest
9
+ } = props;
10
+ return /* @__PURE__ */ jsx(Role.div, {
11
+ ...rest,
12
+ "data-_sk-size": size !== "medium" ? size : void 0,
13
+ ref: forwardedRef
14
+ });
15
+ });
16
+ const MuiTab = forwardRef((props, forwardedRef) => {
17
+ const motionOk = useMediaQuery("(prefers-reduced-motion: no-preference)");
18
+ return /* @__PURE__ */ jsx(Role.button, {
19
+ ...props,
20
+ onFocus: useEventHandlers(props.onFocus, (event) => {
21
+ event?.currentTarget?.scrollIntoView({
22
+ block: "nearest",
23
+ inline: "nearest",
24
+ behavior: motionOk ? "smooth" : "auto"
25
+ });
26
+ }),
27
+ ref: forwardedRef
28
+ });
29
+ });
30
+ export {
31
+ MuiTab,
32
+ MuiTabs
33
+ };
@@ -1,2 +1,18 @@
1
+ declare const variantMapping: {
2
+ h1: string;
3
+ h2: string;
4
+ h3: string;
5
+ h4: string;
6
+ h5: string;
7
+ h6: string;
8
+ subtitle1: string;
9
+ subtitle2: string;
10
+ body1: string;
11
+ body2: string;
12
+ inherit: string;
13
+ button: string;
14
+ caption: string;
15
+ overline: string;
16
+ };
1
17
  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 };
18
+ export { MuiTypography, variantMapping };
@@ -4,12 +4,12 @@ import { forwardRef } from "@stratakit/foundations/secret-internals";
4
4
  const variantMapping = {
5
5
  h1: "h1",
6
6
  h2: "h2",
7
- h3: "h3",
8
- h4: "h4",
9
- h5: "h5",
10
- h6: "h6",
11
- subtitle1: "h6",
12
- subtitle2: "h6",
7
+ h3: "h2",
8
+ h4: "h2",
9
+ h5: "h2",
10
+ h6: "h2",
11
+ subtitle1: "h2",
12
+ subtitle2: "h2",
13
13
  body1: "p",
14
14
  body2: "p",
15
15
  inherit: "p",
@@ -17,16 +17,16 @@ const variantMapping = {
17
17
  caption: "span",
18
18
  overline: "span"
19
19
  };
20
- const variants = Object.keys(variantMapping);
20
+ const muiVariants = Object.keys(variantMapping);
21
21
  const headings = ["h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2"];
22
22
  const MuiTypography = forwardRef((props, forwardedRef) => {
23
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";
24
+ const muiVariant = (() => {
25
+ const variant = muiVariants.find((name) => classList?.includes(`MuiTypography-${name}`));
26
+ return variant || "body2";
27
27
  })();
28
28
  const render = (() => {
29
- const Element = variantMapping[variant] || "p";
29
+ const Element = muiVariant in variantMapping ? variantMapping[muiVariant] : "p";
30
30
  return /* @__PURE__ */ jsx(Element, {});
31
31
  })();
32
32
  return /* @__PURE__ */ jsx(Role, {
@@ -36,5 +36,6 @@ const MuiTypography = forwardRef((props, forwardedRef) => {
36
36
  });
37
37
  });
38
38
  export {
39
- MuiTypography
39
+ MuiTypography,
40
+ variantMapping
40
41
  };
@@ -1,3 +1,6 @@
1
+ interface CreateThemeArgs {
2
+ portalContainer?: HTMLElement | null;
3
+ }
1
4
  /** Creates a StrataKit theme for MUI. Should be used with MUI's `ThemeProvider`. */
2
- declare function createTheme(): import("@mui/material/styles").Theme;
5
+ declare function createTheme(args: CreateThemeArgs): import("@mui/material/styles").Theme;
3
6
  export { createTheme };