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
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
<!-- An absolute URL, not `docs/public/logo-large.png`: this file is the package
|
|
2
|
+
page on npm as well as the front page on GitHub, `.npmignore` keeps `docs/`
|
|
3
|
+
out of the tarball, and npm resolves a relative image against the published
|
|
4
|
+
package before it falls back to anything else. -->
|
|
5
|
+
<img src="https://raw.githubusercontent.com/jooy2/material-plus/main/docs/public/logo-large.png" alt="Material Plus" width="96" height="96">
|
|
6
|
+
|
|
1
7
|
# Material Plus
|
|
2
8
|
|
|
3
9
|
[](https://github.com/jooy2/material-plus/blob/main/LICENSE)  [](https://www.npmjs.com/package/material-plus-ui) [](https://www.npmjs.com/package/material-plus-ui) 
|
|
@@ -8,11 +14,12 @@ Live previews and full props for every component. This README is just the quick
|
|
|
8
14
|
|
|
9
15
|
---
|
|
10
16
|
|
|
11
|
-
**Material Plus is a React component library
|
|
17
|
+
**Material Plus is a React component library implementing Material Design 3.** It is the pile of components you end up writing in every Material project — the field that handles IME composition properly, the icon wrapper that agrees with your set — extracted, documented and tested.
|
|
12
18
|
|
|
13
|
-
It
|
|
19
|
+
It follows the specification directly rather than wrapping somebody's implementation of it, so its colour roles, type scale and shapes are the ones the spec names.
|
|
14
20
|
|
|
15
|
-
- **
|
|
21
|
+
- **Themed in one line.** Set `--mp-source-color` and every colour role follows, the way Material generates a scheme from a source colour. No provider, no theme object, no re-render.
|
|
22
|
+
- **It coexists.** Nothing here is page-level — no reset, no provider, no global styling — and it reads the `--md-sys-color-*` tokens your page already has if they are there. A project already running Material keeps its own setup.
|
|
16
23
|
- **IME-safe by construction.** Korean, Japanese and Chinese composition survives whatever your `onChange` does with the value.
|
|
17
24
|
- **Bring your own icons.** `MPIcon` takes a component or an element from any set. `lucide-react` ships with the package, gathered in one readable constants file.
|
|
18
25
|
- **ESM only**, TypeScript declarations included, tree-shakeable — every component compiles to its own module.
|
|
@@ -42,15 +49,12 @@ pnpm add material-plus-ui
|
|
|
42
49
|
|
|
43
50
|
### Peer dependencies
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
| `@mui/material` | 6, 7, 8 or 9 |
|
|
50
|
-
| `@emotion/react`, `@emotion/styled` | 11 |
|
|
51
|
-
| `react`, `react-dom` | 18 or 19 |
|
|
52
|
+
| Package | Versions |
|
|
53
|
+
| -------------------- | -------- |
|
|
54
|
+
| `@base-ui/react` | 1 |
|
|
55
|
+
| `react`, `react-dom` | 18 or 19 |
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
`@base-ui/react` is a peer rather than a dependency because it carries React context: a `Form` of yours has to be able to see a field of ours, and that only works with one copy in the tree.
|
|
54
58
|
|
|
55
59
|
### Setup
|
|
56
60
|
|
|
@@ -60,7 +64,7 @@ Add one line to your app's CSS entry point:
|
|
|
60
64
|
@import 'material-plus-ui/styles.css';
|
|
61
65
|
```
|
|
62
66
|
|
|
63
|
-
This is finished CSS — no PostCSS plugin, no `@source`, no build-side configuration. It deliberately contains **no reset
|
|
67
|
+
This is finished CSS — no PostCSS plugin, no `@source`, no build-side configuration. It deliberately contains **no reset**, and no page-level styling of any kind: a component resets what it owns on the element it owns, so whatever your page already does stays in charge.
|
|
64
68
|
|
|
65
69
|
If Tailwind v4 is already in your project, import the token sheet instead:
|
|
66
70
|
|
|
@@ -71,39 +75,46 @@ If Tailwind v4 is already in your project, import the token sheet instead:
|
|
|
71
75
|
|
|
72
76
|
## Usage
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
There is no provider. Import a component and render it.
|
|
75
79
|
|
|
76
80
|
```tsx
|
|
77
81
|
import { useState } from 'react';
|
|
78
|
-
import CssBaseline from '@mui/material/CssBaseline';
|
|
79
|
-
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|
80
82
|
import { MPTextField, MPIcon, ICONS } from 'material-plus-ui';
|
|
81
83
|
|
|
82
|
-
const theme = createTheme({ palette: { mode: 'light' } });
|
|
83
|
-
|
|
84
84
|
export default function App() {
|
|
85
85
|
const [email, setEmail] = useState('');
|
|
86
86
|
|
|
87
87
|
return (
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
startIcon={<MPIcon icon={ICONS.search} size={18} />}
|
|
96
|
-
/>
|
|
97
|
-
</ThemeProvider>
|
|
88
|
+
<MPTextField
|
|
89
|
+
label="Email"
|
|
90
|
+
type="email"
|
|
91
|
+
value={email}
|
|
92
|
+
onChange={setEmail}
|
|
93
|
+
startIcon={<MPIcon icon={ICONS.search} size={18} />}
|
|
94
|
+
/>
|
|
98
95
|
);
|
|
99
96
|
}
|
|
100
97
|
```
|
|
101
98
|
|
|
99
|
+
## Theming
|
|
100
|
+
|
|
101
|
+
Material generates a whole scheme from one source colour, and so does this.
|
|
102
|
+
|
|
103
|
+
```css
|
|
104
|
+
:root {
|
|
105
|
+
--mp-source-color: #7c3aed;
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Dark mode follows `prefers-color-scheme` on its own; `data-mp-scheme="dark"` or `.dark` on any element drives it yourself. To disagree with one generated colour, set that role — `--mp-sys-color-outline` — and to follow tokens your page already defines, do nothing: `--md-sys-color-*` is read where it is present.
|
|
110
|
+
|
|
111
|
+
Full details, including scoped and runtime theming, are in [the theming guide](https://material-plus.cdget.com/guide/getting-started#theming).
|
|
112
|
+
|
|
102
113
|
## Components
|
|
103
114
|
|
|
104
115
|
| Component | What it is |
|
|
105
116
|
| --- | --- |
|
|
106
|
-
| [`MPTextField`](https://material-plus.cdget.com/components/inputs/text-field) |
|
|
117
|
+
| [`MPTextField`](https://material-plus.cdget.com/components/inputs/text-field) | An outlined text field that survives an IME, with the label, supporting text, adornments and password toggle already assembled. |
|
|
107
118
|
| [`MPIcon`](https://material-plus.cdget.com/components/display/icon) | A glyph at a known size in a known colour, from whichever icon set you use. |
|
|
108
119
|
|
|
109
120
|
### Why `MPTextField` exists
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPSize, MPVariant } from '../../types';
|
|
3
|
+
export interface MPAccordionProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange'> {
|
|
4
|
+
/**
|
|
5
|
+
* Whether more than one section may be open at once.
|
|
6
|
+
*
|
|
7
|
+
* `false` by default, which is the whole reason an accordion is not just a
|
|
8
|
+
* stack of [collapsibles](./collapsible): closing the last one as the next
|
|
9
|
+
* opens is what keeps the page from growing under the reader.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
/** Which sections are open. Use with `onValueChange` for a controlled accordion. */
|
|
14
|
+
value?: (string | number)[];
|
|
15
|
+
/** Which start open, for an uncontrolled one. */
|
|
16
|
+
defaultValue?: (string | number)[];
|
|
17
|
+
onValueChange?: (value: (string | number)[]) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Separates the sections with a hairline rather than with space.
|
|
20
|
+
*
|
|
21
|
+
* On by default, which is the other way round from `MPList`. A list of tiles
|
|
22
|
+
* is a list; an accordion of tiles is a stack of cards that happen to fold,
|
|
23
|
+
* and the rule is what says the sections are parts of one thing.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
dividers?: boolean;
|
|
27
|
+
/** Unavailable. Every section stops answering. */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* How much surface the sheet paints.
|
|
31
|
+
* @default 'outlined'
|
|
32
|
+
*/
|
|
33
|
+
variant?: MPVariant;
|
|
34
|
+
/**
|
|
35
|
+
* The room inside every section, and the type scale of its header and body.
|
|
36
|
+
* @default 'md'
|
|
37
|
+
*/
|
|
38
|
+
size?: MPSize;
|
|
39
|
+
/**
|
|
40
|
+
* Keeps closed panels in the DOM so the browser's own page search can find and
|
|
41
|
+
* open them. Overrides `keepMounted`.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
hiddenUntilFound?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Keeps closed panels in the DOM. For content that is expensive to build, or
|
|
47
|
+
* that holds form state which should survive being folded away.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
keepMounted?: boolean;
|
|
51
|
+
/** The `MPAccordionItem`s. */
|
|
52
|
+
children?: React.ReactNode;
|
|
53
|
+
}
|
|
54
|
+
export interface MPAccordionItemProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'title' | 'onChange'> {
|
|
55
|
+
/**
|
|
56
|
+
* Identifies the section to `value` / `defaultValue`. Base UI generates one
|
|
57
|
+
* when it is left out, which is enough for an accordion nobody drives from
|
|
58
|
+
* code.
|
|
59
|
+
*/
|
|
60
|
+
value?: string | number;
|
|
61
|
+
/** The heading on the fold. */
|
|
62
|
+
title?: React.ReactNode;
|
|
63
|
+
/** A second line under it, one step down the type scale and muted. */
|
|
64
|
+
subtitle?: React.ReactNode;
|
|
65
|
+
/** Content before the title — a glyph, a status dot, a count. */
|
|
66
|
+
startIcon?: React.ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* A control pinned to the end of the header, **outside** the trigger.
|
|
69
|
+
*
|
|
70
|
+
* Deliberately outside it: a header that both folds and holds a switch has two
|
|
71
|
+
* things to press, and a `<button>` inside a `<button>` is markup the browser
|
|
72
|
+
* rewrites on parse. The same shape `MPCollapsible` and `MPListItem` use.
|
|
73
|
+
*/
|
|
74
|
+
action?: React.ReactNode;
|
|
75
|
+
/** Unavailable. This section stops folding; the rest keep working. */
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/** The body. */
|
|
78
|
+
children?: React.ReactNode;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A stack of sections, one of which is open.
|
|
82
|
+
*
|
|
83
|
+
* Base UI owns the parts that are genuinely hard: the `<button>`/`region`
|
|
84
|
+
* pairing and the `aria-controls` / `aria-expanded` wiring between them, the set
|
|
85
|
+
* of open values, and measuring each panel so it has a height to animate from.
|
|
86
|
+
* What is here is the surface, the ladders and Material's state layer.
|
|
87
|
+
*
|
|
88
|
+
* ## Why this is not a stack of collapsibles
|
|
89
|
+
*
|
|
90
|
+
* Because of `multiple`. A [collapsible](./collapsible) has an `open` of its
|
|
91
|
+
* own and answers to nobody; an accordion owns the *set*, and closing the last
|
|
92
|
+
* section as the next one opens is the whole reason the component exists — it is
|
|
93
|
+
* what keeps the page from growing under the reader. Sections that are genuinely
|
|
94
|
+
* unrelated should be collapsibles, and a component that closed one because the
|
|
95
|
+
* other opened would be inventing a relationship the page does not have.
|
|
96
|
+
*
|
|
97
|
+
* ## The surface stays neutral
|
|
98
|
+
*
|
|
99
|
+
* Even on `filled`, which here is `surface-container-highest` — MD3's own filled
|
|
100
|
+
* card — rather than the accent. An accordion is a box holding somebody else's
|
|
101
|
+
* content, and dyeing the box dyes their content's background. That is also why
|
|
102
|
+
* there is no `color`: nothing would read it.
|
|
103
|
+
*/
|
|
104
|
+
export declare const MPAccordion: React.ForwardRefExoticComponent<MPAccordionProps & React.RefAttributes<HTMLDivElement>>;
|
|
105
|
+
/**
|
|
106
|
+
* One section.
|
|
107
|
+
*
|
|
108
|
+
* The header is always a row, and what is inside it is a real `<button>`
|
|
109
|
+
* covering the title and the chevron, with `action` sitting outside that button
|
|
110
|
+
* as a control of its own. The same shape `MPChip` and `MPListItem` use, for the
|
|
111
|
+
* same two reasons: a `<div>` carrying a click handler is invisible to a
|
|
112
|
+
* keyboard, and a `<button>` inside a `<button>` is markup the browser rewrites
|
|
113
|
+
* on parse.
|
|
114
|
+
*/
|
|
115
|
+
export declare const MPAccordionItem: React.ForwardRefExoticComponent<MPAccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{Accordion as i}from"@base-ui/react/accordion";import{MPIcon as a}from"../icon/MPIcon";import{ChevronDownIcon as r}from"../../constants/icons";import{MPStateLayer as o}from"../../internal/StateLayer";import{CONTROL_GAP as s,CONTROL_ICON as l,hasContent as d,META_TEXT as c,PROSE_TEXT as m,SHEET_PAD_X as u,SHEET_PAD_Y as f,SHEET_TITLE as p}from"../../internal/scale";import{CONTAINER_SURFACE as h}from"../../internal/surface";const x=t.createContext({size:"md",dividers:!0}),v=["h-(--accordion-panel-height) overflow-hidden","transition-[height] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none","data-starting-style:h-0 data-ending-style:h-0"].join(" "),b={xs:"pb-2.5",sm:"pb-3",md:"pb-4",lg:"pb-5",xl:"pb-6"};export const MPAccordion=t.forwardRef(function({multiple:n=!1,value:a,defaultValue:r,onValueChange:o,dividers:s=!0,disabled:l=!1,variant:d="outlined",size:c="md",hiddenUntilFound:m=!1,keepMounted:u=!1,className:f,children:p,...v},b){const N=t.useMemo(()=>({size:c,dividers:s}),[c,s]);return e(x.Provider,{value:N,children:e(i.Root,{ref:b,multiple:n,value:a,defaultValue:r,onValueChange:e=>o?.(e),disabled:l,hiddenUntilFound:m,keepMounted:u,"data-mp-size":c,"data-mp-variant":d,className:["mp-accordion rounded-mp-md flex w-full flex-col",h[d],"text-mp-on-surface",s?"overflow-hidden [&>div+div]:border-mp-outline-variant [&>div+div]:border-t":"p-1",f??""].filter(Boolean).join(" "),...v,children:p})})});export const MPAccordionItem=t.forwardRef(function({value:h,title:N,subtitle:g,startIcon:j,action:w,disabled:y=!1,className:z,children:M,...k},P){const{size:C,dividers:I}=t.useContext(x),V=u[C],B=f[C];return n(i.Item,{ref:P,value:h,disabled:y,className:["mp-accordion__item flex flex-col",z??""].filter(Boolean).join(" "),...k,children:[n(i.Header,{className:"m-0 flex w-full items-center font-[inherit]",children:[n(i.Trigger,{className:["group relative flex min-w-0 flex-1 cursor-pointer items-center text-start","appearance-none border-0 bg-transparent font-[inherit] text-inherit",V,B,s[C],I?"":"rounded-mp-sm","outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default"].filter(Boolean).join(" "),children:[e(o,{}),d(j)?e("span",{className:"text-mp-on-surface-variant flex h-[1lh] shrink-0 items-center",children:j}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[d(N)?e("span",{className:`truncate ${p[C]}`,children:N}):null,d(g)?e("span",{className:`text-mp-on-surface-variant truncate ${c}`,children:g}):null]}),e("span",{className:["text-mp-on-surface-variant flex h-[1lh] shrink-0 items-center","transition-[rotate] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none","group-data-panel-open:rotate-180"].join(" "),children:e(a,{icon:r,size:l[C]})})]}),d(w)?e("span",{className:`flex shrink-0 items-center ${V}`,children:w}):null]}),e(i.Panel,{className:v,children:e("div",{className:["min-w-0",m[C],"text-mp-on-surface-variant",V,b[C]].join(" "),children:M})})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAccordion,MPAccordionItem}from"./MPAccordion";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPColor, MPSize, MPVariant } from '../../types';
|
|
3
|
+
export interface MPAlertProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title'> {
|
|
4
|
+
/**
|
|
5
|
+
* How much surface the alert paints.
|
|
6
|
+
*
|
|
7
|
+
* `tonal` rather than `filled`, which is the one place this component's default
|
|
8
|
+
* differs from a button's. A container tone is MD3's own answer for a message
|
|
9
|
+
* set into a page — it separates itself from the surface without competing
|
|
10
|
+
* with the primary action that is usually sitting right beside it, and a page
|
|
11
|
+
* with three saturated alerts on it has no emphasis left to spend.
|
|
12
|
+
* @default 'tonal'
|
|
13
|
+
*/
|
|
14
|
+
variant?: MPVariant;
|
|
15
|
+
/**
|
|
16
|
+
* Which accent family it reads.
|
|
17
|
+
*
|
|
18
|
+
* Four roles, not a severity ladder — there is no `info`, `success` or
|
|
19
|
+
* `warning` here, because [the specification's colour
|
|
20
|
+
* system](../design/color) has no way to derive them and a library that
|
|
21
|
+
* invented three more families would be promising tokens the sheet cannot
|
|
22
|
+
* produce. `error` is the one severity Material does name, and the rest is an
|
|
23
|
+
* emphasis decision: `primary` for a notice, `secondary` or `tertiary` for one
|
|
24
|
+
* that should sit further back.
|
|
25
|
+
* @default 'primary'
|
|
26
|
+
*/
|
|
27
|
+
color?: MPColor;
|
|
28
|
+
/**
|
|
29
|
+
* The room inside, and the type scale of the text in it.
|
|
30
|
+
* @default 'md'
|
|
31
|
+
*/
|
|
32
|
+
size?: MPSize;
|
|
33
|
+
/**
|
|
34
|
+
* The heading line. With it the alert is two-part — a headline and the detail
|
|
35
|
+
* under it; without it the whole thing is one line.
|
|
36
|
+
*/
|
|
37
|
+
title?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* The glyph at the start.
|
|
40
|
+
*
|
|
41
|
+
* Defaults to the one that goes with `color`; pass `false` to drop it, or a
|
|
42
|
+
* node to replace it. Only two defaults exist because only two are honest: the
|
|
43
|
+
* error family gets the error glyph and everything else gets the informational
|
|
44
|
+
* one. An alert that means "this worked" should say so with an `icon` of its
|
|
45
|
+
* own rather than by having the library guess from a colour.
|
|
46
|
+
*/
|
|
47
|
+
icon?: React.ReactNode | false;
|
|
48
|
+
/**
|
|
49
|
+
* Content pinned to the end of the row — a "Retry" button, a link. Kept out of
|
|
50
|
+
* `children` so it stays on the first line while the message wraps.
|
|
51
|
+
*/
|
|
52
|
+
action?: React.ReactNode;
|
|
53
|
+
/** Passing it is what makes the dismiss button appear. */
|
|
54
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
55
|
+
/**
|
|
56
|
+
* The accessible name of the dismiss button. Defaults to the word for
|
|
57
|
+
* "dismiss" in `locale`.
|
|
58
|
+
*/
|
|
59
|
+
closeLabel?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Which language the dismiss button's default name is written in. Falls back
|
|
62
|
+
* to the nearest `MPLocaleProvider`, then to English.
|
|
63
|
+
*/
|
|
64
|
+
locale?: string;
|
|
65
|
+
/** The message. */
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A message about something that happened, set into the page it is about.
|
|
70
|
+
*
|
|
71
|
+
* The three shapes people mean by "an alert" are one component with different
|
|
72
|
+
* slots filled rather than three components: a bare line (`<MPAlert icon={false}>`),
|
|
73
|
+
* a line with a glyph (the default), and a glyph with a headline and the detail
|
|
74
|
+
* under it (`title` plus `children`). Nothing about the surface changes between
|
|
75
|
+
* them — only how much of it is used.
|
|
76
|
+
*
|
|
77
|
+
* There is no Base UI primitive under this, and there should not be: an alert has
|
|
78
|
+
* no interaction to delegate. It is a live region with a layout, and the only
|
|
79
|
+
* interactive parts it can grow — the action and the dismiss button — are real
|
|
80
|
+
* buttons that the caller either passes in or gets by passing `onClose`.
|
|
81
|
+
*
|
|
82
|
+
* ## Why this is not a snackbar
|
|
83
|
+
*
|
|
84
|
+
* An alert belongs to the flow of the page it interrupts; a snackbar floats over
|
|
85
|
+
* it and leaves on a timer. That is not a styling difference: a message the
|
|
86
|
+
* reader has to act on must not be able to disappear before it has been read,
|
|
87
|
+
* and a message about the page's *current* state has to still be there when they
|
|
88
|
+
* look back at it. If it can be missed without consequence, it is
|
|
89
|
+
* [MPSnackbar](../feedback/snackbar).
|
|
90
|
+
*/
|
|
91
|
+
export declare const MPAlert: React.ForwardRefExoticComponent<MPAlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{MPIcon as r}from"../icon/MPIcon";import{CloseIcon as a,ErrorIcon as l,InfoIcon as o}from"../../constants/icons";import{accentSlots as i}from"../../internal/accent";import{useMPLocale as s,useMPMessages as c}from"../../internal/locale";import{MPStateLayer as m}from"../../internal/StateLayer";import{CONTROL_ICON as d,hasContent as f,PROSE_TEXT as p,SHEET_GAP as u,SHEET_PAD as x,SHEET_TITLE as h,STACK_GAP as v}from"../../internal/scale";const b={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-mp-surface-container-low text-mp-on-surface",outlined:"border-mp-outline border bg-transparent text-mp-on-surface",text:"bg-transparent text-mp-on-surface"},y={filled:"",tonal:"",elevated:"text-(--_mp-accent)",outlined:"text-(--_mp-accent)",text:"text-(--_mp-accent)"},N={filled:"",tonal:"",elevated:"text-mp-on-surface-variant",outlined:"text-mp-on-surface-variant",text:"text-mp-on-surface-variant"},j={primary:"status",secondary:"status",tertiary:"status",error:"alert"};export const MPAlert=n.forwardRef(function({variant:n="tonal",color:g="primary",size:_="md",title:w,icon:z,action:k,onClose:B,closeLabel:C,locale:L,className:M,style:P,children:A,...I},R){const S=s(L),$=c("alert",S),q=y[n],D=f(w),E=void 0===z?e(r,{icon:"error"===g?l:o,size:d[_]}):z;return t("div",{ref:R,role:j[g],"data-mp-size":_,"data-mp-variant":n,className:["mp-alert rounded-mp-md flex w-full items-start","box-border",x[_],u[_],p[_],b[n],M??""].filter(Boolean).join(" "),style:{...i(g),...P},...I,children:[f(E)?e("span",{className:["flex h-[1lh] shrink-0 items-center",q].filter(Boolean).join(" "),children:E}):null,t("div",{className:`flex min-w-0 flex-1 flex-col ${v[_]}`,children:[D?e("div",{className:[h[_],q].filter(Boolean).join(" "),children:w}):null,f(A)?e("div",{className:D?N[n]:void 0,children:A}):null]}),f(k)?e("div",{className:"flex h-[1lh] shrink-0 items-center",children:k}):null,B?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:t("button",{type:"button","aria-label":C??$.dismiss,onClick:B,className:["group rounded-mp-full relative -m-1 flex size-8 cursor-pointer items-center","justify-center bg-transparent text-inherit","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[e(m,{}),e(r,{icon:a,size:d[_]})]})}):null]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPAlert}from"./MPAlert";
|
|
@@ -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";
|