@khanacademy/wonder-blocks-form 6.0.6 → 7.0.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,30 @@
1
1
  # @khanacademy/wonder-blocks-form
2
2
 
3
+ ## 7.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c162abb4: Migrate color instances to use semanticColor internally on TextField and TextArea
8
+ - 8cfaeab0: Migrate Radio and Checkbox to use semanticColor tokens
9
+ - Updated dependencies [8cfaeab0]
10
+ - Updated dependencies [c162abb4]
11
+ - @khanacademy/wonder-blocks-tokens@4.1.0
12
+ - @khanacademy/wonder-blocks-clickable@5.0.7
13
+ - @khanacademy/wonder-blocks-layout@3.0.7
14
+
15
+ ## 7.0.0
16
+
17
+ ### Major Changes
18
+
19
+ - 8d26588f: Remove `light` variant from LabeledTextField, TextField and TextArea"
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [0de25cd8]
24
+ - @khanacademy/wonder-blocks-tokens@4.0.0
25
+ - @khanacademy/wonder-blocks-clickable@5.0.6
26
+ - @khanacademy/wonder-blocks-layout@3.0.6
27
+
3
28
  ## 6.0.6
4
29
 
5
30
  ### Patch Changes
@@ -4,14 +4,14 @@ import type { Checked } from "../util/types";
4
4
  * The internal stateless ☑️ Checkbox
5
5
  */
6
6
  declare const CheckboxCore: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
7
- role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
7
+ role?: import("@khanacademy/wonder-blocks-core").AriaRole;
8
8
  }> & {
9
9
  checked: Checked;
10
10
  disabled: boolean;
11
11
  error: boolean;
12
- groupName?: string | undefined;
13
- id?: string | undefined;
14
- testId?: string | undefined;
12
+ groupName?: string;
13
+ id?: string;
14
+ testId?: string;
15
15
  onClick: () => void;
16
16
  } & React.RefAttributes<HTMLInputElement>>;
17
17
  export default CheckboxCore;
@@ -23,7 +23,7 @@ import type { Checked } from "../util/types";
23
23
  * ```
24
24
  */
25
25
  declare const Checkbox: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
26
- role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
26
+ role?: import("@khanacademy/wonder-blocks-core").AriaRole;
27
27
  }> & {
28
28
  /**
29
29
  * Whether this component is checked or indeterminate
@@ -32,11 +32,11 @@ declare const Checkbox: React.ForwardRefExoticComponent<Readonly<import("@khanac
32
32
  /**
33
33
  * Whether this component is disabled
34
34
  */
35
- disabled?: boolean | undefined;
35
+ disabled?: boolean;
36
36
  /**
37
37
  * Whether this component should show an error state
38
38
  */
39
- error?: boolean | undefined;
39
+ error?: boolean;
40
40
  /**
41
41
  * Callback when this component is selected. The newCheckedState is the
42
42
  * new checked state of the component.
@@ -55,7 +55,7 @@ declare const Checkbox: React.ForwardRefExoticComponent<Readonly<import("@khanac
55
55
  * guarantee that the ID is unique within everything rendered on a page.
56
56
  * Used to match `<label>` with `<input>` elements for screenreaders.
57
57
  */
58
- id?: string | undefined;
58
+ id?: string;
59
59
  /**
60
60
  * Optional styling for the container. Does not style the component.
61
61
  */
@@ -63,16 +63,16 @@ declare const Checkbox: React.ForwardRefExoticComponent<Readonly<import("@khanac
63
63
  /**
64
64
  * Adds CSS classes to the Checkbox.
65
65
  */
66
- className?: string | undefined;
66
+ className?: string;
67
67
  /**
68
68
  * Optional test ID for e2e testing
69
69
  */
70
- testId?: string | undefined;
70
+ testId?: string;
71
71
  /**
72
72
  * Name for the checkbox or radio button group. Only applicable for group
73
73
  * contexts, auto-populated by group components via Choice.
74
74
  * @ignore
75
75
  */
76
- groupName?: string | undefined;
76
+ groupName?: string;
77
77
  } & React.RefAttributes<HTMLInputElement>>;
78
78
  export default Checkbox;
@@ -8,21 +8,21 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
8
8
  * example, we can make onChange a required prop on Checkbox but not on Choice
9
9
  * (because for Choice, that prop would be auto-populated by CheckboxGroup).
10
10
  */ declare const ChoiceInternal: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
11
- role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
11
+ role?: import("@khanacademy/wonder-blocks-core").AriaRole;
12
12
  }> & {
13
13
  /** Whether this choice is checked. */
14
14
  checked: boolean | null | undefined;
15
15
  /** Whether this choice option is disabled. */
16
- disabled?: boolean | undefined;
16
+ disabled?: boolean;
17
17
  /** Whether this choice is in error mode. */
18
- error?: boolean | undefined;
18
+ error?: boolean;
19
19
  /** Returns the new checked state of the component. */
20
20
  onChange: (newCheckedState: boolean) => unknown;
21
21
  /**
22
22
  * Used for accessibility purposes, where the label id should match the
23
23
  * input id.
24
24
  */
25
- id?: string | undefined;
25
+ id?: string;
26
26
  /**
27
27
  * Optional additional styling.
28
28
  */
@@ -30,11 +30,11 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
30
30
  /**
31
31
  * Adds CSS classes to the Button.
32
32
  */
33
- className?: string | undefined;
33
+ className?: string;
34
34
  /**
35
35
  * Optional id for testing purposes.
36
36
  */
37
- testId?: string | undefined;
37
+ testId?: string;
38
38
  /**
39
39
  * Label for the field.
40
40
  */
@@ -42,7 +42,7 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
42
42
  /** Optional description for the field. */
43
43
  description?: React.ReactNode;
44
44
  /** Auto-populated by parent's groupName prop if in a group. */
45
- groupName?: string | undefined;
45
+ groupName?: string;
46
46
  /** Takes either "radio" or "checkbox" value. */
47
47
  variant: "radio" | "checkbox";
48
48
  } & React.RefAttributes<HTMLInputElement>>;
@@ -67,7 +67,7 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
67
67
  * ```
68
68
  */
69
69
  declare const Choice: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
70
- role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
70
+ role?: import("@khanacademy/wonder-blocks-core").AriaRole;
71
71
  }> & {
72
72
  /** User-defined. Label for the field. */
73
73
  label: React.ReactNode;
@@ -76,42 +76,42 @@ declare const Choice: React.ForwardRefExoticComponent<Readonly<import("@khanacad
76
76
  /** User-defined. Should be distinct for each item in the group. */
77
77
  value: string;
78
78
  /** User-defined. Whether this choice option is disabled. Default false. */
79
- disabled?: boolean | undefined;
79
+ disabled?: boolean;
80
80
  /** User-defined. Optional id for testing purposes. */
81
- testId?: string | undefined;
81
+ testId?: string;
82
82
  /** User-defined. Optional additional styling. */
83
83
  style?: StyleType;
84
84
  /**
85
85
  * Auto-populated by parent. Whether this choice is checked.
86
86
  * @ignore
87
87
  */
88
- checked?: boolean | undefined;
88
+ checked?: boolean;
89
89
  /**
90
90
  * Auto-populated by parent. Whether this choice is in error mode (everything
91
91
  * in a choice group would be in error mode at the same time).
92
92
  * @ignore
93
93
  */
94
- error?: boolean | undefined;
94
+ error?: boolean;
95
95
  /**
96
96
  * Auto-populated by parent. Used for accessibility purposes, where the label
97
97
  * id should match the input id.
98
98
  * @ignore
99
99
  */
100
- id?: string | undefined;
100
+ id?: string;
101
101
  /**
102
102
  * Auto-populated by parent's groupName prop.
103
103
  * @ignore
104
104
  */
105
- groupName?: string | undefined;
105
+ groupName?: string;
106
106
  /**
107
107
  * Auto-populated by parent. Returns the new checked state of the component.
108
108
  * @ignore
109
109
  */
110
- onChange?: ((newCheckedState: boolean) => unknown) | undefined;
110
+ onChange?: (newCheckedState: boolean) => unknown;
111
111
  /**
112
112
  * Auto-populated by parent.
113
113
  * @ignore
114
114
  */
115
- variant?: "checkbox" | "radio" | undefined;
115
+ variant?: "radio" | "checkbox";
116
116
  } & React.RefAttributes<HTMLInputElement>>;
117
117
  export default Choice;
@@ -36,10 +36,6 @@ type Props = {
36
36
  * Optional test ID for e2e testing.
37
37
  */
38
38
  testId?: string;
39
- /**
40
- * Change the field’s sub-components to fit a dark background.
41
- */
42
- light?: boolean;
43
39
  };
44
40
  /**
45
41
  * A FieldHeading is an element that provides a label, description, and error element
@@ -91,10 +91,6 @@ type CommonProps = {
91
91
  * Provide hints or examples of what to enter.
92
92
  */
93
93
  placeholder?: string;
94
- /**
95
- * Change the field’s sub-components to fit a dark background.
96
- */
97
- light: boolean;
98
94
  /**
99
95
  * Custom styles for the container.
100
96
  *
@@ -137,7 +133,6 @@ type PropsWithForwardRef = Props & WithForwardRef;
137
133
  type DefaultProps = {
138
134
  type: PropsWithForwardRef["type"];
139
135
  disabled: PropsWithForwardRef["disabled"];
140
- light: PropsWithForwardRef["light"];
141
136
  };
142
137
  type State = {
143
138
  /**
@@ -3,14 +3,14 @@ import type { Checked } from "../util/types";
3
3
  /**
4
4
  * The internal stateless 🔘 Radio button
5
5
  */ declare const RadioCore: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
6
- role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
6
+ role?: import("@khanacademy/wonder-blocks-core").AriaRole;
7
7
  }> & {
8
8
  checked: Checked;
9
9
  disabled: boolean;
10
10
  error: boolean;
11
- groupName?: string | undefined;
12
- id?: string | undefined;
13
- testId?: string | undefined;
11
+ groupName?: string;
12
+ id?: string;
13
+ testId?: string;
14
14
  onClick: () => void;
15
15
  } & React.RefAttributes<HTMLInputElement>>;
16
16
  export default RadioCore;
@@ -7,7 +7,7 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
7
7
  * This component should not really be used by itself because radio buttons are
8
8
  * often grouped together. See RadioGroup.
9
9
  */ declare const Radio: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
10
- role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
10
+ role?: import("@khanacademy/wonder-blocks-core").AriaRole;
11
11
  }> & {
12
12
  /**
13
13
  * Whether this component is checked
@@ -16,11 +16,11 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
16
16
  /**
17
17
  * Whether this component is disabled
18
18
  */
19
- disabled?: boolean | undefined;
19
+ disabled?: boolean;
20
20
  /**
21
21
  * Whether this component should show an error state
22
22
  */
23
- error?: boolean | undefined;
23
+ error?: boolean;
24
24
  /**
25
25
  * Callback when this component is selected. The newCheckedState is the
26
26
  * new checked state of the component.
@@ -39,7 +39,7 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
39
39
  * guarantee that the ID is unique within everything rendered on a page.
40
40
  * Used to match `<label>` with `<input>` elements for screenreaders.
41
41
  */
42
- id?: string | undefined;
42
+ id?: string;
43
43
  /**
44
44
  * Optional styling for the container. Does not style the component.
45
45
  */
@@ -47,16 +47,16 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
47
47
  /**
48
48
  * Adds CSS classes to the Checkbox.
49
49
  */
50
- className?: string | undefined;
50
+ className?: string;
51
51
  /**
52
52
  * Optional test ID for e2e testing
53
53
  */
54
- testId?: string | undefined;
54
+ testId?: string;
55
55
  /**
56
56
  * Name for the checkbox or radio button group. Only applicable for group
57
57
  * contexts, auto-populated by group components via Choice.
58
58
  * @ignore
59
59
  */
60
- groupName?: string | undefined;
60
+ groupName?: string;
61
61
  } & React.RefAttributes<HTMLInputElement>>;
62
62
  export default Radio;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { StyleType } from "@khanacademy/wonder-blocks-core";
3
3
  declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
4
- role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
4
+ role?: import("@khanacademy/wonder-blocks-core").AriaRole;
5
5
  }> & {
6
6
  /**
7
7
  * The text area value.
@@ -15,11 +15,11 @@ declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("@khanac
15
15
  * An optional unique identifier for the TextArea.
16
16
  * If no id is specified, a unique id will be auto-generated.
17
17
  */
18
- id?: string | undefined;
18
+ id?: string;
19
19
  /**
20
20
  * Optional test ID for e2e testing.
21
21
  */
22
- testId?: string | undefined;
22
+ testId?: string;
23
23
  /**
24
24
  * Custom styles for the textarea element.
25
25
  */
@@ -33,39 +33,39 @@ declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("@khanac
33
33
  /**
34
34
  * Provide hints or examples of what to enter.
35
35
  */
36
- placeholder?: string | undefined;
36
+ placeholder?: string;
37
37
  /**
38
38
  * Whether the text area should be disabled.
39
39
  */
40
- disabled?: boolean | undefined;
40
+ disabled?: boolean;
41
41
  /**
42
42
  * Specifies if the text area is read-only.
43
43
  */
44
- readOnly?: boolean | undefined;
44
+ readOnly?: boolean;
45
45
  /**
46
46
  * Specifies if the text area allows autocomplete.
47
47
  */
48
- autoComplete?: "off" | "on" | undefined;
48
+ autoComplete?: "on" | "off";
49
49
  /**
50
50
  * The name for the text area control. This is submitted along with
51
51
  * the form data.
52
52
  */
53
- name?: string | undefined;
53
+ name?: string;
54
54
  /**
55
55
  * CSS classes for the textarea element. It is recommended that the style prop is used instead where possible
56
56
  */
57
- className?: string | undefined;
57
+ className?: string;
58
58
  /**
59
59
  * Whether this textarea should autofocus on page load.
60
60
  */
61
- autoFocus?: boolean | undefined;
61
+ autoFocus?: boolean;
62
62
  /**
63
63
  * The number of visible lines of text for the textarea.
64
64
  * By default, 2 rows are shown.
65
65
  * `rows` is ignored if a height is applied to the textarea using CSS.
66
66
  * The number of rows can change if the resize control is used by the user.
67
67
  */
68
- rows?: number | undefined;
68
+ rows?: number;
69
69
  /**
70
70
  * Determines if the textarea should be checked for spelling by the browser/OS.
71
71
  * By default, it is enabled. It will be checked for spelling when you try
@@ -74,46 +74,46 @@ declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("@khanac
74
74
  * **Note**: Consider disabling `spellCheck` for
75
75
  * 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)
76
76
  */
77
- spellCheck?: boolean | undefined;
77
+ spellCheck?: boolean;
78
78
  /**
79
79
  * How the control should wrap the value for form submission. If not provided,
80
80
  * `soft` is the default behaviour. For more details, see the
81
81
  * [wrap attribute MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap)
82
82
  */
83
- wrap?: "off" | "hard" | "soft" | undefined;
83
+ wrap?: "hard" | "soft" | "off";
84
84
  /**
85
85
  * The minimum number of characters allowed in the textarea.
86
86
  */
87
- minLength?: number | undefined;
87
+ minLength?: number;
88
88
  /**
89
89
  * The maximum number of characters allowed in the textarea.
90
90
  */
91
- maxLength?: number | undefined;
91
+ maxLength?: number;
92
92
  /**
93
93
  * Called when the textarea is clicked.
94
94
  * @param event The event from the click
95
95
  */
96
- onClick?: React.MouseEventHandler<HTMLTextAreaElement> | undefined;
96
+ onClick?: React.MouseEventHandler<HTMLTextAreaElement>;
97
97
  /**
98
98
  * Called when a key is pressed.
99
99
  * @param event The keyboard event
100
100
  */
101
- onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement> | undefined;
101
+ onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;
102
102
  /**
103
103
  * Called when a key is released.
104
104
  * @param event The keyboard event
105
105
  */
106
- onKeyUp?: React.KeyboardEventHandler<HTMLTextAreaElement> | undefined;
106
+ onKeyUp?: React.KeyboardEventHandler<HTMLTextAreaElement>;
107
107
  /**
108
108
  * Called when the element has been focused.
109
109
  * @param event The focus event
110
110
  */
111
- onFocus?: React.FocusEventHandler<HTMLTextAreaElement> | undefined;
111
+ onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;
112
112
  /**
113
113
  * Called when the element has been focused.
114
114
  * @param event The blur event
115
115
  */
116
- onBlur?: React.FocusEventHandler<HTMLTextAreaElement> | undefined;
116
+ onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
117
117
  /**
118
118
  * Provide a validation for the textarea value.
119
119
  * Return a string error message or null | void for a valid input.
@@ -121,25 +121,25 @@ declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("@khanac
121
121
  * Use this for errors that are shown to the user while they are filling out
122
122
  * a form.
123
123
  */
124
- validate?: ((value: string) => string | null | void) | undefined;
124
+ validate?: (value: string) => string | null | void;
125
125
  /**
126
126
  * Called right after the textarea is validated.
127
127
  */
128
- onValidate?: ((errorMessage?: string | null | undefined) => unknown) | undefined;
128
+ onValidate?: (errorMessage?: string | null | undefined) => unknown;
129
129
  /**
130
130
  * If true, textarea is validated as the user types (onChange). If false,
131
131
  * it is validated when the user's focus moves out of the field (onBlur).
132
132
  * It is preferred that instantValidation is set to `false`, however, it
133
133
  * defaults to `true` for backwards compatibility with existing implementations.
134
134
  */
135
- instantValidation?: boolean | undefined;
135
+ instantValidation?: boolean;
136
136
  /**
137
137
  * Whether the textarea is in an error state.
138
138
  *
139
139
  * Use this for errors that are triggered by something external to the
140
140
  * component (example: an error after form submission).
141
141
  */
142
- error?: boolean | undefined;
142
+ error?: boolean;
143
143
  /**
144
144
  * Whether this textarea is required to continue, or the error message to
145
145
  * render if this textarea is left blank.
@@ -162,15 +162,11 @@ declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("@khanac
162
162
  * there is no corresponding message and the default untranlsated message
163
163
  * will be used.
164
164
  */
165
- required?: string | boolean | undefined;
165
+ required?: boolean | string;
166
166
  /**
167
167
  * Specifies the resizing behaviour for the textarea. Defaults to both
168
168
  * behaviour. For more details, see the [CSS resize property values MDN docs](https://developer.mozilla.org/en-US/docs/Web/CSS/resize#values)
169
169
  */
170
- resizeType?: "none" | "both" | "horizontal" | "vertical" | undefined;
171
- /**
172
- * Change the default focus ring color to fit a dark background.
173
- */
174
- light?: boolean | undefined;
170
+ resizeType?: "horizontal" | "vertical" | "both" | "none";
175
171
  } & React.RefAttributes<HTMLTextAreaElement>>;
176
172
  export default TextArea;
@@ -101,10 +101,6 @@ type CommonProps = AriaProps & {
101
101
  * will be used.
102
102
  */
103
103
  required?: boolean | string;
104
- /**
105
- * Change the default focus ring color to fit a dark background.
106
- */
107
- light?: boolean;
108
104
  /**
109
105
  * Custom styles for the input.
110
106
  */