@conduction/components 2.1.20 → 2.1.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/.github/workflows/npm-publish.yml +39 -39
- package/.prettierrc +30 -30
- package/README.md +23 -21
- package/lib/components/badgeCounter/BadgeCounter.d.ts +8 -8
- package/lib/components/badgeCounter/BadgeCounter.js +4 -4
- package/lib/components/badgeCounter/BadgeCounter.module.css +27 -27
- package/lib/components/card/detailsCard/DetailsCard.d.ts +14 -14
- package/lib/components/card/detailsCard/DetailsCard.js +10 -10
- package/lib/components/card/detailsCard/DetailsCard.module.css +51 -51
- package/lib/components/card/downloadCard/DownloadCard.d.ts +11 -11
- package/lib/components/card/downloadCard/DownloadCard.js +8 -8
- package/lib/components/card/downloadCard/DownloadCard.module.css +27 -27
- package/lib/components/card/horizontalImageCard/HorizontalImageCard.d.ts +13 -13
- package/lib/components/card/horizontalImageCard/HorizontalImageCard.js +9 -9
- package/lib/components/card/horizontalImageCard/HorizontalImageCard.module.css +34 -34
- package/lib/components/card/imageAndDetailsCard/ImageAndDetailsCard.d.ts +14 -14
- package/lib/components/card/imageAndDetailsCard/ImageAndDetailsCard.js +9 -9
- package/lib/components/card/imageAndDetailsCard/ImageAndDetailsCard.module.css +63 -63
- package/lib/components/card/index.d.ts +7 -7
- package/lib/components/card/index.js +7 -7
- package/lib/components/card/infoCard/InfoCard.d.ts +8 -8
- package/lib/components/card/infoCard/InfoCard.js +6 -6
- package/lib/components/card/infoCard/InfoCard.module.css +26 -26
- package/lib/components/card/richContentCard/RichContentCard.d.ts +19 -19
- package/lib/components/card/richContentCard/RichContentCard.js +15 -15
- package/lib/components/card/richContentCard/RichContentCard.module.css +93 -93
- package/lib/components/codeBlock/CodeBlock.d.ts +6 -6
- package/lib/components/codeBlock/CodeBlock.js +3 -3
- package/lib/components/codeBlock/CodeBlock.module.css +6 -6
- package/lib/components/container/Container.d.ts +6 -6
- package/lib/components/container/Container.js +4 -4
- package/lib/components/container/Container.module.css +9 -9
- package/lib/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.css +222 -222
- package/lib/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.d.ts +17 -17
- package/lib/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.js +20 -20
- package/lib/components/denhaag-wrappers/pagination/Pagination.css +120 -120
- package/lib/components/denhaag-wrappers/pagination/Pagination.d.ts +9 -9
- package/lib/components/denhaag-wrappers/pagination/Pagination.js +15 -15
- package/lib/components/editableTableRow/EditableTableRow.d.ts +14 -14
- package/lib/components/editableTableRow/EditableTableRow.js +31 -31
- package/lib/components/editableTableRow/EditableTableRow.module.css +25 -25
- package/lib/components/formFields/checkbox/Checkbox.module.css +7 -7
- package/lib/components/formFields/checkbox/checkbox.d.ts +9 -9
- package/lib/components/formFields/checkbox/checkbox.js +3 -3
- package/lib/components/formFields/createKeyValue/CreateKeyValue.d.ts +22 -18
- package/lib/components/formFields/createKeyValue/CreateKeyValue.js +41 -31
- package/lib/components/formFields/createKeyValue/CreateKeyValue.module.css +56 -43
- package/lib/components/formFields/date/Date.d.ts +12 -12
- package/lib/components/formFields/date/Date.js +10 -10
- package/lib/components/formFields/date/Date.module.css +12 -12
- package/lib/components/formFields/errorMessage/ErrorMessage.d.ts +5 -0
- package/lib/components/formFields/errorMessage/ErrorMessage.js +3 -0
- package/lib/components/formFields/errorMessage/ErrorMessage.module.css +9 -0
- package/lib/components/formFields/index.d.ts +8 -8
- package/lib/components/formFields/index.js +8 -8
- package/lib/components/formFields/input.d.ts +21 -20
- package/lib/components/formFields/input.js +16 -15
- package/lib/components/formFields/radio.d.ts +9 -9
- package/lib/components/formFields/radio.js +3 -3
- package/lib/components/formFields/select/select.d.ts +19 -18
- package/lib/components/formFields/select/select.js +22 -21
- package/lib/components/formFields/select/select.module.css +38 -38
- package/lib/components/formFields/textarea.d.ts +9 -8
- package/lib/components/formFields/textarea.js +4 -3
- package/lib/components/formFields/types.d.ts +6 -6
- package/lib/components/formFields/types.js +1 -1
- package/lib/components/imageDivider/ImageDivider.d.ts +7 -7
- package/lib/components/imageDivider/ImageDivider.js +6 -6
- package/lib/components/imageDivider/imageDivider.module.css +5 -5
- package/lib/components/logo/Logo.d.ts +8 -8
- package/lib/components/logo/Logo.js +10 -10
- package/lib/components/logo/Logo.module.css +15 -15
- package/lib/components/metaIcon/MetaIcon.d.ts +7 -7
- package/lib/components/metaIcon/MetaIcon.js +3 -3
- package/lib/components/metaIcon/MetaIcon.module.css +29 -29
- package/lib/components/notificationPopUp/NotificationPopUp.d.ts +26 -26
- package/lib/components/notificationPopUp/NotificationPopUp.js +31 -31
- package/lib/components/privateRoute/PrivateRoute.d.ts +6 -6
- package/lib/components/privateRoute/PrivateRoute.js +15 -15
- package/lib/components/quoteWrapper/QuoteWrapper.d.ts +7 -7
- package/lib/components/quoteWrapper/QuoteWrapper.js +5 -5
- package/lib/components/quoteWrapper/QuoteWrapper.module.css +12 -12
- package/lib/components/statusSteps/StatusSteps.d.ts +13 -13
- package/lib/components/statusSteps/StatusSteps.js +5 -5
- package/lib/components/tag/Tag.d.ts +10 -10
- package/lib/components/tag/Tag.js +6 -6
- package/lib/components/tag/Tag.module.css +44 -44
- package/lib/components/toolTip/ToolTip.d.ts +9 -9
- package/lib/components/toolTip/ToolTip.js +8 -8
- package/lib/components/topNav/index.d.ts +3 -3
- package/lib/components/topNav/index.js +3 -3
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.d.ts +20 -20
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.js +17 -17
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.module.css +145 -145
- package/lib/components/topNav/secondaryTopNav/SecondaryTopNav.d.ts +12 -12
- package/lib/components/topNav/secondaryTopNav/SecondaryTopNav.js +7 -7
- package/lib/components/topNav/secondaryTopNav/SecondaryTopNav.module.css +63 -63
- package/lib/index.d.ts +27 -27
- package/lib/index.js +20 -20
- package/package.json +1 -1
- package/src/components/badgeCounter/BadgeCounter.module.css +27 -27
- package/src/components/card/detailsCard/DetailsCard.module.css +51 -51
- package/src/components/card/downloadCard/DownloadCard.js +10 -10
- package/src/components/card/downloadCard/DownloadCard.module.css +27 -27
- package/src/components/card/horizontalImageCard/HorizontalImageCard.js +9 -9
- package/src/components/card/horizontalImageCard/HorizontalImageCard.module.css +34 -34
- package/src/components/card/imageAndDetailsCard/ImageAndDetailsCard.js +9 -9
- package/src/components/card/imageAndDetailsCard/ImageAndDetailsCard.module.css +63 -63
- package/src/components/card/index.js +5 -5
- package/src/components/card/index.tsx +8 -8
- package/src/components/card/infoCard/InfoCard.module.css +26 -26
- package/src/components/card/richContentCard/RichContentCard.js +17 -17
- package/src/components/card/richContentCard/RichContentCard.module.css +93 -93
- package/src/components/codeBlock/CodeBlock.module.css +6 -6
- package/src/components/container/Container.js +3 -3
- package/src/components/container/Container.module.css +9 -9
- package/src/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.css +222 -222
- package/src/components/denhaag-wrappers/breadcrumbs/Breadcrumbs.js +84 -84
- package/src/components/denhaag-wrappers/pagination/Pagination.css +120 -120
- package/src/components/editableTableRow/EditableTableRow.js +34 -34
- package/src/components/editableTableRow/EditableTableRow.module.css +25 -25
- package/src/components/formFields/checkbox/Checkbox.module.css +7 -7
- package/src/components/formFields/createKeyValue/CreateKeyValue.module.css +56 -43
- package/src/components/formFields/createKeyValue/CreateKeyValue.tsx +53 -12
- package/src/components/formFields/date/Date.module.css +12 -12
- package/src/components/formFields/errorMessage/ErrorMessage.module.css +9 -0
- package/src/components/formFields/errorMessage/ErrorMessage.tsx +9 -0
- package/src/components/formFields/index.js +4 -4
- package/src/components/formFields/input.js +12 -12
- package/src/components/formFields/input.tsx +69 -42
- package/src/components/formFields/select/select.module.css +38 -38
- package/src/components/formFields/select/select.tsx +122 -109
- package/src/components/formFields/textarea.js +3 -3
- package/src/components/formFields/textarea.tsx +7 -2
- package/src/components/formFields/types.js +1 -1
- package/src/components/imageDivider/ImageDivider.js +6 -6
- package/src/components/imageDivider/imageDivider.module.css +5 -5
- package/src/components/logo/Logo.js +10 -10
- package/src/components/logo/Logo.module.css +15 -15
- package/src/components/metaIcon/MetaIcon.js +3 -3
- package/src/components/metaIcon/MetaIcon.module.css +29 -29
- package/src/components/privateRoute/PrivateRoute.js +15 -15
- package/src/components/quoteWrapper/QuoteWrapper.module.css +12 -12
- package/src/components/statusSteps/StatusSteps.js +5 -5
- package/src/components/tag/Tag.module.css +44 -44
- package/src/components/topNav/index.ts +4 -4
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css +145 -145
- package/src/components/topNav/secondaryTopNav/SecondaryTopNav.module.css +63 -63
- package/src/custom.d.ts +4 -4
- package/src/index.ts +79 -79
|
@@ -2,9 +2,12 @@ import * as React from "react";
|
|
|
2
2
|
import * as styles from "./CreateKeyValue.module.css";
|
|
3
3
|
import { Control, Controller, FieldValues } from "react-hook-form";
|
|
4
4
|
import { IReactHookFormProps } from "../types";
|
|
5
|
-
import { IInputProps } from "../input";
|
|
6
5
|
import { Button } from "@gemeente-denhaag/components-react";
|
|
7
6
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@gemeente-denhaag/table";
|
|
7
|
+
import { ToolTip } from "../../toolTip/ToolTip";
|
|
8
|
+
import clsx from "clsx";
|
|
9
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
10
|
+
import { faCopy, faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* Export KeyValue input component (wrapped in FormFieldGroup)
|
|
@@ -14,6 +17,10 @@ interface CreateKeyValueProps {
|
|
|
14
17
|
control: Control<FieldValues, any>;
|
|
15
18
|
defaultValue?: IKeyValue[];
|
|
16
19
|
disabled?: boolean;
|
|
20
|
+
copyValue?: {
|
|
21
|
+
canCopy: boolean;
|
|
22
|
+
onCopied?: () => any;
|
|
23
|
+
};
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
export interface IKeyValue {
|
|
@@ -28,13 +35,14 @@ export const CreateKeyValue = ({
|
|
|
28
35
|
validation,
|
|
29
36
|
defaultValue,
|
|
30
37
|
disabled,
|
|
38
|
+
copyValue,
|
|
31
39
|
}: CreateKeyValueProps & IReactHookFormProps): JSX.Element => {
|
|
32
40
|
return (
|
|
33
41
|
<Controller
|
|
34
42
|
{...{ control, name, errors }}
|
|
35
43
|
rules={validation}
|
|
36
44
|
render={({ field: { onChange } }) => {
|
|
37
|
-
return <KeyValueComponent handleChange={onChange} {...{ defaultValue, errors, disabled }} />;
|
|
45
|
+
return <KeyValueComponent handleChange={onChange} {...{ defaultValue, errors, disabled, copyValue }} />;
|
|
38
46
|
}}
|
|
39
47
|
/>
|
|
40
48
|
);
|
|
@@ -44,15 +52,25 @@ export const CreateKeyValue = ({
|
|
|
44
52
|
* Internal KeyValueComponent (contains all required logic)
|
|
45
53
|
*/
|
|
46
54
|
interface CreateKeyValueComponentProps {
|
|
47
|
-
defaultValue?: IKeyValue[];
|
|
48
55
|
handleChange: (...event: any[]) => void;
|
|
56
|
+
defaultValue?: IKeyValue[];
|
|
49
57
|
disabled?: boolean;
|
|
58
|
+
copyValue?: {
|
|
59
|
+
canCopy: boolean;
|
|
60
|
+
onCopied?: () => any;
|
|
61
|
+
};
|
|
50
62
|
}
|
|
51
63
|
|
|
52
|
-
const KeyValueComponent = ({
|
|
64
|
+
const KeyValueComponent = ({
|
|
65
|
+
defaultValue,
|
|
66
|
+
handleChange,
|
|
67
|
+
disabled,
|
|
68
|
+
copyValue,
|
|
69
|
+
}: CreateKeyValueComponentProps): JSX.Element => {
|
|
53
70
|
const [currentKey, setCurrentKey] = React.useState<string>("");
|
|
54
71
|
const [currentValue, setCurrentValue] = React.useState<string>("");
|
|
55
72
|
const [keyValues, setKeyValues] = React.useState<IKeyValue[]>(defaultValue ?? []);
|
|
73
|
+
const [currentCopyIdx, setCurrentCopyIdx] = React.useState<number>();
|
|
56
74
|
|
|
57
75
|
const currentKeyRef = React.useRef(null);
|
|
58
76
|
const currentValueRef = React.useRef(null);
|
|
@@ -66,6 +84,12 @@ const KeyValueComponent = ({ defaultValue, handleChange, disabled }: CreateKeyVa
|
|
|
66
84
|
setKeyValues([...keyValues, keyValue]);
|
|
67
85
|
};
|
|
68
86
|
|
|
87
|
+
const handleCopyToClipboard = (value: string, id: number) => {
|
|
88
|
+
navigator.clipboard.writeText(value);
|
|
89
|
+
setCurrentCopyIdx(id);
|
|
90
|
+
copyValue?.onCopied && copyValue.onCopied();
|
|
91
|
+
};
|
|
92
|
+
|
|
69
93
|
React.useEffect(() => {
|
|
70
94
|
defaultValue && setKeyValues(defaultValue);
|
|
71
95
|
}, [defaultValue]);
|
|
@@ -87,16 +111,33 @@ const KeyValueComponent = ({ defaultValue, handleChange, disabled }: CreateKeyVa
|
|
|
87
111
|
</TableHead>
|
|
88
112
|
<TableBody>
|
|
89
113
|
{keyValues.map((keyValue, idx) => (
|
|
90
|
-
<TableRow key={`${keyValue}${idx}`}>
|
|
114
|
+
<TableRow key={`${keyValue.key}${keyValue.value}${idx}`}>
|
|
91
115
|
<TableCell>{keyValue.key}</TableCell>
|
|
92
116
|
<TableCell>{keyValue.value}</TableCell>
|
|
93
|
-
<TableCell
|
|
94
|
-
<
|
|
95
|
-
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
<TableCell>
|
|
118
|
+
<div className={styles.buttonsContainer}>
|
|
119
|
+
{copyValue && (
|
|
120
|
+
<ToolTip tooltip="Copy value">
|
|
121
|
+
<Button
|
|
122
|
+
{...{ disabled }}
|
|
123
|
+
className={styles.copyButton}
|
|
124
|
+
onClick={() => handleCopyToClipboard(keyValue.value, idx)}
|
|
125
|
+
variant={currentCopyIdx === idx ? "secondary-action" : "primary-action"}
|
|
126
|
+
>
|
|
127
|
+
<FontAwesomeIcon icon={faCopy} />
|
|
128
|
+
</Button>
|
|
129
|
+
</ToolTip>
|
|
130
|
+
)}
|
|
131
|
+
<ToolTip tooltip="Delete value">
|
|
132
|
+
<Button
|
|
133
|
+
{...{ disabled }}
|
|
134
|
+
onClick={() => setKeyValues(keyValues.filter((_keyValue) => _keyValue !== keyValue))}
|
|
135
|
+
className={clsx(styles.deleteButton)}
|
|
136
|
+
>
|
|
137
|
+
<FontAwesomeIcon icon={faTrash} />
|
|
138
|
+
</Button>
|
|
139
|
+
</ToolTip>
|
|
140
|
+
</div>
|
|
100
141
|
</TableCell>
|
|
101
142
|
</TableRow>
|
|
102
143
|
))}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
display: flex;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.calendar {
|
|
6
|
-
display: flex;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.calendar > div::before,
|
|
10
|
-
.calendar > div::after {
|
|
11
|
-
display: none;
|
|
12
|
-
}
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.calendar {
|
|
6
|
+
display: flex;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.calendar > div::before,
|
|
10
|
+
.calendar > div::after {
|
|
11
|
+
display: none;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--conduction-error-message-color: var(--skeleton-color-red-3);
|
|
3
|
+
--conduction-error-message-font-size: var(--skeleton-font-size-sm);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.message {
|
|
7
|
+
color: var(--conduction-error-message-color);
|
|
8
|
+
font-size: var(--conduction-error-message-font-size);
|
|
9
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputText, InputPassword, InputEmail, InputDate, InputNumber } from "./input";
|
|
2
|
-
import { Textarea } from "./textarea";
|
|
3
|
-
import { InputCheckbox } from "./checkbox";
|
|
4
|
-
export { InputText, InputPassword, InputEmail, InputDate, InputNumber, InputCheckbox, Textarea };
|
|
1
|
+
import { InputText, InputPassword, InputEmail, InputDate, InputNumber } from "./input";
|
|
2
|
+
import { Textarea } from "./textarea";
|
|
3
|
+
import { InputCheckbox } from "./checkbox";
|
|
4
|
+
export { InputText, InputPassword, InputEmail, InputDate, InputNumber, InputCheckbox, Textarea };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { TextField } from "@gemeente-denhaag/components-react";
|
|
4
|
-
import { ShowIcon, HideIcon } from "@gemeente-denhaag/icons";
|
|
5
|
-
export const InputPassword = ({ disabled, name, validation, register, errors, }) => {
|
|
6
|
-
const [showPassword, setShowPassword] = React.useState(false);
|
|
7
|
-
return (_jsx(TextField, { type: showPassword ? "text" : "password", ...{ disabled }, ...register(name, { ...validation }), invalid: errors[name], icon: _jsx("span", { onClick: () => setShowPassword(!showPassword), children: showPassword ? _jsx(HideIcon, {}) : _jsx(ShowIcon, {}) }) }));
|
|
8
|
-
};
|
|
9
|
-
export const InputText = ({ disabled, name, defaultValue, validation, register, errors, }) => (_jsx(TextField, { type: "text", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
10
|
-
export const InputEmail = ({ disabled, name, defaultValue, validation, register, errors, }) => (_jsx(TextField, { type: "email", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
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, errors, }) => (_jsx(TextField, { type: "number", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { TextField } from "@gemeente-denhaag/components-react";
|
|
4
|
+
import { ShowIcon, HideIcon } from "@gemeente-denhaag/icons";
|
|
5
|
+
export const InputPassword = ({ disabled, name, validation, register, errors, }) => {
|
|
6
|
+
const [showPassword, setShowPassword] = React.useState(false);
|
|
7
|
+
return (_jsx(TextField, { type: showPassword ? "text" : "password", ...{ disabled }, ...register(name, { ...validation }), invalid: errors[name], icon: _jsx("span", { onClick: () => setShowPassword(!showPassword), children: showPassword ? _jsx(HideIcon, {}) : _jsx(ShowIcon, {}) }) }));
|
|
8
|
+
};
|
|
9
|
+
export const InputText = ({ disabled, name, defaultValue, validation, register, errors, }) => (_jsx(TextField, { type: "text", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
10
|
+
export const InputEmail = ({ disabled, name, defaultValue, validation, register, errors, }) => (_jsx(TextField, { type: "email", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
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, errors, }) => (_jsx(TextField, { type: "number", ...{ defaultValue, disabled }, ...register(name, { ...validation }), invalid: errors[name] }));
|
|
@@ -3,6 +3,7 @@ import { TextField } from "@gemeente-denhaag/components-react";
|
|
|
3
3
|
import { IReactHookFormProps } from "./types";
|
|
4
4
|
import { faEyeSlash, faEye } from "@fortawesome/free-solid-svg-icons";
|
|
5
5
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
|
+
import { ErrorMessage } from "./errorMessage/ErrorMessage";
|
|
6
7
|
|
|
7
8
|
export interface IInputProps {
|
|
8
9
|
name: string;
|
|
@@ -10,6 +11,7 @@ export interface IInputProps {
|
|
|
10
11
|
defaultValue?: string;
|
|
11
12
|
icon?: JSX.Element;
|
|
12
13
|
placeholder?: string;
|
|
14
|
+
hideErrorMessage?: boolean;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export const InputPassword: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
@@ -19,21 +21,25 @@ export const InputPassword: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
|
19
21
|
register,
|
|
20
22
|
placeholder,
|
|
21
23
|
errors,
|
|
24
|
+
hideErrorMessage,
|
|
22
25
|
}) => {
|
|
23
26
|
const [showPassword, setShowPassword] = React.useState<boolean>(false);
|
|
24
27
|
|
|
25
28
|
return (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
<>
|
|
30
|
+
<TextField
|
|
31
|
+
type={showPassword ? "text" : "password"}
|
|
32
|
+
{...{ disabled, placeholder }}
|
|
33
|
+
{...register(name, { ...validation })}
|
|
34
|
+
invalid={errors[name]}
|
|
35
|
+
icon={
|
|
36
|
+
<span onClick={() => setShowPassword(!showPassword)}>
|
|
37
|
+
{showPassword ? <FontAwesomeIcon icon={faEye} /> : <FontAwesomeIcon icon={faEyeSlash} />}
|
|
38
|
+
</span>
|
|
39
|
+
}
|
|
40
|
+
/>
|
|
41
|
+
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
|
|
42
|
+
</>
|
|
37
43
|
);
|
|
38
44
|
};
|
|
39
45
|
|
|
@@ -46,13 +52,17 @@ export const InputText: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
|
46
52
|
icon,
|
|
47
53
|
placeholder,
|
|
48
54
|
errors,
|
|
55
|
+
hideErrorMessage,
|
|
49
56
|
}) => (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
<>
|
|
58
|
+
<TextField
|
|
59
|
+
type="text"
|
|
60
|
+
{...{ defaultValue, disabled, placeholder, icon }}
|
|
61
|
+
{...register(name, { ...validation })}
|
|
62
|
+
invalid={errors[name]}
|
|
63
|
+
/>
|
|
64
|
+
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
|
|
65
|
+
</>
|
|
56
66
|
);
|
|
57
67
|
|
|
58
68
|
export const InputEmail: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
@@ -64,13 +74,18 @@ export const InputEmail: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
|
64
74
|
icon,
|
|
65
75
|
placeholder,
|
|
66
76
|
errors,
|
|
77
|
+
hideErrorMessage,
|
|
67
78
|
}) => (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
<>
|
|
80
|
+
<TextField
|
|
81
|
+
type="email"
|
|
82
|
+
required={!!validation?.required}
|
|
83
|
+
{...{ defaultValue, disabled, placeholder, icon }}
|
|
84
|
+
{...register(name, { ...validation })}
|
|
85
|
+
invalid={errors[name]}
|
|
86
|
+
/>
|
|
87
|
+
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
|
|
88
|
+
</>
|
|
74
89
|
);
|
|
75
90
|
|
|
76
91
|
export const InputURL: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
@@ -82,13 +97,17 @@ export const InputURL: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
|
82
97
|
icon,
|
|
83
98
|
placeholder,
|
|
84
99
|
errors,
|
|
100
|
+
hideErrorMessage,
|
|
85
101
|
}) => (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
102
|
+
<>
|
|
103
|
+
<TextField
|
|
104
|
+
type="url"
|
|
105
|
+
{...{ defaultValue, disabled, placeholder, icon }}
|
|
106
|
+
{...register(name, { ...validation })}
|
|
107
|
+
invalid={errors[name]}
|
|
108
|
+
/>
|
|
109
|
+
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
|
|
110
|
+
</>
|
|
92
111
|
);
|
|
93
112
|
|
|
94
113
|
export const InputNumber: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
@@ -100,13 +119,17 @@ export const InputNumber: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
|
100
119
|
icon,
|
|
101
120
|
placeholder,
|
|
102
121
|
errors,
|
|
122
|
+
hideErrorMessage,
|
|
103
123
|
}) => (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
124
|
+
<>
|
|
125
|
+
<TextField
|
|
126
|
+
type="number"
|
|
127
|
+
{...{ defaultValue, disabled, placeholder, icon }}
|
|
128
|
+
{...register(name, { ...validation, valueAsNumber: true })}
|
|
129
|
+
invalid={errors[name]}
|
|
130
|
+
/>
|
|
131
|
+
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
|
|
132
|
+
</>
|
|
110
133
|
);
|
|
111
134
|
|
|
112
135
|
export const InputFloat: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
@@ -118,14 +141,18 @@ export const InputFloat: React.FC<IInputProps & IReactHookFormProps> = ({
|
|
|
118
141
|
icon,
|
|
119
142
|
placeholder,
|
|
120
143
|
errors,
|
|
144
|
+
hideErrorMessage,
|
|
121
145
|
}) => (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
146
|
+
<>
|
|
147
|
+
<TextField
|
|
148
|
+
type="number"
|
|
149
|
+
step=".01"
|
|
150
|
+
{...{ disabled, placeholder, icon, defaultValue }}
|
|
151
|
+
{...register(name, { ...validation, valueAsNumber: true })}
|
|
152
|
+
invalid={errors[name]}
|
|
153
|
+
/>
|
|
154
|
+
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
|
|
155
|
+
</>
|
|
129
156
|
);
|
|
130
157
|
|
|
131
158
|
interface IInputFileProps {
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--conduction-input-select-border: 1px solid var(--skeleton-color-grey-3);
|
|
3
|
-
--conduction-input-select-border-focus: 2px dashed var(--skeleton-color-grey-5);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.select > div {
|
|
7
|
-
background-color: var(--skeleton-color-white);
|
|
8
|
-
border: var(--conduction-input-select-border);
|
|
9
|
-
border-radius: var(--skeleton-border-radius-md);
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
padding-block-start: var(--skeleton-size-xs);
|
|
12
|
-
padding-block-end: var(--skeleton-size-xs);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.select.error > div {
|
|
16
|
-
border-color: var(
|
|
17
|
-
--utrecht-textbox-invalid-border-color,
|
|
18
|
-
var(--utrecht-form-input-invalid-border-color, var(--utrecht-textbox-border-color, var(--utrecht-form-input-border-color)))
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.select .select > div:focus-within {
|
|
23
|
-
outline: none;
|
|
24
|
-
box-shadow: none;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.select > div:focus-within::after {
|
|
28
|
-
content: "";
|
|
29
|
-
display: block;
|
|
30
|
-
position: absolute;
|
|
31
|
-
pointer-events: none;
|
|
32
|
-
bottom: calc(var(--skeleton-size-2xs) * -1);
|
|
33
|
-
left: calc(var(--skeleton-size-2xs) * -1);
|
|
34
|
-
right: calc(var(--skeleton-size-2xs) * -1);
|
|
35
|
-
top: calc(var(--skeleton-size-2xs) * -1);
|
|
36
|
-
border: var(--conduction-input-select-border-focus);
|
|
37
|
-
border-radius: var(--skeleton-border-radius-md);
|
|
38
|
-
}
|
|
1
|
+
:root {
|
|
2
|
+
--conduction-input-select-border: 1px solid var(--skeleton-color-grey-3);
|
|
3
|
+
--conduction-input-select-border-focus: 2px dashed var(--skeleton-color-grey-5);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.select > div {
|
|
7
|
+
background-color: var(--skeleton-color-white);
|
|
8
|
+
border: var(--conduction-input-select-border);
|
|
9
|
+
border-radius: var(--skeleton-border-radius-md);
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
padding-block-start: var(--skeleton-size-xs);
|
|
12
|
+
padding-block-end: var(--skeleton-size-xs);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.select.error > div {
|
|
16
|
+
border-color: var(
|
|
17
|
+
--utrecht-textbox-invalid-border-color,
|
|
18
|
+
var(--utrecht-form-input-invalid-border-color, var(--utrecht-textbox-border-color, var(--utrecht-form-input-border-color)))
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.select .select > div:focus-within {
|
|
23
|
+
outline: none;
|
|
24
|
+
box-shadow: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.select > div:focus-within::after {
|
|
28
|
+
content: "";
|
|
29
|
+
display: block;
|
|
30
|
+
position: absolute;
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
bottom: calc(var(--skeleton-size-2xs) * -1);
|
|
33
|
+
left: calc(var(--skeleton-size-2xs) * -1);
|
|
34
|
+
right: calc(var(--skeleton-size-2xs) * -1);
|
|
35
|
+
top: calc(var(--skeleton-size-2xs) * -1);
|
|
36
|
+
border: var(--conduction-input-select-border-focus);
|
|
37
|
+
border-radius: var(--skeleton-border-radius-md);
|
|
38
|
+
}
|