@stratakit/mui 0.4.0 → 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 +22 -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 +49 -24
- 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 +33 -24
- package/package.json +5 -5
|
@@ -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
|
}
|
|
@@ -526,7 +540,12 @@ function createTheme() {
|
|
|
526
540
|
},
|
|
527
541
|
MuiPopover: {
|
|
528
542
|
defaultProps: {
|
|
529
|
-
component: Role.div
|
|
543
|
+
component: Role.div,
|
|
544
|
+
slotProps: {
|
|
545
|
+
paper: {
|
|
546
|
+
role: "dialog"
|
|
547
|
+
}
|
|
548
|
+
}
|
|
530
549
|
}
|
|
531
550
|
},
|
|
532
551
|
MuiRadio: {
|
|
@@ -561,7 +580,12 @@ function createTheme() {
|
|
|
561
580
|
},
|
|
562
581
|
MuiSlider: {
|
|
563
582
|
defaultProps: {
|
|
564
|
-
component: Role.span
|
|
583
|
+
component: Role.span,
|
|
584
|
+
slotProps: {
|
|
585
|
+
valueLabel: {
|
|
586
|
+
className: "MuiTooltip-tooltip"
|
|
587
|
+
}
|
|
588
|
+
}
|
|
565
589
|
}
|
|
566
590
|
},
|
|
567
591
|
MuiSnackbar: {
|
|
@@ -636,7 +660,7 @@ function createTheme() {
|
|
|
636
660
|
},
|
|
637
661
|
MuiTableBody: {
|
|
638
662
|
defaultProps: {
|
|
639
|
-
component:
|
|
663
|
+
component: MuiTableBody,
|
|
640
664
|
role: void 0
|
|
641
665
|
// Removing role="rowgroup". See https://github.com/iTwin/stratakit/pull/1361
|
|
642
666
|
}
|
|
@@ -700,7 +724,7 @@ function createTheme() {
|
|
|
700
724
|
},
|
|
701
725
|
MuiToggleButton: {
|
|
702
726
|
defaultProps: {
|
|
703
|
-
component:
|
|
727
|
+
component: MuiToggleButton
|
|
704
728
|
}
|
|
705
729
|
},
|
|
706
730
|
MuiToolbar: {
|
|
@@ -727,22 +751,7 @@ function createTheme() {
|
|
|
727
751
|
MuiTypography: {
|
|
728
752
|
defaultProps: {
|
|
729
753
|
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
|
-
}
|
|
754
|
+
component: MuiTypography
|
|
746
755
|
}
|
|
747
756
|
}
|
|
748
757
|
}
|
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.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
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",
|
|
@@ -57,9 +57,9 @@
|
|
|
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": {
|