@conduction/components 2.0.25 → 2.0.27

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**
6
6
 
7
+ - 2.0.27: Cleanup
8
+ - 2.0.26: Added Select element error states
7
9
  - 2.0.25: Added InputURL component;
8
10
  - 2.0.24: Bugfix: @conduction not showing
9
11
  - 2.0.23:
@@ -3,18 +3,21 @@ import * as styles from "./select.module.css";
3
3
  import { Controller } from "react-hook-form";
4
4
  import ReactSelect from "react-select";
5
5
  import CreatableSelect from "react-select/creatable";
6
+ import clsx from "clsx";
6
7
  export const SelectMultiple = ({ name, options, errors, control, validation, defaultValue, disabled, }) => {
7
8
  return (_jsx(Controller, { ...{ control, name }, rules: validation, render: ({ field: { onChange, value } }) => {
8
- return (_jsx(ReactSelect, { className: styles.select, isMulti: true, isDisabled: disabled, ...{ options, value, onChange, errors, defaultValue } }));
9
+ return (_jsx(ReactSelect, { className: clsx(styles.select, errors[name] && styles.error), isMulti: true, isDisabled: disabled, ...{ options, value, onChange, errors, defaultValue } }));
9
10
  } }));
10
11
  };
11
12
  export const SelectCreate = ({ name, options, errors, control, validation, defaultValue, disabled, }) => {
13
+ console.log(`error: ${errors[name]}`);
12
14
  return (_jsx(Controller, { ...{ control, name }, rules: validation, render: ({ field: { onChange, value } }) => {
13
- return (_jsx(CreatableSelect, { placeholder: "Select existing or create new entries", className: styles.select, isMulti: true, isDisabled: disabled, ...{ options, value, onChange, errors, defaultValue } }));
15
+ console.log(`error: ${errors[name]}`);
16
+ return (_jsx(CreatableSelect, { placeholder: "Select existing or create new entries", className: clsx(styles.select, errors[name] && styles.error), isMulti: true, isDisabled: disabled, ...{ options, value, onChange, errors, defaultValue } }));
14
17
  } }));
15
18
  };
16
19
  export const SelectSingle = ({ name, options, errors, control, validation, isClearable, defaultValue, disabled, }) => {
17
20
  return (_jsx(Controller, { ...{ control, name }, rules: validation, render: ({ field: { onChange, value } }) => {
18
- return (_jsx(ReactSelect, { className: styles.select, isDisabled: disabled, ...{ options, onChange, value, errors, isClearable, defaultValue } }));
21
+ return (_jsx(ReactSelect, { className: clsx(styles.select, styles.abcdefg, errors[name] && styles.error), isDisabled: disabled, ...{ options, onChange, value, errors, isClearable, defaultValue } }));
19
22
  } }));
20
23
  };
@@ -12,13 +12,16 @@
12
12
  padding-block-end: var(--skeleton-size-xs);
13
13
  }
14
14
 
15
- .select > div:focus-within {
16
- outline: none;
17
- box-shadow: none;
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
+ );
18
20
  }
19
21
 
20
- .select > div:hover {
21
- border-color: var(--skeleton-color-grey-3);
22
+ .select .select > div:focus-within {
23
+ outline: none;
24
+ box-shadow: none;
22
25
  }
23
26
 
24
27
  .select > div:focus-within::after {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "2.0.25",
3
+ "version": "2.0.27",
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,13 +12,16 @@
12
12
  padding-block-end: var(--skeleton-size-xs);
13
13
  }
14
14
 
15
- .select > div:focus-within {
16
- outline: none;
17
- box-shadow: none;
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
+ );
18
20
  }
19
21
 
20
- .select > div:hover {
21
- border-color: var(--skeleton-color-grey-3);
22
+ .select .select > div:focus-within {
23
+ outline: none;
24
+ box-shadow: none;
22
25
  }
23
26
 
24
27
  .select > div:focus-within::after {
@@ -4,6 +4,7 @@ import { Control, Controller, FieldValues } from "react-hook-form";
4
4
  import ReactSelect from "react-select";
5
5
  import CreatableSelect from "react-select/creatable";
6
6
  import { IReactHookFormProps } from "../types";
7
+ import clsx from "clsx";
7
8
 
8
9
  interface ISelectProps {
9
10
  control: Control<FieldValues, any>;
@@ -30,7 +31,7 @@ export const SelectMultiple: React.FC<ISelectProps & IReactHookFormProps> = ({
30
31
  render={({ field: { onChange, value } }) => {
31
32
  return (
32
33
  <ReactSelect
33
- className={styles.select}
34
+ className={clsx(styles.select, errors[name] && styles.error)}
34
35
  isMulti
35
36
  isDisabled={disabled}
36
37
  {...{ options, value, onChange, errors, defaultValue }}
@@ -58,7 +59,7 @@ export const SelectCreate: React.FC<ISelectProps & IReactHookFormProps> = ({
58
59
  return (
59
60
  <CreatableSelect
60
61
  placeholder="Select existing or create new entries"
61
- className={styles.select}
62
+ className={clsx(styles.select, errors[name] && styles.error)}
62
63
  isMulti
63
64
  isDisabled={disabled}
64
65
  {...{ options, value, onChange, errors, defaultValue }}
@@ -86,7 +87,7 @@ export const SelectSingle: React.FC<ISelectProps & IReactHookFormProps> = ({
86
87
  render={({ field: { onChange, value } }) => {
87
88
  return (
88
89
  <ReactSelect
89
- className={styles.select}
90
+ className={clsx(styles.select, errors[name] && styles.error)}
90
91
  isDisabled={disabled}
91
92
  {...{ options, onChange, value, errors, isClearable, defaultValue }}
92
93
  />