-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiInlineEdit] (POC Review) Create Component Directory and Base Functionality #6533
Closed
breehall
wants to merge
5
commits into
elastic:feature/inline-edit
from
breehall:inline-edit/base-structure
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
367ecec
Create a directory for the new EuiInlineEdit component. Created the b…
breehall 40f6e4b
Created the EuiInlineEdit docs page to interact with the component
breehall 7362093
Created a common function that assists with typing within EuiInlineEd…
breehall 5b4a067
Added in the basic validation for EuiInlineEdit to prevent the form c…
breehall 5c192aa
Fixed a small bug that caused the ComboBox input bar to appear empty …
breehall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { | ||
EuiInlineEdit, | ||
EuiFieldText, | ||
EuiComboBox, | ||
EuiTextArea, | ||
EuiComboBoxProps, | ||
EuiHorizontalRule, | ||
EuiSpacer, | ||
} from '../../../../src/components'; | ||
|
||
const optionsStatic = [ | ||
{ | ||
label: 'Titan', | ||
'data-test-subj': 'titanOption', | ||
}, | ||
{ | ||
label: 'Enceladus is disabled', | ||
disabled: true, | ||
}, | ||
{ | ||
label: 'Mimas', | ||
}, | ||
{ | ||
label: 'Dione', | ||
}, | ||
{ | ||
label: 'Iapetus', | ||
}, | ||
{ | ||
label: 'Phoebe', | ||
}, | ||
{ | ||
label: 'Rhea', | ||
}, | ||
{ | ||
label: | ||
"Pandora is one of Saturn's moons, named for a Titaness of Greek mythology", | ||
}, | ||
{ | ||
label: 'Tethys', | ||
}, | ||
{ | ||
label: 'Hyperion', | ||
}, | ||
]; | ||
|
||
export default () => { | ||
const [options, setOptions] = useState(optionsStatic); | ||
const [selectedOptions, setSelected] = useState([options[2], options[4]]); | ||
|
||
const onChange = (selectedOptions: any) => { | ||
setSelected(selectedOptions); | ||
}; | ||
|
||
return ( | ||
<> | ||
{/* Base components */} | ||
<h3>EuiInlineEdit - Text</h3> | ||
<EuiInlineEdit | ||
editViewType={EuiFieldText} | ||
defaultValue="helloWorld" | ||
editViewTypeProps={{ id: 'hello' }} | ||
/> | ||
<EuiHorizontalRule /> | ||
|
||
<h3>EuiInlineEdit - Textarea</h3> | ||
<EuiInlineEdit | ||
editViewType={EuiTextArea} | ||
defaultValue="Tiramisu jelly beans sweet croissant macaroon topping. Gummies fruitcake sesame snaps lollipop chocolate cake lemon drops icing. Cake cake croissant ice cream jujubes donut toffee. Gummies jelly tiramisu cheesecake brownie icing gummi bears candy canes." | ||
editViewTypeProps={{ id: 'hello' }} | ||
/> | ||
<EuiHorizontalRule /> | ||
|
||
<h3>EuiInlineEdit - Select</h3> | ||
<EuiInlineEdit | ||
editViewType={EuiComboBox} | ||
editViewTypeProps={{ | ||
isClearable: true, | ||
options: options, | ||
placeholder: 'Select or create options', | ||
selectedOptions: selectedOptions, | ||
onChange: onChange, | ||
'data-test-subj': 'demoComboBox', | ||
'aria-label': 'Accessible screen reader label', | ||
autoFocus: true, | ||
}} | ||
/> | ||
<EuiHorizontalRule /> | ||
</> | ||
); | ||
}; |
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,40 @@ | ||
import React from 'react'; | ||
|
||
import { GuideSectionTypes } from '../../components'; | ||
|
||
import { EuiText, EuiInlineEdit } from '../../../../src'; | ||
|
||
import InlineEdit from './inline_edit'; | ||
const inlineEditSource = require('!!raw-loader!./inline_edit'); | ||
|
||
export const InlineEditExample = { | ||
title: 'Inline edit', | ||
intro: ( | ||
<> | ||
<EuiText> | ||
Hello! This is where the EuiInlineEdit documentation intro will go! | ||
</EuiText> | ||
</> | ||
), | ||
sections: [ | ||
{ | ||
title: 'Inline edit', | ||
text: ( | ||
<> | ||
<p> | ||
Description needed: how to use the <strong>EuiInlineEdit</strong>{' '} | ||
component. | ||
</p> | ||
</> | ||
), | ||
source: [ | ||
{ | ||
type: GuideSectionTypes.JS, | ||
code: inlineEditSource, | ||
}, | ||
], | ||
demo: <InlineEdit />, | ||
props: { EuiInlineEdit }, | ||
}, | ||
], | ||
}; |
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,9 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { EuiInlineEdit } from './inline_edit'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 I started reviewing these with VoiceOver, I noticed it was reading back the input (or textarea) text but not the heading I presumed was the visual / accessible label. I think you could go a couple of directions here:
aria-labelledby
prop in theEuiInlineEdit
when it's in edit state.label
a required prop so it adds a visual and accessible label to the input. This gets in the way of the heading text in your examples.aria-label
prop on theEuiInlineEdit
component that gets passed to the input or textarea. This is my least favorite option.This change feels like it could affect visual and structural order, so happy to discuss it more next week and look for a good working solution.