From 60c5512c7290ec4a6074808e25aaf320afb28d0c Mon Sep 17 00:00:00 2001 From: "Andrea N. Cardona" Date: Wed, 18 Aug 2021 12:49:56 -0500 Subject: [PATCH 1/5] feat(textInput, textArea, Select): move classNames to outer wrapper --- .../src/components/Select/Select-story.js | 51 ++++++++++++++++++- .../react/src/components/Select/Select.js | 31 +++++++---- .../src/components/TextArea/TextArea-story.js | 23 ++++++++- .../react/src/components/TextArea/TextArea.js | 22 ++++++-- .../components/TextInput/TextInput-story.js | 33 ++++++++++-- .../src/components/TextInput/TextInput.js | 9 +++- 6 files changed, 146 insertions(+), 23 deletions(-) diff --git a/packages/react/src/components/Select/Select-story.js b/packages/react/src/components/Select/Select-story.js index a82356b74400..60cf630a3d9c 100644 --- a/packages/react/src/components/Select/Select-story.js +++ b/packages/react/src/components/Select/Select-story.js @@ -14,6 +14,7 @@ import SelectItem from '../SelectItem'; import SelectItemGroup from '../SelectItemGroup'; import SelectSkeleton from '../Select/Select.Skeleton'; import mdx from './Select.mdx'; +import { FeatureFlags } from '../FeatureFlags'; const sizes = { 'Small (sm)': 'sm', @@ -23,7 +24,7 @@ const sizes = { const props = { select: () => ({ - className: 'some-class', + // className: 'some-class', light: boolean('Light variant (light in )', @@ -125,3 +126,51 @@ Skeleton.parameters = { `, }, }; + +export const classNameChangeTest = () => { + return ( +
+ +
+ + + +
+ ); +}; diff --git a/packages/react/src/components/Select/Select.js b/packages/react/src/components/Select/Select.js index 46bcd539bebe..97c79aee11bd 100644 --- a/packages/react/src/components/Select/Select.js +++ b/packages/react/src/components/Select/Select.js @@ -15,6 +15,7 @@ import { WarningAltFilled16, } from '@carbon/icons-react'; import deprecate from '../../prop-types/deprecate'; +import { useFeatureFlag } from '../FeatureFlags'; const { prefix } = settings; @@ -42,15 +43,19 @@ const Select = React.forwardRef(function Select( }, ref ) { - const selectClasses = classNames({ - [`${prefix}--select`]: true, - [`${prefix}--select--inline`]: inline, - [`${prefix}--select--light`]: light, - [`${prefix}--select--invalid`]: invalid, - [`${prefix}--select--disabled`]: disabled, - [`${prefix}--select--warning`]: warn, - [className]: className, - }); + const enabled = useFeatureFlag('enable-v11-release'); + + const selectClasses = classNames( + { + [`${prefix}--select`]: true, + [`${prefix}--select--inline`]: inline, + [`${prefix}--select--light`]: light, + [`${prefix}--select--invalid`]: invalid, + [`${prefix}--select--disabled`]: disabled, + [`${prefix}--select--warning`]: warn, + }, + [enabled ? null : className] + ); const labelClasses = classNames(`${prefix}--label`, { [`${prefix}--visually-hidden`]: hideLabel, [`${prefix}--label--disabled`]: disabled, @@ -110,8 +115,14 @@ const Select = React.forwardRef(function Select( ); })(); return ( -
+
+ {console.log('hi', className)} {!noLabel && (