@recursica/mantine-adapter 0.42.1 → 0.44.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 (65) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/index.d.ts +93 -15
  3. package/dist/mantine-adapter.cjs +2 -2
  4. package/dist/mantine-adapter.cjs.map +1 -1
  5. package/dist/mantine-adapter.css +1 -1
  6. package/dist/mantine-adapter.js +3534 -3266
  7. package/dist/mantine-adapter.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/components/Accordion/Accordion.tsx +32 -33
  10. package/src/components/AssistiveElement/AssistiveElement.tsx +1 -1
  11. package/src/components/AutoComplete/AutoComplete.tsx +26 -38
  12. package/src/components/Avatar/Avatar.tsx +22 -23
  13. package/src/components/Badge/Badge.tsx +12 -18
  14. package/src/components/Breadcrumb/Breadcrumb.module.css +2 -0
  15. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +0 -6
  16. package/src/components/Breadcrumb/Breadcrumb.tsx +25 -17
  17. package/src/components/Button/Button.tsx +31 -30
  18. package/src/components/Card/Card.tsx +48 -27
  19. package/src/components/Checkbox/Checkbox.tsx +29 -42
  20. package/src/components/Checkbox/CheckboxGroup.tsx +12 -5
  21. package/src/components/Chip/Chip.tsx +34 -27
  22. package/src/components/DatePicker/DatePicker.tsx +46 -47
  23. package/src/components/Dropdown/BareDropdown.tsx +25 -13
  24. package/src/components/Dropdown/DROPDOWN_IMPLEMENTATION_NOTES.md +2 -0
  25. package/src/components/Dropdown/Dropdown.module.css +61 -4
  26. package/src/components/Dropdown/Dropdown.stories.tsx +21 -0
  27. package/src/components/Dropdown/Dropdown.tsx +41 -37
  28. package/src/components/Dropdown/USAGE.md +1 -0
  29. package/src/components/FileInput/FileInput.tsx +1 -1
  30. package/src/components/FileUpload/FileUpload.tsx +1 -1
  31. package/src/components/HoverCard/HoverCard.tsx +18 -34
  32. package/src/components/Label/Label.tsx +20 -21
  33. package/src/components/Link/Link.tsx +6 -14
  34. package/src/components/Loader/Loader.tsx +8 -16
  35. package/src/components/Menu/Menu.stories.tsx +9 -1
  36. package/src/components/Menu/Menu.tsx +55 -48
  37. package/src/components/Modal/Modal.tsx +134 -96
  38. package/src/components/NumberInput/NumberInput.tsx +14 -7
  39. package/src/components/Pagination/Pagination.tsx +25 -34
  40. package/src/components/Panel/Panel.tsx +19 -26
  41. package/src/components/Popover/Popover.tsx +19 -31
  42. package/src/components/Radio/Radio.tsx +32 -43
  43. package/src/components/Radio/RadioGroup.tsx +11 -4
  44. package/src/components/ReadOnlyField/ReadOnlyField.tsx +1 -1
  45. package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +1 -1
  46. package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +1 -1
  47. package/src/components/SegmentedControl/SegmentedControl.tsx +29 -33
  48. package/src/components/Slider/Slider.tsx +30 -43
  49. package/src/components/Stepper/Stepper.tsx +20 -13
  50. package/src/components/Switch/Switch.tsx +45 -45
  51. package/src/components/Switch/SwitchGroup.tsx +11 -4
  52. package/src/components/Table/Table.tsx +1 -1
  53. package/src/components/Tabs/Tabs.tsx +13 -6
  54. package/src/components/Text/Text.tsx +1 -1
  55. package/src/components/TextArea/TextArea.tsx +21 -25
  56. package/src/components/TextField/TextField.tsx +23 -30
  57. package/src/components/TimePicker/TimePicker.tsx +26 -12
  58. package/src/components/Timeline/Timeline.tsx +7 -21
  59. package/src/components/Timeline/TimelineItem.tsx +14 -26
  60. package/src/components/Title/Title.tsx +12 -2
  61. package/src/components/Toast/Toast.tsx +32 -31
  62. package/src/components/Tooltip/Tooltip.tsx +18 -34
  63. package/src/components/TransferList/TransferList.tsx +1 -1
  64. package/src/components/Tree/Tree.tsx +8 -8
  65. package/src/utils/filterStylingProps.ts +4 -0
@@ -6,6 +6,7 @@ import {
6
6
  } from "@mantine/core";
7
7
  import {
8
8
  filterStylingProps,
9
+ mergeClassNames,
9
10
  type RecursicaOverStyled,
10
11
  } from "../../utils/filterStylingProps";
11
12
  import styles from "./Stepper.module.css";
@@ -30,28 +31,34 @@ const _Stepper = forwardRef<HTMLDivElement, StepperProps>(
30
31
  } = props;
31
32
 
32
33
  const sanitizedProps = filterStylingProps(rest, overStyled);
34
+ const restRecord = sanitizedProps as Record<string, unknown>;
35
+
36
+ const mergedClassNames = mergeClassNames(
37
+ {
38
+ steps: styles.steps,
39
+ step: styles.step,
40
+ stepIcon: styles.stepIcon,
41
+ stepCompletedIcon: styles.stepCompletedIcon,
42
+ stepBody: styles.stepBody,
43
+ stepLabel: styles.stepLabel,
44
+ stepDescription: styles.stepDescription,
45
+ separator: styles.separator,
46
+ verticalSeparator: styles.verticalSeparator,
47
+ content: styles.content,
48
+ },
49
+ restRecord.classNames as Partial<Record<string, string>> | undefined,
50
+ );
33
51
 
34
52
  return (
35
53
  <MantineStepper
36
54
  ref={ref}
55
+ {...(sanitizedProps as MantineStepperProps)}
37
56
  orientation={orientation}
38
57
  className={`${styles.root} ${orientation === "horizontal" ? styles.horizontal : styles.vertical} ${size === "large" ? styles.large : styles.small} ${className || ""}`}
39
58
  style={style as React.CSSProperties}
40
59
  data-size={size}
41
60
  data-orientation={orientation}
42
- classNames={{
43
- steps: styles.steps,
44
- step: styles.step,
45
- stepIcon: styles.stepIcon,
46
- stepCompletedIcon: styles.stepCompletedIcon,
47
- stepBody: styles.stepBody,
48
- stepLabel: styles.stepLabel,
49
- stepDescription: styles.stepDescription,
50
- separator: styles.separator,
51
- verticalSeparator: styles.verticalSeparator,
52
- content: styles.content,
53
- }}
54
- {...(sanitizedProps as MantineStepperProps)}
61
+ classNames={mergedClassNames}
55
62
  />
56
63
  );
57
64
  },
@@ -1,4 +1,4 @@
1
- import { forwardRef } from "react";
1
+ import { forwardRef, type CSSProperties } from "react";
2
2
  import {
3
3
  Switch as MantineSwitch,
4
4
  type SwitchProps as MantineSwitchProps,
@@ -9,6 +9,10 @@ import { type ReadOnlyControlProps } from "@recursica/adapter-common";
9
9
 
10
10
  import {
11
11
  filterStylingProps,
12
+ omitUnsupportedProps,
13
+ withCallerOverride,
14
+ mergeClassNames,
15
+ mergeStyles,
12
16
  type RecursicaOverStyled,
13
17
  } from "../../utils/filterStylingProps";
14
18
  import {
@@ -59,50 +63,42 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
59
63
  controlMinWidth,
60
64
  ...rest
61
65
  } = props;
62
- const sanitizedProps = filterStylingProps(rest, overStyled);
66
+ // Props this component intentionally doesn't support — deleted at runtime so they can't leak
67
+ // through even if a caller forces them via plain JavaScript, bypassing the `Omit<>` above.
68
+ const UNSUPPORTED_PROPS = [
69
+ "size", // Recursica controls sizing via Switch.module.css variables, not Mantine's native size scale.
70
+ "color", // Colors are token-driven via Switch.module.css; Mantine's native palette isn't exposed.
71
+ "radius", // Corner radius is fixed by Recursica tokens in Switch.module.css, not caller-configurable.
72
+ "variant", // Switch has a single Recursica-defined visual treatment; Mantine's variant isn't exposed.
73
+ ] as const satisfies readonly (keyof MantineSwitchProps)[];
74
+
75
+ const sanitizedProps = omitUnsupportedProps(
76
+ filterStylingProps(rest, overStyled) as Record<string, unknown>,
77
+ UNSUPPORTED_PROPS,
78
+ ) as Partial<typeof rest>;
63
79
  const restRecord = sanitizedProps as Record<string, unknown>;
64
80
 
65
- // Actively delete dimension bindings that bypass the abstraction
66
- delete restRecord["size"];
67
- delete restRecord["color"];
68
- delete restRecord["radius"];
69
- delete restRecord["variant"];
70
-
71
- const mergedClassNames: Partial<Record<string, string>> = {
72
- root: styles.root,
73
- body: styles.body,
74
- track: styles.track,
75
- thumb: styles.thumb,
76
- trackLabel: styles.trackLabel,
77
- labelWrapper: styles.labelWrapper,
78
- label: styles.label,
79
- };
80
-
81
- const classNamesProp = restRecord.classNames;
82
- if (
83
- classNamesProp &&
84
- typeof classNamesProp === "object" &&
85
- !Array.isArray(classNamesProp)
86
- ) {
87
- const o = classNamesProp as Partial<Record<string, string>>;
88
- mergedClassNames.root = o.root ? `${styles.root} ${o.root}` : styles.root;
89
- mergedClassNames.body = o.body ? `${styles.body} ${o.body}` : styles.body;
90
- mergedClassNames.track = o.track
91
- ? `${styles.track} ${o.track}`
92
- : styles.track;
93
- mergedClassNames.thumb = o.thumb
94
- ? `${styles.thumb} ${o.thumb}`
95
- : styles.thumb;
96
- mergedClassNames.trackLabel = o.trackLabel
97
- ? `${styles.trackLabel} ${o.trackLabel}`
98
- : styles.trackLabel;
99
- mergedClassNames.labelWrapper = o.labelWrapper
100
- ? `${styles.labelWrapper} ${o.labelWrapper}`
101
- : styles.labelWrapper;
102
- mergedClassNames.label = o.label
103
- ? `${styles.label} ${o.label}`
104
- : styles.label;
105
- }
81
+ const mergedClassNames = mergeClassNames(
82
+ {
83
+ root: styles.root,
84
+ body: styles.body,
85
+ track: styles.track,
86
+ thumb: styles.thumb,
87
+ trackLabel: styles.trackLabel,
88
+ labelWrapper: styles.labelWrapper,
89
+ label: styles.label,
90
+ },
91
+ restRecord.classNames as Partial<Record<string, string>> | undefined,
92
+ );
93
+
94
+ // Recursica has no default per-slot inline styles here (all default styling comes from
95
+ // Switch.module.css above) — this only exists so a caller-supplied `styles` prop (permitted
96
+ // once overStyled=true clears filterStylingProps) merges in per-slot instead of needing its
97
+ // own passthrough path.
98
+ const mergedStyles = mergeStyles(
99
+ {} as Record<string, CSSProperties | undefined>,
100
+ restRecord.styles as Partial<Record<string, CSSProperties>> | undefined,
101
+ );
106
102
 
107
103
  const classNameProp = restRecord.className as string | undefined;
108
104
  const finalClass = classNameProp
@@ -147,12 +143,16 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
147
143
  const switchNode = (
148
144
  <MantineSwitch
149
145
  ref={ref}
146
+ {...(sanitizedProps as unknown as MantineSwitchProps)}
150
147
  className={finalClass}
151
148
  classNames={mergedClassNames}
149
+ styles={mergedStyles}
152
150
  disabled={readOnly || disabled}
153
151
  data-disabled={readOnly || disabled || undefined}
154
- thumbIcon={thumbIcon ?? FinalThumbIcon}
155
- {...(sanitizedProps as unknown as MantineSwitchProps)}
152
+ thumbIcon={withCallerOverride<React.ReactNode>(
153
+ FinalThumbIcon,
154
+ thumbIcon,
155
+ )}
156
156
  />
157
157
  );
158
158
 
@@ -7,6 +7,7 @@ import {
7
7
  import { type ReadOnlyControlProps } from "@recursica/adapter-common";
8
8
  import {
9
9
  filterStylingProps,
10
+ omitUnsupportedProps,
10
11
  type RecursicaOverStyled,
11
12
  } from "../../utils/filterStylingProps";
12
13
  import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
@@ -61,11 +62,17 @@ export const SwitchGroup = forwardRef<HTMLDivElement, SwitchGroupProps>(
61
62
  defaultValue,
62
63
  ...rest
63
64
  } = props;
64
- const sanitizedProps = filterStylingProps(rest, overStyled);
65
- const restRecord = sanitizedProps as Record<string, unknown>;
65
+ // Props this component intentionally doesn't support — deleted at runtime so they can't leak
66
+ // through even if a caller forces them via plain JavaScript, bypassing the `Omit<>` above.
67
+ const UNSUPPORTED_PROPS = [
68
+ "size", // Recursica controls sizing via Switch.module.css variables, not Mantine's native size scale.
69
+ ] as const satisfies readonly (keyof MantineSwitchGroupProps)[];
66
70
 
67
- // Delete prohibited sizing hooks from bypassing the variables
68
- delete restRecord["size"];
71
+ const sanitizedProps = omitUnsupportedProps(
72
+ filterStylingProps(rest, overStyled) as Record<string, unknown>,
73
+ UNSUPPORTED_PROPS,
74
+ ) as Partial<typeof rest>;
75
+ const restRecord = sanitizedProps as Record<string, unknown>;
69
76
 
70
77
  return (
71
78
  <WithReadOnlyWrapper
@@ -38,8 +38,8 @@ const TableBase = forwardRef<HTMLTableElement, TableProps>(function Table(
38
38
  return (
39
39
  <MantineTable
40
40
  ref={ref}
41
- className={finalClass}
42
41
  {...(sanitizedProps as unknown as MantineTableProps)}
42
+ className={finalClass}
43
43
  />
44
44
  );
45
45
  });
@@ -8,6 +8,7 @@ import {
8
8
  } from "@mantine/core";
9
9
  import {
10
10
  filterStylingProps,
11
+ mergeClassNames,
11
12
  type RecursicaOverStyled,
12
13
  } from "../../utils/filterStylingProps";
13
14
  import styles from "./Tabs.module.css";
@@ -30,21 +31,27 @@ const _Tabs = forwardRef<HTMLDivElement, TabsProps>(function Tabs(props, ref) {
30
31
  } = props;
31
32
 
32
33
  const sanitizedProps = filterStylingProps(rest, overStyled);
34
+ const restRecord = sanitizedProps as Record<string, unknown>;
35
+
36
+ const mergedClassNames = mergeClassNames(
37
+ {
38
+ list: styles.list,
39
+ tab: styles.tab,
40
+ panel: styles.panel,
41
+ },
42
+ restRecord.classNames as Partial<Record<string, string>> | undefined,
43
+ );
33
44
 
34
45
  return (
35
46
  <MantineTabs
36
47
  ref={ref}
48
+ {...(sanitizedProps as MantineTabsProps)}
37
49
  variant={variant}
38
50
  orientation={orientation}
39
51
  className={`${styles.root} ${className || ""}`}
40
52
  data-variant={variant}
41
53
  data-orientation={orientation}
42
- classNames={{
43
- list: styles.list,
44
- tab: styles.tab,
45
- panel: styles.panel,
46
- }}
47
- {...(sanitizedProps as MantineTabsProps)}
54
+ classNames={mergedClassNames}
48
55
  />
49
56
  );
50
57
  });
@@ -31,8 +31,8 @@ const _Text = forwardRef<HTMLDivElement, TextProps>(function Text(
31
31
  return (
32
32
  <MantineText
33
33
  ref={ref}
34
- className={mergedClassName}
35
34
  {...(sanitizedProps as unknown as MantineTextProps)}
35
+ className={mergedClassName}
36
36
  />
37
37
  );
38
38
  });
@@ -6,6 +6,8 @@ import {
6
6
  import { type ReadOnlyControlProps } from "@recursica/adapter-common";
7
7
  import {
8
8
  filterStylingProps,
9
+ omitUnsupportedProps,
10
+ mergeClassNames,
9
11
  type RecursicaOverStyled,
10
12
  } from "../../utils/filterStylingProps";
11
13
  import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
@@ -28,6 +30,14 @@ export interface RecursicaTextAreaProps
28
30
 
29
31
  export type TextAreaProps = RecursicaOverStyled<RecursicaTextAreaProps>;
30
32
 
33
+ // Props this component intentionally doesn't support — deleted at runtime so they can't leak
34
+ // through even if a caller forces them via plain JavaScript, bypassing the `Omit<>` above.
35
+ const UNSUPPORTED_PROPS = [
36
+ "size", // Recursica controls sizing via the `size` variant + design tokens, not raw dimensions.
37
+ "variant", // Colors/variants are token-driven; the library's native palette isn't exposed.
38
+ "radius", // Recursica does not expose the library's native corner-radius system.
39
+ ] as const satisfies readonly (keyof MantineTextareaProps)[];
40
+
31
41
  export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
32
42
  function TextArea(props, ref) {
33
43
  const {
@@ -58,34 +68,20 @@ export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
58
68
  defaultValue,
59
69
  ...rest
60
70
  } = props;
61
- const sanitizedProps = filterStylingProps(rest, overStyled);
71
+ const sanitizedProps = omitUnsupportedProps(
72
+ filterStylingProps(rest, overStyled) as Record<string, unknown>,
73
+ UNSUPPORTED_PROPS,
74
+ );
62
75
  const restRecord = sanitizedProps as Record<string, unknown>;
63
76
 
64
- // Delete prohibited sizing hooks from bypassing variables natively
65
- delete restRecord["size"];
66
- delete restRecord["variant"];
67
- delete restRecord["radius"];
68
-
69
77
  // Securely map core native blocks down ensuring nested CSS modules map precisely
70
- const mergedClassNames: Partial<Record<string, string>> = {
71
- wrapper: styles.root, // The nested Input internal relative wrapper bounding box
72
- input: styles.input,
73
- };
74
-
75
- const classNamesProp = restRecord.classNames;
76
- if (
77
- classNamesProp &&
78
- typeof classNamesProp === "object" &&
79
- !Array.isArray(classNamesProp)
80
- ) {
81
- const o = classNamesProp as Partial<Record<string, string>>;
82
- mergedClassNames.wrapper = o.wrapper
83
- ? `${styles.root} ${o.wrapper}`
84
- : styles.root;
85
- mergedClassNames.input = o.input
86
- ? `${styles.input} ${o.input}`
87
- : styles.input;
88
- }
78
+ const mergedClassNames = mergeClassNames(
79
+ {
80
+ wrapper: styles.root, // The nested Input internal relative wrapper bounding box
81
+ input: styles.input,
82
+ },
83
+ restRecord.classNames as Partial<Record<string, string>> | undefined,
84
+ );
89
85
 
90
86
  const wrapperClass = className
91
87
  ? `${styles.layoutOverride} ${className}`
@@ -3,6 +3,8 @@ import { Input, type InputProps, type InputWrapperProps } from "@mantine/core";
3
3
  import { type ReadOnlyControlProps } from "@recursica/adapter-common";
4
4
  import {
5
5
  filterStylingProps,
6
+ omitUnsupportedProps,
7
+ mergeClassNames,
6
8
  type RecursicaOverStyled,
7
9
  } from "../../utils/filterStylingProps";
8
10
  import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
@@ -30,6 +32,14 @@ export interface RecursicaTextFieldProps
30
32
 
31
33
  export type TextFieldProps = RecursicaOverStyled<RecursicaTextFieldProps>;
32
34
 
35
+ // Props this component intentionally doesn't support — deleted at runtime so they can't leak
36
+ // through even if a caller forces them via plain JavaScript, bypassing the `Omit<>` above.
37
+ const UNSUPPORTED_PROPS = [
38
+ "size", // Recursica controls sizing via the `size` variant + design tokens, not raw dimensions.
39
+ "variant", // Colors/variants are token-driven; the library's native palette isn't exposed.
40
+ "radius", // Recursica does not expose the library's native corner-radius system.
41
+ ] as const satisfies readonly (keyof InputProps)[];
42
+
33
43
  export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
34
44
  function TextField(props, ref) {
35
45
  const {
@@ -60,38 +70,21 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
60
70
  defaultValue,
61
71
  ...rest
62
72
  } = props;
63
- const sanitizedProps = filterStylingProps(rest, overStyled);
73
+ const sanitizedProps = omitUnsupportedProps(
74
+ filterStylingProps(rest, overStyled) as Record<string, unknown>,
75
+ UNSUPPORTED_PROPS,
76
+ );
64
77
  const restRecord = sanitizedProps as Record<string, unknown>;
65
78
 
66
- // Delete prohibited sizing hooks from bypassing variables natively
67
- delete restRecord["size"];
68
- delete restRecord["variant"];
69
- delete restRecord["radius"];
70
-
71
79
  // Securely map core native blocks down ensuring nested CSS modules map precisely
72
- const mergedClassNames: Partial<Record<string, string>> = {
73
- wrapper: styles.root, // The nested Input internal relative wrapper bounding box
74
- input: styles.input,
75
- section: styles.section,
76
- };
77
-
78
- const classNamesProp = restRecord.classNames;
79
- if (
80
- classNamesProp &&
81
- typeof classNamesProp === "object" &&
82
- !Array.isArray(classNamesProp)
83
- ) {
84
- const o = classNamesProp as Partial<Record<string, string>>;
85
- mergedClassNames.wrapper = o.wrapper
86
- ? `${styles.root} ${o.wrapper}`
87
- : styles.root;
88
- mergedClassNames.input = o.input
89
- ? `${styles.input} ${o.input}`
90
- : styles.input;
91
- mergedClassNames.section = o.section
92
- ? `${styles.section} ${o.section}`
93
- : styles.section;
94
- }
80
+ const mergedClassNames = mergeClassNames(
81
+ {
82
+ wrapper: styles.root, // The nested Input internal relative wrapper bounding box
83
+ input: styles.input,
84
+ section: styles.section,
85
+ },
86
+ restRecord.classNames as Partial<Record<string, string>> | undefined,
87
+ );
95
88
 
96
89
  const wrapperClass = className
97
90
  ? `${styles.layoutOverride} ${className}`
@@ -127,6 +120,7 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
127
120
  /* Naked Input execution safely decoupled from Mantine's macro Input.Wrapper DOM hooks */
128
121
  <Input
129
122
  ref={ref}
123
+ {...(sanitizedProps as unknown as InputProps)}
130
124
  classNames={mergedClassNames}
131
125
  disabled={disabled}
132
126
  value={value}
@@ -135,7 +129,6 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
135
129
  "data-disabled": disabled ? "true" : undefined,
136
130
  "data-error": error ? "true" : undefined,
137
131
  }}
138
- {...(sanitizedProps as unknown as InputProps)}
139
132
  />
140
133
  }
141
134
  />
@@ -7,6 +7,8 @@ import { type InputWrapperProps } from "@mantine/core";
7
7
  import { type ReadOnlyControlProps } from "@recursica/adapter-common";
8
8
  import {
9
9
  filterStylingProps,
10
+ omitUnsupportedProps,
11
+ mergeClassNames,
10
12
  type RecursicaOverStyled,
11
13
  } from "../../utils/filterStylingProps";
12
14
  import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
@@ -102,6 +104,14 @@ export interface RecursicaTimePickerProps
102
104
 
103
105
  export type TimePickerProps = RecursicaOverStyled<RecursicaTimePickerProps>;
104
106
 
107
+ // Props this component intentionally doesn't support — deleted at runtime so they can't leak
108
+ // through even if a caller forces them via plain JavaScript, bypassing the `Omit<>` above.
109
+ const UNSUPPORTED_PROPS = [
110
+ "size", // Recursica controls sizing via the `size` variant + design tokens, not raw dimensions.
111
+ "variant", // Colors/variants are token-driven; the library's native palette isn't exposed.
112
+ "radius", // Recursica does not expose the library's native corner-radius system.
113
+ ] as const satisfies readonly (keyof MantineTimePickerProps)[];
114
+
105
115
  export const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
106
116
  function TimePicker(props, ref) {
107
117
  const {
@@ -137,13 +147,12 @@ export const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
137
147
  ...rest
138
148
  } = props;
139
149
 
140
- const sanitizedProps = filterStylingProps(rest, overStyled);
150
+ const sanitizedProps = omitUnsupportedProps(
151
+ filterStylingProps(rest, overStyled) as Record<string, unknown>,
152
+ UNSUPPORTED_PROPS,
153
+ );
141
154
  const restRecord = sanitizedProps as Record<string, unknown>;
142
155
 
143
- delete restRecord["size"];
144
- delete restRecord["variant"];
145
- delete restRecord["radius"];
146
-
147
156
  // Internal full 24-hour value. Needed because Mantine's TimePicker (hour/minute/second entry)
148
157
  // and our own BareDropdown (AM/PM) both mutate the same conceptual value — see
149
158
  // TIMEPICKER_IMPLEMENTATION_NOTES.md.
@@ -241,12 +250,18 @@ export const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
241
250
  >
242
251
  <MantineTimePicker
243
252
  ref={ref}
244
- classNames={{
245
- wrapper: styles.timeWrapper,
246
- input: styles.timeInput,
247
- fieldsGroup: styles.fieldsGroup,
248
- field: styles.timeField,
249
- }}
253
+ {...(sanitizedProps as unknown as MantineTimePickerProps)}
254
+ classNames={mergeClassNames(
255
+ {
256
+ wrapper: styles.timeWrapper,
257
+ input: styles.timeInput,
258
+ fieldsGroup: styles.fieldsGroup,
259
+ field: styles.timeField,
260
+ },
261
+ restRecord.classNames as
262
+ | Partial<Record<string, string>>
263
+ | undefined,
264
+ )}
250
265
  disabled={disabled}
251
266
  value={internalValue}
252
267
  onChange={handleFieldChange}
@@ -259,7 +274,6 @@ export const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
259
274
  // to seed the mount-time AM default onto Mantine's own hidden native select. See
260
275
  // TIMEPICKER_IMPLEMENTATION_NOTES.md.
261
276
  amPmRef={amPmRef}
262
- {...(sanitizedProps as unknown as MantineTimePickerProps)}
263
277
  />
264
278
  <BareDropdown
265
279
  overStyled
@@ -5,6 +5,7 @@ import {
5
5
  } from "@mantine/core";
6
6
  import {
7
7
  filterStylingProps,
8
+ mergeClassNames,
8
9
  type RecursicaOverStyled,
9
10
  } from "../../utils/filterStylingProps";
10
11
  import styles from "./Timeline.module.css";
@@ -46,36 +47,21 @@ interface TimelineComponent
46
47
  const TimelineInner = React.forwardRef<HTMLDivElement, TimelineProps>(
47
48
  function Timeline({ overStyled = false, ...rest }, ref) {
48
49
  const sanitizedProps = filterStylingProps(rest, overStyled);
50
+ const restRecord = sanitizedProps as Record<string, unknown>;
49
51
 
50
- const mergedClassNames: Partial<Record<string, string>> = {
51
- root: styles.root,
52
- };
53
-
54
- const classNamesProp = (sanitizedProps as Record<string, unknown>)
55
- .classNames;
56
- if (
57
- classNamesProp &&
58
- typeof classNamesProp === "object" &&
59
- !Array.isArray(classNamesProp)
60
- ) {
61
- const o = classNamesProp as Record<string, string>;
62
- Object.keys(o).forEach((key) => {
63
- if (mergedClassNames[key]) {
64
- mergedClassNames[key] = `${mergedClassNames[key]} ${o[key]}`;
65
- } else {
66
- mergedClassNames[key] = o[key];
67
- }
68
- });
69
- }
52
+ const mergedClassNames = mergeClassNames(
53
+ { root: styles.root },
54
+ restRecord.classNames as Partial<Record<string, string>> | undefined,
55
+ );
70
56
 
71
57
  return (
72
58
  <MantineTimeline
73
59
  ref={ref}
74
- classNames={mergedClassNames}
75
60
  {...(sanitizedProps as unknown as Omit<
76
61
  MantineTimelineProps,
77
62
  "color" | "radius" | "bulletSize" | "lineWidth"
78
63
  >)}
64
+ classNames={mergedClassNames}
79
65
  />
80
66
  );
81
67
  },
@@ -5,6 +5,7 @@ import {
5
5
  } from "@mantine/core";
6
6
  import {
7
7
  filterStylingProps,
8
+ mergeClassNames,
8
9
  type RecursicaOverStyled,
9
10
  } from "../../utils/filterStylingProps";
10
11
  import styles from "./Timeline.module.css";
@@ -36,31 +37,18 @@ export const TimelineItem = React.forwardRef<HTMLDivElement, TimelineItemProps>(
36
37
  ref,
37
38
  ) {
38
39
  const sanitizedProps = filterStylingProps(rest, overStyled);
40
+ const restRecord = sanitizedProps as Record<string, unknown>;
39
41
 
40
- const mergedClassNames: Partial<Record<string, string>> = {
41
- item: styles.item,
42
- itemBody: styles.itemBody,
43
- itemContent: styles.itemContent,
44
- itemBullet: styles.itemBullet,
45
- itemTitle: styles.itemTitle,
46
- };
47
-
48
- const classNamesProp = (sanitizedProps as Record<string, unknown>)
49
- .classNames;
50
- if (
51
- classNamesProp &&
52
- typeof classNamesProp === "object" &&
53
- !Array.isArray(classNamesProp)
54
- ) {
55
- const o = classNamesProp as Record<string, string>;
56
- Object.keys(o).forEach((key) => {
57
- if (mergedClassNames[key]) {
58
- mergedClassNames[key] = `${mergedClassNames[key]} ${o[key]}`;
59
- } else {
60
- mergedClassNames[key] = o[key];
61
- }
62
- });
63
- }
42
+ const mergedClassNames = mergeClassNames(
43
+ {
44
+ item: styles.item,
45
+ itemBody: styles.itemBody,
46
+ itemContent: styles.itemContent,
47
+ itemBullet: styles.itemBullet,
48
+ itemTitle: styles.itemTitle,
49
+ },
50
+ restRecord.classNames as Partial<Record<string, string>> | undefined,
51
+ );
64
52
 
65
53
  // Embed timestamp inside children if provided, wrapped in a specific class
66
54
  const content = timestamp ? (
@@ -75,12 +63,12 @@ export const TimelineItem = React.forwardRef<HTMLDivElement, TimelineItemProps>(
75
63
  return (
76
64
  <MantineTimelineItem
77
65
  ref={ref}
78
- classNames={mergedClassNames}
79
- data-variant={bulletVariant}
80
66
  {...(sanitizedProps as unknown as Omit<
81
67
  MantineTimelineItemProps,
82
68
  "radius" | "color" | "lineVariant"
83
69
  >)}
70
+ classNames={mergedClassNames}
71
+ data-variant={bulletVariant}
84
72
  >
85
73
  {content}
86
74
  </MantineTimelineItem>
@@ -5,6 +5,7 @@ import {
5
5
  } from "@mantine/core";
6
6
  import {
7
7
  filterStylingProps,
8
+ omitUnsupportedProps,
8
9
  type RecursicaOverStyled,
9
10
  } from "../../utils/filterStylingProps";
10
11
 
@@ -21,7 +22,16 @@ export const Title = forwardRef<HTMLHeadingElement, TitleProps>(function Title(
21
22
  { overStyled = false, order = 1, ...rest },
22
23
  ref,
23
24
  ) {
24
- const sanitizedProps = filterStylingProps(rest, overStyled);
25
+ // Props this component intentionally doesn't support — deleted at runtime so they can't leak
26
+ // through even if a caller forces them via plain JavaScript, bypassing the `Omit<>` above.
27
+ const UNSUPPORTED_PROPS = [
28
+ "size", // Recursica controls Title sizing via the `order` prop + typography tokens, not Mantine's native `size`.
29
+ ] as const satisfies readonly (keyof MantineTitleProps)[];
30
+
31
+ const sanitizedProps = omitUnsupportedProps(
32
+ filterStylingProps(rest, overStyled),
33
+ UNSUPPORTED_PROPS,
34
+ );
25
35
  const classNameProp = (sanitizedProps as Record<string, unknown>)
26
36
  .className as string | undefined;
27
37
 
@@ -33,9 +43,9 @@ export const Title = forwardRef<HTMLHeadingElement, TitleProps>(function Title(
33
43
  return (
34
44
  <MantineTitle
35
45
  ref={ref}
46
+ {...(sanitizedProps as unknown as MantineTitleProps)}
36
47
  order={order}
37
48
  className={mergedClassName}
38
- {...(sanitizedProps as unknown as MantineTitleProps)}
39
49
  />
40
50
  );
41
51
  });