-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiInlineEdit] Create isReadOnly Prop for Read Mode
#6777
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
Merged
breehall
merged 18 commits into
elastic:feature/EuiInlineEdit
from
breehall:inline-edit/readOnly
May 18, 2023
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
004831e
[EuiInlineEdit] Add the isReadOnly prop that locks the component in r…
breehall 8c08bc3
[EuiInlineEdit] Update snapshots to account for new inline_edit_form …
breehall 0cdc03b
[EuiInlineEdit] Forgot to add snapshot updates
breehall 8a7b117
[REVERT] Add documentation example to InlineEdit Text to display isRe…
breehall da47079
Revert "[REVERT] Add documentation example to InlineEdit Text to disp…
breehall e41cd89
[PR Review]
breehall f7cad78
[PR Feedback]
breehall fd36545
Update and add test cases
breehall cf3a1c9
[PR Feedback] - Update conditional aria-describedby span to surround …
breehall 5dd01b0
Update src-docs/src/views/inline_edit/inline_edit_read_only.tsx
breehall c5930d8
Update src/components/inline_edit/inline_edit_form.styles.ts
breehall c46e6ed
[PR Feedback] -Add note in inline_edit_form.style.ts that we should r…
breehall 531be08
[PR Feedback] Move the isReadOnly prop example up in the documentation
breehall 13a0a02
Snapshots
breehall 4375522
Update src-docs/src/views/inline_edit/inline_edit_example.js
breehall 1940f35
[PR Feedback] - Removed conditiona lo logic to force a toggle from re…
breehall 070d008
Merge branch 'inline-edit/readOnly' of https://github.com/breehall/eu…
breehall 30c2e11
Oops!
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 hidden or 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 hidden or 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 React, { useState } from 'react'; | ||
|
|
||
| import { | ||
| EuiInlineEditText, | ||
| EuiInlineEditTitle, | ||
| EuiSpacer, | ||
| EuiSwitch, | ||
| } from '../../../../src'; | ||
|
|
||
| export default () => { | ||
| const [isReadOnly, setIsReadOnly] = useState(true); | ||
|
|
||
| return ( | ||
| <> | ||
| <EuiSwitch | ||
| label="Toggle read only" | ||
| checked={isReadOnly} | ||
| onChange={(e) => setIsReadOnly(e.target.checked)} | ||
| /> | ||
|
|
||
| <EuiSpacer /> | ||
|
|
||
| <EuiInlineEditText | ||
| inputAriaLabel="Edit text inline" | ||
| defaultValue="This is read only text!" | ||
| isReadOnly={isReadOnly} | ||
| /> | ||
|
|
||
| <EuiSpacer /> | ||
|
|
||
| <EuiInlineEditTitle | ||
| inputAriaLabel="Edit title inline" | ||
| defaultValue="This is a read only title!" | ||
| heading="h3" | ||
| isReadOnly={isReadOnly} | ||
| /> | ||
| </> | ||
| ); | ||
| }; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,26 @@ | ||
| /* | ||
| * 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 { css } from '@emotion/react'; | ||
| import { UseEuiTheme } from '../../services'; | ||
|
|
||
| export const euiInlineEditFormStyles = ({ euiTheme }: UseEuiTheme) => { | ||
| return { | ||
| euiInlineEditButton: css``, | ||
|
|
||
| // Override the cursor and allow users to highlight text when read mode is in the read only state | ||
| // Once EuiEmptyButton has been converted to Emotion, remove this extra selector | ||
| isReadOnly: css` | ||
| &.euiButtonEmpty:disabled { | ||
| cursor: text; | ||
| color: ${euiTheme.colors.text}; | ||
| user-select: text; | ||
breehall marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| `, | ||
| }; | ||
| }; | ||
This file contains hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.