UNPKG

35.5 kBMarkdownView Raw
1# Change Log
2
3All notable changes to this project will be documented in this file. See
4[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
6## [2.1.2](https://github.com/mlaursen/react-md/compare/v2.1.1...v2.1.2) (2020-08-01)
7
8**Note:** Version bump only for package react-md
9
10# Change Log
11
12All notable changes to this project will be documented in this file. See
13[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
14
15## [2.1.1](https://github.com/mlaursen/react-md/compare/v2.1.0...v2.1.1) (2020-07-21)
16
17**Note:** Version bump only for package react-md
18
19# Change Log
20
21All notable changes to this project will be documented in this file. See
22[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
23
24# [2.1.0](https://github.com/mlaursen/react-md/compare/v2.0.4...v2.1.0) (2020-07-12)
25
26**Note:** Version bump only for package react-md
27
28# Change Log
29
30All notable changes to this project will be documented in this file. See
31[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
32
33## [2.0.4](https://github.com/mlaursen/react-md/compare/v2.0.3...v2.0.4) (2020-07-10)
34
35**Note:** Version bump only for package react-md
36
37# Change Log
38
39All notable changes to this project will be documented in this file. See
40[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
41
42## [2.0.3](https://github.com/mlaursen/react-md/compare/v2.0.2...v2.0.3) (2020-07-07)
43
44**Note:** Version bump only for package react-md
45
46## [2.0.2](https://github.com/mlaursen/react-md/compare/v2.0.1...v2.0.2) (2020-06-30)
47
48### Bug Fixes
49
50- Main README Layout example
51 ([bcc8405](https://github.com/mlaursen/react-md/commit/bcc84056351821fb55cc21327de191f65fe7958a))
52- **LICENSE:** Removed the time range from license since it was incorrect
53 ([50c9021](https://github.com/mlaursen/react-md/commit/50c9021cedc0d642758b9fd541bb6c93d2fe1786))
54- Added sideEffects field to package.json
55 ([31820b9](https://github.com/mlaursen/react-md/commit/31820b9b43705e5849664500a17b6849eb6dc2a9))
56- Added unpkg url for base react-md package
57 ([d0efc59](https://github.com/mlaursen/react-md/commit/d0efc59aed0b0ccaa9acadb4e8cf8037bad1f3b3))
58
59## v2.0.1
60
61This release just updated the UMD bundle to be separated into three parts to
62keep the library as small as possible. This really should not affect anyone even
63though it is a "breaking" change.
64
65##### Base react-md library (no material icons)
66
67Development:
68
69- https://unpkg.com/react-md@2.0.1/dist/umd/react-md.development.js
70
71Production:
72
73- https://unpkg.com/react-md@2.0.1/dist/umd/react-md.production.min.js
74
75##### Base react-md library with the Font Icon components for material icons
76
77Development:
78
79- https://unpkg.com/react-md@2.0.1/dist/umd/react-md-with-font-icons.development.js
80
81Production:
82
83- https://unpkg.com/react-md@2.0.1/dist/umd/react-md-with-font-icons.production.min.js
84
85##### Base react-md library with the SVG Icon components for material icons
86
87Development:
88
89- https://unpkg.com/react-md@2.0.1/dist/umd/react-md-with-svg-icons.development.js
90
91Production:
92
93- https://unpkg.com/react-md@2.0.1/dist/umd/react-md-with-svg-icons.production.min.js
94
95### Fixed and updated GZip Size
96
97```sh
98v1 size
99The gzipped UMD bundle size is:
100 - dist/v1/umd/react-md.min.js 98.68 KB
101
102The min and max gzipped CSS bundle sizes are:
103 - dist/v1/css/react-md.yellow-red.min.css 13.2 KB
104 - dist/v1/css/react-md.blue_grey-deep_purple.min.css 13.23 KB
105
106v2 size
107The gzipped UMD bundle size is:
108 - dist/umd/react-md.production.min.js 86.49 KB
109 - dist/umd/react-md-with-font-icons.production.min.js 196.05 KB
110 - dist/umd/react-md-with-svg-icons.production.min.js 196.03 KB
111
112The min and max gzipped CSS bundle sizes are:
113 - dist/css/react-md.grey-deep_orange-200-light.min.css 15.65 KB
114 - dist/css/react-md.indigo-blue-400-dark.min.css 15.71 KB
115
116```
117
118## v2.0.0
119
120The v2 release is a complete re-write of react-md to address the majority of
121problems encountered while using v1. Unfortunately, this took a **lot** longer
122than I had hoped since I ended up using this project to learn [Typescript] as
123well as the new [React hooks API]. Even though there are some missing components
124from v1, I think the new functionality outweighs it and the components are
125scoped for a later release.
126
127##### Missing Components and Functionality from v1 <!-- no-margin-bottom -->
128
129Before starting the migration to v2, I highly recommend reviewing the [Working
130with v1] guide and reviewing the following missing functionality:
131
132- **dropped full support for IE 11** and mostly targeting evergreen browsers for
133 the new dynamic themes
134- some styling props have been removed since the new component API should
135 hopefully eliminate the need for those props. (These props were normally
136 `get*Style`, `get*ClassName`, etc)
137- controlling the visibility and value of some components has been removed since
138 I struggled figuring out a good way to handle controlled/uncontrolled
139 components and hooks. I definitely plan on adding support for this
140 functionality back in.
141- the `BottomNavigation` component has not been added to the initial v2 release.
142 This component might be added at a later time, but the new #app-bar package
143 should be able to solve a decent amount of use cases.
144- the `DatePicker` and `TimePicker` components have not been added to the
145 initial v2 release. These two components will definitely be added in a later
146 release, but require a lot more time to implement since **dates are hard** and
147 I want to create all the sub-components in a reusable and exportable way for
148 additional customization.
149- removed the `FileUpload` component since it didn't feel extremely useful since
150 it didn't actually upload a file to a server
151- the `mini` variants for the `Drawer`/`NavigationDrawer` components have not
152 yet been implemented in the new `Layout` component.
153- removed the `MenuTab` component due to never really working correctly and the
154 new #tabs package should allow for a much better user experience and
155 customization.
156- removed the `ListItemControl` component since it was implemented pretty badly.
157 The new #list and #form packages should allow for this to be re-implemented in
158 your app fairly easily though.
159- removed the `TablePagination` and `TableCardHeader` components since I wasn't
160 sure how helpful they were and didn't really work. The new #table styling
161 behavior and customization should allow for a custom implementation fairly
162 easily though.
163- removed the `EditDialogColumn`, `SelectFieldColumn`, `*Column` components from
164 the #table package since they aren't really needed anymore. Form elements
165 should be renderable within tables without the weird hacks these components
166 were implementing.
167- removed the `Version` component since it was probably only ever used by the
168 documentation site.
169
170### What's new in v2?
171
172This release focused on updating `react-md` to be as customizable as possible by
173exporting a lot more low-level components, hooks, and utils that were used
174internally. Something that I noticed from the v1 release is that if something
175was not easily customizable or specific components were not public, it was
176**easier to actually write your own version of that component**. This was a
177major flaw and caused lots of problems especially since the majority of the
178functionality behind these components were not reusable. The new components and
179hooks should be able to help for these use cases but the down side is that
180you'll still need to create a custom implementation for common patterns
181throughout your app because some patterns seem repetitive.
182
183#### Rewrite to Typescript
184
185> Note: Upgrading to v2 of `react-md` does **not** require you to also use
186> Typescript even though it is highly recommended to do so. You can still use
187> `react-md` with JavaScript as you have done before, but all the examples and
188> documentation will be written with Typescript.
189
190[v1.1.0](/v1/discover-more/whats-new#v1-1-0-released) was the first `react-md`
191release to add support for Typescript but unfortunately the type definitions
192were [not that great]({{GITHUB_URL}}/blob/v1/src/js/index.d.ts) because I did
193not fully understand Typescript and kept getting out of sync or forgotten. Since
194Typescript is becoming the new trend for web development with additional tooling
195and editor integrations, it seemed like a good time to finally start learning
196Typescript and re-write `react-md` to use it natively.
197
198One of the biggest pros for rewriting to Typescript is that now all the
199documentation around Component props, hooks, or utils can now be viewed within
200your editor or IDE if it supports the `"Go to Definition"` functionality due to
201being compiled with the `*.d.ts` files now. In addition, the type definitions
202should never be out of sync and should be much more strictly typed than before
203since the entire library has been written in Typescript.
204
205That being said, there are a few type definitions that could still be improved
206in v2 especially around [generics and Records]({{GITHUB_URL}}/issues/859) so any
207suggestions or PRs are welcomed.
208
209#### New Behavior for Determining the Current Application Size
210
211In v1, the `Drawer` and `NavigationDrawer` components were used to be able to
212determine the current app size using the static methods: `getCurrentMedia` and
213`matchesMedia`. This meant that the only way to determine the current
214application size through media queries was to either:
215
216- render a `Drawer` or `NavigationDrawer` components and hook into the
217 `onMediaTypeChange` callback prop
218- manually create a resize listener and use the
219 `Drawer.getCurrentMedia`/`NavigationDrawer.getCurrentMedia` static methods
220- implement a custom solution
221
222This solution was pretty terrible and lead to confusion, out-of-sync behavior,
223and bugs.
224
225Starting with v2 these issues should be resolved due to React implementing the
226new [Context API] along with the new [AppSizeListener] component and media query
227SCSS mixins.
228
229##### AppSizeListener Component and useAppSize Hook <!-- no-margin-bottom -->
230
231The new `AppSizeListener` component should be mounted **once** near the root of
232your app which will initialize multiple resize and media query event listeners
233to determine what size your app is currently being rendered while the
234`useAppSize` hook allows access to the current size.
235
236Check out the [AppSizeListener] example for more details and a live demo.
237
238##### Media Query Mixins and Components <!-- no-margin-bottom -->
239
240In addition to the new component and hook, `react-md` now provides a few utility
241SCSS mixins for applying styles at different media query sizes:
242
243- [rmd-utils-phone-media]
244- [rmd-utils-tablet-media]
245- [rmd-utils-tablet-only-media]
246- [rmd-utils-desktop-media]
247- [rmd-utils-large-desktop-media]
248
249There are also a few media query components which can be used to conditionally
250render components based on the current application site. Check out the [Media
251Query Components example] for some more information.
252
253#### New Theme API
254
255Since this release dropped IE 11 support, all the dynamic theming is done
256through [Custom CSS Properties (CSS Variables)] with the new theme SCSS
257functions and mixins. The root #theme package now provides a new `background`
258and `surface` color variable to use along with a lot of [other themeable values]
259while the other packages will provide themeable variables for colors, margin,
260and padding. The new theme API allows you to easily modify existing themes
261without all the boilerplate and "hacks" from the v1 release. Here is a quick
262example:
263
264####### v1 theme updates <!-- no-margin -->
265
266```scss
267.custom-theme--v1 {
268 // create smaller icon buttons
269 .md-btn--icon {
270 height: 1rem;
271 font-size: 1rem;
272 width: 1rem;
273 }
274
275 // updating icon spacing
276 .md-icon-text {
277 $new-spacing: 0.5rem;
278
279 &:first-child {
280 padding-right: $new-spacing;
281 }
282
283 &:last-child {
284 padding-left: $new-spacing;
285 }
286 }
287
288 // change theme colors
289 @include react-md-theme-colors($md-orange-500, $md-purple-a-200);
290}
291```
292
293####### v2 theme updates <!-- no-margin -->
294
295```scss
296// in v2
297.custom-theme--v2 {
298 @include rmd-button-theme-update-var(icon-size, 1rem);
299 @include rmd-icon-theme-update-var(text-spacing, 0.5rem);
300 @include rmd-theme-update-var(primary, $rmd-orange-500);
301 @include rmd-theme-update-var(secondary, $rmd-purple-a-200);
302}
303```
304
305You can also reference the current theme values as a value or CSS Variable:
306
307```scss
308.custom-class {
309 // use current background-color
310 @include rmd-theme(background-color, background);
311
312 // use the current primary text color on the current background color
313 @include rmd-theme(color, text-primary-on-background);
314
315 // use the current primary theme color as a border color (for some reason)
316 @include rmd-theme(border-color, primary): ;
317
318 // add 1rem to the current CSS Variable value for the icon text spacing
319 padding: calc(#{rmd-icon-theme-var(text-spacing)} + 1rem);
320}
321```
322
323The new theme API is pretty powerful and allows for a lot of new customization
324without needing to modify the `react-md` internals and remembering specific
325class names. Please check out the [creating dynamic themes] documentation for
326more information.
327
328> Disclaimer: This new theme API was heavily inspired by the
329> [material components web](https://github.com/material-components/material-components-web)
330> library.
331
332#### New Utility SCSS Functions and Mixins
333
334This release added a bunch of new utility functions and mixins to add additional
335styling throughout your app for common use cases such as:
336
337- updating styles for right to left languages: [rmd-utils-rtl]
338- applying styles for mobile devices only: [rmd-utils-phone-media]
339- applying styles for tablets and above: [rmd-utils-tablet-media]
340- applying a simple button CSS reset: [rmd-button-reset]
341- updating a CSS variable's value for the theme package: [rmd-theme-update-var]
342- checking if a color is considered light or dark: [rmd-theme-tone]
343- and more!
344
345Check out the SassDoc pages for additional documentation and examples for common
346mixins:
347
348- [@react-md/alert](/packages/alert/sassdoc#alert-mixins)
349- [@react-md/app-bar](/packages/app-bar/sassdoc#app-bar-mixins)
350- [@react-md/avatar](/packages/avatar/sassdoc#avatar-mixins)
351- [@react-md/badge](/packages/badge/sassdoc#badge-mixins)
352- [@react-md/button](/packages/button/sassdoc#button-mixins)
353- [@react-md/card](/packages/card/sassdoc#card-mixins)
354- [@react-md/chip](/packages/chip/sassdoc#chip-mixins)
355- [@react-md/dialog](/packages/dialog/sassdoc#dialog-mixins)
356- [@react-md/divider](/packages/divider/sassdoc#divider-mixins)
357- [@react-md/elevation](/packages/elevation/sassdoc#elevation-mixins)
358- [@react-md/expansion-panel](/packages/expansion-panel/sassdoc#expansion-panel-mixins)
359- [@react-md/form](/packages/form/sassdoc#form-mixins)
360- [@react-md/icon](/packages/icon/sassdoc#icon-mixins)
361- [@react-md/layout](/packages/layout/sassdoc#layout-mixins)
362- [@react-md/link](/packages/link/sassdoc#link-mixins)
363- [@react-md/list](/packages/list/sassdoc#list-mixins)
364- [@react-md/media](/packages/media/sassdoc#media-mixins)
365- [@react-md/menu](/packages/menu/sassdoc#media-mixins)
366- [@react-md/overlay](/packages/overlay/sassdoc#overlay-mixins)
367- [@react-md/progress](/packages/progress/sassdoc#progress-mixins)
368- [@react-md/sheet](/packages/sheet/sassdoc#sheet-mixins)
369- [@react-md/states](/packages/states/sassdoc#states-mixins)
370- [@react-md/table](/packages/table/sassdoc#table-mixins)
371- [@react-md/tabs](/packages/tabs/sassdoc#tabs-mixins)
372- [@react-md/theme](/packages/theme/sassdoc#theme-mixins)
373- [@react-md/tooltip](/packages/tooltip/sassdoc#tooltip-mixins)
374- [@react-md/transition](/packages/transition/sassdoc#transition-mixins)
375- [@react-md/tree](/packages/tree/sassdoc#tree-mixins)
376- [@react-md/typography](/packages/typography/sassdoc#typography-mixins)
377- [@react-md/utils](/packages/utils/sassdoc#utils-mixins)
378
379#### Automatic Color Fixes for Accessible Contrast Ratios
380
381The default styles from `react-md` will now **attempt** to automatically fix
382contrast ratio issues between foreground and background colors using the new
383[rmd-theme-tone] function. This appears to work for a great amount of use cases,
384but it is still recommended to verify colors meet the recommended contrast ratio
385for accessibility. You can check out the [Theme Builder] for a few examples of
386contrast ratio issues by playing with the theme colors.
387
388#### SCSS Variables and Default Values in JavaScript
389
390Every SCSS variable is now automatically compiled with its default value and
391written to a `dist/scssVariables.js` file for each package as a record of
392variable names as keys and the default compiled value as the value. This allows
393you to get access to each variable name as well as all the themeable CSS
394Variables in JavaScript.
395
396For example, if you want to get all the available material design colors from
397the theme package, you can use the following code:
398
399```ts
400import scssVariables from "@react-md/theme/dist/scssVariables";
401
402// get all the colors from the color palette
403// only the color variables in this package will not be prefixed
404// with rmd-theme
405const colorKeys = Object.keys(scssVariables).filter(
406 (name) => !/^rmd-theme/.test(name)
407);
408```
409
410> Note: This will be strictly typed for Typescript users as well.
411
412#### Improved Typography and CSS Reset
413
414To be honest, I had no idea what I was doing with typography in v1 <sup>_(I
415still don't really understand typography)_</sup> and defaulted to modifying the
416default tags with `react-md` typography styles:
417
418- `<h1> - <h6>`
419- `<p>`
420- `<caption>`
421- `<input>`
422- `<textarea>`
423- `<button>`
424
425Starting with v2, `react-md` will provide a much simpler
426[CSS reset](/packages/utils/sassdoc#utils-mixin-rmd-utils-base) and not apply
427any typography to html tags. In addition, the default typography styles can be
428overridden or merged with new styles using the
429[\$rmd-typography-styles variable](/packages/typography/sassdoc#typography-variable-rmd-typography-styles).
430The new #typography package also exports two new components for general text
431styling and reusable typography mixins.
432
433#### Improved User Interaction States
434
435A user interaction state is the feedback presented to the user when one of the
436following actions happens:
437
438- tap a clickable element on a touch device
439- click a clickable element with the mouse
440- focus an element with the keyboard
441
442####### v1 implementation<!-- no-margin -->
443
444![v1 implementation](https://i.imgur.com/MTxYr1e.mp4)
445
446v1 of `react-md` had a very "noisy" implementation of this with the
447[ripple/ink effect](/v1/components/inks) which caused a 300ms animation each
448time the user interacted with a focusable element. This was _okay_ for the tap
449and click behaviors but extremely obnoxious for keyboard users especially when
450tabbing through elements quickly.
451
452In addition there would sometimes be `:hover` styles applied accidentally after
453a user touches an element on mobile since touch events also trigger the `:hover`
454state. The rewrite for v2 has solved these issues by introducing interaction
455states, providing mixins to dynamically apply styles based on an interaction
456state, and providing a new keyboard focus state.
457
458####### Starting with v2<!-- no-margin -->
459
460![v2 implementation](https://i.imgur.com/wsvliUy.mp4)
461
462The #utils package provides an `InteractionModeListener` that is bundled into
463the `Configuration` component in the #layout package that helps determine which
464interaction mode the user is currently using. This can be used along with the
465following mixins for dynamically applying styles based on an interaction mode:
466
467- [rmd-utils-touch-only]
468- [rmd-utils-keyboard-only]
469- [rmd-utils-mouse-only]
470
471In addition, a new #states package has been added that implements the new
472behavior for the ink/ripple effect that will now only trigger after a click
473event instead of focus. The focus state has been drastically simplified to add
474blue `box-shadow` and sometimes add a slight background color change while
475keyboard focused. The new interaction states can be implemented for any
476non-react-md component as well with the following mixins:
477
478- [rmd-states-surface]
479- [rmd-states-focus-shadow]
480- [rmd-states-pressed-styles]
481- [rmd-states-theme]
482- [rmd-states-theme-update-var]
483
484#### Improved Accessibility and Keyboard Movement
485
486The v1 release of `react-md` implemented _some_ accessibility features and
487keyboard movement but the majority of the behavior was incorrect and caused more
488issues than it tried to solve. v2 is still not 100% perfect due to how
489differently screen readers behave, but should now follow the specs outlined on
490the [WIA-ARIA Best Practices](https://www.w3.org/TR/wai-aria-practices/)
491website. Due to these fixes a lot of components will now correctly require an
492`aria-label` or `aria-labelledby` prop which only required an `id` before.
493
494The new keyboard movement behavior is drastically different now since components
495now correctly follow the recommendations outlined in the WIA-ARIA Best practices
496website. A new feature that is introduced in v2 is the ability to
497"type-to-focus" elements in some complex components. The user can now focus a
498component like the `Tree` or `DropdownMenu` and type letters to match the first
499child that starts with those letters. In addition, lot of work has been made
500into ensuring that keyboard focus is no longer lost while navigating between
501temporary elements like menus and dialogs and implementing the new
502`aria-activedescendant` movement when needed to keep focus on the correct
503components. It is highly recommended to check out the [AutoComplete],
504[DropdownMenu], and [Tree] components since the changes should be extremely
505noticeable and a few of the demos showcase this functionality.
506
507Finally, the accessibility helpers have been created as reusable hooks in the
508##utils package so that non react-md components can implement this functionality
509as well.
510
511- [useFocusOnMount] - Focuses an element when the component mounts which
512 defaults to the first focusable element child. Can be configured to focus the
513 last child by default or a custom `document.querySelector` string.
514- [usePreviousFocus] - Used in temporary elements like menus and dialogs to help
515 ensure that keyboard focus is not lost once the temporary element is closed.
516- [useTabFocusWrap] - A hook implementation of the `FocusContainer` that just
517 provides a `onKeyDown` event handler for maintaining focus within a container.
518- [useFocusMovement] - Provides the functionality to focus elements with custom
519 key configurations.
520- [useActiveDescendantMovement] - Provides the functionality to "focus" elements
521 with custom key configurations by using the `aria-activedescendant` focus
522 pattern which maintains focus on the "root" element
523- [useKeyboardSearch] - A low-level hook for providing the "type-to-focus"
524 behavior on components as an `onKeyDown` event handler.
525- [useKeyboardMovement] - A low-level hook that is used by both the
526 `useFocusMovement` and `useActiveDescendantMovement` to provide keyboard
527 movement and optional search functionality.
528
529#### Right to left Language Support
530
531`react-md` will now automatically update the provided styles when a parent
532element (normally the root `<html>`) for `dir="rtl"` to support right to left
533languages. The following properties will be automatically inversed:
534
535- `margin-left`
536- `margin-right`
537- `padding-left`
538- `padding-right`
539- `left`
540- `right`
541
542Since it might be required to update non-react-md components with these styles,
543the #utils package also exports the following mixins to implement this behavior:
544
545- [rmd-utils-rtl]
546- [rmd-utils-rtl-auto]
547- [rmd-utils-rtl-auto-group]
548
549> The documentation site allows for a live preview for this functionality! If
550> you are on desktop, click the right to left toggle button in the main header.
551> If you are on mobile, click the kebab menu in the main header and then click
552> the toggle right to left option.
553
554This feature is enabled by default starting with v2 but can be disabled by
555updating the
556[rmd-utils-enable-rtl](/packages/utils/sassdoc#utils-variable-rmd-utils-enable-rtl)
557variable:
558
559```scss
560$rmd-utils-enable-rtl: false;
561
562@import "~react-md/dist/react-md";
563```
564
565#### Convenience Configuration and Context Provider Components
566
567v2 of react-md heavily uses the [Context API] to implement different features
568and configuration for things such as:
569
570- changing the default icons used throughout `react-md`
571- disabling the ripple behavior
572- configuring the `theme` for different components
573- determining the current application size
574
575Check out the #layout package for more information since it provides a
576`Configuration` component that combines all of these context providers into a
577single component.
578
579#### Around 50 new Components and 40 hooks
580
581In order to allow more customization and reconfigurability within react-md, more
582low level components are now exported as well as moving some functionality
583within hooks.
584
585#### All Material Icons Available as Components
586
587Since it can be difficult to remember all the icon names or even mistyping a
588font icon name, `react-md@v2` now provides every material icon as a `FontIcon`
589and `SVGIcon` implementation. At the time of writing these release notes, there
590are **932 icons available** which means **1864 icon components**. Check out the
591##material-icons package for more info and previewing every icon.
592
593#### Scoped Packages
594
595Since v2 of `react-md` ended up being a complete re-write, I wanted to create a
596way to be able to slowly update existing apps from v1 to v2 without forcing an
597immediate re-write. Related components will now be grouped and published
598together using the `@react-md` scope as well as the "root" `react-md` package
599that exports everything like normal. If you are completely new to `react-md`, I
600recommend just installing `react-md` while apps that are migrating should use
601the scoped packages.
602
603Please see the [scoped packages] documentation for a more in-depth write up.
604
605#### New Documentation Site
606
607The documentation site has been re-written to use [NextJS](https://nextjs.org/)
608instead of the extremely outdated custom implementation with different webpack
609configs. This should hopefully allow contributors to get started more quickly
610and apply changes as needed. Each page should now also provide a table of
611contents to be able to quickly navigate to a specific heading, demo,
612documentation, etc. There are also some other small other documentation
613improvements that will be outlined below.
614
615> Note: The search behavior needs to be fixed since it was hacked together in
616> about 20 minutes. You should be able to find the majority of components other
617> than the grid components. These can be found in the #utils package as
618> `GridList` and `Grid`.
619
620##### Improved Documentation <!-- no-margin-bottom -->
621
622After reviewing feedback about the v1 documentation site, the main problem areas
623were:
624
625- unable to view the full context of the example code
626- unable to live-edit the example code
627- unable to see the default compiled value for SCSS variables
628- not enough useful documentation around SCSS usage
629- not enough information about the example
630
631To solve the first two issues, a custom
632[sandbox generator script]({{GITHUB_FILE_URL}}/packages/dev-utils/src/sandbox/index.ts)
633was created that resolves every
634[dependency and file name]({{GITHUB_FILE_URL}}/packages/dev-utils/src/sandbox/extract.ts#L58)
635for each demo and generates a
636[sandbox json file]({{GITHUB_FILE_URL}}/packages/dev-utils/src/sandbox/generate.ts#L139).
637This allows for the new and improved
638[DemoSandbox]({{GITHUB_FILE_URL}}/packages/documentation/src/components/DemoSandbox/DemoSandbox.tsx)
639to render all the files for a demo as well as dynamically creating an editable
640code sandbox using the
641[codesandbox define API](https://codesandbox.io/docs/importing#define-api). Each
642demo will now have a button to preview the code in the new `DemoSandbox`, create
643an editable sandbox with [CodeSandbox](https://codesandbox.io/), and a directly
644link to the source code within GitHub to help show the full context of the
645demos. In addition, each demo was updated to hopefully be a lot less complex
646than some that appeared in v1.
647
648The third issue was solved by re-writing the
649[sassdoc generator script]({{GITHUB_FILE_URL}}/packages/dev-utils/src/sassdoc.ts)
650to
651[hackily force compile the scss variable]({{GITHUB_FILE_URL}}/packages/dev-utils/src/utils/getCompiledScssVariable.ts#L134).
652Now if a variable references another SCSS variable, the default compiled value
653can be viewed by enabling the "Default Compiled Value" switch for that variable.
654Check out the
655[\$rmd-alert-theme-values variable](/packages/alert/sassdoc#alert-variable-rmd-alert-theme-values)
656for a quick example.
657
658The forth issue has not been solved completely, but there is now a new solution
659in place by being able to render examples a bit easier within SassDoc and
660showing the compiled value. The
661[rmd-utils-rtl mixin](/packages/utils/sassdoc#utils-mixin-rmd-utils-rtl) has a
662pretty good example to reference for this functionality.
663
664The last issue about missing information for the example has hopefully been
665solved by the new writing patterns throughout the documentation site. Each
666example should now have a bit more information about the components being used
667along with some background information about what the demo is trying to
668accomplish. **Documentation is difficult** so please provide feedback for what
669has been helpful and what has not.
670
671#### GZip Size Comparison
672
673The v2 release has decreased the UMD bundle size by `12.35%` while the CSS
674bundles have increased by `18.56% - 18.75%`:
675
676```sh
677v1 size
678The gzipped UMD bundle size is:
679 - dist/v1/umd/react-md.min.js 98.68 KB
680
681The min and max gzipped CSS bundle sizes are:
682 - dist/v1/css/react-md.yellow-red.min.css 13.2 KB
683 - dist/v1/css/react-md.blue_grey-deep_purple.min.css 13.23 KB
684
685v2 size
686The gzipped UMD bundle size is:
687 - dist/umd/react-md.production.min.js 86.49 KB
688 - dist/umd/react-md-with-font-icons.production.min.js 196.05 KB
689 - dist/umd/react-md-with-svg-icons.production.min.js 196.03 KB
690
691The min and max gzipped CSS bundle sizes are:
692 - dist/css/react-md.grey-deep_orange-200-light.min.css 15.65 KB
693 - dist/css/react-md.indigo-blue-400-dark.min.css 15.71 KB
694```
695
696In addition, v2 _should_ have finally solved the code splitting issue that
697existing in v1 and produce an even smaller bundle if every feature within
698`react-md` is not used.
699
700### In-depth Changelogs
701
702This should be the main highlights for the v2 release. If you are interested in
703an in-depth package-by-package update and changelog, you can view one of the
704following changelogs:
705
706- [@react-md/alert](/packages/alert/changelog#v200)
707- [@react-md/app-bar](/packages/app-bar/changelog#v200)
708- [@react-md/autocomplete](/packages/autocomplete/changelog#v200)
709- [@react-md/avatar](/packages/avatar/changelog#v200)
710- [@react-md/badge](/packages/badge/changelog#v200)
711- [@react-md/button](/packages/button/changelog#v200)
712- [@react-md/card](/packages/card/changelog#v200)
713- [@react-md/chip](/packages/chip/changelog#v200)
714- [@react-md/dialog](/packages/dialog/changelog#v200)
715- [@react-md/divider](/packages/divider/changelog#v200)
716- [@react-md/elevation](/packages/elevation/changelog#v200)
717- [@react-md/expansion-panel](/packages/expansion-panel/changelog#v200)
718- [@react-md/form](/packages/form/changelog#v200)
719- [@react-md/icon](/packages/icon/changelog#v200)
720- [@react-md/layout](/packages/layout/changelog#v200)
721- [@react-md/link](/packages/link/changelog#v200)
722- [@react-md/list](/packages/list/changelog#v200)
723- [@react-md/material-icons](/packages/material-icons/changelog#v200)
724- [@react-md/media](/packages/media/changelog#v200)
725- [@react-md/menu](/packages/menu/changelog#v200)
726- [@react-md/overlay](/packages/overlay/changelog#v200)
727- [@react-md/portal](/packages/portal/changelog#v200)
728- [@react-md/progress](/packages/progress/changelog#v200)
729- [@react-md/sheet](/packages/sheet/changelog#v200)
730- [@react-md/states](/packages/states/changelog#v200)
731- [@react-md/table](/packages/table/changelog#v200)
732- [@react-md/tabs](/packages/tabs/changelog#v200)
733- [@react-md/theme](/packages/theme/changelog#v200)
734- [@react-md/tooltip](/packages/tooltip/changelog#v200)
735- [@react-md/transition](/packages/transition/changelog#v200)
736- [@react-md/tree](/packages/tree/changelog#v200)
737- [@react-md/typography](/packages/typography/changelog#v200)
738- [@react-md/utils](/packages/utils/changelog#v200)
739
740[typescript]: https://www.typescriptlang.org/
741[react hooks api]: https://reactjs.org/docs/hooks-intro.html
742[context api]: https://reactjs.org/docs/context.html
743[custom css properties (css variables)]:
744 https://developer.mozilla.org/en-US/docs/Web/CSS/--*
745[usekeyboardsearch]:
746 {{GITHUB_FILE_URL}}/packages/utils/src/search/useKeyboardSearch.ts
747[usefocusonmount]:
748 {{GITHUB_FILE_URL}}/packages/utils/src/wia-aria/useFocusOnMount.ts
749[usepreviousfocus]:
750 {{GITHUB_FILE_URL}}/packages/utils/src/wia-aria/usePreviousFocus.ts
751[usetabfocuswrap]:
752 {{GITHUB_FILE_URL}}/packages/utils/src/wia-aria/useTabFocusWrap.ts
753[usefocusmovement]:
754 {{GITHUB_FILE_URL}}/packages/utils/src/wia-aria/movement/useFocusMovement.ts
755[useactivedescendantmovement]:
756 {{GITHUB_FILE_URL}}/packages/utils/src/wia-aria/movement/useActiveDescendantMovement.ts
757[usekeyboardmovement]:
758 {{GITHUB_FILE_URL}}/packages/utils/src/movement/useKeyboardMovement.ts
759[autocomplete]: /packages/autocomplete/demos
760[dropdownmenu]: /packages/menu/demos
761[tree]: /packages/tree/demos
762[working with v1]: /guides/working-with-v1
763[creating dynamic themes]: /colors-and-theming/creating-dynamic-themes
764[theme builder]: /colors-and-theming/theme-builder
765[appsizelistener]: /packages/utils/demos#app-size-listener-example-title
766[other themeable values]:
767 /packages/theme/sassdoc#theme-variable-rmd-theme-values
768[media query components example]:
769 /packages/utils/demos#media-query-components-title
770[scoped packages]: /guides/scoped-packages
771[rmd-button-reset]: /packages/button/sassdoc#button-mixin-rmd-button-reset
772[rmd-states-surface]: /packages/states/sassdoc#states-mixin-rmd-states-surface
773[rmd-states-focus-shadow]:
774 /packages/states/sassdoc#states-mixin-rmd-states-focus-shadow
775[rmd-states-pressed-styles]:
776 /packages/states/sassdoc#states-mixin-rmd-states-pressed-styles
777[rmd-states-theme]: /packages/states/sassdoc#states-mixin-rmd-states-theme
778[rmd-states-theme-update-var]:
779 /packages/states/sassdoc#states-mixin-rmd-states-theme-update-var
780[rmd-theme-update-var]: /packages/theme/sassdoc#theme-mixin-rmd-theme-update-var
781[rmd-theme-tone]: /packages/theme/sassdoc#theme-function-rmd-theme-tone
782[rmd-utils-rtl]: /packages/utils/sassdoc#utils-mixin-rmd-utils-rtl
783[rmd-utils-rtl-auto]: /packages/utils/sassdoc#utils-mixin-rmd-utils-rtl-auto
784[rmd-utils-rtl-auto-group]:
785 /packages/utils/sassdoc#utils-mixin-rmd-utils-rtl-auto-group
786[rmd-utils-touch-only]: /packages/utils/sassdoc#utils-mixin-rmd-utils-touch-only
787[rmd-utils-keyboard-only]:
788 /packages/utils/sassdoc#utils-mixin-rmd-utils-keyboard-only
789[rmd-utils-mouse-only]: /packages/utils/sassdoc#utils-mixin-rmd-utils-mouse-only
790[rmd-utils-phone-media]:
791 /packages/utils/sassdoc#utils-mixin-rmd-utils-phone-media
792[rmd-utils-tablet-media]:
793 /packages/utils/sassdoc#utils-mixin-rmd-utils-tablet-media
794[rmd-utils-tablet-only-media]:
795 /packages/utils/sassdoc#utils-mixin-rmd-utils-tablet-only-media
796[rmd-utils-desktop-media]:
797 /packages/utils/sassdoc#utils-mixin-rmd-utils-desktop-media
798[rmd-utils-large-desktop-media]:
799 /packages/utils/sassdoc#utils-mixin-rmd-utils-large-desktop-media