@majapisoftwares/ui 4.0.5 → 4.0.6

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:w-auto md:rounded-md 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>
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
  }
package/package.json CHANGED
@@ -4,6 +4,6 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/majapisoftwares/ui.git"
6
6
  },
7
- "version": "4.0.5",
7
+ "version": "4.0.6",
8
8
  "type": "module"
9
9
  }