@stratakit/mui 0.4.0 → 0.4.2
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 +34 -0
- package/dist/DEV/Root.js +2 -2
- 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/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 +60 -25
- package/dist/Icon.d.ts +1 -1
- package/dist/Root.js +2 -2
- package/dist/styles.css.js +1 -1
- package/dist/types.d.ts +24 -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/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.js +40 -25
- package/package.json +7 -7
|
@@ -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
|
+
};
|
package/dist/~createTheme.js
CHANGED
|
@@ -5,6 +5,8 @@ import OutlinedInput from "@mui/material/OutlinedInput";
|
|
|
5
5
|
import StepConnector from "@mui/material/StepConnector";
|
|
6
6
|
import { createTheme as createMuiTheme } from "@mui/material/styles";
|
|
7
7
|
import cx from "classnames";
|
|
8
|
+
import { MuiAutocomplete } from "./~components/MuiAutocomplete.js";
|
|
9
|
+
import { MuiAvatarGroup } from "./~components/MuiAvatarGroup.js";
|
|
8
10
|
import { MuiBadge } from "./~components/MuiBadge.js";
|
|
9
11
|
import { MuiBottomNavigationAction } from "./~components/MuiBottomNavigation.js";
|
|
10
12
|
import { MuiButtonBase } from "./~components/MuiButtonBase.js";
|
|
@@ -12,9 +14,12 @@ import { MuiCard, MuiCardActionArea, MuiCardMedia } from "./~components/MuiCard.
|
|
|
12
14
|
import { MuiChip, MuiChipDeleteIcon, MuiChipLabel } from "./~components/MuiChip.js";
|
|
13
15
|
import { MuiDivider } from "./~components/MuiDivider.js";
|
|
14
16
|
import { MuiIconButton } from "./~components/MuiIconButton.js";
|
|
17
|
+
import { MuiInputLabel } from "./~components/MuiInputLabel.js";
|
|
15
18
|
import { MuiSnackbar } from "./~components/MuiSnackbar.js";
|
|
16
19
|
import { MuiStepIcon } from "./~components/MuiStepper.js";
|
|
17
|
-
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";
|
|
18
23
|
import { ArrowDownIcon, CaretsUpDownIcon, ChevronDownIcon, ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, DismissIcon, ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from "./Icon.js";
|
|
19
24
|
function createTheme() {
|
|
20
25
|
const palette = {
|
|
@@ -163,6 +168,9 @@ function createTheme() {
|
|
|
163
168
|
children: ownerState.getOptionLabel(option)
|
|
164
169
|
}, key),
|
|
165
170
|
slotProps: {
|
|
171
|
+
root: {
|
|
172
|
+
component: MuiAutocomplete
|
|
173
|
+
},
|
|
166
174
|
paper: {
|
|
167
175
|
elevation: 8
|
|
168
176
|
// match Menu elevation
|
|
@@ -199,7 +207,12 @@ function createTheme() {
|
|
|
199
207
|
},
|
|
200
208
|
MuiAvatarGroup: {
|
|
201
209
|
defaultProps: {
|
|
202
|
-
component:
|
|
210
|
+
component: MuiAvatarGroup,
|
|
211
|
+
slotProps: {
|
|
212
|
+
surplus: {
|
|
213
|
+
["data-_sk-surplus"]: ``
|
|
214
|
+
}
|
|
215
|
+
}
|
|
203
216
|
}
|
|
204
217
|
},
|
|
205
218
|
MuiBackdrop: {
|
|
@@ -315,7 +328,8 @@ function createTheme() {
|
|
|
315
328
|
},
|
|
316
329
|
MuiDialogContentText: {
|
|
317
330
|
defaultProps: {
|
|
318
|
-
component: Role.p
|
|
331
|
+
component: Role.p,
|
|
332
|
+
variant: "inherit"
|
|
319
333
|
}
|
|
320
334
|
},
|
|
321
335
|
MuiDialogTitle: {
|
|
@@ -387,7 +401,7 @@ function createTheme() {
|
|
|
387
401
|
},
|
|
388
402
|
MuiInputLabel: {
|
|
389
403
|
defaultProps: {
|
|
390
|
-
component:
|
|
404
|
+
component: MuiInputLabel,
|
|
391
405
|
shrink: true
|
|
392
406
|
// Removes label animation and masked border from TextField
|
|
393
407
|
}
|
|
@@ -473,7 +487,13 @@ function createTheme() {
|
|
|
473
487
|
},
|
|
474
488
|
MuiMenu: {
|
|
475
489
|
defaultProps: {
|
|
476
|
-
component: Role.div
|
|
490
|
+
component: Role.div,
|
|
491
|
+
slotProps: {
|
|
492
|
+
paper: {
|
|
493
|
+
role: "presentation"
|
|
494
|
+
// Removes role="dialog"
|
|
495
|
+
}
|
|
496
|
+
}
|
|
477
497
|
}
|
|
478
498
|
},
|
|
479
499
|
MuiMenuItem: {
|
|
@@ -526,7 +546,12 @@ function createTheme() {
|
|
|
526
546
|
},
|
|
527
547
|
MuiPopover: {
|
|
528
548
|
defaultProps: {
|
|
529
|
-
component: Role.div
|
|
549
|
+
component: Role.div,
|
|
550
|
+
slotProps: {
|
|
551
|
+
paper: {
|
|
552
|
+
role: "dialog"
|
|
553
|
+
}
|
|
554
|
+
}
|
|
530
555
|
}
|
|
531
556
|
},
|
|
532
557
|
MuiRadio: {
|
|
@@ -561,7 +586,12 @@ function createTheme() {
|
|
|
561
586
|
},
|
|
562
587
|
MuiSlider: {
|
|
563
588
|
defaultProps: {
|
|
564
|
-
component: Role.span
|
|
589
|
+
component: Role.span,
|
|
590
|
+
slotProps: {
|
|
591
|
+
valueLabel: {
|
|
592
|
+
className: "MuiTooltip-tooltip"
|
|
593
|
+
}
|
|
594
|
+
}
|
|
565
595
|
}
|
|
566
596
|
},
|
|
567
597
|
MuiSnackbar: {
|
|
@@ -636,7 +666,7 @@ function createTheme() {
|
|
|
636
666
|
},
|
|
637
667
|
MuiTableBody: {
|
|
638
668
|
defaultProps: {
|
|
639
|
-
component:
|
|
669
|
+
component: MuiTableBody,
|
|
640
670
|
role: void 0
|
|
641
671
|
// Removing role="rowgroup". See https://github.com/iTwin/stratakit/pull/1361
|
|
642
672
|
}
|
|
@@ -700,7 +730,7 @@ function createTheme() {
|
|
|
700
730
|
},
|
|
701
731
|
MuiToggleButton: {
|
|
702
732
|
defaultProps: {
|
|
703
|
-
component:
|
|
733
|
+
component: MuiToggleButton
|
|
704
734
|
}
|
|
705
735
|
},
|
|
706
736
|
MuiToolbar: {
|
|
@@ -727,22 +757,7 @@ function createTheme() {
|
|
|
727
757
|
MuiTypography: {
|
|
728
758
|
defaultProps: {
|
|
729
759
|
variant: "body2",
|
|
730
|
-
|
|
731
|
-
h1: Role.h1,
|
|
732
|
-
h2: Role.h2,
|
|
733
|
-
h3: Role.h3,
|
|
734
|
-
h4: Role.h4,
|
|
735
|
-
h5: Role.h5,
|
|
736
|
-
h6: Role.h6,
|
|
737
|
-
subtitle1: Role.h6,
|
|
738
|
-
subtitle2: Role.h6,
|
|
739
|
-
body1: Role.p,
|
|
740
|
-
body2: Role.p,
|
|
741
|
-
inherit: Role.p,
|
|
742
|
-
button: Role.span,
|
|
743
|
-
caption: Role.span,
|
|
744
|
-
overline: Role.span
|
|
745
|
-
}
|
|
760
|
+
component: MuiTypography
|
|
746
761
|
}
|
|
747
762
|
}
|
|
748
763
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratakit/mui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -45,22 +45,22 @@
|
|
|
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
52
|
"@stratakit/foundations": "^0.4.8",
|
|
53
|
-
"@stratakit/icons": "^0.3.
|
|
53
|
+
"@stratakit/icons": "^0.3.2",
|
|
54
54
|
"classnames": "^2.5.1",
|
|
55
55
|
"react-compiler-runtime": "^1.0.0"
|
|
56
56
|
},
|
|
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.
|
|
63
|
-
"typescript": "~
|
|
60
|
+
"esbuild": "^0.27.7",
|
|
61
|
+
"react": "^19.2.5",
|
|
62
|
+
"react-dom": "^19.2.5",
|
|
63
|
+
"typescript": "~6.0.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@mui/material": "^9.0.0",
|