@stratakit/mui 0.2.1 → 0.3.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +126 -24
  2. package/README.md +8 -4
  3. package/dist/DEV/Icon.js +6 -0
  4. package/dist/DEV/Root.internal.js +57 -0
  5. package/dist/DEV/Root.js +30 -35
  6. package/dist/DEV/createTheme.js +266 -15
  7. package/dist/DEV/styles.css.js +2 -2
  8. package/dist/DEV/~components/MuiBadge.js +20 -0
  9. package/dist/DEV/~components/MuiBottomNavigation.js +23 -0
  10. package/dist/DEV/~components/MuiButtonBase.js +53 -0
  11. package/dist/DEV/~components/MuiCard.js +102 -0
  12. package/dist/DEV/~components/MuiChip.js +84 -0
  13. package/dist/DEV/~components/MuiDivider.js +15 -0
  14. package/dist/DEV/~components/MuiIconButton.js +17 -0
  15. package/dist/DEV/~components/MuiSnackbar.js +12 -0
  16. package/dist/DEV/~components/MuiStepper.js +21 -0
  17. package/dist/DEV/~components/MuiTable.js +23 -0
  18. package/dist/Icon.d.ts +3 -1
  19. package/dist/Icon.js +6 -0
  20. package/dist/Root.d.ts +4 -2
  21. package/dist/Root.internal.d.ts +3 -0
  22. package/dist/Root.internal.js +77 -0
  23. package/dist/Root.js +9 -7
  24. package/dist/createTheme.js +516 -9
  25. package/dist/styles.css.js +2 -2
  26. package/dist/types.d.ts +161 -2
  27. package/dist/~components/MuiBadge.d.ts +7 -0
  28. package/dist/~components/MuiBadge.js +17 -0
  29. package/dist/~components/MuiBottomNavigation.d.ts +2 -0
  30. package/dist/~components/MuiBottomNavigation.js +23 -0
  31. package/dist/~components/MuiButtonBase.d.ts +7 -0
  32. package/dist/~components/MuiButtonBase.js +80 -0
  33. package/dist/~components/MuiCard.d.ts +5 -0
  34. package/dist/~components/MuiCard.js +112 -0
  35. package/dist/~components/MuiChip.d.ts +10 -0
  36. package/dist/~components/MuiChip.js +83 -0
  37. package/dist/~components/MuiDivider.d.ts +6 -0
  38. package/dist/~components/MuiDivider.js +22 -0
  39. package/dist/~components/MuiIconButton.d.ts +6 -0
  40. package/dist/~components/MuiIconButton.js +27 -0
  41. package/dist/~components/MuiSnackbar.d.ts +2 -0
  42. package/dist/~components/MuiSnackbar.js +12 -0
  43. package/dist/~components/MuiStepper.d.ts +2 -0
  44. package/dist/~components/MuiStepper.js +26 -0
  45. package/dist/~components/MuiTable.d.ts +4 -0
  46. package/dist/~components/MuiTable.js +28 -0
  47. package/package.json +13 -9
@@ -0,0 +1,102 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Role } from "@ariakit/react/role";
4
+ import {
5
+ forwardRef,
6
+ useEventHandlers,
7
+ useMergedRefs
8
+ } from "@stratakit/foundations/secret-internals";
9
+ import { MuiButtonBase } from "./MuiButtonBase.js";
10
+ const MuiCardContext = React.createContext(void 0);
11
+ const MuiCard = forwardRef(
12
+ (props, forwardedRef) => {
13
+ const { role, ...rest } = props;
14
+ const [actionAreaElement, setActionAreaElement] = React.useState(void 0);
15
+ const handleActionAreaClick = (event) => {
16
+ if (!actionAreaElement) return;
17
+ if (!(event.target instanceof Element)) return;
18
+ if (event.target.closest("a, button, [role=button]")) return;
19
+ const selection = window.getSelection();
20
+ if (selection && !selection.isCollapsed) return;
21
+ actionAreaElement.click();
22
+ };
23
+ return /* @__PURE__ */ jsx(
24
+ MuiCardContext.Provider,
25
+ {
26
+ value: { actionAreaElement, setActionAreaElement },
27
+ children: /* @__PURE__ */ jsx(
28
+ Role,
29
+ {
30
+ render: /* @__PURE__ */ jsx("article", {}),
31
+ ...rest,
32
+ "data-_sk-actionable": actionAreaElement ? "" : void 0,
33
+ onClick: useEventHandlers(props.onClick, handleActionAreaClick),
34
+ ref: forwardedRef
35
+ }
36
+ )
37
+ }
38
+ );
39
+ }
40
+ );
41
+ DEV: MuiCard.displayName = "MuiCard";
42
+ const MuiCardActionArea = forwardRef(
43
+ (props, forwardedRef) => {
44
+ const { role, ...rest } = props;
45
+ const context = React.useContext(MuiCardContext);
46
+ return /* @__PURE__ */ jsx(
47
+ MuiButtonBase,
48
+ {
49
+ ...rest,
50
+ ref: useMergedRefs(context?.setActionAreaElement, forwardedRef)
51
+ }
52
+ );
53
+ }
54
+ );
55
+ DEV: MuiCardActionArea.displayName = "MuiCardActionArea";
56
+ const MEDIA_COMPONENTS = ["audio", "iframe", "img", "picture", "video"];
57
+ function extractBackgroundImageUrl(style) {
58
+ const backgroundImage = style?.backgroundImage;
59
+ if (!backgroundImage?.startsWith("url(")) return void 0;
60
+ if (!['"', "'"].includes(backgroundImage[4])) return void 0;
61
+ return backgroundImage.slice(5, -2);
62
+ }
63
+ const MuiCardMedia = forwardRef(
64
+ (props, forwardedRef) => {
65
+ const [tagName, setTagName] = React.useState(void 0);
66
+ const determineTagName = React.useCallback(
67
+ (element) => {
68
+ if (!element) return;
69
+ setTagName(element.tagName.toLowerCase());
70
+ },
71
+ []
72
+ );
73
+ const isMediaComponent = MEDIA_COMPONENTS.includes(tagName ?? "");
74
+ const src = isMediaComponent ? extractBackgroundImageUrl(props.style) : void 0;
75
+ const style = (() => {
76
+ if (!isMediaComponent) return props.style;
77
+ const { backgroundImage, ...restStyle } = props.style ?? {};
78
+ return restStyle;
79
+ })();
80
+ const role = (() => {
81
+ if (!isMediaComponent) return props.role;
82
+ if (props.role === "img") return void 0;
83
+ return props.role;
84
+ })();
85
+ return /* @__PURE__ */ jsx(
86
+ Role.div,
87
+ {
88
+ ...props,
89
+ ...src ? { src } : {},
90
+ role,
91
+ style,
92
+ ref: useMergedRefs(determineTagName, forwardedRef)
93
+ }
94
+ );
95
+ }
96
+ );
97
+ DEV: MuiCardMedia.displayName = "MuiCardMedia";
98
+ export {
99
+ MuiCard,
100
+ MuiCardActionArea,
101
+ MuiCardMedia
102
+ };
@@ -0,0 +1,84 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Role } from "@ariakit/react/role";
4
+ import { VisuallyHidden } from "@ariakit/react/visually-hidden";
5
+ import IconButton from "@mui/material/IconButton";
6
+ import { useTheme } from "@mui/material/styles";
7
+ import { forwardRef } from "@stratakit/foundations/secret-internals";
8
+ import { DismissCircleIcon } from "../Icon.js";
9
+ import { MuiButtonBase } from "./MuiButtonBase.js";
10
+ const MuiChipContext = React.createContext(void 0);
11
+ const MuiChip = forwardRef((props, forwardedRef) => {
12
+ const { role, deleteLabel, ...rest } = props;
13
+ const clearId = React.useId();
14
+ const [labelId, setLabelId] = React.useState(void 0);
15
+ const isClickable = props.className?.includes("MuiChip-clickable") ?? false;
16
+ return /* @__PURE__ */ jsx(
17
+ MuiChipContext.Provider,
18
+ {
19
+ value: { labelId, setLabelId, clearId, isClickable, deleteLabel },
20
+ children: /* @__PURE__ */ jsx(
21
+ Role.div,
22
+ {
23
+ ...rest,
24
+ role: role === "button" ? void 0 : role,
25
+ tabIndex: void 0,
26
+ ref: forwardedRef
27
+ }
28
+ )
29
+ }
30
+ );
31
+ });
32
+ DEV: MuiChip.displayName = "MuiChip";
33
+ const MuiChipLabel = forwardRef(
34
+ (props, forwardedRef) => {
35
+ const defaultId = React.useId();
36
+ const { id = defaultId, ...rest } = props;
37
+ const { setLabelId, isClickable } = React.useContext(MuiChipContext) ?? {};
38
+ React.useEffect(() => {
39
+ if (!setLabelId) return;
40
+ setLabelId(id);
41
+ return () => {
42
+ setLabelId(void 0);
43
+ };
44
+ }, [id, setLabelId]);
45
+ const Component = isClickable ? MuiButtonBase : Role.span;
46
+ return /* @__PURE__ */ jsx(
47
+ Component,
48
+ {
49
+ id,
50
+ ...rest,
51
+ ref: forwardedRef
52
+ }
53
+ );
54
+ }
55
+ );
56
+ DEV: MuiChipLabel.displayName = "MuiChipLabel";
57
+ const MuiChipDeleteIcon = forwardRef((props, forwardedRef) => {
58
+ const theme = useTheme();
59
+ const defaultLabel = theme.components?.MuiAutocomplete?.defaultProps?.clearText ?? "Clear";
60
+ const {
61
+ clearId,
62
+ labelId,
63
+ deleteLabel = defaultLabel
64
+ } = React.useContext(MuiChipContext) ?? {};
65
+ return /* @__PURE__ */ jsxs(
66
+ IconButton,
67
+ {
68
+ "aria-labelledby": `${clearId} ${labelId}`,
69
+ size: "small",
70
+ ...props,
71
+ ref: forwardedRef,
72
+ children: [
73
+ /* @__PURE__ */ jsx(VisuallyHidden, { id: clearId, children: deleteLabel }),
74
+ /* @__PURE__ */ jsx(DismissCircleIcon, {})
75
+ ]
76
+ }
77
+ );
78
+ });
79
+ DEV: MuiChipDeleteIcon.displayName = "MuiChipDeleteIcon";
80
+ export {
81
+ MuiChip,
82
+ MuiChipDeleteIcon,
83
+ MuiChipLabel
84
+ };
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Role } from "@ariakit/react/role";
3
+ import { forwardRef } from "@stratakit/foundations/secret-internals";
4
+ const MuiDivider = forwardRef((props, forwardedRef) => {
5
+ const { children, ...rest } = props;
6
+ const defaultRender = (() => {
7
+ if (children || props["aria-orientation"] === "vertical") return /* @__PURE__ */ jsx("div", {});
8
+ return /* @__PURE__ */ jsx("hr", {});
9
+ })();
10
+ return /* @__PURE__ */ jsx(Role, { render: defaultRender, ...rest, ref: forwardedRef, children });
11
+ });
12
+ DEV: MuiDivider.displayName = "MuiDivider";
13
+ export {
14
+ MuiDivider
15
+ };
@@ -0,0 +1,17 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import Tooltip from "@mui/material/Tooltip";
3
+ import { forwardRef } from "@stratakit/foundations/secret-internals";
4
+ import { MuiButtonBase } from "./MuiButtonBase.js";
5
+ const MuiIconButton = forwardRef(
6
+ (props, forwardedRef) => {
7
+ const { label, ...rest } = props;
8
+ if (label) {
9
+ return /* @__PURE__ */ jsx(Tooltip, { title: label, describeChild: false, children: /* @__PURE__ */ jsx(MuiButtonBase, { ...rest, ref: forwardedRef }) });
10
+ }
11
+ return /* @__PURE__ */ jsx(MuiButtonBase, { ...rest, ref: forwardedRef });
12
+ }
13
+ );
14
+ DEV: MuiIconButton.displayName = "MuiIconButton";
15
+ export {
16
+ MuiIconButton
17
+ };
@@ -0,0 +1,12 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Portal } from "@ariakit/react/portal";
3
+ import { forwardRef } from "@stratakit/foundations/secret-internals";
4
+ const MuiSnackbar = forwardRef(
5
+ (props, forwardedRef) => {
6
+ return /* @__PURE__ */ jsx(Portal, { ...props, ref: forwardedRef });
7
+ }
8
+ );
9
+ DEV: MuiSnackbar.displayName = "MuiSnackbar";
10
+ export {
11
+ MuiSnackbar
12
+ };
@@ -0,0 +1,21 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Role } from "@ariakit/react/role";
3
+ import { forwardRef } from "@stratakit/foundations/secret-internals";
4
+ import { CheckmarkIcon, ErrorIcon } from "../Icon.js";
5
+ const MuiStepIcon = forwardRef(
6
+ (props, forwardedRef) => {
7
+ const { children: _, ...rest } = props;
8
+ const classList = props.className?.split(" ") ?? [];
9
+ const completed = classList.includes("Mui-completed");
10
+ const error = classList.includes("Mui-error");
11
+ const children = (() => {
12
+ if (error) return /* @__PURE__ */ jsx(ErrorIcon, {});
13
+ if (completed) return /* @__PURE__ */ jsx(CheckmarkIcon, {});
14
+ })();
15
+ return /* @__PURE__ */ jsx(Role.span, { "aria-hidden": "true", ...rest, ref: forwardedRef, children });
16
+ }
17
+ );
18
+ DEV: MuiStepIcon.displayName = "MuiStepIcon";
19
+ export {
20
+ MuiStepIcon
21
+ };
@@ -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 MuiTableHeadContext = React.createContext(false);
6
+ const MuiTableHead = forwardRef(
7
+ (props, forwardedRef) => {
8
+ return /* @__PURE__ */ jsx(MuiTableHeadContext.Provider, { value: true, children: /* @__PURE__ */ jsx(Role, { render: /* @__PURE__ */ jsx("thead", {}), ...props, ref: forwardedRef }) });
9
+ }
10
+ );
11
+ DEV: MuiTableHead.displayName = "MuiTableHead";
12
+ const MuiTableCell = forwardRef(
13
+ (props, forwardedRef) => {
14
+ const inHeader = React.useContext(MuiTableHeadContext);
15
+ const Component = inHeader ? "th" : "td";
16
+ return /* @__PURE__ */ jsx(Role, { render: /* @__PURE__ */ jsx(Component, {}), ...props, ref: forwardedRef });
17
+ }
18
+ );
19
+ DEV: MuiTableCell.displayName = "MuiTableCell";
20
+ export {
21
+ MuiTableCell,
22
+ MuiTableHead
23
+ };
package/dist/Icon.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { Icon } from "@stratakit/foundations";
3
3
  declare const ArrowDownIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
4
+ declare const CheckmarkIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
4
5
  declare const CaretsUpDownIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
5
6
  declare const ChevronDownIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
6
7
  declare const ChevronLeftIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
@@ -8,8 +9,9 @@ declare const ChevronLeftDoubleIcon: React.ForwardRefExoticComponent<Omit<React.
8
9
  declare const ChevronRightIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
9
10
  declare const ChevronRightDoubleIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
10
11
  declare const DismissIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
12
+ declare const DismissCircleIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
11
13
  declare const ErrorIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
12
14
  declare const InfoIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
13
15
  declare const SuccessIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
14
16
  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, };
17
+ export { Icon, ArrowDownIcon, CheckmarkIcon, CaretsUpDownIcon, ChevronDownIcon, ChevronLeftIcon, ChevronLeftDoubleIcon, ChevronRightIcon, ChevronRightDoubleIcon, DismissIcon, DismissCircleIcon, InfoIcon, SuccessIcon, WarningIcon, ErrorIcon, };
package/dist/Icon.js CHANGED
@@ -3,12 +3,14 @@ import * as React from "react";
3
3
  import { Icon } from "@stratakit/foundations";
4
4
  import svgArrowDown from "@stratakit/icons/arrow-down.svg";
5
5
  import svgCaretsUpDown from "@stratakit/icons/carets-up-down.svg";
6
+ import svgCheckmark from "@stratakit/icons/checkmark.svg";
6
7
  import svgChevronDown from "@stratakit/icons/chevron-down.svg";
7
8
  import svgChevronLeft from "@stratakit/icons/chevron-left.svg";
8
9
  import svgChevronLeftDouble from "@stratakit/icons/chevron-left-double.svg";
9
10
  import svgChevronRight from "@stratakit/icons/chevron-right.svg";
10
11
  import svgChevronRightDouble from "@stratakit/icons/chevron-right-double.svg";
11
12
  import svgDismiss from "@stratakit/icons/dismiss.svg";
13
+ import svgDismissCircle from "@stratakit/icons/dismiss-circle.svg";
12
14
  import svgError from "@stratakit/icons/error.svg";
13
15
  import svgInfo from "@stratakit/icons/info.svg";
14
16
  import svgStatusSuccess from "@stratakit/icons/status-success.svg";
@@ -23,6 +25,7 @@ function createIconComponent(href) {
23
25
  });
24
26
  }
25
27
  const ArrowDownIcon = createIconComponent(svgArrowDown);
28
+ const CheckmarkIcon = createIconComponent(svgCheckmark);
26
29
  const CaretsUpDownIcon = createIconComponent(svgCaretsUpDown);
27
30
  const ChevronDownIcon = createIconComponent(svgChevronDown);
28
31
  const ChevronLeftIcon = createIconComponent(svgChevronLeft);
@@ -30,6 +33,7 @@ const ChevronLeftDoubleIcon = createIconComponent(svgChevronLeftDouble);
30
33
  const ChevronRightIcon = createIconComponent(svgChevronRight);
31
34
  const ChevronRightDoubleIcon = createIconComponent(svgChevronRightDouble);
32
35
  const DismissIcon = createIconComponent(svgDismiss);
36
+ const DismissCircleIcon = createIconComponent(svgDismissCircle);
33
37
  const ErrorIcon = createIconComponent(svgError);
34
38
  const InfoIcon = createIconComponent(svgInfo);
35
39
  const SuccessIcon = createIconComponent(svgStatusSuccess);
@@ -37,11 +41,13 @@ const WarningIcon = createIconComponent(svgWarning);
37
41
  export {
38
42
  ArrowDownIcon,
39
43
  CaretsUpDownIcon,
44
+ CheckmarkIcon,
40
45
  ChevronDownIcon,
41
46
  ChevronLeftDoubleIcon,
42
47
  ChevronLeftIcon,
43
48
  ChevronRightDoubleIcon,
44
49
  ChevronRightIcon,
50
+ DismissCircleIcon,
45
51
  DismissIcon,
46
52
  ErrorIcon,
47
53
  Icon,
package/dist/Root.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as React from "react";
2
- interface RootProps extends React.ComponentPropsWithoutRef<"div"> {
2
+ import { Root as StrataKitRoot } from "@stratakit/foundations";
3
+ import type { BaseProps } from "@stratakit/foundations/secret-internals";
4
+ interface RootProps extends BaseProps<"div">, Pick<React.ComponentProps<typeof StrataKitRoot>, "rootNode"> {
3
5
  children?: React.ReactNode;
4
6
  /**
5
7
  * The color scheme to use for all components on the page.
@@ -16,5 +18,5 @@ interface RootProps extends React.ComponentPropsWithoutRef<"div"> {
16
18
  * </Root>
17
19
  * ```
18
20
  */
19
- declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>>;
21
+ declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
20
22
  export { Root };
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ /** This is similar to MUI's `StyledEngineProvider` but with a custom Emotion cache. */
3
+ export declare function StyledEngineProvider({ children }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,77 @@
1
+ import { c as _c } from "react-compiler-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import createCache from "@emotion/cache";
5
+ import { CacheProvider } from "@emotion/react";
6
+ function StyledEngineProvider(t0) {
7
+ const $ = _c(3);
8
+ const {
9
+ children
10
+ } = t0;
11
+ const [cache] = React.useState(_temp);
12
+ let t1;
13
+ if ($[0] !== cache || $[1] !== children) {
14
+ t1 = jsx(CacheProvider, {
15
+ value: cache,
16
+ children
17
+ });
18
+ $[0] = cache;
19
+ $[1] = children;
20
+ $[2] = t1;
21
+ } else {
22
+ t1 = $[2];
23
+ }
24
+ return t1;
25
+ }
26
+ function _temp() {
27
+ return createEmotionCache();
28
+ }
29
+ function createEmotionCache() {
30
+ const cache = createCache({
31
+ key: "css",
32
+ speedy: true,
33
+ // This injects styles using the `insertRule` API.
34
+ stylisPlugins: [prefixer]
35
+ });
36
+ const prevInsert = cache.insert;
37
+ cache.insert = (...args) => {
38
+ if (!args[1].styles.match(/^@layer\s+[^{]*$/)) {
39
+ args[1].styles = `@layer mui {${args[1].styles}}`;
40
+ }
41
+ return prevInsert(...args);
42
+ };
43
+ return cache;
44
+ }
45
+ function prefixer(element) {
46
+ if (element.length > -1 && !element.return && element.type === "decl") {
47
+ element.return = prefix(element.value, element.length);
48
+ }
49
+ }
50
+ function prefix(value, length) {
51
+ switch (hash(value, length)) {
52
+ // color-adjust
53
+ case 5103:
54
+ return `-webkit-print-${value}${value}`;
55
+ // box-decoration-break
56
+ case 3005:
57
+ // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
58
+ case 6391:
59
+ case 5879:
60
+ case 5623:
61
+ case 6135:
62
+ case 4599:
63
+ case 4855:
64
+ // user-select, hyphens, text-size-adjust
65
+ case 4246:
66
+ case 6968:
67
+ case 2756:
68
+ return `-webkit-${value}${value}`;
69
+ }
70
+ return value;
71
+ }
72
+ function hash(value, length) {
73
+ return (value.charCodeAt(0) | 0) ^ 45 ? (((length << 2 ^ (value.charCodeAt(0) | 0)) << 2 ^ (value.charCodeAt(1) | 0)) << 2 ^ (value.charCodeAt(2) | 0)) << 2 ^ (value.charCodeAt(3) | 0) : 0;
74
+ }
75
+ export {
76
+ StyledEngineProvider
77
+ };
package/dist/Root.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import { c as _c } from "react-compiler-runtime";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { StyledEngineProvider, ThemeProvider, useColorScheme } from "@mui/material/styles";
4
+ import { ThemeProvider, useColorScheme } from "@mui/material/styles";
5
5
  import { Root as StrataKitRoot } from "@stratakit/foundations";
6
- import { RootContext, useSafeContext } from "@stratakit/foundations/secret-internals";
6
+ import { forwardRef, RootContext, useSafeContext } from "@stratakit/foundations/secret-internals";
7
7
  import cx from "classnames";
8
8
  import { createTheme } from "./createTheme.js";
9
+ import { StyledEngineProvider } from "./Root.internal.js";
9
10
  import css from "./styles.css.js";
10
11
  const theme = createTheme();
11
12
  const packageName = "@stratakit/mui";
12
- const key = `${packageName}@${"0.2.1"}`;
13
- const Root = React.forwardRef((props, forwardedRef) => {
13
+ const key = `${packageName}@${"0.3.1"}`;
14
+ const Root = forwardRef((props, forwardedRef) => {
14
15
  const {
15
16
  children,
16
17
  colorScheme,
17
18
  ...rest
18
19
  } = props;
19
20
  return /* @__PURE__ */ jsx(StyledEngineProvider, {
20
- enableCssLayer: true,
21
21
  children: /* @__PURE__ */ jsxs(ThemeProvider, {
22
22
  theme,
23
23
  defaultMode: colorScheme,
@@ -32,16 +32,18 @@ const Root = React.forwardRef((props, forwardedRef) => {
32
32
  })
33
33
  });
34
34
  });
35
- const RootInner = React.forwardRef((props, forwardedRef) => {
35
+ const RootInner = forwardRef((props, forwardedRef) => {
36
36
  const {
37
37
  children,
38
38
  colorScheme,
39
+ rootNode,
39
40
  ...rest
40
41
  } = props;
41
42
  return /* @__PURE__ */ jsx(StrataKitRoot, {
42
43
  ...rest,
43
44
  className: cx("\u{1F95D}MuiRoot", props.className),
44
45
  colorScheme,
46
+ rootNode,
45
47
  synchronizeColorScheme: true,
46
48
  ref: forwardedRef,
47
49
  children
@@ -77,7 +79,7 @@ function Styles() {
77
79
  const $ = _c(4);
78
80
  const rootContext = useSafeContext(RootContext);
79
81
  if (!rootContext.versions?.has(packageName)) {
80
- rootContext.versions?.set(packageName, "0.2.1");
82
+ rootContext.versions?.set(packageName, "0.3.1");
81
83
  }
82
84
  const {
83
85
  rootNode,