@khanacademy/wonder-blocks-form 4.7.5 → 4.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @khanacademy/wonder-blocks-form
2
2
 
3
+ ## 4.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8ab0b734: Allow `TextArea` to be focusable when disabled. It now sets `aria-disabled` instead of the `disabled` attribute based on the `disabled` prop. This makes it so screenreaders will continue to communicate that the component is disabled, while allowing focus on the disabled component. Focus styling is also added to the disabled state.
8
+
9
+ ## 4.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 4215976f: Adds `TextArea` component
14
+
3
15
  ## 4.7.5
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,153 @@
1
+ import * as React from "react";
2
+ import { StyleType } from "@khanacademy/wonder-blocks-core";
3
+ declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("../../../wonder-blocks-core/src/util/aria-types").AriaAttributes> & Readonly<{
4
+ role?: import("../../../wonder-blocks-core/src/util/aria-types").AriaRole | undefined;
5
+ }> & {
6
+ /**
7
+ * The text area value.
8
+ */
9
+ value: string;
10
+ /**
11
+ * Called when the value has changed.
12
+ */
13
+ onChange: (newValue: string) => unknown;
14
+ /**
15
+ * An optional unique identifier for the TextArea.
16
+ * If no id is specified, a unique id will be auto-generated.
17
+ */
18
+ id?: string | undefined;
19
+ /**
20
+ * Optional test ID for e2e testing.
21
+ */
22
+ testId?: string | undefined;
23
+ /**
24
+ * Custom styles for the text area.
25
+ */
26
+ style?: StyleType;
27
+ /**
28
+ * Provide hints or examples of what to enter.
29
+ */
30
+ placeholder?: string | undefined;
31
+ /**
32
+ * Whether the text area should be disabled.
33
+ */
34
+ disabled?: boolean | undefined;
35
+ /**
36
+ * Specifies if the text area is read-only.
37
+ */
38
+ readOnly?: boolean | undefined;
39
+ /**
40
+ * Specifies if the text area allows autocomplete.
41
+ */
42
+ autoComplete?: "off" | "on" | undefined;
43
+ /**
44
+ * The name for the text area control. This is submitted along with
45
+ * the form data.
46
+ */
47
+ name?: string | undefined;
48
+ /**
49
+ * CSS classes for the textarea element. It is recommended that the style prop is used instead where possible
50
+ */
51
+ className?: string | undefined;
52
+ /**
53
+ * Whether this textarea should autofocus on page load.
54
+ */
55
+ autoFocus?: boolean | undefined;
56
+ /**
57
+ * The number of visible lines of text for the textarea.
58
+ * By default, 2 rows are shown.
59
+ * `rows` is ignored if a height is applied to the textarea using CSS.
60
+ * The number of rows can change if the resize control is used by the user.
61
+ */
62
+ rows?: number | undefined;
63
+ /**
64
+ * Determines if the textarea should be checked for spelling by the browser/OS.
65
+ * By default, it is enabled. It will be checked for spelling when you try
66
+ * to edit it (ie. once the textarea is focused). For more details, see the
67
+ * [spellcheck attribute MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#spellcheck).
68
+ * **Note**: Consider disabling `spellCheck` for
69
+ * sensitive information (see [Security and Privacy concerns](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck#security_and_privacy_concerns) for more details)
70
+ */
71
+ spellCheck?: boolean | undefined;
72
+ /**
73
+ * How the control should wrap the value for form submission. If not provided,
74
+ * `soft` is the default behaviour. For more details, see the
75
+ * [wrap attribute MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap)
76
+ */
77
+ wrap?: "off" | "hard" | "soft" | undefined;
78
+ /**
79
+ * The minimum number of characters allowed in the textarea.
80
+ */
81
+ minLength?: number | undefined;
82
+ /**
83
+ * The maximum number of characters allowed in the textarea.
84
+ */
85
+ maxLength?: number | undefined;
86
+ /**
87
+ * Called when the textarea is clicked.
88
+ * @param event The event from the click
89
+ */
90
+ onClick?: React.MouseEventHandler<HTMLTextAreaElement> | undefined;
91
+ /**
92
+ * Called when a key is pressed.
93
+ * @param event The keyboard event
94
+ */
95
+ onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement> | undefined;
96
+ /**
97
+ * Called when a key is released.
98
+ * @param event The keyboard event
99
+ */
100
+ onKeyUp?: React.KeyboardEventHandler<HTMLTextAreaElement> | undefined;
101
+ /**
102
+ * Called when the element has been focused.
103
+ * @param event The focus event
104
+ */
105
+ onFocus?: React.FocusEventHandler<HTMLTextAreaElement> | undefined;
106
+ /**
107
+ * Called when the element has been focused.
108
+ * @param event The blur event
109
+ */
110
+ onBlur?: React.FocusEventHandler<HTMLTextAreaElement> | undefined;
111
+ /**
112
+ * Provide a validation for the textarea value.
113
+ * Return a string error message or null | void for a valid input.
114
+ */
115
+ validate?: ((value: string) => string | null | void) | undefined;
116
+ /**
117
+ * Called right after the textarea is validated.
118
+ */
119
+ onValidate?: ((errorMessage?: string | null | undefined) => unknown) | undefined;
120
+ /**
121
+ * Whether this textarea is required to continue, or the error message to
122
+ * render if this textarea is left blank.
123
+ *
124
+ * This can be a boolean or a string.
125
+ *
126
+ * String:
127
+ * Please pass in a translated string to use as the error message that will
128
+ * render if the user leaves this textarea blank. If this textarea is required,
129
+ * and a string is not passed in, a default untranslated string will render
130
+ * upon error.
131
+ * Note: The string will not be used if a `validate` prop is passed in.
132
+ *
133
+ * Example message: i18n._("A password is required to log in.")
134
+ *
135
+ * Boolean:
136
+ * True/false indicating whether this textarea is required. Please do not pass
137
+ * in `true` if possible - pass in the error string instead.
138
+ * If `true` is passed, and a `validate` prop is not passed, that means
139
+ * there is no corresponding message and the default untranlsated message
140
+ * will be used.
141
+ */
142
+ required?: string | boolean | undefined;
143
+ /**
144
+ * Specifies the resizing behaviour for the textarea. Defaults to both
145
+ * behaviour. For more details, see the [CSS resize property values MDN docs](https://developer.mozilla.org/en-US/docs/Web/CSS/resize#values)
146
+ */
147
+ resizeType?: "none" | "both" | "horizontal" | "vertical" | undefined;
148
+ /**
149
+ * Change the default focus ring color to fit a dark background.
150
+ */
151
+ light?: boolean | undefined;
152
+ } & React.RefAttributes<HTMLTextAreaElement>>;
153
+ export default TextArea;