@majapisoftwares/ui 4.0.5 → 4.1.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.
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
type BaseBreadcrumbPage = {
|
|
3
|
+
href?: string;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type BreadcrumbPage = (BaseBreadcrumbPage & {
|
|
7
|
+
title: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
}) | (BaseBreadcrumbPage & {
|
|
10
|
+
title: ReactElement;
|
|
11
|
+
id: string;
|
|
12
|
+
});
|
|
1
13
|
export type BreadcrumbsProps = {
|
|
2
|
-
pages?:
|
|
3
|
-
title: string;
|
|
4
|
-
href?: string;
|
|
5
|
-
loading?: boolean;
|
|
6
|
-
}[];
|
|
14
|
+
pages?: Array<BreadcrumbPage>;
|
|
7
15
|
homeHref?: string;
|
|
8
16
|
className?: string;
|
|
9
17
|
loading?: boolean;
|
|
10
18
|
};
|
|
11
19
|
export default function Breadcrumbs({ pages, homeHref, className, loading, }: BreadcrumbsProps): import("react").JSX.Element | null;
|
|
20
|
+
export {};
|
|
@@ -8,35 +8,35 @@ export default function Breadcrumbs({ pages, homeHref = "/", className, loading,
|
|
|
8
8
|
if (!pages?.length) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
return (<nav className={clsx("flex", className)} aria-label="Breadcrumb">
|
|
12
|
-
<ol role="list" className="flex w-full space-x-4 bg-white px-6 shadow-sm dark:border-y dark:border-zinc-800 dark:bg-zinc-900 md:
|
|
13
|
-
<li className="flex">
|
|
14
|
-
<div className="flex items-center">
|
|
15
|
-
<NextLink href={homeHref} className="text-zinc-400 hover:text-zinc-500 dark:hover:text-zinc-200">
|
|
16
|
-
<HomeIcon className="h-5 w-5 shrink-0" aria-hidden="true"/>
|
|
17
|
-
<span className="sr-only">Home</span>
|
|
18
|
-
</NextLink>
|
|
19
|
-
</div>
|
|
20
|
-
</li>
|
|
11
|
+
return (<nav className={clsx("flex", className)} aria-label="Breadcrumb">
|
|
12
|
+
<ol role="list" className="flex w-full space-x-4 bg-white px-6 shadow-sm md:w-auto md:rounded-md dark:border-y dark:border-zinc-800 dark:bg-zinc-900 md:dark:border-x">
|
|
13
|
+
<li className="flex">
|
|
14
|
+
<div className="flex items-center">
|
|
15
|
+
<NextLink href={homeHref} className="text-zinc-400 hover:text-zinc-500 dark:hover:text-zinc-200">
|
|
16
|
+
<HomeIcon className="h-5 w-5 shrink-0" aria-hidden="true"/>
|
|
17
|
+
<span className="sr-only">Home</span>
|
|
18
|
+
</NextLink>
|
|
19
|
+
</div>
|
|
20
|
+
</li>
|
|
21
21
|
{pages.map((page, i) => {
|
|
22
22
|
const isLast = i === pages.length - 1;
|
|
23
|
-
return (<li key={page.title} className="flex">
|
|
24
|
-
<div className="flex items-center">
|
|
25
|
-
<svg className="h-full w-6 shrink-0 text-zinc-200 dark:text-zinc-800" viewBox="0 0 24 44" preserveAspectRatio="none" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
26
|
-
<path d="M.293 0l22 22-22 22h1.414l22-22-22-22H.293z"/>
|
|
27
|
-
</svg>
|
|
23
|
+
return (<li key={page.id || page.title.toString()} className="flex">
|
|
24
|
+
<div className="flex items-center">
|
|
25
|
+
<svg className="h-full w-6 shrink-0 text-zinc-200 dark:text-zinc-800" viewBox="0 0 24 44" preserveAspectRatio="none" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
26
|
+
<path d="M.293 0l22 22-22 22h1.414l22-22-22-22H.293z"/>
|
|
27
|
+
</svg>
|
|
28
28
|
<Text href={page.href} className={clsx("ml-4 text-sm font-medium text-zinc-500! dark:text-zinc-400!", {
|
|
29
29
|
"cursor-default": !page.href,
|
|
30
30
|
"hover:text-zinc-700! dark:hover:text-zinc-200!": !!page.href,
|
|
31
|
-
})} aria-current={isLast ? "page" : undefined}>
|
|
32
|
-
{page.loading ? (<Skeleton className="h-3 w-10"/>) : (page.title)}
|
|
33
|
-
</Text>
|
|
34
|
-
</div>
|
|
31
|
+
})} aria-current={isLast ? "page" : undefined}>
|
|
32
|
+
{page.loading ? (<Skeleton className="h-3 w-10"/>) : (page.title)}
|
|
33
|
+
</Text>
|
|
34
|
+
</div>
|
|
35
35
|
</li>);
|
|
36
|
-
})}
|
|
37
|
-
{loading && (<li className="ml-auto! flex items-center">
|
|
38
|
-
<Loading className="-mr-3 ml-4"/>
|
|
39
|
-
</li>)}
|
|
40
|
-
</ol>
|
|
36
|
+
})}
|
|
37
|
+
{loading && (<li className="ml-auto! flex items-center">
|
|
38
|
+
<Loading className="-mr-3 ml-4"/>
|
|
39
|
+
</li>)}
|
|
40
|
+
</ol>
|
|
41
41
|
</nav>);
|
|
42
42
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
1
|
+
import React, { ComponentProps } from "react";
|
|
2
|
+
import ReactMarkdown from "react-markdown";
|
|
3
3
|
export type MarkdownProps = {
|
|
4
4
|
children?: string;
|
|
5
5
|
className?: string;
|
|
6
|
-
options?:
|
|
6
|
+
options?: ComponentProps<typeof ReactMarkdown>;
|
|
7
7
|
};
|
|
8
8
|
export default function Markdown({ children, className, options, }: MarkdownProps): React.JSX.Element;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactMarkdown from "react-markdown";
|
|
2
3
|
import clsx from "../../utils/clsx";
|
|
3
|
-
import
|
|
4
|
+
import remarkGfm from "remark-gfm";
|
|
4
5
|
export default function Markdown({ children, className, options, }) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
__html: converter.makeHtml(children),
|
|
11
|
-
}
|
|
12
|
-
: undefined}/>);
|
|
6
|
+
return (<div className={clsx("prose prose-zinc dark:prose-invert max-w-full", "[&_.contains-task-list]:list-none [&_.contains-task-list]:pl-0", "[&_.task-list-item_input[type='checkbox']]:-mt-1", className)}>
|
|
7
|
+
<ReactMarkdown remarkPlugins={[remarkGfm, ...(options?.remarkPlugins || [])]} {...options}>
|
|
8
|
+
{children}
|
|
9
|
+
</ReactMarkdown>
|
|
10
|
+
</div>);
|
|
13
11
|
}
|