ab-nextjs-components 0.2.1 โ†’ 0.2.3

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.
@@ -0,0 +1,82 @@
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: AbThemeModeProvider (one shared light / dark / system state)
28
+ * @file: ab-theme-mode/index.tsx
29
+ * @type: Client component + hook
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+ 'use client';
40
+
41
+ // โš›๏ธ React
42
+ import { createContext, useContext, type ReactElement, type ReactNode } from 'react';
43
+ // ๐ŸŒ— the theme engine (hooks โ‰ฅ 0.1.6): persisted in localStorage, applied to <html>, follows the OS in 'system'
44
+ import { useAbThemeMode, type AbThemeMode, type AbThemeModeResult } from 'ab-nextjs-hooks/useAbTheme';
45
+
46
+ /** ๐Ÿง  what the provider shares: the chosen mode, what paints, and the setter */
47
+ export interface AbThemeModeContextValue {
48
+ mode: AbThemeMode | string; // ๐ŸŽš๏ธ 'light' | 'dark' | 'system'
49
+ resolvedTheme: AbThemeModeResult['resolvedTheme']; // ๐ŸŽจ what paints ('system' โ†’ light / dark)
50
+ setMode: (mode: AbThemeMode | string) => void; // โœ๏ธ persists + applies (through the engine)
51
+ }
52
+
53
+ // ๐Ÿง  null outside a provider (each toggle then keeps its own engine, exactly like before)
54
+ const AbThemeModeContext = createContext<AbThemeModeContextValue | null>(null);
55
+
56
+ /** โš™๏ธ props */
57
+ export interface AbThemeModeProviderProps {
58
+ defaultMode?: AbThemeMode; // ๐ŸŒฑ before hydration / nothing saved (default 'light', the engine's default)
59
+ children?: ReactNode; // ๐Ÿงฉ the app
60
+ }
61
+
62
+ /**
63
+ * ๐ŸŒ— AbThemeModeProvider โ€” 0.2.3 (Joseph, Welcome 0.2.21): ONE theme state for the whole app. Each AbThemeToggle
64
+ * (laptop sidebar, Settings sheet) and AbMobileHeader's 3-state button used to run its own engine, so they drifted
65
+ * across 768px. Under this provider they all read and write this one engine (still persisted under the `theme`
66
+ * key, still following the OS in 'system'). Put it once, high in the tree (e.g. around AbAppLayout).
67
+ *
68
+ * ๐Ÿงญ Why components and not hooks / theme: the engine already lives in ab-nextjs-hooks; this is only the sharing
69
+ * glue, and the consumers that must read it are components, so the release set stays core + components.
70
+ */
71
+ export function AbThemeModeProvider({ defaultMode = 'light', children }: AbThemeModeProviderProps): ReactElement {
72
+ const engine = useAbThemeMode(defaultMode); // ๐ŸŒ— the ONE engine
73
+ return <AbThemeModeContext.Provider value={engine}>{children}</AbThemeModeContext.Provider>;
74
+ }
75
+
76
+ /** ๐Ÿช useAbThemeModeContext โ€” the shared state, or `null` outside an AbThemeModeProvider. */
77
+ export function useAbThemeModeContext(): AbThemeModeContextValue | null {
78
+ return useContext(AbThemeModeContext); // ๐Ÿ”
79
+ }
80
+
81
+ // ๐Ÿ“ฆ exports
82
+ export default AbThemeModeProvider;
@@ -52,6 +52,8 @@ import { useAbThemeMode, AB_THEME_MODES, type AbThemeMode } from 'ab-nextjs-hook
52
52
  import AbIcon from '../ab-icon';
53
53
  // ๐ŸŽจ styles
54
54
  import styles from './styles.module.css';
55
+ // ๐ŸŒ— 0.2.3: the shared theme state (AbThemeModeProvider), when there is one
56
+ import { useAbThemeModeContext, type AbThemeModeContextValue } from '../ab-theme-mode';
55
57
  import { AB_MOTION } from 'ab-nextjs-animations/motion'; // ๐ŸŽฌ transition class names (ab-nextjs-animations >= 0.2.4)
56
58
  import 'ab-nextjs-animations/motion/styles.css'; // ๐ŸŽจ .ab-motion-*
57
59
 
@@ -105,12 +107,29 @@ export function getNextAbThemeMode(modes: readonly AbThemeMode[], current: AbThe
105
107
  return null; // ๐Ÿ™…
106
108
  }
107
109
 
110
+ /**
111
+ * ๐ŸŒ— AbThemeToggle โ€” 0.2.3: under an AbThemeModeProvider every toggle reads and writes the ONE shared engine (no
112
+ * drift between the laptop and mobile toggles); without a provider it runs its own engine, as before. The branch is
113
+ * between two components, so each keeps a fixed hook order.
114
+ */
108
115
  export function AbThemeToggle(props: AbThemeToggleProps) {
116
+ const shared = useAbThemeModeContext(); // ๐Ÿง  the provider's state, or null
117
+ return shared ? <AbThemeToggleView {...props} engine={shared} /> : <AbThemeToggleOwn {...props} />;
118
+ }
119
+
120
+ // ๐Ÿ”ง no provider: this toggle's own engine (the pre-0.2.3 behaviour)
121
+ function AbThemeToggleOwn(props: AbThemeToggleProps) {
122
+ const engine = useAbThemeMode(props.defaultMode ?? 'light'); // ๐ŸŒ— persists + applies to <html>
123
+ return <AbThemeToggleView {...props} engine={engine} />;
124
+ }
125
+
126
+ // ๐Ÿ–ผ๏ธ the markup, fed by either engine
127
+ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeModeContextValue, 'mode' | 'setMode'> }) {
109
128
  // ๐Ÿงฉ props
110
- const { labels, variant = 'segmented', modes = AB_THEME_MODES, value, onChange, defaultMode = 'light', icons, size = 'md', appearance = 'fill', iconShows, className, style } = props;
129
+ const { labels, variant = 'segmented', modes = AB_THEME_MODES, value, onChange, icons, size = 'md', appearance = 'fill', iconShows, className, style } = props;
111
130
  const thumb = appearance === 'thumb'; // ๐ŸŒ— P7
112
- // ๐ŸŒ— engine: persists + applies to <html>
113
- const engine = useAbThemeMode(defaultMode);
131
+ // ๐ŸŒ— engine: the shared one (provider) or this toggle's own; both persist + apply to <html>
132
+ const { engine } = props;
114
133
  // ๐ŸŽ›๏ธ controlled or engine-driven
115
134
  const current = (value ?? engine.mode) as AbThemeMode;
116
135
  // ๐Ÿ“ refs to move focus with the selection
package/index.ts CHANGED
@@ -116,6 +116,8 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
116
116
  { name: 'AbLocaleSwitcher', file: 'ab-locale-switcher/index.tsx', kind: 'client', status: 'Done' },
117
117
  // ๐Ÿ†• Welcome v6 (AbFlowDiagram)
118
118
  { name: 'AbFlowDiagram', file: 'ab-flow-diagram/index.tsx', kind: 'server', status: 'Done' },
119
+ // ๐Ÿ†• 0.2.3 Welcome v6 playground (AbPlaygroundScene)
120
+ { name: 'AbPlaygroundScene', file: 'ab-playground-scene/index.tsx', kind: 'server', status: 'Done' },
119
121
  // ๐Ÿ†• 0.1.13 docs shell (AbLink)
120
122
  { name: 'AbLink', file: 'ab-link/index.tsx', kind: 'client', status: 'Done' },
121
123
  // ๐Ÿ†• 0.1.13 docs shell (AbKbd) โ€” server-safe, no hooks
@@ -137,6 +139,7 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
137
139
  { name: 'AbConfirmDrawer', file: 'ab-confirm-drawer/index.tsx', kind: 'client', status: 'Done' },
138
140
  { name: 'AbBottomDrawer', file: 'ab-bottom-drawer/index.tsx', kind: 'client', status: 'Done' },
139
141
  { name: 'AbMobileHeader', file: 'ab-mobile-header/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
142
+ { name: 'AbThemeModeProvider', file: 'ab-theme-mode/index.tsx', kind: 'client', status: 'Done' }, // ๐ŸŒ— 0.2.3 shared theme mode
140
143
  { name: 'AbSearchDrawer', file: 'ab-search-drawer/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
141
144
  { name: 'AbTocDrawer', file: 'ab-toc-drawer/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
142
145
  { name: 'AbNavDrawer', file: 'ab-nav-drawer/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
@@ -204,9 +207,16 @@ export type { AbConfirmDrawerProps } from './ab-confirm-drawer/index.tsx'
204
207
  // ๐Ÿ“ฑ 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
205
208
  export { default as AbBottomDrawer } from './ab-bottom-drawer/index.tsx'
206
209
  export type { AbBottomDrawerProps } from './ab-bottom-drawer/index.tsx'
210
+ // ๐Ÿ‘‡ 0.2.3 (Joseph, Welcome 0.2.21): swipe a bottom sheet down to close
211
+ export { useAbSwipeDown, isAbScrolledInside } from './ab-bottom-drawer/use-ab-swipe-down.ts'
212
+ export type { UseAbSwipeDownOptions } from './ab-bottom-drawer/use-ab-swipe-down.ts'
207
213
  // ๐Ÿ†• 0.2.0 drawers v2: AbMobileHeader
208
214
  export { default as AbMobileHeader } from './ab-mobile-header/index.tsx'
209
- export type { AbMobileHeaderProps } from './ab-mobile-header/index.tsx'
215
+ export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from './ab-mobile-header/index.tsx'
216
+ export { AB_MOBILE_HEADER_THEME_CYCLE } from './ab-mobile-header/index.tsx' // ๐ŸŒ— 0.2.3
217
+ // ๐ŸŒ— 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
218
+ export { AbThemeModeProvider, useAbThemeModeContext } from './ab-theme-mode/index.tsx'
219
+ export type { AbThemeModeProviderProps, AbThemeModeContextValue } from './ab-theme-mode/index.tsx'
210
220
  // ๐Ÿ†• 0.2.0 drawers v2: AbSearchDrawer
211
221
  export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from './ab-search-drawer/index.tsx'
212
222
  export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels } from './ab-search-drawer/index.tsx'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-nextjs-components",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
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",
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "license": "MIT",
42
42
  "peerDependencies": {
43
- "ab-nextjs-animations": "^0.2.4",
43
+ "ab-nextjs-animations": "^0.2.5",
44
44
  "ab-nextjs-hooks": "^0.1.7",
45
45
  "ab-nextjs-icons": "^0.2.4",
46
- "ab-nextjs-theme": "^0.3.6",
46
+ "ab-nextjs-theme": "^0.3.7",
47
47
  "clsx": "^2",
48
48
  "next": "^16.3.4",
49
49
  "react": "^19",
@@ -53,10 +53,10 @@
53
53
  "@testing-library/react": "^16.3.3",
54
54
  "@types/node": "^20",
55
55
  "@types/react": "^19",
56
- "ab-nextjs-animations": "^0.2.4",
56
+ "ab-nextjs-animations": "^0.2.5",
57
57
  "ab-nextjs-hooks": "^0.1.7",
58
58
  "ab-nextjs-icons": "^0.2.4",
59
- "ab-nextjs-theme": "^0.3.6",
59
+ "ab-nextjs-theme": "^0.3.7",
60
60
  "clsx": "^2.1.1",
61
61
  "esbuild": "^0.28.2",
62
62
  "eslint": "^9.39.0",
@@ -128,11 +128,13 @@
128
128
  "ab-breadcrumbs",
129
129
  "ab-list",
130
130
  "ab-flow-diagram",
131
+ "ab-playground-scene",
131
132
  "ab-locale-switcher",
132
133
  "ab-install-snippet",
133
134
  "ab-pill",
134
135
  "ab-chip",
135
136
  "ab-theme-toggle",
137
+ "ab-theme-mode",
136
138
  "ab-logo/ab-logo.svg",
137
139
  "styles.css",
138
140
  "css",
@@ -159,6 +161,7 @@
159
161
  "./ab-carousel": "./ab-carousel/index.tsx",
160
162
  "./ab-carousel/helpers": "./ab-carousel/helpers.ts",
161
163
  "./ab-theme-toggle": "./ab-theme-toggle/index.tsx",
164
+ "./ab-theme-mode": "./ab-theme-mode/index.tsx",
162
165
  "./ab-chip": "./ab-chip/index.tsx",
163
166
  "./ab-pill": "./ab-pill/index.tsx",
164
167
  "./ab-install-snippet": "./ab-install-snippet/index.tsx",
@@ -166,6 +169,7 @@
166
169
  "./ab-locale-switcher": "./ab-locale-switcher/index.tsx",
167
170
  "./ab-flow-diagram": "./ab-flow-diagram/index.tsx",
168
171
  "./ab-flow-diagram/helpers": "./ab-flow-diagram/helpers.ts",
172
+ "./ab-playground-scene": "./ab-playground-scene/index.tsx",
169
173
  "./ab-drawer": "./ab-drawer/index.tsx",
170
174
  "./ab-drawer/use-ab-drawer": "./ab-drawer/use-ab-drawer.ts",
171
175
  "./ab-drawer-list": "./ab-drawer-list/index.tsx",
@@ -41,7 +41,8 @@ import type { CSSProperties, ReactElement, ReactNode } from 'react';
41
41
  // ๐Ÿงต class joiner
42
42
  import clsx from 'clsx';
43
43
  // ๐ŸŽจ styles (server copy)
44
- import styles from './styles.module.css';
44
+ // ๐Ÿงฌ 0.2.3 (Joseph 03:41): ONE source for the button box โ€” the client module's CSS (no server copy to drift)
45
+ import styles from '../../ab-button/styles.module.css';
45
46
  // ๐Ÿงฎ the SAME rules as the client twin
46
47
  import {
47
48
  getAbButtonDisabledMode,
@@ -96,7 +97,7 @@ const AbButton = ({
96
97
  const srReason = getAbButtonSrReason({ disabled, disabledReason });
97
98
 
98
99
  // ๐Ÿท๏ธ classes
99
- const classNames = clsx('AbButton', styles.abButton, className, rounded && styles.abButtonRounded, type === 'filled' && styles.isFilled /* ๐Ÿฅ‰ */, mode === 'native' && styles.isDisabled);
100
+ const classNames = clsx('AbButton', styles.abButton, className, rounded && styles.abButtonRounded, type === 'contained' && styles.isContained /* ๐ŸŽจ mirrors client */, type === 'filled' && styles.isFilled /* ๐Ÿฅ‰ */, mode === 'native' && styles.isDisabled);
100
101
 
101
102
  // ๐Ÿ—‚๏ธ data attributes
102
103
  const dataAttrs = {
@@ -52,3 +52,6 @@
52
52
  font-size: 0.875rem;
53
53
  opacity: 0.5;
54
54
  }
55
+ .abTestHelloSrc:hover {
56
+ opacity: 0.9;
57
+ }
package/types/index.d.ts CHANGED
@@ -94,9 +94,16 @@ export type { AbConfirmDrawerProps } from '../ab-confirm-drawer/index.tsx';
94
94
  // ๐Ÿ“ฑ 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
95
95
  export { default as AbBottomDrawer } from '../ab-bottom-drawer/index.tsx';
96
96
  export type { AbBottomDrawerProps } from '../ab-bottom-drawer/index.tsx';
97
+ // ๐Ÿ‘‡ 0.2.3 (Joseph, Welcome 0.2.21): swipe a bottom sheet down to close
98
+ export { useAbSwipeDown, isAbScrolledInside } from '../ab-bottom-drawer/use-ab-swipe-down.ts';
99
+ export type { UseAbSwipeDownOptions } from '../ab-bottom-drawer/use-ab-swipe-down.ts';
97
100
  // ๐Ÿ†• 0.2.0 drawers v2: AbMobileHeader
98
101
  export { default as AbMobileHeader } from '../ab-mobile-header/index.tsx';
99
- export type { AbMobileHeaderProps } from '../ab-mobile-header/index.tsx';
102
+ export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from '../ab-mobile-header/index.tsx';
103
+ export { AB_MOBILE_HEADER_THEME_CYCLE } from '../ab-mobile-header/index.tsx'; // ๐ŸŒ— 0.2.3
104
+ // ๐ŸŒ— 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
105
+ export { AbThemeModeProvider, useAbThemeModeContext } from '../ab-theme-mode/index.tsx';
106
+ export type { AbThemeModeProviderProps, AbThemeModeContextValue } from '../ab-theme-mode/index.tsx';
100
107
  // ๐Ÿ†• 0.2.0 drawers v2: AbSearchDrawer
101
108
  export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from '../ab-search-drawer/index.tsx';
102
109
  export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels } from '../ab-search-drawer/index.tsx';
@@ -1,191 +0,0 @@
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: styles.module.css
28
- * @file: server/ab-button/styles.module.css
29
- * @type: CSS
30
- * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
- */
32
-
33
- /*
34
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
- * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
- */
38
-
39
-
40
- .abButton {
41
- position: relative;
42
- display: inline-flex;
43
- align-items: center;
44
- justify-content: center;
45
- gap: 0.5rem;
46
- width: fit-content;
47
- height: fit-content;
48
- margin: 0;
49
- overflow: hidden;
50
- font-size: 1rem;
51
- line-height: 1.25;
52
- text-decoration: none;
53
- cursor: pointer;
54
- border: none;
55
- background: transparent;
56
- color: inherit;
57
- }
58
-
59
- .abButtonRounded {
60
- border-radius: 9999px;
61
- }
62
-
63
- .isContained {}
64
-
65
- /* ๐Ÿฅ‰ Filled (0.1.12): solid bronze fallback for apps on ab-nextjs-theme < 0.3.3.
66
- * Theme โ‰ฅ 0.3.3 ships `button[data-type="filled"]` (higher specificity), which
67
- * adds the hover / focus / disabled state layers on top of this ๐ŸŽจ */
68
- .isFilled {
69
- --material-icon-color: var(--ab-button-text-color, var(--md-sys-color-on-primary, #fff)); /* ๐ŸŽจ icon = label */
70
-
71
- background: var(--ab-button-background-color, var(--md-sys-color-primary, rgb(133 83 24)));
72
- color: var(--ab-button-text-color, var(--md-sys-color-on-primary, #fff));
73
- font-weight: bold;
74
- }
75
-
76
- .isDisabled {
77
- pointer-events: none;
78
- opacity: 0.6;
79
- }
80
-
81
- .abButtonIcon {
82
- font-size: 1.25rem;
83
- line-height: 1;
84
- }
85
-
86
- .abButtonSpinnerSlot {
87
- position: absolute;
88
- inset: 0;
89
- z-index: 10;
90
- display: flex;
91
- align-items: center;
92
- justify-content: center;
93
- }
94
-
95
- .abButtonSpinner {
96
- /* themed via --ab-button-spinner-color when present */
97
- }
98
-
99
- .hidden { display: none !important; }
100
- .invisible { visibility: hidden; }
101
-
102
- /* ===== G22: start/end icons, badge, aria-disabled ===== */
103
-
104
- /* ๐Ÿ–ผ๏ธ icon slots (any ReactNode, e.g. <AbIcon name="github" />) */
105
- .abButtonSlot {
106
- display: inline-flex; /* ๐Ÿ“ align with label */
107
- flex: none; /* ๐Ÿšซ never squash */
108
- width: 1.25em; /* ๐Ÿ“ icon box */
109
- height: 1.25em; /* ๐Ÿ“ */
110
- align-items: center; /* โ†•๏ธ */
111
- justify-content: center; /* โ†”๏ธ */
112
- }
113
-
114
- /* ๐Ÿท๏ธ "Coming soon" style badge inside the button */
115
- .abButtonBadge {
116
- display: inline-flex; /* ๐Ÿ“ */
117
- align-items: center; /* โ†•๏ธ */
118
- padding: 0.125rem 0.5rem; /* ๐Ÿงฑ */
119
- border-radius: 9999px; /* ๐Ÿ’Š */
120
- font-size: 0.75rem; /* ๐Ÿ”ก small */
121
- font-weight: 600; /* ๐Ÿ’ช */
122
- line-height: 1.2; /* ๐Ÿ“ */
123
- white-space: nowrap; /* ๐Ÿšซ no wrap */
124
- /* โšช neutral tone (default) */
125
- color: var(--ab-color-on-surface-variant, currentColor);
126
- background: var(--ab-color-surface-variant, rgb(0 0 0 / 0.06));
127
- }
128
-
129
- /* ๐Ÿฅ‰ accent tone: small text โ†’ the AA bronze text token (theme 0.3.1) */
130
- .abButtonBadge[data-tone="accent"] {
131
- color: var(--ab-color-bronze-text, #8A6440); /* โ™ฟ 5.02:1 on #fff8f3 */
132
- background: color-mix(in srgb, var(--ab-color-bronze, #A67C52) 14%, transparent); /* ๐ŸŽจ soft wash */
133
- }
134
-
135
- /* ๐Ÿšฆ aria-disabled: looks disabled, stays focusable (no pointer-events:none so tooltips/focus still work) */
136
- .abButton[aria-disabled="true"] {
137
- cursor: not-allowed; /* ๐Ÿšซ */
138
- opacity: 0.6; /* ๐ŸŒซ๏ธ */
139
- }
140
-
141
- /* ๐Ÿ™ˆ visually hidden, still announced */
142
- .srOnly {
143
- position: absolute; /* ๐Ÿ“Œ */
144
- width: 1px; /* ๐Ÿ“ */
145
- height: 1px; /* ๐Ÿ“ */
146
- padding: 0; /* ๐Ÿงน */
147
- margin: -1px; /* ๐Ÿงน */
148
- overflow: hidden; /* โœ‚๏ธ */
149
- clip: rect(0 0 0 0); /* โœ‚๏ธ */
150
- white-space: nowrap; /* ๐Ÿšซ */
151
- border: 0; /* ๐Ÿงน */
152
- }
153
-
154
- /* ===== ๐Ÿ”ท 0.1.14 (P16, Home fidelity spec ยง4 CTAs): shape="rounded" ยท size="md" ยท type="secondary" =====
155
- * Doubled class (0,3,0+) beats the theme's `button[data-type="filled"]` (0,1,1) and its :hover (0,3,1 โ†’ we use 0,5,0). */
156
- .abButton.abButton[data-shape="rounded"] {
157
- gap: 6px; /* ๐Ÿงฑ icon โ†” label */
158
- border-radius: var(--ab-radius-button, 10px); /* ๐Ÿ”ท */
159
- padding: 0 var(--ab-button-padding-inline, 16px); /* ๐Ÿ“ฆ */
160
- font-size: 14px; font-weight: 650; line-height: 1; white-space: nowrap; /* ๐Ÿ”ค */
161
- overflow: visible; /* ๐ŸŒ— the primary shadow must show */
162
- }
163
- .abButton.abButton[data-size="md"] { height: var(--ab-button-height, 40px); box-sizing: border-box; } /* ๐Ÿ“ */
164
- .abButton.abButton[data-shape="rounded"] .abButtonSlot { width: 18px; height: 18px; } /* ๐Ÿ–ผ๏ธ 18px icons */
165
- .abButton.abButton[data-shape="rounded"] .abButtonSlot svg { width: 100%; height: 100%; }
166
- /* ๐Ÿฅ‰ primary (filled) */
167
- .abButton.abButton[data-shape="rounded"][data-type="filled"] {
168
- background: var(--ab-color-btn, #8b6340); color: var(--ab-color-btn-text, #fff); /* ๐ŸŽจ AA (theme 0.3.5) */
169
- border: 0; box-shadow: var(--ab-shadow-button, 0 1px 0 rgb(255 255 255 / 0.2) inset, 0 4px 12px rgb(139 99 64 / 0.25)); /* โœจ */
170
- }
171
- .abButton.abButton[data-shape="rounded"][data-type="filled"]:not(:disabled, [aria-disabled="true"]):hover {
172
- background: color-mix(in srgb, var(--ab-color-btn, #8b6340) 90%, #000); /* ๐Ÿ–ฑ๏ธ */
173
- }
174
- /* โšช secondary */
175
- .abButton.abButton[data-type="secondary"] {
176
- border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); background: var(--ab-color-card, #fff); color: var(--ab-color-text, #211a16); /* ๐ŸŽจ */
177
- box-sizing: border-box;
178
- }
179
- .abButton.abButton[data-type="secondary"]:not(:disabled, [aria-disabled="true"]):hover {
180
- background: linear-gradient(var(--ab-color-hover, rgb(166 124 82 / 0.08)), var(--ab-color-hover, rgb(166 124 82 / 0.08))), var(--ab-color-card, #fff); /* ๐Ÿ–ฑ๏ธ tint over the card */
181
- }
182
- .abButton.abButton[data-shape="rounded"]:not(:disabled, [aria-disabled="true"]):active { transform: translateY(1px); } /* ๐Ÿ‘‡ */
183
- .abButton.abButton[data-shape="rounded"]:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โ™ฟ */
184
- /* ๐Ÿ“ฑ touch widths: 44px, 14.5px (mock .M .btn; the app sets flex: 1) */
185
- @media (max-width: 767px) {
186
- .abButton.abButton[data-size="md"] { height: var(--ab-button-height-touch, 44px); }
187
- .abButton.abButton[data-shape="rounded"][data-size="md"] { font-size: 14.5px; }
188
- }
189
- @media (prefers-reduced-motion: reduce) {
190
- .abButton.abButton[data-shape="rounded"]:active { transform: none; } /* โ™ฟ no nudge */
191
- }