@abgov/react-components 4.17.0 → 4.18.1

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.
@@ -60,44 +60,41 @@ interface BaseProps extends Margins {
60
60
  trailingContent?: React.ReactNode;
61
61
  maxLength?: number;
62
62
  }
63
- declare type OnChange = (name: string, value: string) => void;
64
- declare type OnFocus = (name: string, value: string) => void;
65
- declare type OnBlur = (name: string, value: string) => void;
63
+ declare type OnChange<T = string> = (name: string, value: T) => void;
64
+ declare type OnFocus<T = string> = (name: string, value: T) => void;
65
+ declare type OnBlur<T = string> = (name: string, value: T) => void;
66
+ declare type OnKeyPress<T = string> = (name: string, value: T, key: string) => void;
66
67
  export interface GoAInputProps extends BaseProps {
67
- onChange: OnChange;
68
+ onChange: OnChange<string>;
68
69
  value: string;
69
70
  min?: number | string;
70
71
  max?: number | string;
71
72
  step?: number;
72
- onFocus?: OnFocus;
73
- onBlur?: OnBlur;
73
+ onFocus?: OnFocus<string>;
74
+ onBlur?: OnBlur<string>;
75
+ onKeyPress?: OnKeyPress<string>;
74
76
  }
75
- export declare type InputProps = GoAInputProps;
76
- declare type OnNumberChange = (name: string, value: number) => void;
77
- declare type OnNumberFocus = (name: string, value: number) => void;
78
- declare type OnNumberBlur = (name: string, value: number) => void;
79
- export interface GoANumberInputProps extends BaseProps {
80
- onChange: OnNumberChange;
77
+ interface GoANumberInputProps extends BaseProps {
78
+ onChange: OnChange<number>;
81
79
  value: number;
82
80
  min?: number;
83
81
  max?: number;
84
82
  step?: number;
85
- onFocus?: OnNumberFocus;
86
- onBlur?: OnNumberBlur;
83
+ onFocus?: OnFocus<number>;
84
+ onBlur?: OnBlur<number>;
85
+ onKeyPress?: OnKeyPress<number>;
87
86
  }
88
- declare type OnDateChange = (name: string, value: GoADate) => void;
89
- declare type OnDateFocus = (name: string, value: GoADate) => void;
90
- declare type OnDateBlur = (name: string, value: GoADate) => void;
91
- export interface GoADateInputProps extends BaseProps {
92
- onChange: OnDateChange;
87
+ interface GoADateInputProps extends BaseProps {
88
+ onChange: OnChange<GoADate>;
93
89
  value: GoADate;
94
90
  min?: GoADate;
95
91
  max?: GoADate;
96
92
  step?: number;
97
- onFocus?: OnDateFocus;
98
- onBlur?: OnDateBlur;
93
+ onFocus?: OnFocus<GoADate>;
94
+ onBlur?: OnBlur<GoADate>;
95
+ onKeyPress?: OnKeyPress<GoADate>;
99
96
  }
100
- export declare function GoAInput({ id, debounce, name, type, autoCapitalize, leadingIcon, trailingIcon, variant, focused, disabled, readonly, value, placeholder, error, width, testId, min, max, step, prefix, suffix, ariaLabel, mt, mr, mb, ml, leadingContent, trailingContent, maxLength, onTrailingIconClick, onChange, onFocus, onBlur, }: GoAInputProps & {
97
+ export declare function GoAInput({ id, debounce, name, type, autoCapitalize, leadingIcon, trailingIcon, variant, focused, disabled, readonly, value, placeholder, error, width, testId, min, max, step, prefix, suffix, ariaLabel, mt, mr, mb, ml, leadingContent, trailingContent, maxLength, onTrailingIconClick, onChange, onFocus, onBlur, onKeyPress, }: GoAInputProps & {
101
98
  type?: GoAInputType;
102
99
  }): JSX.Element;
103
100
  export declare function GoAInputText(props: GoAInputProps): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Margins } from "../../common/styling";
3
+ declare type CountBy = "character" | "word";
3
4
  interface WCProps extends Margins {
4
5
  ref: React.Ref<HTMLTextAreaElement>;
5
6
  name: string;
@@ -8,10 +9,10 @@ interface WCProps extends Margins {
8
9
  rows?: number;
9
10
  error?: boolean;
10
11
  disabled?: boolean;
11
- showcounter?: boolean;
12
- maxcharcount?: number;
13
12
  width?: string;
14
13
  arialabel?: string;
14
+ countby?: CountBy;
15
+ maxcount?: number;
15
16
  }
16
17
  declare global {
17
18
  namespace JSX {
@@ -28,12 +29,14 @@ export interface GoATextAreaProps extends Margins {
28
29
  rows?: number;
29
30
  error?: boolean;
30
31
  disabled?: boolean;
31
- showCounter?: boolean;
32
- maxCharCount?: number;
33
32
  width?: string;
34
33
  testId?: string;
35
34
  ariaLabel?: string;
35
+ countBy?: CountBy;
36
+ maxCount?: number;
36
37
  onChange: (name: string, value: string) => void;
38
+ onKeyPress?: (name: string, value: string, key: string) => void;
37
39
  }
38
- export declare function GoATextArea({ name, value, placeholder, rows, disabled, showCounter, maxCharCount, width, testId, error, ariaLabel, mt, mr, mb, ml, onChange, }: GoATextAreaProps): JSX.Element;
39
- export default GoATextArea;
40
+ export declare function GoATextarea({ name, value, placeholder, rows, disabled, countBy, maxCount, width, testId, error, ariaLabel, mt, mr, mb, ml, onChange, onKeyPress, }: GoATextAreaProps): JSX.Element;
41
+ export { GoATextarea as GoATextArea };
42
+ export default GoATextarea;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/react-components",
3
- "version": "4.17.0",
3
+ "version": "4.18.1",
4
4
  "description": "Government of Alberta - UI components for React",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"