@stratakit/mui 0.3.0 → 0.4.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.
@@ -1,14 +1,19 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { Role } from "@ariakit/react/role";
4
4
  import OutlinedInput from "@mui/material/OutlinedInput";
5
+ import StepConnector from "@mui/material/StepConnector";
5
6
  import { createTheme as createMuiTheme } from "@mui/material/styles";
7
+ import cx from "classnames";
6
8
  import { MuiBadge } from "./~components/MuiBadge.js";
9
+ import { MuiBottomNavigationAction } from "./~components/MuiBottomNavigation.js";
7
10
  import { MuiButtonBase } from "./~components/MuiButtonBase.js";
8
- import { MuiCard, MuiCardActionArea } from "./~components/MuiCard.js";
11
+ import { MuiCard, MuiCardActionArea, MuiCardMedia } from "./~components/MuiCard.js";
9
12
  import { MuiChip, MuiChipDeleteIcon, MuiChipLabel } from "./~components/MuiChip.js";
13
+ import { MuiDivider } from "./~components/MuiDivider.js";
10
14
  import { MuiIconButton } from "./~components/MuiIconButton.js";
11
15
  import { MuiSnackbar } from "./~components/MuiSnackbar.js";
16
+ import { MuiStepIcon } from "./~components/MuiStepper.js";
12
17
  import { MuiTableCell, MuiTableHead } from "./~components/MuiTable.js";
13
18
  import { ArrowDownIcon, CaretsUpDownIcon, ChevronDownIcon, ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, DismissIcon, ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from "./Icon.js";
14
19
  function createTheme() {
@@ -124,6 +129,7 @@ function createTheme() {
124
129
  MuiAccordionSummary: {
125
130
  defaultProps: {
126
131
  component: Role.div,
132
+ nativeButton: false,
127
133
  expandIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {})
128
134
  }
129
135
  },
@@ -148,21 +154,47 @@ function createTheme() {
148
154
  defaultProps: {
149
155
  popupIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {}),
150
156
  clearIcon: /* @__PURE__ */ jsx(DismissIcon, {}),
157
+ renderOption: ({
158
+ key,
159
+ ...props
160
+ }, option, _, ownerState) => /* @__PURE__ */ jsx("li", {
161
+ ...props,
162
+ className: cx("MuiMenuItem-root", props.className),
163
+ children: ownerState.getOptionLabel(option)
164
+ }, key),
151
165
  slotProps: {
152
166
  paper: {
153
167
  elevation: 8
154
168
  // match Menu elevation
155
169
  },
170
+ chip: {
171
+ size: "small"
172
+ },
156
173
  clearIndicator: {
157
- tabIndex: 0
174
+ tabIndex: 0,
158
175
  // make clear indicator focusable
176
+ size: "small"
177
+ },
178
+ popupIndicator: {
179
+ size: "small"
159
180
  }
160
181
  }
161
182
  }
162
183
  },
163
184
  MuiAvatar: {
164
185
  defaultProps: {
165
- component: Role.div
186
+ component: Role.div,
187
+ slotProps: {
188
+ img: {
189
+ draggable: false
190
+ }
191
+ }
192
+ },
193
+ styleOverrides: {
194
+ root: {
195
+ width: "var(--_MuiAvatar-size, 2rem)",
196
+ height: "var(--_MuiAvatar-size, 2rem)"
197
+ }
166
198
  }
167
199
  },
168
200
  MuiAvatarGroup: {
@@ -186,6 +218,11 @@ function createTheme() {
186
218
  component: Role.div
187
219
  }
188
220
  },
221
+ MuiBottomNavigationAction: {
222
+ defaultProps: {
223
+ component: MuiBottomNavigationAction
224
+ }
225
+ },
189
226
  MuiBreadcrumbs: {
190
227
  defaultProps: {
191
228
  component: Role.nav,
@@ -234,6 +271,7 @@ function createTheme() {
234
271
  component: Role.div,
235
272
  slotProps: {
236
273
  title: {
274
+ // biome-ignore lint/suspicious/noExplicitAny: MUI's CardHeader.title.component is hardcoded to "span"
237
275
  component: Role.h2
238
276
  }
239
277
  }
@@ -241,7 +279,7 @@ function createTheme() {
241
279
  },
242
280
  MuiCardMedia: {
243
281
  defaultProps: {
244
- component: Role.div
282
+ component: MuiCardMedia
245
283
  }
246
284
  },
247
285
  MuiCheckbox: {
@@ -249,9 +287,9 @@ function createTheme() {
249
287
  component: Role.span,
250
288
  disableRipple: true,
251
289
  // Checkbox doesn't inherit from ButtonBase
252
- icon: /* @__PURE__ */ jsx(Fragment, {}),
253
- checkedIcon: /* @__PURE__ */ jsx(Fragment, {}),
254
- indeterminateIcon: /* @__PURE__ */ jsx(Fragment, {})
290
+ icon: /* @__PURE__ */ jsx(Nothing, {}),
291
+ checkedIcon: /* @__PURE__ */ jsx(Nothing, {}),
292
+ indeterminateIcon: /* @__PURE__ */ jsx(Nothing, {})
255
293
  }
256
294
  },
257
295
  MuiChip: {
@@ -287,7 +325,7 @@ function createTheme() {
287
325
  },
288
326
  MuiDivider: {
289
327
  defaultProps: {
290
- component: withRenderProp(Role, "hr")
328
+ component: MuiDivider
291
329
  }
292
330
  },
293
331
  MuiDrawer: {
@@ -321,11 +359,6 @@ function createTheme() {
321
359
  component: Role.div
322
360
  }
323
361
  },
324
- MuiGridLegacy: {
325
- defaultProps: {
326
- component: Role.div
327
- }
328
- },
329
362
  MuiIcon: {
330
363
  defaultProps: {
331
364
  component: Role.span
@@ -420,7 +453,8 @@ function createTheme() {
420
453
  },
421
454
  MuiListItemButton: {
422
455
  defaultProps: {
423
- component: MuiButtonBase
456
+ component: MuiButtonBase,
457
+ nativeButton: true
424
458
  }
425
459
  },
426
460
  MuiListItemText: {
@@ -468,9 +502,15 @@ function createTheme() {
468
502
  // Removes masked border from Select
469
503
  }
470
504
  },
505
+ MuiPagination: {
506
+ defaultProps: {
507
+ shape: "rounded"
508
+ }
509
+ },
471
510
  MuiPaginationItem: {
472
511
  defaultProps: {
473
512
  component: MuiButtonBase,
513
+ shape: "rounded",
474
514
  slots: {
475
515
  previous: ChevronLeftIcon,
476
516
  next: ChevronRightIcon,
@@ -494,8 +534,8 @@ function createTheme() {
494
534
  component: Role.span,
495
535
  disableRipple: true,
496
536
  // Radio doesn't inherit from ButtonBase
497
- icon: /* @__PURE__ */ jsx(Fragment, {}),
498
- checkedIcon: /* @__PURE__ */ jsx(Fragment, {})
537
+ icon: /* @__PURE__ */ jsx(Nothing, {}),
538
+ checkedIcon: /* @__PURE__ */ jsx(Nothing, {})
499
539
  }
500
540
  },
501
541
  MuiRating: {
@@ -545,7 +585,7 @@ function createTheme() {
545
585
  },
546
586
  MuiStep: {
547
587
  defaultProps: {
548
- component: Role.div
588
+ component: Role.li
549
589
  }
550
590
  },
551
591
  MuiSwitch: {
@@ -555,7 +595,23 @@ function createTheme() {
555
595
  },
556
596
  MuiStepper: {
557
597
  defaultProps: {
558
- component: Role.div
598
+ component: Role.ol,
599
+ connector: /* @__PURE__ */ jsx(StepConnector, {
600
+ "aria-hidden": "true"
601
+ })
602
+ // hiding the connector to prevent invalid markup
603
+ }
604
+ },
605
+ MuiStepLabel: {
606
+ defaultProps: {
607
+ slotProps: {
608
+ root: {
609
+ component: Role.div
610
+ },
611
+ stepIcon: {
612
+ component: MuiStepIcon
613
+ }
614
+ }
559
615
  }
560
616
  },
561
617
  MuiSvgIcon: {
@@ -580,7 +636,9 @@ function createTheme() {
580
636
  },
581
637
  MuiTableBody: {
582
638
  defaultProps: {
583
- component: withRenderProp(Role, "tbody")
639
+ component: withRenderProp(Role, "tbody"),
640
+ role: void 0
641
+ // Removing role="rowgroup". See https://github.com/iTwin/stratakit/pull/1361
584
642
  }
585
643
  },
586
644
  MuiTableCell: {
@@ -652,7 +710,18 @@ function createTheme() {
652
710
  },
653
711
  MuiTooltip: {
654
712
  defaultProps: {
655
- describeChild: true
713
+ placement: "top",
714
+ describeChild: true,
715
+ slotProps: {
716
+ popper: {
717
+ modifiers: [{
718
+ name: "offset",
719
+ options: {
720
+ offset: [0, 2]
721
+ }
722
+ }]
723
+ }
724
+ }
656
725
  }
657
726
  },
658
727
  MuiTypography: {
@@ -688,6 +757,9 @@ function withRenderProp(Role2, DefaultTagName) {
688
757
  });
689
758
  });
690
759
  }
760
+ function Nothing() {
761
+ return null;
762
+ }
691
763
  export {
692
764
  createTheme
693
765
  };
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.4.0",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "types": "./dist/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  "@emotion/cache": "^11.14.0",
50
50
  "@emotion/react": "^11.14.0",
51
51
  "@emotion/styled": "^11.14.1",
52
- "@stratakit/foundations": "^0.4.7",
52
+ "@stratakit/foundations": "^0.4.8",
53
53
  "@stratakit/icons": "^0.3.1",
54
54
  "classnames": "^2.5.1",
55
55
  "react-compiler-runtime": "^1.0.0"
@@ -63,7 +63,7 @@
63
63
  "typescript": "~5.9.3"
64
64
  },
65
65
  "peerDependencies": {
66
- "@mui/material": "^7.3.6",
66
+ "@mui/material": "^9.0.0",
67
67
  "react": ">=18.0.0",
68
68
  "react-dom": ">=18.0.0"
69
69
  },
@@ -1,16 +0,0 @@
1
- /**
2
- * Creates a StrataKit theme for MUI. Should be used with MUI's `ThemeProvider`.
3
- *
4
- * Example:
5
- * ```tsx
6
- * import { ThemeProvider } from "@mui/material/styles";
7
- * import { createTheme } from "@stratakit/mui";
8
- *
9
- * const theme = createTheme();
10
- * <ThemeProvider theme={theme}>
11
- * <App />
12
- * </ThemeProvider>
13
- * ```
14
- */
15
- declare function createTheme(): import("@mui/material/styles").Theme;
16
- export { createTheme };