What's Changed
Deprecations, will be removed in the next major
MediaRangesProviderandMediaRangesContextβ usecreateMediaRangesinstead (#187)- The
asprop on the top-levelOnly(#187) β wrap children in the element you need, or usecreateMediaRanges'sOnly - The "breakpoint"-named aliases kept for backward compatibility after the rename (#181):
- exports:
useBreakpoint,BreakpointsProvider,BreakpointsContext - props on
BreakpointsProvider:breakpoints,additionalBreakpoints
- exports:
Customer facing
- Add
createMediaRanges+DEFAULT_MEDIA_RANGES, a strongly-typed alternative toMediaRangesProvider(#187)createMediaRanges(ranges)returns a{ useMediaRange, Only }pair bound to the ranges you pass in β no React context, noadditionalMediaRangesvsmediaRangessplit- The returned
useMediaRange/Onlyvalidate theonstring end-to-end: every space-separated token must match a declared range or its auto-generatedUp/Downalias. Invalid input surfaces a readable TypeScript error likeInvalid media ranges: foo barinstead ofnever - The returned
Onlyonly forwardschildrenβasand arbitrary forwarded props are not supported; wrap your children in whatever element you need - Spread
DEFAULT_MEDIA_RANGESwhen you want to keep the defaults (xs,sm,md,lg,xl)
- Rename "breakpoint" to "media range" across the library, tests and documentation to better reflect that each name describes a range between two breakpoints rather than a single breakpoint (#181)
- New exports:
useMediaRange,MediaRangesProvider,MediaRangesContext - New props on
MediaRangesProvider:mediaRanges,additionalMediaRanges - Previous exports are kept but deprecated
- New exports:
Internal
- Migrate from yarn to pnpm (#200)
- Replace eslint & prettier by oxlint & oxfmt (#197)
- Replace jest & jest-dom & puppeteer & parcel with vite + vitest + playwright (#201 & #203)
- Update
README.md(#207)
Full Changelog: v5.0.0...v5.1.0