@recursica/mui-adapter 0.25.0 → 0.27.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 (78) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/index.d.ts +105 -19
  3. package/dist/mui-adapter.cjs +77 -77
  4. package/dist/mui-adapter.cjs.map +1 -1
  5. package/dist/mui-adapter.css +1 -1
  6. package/dist/mui-adapter.js +29867 -25282
  7. package/dist/mui-adapter.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/GlobalExemptions.modules.css +0 -6
  10. package/src/components/Accordion/Accordion.module.css +0 -8
  11. package/src/components/Autocomplete/Autocomplete.module.css +0 -8
  12. package/src/components/Autocomplete/Autocomplete.tsx +46 -34
  13. package/src/components/Avatar/Avatar.module.css +0 -8
  14. package/src/components/Avatar/Avatar.tsx +11 -21
  15. package/src/components/Badge/Badge.tsx +9 -13
  16. package/src/components/Breadcrumb/Breadcrumb.tsx +12 -18
  17. package/src/components/Button/Button.module.css +0 -13
  18. package/src/components/Button/Button.tsx +17 -11
  19. package/src/components/Card/Card.tsx +9 -19
  20. package/src/components/Checkbox/Checkbox.tsx +22 -26
  21. package/src/components/Checkbox/CheckboxGroup.tsx +3 -3
  22. package/src/components/Chip/Chip.module.css +0 -27
  23. package/src/components/Chip/Chip.tsx +12 -19
  24. package/src/components/DatePicker/DATEPICKER_IMPLEMENTATION_NOTES.md +29 -0
  25. package/src/components/DatePicker/DatePicker.icons.tsx +35 -0
  26. package/src/components/DatePicker/DatePicker.module.css +451 -42
  27. package/src/components/DatePicker/DatePicker.stories.tsx +23 -25
  28. package/src/components/DatePicker/DatePicker.tsx +229 -47
  29. package/src/components/DatePicker/USAGE.md +14 -1
  30. package/src/components/Dropdown/BareDropdown.tsx +14 -8
  31. package/src/components/Dropdown/Dropdown.module.css +0 -7
  32. package/src/components/Dropdown/Dropdown.tsx +13 -6
  33. package/src/components/FileInput/FileInput.module.css +0 -21
  34. package/src/components/FileInput/FileInput.tsx +1 -1
  35. package/src/components/FileUpload/FileUpload.module.css +0 -11
  36. package/src/components/FileUpload/FileUpload.tsx +1 -1
  37. package/src/components/FormControlLayout/FormControlLayout.tsx +1 -1
  38. package/src/components/FormControlWrapper/FormControlWrapper.tsx +1 -1
  39. package/src/components/HoverCard/HoverCard.module.css +1 -7
  40. package/src/components/HoverCard/HoverCard.tsx +13 -21
  41. package/src/components/Label/Label.module.css +0 -6
  42. package/src/components/Link/Link.module.css +0 -13
  43. package/src/components/Menu/Menu.module.css +0 -5
  44. package/src/components/Menu/Menu.tsx +14 -6
  45. package/src/components/Modal/Modal.module.css +0 -11
  46. package/src/components/Modal/Modal.tsx +12 -6
  47. package/src/components/NumberInput/NumberInput.module.css +0 -7
  48. package/src/components/NumberInput/NumberInput.tsx +30 -15
  49. package/src/components/Pagination/Pagination.module.css +0 -81
  50. package/src/components/Pagination/Pagination.tsx +5 -15
  51. package/src/components/Panel/Panel.tsx +17 -25
  52. package/src/components/Popover/Popover.module.css +0 -5
  53. package/src/components/Popover/Popover.tsx +10 -18
  54. package/src/components/Radio/Radio.tsx +21 -26
  55. package/src/components/Radio/RadioGroup.tsx +3 -4
  56. package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +1 -1
  57. package/src/components/SegmentedControl/SegmentedControl.module.css +0 -8
  58. package/src/components/SegmentedControl/SegmentedControl.tsx +20 -25
  59. package/src/components/Slider/Slider.tsx +40 -43
  60. package/src/components/Stepper/Stepper.tsx +34 -14
  61. package/src/components/Switch/Switch.tsx +33 -49
  62. package/src/components/Switch/SwitchGroup.tsx +3 -3
  63. package/src/components/Tabs/Tabs.tsx +12 -4
  64. package/src/components/TextArea/TextArea.module.css +0 -7
  65. package/src/components/TextArea/TextArea.tsx +30 -7
  66. package/src/components/TextField/TextField.module.css +0 -8
  67. package/src/components/TextField/TextField.tsx +30 -26
  68. package/src/components/TimePicker/TimePicker.module.css +0 -16
  69. package/src/components/Timeline/Timeline.module.css +0 -6
  70. package/src/components/Timeline/Timeline.tsx +9 -1
  71. package/src/components/Timeline/TimelineItem.tsx +2 -2
  72. package/src/components/Toast/Toast.module.css +0 -7
  73. package/src/components/Toast/Toast.tsx +14 -23
  74. package/src/components/Tooltip/Tooltip.module.css +0 -9
  75. package/src/components/Tooltip/Tooltip.tsx +14 -27
  76. package/src/components/TransferList/TransferList.module.css +0 -8
  77. package/src/components/TransferList/TransferList.tsx +1 -1
  78. package/src/utils/filterStylingProps.ts +4 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @recursica/mui-adapter
2
2
 
3
+ ## 0.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d171a96: Update revision to latest
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [d171a96]
12
+ - @recursica/adapter-common@0.19.0
13
+
14
+ ## 0.26.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 015c809: Implemented DatePicker (was a non-functional placeholder stub). Wraps MUI X's `DatePicker` with the same token mapping as the mantine-adapter's DatePicker: tokenized field border/background/text, a default token-styled calendar popover (hover, today, disabled/outside days, selected-day fill, header nav/month-label as Recursica text buttons), default `MM/DD/YY` format, and a default calendar icon that opens the picker (overridable via `slots.openPickerIcon`). `value`/`defaultValue`/`onChange` use plain `Date`, matching the mantine-adapter's convention.
19
+
20
+ ### Patch Changes
21
+
22
+ - 56e0d63: Remove all `recursica-ignore` exemption comments so the token analyzer report reflects true unused/unimplemented Figma variables. No runtime behavior change.
23
+
3
24
  ## 0.25.0
4
25
 
5
26
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -14,6 +14,9 @@ import { CheckboxProps as CheckboxProps_2 } from '@mui/material';
14
14
  import { ChipProps as ChipProps_2 } from '@mui/material';
15
15
  import { CommonProps } from '@mui/material/OverridableComponent';
16
16
  import { ContainerProps as ContainerProps_2 } from '@mui/material';
17
+ import { DatePickerProps } from '@mui/x-date-pickers/DatePicker';
18
+ import { DatePickerSlotProps } from '@mui/x-date-pickers/DatePicker';
19
+ import { DatePickerSlots } from '@mui/x-date-pickers/DatePicker';
17
20
  import { default as default_2 } from 'react';
18
21
  import { DetailedHTMLProps } from 'react';
19
22
  import { DialogActionsProps } from '@mui/material';
@@ -445,25 +448,9 @@ export declare const copyToClipboard: (textToCopy: string, componentRef: default
445
448
 
446
449
  export declare const DatePicker: typeof rawComponents.DatePicker;
447
450
 
448
- declare const DatePicker_2: default_2.FC<DatePickerProps>;
451
+ declare const DatePicker_2: default_2.ForwardRefExoticComponent<DatePickerProps_2 & default_2.RefAttributes<HTMLDivElement>>;
449
452
 
450
- declare type DatePickerProps = Omit<default_2.HTMLAttributes<HTMLDivElement>, "value" | "onChange" | "defaultValue"> & RecursicaDatePickerProps & {
451
- disabled?: boolean;
452
- label?: default_2.ReactNode;
453
- assistiveText?: string;
454
- error?: default_2.ReactNode;
455
- required?: boolean;
456
- withAsterisk?: boolean;
457
- placeholder?: string;
458
- value?: Date | null;
459
- defaultValue?: Date | null;
460
- onChange?: (value: Date | null) => void;
461
- readOnly?: boolean;
462
- formLayout?: "stacked" | "side-by-side";
463
- leftSection?: default_2.ReactNode;
464
- labelWithEditIcon?: boolean;
465
- onLabelEditClick?: () => void;
466
- };
453
+ declare type DatePickerProps_2 = RecursicaOverStyled<RecursicaDatePickerProps_2>;
467
454
 
468
455
  export declare const Dropdown: typeof rawComponents.Dropdown;
469
456
 
@@ -780,6 +767,45 @@ declare type MenuItemProps = RecursicaOverStyled<MenuItemProps_2>;
780
767
 
781
768
  declare type MenuProps = RecursicaOverStyled<MenuProps_2 & RecursicaMenuProps>;
782
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
+
783
809
  export declare const Modal: typeof rawComponents.Modal;
784
810
 
785
811
  declare const Modal_2: typeof ModalRoot & {
@@ -887,6 +913,32 @@ declare type NumberInputProps = RecursicaOverStyled<RecursicaNumberInputProps>;
887
913
 
888
914
  declare type OmitSx<T> = Omit<T, "sx">;
889
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
+
890
942
  export declare const Pagination: typeof rawComponents.Pagination;
891
943
 
892
944
  /**
@@ -1146,7 +1198,8 @@ declare namespace rawComponents {
1146
1198
  Chip_2 as Chip,
1147
1199
  ContainerProps,
1148
1200
  Container_2 as Container,
1149
- DatePickerProps,
1201
+ RecursicaDatePickerProps_2 as RecursicaDatePickerProps,
1202
+ DatePickerProps_2 as DatePickerProps,
1150
1203
  DatePicker_2 as DatePicker,
1151
1204
  RecursicaDropdownProps,
1152
1205
  DropdownProps,
@@ -1582,6 +1635,22 @@ export declare interface RecursicaContainerProps {
1582
1635
  export declare interface RecursicaDatePickerProps {
1583
1636
  }
1584
1637
 
1638
+ declare interface RecursicaDatePickerProps_2 extends Omit<DatePickerProps, "value" | "defaultValue" | "onChange" | "minDate" | "maxDate" | "format" | "slots" | "slotProps">, Pick<RecursicaFormControlWrapperProps, "label" | "error" | "required" | "id" | "assistiveText" | "assistiveWithIcon" | "formLayout" | "labelSize" | "labelAlignment" | "labelOptionalText" | "labelWithEditIcon" | "onLabelEditClick">, ReadOnlyControlProps, RecursicaDatePickerProps {
1639
+ /** Selected date, matching the mantine-adapter convention of a plain `Date` value. */
1640
+ value?: Date | null;
1641
+ /** Uncontrolled initial date. */
1642
+ defaultValue?: Date | null;
1643
+ /** Fires with the new date, or `null` if cleared. */
1644
+ onChange?: (value: Date | null) => void;
1645
+ minDate?: Date;
1646
+ maxDate?: Date;
1647
+ /** Overridable component slots — e.g. `slots={{ openPickerIcon: MyIcon }}` to replace the default calendar icon. */
1648
+ slots?: DatePickerSlots;
1649
+ slotProps?: DatePickerSlotProps;
1650
+ /** Caller-provided inline style, passed through to the FormControlWrapper root. */
1651
+ style?: default_2.CSSProperties;
1652
+ }
1653
+
1585
1654
  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 {
1586
1655
  }
1587
1656
 
@@ -3304,6 +3373,23 @@ declare type TypographyProps_2 = RecursicaOverStyled<Omit<TypographyProps, "vari
3304
3373
  */
3305
3374
  export declare function useGlobalOverStyled(): boolean;
3306
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
+
3307
3393
  /**
3308
3394
  * Universal execution barrier trapping readOnly states globally.
3309
3395
  * Natively delegates active logic down avoiding duplicative internal component bindings dynamically.