neba 1.8.1 → 1.10.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 +7 -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-marquee/AnimateMarquee.js +1 -1
- package/dist/components/app-logo/AppLogo.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/blockquote/Blockquote.js +1 -1
- package/dist/components/box/Box.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.d.ts +13 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +17 -2
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.d.ts +105 -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/dialog/Dialog.d.ts +19 -2
- 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-bottom-navigation/FloatingBottomNavigation.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/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/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.d.ts +17 -2
- 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.d.ts +22 -1
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/rating/Rating.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.d.ts +16 -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/skeleton/Skeleton.js +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/switch/Switch.d.ts +13 -1
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/Table.d.ts +21 -2
- package/dist/components/table/Table.js +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.d.ts +16 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/toast/Toast.d.ts +17 -2
- 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 +97 -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/button-group.d.ts +6 -2
- 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/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 +55 -0
- package/package.json +2 -2
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaAlign, NebaSide, NebaSlots, NebaStyleProps } from '../../types.js';
|
|
3
|
+
/** One stop on the tour. */
|
|
4
|
+
export interface TourStep {
|
|
5
|
+
/**
|
|
6
|
+
* A CSS selector for what this step is about. Left out, the step is centred
|
|
7
|
+
* over the page with nothing cut out of the scrim — which is what a welcome
|
|
8
|
+
* step and a closing step are.
|
|
9
|
+
*/
|
|
10
|
+
target?: string;
|
|
11
|
+
/** The step's heading. */
|
|
12
|
+
title?: React.ReactNode;
|
|
13
|
+
/** What it says. */
|
|
14
|
+
content?: React.ReactNode;
|
|
15
|
+
/** Which edge of the target the card sits on. @default 'bottom' */
|
|
16
|
+
side?: NebaSide;
|
|
17
|
+
/** Where along that edge. @default 'center' */
|
|
18
|
+
align?: NebaAlign;
|
|
19
|
+
/**
|
|
20
|
+
* How far the cut-out is inflated past the target, in pixels. A control with
|
|
21
|
+
* a focus ring wants a couple; a whole panel wants none.
|
|
22
|
+
* @default 6
|
|
23
|
+
*/
|
|
24
|
+
padding?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The parts a Tour draws around its card.
|
|
28
|
+
*
|
|
29
|
+
* `className` is the card — the popup the steps are written on — and `mask` is
|
|
30
|
+
* the dimming behind it, which is a sibling of the popup rather than a
|
|
31
|
+
* descendant and so has no other way in.
|
|
32
|
+
*/
|
|
33
|
+
export type TourSlot = 'mask' | 'title' | 'description' | 'close' | 'footer';
|
|
34
|
+
export interface TourProps extends Pick<NebaStyleProps, 'size' | 'color' | 'density'> {
|
|
35
|
+
/** The stops, in order. */
|
|
36
|
+
steps: readonly TourStep[];
|
|
37
|
+
/** Whether the tour is running. Use with `onOpenChange` for a controlled one. */
|
|
38
|
+
open?: boolean;
|
|
39
|
+
/** Whether it starts running, for an uncontrolled one. @default false */
|
|
40
|
+
defaultOpen?: boolean;
|
|
41
|
+
onOpenChange?: (open: boolean) => void;
|
|
42
|
+
/** Which stop, from `0`. Use with `onStepChange` for a controlled one. */
|
|
43
|
+
step?: number;
|
|
44
|
+
/** Which one it starts on. @default 0 */
|
|
45
|
+
defaultStep?: number;
|
|
46
|
+
onStepChange?: (step: number) => void;
|
|
47
|
+
/** Called when the last step's button is pressed, before the tour closes. */
|
|
48
|
+
onFinish?: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Dims the page and cuts the target out of the dimming. Off, the card is the
|
|
51
|
+
* only thing the tour draws.
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
mask?: boolean;
|
|
55
|
+
/** Draws the Skip button beside the counter. @default true */
|
|
56
|
+
skippable?: boolean;
|
|
57
|
+
/** Whether Escape ends the tour. @default true */
|
|
58
|
+
dismissible?: boolean;
|
|
59
|
+
/** Scrolls each target into view as the tour reaches it. @default true */
|
|
60
|
+
scrollIntoView?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Which language the buttons and the counter are written in — a BCP 47 tag
|
|
63
|
+
* such as `ko`, `pt-BR` or `zh-Hant`. Unsupported tags fall back to English.
|
|
64
|
+
*/
|
|
65
|
+
locale?: string;
|
|
66
|
+
/** The Previous button. Defaults to the `locale`'s word. */
|
|
67
|
+
previousLabel?: React.ReactNode;
|
|
68
|
+
/** The Next button. */
|
|
69
|
+
nextLabel?: React.ReactNode;
|
|
70
|
+
/** What Next becomes on the last step. */
|
|
71
|
+
doneLabel?: React.ReactNode;
|
|
72
|
+
/** The Skip button. */
|
|
73
|
+
skipLabel?: React.ReactNode;
|
|
74
|
+
/** Class names for the card. */
|
|
75
|
+
className?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Class names for the parts around it. `className` is the card, so the
|
|
78
|
+
* dimming behind it is `classNames.mask`.
|
|
79
|
+
*/
|
|
80
|
+
classNames?: NebaSlots<TourSlot>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A guided walk over a page that already exists — the three things a new reader
|
|
84
|
+
* has to be shown once, pointed at where they actually are.
|
|
85
|
+
*
|
|
86
|
+
* It is [HowToSteps](../surfaces/how-to-steps) turned inside out. That component
|
|
87
|
+
* puts the instructions *in* the page and the reader follows them; this one
|
|
88
|
+
* leaves the page as it is and stands over it. The steps are therefore given by
|
|
89
|
+
* selector rather than as content: what a tour is about is already on screen,
|
|
90
|
+
* and describing it a second time inside the card would be two copies to keep
|
|
91
|
+
* in step.
|
|
92
|
+
*
|
|
93
|
+
* The dimming never takes the pointer. A reader can use the control being
|
|
94
|
+
* pointed at while the card is up, which is the difference between a tour and a
|
|
95
|
+
* sequence of dialogs.
|
|
96
|
+
*/
|
|
97
|
+
export declare function Tour({ steps, open, defaultOpen, onOpenChange, step, defaultStep, onStepChange, onFinish, mask, skippable, dismissible, scrollIntoView, locale, previousLabel, nextLabel, doneLabel, skipLabel, size, color, density, className, classNames }: TourProps): React.JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Popover as s}from"@base-ui/react/popover";import{Button as o}from"../button/Button.js";import{boxPaddingXClasses as i,boxPaddingYClasses as a}from"../box/Box.js";import{actionMessages as r,fill as l,stepsMessages as c,useMessages as d}from"../../internal/i18n.js";import{CloseIcon as m}from"../../internal/icons.js";import{observeResize as u}from"../../internal/observe.js";import{cx as p,hasContent as f,metaTextClasses as h,radiusClasses as g,sheetBodyClasses as b,sheetHeaderGapClasses as v,sheetSectionGapClasses as x,sheetTitleClasses as w,surfaceClasses as y,surfaceSlots as N}from"../../internal/styles.js";const k=[y,"relative flex flex-col","border text-(--neba-fg) bg-(--n-panel-press)","[border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]","[outline:none]","[transition:opacity_var(--neba-duration)_var(--neba-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),_={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},j={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};function z({spot:t,radius:n,className:s}){return e("div",null===t?{"aria-hidden":"true",className:p("pointer-events-none fixed inset-0 z-40 bg-(--neba-scrim)",s)}:{"aria-hidden":"true",className:p("pointer-events-none fixed z-40 [box-shadow:0_0_0_9999px_var(--neba-scrim)]",s),style:{top:t.top,left:t.left,width:t.width,height:t.height,borderRadius:n}})}export function Tour({steps:y,open:L,defaultOpen:S=!1,onOpenChange:C,step:E,defaultStep:P=0,onStepChange:O,onFinish:q,mask:B=!0,skippable:F=!0,dismissible:M=!0,scrollIntoView:R=!0,locale:T,previousLabel:A,nextLabel:I,doneLabel:V,skipLabel:$,size:D="md",color:H="primary",density:G="default",className:J,classNames:K}){const Q=d(c,T),U=d(r,T),[W,X]=n.useState(S),[Y,Z]=n.useState(P),ee=L??W,te=Math.min(E??Y,Math.max(0,y.length-1)),ne=y[te],[se,oe]=n.useState(null),ie=e=>{void 0===L&&X(e),C?.(e)},ae=e=>{void 0===E&&Z(e),O?.(e)};if(n.useEffect(()=>{const e=ne?.target;if(!ee||!e)return;const t=document.querySelector(e);if(!(t instanceof HTMLElement))return;R&&t.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"});const n=ne?.padding??6;let s=0;const o=()=>{s=0;const o=t.getBoundingClientRect();oe({selector:e,spot:{top:o.top-n,left:o.left-n,width:o.width+2*n,height:o.height+2*n}})},i=()=>{0===s&&(s=requestAnimationFrame(o))};o();const a=u(t,i);return window.addEventListener("scroll",i,{passive:!0,capture:!0}),window.addEventListener("resize",i,{passive:!0}),()=>{0!==s&&cancelAnimationFrame(s),a(),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}},[ee,ne?.target,ne?.padding,R]),0===y.length)return null;const re=ee&&ne?.target&&se?.selector===ne.target?se.spot:null,le=0===te,ce=te===y.length-1,de=i[G][D],me=a[G][D],ue=j[D],pe=f(ne?.title)||f(ne?.content);return t(s.Root,{open:ee,onOpenChange:(e,t)=>{(e||M||"escape-key"!==t.reason)&&(e||"outside-press"!==t.reason&&"focus-out"!==t.reason)?ie(e):t.cancel()},children:[ee&&B?e(z,{spot:re,radius:re?8:0,className:K?.mask}):null,e(s.Portal,{children:e(s.Positioner,{className:"neba-portal z-50 [outline:none]",side:ne?.side??"bottom",align:ne?.align??"center",sideOffset:10,collisionPadding:12,anchor:()=>{if(!ne?.target)return null;const e=document.querySelector(ne.target);return e instanceof Element?e:null},children:t(s.Popup,{className:p(k,g[D],b[D],x[D],_[D],de,me,J),style:N(H,3),children:[pe?t("div",{className:"flex items-start gap-3",children:[t("div",{className:`flex min-w-0 flex-1 flex-col ${v[D]}`,children:[f(ne?.title)?e(s.Title,{className:p("m-0 font-semibold",w[D],K?.title),children:ne?.title}):null,f(ne?.content)?e(s.Description,{className:p("m-0 min-w-0",K?.description),children:ne?.content}):null]}),M?e("button",{type:"button","aria-label":U.close,onClick:()=>ie(!1),className:p("flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center","rounded-full text-(--neba-muted-fg)","[&_svg]:size-[1.1em] [&_svg]:shrink-0","[transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)]","hover:bg-(--n-soft) hover:text-(--neba-fg)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2",K?.close),children:e(m,{})}):null]}):null,t("div",{className:p("flex items-center gap-2",K?.footer),children:[e("span",{className:`shrink-0 tabular-nums text-(--neba-muted-fg) ${h[D]}`,children:l(Q.position,{index:String(te+1),total:String(y.length)})}),t("div",{className:"ms-auto flex items-center gap-2",children:[F&&!ce?e(o,{size:ue,variant:"text",color:"secondary",onClick:()=>ie(!1),children:$??Q.skip}):null,le?null:e(o,{size:ue,variant:"outline",color:H,onClick:()=>ae(te-1),children:A??Q.previous}),e(o,{size:ue,color:H,onClick:()=>ce?(q?.(),void ie(!1)):ae(te+1),children:ce?V??Q.done:I??Q.next})]})]})]})})})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Tour}from"./Tour.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NebaStyleProps } from '../../types.js';
|
|
3
|
+
/** One thing that can be on either side. */
|
|
4
|
+
export interface TransferItem {
|
|
5
|
+
/** What identifies it, and what `value` is a list of. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** What the row says. */
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
/** In the list but not movable. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface TransferProps extends NebaStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
13
|
+
/** Everything that can be on either side, in the order the lists show it. */
|
|
14
|
+
items: readonly TransferItem[];
|
|
15
|
+
/** What is on the right. Use with `onValueChange` for a controlled pair. */
|
|
16
|
+
value?: readonly string[];
|
|
17
|
+
/** What starts on the right, for an uncontrolled one. */
|
|
18
|
+
defaultValue?: readonly string[];
|
|
19
|
+
onValueChange?: (value: string[]) => void;
|
|
20
|
+
/** The heading over the left-hand list. Defaults to the `locale`'s word. */
|
|
21
|
+
sourceLabel?: React.ReactNode;
|
|
22
|
+
/** And over the right-hand one. */
|
|
23
|
+
targetLabel?: React.ReactNode;
|
|
24
|
+
/** Puts a filter above each list. @default false */
|
|
25
|
+
searchable?: boolean;
|
|
26
|
+
/** How tall each list is. A number of pixels or any CSS length. @default 220 */
|
|
27
|
+
height?: number | string;
|
|
28
|
+
/** Nothing can be ticked or moved. */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Which language the headings, the buttons and the filter are written in — a
|
|
32
|
+
* BCP 47 tag such as `ko`, `pt-BR` or `zh-Hant`. Unsupported tags fall back
|
|
33
|
+
* to English.
|
|
34
|
+
*/
|
|
35
|
+
locale?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Two lists and the arrows between them: everything that could be chosen on one
|
|
39
|
+
* side, everything that has been on the other.
|
|
40
|
+
*
|
|
41
|
+
* It is the shape for a choice that is *long* — the columns in a report, the
|
|
42
|
+
* permissions on a role, the people on a channel — where a
|
|
43
|
+
* [Combobox](./combobox) with forty chips in its field stops being readable and
|
|
44
|
+
* a list of forty checkboxes gives no answer to "what did I actually pick".
|
|
45
|
+
* Below about a dozen options, one of those two is the smaller component.
|
|
46
|
+
*
|
|
47
|
+
* The order of `items` is the order both lists show, so a row does not move when
|
|
48
|
+
* it is sent across and back. What ticks are for is choosing which rows to move;
|
|
49
|
+
* `value` is which side they are on, and the two are deliberately separate —
|
|
50
|
+
* ticking is not choosing.
|
|
51
|
+
*/
|
|
52
|
+
export declare const Transfer: React.ForwardRefExoticComponent<TransferProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{Checkbox as t}from"../checkbox/Checkbox.js";import{IconButton as s}from"../icon-button/IconButton.js";import{ScrollArea as r}from"../scroll-area/ScrollArea.js";import{TextField as i}from"../text-field/TextField.js";import{transferMessages as n,useMessages as o}from"../../internal/i18n.js";import{ArrowRightIcon as c}from"../../internal/icons.js";import{searchText as d}from"../../internal/search.js";import{cx as h,fieldRestClasses as m,hasContent as u,metaTextClasses as f,paddingXClasses as b,radiusClasses as p,surfaceSlots as g,toLength as v}from"../../internal/styles.js";const x={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},y={xs:"py-0.5",sm:"py-1",md:"py-1",lg:"py-1.5",xl:"py-2"};function k({title:a,rows:s,ticked:n,onTick:o,onTickAll:c,search:d,onSearch:h,searchable:u,disabled:v,height:k,emptyMessage:S,searchLabel:w,selectAllLabel:j,style:N}){const{size:$,variant:z="outline",color:A="primary",density:C="default"}=N,T=s.filter(e=>!e.disabled),L=T.filter(e=>n.has(e.value)),M=T.length>0&&L.length===T.length,V=L.length>0&&!M,_=b[C][$];return l("div",{className:["flex min-w-0 flex-col overflow-hidden",m[z],p[$]].join(" "),style:g(A,0),children:[l("div",{className:`flex items-center gap-2 border-b [border-color:var(--neba-border)] ${_} ${x[$]}`,children:[e(t,{size:$,color:A,checked:M,indeterminate:V,disabled:v||0===T.length,"aria-label":j,onCheckedChange:e=>c(!0===e)}),e("span",{className:`min-w-0 flex-1 truncate font-medium ${f[$]}`,children:a}),l("span",{className:`shrink-0 tabular-nums text-(--neba-muted-fg) ${f[$]}`,children:[L.length,"/",s.length]})]}),u?e("div",{className:`${_} ${x[$]}`,children:e(i,{size:$,color:A,density:C,fullWidth:!0,variant:"text",disabled:v,placeholder:w,"aria-label":w,value:d,onChange:e=>h(e.target.value)})}):null,e(r,{size:$,color:A,height:k,fade:!0,children:e("div",{className:`flex flex-col ${_} ${x[$]}`,children:0===s.length?e("span",{className:`text-(--neba-muted-fg) ${f[$]} ${y[$]}`,children:S}):s.map(l=>e(t,{size:$,color:A,className:y[$],label:l.label,checked:n.has(l.value),disabled:v||l.disabled,onCheckedChange:e=>o(l.value,!0===e)},l.value))})})]})}function S(e,l){const a=d(l);return""===a?e:e.filter(e=>"string"!=typeof e.label||d(e.label).includes(a))}export const Transfer=/*@__PURE__*/a.forwardRef(function({items:t,value:r,defaultValue:i,onValueChange:d,sourceLabel:m,targetLabel:f,searchable:b=!1,height:p=220,disabled:g=!1,locale:x,variant:y="outline",size:w="md",color:j="primary",density:N="default",className:$,...z},A){const C=o(n,x),[T,L]=a.useState(i??[]),M=r??T,[V,_]=a.useState(()=>new Set),[B,F]=a.useState(""),[I,R]=a.useState(""),W=a.useMemo(()=>new Set(M),[M]),q=a.useMemo(()=>t.filter(e=>!W.has(e.value)),[t,W]),D=a.useMemo(()=>t.filter(e=>W.has(e.value)),[t,W]),E=(e,l)=>{_(a=>{const t=new Set(a);return l?t.add(e):t.delete(e),t})},G=(e,l)=>{_(a=>{const t=new Set(a);for(const a of e)a.disabled||(l?t.add(a.value):t.delete(a.value));return t})},H=(e,l)=>{const a=e.filter(e=>!e.disabled&&V.has(e.value));if(0===a.length)return;const s=new Set(a.map(e=>e.value)),i=l?t.filter(e=>W.has(e.value)||s.has(e.value)).map(e=>e.value):M.filter(e=>!s.has(e));_(e=>new Set([...e].filter(e=>!s.has(e)))),(e=>{void 0===r&&L(e),d?.(e)})(i)},J=S(q,B),K=S(D,I),O=J.some(e=>!e.disabled&&V.has(e.value)),P=K.some(e=>!e.disabled&&V.has(e.value)),Q=v(p),U={variant:y,size:w,color:j,density:N};return l("div",{ref:A,className:h("grid w-full items-center gap-3","[grid-template-columns:minmax(0,1fr)_auto_minmax(0,1fr)]",$??""),...z,children:[e(k,{title:u(m)?m:C.source,rows:J,ticked:V,onTick:E,onTickAll:e=>G(J,e),search:B,onSearch:F,searchable:b,disabled:g,height:Q,emptyMessage:C.empty,searchLabel:C.search,selectAllLabel:C.selectAll,style:U}),l("div",{className:"flex flex-col gap-2",children:[e(s,{size:w,color:j,variant:"text"===y?"text":"outline",label:C.toTarget,disabled:g||!O,onClick:()=>H(J,!0),icon:e(c,{})}),e(s,{size:w,color:j,variant:"text"===y?"text":"outline",label:C.toSource,disabled:g||!P,onClick:()=>H(K,!1),icon:e("span",{className:"flex rotate-180",children:e(c,{})})})]}),e(k,{title:u(f)?f:C.target,rows:K,ticked:V,onTick:E,onTickAll:e=>G(K,e),search:I,onSearch:R,searchable:b,disabled:g,height:Q,emptyMessage:C.empty,searchLabel:C.search,selectAllLabel:C.selectAll,style:U})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Transfer}from"./Transfer.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{ChevronIcon as a}from"../../internal/icons.js";import{controlTextClasses as l,cx as s,gapClasses as o,hasContent as i,iconClasses as c,radiusClasses as d,surfaceClasses as u,surfaceSlots as m,transitionClasses as f}from"../../internal/styles.js";const p=/*@__PURE__*/n.createContext({size:"md",density:"default",disabled:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),x={solid:[u,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[u,"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"},
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{ChevronIcon as a}from"../../internal/icons.js";import{controlTextClasses as l,cx as s,gapClasses as o,hasContent as i,iconClasses as c,radiusClasses as d,surfaceClasses as u,surfaceSlots as m,transitionClasses as f}from"../../internal/styles.js";const p=/*@__PURE__*/n.createContext({size:"md",density:"default",disabled:!1,expandedKeys:new Set,selectedKeys:new Set,activeKey:null,toggle:()=>{},select:()=>{},activate:()=>{},register:()=>()=>{}}),x={solid:[u,"text-(--neba-fg) bg-(--n-panel-hover)","[box-shadow:var(--n-elev),var(--neba-plate-solid)]"].join(" "),outline:[u,"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={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.75rem"},b={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},h={default:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-3.5"},compact:{xs:"px-1",sm:"px-1",md:"px-1.5",lg:"px-2",xl:"px-2.5"}},v={xs:"rounded-[0.3125rem]",sm:"rounded-[0.375rem]",md:"rounded-[0.5rem]",lg:"rounded-[0.625rem]",xl:"rounded-[0.75rem]"},w={none:"",simple:"neba-tree-simple",folder:"neba-tree-folder"};function y(e){return Array.from(e.querySelectorAll('[role="treeitem"]'))}const k=e=>String(e);export const TreeView=/*@__PURE__*/n.forwardRef(function({variant:t="outline",size:r="md",color:a="primary",density:l="default",elevation:o=0,lines:i="simple",expanded:c,defaultExpanded:u,onExpandedChange:h,selected:v,defaultSelected:C,onSelectedChange:N,multiple:S=!1,disabled:K=!1,label:j,className:A,style:D,children:R,onKeyDown:E,...I},P){const[z,M]=n.useState(u??[]),[V,_]=n.useState(C??[]),[L,T]=n.useState(null),q=c??z,F=v??V,H=n.useRef(null),O=n.useCallback(e=>{H.current=e,"function"==typeof P?P(e):P&&(P.current=e)},[P]),U=n.useCallback(e=>{const t=k(e),r=c??z,n=r.some(e=>k(e)===t)?r.filter(e=>k(e)!==t):[...r,e];void 0===c&&M(n),h?.(n)},[c,z,h]),B=n.useCallback(e=>{const t=k(e),r=v??V,n=r.some(e=>k(e)===t),a=S?n?r.filter(e=>k(e)!==t):[...r,e]:[e];void 0===v&&_(a),N?.(a)},[S,v,V,N]),G=n.useRef(new Map),J=n.useCallback((e,t)=>(G.current.set(e,t),()=>{G.current.delete(e)}),[]),Q=n.useMemo(()=>q.map(k).join("\0"),[q]),W=n.useMemo(()=>F.map(k).join("\0"),[F]),X=n.useMemo(()=>({size:r,density:l,disabled:K,expandedKeys:new Set(q.map(k)),selectedKeys:new Set(F.map(k)),activeKey:L,toggle:U,select:B,activate:T,register:J}),[r,l,K,Q,W,L,U,B,J]);n.useEffect(()=>{if(null!==L&&G.current.has(L))return;const e=H.current;if(!e)return;const t=y(e);0!==t.length&&T(t[0].dataset.nebaValue??null)});const Y=s("flex list-none flex-col p-1",d[r],x[t],f,w[i],A);return e(p.Provider,{value:X,children:e("ul",{ref:O,role:"tree","aria-label":j,"aria-multiselectable":S||void 0,className:Y,style:{...m(a,o),"--n-tree-indent":g[r],"--n-tree-row":b[r],...D},onKeyDown:function(e){if(E?.(e),e.defaultPrevented)return;const t=H.current,r=e.target?.closest?.('[role="treeitem"]');if(!t||!r||!t.contains(r))return;const n=y(t),a=n.indexOf(r);if(-1===a)return;const l=t=>{t&&(e.preventDefault(),T(t.dataset.nebaValue??null),t.focus())},s=e=>{const t=e.dataset.nebaValue;t&&G.current.get(t)?.toggle()},o="rtl"===getComputedStyle(t).direction,i=o?"ArrowLeft":"ArrowRight",c=o?"ArrowRight":"ArrowLeft",d=r.getAttribute("aria-expanded");switch(e.key){case"ArrowDown":l(n[a+1]);break;case"ArrowUp":l(n[a-1]);break;case"Home":l(n[0]);break;case"End":l(n[n.length-1]);break;case i:"false"===d?(e.preventDefault(),s(r)):"true"===d&&l(n[a+1]);break;case c:"true"===d?(e.preventDefault(),s(r)):l(r.parentElement?.closest('[role="treeitem"]'));break;case"Enter":case" ":e.preventDefault(),r.click()}},...I,children:R})})});export const TreeItem=/*@__PURE__*/n.forwardRef(function({value:d,label:u,startIcon:m,endIcon:x,action:g,href:b,expandable:w,disabled:y=!1,className:C,children:N,onClick:S,...K},j){const{size:A,density:D,disabled:R,expandedKeys:E,selectedKeys:I,activeKey:P,toggle:z,select:M,activate:V,register:_}=n.useContext(p),L=n.useId(),T=d??L,q=k(T),F=n.useRef(null),H=n.useCallback(e=>{F.current=e,"function"==typeof j?j(e):j&&(j.current=e)},[j]),O=n.Children.toArray(N),U=w??O.length>0,B=U&&E.has(q),G=I.has(q),J=y||R,Q=n.useRef({toggle:()=>{}});Q.current.toggle=()=>{!J&&U&&z(T)},n.useEffect(()=>_(q,Q.current),[q,_]);const W=s("flex min-w-0 flex-1 cursor-pointer items-center text-start","h-(--n-tree-row)",h[D][A],v[A],o[A],l[A],f,c,"group-focus-visible/tree-item:[outline:2px_solid_var(--n-ring)]","group-focus-visible/tree-item:outline-offset-[-2px]",J?"cursor-not-allowed text-(--neba-disabled-fg)":G?"bg-(--n-soft-press) font-medium text-(--n-accent) hover:bg-(--n-soft-press)":"hover:bg-(--n-soft)"),X=r(t,{children:[e("span",{"aria-hidden":"true",onClick:e=>{!J&&U&&(e.stopPropagation(),e.preventDefault(),F.current?.focus(),V(q),z(T))},className:s("flex h-[1lh] w-[1.15em] shrink-0 items-center justify-center","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",U?"text-(--neba-muted-fg)":"",B?"rotate-0":"-rotate-90 rtl:rotate-90"),children:U?e(a,{}):null}),i(m)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:m}):null,e("span",{className:"min-w-0 flex-1 truncate",children:u}),i(x)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:x}):null]});return r("li",{ref:H,role:"treeitem","aria-expanded":U?B:void 0,"aria-selected":!!G||void 0,"aria-disabled":J||void 0,"data-neba-value":q,tabIndex:P===q?0:-1,className:s("group/tree-item relative block [outline:none]",C),onClick:function(e){e.stopPropagation(),J?e.preventDefault():(F.current?.focus(),V(q),S?.(e),e.defaultPrevented||(U&&z(T),M(T)))},...K,children:[r("div",{className:"flex w-full items-center",children:[b&&!J?e("a",{href:b,tabIndex:-1,className:W,"aria-current":G?"page":void 0,children:X}):e("div",{className:W,children:X}),i(g)?e("span",{className:s("flex shrink-0 items-center",h[D][A]),onClick:e=>e.stopPropagation(),children:g}):null]}),U&&B&&O.length>0?e("ul",{role:"group",className:"list-none ps-(--n-tree-indent)",children:N}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as t}from"@base-ui/react/use-render";import{transitionProps as r}from"../../internal/animate.js";const
|
|
1
|
+
"use client";import*as e from"react";import{useRender as t}from"@base-ui/react/use-render";import{transitionProps as r}from"../../internal/animate.js";import{cx as m}from"../../internal/styles.js";const n={h1:"text-[1.875rem]/[2.25rem] tracking-[-0.02em]",h2:"text-[1.5rem]/[1.875rem] tracking-[-0.015em]",h3:"text-[1.25rem]/[1.625rem] tracking-[-0.01em]",h4:"text-[1.0625rem]/[1.5rem]",h5:"text-[0.9375rem]/[1.375rem]",h6:"text-[0.8125rem]/[1.25rem]",lead:"text-[1.0625rem]/[1.75rem]",body:"text-[0.8125rem]/[1.375rem]",caption:"text-[0.75rem]/[1.125rem]",overline:"text-[0.6875rem]/[1rem] tracking-[0.08em] uppercase"},a={h1:"semibold",h2:"semibold",h3:"semibold",h4:"semibold",h5:"semibold",h6:"semibold",lead:"regular",body:"regular",caption:"regular",overline:"medium"},l={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",lead:"p",body:"p",caption:"span",overline:"span"},i=new Set(["caption","overline"]),o={h1:"mb-4",h2:"mb-3.5",h3:"mb-3",h4:"mb-2.5",h5:"mb-2",h6:"mb-2",lead:"mb-4",body:"mb-3",caption:"mb-2",overline:"mb-2"},s={regular:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},c={start:"text-start",center:"text-center",end:"text-end",justify:"text-justify"},h={1:"truncate",2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"};export const Typography=/*@__PURE__*/e.forwardRef(function({level:d="body",color:b,weight:p,align:u,lines:x,gutter:f=!1,transition:g,render:y,className:v,style:j,children:k,...w},N){const E=r(g),R=m(n[d],s[p??a[d]],u?c[u]:"",x?h[x]??"line-clamp-6":"",f?o[d]:"",b?"text-(--n-accent)":i.has(d)?"text-(--neba-muted-fg)":"text-(--neba-fg)",E.className,v??"");return t({render:y??e.createElement(l[d]),ref:N,props:{className:R,style:b?{"--n-accent":`var(--neba-${b}-accent)`,...E.style,...j}:{...E.style,...j},children:k,...w}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRender as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRender as o}from"@base-ui/react/use-render";import{beginPointerDrag as r}from"../../internal/drag.js";import{actionMessages as a,useMessages as s,windowMessages as l}from"../../internal/i18n.js";import{cx as d,hasContent as c,iconClasses as u,surfaceClasses as m}from"../../internal/styles.js";import{WindowControls as h,orderControls as f,windowChrome as w,windowMetrics as g,windowSlots as p}from"../../internal/window.js";function b(e,t,n){const[o,r]=i.useState(t),a=void 0!==e;return[a?e:o,i.useCallback(e=>{a||r(e),n?.(e)},[a,n])]}const v=[{edge:"n",className:"inset-x-3 top-0 h-1.5 cursor-ns-resize"},{edge:"s",className:"inset-x-3 bottom-0 h-1.5 cursor-ns-resize"},{edge:"w",className:"inset-y-3 left-0 w-1.5 cursor-ew-resize"},{edge:"e",className:"inset-y-3 right-0 w-1.5 cursor-ew-resize"},{edge:"nw",className:"top-0 left-0 size-3 cursor-nwse-resize"},{edge:"ne",className:"top-0 right-0 size-3 cursor-nesw-resize"},{edge:"sw",className:"bottom-0 left-0 size-3 cursor-nesw-resize"},{edge:"se",className:"right-0 bottom-0 size-3 cursor-nwse-resize"}];export const WindowPane=/*@__PURE__*/i.forwardRef(function({os:x="macos",title:z,icon:y,actions:N,controls:M=!0,size:C="md",color:E="primary",accent:S=!1,transparency:k=0,active:L,elevation:I=2,position:R="static",draggable:j=!1,resizable:B=!1,width:D,height:A,minWidth:T=180,minHeight:H,offset:P,defaultOffset:W,onOffsetChange:O,onResize:X,open:$,defaultOpen:F=!0,onOpenChange:Y,minimized:_,defaultMinimized:q=!1,onMinimizedChange:K,maximized:U,defaultMaximized:G=!1,onMaximizedChange:J,scroll:Q=!0,locale:V,minimizeLabel:Z,maximizeLabel:ee,restoreLabel:te,closeLabel:ne,resizeLabel:ie,render:oe,className:re,style:ae,children:se,...le},de){const ce=s(l,V),ue=s(a,V),me=w(x),he=g(x,C),fe=i.useId(),[we,ge]=b($,F,Y),[pe,be]=b(_,q,K),[ve,xe]=b(U,G,J),[ze,ye]=b(P,W??{x:0,y:0},O),[Ne,Me]=i.useState(null),[Ce,Ee]=i.useState(!0),Se=L??Ce,[ke,Le]=i.useState(null),[Ie,Re]=i.useState(null),[je,Be]=i.useState(!1),[De,Ae]=i.useState(!1),[Te,He]=i.useState(we);Te!==we&&(He(we),Ae(!we)),i.useEffect(()=>{if(!De)return;const e=window.setTimeout(()=>Ae(!1),260);return()=>window.clearTimeout(e)},[De]);const Pe=i.useRef(null),We=i.useCallback(e=>{Pe.current=e,"function"==typeof de?de(e):de&&(de.current=e)},[de]);i.useEffect(()=>{if(void 0!==L)return;const e=Pe.current;if(!e)return;const t=t=>{const n=t.target;if(!(n instanceof Node))return;if(e.contains(n))return void Ee(!0);const i=n instanceof Element?n:n.parentElement;i?.closest(".neba-window")&&Ee(!1)};return document.addEventListener("pointerdown",t,!0),document.addEventListener("focusin",t,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("focusin",t,!0)}},[L]);const Oe=i.useRef(null);function Xe(e,t){if(0!==e.button)return;Oe.current?.();const n=e.currentTarget,i=e.clientX,o=e.clientY;Be(!0);const a=()=>{Oe.current=null,Be(!1)},s=r({target:n,pointerId:e.pointerId,onMove:e=>t(e.clientX-i,e.clientY-o),onEnd:a});Oe.current=()=>{s(),a()}}i.useEffect(()=>()=>Oe.current?.(),[]);const $e={width:Math.max(0,T),height:Math.max(he.bar,H??he.bar)};function Fe(e){Me(e),X?.(e)}const Ye=f(x,!0===M?["minimize","maximize","close"]:!1===M?[]:M),_e=Ye.includes("maximize");i.useEffect(()=>{if(pe||null===Ie)return;const e=window.setTimeout(()=>Re(null),400);return()=>window.clearTimeout(e)},[pe,Ie]);const qe={minimize:Z??ce.minimize,maximize:ee??ce.maximize,restore:te??ce.restore,close:ne??ue.close},Ke=e(h,{os:x,metrics:he,controls:Ye,maximized:ve,active:Se,labels:qe,onCommand:function(e){"close"===e?ge(!1):"minimize"===e?function(e){const t=Pe.current,n=t?.firstElementChild;if(t&&n instanceof HTMLElement&&Le(n.offsetHeight+(t.offsetHeight-t.clientHeight)),e&&void 0===(Ne?.height??A)&&t)return Re(t.getBoundingClientRect().height),void requestAnimationFrame(()=>be(!0));be(e)}(!pe):xe(!ve)}}),Ue=c(z)?e("span",{id:fe,className:"min-w-0 truncate",children:z}):null,Ge=c(y)?e("span",{className:"flex shrink-0 items-center",children:y}):null,Je=t("div",{className:d("relative flex shrink-0 items-center select-none",u,j&&!ve?"cursor-grab active:cursor-grabbing":""),style:{height:he.bar,textShadow:"var(--n-window-bar-shadow)",fontWeight:he.weight,paddingInlineStart:he.padX,paddingInlineEnd:he.padEnd,gap:Math.round(.7*he.title),fontSize:he.title,backgroundColor:"var(--n-window-bar)",backgroundImage:"var(--n-window-bar-image)",color:"var(--n-window-bar-fg)",borderBlockEnd:me.rule?"1px solid var(--n-window-line)":void 0},onPointerDown:function(e){if(!j||ve)return;const t={...ze};Xe(e,(e,n)=>ye({x:t.x+e,y:t.y+n}))},onDoubleClick:_e?()=>xe(!ve):void 0,children:["start"===me.controlsSide?Ke:null,"center"===me.titleAlign?e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 flex items-center justify-center",style:{paddingInline:he.controlsWidth(Ye.length)+2*he.padX},children:t("span",{className:"flex min-w-0 items-center",style:{gap:Math.round(.5*he.title)},children:[Ge,Ue]})}):t(n,{children:[Ge,Ue]}),e("span",{className:"flex-1"}),c(N)?e("span",{className:"flex shrink-0 items-center",style:{gap:Math.round(.5*he.title)},onPointerDown:e=>e.stopPropagation(),children:N}):null,"end"===me.controlsSide?Ke:null]}),Qe=ve?{left:0,top:0,width:"100%",height:"100%"}:{left:ze.x,top:ze.y,width:Ne?.width??D,height:pe?ke??he.bar:Ne?.height??A??Ie??void 0},Ve=o({render:oe,ref:We,props:{role:"group","aria-labelledby":Ue?fe:void 0,className:d("neba-window relative flex min-w-0 flex-col overflow-hidden",k>0?m:"",me.glass&&0===k?"[backdrop-filter:var(--neba-blur)]":"","[transition-property:left,top,width,height,opacity,box-shadow,background-color,border-color,border-radius]","[transition-duration:var(--neba-duration-window)]","[transition-timing-function:var(--neba-ease)]","motion-reduce:[transition-duration:0ms]","data-[gesture]:[transition-property:none]",re),"data-gesture":je?"":void 0,inert:!we||void 0,style:{opacity:we?void 0:0,...p({os:x,color:E,accent:S,transparency:k,active:Se,elevation:I}),position:"static"===R?"relative":R,...Qe,borderRadius:ve?0:`${he.radius}px ${he.radius}px ${he.radiusBottom}px ${he.radiusBottom}px`,borderStyle:"solid",borderWidth:he.frame,borderColor:"var(--n-window-line)",backgroundColor:"var(--n-window-band)",boxShadow:"var(--n-window-shadow), var(--neba-plate-glass)",...ae},children:t(n,{children:[Je,e("div",{className:d("min-h-0 flex-1",Q?"overflow-auto":"overflow-hidden"),style:{backgroundColor:"var(--n-window-body)",marginInline:he.band.side,marginBottom:he.band.bottom,boxShadow:he.band.side>0?"inset 0 0 0 1px rgb(0 0 0 / 0.12)":void 0},inert:pe,children:se}),!B||ve||pe?null:v.map(t=>{const n="se"===t.edge;return e("div",{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?ie??ce.resize:void 0,"aria-hidden":n?void 0:"true",className:d("absolute z-10 touch-none",t.className,n?"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]":""),onPointerDown:e=>function(e,t){const n=Pe.current;if(!n||ve)return;const i=n.getBoundingClientRect(),o={width:i.width,height:i.height,x:ze.x,y:ze.y},r=e.includes("e"),a=e.includes("w"),s=e.includes("n"),l=e.includes("s");Xe(t,(e,t)=>{let{width:n,height:i}=o,{x:d,y:c}=o;r&&(n=Math.max($e.width,o.width+e)),l&&(i=Math.max($e.height,o.height+t)),a&&(n=Math.max($e.width,o.width-e),d=o.x+(o.width-n)),s&&(i=Math.max($e.height,o.height-t),c=o.y+(o.height-i)),Fe({width:n,height:i}),(a||s)&&ye({x:d,y:c})})}(t.edge,e),onKeyDown:n?e=>{const t={ArrowRight:[16,0],ArrowLeft:[-16,0],ArrowDown:[0,16],ArrowUp:[0,-16]}[e.key];t&&(e.preventDefault(),function(e,t){const n=Pe.current;if(!n)return;const i=n.getBoundingClientRect();Fe({width:Math.max($e.width,i.width+e),height:Math.max($e.height,i.height+t)})}(t[0],t[1]))}:void 0},t.edge)})]}),...le}});return we||De?Ve:null});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './components/accordion/index.js';
|
|
3
3
|
export * from './components/alert/index.js';
|
|
4
|
+
export * from './components/anchor/index.js';
|
|
4
5
|
export * from './components/animate-appear/index.js';
|
|
5
6
|
export * from './components/app-logo/index.js';
|
|
6
7
|
export * from './components/animate-blink/index.js';
|
|
@@ -16,6 +17,7 @@ export * from './components/animate-zoom/index.js';
|
|
|
16
17
|
export * from './components/area-chart/index.js';
|
|
17
18
|
export * from './components/aspect-ratio/index.js';
|
|
18
19
|
export * from './components/avatar/index.js';
|
|
20
|
+
export * from './components/avatar-group/index.js';
|
|
19
21
|
export * from './components/badge/index.js';
|
|
20
22
|
export * from './components/bar-chart/index.js';
|
|
21
23
|
export * from './components/blockquote/index.js';
|
|
@@ -33,7 +35,9 @@ export * from './components/code-block/index.js';
|
|
|
33
35
|
export * from './components/collapsible/index.js';
|
|
34
36
|
export * from './components/color-picker/index.js';
|
|
35
37
|
export * from './components/combobox/index.js';
|
|
38
|
+
export * from './components/command-palette/index.js';
|
|
36
39
|
export * from './components/container/index.js';
|
|
40
|
+
export * from './components/data-list/index.js';
|
|
37
41
|
export * from './components/data-table/index.js';
|
|
38
42
|
export * from './components/date-picker/index.js';
|
|
39
43
|
export * from './components/date-range-picker/index.js';
|
|
@@ -42,7 +46,10 @@ export * from './components/dialog/index.js';
|
|
|
42
46
|
export * from './components/divider/index.js';
|
|
43
47
|
export * from './components/drawer/index.js';
|
|
44
48
|
export * from './components/empty/index.js';
|
|
49
|
+
export * from './components/fieldset/index.js';
|
|
45
50
|
export * from './components/file-picker/index.js';
|
|
51
|
+
export * from './components/form/index.js';
|
|
52
|
+
export * from './components/gauge-chart/index.js';
|
|
46
53
|
export * from './components/grid/index.js';
|
|
47
54
|
export * from './components/floating-action-button/index.js';
|
|
48
55
|
export * from './components/floating-bottom-navigation/index.js';
|
|
@@ -51,13 +58,17 @@ export * from './components/grid-container/index.js';
|
|
|
51
58
|
export * from './components/header/index.js';
|
|
52
59
|
export * from './components/heatmap-chart/index.js';
|
|
53
60
|
export * from './components/highlight/index.js';
|
|
61
|
+
export * from './components/hover-card/index.js';
|
|
54
62
|
export * from './components/how-to-steps/index.js';
|
|
55
63
|
export * from './components/icon/index.js';
|
|
56
64
|
export * from './components/icon-button/index.js';
|
|
57
65
|
export * from './components/line-chart/index.js';
|
|
58
66
|
export * from './components/list/index.js';
|
|
59
67
|
export * from './components/menu/index.js';
|
|
68
|
+
export * from './components/menubar/index.js';
|
|
69
|
+
export * from './components/meter/index.js';
|
|
60
70
|
export * from './components/mockup/index.js';
|
|
71
|
+
export * from './components/navigation-menu/index.js';
|
|
61
72
|
export * from './components/number-field/index.js';
|
|
62
73
|
export * from './components/otp-field/index.js';
|
|
63
74
|
export * from './components/overlay/index.js';
|
|
@@ -73,6 +84,7 @@ export * from './components/progress-linear/index.js';
|
|
|
73
84
|
export * from './components/radio-group/index.js';
|
|
74
85
|
export * from './components/rating/index.js';
|
|
75
86
|
export * from './components/scatter-chart/index.js';
|
|
87
|
+
export * from './components/scroll-area/index.js';
|
|
76
88
|
export * from './components/scroll-zone/index.js';
|
|
77
89
|
export * from './components/segmented-button/index.js';
|
|
78
90
|
export * from './components/select/index.js';
|
|
@@ -92,8 +104,12 @@ export * from './components/time-picker/index.js';
|
|
|
92
104
|
export * from './components/timeline/index.js';
|
|
93
105
|
export * from './components/timeline-chart/index.js';
|
|
94
106
|
export * from './components/toast/index.js';
|
|
107
|
+
export * from './components/toggle/index.js';
|
|
108
|
+
export * from './components/toggle-group/index.js';
|
|
95
109
|
export * from './components/toolbar/index.js';
|
|
96
110
|
export * from './components/tooltip/index.js';
|
|
111
|
+
export * from './components/tour/index.js';
|
|
112
|
+
export * from './components/transfer/index.js';
|
|
97
113
|
export * from './components/tree-view/index.js';
|
|
98
114
|
export * from './components/typography/index.js';
|
|
99
115
|
export * from './components/window-pane/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./types.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/animate-appear/index.js";export*from"./components/app-logo/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/area-chart/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/badge/index.js";export*from"./components/bar-chart/index.js";export*from"./components/blockquote/index.js";export*from"./components/bottom-navigation/index.js";export*from"./components/box/index.js";export*from"./components/breadcrumb/index.js";export*from"./components/button/index.js";export*from"./components/button-group/index.js";export*from"./components/card/index.js";export*from"./components/carousel/index.js";export*from"./components/chat-bubble/index.js";export*from"./components/checkbox/index.js";export*from"./components/chip/index.js";export*from"./components/code-block/index.js";export*from"./components/collapsible/index.js";export*from"./components/color-picker/index.js";export*from"./components/combobox/index.js";export*from"./components/container/index.js";export*from"./components/data-table/index.js";export*from"./components/date-picker/index.js";export*from"./components/date-range-picker/index.js";export*from"./components/date-time-picker/index.js";export*from"./components/dialog/index.js";export*from"./components/divider/index.js";export*from"./components/drawer/index.js";export*from"./components/empty/index.js";export*from"./components/file-picker/index.js";export*from"./components/grid/index.js";export*from"./components/floating-action-button/index.js";export*from"./components/floating-bottom-navigation/index.js";export*from"./components/footer/index.js";export*from"./components/grid-container/index.js";export*from"./components/header/index.js";export*from"./components/heatmap-chart/index.js";export*from"./components/highlight/index.js";export*from"./components/how-to-steps/index.js";export*from"./components/icon/index.js";export*from"./components/icon-button/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/mockup/index.js";export*from"./components/number-field/index.js";export*from"./components/otp-field/index.js";export*from"./components/overlay/index.js";export*from"./components/page-layout/index.js";export*from"./components/pagination/index.js";export*from"./components/panes/index.js";export*from"./components/pie-chart/index.js";export*from"./components/pill/index.js";export*from"./components/popover/index.js";export*from"./components/progress-box/index.js";export*from"./components/progress-circular/index.js";export*from"./components/progress-linear/index.js";export*from"./components/radio-group/index.js";export*from"./components/rating/index.js";export*from"./components/scatter-chart/index.js";export*from"./components/scroll-zone/index.js";export*from"./components/segmented-button/index.js";export*from"./components/select/index.js";export*from"./components/shortcut/index.js";export*from"./components/sidebar/index.js";export*from"./components/skeleton/index.js";export*from"./components/slider/index.js";export*from"./components/sparkline/index.js";export*from"./components/spoiler/index.js";export*from"./components/statistic/index.js";export*from"./components/switch/index.js";export*from"./components/table/index.js";export*from"./components/tabs/index.js";export*from"./components/text-field/index.js";export*from"./components/text-link/index.js";export*from"./components/time-picker/index.js";export*from"./components/timeline/index.js";export*from"./components/timeline-chart/index.js";export*from"./components/toast/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tree-view/index.js";export*from"./components/typography/index.js";export*from"./components/window-pane/index.js";
|
|
1
|
+
export*from"./types.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/anchor/index.js";export*from"./components/animate-appear/index.js";export*from"./components/app-logo/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/area-chart/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/avatar-group/index.js";export*from"./components/badge/index.js";export*from"./components/bar-chart/index.js";export*from"./components/blockquote/index.js";export*from"./components/bottom-navigation/index.js";export*from"./components/box/index.js";export*from"./components/breadcrumb/index.js";export*from"./components/button/index.js";export*from"./components/button-group/index.js";export*from"./components/card/index.js";export*from"./components/carousel/index.js";export*from"./components/chat-bubble/index.js";export*from"./components/checkbox/index.js";export*from"./components/chip/index.js";export*from"./components/code-block/index.js";export*from"./components/collapsible/index.js";export*from"./components/color-picker/index.js";export*from"./components/combobox/index.js";export*from"./components/command-palette/index.js";export*from"./components/container/index.js";export*from"./components/data-list/index.js";export*from"./components/data-table/index.js";export*from"./components/date-picker/index.js";export*from"./components/date-range-picker/index.js";export*from"./components/date-time-picker/index.js";export*from"./components/dialog/index.js";export*from"./components/divider/index.js";export*from"./components/drawer/index.js";export*from"./components/empty/index.js";export*from"./components/fieldset/index.js";export*from"./components/file-picker/index.js";export*from"./components/form/index.js";export*from"./components/gauge-chart/index.js";export*from"./components/grid/index.js";export*from"./components/floating-action-button/index.js";export*from"./components/floating-bottom-navigation/index.js";export*from"./components/footer/index.js";export*from"./components/grid-container/index.js";export*from"./components/header/index.js";export*from"./components/heatmap-chart/index.js";export*from"./components/highlight/index.js";export*from"./components/hover-card/index.js";export*from"./components/how-to-steps/index.js";export*from"./components/icon/index.js";export*from"./components/icon-button/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/menubar/index.js";export*from"./components/meter/index.js";export*from"./components/mockup/index.js";export*from"./components/navigation-menu/index.js";export*from"./components/number-field/index.js";export*from"./components/otp-field/index.js";export*from"./components/overlay/index.js";export*from"./components/page-layout/index.js";export*from"./components/pagination/index.js";export*from"./components/panes/index.js";export*from"./components/pie-chart/index.js";export*from"./components/pill/index.js";export*from"./components/popover/index.js";export*from"./components/progress-box/index.js";export*from"./components/progress-circular/index.js";export*from"./components/progress-linear/index.js";export*from"./components/radio-group/index.js";export*from"./components/rating/index.js";export*from"./components/scatter-chart/index.js";export*from"./components/scroll-area/index.js";export*from"./components/scroll-zone/index.js";export*from"./components/segmented-button/index.js";export*from"./components/select/index.js";export*from"./components/shortcut/index.js";export*from"./components/sidebar/index.js";export*from"./components/skeleton/index.js";export*from"./components/slider/index.js";export*from"./components/sparkline/index.js";export*from"./components/spoiler/index.js";export*from"./components/statistic/index.js";export*from"./components/switch/index.js";export*from"./components/table/index.js";export*from"./components/tabs/index.js";export*from"./components/text-field/index.js";export*from"./components/text-link/index.js";export*from"./components/time-picker/index.js";export*from"./components/timeline/index.js";export*from"./components/timeline-chart/index.js";export*from"./components/toast/index.js";export*from"./components/toggle/index.js";export*from"./components/toggle-group/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tour/index.js";export*from"./components/transfer/index.js";export*from"./components/tree-view/index.js";export*from"./components/typography/index.js";export*from"./components/window-pane/index.js";
|
|
@@ -99,7 +99,13 @@ export declare function transitionProps(transition: NebaTransition | undefined):
|
|
|
99
99
|
className: string;
|
|
100
100
|
style: React.CSSProperties;
|
|
101
101
|
};
|
|
102
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Whether the reader has asked for less motion — the hook the three effects
|
|
104
|
+
* with motion written in JavaScript read. It lives in `media.ts` beside the
|
|
105
|
+
* query it asks, so a Carousel and a ScrollZone can ask the same question
|
|
106
|
+
* without pulling the eleven effects below in with the answer.
|
|
107
|
+
*/
|
|
108
|
+
export { usePrefersReducedMotion } from './media.js';
|
|
103
109
|
export interface AnimationRunOptions {
|
|
104
110
|
trigger: NebaAnimateTrigger;
|
|
105
111
|
play?: boolean;
|
package/dist/internal/animate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";export const animationClasses={fade:"neba-anim-fade",grow:"neba-anim-scale",slide:"neba-anim-slide",zoom:"neba-anim-scale",rotate:"neba-anim-rotate",blink:"neba-anim-blink"};export const animBaseClass="neba-anim";export const defaultDurations={fade:320,grow:340,slide:380,zoom:340,rotate:460,blink:900};export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function isInfinite(e){return"infinite"===e}export function animationSlots(e){const n={"--n-anim-duration":`${e.duration}ms`,"--n-anim-delay":`${e.delay}ms`,"--n-anim-repeat":(i=e.repeat,"infinite"===i?"infinite":String(i)),"--n-anim-direction":(t=e.mode??"in",a=e.alternate,"out"===t?a?"alternate-reverse":"reverse":a?"alternate":"normal")};var t,a,i;return e.easing&&(n["--n-anim-ease"]=e.easing),void 0!==e.opacity&&(n["--n-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(n["--n-anim-scale"]=String(e.scale)),void 0!==e.x&&(n["--n-anim-x"]=e.x),void 0!==e.y&&(n["--n-anim-y"]=e.y),void 0!==e.angle&&(n["--n-anim-angle"]=e.angle),void 0!==e.angleTo&&(n["--n-anim-angle-to"]=e.angleTo),n}export function slideOffsets(e,n){const t=lengthValue(n),a="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:a};case"bottom":return{x:"0px",y:t};case"left":return{x:a,y:"0px"};default:return{x:t,y:"0px"}}}export function transitionProps(e){if(!e)return{className:"",style:{}};const n="string"==typeof e?{type:e}:e,{type:t}=n,a={duration:n.duration??defaultDurations[t],delay:n.delay??0,easing:n.easing,repeat:n.repeat??("blink"===t?"infinite":1),alternate:n.alternate};if("grow"!==t&&"zoom"!==t||(a.scale=n.scale??("zoom"===t?.4:.8)),"slide"===t){const{x:e,y:t}=slideOffsets(n.from??"bottom",n.distance??"100%");a.x=e,a.y=t}return"rotate"===t&&(a.angle=`${n.angle??-180}deg`),{className:`neba-anim ${animationClasses[t]}`,style:animationSlots(a)}}
|
|
1
|
+
"use client";import*as e from"react";import{observeVisibility as n}from"./observe.js";export const animationClasses={fade:"neba-anim-fade",grow:"neba-anim-scale",slide:"neba-anim-slide",zoom:"neba-anim-scale",rotate:"neba-anim-rotate",blink:"neba-anim-blink"};export const animBaseClass="neba-anim";export const defaultDurations={fade:320,grow:340,slide:380,zoom:340,rotate:460,blink:900};export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function isInfinite(e){return"infinite"===e}export function animationSlots(e){const n={"--n-anim-duration":`${e.duration}ms`,"--n-anim-delay":`${e.delay}ms`,"--n-anim-repeat":(i=e.repeat,"infinite"===i?"infinite":String(i)),"--n-anim-direction":(t=e.mode??"in",a=e.alternate,"out"===t?a?"alternate-reverse":"reverse":a?"alternate":"normal")};var t,a,i;return e.easing&&(n["--n-anim-ease"]=e.easing),void 0!==e.opacity&&(n["--n-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(n["--n-anim-scale"]=String(e.scale)),void 0!==e.x&&(n["--n-anim-x"]=e.x),void 0!==e.y&&(n["--n-anim-y"]=e.y),void 0!==e.angle&&(n["--n-anim-angle"]=e.angle),void 0!==e.angleTo&&(n["--n-anim-angle-to"]=e.angleTo),n}export function slideOffsets(e,n){const t=lengthValue(n),a="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:a};case"bottom":return{x:"0px",y:t};case"left":return{x:a,y:"0px"};default:return{x:t,y:"0px"}}}export function transitionProps(e){if(!e)return{className:"",style:{}};const n="string"==typeof e?{type:e}:e,{type:t}=n,a={duration:n.duration??defaultDurations[t],delay:n.delay??0,easing:n.easing,repeat:n.repeat??("blink"===t?"infinite":1),alternate:n.alternate};if("grow"!==t&&"zoom"!==t||(a.scale=n.scale??("zoom"===t?.4:.8)),"slide"===t){const{x:e,y:t}=slideOffsets(n.from??"bottom",n.distance??"100%");a.x=e,a.y=t}return"rotate"===t&&(a.angle=`${n.angle??-180}deg`),{className:`neba-anim ${animationClasses[t]}`,style:animationSlots(a)}}export{usePrefersReducedMotion}from"./media.js";export function useAnimationRun({trigger:t,play:a,once:i,threshold:o,paused:r,infinite:s}){const l=e.useRef(null),[u,m]=e.useState("mount"===t),[c,f]=e.useState(0),d=e.useCallback(()=>{m(!0),f(e=>e+1)},[]);e.useLayoutEffect(()=>{const e=l.current;if(!e||0===c)return;const n=[e,...e.querySelectorAll(".neba-anim, .neba-marquee-track")];for(const e of n)e.style.animationName="none";e.offsetWidth;for(const e of n)e.style.animationName=""},[c]),e.useEffect(()=>{if("visible"!==t)return;const e=l.current;if(!e)return;let a=null;if(a=n(e,o,e=>{e?(d(),i&&(a?.(),a=null)):i||m(!1)}),a)return()=>a?.();m(!0)},[t,i,o,d]),e.useEffect(()=>{"manual"===t&&(a?d():m(!1))},[t,a,d]);const p="hover"===t?{onPointerEnter:d,onFocus:d,onPointerLeave:()=>{s&&m(!1)},onBlur:()=>{s&&m(!1)}}:{};return{ref:e.useCallback(e=>{l.current=e},[]),state:u&&!r?"running":"paused",started:u,handlers:p}}export function useAnimateElement(e){const{effect:n,trigger:t,play:a,once:i,threshold:o,paused:r,infinite:s,...l}=e,u=useAnimationRun({trigger:t,play:a,once:i,threshold:o,paused:r,infinite:s});return{ref:u.ref,className:n?`neba-anim ${animationClasses[n]}`:"",style:{...animationSlots(l),"--n-anim-state":u.state},props:{...u.handlers,"data-neba-animation":n??void 0,"data-state":u.state}}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AvatarShape } from '../components/avatar/Avatar.js';
|
|
3
|
+
import type { NebaColor, NebaElevation, NebaSize, NebaVariant } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* What an Avatar inherits from the AvatarGroup around it.
|
|
6
|
+
*
|
|
7
|
+
* `button-group.ts`'s arrangement, one component over and for the same reason:
|
|
8
|
+
* a stack of avatars where the fourth one is a size out is not a stack, and
|
|
9
|
+
* `React.Children.map` with `cloneElement` stops working the moment a caller
|
|
10
|
+
* wraps one of them in a Tooltip or produces them from a `.map()`.
|
|
11
|
+
*
|
|
12
|
+
* It lives here rather than in the avatar-group folder so that Avatar can read
|
|
13
|
+
* it without the two components importing each other.
|
|
14
|
+
*/
|
|
15
|
+
export interface AvatarGroupContextValue {
|
|
16
|
+
size?: NebaSize;
|
|
17
|
+
shape?: AvatarShape;
|
|
18
|
+
variant?: NebaVariant;
|
|
19
|
+
color?: NebaColor;
|
|
20
|
+
elevation?: NebaElevation;
|
|
21
|
+
}
|
|
22
|
+
export declare const AvatarGroupContext: React.Context<AvatarGroupContextValue | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as t from"react";export const AvatarGroupContext=/*@__PURE__*/t.createContext(null);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { NebaColor, NebaDensity, NebaElevation, NebaSize, NebaVariant } from '../types.js';
|
|
3
3
|
/**
|
|
4
|
-
* What a Button inherits from the ButtonGroup around it
|
|
4
|
+
* What a Button inherits from the ButtonGroup around it — and what a Toggle
|
|
5
|
+
* inherits from the ToggleGroup around it, which is the same six values and so
|
|
6
|
+
* is the same context rather than a second one spelled identically.
|
|
5
7
|
*
|
|
6
8
|
* The alternative — `React.Children.map` with `cloneElement` — breaks the moment
|
|
7
9
|
* a caller wraps one of the buttons in a Tooltip, a `<Fragment>` or a `.map()`,
|
|
@@ -12,7 +14,9 @@ import type { NebaColor, NebaDensity, NebaElevation, NebaSize, NebaVariant } fro
|
|
|
12
14
|
* `<ButtonGroup>` with no props changes nothing except the corners.
|
|
13
15
|
*
|
|
14
16
|
* It lives in `internal/` rather than in the button-group folder so that Button
|
|
15
|
-
* can read it without the two components importing each other
|
|
17
|
+
* can read it without the two components importing each other — and by now four
|
|
18
|
+
* components read it, which is the arrangement `menu.ts` makes for the same
|
|
19
|
+
* reason.
|
|
16
20
|
*/
|
|
17
21
|
export interface ButtonGroupContextValue {
|
|
18
22
|
variant?: NebaVariant;
|
|
@@ -202,6 +202,23 @@ interface TooltipProps {
|
|
|
202
202
|
* and then flickers.
|
|
203
203
|
*/
|
|
204
204
|
declare function ChartTooltipPanel({ heading, items, x, y, flip, size }: TooltipProps): React.JSX.Element;
|
|
205
|
+
/**
|
|
206
|
+
* The same reading, said out loud rather than drawn.
|
|
207
|
+
*
|
|
208
|
+
* It cannot be the panel above, and that is not a preference. The panel is
|
|
209
|
+
* drawn inside the element carrying `role="img"`, and `img` is a leaf role:
|
|
210
|
+
* everything under it is cut out of the accessibility tree, so a live region
|
|
211
|
+
* in there announces to nobody. This is a *sibling* of the picture, clipped
|
|
212
|
+
* instead of painted, and it is what makes the arrow keys mean something to a
|
|
213
|
+
* reader who is not looking at the plot.
|
|
214
|
+
*
|
|
215
|
+
* Empty when nothing is active, so leaving the chart clears what was said
|
|
216
|
+
* rather than leaving the last column standing in the region forever.
|
|
217
|
+
*/
|
|
218
|
+
declare function ChartStatus({ heading, items }: {
|
|
219
|
+
heading?: React.ReactNode;
|
|
220
|
+
items: readonly ChartTooltipItem[];
|
|
221
|
+
}): React.JSX.Element;
|
|
205
222
|
interface DataTableProps {
|
|
206
223
|
id: string;
|
|
207
224
|
caption?: string;
|
|
@@ -405,5 +422,5 @@ interface CartesianProps extends CartesianChartProps {
|
|
|
405
422
|
* component never has to know which way round the axes are.
|
|
406
423
|
*/
|
|
407
424
|
export declare function CartesianChart({ series, categories, xAxis, yAxis, horizontal, stacked, includeZero, bandRatio, inset, headroom, markInset, xScale, marks, markRadius, table, swatch, scale: givenScale, markTooltip, height, format, locale, label, legend, tooltip, empty, size, variant, padded, className, children, ...box }: CartesianProps): React.JSX.Element;
|
|
408
|
-
export { ChartDataTable, ChartLegendBar, ChartScaleLegend, ChartSurface, ChartTooltipPanel, useMeasuredWidth, useVisibility };
|
|
425
|
+
export { ChartDataTable, ChartLegendBar, ChartScaleLegend, ChartStatus, ChartSurface, ChartTooltipPanel, useMeasuredWidth, useVisibility };
|
|
409
426
|
export type { Visibility };
|