@bug-on/m3-expressive 1.2.4 → 1.2.6
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/CHANGELOG.md +15 -0
- package/README.md +128 -41
- package/dist/buttons.d.mts +1 -1
- package/dist/buttons.d.ts +1 -1
- package/dist/buttons.js +59 -45
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +59 -45
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +54 -40
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +54 -40
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +53 -39
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +53 -39
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +2 -2
- package/dist/forms.d.ts +2 -2
- package/dist/index.d.mts +77 -6
- package/dist/index.d.ts +77 -6
- package/dist/index.js +5607 -5429
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5506 -5329
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +60 -46
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +60 -46
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.d.mts +27 -7
- package/dist/navigation.d.ts +27 -7
- package/dist/navigation.js +481 -474
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +473 -466
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +53 -39
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +53 -39
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +53 -39
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +53 -39
- package/dist/pickers.mjs.map +1 -1
- package/dist/{side-sheet-modal-Bd5Qqvp9.d.ts → side-sheet-modal-DdEZR6Vl.d.ts} +1 -1
- package/dist/{side-sheet-modal-64FGhDxL.d.mts → side-sheet-modal-Dgjt739k.d.mts} +1 -1
- package/dist/{split-button-trailing-uncheckable-DtxrcLxH.d.ts → split-button-trailing-uncheckable--BhNTEJw.d.ts} +5 -5
- package/dist/{split-button-trailing-uncheckable-BTWfIN2k.d.mts → split-button-trailing-uncheckable-DPJL3bO6.d.mts} +5 -5
- package/dist/{text-field-T4Rg-9Bw.d.mts → text-field-DWC7qOvp.d.mts} +128 -128
- package/dist/{text-field-T4Rg-9Bw.d.ts → text-field-DWC7qOvp.d.ts} +128 -128
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @bug-on/m3-expressive
|
|
2
2
|
|
|
3
|
+
## 1.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 564003a: Improve Progress Indicator component
|
|
8
|
+
|
|
9
|
+
## 1.2.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 97fb801: Add Select component Expose Menus, fix UI menu, readme
|
|
14
|
+
- Updated dependencies [97fb801]
|
|
15
|
+
- @bug-on/m3-tailwind@1.2.1
|
|
16
|
+
- @bug-on/m3-tokens@1.2.1
|
|
17
|
+
|
|
3
18
|
## 1.2.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,73 +1,78 @@
|
|
|
1
1
|
# @bug-on/m3-expressive
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@bug-on/m3-expressive)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://tailwindcss.com/)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
A high-performance, accessible React component library built strictly following the [Material Design 3 Expressive](https://m3.material.io/) design system specifications. Features fluid spring motion, flexible shape morphing, dynamic Material You color generation, SSR support, and native compatibility with Next.js 16 (App Router) and Tailwind CSS v4.
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
9
|
-
## 📖 Documentation & Demos
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
## 📖 Documentation & Interactive Demos
|
|
12
|
+
|
|
13
|
+
For detailed API references, interactive component playgrounds, and customization guides, visit:
|
|
14
|
+
👉 **[Official Documentation & Live Demos](https://bug-on-md3.vercel.app)**
|
|
15
|
+
👉 **[GitHub Repository](https://github.com/nguyentruongton/bug-on-md3-expressive)**
|
|
12
16
|
|
|
13
17
|
---
|
|
14
18
|
|
|
15
19
|
## 📦 Installation
|
|
16
20
|
|
|
17
|
-
Install the React component package alongside core ecosystem packages:
|
|
18
|
-
|
|
19
21
|
```bash
|
|
20
|
-
|
|
22
|
+
pnpm add @bug-on/m3-expressive motion
|
|
21
23
|
# or
|
|
22
|
-
|
|
24
|
+
npm install @bug-on/m3-expressive motion
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
###
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
### Peer Dependencies
|
|
28
|
+
|
|
29
|
+
Ensure your project includes the following peer dependencies:
|
|
30
|
+
|
|
31
|
+
| Package | Version Requirement | Description |
|
|
32
|
+
| :--- | :--- | :--- |
|
|
33
|
+
| `react` | `>=18.0.0 || ^19.0.0` | Core React framework |
|
|
34
|
+
| `react-dom` | `>=18.0.0 || ^19.0.0` | DOM renderer for React |
|
|
35
|
+
| `motion` | `>=11.0.0` | Animation engine (FAB, Tabs, Dialogs, Sheets, etc.) |
|
|
36
|
+
| `tailwindcss` | `>=4.0.0` | Utility CSS framework (CSS-first architecture) |
|
|
32
37
|
|
|
33
38
|
---
|
|
34
39
|
|
|
35
40
|
## 🛠️ Configuration & Setup (Tailwind CSS v4)
|
|
36
41
|
|
|
37
42
|
> [!WARNING]
|
|
38
|
-
>
|
|
43
|
+
> This library requires **Tailwind CSS v4** (CSS-first configuration). Tailwind CSS v3 is not supported.
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
Import the required stylesheets into your application's main CSS entry point (e.g. `globals.css` or `app/globals.css`):
|
|
41
46
|
|
|
42
47
|
```css
|
|
43
|
-
/* 1.
|
|
48
|
+
/* 1. Core Tailwind CSS v4 */
|
|
44
49
|
@import "tailwindcss";
|
|
45
50
|
|
|
46
|
-
/* 2.
|
|
51
|
+
/* 2. MD3 Expressive Tokens & Theme Resets */
|
|
47
52
|
@import "@bug-on/m3-expressive/index.css";
|
|
48
53
|
|
|
49
|
-
/* 3. (Optional)
|
|
54
|
+
/* 3. (Optional) Extended MD3 Tailwind Utilities (Elevations, Transitions) */
|
|
50
55
|
@import "@bug-on/m3-tailwind";
|
|
51
56
|
|
|
52
|
-
/* 4. (Optional)
|
|
57
|
+
/* 4. (Optional) Expressive Typography Preset Classes */
|
|
53
58
|
@import "@bug-on/m3-expressive/typography.css";
|
|
54
59
|
```
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
### Icon Font Setup (Material Symbols Outlined)
|
|
62
|
+
|
|
63
|
+
The `<Icon />` component uses **Material Symbols Outlined**. You can choose CDN font delivery or self-hosted assets:
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
The library includes a built-in `<Icon />` component using the `Material Symbols Outlined` font. Import the icon stylesheet at your application root (e.g., `layout.tsx` or `main.tsx`):
|
|
65
|
+
#### Option A: Google Fonts CDN (Recommended for Web)
|
|
60
66
|
|
|
61
67
|
```tsx
|
|
62
68
|
// app/layout.tsx or src/main.tsx
|
|
63
|
-
import
|
|
64
|
-
import { MaterialSymbolsPreconnect } from
|
|
69
|
+
import "@bug-on/m3-expressive/material-symbols-cdn.css";
|
|
70
|
+
import { MaterialSymbolsPreconnect } from "@bug-on/m3-expressive";
|
|
65
71
|
|
|
66
|
-
export default function RootLayout({ children }) {
|
|
72
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
67
73
|
return (
|
|
68
|
-
<html>
|
|
74
|
+
<html lang="en">
|
|
69
75
|
<head>
|
|
70
|
-
{/* Preconnect helper to accelerate font loading */}
|
|
71
76
|
<MaterialSymbolsPreconnect />
|
|
72
77
|
</head>
|
|
73
78
|
<body>{children}</body>
|
|
@@ -76,7 +81,9 @@ export default function RootLayout({ children }) {
|
|
|
76
81
|
}
|
|
77
82
|
```
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
#### Option B: Offline / Self-Hosted Assets
|
|
85
|
+
|
|
86
|
+
For air-gapped environments or offline font delivery, install `@bug-on/m3-fonts`:
|
|
80
87
|
|
|
81
88
|
```bash
|
|
82
89
|
pnpm add @bug-on/m3-fonts
|
|
@@ -87,26 +94,106 @@ pnpm add @bug-on/m3-fonts
|
|
|
87
94
|
@import "@bug-on/m3-fonts/typography.css";
|
|
88
95
|
```
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 🧩 Subpath Exports Guide
|
|
100
|
+
|
|
101
|
+
To keep bundle sizes lean, `@bug-on/m3-expressive` offers dedicated subpath entrypoints:
|
|
102
|
+
|
|
103
|
+
| Subpath Import | Module Contents |
|
|
104
|
+
| :--- | :--- |
|
|
105
|
+
| `@bug-on/m3-expressive/core` | `MD3ThemeProvider`, `createMd3ExpressiveTheme`, `generateM3Theme`, `applyTheme` |
|
|
106
|
+
| `@bug-on/m3-expressive/buttons` | `Button`, `IconButton`, `FAB`, `ExtendedFAB`, `FABMenu`, `SplitButton`, `ButtonGroup`, `ButtonDistribute` |
|
|
107
|
+
| `@bug-on/m3-expressive/forms` | `TextField`, `Checkbox`, `RadioButton`, `Switch`, `Slider`, `RangeSlider`, `Select`, `Search` |
|
|
108
|
+
| `@bug-on/m3-expressive/navigation` | `NavigationBar`, `NavigationRail`, `NavigationDrawer`, `Tabs`, `Tab`, `TabsList`, `TabsContent`, `App Bar`, `Toolbar` |
|
|
109
|
+
| `@bug-on/m3-expressive/overlays` | `Dialog`, `SideSheet`, `BottomSheet`, `Tooltip` |
|
|
110
|
+
| `@bug-on/m3-expressive/feedback` | `Snackbar`, `SnackbarProvider`, `useSnackbar`, `ProgressIndicator`, `LoadingIndicator`, `Badge`, `BadgedBox` |
|
|
111
|
+
| `@bug-on/m3-expressive/layout` | `Card`, `Divider`, `List`, `ListItem`, `ListDivider`, `ScrollArea`, `CodeBlock`, `TableOfContents` |
|
|
112
|
+
| `@bug-on/m3-expressive/pickers` | `DatePicker`, `TimePicker` |
|
|
113
|
+
| `@bug-on/m3-expressive/shapes` | `ShapeMedia`, `ShapeEngine`, `MD3Shape` utilities |
|
|
91
114
|
|
|
92
115
|
---
|
|
93
116
|
|
|
94
|
-
## 🚀
|
|
117
|
+
## 🚀 Quick Code Example
|
|
95
118
|
|
|
96
119
|
```tsx
|
|
97
|
-
import {
|
|
120
|
+
import { MD3ThemeProvider } from "@bug-on/m3-expressive/core";
|
|
121
|
+
import { Button } from "@bug-on/m3-expressive/buttons";
|
|
122
|
+
import { TextField } from "@bug-on/m3-expressive/forms";
|
|
123
|
+
import { Icon } from "@bug-on/m3-expressive";
|
|
98
124
|
|
|
99
|
-
export default function
|
|
125
|
+
export default function LoginCard() {
|
|
100
126
|
return (
|
|
101
|
-
<
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
<MD3ThemeProvider sourceColor="#00639b" defaultMode="system">
|
|
128
|
+
<div className="p-6 bg-m3-surface text-m3-on-surface rounded-m3-extra-large shadow-m3-elevation-2 max-w-sm space-y-4">
|
|
129
|
+
<h2 className="text-m3-title-large font-bold">Welcome Back</h2>
|
|
130
|
+
|
|
131
|
+
<TextField
|
|
132
|
+
label="Email Address"
|
|
133
|
+
variant="outlined"
|
|
134
|
+
leadingIcon={<Icon name="mail" />}
|
|
135
|
+
/>
|
|
136
|
+
|
|
137
|
+
<Button
|
|
138
|
+
colorStyle="filled"
|
|
139
|
+
size="md"
|
|
140
|
+
icon={<Icon name="arrow_forward" />}
|
|
141
|
+
>
|
|
142
|
+
Sign In
|
|
143
|
+
</Button>
|
|
144
|
+
</div>
|
|
145
|
+
</MD3ThemeProvider>
|
|
106
146
|
);
|
|
107
147
|
}
|
|
108
148
|
```
|
|
109
149
|
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🎨 Component Inventory
|
|
153
|
+
|
|
154
|
+
### 🔘 Buttons & Actions
|
|
155
|
+
- **`Button`**: Filled, Elevated, Tonal, Outlined, Text variants.
|
|
156
|
+
- **`IconButton`**: Standard, Filled, Tonal, Outlined, with toggle state support.
|
|
157
|
+
- **`FAB` / `ExtendedFAB`**: Small, Medium, Large, Extended with label & animated icons.
|
|
158
|
+
- **`FABMenu`**: Speed-dial style Floating Action Button expandable menu.
|
|
159
|
+
- **`SplitButton`**: Combined primary button action with dropdown trigger.
|
|
160
|
+
- **`ButtonGroup` / `ButtonDistribute`**: Grouped segmented buttons with shared shape states.
|
|
161
|
+
|
|
162
|
+
### 📝 Forms & Inputs
|
|
163
|
+
- **`TextField`**: Outlined and Filled variants with leading/trailing icons, error state, and helper text.
|
|
164
|
+
- **`Checkbox`**: Standard and TriState indeterminate checkbox with animated checkmark.
|
|
165
|
+
- **`RadioButton`**: Standard Material Design 3 single select options.
|
|
166
|
+
- **`Switch`**: Toggle switch with optional inline icons.
|
|
167
|
+
- **`Slider` / `RangeSlider`**: Continuous and discrete sliders with value tooltips and step indicators.
|
|
168
|
+
- **`Select` / `Menu`**: Expressive dropdown select and popover menus.
|
|
169
|
+
- **`Search`**: Search bar and full-screen Search View overlays.
|
|
170
|
+
|
|
171
|
+
### 🧭 Navigation & Toolbars
|
|
172
|
+
- **`NavigationBar`**: Bottom navigation bar with animated active indicators.
|
|
173
|
+
- **`NavigationRail`**: Vertical navigation bar for wide displays and desktop screens.
|
|
174
|
+
- **`NavigationDrawer`**: Standard docked and modal drawer components.
|
|
175
|
+
- **`Tabs` / `Tab` / `TabsList` / `TabsContent`**: Primary and Secondary tabs with sliding indicator.
|
|
176
|
+
- **`SmallAppBar` / `MediumFlexibleAppBar` / `LargeFlexibleAppBar` / `BottomAppBar`**: Collapsible & flexible app bars.
|
|
177
|
+
- **`DockedToolbar`**: Expressive floating/docked action toolbar.
|
|
178
|
+
|
|
179
|
+
### 🖼️ Overlays & Feedback
|
|
180
|
+
- **`Dialog`**: Expressive alert and full-screen dialogs powered by Framer Motion.
|
|
181
|
+
- **`SideSheet` / `BottomSheet`**: Modal and non-modal contextual sheets.
|
|
182
|
+
- **`Tooltip`**: Plain and Rich tooltips with carets and call-to-action buttons.
|
|
183
|
+
- **`Snackbar` / `SnackbarProvider` / `useSnackbar`**: Toast notification queue system.
|
|
184
|
+
- **`ProgressIndicator`**: Circular and Linear progress bars (determinate, indeterminate, wavy).
|
|
185
|
+
- **`LoadingIndicator`**: Expressive loading animation.
|
|
186
|
+
- **`Badge` / `BadgedBox`**: Dot and numerical status badges.
|
|
187
|
+
|
|
188
|
+
### 📐 Layout, Surfaces & Shapes
|
|
189
|
+
- **`Card`**: Elevated, Filled, Outlined card surfaces.
|
|
190
|
+
- **`Divider`**: Full-bleed and inset divider lines.
|
|
191
|
+
- **`List` / `ListItem` / `ListDivider`**: Single and multi-line list items with avatar/icon slots.
|
|
192
|
+
- **`ScrollArea`**: Styled scrollable container.
|
|
193
|
+
- **`ShapeMedia`**: Morphing media frame supporting MD3 expressive shapes (Full, Extra Large, Large, Medium, Small).
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
110
197
|
## ⚖️ License
|
|
111
|
-
MIT
|
|
112
198
|
|
|
199
|
+
[MIT](./LICENSE)
|
package/dist/buttons.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BUTTON_COLOR_TOKENS, a as BUTTON_SIZE_TOKENS, b as BaseButtonProps, c as Button, d as ButtonDistribute, e as ButtonDistributeProps, f as ButtonGroup, g as ButtonGroupOrientation, h as ButtonGroupProps, i as ButtonGroupVariant, j as ButtonProps, D as DistributeMode, E as ElevatedSplitButtonLeading, k as ElevatedSplitButtonTrailing, l as ElevatedSplitButtonTrailingUncheckable, m as ExtendedFAB, n as ExtendedFABProps, F as FAB, o as FABMenu, p as FABMenuItem, q as FABMenuItemData, r as FABMenuItemProps, s as FABMenuProps, t as FABPosition, u as FABPositionProps, v as FABProps, w as FilledSplitButtonLeading, x as FilledSplitButtonTrailing, y as FilledSplitButtonTrailingUncheckable, O as OutlinedSplitButtonLeading, z as OutlinedSplitButtonTrailing, A as OutlinedSplitButtonTrailingUncheckable, S as SplitButtonLayout, C as SplitButtonLayoutProps, G as SplitButtonLeading, H as SplitButtonLeadingProps, I as SplitButtonSize, V as SplitButtonSizeTokens, J as SplitButtonTrailing, K as SplitButtonTrailingProps, L as SplitButtonTrailingUncheckable, M as SplitButtonTrailingUncheckableProps, N as SplitButtonVariant, T as ToggleFAB, P as ToggleFABProps, Q as TonalSplitButtonLeading, R as TonalSplitButtonTrailing, U as TonalSplitButtonTrailingUncheckable } from './split-button-trailing-uncheckable-
|
|
1
|
+
export { B as BUTTON_COLOR_TOKENS, a as BUTTON_SIZE_TOKENS, b as BaseButtonProps, c as Button, d as ButtonDistribute, e as ButtonDistributeProps, f as ButtonGroup, g as ButtonGroupOrientation, h as ButtonGroupProps, i as ButtonGroupVariant, j as ButtonProps, D as DistributeMode, E as ElevatedSplitButtonLeading, k as ElevatedSplitButtonTrailing, l as ElevatedSplitButtonTrailingUncheckable, m as ExtendedFAB, n as ExtendedFABProps, F as FAB, o as FABMenu, p as FABMenuItem, q as FABMenuItemData, r as FABMenuItemProps, s as FABMenuProps, t as FABPosition, u as FABPositionProps, v as FABProps, w as FilledSplitButtonLeading, x as FilledSplitButtonTrailing, y as FilledSplitButtonTrailingUncheckable, O as OutlinedSplitButtonLeading, z as OutlinedSplitButtonTrailing, A as OutlinedSplitButtonTrailingUncheckable, S as SplitButtonLayout, C as SplitButtonLayoutProps, G as SplitButtonLeading, H as SplitButtonLeadingProps, I as SplitButtonSize, V as SplitButtonSizeTokens, J as SplitButtonTrailing, K as SplitButtonTrailingProps, L as SplitButtonTrailingUncheckable, M as SplitButtonTrailingUncheckableProps, N as SplitButtonVariant, T as ToggleFAB, P as ToggleFABProps, Q as TonalSplitButtonLeading, R as TonalSplitButtonTrailing, U as TonalSplitButtonTrailingUncheckable } from './split-button-trailing-uncheckable-DPJL3bO6.mjs';
|
|
2
2
|
import { Transition } from 'motion/react';
|
|
3
3
|
import { b as MD3Size } from './md3-Dty-Qcad.mjs';
|
|
4
4
|
export { B as BaseIconButtonProps, I as IconButton, a as IconButtonProps } from './icon-button-CSsDmuQC.mjs';
|
package/dist/buttons.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BUTTON_COLOR_TOKENS, a as BUTTON_SIZE_TOKENS, b as BaseButtonProps, c as Button, d as ButtonDistribute, e as ButtonDistributeProps, f as ButtonGroup, g as ButtonGroupOrientation, h as ButtonGroupProps, i as ButtonGroupVariant, j as ButtonProps, D as DistributeMode, E as ElevatedSplitButtonLeading, k as ElevatedSplitButtonTrailing, l as ElevatedSplitButtonTrailingUncheckable, m as ExtendedFAB, n as ExtendedFABProps, F as FAB, o as FABMenu, p as FABMenuItem, q as FABMenuItemData, r as FABMenuItemProps, s as FABMenuProps, t as FABPosition, u as FABPositionProps, v as FABProps, w as FilledSplitButtonLeading, x as FilledSplitButtonTrailing, y as FilledSplitButtonTrailingUncheckable, O as OutlinedSplitButtonLeading, z as OutlinedSplitButtonTrailing, A as OutlinedSplitButtonTrailingUncheckable, S as SplitButtonLayout, C as SplitButtonLayoutProps, G as SplitButtonLeading, H as SplitButtonLeadingProps, I as SplitButtonSize, V as SplitButtonSizeTokens, J as SplitButtonTrailing, K as SplitButtonTrailingProps, L as SplitButtonTrailingUncheckable, M as SplitButtonTrailingUncheckableProps, N as SplitButtonVariant, T as ToggleFAB, P as ToggleFABProps, Q as TonalSplitButtonLeading, R as TonalSplitButtonTrailing, U as TonalSplitButtonTrailingUncheckable } from './split-button-trailing-uncheckable
|
|
1
|
+
export { B as BUTTON_COLOR_TOKENS, a as BUTTON_SIZE_TOKENS, b as BaseButtonProps, c as Button, d as ButtonDistribute, e as ButtonDistributeProps, f as ButtonGroup, g as ButtonGroupOrientation, h as ButtonGroupProps, i as ButtonGroupVariant, j as ButtonProps, D as DistributeMode, E as ElevatedSplitButtonLeading, k as ElevatedSplitButtonTrailing, l as ElevatedSplitButtonTrailingUncheckable, m as ExtendedFAB, n as ExtendedFABProps, F as FAB, o as FABMenu, p as FABMenuItem, q as FABMenuItemData, r as FABMenuItemProps, s as FABMenuProps, t as FABPosition, u as FABPositionProps, v as FABProps, w as FilledSplitButtonLeading, x as FilledSplitButtonTrailing, y as FilledSplitButtonTrailingUncheckable, O as OutlinedSplitButtonLeading, z as OutlinedSplitButtonTrailing, A as OutlinedSplitButtonTrailingUncheckable, S as SplitButtonLayout, C as SplitButtonLayoutProps, G as SplitButtonLeading, H as SplitButtonLeadingProps, I as SplitButtonSize, V as SplitButtonSizeTokens, J as SplitButtonTrailing, K as SplitButtonTrailingProps, L as SplitButtonTrailingUncheckable, M as SplitButtonTrailingUncheckableProps, N as SplitButtonVariant, T as ToggleFAB, P as ToggleFABProps, Q as TonalSplitButtonLeading, R as TonalSplitButtonTrailing, U as TonalSplitButtonTrailingUncheckable } from './split-button-trailing-uncheckable--BhNTEJw.js';
|
|
2
2
|
import { Transition } from 'motion/react';
|
|
3
3
|
import { b as MD3Size } from './md3-Dty-Qcad.js';
|
|
4
4
|
export { B as BaseIconButtonProps, I as IconButton, a as IconButtonProps } from './icon-button-CSsDmuQC.js';
|
package/dist/buttons.js
CHANGED
|
@@ -278,24 +278,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
278
278
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
279
279
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
280
280
|
}
|
|
281
|
-
d += " Z";
|
|
282
281
|
return d;
|
|
283
282
|
}
|
|
284
283
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
285
284
|
if (startX >= endX) return "";
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
285
|
+
if (amp <= 0.01) {
|
|
286
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
287
|
+
}
|
|
288
|
+
const safeWl = Math.max(1, wl);
|
|
289
|
+
const k = 2 * Math.PI / safeWl;
|
|
290
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
291
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
292
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
293
|
+
const step = safeWl / 4;
|
|
294
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
295
|
+
let currentX = startX;
|
|
296
|
+
while (currentX < endX) {
|
|
297
|
+
const nextX = Math.min(endX, currentX + step);
|
|
298
|
+
const dx = nextX - currentX;
|
|
299
|
+
const scale = dx / 3;
|
|
300
|
+
const y0 = yAt(currentX);
|
|
301
|
+
const dy0 = dyAt(currentX);
|
|
302
|
+
const y1 = yAt(nextX);
|
|
303
|
+
const dy1 = dyAt(nextX);
|
|
304
|
+
const cp1x = currentX + scale;
|
|
305
|
+
const cp1y = y0 + scale * dy0;
|
|
306
|
+
const cp2x = nextX - scale;
|
|
307
|
+
const cp2y = y1 - scale * dy1;
|
|
308
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
309
|
+
currentX = nextX;
|
|
296
310
|
}
|
|
297
|
-
const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
|
|
298
|
-
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
299
311
|
return d;
|
|
300
312
|
}
|
|
301
313
|
var CircularProgress = React16__namespace.forwardRef(
|
|
@@ -450,16 +462,13 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
450
462
|
position: "absolute",
|
|
451
463
|
inset: 0,
|
|
452
464
|
overflow: "visible",
|
|
453
|
-
rotate: "-90deg",
|
|
454
465
|
transformOrigin: "center"
|
|
455
466
|
},
|
|
456
|
-
animate: { rotate: [
|
|
467
|
+
animate: { rotate: [0, 360] },
|
|
457
468
|
transition: {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
ease: "linear"
|
|
462
|
-
}
|
|
469
|
+
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
470
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
471
|
+
ease: "linear"
|
|
463
472
|
},
|
|
464
473
|
children: [
|
|
465
474
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -472,17 +481,16 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
472
481
|
stroke: bgTrackColor,
|
|
473
482
|
strokeWidth: trackHeight,
|
|
474
483
|
strokeLinecap: "round",
|
|
475
|
-
style: { originX: "50%", originY: "50%" },
|
|
476
484
|
animate: {
|
|
477
485
|
pathLength: [
|
|
478
|
-
Math.max(1e-3,
|
|
479
|
-
Math.max(1e-3,
|
|
480
|
-
Math.max(1e-3,
|
|
486
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
487
|
+
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
488
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
481
489
|
],
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
490
|
+
pathOffset: [
|
|
491
|
+
0.1 + gapForTrack,
|
|
492
|
+
0.75 + gapForTrack,
|
|
493
|
+
0.1 + gapForTrack
|
|
486
494
|
]
|
|
487
495
|
},
|
|
488
496
|
transition: {
|
|
@@ -500,10 +508,9 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
500
508
|
stroke: activeColor,
|
|
501
509
|
strokeWidth: trackHeight,
|
|
502
510
|
strokeLinecap: "round",
|
|
503
|
-
style: { originX: "50%", originY: "50%" },
|
|
504
511
|
animate: {
|
|
505
512
|
pathLength: [0.1, 0.75, 0.1],
|
|
506
|
-
|
|
513
|
+
pathOffset: [0, 0.65, 1]
|
|
507
514
|
},
|
|
508
515
|
transition: {
|
|
509
516
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -521,10 +528,9 @@ var CircularProgress = React16__namespace.forwardRef(
|
|
|
521
528
|
stroke: activeColor,
|
|
522
529
|
strokeWidth: trackHeight,
|
|
523
530
|
strokeLinecap: "round",
|
|
524
|
-
style: { originX: "50%", originY: "50%" },
|
|
525
531
|
animate: {
|
|
526
532
|
pathLength: [0.1, 0.75, 0.1],
|
|
527
|
-
|
|
533
|
+
pathOffset: [0, 0.65, 1]
|
|
528
534
|
},
|
|
529
535
|
transition: {
|
|
530
536
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -697,6 +703,12 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
697
703
|
duration: 0.5
|
|
698
704
|
});
|
|
699
705
|
react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
706
|
+
} else {
|
|
707
|
+
react.animate(amplitudeMV, amplitude, {
|
|
708
|
+
type: "spring",
|
|
709
|
+
bounce: 0,
|
|
710
|
+
duration: 0.5
|
|
711
|
+
});
|
|
700
712
|
}
|
|
701
713
|
}, [
|
|
702
714
|
clampedValue,
|
|
@@ -710,10 +722,10 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
710
722
|
1,
|
|
711
723
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
712
724
|
);
|
|
713
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
714
725
|
react.useAnimationFrame((time) => {
|
|
715
726
|
if (width === 0) return;
|
|
716
727
|
const currentAmp = amplitudeMV.get();
|
|
728
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
717
729
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
718
730
|
const capWidth = trackHeight / 2;
|
|
719
731
|
let activePathD = "";
|
|
@@ -814,7 +826,7 @@ var WavyLinearTrack = React16__namespace.memo(function WavyLinearTrack2({
|
|
|
814
826
|
"div",
|
|
815
827
|
{
|
|
816
828
|
ref: containerRef,
|
|
817
|
-
className: "relative w-full
|
|
829
|
+
className: "relative w-full",
|
|
818
830
|
style: { height: svgHeight },
|
|
819
831
|
children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
820
832
|
"svg",
|
|
@@ -868,7 +880,7 @@ var LinearProgress = React16__namespace.forwardRef(
|
|
|
868
880
|
waveSpeed = 1,
|
|
869
881
|
crawlerSpeed = 1,
|
|
870
882
|
determinateAnimation = "md3",
|
|
871
|
-
indeterminateAnimation = "
|
|
883
|
+
indeterminateAnimation = "md3",
|
|
872
884
|
gapSize = 4,
|
|
873
885
|
showStopIndicator = "auto",
|
|
874
886
|
color,
|
|
@@ -905,15 +917,15 @@ var LinearProgress = React16__namespace.forwardRef(
|
|
|
905
917
|
setIsRtl(dir === "rtl");
|
|
906
918
|
}
|
|
907
919
|
}, []);
|
|
908
|
-
const isWavy = shape === "wavy";
|
|
909
920
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
921
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
910
922
|
const effectiveAmplitude = React16__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
911
923
|
const svgHeight = React16__namespace.useMemo(
|
|
912
924
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
913
925
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
914
926
|
);
|
|
915
927
|
const shouldShowStop = React16__namespace.useMemo(
|
|
916
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
928
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
917
929
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
918
930
|
);
|
|
919
931
|
const stopSize = React16__namespace.useMemo(
|
|
@@ -923,6 +935,8 @@ var LinearProgress = React16__namespace.forwardRef(
|
|
|
923
935
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
924
936
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
925
937
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
938
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
939
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
926
940
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
927
941
|
"div",
|
|
928
942
|
__spreadProps(__spreadValues({
|
|
@@ -939,12 +953,12 @@ var LinearProgress = React16__namespace.forwardRef(
|
|
|
939
953
|
style: { height: svgHeight }
|
|
940
954
|
}, restProps), {
|
|
941
955
|
children: [
|
|
942
|
-
|
|
956
|
+
useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
943
957
|
WavyLinearTrack,
|
|
944
958
|
{
|
|
945
959
|
trackHeight,
|
|
946
960
|
svgHeight,
|
|
947
|
-
amplitude:
|
|
961
|
+
amplitude: trackAmp,
|
|
948
962
|
wavelength,
|
|
949
963
|
indeterminateWavelength,
|
|
950
964
|
activeColor,
|
|
@@ -1100,6 +1114,7 @@ function TouchTarget() {
|
|
|
1100
1114
|
}
|
|
1101
1115
|
var BUTTON_SHAPE_MORPH_SPRING = FAST_SPATIAL_SPRING;
|
|
1102
1116
|
var BUTTON_RADIUS_SPRING = FAST_EFFECTS_SPRING;
|
|
1117
|
+
var ROUND_SHAPE_RADIUS = 9999;
|
|
1103
1118
|
var BUTTON_SIZE_TOKENS = {
|
|
1104
1119
|
xs: {
|
|
1105
1120
|
height: "2rem",
|
|
@@ -1118,7 +1133,7 @@ var BUTTON_SIZE_TOKENS = {
|
|
|
1118
1133
|
// 12dp
|
|
1119
1134
|
pressedShapeRadius: m3Tokens.cornerRadius.small,
|
|
1120
1135
|
// 8dp
|
|
1121
|
-
roundShapeRadius:
|
|
1136
|
+
roundShapeRadius: ROUND_SHAPE_RADIUS
|
|
1122
1137
|
},
|
|
1123
1138
|
sm: {
|
|
1124
1139
|
height: "2.5rem",
|
|
@@ -1137,7 +1152,7 @@ var BUTTON_SIZE_TOKENS = {
|
|
|
1137
1152
|
// 12dp
|
|
1138
1153
|
pressedShapeRadius: m3Tokens.cornerRadius.small,
|
|
1139
1154
|
// 8dp
|
|
1140
|
-
roundShapeRadius:
|
|
1155
|
+
roundShapeRadius: ROUND_SHAPE_RADIUS
|
|
1141
1156
|
},
|
|
1142
1157
|
md: {
|
|
1143
1158
|
height: "3.5rem",
|
|
@@ -1156,7 +1171,7 @@ var BUTTON_SIZE_TOKENS = {
|
|
|
1156
1171
|
// 16dp
|
|
1157
1172
|
pressedShapeRadius: m3Tokens.cornerRadius.medium,
|
|
1158
1173
|
// 12dp
|
|
1159
|
-
roundShapeRadius:
|
|
1174
|
+
roundShapeRadius: ROUND_SHAPE_RADIUS
|
|
1160
1175
|
},
|
|
1161
1176
|
lg: {
|
|
1162
1177
|
height: "6rem",
|
|
@@ -1175,7 +1190,7 @@ var BUTTON_SIZE_TOKENS = {
|
|
|
1175
1190
|
// 28dp
|
|
1176
1191
|
pressedShapeRadius: m3Tokens.cornerRadius.large,
|
|
1177
1192
|
// 16dp
|
|
1178
|
-
roundShapeRadius:
|
|
1193
|
+
roundShapeRadius: ROUND_SHAPE_RADIUS
|
|
1179
1194
|
},
|
|
1180
1195
|
xl: {
|
|
1181
1196
|
height: "8.5rem",
|
|
@@ -1194,7 +1209,7 @@ var BUTTON_SIZE_TOKENS = {
|
|
|
1194
1209
|
// 28dp
|
|
1195
1210
|
pressedShapeRadius: m3Tokens.cornerRadius.large,
|
|
1196
1211
|
// 16dp
|
|
1197
|
-
roundShapeRadius:
|
|
1212
|
+
roundShapeRadius: ROUND_SHAPE_RADIUS
|
|
1198
1213
|
}
|
|
1199
1214
|
};
|
|
1200
1215
|
var BUTTON_TYPOGRAPHY_TOKENS = {
|
|
@@ -1546,7 +1561,6 @@ var ButtonComponent = React16__namespace.forwardRef(
|
|
|
1546
1561
|
react.m.button,
|
|
1547
1562
|
__spreadProps(__spreadValues({
|
|
1548
1563
|
ref,
|
|
1549
|
-
layout: true,
|
|
1550
1564
|
type: "button",
|
|
1551
1565
|
"aria-pressed": isToggle ? isSelected : void 0,
|
|
1552
1566
|
"aria-label": computedAriaLabel,
|