@recursica/mantine-adapter 0.6.0 → 0.7.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 (140) hide show
  1. package/.storybook/commonArgTypes.ts +148 -0
  2. package/CHANGELOG.md +69 -0
  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 +660 -586
  7. package/dist/mantine-adapter.js.map +1 -1
  8. package/dist/src/components/Checkbox/CheckboxGroup.d.ts +1 -1
  9. package/dist/src/components/Chip/Chip.d.ts +14 -2
  10. package/package.json +5 -2
  11. package/src/OverStyling.stories.tsx +174 -0
  12. package/src/Version.stories.tsx +56 -0
  13. package/src/components/Accordion/ACCORDION_IMPLEMENTATION_NOTES.md +48 -0
  14. package/src/components/Accordion/Accordion.module.css +261 -0
  15. package/src/components/Accordion/Accordion.stories.tsx +145 -0
  16. package/src/components/Accordion/Accordion.tsx +200 -0
  17. package/src/components/Accordion/index.ts +1 -0
  18. package/src/components/AssistiveElement/AssistiveElement.module.css +111 -0
  19. package/src/components/AssistiveElement/AssistiveElement.stories.tsx +73 -0
  20. package/src/components/AssistiveElement/AssistiveElement.tsx +91 -0
  21. package/src/components/Avatar/AVATAR_IMPLEMENTATION_NOTES.md +24 -0
  22. package/src/components/Avatar/Avatar.module.css +340 -0
  23. package/src/components/Avatar/Avatar.stories.tsx +102 -0
  24. package/src/components/Avatar/Avatar.tsx +100 -0
  25. package/src/components/Avatar/index.ts +1 -0
  26. package/src/components/Badge/BADGE_IMPLEMENTATION_NOTES.md +18 -0
  27. package/src/components/Badge/Badge.module.css +124 -0
  28. package/src/components/Badge/Badge.stories.tsx +77 -0
  29. package/src/components/Badge/Badge.tsx +66 -0
  30. package/src/components/Breadcrumb/BREADCRUMB_IMPLEMENTATION_NOTES.md +14 -0
  31. package/src/components/Breadcrumb/Breadcrumb.module.css +26 -0
  32. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +77 -0
  33. package/src/components/Breadcrumb/Breadcrumb.tsx +64 -0
  34. package/src/components/Button/Button.module.css +275 -0
  35. package/src/components/Button/Button.stories.tsx +105 -0
  36. package/src/components/Button/Button.tsx +122 -0
  37. package/src/components/Button/IMPLEMENTATION_NOTES.md +45 -0
  38. package/src/components/Button/index.ts +1 -0
  39. package/src/components/Card/CARD_IMPLEMENTATION_NOTES.md +10 -0
  40. package/src/components/Card/Card.module.css +60 -0
  41. package/src/components/Card/Card.stories.tsx +141 -0
  42. package/src/components/Card/Card.tsx +176 -0
  43. package/src/components/Checkbox/CHECKBOX_IMPLEMENTATION_NOTES.md +25 -0
  44. package/src/components/Checkbox/Checkbox.module.css +204 -0
  45. package/src/components/Checkbox/Checkbox.stories.tsx +73 -0
  46. package/src/components/Checkbox/Checkbox.tsx +111 -0
  47. package/src/components/Checkbox/CheckboxGroup.stories.tsx +138 -0
  48. package/src/components/Checkbox/CheckboxGroup.tsx +140 -0
  49. package/src/components/Chip/CHIP_IMPLEMENTATION_NOTES.md +35 -0
  50. package/src/components/Chip/Chip.module.css +218 -0
  51. package/src/components/Chip/Chip.stories.tsx +115 -0
  52. package/src/components/Chip/Chip.tsx +143 -0
  53. package/src/components/DatePicker/DatePicker.stories.tsx +22 -0
  54. package/src/components/DatePicker/DatePicker.tsx +7 -0
  55. package/src/components/Dropdown/Dropdown.stories.tsx +22 -0
  56. package/src/components/Dropdown/Dropdown.tsx +7 -0
  57. package/src/components/FileInput/FileInput.stories.tsx +22 -0
  58. package/src/components/FileInput/FileInput.tsx +7 -0
  59. package/src/components/FileUpload/FileUpload.stories.tsx +22 -0
  60. package/src/components/FileUpload/FileUpload.tsx +7 -0
  61. package/src/components/FormControlWrapper/FORMCONTROLWRAPPER_IMPLEMENTATION_NOTES.md +32 -0
  62. package/src/components/FormControlWrapper/FormControlWrapper.module.css +46 -0
  63. package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +116 -0
  64. package/src/components/FormControlWrapper/FormControlWrapper.tsx +170 -0
  65. package/src/components/HoverCard/HoverCard.stories.tsx +17 -0
  66. package/src/components/HoverCard/HoverCard.tsx +7 -0
  67. package/src/components/Label/LABEL_IMPLEMENTATION_NOTES.md +48 -0
  68. package/src/components/Label/Label.module.css +177 -0
  69. package/src/components/Label/Label.stories.tsx +123 -0
  70. package/src/components/Label/Label.tsx +132 -0
  71. package/src/components/Label/index.ts +1 -0
  72. package/src/components/Link/Link.stories.tsx +17 -0
  73. package/src/components/Link/Link.tsx +7 -0
  74. package/src/components/Loader/Loader.stories.tsx +17 -0
  75. package/src/components/Loader/Loader.tsx +7 -0
  76. package/src/components/Menu/Menu.stories.tsx +17 -0
  77. package/src/components/Menu/Menu.tsx +7 -0
  78. package/src/components/Modal/Modal.stories.tsx +17 -0
  79. package/src/components/Modal/Modal.tsx +7 -0
  80. package/src/components/NumberInput/NumberInput.stories.tsx +22 -0
  81. package/src/components/NumberInput/NumberInput.tsx +7 -0
  82. package/src/components/Pagination/Pagination.stories.tsx +17 -0
  83. package/src/components/Pagination/Pagination.tsx +7 -0
  84. package/src/components/Panel/Panel.stories.tsx +17 -0
  85. package/src/components/Panel/Panel.tsx +7 -0
  86. package/src/components/Popover/Popover.stories.tsx +17 -0
  87. package/src/components/Popover/Popover.tsx +7 -0
  88. package/src/components/Radio/Radio.stories.tsx +22 -0
  89. package/src/components/Radio/Radio.tsx +7 -0
  90. package/src/components/ReadOnlyField/READ_ONLY_FIELD_IMPLEMENTATION_NOTES.md +15 -0
  91. package/src/components/ReadOnlyField/ReadOnlyField.module.css +49 -0
  92. package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +120 -0
  93. package/src/components/ReadOnlyField/ReadOnlyField.tsx +75 -0
  94. package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +46 -0
  95. package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +85 -0
  96. package/src/components/ReadOnlyField/index.ts +3 -0
  97. package/src/components/Search/Search.stories.tsx +17 -0
  98. package/src/components/Search/Search.tsx +7 -0
  99. package/src/components/SegmentedControl/SegmentedControl.stories.tsx +22 -0
  100. package/src/components/SegmentedControl/SegmentedControl.tsx +7 -0
  101. package/src/components/Slider/Slider.stories.tsx +22 -0
  102. package/src/components/Slider/Slider.tsx +7 -0
  103. package/src/components/Stepper/Stepper.stories.tsx +17 -0
  104. package/src/components/Stepper/Stepper.tsx +7 -0
  105. package/src/components/Switch/Switch.stories.tsx +22 -0
  106. package/src/components/Switch/Switch.tsx +7 -0
  107. package/src/components/Table/Table.stories.tsx +17 -0
  108. package/src/components/Table/Table.tsx +7 -0
  109. package/src/components/Tabs/Tabs.stories.tsx +17 -0
  110. package/src/components/Tabs/Tabs.tsx +7 -0
  111. package/src/components/Text/Text.stories.tsx +88 -0
  112. package/src/components/Text/Text.tsx +54 -0
  113. package/src/components/TextArea/TextArea.stories.tsx +22 -0
  114. package/src/components/TextArea/TextArea.tsx +7 -0
  115. package/src/components/TextField/TEXTFIELD_IMPLEMENTATION_NOTES.md +19 -0
  116. package/src/components/TextField/TextField.module.css +225 -0
  117. package/src/components/TextField/TextField.stories.tsx +162 -0
  118. package/src/components/TextField/TextField.tsx +138 -0
  119. package/src/components/TimePicker/TimePicker.stories.tsx +22 -0
  120. package/src/components/TimePicker/TimePicker.tsx +7 -0
  121. package/src/components/Timeline/Timeline.stories.tsx +17 -0
  122. package/src/components/Timeline/Timeline.tsx +7 -0
  123. package/src/components/Title/Title.stories.tsx +63 -0
  124. package/src/components/Title/Title.tsx +45 -0
  125. package/src/components/Toast/Toast.stories.tsx +17 -0
  126. package/src/components/Toast/Toast.tsx +7 -0
  127. package/src/components/Tooltip/Tooltip.stories.tsx +17 -0
  128. package/src/components/Tooltip/Tooltip.tsx +7 -0
  129. package/src/components/TransferList/TransferList.stories.tsx +17 -0
  130. package/src/components/TransferList/TransferList.tsx +7 -0
  131. package/src/components/index.ts +39 -0
  132. package/src/env.d.ts +7 -0
  133. package/src/index.ts +3 -0
  134. package/src/types/index.ts +9 -0
  135. package/src/types/mantine.d.ts +7 -0
  136. package/src/types/scss-modules.d.ts +9 -0
  137. package/src/utils/ColorSchemeWrapper.tsx +27 -0
  138. package/src/utils/copyToClipboard.ts +36 -0
  139. package/src/utils/filterStylingProps.ts +139 -0
  140. package/src/utils/index.ts +1 -0
@@ -0,0 +1,174 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import {
3
+ Container,
4
+ Paper,
5
+ Title,
6
+ Text,
7
+ List,
8
+ Divider,
9
+ Group,
10
+ Code,
11
+ } from "@mantine/core";
12
+ import { Button } from "./components/Button/Button";
13
+
14
+ const OverStylingInfo = () => {
15
+ return (
16
+ <Container size="md" py="xl">
17
+ <Paper withBorder p="xl" radius="md">
18
+ <Title order={1} mb="md">
19
+ Over Styling (<Code>overStyled</Code>)
20
+ </Title>
21
+ <Text mb="md">
22
+ By default, all Recursica components are strictly sandboxed. This
23
+ means they are protected against arbitrary styling configurations
24
+ (like passing generic React <Code>style</Code> objects, custom{" "}
25
+ <Code>classNames</Code> injections, or using deep Mantine layout hooks
26
+ like <Code>bg</Code> and <Code>c</Code>). This strict compile-time and
27
+ run-time enforcement guarantees that your design system tokens remain
28
+ true across your application.
29
+ </Text>
30
+ <Text mb="md">
31
+ However, there may be edge cases where a developer absolutely must
32
+ modify a component beyond what the design tokens natively allow. For
33
+ this, we provide the <strong>escape hatch</strong> property:{" "}
34
+ <Code>overStyled={`{true}`}</Code>.
35
+ </Text>
36
+
37
+ <Title order={3} mb="sm">
38
+ The Core Philosophy
39
+ </Title>
40
+ <Text mb="sm">
41
+ **You should not over-style components.** Using{" "}
42
+ <Code>overStyled</Code> explicitly signifies that you are breaking
43
+ design system rules.
44
+ </Text>
45
+ <List mb="xl" type="ordered">
46
+ <List.Item>
47
+ <strong>Technical Debt:</strong> If over-styling is required, it
48
+ should be treated as a short-term workaround. Ideally, the component
49
+ will be refactored once the required layouts or variants are
50
+ officially integrated into the core Recursica component library.
51
+ </List.Item>
52
+ <List.Item>
53
+ <strong>Auditing & Searching:</strong> Because this pattern creates
54
+ technical debt, we enforce the explicit <Code>overStyled</Code>{" "}
55
+ boolean. This provides a highly auditable, easily searchable string.
56
+ Product managers and engineers can quickly grep the codebase for{" "}
57
+ <Code>overStyled</Code> (or the <Code>RecursicaOverStyled</Code>{" "}
58
+ typings) to hunt down components that don't match standard patterns.
59
+ </List.Item>
60
+ <List.Item>
61
+ <strong>Highly Custom Components:</strong> If your application
62
+ genuinely requires massive custom layouts that the UI kit cannot
63
+ support, <strong>do not hack the Recursica component</strong>.
64
+ Instead, it is highly encouraged that you import the underlying
65
+ primitive component directly from <Code>@mantine/core</Code> and
66
+ construct your independent feature there. While you can utilize raw
67
+ Recursica CSS variables on these custom components, note that they
68
+ are not guaranteed to be accurately maintained as Recursica evolves.
69
+ Keep strict components strict!
70
+ </List.Item>
71
+ </List>
72
+
73
+ <Divider mb="xl" />
74
+
75
+ <Title order={3} mb="sm">
76
+ Permitted Layout Properties
77
+ </Title>
78
+ <Text mb="sm">
79
+ Unlike deep styling bounds (colors, typography, padding, dimensions),
80
+ external <strong>layout spacing properties</strong> like Margins (
81
+ <Code>m</Code>, <Code>mt</Code>, <Code>mb</Code>, <Code>mx</Code>) are
82
+ safely <strong>permitted by default</strong>. This allows integrators
83
+ to structurally compose components alongside siblings without
84
+ breaching internal token boundaries.
85
+ </Text>
86
+ <Text mb="xl">
87
+ When using layout properties, you have the flexibility to use either
88
+ ecosystem seamlessly:
89
+ </Text>
90
+ <List mb="md" type="ordered">
91
+ <List.Item>
92
+ <strong>Mantine Core Values:</strong> Passing standard Mantine sizes
93
+ (like <Code>mt="md"</Code>) passes straight through to Mantine
94
+ natively, allowing you to interface completely normally with a
95
+ parent application's existing Mantine Theme setup that might fall
96
+ outside Recursica's scope.
97
+ </List.Item>
98
+ <List.Item>
99
+ <strong>Recursica Strict Tokens:</strong> Passing our custom
100
+ prefixed tokens (like <Code>mt="rec-md"</Code>) signals our internal
101
+ layout interceptor to securely translate the value directly to our
102
+ native <Code>recursica_brand_dimensions</Code> CSS variables. This
103
+ ensures strict design token measurements while sharing the exact
104
+ same prop interface!
105
+ </List.Item>
106
+ </List>
107
+ <Text mb="sm" fw={500}>
108
+ Available Recursica Layout Tokens:
109
+ </Text>
110
+ <List mb="xl" type="unordered">
111
+ <List.Item>
112
+ <Code>rec-none</Code> (0px limit)
113
+ </List.Item>
114
+ <List.Item>
115
+ <Code>rec-sm</Code> (0.5x scaling)
116
+ </List.Item>
117
+ <List.Item>
118
+ <Code>rec-default</Code> (1.0x scaling)
119
+ </List.Item>
120
+ <List.Item>
121
+ <Code>rec-md</Code> (1.5x scaling)
122
+ </List.Item>
123
+ <List.Item>
124
+ <Code>rec-lg</Code> (2.0x scaling)
125
+ </List.Item>
126
+ <List.Item>
127
+ <Code>rec-xl</Code> (3.0x scaling)
128
+ </List.Item>
129
+ <List.Item>
130
+ <Code>rec-2xl</Code> (4.0x scaling)
131
+ </List.Item>
132
+ </List>
133
+
134
+ <Divider mb="xl" />
135
+
136
+ <Title order={3} mb="md">
137
+ Live Example
138
+ </Title>
139
+ <Text mb="xl">
140
+ Below is a side-by-side comparison. The first is a standard Recursica
141
+ Button protected by the design tokens mapping. The second flagrantly
142
+ forces <Code>overStyled={`{true}`}</Code>, allowing Mantine's native
143
+ styling generics to punch right through the sandbox layout.
144
+ </Text>
145
+
146
+ <Group gap="xl">
147
+ <div>
148
+ <Text size="sm" c="dimmed" mb="xs">
149
+ Strict Baseline (Default)
150
+ </Text>
151
+ <Button variant="solid">Standard UI Kit Button</Button>
152
+ </div>
153
+ <div>
154
+ <Text size="sm" c="dimmed" mb="xs">
155
+ overStyled={`{true}`}
156
+ </Text>
157
+ <Button overStyled={true} bg="pink" c="black" radius="xl">
158
+ Unsafe Pink Marketing Button
159
+ </Button>
160
+ </div>
161
+ </Group>
162
+ </Paper>
163
+ </Container>
164
+ );
165
+ };
166
+
167
+ const meta: Meta<typeof OverStylingInfo> = {
168
+ title: "Introduction/Over Styling",
169
+ component: OverStylingInfo,
170
+ };
171
+
172
+ export default meta;
173
+
174
+ export const Default: StoryObj<typeof OverStylingInfo> = {};
@@ -0,0 +1,56 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import ReactMarkdown from "react-markdown";
3
+ import {
4
+ Container,
5
+ Paper,
6
+ Title,
7
+ TypographyStylesProvider,
8
+ Group,
9
+ Anchor,
10
+ Divider,
11
+ } from "@mantine/core";
12
+ import pkg from "../package.json";
13
+ import changelog from "../CHANGELOG.md?raw";
14
+
15
+ const VersionInfo = () => {
16
+ return (
17
+ <Container size="md" py="xl">
18
+ <Paper withBorder p="xl" radius="md">
19
+ <Title order={1} mb="xs">
20
+ Mantine Adapter v{pkg.version}
21
+ </Title>
22
+ <Group mb="xl" gap="md">
23
+ <Anchor
24
+ href="https://github.com/borderux/recursica"
25
+ target="_blank"
26
+ rel="noopener noreferrer"
27
+ >
28
+ GitHub Repository
29
+ </Anchor>
30
+ <Anchor
31
+ href="https://recursica.com"
32
+ target="_blank"
33
+ rel="noopener noreferrer"
34
+ >
35
+ Documentation & Website
36
+ </Anchor>
37
+ </Group>
38
+ <Divider mb="xl" />
39
+ <TypographyStylesProvider>
40
+ <ReactMarkdown>{changelog}</ReactMarkdown>
41
+ </TypographyStylesProvider>
42
+ </Paper>
43
+ </Container>
44
+ );
45
+ };
46
+
47
+ const meta: Meta<typeof VersionInfo> = {
48
+ title: "Introduction/Version Info",
49
+ component: VersionInfo,
50
+ };
51
+
52
+ export default meta;
53
+
54
+ type Story = StoryObj<typeof VersionInfo>;
55
+
56
+ export const Default: Story = {};
@@ -0,0 +1,48 @@
1
+ # Accordion – implementation notes
2
+
3
+ Decisions and design tweaks strictly tailored for the UI Kit's Accordion wrapped against `@mantine/core`. Use this when managing components possessing deeply nested state logic (e.g., active toggles, nested headers mapping external design properties).
4
+
5
+ ---
6
+
7
+ ## 1. Hybrid Composition API (Smart Rendering Flow)
8
+
9
+ **Decision:** We fundamentally maintain the exact library composition API structure (`<Accordion>`, `<Accordion.Item>`, `<Accordion.Control>`, `<Accordion.Panel>`) while actively supporting an auto-completing flattened prop schema matching the unified Recursica API (`title`, `leftIcon`, `divider`).
10
+ **Implementation:** Avoid rigid raw parameter dumps. Mantine dynamically injects explicit `id` logic, keyboard ARIA mapping, and focus tracking correctly across `Control` to `Panel` DOM connections natively. By exposing the hierarchical mapping 1:1, Recursica safely adopts these capabilities. However, to strictly support Recursica's unified prop mapping interface:
11
+
12
+ - **Auto-Construction:** If integrators natively pass `title` and/or `leftIcon` props into `<AccordionItem>`, the component structurally auto-generates the internal `AccordionControl` sub-wrappers mapping the text and SVG natively, whilst treating `children` implicitly as the Panel contents.
13
+ - **Graceful Falldown:** If `title` is heavily omitted, the node immediately falls backward into raw Mantine composability expecting integrators mapped `<Accordion.Control>` entirely manually.
14
+
15
+ ---
16
+
17
+ ## 2. Default Configuration Reset (`unstyled`)
18
+
19
+ **Decision:** We strip Mantine's inner styles away completely from Accordion mappings by leveraging React's default `variant="unstyled"`.
20
+ **Implementation:** In `Accordion.tsx`, `<MantineAccordion>` binds `variant="unstyled"`. This effectively deletes Mantine's precomputed padding, borders, and shadow mappings allowing our targeted `classNames` inside `Accordion.module.css` to become the exact source of foundational truth without "fighting" `!important` tags or unpredictable flex-layouts inherited globally.
21
+
22
+ ---
23
+
24
+ ## 3. Strict SVG Icons Wrapper (`.iconLeftWrapper`)
25
+
26
+ **Decision:** Identical logic enforced as seen within Buttons: SVG scales dynamically inside `.mantine-leftSection` based on SVGs internal definition boundaries potentially corrupting header gaps.
27
+ **Implementation:** `AccordionControl` captures `<span className={styles.iconLeftWrapper} aria-hidden>` forcing `object-fit: contain` mapped exactly to the `properties_icon-left-size` Recursica dimension token forcing integrator SVG overrides inline perfectly.
28
+
29
+ ---
30
+
31
+ ## 4. Transparent Global Hover Fixes
32
+
33
+ **Decision:** We nullify internal Mantine button hover actions and exclusively utilize Recursica's hover structure natively.
34
+ **Implementation:** We construct `.control::after` pseudo-objects dynamically pulling our `hover-color` & `hover-opacity` bindings. Mantine's native action sets `.control:hover { background-color: var(...) }` dynamically causing internal layer overlaps. We enforce `background-color: transparent` strictly overriding it, preserving our pseudo-overlay layer-cascade cleanly.
35
+
36
+ ---
37
+
38
+ ## 5. Active Target Hooks (`[data-active]`)
39
+
40
+ **Decision:** Collapsed and expanded state tracking requires separate background maps across `AccordionItem`.
41
+ **Implementation:** Rather than syncing React `useState` hooks matching `Accordion.value`, we defer to Mantine's inherent DOM mapping: `.item[data-active]` implicitly triggers exactly when Mantine registers an expansion state swap changing values down dynamically on the element layer, perfectly binding to `--recursica_..._background-expanded`.
42
+
43
+ ---
44
+
45
+ ## 6. Nullifying Isolated State Bounds (`open` boolean)
46
+
47
+ **Decision:** We do not bind isolated `open={true}` state properties natively on individual `<AccordionItem>` configurations.
48
+ **Implementation:** Recursica natively dictates an item-level `open` tracking mapping. However, internally mapping boolean flags structurally across specific tree nodes heavily corrupts Mantine's DOM layout algorithms mapping parent-driven transition listeners. Mantine forces all expanded-height logic to run symmetrically off the `<Accordion value="...">` string matching array to accurately bind ARIA transitions. We explicitly ignore isolated item `<AccordionItem open={...}>` booleans to shield the rendering sequence cleanly.
@@ -0,0 +1,261 @@
1
+ /* ==== ACCORDION CONTAINER ==== */
2
+ .root {
3
+ box-sizing: border-box;
4
+ margin: 0;
5
+ display: flex;
6
+ flex-direction: column;
7
+
8
+ border-style: solid;
9
+ border-width: var(
10
+ --recursica_ui-kit_components_accordion_properties_border-size
11
+ );
12
+ border-radius: var(
13
+ --recursica_ui-kit_components_accordion_properties_border-radius
14
+ );
15
+ border-color: var(
16
+ --recursica_ui-kit_components_accordion_properties_colors_border-color
17
+ );
18
+ background-color: var(
19
+ --recursica_ui-kit_components_accordion_properties_colors_background
20
+ );
21
+ box-shadow: var(--recursica_ui-kit_components_accordion_properties_elevation);
22
+
23
+ max-width: var(--recursica_ui-kit_components_accordion_properties_max-width);
24
+ min-width: var(--recursica_ui-kit_components_accordion_properties_min-width);
25
+ padding: var(--recursica_ui-kit_components_accordion_properties_padding);
26
+
27
+ /* Ensure gaps between items */
28
+ gap: var(--recursica_ui-kit_components_accordion_properties_item-gap);
29
+ }
30
+
31
+ /* ==== ACCORDION ITEM ==== */
32
+ .item {
33
+ box-sizing: border-box;
34
+ margin: 0;
35
+ position: relative;
36
+ transition: all 0.2s ease;
37
+
38
+ /* Overriding Mantine Default Borders natively */
39
+ border-bottom: none;
40
+
41
+ border-style: solid;
42
+ border-color: var(
43
+ --recursica_ui-kit_components_accordion-item_properties_colors_divider
44
+ );
45
+ border-width: var(
46
+ --recursica_ui-kit_components_accordion-item_properties_divider-size
47
+ );
48
+ border-radius: var(
49
+ --recursica_ui-kit_components_accordion-item_properties_border-radius
50
+ );
51
+ box-shadow: var(
52
+ --recursica_ui-kit_components_accordion-item_properties_elevation
53
+ );
54
+
55
+ background-color: var(
56
+ --recursica_ui-kit_components_accordion-item_properties_colors_background-collapsed
57
+ );
58
+ }
59
+ .item[data-active] {
60
+ background-color: var(
61
+ --recursica_ui-kit_components_accordion-item_properties_colors_background-expanded
62
+ );
63
+ }
64
+ .noDivider {
65
+ border-bottom: none !important;
66
+ border-bottom-width: 0 !important;
67
+ }
68
+
69
+ /* ==== ACCORDION CONTROL (HEADER) ==== */
70
+ .control {
71
+ box-sizing: border-box;
72
+ width: 100%;
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: space-between;
76
+
77
+ /* Re-apply gap defined by UI Kit for icons vs text */
78
+ gap: var(--recursica_ui-kit_components_accordion-item_properties_icon-gap);
79
+
80
+ /* Strip Mantine's baked padding directly */
81
+ padding: var(
82
+ --recursica_ui-kit_components_accordion-item_properties_padding-vertical
83
+ )
84
+ var(
85
+ --recursica_ui-kit_components_accordion-item_properties_padding-horizontal
86
+ );
87
+ background-color: transparent;
88
+
89
+ transition: background-color 0.15s ease;
90
+ position: relative;
91
+ z-index: 1;
92
+ color: var(
93
+ --recursica_ui-kit_components_accordion-item_properties_colors_text
94
+ );
95
+
96
+ /* Header Typography */
97
+ font-family: var(
98
+ --recursica_ui-kit_components_accordion-item_properties_header-text_font-family
99
+ );
100
+ font-size: var(
101
+ --recursica_ui-kit_components_accordion-item_properties_header-text_font-size
102
+ );
103
+ font-weight: var(
104
+ --recursica_ui-kit_components_accordion-item_properties_header-text_font-weight
105
+ );
106
+ font-style: var(
107
+ --recursica_ui-kit_components_accordion-item_properties_header-text_font-style
108
+ );
109
+ letter-spacing: var(
110
+ --recursica_ui-kit_components_accordion-item_properties_header-text_letter-spacing
111
+ );
112
+ line-height: var(
113
+ --recursica_ui-kit_components_accordion-item_properties_header-text_line-height
114
+ );
115
+ text-decoration: var(
116
+ --recursica_ui-kit_components_accordion-item_properties_header-text_text-decoration
117
+ );
118
+ text-transform: var(
119
+ --recursica_ui-kit_components_accordion-item_properties_header-text_text-transform
120
+ );
121
+ }
122
+
123
+ /* Mantine natively places hover states on the control node.
124
+ We explicitly override it with our layer hover tokens via an overlay ::after structure
125
+ so we can cleanly utilize the hover-opacity token! */
126
+ .control:hover {
127
+ background-color: transparent;
128
+ }
129
+ .control::after {
130
+ content: "";
131
+ position: absolute;
132
+ inset: 0;
133
+ border-radius: inherit;
134
+ z-index: -1;
135
+ pointer-events: none;
136
+ background-color: var(
137
+ --recursica_ui-kit_components_accordion-item_properties_hover-color
138
+ );
139
+ opacity: 0;
140
+ transition: opacity 150ms ease;
141
+ }
142
+ .control:hover:not(:disabled)::after {
143
+ opacity: var(
144
+ --recursica_ui-kit_components_accordion-item_properties_hover-opacity,
145
+ 0.1
146
+ );
147
+ }
148
+
149
+ /* Label logic inside the Control wrapper */
150
+ .label {
151
+ flex: 1;
152
+ text-align: left;
153
+ color: inherit;
154
+ padding: 0; /* Clear Mantine inner padding */
155
+ }
156
+
157
+ /* ==== CHEVRON / RIGHT ICON ==== */
158
+ .chevron {
159
+ flex-shrink: 0;
160
+ width: var(
161
+ --recursica_ui-kit_components_accordion-item_properties_icon-right-size
162
+ );
163
+ height: var(
164
+ --recursica_ui-kit_components_accordion-item_properties_icon-right-size
165
+ );
166
+ color: var(
167
+ --recursica_ui-kit_components_accordion-item_properties_colors_icon
168
+ );
169
+ margin: 0;
170
+ transition: transform 200ms ease;
171
+ display: flex;
172
+ align-items: center;
173
+ justify-content: center;
174
+ }
175
+ .chevron > * {
176
+ width: 100%;
177
+ height: 100%;
178
+ object-fit: contain;
179
+ }
180
+ .item[data-active] .chevron {
181
+ transform: rotate(180deg);
182
+ }
183
+
184
+ /* ==== LEFT ICON / CUSTOM ICONS ==== */
185
+ .iconLeftWrapper {
186
+ flex-shrink: 0;
187
+ display: flex;
188
+ align-items: center;
189
+ justify-content: center;
190
+ width: var(
191
+ --recursica_ui-kit_components_accordion-item_properties_icon-left-size
192
+ );
193
+ height: var(
194
+ --recursica_ui-kit_components_accordion-item_properties_icon-left-size
195
+ );
196
+ color: var(
197
+ --recursica_ui-kit_components_accordion-item_properties_colors_icon
198
+ );
199
+ }
200
+ .iconLeftWrapper > * {
201
+ width: 100%;
202
+ height: 100%;
203
+ object-fit: contain;
204
+ }
205
+
206
+ /* ==== ACCORDION PANEL (CONTENT) ==== */
207
+ .panel {
208
+ box-sizing: border-box;
209
+ margin: 0;
210
+ padding: 0; /* Overriding dynamic layout structure */
211
+ background-color: var(
212
+ --recursica_ui-kit_components_accordion-item_properties_colors_content-background
213
+ );
214
+ }
215
+
216
+ .content {
217
+ box-sizing: border-box;
218
+ /* Strip Mantine padding and apply logic directly mapped */
219
+ padding: 0
220
+ var(
221
+ --recursica_ui-kit_components_accordion-item_properties_padding-horizontal
222
+ )
223
+ var(
224
+ --recursica_ui-kit_components_accordion-item_properties_content-bottom-padding
225
+ );
226
+
227
+ /* Apply offset gap explicitly calculated below header */
228
+ padding-top: var(
229
+ --recursica_ui-kit_components_accordion-item_properties_header-content-gap
230
+ );
231
+
232
+ color: var(
233
+ --recursica_ui-kit_components_accordion-item_properties_colors_content-text
234
+ );
235
+
236
+ /* Content Typography */
237
+ font-family: var(
238
+ --recursica_ui-kit_components_accordion-item_properties_content-text_font-family
239
+ );
240
+ font-size: var(
241
+ --recursica_ui-kit_components_accordion-item_properties_content-text_font-size
242
+ );
243
+ font-weight: var(
244
+ --recursica_ui-kit_components_accordion-item_properties_content-text_font-weight
245
+ );
246
+ font-style: var(
247
+ --recursica_ui-kit_components_accordion-item_properties_content-text_font-style
248
+ );
249
+ letter-spacing: var(
250
+ --recursica_ui-kit_components_accordion-item_properties_content-text_letter-spacing
251
+ );
252
+ line-height: var(
253
+ --recursica_ui-kit_components_accordion-item_properties_content-text_line-height
254
+ );
255
+ text-decoration: var(
256
+ --recursica_ui-kit_components_accordion-item_properties_content-text_text-decoration
257
+ );
258
+ text-transform: var(
259
+ --recursica_ui-kit_components_accordion-item_properties_content-text_text-transform
260
+ );
261
+ }
@@ -0,0 +1,145 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Accordion } from "./Accordion";
3
+ import { Layer } from "@recursica/adapter-common";
4
+
5
+ const SVGIcon = () => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ width="24"
9
+ height="24"
10
+ viewBox="0 0 24 24"
11
+ fill="none"
12
+ stroke="currentColor"
13
+ strokeWidth="2"
14
+ strokeLinecap="round"
15
+ strokeLinejoin="round"
16
+ >
17
+ <path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
18
+ </svg>
19
+ );
20
+
21
+ const ChevronIcon = () => (
22
+ <svg
23
+ width="24"
24
+ height="24"
25
+ viewBox="0 0 24 24"
26
+ fill="none"
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ >
29
+ <path
30
+ d="M20.0306 9.53062L12.5306 17.0306C12.461 17.1003 12.3783 17.1557 12.2872 17.1934C12.1962 17.2312 12.0986 17.2506 12 17.2506C11.9014 17.2506 11.8038 17.2312 11.7128 17.1934C11.6218 17.1557 11.539 17.1003 11.4694 17.0306L3.96938 9.53062C3.82865 9.38988 3.74959 9.19901 3.74959 8.99999C3.74959 8.80097 3.82865 8.61009 3.96938 8.46936C4.11011 8.32863 4.30098 8.24957 4.50001 8.24957C4.69903 8.24957 4.8899 8.32863 5.03063 8.46936L12 15.4397L18.9694 8.46936C19.0391 8.39968 19.1218 8.34441 19.2128 8.30669C19.3039 8.26898 19.4015 8.24957 19.5 8.24957C19.5986 8.24957 19.6961 8.26898 19.7872 8.30669C19.8782 8.34441 19.9609 8.39968 20.0306 8.46936C20.1003 8.53905 20.1556 8.62177 20.1933 8.71282C20.231 8.80386 20.2504 8.90144 20.2504 8.99999C20.2504 9.09854 20.231 9.19612 20.1933 9.28716C20.1556 9.37821 20.1003 9.46093 20.0306 9.53062Z"
31
+ fill="currentColor"
32
+ />
33
+ </svg>
34
+ );
35
+
36
+ const meta: Meta<typeof Accordion> = {
37
+ title: "UI-Kit/Accordion",
38
+ component: Accordion,
39
+ tags: ["autodocs"],
40
+ parameters: {
41
+ docs: {
42
+ description: {
43
+ component: `
44
+ The \`Accordion\` component intelligently wraps \`@mantine/core\`'s underlying Accordion layers while applying strict native design system mapping via \`recursica_variables_scoped.css\`.
45
+
46
+ ### Hybrid Composition API (Smart-Rendering)
47
+ To maximize flexibility while strictly aligning with the explicit Recursica design logic, the \`AccordionItem\` operates utilizing a **Hybrid Smart-Rendering Flow**:
48
+
49
+ 1. **Auto-Construction (Explicit Mapping)**:
50
+ If you supply the explicitly outlined Recursica properties (\`title\`, \`leftIcon\`) directly onto \`<Accordion.Item>\`, the component auto-generates the necessary \`<Accordion.Control>\` DOM layer inherently bridging the icons and titles visually while leaving the raw \`children\` wrapped neatly as the \`<Accordion.Panel>\`.
51
+
52
+ 2. **Graceful Falldown (Raw Composability)**:
53
+ If you deliberately omit the \`title\` property, the entire mapping system gracefully falls backward yielding exactly to the raw \`@mantine/core\` composition model. Under this context, you must inject your localized \`<Accordion.Control>\` and \`<Accordion.Panel>\` configurations completely manually.
54
+
55
+ ### Architecture Warning (\`open\`)
56
+ To structurally protect the parent wrapper's core transitions tracking architecture (\`<Accordion value="...">\`), this configuration explicitly rejects mapping isolated \`open={true}\` object states natively on specific configurations. Use Mantine's inherent sibling arrays matching the corresponding active value map!
57
+ `,
58
+ },
59
+ },
60
+ },
61
+ };
62
+
63
+ export default meta;
64
+
65
+ export const Default: StoryObj<typeof Accordion> = {
66
+ render: () => {
67
+ return (
68
+ <Layer layer={0} style={{ padding: "24px" }}>
69
+ <Accordion defaultValue="item-1" chevron={<ChevronIcon />}>
70
+ <Accordion.Item value="item-1">
71
+ <Accordion.Control>Billing and Membership</Accordion.Control>
72
+ <Accordion.Panel>
73
+ You can manage your billing directly from the dashboard tab. All
74
+ payments are processed automatically.
75
+ </Accordion.Panel>
76
+ </Accordion.Item>
77
+
78
+ <Accordion.Item value="item-2">
79
+ <Accordion.Control>Refund Policy</Accordion.Control>
80
+ <Accordion.Panel>
81
+ We offer a 30-day money-back guarantee for all new subscriptions.
82
+ </Accordion.Panel>
83
+ </Accordion.Item>
84
+
85
+ <Accordion.Item value="item-3">
86
+ <Accordion.Control>Technical Support</Accordion.Control>
87
+ <Accordion.Panel>
88
+ Our support team is available 24/7 via live chat or email.
89
+ </Accordion.Panel>
90
+ </Accordion.Item>
91
+ </Accordion>
92
+ </Layer>
93
+ );
94
+ },
95
+ };
96
+
97
+ export const WithIcons: StoryObj<typeof Accordion> = {
98
+ render: () => {
99
+ return (
100
+ <Layer layer={0} style={{ padding: "24px" }}>
101
+ <Accordion defaultValue="security" chevron={<ChevronIcon />}>
102
+ <Accordion.Item value="security">
103
+ <Accordion.Control leftIcon={<SVGIcon />}>
104
+ Security Settings
105
+ </Accordion.Control>
106
+ <Accordion.Panel>
107
+ Enable two-factor authentication (2FA) and monitor active sessions
108
+ below.
109
+ </Accordion.Panel>
110
+ </Accordion.Item>
111
+
112
+ <Accordion.Item value="privacy">
113
+ <Accordion.Control leftIcon={<SVGIcon />}>
114
+ Privacy Configuration
115
+ </Accordion.Control>
116
+ <Accordion.Panel>
117
+ Choose what data is shared with our analytics partners.
118
+ </Accordion.Panel>
119
+ </Accordion.Item>
120
+ </Accordion>
121
+ </Layer>
122
+ );
123
+ },
124
+ };
125
+
126
+ export const LayerOne: StoryObj<typeof Accordion> = {
127
+ render: () => {
128
+ return (
129
+ <Layer layer={1} style={{ padding: "24px" }}>
130
+ <Accordion defaultValue="demo" chevron={<ChevronIcon />}>
131
+ <Accordion.Item value="demo">
132
+ <Accordion.Control leftIcon={<SVGIcon />}>
133
+ Layer 1 Render Engine
134
+ </Accordion.Control>
135
+ <Accordion.Panel>
136
+ This Accordion dynamically updates its colors, borders, and
137
+ typography variables because it is wrapped securely by the
138
+ simulated `data-recursica-layer="1"`.
139
+ </Accordion.Panel>
140
+ </Accordion.Item>
141
+ </Accordion>
142
+ </Layer>
143
+ );
144
+ },
145
+ };