@ttoss/layouts 0.1.0 → 0.1.2

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
@@ -16,7 +16,7 @@ You can use the `Layout` component to add a layout to your application:
16
16
  import { Layout } from '@ttoss/layouts';
17
17
 
18
18
  const App = () => (
19
- <Layout layout="StackedLayout">
19
+ <Layout>
20
20
  <Layout.Header>Header</Layout.Header>
21
21
  <Layout.Main>Main</Layout.Main>
22
22
  <Layout.Footer>Footer</Layout.Footer>
@@ -24,7 +24,7 @@ const App = () => (
24
24
  );
25
25
  ```
26
26
 
27
- Or you can use specifics components as `StackedLayout` to add a layout to your application:
27
+ Or you can use specifics components as `StackedLayout` to add specific layout to your application:
28
28
 
29
29
  ```tsx
30
30
  import { Layout, StackedLayout } from '@ttoss/layouts';
package/dist/esm/index.js CHANGED
@@ -1,13 +1,23 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
2
 
3
+ // src/components/BaseLayout.tsx
4
+ import { Box } from "@ttoss/ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var BaseLayout = props => {
7
+ return /* @__PURE__ */jsx(Box, {
8
+ ...props,
9
+ children: props.children
10
+ });
11
+ };
12
+
3
13
  // src/components/Layout.tsx
4
14
  import { Container } from "@ttoss/ui";
5
15
 
6
16
  // src/components/Footer.tsx
7
- import { Box } from "@ttoss/ui";
8
- import { jsx } from "react/jsx-runtime";
17
+ import { Box as Box2 } from "@ttoss/ui";
18
+ import { jsx as jsx2 } from "react/jsx-runtime";
9
19
  var Footer = props => {
10
- return /* @__PURE__ */jsx(Box, {
20
+ return /* @__PURE__ */jsx2(Box2, {
11
21
  variant: "layout.footer",
12
22
  ...props,
13
23
  as: "footer",
@@ -17,10 +27,10 @@ var Footer = props => {
17
27
  Footer.displayName = "Footer";
18
28
 
19
29
  // src/components/Header.tsx
20
- import { Box as Box2 } from "@ttoss/ui";
21
- import { jsx as jsx2 } from "react/jsx-runtime";
30
+ import { Box as Box3 } from "@ttoss/ui";
31
+ import { jsx as jsx3 } from "react/jsx-runtime";
22
32
  var Header = props => {
23
- return /* @__PURE__ */jsx2(Box2, {
33
+ return /* @__PURE__ */jsx3(Box3, {
24
34
  variant: "layout.header",
25
35
  ...props,
26
36
  as: "header",
@@ -30,10 +40,10 @@ var Header = props => {
30
40
  Header.displayName = "Header";
31
41
 
32
42
  // src/components/Main.tsx
33
- import { Box as Box3 } from "@ttoss/ui";
34
- import { jsx as jsx3 } from "react/jsx-runtime";
43
+ import { Box as Box4 } from "@ttoss/ui";
44
+ import { jsx as jsx4 } from "react/jsx-runtime";
35
45
  var Main = props => {
36
- return /* @__PURE__ */jsx3(Box3, {
46
+ return /* @__PURE__ */jsx4(Box4, {
37
47
  variant: "layout.main",
38
48
  ...props,
39
49
  as: "main",
@@ -42,16 +52,22 @@ var Main = props => {
42
52
  };
43
53
  Main.displayName = "Main";
44
54
 
45
- // src/components/BaseLayout.tsx
46
- import { Box as Box4 } from "@ttoss/ui";
47
- import { jsx as jsx4 } from "react/jsx-runtime";
48
- var BaseLayout = props => {
49
- return /* @__PURE__ */jsx4(Box4, {
55
+ // src/components/Layout.tsx
56
+ import { jsx as jsx5 } from "react/jsx-runtime";
57
+ var Layout = ({
58
+ children,
59
+ ...props
60
+ }) => {
61
+ return /* @__PURE__ */jsx5(BaseLayout, {
50
62
  variant: "layout.layout",
51
63
  ...props,
52
- children: props.children
64
+ children
53
65
  });
54
66
  };
67
+ Layout.Header = Header;
68
+ Layout.Main = Main;
69
+ Layout.Footer = Footer;
70
+ Layout.Container = Container;
55
71
 
56
72
  // src/getSemanticElements.ts
57
73
  import * as React from "react";
@@ -79,7 +95,8 @@ var getSematicElements = ({
79
95
  // src/components/StackedLayout.tsx
80
96
  import { jsxs } from "react/jsx-runtime";
81
97
  var StackedLayout = ({
82
- children
98
+ children,
99
+ ...props
83
100
  }) => {
84
101
  const {
85
102
  header,
@@ -89,25 +106,13 @@ var StackedLayout = ({
89
106
  children
90
107
  });
91
108
  return /* @__PURE__ */jsxs(BaseLayout, {
109
+ ...props,
92
110
  sx: {
93
111
  display: "flex",
94
- flexDirection: "column"
112
+ flexDirection: "column",
113
+ ...props.sx
95
114
  },
96
115
  children: [header, main, footer]
97
116
  });
98
117
  };
99
-
100
- // src/components/Layout.tsx
101
- import { jsx as jsx5 } from "react/jsx-runtime";
102
- var Layout = ({
103
- children
104
- }) => {
105
- return /* @__PURE__ */jsx5(StackedLayout, {
106
- children
107
- });
108
- };
109
- Layout.Header = Header;
110
- Layout.Main = Main;
111
- Layout.Footer = Footer;
112
- Layout.Container = Container;
113
118
  export { Footer, Header, Layout, Main, StackedLayout };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,12 @@
1
+ import * as react from 'react';
1
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as React$1 from 'react';
3
3
  import { BoxProps } from '@ttoss/ui';
4
4
 
5
- type Layouts = 'StackedLayout';
6
- type LayoutProps = React$1.PropsWithChildren<{
7
- layout?: Layouts;
8
- }>;
5
+ type BaseLayoutProps = BoxProps;
6
+
7
+ type LayoutProps = BaseLayoutProps;
9
8
  declare const Layout: {
10
- ({ children }: LayoutProps): react_jsx_runtime.JSX.Element;
9
+ ({ children, ...props }: LayoutProps): react_jsx_runtime.JSX.Element;
11
10
  Header: {
12
11
  (props: BoxProps): react_jsx_runtime.JSX.Element;
13
12
  displayName: string;
@@ -20,7 +19,7 @@ declare const Layout: {
20
19
  (props: BoxProps): react_jsx_runtime.JSX.Element;
21
20
  displayName: string;
22
21
  };
23
- Container: React$1.ForwardRefExoticComponent<BoxProps & React$1.RefAttributes<HTMLDivElement>>;
22
+ Container: react.ForwardRefExoticComponent<BoxProps & react.RefAttributes<HTMLDivElement>>;
24
23
  };
25
24
 
26
25
  declare const Header: {
@@ -38,8 +37,6 @@ declare const Main: {
38
37
  displayName: string;
39
38
  };
40
39
 
41
- declare const StackedLayout: ({ children }: {
42
- children: React.ReactNode;
43
- }) => react_jsx_runtime.JSX.Element;
40
+ declare const StackedLayout: ({ children, ...props }: BaseLayoutProps) => react_jsx_runtime.JSX.Element;
44
41
 
45
42
  export { Footer, Header, Layout, Main, StackedLayout };
package/dist/index.js CHANGED
@@ -46,14 +46,24 @@ __export(src_exports, {
46
46
  });
47
47
  module.exports = __toCommonJS(src_exports);
48
48
 
49
+ // src/components/BaseLayout.tsx
50
+ var import_ui = require("@ttoss/ui");
51
+ var import_jsx_runtime = require("react/jsx-runtime");
52
+ var BaseLayout = props => {
53
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ui.Box, {
54
+ ...props,
55
+ children: props.children
56
+ });
57
+ };
58
+
49
59
  // src/components/Layout.tsx
50
60
  var import_ui5 = require("@ttoss/ui");
51
61
 
52
62
  // src/components/Footer.tsx
53
- var import_ui = require("@ttoss/ui");
54
- var import_jsx_runtime = require("react/jsx-runtime");
63
+ var import_ui2 = require("@ttoss/ui");
64
+ var import_jsx_runtime2 = require("react/jsx-runtime");
55
65
  var Footer = props => {
56
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ui.Box, {
66
+ return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui2.Box, {
57
67
  variant: "layout.footer",
58
68
  ...props,
59
69
  as: "footer",
@@ -63,10 +73,10 @@ var Footer = props => {
63
73
  Footer.displayName = "Footer";
64
74
 
65
75
  // src/components/Header.tsx
66
- var import_ui2 = require("@ttoss/ui");
67
- var import_jsx_runtime2 = require("react/jsx-runtime");
76
+ var import_ui3 = require("@ttoss/ui");
77
+ var import_jsx_runtime3 = require("react/jsx-runtime");
68
78
  var Header = props => {
69
- return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui2.Box, {
79
+ return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_ui3.Box, {
70
80
  variant: "layout.header",
71
81
  ...props,
72
82
  as: "header",
@@ -76,10 +86,10 @@ var Header = props => {
76
86
  Header.displayName = "Header";
77
87
 
78
88
  // src/components/Main.tsx
79
- var import_ui3 = require("@ttoss/ui");
80
- var import_jsx_runtime3 = require("react/jsx-runtime");
89
+ var import_ui4 = require("@ttoss/ui");
90
+ var import_jsx_runtime4 = require("react/jsx-runtime");
81
91
  var Main = props => {
82
- return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_ui3.Box, {
92
+ return /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_ui4.Box, {
83
93
  variant: "layout.main",
84
94
  ...props,
85
95
  as: "main",
@@ -88,16 +98,22 @@ var Main = props => {
88
98
  };
89
99
  Main.displayName = "Main";
90
100
 
91
- // src/components/BaseLayout.tsx
92
- var import_ui4 = require("@ttoss/ui");
93
- var import_jsx_runtime4 = require("react/jsx-runtime");
94
- var BaseLayout = props => {
95
- return /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_ui4.Box, {
101
+ // src/components/Layout.tsx
102
+ var import_jsx_runtime5 = require("react/jsx-runtime");
103
+ var Layout = ({
104
+ children,
105
+ ...props
106
+ }) => {
107
+ return /* @__PURE__ */(0, import_jsx_runtime5.jsx)(BaseLayout, {
96
108
  variant: "layout.layout",
97
109
  ...props,
98
- children: props.children
110
+ children
99
111
  });
100
112
  };
113
+ Layout.Header = Header;
114
+ Layout.Main = Main;
115
+ Layout.Footer = Footer;
116
+ Layout.Container = import_ui5.Container;
101
117
 
102
118
  // src/getSemanticElements.ts
103
119
  var React = __toESM(require("react"));
@@ -123,9 +139,10 @@ var getSematicElements = ({
123
139
  };
124
140
 
125
141
  // src/components/StackedLayout.tsx
126
- var import_jsx_runtime5 = require("react/jsx-runtime");
142
+ var import_jsx_runtime6 = require("react/jsx-runtime");
127
143
  var StackedLayout = ({
128
- children
144
+ children,
145
+ ...props
129
146
  }) => {
130
147
  const {
131
148
  header,
@@ -134,28 +151,16 @@ var StackedLayout = ({
134
151
  } = getSematicElements({
135
152
  children
136
153
  });
137
- return /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(BaseLayout, {
154
+ return /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(BaseLayout, {
155
+ ...props,
138
156
  sx: {
139
157
  display: "flex",
140
- flexDirection: "column"
158
+ flexDirection: "column",
159
+ ...props.sx
141
160
  },
142
161
  children: [header, main, footer]
143
162
  });
144
163
  };
145
-
146
- // src/components/Layout.tsx
147
- var import_jsx_runtime6 = require("react/jsx-runtime");
148
- var Layout = ({
149
- children
150
- }) => {
151
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(StackedLayout, {
152
- children
153
- });
154
- };
155
- Layout.Header = Header;
156
- Layout.Main = Main;
157
- Layout.Footer = Footer;
158
- Layout.Container = import_ui5.Container;
159
164
  // Annotate the CommonJS export names for ESM import in node:
160
165
  0 && (module.exports = {
161
166
  Footer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/layouts",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Layout components for React",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -16,7 +16,7 @@
16
16
  "typings": "dist/index.d.ts",
17
17
  "peerDependencies": {
18
18
  "react": ">=16.8.0",
19
- "@ttoss/ui": "^1.37.0"
19
+ "@ttoss/ui": "^1.37.1"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/jest": "^29.5.2",
@@ -26,7 +26,7 @@
26
26
  "tsup": "^6.7.0",
27
27
  "@ttoss/config": "^1.30.1",
28
28
  "@ttoss/test-utils": "^1.23.2",
29
- "@ttoss/ui": "^1.37.0"
29
+ "@ttoss/ui": "^1.37.1"
30
30
  },
31
31
  "keywords": [
32
32
  "React"
@@ -1,9 +1,7 @@
1
1
  import { Box, BoxProps } from '@ttoss/ui';
2
2
 
3
- export const BaseLayout = (props: BoxProps) => {
4
- return (
5
- <Box variant="layout.layout" {...props}>
6
- {props.children}
7
- </Box>
8
- );
3
+ export type BaseLayoutProps = BoxProps;
4
+
5
+ export const BaseLayout = (props: BaseLayoutProps) => {
6
+ return <Box {...props}>{props.children}</Box>;
9
7
  };
@@ -1,20 +1,19 @@
1
- import * as React from 'react';
1
+ import { BaseLayout, type BaseLayoutProps } from './BaseLayout';
2
2
  import { type BoxProps, Container, type ContainerProps } from '@ttoss/ui';
3
3
  import { Footer } from './Footer';
4
4
  import { Header } from './Header';
5
5
  import { Main } from './Main';
6
- import { StackedLayout } from './StackedLayout';
7
6
 
8
7
  export type { ContainerProps, BoxProps };
9
8
 
10
- type Layouts = 'StackedLayout';
9
+ type LayoutProps = BaseLayoutProps;
11
10
 
12
- type LayoutProps = React.PropsWithChildren<{
13
- layout?: Layouts;
14
- }>;
15
-
16
- export const Layout = ({ children }: LayoutProps) => {
17
- return <StackedLayout>{children}</StackedLayout>;
11
+ export const Layout = ({ children, ...props }: LayoutProps) => {
12
+ return (
13
+ <BaseLayout variant="layout.layout" {...props}>
14
+ {children}
15
+ </BaseLayout>
16
+ );
18
17
  };
19
18
 
20
19
  Layout.Header = Header;
@@ -1,14 +1,16 @@
1
- import { BaseLayout } from './BaseLayout';
1
+ import { BaseLayout, type BaseLayoutProps } from './BaseLayout';
2
2
  import { getSematicElements } from '../getSemanticElements';
3
3
 
4
- export const StackedLayout = ({ children }: { children: React.ReactNode }) => {
4
+ export const StackedLayout = ({ children, ...props }: BaseLayoutProps) => {
5
5
  const { header, main, footer } = getSematicElements({ children });
6
6
 
7
7
  return (
8
8
  <BaseLayout
9
+ {...props}
9
10
  sx={{
10
11
  display: 'flex',
11
12
  flexDirection: 'column',
13
+ ...props.sx,
12
14
  }}
13
15
  >
14
16
  {header}