@langchain/macaw-components 1.3.4 → 1.4.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/dist/catalog.json +581 -537
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +19 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +83 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/index.js +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -1
- package/dist/index.js +2 -1
- package/dist/utilities.css +1 -1
- package/docs/DESIGN.md +19 -0
- package/package.json +6 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
import type { IconComponent } from '../../utils/icon-types.js';
|
|
3
|
+
import type { LinkProps } from '../Link/index.js';
|
|
4
|
+
type BreadcrumbProps = ComponentPropsWithoutRef<'nav'> & {
|
|
5
|
+
separator?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
type BreadcrumbLinkProps = LinkProps;
|
|
8
|
+
type BreadcrumbPageProps = ComponentPropsWithoutRef<'span'> & {
|
|
9
|
+
leftDecorator?: IconComponent;
|
|
10
|
+
};
|
|
11
|
+
declare const Breadcrumb: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
12
|
+
separator?: ReactNode;
|
|
13
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
14
|
+
declare const BreadcrumbLink: import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
15
|
+
declare const BreadcrumbPage: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
16
|
+
leftDecorator?: IconComponent;
|
|
17
|
+
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
18
|
+
export { Breadcrumb, BreadcrumbLink, BreadcrumbPage };
|
|
19
|
+
export type { BreadcrumbProps, BreadcrumbLinkProps, BreadcrumbPageProps };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Text } from "../Text/Text.js";
|
|
3
|
+
import { Children, cloneElement, forwardRef } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region packages/components/src/components/Breadcrumb/Breadcrumb.tsx
|
|
6
|
+
var Breadcrumb = forwardRef(({ children, className, separator = "/", ...props }, ref) => {
|
|
7
|
+
const items = Children.toArray(children).filter((item) => item !== "");
|
|
8
|
+
if (!items.length) return null;
|
|
9
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
10
|
+
ref,
|
|
11
|
+
"aria-label": "Breadcrumb",
|
|
12
|
+
className: cn("min-w-0", className),
|
|
13
|
+
...props,
|
|
14
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
15
|
+
role: "list",
|
|
16
|
+
className: "flex flex-wrap items-center gap-space-2",
|
|
17
|
+
children: items.map((item, index) => /* @__PURE__ */ jsxs("li", {
|
|
18
|
+
className: "flex min-w-0 max-w-full items-center gap-space-2",
|
|
19
|
+
children: [index > 0 && /* @__PURE__ */ jsx("span", {
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
className: "shrink-0 text-xxs text-quaternary",
|
|
22
|
+
children: separator
|
|
23
|
+
}), item]
|
|
24
|
+
}, typeof item === "object" && "key" in item ? item.key : index))
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
29
|
+
var BreadcrumbLink = forwardRef(({ children, className, as, leftDecorator: LeftIcon, rightDecorator: RightIcon, iconWeight = "regular", variant = "xs", ...props }, ref) => {
|
|
30
|
+
const linkProps = {
|
|
31
|
+
...typeof children === "string" && as?.props.title === void 0 ? { title: children } : {},
|
|
32
|
+
...props,
|
|
33
|
+
ref,
|
|
34
|
+
className: cn("inline-flex min-w-0 items-center gap-space-1 rounded-sm text-quaternary hover:text-secondary hover:underline underline-offset-2 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-focus", as?.props.className, className),
|
|
35
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
36
|
+
LeftIcon && /* @__PURE__ */ jsx(LeftIcon, {
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
size: 12,
|
|
39
|
+
weight: iconWeight,
|
|
40
|
+
className: "shrink-0"
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ jsx(Text, {
|
|
43
|
+
as: "span",
|
|
44
|
+
variant,
|
|
45
|
+
weight: "medium",
|
|
46
|
+
className: "min-w-0 max-w-50 truncate",
|
|
47
|
+
children
|
|
48
|
+
}),
|
|
49
|
+
RightIcon && /* @__PURE__ */ jsx(RightIcon, {
|
|
50
|
+
"aria-hidden": true,
|
|
51
|
+
size: 12,
|
|
52
|
+
weight: iconWeight,
|
|
53
|
+
className: "shrink-0"
|
|
54
|
+
})
|
|
55
|
+
] })
|
|
56
|
+
};
|
|
57
|
+
return as ? cloneElement(as, linkProps) : /* @__PURE__ */ jsx("a", { ...linkProps });
|
|
58
|
+
});
|
|
59
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
60
|
+
var BreadcrumbPage = forwardRef(({ children, className, leftDecorator: LeftIcon, ...props }, ref) => /* @__PURE__ */ jsxs("span", {
|
|
61
|
+
ref,
|
|
62
|
+
"aria-current": "page",
|
|
63
|
+
title: typeof children === "string" ? children : void 0,
|
|
64
|
+
className: cn("inline-flex min-w-0 items-center gap-space-1 text-secondary", className),
|
|
65
|
+
...props,
|
|
66
|
+
children: [LeftIcon && /* @__PURE__ */ jsx(LeftIcon, {
|
|
67
|
+
"aria-hidden": true,
|
|
68
|
+
size: 12,
|
|
69
|
+
weight: "regular",
|
|
70
|
+
className: "shrink-0"
|
|
71
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
72
|
+
as: "span",
|
|
73
|
+
variant: "xs",
|
|
74
|
+
weight: "medium",
|
|
75
|
+
className: "min-w-0 max-w-50 truncate",
|
|
76
|
+
children
|
|
77
|
+
})]
|
|
78
|
+
}));
|
|
79
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
80
|
+
//#endregion
|
|
81
|
+
export { Breadcrumb, BreadcrumbLink, BreadcrumbPage };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=Breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","names":[],"sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n forwardRef,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\n\nimport { cn } from '../../utils/cn';\nimport type { IconComponent } from '../../utils/icon-types';\nimport type { LinkProps } from '../Link';\nimport { Text } from '../Text';\n\ntype BreadcrumbProps = ComponentPropsWithoutRef<'nav'> & {\n separator?: ReactNode;\n};\n\ntype BreadcrumbLinkProps = LinkProps;\n\ntype BreadcrumbPageProps = ComponentPropsWithoutRef<'span'> & {\n leftDecorator?: IconComponent;\n};\n\nconst Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(\n ({ children, className, separator = '/', ...props }, ref) => {\n const items = Children.toArray(children).filter((item) => item !== '');\n if (!items.length) return null;\n\n return (\n <nav\n ref={ref}\n aria-label=\"Breadcrumb\"\n className={cn('min-w-0', className)}\n {...props}\n >\n <ol role=\"list\" className=\"flex flex-wrap items-center gap-space-2\">\n {items.map((item, index) => (\n <li\n key={typeof item === 'object' && 'key' in item ? item.key : index}\n className=\"flex min-w-0 max-w-full items-center gap-space-2\"\n >\n {index > 0 && (\n <span\n aria-hidden=\"true\"\n className=\"shrink-0 text-xxs text-quaternary\"\n >\n {separator}\n </span>\n )}\n {item}\n </li>\n ))}\n </ol>\n </nav>\n );\n }\n);\nBreadcrumb.displayName = 'Breadcrumb';\n\nconst BreadcrumbLink = forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(\n (\n {\n children,\n className,\n as,\n leftDecorator: LeftIcon,\n rightDecorator: RightIcon,\n iconWeight = 'regular',\n variant = 'xs',\n ...props\n },\n ref\n ) => {\n const linkProps = {\n ...(typeof children === 'string' && as?.props.title === undefined\n ? { title: children }\n : {}),\n ...props,\n ref,\n className: cn(\n 'inline-flex min-w-0 items-center gap-space-1 rounded-sm text-quaternary hover:text-secondary hover:underline underline-offset-2 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-focus',\n as?.props.className,\n className\n ),\n children: (\n <>\n {LeftIcon && (\n <LeftIcon\n aria-hidden\n size={12}\n weight={iconWeight}\n className=\"shrink-0\"\n />\n )}\n <Text\n as=\"span\"\n variant={variant}\n weight=\"medium\"\n className=\"min-w-0 max-w-50 truncate\"\n >\n {children}\n </Text>\n {RightIcon && (\n <RightIcon\n aria-hidden\n size={12}\n weight={iconWeight}\n className=\"shrink-0\"\n />\n )}\n </>\n ),\n };\n\n return as ? cloneElement(as, linkProps) : <a {...linkProps} />;\n }\n);\nBreadcrumbLink.displayName = 'BreadcrumbLink';\n\nconst BreadcrumbPage = forwardRef<HTMLSpanElement, BreadcrumbPageProps>(\n ({ children, className, leftDecorator: LeftIcon, ...props }, ref) => (\n <span\n ref={ref}\n aria-current=\"page\"\n title={typeof children === 'string' ? children : undefined}\n className={cn(\n 'inline-flex min-w-0 items-center gap-space-1 text-secondary',\n className\n )}\n {...props}\n >\n {LeftIcon && (\n <LeftIcon aria-hidden size={12} weight=\"regular\" className=\"shrink-0\" />\n )}\n <Text\n as=\"span\"\n variant=\"xs\"\n weight=\"medium\"\n className=\"min-w-0 max-w-50 truncate\"\n >\n {children}\n </Text>\n </span>\n )\n);\nBreadcrumbPage.displayName = 'BreadcrumbPage';\n\nexport { Breadcrumb, BreadcrumbLink, BreadcrumbPage };\nexport type { BreadcrumbProps, BreadcrumbLinkProps, BreadcrumbPageProps };\n"],"mappings":";;;;;AAuBA,IAAM,aAAa,YAChB,EAAE,UAAU,WAAW,YAAY,KAAK,GAAG,SAAS,QAAQ;CAC3D,MAAM,QAAQ,SAAS,QAAQ,QAAQ,CAAC,CAAC,QAAQ,SAAS,SAAS,EAAE;CACrE,IAAI,CAAC,MAAM,QAAQ,OAAO;CAE1B,OACE,oBAAC,OAAD;EACO;EACL,cAAW;EACX,WAAW,GAAG,WAAW,SAAS;EAClC,GAAI;EAEJ,UAAA,oBAAC,MAAD;GAAI,MAAK;GAAO,WAAU;GACvB,UAAA,MAAM,KAAK,MAAM,UAChB,qBAAC,MAAD;IAEE,WAAU;IAFZ,UAAA,CAIG,QAAQ,KACP,oBAAC,QAAD;KACE,eAAY;KACZ,WAAU;KAET,UAAA;IACG,CAAA,GAEP,IACC;GAZG,GAAA,OAAO,SAAS,YAAY,SAAS,OAAO,KAAK,MAAM,KAY1D,CACL;EACC,CAAA;CACD,CAAA;AAET,CACF;AACA,WAAW,cAAc;AAEzB,IAAM,iBAAiB,YAEnB,EACE,UACA,WACA,IACA,eAAe,UACf,gBAAgB,WAChB,aAAa,WACb,UAAU,MACV,GAAG,SAEL,QACG;CACH,MAAM,YAAY;EAChB,GAAI,OAAO,aAAa,YAAY,IAAI,MAAM,UAAU,KAAA,IACpD,EAAE,OAAO,SAAS,IAClB,CAAC;EACL,GAAG;EACH;EACA,WAAW,GACT,8MACA,IAAI,MAAM,WACV,SACF;EACA,UACE,qBAAA,YAAA,EAAA,UAAA;GACG,YACC,oBAAC,UAAD;IACE,eAAA;IACA,MAAM;IACN,QAAQ;IACR,WAAU;GACX,CAAA;GAEH,oBAAC,MAAD;IACE,IAAG;IACM;IACT,QAAO;IACP,WAAU;IAET;GACG,CAAA;GACL,aACC,oBAAC,WAAD;IACE,eAAA;IACA,MAAM;IACN,QAAQ;IACR,WAAU;GACX,CAAA;EAEH,EAAA,CAAA;CAEN;CAEA,OAAO,KAAK,aAAa,IAAI,SAAS,IAAI,oBAAC,KAAD,EAAG,GAAI,UAAY,CAAA;AAC/D,CACF;AACA,eAAe,cAAc;AAE7B,IAAM,iBAAiB,YACpB,EAAE,UAAU,WAAW,eAAe,UAAU,GAAG,SAAS,QAC3D,qBAAC,QAAD;CACO;CACL,gBAAa;CACb,OAAO,OAAO,aAAa,WAAW,WAAW,KAAA;CACjD,WAAW,GACT,+DACA,SACF;CACA,GAAI;CARN,UAAA,CAUG,YACC,oBAAC,UAAD;EAAU,eAAA;EAAY,MAAM;EAAI,QAAO;EAAU,WAAU;CAAY,CAAA,GAEzE,oBAAC,MAAD;EACE,IAAG;EACH,SAAQ;EACR,QAAO;EACP,WAAU;EAET;CACG,CAAA,CACF;AAEV,CAAA,CAAA;AACA,eAAe,cAAc"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { Breadcrumb, BreadcrumbLink, BreadcrumbPage } from './Breadcrumb/index.js';
|
|
2
|
+
export type { BreadcrumbProps, BreadcrumbLinkProps, BreadcrumbPageProps, } from './Breadcrumb/index.js';
|
|
1
3
|
export { Button } from './Button/index.js';
|
|
2
4
|
export type { ButtonProps } from './Button/index.js';
|
|
3
5
|
export { ButtonGroup } from './ButtonGroup/index.js';
|
package/dist/components/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Icon } from "./Icon/Icon.js";
|
|
|
10
10
|
import { Attachment } from "./Attachment/Attachment.js";
|
|
11
11
|
import { AttachmentList } from "./Attachment/AttachmentList.js";
|
|
12
12
|
import { Banner } from "./Banner/Banner.js";
|
|
13
|
+
import { Breadcrumb, BreadcrumbLink, BreadcrumbPage } from "./Breadcrumb/Breadcrumb.js";
|
|
13
14
|
import { ButtonGroup } from "./ButtonGroup/ButtonGroup.js";
|
|
14
15
|
import { Card } from "./Card/Card.js";
|
|
15
16
|
import { Link } from "./Link/Link.js";
|
|
@@ -40,4 +41,4 @@ import { Slider } from "./Slider/Slider.js";
|
|
|
40
41
|
import { StatusBadge } from "./StatusBadge/StatusBadge.js";
|
|
41
42
|
import { Switch } from "./Switch/Switch.js";
|
|
42
43
|
import { Textarea } from "./Textarea/Textarea.js";
|
|
43
|
-
export { Attachment, AttachmentList, Avatar, Badge, Banner, Button, ButtonGroup, Card, ChartTooltip, ChartTooltipBody, ChartTooltipHeader, ChartTooltipRow, ChatMessage, ChatMessageActions, ChatMessageBody, ChatMessageHeader, ChatTurnDivider, Checkbox, CircleSkeleton, Divider, EmptyState, ErrorState, GroupedTabs, HeatmapBlock, HeatmapChart, Icon, IconButton, ImagePreviewBlock, ImagePreviewDialog, Input, Kbd, KbdGroup, LinearProgress, Link, MetricChart, ProgressBar, RadioButton, RadioCard, RadioGroup, RadioGroupItem, Skeleton, SkeletonRows, Slider, Spinner, SpinnerIcon, StatusBadge, Switch, Text, Textarea, Tooltip, TooltipProvider, formatMetricCurrency, formatMetricDate, formatMetricDuration, formatMetricNumber, formatMetricTime, getCheckedState };
|
|
44
|
+
export { Attachment, AttachmentList, Avatar, Badge, Banner, Breadcrumb, BreadcrumbLink, BreadcrumbPage, Button, ButtonGroup, Card, ChartTooltip, ChartTooltipBody, ChartTooltipHeader, ChartTooltipRow, ChatMessage, ChatMessageActions, ChatMessageBody, ChatMessageHeader, ChatTurnDivider, Checkbox, CircleSkeleton, Divider, EmptyState, ErrorState, GroupedTabs, HeatmapBlock, HeatmapChart, Icon, IconButton, ImagePreviewBlock, ImagePreviewDialog, Input, Kbd, KbdGroup, LinearProgress, Link, MetricChart, ProgressBar, RadioButton, RadioCard, RadioGroup, RadioGroupItem, Skeleton, SkeletonRows, Slider, Spinner, SpinnerIcon, StatusBadge, Switch, Text, Textarea, Tooltip, TooltipProvider, formatMetricCurrency, formatMetricDate, formatMetricDuration, formatMetricNumber, formatMetricTime, getCheckedState };
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Icon } from "./components/Icon/Icon.js";
|
|
|
10
10
|
import { Attachment } from "./components/Attachment/Attachment.js";
|
|
11
11
|
import { AttachmentList } from "./components/Attachment/AttachmentList.js";
|
|
12
12
|
import { Banner } from "./components/Banner/Banner.js";
|
|
13
|
+
import { Breadcrumb, BreadcrumbLink, BreadcrumbPage } from "./components/Breadcrumb/Breadcrumb.js";
|
|
13
14
|
import { ButtonGroup } from "./components/ButtonGroup/ButtonGroup.js";
|
|
14
15
|
import { Card } from "./components/Card/Card.js";
|
|
15
16
|
import { Link } from "./components/Link/Link.js";
|
|
@@ -41,4 +42,4 @@ import { StatusBadge } from "./components/StatusBadge/StatusBadge.js";
|
|
|
41
42
|
import { Switch } from "./components/Switch/Switch.js";
|
|
42
43
|
import { Textarea } from "./components/Textarea/Textarea.js";
|
|
43
44
|
import "./components/index.js";
|
|
44
|
-
export { Attachment, AttachmentList, Avatar, Badge, Banner, Button, ButtonGroup, Card, ChartTooltip, ChartTooltipBody, ChartTooltipHeader, ChartTooltipRow, ChatMessage, ChatMessageActions, ChatMessageBody, ChatMessageHeader, ChatTurnDivider, Checkbox, CircleSkeleton, Divider, EmptyState, ErrorState, GroupedTabs, HeatmapBlock, HeatmapChart, Icon, IconButton, ImagePreviewBlock, ImagePreviewDialog, Input, Kbd, KbdGroup, LinearProgress, Link, MetricChart, ProgressBar, RadioButton, RadioCard, RadioGroup, RadioGroupItem, Skeleton, SkeletonRows, Slider, Spinner, SpinnerIcon, StatusBadge, Switch, Text, Textarea, Tooltip, TooltipProvider, formatMetricCurrency, formatMetricDate, formatMetricDuration, formatMetricNumber, formatMetricTime, getCheckedState };
|
|
45
|
+
export { Attachment, AttachmentList, Avatar, Badge, Banner, Breadcrumb, BreadcrumbLink, BreadcrumbPage, Button, ButtonGroup, Card, ChartTooltip, ChartTooltipBody, ChartTooltipHeader, ChartTooltipRow, ChatMessage, ChatMessageActions, ChatMessageBody, ChatMessageHeader, ChatTurnDivider, Checkbox, CircleSkeleton, Divider, EmptyState, ErrorState, GroupedTabs, HeatmapBlock, HeatmapChart, Icon, IconButton, ImagePreviewBlock, ImagePreviewDialog, Input, Kbd, KbdGroup, LinearProgress, Link, MetricChart, ProgressBar, RadioButton, RadioCard, RadioGroup, RadioGroupItem, Skeleton, SkeletonRows, Slider, Spinner, SpinnerIcon, StatusBadge, Switch, Text, Textarea, Tooltip, TooltipProvider, formatMetricCurrency, formatMetricDate, formatMetricDuration, formatMetricNumber, formatMetricTime, getCheckedState };
|