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
|
@@ -26,6 +26,35 @@ export interface PieChartProps extends ChartBaseProps {
|
|
|
26
26
|
* @default 0
|
|
27
27
|
*/
|
|
28
28
|
startAngle?: number;
|
|
29
|
+
/**
|
|
30
|
+
* How much of the middle is cut out, as a fraction of the radius, from `0`
|
|
31
|
+
* for a filled disc to `0.92` for a hairline ring.
|
|
32
|
+
*
|
|
33
|
+
* `shape` already sets it — `0` for a `pie`, `0.62` for a `donut` and a
|
|
34
|
+
* `semi` — and this is the dial behind that, for the ring that has to be
|
|
35
|
+
* thinner or thicker than the house one. A `pie` given a hole is a donut, so
|
|
36
|
+
* reach for `shape` first and for this only when the default ring is the
|
|
37
|
+
* wrong weight: a thin one reads as a progress track and a thick one as a
|
|
38
|
+
* pie with a hole punched in it.
|
|
39
|
+
*
|
|
40
|
+
* `center` needs a hole to sit in, so setting one is also how a `pie` gets a
|
|
41
|
+
* readout in the middle.
|
|
42
|
+
* @default 0 for `pie`, 0.62 for `donut` and `semi`
|
|
43
|
+
*/
|
|
44
|
+
hole?: number;
|
|
45
|
+
/**
|
|
46
|
+
* The surface showing between two touching slices, in pixels.
|
|
47
|
+
*
|
|
48
|
+
* A constant on screen and not in the data, which is why it is a length: the
|
|
49
|
+
* gap is what separates two slices of the same hue family, and an angle that
|
|
50
|
+
* looked right on a 300px chart is a wedge out of a 60px one. `0` closes it,
|
|
51
|
+
* and the slices then meet at a hairline the eye has to find on its own.
|
|
52
|
+
*
|
|
53
|
+
* It is never taken off a slice too narrow to spare it, so a one-degree
|
|
54
|
+
* sliver stays a sliver rather than inverting.
|
|
55
|
+
* @default 2
|
|
56
|
+
*/
|
|
57
|
+
gap?: number;
|
|
29
58
|
/**
|
|
30
59
|
* What goes in the hole. A `donut` or a `semi` with nothing in the middle is
|
|
31
60
|
* a pie with a bite out of it; the total, or the one figure the chart is
|
|
@@ -50,9 +79,11 @@ export interface PieChartProps extends ChartBaseProps {
|
|
|
50
79
|
* a poor thing to compare — two slices within a few percent of each other are
|
|
51
80
|
* indistinguishable, and a reader cannot rank six of them — so the pie is right
|
|
52
81
|
* for exactly one question: *is one of these most of it?* Anything finer than
|
|
53
|
-
* that, and anything past six slices, is a [BarChart](./bar-chart)
|
|
82
|
+
* that, and anything past six slices, is a [BarChart](./bar-chart); a pie of
|
|
83
|
+
* two slices is a [Statistic](./statistic).
|
|
54
84
|
*
|
|
55
|
-
* A slice's colour follows
|
|
56
|
-
*
|
|
85
|
+
* A slice's colour follows its place in `data`, so a filter that drops one
|
|
86
|
+
* moves every slice after it onto the next colour; a point's own `color`
|
|
87
|
+
* holds it.
|
|
57
88
|
*/
|
|
58
89
|
export declare function PieChart(rawProps: PieChartProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as t from"react";import{ChartDataTable as n,ChartExport as a,ChartLegendBar as i,ChartStatus as r,ChartSummary as o,ChartSurface as s,ChartTooltipPanel as u,markTransitionClasses as d,summarise as m,useMeasuredWidth as c,useReleaseOutside as h,useVisibility as f,chartHeight as v,useMeasuredHeight as p}from"../../internal/chart-frame.js";import{arcPath as x,categoryAt as g,chartFontSizes as b,compactNumber as y,formatCategory as M,inkOn as N,markGap as j,seriesColor as w,toValue as k,warnPaletteOverflow as E}from"../../internal/chart.js";import{numberFormatter as I}from"../../internal/format.js";import{cx as z,metaTextClasses as P}from"../../internal/styles.js";import{chartMessages as A,emptyMessages as $,useMessages as L}from"../../internal/i18n.js";import{useStyleDefaults as S}from"../../internal/defaults.js";const B={pie:0,donut:.62,semi:.62};export function PieChart(C){const{data:R,categories:D,shape:O="pie",startAngle:_=0,hole:F,gap:H=j,center:K,valueLabels:T="none",height:V,format:W,locale:q,label:G,legend:J,tooltip:Q,empty:U,exportable:X=!1,exportFileName:Y="chart.csv",onExport:Z,size:ee="md",variant:le="text",padded:te=!1,className:ne,...ae}=S(C,["size","variant","locale"]),ie=t.useRef(null),re=c(ie),oe=L($,q),se=L(A,q),ue=t.useId(),de=t.useCallback(e=>W?I(q,W).format(e):y(e,q),[W,q]),me=t.useMemo(()=>R.map(k),[R]),ce=t.useMemo(()=>me.map((e,l)=>({name:M(g(l,D,[me]),q),data:[R[l]],color:e.color})),[me,D,R,q]),he=f(ce);t.useEffect(()=>{E(ce.length)},[ce.length]);const[fe,ve]=t.useState(null);h(ie,null!==fe,()=>ve(null));const pe=t.useId(),xe=ce.map((e,l)=>w(e,l)),ge=me.reduce((e,l,t)=>he.visible[t]&&null!==l.value?e+Math.max(0,l.value):e,0),be="semi"===O,ye=p(ie,"string"==typeof V),Me=v(V,ee,ye),Ne=b[ee],je=!1===J?{interactive:!1}:!0===J||void 0===J?{}:J,we=!1!==J&&ce.length>1,ke=je.side??"bottom",Ee=!1===Q?{mode:"none"}:!0===Q||void 0===Q?{}:Q,Ie="none"===Ee.mode,ze=re/2,Pe=Math.max(0,Math.min(re/2,be?Me:Me/2)-2),Ae=be?Math.min(Me,Me/2+Pe/2):Me/2,$e=Pe*Math.min(.92,Math.max(0,F??B[O])),Le=ge<=0||Pe<=0,Se=Pe>0?Math.min(15,Math.max(0,H)/Pe*(180/Math.PI)):0,Be=be?180:360,Ce=[];let Re=be?-90:_;me.forEach((e,l)=>{if(!he.visible[l]||null===e.value||e.value<=0)return;const t=e.value/ge,n=t*Be;Ce.push({index:l,start:Re,end:Re+n,value:e.value,share:t}),Re+=n});const De=null===fe?[]:[{seriesIndex:fe,name:ce[fe]?.name,color:me[fe]?.color??xe[fe],value:me[fe]?.value??null,formatted:`${de(me[fe]?.value??0)} · ${Math.round(10*(Math.max(0,me[fe]?.value??0)/ge*100+Number.EPSILON))/10}%`,label:me[fe]?.label}];return l(s,{...ae,size:ee,variant:le,padded:te,className:ne,legendSide:ke,legend:we?e(i,{series:ce,colors:xe,options:je,visibility:he,size:ee,values:je.showValue?me.map(e=>null===e.value?void 0:de(e.value)):void 0}):null,table:Le?null:e(n,{id:ue,caption:G,categories:ce.map(e=>e.name??""),series:[{name:G,data:R}],values:[me],format:de,locale:q}),children:[X&&!Le?e(a,{rows:()=>[["",G??se.label],...ce.map((e,l)=>[e.name??"",me[l]?.value??null])],fileName:Y,onExport:Z,label:se.exportCsv}):null,l("div",{ref:ie,role:"img",tabIndex:Le?void 0:0,"aria-label":G??se.label,"aria-describedby":Le?void 0:pe,onPointerLeave:e=>{"touch"!==e.pointerType&&ve(null)},onBlur:()=>ve(null),onKeyDown:e=>{const l=Ce.map(e=>e.index);if("Escape"===e.key){if(null===fe)return;ve(null)}else{if(Ie||0===l.length)return;if("Home"===e.key)ve(l[0]);else if("End"===e.key)ve(l[l.length-1]);else{if("ArrowRight"!==e.key&&"ArrowLeft"!==e.key)return;{const t=null===fe?-1:l.indexOf(fe),n="ArrowRight"===e.key?t+1:t-1;ve(l[(n+l.length)%l.length])}}}e.preventDefault()},className:z("relative w-full rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:"string"==typeof V?V:Me},children:[Le?e("div",{className:z("flex h-full items-center justify-center text-(--neba-muted-fg)",P[ee]),children:U??oe.title}):re>0?l("svg",{width:re,height:Me,viewBox:`0 0 ${re} ${Me}`,"aria-hidden":"true",className:"block",children:[Ce.map(l=>{const t=null!==he.hovered&&he.hovered!==l.index||null!==fe&&fe!==l.index,n=l.end-l.start>2*Se?Se/2:0;return e("path",{d:x(ze,Ae,Pe,$e,l.start+n,l.end-n),fill:me[l.index].color??xe[l.index],opacity:t?.32:1,onPointerEnter:Ie?void 0:()=>ve(l.index),className:d},l.index)}),"all"===T?Ce.map(l=>{const t=((l.start+l.end)/2-90)*(Math.PI/180),n=$e>0?($e+Pe)/2:.68*Pe,a=`${Math.round(100*l.share)}%`;return(l.end-l.start)*(Math.PI/180)*n<2*Ne||Pe-$e<1.6*Ne?null:e("text",{x:ze+n*Math.cos(t),y:Ae+n*Math.sin(t),textAnchor:"middle",dominantBaseline:"central",fontSize:Ne,fontWeight:600,fill:N(me[l.index].color,l.index),className:"tabular-nums",children:a},l.index)}):null]}):null,K&&$e>0?e("div",{className:"pointer-events-none absolute flex flex-col items-center justify-center text-center",style:{left:ze-$e,top:Ae-$e,width:2*$e,height:be?$e:2*$e},children:K}):null,null===fe||Ie?null:Ee.render?e("div",{className:"pointer-events-none absolute top-0 left-1/2 z-10",children:Ee.render({index:fe,category:ce[fe]?.name??fe,items:De})}):e(u,{heading:ce[fe]?.name,items:De,x:ze,y:8,flip:!1,size:ee})]}),Le?null:e(o,{id:pe,template:se.summary,locale:q,...m(me.filter((e,l)=>he.visible[l]).map(e=>[e]),de)}),Ie?null:e(r,{heading:null===fe?void 0:ce[fe]?.name,items:De})]})}
|
|
@@ -51,6 +51,14 @@ export interface PillProps extends NebaStyleProps, Omit<React.ComponentPropsWith
|
|
|
51
51
|
position?: NebaPosition;
|
|
52
52
|
/** Which edge it is held against when `position` is not `static`. @default 'top' */
|
|
53
53
|
side?: 'top' | 'bottom';
|
|
54
|
+
/**
|
|
55
|
+
* Keeps it clear of a phone's home indicator and notch, on a page laid out
|
|
56
|
+
* under them with `viewport-fit=cover`, by adding the screen's
|
|
57
|
+
* `env(safe-area-inset-*)` on the edge it is held against. Only a `fixed` or
|
|
58
|
+
* `sticky` one is ever against that edge, so a `static` one is left alone.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
safeArea?: boolean;
|
|
54
62
|
/** Passing it makes the row a real button. */
|
|
55
63
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
56
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{trackPointer as i}from"../../internal/glow.js";import{observeResize as l}from"../../internal/observe.js";import{controlSlots as r,controlTextClasses as s,cx as a,focusRingClasses as c,gapClasses as m,hasContent as d,iconClasses as f,iconSizeClasses as x,metaTextClasses as p,paddingXClasses as u,pressTransitionClasses as h,sheetBodyClasses as v,surfaceClasses as b,transitionClasses as g}from"../../internal/styles.js";import{inertValue as w}from"../../internal/inert.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const j={solid:[b,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[b,"border text-(--n-on-tint) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:`${b} text-(--n-on-tint) bg-(--n-soft)`},_={solid:"hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)",outline:"hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)] active:bg-(--n-panel-press)",text:"hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)"},k={xs:"min-h-5.5",sm:"min-h-6.5",md:"min-h-8",lg:"min-h-10",xl:"min-h-12"},z={xs:"rounded-[0.6875rem]",sm:"rounded-[0.8125rem]",md:"rounded-[1rem]",lg:"rounded-[1.25rem]",xl:"rounded-[1.5rem]"},N={default:{xs:"px-3",sm:"px-4",md:"px-5",lg:"px-6",xl:"px-8"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}},$={static:{top:"",bottom:""},sticky:{top:"sticky top-3 z-20",bottom:"sticky bottom-3 z-20"},fixed:{top:"fixed inset-x-0 top-3 z-30 mx-auto w-fit",bottom:"fixed inset-x-0 bottom-3 z-30 mx-auto w-fit"}},P={static:{top:"",bottom:""},sticky:{top:"sticky top-[calc(0.75rem_+_env(safe-area-inset-top))] z-20",bottom:"sticky bottom-[calc(0.75rem_+_env(safe-area-inset-bottom))] z-20"},fixed:{top:"fixed inset-x-0 top-[calc(0.75rem_+_env(safe-area-inset-top))] z-30 mx-auto w-fit",bottom:"fixed inset-x-0 bottom-[calc(0.75rem_+_env(safe-area-inset-bottom))] z-30 mx-auto w-fit"}};export const Pill=/*@__PURE__*/o.forwardRef(function Pill(b,I){const{variant:C="solid",size:H="md",color:M="secondary",density:R="default",elevation:A=2,startIcon:B,endIcon:E,title:F,description:L,details:S,expanded:q=!1,position:D="static",side:G="top",safeArea:J=!0,className:K,style:O,children:Q,onClick:T,...U}=y(b,["size","density","variant"]),V=o.useRef(null),W=o.useId(),[X,Y]=o.useState(null),Z=d(S);o.useLayoutEffect(()=>{const e=V.current;if(e)return Y(e.scrollHeight),l(e,()=>Y(e.scrollHeight))},[Z]);const ee=Boolean(T),te=u[R][H],ne=t(n,{children:[d(B)?e("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-full [&_img]:size-full [&_img]:object-cover ${x[H]}`,children:B}):null,d(F)||d(L)||d(Q)?t("span",{className:["flex min-w-0 flex-1 flex-col items-center justify-center text-center",N[R][H]].join(" "),children:[d(F)?e("span",{className:"max-w-full truncate",children:F}):null,d(L)?e("span",{className:`max-w-full truncate font-normal ${p[H]}`,children:L}):null,Q]}):null]});return t("div",{ref:I,className:a("inline-flex max-w-full flex-col overflow-hidden align-middle",z[H],"font-medium whitespace-nowrap select-none",s[H],j[C],g,h,f,ee?`neba-glow ${_[C]}`:"",(J?P:$)[D][G],K??""),style:{...r(M,A,C),...O},...U,onPointerMove:i(U.onPointerMove,ee),children:[t("div",{className:["flex shrink-0 items-center py-1",k[H],m[H],ee?"ps-0":te,d(E)?"pe-1":ee?"pe-0":""].join(" "),children:[ee?e("button",{type:"button",className:["flex min-w-0 flex-1 cursor-pointer items-center justify-center self-stretch","rounded-[inherit]",m[H],te,c].join(" "),"aria-expanded":Z?q:void 0,"aria-controls":Z?W:void 0,onClick:T,children:ne}):ne,d(E)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:E}):null]}),Z?e("div",{id:W,className:["overflow-hidden","[transition:height_var(--neba-duration)_var(--neba-ease)]","motion-reduce:[transition-duration:0ms]"].join(" "),style:{height:q?X??"auto":0},inert:w(!q),children:e("div",{ref:V,className:`whitespace-normal ${te} pb-2 ${v[H]}`,children:S})}):null]})});
|
|
@@ -14,7 +14,12 @@ export interface PopconfirmProps {
|
|
|
14
14
|
description?: React.ReactNode;
|
|
15
15
|
/** Called when the reader confirms. May return a promise; see `onConfirm`. */
|
|
16
16
|
onConfirm?: () => void | Promise<unknown>;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Called when the reader cancels. Dismissing does not call it.
|
|
19
|
+
*
|
|
20
|
+
* Walking away from a question is not answering it _no_, so a handler that
|
|
21
|
+
* undoes something here does not run every time somebody presses Escape.
|
|
22
|
+
*/
|
|
18
23
|
onCancel?: () => void;
|
|
19
24
|
/** Overrides the confirming button's label. Defaults to the locale's word. */
|
|
20
25
|
confirmLabel?: React.ReactNode;
|
|
@@ -42,7 +47,7 @@ export interface PopconfirmProps {
|
|
|
42
47
|
open?: boolean;
|
|
43
48
|
defaultOpen?: boolean;
|
|
44
49
|
onOpenChange?: (open: boolean) => void;
|
|
45
|
-
/** BCP 47 tag deciding the two default labels.
|
|
50
|
+
/** BCP 47 tag deciding the two default labels. Falls back to the provider's, then to English. */
|
|
46
51
|
locale?: string;
|
|
47
52
|
/** How wide the bubble is. */
|
|
48
53
|
width?: number | string;
|
|
@@ -63,8 +68,10 @@ export interface PopconfirmProps {
|
|
|
63
68
|
* So the rule is about *reach* rather than about danger: one row, a Popconfirm;
|
|
64
69
|
* the page, a Confirm.
|
|
65
70
|
*
|
|
66
|
-
* It closes itself once `onConfirm`
|
|
71
|
+
* It closes itself once `onConfirm` resolves, so an async handler keeps the
|
|
67
72
|
* bubble up — and its confirming button busy — until the work is actually done.
|
|
73
|
+
* A handler that rejects leaves the bubble open with its button ready again, and
|
|
74
|
+
* the error is not caught: it belongs to the page's own error reporting.
|
|
68
75
|
* A question that vanished before its answer landed is a question the reader
|
|
69
76
|
* has no way to know was heard.
|
|
70
77
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as i from"react";import{Button as o}from"../button/Button.js";import{Popover as t,PopoverClose as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as i from"react";import{Popover as r}from"@base-ui/react/popover";import{Button as o}from"../button/Button.js";import{Popover as t,PopoverClose as a}from"../popover/Popover.js";import{severityIcon as l}from"../../internal/icons.js";import{confirmMessages as s,useMessages as c}from"../../internal/i18n.js";import{cx as m,gapClasses as d}from"../../internal/styles.js";import{useStyleDefaults as p}from"../../internal/defaults.js";export function Popconfirm(f){const{trigger:u,title:h,description:x,onConfirm:g,onCancel:j,confirmLabel:v,cancelLabel:N,color:C="danger",size:b="sm",icon:y=!0,side:w="top",align:z="center",open:k,defaultOpen:O,onOpenChange:P,locale:L,width:S=280,className:B,classNames:D}=p(f,["size","locale"]),T=c(s,L),[q,A]=i.useState(O??!1),E=k??q,[F,G]=i.useState(!1),H=e=>{void 0===k&&A(e),P?.(e)},I=!0===y?l(C):y;return e(t,{trigger:u,open:E,onOpenChange:H,side:w,align:z,size:b,color:C,width:S,showClose:!1,className:B,children:n("div",{className:m("flex",d[b]),children:[I?e("span",{"aria-hidden":"true",className:m("mt-px shrink-0 text-(--n-accent)",D?.icon),children:I}):null,n("div",{className:m("flex min-w-0 flex-1 flex-col",d[b]),children:[h?e(r.Title,{render:e("p",{}),className:m("font-medium text-(--neba-fg)",D?.title),children:h}):null,x?e(r.Description,{render:e("p",{}),className:m("text-(--neba-muted-fg)",D?.description),children:x}):null,n("div",{className:m("flex justify-end gap-1.5 pt-0.5",D?.actions),children:[e(a,{render:e(o,{size:b,variant:"text",color:"secondary",onClick:()=>j?.(),children:N??T.cancel})}),e(o,{size:b,color:C,loading:F,onClick:async()=>{try{G(!0),await(g?.()),H(!1)}finally{G(!1)}},children:v??T.confirm})]})]})]})})}
|
|
@@ -67,7 +67,14 @@ export interface PopoverProps extends Pick<NebaStyleProps, 'size' | 'color' | 'd
|
|
|
67
67
|
* @default true
|
|
68
68
|
*/
|
|
69
69
|
dismissible?: boolean;
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Shows the × in the corner.
|
|
72
|
+
*
|
|
73
|
+
* A `modal` popover without one still gets a close button, visually hidden
|
|
74
|
+
* until it takes the keyboard focus: a focus trap needs a way out a screen
|
|
75
|
+
* reader can reach, and VoiceOver on iOS has no Escape key to press.
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
71
78
|
showClose?: boolean;
|
|
72
79
|
/**
|
|
73
80
|
* Which language the × is named in — a BCP 47 tag such as `ko`, `pt-BR` or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Popover as o}from"@base-ui/react/popover";import{boxPaddingXClasses as l,boxPaddingYClasses as i}from"../box/Box.js";import{actionMessages as n,useMessages as t}from"../../internal/i18n.js";import{CloseIcon as a}from"../../internal/icons.js";import{cx as r,hasContent as d,metaTextClasses as c,popupFadeClasses as m,radiusClasses as f,sheetBodyClasses as p,sheetHeaderGapClasses as u,sheetSectionGapClasses as b,sheetTitleClasses as h,srOnlyClasses as x,surfaceClasses as g,surfaceSlots as v}from"../../internal/styles.js";import{useStyleDefaults as w}from"../../internal/defaults.js";const j={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},N=[g,"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]",m].join(" "),_={xs:8,sm:9,md:10,lg:11,xl:12};export const PopoverClose=o.Close;export function Popover(m){const{size:g="md",color:k="primary",density:y="default",trigger:z,title:O,description:C,children:P,side:$="bottom",align:B="center",sideOffset:L=6,alignOffset:M=0,arrow:T=!1,open:W,defaultOpen:A,onOpenChange:D,modal:E=!1,dismissible:R=!0,showClose:q=!1,locale:F,closeLabel:G,width:H,className:I,style:J,...K}=w(m,["size","density","locale"]),Q=t(n,F),S=l[y][g],U=i[y][g],V=_[g],X=d(O)||d(C);return s(o.Root,{open:W,defaultOpen:A,modal:E,onOpenChange:(e,s)=>{R||e||"escape-key"!==s.reason&&"outside-press"!==s.reason&&"focus-out"!==s.reason?D?.(e):s.cancel()},children:[z?e(o.Trigger,{render:z}):null,e(o.Portal,{children:e(o.Positioner,{className:"neba-portal z-(--neba-z-portal) [outline:none]",side:$,align:B,sideOffset:L,alignOffset:M,children:s(o.Popup,{className:r(N,f[g],p[g],b[g],S,U,void 0===H?j[g]:"",I??""),style:{...v(k,3),...void 0===H?null:{maxWidth:"number"==typeof H?`${H}px`:H},...J},...K,children:[T?e(o.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:s("svg",{width:V,height:V/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:[e("path",{d:"M0 0h10L5 5z",fill:"var(--n-panel-press)"}),e("path",{d:"M0 0 5 5 10 0",fill:"none",stroke:"var(--n-line)",strokeWidth:"1",vectorEffect:"non-scaling-stroke"})]})}):null,X||q?s("div",{className:"flex shrink-0 items-start gap-3",children:[s("div",{className:`flex min-w-0 flex-1 flex-col ${u[g]}`,children:[d(O)?e(o.Title,{className:`m-0 font-semibold ${h[g]}`,children:O}):null,d(C)?e(o.Description,{className:`m-0 text-(--neba-muted-fg) ${c[g]}`,children:C}):null]}),q?e(o.Close,{"aria-label":G??Q.close,className:["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"].join(" "),children:e(a,{})}):null]}):null,d(P)?e("div",{className:"min-w-0",children:P}):null,!1===E||q?null:e(o.Close,{"aria-label":G??Q.close,className:r(x,"end-2 top-2 flex cursor-pointer items-center justify-center rounded-full","bg-(--n-panel-press) text-(--neba-muted-fg) [&_svg]:size-[1.1em] [&_svg]:shrink-0","focus-visible:size-[1.6em] focus-visible:[clip-path:none]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),children:e(a,{})})]})})})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import*as r from"react";import{createPortal as e}from"react-dom";import{cx as o}from"../../internal/styles.js";export const Portal=/*@__PURE__*/r.forwardRef(function Portal({children:n,container:s,disabled:a=!1,className:c,...i},l){const[f,m]=r.useState(null);r.useEffect(()=>{if(a)return;const t="function"==typeof s?s():s;m(t??document.body)},[s,a]);const u=t("div",{ref:l,className:o("neba-portal",c),...i,children:n});return a?u:f?e(u,f):null});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Progress as s}from"@base-ui/react/progress";import{plateGapClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Progress as s}from"@base-ui/react/progress";import{plateGapClasses as r,plateRadiusClasses as t,plateSizeClasses as n,progressAriaText as i,progressFraction as o,progressSlots as m,progressText as u}from"../../internal/progress.js";import{cx as f,metaTextClasses as c,stackGapClasses as d}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";export const ProgressBox=/*@__PURE__*/l.forwardRef(function ProgressBox(l,b){const{size:h="md",color:p="primary",count:g=4,value:v=null,min:y=0,max:j=100,label:w,showValue:N=!1,format:M,className:V,style:k,...z}=x(l,["size"]),A=o(v,y,j),B=null===A,P=void 0!==M,R=Number.isFinite(g)?Math.max(1,Math.floor(g)):1;return a(s.Root,{ref:b,value:B?null:v,min:y,max:j,format:M,getAriaValueText:i(A,P),className:f("inline-flex flex-col",d[h],V??""),style:{...m(p),...k},...z,children:[w||N?a("div",{className:["flex items-baseline gap-2",w?"justify-between":"justify-end",c[h]].join(" "),children:[w?e(s.Label,{className:"min-w-0 truncate text-(--neba-fg)",children:w}):null,N?e(s.Value,{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:e=>u(A,e,P)}):null]}):null,e(s.Track,{className:`flex ${r[h]}`,children:Array.from({length:R},(a,l)=>e("span",{className:f("relative overflow-hidden bg-(--n-soft)","[box-shadow:var(--neba-plate-glass)]",n[h],t[h],B?"neba-plate-wave":""),style:B?{"--n-i":l}:void 0,children:B?null:e("span",{className:"absolute inset-y-0 start-0 bg-(--n-fill) [transition:width_var(--neba-duration-fill)_var(--neba-ease)]",style:{width:`${Math.min(100,Math.max(0,100*(A*R-l)))}%`}})},l))})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Progress as s}from"@base-ui/react/progress";import{progressAriaText as t,progressFraction as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Progress as s}from"@base-ui/react/progress";import{progressAriaText as t,progressFraction as l,progressSlots as n,progressText as i,ringDiameters as o,ringStrokes as c}from"../../internal/progress.js";import{cx as m,gapClasses as u,metaTextClasses as f}from"../../internal/styles.js";import{useStyleDefaults as h}from"../../internal/defaults.js";export const ProgressCircular=/*@__PURE__*/a.forwardRef(function ProgressCircular(a,d){const{size:x="md",color:k="primary",value:p=null,min:g=0,max:b=100,label:v,showValue:y=!1,format:$,locale:j,thickness:N,className:w,style:M,...P}=h(a,["size","locale"]),V=l(p,g,b),z=null===V,C=void 0!==$,D=o[x],L=D/2,R=Math.min(Math.max(N??c[x],.5),L/2),W=L-R/2,_=2*Math.PI*W,A=z?`${.28*_} ${_}`:`${_}`,B=z?0:_*(1-V);return r(s.Root,{ref:d,value:z?null:p,min:g,max:b,format:$,locale:j,getAriaValueText:t(V,C),className:m("inline-flex items-center",u[x],f[x],w??""),style:{...n(k),...M},...P,children:[r("svg",{className:z?"neba-ring-spin shrink-0":"shrink-0",width:D,height:D,viewBox:`0 0 ${D} ${D}`,fill:"none","aria-hidden":"true",children:[e("circle",{cx:L,cy:L,r:W,stroke:"var(--n-soft)",strokeWidth:R}),e("circle",{cx:L,cy:L,r:W,stroke:"var(--n-accent)",strokeWidth:R,strokeLinecap:"round",strokeDasharray:A,strokeDashoffset:B,transform:`rotate(-90 ${L} ${L})`,className:"[transition:stroke-dashoffset_var(--neba-duration-fill)_var(--neba-ease)]"})]}),v?e(s.Label,{className:"min-w-0 truncate text-(--neba-fg)",children:v}):null,y?e(s.Value,{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:e=>i(V,e,C)}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Progress as r}from"@base-ui/react/progress";import{barThicknessClasses as s,progressAriaText as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Progress as r}from"@base-ui/react/progress";import{barThicknessClasses as s,progressAriaText as n,progressFraction as t,progressSlots as i,progressText as o}from"../../internal/progress.js";import{cx as m,metaTextClasses as u,stackGapClasses as c}from"../../internal/styles.js";import{useStyleDefaults as f}from"../../internal/defaults.js";export const ProgressLinear=/*@__PURE__*/a.forwardRef(function ProgressLinear(a,d){const{size:b="md",color:p="primary",value:g=null,min:x=0,max:h=100,label:j,showValue:v=!1,format:w,locale:y,thickness:N,className:k,style:L,...V}=f(a,["size","locale"]),z=t(g,x,h),P=null===z,R=void 0!==w;return l(r.Root,{ref:d,value:P?null:g,min:x,max:h,format:w,locale:y,getAriaValueText:n(z,R),className:m("flex w-full flex-col",c[b],k??""),style:{...i(p),...L},...V,children:[j||v?l("div",{className:["flex items-baseline gap-2",j?"justify-between":"justify-end",u[b]].join(" "),children:[j?e(r.Label,{className:"min-w-0 truncate text-(--neba-fg)",children:j}):null,v?e(r.Value,{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:e=>o(z,e,R)}):null]}):null,e(r.Track,{className:`neba-progress-track relative w-full overflow-hidden rounded-full bg-(--n-soft) ${s[b]}`,style:void 0===N?void 0:{height:`${N}px`},children:e(r.Indicator,{className:["neba-progress-indicator absolute rounded-full bg-(--n-fill)",P?"neba-sweep":"top-0 [transition:width_var(--neba-duration-fill)_var(--neba-ease)]"].join(" ")})})]})});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PromptMessages } from '../../internal/i18n.js';
|
|
3
|
+
import type { NebaElevation, NebaSlots, NebaStyleProps } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The parts a PromptInput draws behind its root.
|
|
6
|
+
*
|
|
7
|
+
* `shell` is the framed box — the thing wearing the border, the fill and the
|
|
8
|
+
* focus ring — and `control` the `<textarea>` inside it. `toolbar` is the row
|
|
9
|
+
* under the text and `send` the one button the component draws itself.
|
|
10
|
+
*/
|
|
11
|
+
export type PromptInputSlot = 'shell' | 'control' | 'toolbar' | 'send';
|
|
12
|
+
/** Which key sends, spelled the way [Shortcut] draws it. */
|
|
13
|
+
export type PromptSubmitKey = 'Enter' | 'Mod+Enter';
|
|
14
|
+
type NativeControlProps = Omit<React.ComponentPropsWithoutRef<'textarea'>, 'color' | 'size' | 'value' | 'defaultValue' | 'onChange' | 'onSubmit' | 'children'>;
|
|
15
|
+
export interface PromptInputProps extends Pick<NebaStyleProps, 'size' | 'variant' | 'color' | 'density'>, NativeControlProps {
|
|
16
|
+
/** What is in the field. Pass it with `onValueChange` to drive it yourself. */
|
|
17
|
+
value?: string;
|
|
18
|
+
/** What an uncontrolled field starts with. @default '' */
|
|
19
|
+
defaultValue?: string;
|
|
20
|
+
/** Called on every keystroke, with the whole value. */
|
|
21
|
+
onValueChange?: (value: string) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Called with the value when the field is sent — by the key, by the button,
|
|
24
|
+
* or by a form submission. An empty field never sends.
|
|
25
|
+
*
|
|
26
|
+
* It does **not** clear the field. What happens to what was typed is the
|
|
27
|
+
* application's: a message that failed to send should still be there.
|
|
28
|
+
*/
|
|
29
|
+
onSubmit?: (value: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Whether an answer is being written. The send button becomes a stop button,
|
|
32
|
+
* and stays pressable — which is the whole reason it is one button and not
|
|
33
|
+
* two: the thing a reader reaches for to stop an answer is exactly where
|
|
34
|
+
* they last pressed to start it.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
submitting?: boolean;
|
|
38
|
+
/** Called when the stop button is pressed. */
|
|
39
|
+
onStop?: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Which key sends. `Enter` sends and `Shift+Enter` breaks the line;
|
|
42
|
+
* `Mod+Enter` is the other way round, for a field people write paragraphs in.
|
|
43
|
+
*
|
|
44
|
+
* Neither fires while an input method is composing — a Korean or Japanese
|
|
45
|
+
* reader pressing Enter to accept a candidate is finishing a word, not
|
|
46
|
+
* sending a message.
|
|
47
|
+
* @default 'Enter'
|
|
48
|
+
*/
|
|
49
|
+
submitKey?: PromptSubmitKey;
|
|
50
|
+
/**
|
|
51
|
+
* Passing it makes the shell a drop target. It is called with the files, and
|
|
52
|
+
* what happens to them is the application's.
|
|
53
|
+
*
|
|
54
|
+
* A folder dropped onto a page arrives looking like a zero-byte file, and
|
|
55
|
+
* those are filtered out before this is called — the same check a
|
|
56
|
+
* [FilePicker](../inputs/file-picker) makes.
|
|
57
|
+
*/
|
|
58
|
+
onFiles?: (files: File[]) => void;
|
|
59
|
+
/** The field's accessible name, drawn for a screen reader and nobody else. */
|
|
60
|
+
label?: React.ReactNode;
|
|
61
|
+
/** How many rows the field is at its shortest. @default 1 */
|
|
62
|
+
minRows?: number;
|
|
63
|
+
/**
|
|
64
|
+
* And at its tallest, after which it scrolls. A prompt field that grows
|
|
65
|
+
* without a ceiling pushes the conversation it belongs to off the screen.
|
|
66
|
+
* @default 8
|
|
67
|
+
*/
|
|
68
|
+
maxRows?: number;
|
|
69
|
+
/** Controls at the start of the toolbar under the text — attach, a model Select. */
|
|
70
|
+
start?: React.ReactNode;
|
|
71
|
+
/** Controls at its end, before the send button — a token count, a mode toggle. */
|
|
72
|
+
end?: React.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Drop shadow depth. `0` (the default) is flat.
|
|
75
|
+
* @default 0
|
|
76
|
+
*/
|
|
77
|
+
elevation?: NebaElevation;
|
|
78
|
+
/** Which language the two button labels are written in, as a BCP 47 tag. */
|
|
79
|
+
locale?: string;
|
|
80
|
+
/** Those words, written out. Overrides the `locale`'s. */
|
|
81
|
+
labels?: Partial<PromptMessages>;
|
|
82
|
+
/** Class names for the parts behind the root. */
|
|
83
|
+
classNames?: NebaSlots<PromptInputSlot>;
|
|
84
|
+
/** A strip above the field — the attachments that have been added, a reply-to line. */
|
|
85
|
+
children?: React.ReactNode;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Everything a prompt goes out through: the text, the attach and model
|
|
89
|
+
* controls, and one button that sends and then stops.
|
|
90
|
+
*
|
|
91
|
+
* A [TextField](../inputs/text-field) with `multiline` plus a
|
|
92
|
+
* [Toolbar](../surfaces/toolbar) gets the shell. What it does not get is the
|
|
93
|
+
* three things that are rewritten at every call site: a field that grows with
|
|
94
|
+
* what is typed and then stops growing, a send button that becomes a stop
|
|
95
|
+
* button without moving, and Enter meaning *send* while Shift+Enter means a new
|
|
96
|
+
* line.
|
|
97
|
+
*
|
|
98
|
+
* The composition guard is the part most easily missed and the one that matters
|
|
99
|
+
* most outside English: pressing Enter to accept a candidate from a Korean or
|
|
100
|
+
* Japanese input method is finishing a word, and a field that read it as a
|
|
101
|
+
* send would make the language unusable.
|
|
102
|
+
*/
|
|
103
|
+
export declare const PromptInput: React.ForwardRefExoticComponent<PromptInputProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
104
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{IconButton as r}from"../icon-button/IconButton.js";import{useDropZone as l}from"../../internal/drop.js";import{fieldLight as o,fieldSpotlightSlot as a,glowClasses as i}from"../../internal/glow.js";import{matchesShortcut as s}from"../../internal/keys.js";import{promptMessages as c,useMessages as m}from"../../internal/i18n.js";import{controlTextLeadingClasses as d,cx as u,disabledClasses as f,fieldFocusTransitionClasses as p,fieldReadOnlyClasses as h,fieldRestClasses as g,fieldRingClasses as x,hasContent as v,iconClasses as b,metaTextClasses as w,paddingXClasses as y,radiusClasses as $,srOnlyClasses as j,surfaceSlots as N,transitionClasses as k}from"../../internal/styles.js";import{useStyleDefaults as I}from"../../internal/defaults.js";import{useFieldsetDisabled as S}from"../../internal/fieldset.js";function SendIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e("path",{d:"M8 13V3.5m0 0L3.75 7.75M8 3.5l4.25 4.25",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function StopIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e("rect",{x:"4",y:"4",width:"8",height:"8",rx:"1.5"})})}const C={xs:`${$.sm} ${d.xs}`,sm:`${$.md} ${d.sm}`,md:`${$.lg} ${d.md}`,lg:`${$.xl} ${d.lg}`,xl:`${$.xl} ${d.xl}`},D={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2.5",xl:"gap-3"};export const PromptInput=/*@__PURE__*/n.forwardRef(function PromptInput(d,$){const{variant:z="outline",size:L="md",color:M="primary",density:R="default",elevation:B=0,value:E,defaultValue:K="",onValueChange:P,onSubmit:V,submitting:F=!1,onStop:O,submitKey:H="Enter",onFiles:T,label:W,minRows:q=1,maxRows:A=8,start:G,end:J,locale:Q,labels:U,classNames:X,disabled:Y,readOnly:Z=!1,onKeyDown:_,className:ee,style:te,children:ne,...re}=I(d,["size","density","variant","locale"]),le=S(Y),oe=!le&&!Z,ae={...m(c,Q),...U},[ie,se]=n.useState(K),ce=void 0!==E,me=ce?E:ie,{over:de,handlers:ue}=l(T),fe=n.useId(),pe=n.useRef(null),he=n.useCallback(e=>{pe.current=e,"function"==typeof $?$(e):$&&($.current=e)},[$]);n.useLayoutEffect(()=>{const e=pe.current;e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)},[me]);const ge=()=>{!me.trim()||le||Z||F||V?.(me)},xe=me.trim().length>0&&!le&&!Z;return t("form",{onSubmit:e=>{e.preventDefault(),ge()},className:u("flex w-full flex-col",ee??""),style:{...N(M,B),...oe?a:void 0,...te},children:[v(W)?e("label",{htmlFor:fe,className:j,children:W}):null,t("div",{"data-dropping":de||void 0,...ue,...o(oe),onPointerDown:e=>{e.target!==e.currentTarget||le||(e.preventDefault(),pe.current?.focus())},className:u("relative flex w-full flex-col py-2","[-webkit-tap-highlight-color:transparent]",C[L],D[L],y[R][L],k,p,x,b,le?f[z]:Z?h[z]:`${g[z]} ${i}`,de?"[border-color:var(--n-ring)] bg-(--n-soft)":"",X?.shell??""),children:[ne,e("textarea",{ref:he,id:fe,rows:q,value:me,disabled:le,readOnly:Z,onChange:e=>{ce||se(e.target.value),P?.(e.target.value)},className:u("neba-input block w-full resize-none bg-transparent [font:inherit] text-inherit","[outline:none]","min-h-(--n-min-rows) max-h-(--n-max-rows) overflow-y-auto","placeholder:text-(--neba-muted-fg)","caret-(--n-accent) selection:bg-(--n-soft-press)","disabled:cursor-not-allowed",X?.control??""),style:{"--n-min-rows":`calc(${Math.max(q,1)} * 1lh)`,"--n-max-rows":`calc(${Math.max(A,q,1)} * 1lh)`},...re,onKeyDown:e=>{!e.nativeEvent.isComposing&&s(e,H)&&(e.preventDefault(),ge()),_?.(e)}}),t("div",{className:u("flex min-w-0 items-center gap-2",w[L],X?.toolbar??""),children:[v(G)?e("div",{className:"flex min-w-0 items-center gap-1",children:G}):null,t("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:[v(J)?e("div",{className:"flex items-center gap-1",children:J}):null,e(r,{type:F?"button":"submit",size:L,color:M,icon:e(F?StopIcon:SendIcon,{}),label:F?ae.stop:ae.send,disabled:!F&&!xe,onClick:F?O:void 0,className:X?.send})]})]}),de?e("div",{"aria-hidden":"true",className:u("pointer-events-none absolute inset-0 flex items-center justify-center","font-medium text-(--n-accent)",C[L]),children:ae.drop}):null]})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PromptInput}from"./PromptInput.js";
|
|
@@ -61,9 +61,9 @@ export interface NebaProviderProps {
|
|
|
61
61
|
* <script dangerouslySetInnerHTML={{ __html: colorSchemeScript() }} />
|
|
62
62
|
* ```
|
|
63
63
|
*
|
|
64
|
-
* It reads the same key and writes the same attribute
|
|
65
|
-
* two cannot disagree — which is the reason it is here
|
|
66
|
-
* documentation snippet somebody copies once and never updates.
|
|
64
|
+
* It reads the same key and writes the same attribute and `color-scheme` the
|
|
65
|
+
* provider does, so the two cannot disagree — which is the reason it is here
|
|
66
|
+
* rather than in a documentation snippet somebody copies once and never updates.
|
|
67
67
|
*/
|
|
68
68
|
export declare function colorSchemeScript(options?: {
|
|
69
69
|
storageKey?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{DirectionProvider as r}from"@base-ui/react/direction-provider";import{DefaultsContext as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{DirectionProvider as r,useDirection as o}from"@base-ui/react/direction-provider";import{DefaultsContext as l}from"../../internal/defaults.js";import{useHydrated as n,useMediaQuery as c}from"../../internal/media.js";const s=/*@__PURE__*/t.createContext(null);export function colorSchemeScript(e={}){const t=e.storageKey??"neba-color-scheme",r=e.defaultColorScheme??"system";return`(function(){try{var s=localStorage.getItem(${a(t)})||${a(r)};if(s==='system'){s=matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}var d=document.documentElement;d.setAttribute('data-theme',s);d.style.colorScheme=s}catch(e){}})()`}function a(e){return JSON.stringify(e).replace(/</g,"\\u003c")}export function NebaProvider({children:a,defaults:i,colorScheme:u,defaultColorScheme:m="system",onColorSchemeChange:d,storageKey:h="neba-color-scheme",colorSchemeElement:f,direction:S}){const g=n(),y=t.useContext(l),v=t.useContext(s),p=o(),[C,b]=t.useState(null),x=t.useMemo(()=>g?function(e){if(!1===e||"undefined"==typeof localStorage)return null;try{const t=localStorage.getItem(e);return"light"===t||"dark"===t||"system"===t?t:null}catch{return null}}(h):null,[g,h]),k=u??C??x??m,E=c("(prefers-color-scheme: dark)"),j="system"===k?E?"dark":"light":k,M=t.useCallback(e=>{if(void 0===u&&b(e),!1!==h)try{localStorage.setItem(h,e)}catch{}d?.(e)},[u,h,d]);t.useEffect(()=>{if(!g)return;const e=f?f():null===v?document.documentElement:null;e&&(e.setAttribute("data-theme",j),e.style.colorScheme=j)},[g,j,f,v]),t.useEffect(()=>{S&&document.documentElement.setAttribute("dir",S)},[S]);const P=t.useMemo(()=>({colorScheme:k,resolvedColorScheme:j,setColorScheme:M,toggleColorScheme:()=>M("dark"===j?"light":"dark")}),[k,j,M]),z=i?.size??y?.size,A=i?.density??y?.density,I=i?.variant??y?.variant,N=i?.locale??y?.locale,w=null!=i||null!==y,K=t.useMemo(()=>w?{size:z,density:A,variant:I,locale:N}:null,[w,z,A,I,N]);return e(l.Provider,{value:K,children:e(s.Provider,{value:P,children:e(r,{direction:S??p,children:a})})})}export function useColorScheme(){const e=t.useContext(s);if(!e)throw new Error("neba: useColorScheme() needs a <NebaProvider> above it.");return e}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Radio as n}from"@base-ui/react/radio";import{RadioGroup as l}from"@base-ui/react/radio-group";import{Field as i}from"@base-ui/react/field";import{controlTextClasses as o,cx as t,hitAreaClasses as s,metaTextClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Radio as n}from"@base-ui/react/radio";import{RadioGroup as l}from"@base-ui/react/radio-group";import{Field as i}from"@base-ui/react/field";import{controlTextClasses as o,cx as t,hitAreaClasses as s,metaTextClasses as d,surfaceClasses as c,tickDotClasses as b,tickRowLeadingClasses as f,tickSizeClasses as m,transitionClasses as h}from"../../internal/styles.js";import{useStyleDefaults as p}from"../../internal/defaults.js";import{useFieldsetDisabled as u}from"../../internal/fieldset.js";const v=/*@__PURE__*/r.createContext({size:"md",color:"primary",readOnly:!1,disabled:!1}),g=["relative inline-flex shrink-0 items-center justify-center rounded-full border",s,"[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",h,"active:[transition-duration:0ms]","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"].join(" "),x=[c,"cursor-pointer bg-(--n-panel) [border-color:var(--n-line)]","hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]","data-[checked]:bg-(--n-fill) data-[checked]:text-(--n-on-solid)","data-[checked]:[border-color:transparent]","data-[checked]:hover:bg-(--n-fill-hover)"].join(" "),N=[c,"cursor-default bg-(--n-panel) [border-color:var(--n-line)]","[filter:saturate(0.55)]","data-[checked]:bg-(--n-fill) data-[checked]:text-(--n-on-solid)","data-[checked]:[border-color:transparent]"].join(" "),y=["cursor-not-allowed bg-transparent [border-color:var(--neba-disabled-border)] shadow-none","data-[checked]:bg-(--neba-disabled-bg)"].join(" "),j=["rounded-full bg-current","[transition:width_var(--neba-duration)_var(--neba-ease),height_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:size-0 data-[ending-style]:size-0"].join(" ");export const Radio=/*@__PURE__*/r.forwardRef(function Radio({label:l,description:s,disabled:c,className:h,classNames:p,style:u,...k},z){const R=r.useContext(v),w=k.readOnly??R.readOnly,$=c??R.disabled;return e(i.Root,{disabled:$,className:t("flex flex-col",h??""),style:u,children:a("div",{className:`flex items-start gap-2 ${o[R.size]} ${f}`,children:[e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(n.Root,{ref:z,className:t(g,m[R.size],$?y:w?N:x,p?.control),disabled:$,...k,children:e(n.Indicator,{className:t(j,b[R.size],p?.indicator)})})}),l||s?a("span",{className:"flex min-w-0 flex-col gap-0.5",children:[l?e(i.Label,{className:t("leading-[1.4]",$?"text-(--neba-disabled-fg)":"cursor-pointer text-(--neba-fg)",p?.label),children:l}):null,s?e(i.Description,{className:t(d[R.size],"text-(--neba-muted-fg)",p?.description),children:s}):null]}):null]})})});export const RadioGroup=/*@__PURE__*/r.forwardRef(function RadioGroup(n,o){const{size:s="md",color:c="primary",orientation:b="vertical",label:f,description:m,error:h,invalid:g,disabled:x,readOnly:N=!1,className:y,classNames:j,style:k,children:z,...R}=p(n,["size"]),w=u(x),$=null!=h&&!1!==h&&""!==h,O=g??$,_=O?"danger":c,G={"--n-fill":`var(--neba-${_}-fill)`,"--n-fill-hover":`var(--neba-${_}-fill-hover)`,"--n-on-solid":`var(--neba-${_}-on-solid)`,"--n-accent":`var(--neba-${_}-accent)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-line":`var(--neba-${_}-line)`,"--n-line-hover":`var(--neba-${_}-line-hover)`,"--n-ring":`var(--neba-${_}-ring)`},C=r.useMemo(()=>({size:s,color:_,readOnly:N,disabled:w}),[s,_,N,w]);return e(v.Provider,{value:C,children:a(i.Root,{disabled:w,invalid:O,className:t("flex flex-col gap-1.5",y??""),style:{...G,...k},children:[f?e(i.Label,{className:t(d[s],"font-medium",w?"text-(--neba-disabled-fg)":"text-(--neba-fg)",j?.label),children:f}):null,m?e(i.Description,{className:t(d[s],"text-(--neba-muted-fg)",j?.description),children:m}):null,e(l,{ref:o,disabled:w,readOnly:N,className:t("flex","horizontal"===b?"flex-row flex-wrap gap-x-5 gap-y-2":"flex-col gap-2",j?.control),...R,children:z}),e(i.Error,$?{match:!0,className:t(d[s],"text-(--n-accent)",j?.error),children:h}:{className:t(d[s],"text-(--n-accent)",j?.error)})]})})});
|
|
@@ -49,7 +49,10 @@ export interface RatingProps extends Omit<React.ComponentPropsWithoutRef<'div'>,
|
|
|
49
49
|
readOnly?: boolean;
|
|
50
50
|
/** Unavailable. Drops the colour family for neutral grey. */
|
|
51
51
|
disabled?: boolean;
|
|
52
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Identifies the value when a form is submitted. Without one a Rating
|
|
54
|
+
* submits nothing, and `required` has nothing to hold back.
|
|
55
|
+
*/
|
|
53
56
|
name?: string;
|
|
54
57
|
/** A form will not submit until a star has been chosen. */
|
|
55
58
|
required?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{StarIcon as t,StarOutlineIcon as r}from"../../internal/icons.js";import{fillMessage as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{StarIcon as t,StarOutlineIcon as r}from"../../internal/icons.js";import{fillMessage as i,ratingMessages as l,useMessages as o}from"../../internal/i18n.js";import{controlSlots as s,cx as d,focusWithinRingClasses as m,gapClasses as c,iconSizeClasses as u,radiusClasses as h,srOnlyClasses as f,transitionClasses as b}from"../../internal/styles.js";import{useStyleDefaults as p}from"../../internal/defaults.js";const v="flex items-center justify-center";export const Rating=/*@__PURE__*/n.forwardRef(function Rating(x,y){const{value:g,defaultValue:j=0,onValueChange:M,count:N=5,precision:w=1,icon:k,emptyIcon:S,clearable:C=!0,readOnly:L=!1,disabled:P=!1,name:q,required:I=!1,size:R="md",color:z="warning",locale:A,label:V,valueLabel:_,className:E,style:F,onPointerLeave:O,...$}=p(x,["size","locale"]),B=o(l,A),D=n.useId(),G=q??D,H=void 0===q?`${D}-no-form`:void 0,[J,K]=n.useState(j),Q=void 0!==g,T=Q?g:J,[U,W]=n.useState(null),X=Math.max(1,Math.floor(N)),Y=w>0&&w<=1?w:1,Z=Math.round(1/Y),ee=Math.max(0,Math.min(X,U??T)),ae=n.useCallback(e=>_?_(e,X):e<=0?B.empty:i(B.value,{value:String(Math.round(10*e)/10),max:String(X)}),[_,X,B]),ne=e=>{Q||K(e),M?.(e)},te=Array.from({length:X},(n,i)=>{const l=Math.max(0,Math.min(1,ee-i));return a("span",{className:d("relative inline-flex shrink-0",u[R],h.xs,L||P?"":m),children:[e("span",{className:[v,u[R],P?"text-(--neba-disabled-fg)":"text-(--n-empty)"].join(" "),children:S??e(r,{})}),e("span",{"aria-hidden":"true",className:d("pointer-events-none absolute inset-y-0 start-0 overflow-hidden","[transition:width_var(--neba-duration)_var(--neba-ease)]"),style:{width:100*l+"%"},children:e("span",{className:[v,u[R],P?"text-(--neba-disabled-fg)":"text-(--n-fill)",b].join(" "),children:k??e(t,{})})}),L?null:Array.from({length:Z},(a,n)=>{const t=Number((i+(n+1)*Y).toFixed(4));return e("label",{className:["absolute inset-y-0",P?"cursor-not-allowed":"cursor-pointer"].join(" "),style:{insetInlineStart:100*n/Z+"%",width:100/Z+"%"},onPointerEnter:()=>{P||W(t)},children:e("input",{type:"radio",className:f,name:G,form:H,value:t,checked:T===t,disabled:P,required:I,"aria-label":ae(t),onChange:()=>ne(t),onClick:()=>{C&&T===t&&ne(0)}})},t)})]},i)}),re=d("inline-flex items-center align-middle",c[R],P?"cursor-not-allowed":"",E??""),ie={...s(z,0,"solid"),"--n-empty":"color-mix(in oklab, var(--neba-muted-fg) 40%, transparent)",...F};return e("div",L?{ref:y,role:"img","aria-label":ae(Math.max(0,Math.min(X,T))),className:re,style:ie,onPointerLeave:O,...$,children:te}:{ref:y,role:"radiogroup","aria-label":V??B.label,"aria-disabled":P||void 0,"aria-required":I||void 0,className:re,style:ie,onPointerLeave:e=>{W(null),O?.(e)},...$,children:te})});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ReasoningMessages } from '../../internal/i18n.js';
|
|
3
|
+
import type { NebaElevation, NebaSlots, NebaStyleProps } from '../../types.js';
|
|
4
|
+
/** The two parts a Reasoning draws behind its root: the header, and the panel. */
|
|
5
|
+
export type ReasoningSlot = 'header' | 'body';
|
|
6
|
+
export interface ReasoningProps extends Pick<NebaStyleProps, 'size' | 'variant' | 'color' | 'density'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'onChange'> {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the thinking is still arriving. It is what the header says, what
|
|
9
|
+
* the mark does, and — unless `autoOpen` is off — whether the panel is open.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
streaming?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* How long the thinking took, in milliseconds.
|
|
15
|
+
*
|
|
16
|
+
* Left out, the panel counts its own from the moment `streaming` went true
|
|
17
|
+
* and keeps the last figure once it stops — which is where "Thought for 4s"
|
|
18
|
+
* comes from. A stretch shorter than a second never gets a number, and the
|
|
19
|
+
* header says so in words instead.
|
|
20
|
+
*/
|
|
21
|
+
duration?: number;
|
|
22
|
+
/** Whether the panel is showing. Pass it to drive the disclosure yourself. */
|
|
23
|
+
open?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Where an uncontrolled Reasoning starts, before any stream has run.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
defaultOpen?: boolean;
|
|
29
|
+
/** Called when the header, or the stream, opens or closes the panel. */
|
|
30
|
+
onOpenChange?: (open: boolean) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Opens the panel while the stream runs and closes it when the stream ends.
|
|
33
|
+
*
|
|
34
|
+
* On, because that is the whole difference between this and a
|
|
35
|
+
* [Collapsible](../surfaces/collapsible): the reader can watch the thinking
|
|
36
|
+
* as it arrives without asking for it, and is left with a one-line summary
|
|
37
|
+
* rather than a wall of it. Turn it off for a panel that should stay where
|
|
38
|
+
* the reader put it.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
autoOpen?: boolean;
|
|
42
|
+
/** Replaces what the header says. Otherwise it is the `locale`'s sentence. */
|
|
43
|
+
label?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* The mark at the start. Defaults to the turning ring while the stream runs
|
|
46
|
+
* and nothing after it; pass `false` to drop it, or a node to replace it.
|
|
47
|
+
*/
|
|
48
|
+
icon?: React.ReactNode | false;
|
|
49
|
+
/**
|
|
50
|
+
* Drop shadow depth. `0` (the default) is flat.
|
|
51
|
+
* @default 0
|
|
52
|
+
*/
|
|
53
|
+
elevation?: NebaElevation;
|
|
54
|
+
/** Which language the header's own sentence is written in, as a BCP 47 tag. */
|
|
55
|
+
locale?: string;
|
|
56
|
+
/** Those sentences, written out. Overrides the `locale`'s. */
|
|
57
|
+
labels?: Partial<ReasoningMessages>;
|
|
58
|
+
/** Class names for the parts behind the root. */
|
|
59
|
+
classNames?: NebaSlots<ReasoningSlot>;
|
|
60
|
+
/** The thinking. */
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A thinking panel that the stream opens and closes.
|
|
65
|
+
*
|
|
66
|
+
* On a [Spoiler](../surfaces/spoiler) and a
|
|
67
|
+
* [Collapsible](../surfaces/collapsible) the reader owns the open state: they
|
|
68
|
+
* covered it, they uncover it. Here the stream owns it — the panel opens as the
|
|
69
|
+
* thinking starts arriving, stays open while the reader can follow it, and
|
|
70
|
+
* folds itself away into one line when it stops. What is left behind is a
|
|
71
|
+
* record that it happened and how long it took, which is what a reader wants
|
|
72
|
+
* from reasoning they did not need to read.
|
|
73
|
+
*
|
|
74
|
+
* The panel is deliberately **not** a live region. Thinking is long, it is
|
|
75
|
+
* revised as it arrives, and a screen reader reading every revision aloud would
|
|
76
|
+
* bury the answer it is on the way to.
|
|
77
|
+
*/
|
|
78
|
+
export declare const Reasoning: React.ForwardRefExoticComponent<ReasoningProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Collapsible as t}from"@base-ui/react/collapsible";import{boxPaddingXClasses as o,boxPaddingYClasses as r}from"../box/Box.js";import{ChevronIcon as l,SpinnerIcon as s}from"../../internal/icons.js";import{formatDuration as i,useElapsed as c}from"../../internal/run.js";import{fillMessage as d,reasoningMessages as m,useMessages as f}from"../../internal/i18n.js";import{collapsiblePanelClasses as p,cx as u,gapClasses as b,hasContent as h,iconClasses as v,radiusClasses as x,sheetBodyClasses as g,sheetTitleClasses as j,surfaceClasses as N,surfaceSlots as y,transitionClasses as w}from"../../internal/styles.js";import{useStyleDefaults as O}from"../../internal/defaults.js";const R={solid:[N,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[N,"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"};export const Reasoning=/*@__PURE__*/a.forwardRef(function Reasoning(N,_){const{variant:k="text",size:C="md",color:z="secondary",density:S="default",elevation:B=0,streaming:P=!1,duration:T,open:q,defaultOpen:A=!1,onOpenChange:D,autoOpen:E=!0,label:F,icon:G,locale:H,labels:I,classNames:J,className:K,style:L,children:M,...Q}=O(N,["size","density","variant","locale"]),U={...f(m,H),...I},[V,W]=a.useState(A||E&&P),[X,Y]=a.useState(P),Z=void 0!==q,$=Z?q:V;X!==P&&(Y(P),E&&!Z&&W(P));const ee=c(P,T),ne=null===ee?null:i(ee,H),ae=h(F)?F:P?U.thinking:null===ne?U.done:d(U.thought,{duration:ne}),te=void 0===G?P?e(s,{}):null:G;return n(t.Root,{ref:_,open:$,onOpenChange:e=>{Z||W(e),D?.(e)},"aria-busy":P||void 0,"data-streaming":P||void 0,className:u("flex flex-col overflow-hidden",x[C],R[k],w,v,K??""),style:{...y(z,B),...L},...Q,children:[n(t.Trigger,{className:u("flex w-full cursor-pointer items-center text-start text-(--neba-muted-fg)",o[S][C],r[S][C],b[C],j[C],w,"hover:bg-(--n-soft) hover:text-(--n-on-tint)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",J?.header??""),children:[h(te)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:te}):null,e("span",{className:"min-w-0 flex-1 truncate font-medium",children:ae}),e("span",{className:["flex h-[1lh] shrink-0 items-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]","data-[panel-open]:rotate-180"].join(" "),children:e(l,{})})]}),e(t.Panel,{className:p,children:e("div",{className:u("min-w-0 border-s-2 text-(--neba-muted-fg) [border-color:var(--n-line)]",o[S][C],"compact"===S?"pb-2":"pb-4",g[C],J?.body??""),children:M})})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Reasoning}from"./Reasoning.js";
|