@stratakit/mui 0.3.0 → 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.
@@ -0,0 +1,2 @@
1
+ declare const MuiBottomNavigationAction: 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>>;
2
+ export { MuiBottomNavigationAction };
@@ -0,0 +1,23 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "@stratakit/foundations/secret-internals";
3
+ import { MuiButtonBase } from "./MuiButtonBase.js";
4
+ const MuiBottomNavigationAction = forwardRef((props, forwardedRef) => {
5
+ const {
6
+ children,
7
+ ...rest
8
+ } = props;
9
+ const classList = props.className?.split(" ") ?? [];
10
+ const selected = classList.includes("Mui-selected");
11
+ return /* @__PURE__ */ jsx(MuiButtonBase, {
12
+ "aria-current": selected ? "true" : "false",
13
+ ...rest,
14
+ ref: forwardedRef,
15
+ children: /* @__PURE__ */ jsx("span", {
16
+ className: "MuiBottomNavigationAction-content",
17
+ children
18
+ })
19
+ });
20
+ });
21
+ export {
22
+ MuiBottomNavigationAction
23
+ };
@@ -1,4 +1,5 @@
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
3
  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
- export { MuiCard, MuiCardActionArea };
4
+ 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 };
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react-compiler-runtime";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import * as React from "react";
3
4
  import { Role } from "@ariakit/react/role";
@@ -43,7 +44,69 @@ const MuiCardActionArea = forwardRef((props, forwardedRef) => {
43
44
  ref: useMergedRefs(context?.setActionAreaElement, forwardedRef)
44
45
  });
45
46
  });
47
+ const MEDIA_COMPONENTS = ["audio", "iframe", "img", "picture", "video"];
48
+ function extractBackgroundImageUrl(style) {
49
+ const backgroundImage = style?.backgroundImage;
50
+ if (!backgroundImage?.startsWith("url(")) return void 0;
51
+ if (!['"', "'"].includes(backgroundImage[4])) return void 0;
52
+ return backgroundImage.slice(5, -2);
53
+ }
54
+ const MuiCardMedia = forwardRef((props, forwardedRef) => {
55
+ const $ = _c(1);
56
+ const [tagName, setTagName] = React.useState(void 0);
57
+ let t0;
58
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
59
+ t0 = (element) => {
60
+ if (!element) {
61
+ return;
62
+ }
63
+ setTagName(element.tagName.toLowerCase());
64
+ };
65
+ $[0] = t0;
66
+ } else {
67
+ t0 = $[0];
68
+ }
69
+ const determineTagName = t0;
70
+ const isMediaComponent = MEDIA_COMPONENTS.includes(tagName ?? "");
71
+ const src = isMediaComponent ? extractBackgroundImageUrl(props.style) : void 0;
72
+ let t1;
73
+ bb0: {
74
+ if (!isMediaComponent) {
75
+ t1 = props.style;
76
+ break bb0;
77
+ }
78
+ const {
79
+ backgroundImage,
80
+ ...restStyle
81
+ } = props.style ?? {};
82
+ t1 = restStyle;
83
+ }
84
+ const style = t1;
85
+ let t2;
86
+ bb1: {
87
+ if (!isMediaComponent) {
88
+ t2 = props.role;
89
+ break bb1;
90
+ }
91
+ if (props.role === "img") {
92
+ t2 = void 0;
93
+ break bb1;
94
+ }
95
+ t2 = props.role;
96
+ }
97
+ const role = t2;
98
+ return jsx(Role.div, {
99
+ ...props,
100
+ ...src ? {
101
+ src
102
+ } : {},
103
+ role,
104
+ style,
105
+ ref: useMergedRefs(determineTagName, forwardedRef)
106
+ });
107
+ });
46
108
  export {
47
109
  MuiCard,
48
- MuiCardActionArea
110
+ MuiCardActionArea,
111
+ MuiCardMedia
49
112
  };
@@ -1,9 +1,10 @@
1
1
  import * as React from "react";
2
2
  import type Chip from "@mui/material/Chip";
3
+ import type { BaseProps } from "@stratakit/foundations/secret-internals";
3
4
  type ChipProps = React.ComponentProps<typeof Chip>;
4
- interface MuiChipProps extends React.ComponentProps<"div">, Pick<ChipProps, "deleteLabel"> {
5
+ interface MuiChipProps extends BaseProps<"div">, Pick<ChipProps, "deleteLabel"> {
5
6
  }
6
- declare const MuiChip: React.ForwardRefExoticComponent<Omit<MuiChipProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
- declare const MuiChipLabel: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
8
- declare const MuiChipDeleteIcon: React.ForwardRefExoticComponent<Omit<import("@mui/material/IconButton").IconButtonOwnProps & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, "classes"> & 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" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "edge">, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const MuiChip: React.ForwardRefExoticComponent<MuiChipProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
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, "classes"> & 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" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "edge">, "ref"> & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
9
10
  export { MuiChip, MuiChipLabel, MuiChipDeleteIcon };
@@ -4,10 +4,11 @@ import { Role } from "@ariakit/react/role";
4
4
  import { VisuallyHidden } from "@ariakit/react/visually-hidden";
5
5
  import IconButton from "@mui/material/IconButton";
6
6
  import { useTheme } from "@mui/material/styles";
7
- import { DismissIcon } from "../Icon.js";
7
+ import { forwardRef } from "@stratakit/foundations/secret-internals";
8
+ import { DismissCircleIcon } from "../Icon.js";
8
9
  import { MuiButtonBase } from "./MuiButtonBase.js";
9
10
  const MuiChipContext = React.createContext(void 0);
10
- const MuiChip = React.forwardRef((props, forwardedRef) => {
11
+ const MuiChip = forwardRef((props, forwardedRef) => {
11
12
  const {
12
13
  role,
13
14
  deleteLabel,
@@ -32,7 +33,7 @@ const MuiChip = React.forwardRef((props, forwardedRef) => {
32
33
  })
33
34
  });
34
35
  });
35
- const MuiChipLabel = React.forwardRef((props, forwardedRef) => {
36
+ const MuiChipLabel = forwardRef((props, forwardedRef) => {
36
37
  const defaultId = React.useId();
37
38
  const {
38
39
  id = defaultId,
@@ -56,7 +57,7 @@ const MuiChipLabel = React.forwardRef((props, forwardedRef) => {
56
57
  ref: forwardedRef
57
58
  });
58
59
  });
59
- const MuiChipDeleteIcon = React.forwardRef((props, forwardedRef) => {
60
+ const MuiChipDeleteIcon = forwardRef((props, forwardedRef) => {
60
61
  const theme = useTheme();
61
62
  const defaultLabel = theme.components?.MuiAutocomplete?.defaultProps?.clearText ?? "Clear";
62
63
  const {
@@ -72,7 +73,7 @@ const MuiChipDeleteIcon = React.forwardRef((props, forwardedRef) => {
72
73
  children: [/* @__PURE__ */ jsx(VisuallyHidden, {
73
74
  id: clearId,
74
75
  children: deleteLabel
75
- }), /* @__PURE__ */ jsx(DismissIcon, {})]
76
+ }), /* @__PURE__ */ jsx(DismissCircleIcon, {})]
76
77
  });
77
78
  });
78
79
  export {
@@ -0,0 +1,6 @@
1
+ import type { DividerOwnProps } from "@mui/material/Divider";
2
+ import type { BaseProps } from "@stratakit/foundations/secret-internals";
3
+ interface MuiDividerProps extends BaseProps<"hr">, Pick<DividerOwnProps, "children"> {
4
+ }
5
+ declare const MuiDivider: import("react").ForwardRefExoticComponent<MuiDividerProps & import("react").RefAttributes<HTMLElement | HTMLHRElement>>;
6
+ export { MuiDivider };
@@ -0,0 +1,22 @@
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 {
6
+ children,
7
+ ...rest
8
+ } = props;
9
+ const defaultRender = (() => {
10
+ if (children || props["aria-orientation"] === "vertical") return /* @__PURE__ */ jsx("div", {});
11
+ return /* @__PURE__ */ jsx("hr", {});
12
+ })();
13
+ return /* @__PURE__ */ jsx(Role, {
14
+ render: defaultRender,
15
+ ...rest,
16
+ ref: forwardedRef,
17
+ children
18
+ });
19
+ });
20
+ export {
21
+ MuiDivider
22
+ };
@@ -0,0 +1,2 @@
1
+ declare const MuiStepIcon: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "render"> & import("react").RefAttributes<HTMLElement | HTMLSpanElement>>;
2
+ export { MuiStepIcon };
@@ -0,0 +1,26 @@
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((props, forwardedRef) => {
6
+ const {
7
+ children: _,
8
+ ...rest
9
+ } = props;
10
+ const classList = props.className?.split(" ") ?? [];
11
+ const completed = classList.includes("Mui-completed");
12
+ const error = classList.includes("Mui-error");
13
+ const children = (() => {
14
+ if (error) return /* @__PURE__ */ jsx(ErrorIcon, {});
15
+ if (completed) return /* @__PURE__ */ jsx(CheckmarkIcon, {});
16
+ })();
17
+ return /* @__PURE__ */ jsx(Role.span, {
18
+ "aria-hidden": "true",
19
+ ...rest,
20
+ ref: forwardedRef,
21
+ children
22
+ });
23
+ });
24
+ export {
25
+ MuiStepIcon
26
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stratakit/mui",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "types": "./dist/index.d.ts",