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.
- package/CHANGELOG.md +5 -1
- package/ab-bottom-drawer/index.tsx +35 -4
- package/ab-bottom-drawer/use-ab-swipe-down.ts +125 -0
- package/ab-button/helpers.ts +2 -2
- package/ab-button/index.tsx +1 -1
- package/ab-button/styles.module.css +86 -20
- package/ab-carousel/index.tsx +202 -31
- package/ab-carousel/styles.module.css +22 -1
- package/ab-drawer/kit.module.css +27 -0
- package/ab-flow-diagram/frame-scale.tsx +65 -0
- package/ab-flow-diagram/helpers.ts +89 -3
- package/ab-flow-diagram/index.tsx +116 -3
- package/ab-flow-diagram/styles.module.css +112 -1
- package/ab-mobile-header/index.tsx +151 -12
- package/ab-package-card/index.tsx +1 -1
- package/ab-package-card/previews.tsx +20 -4
- package/ab-playground-scene/i18n.module.css +54 -0
- package/ab-playground-scene/i18n.tsx +141 -0
- package/ab-playground-scene/icons.tsx +96 -0
- package/ab-playground-scene/index.tsx +138 -0
- package/ab-playground-scene/labels.ts +103 -0
- package/ab-playground-scene/scenes.tsx +103 -0
- package/ab-playground-scene/styles.module.css +148 -0
- package/ab-playground-scene/upgraded.tsx +315 -0
- package/ab-playground-scene/welcome.tsx +120 -0
- package/ab-theme-mode/index.tsx +82 -0
- package/ab-theme-toggle/index.tsx +22 -3
- package/index.ts +11 -1
- package/package.json +9 -5
- package/server/ab-button/index.tsx +3 -2
- package/server/ab-test-hello/styles.module.css +3 -0
- package/types/index.d.ts +8 -1
- package/server/ab-button/styles.module.css +0 -191
|
@@ -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,
|
|
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:
|
|
113
|
-
const engine =
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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 = {
|
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
|
-
}
|