Skip to content

Commit

Permalink
refactor(TextInput): rename presentational input
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod committed May 9, 2019
1 parent 73ef45b commit e475bfb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { mount, shallow } from 'enzyme';
describe('TextInput', () => {
describe('renders as expected', () => {
const wrapper = mount(
<TextInput.ControlledPasswordInput
<TextInput.PresentationalPasswordInput
id="test"
className="extra-class"
labelText="testlabel"
Expand Down
10 changes: 5 additions & 5 deletions packages/react/src/components/TextInput/PasswordInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { textInputProps } from './util';

const { prefix } = settings;

export const ControlledPasswordInput = React.forwardRef(
function ControlledPasswordInput(
export const PresentationalPasswordInput = React.forwardRef(
function PresentationalPasswordInput(
{
alt,
labelText,
Expand Down Expand Up @@ -126,7 +126,7 @@ export const ControlledPasswordInput = React.forwardRef(
}
);

ControlledPasswordInput.propTypes = {
PresentationalPasswordInput.propTypes = {
/**
* Provide custom alt text for the password visibility toggle button
*/
Expand Down Expand Up @@ -212,7 +212,7 @@ ControlledPasswordInput.propTypes = {
light: PropTypes.bool,
};

ControlledPasswordInput.defaultProps = {
PresentationalPasswordInput.defaultProps = {
alt: '',
className: `${prefix}--text__input`,
disabled: false,
Expand All @@ -237,7 +237,7 @@ export default class PasswordInput extends React.Component {

render() {
return (
<ControlledPasswordInput
<PresentationalPasswordInput
{...this.props}
visible={this.state.visible}
onClick={this.togglePasswordVisibility}
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/TextInput/TextInput-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const types = {
'For password (password)': 'password',
};

class ControlledPasswordInputApp extends React.Component {
class PresentationalPasswordInputApp extends React.Component {
state = {
type: 'password',
};
Expand All @@ -32,7 +32,7 @@ class ControlledPasswordInputApp extends React.Component {

render() {
return (
<TextInput.ControlledPasswordInput
<TextInput.PresentationalPasswordInput
type={this.state.type}
togglePasswordVisibility={this.togglePasswordVisibility}
{...TextInputProps()}
Expand Down Expand Up @@ -97,7 +97,7 @@ storiesOf('TextInput', module)
)
.add(
'Fully controlled toggle password visibility',
() => <ControlledPasswordInputApp />,
() => <PresentationalPasswordInputApp />,
{
info: {
text: `
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from 'react';
import classNames from 'classnames';
import { settings } from 'carbon-components';
import WarningFilled16 from '@carbon/icons-react/lib/warning--filled/16';
import PasswordInput, { ControlledPasswordInput } from './PasswordInput';
import PasswordInput, { PresentationalPasswordInput } from './PasswordInput';
import { textInputProps } from './util';

const { prefix } = settings;
Expand Down Expand Up @@ -97,7 +97,7 @@ const TextInput = React.forwardRef(function TextInput(
});

TextInput.PasswordInput = PasswordInput;
TextInput.ControlledPasswordInput = ControlledPasswordInput;
TextInput.PresentationalPasswordInput = PresentationalPasswordInput;
TextInput.propTypes = {
/**
* Specify an optional className to be applied to the <input> node
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/TextInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
*/

export * from './TextInput.Skeleton';
export ControlledPasswordInput from './PasswordInput';
export PresentationalPasswordInput from './PasswordInput';
export PasswordInput from './PasswordInput';
export default from './TextInput';

0 comments on commit e475bfb

Please sign in to comment.