@ttoss/layouts 0.2.16 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/layouts",
3
- "version": "0.2.16",
3
+ "version": "0.3.0",
4
4
  "description": "Layout components for React",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -11,10 +11,10 @@
11
11
  "url": "https://github.com/ttoss/ttoss.git",
12
12
  "directory": "packages/layouts"
13
13
  },
14
+ "type": "module",
14
15
  "exports": {
15
16
  ".": {
16
17
  "import": "./dist/esm/index.js",
17
- "require": "./dist/index.js",
18
18
  "types": "./dist/index.d.ts"
19
19
  }
20
20
  },
@@ -25,7 +25,7 @@
25
25
  "sideEffects": false,
26
26
  "peerDependencies": {
27
27
  "react": ">=16.8.0",
28
- "@ttoss/ui": "^4.1.16"
28
+ "@ttoss/ui": "^5.0.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/jest": "^29.5.12",
@@ -33,9 +33,9 @@
33
33
  "jest": "^29.7.0",
34
34
  "react": "^18.3.1",
35
35
  "tsup": "^8.2.4",
36
- "@ttoss/config": "^1.32.8",
37
- "@ttoss/test-utils": "^2.1.12",
38
- "@ttoss/ui": "^4.1.16"
36
+ "@ttoss/test-utils": "^2.1.13",
37
+ "@ttoss/ui": "^5.0.0",
38
+ "@ttoss/config": "^1.32.9"
39
39
  },
40
40
  "keywords": [
41
41
  "React"
@@ -46,6 +46,6 @@
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup",
49
- "test": "jest"
49
+ "test": "jest --projects tests/unit"
50
50
  }
51
51
  }
package/dist/index.d.mts DELETED
@@ -1,42 +0,0 @@
1
- import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { BoxProps } from '@ttoss/ui';
4
-
5
- type BaseLayoutProps = BoxProps;
6
-
7
- type LayoutProps = BaseLayoutProps;
8
- declare const Layout: {
9
- ({ children, ...props }: LayoutProps): react_jsx_runtime.JSX.Element;
10
- Header: {
11
- (props: BoxProps): react_jsx_runtime.JSX.Element;
12
- displayName: string;
13
- };
14
- Main: {
15
- (props: BoxProps): react_jsx_runtime.JSX.Element;
16
- displayName: string;
17
- };
18
- Footer: {
19
- (props: BoxProps): react_jsx_runtime.JSX.Element;
20
- displayName: string;
21
- };
22
- Container: react.ForwardRefExoticComponent<BoxProps & react.RefAttributes<HTMLDivElement>>;
23
- };
24
-
25
- declare const Header: {
26
- (props: BoxProps): react_jsx_runtime.JSX.Element;
27
- displayName: string;
28
- };
29
-
30
- declare const Footer: {
31
- (props: BoxProps): react_jsx_runtime.JSX.Element;
32
- displayName: string;
33
- };
34
-
35
- declare const Main: {
36
- (props: BoxProps): react_jsx_runtime.JSX.Element;
37
- displayName: string;
38
- };
39
-
40
- declare const StackedLayout: ({ children, ...props }: BaseLayoutProps) => react_jsx_runtime.JSX.Element;
41
-
42
- export { Footer, Header, Layout, Main, StackedLayout };
package/dist/index.js DELETED
@@ -1,171 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- "use strict";
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all) __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
- get: () => from[key],
20
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
- });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
- // If the importer is in node compatibility mode or this is not an ESM
27
- // file that has been converted to a CommonJS file using a Babel-
28
- // compatible transform (i.e. "__esModule" has not been set), then set
29
- // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
- value: mod,
32
- enumerable: true
33
- }) : target, mod));
34
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
35
- value: true
36
- }), mod);
37
-
38
- // src/index.ts
39
- var src_exports = {};
40
- __export(src_exports, {
41
- Footer: () => Footer,
42
- Header: () => Header,
43
- Layout: () => Layout,
44
- Main: () => Main,
45
- StackedLayout: () => StackedLayout
46
- });
47
- module.exports = __toCommonJS(src_exports);
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
-
59
- // src/components/Layout.tsx
60
- var import_ui5 = require("@ttoss/ui");
61
-
62
- // src/components/Footer.tsx
63
- var import_ui2 = require("@ttoss/ui");
64
- var import_jsx_runtime2 = require("react/jsx-runtime");
65
- var Footer = props => {
66
- return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui2.Box, {
67
- variant: "layout.footer",
68
- ...props,
69
- as: "footer",
70
- children: props.children
71
- });
72
- };
73
- Footer.displayName = "Footer";
74
-
75
- // src/components/Header.tsx
76
- var import_ui3 = require("@ttoss/ui");
77
- var import_jsx_runtime3 = require("react/jsx-runtime");
78
- var Header = props => {
79
- return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_ui3.Box, {
80
- variant: "layout.header",
81
- ...props,
82
- as: "header",
83
- children: props.children
84
- });
85
- };
86
- Header.displayName = "Header";
87
-
88
- // src/components/Main.tsx
89
- var import_ui4 = require("@ttoss/ui");
90
- var import_jsx_runtime4 = require("react/jsx-runtime");
91
- var Main = props => {
92
- return /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_ui4.Box, {
93
- variant: "layout.main",
94
- ...props,
95
- as: "main",
96
- children: props.children
97
- });
98
- };
99
- Main.displayName = "Main";
100
-
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, {
108
- variant: "layout.layout",
109
- ...props,
110
- children
111
- });
112
- };
113
- Layout.Header = Header;
114
- Layout.Main = Main;
115
- Layout.Footer = Footer;
116
- Layout.Container = import_ui5.Container;
117
-
118
- // src/getSemanticElements.ts
119
- var React = __toESM(require("react"));
120
- var semanticComponents = {
121
- Header: "header",
122
- Footer: "footer",
123
- Main: "main"
124
- };
125
- var getSematicElements = ({
126
- children
127
- }) => {
128
- const semanticElements = {};
129
- React.Children.forEach(children, child => {
130
- const displayName = child?.type?.displayName;
131
- if (!displayName) {
132
- return;
133
- }
134
- if (semanticComponents[displayName]) {
135
- semanticElements[semanticComponents[displayName]] = child;
136
- }
137
- });
138
- return semanticElements;
139
- };
140
-
141
- // src/components/StackedLayout.tsx
142
- var import_jsx_runtime6 = require("react/jsx-runtime");
143
- var StackedLayout = ({
144
- children,
145
- ...props
146
- }) => {
147
- const {
148
- header,
149
- main,
150
- footer
151
- } = getSematicElements({
152
- children
153
- });
154
- return /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(BaseLayout, {
155
- ...props,
156
- sx: {
157
- display: "flex",
158
- flexDirection: "column",
159
- ...props.sx
160
- },
161
- children: [header, main, footer]
162
- });
163
- };
164
- // Annotate the CommonJS export names for ESM import in node:
165
- 0 && (module.exports = {
166
- Footer,
167
- Header,
168
- Layout,
169
- Main,
170
- StackedLayout
171
- });