neba 1.13.0 → 1.16.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/README.md +22 -30
- package/dist/a2ui/catalog.json +1466 -0
- package/dist/a2ui/components.d.ts +21 -0
- package/dist/a2ui/components.js +1 -0
- package/dist/a2ui/index.d.ts +62 -0
- package/dist/a2ui/index.js +1 -0
- package/dist/a2ui/schema.d.ts +47 -0
- package/dist/a2ui/schema.js +1 -0
- package/dist/components/accordion/Accordion.d.ts +5 -1
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/agent-steps/AgentSteps.d.ts +80 -0
- package/dist/components/agent-steps/AgentSteps.js +1 -0
- package/dist/components/agent-steps/index.d.ts +2 -0
- package/dist/components/agent-steps/index.js +1 -0
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/anchor/Anchor.d.ts +3 -2
- package/dist/components/anchor/Anchor.js +1 -1
- package/dist/components/animate-appear/AnimateAppear.js +1 -1
- package/dist/components/animate-blink/AnimateBlink.d.ts +3 -0
- package/dist/components/animate-blink/AnimateBlink.js +1 -1
- package/dist/components/animate-counter/AnimateCounter.d.ts +3 -1
- package/dist/components/animate-counter/AnimateCounter.js +1 -1
- package/dist/components/animate-fade/AnimateFade.js +1 -1
- package/dist/components/animate-float/AnimateFloat.js +1 -1
- package/dist/components/animate-grow/AnimateGrow.js +1 -1
- package/dist/components/animate-headline/AnimateHeadline.d.ts +9 -2
- package/dist/components/animate-headline/AnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/AnimateLighting.d.ts +1 -1
- package/dist/components/animate-lighting/AnimateLighting.js +1 -1
- package/dist/components/animate-marquee/AnimateMarquee.d.ts +15 -6
- package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
- package/dist/components/animate-reveal/AnimateReveal.js +1 -1
- package/dist/components/animate-rotate/AnimateRotate.js +1 -1
- package/dist/components/animate-scramble/AnimateScramble.d.ts +5 -3
- package/dist/components/animate-scramble/AnimateScramble.js +1 -1
- package/dist/components/animate-shake/AnimateShake.js +1 -1
- package/dist/components/animate-slide/AnimateSlide.js +1 -1
- package/dist/components/animate-split/AnimateSplit.d.ts +3 -1
- package/dist/components/animate-split/AnimateSplit.js +1 -1
- package/dist/components/animate-typing/AnimateTyping.d.ts +12 -4
- package/dist/components/animate-typing/AnimateTyping.js +1 -1
- package/dist/components/animate-zoom/AnimateZoom.js +1 -1
- package/dist/components/app-logo/AppLogo.js +1 -1
- package/dist/components/approval/Approval.d.ts +115 -0
- package/dist/components/approval/Approval.js +1 -0
- package/dist/components/approval/index.d.ts +2 -0
- package/dist/components/approval/index.js +1 -0
- package/dist/components/area-chart/AreaChart.d.ts +16 -5
- package/dist/components/area-chart/AreaChart.js +1 -1
- package/dist/components/aspect-ratio/AspectRatio.d.ts +6 -4
- package/dist/components/aspect-ratio/AspectRatio.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/bar-chart/BarChart.d.ts +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/blockquote/Blockquote.js +1 -1
- package/dist/components/bottom-navigation/BottomNavigation.d.ts +2 -1
- package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
- package/dist/components/box/Box.d.ts +5 -0
- package/dist/components/box/Box.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts +10 -0
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/button/Button.d.ts +11 -0
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button-group/ButtonGroup.js +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/carousel/Carousel.d.ts +4 -0
- package/dist/components/carousel/Carousel.js +1 -1
- package/dist/components/chat-bubble/ChatBubble.js +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/chip/Chip.d.ts +3 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/code-block/CodeBlock.d.ts +6 -3
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/collapsible/Collapsible.d.ts +11 -1
- package/dist/components/collapsible/Collapsible.js +1 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +11 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/confirm/Confirm.js +1 -1
- package/dist/components/container/Container.js +1 -1
- package/dist/components/context-window/ContextWindow.d.ts +103 -0
- package/dist/components/context-window/ContextWindow.js +1 -0
- package/dist/components/context-window/index.d.ts +2 -0
- package/dist/components/context-window/index.js +1 -0
- package/dist/components/data-list/DataList.js +1 -1
- package/dist/components/data-table/DataTable.d.ts +12 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/date-picker/DatePicker.js +1 -1
- package/dist/components/date-range-picker/DateRangePicker.js +1 -1
- package/dist/components/date-time-picker/DateTimePicker.js +1 -1
- package/dist/components/dialog/Dialog.d.ts +12 -0
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/drawer/Drawer.d.ts +7 -0
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/fieldset/Fieldset.js +1 -1
- package/dist/components/file-picker/FilePicker.d.ts +12 -4
- package/dist/components/file-picker/FilePicker.js +1 -1
- package/dist/components/flex/Flex.d.ts +8 -2
- package/dist/components/flex/Flex.js +1 -1
- package/dist/components/floating-action-button/FloatingActionButton.d.ts +16 -1
- package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
- package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
- package/dist/components/footer/Footer.d.ts +8 -0
- package/dist/components/footer/Footer.js +1 -1
- package/dist/components/form/Form.d.ts +4 -2
- package/dist/components/form/Form.js +1 -1
- package/dist/components/gallery/Gallery.d.ts +56 -3
- package/dist/components/gallery/Gallery.js +1 -1
- package/dist/components/gallery/GalleryViewer.js +1 -1
- package/dist/components/gauge-chart/GaugeChart.d.ts +1 -1
- package/dist/components/gauge-chart/GaugeChart.js +1 -1
- package/dist/components/grid/Grid.js +1 -1
- package/dist/components/grid-container/GridContainer.js +1 -1
- package/dist/components/header/Header.js +1 -1
- package/dist/components/heatmap-chart/HeatmapChart.d.ts +20 -1
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/how-to-steps/HowToSteps.d.ts +26 -1
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/icon-button/IconButton.d.ts +0 -20
- package/dist/components/icon-button/IconButton.js +1 -1
- package/dist/components/image/Image.d.ts +137 -11
- package/dist/components/image/Image.js +1 -1
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/inline-citation/InlineCitation.d.ts +53 -0
- package/dist/components/inline-citation/InlineCitation.js +1 -0
- package/dist/components/inline-citation/index.d.ts +2 -0
- package/dist/components/inline-citation/index.js +1 -0
- package/dist/components/line-chart/LineChart.d.ts +16 -5
- package/dist/components/line-chart/LineChart.js +1 -1
- package/dist/components/list/List.js +1 -1
- package/dist/components/menu/Menu.d.ts +25 -11
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/menubar/Menubar.js +1 -1
- package/dist/components/meter/Meter.d.ts +6 -0
- package/dist/components/meter/Meter.js +1 -1
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.d.ts +10 -1
- package/dist/components/navigation-menu/NavigationMenu.js +1 -1
- package/dist/components/number-field/NumberField.d.ts +20 -6
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/otp-field/OtpField.d.ts +7 -0
- package/dist/components/otp-field/OtpField.js +1 -1
- package/dist/components/overlay/Overlay.d.ts +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/page-layout/PageLayout.d.ts +11 -0
- package/dist/components/page-layout/PageLayout.js +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/panes/Panes.d.ts +11 -0
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.d.ts +34 -3
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pill/Pill.d.ts +8 -0
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/popconfirm/Popconfirm.d.ts +10 -3
- package/dist/components/popconfirm/Popconfirm.js +1 -1
- package/dist/components/popover/Popover.d.ts +8 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/progress-box/ProgressBox.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.js +1 -1
- package/dist/components/progress-linear/ProgressLinear.js +1 -1
- package/dist/components/prompt-input/PromptInput.d.ts +104 -0
- package/dist/components/prompt-input/PromptInput.js +1 -0
- package/dist/components/prompt-input/index.d.ts +2 -0
- package/dist/components/prompt-input/index.js +1 -0
- package/dist/components/provider/NebaProvider.d.ts +3 -3
- package/dist/components/provider/NebaProvider.js +1 -1
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/rating/Rating.d.ts +4 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/reasoning/Reasoning.d.ts +78 -0
- package/dist/components/reasoning/Reasoning.js +1 -0
- package/dist/components/reasoning/index.d.ts +2 -0
- package/dist/components/reasoning/index.js +1 -0
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-area/ScrollArea.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.d.ts +10 -0
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/segmented-button/SegmentedButton.js +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/shortcut/Shortcut.js +1 -1
- package/dist/components/show/Show.d.ts +6 -5
- package/dist/components/show/Show.js +1 -1
- package/dist/components/sidebar/Sidebar.d.ts +7 -5
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/sidebar/SidebarTrigger.js +1 -1
- package/dist/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.d.ts +13 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/sources/Sources.d.ts +78 -0
- package/dist/components/sources/Sources.js +1 -0
- package/dist/components/sources/index.d.ts +2 -0
- package/dist/components/sources/index.js +1 -0
- package/dist/components/sparkline/Sparkline.d.ts +14 -1
- package/dist/components/sparkline/Sparkline.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/stack/Stack.d.ts +2 -2
- package/dist/components/stack/Stack.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/streaming-text/StreamingText.d.ts +75 -0
- package/dist/components/streaming-text/StreamingText.js +1 -0
- package/dist/components/streaming-text/index.d.ts +2 -0
- package/dist/components/streaming-text/index.js +1 -0
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/Table.d.ts +8 -2
- package/dist/components/table/Table.js +1 -1
- package/dist/components/tabs/Tabs.d.ts +17 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/timeline/Timeline.d.ts +8 -0
- package/dist/components/timeline/Timeline.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.d.ts +9 -3
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toggle/Toggle.js +1 -1
- package/dist/components/toggle-group/ToggleGroup.js +1 -1
- package/dist/components/tool-call/ToolCall.d.ts +104 -0
- package/dist/components/tool-call/ToolCall.js +1 -0
- package/dist/components/tool-call/index.d.ts +2 -0
- package/dist/components/tool-call/index.js +1 -0
- package/dist/components/toolbar/Toolbar.d.ts +8 -0
- package/dist/components/toolbar/Toolbar.js +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.d.ts +2 -0
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-select/TreeSelect.js +1 -1
- package/dist/components/tree-view/TreeView.d.ts +6 -0
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/typography/Typography.js +1 -1
- package/dist/components/visually-hidden/VisuallyHidden.d.ts +9 -7
- package/dist/components/visually-hidden/VisuallyHidden.js +1 -1
- package/dist/components/window-pane/WindowPane.d.ts +2 -2
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/hooks/useElementSize.d.ts +3 -1
- package/dist/hooks/useElementSize.js +1 -1
- package/dist/hooks/useOnScreen.d.ts +3 -0
- package/dist/hooks/useOnScreen.js +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +63 -16
- package/dist/internal/animate.js +1 -1
- package/dist/internal/calendar.d.ts +6 -1
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-brush.d.ts +53 -0
- package/dist/internal/chart-brush.js +1 -0
- package/dist/internal/chart-frame.d.ts +186 -30
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/chart.d.ts +133 -6
- package/dist/internal/chart.js +1 -1
- package/dist/internal/children.d.ts +15 -0
- package/dist/internal/children.js +1 -0
- package/dist/internal/color.d.ts +4 -0
- package/dist/internal/color.js +1 -1
- package/dist/internal/csv.d.ts +12 -1
- package/dist/internal/csv.js +1 -1
- package/dist/internal/data-table.d.ts +28 -10
- package/dist/internal/data-table.js +1 -1
- package/dist/internal/date.d.ts +12 -5
- package/dist/internal/date.js +1 -1
- package/dist/internal/defaults.d.ts +6 -1
- package/dist/internal/defaults.js +1 -1
- package/dist/internal/drag.d.ts +13 -1
- package/dist/internal/drag.js +1 -1
- package/dist/internal/drop.d.ts +61 -0
- package/dist/internal/drop.js +1 -0
- package/dist/internal/fieldset.d.ts +13 -0
- package/dist/internal/fieldset.js +1 -0
- package/dist/internal/glow.d.ts +102 -0
- package/dist/internal/glow.js +1 -0
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/i18n.d.ts +232 -11
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/icons.d.ts +13 -2
- package/dist/internal/icons.js +1 -1
- package/dist/internal/inert.d.ts +13 -0
- package/dist/internal/inert.js +1 -0
- package/dist/internal/initials.d.ts +8 -3
- package/dist/internal/initials.js +1 -1
- package/dist/internal/keys.d.ts +13 -0
- package/dist/internal/keys.js +1 -1
- package/dist/internal/link.d.ts +13 -15
- package/dist/internal/link.js +1 -1
- package/dist/internal/media.d.ts +9 -17
- package/dist/internal/media.js +1 -1
- package/dist/internal/menu.d.ts +6 -1
- package/dist/internal/mockup.d.ts +5 -4
- package/dist/internal/mockup.js +1 -1
- package/dist/internal/observe.d.ts +12 -0
- package/dist/internal/observe.js +1 -1
- package/dist/internal/page-layout.d.ts +10 -8
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.d.ts +1 -1
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +11 -5
- package/dist/internal/progress.js +1 -1
- package/dist/internal/responsive.d.ts +0 -8
- package/dist/internal/responsive.js +1 -1
- package/dist/internal/run.d.ts +71 -0
- package/dist/internal/run.js +1 -0
- package/dist/internal/screen.d.ts +12 -0
- package/dist/internal/screen.js +1 -0
- package/dist/internal/styles.d.ts +185 -14
- package/dist/internal/styles.js +1 -1
- package/dist/internal/text.d.ts +3 -3
- package/dist/internal/text.js +1 -1
- package/dist/internal/window.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +516 -53
- package/dist/types.d.ts +167 -7
- package/dist/types.js +0 -8
- package/package.json +43 -9
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type RunMessages, type ToolMessages } from '../../internal/i18n.js';
|
|
3
|
+
import type { NebaElevation, NebaRunStatus, NebaSlots, NebaStyleProps } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The parts a ToolCall draws behind its root.
|
|
6
|
+
*
|
|
7
|
+
* `header` is the row that is always there — the mark, the name, the elapsed
|
|
8
|
+
* time and the chevron — and `body` is the panel behind it. `args` and
|
|
9
|
+
* `result` name the two blocks inside that panel, because they are what a
|
|
10
|
+
* caller reaches for: a tool whose arguments are long enough to want their own
|
|
11
|
+
* scroll is the ordinary case.
|
|
12
|
+
*/
|
|
13
|
+
export type ToolCallSlot = 'header' | 'body' | 'args' | 'result';
|
|
14
|
+
export interface ToolCallProps extends Pick<NebaStyleProps, 'size' | 'variant' | 'color' | 'density'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'onChange'> {
|
|
15
|
+
/**
|
|
16
|
+
* What was called. Drawn in the monospaced face, because a tool name is an
|
|
17
|
+
* identifier rather than a phrase.
|
|
18
|
+
*/
|
|
19
|
+
name: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* How far the call has got. It decides the mark, the colour family and what
|
|
22
|
+
* the panel shows — an `error` draws `error` where a `success` draws
|
|
23
|
+
* `result`.
|
|
24
|
+
* @default 'pending'
|
|
25
|
+
*/
|
|
26
|
+
status?: NebaRunStatus;
|
|
27
|
+
/**
|
|
28
|
+
* What the tool was called with. A string is drawn as preformatted text; a
|
|
29
|
+
* node is rendered as it is, so a [CodeBlock](../display/code-block) or a
|
|
30
|
+
* table of parameters goes straight in.
|
|
31
|
+
*/
|
|
32
|
+
args?: React.ReactNode;
|
|
33
|
+
/** What it answered, under the same rule. */
|
|
34
|
+
result?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* What went wrong, shown in place of `result` while `status` is `error`.
|
|
37
|
+
* Without it a failed call shows its `result`, which is often the error the
|
|
38
|
+
* tool itself returned.
|
|
39
|
+
*/
|
|
40
|
+
error?: React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* How long the call took, in milliseconds.
|
|
43
|
+
*
|
|
44
|
+
* Left out, a `running` call counts its own time from the moment it started
|
|
45
|
+
* running and says nothing for the first second — a number ticking up is the
|
|
46
|
+
* only thing on the row that says the call has not hung. The count stops the
|
|
47
|
+
* moment a real figure arrives, because at that point it was only ever
|
|
48
|
+
* standing in for one.
|
|
49
|
+
*/
|
|
50
|
+
duration?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Anything else that belongs on the header line — a server name, a token
|
|
53
|
+
* count, a retry badge. Sits after the name and before the elapsed time.
|
|
54
|
+
*/
|
|
55
|
+
meta?: React.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* The mark at the start. Defaults to the one that goes with `status`; pass
|
|
58
|
+
* `false` to drop it, or a node to replace it.
|
|
59
|
+
*/
|
|
60
|
+
icon?: React.ReactNode | false;
|
|
61
|
+
/** Whether the panel is showing. Pass it to drive the disclosure yourself. */
|
|
62
|
+
open?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Where an uncontrolled ToolCall starts. A call that *fails* opens itself
|
|
65
|
+
* whatever this said, unless `open` is holding it: a reader should not have
|
|
66
|
+
* to go looking for the reason something did not work.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
defaultOpen?: boolean;
|
|
70
|
+
/** Called when the header opens or closes the panel. */
|
|
71
|
+
onOpenChange?: (open: boolean) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Drop shadow depth. `0` (the default) is flat — a tool call belongs to the
|
|
74
|
+
* transcript it sits in rather than floating over it.
|
|
75
|
+
* @default 0
|
|
76
|
+
*/
|
|
77
|
+
elevation?: NebaElevation;
|
|
78
|
+
/**
|
|
79
|
+
* Which language the status and the two headings are said in — a BCP 47 tag
|
|
80
|
+
* such as `ko` or `pt-BR`. Unsupported tags fall back to English.
|
|
81
|
+
*/
|
|
82
|
+
locale?: string;
|
|
83
|
+
/** Those words, written out. Overrides the `locale`'s. */
|
|
84
|
+
labels?: Partial<RunMessages & ToolMessages>;
|
|
85
|
+
/** Class names for the parts behind the root. */
|
|
86
|
+
classNames?: NebaSlots<ToolCallSlot>;
|
|
87
|
+
/** Anything to put under the result — a follow-up action, a note. */
|
|
88
|
+
children?: React.ReactNode;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* One tool invocation: what was called, what with, what came back, and how long
|
|
92
|
+
* it took.
|
|
93
|
+
*
|
|
94
|
+
* The smallest unit of an agent transcript, and the one thing nothing else in
|
|
95
|
+
* the library composes into. A [Collapsible](../surfaces/collapsible) folds
|
|
96
|
+
* content a reader owns the state of; this one is opened and closed by a call
|
|
97
|
+
* that is still happening, and its result is not there on the first render.
|
|
98
|
+
*
|
|
99
|
+
* Base UI owns the disclosure — the button and panel pairing, the
|
|
100
|
+
* `aria-expanded` and `aria-controls` between them, and the measured height the
|
|
101
|
+
* panel opens over — so what is left here is the header row, the two blocks
|
|
102
|
+
* inside the panel and the arithmetic on the clock.
|
|
103
|
+
*/
|
|
104
|
+
export declare const ToolCall: React.ForwardRefExoticComponent<ToolCallProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,Fragment as a,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Collapsible as t}from"@base-ui/react/collapsible";import{boxPaddingXClasses as s,boxPaddingYClasses as r}from"../box/Box.js";import{ChevronIcon as o}from"../../internal/icons.js";import{formatDuration as i,runColor as c,runIcon as m,useElapsed as d}from"../../internal/run.js";import{runMessages as u,toolMessages as f,useMessages as p}from"../../internal/i18n.js";import{collapsiblePanelClasses as h,cx as b,gapClasses as x,hasContent as v,iconClasses as g,metaTextClasses as N,preformattedClasses as j,radiusClasses as w,sheetBodyClasses as y,sheetTitleClasses as k,srOnlyClasses as z,surfaceClasses as C,surfaceSlots as B,transitionClasses as _}from"../../internal/styles.js";import{useStyleDefaults as O}from"../../internal/defaults.js";const R={solid:[C,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[C,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},T=k;export const ToolCall=/*@__PURE__*/l.forwardRef(function ToolCall(j,k){const{variant:C="outline",size:E="md",color:F="primary",density:P="default",elevation:S=0,name:q,status:A="pending",args:D,result:G,error:H,duration:I,meta:J,icon:K,open:L,defaultOpen:M=!1,onOpenChange:Q,locale:U,labels:V,classNames:W,className:X,style:Y,children:Z,...$}=O(j,["size","density","variant","locale"]),ee={...p(u,U),...p(f,U),...V},[ae,ne]=l.useState(M),le=void 0!==L,te=le?L:ae,se=l.useRef(A);l.useEffect(()=>{se.current===A||"error"!==A||le||ne(!0),se.current=A},[A,le]);const re=d("running"===A,I),oe=c(A,F),ie=void 0===K?m(A):K,ce=function(e,a,n){return"error"===e&&v(n)?n:a}(A,G,H),me=v(D)||v(ce)||v(Z),de=s[P][E],ue=r[P][E],fe=n(a,{children:[v(ie)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--n-accent)",children:ie}):null,e("span",{className:b("min-w-0 truncate font-mono font-semibold",T[E]),children:q}),e("span",{className:z,children:ee[A]}),v(J)?e("span",{className:b("min-w-0 truncate text-(--neba-muted-fg)",N[E]),children:J}):null,e("span",{className:"flex-1"}),null===re?null:e("span",{className:b("shrink-0 tabular-nums text-(--neba-muted-fg)",N[E]),children:i(re,U)})]}),pe=b("flex flex-col overflow-hidden",w[E],R[C],_,g,X??""),he={...B(oe,S),...Y};return me?n(t.Root,{ref:k,open:te,onOpenChange:e=>{le||ne(e),Q?.(e)},"data-status":A,className:pe,style:he,...$,children:[n(t.Trigger,{className:b("flex w-full cursor-pointer items-center text-start",de,ue,x[E],_,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",W?.header??""),children:[fe,e("span",{className:["flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[panel-open]:rotate-180"].join(" "),children:e(o,{})})]}),e(t.Panel,{className:h,children:n("div",{className:b("flex min-w-0 flex-col gap-2 pb-4",de,y[E],"compact"===P?"pb-2":"",W?.body??""),children:[v(D)?e(Block,{size:E,label:ee.arguments,className:W?.args,value:D}):null,v(ce)?e(Block,{size:E,label:ee.result,className:W?.result,value:ce,accent:"error"===A}):null,Z]})})]}):e("div",{ref:k,"data-status":A,className:pe,style:he,...$,children:e("div",{className:b("flex items-center",de,ue,x[E],W?.header??""),children:fe})})});function Block({size:a,label:l,value:t,className:s,accent:r=!1}){return n("div",{className:b("flex min-w-0 flex-col gap-1",s??""),children:[e("span",{className:b("font-medium tracking-wide text-(--neba-muted-fg) uppercase",N[a]),children:l}),"string"==typeof t?e("pre",{className:b(j,"max-h-64",r?"text-(--n-accent)":""),children:t}):e("div",{className:r?"text-(--n-accent)":void 0,children:t})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ToolCall}from"./ToolCall.js";
|
|
@@ -24,6 +24,14 @@ export interface ToolbarProps extends NebaStyleProps, Omit<React.ComponentPropsW
|
|
|
24
24
|
position?: NebaPosition;
|
|
25
25
|
/** Which edge it is held against when `position` is not `static`. @default 'top' */
|
|
26
26
|
side?: 'top' | 'bottom';
|
|
27
|
+
/**
|
|
28
|
+
* Keeps what is on the bar clear of a phone's home indicator and notch, on a
|
|
29
|
+
* page laid out under them with `viewport-fit=cover`, by adding the screen's
|
|
30
|
+
* `env(safe-area-inset-*)` on the edge it is held against. Only a `fixed` or
|
|
31
|
+
* `sticky` bar is ever against that edge, so a `static` one is left alone.
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
safeArea?: boolean;
|
|
27
35
|
/**
|
|
28
36
|
* Draws a hairline along the edge that faces the content — under a `top` bar,
|
|
29
37
|
* over a `bottom` one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{useRender as n}from"@base-ui/react/use-render";import{boxPaddingXClasses as
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{useRender as n}from"@base-ui/react/use-render";import{boxPaddingXClasses as a,boxPaddingYClasses as i,boxPaddingYValues as s}from"../box/Box.js";import{cx as l,hasContent as d,radiusClasses as m,sheetSectionGapClasses as c,surfaceClasses as p,surfaceSlots as b,transitionClasses as f}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const v={solid:[p,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[p,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},u={static:{top:"",bottom:""},sticky:{top:"sticky top-0 z-20",bottom:"sticky bottom-0 z-20"},fixed:{top:"fixed inset-x-0 top-0 z-30",bottom:"fixed inset-x-0 bottom-0 z-30"}},g={top:"border-b [border-color:var(--n-line)]",bottom:"border-t [border-color:var(--n-line)]"};export const Toolbar=/*@__PURE__*/o.forwardRef(function Toolbar(o,p){const{variant:h="outline",size:y="md",color:j="primary",density:w="default",elevation:z=0,position:k="static",side:N="top",safeArea:T=!0,divider:B=!1,start:$,end:A,render:F,className:R,style:q,children:C,...D}=x(o,["size","density","variant"]),E=l("flex w-full min-w-0 items-center",a[w][y],i[w][y],c[y],"static"===k?m[y]:"",v[h],B?g[N]:"",u[k][N],f,R??"");return n({render:F,ref:p,props:{className:E,style:{...b(j,z),...T&&"static"!==k?{["bottom"===N?"paddingBottom":"paddingTop"]:`calc(${s[w][y]} + env(safe-area-inset-${N}))`}:null,...q},children:r(t,{children:[d($)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:$}):null,e("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:C}),d(A)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:A}):null]}),...D}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Tooltip as a}from"@base-ui/react/tooltip";import{controlSlots as i,cx as s,metaTextClasses as l,paddingXClasses as n,popupFadeClasses as r,radiusClasses as d,surfaceClasses as p}from"../../internal/styles.js";import{useStyleDefaults as c}from"../../internal/defaults.js";export const TooltipProvider=a.Provider;const m=[p,"max-w-64 text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]","[outline:none]",r,"data-[instant]:[transition-duration:0ms]"].join(" "),f={xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"},h={xs:6,sm:7,md:8,lg:9,xl:10};export function Tooltip(r){const{content:p,children:u,size:x="sm",color:y="secondary",density:b="default",side:g="top",align:v="center",sideOffset:j=6,delay:w,closeDelay:O,arrow:z=!0,open:N,defaultOpen:P,onOpenChange:T,disabled:C=!1,className:D,style:k,...
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Tooltip as a}from"@base-ui/react/tooltip";import{controlSlots as i,cx as s,metaTextClasses as l,paddingXClasses as n,popupFadeClasses as r,radiusClasses as d,surfaceClasses as p}from"../../internal/styles.js";import{useStyleDefaults as c}from"../../internal/defaults.js";export const TooltipProvider=a.Provider;const m=[p,"max-w-64 text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--neba-shadow-3),var(--neba-plate-solid)]","[outline:none]",r,"data-[instant]:[transition-duration:0ms]"].join(" "),f={xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"},h={xs:6,sm:7,md:8,lg:9,xl:10};export function Tooltip(r){const{content:p,children:u,size:x="sm",color:y="secondary",density:b="default",side:g="top",align:v="center",sideOffset:j=6,delay:w,closeDelay:O,arrow:z=!0,open:N,defaultOpen:P,onOpenChange:T,disabled:C=!1,className:D,style:k,id:A,...B}=c(r,["size","density"]),I=h[x],L=o.useId(),M=A??L,[R,S]=o.useState(P??!1),q=N??R;return t(a.Root,{open:N,defaultOpen:P,onOpenChange:e=>{void 0===N&&S(e),T?.(e)},children:[e(a.Trigger,{render:u,delay:w,closeDelay:O,disabled:C,"aria-describedby":q?M:void 0}),e(a.Portal,{children:e(a.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:g,align:v,sideOffset:j,children:t(a.Popup,{id:M,role:"tooltip",className:s(m,d[x],n[b][x],f[x],l[x],D??""),style:{...i(y,3,"solid"),...k},...B,children:[z?e(a.Arrow,{className:["data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"].join(" "),children:e("svg",{width:I,height:I/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:e("path",{d:"M0 0h10L5 5z",fill:"var(--n-fill)"})})}):null,p]})})})]})}
|
|
@@ -71,6 +71,8 @@ export interface TourProps extends Pick<NebaStyleProps, 'size' | 'color' | 'dens
|
|
|
71
71
|
doneLabel?: React.ReactNode;
|
|
72
72
|
/** The Skip button. */
|
|
73
73
|
skipLabel?: React.ReactNode;
|
|
74
|
+
/** Accessible name of the × that ends the tour. Defaults to the `locale`'s word. */
|
|
75
|
+
closeLabel?: string;
|
|
74
76
|
/** Class names for the card. */
|
|
75
77
|
className?: string;
|
|
76
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Popover as s}from"@base-ui/react/popover";import{Button as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Popover as s}from"@base-ui/react/popover";import{Button as i}from"../button/Button.js";import{boxPaddingXClasses as o,boxPaddingYClasses as l}from"../box/Box.js";import{actionMessages as r,fillMessage as a,stepsMessages as c,useMessages as d}from"../../internal/i18n.js";import{CloseIcon as m}from"../../internal/icons.js";import{observeResize as u}from"../../internal/observe.js";import{cx as p,hasContent as f,metaTextClasses as h,popupFadeClasses as g,radiusClasses as b,sheetBodyClasses as v,sheetHeaderGapClasses as x,sheetSectionGapClasses as w,sheetTitleClasses as k,srOnlyClasses as N,surfaceClasses as y,surfaceSlots as z}from"../../internal/styles.js";import{useStyleDefaults as j}from"../../internal/defaults.js";const S=[y,"relative flex flex-col","border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]",g].join(" "),_={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},L={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};function C(e){try{return document.querySelector(e)}catch{return null}}function Mask({spot:t,radius:n,className:s}){return e("div",null===t?{"aria-hidden":"true",className:p("pointer-events-none fixed inset-0 z-40 bg-(--neba-scrim)",s)}:{"aria-hidden":"true",className:p("pointer-events-none fixed z-40 [box-shadow:0_0_0_9999px_var(--neba-scrim)]",s),style:{top:t.top,left:t.left,width:t.width,height:t.height,borderRadius:n}})}export function Tour(g){const{steps:y,open:E,defaultOpen:M=!1,onOpenChange:P,step:O,defaultStep:B=0,onStepChange:F,onFinish:R,mask:T=!0,skippable:q=!0,dismissible:A=!0,scrollIntoView:I=!0,locale:V,previousLabel:$,nextLabel:D,doneLabel:H,skipLabel:G,closeLabel:J,size:K="md",color:Q="primary",density:U="default",className:W,classNames:X}=j(g,["size","density","locale"]),Y=d(c,V),Z=d(r,V),[ee,te]=n.useState(M),[ne,se]=n.useState(B),ie=E??ee,oe=Math.min(O??ne,Math.max(0,y.length-1)),le=y[oe],[re,ae]=n.useState(null),ce=e=>{void 0===E&&te(e),P?.(e)},de=e=>{void 0===O&&se(e),F?.(e)},[me,ue]=n.useState(null);if(n.useLayoutEffect(()=>{const e=le?.target;ue(ie&&e?C(e):null)},[ie,le?.target]),n.useEffect(()=>{const e=le?.target;if(!ie||!e)return;const t=C(e);if(!(t instanceof HTMLElement))return;I&&t.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"});const n=le?.padding??6;let s=0;const i=()=>{s=0;const i=t.getBoundingClientRect(),o={top:i.top-n,left:i.left-n,width:i.width+2*n,height:i.height+2*n};ae(t=>t?.selector===e&&t.spot.top===o.top&&t.spot.left===o.left&&t.spot.width===o.width&&t.spot.height===o.height?t:{selector:e,spot:o})},o=()=>{0===s&&(s=requestAnimationFrame(i))};i();const l=u(t,o);return window.addEventListener("scroll",o,{passive:!0,capture:!0}),window.addEventListener("resize",o,{passive:!0}),()=>{0!==s&&cancelAnimationFrame(s),l(),window.removeEventListener("scroll",o,!0),window.removeEventListener("resize",o)}},[ie,le?.target,le?.padding,I]),0===y.length)return null;const pe=ie&&le?.target&&re?.selector===le.target?re.spot:null,fe=0===oe,he=oe===y.length-1,ge=o[U][K],be=l[U][K],ve=L[K],xe=f(le?.title)||f(le?.content);return e(s.Root,{open:ie,onOpenChange:(e,t)=>{(e||A||"escape-key"!==t.reason)&&(e||"outside-press"!==t.reason&&"focus-out"!==t.reason)?ce(e):t.cancel()},children:t(s.Portal,{children:[ie&&T?e(Mask,{spot:pe,radius:pe?8:0,className:X?.mask}):null,e(s.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:le?.side??"bottom",align:le?.align??"center",sideOffset:10,collisionPadding:12,anchor:me,children:t(s.Popup,{className:p(S,b[K],v[K],w[K],_[K],ge,be,W),style:z(Q,3),children:[e("span",{className:N,"aria-live":"polite",children:"string"==typeof le?.title?a(Y.step,{index:String(oe+1),title:le.title}):a(Y.position,{index:String(oe+1),total:String(y.length)})}),xe?t("div",{className:"flex items-start gap-3",children:[t("div",{className:`flex min-w-0 flex-1 flex-col ${x[K]}`,children:[f(le?.title)?e(s.Title,{className:p("m-0 font-semibold",k[K],X?.title),children:le?.title}):null,f(le?.content)?e(s.Description,{className:p("m-0 min-w-0",X?.description),children:le?.content}):null]}),A?e("button",{type:"button","aria-label":J??Z.close,onClick:()=>ce(!1),className:p("flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center","rounded-full text-(--neba-muted-fg)","[&_svg]:size-[1.1em] [&_svg]:shrink-0","[transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","hover:bg-(--n-soft) hover:text-(--neba-fg)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",X?.close),children:e(m,{})}):null]}):null,t("div",{className:p("flex items-center gap-2",X?.footer),children:[e("span",{className:`shrink-0 tabular-nums text-(--neba-muted-fg) ${h[K]}`,children:a(Y.position,{index:String(oe+1),total:String(y.length)})}),t("div",{className:"ms-auto flex items-center gap-2",children:[q&&!he?e(i,{size:ve,variant:"text",color:"secondary",onClick:()=>ce(!1),children:G??Y.skip}):null,fe?null:e(i,{size:ve,variant:"outline",color:Q,onClick:()=>de(oe-1),children:$??Y.previous}),e(i,{size:ve,color:Q,onClick:()=>he?(R?.(),void ce(!1)):de(oe+1),children:he?H??Y.done:D??Y.next})]})]})]})})]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Checkbox as t}from"../checkbox/Checkbox.js";import{IconButton as s}from"../icon-button/IconButton.js";import{ScrollArea as r}from"../scroll-area/ScrollArea.js";import{TextField as i}from"../text-field/TextField.js";import{transferMessages as n,useMessages as o}from"../../internal/i18n.js";import{ArrowRightIcon as c}from"../../internal/icons.js";import{searchText as d}from"../../internal/search.js";import{cx as m,fieldRestClasses as u,hasContent as h,metaTextClasses as f,paddingXClasses as b,radiusClasses as p,surfaceSlots as v,toLength as g}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const y={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},k={xs:"py-0.5",sm:"py-1",md:"py-1",lg:"py-1.5",xl:"py-2"};function
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Checkbox as t}from"../checkbox/Checkbox.js";import{IconButton as s}from"../icon-button/IconButton.js";import{ScrollArea as r}from"../scroll-area/ScrollArea.js";import{TextField as i}from"../text-field/TextField.js";import{transferMessages as n,useMessages as o}from"../../internal/i18n.js";import{ArrowRightIcon as c}from"../../internal/icons.js";import{searchText as d}from"../../internal/search.js";import{cx as m,fieldRestClasses as u,hasContent as h,metaTextClasses as f,paddingXClasses as b,radiusClasses as p,surfaceSlots as v,toLength as g}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const y={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},k={xs:"py-0.5",sm:"py-1",md:"py-1",lg:"py-1.5",xl:"py-2"};function Panel({title:s,rows:n,arrived:o,ticked:c,onTick:d,onTickAll:h,search:g,onSearch:x,searchable:S,disabled:w,height:j,emptyMessage:N,searchLabel:z,selectAllLabel:M,style:T}){const{size:$,variant:A="outline",color:C="primary",density:L="default"}=T,_=n.filter(e=>!e.disabled),P=_.filter(e=>c.has(e.value)),I=_.length>0&&P.length===_.length,V=P.length>0&&!I,B=b[L][$],F=l.useId();return a("div",{role:"group","aria-labelledby":F,className:["flex min-w-0 flex-col overflow-hidden",u[A],p[$]].join(" "),style:v(C,0),children:[a("div",{className:`flex items-center gap-2 border-b [border-color:var(--neba-border)] ${B} ${y[$]}`,children:[e(t,{size:$,color:C,checked:I,indeterminate:V,disabled:w||0===_.length,"aria-label":M,onCheckedChange:e=>h(!0===e)}),e("span",{id:F,className:`min-w-0 flex-1 truncate font-medium ${f[$]}`,children:s}),a("span",{className:`shrink-0 tabular-nums text-(--neba-muted-fg) ${f[$]}`,children:[P.length,"/",n.length]})]}),S?e("div",{className:`${B} ${y[$]}`,children:e(i,{size:$,color:C,density:L,fullWidth:!0,variant:"text",disabled:w,placeholder:z,"aria-label":z,value:g,onChange:e=>x(e.target.value)})}):null,e(r,{size:$,color:C,height:j,fade:!0,children:e("div",{className:`flex flex-col ${B} ${y[$]}`,children:0===n.length?e("span",{className:`text-(--neba-muted-fg) ${f[$]} ${k[$]}`,children:N}):n.map(a=>e(t,{size:$,color:C,className:m(k[$],o.has(a.value)?"[animation:neba-anim-fade_var(--neba-duration-fill)_var(--neba-ease)_both]":""),label:a.label,checked:c.has(a.value),disabled:w||a.disabled,onCheckedChange:e=>d(a.value,!0===e)},a.value))})})]})}function S(e,a,l){const t=d(a);return""===t?e:e.filter(e=>{const a=l.get(e.value);return void 0===a||a.includes(t)})}export const Transfer=/*@__PURE__*/l.forwardRef(function Transfer(t,r){const{items:i,value:u,defaultValue:f,onValueChange:b,sourceLabel:p,targetLabel:v,searchable:y=!1,height:k=220,disabled:w=!1,locale:j,variant:N="outline",size:z="md",color:M="primary",density:T="default",className:$,...A}=x(t,["size","density","variant","locale"]),C=o(n,j),[L,_]=l.useState(f??[]),P=u??L,[I,V]=l.useState(()=>new Set),[B,F]=l.useState(()=>new Set),[R,W]=l.useState(""),[q,D]=l.useState(""),E=l.useMemo(()=>new Set(P),[P]),G=l.useMemo(()=>i.filter(e=>!E.has(e.value)),[i,E]),H=l.useMemo(()=>i.filter(e=>E.has(e.value)),[i,E]),J=(e,a)=>{V(l=>{const t=new Set(l);return a?t.add(e):t.delete(e),t})},K=(e,a)=>{V(l=>{const t=new Set(l);for(const l of e)l.disabled||(a?t.add(l.value):t.delete(l.value));return t})},O=(e,a)=>{const l=e.filter(e=>!e.disabled&&I.has(e.value));if(0===l.length)return;const t=new Set(l.map(e=>e.value)),s=new Set(i.map(e=>e.value)),r=P.filter(e=>!s.has(e)),n=a?[...i.filter(e=>E.has(e.value)||t.has(e.value)).map(e=>e.value),...r]:P.filter(e=>!t.has(e));V(e=>new Set([...e].filter(e=>!t.has(e)))),F(t),(e=>{void 0===u&&_(e),b?.(e)})(n)},Q=l.useMemo(()=>function(e){const a=new Map;for(const l of e)"string"==typeof l.label&&a.set(l.value,d(l.label));return a}(i),[i]),U=l.useMemo(()=>S(G,R,Q),[G,R,Q]),X=l.useMemo(()=>S(H,q,Q),[H,q,Q]),Y=U.some(e=>!e.disabled&&I.has(e.value)),Z=X.some(e=>!e.disabled&&I.has(e.value)),ee=g(k),ae={variant:N,size:z,color:M,density:T};return a("div",{ref:r,className:m("grid w-full items-center gap-3","[grid-template-columns:minmax(0,1fr)_auto_minmax(0,1fr)]",$??""),...A,children:[e(Panel,{title:h(p)?p:C.source,rows:U,arrived:B,ticked:I,onTick:J,onTickAll:e=>K(U,e),search:R,onSearch:W,searchable:y,disabled:w,height:ee,emptyMessage:C.empty,searchLabel:C.search,selectAllLabel:C.selectAll,style:ae}),a("div",{className:"flex flex-col gap-2",children:[e(s,{size:z,color:M,variant:"text"===N?"text":"outline",label:C.toTarget,disabled:w||!Y,onClick:()=>O(U,!0),icon:e("span",{className:"flex rtl:rotate-180",children:e(c,{})})}),e(s,{size:z,color:M,variant:"text"===N?"text":"outline",label:C.toSource,disabled:w||!Z,onClick:()=>O(X,!1),icon:e("span",{className:"flex rotate-180 rtl:rotate-0",children:e(c,{})})})]}),e(Panel,{title:h(v)?v:C.target,rows:X,arrived:B,ticked:I,onTick:J,onTickAll:e=>K(X,e),search:q,onSearch:D,searchable:y,disabled:w,height:ee,emptyMessage:C.empty,searchLabel:C.search,selectAllLabel:C.selectAll,style:ae})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{TreeItem as n,TreeView as r}from"../tree-view/TreeView.js";import{PickerShell as t}from"../../internal/picker.js";import{searchHaystack as o,searchText as i}from"../../internal/search.js";import{actionMessages as s,commandMessages as c,comboboxMessages as d,useMessages as u}from"../../internal/i18n.js";import{useStyleDefaults as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{TreeItem as n,TreeView as r}from"../tree-view/TreeView.js";import{PickerShell as t}from"../../internal/picker.js";import{searchHaystack as o,searchText as i}from"../../internal/search.js";import{actionMessages as s,commandMessages as c,comboboxMessages as d,useMessages as u}from"../../internal/i18n.js";import{useStyleDefaults as p}from"../../internal/defaults.js";function h(e,l=new Map){for(const a of e)l.set(a.value,a),a.children&&h(a.children,l);return l}function m(e,l=new Map){for(const a of e)l.set(a,o([a.searchLabel??("string"==typeof a.label?a.label:String(a.value))])),a.children&&m(a.children,l);return l}function f(e,l,a){if(""===l)return e;const n=[];for(const r of e){const e=r.children?f(r.children,l,a):void 0,t=(a.get(r)??"").includes(l);(t||e&&e.length>0)&&n.push({...r,children:t?r.children:e})}return n}function g(e,l=[]){for(const a of e)a.children&&a.children.length>0&&(l.push(a.value),g(a.children,l));return l}export const TreeSelect=/*@__PURE__*/a.forwardRef(function TreeSelect(o,b){const{items:v=[],value:x,defaultValue:y,onValueChange:S,multiple:w=!1,selectableBranches:C=!1,defaultExpanded:j,expanded:N,onExpandedChange:M,open:O,defaultOpen:z,onOpenChange:T,placeholder:V,clearable:E=!1,clearLabel:L,closeOnSelect:k,searchable:A=!1,searchPlaceholder:I,locale:R,format:B,name:P,size:$="md",color:q="primary",readOnly:D=!1,disabled:F=!1,classNames:G,...H}=p(o,["size","locale"]),J=u(d,R),K=u(c,R),Q=u(s,R),U=e=>null==e?[]:Array.isArray(e)?e:[e],[W,X]=a.useState(()=>U(y)),Y=void 0!==x?U(x):W,[Z,_]=a.useState(z??!1),ee=O??Z,[le,ae]=a.useState(""),ne=a.useMemo(()=>h(v),[v]),re=a.useMemo(()=>m(v),[v]),te=i(le),oe=a.useMemo(()=>f(v,te,re),[v,te,re]),ie=a.useMemo(()=>""===te?void 0:g(oe),[te,oe]),[se,ce]=a.useState(()=>j??[]),de=ie??N??se,ue=e=>{e&&(D||F)||(void 0===O&&_(e),e||ae(""),T?.(e))},pe=e=>{void 0===x&&X(e),S?.(e)},he=e=>e.selectable??(!(e.children&&e.children.length>0)||C),me=Y.map(e=>ne.get(e)).filter(e=>void 0!==e),fe=0===me.length?V??"":B?B(me):me.map(e=>e.label).reduce((e,l,a)=>0===a?[l]:[...e,", ",l],[]),ge=l=>l.map(l=>e(n,{value:l.value,label:l.label,startIcon:l.startIcon,disabled:l.disabled,selectable:he(l),className:G?.item,children:l.children?ge(l.children):null},l.value));return e(t,{...H,size:$,color:q,readOnly:D,disabled:F,triggerRef:b,display:fe,empty:0===me.length,clearable:E,onClear:()=>pe([]),open:ee,onOpenChange:ue,clearLabel:L??Q.clear,popupClassName:G?.popup,hiddenValues:P?Y.map(e=>({name:P,value:String(e)})):void 0,children:l("div",{className:"flex max-h-80 w-64 flex-col gap-2 overflow-hidden",children:[A?e("input",{type:"text",value:le,placeholder:I??K.search,"aria-label":I??K.search,onChange:e=>ae(e.currentTarget.value),className:"neba-input w-full shrink-0 bg-transparent px-1 py-1 [font:inherit] text-(--neba-fg) [outline:none] placeholder:text-(--neba-muted-fg)"}):null,e("div",{className:"min-h-0 flex-1 overflow-auto",children:0===oe.length?e("p",{className:`px-1 py-2 text-(--neba-muted-fg) ${G?.empty??""}`,children:J.empty}):e(r,{size:$,color:q,multiple:w,selected:Y,onSelectedChange:e=>{const l=e.filter(e=>{const l=ne.get(e);return void 0!==l&&he(l)&&!l.disabled});pe(w?l:l.slice(-1)),(k??!w)&&ue(!1)},expanded:de,onExpandedChange:ie?()=>{}:e=>{void 0===N&&ce(e),M?.(e)},className:G?.tree,children:ge(oe)})})]})})});
|
|
@@ -85,6 +85,12 @@ export interface TreeItemProps extends Omit<React.ComponentPropsWithoutRef<'li'>
|
|
|
85
85
|
expandable?: boolean;
|
|
86
86
|
/** Unavailable. Its branch, if it is open, keeps working. */
|
|
87
87
|
disabled?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether pressing the row chooses it. A row that cannot be chosen still
|
|
90
|
+
* opens and shuts — the folder in a tree whose answers are the files.
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
selectable?: boolean;
|
|
88
94
|
/** The rows underneath this one. */
|
|
89
95
|
children?: React.ReactNode;
|
|
90
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as t,jsxs as
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{safeHref as a}from"../../internal/link.js";import{ChevronIcon as l}from"../../internal/icons.js";import{controlTextClasses as s,cx as o,gapClasses as i,hasContent as d,iconClasses as c,radiusClasses as u,surfaceClasses as m,surfaceSlots as f,transitionClasses as p}from"../../internal/styles.js";import{useStyleDefaults as g}from"../../internal/defaults.js";const x=/*@__PURE__*/r.createContext({size:"md",density:"default",disabled:!1,multiple:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),b=/*@__PURE__*/r.createContext(!1),v={solid:[m,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[m,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},h={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.75rem"},w={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},y={default:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-3.5"},compact:{xs:"px-1",sm:"px-1",md:"px-1.5",lg:"px-2",xl:"px-2.5"}},k={xs:"rounded-[0.3125rem]",sm:"rounded-[0.375rem]",md:"rounded-[0.5rem]",lg:"rounded-[0.625rem]",xl:"rounded-[0.75rem]"},C={none:"",simple:"neba-tree-simple",folder:"neba-tree-folder"};function S(e){return Array.from(e.querySelectorAll('[role="treeitem"]')).filter(e=>null===e.closest("[data-closing]"))}const E=e=>String(e);export const TreeView=/*@__PURE__*/r.forwardRef(function TreeView(t,n){const{variant:a="outline",size:l="md",color:s="primary",density:i="default",elevation:d=0,lines:c="simple",expanded:m,defaultExpanded:b,onExpandedChange:y,selected:k,defaultSelected:N,onSelectedChange:A,multiple:j=!1,disabled:K=!1,label:V,className:D,style:R,children:I,onKeyDown:P,...T}=g(t,["size","density","variant"]),[_,z]=r.useState(b??[]),[F,M]=r.useState(N??[]),[q,L]=r.useState(null),H=m??_,O=k??F,U=r.useRef(null),B=r.useCallback(e=>{U.current=e,"function"==typeof n?n(e):n&&(n.current=e)},[n]),G=r.useRef({expandedValues:H,selectedValues:O,controlledExpanded:void 0!==m,controlledSelected:void 0!==k,multiple:j,onExpandedChange:y,onSelectedChange:A});G.current={expandedValues:H,selectedValues:O,controlledExpanded:void 0!==m,controlledSelected:void 0!==k,multiple:j,onExpandedChange:y,onSelectedChange:A};const J=r.useCallback(e=>{const{expandedValues:t,controlledExpanded:n,onExpandedChange:r}=G.current,a=E(e),l=t.some(e=>E(e)===a)?t.filter(e=>E(e)!==a):[...t,e];n||z(l),r?.(l)},[]),Q=r.useCallback(e=>{const{selectedValues:t,controlledSelected:n,multiple:r,onSelectedChange:a}=G.current,l=E(e),s=t.some(e=>E(e)===l),o=r?s?t.filter(e=>E(e)!==l):[...t,e]:[e];n||M(o),a?.(o)},[]),W=r.useRef(new Map),X=r.useCallback((e,t)=>(W.current.set(e,t),()=>{W.current.delete(e)}),[]),Y=r.useMemo(()=>H.map(E).join("\0"),[H]),Z=r.useMemo(()=>O.map(E).join("\0"),[O]),$=r.useMemo(()=>({size:l,density:i,disabled:K,multiple:j,expandedKeys:new Set(H.map(E)),selectedKeys:new Set(O.map(E)),activeKey:q,toggle:J,select:Q,activate:L,register:X}),[l,i,K,j,Y,Z,q,J,Q,X]);r.useEffect(()=>{if(null!==q&&W.current.has(q))return;const e=U.current;if(!e)return;const t=S(e);if(0===t.length)return;const n=t.find(e=>"true"===e.getAttribute("aria-selected"))??t[0];L(n.dataset.nebaValue??null)});const ee=o("flex list-none flex-col p-1",u[l],v[a],p,C[c],D);return e(x.Provider,{value:$,children:e("ul",{ref:B,role:"tree","aria-label":V,"aria-multiselectable":j||void 0,className:ee,style:{...f(s,d),"--n-tree-indent":h[l],"--n-tree-row":w[l],...R},onKeyDown:function(e){if(P?.(e),e.defaultPrevented)return;const t=U.current,n=e.target?.closest?.('[role="treeitem"]');if(!t||!n||!t.contains(n))return;if(e.target!==n)return;const r=S(t),a=r.indexOf(n);if(-1===a)return;const l=t=>{t&&(e.preventDefault(),L(t.dataset.nebaValue??null),t.focus())},s=e=>{const t=e.dataset.nebaValue;t&&W.current.get(t)?.toggle()},o="rtl"===getComputedStyle(t).direction,i=o?"ArrowLeft":"ArrowRight",d=o?"ArrowRight":"ArrowLeft",c=n.getAttribute("aria-expanded");switch(e.key){case"ArrowDown":l(r[a+1]);break;case"ArrowUp":l(r[a-1]);break;case"Home":l(r[0]);break;case"End":l(r[r.length-1]);break;case i:"false"===c?(e.preventDefault(),s(n)):"true"===c&&l(r[a+1]);break;case d:"true"===c?(e.preventDefault(),s(n)):l(n.parentElement?.closest('[role="treeitem"]'));break;case"Enter":case" ":e.preventDefault();(("Enter"===e.key?n.querySelector(":scope > div > a[href]"):null)??n).click();break}},...T,children:I})})});export const TreeItem=/*@__PURE__*/r.forwardRef(function TreeItem({value:u,label:m,startIcon:f,endIcon:g,action:v,href:h,expandable:w,disabled:C=!1,selectable:S=!0,className:N,children:A,onClick:j,...K},V){const{size:D,density:R,disabled:I,expandedKeys:P,selectedKeys:T,activeKey:_,toggle:z,select:F,activate:M,register:q,multiple:L}=r.useContext(x),H=r.useId(),O=u??H,U=E(O),B=r.useRef(null),G=r.useCallback(e=>{B.current=e,"function"==typeof V?V(e):V&&(V.current=e)},[V]),J=r.Children.toArray(A),Q=w??J.length>0,W=Q&&P.has(U),X=T.has(U),Y=C||I,Z=r.useRef({toggle:()=>{}});Z.current.toggle=()=>{!Y&&Q&&z(O)};const $=r.useContext(b);r.useEffect(()=>$?void 0:q(U,Z.current),[$,U,q]);const[ee,te]=r.useState(W),[ne,re]=r.useState(W),ae=r.useRef(null);r.useEffect(()=>{if(W){te(!0);const e=requestAnimationFrame(()=>re(!0));return()=>cancelAnimationFrame(e)}re(!1);const e=ae.current;(null===e||getComputedStyle(e).transitionDuration.split(",").every(e=>0===parseFloat(e)))&&te(!1)},[W]);const le=o("flex min-w-0 flex-1 cursor-pointer items-center text-start","h-(--n-tree-row)",y[R][D],k[D],i[D],s[D],p,c,"group-focus-visible/tree-item:[outline:2px_solid_var(--n-ring)]","group-focus-visible/tree-item:outline-offset-[-2px]",Y?"cursor-not-allowed text-(--neba-disabled-fg)":X?"bg-(--n-soft-press) font-medium text-(--n-on-tint) hover:bg-(--n-soft-press)":"hover:bg-(--n-soft)"),se=n(t,{children:[e("span",{"aria-hidden":"true",onClick:e=>{!Y&&Q&&(e.stopPropagation(),e.preventDefault(),B.current?.focus(),M(U),z(O))},className:o("flex h-[1lh] w-[1.15em] shrink-0 items-center justify-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",Q?"text-(--neba-muted-fg)":"",W?"rotate-0":"-rotate-90 rtl:rotate-90"),children:Q?e(l,{}):null}),d(f)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:f}):null,e("span",{className:"min-w-0 flex-1 truncate",children:m}),d(g)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:g}):null]});return n("li",{ref:G,role:"treeitem","aria-expanded":Q?W:void 0,"aria-selected":!!X||(!L||!S)&&void 0,"aria-disabled":Y||void 0,"data-neba-value":U,tabIndex:_===U?0:-1,className:o("group/tree-item relative block [outline:none]",N),onClick:function(e){e.stopPropagation(),Y?e.preventDefault():(B.current?.focus(),M(U),j?.(e),e.defaultPrevented||(Q&&z(O),S&&F(O)))},...K,children:[n("div",{className:"flex w-full items-center",children:[void 0===a(h)||Y?e("div",{className:le,children:se}):e("a",{href:a(h),tabIndex:-1,className:le,"aria-current":X?"page":void 0,children:se}),d(v)?e("span",{className:o("flex shrink-0 items-center",y[R][D]),onClick:e=>e.stopPropagation(),children:v}):null]}),Q&&ee&&J.length>0?e("div",{ref:ae,"data-closing":W?void 0:"",className:o("grid [transition:grid-template-rows_var(--neba-duration)_var(--neba-ease)]",ne?"[grid-template-rows:1fr]":"[grid-template-rows:0fr] pointer-events-none"),onTransitionEnd:e=>{e.target!==e.currentTarget||"grid-template-rows"!==e.propertyName||W||te(!1)},children:e("ul",{role:"group",className:"min-h-0 list-none overflow-hidden ps-(--n-tree-indent)",children:e(b.Provider,{value:$||!W,children:A})})}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as a}from"@base-ui/react/use-render";import{transitionProps as t}from"../../internal/animate.js";import{clampClasses as r,clampSlot as n,cx as p}from"../../internal/styles.js";const o={h1:"[&.neba-typography]:text-[1.875rem]/[1.2] [&.neba-typography]:tracking-[-0.02em]",h2:"[&.neba-typography]:text-[1.5rem]/[1.25] [&.neba-typography]:tracking-[-0.015em]",h3:"[&.neba-typography]:text-[1.25rem]/[1.3] [&.neba-typography]:tracking-[-0.01em]",h4:"[&.neba-typography]:text-[1.0625rem]/[1.41176] [&.neba-typography]:tracking-normal",h5:"[&.neba-typography]:text-[0.9375rem]/[1.46667] [&.neba-typography]:tracking-normal",h6:"[&.neba-typography]:text-[0.8125rem]/[1.53846] [&.neba-typography]:tracking-normal",lead:"[&.neba-typography]:text-[1.0625rem]/[1.64706] [&.neba-typography]:tracking-normal",body:"[&.neba-typography]:text-[0.8125rem]/[1.69231] [&.neba-typography]:tracking-normal",caption:"[&.neba-typography]:text-[0.75rem]/[1.5] [&.neba-typography]:tracking-normal",overline:"[&.neba-typography]:text-[0.6875rem]/[1.45455] [&.neba-typography]:tracking-[0.08em] uppercase"},y={h1:"semibold",h2:"semibold",h3:"semibold",h4:"semibold",h5:"semibold",h6:"semibold",lead:"regular",body:"regular",caption:"regular",overline:"medium"},h={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",lead:"p",body:"p",caption:"span",overline:"span"},b=new Set(["caption","overline"]),m={h1:"[&.neba-typography]:mb-4",h2:"[&.neba-typography]:mb-3.5",h3:"[&.neba-typography]:mb-3",h4:"[&.neba-typography]:mb-2.5",h5:"[&.neba-typography]:mb-2",h6:"[&.neba-typography]:mb-2",lead:"[&.neba-typography]:mb-4",body:"[&.neba-typography]:mb-3",caption:"[&.neba-typography]:mb-2",overline:"[&.neba-typography]:mb-2"},g={regular:"[&.neba-typography]:font-normal",medium:"[&.neba-typography]:font-medium",semibold:"[&.neba-typography]:font-semibold",bold:"[&.neba-typography]:font-bold"},i={start:"text-start",center:"text-center",end:"text-end",justify:"text-justify"};export const Typography=/*@__PURE__*/e.forwardRef(function Typography({level:l="body",color:s,weight:c,align:d,lines:u,gutter:x=!1,transition:f,render:k,className:v,style:j,children:w,...N},T){const E=t(f),R=p("neba-typography",o[l],g[c??y[l]],d?i[d]:"","span"===h[l]&&(d||x)?"block":"",u?r(u):"",x?m[l]:"[&.neba-typography]:my-0",s?"[&.neba-typography]:text-(--n-accent)":b.has(l)?"[&.neba-typography]:text-(--neba-muted-fg)":"",E.className,v??"");return a({render:k??e.createElement(h[l]),ref:T,props:{className:R,style:s?{"--n-accent":`var(--neba-${s}-accent)`,...n(u),...E.style,...j}:{...n(u),...E.style,...j},children:w,...N}})});
|
|
@@ -22,13 +22,15 @@ export interface VisuallyHiddenProps extends React.ComponentPropsWithoutRef<'spa
|
|
|
22
22
|
* screen reader instead of a picture. This is the same 1px clipped box, offered
|
|
23
23
|
* so an application's own markup can say the same things.
|
|
24
24
|
*
|
|
25
|
-
* The form matters and there is only one that works. `hidden
|
|
26
|
-
* `display: none` take the text off the accessibility
|
|
27
|
-
* screen, which is the opposite of the job. `opacity: 0`
|
|
28
|
-
* ghost the size of the words, and a pointer finds it.
|
|
29
|
-
* makes a box that wide and a horizontal scrollbar with
|
|
30
|
-
*
|
|
31
|
-
*
|
|
25
|
+
* The form matters and there is only one that works. `hidden`,
|
|
26
|
+
* `display: none` and `visibility: hidden` take the text off the accessibility
|
|
27
|
+
* tree along with the screen, which is the opposite of the job. `opacity: 0`
|
|
28
|
+
* leaves a clickable ghost the size of the words, and a pointer finds it.
|
|
29
|
+
* `text-indent: -9999px` makes a box that wide and a horizontal scrollbar with
|
|
30
|
+
* it, and `font-size: 0` is announced by some screen readers as nothing at all.
|
|
31
|
+
* A 1px box with its contents clipped is invisible to a sighted reader and
|
|
32
|
+
* present to every other kind, and it is what every serious implementation
|
|
33
|
+
* converged on.
|
|
32
34
|
*
|
|
33
35
|
* There is no `aria-hidden` here, deliberately: that is the *other* half of the
|
|
34
36
|
* pair — visible and not announced — and it is an attribute rather than a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r}from"react/jsx-runtime";import*as e from"react";import{useRender as s}from"@base-ui/react/use-render";import{cx as
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import*as e from"react";import{useRender as s}from"@base-ui/react/use-render";import{cx as i,srOnlyClasses as a}from"../../internal/styles.js";export const VisuallyHidden=/*@__PURE__*/e.forwardRef(function VisuallyHidden({visible:e=!1,render:t,className:n,...o},m){return s({render:t??r("span",{}),ref:m,props:{...o,className:i(e?void 0:a,n)}})});
|
|
@@ -74,7 +74,7 @@ export interface WindowPaneProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
74
74
|
*
|
|
75
75
|
* What being in front looks like is the system's: coloured traffic lights on
|
|
76
76
|
* macOS against grey ones, an accent title bar and an accent border on
|
|
77
|
-
* Windows 10, a tinted header bar on GNOME — and, on
|
|
77
|
+
* Windows 10, a tinted header bar on GNOME — and, on every one of them, a window one
|
|
78
78
|
* step further off the page than the ones behind it.
|
|
79
79
|
*/
|
|
80
80
|
active?: boolean;
|
|
@@ -155,7 +155,7 @@ export interface WindowPaneProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
155
155
|
children?: React.ReactNode;
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
* A window, drawn the way one of
|
|
158
|
+
* A window, drawn the way one of eight systems draws it, with anything at all
|
|
159
159
|
* inside it.
|
|
160
160
|
*
|
|
161
161
|
* It is not a real window and does not pretend to be one: there is no desktop,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRender as o}from"@base-ui/react/use-render";import{beginPointerDrag as r}from"../../internal/drag.js";import{actionMessages as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRender as o}from"@base-ui/react/use-render";import{beginPointerDrag as r}from"../../internal/drag.js";import{actionMessages as s,useMessages as a,windowMessages as l}from"../../internal/i18n.js";import{cx as d,hasContent as c,iconClasses as u,surfaceClasses as h}from"../../internal/styles.js";import{WindowControls as m,orderControls as f,windowChrome as g,windowMetrics as w,windowSlots as p}from"../../internal/window.js";import{inertValue as b}from"../../internal/inert.js";import{useStyleDefaults as x}from"../../internal/defaults.js";function v(e,t,n){const[o,r]=i.useState(t),s=void 0!==e;return[s?e:o,i.useCallback(e=>{s||r(e),n?.(e)},[s,n])]}const z=[{edge:"n",className:"inset-x-3 top-0 h-1.5 cursor-ns-resize"},{edge:"s",className:"inset-x-3 bottom-0 h-1.5 cursor-ns-resize"},{edge:"w",className:"inset-y-3 left-0 w-1.5 cursor-ew-resize"},{edge:"e",className:"inset-y-3 right-0 w-1.5 cursor-ew-resize"},{edge:"nw",className:"top-0 left-0 size-3 cursor-nwse-resize"},{edge:"ne",className:"top-0 right-0 size-3 cursor-nesw-resize"},{edge:"sw",className:"bottom-0 left-0 size-3 cursor-nesw-resize"},{edge:"se",className:"right-0 bottom-0 size-3 cursor-nwse-resize"}],y=[];export const WindowPane=/*@__PURE__*/i.forwardRef(function WindowPane(M,E){const{os:N="macos",title:H,icon:S,actions:C,controls:k=!0,size:L="md",color:W="primary",accent:j=!1,transparency:I=0,active:P,elevation:D=2,position:T="static",draggable:R=!1,resizable:A=!1,width:O,height:B,minWidth:X=180,minHeight:$,offset:F,defaultOffset:Y,onOffsetChange:_,onResize:q,open:K,defaultOpen:U=!0,onOpenChange:G,minimized:J,defaultMinimized:Q=!1,onMinimizedChange:V,maximized:Z,defaultMaximized:ee=!1,onMaximizedChange:te,scroll:ne=!0,locale:ie,minimizeLabel:oe,maximizeLabel:re,restoreLabel:se,closeLabel:ae,resizeLabel:le,render:de,className:ce,style:ue,children:he,...me}=x(M,["size","locale"]),fe=a(l,ie),ge=i.useId(),we=a(s,ie),pe=g(N),be=w(N,L),xe=i.useId(),[ve,ze]=v(K,U,G),[ye,Me]=v(J,Q,V),[Ee,Ne]=v(Z,ee,te),[He,Se]=v(F,Y??{x:0,y:0},_),[Ce,ke]=i.useState(null),[Le,We]=i.useState({width:O,height:B});Le.width===O&&Le.height===B||(We({width:O,height:B}),ke(null));const[je,Ie]=i.useState(!0),Pe=P??je,[De,Te]=i.useState(null),[Re,Ae]=i.useState(null),[Oe,Be]=i.useState(!1),[Xe,$e]=i.useState(!1),[Fe,Ye]=i.useState(ve);Fe!==ve&&(Ye(ve),$e(!ve)),i.useEffect(()=>{if(!Xe)return;const e=window.setTimeout(()=>$e(!1),260);return()=>window.clearTimeout(e)},[Xe]);const _e=i.useRef(null),qe=i.useCallback(e=>{_e.current=e,"function"==typeof E?E(e):E&&(E.current=e)},[E]);i.useEffect(()=>{if(void 0!==P||!ve)return;const e=_e.current;if(!e)return;const t=e=>Ie(e);y.push(t);const n=n=>{const i=n.target;if(!(i instanceof Node))return;if(e.contains(i))return y.splice(y.indexOf(t),1),y.push(t),void Ie(!0);const o=i instanceof Element?i:i.parentElement;o?.closest(".neba-window")&&Ie(!1)};return document.addEventListener("pointerdown",n,!0),document.addEventListener("focusin",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("focusin",n,!0);const e=y.indexOf(t),i=e===y.length-1;y.splice(e,1),i&&y[y.length-1]?.(!0)}},[P,ve]);const Ke=i.useRef(null);function Ue(e,t){if(0!==e.button)return;Ke.current?.();const n=e.currentTarget,i=e.clientX,o=e.clientY,s=_e.current,a=s?.getBoundingClientRect(),l=s&&a&&s.offsetWidth>0&&a.width/s.offsetWidth||1,d=s&&a&&s.offsetHeight>0&&a.height/s.offsetHeight||1;Be(!0);const c=()=>{Ke.current=null,Be(!1)},u=r({target:n,pointerId:e.pointerId,onMove:e=>t((e.clientX-i)/l,(e.clientY-o)/d),onEnd:c});Ke.current=()=>{u(),c()}}i.useEffect(()=>()=>Ke.current?.(),[]);const Ge={width:Math.max(0,X),height:Math.max(be.bar,$??be.bar)};function Je(e){ke(e),q?.(e)}const Qe=f(N,!0===k?["minimize","maximize","close"]:!1===k?[]:k),Ve=Qe.includes("maximize");i.useLayoutEffect(()=>{if(!ye||null!==De)return;const e=_e.current,t=e?.firstElementChild;e&&t instanceof HTMLElement&&Te(t.offsetHeight+(e.offsetHeight-e.clientHeight))},[ye,De]),i.useEffect(()=>{if(ye||null===Re)return;const e=window.setTimeout(()=>Ae(null),400);return()=>window.clearTimeout(e)},[ye,Re]);const Ze={minimize:oe??fe.minimize,maximize:re??fe.maximize,restore:se??fe.restore,close:ae??we.close},et=e(m,{os:N,metrics:be,controls:Qe,maximized:Ee,active:Pe,labels:Ze,onCommand:function(e){"close"===e?ze(!1):"minimize"===e?function(e){const t=_e.current,n=t?.firstElementChild;if(t&&n instanceof HTMLElement&&Te(n.offsetHeight+(t.offsetHeight-t.clientHeight)),e&&void 0===(Ce?.height??B)&&t)return Ae(t.offsetHeight),void requestAnimationFrame(()=>Me(!0));Me(e)}(!ye):Ne(!Ee)}}),tt=c(H)?e("span",{id:xe,className:"min-w-0 truncate",children:H}):null,nt=c(S)?e("span",{className:"flex shrink-0 items-center",children:S}):null,it=t("div",{className:d("relative flex shrink-0 items-center select-none",u,R&&!Ee?"cursor-grab touch-none active:cursor-grabbing":""),style:{height:be.bar,textShadow:"var(--n-window-bar-shadow)",fontWeight:be.weight,paddingInlineStart:be.padX,paddingInlineEnd:be.padEnd,gap:Math.round(.7*be.title),fontSize:be.title,backgroundColor:"var(--n-window-bar)",backgroundImage:"var(--n-window-bar-image)",color:"var(--n-window-bar-fg)",borderBlockEnd:pe.rule?"1px solid var(--n-window-line)":void 0},onPointerDown:function(e){if(!R||Ee)return;const t={...He},n=_e.current,i="fixed"===T?{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}:"absolute"===T&&n?.offsetParent instanceof HTMLElement?{width:n.offsetParent.clientWidth,height:n.offsetParent.clientHeight}:null,o=n?.offsetWidth??0,r=Math.min(o,48);Ue(e,(e,n)=>{const s=t.x+e,a=t.y+n;Se(i?{x:Math.min(Math.max(s,r-o),i.width-r),y:Math.min(Math.max(a,0),Math.max(0,i.height-be.bar))}:{x:s,y:a})})},onDoubleClick:Ve?()=>Ne(!Ee):void 0,children:["start"===pe.controlsSide?et:null,"center"===pe.titleAlign?e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 flex items-center justify-center",style:{paddingInline:be.controlsWidth(Qe.length)+2*be.padX},children:t("span",{className:"flex min-w-0 items-center",style:{gap:Math.round(.5*be.title)},children:[nt,tt]})}):t(n,{children:[nt,tt]}),e("span",{className:"flex-1"}),c(C)?e("span",{className:"flex shrink-0 items-center",style:{gap:Math.round(.5*be.title)},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:C}):null,"end"===pe.controlsSide?et:null]}),ot=Ee?{left:0,top:0,width:"100%",height:"100%"}:{left:He.x,top:He.y,width:Ce?.width??O,height:ye?De??be.bar:Ce?.height??B??Re??void 0},rt=o({render:de,ref:qe,props:{role:"group","aria-labelledby":tt?xe:void 0,className:d("neba-window relative flex min-w-0 flex-col overflow-hidden",I>0?h:"",pe.glass&&0===I?"[backdrop-filter:var(--neba-blur)]":"","[transition-property:left,top,width,height,opacity,box-shadow,background-color,border-color,border-radius]","[transition-duration:var(--neba-duration-window)]","[transition-timing-function:var(--neba-ease)]","motion-reduce:[transition-duration:0ms]","data-[gesture]:[transition-property:none]",ce),"data-gesture":Oe?"":void 0,inert:b(!ve),style:{opacity:ve?void 0:0,...p({os:N,color:W,accent:j,transparency:I,active:Pe,elevation:D}),position:"static"===T?"relative":T,...ot,borderRadius:Ee?0:`${be.radius}px ${be.radius}px ${be.radiusBottom}px ${be.radiusBottom}px`,borderStyle:"solid",borderWidth:be.frame,borderColor:"var(--n-window-line)",backgroundColor:"var(--n-window-band)",boxShadow:"var(--n-window-shadow), var(--neba-plate-glass)",...ue},children:t(n,{children:[it,e("div",{className:d("min-h-0 flex-1",ne?"overflow-auto":"overflow-hidden"),style:{backgroundColor:"var(--n-window-body)",marginInline:be.band.side,marginBottom:be.band.bottom,boxShadow:be.band.side>0?"inset 0 0 0 1px rgb(0 0 0 / 0.12)":void 0},inert:b(ye),children:he}),!A||Ee||ye?null:e("span",{id:ge,hidden:!0,children:fe.resizeHint}),!A||Ee||ye?null:z.map(t=>{const n="se"===t.edge;return e("div",{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?le??fe.resize:void 0,"aria-describedby":n?ge:void 0,"aria-hidden":n?void 0:"true",className:d("absolute z-10 touch-none",t.className,n?"neba-hit":"",n?"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]":""),onPointerDown:e=>function(e,t){const n=_e.current;if(!n||Ee)return;const i={width:n.offsetWidth,height:n.offsetHeight,x:He.x,y:He.y},o=e.includes("e"),r=e.includes("w"),s=e.includes("n"),a=e.includes("s");Ue(t,(e,t)=>{let{width:n,height:l}=i,{x:d,y:c}=i;o&&(n=Math.max(Ge.width,i.width+e)),a&&(l=Math.max(Ge.height,i.height+t)),r&&(n=Math.max(Ge.width,i.width-e),d=i.x+(i.width-n)),s&&(l=Math.max(Ge.height,i.height-t),c=i.y+(i.height-l)),Je({width:n,height:l}),(r||s)&&Se({x:d,y:c})})}(t.edge,e),onKeyDown:n?e=>{const t={ArrowRight:[16,0],ArrowLeft:[-16,0],ArrowDown:[0,16],ArrowUp:[0,-16]}[e.key];t&&(e.preventDefault(),function(e,t){const n=_e.current;n&&Je({width:Math.max(Ge.width,n.offsetWidth+e),height:Math.max(Ge.height,n.offsetHeight+t)})}(t[0],t[1]))}:void 0},t.edge)})]}),...me}});return ve||Xe?rt:null});
|
|
@@ -15,7 +15,9 @@ export interface ElementSize {
|
|
|
15
15
|
* The ref goes on the element to watch. It measures once as soon as that
|
|
16
16
|
* element is there rather than waiting to be told, because a `ResizeObserver`
|
|
17
17
|
* that is missing — an old browser, a server — never says anything at all, and
|
|
18
|
-
* a component sized `0 × 0` forever is worse than one measured once.
|
|
18
|
+
* a component sized `0 × 0` forever is worse than one measured once. An element
|
|
19
|
+
* put on the ref after the first render, behind a loading state for instance, is
|
|
20
|
+
* measured when it arrives.
|
|
19
21
|
*/
|
|
20
22
|
export declare function useElementSize<E extends Element = HTMLElement>(): [
|
|
21
23
|
React.RefObject<E | null>,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as t from"react";import{observeResize as
|
|
1
|
+
"use client";import*as t from"react";import{attachedRef as e,observeResize as i}from"../internal/observe.js";export function useElementSize(){const[n,h]=t.useState(null),[r]=t.useState(()=>e(h)),[u,o]=t.useState({width:0,height:0});return t.useLayoutEffect(()=>{if(!n)return;const t=()=>{const t=n.getBoundingClientRect();o(e=>e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})};return t(),i(n,t)},[n]),[r,u]}
|
|
@@ -20,5 +20,8 @@ export interface OnScreenOptions {
|
|
|
20
20
|
* It answers `true` where there is no `IntersectionObserver` rather than
|
|
21
21
|
* `false`, and that is the load-bearing part: a caller cannot know without one,
|
|
22
22
|
* and the right fallback is to show the thing rather than to hide it forever.
|
|
23
|
+
*
|
|
24
|
+
* An element put on the ref after the first render, behind a loading state for
|
|
25
|
+
* instance, is watched from when it arrives.
|
|
23
26
|
*/
|
|
24
27
|
export declare function useOnScreen<E extends Element = HTMLElement>(options?: OnScreenOptions): [React.RefObject<E | null>, boolean];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{observeVisibility as r}from"../internal/observe.js";export function useOnScreen(
|
|
1
|
+
"use client";import*as e from"react";import{attachedRef as t,observeVisibility as r}from"../internal/observe.js";export function useOnScreen(n={}){const{threshold:s=0,once:o=!0}=n,[u,c]=e.useState(null),[f]=e.useState(()=>t(c)),[i,a]=e.useState(!1);return e.useEffect(()=>{if(!u)return;const e=r(u,s,t=>{a(t),t&&o&&e?.()});if(e)return e;a(!0)},[u,s,o]),[f,i]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './hooks/index.js';
|
|
3
3
|
export * from './components/accordion/index.js';
|
|
4
|
+
export * from './components/agent-steps/index.js';
|
|
4
5
|
export * from './components/alert/index.js';
|
|
5
6
|
export * from './components/anchor/index.js';
|
|
6
7
|
export * from './components/animate-appear/index.js';
|
|
7
8
|
export * from './components/app-logo/index.js';
|
|
9
|
+
export * from './components/approval/index.js';
|
|
8
10
|
export * from './components/animate-blink/index.js';
|
|
9
11
|
export * from './components/animate-counter/index.js';
|
|
10
12
|
export * from './components/animate-fade/index.js';
|
|
@@ -45,6 +47,7 @@ export * from './components/combobox/index.js';
|
|
|
45
47
|
export * from './components/command-palette/index.js';
|
|
46
48
|
export * from './components/confirm/index.js';
|
|
47
49
|
export * from './components/container/index.js';
|
|
50
|
+
export * from './components/context-window/index.js';
|
|
48
51
|
export * from './components/data-list/index.js';
|
|
49
52
|
export * from './components/data-table/index.js';
|
|
50
53
|
export * from './components/date-picker/index.js';
|
|
@@ -73,6 +76,7 @@ export * from './components/how-to-steps/index.js';
|
|
|
73
76
|
export * from './components/icon/index.js';
|
|
74
77
|
export * from './components/icon-button/index.js';
|
|
75
78
|
export * from './components/image/index.js';
|
|
79
|
+
export * from './components/inline-citation/index.js';
|
|
76
80
|
export * from './components/line-chart/index.js';
|
|
77
81
|
export * from './components/list/index.js';
|
|
78
82
|
export * from './components/menu/index.js';
|
|
@@ -94,8 +98,10 @@ export * from './components/portal/index.js';
|
|
|
94
98
|
export * from './components/progress-box/index.js';
|
|
95
99
|
export * from './components/progress-circular/index.js';
|
|
96
100
|
export * from './components/progress-linear/index.js';
|
|
101
|
+
export * from './components/prompt-input/index.js';
|
|
97
102
|
export * from './components/provider/index.js';
|
|
98
103
|
export * from './components/radio-group/index.js';
|
|
104
|
+
export * from './components/reasoning/index.js';
|
|
99
105
|
export * from './components/rating/index.js';
|
|
100
106
|
export * from './components/scatter-chart/index.js';
|
|
101
107
|
export * from './components/scroll-area/index.js';
|
|
@@ -109,8 +115,10 @@ export * from './components/skeleton/index.js';
|
|
|
109
115
|
export * from './components/slider/index.js';
|
|
110
116
|
export * from './components/sparkline/index.js';
|
|
111
117
|
export * from './components/spoiler/index.js';
|
|
118
|
+
export * from './components/sources/index.js';
|
|
112
119
|
export * from './components/stack/index.js';
|
|
113
120
|
export * from './components/statistic/index.js';
|
|
121
|
+
export * from './components/streaming-text/index.js';
|
|
114
122
|
export * from './components/switch/index.js';
|
|
115
123
|
export * from './components/table/index.js';
|
|
116
124
|
export * from './components/tabs/index.js';
|
|
@@ -123,6 +131,7 @@ export * from './components/toast/index.js';
|
|
|
123
131
|
export * from './components/toggle/index.js';
|
|
124
132
|
export * from './components/toggle-group/index.js';
|
|
125
133
|
export * from './components/toolbar/index.js';
|
|
134
|
+
export * from './components/tool-call/index.js';
|
|
126
135
|
export * from './components/tooltip/index.js';
|
|
127
136
|
export * from './components/tour/index.js';
|
|
128
137
|
export * from './components/transfer/index.js';
|