ab-nextjs-components 0.3.2 โ 0.4.0
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/ab-breadcrumbs/styles.module.css +10 -0
- package/ab-callout/index.tsx +95 -0
- package/ab-callout/styles.module.css +72 -0
- package/ab-code-block/copy.tsx +76 -0
- package/ab-code-block/index.tsx +130 -0
- package/ab-code-block/styles.module.css +59 -0
- package/ab-content-tabs/index.tsx +144 -0
- package/ab-content-tabs/styles.module.css +61 -0
- package/ab-doc-pager/index.tsx +95 -0
- package/ab-doc-pager/styles.module.css +49 -0
- package/ab-icon/builtin.ts +8 -0
- package/ab-search-trigger/styles.module.css +2 -2
- package/index.ts +19 -0
- package/package.json +14 -5
- package/types/index.d.ts +14 -0
|
@@ -50,5 +50,15 @@
|
|
|
50
50
|
.abCrumbSep { width: 16px; height: 16px; flex: none; } /* โบ */
|
|
51
51
|
.abCrumbCurrent { color: var(--ab-crumbs-current); font-weight: 650; overflow: hidden; text-overflow: ellipsis; } /* ๐ฏ */
|
|
52
52
|
.abCrumbLink { color: inherit; text-decoration: none; border-radius: 4px; } /* ๐ */
|
|
53
|
+
/* ๐ 0.3.4 (Joseph, 0.2.24 docs): every crumb is at least 24ร24 (WCAG 2.5.8 target size), centred in its box */
|
|
54
|
+
.abCrumbLink,
|
|
55
|
+
.abCrumbCurrent {
|
|
56
|
+
display: inline-flex; /* ๐ */
|
|
57
|
+
align-items: center; /* โ๏ธ */
|
|
58
|
+
justify-content: center; /* โ๏ธ short labels ("Docs") centre in the 24px box */
|
|
59
|
+
min-width: 24px; /* ๐ */
|
|
60
|
+
min-height: 24px; /* ๐ */
|
|
61
|
+
box-sizing: border-box; /* ๐ฆ */
|
|
62
|
+
}
|
|
53
63
|
.abCrumbLink:hover { color: var(--ab-crumbs-hover); } /* ๐ฑ๏ธ */
|
|
54
64
|
.abCrumbLink:focus-visible { outline: 2px solid var(--ab-crumbs-ring); outline-offset: 2px; } /* โฟ */
|
|
@@ -0,0 +1,95 @@
|
|
|
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: AbCallout (0.3.4, Joseph 0.2.24 MDX docs)
|
|
28
|
+
* @file: ab-callout/index.tsx
|
|
29
|
+
* @type: Server component
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> <AbCallout variant="warning" title="Heads up">Next 16 only.</AbCallout>
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
38
|
+
* MOTTO: We'll always do more ๐!!!
|
|
39
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
// โ๏ธ React
|
|
43
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
44
|
+
// ๐งต classes
|
|
45
|
+
import clsx from 'clsx';
|
|
46
|
+
// ๐ฃ the server-safe icon (built-in AbIcons: info, lightbulb, warning, error)
|
|
47
|
+
import AbIcon from '../server/ab-icon';
|
|
48
|
+
// ๐จ styles
|
|
49
|
+
import styles from './styles.module.css';
|
|
50
|
+
|
|
51
|
+
/** ๐จ the four kinds */
|
|
52
|
+
export type AbCalloutVariant = 'note' | 'tip' | 'warning' | 'danger';
|
|
53
|
+
/** ๐ฃ the icon of each kind (AbIcons names, all built in) */
|
|
54
|
+
export const AB_CALLOUT_ICONS: Readonly<Record<AbCalloutVariant, string>> = { note: 'info', tip: 'lightbulb', warning: 'warning', danger: 'error' };
|
|
55
|
+
|
|
56
|
+
/** โ๏ธ props */
|
|
57
|
+
export interface AbCalloutProps {
|
|
58
|
+
variant?: AbCalloutVariant; // ๐จ default 'note'
|
|
59
|
+
title?: ReactNode; // ๐ท๏ธ bold first line (also names the region)
|
|
60
|
+
children?: ReactNode; // ๐ the body (MDX content)
|
|
61
|
+
icon?: string | null; // ๐ฃ override the glyph (`null` = none)
|
|
62
|
+
// โฟ default 'note' for every kind: a callout is static aside content, NOT a live message. Pass role="alert"
|
|
63
|
+
// only for something that appears dynamically (it interrupts screen readers)
|
|
64
|
+
role?: 'note' | 'alert' | 'status' | 'region';
|
|
65
|
+
label?: string; // โฟ an accessible name when there is no title (e.g. "Warning")
|
|
66
|
+
className?: string; // ๐ท๏ธ
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* ๐ก AbCallout โ an MDX admonition: an icon, an optional title and the body on a tinted card. Server-safe.
|
|
71
|
+
* The root is role="note" (a static aside to the text, not a live alert) named by its title, and the kind is
|
|
72
|
+
* also said in words for screen readers when there is no title, so meaning never rests on colour or icon alone.
|
|
73
|
+
*/
|
|
74
|
+
const AbCallout = ({ variant = 'note', title, children, icon, role = 'note', label, className }: AbCalloutProps): ReactElement => {
|
|
75
|
+
const glyph = icon === undefined ? AB_CALLOUT_ICONS[variant] : icon; // ๐ฃ
|
|
76
|
+
return (
|
|
77
|
+
<div
|
|
78
|
+
role={role} // โฟ
|
|
79
|
+
aria-label={title == null ? (label ?? variant[0].toUpperCase() + variant.slice(1)) : undefined} // ๐ท๏ธ "Warning" etc.
|
|
80
|
+
className={clsx('AbCallout', styles.abCallout, className)} // ๐จ the body keeps theme .ab-prose styles
|
|
81
|
+
data-ab-part="callout" // ๐๏ธ
|
|
82
|
+
data-variant={variant} // ๐จ the colour set
|
|
83
|
+
>
|
|
84
|
+
{glyph && <span className={styles.abCalloutIcon} aria-hidden="true"><AbIcon name={glyph} size={20} /></span> /* ๐ฃ decorative */}
|
|
85
|
+
<div className={styles.abCalloutBody}>
|
|
86
|
+
{title != null && <p className={styles.abCalloutTitle} data-ab-part="callout-title">{title}</p> /* ๐ท๏ธ */}
|
|
87
|
+
{children != null && <div className={styles.abCalloutText}>{children}</div> /* ๐ */}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// ๐ฆ exports
|
|
94
|
+
export default AbCallout;
|
|
95
|
+
export { AbCallout };
|
|
@@ -0,0 +1,72 @@
|
|
|
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: AbCallout styles (0.3.4)
|
|
28
|
+
* @file: ab-callout/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
|
+
/* ๐ก the card: a start accent bar + a tint; each variant only sets the two knobs */
|
|
40
|
+
.abCallout {
|
|
41
|
+
--ab-callout-accent: var(--ab-color-accent, #a67c52); /* ๐ฅ note = brand bronze */
|
|
42
|
+
--ab-callout-tint: var(--ab-color-tint, #f4e7db); /* ๐จ */
|
|
43
|
+
display: flex; /* ๐ icon ยท body */
|
|
44
|
+
gap: 12px; /* โ๏ธ */
|
|
45
|
+
margin: 0 0 1.25em; /* โ๏ธ prose rhythm */
|
|
46
|
+
padding: 12px 16px; /* ๐ฆ */
|
|
47
|
+
border: 1px solid color-mix(in srgb, var(--ab-callout-accent) 30%, transparent); /* ๐ฒ */
|
|
48
|
+
border-inline-start-width: 4px; /* โ the accent bar (RTL-safe) */
|
|
49
|
+
border-inline-start-color: var(--ab-callout-accent); /* ๐จ */
|
|
50
|
+
border-radius: var(--ab-radius-row, 8px); /* ๐ข */
|
|
51
|
+
background: var(--ab-callout-tint); /* ๐จ */
|
|
52
|
+
color: var(--ab-callout-text, var(--ab-color-text, #211a16)); /* ๐๏ธ AA on every tint (warning/danger: their on-container token) */
|
|
53
|
+
}
|
|
54
|
+
.abCallout[data-variant='tip'] { --ab-callout-accent: var(--ab-color-sage-accent, #4f7a4a); --ab-callout-tint: color-mix(in srgb, var(--ab-color-sage-accent, #4f7a4a) 10%, var(--ab-color-card, #fff)); } /* ๐ฟ */
|
|
55
|
+
/* โ ๏ธ 0.4.0: theme โฅ 0.3.8 status tokens (AA in every scheme, AAA in high contrast); fallbacks = the light values */
|
|
56
|
+
.abCallout[data-variant='warning'] {
|
|
57
|
+
--ab-callout-accent: var(--ab-color-warning, #8a5300); /* โ ๏ธ the start bar (โฅ 4.5:1 on the page) */
|
|
58
|
+
--ab-callout-tint: var(--ab-color-warning-container, #ffddb3); /* ๐จ soft fill */
|
|
59
|
+
--ab-callout-icon: var(--ab-color-on-warning-container, #2b1700); /* ๐ฃ โฟ on-container: โฅ 4.5:1 on the fill in every scheme (the accent is not, in high contrast) */
|
|
60
|
+
--ab-callout-text: var(--ab-color-on-warning-container, #2b1700); /* ๐๏ธ text on the fill */
|
|
61
|
+
}
|
|
62
|
+
.abCallout[data-variant='danger'] {
|
|
63
|
+
--ab-callout-accent: var(--ab-color-danger, #904a43); /* ๐ the start bar (โฅ 4.5:1 on the page) */
|
|
64
|
+
--ab-callout-tint: var(--ab-color-danger-container, #ffdad6); /* ๐จ soft fill */
|
|
65
|
+
--ab-callout-icon: var(--ab-color-on-danger-container, #3b0907); /* ๐ฃ โฟ on-container: โฅ 4.5:1 on the fill in every scheme (the accent is not, in high contrast) */
|
|
66
|
+
--ab-callout-text: var(--ab-color-on-danger-container, #3b0907); /* ๐๏ธ text on the fill */
|
|
67
|
+
}
|
|
68
|
+
.abCalloutIcon { flex: none; display: inline-flex; padding-top: 2px; color: var(--ab-callout-icon, var(--ab-callout-accent)); } /* ๐ฃ */
|
|
69
|
+
.abCalloutBody { flex: 1 1 auto; min-width: 0; } /* ๐ */
|
|
70
|
+
.abCalloutTitle { margin: 0 0 4px; font-weight: 700; } /* ๐ท๏ธ */
|
|
71
|
+
.abCalloutText > :first-child { margin-top: 0; } /* โฌ๏ธ */
|
|
72
|
+
.abCalloutText > :last-child { margin-bottom: 0; } /* โฌ๏ธ */
|
|
@@ -0,0 +1,76 @@
|
|
|
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: AbCodeBlockCopy (0.3.4)
|
|
28
|
+
* @file: ab-code-block/copy.tsx
|
|
29
|
+
* @type: Client component (the AbCodeBlock copy island)
|
|
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 { useRef, type ReactElement } from 'react';
|
|
43
|
+
// ๐ clipboard (hooks โฅ 0.1.6, deep import)
|
|
44
|
+
import { useAbClipboard } from 'ab-nextjs-hooks/useAbClipboard';
|
|
45
|
+
// ๐ the shared icon button
|
|
46
|
+
import AbIconButton from '../ab-icon-button';
|
|
47
|
+
// ๐จ styles
|
|
48
|
+
import styles from './styles.module.css';
|
|
49
|
+
|
|
50
|
+
/** โ๏ธ props */
|
|
51
|
+
export interface AbCodeBlockCopyProps {
|
|
52
|
+
code?: string; // ๐ the raw source (else the block's <pre> text)
|
|
53
|
+
label: string; // โฟ "Copy code"
|
|
54
|
+
copiedLabel: string; // โ
"Copied"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** ๐ the copy button: copies `code`, or the text of its own block's code; "Copied" is announced politely */
|
|
58
|
+
const AbCodeBlockCopy = ({ code, label, copiedLabel }: AbCodeBlockCopyProps): ReactElement => {
|
|
59
|
+
const ref = useRef<HTMLSpanElement>(null); // ๐ to find the block around us
|
|
60
|
+
const { copy, copied } = useAbClipboard(); // ๐ resets after 2s
|
|
61
|
+
const onCopy = () => {
|
|
62
|
+
const block = ref.current?.closest('[data-ab-part="code-block"]'); // ๐งฑ our AbCodeBlock
|
|
63
|
+
const text = code ?? block?.querySelector('[data-ab-part="code-block-code"]')?.textContent ?? ''; // ๐ what to copy
|
|
64
|
+
void copy(text.replace(/\n$/, '')); // ๐ (no trailing newline)
|
|
65
|
+
};
|
|
66
|
+
return (
|
|
67
|
+
<span ref={ref} className={styles.abCodeBlockCopy} data-ab-part="code-block-copy">
|
|
68
|
+
<AbIconButton icon={copied ? 'check' : 'content_copy'} label={label} naked onClick={onCopy} /> {/* ๐ name stays the action */}
|
|
69
|
+
<span className={styles.srOnly} role="status" aria-live="polite">{copied ? copiedLabel : ''}</span> {/* ๐ฃ */}
|
|
70
|
+
</span>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// ๐ฆ exports
|
|
75
|
+
export default AbCodeBlockCopy;
|
|
76
|
+
export { AbCodeBlockCopy };
|
|
@@ -0,0 +1,130 @@
|
|
|
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: AbCodeBlock (0.3.4, Joseph 0.2.24 MDX docs)
|
|
28
|
+
* @file: ab-code-block/index.tsx
|
|
29
|
+
* @type: Server component (no hooks; the copy button is a client island)
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> <AbCodeBlock filename="app/page.tsx" language="tsx" code={source} html={await codeToHtml(source, โฆ)} />
|
|
34
|
+
* 2+|> <AbCodeBlock language="bash" copyLabel={t('copy')} copiedLabel={t('copied')}><pre><code>pnpm add ab-nextjs-components</code></pre></AbCodeBlock>
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
39
|
+
* MOTTO: We'll always do more ๐!!!
|
|
40
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
// โ๏ธ React
|
|
44
|
+
import { Children, cloneElement, isValidElement, type ReactElement, type ReactNode } from 'react';
|
|
45
|
+
// ๐งต classes
|
|
46
|
+
import clsx from 'clsx';
|
|
47
|
+
// ๐ the copy button (the only client part)
|
|
48
|
+
import AbCodeBlockCopy from './copy';
|
|
49
|
+
// ๐จ styles
|
|
50
|
+
import styles from './styles.module.css';
|
|
51
|
+
|
|
52
|
+
// ๐ค escape a name for an HTML attribute (the `html` path)
|
|
53
|
+
const escAttr = (v: string) => v.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<'); // ๐งน
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* โจ๏ธ 0.4.0 (God): a plain <pre> gets tabIndex 0 (keyboard users can scroll long lines with the arrow keys) and a name.
|
|
57
|
+
* Shiki's <pre tabindex="0"> keeps its own tabindex (never doubled); an existing aria-label is never replaced.
|
|
58
|
+
*/
|
|
59
|
+
function withAbFocusablePre(children: ReactNode, name?: string): ReactNode {
|
|
60
|
+
return Children.map(children, (c) => {
|
|
61
|
+
if (!isValidElement<Record<string, unknown>>(c) || c.type !== 'pre') return c; // ๐
only a direct <pre>
|
|
62
|
+
const extra: Record<string, unknown> = {}; // ๐งฉ what we add
|
|
63
|
+
if (c.props.tabIndex == null && c.props.tabindex == null) extra.tabIndex = 0; // โจ๏ธ focusable
|
|
64
|
+
if (name && c.props['aria-label'] == null && c.props['aria-labelledby'] == null) extra['aria-label'] = name; // ๐ท๏ธ named
|
|
65
|
+
return Object.keys(extra).length ? cloneElement(c, extra) : c; // โ
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** ๐งพ the same for an `html` string: patch the FIRST <pre โฆ> tag only */
|
|
70
|
+
function withAbFocusablePreHtml(html: string, name?: string): string {
|
|
71
|
+
return html.replace(/<pre\b([^>]*)>/i, (tag, attrs: string) => {
|
|
72
|
+
let a = attrs; // ๐งฉ
|
|
73
|
+
if (!/\stabindex\s*=/i.test(a)) a += ' tabindex="0"'; // โจ๏ธ Shiki already has one โ untouched
|
|
74
|
+
if (name && !/\saria-label(ledby)?\s*=/i.test(a)) a += ` aria-label="${escAttr(name)}"`; // ๐ท๏ธ
|
|
75
|
+
return `<pre${a}>`; // โ
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** โ๏ธ props */
|
|
80
|
+
export interface AbCodeBlockProps {
|
|
81
|
+
children?: ReactNode; // ๐๏ธ Shiki-rendered (or plain) <pre><code>โฆ</code></pre>, e.g. from rehype-pretty-code in MDX
|
|
82
|
+
html?: string; // ๐งพ OR a pre-rendered HTML string (Shiki `codeToHtml`), trusted: YOU render it, never user input
|
|
83
|
+
code?: string; // ๐ the raw source to copy (best). Without it the button copies the rendered <pre>'s text
|
|
84
|
+
title?: ReactNode; // ๐ท๏ธ a caption in the header bar (e.g. "Install")
|
|
85
|
+
filename?: string; // ๐ a file name in the header bar (mono), e.g. "app/page.tsx"
|
|
86
|
+
language?: string; // ๐ค e.g. "tsx": a small badge + data-language (+ the region's name when there is no title)
|
|
87
|
+
copyLabel?: string; // โฟ the copy button's name (default "Copy code")
|
|
88
|
+
copiedLabel?: string; // โ
announced after a copy (default "Copied")
|
|
89
|
+
copy?: boolean; // ๐ show the copy button (default true)
|
|
90
|
+
className?: string; // ๐ท๏ธ
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* ๐ป AbCodeBlock โ a server-rendered code block for MDX docs: an optional header (title / filename ยท language),
|
|
95
|
+
* the highlighted code (children or an `html` string, both from Shiki), and a small client copy button. It is a
|
|
96
|
+
* <figure> (with a <figcaption> when there is a header), so the caption names the code for assistive tech; the
|
|
97
|
+
* <pre> is focusable (Shiki's tabindex kept, a plain one gets tabIndex 0) and named, so keyboard users can scroll it.
|
|
98
|
+
*/
|
|
99
|
+
const AbCodeBlock = ({ children, html, code, title, filename, language, copyLabel = 'Copy code', copiedLabel = 'Copied', copy = true, className }: AbCodeBlockProps): ReactElement => {
|
|
100
|
+
const hasHeader = title != null || !!filename || !!language; // ๐ท๏ธ a header bar?
|
|
101
|
+
const caption = (title ?? filename) != null; // ๐ฌ a visible name for the figure
|
|
102
|
+
// ๐ท๏ธ the scroller's name: the title (if text), else the filename, else "<language> code"
|
|
103
|
+
const preName = typeof title === 'string' ? title : filename || (language ? `${language} code` : undefined);
|
|
104
|
+
return (
|
|
105
|
+
<figure
|
|
106
|
+
className={clsx('AbCodeBlock', 'ab-prose-none', styles.abCodeBlock, className)} // ๐จ (opts out of theme .ab-prose)
|
|
107
|
+
data-ab-part="code-block" // ๐๏ธ the copy island finds its <pre> through this
|
|
108
|
+
data-language={language || undefined} // ๐ค
|
|
109
|
+
aria-label={!caption && language ? `${language} code` : undefined} // โฟ a name when nothing else gives one
|
|
110
|
+
>
|
|
111
|
+
{hasHeader && (
|
|
112
|
+
<figcaption className={styles.abCodeBlockHead} data-ab-part="code-block-head">
|
|
113
|
+
{title != null && <span className={styles.abCodeBlockTitle}>{title}</span> /* ๐ท๏ธ */}
|
|
114
|
+
{filename && <span className={styles.abCodeBlockFile} translate="no">{filename}</span> /* ๐ */}
|
|
115
|
+
{language && <span className={styles.abCodeBlockLang} aria-hidden={caption ? undefined : true} translate="no">{language}</span> /* ๐ค */}
|
|
116
|
+
</figcaption>
|
|
117
|
+
)}
|
|
118
|
+
<div className={styles.abCodeBlockBody}>
|
|
119
|
+
{html != null
|
|
120
|
+
? <div className={styles.abCodeBlockCode} data-ab-part="code-block-code" dangerouslySetInnerHTML={{ __html: withAbFocusablePreHtml(html, preName) }} /> // ๐งพ Shiki string (+ a focusable, named <pre>)
|
|
121
|
+
: <div className={styles.abCodeBlockCode} data-ab-part="code-block-code">{withAbFocusablePre(children, preName)}</div> /* ๐๏ธ Shiki children (+ a focusable, named <pre>) */}
|
|
122
|
+
{copy && <AbCodeBlockCopy code={code} label={copyLabel} copiedLabel={copiedLabel} /> /* ๐ client island */}
|
|
123
|
+
</div>
|
|
124
|
+
</figure>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// ๐ฆ exports
|
|
129
|
+
export default AbCodeBlock;
|
|
130
|
+
export { AbCodeBlock };
|
|
@@ -0,0 +1,59 @@
|
|
|
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: AbCodeBlock styles (0.3.4)
|
|
28
|
+
* @file: ab-code-block/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
|
+
/* ๐ป the block: dark code surface tokens (theme โฅ 0.3.4), rounded, clipped */
|
|
40
|
+
.abCodeBlock {
|
|
41
|
+
margin: 0 0 1.25em; /* โ๏ธ prose rhythm */
|
|
42
|
+
overflow: hidden; /* โ๏ธ rounded corners clip the header + code */
|
|
43
|
+
border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); /* ๐ฒ */
|
|
44
|
+
border-radius: var(--ab-radius-code, 12px); /* ๐ข */
|
|
45
|
+
background: var(--ab-color-code-surface, #231a14); /* ๐จ */
|
|
46
|
+
color: var(--ab-color-on-code-surface, #f4ece5); /* ๐๏ธ */
|
|
47
|
+
}
|
|
48
|
+
/* ๐ท๏ธ header: title ยท filename ยท language badge */
|
|
49
|
+
.abCodeBlockHead { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 16px; border-bottom: 1px solid rgb(255 255 255 / 0.08); font: 500 12.5px/1.2 var(--ab-font-body, system-ui, sans-serif); } /* ๐ */
|
|
50
|
+
.abCodeBlockTitle { font-weight: 600; } /* ๐ท๏ธ */
|
|
51
|
+
.abCodeBlockFile { font-family: var(--ab-font-code, ui-monospace, monospace); opacity: 0.85; } /* ๐ */
|
|
52
|
+
.abCodeBlockLang { margin-inline-start: auto; padding: 2px 6px; border-radius: 4px; background: rgb(255 255 255 / 0.08); font: 600 11px/1 var(--ab-font-code, ui-monospace, monospace); text-transform: lowercase; } /* ๐ค badge */
|
|
53
|
+
/* ๐งฑ body: the code + the copy button in its top-end corner */
|
|
54
|
+
.abCodeBlockBody { position: relative; } /* ๐ */
|
|
55
|
+
.abCodeBlockCode :where(pre) { margin: 0; padding: 14px 56px 14px 16px; overflow-x: auto; background: transparent !important; font: 13.5px/1.6 var(--ab-font-code, ui-monospace, monospace); } /* โ๏ธ scrolls; room for the button; Shiki's inline bg yields to ours */
|
|
56
|
+
.abCodeBlockCode :where(pre):focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; } /* โฟ */
|
|
57
|
+
.abCodeBlockCode :where(code) { font: inherit; } /* ๐ค */
|
|
58
|
+
.abCodeBlockCopy { position: absolute; inset-block-start: 4px; inset-inline-end: 4px; color: inherit; } /* ๐ 44px button (AbIconButton) */
|
|
59
|
+
.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* ๐ถ๏ธ */
|
|
@@ -0,0 +1,144 @@
|
|
|
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: AbContentTabs + AbContentTab (0.3.4, Joseph 0.2.24 MDX docs)
|
|
28
|
+
* @file: ab-content-tabs/index.tsx
|
|
29
|
+
* @type: Client component
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> // mdx-components.tsx: { Tabs: AbContentTabs, Tab: AbContentTab }
|
|
34
|
+
* 2+|> <Tabs label="Package manager"><Tab label="pnpm">โฆ</Tab><Tab label="npm">โฆ</Tab></Tabs>
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
39
|
+
* MOTTO: We'll always do more ๐!!!
|
|
40
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
'use client';
|
|
44
|
+
|
|
45
|
+
// โ๏ธ React
|
|
46
|
+
import { Children, isValidElement, useId, useRef, useState, type KeyboardEvent, type ReactElement, type ReactNode } from 'react';
|
|
47
|
+
// ๐งต classes
|
|
48
|
+
import clsx from 'clsx';
|
|
49
|
+
// ๐จ styles
|
|
50
|
+
import styles from './styles.module.css';
|
|
51
|
+
|
|
52
|
+
/** โ๏ธ one tab (a marker element: AbContentTabs reads its props, it renders only its children) */
|
|
53
|
+
export interface AbContentTabProps {
|
|
54
|
+
label: ReactNode; // ๐ท๏ธ the tab's text, e.g. "pnpm"
|
|
55
|
+
value?: string; // ๐ a stable key (default: the label text or the index), for `defaultValue`
|
|
56
|
+
children?: ReactNode; // ๐ the panel content (MDX)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** ๐ AbContentTab โ one panel of an AbContentTabs (MDX `<Tab>`). On its own it just renders its children. */
|
|
60
|
+
const AbContentTab = ({ children }: AbContentTabProps): ReactElement => <>{children}</>;
|
|
61
|
+
|
|
62
|
+
/** โ๏ธ props */
|
|
63
|
+
export interface AbContentTabsProps {
|
|
64
|
+
children?: ReactNode; // ๐ AbContentTab elements (anything else is ignored)
|
|
65
|
+
label?: string; // โฟ the tablist's name, e.g. "Package manager"
|
|
66
|
+
defaultValue?: string; // ๐ฏ the tab open first (default the first)
|
|
67
|
+
onChange?: (value: string) => void; // ๐ฃ after a switch
|
|
68
|
+
className?: string; // ๐ท๏ธ
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ๐ a tab's value: its `value`, else its string label, else its index
|
|
72
|
+
const valueOf = (p: AbContentTabProps, i: number) => p.value ?? (typeof p.label === 'string' ? p.label : String(i));
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* ๐๏ธ AbContentTabs โ the WAI-ARIA tabs pattern for MDX `<Tabs>`: a role="tablist" of buttons (roving tabindex,
|
|
76
|
+
* โ/โ wrap and flip in RTL, Home/End; selection follows focus) over role="tabpanel"s linked by aria-controls /
|
|
77
|
+
* aria-labelledby. Every panel is in the HTML (inactive ones `hidden`), so the server render already has the
|
|
78
|
+
* content. AbTabs is a nav strip of links, so this is its own small component. No motion (the switch is instant).
|
|
79
|
+
*/
|
|
80
|
+
const AbContentTabs = ({ children, label, defaultValue, onChange, className }: AbContentTabsProps): ReactElement => {
|
|
81
|
+
const id = useId(); // ๐ tab + panel ids
|
|
82
|
+
// ๐ the AbContentTab children (MDX passes them through as elements)
|
|
83
|
+
const tabs = Children.toArray(children).filter((c): c is ReactElement<AbContentTabProps> => isValidElement(c) && (c.type === AbContentTab || (c.props as Partial<AbContentTabProps>)?.label != null)); // ๐ also any element with a `label` (e.g. a wrapped Tab across the RSC boundary)
|
|
84
|
+
const values = tabs.map((t, i) => valueOf(t.props, i)); // ๐
|
|
85
|
+
const [selected, setSelected] = useState(() => (defaultValue && values.includes(defaultValue) ? defaultValue : values[0])); // ๐ฏ
|
|
86
|
+
const current = values.includes(selected) ? selected : values[0]; // ๐ children changed
|
|
87
|
+
const refs = useRef<Array<HTMLButtonElement | null>>([]); // ๐ to move focus
|
|
88
|
+
const select = (v: string) => { setSelected(v); onChange?.(v); }; // โ
|
|
89
|
+
// โจ๏ธ roving keys on the tablist
|
|
90
|
+
const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
|
|
91
|
+
const rtl = e.currentTarget.closest('[dir]')?.getAttribute('dir') === 'rtl'; // ๐
|
|
92
|
+
const i = values.indexOf(current); const n = values.length; // ๐
|
|
93
|
+
const next = rtl ? 'ArrowLeft' : 'ArrowRight'; const prev = rtl ? 'ArrowRight' : 'ArrowLeft'; // โ๏ธ
|
|
94
|
+
const j = e.key === next ? (i + 1) % n : e.key === prev ? (i - 1 + n) % n : e.key === 'Home' ? 0 : e.key === 'End' ? n - 1 : -1; // ๐ฏ
|
|
95
|
+
if (j < 0) return; // ๐
other keys
|
|
96
|
+
e.preventDefault(); // ๐ no scroll
|
|
97
|
+
select(values[j]); // โ
automatic activation
|
|
98
|
+
refs.current[j]?.focus(); // ๐ฏ
|
|
99
|
+
};
|
|
100
|
+
return (
|
|
101
|
+
<div className={clsx('AbContentTabs', styles.abContentTabs, className)} data-ab-part="content-tabs">
|
|
102
|
+
<div role="tablist" aria-label={label} className={styles.abContentTabsList} onKeyDown={onKeyDown}>
|
|
103
|
+
{tabs.map((t, i) => {
|
|
104
|
+
const on = values[i] === current; // โ
|
|
105
|
+
return (
|
|
106
|
+
<button
|
|
107
|
+
key={values[i]} // ๐
|
|
108
|
+
ref={(el) => { refs.current[i] = el; }} // ๐
|
|
109
|
+
type="button" // ๐งพ
|
|
110
|
+
role="tab" // โฟ
|
|
111
|
+
id={`${id}-tab-${i}`} // ๐
|
|
112
|
+
aria-selected={on} // โ
|
|
113
|
+
aria-controls={`${id}-panel-${i}`} // ๐
|
|
114
|
+
tabIndex={on ? 0 : -1} // โจ๏ธ one tab stop
|
|
115
|
+
className={styles.abContentTab} // ๐จ
|
|
116
|
+
data-ab-part="content-tab" // ๐๏ธ
|
|
117
|
+
onClick={() => select(values[i])} // ๐ฑ๏ธ
|
|
118
|
+
>
|
|
119
|
+
{t.props.label}
|
|
120
|
+
</button>
|
|
121
|
+
);
|
|
122
|
+
})}
|
|
123
|
+
</div>
|
|
124
|
+
{tabs.map((t, i) => (
|
|
125
|
+
<div
|
|
126
|
+
key={values[i]} // ๐
|
|
127
|
+
role="tabpanel" // โฟ
|
|
128
|
+
id={`${id}-panel-${i}`} // ๐
|
|
129
|
+
aria-labelledby={`${id}-tab-${i}`} // ๐
|
|
130
|
+
hidden={values[i] !== current} // ๐ inactive
|
|
131
|
+
tabIndex={0} // โจ๏ธ reachable even when it has no focusable content (APG)
|
|
132
|
+
className={styles.abContentTabsPanel} // ๐จ
|
|
133
|
+
data-ab-part="content-tab-panel" // ๐๏ธ
|
|
134
|
+
>
|
|
135
|
+
{t.props.children}
|
|
136
|
+
</div>
|
|
137
|
+
))}
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// ๐ฆ exports
|
|
143
|
+
export default AbContentTabs;
|
|
144
|
+
export { AbContentTabs, AbContentTab };
|
|
@@ -0,0 +1,61 @@
|
|
|
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: AbContentTabs styles (0.3.4)
|
|
28
|
+
* @file: ab-content-tabs/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
|
+
.abContentTabs { margin: 0 0 1.25em; } /* โ๏ธ prose rhythm */
|
|
40
|
+
/* ๐๏ธ the tab row: a hairline under, scrolls when narrow */
|
|
41
|
+
.abContentTabsList { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--ab-color-div, rgb(92 64 48 / 0.11)); } /* ๐ */
|
|
42
|
+
/* ๐ a tab: 44px tall target, an underline when selected (not colour alone) */
|
|
43
|
+
.abContentTab {
|
|
44
|
+
flex: none; /* ๐ */
|
|
45
|
+
min-height: 44px; /* ๐ */
|
|
46
|
+
padding: 0 14px; /* ๐ฆ */
|
|
47
|
+
margin-bottom: -1px; /* โ sits on the hairline */
|
|
48
|
+
border: 0; /* ๐งน */
|
|
49
|
+
border-bottom: 2px solid transparent; /* โ the selected bar's slot */
|
|
50
|
+
background: none; /* ๐งน */
|
|
51
|
+
color: var(--ab-color-muted, #6b5b50); /* ๐๏ธ */
|
|
52
|
+
font: 500 14px/1 var(--ab-font-body, inherit); /* ๐ค */
|
|
53
|
+
cursor: pointer; /* ๐ */
|
|
54
|
+
}
|
|
55
|
+
.abContentTab[aria-selected='true'] { border-bottom-color: var(--ab-color-accent, #a67c52); color: var(--ab-color-text, #211a16); font-weight: 650; } /* โ
*/
|
|
56
|
+
@media (hover: hover) { .abContentTab:hover { color: var(--ab-color-text, #211a16); } } /* ๐ฑ๏ธ */
|
|
57
|
+
.abContentTab:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; border-radius: 6px; } /* โฟ */
|
|
58
|
+
.abContentTabsPanel { padding-top: 12px; } /* ๐ฆ */
|
|
59
|
+
.abContentTabsPanel:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; border-radius: 6px; } /* โฟ */
|
|
60
|
+
.abContentTabsPanel > :first-child { margin-top: 0; } /* โฌ๏ธ */
|
|
61
|
+
.abContentTabsPanel > :last-child { margin-bottom: 0; } /* โฌ๏ธ */
|
|
@@ -0,0 +1,95 @@
|
|
|
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: AbDocPager (0.3.4, Joseph 0.2.24 MDX docs)
|
|
28
|
+
* @file: ab-doc-pager/index.tsx
|
|
29
|
+
* @type: Server-safe component (links via AbLinkProvider)
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> <AbDocPager prev={{ href: '/docs/install', title: 'Install' }} next={{ href: '/docs/theme', title: 'Theme' }} />
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
38
|
+
* MOTTO: We'll always do more ๐!!!
|
|
39
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
// โ๏ธ React
|
|
43
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
44
|
+
// ๐งต classes
|
|
45
|
+
import clsx from 'clsx';
|
|
46
|
+
// ๐ the app's link (AbLinkProvider, e.g. the i18n Link)
|
|
47
|
+
import Link from '../ab-link';
|
|
48
|
+
// ๐ฃ the arrows (server-safe icon)
|
|
49
|
+
import AbIcon from '../server/ab-icon';
|
|
50
|
+
// ๐จ styles
|
|
51
|
+
import styles from './styles.module.css';
|
|
52
|
+
|
|
53
|
+
/** ๐ one side of the pager */
|
|
54
|
+
export interface AbDocPagerLink {
|
|
55
|
+
href: string; // ๐
|
|
56
|
+
title: ReactNode; // ๐ท๏ธ the page's title
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** โ๏ธ props */
|
|
60
|
+
export interface AbDocPagerProps {
|
|
61
|
+
prev?: AbDocPagerLink | null; // โฌ
๏ธ the previous page (none on the first)
|
|
62
|
+
next?: AbDocPagerLink | null; // โก๏ธ the next page (none on the last)
|
|
63
|
+
labels?: { nav?: string; prev?: string; next?: string }; // ๐ "Pages", "Previous", "Next"
|
|
64
|
+
className?: string; // ๐ท๏ธ
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* โฎ๏ธโญ๏ธ AbDocPager โ the "Previous / Next" cards at the end of a docs page. A <nav> named "Pages"; each card is
|
|
69
|
+
* one link (โฅ 44px tall) whose name reads "Previous: Install" (the small label is part of the link text).
|
|
70
|
+
* rel="prev" / rel="next" for crawlers. Server-safe: no hooks of its own.
|
|
71
|
+
*/
|
|
72
|
+
const AbDocPager = ({ prev, next, labels = {}, className }: AbDocPagerProps): ReactElement | null => {
|
|
73
|
+
const L = { nav: 'Pages', prev: 'Previous', next: 'Next', ...labels }; // ๐
|
|
74
|
+
if (!prev && !next) return null; // ๐
nothing to show
|
|
75
|
+
return (
|
|
76
|
+
<nav aria-label={L.nav} className={clsx('AbDocPager', 'ab-prose-none', styles.abDocPager, className)} data-ab-part="doc-pager">
|
|
77
|
+
{prev ? (
|
|
78
|
+
<Link href={prev.href} rel="prev" className={styles.abDocPagerLink} data-ab-part="doc-pager-prev">
|
|
79
|
+
<span className={styles.abDocPagerHint}><AbIcon name="arrow_back" size={16} />{L.prev}<span className={styles.srOnly}>: </span></span>
|
|
80
|
+
<span className={styles.abDocPagerTitle}>{prev.title}</span>
|
|
81
|
+
</Link>
|
|
82
|
+
) : <span aria-hidden="true" />}
|
|
83
|
+
{next && (
|
|
84
|
+
<Link href={next.href} rel="next" className={clsx(styles.abDocPagerLink, styles.abDocPagerNext)} data-ab-part="doc-pager-next">
|
|
85
|
+
<span className={styles.abDocPagerHint}>{L.next}<span className={styles.srOnly}>: </span><AbIcon name="arrow_forward" size={16} /></span>
|
|
86
|
+
<span className={styles.abDocPagerTitle}>{next.title}</span>
|
|
87
|
+
</Link>
|
|
88
|
+
)}
|
|
89
|
+
</nav>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// ๐ฆ exports
|
|
94
|
+
export default AbDocPager;
|
|
95
|
+
export { AbDocPager };
|
|
@@ -0,0 +1,49 @@
|
|
|
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: AbDocPager styles (0.3.4)
|
|
28
|
+
* @file: ab-doc-pager/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
|
+
.abDocPager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2em 0 0; } /* ๐ two equal cards */
|
|
40
|
+
@media (width < 560px) { .abDocPager { grid-template-columns: 1fr; } } /* ๐ฑ stacked */
|
|
41
|
+
.abDocPagerLink { display: flex; flex-direction: column; gap: 4px; min-height: 44px; padding: 12px 16px; border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); border-radius: var(--ab-radius-card, 14px); background: var(--ab-color-card, #fff); color: var(--ab-color-text, #211a16); text-decoration: none; } /* ๐ */
|
|
42
|
+
.abDocPagerNext { grid-column: 2; align-items: flex-end; text-align: end; } /* โก๏ธ always on the end side */
|
|
43
|
+
@media (width < 560px) { .abDocPagerNext { grid-column: 1; } } /* ๐ฑ */
|
|
44
|
+
@media (hover: hover) { .abDocPagerLink:hover { border-color: var(--ab-color-accent, #a67c52); } } /* ๐ฑ๏ธ */
|
|
45
|
+
.abDocPagerLink:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โฟ */
|
|
46
|
+
.abDocPagerHint { display: inline-flex; align-items: center; gap: 4px; color: var(--ab-color-muted, #6b5b50); font-size: 12.5px; } /* ๐ท๏ธ */
|
|
47
|
+
.abDocPagerTitle { font-weight: 650; } /* ๐ท๏ธ */
|
|
48
|
+
.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* ๐ถ๏ธ */
|
|
49
|
+
[dir="rtl"] .abDocPagerHint > :global(.AbIcon) { transform: scaleX(-1); } /* ๐ arrows point the reading way */
|
package/ab-icon/builtin.ts
CHANGED
|
@@ -43,6 +43,10 @@ import lightMode from 'ab-nextjs-icons/ab-icons/icons/light_mode'; // ๐ AbThe
|
|
|
43
43
|
import darkMode from 'ab-nextjs-icons/ab-icons/icons/dark_mode'; // ๐ AbThemeToggle
|
|
44
44
|
import computer from 'ab-nextjs-icons/ab-icons/icons/computer'; // ๐ฅ๏ธ AbThemeToggle (system)
|
|
45
45
|
import brightnessAuto from 'ab-nextjs-icons/ab-icons/icons/brightness_auto'; // ๐๐
ฐ๏ธ 0.3.2: system theme (AbThemeToggle, AbMobileHeader, AbSettingsDrawer; icons โฅ 0.2.7)
|
|
46
|
+
import info from 'ab-nextjs-icons/ab-icons/icons/info'; // โน๏ธ 0.3.4 AbCallout note
|
|
47
|
+
import lightbulb from 'ab-nextjs-icons/ab-icons/icons/lightbulb'; // ๐ก 0.3.4 AbCallout tip
|
|
48
|
+
import warning from 'ab-nextjs-icons/ab-icons/icons/warning'; // โ ๏ธ 0.3.4 AbCallout warning
|
|
49
|
+
import error from 'ab-nextjs-icons/ab-icons/icons/error'; // ๐ 0.3.4 AbCallout danger
|
|
46
50
|
import language from 'ab-nextjs-icons/ab-icons/icons/language'; // ๐ AbLocaleSwitcher
|
|
47
51
|
import contentCopy from 'ab-nextjs-icons/ab-icons/icons/content_copy'; // ๐ AbInstallSnippet
|
|
48
52
|
import check from 'ab-nextjs-icons/ab-icons/icons/check'; // โ
AbInstallSnippet (copied)
|
|
@@ -67,6 +71,10 @@ export const AB_ICON_BUILTINS: Record<string, AbIconSvgData> = {
|
|
|
67
71
|
computer, // ๐ฅ๏ธ (kept for apps that still ask for it)
|
|
68
72
|
brightness_auto: brightnessAuto, // ๐๐
ฐ๏ธ 0.3.2: the system theme glyph
|
|
69
73
|
language, // ๐
|
|
74
|
+
info, // โน๏ธ 0.3.4 AbCallout
|
|
75
|
+
lightbulb, // ๐ก 0.3.4 AbCallout
|
|
76
|
+
warning, // โ ๏ธ 0.3.4 AbCallout
|
|
77
|
+
error, // ๐ 0.3.4 AbCallout
|
|
70
78
|
content_copy: contentCopy, // ๐
|
|
71
79
|
check, // โ
|
|
72
80
|
chevron_left: chevronLeft, // โ๏ธ
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); border-radius: var(--ab-radius-pill, 999px); /* ๐ */
|
|
85
85
|
background: var(--ab-color-card, #fff); color: var(--ab-color-faint, #807062); font-size: 13px; line-height: 1; /* ๐จ ๐ค */
|
|
86
86
|
}
|
|
87
|
-
/* ๐ 0.3.2 (God, 0.2.23 gaps): an invisible 44px-tall hit area around the 34px pill (
|
|
87
|
+
/* ๐ 0.3.2 (God, 0.2.23 gaps): an invisible 44px-tall hit area around the 34px pill (0.3.3: 6px above + below), so the
|
|
88
88
|
tap target is โฅ 44px (WCAG 2.5.5) without changing the look */
|
|
89
|
-
.abSearchTrigger[data-size='sm']::after { content: ''; position: absolute; inset: -
|
|
89
|
+
.abSearchTrigger[data-size='sm']::after { content: ''; position: absolute; inset: -6px 0; } /* ๐ซฅ hit area: 0.3.3 6px above + below โ 46px, safely โฅ 44 */
|
|
90
90
|
.abSearchTrigger[data-variant='field']:hover, .abSearchTrigger[data-size='sm']:hover { border-color: color-mix(in srgb, var(--ab-color-accent, #a67c52) 40%, transparent); } /* ๐ฑ๏ธ */
|
|
91
91
|
.abSearchTrigger[data-variant='field']:focus-visible, .abSearchTrigger[data-size='sm']:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โฟ */
|
|
92
92
|
/* โจ๏ธ the single key cap (mock `kbd`): 20px, radius 5, 2px bottom border, 11/600 --muted */
|
package/index.ts
CHANGED
|
@@ -142,6 +142,11 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
|
|
|
142
142
|
{ name: 'AbProfileAvatar', file: 'ab-profile-avatar/index.tsx', kind: 'server', status: 'Done' }, // ๐ 0.2.1 initials / photo / glyph circle (no hooks: client + server)
|
|
143
143
|
{ name: 'AbVersionSwitcher', file: 'ab-version-switcher/index.tsx', kind: 'client', status: 'Done' },
|
|
144
144
|
{ name: 'AbBreadcrumbs', file: 'ab-breadcrumbs/index.tsx', kind: 'server', status: 'Done' },
|
|
145
|
+
{ name: 'AbDocPager', file: 'ab-doc-pager/index.tsx', kind: 'server', status: 'Done' }, // โฎ๏ธโญ๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
|
|
146
|
+
{ name: 'AbContentTabs', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
|
|
147
|
+
{ name: 'AbContentTab', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
|
|
148
|
+
{ name: 'AbCodeBlock', file: 'ab-code-block/index.tsx', kind: 'server', status: 'Done' }, // ๐ป 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
|
|
149
|
+
{ name: 'AbCallout', file: 'ab-callout/index.tsx', kind: 'server', status: 'Done' }, // ๐ก 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
|
|
145
150
|
{ name: 'AbList', file: 'ab-list/index.tsx', kind: 'server', status: 'Done' },
|
|
146
151
|
]
|
|
147
152
|
|
|
@@ -244,3 +249,17 @@ export { default as AbProductItem } from './ab-product-item/index.tsx'
|
|
|
244
249
|
export { default as AbDemoBox } from './ab-demo-box/index.tsx'
|
|
245
250
|
export { default as AbDemoCode } from './ab-demo-code/index.tsx'
|
|
246
251
|
export { default as AbPolygon } from './server/ab-polygon/index.tsx'
|
|
252
|
+
// ๐ก 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
|
|
253
|
+
export { default as AbCallout, AB_CALLOUT_ICONS } from './ab-callout/index.tsx'
|
|
254
|
+
export type { AbCalloutProps, AbCalloutVariant } from './ab-callout/index.tsx'
|
|
255
|
+
// ๐ป 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
|
|
256
|
+
export { default as AbCodeBlock } from './ab-code-block/index.tsx'
|
|
257
|
+
export { default as AbCodeBlockCopy } from './ab-code-block/copy.tsx'
|
|
258
|
+
export type { AbCodeBlockCopyProps } from './ab-code-block/copy.tsx'
|
|
259
|
+
export type { AbCodeBlockProps } from './ab-code-block/index.tsx'
|
|
260
|
+
// ๐๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
|
|
261
|
+
export { default as AbContentTabs, AbContentTab } from './ab-content-tabs/index.tsx'
|
|
262
|
+
export type { AbContentTabsProps, AbContentTabProps } from './ab-content-tabs/index.tsx'
|
|
263
|
+
// โฎ๏ธโญ๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
|
|
264
|
+
export { default as AbDocPager } from './ab-doc-pager/index.tsx'
|
|
265
|
+
export type { AbDocPagerProps, AbDocPagerLink } from './ab-doc-pager/index.tsx'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ab-nextjs-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"ab-nextjs-animations": "^0.2.5",
|
|
44
44
|
"ab-nextjs-hooks": "^0.1.7",
|
|
45
45
|
"ab-nextjs-icons": "^0.2.7",
|
|
46
|
-
"ab-nextjs-theme": "^0.3.
|
|
46
|
+
"ab-nextjs-theme": "^0.3.8",
|
|
47
47
|
"clsx": "^2",
|
|
48
48
|
"next": "^16.3.4",
|
|
49
49
|
"react": "^19",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"ab-nextjs-animations": "^0.2.5",
|
|
57
57
|
"ab-nextjs-hooks": "^0.1.7",
|
|
58
58
|
"ab-nextjs-icons": "^0.2.7",
|
|
59
|
-
"ab-nextjs-theme": "^0.3.
|
|
59
|
+
"ab-nextjs-theme": "^0.3.8",
|
|
60
60
|
"clsx": "^2.1.1",
|
|
61
61
|
"esbuild": "^0.28.2",
|
|
62
62
|
"eslint": "^9.39.0",
|
|
@@ -141,7 +141,11 @@
|
|
|
141
141
|
"ab-card",
|
|
142
142
|
"ab-package-card",
|
|
143
143
|
"ab-toc",
|
|
144
|
-
"ab-error-hero"
|
|
144
|
+
"ab-error-hero",
|
|
145
|
+
"ab-callout",
|
|
146
|
+
"ab-code-block",
|
|
147
|
+
"ab-content-tabs",
|
|
148
|
+
"ab-doc-pager"
|
|
145
149
|
],
|
|
146
150
|
"exports": {
|
|
147
151
|
".": {
|
|
@@ -241,7 +245,12 @@
|
|
|
241
245
|
"./ab-toc": "./ab-toc/index.tsx",
|
|
242
246
|
"./ab-error-hero": "./ab-error-hero/index.tsx",
|
|
243
247
|
"./ab-sidebar/view": "./ab-sidebar/view.tsx",
|
|
244
|
-
"./ab-navbar/view": "./ab-navbar/view.tsx"
|
|
248
|
+
"./ab-navbar/view": "./ab-navbar/view.tsx",
|
|
249
|
+
"./ab-callout": "./ab-callout/index.tsx",
|
|
250
|
+
"./ab-code-block": "./ab-code-block/index.tsx",
|
|
251
|
+
"./ab-code-block/copy": "./ab-code-block/copy.tsx",
|
|
252
|
+
"./ab-content-tabs": "./ab-content-tabs/index.tsx",
|
|
253
|
+
"./ab-doc-pager": "./ab-doc-pager/index.tsx"
|
|
245
254
|
},
|
|
246
255
|
"peerDependenciesMeta": {
|
|
247
256
|
"ab-nextjs-theme": {
|
package/types/index.d.ts
CHANGED
|
@@ -139,3 +139,17 @@ export { default as AbProductItem } from '../ab-product-item/index.tsx';
|
|
|
139
139
|
export { default as AbDemoBox } from '../ab-demo-box/index.tsx';
|
|
140
140
|
export { default as AbDemoCode } from '../ab-demo-code/index.tsx';
|
|
141
141
|
export { default as AbPolygon } from '../server/ab-polygon/index.tsx';
|
|
142
|
+
// ๐ก 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
|
|
143
|
+
export { default as AbCallout, AB_CALLOUT_ICONS } from '../ab-callout/index.tsx';
|
|
144
|
+
export type { AbCalloutProps, AbCalloutVariant } from '../ab-callout/index.tsx';
|
|
145
|
+
// ๐ป 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
|
|
146
|
+
export { default as AbCodeBlock } from '../ab-code-block/index.tsx';
|
|
147
|
+
export { default as AbCodeBlockCopy } from '../ab-code-block/copy.tsx';
|
|
148
|
+
export type { AbCodeBlockCopyProps } from '../ab-code-block/copy.tsx';
|
|
149
|
+
export type { AbCodeBlockProps } from '../ab-code-block/index.tsx';
|
|
150
|
+
// ๐๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
|
|
151
|
+
export { default as AbContentTabs, AbContentTab } from '../ab-content-tabs/index.tsx';
|
|
152
|
+
export type { AbContentTabsProps, AbContentTabProps } from '../ab-content-tabs/index.tsx';
|
|
153
|
+
// โฎ๏ธโญ๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
|
|
154
|
+
export { default as AbDocPager } from '../ab-doc-pager/index.tsx';
|
|
155
|
+
export type { AbDocPagerProps, AbDocPagerLink } from '../ab-doc-pager/index.tsx';
|