@recursica/mui-adapter 0.26.0 → 0.28.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/index.d.ts +83 -1
  3. package/dist/mui-adapter.cjs +73 -73
  4. package/dist/mui-adapter.cjs.map +1 -1
  5. package/dist/mui-adapter.css +1 -1
  6. package/dist/mui-adapter.js +9400 -9255
  7. package/dist/mui-adapter.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/components/Autocomplete/Autocomplete.tsx +46 -34
  10. package/src/components/Avatar/Avatar.tsx +11 -21
  11. package/src/components/Badge/Badge.tsx +9 -13
  12. package/src/components/Breadcrumb/Breadcrumb.module.css +10 -5
  13. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +0 -6
  14. package/src/components/Breadcrumb/Breadcrumb.tsx +13 -18
  15. package/src/components/Button/Button.tsx +17 -11
  16. package/src/components/Card/Card.tsx +9 -19
  17. package/src/components/Checkbox/Checkbox.tsx +22 -26
  18. package/src/components/Checkbox/CheckboxGroup.tsx +3 -3
  19. package/src/components/Chip/Chip.tsx +12 -19
  20. package/src/components/Dropdown/BareDropdown.tsx +14 -8
  21. package/src/components/Dropdown/Dropdown.icons.tsx +33 -0
  22. package/src/components/Dropdown/Dropdown.module.css +117 -15
  23. package/src/components/Dropdown/Dropdown.stories.tsx +21 -0
  24. package/src/components/Dropdown/Dropdown.tsx +102 -17
  25. package/src/components/Dropdown/USAGE.md +7 -0
  26. package/src/components/FileInput/FileInput.tsx +1 -1
  27. package/src/components/FileUpload/FileUpload.tsx +1 -1
  28. package/src/components/FormControlLayout/FormControlLayout.tsx +1 -1
  29. package/src/components/FormControlWrapper/FormControlWrapper.tsx +1 -1
  30. package/src/components/HoverCard/HoverCard.module.css +25 -3
  31. package/src/components/HoverCard/HoverCard.tsx +13 -21
  32. package/src/components/Menu/Menu.module.css +3 -0
  33. package/src/components/Menu/Menu.stories.tsx +128 -5
  34. package/src/components/Menu/Menu.tsx +15 -7
  35. package/src/components/Modal/Modal.tsx +12 -6
  36. package/src/components/NumberInput/NumberInput.tsx +30 -15
  37. package/src/components/Pagination/Pagination.tsx +5 -15
  38. package/src/components/Panel/Panel.tsx +17 -25
  39. package/src/components/Popover/Popover.tsx +10 -18
  40. package/src/components/Radio/Radio.tsx +21 -26
  41. package/src/components/Radio/RadioGroup.tsx +3 -4
  42. package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +1 -1
  43. package/src/components/SegmentedControl/SegmentedControl.tsx +20 -25
  44. package/src/components/Slider/Slider.tsx +40 -43
  45. package/src/components/Stepper/Stepper.tsx +34 -14
  46. package/src/components/Switch/Switch.tsx +33 -49
  47. package/src/components/Switch/SwitchGroup.tsx +3 -3
  48. package/src/components/Tabs/Tabs.tsx +12 -4
  49. package/src/components/TextArea/TextArea.tsx +30 -7
  50. package/src/components/TextField/TextField.tsx +30 -26
  51. package/src/components/Timeline/Timeline.tsx +9 -1
  52. package/src/components/Timeline/TimelineItem.tsx +2 -2
  53. package/src/components/Toast/Toast.tsx +14 -23
  54. package/src/components/Tooltip/Tooltip.tsx +14 -27
  55. package/src/components/TransferList/TransferList.tsx +1 -1
  56. package/src/utils/filterStylingProps.ts +4 -0
@@ -4,6 +4,7 @@ import {
4
4
  } from "@mui/material";
5
5
  import {
6
6
  filterStylingProps,
7
+ mergeClassNames,
7
8
  type RecursicaOverStyled,
8
9
  } from "../../utils/filterStylingProps";
9
10
  import styles from "./Tooltip.module.css";
@@ -48,32 +49,18 @@ const TooltipBase = function Tooltip({
48
49
  const { title, ...restProps } = rest;
49
50
  const sanitizedProps = filterStylingProps(restProps, overStyled);
50
51
 
51
- // Bind CSS module classes to Mui's internal classNames API
52
- const mergedClassNames: Partial<Record<string, string>> = {
53
- tooltip: styles.tooltip,
54
- arrow: styles.arrow,
55
- };
56
-
57
- const classNamesProp = (sanitizedProps as Record<string, unknown>).classNames;
58
- if (
59
- classNamesProp &&
60
- typeof classNamesProp === "object" &&
61
- !Array.isArray(classNamesProp)
62
- ) {
63
- const o = classNamesProp as Record<string, string>;
64
- Object.keys(o).forEach((key) => {
65
- if (mergedClassNames[key]) {
66
- mergedClassNames[key] = `${mergedClassNames[key]} ${o[key]}`;
67
- } else {
68
- mergedClassNames[key] = o[key];
69
- }
70
- });
71
- }
72
-
73
- const withArrow = (sanitizedProps as Record<string, unknown>).withArrow as
74
- | boolean
75
- | undefined;
76
- const resolvedWithArrow = withBeak ?? withArrow;
52
+ // Bind CSS module classes to Mui's internal classNames API. Note MUI's actual prop is
53
+ // "classes", not "classNames" (that's Mantine's naming) — this used to read the wrong key,
54
+ // silently no-op-ing any caller-supplied classes.
55
+ const mergedClassNames = mergeClassNames(
56
+ {
57
+ tooltip: styles.tooltip,
58
+ arrow: styles.arrow,
59
+ },
60
+ (sanitizedProps as Record<string, unknown>).classes as
61
+ | Partial<Record<string, string>>
62
+ | undefined,
63
+ );
77
64
 
78
65
  return (
79
66
  <MuiTooltip
@@ -81,7 +68,7 @@ const TooltipBase = function Tooltip({
81
68
  title={label || title || ""}
82
69
  open={opened}
83
70
  placement="top" /* Recursica default; Mui defaults to "bottom" */
84
- arrow={resolvedWithArrow}
71
+ arrow={withBeak}
85
72
  classes={mergedClassNames}
86
73
  />
87
74
  );
@@ -346,10 +346,10 @@ export const TransferList = forwardRef<HTMLDivElement, TransferListProps>(
346
346
  readOnlyNativeProps={props}
347
347
  activeComponent={
348
348
  <div
349
+ {...(sanitizedProps as Record<string, unknown>)}
349
350
  className={styles.root}
350
351
  data-disabled={disabled ? "true" : undefined}
351
352
  data-error={error ? "true" : undefined}
352
- {...(sanitizedProps as Record<string, unknown>)}
353
353
  >
354
354
  <div className={styles.panes}>
355
355
  {renderPane(
@@ -58,6 +58,10 @@ export {
58
58
  type BlockedStylingKeys,
59
59
  type ForbiddenStyles,
60
60
  type WithRecursicaSpacing,
61
+ omitUnsupportedProps,
62
+ withCallerOverride,
63
+ mergeClassNames,
64
+ mergeStyles,
61
65
  } from "@recursica/adapter-common";
62
66
 
63
67
  const LAYOUT_PROPS = new Set([