@docubook/create 1.15.3 → 1.16.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/package.json +1 -1
- package/src/dist/app/page.tsx +1 -1
- package/src/dist/components/contexts/AccordionContext.ts +4 -0
- package/src/dist/components/markdown/AccordionGroupMdx.tsx +31 -0
- package/src/dist/components/markdown/AccordionMdx.tsx +17 -6
- package/src/dist/lib/markdown.ts +2 -0
- package/src/dist/package.json +1 -1
package/package.json
CHANGED
package/src/dist/app/page.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export default function Home() {
|
|
|
25
25
|
)}
|
|
26
26
|
>
|
|
27
27
|
<AnimatedShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-100 hover:duration-300 hover:dark:text-neutral-200">
|
|
28
|
-
<span>🚀 New Version - Release v1.
|
|
28
|
+
<span>🚀 New Version - Release v1.16.0</span>
|
|
29
29
|
<ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" />
|
|
30
30
|
</AnimatedShinyText>
|
|
31
31
|
</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import React, { ReactNode } from "react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { AccordionGroupContext } from "@/components/contexts/AccordionContext";
|
|
6
|
+
|
|
7
|
+
interface AccordionGroupProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const AccordionGroup: React.FC<AccordionGroupProps> = ({ children, className }) => {
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
// Wrap all children with the AccordionGroupContext.Provider
|
|
16
|
+
// so that any nested accordions know they are inside a group.
|
|
17
|
+
// This enables group-specific behavior in child components.
|
|
18
|
+
<AccordionGroupContext.Provider value={{ inGroup: true }}>
|
|
19
|
+
<div
|
|
20
|
+
className={clsx(
|
|
21
|
+
"border rounded-lg overflow-hidden",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
</AccordionGroupContext.Provider>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default AccordionGroup;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { ReactNode, useState } from 'react';
|
|
3
|
+
import { ReactNode, useState, useContext } from 'react';
|
|
4
4
|
import { ChevronRight } from 'lucide-react';
|
|
5
5
|
import * as Icons from "lucide-react";
|
|
6
6
|
import { cn } from '@/lib/utils';
|
|
7
|
+
import { AccordionGroupContext } from '@/components/contexts/AccordionContext';
|
|
7
8
|
|
|
8
9
|
type AccordionProps = {
|
|
9
10
|
title: string;
|
|
@@ -18,16 +19,26 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
18
19
|
defaultOpen = false,
|
|
19
20
|
icon,
|
|
20
21
|
}: AccordionProps) => {
|
|
22
|
+
const groupContext = useContext(AccordionGroupContext);
|
|
23
|
+
const isInGroup = groupContext?.inGroup === true;
|
|
21
24
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
22
|
-
|
|
23
25
|
const Icon = icon ? (Icons[icon] as React.FC<{ className?: string }>) : null;
|
|
24
26
|
|
|
27
|
+
// The main wrapper div for the accordion.
|
|
28
|
+
// All styling logic for the accordion container is handled here.
|
|
25
29
|
return (
|
|
26
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
className={cn(
|
|
32
|
+
// Style for STANDALONE: full card with border & shadow
|
|
33
|
+
!isInGroup && "border rounded-lg shadow-sm",
|
|
34
|
+
// Style for IN GROUP: only a bottom border separator
|
|
35
|
+
isInGroup && "border-b last:border-b-0 border-border"
|
|
36
|
+
)}
|
|
37
|
+
>
|
|
27
38
|
<button
|
|
28
39
|
type="button"
|
|
29
40
|
onClick={() => setIsOpen(!isOpen)}
|
|
30
|
-
className="flex items-center space-x-2 w-full px-4 h-12 transition-colors bg-
|
|
41
|
+
className="flex items-center space-x-2 w-full px-4 h-12 transition-colors bg-muted/40 dark:bg-muted/20 hover:bg-muted/70 dark:hover:bg-muted/70"
|
|
31
42
|
>
|
|
32
43
|
<ChevronRight
|
|
33
44
|
className={cn(
|
|
@@ -40,7 +51,7 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
40
51
|
</button>
|
|
41
52
|
|
|
42
53
|
{isOpen && (
|
|
43
|
-
<div className="px-4 py-3
|
|
54
|
+
<div className="px-4 py-3 dark:bg-muted/10 bg-muted/15">
|
|
44
55
|
{children}
|
|
45
56
|
</div>
|
|
46
57
|
)}
|
|
@@ -48,4 +59,4 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
48
59
|
);
|
|
49
60
|
};
|
|
50
61
|
|
|
51
|
-
export default Accordion;
|
|
62
|
+
export default Accordion;
|
package/src/dist/lib/markdown.ts
CHANGED
|
@@ -45,6 +45,7 @@ import CardGroup from "@/components/markdown/CardGroupMdx";
|
|
|
45
45
|
import Kbd from "@/components/markdown/KeyboardMdx";
|
|
46
46
|
import { Release, Changes } from "@/components/markdown/ReleaseMdx";
|
|
47
47
|
import { File, Files, Folder } from "@/components/markdown/FileTreeMdx";
|
|
48
|
+
import AccordionGroup from "@/components/markdown/AccordionGroupMdx";
|
|
48
49
|
|
|
49
50
|
// add custom components
|
|
50
51
|
const components = {
|
|
@@ -73,6 +74,7 @@ const components = {
|
|
|
73
74
|
File,
|
|
74
75
|
Files,
|
|
75
76
|
Folder,
|
|
77
|
+
AccordionGroup
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
// can be used for other pages like blogs, Guides etc
|