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
|
@@ -23,8 +23,8 @@ export interface FilePickerProps extends NebaStyleProps, Omit<React.ComponentPro
|
|
|
23
23
|
/** The largest a single file may be, in bytes. */
|
|
24
24
|
maxSize?: number;
|
|
25
25
|
/**
|
|
26
|
-
* How many files may be held at once
|
|
27
|
-
* against what is already chosen rather than against one drop.
|
|
26
|
+
* How many files may be held at once, counted only when `multiple` is on,
|
|
27
|
+
* and checked against what is already chosen rather than against one drop.
|
|
28
28
|
*/
|
|
29
29
|
maxFiles?: number;
|
|
30
30
|
/** The chosen files. Use with `onFilesChange` for a controlled picker. */
|
|
@@ -45,7 +45,7 @@ export interface FilePickerProps extends NebaStyleProps, Omit<React.ComponentPro
|
|
|
45
45
|
error?: React.ReactNode;
|
|
46
46
|
/** Forces the invalid state without a message. Defaults to `!!error`. */
|
|
47
47
|
invalid?: boolean;
|
|
48
|
-
/** The line inside the box. Defaults to
|
|
48
|
+
/** The line inside the box. Defaults to the `locale`'s sentence. */
|
|
49
49
|
title?: React.ReactNode;
|
|
50
50
|
/** The line under it — what is accepted, how big, how many. */
|
|
51
51
|
hint?: React.ReactNode;
|
|
@@ -56,8 +56,16 @@ export interface FilePickerProps extends NebaStyleProps, Omit<React.ComponentPro
|
|
|
56
56
|
* @default true
|
|
57
57
|
*/
|
|
58
58
|
showList?: boolean;
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Accessible name of a file's remove button. Receives the file's name, and
|
|
61
|
+
* overrides the `locale`'s words.
|
|
62
|
+
*/
|
|
60
63
|
removeLabel?: (name: string) => string;
|
|
64
|
+
/**
|
|
65
|
+
* Which language the box's own words are in — the line inside it and the
|
|
66
|
+
* remove buttons — as a BCP 47 tag. Unsupported tags fall back to English.
|
|
67
|
+
*/
|
|
68
|
+
locale?: string;
|
|
61
69
|
/** Stretches to the width of the container. @default true */
|
|
62
70
|
fullWidth?: boolean;
|
|
63
71
|
/** Unavailable. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{useDropZone as r}from"../../internal/drop.js";import{glowClasses as l,spotlightSlot as a,trackPointer as o}from"../../internal/glow.js";import{CloseIcon as i}from"../../internal/icons.js";import{fileMessages as s,fillMessage as c,useMessages as d}from"../../internal/i18n.js";import{controlTextLeadingClasses as u,cx as f,disabledClasses as m,gapClasses as p,hasContent as h,iconClasses as b,metaTextClasses as v,radiusClasses as x,readOnlyFilterClasses as g,sheetTitleClasses as y,stackGapClasses as k,surfaceClasses as $,surfaceSlots as j,transitionClasses as N}from"../../internal/styles.js";import{useStyleDefaults as w}from"../../internal/defaults.js";const z={default:{xs:"p-4",sm:"p-5",md:"p-6",lg:"p-8",xl:"p-10"},compact:{xs:"p-2",sm:"p-3",md:"p-4",lg:"p-5",xl:"p-6"}},C={solid:[$,"border-2 border-dashed text-(--neba-fg) bg-(--n-panel-hover)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),outline:[$,"border-2 border-dashed text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"border-2 border-dashed text-(--neba-fg) bg-transparent [border-color:var(--n-line)]"},I={solid:"hover:bg-(--n-panel-press) hover:[border-color:var(--n-line-hover)]",outline:"hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)]",text:"hover:bg-(--n-soft) hover:[border-color:var(--n-line-hover)]"};function UploadIcon(){return n("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("path",{d:"M8 10.5V2.75m0 0L5.25 5.5M8 2.75 10.75 5.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M2.75 9.75v1.75a1.75 1.75 0 0 0 1.75 1.75h7a1.75 1.75 0 0 0 1.75-1.75V9.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function formatFileSize(e){if(e<1e3)return`${e} B`;const n=["kB","MB","GB","TB"];let t=e/1e3,r=0;for(;t>=1e3&&r<n.length-1;)t/=1e3,r+=1;return`${t<10?t.toFixed(1):Math.round(t)} ${n[r]}`}function L(e,n){const t=e.name.toLowerCase(),r=e.type.toLowerCase();return n.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>e.startsWith(".")?t.endsWith(e):e.endsWith("/*")?r.startsWith(`${e.slice(0,-1)}`):r===e)}export const FilePicker=/*@__PURE__*/t.forwardRef(function FilePicker($,_){const{variant:M="outline",size:F="md",color:B="primary",density:E="default",elevation:W=0,accept:R,multiple:S=!1,maxSize:T,maxFiles:P,value:V,defaultValue:q,onFilesChange:A,onReject:D,label:O,description:U,error:G,invalid:H,title:Y,hint:J,icon:K,showList:Q=!0,removeLabel:X,fullWidth:Z=!0,disabled:ee=!1,readOnly:ne=!1,required:te=!1,name:re,id:le,locale:ae,className:oe,style:ie,...se}=w($,["size","density","variant","locale"]),ce=d(s,ae),de=X??(e=>c(ce.remove,{name:e})),ue=t.useRef(null);t.useImperativeHandle(_,()=>ue.current);const[fe,me]=t.useState(()=>[...q??[]]),pe=t.useMemo(()=>V?[...V]:fe,[V,fe]),he=h(G),be=H??he,ve=be?"danger":B,xe=ee||ne,ge=t.useId(),ye=t.useId(),ke=t.useId(),$e=le??ke,je=t.useCallback(e=>{V||me(e),A?.(e)},[A,V]),Ne=t.useCallback(e=>{const n=[],t=[],r=S?P??Number.POSITIVE_INFINITY:1,l=S?pe.length:0;for(const a of e)R&&!L(a,R)?t.push({file:a,reason:"type"}):void 0!==T&&a.size>T?t.push({file:a,reason:"size"}):l+n.length>=r?t.push({file:a,reason:"count"}):n.push(a);return{kept:n,rejections:t}},[R,pe.length,P,T,S]),we=t.useCallback(e=>{const{kept:n,rejections:t}=Ne(e);t.length>0&&D?.(t),n.length>0&&je(S?[...pe,...n]:n)},[Ne,je,pe,S,D]),{over:ze,handlers:Ce}=r(xe?void 0:we),Ie=t.useRef(null),Le=t.useRef(null),_e=t.useRef(null);t.useLayoutEffect(()=>{const e=_e.current;if(null===e)return;_e.current=null;const n=Le.current?.querySelectorAll("li button")??[],t=n[Math.min(e,n.length-1)]??Ie.current;t?.focus()},[pe]);const Me=t.useCallback(()=>{const e=ue.current;if(e&&"undefined"!=typeof DataTransfer)try{const n=new DataTransfer;pe.forEach(e=>n.items.add(e)),e.files=n.files}catch{}},[pe]);t.useEffect(()=>{Me();const e=ue.current;return e?.addEventListener("cancel",Me),()=>e?.removeEventListener("cancel",Me)},[Me]);const Fe=f("flex w-full flex-col items-center justify-center text-center","cursor-pointer select-none",z[E][F],x[F],p[F],N,b,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",ee?`${m[M]} border-2 border-dashed`:ne?`${C[M]} ${g} cursor-default`:C[M],xe?"":`${I[M]} ${l}`,ze&&!xe?"bg-(--n-soft-press) [border-color:var(--n-ring)]":"");return n("div",{className:f("flex-col align-top",k[F],Z?"flex w-full":"inline-flex",oe??""),style:{...j(ve,W),...xe?void 0:a,...ie},...se,children:[h(O)?e("span",{id:ye,className:[v[F],"font-medium",ee?"text-(--neba-disabled-fg)":"text-(--neba-fg)"].join(" "),children:O}):null,n("div",{className:"flex w-full flex-col",...Ce,children:[n("button",{ref:Ie,onPointerMove:o(void 0,!xe),type:"button",id:$e,disabled:ee,"aria-labelledby":h(O)?`${ye} ${$e}`:void 0,"aria-describedby":h(U)||he?ge:void 0,"aria-invalid":be||void 0,className:Fe,onClick:()=>{xe||ue.current&&(ue.current.value="",ue.current.click())},children:[void 0===K?e("span",{className:"flex items-center text-(--n-accent) [&_svg]:size-[1.8em]",children:e(UploadIcon,{})}):h(K)?e("span",{className:"flex items-center text-(--n-accent) [&_svg]:size-[1.8em]",children:K}):null,e("span",{className:`font-medium ${y[F]}`,children:Y??ce.title}),h(J)?e("span",{className:`text-(--neba-muted-fg) ${v[F]}`,children:J}):null]}),e("input",{ref:ue,type:"file",name:re,accept:R,multiple:S,required:te&&0===pe.length,disabled:ee,tabIndex:-1,"aria-hidden":"true",className:"absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onChange:e=>we(Array.from(e.target.files??[]))})]}),Q&&pe.length>0?e("ul",{ref:Le,role:"list",className:`flex w-full flex-col ${k[F]} m-0 list-none p-0`,children:pe.map((t,r)=>n("li",{className:["flex w-full items-center gap-2 px-2 py-1.5",x.xs,u[F],"bg-(--n-soft) text-(--neba-fg)"].join(" "),children:[e("span",{className:"min-w-0 flex-1 truncate",children:t.name}),e("span",{className:`shrink-0 text-(--neba-muted-fg) tabular-nums ${v[F]}`,children:formatFileSize(t.size)}),xe?null:e("button",{type:"button","aria-label":de(t.name),className:["inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full","size-[1.3em] text-(--neba-muted-fg) opacity-70","[transition:opacity_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","[&_svg]:size-[0.9em]","hover:text-(--neba-fg) hover:opacity-100 focus-visible:opacity-100","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"].join(" "),onClick:e=>{_e.current=e.currentTarget===document.activeElement?r:null,je(pe.filter((e,n)=>n!==r))},children:e(i,{})})]},`${t.name}-${t.size}-${t.lastModified}-${r}`))}):null,h(U)&&!he?e("span",{id:ge,className:`${v[F]} text-(--neba-muted-fg)`,children:U}):null,he?e("span",{id:ge,className:`${v[F]} text-(--n-accent)`,children:G}):null]})});
|
|
@@ -34,9 +34,15 @@ export interface FlexProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
34
34
|
* @default 0
|
|
35
35
|
*/
|
|
36
36
|
spacing?: NebaResponsive<number>;
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The vertical gap only, whatever `direction` is: between wrapped lines in a
|
|
39
|
+
* row and between the children of a column. Falls back to `spacing`.
|
|
40
|
+
*/
|
|
38
41
|
rowSpacing?: NebaResponsive<number>;
|
|
39
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The horizontal gap only, whatever `direction` is: between the children of a
|
|
44
|
+
* row and between wrapped lines in a column. Falls back to `spacing`.
|
|
45
|
+
*/
|
|
40
46
|
columnSpacing?: NebaResponsive<number>;
|
|
41
47
|
/** How the row distributes the space its children did not use. */
|
|
42
48
|
justifyContent?: NebaJustifyContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignContentClasses as n,alignItemsClasses as i,justifyContentClasses as t,spacingValue as a}from"../../internal/grid.js";import{overlayResponsive as o,responsiveSlots as l,withBaseline as s}from"../../internal/responsive.js";import{cx as p}from"../../internal/styles.js";function c(e){return r=>{const n="vertical"===r?"column":"row";return e?`${n}-reverse`:n}}export const Flex=/*@__PURE__*/e.forwardRef(function({direction:e,reverse:f=!1,spacing:m,rowSpacing:x,columnSpacing:g,justifyContent:d,alignItems:u,alignContent:y,wrap:w=!1,inline:v=!1,render:j,className:h,style:b,children:C,...
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{alignContentClasses as n,alignItemsClasses as i,justifyContentClasses as t,spacingValue as a}from"../../internal/grid.js";import{overlayResponsive as o,responsiveSlots as l,withBaseline as s}from"../../internal/responsive.js";import{cx as p}from"../../internal/styles.js";function c(e){return r=>{const n="vertical"===r?"column":"row";return e?`${n}-reverse`:n}}export const Flex=/*@__PURE__*/e.forwardRef(function Flex({direction:e,reverse:f=!1,spacing:m,rowSpacing:x,columnSpacing:g,justifyContent:d,alignItems:u,alignContent:y,wrap:w=!1,inline:v=!1,render:j,className:h,style:b,children:C,...F},N){const S=p("neba-flex",v?"inline-flex":"flex","[flex-direction:var(--n-flex-dir)] gap-x-(--n-gap-x) gap-y-(--n-gap-y)",w?"flex-wrap":"flex-nowrap",d?t[d]:"",u?i[u]:"",y?n[y]:"",h??"");return r({render:j,ref:N,props:{className:S,style:{...l("flex-dir",s(e,"horizontal"),c(f)),...l("gap-x",o(s(m,0),g),a),...l("gap-y",o(s(m,0),x),a),...b},children:C,...F}})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { NebaCorner, NebaElevation, NebaPosition, NebaStyleProps } from '../../types.js';
|
|
2
|
+
import type { NebaCorner, NebaElevation, NebaPosition, NebaSlots, NebaStyleProps } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Where a floating button sits, with one value the shared vocabulary does not
|
|
5
5
|
* have.
|
|
@@ -19,9 +19,17 @@ export type FloatingActionButtonPosition = NebaPosition | 'absolute';
|
|
|
19
19
|
* a dial that fans sideways out of a corner fans into the edge of the screen.
|
|
20
20
|
*/
|
|
21
21
|
export type FloatingActionButtonDirection = 'top' | 'bottom';
|
|
22
|
+
/**
|
|
23
|
+
* The parts of a FloatingActionButton a `classNames` entry can reach. `className`
|
|
24
|
+
* and `style` are the button's; `frame` is the box pinned to the corner, which
|
|
25
|
+
* holds the button and its dial.
|
|
26
|
+
*/
|
|
27
|
+
export type FloatingActionButtonSlot = 'frame';
|
|
22
28
|
export interface FloatingActionButtonProps extends NebaStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'onClick'> {
|
|
23
29
|
/** The glyph on the button. @default a plus */
|
|
24
30
|
icon?: React.ReactNode;
|
|
31
|
+
/** Classes for the box pinned to the corner. `className` goes on the button itself. */
|
|
32
|
+
classNames?: NebaSlots<FloatingActionButtonSlot>;
|
|
25
33
|
/**
|
|
26
34
|
* What the button does, in words.
|
|
27
35
|
*
|
|
@@ -65,6 +73,13 @@ export interface FloatingActionButtonProps extends NebaStyleProps, Omit<React.Co
|
|
|
65
73
|
* @default 16
|
|
66
74
|
*/
|
|
67
75
|
offset?: number | string;
|
|
76
|
+
/**
|
|
77
|
+
* Adds the screen's `env(safe-area-inset-*)` to `offset` on the edge the
|
|
78
|
+
* corner is against, so a button pinned to the bottom of a phone clears its
|
|
79
|
+
* home indicator. Only a `fixed` or `sticky` button is ever against that edge.
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
safeArea?: boolean;
|
|
68
83
|
/**
|
|
69
84
|
* Which way the actions fan out. Taken from `corner` when it is left out — up
|
|
70
85
|
* from the bottom of the screen, down from the top — which is right often
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Button as n}from"../button/Button.js";import{CloseIcon as s,PlusIcon as a}from"../../internal/icons.js";import{cx as r,hasContent as i,metaTextClasses as l,radiusClasses as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Button as n}from"../button/Button.js";import{CloseIcon as s,PlusIcon as a}from"../../internal/icons.js";import{cx as r,hasContent as i,metaTextClasses as l,radiusClasses as c,surfaceClasses as f}from"../../internal/styles.js";import{useStyleDefaults as d}from"../../internal/defaults.js";const m=/*@__PURE__*/o.createContext({variant:"solid",size:"md",color:"primary",density:"default",elevation:1,showLabels:!0,reversed:!0,close:()=>{},closesOnAction:!1,focusTrigger:()=>{}}),u={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"lg"},b="lg",p={static:"",absolute:"absolute z-30",sticky:"sticky z-30",fixed:"fixed z-40"},v={"top-start":"top-(--n-fab-offset) start-(--n-fab-offset)","top-end":"top-(--n-fab-offset) end-(--n-fab-offset)","bottom-start":"bottom-(--n-fab-offset) start-(--n-fab-offset)","bottom-end":"bottom-(--n-fab-offset) end-(--n-fab-offset)"},x={"top-start":"top-[calc(var(--n-fab-offset)_+_env(safe-area-inset-top))] start-(--n-fab-offset)","top-end":"top-[calc(var(--n-fab-offset)_+_env(safe-area-inset-top))] end-(--n-fab-offset)","bottom-start":"bottom-[calc(var(--n-fab-offset)_+_env(safe-area-inset-bottom))] start-(--n-fab-offset)","bottom-end":"bottom-[calc(var(--n-fab-offset)_+_env(safe-area-inset-bottom))] end-(--n-fab-offset)"},g=r("pointer-events-none max-w-40 truncate select-none","px-2 py-0.5 text-(--neba-fg) bg-(--n-panel)",f,c.xs,"[box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]");export const FloatingActionButton=/*@__PURE__*/o.forwardRef(function FloatingActionButton(i,l){const{variant:c="solid",size:f=b,color:g="primary",density:y="default",elevation:h=2,icon:w,label:z,extended:_=!1,openIcon:k,position:A="fixed",corner:C="bottom-end",offset:N=16,safeArea:L=!0,direction:j,open:E,defaultOpen:O=!1,onOpenChange:R,openOnHover:P=!0,closeOnAction:T=!0,showLabels:F=!0,disabled:I=!1,className:B,classNames:D,style:K,children:W,onClick:H,onKeyDown:M,onPointerEnter:S,onPointerLeave:$,...q}=d(i,["size","density","variant"]),G=o.useId(),J=o.useRef(null),Q=o.useRef(null),[U,V]=o.useState(O),X=void 0!==E,Y=o.Children.toArray(W).length>0,Z=(X?E:U)&&Y&&!I,ee=o.useCallback(e=>{X||V(e),R?.(e)},[X,R]),te=o.useCallback(()=>ee(!1),[ee]),oe=o.useRef(!1);o.useEffect(()=>{if(!Z)return;const e=e=>{const t=Q.current;t&&e.target instanceof Node&&!t.contains(e.target)&&te()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[Z,te]);const ne=j??(C.startsWith("bottom")?"top":"bottom"),se=C.endsWith("end"),ae=o.useMemo(()=>({variant:c,size:u[f],color:g,density:y,elevation:h,showLabels:F,reversed:se,close:T?te:()=>{},closesOnAction:T,focusTrigger:()=>J.current?.focus()}),[c,f,g,y,h,F,se,T,te]),re=Z&&!1!==k?k??e(s,{}):w??e(a,{});return t("div",{ref:e=>{Q.current=e,"function"==typeof l?l(e):l&&(l.current=e)},className:r("flex w-fit","top"===ne?"flex-col-reverse":"flex-col",se?"items-end":"items-start","xs"===f||"sm"===f?"gap-1.5":"gap-2",p[A],"static"===A?"":!L||"fixed"!==A&&"sticky"!==A?v[C]:x[C],D?.frame),style:{"--n-fab-offset":"number"==typeof N?`${N}px`:N},onKeyDown:e=>{"Escape"===e.key&&Z&&(e.stopPropagation(),te(),J.current?.focus()),M?.(e)},onPointerEnter:e=>{P&&Y&&!I&&"mouse"===e.pointerType&&(oe.current=!Z,ee(!0)),S?.(e)},onPointerLeave:e=>{P&&"mouse"===e.pointerType&&(oe.current=!1,te()),$?.(e)},...q,children:[e(n,{ref:J,variant:c,size:f,color:g,density:y,elevation:h,disabled:I,"aria-label":z,"aria-expanded":Y?Z:void 0,"aria-controls":Y&&Z?G:void 0,startIcon:re,className:B,style:{borderRadius:"9999px",...K},onClick:e=>{Y&&(Z&&oe.current?oe.current=!1:ee(!Z)),H?.(e)},children:_?z:void 0}),Z?e("div",{id:G,className:r("flex","top"===ne?"flex-col-reverse":"flex-col",se?"items-end":"items-start","xs"===f||"sm"===f?"gap-1.5":"gap-2","[animation:neba-anim-fade_var(--neba-duration)_var(--neba-ease)_both]"),children:e(m.Provider,{value:ae,children:W})}):null]})});export const FloatingAction=/*@__PURE__*/o.forwardRef(function FloatingAction({icon:s,label:a,disabled:c=!1,className:f,style:d,onClick:u,...b},p){const v=o.useContext(m);return t("div",{className:r("flex items-center gap-2",v.reversed?"flex-row-reverse":"flex-row",f),children:[e(n,{ref:p,variant:v.variant,size:v.size,color:v.color,density:v.density,elevation:v.elevation,disabled:c,"aria-label":a,startIcon:s,style:{borderRadius:"9999px",...d},onClick:e=>{const t=e.currentTarget===document.activeElement;u?.(e),v.close(),t&&v.closesOnAction&&v.focusTrigger()},...b}),v.showLabels&&i(a)?e("span",{"aria-hidden":"true",className:r(g,l[v.size]),children:a}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useRender as n}from"@base-ui/react/use-render";import{barMinHeightClasses as r,BottomNavigationContext as o}from"../../internal/bottom-navigation.js";import{observeResize as s}from"../../internal/observe.js";import{cx as i,surfaceClasses as l,surfaceSlots as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useRender as n}from"@base-ui/react/use-render";import{barMinHeightClasses as r,BottomNavigationContext as o}from"../../internal/bottom-navigation.js";import{observeResize as s}from"../../internal/observe.js";import{cx as i,surfaceClasses as l,surfaceSlots as d,transitionClasses as f}from"../../internal/styles.js";import{useStyleDefaults as u}from"../../internal/defaults.js";const p={solid:[l,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[l,"border text-(--neba-fg) bg-(--n-panel-hover)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},m={static:"relative mx-auto w-fit",absolute:"absolute inset-x-0 bottom-(--n-nav-offset) z-30 mx-auto w-fit",sticky:"sticky bottom-(--n-nav-offset) z-30 mx-auto w-fit",fixed:"fixed inset-x-0 bottom-(--n-nav-offset) z-40 mx-auto w-fit"},v={default:{xs:"p-1",sm:"p-1",md:"p-1.5",lg:"p-1.5",xl:"p-2"},compact:{xs:"p-0.5",sm:"p-0.5",md:"p-1",lg:"p-1",xl:"p-1"}},c={solid:`${l} bg-(--n-panel-hover) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,outline:`${l} bg-(--n-soft-hover) [box-shadow:var(--neba-shadow-1),var(--neba-plate-glass)]`,text:"bg-(--n-soft-hover)"},b={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const FloatingBottomNavigation=/*@__PURE__*/a.forwardRef(function FloatingBottomNavigation(l,x){const{variant:g="outline",size:y="md",color:h="primary",density:w="default",elevation:j=2,value:$,defaultValue:z=null,onValueChange:N,position:k="fixed",offset:A=16,labels:P="selected",safeArea:C=!0,disabled:E=!1,label:L,render:R,className:B,style:F,children:S,...V}=u(l,["size","density","variant"]),[W,q]=a.useState(z),H=void 0!==$,M=H?$:W,T=a.useCallback(e=>{H||q(e),N?.(e)},[H,N]),D=a.useMemo(()=>({value:M??null,change:T,size:y,density:w,labels:P,disabled:E,floating:!0}),[M,T,y,w,P,E]),G=a.useRef(null),I=a.useRef(null),J=a.useCallback(e=>{G.current=e,"function"==typeof x?x(e):x&&(x.current=e)},[x]),K=a.useCallback(e=>{const t=G.current,a=I.current;if(!t||!a)return;const n=t.querySelector("[data-nav-item][aria-current]");if(a.hidden=!n,!n)return void a.removeAttribute("data-ready");const r=!e||!a.hasAttribute("data-ready");r&&a.removeAttribute("data-ready"),a.style.setProperty("--n-nav-x",`${n.offsetLeft}px`),a.style.setProperty("--n-nav-y",`${n.offsetTop}px`),a.style.setProperty("--n-nav-w",`${n.offsetWidth}px`),a.style.setProperty("--n-nav-h",`${n.offsetHeight}px`),r&&a.offsetWidth,a.setAttribute("data-ready","")},[]);a.useLayoutEffect(()=>{K(!0)},[K,M,g,y,w,P,S]),a.useEffect(()=>{const e=G.current;if(!e)return;const t=e=>{"grid-template-columns"===e.propertyName&&K(!0)},a=s(e,()=>K(!1));return e.addEventListener("transitionend",t),()=>{a(),e.removeEventListener("transitionend",t)}},[K]);const O="number"==typeof A?`${A}px`:A,Q=i("flex max-w-full min-w-0 items-center rounded-full",r[y],v[w][y],b[y],p[g],m[k],f,B);return n({render:R??e("nav",{}),ref:J,props:{"aria-label":L,className:Q,style:{...d(h,j),"--n-nav-offset":C?`calc(${O} + env(safe-area-inset-bottom))`:O,...F},children:t(o.Provider,{value:D,children:[null!=M?e("span",{ref:I,"aria-hidden":"true",className:i("pointer-events-none absolute rounded-full","top-(--n-nav-y) left-(--n-nav-x) h-(--n-nav-h) w-(--n-nav-w)",c[g],"[transition-property:left,top,width,height]","[transition-timing-function:var(--neba-ease)]","[transition-duration:0ms] data-[ready]:[transition-duration:var(--neba-duration)]","motion-reduce:[transition-duration:0ms]")}):null,S]}),...V}})});
|
|
@@ -11,6 +11,14 @@ export interface FooterProps extends Omit<React.ComponentPropsWithoutRef<'footer
|
|
|
11
11
|
* @default 'static'
|
|
12
12
|
*/
|
|
13
13
|
position?: NebaPosition;
|
|
14
|
+
/**
|
|
15
|
+
* Keeps it clear of a phone's home indicator and notch, on a page laid out
|
|
16
|
+
* under them with `viewport-fit=cover`, by adding the screen's
|
|
17
|
+
* `env(safe-area-inset-*)` on the edge it is held against. Only a `fixed` or
|
|
18
|
+
* `sticky` one is ever against that edge, so a `static` one is left alone.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
safeArea?: boolean;
|
|
14
22
|
/**
|
|
15
23
|
* Weight of the sheet, said the way a *container* says it: the bar is never
|
|
16
24
|
* dyed, because what is on it arrives with colours of its own.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{useRender as r}from"@base-ui/react/use-render";import{boxPaddingXClasses as a,boxPaddingYClasses as o}from"../box/Box.js";import{PageLayoutContext as n}from"../../internal/page-layout.js";import{cx as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{useRender as r}from"@base-ui/react/use-render";import{boxPaddingXClasses as a,boxPaddingYClasses as o}from"../box/Box.js";import{PageLayoutContext as n,PageLayoutSlotContext as s}from"../../internal/page-layout.js";import{cx as i,measureValue as l,surfaceClasses as m,surfaceSlots as f,transitionClasses as d}from"../../internal/styles.js";import{responsiveSlots as c}from"../../internal/responsive.js";import{useStyleDefaults as p}from"../../internal/defaults.js";const b={solid:[m,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[m,"text-(--neba-fg) bg-(--n-panel)","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},x={static:"",sticky:"sticky bottom-0 z-30",fixed:"fixed inset-x-0 bottom-0 z-40"};export const Footer=/*@__PURE__*/t.forwardRef(function Footer(m,u){const{position:v="static",safeArea:y=!0,variant:g="outline",size:j="md",color:w="primary",density:h="default",elevation:z=0,divider:k=!0,maxWidth:C,padded:N=!0,label:F,render:A,className:B,style:R,children:W,...q}=p(m,["size","density","variant"]),D=t.useContext(n),{register:E}=D,G="footer"===t.useContext(s),H=t.useCallback(e=>{G&&E("footer",e),"function"==typeof u?u(e):u&&(u.current=e)},[E,u,G,v]),I=i("w-full min-w-0",b[g],k?"border-t [border-color:var(--n-line)]":"",x[v],y&&"static"!==v?"pb-[env(safe-area-inset-bottom)]":"",d,B);return r({render:A??e("footer",{}),ref:H,props:{"aria-label":F,className:I,style:{...f(w,z),...R},children:e("div",{className:i("w-full",N?i(a[h][j],o[h][j]):"","neba-measure mx-auto max-w-(--n-max-w)"),style:c("max-w",C,l),children:W}),...q}})});
|
|
@@ -29,8 +29,10 @@ export interface FormProps extends Omit<React.ComponentPropsWithoutRef<'form'>,
|
|
|
29
29
|
*/
|
|
30
30
|
errors?: FormErrors;
|
|
31
31
|
/**
|
|
32
|
-
* Called on a valid submit, with the form's values.
|
|
33
|
-
* prevented, so nothing navigates.
|
|
32
|
+
* Called on a valid submit, with the form's values. When it is given, the
|
|
33
|
+
* native submit event is prevented, so nothing navigates. Without it the
|
|
34
|
+
* submit goes ahead, which is what lets an `action` run (a function `action`
|
|
35
|
+
* is React 19's).
|
|
34
36
|
*/
|
|
35
37
|
onSubmit?: (values: Record<string, unknown>) => void;
|
|
36
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r}from"react/jsx-runtime";import*as o from"react";import{Form as e}from"@base-ui/react/form";import{cx as t,sheetSectionGapClasses as i}from"../../internal/styles.js";export const Form=/*@__PURE__*/o.forwardRef(function({validationMode:
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import*as o from"react";import{Form as e}from"@base-ui/react/form";import{cx as t,sheetSectionGapClasses as i}from"../../internal/styles.js";import{useStyleDefaults as m}from"../../internal/defaults.js";export const Form=/*@__PURE__*/o.forwardRef(function Form(o,s){const{validationMode:a="onSubmit",errors:n,onSubmit:l,size:f="md",className:c,children:d,...u}=m(o,["size"]);return r(e,{ref:s,validationMode:a,errors:n,onFormSubmit:l?r=>l(r):void 0,className:t("flex flex-col",i[f],c??""),...u,children:d})});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NebaAspectFit } from '../aspect-ratio/AspectRatio.js';
|
|
3
|
+
import type { NebaImageFilter, NebaImageFlip, NebaImageFrame, NebaImageLetterbox, NebaImagePlaceholderOptions, NebaImagePosition, NebaImageProtection, NebaImageRotation, NebaImageWatermark } from '../image/Image.js';
|
|
3
4
|
import type { NebaResponsive, NebaSize, NebaSlots } from '../../types.js';
|
|
4
5
|
/** The parts a Gallery draws behind its root. */
|
|
5
6
|
export type GallerySlot = 'item' | 'image' | 'caption' | 'title' | 'description';
|
|
@@ -46,8 +47,31 @@ export interface NebaGalleryItem {
|
|
|
46
47
|
* *before* anything has loaded — which is the whole reason it is data rather
|
|
47
48
|
* than a measurement. A set without it falls back to the Gallery's own
|
|
48
49
|
* `ratio`, and comes out as a grid of squares in a masonry's clothing.
|
|
50
|
+
*
|
|
51
|
+
* It is the file's proportion as stored: an item turned onto its side with
|
|
52
|
+
* `rotate` is laid out on its side without anybody working the ratio out
|
|
53
|
+
* again.
|
|
49
54
|
*/
|
|
50
55
|
ratio?: number | string;
|
|
56
|
+
/**
|
|
57
|
+
* Turns the picture clockwise, a quarter at a time — for the photograph that
|
|
58
|
+
* was shot sideways. Follows the picture into the viewer.
|
|
59
|
+
* @default 0
|
|
60
|
+
*/
|
|
61
|
+
rotate?: NebaImageRotation;
|
|
62
|
+
/** Mirrors the picture. Follows it into the viewer. @default 'none' */
|
|
63
|
+
flip?: NebaImageFlip;
|
|
64
|
+
/**
|
|
65
|
+
* Which part of the picture a tile keeps when it crops, or where the space
|
|
66
|
+
* goes when it does not.
|
|
67
|
+
* @default 'center'
|
|
68
|
+
*/
|
|
69
|
+
position?: NebaImagePosition;
|
|
70
|
+
/**
|
|
71
|
+
* A small copy of the picture — a URL, a data URI or a `Blob` — to stand in
|
|
72
|
+
* while the tile's file arrives, instead of a Skeleton.
|
|
73
|
+
*/
|
|
74
|
+
placeholder?: NebaImagePlaceholderOptions;
|
|
51
75
|
/** How many columns the tile takes in `quilted`. @default 1 */
|
|
52
76
|
cols?: number;
|
|
53
77
|
/** How many rows the tile takes in `quilted`. @default 1 */
|
|
@@ -85,15 +109,33 @@ export interface GalleryProps extends Omit<React.ComponentPropsWithoutRef<'ul'>,
|
|
|
85
109
|
rowHeight?: number;
|
|
86
110
|
/** Rounds the tiles. @default 'md' */
|
|
87
111
|
rounded?: NebaSize | boolean;
|
|
112
|
+
/**
|
|
113
|
+
* How a picture fills its tile. `cover` crops it to the tile; `contain` and
|
|
114
|
+
* `scale-down` keep all of it, which is what a set of product shots on a
|
|
115
|
+
* contact sheet wants, and leave space that `letterbox` fills.
|
|
116
|
+
* @default 'cover'
|
|
117
|
+
*/
|
|
118
|
+
fit?: NebaAspectFit;
|
|
119
|
+
/** Passed to every tile's picture: what fills the space `fit` leaves. */
|
|
120
|
+
letterbox?: NebaImageLetterbox | (string & {});
|
|
121
|
+
/**
|
|
122
|
+
* When the tiles' files load. `lazy` waits until a tile is near the screen,
|
|
123
|
+
* so a wall of forty photographs asks for the few a reader can see rather
|
|
124
|
+
* than all forty at once. Set `eager` when the gallery is the largest thing
|
|
125
|
+
* above the fold, where a lazy first row arrives later than it should.
|
|
126
|
+
* @default 'lazy'
|
|
127
|
+
*/
|
|
128
|
+
loading?: 'lazy' | 'eager';
|
|
88
129
|
/**
|
|
89
130
|
* Where a tile's `title` and `description` go. `below` puts them under the
|
|
90
131
|
* picture, `overlay` writes them across the foot of it, and `hover` is
|
|
91
|
-
* `overlay` that arrives with the pointer
|
|
132
|
+
* `overlay` that arrives with the pointer or the keyboard focus, and stays up
|
|
133
|
+
* on a screen that cannot hover.
|
|
92
134
|
* @default 'none'
|
|
93
135
|
*/
|
|
94
136
|
caption?: NebaGalleryCaption;
|
|
95
137
|
/**
|
|
96
|
-
* What a tile does under the pointer.
|
|
138
|
+
* What a tile does under the pointer, and under the keyboard focus.
|
|
97
139
|
*
|
|
98
140
|
* `lift` and `dim` are depth and colour, which is how everything else in the
|
|
99
141
|
* library answers a pointer. `zoom` is the one that scales, and it is the
|
|
@@ -133,6 +175,17 @@ export interface GalleryProps extends Omit<React.ComponentPropsWithoutRef<'ul'>,
|
|
|
133
175
|
/** Class names for the parts behind the root. */
|
|
134
176
|
classNames?: NebaSlots<GallerySlot>;
|
|
135
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Whether an item is turned onto its side, whatever number its turn was written
|
|
180
|
+
* as. Exported for the viewer, and deliberately left out of the barrel.
|
|
181
|
+
*/
|
|
182
|
+
export declare function isSideways(item: NebaGalleryItem): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* The shape an item is drawn in: its own ratio, on its side when it is turned.
|
|
185
|
+
* An item with no ratio takes the Gallery's, which is the layout's shape and has
|
|
186
|
+
* nothing to turn.
|
|
187
|
+
*/
|
|
188
|
+
export declare function shownRatioOf(item: NebaGalleryItem, fallback: number): number;
|
|
136
189
|
/**
|
|
137
190
|
* A set of pictures, arranged.
|
|
138
191
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import*as r from"react";import{Image as o}from"../image/Image.js";import{responsiveSlots as l,withBaseline as a}from"../../internal/responsive.js";import{useBreakpointValue as s}from"../../hooks/useMediaQuery.js";import{fillMessage as n,galleryMessages as u,useMessages as d}from"../../internal/i18n.js";import{cx as m,hasContent as c,metaTextClasses as p,radiusClasses as f,sheetTitleClasses as h,toLength as g,transitionClasses as x}from"../../internal/styles.js";import{useStyleDefaults as b}from"../../internal/defaults.js";const v=r.lazy(()=>import("./GalleryViewer.js").then(e=>({default:e.GalleryViewer}))),w={xs:2,sm:3,lg:4},y={xs:"0.25rem",sm:"0.375rem",md:"0.5rem",lg:"0.75rem",xl:"1rem"};function N(e,t){if(void 0===e)return t;if("number"==typeof e)return e>0?e:t;const[i,r]=e.split("/"),o=void 0===r?Number(i):Number(i)/Number(r);return Number.isFinite(o)&&o>0?o:t}export function isSideways(e){return Math.abs(Math.round((e.rotate??0)/90))%2==1}export function shownRatioOf(e,t){const i=N(e.ratio,t);return void 0!==e.ratio&&isSideways(e)?1/i:i}const j={none:"",lift:"group-hover/tile:[box-shadow:var(--neba-shadow-2)] group-has-[:focus-visible]/tile:[box-shadow:var(--neba-shadow-2)] supports-[not_selector(:has(*))]:group-focus-within/tile:[box-shadow:var(--neba-shadow-2)]",dim:"",zoom:""},$={none:"",lift:"",dim:"group-hover/tile:[filter:brightness(0.82)] group-has-[:focus-visible]/tile:[filter:brightness(0.82)] supports-[not_selector(:has(*))]:group-focus-within/tile:[filter:brightness(0.82)]",zoom:"group-hover/tile:[transform:scale(1.06)] group-has-[:focus-visible]/tile:[transform:scale(1.06)] supports-[not_selector(:has(*))]:group-focus-within/tile:[transform:scale(1.06)]"};export const Gallery=/*@__PURE__*/r.forwardRef(function Gallery(_,k){const{items:M,layout:S="grid",columns:z,gap:R="md",ratio:q=1,rowHeight:G=220,rounded:A="md",fit:C="cover",letterbox:I,loading:O="lazy",caption:F="none",hover:V="lift",preview:B=!1,onItemSelect:E,filter:H,frame:Q,watermark:T,protect:W=!1,label:D,locale:J,empty:K,className:L,classNames:P,style:U,...X}=b(_,["locale"]),Y=d(u,J),Z=r.useId(),[ee,te]=r.useState(null),ie=a(z??w,2),re=Math.max(1,s(ie)??2),oe="string"==typeof R&&R in y?y[R]:g(R)??y.md,le=!1===A?"":f[!0===A?"md":A],ae=N(q,1),se=(r,l,a)=>{const s=c(r.title)||c(r.description),u="none"!==F&&s,d="overlay"===F||"hover"===F,f=`${Z}-${l}-title`,g=`${Z}-${l}-description`,b=`${Z}-${l}-position`,v=n(Y.item,{index:String(l+1),total:String(M.length)}),w=e(o,{src:r.src,alt:r.alt,ratio:"grid"===S?q:"quilted"===S?"auto":void 0!==r.ratio&&isSideways(r)?shownRatioOf(r,ae):r.ratio??q,fit:C,position:r.position,letterbox:I,rotate:r.rotate,flip:r.flip,placeholder:r.placeholder,loading:O,rounded:!1,filter:H,frame:Q,watermark:T,protect:W,className:m("size-full",P?.image),classNames:{image:m("motion-reduce:[transition-duration:0ms]",$[V])}}),y=u?t("div",{className:m("min-w-0",d?m("pointer-events-none absolute inset-x-0 bottom-0 flex flex-col gap-0.5 p-2.5 text-white","[background:linear-gradient(to_top,color-mix(in_oklab,#000_72%,transparent),transparent)]","hover"===F?"opacity-0 group-hover/tile:opacity-100 group-has-[:focus-visible]/tile:opacity-100 supports-[not_selector(:has(*))]:group-focus-within/tile:opacity-100 [@media(hover:none)]:opacity-100 [transition:opacity_var(--neba-duration-fill)_var(--neba-ease)]":""):"flex flex-col gap-0.5 pt-1.5",P?.caption),children:[c(r.title)?e("span",{id:f,className:m("truncate font-medium",h.sm,d?"":"text-(--neba-fg)",P?.title),children:r.title}):null,c(r.description)?e("span",{id:g,className:m("truncate",p.md,d?"text-white/80":"text-(--neba-muted-fg)",P?.description),children:r.description}):null]}):null,N=t("span",{className:m("relative block overflow-hidden",le,"quilted"===S||"justified"===S?"size-full":"","[transition:box-shadow_var(--neba-duration)_var(--neba-ease)]",j[V]),children:[w,d?y:null]}),_=d||!u?N:t(i,{children:[N,y]});return e("li",{className:m("group/tile relative m-0 min-w-0 list-none","justified"===S?"flex flex-col":"",P?.item),style:a,children:B||E?t("button",{type:"button","aria-label":u?void 0:`${r.alt} — ${v}`,"aria-labelledby":u?`${c(r.title)?f:g} ${b}`:void 0,"aria-describedby":u&&c(r.title)&&c(r.description)?g:void 0,className:m("block w-full text-start",B?"cursor-zoom-in":"cursor-pointer",x,"focus-visible:[outline:2px_solid_var(--n-ring,var(--neba-primary-ring))] focus-visible:[outline-offset:2px]",le,"justified"===S?"flex-1":""),onClick:()=>(e=>{E?.(M[e],e),B&&te(e)})(l),children:[_,u?e("span",{id:b,hidden:!0,children:v}):null]}):_},r.id??r.src)},ne=m("neba-gallery m-0 list-none p-0","justified"===S?"neba-gallery-justified flex flex-wrap":"","masonry"===S?"flex items-start":"","grid"===S||"quilted"===S?"grid":"",L??""),ue={gap:oe,...l("cols",ie,e=>String(Math.max(1,Math.round(e)))),..."grid"===S||"quilted"===S?{gridTemplateColumns:"repeat(var(--n-cols), minmax(0, 1fr))"}:null,..."quilted"===S?{gridAutoRows:`${G}px`,gridAutoFlow:"dense"}:null,...U};let de;if("masonry"===S){de=function(e,t){const i=Array.from({length:t},()=>[]),r=new Array(t).fill(0);return e.forEach((e,o)=>{let l=0;for(let e=1;e<t;e+=1)r[e]<r[l]&&(l=e);i[l].push(o),r[l]+=1/e}),i}(M.map(e=>shownRatioOf(e,ae)),re).map((t,i)=>e("li",{className:"m-0 flex min-w-0 flex-1 list-none flex-col",style:{gap:oe},children:e("ul",{className:"m-0 flex list-none flex-col p-0",style:{gap:oe},children:t.map(e=>se(M[e],e,{}))})},i))}else de="justified"===S?M.map((e,t)=>{const i=shownRatioOf(e,ae);return se(e,t,{flexGrow:i,flexBasis:i*G+"px",maxWidth:"100%"})}):M.map((e,t)=>se(e,t,"quilted"===S?{gridColumn:`span ${Math.max(1,Math.round(e.cols??1))}`,gridRow:`span ${Math.max(1,Math.round(e.rows??1))}`}:{}));return 0===M.length&&c(K)?e(i,{children:K}):t(i,{children:[e("ul",{ref:k,role:"list","aria-label":D??Y.label,className:ne,style:ue,...X,children:de}),B?e(r.Suspense,{fallback:null,children:e(v,{items:M,index:ee,onIndexChange:te,locale:J,watermark:T,protect:W,messages:Y})}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Dialog as l}from"../dialog/Dialog.js";import{IconButton as n}from"../icon-button/IconButton.js";import{Image as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Dialog as l}from"../dialog/Dialog.js";import{IconButton as n}from"../icon-button/IconButton.js";import{Image as i}from"../image/Image.js";import{ChevronIcon as a}from"../../internal/icons.js";import{fillMessage as r}from"../../internal/i18n.js";import{cx as o,metaTextClasses as s}from"../../internal/styles.js";import{isSideways as c,shownRatioOf as m}from"./Gallery.js";export function GalleryViewer({items:d,index:u,onIndexChange:p,locale:f,watermark:v,protect:h,messages:x}){const g=null!==u,j=null===u?void 0:d[u],y=null===u||u<=0,w=null===u||u>=d.length-1,N=void 0!==j&&c(j),b=N&&void 0!==j.ratio?m(j,1):null,k=e=>{e>=0&&e<d.length&&p(e)};return e(l,{open:g,onOpenChange:e=>{e||p(null)},size:"xl",locale:f,title:j?.title??j?.alt??"",description:j?.description,onKeyDown:e=>{if(null===u||e.metaKey||e.ctrlKey||e.altKey)return;const t="rtl"===getComputedStyle(e.currentTarget).direction?-1:1;"ArrowRight"===e.key?(e.preventDefault(),k(u+t)):"ArrowLeft"===e.key&&(e.preventDefault(),k(u-t))},children:t("div",{className:"flex flex-col gap-3",children:[t("div",{className:"relative flex items-center justify-center",children:[j?e(i,{src:j.full??j.src,alt:j.alt,ratio:b??"auto",fit:"contain",rounded:"md",rotate:j.rotate,flip:j.flip,watermark:v,protect:h,className:N?null===b?"max-h-[70vh]":void 0:"max-h-[70vh] w-auto",classNames:N?void 0:{image:"max-h-[70vh] w-auto object-contain"},style:N?{width:null===b?"100%":`min(100%, calc(70vh * ${b}))`}:void 0},j.id??j.src):null,d.length>1?t("div",{className:"pointer-events-none absolute inset-x-0 flex items-center justify-between px-1",children:[e(n,{variant:"solid",elevation:1,label:x.previous,disabled:y,className:"pointer-events-auto",icon:e("span",{className:"flex items-center rotate-90 rtl:-rotate-90",children:e(a,{})}),onClick:()=>k((u??0)-1)}),e(n,{variant:"solid",elevation:1,label:x.next,disabled:w,className:"pointer-events-auto",icon:e("span",{className:"flex items-center -rotate-90 rtl:rotate-90",children:e(a,{})}),onClick:()=>k((u??0)+1)})]}):null]}),d.length>1?e("p",{className:o("m-0 text-center text-(--neba-muted-fg)",s.md),"aria-live":"polite",children:r(x.item,{index:String((u??0)+1),total:String(d.length)})}):null]})})}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ChartBaseProps } from '../../internal/chart-frame.js';
|
|
3
3
|
import type { NebaThreshold } from '../../types.js';
|
|
4
|
-
export interface GaugeChartProps extends Omit<ChartBaseProps, 'legend' | 'tooltip'> {
|
|
4
|
+
export interface GaugeChartProps extends Omit<ChartBaseProps, 'legend' | 'tooltip' | 'exportable' | 'exportFileName' | 'onExport'> {
|
|
5
5
|
/**
|
|
6
6
|
* The reading. `null` draws the dial with nothing on it, which is the honest
|
|
7
7
|
* picture of an instrument that has not been told anything.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as a,Fragment as e}from"react/jsx-runtime";import*as n from"react";import{ChartSurface as r,useMeasuredWidth as l}from"../../internal/chart-frame.js";import{arcPath as
|
|
1
|
+
"use client";import{jsx as t,jsxs as a,Fragment as e}from"react/jsx-runtime";import*as n from"react";import{ChartSurface as r,useMeasuredWidth as l,chartHeight as s,useMeasuredHeight as i}from"../../internal/chart-frame.js";import{arcPath as o,chartFontSizes as m,compactNumber as h,ringPath as c,textWidth as f,truncate as u}from"../../internal/chart.js";import{numberFormatter as d}from"../../internal/format.js";import{emptyMessages as x,useMessages as p}from"../../internal/i18n.js";import{thresholdColor as M}from"../../internal/progress.js";import{cx as g,hasContent as b,metaTextClasses as v}from"../../internal/styles.js";import{useStyleDefaults as y}from"../../internal/defaults.js";function N(t,a,e,n){const r=(n-90)*Math.PI/180;return[t+e*Math.cos(r),a+e*Math.sin(r)]}export function GaugeChart(j){const{value:k,min:w=0,max:z=100,sweep:S=180,thickness:$=.22,thresholds:W,ticks:q=!1,showRange:A=!0,center:B,caption:C,height:D,format:I,locale:L,label:P,empty:R,size:F="md",variant:G="text",color:Y="primary",padded:E=!1,className:H,...J}=y(j,["size","variant","locale"]),K=n.useRef(null),O=l(K),Q=p(x,L),T=n.useCallback(t=>I?d(L,I).format(t):h(t,L),[I,L]),U=Math.max(1,Math.min(360,S)),V=U/2,X=-V,Z=V,_=z-w,tt=null===k||Number.isNaN(k)||0===_?null:Math.min(1,Math.max(0,(k-w)/_)),at=null===k?Y:M(k,Y,W),et=i(K,"string"==typeof D),nt=s(D,F,et),rt=m[F],lt=Math.min(.9,Math.max(.05,$)),st=V*Math.PI/180,it=U>=360?1:Math.max(0,-Math.cos(st)),ot=U>=180?1:Math.sin(st),mt=Math.sin(st),ht=-Math.cos(st),ct=A&&U<330?[w,z].map(t=>u(T(t),Math.max(0,.28*O),rt)):[],ft=ct.reduce((t,a)=>Math.max(t,f(a,rt)),0),ut=.35*rt,dt=!1===q?0:.85*rt,xt=ht<=.25,pt=xt?0:.5*rt,Mt=xt?rt:rt*(.35+.55*ht),gt=ct.length>0?ht*pt+Mt+.25*rt:0,bt=Math.max(ut,dt),vt=Math.max(ut,dt),yt=Math.max(ut,dt,gt),Nt=[(O/2-bt)/Math.max(.05,ot),(nt-vt-yt)/(1+it)];if(ft>0&&mt>.05){const t=xt?ft/2:ft;Nt.push(Math.max(0,O/2-ut-t)/mt-pt)}const jt=Math.max(0,Math.min(...Nt)),kt=jt*(1-lt),wt=O/2,zt=vt+jt*(1+it)+yt,St=vt+jt+Math.max(0,(nt-zt)/2),$t=O>0,Wt=0===_||$t&&jt<=0,qt=b(C)?1.85*rt:0,At=St-kt*(1-Math.min(1,it))/2,Bt=Math.min(kt,Math.abs(St-At)),Ct=Math.min(kt,Math.abs(St-At-qt/2)),Dt=2*Math.sqrt(Math.max(0,kt*kt-Ct*Ct)),It=B??(null===k?"—":T(k)),Lt="string"==typeof It?f(It,1):0,Pt=Lt>0?Math.max(rt,Math.min(2*rt,function(t,a,e,n,r){const l=t*t/(4*r*r)+n*n,s=2*a*n,i=a*a-e*e;return l<=0||i>=0?0:(Math.sqrt(s*s-4*l*i)-s)/(2*l)}(Lt,Bt,kt,.42,.86))):2*rt,Rt=!1===q?0:Math.max(2,Math.floor(q));return t(r,{...J,variant:G,color:Y,size:F,padded:E,legendSide:"bottom",className:H,legend:null,table:null,children:t("div",{ref:K,className:"relative w-full",style:{height:"string"==typeof D?D:nt},...void 0===P?{}:null===tt||null===k?{role:"img","aria-label":P}:{role:"meter","aria-label":P,"aria-valuenow":k,"aria-valuemin":w,"aria-valuemax":z,"aria-valuetext":["string"==typeof It||"number"==typeof It?String(It):T(k),"string"==typeof C||"number"==typeof C?String(C):""].filter(Boolean).join(" ")},children:Wt?t("div",{className:g("flex h-full items-center justify-center text-(--neba-muted-fg)",v[F]),children:R??Q.title}):$t?a(e,{children:[a("svg",{width:O,height:nt,viewBox:`0 0 ${O} ${nt}`,"aria-hidden":"true",className:"block",children:[t("path",{d:o(wt,St,jt,kt,X,Z),fill:`var(--neba-${Y}-soft)`}),null!==tt?t("path",{d:c(wt,St,(jt+kt)/2,X,Z),fill:"none",stroke:`var(--neba-${at}-fill)`,strokeWidth:jt-kt,pathLength:"1",strokeDasharray:"1",strokeDashoffset:1-tt,style:{transition:"stroke-dashoffset var(--neba-duration-fill) var(--neba-ease), stroke var(--neba-duration) var(--neba-ease)"}}):null,Rt>0?Array.from({length:Rt},(a,e)=>{const n=X+U*e/(Rt-1),[r,l]=N(wt,St,jt+.25*rt,n),[s,i]=N(wt,St,jt+.6*rt,n);return t("line",{x1:r,y1:l,x2:s,y2:i,stroke:"var(--neba-chart-grid)",strokeWidth:1,strokeLinecap:"round"},e)}):null,ct.length>0?[[ct[0],X,"start"],[ct[1],Z,"end"]].map(([a,e,n])=>{const[r,l]=N(wt,St,jt+pt,e);return t("text",{x:r,y:l+Mt,textAnchor:xt?"middle":"start"===n?"end":"start",fontSize:rt,fill:"var(--neba-muted-fg)",children:a},n)}):null]}),a("div",{className:"pointer-events-none absolute inset-x-0 mx-auto flex flex-col items-center gap-0.5 text-center",style:{top:At+qt/2,maxWidth:Dt,transform:"translateY(-50%)"},children:[t("span",{className:"font-semibold tabular-nums text-(--neba-fg)",style:{fontSize:Pt},children:It}),C?t("span",{className:g("text-(--neba-muted-fg)",v[F]),children:C}):null]})]}):a("div",{className:"flex h-full flex-col items-center justify-center gap-0.5 text-center",children:[t("span",{className:"font-semibold tabular-nums text-(--neba-fg)",style:{fontSize:2*rt},children:It}),C?t("span",{className:g("text-(--neba-muted-fg)",v[F]),children:C}):null]})})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as
|
|
1
|
+
"use client";import*as r from"react";import{useRender as e}from"@base-ui/react/use-render";import{alignSelfClasses as n,offsetValue as t,spanGrow as s,spanValue as o,spanWidth as i}from"../../internal/grid.js";import{breakpointMap as f,responsiveSlots as a}from"../../internal/responsive.js";import{cx as c}from"../../internal/styles.js";function l(r){const e=f(r),n=Object.entries(e),t={};let c=!1;for(const[r,e]of n)"number"==typeof e?t[r]=e:c=!0;const l=a("span",t,o);return c?{...l,...a("span-w",e,i),...a("grow",e,s)}:l}export const Grid=/*@__PURE__*/r.forwardRef(function Grid({span:r,offset:s,alignSelf:o,render:i,className:f,style:m,children:p,...d},u){const b=c("neba-grid-item",o?n[o]:"",f??"");return e({render:i,ref:u,props:{className:b,style:{...l(r),...a("offset",s,t),...m},children:p,...d}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as
|
|
1
|
+
"use client";import*as r from"react";import{useRender as e}from"@base-ui/react/use-render";import{alignContentClasses as n,alignItemsClasses as t,columnCount as a,justifyContentClasses as i,spacingValue as o}from"../../internal/grid.js";import{overlayResponsive as s,responsiveSlots as p,withBaseline as l}from"../../internal/responsive.js";import{boxPaddingClasses as m}from"../box/Box.js";import{cx as d}from"../../internal/styles.js";import{useStyleDefaults as f}from"../../internal/defaults.js";export const GridContainer=/*@__PURE__*/r.forwardRef(function GridContainer(r,c){const{columns:g,spacing:u,rowSpacing:x,columnSpacing:y,justifyContent:j,alignItems:w,alignContent:C,wrap:b=!0,padded:h=!0,size:z="md",density:G="default",render:N,className:S,style:v,children:B,...I}=f(r,["size","density"]),R=d("neba-grid flex",b?"flex-wrap":"flex-nowrap","gap-x-(--n-gap-x) gap-y-(--n-gap-y)",h?m[G][z]:"",j?i[j]:"",w?t[w]:"",C?n[C]:"",S??"");return e({render:N,ref:c,props:{className:R,style:{...p("cols",l(g,12),a),...p("gap-x",s(l(u,2),y),o),...p("gap-y",s(l(u,2),x),o),...v},children:B,...I}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useRender as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useRender as r}from"@base-ui/react/use-render";import{boxPaddingXClasses as n}from"../box/Box.js";import{PageLayoutContext as s,PageLayoutSlotContext as i}from"../../internal/page-layout.js";import{cx as l,hasContent as m,measureValue as o,surfaceClasses as d,surfaceSlots as c,transitionClasses as x}from"../../internal/styles.js";import{responsiveSlots as f}from"../../internal/responsive.js";import{useStyleDefaults as p}from"../../internal/defaults.js";const u={xs:"min-h-10",sm:"min-h-12",md:"min-h-14",lg:"min-h-16",xl:"min-h-20"},g={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-4",xl:"gap-5"},h={xs:"gap-3",sm:"gap-4",md:"gap-6",lg:"gap-8",xl:"gap-10"},b={solid:[d,"text-(--neba-fg) bg-(--n-panel-press)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[d,"text-(--neba-fg) bg-(--n-panel)","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},v={static:"",sticky:"sticky top-0 z-30",fixed:"fixed inset-x-0 top-0 z-40"},y={start:"shrink-0",center:"flex-1 basis-0",end:"shrink-0"},j={start:"flex min-w-0 flex-1 items-center justify-start",center:"flex min-w-0 shrink items-center justify-center",end:"flex min-w-0 flex-1 items-center justify-end"};export const Header=/*@__PURE__*/a.forwardRef(function Header(d,w){const{brand:N,actions:k,align:z="start",position:C="sticky",variant:H="outline",size:B="md",color:R="primary",density:W="default",elevation:q=0,divider:A=!0,maxWidth:D,padded:E=!0,label:F,render:G,className:I,style:J,children:K,...L}=p(d,["size","density","variant"]),M=a.useContext(s),{register:O}=M,P="header"===a.useContext(i),Q=a.useCallback(e=>{P&&O("header",e),"function"==typeof w?w(e):w&&(w.current=e)},[O,w,P,C]),S=l("w-full min-w-0",b[H],A?"border-b [border-color:var(--n-line)]":"",v[C],x,I);return r({render:G??e("header",{}),ref:Q,props:{"aria-label":F,className:S,style:{...c(R,q),...J},children:t("div",{className:l("flex w-full items-center",u[B],h[B],E?n[W][B]:"","neba-measure mx-auto max-w-(--n-max-w)"),style:f("max-w",D,o),children:[m(N)?e("div",{className:l("flex min-w-0 items-center",y[z],g[B]),children:N}):"center"===z?e("div",{"aria-hidden":"true",className:y[z]}):null,m(K)?e("div",{className:l(j[z],g[B]),children:K}):null,m(k)?e("div",{className:l("flex min-w-0 items-center justify-end",y[z],g[B]),children:k}):"center"===z?e("div",{"aria-hidden":"true",className:y[z]}):null]}),...L}})});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ChartScaleKind } from '../../internal/chart.js';
|
|
3
|
-
import type { NebaChartCategory, NebaChartLegend, NebaChartSeries } from '../../types.js';
|
|
3
|
+
import type { NebaChartAxis, NebaChartCategory, NebaChartLegend, NebaChartSeries } from '../../types.js';
|
|
4
4
|
import type { ChartBaseProps } from '../../internal/chart-frame.js';
|
|
5
5
|
export interface HeatmapChartProps extends Omit<ChartBaseProps, 'legend'> {
|
|
6
6
|
/**
|
|
@@ -50,6 +50,25 @@ export interface HeatmapChartProps extends Omit<ChartBaseProps, 'legend'> {
|
|
|
50
50
|
valueLabels?: 'none' | 'all';
|
|
51
51
|
/** Where the scale legend sits. `false` leaves it off. */
|
|
52
52
|
legend?: boolean | Pick<NebaChartLegend, 'side' | 'align'>;
|
|
53
|
+
/**
|
|
54
|
+
* The column axis — the names along the bottom of a `grid`.
|
|
55
|
+
*
|
|
56
|
+
* Both of a heatmap's axes are **category** axes: what the magnitude is drawn
|
|
57
|
+
* on is the colour ramp, which the scale legend describes rather than an
|
|
58
|
+
* axis. So `min`, `max`, `tickCount` and `grid` mean nothing here and are not
|
|
59
|
+
* read; the chart's own `min` and `max` are the ones that set the ramp.
|
|
60
|
+
* `hidden`, `label`, `tickFormat`, `tickAngle` and `thickness` all work.
|
|
61
|
+
*
|
|
62
|
+
* A `treemap` names its tiles on their own faces, so it has no axes and reads
|
|
63
|
+
* neither of these.
|
|
64
|
+
*/
|
|
65
|
+
xAxis?: NebaChartAxis;
|
|
66
|
+
/**
|
|
67
|
+
* The row axis — the names down the side of a `grid`. The same five fields as
|
|
68
|
+
* `xAxis`, less `tickAngle`: a row already has a line of its own, and turning
|
|
69
|
+
* its name would take room it is not short of.
|
|
70
|
+
*/
|
|
71
|
+
yAxis?: NebaChartAxis;
|
|
53
72
|
}
|
|
54
73
|
/**
|
|
55
74
|
* A magnitude per cell, coloured rather than measured.
|