From 4af8d36b42706a9c0057ea364296cc93fbc494f0 Mon Sep 17 00:00:00 2001 From: Maciek Stasieluk Date: Thu, 26 Oct 2017 14:01:00 +0200 Subject: [PATCH] Added support for wrapClassName in SemanticUI theme --- API.md | 12 +++++++++--- packages/uniforms-semantic/__tests__/DateField.js | 7 +++++++ packages/uniforms-semantic/__tests__/NumField.js | 7 +++++++ packages/uniforms-semantic/__tests__/TextField.js | 7 +++++++ packages/uniforms-semantic/src/DateField.js | 3 ++- packages/uniforms-semantic/src/NumField.js | 3 ++- packages/uniforms-semantic/src/TextField.js | 3 ++- 7 files changed, 36 insertions(+), 6 deletions(-) diff --git a/API.md b/API.md index 1100f5ddb..513319f4e 100644 --- a/API.md +++ b/API.md @@ -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. @@ -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" /> ``` @@ -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" /> ``` diff --git a/packages/uniforms-semantic/__tests__/DateField.js b/packages/uniforms-semantic/__tests__/DateField.js index 08236a239..5bce3224e 100644 --- a/packages/uniforms-semantic/__tests__/DateField.js +++ b/packages/uniforms-semantic/__tests__/DateField.js @@ -161,3 +161,10 @@ test(' - renders a icon', () => { expect(wrapper.find('i')).toHaveLength(1); }); + +test(' - renders with a custom wrapClassName', () => { + const element = ; + const wrapper = mount(element, createContext({x: {type: Date}})); + + expect(wrapper.find('.ui.input.test-class-name')).toHaveLength(1); +}); diff --git a/packages/uniforms-semantic/__tests__/NumField.js b/packages/uniforms-semantic/__tests__/NumField.js index 093798f11..9afc1fe73 100644 --- a/packages/uniforms-semantic/__tests__/NumField.js +++ b/packages/uniforms-semantic/__tests__/NumField.js @@ -246,3 +246,10 @@ test(' - renders a icon', () => { expect(wrapper.find('i')).toHaveLength(1); }); + +test(' - renders with a custom wrapClassName', () => { + const element = ; + const wrapper = mount(element, createContext({x: {type: Number}})); + + expect(wrapper.find('.ui.input.test-class-name')).toHaveLength(1); +}); diff --git a/packages/uniforms-semantic/__tests__/TextField.js b/packages/uniforms-semantic/__tests__/TextField.js index 2ff663013..6d920d6ee 100644 --- a/packages/uniforms-semantic/__tests__/TextField.js +++ b/packages/uniforms-semantic/__tests__/TextField.js @@ -164,3 +164,10 @@ test(' - renders a icon', () => { expect(wrapper.find('i')).toHaveLength(1); }); + +test(' - renders with a custom wrapClassName', () => { + const element = ; + const wrapper = mount(element, createContext({x: {type: String}})); + + expect(wrapper.find('.ui.input.test-class-name')).toHaveLength(1); +}); diff --git a/packages/uniforms-semantic/src/DateField.js b/packages/uniforms-semantic/src/DateField.js index bcef7a509..ed4b4d7a6 100644 --- a/packages/uniforms-semantic/src/DateField.js +++ b/packages/uniforms-semantic/src/DateField.js @@ -32,6 +32,7 @@ const Date_ = ({ required, showInlineError, value, + wrapClassName, ...props }) =>
@@ -41,7 +42,7 @@ const Date_ = ({ )} -
+
@@ -36,7 +37,7 @@ const Num_ = ({ )} -
+
@@ -30,7 +31,7 @@ const Text = ({ )} -
+