ab-nextjs-components 0.1.7 β 0.1.9
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 +18 -0
- package/README.md +13 -0
- package/ab-linear-progress/index.tsx +125 -0
- package/ab-linear-progress/styles.module.css +121 -0
- package/ab-logo/index.tsx +88 -30
- package/ab-logo/styles.module.css +79 -11
- package/ab-splash/csp.d.ts +54 -0
- package/ab-splash/csp.mjs +82 -0
- package/ab-splash/csp.ts +60 -0
- package/ab-splash/gate.ts +216 -0
- package/ab-splash/index.tsx +138 -0
- package/ab-splash/styles.module.css +106 -0
- package/assets/logos/ab-logo.svg +1 -0
- package/assets/spinners/12-dots-scale-rotate.svg +1 -0
- package/assets/spinners/3-dots-scale.svg +1 -0
- package/assets/spinners/LICENSE +20 -0
- package/css/chrome-mq.css +121 -0
- package/css/dialog.css +248 -0
- package/css/doodle.css +41 -0
- package/css/logo.css +52 -0
- package/css/spinner.css +28 -0
- package/css/toast.css +70 -0
- package/index.ts +6 -0
- package/package.json +25 -6
- package/server/ab-logo/index.tsx +88 -29
- package/server/ab-logo/styles.module.css +79 -11
- package/styles.css +14 -0
- package/types/css.d.ts +43 -0
- package/types/index.d.ts +2 -0
package/server/ab-logo/index.tsx
CHANGED
|
@@ -27,69 +27,128 @@
|
|
|
27
27
|
* @project: ab-nextjs-components
|
|
28
28
|
* @name: AbLogo - Server
|
|
29
29
|
* @file: server/ab-logo/index.tsx
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
30
31
|
*/
|
|
31
32
|
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more π!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// π₯οΈ server build (no 'use client'; the client twin lives in `ab-logo`)
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
// π§© React types only
|
|
42
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
43
|
+
// π§΅ class-name joiner
|
|
34
44
|
import clsx from 'clsx';
|
|
45
|
+
// π¨ package-shipped CSS module (Tailwind-independent)
|
|
35
46
|
import styles from './styles.module.css';
|
|
36
47
|
|
|
48
|
+
// π
°οΈ the four logo looks
|
|
37
49
|
export type AbLogoType = 'contained' | 'outlined' | 'hollow' | 'naked';
|
|
38
50
|
|
|
51
|
+
// π public props
|
|
39
52
|
export interface AbLogoProps {
|
|
53
|
+
// π
°οΈ look of the mark (default: naked)
|
|
40
54
|
type?: AbLogoType;
|
|
55
|
+
// π·οΈ consumer classes
|
|
41
56
|
className?: string;
|
|
42
|
-
/** Optional image src
|
|
57
|
+
/** πΌοΈ Optional image src. Defaults to the Ab mark shipped in this package (data URI). */
|
|
43
58
|
src?: string;
|
|
44
|
-
/** Optional CSS mask value for outlined/hollow/naked. */
|
|
59
|
+
/** π Optional CSS mask value for outlined/hollow/naked. */
|
|
45
60
|
mask?: string;
|
|
61
|
+
// π£οΈ accessible name of the mark
|
|
46
62
|
alt?: string;
|
|
63
|
+
// π mark size (or wordmark font-size when `wordmark` is on)
|
|
47
64
|
size?: number | string;
|
|
65
|
+
/** π€ Show the wordmark next to the mark: `true` β "Elements", or any string. */
|
|
66
|
+
wordmark?: boolean | string;
|
|
67
|
+
/** π¨ Mark + wordmark color (CSS color). Defaults to bronze (light) / #FFF8F5 (dark). */
|
|
68
|
+
color?: string;
|
|
48
69
|
}
|
|
49
70
|
|
|
50
|
-
/** Inlined Ab logo shipped with this package (also at `ab-logo/ab-logo.svg`). */
|
|
51
|
-
const
|
|
71
|
+
/** π
°οΈ Inlined Ab logo shipped with this package (also at `ab-logo/ab-logo.svg`). */
|
|
72
|
+
export const AB_LOGO_DEFAULT_SRC = 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xml%3Aspace%3D%22preserve%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23A67C52%22%20d%3D%22m1.8%2020.5%209.3-17v17zM22.2%207.7l-9.3-4.2v17l9.3-4.2-4.7-4.3z%22/%3E%3Cpath%20d%3D%22m12.9%2020.5%209.3-4.2-9.3-8.6z%22%20opacity%3D%22.1%22/%3E%3C/svg%3E';
|
|
73
|
+
|
|
74
|
+
// π€ the default wordmark text (a brand name, never translated)
|
|
75
|
+
export const AB_LOGO_DEFAULT_WORDMARK = 'Elements';
|
|
76
|
+
|
|
77
|
+
// π number β px, string β as is
|
|
78
|
+
const toCssSize = (size?: number | string): string | undefined =>
|
|
79
|
+
size != null ? (typeof size === 'number' ? `${size}px` : size) : undefined;
|
|
52
80
|
|
|
53
81
|
const AbLogo = ({
|
|
54
|
-
type = 'naked',
|
|
55
|
-
className,
|
|
56
|
-
src,
|
|
57
|
-
mask,
|
|
58
|
-
alt = 'Ab',
|
|
59
|
-
size,
|
|
82
|
+
type = 'naked', // π
°οΈ naked by default
|
|
83
|
+
className, // π·οΈ consumer classes
|
|
84
|
+
src, // πΌοΈ optional image
|
|
85
|
+
mask, // π optional mask
|
|
86
|
+
alt = 'Ab', // π£οΈ default name
|
|
87
|
+
size, // π optional size
|
|
88
|
+
wordmark, // π€ optional wordmark
|
|
89
|
+
color, // π¨ optional color
|
|
60
90
|
}: AbLogoProps): ReactElement => {
|
|
61
|
-
|
|
91
|
+
// π normalized size
|
|
92
|
+
const dim = toCssSize(size);
|
|
93
|
+
// π€ wordmark text (null = no wordmark)
|
|
94
|
+
const text = wordmark === true ? AB_LOGO_DEFAULT_WORDMARK : typeof wordmark === 'string' && wordmark ? wordmark : null;
|
|
95
|
+
// π¨ color as a custom property consumed by the CSS module
|
|
96
|
+
const colorVar = (color ? { '--ab-logo-color': color } : {}) as CSSProperties;
|
|
62
97
|
|
|
98
|
+
// πΌοΈ build the mark
|
|
99
|
+
let mark: ReactElement;
|
|
63
100
|
if (type === 'contained') {
|
|
64
|
-
|
|
101
|
+
// πΌοΈ contained = a real <img>
|
|
102
|
+
mark = (
|
|
103
|
+
// eslint-disable-next-line @next/next/no-img-element -- πΌοΈ the default src is an inline data-URI SVG (nothing for next/image to optimize), and this package must not require next/image's loader config in consumer apps
|
|
65
104
|
<img
|
|
66
|
-
className={clsx('AbLogo', 'app-logo', styles.abLogoContained,
|
|
67
|
-
src={src ??
|
|
68
|
-
alt={alt}
|
|
105
|
+
className={clsx(!text && ['AbLogo', 'app-logo', className], styles.abLogoContained, text && styles.abLogo__mark)}
|
|
106
|
+
src={src ?? AB_LOGO_DEFAULT_SRC}
|
|
107
|
+
alt={text ? '' : alt}
|
|
108
|
+
aria-hidden={text ? true : undefined}
|
|
69
109
|
data-type="contained"
|
|
70
|
-
style={dim ? { width: dim, height: dim } : undefined}
|
|
110
|
+
style={!text && dim ? { width: dim, height: dim } : undefined}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
} else {
|
|
114
|
+
// π explicit mask/src wins; otherwise the CSS module masks with `--app-logo-url` or the shipped mark (no brown square β
)
|
|
115
|
+
const maskValue = mask ?? (src ? `url('${src}') no-repeat 50% 50%` : undefined);
|
|
116
|
+
mark = (
|
|
117
|
+
<span
|
|
118
|
+
className={clsx(!text && ['AbLogo', 'app-logo', className], styles.abLogo, text && styles.abLogo__mark)}
|
|
119
|
+
data-type={type}
|
|
120
|
+
role={text ? undefined : 'img'}
|
|
121
|
+
aria-label={text ? undefined : alt}
|
|
122
|
+
aria-hidden={text ? true : undefined}
|
|
123
|
+
style={{
|
|
124
|
+
...(!text ? colorVar : {}), // π¨ color (standalone mark only; lockup sets it on the wrapper)
|
|
125
|
+
...(!text && dim ? { width: dim, height: dim } : {}), // π size
|
|
126
|
+
...(maskValue ? { WebkitMask: maskValue, mask: maskValue, WebkitMaskSize: 'cover', maskSize: 'cover' } : {}), // π custom mask
|
|
127
|
+
}}
|
|
71
128
|
/>
|
|
72
129
|
);
|
|
73
130
|
}
|
|
74
131
|
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
|
|
132
|
+
// π
°οΈ no wordmark β just the mark (unchanged API)
|
|
133
|
+
if (!text) return mark;
|
|
134
|
+
|
|
135
|
+
// π€ lockup: mark + wordmark, one accessible image
|
|
78
136
|
return (
|
|
79
137
|
<span
|
|
80
|
-
className={clsx('AbLogo', '
|
|
138
|
+
className={clsx('AbLogo', 'AbLogo--wordmark', styles.abLogo__lockup, className)}
|
|
81
139
|
data-type={type}
|
|
82
140
|
role="img"
|
|
83
|
-
aria-label={alt}
|
|
84
|
-
style={{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}}
|
|
90
|
-
|
|
141
|
+
aria-label={`${alt} ${text}`.trim()}
|
|
142
|
+
style={{ ...colorVar, ...(dim ? { fontSize: dim } : {}) }}
|
|
143
|
+
>
|
|
144
|
+
{/* π
°οΈ the mark */}
|
|
145
|
+
{mark}
|
|
146
|
+
{/* π€ the wordmark β Quicksand Bold from ab-nextjs-fonts */}
|
|
147
|
+
<span className={clsx('font-quicksand-bold', styles.abLogo__wordmark)} aria-hidden="true">{text}</span>
|
|
148
|
+
</span>
|
|
91
149
|
);
|
|
92
150
|
};
|
|
93
151
|
|
|
152
|
+
// π¦ exports
|
|
94
153
|
export default AbLogo;
|
|
95
154
|
export { AbLogo };
|
|
@@ -4,7 +4,31 @@
|
|
|
4
4
|
* ab-nextjs-components
|
|
5
5
|
* ~~~~~~~~~~~~
|
|
6
6
|
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
-
*
|
|
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 - Component Stylesheet (plain CSS, Tailwind-independent)
|
|
29
|
+
* @file: server/ab-logo/styles.module.css
|
|
30
|
+
* @type: CSS Module
|
|
31
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
8
32
|
*/
|
|
9
33
|
|
|
10
34
|
/*
|
|
@@ -13,18 +37,62 @@
|
|
|
13
37
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
14
38
|
*/
|
|
15
39
|
|
|
40
|
+
/* π
°οΈ masked mark (naked / outlined / hollow) */
|
|
16
41
|
.abLogo {
|
|
17
|
-
display: block;
|
|
18
|
-
position: relative;
|
|
19
|
-
width: 1.5rem;
|
|
20
|
-
height: 1.5rem;
|
|
21
|
-
|
|
42
|
+
display: block; /* π§± block box */
|
|
43
|
+
position: relative; /* π positioning context */
|
|
44
|
+
width: 1.5rem; /* βοΈ default size */
|
|
45
|
+
height: 1.5rem; /* βοΈ default size */
|
|
46
|
+
/* π¨ bronze by default; `--app-logo-color` (chrome) or `--ab-logo-color` (prop) override */
|
|
47
|
+
background-color: var(--app-logo-color, var(--ab-logo-color, #A67C52));
|
|
48
|
+
/* π the shipped Ab mark as mask β no brown square without chrome CSS β
*/
|
|
49
|
+
-webkit-mask: var(--app-logo-url, url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xml%3Aspace%3D%22preserve%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23A67C52%22%20d%3D%22m1.8%2020.5%209.3-17v17zM22.2%207.7l-9.3-4.2v17l9.3-4.2-4.7-4.3z%22/%3E%3Cpath%20d%3D%22m12.9%2020.5%209.3-4.2-9.3-8.6z%22%20opacity%3D%22.1%22/%3E%3C/svg%3E")) no-repeat 50% 50%;
|
|
50
|
+
mask: var(--app-logo-url, url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xml%3Aspace%3D%22preserve%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23A67C52%22%20d%3D%22m1.8%2020.5%209.3-17v17zM22.2%207.7l-9.3-4.2v17l9.3-4.2-4.7-4.3z%22/%3E%3Cpath%20d%3D%22m12.9%2020.5%209.3-4.2-9.3-8.6z%22%20opacity%3D%22.1%22/%3E%3C/svg%3E")) no-repeat 50% 50%;
|
|
51
|
+
-webkit-mask-size: contain; /* π keep proportions */
|
|
52
|
+
mask-size: contain; /* π keep proportions */
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* π dark: light mark on dark surfaces */
|
|
56
|
+
:global(html.dark) .abLogo:not(.abLogo__mark) {
|
|
57
|
+
background-color: var(--app-logo-color, var(--ab-logo-color, #FFF8F5));
|
|
22
58
|
}
|
|
23
59
|
|
|
60
|
+
/* πΌοΈ contained mark (a real <img>) */
|
|
24
61
|
.abLogoContained {
|
|
25
|
-
display: block;
|
|
26
|
-
position: relative;
|
|
27
|
-
width: 1.5rem;
|
|
28
|
-
height: 1.5rem;
|
|
29
|
-
object-fit: contain;
|
|
62
|
+
display: block; /* π§± block box */
|
|
63
|
+
position: relative; /* π positioning context */
|
|
64
|
+
width: 1.5rem; /* βοΈ default size */
|
|
65
|
+
height: 1.5rem; /* βοΈ default size */
|
|
66
|
+
object-fit: contain; /* π keep proportions */
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* π€ lockup = mark + wordmark */
|
|
70
|
+
.abLogo__lockup {
|
|
71
|
+
display: inline-flex; /* β‘οΈ one row */
|
|
72
|
+
align-items: center; /* βοΈ centered */
|
|
73
|
+
gap: 0.28em; /* βοΈ gap scales with the text */
|
|
74
|
+
font-size: 2rem; /* π default lockup size (override with `size`) */
|
|
75
|
+
line-height: 1; /* π tight */
|
|
76
|
+
color: var(--ab-logo-color, #A67C52); /* π¨ bronze */
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* π dark lockup */
|
|
80
|
+
:global(html.dark) .abLogo__lockup {
|
|
81
|
+
color: var(--ab-logo-color, #FFF8F5);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* π
°οΈ the mark inside a lockup follows the text size & color */
|
|
85
|
+
.abLogo__mark {
|
|
86
|
+
width: 1.15em; /* βοΈ β cap height + descender, as in the splash mock */
|
|
87
|
+
height: 1.15em; /* βοΈ square */
|
|
88
|
+
flex: none; /* π« never shrink */
|
|
89
|
+
background-color: currentColor; /* π¨ same as the wordmark */
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* π€ the wordmark β Quicksand Bold (font files ship with ab-nextjs-fonts/quicksand/styles.css) */
|
|
93
|
+
.abLogo__wordmark {
|
|
94
|
+
font-family: 'Quicksand-Bold', 'Quicksand', ui-rounded, system-ui, sans-serif; /* π€ */
|
|
95
|
+
font-weight: 700; /* πͺ bold */
|
|
96
|
+
letter-spacing: 0.01em; /* βοΈ as in the mock */
|
|
97
|
+
white-space: nowrap; /* π« no wrap */
|
|
30
98
|
}
|
package/styles.css
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ab-nextjs-components β component chrome (dialog, toast, logo, spinner, doodle)
|
|
3
|
+
*
|
|
4
|
+
* Import after ab-nextjs-theme/styles.css:
|
|
5
|
+
* @import "ab-nextjs-theme/styles.css";
|
|
6
|
+
* @import "ab-nextjs-components/styles.css";
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
@import "./css/dialog.css";
|
|
10
|
+
@import "./css/toast.css";
|
|
11
|
+
@import "./css/logo.css";
|
|
12
|
+
@import "./css/spinner.css";
|
|
13
|
+
@import "./css/doodle.css";
|
|
14
|
+
@import "./css/chrome-mq.css";
|
package/types/css.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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: CSS module typings (for `tsc --noEmit` outside Next.js)
|
|
29
|
+
* @file: types/css.d.ts
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more π!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// π¨ every `*.module.css` import is a readonly class-name map
|
|
40
|
+
declare module '*.module.css' {
|
|
41
|
+
const classes: { readonly [key: string]: string } // πΊοΈ class map
|
|
42
|
+
export default classes // π¦ default export
|
|
43
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export default abComponents;
|
|
|
17
17
|
|
|
18
18
|
export { default as AbIcon } from '../ab-icon/index.tsx';
|
|
19
19
|
export { default as AbLogo } from '../ab-logo/index.tsx';
|
|
20
|
+
// πΆ progress bar (ported from core)
|
|
21
|
+
export { default as AbLinearProgress } from '../ab-linear-progress/index.tsx';
|
|
20
22
|
export { default as AbButton } from '../ab-button/index.tsx';
|
|
21
23
|
export { default as AbIconButton } from '../ab-icon-button/index.tsx';
|
|
22
24
|
export { default as AbInput } from '../ab-input/index.tsx';
|