material-plus-ui 1.0.0 → 1.2.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/dist/components/animate-appear/MPAnimateAppear.d.ts +56 -0
- package/dist/components/animate-appear/MPAnimateAppear.js +1 -0
- package/dist/components/animate-appear/index.d.ts +2 -0
- package/dist/components/animate-appear/index.js +1 -0
- package/dist/components/animate-blink/MPAnimateBlink.d.ts +41 -0
- package/dist/components/animate-blink/MPAnimateBlink.js +1 -0
- package/dist/components/animate-blink/index.d.ts +2 -0
- package/dist/components/animate-blink/index.js +1 -0
- package/dist/components/animate-fade/MPAnimateFade.d.ts +38 -0
- package/dist/components/animate-fade/MPAnimateFade.js +1 -0
- package/dist/components/animate-fade/index.d.ts +2 -0
- package/dist/components/animate-fade/index.js +1 -0
- package/dist/components/animate-grow/MPAnimateGrow.d.ts +52 -0
- package/dist/components/animate-grow/MPAnimateGrow.js +1 -0
- package/dist/components/animate-grow/index.d.ts +2 -0
- package/dist/components/animate-grow/index.js +1 -0
- package/dist/components/animate-headline/MPAnimateHeadline.d.ts +63 -0
- package/dist/components/animate-headline/MPAnimateHeadline.js +1 -0
- package/dist/components/animate-headline/index.d.ts +2 -0
- package/dist/components/animate-headline/index.js +1 -0
- package/dist/components/animate-lighting/MPAnimateLighting.d.ts +68 -0
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -0
- package/dist/components/animate-lighting/index.d.ts +2 -0
- package/dist/components/animate-lighting/index.js +1 -0
- package/dist/components/animate-marquee/MPAnimateMarquee.d.ts +66 -0
- package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -0
- package/dist/components/animate-marquee/index.d.ts +2 -0
- package/dist/components/animate-marquee/index.js +1 -0
- package/dist/components/animate-rotate/MPAnimateRotate.d.ts +56 -0
- package/dist/components/animate-rotate/MPAnimateRotate.js +1 -0
- package/dist/components/animate-rotate/index.d.ts +2 -0
- package/dist/components/animate-rotate/index.js +1 -0
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +53 -0
- package/dist/components/animate-slide/MPAnimateSlide.js +1 -0
- package/dist/components/animate-slide/index.d.ts +2 -0
- package/dist/components/animate-slide/index.js +1 -0
- package/dist/components/animate-typing/MPAnimateTyping.d.ts +59 -0
- package/dist/components/animate-typing/MPAnimateTyping.js +1 -0
- package/dist/components/animate-typing/index.d.ts +2 -0
- package/dist/components/animate-typing/index.js +1 -0
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +44 -0
- package/dist/components/animate-zoom/MPAnimateZoom.js +1 -0
- package/dist/components/animate-zoom/index.d.ts +2 -0
- package/dist/components/animate-zoom/index.js +1 -0
- package/dist/components/avatar/MPAvatar.d.ts +9 -2
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/badge/MPBadge.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +144 -0
- package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -0
- package/dist/components/bottom-navigation/index.d.ts +2 -0
- package/dist/components/bottom-navigation/index.js +1 -0
- package/dist/components/breadcrumb/MPBreadcrumb.d.ts +22 -0
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
- package/dist/components/button/MPButton.d.ts +7 -2
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/checkbox/MPCheckbox.d.ts +2 -2
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +13 -3
- package/dist/components/chip/MPChip.js +1 -1
- package/dist/components/color-picker/MPColorPicker.d.ts +21 -3
- package/dist/components/color-picker/MPColorPicker.js +1 -1
- package/dist/components/combobox/MPCombobox.d.ts +38 -10
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/container/MPContainer.d.ts +75 -0
- package/dist/components/container/MPContainer.js +1 -0
- package/dist/components/container/index.d.ts +2 -0
- package/dist/components/container/index.js +1 -0
- package/dist/components/date-picker/MPDatePicker.d.ts +3 -0
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/MPDateTimePicker.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +8 -3
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +33 -9
- package/dist/components/drawer/MPDrawer.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +12 -2
- package/dist/components/empty/MPEmpty.js +1 -1
- package/dist/components/file-picker/MPFilePicker.d.ts +11 -1
- package/dist/components/file-picker/MPFilePicker.js +1 -1
- package/dist/components/floating-action-button/MPFloatingActionButton.d.ts +126 -0
- package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -0
- package/dist/components/floating-action-button/index.d.ts +2 -0
- package/dist/components/floating-action-button/index.js +1 -0
- package/dist/components/grid/MPGrid.d.ts +155 -0
- package/dist/components/grid/MPGrid.js +1 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/grid/index.js +1 -0
- package/dist/components/highlight/MPHighlight.js +1 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +10 -1
- package/dist/components/menu/MPMenu.js +1 -1
- package/dist/components/number-field/MPNumberField.d.ts +21 -3
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/pagination/MPPagination.d.ts +106 -0
- package/dist/components/pagination/MPPagination.js +1 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/panes/MPPanes.js +1 -1
- package/dist/components/pill/MPPill.js +1 -1
- package/dist/components/popover/MPPopover.d.ts +8 -3
- package/dist/components/popover/MPPopover.js +1 -1
- package/dist/components/radio-group/MPRadioGroup.js +1 -1
- package/dist/components/rating/MPRating.d.ts +135 -0
- package/dist/components/rating/MPRating.js +1 -0
- package/dist/components/rating/index.d.ts +2 -0
- package/dist/components/rating/index.js +1 -0
- package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
- package/dist/components/select/MPSelect.d.ts +23 -6
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/skeleton/MPSkeleton.js +1 -1
- package/dist/components/slider/MPSlider.js +1 -1
- package/dist/components/snackbar/MPSnackbar.d.ts +8 -3
- package/dist/components/snackbar/MPSnackbar.js +1 -1
- package/dist/components/spoiler/MPSpoiler.js +1 -1
- package/dist/components/switch/MPSwitch.d.ts +2 -2
- package/dist/components/switch/MPSwitch.js +1 -1
- package/dist/components/table/MPTable.d.ts +14 -1
- package/dist/components/table/MPTable.js +1 -1
- package/dist/components/tabs/MPTabs.d.ts +145 -0
- package/dist/components/tabs/MPTabs.js +1 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/text-field/MPTextField.d.ts +37 -7
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/text-link/MPTextLink.js +1 -1
- package/dist/components/time-picker/MPTimePicker.js +1 -1
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/constants/icons.d.ts +13 -0
- package/dist/constants/icons.js +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/FieldOutline.d.ts +75 -4
- package/dist/internal/FieldOutline.js +1 -1
- package/dist/internal/Picker.d.ts +52 -9
- package/dist/internal/Picker.js +1 -1
- package/dist/internal/animate.d.ts +179 -0
- package/dist/internal/animate.js +1 -0
- package/dist/internal/date.d.ts +2 -2
- package/dist/internal/date.js +1 -1
- package/dist/internal/i18n.d.ts +110 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/inert.d.ts +11 -0
- package/dist/internal/inert.js +1 -0
- package/dist/internal/surface.d.ts +42 -12
- package/dist/internal/surface.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +640 -4
- package/dist/types.d.ts +155 -0
- package/package.json +10 -10
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPAnimateProps, MPSide } from '../../types';
|
|
4
|
+
export interface MPAnimateAppearProps extends MPAnimateProps, 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;
|
|
11
|
+
/**
|
|
12
|
+
* Which edge each child drifts in from.
|
|
13
|
+
* @default 'bottom'
|
|
14
|
+
*/
|
|
15
|
+
from?: MPSide;
|
|
16
|
+
/**
|
|
17
|
+
* How far each child travels. Short on purpose: this is a settling, not an
|
|
18
|
+
* entrance from off screen, and a long travel over a list of eight turns the
|
|
19
|
+
* whole block into something moving.
|
|
20
|
+
* @default '0.75rem'
|
|
21
|
+
*/
|
|
22
|
+
distance?: number | string;
|
|
23
|
+
/**
|
|
24
|
+
* Fades each child in as it settles.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
fade?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Runs the list from the last child to the first.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
reverse?: boolean;
|
|
33
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
34
|
+
render?: useRender.RenderProp;
|
|
35
|
+
/** The things that appear, one after another. */
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A list of things settling into place one after another.
|
|
40
|
+
*
|
|
41
|
+
* Each child gets the same short fade and drift, held back by its position — so
|
|
42
|
+
* the effect belongs to the **set** rather than to any one item, and a reader's
|
|
43
|
+
* eye is walked down the list in the order it should be read. That is what MD3
|
|
44
|
+
* means by a list being introduced rather than merely drawn.
|
|
45
|
+
*
|
|
46
|
+
* The animation is written onto the children themselves rather than onto
|
|
47
|
+
* wrappers around them. A row of `<li>`s stays a row of `<li>`s, a grid's cells
|
|
48
|
+
* stay its direct children, and nothing about the layout changes because the
|
|
49
|
+
* list is being animated. Only a bare string has no element to write onto, so
|
|
50
|
+
* that one is wrapped in a `<span>`.
|
|
51
|
+
*
|
|
52
|
+
* The stagger is per **child**, which means what you pass matters: eight
|
|
53
|
+
* children are eight steps, and one child holding eight things is one step.
|
|
54
|
+
* That is also how to opt part of a list out — group it.
|
|
55
|
+
*/
|
|
56
|
+
export declare const MPAnimateAppear: React.ForwardRefExoticComponent<MPAnimateAppearProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import*as a from"react";import{useRender as t}from"@base-ui/react/use-render";import{ANIMATION_CLASS as r,ANIM_BASE as s,animationSlots as n,isInfinite as i,slideOffsets as o,useAnimationRun as l}from"../../internal/animate";export const MPAnimateAppear=a.forwardRef(function({duration:m,delay:p=0,easing:d,repeat:c=1,alternate:f,paused:y,trigger:u="mount",play:h,once:g=!0,threshold:x=.2,stagger:N=80,from:j="bottom",distance:A="0.75rem",fade:b=!0,reverse:E=!1,render:$,className:v,style:w,children:B,...C},M){const P=l({trigger:u,play:h,once:g,threshold:x,paused:y,infinite:i(c)}),{x:R,y:V}=o(j,A),_=a.Children.toArray(B),k=`${s} ${r.slide}`,q=_.map((t,r)=>{const s=E?_.length-1-r:r,i=n({effect:"slide",duration:m,delay:p+s*N,easing:d,repeat:c,alternate:f,x:R,y:V,opacity:b?0:1});if(!a.isValidElement(t))return e("span",{className:k,style:i,children:t},r);const o=t.props;return a.cloneElement(t,{className:[k,o.className].filter(Boolean).join(" "),style:{...i,...o.style}})});return t({render:$,ref:[M,P.ref],props:{...C,className:v,style:{"--_mp-anim-state":P.state,...w},...P.handlers,"data-mp-animation":"appear","data-mp-state":P.state,children:q}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateAppear}from"./MPAnimateAppear";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPAnimateProps } from '../../types';
|
|
4
|
+
export interface MPAnimateBlinkProps extends MPAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* How faint it gets at the bottom of the cycle, between `0` and `1`. Raise it
|
|
7
|
+
* for something that has to stay readable while it pulses.
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
10
|
+
min?: number;
|
|
11
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
12
|
+
render?: useRender.RenderProp;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Content pulsing between full opacity and a floor.
|
|
17
|
+
*
|
|
18
|
+
* The cycle is symmetric — full, faint, full — so however many times it runs it
|
|
19
|
+
* ends where it started. A blink that finished halfway would leave the element
|
|
20
|
+
* permanently half drawn, which reads as a rendering fault rather than as an
|
|
21
|
+
* effect that has ended.
|
|
22
|
+
*
|
|
23
|
+
* It repeats forever unless told otherwise, because a single blink is a flicker
|
|
24
|
+
* and nobody asks for a flicker. `standard` rather than the emphasized curve
|
|
25
|
+
* every other effect takes, for the same reason: a pulse has no destination to
|
|
26
|
+
* decelerate into, and easing into a frame it immediately leaves reads as a
|
|
27
|
+
* stutter.
|
|
28
|
+
*
|
|
29
|
+
* ## Two things worth saying before using it
|
|
30
|
+
*
|
|
31
|
+
* Something that never stops moving in the corner of a page being read is the
|
|
32
|
+
* one kind of motion this library otherwise refuses, and a reader with a
|
|
33
|
+
* reduced-motion preference will see none of it. So `min` is a **dimming**,
|
|
34
|
+
* never the only thing carrying the message: if it is urgent, say so in words
|
|
35
|
+
* as well.
|
|
36
|
+
*
|
|
37
|
+
* For a placeholder that pulses because content has not arrived yet, this is
|
|
38
|
+
* the wrong component — [MPSkeleton](../feedback/skeleton) reserves the space
|
|
39
|
+
* the real thing will take, which is the part that was doing the work.
|
|
40
|
+
*/
|
|
41
|
+
export declare const MPAnimateBlink: React.ForwardRefExoticComponent<MPAnimateBlinkProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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";export const MPAnimateBlink=e.forwardRef(function({duration:e,delay:n=0,easing:i,repeat:o="infinite",alternate:s,paused:l,trigger:p="mount",play:c,once:d=!0,threshold:f=.2,min:m=0,render:u,className:y,style:g,children:h,...N},b){const k=a({effect:"blink",duration:e,delay:n,easing:i,repeat:o,alternate:s,opacity:m,trigger:p,play:c,once:d,threshold:f,paused:l,infinite:t(o)});return r({render:u,ref:[b,k.ref],props:{...N,className:[k.className,y].filter(Boolean).join(" "),style:{...k.style,...g},...k.props,children:h}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateBlink}from"./MPAnimateBlink";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPAnimateMode, MPAnimateProps } from '../../types';
|
|
4
|
+
export interface MPAnimateFadeProps extends MPAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the content arrives or leaves. An exit is quicker than an entrance
|
|
7
|
+
* — MD3's `short4` against `medium2` — unless `duration` says otherwise.
|
|
8
|
+
* @default 'in'
|
|
9
|
+
*/
|
|
10
|
+
mode?: MPAnimateMode;
|
|
11
|
+
/**
|
|
12
|
+
* The opacity it starts from, between `0` and `1`. Raise it for content that
|
|
13
|
+
* should never be completely gone.
|
|
14
|
+
* @default 0
|
|
15
|
+
*/
|
|
16
|
+
from?: number;
|
|
17
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
18
|
+
render?: useRender.RenderProp;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Content arriving or leaving on opacity alone.
|
|
23
|
+
*
|
|
24
|
+
* The plainest effect in the set, and the one to reach for first: nothing
|
|
25
|
+
* moves, so nothing reflows and nothing is resampled. A fade is the only
|
|
26
|
+
* entrance that is safe on a block of text at any size — everything else in
|
|
27
|
+
* this group either scales it or travels it, and both resample glyphs.
|
|
28
|
+
*
|
|
29
|
+
* It is also the effect MD3 names in two of its four standard patterns. **Fade
|
|
30
|
+
* through** — one thing out, then the next in — is what this is when two of
|
|
31
|
+
* them are sequenced with a `delay`; **fade** is what a thing entering or
|
|
32
|
+
* leaving a screen does on its own, which is the default here.
|
|
33
|
+
*
|
|
34
|
+
* `mode="out"` is the same animation run backwards, and it is *held* at the
|
|
35
|
+
* end: a faded-out element stays faded out rather than snapping back into view
|
|
36
|
+
* the moment the animation finishes.
|
|
37
|
+
*/
|
|
38
|
+
export declare const MPAnimateFade: React.ForwardRefExoticComponent<MPAnimateFadeProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as a,useAnimateElement as t}from"../../internal/animate";export const MPAnimateFade=e.forwardRef(function({duration:e,delay:n=0,easing:o,repeat:i=1,alternate:s,paused:l,trigger:d="mount",play:m,once:p=!0,threshold:c=.2,mode:f="in",from:u=0,render:y,className:g,style:h,children:N,...b},j){const w=t({effect:"fade",duration:e,delay:n,easing:o,repeat:i,alternate:s,mode:f,opacity:u,trigger:d,play:m,once:p,threshold:c,paused:l,infinite:a(i)});return r({render:y,ref:[j,w.ref],props:{...b,className:[w.className,g].filter(Boolean).join(" "),style:{...w.style,...h},...w.props,children:N}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateFade}from"./MPAnimateFade";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPAnimateMode, MPAnimateProps } from '../../types';
|
|
4
|
+
export interface MPAnimateGrowProps extends MPAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the content unfolds or folds away. An exit is quicker than an
|
|
7
|
+
* entrance — MD3's `short4` against `medium4` — unless `duration` says
|
|
8
|
+
* otherwise.
|
|
9
|
+
* @default 'in'
|
|
10
|
+
*/
|
|
11
|
+
mode?: MPAnimateMode;
|
|
12
|
+
/**
|
|
13
|
+
* The scale it starts from, as a multiple of its final size. Above `1` it
|
|
14
|
+
* settles down onto the page instead of up out of it.
|
|
15
|
+
* @default 0.8
|
|
16
|
+
*/
|
|
17
|
+
from?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Which point stays put while the rest moves — any CSS `transform-origin`.
|
|
20
|
+
* `'top'` unfolds downwards, `'bottom left'` out of a corner.
|
|
21
|
+
* @default 'center'
|
|
22
|
+
*/
|
|
23
|
+
origin?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Fades in as it grows. Turn it off for something already on the page that is
|
|
26
|
+
* only changing size.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
fade?: boolean;
|
|
30
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
31
|
+
render?: useRender.RenderProp;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Content unfolding from a point.
|
|
36
|
+
*
|
|
37
|
+
* This is the container transform MD3 describes, at the one scale a component
|
|
38
|
+
* library can offer it: something opens out of the place it belongs to. A panel
|
|
39
|
+
* out of a toolbar, a card out of the row it sits in, a sheet out of the button
|
|
40
|
+
* that summoned it — `origin` is what anchors it to that place, and it is the
|
|
41
|
+
* whole difference between this and [MPAnimateZoom](../motion/animate-zoom).
|
|
42
|
+
*
|
|
43
|
+
* A Grow starts close to its final size, so the travel is short and the content
|
|
44
|
+
* inside is legible for most of the animation. A Zoom starts at less than half
|
|
45
|
+
* and always about the middle: it comes at the reader rather than out of
|
|
46
|
+
* anything.
|
|
47
|
+
*
|
|
48
|
+
* `transform-origin` governs the standalone `scale` property as well as the
|
|
49
|
+
* `transform` shorthand, which is what lets this effect stay off the shorthand
|
|
50
|
+
* entirely — a caller's own transform on the same element survives.
|
|
51
|
+
*/
|
|
52
|
+
export declare const MPAnimateGrow: React.ForwardRefExoticComponent<MPAnimateGrowProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as a,useAnimateElement as t}from"../../internal/animate";export const MPAnimateGrow=e.forwardRef(function({duration:e,delay:n=0,easing:o,repeat:i=1,alternate:s,paused:l,trigger:d="mount",play:c,once:m=!0,threshold:f=.2,mode:p="in",from:g=.8,origin:u="center",fade:y=!0,render:h,className:w,style:N,children:b,...j},x){const A=t({effect:"grow",duration:e,delay:n,easing:o,repeat:i,alternate:s,mode:p,scale:g,opacity:y?0:1,trigger:d,play:c,once:m,threshold:f,paused:l,infinite:a(i)});return r({render:h,ref:[x,A.ref],props:{...j,className:[A.className,w].filter(Boolean).join(" "),style:{transformOrigin:u,...A.style,...N},...A.props,children:b}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateGrow}from"./MPAnimateGrow";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPAnimateProps } from '../../types';
|
|
3
|
+
export interface MPAnimateHeadlineProps extends Omit<MPAnimateProps, 'alternate'>, React.ComponentPropsWithoutRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* How long each line is held before the next one comes up, in milliseconds.
|
|
6
|
+
* Counted from the moment a line arrives, so it is reading time rather than a
|
|
7
|
+
* cycle length.
|
|
8
|
+
* @default 2600
|
|
9
|
+
*/
|
|
10
|
+
interval?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Which line is showing. Pass it to drive the reel yourself — from a step in
|
|
13
|
+
* a form, a tab, or a timer of your own.
|
|
14
|
+
*/
|
|
15
|
+
index?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Where an uncontrolled reel starts.
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
defaultIndex?: number;
|
|
21
|
+
/** Called with the line that has just come up. */
|
|
22
|
+
onIndexChange?: (index: number) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Starts again after the last line. Off, the reel stops on the last one and
|
|
25
|
+
* stays there.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
loop?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* How far a line travels as it comes up or leaves — a CSS length, or a number
|
|
31
|
+
* in pixels. `'100%'` is one line's own height.
|
|
32
|
+
* @default '100%'
|
|
33
|
+
*/
|
|
34
|
+
rise?: number | string;
|
|
35
|
+
/** The lines, in the order they should be read. */
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One line replacing the one above it, on a timer.
|
|
40
|
+
*
|
|
41
|
+
* Every line sits in the same grid cell, so the box is as tall as the longest
|
|
42
|
+
* of them from the first frame and never resizes as the reel turns — which is
|
|
43
|
+
* the whole difficulty with this effect, and the reason the lines that are not
|
|
44
|
+
* showing keep their space with `visibility` rather than being taken out of the
|
|
45
|
+
* layout.
|
|
46
|
+
*
|
|
47
|
+
* It is deliberately **not a ticker**. A line comes up, it stops, and it is
|
|
48
|
+
* held long enough to read; `interval` is counted from the moment it arrives
|
|
49
|
+
* rather than from the start of the cycle, so raising `duration` does not
|
|
50
|
+
* quietly eat the reading time.
|
|
51
|
+
*
|
|
52
|
+
* The swap is the one place in this library where both halves of MD3's
|
|
53
|
+
* emphasized curve are written out: the line arriving decelerates into place
|
|
54
|
+
* while the line leaving accelerates away. Everywhere else an exit is a
|
|
55
|
+
* reversed entrance, but here the two genuinely are two animations on two
|
|
56
|
+
* elements at the same moment.
|
|
57
|
+
*
|
|
58
|
+
* Use it for a set of phrases where any one of them would have done — three
|
|
59
|
+
* ways of saying what a product is, a rotating set of customer names. What it
|
|
60
|
+
* is not for is content a reader has to see, because there is no guarantee they
|
|
61
|
+
* are looking during the two seconds it is up.
|
|
62
|
+
*/
|
|
63
|
+
export declare const MPAnimateHeadline: React.ForwardRefExoticComponent<MPAnimateHeadlineProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{easingValue as n,isInfinite as a,lengthValue as r,useAnimationRun as i,usePrefersReducedMotion as s}from"../../internal/animate";export const MPAnimateHeadline=t.forwardRef(function({duration:o,delay:l=0,easing:m,repeat:u="infinite",paused:c,trigger:d="mount",play:f,once:p=!0,threshold:h=.2,interval:v=2600,index:g,defaultIndex:y=0,onIndexChange:x,loop:E=!0,rise:N="100%",className:j,style:T,children:_,...C},M){const R=i({trigger:d,play:f,once:p,threshold:h,paused:c,infinite:a(u)}),k=s(),A=t.Children.toArray(_),B=A.length,[I,S]=t.useState(y),b=Math.min(g??I,Math.max(B-1,0)),[w,H]=t.useState(null),P=t.useRef(b);t.useEffect(()=>{P.current!==b&&(H(P.current),P.current=b)},[b]);const V=o??500;t.useEffect(()=>{if(null===w)return;const e=setTimeout(()=>H(null),V);return()=>clearTimeout(e)},[w,V]);const $=t.useCallback(()=>{const e=b+1;if(e>=B){if(!E)return;return void 0===g&&S(0),void x?.(0)}void 0===g&&S(e),x?.(e)},[b,B,E,g,x]),q=t.useRef(!1);return t.useEffect(()=>{if(void 0!==g||B<2||"running"!==R.state)return;if(!E&&b===B-1)return;const e=setTimeout(()=>{q.current=!0,$()},v+(q.current?0:l));return()=>clearTimeout(e)},[g,B,R.state,v,l,$,E,b]),e("div",{ref:e=>{R.ref(e),"function"==typeof M?M(e):M&&(M.current=e)},className:["mp-headline",j??""].filter(Boolean).join(" "),style:{...void 0===o?{}:{"--_mp-anim-duration":`${o}ms`},"--_mp-anim-rise":r(N),...m?{"--_mp-anim-ease":n(m)}:{},"--_mp-anim-state":R.state,...T},"data-mp-animation":"headline","data-mp-state":R.state,...R.handlers,...C,children:A.map((n,a)=>{const r=a===b?"active":a!==w||k?void 0:"leaving";if(!t.isValidElement(n))return e("span",{className:"mp-headline-item","data-mp-state":r,children:n},a);const i=n.props;return t.cloneElement(n,{key:a,className:["mp-headline-item",i.className].filter(Boolean).join(" "),"data-mp-state":r})})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateHeadline}from"./MPAnimateHeadline";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPAnimateProps, MPColor, MPSize } from '../../types';
|
|
4
|
+
export interface MPAnimateLightingProps extends Omit<MPAnimateProps, 'easing'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
5
|
+
/**
|
|
6
|
+
* Which accent family the light is drawn in. Not an arbitrary colour, for the
|
|
7
|
+
* reason no component in this library takes one: to change what `primary`
|
|
8
|
+
* *is*, set the token.
|
|
9
|
+
* @default 'primary'
|
|
10
|
+
*/
|
|
11
|
+
color?: MPColor;
|
|
12
|
+
/**
|
|
13
|
+
* The radius the light follows, on the shared corner ladder. It has to match
|
|
14
|
+
* what is inside, or the glow will cut a corner the content has rounded off.
|
|
15
|
+
* @default 'md'
|
|
16
|
+
*/
|
|
17
|
+
size?: MPSize;
|
|
18
|
+
/**
|
|
19
|
+
* How far past the content the light reaches, in pixels.
|
|
20
|
+
* @default 3
|
|
21
|
+
*/
|
|
22
|
+
spread?: number;
|
|
23
|
+
/**
|
|
24
|
+
* How much of the outline is lit at once, in degrees. Small is a travelling
|
|
25
|
+
* spark; large is a sweep.
|
|
26
|
+
* @default 50
|
|
27
|
+
*/
|
|
28
|
+
arc?: number;
|
|
29
|
+
/**
|
|
30
|
+
* How soft the light is, in pixels. At `0` it is a hard-edged wedge, which
|
|
31
|
+
* reads as a graphic rather than as light.
|
|
32
|
+
* @default 4
|
|
33
|
+
*/
|
|
34
|
+
blur?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Runs the light the other way round.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
reverse?: boolean;
|
|
40
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
41
|
+
render?: useRender.RenderProp;
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A light travelling around the outside of something.
|
|
46
|
+
*
|
|
47
|
+
* The light is **behind** the content rather than on it, so what a reader sees
|
|
48
|
+
* is a glow escaping from under the edges — which is why it works around a
|
|
49
|
+
* [card](../layout/card) or a [button](../inputs/button) without touching
|
|
50
|
+
* anything about how they are drawn. Nothing inside is altered, nothing is
|
|
51
|
+
* overlaid, and the content stays exactly as legible as it was.
|
|
52
|
+
*
|
|
53
|
+
* Use it to mark the one thing on a screen that is currently live: the row that
|
|
54
|
+
* is processing, the field being checked, the plan being recommended. It draws
|
|
55
|
+
* attention with light rather than by moving anything, which is the only way
|
|
56
|
+
* this library has of saying "here" without also saying "and it moved".
|
|
57
|
+
*
|
|
58
|
+
* ## Two things it needs from the caller
|
|
59
|
+
*
|
|
60
|
+
* `size` has to agree with the radius of what is inside it. The glow follows
|
|
61
|
+
* the wrapper's own corners, so an `xl` card in an `md` Lighting will show
|
|
62
|
+
* light poking out of four corners the card has already rounded away.
|
|
63
|
+
*
|
|
64
|
+
* And the arc is decoration. Under `prefers-reduced-motion` it stops travelling
|
|
65
|
+
* and becomes an even glow — still a mark, no longer a motion — so whatever it
|
|
66
|
+
* was pointing at has to be sayable without it.
|
|
67
|
+
*/
|
|
68
|
+
export declare const MPAnimateLighting: React.ForwardRefExoticComponent<MPAnimateLightingProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{accentSlots as a}from"../../internal/accent";import{isInfinite as n,repeatValue as t,useAnimationRun as m}from"../../internal/animate";const i={xs:"rounded-mp-xs",sm:"rounded-mp-sm",md:"rounded-mp-md",lg:"rounded-mp-lg",xl:"rounded-mp-xl"};export const MPAnimateLighting=e.forwardRef(function({duration:e=3e3,delay:o=0,repeat:d="infinite",alternate:p,paused:s,trigger:l="mount",play:c,once:g=!0,threshold:u=.2,color:f="primary",size:h="md",spread:_=3,arc:x=50,blur:y=4,reverse:w=!1,render:$,className:b,style:v,children:z,...N},j){const A=m({trigger:l,play:c,once:g,threshold:u,paused:s,infinite:n(d)});return r({render:$,ref:[j,A.ref],props:{...N,"data-mp-size":h,className:["mp-anim-lighting",i[h],b].filter(Boolean).join(" "),style:{...a(f),"--_mp-anim-duration":`${e}ms`,"--_mp-anim-delay":`${o}ms`,"--_mp-anim-repeat":t(d),"--_mp-anim-direction":w?p?"alternate-reverse":"reverse":p?"alternate":"normal","--_mp-anim-state":A.state,"--_mp-anim-glow-width":`${_}px`,"--_mp-anim-glow-arc":`${x}deg`,"--_mp-anim-glow-blur":`${y}px`,...v},...A.handlers,"data-mp-animation":"lighting","data-mp-state":A.state,children:z}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateLighting}from"./MPAnimateLighting";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPAnimateProps, MPOrientation } from '../../types';
|
|
3
|
+
export interface MPAnimateMarqueeProps extends MPAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* Which way the strip runs.
|
|
6
|
+
* @default 'horizontal'
|
|
7
|
+
*/
|
|
8
|
+
orientation?: MPOrientation;
|
|
9
|
+
/**
|
|
10
|
+
* Runs it the other way — left to right, or bottom to top.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
reverse?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* How fast the content travels, in pixels per second. A speed rather than a
|
|
16
|
+
* duration, so a strip of four logos and a strip of forty move at the same
|
|
17
|
+
* pace instead of the long one becoming a blur.
|
|
18
|
+
* @default 60
|
|
19
|
+
*/
|
|
20
|
+
speed?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The gap between items, and between the last item and the first of the next
|
|
23
|
+
* pass — a CSS length, or a number in pixels.
|
|
24
|
+
* @default '2rem'
|
|
25
|
+
*/
|
|
26
|
+
gap?: number | string;
|
|
27
|
+
/**
|
|
28
|
+
* How many copies of the content are laid end to end. Two is enough for
|
|
29
|
+
* anything at least as wide as its container; raise it when the content is
|
|
30
|
+
* short enough to leave a hole behind itself.
|
|
31
|
+
* @default 2
|
|
32
|
+
*/
|
|
33
|
+
copies?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Stops while the pointer is on it, so something scrolling past can actually
|
|
36
|
+
* be read or clicked.
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
pauseOnHover?: boolean;
|
|
40
|
+
/** The things that scroll past. */
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Content scrolling steadily past, forever.
|
|
45
|
+
*
|
|
46
|
+
* The content is laid down twice, and each copy travels exactly its own length
|
|
47
|
+
* plus the gap — so the moment the first copy has left, the second is standing
|
|
48
|
+
* precisely where it began. There is no seam, no jump and no frame where the
|
|
49
|
+
* strip is empty, and none of that depends on measuring anything: a percentage
|
|
50
|
+
* `translate` resolves against the element's own box.
|
|
51
|
+
*
|
|
52
|
+
* What **is** measured is only the speed. A duration would mean a strip of four
|
|
53
|
+
* logos and a strip of forty crossing the same box in the same time, with the
|
|
54
|
+
* long one becoming unreadable; `speed` is pixels per second, so both move at
|
|
55
|
+
* the pace of a reader instead. The strip is re-measured whenever it changes
|
|
56
|
+
* size.
|
|
57
|
+
*
|
|
58
|
+
* `pauseOnHover` is on by default and is not decoration: content moving past a
|
|
59
|
+
* pointer cannot be clicked reliably, and a link inside a marquee that never
|
|
60
|
+
* stops is a link nobody can follow.
|
|
61
|
+
*
|
|
62
|
+
* Only the first copy is read out. The rest carry `aria-hidden`, or a screen
|
|
63
|
+
* reader would announce everything on the strip as many times as it was laid
|
|
64
|
+
* down.
|
|
65
|
+
*/
|
|
66
|
+
export declare const MPAnimateMarquee: React.ForwardRefExoticComponent<MPAnimateMarqueeProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{easingValue as t,isInfinite as a,lengthValue as n,repeatValue as i,useAnimationRun as o}from"../../internal/animate";export const MPAnimateMarquee=r.forwardRef(function({duration:s,delay:m=0,easing:p,repeat:u="infinite",alternate:l,paused:c,trigger:d="mount",play:f,once:h=!0,threshold:v=.2,orientation:g="horizontal",reverse:y=!1,speed:_=60,gap:q="2rem",copies:R=2,pauseOnHover:b=!0,className:x,style:M,children:j,...w},z){const N=o({trigger:d,play:f,once:h,threshold:v,paused:c,infinite:a(u)}),O=r.useRef(null),A=r.useRef(null),[G,H]=r.useState(0),S="vertical"===g;r.useEffect(()=>{const e=O.current,r=A.current;if(!e||!r)return;const t=()=>{const t=getComputedStyle(e),a=parseFloat(S?t.rowGap:t.columnGap)||0,n=S?r.offsetHeight:r.offsetWidth;H(n+a)};if(t(),"undefined"==typeof ResizeObserver)return;const a=new ResizeObserver(t);return a.observe(r),a.observe(e),()=>a.disconnect()},[S,j]);const $=s??(G>0?G/_*1e3:12e3);return e("div",{ref:e=>{O.current=e,N.ref(e),"function"==typeof z?z(e):z&&(z.current=e)},className:["mp-marquee",S?"mp-marquee-vertical":"",x??""].filter(Boolean).join(" "),style:{"--_mp-anim-gap":n(q),...p?{"--_mp-anim-ease":t(p)}:{},"--_mp-anim-duration":`${Math.round($)}ms`,"--_mp-anim-delay":`${m}ms`,"--_mp-anim-repeat":i(u),"--_mp-anim-direction":y?l?"alternate-reverse":"reverse":l?"alternate":"normal","--_mp-anim-state":N.state,...M},"data-mp-animation":"marquee","data-mp-state":N.state,"data-mp-pause-on-hover":b?"":void 0,...N.handlers,...w,children:Array.from({length:Math.max(1,R)},(r,t)=>(r=>e("div",{ref:0===r?A:void 0,className:"mp-marquee-track","aria-hidden":0===r?void 0:"true",children:j},r))(t))})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateMarquee}from"./MPAnimateMarquee";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPAnimateMode, MPAnimateProps } from '../../types';
|
|
4
|
+
export interface MPAnimateRotateProps extends MPAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the content turns into place or out of it.
|
|
7
|
+
* @default 'in'
|
|
8
|
+
*/
|
|
9
|
+
mode?: MPAnimateMode;
|
|
10
|
+
/**
|
|
11
|
+
* The angle it starts at, in degrees. Negative is anticlockwise.
|
|
12
|
+
* @default -180
|
|
13
|
+
*/
|
|
14
|
+
from?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The angle it ends at, in degrees. Together with `from` this is what makes
|
|
17
|
+
* one component cover both a quarter turn into place and an endless spin:
|
|
18
|
+
* `from={0} to={360} repeat="infinite" easing="linear"`.
|
|
19
|
+
* @default 0
|
|
20
|
+
*/
|
|
21
|
+
to?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Which point it turns about — any CSS `transform-origin`.
|
|
24
|
+
* @default 'center'
|
|
25
|
+
*/
|
|
26
|
+
origin?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Fades in as it turns. Turn it off for a continuous spin, where a repeating
|
|
29
|
+
* fade would read as flickering.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
fade?: boolean;
|
|
33
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
34
|
+
render?: useRender.RenderProp;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Content turning about a point.
|
|
39
|
+
*
|
|
40
|
+
* Two angles rather than one, which is what lets this be both of the effects a
|
|
41
|
+
* rotation is ever used for. `from` alone is an **arrival** — something
|
|
42
|
+
* swinging into place and stopping. `from` and `to` together with
|
|
43
|
+
* `repeat="infinite"` and `easing="linear"` is a **spin** that never lands,
|
|
44
|
+
* which is what a decorative mark or a badge wants.
|
|
45
|
+
*
|
|
46
|
+
* Rotation is the one movement this library allows on a glyph without argument:
|
|
47
|
+
* a chevron is turned rather than redrawn all over the components, because a
|
|
48
|
+
* turned arrow is still the same arrow. What it is emphatically not for is
|
|
49
|
+
* text. A rotated word is resampled along its whole length, and at any angle
|
|
50
|
+
* that is not a multiple of 90° every stem in it lands between pixels.
|
|
51
|
+
*
|
|
52
|
+
* If what you want is a spinner, this is not it — an indeterminate indicator
|
|
53
|
+
* has to say what it is waiting on, which is
|
|
54
|
+
* [MPProgressCircular](../feedback/progress-circular).
|
|
55
|
+
*/
|
|
56
|
+
export declare const MPAnimateRotate: React.ForwardRefExoticComponent<MPAnimateRotateProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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";export const MPAnimateRotate=e.forwardRef(function({duration:e,delay:n=0,easing:o,repeat:i=1,alternate:s,paused:l,trigger:d="mount",play:m,once:c=!0,threshold:f=.2,mode:p="in",from:g=-180,to:u=0,origin:y="center",fade:h=!0,render:N,className:R,style:$,children:b,...j},w){const x=a({effect:"rotate",duration:e,delay:n,easing:o,repeat:i,alternate:s,mode:p,angle:`${g}deg`,angleTo:`${u}deg`,opacity:h?0:1,trigger:d,play:m,once:c,threshold:f,paused:l,infinite:t(i)});return r({render:N,ref:[w,x.ref],props:{...j,className:[x.className,R].filter(Boolean).join(" "),style:{transformOrigin:y,...x.style,...$},...x.props,children:b}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateRotate}from"./MPAnimateRotate";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPAnimateMode, MPAnimateProps, MPSide } from '../../types';
|
|
4
|
+
export interface MPAnimateSlideProps extends MPAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the content slides in or slides away. `out` leaves by the same edge
|
|
7
|
+
* it would have come from, and is quicker — MD3's `short4` against `medium4`.
|
|
8
|
+
* @default 'in'
|
|
9
|
+
*/
|
|
10
|
+
mode?: MPAnimateMode;
|
|
11
|
+
/**
|
|
12
|
+
* Which edge it travels from. Physical, as `MPSide` is everywhere in this
|
|
13
|
+
* library: a panel sliding down from the top comes from the top in every
|
|
14
|
+
* writing direction.
|
|
15
|
+
* @default 'bottom'
|
|
16
|
+
*/
|
|
17
|
+
from?: MPSide;
|
|
18
|
+
/**
|
|
19
|
+
* How far it travels — a CSS length, or a number in pixels. `'100%'` is the
|
|
20
|
+
* element's own width or height, which is what makes it appear from behind
|
|
21
|
+
* its own edge.
|
|
22
|
+
* @default '100%'
|
|
23
|
+
*/
|
|
24
|
+
distance?: number | string;
|
|
25
|
+
/**
|
|
26
|
+
* Fades in as it slides.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
fade?: boolean;
|
|
30
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
31
|
+
render?: useRender.RenderProp;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Content travelling in from one edge.
|
|
36
|
+
*
|
|
37
|
+
* This is MD3's **shared axis** transition, at the scale one wrapper can offer
|
|
38
|
+
* it: things that are related move along the same line, so a reader reads the
|
|
39
|
+
* direction as a relationship. A step forward comes from the end edge and a
|
|
40
|
+
* step back from the start one; a panel belonging to the bar above it comes
|
|
41
|
+
* down from the top.
|
|
42
|
+
*
|
|
43
|
+
* The default distance is the element's own size, so it starts exactly out of
|
|
44
|
+
* frame and is never half drawn somewhere it does not belong. Put it in a box
|
|
45
|
+
* with `overflow: hidden` and the effect is a panel appearing from behind that
|
|
46
|
+
* box's edge.
|
|
47
|
+
*
|
|
48
|
+
* A slide moves the element and not the layout: this is a `translate`, so
|
|
49
|
+
* nothing on the page reflows while it runs. For a much shorter travel over a
|
|
50
|
+
* list of things, one after another, use
|
|
51
|
+
* [MPAnimateAppear](../motion/animate-appear).
|
|
52
|
+
*/
|
|
53
|
+
export declare const MPAnimateSlide: React.ForwardRefExoticComponent<MPAnimateSlideProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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";export const MPAnimateSlide=e.forwardRef(function({duration:e,delay:o=0,easing:i,repeat:s=1,alternate:l,paused:d,trigger:m="mount",play:c,once:p=!0,threshold:f=.2,mode:y="in",from:u="bottom",distance:g="100%",fade:h=!0,render:x,className:N,style:b,children:j,...w},A){const{x:B,y:M}=a(u,g),P=n({effect:"slide",duration:e,delay:o,easing:i,repeat:s,alternate:l,mode:y,x:B,y:M,opacity:h?0:1,trigger:m,play:c,once:p,threshold:f,paused:d,infinite:t(s)});return r({render:x,ref:[A,P.ref],props:{...w,className:[P.className,N].filter(Boolean).join(" "),style:{...P.style,...b},...P.props,children:j}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateSlide}from"./MPAnimateSlide";
|