@langchain/macaw-components 1.5.2 → 1.6.1

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.
Files changed (35) hide show
  1. package/dist/catalog.json +754 -683
  2. package/dist/components/ChartCard/ChartCardSkeleton.d.ts +1 -1
  3. package/dist/components/ChartCard/ChartCardSkeleton.js +50 -1
  4. package/dist/components/ChartCard/ChartCardSkeleton.js.map +1 -1
  5. package/dist/components/ChatRichContent/ChatRichContent.d.ts +4 -0
  6. package/dist/components/ChatRichContent/ChatRichContent.js +315 -0
  7. package/dist/components/ChatRichContent/ChatRichContent.js.map +1 -0
  8. package/dist/components/ChatRichContent/ChatRichContent.types.d.ts +101 -0
  9. package/dist/components/ChatRichContent/ChatRichContent.types.js +0 -0
  10. package/dist/components/ChatRichContent/ChatRichContentChoices.d.ts +2 -0
  11. package/dist/components/ChatRichContent/ChatRichContentChoices.js +121 -0
  12. package/dist/components/ChatRichContent/ChatRichContentChoices.js.map +1 -0
  13. package/dist/components/ChatRichContent/ChatRichContentCollapsible.d.ts +10 -0
  14. package/dist/components/ChatRichContent/ChatRichContentCollapsible.js +23 -0
  15. package/dist/components/ChatRichContent/ChatRichContentCollapsible.js.map +1 -0
  16. package/dist/components/ChatRichContent/ChatRichContentQuestionNav.d.ts +7 -0
  17. package/dist/components/ChatRichContent/ChatRichContentQuestionNav.js +53 -0
  18. package/dist/components/ChatRichContent/ChatRichContentQuestionNav.js.map +1 -0
  19. package/dist/components/ChatRichContent/ChatRichContentStatus.d.ts +11 -0
  20. package/dist/components/ChatRichContent/ChatRichContentStatus.js +31 -0
  21. package/dist/components/ChatRichContent/ChatRichContentStatus.js.map +1 -0
  22. package/dist/components/ChatRichContent/index.d.ts +3 -0
  23. package/dist/components/ChatRichContent/index.js +3 -0
  24. package/dist/components/RadarChart/RadarChart.d.ts +85 -0
  25. package/dist/components/RadarChart/RadarChart.js +357 -0
  26. package/dist/components/RadarChart/RadarChart.js.map +1 -0
  27. package/dist/components/RadarChart/index.d.ts +2 -0
  28. package/dist/components/RadarChart/index.js +2 -0
  29. package/dist/components/index.d.ts +2 -0
  30. package/dist/components/index.js +7 -5
  31. package/dist/index.js +7 -5
  32. package/dist/utilities.css +1 -1
  33. package/docs/DESIGN.md +26 -0
  34. package/docs/STYLES.md +39 -39
  35. package/package.json +10 -2
@@ -0,0 +1,121 @@
1
+ import { Checkbox } from "../Checkbox/Checkbox.js";
2
+ import { Input } from "../Input/Input.js";
3
+ import { RadioButton } from "../RadioButton/RadioButton.js";
4
+ import { RadioGroup } from "../RadioGroup/RadioGroup.js";
5
+ import { useRef } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region packages/components/src/components/ChatRichContent/ChatRichContentChoices.tsx
8
+ function ChatRichContentChoices({ mode, options, value, onChange, "aria-label": label, "aria-describedby": describedBy, allowCustom = false, customInput = "inline", onCustomSelect, disabled = false, isError = false }) {
9
+ const focusCustomInput = useRef(false);
10
+ const customSelected = allowCustom && value.custom?.selected === true;
11
+ function selectCustom(selected) {
12
+ if (disabled) return;
13
+ focusCustomInput.current = customInput === "inline" && selected && !customSelected;
14
+ onChange({
15
+ selected: mode === "single" ? [] : value.selected,
16
+ custom: {
17
+ selected,
18
+ text: value.custom?.text ?? ""
19
+ }
20
+ });
21
+ if (selected) onCustomSelect?.();
22
+ }
23
+ const showCustomInput = customSelected && customInput === "inline";
24
+ const customLabelProps = showCustomInput ? { "aria-label": "Something else…" } : { label: "Something else…" };
25
+ const customTextInput = showCustomInput && /* @__PURE__ */ jsx(Input, {
26
+ ref: (element) => {
27
+ if (element && focusCustomInput.current && !disabled) {
28
+ element.focus();
29
+ focusCustomInput.current = false;
30
+ }
31
+ },
32
+ "aria-label": `${label} — Something else`,
33
+ "aria-describedby": describedBy,
34
+ placeholder: "Something else…",
35
+ size: "sm",
36
+ variant: "plain",
37
+ className: "min-w-0 flex-1",
38
+ debounceMs: 0,
39
+ disabled,
40
+ isError,
41
+ value: value.custom?.text ?? "",
42
+ onChange: (text) => {
43
+ if (disabled) return;
44
+ onChange({
45
+ ...value,
46
+ custom: {
47
+ selected: true,
48
+ text
49
+ }
50
+ });
51
+ }
52
+ });
53
+ return mode === "single" ? /* @__PURE__ */ jsxs(RadioGroup, {
54
+ "aria-label": label,
55
+ "aria-describedby": describedBy,
56
+ "aria-invalid": isError || void 0,
57
+ disabled,
58
+ className: "flex flex-col gap-space-1",
59
+ value: customSelected ? "custom" : value.selected[0] === void 0 ? "" : `option:${value.selected[0]}`,
60
+ onValueChange: (next) => {
61
+ if (disabled) return;
62
+ if (next === "custom") {
63
+ selectCustom(true);
64
+ return;
65
+ }
66
+ focusCustomInput.current = false;
67
+ onChange({
68
+ selected: [next.slice(7)],
69
+ ...value.custom && { custom: {
70
+ ...value.custom,
71
+ selected: false
72
+ } }
73
+ });
74
+ },
75
+ children: [options.map((option) => /* @__PURE__ */ jsx(RadioButton, {
76
+ value: `option:${option.value}`,
77
+ label: option.label,
78
+ disabled,
79
+ className: "min-h-6"
80
+ }, option.value)), allowCustom && /* @__PURE__ */ jsxs("div", {
81
+ className: "flex min-h-6 min-w-0 items-center gap-space-2",
82
+ children: [/* @__PURE__ */ jsx(RadioButton, {
83
+ value: "custom",
84
+ ...customLabelProps,
85
+ disabled
86
+ }), customTextInput]
87
+ })]
88
+ }) : /* @__PURE__ */ jsxs("div", {
89
+ role: "group",
90
+ "aria-label": label,
91
+ "aria-describedby": describedBy,
92
+ className: "flex flex-col gap-space-1",
93
+ children: [options.map((option) => /* @__PURE__ */ jsx(Checkbox, {
94
+ label: option.label,
95
+ checked: value.selected.includes(option.value),
96
+ "aria-invalid": isError || void 0,
97
+ disabled,
98
+ containerClassName: "min-h-6",
99
+ onCheckedChange: (checked) => {
100
+ if (disabled) return;
101
+ onChange({
102
+ ...value,
103
+ selected: checked === true ? [...value.selected, option.value] : value.selected.filter((item) => item !== option.value)
104
+ });
105
+ }
106
+ }, option.value)), allowCustom && /* @__PURE__ */ jsxs("div", {
107
+ className: "flex min-h-6 min-w-0 items-center gap-space-2",
108
+ children: [/* @__PURE__ */ jsx(Checkbox, {
109
+ ...customLabelProps,
110
+ checked: customSelected,
111
+ "aria-invalid": isError || void 0,
112
+ disabled,
113
+ onCheckedChange: (checked) => selectCustom(checked === true)
114
+ }), customTextInput]
115
+ })]
116
+ });
117
+ }
118
+ //#endregion
119
+ export { ChatRichContentChoices };
120
+
121
+ //# sourceMappingURL=ChatRichContentChoices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatRichContentChoices.js","names":[],"sources":["../../../src/components/ChatRichContent/ChatRichContentChoices.tsx"],"sourcesContent":["import { useRef } from 'react';\n\nimport { Checkbox } from '../Checkbox';\nimport { Input } from '../Input';\nimport { RadioButton } from '../RadioButton';\nimport { RadioGroup } from '../RadioGroup';\nimport type { ChatRichContentChoicesProps } from './ChatRichContent.types';\n\nexport function ChatRichContentChoices({\n mode,\n options,\n value,\n onChange,\n 'aria-label': label,\n 'aria-describedby': describedBy,\n allowCustom = false,\n customInput = 'inline',\n onCustomSelect,\n disabled = false,\n isError = false,\n}: ChatRichContentChoicesProps) {\n const focusCustomInput = useRef(false);\n const customSelected = allowCustom && value.custom?.selected === true;\n\n function selectCustom(selected: boolean) {\n if (disabled) return;\n focusCustomInput.current =\n customInput === 'inline' && selected && !customSelected;\n onChange({\n selected: mode === 'single' ? [] : value.selected,\n custom: { selected, text: value.custom?.text ?? '' },\n });\n if (selected) onCustomSelect?.();\n }\n\n const showCustomInput = customSelected && customInput === 'inline';\n const customLabelProps = showCustomInput\n ? { 'aria-label': 'Something else…' }\n : { label: 'Something else…' };\n const customTextInput = showCustomInput && (\n <Input\n ref={(element) => {\n if (element && focusCustomInput.current && !disabled) {\n element.focus();\n focusCustomInput.current = false;\n }\n }}\n aria-label={`${label} — Something else`}\n aria-describedby={describedBy}\n placeholder=\"Something else…\"\n size=\"sm\"\n variant=\"plain\"\n className=\"min-w-0 flex-1\"\n debounceMs={0}\n disabled={disabled}\n isError={isError}\n value={value.custom?.text ?? ''}\n onChange={(text) => {\n if (disabled) return;\n onChange({ ...value, custom: { selected: true, text } });\n }}\n />\n );\n\n return mode === 'single' ? (\n <RadioGroup\n aria-label={label}\n aria-describedby={describedBy}\n aria-invalid={isError || undefined}\n disabled={disabled}\n className=\"flex flex-col gap-space-1\"\n value={\n customSelected\n ? 'custom'\n : value.selected[0] === undefined\n ? ''\n : `option:${value.selected[0]}`\n }\n onValueChange={(next) => {\n if (disabled) return;\n if (next === 'custom') {\n selectCustom(true);\n return;\n }\n focusCustomInput.current = false;\n onChange({\n selected: [next.slice('option:'.length)],\n ...(value.custom && {\n custom: { ...value.custom, selected: false },\n }),\n });\n }}\n >\n {options.map((option) => (\n <RadioButton\n key={option.value}\n value={`option:${option.value}`}\n label={option.label}\n disabled={disabled}\n className=\"min-h-6\"\n />\n ))}\n {allowCustom && (\n <div className=\"flex min-h-6 min-w-0 items-center gap-space-2\">\n <RadioButton\n value=\"custom\"\n {...customLabelProps}\n disabled={disabled}\n />\n {customTextInput}\n </div>\n )}\n </RadioGroup>\n ) : (\n <div\n role=\"group\"\n aria-label={label}\n aria-describedby={describedBy}\n className=\"flex flex-col gap-space-1\"\n >\n {options.map((option) => (\n <Checkbox\n key={option.value}\n label={option.label}\n checked={value.selected.includes(option.value)}\n aria-invalid={isError || undefined}\n disabled={disabled}\n containerClassName=\"min-h-6\"\n onCheckedChange={(checked) => {\n if (disabled) return;\n onChange({\n ...value,\n selected:\n checked === true\n ? [...value.selected, option.value]\n : value.selected.filter((item) => item !== option.value),\n });\n }}\n />\n ))}\n {allowCustom && (\n <div className=\"flex min-h-6 min-w-0 items-center gap-space-2\">\n <Checkbox\n {...customLabelProps}\n checked={customSelected}\n aria-invalid={isError || undefined}\n disabled={disabled}\n onCheckedChange={(checked) => selectCustom(checked === true)}\n />\n {customTextInput}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ /** Animates height between 0 and auto; hidden content is inert. */
3
+ export declare function ChatRichContentCollapsible({ id, open, disabled, className, children, }: {
4
+ id?: string;
5
+ open: boolean;
6
+ /** Renders children directly in the parent's layout. */
7
+ disabled?: boolean;
8
+ className?: string;
9
+ children: ReactNode;
10
+ }): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
@@ -0,0 +1,23 @@
1
+ import { cn } from "../../utils/cn.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region packages/components/src/components/ChatRichContent/ChatRichContentCollapsible.tsx
4
+ /** Animates height between 0 and auto; hidden content is inert. */
5
+ function ChatRichContentCollapsible({ id, open, disabled = false, className, children }) {
6
+ if (disabled) return children;
7
+ return /* @__PURE__ */ jsx("div", {
8
+ id,
9
+ inert: !open,
10
+ className: cn("grid transition-[grid-template-rows,opacity] duration-normal ease-out motion-reduce:transition-none", open ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
11
+ children: /* @__PURE__ */ jsx("div", {
12
+ className: "min-h-0 overflow-hidden",
13
+ children: /* @__PURE__ */ jsx("div", {
14
+ className: cn("flex min-w-0 flex-col gap-space-4", className),
15
+ children
16
+ })
17
+ })
18
+ });
19
+ }
20
+ //#endregion
21
+ export { ChatRichContentCollapsible };
22
+
23
+ //# sourceMappingURL=ChatRichContentCollapsible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatRichContentCollapsible.js","names":[],"sources":["../../../src/components/ChatRichContent/ChatRichContentCollapsible.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cn } from '../../utils/cn';\n\n/** Animates height between 0 and auto; hidden content is inert. */\nexport function ChatRichContentCollapsible({\n id,\n open,\n disabled = false,\n className,\n children,\n}: {\n id?: string;\n open: boolean;\n /** Renders children directly in the parent's layout. */\n disabled?: boolean;\n className?: string;\n children: ReactNode;\n}) {\n if (disabled) return children;\n return (\n <div\n id={id}\n inert={!open}\n className={cn(\n 'grid transition-[grid-template-rows,opacity] duration-normal ease-out motion-reduce:transition-none',\n open ? 'grid-rows-[1fr] opacity-100' : 'grid-rows-[0fr] opacity-0'\n )}\n >\n <div className=\"min-h-0 overflow-hidden\">\n <div className={cn('flex min-w-0 flex-col gap-space-4', className)}>\n {children}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAKA,SAAgB,2BAA2B,EACzC,IACA,MACA,WAAW,OACX,WACA,YAQC;CACD,IAAI,UAAU,OAAO;CACrB,OACE,oBAAC,OAAD;EACM;EACJ,OAAO,CAAC;EACR,WAAW,GACT,uGACA,OAAO,gCAAgC,2BACzC;EAEA,UAAA,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,OAAD;IAAK,WAAW,GAAG,qCAAqC,SAAS;IAC9D;GACE,CAAA;EACF,CAAA;CACF,CAAA;AAET"}
@@ -0,0 +1,7 @@
1
+ export declare function ChatRichContentQuestionNav({ title, current, total, disabled, onChange, }: {
2
+ title: string;
3
+ current: number;
4
+ total: number;
5
+ disabled: boolean;
6
+ onChange: (current: number) => void;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,53 @@
1
+ import { Text } from "../Text/Text.js";
2
+ import { IconButton } from "../IconButton/IconButton.js";
3
+ import { CaretLeftIcon } from "@phosphor-icons/react/dist/ssr/CaretLeft";
4
+ import { CaretRightIcon } from "@phosphor-icons/react/dist/ssr/CaretRight";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region packages/components/src/components/ChatRichContent/ChatRichContentQuestionNav.tsx
7
+ function ChatRichContentQuestionNav({ title, current, total, disabled, onChange }) {
8
+ return /* @__PURE__ */ jsxs("nav", {
9
+ "aria-label": `Questions: ${title}`,
10
+ className: "flex shrink-0 items-center gap-space-1",
11
+ children: [
12
+ /* @__PURE__ */ jsx(IconButton, {
13
+ type: "button",
14
+ icon: CaretLeftIcon,
15
+ iconWeight: "regular",
16
+ size: "xxs",
17
+ color: "secondary",
18
+ variant: "plain",
19
+ label: "Previous question",
20
+ disabled: disabled || current <= 1,
21
+ onClick: () => onChange(current - 1)
22
+ }),
23
+ /* @__PURE__ */ jsxs(Text, {
24
+ as: "span",
25
+ variant: "xs",
26
+ color: "tertiary",
27
+ "aria-live": "polite",
28
+ "aria-atomic": "true",
29
+ className: "whitespace-nowrap tabular-nums",
30
+ children: [
31
+ current,
32
+ " of ",
33
+ total
34
+ ]
35
+ }),
36
+ /* @__PURE__ */ jsx(IconButton, {
37
+ type: "button",
38
+ icon: CaretRightIcon,
39
+ iconWeight: "regular",
40
+ size: "xxs",
41
+ color: "secondary",
42
+ variant: "plain",
43
+ label: "Next question",
44
+ disabled: disabled || current >= total,
45
+ onClick: () => onChange(current + 1)
46
+ })
47
+ ]
48
+ });
49
+ }
50
+ //#endregion
51
+ export { ChatRichContentQuestionNav };
52
+
53
+ //# sourceMappingURL=ChatRichContentQuestionNav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatRichContentQuestionNav.js","names":[],"sources":["../../../src/components/ChatRichContent/ChatRichContentQuestionNav.tsx"],"sourcesContent":["import { CaretLeftIcon } from '@phosphor-icons/react/dist/ssr/CaretLeft';\nimport { CaretRightIcon } from '@phosphor-icons/react/dist/ssr/CaretRight';\n\nimport { IconButton } from '../IconButton';\nimport { Text } from '../Text';\n\nexport function ChatRichContentQuestionNav({\n title,\n current,\n total,\n disabled,\n onChange,\n}: {\n title: string;\n current: number;\n total: number;\n disabled: boolean;\n onChange: (current: number) => void;\n}) {\n return (\n <nav\n aria-label={`Questions: ${title}`}\n className=\"flex shrink-0 items-center gap-space-1\"\n >\n <IconButton\n type=\"button\"\n icon={CaretLeftIcon}\n iconWeight=\"regular\"\n size=\"xxs\"\n color=\"secondary\"\n variant=\"plain\"\n label=\"Previous question\"\n disabled={disabled || current <= 1}\n onClick={() => onChange(current - 1)}\n />\n <Text\n as=\"span\"\n variant=\"xs\"\n color=\"tertiary\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"whitespace-nowrap tabular-nums\"\n >\n {current} of {total}\n </Text>\n <IconButton\n type=\"button\"\n icon={CaretRightIcon}\n iconWeight=\"regular\"\n size=\"xxs\"\n color=\"secondary\"\n variant=\"plain\"\n label=\"Next question\"\n disabled={disabled || current >= total}\n onClick={() => onChange(current + 1)}\n />\n </nav>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAgB,2BAA2B,EACzC,OACA,SACA,OACA,UACA,YAOC;CACD,OACE,qBAAC,OAAD;EACE,cAAY,cAAc;EAC1B,WAAU;EAFZ,UAAA;GAIE,oBAAC,YAAD;IACE,MAAK;IACL,MAAM;IACN,YAAW;IACX,MAAK;IACL,OAAM;IACN,SAAQ;IACR,OAAM;IACN,UAAU,YAAY,WAAW;IACjC,eAAe,SAAS,UAAU,CAAC;GACpC,CAAA;GACD,qBAAC,MAAD;IACE,IAAG;IACH,SAAQ;IACR,OAAM;IACN,aAAU;IACV,eAAY;IACZ,WAAU;IANZ,UAAA;KAQG;KAAQ;KAAK;IACV;;GACN,oBAAC,YAAD;IACE,MAAK;IACL,MAAM;IACN,YAAW;IACX,MAAK;IACL,OAAM;IACN,SAAQ;IACR,OAAM;IACN,UAAU,YAAY,WAAW;IACjC,eAAe,SAAS,UAAU,CAAC;GACpC,CAAA;EACE;;AAET"}
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChatRichContentState } from './ChatRichContent.types.js';
3
+ export declare function ChatRichContentStatus({ id, live, compact, state, isError, children, }: {
4
+ id: string;
5
+ /** Only one copy is announced and referenced when the status renders twice. */
6
+ live: boolean;
7
+ compact: boolean;
8
+ state: ChatRichContentState;
9
+ isError: boolean;
10
+ children: ReactNode;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { cn } from "../../utils/cn.js";
2
+ import { Text } from "../Text/Text.js";
3
+ import { Icon } from "../Icon/Icon.js";
4
+ import { CheckIcon } from "@phosphor-icons/react/dist/ssr/Check";
5
+ import { XIcon } from "@phosphor-icons/react/dist/ssr/X";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region packages/components/src/components/ChatRichContent/ChatRichContentStatus.tsx
8
+ function ChatRichContentStatus({ id, live, compact, state, isError, children }) {
9
+ const succeeded = state === "submitted" || state === "approved";
10
+ const icon = succeeded ? CheckIcon : state === "rejected" ? XIcon : void 0;
11
+ return /* @__PURE__ */ jsxs(Text, {
12
+ id: live ? id : void 0,
13
+ role: live ? isError ? "alert" : "status" : void 0,
14
+ variant: compact ? "xs" : "sm",
15
+ className: cn("flex min-w-0 items-center gap-space-1 text-tertiary", compact ? "max-w-[50%]" : "flex-1", !compact && (state === "approved" || state === "rejected") && "justify-end", isError && "text-error-primary"),
16
+ children: [icon && /* @__PURE__ */ jsx(Icon, {
17
+ icon,
18
+ "aria-hidden": true,
19
+ size: compact ? "sm" : "md",
20
+ weight: "regular",
21
+ className: cn("shrink-0", succeeded && "text-success-primary")
22
+ }), /* @__PURE__ */ jsx("span", {
23
+ className: cn("min-w-0", compact && "truncate"),
24
+ children
25
+ })]
26
+ });
27
+ }
28
+ //#endregion
29
+ export { ChatRichContentStatus };
30
+
31
+ //# sourceMappingURL=ChatRichContentStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatRichContentStatus.js","names":[],"sources":["../../../src/components/ChatRichContent/ChatRichContentStatus.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check';\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X';\n\nimport { cn } from '../../utils/cn';\nimport { Icon } from '../Icon';\nimport { Text } from '../Text';\nimport type { ChatRichContentState } from './ChatRichContent.types';\n\nexport function ChatRichContentStatus({\n id,\n live,\n compact,\n state,\n isError,\n children,\n}: {\n id: string;\n /** Only one copy is announced and referenced when the status renders twice. */\n live: boolean;\n compact: boolean;\n state: ChatRichContentState;\n isError: boolean;\n children: ReactNode;\n}) {\n const succeeded = state === 'submitted' || state === 'approved';\n const icon = succeeded ? CheckIcon : state === 'rejected' ? XIcon : undefined;\n return (\n <Text\n id={live ? id : undefined}\n role={live ? (isError ? 'alert' : 'status') : undefined}\n variant={compact ? 'xs' : 'sm'}\n className={cn(\n 'flex min-w-0 items-center gap-space-1 text-tertiary',\n compact ? 'max-w-[50%]' : 'flex-1',\n !compact &&\n (state === 'approved' || state === 'rejected') &&\n 'justify-end',\n isError && 'text-error-primary'\n )}\n >\n {icon && (\n <Icon\n icon={icon}\n aria-hidden\n size={compact ? 'sm' : 'md'}\n weight=\"regular\"\n className={cn('shrink-0', succeeded && 'text-success-primary')}\n />\n )}\n <span className={cn('min-w-0', compact && 'truncate')}>{children}</span>\n </Text>\n );\n}\n"],"mappings":";;;;;;;AAUA,SAAgB,sBAAsB,EACpC,IACA,MACA,SACA,OACA,SACA,YASC;CACD,MAAM,YAAY,UAAU,eAAe,UAAU;CACrD,MAAM,OAAO,YAAY,YAAY,UAAU,aAAa,QAAQ,KAAA;CACpE,OACE,qBAAC,MAAD;EACE,IAAI,OAAO,KAAK,KAAA;EAChB,MAAM,OAAQ,UAAU,UAAU,WAAY,KAAA;EAC9C,SAAS,UAAU,OAAO;EAC1B,WAAW,GACT,uDACA,UAAU,gBAAgB,UAC1B,CAAC,YACE,UAAU,cAAc,UAAU,eACnC,eACF,WAAW,oBACb;EAXF,UAAA,CAaG,QACC,oBAAC,MAAD;GACQ;GACN,eAAA;GACA,MAAM,UAAU,OAAO;GACvB,QAAO;GACP,WAAW,GAAG,YAAY,aAAa,sBAAsB;EAC9D,CAAA,GAEH,oBAAC,QAAD;GAAM,WAAW,GAAG,WAAW,WAAW,UAAU;GAAI;EAAe,CAAA,CACnE;;AAEV"}
@@ -0,0 +1,3 @@
1
+ export { ChatRichContent, ChatRichContentFallback } from './ChatRichContent.js';
2
+ export { ChatRichContentChoices } from './ChatRichContentChoices.js';
3
+ export type { ChatRichContentChoicesProps, ChatRichContentChoicesValue, ChatRichContentFallbackProps, ChatRichContentProps, ChatRichContentState, ChatRichContentRenderer, ChatRichContentRendererContext, ChatRichContentNavigation, } from './ChatRichContent.types.js';
@@ -0,0 +1,3 @@
1
+ import { ChatRichContent, ChatRichContentFallback } from "./ChatRichContent.js";
2
+ import { ChatRichContentChoices } from "./ChatRichContentChoices.js";
3
+ export { ChatRichContent, ChatRichContentChoices, ChatRichContentFallback };
@@ -0,0 +1,85 @@
1
+ import { type HTMLAttributes, type ReactNode } from 'react';
2
+ export type RadarChartDatum = {
3
+ /** Unique, stable identifier for this axis. */
4
+ id: string;
5
+ label: string;
6
+ value: number;
7
+ /** Semantic chart color; defaults to the categorical fill palette in axis order. */
8
+ color?: string;
9
+ };
10
+ export type RadarChartAxis = {
11
+ /** Unique, stable identifier; keys each series' `values`. */
12
+ id: string;
13
+ label: string;
14
+ };
15
+ export type RadarChartSeries = {
16
+ /** Unique, stable identifier; use it as the matching legend item's id. */
17
+ id: string;
18
+ label: string;
19
+ /** Values keyed by axis id. Missing, negative, and non-finite values plot at zero. */
20
+ values: Readonly<Record<string, number | undefined>>;
21
+ /**
22
+ * Outline color; defaults to the categorical line palette in series order.
23
+ * The area uses the hue-matched fill color.
24
+ */
25
+ color?: string;
26
+ };
27
+ /** One axis and every visible series' value on it, for multi-series tooltips. */
28
+ export type RadarChartAxisValues = RadarChartAxis & {
29
+ /** Visible series in input order, with sanitized values and outline colors. */
30
+ values: readonly {
31
+ id: string;
32
+ label: string;
33
+ value: number;
34
+ color: string;
35
+ }[];
36
+ };
37
+ type RadarChartBaseProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
38
+ /** Shared axis maximum; defaults to the largest finite positive value. */
39
+ maxValue?: number;
40
+ /** Formats labels and the accessible data summary. */
41
+ formatValue?: (value: number) => string;
42
+ };
43
+ export type RadarChartSingleSeriesProps = RadarChartBaseProps & {
44
+ /** Axes in clockwise order, beginning at the top. Supply at least three. */
45
+ data: readonly RadarChartDatum[];
46
+ /**
47
+ * Content inside ChartTooltip on point or label hover and keyboard focus.
48
+ * Receives the sanitized value and resolved color. Compose ChartTooltipHeader,
49
+ * ChartTooltipBody, and ChartTooltipRow here; omit for a static chart.
50
+ */
51
+ renderTooltip?: (datum: RadarChartDatum) => ReactNode;
52
+ axes?: never;
53
+ series?: never;
54
+ renderAxisTooltip?: never;
55
+ selectedIds?: never;
56
+ activeLegendItemId?: never;
57
+ };
58
+ export type RadarChartMultiSeriesProps = RadarChartBaseProps & {
59
+ /** Axes in clockwise order, beginning at the top. Supply at least three. */
60
+ axes: readonly RadarChartAxis[];
61
+ /**
62
+ * Overlapping areas on the shared axes, drawn in input order. Keep to about
63
+ * four; beyond that, filter series or use small multiples.
64
+ */
65
+ series: readonly RadarChartSeries[];
66
+ /**
67
+ * Content inside ChartTooltip when an axis is hovered anywhere in its sector
68
+ * or focused. Compose one ChartTooltipRow per series; omit for a static chart.
69
+ */
70
+ renderAxisTooltip?: (axis: RadarChartAxisValues) => ReactNode;
71
+ /** When non-empty, only these series are drawn. Colors keep their series order. */
72
+ selectedIds?: ReadonlySet<string>;
73
+ /** Emphasizes one series from an external legend and dims the rest. */
74
+ activeLegendItemId?: string | null;
75
+ data?: never;
76
+ renderTooltip?: never;
77
+ };
78
+ export type RadarChartProps = RadarChartSingleSeriesProps | RadarChartMultiSeriesProps;
79
+ /**
80
+ * A radar with a shared scale and clockwise, outside axis labels. Pass `data`
81
+ * for one series with categorical points, or `axes` and `series` for
82
+ * overlapping areas identified by an external legend.
83
+ */
84
+ export declare const RadarChart: (props: RadarChartProps) => import("react").JSX.Element;
85
+ export {};