Skip to content

Commit

Permalink
Merge branch 'main' into progress-tracker-motion
Browse files Browse the repository at this point in the history
  • Loading branch information
kristastarr authored Oct 19, 2021
2 parents 8232648 + 7273119 commit 604b088
Show file tree
Hide file tree
Showing 23 changed files with 1,362 additions and 44 deletions.
8 changes: 8 additions & 0 deletions packages/carbon-react/src/components/Tabs/Tabs.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@

import React from 'react';
import { Button, Tab, Tabs, TabsSkeleton } from '../Tabs';
import { unstable_FeatureFlags as FeatureFlags } from 'carbon-components-react';
import { Layer } from '../Layer';

export default {
title: 'Components/Tabs',
decorators: [
(Story) => (
<FeatureFlags flags={{ 'enable-v11-release': true }}>
<Story />
</FeatureFlags>
),
],
parameters: {
component: Tabs,
subcomponents: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@
display: inline-block;
width: 100%;
max-width: rem(320px);
margin-bottom: $carbon--spacing-03;
@if not feature-flag-enabled('enable-v11-release') {
margin-bottom: $carbon--spacing-03;
}

color: $link-01;
cursor: pointer;
outline: 2px solid transparent;
Expand Down
21 changes: 15 additions & 6 deletions packages/components/src/components/form/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
.#{$prefix}--fieldset {
@include reset;

margin-bottom: $carbon--spacing-07;
@if not feature-flag-enabled('enable-v11-release') {
margin-bottom: $carbon--spacing-07;
}
}

.#{$prefix}--fieldset--no-margin {
margin-bottom: 0;
@if not feature-flag-enabled('enable-v11-release') {
.#{$prefix}--fieldset--no-margin {
margin-bottom: 0;
}
}

.#{$prefix}--form-item {
Expand All @@ -42,7 +46,10 @@
@include type-style('label-01');

display: inline-block;
margin-bottom: $carbon--spacing-03;
@if not feature-flag-enabled('enable-v11-release') {
margin-bottom: $carbon--spacing-03;
}

color: $text-02;
font-weight: $input-label-weight;
line-height: 1rem;
Expand Down Expand Up @@ -125,8 +132,10 @@
display: block;
}

.#{$prefix}--form--fluid .#{$prefix}--fieldset {
margin: 0;
@if not feature-flag-enabled('enable-v11-release') {
.#{$prefix}--form--fluid .#{$prefix}--fieldset {
margin: 0;
}
}

.#{$prefix}--form--fluid input[data-invalid] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
height: auto;
min-height: rem(48px);
flex-wrap: wrap;
margin-top: $carbon--spacing-05;
margin-bottom: $carbon--spacing-05;
@if not feature-flag-enabled('enable-v11-release') {
margin-top: $carbon--spacing-05;
margin-bottom: $carbon--spacing-05;
}

color: $inverse-01;

@include carbon--breakpoint(md) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@
width: rem(288px);
height: auto;
padding-left: $carbon--spacing-05;
margin-top: $carbon--spacing-03;
margin-right: $carbon--spacing-05;
margin-bottom: $carbon--spacing-03;
@if not feature-flag-enabled('enable-v11-release') {
margin-top: $carbon--spacing-03;
margin-right: $carbon--spacing-05;
margin-bottom: $carbon--spacing-03;
}

box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
color: $inverse-01;

&:first-child {
margin-top: $carbon--spacing-05;
@if not feature-flag-enabled('enable-v11-release') {
&:first-child {
margin-top: $carbon--spacing-05;
}
}

@include carbon--breakpoint(max) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

display: table;
width: 100%;
margin-bottom: 5rem;
@if not feature-flag-enabled('enable-v11-release') {
margin-bottom: 5rem;
}

background-color: transparent;
border-collapse: collapse;
border-spacing: 0;
Expand Down
4 changes: 3 additions & 1 deletion packages/react/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const customProperties = require('postcss-custom-properties');
const rtlcss = require('rtlcss');

const {
CARBON_ENABLE_V11_RELEASE,
CARBON_ENABLE_V11_RELEASE = 'false',
CARBON_REACT_STORYBOOK_USE_CUSTOM_PROPERTIES = 'false',
CARBON_REACT_STORYBOOK_USE_RTL,
CARBON_REACT_STORYBOOK_USE_SASS_LOADER,
Expand Down Expand Up @@ -69,6 +69,7 @@ module.exports = {
$feature-flags: (
ui-shell: true,
enable-css-custom-properties: ${CARBON_REACT_STORYBOOK_USE_CUSTOM_PROPERTIES},
enable-v11-release: ${CARBON_ENABLE_V11_RELEASE},
);
${content}
`;
Expand All @@ -88,6 +89,7 @@ module.exports = {
$feature-flags: (
ui-shell: true,
enable-css-custom-properties: ${CARBON_REACT_STORYBOOK_USE_CUSTOM_PROPERTIES},
enable-v11-release: ${CARBON_ENABLE_V11_RELEASE},
);
`,
implementation: require('sass'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5905,7 +5905,6 @@ Map {
"label": "provide a label",
"onClick": [Function],
"onKeyDown": [Function],
"role": "presentation",
"selected": false,
},
"propTypes": Object {
Expand Down Expand Up @@ -5946,10 +5945,7 @@ Map {
"renderContent": Object {
"type": "func",
},
"role": Object {
"isRequired": true,
"type": "string",
},
"role": [Function],
"selected": Object {
"isRequired": true,
"type": "bool",
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/FormGroup/FormGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ const FormGroup = ({
className,
message,
messageText,
hasMargin,
hasMargin, // TODO - remove in v11
...other
}) => {
const prefix = usePrefix();
const enabled = useFeatureFlag('enable-v11-release');
const classNamesLegend = classnames(`${prefix}--label`, [
enabled ? null : className,
]);
// TODO - remove `fieldset--no-margin` in v11
const classNamesFieldset = classnames(`${prefix}--fieldset`, className, {
[`${prefix}--fieldset--no-margin`]: !hasMargin,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Tab/Tab-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Tab', () => {
});

it('renders <li> with [role="presentation"]', () => {
expect(wrapper.props().role).toEqual('presentation');
expect(wrapper.find('li').prop('role')).toEqual('presentation');
});

it('renders <button> with tabindex set to 0', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class Tab extends React.Component {
/**
* Provide an accessibility role for your Tab
*/
role: PropTypes.string.isRequired,
role: deprecate(PropTypes.string),

/**
* Whether your Tab is selected.
Expand All @@ -97,7 +97,6 @@ export default class Tab extends React.Component {
};

static defaultProps = {
role: 'presentation',
label: 'provide a label',
selected: false,
onClick: () => {},
Expand All @@ -122,6 +121,7 @@ export default class Tab extends React.Component {
renderAnchor,
renderButton,
renderContent, // eslint-disable-line no-unused-vars
role, // eslint-disable-line no-unused-vars
...other
} = this.props;

Expand Down
8 changes: 7 additions & 1 deletion packages/react/src/components/Tab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/

export default from './Tab';
import * as FeatureFlags from '@carbon/feature-flags';
import { default as TabNext } from './next/Tab';
import { default as TabClassic } from './Tab';

const Tab = FeatureFlags.enabled('enable-v11-release') ? TabNext : TabClassic;

export default Tab;
Loading

0 comments on commit 604b088

Please sign in to comment.