ab-nextjs-components 0.1.2 → 0.1.4
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/CHANGELOG.md +45 -0
- package/README.md +60 -14
- package/ab-avatar/index.tsx +90 -0
- package/ab-avatar/styles.module.css +62 -0
- package/ab-balloon/index.tsx +55 -0
- package/ab-balloon/styles.module.css +12 -0
- package/ab-brand/index.tsx +88 -0
- package/ab-brand/styles.module.css +54 -0
- package/ab-button/index.tsx +164 -0
- package/ab-button/styles.module.css +63 -0
- package/ab-collapsible/index.tsx +188 -0
- package/ab-collapsible/styles.module.css +98 -0
- package/ab-color/index.tsx +84 -0
- package/ab-color/styles.module.css +51 -0
- package/ab-demo-box/index.tsx +38 -0
- package/ab-demo-box/styles.module.css +13 -0
- package/ab-demo-code/index.tsx +62 -0
- package/ab-demo-code/styles.module.css +41 -0
- package/ab-icon/index.tsx +63 -0
- package/ab-icon/styles.module.css +27 -0
- package/ab-icon-button/index.tsx +107 -0
- package/ab-icon-button/styles.module.css +64 -0
- package/ab-image/index.tsx +83 -0
- package/ab-image/styles.module.css +27 -0
- package/ab-info/index.tsx +89 -0
- package/ab-info/styles.module.css +87 -0
- package/ab-input/index.tsx +277 -0
- package/ab-input/styles.module.css +101 -0
- package/ab-key-feature/index.tsx +60 -0
- package/ab-key-feature/styles.module.css +47 -0
- package/ab-like-button/index.tsx +116 -0
- package/ab-like-button/styles.module.css +60 -0
- package/ab-logo/index.tsx +94 -0
- package/ab-logo/styles.module.css +30 -0
- package/ab-main-headline/index.tsx +57 -0
- package/ab-main-headline/styles.module.css +24 -0
- package/ab-menu/index.tsx +119 -0
- package/ab-menu/styles.module.css +99 -0
- package/ab-name/index.tsx +49 -0
- package/ab-name/styles.module.css +14 -0
- package/ab-navbar/index.tsx +68 -0
- package/ab-navbar/styles.module.css +35 -0
- package/ab-page-paginator/index.tsx +130 -0
- package/ab-page-paginator/styles.module.css +47 -0
- package/ab-page-switcher/index.tsx +121 -0
- package/ab-page-switcher/styles.module.css +37 -0
- package/ab-preview/index.tsx +78 -0
- package/ab-preview/styles.module.css +26 -0
- package/ab-price/index.tsx +109 -0
- package/ab-price/styles.module.css +36 -0
- package/ab-price-tag/index.tsx +70 -0
- package/ab-price-tag/styles.module.css +81 -0
- package/ab-product/index.tsx +128 -0
- package/ab-product/styles.module.css +44 -0
- package/ab-product-item/index.tsx +78 -0
- package/ab-product-item/styles.module.css +21 -0
- package/ab-progress-chips/index.tsx +105 -0
- package/ab-progress-chips/styles.module.css +43 -0
- package/ab-search-result/index.tsx +79 -0
- package/ab-search-result/styles.module.css +48 -0
- package/ab-searchbar/index.tsx +150 -0
- package/ab-searchbar/styles.module.css +77 -0
- package/ab-sidebar/index.tsx +72 -0
- package/ab-sidebar/styles.module.css +41 -0
- package/ab-switch-back/index.tsx +72 -0
- package/ab-switch-back/styles.module.css +45 -0
- package/ab-tab/index.tsx +101 -0
- package/ab-tab/styles.module.css +65 -0
- package/ab-tabs/index.tsx +45 -0
- package/ab-tabs/styles.module.css +17 -0
- package/ab-test-hello/index.tsx +37 -0
- package/ab-test-hello/styles.module.css +25 -0
- package/ab-text/index.tsx +36 -0
- package/ab-text/styles.module.css +3 -0
- package/index.ts +117 -0
- package/package.json +152 -7
- package/server/ab-avatar/index.tsx +85 -0
- package/server/ab-avatar/styles.module.css +62 -0
- package/server/ab-badge/index.tsx +66 -0
- package/server/ab-badge/styles.module.css +39 -0
- package/server/ab-brand/index.tsx +87 -0
- package/server/ab-brand/styles.module.css +54 -0
- package/server/ab-button/index.tsx +144 -0
- package/server/ab-button/styles.module.css +63 -0
- package/server/ab-icon/index.tsx +61 -0
- package/server/ab-icon/styles.module.css +27 -0
- package/server/ab-key-feature/index.tsx +59 -0
- package/server/ab-key-feature/styles.module.css +47 -0
- package/server/ab-logo/index.tsx +93 -0
- package/server/ab-logo/styles.module.css +30 -0
- package/server/ab-name/index.tsx +48 -0
- package/server/ab-name/styles.module.css +14 -0
- package/server/ab-nav-link/index.tsx +60 -0
- package/server/ab-nav-link/styles.module.css +32 -0
- package/server/ab-navbar/index.tsx +64 -0
- package/server/ab-navbar/styles.module.css +35 -0
- package/server/ab-polygon/index.tsx +45 -0
- package/server/ab-polygon/styles.module.css +11 -0
- package/server/ab-sidebar/index.tsx +68 -0
- package/server/ab-sidebar/styles.module.css +41 -0
- package/server/ab-switch-back/index.tsx +71 -0
- package/server/ab-switch-back/styles.module.css +45 -0
- package/server/ab-test-hello/index.tsx +35 -0
- package/server/ab-test-hello/styles.module.css +22 -0
- package/server/ab-text/index.tsx +33 -0
- package/server/ab-text/styles.module.css +3 -0
- package/server/index.ts +27 -0
- package/types/index.d.ts +54 -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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
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
|
+
*
|
|
27
|
+
* @project: ab-nextjs-components
|
|
28
|
+
* @name: AbLogo - Client
|
|
29
|
+
* @file: ab-logo/index.tsx
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
'use client';
|
|
33
|
+
|
|
34
|
+
import type { ReactElement } from 'react';
|
|
35
|
+
import clsx from 'clsx';
|
|
36
|
+
import styles from './styles.module.css';
|
|
37
|
+
|
|
38
|
+
export type AbLogoType = 'contained' | 'outlined' | 'hollow' | 'naked';
|
|
39
|
+
|
|
40
|
+
export interface AbLogoProps {
|
|
41
|
+
type?: AbLogoType;
|
|
42
|
+
className?: string;
|
|
43
|
+
/** Optional image src (contained). Defaults to ab-nextjs-icons Ab logo. */
|
|
44
|
+
src?: string;
|
|
45
|
+
/** Optional CSS mask value for outlined/hollow/naked. */
|
|
46
|
+
mask?: string;
|
|
47
|
+
alt?: string;
|
|
48
|
+
size?: number | string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const DEFAULT_SRC = '/ab-nextjs-icons/logos/ab-logo.svg';
|
|
52
|
+
|
|
53
|
+
const AbLogo = ({
|
|
54
|
+
type = 'naked',
|
|
55
|
+
className,
|
|
56
|
+
src,
|
|
57
|
+
mask,
|
|
58
|
+
alt = 'Ab',
|
|
59
|
+
size,
|
|
60
|
+
}: AbLogoProps): ReactElement => {
|
|
61
|
+
const dim = size != null ? (typeof size === 'number' ? `${size}px` : size) : undefined;
|
|
62
|
+
|
|
63
|
+
if (type === 'contained') {
|
|
64
|
+
return (
|
|
65
|
+
<img
|
|
66
|
+
className={clsx('AbLogo', 'app-logo', styles.abLogoContained, className)}
|
|
67
|
+
src={src ?? DEFAULT_SRC}
|
|
68
|
+
alt={alt}
|
|
69
|
+
data-type="contained"
|
|
70
|
+
style={dim ? { width: dim, height: dim } : undefined}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const maskValue = mask ?? `url('${DEFAULT_SRC}') no-repeat 50% 50%`;
|
|
76
|
+
return (
|
|
77
|
+
<span
|
|
78
|
+
className={clsx('AbLogo', 'app-logo', styles.abLogo, className)}
|
|
79
|
+
data-type={type}
|
|
80
|
+
role="img"
|
|
81
|
+
aria-label={alt}
|
|
82
|
+
style={{
|
|
83
|
+
...(dim ? { width: dim, height: dim } : {}),
|
|
84
|
+
WebkitMask: maskValue,
|
|
85
|
+
mask: maskValue,
|
|
86
|
+
WebkitMaskSize: 'cover',
|
|
87
|
+
maskSize: 'cover',
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default AbLogo;
|
|
94
|
+
export { AbLogo };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
* Plain CSS modules — no Tailwind Tailwind apply (Turbopack-safe).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
12
|
+
* MOTTO: We'll always do more 😜!!!
|
|
13
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
.abLogo {
|
|
17
|
+
display: block;
|
|
18
|
+
position: relative;
|
|
19
|
+
width: 1.5rem;
|
|
20
|
+
height: 1.5rem;
|
|
21
|
+
background-color: var(--app-logo-color, #a67c52);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.abLogoContained {
|
|
25
|
+
display: block;
|
|
26
|
+
position: relative;
|
|
27
|
+
width: 1.5rem;
|
|
28
|
+
height: 1.5rem;
|
|
29
|
+
object-fit: contain;
|
|
30
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* @project: ab-nextjs-components
|
|
9
|
+
* @name: AbMainHeadline - Client (port of lyd-main-headline; providers stripped)
|
|
10
|
+
* @file: ab-main-headline/index.tsx
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use client';
|
|
14
|
+
|
|
15
|
+
import type { ReactElement } from 'react';
|
|
16
|
+
import clsx from 'clsx';
|
|
17
|
+
import styles from './styles.module.css';
|
|
18
|
+
|
|
19
|
+
export interface AbMainHeadlineProps {
|
|
20
|
+
className?: string;
|
|
21
|
+
timePeriod?: 'morning' | 'afternoon' | 'evening' | 'night';
|
|
22
|
+
title: string;
|
|
23
|
+
commaHidden?: boolean;
|
|
24
|
+
subtitle: string;
|
|
25
|
+
isFirstNameBold?: boolean;
|
|
26
|
+
hasExclamationMark?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const AbMainHeadline = ({
|
|
30
|
+
className,
|
|
31
|
+
timePeriod,
|
|
32
|
+
title,
|
|
33
|
+
commaHidden = false,
|
|
34
|
+
subtitle,
|
|
35
|
+
isFirstNameBold = false,
|
|
36
|
+
hasExclamationMark = false,
|
|
37
|
+
}: AbMainHeadlineProps): ReactElement => {
|
|
38
|
+
const parts = title.trim().split(/\s+/);
|
|
39
|
+
const first = parts[0] ?? '';
|
|
40
|
+
const rest = parts.slice(1).join(' ');
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<header className={clsx('AbMainHeadline', styles.abMainHeadline, className)}>
|
|
44
|
+
{timePeriod ? <span className={styles.abMainHeadlinePeriod}>{timePeriod}</span> : null}
|
|
45
|
+
<h1 className={styles.abMainHeadlineTitle}>
|
|
46
|
+
{isFirstNameBold ? <strong>{first}</strong> : first}
|
|
47
|
+
{rest ? ` ${rest}` : ''}
|
|
48
|
+
{!commaHidden ? ',' : ''}
|
|
49
|
+
{hasExclamationMark ? '!' : ''}
|
|
50
|
+
</h1>
|
|
51
|
+
<p className={styles.abMainHeadlineSubtitle}>{subtitle}</p>
|
|
52
|
+
</header>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default AbMainHeadline;
|
|
57
|
+
export { AbMainHeadline };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.abMainHeadline {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0.35rem;
|
|
5
|
+
}
|
|
6
|
+
.abMainHeadlineTitle {
|
|
7
|
+
margin: 0;
|
|
8
|
+
font-size: clamp(1.75rem, 4vw, 2.75rem);
|
|
9
|
+
font-weight: 700;
|
|
10
|
+
line-height: 1.15;
|
|
11
|
+
}
|
|
12
|
+
.abMainHeadlineTitle strong { font-weight: 900; }
|
|
13
|
+
.abMainHeadlineSubtitle {
|
|
14
|
+
margin: 0;
|
|
15
|
+
font-size: 1.05rem;
|
|
16
|
+
opacity: 0.75;
|
|
17
|
+
}
|
|
18
|
+
.abMainHeadlinePeriod {
|
|
19
|
+
font-size: 0.75rem;
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
text-transform: uppercase;
|
|
22
|
+
letter-spacing: 0.08em;
|
|
23
|
+
opacity: 0.55;
|
|
24
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* @project: ab-nextjs-components
|
|
9
|
+
* @name: AbMenu - Client (port of lyd-menu)
|
|
10
|
+
* @file: ab-menu/index.tsx
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use client';
|
|
14
|
+
|
|
15
|
+
import type { ReactElement } from 'react';
|
|
16
|
+
import { forwardRef } from 'react';
|
|
17
|
+
import Link from 'next/link';
|
|
18
|
+
import clsx from 'clsx';
|
|
19
|
+
import styles from './styles.module.css';
|
|
20
|
+
|
|
21
|
+
export interface AbMenuItemData {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
icon?: string;
|
|
25
|
+
selected?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
inactive?: boolean;
|
|
28
|
+
href?: string;
|
|
29
|
+
action?: string;
|
|
30
|
+
onClick?: () => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface AbMenuProps {
|
|
34
|
+
className?: string;
|
|
35
|
+
id: string;
|
|
36
|
+
title?: string;
|
|
37
|
+
items: AbMenuItemData[];
|
|
38
|
+
isCancelable?: boolean;
|
|
39
|
+
hidden?: boolean;
|
|
40
|
+
isActive?: boolean;
|
|
41
|
+
onCancel?: () => void;
|
|
42
|
+
cancelLabel?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const AbMenu = forwardRef<HTMLMenuElement, AbMenuProps>(function AbMenu(
|
|
46
|
+
{
|
|
47
|
+
className,
|
|
48
|
+
id,
|
|
49
|
+
title,
|
|
50
|
+
items,
|
|
51
|
+
isCancelable = false,
|
|
52
|
+
hidden = false,
|
|
53
|
+
isActive = false,
|
|
54
|
+
onCancel,
|
|
55
|
+
cancelLabel = 'Cancel',
|
|
56
|
+
},
|
|
57
|
+
ref,
|
|
58
|
+
): ReactElement {
|
|
59
|
+
return (
|
|
60
|
+
<menu
|
|
61
|
+
ref={ref}
|
|
62
|
+
id={id}
|
|
63
|
+
hidden={hidden}
|
|
64
|
+
data-active={isActive ? 'true' : 'false'}
|
|
65
|
+
className={clsx('AbMenu', styles.abMenu, isActive && styles.isActive, className)}
|
|
66
|
+
>
|
|
67
|
+
{title ? <p className={styles.abMenuTitle}>{title}</p> : null}
|
|
68
|
+
<ul className={styles.abMenuList}>
|
|
69
|
+
{items.map((item) => {
|
|
70
|
+
const body = (
|
|
71
|
+
<>
|
|
72
|
+
{item.icon ? (
|
|
73
|
+
<span className={clsx('material-symbols-rounded', styles.abMenuIcon)} aria-hidden>
|
|
74
|
+
{item.icon}
|
|
75
|
+
</span>
|
|
76
|
+
) : null}
|
|
77
|
+
<span className={styles.abMenuLabel}>{item.label}</span>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
const itemClass = clsx(
|
|
81
|
+
styles.abMenuItem,
|
|
82
|
+
item.selected && styles.isSelected,
|
|
83
|
+
item.disabled && styles.isDisabled,
|
|
84
|
+
item.inactive && styles.isInactive,
|
|
85
|
+
);
|
|
86
|
+
if (item.href && !item.disabled) {
|
|
87
|
+
return (
|
|
88
|
+
<li key={item.id} className={itemClass} data-action={item.action}>
|
|
89
|
+
<Link href={item.href} className={styles.abMenuLink} onClick={item.onClick}>
|
|
90
|
+
{body}
|
|
91
|
+
</Link>
|
|
92
|
+
</li>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return (
|
|
96
|
+
<li key={item.id} className={itemClass} data-action={item.action}>
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
className={styles.abMenuButton}
|
|
100
|
+
disabled={item.disabled}
|
|
101
|
+
onClick={item.onClick}
|
|
102
|
+
>
|
|
103
|
+
{body}
|
|
104
|
+
</button>
|
|
105
|
+
</li>
|
|
106
|
+
);
|
|
107
|
+
})}
|
|
108
|
+
</ul>
|
|
109
|
+
{isCancelable ? (
|
|
110
|
+
<button type="button" className={styles.abMenuCancel} onClick={onCancel}>
|
|
111
|
+
{cancelLabel}
|
|
112
|
+
</button>
|
|
113
|
+
) : null}
|
|
114
|
+
</menu>
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export default AbMenu;
|
|
119
|
+
export { AbMenu };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
.abMenu {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0.5rem;
|
|
5
|
+
min-width: 12rem;
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0.75rem;
|
|
8
|
+
list-style: none;
|
|
9
|
+
border-radius: 0.75rem;
|
|
10
|
+
background: var(--ab-surface-container, #f3edf7);
|
|
11
|
+
color: var(--ab-on-surface, #1c1b1f);
|
|
12
|
+
box-shadow: 0 4px 16px color-mix(in srgb, #000 12%, transparent);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.isActive {
|
|
16
|
+
outline: 2px solid var(--ab-primary, #a67c52);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.abMenuTitle {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0 0.5rem;
|
|
22
|
+
font-size: 0.75rem;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
letter-spacing: 0.06em;
|
|
26
|
+
opacity: 0.7;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.abMenuList {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
gap: 0.125rem;
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 0;
|
|
35
|
+
list-style: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.abMenuItem {
|
|
39
|
+
margin: 0;
|
|
40
|
+
border-radius: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.abMenuLink,
|
|
44
|
+
.abMenuButton {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 0.75rem;
|
|
48
|
+
width: 100%;
|
|
49
|
+
padding: 0.625rem 0.75rem;
|
|
50
|
+
border: none;
|
|
51
|
+
border-radius: 0.5rem;
|
|
52
|
+
background: transparent;
|
|
53
|
+
color: inherit;
|
|
54
|
+
font: inherit;
|
|
55
|
+
text-align: left;
|
|
56
|
+
text-decoration: none;
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.abMenuLink:hover,
|
|
61
|
+
.abMenuButton:hover {
|
|
62
|
+
background: color-mix(in srgb, var(--ab-on-surface, #1c1b1f) 8%, transparent);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.abMenuIcon {
|
|
66
|
+
font-size: 1.25rem;
|
|
67
|
+
line-height: 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.abMenuLabel {
|
|
71
|
+
flex: 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.isSelected .abMenuLink,
|
|
75
|
+
.isSelected .abMenuButton {
|
|
76
|
+
background: color-mix(in srgb, var(--ab-primary, #a67c52) 16%, transparent);
|
|
77
|
+
font-weight: 600;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.isDisabled {
|
|
81
|
+
opacity: 0.5;
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.isInactive {
|
|
86
|
+
opacity: 0.65;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.abMenuCancel {
|
|
90
|
+
margin-top: 0.25rem;
|
|
91
|
+
padding: 0.625rem;
|
|
92
|
+
border: none;
|
|
93
|
+
border-radius: 0.5rem;
|
|
94
|
+
background: transparent;
|
|
95
|
+
color: var(--ab-primary, #a67c52);
|
|
96
|
+
font: inherit;
|
|
97
|
+
font-weight: 600;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* @project: ab-nextjs-components
|
|
9
|
+
* @name: AbName - Client (port of lyd-name)
|
|
10
|
+
* @file: ab-name/index.tsx
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use client';
|
|
14
|
+
|
|
15
|
+
import type { ReactElement } from 'react';
|
|
16
|
+
import clsx from 'clsx';
|
|
17
|
+
import styles from './styles.module.css';
|
|
18
|
+
|
|
19
|
+
export interface AbNameProps {
|
|
20
|
+
type?: 'light' | 'regular' | 'bold' | 'black';
|
|
21
|
+
className?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const AbName = ({
|
|
27
|
+
type = 'regular',
|
|
28
|
+
className,
|
|
29
|
+
label = 'abElements',
|
|
30
|
+
onClick,
|
|
31
|
+
}: AbNameProps): ReactElement => {
|
|
32
|
+
const first = label.slice(0, 2);
|
|
33
|
+
const rest = label.slice(2);
|
|
34
|
+
return (
|
|
35
|
+
<span
|
|
36
|
+
data-type={type}
|
|
37
|
+
className={clsx('AbName', styles.abName, className)}
|
|
38
|
+
onClick={onClick}
|
|
39
|
+
role={onClick ? 'button' : undefined}
|
|
40
|
+
tabIndex={onClick ? 0 : undefined}
|
|
41
|
+
>
|
|
42
|
+
<span className={styles.abNameAb}>{first}</span>
|
|
43
|
+
<span className={styles.abNameRest}>{rest}</span>
|
|
44
|
+
</span>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default AbName;
|
|
49
|
+
export { AbName };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.abName {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: baseline;
|
|
4
|
+
font-family: ui-serif, Georgia, serif;
|
|
5
|
+
letter-spacing: -0.02em;
|
|
6
|
+
cursor: default;
|
|
7
|
+
user-select: none;
|
|
8
|
+
}
|
|
9
|
+
.abName[data-type='light'] { font-weight: 300; }
|
|
10
|
+
.abName[data-type='regular'] { font-weight: 400; }
|
|
11
|
+
.abName[data-type='bold'] { font-weight: 700; }
|
|
12
|
+
.abName[data-type='black'] { font-weight: 900; }
|
|
13
|
+
.abNameAb { color: var(--ab-primary, #6750a4); }
|
|
14
|
+
.abNameRest { opacity: 0.85; }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* @project: ab-nextjs-components
|
|
9
|
+
* @name: AbNavbar - Client (port of lyd-navbar; providers stripped)
|
|
10
|
+
* @file: ab-navbar/index.tsx
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use client';
|
|
14
|
+
|
|
15
|
+
import type { ReactElement } from 'react';
|
|
16
|
+
import Link from 'next/link';
|
|
17
|
+
import { usePathname } from 'next/navigation';
|
|
18
|
+
import clsx from 'clsx';
|
|
19
|
+
import styles from './styles.module.css';
|
|
20
|
+
|
|
21
|
+
export type AbNavbarLink = {
|
|
22
|
+
href: string;
|
|
23
|
+
icon: string;
|
|
24
|
+
value: string;
|
|
25
|
+
label: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export interface AbNavbarProps {
|
|
29
|
+
className?: string;
|
|
30
|
+
type?: 'customer' | 'admin';
|
|
31
|
+
page?: string;
|
|
32
|
+
links?: AbNavbarLink[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const AbNavbar = ({
|
|
36
|
+
className,
|
|
37
|
+
type = 'customer',
|
|
38
|
+
page,
|
|
39
|
+
links = [],
|
|
40
|
+
}: AbNavbarProps): ReactElement => {
|
|
41
|
+
const pathname = usePathname() ?? '';
|
|
42
|
+
return (
|
|
43
|
+
<nav data-type={type} className={clsx('AbNavbar', styles.abNavbar, className)} aria-label="Primary">
|
|
44
|
+
<ul className={styles.abNavbarList}>
|
|
45
|
+
{links.map((link) => {
|
|
46
|
+
const active = page ? page === link.value : pathname === link.href || pathname.startsWith(`${link.href}/`);
|
|
47
|
+
return (
|
|
48
|
+
<li key={link.value}>
|
|
49
|
+
<Link
|
|
50
|
+
href={link.href}
|
|
51
|
+
data-active={active ? 'true' : 'false'}
|
|
52
|
+
className={styles.abNavbarLink}
|
|
53
|
+
>
|
|
54
|
+
<span className={clsx('material-symbols-rounded', styles.abNavbarIcon)} aria-hidden>
|
|
55
|
+
{link.icon}
|
|
56
|
+
</span>
|
|
57
|
+
<span>{link.label}</span>
|
|
58
|
+
</Link>
|
|
59
|
+
</li>
|
|
60
|
+
);
|
|
61
|
+
})}
|
|
62
|
+
</ul>
|
|
63
|
+
</nav>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default AbNavbar;
|
|
68
|
+
export { AbNavbar };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.abNavbar {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 0.5rem;
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: 0.5rem 0.75rem;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
.abNavbarList {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 0.25rem;
|
|
13
|
+
list-style: none;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
overflow-x: auto;
|
|
17
|
+
}
|
|
18
|
+
.abNavbarLink {
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 0.35rem;
|
|
22
|
+
padding: 0.45rem 0.75rem;
|
|
23
|
+
border-radius: 9999px;
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
color: inherit;
|
|
26
|
+
opacity: 0.7;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
font-size: 0.875rem;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
}
|
|
31
|
+
.abNavbarLink[data-active='true'] {
|
|
32
|
+
opacity: 1;
|
|
33
|
+
background: color-mix(in srgb, var(--ab-primary, #6750a4) 14%, transparent);
|
|
34
|
+
}
|
|
35
|
+
.abNavbarIcon { font-size: 1.15rem; }
|