neba 1.8.0 → 1.9.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 +13 -7
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/anchor/Anchor.d.ts +73 -0
- package/dist/components/anchor/Anchor.js +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-appear/AnimateAppear.js +1 -1
- package/dist/components/animate-blink/AnimateBlink.js +1 -1
- package/dist/components/animate-fade/AnimateFade.js +1 -1
- package/dist/components/animate-grow/AnimateGrow.js +1 -1
- package/dist/components/animate-headline/AnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/AnimateLighting.js +1 -1
- package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
- package/dist/components/animate-rotate/AnimateRotate.js +1 -1
- package/dist/components/animate-slide/AnimateSlide.js +1 -1
- 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/area-chart/AreaChart.js +1 -1
- package/dist/components/aspect-ratio/AspectRatio.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/avatar-group/AvatarGroup.d.ts +47 -0
- package/dist/components/avatar-group/AvatarGroup.js +1 -0
- package/dist/components/avatar-group/index.d.ts +2 -0
- package/dist/components/avatar-group/index.js +1 -0
- package/dist/components/badge/Badge.js +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.js +1 -1
- package/dist/components/box/Box.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button-group/ButtonGroup.js +1 -1
- package/dist/components/card/Card.js +1 -1
- 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.js +1 -1
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/collapsible/Collapsible.js +1 -1
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.d.ts +88 -0
- package/dist/components/command-palette/CommandPalette.js +1 -0
- package/dist/components/command-palette/index.d.ts +2 -0
- package/dist/components/command-palette/index.js +1 -0
- package/dist/components/container/Container.js +1 -1
- package/dist/components/data-list/DataList.d.ts +55 -0
- package/dist/components/data-list/DataList.js +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.js +1 -0
- 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.js +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/fieldset/Fieldset.d.ts +33 -0
- package/dist/components/fieldset/Fieldset.js +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +1 -0
- package/dist/components/file-picker/FilePicker.js +1 -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.js +1 -1
- package/dist/components/form/Form.d.ts +58 -0
- package/dist/components/form/Form.js +1 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/gauge-chart/GaugeChart.d.ts +62 -0
- package/dist/components/gauge-chart/GaugeChart.js +1 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- 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.js +1 -1
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/hover-card/HoverCard.d.ts +78 -0
- package/dist/components/hover-card/HoverCard.js +1 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/how-to-steps/HowToSteps.d.ts +11 -25
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/icon-button/IconButton.js +1 -1
- package/dist/components/line-chart/LineChart.js +1 -1
- package/dist/components/list/List.js +1 -1
- package/dist/components/menu/Menu.d.ts +16 -4
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/menubar/Menubar.d.ts +56 -0
- package/dist/components/menubar/Menubar.js +1 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +1 -0
- package/dist/components/meter/Meter.d.ts +52 -0
- package/dist/components/meter/Meter.js +1 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.d.ts +100 -0
- package/dist/components/navigation-menu/NavigationMenu.js +1 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +1 -0
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/otp-field/OtpField.js +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/page-layout/PageLayout.js +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/popover/Popover.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/radio-group/RadioGroup.js +1 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-area/ScrollArea.d.ts +50 -0
- package/dist/components/scroll-area/ScrollArea.js +1 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-zone/ScrollZone.d.ts +35 -17
- 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/sidebar/Sidebar.js +1 -1
- package/dist/components/sidebar/SidebarTrigger.js +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/sparkline/Sparkline.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/Table.js +1 -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.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toggle/Toggle.d.ts +53 -0
- package/dist/components/toggle/Toggle.js +1 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +1 -0
- package/dist/components/toggle-group/ToggleGroup.d.ts +51 -0
- package/dist/components/toggle-group/ToggleGroup.js +1 -0
- package/dist/components/toggle-group/index.d.ts +2 -0
- package/dist/components/toggle-group/index.js +1 -0
- package/dist/components/toolbar/Toolbar.js +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.d.ts +82 -0
- package/dist/components/tour/Tour.js +1 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/Transfer.d.ts +52 -0
- package/dist/components/transfer/Transfer.js +1 -0
- package/dist/components/transfer/index.d.ts +2 -0
- package/dist/components/transfer/index.js +1 -0
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/typography/Typography.js +1 -1
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +7 -1
- package/dist/internal/animate.js +1 -1
- package/dist/internal/avatar-group.d.ts +22 -0
- package/dist/internal/avatar-group.js +1 -0
- package/dist/internal/bottom-navigation.js +1 -1
- package/dist/internal/button-group.d.ts +6 -2
- package/dist/internal/button-group.js +1 -1
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +18 -1
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/data-table.d.ts +0 -14
- package/dist/internal/data-table.js +1 -1
- package/dist/internal/drag.d.ts +62 -0
- package/dist/internal/drag.js +1 -0
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/i18n.d.ts +82 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/link.d.ts +19 -0
- package/dist/internal/link.js +1 -0
- package/dist/internal/media.d.ts +29 -0
- package/dist/internal/media.js +1 -0
- package/dist/internal/menu.js +1 -1
- package/dist/internal/observe.d.ts +42 -0
- package/dist/internal/observe.js +1 -0
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +5 -0
- package/dist/internal/search.d.ts +33 -0
- package/dist/internal/search.js +1 -0
- package/dist/internal/styles.d.ts +39 -0
- package/dist/internal/styles.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 +104 -0
- package/dist/types.d.ts +16 -0
- package/package.json +2 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaAlign, NebaSide, NebaStyleProps } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The same three axes a [Popover](./popover) takes, and for the same reasons:
|
|
5
|
+
* no `variant`, because a surface that had to be hovered has already asserted
|
|
6
|
+
* itself, and no `elevation`, because a card floating over the page is the
|
|
7
|
+
* whole idea and a prop that could sit it flat would undo it.
|
|
8
|
+
*/
|
|
9
|
+
export interface HoverCardProps extends Pick<NebaStyleProps, 'size' | 'color' | 'density'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'children'> {
|
|
10
|
+
/**
|
|
11
|
+
* What the card hangs off. Exactly one element, which must accept a ref and
|
|
12
|
+
* spread props — every Neba component does.
|
|
13
|
+
*
|
|
14
|
+
* Usually a [TextLink](../display/text-link) or an
|
|
15
|
+
* [Avatar](../display/avatar): the two things a reader wants to know more
|
|
16
|
+
* about without leaving the sentence they are in.
|
|
17
|
+
*/
|
|
18
|
+
trigger: React.ReactElement;
|
|
19
|
+
/** The heading, rendered as the element that names the card. */
|
|
20
|
+
title?: React.ReactNode;
|
|
21
|
+
/** A line under the title. */
|
|
22
|
+
description?: React.ReactNode;
|
|
23
|
+
/** The body. */
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Which edge of the trigger it appears on. Flips when there is no room.
|
|
27
|
+
* @default 'bottom'
|
|
28
|
+
*/
|
|
29
|
+
side?: NebaSide;
|
|
30
|
+
/** Where it sits along that edge. @default 'center' */
|
|
31
|
+
align?: NebaAlign;
|
|
32
|
+
/** Distance from the trigger, in pixels. @default 6 */
|
|
33
|
+
sideOffset?: number;
|
|
34
|
+
/** Shift along that edge, in pixels. @default 0 */
|
|
35
|
+
alignOffset?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Draws the wedge pointing at the trigger. Off by default, exactly as on
|
|
38
|
+
* Popover: this surface is translucent over a blurred backdrop, and a wedge
|
|
39
|
+
* sticking out past the card's own box cannot carry that backdrop with it.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
arrow?: boolean;
|
|
43
|
+
/** Whether the card is open. Use with `onOpenChange` for a controlled one. */
|
|
44
|
+
open?: boolean;
|
|
45
|
+
/** Whether it starts open, for an uncontrolled one. */
|
|
46
|
+
defaultOpen?: boolean;
|
|
47
|
+
onOpenChange?: (open: boolean) => void;
|
|
48
|
+
/**
|
|
49
|
+
* How long the pointer has to rest on the trigger before the card opens, in
|
|
50
|
+
* milliseconds. The default is long enough that crossing a paragraph of links
|
|
51
|
+
* does not open four of them.
|
|
52
|
+
*/
|
|
53
|
+
delay?: number;
|
|
54
|
+
/**
|
|
55
|
+
* How long the card stays after the pointer has left, in milliseconds. This
|
|
56
|
+
* is what makes the gap between the trigger and the card crossable.
|
|
57
|
+
*/
|
|
58
|
+
closeDelay?: number;
|
|
59
|
+
/** A hard cap on the card's width, overriding the one `size` implies. */
|
|
60
|
+
width?: number | string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A card that opens when the pointer rests on something, and holds a preview of
|
|
64
|
+
* what is on the other side of it.
|
|
65
|
+
*
|
|
66
|
+
* It sits between the library's other two popups, and the distance is short in
|
|
67
|
+
* both directions. A [Tooltip](../feedback/tooltip) is a label — one line, no
|
|
68
|
+
* interaction, and the pointer never reaches it. A [Popover](./popover) is a
|
|
69
|
+
* panel that was *asked for* by a press, so it can hold a form. This one is
|
|
70
|
+
* uninvited like a tooltip and reachable like a popover: the pointer can cross
|
|
71
|
+
* into it, and a link inside it can be followed.
|
|
72
|
+
*
|
|
73
|
+
* Because it is uninvited, it is never the only way to something. Whatever is in
|
|
74
|
+
* here has to exist on the page the trigger leads to as well — a keyboard
|
|
75
|
+
* without hover, a touchscreen with no pointer at all, and a screen reader all
|
|
76
|
+
* arrive by that route instead.
|
|
77
|
+
*/
|
|
78
|
+
export declare function HoverCard({ size, color, density, trigger, title, description, children, side, align, sideOffset, alignOffset, arrow, open, defaultOpen, onOpenChange, delay, closeDelay, width, className, style, ...props }: HoverCardProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{PreviewCard as t}from"@base-ui/react/preview-card";import{boxPaddingXClasses as l,boxPaddingYClasses as i}from"../box/Box.js";import{cx as n,hasContent as o,metaTextClasses as r,radiusClasses as s,sheetBodyClasses as d,sheetHeaderGapClasses as c,sheetSectionGapClasses as m,sheetTitleClasses as p,surfaceClasses as f,surfaceSlots as x,toLength as h}from"../../internal/styles.js";const g={xs:"max-w-64",sm:"max-w-72",md:"max-w-84",lg:"max-w-md",xl:"max-w-xl"},u=[f,"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]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),b={xs:8,sm:9,md:10,lg:11,xl:12};export function HoverCard({size:f="md",color:v="primary",density:w="default",trigger:y,title:N,description:O,children:j,side:k="bottom",align:z="center",sideOffset:C=6,alignOffset:P=0,arrow:$=!1,open:B,defaultOpen:D,onOpenChange:M,delay:W,closeDelay:_,width:A,className:E,style:H,...L}){const R=l[w][f],T=i[w][f],q=b[f],F=o(N)||o(O),G=h(A);return a(t.Root,{open:B,defaultOpen:D,onOpenChange:e=>M?.(e),children:[e(t.Trigger,{render:y,delay:W,closeDelay:_}),e(t.Portal,{children:e(t.Positioner,{className:"neba-portal z-50 [outline:none]",side:k,align:z,sideOffset:C,alignOffset:P,children:a(t.Popup,{className:n(u,s[f],d[f],m[f],R,T,void 0===G?g[f]:"",E??""),style:{...x(v,3),...void 0===G?null:{maxWidth:G},...H},...L,children:[$?e(t.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:a("svg",{width:q,height:q/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,F?a("div",{className:`flex min-w-0 flex-col ${c[f]}`,children:[o(N)?e("div",{className:`m-0 font-semibold ${p[f]}`,children:N}):null,o(O)?e("div",{className:`m-0 text-(--neba-muted-fg) ${r[f]}`,children:O}):null]}):null,o(j)?e("div",{className:"min-w-0",children:j}):null]})})})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{HoverCard}from"./HoverCard.js";
|
|
@@ -34,6 +34,17 @@ export interface HowToStepsProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
34
34
|
steps: HowToStep[];
|
|
35
35
|
/** The guide's own heading, over both columns. */
|
|
36
36
|
title?: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Which heading level `title` is written at, and the step's title one below
|
|
39
|
+
* it.
|
|
40
|
+
*
|
|
41
|
+
* A heading level is a claim about the *page*, not about the component: a
|
|
42
|
+
* guide under an `<h1>` is an `<h2>` and the same guide inside a section is an
|
|
43
|
+
* `<h4>`, and a component that decides for itself breaks the outline of every
|
|
44
|
+
* page it does not happen to suit.
|
|
45
|
+
* @default 3
|
|
46
|
+
*/
|
|
47
|
+
headingLevel?: 2 | 3 | 4 | 5;
|
|
37
48
|
/** Which step is showing. Pass it to drive the guide yourself. */
|
|
38
49
|
step?: number;
|
|
39
50
|
/** Where an uncontrolled guide starts. @default 0 */
|
|
@@ -139,29 +150,4 @@ export interface HowToStepsProps extends Omit<React.ComponentPropsWithoutRef<'di
|
|
|
139
150
|
doneLabel?: string;
|
|
140
151
|
restartLabel?: string;
|
|
141
152
|
}
|
|
142
|
-
/**
|
|
143
|
-
* A guide the reader walks through: numbered steps down one side, one step's
|
|
144
|
-
* instructions at a time beside them, and a way forward under those.
|
|
145
|
-
*
|
|
146
|
-
* It is [Timeline]'s interactive sibling, and the two are deliberately not one
|
|
147
|
-
* component. A Timeline *reports* — this happened, then this did, and here is
|
|
148
|
-
* where things have got to — and nothing in it is pressed. A HowToSteps *asks*:
|
|
149
|
-
* the reader is meant to do the thing on the screen and then say they have,
|
|
150
|
-
* which needs a current step, a way to change it, and an end.
|
|
151
|
-
*
|
|
152
|
-
* Two things about how it is built are load-bearing rather than incidental.
|
|
153
|
-
*
|
|
154
|
-
* **Every step's body is rendered into the same grid cell**, with the ones not
|
|
155
|
-
* showing left in the document, `invisible` and `inert`. The panel is therefore
|
|
156
|
-
* as tall as the tallest step at every moment, so moving between a one-line
|
|
157
|
-
* step and a five-line one does not resize the card the guide sits in — which,
|
|
158
|
-
* on a page the reader has already scrolled, moves everything under it. The
|
|
159
|
-
* finished panel is in that cell too, for the same reason.
|
|
160
|
-
*
|
|
161
|
-
* **The list is a list of buttons and not a tablist.** A stepper looks like
|
|
162
|
-
* tabs and is not one: the panels are ordered, the reader is expected to arrive
|
|
163
|
-
* at them in that order, and `aria-current="step"` is the attribute that says
|
|
164
|
-
* so. A tablist's roving focus would tell a screen reader that these are
|
|
165
|
-
* interchangeable views of one thing.
|
|
166
|
-
*/
|
|
167
153
|
export declare const HowToSteps: React.ForwardRefExoticComponent<HowToStepsProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as l from"react";import{Button as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as l from"react";import{Button as a}from"../button/Button.js";import{boxPaddingClasses as r}from"../box/Box.js";import{CheckIcon as i,ChevronIcon as o,RestartIcon as s,SuccessIcon as c}from"../../internal/icons.js";import{fill as m,stepsMessages as d,useMessages as p}from"../../internal/i18n.js";import{transitionProps as f}from"../../internal/animate.js";import{cx as x,hasContent as u,iconClasses as b,metaTextClasses as h,radiusClasses as g,sheetBodyClasses as v,sheetSectionGapClasses as N,sheetTitleClasses as w,srOnlyClasses as y,surfaceClasses as k,surfaceSlots as j,toLength as C,transitionClasses as z}from"../../internal/styles.js";const S={xs:{box:"1.25rem",text:"text-[0.625rem]"},sm:{box:"1.5rem",text:"text-[0.6875rem]"},md:{box:"1.75rem",text:"text-[0.75rem]"},lg:{box:"2rem",text:"text-[0.8125rem]"},xl:{box:"2.25rem",text:"text-[0.875rem]"}},L={default:{xs:"gap-0.5",sm:"gap-1",md:"gap-1",lg:"gap-1.5",xl:"gap-2"},compact:{xs:"gap-0",sm:"gap-0",md:"gap-0.5",lg:"gap-0.5",xl:"gap-1"}},I={solid:[k,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[k,"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"};function M(e){return"string"==typeof e?e:""}function R({level:e,...t}){return l.createElement(`h${Math.min(6,Math.max(1,e))}`,t)}export const HowToSteps=/*@__PURE__*/l.forwardRef(function({steps:k,title:B,headingLevel:_=3,step:H,defaultStep:T=0,onStepChange:$,completed:E,defaultCompleted:A=!1,onCompletedChange:F,orientation:W="vertical",maxHeight:q,railWidth:D="15rem",navigation:G=!0,divider:J=!0,transition:K="fade",completion:O=!0,completedContent:P,variant:Q="outline",size:U="md",color:V="primary",density:X="default",elevation:Y=0,locale:Z,previousLabel:ee,nextLabel:te,doneLabel:ne,restartLabel:le,className:ae,style:re,...ie},oe){const se=p(d,Z),ce=l.useId(),[me,de]=l.useState(T),[pe,fe]=l.useState(A),xe=void 0!==H,ue=void 0!==E,be=k.length,he=Math.min(Math.max(xe?H:me,0),Math.max(be-1,0)),ge=O&&(ue?E:pe),ve=void 0!==q,Ne="vertical"===W,we=l.useRef(null),ye=l.useRef(null);if(l.useEffect(()=>{const e=we.current,t=ye.current;if(!e||!t)return;const n=e.getBoundingClientRect(),l=t.getBoundingClientRect();Ne?l.top<n.top?e.scrollTop-=n.top-l.top:l.bottom>n.bottom&&(e.scrollTop+=l.bottom-n.bottom):l.left<n.left?e.scrollLeft-=n.left-l.left:l.right>n.right&&(e.scrollLeft+=l.right-n.right)},[he,Ne]),0===be)return null;const ke=(e,t=!1)=>{ue||fe(t),ge!==t&&F?.(t),t||(xe||de(e),e!==he&&$?.(e))},je=0===he,Ce=he===be-1,ze="none"===K?null:f(K),Se=t=>{const n=ge||t<he,l=!ge&&t===he;return e("span",{"aria-hidden":"true",className:x("z-1 flex shrink-0 items-center justify-center rounded-full border font-medium","size-(--n-step-mark) [&_svg]:size-[1.15em]",S[U].text,z,n?"bg-(--n-fill) text-(--n-on-solid) [border-color:transparent]":l?"bg-(--neba-surface) text-(--n-accent) [border-color:var(--n-accent)]":"bg-(--neba-surface) text-(--neba-muted-fg) [border-color:var(--n-line)]"),children:n?e(i,{}):t+1})},Le=e("ol",{ref:we,"aria-label":se.steps,className:x("m-0 flex list-none p-0",Ne?"flex-col":"flex-row",L[X][U],ve&&Ne?"min-h-0 overflow-y-auto overscroll-contain":"",Ne?"":"overflow-x-auto overscroll-contain"),children:k.map((n,l)=>{const a=ge||l<he,r=!ge&&l===he;return t("li",{ref:r?ye:void 0,className:x("relative",Ne?"":"min-w-0 flex-1"),children:[l<be-1?e("span",{"aria-hidden":"true",className:x("absolute",z,a?"bg-(--n-fill)":"bg-(--n-line)",Ne?["w-px","[inset-inline-start:calc(0.25rem+var(--n-step-mark)/2)]","[top:calc(0.25rem+var(--n-step-mark))]","[height:calc(100%-var(--n-step-mark))]"].join(" "):["h-px","[inset-inline-start:calc(50%+var(--n-step-mark)/2)]","[top:calc(0.25rem+var(--n-step-mark)/2)]","[width:calc(100%-var(--n-step-mark))]"].join(" "))}):null,t("button",{type:"button",onClick:()=>ke(l),"aria-current":r?"step":void 0,className:x("flex w-full cursor-pointer items-center p-1 text-start",Ne?"gap-3":"flex-col gap-1.5 text-center",g.sm,"hover:bg-(--n-soft)",z,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1"),children:[Se(l),e("span",{className:x("min-w-0",Ne?"truncate":"",h[U],r?"font-medium text-(--neba-fg)":"text-(--neba-muted-fg)"),children:n.title}),e("span",{className:y,children:m(se.step,{index:String(l+1),title:M(n.title)})})]})]},l)})}),Ie=t("div",{className:x("grid flex-1 grid-cols-1",ve?"min-h-0":""),children:[k.map((n,l)=>{const a=ge||l!==he;return t("div",{"aria-hidden":a,inert:a||void 0,className:x("col-start-1 row-start-1 min-w-0",ve?"overflow-y-auto overscroll-contain":"",a?"invisible":ze?.className??""),style:a?void 0:ze?.style,children:[t("div",{className:"mb-3 flex items-baseline gap-3",children:[u(n.icon)?e("span",{"aria-hidden":"true",className:x("flex h-[1lh] shrink-0 items-center text-(--n-accent)",w[U],b),children:n.icon}):null,e(R,{level:_+1,className:x("m-0 min-w-0 flex-1 font-medium",w[U]),children:n.title}),e("span",{className:x("shrink-0 text-(--neba-muted-fg) tabular-nums",h[U]),children:m(se.position,{index:String(l+1),total:String(be)})})]}),n.image?e("img",{src:n.image,alt:n.imageAlt??M(n.title),loading:"lazy",decoding:"async",className:x("mb-3 max-h-72 w-full object-contain",g[U])}):null,u(n.content)?e("div",{className:x("min-w-0",v[U]),children:n.content}):null]},l)}),O?t("div",{"aria-hidden":!ge,inert:!ge||void 0,className:x("col-start-1 row-start-1 flex min-w-0 flex-col items-center justify-center gap-2 py-4 text-center",ge?ze?.className??"":"invisible"),style:ge?ze?.style:void 0,children:[e("span",{"aria-hidden":"true",className:"text-(--n-accent) [&_svg]:size-9",children:e(c,{})}),e("p",{className:x("m-0 font-medium",v[U]),children:P??se.completed})]}):null]});return t("div",{ref:oe,"aria-labelledby":u(B)?ce:void 0,className:x("flex min-w-0 flex-col",g[U],r[X][U],N[U],I[Q],z,ae),style:{...j(V,Y),"--n-fill":`var(--neba-${V}-fill)`,"--n-on-solid":`var(--neba-${V}-on-solid)`,"--n-step-mark":S[U].box,"--n-step-rail":C(D),...ve?{maxHeight:C(q)}:null,...re},...ie,children:[u(B)?e(R,{level:_,id:ce,className:x("m-0 shrink-0 font-medium",w[U]),children:B}):null,t("div",{className:x("flex min-w-0 flex-1 flex-col",ve?"min-h-0":"",Ne?"gap-4 sm:flex-row sm:gap-5":"gap-4"),children:[e("div",{className:x("flex min-w-0 flex-col",ve?"min-h-0":"",Ne?"sm:w-(--n-step-rail) sm:shrink-0":"",J?Ne?"border-b pb-4 sm:border-b-0 sm:border-e sm:pb-0 sm:pe-5":"border-b pb-4":"",J?"[border-color:var(--n-line)]":""),children:Le}),t("div",{className:x("flex min-w-0 flex-1 flex-col",ve?"min-h-0":"",N[U]),children:[Ie,G?e("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:ge?e(a,{size:U,variant:"outline",color:V,startIcon:e(s,{}),onClick:()=>ke(0),children:le??se.restart}):t(n,{children:[e(a,{size:U,variant:"outline",color:V,disabled:je,startIcon:e("span",{className:"rotate-90 rtl:-rotate-90",children:e(o,{})}),onClick:()=>ke(he-1),children:ee??se.previous}),e(a,Ce&&O?{size:U,variant:"solid",color:V,startIcon:e(i,{}),onClick:()=>ke(he,!0),children:ne??se.done}:{size:U,variant:"solid",color:V,disabled:Ce,endIcon:e("span",{className:"-rotate-90 rtl:rotate-90",children:e(o,{})}),onClick:()=>ke(he+1),children:te??se.next})]})}):null]})]})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{transitionProps as i}from"../../internal/animate.js";import{iconSizeClasses as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{transitionProps as i}from"../../internal/animate.js";import{cx as n,iconSizeClasses as r}from"../../internal/styles.js";const s={xs:"text-[0.875rem]",sm:"text-[1rem]",md:"text-[1.25rem]",lg:"text-[1.5rem]",xl:"text-[1.75rem]"};export const Icon=/*@__PURE__*/t.forwardRef(function({icon:t,size:l="md",color:a="inherit",label:m,transition:o,className:c,style:f,...x},d){const g=i(o),u=n("inline-flex shrink-0 items-center justify-center align-middle",r[l],"[&>svg]:block [&>svg]:size-full [&>img]:block [&>img]:size-full",`leading-none ${s[l]}`,"inherit"===a?"":"text-(--n-accent)",g.className,c??"");return e("span",{ref:d,className:u,style:"inherit"===a?{...g.style,...f}:{"--n-accent":`var(--neba-${a}-accent)`,...g.style,...f},role:m?"img":void 0,"aria-label":m,"aria-hidden":!m||void 0,...x,children:t})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import*as r from"react";import{Button as o}from"../button/Button.js";export const IconButton=/*@__PURE__*/r.forwardRef(function({icon:r,label:e,style:a
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import*as r from"react";import{Button as o}from"../button/Button.js";export const IconButton=/*@__PURE__*/r.forwardRef(function({icon:r,label:e,style:n,...a},s){return t(o,{ref:s,"aria-label":e,startIcon:r,style:{borderRadius:"9999px",...n},...a})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{CartesianChart as t}from"../../internal/chart-frame.js";import{LineSeries as n}from"../../internal/chart-line.js";export function LineChart({curve:a="linear",markers:
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{CartesianChart as t}from"../../internal/chart-frame.js";import{LineSeries as n}from"../../internal/chart-line.js";export function LineChart({curve:a="linear",markers:c="auto",gradient:i=!1,connectNulls:o=!1,valueLabels:s="none",stacked:l=!1,...m}){const u=r.useId().replace(/:/g,"");return e(t,{...m,stacked:l,inset:!0,includeZero:!1,headroom:"none"===s?0:10,children:r=>e(n,{context:r,curve:a,filled:!1,stacked:l,markers:c,valueLabels:s,connectNulls:o,gradient:i,idPrefix:u})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r,Fragment as s}from"react/jsx-runtime";import*as n from"react";import{useRender as t}from"@base-ui/react/use-render";import{boxPaddingXClasses as l}from"../box/Box.js";import{cx as a,focusRingClasses as i,gapClasses as o,hasContent as d,iconClasses as c,metaTextClasses as m,radiusClasses as f,sheetBodyClasses as x,surfaceClasses as p,surfaceSlots as u,transitionClasses as h}from"../../internal/styles.js";const b=/*@__PURE__*/n.createContext({size:"md",density:"default",dividers:!1}),v={solid:[p,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[p,"border text-(--neba-fg) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev),var(--neba-plate-glass)]"].join(" "),text:"text-(--neba-fg) bg-transparent"},g={default:{xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},compact:{xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"}},y={xs:f.xs,sm:f.xs,md:f.sm,lg:f.sm,xl:f.md};export const List=/*@__PURE__*/n.forwardRef(function({variant:r="outline",size:s="md",color:l="primary",density:i="default",elevation:o=0,dividers:d=!1,render:c,className:m,style:x,children:p,...g},y){const N=n.useMemo(()=>({size:s,density:i,dividers:d}),[s,i,d]),w=a("flex flex-col",f[s],v[r],h,d?"overflow-hidden [&>li+li]:border-t [&>li+li]:[border-color:var(--n-line)]":"p-1",m??""),j=t({render:c,ref:y,props:{role:"list",className:w,style:{...u(l,o),...x},children:p,...g}});return e(b.Provider,{value:N,children:j})});export const ListItem=/*@__PURE__*/n.forwardRef(function({startIcon:t,endIcon:f,description:p,action:u,href:v,selected:N=!1,disabled:w=!1,className:j,children:k,onClick:C,...z},I){const{size:$,density:B,dividers:L}=n.useContext(b),R=Boolean(C||v)&&!w,F=l[B][$],M=g[B][$],P=a("flex min-w-0 flex-1 items-center text-start",F,M,o[$],x[$],h,c,L?"":y[$],w?"cursor-not-allowed text-(--neba-disabled-fg)":N?"bg-(--n-soft-press) font-medium text-(--n-accent)":"",R?`cursor-pointer ${i}`:"",R&&!N?"hover:bg-(--n-soft)":"",R&&N?"hover:bg-(--n-soft-press)":""),q=r(s,{children:[d(t)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:t}):null,r("span",{className:"flex min-w-0 flex-1 flex-col",children:[d(k)?e("span",{className:"truncate",children:k}):null,d(p)?e("span",{className:`truncate text-(--neba-muted-fg) ${m[$]}`,children:p}):null]}),d(f)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:f}):null]});return r("li",{ref:I,className:a("flex w-full items-center",j??""),...z,children:[R&&v?e("a",{href:v,className:P,"aria-current":N?"page":void 0,onClick:C,children:q}):R?e("button",{type:"button",className:P,"aria-current":!!N||void 0,onClick:C,children:q}):e("div",{className:P,"aria-disabled":w||void 0,children:q}),d(u)?e("div",{className:`flex shrink-0 items-center ${F}`,children:u}):null]})});
|
|
@@ -32,6 +32,11 @@ export interface MenuProps extends MenuSurfaceProps {
|
|
|
32
32
|
sideOffset?: number;
|
|
33
33
|
/**
|
|
34
34
|
* Whether the page behind is taken away while the menu is open.
|
|
35
|
+
*
|
|
36
|
+
* Left undefined rather than defaulted here on purpose: Base UI's own default
|
|
37
|
+
* is the same `true`, and it warns when the prop is set on a menu that turns
|
|
38
|
+
* out to be nested — which is every menu on a [Menubar](./menubar) and every
|
|
39
|
+
* submenu. Not passing it is how the default stays a default.
|
|
35
40
|
* @default true
|
|
36
41
|
*/
|
|
37
42
|
modal?: boolean;
|
|
@@ -71,8 +76,15 @@ export interface MenuItemProps {
|
|
|
71
76
|
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
72
77
|
/** Renders the row as a real `<a>`. A menu of links has to be links. */
|
|
73
78
|
href?: string;
|
|
74
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Where the link opens — `_blank` and the rest. Ignored without `href`.
|
|
81
|
+
*
|
|
82
|
+
* Anything other than this tab also gets `rel="noopener noreferrer"`, merged
|
|
83
|
+
* with whatever `rel` was asked for, exactly as on [TextLink].
|
|
84
|
+
*/
|
|
75
85
|
target?: string;
|
|
86
|
+
/** The link's `rel`. The two tokens a new tab needs are added to it. */
|
|
87
|
+
rel?: string;
|
|
76
88
|
/** Content before the label — an icon, a swatch, a check. */
|
|
77
89
|
startIcon?: React.ReactNode;
|
|
78
90
|
/** Content after the label, before any `shortcut`. */
|
|
@@ -123,7 +135,7 @@ export interface MenuGroupProps {
|
|
|
123
135
|
children?: React.ReactNode;
|
|
124
136
|
className?: string;
|
|
125
137
|
}
|
|
126
|
-
export interface MenuCheckboxItemProps extends Omit<MenuItemProps, 'href' | 'target' | 'startIcon' | 'onClick'> {
|
|
138
|
+
export interface MenuCheckboxItemProps extends Omit<MenuItemProps, 'href' | 'target' | 'rel' | 'startIcon' | 'onClick'> {
|
|
127
139
|
checked?: boolean;
|
|
128
140
|
defaultChecked?: boolean;
|
|
129
141
|
onCheckedChange?: (checked: boolean) => void;
|
|
@@ -143,7 +155,7 @@ export interface MenuRadioGroupProps {
|
|
|
143
155
|
children?: React.ReactNode;
|
|
144
156
|
className?: string;
|
|
145
157
|
}
|
|
146
|
-
export interface MenuRadioItemProps extends Omit<MenuItemProps, 'href' | 'target' | 'startIcon' | 'onClick'> {
|
|
158
|
+
export interface MenuRadioItemProps extends Omit<MenuItemProps, 'href' | 'target' | 'rel' | 'startIcon' | 'onClick'> {
|
|
147
159
|
/** What this row sets the group to. */
|
|
148
160
|
value: string | number;
|
|
149
161
|
/** @default false */
|
|
@@ -158,7 +170,7 @@ export type MenuSeparatorProps = React.ComponentPropsWithoutRef<'div'>;
|
|
|
158
170
|
* links that are not links cannot be opened in a new tab, cannot be copied, and
|
|
159
171
|
* tells a screen reader the wrong thing about every one of them.
|
|
160
172
|
*/
|
|
161
|
-
export declare function MenuItem({ onClick, href, target, startIcon, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MenuItemProps): React.JSX.Element;
|
|
173
|
+
export declare function MenuItem({ onClick, href, target, rel, startIcon, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MenuItemProps): React.JSX.Element;
|
|
162
174
|
/** A row that ticks. The tick lands in the same slot a `startIcon` would. */
|
|
163
175
|
export declare function MenuCheckboxItem({ checked, defaultChecked, onCheckedChange, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MenuCheckboxItemProps): React.JSX.Element;
|
|
164
176
|
/** One choice out of a set. Wraps the rows that make up the set. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n,Fragment as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import*as a from"react";import{Menu as l}from"@base-ui/react/menu";import{ContextMenu as s}from"@base-ui/react/context-menu";import{MenuContext as i}from"../../internal/menu.js";import{CheckIcon as o,ChevronIcon as r,DotIcon as c}from"../../internal/icons.js";import{safeRel as d}from"../../internal/link.js";import{controlTextLeadingClasses as u,cx as m,gapClasses as p,hasContent as h,iconClasses as x,metaTextClasses as f,radiusClasses as b,surfaceClasses as g,surfaceSlots as y,transitionClasses as N}from"../../internal/styles.js";const C=[g,"max-h-[min(24rem,var(--available-height))] min-w-40 overflow-y-auto overscroll-contain","border bg-(--n-panel-press) p-1","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),v={default:{xs:"px-1.5 py-0.5",sm:"px-2 py-1",md:"px-2.5 py-1.5",lg:"px-3 py-2",xl:"px-3.5 py-2.5"},compact:{xs:"px-1 py-0.5",sm:"px-1.5 py-0.5",md:"px-2 py-1",lg:"px-2.5 py-1",xl:"px-3 py-1.5"}},k={xs:b.xs,sm:b.xs,md:b.sm,lg:b.sm,xl:b.md};function O(e,n,t,a){return m("relative flex w-full cursor-pointer items-center select-none",t?"text-(--n-accent)":"text-(--neba-fg)",v[n][e],k[e],p[e],u[e],N,x,"data-[highlighted]:bg-(--n-soft-hover)","data-[popup-open]:bg-(--n-soft)","data-[disabled]:cursor-not-allowed data-[disabled]:text-(--neba-disabled-fg)","[outline:none]",a??"")}const z="flex h-[1lh] w-[1.2em] shrink-0 items-center justify-center";function I({children:t,description:a,size:l}){return h(a)?n("span",{className:"flex min-w-0 flex-1 flex-col text-start",children:[e("span",{className:"truncate",children:t}),e("span",{className:`truncate text-(--neba-muted-fg) ${f[l]}`,children:a})]}):e("span",{className:"min-w-0 flex-1 truncate text-start",children:t})}export function MenuItem({onClick:s,href:o,target:r,rel:c,startIcon:u,endIcon:m,shortcut:p,description:x,color:b,closeOnClick:g=!0,disabled:N=!1,label:C,children:v,className:k,style:M}){const j=a.useContext(i),{size:$,density:w}=j,P=n(t,{children:[h(u)?e("span",{className:`${z} text-(--neba-muted-fg)`,children:u}):null,e(I,{description:x,size:$,children:v}),h(m)?e("span",{className:`${z} text-(--neba-muted-fg)`,children:m}):null,h(p)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${f[$]}`,children:p}):null]}),R=b?y(b,0):void 0,F=R||M?{...R,...M}:void 0;return void 0!==o?e(l.LinkItem,{href:o,target:r,rel:d(r,c),label:C,closeOnClick:g,onClick:s,className:O($,w,Boolean(b),k),style:F,children:P}):e(l.Item,{disabled:N,label:C,closeOnClick:g,onClick:s,className:O($,w,Boolean(b),k),style:F,children:P})}export function MenuCheckboxItem({checked:t,defaultChecked:s,onCheckedChange:r,endIcon:c,shortcut:d,description:u,color:m,closeOnClick:p=!1,disabled:x=!1,label:b,children:g,className:N,style:C}){const{size:v,density:k}=a.useContext(i),M=m?y(m,0):void 0;return n(l.CheckboxItem,{checked:t,defaultChecked:s,onCheckedChange:e=>r?.(e),disabled:x,label:b,closeOnClick:p,className:O(v,k,Boolean(m),N),style:M||C?{...M,...C}:void 0,children:[e("span",{className:`${z} text-(--n-accent)`,children:e(l.CheckboxItemIndicator,{className:"flex items-center justify-center",children:e(o,{})})}),e(I,{description:u,size:v,children:g}),h(c)?e("span",{className:`${z} text-(--neba-muted-fg)`,children:c}):null,h(d)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${f[v]}`,children:d}):null]})}export function MenuRadioGroup({value:n,defaultValue:t,onValueChange:a,disabled:s=!1,children:i,className:o}){return e(l.RadioGroup,{value:n,defaultValue:t,onValueChange:e=>a?.(e),disabled:s,className:o,children:i})}export function MenuRadioItem({value:t,endIcon:s,shortcut:o,description:r,color:d,closeOnClick:u=!1,disabled:m=!1,label:p,children:x,className:b,style:g}){const{size:N,density:C}=a.useContext(i),v=d?y(d,0):void 0;return n(l.RadioItem,{value:t,disabled:m,label:p,closeOnClick:u,className:O(N,C,Boolean(d),b),style:v||g?{...v,...g}:void 0,children:[e("span",{className:`${z} text-(--n-accent)`,children:e(l.RadioItemIndicator,{className:"flex items-center justify-center",children:e(c,{})})}),e(I,{description:r,size:N,children:x}),h(s)?e("span",{className:`${z} text-(--neba-muted-fg)`,children:s}):null,h(o)?e("span",{className:`ms-2 shrink-0 text-(--neba-muted-fg) tabular-nums ${f[N]}`,children:o}):null]})}export function MenuGroup({label:t,children:s,className:o}){const{size:r,density:c}=a.useContext(i);return n(l.Group,{className:o,children:[h(t)?e(l.GroupLabel,{className:[v[c][r],f[r],"font-semibold tracking-wide text-(--neba-muted-fg) uppercase"].join(" "),children:t}):null,s]})}export function MenuSeparator({className:n,...t}){return e(l.Separator,{className:m("-mx-1 my-1 h-px bg-(--n-line)",n??""),...t})}export function MenuSubmenu({label:t,startIcon:s,disabled:o=!1,side:c="right",sideOffset:d=4,children:p,className:x,style:f}){const g=a.useContext(i),{size:N,density:v,color:k}=g;return n(l.SubmenuRoot,{children:[n(l.SubmenuTrigger,{disabled:o,className:O(N,v,!1),children:[h(s)?e("span",{className:`${z} text-(--neba-muted-fg)`,children:s}):null,e("span",{className:"min-w-0 flex-1 truncate text-start",children:t}),e("span",{className:`${z} text-(--neba-muted-fg) -rotate-90`,children:e(r,{})})]}),e(l.Portal,{children:e(l.Positioner,{className:"neba-portal z-50 [outline:none]",side:c,sideOffset:d,align:"start",children:e(l.Popup,{className:m(C,b[N],u[N],x??""),style:{...y(k,3),...f},children:p})})})]})}export function Menu({size:t="md",color:s="primary",density:o="default",trigger:r,open:c,defaultOpen:d,onOpenChange:p,side:h="bottom",align:x="start",sideOffset:f=6,modal:g,openOnHover:N=!1,loopFocus:v=!0,disabled:k=!1,className:O,style:z,children:I}){const M=a.useMemo(()=>({size:t,color:s,density:o}),[t,s,o]);return e(i.Provider,{value:M,children:n(l.Root,{open:c,defaultOpen:d,onOpenChange:e=>p?.(e),modal:g,loopFocus:v,disabled:k,children:[r?e(l.Trigger,{render:r,openOnHover:N,disabled:k}):null,e(l.Portal,{children:e(l.Positioner,{className:"neba-portal z-50 [outline:none]",side:h,align:x,sideOffset:f,children:e(l.Popup,{className:m(C,b[t],u[t],O??""),style:{...y(s,3),...z},children:I})})})]})})}export function ContextMenu({size:t="md",color:l="primary",density:o="default",content:r,children:c,open:d,defaultOpen:p,onOpenChange:h,loopFocus:x=!0,disabled:f=!1,className:g,style:N}){const v=a.useMemo(()=>({size:t,color:l,density:o}),[t,l,o]);return e(i.Provider,{value:v,children:n(s.Root,{open:d,defaultOpen:p,onOpenChange:e=>h?.(e),loopFocus:x,disabled:f,children:[e(s.Trigger,{children:c}),e(s.Portal,{children:e(s.Positioner,{className:"neba-portal z-50 [outline:none]",children:e(s.Popup,{className:m(C,b[t],u[t],g??""),style:{...y(l,3),...N},children:r})})})]})})}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaOrientation, NebaStyleProps } from '../../types.js';
|
|
3
|
+
export interface MenubarProps extends Pick<NebaStyleProps, 'size' | 'color' | 'density'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
4
|
+
/**
|
|
5
|
+
* Which way the bar runs. `vertical` is the shape a side rail of menus takes;
|
|
6
|
+
* the arrow keys follow it either way.
|
|
7
|
+
* @default 'horizontal'
|
|
8
|
+
*/
|
|
9
|
+
orientation?: NebaOrientation;
|
|
10
|
+
/**
|
|
11
|
+
* Whether an open menu takes the page away. On — the default, and Base UI's —
|
|
12
|
+
* an open menu is what the pointer is talking to.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
modal?: boolean;
|
|
16
|
+
/** Whether the arrow keys wrap around at the ends of the bar. @default true */
|
|
17
|
+
loopFocus?: boolean;
|
|
18
|
+
/** Disables every menu on the bar at once. */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** The menus. */
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export interface MenubarMenuProps {
|
|
24
|
+
/** The word on the bar. */
|
|
25
|
+
label: React.ReactNode;
|
|
26
|
+
/** Content before the label. Sized in `em`, so it tracks it. */
|
|
27
|
+
startIcon?: React.ReactNode;
|
|
28
|
+
/** Unavailable. The word stays on the bar and opens nothing. */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** The rows, written exactly as they are inside a [Menu](./menu). */
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* One menu on the bar: the word, and the rows behind it.
|
|
35
|
+
*
|
|
36
|
+
* It has no `size`, `color` or `density` of its own — all three belong to the
|
|
37
|
+
* bar, which is the only place they can be set once and hold for every menu on
|
|
38
|
+
* it. The rows inside are the same `MenuItem`, `MenuSeparator`, `MenuGroup` and
|
|
39
|
+
* `MenuSubmenu` a [Menu](./menu) takes, because it is the same menu.
|
|
40
|
+
*/
|
|
41
|
+
export declare function MenubarMenu({ label, startIcon, disabled, children }: MenubarMenuProps): React.JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* The strip of words at the top of an application — File, Edit, View — each of
|
|
44
|
+
* which opens a menu.
|
|
45
|
+
*
|
|
46
|
+
* What makes it a bar rather than a row of separate menus is what happens once
|
|
47
|
+
* one is open: moving along the strip walks through the others instead of
|
|
48
|
+
* closing the one you left, and the arrow keys move between the menus as well as
|
|
49
|
+
* inside them. Base UI owns all of that, along with the `menubar` role.
|
|
50
|
+
*
|
|
51
|
+
* It draws no surface of its own. A menu bar sits *on* something — a
|
|
52
|
+
* [Toolbar](../surfaces/toolbar), a [WindowPane](../surfaces/window-pane)'s
|
|
53
|
+
* title bar, a [Header](../layout/header) — and a sheet under a strip that is
|
|
54
|
+
* already on a sheet is two sheets.
|
|
55
|
+
*/
|
|
56
|
+
export declare const Menubar: React.ForwardRefExoticComponent<MenubarProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsxs as e,jsx as n}from"react/jsx-runtime";import*as t from"react";import{Menubar as o}from"@base-ui/react/menubar";import{Menu as r}from"../menu/Menu.js";import{MenuContext as s}from"../../internal/menu.js";import{controlTextClasses as a,cx as i,gapClasses as l,hasContent as c,iconClasses as d,paddingXClasses as u,radiusClasses as f,transitionClasses as m}from"../../internal/styles.js";const p={xs:"h-4.5",sm:"h-5.5",md:"h-6.5",lg:"h-8",xl:"h-10"},b=["inline-flex shrink-0 cursor-pointer select-none items-center justify-center","whitespace-nowrap font-medium leading-none","text-(--neba-fg) bg-transparent","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",m,d,"hover:bg-(--n-soft)","data-[popup-open]:bg-(--n-soft-hover) data-[popup-open]:text-(--n-accent)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]","disabled:cursor-not-allowed disabled:text-(--neba-disabled-fg) disabled:hover:bg-transparent"].join(" ");export function MenubarMenu({label:o,startIcon:i,disabled:d=!1,children:m}){const{size:h,color:x,density:v}=t.useContext(s);return n(r,{size:h,color:x,density:v,disabled:d,openOnHover:!0,sideOffset:4,trigger:e("button",{type:"button",disabled:d,className:[b,p[h],a[h],l[h],u["default"===v?"compact":v][h],f[h]].join(" "),children:[c(i)?i:null,o]}),children:m})}export const Menubar=/*@__PURE__*/t.forwardRef(function({size:e="md",color:r="primary",density:a="default",orientation:c="horizontal",modal:d=!0,loopFocus:u=!0,disabled:f=!1,className:m,style:p,children:b,...h},x){const v=t.useMemo(()=>({size:e,color:r,density:a}),[e,r,a]);return n(s.Provider,{value:v,children:n(o,{ref:x,orientation:c,modal:d,loopFocus:u,disabled:f,className:i("flex items-center","vertical"===c?"flex-col items-stretch":"flex-row",l[e],m??""),style:{"--n-soft":`var(--neba-${r}-soft)`,"--n-soft-hover":`var(--neba-${r}-soft-hover)`,"--n-accent":`var(--neba-${r}-accent)`,"--n-ring":`var(--neba-${r}-ring)`,...p},...h,children:b})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Menubar,MenubarMenu}from"./Menubar.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaColor, NebaSize, NebaThreshold } from '../../types.js';
|
|
3
|
+
export interface MeterProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* How much there is. Required, and that is the whole difference from a
|
|
6
|
+
* [ProgressLinear](./progress-linear): a meter reports a quantity that is
|
|
7
|
+
* already known, so there is no indeterminate case to have a default for.
|
|
8
|
+
*/
|
|
9
|
+
value: number;
|
|
10
|
+
/** @default 0 */
|
|
11
|
+
min?: number;
|
|
12
|
+
/** @default 100 */
|
|
13
|
+
max?: number;
|
|
14
|
+
/** A name for what is being measured. Read out with the value. */
|
|
15
|
+
label?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Shows the value as text beside the bar. A percentage of the range unless
|
|
18
|
+
* `format` says otherwise.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
showValue?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* How to write the value — `Intl.NumberFormat` options, so bytes, currencies
|
|
24
|
+
* and plain counts all work. A meter usually has real units, which is when
|
|
25
|
+
* this matters more than it does on a progress bar.
|
|
26
|
+
*/
|
|
27
|
+
format?: Intl.NumberFormatOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Where the bar changes colour, smallest `from` first. The family of the last
|
|
30
|
+
* threshold the value has reached wins; below all of them `color` stands.
|
|
31
|
+
*/
|
|
32
|
+
thresholds?: readonly NebaThreshold[];
|
|
33
|
+
/** Thickness of the groove. Nothing else on a bar has a size. @default 'md' */
|
|
34
|
+
size?: NebaSize;
|
|
35
|
+
/** The family the bar carries before any threshold is reached. @default 'primary' */
|
|
36
|
+
color?: NebaColor;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* How much of something there is, on a scale that is known in advance — disk
|
|
40
|
+
* used, seats taken, quota spent, a password's strength.
|
|
41
|
+
*
|
|
42
|
+
* It looks exactly like a [ProgressLinear](./progress-linear) and is not one.
|
|
43
|
+
* A progress bar is about *time*: something is happening and this is how far it
|
|
44
|
+
* has got, so it may have no value at all and it is expected to move on its own.
|
|
45
|
+
* A meter is about *quantity*: the number is already known, it does not move
|
|
46
|
+
* unless the thing it measures does, and it is meaningful to say the reading is
|
|
47
|
+
* bad — which is what `thresholds` is for.
|
|
48
|
+
*
|
|
49
|
+
* Base UI's Meter owns the semantics: `role="meter"`, the value and range
|
|
50
|
+
* attributes, and formatting the number for `aria-valuetext`.
|
|
51
|
+
*/
|
|
52
|
+
export declare const Meter: React.ForwardRefExoticComponent<MeterProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Meter as l}from"@base-ui/react/meter";import{barThicknessClasses as t,progressFraction as n,progressSlots as s}from"../../internal/progress.js";import{cx as o,metaTextClasses as i,stackGapClasses as m}from"../../internal/styles.js";export const Meter=/*@__PURE__*/a.forwardRef(function({value:a,min:u=0,max:f=100,label:c,showValue:d=!1,format:b,thresholds:h,size:x="md",color:p="primary",className:v,style:g,...j},w){const N=n(a,u,f),y=function(e,r,a){if(!a||0===a.length)return r;let l=r;for(const r of a)e>=r.from&&(l=r.color);return l}(a,p,h),_=void 0!==b;return r(l.Root,{ref:w,value:a,min:u,max:f,format:b,className:o("flex w-full flex-col",m[x],v??""),style:{...s(y),...g},...j,children:[c||d?r("div",{className:["flex items-baseline gap-2",c?"justify-between":"justify-end",i[x]].join(" "),children:[c?e(l.Label,{className:"min-w-0 truncate text-(--neba-fg)",children:c}):null,d?e(l.Value,{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:e=>_?e:`${Math.round(100*(N??0))}%`}):null]}):null,e(l.Track,{className:`relative w-full overflow-hidden rounded-full bg-(--n-soft) ${t[x]}`,children:e(l.Indicator,{className:"absolute top-0 rounded-full bg-(--n-fill) [transition:width_var(--neba-duration-fill)_var(--neba-ease),background-color_var(--neba-duration)_var(--neba-ease)]"})})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Meter}from"./Meter.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import*as r from"react";import{useRender as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import*as r from"react";import{useRender as a}from"@base-ui/react/use-render";import{transitionProps as n}from"../../internal/animate.js";import{MockupCutout as o,defaultNotch as s,elevationFilters as h,finishSlots as d,mockupChrome as l,mockupMetrics as c,resolveOs as u,shellClasses as m}from"../../internal/mockup.js";import{observeResize as p}from"../../internal/observe.js";import{cx as f,surfaceSlots as g}from"../../internal/styles.js";const b="undefined"==typeof document?r.useEffect:r.useLayoutEffect;export const Mockup=/*@__PURE__*/r.forwardRef(function({device:v,os:w,hardware:y="monitor",size:x="md",resolution:k,orientation:N="portrait",bezel:R="standard",finish:$="graphite",notch:z,systemUi:M=!0,scroll:j=!1,wallpaper:W,time:H="9:41",width:B,height:C,color:E="primary",elevation:L=0,transition:P,render:S,className:F,style:I,children:T,...U},q){const A=u(v,w),D=z??s(v,A),G="desktop"!==v&&"landscape"===N,J=c({device:v,size:x,resolution:k,orientation:N,bezel:R,hardware:y}),{screen:K,frame:O,body:Q,stand:V,base:X}=J,Y=r.useRef(null),[Z,_]=r.useState(null);b(()=>{const e=Y.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return;const i=Math.min(t.width/O.width,t.height/O.height);_(e=>null!==e&&Math.abs(e-i)<1e-4?e:i)};return t(),p(e,t)},[O.width,O.height]);const ee=r.useCallback(e=>{Y.current=e,"function"==typeof q?q(e):q&&(q.current=e)},[q]),te=M?l({os:A,notch:D,landscape:G,time:H}):{},ie=n(P),re="none"===R,ae=t("div",{className:"neba-mockup-screen relative flex flex-col overflow-hidden",style:{width:K.width,height:K.height,borderRadius:J.screenRadius,background:W??"var(--neba-surface)",boxShadow:re?void 0:"inset 0 0 0 1px var(--n-shell-shade)"},children:[te.top?.node,t("div",{className:"flex min-h-0 flex-1",children:[te.start?.node,e("div",{className:"min-w-0 flex-1 "+(j?"overflow-auto":"overflow-hidden"),style:{containerType:"size",containerName:"neba-screen"},children:T})]}),te.bottom?.node,e(o,{notch:D,screen:K,landscape:G})]}),ne=f("neba-mockup relative block",ie.className,F??"");return a({render:S,ref:ee,props:{className:ne,style:{...g(E,L),...d[$],...ie.style,width:B??(void 0===C?"100%":"auto"),height:C??"auto",aspectRatio:`${O.width} / ${O.height}`,filter:h[L],...I},children:t("div",{className:"absolute top-1/2 left-1/2 flex flex-col items-center",style:{width:O.width,height:O.height,transform:`translate(-50%, -50%) scale(${Z??1})`,visibility:null===Z?"hidden":void 0},children:[e("div",{className:re?"":m,style:{width:Q.width,height:Q.height,borderRadius:J.frameRadius,paddingBlock:`${J.bezel.top}px ${J.bezel.bottom}px`,paddingInline:J.bezel.x},children:ae}),V?t(i,{children:[e("div",{"aria-hidden":"true",style:{width:V.neckWidth,height:V.neckHeight,background:"var(--n-shell-shade)",clipPath:"polygon(16% 0, 84% 0, 100% 100%, 0 100%)"}}),e("div",{"aria-hidden":"true",className:m,style:{width:V.footWidth,height:V.footHeight,borderRadius:V.footHeight/2}})]}):null,X?e("div",{"aria-hidden":"true",className:`relative ${m}`,style:{width:X.width,height:X.height,borderRadius:`0 0 ${Math.round(.55*X.height)}px ${Math.round(.55*X.height)}px`,clipPath:"polygon(0 0, 100% 0, 98.5% 100%, 1.5% 100%)"},children:e("div",{className:"absolute top-0 left-1/2",style:{width:X.lipWidth,height:Math.round(.34*X.height),marginLeft:-X.lipWidth/2,borderRadius:`0 0 ${Math.round(.2*X.height)}px ${Math.round(.2*X.height)}px`,background:"var(--n-shell-shade)"}})}):null]}),...U}})});
|