@recursica/mui-adapter 0.34.0 → 0.34.3
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.
- package/CHANGELOG.md +27 -0
- package/dist/index.d.ts +219 -154
- package/dist/mui-adapter.cjs +55 -55
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +3383 -3440
- package/dist/mui-adapter.js.map +1 -1
- package/package.json +9 -4
- package/src/OverStyling.tsx +2 -2
- package/src/components/Accordion/Accordion.test.tsx +1 -0
- package/src/components/AssistiveElement/AssistiveElement.test.tsx +1 -0
- package/src/components/Autocomplete/Autocomplete.test.tsx +1 -0
- package/src/components/Avatar/Avatar.test.tsx +1 -0
- package/src/components/Badge/Badge.test.tsx +1 -0
- package/src/components/Box/Box.test.tsx +1 -0
- package/src/components/Breadcrumb/Breadcrumb.test.tsx +1 -0
- package/src/components/Button/BUTTON_IMPLEMENTATION_NOTES.md +10 -0
- package/src/components/Button/Button.module.css +1 -0
- package/src/components/Button/Button.styleIsolation.dom.test.tsx +98 -0
- package/src/components/Card/Card.test.tsx +1 -0
- package/src/components/Checkbox/Checkbox.test.tsx +1 -0
- package/src/components/Chip/Chip.test.tsx +1 -0
- package/src/components/Container/Container.test.tsx +1 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +25 -0
- package/src/components/DatePicker/DatePicker.test.tsx +1 -0
- package/src/components/Dropdown/Dropdown.test.tsx +1 -0
- package/src/components/FileInput/FileInput.test.tsx +1 -0
- package/src/components/FileUpload/FileUpload.test.tsx +1 -0
- package/src/components/Flex/Flex.test.tsx +1 -0
- package/src/components/Flex/Flex.tsx +21 -4
- package/src/components/FormControlLayout/FormControlLayout.test.tsx +1 -0
- package/src/components/FormControlWrapper/FormControlWrapper.test.tsx +1 -0
- package/src/components/Grid/Grid.stories.tsx +38 -62
- package/src/components/Grid/Grid.test.tsx +1 -0
- package/src/components/Grid/Grid.tsx +59 -144
- package/src/components/Grid/IMPLEMENTATION_NOTES.md +11 -11
- package/src/components/Grid/USAGE.md +8 -6
- package/src/components/Group/Group.test.tsx +1 -0
- package/src/components/Group/Group.tsx +24 -2
- package/src/components/HoverCard/HoverCard.test.tsx +1 -0
- package/src/components/Label/Label.test.tsx +1 -0
- package/src/components/Link/Link.test.tsx +1 -0
- package/src/components/Loader/Loader.test.tsx +1 -0
- package/src/components/Menu/Menu.test.tsx +1 -0
- package/src/components/Modal/Modal.module.css +103 -1
- package/src/components/Modal/Modal.stories.tsx +28 -2
- package/src/components/Modal/Modal.test.tsx +1 -0
- package/src/components/NumberInput/NumberInput.test.tsx +1 -0
- package/src/components/Pagination/Pagination.test.tsx +1 -0
- package/src/components/Panel/Panel.test.tsx +1 -0
- package/src/components/Popover/Popover.test.tsx +1 -0
- package/src/components/Radio/Radio.test.tsx +1 -0
- package/src/components/ReadOnlyField/ReadOnlyField.test.tsx +1 -0
- package/src/components/SegmentedControl/SegmentedControl.test.tsx +1 -0
- package/src/components/Slider/Slider.test.tsx +1 -0
- package/src/components/Stack/Stack.stories.tsx +9 -9
- package/src/components/Stack/Stack.test.tsx +1 -0
- package/src/components/Stack/Stack.tsx +15 -14
- package/src/components/Stack/USAGE.md +1 -1
- package/src/components/Stepper/Stepper.test.tsx +1 -0
- package/src/components/Switch/Switch.stories.tsx +1 -1
- package/src/components/Switch/Switch.test.tsx +1 -0
- package/src/components/Table/Table.test.tsx +1 -0
- package/src/components/Tabs/Tabs.test.tsx +1 -0
- package/src/components/Text/Text.stories.tsx +3 -16
- package/src/components/Text/Text.test.tsx +1 -0
- package/src/components/TextArea/TextArea.test.tsx +1 -0
- package/src/components/TextField/TextField.test.tsx +1 -0
- package/src/components/TimePicker/TimePicker.test.tsx +1 -0
- package/src/components/Timeline/Timeline.test.tsx +1 -0
- package/src/components/Title/Title.stories.tsx +3 -16
- package/src/components/Title/Title.test.tsx +1 -0
- package/src/components/Toast/Toast.test.tsx +1 -0
- package/src/components/Tooltip/Tooltip.test.tsx +1 -0
- package/src/components/TransferList/TransferList.test.tsx +1 -0
- package/src/components/Tree/Tree.test.tsx +1 -0
- package/src/components/Typography/Typography.test.tsx +1 -0
- package/src/utils/filterStylingProps.test.ts +85 -0
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git+https://github.com/borderux/recursica.git",
|
|
14
14
|
"directory": "packages/mui-adapter"
|
|
15
15
|
},
|
|
16
|
-
"version": "0.34.
|
|
16
|
+
"version": "0.34.3",
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
@@ -59,14 +59,19 @@
|
|
|
59
59
|
"lint": "eslint .",
|
|
60
60
|
"storybook": "storybook dev -p 6012",
|
|
61
61
|
"analyze-tokens": "analyze-tokens --css @recursica/official-release/recursica_variables_scoped.css --dir src/components --output token-analysis.json",
|
|
62
|
-
"prebuild": "npm run analyze-tokens"
|
|
62
|
+
"prebuild": "npm run analyze-tokens",
|
|
63
|
+
"adapter-tester": "adapter-tester --serve",
|
|
64
|
+
"adapter-tester:automated": "adapter-tester",
|
|
65
|
+
"test": "vitest run --project unit",
|
|
66
|
+
"test:dom": "vitest run --project dom"
|
|
63
67
|
},
|
|
64
68
|
"devDependencies": {
|
|
65
|
-
"@chromatic-com/storybook": "^5.1.1",
|
|
66
69
|
"@eslint/js": "^9.25.0",
|
|
67
70
|
"@mui/lab": "^7.0.1-beta.25",
|
|
68
71
|
"@mui/x-date-pickers": "^9.11.0",
|
|
69
72
|
"@mui/x-tree-view": "^9.11.0",
|
|
73
|
+
"@playwright/test": "^1.53.0",
|
|
74
|
+
"@recursica/adapter-tester": "*",
|
|
70
75
|
"@recursica/recursica-postcss-vars": "*",
|
|
71
76
|
"@recursica/storybook-template": "*",
|
|
72
77
|
"@recursica/token-analyzer": "*",
|
|
@@ -102,7 +107,7 @@
|
|
|
102
107
|
"vitest": "^3.2.4"
|
|
103
108
|
},
|
|
104
109
|
"dependencies": {
|
|
105
|
-
"@recursica/adapter-common": "^0.25.
|
|
110
|
+
"@recursica/adapter-common": "^0.25.1",
|
|
106
111
|
"@recursica/official-release": "^2.8.0",
|
|
107
112
|
"dayjs": "^1.11.21"
|
|
108
113
|
},
|
package/src/OverStyling.tsx
CHANGED
|
@@ -35,7 +35,7 @@ export const OverStylingInfo = () => {
|
|
|
35
35
|
Try It Yourself
|
|
36
36
|
</Title>
|
|
37
37
|
|
|
38
|
-
<Stack direction="row" alignItems="center"
|
|
38
|
+
<Stack direction="row" alignItems="center" spacing="rec-sm" mb="rec-md">
|
|
39
39
|
<Switch
|
|
40
40
|
label="Highlight Over-Styled Components"
|
|
41
41
|
checked={isHighlightActive}
|
|
@@ -50,7 +50,7 @@ export const OverStylingInfo = () => {
|
|
|
50
50
|
styling generics to punch right through the sandbox layout.
|
|
51
51
|
</Text>
|
|
52
52
|
|
|
53
|
-
<Stack direction="row"
|
|
53
|
+
<Stack direction="row" spacing="rec-default">
|
|
54
54
|
<Box>
|
|
55
55
|
<Text
|
|
56
56
|
variant="caption"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Accordion component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future AssistiveElement component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Autocomplete component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Avatar component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Badge component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Box component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Breadcrumb component tests. Add tests here if/when needed.
|
|
@@ -65,3 +65,13 @@ We explicitly pass `disableRipple` and `disableElevation` to block MUI's dynamic
|
|
|
65
65
|
**Real discrepancy found:** `.root`'s "Shared Defaults" set `line-height` once, unconditionally, from the _default_-size token, and `.labelText` merely did `line-height: inherit` — so the small-size line-height token was never actually referenced (it was `recursica-ignore`d as "redundant"). Mantine's `Button.module.css`, by contrast, sets `line-height` directly on `.labelText` per size, from each size's own token. They currently resolve to the same literal value, so this wasn't visually observable, but it's a latent divergence from the source of truth — a future token change to the small-size line-height would silently not apply in mui-adapter.
|
|
66
66
|
|
|
67
67
|
**Fix:** moved `line-height` off `.root` and onto `.labelText` (default token), added `.root[data-size="small"] .labelText { line-height: ... }` (small token), and removed the now-inaccurate `recursica-ignore` for that token — matching Mantine's structure exactly.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Button doesn't shrink inside a constraining container (Genesis, 2026-08-27)
|
|
72
|
+
|
|
73
|
+
**Bug:** in the `TruncatedLabel` story (`<div style={{ maxWidth: 250 }}><Button>...long label.../Button></div>`), the button ignored the 250px wrapper entirely and rendered at its full 534px intrinsic width, overflowing the wrapper instead of shrinking and showing the ellipsis.
|
|
74
|
+
|
|
75
|
+
**Root cause:** `.root` has `width: fit-content` (to hug its own content instead of stretching in flex columns) but no `max-width`. Verified via Playwright: the wrapper measured exactly 250px, but `fit-content` on `.root` still resolved to its 534px `max-content` size — it doesn't reliably clamp against a narrower containing block on its own. Same root cause and identical fix in mantine-adapter.
|
|
76
|
+
|
|
77
|
+
**Fix:** added `max-width: 100%` to `.root`. It's a no-op when the parent is wide enough (confirmed no change to `Default`/`IconOnly`/`TextWithIcon` story widths), and clamps the button to the parent's resolved width when the parent is narrower — at which point the existing `overflow: hidden` (`.root`) + `text-overflow: ellipsis`/`white-space: nowrap` (`.labelText`) take over, exactly as already documented above.
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
position: relative;
|
|
18
18
|
transition: all 0.2s ease;
|
|
19
19
|
width: fit-content; /* Prevent stretching in flex columns */
|
|
20
|
+
max-width: 100%; /* Let a constraining parent (e.g. max-width container) actually shrink the button; fit-content alone ignores it */
|
|
20
21
|
|
|
21
22
|
/* Shared Defaults */
|
|
22
23
|
font-family: var(
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
4
|
+
import { flushSync } from "react-dom";
|
|
5
|
+
import { ThemeProvider, createTheme, Button as MuiButton } from "@mui/material";
|
|
6
|
+
import { Button as RecursicaButton } from "./Button";
|
|
7
|
+
|
|
8
|
+
function mount(node: React.ReactElement): {
|
|
9
|
+
container: HTMLElement;
|
|
10
|
+
root: Root;
|
|
11
|
+
} {
|
|
12
|
+
const container = document.createElement("div");
|
|
13
|
+
document.body.appendChild(container);
|
|
14
|
+
const root = createRoot(container);
|
|
15
|
+
flushSync(() => root.render(node));
|
|
16
|
+
return { container, root };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function unmount({ container, root }: { container: HTMLElement; root: Root }) {
|
|
20
|
+
root.unmount();
|
|
21
|
+
container.remove();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const theme = createTheme({ colorSchemes: { light: true, dark: true } });
|
|
25
|
+
|
|
26
|
+
function withProvider(node: React.ReactElement) {
|
|
27
|
+
return <ThemeProvider theme={theme}>{node}</ThemeProvider>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Guards against Recursica's Button CSS bleeding onto (or being bled onto by) a plain,
|
|
32
|
+
* unwrapped MUI Button rendered in the same document. The two must be visibly different
|
|
33
|
+
* (Recursica's own classes/data-attributes), but the plain kit button must render identically
|
|
34
|
+
* whether or not a Recursica Button exists alongside it.
|
|
35
|
+
*/
|
|
36
|
+
describe("Button style isolation from the underlying MUI kit", () => {
|
|
37
|
+
it("adds Recursica-only classes/attributes without leaking them onto a plain MUI Button", () => {
|
|
38
|
+
const recursica = mount(
|
|
39
|
+
withProvider(<RecursicaButton>Recursica</RecursicaButton>),
|
|
40
|
+
);
|
|
41
|
+
const kit = mount(withProvider(<MuiButton>Plain</MuiButton>));
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const recursicaButton = recursica.container.querySelector("button")!;
|
|
45
|
+
const kitButton = kit.container.querySelector("button")!;
|
|
46
|
+
|
|
47
|
+
const recursicaClasses = Array.from(recursicaButton.classList);
|
|
48
|
+
const kitClasses = new Set(kitButton.classList);
|
|
49
|
+
const recursicaOnlyClasses = recursicaClasses.filter(
|
|
50
|
+
(cls) => !kitClasses.has(cls),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// Recursica's Button.module.css classes must exist...
|
|
54
|
+
expect(recursicaOnlyClasses.length).toBeGreaterThan(0);
|
|
55
|
+
// ...and none of them are present on the plain kit button.
|
|
56
|
+
for (const cls of recursicaOnlyClasses) {
|
|
57
|
+
expect(kitButton.classList.contains(cls)).toBe(false);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Recursica-only markers confirm the two are meaningfully different components.
|
|
61
|
+
expect(recursicaButton.getAttribute("data-variant")).toBe("solid");
|
|
62
|
+
expect(kitButton.getAttribute("data-variant")).toBeNull();
|
|
63
|
+
} finally {
|
|
64
|
+
unmount(recursica);
|
|
65
|
+
unmount(kit);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("renders a plain MUI Button identically whether or not Recursica's Button is mounted alongside it", () => {
|
|
70
|
+
const recursica = mount(
|
|
71
|
+
withProvider(<RecursicaButton>Recursica</RecursicaButton>),
|
|
72
|
+
);
|
|
73
|
+
const kitAlongsideRecursica = mount(
|
|
74
|
+
withProvider(<MuiButton>Plain</MuiButton>),
|
|
75
|
+
);
|
|
76
|
+
const kitIsolated = mount(withProvider(<MuiButton>Plain</MuiButton>));
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
const kitButton =
|
|
80
|
+
kitAlongsideRecursica.container.querySelector("button")!;
|
|
81
|
+
const isolatedButton = kitIsolated.container.querySelector("button")!;
|
|
82
|
+
|
|
83
|
+
expect(Array.from(kitButton.classList).sort()).toEqual(
|
|
84
|
+
Array.from(isolatedButton.classList).sort(),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const kitStyle = getComputedStyle(kitButton);
|
|
88
|
+
const isolatedStyle = getComputedStyle(isolatedButton);
|
|
89
|
+
expect(kitStyle.borderRadius).toBe(isolatedStyle.borderRadius);
|
|
90
|
+
expect(kitStyle.backgroundColor).toBe(isolatedStyle.backgroundColor);
|
|
91
|
+
expect(kitStyle.fontFamily).toBe(isolatedStyle.fontFamily);
|
|
92
|
+
} finally {
|
|
93
|
+
unmount(recursica);
|
|
94
|
+
unmount(kitAlongsideRecursica);
|
|
95
|
+
unmount(kitIsolated);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Card component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Checkbox component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Chip component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Container component tests. Add tests here if/when needed.
|
|
@@ -120,6 +120,31 @@ export const ErrorState: Story = {
|
|
|
120
120
|
},
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
+
export const OpenedCalendar: Story = {
|
|
124
|
+
args: {
|
|
125
|
+
label: "Meeting Date",
|
|
126
|
+
assistiveText: "Calendar rendered open by default for styling review.",
|
|
127
|
+
// MUI X's DatePicker supports a controlled `open` prop directly; pairing it with a
|
|
128
|
+
// no-op `onClose` keeps the calendar open with no click interaction needed — same
|
|
129
|
+
// intent as the mantine-adapter's `OpenedCalendar` story.
|
|
130
|
+
open: true,
|
|
131
|
+
onClose: () => {},
|
|
132
|
+
// Fixed (not computed) so the selected-day fill is visible on load, alongside the
|
|
133
|
+
// today marker, for styling review. Local-component constructor, not an ISO date
|
|
134
|
+
// string — `new Date("2026-08-26")` parses as UTC midnight, which renders as the
|
|
135
|
+
// 25th in any timezone behind UTC.
|
|
136
|
+
defaultValue: new Date(2026, 7, 26),
|
|
137
|
+
},
|
|
138
|
+
parameters: {
|
|
139
|
+
docs: {
|
|
140
|
+
description: {
|
|
141
|
+
story:
|
|
142
|
+
"The calendar dropdown renders open by default so its styling can be reviewed without a click interaction.",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
123
148
|
export const StaticReadOnly: Story = {
|
|
124
149
|
args: {
|
|
125
150
|
label: "Static ReadOnly Review",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future DatePicker component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Dropdown component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future FileInput component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future FileUpload component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Flex component tests. Add tests here if/when needed.
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Flex layout wrapper.
|
|
3
3
|
*
|
|
4
4
|
* NOTE: MUI does not have a native `<Flex>` component (it relies on `<Box display="flex">`
|
|
5
|
-
* or `<Stack>`).
|
|
6
|
-
*
|
|
5
|
+
* or `<Stack>`). Per the layout-components rule, when a UI kit lacks an equivalent component
|
|
6
|
+
* it's built following a prop definition similar to Mantine's own `Flex` (gap/rowGap/columnGap/
|
|
7
|
+
* direction/align/justify/wrap) — this shape is owned locally here, not shared as a formal
|
|
8
|
+
* cross-adapter Recursica contract.
|
|
7
9
|
*
|
|
8
10
|
* Like Stack and Group, this is a primitive layout component. It strictly filters out the
|
|
9
11
|
* `sx` prop using `OmitSx` and `filterSxProp` to enforce the use of standard layout scales.
|
|
@@ -17,10 +19,25 @@ import {
|
|
|
17
19
|
type WithRecursicaSpacing,
|
|
18
20
|
} from "../../utils/filterStylingProps";
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
interface FlexOwnProps {
|
|
23
|
+
/** Global gap spacing key or CSS value */
|
|
24
|
+
gap?: string | number;
|
|
25
|
+
/** Horizontal row spacing */
|
|
26
|
+
rowGap?: string | number;
|
|
27
|
+
/** Vertical column spacing */
|
|
28
|
+
columnGap?: string | number;
|
|
29
|
+
/** Flex direction */
|
|
30
|
+
direction?: React.CSSProperties["flexDirection"];
|
|
31
|
+
/** Align items */
|
|
32
|
+
align?: React.CSSProperties["alignItems"];
|
|
33
|
+
/** Justify content */
|
|
34
|
+
justify?: React.CSSProperties["justifyContent"];
|
|
35
|
+
/** Flex wrap */
|
|
36
|
+
wrap?: React.CSSProperties["flexWrap"];
|
|
37
|
+
}
|
|
21
38
|
|
|
22
39
|
export type FlexProps = WithRecursicaSpacing<
|
|
23
|
-
OmitSx<MUIBoxProps &
|
|
40
|
+
OmitSx<MUIBoxProps & FlexOwnProps>
|
|
24
41
|
>;
|
|
25
42
|
|
|
26
43
|
export const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future FormControlLayout component tests. Add tests here if/when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future FormControlWrapper component tests. Add tests here if/when needed.
|
|
@@ -14,20 +14,19 @@ const meta: Meta<GridStoryProps> = {
|
|
|
14
14
|
docs: {
|
|
15
15
|
description: {
|
|
16
16
|
component:
|
|
17
|
-
"Grid is a 12-column (by default) responsive grid layout hand-composed from MUI's Grid, providing column
|
|
17
|
+
"Grid is a 12-column (by default) responsive grid layout hand-composed from MUI's own Grid, providing column sizing, offsets, ordering, and breakpoint-based visibility using MUI's native prop names.",
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
controls: {
|
|
21
|
-
include: ["children", "
|
|
21
|
+
include: ["children", "spacing", "columns", "direction", "wrap"],
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
args: {
|
|
25
|
-
|
|
25
|
+
spacing: "rec-default",
|
|
26
26
|
columns: 12,
|
|
27
|
-
grow: false,
|
|
28
27
|
},
|
|
29
28
|
argTypes: {
|
|
30
|
-
|
|
29
|
+
spacing: {
|
|
31
30
|
control: "select",
|
|
32
31
|
options: [
|
|
33
32
|
"rec-none",
|
|
@@ -38,32 +37,12 @@ const meta: Meta<GridStoryProps> = {
|
|
|
38
37
|
"rec-xl",
|
|
39
38
|
"rec-2xl",
|
|
40
39
|
],
|
|
41
|
-
description: "
|
|
40
|
+
description: "Space between columns",
|
|
42
41
|
},
|
|
43
42
|
columns: {
|
|
44
43
|
control: "number",
|
|
45
44
|
description: "Number of columns in each row",
|
|
46
45
|
},
|
|
47
|
-
grow: {
|
|
48
|
-
control: "boolean",
|
|
49
|
-
description: "Columns in the last row expand to fill available space",
|
|
50
|
-
},
|
|
51
|
-
justify: {
|
|
52
|
-
control: "select",
|
|
53
|
-
options: [
|
|
54
|
-
"flex-start",
|
|
55
|
-
"center",
|
|
56
|
-
"flex-end",
|
|
57
|
-
"space-between",
|
|
58
|
-
"space-around",
|
|
59
|
-
],
|
|
60
|
-
description: "Justify-content property",
|
|
61
|
-
},
|
|
62
|
-
align: {
|
|
63
|
-
control: "select",
|
|
64
|
-
options: ["flex-start", "center", "flex-end", "stretch"],
|
|
65
|
-
description: "Align-items property",
|
|
66
|
-
},
|
|
67
46
|
},
|
|
68
47
|
};
|
|
69
48
|
|
|
@@ -83,34 +62,34 @@ export const Default: Story = {
|
|
|
83
62
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
84
63
|
render: ({ withLayer, layer, ...args }: any) => (
|
|
85
64
|
<Grid {...args}>
|
|
86
|
-
<Grid.Col
|
|
87
|
-
<Swatch>
|
|
65
|
+
<Grid.Col size={4}>
|
|
66
|
+
<Swatch>size 4</Swatch>
|
|
88
67
|
</Grid.Col>
|
|
89
|
-
<Grid.Col
|
|
90
|
-
<Swatch>
|
|
68
|
+
<Grid.Col size={4}>
|
|
69
|
+
<Swatch>size 4</Swatch>
|
|
91
70
|
</Grid.Col>
|
|
92
|
-
<Grid.Col
|
|
93
|
-
<Swatch>
|
|
71
|
+
<Grid.Col size={4}>
|
|
72
|
+
<Swatch>size 4</Swatch>
|
|
94
73
|
</Grid.Col>
|
|
95
74
|
</Grid>
|
|
96
75
|
),
|
|
97
76
|
};
|
|
98
77
|
|
|
99
|
-
export const
|
|
78
|
+
export const ResponsiveSizes: Story = {
|
|
100
79
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
101
80
|
render: ({ withLayer, layer, ...args }: any) => (
|
|
102
81
|
<Grid {...args}>
|
|
103
|
-
<Grid.Col
|
|
104
|
-
<Swatch>
|
|
82
|
+
<Grid.Col size={{ xs: 12, sm: 6, md: 3 }}>
|
|
83
|
+
<Swatch>xs 12 / sm 6 / md 3</Swatch>
|
|
105
84
|
</Grid.Col>
|
|
106
|
-
<Grid.Col
|
|
107
|
-
<Swatch>
|
|
85
|
+
<Grid.Col size={{ xs: 12, sm: 6, md: 3 }}>
|
|
86
|
+
<Swatch>xs 12 / sm 6 / md 3</Swatch>
|
|
108
87
|
</Grid.Col>
|
|
109
|
-
<Grid.Col
|
|
110
|
-
<Swatch>
|
|
88
|
+
<Grid.Col size={{ xs: 12, sm: 6, md: 3 }}>
|
|
89
|
+
<Swatch>xs 12 / sm 6 / md 3</Swatch>
|
|
111
90
|
</Grid.Col>
|
|
112
|
-
<Grid.Col
|
|
113
|
-
<Swatch>
|
|
91
|
+
<Grid.Col size={{ xs: 12, sm: 6, md: 3 }}>
|
|
92
|
+
<Swatch>xs 12 / sm 6 / md 3</Swatch>
|
|
114
93
|
</Grid.Col>
|
|
115
94
|
</Grid>
|
|
116
95
|
),
|
|
@@ -120,31 +99,28 @@ export const Offset: Story = {
|
|
|
120
99
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
121
100
|
render: ({ withLayer, layer, ...args }: any) => (
|
|
122
101
|
<Grid {...args}>
|
|
123
|
-
<Grid.Col
|
|
124
|
-
<Swatch>
|
|
102
|
+
<Grid.Col size={4} offset={4}>
|
|
103
|
+
<Swatch>size 4, offset 4</Swatch>
|
|
125
104
|
</Grid.Col>
|
|
126
|
-
<Grid.Col
|
|
127
|
-
<Swatch>
|
|
105
|
+
<Grid.Col size={4}>
|
|
106
|
+
<Swatch>size 4</Swatch>
|
|
128
107
|
</Grid.Col>
|
|
129
108
|
</Grid>
|
|
130
109
|
),
|
|
131
110
|
};
|
|
132
111
|
|
|
133
112
|
export const Grow: Story = {
|
|
134
|
-
args: {
|
|
135
|
-
grow: true,
|
|
136
|
-
},
|
|
137
113
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
138
114
|
render: ({ withLayer, layer, ...args }: any) => (
|
|
139
115
|
<Grid {...args}>
|
|
140
|
-
<Grid.Col
|
|
141
|
-
<Swatch>
|
|
116
|
+
<Grid.Col size={3}>
|
|
117
|
+
<Swatch>size 3</Swatch>
|
|
142
118
|
</Grid.Col>
|
|
143
|
-
<Grid.Col
|
|
144
|
-
<Swatch>
|
|
119
|
+
<Grid.Col size={3}>
|
|
120
|
+
<Swatch>size 3</Swatch>
|
|
145
121
|
</Grid.Col>
|
|
146
|
-
<Grid.Col
|
|
147
|
-
<Swatch>
|
|
122
|
+
<Grid.Col size="grow">
|
|
123
|
+
<Swatch>size "grow" (fills remaining space)</Swatch>
|
|
148
124
|
</Grid.Col>
|
|
149
125
|
</Grid>
|
|
150
126
|
),
|
|
@@ -157,14 +133,14 @@ export const CustomColumnCount: Story = {
|
|
|
157
133
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
158
134
|
render: ({ withLayer, layer, ...args }: any) => (
|
|
159
135
|
<Grid {...args}>
|
|
160
|
-
<Grid.Col
|
|
161
|
-
<Swatch>
|
|
136
|
+
<Grid.Col size={2}>
|
|
137
|
+
<Swatch>size 2 of 6</Swatch>
|
|
162
138
|
</Grid.Col>
|
|
163
|
-
<Grid.Col
|
|
164
|
-
<Swatch>
|
|
139
|
+
<Grid.Col size={2}>
|
|
140
|
+
<Swatch>size 2 of 6</Swatch>
|
|
165
141
|
</Grid.Col>
|
|
166
|
-
<Grid.Col
|
|
167
|
-
<Swatch>
|
|
142
|
+
<Grid.Col size={2}>
|
|
143
|
+
<Swatch>size 2 of 6</Swatch>
|
|
168
144
|
</Grid.Col>
|
|
169
145
|
</Grid>
|
|
170
146
|
),
|
|
@@ -174,10 +150,10 @@ export const VisibleHiddenFrom: Story = {
|
|
|
174
150
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
175
151
|
render: ({ withLayer, layer, ...args }: any) => (
|
|
176
152
|
<Grid {...args}>
|
|
177
|
-
<Grid.Col
|
|
153
|
+
<Grid.Col size={6} hiddenFrom="sm">
|
|
178
154
|
<Swatch>hidden from sm and up</Swatch>
|
|
179
155
|
</Grid.Col>
|
|
180
|
-
<Grid.Col
|
|
156
|
+
<Grid.Col size={6} visibleFrom="sm">
|
|
181
157
|
<Swatch>visible from sm and up</Swatch>
|
|
182
158
|
</Grid.Col>
|
|
183
159
|
</Grid>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Placeholder for future Grid component tests. Add tests here if/when needed.
|