forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Feature Flag out of Experimental (carbon-design-system#17806)
* feat: adding feature flag item to stable * feat: added combobox floating styles * fix: imported all dynamic floating styles to stable * feat: added remaning feature flags * fix: fixed a tile and overflow paths in avt tests * test: fixed tests * fix: removed parameter from main.js * fix: fixed naming * fix: moved flag details to the top level
- Loading branch information
Showing
34 changed files
with
1,021 additions
and
1,477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
packages/react/src/components/ComboBox/ComboBox.featureflag.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2023 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { ComboBox } from '../ComboBox'; | ||
import { WithFeatureFlags } from '../../../.storybook/templates/WithFeatureFlags'; | ||
|
||
export default { | ||
title: 'Components/ComboBox/Feature Flag', | ||
component: ComboBox, | ||
tags: ['!autodocs'], | ||
decorators: [ | ||
(Story) => ( | ||
<WithFeatureFlags | ||
flags={{ | ||
'enable-v12-dynamic-floating-styles': true, | ||
}}> | ||
<Story /> | ||
</WithFeatureFlags> | ||
), | ||
], | ||
}; | ||
|
||
const comboBoxItems = [ | ||
{ | ||
id: 'option-0', | ||
text: 'An example option that is really long to show what should be done to handle long text', | ||
}, | ||
{ | ||
id: 'option-1', | ||
text: 'Option 1', | ||
}, | ||
{ | ||
id: 'option-2', | ||
text: 'Option 2', | ||
}, | ||
{ | ||
id: 'option-3', | ||
text: 'Option 3 - a disabled item', | ||
disabled: true, | ||
}, | ||
{ | ||
id: 'option-4', | ||
text: 'Option 4', | ||
}, | ||
{ | ||
id: 'option-5', | ||
text: 'Option 5', | ||
}, | ||
]; | ||
|
||
export const FloatingStyles = (args) => ( | ||
<ComboBox | ||
onChange={() => {}} | ||
id="carbon-combobox" | ||
items={comboBoxItems} | ||
itemToString={(item) => (item ? item.text : '')} | ||
titleText="ComboBox title" | ||
helperText="Combobox helper text" | ||
{...args} | ||
/> | ||
); | ||
|
||
FloatingStyles.args = { | ||
direction: 'bottom', | ||
}; | ||
|
||
FloatingStyles.argTypes = { | ||
direction: { | ||
options: ['top', 'bottom'], | ||
control: { | ||
type: 'radio', | ||
}, | ||
}, | ||
}; |
39 changes: 39 additions & 0 deletions
39
packages/react/src/components/ComboBox/Combobox.DynamicStyles.featureflag.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Meta } from '@storybook/blocks'; | ||
|
||
<Meta title="Components/ComboBox/Feature Flag" name="Flag details" /> | ||
|
||
# Dynamically set floating styles | ||
|
||
Components with `autoAlign` use the | ||
[`floating-ui`](https://github.com/floating-ui/floating-ui) library to handle | ||
the dynamic positioning of floating elements relative to their trigger / anchor | ||
element. This also includes collision detection that repositions the floating | ||
element as necessary to keep it visible within the viewport. In the majority of | ||
cases, the styling from the `floating-ui` 'fixed' positioning strategy prevents | ||
the floating element from being | ||
[clipped](https://floating-ui.com/docs/misc#clipping) by an ancestor element. | ||
|
||
The `enable-v12-dynamic-floating-styles` flag enables this dynamic styling | ||
without the collision detection. | ||
|
||
**Note**: The flag has no effect when used with `autoAlign` because `autoAlign` | ||
includes both the dynamic positioning styles and collision detection. | ||
|
||
## Enable dynamic setting of floating styles | ||
|
||
```js | ||
<FeatureFlags | ||
flags={{ | ||
'enable-v12-dynamic-floating-styles': true, | ||
}}> | ||
<ComboBox | ||
onChange={() => {}} | ||
id="carbon-combobox" | ||
items={comboBoxItems} | ||
itemToString={(item) => (item ? item.text : '')} | ||
titleText="ComboBox title" | ||
helperText="Combobox helper text" | ||
{...args} | ||
/> | ||
</FeatureFlags> | ||
``` |
35 changes: 35 additions & 0 deletions
35
...ages/react/src/components/ComboButton/ComboButton.DynamicStyles.featureflag.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Meta } from '@storybook/blocks'; | ||
|
||
<Meta title="Components/ComboButton/Feature Flag" name="Flag details" /> | ||
|
||
# Dynamically set floating styles | ||
|
||
Components with `autoAlign` use the | ||
[`floating-ui`](https://github.com/floating-ui/floating-ui) library to handle | ||
the dynamic positioning of floating elements relative to their trigger / anchor | ||
element. This also includes collision detection that repositions the floating | ||
element as necessary to keep it visible within the viewport. In the majority of | ||
cases, the styling from the `floating-ui` 'fixed' positioning strategy prevents | ||
the floating element from being | ||
[clipped](https://floating-ui.com/docs/misc#clipping) by an ancestor element. | ||
|
||
The `enable-v12-dynamic-floating-styles` flag enables this dynamic styling | ||
without the collision detection. | ||
|
||
**Note**: The flag has no effect when used with `autoAlign` because `autoAlign` | ||
includes both the dynamic positioning styles and collision detection. | ||
|
||
## Enable dynamic setting of floating styles | ||
|
||
```js | ||
<FeatureFlags | ||
flags={{ | ||
'enable-v12-dynamic-floating-styles': true, | ||
}}> | ||
<ComboButton menuAlignment={args.menuAlignment} label="Primary action"> | ||
<MenuItem label="Second action with a long label description" /> | ||
<MenuItem label="Third action" /> | ||
<MenuItem label="Fourth action" disabled /> | ||
</ComboButton> | ||
</FeatureFlags> | ||
``` |
48 changes: 48 additions & 0 deletions
48
packages/react/src/components/ComboButton/ComboButton.featureflag.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2023 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { ComboButton } from '../ComboButton'; | ||
import { WithFeatureFlags } from '../../../.storybook/templates/WithFeatureFlags'; | ||
import { MenuItem } from '../Menu'; | ||
|
||
export default { | ||
title: 'Components/ComboButton/Feature Flag', | ||
component: ComboButton, | ||
tags: ['!autodocs'], | ||
decorators: [ | ||
(Story) => ( | ||
<WithFeatureFlags | ||
flags={{ | ||
'enable-v12-dynamic-floating-styles': true, | ||
}}> | ||
<Story /> | ||
</WithFeatureFlags> | ||
), | ||
], | ||
}; | ||
|
||
export const FloatingStyles = (args) => ( | ||
<ComboButton menuAlignment={args.menuAlignment} label="Primary action"> | ||
<MenuItem label="Second action with a long label description" /> | ||
<MenuItem label="Third action" /> | ||
<MenuItem label="Fourth action" disabled /> | ||
</ComboButton> | ||
); | ||
|
||
FloatingStyles.args = { | ||
menuAlignment: 'bottom', | ||
}; | ||
|
||
FloatingStyles.argTypes = { | ||
menuAlignment: { | ||
options: ['top', 'bottom'], | ||
control: { | ||
type: 'radio', | ||
}, | ||
}, | ||
}; |
2 changes: 1 addition & 1 deletion
2
packages/react/src/components/ComposedModal/ComposedModal.featureflag.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.