@conduction/components 2.1.0 → 2.1.2
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
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { IReactHookFormProps } from "./types";
|
|
3
|
-
import { Control, FieldValues } from "react-hook-form";
|
|
4
3
|
export interface IInputProps {
|
|
5
4
|
name: string;
|
|
6
5
|
disabled?: boolean;
|
|
7
6
|
defaultValue?: string;
|
|
8
7
|
icon?: JSX.Element;
|
|
9
8
|
placeholder?: string;
|
|
10
|
-
control?: Control<FieldValues, any>;
|
|
11
9
|
}
|
|
12
10
|
export declare const InputPassword: React.FC<IInputProps & IReactHookFormProps>;
|
|
13
11
|
export declare const InputText: React.FC<IInputProps & IReactHookFormProps>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { TextField } from "@gemeente-denhaag/components-react";
|
|
4
4
|
import { ShowIcon, HideIcon } from "@gemeente-denhaag/icons";
|
|
5
|
-
import { Controller } from "react-hook-form";
|
|
6
5
|
export const InputPassword = ({ disabled, name, validation, register, placeholder, errors, }) => {
|
|
7
6
|
const [showPassword, setShowPassword] = React.useState(false);
|
|
8
7
|
return (_jsx(TextField, { type: showPassword ? "text" : "password", ...{ disabled, placeholder }, ...register(name, { ...validation }), invalid: errors[name], icon: _jsx("span", { onClick: () => setShowPassword(!showPassword), children: showPassword ? _jsx(HideIcon, {}) : _jsx(ShowIcon, {}) }) }));
|
|
@@ -10,9 +9,7 @@ export const InputPassword = ({ disabled, name, validation, register, placeholde
|
|
|
10
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] }));
|
|
11
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] }));
|
|
12
11
|
export const InputURL = ({ disabled, name, defaultValue, validation, register, icon, placeholder, errors, }) => (_jsx(TextField, { type: "url", ...{ defaultValue, disabled, placeholder, icon }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
13
|
-
export const InputDate = ({ disabled, name, defaultValue, validation, errors,
|
|
14
|
-
return _jsx(Datepicker, { ...{ value, onChange, disabled }, error: !!errors[name] });
|
|
15
|
-
} }));
|
|
12
|
+
export const InputDate = ({ disabled, name, defaultValue, validation, errors, register, }) => (_jsx(TextField, { type: "date", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
16
13
|
export const InputDateTime = ({ disabled, name, defaultValue, validation, register, errors, }) => (_jsx(TextField, { type: "datetime-local", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
17
14
|
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] }));
|
|
18
15
|
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] }));
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { TextField } from "@gemeente-denhaag/components-react";
|
|
3
3
|
import { ShowIcon, HideIcon } from "@gemeente-denhaag/icons";
|
|
4
4
|
import { IReactHookFormProps } from "./types";
|
|
5
|
-
import { Control, FieldValues, Controller } from "react-hook-form";
|
|
6
5
|
|
|
7
6
|
export interface IInputProps {
|
|
8
7
|
name: string;
|
|
@@ -10,7 +9,6 @@ export interface IInputProps {
|
|
|
10
9
|
defaultValue?: string;
|
|
11
10
|
icon?: JSX.Element;
|
|
12
11
|
placeholder?: string;
|
|
13
|
-
control?: Control<FieldValues, any>;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export const InputPassword: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
@@ -94,14 +92,13 @@ export const InputDate: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
|
94
92
|
defaultValue,
|
|
95
93
|
validation,
|
|
96
94
|
errors,
|
|
97
|
-
|
|
95
|
+
register,
|
|
98
96
|
}) => (
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}}
|
|
97
|
+
<TextField
|
|
98
|
+
type="date"
|
|
99
|
+
{...{ defaultValue, disabled }}
|
|
100
|
+
{...register(name, { ...validation })}
|
|
101
|
+
invalid={errors[name]}
|
|
105
102
|
/>
|
|
106
103
|
);
|
|
107
104
|
|