@ttoss/layouts 0.8.1 → 0.9.1
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/README.md +45 -21
- package/dist/esm/index.js +42 -26
- package/dist/index.d.ts +16 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -59,9 +59,7 @@ The Main component provides a structured content area with three distinct sectio
|
|
|
59
59
|
<button>Action Button</button>
|
|
60
60
|
</Layout.Main.Header>
|
|
61
61
|
|
|
62
|
-
<Layout.Main.Body>
|
|
63
|
-
Main content with consistent padding and scroll handling
|
|
64
|
-
</Layout.Main.Body>
|
|
62
|
+
<Layout.Main.Body>Main content with scroll handling</Layout.Main.Body>
|
|
65
63
|
|
|
66
64
|
<Layout.Main.Footer>
|
|
67
65
|
<span>Last updated: Today</span>
|
|
@@ -162,25 +160,51 @@ All components integrate seamlessly with `@ttoss/ui` theme system via `sx` prop:
|
|
|
162
160
|
</Layout.Main>
|
|
163
161
|
```
|
|
164
162
|
|
|
165
|
-
###
|
|
166
|
-
|
|
167
|
-
The `
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
minWidth: ['100%', '1100px'],
|
|
176
|
-
marginX: 'auto',
|
|
177
|
-
paddingX: '4',
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
};
|
|
181
|
-
```
|
|
163
|
+
### Inner Container Styling with containerSx
|
|
164
|
+
|
|
165
|
+
The `MainHeader`, `MainFooter`, and `MainBody` components (`Layout.Main.Header`, `Layout.Main.Footer`, `Layout.Main.Body`) include an inner `Container` component for consistent layout width and padding. While the `sx` prop styles the outer `Box` element, the `containerSx` prop allows you to customize the inner `Container`'s styling.
|
|
166
|
+
|
|
167
|
+
The inner `Container` uses the `layout.container` variant, which by default limits the maxWidth to 1200px on larger screens (responsive: 100% on mobile).
|
|
168
|
+
|
|
169
|
+
**Key Differences:**
|
|
170
|
+
|
|
171
|
+
- **`sx`**: Styles the outer `Box` wrapper (background, borders, positioning, etc.)
|
|
172
|
+
- **`containerSx`**: Styles the inner `Container` (max-width, padding, margins, etc.)
|
|
182
173
|
|
|
183
|
-
|
|
174
|
+
**When to use `containerSx`:**
|
|
175
|
+
|
|
176
|
+
- Override default container padding or max-width
|
|
177
|
+
- Apply theme-specific container styling
|
|
178
|
+
- Customize spacing within the layout structure
|
|
179
|
+
|
|
180
|
+
**Examples:**
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
// Customize container padding for MainBody
|
|
184
|
+
<Layout.Main.Body
|
|
185
|
+
containerSx={{
|
|
186
|
+
paddingX: '8', // Override default padding
|
|
187
|
+
maxWidth: '1200px', // Custom max-width
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
Content with custom container styling
|
|
191
|
+
</Layout.Main.Body>
|
|
192
|
+
|
|
193
|
+
// Style outer Box background while customizing inner container
|
|
194
|
+
<Layout.Main.Header
|
|
195
|
+
sx={{
|
|
196
|
+
backgroundColor: 'gray.100', // Outer Box background
|
|
197
|
+
boxShadow: 'md', // Outer Box shadow
|
|
198
|
+
}}
|
|
199
|
+
containerSx={{
|
|
200
|
+
paddingY: '6', // Inner container vertical padding
|
|
201
|
+
justifyContent: 'space-between', // Inner container alignment
|
|
202
|
+
}}
|
|
203
|
+
>
|
|
204
|
+
<Logo />
|
|
205
|
+
<Navigation />
|
|
206
|
+
</Layout.Main.Header>
|
|
207
|
+
```
|
|
184
208
|
|
|
185
209
|
## Advanced Usage
|
|
186
210
|
|
package/dist/esm/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// src/components/Layout.tsx
|
|
10
|
-
import { Box as Box8, Container as
|
|
10
|
+
import { Box as Box8, Container as Container4 } from "@ttoss/ui";
|
|
11
11
|
|
|
12
12
|
// src/components/Footer.tsx
|
|
13
13
|
import { Box } from "@ttoss/ui";
|
|
@@ -2429,63 +2429,82 @@ var Header = /* @__PURE__ */__name(({
|
|
|
2429
2429
|
Header.displayName = "Header";
|
|
2430
2430
|
|
|
2431
2431
|
// src/components/Main.tsx
|
|
2432
|
-
import { Box as Box7
|
|
2432
|
+
import { Box as Box7 } from "@ttoss/ui";
|
|
2433
2433
|
|
|
2434
2434
|
// src/components/MainBody.tsx
|
|
2435
|
-
import { Box as Box4 } from "@ttoss/ui";
|
|
2436
|
-
var MainBody = /* @__PURE__ */__name(
|
|
2435
|
+
import { Box as Box4, Container } from "@ttoss/ui";
|
|
2436
|
+
var MainBody = /* @__PURE__ */__name(({
|
|
2437
|
+
containerSx,
|
|
2438
|
+
...props
|
|
2439
|
+
}) => {
|
|
2437
2440
|
return /* @__PURE__ */React.createElement(Box4, {
|
|
2438
2441
|
variant: "layout.main.body",
|
|
2439
2442
|
...props,
|
|
2440
2443
|
as: "main",
|
|
2441
2444
|
sx: {
|
|
2442
|
-
paddingX: "10",
|
|
2443
|
-
paddingY: "6",
|
|
2444
|
-
overflowY: "auto",
|
|
2445
2445
|
width: "full",
|
|
2446
|
-
|
|
2446
|
+
flex: 1,
|
|
2447
2447
|
...props.sx
|
|
2448
2448
|
}
|
|
2449
|
-
},
|
|
2449
|
+
}, /* @__PURE__ */React.createElement(Container, {
|
|
2450
|
+
paddingY: "6",
|
|
2451
|
+
variant: "layout.container",
|
|
2452
|
+
"data-testid": "main-body-container",
|
|
2453
|
+
sx: {
|
|
2454
|
+
...containerSx
|
|
2455
|
+
}
|
|
2456
|
+
}, props.children));
|
|
2450
2457
|
}, "MainBody");
|
|
2451
2458
|
MainBody.displayName = "MainBody";
|
|
2452
2459
|
|
|
2453
2460
|
// src/components/MainFooter.tsx
|
|
2454
|
-
import { Box as Box5 } from "@ttoss/ui";
|
|
2455
|
-
var MainFooter = /* @__PURE__ */__name(
|
|
2461
|
+
import { Box as Box5, Container as Container2 } from "@ttoss/ui";
|
|
2462
|
+
var MainFooter = /* @__PURE__ */__name(({
|
|
2463
|
+
containerSx,
|
|
2464
|
+
...props
|
|
2465
|
+
}) => {
|
|
2456
2466
|
return /* @__PURE__ */React.createElement(Box5, {
|
|
2457
2467
|
variant: "layout.main.footer",
|
|
2458
2468
|
...props,
|
|
2459
2469
|
sx: {
|
|
2460
|
-
paddingX: "10",
|
|
2461
|
-
paddingY: "3",
|
|
2462
2470
|
borderTop: "sm",
|
|
2463
2471
|
borderColor: "display.border.muted.default",
|
|
2464
2472
|
backgroundColor: "navigation.background.primary.default",
|
|
2465
2473
|
width: "full",
|
|
2466
2474
|
...props.sx
|
|
2467
2475
|
}
|
|
2468
|
-
},
|
|
2476
|
+
}, /* @__PURE__ */React.createElement(Container2, {
|
|
2477
|
+
paddingY: "3",
|
|
2478
|
+
variant: "layout.container",
|
|
2479
|
+
"data-testid": "main-footer-container",
|
|
2480
|
+
sx: containerSx
|
|
2481
|
+
}, props.children));
|
|
2469
2482
|
}, "MainFooter");
|
|
2470
2483
|
MainFooter.displayName = "MainFooter";
|
|
2471
2484
|
|
|
2472
2485
|
// src/components/MainHeader.tsx
|
|
2473
|
-
import { Box as Box6 } from "@ttoss/ui";
|
|
2474
|
-
var MainHeader = /* @__PURE__ */__name(
|
|
2486
|
+
import { Box as Box6, Container as Container3 } from "@ttoss/ui";
|
|
2487
|
+
var MainHeader = /* @__PURE__ */__name(({
|
|
2488
|
+
containerSx,
|
|
2489
|
+
...props
|
|
2490
|
+
}) => {
|
|
2475
2491
|
return /* @__PURE__ */React.createElement(Box6, {
|
|
2476
2492
|
variant: "layout.main.header",
|
|
2477
2493
|
...props,
|
|
2478
2494
|
as: "header",
|
|
2479
2495
|
sx: {
|
|
2480
|
-
paddingX: "4",
|
|
2481
|
-
paddingY: "3",
|
|
2482
2496
|
borderBottom: "sm",
|
|
2483
2497
|
borderColor: "display.border.muted.default",
|
|
2484
2498
|
backgroundColor: "navigation.background.primary.default",
|
|
2485
2499
|
width: "full",
|
|
2486
2500
|
...props.sx
|
|
2487
2501
|
}
|
|
2488
|
-
},
|
|
2502
|
+
}, /* @__PURE__ */React.createElement(Container3, {
|
|
2503
|
+
paddingY: "3",
|
|
2504
|
+
variant: "layout.container",
|
|
2505
|
+
"data-testid": "main-header-container",
|
|
2506
|
+
sx: containerSx
|
|
2507
|
+
}, props.children));
|
|
2489
2508
|
}, "MainHeader");
|
|
2490
2509
|
MainHeader.displayName = "MainHeader";
|
|
2491
2510
|
|
|
@@ -2495,15 +2514,12 @@ var Main = /* @__PURE__ */__name(props => {
|
|
|
2495
2514
|
variant: "layout.main",
|
|
2496
2515
|
sx: {
|
|
2497
2516
|
overflowX: "auto",
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
}, /* @__PURE__ */React.createElement(Container, {
|
|
2501
|
-
variant: "layout.container",
|
|
2502
|
-
sx: {
|
|
2517
|
+
overflowY: "auto",
|
|
2518
|
+
flex: 1,
|
|
2503
2519
|
display: "flex",
|
|
2504
2520
|
flexDirection: "column"
|
|
2505
2521
|
}
|
|
2506
|
-
}, props.children)
|
|
2522
|
+
}, props.children);
|
|
2507
2523
|
}, "Main");
|
|
2508
2524
|
Main.displayName = "Main";
|
|
2509
2525
|
Main.Header = MainHeader;
|
|
@@ -2522,7 +2538,7 @@ Layout.Header = Header;
|
|
|
2522
2538
|
Layout.Sidebar = Sidebar;
|
|
2523
2539
|
Layout.Main = Main;
|
|
2524
2540
|
Layout.Footer = Footer;
|
|
2525
|
-
Layout.Container =
|
|
2541
|
+
Layout.Container = Container4;
|
|
2526
2542
|
|
|
2527
2543
|
// src/components/SidebarCollapseLayout.tsx
|
|
2528
2544
|
import { Flex as Flex3, Stack } from "@ttoss/ui";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { BoxProps, StackProps } from '@ttoss/ui';
|
|
2
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
type MainFooterProps = BoxProps & {
|
|
6
|
+
containerSx?: BoxProps['sx'];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type MainBodyProps = BoxProps & {
|
|
10
|
+
containerSx?: BoxProps['sx'];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type MainHeaderProps = BoxProps & {
|
|
14
|
+
containerSx?: BoxProps['sx'];
|
|
15
|
+
};
|
|
4
16
|
|
|
5
17
|
declare const Layout: {
|
|
6
18
|
({ children }: React.PropsWithChildren<StackProps>): react_jsx_runtime.JSX.Element;
|
|
@@ -22,15 +34,15 @@ declare const Layout: {
|
|
|
22
34
|
(props: BoxProps): react_jsx_runtime.JSX.Element;
|
|
23
35
|
displayName: string;
|
|
24
36
|
Header: {
|
|
25
|
-
(props:
|
|
37
|
+
({ containerSx, ...props }: MainHeaderProps): react_jsx_runtime.JSX.Element;
|
|
26
38
|
displayName: string;
|
|
27
39
|
};
|
|
28
40
|
Body: {
|
|
29
|
-
(props:
|
|
41
|
+
({ containerSx, ...props }: MainBodyProps): react_jsx_runtime.JSX.Element;
|
|
30
42
|
displayName: string;
|
|
31
43
|
};
|
|
32
44
|
Footer: {
|
|
33
|
-
(props:
|
|
45
|
+
({ containerSx, ...props }: MainFooterProps): react_jsx_runtime.JSX.Element;
|
|
34
46
|
displayName: string;
|
|
35
47
|
};
|
|
36
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/layouts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Layout components for React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": ">=16.8.0",
|
|
28
|
-
"@ttoss/components": "^2.12.
|
|
29
|
-
"@ttoss/ui": "^6.4.
|
|
28
|
+
"@ttoss/components": "^2.12.3",
|
|
29
|
+
"@ttoss/ui": "^6.4.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/jest": "^30.0.0",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"jest": "^30.2.0",
|
|
35
35
|
"react": "^19.2.1",
|
|
36
36
|
"tsup": "^8.5.1",
|
|
37
|
-
"@ttoss/
|
|
37
|
+
"@ttoss/config": "^1.35.12",
|
|
38
|
+
"@ttoss/components": "^2.12.3",
|
|
38
39
|
"@ttoss/react-icons": "^0.5.6",
|
|
39
40
|
"@ttoss/test-utils": "^4.0.2",
|
|
40
|
-
"@ttoss/ui": "^6.4.
|
|
41
|
-
"@ttoss/config": "^1.35.12"
|
|
41
|
+
"@ttoss/ui": "^6.4.3"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"React"
|