@conduction/components 2.1.13 → 2.1.15

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.1 (breaking changes from 2.0.x)**
6
6
 
7
+ - 2.1.15: Add InputDate component based on react-datepicker.
8
+ - 2.1.14: Refactor checkbox to remove svg errors
7
9
  - 2.1.13: Refactor components to remove svg errors (e.g. shape-rendering => shapeRendering)
8
10
  - 2.1.12: Added ToolTip max-width and break-word
9
11
  - 2.1.11: Added CreateKeyValue component disabled state on delete buttons
@@ -0,0 +1,7 @@
1
+ .container {
2
+ user-select: none;
3
+ }
4
+
5
+ .container:hover {
6
+ cursor: pointer;
7
+ }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { IReactHookFormProps } from "./types";
2
+ import { IReactHookFormProps } from "./../types";
3
3
  export interface ICheckboxProps {
4
4
  label: string;
5
5
  name: string;
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as styles from "./Checkbox.module.css";
3
+ export const InputCheckbox = ({ name, validation, register, label, defaultChecked, disabled, }) => (_jsxs("div", { className: styles.container, children: [_jsx("input", { type: "checkbox", id: `checkbox${name}`, ...{ defaultChecked, disabled }, ...register(name, { ...validation }) }), _jsx("label", { htmlFor: `checkbox${name}`, children: label })] }));
@@ -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
+ };
@@ -0,0 +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,7 +1,8 @@
1
- import { InputText, InputPassword, InputEmail, InputURL, InputDate, InputDateTime, InputNumber, InputFile } from "./input";
1
+ import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input";
2
2
  import { Textarea } from "./textarea";
3
- import { InputCheckbox } from "./checkbox";
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
- export { InputRadio, InputText, InputPassword, InputEmail, InputURL, InputDate, InputDateTime, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, SelectCreate, CreateKeyValue, IKeyValue, };
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, InputDate, InputDateTime, InputNumber, InputFile, } from "./input";
1
+ import { InputText, InputPassword, InputEmail, InputURL, InputNumber, InputFile } from "./input";
2
2
  import { Textarea } from "./textarea";
3
- import { InputCheckbox } from "./checkbox";
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
- export { InputRadio, InputText, InputPassword, InputEmail, InputURL, InputDate, InputDateTime, InputNumber, InputCheckbox, InputFile, Textarea, SelectSingle, SelectMultiple, SelectCreate, CreateKeyValue, };
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 }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
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,7 @@
1
+ .container {
2
+ user-select: none;
3
+ }
4
+
5
+ .container:hover {
6
+ cursor: pointer;
7
+ }
@@ -0,0 +1,28 @@
1
+ import * as styles from "./Checkbox.module.css";
2
+ import { IReactHookFormProps } from "./../types";
3
+
4
+ export interface ICheckboxProps {
5
+ label: string;
6
+ name: string;
7
+ defaultChecked?: boolean;
8
+ disabled?: boolean;
9
+ }
10
+
11
+ export const InputCheckbox: React.FC<ICheckboxProps & IReactHookFormProps> = ({
12
+ name,
13
+ validation,
14
+ register,
15
+ label,
16
+ defaultChecked,
17
+ disabled,
18
+ }) => (
19
+ <div className={styles.container}>
20
+ <input
21
+ type="checkbox"
22
+ id={`checkbox${name}`}
23
+ {...{ defaultChecked, disabled }}
24
+ {...register(name, { ...validation })}
25
+ />
26
+ <label htmlFor={`checkbox${name}`}>{label}</label>
27
+ </div>
28
+ );
@@ -0,0 +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
+ }
@@ -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
- import { InputCheckbox } from "./checkbox";
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 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FormControlLabel } from "@gemeente-denhaag/components-react";
3
- export const InputCheckbox = ({ name, validation, register, label, defaultChecked, disabled, }) => (_jsx(FormControlLabel, { input: _jsx("input", { type: "checkbox", id: `checkbox${name}`, ...{ defaultChecked, disabled }, ...register(name, { ...validation }) }), ...{ label } }));
@@ -1,3 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FormControlLabel } from "@gemeente-denhaag/components-react";
3
- export const InputCheckbox = ({ name, validation, register, label, }) => _jsx(FormControlLabel, { input: _jsx("input", { type: "checkbox", ...register(name, { ...validation }) }), ...{ label } });
@@ -1,30 +0,0 @@
1
- import { FormControlLabel } from "@gemeente-denhaag/components-react";
2
- import { IReactHookFormProps } from "./types";
3
-
4
- export interface ICheckboxProps {
5
- label: string;
6
- name: string;
7
- defaultChecked?: boolean;
8
- disabled?: boolean;
9
- }
10
-
11
- export const InputCheckbox: React.FC<ICheckboxProps & IReactHookFormProps> = ({
12
- name,
13
- validation,
14
- register,
15
- label,
16
- defaultChecked,
17
- disabled,
18
- }) => (
19
- <FormControlLabel
20
- input={
21
- <input
22
- type="checkbox"
23
- id={`checkbox${name}`}
24
- {...{ defaultChecked, disabled }}
25
- {...register(name, { ...validation })}
26
- />
27
- }
28
- {...{ label }}
29
- />
30
- );
package/src/index.js DELETED
@@ -1,14 +0,0 @@
1
- export * from "./components/card";
2
- export * from "./components/casesTable/CasesTable";
3
- export * from "./components/container/Container";
4
- export * from "./components/denhaag-wrappers/breadcrumbs/Breadcrumbs";
5
- export * from "./components/editableTableRow/EditableTableRow";
6
- export * from "./components/formFields";
7
- export * from "./components/imageDivider/ImageDivider";
8
- export * from "./components/logo/Logo";
9
- export * from "./components/messageForm/MessageForm";
10
- export * from "./components/messagesTable/MessagesTable";
11
- export * from "./components/metaIcon/MetaIcon";
12
- export * from "./components/privateRoute/PrivateRoute";
13
- export * from "./components/statusSteps/StatusSteps";
14
- export * from "./components/topNav/TopNav";