@mcp-b/react-components 0.1.1 → 0.1.3

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 (203) hide show
  1. package/dist/Button-QCM8ZKgR.d.ts +98 -0
  2. package/dist/CodeBlock-CttHhWcb.js +356 -0
  3. package/dist/CodeBlock-V6pgafSS.d.ts +174 -0
  4. package/dist/Select-CRsKCJ9x.d.ts +200 -0
  5. package/dist/class-names-9UtZwb0J.js +12 -0
  6. package/dist/components/Accordion.d.ts +81 -0
  7. package/dist/components/Accordion.js +97 -0
  8. package/dist/components/AgentConnection.d.ts +69 -0
  9. package/dist/components/AgentConnection.js +176 -0
  10. package/dist/components/AlertDialog.d.ts +148 -0
  11. package/dist/components/AlertDialog.js +141 -0
  12. package/dist/components/Artifact.d.ts +128 -0
  13. package/dist/components/Artifact.js +115 -0
  14. package/dist/components/Autocomplete.d.ts +186 -0
  15. package/dist/components/Autocomplete.js +186 -0
  16. package/dist/components/Avatar.d.ts +134 -0
  17. package/dist/components/Avatar.js +118 -0
  18. package/dist/components/Badge.d.ts +68 -0
  19. package/dist/components/Badge.js +108 -0
  20. package/dist/components/Button.d.ts +2 -0
  21. package/dist/components/Button.js +73 -0
  22. package/dist/components/Card.d.ts +87 -0
  23. package/dist/components/Card.js +81 -0
  24. package/dist/components/ChainOfThought.d.ts +153 -0
  25. package/dist/components/ChainOfThought.js +157 -0
  26. package/dist/components/Checkbox.d.ts +35 -0
  27. package/dist/components/Checkbox.js +47 -0
  28. package/dist/components/CheckboxGroup.d.ts +76 -0
  29. package/dist/components/CheckboxGroup.js +69 -0
  30. package/dist/components/CodeBlock.d.ts +2 -0
  31. package/dist/components/CodeBlock.js +2 -0
  32. package/dist/components/Collapsible.d.ts +127 -0
  33. package/dist/components/Collapsible.js +103 -0
  34. package/dist/components/Combobox.d.ts +177 -0
  35. package/dist/components/Combobox.js +179 -0
  36. package/dist/components/Commit.d.ts +265 -0
  37. package/dist/components/Commit.js +282 -0
  38. package/dist/components/Context.d.ts +129 -0
  39. package/dist/components/Context.js +309 -0
  40. package/dist/components/ContextMenu.d.ts +282 -0
  41. package/dist/components/ContextMenu.js +270 -0
  42. package/dist/components/Conversation.d.ts +166 -0
  43. package/dist/components/Conversation.js +202 -0
  44. package/dist/components/Dialog.d.ts +120 -0
  45. package/dist/components/Dialog.js +114 -0
  46. package/dist/components/EnvironmentVariables.d.ts +176 -0
  47. package/dist/components/EnvironmentVariables.js +221 -0
  48. package/dist/components/Field.d.ts +281 -0
  49. package/dist/components/Field.js +274 -0
  50. package/dist/components/Fieldset.d.ts +93 -0
  51. package/dist/components/Fieldset.js +81 -0
  52. package/dist/components/FileTree.d.ts +116 -0
  53. package/dist/components/FileTree.js +310 -0
  54. package/dist/components/Form.d.ts +94 -0
  55. package/dist/components/Form.js +88 -0
  56. package/dist/components/GithubMotionMark.d.ts +13 -0
  57. package/dist/components/GithubMotionMark.js +23 -0
  58. package/dist/components/Input.d.ts +33 -0
  59. package/dist/components/Input.js +27 -0
  60. package/dist/components/Label.d.ts +44 -0
  61. package/dist/components/Label.js +41 -0
  62. package/dist/components/Menu.d.ts +395 -0
  63. package/dist/components/Menu.js +338 -0
  64. package/dist/components/Menubar.d.ts +331 -0
  65. package/dist/components/Menubar.js +299 -0
  66. package/dist/components/Message.d.ts +216 -0
  67. package/dist/components/Message.js +245 -0
  68. package/dist/components/Meter.d.ts +151 -0
  69. package/dist/components/Meter.js +121 -0
  70. package/dist/components/ModelSelector.d.ts +198 -0
  71. package/dist/components/ModelSelector.js +306 -0
  72. package/dist/components/NaniteScene.d.ts +33 -0
  73. package/dist/components/NaniteScene.js +405 -0
  74. package/dist/components/NavigationMenu.d.ts +256 -0
  75. package/dist/components/NavigationMenu.js +228 -0
  76. package/dist/components/NumberField.d.ts +159 -0
  77. package/dist/components/NumberField.js +123 -0
  78. package/dist/components/Popover.d.ts +278 -0
  79. package/dist/components/Popover.js +245 -0
  80. package/dist/components/PreviewCard.d.ts +156 -0
  81. package/dist/components/PreviewCard.js +156 -0
  82. package/dist/components/PricingPage.d.ts +209 -0
  83. package/dist/components/PricingPage.js +506 -0
  84. package/dist/components/Progress.d.ts +58 -0
  85. package/dist/components/Progress.js +51 -0
  86. package/dist/components/PromptInput.d.ts +399 -0
  87. package/dist/components/PromptInput.js +737 -0
  88. package/dist/components/Queue.d.ts +241 -0
  89. package/dist/components/Queue.js +225 -0
  90. package/dist/components/RadioGroup.d.ts +78 -0
  91. package/dist/components/RadioGroup.js +72 -0
  92. package/dist/components/Reasoning.d.ts +88 -0
  93. package/dist/components/Reasoning.js +187 -0
  94. package/dist/components/ScrollArea.d.ts +160 -0
  95. package/dist/components/ScrollArea.js +145 -0
  96. package/dist/components/Select.d.ts +2 -0
  97. package/dist/components/Select.js +260 -0
  98. package/dist/components/Separator.d.ts +45 -0
  99. package/dist/components/Separator.js +40 -0
  100. package/dist/components/Shell.d.ts +163 -0
  101. package/dist/components/Shell.js +137 -0
  102. package/dist/components/Slider.d.ts +120 -0
  103. package/dist/components/Slider.js +115 -0
  104. package/dist/components/Sources.d.ts +91 -0
  105. package/dist/components/Sources.js +121 -0
  106. package/dist/components/Stepper.d.ts +190 -0
  107. package/dist/components/Stepper.js +315 -0
  108. package/dist/components/Switch.d.ts +57 -0
  109. package/dist/components/Switch.js +55 -0
  110. package/dist/components/Tabs.d.ts +84 -0
  111. package/dist/components/Tabs.js +78 -0
  112. package/dist/components/Task.d.ts +100 -0
  113. package/dist/components/Task.js +120 -0
  114. package/dist/components/Terminal.d.ts +118 -0
  115. package/dist/components/Terminal.js +234 -0
  116. package/dist/components/TestResults.d.ts +236 -0
  117. package/dist/components/TestResults.js +346 -0
  118. package/dist/components/Toast.d.ts +192 -0
  119. package/dist/components/Toast.js +163 -0
  120. package/dist/components/Toggle.d.ts +69 -0
  121. package/dist/components/Toggle.js +66 -0
  122. package/dist/components/ToggleGroup.d.ts +69 -0
  123. package/dist/components/ToggleGroup.js +99 -0
  124. package/dist/components/Tool.d.ts +119 -0
  125. package/dist/components/Tool.js +192 -0
  126. package/dist/components/Toolbar.d.ts +162 -0
  127. package/dist/components/Toolbar.js +126 -0
  128. package/dist/components/Tooltip.d.ts +81 -0
  129. package/dist/components/Tooltip.js +74 -0
  130. package/dist/components/WebPreview.d.ts +143 -0
  131. package/dist/components/WebPreview.js +280 -0
  132. package/dist/components/useStickToBottom.d.ts +30 -0
  133. package/dist/components/useStickToBottom.js +95 -0
  134. package/dist/copy-button-BIATcZWZ.d.ts +16 -0
  135. package/dist/copy-button-BNgclDrO.js +43 -0
  136. package/dist/icons-BsWc8g4E.js +221 -0
  137. package/dist/styles/accordion.css +10 -10
  138. package/dist/styles/agent-connection.css +18 -17
  139. package/dist/styles/alert-dialog.css +48 -29
  140. package/dist/styles/artifact.css +10 -10
  141. package/dist/styles/autocomplete.css +25 -24
  142. package/dist/styles/avatar.css +96 -6
  143. package/dist/styles/badge.css +78 -14
  144. package/dist/styles/base.css +9 -9
  145. package/dist/styles/button.css +57 -38
  146. package/dist/styles/card.css +57 -10
  147. package/dist/styles/chain-of-thought.css +47 -33
  148. package/dist/styles/checkbox.css +24 -10
  149. package/dist/styles/code-block.css +22 -15
  150. package/dist/styles/collapsible.css +14 -12
  151. package/dist/styles/combobox.css +26 -25
  152. package/dist/styles/commit.css +49 -24
  153. package/dist/styles/context-menu.css +70 -16
  154. package/dist/styles/context.css +15 -15
  155. package/dist/styles/conversation.css +12 -12
  156. package/dist/styles/dialog.css +52 -16
  157. package/dist/styles/environment-variables.css +19 -19
  158. package/dist/styles/field.css +184 -22
  159. package/dist/styles/fieldset.css +5 -4
  160. package/dist/styles/file-tree.css +17 -17
  161. package/dist/styles/index.css.d.ts +1 -0
  162. package/dist/styles/input.css +45 -11
  163. package/dist/styles/label.css +21 -4
  164. package/dist/styles/menu.css +55 -32
  165. package/dist/styles/menubar.css +80 -28
  166. package/dist/styles/message.css +22 -13
  167. package/dist/styles/meter.css +8 -8
  168. package/dist/styles/model-selector.css +33 -21
  169. package/dist/styles/navigation-menu.css +26 -24
  170. package/dist/styles/number-field.css +20 -18
  171. package/dist/styles/popover.css +38 -28
  172. package/dist/styles/preview-card.css +15 -13
  173. package/dist/styles/pricing-page.css +53 -53
  174. package/dist/styles/progress.css +7 -7
  175. package/dist/styles/prompt-input.css +73 -24
  176. package/dist/styles/queue.css +58 -32
  177. package/dist/styles/radio.css +26 -11
  178. package/dist/styles/reasoning.css +15 -11
  179. package/dist/styles/scroll-area.css +6 -6
  180. package/dist/styles/scrollbars.css +4 -4
  181. package/dist/styles/select.css +84 -25
  182. package/dist/styles/separator.css +1 -1
  183. package/dist/styles/shell.css +21 -20
  184. package/dist/styles/slider.css +35 -11
  185. package/dist/styles/sources.css +20 -20
  186. package/dist/styles/stepper.css +22 -22
  187. package/dist/styles/switch.css +29 -13
  188. package/dist/styles/tabs.css +23 -16
  189. package/dist/styles/task.css +27 -23
  190. package/dist/styles/terminal.css +16 -13
  191. package/dist/styles/test-results.css +79 -32
  192. package/dist/styles/toast.css +26 -25
  193. package/dist/styles/toggle-group.css +12 -12
  194. package/dist/styles/toggle.css +29 -11
  195. package/dist/styles/tool.css +54 -32
  196. package/dist/styles/toolbar.css +30 -28
  197. package/dist/styles/tooltip.css +10 -8
  198. package/dist/styles/web-preview.css +37 -21
  199. package/dist/utils/structured-code.d.ts +10 -0
  200. package/dist/utils/structured-code.js +81 -0
  201. package/package.json +17 -8
  202. package/dist/index.d.ts +0 -7236
  203. package/dist/index.js +0 -8945
@@ -0,0 +1,120 @@
1
+ import * as React from "react";
2
+ import { Slider as Slider$1 } from "@base-ui/react/slider";
3
+
4
+ //#region src/components/Slider.d.ts
5
+ interface SliderProps extends Omit<React.ComponentPropsWithRef<typeof Slider$1.Root>, "className"> {
6
+ className?: string;
7
+ }
8
+ interface SliderControlProps extends Omit<React.ComponentPropsWithRef<typeof Slider$1.Control>, "className"> {
9
+ className?: string;
10
+ }
11
+ interface SliderTrackProps extends Omit<React.ComponentPropsWithRef<typeof Slider$1.Track>, "className"> {
12
+ className?: string;
13
+ }
14
+ interface SliderIndicatorProps extends Omit<React.ComponentPropsWithRef<typeof Slider$1.Indicator>, "className"> {
15
+ className?: string;
16
+ }
17
+ interface SliderThumbProps extends Omit<React.ComponentPropsWithRef<typeof Slider$1.Thumb>, "className"> {
18
+ className?: string;
19
+ }
20
+ interface SliderOutputProps extends Omit<React.ComponentPropsWithRef<typeof Slider$1.Value>, "children"> {
21
+ className?: string;
22
+ children?: (value: number, values: readonly number[], formattedValues: readonly string[]) => React.ReactNode;
23
+ }
24
+ /**
25
+ * A slider component for selecting values from a range.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <Slider defaultValue={50}>
30
+ * <SliderControl>
31
+ * <SliderTrack>
32
+ * <SliderIndicator />
33
+ * <SliderThumb />
34
+ * </SliderTrack>
35
+ * </SliderControl>
36
+ * </Slider>
37
+ * ```
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * // With output value display
42
+ * <Slider defaultValue={50}>
43
+ * <SliderOutput />
44
+ * <SliderControl>
45
+ * <SliderTrack>
46
+ * <SliderIndicator />
47
+ * <SliderThumb />
48
+ * </SliderTrack>
49
+ * </SliderControl>
50
+ * </Slider>
51
+ * ```
52
+ *
53
+ * @see {@link https://base-ui.com/react/components/slider | Base UI Slider}
54
+ */
55
+ declare function Slider({
56
+ className,
57
+ children,
58
+ defaultValue,
59
+ max,
60
+ min,
61
+ ref,
62
+ value,
63
+ ...props
64
+ }: SliderProps & {
65
+ ref?: React.Ref<HTMLDivElement>;
66
+ }): React.JSX.Element;
67
+ /**
68
+ * The control area for the Slider (handles interactions).
69
+ */
70
+ declare function SliderControl({
71
+ className,
72
+ ref,
73
+ ...props
74
+ }: SliderControlProps & {
75
+ ref?: React.Ref<HTMLDivElement>;
76
+ }): React.JSX.Element;
77
+ /**
78
+ * The track container for the Slider.
79
+ */
80
+ declare function SliderTrack({
81
+ className,
82
+ ref,
83
+ ...props
84
+ }: SliderTrackProps & {
85
+ ref?: React.Ref<HTMLDivElement>;
86
+ }): React.JSX.Element;
87
+ /**
88
+ * The filled indicator showing current value position.
89
+ */
90
+ declare function SliderIndicator({
91
+ className,
92
+ ref,
93
+ ...props
94
+ }: SliderIndicatorProps & {
95
+ ref?: React.Ref<HTMLDivElement>;
96
+ }): React.JSX.Element;
97
+ /**
98
+ * The draggable thumb for the Slider.
99
+ */
100
+ declare function SliderThumb({
101
+ className,
102
+ ref,
103
+ ...props
104
+ }: SliderThumbProps & {
105
+ ref?: React.Ref<HTMLDivElement>;
106
+ }): React.JSX.Element;
107
+ /**
108
+ * Displays the current value of the Slider.
109
+ * Note: This must be used inside a Slider component to access the value context.
110
+ */
111
+ declare function SliderOutput({
112
+ className,
113
+ children,
114
+ ref,
115
+ ...props
116
+ }: SliderOutputProps & {
117
+ ref?: React.Ref<HTMLOutputElement>;
118
+ }): React.JSX.Element;
119
+ //#endregion
120
+ export { Slider, SliderControl, SliderControlProps, SliderIndicator, SliderIndicatorProps, SliderOutput, SliderOutputProps, SliderProps, SliderThumb, SliderThumbProps, SliderTrack, SliderTrackProps };
@@ -0,0 +1,115 @@
1
+ import "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Slider as Slider$1 } from "@base-ui/react/slider";
4
+ //#region src/components/Slider.tsx
5
+ /**
6
+ * A slider component for selecting values from a range.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <Slider defaultValue={50}>
11
+ * <SliderControl>
12
+ * <SliderTrack>
13
+ * <SliderIndicator />
14
+ * <SliderThumb />
15
+ * </SliderTrack>
16
+ * </SliderControl>
17
+ * </Slider>
18
+ * ```
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * // With output value display
23
+ * <Slider defaultValue={50}>
24
+ * <SliderOutput />
25
+ * <SliderControl>
26
+ * <SliderTrack>
27
+ * <SliderIndicator />
28
+ * <SliderThumb />
29
+ * </SliderTrack>
30
+ * </SliderControl>
31
+ * </Slider>
32
+ * ```
33
+ *
34
+ * @see {@link https://base-ui.com/react/components/slider | Base UI Slider}
35
+ */
36
+ function Slider({ className = "", children, defaultValue, max = 100, min = 0, ref, value, ...props }) {
37
+ const classes = ["slider", className].filter(Boolean).join(" ");
38
+ const resolvedDefaultValue = children == null && value === void 0 && defaultValue === void 0 ? [min, max] : defaultValue;
39
+ const thumbValues = Array.isArray(value) ? value : Array.isArray(resolvedDefaultValue) ? resolvedDefaultValue : [value ?? resolvedDefaultValue ?? min];
40
+ return /* @__PURE__ */ jsx(Slider$1.Root, {
41
+ ref,
42
+ "data-slot": "slider",
43
+ className: classes,
44
+ defaultValue: resolvedDefaultValue,
45
+ max,
46
+ min,
47
+ value,
48
+ ...props,
49
+ children: children ?? /* @__PURE__ */ jsx(SliderControl, { children: /* @__PURE__ */ jsxs(SliderTrack, { children: [/* @__PURE__ */ jsx(SliderIndicator, {}), thumbValues.map((_, index) => /* @__PURE__ */ jsx(SliderThumb, { index }, index))] }) })
50
+ });
51
+ }
52
+ /**
53
+ * The control area for the Slider (handles interactions).
54
+ */
55
+ function SliderControl({ className = "", ref, ...props }) {
56
+ const classes = ["slider__control", className].filter(Boolean).join(" ");
57
+ return /* @__PURE__ */ jsx(Slider$1.Control, {
58
+ ref,
59
+ "data-slot": "slider-control",
60
+ className: classes,
61
+ ...props
62
+ });
63
+ }
64
+ /**
65
+ * The track container for the Slider.
66
+ */
67
+ function SliderTrack({ className = "", ref, ...props }) {
68
+ const classes = ["slider__track", className].filter(Boolean).join(" ");
69
+ return /* @__PURE__ */ jsx(Slider$1.Track, {
70
+ ref,
71
+ "data-slot": "slider-track",
72
+ className: classes,
73
+ ...props
74
+ });
75
+ }
76
+ /**
77
+ * The filled indicator showing current value position.
78
+ */
79
+ function SliderIndicator({ className = "", ref, ...props }) {
80
+ const classes = ["slider__indicator", className].filter(Boolean).join(" ");
81
+ return /* @__PURE__ */ jsx(Slider$1.Indicator, {
82
+ ref,
83
+ "data-slot": "slider-range",
84
+ className: classes,
85
+ ...props
86
+ });
87
+ }
88
+ /**
89
+ * The draggable thumb for the Slider.
90
+ */
91
+ function SliderThumb({ className = "", ref, ...props }) {
92
+ const classes = ["slider__thumb", className].filter(Boolean).join(" ");
93
+ return /* @__PURE__ */ jsx(Slider$1.Thumb, {
94
+ ref,
95
+ "data-slot": "slider-thumb",
96
+ className: classes,
97
+ ...props
98
+ });
99
+ }
100
+ /**
101
+ * Displays the current value of the Slider.
102
+ * Note: This must be used inside a Slider component to access the value context.
103
+ */
104
+ function SliderOutput({ className = "", children, ref, ...props }) {
105
+ const classes = ["slider__output", className].filter(Boolean).join(" ");
106
+ return /* @__PURE__ */ jsx(Slider$1.Value, {
107
+ ref,
108
+ "data-slot": "slider-output",
109
+ className: classes,
110
+ ...props,
111
+ children: (formattedValues, values) => typeof children === "function" ? children(values[0] ?? 0, values, formattedValues) : formattedValues.join(" - ")
112
+ });
113
+ }
114
+ //#endregion
115
+ export { Slider, SliderControl, SliderIndicator, SliderOutput, SliderThumb, SliderTrack };
@@ -0,0 +1,91 @@
1
+ import { CollapsiblePanelProps, CollapsibleRootProps, CollapsibleTriggerProps } from "./Collapsible.js";
2
+ import * as React from "react";
3
+
4
+ //#region src/components/Sources.d.ts
5
+ /**
6
+ * Props for the Sources root. Wraps Base UI Collapsible.Root.
7
+ */
8
+ interface SourcesProps extends Omit<CollapsibleRootProps, "className" | "unstyled"> {
9
+ className?: string;
10
+ }
11
+ /**
12
+ * Displays a collapsible list of citations used by an AI to generate a
13
+ * response. Compose with SourcesTrigger, SourcesContent, and one or more
14
+ * Source children. Adapted from Vercel AI Elements and restyled with Sigvelo
15
+ * CSS tokens.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <Sources defaultOpen>
20
+ * <SourcesTrigger count={3} />
21
+ * <SourcesContent>
22
+ * <Source href="https://example.com/a" title="Article A" />
23
+ * <Source href="https://example.com/b" title="Article B" />
24
+ * <Source href="https://example.com/c" title="Article C" />
25
+ * </SourcesContent>
26
+ * </Sources>
27
+ * ```
28
+ *
29
+ * @see {@link https://elements.ai-sdk.dev/components/sources | AI Elements Sources}
30
+ */
31
+ declare function Sources({
32
+ className,
33
+ ref,
34
+ ...props
35
+ }: SourcesProps & {
36
+ ref?: React.Ref<HTMLDivElement>;
37
+ }): React.JSX.Element;
38
+ interface SourcesTriggerProps extends Omit<CollapsibleTriggerProps, "className" | "unstyled"> {
39
+ className?: string;
40
+ /** Number of sources to show in the trigger label. */
41
+ count: number;
42
+ }
43
+ /**
44
+ * The clickable header that toggles the sources list. Shows the count and a
45
+ * chevron that rotates when open.
46
+ */
47
+ declare function SourcesTrigger({
48
+ className,
49
+ count,
50
+ children,
51
+ ref,
52
+ ...props
53
+ }: SourcesTriggerProps & {
54
+ ref?: React.Ref<HTMLButtonElement>;
55
+ }): React.JSX.Element;
56
+ interface SourcesContentProps extends Omit<CollapsiblePanelProps, "className" | "unstyled"> {
57
+ className?: string;
58
+ }
59
+ /**
60
+ * The collapsible panel that contains Source children.
61
+ */
62
+ declare function SourcesContent({
63
+ className,
64
+ children,
65
+ ref,
66
+ ...props
67
+ }: SourcesContentProps & {
68
+ ref?: React.Ref<HTMLDivElement>;
69
+ }): React.JSX.Element;
70
+ interface SourceProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "title"> {
71
+ /** The display title for this citation. */
72
+ title?: string;
73
+ /** Optional description rendered beneath the title. */
74
+ description?: string;
75
+ }
76
+ /**
77
+ * A single citation item. Renders as an anchor inside the sources list.
78
+ */
79
+ declare function Source({
80
+ title,
81
+ description,
82
+ children,
83
+ className,
84
+ href,
85
+ ref,
86
+ ...props
87
+ }: SourceProps & {
88
+ ref?: React.Ref<HTMLAnchorElement>;
89
+ }): React.JSX.Element;
90
+ //#endregion
91
+ export { Source, SourceProps, Sources, SourcesContent, SourcesContentProps, SourcesProps, SourcesTrigger, SourcesTriggerProps };
@@ -0,0 +1,121 @@
1
+ import { c as ChevronRightIcon, v as LinkIcon } from "../icons-BsWc8g4E.js";
2
+ import { t as cx } from "../class-names-9UtZwb0J.js";
3
+ import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
4
+ import "react";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/Sources.tsx
7
+ /**
8
+ * Displays a collapsible list of citations used by an AI to generate a
9
+ * response. Compose with SourcesTrigger, SourcesContent, and one or more
10
+ * Source children. Adapted from Vercel AI Elements and restyled with Sigvelo
11
+ * CSS tokens.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <Sources defaultOpen>
16
+ * <SourcesTrigger count={3} />
17
+ * <SourcesContent>
18
+ * <Source href="https://example.com/a" title="Article A" />
19
+ * <Source href="https://example.com/b" title="Article B" />
20
+ * <Source href="https://example.com/c" title="Article C" />
21
+ * </SourcesContent>
22
+ * </Sources>
23
+ * ```
24
+ *
25
+ * @see {@link https://elements.ai-sdk.dev/components/sources | AI Elements Sources}
26
+ */
27
+ function Sources({ className, ref, ...props }) {
28
+ return /* @__PURE__ */ jsx(CollapsibleRoot, {
29
+ ref,
30
+ className: cx("sources", className),
31
+ ...props,
32
+ unstyled: true
33
+ });
34
+ }
35
+ /**
36
+ * The clickable header that toggles the sources list. Shows the count and a
37
+ * chevron that rotates when open.
38
+ */
39
+ function SourcesTrigger({ className, count, children, ref, ...props }) {
40
+ return /* @__PURE__ */ jsx(CollapsibleTrigger, {
41
+ ref,
42
+ className: cx("sources__trigger", className),
43
+ ...props,
44
+ unstyled: true,
45
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
46
+ className: "sources__trigger-label",
47
+ children: [
48
+ "Used ",
49
+ count,
50
+ " ",
51
+ count === 1 ? "source" : "sources"
52
+ ]
53
+ }), /* @__PURE__ */ jsx("span", {
54
+ className: "sources__trigger-icon",
55
+ "aria-hidden": "true",
56
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
57
+ })] })
58
+ });
59
+ }
60
+ /**
61
+ * The collapsible panel that contains Source children.
62
+ */
63
+ function SourcesContent({ className, children, ref, ...props }) {
64
+ return /* @__PURE__ */ jsx(CollapsiblePanel, {
65
+ ref,
66
+ className: cx("sources__content", className),
67
+ ...props,
68
+ unstyled: true,
69
+ children: /* @__PURE__ */ jsx("ol", {
70
+ className: "sources__list",
71
+ role: "list",
72
+ children
73
+ })
74
+ });
75
+ }
76
+ /**
77
+ * A single citation item. Renders as an anchor inside the sources list.
78
+ */
79
+ function Source({ title, description, children, className, href, ref, ...props }) {
80
+ return /* @__PURE__ */ jsx("li", {
81
+ className: "sources__item",
82
+ children: /* @__PURE__ */ jsx("a", {
83
+ ref,
84
+ href,
85
+ className: cx("sources__link", className),
86
+ target: "_blank",
87
+ rel: "noreferrer",
88
+ ...props,
89
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
90
+ className: "sources__link-icon",
91
+ "aria-hidden": "true",
92
+ children: /* @__PURE__ */ jsx(LinkIcon, {})
93
+ }), /* @__PURE__ */ jsxs("span", {
94
+ className: "sources__link-body",
95
+ children: [
96
+ title ? /* @__PURE__ */ jsx("span", {
97
+ className: "sources__link-title",
98
+ children: title
99
+ }) : null,
100
+ description ? /* @__PURE__ */ jsx("span", {
101
+ className: "sources__link-description",
102
+ children: description
103
+ }) : null,
104
+ href ? /* @__PURE__ */ jsx("span", {
105
+ className: "sources__link-host",
106
+ children: hostnameFrom(href)
107
+ }) : null
108
+ ]
109
+ })] })
110
+ })
111
+ });
112
+ }
113
+ function hostnameFrom(href) {
114
+ try {
115
+ return new URL(href).hostname.replace(/^www\./, "");
116
+ } catch {
117
+ return href;
118
+ }
119
+ }
120
+ //#endregion
121
+ export { Source, Sources, SourcesContent, SourcesTrigger };
@@ -0,0 +1,190 @@
1
+ import * as React from "react";
2
+
3
+ //#region src/components/Stepper.d.ts
4
+ type StepperOrientation = "horizontal" | "vertical";
5
+ type StepperState = "active" | "completed" | "inactive" | "loading";
6
+ type StepIndicators = {
7
+ active?: React.ReactNode;
8
+ completed?: React.ReactNode;
9
+ inactive?: React.ReactNode;
10
+ loading?: React.ReactNode;
11
+ };
12
+ interface StepperContextValue {
13
+ activeStep: number;
14
+ setActiveStep: (step: number) => void;
15
+ stepsCount: number;
16
+ orientation: StepperOrientation;
17
+ indicators: StepIndicators;
18
+ idPrefix: string;
19
+ registerTrigger: (step: number, node: HTMLButtonElement | null) => void;
20
+ focusNext: (step: number) => void;
21
+ focusPrev: (step: number) => void;
22
+ focusFirst: () => void;
23
+ focusLast: () => void;
24
+ }
25
+ interface StepItemContextValue {
26
+ step: number;
27
+ state: StepperState;
28
+ isDisabled: boolean;
29
+ isLoading: boolean;
30
+ }
31
+ declare function useStepper(): StepperContextValue;
32
+ declare function useStepItem(): StepItemContextValue;
33
+ interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
34
+ /**
35
+ * The first active step for uncontrolled steppers.
36
+ * @default 1
37
+ */
38
+ defaultValue?: number;
39
+ /**
40
+ * The active step for controlled steppers.
41
+ */
42
+ value?: number;
43
+ /**
44
+ * Called when a trigger requests a new active step.
45
+ */
46
+ onValueChange?: (value: number) => void;
47
+ /**
48
+ * The layout direction of the step navigation.
49
+ * @default "horizontal"
50
+ */
51
+ orientation?: StepperOrientation;
52
+ /**
53
+ * Optional replacement content for indicator states.
54
+ */
55
+ indicators?: StepIndicators;
56
+ }
57
+ /**
58
+ * A composable stepper for setup flows, onboarding, and other ordered workflows.
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * <Stepper defaultValue={1}>
63
+ * <StepperNav>
64
+ * <StepperItem step={1}>
65
+ * <StepperTrigger>
66
+ * <StepperIndicator>1</StepperIndicator>
67
+ * <StepperTitle>Connect account</StepperTitle>
68
+ * </StepperTrigger>
69
+ * <StepperSeparator />
70
+ * </StepperItem>
71
+ * </StepperNav>
72
+ * </Stepper>
73
+ * ```
74
+ *
75
+ * @see {@link https://reui.io/docs/components/base/stepper | ReUI Stepper}
76
+ */
77
+ declare function Stepper({
78
+ defaultValue,
79
+ value,
80
+ onValueChange,
81
+ orientation,
82
+ indicators,
83
+ className,
84
+ children,
85
+ ref,
86
+ ...props
87
+ }: StepperProps & {
88
+ ref?: React.Ref<HTMLDivElement>;
89
+ }): React.JSX.Element;
90
+ interface StepperNavProps extends React.ComponentPropsWithoutRef<"nav"> {}
91
+ declare function StepperNav({
92
+ className,
93
+ ref,
94
+ role,
95
+ ...props
96
+ }: StepperNavProps & {
97
+ ref?: React.Ref<HTMLElement>;
98
+ }): React.JSX.Element;
99
+ interface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {
100
+ step: number;
101
+ completed?: boolean;
102
+ disabled?: boolean;
103
+ loading?: boolean;
104
+ }
105
+ declare function StepperItem({
106
+ step,
107
+ completed,
108
+ disabled,
109
+ loading,
110
+ className,
111
+ ref,
112
+ ...props
113
+ }: StepperItemProps & {
114
+ ref?: React.Ref<HTMLDivElement>;
115
+ }): React.JSX.Element;
116
+ interface StepperTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {}
117
+ declare function StepperTrigger({
118
+ className,
119
+ children,
120
+ disabled,
121
+ id,
122
+ "aria-controls": ariaControls,
123
+ tabIndex,
124
+ onClick,
125
+ onKeyDown,
126
+ ref,
127
+ ...props
128
+ }: StepperTriggerProps & {
129
+ ref?: React.Ref<HTMLButtonElement>;
130
+ }): React.JSX.Element;
131
+ interface StepperIndicatorProps extends React.ComponentPropsWithoutRef<"span"> {}
132
+ declare function StepperIndicator({
133
+ className,
134
+ children,
135
+ ref,
136
+ ...props
137
+ }: StepperIndicatorProps & {
138
+ ref?: React.Ref<HTMLSpanElement>;
139
+ }): React.JSX.Element;
140
+ interface StepperSeparatorProps extends React.ComponentPropsWithoutRef<"span"> {}
141
+ declare function StepperSeparator({
142
+ className,
143
+ ref,
144
+ ...props
145
+ }: StepperSeparatorProps & {
146
+ ref?: React.Ref<HTMLSpanElement>;
147
+ }): React.JSX.Element;
148
+ interface StepperTitleProps extends React.ComponentPropsWithoutRef<"h3"> {}
149
+ declare function StepperTitle({
150
+ className,
151
+ children,
152
+ ref,
153
+ ...props
154
+ }: StepperTitleProps & {
155
+ ref?: React.Ref<HTMLHeadingElement>;
156
+ }): React.JSX.Element;
157
+ interface StepperDescriptionProps extends React.ComponentPropsWithoutRef<"div"> {}
158
+ declare function StepperDescription({
159
+ className,
160
+ ref,
161
+ ...props
162
+ }: StepperDescriptionProps & {
163
+ ref?: React.Ref<HTMLDivElement>;
164
+ }): React.JSX.Element;
165
+ interface StepperPanelProps extends React.ComponentPropsWithoutRef<"div"> {}
166
+ declare function StepperPanel({
167
+ className,
168
+ ref,
169
+ ...props
170
+ }: StepperPanelProps & {
171
+ ref?: React.Ref<HTMLDivElement>;
172
+ }): React.JSX.Element;
173
+ interface StepperContentProps extends React.ComponentPropsWithoutRef<"div"> {
174
+ value: number;
175
+ forceMount?: boolean;
176
+ }
177
+ declare function StepperContent({
178
+ value,
179
+ forceMount,
180
+ className,
181
+ children,
182
+ id,
183
+ "aria-labelledby": ariaLabelledBy,
184
+ ref,
185
+ ...props
186
+ }: StepperContentProps & {
187
+ ref?: React.Ref<HTMLDivElement>;
188
+ }): React.JSX.Element | null;
189
+ //#endregion
190
+ export { StepIndicators, StepItemContextValue, Stepper, StepperContent, StepperContentProps, StepperContextValue, StepperDescription, StepperDescriptionProps, StepperIndicator, StepperIndicatorProps, StepperItem, StepperItemProps, StepperNav, StepperNavProps, StepperOrientation, StepperPanel, StepperPanelProps, StepperProps, StepperSeparator, StepperSeparatorProps, StepperState, StepperTitle, StepperTitleProps, StepperTrigger, StepperTriggerProps, useStepItem, useStepper };