@bug-on/m3-expressive 1.3.1 → 1.3.3
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 +113 -60
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/{core-CAU8g2HY.d.mts → core-D8FdHY6I.d.mts} +1 -1
- package/dist/{core-DRrLnsnJ.d.ts → core-DyEy8H9Z.d.ts} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +9 -7
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +9 -7
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +2 -1
- package/dist/feedback.d.ts +2 -1
- package/dist/feedback.js +11 -8
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +11 -9
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +4 -3
- package/dist/forms.d.ts +4 -3
- package/dist/forms.js +5084 -2987
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +5083 -2989
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-USJo7AqO.d.mts → icon-button-CxyJv7UV.d.mts} +1 -1
- package/dist/{icon-button-CqdQBsRe.d.ts → icon-button-Di8VX6ou.d.ts} +1 -1
- package/dist/index.d.mts +13 -83
- package/dist/index.d.ts +13 -83
- package/dist/index.js +2843 -1210
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2692 -1072
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +496 -37
- package/dist/layout.d.ts +496 -37
- package/dist/layout.js +1537 -238
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +1509 -226
- package/dist/layout.mjs.map +1 -1
- package/dist/{md3-D0_Z7IXj.d.mts → md3-BQhRygSi.d.mts} +1 -1
- package/dist/{md3-D0_Z7IXj.d.ts → md3-BQhRygSi.d.ts} +1 -1
- package/dist/menu-types-rZNQFO7Y.d.mts +315 -0
- package/dist/menu-types-rZNQFO7Y.d.ts +315 -0
- package/dist/navigation.d.mts +28 -296
- package/dist/navigation.d.ts +28 -296
- package/dist/navigation.js +584 -288
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +576 -282
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- package/dist/{side-sheet-modal-Dgjt739k.d.mts → side-sheet-modal-64FGhDxL.d.mts} +1 -1
- package/dist/{side-sheet-modal-DdEZR6Vl.d.ts → side-sheet-modal-Bd5Qqvp9.d.ts} +1 -1
- package/dist/{split-button-trailing-uncheckable-DTQJjzsB.d.ts → split-button-trailing-uncheckable-CGzk7KcG.d.ts} +1 -1
- package/dist/{split-button-trailing-uncheckable-CIVEYgjY.d.mts → split-button-trailing-uncheckable-gAz6OAIi.d.mts} +1 -1
- package/dist/{text-field-Ear3hCSq.d.mts → text-field-4OlT9o8s.d.mts} +155 -5
- package/dist/{text-field-CiOmDM_8.d.ts → text-field-DARNdj14.d.ts} +155 -5
- package/llms-full.txt +255 -0
- package/llms.txt +102 -0
- package/package.json +10 -5
package/llms-full.txt
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# @bug-on/m3-expressive — Full AI Documentation (v1.1.1)
|
|
2
|
+
|
|
3
|
+
This file contains the complete context for the `@bug-on/m3-expressive` library (version 1.1.1), including core principles, multi-package architecture, styling guides, component references, and AI gotchas.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PART 1: Core Principles & Architecture
|
|
8
|
+
|
|
9
|
+
## 1. Package Architecture & Dependencies
|
|
10
|
+
|
|
11
|
+
The Bug On MD3 Expressive suite consists of 4 specialized packages designed to work together:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
┌────────────────────────────────────────────────────────┐
|
|
15
|
+
│ @bug-on/m3-tokens │ (Level 0: Base Tokens)
|
|
16
|
+
└───────────────────────────┬────────────────────────────┘
|
|
17
|
+
│
|
|
18
|
+
┌────────────────────┴───────────────────┐
|
|
19
|
+
▼ ▼
|
|
20
|
+
┌──────────────────────────────────┐ ┌──────────────────────────────────┐
|
|
21
|
+
│ @bug-on/m3-tailwind │ │ @bug-on/m3-fonts │ (Level 1: Utilities & Assets)
|
|
22
|
+
│ (Tailwind CSS v4 theme plugin) │ │ (Optional self-hosted fonts) │
|
|
23
|
+
└────────────────┬─────────────────┘ └──────────────────────────────────┘
|
|
24
|
+
│
|
|
25
|
+
▼
|
|
26
|
+
┌──────────────────────────────────────────────────────────┐
|
|
27
|
+
│ @bug-on/m3-expressive │ (Level 2: Core React Component Library)
|
|
28
|
+
│ (Bundles tokens + Tailwind theme into index.css) │
|
|
29
|
+
└──────────────────────────────────────────────────────────┘
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **`@bug-on/m3-expressive`** (`packages/react`): Main library containing all React components, `MD3ThemeProvider`, hooks, and motion primitives.
|
|
33
|
+
- **`@bug-on/m3-tokens`** (`packages/tokens`): Raw HCT color tokens, 10-level shape radii scales, typography tokens, and Framer Motion physics constants.
|
|
34
|
+
- **`@bug-on/m3-tailwind`** (`packages/tailwind`): Tailwind CSS v4 CSS-first theme configuration and utility classes (`elevation-*`, `icon-fill-*`, `transition-m3-*`).
|
|
35
|
+
- **`@bug-on/m3-fonts`** (`packages/fonts`): Optional self-hosted font assets (`Material Symbols` and `Google Sans Flex`).
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 2. The Mental Model: MD3 Expressive
|
|
40
|
+
|
|
41
|
+
Unlike standard MD3, **Expressive** layouts emphasize:
|
|
42
|
+
- **Shape Morphing**: Components dynamically morph corner radii (e.g., squircle to circle, pill to rounded square, or squished pill) during interactions.
|
|
43
|
+
- **Physics Springs**: We use physics-based spring transitions (`motion/react` v12+) instead of duration-based ease curves.
|
|
44
|
+
- **Spatial Springs**: For position, size, shape (border-radius), scale (e.g., `FAST_SPATIAL_SPRING`, `DEFAULT_SPATIAL_SPRING`).
|
|
45
|
+
- **Effects Springs**: For color, opacity (no bounce) (e.g., `FAST_EFFECTS_SPRING`).
|
|
46
|
+
- **Expressive Spring**: `SPRING_TRANSITION_EXPRESSIVE` has strong bounce (`bounce: 0.45`), used for active indicator morphs and item selection.
|
|
47
|
+
- **Dynamic Color Engine (MD3 Spec 2025 + MCU v0.4.0)**: Uses `@material/material-color-utilities ^0.4.0` with `specVersion: '2025'` and `Variant.EXPRESSIVE` by default. Derived from CSS variables like `--md-sys-color-primary`, `--md-sys-color-surface-container-low`, `--md-sys-color-primary-fixed`, etc.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3. Theme Management
|
|
52
|
+
|
|
53
|
+
Always wrap your application in `MD3ThemeProvider`. It supports controlling scheme `variant` (`"expressive"`, `"tonal_spot"`, `"vibrant"`, `"fidelity"`, `"content"`, `"monochrome"`, `"neutral"`) and `contrastLevel` (`0` standard, `0.5` medium, `1` maximum contrast/WCAG AAA).
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { MD3ThemeProvider } from "@bug-on/m3-expressive";
|
|
57
|
+
|
|
58
|
+
function App() {
|
|
59
|
+
return (
|
|
60
|
+
<MD3ThemeProvider
|
|
61
|
+
mode="system"
|
|
62
|
+
sourceColor="#6750A4"
|
|
63
|
+
variant="expressive"
|
|
64
|
+
contrastLevel={0}
|
|
65
|
+
enableSnackbar
|
|
66
|
+
>
|
|
67
|
+
<Main />
|
|
68
|
+
</MD3ThemeProvider>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 4. Polymorphism (`asChild`)
|
|
76
|
+
|
|
77
|
+
Most interactive components use the `asChild` pattern from Radix UI. This allows passing a custom element (like Next.js `Link`) and having it receive the component's styles and logic:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<Button asChild>
|
|
81
|
+
<Link href="/dashboard">Go to Dashboard</Link>
|
|
82
|
+
</Button>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> **AI Warning**: When using `asChild`, ensure the child component is a single valid React element that accepts a `ref`.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 5. Tailwind v4 Zero-Config Integration
|
|
90
|
+
|
|
91
|
+
The library uses a CSS-first architecture. All MD3 design tokens, resets, and utility classes are bundled in the stylesheet:
|
|
92
|
+
|
|
93
|
+
```css
|
|
94
|
+
@import "tailwindcss";
|
|
95
|
+
@import "@bug-on/m3-expressive/index.css";
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
By importing `@bug-on/m3-expressive/index.css`, Tailwind v4 automatically processes the `@theme` block so utility classes work out of the box:
|
|
99
|
+
- `bg-m3-primary`, `text-m3-on-primary`
|
|
100
|
+
- `bg-m3-surface-container-high`
|
|
101
|
+
- `border-m3-outline`
|
|
102
|
+
- `rounded-m3-xl`
|
|
103
|
+
|
|
104
|
+
> **Note**: Tailwind v3 is NOT supported.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 6. Icons & Fonts
|
|
109
|
+
|
|
110
|
+
Icons use **Material Symbols** (Variable Font).
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
<Icon name="search" weight={500} size={24} />
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- Standard CDN imports: `@import "@bug-on/m3-expressive/typography.css";` and `@import "@bug-on/m3-expressive/material-symbols-cdn.css";`
|
|
117
|
+
- Offline / Self-hosted imports: `pnpm add @bug-on/m3-fonts`, then `@import "@bug-on/m3-fonts/typography.css";` and `@import "@bug-on/m3-fonts/material-symbols.css";`
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 7. Layout & State Composition Patterns
|
|
122
|
+
|
|
123
|
+
### 7.1 Compound Components & Responsive Layout Groups
|
|
124
|
+
Complex components use a structured compound pattern:
|
|
125
|
+
- **Dialog & Drawer**: `Dialog`, `DialogTrigger`, `DialogContent`, `DialogHeader`, `DialogTitle`, `DialogBody`, `DialogFooter`, `DialogClose`.
|
|
126
|
+
- **Tabs**: `Tabs`, `TabsList`, `Tab`, `TabsContent`.
|
|
127
|
+
- **SplitButton**: `SplitButtonLayout`, `SplitButtonLeading`, `SplitButtonTrailing` (or `SplitButtonTrailingUncheckable`).
|
|
128
|
+
- **ButtonDistribute**: `ButtonDistribute` (`mode="dynamic" | "fixed" | "mixed"`), spring-animated button layout container for responsive action bars.
|
|
129
|
+
- **Menu Family**: `Menu`, `MenuTrigger`, `MenuContent`, `MenuGroup`, `MenuItem`, `MenuDivider`, `SubMenu`. Features shape morphing (`12dp` standalone corners), `variant="expressive" | "baseline"`, `colorVariant="standard" | "vibrant"`, and `matchTriggerWidth`. Includes `ContextMenu` and static `VerticalMenu`.
|
|
130
|
+
- **Select**: `Select` (Exposed Dropdown Menu & Autocomplete). Wraps `TextField` + `Menu`. Supports `searchable` (real-time filtering), controlled/uncontrolled state, and `onChange={(value, option) => void}`.
|
|
131
|
+
|
|
132
|
+
### 7.2 Navigation Customization
|
|
133
|
+
- **NavigationBar & NavigationRail**: Support customizable `itemShape` (`"pill" | "circle" | "rounded-rectangle"`), `labelVisibility` (`"labeled" | "auto" | "unlabeled"`), and `fabAlignment` (`"left" | "center"`).
|
|
134
|
+
|
|
135
|
+
### 7.3 Hoisted State (Date & Time Pickers)
|
|
136
|
+
`DatePicker` and `TimePicker` are **stateless**. The caller owns state via hooks (`useDatePickerState`, `useTimePickerState`) and passes it as a prop.
|
|
137
|
+
|
|
138
|
+
### 7.4 Progress Indicator & Wavy Shapes
|
|
139
|
+
`ProgressIndicator` renders loading status as flat/wavy linear bars or circular indicators.
|
|
140
|
+
- **States**: Determinate (when `value: number` is provided, 0-100) and Indeterminate (when `value` is omitted/undefined).
|
|
141
|
+
- **Accessibility**: `aria-label` is strictly **required** (do not miss it).
|
|
142
|
+
- **API Cleanliness**: Do NOT pass `max` prop. Progress is mapped strictly 0-100.
|
|
143
|
+
- **Linear configuration**:
|
|
144
|
+
- `shape="flat" | "wavy"` & `trackShape="flat" | "wavy"`
|
|
145
|
+
- `amplitude`, `wavelength`, `indeterminateWavelength`, `waveSpeed`, `crawlerSpeed`, `gapSize`
|
|
146
|
+
- `determinateAnimation="md3" | "continuous"` (md3 flattens wave at edges; continuous keeps wave height)
|
|
147
|
+
- `indeterminateAnimation="md3" | "continuous"` (md3 uses physics-stretching sliders; continuous is a rolling path)
|
|
148
|
+
- `showStopIndicator=boolean | "auto"` (fades in a stopping point dot at 100% if "auto")
|
|
149
|
+
- **Circular configuration**:
|
|
150
|
+
- `size` (diameter in px, default 48)
|
|
151
|
+
- `shape="flat" | "wavy"`, `amplitude`, `wavelength`, `crawlerSpeed`, `gapSize`
|
|
152
|
+
- `showTrack=boolean | "auto"` (defaults to hidden for flat, visible for wavy circular)
|
|
153
|
+
- `minProgress` & `maxProgress` (bounds the sliding arc size between 0 and 1)
|
|
154
|
+
- `amplitudeRange=[min, max]` (modulates wave amplitude relative to current arc length)
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
const state = useDatePickerState({ initialSelectedDateMs: Date.now() });
|
|
158
|
+
<DatePicker state={state} />
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
# PART 2: Styling & Design Tokens
|
|
164
|
+
|
|
165
|
+
## 1. Color Roles & State Overlays
|
|
166
|
+
|
|
167
|
+
Use the `m3-` prefix followed by the MD3 color role:
|
|
168
|
+
- **Primary**: `bg-m3-primary`, `text-m3-on-primary`, `border-m3-primary-container`
|
|
169
|
+
- **Secondary**: `bg-m3-secondary`, `text-m3-on-secondary`, `bg-m3-secondary-container`
|
|
170
|
+
- **Tertiary**: `bg-m3-tertiary`, `text-m3-on-tertiary`, `bg-m3-tertiary-container`
|
|
171
|
+
- **Surface**: `bg-m3-surface`, `bg-m3-surface-container-low`, `bg-m3-surface-container-high`, `bg-m3-surface-variant`, `bg-m3-surface-dim`, `bg-m3-surface-bright`
|
|
172
|
+
- **Background**: `bg-m3-background`, `text-m3-on-background`
|
|
173
|
+
- **Fixed Roles (Brand-stable across light/dark)**:
|
|
174
|
+
- `bg-m3-primary-fixed`, `bg-m3-primary-fixed-dim`, `text-m3-on-primary-fixed`, `text-m3-on-primary-fixed-variant`
|
|
175
|
+
- `bg-m3-secondary-fixed`, `bg-m3-secondary-fixed-dim`, `text-m3-on-secondary-fixed`, `text-m3-on-secondary-fixed-variant`
|
|
176
|
+
- `bg-m3-tertiary-fixed`, `bg-m3-tertiary-fixed-dim`, `text-m3-on-tertiary-fixed`, `text-m3-on-tertiary-fixed-variant`
|
|
177
|
+
- **Expressive Dim Tones (Spec 2025)**: `bg-m3-primary-dim`, `bg-m3-secondary-dim`, `bg-m3-tertiary-dim`
|
|
178
|
+
- **Error**: `text-m3-error`, `bg-m3-error-container`, `text-m3-on-error-container`
|
|
179
|
+
|
|
180
|
+
State overlays in Tailwind v4:
|
|
181
|
+
- `hover:bg-m3-primary/8` (8% opacity overlay)
|
|
182
|
+
- `active:bg-m3-primary/12` (12% opacity overlay)
|
|
183
|
+
- `disabled:opacity-[0.38]` (Standard MD3 disabled opacity)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 2. Shapes (10-level Scale)
|
|
188
|
+
|
|
189
|
+
- `rounded-m3-none`: 0px
|
|
190
|
+
- `rounded-m3-extra-small`: 4px
|
|
191
|
+
- `rounded-m3-small`: 8px
|
|
192
|
+
- `rounded-m3-medium`: 12px
|
|
193
|
+
- `rounded-m3-large`: 16px
|
|
194
|
+
- `rounded-m3-large-increased`: 20px
|
|
195
|
+
- `rounded-m3-extra-large`: 28px
|
|
196
|
+
- `rounded-m3-extra-large-increased`: 32px
|
|
197
|
+
- `rounded-m3-extra-extra-large`: 48px
|
|
198
|
+
- `rounded-m3-full`: Pill (9999px)
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 3. Motion & Springs Constants
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import {
|
|
206
|
+
FAST_SPATIAL_SPRING,
|
|
207
|
+
DEFAULT_SPATIAL_SPRING,
|
|
208
|
+
FAST_EFFECTS_SPRING,
|
|
209
|
+
SPRING_TRANSITION_EXPRESSIVE
|
|
210
|
+
} from "@bug-on/m3-expressive";
|
|
211
|
+
|
|
212
|
+
<m.div animate={{ x: 100 }} transition={FAST_SPATIAL_SPRING} />
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
- **FAST_SPATIAL**: Snappy, high stiffness. Use for hover/tap feedback.
|
|
216
|
+
- **DEFAULT_SPATIAL**: Balanced damping. Use for page transitions and layout morphs.
|
|
217
|
+
- **SPRING_TRANSITION_EXPRESSIVE**: High bounce spring (`bounce: 0.45`). Used for active indicator morphs.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
# PART 3: Subpath Exports & Gotchas Reference
|
|
222
|
+
|
|
223
|
+
## Subpath Exports Map
|
|
224
|
+
|
|
225
|
+
- `@bug-on/m3-expressive` — complete package exports
|
|
226
|
+
- `@bug-on/m3-expressive/index.css` — **REQUIRED**: bundled tokens + Tailwind `@theme` + resets
|
|
227
|
+
- `@bug-on/m3-expressive/core` — base providers, hooks, motion tokens
|
|
228
|
+
- `@bug-on/m3-expressive/buttons` — Button, IconButton, ButtonDistribute, FAB, ExtendedFAB, FABMenu, SplitButton, ButtonGroup
|
|
229
|
+
- `@bug-on/m3-expressive/forms` — Select, TextField, Checkbox, RadioButton, Switch, Slider, Search
|
|
230
|
+
- `@bug-on/m3-expressive/feedback` — Dialog, Menu, ContextMenu, VerticalMenu, Tooltip, SnackbarProvider, ProgressIndicator
|
|
231
|
+
- `@bug-on/m3-expressive/navigation` — NavigationBar, NavigationRail, Drawer, Tabs
|
|
232
|
+
- `@bug-on/m3-expressive/overlays` — BottomSheet, SideSheet
|
|
233
|
+
- `@bug-on/m3-expressive/pickers` — DatePicker, DateRangePicker, TimePicker, state hooks
|
|
234
|
+
- `@bug-on/m3-expressive/shapes` — ShapeMedia, ShapeSvg
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Common AI Mistakes & Gotchas
|
|
239
|
+
|
|
240
|
+
| Mistake | Correct |
|
|
241
|
+
| :--- | :--- |
|
|
242
|
+
| `<Icon name="ArrowForward" />` | `<Icon name="arrow_forward" />` (use snake_case) |
|
|
243
|
+
| `<Button variant="toggle">` (without `selected`) | Must pass both `variant="toggle"` and `selected={boolean}` |
|
|
244
|
+
| `<IconButton>` (without `aria-label`) | `aria-label` is required on icon buttons for accessibility |
|
|
245
|
+
| Manually writing flex math for responsive action bars | Use `<ButtonDistribute mode="dynamic">` for spring-animated responsive width distribution |
|
|
246
|
+
| `onChange={e => setValue(e.target.value)}` on TextField | `onChange={(value) => setValue(value)}` (first argument is a string) |
|
|
247
|
+
| `Select` `onChange` assuming standard React `SyntheticEvent` | Signature is `onChange={(value: string, option?: SelectOption) => void}` |
|
|
248
|
+
| `<TabsList>` (without `variant`) | `variant` prop is required on `TabsList` (`"primary"` or `"secondary"`) |
|
|
249
|
+
| Using `useSnackbar()` outside `MD3ThemeProvider` or `SnackbarProvider` | Ensure provider wraps the tree with `enableSnackbar` |
|
|
250
|
+
| `<DatePicker />` or `<TimePicker />` without `state` prop | Always create state via `useDatePickerState()` or `useTimePickerState()` |
|
|
251
|
+
| `<BottomSheet isOpen={...}>` | Correct prop names are `open` and `onOpenChange` |
|
|
252
|
+
| `<MenuContent>` with nested `<SubMenu>` clipping overflow | Pass `hasOverflow={true}` to `MenuContent` or `ContextMenuContent` so submenus escape container bounds |
|
|
253
|
+
| `<ProgressIndicator max={100} />` | ProgressIndicator does not support `max` prop. Progress is mapped strictly from 0 to 100 on the `value` prop |
|
|
254
|
+
| `<ProgressIndicator>` without `aria-label` | `aria-label` is required on all progress indicators for accessibility |
|
|
255
|
+
| `<ProgressIndicator value={0} />` for indeterminate mode | Omit `value` prop entirely (or pass `undefined`) to trigger indeterminate loading. Setting `value={0}` indicates 0% determinate progress |
|
package/llms.txt
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @bug-on/m3-expressive
|
|
2
|
+
|
|
3
|
+
> MD3 Expressive Design System for React + Tailwind v4 + Framer Motion. Version: 1.3.1
|
|
4
|
+
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> Bug On MD3 Expressive only supports **Tailwind CSS v4** (peer dependency `tailwindcss: ">=4.0.0"`). **Tailwind CSS v3 is no longer supported**.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Ecosystem Package Map
|
|
11
|
+
|
|
12
|
+
- **`@bug-on/m3-expressive`** (`packages/react`): Core UI library with 30+ components, dynamic provider (`MD3ThemeProvider`), hooks, and motion primitives.
|
|
13
|
+
- **`@bug-on/m3-tokens`** (`packages/tokens`): Base design tokens for color palettes, shape scales, typography, and spring constants.
|
|
14
|
+
- **`@bug-on/m3-tailwind`** (`packages/tailwind`): CSS-first Tailwind v4 theme plugin, elevations, Shiki code styling, and utility classes (`icon-fill-*`, `transition-m3-*`).
|
|
15
|
+
- **`@bug-on/m3-fonts`** (`packages/fonts`): Optional self-hosted font assets for offline or air-gapped environments (`Material Symbols` & Typography).
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Quick Installation & Setup
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add @bug-on/m3-expressive motion
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
/* globals.css — Zero Config Tailwind v4 setup */
|
|
27
|
+
@import "tailwindcss";
|
|
28
|
+
@import "@bug-on/m3-expressive/index.css"; /* tokens + @theme + resets (REQUIRED) */
|
|
29
|
+
@import "@bug-on/m3-tailwind"; /* optional: MD3 utilities & elevation */
|
|
30
|
+
@import "@bug-on/m3-expressive/typography.css"; /* optional: typography preset classes */
|
|
31
|
+
@import "@bug-on/m3-expressive/material-symbols-cdn.css"; /* optional: Material Symbols (CDN) */
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For offline or self-hosted fonts:
|
|
35
|
+
```bash
|
|
36
|
+
pnpm add @bug-on/m3-fonts
|
|
37
|
+
```
|
|
38
|
+
```css
|
|
39
|
+
@import "@bug-on/m3-fonts/typography.css";
|
|
40
|
+
@import "@bug-on/m3-fonts/material-symbols.css";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
// App layout wrapper
|
|
45
|
+
import { MD3ThemeProvider } from "@bug-on/m3-expressive/core";
|
|
46
|
+
|
|
47
|
+
function Root({ children }: { children: React.ReactNode }) {
|
|
48
|
+
return (
|
|
49
|
+
<MD3ThemeProvider
|
|
50
|
+
defaultMode="system"
|
|
51
|
+
sourceColor="#6750A4"
|
|
52
|
+
variant="expressive"
|
|
53
|
+
contrastLevel={0}
|
|
54
|
+
enableSnackbar
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</MD3ThemeProvider>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Core Principles for AI Code Generators
|
|
65
|
+
|
|
66
|
+
- **Dynamic Color (MD3 Spec 2025 + MCU v0.4.0)**: Palette generation uses `specVersion: '2025'` with `Variant.EXPRESSIVE` as default. Supports scheme `variant` (`"expressive"`, `"tonal_spot"`, `"vibrant"`, `"fidelity"`, `"content"`, `"monochrome"`, `"neutral"`) and `contrastLevel` (`0`, `0.5`, `1`).
|
|
67
|
+
- **Expressive Color Tokens**: Fixed color roles (`bg-m3-primary-fixed`, `bg-m3-secondary-fixed`, `bg-m3-tertiary-fixed` + dim/on variants) remain light/dark invariant. Dim tones (`bg-m3-primary-dim`, etc.) provide subdued accent surfaces.
|
|
68
|
+
- **Button Color Styles & Layouts**: Supports 8 color styles: `"filled"`, `"tonal"`, `"outlined"`, `"text"`, `"elevated"`, `"tertiary"`, `"primary-fixed"`, `"tertiary-fixed"`. `ButtonDistribute` (`mode="dynamic" | "fixed" | "mixed"`) handles responsive button row weighting.
|
|
69
|
+
- **Carousel (Morphing & Multi-browse)**: `Carousel` component implements Material Design 3 Expressive motion keyline math (`useCarouselKeylines`) for dynamic item shrinking/expansion during scrolling.
|
|
70
|
+
- **Chips**: 4 standard variants (`variant="assist" | "filter" | "input" | "suggestion"`) supporting leading avatar/icons, animated selection checkmarks, and trailing remove buttons, grouped via `ChipGroup`.
|
|
71
|
+
- **Shape Morphing & Custom Shapes**: Elements dynamically morph corner radii during interactions. `NavigationBar` and `NavigationRail` support custom item shapes (`"pill" | "circle" | "rounded-rectangle"`).
|
|
72
|
+
- **Physics Springs**: Powered by `motion/react` (Framer Motion ≥12). Uses spatial (`FAST_SPATIAL_SPRING`, `DEFAULT_SPATIAL_SPRING`) and effects (`FAST_EFFECTS_SPRING`) springs.
|
|
73
|
+
- **Polymorphism (`asChild`)**: Supported across buttons, cards, drawers, and dialog triggers for custom routing links.
|
|
74
|
+
- **Hoisted State**: `DatePicker` and `TimePicker` are stateless and require `useDatePickerState()` / `useTimePickerState()`.
|
|
75
|
+
- **TextField & Select onChange**: Parameter signature receives `(value: string)` — NOT a raw React SyntheticEvent. `Select` returns `(value: string, option?: SelectOption)`.
|
|
76
|
+
- **Select & Exposed Dropdowns**: `Select` supports standard dropdown and `searchable` autocomplete mode with real-time option filtering and `matchTriggerWidth` (default `true`).
|
|
77
|
+
- **Menu Family & Morphing**: `Menu`, `ContextMenu`, and `VerticalMenu` feature container shape morphing (`12dp` standalone corners). `MenuContent` `matchTriggerWidth` matches popover width to trigger.
|
|
78
|
+
- **ProgressIndicator & Wavy Motion**: Supports `"linear"` and `"circular"` variants with dynamic `"wavy"` shapes (`shape="wavy"`, `trackShape`, `amplitude`, `wavelength`). `aria-label` is strictly **required**. Indeterminate mode is triggered by omitting the `value` prop (do not use `max` prop). Supports co-elastic animations (`determinateAnimation`, `indeterminateAnimation`) and track stop dots (`showStopIndicator`).
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Package Subpath Exports
|
|
83
|
+
|
|
84
|
+
- `@bug-on/m3-expressive` — complete package exports
|
|
85
|
+
- `@bug-on/m3-expressive/index.css` — **REQUIRED**: bundled tokens + Tailwind `@theme` + resets
|
|
86
|
+
- `@bug-on/m3-expressive/core` — base providers (`MD3ThemeProvider`), hooks (`useTheme`, `useThemeMode`, `useSnackbar`), `Icon`, `Ripple`
|
|
87
|
+
- `@bug-on/m3-expressive/buttons` — Button, IconButton, ButtonDistribute, FAB, ExtendedFAB, FABMenu, SplitButton, ButtonGroup
|
|
88
|
+
- `@bug-on/m3-expressive/forms` — TextField, Chip, Checkbox, TriStateCheckbox, RadioButton, RadioGroup, Switch, Slider, RangeSlider, Select, Search
|
|
89
|
+
- `@bug-on/m3-expressive/feedback` — Snackbar, SnackbarProvider, useSnackbar, ProgressIndicator (linear, circular, wavy), LoadingIndicator, Badge, BadgedBox, PlainTooltip, RichTooltip
|
|
90
|
+
- `@bug-on/m3-expressive/navigation` — NavigationBar, NavigationRail, NavigationDrawer, Tabs, Tab, SmallAppBar, MediumFlexibleAppBar, LargeFlexibleAppBar, BottomAppBar, DockedToolbar, HorizontalFloatingToolbar, VerticalFloatingToolbar, Menu, ContextMenu, VerticalMenu, Search
|
|
91
|
+
- `@bug-on/m3-expressive/overlays` — Dialog, DialogFullScreenContent, Drawer, BottomSheet, BottomSheetModal, SideSheet, SideSheetModal
|
|
92
|
+
- `@bug-on/m3-expressive/layout` — Card, Carousel, Divider, List, ListItem, ListDivider, ScrollArea, CodeBlock, TableOfContents, Text, Typography
|
|
93
|
+
- `@bug-on/m3-expressive/pickers` — DatePicker, DatePickerDialog, DatePickerInput, DateRangePicker, TimePicker, TimePickerDialog, TimeInput, state hooks
|
|
94
|
+
- `@bug-on/m3-expressive/shapes` — ShapeMedia, ShapeSvg, ShapeIcon, useShapeMorph
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Documentation Links
|
|
99
|
+
|
|
100
|
+
- [Full AI Context Document](./llms-full.txt) - **Recommended for AI Agents** (Detailed APIs, gotchas, gotcha matrix)
|
|
101
|
+
- [Component Reference Site](https://bug-on-md3.vercel.app/docs/components)
|
|
102
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bug-on/m3-expressive",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Material Design 3 Expressive React components",
|
|
5
5
|
"author": "Bug On",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
29
|
"README.md",
|
|
30
|
-
"CHANGELOG.md"
|
|
30
|
+
"CHANGELOG.md",
|
|
31
|
+
"llms.txt",
|
|
32
|
+
"llms-full.txt"
|
|
31
33
|
],
|
|
32
34
|
"sideEffects": [
|
|
33
35
|
"*.css"
|
|
@@ -153,7 +155,9 @@
|
|
|
153
155
|
"types": "./dist/shapes.d.ts",
|
|
154
156
|
"default": "./dist/shapes.js"
|
|
155
157
|
}
|
|
156
|
-
}
|
|
158
|
+
},
|
|
159
|
+
"./llms.txt": "./llms.txt",
|
|
160
|
+
"./llms-full.txt": "./llms-full.txt"
|
|
157
161
|
},
|
|
158
162
|
"peerDependencies": {
|
|
159
163
|
"motion": ">=12.0.0",
|
|
@@ -179,8 +183,8 @@
|
|
|
179
183
|
"class-variance-authority": "^0.7.1",
|
|
180
184
|
"clsx": "^2.1.1",
|
|
181
185
|
"tailwind-merge": "^3.3.1",
|
|
182
|
-
"@bug-on/m3-tokens": "1.2.
|
|
183
|
-
"@bug-on/m3-tailwind": "1.2.
|
|
186
|
+
"@bug-on/m3-tokens": "1.2.2",
|
|
187
|
+
"@bug-on/m3-tailwind": "1.2.2"
|
|
184
188
|
},
|
|
185
189
|
"devDependencies": {
|
|
186
190
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -199,6 +203,7 @@
|
|
|
199
203
|
"vitest": "^4.1.6"
|
|
200
204
|
},
|
|
201
205
|
"scripts": {
|
|
206
|
+
"prebuild": "node -e \"const fs=require('fs'); if(fs.existsSync('../../llms.txt')) { fs.copyFileSync('../../llms.txt', 'llms.txt'); fs.copyFileSync('../../llms-full.txt', 'llms-full.txt'); }\"",
|
|
202
207
|
"build": "tsup",
|
|
203
208
|
"dev": "tsup --watch",
|
|
204
209
|
"test": "vitest run",
|