@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @recursica/mui-adapter
2
2
 
3
+ ## 0.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - adab23c: Revised Dropwdown, Menu, Breadcrumb
8
+
9
+ ## 0.27.0
10
+
11
+ ### Minor Changes
12
+
13
+ - d171a96: Update revision to latest
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [d171a96]
18
+ - @recursica/adapter-common@0.19.0
19
+
3
20
  ## 0.26.0
4
21
 
5
22
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -767,6 +767,45 @@ declare type MenuItemProps = RecursicaOverStyled<MenuItemProps_2>;
767
767
 
768
768
  declare type MenuProps = RecursicaOverStyled<MenuProps_2 & RecursicaMenuProps>;
769
769
 
770
+ /**
771
+ * mergeClassNames
772
+ *
773
+ * Per-slot merge for a `classNames` prop against Recursica's own CSS-module classes. This is
774
+ * NOT the same shape as `withCallerOverride`: the caller's value must never fully replace ours,
775
+ * because the underlying library's `classNames` slots are singular strings — replacing one
776
+ * outright would drop the component's own module styles, not just extend them. Each slot keeps
777
+ * Recursica's class and appends the caller's class for that slot if they supplied one.
778
+ *
779
+ * Merges over the UNION of slots in `ours` and `callerValue`, not just `ours`'s keys — a caller
780
+ * may target a slot Recursica doesn't set a default class for (e.g. a library slot we never
781
+ * needed to style ourselves). Restricting the loop to `ours`'s keys would silently drop that
782
+ * slot instead of passing it through, the same class of prop-leakage bug this whole pattern
783
+ * exists to prevent.
784
+ *
785
+ * @param ours - Recursica's own per-slot classNames (CSS module classes)
786
+ * @param callerValue - The caller's `classNames` prop, if any
787
+ * @returns a new classNames object covering every slot named by either side
788
+ */
789
+ export declare function mergeClassNames<T extends Record<string, string | undefined>>(ours: T, callerValue: Partial<Record<keyof T, string>> | undefined): T;
790
+
791
+ /**
792
+ * mergeStyles
793
+ *
794
+ * Per-slot merge for a `styles` prop (e.g. Mantine's StylesApi) against Recursica's own default
795
+ * inline styles for that slot. Mirrors `mergeClassNames`'s shape but the merge is a plain object
796
+ * merge instead of a string concat, since each slot's value is a `CSSProperties` object, not a
797
+ * class list: the caller's individual style properties override ours property-by-property
798
+ * without dropping properties they didn't touch.
799
+ *
800
+ * Merges over the UNION of slots in `ours` and `callerValue`, not just `ours`'s keys — same
801
+ * reasoning as `mergeClassNames`: a caller may target a slot Recursica has no default for.
802
+ *
803
+ * @param ours - Recursica's own per-slot default styles, if any
804
+ * @param callerValue - The caller's `styles` prop, if any
805
+ * @returns a new styles object covering every slot named by either side
806
+ */
807
+ export declare function mergeStyles<T extends Record<string, default_2.CSSProperties | undefined>>(ours: T, callerValue: Partial<Record<keyof T, default_2.CSSProperties>> | undefined): T;
808
+
770
809
  export declare const Modal: typeof rawComponents.Modal;
771
810
 
772
811
  declare const Modal_2: typeof ModalRoot & {
@@ -874,6 +913,32 @@ declare type NumberInputProps = RecursicaOverStyled<RecursicaNumberInputProps>;
874
913
 
875
914
  declare type OmitSx<T> = Omit<T, "sx">;
876
915
 
916
+ /**
917
+ * omitUnsupportedProps
918
+ *
919
+ * Shared across every adapter. Where `filterStylingProps` blocks the fixed set of styling
920
+ * escape hatches (className, style, sx, etc.), this utility deletes a component-declared list
921
+ * of named props that component doesn't support at all — e.g. a native prop the underlying
922
+ * library exposes but Recursica intentionally doesn't map (`size`, `color`, `radius`, ...).
923
+ *
924
+ * `Omit<LibraryProps, "size">` on the public type already stops well-typed callers. This is the
925
+ * runtime backstop: a plain-JavaScript caller (or anyone forcing the type) can still put `size`
926
+ * on the props object, and without this it would leak straight through `...rest` into the
927
+ * wrapped component. Call this immediately after `filterStylingProps`, on every component
928
+ * (including sub-components merged onto a parent, e.g. `Table.Th`), declaring the omitted keys
929
+ * as a local `UNSUPPORTED_PROPS` const with a comment per prop explaining why it's unsupported.
930
+ *
931
+ * @param props - Props already run through `filterStylingProps`
932
+ * @param unsupportedProps - Component-declared list of prop names to delete. Typed as
933
+ * `PropertyKey`, not `keyof T`, on purpose: `T` is the already-narrowed `rest`/`sanitizedProps`
934
+ * type, which typically has these props `Omit<>`'d out of it already — the whole point of
935
+ * `UNSUPPORTED_PROPS` is to still catch them at runtime. Type `UNSUPPORTED_PROPS` itself
936
+ * against the underlying library's full props type instead, e.g.
937
+ * `as const satisfies readonly (keyof MantineButtonProps)[]`.
938
+ * @returns `props` with every key in `unsupportedProps` removed
939
+ */
940
+ export declare function omitUnsupportedProps<T extends Record<string, unknown>>(props: T, unsupportedProps: readonly PropertyKey[]): Partial<T>;
941
+
877
942
  export declare const Pagination: typeof rawComponents.Pagination;
878
943
 
879
944
  /**
@@ -1586,7 +1651,7 @@ declare interface RecursicaDatePickerProps_2 extends Omit<DatePickerProps, "valu
1586
1651
  style?: default_2.CSSProperties;
1587
1652
  }
1588
1653
 
1589
- export declare interface RecursicaDropdownProps extends Omit<SelectProps, keyof default_2.HTMLAttributes<HTMLDivElement> | "size" | "variant" | "classes" | "inputProps" | "SelectDisplayProps" | "ref" | "error">, Omit<RecursicaFormControlWrapperProps, "controlMaxWidth" | "controlMinWidth">, ReadOnlyControlProps, RecursicaDropdownProps_2 {
1654
+ export declare interface RecursicaDropdownProps extends Omit<SelectProps, keyof default_2.HTMLAttributes<HTMLDivElement> | "size" | "variant" | "classes" | "inputProps" | "SelectDisplayProps" | "ref" | "error">, Pick<SelectProps, "onChange">, Omit<RecursicaFormControlWrapperProps, "controlMaxWidth" | "controlMinWidth" | "onChange">, ReadOnlyControlProps, RecursicaDropdownProps_2 {
1590
1655
  }
1591
1656
 
1592
1657
  /**
@@ -3308,6 +3373,23 @@ declare type TypographyProps_2 = RecursicaOverStyled<Omit<TypographyProps, "vari
3308
3373
  */
3309
3374
  export declare function useGlobalOverStyled(): boolean;
3310
3375
 
3376
+ /**
3377
+ * withCallerOverride
3378
+ *
3379
+ * Resolves a single prop where Recursica supplies a default but the caller should be able to
3380
+ * override it. Use this only when the default can't be expressed as a plain destructured default
3381
+ * (`const { variant = "solid" } = props`) — e.g. the default is computed from other props/state
3382
+ * inside the component body, so it isn't known until after `rest` has already been destructured.
3383
+ *
3384
+ * Do not rely on spread order for this (`{...sanitizedProps, ...overrides}` never carries this
3385
+ * intent implicitly) — resolve the value explicitly and place the result in `overrides`.
3386
+ *
3387
+ * @param ourDefault - The value Recursica falls back to when the caller didn't supply one
3388
+ * @param callerValue - The raw value from the caller's props, if any
3389
+ * @returns `callerValue` if defined, else `ourDefault`
3390
+ */
3391
+ export declare function withCallerOverride<T>(ourDefault: T, callerValue: T | undefined): T;
3392
+
3311
3393
  /**
3312
3394
  * Universal execution barrier trapping readOnly states globally.
3313
3395
  * Natively delegates active logic down avoiding duplicative internal component bindings dynamically.