neba 1.11.0 → 1.12.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 +4 -4
- package/dist/components/animate-appear/AnimateAppear.d.ts +2 -13
- package/dist/components/animate-appear/AnimateAppear.js +1 -1
- package/dist/components/animate-blink/AnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/AnimateBlink.js +1 -1
- package/dist/components/animate-counter/AnimateCounter.d.ts +45 -0
- package/dist/components/animate-counter/AnimateCounter.js +1 -0
- package/dist/components/animate-counter/index.d.ts +1 -0
- package/dist/components/animate-counter/index.js +1 -0
- package/dist/components/animate-fade/AnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/AnimateFade.js +1 -1
- package/dist/components/animate-float/AnimateFloat.d.ts +35 -0
- package/dist/components/animate-float/AnimateFloat.js +1 -0
- package/dist/components/animate-float/index.d.ts +1 -0
- package/dist/components/animate-float/index.js +1 -0
- package/dist/components/animate-grow/AnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/AnimateGrow.js +1 -1
- package/dist/components/animate-reveal/AnimateReveal.d.ts +41 -0
- package/dist/components/animate-reveal/AnimateReveal.js +1 -0
- package/dist/components/animate-reveal/index.d.ts +1 -0
- package/dist/components/animate-reveal/index.js +1 -0
- package/dist/components/animate-rotate/AnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/AnimateRotate.js +1 -1
- package/dist/components/animate-scramble/AnimateScramble.d.ts +48 -0
- package/dist/components/animate-scramble/AnimateScramble.js +1 -0
- package/dist/components/animate-scramble/index.d.ts +1 -0
- package/dist/components/animate-scramble/index.js +1 -0
- package/dist/components/animate-shake/AnimateShake.d.ts +39 -0
- package/dist/components/animate-shake/AnimateShake.js +1 -0
- package/dist/components/animate-shake/index.d.ts +1 -0
- package/dist/components/animate-shake/index.js +1 -0
- package/dist/components/animate-slide/AnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/AnimateSlide.js +1 -1
- package/dist/components/animate-split/AnimateSplit.d.ts +61 -0
- package/dist/components/animate-split/AnimateSplit.js +1 -0
- package/dist/components/animate-split/index.d.ts +1 -0
- package/dist/components/animate-split/index.js +1 -0
- package/dist/components/animate-typing/AnimateTyping.js +1 -1
- package/dist/components/animate-zoom/AnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/AnimateZoom.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/container/Container.d.ts +12 -4
- package/dist/components/container/Container.js +1 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/flex/Flex.d.ts +93 -0
- package/dist/components/flex/Flex.js +1 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
- package/dist/components/footer/Footer.d.ts +4 -3
- package/dist/components/footer/Footer.js +1 -1
- package/dist/components/gallery/Gallery.d.ts +150 -0
- package/dist/components/gallery/Gallery.js +1 -0
- package/dist/components/gallery/GalleryViewer.d.ts +30 -0
- package/dist/components/gallery/GalleryViewer.js +1 -0
- package/dist/components/gallery/index.d.ts +2 -0
- package/dist/components/gallery/index.js +1 -0
- package/dist/components/gauge-chart/GaugeChart.js +1 -1
- package/dist/components/grid/Grid.js +1 -1
- package/dist/components/grid-container/GridContainer.js +1 -1
- package/dist/components/header/Header.d.ts +5 -4
- package/dist/components/header/Header.js +1 -1
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/hover-card/HoverCard.js +1 -1
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/image/Image.d.ts +123 -3
- package/dist/components/image/Image.js +1 -1
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.js +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/popover/Popover.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-zone/ScrollZone.d.ts +9 -4
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/show/Show.d.ts +60 -0
- package/dist/components/show/Show.js +1 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/stack/Stack.d.ts +126 -0
- package/dist/components/stack/Stack.js +1 -0
- package/dist/components/stack/index.d.ts +1 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/statistic/Statistic.d.ts +8 -3
- package/dist/components/tabs/Tabs.d.ts +28 -0
- package/dist/components/tabs/Tabs.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.js +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useMediaQuery.d.ts +35 -1
- package/dist/hooks/useMediaQuery.js +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +65 -2
- package/dist/internal/animate.js +1 -1
- package/dist/internal/chart-frame.d.ts +32 -0
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/chart.d.ts +16 -0
- package/dist/internal/chart.js +1 -1
- package/dist/internal/grid.d.ts +13 -27
- package/dist/internal/grid.js +1 -1
- package/dist/internal/i18n.d.ts +20 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/media.d.ts +9 -2
- package/dist/internal/media.js +1 -1
- package/dist/internal/page-layout.d.ts +11 -9
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/picker.js +1 -1
- package/dist/internal/responsive.d.ts +97 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/styles.d.ts +68 -0
- package/dist/internal/styles.js +1 -1
- package/dist/internal/text.d.ts +42 -0
- package/dist/internal/text.js +1 -0
- 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 +280 -24
- package/dist/types.d.ts +119 -6
- package/package.json +18 -17
- package/dist/components/avatar-group/AvatarGroup.d.ts +0 -47
- package/dist/components/avatar-group/AvatarGroup.js +0 -1
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/internal/avatar-group.d.ts +0 -22
- package/dist/internal/avatar-group.js +0 -1
package/README.md
CHANGED
|
@@ -180,17 +180,17 @@ Placement props are logical, not physical — `start`/`end` rather than `left`/`
|
|
|
180
180
|
|
|
181
181
|
**Surfaces** — Box, Card, Accordion, Collapsible, Tabs, Carousel, Toolbar, Pill, Spoiler, HowToSteps, ChatBubble, Drawer, Popover, Mockup, WindowPane, HoverCard
|
|
182
182
|
|
|
183
|
-
**Display** — Typography, TextLink, Blockquote, Highlight, Divider, Chip, Badge, Avatar,
|
|
183
|
+
**Display** — Typography, TextLink, Blockquote, Highlight, Divider, Chip, Badge, Avatar, AppLogo, Icon, Image, Gallery, Shortcut, List, DataList, Table, DataTable, CodeBlock, Timeline, Breadcrumb, Anchor, TreeView, VisuallyHidden
|
|
184
184
|
|
|
185
185
|
**Charts** — Statistic, Sparkline, LineChart, AreaChart, BarChart, PieChart, ScatterChart, TimelineChart, HeatmapChart, GaugeChart
|
|
186
186
|
|
|
187
187
|
**Feedback** — Alert, Dialog, Confirm, Popconfirm, Toast, Tooltip, Overlay, Skeleton, Empty, ProgressLinear, ProgressCircular, ProgressBox, Meter, Tour
|
|
188
188
|
|
|
189
|
-
**Layout** — PageLayout (with Header, Footer and Sidebar), Container, Grid (with GridContainer), Panes, AspectRatio, Portal, ScrollZone, ScrollArea
|
|
189
|
+
**Layout** — PageLayout (with Header, Footer and Sidebar), Container, Grid (with GridContainer), Flex, Panes, Stack, Show, AspectRatio, Portal, ScrollZone, ScrollArea
|
|
190
190
|
|
|
191
|
-
**Transitions** — AnimateFade, AnimateGrow, AnimateZoom, AnimateSlide, AnimateRotate, AnimateBlink, AnimateAppear, AnimateTyping, AnimateLighting, AnimateMarquee, AnimateHeadline
|
|
191
|
+
**Transitions** — AnimateFade, AnimateGrow, AnimateZoom, AnimateSlide, AnimateRotate, AnimateBlink, AnimateReveal, AnimateFloat, AnimateShake, AnimateAppear, AnimateSplit, AnimateTyping, AnimateScramble, AnimateCounter, AnimateLighting, AnimateMarquee, AnimateHeadline
|
|
192
192
|
|
|
193
|
-
**Recently added** — TreeSelect, Calendar, Image, Confirm, Popconfirm, VisuallyHidden, Portal, GaugeChart, CommandPalette, Tour, Transfer, Anchor, DataList,
|
|
193
|
+
**Recently added** — Gallery, Flex, Show, the six new `Animate*` (Reveal, Float, Shake, Split, Counter, Scramble), Stack, TreeSelect, Calendar, Image, Confirm, Popconfirm, VisuallyHidden, Portal, GaugeChart, CommandPalette, Tour, Transfer, Anchor, DataList, NavigationMenu, Menubar, Form (with Fieldset), ScrollArea, HoverCard, Meter, Toggle (with ToggleGroup), CodeBlock, HowToSteps, ScrollZone, FloatingBottomNavigation, WindowPane, Collapsible, Rating, BottomNavigation, FloatingActionButton, the charts (Sparkline, LineChart, AreaChart, BarChart, PieChart, ScatterChart, TimelineChart, HeatmapChart), DataTable, Empty, Mockup, the `Animate*` wrappers, ColorPicker, Drawer, Popover, Skeleton, AspectRatio
|
|
194
194
|
|
|
195
195
|
Each one has its own page — live previews, every prop, and the variations worth seeing — under [**All components**](https://neba.cdget.com/components/).
|
|
196
196
|
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateProps, NebaSide } from '../../types.js';
|
|
4
|
-
export interface AnimateAppearProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
-
/**
|
|
6
|
-
* How long after one child the next one starts, in milliseconds. This is the
|
|
7
|
-
* whole effect — everything else is what a single child does.
|
|
8
|
-
* @default 80
|
|
9
|
-
*/
|
|
10
|
-
stagger?: number;
|
|
3
|
+
import type { NebaAnimateProps, NebaSide, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateAppearProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
11
5
|
/**
|
|
12
6
|
* Which edge each child drifts in from.
|
|
13
7
|
* @default 'bottom'
|
|
@@ -25,11 +19,6 @@ export interface AnimateAppearProps extends NebaAnimateProps, React.ComponentPro
|
|
|
25
19
|
* @default true
|
|
26
20
|
*/
|
|
27
21
|
fade?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Runs the list from the last child to the first.
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
reverse?: boolean;
|
|
33
22
|
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
34
23
|
render?: useRender.RenderProp;
|
|
35
24
|
/** The things that appear, one after another. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import
|
|
1
|
+
"use client";import*as e from"react";import{useRender as a}from"@base-ui/react/use-render";import{animBaseClass as t,animationClasses as r,isInfinite as n,slideOffsets as i,staggerChildren as s,useAnimationRun as o}from"../../internal/animate.js";export const AnimateAppear=/*@__PURE__*/e.forwardRef(function({duration:e=420,delay:d=0,easing:l,repeat:p=1,alternate:m,paused:c,trigger:g="mount",play:u,once:f=!0,threshold:y=.2,stagger:h=80,durationStep:b=0,reverse:x=!1,timeline:v,range:A,from:N="bottom",distance:S="0.75rem",fade:$=!0,render:j,className:w,style:R,children:k,...q},z){const B=o({trigger:g,play:u,once:f,threshold:y,paused:c,infinite:n(p)}),{x:C,y:D}=i(N,S),E=s(k,`${t} ${r.slide}`,{duration:e,delay:d,easing:l,repeat:p,alternate:m,x:C,y:D,opacity:$?0:1,timeline:v,range:A},{stagger:h,durationStep:b,reverse:x});return a({render:j,ref:[z,B.ref],props:{...q,className:w,style:{"--n-anim-state":B.state,...R},...B.handlers,"data-neba-animation":"appear","data-state":B.state,children:E}})});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateProps } from '../../types.js';
|
|
4
|
-
export interface AnimateBlinkProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateBlinkProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* How faint it gets at the bottom of the cycle, between `0` and `1`. Raise it
|
|
7
7
|
* for something that has to stay readable while it pulses.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as n}from"../../internal/animate.js";import{cx as a}from"../../internal/styles.js";export const AnimateBlink=/*@__PURE__*/e.forwardRef(function({duration:e=900,delay:i=0,easing:s,repeat:l="infinite",alternate:o,paused:d,trigger:p="mount",play:c,once:m=!0,threshold:f=.2,stagger:g=0,durationStep:u=0,reverse:y=!1,timeline:h,range:N,min:b=0,render:j,className:k,style:v,children:S,...w},x){const A=n({effect:"blink",duration:e,delay:i,easing:s,repeat:l,alternate:o,opacity:b,trigger:p,play:c,once:m,threshold:f,paused:d,infinite:t(l),timeline:h,range:N,children:S,stagger:g,durationStep:u,reverse:y});return r({render:j,ref:[x,A.ref],props:{...w,className:a(A.className,k),style:{...A.style,...v},...A.props,children:A.children}})});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAnimateProps } from '../../types.js';
|
|
4
|
+
export interface AnimateCounterProps extends Omit<NebaAnimateProps, 'easing' | 'repeat' | 'alternate'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
5
|
+
/** Where it lands. */
|
|
6
|
+
value: number;
|
|
7
|
+
/**
|
|
8
|
+
* Where it starts.
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
11
|
+
from?: number;
|
|
12
|
+
/**
|
|
13
|
+
* How long the count takes, in milliseconds.
|
|
14
|
+
* @default 1200
|
|
15
|
+
*/
|
|
16
|
+
duration?: number;
|
|
17
|
+
/**
|
|
18
|
+
* How the number is written — `Intl.NumberFormat` options, so a currency, a
|
|
19
|
+
* percentage or a compact `1.2M` is a prop rather than a `format` callback.
|
|
20
|
+
*/
|
|
21
|
+
format?: Intl.NumberFormatOptions;
|
|
22
|
+
/** Which language it is written in. Defaults to the reader's own. */
|
|
23
|
+
locale?: string;
|
|
24
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
25
|
+
render?: useRender.RenderProp;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A number counted up to its value.
|
|
29
|
+
*
|
|
30
|
+
* The one animation in the library whose subject is the content rather than the
|
|
31
|
+
* box around it, and the reason it is a component: a count is a value being
|
|
32
|
+
* interpolated and formatted on every frame, which is not something a
|
|
33
|
+
* `@keyframes` can do.
|
|
34
|
+
*
|
|
35
|
+
* It pairs with [Statistic](../charts/statistic) — a dashboard that draws its
|
|
36
|
+
* numbers instantly and animates everything around them has the emphasis
|
|
37
|
+
* exactly backwards.
|
|
38
|
+
*
|
|
39
|
+
* The finished number is in the document from the first frame, in a clipped box
|
|
40
|
+
* for a screen reader; what counts is a visible copy that is `aria-hidden`.
|
|
41
|
+
* A reader who cannot see the count is told the answer rather than a hundred
|
|
42
|
+
* intermediate ones, and a reader who has asked for less motion is shown the
|
|
43
|
+
* answer too.
|
|
44
|
+
*/
|
|
45
|
+
export declare const AnimateCounter: React.ForwardRefExoticComponent<AnimateCounterProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,Fragment as r,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{useRender as a}from"@base-ui/react/use-render";import{useAnimationRun as s,usePrefersReducedMotion as i}from"../../internal/animate.js";import{srOnlyClasses as o}from"../../internal/styles.js";export const AnimateCounter=/*@__PURE__*/n.forwardRef(function({value:m,from:l=0,duration:u=1200,delay:c=0,paused:d,trigger:f="mount",play:p,once:h=!0,threshold:y=.2,format:g,locale:F,render:j,className:v,style:A,...N},x){const b=s({trigger:f,play:p,once:h,threshold:y,paused:d,infinite:!1}),q=i(),[w,M]=n.useState(l),S=void 0===g?"":JSON.stringify(g),C=n.useMemo(()=>new Intl.NumberFormat(F,g),[F,S]);return n.useEffect(()=>{if(!b.started)return void M(l);if(q||u<=0)return void M(m);let e=0,r=null;const t=n=>{null===r&&(r=n);const a=n-r-c;if(a<0)return void(e=requestAnimationFrame(t));const s=Math.min(1,a/u);M(l+(m-l)*function(e){return 1-(1-e)**3}(s)),s<1&&(e=requestAnimationFrame(t))};return M(l),e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[b.started,q,m,l,u,c]),a({render:j,ref:[x,b.ref],props:{...N,className:v,style:A,"data-neba-animation":"counter","data-state":b.state,...b.handlers,children:t(r,{children:[e("span",{className:o,children:C.format(m)}),e("span",{"aria-hidden":"true",children:C.format(w)})]})}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnimateCounter.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./AnimateCounter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateMode, NebaAnimateProps } from '../../types.js';
|
|
4
|
-
export interface AnimateFadeProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateMode, NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateFadeProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content arrives or leaves.
|
|
7
7
|
* @default 'in'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateFade=/*@__PURE__*/e.forwardRef(function({duration:e=320,delay:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateFade=/*@__PURE__*/e.forwardRef(function({duration:e=320,delay:i=0,easing:s,repeat:o=1,alternate:l,paused:d,trigger:m="mount",play:p,once:c=!0,threshold:f=.2,stagger:g=0,durationStep:u=0,reverse:y=!1,timeline:h,range:N,mode:j="in",from:v=0,render:S,className:b,style:w,children:x,...A},F){const R=a({effect:"fade",duration:e,delay:i,easing:s,repeat:o,alternate:l,mode:j,opacity:v,trigger:m,play:p,once:c,threshold:f,paused:d,infinite:t(o),timeline:h,range:N,children:x,stagger:g,durationStep:u,reverse:y});return r({render:S,ref:[F,R.ref],props:{...A,className:n(R.className,b),style:{...R.style,...w},...R.props,children:R.children}})});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAnimateProps, NebaSide, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateFloatProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Which way it drifts.
|
|
7
|
+
* @default 'top'
|
|
8
|
+
*/
|
|
9
|
+
from?: NebaSide;
|
|
10
|
+
/**
|
|
11
|
+
* How far, at the top of the drift — a CSS length, or a number in pixels.
|
|
12
|
+
* Small on purpose: this is something resting rather than something moving,
|
|
13
|
+
* and past about a centimetre it stops reading as either.
|
|
14
|
+
* @default '0.5rem'
|
|
15
|
+
*/
|
|
16
|
+
distance?: number | string;
|
|
17
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
18
|
+
render?: useRender.RenderProp;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A slow drift with nowhere to get to.
|
|
23
|
+
*
|
|
24
|
+
* The only effect in the set that is neither an arrival nor a state: it says
|
|
25
|
+
* *this is not fixed to the page*, which is what an illustration, a floating
|
|
26
|
+
* card or a mark above a hero wants and what nothing else in the library says.
|
|
27
|
+
* It runs for as long as the page is open and turns round at both ends, so
|
|
28
|
+
* there is never a frame where it jumps back.
|
|
29
|
+
*
|
|
30
|
+
* It is `translate` rather than a `transform`, so it composes with anything the
|
|
31
|
+
* element is already scaled or rotated by — and it is deliberately not offered
|
|
32
|
+
* on a control: a button that is never quite where it was is a button that is
|
|
33
|
+
* harder to press.
|
|
34
|
+
*/
|
|
35
|
+
export declare const AnimateFloat: React.ForwardRefExoticComponent<AnimateFloatProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,slideOffsets as a,useAnimateElement as n}from"../../internal/animate.js";import{cx as i}from"../../internal/styles.js";export const AnimateFloat=/*@__PURE__*/e.forwardRef(function({duration:e=3200,delay:s=0,easing:l="ease-in-out",repeat:o="infinite",alternate:m=!0,paused:d,trigger:c="mount",play:f,once:p=!0,threshold:u=.2,stagger:g=0,durationStep:y=0,reverse:h=!1,timeline:x,range:N,from:b="top",distance:j="0.5rem",render:v,className:S,style:w,children:A,...C},F){const{x:R,y:k}=a(b,j),q=n({effect:null,effectClass:"neba-anim-float",name:"float",duration:e,delay:s,easing:l,repeat:o,alternate:m,x:R,y:k,trigger:c,play:f,once:p,threshold:u,paused:d,infinite:t(o),timeline:x,range:N,children:A,stagger:g,durationStep:y,reverse:h});return r({render:v,ref:[F,q.ref],props:{...C,className:i(q.className,S),style:{...q.style,...w},...q.props,children:q.children}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnimateFloat.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./AnimateFloat.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateMode, NebaAnimateProps } from '../../types.js';
|
|
4
|
-
export interface AnimateGrowProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateMode, NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateGrowProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content unfolds or folds away.
|
|
7
7
|
* @default 'in'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateGrow=/*@__PURE__*/e.forwardRef(function({duration:e=340,delay:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateGrow=/*@__PURE__*/e.forwardRef(function({duration:e=340,delay:i=0,easing:s,repeat:o=1,alternate:l,paused:d,trigger:m="mount",play:c,once:p=!0,threshold:f=.2,stagger:g=0,durationStep:u=0,reverse:y=!1,timeline:h,range:w,mode:N="in",from:j=.8,origin:v="center",fade:S=!0,render:b,className:x,style:A,children:G,...O},R){const k=a({effect:"grow",duration:e,delay:i,easing:s,repeat:o,alternate:l,mode:N,scale:j,opacity:S?0:1,trigger:m,play:c,once:p,threshold:f,paused:d,infinite:t(o),timeline:h,range:w,children:G,stagger:g,durationStep:u,reverse:y});return r({render:b,ref:[R,k.ref],props:{...O,className:n(k.className,x),style:{transformOrigin:v,...k.style,...A},...k.props,children:k.children}})});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAnimateMode, NebaAnimateProps, NebaSide, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateRevealProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the content is uncovered or covered again.
|
|
7
|
+
* @default 'in'
|
|
8
|
+
*/
|
|
9
|
+
mode?: NebaAnimateMode;
|
|
10
|
+
/**
|
|
11
|
+
* The edge the wipe travels **from**. `left` uncovers left to right.
|
|
12
|
+
* @default 'left'
|
|
13
|
+
*/
|
|
14
|
+
side?: NebaSide;
|
|
15
|
+
/**
|
|
16
|
+
* Fades as it wipes, from this opacity. `1` — the default — is a wipe and
|
|
17
|
+
* nothing else, which is the point of reaching for one.
|
|
18
|
+
* @default 1
|
|
19
|
+
*/
|
|
20
|
+
from?: number;
|
|
21
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
22
|
+
render?: useRender.RenderProp;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Content uncovered by an edge travelling across it.
|
|
27
|
+
*
|
|
28
|
+
* The one entrance in the set where the content never moves and never changes
|
|
29
|
+
* colour: it is already in place, at full size and full strength, and what
|
|
30
|
+
* changes is how much of it has been let through. That makes it the effect to
|
|
31
|
+
* reach for on a heading, a rule, a chart's own plot area — anything whose
|
|
32
|
+
* position is the information.
|
|
33
|
+
*
|
|
34
|
+
* It is `clip-path`, so there is no wrapper and no `overflow` box: the element
|
|
35
|
+
* takes exactly the room it always took, and everything around it is laid out
|
|
36
|
+
* against the finished size from the first frame.
|
|
37
|
+
*
|
|
38
|
+
* `mode="out"` runs the same edge backwards and holds it there, which covers
|
|
39
|
+
* the content up.
|
|
40
|
+
*/
|
|
41
|
+
export declare const AnimateReveal: React.ForwardRefExoticComponent<AnimateRevealProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,revealClip as a,useAnimateElement as n}from"../../internal/animate.js";import{cx as i}from"../../internal/styles.js";export const AnimateReveal=/*@__PURE__*/e.forwardRef(function({duration:e=620,delay:s=0,easing:l,repeat:o=1,alternate:d,paused:m,trigger:p="mount",play:c,once:f=!0,threshold:g=.2,stagger:u=0,durationStep:y=0,reverse:h=!1,timeline:v,range:N,mode:j="in",side:R="left",from:S=1,render:b,className:w,style:x,children:A,...k},q){const z=n({effect:"reveal",duration:e,delay:s,easing:l,repeat:o,alternate:d,mode:j,opacity:S,clip:a(R),trigger:p,play:c,once:f,threshold:g,paused:m,infinite:t(o),timeline:v,range:N,children:A,stagger:u,durationStep:y,reverse:h});return r({render:b,ref:[q,z.ref],props:{...k,className:i(z.className,w),style:{...z.style,...x},...z.props,children:z.children}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnimateReveal.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./AnimateReveal.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateMode, NebaAnimateProps } from '../../types.js';
|
|
4
|
-
export interface AnimateRotateProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateMode, NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateRotateProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/** Whether the content turns into place or out of it. @default 'in' */
|
|
6
6
|
mode?: NebaAnimateMode;
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateRotate=/*@__PURE__*/e.forwardRef(function({duration:e=460,delay:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateRotate=/*@__PURE__*/e.forwardRef(function({duration:e=460,delay:i=0,easing:o,repeat:s=1,alternate:l,paused:d,trigger:m="mount",play:c,once:g=!0,threshold:p=.2,stagger:f=0,durationStep:u=0,reverse:y=!1,timeline:h,range:N,mode:j="in",from:v=-180,to:R=0,origin:S="center",fade:$=!0,render:b,className:w,style:x,children:A,...O},T){const k=a({effect:"rotate",duration:e,delay:i,easing:o,repeat:s,alternate:l,mode:j,angle:`${v}deg`,angleTo:`${R}deg`,opacity:$?0:1,trigger:m,play:c,once:g,threshold:p,paused:d,infinite:t(s),timeline:h,range:N,children:A,stagger:f,durationStep:u,reverse:y});return r({render:b,ref:[T,k.ref],props:{...O,className:n(k.className,w),style:{transformOrigin:S,...k.style,...x},...k.props,children:k.children}})});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAnimateProps } from '../../types.js';
|
|
4
|
+
export interface AnimateScrambleProps extends Omit<NebaAnimateProps, 'easing' | 'alternate'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
5
|
+
/** The text, when it is easier to pass than to nest. Overrides `children`. */
|
|
6
|
+
text?: string;
|
|
7
|
+
/**
|
|
8
|
+
* How fast the text settles, in characters per second.
|
|
9
|
+
* @default 18
|
|
10
|
+
*/
|
|
11
|
+
speed?: number;
|
|
12
|
+
/**
|
|
13
|
+
* How often an unsettled character is redrawn, in milliseconds. Lower is
|
|
14
|
+
* busier; below about 30 it stops reading as characters at all.
|
|
15
|
+
* @default 45
|
|
16
|
+
*/
|
|
17
|
+
tick?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The pool an unsettled character is drawn from. Deliberately narrow — a pool
|
|
20
|
+
* with tall and short glyphs in it makes the line jump as it settles.
|
|
21
|
+
*/
|
|
22
|
+
characters?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Which language the text is in, for finding the character boundaries.
|
|
25
|
+
*/
|
|
26
|
+
locale?: string;
|
|
27
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
28
|
+
render?: useRender.RenderProp;
|
|
29
|
+
/** The text to settle. Only text is settled. */
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Text arriving through noise, one character at a time.
|
|
34
|
+
*
|
|
35
|
+
* `AnimateTyping`'s sibling: a typewriter reveals a string from an empty line,
|
|
36
|
+
* this one resolves it out of a line that was already the right length. That is
|
|
37
|
+
* the whole reason to choose it — the box never changes size, so nothing around
|
|
38
|
+
* it reflows and a heading does not push the page down as it lands.
|
|
39
|
+
*
|
|
40
|
+
* Whitespace is never scrambled. A space that flickers into a letter and back
|
|
41
|
+
* reads as the words having moved, which is the one thing this effect is for
|
|
42
|
+
* avoiding.
|
|
43
|
+
*
|
|
44
|
+
* The finished string is in the document from the first frame, in a clipped box
|
|
45
|
+
* for a screen reader; the noise is a visible copy that is `aria-hidden`. A
|
|
46
|
+
* reader who has asked for less motion is shown the text.
|
|
47
|
+
*/
|
|
48
|
+
export declare const AnimateScramble: React.ForwardRefExoticComponent<AnimateScrambleProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{useRender as s}from"@base-ui/react/use-render";import{isInfinite as n,useAnimationRun as i,usePrefersReducedMotion as o}from"../../internal/animate.js";import{graphemesOf as l,textOf as c}from"../../internal/text.js";import{srOnlyClasses as m}from"../../internal/styles.js";const d="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&$@*";export const AnimateScramble=/*@__PURE__*/a.forwardRef(function({text:u,speed:p=18,tick:h=45,characters:f=d,duration:g,delay:x=0,repeat:j=1,paused:M,trigger:y="mount",play:v,once:N=!0,threshold:b=.2,locale:I,render:T,className:w,style:R,children:S,...A},E){const F=i({trigger:y,play:v,once:N,threshold:b,paused:M,infinite:n(j)}),k=o(),B=u??c(S),C=a.useMemo(()=>l(B,I),[B,I]),D=C.length,[G,H]=a.useState(0),[,J]=a.useReducer(e=>e+1,0),K=a.useMemo(()=>void 0!==g&&D>0?Math.max(1,g/D):1e3/Math.max(1,p),[g,p,D]);a.useEffect(()=>{if(!F.started||M)return;if(k||0===D)return void H(D);let e,t=0;const r=()=>{t+=1,H(t),t<D?e=setTimeout(r,K):clearInterval(a)};H(0);const a=setInterval(J,h);return e=setTimeout(r,x+K),()=>{clearTimeout(e),clearInterval(a)}},[F.started,M,k,D,K,h,x]);const L=f.length>0?f:d,O=C.map((e,t)=>t<G||""===e.trim()?e:L[Math.floor(Math.random()*L.length)]).join("");return s({render:T,ref:[E,F.ref],props:{...A,className:w,style:R,"data-neba-animation":"scramble","data-state":F.state,...F.handlers,children:r(t,{children:[e("span",{className:m,children:B}),e("span",{"aria-hidden":"true",className:"whitespace-pre-wrap",children:O})]})}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnimateScramble.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./AnimateScramble.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateShakeProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* How far it travels at the widest point — a CSS length, or a number in
|
|
7
|
+
* pixels. Short: this is a head shaken, not a thing thrown.
|
|
8
|
+
* @default 6
|
|
9
|
+
*/
|
|
10
|
+
distance?: number | string;
|
|
11
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
12
|
+
render?: useRender.RenderProp;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The one effect in the set that says *no*.
|
|
17
|
+
*
|
|
18
|
+
* A password that was wrong, a form that would not send, a row that could not
|
|
19
|
+
* be dropped where it was let go. Every other animation here is about content
|
|
20
|
+
* arriving; this one is an **answer**, and it is the only reason to reach for
|
|
21
|
+
* it — a shake that runs on mount is decoration, and decoration that moves is
|
|
22
|
+
* what a reader learns to ignore.
|
|
23
|
+
*
|
|
24
|
+
* It is therefore almost always `trigger="manual"` with `play` bound to the
|
|
25
|
+
* thing that failed, and it starts and ends exactly where the element sits, so
|
|
26
|
+
* a run that is interrupted leaves nothing off its mark.
|
|
27
|
+
*
|
|
28
|
+
* ## Why this one is allowed to move
|
|
29
|
+
*
|
|
30
|
+
* The house rule is that a control is never transformed: scaling resamples the
|
|
31
|
+
* label, and text that shifts under the cursor is what reads as cheap. That
|
|
32
|
+
* rule is about a control's **resting states** — hover, press, on, off — where
|
|
33
|
+
* the movement is a side effect of saying something colour could say better.
|
|
34
|
+
* A shake is not a state. It is a one-off reply to something the reader just
|
|
35
|
+
* did, it is over in four hundred milliseconds, and there is no colour that
|
|
36
|
+
* says "that did not work" as unmistakably. It is an exception, it is the only
|
|
37
|
+
* one, and it should never be given `repeat`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const AnimateShake: React.ForwardRefExoticComponent<AnimateShakeProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as a,lengthValue as t,useAnimateElement as n}from"../../internal/animate.js";import{cx as s}from"../../internal/styles.js";export const AnimateShake=/*@__PURE__*/e.forwardRef(function({duration:e=420,delay:i=0,easing:l="ease-in-out",repeat:o=1,alternate:d,paused:c,trigger:m="manual",play:p,once:f=!0,threshold:u=.2,stagger:g=0,durationStep:h=0,reverse:y=!1,timeline:k,range:N,distance:S=6,render:b,className:j,style:v,children:x,...w},A){const C=n({effect:null,effectClass:"neba-anim-shake",name:"shake",duration:e,delay:i,easing:l,repeat:o,alternate:d,x:t(S),trigger:m,play:p,once:f,threshold:u,paused:c,infinite:a(o),timeline:k,range:N,children:x,stagger:g,durationStep:h,reverse:y});return r({render:b,ref:[A,C.ref],props:{...w,className:s(C.className,j),style:{...C.style,...v},...C.props,children:C.children}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnimateShake.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./AnimateShake.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateMode, NebaAnimateProps, NebaSide } from '../../types.js';
|
|
4
|
-
export interface AnimateSlideProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateMode, NebaAnimateProps, NebaSide, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateSlideProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content slides in or slides away. `out` leaves by the same edge
|
|
7
7
|
* it would have come from.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,slideOffsets as a,useAnimateElement as n}from"../../internal/animate.js";import{cx as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,slideOffsets as a,useAnimateElement as n}from"../../internal/animate.js";import{cx as i}from"../../internal/styles.js";export const AnimateSlide=/*@__PURE__*/e.forwardRef(function({duration:e=380,delay:s=0,easing:o,repeat:l=1,alternate:d,paused:m,trigger:c="mount",play:p,once:f=!0,threshold:g=.2,stagger:u=0,durationStep:y=0,reverse:h=!1,timeline:x,range:N,mode:S="in",from:b="bottom",distance:j="100%",fade:v=!0,render:w,className:A,style:R,children:k,...q},z){const{x:B,y:C}=a(b,j),D=n({effect:"slide",duration:e,delay:s,easing:o,repeat:l,alternate:d,mode:S,x:B,y:C,opacity:v?0:1,trigger:c,play:p,once:f,threshold:g,paused:m,infinite:t(l),timeline:x,range:N,children:k,stagger:u,durationStep:y,reverse:h});return r({render:w,ref:[z,D.ref],props:{...q,className:i(D.className,A),style:{...D.style,...R},...D.props,children:D.children}})});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { NebaAnimateProps, NebaAnimation, NebaSide, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
/** What a piece is. */
|
|
5
|
+
export type NebaSplitBy = 'word' | 'character';
|
|
6
|
+
export interface AnimateSplitProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
7
|
+
/** The text, when it is easier to pass than to nest. Overrides `children`. */
|
|
8
|
+
text?: string;
|
|
9
|
+
/**
|
|
10
|
+
* What one piece is. `word` is the default and the one to reach for: a
|
|
11
|
+
* heading of eight words is eight boxes, and the same heading by character is
|
|
12
|
+
* forty-six.
|
|
13
|
+
* @default 'word'
|
|
14
|
+
*/
|
|
15
|
+
by?: NebaSplitBy;
|
|
16
|
+
/**
|
|
17
|
+
* Which effect each piece arrives on — the library's own vocabulary, so a
|
|
18
|
+
* split heading's fade and an `AnimateFade` are the same fade.
|
|
19
|
+
* @default 'slide'
|
|
20
|
+
*/
|
|
21
|
+
effect?: NebaAnimation;
|
|
22
|
+
/** Which edge a `slide` piece comes from. @default 'bottom' */
|
|
23
|
+
from?: NebaSide;
|
|
24
|
+
/** How far a `slide` piece travels. @default '0.4em' */
|
|
25
|
+
distance?: number | string;
|
|
26
|
+
/** Where a `grow` or `zoom` piece starts, as a multiple of its final size. */
|
|
27
|
+
scale?: number;
|
|
28
|
+
/** How far a `rotate` piece turns from, in degrees. */
|
|
29
|
+
angle?: number;
|
|
30
|
+
/** Which edge a `reveal` piece is wiped from. */
|
|
31
|
+
side?: NebaSide;
|
|
32
|
+
/**
|
|
33
|
+
* Which language the text is in, for finding the word and character
|
|
34
|
+
* boundaries. A word boundary is not a space in Japanese, Thai or Chinese.
|
|
35
|
+
*/
|
|
36
|
+
locale?: string;
|
|
37
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
38
|
+
render?: useRender.RenderProp;
|
|
39
|
+
/** The text to split. Only text is split — an element contributes its words. */
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A line of text arriving a word — or a letter — at a time.
|
|
44
|
+
*
|
|
45
|
+
* `AnimateAppear` walked down a list a child at a time; this walks along a
|
|
46
|
+
* sentence. The difference is only where the pieces come from, which is why
|
|
47
|
+
* everything below the split is the same machinery: one `@keyframes` per piece,
|
|
48
|
+
* held back by its place in the line.
|
|
49
|
+
*
|
|
50
|
+
* The whole string is in the document from the first frame — in a clipped box
|
|
51
|
+
* for a screen reader, which reads it once and is not made to sit through the
|
|
52
|
+
* performance — and what animates is a visible copy that is `aria-hidden`. That
|
|
53
|
+
* is `AnimateTyping`'s arrangement and it is here for the same two reasons: the
|
|
54
|
+
* effect costs a reader who cannot see it nothing, and a find-in-page still
|
|
55
|
+
* finds the sentence rather than forty-six separate letters.
|
|
56
|
+
*
|
|
57
|
+
* Every piece is an `inline-block`, which is what lets it be moved at all — an
|
|
58
|
+
* inline box cannot be translated up. Each keeps the space that followed it, so
|
|
59
|
+
* a line still breaks between words and never inside the gap.
|
|
60
|
+
*/
|
|
61
|
+
export declare const AnimateSplit: React.ForwardRefExoticComponent<AnimateSplitProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,Fragment as a,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{useRender as n}from"@base-ui/react/use-render";import{animBaseClass as s,animationClasses as i,isInfinite as l,staggerChildren as o,transitionParts as d,useAnimationRun as m}from"../../internal/animate.js";import{graphemesOf as c,textOf as p,wordsOf as u}from"../../internal/text.js";import{cx as f,srOnlyClasses as g}from"../../internal/styles.js";export const AnimateSplit=/*@__PURE__*/r.forwardRef(function({text:h,by:y="word",effect:j="slide",duration:x=520,delay:b=0,easing:w,repeat:N=1,alternate:S,paused:v,trigger:$="mount",play:k,once:A=!0,threshold:F=.2,stagger:M=45,durationStep:R=0,reverse:q=!1,timeline:z,range:B,from:C="bottom",distance:D="0.4em",scale:E,angle:G,side:H,locale:I,render:J,className:K,style:L,children:O,...P},Q){const T=m({trigger:$,play:k,once:A,threshold:F,paused:v,infinite:l(N)}),U=h??p(O),V=r.useMemo(()=>"word"===y?u(U,I):c(U,I),[y,U,I]),W=d({type:j,duration:x,delay:b,easing:w,repeat:N,alternate:S,from:C,distance:D,scale:E,angle:G,side:H,timeline:z,range:B}),X=o(W?V.map((a,t)=>e("span",{className:"inline-block whitespace-pre",children:a},t)):null,`${s} ${i[j]}`,W?.slots??{duration:x,delay:b,repeat:N},{stagger:M,durationStep:R,reverse:q});return n({render:J,ref:[Q,T.ref],props:{...P,className:K,style:{"--n-anim-state":T.state,...L},...T.handlers,"data-neba-animation":"split","data-state":T.state,children:t(a,{children:[e("span",{className:f(g),children:U}),e("span",{"aria-hidden":"true",children:X})]})}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnimateSplit.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./AnimateSplit.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{isInfinite as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{isInfinite as a,useAnimationRun as n,usePrefersReducedMotion as i}from"../../internal/animate.js";import{cx as s,srOnlyClasses as o}from"../../internal/styles.js";import{graphemesOf as u,textOf as c}from"../../internal/text.js";export const AnimateTyping=/*@__PURE__*/r.forwardRef(function({text:l,speed:m=24,hold:f=1400,erase:d=!1,eraseSpeed:p,caret:h=!0,caretChar:y="|",duration:x,delay:g=0,repeat:T=1,paused:j,trigger:v="mount",play:N,once:M=!0,threshold:w=.2,className:b,style:E,children:R,...S},A){const C=n({trigger:v,play:N,once:M,threshold:w,paused:j,infinite:a(T)}),k=i(),q=l??c(R),z=r.useMemo(()=>u(q),[q]),B=z.length,[D,F]=r.useState(0),G=r.useRef(0),H=x&&B>0?x/B:1e3/Math.max(m,1),I=1e3/Math.max(p??2*m,1);return r.useEffect(()=>{G.current=0},[B]),r.useEffect(()=>{if(k||0===B)return void F(B);if(!C.started)return G.current=0,void F(0);if(j)return;let e,t=!1,r=G.current,a=1,n=!1;const i="infinite"===T?1/0:Math.max(1,T);if(r>=B&&1===i)return;const s=()=>{if(!t){if(n)return r-=1,G.current=r,F(r),r<=0&&(n=!1,a+=1),void(e=setTimeout(s,n?I:H));if(r+=1,G.current=r,F(r),r<B)e=setTimeout(s,H);else if(!(a>=i)){if(d)return n=!0,void(e=setTimeout(s,f));a+=1,e=setTimeout(()=>{t||(r=0,G.current=0,F(0),e=setTimeout(s,H))},f)}}};return F(r),e=setTimeout(s,0===r?g:H),()=>{t=!0,clearTimeout(e)}},[C.started,j,k,B,H,I,g,f,d,T]),t("div",{ref:e=>{C.ref(e),"function"==typeof A?A(e):A&&(A.current=e)},className:b,style:E,"data-neba-animation":"typing","data-state":C.state,...C.handlers,...S,children:[e("span",{className:o,children:q}),t("span",{"aria-hidden":"true",className:"whitespace-pre-wrap",children:[z.slice(0,D).join(""),h?e("span",{className:s("neba-typing-caret"),children:y}):null]})]})});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaAnimateMode, NebaAnimateProps } from '../../types.js';
|
|
4
|
-
export interface AnimateZoomProps extends NebaAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { NebaAnimateMode, NebaAnimateProps, NebaStaggerProps, NebaTimelineProps } from '../../types.js';
|
|
4
|
+
export interface AnimateZoomProps extends NebaAnimateProps, NebaStaggerProps, NebaTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content comes forward or falls away.
|
|
7
7
|
* @default 'in'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateZoom=/*@__PURE__*/e.forwardRef(function({duration:e=340,delay:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const AnimateZoom=/*@__PURE__*/e.forwardRef(function({duration:e=340,delay:i=0,easing:o,repeat:s=1,alternate:l,paused:m,trigger:d="mount",play:c,once:p=!0,threshold:f=.2,stagger:g=0,durationStep:u=0,reverse:y=!1,timeline:h,range:N,mode:j="in",from:v=.4,fade:S=!0,render:b,className:w,style:x,children:z,...A},O){const R=a({effect:"zoom",duration:e,delay:i,easing:o,repeat:s,alternate:l,mode:j,scale:v,opacity:S?0:1,trigger:d,play:c,once:p,threshold:f,paused:m,infinite:t(s),timeline:h,range:N,children:z,stagger:g,durationStep:u,reverse:y});return r({render:b,ref:[O,R.ref],props:{...A,className:n(R.className,w),style:{transformOrigin:"center",...R.style,...x},...R.props,children:R.children}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{Avatar as t}from"@base-ui/react/avatar";import{transitionProps as r}from"../../internal/animate.js";import{initialsOf as i}from"../../internal/initials.js";import{controlHeightClasses as s,controlSlots as o,controlSquareClasses as l,cx as d,hasContent as c,srOnlyClasses as m,surfaceClasses as f,transitionClasses as u}from"../../internal/styles.js";import{useStyleDefaults as v}from"../../internal/defaults.js";const x={xs:"text-[0.5625rem]",sm:"text-[0.6875rem]",md:"text-[0.8125rem]",lg:"text-[1rem]",xl:"text-[1.1875rem]"},h={xs:"rounded-[0.375rem]",sm:"rounded-[0.4375rem]",md:"rounded-[0.5625rem]",lg:"rounded-[0.6875rem]",xl:"rounded-[0.875rem]"},p={solid:[f,"text-(--n-on-solid) bg-(--n-fill)","[box-shadow:var(--n-elev)]"].join(" "),outline:[f,"border text-(--n-accent) bg-(--n-panel)","[border-color:var(--n-line)]","[box-shadow:var(--n-elev)]"].join(" "),text:"text-(--n-accent) bg-(--n-soft-press) [box-shadow:var(--n-elev)]"},b="after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit]",g={solid:`${b} after:[box-shadow:var(--neba-plate-solid)]`,outline:`${b} after:[box-shadow:var(--neba-plate-glass)]`,text:""},j=["relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden","align-middle font-semibold tracking-wide whitespace-nowrap leading-none","[&_svg]:pointer-events-none [&_svg]:size-[55%]",u].join(" ");function w(){return a("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[e("path",{d:"M12 12a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9Z"}),e("path",{d:"M12 14.25c-4.28 0-7.75 2.42-7.75 5.4 0 .75.6 1.35 1.35 1.35h12.8c.75 0 1.35-.6 1.35-1.35 0-2.98-3.47-5.4-7.75-5.4Z"})]})}export const Avatar=/*@__PURE__*/n.forwardRef(function(n,f){const{src:u,srcSet:b,alt:y,name:N,initials:z,shape:_,variant:S,size:k,color:C,elevation:A,delay:B,imageProps:L,onLoadingStatusChange:M,transition:R,className:Z,style:$,children:F,...I}=v(n,["size","variant"]),P=_??"circle",q=S??"text",D=k??"md",E=C??"primary",G=A??0,H=N?i(N):"",J=r(R),K=y??N,O=c(F)?F:(z??H)||e(w,{}),Q=c(F)||Boolean(z??H),T=d(j,s[D],l[D],x[D],"circle"===P?"rounded-full":h[D],p[q],g[q],J.className,Z??"");return a(t.Root,{ref:f,className:T,style:{...o(E,G,q),...J.style,...$},...I,children:[u?e(t.Image,{src:u,srcSet:b,alt:K??"",className:"size-full object-cover [animation:neba-anim-fade_var(--neba-duration-fill)_var(--neba-ease)_both]",decoding:"async",onLoadingStatusChange:M,...L}):null,a(t.Fallback,{delay:u?B:void 0,className:"flex size-full items-center justify-center",children:[K&&Q?e("span",{className:m,children:K}):null,e("span",{"aria-hidden":!(!K||!Q)||void 0,className:"contents",children:O})]})]})});
|