@dust-tt/sparkle 0.2.213 → 0.2.214-pr
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/dist/cjs/_index.d.ts +2 -0
- package/dist/cjs/components/Breadcrumbs.d.ts +13 -0
- package/dist/cjs/index.js +2747 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stories/Breadcrumbs.stories.d.ts +8 -0
- package/dist/esm/_index.d.ts +2 -0
- package/dist/esm/components/Breadcrumbs.d.ts +13 -0
- package/dist/esm/index.js +2743 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stories/Breadcrumbs.stories.d.ts +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/_index.ts +3 -0
- package/src/components/Breadcrumbs.tsx +52 -0
- package/src/stories/Breadcrumbs.stories.tsx +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dust-tt/sparkle",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.214-pr",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "rm -rf dist && rollup -c",
|
|
6
6
|
"build:with-tw-base": "rollup -c --environment INCLUDE_TW_BASE:true",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"eslint-plugin-simple-import-sort": "^12.1.0",
|
|
51
51
|
"eslint-plugin-storybook": "^0.8.0",
|
|
52
52
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
53
|
+
"next": "^14.2.3",
|
|
53
54
|
"prettier": "^3.0",
|
|
54
55
|
"prettier-plugin-tailwindcss": "^0.6.5",
|
|
55
56
|
"react": "^18.3.1",
|
package/src/_index.ts
CHANGED
|
@@ -148,6 +148,9 @@ export { Markdown };
|
|
|
148
148
|
import { DataTable } from "./components/DataTable";
|
|
149
149
|
export { DataTable };
|
|
150
150
|
|
|
151
|
+
import { Breadcrumbs } from "@sparkle/components/Breadcrumbs";
|
|
152
|
+
export { Breadcrumbs };
|
|
153
|
+
|
|
151
154
|
import {
|
|
152
155
|
LogoHorizontalColor as LogoHorizontalColorLogo,
|
|
153
156
|
LogoHorizontalColorLayer1 as LogoHorizontalColorLogoLayer1,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import type { ComponentType } from "react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
import { ChevronRightIcon, Icon } from "@sparkle/index";
|
|
6
|
+
|
|
7
|
+
type BreadcrumbProps = {
|
|
8
|
+
items: {
|
|
9
|
+
label: string;
|
|
10
|
+
icon?: ComponentType<{ className?: string }>;
|
|
11
|
+
href?: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function Breadcrumbs({ items }: BreadcrumbProps) {
|
|
16
|
+
return (
|
|
17
|
+
<div className="gap-2 s-flex s-flex-row s-items-center">
|
|
18
|
+
{items.map((item, index) => (
|
|
19
|
+
<div key={index} className="s-flex s-flex-row s-items-center s-gap-1">
|
|
20
|
+
<Icon visual={item.icon} className="s-text-brand" />
|
|
21
|
+
<div>
|
|
22
|
+
{item.href ? (
|
|
23
|
+
<Link
|
|
24
|
+
href={item.href}
|
|
25
|
+
className={
|
|
26
|
+
index === items.length - 1
|
|
27
|
+
? "s-text-element-900"
|
|
28
|
+
: "s-text-element-700"
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
{item.label}
|
|
32
|
+
</Link>
|
|
33
|
+
) : (
|
|
34
|
+
<span
|
|
35
|
+
className={
|
|
36
|
+
index === items.length - 1
|
|
37
|
+
? "s-text-element-900"
|
|
38
|
+
: "s-text-element-700"
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
{item.label}
|
|
42
|
+
</span>
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
{index === items.length - 1 ? null : (
|
|
46
|
+
<ChevronRightIcon className="s-text-element-500" />
|
|
47
|
+
)}
|
|
48
|
+
</div>
|
|
49
|
+
))}
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import { Breadcrumbs, CompanyIcon, HomeIcon } from "../index_with_tw_base";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Components/Breadcrumbs",
|
|
8
|
+
component: Breadcrumbs,
|
|
9
|
+
} satisfies Meta<typeof Breadcrumbs>;
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
export const BreadcrumbsExample = () => {
|
|
14
|
+
const items1 = [
|
|
15
|
+
{ label: "Home", href: "#", icon: HomeIcon },
|
|
16
|
+
{ label: "Vaults", href: "#" },
|
|
17
|
+
{ label: "My Vault" },
|
|
18
|
+
];
|
|
19
|
+
const items2 = [
|
|
20
|
+
{ label: "Home", href: "#", icon: HomeIcon },
|
|
21
|
+
{ label: "Vaults", href: "#", icon: CompanyIcon },
|
|
22
|
+
{ label: "My Vault", href: "#" },
|
|
23
|
+
{ label: "Data Sources" },
|
|
24
|
+
];
|
|
25
|
+
return (
|
|
26
|
+
<div className="s-flex s-flex-col s-gap-4">
|
|
27
|
+
<Breadcrumbs items={items1} />
|
|
28
|
+
<Breadcrumbs items={items2} />
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|