@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
@@ -1,5 +1,18 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Role } from "@ariakit/react/role";
4
+ import OutlinedInput from "@mui/material/OutlinedInput";
2
5
  import { createTheme as createMuiTheme } from "@mui/material/styles";
6
+ import { MuiBadge } from "./~components/MuiBadge.js";
7
+ import { MuiBottomNavigationAction } from "./~components/MuiBottomNavigation.js";
8
+ import { MuiButtonBase } from "./~components/MuiButtonBase.js";
9
+ import { MuiCard, MuiCardActionArea, MuiCardMedia } from "./~components/MuiCard.js";
10
+ import { MuiChip, MuiChipDeleteIcon, MuiChipLabel } from "./~components/MuiChip.js";
11
+ import { MuiDivider } from "./~components/MuiDivider.js";
12
+ import { MuiIconButton } from "./~components/MuiIconButton.js";
13
+ import { MuiSnackbar } from "./~components/MuiSnackbar.js";
14
+ import { MuiStepIcon } from "./~components/MuiStepper.js";
15
+ import { MuiTableCell, MuiTableHead } from "./~components/MuiTable.js";
3
16
  import { ArrowDownIcon, CaretsUpDownIcon, ChevronDownIcon, ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, DismissIcon, ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from "./Icon.js";
4
17
  function createTheme() {
5
18
  const palette = {
@@ -43,6 +56,40 @@ function createTheme() {
43
56
  button: {
44
57
  textTransform: "none"
45
58
  // Disable all-caps on buttons and tabs
59
+ },
60
+ // These are only hardcoded here as fallback. The CSS will take precedence.
61
+ body1: {
62
+ fontSize: 16
63
+ },
64
+ body2: {
65
+ fontSize: 14
66
+ },
67
+ h1: {
68
+ fontSize: 48
69
+ },
70
+ h2: {
71
+ fontSize: 40
72
+ },
73
+ h3: {
74
+ fontSize: 32
75
+ },
76
+ h4: {
77
+ fontSize: 28
78
+ },
79
+ h5: {
80
+ fontSize: 24
81
+ },
82
+ h6: {
83
+ fontSize: 20
84
+ },
85
+ caption: {
86
+ fontSize: 12
87
+ },
88
+ subtitle1: {
89
+ fontSize: 12
90
+ },
91
+ subtitle2: {
92
+ fontSize: 11
46
93
  }
47
94
  },
48
95
  shadows: [
@@ -61,13 +108,31 @@ function createTheme() {
61
108
  // biome-ignore lint/suspicious/noExplicitAny: MUI expects 25 items in the shadows array
62
109
  ],
63
110
  components: {
111
+ MuiAppBar: {
112
+ defaultProps: {
113
+ component: Role.header
114
+ }
115
+ },
116
+ MuiAccordion: {
117
+ defaultProps: {
118
+ component: Role.div,
119
+ slotProps: {
120
+ region: {
121
+ role: void 0,
122
+ "aria-labelledby": void 0
123
+ }
124
+ }
125
+ }
126
+ },
64
127
  MuiAccordionSummary: {
65
128
  defaultProps: {
129
+ component: Role.div,
66
130
  expandIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {})
67
131
  }
68
132
  },
69
133
  MuiAlert: {
70
134
  defaultProps: {
135
+ component: Role.div,
71
136
  variant: "outlined",
72
137
  iconMapping: {
73
138
  error: /* @__PURE__ */ jsx(ErrorIcon, {}),
@@ -77,6 +142,11 @@ function createTheme() {
77
142
  }
78
143
  }
79
144
  },
145
+ MuiAlertTitle: {
146
+ defaultProps: {
147
+ component: Role.div
148
+ }
149
+ },
80
150
  MuiAutocomplete: {
81
151
  defaultProps: {
82
152
  popupIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {}),
@@ -85,58 +155,237 @@ function createTheme() {
85
155
  paper: {
86
156
  elevation: 8
87
157
  // match Menu elevation
158
+ },
159
+ chip: {
160
+ size: "small"
161
+ },
162
+ clearIndicator: {
163
+ tabIndex: 0,
164
+ // make clear indicator focusable
165
+ size: "small"
166
+ },
167
+ popupIndicator: {
168
+ size: "small"
88
169
  }
89
170
  }
90
171
  }
91
172
  },
173
+ MuiAvatar: {
174
+ defaultProps: {
175
+ component: Role.div,
176
+ imgProps: {
177
+ draggable: false
178
+ }
179
+ },
180
+ styleOverrides: {
181
+ root: {
182
+ width: "var(--_MuiAvatar-size, 2rem)",
183
+ height: "var(--_MuiAvatar-size, 2rem)"
184
+ }
185
+ }
186
+ },
187
+ MuiAvatarGroup: {
188
+ defaultProps: {
189
+ component: Role.div
190
+ }
191
+ },
192
+ MuiBackdrop: {
193
+ defaultProps: {
194
+ component: Role.div
195
+ }
196
+ },
197
+ MuiBadge: {
198
+ defaultProps: {
199
+ component: MuiBadge,
200
+ color: "secondary"
201
+ }
202
+ },
203
+ MuiBottomNavigation: {
204
+ defaultProps: {
205
+ component: Role.div
206
+ }
207
+ },
208
+ MuiBottomNavigationAction: {
209
+ defaultProps: {
210
+ component: MuiBottomNavigationAction
211
+ }
212
+ },
92
213
  MuiBreadcrumbs: {
93
214
  defaultProps: {
215
+ component: Role.nav,
94
216
  separator: /* @__PURE__ */ jsx(ChevronRightIcon, {})
95
217
  }
96
218
  },
97
219
  MuiButtonBase: {
98
220
  defaultProps: {
221
+ component: MuiButtonBase,
99
222
  disableRipple: true
100
223
  // https://mui.com/material-ui/getting-started/faq/#how-can-i-disable-the-ripple-effect-globally
101
224
  }
102
225
  },
103
226
  MuiButton: {
104
227
  defaultProps: {
228
+ component: MuiButtonBase,
105
229
  color: "secondary",
106
230
  variant: "contained"
107
231
  }
108
232
  },
109
233
  MuiButtonGroup: {
110
234
  defaultProps: {
235
+ component: Role.div,
111
236
  color: "secondary",
112
237
  disableRipple: true
113
238
  // ButtonGroup overrides Button's disableRipple so we need to set it here as well
114
239
  }
115
240
  },
116
- MuiChip: {
241
+ MuiCard: {
242
+ defaultProps: {
243
+ component: MuiCard
244
+ }
245
+ },
246
+ MuiCardActionArea: {
247
+ defaultProps: {
248
+ component: MuiCardActionArea
249
+ }
250
+ },
251
+ MuiCardContent: {
117
252
  defaultProps: {
118
- deleteIcon: /* @__PURE__ */ jsx(DismissIcon, {})
253
+ component: Role.div
254
+ }
255
+ },
256
+ MuiCardHeader: {
257
+ defaultProps: {
258
+ component: Role.div,
259
+ slotProps: {
260
+ title: {
261
+ component: Role.h2
262
+ }
263
+ }
264
+ }
265
+ },
266
+ MuiCardMedia: {
267
+ defaultProps: {
268
+ component: MuiCardMedia
119
269
  }
120
270
  },
121
271
  MuiCheckbox: {
122
272
  defaultProps: {
123
- disableRipple: true
273
+ component: Role.span,
274
+ disableRipple: true,
124
275
  // Checkbox doesn't inherit from ButtonBase
276
+ icon: /* @__PURE__ */ jsx(Nothing, {}),
277
+ checkedIcon: /* @__PURE__ */ jsx(Nothing, {}),
278
+ indeterminateIcon: /* @__PURE__ */ jsx(Nothing, {})
125
279
  }
126
280
  },
127
- MuiInputLabel: {
281
+ MuiChip: {
128
282
  defaultProps: {
129
- shrink: true
130
- // Removes label animation and masked border from TextField
283
+ component: MuiChip,
284
+ deleteIcon: /* @__PURE__ */ jsx(MuiChipDeleteIcon, {}),
285
+ slotProps: {
286
+ label: {
287
+ component: MuiChipLabel
288
+ }
289
+ }
290
+ }
291
+ },
292
+ MuiContainer: {
293
+ defaultProps: {
294
+ component: Role.div
295
+ }
296
+ },
297
+ MuiDialog: {
298
+ defaultProps: {
299
+ component: Role.div
300
+ }
301
+ },
302
+ MuiDialogContentText: {
303
+ defaultProps: {
304
+ component: Role.p
305
+ }
306
+ },
307
+ MuiDialogTitle: {
308
+ defaultProps: {
309
+ component: Role.h2
310
+ }
311
+ },
312
+ MuiDivider: {
313
+ defaultProps: {
314
+ component: MuiDivider
315
+ }
316
+ },
317
+ MuiDrawer: {
318
+ defaultProps: {
319
+ component: Role.div
131
320
  }
132
321
  },
133
322
  MuiFab: {
134
323
  defaultProps: {
324
+ component: MuiButtonBase,
135
325
  color: "primary"
136
326
  }
137
327
  },
328
+ MuiFormControl: {
329
+ defaultProps: {
330
+ component: Role.div
331
+ }
332
+ },
333
+ MuiFormHelperText: {
334
+ defaultProps: {
335
+ component: Role.p
336
+ }
337
+ },
338
+ MuiFormLabel: {
339
+ defaultProps: {
340
+ component: Role.label
341
+ }
342
+ },
343
+ MuiGrid: {
344
+ defaultProps: {
345
+ component: Role.div
346
+ }
347
+ },
348
+ MuiGridLegacy: {
349
+ defaultProps: {
350
+ component: Role.div
351
+ }
352
+ },
353
+ MuiIcon: {
354
+ defaultProps: {
355
+ component: Role.span
356
+ }
357
+ },
358
+ MuiIconButton: {
359
+ defaultProps: {
360
+ component: MuiIconButton,
361
+ color: "secondary"
362
+ }
363
+ },
364
+ MuiImageList: {
365
+ defaultProps: {
366
+ component: Role.ul
367
+ }
368
+ },
369
+ MuiImageListItem: {
370
+ defaultProps: {
371
+ component: Role.li
372
+ }
373
+ },
374
+ MuiInputAdornment: {
375
+ defaultProps: {
376
+ component: Role.div
377
+ }
378
+ },
379
+ MuiInputLabel: {
380
+ defaultProps: {
381
+ component: Role.label,
382
+ shrink: true
383
+ // Removes label animation and masked border from TextField
384
+ }
385
+ },
138
386
  MuiLink: {
139
387
  defaultProps: {
388
+ component: Role.a,
140
389
  color: "textPrimary"
141
390
  },
142
391
  variants: [{
@@ -183,14 +432,75 @@ function createTheme() {
183
432
  }
184
433
  }]
185
434
  },
435
+ MuiList: {
436
+ defaultProps: {
437
+ component: Role.ul
438
+ }
439
+ },
440
+ MuiListItem: {
441
+ defaultProps: {
442
+ component: Role.li
443
+ }
444
+ },
445
+ MuiListItemButton: {
446
+ defaultProps: {
447
+ component: MuiButtonBase
448
+ }
449
+ },
450
+ MuiListItemText: {
451
+ defaultProps: {
452
+ slotProps: {
453
+ primary: {
454
+ variant: "inherit"
455
+ }
456
+ }
457
+ }
458
+ },
459
+ MuiListSubheader: {
460
+ defaultProps: {
461
+ component: Role.li
462
+ }
463
+ },
464
+ MuiMenu: {
465
+ defaultProps: {
466
+ component: Role.div
467
+ }
468
+ },
469
+ MuiMenuItem: {
470
+ defaultProps: {
471
+ component: Role.li
472
+ }
473
+ },
474
+ MuiMenuList: {
475
+ defaultProps: {
476
+ component: Role.ul
477
+ }
478
+ },
479
+ MuiMobileStepper: {
480
+ defaultProps: {
481
+ component: Role.div
482
+ }
483
+ },
484
+ MuiModal: {
485
+ defaultProps: {
486
+ component: Role.div
487
+ }
488
+ },
186
489
  MuiOutlinedInput: {
187
490
  defaultProps: {
188
491
  notched: false
189
492
  // Removes masked border from Select
190
493
  }
191
494
  },
495
+ MuiPagination: {
496
+ defaultProps: {
497
+ shape: "rounded"
498
+ }
499
+ },
192
500
  MuiPaginationItem: {
193
501
  defaultProps: {
502
+ component: MuiButtonBase,
503
+ shape: "rounded",
194
504
  slots: {
195
505
  previous: ChevronLeftIcon,
196
506
  next: ChevronRightIcon,
@@ -199,11 +509,166 @@ function createTheme() {
199
509
  }
200
510
  }
201
511
  },
512
+ MuiPaper: {
513
+ defaultProps: {
514
+ component: Role.div
515
+ }
516
+ },
517
+ MuiPopover: {
518
+ defaultProps: {
519
+ component: Role.div
520
+ }
521
+ },
522
+ MuiRadio: {
523
+ defaultProps: {
524
+ component: Role.span,
525
+ disableRipple: true,
526
+ // Radio doesn't inherit from ButtonBase
527
+ icon: /* @__PURE__ */ jsx(Nothing, {}),
528
+ checkedIcon: /* @__PURE__ */ jsx(Nothing, {})
529
+ }
530
+ },
531
+ MuiRating: {
532
+ defaultProps: {
533
+ component: Role.span
534
+ }
535
+ },
202
536
  MuiSelect: {
203
537
  defaultProps: {
204
538
  IconComponent: CaretsUpDownIcon
205
539
  }
206
540
  },
541
+ MuiNativeSelect: {
542
+ defaultProps: {
543
+ input: /* @__PURE__ */ jsx(OutlinedInput, {}),
544
+ IconComponent: CaretsUpDownIcon
545
+ }
546
+ },
547
+ MuiSkeleton: {
548
+ defaultProps: {
549
+ component: Role.span
550
+ }
551
+ },
552
+ MuiSlider: {
553
+ defaultProps: {
554
+ component: Role.span
555
+ }
556
+ },
557
+ MuiSnackbar: {
558
+ defaultProps: {
559
+ slotProps: {
560
+ root: {
561
+ component: MuiSnackbar
562
+ }
563
+ }
564
+ }
565
+ },
566
+ MuiSnackbarContent: {
567
+ defaultProps: {
568
+ component: Role.div
569
+ }
570
+ },
571
+ MuiStack: {
572
+ defaultProps: {
573
+ component: Role.div
574
+ }
575
+ },
576
+ MuiStep: {
577
+ defaultProps: {
578
+ component: Role.div
579
+ }
580
+ },
581
+ MuiSwitch: {
582
+ defaultProps: {
583
+ component: Role.span
584
+ }
585
+ },
586
+ MuiStepper: {
587
+ defaultProps: {
588
+ component: Role.div
589
+ }
590
+ },
591
+ MuiStepLabel: {
592
+ defaultProps: {
593
+ slotProps: {
594
+ root: {
595
+ component: Role.div
596
+ },
597
+ stepIcon: {
598
+ component: MuiStepIcon
599
+ }
600
+ }
601
+ }
602
+ },
603
+ MuiSvgIcon: {
604
+ defaultProps: {
605
+ component: Role.svg
606
+ }
607
+ },
608
+ MuiSwipeableDrawer: {
609
+ defaultProps: {
610
+ component: Role.div
611
+ }
612
+ },
613
+ MuiTabs: {
614
+ defaultProps: {
615
+ component: Role.div
616
+ }
617
+ },
618
+ MuiTable: {
619
+ defaultProps: {
620
+ component: withRenderProp(Role, "table")
621
+ }
622
+ },
623
+ MuiTableBody: {
624
+ defaultProps: {
625
+ component: withRenderProp(Role, "tbody"),
626
+ role: void 0
627
+ // Removing role="rowgroup". See https://github.com/iTwin/stratakit/pull/1361
628
+ }
629
+ },
630
+ MuiTableCell: {
631
+ defaultProps: {
632
+ component: MuiTableCell
633
+ }
634
+ },
635
+ MuiTableContainer: {
636
+ defaultProps: {
637
+ component: withRenderProp(Role, "div")
638
+ }
639
+ },
640
+ MuiTableFooter: {
641
+ defaultProps: {
642
+ component: withRenderProp(Role, "tfoot")
643
+ }
644
+ },
645
+ MuiTableHead: {
646
+ defaultProps: {
647
+ component: MuiTableHead
648
+ }
649
+ },
650
+ MuiTablePagination: {
651
+ defaultProps: {
652
+ component: withRenderProp(Role, "td"),
653
+ slotProps: {
654
+ root: {
655
+ colSpan: 999
656
+ }
657
+ }
658
+ }
659
+ },
660
+ MuiTableRow: {
661
+ defaultProps: {
662
+ component: withRenderProp(Role, "tr")
663
+ }
664
+ },
665
+ MuiTableSortLabel: {
666
+ defaultProps: {
667
+ component: Role.span,
668
+ // TODO: This should use sort-ascending and sort-descending icons, but that requires disabling MUI's built-in icon rotation.
669
+ IconComponent: ArrowDownIcon
670
+ }
671
+ },
207
672
  MuiTablePaginationActions: {
208
673
  defaultProps: {
209
674
  slots: {
@@ -214,20 +679,62 @@ function createTheme() {
214
679
  }
215
680
  }
216
681
  },
217
- MuiTableSortLabel: {
682
+ MuiTextField: {
218
683
  defaultProps: {
219
- // TODO: This should use sort-ascending and sort-descending icons, but that requires disabling MUI's built-in icon rotation.
220
- IconComponent: ArrowDownIcon
684
+ component: Role.div
685
+ }
686
+ },
687
+ MuiToggleButton: {
688
+ defaultProps: {
689
+ component: MuiIconButton
690
+ }
691
+ },
692
+ MuiToolbar: {
693
+ defaultProps: {
694
+ component: Role.div
221
695
  }
222
696
  },
223
697
  MuiTooltip: {
224
698
  defaultProps: {
225
699
  describeChild: true
226
700
  }
701
+ },
702
+ MuiTypography: {
703
+ defaultProps: {
704
+ variant: "body2",
705
+ variantMapping: {
706
+ h1: Role.h1,
707
+ h2: Role.h2,
708
+ h3: Role.h3,
709
+ h4: Role.h4,
710
+ h5: Role.h5,
711
+ h6: Role.h6,
712
+ subtitle1: Role.h6,
713
+ subtitle2: Role.h6,
714
+ body1: Role.p,
715
+ body2: Role.p,
716
+ inherit: Role.p,
717
+ button: Role.span,
718
+ caption: Role.span,
719
+ overline: Role.span
720
+ }
721
+ }
227
722
  }
228
723
  }
229
724
  });
230
725
  }
726
+ function withRenderProp(Role2, DefaultTagName) {
727
+ return React.forwardRef((props, forwardedRef) => {
728
+ return /* @__PURE__ */ jsx(Role2, {
729
+ render: /* @__PURE__ */ jsx(DefaultTagName, {}),
730
+ ...props,
731
+ ref: forwardedRef
732
+ });
733
+ });
734
+ }
735
+ function Nothing() {
736
+ return null;
737
+ }
231
738
  export {
232
739
  createTheme
233
740
  };