@kopexa/page-layout 0.0.0-canary-20250720192841
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 +24 -0
- package/dist/chunk-F7HJK32J.mjs +89 -0
- package/dist/chunk-QHYETCIA.mjs +23 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +114 -0
- package/dist/index.mjs +8 -0
- package/dist/namespace.d.mts +10 -0
- package/dist/namespace.d.ts +10 -0
- package/dist/namespace.js +112 -0
- package/dist/namespace.mjs +16 -0
- package/dist/page-layout.d.mts +36 -0
- package/dist/page-layout.d.ts +36 -0
- package/dist/page-layout.js +110 -0
- package/dist/page-layout.mjs +15 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @kopexa/page-layout
|
|
2
|
+
|
|
3
|
+
A Quick description of the component
|
|
4
|
+
|
|
5
|
+
> This is an internal utility, not intended for public usage.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
yarn add @kopexa/page-layout
|
|
11
|
+
# or
|
|
12
|
+
npm i @kopexa/page-layout
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Contribution
|
|
16
|
+
|
|
17
|
+
Yes please! See the
|
|
18
|
+
[contributing guidelines](https://github.com/kopexa-grc/sight/blob/master/CONTRIBUTING.md)
|
|
19
|
+
for details.
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
This project is licensed under the terms of the
|
|
24
|
+
[MIT license](https://github.com/kopexa-grc/sight/blob/master/LICENSE).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/page-layout.tsx
|
|
9
|
+
import { createContext } from "@kopexa/react-utils";
|
|
10
|
+
import { dataAttr } from "@kopexa/shared-utils";
|
|
11
|
+
import { pageLayout } from "@kopexa/theme";
|
|
12
|
+
import { Children, isValidElement, useMemo } from "react";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
var [Provider, usePageLayoutContext] = createContext(
|
|
15
|
+
{}
|
|
16
|
+
);
|
|
17
|
+
var PageLayoutRoot = (props) => {
|
|
18
|
+
const { children, width, spacing, paneWidth, gap, ...rest } = props;
|
|
19
|
+
const styles = useMemo(
|
|
20
|
+
() => pageLayout({ width, spacing, paneWidth, gap }),
|
|
21
|
+
[width, spacing, paneWidth, gap]
|
|
22
|
+
);
|
|
23
|
+
const header = [];
|
|
24
|
+
const footer = [];
|
|
25
|
+
const content = [];
|
|
26
|
+
Children.forEach(children, (child) => {
|
|
27
|
+
if (isValidElement(child)) {
|
|
28
|
+
const type = getDisplayName(child);
|
|
29
|
+
if (type === "PageLayoutHeader") {
|
|
30
|
+
header.push(child);
|
|
31
|
+
} else if (type === "PageLayoutFooter") {
|
|
32
|
+
footer.push(child);
|
|
33
|
+
} else {
|
|
34
|
+
content.push(child);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
content.push(child);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ jsx(Provider, { value: { styles }, children: /* @__PURE__ */ jsx("div", { ...rest, children: /* @__PURE__ */ jsxs("div", { className: styles.wrapper(), children: [
|
|
41
|
+
header,
|
|
42
|
+
/* @__PURE__ */ jsx("div", { className: styles.baseContent(), children: content }),
|
|
43
|
+
footer
|
|
44
|
+
] }) }) });
|
|
45
|
+
};
|
|
46
|
+
var PageLayoutHeader = (props) => {
|
|
47
|
+
const { className, ...rest } = props;
|
|
48
|
+
const { styles } = usePageLayoutContext();
|
|
49
|
+
return /* @__PURE__ */ jsx("header", { className: styles.header({ className }), ...rest });
|
|
50
|
+
};
|
|
51
|
+
PageLayoutHeader.displayName = "PageLayoutHeader";
|
|
52
|
+
var PageLayoutFooter = (props) => {
|
|
53
|
+
const { className, children, ...rest } = props;
|
|
54
|
+
const { styles } = usePageLayoutContext();
|
|
55
|
+
return /* @__PURE__ */ jsx("footer", { className: styles.footerWrapper({ className }), ...rest, children: /* @__PURE__ */ jsx("div", { className: styles.footerContent(), children }) });
|
|
56
|
+
};
|
|
57
|
+
PageLayoutFooter.displayName = "PageLayoutFooter";
|
|
58
|
+
function PageLayoutPane(props) {
|
|
59
|
+
const { className, children, position = "end", sticky, ...rest } = props;
|
|
60
|
+
const { styles } = usePageLayoutContext();
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: styles.paneWrapper({ className }),
|
|
65
|
+
"data-position": position,
|
|
66
|
+
"data-sticky": dataAttr(sticky),
|
|
67
|
+
...rest,
|
|
68
|
+
children: /* @__PURE__ */ jsx("div", { className: styles.pane(), children })
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function PageLayoutContent(props) {
|
|
73
|
+
const { className, children, ...rest } = props;
|
|
74
|
+
const { styles } = usePageLayoutContext();
|
|
75
|
+
return /* @__PURE__ */ jsx("div", { className: styles.contentWrapper({ className }), ...rest, children: /* @__PURE__ */ jsx("div", { className: styles.content(), children }) });
|
|
76
|
+
}
|
|
77
|
+
function getDisplayName(el) {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
return (_c = (_a = el.type) == null ? void 0 : _a.displayName) != null ? _c : (_b = el.type) == null ? void 0 : _b.name;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
__export,
|
|
84
|
+
PageLayoutRoot,
|
|
85
|
+
PageLayoutHeader,
|
|
86
|
+
PageLayoutFooter,
|
|
87
|
+
PageLayoutPane,
|
|
88
|
+
PageLayoutContent
|
|
89
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
PageLayoutContent,
|
|
4
|
+
PageLayoutFooter,
|
|
5
|
+
PageLayoutHeader,
|
|
6
|
+
PageLayoutPane,
|
|
7
|
+
PageLayoutRoot,
|
|
8
|
+
__export
|
|
9
|
+
} from "./chunk-F7HJK32J.mjs";
|
|
10
|
+
|
|
11
|
+
// src/namespace.ts
|
|
12
|
+
var namespace_exports = {};
|
|
13
|
+
__export(namespace_exports, {
|
|
14
|
+
Content: () => PageLayoutContent,
|
|
15
|
+
Footer: () => PageLayoutFooter,
|
|
16
|
+
Header: () => PageLayoutHeader,
|
|
17
|
+
Pane: () => PageLayoutPane,
|
|
18
|
+
Root: () => PageLayoutRoot
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
namespace_exports
|
|
23
|
+
};
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
PageLayout: () => namespace_exports
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// src/namespace.ts
|
|
29
|
+
var namespace_exports = {};
|
|
30
|
+
__export(namespace_exports, {
|
|
31
|
+
Content: () => PageLayoutContent,
|
|
32
|
+
Footer: () => PageLayoutFooter,
|
|
33
|
+
Header: () => PageLayoutHeader,
|
|
34
|
+
Pane: () => PageLayoutPane,
|
|
35
|
+
Root: () => PageLayoutRoot
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// src/page-layout.tsx
|
|
39
|
+
var import_react_utils = require("@kopexa/react-utils");
|
|
40
|
+
var import_shared_utils = require("@kopexa/shared-utils");
|
|
41
|
+
var import_theme = require("@kopexa/theme");
|
|
42
|
+
var import_react = require("react");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
var [Provider, usePageLayoutContext] = (0, import_react_utils.createContext)(
|
|
45
|
+
{}
|
|
46
|
+
);
|
|
47
|
+
var PageLayoutRoot = (props) => {
|
|
48
|
+
const { children, width, spacing, paneWidth, gap, ...rest } = props;
|
|
49
|
+
const styles = (0, import_react.useMemo)(
|
|
50
|
+
() => (0, import_theme.pageLayout)({ width, spacing, paneWidth, gap }),
|
|
51
|
+
[width, spacing, paneWidth, gap]
|
|
52
|
+
);
|
|
53
|
+
const header = [];
|
|
54
|
+
const footer = [];
|
|
55
|
+
const content = [];
|
|
56
|
+
import_react.Children.forEach(children, (child) => {
|
|
57
|
+
if ((0, import_react.isValidElement)(child)) {
|
|
58
|
+
const type = getDisplayName(child);
|
|
59
|
+
if (type === "PageLayoutHeader") {
|
|
60
|
+
header.push(child);
|
|
61
|
+
} else if (type === "PageLayoutFooter") {
|
|
62
|
+
footer.push(child);
|
|
63
|
+
} else {
|
|
64
|
+
content.push(child);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
content.push(child);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.wrapper(), children: [
|
|
71
|
+
header,
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.baseContent(), children: content }),
|
|
73
|
+
footer
|
|
74
|
+
] }) }) });
|
|
75
|
+
};
|
|
76
|
+
var PageLayoutHeader = (props) => {
|
|
77
|
+
const { className, ...rest } = props;
|
|
78
|
+
const { styles } = usePageLayoutContext();
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { className: styles.header({ className }), ...rest });
|
|
80
|
+
};
|
|
81
|
+
PageLayoutHeader.displayName = "PageLayoutHeader";
|
|
82
|
+
var PageLayoutFooter = (props) => {
|
|
83
|
+
const { className, children, ...rest } = props;
|
|
84
|
+
const { styles } = usePageLayoutContext();
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("footer", { className: styles.footerWrapper({ className }), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.footerContent(), children }) });
|
|
86
|
+
};
|
|
87
|
+
PageLayoutFooter.displayName = "PageLayoutFooter";
|
|
88
|
+
function PageLayoutPane(props) {
|
|
89
|
+
const { className, children, position = "end", sticky, ...rest } = props;
|
|
90
|
+
const { styles } = usePageLayoutContext();
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
className: styles.paneWrapper({ className }),
|
|
95
|
+
"data-position": position,
|
|
96
|
+
"data-sticky": (0, import_shared_utils.dataAttr)(sticky),
|
|
97
|
+
...rest,
|
|
98
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.pane(), children })
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
function PageLayoutContent(props) {
|
|
103
|
+
const { className, children, ...rest } = props;
|
|
104
|
+
const { styles } = usePageLayoutContext();
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.contentWrapper({ className }), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.content(), children }) });
|
|
106
|
+
}
|
|
107
|
+
function getDisplayName(el) {
|
|
108
|
+
var _a, _b, _c;
|
|
109
|
+
return (_c = (_a = el.type) == null ? void 0 : _a.displayName) != null ? _c : (_b = el.type) == null ? void 0 : _b.name;
|
|
110
|
+
}
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
PageLayout
|
|
114
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PageLayoutContent, PageLayoutContentProps, PageLayoutFooter, PageLayoutFooterProps, PageLayoutHeader, PageLayoutHeaderProps, PageLayoutPane, PageLayoutPaneProps, PageLayoutRoot, PageLayoutRootProps } from './page-layout.mjs';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '@kopexa/theme';
|
|
4
|
+
import 'react';
|
|
5
|
+
|
|
6
|
+
declare namespace namespace {
|
|
7
|
+
export { PageLayoutContent as Content, PageLayoutContentProps as ContentProps, PageLayoutFooter as Footer, PageLayoutFooterProps as FooterProps, PageLayoutHeader as Header, PageLayoutHeaderProps as HeaderProps, PageLayoutPane as Pane, PageLayoutPaneProps as PaneProps, PageLayoutRoot as Root, PageLayoutRootProps as RootProps };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { PageLayoutContent as Content, PageLayoutContentProps as ContentProps, PageLayoutFooter as Footer, PageLayoutFooterProps as FooterProps, PageLayoutHeader as Header, PageLayoutHeaderProps as HeaderProps, PageLayoutPane as Pane, PageLayoutPaneProps as PaneProps, PageLayoutRoot as Root, PageLayoutRootProps as RootProps, namespace as n };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PageLayoutContent, PageLayoutContentProps, PageLayoutFooter, PageLayoutFooterProps, PageLayoutHeader, PageLayoutHeaderProps, PageLayoutPane, PageLayoutPaneProps, PageLayoutRoot, PageLayoutRootProps } from './page-layout.js';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '@kopexa/theme';
|
|
4
|
+
import 'react';
|
|
5
|
+
|
|
6
|
+
declare namespace namespace {
|
|
7
|
+
export { PageLayoutContent as Content, PageLayoutContentProps as ContentProps, PageLayoutFooter as Footer, PageLayoutFooterProps as FooterProps, PageLayoutHeader as Header, PageLayoutHeaderProps as HeaderProps, PageLayoutPane as Pane, PageLayoutPaneProps as PaneProps, PageLayoutRoot as Root, PageLayoutRootProps as RootProps };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { PageLayoutContent as Content, PageLayoutContentProps as ContentProps, PageLayoutFooter as Footer, PageLayoutFooterProps as FooterProps, PageLayoutHeader as Header, PageLayoutHeaderProps as HeaderProps, PageLayoutPane as Pane, PageLayoutPaneProps as PaneProps, PageLayoutRoot as Root, PageLayoutRootProps as RootProps, namespace as n };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/namespace.ts
|
|
22
|
+
var namespace_exports = {};
|
|
23
|
+
__export(namespace_exports, {
|
|
24
|
+
Content: () => PageLayoutContent,
|
|
25
|
+
Footer: () => PageLayoutFooter,
|
|
26
|
+
Header: () => PageLayoutHeader,
|
|
27
|
+
Pane: () => PageLayoutPane,
|
|
28
|
+
Root: () => PageLayoutRoot
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(namespace_exports);
|
|
31
|
+
|
|
32
|
+
// src/page-layout.tsx
|
|
33
|
+
var import_react_utils = require("@kopexa/react-utils");
|
|
34
|
+
var import_shared_utils = require("@kopexa/shared-utils");
|
|
35
|
+
var import_theme = require("@kopexa/theme");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var [Provider, usePageLayoutContext] = (0, import_react_utils.createContext)(
|
|
39
|
+
{}
|
|
40
|
+
);
|
|
41
|
+
var PageLayoutRoot = (props) => {
|
|
42
|
+
const { children, width, spacing, paneWidth, gap, ...rest } = props;
|
|
43
|
+
const styles = (0, import_react.useMemo)(
|
|
44
|
+
() => (0, import_theme.pageLayout)({ width, spacing, paneWidth, gap }),
|
|
45
|
+
[width, spacing, paneWidth, gap]
|
|
46
|
+
);
|
|
47
|
+
const header = [];
|
|
48
|
+
const footer = [];
|
|
49
|
+
const content = [];
|
|
50
|
+
import_react.Children.forEach(children, (child) => {
|
|
51
|
+
if ((0, import_react.isValidElement)(child)) {
|
|
52
|
+
const type = getDisplayName(child);
|
|
53
|
+
if (type === "PageLayoutHeader") {
|
|
54
|
+
header.push(child);
|
|
55
|
+
} else if (type === "PageLayoutFooter") {
|
|
56
|
+
footer.push(child);
|
|
57
|
+
} else {
|
|
58
|
+
content.push(child);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
content.push(child);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.wrapper(), children: [
|
|
65
|
+
header,
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.baseContent(), children: content }),
|
|
67
|
+
footer
|
|
68
|
+
] }) }) });
|
|
69
|
+
};
|
|
70
|
+
var PageLayoutHeader = (props) => {
|
|
71
|
+
const { className, ...rest } = props;
|
|
72
|
+
const { styles } = usePageLayoutContext();
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { className: styles.header({ className }), ...rest });
|
|
74
|
+
};
|
|
75
|
+
PageLayoutHeader.displayName = "PageLayoutHeader";
|
|
76
|
+
var PageLayoutFooter = (props) => {
|
|
77
|
+
const { className, children, ...rest } = props;
|
|
78
|
+
const { styles } = usePageLayoutContext();
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("footer", { className: styles.footerWrapper({ className }), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.footerContent(), children }) });
|
|
80
|
+
};
|
|
81
|
+
PageLayoutFooter.displayName = "PageLayoutFooter";
|
|
82
|
+
function PageLayoutPane(props) {
|
|
83
|
+
const { className, children, position = "end", sticky, ...rest } = props;
|
|
84
|
+
const { styles } = usePageLayoutContext();
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: styles.paneWrapper({ className }),
|
|
89
|
+
"data-position": position,
|
|
90
|
+
"data-sticky": (0, import_shared_utils.dataAttr)(sticky),
|
|
91
|
+
...rest,
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.pane(), children })
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
function PageLayoutContent(props) {
|
|
97
|
+
const { className, children, ...rest } = props;
|
|
98
|
+
const { styles } = usePageLayoutContext();
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.contentWrapper({ className }), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.content(), children }) });
|
|
100
|
+
}
|
|
101
|
+
function getDisplayName(el) {
|
|
102
|
+
var _a, _b, _c;
|
|
103
|
+
return (_c = (_a = el.type) == null ? void 0 : _a.displayName) != null ? _c : (_b = el.type) == null ? void 0 : _b.name;
|
|
104
|
+
}
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
Content,
|
|
108
|
+
Footer,
|
|
109
|
+
Header,
|
|
110
|
+
Pane,
|
|
111
|
+
Root
|
|
112
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "./chunk-QHYETCIA.mjs";
|
|
3
|
+
import {
|
|
4
|
+
PageLayoutContent,
|
|
5
|
+
PageLayoutFooter,
|
|
6
|
+
PageLayoutHeader,
|
|
7
|
+
PageLayoutPane,
|
|
8
|
+
PageLayoutRoot
|
|
9
|
+
} from "./chunk-F7HJK32J.mjs";
|
|
10
|
+
export {
|
|
11
|
+
PageLayoutContent as Content,
|
|
12
|
+
PageLayoutFooter as Footer,
|
|
13
|
+
PageLayoutHeader as Header,
|
|
14
|
+
PageLayoutPane as Pane,
|
|
15
|
+
PageLayoutRoot as Root
|
|
16
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PageLayoutVariantProps } from '@kopexa/theme';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type PageLayoutRootProps = ComponentProps<"div"> & PageLayoutVariantProps;
|
|
6
|
+
declare const PageLayoutRoot: (props: PageLayoutRootProps) => react_jsx_runtime.JSX.Element;
|
|
7
|
+
type PageLayoutHeaderProps = ComponentProps<"header">;
|
|
8
|
+
declare const PageLayoutHeader: {
|
|
9
|
+
(props: PageLayoutHeaderProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
type PageLayoutFooterProps = ComponentProps<"footer">;
|
|
13
|
+
declare const PageLayoutFooter: {
|
|
14
|
+
(props: PageLayoutFooterProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
type PageLayoutPaneProps = ComponentProps<"div"> & {
|
|
18
|
+
/**
|
|
19
|
+
* Position of the pane within the layout.
|
|
20
|
+
* - `start`: Pane is positioned at the start of the layout.
|
|
21
|
+
* - `end`: Pane is positioned at the end of the layout.
|
|
22
|
+
* @default `end`
|
|
23
|
+
*/
|
|
24
|
+
position?: "start" | "end";
|
|
25
|
+
/**
|
|
26
|
+
* If true, the pane will be sticky at the top of the viewport.
|
|
27
|
+
* This is useful for keeping the pane visible while scrolling.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
sticky?: boolean;
|
|
31
|
+
};
|
|
32
|
+
declare function PageLayoutPane(props: PageLayoutPaneProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
type PageLayoutContentProps = ComponentProps<"div">;
|
|
34
|
+
declare function PageLayoutContent(props: PageLayoutContentProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { PageLayoutContent, type PageLayoutContentProps, PageLayoutFooter, type PageLayoutFooterProps, PageLayoutHeader, type PageLayoutHeaderProps, PageLayoutPane, type PageLayoutPaneProps, PageLayoutRoot, type PageLayoutRootProps };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PageLayoutVariantProps } from '@kopexa/theme';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type PageLayoutRootProps = ComponentProps<"div"> & PageLayoutVariantProps;
|
|
6
|
+
declare const PageLayoutRoot: (props: PageLayoutRootProps) => react_jsx_runtime.JSX.Element;
|
|
7
|
+
type PageLayoutHeaderProps = ComponentProps<"header">;
|
|
8
|
+
declare const PageLayoutHeader: {
|
|
9
|
+
(props: PageLayoutHeaderProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
type PageLayoutFooterProps = ComponentProps<"footer">;
|
|
13
|
+
declare const PageLayoutFooter: {
|
|
14
|
+
(props: PageLayoutFooterProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
type PageLayoutPaneProps = ComponentProps<"div"> & {
|
|
18
|
+
/**
|
|
19
|
+
* Position of the pane within the layout.
|
|
20
|
+
* - `start`: Pane is positioned at the start of the layout.
|
|
21
|
+
* - `end`: Pane is positioned at the end of the layout.
|
|
22
|
+
* @default `end`
|
|
23
|
+
*/
|
|
24
|
+
position?: "start" | "end";
|
|
25
|
+
/**
|
|
26
|
+
* If true, the pane will be sticky at the top of the viewport.
|
|
27
|
+
* This is useful for keeping the pane visible while scrolling.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
sticky?: boolean;
|
|
31
|
+
};
|
|
32
|
+
declare function PageLayoutPane(props: PageLayoutPaneProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
type PageLayoutContentProps = ComponentProps<"div">;
|
|
34
|
+
declare function PageLayoutContent(props: PageLayoutContentProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { PageLayoutContent, type PageLayoutContentProps, PageLayoutFooter, type PageLayoutFooterProps, PageLayoutHeader, type PageLayoutHeaderProps, PageLayoutPane, type PageLayoutPaneProps, PageLayoutRoot, type PageLayoutRootProps };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/page-layout.tsx
|
|
22
|
+
var page_layout_exports = {};
|
|
23
|
+
__export(page_layout_exports, {
|
|
24
|
+
PageLayoutContent: () => PageLayoutContent,
|
|
25
|
+
PageLayoutFooter: () => PageLayoutFooter,
|
|
26
|
+
PageLayoutHeader: () => PageLayoutHeader,
|
|
27
|
+
PageLayoutPane: () => PageLayoutPane,
|
|
28
|
+
PageLayoutRoot: () => PageLayoutRoot
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(page_layout_exports);
|
|
31
|
+
var import_react_utils = require("@kopexa/react-utils");
|
|
32
|
+
var import_shared_utils = require("@kopexa/shared-utils");
|
|
33
|
+
var import_theme = require("@kopexa/theme");
|
|
34
|
+
var import_react = require("react");
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var [Provider, usePageLayoutContext] = (0, import_react_utils.createContext)(
|
|
37
|
+
{}
|
|
38
|
+
);
|
|
39
|
+
var PageLayoutRoot = (props) => {
|
|
40
|
+
const { children, width, spacing, paneWidth, gap, ...rest } = props;
|
|
41
|
+
const styles = (0, import_react.useMemo)(
|
|
42
|
+
() => (0, import_theme.pageLayout)({ width, spacing, paneWidth, gap }),
|
|
43
|
+
[width, spacing, paneWidth, gap]
|
|
44
|
+
);
|
|
45
|
+
const header = [];
|
|
46
|
+
const footer = [];
|
|
47
|
+
const content = [];
|
|
48
|
+
import_react.Children.forEach(children, (child) => {
|
|
49
|
+
if ((0, import_react.isValidElement)(child)) {
|
|
50
|
+
const type = getDisplayName(child);
|
|
51
|
+
if (type === "PageLayoutHeader") {
|
|
52
|
+
header.push(child);
|
|
53
|
+
} else if (type === "PageLayoutFooter") {
|
|
54
|
+
footer.push(child);
|
|
55
|
+
} else {
|
|
56
|
+
content.push(child);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
content.push(child);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.wrapper(), children: [
|
|
63
|
+
header,
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.baseContent(), children: content }),
|
|
65
|
+
footer
|
|
66
|
+
] }) }) });
|
|
67
|
+
};
|
|
68
|
+
var PageLayoutHeader = (props) => {
|
|
69
|
+
const { className, ...rest } = props;
|
|
70
|
+
const { styles } = usePageLayoutContext();
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { className: styles.header({ className }), ...rest });
|
|
72
|
+
};
|
|
73
|
+
PageLayoutHeader.displayName = "PageLayoutHeader";
|
|
74
|
+
var PageLayoutFooter = (props) => {
|
|
75
|
+
const { className, children, ...rest } = props;
|
|
76
|
+
const { styles } = usePageLayoutContext();
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("footer", { className: styles.footerWrapper({ className }), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.footerContent(), children }) });
|
|
78
|
+
};
|
|
79
|
+
PageLayoutFooter.displayName = "PageLayoutFooter";
|
|
80
|
+
function PageLayoutPane(props) {
|
|
81
|
+
const { className, children, position = "end", sticky, ...rest } = props;
|
|
82
|
+
const { styles } = usePageLayoutContext();
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: styles.paneWrapper({ className }),
|
|
87
|
+
"data-position": position,
|
|
88
|
+
"data-sticky": (0, import_shared_utils.dataAttr)(sticky),
|
|
89
|
+
...rest,
|
|
90
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.pane(), children })
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function PageLayoutContent(props) {
|
|
95
|
+
const { className, children, ...rest } = props;
|
|
96
|
+
const { styles } = usePageLayoutContext();
|
|
97
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.contentWrapper({ className }), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.content(), children }) });
|
|
98
|
+
}
|
|
99
|
+
function getDisplayName(el) {
|
|
100
|
+
var _a, _b, _c;
|
|
101
|
+
return (_c = (_a = el.type) == null ? void 0 : _a.displayName) != null ? _c : (_b = el.type) == null ? void 0 : _b.name;
|
|
102
|
+
}
|
|
103
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
+
0 && (module.exports = {
|
|
105
|
+
PageLayoutContent,
|
|
106
|
+
PageLayoutFooter,
|
|
107
|
+
PageLayoutHeader,
|
|
108
|
+
PageLayoutPane,
|
|
109
|
+
PageLayoutRoot
|
|
110
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
PageLayoutContent,
|
|
4
|
+
PageLayoutFooter,
|
|
5
|
+
PageLayoutHeader,
|
|
6
|
+
PageLayoutPane,
|
|
7
|
+
PageLayoutRoot
|
|
8
|
+
} from "./chunk-F7HJK32J.mjs";
|
|
9
|
+
export {
|
|
10
|
+
PageLayoutContent,
|
|
11
|
+
PageLayoutFooter,
|
|
12
|
+
PageLayoutHeader,
|
|
13
|
+
PageLayoutPane,
|
|
14
|
+
PageLayoutRoot
|
|
15
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kopexa/page-layout",
|
|
3
|
+
"version": "0.0.0-canary-20250720192841",
|
|
4
|
+
"description": "The layout for our pages used within kopexa",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"page-layout"
|
|
7
|
+
],
|
|
8
|
+
"author": "Kopexa <hello@kopexa.com>",
|
|
9
|
+
"homepage": "https://kopexa.com",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/kopexa-grc/sight.git",
|
|
22
|
+
"directory": "packages/components/page-layout"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/kopexa-grc/sight/issues"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": ">=19.0.0-rc.0",
|
|
29
|
+
"react-dom": ">=19.0.0-rc.0",
|
|
30
|
+
"motion": ">=12.23.6",
|
|
31
|
+
"@kopexa/theme": "0.0.0-canary-20250720192841"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@kopexa/shared-utils": "1.1.1",
|
|
35
|
+
"@kopexa/react-utils": "2.0.1"
|
|
36
|
+
},
|
|
37
|
+
"clean-package": "../../../clean-package.config.json",
|
|
38
|
+
"module": "dist/index.mjs",
|
|
39
|
+
"types": "dist/index.d.ts",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"import": "./dist/index.mjs",
|
|
44
|
+
"require": "./dist/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsup src --dts",
|
|
50
|
+
"build:fast": "tsup src",
|
|
51
|
+
"dev": "pnpm build:fast --watch",
|
|
52
|
+
"clean": "rimraf dist .turbo",
|
|
53
|
+
"typecheck": "tsc --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|