-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
- so you can set theme via global variable
Deploy preview for the-carbon-components ready! Built with commit 76c6725 https://deploy-preview-1872--the-carbon-components.netlify.com |
There was a problem hiding this 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
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 AccordionAccordion is a straight forward example. It may seem a little awkward to split up CSS shorthand like You’ll also notice that included mixins that use color variables like Button
@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. InputNothing new was discovered when creating |
@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? |
@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. |
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. |
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). |
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: Page heros... call to action sections... all just modifications to color: 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 |
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? |
^ 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. |
@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? |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
src/components/button/_mixins.scss
Outdated
&:disabled:focus { | ||
text-decoration: none; | ||
} | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@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 We use the carbon |
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). |
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. |
@asudoh changes to 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@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:
Light UI:
Dark UI:
|
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. 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 |
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. |
My quick experiment showed that we can reduce the bundle including all components from 28K to 8K, minified/gzipped. |
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. |
…input" This reverts commit 9504fa4.
@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 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 If there is concern around governance. Like y'all don't want people like myself touching the lower level APIs. (e.g 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. |
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. |
@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! |
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. 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. |
@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? |
@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 |
- emphasis on reducing CSS bloat
Here are my findings. Using:
You can explore Findings
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
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 @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
}
} |
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. 🤭 |
@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 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 |
@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 @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 |
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. |
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.:
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 |
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? |
* 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
This RFC is the second iteration of #1822. This addresses the feedback on the original RFC to:
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 incarbon-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
!default
s. 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:If you want to use a non-default theme like g10, g90, g100... now you can simply set the new
carbon--theme
global variable.If you wanted to modify one of the alternate themes, you can do that too!
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 classmy-inline-theme
sets$interactive-03
to pink then includes button declaration blocks.Should you want to include an alternate theme as provided by
@carbon-elements
, use the new mixincarbon--theme-overrides
that defines all tokens without!default
so they can globally override the default declarations.To Do
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.
To Do