ab-nextjs-components 0.1.9 โ†’ 0.1.11

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 (49) hide show
  1. package/CHANGELOG.md +36 -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 +152 -0
  16. package/ab-flow-diagram/styles.module.css +158 -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 +5 -1
  29. package/ab-linear-progress/styles.module.css +8 -24
  30. package/ab-locale-switcher/index.tsx +213 -0
  31. package/ab-locale-switcher/styles.module.css +127 -0
  32. package/ab-pill/index.tsx +74 -0
  33. package/ab-progress-chips/index.tsx +30 -1
  34. package/ab-progress-chips/styles.module.css +40 -1
  35. package/ab-searchbar/index.tsx +33 -2
  36. package/ab-searchbar/styles.module.css +41 -5
  37. package/ab-splash/index.tsx +3 -1
  38. package/ab-splash/styles.module.css +2 -5
  39. package/ab-theme-toggle/index.tsx +188 -0
  40. package/ab-theme-toggle/styles.module.css +89 -0
  41. package/css/dialog.css +38 -3
  42. package/index.ts +41 -0
  43. package/package.json +33 -17
  44. package/server/ab-brand/index.tsx +29 -1
  45. package/server/ab-brand/styles.module.css +40 -1
  46. package/server/ab-button/index.tsx +96 -79
  47. package/server/ab-button/styles.module.css +79 -1
  48. package/server/ab-icon/index.tsx +68 -16
  49. package/server/ab-icon/styles.module.css +53 -9
package/css/dialog.css CHANGED
@@ -1,7 +1,41 @@
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: Dialog chrome styles (moved out of ab-nextjs-theme)
28
+ * @file: css/dialog.css
29
+ * @type: CSS
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
1
33
  /*
2
- * ab-nextjs-components โ€” chrome styles moved out of ab-nextjs-theme
3
- * Copyright (c) 2026 Abraham Ukachi. MIT.
4
- */
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
5
39
 
6
40
  /* Dialogs */
7
41
  #dialogs, .Dialogs {
@@ -104,6 +138,7 @@ li.dialog-list-item {
104
138
  transform-origin: left;
105
139
  opacity: var(--opacity-dialog-list-item, 0.68);
106
140
  user-select: none;
141
+ /* โš ๏ธ named motion exception (James review): consumer-rendered markup, no component can add an ab-motion-* class; pinned in __tests__/motion-from-animations.test.tsx */
107
142
  transition: all 0.2s ease-in-out;
108
143
  }
109
144
 
package/index.ts CHANGED
@@ -5,11 +5,38 @@
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: Components - Package Catalog
10
28
  * @file: index.ts
29
+ * @type: Package catalog + barrel
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
11
31
  */
12
32
 
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+
13
40
  import type { ComponentCatalogEntry } from './types'
14
41
 
15
42
  /**
@@ -24,6 +51,8 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
24
51
  { name: 'AbLinearProgress', file: 'ab-linear-progress/index.tsx', kind: 'client', status: 'Done' },
25
52
  // ๐Ÿ’ฆ AbSplash: subpath-only (`ab-nextjs-components/ab-splash`)
26
53
  { name: 'AbSplash', file: 'ab-splash/index.tsx', kind: 'client', status: 'Done' },
54
+ // ๐ŸŽ  G31 AbCarousel (Welcome v6): subpath-only (`ab-nextjs-components/ab-carousel`), needs ab-nextjs-hooks >= 0.1.6
55
+ { name: 'AbCarousel', file: 'ab-carousel/index.tsx', kind: 'client', status: 'Done' },
27
56
  { name: 'AbButton', file: 'ab-button/index.tsx', kind: 'client', status: 'Done' },
28
57
  { name: 'AbIconButton', file: 'ab-icon-button/index.tsx', kind: 'client', status: 'Done' },
29
58
  { name: 'AbInput', file: 'ab-input/index.tsx', kind: 'client', status: 'Done' },
@@ -75,6 +104,18 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
75
104
  { name: 'AbTestHello', file: 'server/ab-test-hello/index.tsx', kind: 'server', status: 'Done' },
76
105
  { name: 'AbKeyFeature', file: 'server/ab-key-feature/index.tsx', kind: 'server', status: 'Done' },
77
106
  { name: 'AbSwitchBack', file: 'server/ab-switch-back/index.tsx', kind: 'server', status: 'Done' },
107
+ // ๐Ÿ†• Welcome v6 (AbThemeToggle)
108
+ { name: 'AbThemeToggle', file: 'ab-theme-toggle/index.tsx', kind: 'client', status: 'Done' },
109
+ // ๐Ÿ†• Welcome v6 (AbChip)
110
+ { name: 'AbChip', file: 'ab-chip/index.tsx', kind: 'server', status: 'Done' },
111
+ // ๐Ÿ†• Welcome v6 (AbPill)
112
+ { name: 'AbPill', file: 'ab-pill/index.tsx', kind: 'server', status: 'Done' },
113
+ // ๐Ÿ†• Welcome v6 (AbInstallSnippet)
114
+ { name: 'AbInstallSnippet', file: 'ab-install-snippet/index.tsx', kind: 'client', status: 'Done' },
115
+ // ๐Ÿ†• Welcome v6 (AbLocaleSwitcher)
116
+ { name: 'AbLocaleSwitcher', file: 'ab-locale-switcher/index.tsx', kind: 'client', status: 'Done' },
117
+ // ๐Ÿ†• Welcome v6 (AbFlowDiagram)
118
+ { name: 'AbFlowDiagram', file: 'ab-flow-diagram/index.tsx', kind: 'server', status: 'Done' },
78
119
  ]
79
120
 
80
121
  const abComponents = { supportedComponents }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ab-nextjs-components",
3
- "version": "0.1.9",
4
- "description": "\ud83d\ude80 A lightweight collection of server & client React components created by Abraham Ukachi, and optimized for Next.js applications \ud83d\ude0e.",
3
+ "version": "0.1.11",
4
+ "description": "๐Ÿš€ A lightweight collection of server & client React components created by Abraham Ukachi, and optimized for Next.js applications ๐Ÿ˜Ž.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
7
7
  "types": "types/index.d.ts",
@@ -40,28 +40,33 @@
40
40
  },
41
41
  "license": "MIT",
42
42
  "peerDependencies": {
43
+ "ab-nextjs-animations": "^0.2.4",
44
+ "ab-nextjs-hooks": "^0.1.6",
45
+ "ab-nextjs-icons": "^0.2.3",
46
+ "ab-nextjs-theme": "^0.3.1",
43
47
  "clsx": "^2",
44
48
  "next": "^16.3.4",
45
49
  "react": "^19",
46
- "react-dom": "^19",
47
- "ab-nextjs-theme": "*",
48
- "ab-nextjs-icons": "*",
49
- "ab-nextjs-hooks": "*",
50
- "ab-nextjs-animations": "*"
50
+ "react-dom": "^19"
51
51
  },
52
52
  "devDependencies": {
53
+ "@testing-library/react": "^16.3.3",
53
54
  "@types/node": "^20",
54
55
  "@types/react": "^19",
56
+ "ab-nextjs-animations": "^0.2.4",
57
+ "ab-nextjs-hooks": "^0.1.6",
58
+ "ab-nextjs-icons": "^0.2.3",
59
+ "ab-nextjs-theme": "^0.3.1",
60
+ "clsx": "^2.1.1",
61
+ "esbuild": "^0.28.2",
55
62
  "eslint": "^9.39.0",
56
63
  "eslint-config-next": "16.3.4",
64
+ "happy-dom": "^20.14.6",
57
65
  "next": "16.3.4",
58
66
  "react": "^19",
59
67
  "react-dom": "^19",
60
68
  "typescript": "^5",
61
- "vitest": "^3",
62
- "clsx": "^2.1.1",
63
- "ab-nextjs-hooks": "^0.1.2",
64
- "esbuild": "^0.28.2"
69
+ "vitest": "^3"
65
70
  },
66
71
  "files": [
67
72
  "index.ts",
@@ -108,6 +113,13 @@
108
113
  "ab-demo-code",
109
114
  "ab-splash",
110
115
  "ab-linear-progress",
116
+ "ab-carousel",
117
+ "ab-flow-diagram",
118
+ "ab-locale-switcher",
119
+ "ab-install-snippet",
120
+ "ab-pill",
121
+ "ab-chip",
122
+ "ab-theme-toggle",
111
123
  "ab-logo/ab-logo.svg",
112
124
  "styles.css",
113
125
  "css",
@@ -123,6 +135,16 @@
123
135
  "./ab-logo": "./ab-logo/index.tsx",
124
136
  "./ab-linear-progress": "./ab-linear-progress/index.tsx",
125
137
  "./ab-splash": "./ab-splash/index.tsx",
138
+ "./ab-carousel": "./ab-carousel/index.tsx",
139
+ "./ab-carousel/helpers": "./ab-carousel/helpers.ts",
140
+ "./ab-theme-toggle": "./ab-theme-toggle/index.tsx",
141
+ "./ab-chip": "./ab-chip/index.tsx",
142
+ "./ab-pill": "./ab-pill/index.tsx",
143
+ "./ab-install-snippet": "./ab-install-snippet/index.tsx",
144
+ "./ab-install-snippet/helpers": "./ab-install-snippet/helpers.ts",
145
+ "./ab-locale-switcher": "./ab-locale-switcher/index.tsx",
146
+ "./ab-flow-diagram": "./ab-flow-diagram/index.tsx",
147
+ "./ab-flow-diagram/helpers": "./ab-flow-diagram/helpers.ts",
126
148
  "./ab-splash/gate": "./ab-splash/gate.ts",
127
149
  "./ab-splash/csp": {
128
150
  "types": "./ab-splash/csp.d.ts",
@@ -188,14 +210,8 @@
188
210
  "ab-nextjs-theme": {
189
211
  "optional": true
190
212
  },
191
- "ab-nextjs-icons": {
192
- "optional": true
193
- },
194
213
  "ab-nextjs-hooks": {
195
214
  "optional": true
196
- },
197
- "ab-nextjs-animations": {
198
- "optional": true
199
215
  }
200
216
  }
201
217
  }
@@ -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
+ }