-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EuiFieldText][EuiFieldNumber] Various
icon
related fixes (#7666)
- Loading branch information
Showing
11 changed files
with
224 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
**Bug fixes** | ||
|
||
- Fixed `EuiFieldNumber`'s typing to accept an icon configuration shape | ||
- Fixed `EuiFieldText` and `EuiFieldNumber` to render the correct paddings for icon shapes set to `side: 'right'` | ||
- Fixed `EuiFieldText` and `EuiFieldNumber` to fully ignore `icon`/`prepend`/`append` when `controlOnly` is set to true | ||
- Fixed `EuiColorPicker`'s input not setting the correct right padding for the number of icons displayed |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { | ||
disableStorybookControls, | ||
hideStorybookControls, | ||
moveStorybookControlsToCategory, | ||
} from '../../../../.storybook/utils'; | ||
|
||
import { EuiFieldText, EuiFieldTextProps } from './field_text'; | ||
|
||
const meta: Meta<EuiFieldTextProps> = { | ||
title: 'Forms/EuiFieldText', | ||
component: EuiFieldText, | ||
argTypes: { | ||
// For quicker/easier QA | ||
icon: { control: 'text' }, | ||
prepend: { control: 'text' }, | ||
append: { control: 'text' }, | ||
}, | ||
args: { | ||
// Component defaults | ||
compressed: false, | ||
fullWidth: false, | ||
isInvalid: false, | ||
isLoading: false, | ||
disabled: false, | ||
readOnly: false, | ||
controlOnly: false, | ||
// Added for easier testing | ||
placeholder: 'EuiFieldText', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiFieldTextProps>; | ||
disableStorybookControls(meta, ['inputRef']); | ||
|
||
export const Playground: Story = {}; | ||
|
||
export const IconShape: Story = { | ||
argTypes: { icon: { control: 'object' } }, | ||
args: { icon: { type: 'warning', color: 'warning', side: 'left' } }, | ||
}; | ||
// Move other props below the icon prop | ||
moveStorybookControlsToCategory(IconShape, [ | ||
'compressed', | ||
'fullWidth', | ||
'isInvalid', | ||
'isLoading', | ||
'disabled', | ||
'readOnly', | ||
'placeholder', | ||
'prepend', | ||
'append', | ||
]); | ||
// Hide props that remove or won't affect the icon or its positioning | ||
hideStorybookControls(IconShape, ['controlOnly', 'inputRef']); |
Oops, something went wrong.