@burtson-labs/ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSES/DEPENDENCIES.txt +1 -1
- package/README.md +15 -11
- package/dist/components/accordion.d.ts +3 -3
- package/dist/components/accordion.js +13 -10
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/agent-run.d.ts +22 -0
- package/dist/components/agent-run.js +131 -0
- package/dist/components/agent-run.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +12 -10
- package/dist/components/alert-dialog.js +29 -20
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.d.ts +5 -3
- package/dist/components/alert.js +11 -7
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-shell.d.ts +7 -6
- package/dist/components/app-shell.js +21 -14
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/attachment.d.ts +3 -3
- package/dist/components/attachment.js +10 -7
- package/dist/components/attachment.js.map +1 -1
- package/dist/components/audio-player.d.ts +2 -2
- package/dist/components/audio-player.js +8 -6
- package/dist/components/audio-player.js.map +1 -1
- package/dist/components/avatar-upload.d.ts +19 -0
- package/dist/components/avatar-upload.js +359 -0
- package/dist/components/avatar-upload.js.map +1 -0
- package/dist/components/avatar.d.ts +3 -3
- package/dist/components/avatar.js +10 -7
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +12 -10
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +24 -17
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.d.ts +8 -1
- package/dist/components/button.js +12 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +8 -8
- package/dist/components/card.js +32 -23
- package/dist/components/card.js.map +1 -1
- package/dist/components/chat-history.d.ts +1 -1
- package/dist/components/chat-history.js +10 -9
- package/dist/components/chat-history.js.map +1 -1
- package/dist/components/chat-layout.d.ts +1 -1
- package/dist/components/chat-layout.js +7 -3
- package/dist/components/chat-layout.js.map +1 -1
- package/dist/components/checkbox-card.d.ts +2 -2
- package/dist/components/checkbox-card.js +9 -7
- package/dist/components/checkbox-card.js.map +1 -1
- package/dist/components/checkbox.d.ts +23 -2
- package/dist/components/checkbox.js +48 -6
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.d.ts +2 -2
- package/dist/components/collapsible.js +7 -5
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.d.ts +14 -4
- package/dist/components/combobox.js +18 -8
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.d.ts +68 -12
- package/dist/components/command.js +38 -25
- package/dist/components/command.js.map +1 -1
- package/dist/components/composer.d.ts +2 -2
- package/dist/components/composer.js +9 -7
- package/dist/components/composer.js.map +1 -1
- package/dist/components/connection-status.d.ts +3 -3
- package/dist/components/connection-status.js +18 -14
- package/dist/components/connection-status.js.map +1 -1
- package/dist/components/context-menu.d.ts +14 -13
- package/dist/components/context-menu.js +33 -23
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/conversation.d.ts +1 -1
- package/dist/components/conversation.js +6 -5
- package/dist/components/conversation.js.map +1 -1
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +3 -2
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table.d.ts +7 -2
- package/dist/components/data-table.js +16 -42
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/dialog.d.ts +18 -9
- package/dist/components/dialog.js +38 -22
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +14 -13
- package/dist/components/dropdown-menu.js +33 -23
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editor-tabs.d.ts +1 -1
- package/dist/components/editor-tabs.js +6 -5
- package/dist/components/editor-tabs.js.map +1 -1
- package/dist/components/empty-state.d.ts +5 -5
- package/dist/components/empty-state.js +16 -11
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/error-summary.d.ts +21 -0
- package/dist/components/error-summary.js +62 -0
- package/dist/components/error-summary.js.map +1 -0
- package/dist/components/field.d.ts +66 -7
- package/dist/components/field.js +151 -20
- package/dist/components/field.js.map +1 -1
- package/dist/components/form-actions.d.ts +18 -0
- package/dist/components/form-actions.js +30 -0
- package/dist/components/form-actions.js.map +1 -0
- package/dist/components/icon-button.d.ts +3 -1
- package/dist/components/icon-button.js +5 -3
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/input.d.ts +42 -7
- package/dist/components/input.js +53 -10
- package/dist/components/input.js.map +1 -1
- package/dist/components/kbd.d.ts +2 -2
- package/dist/components/kbd.js +7 -5
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/label.d.ts +6 -1
- package/dist/components/label.js +10 -4
- package/dist/components/label.js.map +1 -1
- package/dist/components/markdown.d.ts +4 -3
- package/dist/components/markdown.js +7 -6
- package/dist/components/markdown.js.map +1 -1
- package/dist/components/menubar.d.ts +16 -14
- package/dist/components/menubar.js +39 -27
- package/dist/components/menubar.js.map +1 -1
- package/dist/components/message-actions.d.ts +3 -3
- package/dist/components/message-actions.js +15 -12
- package/dist/components/message-actions.js.map +1 -1
- package/dist/components/message.d.ts +1 -1
- package/dist/components/message.js +5 -3
- package/dist/components/message.js.map +1 -1
- package/dist/components/mobile-nav.d.ts +1 -1
- package/dist/components/mobile-nav.js +6 -5
- package/dist/components/mobile-nav.js.map +1 -1
- package/dist/components/native-select.d.ts +16 -0
- package/dist/components/native-select.js +33 -0
- package/dist/components/native-select.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +12 -11
- package/dist/components/navigation-menu.js +32 -23
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/number-input.d.ts +23 -0
- package/dist/components/number-input.js +45 -0
- package/dist/components/number-input.js.map +1 -0
- package/dist/components/onboarding-checklist.d.ts +1 -1
- package/dist/components/onboarding-checklist.js +4 -3
- package/dist/components/onboarding-checklist.js.map +1 -1
- package/dist/components/page-header.d.ts +7 -6
- package/dist/components/page-header.js +22 -15
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +3 -2
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.d.ts +13 -10
- package/dist/components/popover.js +23 -17
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +6 -5
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.d.ts +22 -3
- package/dist/components/radio-group.js +51 -10
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/reasoning.d.ts +3 -3
- package/dist/components/reasoning.js +9 -7
- package/dist/components/reasoning.js.map +1 -1
- package/dist/components/scroll-area.d.ts +3 -2
- package/dist/components/scroll-area.js +10 -7
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/secret-input.d.ts +3 -2
- package/dist/components/secret-input.js +6 -4
- package/dist/components/secret-input.js.map +1 -1
- package/dist/components/select.d.ts +11 -6
- package/dist/components/select.js +24 -18
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +4 -3
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.d.ts +10 -8
- package/dist/components/sheet.js +31 -20
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/skeleton.d.ts +2 -1
- package/dist/components/skeleton.js +6 -4
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.d.ts +10 -6
- package/dist/components/slider.js +15 -7
- package/dist/components/slider.js.map +1 -1
- package/dist/components/source.d.ts +2 -2
- package/dist/components/source.js +9 -7
- package/dist/components/source.js.map +1 -1
- package/dist/components/spinner.d.ts +4 -2
- package/dist/components/spinner.js +4 -3
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/stat-card.d.ts +27 -2
- package/dist/components/stat-card.js +69 -9
- package/dist/components/stat-card.js.map +1 -1
- package/dist/components/status.d.ts +7 -6
- package/dist/components/status.js +11 -5
- package/dist/components/status.js.map +1 -1
- package/dist/components/steps.d.ts +1 -1
- package/dist/components/steps.js +4 -3
- package/dist/components/steps.js.map +1 -1
- package/dist/components/switch.d.ts +46 -2
- package/dist/components/switch.js +85 -8
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +29 -12
- package/dist/components/table.js +79 -34
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +9 -4
- package/dist/components/tabs.js +22 -13
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.d.ts +6 -1
- package/dist/components/textarea.js +3 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast.d.ts +10 -6
- package/dist/components/toast.js +27 -18
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toaster.d.ts +4 -2
- package/dist/components/toaster.js +6 -2
- package/dist/components/toaster.js.map +1 -1
- package/dist/components/tool-call.d.ts +3 -3
- package/dist/components/tool-call.js +16 -12
- package/dist/components/tool-call.js.map +1 -1
- package/dist/components/toolbar.d.ts +9 -4
- package/dist/components/toolbar.js +14 -9
- package/dist/components/toolbar.js.map +1 -1
- package/dist/components/tooltip.d.ts +3 -2
- package/dist/components/tooltip.js +7 -4
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/tour.js +2 -2
- package/dist/components/tour.js.map +1 -1
- package/dist/components/tree-view.d.ts +1 -1
- package/dist/components/tree-view.js +9 -5
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/voice-recorder.d.ts +1 -1
- package/dist/components/voice-recorder.js +4 -2
- package/dist/components/voice-recorder.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +19 -12
- package/dist/lib/media.d.ts +18 -0
- package/dist/lib/media.js +34 -0
- package/dist/lib/media.js.map +1 -0
- package/dist/lib/utils.d.ts +32 -0
- package/dist/lib/utils.js +33 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/mui/index.js +20 -8
- package/dist/mui/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme.css +36 -17
- package/dist/tokens.d.ts +78 -36
- package/dist/tokens.js +63 -32
- package/dist/tokens.js.map +1 -1
- package/package.json +5 -3
package/dist/components/kbd.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
|
-
import "react";
|
|
3
|
+
import * as React from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/kbd.tsx
|
|
6
|
-
function Kbd({ className, ...props }) {
|
|
6
|
+
var Kbd = React.forwardRef(function Kbd({ className, ...props }, ref) {
|
|
7
7
|
return /* @__PURE__ */ jsx("kbd", {
|
|
8
|
+
ref,
|
|
8
9
|
"data-slot": "kbd",
|
|
9
10
|
className: cn("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center gap-1 rounded-xs border border-border-strong border-b-2 bg-surface-muted px-1 font-mono text-[11px] font-medium text-muted-foreground select-none [&_svg]:size-3", className),
|
|
10
11
|
...props
|
|
11
12
|
});
|
|
12
|
-
}
|
|
13
|
-
function KbdGroup({ className, ...props }) {
|
|
13
|
+
});
|
|
14
|
+
var KbdGroup = React.forwardRef(function KbdGroup({ className, ...props }, ref) {
|
|
14
15
|
return /* @__PURE__ */ jsx("span", {
|
|
16
|
+
ref,
|
|
15
17
|
"data-slot": "kbd-group",
|
|
16
18
|
className: cn("inline-flex items-center gap-1", className),
|
|
17
19
|
...props
|
|
18
20
|
});
|
|
19
|
-
}
|
|
21
|
+
});
|
|
20
22
|
//#endregion
|
|
21
23
|
export { Kbd, KbdGroup };
|
|
22
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kbd.js","names":[],"sources":["../../src/components/kbd.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\
|
|
1
|
+
{"version":3,"file":"kbd.js","names":[],"sources":["../../src/components/kbd.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nconst Kbd = React.forwardRef<HTMLElement, React.ComponentProps<'kbd'>>(function Kbd(\n { className, ...props },\n ref,\n) {\n return (\n <kbd\n ref={ref}\n data-slot=\"kbd\"\n className={cn(\n 'pointer-events-none inline-flex h-5 min-w-5 items-center justify-center gap-1 rounded-xs border border-border-strong border-b-2 bg-surface-muted px-1 font-mono text-[11px] font-medium text-muted-foreground select-none [&_svg]:size-3',\n className,\n )}\n {...props}\n />\n );\n});\n\nconst KbdGroup = React.forwardRef<HTMLSpanElement, React.ComponentProps<'span'>>(function KbdGroup(\n { className, ...props },\n ref,\n) {\n return (\n <span\n ref={ref}\n data-slot=\"kbd-group\"\n className={cn('inline-flex items-center gap-1', className)}\n {...props}\n />\n );\n});\n\nexport { Kbd, KbdGroup };\n"],"mappings":";;;;;AAIA,IAAM,MAAM,MAAM,WAAqD,SAAS,IAC9E,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAAC,OAAD;EACO;EACL,aAAU;EACV,WAAW,GACT,4OACA,SACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC;AAED,IAAM,WAAW,MAAM,WAA0D,SAAS,SACxF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAAC,QAAD;EACO;EACL,aAAU;EACV,WAAW,GAAG,kCAAkC,SAAS;EACzD,GAAI;CACL,CAAA;AAEL,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as LabelPrimitive from '../primitives/vendor/radix/react-label';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A caption for a control. Wrap a Checkbox, Switch or RadioGroupItem in it
|
|
5
|
+
* and the whole caption toggles the control; at least 44px tall on touch
|
|
6
|
+
* screens when it does.
|
|
7
|
+
*/
|
|
8
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
4
9
|
export { Label };
|
package/dist/components/label.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { Root } from "../primitives/vendor/radix/react-label/label.js";
|
|
4
|
-
import "react";
|
|
4
|
+
import * as React from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/label.tsx
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A caption for a control. Wrap a Checkbox, Switch or RadioGroupItem in it
|
|
9
|
+
* and the whole caption toggles the control; at least 44px tall on touch
|
|
10
|
+
* screens when it does.
|
|
11
|
+
*/
|
|
12
|
+
var Label = React.forwardRef(function Label({ className, ...props }, ref) {
|
|
8
13
|
return /* @__PURE__ */ jsx(Root, {
|
|
14
|
+
ref,
|
|
9
15
|
"data-slot": "label",
|
|
10
|
-
className: cn("flex items-center gap-2 text-[13px] leading-none font-semibold select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
16
|
+
className: cn("flex items-center gap-2 text-[13px] leading-none font-semibold select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50 has-[[data-slot=checkbox],[data-slot=switch],[data-slot=radio-group-item]]:cursor-pointer has-[[data-slot=checkbox],[data-slot=switch],[data-slot=radio-group-item]]:pointer-coarse:min-h-11", className),
|
|
11
17
|
...props
|
|
12
18
|
});
|
|
13
|
-
}
|
|
19
|
+
});
|
|
14
20
|
//#endregion
|
|
15
21
|
export { Label };
|
|
16
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","names":["LabelPrimitive.Root"],"sources":["../../src/components/label.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\nimport * as LabelPrimitive from '../primitives/vendor/radix/react-label';\n\
|
|
1
|
+
{"version":3,"file":"label.js","names":["LabelPrimitive.Root"],"sources":["../../src/components/label.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\nimport * as LabelPrimitive from '../primitives/vendor/radix/react-label';\n\n/**\n * A caption for a control. Wrap a Checkbox, Switch or RadioGroupItem in it\n * and the whole caption toggles the control; at least 44px tall on touch\n * screens when it does.\n */\nconst Label = React.forwardRef<HTMLLabelElement, React.ComponentProps<typeof LabelPrimitive.Root>>(\n function Label({ className, ...props }, ref) {\n return (\n <LabelPrimitive.Root\n ref={ref}\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-[13px] leading-none font-semibold select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50 has-[[data-slot=checkbox],[data-slot=switch],[data-slot=radio-group-item]]:cursor-pointer has-[[data-slot=checkbox],[data-slot=switch],[data-slot=radio-group-item]]:pointer-coarse:min-h-11',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport { Label };\n"],"mappings":";;;;;;;;;;;AAUA,IAAM,QAAQ,MAAM,WAClB,SAAS,MAAM,EAAE,WAAW,GAAG,SAAS,KAAK;CAC3C,OACE,oBAACA,MAAD;EACO;EACL,aAAU;EACV,WAAW,GACT,0ZACA,SACF;EACA,GAAI;CACL,CAAA;AAEL,CACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
/** A fenced code block with a language label and a copy button. */
|
|
3
|
-
|
|
3
|
+
export interface CodeBlockProps {
|
|
4
4
|
code: string;
|
|
5
5
|
lang?: string;
|
|
6
6
|
className?: string;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
|
+
declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
9
|
type Block = {
|
|
9
10
|
type: 'p';
|
|
10
11
|
text: string;
|
|
@@ -29,5 +30,5 @@ export interface MarkdownProps extends Omit<React.ComponentProps<'div'>, 'childr
|
|
|
29
30
|
children: string;
|
|
30
31
|
}
|
|
31
32
|
/** Renders a Markdown string safely, for assistant messages. */
|
|
32
|
-
declare
|
|
33
|
+
declare const Markdown: React.ForwardRefExoticComponent<Omit<MarkdownProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
33
34
|
export { CodeBlock, Markdown };
|
|
@@ -36,13 +36,13 @@ function inline(text, key) {
|
|
|
36
36
|
if (last < text.length) out.push(text.slice(last));
|
|
37
37
|
return out;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
function CodeBlock({ code, lang, className }) {
|
|
39
|
+
var CodeBlock = React.forwardRef(function CodeBlock({ code, lang, className }, ref) {
|
|
41
40
|
return /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
ref,
|
|
42
42
|
"data-slot": "code-block",
|
|
43
43
|
className: cn("overflow-hidden rounded-md border bg-code text-code-foreground", className),
|
|
44
44
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
45
|
-
className: "flex h-8 items-center justify-between border-b border-white/10 px-3 text-[11px] text-code-foreground/
|
|
45
|
+
className: "flex min-h-8 items-center justify-between border-b border-white/10 px-3 text-[11px] text-code-foreground/70",
|
|
46
46
|
children: [/* @__PURE__ */ jsx("span", {
|
|
47
47
|
className: "font-mono",
|
|
48
48
|
children: lang || "text"
|
|
@@ -56,7 +56,7 @@ function CodeBlock({ code, lang, className }) {
|
|
|
56
56
|
children: /* @__PURE__ */ jsx("code", { children: code })
|
|
57
57
|
})]
|
|
58
58
|
});
|
|
59
|
-
}
|
|
59
|
+
});
|
|
60
60
|
/** Split Markdown into blocks. Exported for tests. */
|
|
61
61
|
function parseMarkdown(source) {
|
|
62
62
|
const lines = source.replace(/\r\n?/g, "\n").split("\n");
|
|
@@ -122,9 +122,10 @@ function parseMarkdown(source) {
|
|
|
122
122
|
return blocks;
|
|
123
123
|
}
|
|
124
124
|
/** Renders a Markdown string safely, for assistant messages. */
|
|
125
|
-
function Markdown({ children, className, ...props }) {
|
|
125
|
+
var Markdown = React.forwardRef(function Markdown({ children, className, ...props }, ref) {
|
|
126
126
|
const blocks = React.useMemo(() => parseMarkdown(children), [children]);
|
|
127
127
|
return /* @__PURE__ */ jsx("div", {
|
|
128
|
+
ref,
|
|
128
129
|
"data-slot": "markdown",
|
|
129
130
|
className: cn("grid gap-3 text-sm leading-6 [&_li]:leading-6", className),
|
|
130
131
|
...props,
|
|
@@ -162,7 +163,7 @@ function Markdown({ children, className, ...props }) {
|
|
|
162
163
|
}
|
|
163
164
|
})
|
|
164
165
|
});
|
|
165
|
-
}
|
|
166
|
+
});
|
|
166
167
|
//#endregion
|
|
167
168
|
export { CodeBlock, Markdown, parseMarkdown };
|
|
168
169
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.js","names":[],"sources":["../../src/components/markdown.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { CopyButton } from './copy-button';\n\n/*\n * A small, safe Markdown renderer for chat: paragraphs, headings, bullet and\n * numbered lists, block quotes, fenced code, inline code, bold, italic and\n * links. Everything becomes React elements (never HTML strings), and links\n * only keep http(s) and mailto targets, so model output cannot inject markup\n * or script.\n */\n\nconst SAFE_HREF = /^(https?:\\/\\/|mailto:)/i;\n\nfunction inline(text: string, key: string): React.ReactNode[] {\n const out: React.ReactNode[] = [];\n const pattern =\n /(`[^`]+`)|(\\*\\*[^*]+\\*\\*|__[^_]+__)|(\\*[^*\\s][^*]*\\*|_[^_\\s][^_]*_)|(\\[[^\\]]+\\]\\([^)\\s]+\\))/g;\n let last = 0;\n let n = 0;\n for (const m of text.matchAll(pattern)) {\n const i = m.index;\n if (i > last) out.push(text.slice(last, i));\n const token = m[0];\n const k = `${key}-${n++}`;\n if (m[1]) {\n out.push(\n <code key={k} className=\"rounded-xs bg-muted px-1 py-0.5 font-mono text-[0.85em]\">\n {token.slice(1, -1)}\n </code>,\n );\n } else if (m[2]) {\n out.push(<strong key={k}>{inline(token.slice(2, -2), k)}</strong>);\n } else if (m[3]) {\n out.push(<em key={k}>{inline(token.slice(1, -1), k)}</em>);\n } else {\n const [, label = '', href = ''] = /^\\[([^\\]]+)\\]\\(([^)\\s]+)\\)$/.exec(token) ?? [];\n out.push(\n SAFE_HREF.test(href) ? (\n <a\n key={k}\n href={href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n className=\"text-brand underline underline-offset-2 hover:text-brand-hover\"\n >\n {label}\n </a>\n ) : (\n label\n ),\n );\n }\n last = i + token.length;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\n/** A fenced code block with a language label and a copy button. */\nfunction CodeBlock({ code, lang, className }: { code: string; lang?: string; className?: string }) {\n return (\n <div\n data-slot=\"code-block\"\n className={cn('overflow-hidden rounded-md border bg-code text-code-foreground', className)}\n >\n <div className=\"flex h-8 items-center justify-between border-b border-white/10 px-3 text-[11px] text-code-foreground/60\">\n <span className=\"font-mono\">{lang || 'text'}</span>\n <CopyButton\n value={code}\n label=\"Copy code\"\n className=\"size-7 text-code-foreground hover:bg-white/10 hover:text-code-foreground\"\n />\n </div>\n <pre className=\"overflow-x-auto p-3 font-mono text-[12.5px] leading-5\">\n <code>{code}</code>\n </pre>\n </div>\n );\n}\n\ntype Block =\n | { type: 'p'; text: string }\n | { type: 'h'; level: 1 | 2 | 3; text: string }\n | { type: 'ul' | 'ol'; items: string[] }\n | { type: 'quote'; text: string }\n | { type: 'code'; lang: string; code: string };\n\n/** Split Markdown into blocks. Exported for tests. */\nexport function parseMarkdown(source: string): Block[] {\n const lines = source.replace(/\\r\\n?/g, '\\n').split('\\n');\n const blocks: Block[] = [];\n let para: string[] = [];\n const flush = () => {\n if (para.length) blocks.push({ type: 'p', text: para.join(' ') });\n para = [];\n };\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? '';\n const fence = /^```\\s*([\\w+-]*)\\s*$/.exec(line);\n if (fence) {\n flush();\n const code: string[] = [];\n i++;\n while (i < lines.length && !/^```\\s*$/.test(lines[i] ?? '')) code.push(lines[i++] ?? '');\n blocks.push({ type: 'code', lang: fence[1] ?? '', code: code.join('\\n') });\n continue;\n }\n const heading = /^(#{1,3})\\s+(.*)$/.exec(line);\n if (heading) {\n flush();\n blocks.push({\n type: 'h',\n level: (heading[1]?.length ?? 1) as 1 | 2 | 3,\n text: heading[2] ?? '',\n });\n continue;\n }\n const list = /^\\s*([-*]|\\d+[.)])\\s+(.*)$/.exec(line);\n if (list) {\n flush();\n const type = /\\d/.test(list[1] ?? '') ? 'ol' : 'ul';\n const prev = blocks.at(-1);\n if (prev && prev.type === type) prev.items.push(list[2] ?? '');\n else blocks.push({ type, items: [list[2] ?? ''] });\n continue;\n }\n const quote = /^>\\s?(.*)$/.exec(line);\n if (quote) {\n flush();\n blocks.push({ type: 'quote', text: quote[1] ?? '' });\n continue;\n }\n if (!line.trim()) flush();\n else para.push(line.trim());\n }\n flush();\n return blocks;\n}\n\nexport interface MarkdownProps extends Omit<React.ComponentProps<'div'>, 'children'> {\n children: string;\n}\n\n/** Renders a Markdown string safely, for assistant messages. */\nfunction Markdown({ children, className, ...props }: MarkdownProps) {\n const blocks = React.useMemo(() => parseMarkdown(children), [children]);\n return (\n <div\n data-slot=\"markdown\"\n className={cn('grid gap-3 text-sm leading-6 [&_li]:leading-6', className)}\n {...props}\n >\n {blocks.map((b, i) => {\n const k = `b${i}`;\n switch (b.type) {\n case 'h': {\n const Tag = (['h3', 'h4', 'h5'] as const)[b.level - 1] ?? 'h5';\n return (\n <Tag key={k} className=\"font-semibold tracking-[-0.01em]\">\n {inline(b.text, k)}\n </Tag>\n );\n }\n case 'ul':\n case 'ol': {\n const Tag = b.type;\n return (\n <Tag\n key={k}\n className={cn('grid gap-1 pl-5', b.type === 'ul' ? 'list-disc' : 'list-decimal')}\n >\n {b.items.map((item, j) => (\n <li key={`${k}-${j}`}>{inline(item, `${k}-${j}`)}</li>\n ))}\n </Tag>\n );\n }\n case 'quote':\n return (\n <blockquote\n key={k}\n className=\"border-l-2 border-border-strong pl-3 text-muted-foreground\"\n >\n {inline(b.text, k)}\n </blockquote>\n );\n case 'code':\n return <CodeBlock key={k} code={b.code} lang={b.lang} />;\n default:\n return <p key={k}>{inline(b.text, k)}</p>;\n }\n })}\n </div>\n );\n}\n\nexport { CodeBlock, Markdown };\n"],"mappings":";;;;;;AAcA,IAAM,YAAY;AAElB,SAAS,OAAO,MAAc,KAAgC;CAC5D,MAAM,MAAyB,CAAC;CAChC,MAAM,UACJ;CACF,IAAI,OAAO;CACX,IAAI,IAAI;CACR,KAAK,MAAM,KAAK,KAAK,SAAS,OAAO,GAAG;EACtC,MAAM,IAAI,EAAE;EACZ,IAAI,IAAI,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,CAAC,CAAC;EAC1C,MAAM,QAAQ,EAAE;EAChB,MAAM,IAAI,GAAG,IAAI,GAAG;EACpB,IAAI,EAAE,IACJ,IAAI,KACF,oBAAC,QAAD;GAAc,WAAU;GACrB,UAAA,MAAM,MAAM,GAAG,EAAE;EACd,GAFK,CAEL,CACR;OACK,IAAI,EAAE,IACX,IAAI,KAAK,oBAAC,UAAD,EAAA,UAAiB,OAAO,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,EAAU,GAA1C,CAA0C,CAAC;OAC5D,IAAI,EAAE,IACX,IAAI,KAAK,oBAAC,MAAD,EAAA,UAAa,OAAO,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,EAAM,GAAtC,CAAsC,CAAC;OACpD;GACL,MAAM,GAAG,QAAQ,IAAI,OAAO,MAAM,8BAA8B,KAAK,KAAK,KAAK,CAAC;GAChF,IAAI,KACF,UAAU,KAAK,IAAI,IACjB,oBAAC,KAAD;IAEQ;IACN,QAAO;IACP,KAAI;IACJ,WAAU;IAET,UAAA;GACA,GAPI,CAOJ,IAEH,KAEJ;EACF;EACA,OAAO,IAAI,MAAM;CACnB;CACA,IAAI,OAAO,KAAK,QAAQ,IAAI,KAAK,KAAK,MAAM,IAAI,CA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AE,MAAM,KAAK,MAAM,MAClB,oBAAC,MAAD,EAAA,UAAuB,OAAO,MAAM,GAAG,EAAE,GAAG,GAAG,EAAM,GAA5C,GAAG,EAAE,GAAG,GAAoC,CACtD;KACE,GANE,CAMF;IAET;IACA,KAAK,SACH,OACE,oBAAC,cAAD;KAEE,WAAU;KAET,UAAA,OAAO,EAAE,MAAM,CAAC;IACP,GAJL,CAIK;IAEhB,KAAK,QACH,OAAO,oBAAC,WAAD;KAAmB,MAAM,EAAE;KAAM,MAAM,EAAE;IAAO,GAAhC,CAAgC;IACzD,SACE,OAAO,oBAAC,KAAD,EAAA,UAAY,OAAO,EAAE,MAAM,CAAC,EAAK,GAAzB,CAAyB;GAC5C;EACF,CAAC;CACE,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"markdown.js","names":[],"sources":["../../src/components/markdown.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { CopyButton } from './copy-button';\n\n/*\n * A small, safe Markdown renderer for chat: paragraphs, headings, bullet and\n * numbered lists, block quotes, fenced code, inline code, bold, italic and\n * links. Everything becomes React elements (never HTML strings), and links\n * only keep http(s) and mailto targets, so model output cannot inject markup\n * or script.\n */\n\nconst SAFE_HREF = /^(https?:\\/\\/|mailto:)/i;\n\nfunction inline(text: string, key: string): React.ReactNode[] {\n const out: React.ReactNode[] = [];\n const pattern =\n /(`[^`]+`)|(\\*\\*[^*]+\\*\\*|__[^_]+__)|(\\*[^*\\s][^*]*\\*|_[^_\\s][^_]*_)|(\\[[^\\]]+\\]\\([^)\\s]+\\))/g;\n let last = 0;\n let n = 0;\n for (const m of text.matchAll(pattern)) {\n const i = m.index;\n if (i > last) out.push(text.slice(last, i));\n const token = m[0];\n const k = `${key}-${n++}`;\n if (m[1]) {\n out.push(\n <code key={k} className=\"rounded-xs bg-muted px-1 py-0.5 font-mono text-[0.85em]\">\n {token.slice(1, -1)}\n </code>,\n );\n } else if (m[2]) {\n out.push(<strong key={k}>{inline(token.slice(2, -2), k)}</strong>);\n } else if (m[3]) {\n out.push(<em key={k}>{inline(token.slice(1, -1), k)}</em>);\n } else {\n const [, label = '', href = ''] = /^\\[([^\\]]+)\\]\\(([^)\\s]+)\\)$/.exec(token) ?? [];\n out.push(\n SAFE_HREF.test(href) ? (\n <a\n key={k}\n href={href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n className=\"text-brand underline underline-offset-2 hover:text-brand-hover\"\n >\n {label}\n </a>\n ) : (\n label\n ),\n );\n }\n last = i + token.length;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\n/** A fenced code block with a language label and a copy button. */\nexport interface CodeBlockProps {\n code: string;\n lang?: string;\n className?: string;\n}\n\nconst CodeBlock = React.forwardRef<HTMLDivElement, CodeBlockProps>(function CodeBlock(\n { code, lang, className },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"code-block\"\n className={cn('overflow-hidden rounded-md border bg-code text-code-foreground', className)}\n >\n <div className=\"flex min-h-8 items-center justify-between border-b border-white/10 px-3 text-[11px] text-code-foreground/70\">\n <span className=\"font-mono\">{lang || 'text'}</span>\n <CopyButton\n value={code}\n label=\"Copy code\"\n className=\"size-7 text-code-foreground hover:bg-white/10 hover:text-code-foreground\"\n />\n </div>\n <pre className=\"overflow-x-auto p-3 font-mono text-[12.5px] leading-5\">\n <code>{code}</code>\n </pre>\n </div>\n );\n});\n\ntype Block =\n | { type: 'p'; text: string }\n | { type: 'h'; level: 1 | 2 | 3; text: string }\n | { type: 'ul' | 'ol'; items: string[] }\n | { type: 'quote'; text: string }\n | { type: 'code'; lang: string; code: string };\n\n/** Split Markdown into blocks. Exported for tests. */\nexport function parseMarkdown(source: string): Block[] {\n const lines = source.replace(/\\r\\n?/g, '\\n').split('\\n');\n const blocks: Block[] = [];\n let para: string[] = [];\n const flush = () => {\n if (para.length) blocks.push({ type: 'p', text: para.join(' ') });\n para = [];\n };\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? '';\n const fence = /^```\\s*([\\w+-]*)\\s*$/.exec(line);\n if (fence) {\n flush();\n const code: string[] = [];\n i++;\n while (i < lines.length && !/^```\\s*$/.test(lines[i] ?? '')) code.push(lines[i++] ?? '');\n blocks.push({ type: 'code', lang: fence[1] ?? '', code: code.join('\\n') });\n continue;\n }\n const heading = /^(#{1,3})\\s+(.*)$/.exec(line);\n if (heading) {\n flush();\n blocks.push({\n type: 'h',\n level: (heading[1]?.length ?? 1) as 1 | 2 | 3,\n text: heading[2] ?? '',\n });\n continue;\n }\n const list = /^\\s*([-*]|\\d+[.)])\\s+(.*)$/.exec(line);\n if (list) {\n flush();\n const type = /\\d/.test(list[1] ?? '') ? 'ol' : 'ul';\n const prev = blocks.at(-1);\n if (prev && prev.type === type) prev.items.push(list[2] ?? '');\n else blocks.push({ type, items: [list[2] ?? ''] });\n continue;\n }\n const quote = /^>\\s?(.*)$/.exec(line);\n if (quote) {\n flush();\n blocks.push({ type: 'quote', text: quote[1] ?? '' });\n continue;\n }\n if (!line.trim()) flush();\n else para.push(line.trim());\n }\n flush();\n return blocks;\n}\n\nexport interface MarkdownProps extends Omit<React.ComponentProps<'div'>, 'children'> {\n children: string;\n}\n\n/** Renders a Markdown string safely, for assistant messages. */\nconst Markdown = React.forwardRef<HTMLDivElement, MarkdownProps>(function Markdown(\n { children, className, ...props },\n ref,\n) {\n const blocks = React.useMemo(() => parseMarkdown(children), [children]);\n return (\n <div\n ref={ref}\n data-slot=\"markdown\"\n className={cn('grid gap-3 text-sm leading-6 [&_li]:leading-6', className)}\n {...props}\n >\n {blocks.map((b, i) => {\n const k = `b${i}`;\n switch (b.type) {\n case 'h': {\n const Tag = (['h3', 'h4', 'h5'] as const)[b.level - 1] ?? 'h5';\n return (\n <Tag key={k} className=\"font-semibold tracking-[-0.01em]\">\n {inline(b.text, k)}\n </Tag>\n );\n }\n case 'ul':\n case 'ol': {\n const Tag = b.type;\n return (\n <Tag\n key={k}\n className={cn('grid gap-1 pl-5', b.type === 'ul' ? 'list-disc' : 'list-decimal')}\n >\n {b.items.map((item, j) => (\n <li key={`${k}-${j}`}>{inline(item, `${k}-${j}`)}</li>\n ))}\n </Tag>\n );\n }\n case 'quote':\n return (\n <blockquote\n key={k}\n className=\"border-l-2 border-border-strong pl-3 text-muted-foreground\"\n >\n {inline(b.text, k)}\n </blockquote>\n );\n case 'code':\n return <CodeBlock key={k} code={b.code} lang={b.lang} />;\n default:\n return <p key={k}>{inline(b.text, k)}</p>;\n }\n })}\n </div>\n );\n});\n\nexport { CodeBlock, Markdown };\n"],"mappings":";;;;;;AAcA,IAAM,YAAY;AAElB,SAAS,OAAO,MAAc,KAAgC;CAC5D,MAAM,MAAyB,CAAC;CAChC,MAAM,UACJ;CACF,IAAI,OAAO;CACX,IAAI,IAAI;CACR,KAAK,MAAM,KAAK,KAAK,SAAS,OAAO,GAAG;EACtC,MAAM,IAAI,EAAE;EACZ,IAAI,IAAI,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,CAAC,CAAC;EAC1C,MAAM,QAAQ,EAAE;EAChB,MAAM,IAAI,GAAG,IAAI,GAAG;EACpB,IAAI,EAAE,IACJ,IAAI,KACF,oBAAC,QAAD;GAAc,WAAU;GACrB,UAAA,MAAM,MAAM,GAAG,EAAE;EACd,GAFK,CAEL,CACR;OACK,IAAI,EAAE,IACX,IAAI,KAAK,oBAAC,UAAD,EAAA,UAAiB,OAAO,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,EAAU,GAA1C,CAA0C,CAAC;OAC5D,IAAI,EAAE,IACX,IAAI,KAAK,oBAAC,MAAD,EAAA,UAAa,OAAO,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,EAAM,GAAtC,CAAsC,CAAC;OACpD;GACL,MAAM,GAAG,QAAQ,IAAI,OAAO,MAAM,8BAA8B,KAAK,KAAK,KAAK,CAAC;GAChF,IAAI,KACF,UAAU,KAAK,IAAI,IACjB,oBAAC,KAAD;IAEQ;IACN,QAAO;IACP,KAAI;IACJ,WAAU;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AAU;MACpB,UAAA,OAAO,EAAE,MAAM,CAAC;KACd,GAFK,CAEL;IAET;IACA,KAAK;IACL,KAAK,MAAM;KACT,MAAM,MAAM,EAAE;KACd,OACE,oBAAC,KAAD;MAEE,WAAW,GAAG,mBAAmB,EAAE,SAAS,OAAO,cAAc,cAAc;MAE9E,UAAA,EAAE,MAAM,KAAK,MAAM,MAClB,oBAAC,MAAD,EAAA,UAAuB,OAAO,MAAM,GAAG,EAAE,GAAG,GAAG,EAAM,GAA5C,GAAG,EAAE,GAAG,GAAoC,CACtD;KACE,GANE,CAMF;IAET;IACA,KAAK,SACH,OACE,oBAAC,cAAD;KAEE,WAAU;KAET,UAAA,OAAO,EAAE,MAAM,CAAC;IACP,GAJL,CAIK;IAEhB,KAAK,QACH,OAAO,oBAAC,WAAD;KAAmB,MAAM,EAAE;KAAM,MAAM,EAAE;IAAO,GAAhC,CAAgC;IACzD,SACE,OAAO,oBAAC,KAAD,EAAA,UAAY,OAAO,EAAE,MAAM,CAAC,EAAK,GAAzB,CAAyB;GAC5C;EACF,CAAC;CACE,CAAA;AAET,CAAC"}
|
|
@@ -5,26 +5,28 @@ import * as MenubarPrimitive from '../primitives/vendor/radix/react-menubar';
|
|
|
5
5
|
* Down opens one, and an open menu follows the pointer across triggers. Rows
|
|
6
6
|
* match DropdownMenu and ContextMenu.
|
|
7
7
|
*/
|
|
8
|
-
declare
|
|
8
|
+
declare const Menubar: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
declare function MenubarMenu(props: React.ComponentProps<typeof MenubarPrimitive.Menu>): React.JSX.Element;
|
|
10
|
-
|
|
10
|
+
/** A 28px trigger with a 6px radius (the bar's 10px less its 2px inset); 44px tall to a touch. */
|
|
11
|
+
declare const MenubarTrigger: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
12
|
declare function MenubarGroup(props: React.ComponentProps<typeof MenubarPrimitive.Group>): React.JSX.Element;
|
|
12
|
-
declare
|
|
13
|
-
|
|
13
|
+
declare const MenubarContent: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export interface MenubarItemProps extends React.ComponentProps<typeof MenubarPrimitive.Item> {
|
|
14
15
|
inset?: boolean;
|
|
15
16
|
variant?: 'default' | 'destructive';
|
|
16
|
-
}
|
|
17
|
-
declare
|
|
17
|
+
}
|
|
18
|
+
declare const MenubarItem: React.ForwardRefExoticComponent<Omit<MenubarItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const MenubarCheckboxItem: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
20
|
declare function MenubarRadioGroup(props: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>): React.JSX.Element;
|
|
19
|
-
declare
|
|
20
|
-
declare
|
|
21
|
+
declare const MenubarRadioItem: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const MenubarLabel: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarLabelProps & React.RefAttributes<HTMLDivElement> & {
|
|
21
23
|
inset?: boolean;
|
|
22
|
-
}
|
|
23
|
-
declare
|
|
24
|
-
declare
|
|
24
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
declare const MenubarSeparator: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
declare const MenubarShortcut: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
25
27
|
declare function MenubarSub(props: React.ComponentProps<typeof MenubarPrimitive.Sub>): React.JSX.Element;
|
|
26
|
-
declare
|
|
28
|
+
declare const MenubarSubTrigger: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSubTriggerProps & React.RefAttributes<HTMLDivElement> & {
|
|
27
29
|
inset?: boolean;
|
|
28
|
-
}
|
|
29
|
-
declare
|
|
30
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
declare const MenubarSubContent: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
30
32
|
export { Menubar, MenubarMenu, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../lib/utils.js";
|
|
3
|
-
import { menuItemClasses, surfaceClasses } from "./popover.js";
|
|
2
|
+
import { cn, focusRingClasses, touchTargetRowClasses } from "../lib/utils.js";
|
|
3
|
+
import { menuItemClasses, menuLabelClasses, surfaceClasses } from "./popover.js";
|
|
4
4
|
import { CheckboxItem, Content, Group, Item, ItemIndicator, Label, Menu, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger } from "../primitives/vendor/radix/react-menubar/menubar.js";
|
|
5
|
-
import "react";
|
|
5
|
+
import * as React from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import ChevronRight from "@burtson-labs/icons/react/chevron-right";
|
|
8
8
|
import Check from "@burtson-labs/icons/react/check";
|
|
@@ -12,52 +12,58 @@ import Check from "@burtson-labs/icons/react/check";
|
|
|
12
12
|
* Down opens one, and an open menu follows the pointer across triggers. Rows
|
|
13
13
|
* match DropdownMenu and ContextMenu.
|
|
14
14
|
*/
|
|
15
|
-
function Menubar({ className, ...props }) {
|
|
15
|
+
var Menubar = React.forwardRef(function Menubar({ className, ...props }, ref) {
|
|
16
16
|
return /* @__PURE__ */ jsx(Root, {
|
|
17
|
+
ref,
|
|
17
18
|
"data-slot": "menubar",
|
|
18
19
|
className: cn("flex h-8 items-center gap-0.5 rounded-md border bg-surface p-0.5", className),
|
|
19
20
|
...props
|
|
20
21
|
});
|
|
21
|
-
}
|
|
22
|
+
});
|
|
22
23
|
function MenubarMenu(props) {
|
|
23
24
|
return /* @__PURE__ */ jsx(Menu, {
|
|
24
25
|
"data-slot": "menubar-menu",
|
|
25
26
|
...props
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
/** A 28px trigger with a 6px radius (the bar's 10px less its 2px inset); 44px tall to a touch. */
|
|
30
|
+
var MenubarTrigger = React.forwardRef(function MenubarTrigger({ className, ...props }, ref) {
|
|
29
31
|
return /* @__PURE__ */ jsx(Trigger, {
|
|
32
|
+
ref,
|
|
30
33
|
"data-slot": "menubar-trigger",
|
|
31
|
-
className: cn("flex h-7 items-center rounded-
|
|
34
|
+
className: cn("flex h-7 items-center rounded-xs px-2.5 text-[13px] font-medium select-none hover:bg-muted data-[state=open]:bg-muted", focusRingClasses, "focus-visible:outline-offset-[-2px]", touchTargetRowClasses, className),
|
|
32
35
|
...props
|
|
33
36
|
});
|
|
34
|
-
}
|
|
37
|
+
});
|
|
35
38
|
function MenubarGroup(props) {
|
|
36
39
|
return /* @__PURE__ */ jsx(Group, {
|
|
37
40
|
"data-slot": "menubar-group",
|
|
38
41
|
...props
|
|
39
42
|
});
|
|
40
43
|
}
|
|
41
|
-
function MenubarContent({ className, align = "start", sideOffset = 4, ...props }) {
|
|
44
|
+
var MenubarContent = React.forwardRef(function MenubarContent({ className, align = "start", sideOffset = 4, ...props }, ref) {
|
|
42
45
|
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, {
|
|
46
|
+
ref,
|
|
43
47
|
"data-slot": "menubar-content",
|
|
44
48
|
align,
|
|
45
49
|
sideOffset,
|
|
46
50
|
className: cn(surfaceClasses, "max-h-(--radix-menubar-content-available-height) min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-x-hidden overflow-y-auto p-1", className),
|
|
47
51
|
...props
|
|
48
52
|
}) });
|
|
49
|
-
}
|
|
50
|
-
function MenubarItem({ className, inset, variant = "default", ...props }) {
|
|
53
|
+
});
|
|
54
|
+
var MenubarItem = React.forwardRef(function MenubarItem({ className, inset, variant = "default", ...props }, ref) {
|
|
51
55
|
return /* @__PURE__ */ jsx(Item, {
|
|
56
|
+
ref,
|
|
52
57
|
"data-slot": "menubar-item",
|
|
53
58
|
"data-inset": inset || void 0,
|
|
54
59
|
"data-variant": variant,
|
|
55
60
|
className: cn(menuItemClasses, "data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:*:[svg]:!text-destructive", className),
|
|
56
61
|
...props
|
|
57
62
|
});
|
|
58
|
-
}
|
|
59
|
-
function MenubarCheckboxItem({ className, children, checked, ...props }) {
|
|
63
|
+
});
|
|
64
|
+
var MenubarCheckboxItem = React.forwardRef(function MenubarCheckboxItem({ className, children, checked, ...props }, ref) {
|
|
60
65
|
return /* @__PURE__ */ jsxs(CheckboxItem, {
|
|
66
|
+
ref,
|
|
61
67
|
"data-slot": "menubar-checkbox-item",
|
|
62
68
|
className: cn(menuItemClasses, "pl-8", className),
|
|
63
69
|
checked,
|
|
@@ -70,15 +76,16 @@ function MenubarCheckboxItem({ className, children, checked, ...props }) {
|
|
|
70
76
|
}) })
|
|
71
77
|
}), children]
|
|
72
78
|
});
|
|
73
|
-
}
|
|
79
|
+
});
|
|
74
80
|
function MenubarRadioGroup(props) {
|
|
75
81
|
return /* @__PURE__ */ jsx(RadioGroup, {
|
|
76
82
|
"data-slot": "menubar-radio-group",
|
|
77
83
|
...props
|
|
78
84
|
});
|
|
79
85
|
}
|
|
80
|
-
function MenubarRadioItem({ className, children, ...props }) {
|
|
86
|
+
var MenubarRadioItem = React.forwardRef(function MenubarRadioItem({ className, children, ...props }, ref) {
|
|
81
87
|
return /* @__PURE__ */ jsxs(RadioItem, {
|
|
88
|
+
ref,
|
|
82
89
|
"data-slot": "menubar-radio-item",
|
|
83
90
|
className: cn(menuItemClasses, "pl-8", className),
|
|
84
91
|
...props,
|
|
@@ -87,37 +94,41 @@ function MenubarRadioItem({ className, children, ...props }) {
|
|
|
87
94
|
children: /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx("span", { className: "block size-2 rounded-full bg-foreground" }) })
|
|
88
95
|
}), children]
|
|
89
96
|
});
|
|
90
|
-
}
|
|
91
|
-
function MenubarLabel({ className, inset, ...props }) {
|
|
97
|
+
});
|
|
98
|
+
var MenubarLabel = React.forwardRef(function MenubarLabel({ className, inset, ...props }, ref) {
|
|
92
99
|
return /* @__PURE__ */ jsx(Label, {
|
|
100
|
+
ref,
|
|
93
101
|
"data-slot": "menubar-label",
|
|
94
102
|
"data-inset": inset || void 0,
|
|
95
|
-
className: cn("
|
|
103
|
+
className: cn(menuLabelClasses, "data-[inset]:pl-8", className),
|
|
96
104
|
...props
|
|
97
105
|
});
|
|
98
|
-
}
|
|
99
|
-
function MenubarSeparator({ className, ...props }) {
|
|
106
|
+
});
|
|
107
|
+
var MenubarSeparator = React.forwardRef(function MenubarSeparator({ className, ...props }, ref) {
|
|
100
108
|
return /* @__PURE__ */ jsx(Separator, {
|
|
109
|
+
ref,
|
|
101
110
|
"data-slot": "menubar-separator",
|
|
102
111
|
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
103
112
|
...props
|
|
104
113
|
});
|
|
105
|
-
}
|
|
106
|
-
function MenubarShortcut({ className, ...props }) {
|
|
114
|
+
});
|
|
115
|
+
var MenubarShortcut = React.forwardRef(function MenubarShortcut({ className, ...props }, ref) {
|
|
107
116
|
return /* @__PURE__ */ jsx("span", {
|
|
117
|
+
ref,
|
|
108
118
|
"data-slot": "menubar-shortcut",
|
|
109
119
|
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
|
|
110
120
|
...props
|
|
111
121
|
});
|
|
112
|
-
}
|
|
122
|
+
});
|
|
113
123
|
function MenubarSub(props) {
|
|
114
124
|
return /* @__PURE__ */ jsx(Sub, {
|
|
115
125
|
"data-slot": "menubar-sub",
|
|
116
126
|
...props
|
|
117
127
|
});
|
|
118
128
|
}
|
|
119
|
-
function MenubarSubTrigger({ className, inset, children, ...props }) {
|
|
129
|
+
var MenubarSubTrigger = React.forwardRef(function MenubarSubTrigger({ className, inset, children, ...props }, ref) {
|
|
120
130
|
return /* @__PURE__ */ jsxs(SubTrigger, {
|
|
131
|
+
ref,
|
|
121
132
|
"data-slot": "menubar-sub-trigger",
|
|
122
133
|
"data-inset": inset || void 0,
|
|
123
134
|
className: cn(menuItemClasses, "data-[state=open]:bg-secondary", className),
|
|
@@ -127,14 +138,15 @@ function MenubarSubTrigger({ className, inset, children, ...props }) {
|
|
|
127
138
|
"aria-hidden": true
|
|
128
139
|
})]
|
|
129
140
|
});
|
|
130
|
-
}
|
|
131
|
-
function MenubarSubContent({ className, ...props }) {
|
|
141
|
+
});
|
|
142
|
+
var MenubarSubContent = React.forwardRef(function MenubarSubContent({ className, ...props }, ref) {
|
|
132
143
|
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(SubContent, {
|
|
144
|
+
ref,
|
|
133
145
|
"data-slot": "menubar-sub-content",
|
|
134
146
|
className: cn(surfaceClasses, "min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden p-1", className),
|
|
135
147
|
...props
|
|
136
148
|
}) });
|
|
137
|
-
}
|
|
149
|
+
});
|
|
138
150
|
//#endregion
|
|
139
151
|
export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger };
|
|
140
152
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menubar.js","names":["MenubarPrimitive.Root","MenubarPrimitive.Menu","MenubarPrimitive.Trigger","MenubarPrimitive.Group","MenubarPrimitive.Portal","MenubarPrimitive.Content","MenubarPrimitive.Item","itemClasses","MenubarPrimitive.CheckboxItem","MenubarPrimitive.ItemIndicator","MenubarPrimitive.RadioGroup","MenubarPrimitive.RadioItem","MenubarPrimitive.Label","MenubarPrimitive.Separator","MenubarPrimitive.Sub","MenubarPrimitive.SubTrigger","MenubarPrimitive.SubContent"],"sources":["../../src/components/menubar.tsx"],"sourcesContent":["import Check from '@burtson-labs/icons/react/check';\nimport ChevronRight from '@burtson-labs/icons/react/chevron-right';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\nimport * as MenubarPrimitive from '../primitives/vendor/radix/react-menubar';\n\nimport { menuItemClasses as itemClasses, surfaceClasses } from './popover';\n\n/**\n * An application menu bar (File, Edit, View). Left/Right move between menus,\n * Down opens one, and an open menu follows the pointer across triggers. Rows\n * match DropdownMenu and ContextMenu.\n */\nfunction Menubar({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Root>) {\n return (\n <MenubarPrimitive.Root\n data-slot=\"menubar\"\n className={cn('flex h-8 items-center gap-0.5 rounded-md border bg-surface p-0.5', className)}\n {...props}\n />\n );\n}\n\nfunction MenubarMenu(props: React.ComponentProps<typeof MenubarPrimitive.Menu>) {\n return <MenubarPrimitive.Menu data-slot=\"menubar-menu\" {...props} />;\n}\n\nfunction MenubarTrigger({\n className,\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {\n return (\n <MenubarPrimitive.Trigger\n data-slot=\"menubar-trigger\"\n className={cn(\n 'flex h-7 items-center rounded-sm px-2.5 text-[13px] font-medium outline-none select-none hover:bg-muted focus-visible:shadow-[inset_0_0_0_1px_var(--ring)] data-[state=open]:bg-muted',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction MenubarGroup(props: React.ComponentProps<typeof MenubarPrimitive.Group>) {\n return <MenubarPrimitive.Group data-slot=\"menubar-group\" {...props} />;\n}\n\nfunction MenubarContent({\n className,\n align = 'start',\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Content>) {\n return (\n <MenubarPrimitive.Portal>\n <MenubarPrimitive.Content\n data-slot=\"menubar-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n surfaceClasses,\n 'max-h-(--radix-menubar-content-available-height) min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-x-hidden overflow-y-auto p-1',\n className,\n )}\n {...props}\n />\n </MenubarPrimitive.Portal>\n );\n}\n\nfunction MenubarItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Item> & {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n}) {\n return (\n <MenubarPrimitive.Item\n data-slot=\"menubar-item\"\n data-inset={inset || undefined}\n data-variant={variant}\n className={cn(\n itemClasses,\n 'data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:*:[svg]:!text-destructive',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction MenubarCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {\n return (\n <MenubarPrimitive.CheckboxItem\n data-slot=\"menubar-checkbox-item\"\n className={cn(itemClasses, 'pl-8', className)}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <MenubarPrimitive.ItemIndicator>\n <Check className=\"size-4 text-foreground\" aria-hidden />\n </MenubarPrimitive.ItemIndicator>\n </span>\n {children}\n </MenubarPrimitive.CheckboxItem>\n );\n}\n\nfunction MenubarRadioGroup(props: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {\n return <MenubarPrimitive.RadioGroup data-slot=\"menubar-radio-group\" {...props} />;\n}\n\nfunction MenubarRadioItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {\n return (\n <MenubarPrimitive.RadioItem\n data-slot=\"menubar-radio-item\"\n className={cn(itemClasses, 'pl-8', className)}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <MenubarPrimitive.ItemIndicator>\n <span className=\"block size-2 rounded-full bg-foreground\" />\n </MenubarPrimitive.ItemIndicator>\n </span>\n {children}\n </MenubarPrimitive.RadioItem>\n );\n}\n\nfunction MenubarLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Label> & { inset?: boolean }) {\n return (\n <MenubarPrimitive.Label\n data-slot=\"menubar-label\"\n data-inset={inset || undefined}\n className={cn(\n 'px-2 pt-2 pb-1 text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase data-[inset]:pl-8',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction MenubarSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Separator>) {\n return (\n <MenubarPrimitive.Separator\n data-slot=\"menubar-separator\"\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction MenubarShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"menubar-shortcut\"\n className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction MenubarSub(props: React.ComponentProps<typeof MenubarPrimitive.Sub>) {\n return <MenubarPrimitive.Sub data-slot=\"menubar-sub\" {...props} />;\n}\n\nfunction MenubarSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & { inset?: boolean }) {\n return (\n <MenubarPrimitive.SubTrigger\n data-slot=\"menubar-sub-trigger\"\n data-inset={inset || undefined}\n className={cn(itemClasses, 'data-[state=open]:bg-secondary', className)}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto size-4\" aria-hidden />\n </MenubarPrimitive.SubTrigger>\n );\n}\n\nfunction MenubarSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {\n return (\n <MenubarPrimitive.Portal>\n <MenubarPrimitive.SubContent\n data-slot=\"menubar-sub-content\"\n className={cn(\n surfaceClasses,\n 'min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden p-1',\n className,\n )}\n {...props}\n />\n </MenubarPrimitive.Portal>\n );\n}\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarCheckboxItem,\n MenubarContent,\n MenubarGroup,\n MenubarItem,\n MenubarLabel,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarSeparator,\n MenubarShortcut,\n MenubarSub,\n MenubarSubContent,\n MenubarSubTrigger,\n MenubarTrigger,\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,QAAQ,EAAE,WAAW,GAAG,SAA6D;CAC5F,OACE,oBAACA,MAAD;EACE,aAAU;EACV,WAAW,GAAG,oEAAoE,SAAS;EAC3F,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,OAA2D;CAC9E,OAAO,oBAACC,MAAD;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,eAAe,EACtB,WACA,GAAG,SACqD;CACxD,OACE,oBAACC,SAAD;EACE,aAAU;EACV,WAAW,GACT,yLACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,OAA4D;CAChF,OAAO,oBAACC,OAAD;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,eAAe,EACtB,WACA,QAAQ,SACR,aAAa,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A,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAACC,WAAD;EACE,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAuC;CAC9E,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GAAG,yDAAyD,SAAS;EAChF,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,OAA0D;CAC5E,OAAO,oBAACC,KAAD;EAAsB,aAAU;EAAc,GAAI;CAAQ,CAAA;AACnE;AAEA,SAAS,kBAAkB,EACzB,WACA,OACA,UACA,GAAG,SAC8E;CACjF,OACE,qBAACC,YAAD;EACE,aAAU;EACV,cAAY,SAAS,KAAA;EACrB,WAAW,GAAGR,iBAAa,kCAAkC,SAAS;EACtE,GAAI;EAJN,UAAA,CAMG,UACD,oBAAC,cAAD;GAAc,WAAU;GAAiB,eAAA;EAAa,CAAA,CAC3B;;AAEjC;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;CAC3D,OACE,oBAACH,QAAD,EAAA,UACE,oBAACY,YAAD;EACE,aAAU;EACV,WAAW,GACT,gBACA,sFACA,SACF;EACA,GAAI;CACL,CAAA,EACsB,CAAA;AAE7B"}
|
|
1
|
+
{"version":3,"file":"menubar.js","names":["MenubarPrimitive.Root","MenubarPrimitive.Menu","MenubarPrimitive.Trigger","MenubarPrimitive.Group","MenubarPrimitive.Portal","MenubarPrimitive.Content","MenubarPrimitive.Item","itemClasses","MenubarPrimitive.CheckboxItem","MenubarPrimitive.ItemIndicator","MenubarPrimitive.RadioGroup","MenubarPrimitive.RadioItem","MenubarPrimitive.Label","MenubarPrimitive.Separator","MenubarPrimitive.Sub","MenubarPrimitive.SubTrigger","MenubarPrimitive.SubContent"],"sources":["../../src/components/menubar.tsx"],"sourcesContent":["import Check from '@burtson-labs/icons/react/check';\nimport ChevronRight from '@burtson-labs/icons/react/chevron-right';\nimport * as React from 'react';\n\nimport { cn, focusRingClasses, touchTargetRowClasses } from '../lib/utils';\nimport * as MenubarPrimitive from '../primitives/vendor/radix/react-menubar';\n\nimport { menuItemClasses as itemClasses, menuLabelClasses, surfaceClasses } from './popover';\n\n/**\n * An application menu bar (File, Edit, View). Left/Right move between menus,\n * Down opens one, and an open menu follows the pointer across triggers. Rows\n * match DropdownMenu and ContextMenu.\n */\nconst Menubar = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof MenubarPrimitive.Root>\n>(function Menubar({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Root\n ref={ref}\n data-slot=\"menubar\"\n className={cn('flex h-8 items-center gap-0.5 rounded-md border bg-surface p-0.5', className)}\n {...props}\n />\n );\n});\n\nfunction MenubarMenu(props: React.ComponentProps<typeof MenubarPrimitive.Menu>) {\n return <MenubarPrimitive.Menu data-slot=\"menubar-menu\" {...props} />;\n}\n\n/** A 28px trigger with a 6px radius (the bar's 10px less its 2px inset); 44px tall to a touch. */\nconst MenubarTrigger = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof MenubarPrimitive.Trigger>\n>(function MenubarTrigger({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Trigger\n ref={ref}\n data-slot=\"menubar-trigger\"\n className={cn(\n 'flex h-7 items-center rounded-xs px-2.5 text-[13px] font-medium select-none hover:bg-muted data-[state=open]:bg-muted',\n focusRingClasses,\n 'focus-visible:outline-offset-[-2px]',\n touchTargetRowClasses,\n className,\n )}\n {...props}\n />\n );\n});\n\nfunction MenubarGroup(props: React.ComponentProps<typeof MenubarPrimitive.Group>) {\n return <MenubarPrimitive.Group data-slot=\"menubar-group\" {...props} />;\n}\n\nconst MenubarContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof MenubarPrimitive.Content>\n>(function MenubarContent({ className, align = 'start', sideOffset = 4, ...props }, ref) {\n return (\n <MenubarPrimitive.Portal>\n <MenubarPrimitive.Content\n ref={ref}\n data-slot=\"menubar-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n surfaceClasses,\n 'max-h-(--radix-menubar-content-available-height) min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-x-hidden overflow-y-auto p-1',\n className,\n )}\n {...props}\n />\n </MenubarPrimitive.Portal>\n );\n});\n\nexport interface MenubarItemProps extends React.ComponentProps<typeof MenubarPrimitive.Item> {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n}\n\nconst MenubarItem = React.forwardRef<HTMLDivElement, MenubarItemProps>(function MenubarItem(\n { className, inset, variant = 'default', ...props },\n ref,\n) {\n return (\n <MenubarPrimitive.Item\n ref={ref}\n data-slot=\"menubar-item\"\n data-inset={inset || undefined}\n data-variant={variant}\n className={cn(\n itemClasses,\n 'data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:*:[svg]:!text-destructive',\n className,\n )}\n {...props}\n />\n );\n});\n\nconst MenubarCheckboxItem = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>\n>(function MenubarCheckboxItem({ className, children, checked, ...props }, ref) {\n return (\n <MenubarPrimitive.CheckboxItem\n ref={ref}\n data-slot=\"menubar-checkbox-item\"\n className={cn(itemClasses, 'pl-8', className)}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <MenubarPrimitive.ItemIndicator>\n <Check className=\"size-4 text-foreground\" aria-hidden />\n </MenubarPrimitive.ItemIndicator>\n </span>\n {children}\n </MenubarPrimitive.CheckboxItem>\n );\n});\n\nfunction MenubarRadioGroup(props: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {\n return <MenubarPrimitive.RadioGroup data-slot=\"menubar-radio-group\" {...props} />;\n}\n\nconst MenubarRadioItem = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof MenubarPrimitive.RadioItem>\n>(function MenubarRadioItem({ className, children, ...props }, ref) {\n return (\n <MenubarPrimitive.RadioItem\n ref={ref}\n data-slot=\"menubar-radio-item\"\n className={cn(itemClasses, 'pl-8', className)}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <MenubarPrimitive.ItemIndicator>\n <span className=\"block size-2 rounded-full bg-foreground\" />\n </MenubarPrimitive.ItemIndicator>\n </span>\n {children}\n </MenubarPrimitive.RadioItem>\n );\n});\n\nconst MenubarLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof MenubarPrimitive.Label> & { inset?: boolean }\n>(function MenubarLabel({ className, inset, ...props }, ref) {\n return (\n <MenubarPrimitive.Label\n ref={ref}\n data-slot=\"menubar-label\"\n data-inset={inset || undefined}\n className={cn(menuLabelClasses, 'data-[inset]:pl-8', className)}\n {...props}\n />\n );\n});\n\nconst MenubarSeparator = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof MenubarPrimitive.Separator>\n>(function MenubarSeparator({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Separator\n ref={ref}\n data-slot=\"menubar-separator\"\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n );\n});\n\nconst MenubarShortcut = React.forwardRef<HTMLSpanElement, React.ComponentProps<'span'>>(\n function MenubarShortcut({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n data-slot=\"menubar-shortcut\"\n className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)}\n {...props}\n />\n );\n },\n);\n\nfunction MenubarSub(props: React.ComponentProps<typeof MenubarPrimitive.Sub>) {\n return <MenubarPrimitive.Sub data-slot=\"menubar-sub\" {...props} />;\n}\n\nconst MenubarSubTrigger = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & { inset?: boolean }\n>(function MenubarSubTrigger({ className, inset, children, ...props }, ref) {\n return (\n <MenubarPrimitive.SubTrigger\n ref={ref}\n data-slot=\"menubar-sub-trigger\"\n data-inset={inset || undefined}\n className={cn(itemClasses, 'data-[state=open]:bg-secondary', className)}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto size-4\" aria-hidden />\n </MenubarPrimitive.SubTrigger>\n );\n});\n\nconst MenubarSubContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof MenubarPrimitive.SubContent>\n>(function MenubarSubContent({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Portal>\n <MenubarPrimitive.SubContent\n ref={ref}\n data-slot=\"menubar-sub-content\"\n className={cn(\n surfaceClasses,\n 'min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden p-1',\n className,\n )}\n {...props}\n />\n </MenubarPrimitive.Portal>\n );\n});\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarCheckboxItem,\n MenubarContent,\n MenubarGroup,\n MenubarItem,\n MenubarLabel,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarSeparator,\n MenubarShortcut,\n MenubarSub,\n MenubarSubContent,\n MenubarSubTrigger,\n MenubarTrigger,\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAM,UAAU,MAAM,WAGpB,SAAS,QAAQ,EAAE,WAAW,GAAG,SAAS,KAAK;CAC/C,OACE,oBAACA,MAAD;EACO;EACL,aAAU;EACV,WAAW,GAAG,oEAAoE,SAAS;EAC3F,GAAI;CACL,CAAA;AAEL,CAAC;AAED,SAAS,YAAY,OAA2D;CAC9E,OAAO,oBAACC,MAAD;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;;AAGA,IAAM,iBAAiB,MAAM,WAG3B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACtD,OACE,oBAACC,SAAD;EACO;EACL,aAAU;EACV,WAAW,GACT,yHACA,kBACA,uCACA,uBACA,SACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC;AAED,SAAS,aAAa,OAA4D;CAChF,OAAO,oBAACC,OAAD;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,IAAM,iBA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CAAA;AAE7B,CAAC"}
|
|
@@ -16,7 +16,7 @@ export interface MessageActionsProps extends React.ComponentProps<'div'> {
|
|
|
16
16
|
* small icon buttons. Pass it to Message's `actions`, which shows it on
|
|
17
17
|
* hover and focus (always on touch screens).
|
|
18
18
|
*/
|
|
19
|
-
declare
|
|
19
|
+
declare const MessageActions: React.ForwardRefExoticComponent<Omit<MessageActionsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
20
20
|
export interface MessageEditorProps extends Omit<React.ComponentProps<'form'>, 'onSubmit'> {
|
|
21
21
|
/** The text being edited. */
|
|
22
22
|
defaultValue: string;
|
|
@@ -29,7 +29,7 @@ export interface MessageEditorProps extends Omit<React.ComponentProps<'form'>, '
|
|
|
29
29
|
* Edit-and-resend in place of a sent message. Enter sends (never mid-IME
|
|
30
30
|
* composition), Shift+Enter adds a line, Escape cancels.
|
|
31
31
|
*/
|
|
32
|
-
declare
|
|
32
|
+
declare const MessageEditor: React.ForwardRefExoticComponent<Omit<MessageEditorProps, "ref"> & React.RefAttributes<HTMLFormElement>>;
|
|
33
33
|
export interface MessageFile {
|
|
34
34
|
name: string;
|
|
35
35
|
/** Bytes. */
|
|
@@ -52,5 +52,5 @@ export interface MessageAttachmentsProps extends React.ComponentProps<'div'> {
|
|
|
52
52
|
* Files sent with a message: voice notes play inline, images show a
|
|
53
53
|
* thumbnail, anything else is a named chip that opens the file.
|
|
54
54
|
*/
|
|
55
|
-
declare
|
|
55
|
+
declare const MessageAttachments: React.ForwardRefExoticComponent<Omit<MessageAttachmentsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
56
56
|
export { MessageActions, MessageAttachments, MessageEditor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { cn, focusRingClasses, noOutlineClasses } from "../lib/utils.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
4
|
import { formatBytes } from "./attachment.js";
|
|
5
5
|
import { VoiceMessage } from "./audio-player.js";
|
|
@@ -18,9 +18,10 @@ import ThumbsUp from "@burtson-labs/icons/react/thumbs-up";
|
|
|
18
18
|
* small icon buttons. Pass it to Message's `actions`, which shows it on
|
|
19
19
|
* hover and focus (always on touch screens).
|
|
20
20
|
*/
|
|
21
|
-
function MessageActions({ copyText, onRegenerate, onEdit, feedback = null, onFeedback, className, ...props }) {
|
|
22
|
-
const small = "size-7 text-muted-foreground hover:text-foreground pointer-coarse:size-
|
|
21
|
+
var MessageActions = React.forwardRef(function MessageActions({ copyText, onRegenerate, onEdit, feedback = null, onFeedback, className, ...props }, ref) {
|
|
22
|
+
const small = "size-7 text-muted-foreground hover:text-foreground pointer-coarse:size-11";
|
|
23
23
|
return /* @__PURE__ */ jsxs("div", {
|
|
24
|
+
ref,
|
|
24
25
|
"data-slot": "message-actions",
|
|
25
26
|
role: "toolbar",
|
|
26
27
|
"aria-label": "Message actions",
|
|
@@ -67,17 +68,18 @@ function MessageActions({ copyText, onRegenerate, onEdit, feedback = null, onFee
|
|
|
67
68
|
})] })
|
|
68
69
|
]
|
|
69
70
|
});
|
|
70
|
-
}
|
|
71
|
+
});
|
|
71
72
|
/**
|
|
72
73
|
* Edit-and-resend in place of a sent message. Enter sends (never mid-IME
|
|
73
74
|
* composition), Shift+Enter adds a line, Escape cancels.
|
|
74
75
|
*/
|
|
75
|
-
function MessageEditor({ defaultValue, onSubmit, onCancel, submitLabel = "Send", className, ...props }) {
|
|
76
|
+
var MessageEditor = React.forwardRef(function MessageEditor({ defaultValue, onSubmit, onCancel, submitLabel = "Send", className, ...props }, ref) {
|
|
76
77
|
const [value, setValue] = React.useState(defaultValue);
|
|
77
78
|
const send = () => {
|
|
78
79
|
if (value.trim()) onSubmit(value.trim());
|
|
79
80
|
};
|
|
80
81
|
return /* @__PURE__ */ jsxs("form", {
|
|
82
|
+
ref,
|
|
81
83
|
"data-slot": "message-editor",
|
|
82
84
|
onSubmit: (e) => {
|
|
83
85
|
e.preventDefault();
|
|
@@ -100,7 +102,7 @@ function MessageEditor({ defaultValue, onSubmit, onCancel, submitLabel = "Send",
|
|
|
100
102
|
send();
|
|
101
103
|
}
|
|
102
104
|
},
|
|
103
|
-
className: "field-sizing-content max-h-60 min-h-16 w-full resize-none rounded-lg border border-ring bg-surface px-3 py-2 text-base leading-6 inset-ring-1 inset-ring-ring
|
|
105
|
+
className: cn("field-sizing-content max-h-60 min-h-16 w-full resize-none rounded-lg border border-ring bg-surface px-3 py-2 text-base leading-6 inset-ring-1 inset-ring-ring sm:text-sm", noOutlineClasses)
|
|
104
106
|
}), /* @__PURE__ */ jsxs("div", {
|
|
105
107
|
className: "flex justify-end gap-2",
|
|
106
108
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
@@ -117,14 +119,15 @@ function MessageEditor({ defaultValue, onSubmit, onCancel, submitLabel = "Send",
|
|
|
117
119
|
})]
|
|
118
120
|
})]
|
|
119
121
|
});
|
|
120
|
-
}
|
|
122
|
+
});
|
|
121
123
|
/**
|
|
122
124
|
* Files sent with a message: voice notes play inline, images show a
|
|
123
125
|
* thumbnail, anything else is a named chip that opens the file.
|
|
124
126
|
*/
|
|
125
|
-
function MessageAttachments({ files, className, ...props }) {
|
|
127
|
+
var MessageAttachments = React.forwardRef(function MessageAttachments({ files, className, ...props }, ref) {
|
|
126
128
|
if (!files.length) return null;
|
|
127
129
|
return /* @__PURE__ */ jsx("div", {
|
|
130
|
+
ref,
|
|
128
131
|
"data-slot": "message-attachments",
|
|
129
132
|
className: cn("flex flex-wrap gap-2", className),
|
|
130
133
|
...props,
|
|
@@ -141,7 +144,7 @@ function MessageAttachments({ files, className, ...props }) {
|
|
|
141
144
|
href: f.href,
|
|
142
145
|
target: "_blank",
|
|
143
146
|
rel: "noreferrer",
|
|
144
|
-
className: "block overflow-hidden rounded-lg border
|
|
147
|
+
className: cn("block overflow-hidden rounded-lg border", focusRingClasses),
|
|
145
148
|
children: /* @__PURE__ */ jsx("img", {
|
|
146
149
|
src: f.href,
|
|
147
150
|
alt: f.name,
|
|
@@ -162,12 +165,12 @@ function MessageAttachments({ files, className, ...props }) {
|
|
|
162
165
|
children: formatBytes(f.size)
|
|
163
166
|
})
|
|
164
167
|
] });
|
|
165
|
-
const chipClass = "inline-flex max-w-64 items-center gap-2 rounded-md border bg-surface px-2.5 py-1.5 text-sm";
|
|
168
|
+
const chipClass = "inline-flex max-w-64 items-center gap-2 rounded-md border bg-surface px-2.5 py-1.5 text-sm pointer-coarse:min-h-11";
|
|
166
169
|
return f.href ? /* @__PURE__ */ jsx("a", {
|
|
167
170
|
href: f.href,
|
|
168
171
|
target: "_blank",
|
|
169
172
|
rel: "noreferrer",
|
|
170
|
-
className: cn(chipClass, "
|
|
173
|
+
className: cn(chipClass, "hover:bg-muted", focusRingClasses),
|
|
171
174
|
children: chip
|
|
172
175
|
}, `${f.name}-${i}`) : /* @__PURE__ */ jsx("span", {
|
|
173
176
|
className: chipClass,
|
|
@@ -175,7 +178,7 @@ function MessageAttachments({ files, className, ...props }) {
|
|
|
175
178
|
}, `${f.name}-${i}`);
|
|
176
179
|
})
|
|
177
180
|
});
|
|
178
|
-
}
|
|
181
|
+
});
|
|
179
182
|
//#endregion
|
|
180
183
|
export { MessageActions, MessageAttachments, MessageEditor };
|
|
181
184
|
|