Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/textfields/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"styled-components": "^3.2.6"
},
"devDependencies": {
"@zendeskgarden/css-forms": "6.1.1",
"@zendeskgarden/css-forms": "6.1.3",
"@zendeskgarden/react-theming": "^3.1.3"
},
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions packages/textfields/src/elements/FauxInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default class FauxInput extends ControlledComponent {
this.setControlledState({ focused: false });
})}
focused={focused}
aria-invalid={null} // eslint-disable-line jsx-a11y/aria-proptypes
>
{children}
</DIVInput>
Expand Down
6 changes: 3 additions & 3 deletions packages/textfields/src/views/MediaFigure.example.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The `FauxInput[mediaLayout=true]` can be used with the `MediaFigure` component
to include icons within the input.
The `FauxInput[mediaLayout=true]` can be used with the `MediaFigure` and `MediaInput`
components to include icons within the input.

```jsx
const SearchIcon = require('svg-react-loader?name=Settings!@zendeskgarden/svg-icons/src/14/search.svg');
Expand All @@ -9,7 +9,7 @@ const SettingsIcon = require('svg-react-loader?name=Attachment!@zendeskgarden/sv
<MediaFigure>
<SearchIcon />
</MediaFigure>
<Input aria-label="Media Input Example" placeholder="Example media input" bare />
<MediaInput aria-label="Media Input Example" placeholder="Example media input" />
<MediaFigure>
<SettingsIcon />
</MediaFigure>
Expand Down
53 changes: 53 additions & 0 deletions packages/textfields/src/views/MediaInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/

import PropTypes from 'prop-types';
import styled from 'styled-components';
import { retrieveTheme } from '@zendeskgarden/react-theming';
import TextStyles from '@zendeskgarden/css-forms/dist/text.css';

import Input from './Input';

const COMPONENT_ID = 'textfields.media_input';
const VALIDATION = {
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'error',
NONE: 'none'
};

/**
* Accepts all `<input>` props
*/
const MediaInput = styled(Input).attrs({
'data-garden-id': COMPONENT_ID,
'data-garden-version': PACKAGE_VERSION,
className: TextStyles['c-txt__input--media__body']
})`
${props => retrieveTheme(COMPONENT_ID, props)};
`;

MediaInput.propTypes = {
small: PropTypes.bool,
bare: PropTypes.bool,
disabled: PropTypes.bool,
focused: PropTypes.bool,
hovered: PropTypes.bool,
validation: PropTypes.oneOf([
VALIDATION.SUCCESS,
VALIDATION.WARNING,
VALIDATION.ERROR,
VALIDATION.NONE
])
};

MediaInput.defaultProps = {
bare: true
};

/** @component */
export default MediaInput;
19 changes: 19 additions & 0 deletions packages/textfields/src/views/MediaInput.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/

import React from 'react';
import { shallow } from 'enzyme';

import MediaInput from './MediaInput';

describe('MediaInput', () => {
it('renders default styling', () => {
const wrapper = shallow(<MediaInput />);

expect(wrapper).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`MediaInput renders default styling 1`] = `
<Input
bare={true}
className="c-txt__input--media__body "
data-garden-id="textfields.media_input"
data-garden-version="version"
/>
`;
3 changes: 1 addition & 2 deletions utils/travis/publish-gh-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ const ghPages = require('gh-pages');

ghPages.publish('demo', {
repo: `https://${process.env.GITHUB_TOKEN}@github.com/zendeskgarden/react-components.git`,
silent: true,
add: true
silent: true
});