ab-nextjs-components 0.1.8 โ†’ 0.1.10

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/ab-brand/index.tsx +30 -1
  3. package/ab-brand/styles.module.css +40 -1
  4. package/ab-button/helpers.ts +90 -0
  5. package/ab-button/index.tsx +164 -87
  6. package/ab-button/styles.module.css +79 -1
  7. package/ab-carousel/helpers.ts +146 -0
  8. package/ab-carousel/index.tsx +643 -0
  9. package/ab-carousel/styles.module.css +206 -0
  10. package/ab-chip/index.tsx +75 -0
  11. package/ab-chip/styles.module.css +87 -0
  12. package/ab-collapsible/index.tsx +30 -1
  13. package/ab-collapsible/styles.module.css +40 -1
  14. package/ab-flow-diagram/helpers.ts +77 -0
  15. package/ab-flow-diagram/index.tsx +141 -0
  16. package/ab-flow-diagram/styles.module.css +141 -0
  17. package/ab-icon/builtin.ts +61 -0
  18. package/ab-icon/helpers.ts +102 -0
  19. package/ab-icon/index.tsx +77 -16
  20. package/ab-icon/styles.module.css +53 -9
  21. package/ab-icon-button/index.tsx +110 -46
  22. package/ab-icon-button/styles.module.css +28 -10
  23. package/ab-install-snippet/helpers.ts +62 -0
  24. package/ab-install-snippet/index.tsx +170 -0
  25. package/ab-install-snippet/styles.module.css +104 -0
  26. package/ab-like-button/index.tsx +33 -1
  27. package/ab-like-button/styles.module.css +41 -6
  28. package/ab-linear-progress/index.tsx +129 -0
  29. package/ab-linear-progress/styles.module.css +105 -0
  30. package/ab-locale-switcher/index.tsx +213 -0
  31. package/ab-locale-switcher/styles.module.css +127 -0
  32. package/ab-logo/index.tsx +88 -30
  33. package/ab-logo/styles.module.css +79 -11
  34. package/ab-pill/index.tsx +74 -0
  35. package/ab-progress-chips/index.tsx +30 -1
  36. package/ab-progress-chips/styles.module.css +40 -1
  37. package/ab-searchbar/index.tsx +33 -2
  38. package/ab-searchbar/styles.module.css +41 -5
  39. package/ab-splash/csp.d.ts +54 -0
  40. package/ab-splash/csp.mjs +82 -0
  41. package/ab-splash/csp.ts +60 -0
  42. package/ab-splash/gate.ts +216 -0
  43. package/ab-splash/index.tsx +140 -0
  44. package/ab-splash/styles.module.css +103 -0
  45. package/ab-theme-toggle/index.tsx +188 -0
  46. package/ab-theme-toggle/styles.module.css +89 -0
  47. package/css/dialog.css +38 -3
  48. package/index.ts +47 -0
  49. package/package.json +46 -18
  50. package/server/ab-brand/index.tsx +29 -1
  51. package/server/ab-brand/styles.module.css +40 -1
  52. package/server/ab-button/index.tsx +96 -79
  53. package/server/ab-button/styles.module.css +79 -1
  54. package/server/ab-icon/index.tsx +68 -16
  55. package/server/ab-icon/styles.module.css +53 -9
  56. package/server/ab-logo/index.tsx +88 -29
  57. package/server/ab-logo/styles.module.css +79 -11
  58. package/types/css.d.ts +43 -0
  59. package/types/index.d.ts +2 -0
@@ -5,9 +5,35 @@
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
+ *
8
26
  * @project: ab-nextjs-components
9
27
  * @name: AbBrand - Server (port of lyd-brand)
10
28
  * @file: server/ab-brand/index.tsx
29
+ * @type: TypeScript (React)
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11
37
  */
12
38
 
13
39
 
@@ -16,6 +42,8 @@ import Link from 'next/link';
16
42
  import Image from 'next/image';
17
43
  import clsx from 'clsx';
18
44
  import styles from './styles.module.css';
45
+ import { AB_MOTION } from 'ab-nextjs-animations/motion'; // ๐ŸŽฌ transition class names (ab-nextjs-animations >= 0.2.4)
46
+ import 'ab-nextjs-animations/motion/styles.css'; // ๐ŸŽจ .ab-motion-*
19
47
 
20
48
  export interface AbBrandProps {
21
49
  className?: string;
@@ -70,7 +98,7 @@ const AbBrand = ({
70
98
  style={style}
71
99
  >
72
100
  <div className={styles.abBrandImageWrap}>
73
- <Image className={styles.abBrandImage} src={image} alt={imageAlt ?? name} width={640} height={360} unoptimized />
101
+ <Image className={clsx(styles.abBrandImage, AB_MOTION.transform)} src={image} alt={imageAlt ?? name} width={640} height={360} unoptimized />
74
102
  </div>
75
103
  <div className={styles.abBrandMeta}>
76
104
  <Image className={styles.abBrandLogo} src={logo} alt={logoAlt ?? shortName} width={40} height={40} unoptimized />
@@ -1,3 +1,42 @@
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
+ * @project: ab-nextjs-components
27
+ * @name: ab-brand - styles
28
+ * @file: server/ab-brand/styles.module.css
29
+ * @type: CSS Module
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+
1
40
  .abBrand {
2
41
  position: relative;
3
42
  display: flex;
@@ -28,7 +67,7 @@
28
67
  object-fit: cover;
29
68
  width: 100%;
30
69
  height: 100%;
31
- transition: transform 0.35s ease;
70
+ --ab-motion-duration: 350ms; /* ๐Ÿ” zoom tween = .ab-motion-transform (ab-nextjs-animations) */
32
71
  }
33
72
  .abBrandLogo {
34
73
  width: 2.5rem;
@@ -22,117 +22,133 @@
22
22
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
-
26
25
  *
27
26
  * @project: ab-nextjs-components
28
27
  * @name: AbButton - Server (no onClick; hrefโ†’<a> or submit)
29
28
  * @file: server/ab-button/index.tsx
29
+ * @type: Server component โ€” G22 parity with the client twin
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30
37
  */
31
38
 
39
+ // โš›๏ธ types
32
40
  import type { CSSProperties, ReactElement, ReactNode } from 'react';
41
+ // ๐Ÿงต class joiner
33
42
  import clsx from 'clsx';
43
+ // ๐ŸŽจ styles (server copy)
34
44
  import styles from './styles.module.css';
45
+ // ๐Ÿงฎ the SAME rules as the client twin
46
+ import {
47
+ getAbButtonDisabledMode,
48
+ getAbButtonSrReason,
49
+ type AbButtonBadgeTone,
50
+ type AbButtonColor,
51
+ type AbButtonType,
52
+ } from '../../ab-button/helpers';
35
53
 
36
- export type AbButtonType = 'contained' | 'outlined' | 'text';
37
- export type AbButtonColor = 'primary' | 'secondary' | 'tertiary' | 'white' | 'black';
54
+ // ๐Ÿ“ฆ shared types
55
+ export type { AbButtonBadgeTone, AbButtonColor, AbButtonType, AbButtonDisabledMode } from '../../ab-button/helpers';
38
56
 
57
+ // โš™๏ธ props (no onClick on the server)
39
58
  export interface AbButtonProps {
40
- id?: string;
41
- type?: AbButtonType;
42
- htmlType?: 'button' | 'submit' | 'reset';
43
- className?: string;
44
- hidden?: boolean;
45
- style?: CSSProperties;
46
- rounded?: boolean;
47
- raised?: boolean;
48
- shrinks?: boolean;
49
- expands?: boolean;
50
- withIcon?: boolean;
51
- disabled?: boolean;
52
- iconPosition?: 'left' | 'right';
53
- label: string;
54
- icon?: string;
55
- color?: AbButtonColor;
56
- href?: string;
57
- children?: ReactNode;
59
+ id?: string; // ๐Ÿ†”
60
+ type?: AbButtonType; // ๐ŸŽจ
61
+ htmlType?: 'button' | 'submit' | 'reset'; // ๐Ÿงพ
62
+ className?: string; // ๐Ÿท๏ธ
63
+ hidden?: boolean; // ๐Ÿ™ˆ
64
+ style?: CSSProperties; // ๐ŸŽจ
65
+ rounded?: boolean; // ๐Ÿ’Š
66
+ raised?: boolean; // ๐Ÿ”๏ธ
67
+ shrinks?: boolean; // ๐Ÿค
68
+ expands?: boolean; // ๐Ÿ”
69
+ withIcon?: boolean; // ๐Ÿ”ฃ
70
+ disabled?: boolean; // ๐Ÿšซ
71
+ iconPosition?: 'left' | 'right'; // โ†”๏ธ
72
+ label: string; // ๐Ÿท๏ธ
73
+ icon?: string; // ๐Ÿ”ฃ
74
+ color?: AbButtonColor; // ๐ŸŽจ
75
+ href?: string; // ๐Ÿ”—
76
+ children?: ReactNode; // ๐Ÿงฉ
77
+ startIcon?: ReactNode; // ๐Ÿ–ผ๏ธ G22
78
+ endIcon?: ReactNode; // ๐Ÿ–ผ๏ธ G22
79
+ badge?: ReactNode; // ๐Ÿท๏ธ G22
80
+ badgeTone?: AbButtonBadgeTone; // ๐ŸŽจ G22
81
+ disabledReason?: string; // ๐Ÿ’ฌ G22
82
+ focusableWhenDisabled?: boolean; // โŒจ๏ธ G22
58
83
  }
59
84
 
60
- /** Server AbButton โ€” no onClick. Use href for links or htmlType for form submit. */
85
+ /** ๐Ÿ–ฅ๏ธ Server AbButton: no onClick. Use href for links or htmlType for form submit. No-JS safe. */
61
86
  const AbButton = ({
62
- id,
63
- type = 'contained',
64
- htmlType = 'button',
65
- className,
66
- hidden = false,
67
- style,
68
- rounded = true,
69
- raised = false,
70
- shrinks = false,
71
- expands = false,
72
- withIcon = false,
73
- disabled = false,
74
- iconPosition = 'left',
75
- label,
76
- icon,
77
- color = 'primary',
78
- href,
79
- children,
87
+ id, type = 'contained', htmlType = 'button', className, hidden = false, style, rounded = true, raised = false,
88
+ shrinks = false, expands = false, withIcon = false, disabled = false, iconPosition = 'left', label, icon,
89
+ color = 'primary', href, children, startIcon, endIcon, badge, badgeTone = 'neutral', disabledReason, focusableWhenDisabled,
80
90
  }: AbButtonProps): ReactElement => {
81
- const classNames = clsx(
82
- 'AbButton',
83
- styles.abButton,
84
- className,
85
- rounded && styles.abButtonRounded,
86
- disabled && styles.isDisabled,
87
- );
91
+ // ๐Ÿšฆ shared disabled rules
92
+ const mode = getAbButtonDisabledMode({ disabled, badge, disabledReason, focusableWhenDisabled });
93
+ // ๐Ÿ’ฌ hidden reason
94
+ const srReason = getAbButtonSrReason({ disabled, disabledReason });
88
95
 
96
+ // ๐Ÿท๏ธ classes
97
+ const classNames = clsx('AbButton', styles.abButton, className, rounded && styles.abButtonRounded, mode === 'native' && styles.isDisabled);
98
+
99
+ // ๐Ÿ—‚๏ธ data attributes
89
100
  const dataAttrs = {
90
- 'data-type': type,
91
- 'data-raised': raised ? 'true' : 'false',
92
- 'data-shrinks': shrinks ? 'true' : 'false',
93
- 'data-expands': expands ? 'true' : 'false',
94
- 'data-rounded': rounded ? 'true' : 'false',
95
- 'data-iconpos': iconPosition,
96
- 'data-color': color,
101
+ 'data-type': type, // ๐ŸŽจ
102
+ 'data-raised': raised ? 'true' : 'false', // ๐Ÿ”๏ธ
103
+ 'data-shrinks': shrinks ? 'true' : 'false', // ๐Ÿค
104
+ 'data-expands': expands ? 'true' : 'false', // ๐Ÿ”
105
+ 'data-rounded': rounded ? 'true' : 'false', // ๐Ÿ’Š
106
+ 'data-iconpos': iconPosition, // โ†”๏ธ
107
+ 'data-color': color, // ๐ŸŽจ
108
+ 'data-disabled-mode': mode, // ๐Ÿšฆ
97
109
  } as const;
98
110
 
111
+ // ๐Ÿ”ฃ legacy icon (decorative)
112
+ const legacyIcon = withIcon && icon ? <span className={clsx('material-symbols-rounded', 'icon')} aria-hidden="true">{icon}</span> : null;
113
+
114
+ // ๐Ÿงฑ content (same order as the client twin)
99
115
  const content = (
100
116
  <>
101
- {withIcon && iconPosition === 'left' && icon ? (
102
- <span className={clsx('material-symbols-rounded', 'icon')}>{icon}</span>
103
- ) : null}
117
+ {iconPosition === 'left' ? legacyIcon : null}
118
+ {startIcon ? <span className={styles.abButtonSlot} aria-hidden="true">{startIcon}</span> : null}
104
119
  <span>{children ?? label}</span>
105
- {withIcon && iconPosition === 'right' && icon ? (
106
- <span className={clsx('material-symbols-rounded', 'icon')}>{icon}</span>
120
+ {badge ? (
121
+ <>
122
+ <span className={styles.srOnly}>, </span>
123
+ <span className={styles.abButtonBadge} data-tone={badgeTone} data-ab-part="badge" aria-hidden={srReason ? true : undefined}>{badge}</span>
124
+ </>
107
125
  ) : null}
126
+ {srReason ? <span className={styles.srOnly}>, {srReason}</span> : null}
127
+ {endIcon ? <span className={styles.abButtonSlot} aria-hidden="true">{endIcon}</span> : null}
128
+ {iconPosition === 'right' ? legacyIcon : null}
108
129
  </>
109
130
  );
110
131
 
132
+ // ๐Ÿ”— link mode
111
133
  if (href) {
112
- return (
113
- <a
114
- id={id}
115
- href={disabled ? undefined : href}
116
- role="button"
117
- className={classNames}
118
- style={style}
119
- hidden={hidden}
120
- aria-disabled={disabled}
121
- {...dataAttrs}
122
- >
123
- {content}
124
- </a>
125
- );
134
+ if (mode !== 'none') {
135
+ // ๐Ÿšซ blocked link: no href, role=link, focusable only in aria mode
136
+ return <span id={id} role="link" aria-disabled="true" tabIndex={mode === 'aria' ? 0 : -1} className={classNames} style={style} hidden={hidden} {...dataAttrs}>{content}</span>;
137
+ }
138
+ // โœ… a link is a link (no role=button)
139
+ return <a id={id} href={href} className={classNames} style={style} hidden={hidden} {...dataAttrs}>{content}</a>;
126
140
  }
127
141
 
142
+ // ๐Ÿ”˜ button: aria mode is type="button" so a disabled CTA can never submit, even without JS
128
143
  return (
129
144
  <button
130
- id={id}
131
- type={htmlType}
132
- className={classNames}
133
- style={style}
134
- hidden={hidden}
135
- disabled={disabled}
145
+ id={id} // ๐Ÿ†”
146
+ type={mode === 'aria' ? 'button' : htmlType} // ๐Ÿงพ
147
+ className={classNames} // ๐Ÿท๏ธ
148
+ style={style} // ๐ŸŽจ
149
+ hidden={hidden} // ๐Ÿ™ˆ
150
+ disabled={mode === 'native'} // ๐Ÿšซ
151
+ aria-disabled={mode === 'aria' ? true : undefined} // ๐Ÿšฆ
136
152
  {...dataAttrs}
137
153
  >
138
154
  {content}
@@ -140,5 +156,6 @@ const AbButton = ({
140
156
  );
141
157
  };
142
158
 
159
+ // ๐Ÿ“ฆ exports
143
160
  export default AbButton;
144
161
  export { AbButton };
@@ -2,7 +2,32 @@
2
2
  * @license MIT
3
3
  * ~~~~~~~~~~~~
4
4
  * ab-nextjs-components
5
- * Plain CSS modules โ€” no Tailwind Tailwind apply (Turbopack-safe).
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-components
27
+ * @name: styles.module.css
28
+ * @file: server/ab-button/styles.module.css
29
+ * @type: CSS
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
6
31
  */
7
32
 
8
33
  /*
@@ -11,6 +36,7 @@
11
36
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
37
  */
13
38
 
39
+
14
40
  .abButton {
15
41
  position: relative;
16
42
  display: inline-flex;
@@ -61,3 +87,55 @@
61
87
 
62
88
  .hidden { display: none !important; }
63
89
  .invisible { visibility: hidden; }
90
+
91
+ /* ===== G22: start/end icons, badge, aria-disabled ===== */
92
+
93
+ /* ๐Ÿ–ผ๏ธ icon slots (any ReactNode, e.g. <AbIcon name="github" />) */
94
+ .abButtonSlot {
95
+ display: inline-flex; /* ๐Ÿ“ align with label */
96
+ flex: none; /* ๐Ÿšซ never squash */
97
+ width: 1.25em; /* ๐Ÿ“ icon box */
98
+ height: 1.25em; /* ๐Ÿ“ */
99
+ align-items: center; /* โ†•๏ธ */
100
+ justify-content: center; /* โ†”๏ธ */
101
+ }
102
+
103
+ /* ๐Ÿท๏ธ "Coming soon" style badge inside the button */
104
+ .abButtonBadge {
105
+ display: inline-flex; /* ๐Ÿ“ */
106
+ align-items: center; /* โ†•๏ธ */
107
+ padding: 0.125rem 0.5rem; /* ๐Ÿงฑ */
108
+ border-radius: 9999px; /* ๐Ÿ’Š */
109
+ font-size: 0.75rem; /* ๐Ÿ”ก small */
110
+ font-weight: 600; /* ๐Ÿ’ช */
111
+ line-height: 1.2; /* ๐Ÿ“ */
112
+ white-space: nowrap; /* ๐Ÿšซ no wrap */
113
+ /* โšช neutral tone (default) */
114
+ color: var(--ab-color-on-surface-variant, currentColor);
115
+ background: var(--ab-color-surface-variant, rgb(0 0 0 / 0.06));
116
+ }
117
+
118
+ /* ๐Ÿฅ‰ accent tone: small text โ†’ the AA bronze text token (theme 0.3.1) */
119
+ .abButtonBadge[data-tone="accent"] {
120
+ color: var(--ab-color-bronze-text, #8A6440); /* โ™ฟ 5.02:1 on #fff8f3 */
121
+ background: color-mix(in srgb, var(--ab-color-bronze, #A67C52) 14%, transparent); /* ๐ŸŽจ soft wash */
122
+ }
123
+
124
+ /* ๐Ÿšฆ aria-disabled: looks disabled, stays focusable (no pointer-events:none so tooltips/focus still work) */
125
+ .abButton[aria-disabled="true"] {
126
+ cursor: not-allowed; /* ๐Ÿšซ */
127
+ opacity: 0.6; /* ๐ŸŒซ๏ธ */
128
+ }
129
+
130
+ /* ๐Ÿ™ˆ visually hidden, still announced */
131
+ .srOnly {
132
+ position: absolute; /* ๐Ÿ“Œ */
133
+ width: 1px; /* ๐Ÿ“ */
134
+ height: 1px; /* ๐Ÿ“ */
135
+ padding: 0; /* ๐Ÿงน */
136
+ margin: -1px; /* ๐Ÿงน */
137
+ overflow: hidden; /* โœ‚๏ธ */
138
+ clip: rect(0 0 0 0); /* โœ‚๏ธ */
139
+ white-space: nowrap; /* ๐Ÿšซ */
140
+ border: 0; /* ๐Ÿงน */
141
+ }
@@ -22,40 +22,92 @@
22
22
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
-
26
25
  *
27
26
  * @project: ab-nextjs-components
28
- * @name: AbIcon - Server
27
+ * @name: AbIcon - Server (G2)
29
28
  * @file: server/ab-icon/index.tsx
29
+ * @type: Server component โ€” any AbIcons name, zero client JS
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30
37
  */
31
38
 
32
- import type { ReactElement } from 'react';
39
+ // โš›๏ธ types
40
+ import type { CSSProperties, ReactElement } from 'react';
41
+ // ๐Ÿงต classes
33
42
  import clsx from 'clsx';
43
+ // ๐Ÿ—บ๏ธ full icon map: fine here, server components ship no JS to the browser
44
+ import { getAbIconSvg } from 'ab-nextjs-icons/ab-icons';
45
+ // ๐Ÿงฎ shared helpers (same rules as the client twin)
46
+ import { getAbIconStroke, getRegisteredAbIcon, pickAbIconMarkup, toAbIconSize, type AbIconSvgData, type AbIconVariant, type AbIconWeight } from '../../ab-icon/helpers';
47
+ // ๐ŸŽจ styles (server copy)
34
48
  import styles from './styles.module.css';
35
49
 
50
+ // โš™๏ธ props
36
51
  export interface AbIconProps {
37
- name: string;
38
- className?: string;
39
- filled?: boolean;
40
- size?: number | string;
41
- title?: string;
52
+ name: string; // ๐Ÿ—‚๏ธ AbIcons name (snake_case); Material ligature fallback if unknown
53
+ variant?: AbIconVariant; // ๐ŸŽš๏ธ outlined (default) | filled
54
+ filled?: boolean; // ๐Ÿ•ฐ๏ธ legacy alias for variant="filled"
55
+ weight?: AbIconWeight | number; // ๐Ÿ“ 100โ€“700 (outlined), default 200
56
+ size?: number | string; // ๐Ÿ“ default 24px
57
+ label?: string; // โ™ฟ NEW: accessible name; omitted = decorative (aria-hidden)
58
+ title?: string; // ๐Ÿ’ฌ legacy tooltip + name
59
+ svg?: AbIconSvgData; // ๐Ÿงพ NEW: explicit markup (tree-shaken per-icon import)
60
+ className?: string; // ๐Ÿท๏ธ
61
+ style?: CSSProperties; // ๐ŸŽจ
42
62
  }
43
63
 
44
- /** Material Symbols ligature icon (server / RSC). */
45
- const AbIcon = ({ name, className, filled = false, size, title }: AbIconProps): ReactElement => {
64
+ /** ๐Ÿ”ฃ AbIcons SVG icon (server / RSC): `svg` prop โ†’ registry โ†’ full AbIcons map โ†’ Material ligature. */
65
+ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg, className, style }: AbIconProps): ReactElement => {
66
+ // ๐ŸŽš๏ธ variant for lookup
67
+ const want: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
68
+ // ๐Ÿ” explicit โ†’ registered โ†’ whole map (weight is applied by CSS, so ask for the raw markup)
69
+ const markup = pickAbIconMarkup(svg ?? getRegisteredAbIcon(name), want) ?? getAbIconSvg(name, want);
70
+ // ๐ŸŽš๏ธ legacy `filled` โ†’ variant
71
+ const v: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
72
+ // ๐Ÿท๏ธ accessible name: `label` (new) or `title` (legacy)
73
+ const name_ = label ?? title;
74
+ // ๐ŸŽจ size + weight as CSS variables (weight overrides SVG stroke-width via CSS)
75
+ const vars = { ...style, '--ab-icon-size': toAbIconSize(size), '--ab-icon-stroke': String(getAbIconStroke(weight)) } as CSSProperties;
76
+ // โ™ฟ labelled = image, else decorative
77
+ const a11y = name_ ? { role: 'img' as const, 'aria-label': name_ } : { 'aria-hidden': true as const };
78
+
79
+ // โœ… AbIcons SVG
80
+ if (markup) {
81
+ return (
82
+ <span
83
+ className={clsx('AbIcon', styles.abIcon, className)} // ๐Ÿท๏ธ
84
+ style={vars} // ๐ŸŽจ
85
+ data-variant={v} // ๐ŸŽš๏ธ
86
+ data-icon={name} // ๐Ÿ—‚๏ธ
87
+ title={title} // ๐Ÿ’ฌ legacy tooltip only
88
+ {...a11y} // โ™ฟ
89
+ // ๐Ÿ”’ trusted, package-generated static markup (never user input)
90
+ dangerouslySetInnerHTML={{ __html: markup }}
91
+ />
92
+ );
93
+ }
94
+
95
+ // ๐Ÿ•ฐ๏ธ fallback: Material Symbols ligature (pre-G2 behaviour) for names not in AbIcons
46
96
  return (
47
97
  <span
48
- className={clsx('material-symbols-rounded', 'icon', styles.abIcon, className)}
49
- style={size != null ? { fontSize: typeof size === 'number' ? `${size}px` : size } : undefined}
50
- title={title}
51
- aria-hidden={title ? undefined : true}
52
- role={title ? 'img' : undefined}
53
- data-filled={filled ? 'true' : 'false'}
98
+ className={clsx('material-symbols-rounded', 'icon', styles.abIconFont, className)} // ๐Ÿท๏ธ
99
+ style={{ ...style, fontSize: toAbIconSize(size) }} // ๐Ÿ“
100
+ data-filled={v === 'filled' ? 'true' : 'false'} // ๐ŸŽš๏ธ
101
+ data-icon={name} // ๐Ÿ—‚๏ธ
102
+ data-ab-icon-fallback="font" // ๐Ÿ”Ž easy to audit
103
+ title={title} // ๐Ÿ’ฌ
104
+ {...a11y} // โ™ฟ
54
105
  >
55
106
  {name}
56
107
  </span>
57
108
  );
58
109
  };
59
110
 
111
+ // ๐Ÿ“ฆ exports
60
112
  export default AbIcon;
61
113
  export { AbIcon };
@@ -4,7 +4,30 @@
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
+ * @project: ab-nextjs-components
27
+ * @name: AbIcon - Styles (G2)
28
+ * @file: server/ab-icon/styles.module.css
29
+ * @type: CSS module
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
8
31
  */
9
32
 
10
33
  /*
@@ -13,15 +36,36 @@
13
36
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
37
  */
15
38
 
39
+ /* ๐Ÿ”ฃ SVG icon box */
16
40
  .abIcon {
17
- display: inline-flex;
18
- align-items: center;
19
- justify-content: center;
20
- font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
21
- line-height: 1;
22
- user-select: none;
41
+ display: inline-flex; /* ๐Ÿ“ */
42
+ flex: none; /* ๐Ÿšซ squash */
43
+ width: var(--ab-icon-size, 24px); /* ๐Ÿ“ */
44
+ height: var(--ab-icon-size, 24px); /* ๐Ÿ“ */
45
+ line-height: 0; /* ๐Ÿงน no baseline gap */
46
+ color: inherit; /* ๐ŸŽจ currentColor flows into the SVG */
23
47
  }
24
48
 
25
- .abIcon[data-filled='true'] {
26
- font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
49
+ /* ๐Ÿ“ the inline SVG fills the box */
50
+ .abIcon > svg {
51
+ width: 100%; /* โ†”๏ธ */
52
+ height: 100%; /* โ†•๏ธ */
53
+ }
54
+
55
+ /* ๐Ÿ“ weight: CSS beats SVG presentation attributes, outlined only (filled stay solid) */
56
+ .abIcon[data-variant='outlined'] > svg [stroke] {
57
+ stroke-width: var(--ab-icon-stroke, 1.25); /* โœ๏ธ */
58
+ }
59
+
60
+ /* ๐Ÿ•ฐ๏ธ Material Symbols fallback (unchanged from pre-G2) */
61
+ .abIconFont {
62
+ display: inline-flex; /* ๐Ÿ“ */
63
+ align-items: center; /* โ†•๏ธ */
64
+ justify-content: center; /* โ†”๏ธ */
65
+ font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; /* ๐Ÿ”ค */
66
+ line-height: 1; /* ๐Ÿ“ */
67
+ user-select: none; /* ๐Ÿšซ */
68
+ }
69
+ .abIconFont[data-filled='true'] {
70
+ font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; /* โฌ› */
27
71
  }