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

Added support for wrapClassName in SemanticUI theme #358

Merged
merged 1 commit into from
Oct 26, 2017
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
12 changes: 9 additions & 3 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,12 @@ import DateField from 'uniforms-unstyled/DateField'; // Choose your theme packag
showInlineError={true}

// Field and sourroundings wrap className.
// *Some description would be great, huh?*
// In SemanticUI theme, this class name is used on ui input wrapper,
// so you can pass classes like small, huge, inverted, transparent etc.
// Available in:
// bootstrap3
// bootstrap4
// semantic
wrapClassName="a b c"

// Display time picker in ampm (12hr) format or 24hr format.
Expand Down Expand Up @@ -738,10 +740,12 @@ import NumField from 'uniforms-unstyled/NumField'; // Choose your theme package.
step={5}

// Field and sourroundings wrap className.
// *Some description would be great, huh?*
// In SemanticUI theme, this class name is used on ui input wrapper,
// so you can pass variations like small, huge, inverted, transparent etc.
// Available in:
// bootstrap3
// bootstrap4
// semantic
wrapClassName="a b c"
/>
```
Expand Down Expand Up @@ -995,10 +999,12 @@ import TextField from 'uniforms-unstyled/TextField'; // Choose your theme packag
type="password"

// Field and sourroundings wrap className.
// *Some description would be great, huh?*
// In SemanticUI theme, this class name is used on ui input wrapper,
// so you can pass variations like small, huge, inverted, transparent etc.
// Available in:
// bootstrap3
// bootstrap4
// semantic
wrapClassName="a b c"
/>
```
Expand Down
7 changes: 7 additions & 0 deletions packages/uniforms-semantic/__tests__/DateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,10 @@ test('<DateField> - renders a icon', () => {

expect(wrapper.find('i')).toHaveLength(1);
});

test('<DateField> - renders with a custom wrapClassName', () => {
const element = <DateField name="x" wrapClassName="test-class-name" />;
const wrapper = mount(element, createContext({x: {type: Date}}));

expect(wrapper.find('.ui.input.test-class-name')).toHaveLength(1);
});
7 changes: 7 additions & 0 deletions packages/uniforms-semantic/__tests__/NumField.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,10 @@ test('<NumField> - renders a icon', () => {

expect(wrapper.find('i')).toHaveLength(1);
});

test('<NumField> - renders with a custom wrapClassName', () => {
const element = <NumField name="x" wrapClassName="test-class-name" />;
const wrapper = mount(element, createContext({x: {type: Number}}));

expect(wrapper.find('.ui.input.test-class-name')).toHaveLength(1);
});
7 changes: 7 additions & 0 deletions packages/uniforms-semantic/__tests__/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,10 @@ test('<TextField> - renders a icon', () => {

expect(wrapper.find('i')).toHaveLength(1);
});

test('<TextField> - renders with a custom wrapClassName', () => {
const element = <TextField name="x" wrapClassName="test-class-name" />;
const wrapper = mount(element, createContext({x: {type: String}}));

expect(wrapper.find('.ui.input.test-class-name')).toHaveLength(1);
});
3 changes: 2 additions & 1 deletion packages/uniforms-semantic/src/DateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const Date_ = ({
required,
showInlineError,
value,
wrapClassName,
...props
}) =>
<div className={classnames(className, {disabled, error, required}, 'field')} {...filterDOMProps(props)}>
Expand All @@ -41,7 +42,7 @@ const Date_ = ({
</label>
)}

<div className={classnames('ui', {left: iconLeft, icon: icon || iconLeft}, 'input')}>
<div className={classnames('ui', wrapClassName, {left: iconLeft, icon: icon || iconLeft}, 'input')}>
<input
disabled={disabled}
id={id}
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-semantic/src/NumField.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const Num_ = ({
showInlineError,
step,
value,
wrapClassName,
...props
}) =>
<div className={classnames(className, {disabled, error, required}, 'field')} {...filterDOMProps(props)}>
Expand All @@ -36,7 +37,7 @@ const Num_ = ({
</label>
)}

<div className={classnames('ui', {left: iconLeft, icon: icon || iconLeft}, 'input')}>
<div className={classnames('ui', wrapClassName, {left: iconLeft, icon: icon || iconLeft}, 'input')}>
<input
disabled={disabled}
id={id}
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-semantic/src/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Text = ({
showInlineError,
type,
value,
wrapClassName,
...props
}) =>
<div className={classnames(className, {disabled, error, required}, 'field')} {...filterDOMProps(props)}>
Expand All @@ -30,7 +31,7 @@ const Text = ({
</label>
)}

<div className={classnames('ui', {left: iconLeft, icon: icon || iconLeft}, 'input')}>
<div className={classnames('ui', wrapClassName, {left: iconLeft, icon: icon || iconLeft}, 'input')}>
<input
disabled={disabled}
id={id}
Expand Down