@ttoss/layouts 0.7.5 → 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 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
- ### Layout Variant Usage
166
-
167
- The `Main` component applies `variant="layout.container"` to its internal Container, ensuring consistent layout width and padding based on your theme. Define `layout.container` in your theme for global control:
168
-
169
- ```js
170
- // theme.js
171
- export const theme = {
172
- layout: {
173
- container: {
174
- maxWidth: ['100%', '1100px'],
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
- Other layout components (Header, Sidebar, Footer) also accept the `variant` prop for theme-driven customization.
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 Container2 } from "@ttoss/ui";
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";
@@ -2413,6 +2413,7 @@ var Header = /* @__PURE__ */__name(({
2413
2413
  borderBottom: "sm",
2414
2414
  borderColor: "display.border.muted.default",
2415
2415
  backgroundColor: "navigation.background.primary.default",
2416
+ zIndex: "overlay",
2416
2417
  ...(sidebarSlot ? {} : paddingSx),
2417
2418
  ...boxProps.sx
2418
2419
  }
@@ -2428,63 +2429,82 @@ var Header = /* @__PURE__ */__name(({
2428
2429
  Header.displayName = "Header";
2429
2430
 
2430
2431
  // src/components/Main.tsx
2431
- import { Box as Box7, Container } from "@ttoss/ui";
2432
+ import { Box as Box7 } from "@ttoss/ui";
2432
2433
 
2433
2434
  // src/components/MainBody.tsx
2434
- import { Box as Box4 } from "@ttoss/ui";
2435
- var MainBody = /* @__PURE__ */__name(props => {
2435
+ import { Box as Box4, Container } from "@ttoss/ui";
2436
+ var MainBody = /* @__PURE__ */__name(({
2437
+ containerSx,
2438
+ ...props
2439
+ }) => {
2436
2440
  return /* @__PURE__ */React.createElement(Box4, {
2437
2441
  variant: "layout.main.body",
2438
2442
  ...props,
2439
2443
  as: "main",
2440
2444
  sx: {
2441
- paddingX: "10",
2442
- paddingY: "6",
2443
- overflowY: "auto",
2444
2445
  width: "full",
2445
- height: "full",
2446
+ flex: 1,
2446
2447
  ...props.sx
2447
2448
  }
2448
- }, props.children);
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));
2449
2457
  }, "MainBody");
2450
2458
  MainBody.displayName = "MainBody";
2451
2459
 
2452
2460
  // src/components/MainFooter.tsx
2453
- import { Box as Box5 } from "@ttoss/ui";
2454
- var MainFooter = /* @__PURE__ */__name(props => {
2461
+ import { Box as Box5, Container as Container2 } from "@ttoss/ui";
2462
+ var MainFooter = /* @__PURE__ */__name(({
2463
+ containerSx,
2464
+ ...props
2465
+ }) => {
2455
2466
  return /* @__PURE__ */React.createElement(Box5, {
2456
2467
  variant: "layout.main.footer",
2457
2468
  ...props,
2458
2469
  sx: {
2459
- paddingX: "10",
2460
- paddingY: "3",
2461
2470
  borderTop: "sm",
2462
2471
  borderColor: "display.border.muted.default",
2463
2472
  backgroundColor: "navigation.background.primary.default",
2464
2473
  width: "full",
2465
2474
  ...props.sx
2466
2475
  }
2467
- }, props.children);
2476
+ }, /* @__PURE__ */React.createElement(Container2, {
2477
+ paddingY: "3",
2478
+ variant: "layout.container",
2479
+ "data-testid": "main-footer-container",
2480
+ sx: containerSx
2481
+ }, props.children));
2468
2482
  }, "MainFooter");
2469
2483
  MainFooter.displayName = "MainFooter";
2470
2484
 
2471
2485
  // src/components/MainHeader.tsx
2472
- import { Box as Box6 } from "@ttoss/ui";
2473
- var MainHeader = /* @__PURE__ */__name(props => {
2486
+ import { Box as Box6, Container as Container3 } from "@ttoss/ui";
2487
+ var MainHeader = /* @__PURE__ */__name(({
2488
+ containerSx,
2489
+ ...props
2490
+ }) => {
2474
2491
  return /* @__PURE__ */React.createElement(Box6, {
2475
2492
  variant: "layout.main.header",
2476
2493
  ...props,
2477
2494
  as: "header",
2478
2495
  sx: {
2479
- paddingX: "4",
2480
- paddingY: "3",
2481
2496
  borderBottom: "sm",
2482
2497
  borderColor: "display.border.muted.default",
2483
2498
  backgroundColor: "navigation.background.primary.default",
2484
2499
  width: "full",
2485
2500
  ...props.sx
2486
2501
  }
2487
- }, props.children);
2502
+ }, /* @__PURE__ */React.createElement(Container3, {
2503
+ paddingY: "3",
2504
+ variant: "layout.container",
2505
+ "data-testid": "main-header-container",
2506
+ sx: containerSx
2507
+ }, props.children));
2488
2508
  }, "MainHeader");
2489
2509
  MainHeader.displayName = "MainHeader";
2490
2510
 
@@ -2494,15 +2514,12 @@ var Main = /* @__PURE__ */__name(props => {
2494
2514
  variant: "layout.main",
2495
2515
  sx: {
2496
2516
  overflowX: "auto",
2497
- flex: 1
2498
- }
2499
- }, /* @__PURE__ */React.createElement(Container, {
2500
- variant: "layout.container",
2501
- sx: {
2517
+ overflowY: "auto",
2518
+ flex: 1,
2502
2519
  display: "flex",
2503
2520
  flexDirection: "column"
2504
2521
  }
2505
- }, props.children));
2522
+ }, props.children);
2506
2523
  }, "Main");
2507
2524
  Main.displayName = "Main";
2508
2525
  Main.Header = MainHeader;
@@ -2521,7 +2538,7 @@ Layout.Header = Header;
2521
2538
  Layout.Sidebar = Sidebar;
2522
2539
  Layout.Main = Main;
2523
2540
  Layout.Footer = Footer;
2524
- Layout.Container = Container2;
2541
+ Layout.Container = Container4;
2525
2542
 
2526
2543
  // src/components/SidebarCollapseLayout.tsx
2527
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
- import { StackProps, BoxProps } from '@ttoss/ui';
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: BoxProps): react_jsx_runtime.JSX.Element;
37
+ ({ containerSx, ...props }: MainHeaderProps): react_jsx_runtime.JSX.Element;
26
38
  displayName: string;
27
39
  };
28
40
  Body: {
29
- (props: BoxProps): react_jsx_runtime.JSX.Element;
41
+ ({ containerSx, ...props }: MainBodyProps): react_jsx_runtime.JSX.Element;
30
42
  displayName: string;
31
43
  };
32
44
  Footer: {
33
- (props: BoxProps): react_jsx_runtime.JSX.Element;
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.7.5",
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/ui": "^6.4.0",
29
- "@ttoss/components": "^2.11.7"
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/components": "^2.11.7",
38
37
  "@ttoss/config": "^1.35.12",
39
- "@ttoss/ui": "^6.4.0",
38
+ "@ttoss/components": "^2.12.3",
40
39
  "@ttoss/react-icons": "^0.5.6",
41
- "@ttoss/test-utils": "^4.0.2"
40
+ "@ttoss/test-utils": "^4.0.2",
41
+ "@ttoss/ui": "^6.4.3"
42
42
  },
43
43
  "keywords": [
44
44
  "React"