Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC v2] Sass theming, theme zoning, and whitelabelling #1872

Closed
wants to merge 4 commits into from

Conversation

mattrosno
Copy link
Member

@mattrosno mattrosno commented Feb 21, 2019

This RFC is the second iteration of #1822. This addresses the feedback on the original RFC to:

  1. Minimize breaking changes (renaming files, renaming Sass variables/mixins/functions)
  2. Simplify custom theming
  3. Be able to change more than just colors in inline themes

As demonstrated in the first commit, the only Sass change is calling @include carbon--theme; instead of @include carbon--theme-white();. The rest of the changes are in carbon-elements themes, which as open to change as they were introduced in v10.

Global Variables

Like before, global variables come from many different places specified with !defaults. Sass files often import global variables from @carbon/colors, @carbon/elements themes, etc. You can take any of those and globally define them in your custom Sass build:

$prefix: 'foo'; // from _vars.scss
$interactive-03: pink; // from _theme-tokens.scss, ultimately @carbon/elements
$carbon--orange-40: yellow; // from _colors.scss, ultimately @carbon/colors

@import '../node_modules/carbon-components/scss/global/styles.scss';

If you want to use a non-default theme like g10, g90, g100... now you can simply set the new carbon--theme global variable.

$carbon--theme: 'g90';

@import '../node_modules/carbon-components/scss/global/styles.scss';

If you wanted to modify one of the alternate themes, you can do that too!

$interactive-03: pink;
$carbon--theme: 'g90';

@import '../node_modules/carbon-components/scss/global/styles.scss';

Inline Themes

Regardless if you are using global variables for your default theme or not... you can define inline themes by setting global variables after styles.scss has been built. In this simple example, $interactive-03 is orange in the default theme and the inline theme with namespace class my-inline-theme sets $interactive-03 to pink then includes button declaration blocks.

$interactive-03: orange;

@import '../node_modules/carbon-components/scss/global/styles.scss';

@if feature-flag-enabled('components-x') {
  .my-inline-theme {
    $interactive-03: pink;
    @include button--x;
    // other component mixins go here to include in inline theme
  }
}

Should you want to include an alternate theme as provided by @carbon-elements, use the new mixin carbon--theme-overrides that defines all tokens without !default so they can globally override the default declarations.

$interactive-03: orange;

@import '../node_modules/carbon-components/scss/global/styles.scss';

@if feature-flag-enabled('components-x') {
  .my-dark-theme {
    @include carbon--theme-overrides('g90');
    @include button--x;
    // other component mixins go here to include in inline theme
  }
}

To Do

  • Refactor button example so you can call a colors mixin to prevent inline theme CSS bloat

Whitelabelling

Any global variable with a default value is fair game in default and inline theming. Let's say you wanted bigger buttons in your default theme and giant buttons in an inline theme. Assuming each component has separate colors mixins, if modifying something beyond colors, you'd need to call the full component mixin again.

$button-height: 100px;

@import '../node_modules/carbon-components/scss/global/styles.scss';

@if feature-flag-enabled('components-x') {
  .my-custom-theme {
    $button-height: 200px;
    @include button--x;
    // other component mixins go here to include in inline theme
  }
}

To Do

  • Evaluate button component variables, following Bootstrap's example on variable naming conventions and what component variables they include (colors, text, box model)

- so you can set theme via global variable
@netlify
Copy link

netlify bot commented Feb 21, 2019

Deploy preview for the-carbon-components ready!

Built with commit 76c6725

https://deploy-preview-1872--the-carbon-components.netlify.com

Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍, the code is much cleaner - Good to go from my perspective. Thanks @mattrosno!

- move all use of colors in experimental mixins to new colors mixins to be used in inline theming
@mattrosno
Copy link
Member Author

In the second commit, I demonstrate how we can move color properties to new color-only mixins. That allows us to prevent CSS bloat when using inline themes, since inline themes only include color changes. E.g.

@import '../node_modules/carbon-components/scss/global/styles.scss';

@if feature-flag-enabled('components-x') {
  .my-dark-theme {
    @include carbon--theme-overrides('g90');
    @include accordion-colors--x;
    @include button-colors--x;
    @include text-input-colors--x;
  }
}

Naming convention is that component mixins that only contain colors are suffixed with -colors.

Accordion

Accordion is a straight forward example. It may seem a little awkward to split up CSS shorthand like border into border-width and border-style in the main mixin, and border-color in the colors mixin, but I don’t find that a big deal. As a convention, it’s feels right to keep all use of color variables in the colors mixins.

You’ll also notice that included mixins that use color variables like @include focus-outline('outline’); have been moved to the -colors mixin.

Button

button/_mixins.scss has button-theme--x mixin, and I moved color properties out of that into button-theme-colors--x mixin. That’d be a breaking change, as somebody currently using:

@include button-theme--x(…vars);

Would need to modify to:

@include button-theme--x;
@include button-theme-colors--x(…vars);

If we’re concerned about that breaking change, we could create the button colors mixin in a way that doesn’t change the original theme mixin - it’d just have duplicated non-color declarations in inline theme CSS.

Input

Nothing new was discovered when creating text-input-colors—x, that hadn’t already been done in the accordion example.

@mattrosno
Copy link
Member Author

@asudoh part two of this RFC is ready for review: color-only mixins to use in inline theming. As demonstrated in the second commit and the above comment, I tried it out with three components.

@joshblack do you have any ideas on how we could test for styling regression as this moves around outputted css source order a bit?

@joshblack
Copy link
Contributor

joshblack commented Feb 25, 2019

@mattrosno one potential way for checking this would be to "render" the styles in jsdom and then make sure the CSS Style Rules themselves are the same.

So something like:

test('some selector', async () => {
  // Render Sass to get the output
  const { result } = await renderSass(`
// Imports here
`);

  // Create the stylesheet and add the CSS as its content
  const stylesheet = document.createElement('style');
  stylesheet.textContent = result;

  // Iterate through cssRules to find selector in mind
  const selector = Array.from(stylesheet.cssRules).filter(/* ... */);

  // Make an assertion on the value of the selector
  expect(selector).toMatchSnapshot();
});

Might be able to use globals too like StyleSheet, CSSStyleSheet, CSSSTyleRule, etc.

@joshblack
Copy link
Contributor

Copying note over from the other one, once concern I have is that we would need to parse out anything that is theme-able into it's own mixin. Is there any worry about how this could impact authorship? Seems like it could be easy to do the wrong thing when it comes to color and add it to the selector instead of pulling it out. In addition, would we have to do this for other theme-able properties in the future? For example, type, spacing, etc.

@asudoh asudoh self-requested a review February 26, 2019 04:12
@asudoh
Copy link
Contributor

asudoh commented Feb 26, 2019

Thank you for coming up with the second round of RFC @mattrosno! Not sure if it's the same as what @joshblack brought up above, but wanted to understand why themeable colors are extracted out in a mix-in. It appears that other abstractions we have like variables, lower-level mixins are good enough for many places (e.g. border color of accordion) and CSS bloat is a concern only for extreme cases of customization (e.g. using some other property instead of border).

@mattrosno
Copy link
Member Author

Color-Optimized Inline Theming

@asudoh the purpose of color-only mixins is inline theming. Why optimize inline theming for color overrides? Because that's the need. @joshblack with this approach, you could make an inline theme that modifies more than just colors with:

@import '../node_modules/carbon-components/scss/global/styles.scss';

@if feature-flag-enabled('components-x') {
  .my-crazy-theme {
    $button-height: 400px;
    $button-border-width: 10px;
    @include button--x;
  }
}

This uses the full button mixin. With that comes CSS bloat via unnecessary selector overrides. I don't see that happening often. I expect non-color global overrides to just be needed at the default theme level (also applied to inline themes).

A more realistic example is marketing page striping where sections of the page use alternate themes:
image

Page heros... call to action sections... all just modifications to color:
image

Authorship

@joshblack on authorship, it's just something that we document and enforce along with our BEM-style selectors, component variable naming convention, oh and when you use colors, do so in -colors mixins so those can be cleanly used in inline themes.

@asudoh
Copy link
Contributor

asudoh commented Feb 27, 2019

Thank you for more explanation @mattrosno! Your 2nd screenshot above and the words around it give me an impression that you wanted component-specific, color-only theme zoning. Is it correct?

@asudoh
Copy link
Contributor

asudoh commented Mar 1, 2019

^ If so - From a technical sense I see the current codebase doesn’t have a good way to do that. OTOH, mulling over this topic further, I imagine that applying the notion of theme zoning only to a combination of specific styling area (color) paves a way for applications to easily lose UX coherency. Good to see with designers where we'd go with theme zoning.

@mattrosno
Copy link
Member Author

@asudoh I think our Sass should allow anything to be used in inline themes to allow ultimate flexibility. That being said, I expect (through personal experience, discussions with various teams here) color-only changes to be the primary use of inline theming. That's why this RFC allows anything to be used in inline theming, and optimizes for color-only inline theming to minimize CSS bloat.

@photodow @elizabethsjudd can you chime in with your needs regarding inline theming?

Copy link
Contributor

@elizabethsjudd elizabethsjudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for looking in to this! It's going to make our work in WH so much more manageable. Overall I think this is looking great and I only had a few questions with naming so I can better understand the expectations between the beta and GA releases of Carbon X. Right now there seems to be some inconsistencies and these mixins are going to be referenced out side of Carbon so I want to make sure there are clear expectations.

My other question comes for setting global variables to white label (change aspects that aren't colors). We don't pull the entire suite of Carbon components but pull in the styles on a per component basis (and we advise our users to only pull in the components that they use) to reduce bloat. If we change the value of a global variable for a "zone" wouldn't that create side-effects if that component were to be referenced by another?

@include accordion-colors--x;
}

@mixin accordion-colors--x {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to make sure I understand the future expectations. Once v10 is released, we shouldn't have to be setting the feature flags to get the Carbon X styles. Is the --x going to remain on the mixin names?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we release v10, the default values of feature flags will be flipped. It means that v10 styles will be effective by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's specifically why I asked this... Carbon users use these mixins directly so when the feature flag is turned off we'd have to go and update all reference to these mixins... seems very tedious from a user perspective.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth submitting a request to: https://github.com/carbon-design-system/carbon-upgrade and we can try and include it 👍

For reference, here is how we used it to update color names. We also used it for updating namespaces here for layout.

In v10, we will also be more strict around our sassdoc annotations so that it is clear what is intended for public or private access. These component-level mixins aren't intended for public access, as far as I'm aware. @asudoh feel free to correct me if I'm wrong here 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Right, these are just for conditional import.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The color mixins are 100% meant to be public, that's what my request is for. I want the ability to call a mixin that would change only the colors of a component. If they are private then they provide no value to WH which is why having the --x and changing it with the feature flags does seem realistic for manageability.

@joshblack isn't my request on this repo the request for the update? I don't understand why you're asking to have a duplicate thread.

Copy link
Contributor

@elizabethsjudd elizabethsjudd Mar 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattrosno can you chime in here... this is a very big concern for WH and would basically make a lot of this work moot for us. Were you also under the impression that these would be private mixins? Based on this comment this does not seem to be your impression

&:disabled:focus {
text-decoration: none;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the button-theme mixin to call the button-theme-color mixin like in accordion. https://github.com/IBM/carbon-components/blob/9504fa4d6a3470275cd9eb6f5f5f2d3e6a503f4c/src/components/accordion/_accordion.scss#L277

Another question about future expectations: would button-theme become button and button-theme-color become button-color to align with what is going on with accordion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know where the comment went but I swear I saw an email with a response to this. To be clear, for buttons the button-theme mixin is actually a variant. The name button-theme is confusing given the new inline-theming/zone option that this PR introduces. I wonder if it would be smart to take advantage of the Carbon X release and rename this to be clearer to something like button-variant instead.

@elizabethsjudd
Copy link
Contributor

@mattrosno This is beyond the scope of this PR but as I was reading these files, it would be nice if the mixins were defined in a separate file from the where the @include exports is declared so we can reference only mixins without fear of side effects in our CSS. (This would be a non-breaking change to existing Carbon users)

We use the carbon @include exports in WH and there are still areas where we are getting duplicate code in our generated CSS but I haven't had a chance to dig in to why it's happening on some components and not others. Separating these aspects (code that is stripped from CSS and code that is the CSS output) in to separate files could be a failsafe for these concerns.

@asudoh
Copy link
Contributor

asudoh commented Mar 3, 2019

I'm still concerned on creating a mechanism extracting out components' color definitions to apply flexibility there. Though we strive toward flexibile APIs, I see adding flexibility there comes with significant overhead in our codebase (e.g. how Carbon core authors components) without being cautious on what we do in detail and how.

That's why it's good to better understand what are the underlying use cases behind and work with our designers to see what is the best way to meet the requirement. CC @IBM/carbon-designers to let them take a note and to see a chance to chime in.

What I would imagine about theme zoning is something like applying white theme to the main portion and g10 theme to some portions. Two screenshots in @mattrosno's earlier comment seem to represent such use case. That said, need to understand why @mattrosno seems to be trying to fiddle with our lower-level API instead of our higher-level API (set).

@aagonzales
Copy link
Member

Can we set up a meeting and talk about this in person, to make sure we're (designers) are correctly understanding what's being proposed.

@mattrosno
Copy link
Member Author

That said, need to understand why @mattrosno seems to be trying to fiddle with our lower-level API instead of our higher-level API (set).

@asudoh changes to @carbon/elements/scss/themes as demonstrated in first commit necessary to (1) let app developers set default theme through global Sass variable and (2) let app developers define inline themes in their Sass builds.

Why modify lower-level component APIs? To optimize CSS output (reduce CSS bloat) for the most common use of inline-theming, which AFAIK is only colors. I have discussed the need with @photodow for marketing pages and with @elizabethsjudd for their portfolio's needs.

I guess we need more underlying use cases. No need to meet. @IBM/carbon-designers please share designs or supporting material for needing one theme inside another. After that, if we're in agreement that the primary purpose of inline theming is just for color changes, we then make the authorship vs CSS bloat decision to determine if we move CSS color declarations to mixins that only set colors.

@@ -153,17 +153,18 @@

.#{$prefix}--accordion__item {
transition: all $transition--base $carbon--standard-easing;
border-top: 1px solid $ui-03;
Copy link
Contributor

@photodow photodow Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be too much of a stretch to keep colors where they are like you had them for default theme use, and then you could use the accordion--color mixin to overwrite those colors to optimize the code a little further?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then it's not DRY... we'd have to always remember to include color overrides. Could be easier than having to split up declarations like border-top though... so ya, I'd support that as a viable option.

@sadekbazaraa
Copy link

sadekbazaraa commented Mar 4, 2019

@aagonzales and @jeanservaas have asked me to chime in here with some general thoughts about how the colors are intended to work in regards to our Dark and Light UIs. I’ve been wondering if referring to our default color system as having light and dark “UIs” as opposed to "themes" helps since "themes" seems to be causing confusion in this context.

Here’s a few foundational principles:

  1. There are 2 distinct UIs—Dark and Light. We’ve intentionally avoided the use of midtones and skewed towards either end of the spectrum.
  2. Within each UI, there are several degrees of nuance and flexibility. The background color of the “zone” that is being designed is the primary factor in determining how the rest of the colors are applied.
  3. There are 5 global background colors for any of these zones in the default dark and light UIs. In light, we use White and Gray 10 and in dark we use Gray 100 / 90 / 80.

Light UI:

  1. In general, components with Gray 10 backgrounds are applied to white zones and components with White backgrounds are applied to Gray 10 zones. While this should probably be the limiting case for a default set, there is actually a bit more flexibility within the system. For example, a White table may sit on top of a White zone OR a Gray 10 zone. Both options are viable and constitute the light UI. Similarly, a card component with a White background may sit on top of a White zone OR a Gray 10 zone. Furthermore, both scenarios may exist in the same experience, whether product or digital. Perhaps an alt or an override would be useful to classify these additional degrees of nuance.
  2. The light UI does not use Gray 20 background zones, the nuances are achieved most commonly by alternating between White on Gray 10 and Gray 10 on White combinations. The dark UI is a different beast entirely with different behaviors.

Dark UI:

  1. Contrary to the light UI with its alternating use of White / Gray 10 background layering, the dark UI always gets progressively lighter as layers are added. In other words, we never use a component background that is darker than the background zone it's being applied to. The same is true of interaction states, such as hover, selected and active.
  2. In general, Gray 90 components are applied to Gray 100 background zones and Gray 80 components are applied to Gray 90 background zones.
  3. Similar to the light UI, there is also the possibility of having a Gray 100 table sitting atop a Gray 100 background zone. The same applies to cards and various other components. To reiterate the possibility, perhaps the default set is Gray 90 on Gray 100 and Gray 80 on Gray 90 with alts and overrides being used to achieve combining the same component and background color as needed.
  4. Another nuance within the system for dark UI is that one could also apply a Gray 80 component to a Gray 90 OR a Gray 100 background. One way to simplify may be to have the default case be 80 on 90 with an alt to use 80 on 100.
  5. Because our layering gets progressively lighter in the dark UI, there are some occasions where we might use a Gray 70 component on a Gray 80 background. This scenario would be in the case of compound components specifically. For example, you may have a background zone of Gray 90 that you’ve applied a Gray 80 card too. Then on top of that Gray 80 card is an overflow menu with it’s own background color. In this case the overflow background would be Gray 70. The use of Gray 70 is only applicable in this compound component scenario.

@sadekbazaraa
Copy link

It's much easier to grasp the concepts written above with visual examples. Attached is the latest working version of the Color UI page on Design Language for reference.

color_ui

@sadekbazaraa
Copy link

sadekbazaraa commented Mar 4, 2019

I'm going to do my best to outline some thinking around how our tokens and variables might work. Of course I have 0% experience as a developer so I know very little about how tokens work but in a few discussions with different devs early on it did not seem entirely out of the ordinary to have a set of tokens that were dependent on another variable.

In regards to our system, I've always contemplated the tokens being dependent on the primary background color that the component is being applied to—White / G10 / G100 / G90 / G80. The same token would give you different colors dependent on which of the 5 global background colors are being used.

Take links for example, there isn't a single link color across the board. Even in light and dark UIs respectively, link colors are different depending on which zone it's sitting on. Primary buttons may be the only component that is the same across all of our backgrounds, everything else has a high degree of nuance driven by accessibility requirements above all else.

With all of that in mind. I'll share an exploration from many months ago regarding how tokens might play out for links. Again, I have no idea how this works so it should be considered merely as a logical exercise. Potential token names on the right, background color across the top and the table of values in between.

screen shot 2019-02-08 at 4 38 12 pm

The main thing to consider is how and if it's possible to have singular tokens return the correct value based on which global background it's sitting on. I think this was the whole notion of cascading tokens that we were talking about with the gal from the Lightning system a few weeks back.

Ok, hope some of this expose is useful...

S

@asudoh
Copy link
Contributor

asudoh commented Mar 5, 2019

Thanks @mattrosno for explaining that the attempt to fiddle with lower-level API is for de-duping CSS rules, and @sadekbazaraa for outlining the theme zoning requirements in detail.

Starting with theme zoning requirements, though there are some constraints wrt what theme can be on what background, the set constraints are not as hard as I had imagined and I have an impression that it may not make sense to bake in the constraints to our Sass API level.

Wrt the requirements of de-duping CSS rules, I see the requirements is fair. My suggestion is utilizing toolchain instead of changing our Sass API. e.g. It's fairly easy to extract out non-color CSS rules with PostCSS. IIRC @joshblack has created JavaScript version of theme token table, and with that, I think we can extract out CSS rules just of theme colors.

In this way, we can focus on (possibly) defining theme-zoning API, without being worried about performance optimizations.

@asudoh
Copy link
Contributor

asudoh commented Mar 5, 2019

My quick experiment showed that we can reduce the bundle including all components from 28K to 8K, minified/gzipped.

@mattrosno
Copy link
Member Author

Thanks for sharing @sadekbazaraa. @asudoh regarding component mixins and the desire to not change them unless we need to... let me do this. Unless I hear otherwise, I'm under the impression that inline theming will be primarily done for only colors changes. (Components in inline themes can leverage modifiers if they need changes beyond color.)

I'll evaluate (1) baseline CSS bundle (minified/gzipped) all components as you did. Then (2) if a user defines an inline theme that includes all components using our mixins as-is. Then (3) as @photodow suggested, creating new color-only override mixins for each component to only use those in the inline theme.

I hope that will help give confidence in inline theming approach so we can make it happen.

@photodow
Copy link
Contributor

photodow commented Mar 5, 2019

@mattrosno thanks for the hard work on this. It's really looking great!

For Digital Design performance is critical. Especially where we are in development at the moment, and how it relates to theming. At the moment, it's looking like we'll need each variation for each component built out. As @mattrosno's work in progress here tries to avoid, I'd really like to avoid building out and delivering 4 copies of each component to our adopters. (That can get large fast even when you're using a minimum number of components) Anything we can shave off using these component color mixins would be very much appreciated. If padding isn't necessary in a g100 theme when it's already defined with the default white then why include it? With that said unless y'all have another solution in mind the separation of colors look like a great way to minimize the theming's impact on performance.

I don't know if y'all will support this in the future, but another need outside of color we have is updating the majority of the components to body-long-02 instead of the current default of body-long-01. I think @mattrosno addressed this need in this WIP as well. I have a hard time seeing at the moment we need it to be inline. After discussing with him things like this can be defined at the component level, and cross all theme variants.

If there is concern around governance. Like y'all don't want people like myself touching the lower level APIs. (e.g button--x, button--color--x) I wonder if adopters like myself could pass in the themes including potentially new themes to build it all vs. giving us the button--color--x and expecting us to build the themes. If possible this could potentially improve governance, simplicity from adopters like myself, and even enforce more consistency with the naming conventions and more. See example below...

Instead of adopters like myself doing the following that was proposed.

@import '@carbon/themes/scss/mixins.scss';
@import '~carbon-components/scss/components/accordion/accordion';

@if feature-flag-enabled('components-x') {
    @include button-colors--x; // default

    .my-theme-g10 {
        @include carbon--theme-overrides('g90');
        @include button-colors--x;
    }

    .my-theme-g90 {
        @include carbon--theme-overrides('g90');
        @include button-colors--x;
    }

    .my-theme-g100 {
        @include carbon--theme-overrides('g100');
        @include button-colors--x;
    }
}

We pass in the theme names we want to include, and y'all cycle through and build within the component?

// custom-pink theme defined earlier at the global level
$import-themes: ['g10', 'g90', 'g100', 'custom-pink'];

@import '~carbon-components/scss/components/accordion/accordion';

Just some thoughts, but maybe I'm getting ahead of the discussion here, or not have a full understanding of implications yet. Either way, if y'all still need more use cases after what @sadekbazaraa shared let me know, I'd be happy to track down some that we've worked directly on, and even some out in wild on IBM.com.

@elizabethsjudd
Copy link
Contributor

I like @photodow's idea for the default themes (would make things even easier for the end user) but I do think that doesn't resolve the issue for our users that need to be able to white-label. We need the flexibility to call these mixins ourselves and make changes as needed without having to constantly change the name.

@mattrosno
Copy link
Member Author

@photodow @elizabethsjudd thanks for the feedback! This is great. I'll crank out another commit to demonstrate how I see this working and get your feedback. Stay tuned!

@asudoh
Copy link
Contributor

asudoh commented Mar 5, 2019

Just in case I was not clear enough - Even though I see theme zoning is mostly about colors, I do not think it's a good idea fiddling with e.g. button-theme mix-in for the purpose of theme zoning (BTW I think button-theme name is confusing, as it's for defining different button variant). Given the requirement around fiddling with such mix-in is eliminating redundant style rules, we can do it with additional toolstack instead.

Creating styles for alternate themes in an application can be done by building our Sass code with alternate settings, and we may define a higher-level API for that purpose.

@mattrosno
Copy link
Member Author

Given the requirement around fiddling with such mix-in is eliminating redundant style rules, we can do it with additional toolstack instead.

@asudoh can you give an example? What specific tool/library could take CSS like:

.foo {
  height: 100px;
  width: 100px;
  position: relative;
  background-color: red;
  border: 1px solid blue;
}

.my-theme .foo {
  height: 100px;
  width: 100px;
  position: relative;
  background-color: yellow;
  border: 1px solid green;
}

And optimize as

.foo {
  height: 100px;
  width: 100px;
  position: relative;
  background-color: red;
  border: 1px solid blue;
}

.my-theme .foo {
  background-color: yellow;
  border-color: green;
}

Or something similar so an inline theme with all components included doesn't nearly double CSS filesize?

@asudoh
Copy link
Contributor

asudoh commented Mar 6, 2019

@mattrosno It's PostCSS: https://postcss.org. It creates AST for CSS and where you can mangle - Very similar to Babel for JS. If we separate the former/latter rulesets, we can apply something like https://github.com/rsanchez/css-color-extractor, which is a PostCSS plugin. Extending that PostCSS plugin to apply color extraction only to ones with the selector beginning with .my-theme should be do-able, too.

@mattrosno
Copy link
Member Author

mattrosno commented Mar 6, 2019

Here are my findings. Using:

# get file size
du -h filename.css

# get file size when gzipped
gzip -c filename.css | wc -c

You can explore demo/scss/demo.scss to see the custom Sass builds for scenarios 1 - 4 below. I also made temporary changes to gulpfile.js so I had minified demo CSS.

Findings

File Size Gzipped
(1) Normal build all components
demo.css 272KB 30.0KB
demo.min.css 216KB 27.2KB
(2) With inline theme all components
demo.css 428KB 47.0KB
demo.min.css 352KB 43.2KB
(3) With inline theme all components using color override mixins
demo.css 328KB 35.4KB
demo.min.css 264KB 32.4KB
(4) With inline theme all components using PostCSS
demo.css 332KB 35.9KB
demo.min.css 272KB 32.7KB

It's clear that (3) file size is much better than (2). As shown in previous commit, color-only override mixins are very tedious and error-prone. (4) uses PostCSS to eliminate the need for authoring color-only override mixins. Using Gulp like so:

const postcss = require('postcss');
const colorsOnly = require('postcss-colors-only');
const removeSelectors = require('postcss-remove-selectors');

const inlineTheme = () =>
  through.obj((file, enc, callback) => {
    // 1. split up default and inline theme declarion blocks
    const defaultCSS = postcss()
      .use(
        removeSelectors({
          selectors: [/.my-dark-theme/],
        })
      )
      .process(file.contents.toString(enc)).css;

    const themeCSS = postcss()
      .use(
        removeSelectors({
          selectors: [/^((?!.my-dark-theme).)*$/],
        })
      )
      .process(file.contents.toString(enc)).css;

    // 2. only keep color declarations for the inline theme
    const themeColorsCSS = postcss()
      .use(colorsOnly())
      .process(themeCSS).css;

    // 3. concatenate default and optimized inline theme
    file.contents = Buffer.from(
      `${defaultCSS}
      ${themeColorsCSS}`,
      enc
    );

    callback(null, file);
  });

gulp.task('sass:dev:compiled', () =>
  gulp
    .src('demo/scss/demo.scss')
    .pipe(sourcemaps.init())
    .pipe(
      header(`
        $feature-flags: (
          components-x: true,
          breaking-changes-x: true,
          grid: true,
          ui-shell: true,
        );
      `)
    )
    .pipe(
      sass({
        includePaths: ['node_modules'],
        outputStyle: 'compressed',
      }).on('error', sass.logError)
    )
    .pipe(
      autoprefixer({
        browsers: ['> 1%', 'last 2 versions'],
      })
    )
    .pipe(inlineTheme())
    .pipe(
      rename(filePath => {
        filePath.extname = `.min${filePath.extname}`;
      })
    )
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('demo'))
    .pipe(browserSync.stream({ match: '**/*.css' }))
);

Recommendation

  1. Create issue to update theme from @carbon/elements as shown in first commit. We don't need to touch any lower-level component Sass APIs.
  2. Make sure all components are authored in mixins that can be included in inline themes. Also move feature flags around so the user doesn't have to include experimental --x mixins.
  3. Document how to override default theme in Sass build and how to inline theme.
  4. Document how to use PostCSS to de-dupe CSS when using inline theming.
  5. Move component variables to better support whitelabelling to a new RFC.

To reiterate, inline theming works like so, where after primary styles are built, you set your namespace class, whatever global variables you want (or use a helper like carbon--theme-overrides('g90')) and include just the components that you want in that inline theme.

@import '../../src/globals/scss/styles';
@if feature-flag-enabled('components-x') {
  .my-dark-theme {
    @include carbon--theme-overrides('g90');
    @include accordion;
    @include breadcrumb;
    // other components here
  }
}

@photodow
Copy link
Contributor

photodow commented Mar 6, 2019

Just trying to understand, but if y'all decide to go the PostCSS route you're removing duplicate CSS on build and begin to dictate/influence adopter's build process? Am I understanding that option correctly?

Maybe y'all are already doing that, and I'm just improperly building the code base. 🤭

@elizabethsjudd
Copy link
Contributor

@mattrosno Is the gulp work that you did going to actually be delivered to Carbon users? We do this a lot in WH (look at our tools package) and it looks like it's pretty repeatable that it could be distributed with Carbon to users that want it.

To be clear, the new recommendation is that there isn't any new mixins and it's to use PostCSS (btw this was a really interesting concept. I've used PostCSS but not this plugin specifically). My question that still remains about the accordion mixin is currently meant to be private mixins and the name needs changed based on the the feature flag. But the demo code specifically shows the "user" calling these mixins.

@mattrosno
Copy link
Member Author

@photodow my opinion is that Carbon can't optimize product Sass builds, but we can share best practices on how to do so given product needs.

@elizabethsjudd I think it'd be great to define our build tools in an exportable way. Might need to be more of a post-v10 effort.

Correct, my recommendation is to leverage PostCSS and not create new mixins. Related to #1856, I understand the desire to not call --x mixins for inline theming. I'll add that to the recommended TODO list, moving the feature flag in the main mixin. E.g., from:

@mixin accordion {}

@mixin accordion--x {}

@include exports('accordion') {
  @if feature-flag-enabled('components-x') {
    @include accordion--x;
  } @else {
    @include accordion;
  }
}

To:

@mixin accordion {
  @if feature-flag-enabled('components-x') {
    @include accordion--x;
  } @else {
    // styles here
  }
}

@mixin accordion--x {}

@include exports('accordion') {
  @include accordion;
}

So accordion is public to be used in inline themes, and accordion--x is private. Is that what you're looking for?

@scottnath
Copy link

Hey @mattrosno, if there isn't a second mixin for colors, but a developer needs alternate color versions of a given component, but they do not have the skillset/permission/access/whatever to change the build process, doesn't that leave them with bloated code and no way to fix it?

This choice feels like it's mixing the skillsets required to use carbon's sass files. It's not abnormal for the front-end UI person to have no access to changing the build processes. Seems like this hurdle could be avoided if the white-label-able parts were in their own mixin.

@asudoh
Copy link
Contributor

asudoh commented Mar 7, 2019

Great to hear that @mattrosno could achieve optimization to CSS output he needed! Given that, the only question here seems whether we want to make component mixins public. Given it was originally for stable/experimental switch and had no intention to make it public, we need to be careful to some extent. e.g.:

  1. Should the component mixin take a theme token map as an optional argument, defaulting to the one of the applied theme?
  2. Should we rename stable mixin so we can use that name (e.g. @mixin button) for entry-point purpose (doing stable/experimental switch inside)? - This discussion item will be stale once we do cleanup to eliminate stable code after v10 release, but just wanted to note

@scottnath

It's not abnormal for the front-end UI person to have no access to changing the build processes.

PostCSS we are discussing here is similar to Sass compiler from the perspective of the complexity of build toolchain setup - Instead of introducing a big leap there. PostCSS generates a mangled version of .css from a .css file, similar to Sass compiler that generates a .css file from a .scss file. Hope this makes sense.

@joshblack
Copy link
Contributor

Hey @mattrosno! 👋 Seems like the RFC has gone quiet, are we down for closing it and moving forward with the theme work over in elements?

@mattrosno mattrosno closed this Mar 19, 2019
joshblack pushed a commit to joshblack/carbon that referenced this pull request May 2, 2019
joshblack added a commit that referenced this pull request May 8, 2019
* fix(Storybook): IE11 fix (#1779)

This fix workarounds storybooks/storybook#5080.

*  fix(list-box): Prevent focus on open/close icon (#1772)

* fix(list-box): Prevent focus on open/close icon

* fix(date-picker): Prevent focus on date-picker/input icon

* fix(date-picker): Prevent focus on date-picker/input icon - snap

* fix(a11y): avoid empty label in ToggleSmall (#1771)

Fixes #1183.

* feat(OverflowMenu): add experimental OverflowMenu (#1767)

* docs(OverflowMenu): support `flipped` storybook knob

* chore: bump carbon-components version

* fix(OverflowMenu): pass trigger node and flip prop through FloatingMenu

* docs(FloatingMenu): fix typo

* fix(OverflowMenu): handle click on trigger button div

* fix(MultiSelect): avoid repeated assignment of ids (#1795)

* feat(ContentSwitcher): add experimental ContentSwitcher (#1716)

* docs(ContentSwitcher): use experimental icons

* fix(ContentSwitcher): match vanilla markup

* feat(ContentSwitcher): support `disabled` attribute

* chore: bump carbon-components version

* docs(OrderedList): create component story (#1723)

* fix(TimePicker): update markup to match experimental component (#1747)

* fix(TimePicker): update markup to match experimental component

* docs(TimePicker): fix typo

* chore(lint): ensure lint-staged formats the code (#1803)

* fix(Tile): reorder component markup for a11y (#1774)

* fix(TileGroup): use fieldset element for TileGroup wrapper

* fix(Tile): place label after input control

* test(Tile): account for new React.Fragment wrapper

*  docs(TextInput): expose `defaultValue` prop as Storybook knob (#1808)

* chore: update offline package mirrors

* docs(TextInput): expose `defaultValue` prop as Storybook knob

* docs(components): usage of feature flags (#1794)

* feat(NumberInput): add experimental NumberInput (#1654)

* docs(FormItem): add `hideLabel` prop to storybook example

* feat(NumberInput): align NumberInput markup with vanilla repo

* test(NumberInput): remove form item wrapper check

* Revert "feat(NumberInput): align NumberInput markup with vanilla repo"

This reverts commit 6abb5fcf2a5b2d9a329ce9739fee22628df4e132.

* refactor(NumberInput): set default label value to empty string

* Revert "test(NumberInput): remove form item wrapper check"

This reverts commit c780e6a85231b948db541a119ba2c2a4602f9db9.

* refactor(NumberInput): set default labelText based on feature flag

* fix(NumberInput): match vanilla markup

* fix(NumberInput): match vanilla markup and use caret glyph icons

* refactor(NumberInput): use React fragment syntax

* fix(ui-shell): improve keyboard accessibility (#1813)

* fix(ui-shell): remove aria menu keyhandlers

* fix(ui-shell): remove unused variables

* fix(ui-shell): return focus to menu button on escape

* fix(ui-shell): remove unused variables

* fix(ui-shell): run prettier and update snap shots

* fix(ui-shell): handle keydown enter on nested menuitems  (#1816)

* fix(ui-shell): remove aria menu keyhandlers

* fix(ui-shell): remove unused variables

* fix(ui-shell): return focus to menu button on escape

* fix(ui-shell): remove unused variables

* fix(ui-shell): run prettier and update snap shots

* fix(ui-shell): handle keydown enter on menuitems

* chore(ui-shell): update snapshots

* fix(ui-shell): refactor some event handler logic with Josh

* chore(ui-shell): update snapshots

* docs(OverflowMenu): highlight floatingMenu and primaryFocus (#1812)

* docs(Storybook): more detailed doc for using our Storybook (#1809)

* docs(Storybook): more detailed doc for using our Storybook

* Update docs/components.md

Co-Authored-By: asudoh <asudoh@gmail.com>

* Update README.md

Co-Authored-By: asudoh <asudoh@gmail.com>

* docs(Storybook): minor updates

* fix(tab-content): add prefix to content classname (#1784)

* fix(tab-content): add prefix to content classname

* fix(tabs): remove unnecessary classname

* fix(radiobuttongroup): custom class should merge with base class (#1818)

* feat(ListBoxMenuIcon): support translatable SVG icon title (#1802)

* feat(ListBoxMenuIcon): support translatable SVG icon title

* feat(MultiSelect): pass custom SVG titles to ListBoxMenuIcon

* chore: update snapshot

* refactor(MultiSelect): use callback pattern for assigning SVG title

* chore: update snapshot

* fix(MultiSelect): remove default `translateWithid` prop value

* chore: update snapshot

* feat(PaginationV2): add experimental Pagination (#1800)

* chore: bump carbon-components version

* feat(PaginationV2): add experimental Pagination

* chore: bump carbon-components version

* fix(Pagination): render page range only when page input is enabled

* refactor(Pagination): remove `isLastPage` prop

* refactor(Notification): remove unused props (#1832)

* chore: Update wai-aria on tooltip. resolve #1494 (#1823)

* chore: Update wai-aria on tooltip. resolve #1494

* chore: Updates test.

* chore: reverts triggers to div with button roles.

* AccordionSkeleton: Properties added (#1821)

* refactor(AccordionSkeleton): Converted skeleton from class to functional component

* feat(AccordionSkeleton): Added option to show first item opened or not

* fix(AccordionSkeleton): Number of items differ for first item opened and closed variations

* feat(AccordionSkeleton): Option to set number of items added

* chore: bump webpack-dev-server in example package.json (#1830)

* chore: bump webpack-dev-server in example package.json

* fix: use caret prefix

* Update 'InnerClickListener'  (#1825)

* Update 'InnerClickListener'
- check if event target exists in DOM
- if it does not exist, should not trigger onClickOutside

* Run prettier

* Implemented suggestions fix

* Fix failing tests

* reordering boolean test elements

* Trying different approach for IE fix

* Attempt to fix failing test

* Attempt fix 2 - check if target === body

* Testing simpler version

* Test simpler 2

* fix(InnerClickListener): added test case and reverted to previous fix

* fix(InnerClickListener): Removing outdated comment

*  feat(AccordionItem): add experimental Accordion Item (#1835)

* feat(AccordionItem): add experimental Accordion Item

* test(AccordionItem): Fixes tests for new icon components

* chore(AccordionItem): Use aria label prop

* fix(AccordionItem): Remove role null

* chore(AccordionItem): Remove icon prop

* chore(AccorionItem): Adds role null back into legacy icon

* docs(examples): usage of react-router, resolves #795 (#1797)

* docs(examples): usage of react-router, resolves #795

* docs(examples): address prettier errors

* docs(examples): remove svg

* docs(examples): address review comments and use prebuilt css

* docs(examples): accidentally updated incorrect file

* fix(components): avoid being shown as ForwardRef (#1787)

* fix(components): avoid being shown as ForwardRef

Fixes #1786.

* chore: use ForwardRef(ComponentName)

* chore(components): avoid Object.assign() for ref forwarding components

* Update src/components/Checkbox/Checkbox.js

Co-Authored-By: asudoh <asudoh@gmail.com>

* chore: bring missing React.forwardRef() call back

* chore: bring missing React.forwardRef() call back

* feat(ProgressIndicator): add experimental progress indicator (#1726)

* feat(ProgressIndicator): update SVG icons and match experimental markup

* feat(ProgressIndicator): support experimental overflow tooltip

* fix(ProgressIndicator): avoid passing style prop to nested tooltips

* fix(ProgressIndicator): allow assignment of tooltip ID for each step

* refactor(ProgressIndicator): use render prop for overflow tooltip

* refactor(ProgressIndicator): set default progress step label

* refactor(ProgressIndicator): remove else-returns

* docs(g11n): notes of globalization (#1826)

* docs(g11n): notes of globalization

Refs IBM/carbon-components#1335.

* Update docs/g11n.md

Co-Authored-By: asudoh <asudoh@gmail.com>

* fix(Slider): remove redundant updatePosition() call (#1840)

`updatePosition()` used to be called in `cDM()` for initial
prop->state sync. Given we have got new prop->state sync code in
`v10`, such logic is no longer needed.

Fixes #1839 for `v10`.

* fix(Tabs): re-implement tab-content classname (#1846)

* fix(MultiSelect): fixed translateWithId prop-type, resolves #1847 (#1849)

* feat(Notification): allow composable notification content (#1856)

* Revert "refactor(Notification): remove unused props (#1832)"

This reverts commit c2c6b70585f3f8ef09fb2e9e3cb36f844ffcff99.

* fix(Notification): add experimental icons

* docs(Notification): add prop type comments

* docs(Notification): remove unneeded wrapper divs

* feat(Notification): allow composable notification content

* feat(OverflowMenu): add arrow key navigation (#1822)

* refactor(OverflowMenu): use keycode matching util functions

* refactor(OverflowMenuItem): refactor to class component for ref access

* feat(OverflowMenu): add arrow key navigation

* fix(OverflowMenuItem): avoid spreading invalid attributes

* feat(OverflowMenu): focus on first menu item on menu open

* docs(OverflowMenu): avoid redundant prop value

* fix(OverflowMenuItem): disallow tab key navigation

* fix(OverflowMenu): close menu on blur

* docs(OverflowMenu): add additional menu to test keyboard navigation

* fix(OverflowMenu): prevent blur handler is menu is floating

* feat(DataTable): support radio button selection (#1824)

* refactor(RadioButton): remove deprecated lifecycle methods

* feat(DataTable): support radio button selection

* docs(DataTable): add radio button selection story

* fix(InlineCheckbox): add expected onChange prop

* fix(RadioButton): add expected props and default values

* test(DataTable): add radio button selection tests

* test(DataTable): refactor existing tests to use new helper function

* chore: update snapshots

* refactor(TableSelectRow): dynamically assign tag

* docs: add additional `propTypes`

* fix(ui-shell): add aria label to sidenav with complimentary landmark (#1848)

* fix(a11y): add aria label to complimentary landmark

* fix(jest): update snapshot tests

* fix(ui-shell): remove wrapper aside element

* fix(ui-shell): update snapshots

* fix: remove bitwise operators (#1857)

* fix(NumberInput): add aria attributes for a11y (#1841)

* fix(NumberInput): add aria attributes for a11y

* feat(NumberInput): support translations on arrow control labels

* fix: (<DataTable>): filter without boolean column" (#1858)

* feat(Tabs): allow custom className for `<TabContent>` (#1855)

* fix(modal): uses secondary button on danger modal for componentsX (#1861)

* feat(DataTableSkeleton): add optional headers property (#1862)

* feat(DataTableSkeleton): add optional headers property

* feat(DataTableSkeleton): specify prop-type

* Update issue templates

Adds an accessibility specific issue template to help expedite issue triage and help me stay on top of existing issues.

* fix: run prettier to fix issues with new md (#1872)

* fix(tile): typo in clickable variation knob desc (#1867)

* fix(TableExpandRow): pass headers value to fix a11y violation (#1792)

* fix(TableExpandRow): pass headers value to fix a11y violation

* fix: run prettier on changed files

* docs: add relevant URL into proptypes comments

* chore(Tooltip): deprecate non-click-to-open in regular tooltip (#1873)

* chore(Tooltip): deprecate non-click-to-open in regular tooltip

Fixes #1864.

* Update src/components/Tooltip/Tooltip.js

Co-Authored-By: asudoh <asudoh@gmail.com>

* fix(overflowMenu): include iconProps for CarbonX version (#1881)

* feat(DropdownV2): highlight selected item in drop down (#1869)

* feat: support experimental icon strategy (#1838)

* refactor: support experimental icon strategy

* fix(Notification): remove unneeded boolean check

* chore: avoid default icon import entry point

* fix(Tooltip): ensure debounce function is cleaned-up (#1882)

Fixes #1871.

Note that the feature this fix is applied to has been deprecated.

* docs(experimental): update instruction to change feature flags (#1875)

* docs(build): update instruction on building carbon-coponents style (#1874)

Refs IBM/carbon-components#1754.

* fix(Modal): NPE check for focusable element ref (#1887)

* feat: allow tabs to accept any react node (#1886)

* chore: bump icons dependency (#1884)

* Tooltip with custom icon (#1814)

* feat(Tooltip): custom icon support

* feat(Tooltip): custom icon support

* feat(Tooltip): custom icon support with the renderIcon approach

* feat(Tooltip): custom icon support with forward ref

* feat(Tooltip): custom icon support with forward ref, update @carbon/icons-react

* feat(Tooltip): custom icon support with forward ref, fix typo in tests

* feat(Tooltip): custom icon support, update @carbon/icons-react

* Update src/components/Tooltip/Tooltip.js

Co-Authored-By: devniel <dnielfs@gmail.com>

* feat(Tooltip): custom icon support, add react-is to validated forwardRef components

* feat(Tooltip): custom icon support, add react-is to validated forwardRef components

* feat(Tooltip): custom icon support, add react-is to validate forwardRef components

* feat(datatable): custom classes support for TableSelectAll and TableSelectRow (#1894)

* fix(DropdownV2): uses strict equality operator to know if item is highlighted, resolves #1898 (#1900)

* fix(ToggleSmall): replace `class` prop with `className` (#1902)

* fix(ToggleSmall): replace `class` prop with `className`

* docs(ToggleSmall): remove unused props

* feat(Button): allows button to render arbitrary component as its root (#1891)

* feat(Button): allows button to render arbitrary component as its root

leverages a render prop to allow consumers to render whatever they want in place of button or anchor

closes #1890

* refactor(Button): consolidates code to choose button node type

* fix(Button): fixes props to button and anchor components

* refactor(Button): renames render prop to as

* chore(components): remove deprecated components (#1606)

* chore(components): remove deprecated components

Refs IBM/carbon-components#1501.

* chore(test): move describeBreakingChangesXFeatures() to setup

* chore: some cleanup

* chore: resolve merge conflict

* fix(OverflowMenu): check menu body and click handler event origin (#1903)

* fix(OverflowMenu): check menu body and click handler event origin

* docs(Toolbar): add input props to radio button

* fix(datepickerinput): update logic for displaying icon for carbonX (#1906)

* docs(Button): add example with custom link component as root (#1910)

* docs(Button): remove hard-coded type prop

* docs(Button): add example with custom link component as root

* fix(Checkbox): ensure indeterminate DOM property is set (#1788)

Fixes #1785.

* feat(MultiSelect): add open prop (#1793)

* feat(MultiSelect): add isOpen prop

* feat(MultiSelect): add state handling for open prop

* fix(MultiSelect): test update

* chore(Storybook): add knob for danger in ModalWrapper (#1914)

Fixes #640.

* fix(Toggle): hide on/off test for screen readers (#1865)

* fix(Toggle): hide on/off test for screen readers

Refs IBM/carbon-components#1794.

* fix(Toggle): replace fieldset/legend with div

* chore(Toggle): turn to class and use setupGetInstanceId

* chore(tag): fix class name (#1928)

* chore: bump `carbon-components` version (#1950)

* chore(dependencies): upgrade carbon-components (#1962)

Fixes IBM/carbon-components#1964.

* fix(DatePicker): fix tabbing through in range mode (#1957)

* fix(DatePicker): fix tabbing through in range mode

Refs #1899.

* chore(build): update size threshold

* feat(components): support custom icon renderer (#1908)

* feat(components): support custom icon renderer

Fixes #1750, #1749.

* chore(Button): change code style of the story

* fix: get rid of console error from using ref on SFC (#1969)

* fix: get rid of console error from using ref on SFC

* fix(ui-shell): add displayName for ui-shell link

* feat(components): support forwardRef for button and stateful (#1859)

* feat(components): support forwardRef for button and stateful

Refs #1191, #1777.

* chore(components): s/forwardRef/innerRef/g

* fix(MultiSelect): remove item autosort behavior (#1926)

* fix(ProgressIndicator): fix wrong prop (#1922)

* fix(OverflowMenu): assign menu body ref for non-floating menu (#1920)

* fix(Tooltip): assign correct classes (#1917)

* fix(toggle): add checkmark icon for v10 mini toggle (#1936)

* fix(number-input): use required prop `iconDescription` in CarbonX icons (#1975)

* fix(number-input): use required prop `iconDescription` in CarbonX icons

* fix(number-input): use deconstruction

* fix(number-input): apply aria-label to up-icon per PR feedback

Co-Authored-By: jendowns <hello@jendowns.com>

* fix(number-input): apply aria-label to down-icon per PR feedback

Co-Authored-By: jendowns <hello@jendowns.com>

* chore: prettier change

* docs(components): introduce misc migration guides (#1959)

Refs #1759.

* Deprecate non floating overflow menu (#1961)

* chore(OverflowMenu): deprecate non-floating option

Fixes #1921.

* docs(OverflowMenu): add migration guide

* feat(multi-select): address accessibility tabbing issue (#1731)

* Added keydown to open, fixed a11y tabbing issue

* Linting

* Addressed reviews

* fixup

* linting

* added test coverage for list-box

* ran prettier

* feat(RadioButton): support labelPosition prop (#1930)

* feat(RadioButton): support labelPosition prop

Fixes #1913.

* chore(RadioButton): code format change

* chore(RadioButton): deprecate/remove top/bottom option

* fix(DropdownV2): expect string or object for `selectedItem` prop (#1946)

* feat(footer): deprecate for v10 (#1960)

Fixes #1956.

* feat(Notification): remove for v10 (#1978)

Superseded by `<InlineNotification>` and `<ToastNotification>`.

Fixes #1958.

* feat(FloatingMenu): support refs (#1988)

Fixes #1778.

* docs(components): introduce migration guides for renderIcon and ref props (#1976)

* docs(components): introduce migration guides for renderIcon and ref props

Refs #1759.

* test(DataTable): test tweaks

* docs(RadioButton): formatting fix

* [Feat] Add ability to render item other than string for HeaderMenu (#1980)

* feat: add ability for component to render any content instead of a string

* chore: update snapshot for change in HeaderMenu

* test: adding test for HeaderMenu

* test: add test for content prop

* feat: remove dropdown chevron when content is rendered

* refactor: changed to function component based on code review

* refactor: name change from code review

* chore(OverflowMenuItem): warn missing closeMenu prop (#1955)

Fixes #1951.

* docs(migrate): add migration docs and update README (#1993)

* docs(migrate): add migration docs and update README

* Update docs/migration/README.md

Co-Authored-By: joshblack <josh@josh.black>

* Update docs/migration/migrate-to-10.x.md

Co-Authored-By: joshblack <josh@josh.black>

* Update docs/migration/migrate-to-10.x.md

Co-Authored-By: joshblack <josh@josh.black>

* Update docs/migration/migrate-to-10.x.md

Co-Authored-By: joshblack <josh@josh.black>

* Update docs/migration/migrate-to-10.x.md

Co-Authored-By: joshblack <josh@josh.black>

* Update docs/migration/migrate-to-10.x.md

Co-Authored-By: joshblack <josh@josh.black>

* Update docs/migration/migrate-to-10.x.md

Co-Authored-By: joshblack <josh@josh.black>

* Update docs/migration/migrate-to-10.x.md

Co-Authored-By: joshblack <josh@josh.black>

* chore(lint): Add no-typos for react linting (#2000)

* fix: Add titles to buttons that encapsulate icons (#1982)

* fix: Add titles to buttons that encapsulate icons

* fix: update snapshots

* feat: add missing title tags to icon buttons

* fix: update snapshots

* fix(DatePicker): fix month input appearance (#2004)

By incorporating  IBM/carbon-components#1977.

Fixes #2001.

* chore(components): simplify react node tree structure (#1997)

Such optimization is done for stateless components with
`React.forwardRef()`, optimizing the React node tree from:

```
<ForwardRef(TextInput) ...>
  <TextInput ...>...</TextInput>
</ForwardRef(TextInput)>
```

To:

```
<ForwardRef(TextInput) ...>...</ForwardRef(TextInput)>
```

Refs #1768.

* fix(DatePicker): match experimental spec (#1966)

* fix(DatePicker): use new SVG icon markup

* fix(DatePicker): use correct flatpickr config option

* fix(DatePickerInput): match experimental markup

* chore: update carbon-components

* docs(migrate): update README.md (#1998)

* feat(NumberInput): add experimental mobile variant (#1983)

* feat(NumberInput): add experimental mobile variant

* chore: bump carbon-components version

* chore: bump dependencies

* fix(NumberInput): reorder default legacy props for icon description

* style(NumberInput): rename prop

* chore: bump carbon-components version

* style(NumberInput): rename prop type

* chore: bump carbon-components version

* chore(components): update required polyfills (#1938)

* chore(components): update required polyfills

Fixes #1934.
Fixes #1517.

* docs(migration): add polyfills to root migration doc

* fix(TextInput): match text input to experimental spec (#1990)

* chore: bump dependencies

* fix(TextInput): add disabled classes

* chore: bump carbon-components version

* fix(TextInput): add invalid class for input field

* chore(search): search audit (#2005)

* chore(package): update carbon-components

* chore(search): remove lg search and add xl

* chore(search): update icon

* chore(search): add aria label

* chore(search): update tests

* chore(search): remove default value to none

* chore(search): guard against breaking changes

* fix(OverflowMenu): match experimental spec (#2007)

* chore: bump carbon-components version

* fix(OverflowMenu): properly align menu item icons

* chore: bump carbon-components version

* docs(OverflowMenu): refactor example menus

* chore: bump carbon-components version

* feat(ProgressIndicator): add optional interactivity (#1945)

* fix(DatePicker): protect flatpickr in shallow render tests

* fix(DatePicker): add comment to describe the Null check

* fix(DatePicker): protect callbacks against this.cal NPE

* test(DatePicker): add testcase to cover shallow behavior

* feat(progressindicator): add interactivity if onChange prop is passed

* fix(progressindicator): few small style fixes to the focus outline

* fix(progress): support experimental mode

* fix(progress): typoed the key to check, fix proptypes errors

* fix(progress): current step should not be interactive

* fix(progress): added reference to the new styles and additional tests

* chore(package): update peer dep to latest carbon

* fix(progressindicator): remove unnecessary index check

* ContentSwitcher react, audit fixes (#2038)

* chore(content-switcher): remove icon support

* chore(content-switcher): set icon and a/href for v9 only

* chore(content-switcher): update to new carbon-components

* feat(Link): add disabled prop (#2024)

* feat(Link): add disabled prop

* docs(Link): add disabled knob

* chore(components): support SVG title attribute for icon description (#1977)

* chore(components): support SVG title attribute for icon description

Refs #1750.

* test(components): adjust tests with the new DOM structure

* chore(components): moving away from alt for icons

* chore(Tooltip): use correct prop for title

* chore(components): revert ones with surrounding button

* test(components): test fixes

* fix(Notification): match experimental spec (#2020)

* chore: upgrade @carbon/icons-react

* fix(Notification): render toast icons

* feat(Notification): support iconDescription

* Revert "chore: upgrade @carbon/icons-react"

This reverts commit 78fa3f8d4867056e7a1e750e22c9e403025d76d4.

* chore: bump @carbon/icons-react version

* chore: update snapshots

* refactor(Notification): account for modified React node tree

* fix(Notification): expect proper SVG asset

* chore: bump carbon-elements version

* chore: bump carbon-components version

* chore(Button): remove danger--primary from v10 demo (#2044)

* chore(Button): remove danger--primary from v10 demo

Refs #2027.

* docs(Button): update migration guide

* fix(Slider): add proper support for disabled state (#2034)

* docs(components): add process to migration document (#2049)

- fix component typo
- add additional Icon migration instruction

* fix(Select): match experimental spec (#2030)

* fix(Select): match experimental spec

* fix(Select): add legacy helper text

* chore: bump carbon-components version

* chore: bump carbon-components version

* fix(Select): backport support for v9 inline helper

* fix(Tooltip): support click-to-open with no-icon scenario (#2047)

Fixes #2046.

* chore: bump carbon-components version (#2060)

* feat(data-table): add renderIcon to TableBatchAction (#2056)

* Audit: Pagination fixes (react) (#2057)

* chore(pagination): screen reader UX fixes

* chore(pagination): hide label

* test(components): support v10 code (#2031)

* test(components): support v10 code

Fixes #2032.

* chore(test): mac support

* chore(test): use setup file instead of sed

* test(components): update tests upon latest commits

* chore: Yarn updates

* fix(Select): add aria-label back on chevron

* Fix tooltip a11y issue (#2065)

* https://github.com/IBM/carbon-components-react/issues/2063

https://github.com/IBM/carbon-components-react/issues/2063

* remove the space

* fix(TextArea): match experimental spec (#2036)

* fix(TextArea): add disabled class to label

* fix(Textarea): match experimental spec

* fix(TextArea): add disabled class to input

* chore: bump carbon-components version

* chore: bump carbon-components version

* chore: bump carbon-components version

* feat(breadcrumb): add support for current page (#2054)

* feat(breadcrumb): add support for current page

* chore(breadcrumb): add new prop types behind feature flag

* chore(breadcrumb): update imports in storybook

* Update Breadcrumb-story.js

* fix(Button): add disabled state for other nodes (#2067)

* fix(Button): add disabled state for other nodes

* chore: bump carbon-components version

* docs(Button): incorporate button set wrapper

* chore(code-snippet): add margin to seperate skeletons (#2075)

* chore(code-snippet): add margin to seperate skeletons

* chore(code-snippet): remove px

* chore(code-snippet): fix label

* chore(tabs): add padding in tabs to content story (#2077)

* fix: deprecate the appendTo prop in date picker (#2062)

* fix: deprecate the appendTo prop in date picker

* fix: Add deprecation warning

* fix: typos in warning

* fix(progress-indicator): remove ternary for null label, update story name (#2073)

* Pagination screen reader tweak (#2069)

* chore(pagination): screen reader UX fixes

* chore(pagination): hide label

* chore(pagination): screen reader label tweak

* chore(pagination): re-implement stuff. set story and default props better

* fix(progressIndicatorSkeleton): Update html to fix styling (#2084)

* fix: update skeleton svg for progress indicator

* chore: update html

* refactor(Slider): replace Carbon TextInput (#2085)

* docs(storybook): add rtl addon (#2092)

* docs: add rtl addon

* fix: add offline files

* fix: add more offline files

* feat(DataTable): Add sorting params to header onClick callback (#2083)

* feat(DataTable): Add sorting params to header onClick callback

* chore(build): update size threshold

* fix(progressIndicatorSkeleton): Update html to fix styling (#2084)

* fix: update skeleton svg for progress indicator

* chore: update html

* refactor(Slider): replace Carbon TextInput (#2085)

* feat(DataTable): Add sorting params to header onClick callback

* fix(SkeletonText): support SSR (#2095)

* fix(SkeletonText): support SSR

Fixes #2013.

* chore: update bundle size threshold

* Update issue templates

Removing myself from being auto assigned. Carbonated auto-ping-bot incoming!

* chore(format): run prettier (#2099)

* docs(7.x): update docs to reference v7 instead of v10 (#2100)

* docs(7.x): update docs to reference v7 instead of v10

* Update migrate-to-7.x.md

* chore(DataTable): update exports test

* docs(migration): misc updates (#2105)

* docs(migration): misc updates

Refs #2100.

* docs(components): migration guides to more components

* feat(Icon): deprecate name prop (#2104)

Refs #2100.

Aligns the actual behavior to that doc update.

* fix(DropdownV2): match experimental spec (#2093)

* docs(DropdownV2): add invalid knob

* chore: bump carbon-components version

* fix(ListBox): add v10 listbox classes

* fix(DropdownV2): add disabled form and v10 classes

* refactor(ListBox): deprecate `type` prop

* feat(DropdownV2): integrate v10 listbox

* test: update snapshots and inline variant test

* Revert "refactor(ListBox): deprecate `type` prop"

This reverts commit 642c01ac3cef2970e0d1fc8c9b88e343db9db0a3.

* Revert "test: update snapshots and inline variant test"

This reverts commit d98db03c3a11cd3b746e97e3ccc44a846d2f676d.

* docs(ListBox): add propType

* fix(Dropdown): use listbox light and invalid style

* docs(DropdownV2): change options list placeholder

* fix(Dropdown): remove breaking changes flag

* test: update snapshots

* chore: bump carbon-components version

* chore: bump carbon-components version

* chore: bump carbon-components version

* chore: bump carbon-components version

* fix(ListBoxMenuItem): add conditional for v10

* fix(DropdownV2): add disabled class

* fix(DropdownV2): add light class

* chore: update snapshots

* refactor(ListBoxMenuItem): remove unneeded attrs

* chore: bump carbon-components version

* refactor(DropdownV2): remove wrapper from v9

* chore: update snapshot

* feat(modal): make modal a focus trap (#2096)

* fix(modal): add focus-trap-react package

* fix(modal): make modal a focus trap

* chore(modal): update snapshots

* fix(modal): move focus trap to outer-inner modal

* fix(modal): remove focusButton, onBlur, onTransitionEnd

* fix(modal): add asudoh suggested changes

* fix(modal): reverting changes

* chore(modal): update snapshot

* fix(modal): get tests passing

* fix(modal): add check for open modal

* chore(modal): update snapshot

* chore(pagination): use en dash instead of hyphen (#2115)

* chore(pagination): use en dash instead of hyphen

* chore(pagination): update test with en dashes in expected content

* chore(pagination): more en dash

* chore(pagination): more en dash

* docs(Search): make input value editable (#2121)

* docs(Search): expose defaultValue instead of value

* chore(Search): update prop types

* feat(project): release v10 (#2089)

* feat(project): update dependencies and feature flags

* chore(project): sync offline mirror

* chore(project): update dependencies

* chore(examples): prevent duplicate module name

* chore(project): update snapshots

* test: add exports test

* feat(table): remove old table exports

BREAKING CHANGE: TableData and TableRowExpanded have been removed.

* feat(tooltip-simple): remove TooltipSimple

BREAKING CHANGE: The TooltipSimple component has been removed.

* feat(DropdownV2): move DropdownV2 to Dropdown

BREAKING CHANGE: DropdownItem removed, DropdownV2 is now Dropdown

* fix(Dropdown): remove reference to DropdownItem

* chore(format): run prettier

* Revert "fix(Dropdown): remove reference to DropdownItem"

This reverts commit 920a1607ea7e38bfaa53dc993acaf5b9ef0ef829.

* Revert "feat(DropdownV2): move DropdownV2 to Dropdown"

This reverts commit 4cdbadc05ab1c71955238a1793e04f3653b89aba.

* feat(dropdown): rename DropdownV2 to Dropdown

BREAKING CHANGE: Dropdown now points to DropdownV2

* feat(components): remove Footer component

BREAKING CHANGE: the Footer component has been removed

* feat(pagination): rename PaginationV2 to Pagination

BREAKING CHANGE: Pagination now points to PaginationV2

* chore(storybook): remove experimental preview

* feat(icon): remove name prop

BREAKING CHANGE: the name prop for Icon has been removed

* chore(package): v10.0.0-rc.0

* chore(package): update carbon-components to 10.0.0-rc.0

* chore(project): fix license in package.json

* Revert "feat(icon): remove name prop"

This reverts commit 752c6fc099270436fb999b669ae854b3dda07b99.

* chore(storybook): invert feature flags

* chore(storybook): fix icon story errors and knob options (#2)

* chore(ModalWrapper): update snapshot

* chore(ci): remove semantic-release

* chore(project): update carbon-components to v10

* chore(ci): temporarily disable storybook publish step (#2122)

* chore(ci): temporarily disable storybook publish step

* chore(project): sync offline mirror

* feat(project): update to v7.0.0 (#2123)

* chore(pagination): remove unused stuff (#2129)

* fix: apply correct aria label prop for radio (#2079)

* chore: apply correct aria label prop for radio

* feat: add hideLabel to RadioButton

* fix(TextInput): add invalid attr on wrapper div (#2134)

* docs(ModalWrapper): use unique radio button values (#2144)

* chore(build): upgrade rollup (#2156)

* fix: add disabled label styles (#2159)

* fix(DatePickerInput): add disabled label styles

* fix(TimePicker): add disabled label styles

* chore(test): upgrade Jest/Enzyme (#2157)

* fix(Modal): fix NPE at onTransitionEnd (#2141)

Caused by `onTransitionEnd` on a child element in modal, presumably
when modal node ref hasn't been ready yet.

Fixes #2140.

* Update migrate-to-7.x.md (#2132)

* Update migrate-to-7.x.md

* fix: prettier

* FEAT(SideNav): Side nav focus state (#2150)

* feat(sidenav): add ability to change default expanded state

* feat(sidenav): add focus class to sidenav when a child holds focus

* refactor(sidenav): conditionally use expand class instead of adding new focus one

* refactor(sidenav): added gDSFP as suggested from code review

* refactor(sidenav): removed changes from PR #2146

* refactor(sidenav): add state check in handleBlur

* chore(build): upgrade Yarn (#2154)

And a change to ensure a specific version of Yarn runs.

* chore(lint): introduce commitlint (#2155)

Also introduces 50/72 rule.

* chore(lint): upgrade prettier (#2153)

* fix(DataTable): update data-table styles and add description prop (#2127)

* feat: update data-table styles and add description prop

* fix: update snapshots

* chore: remove old icons

* chore: update snapshots

* feat: Add expansion and sorting functionality

* test: update snapshots and tests

* docs: update default table to be sortable

* feat: add class to parent/sibling on hover

* test: update snapshots

* fix: update sort prop to match header

* fix: use previousElementSibling and combine event handlers

* fix: don't use toggle

* FEAT(SideNav):  add ability to change default expanded state (#2146)

* feat(sidenav): add ability to change default expanded state

* refactor(sidenav): add gDSFP to sidenav component

* chore(sidenav): updated snapshots

* refactor(sidenav): rename prop

* test(sidenav): add additional test

* refactor(sidenav): changed name of state

* Adds README.md for MultiSelect component (#2139)

* docs(MultiSelect): adds README.md that describes use cases

* feat(MultiSelect): adds withReadme on stories.

* would to will

* updates readme

* corrects grammar

* adds you

* removes itemToSting that was not neede

* docs(MultiSelect): prettier

* docs(migration): remove unreleased block (#2176)

* fix(multi-select): introduce translateWithId (#2175)

Fixes #2162.

* feat(OverflowMenu): add menuOptionsClass to overflowMenu (#2174)

* feat: add menuOptionsClass to overflowMenu

* refactor: use the destructured prop

* fix(TimePicker): add carbon text input classes (#2169)

* fix(modal): set initial focus and conditionally render focus trap (#2163)

* fix(Modal): get focus behavior in sync with/without focus-trap

* fix(modal): remove unused focus-trap, createFocusTrap

* chore(modal): update snapshots

* v7.0.1 (#2190)

## [7.0.1](https://github.com/IBM/carbon-components-react/compare/v7.0.0...v7.0.1) (2019-04-10)


### Bug Fixes

* add disabled label styles ([#2159](https://github.com/IBM/carbon-components-react/issues/2159)) ([fe9fd41](https://github.com/IBM/carbon-components-react/commit/fe9fd41))
* apply correct aria label prop for radio ([#2079](https://github.com/IBM/carbon-components-react/issues/2079)) ([1fb7214](https://github.com/IBM/carbon-components-react/commit/1fb7214))
* **DataTable:** update data-table styles and add description prop ([#2127](https://github.com/IBM/carbon-components-react/issues/2127)) ([4196a39](https://github.com/IBM/carbon-components-react/commit/4196a39))
* **Modal:** fix NPE at onTransitionEnd ([#2141](https://github.com/IBM/carbon-components-react/issues/2141)) ([09c248a](https://github.com/IBM/carbon-components-react/commit/09c248a)), closes [#2140](https://github.com/IBM/carbon-components-react/issues/2140)
* **multi-select:** introduce translateWithId ([#2175](https://github.com/IBM/carbon-components-react/issues/2175)) ([e769f33](https://github.com/IBM/carbon-components-react/commit/e769f33)), closes [#2162](https://github.com/IBM/carbon-components-react/issues/2162)
* **TextInput:** add invalid attr on wrapper div ([#2134](https://github.com/IBM/carbon-components-react/issues/2134)) ([bbbcff8](https://github.com/IBM/carbon-components-react/commit/bbbcff8))

* docs: update codepen example (#2186)

* fix: delete build folders (#2202)

* v7.1.0 (#2203)

* fix(DataTableSkeleton): headers prop can now be array of objects to match DataTable (#2181)

* fix(data-table-skel): headers can be array of objs

* fix(data-table-skel): pr feedback

* fix: use new classnames (#2200)

* fix(content-switcher): update markup to match v10 changes (#2209)

* chore(ci): re-enable storybook, remove experimental (#2199)

* fix(tooltip): handle esc keydown event (#2164)

* fix(tooltip): handle esc keydown event

* chore(tooltip): update snapshots

* chore(tooltip): update snapshots

* fix(tooltip): add keys.js module

* fix(tooltip): add event.code object to key.js

* chore(package): remove bowser dependency (#2213)

* chore(project): update eslint to 5.16.0 (#2214)

* refactor: update SideNav state management (#2208)

* refactor: update SideNav state management

* test: update snapshots

* test: update snapshots and tests

* refactor: change listener API, pass dom event

* test: update snapshots

* fix: handleToggle arguments

* refactor: use strict undefined check for control

* docs(migration): add block to refer to Carbon X (#2210)

* chore(project): add clean task (#2215)

* chore(project): add clean task

* chore(yarn): sync yarn.lock file

* chore(rollup): update rollup and config (#2216)

* chore(rollup): update rollup and config

* Update rollup.config.js

* Update package.json

* chore(build): change main field reading order

* feat(project): update React and dependencies to 16.8.6 (#2212)

* fix(Modal): adds text to modalAriaLabel on story. (#2217)

* chore(project): update babel deps, remove unused plugins (#2211)

* chore(project): update babel deps, remove unused plugins

* chore(project): sync offline mirror

* chore(storybook): update babel config to read from package.json

* chore: update carbon-components for storybook (#2221)

Brings in new styles and updates for data table work

* fix(ComboBox): match experimental spec (#2158)

* feat(ComboBox): add title and helper text support

* feat(ComboBox): support invalid state

* docs(ComboBox): add knob for light variant

* refactor(ComboBox): match vanilla invalid state

* fix(ListBox): pass aria label and role into menu

* fix(ListBoxMenuIcon): add `role="button"`

* fix(ListBox): require id for listbox menus

* fix(ListBox): add aria attrs for listbox inputs

* fix(ComboBox): pass `isOpen` to `<ListBox>`

* fix(ListBoxField): set default negative tabindex

* fix(ListBox): remove tabindex on wrapper div

* test(ListBox): remove outdated tests

* test(ListBoxField): test modifiable tabindex prop

* chore: update snapshots

* docs: add `ariaLabel` propType

* test: pass in example IDs

* docs(ListBox): remove unused propType

* fix(Dropdown): remove unneeded ListBox prop

* chore: update snapshots

* fix: add IDs for Dropdown and Multiselect control

* chore: update snapshots

* fix(Dropdown): make listbox field tabbable

* fix(MultiSelect): make listbox field tabbable

* fix(FilterableMultiSelect): remove unused prop

* chore: update snapshots

* chore: bump carbon-components version

* feat(Toggle and ToggleSmall): on Enter key press toggle action is being triggered. (#2219)

* fix(Toggle): adds event for key.wich===13

* fix(ToggleSmall): adds event for key.wich===13

* fix(Toggle): adds helpers for keypress

* fix: adds helpers for keypress

* fix: adds actions

* fix(Icon): removes description default value (#2235)

* fix(Icon): no alt in svg (#2243)

* chore(commitlint): disable scope-case (#2225)

We are historycally using React component name for scope when we change
React component.

* fix(Tabs): avoid stale tab ref cache (#2224)

The problem happens when `selected` and `children` changes at the same
time.

Fixes #2204.

* fix(Loading): adds aria-label and description property to component (#2252)

* fix: adds property description

* fix: adds description property to aria-label

* fix: typo

* fix: typo

* fix(Modal): fix button type in danger mode (#2254)

* fix(Modal): fix button type in danger mode

Fixes #2249.

* test(Modal): update for danger button

* fix(notification): adds aria-label to button (#2255)

* fix(notification): adds aria-label to button

* fix(notification): remove test label

* fix(accordion): remove role=presentation (#2256)

* fix(code-snippet): add screen reader accessibility improvements (#2165)

* fix(code-snippet): add alert role to copy verification

* fix(code-snippet): add aria-describedby, aria-labelledby to inline snippet

* fix(code-snippet): add unique id to aria-describedby

* fix(code-snippet): remove breaking change

* fix(codesnippet): preserve ariaLabel

* fix(InputField) -  adds aria-label property on `input` element (#2262)

* fix: adds property ariaLabel

* fix: adds ariaLabel into the label of the inout

* fix: typo

* fix: adds aria-label on input and not on label

* feat: Table toolbar v10 (#2247)

* chore: update carbon-components for storybook

* feat: add initial toolbar updates

* fix: default props

* test: update snapshots

* test: update tests

* test: fix tests

* test: update snapshots

* chore: update peer deps

* feat: add new modifiers, update stories, add knobs

This commit adds all of the new modifiers and removes the unusued ones.
All of the datatable stories have been updated to reflect new markup
and to expose knobs to adjust shared modifiers.

The dynamic content story was updated to use the new menu system. This
also adds support for styles that have not been added yet (row size).

* test: update snapshots

* test: update snapshots

* fix: update proptypes and use cx lib

* test: update snapshots

* fix: add sortable prop and update snaps

* chore: refine story responsibilities

This updates the stories so that they only use the feature they are
showcasing. This will prevent users from bringing in DataTable features
that they don't need.

A "kitchen sink" data table might be useful as well.

* fix: add a11y updates

* test: fix tests

* Update src/components/DataTable/TableToolbar.js

Co-Authored-By: vpicone <vpicone@gmail.com>

* fix: remove tab index

Received the following linting error when attempting to define tabindex
on the section component:

`tabIndex` should only be declared on interactive
elements.eslint(jsx-a11y/no-noninteractive-tabindex)

* test: update snapshots

* fix(Tooltip): adds esc listener (#2248)

* fix: adds esc listener

* fix: adds open

* fix: clean listener on unmount

* chore: add test for 2209 (#2218)

* fix(Tooltop): a11y improvements (#2245)

* fix(Icon): no alt in svg

* fix(Tooltip): ✅ removes IconTitle

* fix(Tooltip): ✅ removes aria-owns - should not used in tooltip pattern

* fix(Tooltip): ✅ adds sensible default aria-label. "Help" not "tooltip"

* fix(Tooltip): ✅ aria-labels are now set on the Icon only and not in the div

if the user provides property `triggerText`, then the button should use aria-labelledby to point to its id, if the user doesn't provide property `triggerText`, then they need to provide an aria-label via the `iconDescription` property.

* fix(Tooltip): ✅ aria-labels

* fix: FinalIcon is now shown when Icon is there

* fix: rearanges

* fix: refs cannot be passed into func components

* fix: adds proptypes validation using helpers

* fix: ref a propRef

* fix(Tab): add missing disabled prop (#2234)

Refs #1293.

* fix(pagination): add noLabel prop to Select (#2260)

* fix(pagination): add noLabel prop to Select

* fix(pagination): preserve hideLabel

* fix(pagination): add noLabel use comment

* fix(pagination): add proptypes

* docs(DataTable): Update documentation for DataTable expansion (#2276)

- Update to reflect that no `TableCell` should be a child of `TableExpandedRow`
- Update to add `colSpan` property to the `TableExpandedRow` element

* fix(tooltip): remove aria-owns (#2273)

* chore(components): better name with forwardRef (#2281)

This change updates React component name for various forward-ref'ed
components from just `<ForwardRef>` to  something like
`<ForwardRef(TextInput)>`.

Refs #1768.

* fix(Pagination): pageInputDisabled won't disable buttons (#2264) (#2278)

* feat: update SideNav and Menu (#2294)

- Use new PropTypes.elementType to allow for `Link`
- Make menu icons optional

* v7.2.0 (#2296)

* Multi select v9 selection behaviour (#2090)

* feat(MultiSelect): Selected items will not move to top

* feat(MultiSelect): Selected items move to top after reopening dropdown

* chore: update snapshots

* Add stalebot. Update exemptions after it runs once (#2289)

* feat(Tabs): support custom tab content (#2142)

Fixes #2028.

* fix(OverflowMenu): cleanup timeout upon unmount (#2259)

Fixes #2114.

* fix(DataTable): selection fix (#2271)

* fix(DataTable): selection fix

* fix(DataTable): updating snapshots for tests

* refactor(DataTable): keeping the same keys

* refactor(DataTable): updated optional proptypes

* docs(DataTable): storybook + README

* fix(ComboBox): prevent open upon clear (#2257)

Fixes #1984.

* fix(MultiSelect): apply tWI to selection (#2268)

Fixes #2267.

* docs(Modal): update prop type comment (#2275)

Closes #2272.

* fix(NumberInput): avoid validation for space (#2280)

Fixes #2106

* docs(Pagination): fix typo (#2284)

* docs(Toggle): expose `disabled` knob (#2285)

* chore(components): remove v9 code (#2269)

* chore(components): remove v9 code

Refs IBM/carbon-components#2308.

* chore(DatePickerInput): remove fragment

* fix(Dropdown): pass translationWithId through (#2298)

* fix: add TableToolbarMenu to default exports (#2301)

* fix: add TableToolbarMenu to default exports

* test: update snapshots

* chore(readme): fix broken ci status badge photo (#2305)

* chore(SideNav): align icon API to other components (#2306)

Fixes #2008.

* fix(Modal): accept nodes to heading (#2303)

Fixes carbon-design-system/carbon-components#629.

* chore(components): complete removing icon prop (#2302)

Refs carbon-design-system/carbon-components#2308.

* fix(tile): various DAP fixes (#2258)

* fix(tile): move aria-label, use unique ids

* fix(tile): re-add aria-label to chevron

* fix(tile): add unique id

* fix(tile): move uid call into creation

* fix(tile): merge master and add ID prop

* Update src/components/Tile/Tile.js

Co-Authored-By: dakahn <40970507+dakahn@users.noreply.github.com>

* Update src/components/Tile/Tile.js

Co-Authored-By: dakahn <40970507+dakahn@users.noreply.github.com>

* Update src/components/Tile/Tile.js

Co-Authored-By: dakahn <40970507+dakahn@users.noreply.github.com>

* Update src/components/Tile/Tile.js

Co-Authored-By: dakahn <40970507+dakahn@users.noreply.github.com>

* fix(overflow-menu): remove add from menu (#2309)

* Update stale.yml (#2310)

Changing the label of stale bot issue closers to `inactive` from `wontfix`

* fix(modal): screen reader improvements (#2299)

* fix(modal): change title add proper headings

* chore(modal): update snaps

* chore(modal): update snapshot

* fix(modal): add back the title attr

* chore(modal): update snapshots

* feat(MultiSelect): match experimental spec (#2239)

* chore(Storybook): remove RTL plugin (#2316)

This change removes RTL plugin of Storybook. Though it's a nice add-on,
we require an additional build step to generate RTL version of CSS and
that Storybook add-on does not seem to kick off an altern ate build.

Refs #2053.
Refs #2314.
Refs #2286.

* feat(TextInput): add password visibility toggle for text fields (#2323)

* docs(TextInput): describe PropTypes

* chore: update carbon peer dependencies

* docs(TextInput): modify `type` storybook knob

* feat(TextInput): add password visibility toggle

* docs(TextInput): add `text` option to storybook types knob

* test(TextInput): test password visibility toggle TextInput

* refactor(TextInput): create PasswordInput component

* feat(PasswordInput): allow custom `alt` text attribute

* refactor(PasswordInput): pull out shared function

* feat(PasswordInput): display tooltip text on hover of visibility toggle

* feat: add ControlledPasswordInput component

* feat(ControlledPasswordInput): set default `type` prop value

* test(TextInput): add tests for PasswordInput and ControlledPasswordInput

* feat(PasswordInput): allow custom password visibility toggle alt text

* fix(PasswordInput): export named password input components

* docs(TextInput): refactor story for storybook v4

* fix(PasswordInput): match experimental spec

* fix(PasswordInput): rename attribute

* test(TextInput): checkout test from master

* test(TextInput): fix console warning

* feat(ControlledPasswordInput): match v10 spec

* test(PasswordInput): rename suite

* test(ControlledPasswordInput): add test suite

* fix(TextInput): add data-invalid attribute for v10

* refactor: remove v9 code

* chore: sync forwardRef changes

* chore: update lockfile

* docs: revert comment changes

* docs: space between propTypes

* chore(react): sync offline mirror

* chore(components): sync docs to local folder

* docs(github): update to include question for package

* chore(ci): update CI config and steps for lint-staged

* chore(project): sync yarn.lock

* chore(project): sync offline mirror

* chore(react): update storybook dependency

* chore(react): update dev env to use source path

* chore(project): update commitlint settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants