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.
@@ -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
- import type { ReactElement } from 'react';
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 (contained). Defaults to the Ab logo shipped in this package (data URI). */
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 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';
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
- const dim = size != null ? (typeof size === 'number' ? `${size}px` : size) : undefined;
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
- return (
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, className)}
67
- src={src ?? DEFAULT_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
- // With no `mask`/`src`, leave the mask to `ab-nextjs-theme` (`--app-logo-url` / `.app-logo`).
76
- // When `mask` or `src` is set, apply it inline (src becomes a CSS mask url).
77
- const maskValue = mask ?? (src ? `url('${src}') no-repeat 50% 50%` : undefined);
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', 'app-logo', styles.abLogo, className)}
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
- ...(dim ? { width: dim, height: dim } : {}),
86
- ...(maskValue
87
- ? { WebkitMask: maskValue, mask: maskValue, WebkitMaskSize: 'cover', maskSize: 'cover' }
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
- * Plain CSS modules β€” no Tailwind Tailwind apply (Turbopack-safe).
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
- background-color: var(--app-logo-color, #a67c52);
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';