@conduction/components 2.1.14 → 2.1.16
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 +2 -0
- package/lib/components/formFields/date/Date.d.ts +12 -0
- package/lib/components/formFields/date/Date.js +10 -0
- package/lib/components/formFields/date/Date.module.css +12 -0
- package/lib/components/formFields/index.d.ts +3 -2
- package/lib/components/formFields/index.js +3 -2
- package/lib/components/formFields/input.d.ts +0 -2
- package/lib/components/formFields/input.js +0 -2
- package/lib/components/toolTip/ToolTip.js +2 -1
- package/package.json +3 -1
- package/src/components/formFields/date/Date.module.css +12 -0
- package/src/components/formFields/date/Date.tsx +42 -0
- package/src/components/formFields/index.tsx +2 -11
- package/src/components/formFields/input.tsx +0 -32
- package/src/components/toolTip/ToolTip.tsx +3 -4
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
- **Version 2.1 (breaking changes from 2.0.x)**
|
|
6
6
|
|
|
7
|
+
- 2.1.16: Refactor ToolTip layoutClassName placement.
|
|
8
|
+
- 2.1.15: Add InputDate component based on react-datepicker.
|
|
7
9
|
- 2.1.14: Refactor checkbox to remove svg errors
|
|
8
10
|
- 2.1.13: Refactor components to remove svg errors (e.g. shape-rendering => shapeRendering)
|
|
9
11
|
- 2.1.12: Added ToolTip max-width and break-word
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
3
|
+
import { Control, FieldValues } from "react-hook-form";
|
|
4
|
+
import { IReactHookFormProps } from "../types";
|
|
5
|
+
interface IDateProps {
|
|
6
|
+
control: Control<FieldValues, any>;
|
|
7
|
+
name: string;
|
|
8
|
+
showTimeSelect?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const InputDate: React.FC<IDateProps & IReactHookFormProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
3
|
+
import * as styles from "./Date.module.css";
|
|
4
|
+
import { Controller } from "react-hook-form";
|
|
5
|
+
import DatePicker from "react-datepicker";
|
|
6
|
+
export const InputDate = ({ name, errors, control, validation, disabled, }) => {
|
|
7
|
+
return (_jsx(Controller, { ...{ control, name }, rules: validation, render: ({ field: { onChange, value } }) => {
|
|
8
|
+
return (_jsx(DatePicker, { calendarClassName: styles.calendar, className: "denhaag-datepicker__input", onChange: (date) => onChange(date), dateFormat: "d-MM-yyyy HH:mm", selected: value, timeIntervals: 1, showTimeSelect: true, ...{ errors, value, disabled } }));
|
|
9
|
+
} }));
|
|
10
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { InputText, InputPassword, InputEmail, InputURL,
|
|
1
|
+
import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input";
|
|
2
2
|
import { Textarea } from "./textarea";
|
|
3
3
|
import { InputCheckbox } from "./checkbox/checkbox";
|
|
4
4
|
import { InputRadio } from "./radio";
|
|
5
5
|
import { SelectSingle, SelectMultiple, SelectCreate } from "./select/select";
|
|
6
6
|
import { CreateKeyValue, IKeyValue } from "./createKeyValue/CreateKeyValue";
|
|
7
|
-
|
|
7
|
+
import { InputDate } from "./date/Date";
|
|
8
|
+
export { InputRadio, InputText, InputPassword, InputEmail, InputURL, InputDate, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, SelectCreate, CreateKeyValue, IKeyValue, };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { InputText, InputPassword, InputEmail, InputURL,
|
|
1
|
+
import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input";
|
|
2
2
|
import { Textarea } from "./textarea";
|
|
3
3
|
import { InputCheckbox } from "./checkbox/checkbox";
|
|
4
4
|
import { InputRadio } from "./radio";
|
|
5
5
|
import { SelectSingle, SelectMultiple, SelectCreate } from "./select/select";
|
|
6
6
|
import { CreateKeyValue } from "./createKeyValue/CreateKeyValue";
|
|
7
|
-
|
|
7
|
+
import { InputDate } from "./date/Date";
|
|
8
|
+
export { InputRadio, InputText, InputPassword, InputEmail, InputURL, InputDate, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, SelectCreate, CreateKeyValue, };
|
|
@@ -11,8 +11,6 @@ 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 InputURL: React.FC<IInputProps & IReactHookFormProps>;
|
|
14
|
-
export declare const InputDate: React.FC<IInputProps & IReactHookFormProps>;
|
|
15
|
-
export declare const InputDateTime: React.FC<IInputProps & IReactHookFormProps>;
|
|
16
14
|
export declare const InputNumber: React.FC<IInputProps & IReactHookFormProps>;
|
|
17
15
|
export declare const InputFloat: React.FC<IInputProps & IReactHookFormProps>;
|
|
18
16
|
interface IInputFileProps {
|
|
@@ -10,8 +10,6 @@ export const InputPassword = ({ disabled, name, validation, register, placeholde
|
|
|
10
10
|
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
11
|
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
12
|
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, register, }) => (_jsx(TextField, { type: "date", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
14
|
-
export const InputDateTime = ({ disabled, name, defaultValue, validation, register, errors, }) => (_jsx(TextField, { type: "datetime-local", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
15
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] }));
|
|
16
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] }));
|
|
17
15
|
export const InputFile = ({ disabled, name, accept, defaultValue, validation, register, }) => (_jsx("input", { className: "denhaag-textfield__input", type: "file", ...{ defaultValue, disabled, accept }, ...register(name, { ...validation }) }));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
2
3
|
import ReactTooltip from "react-tooltip";
|
|
3
4
|
import * as styles from "./ToolTip.module.css";
|
|
4
5
|
export const ToolTip = ({ children, layoutClassName, tooltip }) => {
|
|
5
|
-
return (_jsxs("div", { className: styles.wrapper, children: [_jsx("div", { "data-tip": tooltip,
|
|
6
|
+
return (_jsxs("div", { className: clsx(styles.wrapper, layoutClassName && layoutClassName), children: [_jsx("div", { "data-tip": tooltip, children: children }), _jsx(ReactTooltip, { place: "top", type: "dark", effect: "solid", className: styles.tooltip })] }));
|
|
6
7
|
};
|
|
7
8
|
export { ReactTooltip };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conduction/components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.16",
|
|
4
4
|
"description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"clsx": "^1.1.1",
|
|
33
33
|
"gatsby": "^4.11.1",
|
|
34
34
|
"react": "^17.0.1",
|
|
35
|
+
"react-datepicker": "^4.10.0",
|
|
35
36
|
"react-hook-form": "7.29.0",
|
|
36
37
|
"react-select": "5.3.2",
|
|
37
38
|
"react-tooltip": "^4.2.21"
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@types/node": "^17.0.23",
|
|
41
42
|
"@types/react": "^17.0.43",
|
|
43
|
+
"@types/react-datepicker": "^4.8.0",
|
|
42
44
|
"@types/react-dom": "^17.0.14",
|
|
43
45
|
"tsc-hooks": "^1.1.1",
|
|
44
46
|
"typescript": "^4.6.3"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
3
|
+
import * as styles from "./Date.module.css";
|
|
4
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
|
5
|
+
import { IReactHookFormProps } from "../types";
|
|
6
|
+
import DatePicker from "react-datepicker";
|
|
7
|
+
|
|
8
|
+
interface IDateProps {
|
|
9
|
+
control: Control<FieldValues, any>;
|
|
10
|
+
name: string;
|
|
11
|
+
showTimeSelect?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const InputDate: React.FC<IDateProps & IReactHookFormProps> = ({
|
|
16
|
+
name,
|
|
17
|
+
errors,
|
|
18
|
+
control,
|
|
19
|
+
validation,
|
|
20
|
+
disabled,
|
|
21
|
+
}) => {
|
|
22
|
+
return (
|
|
23
|
+
<Controller
|
|
24
|
+
{...{ control, name }}
|
|
25
|
+
rules={validation}
|
|
26
|
+
render={({ field: { onChange, value } }) => {
|
|
27
|
+
return (
|
|
28
|
+
<DatePicker
|
|
29
|
+
calendarClassName={styles.calendar}
|
|
30
|
+
className="denhaag-datepicker__input"
|
|
31
|
+
onChange={(date) => onChange(date)}
|
|
32
|
+
dateFormat="d-MM-yyyy HH:mm"
|
|
33
|
+
selected={value}
|
|
34
|
+
timeIntervals={1}
|
|
35
|
+
showTimeSelect
|
|
36
|
+
{...{ errors, value, disabled }}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InputText,
|
|
3
|
-
InputPassword,
|
|
4
|
-
InputEmail,
|
|
5
|
-
InputURL,
|
|
6
|
-
InputDate,
|
|
7
|
-
InputDateTime,
|
|
8
|
-
InputNumber,
|
|
9
|
-
InputFile,
|
|
10
|
-
} from "./input";
|
|
1
|
+
import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input";
|
|
11
2
|
import { Textarea } from "./textarea";
|
|
12
3
|
import { InputCheckbox } from "./checkbox/checkbox";
|
|
13
4
|
import { InputRadio } from "./radio";
|
|
14
5
|
import { SelectSingle, SelectMultiple, SelectCreate } from "./select/select";
|
|
15
6
|
import { CreateKeyValue, IKeyValue } from "./createKeyValue/CreateKeyValue";
|
|
7
|
+
import { InputDate } from "./date/Date";
|
|
16
8
|
|
|
17
9
|
export {
|
|
18
10
|
InputRadio,
|
|
@@ -21,7 +13,6 @@ export {
|
|
|
21
13
|
InputEmail,
|
|
22
14
|
InputURL,
|
|
23
15
|
InputDate,
|
|
24
|
-
InputDateTime,
|
|
25
16
|
InputNumber,
|
|
26
17
|
InputCheckbox,
|
|
27
18
|
InputFile,
|
|
@@ -91,38 +91,6 @@ export const InputURL: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
|
91
91
|
/>
|
|
92
92
|
);
|
|
93
93
|
|
|
94
|
-
export const InputDate: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
95
|
-
disabled,
|
|
96
|
-
name,
|
|
97
|
-
defaultValue,
|
|
98
|
-
validation,
|
|
99
|
-
errors,
|
|
100
|
-
register,
|
|
101
|
-
}) => (
|
|
102
|
-
<TextField
|
|
103
|
-
type="date"
|
|
104
|
-
{...{ defaultValue, disabled }}
|
|
105
|
-
{...register(name, { ...validation })}
|
|
106
|
-
invalid={errors[name]}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
export const InputDateTime: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
111
|
-
disabled,
|
|
112
|
-
name,
|
|
113
|
-
defaultValue,
|
|
114
|
-
validation,
|
|
115
|
-
register,
|
|
116
|
-
errors,
|
|
117
|
-
}) => (
|
|
118
|
-
<TextField
|
|
119
|
-
type="datetime-local"
|
|
120
|
-
{...{ defaultValue, disabled }}
|
|
121
|
-
{...register(name, { ...validation })}
|
|
122
|
-
invalid={errors[name]}
|
|
123
|
-
/>
|
|
124
|
-
);
|
|
125
|
-
|
|
126
94
|
export const InputNumber: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
127
95
|
disabled,
|
|
128
96
|
name,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
1
2
|
import _ from "lodash";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import ReactTooltip from "react-tooltip";
|
|
@@ -11,10 +12,8 @@ interface ToolTipProps {
|
|
|
11
12
|
|
|
12
13
|
export const ToolTip: React.FC<ToolTipProps> = ({ children, layoutClassName, tooltip }) => {
|
|
13
14
|
return (
|
|
14
|
-
<div className={styles.wrapper}>
|
|
15
|
-
<div data-tip={tooltip}
|
|
16
|
-
{children}
|
|
17
|
-
</div>
|
|
15
|
+
<div className={clsx(styles.wrapper, layoutClassName && layoutClassName)}>
|
|
16
|
+
<div data-tip={tooltip}>{children}</div>
|
|
18
17
|
|
|
19
18
|
<ReactTooltip place={"top"} type={"dark"} effect={"solid"} className={styles.tooltip} />
|
|
20
19
|
</div>
|