@conduction/components 2.1.22 → 2.1.25

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,9 @@
4
4
 
5
5
  - **Version 2.1 (breaking changes from 2.0.x)**
6
6
 
7
+ - 2.1.25: Added id prop to select component
8
+ - 2.1.24: Add new design tokens for topnav dropdown
9
+ - 2.1.23: Added optional error messages to CreateKeyValue and unused classname removed warning.
7
10
  - 2.1.22: Added optional error messages to textarea, select and input fields.
8
11
  - 2.1.21: Added optional copy button and refactored delete button in CreateKeyValue.
9
12
  - 2.1.20: Updated react.fc code and github actions added.
@@ -13,10 +13,11 @@ interface CreateKeyValueProps {
13
13
  canCopy: boolean;
14
14
  onCopied?: () => any;
15
15
  };
16
+ hideErrorMessage?: boolean;
16
17
  }
17
18
  export interface IKeyValue {
18
19
  key: string;
19
20
  value: string;
20
21
  }
21
- export declare const CreateKeyValue: ({ name, errors, control, validation, defaultValue, disabled, copyValue, }: CreateKeyValueProps & IReactHookFormProps) => JSX.Element;
22
+ export declare const CreateKeyValue: ({ name, errors, control, validation, defaultValue, disabled, copyValue, hideErrorMessage, }: CreateKeyValueProps & IReactHookFormProps) => JSX.Element;
22
23
  export {};
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import * as styles from "./CreateKeyValue.module.css";
4
4
  import { Controller } from "react-hook-form";
@@ -8,9 +8,10 @@ import { ToolTip } from "../../toolTip/ToolTip";
8
8
  import clsx from "clsx";
9
9
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
10
10
  import { faCopy, faTrash } from "@fortawesome/free-solid-svg-icons";
11
- export const CreateKeyValue = ({ name, errors, control, validation, defaultValue, disabled, copyValue, }) => {
11
+ import { ErrorMessage } from "../errorMessage/ErrorMessage";
12
+ export const CreateKeyValue = ({ name, errors, control, validation, defaultValue, disabled, copyValue, hideErrorMessage, }) => {
12
13
  return (_jsx(Controller, { ...{ control, name, errors }, rules: validation, render: ({ field: { onChange } }) => {
13
- return _jsx(KeyValueComponent, { handleChange: onChange, ...{ defaultValue, errors, disabled, copyValue } });
14
+ return (_jsxs(_Fragment, { children: [_jsx(KeyValueComponent, { handleChange: onChange, ...{ defaultValue, errors, disabled, copyValue } }), errors[name] && !hideErrorMessage && _jsx(ErrorMessage, { message: errors[name].message })] }));
14
15
  } }));
15
16
  };
16
17
  const KeyValueComponent = ({ defaultValue, handleChange, disabled, copyValue, }) => {
@@ -37,5 +38,5 @@ const KeyValueComponent = ({ defaultValue, handleChange, disabled, copyValue, })
37
38
  React.useEffect(() => {
38
39
  handleChange(keyValues);
39
40
  }, [keyValues]);
40
- return (_jsxs("div", { className: styles.keyValue, children: [keyValues && (_jsxs(Table, { className: styles.table, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableHeader, { children: "Key" }), _jsx(TableHeader, { children: "Value" }), _jsx(TableHeader, {})] }) }), _jsx(TableBody, { children: keyValues.map((keyValue, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: keyValue.key }), _jsx(TableCell, { children: keyValue.value }), _jsx(TableCell, { children: _jsxs("div", { className: styles.buttonsContainer, children: [copyValue && (_jsx(ToolTip, { tooltip: "Copy value", children: _jsx(Button, { ...{ disabled }, className: styles.copyButton, onClick: () => handleCopyToClipboard(keyValue.value, idx), variant: currentCopyIdx === idx ? "secondary-action" : "primary-action", children: _jsx(FontAwesomeIcon, { icon: faCopy }) }) })), _jsx(ToolTip, { tooltip: "Delete value", children: _jsx(Button, { ...{ disabled }, onClick: () => setKeyValues(keyValues.filter((_keyValue) => _keyValue !== keyValue)), className: clsx(styles.deleteButton), children: _jsx(FontAwesomeIcon, { icon: faTrash }) }) })] }) })] }, `${keyValue.key}${keyValue.value}${idx}`))) })] })), _jsxs("div", { className: styles.form, children: [_jsx("input", { type: "text", placeholder: "Key", value: currentKey, ref: currentKeyRef, className: "denhaag-textfield__input", onChange: (e) => setCurrentKey(e.target.value), ...{ disabled } }), _jsx("input", { type: "text", placeholder: "Value", value: currentValue, ref: currentValueRef, className: "denhaag-textfield__input", onChange: (e) => setCurrentValue(e.target.value), ...{ disabled } }), _jsx(Button, { onClick: handleCreate, disabled: !currentKey || !currentValue || disabled, children: "Add" })] })] }));
41
+ return (_jsxs("div", { className: styles.keyValue, children: [keyValues && (_jsxs(Table, { className: styles.table, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableHeader, { children: "Key" }), _jsx(TableHeader, { children: "Value" }), _jsx(TableHeader, {})] }) }), _jsx(TableBody, { children: keyValues.map((keyValue, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: keyValue.key }), _jsx(TableCell, { children: keyValue.value }), _jsx(TableCell, { children: _jsxs("div", { className: styles.buttonsContainer, children: [copyValue && (_jsx(ToolTip, { tooltip: "Copy value", children: _jsx(Button, { ...{ disabled }, onClick: () => handleCopyToClipboard(keyValue.value, idx), variant: currentCopyIdx === idx ? "secondary-action" : "primary-action", children: _jsx(FontAwesomeIcon, { icon: faCopy }) }) })), _jsx(ToolTip, { tooltip: "Delete value", children: _jsx(Button, { ...{ disabled }, onClick: () => setKeyValues(keyValues.filter((_keyValue) => _keyValue !== keyValue)), className: clsx(styles.deleteButton), children: _jsx(FontAwesomeIcon, { icon: faTrash }) }) })] }) })] }, `${keyValue.key}${keyValue.value}${idx}`))) })] })), _jsxs("div", { className: styles.form, children: [_jsx("input", { type: "text", placeholder: "Key", value: currentKey, ref: currentKeyRef, className: "denhaag-textfield__input", onChange: (e) => setCurrentKey(e.target.value), ...{ disabled } }), _jsx("input", { type: "text", placeholder: "Value", value: currentValue, ref: currentValueRef, className: "denhaag-textfield__input", onChange: (e) => setCurrentValue(e.target.value), ...{ disabled } }), _jsx(Button, { onClick: handleCreate, disabled: !currentKey || !currentValue || disabled, children: "Add" })] })] }));
41
42
  };
@@ -8,12 +8,13 @@ interface ISelectProps {
8
8
  value: string;
9
9
  }[];
10
10
  name: string;
11
+ id?: string;
11
12
  defaultValue?: any;
12
13
  disabled?: boolean;
13
14
  isClearable?: boolean;
14
15
  hideErrorMessage?: boolean;
15
16
  }
16
- export declare const SelectMultiple: ({ name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, }: ISelectProps & IReactHookFormProps) => JSX.Element;
17
- export declare const SelectCreate: ({ name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, }: ISelectProps & IReactHookFormProps) => JSX.Element;
18
- export declare const SelectSingle: ({ name, options, errors, control, validation, isClearable, defaultValue, disabled, hideErrorMessage, }: ISelectProps & IReactHookFormProps) => JSX.Element;
17
+ export declare const SelectMultiple: ({ id, name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, }: ISelectProps & IReactHookFormProps) => JSX.Element;
18
+ export declare const SelectCreate: ({ id, name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, }: ISelectProps & IReactHookFormProps) => JSX.Element;
19
+ export declare const SelectSingle: ({ id, name, options, errors, control, validation, isClearable, defaultValue, disabled, hideErrorMessage, }: ISelectProps & IReactHookFormProps) => JSX.Element;
19
20
  export {};
@@ -5,18 +5,18 @@ import ReactSelect from "react-select";
5
5
  import CreatableSelect from "react-select/creatable";
6
6
  import clsx from "clsx";
7
7
  import { ErrorMessage } from "../errorMessage/ErrorMessage";
8
- export const SelectMultiple = ({ name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, }) => {
8
+ export const SelectMultiple = ({ id, name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, }) => {
9
9
  return (_jsx(Controller, { ...{ control, name, defaultValue }, rules: validation, render: ({ field: { onChange, value } }) => {
10
- return (_jsxs(_Fragment, { children: [_jsx(ReactSelect, { value: value ?? "", className: clsx(styles.select, errors[name] && styles.error), isMulti: true, isDisabled: disabled, ...{ options, onChange, errors }, menuPortalTarget: document.body, styles: { menuPortal: (base) => ({ ...base, zIndex: 100 }) }, placeholder: disabled ? "Disabled..." : "Select one or more options..." }), errors[name] && !hideErrorMessage && _jsx(ErrorMessage, { message: errors[name].message })] }));
10
+ return (_jsxs(_Fragment, { children: [_jsx(ReactSelect, { inputId: id, value: value ?? "", className: clsx(styles.select, errors[name] && styles.error), isMulti: true, isDisabled: disabled, ...{ options, onChange, errors }, menuPortalTarget: document.body, styles: { menuPortal: (base) => ({ ...base, zIndex: 100 }) }, placeholder: disabled ? "Disabled..." : "Select one or more options..." }), errors[name] && !hideErrorMessage && _jsx(ErrorMessage, { message: errors[name].message })] }));
11
11
  } }));
12
12
  };
13
- export const SelectCreate = ({ name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, }) => {
13
+ export const SelectCreate = ({ id, name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, }) => {
14
14
  return (_jsx(Controller, { ...{ control, name, defaultValue }, rules: validation, render: ({ field: { onChange, value } }) => {
15
- return (_jsxs(_Fragment, { children: [_jsx(CreatableSelect, { value: value ?? "", placeholder: disabled ? "Disabled..." : "Select or create one or multiple options...", className: clsx(styles.select, errors[name] && styles.error), isMulti: true, isDisabled: disabled, ...{ options, onChange, errors }, menuPortalTarget: document.body, styles: { menuPortal: (base) => ({ ...base, zIndex: 100 }) } }), errors[name] && !hideErrorMessage && _jsx(ErrorMessage, { message: errors[name].message })] }));
15
+ return (_jsxs(_Fragment, { children: [_jsx(CreatableSelect, { inputId: id, value: value ?? "", placeholder: disabled ? "Disabled..." : "Select or create one or multiple options...", className: clsx(styles.select, errors[name] && styles.error), isMulti: true, isDisabled: disabled, ...{ options, onChange, errors }, menuPortalTarget: document.body, styles: { menuPortal: (base) => ({ ...base, zIndex: 100 }) } }), errors[name] && !hideErrorMessage && _jsx(ErrorMessage, { message: errors[name].message })] }));
16
16
  } }));
17
17
  };
18
- export const SelectSingle = ({ name, options, errors, control, validation, isClearable, defaultValue, disabled, hideErrorMessage, }) => {
18
+ export const SelectSingle = ({ id, name, options, errors, control, validation, isClearable, defaultValue, disabled, hideErrorMessage, }) => {
19
19
  return (_jsx(Controller, { ...{ control, name, defaultValue }, rules: validation, render: ({ field: { onChange, value } }) => {
20
- return (_jsxs(_Fragment, { children: [_jsx(ReactSelect, { value: value ?? "", className: clsx(styles.select, errors[name] && styles.error), isDisabled: disabled, ...{ options, onChange, errors, isClearable }, menuPortalTarget: document.body, styles: { menuPortal: (base) => ({ ...base, zIndex: 100 }) }, placeholder: disabled ? "Disabled..." : "Select an option..." }), errors[name] && !hideErrorMessage && _jsx(ErrorMessage, { message: errors[name].message })] }));
20
+ return (_jsxs(_Fragment, { children: [_jsx(ReactSelect, { inputId: id, value: value ?? "", className: clsx(styles.select, errors[name] && styles.error), isDisabled: disabled, ...{ options, onChange, errors, isClearable }, menuPortalTarget: document.body, styles: { menuPortal: (base) => ({ ...base, zIndex: 100 }) }, placeholder: disabled ? "Disabled..." : "Select an option..." }), errors[name] && !hideErrorMessage && _jsx(ErrorMessage, { message: errors[name].message })] }));
21
21
  } }));
22
22
  };
@@ -1,145 +1,157 @@
1
- :root {
2
- --conduction-primary-top-nav-item-padding: var(--skeleton-size-md);
3
- --conduction-primary-top-nav-color: var(--skeleton-color-white);
4
- --conduction-primary-top-nav-background-color: var(--skeleton-color-secondary-3);
5
- --conduction-primary-top-nav-background-color-hover: rgba(255, 255, 255, 0.2);
6
- --conduction-primary-top-nav-dropdown-border-radius: var(--skeleton-border-radius-md);
7
- --conduction-primary-top-nav-background-color-active: rgba(255, 255, 255, 0.2);
8
- --conduction-primary-top-nav-box-shadow-active: inset 0 -4px black;
9
- --conduction-primary-top-nav-toggle-icon-size: 24px;
10
- --conduction-primary-top-nav-mobile-logo-padding: 18px;
11
- --conduction-primary-top-nav-item-icon-margin: var(--skeleton-size-2x);
12
- }
13
-
14
- .container {
15
- width: 100%;
16
- }
17
-
18
- .menuToggleContainer {
19
- width: 100%;
20
- display: flex;
21
- align-items: center;
22
- justify-content: space-between;
23
- }
24
-
25
- .menuToggleContainer > .menuToggle {
26
- all: unset;
27
- font-size: var(--conduction-primary-top-nav-toggle-icon-size);
28
- padding: var(--conduction-primary-top-nav-mobile-logo-padding);
29
- }
30
-
31
- .menuToggleContainer > .menuToggle:hover {
32
- cursor: pointer;
33
- }
34
-
35
- .primary {
36
- display: none;
37
- }
38
-
39
- .primary.isOpen {
40
- display: block;
41
- }
42
-
43
- .menuToggleContainer {
44
- width: 100%;
45
- }
46
-
47
- .primary {
48
- font-weight: 500;
49
- width: 100%;
50
- background-color: var(--conduction-primary-top-nav-background-color);
51
- }
52
-
53
- .primary:hover {
54
- cursor: pointer;
55
- }
56
-
57
- .ul {
58
- margin: unset;
59
- padding-inline-start: unset;
60
- align-items: center;
61
- max-height: 80vh;
62
- overflow-y: scroll;
63
- }
64
-
65
- .li {
66
- list-style-type: none;
67
- display: block;
68
- position: relative;
69
- padding-inline-start: var(--conduction-primary-top-nav-item-padding);
70
- padding-inline-end: var(--conduction-primary-top-nav-item-padding);
71
- padding-block-start: var(--conduction-primary-top-nav-item-padding);
72
- padding-block-end: var(--conduction-primary-top-nav-item-padding);
73
- }
74
-
75
- .li:hover {
76
- background-color: var(--conduction-primary-top-nav-background-color-hover);
77
- }
78
-
79
- .current {
80
- background-color: var(--conduction-primary-top-nav-background-color-active);
81
- box-shadow: var(--conduction-primary-top-nav-box-shadow-active);
82
- }
83
-
84
- .primary .link {
85
- display: block;
86
- text-decoration: none;
87
- color: var(--conduction-primary-top-nav-color);
88
- }
89
-
90
- .primary .li:hover .dropdown {
91
- display: block;
92
- z-index: 1;
93
- }
94
-
95
- .dropdown {
96
- left: 0;
97
- top: 100%;
98
- padding: 0;
99
- width: 100%;
100
- display: block;
101
- list-style-type: none;
102
- background-color: var(--conduction-primary-top-nav-background-color);
103
- border-bottom-right-radius: var(--conduction-primary-top-nav-dropdown-border-radius);
104
- border-bottom-left-radius: var(--conduction-primary-top-nav-dropdown-border-radius);
105
- }
106
-
107
- .dropdown > li {
108
- padding-inline-start: var(--web-app-size-md);
109
- }
110
-
111
- .label {
112
- overflow: hidden;
113
- max-width: 37ch;
114
- text-overflow: ellipsis;
115
- white-space: nowrap;
116
- }
117
-
118
- .label > :not(:last-child) {
119
- margin-inline-end: var(--conduction-primary-top-nav-item-icon-margin);
120
- }
121
-
122
- @media only screen and (min-width: 992px) {
123
- .container {
124
- width: fit-content;
125
- }
126
-
127
- .primary {
128
- display: block;
129
- width: fit-content;
130
- }
131
-
132
- .ul {
133
- display: flex;
134
- overflow-y: unset;
135
- }
136
-
137
- .dropdown {
138
- position: absolute;
139
- display: none;
140
- }
141
-
142
- .menuToggleContainer {
143
- display: none;
144
- }
145
- }
1
+ :root {
2
+ --conduction-primary-top-nav-item-padding: var(--skeleton-size-md);
3
+ --conduction-primary-top-nav-color: var(--skeleton-color-white);
4
+ --conduction-primary-top-nav-background-color: var(--skeleton-color-secondary-3);
5
+ --conduction-primary-top-nav-background-color-hover: rgba(255, 255, 255, 0.2);
6
+ --conduction-primary-top-nav-dropdown-border-radius: var(--skeleton-border-radius-md);
7
+ --conduction-primary-top-nav-background-color-active: rgba(255, 255, 255, 0.2);
8
+ --conduction-primary-top-nav-box-shadow-active: inset 0 -4px black;
9
+ --conduction-primary-top-nav-toggle-icon-size: 24px;
10
+ --conduction-primary-top-nav-mobile-logo-padding: 18px;
11
+ --conduction-primary-top-nav-item-icon-margin: var(--skeleton-size-2x);
12
+ }
13
+
14
+ .container {
15
+ width: 100%;
16
+ }
17
+
18
+ .menuToggleContainer {
19
+ width: 100%;
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ }
24
+
25
+ .menuToggleContainer > .menuToggle {
26
+ all: unset;
27
+ font-size: var(--conduction-primary-top-nav-toggle-icon-size);
28
+ padding: var(--conduction-primary-top-nav-mobile-logo-padding);
29
+ }
30
+
31
+ .menuToggleContainer > .menuToggle:hover {
32
+ cursor: pointer;
33
+ }
34
+
35
+ .primary {
36
+ display: none;
37
+ }
38
+
39
+ .primary.isOpen {
40
+ display: block;
41
+ }
42
+
43
+ .menuToggleContainer {
44
+ width: 100%;
45
+ }
46
+
47
+ .primary {
48
+ font-weight: 500;
49
+ width: 100%;
50
+ background-color: var(--conduction-primary-top-nav-background-color);
51
+ }
52
+
53
+ .primary:hover {
54
+ cursor: pointer;
55
+ }
56
+
57
+ .ul {
58
+ margin: unset;
59
+ padding-inline-start: unset;
60
+ align-items: center;
61
+ max-height: 80vh;
62
+ overflow-y: scroll;
63
+ }
64
+
65
+ .li {
66
+ list-style-type: none;
67
+ display: block;
68
+ position: relative;
69
+ padding-inline-start: var(--conduction-primary-top-nav-item-padding);
70
+ padding-inline-end: var(--conduction-primary-top-nav-item-padding);
71
+ padding-block-start: var(--conduction-primary-top-nav-item-padding);
72
+ padding-block-end: var(--conduction-primary-top-nav-item-padding);
73
+ }
74
+
75
+ .li:hover {
76
+ background-color: var(--conduction-primary-top-nav-background-color-hover);
77
+ }
78
+
79
+ .current {
80
+ background-color: var(--conduction-primary-top-nav-background-color-active);
81
+ box-shadow: var(--conduction-primary-top-nav-box-shadow-active);
82
+ }
83
+
84
+ .primary .link {
85
+ display: block;
86
+ text-decoration: none;
87
+ color: var(--conduction-primary-top-nav-color);
88
+ }
89
+
90
+ .primary .li:hover .link {
91
+ color: var(--conduction-primary-top-nav-color-hover);
92
+ }
93
+
94
+ .primary .li:hover .dropdown {
95
+ display: block;
96
+ z-index: 1;
97
+ }
98
+
99
+ .dropdown {
100
+ left: 0;
101
+ top: 100%;
102
+ padding: 0;
103
+ width: 100%;
104
+ display: block;
105
+ list-style-type: none;
106
+ background-color: var(--conduction-primary-top-nav-dropdown-background-color);
107
+ border-bottom-right-radius: var(--conduction-primary-top-nav-dropdown-border-radius);
108
+ border-bottom-left-radius: var(--conduction-primary-top-nav-dropdown-border-radius);
109
+ }
110
+
111
+ .primary .dropdown .li .link {
112
+ color: var(--conduction-primary-top-nav-dropdown-color);
113
+ }
114
+
115
+ .dropdown .li:hover {
116
+ background: var(--conduction-primary-top-nav-dropdown-background-color-hover);
117
+ }
118
+
119
+ .dropdown > li {
120
+ padding-inline-start: var(--web-app-size-md);
121
+ }
122
+
123
+ .label {
124
+ overflow: hidden;
125
+ max-width: 37ch;
126
+ text-overflow: ellipsis;
127
+ white-space: nowrap;
128
+ }
129
+
130
+ .label > :not(:last-child) {
131
+ margin-inline-end: var(--conduction-primary-top-nav-item-icon-margin);
132
+ }
133
+
134
+ @media only screen and (min-width: 992px) {
135
+ .container {
136
+ width: fit-content;
137
+ }
138
+
139
+ .primary {
140
+ display: block;
141
+ width: fit-content;
142
+ }
143
+
144
+ .ul {
145
+ display: flex;
146
+ overflow-y: unset;
147
+ }
148
+
149
+ .dropdown {
150
+ position: absolute;
151
+ display: none;
152
+ }
153
+
154
+ .menuToggleContainer {
155
+ display: none;
156
+ }
157
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "2.1.22",
3
+ "version": "2.1.25",
4
4
  "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -12,12 +12,7 @@
12
12
  "type": "git",
13
13
  "url": "git+https://github.com/ConductionNL/conduction-components.git"
14
14
  },
15
- "keywords": [
16
- "React",
17
- "Gatsby",
18
- "Conduction",
19
- "Components"
20
- ],
15
+ "keywords": ["React", "Gatsby", "Conduction", "Components"],
21
16
  "author": "Conduction B.V.",
22
17
  "license": "ISC",
23
18
  "bugs": {
@@ -8,6 +8,7 @@ import { ToolTip } from "../../toolTip/ToolTip";
8
8
  import clsx from "clsx";
9
9
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
10
10
  import { faCopy, faTrash } from "@fortawesome/free-solid-svg-icons";
11
+ import { ErrorMessage } from "../errorMessage/ErrorMessage";
11
12
 
12
13
  /**
13
14
  * Export KeyValue input component (wrapped in FormFieldGroup)
@@ -21,6 +22,7 @@ interface CreateKeyValueProps {
21
22
  canCopy: boolean;
22
23
  onCopied?: () => any;
23
24
  };
25
+ hideErrorMessage?: boolean;
24
26
  }
25
27
 
26
28
  export interface IKeyValue {
@@ -36,13 +38,19 @@ export const CreateKeyValue = ({
36
38
  defaultValue,
37
39
  disabled,
38
40
  copyValue,
41
+ hideErrorMessage,
39
42
  }: CreateKeyValueProps & IReactHookFormProps): JSX.Element => {
40
43
  return (
41
44
  <Controller
42
45
  {...{ control, name, errors }}
43
46
  rules={validation}
44
47
  render={({ field: { onChange } }) => {
45
- return <KeyValueComponent handleChange={onChange} {...{ defaultValue, errors, disabled, copyValue }} />;
48
+ return (
49
+ <>
50
+ <KeyValueComponent handleChange={onChange} {...{ defaultValue, errors, disabled, copyValue }} />
51
+ {errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
52
+ </>
53
+ );
46
54
  }}
47
55
  />
48
56
  );
@@ -120,7 +128,6 @@ const KeyValueComponent = ({
120
128
  <ToolTip tooltip="Copy value">
121
129
  <Button
122
130
  {...{ disabled }}
123
- className={styles.copyButton}
124
131
  onClick={() => handleCopyToClipboard(keyValue.value, idx)}
125
132
  variant={currentCopyIdx === idx ? "secondary-action" : "primary-action"}
126
133
  >
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import * as styles from "./select.module.css";
2
3
  import { Control, Controller, FieldValues } from "react-hook-form";
3
4
  import ReactSelect from "react-select";
@@ -10,6 +11,7 @@ interface ISelectProps {
10
11
  control: Control<FieldValues, any>;
11
12
  options: { label: string; value: string }[];
12
13
  name: string;
14
+ id?: string;
13
15
  defaultValue?: any;
14
16
  disabled?: boolean;
15
17
  isClearable?: boolean;
@@ -17,6 +19,7 @@ interface ISelectProps {
17
19
  }
18
20
 
19
21
  export const SelectMultiple = ({
22
+ id,
20
23
  name,
21
24
  options,
22
25
  errors,
@@ -34,6 +37,7 @@ export const SelectMultiple = ({
34
37
  return (
35
38
  <>
36
39
  <ReactSelect
40
+ inputId={id}
37
41
  value={value ?? ""}
38
42
  className={clsx(styles.select, errors[name] && styles.error)}
39
43
  isMulti
@@ -52,6 +56,7 @@ export const SelectMultiple = ({
52
56
  };
53
57
 
54
58
  export const SelectCreate = ({
59
+ id,
55
60
  name,
56
61
  options,
57
62
  errors,
@@ -69,6 +74,7 @@ export const SelectCreate = ({
69
74
  return (
70
75
  <>
71
76
  <CreatableSelect
77
+ inputId={id}
72
78
  value={value ?? ""}
73
79
  placeholder={disabled ? "Disabled..." : "Select or create one or multiple options..."}
74
80
  className={clsx(styles.select, errors[name] && styles.error)}
@@ -87,6 +93,7 @@ export const SelectCreate = ({
87
93
  };
88
94
 
89
95
  export const SelectSingle = ({
96
+ id,
90
97
  name,
91
98
  options,
92
99
  errors,
@@ -105,6 +112,7 @@ export const SelectSingle = ({
105
112
  return (
106
113
  <>
107
114
  <ReactSelect
115
+ inputId={id}
108
116
  value={value ?? ""}
109
117
  className={clsx(styles.select, errors[name] && styles.error)}
110
118
  isDisabled={disabled}
@@ -1,145 +1,157 @@
1
- :root {
2
- --conduction-primary-top-nav-item-padding: var(--skeleton-size-md);
3
- --conduction-primary-top-nav-color: var(--skeleton-color-white);
4
- --conduction-primary-top-nav-background-color: var(--skeleton-color-secondary-3);
5
- --conduction-primary-top-nav-background-color-hover: rgba(255, 255, 255, 0.2);
6
- --conduction-primary-top-nav-dropdown-border-radius: var(--skeleton-border-radius-md);
7
- --conduction-primary-top-nav-background-color-active: rgba(255, 255, 255, 0.2);
8
- --conduction-primary-top-nav-box-shadow-active: inset 0 -4px black;
9
- --conduction-primary-top-nav-toggle-icon-size: 24px;
10
- --conduction-primary-top-nav-mobile-logo-padding: 18px;
11
- --conduction-primary-top-nav-item-icon-margin: var(--skeleton-size-2x);
12
- }
13
-
14
- .container {
15
- width: 100%;
16
- }
17
-
18
- .menuToggleContainer {
19
- width: 100%;
20
- display: flex;
21
- align-items: center;
22
- justify-content: space-between;
23
- }
24
-
25
- .menuToggleContainer > .menuToggle {
26
- all: unset;
27
- font-size: var(--conduction-primary-top-nav-toggle-icon-size);
28
- padding: var(--conduction-primary-top-nav-mobile-logo-padding);
29
- }
30
-
31
- .menuToggleContainer > .menuToggle:hover {
32
- cursor: pointer;
33
- }
34
-
35
- .primary {
36
- display: none;
37
- }
38
-
39
- .primary.isOpen {
40
- display: block;
41
- }
42
-
43
- .menuToggleContainer {
44
- width: 100%;
45
- }
46
-
47
- .primary {
48
- font-weight: 500;
49
- width: 100%;
50
- background-color: var(--conduction-primary-top-nav-background-color);
51
- }
52
-
53
- .primary:hover {
54
- cursor: pointer;
55
- }
56
-
57
- .ul {
58
- margin: unset;
59
- padding-inline-start: unset;
60
- align-items: center;
61
- max-height: 80vh;
62
- overflow-y: scroll;
63
- }
64
-
65
- .li {
66
- list-style-type: none;
67
- display: block;
68
- position: relative;
69
- padding-inline-start: var(--conduction-primary-top-nav-item-padding);
70
- padding-inline-end: var(--conduction-primary-top-nav-item-padding);
71
- padding-block-start: var(--conduction-primary-top-nav-item-padding);
72
- padding-block-end: var(--conduction-primary-top-nav-item-padding);
73
- }
74
-
75
- .li:hover {
76
- background-color: var(--conduction-primary-top-nav-background-color-hover);
77
- }
78
-
79
- .current {
80
- background-color: var(--conduction-primary-top-nav-background-color-active);
81
- box-shadow: var(--conduction-primary-top-nav-box-shadow-active);
82
- }
83
-
84
- .primary .link {
85
- display: block;
86
- text-decoration: none;
87
- color: var(--conduction-primary-top-nav-color);
88
- }
89
-
90
- .primary .li:hover .dropdown {
91
- display: block;
92
- z-index: 1;
93
- }
94
-
95
- .dropdown {
96
- left: 0;
97
- top: 100%;
98
- padding: 0;
99
- width: 100%;
100
- display: block;
101
- list-style-type: none;
102
- background-color: var(--conduction-primary-top-nav-background-color);
103
- border-bottom-right-radius: var(--conduction-primary-top-nav-dropdown-border-radius);
104
- border-bottom-left-radius: var(--conduction-primary-top-nav-dropdown-border-radius);
105
- }
106
-
107
- .dropdown > li {
108
- padding-inline-start: var(--web-app-size-md);
109
- }
110
-
111
- .label {
112
- overflow: hidden;
113
- max-width: 37ch;
114
- text-overflow: ellipsis;
115
- white-space: nowrap;
116
- }
117
-
118
- .label > :not(:last-child) {
119
- margin-inline-end: var(--conduction-primary-top-nav-item-icon-margin);
120
- }
121
-
122
- @media only screen and (min-width: 992px) {
123
- .container {
124
- width: fit-content;
125
- }
126
-
127
- .primary {
128
- display: block;
129
- width: fit-content;
130
- }
131
-
132
- .ul {
133
- display: flex;
134
- overflow-y: unset;
135
- }
136
-
137
- .dropdown {
138
- position: absolute;
139
- display: none;
140
- }
141
-
142
- .menuToggleContainer {
143
- display: none;
144
- }
145
- }
1
+ :root {
2
+ --conduction-primary-top-nav-item-padding: var(--skeleton-size-md);
3
+ --conduction-primary-top-nav-color: var(--skeleton-color-white);
4
+ --conduction-primary-top-nav-background-color: var(--skeleton-color-secondary-3);
5
+ --conduction-primary-top-nav-background-color-hover: rgba(255, 255, 255, 0.2);
6
+ --conduction-primary-top-nav-dropdown-border-radius: var(--skeleton-border-radius-md);
7
+ --conduction-primary-top-nav-background-color-active: rgba(255, 255, 255, 0.2);
8
+ --conduction-primary-top-nav-box-shadow-active: inset 0 -4px black;
9
+ --conduction-primary-top-nav-toggle-icon-size: 24px;
10
+ --conduction-primary-top-nav-mobile-logo-padding: 18px;
11
+ --conduction-primary-top-nav-item-icon-margin: var(--skeleton-size-2x);
12
+ }
13
+
14
+ .container {
15
+ width: 100%;
16
+ }
17
+
18
+ .menuToggleContainer {
19
+ width: 100%;
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ }
24
+
25
+ .menuToggleContainer > .menuToggle {
26
+ all: unset;
27
+ font-size: var(--conduction-primary-top-nav-toggle-icon-size);
28
+ padding: var(--conduction-primary-top-nav-mobile-logo-padding);
29
+ }
30
+
31
+ .menuToggleContainer > .menuToggle:hover {
32
+ cursor: pointer;
33
+ }
34
+
35
+ .primary {
36
+ display: none;
37
+ }
38
+
39
+ .primary.isOpen {
40
+ display: block;
41
+ }
42
+
43
+ .menuToggleContainer {
44
+ width: 100%;
45
+ }
46
+
47
+ .primary {
48
+ font-weight: 500;
49
+ width: 100%;
50
+ background-color: var(--conduction-primary-top-nav-background-color);
51
+ }
52
+
53
+ .primary:hover {
54
+ cursor: pointer;
55
+ }
56
+
57
+ .ul {
58
+ margin: unset;
59
+ padding-inline-start: unset;
60
+ align-items: center;
61
+ max-height: 80vh;
62
+ overflow-y: scroll;
63
+ }
64
+
65
+ .li {
66
+ list-style-type: none;
67
+ display: block;
68
+ position: relative;
69
+ padding-inline-start: var(--conduction-primary-top-nav-item-padding);
70
+ padding-inline-end: var(--conduction-primary-top-nav-item-padding);
71
+ padding-block-start: var(--conduction-primary-top-nav-item-padding);
72
+ padding-block-end: var(--conduction-primary-top-nav-item-padding);
73
+ }
74
+
75
+ .li:hover {
76
+ background-color: var(--conduction-primary-top-nav-background-color-hover);
77
+ }
78
+
79
+ .current {
80
+ background-color: var(--conduction-primary-top-nav-background-color-active);
81
+ box-shadow: var(--conduction-primary-top-nav-box-shadow-active);
82
+ }
83
+
84
+ .primary .link {
85
+ display: block;
86
+ text-decoration: none;
87
+ color: var(--conduction-primary-top-nav-color);
88
+ }
89
+
90
+ .primary .li:hover .link {
91
+ color: var(--conduction-primary-top-nav-color-hover);
92
+ }
93
+
94
+ .primary .li:hover .dropdown {
95
+ display: block;
96
+ z-index: 1;
97
+ }
98
+
99
+ .dropdown {
100
+ left: 0;
101
+ top: 100%;
102
+ padding: 0;
103
+ width: 100%;
104
+ display: block;
105
+ list-style-type: none;
106
+ background-color: var(--conduction-primary-top-nav-dropdown-background-color);
107
+ border-bottom-right-radius: var(--conduction-primary-top-nav-dropdown-border-radius);
108
+ border-bottom-left-radius: var(--conduction-primary-top-nav-dropdown-border-radius);
109
+ }
110
+
111
+ .primary .dropdown .li .link {
112
+ color: var(--conduction-primary-top-nav-dropdown-color);
113
+ }
114
+
115
+ .dropdown .li:hover {
116
+ background: var(--conduction-primary-top-nav-dropdown-background-color-hover);
117
+ }
118
+
119
+ .dropdown > li {
120
+ padding-inline-start: var(--web-app-size-md);
121
+ }
122
+
123
+ .label {
124
+ overflow: hidden;
125
+ max-width: 37ch;
126
+ text-overflow: ellipsis;
127
+ white-space: nowrap;
128
+ }
129
+
130
+ .label > :not(:last-child) {
131
+ margin-inline-end: var(--conduction-primary-top-nav-item-icon-margin);
132
+ }
133
+
134
+ @media only screen and (min-width: 992px) {
135
+ .container {
136
+ width: fit-content;
137
+ }
138
+
139
+ .primary {
140
+ display: block;
141
+ width: fit-content;
142
+ }
143
+
144
+ .ul {
145
+ display: flex;
146
+ overflow-y: unset;
147
+ }
148
+
149
+ .dropdown {
150
+ position: absolute;
151
+ display: none;
152
+ }
153
+
154
+ .menuToggleContainer {
155
+ display: none;
156
+ }
157
+ }