@indico-data/design-system 2.34.3 → 2.34.4

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.
@@ -4,8 +4,10 @@ import { LabelProps } from '../subcomponents/Label';
4
4
  export interface BaseInputProps {
5
5
  value?: string | undefined;
6
6
  placeholder?: string;
7
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
7
  isDisabled?: boolean;
8
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
9
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
10
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
9
11
  errorMessage?: string | undefined;
10
12
  helpText?: string;
11
13
  iconName?: IconName;
@@ -5,6 +5,8 @@ export interface PasswordInputProps extends LabelProps {
5
5
  value?: string | undefined;
6
6
  placeholder?: string;
7
7
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
9
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
8
10
  isDisabled?: boolean;
9
11
  errorMessage?: string | undefined;
10
12
  helpText?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "2.34.3",
3
+ "version": "2.34.4",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -9,8 +9,10 @@ import { DisplayFormError } from '../subcomponents/DisplayFormError';
9
9
  export interface BaseInputProps {
10
10
  value?: string | undefined;
11
11
  placeholder?: string;
12
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
13
12
  isDisabled?: boolean;
13
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
14
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
15
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
14
16
  errorMessage?: string | undefined;
15
17
  helpText?: string;
16
18
  iconName?: IconName;
@@ -26,13 +28,15 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
26
28
  {
27
29
  name,
28
30
  placeholder,
29
- onChange,
30
31
  isRequired,
31
32
  isDisabled,
32
33
  isClearable,
33
34
  errorMessage,
34
35
  helpText,
35
36
  iconName,
37
+ onChange,
38
+ onBlur,
39
+ onKeyDown,
36
40
  className,
37
41
  ...rest
38
42
  },
@@ -66,6 +70,8 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
66
70
  disabled={isDisabled}
67
71
  placeholder={placeholder}
68
72
  onChange={onChange}
73
+ onBlur={onBlur}
74
+ onKeyDown={onKeyDown}
69
75
  className={inputClasses}
70
76
  aria-invalid={hasErrors ? true : undefined}
71
77
  aria-describedby={hasErrors || helpText ? `${name}-helper` : undefined}
@@ -18,6 +18,8 @@ const NumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>(
18
18
  {
19
19
  name,
20
20
  onChange,
21
+ onBlur,
22
+ onKeyDown,
21
23
  isRequired,
22
24
  isDisabled,
23
25
  isClearable,
@@ -58,6 +60,8 @@ const NumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>(
58
60
  type="number"
59
61
  disabled={isDisabled}
60
62
  onChange={onChange}
63
+ onBlur={onBlur}
64
+ onKeyDown={onKeyDown}
61
65
  className={inputClasses}
62
66
  aria-invalid={hasErrors ? true : undefined}
63
67
  aria-describedby={hasErrors || helpText ? `${name}-helper` : undefined}
@@ -9,6 +9,8 @@ export interface PasswordInputProps extends LabelProps {
9
9
  value?: string | undefined;
10
10
  placeholder?: string;
11
11
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
12
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
13
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
12
14
  isDisabled?: boolean;
13
15
  errorMessage?: string | undefined;
14
16
  helpText?: string;
@@ -22,6 +24,8 @@ const PasswordInput = React.forwardRef<HTMLInputElement, PasswordInputProps>(
22
24
  name,
23
25
  placeholder,
24
26
  onChange,
27
+ onBlur,
28
+ onKeyDown,
25
29
  isRequired,
26
30
  isDisabled,
27
31
  errorMessage,
@@ -59,6 +63,8 @@ const PasswordInput = React.forwardRef<HTMLInputElement, PasswordInputProps>(
59
63
  disabled={isDisabled}
60
64
  placeholder={placeholder}
61
65
  onChange={onChange}
66
+ onBlur={onBlur}
67
+ onKeyDown={onKeyDown}
62
68
  className={inputClasses}
63
69
  aria-invalid={hasErrors ? 'true' : 'false'}
64
70
  aria-describedby={hasErrors || helpText ? `${name}-helper` : undefined}
@@ -61,6 +61,30 @@ const baseInputArgTypes: ArgTypes = {
61
61
  type: { name: 'function', required: true },
62
62
  action: 'onChange',
63
63
  },
64
+ onBlur: {
65
+ control: false,
66
+ description: 'onBlur event handler',
67
+ table: {
68
+ category: 'Callbacks',
69
+ type: {
70
+ summary: '(e: React.FocusEvent<HTMLInputElement>) => void',
71
+ },
72
+ },
73
+ type: { name: 'function', required: false },
74
+ action: 'onBlur',
75
+ },
76
+ onKeyDown: {
77
+ control: false,
78
+ description: 'onKeyDown event handler',
79
+ table: {
80
+ category: 'Callbacks',
81
+ type: {
82
+ summary: '(e: React.KeyboardEvent<HTMLInputElement>) => void',
83
+ },
84
+ },
85
+ type: { name: 'function', required: false },
86
+ action: 'onKeyDown',
87
+ },
64
88
  placeholder: {
65
89
  control: 'text',
66
90
  description: 'The placeholder for the form component',