aboutsummaryrefslogtreecommitdiffstats
path: root/packages/forms
diff options
context:
space:
mode:
Diffstat (limited to 'packages/forms')
-rw-r--r--packages/forms/package.json6
-rw-r--r--packages/forms/src/input/index.tsx2
-rw-r--r--packages/forms/src/input/styles.ts2
-rw-r--r--packages/forms/src/label/index.tsx4
-rw-r--r--packages/forms/src/select/index.tsx2
-rw-r--r--packages/forms/src/typings/generic.ts1
6 files changed, 12 insertions, 5 deletions
diff --git a/packages/forms/package.json b/packages/forms/package.json
index 8c21303f4..0ac9a846f 100644
--- a/packages/forms/package.json
+++ b/packages/forms/package.json
@@ -1,6 +1,6 @@
1{ 1{
2 "name": "@meetfranz/forms", 2 "name": "@meetfranz/forms",
3 "version": "1.0.14", 3 "version": "1.0.15",
4 "description": "React form components for Franz", 4 "description": "React form components for Franz",
5 "main": "lib/index.js", 5 "main": "lib/index.js",
6 "scripts": { 6 "scripts": {
@@ -25,7 +25,7 @@
25 "dependencies": { 25 "dependencies": {
26 "@mdi/js": "^3.3.92", 26 "@mdi/js": "^3.3.92",
27 "@mdi/react": "^1.1.0", 27 "@mdi/react": "^1.1.0",
28 "@meetfranz/theme": "^1.0.12", 28 "@meetfranz/theme": "^1.0.13",
29 "react-html-attributes": "^1.4.3", 29 "react-html-attributes": "^1.4.3",
30 "react-loader": "^2.4.5" 30 "react-loader": "^2.4.5"
31 }, 31 },
@@ -35,5 +35,5 @@
35 "react-dom": "16.7.0", 35 "react-dom": "16.7.0",
36 "react-jss": "^8.6.1" 36 "react-jss": "^8.6.1"
37 }, 37 },
38 "gitHead": "795eb685f4f57c66a2989993f0478e94baf3ca77" 38 "gitHead": "e9b9079dc921e85961954727a7b2a8eabe5b9798"
39} 39}
diff --git a/packages/forms/src/input/index.tsx b/packages/forms/src/input/index.tsx
index e410f8fef..a2d7c62d5 100644
--- a/packages/forms/src/input/index.tsx
+++ b/packages/forms/src/input/index.tsx
@@ -113,6 +113,7 @@ class InputComponent extends Component<IProps, IState> {
113 min, 113 min,
114 max, 114 max,
115 step, 115 step,
116 required,
116 } = this.props; 117 } = this.props;
117 118
118 const { 119 const {
@@ -132,6 +133,7 @@ class InputComponent extends Component<IProps, IState> {
132 showLabel={showLabel} 133 showLabel={showLabel}
133 htmlFor={id} 134 htmlFor={id}
134 className={classes.label} 135 className={classes.label}
136 isRequired={required}
135 > 137 >
136 <div 138 <div
137 className={classnames({ 139 className={classnames({
diff --git a/packages/forms/src/input/styles.ts b/packages/forms/src/input/styles.ts
index 2f7ea65f2..e2ab30a4f 100644
--- a/packages/forms/src/input/styles.ts
+++ b/packages/forms/src/input/styles.ts
@@ -4,7 +4,7 @@ import CSS from 'csstype';
4const prefixStyles = (theme: Theme) => ({ 4const prefixStyles = (theme: Theme) => ({
5 background: theme.inputPrefixBackground, 5 background: theme.inputPrefixBackground,
6 color: theme.inputPrefixColor, 6 color: theme.inputPrefixColor,
7 lineHeight: theme.inputHeight, 7 lineHeight: `${theme.inputHeight}px`,
8 padding: '0 10px', 8 padding: '0 10px',
9 fontSize: theme.uiFontSize, 9 fontSize: theme.uiFontSize,
10}); 10});
diff --git a/packages/forms/src/label/index.tsx b/packages/forms/src/label/index.tsx
index 590270a06..1b33ba22c 100644
--- a/packages/forms/src/label/index.tsx
+++ b/packages/forms/src/label/index.tsx
@@ -9,6 +9,7 @@ import styles from './styles';
9 9
10interface ILabel extends IFormField, React.LabelHTMLAttributes<HTMLLabelElement> { 10interface ILabel extends IFormField, React.LabelHTMLAttributes<HTMLLabelElement> {
11 classes: Classes; 11 classes: Classes;
12 isRequired: boolean;
12} 13}
13 14
14class LabelComponent extends Component<ILabel> { 15class LabelComponent extends Component<ILabel> {
@@ -24,6 +25,7 @@ class LabelComponent extends Component<ILabel> {
24 className, 25 className,
25 children, 26 children,
26 htmlFor, 27 htmlFor,
28 isRequired,
27 } = this.props; 29 } = this.props;
28 30
29 if (!showLabel) return children; 31 if (!showLabel) return children;
@@ -36,7 +38,7 @@ class LabelComponent extends Component<ILabel> {
36 htmlFor={htmlFor} 38 htmlFor={htmlFor}
37 > 39 >
38 {showLabel && ( 40 {showLabel && (
39 <span className={classes.label}>{title}</span> 41 <span className={classes.label}>{title}{isRequired && ' *'}</span>
40 )} 42 )}
41 <div className={classes.content}> 43 <div className={classes.content}>
42 {children} 44 {children}
diff --git a/packages/forms/src/select/index.tsx b/packages/forms/src/select/index.tsx
index cfbe91dda..0e5ded176 100644
--- a/packages/forms/src/select/index.tsx
+++ b/packages/forms/src/select/index.tsx
@@ -311,6 +311,7 @@ class SelectComponent extends Component<IProps> {
311 showLabel, 311 showLabel,
312 showSearch, 312 showSearch,
313 onChange, 313 onChange,
314 required,
314 } = this.props; 315 } = this.props;
315 316
316 const { 317 const {
@@ -340,6 +341,7 @@ class SelectComponent extends Component<IProps> {
340 showLabel={showLabel} 341 showLabel={showLabel}
341 htmlFor={id} 342 htmlFor={id}
342 className={classes.label} 343 className={classes.label}
344 isRequired={required}
343 > 345 >
344 <div 346 <div
345 className={classnames({ 347 className={classnames({
diff --git a/packages/forms/src/typings/generic.ts b/packages/forms/src/typings/generic.ts
index b7f2fc452..9688ce2c7 100644
--- a/packages/forms/src/typings/generic.ts
+++ b/packages/forms/src/typings/generic.ts
@@ -5,6 +5,7 @@ export interface IFormField {
5 showLabel?: boolean; 5 showLabel?: boolean;
6 label?: string; 6 label?: string;
7 error?: string; 7 error?: string;
8 required?: boolean;
8} 9}
9 10
10export interface IWithStyle { 11export interface IWithStyle {