@dust-tt/sparkle 0.2.212 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.2.212",
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
+ }
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { ComponentType } from "react";
2
2
 
3
3
  import { classNames } from "@sparkle/lib/utils";
4
4
 
@@ -19,6 +19,7 @@ export interface ContentMessageProps {
19
19
  | "pink"
20
20
  | "action"
21
21
  | "red";
22
+ icon?: ComponentType;
22
23
  }
23
24
 
24
25
  export function ContentMessage({
@@ -27,6 +28,7 @@ export function ContentMessage({
27
28
  children,
28
29
  size = "md",
29
30
  className = "",
31
+ icon,
30
32
  }: ContentMessageProps) {
31
33
  const variantClasses = {
32
34
  border: `s-border-${variant}-200`,
@@ -52,7 +54,7 @@ export function ContentMessage({
52
54
  <>
53
55
  <Icon
54
56
  size="md"
55
- visual={InformationCircleIcon}
57
+ visual={icon ?? InformationCircleIcon}
56
58
  className={classNames("s-shrink-0", variantClasses.iconColor)}
57
59
  />
58
60
  <div className="s-flex s-flex-col s-gap-2">
@@ -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
+ };
@@ -1,7 +1,7 @@
1
1
  import type { Meta } from "@storybook/react";
2
2
  import React from "react";
3
3
 
4
- import { ContentMessage } from "../index_with_tw_base";
4
+ import { ContentMessage, HeartIcon } from "../index_with_tw_base";
5
5
 
6
6
  const meta = {
7
7
  title: "Components/ContentMessage",
@@ -19,8 +19,8 @@ export const ContentExample = () => (
19
19
  <ContentMessage title="This is a title" variant="pink">
20
20
  This is a message. It can be multiple lines long.
21
21
  </ContentMessage>
22
- <ContentMessage title="This is a title" variant="emerald">
23
- This is a message. It can be multiple lines long.
22
+ <ContentMessage title="This is a cat" variant="purple" icon={HeartIcon}>
23
+ This is a Soupinou. It is cute.
24
24
  </ContentMessage>
25
25
  <h2>Size "sm"</h2>
26
26
  <ContentMessage title="This is a title" size="sm">