@stratakit/mui 0.4.2 → 0.5.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 (44) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/DEV/Root.internal.js +1 -1
  3. package/dist/DEV/Root.js +43 -21
  4. package/dist/DEV/styles.css.js +1 -1
  5. package/dist/DEV/~components/MuiAccordion.js +36 -0
  6. package/dist/DEV/~components/MuiAlert.js +37 -0
  7. package/dist/DEV/~components/MuiAutocomplete.js +134 -11
  8. package/dist/DEV/~components/MuiBadge.js +24 -5
  9. package/dist/DEV/~components/MuiCard.js +53 -9
  10. package/dist/DEV/~components/MuiDivider.js +13 -3
  11. package/dist/DEV/~components/MuiMenu.js +22 -0
  12. package/dist/DEV/~components/MuiPopover.js +40 -0
  13. package/dist/DEV/~components/MuiTabs.js +43 -0
  14. package/dist/DEV/~components/MuiTypography.js +16 -13
  15. package/dist/DEV/~createTheme.js +142 -53
  16. package/dist/Root.internal.d.ts +1 -1
  17. package/dist/Root.internal.js +1 -1
  18. package/dist/Root.js +13 -4
  19. package/dist/styles.css.js +1 -1
  20. package/dist/types.d.ts +151 -5
  21. package/dist/~components/MuiAccordion.d.ts +11 -0
  22. package/dist/~components/MuiAccordion.js +30 -0
  23. package/dist/~components/MuiAlert.d.ts +4 -0
  24. package/dist/~components/MuiAlert.js +38 -0
  25. package/dist/~components/MuiAutocomplete.d.ts +4 -1
  26. package/dist/~components/MuiAutocomplete.js +132 -12
  27. package/dist/~components/MuiBadge.d.ts +6 -4
  28. package/dist/~components/MuiBadge.js +24 -4
  29. package/dist/~components/MuiCard.d.ts +2 -1
  30. package/dist/~components/MuiCard.js +67 -12
  31. package/dist/~components/MuiChip.d.ts +1 -1
  32. package/dist/~components/MuiDivider.d.ts +1 -1
  33. package/dist/~components/MuiDivider.js +3 -1
  34. package/dist/~components/MuiMenu.d.ts +7 -0
  35. package/dist/~components/MuiMenu.js +25 -0
  36. package/dist/~components/MuiPopover.d.ts +10 -0
  37. package/dist/~components/MuiPopover.js +62 -0
  38. package/dist/~components/MuiTabs.d.ts +8 -0
  39. package/dist/~components/MuiTabs.js +33 -0
  40. package/dist/~components/MuiTypography.d.ts +17 -1
  41. package/dist/~components/MuiTypography.js +13 -12
  42. package/dist/~createTheme.d.ts +4 -1
  43. package/dist/~createTheme.js +149 -70
  44. package/package.json +8 -8
@@ -1,3 +1,6 @@
1
+ interface CreateThemeArgs {
2
+ portalContainer?: HTMLElement | null;
3
+ }
1
4
  /** Creates a StrataKit theme for MUI. Should be used with MUI's `ThemeProvider`. */
2
- declare function createTheme(): import("@mui/material/styles").Theme;
5
+ declare function createTheme(args: CreateThemeArgs): import("@mui/material/styles").Theme;
3
6
  export { createTheme };
@@ -5,23 +5,31 @@ 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";
8
+ import { MuiAccordionRootSlot, MuiAccordionSummary } from "./~components/MuiAccordion.js";
9
+ import { MuiAlert, MuiAlertTitle } from "./~components/MuiAlert.js";
10
+ import { MuiAutocomplete, MuiAutocompleteChip, MuiAutocompleteChipDeleteIcon, MuiAutocompleteClearIndicator } from "./~components/MuiAutocomplete.js";
9
11
  import { MuiAvatarGroup } from "./~components/MuiAvatarGroup.js";
10
- import { MuiBadge } from "./~components/MuiBadge.js";
12
+ import { MuiBadge, MuiBadgeBadge } from "./~components/MuiBadge.js";
11
13
  import { MuiBottomNavigationAction } from "./~components/MuiBottomNavigation.js";
12
14
  import { MuiButtonBase } from "./~components/MuiButtonBase.js";
13
- import { MuiCard, MuiCardActionArea, MuiCardMedia } from "./~components/MuiCard.js";
15
+ import { MuiCard, MuiCardActionArea, MuiCardHeaderTitle, MuiCardMedia } from "./~components/MuiCard.js";
14
16
  import { MuiChip, MuiChipDeleteIcon, MuiChipLabel } from "./~components/MuiChip.js";
15
17
  import { MuiDivider } from "./~components/MuiDivider.js";
16
18
  import { MuiIconButton } from "./~components/MuiIconButton.js";
17
19
  import { MuiInputLabel } from "./~components/MuiInputLabel.js";
20
+ import { MuiMenuListSlot } from "./~components/MuiMenu.js";
21
+ import { MuiPopoverPaperSlot } from "./~components/MuiPopover.js";
18
22
  import { MuiSnackbar } from "./~components/MuiSnackbar.js";
19
23
  import { MuiStepIcon } from "./~components/MuiStepper.js";
20
24
  import { MuiTableBody, MuiTableCell, MuiTableHead } from "./~components/MuiTable.js";
25
+ import { MuiTab, MuiTabs } from "./~components/MuiTabs.js";
21
26
  import { MuiToggleButton } from "./~components/MuiToggleButton.js";
22
- import { MuiTypography } from "./~components/MuiTypography.js";
27
+ import { MuiTypography, variantMapping } from "./~components/MuiTypography.js";
23
28
  import { ArrowDownIcon, CaretsUpDownIcon, ChevronDownIcon, ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, DismissIcon, ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from "./Icon.js";
24
- function createTheme() {
29
+ function createTheme(args) {
30
+ const {
31
+ portalContainer: container
32
+ } = args;
25
33
  const palette = {
26
34
  primary: {
27
35
  main: "var(--stratakit-mui-palette-primary-main)"
@@ -72,31 +80,35 @@ function createTheme() {
72
80
  fontSize: 14
73
81
  },
74
82
  h1: {
75
- fontSize: 48
83
+ fontSize: 20
76
84
  },
77
85
  h2: {
78
- fontSize: 40
86
+ fontSize: 18
79
87
  },
80
88
  h3: {
81
- fontSize: 32
89
+ fontSize: 16
82
90
  },
83
91
  h4: {
84
- fontSize: 28
92
+ fontSize: 14
85
93
  },
86
94
  h5: {
87
- fontSize: 24
95
+ fontSize: 12
88
96
  },
89
97
  h6: {
90
- fontSize: 20
98
+ fontSize: 12
91
99
  },
92
100
  caption: {
93
101
  fontSize: 12
94
102
  },
103
+ overline: {
104
+ fontSize: 12,
105
+ textTransform: "none"
106
+ },
95
107
  subtitle1: {
96
- fontSize: 12
108
+ fontSize: 16
97
109
  },
98
110
  subtitle2: {
99
- fontSize: 11
111
+ fontSize: 14
100
112
  }
101
113
  },
102
114
  shadows: [
@@ -123,6 +135,10 @@ function createTheme() {
123
135
  MuiAccordion: {
124
136
  defaultProps: {
125
137
  component: Role.div,
138
+ disableGutters: true,
139
+ slots: {
140
+ root: MuiAccordionRootSlot
141
+ },
126
142
  slotProps: {
127
143
  region: {
128
144
  role: void 0,
@@ -133,26 +149,34 @@ function createTheme() {
133
149
  },
134
150
  MuiAccordionSummary: {
135
151
  defaultProps: {
136
- component: Role.div,
152
+ component: MuiAccordionSummary,
137
153
  nativeButton: false,
138
154
  expandIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {})
139
155
  }
140
156
  },
141
157
  MuiAlert: {
142
158
  defaultProps: {
143
- component: Role.div,
159
+ component: MuiAlert,
144
160
  variant: "outlined",
161
+ severity: "none",
162
+ role: "group",
163
+ // Overriding role="alert".
145
164
  iconMapping: {
146
165
  error: /* @__PURE__ */ jsx(ErrorIcon, {}),
147
166
  info: /* @__PURE__ */ jsx(InfoIcon, {}),
148
167
  success: /* @__PURE__ */ jsx(SuccessIcon, {}),
149
168
  warning: /* @__PURE__ */ jsx(WarningIcon, {})
169
+ },
170
+ slotProps: {
171
+ closeButton: {
172
+ edge: "end"
173
+ }
150
174
  }
151
175
  }
152
176
  },
153
177
  MuiAlertTitle: {
154
178
  defaultProps: {
155
- component: Role.div
179
+ component: MuiAlertTitle
156
180
  }
157
181
  },
158
182
  MuiAutocomplete: {
@@ -165,6 +189,7 @@ function createTheme() {
165
189
  }, option, _, ownerState) => /* @__PURE__ */ jsx("li", {
166
190
  ...props,
167
191
  className: cx("MuiMenuItem-root", props.className),
192
+ "data-_sk-dense": ownerState.size === "small" ? "" : void 0,
168
193
  children: ownerState.getOptionLabel(option)
169
194
  }, key),
170
195
  slotProps: {
@@ -176,9 +201,12 @@ function createTheme() {
176
201
  // match Menu elevation
177
202
  },
178
203
  chip: {
179
- size: "small"
204
+ size: "small",
205
+ component: MuiAutocompleteChip,
206
+ deleteIcon: /* @__PURE__ */ jsx(MuiAutocompleteChipDeleteIcon, {})
180
207
  },
181
208
  clearIndicator: {
209
+ component: MuiAutocompleteClearIndicator,
182
210
  tabIndex: 0,
183
211
  // make clear indicator focusable
184
212
  size: "small"
@@ -223,7 +251,12 @@ function createTheme() {
223
251
  MuiBadge: {
224
252
  defaultProps: {
225
253
  component: MuiBadge,
226
- color: "secondary"
254
+ color: "secondary",
255
+ slotProps: {
256
+ badge: {
257
+ component: MuiBadgeBadge
258
+ }
259
+ }
227
260
  }
228
261
  },
229
262
  MuiBottomNavigation: {
@@ -266,12 +299,16 @@ function createTheme() {
266
299
  },
267
300
  MuiCard: {
268
301
  defaultProps: {
269
- component: MuiCard
302
+ component: MuiCard,
303
+ variant: "outlined"
270
304
  }
271
305
  },
272
306
  MuiCardActionArea: {
273
307
  defaultProps: {
274
- component: MuiCardActionArea
308
+ component: MuiCardActionArea,
309
+ slots: {
310
+ focusHighlight: Nothing
311
+ }
275
312
  }
276
313
  },
277
314
  MuiCardContent: {
@@ -285,7 +322,7 @@ function createTheme() {
285
322
  slotProps: {
286
323
  title: {
287
324
  // biome-ignore lint/suspicious/noExplicitAny: MUI's CardHeader.title.component is hardcoded to "span"
288
- component: Role.h2
325
+ component: MuiCardHeaderTitle
289
326
  }
290
327
  }
291
328
  }
@@ -334,7 +371,8 @@ function createTheme() {
334
371
  },
335
372
  MuiDialogTitle: {
336
373
  defaultProps: {
337
- component: Role.h2
374
+ component: Role.h2,
375
+ variant: "body-lg"
338
376
  }
339
377
  },
340
378
  MuiDivider: {
@@ -410,50 +448,7 @@ function createTheme() {
410
448
  defaultProps: {
411
449
  component: Role.a,
412
450
  color: "textPrimary"
413
- },
414
- variants: [{
415
- props: {
416
- color: "primary"
417
- },
418
- style: {
419
- color: "var(--stratakit-color-text-accent-strong)"
420
- }
421
- }, {
422
- props: {
423
- color: "secondary"
424
- },
425
- style: {
426
- color: "var(--stratakit-color-text-neutral-primary)"
427
- }
428
- }, {
429
- props: {
430
- color: "error"
431
- },
432
- style: {
433
- color: "var(--stratakit-color-text-critical-base)"
434
- }
435
- }, {
436
- props: {
437
- color: "info"
438
- },
439
- style: {
440
- color: "var(--stratakit-color-text-info-base)"
441
- }
442
- }, {
443
- props: {
444
- color: "success"
445
- },
446
- style: {
447
- color: "var(--stratakit-color-text-positive-base)"
448
- }
449
- }, {
450
- props: {
451
- color: "warning"
452
- },
453
- style: {
454
- color: "var(--stratakit-color-text-attention-base)"
455
- }
456
- }]
451
+ }
457
452
  },
458
453
  MuiList: {
459
454
  defaultProps: {
@@ -488,6 +483,9 @@ function createTheme() {
488
483
  MuiMenu: {
489
484
  defaultProps: {
490
485
  component: Role.div,
486
+ slots: {
487
+ list: MuiMenuListSlot
488
+ },
491
489
  slotProps: {
492
490
  paper: {
493
491
  role: "presentation"
@@ -513,7 +511,8 @@ function createTheme() {
513
511
  },
514
512
  MuiModal: {
515
513
  defaultProps: {
516
- component: Role.div
514
+ component: Role.div,
515
+ container
517
516
  }
518
517
  },
519
518
  MuiOutlinedInput: {
@@ -547,6 +546,12 @@ function createTheme() {
547
546
  MuiPopover: {
548
547
  defaultProps: {
549
548
  component: Role.div,
549
+ disableScrollLock: true,
550
+ // Popover passes down `container` prop to `Modal` https://github.com/mui/material-ui/blob/708ef10e874efa63d2e4972bd902befa1912f2dc/packages/mui-material/src/Popover/Popover.js#L389
551
+ container,
552
+ slots: {
553
+ paper: MuiPopoverPaperSlot
554
+ },
550
555
  slotProps: {
551
556
  paper: {
552
557
  role: "dialog"
@@ -554,6 +559,11 @@ function createTheme() {
554
559
  }
555
560
  }
556
561
  },
562
+ MuiPopper: {
563
+ defaultProps: {
564
+ container
565
+ }
566
+ },
557
567
  MuiRadio: {
558
568
  defaultProps: {
559
569
  component: Role.span,
@@ -656,7 +666,25 @@ function createTheme() {
656
666
  },
657
667
  MuiTabs: {
658
668
  defaultProps: {
659
- component: Role.div
669
+ component: MuiTabs,
670
+ allowScrollButtonsMobile: true,
671
+ slotProps: {
672
+ scrollButtons: {
673
+ "aria-hidden": true
674
+ },
675
+ startScrollButtonIcon: {
676
+ component: ChevronLeftIcon
677
+ },
678
+ endScrollButtonIcon: {
679
+ component: ChevronRightIcon
680
+ }
681
+ }
682
+ }
683
+ },
684
+ MuiTab: {
685
+ defaultProps: {
686
+ component: MuiTab,
687
+ iconPosition: "start"
660
688
  }
661
689
  },
662
690
  MuiTable: {
@@ -756,9 +784,60 @@ function createTheme() {
756
784
  },
757
785
  MuiTypography: {
758
786
  defaultProps: {
759
- variant: "body2",
787
+ variant: "inherit",
788
+ variantMapping,
760
789
  component: MuiTypography
761
- }
790
+ },
791
+ variants: [{
792
+ props: {
793
+ color: "primary"
794
+ },
795
+ style: {
796
+ color: "var(--stratakit-color-text-accent-strong)"
797
+ }
798
+ }, {
799
+ props: {
800
+ color: "secondary"
801
+ },
802
+ style: {
803
+ color: "var(--stratakit-color-text-neutral-primary)"
804
+ }
805
+ }, {
806
+ props: {
807
+ color: "textTertiary"
808
+ },
809
+ style: {
810
+ color: "var(--stratakit-color-text-neutral-tertiary)"
811
+ }
812
+ }, {
813
+ props: {
814
+ color: "error"
815
+ },
816
+ style: {
817
+ color: "var(--stratakit-color-text-critical-base)"
818
+ }
819
+ }, {
820
+ props: {
821
+ color: "info"
822
+ },
823
+ style: {
824
+ color: "var(--stratakit-color-text-info-base)"
825
+ }
826
+ }, {
827
+ props: {
828
+ color: "success"
829
+ },
830
+ style: {
831
+ color: "var(--stratakit-color-text-positive-base)"
832
+ }
833
+ }, {
834
+ props: {
835
+ color: "warning"
836
+ },
837
+ style: {
838
+ color: "var(--stratakit-color-text-attention-base)"
839
+ }
840
+ }]
762
841
  }
763
842
  }
764
843
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stratakit/mui",
3
3
  "type": "module",
4
- "version": "0.4.2",
4
+ "version": "0.5.1",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "types": "./dist/index.d.ts",
@@ -45,21 +45,21 @@
45
45
  "design system"
46
46
  ],
47
47
  "dependencies": {
48
- "@ariakit/react": "^0.4.25",
48
+ "@ariakit/react": "^0.4.29",
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.8",
53
- "@stratakit/icons": "^0.3.2",
52
+ "@stratakit/foundations": "^0.4.9",
53
+ "@stratakit/icons": "^0.4.1",
54
54
  "classnames": "^2.5.1",
55
55
  "react-compiler-runtime": "^1.0.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@types/react": "^19.2.14",
58
+ "@types/react": "^19.2.16",
59
59
  "@types/react-dom": "^19.2.3",
60
- "esbuild": "^0.27.7",
61
- "react": "^19.2.5",
62
- "react-dom": "^19.2.5",
60
+ "esbuild": "^0.28.0",
61
+ "react": "^19.2.7",
62
+ "react-dom": "^19.2.7",
63
63
  "typescript": "~6.0.3"
64
64
  },
65
65
  "peerDependencies": {