@docubook/create 1.15.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/create",
3
- "version": "1.15.2",
3
+ "version": "1.16.0",
4
4
  "description": "CLI to create DocuBook projects",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -2,7 +2,7 @@
2
2
  "DocuImage": {
3
3
  "prefix": "image",
4
4
  "body": [
5
- "![${1:Alt text for the image}](${2:https://via.placeholder.com/150})"
5
+ "![${1:Alt text for the image}](${2:/images/example-img.png})"
6
6
  ],
7
7
  "description": "Snippet untuk menampilkan image komponen."
8
8
  },
@@ -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.15.2</span>
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,4 @@
1
+ import { createContext } from 'react';
2
+
3
+ // Create a context to check if a component is inside an accordion group
4
+ export const AccordionGroupContext = createContext<{ inGroup: boolean } | null>(null);
@@ -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,30 +1,44 @@
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
+ import * as Icons from "lucide-react";
5
6
  import { cn } from '@/lib/utils';
7
+ import { AccordionGroupContext } from '@/components/contexts/AccordionContext';
6
8
 
7
9
  type AccordionProps = {
8
10
  title: string;
9
11
  children?: ReactNode;
10
12
  defaultOpen?: boolean;
11
- className?: string;
13
+ icon?: keyof typeof Icons;
12
14
  };
13
15
 
14
- const Accordion = ({
16
+ const Accordion: React.FC<AccordionProps> = ({
15
17
  title,
16
18
  children,
17
19
  defaultOpen = false,
18
- className,
20
+ icon,
19
21
  }: AccordionProps) => {
22
+ const groupContext = useContext(AccordionGroupContext);
23
+ const isInGroup = groupContext?.inGroup === true;
20
24
  const [isOpen, setIsOpen] = useState(defaultOpen);
25
+ const Icon = icon ? (Icons[icon] as React.FC<{ className?: string }>) : null;
21
26
 
27
+ // The main wrapper div for the accordion.
28
+ // All styling logic for the accordion container is handled here.
22
29
  return (
23
- <div className={cn("border rounded-lg overflow-hidden", className)}>
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
+ >
24
38
  <button
25
39
  type="button"
26
40
  onClick={() => setIsOpen(!isOpen)}
27
- className="flex items-center my-auto space-x-2 space-y-2 w-full px-4 h-12 transition-colors bg-background dark:hover:bg-muted/50 hover:bg-muted/15"
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"
28
42
  >
29
43
  <ChevronRight
30
44
  className={cn(
@@ -32,11 +46,12 @@ const Accordion = ({
32
46
  isOpen && "rotate-90"
33
47
  )}
34
48
  />
35
- <h3 className="font-medium text-base text-foreground pb-2">{title}</h3>
49
+ {Icon && <Icon className="text-foreground w-4 h-4"/> }
50
+ <h3 className="font-medium text-base text-foreground m-0">{title}</h3>
36
51
  </button>
37
52
 
38
53
  {isOpen && (
39
- <div className="px-4 py-3 border-t dark:bg-muted/50 bg-muted/15">
54
+ <div className="px-4 py-3 dark:bg-muted/10 bg-muted/15">
40
55
  {children}
41
56
  </div>
42
57
  )}
@@ -44,4 +59,4 @@ const Accordion = ({
44
59
  );
45
60
  };
46
61
 
47
- export default Accordion;
62
+ export default Accordion;
@@ -42,11 +42,11 @@ example note :
42
42
  displaying an image in markdown format :
43
43
 
44
44
  ```plaintext
45
- ![Alt text for the image](https://via.placeholder.com/150)
45
+ ![Alt text for the image](/images/example-img.png)
46
46
  ```
47
47
 
48
48
  render as :
49
- ![Alt text for the image](https://via.placeholder.com/150)
49
+ ![Alt text for the image](/images/example-img.png)
50
50
 
51
51
  For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
52
52
 
@@ -42,11 +42,11 @@ example note :
42
42
  displaying an image in markdown format :
43
43
 
44
44
  ```plaintext
45
- ![Alt text for the image](https://via.placeholder.com/150)
45
+ ![Alt text for the image](/images/example-img.png)
46
46
  ```
47
47
 
48
48
  render as :
49
- ![Alt text for the image](https://via.placeholder.com/150)
49
+ ![Alt text for the image](/images/example-img.png)
50
50
 
51
51
  For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
52
52
 
@@ -42,11 +42,11 @@ example note :
42
42
  displaying an image in markdown format :
43
43
 
44
44
  ```plaintext
45
- ![Alt text for the image](https://via.placeholder.com/150)
45
+ ![Alt text for the image](/images/example-img.png)
46
46
  ```
47
47
 
48
48
  render as :
49
- ![Alt text for the image](https://via.placeholder.com/150)
49
+ ![Alt text for the image](/images/example-img.png)
50
50
 
51
51
  For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
52
52
 
@@ -42,11 +42,11 @@ example note :
42
42
  displaying an image in markdown format :
43
43
 
44
44
  ```plaintext
45
- ![Alt text for the image](https://via.placeholder.com/150)
45
+ ![Alt text for the image](/images/example-img.png)
46
46
  ```
47
47
 
48
48
  render as :
49
- ![Alt text for the image](https://via.placeholder.com/150)
49
+ ![Alt text for the image](/images/example-img.png)
50
50
 
51
51
  For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
52
52
 
@@ -42,11 +42,11 @@ example note :
42
42
  displaying an image in markdown format :
43
43
 
44
44
  ```plaintext
45
- ![Alt text for the image](https://via.placeholder.com/150)
45
+ ![Alt text for the image](/images/example-img.png)
46
46
  ```
47
47
 
48
48
  render as :
49
- ![Alt text for the image](https://via.placeholder.com/150)
49
+ ![Alt text for the image](/images/example-img.png)
50
50
 
51
51
  For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
52
52
 
@@ -42,11 +42,11 @@ example note :
42
42
  displaying an image in markdown format :
43
43
 
44
44
  ```plaintext
45
- ![Alt text for the image](https://via.placeholder.com/150)
45
+ ![Alt text for the image](/images/example-img.png)
46
46
  ```
47
47
 
48
48
  render as :
49
- ![Alt text for the image](https://via.placeholder.com/150)
49
+ ![Alt text for the image](/images/example-img.png)
50
50
 
51
51
  For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
52
52
 
@@ -60,4 +60,15 @@ date : 10-12-2024
60
60
  image : example-img.png
61
61
  ---
62
62
  ```
63
- </Note>
63
+ </Note>
64
+
65
+ <Accordion title="Code Block" defaultOpen={true} icon="Code">
66
+ ```javascript:main.js showLineNumbers {3-4}
67
+ function isRocketAboutToCrash() {
68
+ // Check if the rocket is stable
69
+ if (!isStable()) {
70
+ NoCrash(); // Prevent the crash
71
+ }
72
+ }
73
+ ```
74
+ </Accordion>
@@ -42,11 +42,11 @@ example note :
42
42
  displaying an image in markdown format :
43
43
 
44
44
  ```plaintext
45
- ![Alt text for the image](https://via.placeholder.com/150)
45
+ ![Alt text for the image](/images/example-img.png)
46
46
  ```
47
47
 
48
48
  render as :
49
- ![Alt text for the image](https://via.placeholder.com/150)
49
+ ![Alt text for the image](/images/example-img.png)
50
50
 
51
51
  For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
52
52
 
@@ -70,14 +70,7 @@
70
70
  "items": [
71
71
  { "title": "Introduction", "href": "/introduction" },
72
72
  { "title": "Quick Start Guide", "href": "/quick-start-guide" },
73
- { "title": "Development", "href": "/development" },
74
- {
75
- "title": "Config",
76
- "href": "/config",
77
- "items": [
78
- { "title": "Sub Config", "href": "/subconfig" }
79
- ]
80
- }
73
+ { "title": "Development", "href": "/development" }
81
74
  ]
82
75
  },
83
76
  {
@@ -98,10 +91,10 @@
98
91
  },
99
92
  {
100
93
  "title": "Changelog",
101
- "href": "/Changelog",
94
+ "href": "/changelog",
102
95
  "noLink": true,
103
96
  "context": {
104
- "icon": "Hystory",
97
+ "icon": "History",
105
98
  "description": "Update and Changes",
106
99
  "title": "Release"
107
100
  },
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docubook",
3
- "version": "1.15.2",
3
+ "version": "1.16.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev",