@conduction/components 2.0.20 → 2.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  - **Version 2**
6
6
 
7
+ - 2.0.22: Refactor InputNumber and InputFloat to return number type.
8
+ - 2.0.21: Add InputDateTime component.
7
9
  - 2.0.20: Bugfix Textarea component to include correct field validation.
8
10
  - 2.0.19: Add disabled state to Textarea and InputCheckbox components.
9
11
  - 2.0.17 & 2.0.18: Refactor PrimaryTopNav styling.
@@ -1,7 +1,7 @@
1
- import { InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile } from "./input";
1
+ import { InputText, InputPassword, InputEmail, InputDate, InputDateTime, InputNumber, InputFile } from "./input";
2
2
  import { Textarea } from "./textarea";
3
3
  import { InputCheckbox } from "./checkbox";
4
4
  import { InputRadio } from "./radio";
5
5
  import { SelectSingle, SelectMultiple } from "./select/select";
6
6
  import { CreateKeyValue } from "./createKeyValue/CreateKeyValue";
7
- export { InputRadio, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, CreateKeyValue, };
7
+ export { InputRadio, InputText, InputPassword, InputEmail, InputDate, InputDateTime, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, CreateKeyValue, };
@@ -1,7 +1,7 @@
1
- import { InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile } from "./input";
1
+ import { InputText, InputPassword, InputEmail, InputDate, InputDateTime, InputNumber, InputFile } from "./input";
2
2
  import { Textarea } from "./textarea";
3
3
  import { InputCheckbox } from "./checkbox";
4
4
  import { InputRadio } from "./radio";
5
5
  import { SelectSingle, SelectMultiple } from "./select/select";
6
6
  import { CreateKeyValue } from "./createKeyValue/CreateKeyValue";
7
- export { InputRadio, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, CreateKeyValue, };
7
+ export { InputRadio, InputText, InputPassword, InputEmail, InputDate, InputDateTime, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, CreateKeyValue, };
@@ -11,6 +11,7 @@ export declare const InputPassword: React.FC<IInputProps & IReactHookFormProps>;
11
11
  export declare const InputText: React.FC<IInputProps & IReactHookFormProps>;
12
12
  export declare const InputEmail: React.FC<IInputProps & IReactHookFormProps>;
13
13
  export declare const InputDate: React.FC<IInputProps & IReactHookFormProps>;
14
+ export declare const InputDateTime: React.FC<IInputProps & IReactHookFormProps>;
14
15
  export declare const InputNumber: React.FC<IInputProps & IReactHookFormProps>;
15
16
  export declare const InputFloat: React.FC<IInputProps & IReactHookFormProps>;
16
17
  interface IInputFileProps {
@@ -9,6 +9,7 @@ export const InputPassword = ({ disabled, name, validation, register, placeholde
9
9
  export const InputText = ({ disabled, name, defaultValue, validation, register, icon, placeholder, errors, }) => (_jsx(TextField, { type: "text", ...{ defaultValue, disabled, placeholder, icon }, ...register(name, { ...validation }), invalid: errors[name] }));
10
10
  export const InputEmail = ({ disabled, name, defaultValue, validation, register, icon, placeholder, errors, }) => (_jsx(TextField, { type: "email", ...{ defaultValue, disabled, placeholder, icon }, ...register(name, { ...validation }), invalid: errors[name] }));
11
11
  export const InputDate = ({ disabled, name, defaultValue, validation, register, errors, }) => (_jsx(TextField, { type: "date", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
12
- export const InputNumber = ({ disabled, name, defaultValue, validation, register, icon, placeholder, errors, }) => (_jsx(TextField, { type: "number", ...{ defaultValue, disabled, placeholder, icon }, ...register(name, { ...validation }), invalid: errors[name] }));
13
- export const InputFloat = ({ disabled, name, defaultValue, validation, register, icon, placeholder, errors, }) => (_jsx(TextField, { type: "number", step: ".01", ...{ disabled, placeholder, icon, defaultValue }, ...register(name, { ...validation }), invalid: errors[name] }));
12
+ export const InputDateTime = ({ disabled, name, defaultValue, validation, register, errors, }) => (_jsx(TextField, { type: "datetime-local", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
13
+ export const InputNumber = ({ disabled, name, defaultValue, validation, register, icon, placeholder, errors, }) => (_jsx(TextField, { type: "number", ...{ defaultValue, disabled, placeholder, icon }, ...register(name, { ...validation, valueAsNumber: true }), invalid: errors[name] }));
14
+ export const InputFloat = ({ disabled, name, defaultValue, validation, register, icon, placeholder, errors, }) => (_jsx(TextField, { type: "number", step: ".01", ...{ disabled, placeholder, icon, defaultValue }, ...register(name, { ...validation, valueAsNumber: true }), invalid: errors[name] }));
14
15
  export const InputFile = ({ disabled, name, accept, defaultValue, validation, register, }) => (_jsx("input", { className: "denhaag-textfield__input", type: "file", ...{ defaultValue, disabled, accept }, ...register(name, { ...validation }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- import { InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile } from "./input";
1
+ import { InputText, InputPassword, InputEmail, InputDate, InputDateTime, InputNumber, InputFile } from "./input";
2
2
  import { Textarea } from "./textarea";
3
3
  import { InputCheckbox } from "./checkbox";
4
4
  import { InputRadio } from "./radio";
@@ -11,6 +11,7 @@ export {
11
11
  InputPassword,
12
12
  InputEmail,
13
13
  InputDate,
14
+ InputDateTime,
14
15
  InputNumber,
15
16
  InputCheckbox,
16
17
  InputFile,
@@ -84,6 +84,22 @@ export const InputDate: React.FC<IInputProps & IReactHookFormProps> = ({
84
84
  />
85
85
  );
86
86
 
87
+ export const InputDateTime: React.FC<IInputProps & IReactHookFormProps> = ({
88
+ disabled,
89
+ name,
90
+ defaultValue,
91
+ validation,
92
+ register,
93
+ errors,
94
+ }) => (
95
+ <TextField
96
+ type="datetime-local"
97
+ {...{ defaultValue, disabled }}
98
+ {...register(name, { ...validation })}
99
+ invalid={errors[name]}
100
+ />
101
+ );
102
+
87
103
  export const InputNumber: React.FC<IInputProps & IReactHookFormProps> = ({
88
104
  disabled,
89
105
  name,
@@ -97,7 +113,7 @@ export const InputNumber: React.FC<IInputProps & IReactHookFormProps> = ({
97
113
  <TextField
98
114
  type="number"
99
115
  {...{ defaultValue, disabled, placeholder, icon }}
100
- {...register(name, { ...validation })}
116
+ {...register(name, { ...validation, valueAsNumber: true })}
101
117
  invalid={errors[name]}
102
118
  />
103
119
  );
@@ -116,7 +132,7 @@ export const InputFloat: React.FC<IInputProps & IReactHookFormProps> = ({
116
132
  type="number"
117
133
  step=".01"
118
134
  {...{ disabled, placeholder, icon, defaultValue }}
119
- {...register(name, { ...validation })}
135
+ {...register(name, { ...validation, valueAsNumber: true })}
120
136
  invalid={errors[name]}
121
137
  />
122
138
  );