Skip to content
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

[EuiFieldPassword] Support toggling of obfuscation #3751

Merged
merged 14 commits into from
Jul 27, 2020
Merged
2 changes: 0 additions & 2 deletions src-docs/src/views/datagrid/styling.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ export default class DataGrid extends Component {
button={styleButton}
isOpen={this.state.isPopoverOpen}
anchorPosition="rightUp"
zIndex={3}
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
closePopover={this.closePopover.bind(this)}>
<div style={{ width: 300 }}>
<EuiFormRow label="Border" display="columnCompressed">
Expand Down Expand Up @@ -505,7 +504,6 @@ export default class DataGrid extends Component {
button={toolbarButton}
isOpen={this.state.isToolbarPopoverOpen}
anchorPosition="rightUp"
zIndex={3}
closePopover={this.closeToolbarPopover.bind(this)}>
<div style={{ width: 400 }}>
<EuiFormRow
Expand Down
24 changes: 17 additions & 7 deletions src-docs/src/views/form_controls/field_password.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
import React, { useState } from 'react';

import { EuiFieldPassword } from '../../../../src/components';
import { EuiFieldPassword, EuiSwitch } from '../../../../src/components';
import { DisplayToggles } from './display_toggles';

export default function() {
const [value, setValue] = useState('');

const onChange = e => {
setValue(e.target.value);
};
const [dual, setDual] = useState(true);

return (
/* DisplayToggles wrapper for Docs only */
<DisplayToggles canAppend canPrepend>
<DisplayToggles
canAppend
canPrepend
extras={[
<EuiSwitch
compressed
label={'dual'}
checked={dual}
onChange={e => {
setDual(e.target.checked);
}}
/>,
]}>
<EuiFieldPassword
placeholder="Placeholder text"
type={dual ? 'dual' : undefined}
value={value}
onChange={e => onChange(e)}
onChange={e => setValue(e.target.value)}
aria-label="Use aria labels when no actual label is in use"
/>
</DisplayToggles>
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/form_controls/form_controls_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const fieldPasswordSnippet = [
placeholder="Placeholder text"
value={value}
onChange={onChange}
type="dual"
/>`,
];

Expand Down
Loading