@recursica/mantine-adapter 0.50.2 → 0.50.4

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 (70) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/index.d.ts +107 -139
  3. package/dist/mantine-adapter.cjs +1 -1
  4. package/dist/mantine-adapter.cjs.map +1 -1
  5. package/dist/mantine-adapter.css +1 -1
  6. package/dist/mantine-adapter.js +4 -3
  7. package/dist/mantine-adapter.js.map +1 -1
  8. package/package.json +5 -4
  9. package/src/components/Accordion/Accordion.test.tsx +1 -0
  10. package/src/components/AssistiveElement/AssistiveElement.test.tsx +1 -0
  11. package/src/components/AutoComplete/AutoComplete.test.tsx +1 -0
  12. package/src/components/Avatar/Avatar.test.tsx +1 -0
  13. package/src/components/Badge/Badge.test.tsx +1 -0
  14. package/src/components/Breadcrumb/Breadcrumb.test.tsx +1 -0
  15. package/src/components/Button/Button.module.css +1 -0
  16. package/src/components/Button/Button.styleIsolation.dom.test.tsx +98 -0
  17. package/src/components/Button/IMPLEMENTATION_NOTES.md +2 -0
  18. package/src/components/Card/Card.test.tsx +1 -0
  19. package/src/components/Checkbox/Checkbox.test.tsx +1 -0
  20. package/src/components/Chip/Chip.test.tsx +1 -0
  21. package/src/components/Container/Container.test.tsx +1 -0
  22. package/src/components/DatePicker/DatePicker.test.tsx +1 -0
  23. package/src/components/Dropdown/Dropdown.test.tsx +1 -0
  24. package/src/components/FileInput/FileInput.test.tsx +1 -0
  25. package/src/components/FileUpload/FileUpload.test.tsx +1 -0
  26. package/src/components/Flex/Flex.test.tsx +1 -0
  27. package/src/components/Flex/Flex.tsx +5 -5
  28. package/src/components/FormControlLayout/FormControlLayout.test.tsx +1 -0
  29. package/src/components/FormControlWrapper/FormControlWrapper.test.tsx +1 -0
  30. package/src/components/Grid/GRID_IMPLEMENTATION_NOTES.md +2 -2
  31. package/src/components/Grid/Grid.stories.tsx +11 -11
  32. package/src/components/Grid/Grid.test.tsx +1 -0
  33. package/src/components/Grid/Grid.tsx +10 -15
  34. package/src/components/Grid/USAGE.md +3 -3
  35. package/src/components/Group/Group.test.tsx +1 -0
  36. package/src/components/Group/Group.tsx +5 -5
  37. package/src/components/HoverCard/HoverCard.test.tsx +1 -0
  38. package/src/components/Label/Label.test.tsx +1 -0
  39. package/src/components/Link/Link.test.tsx +1 -0
  40. package/src/components/Loader/Loader.test.tsx +1 -0
  41. package/src/components/Menu/Menu.test.tsx +1 -0
  42. package/src/components/Modal/Modal.test.tsx +1 -0
  43. package/src/components/NumberInput/NumberInput.test.tsx +1 -0
  44. package/src/components/Pagination/Pagination.test.tsx +1 -0
  45. package/src/components/Panel/Panel.test.tsx +1 -0
  46. package/src/components/Popover/Popover.test.tsx +1 -0
  47. package/src/components/Radio/Radio.test.tsx +1 -0
  48. package/src/components/ReadOnlyField/ReadOnlyField.test.tsx +1 -0
  49. package/src/components/SegmentedControl/SegmentedControl.test.tsx +1 -0
  50. package/src/components/Slider/Slider.test.tsx +1 -0
  51. package/src/components/Stack/Stack.test.tsx +1 -0
  52. package/src/components/Stack/Stack.tsx +5 -5
  53. package/src/components/Stepper/Stepper.test.tsx +1 -0
  54. package/src/components/Switch/Switch.test.tsx +1 -0
  55. package/src/components/Table/Table.test.tsx +1 -0
  56. package/src/components/Tabs/Tabs.test.tsx +1 -0
  57. package/src/components/Text/Text.stories.tsx +3 -16
  58. package/src/components/Text/Text.test.tsx +1 -0
  59. package/src/components/TextArea/TextArea.test.tsx +1 -0
  60. package/src/components/TextField/TextField.test.tsx +1 -0
  61. package/src/components/TimePicker/TimePicker.test.tsx +1 -0
  62. package/src/components/Timeline/Timeline.test.tsx +1 -0
  63. package/src/components/Title/Title.stories.tsx +3 -16
  64. package/src/components/Title/Title.test.tsx +1 -0
  65. package/src/components/Toast/Toast.test.tsx +1 -0
  66. package/src/components/Tooltip/Tooltip.test.tsx +1 -0
  67. package/src/components/TransferList/TransferList.test.tsx +1 -0
  68. package/src/components/Tree/Tree.test.tsx +1 -0
  69. package/src/utils/filterStylingProps.test.ts +85 -0
  70. package/src/utils/filterStylingProps.ts +1 -0
@@ -0,0 +1,85 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import {
3
+ BLOCKED_STYLING_KEYS,
4
+ SPACING_MAP,
5
+ filterStylingProps,
6
+ mapLayoutProps,
7
+ } from "./filterStylingProps";
8
+
9
+ describe("filterStylingProps", () => {
10
+ it("strips every blocked styling key by default", () => {
11
+ const props = Object.fromEntries(
12
+ BLOCKED_STYLING_KEYS.map((key) => [key, "should-be-removed"]),
13
+ );
14
+
15
+ const sanitized = filterStylingProps(props);
16
+
17
+ for (const key of BLOCKED_STYLING_KEYS) {
18
+ expect(sanitized).not.toHaveProperty(key);
19
+ }
20
+ });
21
+
22
+ it("keeps props that aren't blocked styling keys", () => {
23
+ const sanitized = filterStylingProps({
24
+ disabled: true,
25
+ "aria-label": "Submit",
26
+ });
27
+
28
+ expect(sanitized).toEqual({ disabled: true, "aria-label": "Submit" });
29
+ });
30
+
31
+ it("keeps layout props (e.g. margin) untouched when not a rec- token", () => {
32
+ const sanitized = filterStylingProps({ m: "16px" });
33
+
34
+ expect(sanitized).toEqual({ m: "16px" });
35
+ });
36
+
37
+ it("maps rec- spacing tokens on layout props to their CSS variable", () => {
38
+ const sanitized = filterStylingProps({ m: "rec-lg", gap: "rec-sm" });
39
+
40
+ expect(sanitized).toEqual({
41
+ m: SPACING_MAP["rec-lg"],
42
+ gap: SPACING_MAP["rec-sm"],
43
+ });
44
+ });
45
+
46
+ it("does not map rec- tokens on props that aren't layout props", () => {
47
+ const sanitized = filterStylingProps({ "data-testid": "rec-lg" });
48
+
49
+ expect(sanitized).toEqual({ "data-testid": "rec-lg" });
50
+ });
51
+
52
+ it("leaves an unrecognized rec- value alone", () => {
53
+ const sanitized = filterStylingProps({ m: "rec-not-a-real-token" });
54
+
55
+ expect(sanitized).toEqual({ m: "rec-not-a-real-token" });
56
+ });
57
+
58
+ it("bypasses all filtering when overStyled is true", () => {
59
+ const props = { className: "custom", bg: "red", m: "rec-lg" };
60
+
61
+ expect(filterStylingProps(props, true)).toEqual(props);
62
+ });
63
+
64
+ it("does not mutate the input props object", () => {
65
+ const props = { className: "custom", m: "rec-lg" };
66
+
67
+ filterStylingProps(props);
68
+
69
+ expect(props).toEqual({ className: "custom", m: "rec-lg" });
70
+ });
71
+ });
72
+
73
+ describe("mapLayoutProps", () => {
74
+ it("maps rec- spacing tokens on layout props", () => {
75
+ expect(mapLayoutProps({ mt: "rec-xl" })).toEqual({
76
+ mt: SPACING_MAP["rec-xl"],
77
+ });
78
+ });
79
+
80
+ it("leaves non-layout props untouched even if they look like a token", () => {
81
+ expect(mapLayoutProps({ variant: "rec-xl" })).toEqual({
82
+ variant: "rec-xl",
83
+ });
84
+ });
85
+ });
@@ -84,6 +84,7 @@ const LAYOUT_PROPS = new Set([
84
84
  "gap",
85
85
  "rowGap",
86
86
  "columnGap",
87
+ "gutter",
87
88
  "top",
88
89
  "left",
89
90
  "bottom",