ab-nextjs-core 0.1.0 → 0.1.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 +44 -8
- package/ab-app-layout/index.tsx +107 -0
- package/ab-app-layout/styles.module.css +145 -0
- package/ab-aside-layout/index.tsx +188 -0
- package/ab-aside-layout/styles.module.css +160 -0
- package/ab-linear-progress/index.tsx +71 -0
- package/ab-main-layout/index.tsx +114 -0
- package/ab-main-layout/styles.module.css +167 -0
- package/ab-page-provider/index.tsx +157 -0
- package/ab-screen-layout/index.tsx +101 -0
- package/ab-screen-layout/styles.module.css +134 -0
- package/index.ts +58 -0
- package/package.json +58 -6
- package/server/ab-app-layout/index.tsx +113 -0
- package/server/ab-app-layout/styles.module.css +145 -0
- package/server/ab-aside-layout/index.tsx +117 -0
- package/server/ab-aside-layout/styles.module.css +155 -0
- package/server/ab-main-layout/index.tsx +119 -0
- package/server/ab-main-layout/styles.module.css +167 -0
- package/server/ab-screen-layout/index.tsx +107 -0
- package/server/ab-screen-layout/styles.module.css +134 -0
- package/types/css.d.ts +4 -0
- package/types/index.d.ts +14 -0
- package/.github/ab-logo-dark.svg +0 -12
- package/.github/ab-logo-light.svg +0 -9
- package/.github/nextjs-logoname-dark.svg +0 -28
- package/.github/nextjs-logoname-light.svg +0 -25
package/README.md
CHANGED
|
@@ -36,6 +36,18 @@
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
## Tooling
|
|
40
|
+
|
|
41
|
+
This package targets **Next.js 16.3.4** / **React 19** (eslint 9 flat config + vitest).
|
|
42
|
+
Layout shells are **Done** (LYD-faithful slot API). Consumers must configure Tailwind so its content covers this package (CSS Modules use `@apply`).
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
Layout stylesheets are **plain CSS modules** (no Tailwind `@apply`) so Next/Turbopack consumers never hit CssSyntaxError expanding package CSS. Theme colors use CSS variables (`--color-background`, `--color-dark-background`, falling back to `--surface`).
|
|
46
|
+
|
|
47
|
+
Peer: `clsx`, `next@16.3.4`, `react@^19`, `react-dom@^19`.
|
|
48
|
+
|
|
49
|
+
Optional: wrap client `AbAsideLayout` with `AbPageProvider` / `useAbPage` for aside open state.
|
|
50
|
+
|
|
39
51
|
## Getting Started
|
|
40
52
|
|
|
41
53
|
### Installation
|
|
@@ -61,10 +73,10 @@ A list of all the supported **core server components** and their current status:
|
|
|
61
73
|
|
|
62
74
|
| No. | Name | File | Status |
|
|
63
75
|
|:----|:-----|:-----|:-------|
|
|
64
|
-
| 1 | *`AbAppLayout`* | **server/ab-app-layout/index.tsx** |
|
|
65
|
-
| 2 | *`AbScreenLayout`* | **server/ab-screen-layout/index.tsx** |
|
|
66
|
-
| 3 | *`AbMainLayout`* | **server/ab-main-layout/index.tsx** |
|
|
67
|
-
| 4 | *`AbAsideLayout`* | **server/ab-aside-layout/index.tsx** |
|
|
76
|
+
| 1 | *`AbAppLayout`* | **server/ab-app-layout/index.tsx** | Done |
|
|
77
|
+
| 2 | *`AbScreenLayout`* | **server/ab-screen-layout/index.tsx** | Done |
|
|
78
|
+
| 3 | *`AbMainLayout`* | **server/ab-main-layout/index.tsx** | Done |
|
|
79
|
+
| 4 | *`AbAsideLayout`* | **server/ab-aside-layout/index.tsx** | Done |
|
|
68
80
|
|
|
69
81
|
|
|
70
82
|
|
|
@@ -74,10 +86,10 @@ A list of all the supported **core client components** and their current status:
|
|
|
74
86
|
|
|
75
87
|
| No. | Name | File | Status |
|
|
76
88
|
|:----|:-----|:-----|:-------|
|
|
77
|
-
| 1 | *`AbAppLayout`* | **ab-app-layout/index.tsx** |
|
|
78
|
-
| 2 | *`AbScreenLayout`* | **ab-screen-layout/index.tsx** |
|
|
79
|
-
| 3 | *`AbMainLayout`* | **ab-main-layout/index.tsx** |
|
|
80
|
-
| 4 | *`AbAsideLayout`* | **ab-aside-layout/index.tsx** |
|
|
89
|
+
| 1 | *`AbAppLayout`* | **ab-app-layout/index.tsx** | Done |
|
|
90
|
+
| 2 | *`AbScreenLayout`* | **ab-screen-layout/index.tsx** | Done |
|
|
91
|
+
| 3 | *`AbMainLayout`* | **ab-main-layout/index.tsx** | Done |
|
|
92
|
+
| 4 | *`AbAsideLayout`* | **ab-aside-layout/index.tsx** | Done |
|
|
81
93
|
|
|
82
94
|
|
|
83
95
|
|
|
@@ -87,6 +99,30 @@ A list of all the supported **core client components** and their current status:
|
|
|
87
99
|
|
|
88
100
|
|
|
89
101
|
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
## Imports
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
// catalog
|
|
108
|
+
import { supportedCore } from 'ab-nextjs-core'
|
|
109
|
+
|
|
110
|
+
// server layouts
|
|
111
|
+
import AbAppLayout from 'ab-nextjs-core/server/ab-app-layout'
|
|
112
|
+
import AbScreenLayout from 'ab-nextjs-core/server/ab-screen-layout'
|
|
113
|
+
import AbMainLayout from 'ab-nextjs-core/server/ab-main-layout'
|
|
114
|
+
import AbAsideLayout from 'ab-nextjs-core/server/ab-aside-layout'
|
|
115
|
+
|
|
116
|
+
// client layouts
|
|
117
|
+
import AbAppLayout from 'ab-nextjs-core/ab-app-layout'
|
|
118
|
+
import AbScreenLayout from 'ab-nextjs-core/ab-screen-layout'
|
|
119
|
+
import AbMainLayout from 'ab-nextjs-core/ab-main-layout'
|
|
120
|
+
import AbAsideLayout from 'ab-nextjs-core/ab-aside-layout'
|
|
121
|
+
import { AbPageProvider, useAbPage } from 'ab-nextjs-core/ab-page-provider'
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
> NOTE: `AbAppLayout` does **not** bake in sidebar/navbar/i18n — pass `sideBar` / `navBar` slots from the consumer. Content rule: `content ?? children`.
|
|
125
|
+
|
|
90
126
|
## Learn More abElements
|
|
91
127
|
|
|
92
128
|
To learn more about **`abElements`**, take a look at the following resources:
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-core
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-core
|
|
27
|
+
* @authors: Abraham Ukachi <abraham.ukachi@laplateforme.io>
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
32
|
+
* MOTTO: We'll always do more 😜!!!
|
|
33
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
'use client';
|
|
37
|
+
|
|
38
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
39
|
+
import clsx from 'clsx';
|
|
40
|
+
import AbLinearProgress from '../ab-linear-progress';
|
|
41
|
+
import styles from './styles.module.css';
|
|
42
|
+
|
|
43
|
+
export interface AbAppLayoutProps {
|
|
44
|
+
orientation: 'vertical' | 'horizontal';
|
|
45
|
+
className?: string;
|
|
46
|
+
hidden?: boolean;
|
|
47
|
+
pageName?: string;
|
|
48
|
+
header?: ReactNode;
|
|
49
|
+
sideBar?: ReactNode;
|
|
50
|
+
content?: ReactNode;
|
|
51
|
+
navBar?: ReactNode;
|
|
52
|
+
footer?: ReactNode;
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
menus?: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Client markup mirror of server AbAppLayout (slots only). */
|
|
58
|
+
const AbAppLayout = ({
|
|
59
|
+
orientation,
|
|
60
|
+
className,
|
|
61
|
+
hidden,
|
|
62
|
+
pageName,
|
|
63
|
+
header,
|
|
64
|
+
sideBar,
|
|
65
|
+
content,
|
|
66
|
+
navBar,
|
|
67
|
+
footer,
|
|
68
|
+
children,
|
|
69
|
+
menus,
|
|
70
|
+
}: AbAppLayoutProps): ReactElement => {
|
|
71
|
+
return (
|
|
72
|
+
<div
|
|
73
|
+
className={clsx(['AbAppLayout', styles.abAppLayout, className])}
|
|
74
|
+
hidden={hidden}
|
|
75
|
+
data-page-name={pageName}
|
|
76
|
+
data-orientation={orientation ?? ''}
|
|
77
|
+
>
|
|
78
|
+
<div className={clsx(['HeaderWrapper', styles.abAppLayout__headerWrapper])}>
|
|
79
|
+
{header}
|
|
80
|
+
</div>
|
|
81
|
+
<div className={clsx(['ContentWrapper', styles.abAppLayout__contentWrapper])}>
|
|
82
|
+
{sideBar}
|
|
83
|
+
{content ?? children}
|
|
84
|
+
{navBar}
|
|
85
|
+
</div>
|
|
86
|
+
<div className={clsx(['FooterWrapper', styles.abAppLayout__footerWrapper])}>
|
|
87
|
+
{footer}
|
|
88
|
+
</div>
|
|
89
|
+
<div id="backdrop" className={clsx(['Backdrop', styles.abAppLayout__backdrop])} hidden />
|
|
90
|
+
<div id="menus" className={clsx(['Menus', styles.abAppLayout__menus])} hidden>
|
|
91
|
+
{menus}
|
|
92
|
+
</div>
|
|
93
|
+
<div id="dialogs" className={clsx(['Dialogs', styles.abAppLayout__dialogs])} hidden />
|
|
94
|
+
<div id="toasts" className={clsx(['Toasts', styles.abAppLayout__toasts])} hidden />
|
|
95
|
+
<AbLinearProgress
|
|
96
|
+
className="absolute top-0 left-0 right-0 z-50 !h-0.5 lg:!h-1"
|
|
97
|
+
color="secondary"
|
|
98
|
+
hidden={true}
|
|
99
|
+
isIndeterminate={true}
|
|
100
|
+
progress={25}
|
|
101
|
+
/>
|
|
102
|
+
<canvas className={clsx(['Canvas', styles.abAppLayout__canvas])} />
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default AbAppLayout;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-core
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-core
|
|
27
|
+
* @name: AB App Layout - Component Stylesheet (plain CSS, Tailwind-independent)
|
|
28
|
+
* @file: ab-app-layout/styles.module.css
|
|
29
|
+
* @type: CSS Module
|
|
30
|
+
* @authors: Abraham Ukachi <abraham.ukachi@laplateforme.io>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more 😜!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/* ===== AB APP LAYOUT STYLES ===== */
|
|
41
|
+
|
|
42
|
+
.abAppLayout {
|
|
43
|
+
position: relative;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.abAppLayout__headerWrapper {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
right: 0;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: auto;
|
|
59
|
+
z-index: 20;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.abAppLayout__contentWrapper {
|
|
64
|
+
position: relative;
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
z-index: 10;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media (min-width: 768px) {
|
|
74
|
+
.abAppLayout__contentWrapper { flex-direction: row; }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media (min-width: 1536px) {
|
|
78
|
+
.abAppLayout__contentWrapper > *:nth-child(1) {
|
|
79
|
+
border-top-right-radius: 1.5rem;
|
|
80
|
+
border-bottom-right-radius: 1.5rem;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
margin-top: auto;
|
|
83
|
+
margin-bottom: auto;
|
|
84
|
+
margin-left: 0;
|
|
85
|
+
margin-right: 0;
|
|
86
|
+
max-height: calc(100vh - 3rem);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.abAppLayout__contentWrapper > *:nth-child(2) {
|
|
90
|
+
margin: 1.5rem;
|
|
91
|
+
border-radius: 1.5rem;
|
|
92
|
+
max-height: calc(100vh - 3rem);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.abAppLayout__footerWrapper {
|
|
97
|
+
position: absolute;
|
|
98
|
+
bottom: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
right: 0;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: auto;
|
|
105
|
+
z-index: 20;
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.abAppLayout__backdrop {
|
|
110
|
+
position: absolute;
|
|
111
|
+
inset: 0;
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
align-items: center;
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 100%;
|
|
117
|
+
z-index: 40;
|
|
118
|
+
backdrop-filter: blur(4px);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.abAppLayout__menus,
|
|
122
|
+
.abAppLayout__dialogs,
|
|
123
|
+
.abAppLayout__toasts {
|
|
124
|
+
position: absolute;
|
|
125
|
+
inset: 0;
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 100%;
|
|
128
|
+
z-index: 50;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.abAppLayout__toasts { animation: abCoreFadeIn 300ms ease-in-out; }
|
|
132
|
+
|
|
133
|
+
.abAppLayout__canvas {
|
|
134
|
+
position: absolute;
|
|
135
|
+
inset: 0;
|
|
136
|
+
width: 100%;
|
|
137
|
+
height: 100%;
|
|
138
|
+
pointer-events: none;
|
|
139
|
+
z-index: 50;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@keyframes abCoreFadeIn {
|
|
143
|
+
from { opacity: 0; }
|
|
144
|
+
to { opacity: 1; }
|
|
145
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-core
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-core
|
|
27
|
+
* @authors: Abraham Ukachi <abraham.ukachi@laplateforme.io>
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
32
|
+
* MOTTO: We'll always do more 😜!!!
|
|
33
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
'use client';
|
|
37
|
+
|
|
38
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
39
|
+
import { useEffect, useRef } from 'react';
|
|
40
|
+
import clsx from 'clsx';
|
|
41
|
+
import { useAbPage } from '../ab-page-provider';
|
|
42
|
+
import AbLinearProgress from '../ab-linear-progress';
|
|
43
|
+
import styles from './styles.module.css';
|
|
44
|
+
|
|
45
|
+
export interface AbAsideLayoutProps {
|
|
46
|
+
orientation: 'vertical' | 'horizontal';
|
|
47
|
+
className?: string;
|
|
48
|
+
hidden?: boolean;
|
|
49
|
+
pageName?: string;
|
|
50
|
+
header?: ReactNode;
|
|
51
|
+
content?: ReactNode;
|
|
52
|
+
footer?: ReactNode;
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
dividerHidden?: boolean;
|
|
55
|
+
menus?: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Ab Aside Layout — Core Client Component (from LYD client LydAsideLayout).
|
|
60
|
+
* Uses minimal useAbPage contract (AbPageProvider), not LydPageProvider.
|
|
61
|
+
*/
|
|
62
|
+
const AbAsideLayout = ({
|
|
63
|
+
orientation,
|
|
64
|
+
className,
|
|
65
|
+
hidden,
|
|
66
|
+
pageName,
|
|
67
|
+
header,
|
|
68
|
+
content,
|
|
69
|
+
footer,
|
|
70
|
+
children,
|
|
71
|
+
dividerHidden,
|
|
72
|
+
menus,
|
|
73
|
+
}: AbAsideLayoutProps): ReactElement => {
|
|
74
|
+
const {
|
|
75
|
+
isAsideOpen,
|
|
76
|
+
isAsideOpenOnMobile,
|
|
77
|
+
asideDuration,
|
|
78
|
+
asideElement,
|
|
79
|
+
setAsideElement,
|
|
80
|
+
isAsideOpening,
|
|
81
|
+
isAsideClosing,
|
|
82
|
+
isAsideLoading,
|
|
83
|
+
} = useAbPage();
|
|
84
|
+
|
|
85
|
+
const asideRef = useRef<HTMLElement | null>(null);
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const el = asideRef.current;
|
|
89
|
+
if (el) setAsideElement(el);
|
|
90
|
+
return () => setAsideElement(null);
|
|
91
|
+
}, [setAsideElement]);
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const updateAsideParentElement = (
|
|
95
|
+
parentEl: HTMLElement,
|
|
96
|
+
open: boolean,
|
|
97
|
+
openOnMobile: boolean,
|
|
98
|
+
opening: boolean,
|
|
99
|
+
closing: boolean,
|
|
100
|
+
) => {
|
|
101
|
+
const parentElWidth = parentEl.clientWidth;
|
|
102
|
+
parentEl.style.setProperty('--current-aside-width', `${parentElWidth}px`);
|
|
103
|
+
parentEl.classList.toggle('is-aside-open', open);
|
|
104
|
+
parentEl.classList.toggle('is-aside-open-on-mobile', openOnMobile);
|
|
105
|
+
parentEl.classList.toggle('is-aside-opening', opening);
|
|
106
|
+
parentEl.classList.toggle('is-aside-closing', closing);
|
|
107
|
+
parentEl.style.setProperty('--aside-duration', `${asideDuration}ms`);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const parentEl = asideElement?.parentElement as HTMLElement | null | undefined;
|
|
111
|
+
const width =
|
|
112
|
+
typeof window !== 'undefined' ? window.innerWidth : 0;
|
|
113
|
+
|
|
114
|
+
if (parentEl && width > 0) {
|
|
115
|
+
updateAsideParentElement(
|
|
116
|
+
parentEl,
|
|
117
|
+
isAsideOpen,
|
|
118
|
+
isAsideOpenOnMobile,
|
|
119
|
+
isAsideOpening,
|
|
120
|
+
isAsideClosing,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}, [
|
|
124
|
+
isAsideOpen,
|
|
125
|
+
isAsideOpenOnMobile,
|
|
126
|
+
isAsideOpening,
|
|
127
|
+
isAsideClosing,
|
|
128
|
+
asideElement,
|
|
129
|
+
asideDuration,
|
|
130
|
+
]);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<aside
|
|
134
|
+
ref={asideRef}
|
|
135
|
+
className={clsx(
|
|
136
|
+
['AbAsideLayout', 'group/aside-layout', styles.abAsideLayout, className],
|
|
137
|
+
{ 'is-open max-lg:!animate-slide-from-right': isAsideOpen },
|
|
138
|
+
{ 'is-open-on-mobile': isAsideOpenOnMobile },
|
|
139
|
+
{ '!hidden': !isAsideOpen && !isAsideOpening && !isAsideClosing },
|
|
140
|
+
)}
|
|
141
|
+
hidden={hidden}
|
|
142
|
+
data-page-name={pageName}
|
|
143
|
+
data-opened={isAsideOpen}
|
|
144
|
+
data-open-on-mobile={isAsideOpenOnMobile}
|
|
145
|
+
>
|
|
146
|
+
<div className={clsx(['HeaderWrapper', styles.abAsideLayout__headerWrapper])}>
|
|
147
|
+
{header}
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<div
|
|
151
|
+
className={clsx([
|
|
152
|
+
'ContentWrapper',
|
|
153
|
+
styles.abAsideLayout__contentWrapper,
|
|
154
|
+
orientation === 'horizontal' && '!flex-row',
|
|
155
|
+
])}
|
|
156
|
+
>
|
|
157
|
+
{content ?? children}
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div className={clsx(['FooterWrapper', styles.abAsideLayout__footerWrapper])}>
|
|
161
|
+
{footer}
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<div className={clsx(['Backdrop', styles.abAsideLayout__backdrop])} hidden />
|
|
165
|
+
<div className={clsx(['Menus', styles.abAsideLayout__menus])} hidden>
|
|
166
|
+
{menus}
|
|
167
|
+
</div>
|
|
168
|
+
<div className={clsx(['Dialogs', styles.abAsideLayout__dialogs])} hidden />
|
|
169
|
+
<div className={clsx(['Toasts', styles.abAsideLayout__toasts])} hidden />
|
|
170
|
+
|
|
171
|
+
{!dividerHidden && (
|
|
172
|
+
<span className={clsx(['divider', 'vertical', 'left', styles.abAsideLayout__divider])} />
|
|
173
|
+
)}
|
|
174
|
+
|
|
175
|
+
<AbLinearProgress
|
|
176
|
+
className="absolute top-0 left-0 right-0 z-50 !h-0.5 lg:!h-1"
|
|
177
|
+
color="secondary"
|
|
178
|
+
hidden={!isAsideLoading}
|
|
179
|
+
isIndeterminate={true}
|
|
180
|
+
progress={25}
|
|
181
|
+
/>
|
|
182
|
+
|
|
183
|
+
<canvas className={clsx(['Canvas', styles.abAsideLayout__canvas])} />
|
|
184
|
+
</aside>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default AbAsideLayout;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-core
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-core
|
|
27
|
+
* @name: AB Aside Layout (client) - Component Stylesheet (plain CSS, Tailwind-independent)
|
|
28
|
+
* @file: ab-aside-layout/styles.module.css
|
|
29
|
+
* @type: CSS Module
|
|
30
|
+
* @authors: Abraham Ukachi <abraham.ukachi@laplateforme.io>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more 😜!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/* ===== AB ASIDE LAYOUT STYLES ===== */
|
|
41
|
+
|
|
42
|
+
.abAsideLayout {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
z-index: 10;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
transition-property: all;
|
|
50
|
+
transition-duration: 300ms;
|
|
51
|
+
transition-timing-function: ease-in-out;
|
|
52
|
+
background-color: var(--color-background, var(--surface, #ffffff));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@media (min-width: 1536px) {
|
|
56
|
+
.abAsideLayout {
|
|
57
|
+
margin-left: 0.75rem;
|
|
58
|
+
border-radius: 1.5rem;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:global(.dark) .abAsideLayout,
|
|
63
|
+
:global([data-theme="dark"]) .abAsideLayout {
|
|
64
|
+
background-color: var(--color-dark-background, var(--surface, #0a0a0a));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (max-width: 767px) {
|
|
68
|
+
.abAsideLayout__divider { visibility: hidden; }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media (min-width: 1536px) {
|
|
72
|
+
.abAsideLayout__divider { visibility: hidden; }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.abAsideLayout__headerWrapper {
|
|
76
|
+
position: relative;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: auto;
|
|
81
|
+
z-index: 20;
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.abAsideLayout__contentWrapper {
|
|
86
|
+
position: relative;
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: auto;
|
|
91
|
+
flex-grow: 1;
|
|
92
|
+
justify-content: space-between;
|
|
93
|
+
z-index: 10;
|
|
94
|
+
overflow: auto;
|
|
95
|
+
overflow-x: hidden;
|
|
96
|
+
pointer-events: auto;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.abAsideLayout__footerWrapper {
|
|
100
|
+
position: relative;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: auto;
|
|
105
|
+
z-index: 20;
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.abAsideLayout__footerWrapper::before {
|
|
110
|
+
content: "";
|
|
111
|
+
position: absolute;
|
|
112
|
+
inset: 0;
|
|
113
|
+
width: 100%;
|
|
114
|
+
height: 100%;
|
|
115
|
+
z-index: -1;
|
|
116
|
+
transform: translateY(-100%);
|
|
117
|
+
background-image: linear-gradient(to bottom, transparent, var(--color-background, var(--surface, #ffffff)));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:global(.dark) .abAsideLayout__footerWrapper::before,
|
|
121
|
+
:global([data-theme="dark"]) .abAsideLayout__footerWrapper::before {
|
|
122
|
+
background-image: linear-gradient(to bottom, transparent, var(--color-dark-background, var(--surface, #0a0a0a)));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.abAsideLayout__backdrop {
|
|
126
|
+
position: absolute;
|
|
127
|
+
inset: 0;
|
|
128
|
+
width: 100%;
|
|
129
|
+
height: 100%;
|
|
130
|
+
z-index: 40;
|
|
131
|
+
backdrop-filter: blur(4px);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.abAsideLayout__menus,
|
|
135
|
+
.abAsideLayout__dialogs,
|
|
136
|
+
.abAsideLayout__toasts {
|
|
137
|
+
position: absolute;
|
|
138
|
+
inset: 0;
|
|
139
|
+
width: 100%;
|
|
140
|
+
height: 100%;
|
|
141
|
+
z-index: 50;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.abAsideLayout__toasts {
|
|
145
|
+
animation: abCoreFadeIn 300ms ease-in-out;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.abAsideLayout__canvas {
|
|
149
|
+
position: absolute;
|
|
150
|
+
inset: 0;
|
|
151
|
+
width: 100%;
|
|
152
|
+
height: 100%;
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
z-index: 50;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@keyframes abCoreFadeIn {
|
|
158
|
+
from { opacity: 0; }
|
|
159
|
+
to { opacity: 1; }
|
|
160
|
+
}
|