@mcp-b/react-components 0.1.1 → 0.1.2

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 +16 -7
  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 { Dialog as Dialog$1 } from "@base-ui/react/dialog";
3
+
4
+ //#region src/components/Dialog.d.ts
5
+ interface DialogProps extends Dialog$1.Root.Props {}
6
+ interface DialogTriggerProps extends Dialog$1.Trigger.Props {}
7
+ interface DialogPortalProps extends Dialog$1.Portal.Props {}
8
+ interface DialogBackdropProps extends Omit<Dialog$1.Backdrop.Props, "className"> {
9
+ className?: string;
10
+ }
11
+ interface DialogPopupProps extends Omit<Dialog$1.Popup.Props, "className"> {
12
+ className?: string;
13
+ /**
14
+ * The size of the dialog.
15
+ * @default 'md'
16
+ */
17
+ size?: "sm" | "md" | "lg" | "fullscreen";
18
+ }
19
+ interface DialogTitleProps extends Omit<Dialog$1.Title.Props, "className"> {
20
+ className?: string;
21
+ }
22
+ interface DialogDescriptionProps extends Omit<Dialog$1.Description.Props, "className"> {
23
+ className?: string;
24
+ }
25
+ interface DialogCloseProps extends Omit<Dialog$1.Close.Props, "className"> {
26
+ className?: string;
27
+ }
28
+ type DialogOverlayProps = DialogBackdropProps;
29
+ type DialogContentProps = DialogPopupProps & {
30
+ showCloseButton?: boolean;
31
+ };
32
+ interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
33
+ interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {
34
+ showCloseButton?: boolean;
35
+ }
36
+ /**
37
+ * A dialog component for modal interactions.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * <Dialog open={isOpen} onOpenChange={setIsOpen}>
42
+ * <DialogPortal>
43
+ * <DialogBackdrop />
44
+ * <DialogPopup>
45
+ * <DialogTitle>Confirm</DialogTitle>
46
+ * <DialogDescription>Are you sure?</DialogDescription>
47
+ * <DialogClose>Cancel</DialogClose>
48
+ * </DialogPopup>
49
+ * </DialogPortal>
50
+ * </Dialog>
51
+ * ```
52
+ *
53
+ * @see {@link https://base-ui.com/react/components/dialog | Base UI Dialog}
54
+ */
55
+ declare const Dialog: typeof Dialog$1.Root;
56
+ declare function DialogTrigger(props: DialogTriggerProps): React.JSX.Element;
57
+ declare const DialogPortal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
58
+ declare function DialogBackdrop({
59
+ className,
60
+ ref,
61
+ ...props
62
+ }: DialogBackdropProps & {
63
+ ref?: React.Ref<HTMLDivElement>;
64
+ }): React.JSX.Element;
65
+ declare const DialogOverlay: typeof DialogBackdrop;
66
+ declare function DialogPopup({
67
+ size,
68
+ className,
69
+ ref,
70
+ ...props
71
+ }: DialogPopupProps & {
72
+ ref?: React.Ref<HTMLDivElement>;
73
+ }): React.JSX.Element;
74
+ declare function DialogContent({
75
+ children,
76
+ showCloseButton,
77
+ ref,
78
+ ...props
79
+ }: DialogContentProps & {
80
+ ref?: React.Ref<HTMLDivElement>;
81
+ }): React.JSX.Element;
82
+ declare function DialogHeader({
83
+ className,
84
+ ref,
85
+ ...props
86
+ }: DialogHeaderProps & {
87
+ ref?: React.Ref<HTMLDivElement>;
88
+ }): React.JSX.Element;
89
+ declare function DialogFooter({
90
+ className,
91
+ showCloseButton,
92
+ children,
93
+ ref,
94
+ ...props
95
+ }: DialogFooterProps & {
96
+ ref?: React.Ref<HTMLDivElement>;
97
+ }): React.JSX.Element;
98
+ declare function DialogTitle({
99
+ className,
100
+ ref,
101
+ ...props
102
+ }: DialogTitleProps & {
103
+ ref?: React.Ref<HTMLHeadingElement>;
104
+ }): React.JSX.Element;
105
+ declare function DialogDescription({
106
+ className,
107
+ ref,
108
+ ...props
109
+ }: DialogDescriptionProps & {
110
+ ref?: React.Ref<HTMLParagraphElement>;
111
+ }): React.JSX.Element;
112
+ declare function DialogClose({
113
+ className,
114
+ ref,
115
+ ...props
116
+ }: DialogCloseProps & {
117
+ ref?: React.Ref<HTMLButtonElement>;
118
+ }): React.JSX.Element;
119
+ //#endregion
120
+ export { Dialog, DialogBackdrop, DialogBackdropProps, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogOverlay, DialogOverlayProps, DialogPopup, DialogPopupProps, DialogPortal, DialogPortalProps, DialogProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps };
@@ -0,0 +1,114 @@
1
+ import { O as XIcon } from "../icons-BsWc8g4E.js";
2
+ import "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
5
+ //#region src/components/Dialog.tsx
6
+ /**
7
+ * A dialog component for modal interactions.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <Dialog open={isOpen} onOpenChange={setIsOpen}>
12
+ * <DialogPortal>
13
+ * <DialogBackdrop />
14
+ * <DialogPopup>
15
+ * <DialogTitle>Confirm</DialogTitle>
16
+ * <DialogDescription>Are you sure?</DialogDescription>
17
+ * <DialogClose>Cancel</DialogClose>
18
+ * </DialogPopup>
19
+ * </DialogPortal>
20
+ * </Dialog>
21
+ * ```
22
+ *
23
+ * @see {@link https://base-ui.com/react/components/dialog | Base UI Dialog}
24
+ */
25
+ const Dialog = Dialog$1.Root;
26
+ function DialogTrigger(props) {
27
+ return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
28
+ "data-slot": "dialog-trigger",
29
+ ...props
30
+ });
31
+ }
32
+ const DialogPortal = Dialog$1.Portal;
33
+ function DialogBackdrop({ className = "", ref, ...props }) {
34
+ const classes = ["dialog__backdrop", className].filter(Boolean).join(" ");
35
+ return /* @__PURE__ */ jsx(Dialog$1.Backdrop, {
36
+ ref,
37
+ "data-slot": "dialog-overlay",
38
+ className: classes,
39
+ ...props
40
+ });
41
+ }
42
+ const DialogOverlay = DialogBackdrop;
43
+ function DialogPopup({ size = "md", className = "", ref, ...props }) {
44
+ const classes = [
45
+ "dialog__popup",
46
+ size !== "md" && `dialog__popup--${size}`,
47
+ className
48
+ ].filter(Boolean).join(" ");
49
+ return /* @__PURE__ */ jsx(Dialog$1.Popup, {
50
+ ref,
51
+ "data-slot": "dialog-content",
52
+ className: classes,
53
+ ...props
54
+ });
55
+ }
56
+ function DialogContent({ children, showCloseButton = true, ref, ...props }) {
57
+ return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, {}), /* @__PURE__ */ jsxs(DialogPopup, {
58
+ ref,
59
+ ...props,
60
+ children: [children, showCloseButton ? /* @__PURE__ */ jsxs(DialogClose, {
61
+ className: "dialog__close--icon",
62
+ children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
63
+ className: "dialog__close-label",
64
+ children: "Close"
65
+ })]
66
+ }) : null]
67
+ })] });
68
+ }
69
+ function DialogHeader({ className = "", ref, ...props }) {
70
+ return /* @__PURE__ */ jsx("div", {
71
+ ref,
72
+ "data-slot": "dialog-header",
73
+ className: ["dialog__header", className].filter(Boolean).join(" "),
74
+ ...props
75
+ });
76
+ }
77
+ function DialogFooter({ className = "", showCloseButton = false, children, ref, ...props }) {
78
+ return /* @__PURE__ */ jsxs("div", {
79
+ ref,
80
+ "data-slot": "dialog-footer",
81
+ className: ["dialog__footer", className].filter(Boolean).join(" "),
82
+ ...props,
83
+ children: [children, showCloseButton ? /* @__PURE__ */ jsx(DialogClose, { children: "Close" }) : null]
84
+ });
85
+ }
86
+ function DialogTitle({ className = "", ref, ...props }) {
87
+ const classes = ["dialog__title", className].filter(Boolean).join(" ");
88
+ return /* @__PURE__ */ jsx(Dialog$1.Title, {
89
+ ref,
90
+ "data-slot": "dialog-title",
91
+ className: classes,
92
+ ...props
93
+ });
94
+ }
95
+ function DialogDescription({ className = "", ref, ...props }) {
96
+ const classes = ["dialog__description", className].filter(Boolean).join(" ");
97
+ return /* @__PURE__ */ jsx(Dialog$1.Description, {
98
+ ref,
99
+ "data-slot": "dialog-description",
100
+ className: classes,
101
+ ...props
102
+ });
103
+ }
104
+ function DialogClose({ className = "", ref, ...props }) {
105
+ const classes = ["dialog__close", className].filter(Boolean).join(" ");
106
+ return /* @__PURE__ */ jsx(Dialog$1.Close, {
107
+ ref,
108
+ "data-slot": "dialog-close",
109
+ className: classes,
110
+ ...props
111
+ });
112
+ }
113
+ //#endregion
114
+ export { Dialog, DialogBackdrop, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPopup, DialogPortal, DialogTitle, DialogTrigger };
@@ -0,0 +1,176 @@
1
+ import { r as ButtonProps } from "../Button-QCM8ZKgR.js";
2
+ import * as React from "react";
3
+
4
+ //#region src/components/EnvironmentVariables.d.ts
5
+ interface EnvironmentVariablesProps extends React.HTMLAttributes<HTMLDivElement> {
6
+ /** Controlled visibility for all variable values. */
7
+ showValues?: boolean;
8
+ /** Initial visibility for uncontrolled value reveal state. */
9
+ defaultShowValues?: boolean;
10
+ /** Called when the reveal switch changes value visibility. */
11
+ onShowValuesChange?: (show: boolean) => void;
12
+ /** Additional class names for layout only; do not override masking styles from apps. */
13
+ className?: string;
14
+ /** Header, content, groups, and variable rows. */
15
+ children?: React.ReactNode;
16
+ }
17
+ /**
18
+ * A panel displaying environment variables with masked values and per-variable
19
+ * copy actions. Toggle the reveal switch to show all values at once.
20
+ *
21
+ * Built internally for deployment/setup screens. Use it to display known
22
+ * environment keys and copyable values. Do not treat masking as a security
23
+ * boundary; do not render secrets for users who are not allowed to see them.
24
+ *
25
+ * Sigvelo changes: composes Badge, Button, Switch, and Tooltip; maps copy and
26
+ * reveal controls to Sigvelo CSS tokens; keeps masking local to the component.
27
+ *
28
+ * Values need visible labels and copy buttons need accessible labels. Styling
29
+ * consumes text, muted text, border, surface, spacing, radius, and focus tokens.
30
+ * Add shared formats here if multiple apps need them.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * <EnvironmentVariables defaultShowValues={false}>
35
+ * <EnvironmentVariablesHeader>
36
+ * <EnvironmentVariablesTitle>Server env</EnvironmentVariablesTitle>
37
+ * <EnvironmentVariablesToggle />
38
+ * </EnvironmentVariablesHeader>
39
+ * <EnvironmentVariablesContent>
40
+ * <EnvironmentVariable name="DATABASE_URL" value="postgres://localhost/x">
41
+ * <EnvironmentVariableName />
42
+ * <EnvironmentVariableValue />
43
+ * <EnvironmentVariableRequired />
44
+ * <EnvironmentVariableCopyButton format="export" />
45
+ * </EnvironmentVariable>
46
+ * </EnvironmentVariablesContent>
47
+ * </EnvironmentVariables>
48
+ * ```
49
+ */
50
+ declare function EnvironmentVariables({
51
+ className,
52
+ showValues,
53
+ defaultShowValues,
54
+ onShowValuesChange,
55
+ children,
56
+ ref,
57
+ ...props
58
+ }: EnvironmentVariablesProps & {
59
+ ref?: React.Ref<HTMLDivElement>;
60
+ }): React.JSX.Element;
61
+ interface EnvironmentVariablesHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
62
+ declare function EnvironmentVariablesHeader({
63
+ className,
64
+ children,
65
+ ref,
66
+ ...props
67
+ }: EnvironmentVariablesHeaderProps & {
68
+ ref?: React.Ref<HTMLDivElement>;
69
+ }): React.JSX.Element;
70
+ interface EnvironmentVariablesTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {}
71
+ declare function EnvironmentVariablesTitle({
72
+ className,
73
+ children,
74
+ ref,
75
+ ...props
76
+ }: EnvironmentVariablesTitleProps & {
77
+ ref?: React.Ref<HTMLHeadingElement>;
78
+ }): React.JSX.Element;
79
+ interface EnvironmentVariablesToggleProps extends Omit<React.HTMLAttributes<HTMLLabelElement>, "onChange"> {
80
+ /** Optional label. Defaults to "Show values". */
81
+ label?: string;
82
+ }
83
+ declare function EnvironmentVariablesToggle({
84
+ className,
85
+ label,
86
+ ref,
87
+ ...props
88
+ }: EnvironmentVariablesToggleProps & {
89
+ ref?: React.Ref<HTMLLabelElement>;
90
+ }): React.JSX.Element;
91
+ interface EnvironmentVariablesContentProps extends React.HTMLAttributes<HTMLDivElement> {}
92
+ declare function EnvironmentVariablesContent({
93
+ className,
94
+ children,
95
+ ref,
96
+ ...props
97
+ }: EnvironmentVariablesContentProps & {
98
+ ref?: React.Ref<HTMLDivElement>;
99
+ }): React.JSX.Element;
100
+ interface EnvironmentVariableGroupProps extends React.HTMLAttributes<HTMLDivElement> {
101
+ label?: string;
102
+ }
103
+ declare function EnvironmentVariableGroup({
104
+ className,
105
+ label,
106
+ children,
107
+ ref,
108
+ ...props
109
+ }: EnvironmentVariableGroupProps & {
110
+ ref?: React.Ref<HTMLDivElement>;
111
+ }): React.JSX.Element;
112
+ interface EnvironmentVariableProps extends React.HTMLAttributes<HTMLDivElement> {
113
+ name: string;
114
+ value: string;
115
+ }
116
+ declare function EnvironmentVariable({
117
+ className,
118
+ name,
119
+ value,
120
+ children,
121
+ ref,
122
+ ...props
123
+ }: EnvironmentVariableProps & {
124
+ ref?: React.Ref<HTMLDivElement>;
125
+ }): React.JSX.Element;
126
+ interface EnvironmentVariableNameProps extends React.HTMLAttributes<HTMLSpanElement> {}
127
+ declare function EnvironmentVariableName({
128
+ className,
129
+ children,
130
+ ref,
131
+ ...props
132
+ }: EnvironmentVariableNameProps & {
133
+ ref?: React.Ref<HTMLSpanElement>;
134
+ }): React.JSX.Element;
135
+ interface EnvironmentVariableValueProps extends React.HTMLAttributes<HTMLSpanElement> {}
136
+ declare function EnvironmentVariableValue({
137
+ className,
138
+ children,
139
+ ref,
140
+ ...props
141
+ }: EnvironmentVariableValueProps & {
142
+ ref?: React.Ref<HTMLSpanElement>;
143
+ }): React.JSX.Element;
144
+ type EnvironmentVariableCopyFormat = "name" | "value" | "export";
145
+ interface EnvironmentVariableCopyButtonProps extends Omit<ButtonProps, "children" | "variant" | "size" | "color" | "className" | "onClick" | "onError"> {
146
+ format?: EnvironmentVariableCopyFormat;
147
+ copyFormat?: EnvironmentVariableCopyFormat;
148
+ label?: string;
149
+ className?: string;
150
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
151
+ onCopy?: () => void;
152
+ onError?: (error: Error) => void;
153
+ timeout?: number;
154
+ }
155
+ declare function EnvironmentVariableCopyButton({
156
+ className,
157
+ format,
158
+ copyFormat,
159
+ label,
160
+ onClick,
161
+ onCopy,
162
+ onError,
163
+ timeout,
164
+ ...props
165
+ }: EnvironmentVariableCopyButtonProps): React.JSX.Element;
166
+ interface EnvironmentVariableRequiredProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "color"> {}
167
+ declare function EnvironmentVariableRequired({
168
+ className,
169
+ children,
170
+ ref,
171
+ ...props
172
+ }: EnvironmentVariableRequiredProps & {
173
+ ref?: React.Ref<HTMLSpanElement>;
174
+ }): React.JSX.Element;
175
+ //#endregion
176
+ export { EnvironmentVariable, EnvironmentVariableCopyButton, EnvironmentVariableCopyButtonProps, EnvironmentVariableCopyFormat, EnvironmentVariableGroup, EnvironmentVariableGroupProps, EnvironmentVariableName, EnvironmentVariableNameProps, EnvironmentVariableProps, EnvironmentVariableRequired, EnvironmentVariableRequiredProps, EnvironmentVariableValue, EnvironmentVariableValueProps, EnvironmentVariables, EnvironmentVariablesContent, EnvironmentVariablesContentProps, EnvironmentVariablesHeader, EnvironmentVariablesHeaderProps, EnvironmentVariablesProps, EnvironmentVariablesTitle, EnvironmentVariablesTitleProps, EnvironmentVariablesToggle, EnvironmentVariablesToggleProps };
@@ -0,0 +1,221 @@
1
+ import { f as EyeIcon, l as CopyIcon, o as CheckIcon, p as EyeOffIcon } from "../icons-BsWc8g4E.js";
2
+ import { t as cx } from "../class-names-9UtZwb0J.js";
3
+ import { Button } from "./Button.js";
4
+ import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
5
+ import { Badge } from "./Badge.js";
6
+ import { Switch, SwitchThumb } from "./Switch.js";
7
+ import * as React from "react";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ //#region src/components/EnvironmentVariables.tsx
10
+ const EnvStateContext = React.createContext(null);
11
+ function useEnvStateContext() {
12
+ const ctx = React.useContext(EnvStateContext);
13
+ if (!ctx) throw new Error("EnvironmentVariable subcomponents must be used inside <EnvironmentVariables>.");
14
+ return ctx;
15
+ }
16
+ const VariableContext = React.createContext(null);
17
+ function useVariableContext() {
18
+ const ctx = React.useContext(VariableContext);
19
+ if (!ctx) throw new Error("EnvironmentVariableName/Value must be inside <EnvironmentVariable>.");
20
+ return ctx;
21
+ }
22
+ /**
23
+ * A panel displaying environment variables with masked values and per-variable
24
+ * copy actions. Toggle the reveal switch to show all values at once.
25
+ *
26
+ * Built internally for deployment/setup screens. Use it to display known
27
+ * environment keys and copyable values. Do not treat masking as a security
28
+ * boundary; do not render secrets for users who are not allowed to see them.
29
+ *
30
+ * Sigvelo changes: composes Badge, Button, Switch, and Tooltip; maps copy and
31
+ * reveal controls to Sigvelo CSS tokens; keeps masking local to the component.
32
+ *
33
+ * Values need visible labels and copy buttons need accessible labels. Styling
34
+ * consumes text, muted text, border, surface, spacing, radius, and focus tokens.
35
+ * Add shared formats here if multiple apps need them.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <EnvironmentVariables defaultShowValues={false}>
40
+ * <EnvironmentVariablesHeader>
41
+ * <EnvironmentVariablesTitle>Server env</EnvironmentVariablesTitle>
42
+ * <EnvironmentVariablesToggle />
43
+ * </EnvironmentVariablesHeader>
44
+ * <EnvironmentVariablesContent>
45
+ * <EnvironmentVariable name="DATABASE_URL" value="postgres://localhost/x">
46
+ * <EnvironmentVariableName />
47
+ * <EnvironmentVariableValue />
48
+ * <EnvironmentVariableRequired />
49
+ * <EnvironmentVariableCopyButton format="export" />
50
+ * </EnvironmentVariable>
51
+ * </EnvironmentVariablesContent>
52
+ * </EnvironmentVariables>
53
+ * ```
54
+ */
55
+ function EnvironmentVariables({ className, showValues, defaultShowValues = false, onShowValuesChange, children, ref, ...props }) {
56
+ const [internal, setInternal] = React.useState(defaultShowValues);
57
+ const isControlled = showValues !== void 0;
58
+ const current = isControlled ? showValues : internal;
59
+ const setShowValues = React.useCallback((next) => {
60
+ if (!isControlled) setInternal(next);
61
+ onShowValuesChange?.(next);
62
+ }, [isControlled, onShowValuesChange]);
63
+ const ctxValue = React.useMemo(() => ({
64
+ showValues: current,
65
+ setShowValues
66
+ }), [current, setShowValues]);
67
+ return /* @__PURE__ */ jsx(EnvStateContext.Provider, {
68
+ value: ctxValue,
69
+ children: /* @__PURE__ */ jsx("div", {
70
+ ref,
71
+ className: cx("environment-variables", className),
72
+ ...props,
73
+ children
74
+ })
75
+ });
76
+ }
77
+ function EnvironmentVariablesHeader({ className, children, ref, ...props }) {
78
+ return /* @__PURE__ */ jsx("div", {
79
+ ref,
80
+ className: cx("environment-variables__header", className),
81
+ ...props,
82
+ children
83
+ });
84
+ }
85
+ function EnvironmentVariablesTitle({ className, children, ref, ...props }) {
86
+ return /* @__PURE__ */ jsx("h3", {
87
+ ref,
88
+ className: cx("environment-variables__title", className),
89
+ ...props,
90
+ children: children ?? "Environment Variables"
91
+ });
92
+ }
93
+ function EnvironmentVariablesToggle({ className, label = "Show values", ref, ...props }) {
94
+ const { showValues, setShowValues } = useEnvStateContext();
95
+ return /* @__PURE__ */ jsxs("label", {
96
+ ref,
97
+ className: cx("environment-variables__toggle", className),
98
+ ...props,
99
+ children: [
100
+ /* @__PURE__ */ jsx("span", {
101
+ "aria-hidden": "true",
102
+ className: "environment-variables__toggle-icon",
103
+ children: showValues ? /* @__PURE__ */ jsx(EyeIcon, {}) : /* @__PURE__ */ jsx(EyeOffIcon, {})
104
+ }),
105
+ /* @__PURE__ */ jsx("span", {
106
+ className: "environment-variables__toggle-label",
107
+ children: label
108
+ }),
109
+ /* @__PURE__ */ jsx(Switch, {
110
+ checked: showValues,
111
+ onCheckedChange: setShowValues,
112
+ size: "sm",
113
+ children: /* @__PURE__ */ jsx(SwitchThumb, {})
114
+ })
115
+ ]
116
+ });
117
+ }
118
+ function EnvironmentVariablesContent({ className, children, ref, ...props }) {
119
+ return /* @__PURE__ */ jsx("div", {
120
+ ref,
121
+ className: cx("environment-variables__content", className),
122
+ ...props,
123
+ children
124
+ });
125
+ }
126
+ function EnvironmentVariableGroup({ className, label, children, ref, ...props }) {
127
+ return /* @__PURE__ */ jsxs("div", {
128
+ ref,
129
+ className: cx("environment-variables__group", className),
130
+ ...props,
131
+ children: [label ? /* @__PURE__ */ jsx("div", {
132
+ className: "environment-variables__group-label",
133
+ children: label
134
+ }) : null, children]
135
+ });
136
+ }
137
+ function EnvironmentVariable({ className, name, value, children, ref, ...props }) {
138
+ const ctxValue = React.useMemo(() => ({
139
+ name,
140
+ value
141
+ }), [name, value]);
142
+ return /* @__PURE__ */ jsx(VariableContext.Provider, {
143
+ value: ctxValue,
144
+ children: /* @__PURE__ */ jsx("div", {
145
+ ref,
146
+ className: cx("environment-variables__row", className),
147
+ ...props,
148
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(EnvironmentVariableName, {}), /* @__PURE__ */ jsx(EnvironmentVariableValue, {})] })
149
+ })
150
+ });
151
+ }
152
+ function EnvironmentVariableName({ className, children, ref, ...props }) {
153
+ const { name } = useVariableContext();
154
+ return /* @__PURE__ */ jsx("span", {
155
+ ref,
156
+ className: cx("environment-variables__name", className),
157
+ ...props,
158
+ children: children ?? name
159
+ });
160
+ }
161
+ function EnvironmentVariableValue({ className, children, ref, ...props }) {
162
+ const { value } = useVariableContext();
163
+ const { showValues } = useEnvStateContext();
164
+ const masked = "•".repeat(Math.min(value.length, 12));
165
+ return /* @__PURE__ */ jsx("span", {
166
+ ref,
167
+ className: cx("environment-variables__value", className),
168
+ ...props,
169
+ children: children ?? (showValues ? value : masked)
170
+ });
171
+ }
172
+ function EnvironmentVariableCopyButton({ className, format = "value", copyFormat, label, onClick, onCopy, onError, timeout = 1500, ...props }) {
173
+ const { name, value } = useVariableContext();
174
+ const [copied, setCopied] = React.useState(false);
175
+ const timeoutRef = React.useRef(null);
176
+ const resolvedFormat = copyFormat ?? format;
177
+ const text = resolvedFormat === "name" ? name : resolvedFormat === "export" ? `export ${name}="${value}"` : value;
178
+ const buttonLabel = label ?? `Copy ${resolvedFormat}`;
179
+ const handleClick = React.useCallback(async (e) => {
180
+ try {
181
+ await navigator.clipboard.writeText(text);
182
+ setCopied(true);
183
+ onCopy?.();
184
+ if (timeoutRef.current !== null) window.clearTimeout(timeoutRef.current);
185
+ timeoutRef.current = window.setTimeout(() => setCopied(false), timeout);
186
+ } catch (error) {
187
+ onError?.(error);
188
+ }
189
+ onClick?.(e);
190
+ }, [
191
+ onClick,
192
+ onCopy,
193
+ onError,
194
+ text,
195
+ timeout
196
+ ]);
197
+ React.useEffect(() => () => {
198
+ if (timeoutRef.current !== null) window.clearTimeout(timeoutRef.current);
199
+ }, []);
200
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Button, {
201
+ variant: "ghost",
202
+ size: "icon",
203
+ "aria-label": buttonLabel,
204
+ className: cx("environment-variables__copy", className),
205
+ ...props,
206
+ onClick: handleClick,
207
+ children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
208
+ }) }), /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipPositioner, { children: /* @__PURE__ */ jsx(TooltipPopup, { children: copied ? "Copied" : buttonLabel }) }) })] });
209
+ }
210
+ function EnvironmentVariableRequired({ className, children, ref, ...props }) {
211
+ return /* @__PURE__ */ jsx(Badge, {
212
+ ...props,
213
+ ref,
214
+ color: "warning",
215
+ size: "sm",
216
+ className: cx("environment-variables__required", className),
217
+ children: children ?? "Required"
218
+ });
219
+ }
220
+ //#endregion
221
+ export { EnvironmentVariable, EnvironmentVariableCopyButton, EnvironmentVariableGroup, EnvironmentVariableName, EnvironmentVariableRequired, EnvironmentVariableValue, EnvironmentVariables, EnvironmentVariablesContent, EnvironmentVariablesHeader, EnvironmentVariablesTitle, EnvironmentVariablesToggle };