material-plus-ui 0.0.1 → 1.1.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 +39 -28
- package/dist/components/accordion/MPAccordion.d.ts +115 -0
- package/dist/components/accordion/MPAccordion.js +1 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/alert/MPAlert.d.ts +91 -0
- package/dist/components/alert/MPAlert.js +1 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- 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/aspect-ratio/MPAspectRatio.d.ts +69 -0
- package/dist/components/aspect-ratio/MPAspectRatio.js +1 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +1 -0
- package/dist/components/avatar/MPAvatar.d.ts +104 -0
- package/dist/components/avatar/MPAvatar.js +1 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/badge/MPBadge.d.ts +104 -0
- package/dist/components/badge/MPBadge.js +1 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/blockquote/MPBlockquote.d.ts +73 -0
- package/dist/components/blockquote/MPBlockquote.js +1 -0
- package/dist/components/blockquote/index.d.ts +2 -0
- package/dist/components/blockquote/index.js +1 -0
- 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/box/MPBox.d.ts +78 -0
- package/dist/components/box/MPBox.js +1 -0
- package/dist/components/box/index.d.ts +2 -0
- package/dist/components/box/index.js +1 -0
- package/dist/components/breadcrumb/MPBreadcrumb.d.ts +127 -0
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/MPButton.d.ts +75 -0
- package/dist/components/button/MPButton.js +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button-group/MPButtonGroup.d.ts +31 -0
- package/dist/components/button-group/MPButtonGroup.js +1 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/card/MPCard.d.ts +73 -0
- package/dist/components/card/MPCard.js +1 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/carousel/MPCarousel.d.ts +116 -0
- package/dist/components/carousel/MPCarousel.js +1 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.js +1 -0
- package/dist/components/chat-bubble/MPChatBubble.d.ts +132 -0
- package/dist/components/chat-bubble/MPChatBubble.js +1 -0
- package/dist/components/chat-bubble/index.d.ts +2 -0
- package/dist/components/chat-bubble/index.js +1 -0
- package/dist/components/checkbox/MPCheckbox.d.ts +76 -0
- package/dist/components/checkbox/MPCheckbox.js +1 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/MPChip.d.ts +74 -0
- package/dist/components/chip/MPChip.js +1 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/collapsible/MPCollapsible.d.ts +97 -0
- package/dist/components/collapsible/MPCollapsible.js +1 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/color-picker/MPColorPicker.d.ts +131 -0
- package/dist/components/color-picker/MPColorPicker.js +1 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +1 -0
- package/dist/components/combobox/MPCombobox.d.ts +175 -0
- package/dist/components/combobox/MPCombobox.js +1 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1 -0
- 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 +98 -0
- package/dist/components/date-picker/MPDatePicker.js +1 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/MPDateRangePicker.d.ts +98 -0
- package/dist/components/date-range-picker/MPDateRangePicker.js +1 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/date-time-picker/MPDateTimePicker.d.ts +78 -0
- package/dist/components/date-time-picker/MPDateTimePicker.js +1 -0
- package/dist/components/date-time-picker/index.d.ts +2 -0
- package/dist/components/date-time-picker/index.js +1 -0
- package/dist/components/dialog/MPDialog.d.ts +150 -0
- package/dist/components/dialog/MPDialog.js +1 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/divider/MPDivider.d.ts +80 -0
- package/dist/components/divider/MPDivider.js +1 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/drawer/MPDrawer.d.ts +168 -0
- package/dist/components/drawer/MPDrawer.js +1 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/empty/MPEmpty.d.ts +74 -0
- package/dist/components/empty/MPEmpty.js +1 -0
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/empty/index.js +1 -0
- package/dist/components/file-picker/MPFilePicker.d.ts +113 -0
- package/dist/components/file-picker/MPFilePicker.js +1 -0
- package/dist/components/file-picker/index.d.ts +2 -0
- package/dist/components/file-picker/index.js +1 -0
- 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.d.ts +95 -0
- package/dist/components/highlight/MPHighlight.js +1 -0
- package/dist/components/highlight/index.d.ts +2 -0
- package/dist/components/highlight/index.js +1 -0
- package/dist/components/icon-button/MPIconButton.d.ts +59 -0
- package/dist/components/icon-button/MPIconButton.js +1 -0
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/list/MPList.d.ts +96 -0
- package/dist/components/list/MPList.js +1 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/locale/MPLocaleProvider.d.ts +63 -0
- package/dist/components/locale/MPLocaleProvider.js +1 -0
- package/dist/components/locale/index.d.ts +2 -0
- package/dist/components/locale/index.js +1 -0
- package/dist/components/menu/MPMenu.d.ts +232 -0
- package/dist/components/menu/MPMenu.js +1 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/number-field/MPNumberField.d.ts +117 -0
- package/dist/components/number-field/MPNumberField.js +1 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +1 -0
- package/dist/components/otp-field/MPOtpField.d.ts +89 -0
- package/dist/components/otp-field/MPOtpField.js +1 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +1 -0
- package/dist/components/overlay/MPOverlay.d.ts +96 -0
- package/dist/components/overlay/MPOverlay.js +1 -0
- package/dist/components/overlay/index.d.ts +2 -0
- package/dist/components/overlay/index.js +1 -0
- 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.d.ts +100 -0
- package/dist/components/panes/MPPanes.js +1 -0
- package/dist/components/panes/index.d.ts +2 -0
- package/dist/components/panes/index.js +1 -0
- package/dist/components/pill/MPPill.d.ts +117 -0
- package/dist/components/pill/MPPill.js +1 -0
- package/dist/components/pill/index.d.ts +2 -0
- package/dist/components/pill/index.js +1 -0
- package/dist/components/popover/MPPopover.d.ts +143 -0
- package/dist/components/popover/MPPopover.js +1 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/progress-box/MPProgressBox.d.ts +40 -0
- package/dist/components/progress-box/MPProgressBox.js +1 -0
- package/dist/components/progress-box/index.d.ts +2 -0
- package/dist/components/progress-box/index.js +1 -0
- package/dist/components/progress-circular/MPProgressCircular.d.ts +32 -0
- package/dist/components/progress-circular/MPProgressCircular.js +1 -0
- package/dist/components/progress-circular/index.d.ts +2 -0
- package/dist/components/progress-circular/index.js +1 -0
- package/dist/components/progress-linear/MPProgressLinear.d.ts +32 -0
- package/dist/components/progress-linear/MPProgressLinear.js +1 -0
- package/dist/components/progress-linear/index.d.ts +2 -0
- package/dist/components/progress-linear/index.js +1 -0
- package/dist/components/radio-group/MPRadioGroup.d.ts +81 -0
- package/dist/components/radio-group/MPRadioGroup.js +1 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- 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.d.ts +75 -0
- package/dist/components/segmented-button/MPSegmentedButton.js +1 -0
- package/dist/components/segmented-button/index.d.ts +2 -0
- package/dist/components/segmented-button/index.js +1 -0
- package/dist/components/select/MPSelect.d.ts +103 -0
- package/dist/components/select/MPSelect.js +1 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/shortcut/MPShortcut.d.ts +67 -0
- package/dist/components/shortcut/MPShortcut.js +1 -0
- package/dist/components/shortcut/index.d.ts +2 -0
- package/dist/components/shortcut/index.js +1 -0
- package/dist/components/skeleton/MPSkeleton.d.ts +76 -0
- package/dist/components/skeleton/MPSkeleton.js +1 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/slider/MPSlider.d.ts +77 -0
- package/dist/components/slider/MPSlider.js +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/snackbar/MPSnackbar.d.ts +175 -0
- package/dist/components/snackbar/MPSnackbar.js +1 -0
- package/dist/components/snackbar/index.d.ts +2 -0
- package/dist/components/snackbar/index.js +1 -0
- package/dist/components/spoiler/MPSpoiler.d.ts +106 -0
- package/dist/components/spoiler/MPSpoiler.js +1 -0
- package/dist/components/spoiler/index.d.ts +2 -0
- package/dist/components/spoiler/index.js +1 -0
- package/dist/components/switch/MPSwitch.d.ts +75 -0
- package/dist/components/switch/MPSwitch.js +1 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/MPTable.d.ts +120 -0
- package/dist/components/table/MPTable.js +1 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- 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 +51 -22
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/text-link/MPTextLink.d.ts +88 -0
- package/dist/components/text-link/MPTextLink.js +1 -0
- package/dist/components/text-link/index.d.ts +2 -0
- package/dist/components/text-link/index.js +1 -0
- package/dist/components/time-picker/MPTimePicker.d.ts +108 -0
- package/dist/components/time-picker/MPTimePicker.js +1 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/index.js +1 -0
- package/dist/components/timeline/MPTimeline.d.ts +96 -0
- package/dist/components/timeline/MPTimeline.js +1 -0
- package/dist/components/timeline/index.d.ts +2 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/tooltip/MPTooltip.d.ts +117 -0
- package/dist/components/tooltip/MPTooltip.js +1 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/typography/MPTypography.d.ts +94 -0
- package/dist/components/typography/MPTypography.js +1 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/index.js +1 -0
- package/dist/constants/icons.d.ts +49 -0
- package/dist/constants/icons.js +1 -1
- package/dist/index.d.ts +73 -0
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.d.ts +118 -0
- package/dist/internal/Calendar.js +1 -0
- package/dist/internal/FieldOutline.d.ts +109 -0
- package/dist/internal/FieldOutline.js +1 -0
- package/dist/internal/Picker.d.ts +153 -0
- package/dist/internal/Picker.js +1 -0
- package/dist/internal/StateLayer.d.ts +45 -0
- package/dist/internal/StateLayer.js +1 -0
- package/dist/internal/SupportingText.d.ts +23 -0
- package/dist/internal/SupportingText.js +1 -0
- package/dist/internal/WidthSizer.d.ts +31 -0
- package/dist/internal/WidthSizer.js +1 -0
- package/dist/internal/accent.d.ts +39 -0
- package/dist/internal/accent.js +1 -0
- package/dist/internal/animate.d.ts +179 -0
- package/dist/internal/animate.js +1 -0
- package/dist/internal/button-group.d.ts +21 -0
- package/dist/internal/button-group.js +1 -0
- package/dist/internal/color.d.ts +125 -0
- package/dist/internal/color.js +1 -0
- package/dist/internal/date.d.ts +179 -0
- package/dist/internal/date.js +1 -0
- package/dist/internal/i18n.d.ts +241 -0
- package/dist/internal/i18n.js +1 -0
- package/dist/internal/inert.d.ts +11 -0
- package/dist/internal/inert.js +1 -0
- package/dist/internal/locale.d.ts +43 -0
- package/dist/internal/locale.js +1 -0
- package/dist/internal/menu.d.ts +23 -0
- package/dist/internal/menu.js +1 -0
- package/dist/internal/progress.d.ts +126 -0
- package/dist/internal/progress.js +1 -0
- package/dist/internal/scale.d.ts +127 -0
- package/dist/internal/scale.js +1 -0
- package/dist/internal/surface.d.ts +76 -0
- package/dist/internal/surface.js +1 -0
- package/dist/internal/visually-hidden.d.ts +23 -0
- package/dist/internal/visually-hidden.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1871 -20
- package/dist/types.d.ts +262 -16
- package/package.json +16 -21
|
@@ -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";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPAnimateProps } from '../../types';
|
|
3
|
+
export interface MPAnimateTypingProps extends Omit<MPAnimateProps, 'alternate' | 'easing'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
4
|
+
/** The text, when it is easier to pass than to nest. Overrides `children`. */
|
|
5
|
+
text?: string;
|
|
6
|
+
/**
|
|
7
|
+
* How fast it is typed, in characters per second.
|
|
8
|
+
* @default 24
|
|
9
|
+
*/
|
|
10
|
+
speed?: number;
|
|
11
|
+
/**
|
|
12
|
+
* How long the finished text is held before it repeats, in milliseconds.
|
|
13
|
+
* @default 1400
|
|
14
|
+
*/
|
|
15
|
+
hold?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Deletes the text again before repeating, rather than clearing it in one
|
|
18
|
+
* frame. Only means anything when `repeat` is more than once.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
erase?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* How fast it is deleted, in characters per second. Deleting is usually about
|
|
24
|
+
* twice as fast as typing, which is what a person actually does.
|
|
25
|
+
* @default twice `speed`
|
|
26
|
+
*/
|
|
27
|
+
eraseSpeed?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The block after the text.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
caret?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* What the caret is drawn as.
|
|
35
|
+
* @default '|'
|
|
36
|
+
*/
|
|
37
|
+
caretChar?: React.ReactNode;
|
|
38
|
+
/** The text to type. Only text is typed — see below. */
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Text appearing one character at a time.
|
|
43
|
+
*
|
|
44
|
+
* The whole string is in the document from the first frame — in a clipped box
|
|
45
|
+
* for a screen reader, which reads it once and is not made to sit through the
|
|
46
|
+
* performance — and what animates is a visible copy that is `aria-hidden`. So
|
|
47
|
+
* the effect costs a reader who cannot see it nothing, and costs a reader who
|
|
48
|
+
* can nothing either: the box is not laid out from the characters that have
|
|
49
|
+
* arrived, so the text around it does not reflow on every frame.
|
|
50
|
+
*
|
|
51
|
+
* `repeat`, `hold` and `erase` are what make it a loop: type, hold, delete,
|
|
52
|
+
* type again. Without `erase` a repeat clears in one frame, which is right for
|
|
53
|
+
* a line that is being replaced rather than rewritten.
|
|
54
|
+
*
|
|
55
|
+
* Only **text** is typed. Pass a string, or strings; an element among the
|
|
56
|
+
* children contributes its text and nothing about its markup, because there is
|
|
57
|
+
* no honest way to reveal half of a link.
|
|
58
|
+
*/
|
|
59
|
+
export declare const MPAnimateTyping: React.ForwardRefExoticComponent<MPAnimateTypingProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{isInfinite as n,useAnimationRun as a,usePrefersReducedMotion as i}from"../../internal/animate";import{VISUALLY_HIDDEN as s}from"../../internal/visually-hidden";function u(e){return"string"==typeof e||"number"==typeof e?String(e):Array.isArray(e)?e.map(u).join(""):""}export const MPAnimateTyping=r.forwardRef(function({text:o,speed:m=24,hold:c=1400,erase:f=!1,eraseSpeed:l,caret:d=!0,caretChar:p="|",duration:h,delay:g=0,repeat:y=1,paused:x,trigger:T="mount",play:v,once:j=!0,threshold:M=.2,className:N,style:S,children:w,...A},I){const E=a({trigger:T,play:v,once:j,threshold:M,paused:x,infinite:n(y)}),R=i(),b=o??u(w),C=r.useMemo(()=>function(e,t){if("undefined"!=typeof Intl&&"Segmenter"in Intl)return[...new Intl.Segmenter(t,{granularity:"grapheme"}).segment(e)].map(e=>e.segment);return[...e]}(b),[b]),P=C.length,[k,q]=r.useState(0),z=r.useRef(0),B=h&&P>0?h/P:1e3/Math.max(m,1),D=1e3/Math.max(l??2*m,1);return r.useEffect(()=>{z.current=0},[P]),r.useEffect(()=>{if(R||0===P)return void q(P);if(!E.started)return z.current=0,void q(0);if(x)return;let e,t=!1,r=z.current,n=1,a=!1;const i="infinite"===y?1/0:Math.max(1,y);if(r>=P&&1===i)return;const s=()=>{if(!t){if(a)return r-=1,z.current=r,q(r),r<=0&&(a=!1,n+=1),void(e=setTimeout(s,a?D:B));if(r+=1,z.current=r,q(r),r<P)e=setTimeout(s,B);else if(!(n>=i)){if(f)return a=!0,void(e=setTimeout(s,c));n+=1,e=setTimeout(()=>{t||(r=0,z.current=0,q(0),e=setTimeout(s,B))},c)}}};return q(r),e=setTimeout(s,0===r?g:B),()=>{t=!0,clearTimeout(e)}},[E.started,x,R,P,B,D,g,c,f,y]),t("div",{ref:e=>{E.ref(e),"function"==typeof I?I(e):I&&(I.current=e)},className:N,style:S,"data-mp-animation":"typing","data-mp-state":E.state,...E.handlers,...A,children:[e("span",{className:s,children:b}),t("span",{"aria-hidden":"true",className:"whitespace-pre-wrap",children:[C.slice(0,k).join(""),d?e("span",{className:"mp-typing-caret",children:p}):null]})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateTyping}from"./MPAnimateTyping";
|
|
@@ -0,0 +1,44 @@
|
|
|
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 MPAnimateZoomProps extends MPAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the content comes forward or falls 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
|
+
* arrives oversized and settles back, which reads as coming *towards* the
|
|
15
|
+
* reader rather than up out of the page.
|
|
16
|
+
* @default 0.4
|
|
17
|
+
*/
|
|
18
|
+
from?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Fades in as it zooms.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
fade?: boolean;
|
|
24
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
25
|
+
render?: useRender.RenderProp;
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Content arriving from the middle of where it will end up.
|
|
30
|
+
*
|
|
31
|
+
* The same arithmetic as [MPAnimateGrow](../motion/animate-grow) at more than
|
|
32
|
+
* twice the distance, and always about the centre — which is the whole
|
|
33
|
+
* difference. A grow unfolds *from* somewhere; a zoom comes at the reader.
|
|
34
|
+
*
|
|
35
|
+
* Use it for the one thing on a screen that is meant to interrupt: a
|
|
36
|
+
* confirmation, a result, a number that has just landed. Use it once. An
|
|
37
|
+
* interruption that happens three times on one screen is a layout, and the
|
|
38
|
+
* effect that belongs to a set of things rather than to one is
|
|
39
|
+
* [MPAnimateAppear](../motion/animate-appear).
|
|
40
|
+
*
|
|
41
|
+
* There is no `origin`, on purpose. A zoom anchored to a corner is a grow, and
|
|
42
|
+
* the library does not offer two spellings of one idea.
|
|
43
|
+
*/
|
|
44
|
+
export declare const MPAnimateZoom: React.ForwardRefExoticComponent<MPAnimateZoomProps & 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 MPAnimateZoom=e.forwardRef(function({duration:e,delay:o=0,easing:n,repeat:i=1,alternate:s,paused:l,trigger:m="mount",play:d,once:c=!0,threshold:f=.2,mode:p="in",from:u=.4,fade:y=!0,render:g,className:h,style:N,children:b,...j},w){const x=t({effect:"zoom",duration:e,delay:o,easing:n,repeat:i,alternate:s,mode:p,scale:u,opacity:y?0:1,trigger:m,play:d,once:c,threshold:f,paused:l,infinite:a(i)});return r({render:g,ref:[w,x.ref],props:{...j,className:[x.className,h].filter(Boolean).join(" "),style:{transformOrigin:"center",...x.style,...N},...x.props,children:b}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAnimateZoom}from"./MPAnimateZoom";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPSize } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* How the media inside is fitted to the box, spelled the way CSS spells it.
|
|
6
|
+
*
|
|
7
|
+
* These are `object-fit`'s own values rather than a nicer set of words, and for
|
|
8
|
+
* the same reason `MPSide` keeps `top`/`right`/`bottom`/`left`: inventing
|
|
9
|
+
* `fill-the-box` would only make a reader look up which CSS it maps to.
|
|
10
|
+
*/
|
|
11
|
+
export type MPAspectFit = 'cover' | 'contain' | 'fill' | 'none';
|
|
12
|
+
export interface MPAspectRatioProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
13
|
+
/**
|
|
14
|
+
* The proportion the box holds, written the way CSS writes it — a number
|
|
15
|
+
* (`1.5`) or a ratio (`'16 / 9'`). Both reach `aspect-ratio` untouched.
|
|
16
|
+
* @default 1
|
|
17
|
+
*/
|
|
18
|
+
ratio?: number | string;
|
|
19
|
+
/**
|
|
20
|
+
* How a single piece of media inside is fitted.
|
|
21
|
+
*
|
|
22
|
+
* Applies to an `img`, a `video`, a `canvas`, an `svg`, a `picture` or an
|
|
23
|
+
* `iframe` that is a *direct* child; those are stretched to the full box and
|
|
24
|
+
* then fitted. Anything else is laid out normally and this prop does not reach
|
|
25
|
+
* it.
|
|
26
|
+
* @default 'cover'
|
|
27
|
+
*/
|
|
28
|
+
fit?: MPAspectFit;
|
|
29
|
+
/**
|
|
30
|
+
* Rounds the corners to the `size` rung.
|
|
31
|
+
*
|
|
32
|
+
* Off by default. A layout component draws nothing, and a photograph with its
|
|
33
|
+
* corners cut is a decision about the photograph — but it is such a common one
|
|
34
|
+
* that making the caller reach for a `className` would be perverse.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
rounded?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Which corner `rounded` uses. There is no height and no type scale on a box
|
|
40
|
+
* whose whole job is a proportion, so this is the one axis `size` has here.
|
|
41
|
+
* @default 'md'
|
|
42
|
+
*/
|
|
43
|
+
size?: MPSize;
|
|
44
|
+
/**
|
|
45
|
+
* Renders something other than a `<div>`: `render={<figure />}`,
|
|
46
|
+
* `render={<a href="…" />}`. Base UI's own escape hatch.
|
|
47
|
+
*/
|
|
48
|
+
render?: useRender.RenderProp;
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A box that keeps a proportion whatever width it is given.
|
|
53
|
+
*
|
|
54
|
+
* It draws nothing — no surface, no border, no shadow, no colour — which is what
|
|
55
|
+
* makes it layout rather than a component in the Material sense. What it does is
|
|
56
|
+
* *reserve* the space: a card whose image arrives late does not reflow the page
|
|
57
|
+
* around it, and a row of thumbnails is a row of one shape.
|
|
58
|
+
*
|
|
59
|
+
* That is worth more than it sounds. Material's layout guidance is built on a
|
|
60
|
+
* grid whose rows line up, and the single most common way a real page stops
|
|
61
|
+
* lining up is media of unknown height arriving after the text around it has
|
|
62
|
+
* already been laid out.
|
|
63
|
+
*
|
|
64
|
+
* The proportion is CSS's own `aspect-ratio`, so a caller who already knows
|
|
65
|
+
* `16 / 9` has nothing to translate. `fit` is the one convenience on top: the
|
|
66
|
+
* media inside is stretched to the box and then fitted, which is the pair of
|
|
67
|
+
* declarations every use of this component would otherwise start with.
|
|
68
|
+
*/
|
|
69
|
+
export declare const MPAspectRatio: React.ForwardRefExoticComponent<MPAspectRatioProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{useRender as o}from"@base-ui/react/use-render";const i={xs:"rounded-mp-xs",sm:"rounded-mp-sm",md:"rounded-mp-md",lg:"rounded-mp-md",xl:"rounded-mp-xl"},t=["[&>img]:size-full","[&>video]:size-full","[&>canvas]:size-full","[&>svg]:size-full","[&>iframe]:size-full","[&>picture]:size-full","[&>picture>img]:size-full"].join(" "),r={cover:"[&>img]:object-cover [&>video]:object-cover [&>picture>img]:object-cover",contain:"[&>img]:object-contain [&>video]:object-contain [&>picture>img]:object-contain",fill:"[&>img]:object-fill [&>video]:object-fill [&>picture>img]:object-fill",none:"[&>img]:object-none [&>video]:object-none [&>picture>img]:object-none"};export const MPAspectRatio=e.forwardRef(function({ratio:e=1,fit:c="cover",rounded:l=!1,size:n="md",render:s,className:d,style:m,children:a,...u},f){const p=["mp-aspect-ratio relative block w-full overflow-hidden",t,r[c],l?i[n]:"",d??""].filter(Boolean).join(" ");return o({render:s,ref:f,props:{"data-mp-size":n,className:p,style:{aspectRatio:e,...m},children:a,...u}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAspectRatio}from"./MPAspectRatio";
|