@khanacademy/wonder-blocks-form 4.9.1 → 4.9.3
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 +19 -0
- package/dist/components/checkbox-core.d.ts +2 -2
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/choice-internal.d.ts +2 -2
- package/dist/components/choice.d.ts +2 -2
- package/dist/components/radio-core.d.ts +2 -2
- package/dist/components/radio.d.ts +2 -2
- package/dist/components/text-area.d.ts +2 -2
- package/dist/components/text-field.d.ts +4 -1
- package/dist/es/index.js +31 -78
- package/dist/index.js +31 -78
- package/package.json +7 -7
- package/src/__tests__/__snapshots__/custom-snapshot.test.tsx.snap +0 -247
- package/src/__tests__/custom-snapshot.test.tsx +0 -48
- package/src/components/__tests__/checkbox-group.test.tsx +0 -162
- package/src/components/__tests__/checkbox.test.tsx +0 -138
- package/src/components/__tests__/field-heading.test.tsx +0 -225
- package/src/components/__tests__/labeled-text-field.test.tsx +0 -727
- package/src/components/__tests__/radio-group.test.tsx +0 -182
- package/src/components/__tests__/text-area.test.tsx +0 -1286
- package/src/components/__tests__/text-field.test.tsx +0 -562
- package/src/components/checkbox-core.tsx +0 -239
- package/src/components/checkbox-group.tsx +0 -174
- package/src/components/checkbox.tsx +0 -99
- package/src/components/choice-internal.tsx +0 -184
- package/src/components/choice.tsx +0 -157
- package/src/components/field-heading.tsx +0 -169
- package/src/components/group-styles.ts +0 -33
- package/src/components/labeled-text-field.tsx +0 -317
- package/src/components/radio-core.tsx +0 -171
- package/src/components/radio-group.tsx +0 -159
- package/src/components/radio.tsx +0 -82
- package/src/components/text-area.tsx +0 -430
- package/src/components/text-field.tsx +0 -437
- package/src/index.ts +0 -17
- package/src/util/types.ts +0 -85
- package/tsconfig-build.json +0 -19
- package/tsconfig-build.tsbuildinfo +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-form
|
|
2
2
|
|
|
3
|
+
## 4.9.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
|
|
8
|
+
- Updated dependencies [02a1b298]
|
|
9
|
+
- @khanacademy/wonder-blocks-clickable@4.2.8
|
|
10
|
+
- @khanacademy/wonder-blocks-core@7.0.1
|
|
11
|
+
- @khanacademy/wonder-blocks-icon@4.1.5
|
|
12
|
+
- @khanacademy/wonder-blocks-layout@2.2.1
|
|
13
|
+
- @khanacademy/wonder-blocks-tokens@2.0.1
|
|
14
|
+
- @khanacademy/wonder-blocks-typography@2.1.16
|
|
15
|
+
|
|
16
|
+
## 4.9.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 9ec147a9: Revert updated `TextField` state styling
|
|
21
|
+
|
|
3
22
|
## 4.9.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -3,8 +3,8 @@ import type { Checked } from "../util/types";
|
|
|
3
3
|
/**
|
|
4
4
|
* The internal stateless ☑️ Checkbox
|
|
5
5
|
*/
|
|
6
|
-
declare const CheckboxCore: React.ForwardRefExoticComponent<Readonly<import("
|
|
7
|
-
role?: import("
|
|
6
|
+
declare const CheckboxCore: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
7
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
|
|
8
8
|
}> & {
|
|
9
9
|
checked: Checked;
|
|
10
10
|
disabled: boolean;
|
|
@@ -22,8 +22,8 @@ import type { Checked } from "../util/types";
|
|
|
22
22
|
* <Checkbox checked={checked} onChange={setChecked} />
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
declare const Checkbox: React.ForwardRefExoticComponent<Readonly<import("
|
|
26
|
-
role?: import("
|
|
25
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
26
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
|
|
27
27
|
}> & {
|
|
28
28
|
/**
|
|
29
29
|
* Whether this component is checked or indeterminate
|
|
@@ -7,8 +7,8 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
|
7
7
|
* and RadioGroup. This design allows for more explicit prop typing. For
|
|
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
|
-
*/ declare const ChoiceInternal: React.ForwardRefExoticComponent<Readonly<import("
|
|
11
|
-
role?: import("
|
|
10
|
+
*/ declare const ChoiceInternal: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
11
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
|
|
12
12
|
}> & {
|
|
13
13
|
/** Whether this choice is checked. */
|
|
14
14
|
checked: boolean | null | undefined;
|
|
@@ -66,8 +66,8 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
|
66
66
|
* </RadioGroup>
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
|
-
declare const Choice: React.ForwardRefExoticComponent<Readonly<import("
|
|
70
|
-
role?: import("
|
|
69
|
+
declare const Choice: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
70
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
|
|
71
71
|
}> & {
|
|
72
72
|
/** User-defined. Label for the field. */
|
|
73
73
|
label: React.ReactNode;
|
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import type { Checked } from "../util/types";
|
|
3
3
|
/**
|
|
4
4
|
* The internal stateless 🔘 Radio button
|
|
5
|
-
*/ declare const RadioCore: React.ForwardRefExoticComponent<Readonly<import("
|
|
6
|
-
role?: import("
|
|
5
|
+
*/ declare const RadioCore: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
6
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
|
|
7
7
|
}> & {
|
|
8
8
|
checked: Checked;
|
|
9
9
|
disabled: boolean;
|
|
@@ -6,8 +6,8 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
|
6
6
|
*
|
|
7
7
|
* This component should not really be used by itself because radio buttons are
|
|
8
8
|
* often grouped together. See RadioGroup.
|
|
9
|
-
*/ declare const Radio: React.ForwardRefExoticComponent<Readonly<import("
|
|
10
|
-
role?: import("
|
|
9
|
+
*/ declare const Radio: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
10
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
|
|
11
11
|
}> & {
|
|
12
12
|
/**
|
|
13
13
|
* Whether this component is checked
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
3
|
-
declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("
|
|
4
|
-
role?: import("
|
|
3
|
+
declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
4
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole | undefined;
|
|
5
5
|
}> & {
|
|
6
6
|
/**
|
|
7
7
|
* The text area value.
|
|
@@ -133,6 +133,10 @@ type State = {
|
|
|
133
133
|
* Displayed when the validation fails.
|
|
134
134
|
*/
|
|
135
135
|
error: string | null | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* The user focuses on this field.
|
|
138
|
+
*/
|
|
139
|
+
focused: boolean;
|
|
136
140
|
};
|
|
137
141
|
/**
|
|
138
142
|
* A TextField is an element used to accept a single line of text from the user.
|
|
@@ -146,7 +150,6 @@ declare class TextField extends React.Component<PropsWithForwardRef, State> {
|
|
|
146
150
|
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => unknown;
|
|
147
151
|
handleFocus: (event: React.FocusEvent<HTMLInputElement>) => unknown;
|
|
148
152
|
handleBlur: (event: React.FocusEvent<HTMLInputElement>) => unknown;
|
|
149
|
-
getStyles: () => StyleType;
|
|
150
153
|
render(): React.ReactNode;
|
|
151
154
|
}
|
|
152
155
|
type ExportProps = OmitConstrained<JSX.LibraryManagedAttributes<typeof TextField, React.ComponentProps<typeof TextField>>, "forwardedRef">;
|
package/dist/es/index.js
CHANGED
|
@@ -592,14 +592,15 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
|
|
|
592
592
|
})));
|
|
593
593
|
});
|
|
594
594
|
|
|
595
|
-
const _excluded$2 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "
|
|
595
|
+
const _excluded$2 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
|
|
596
596
|
const defaultErrorMessage$1 = "This field is required.";
|
|
597
597
|
const StyledInput = addStyle("input");
|
|
598
598
|
class TextField extends React.Component {
|
|
599
599
|
constructor(props) {
|
|
600
600
|
super(props);
|
|
601
601
|
this.state = {
|
|
602
|
-
error: null
|
|
602
|
+
error: null,
|
|
603
|
+
focused: false
|
|
603
604
|
};
|
|
604
605
|
this.maybeValidate = newValue => {
|
|
605
606
|
const {
|
|
@@ -640,30 +641,25 @@ class TextField extends React.Component {
|
|
|
640
641
|
const {
|
|
641
642
|
onFocus
|
|
642
643
|
} = this.props;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
644
|
+
this.setState({
|
|
645
|
+
focused: true
|
|
646
|
+
}, () => {
|
|
647
|
+
if (onFocus) {
|
|
648
|
+
onFocus(event);
|
|
649
|
+
}
|
|
650
|
+
});
|
|
646
651
|
};
|
|
647
652
|
this.handleBlur = event => {
|
|
648
653
|
const {
|
|
649
654
|
onBlur
|
|
650
655
|
} = this.props;
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
light
|
|
659
|
-
} = this.props;
|
|
660
|
-
const {
|
|
661
|
-
error
|
|
662
|
-
} = this.state;
|
|
663
|
-
const baseStyles = [styles$2.input, styles$7.LabelMedium];
|
|
664
|
-
const defaultStyles = [styles$2.default, !disabled && styles$2.defaultFocus, disabled && styles$2.disabled, !!error && styles$2.error];
|
|
665
|
-
const lightStyles = [styles$2.light, !disabled && styles$2.lightFocus, disabled && styles$2.lightDisabled, !!error && styles$2.lightError];
|
|
666
|
-
return [...baseStyles, ...(light ? lightStyles : defaultStyles)];
|
|
656
|
+
this.setState({
|
|
657
|
+
focused: false
|
|
658
|
+
}, () => {
|
|
659
|
+
if (onBlur) {
|
|
660
|
+
onBlur(event);
|
|
661
|
+
}
|
|
662
|
+
});
|
|
667
663
|
};
|
|
668
664
|
if (props.validate && props.value !== "") {
|
|
669
665
|
this.state.error = props.validate(props.value) || null;
|
|
@@ -684,6 +680,7 @@ class TextField extends React.Component {
|
|
|
684
680
|
disabled,
|
|
685
681
|
onKeyDown,
|
|
686
682
|
placeholder,
|
|
683
|
+
light,
|
|
687
684
|
style,
|
|
688
685
|
testId,
|
|
689
686
|
readOnly,
|
|
@@ -696,7 +693,7 @@ class TextField extends React.Component {
|
|
|
696
693
|
id: id,
|
|
697
694
|
scope: "text-field"
|
|
698
695
|
}, uniqueId => React.createElement(StyledInput, _extends({
|
|
699
|
-
style: [this.
|
|
696
|
+
style: [styles$2.input, styles$7.LabelMedium, styles$2.default, disabled ? styles$2.disabled : this.state.focused ? [styles$2.focused, light && styles$2.defaultLight] : !!this.state.error && [styles$2.error, light && styles$2.errorLight], !!this.state.error && styles$2.error, style && style],
|
|
700
697
|
id: uniqueId,
|
|
701
698
|
type: type,
|
|
702
699
|
placeholder: placeholder,
|
|
@@ -726,10 +723,12 @@ const styles$2 = StyleSheet.create({
|
|
|
726
723
|
input: {
|
|
727
724
|
width: "100%",
|
|
728
725
|
height: 40,
|
|
729
|
-
borderRadius:
|
|
726
|
+
borderRadius: 4,
|
|
730
727
|
boxSizing: "border-box",
|
|
731
728
|
paddingLeft: spacing.medium_16,
|
|
732
|
-
margin: 0
|
|
729
|
+
margin: 0,
|
|
730
|
+
outline: "none",
|
|
731
|
+
boxShadow: "none"
|
|
733
732
|
},
|
|
734
733
|
default: {
|
|
735
734
|
background: color.white,
|
|
@@ -739,23 +738,12 @@ const styles$2 = StyleSheet.create({
|
|
|
739
738
|
color: color.offBlack64
|
|
740
739
|
}
|
|
741
740
|
},
|
|
742
|
-
defaultFocus: {
|
|
743
|
-
":focus-visible": {
|
|
744
|
-
borderColor: color.blue,
|
|
745
|
-
outline: `1px solid ${color.blue}`,
|
|
746
|
-
outlineOffset: 0
|
|
747
|
-
}
|
|
748
|
-
},
|
|
749
741
|
error: {
|
|
750
742
|
background: color.fadedRed8,
|
|
751
743
|
border: `1px solid ${color.red}`,
|
|
752
744
|
color: color.offBlack,
|
|
753
745
|
"::placeholder": {
|
|
754
746
|
color: color.offBlack64
|
|
755
|
-
},
|
|
756
|
-
":focus-visible": {
|
|
757
|
-
outlineColor: color.red,
|
|
758
|
-
borderColor: color.red
|
|
759
747
|
}
|
|
760
748
|
},
|
|
761
749
|
disabled: {
|
|
@@ -763,57 +751,22 @@ const styles$2 = StyleSheet.create({
|
|
|
763
751
|
border: `1px solid ${color.offBlack16}`,
|
|
764
752
|
color: color.offBlack64,
|
|
765
753
|
"::placeholder": {
|
|
766
|
-
color: color.
|
|
767
|
-
},
|
|
768
|
-
cursor: "not-allowed",
|
|
769
|
-
":focus-visible": {
|
|
770
|
-
outline: "none",
|
|
771
|
-
boxShadow: `0 0 0 1px ${color.white}, 0 0 0 3px ${color.offBlack32}`
|
|
754
|
+
color: color.offBlack32
|
|
772
755
|
}
|
|
773
756
|
},
|
|
774
|
-
|
|
757
|
+
focused: {
|
|
775
758
|
background: color.white,
|
|
776
|
-
border: `1px solid ${color.
|
|
759
|
+
border: `1px solid ${color.blue}`,
|
|
777
760
|
color: color.offBlack,
|
|
778
761
|
"::placeholder": {
|
|
779
762
|
color: color.offBlack64
|
|
780
763
|
}
|
|
781
764
|
},
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
outline: `1px solid ${color.blue}`,
|
|
785
|
-
outlineOffset: 0,
|
|
786
|
-
borderColor: color.blue,
|
|
787
|
-
boxShadow: `0px 0px 0px 2px ${color.blue}, 0px 0px 0px 3px ${color.white}`
|
|
788
|
-
}
|
|
789
|
-
},
|
|
790
|
-
lightDisabled: {
|
|
791
|
-
backgroundColor: "transparent",
|
|
792
|
-
border: `1px solid ${color.white32}`,
|
|
793
|
-
color: color.white64,
|
|
794
|
-
"::placeholder": {
|
|
795
|
-
color: color.white64
|
|
796
|
-
},
|
|
797
|
-
cursor: "not-allowed",
|
|
798
|
-
":focus-visible": {
|
|
799
|
-
borderColor: mix(color.white32, color.blue),
|
|
800
|
-
outline: "none",
|
|
801
|
-
boxShadow: `0 0 0 1px ${color.offBlack32}, 0 0 0 3px ${color.fadedBlue}`
|
|
802
|
-
}
|
|
765
|
+
defaultLight: {
|
|
766
|
+
boxShadow: `0px 0px 0px 1px ${color.blue}, 0px 0px 0px 2px ${color.white}`
|
|
803
767
|
},
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
border: `1px solid ${color.red}`,
|
|
807
|
-
boxShadow: `0px 0px 0px 1px ${color.red}, 0px 0px 0px 2px ${color.white}`,
|
|
808
|
-
color: color.offBlack,
|
|
809
|
-
"::placeholder": {
|
|
810
|
-
color: color.offBlack64
|
|
811
|
-
},
|
|
812
|
-
":focus-visible": {
|
|
813
|
-
outlineColor: color.red,
|
|
814
|
-
borderColor: color.red,
|
|
815
|
-
boxShadow: `0px 0px 0px 2px ${color.red}, 0px 0px 0px 3px ${color.white}`
|
|
816
|
-
}
|
|
768
|
+
errorLight: {
|
|
769
|
+
boxShadow: `0px 0px 0px 1px ${color.red}, 0px 0px 0px 2px ${color.white}`
|
|
817
770
|
}
|
|
818
771
|
});
|
|
819
772
|
var TextField$1 = React.forwardRef((props, ref) => React.createElement(TextField, _extends({}, props, {
|
|
@@ -1109,7 +1062,7 @@ const TextArea = React.forwardRef(function TextArea(props, ref) {
|
|
|
1109
1062
|
"data-testid": testId,
|
|
1110
1063
|
ref: ref,
|
|
1111
1064
|
className: className,
|
|
1112
|
-
style: [getStyles(), style],
|
|
1065
|
+
style: [...getStyles(), style],
|
|
1113
1066
|
value: value,
|
|
1114
1067
|
onChange: handleChange,
|
|
1115
1068
|
placeholder: placeholder,
|
package/dist/index.js
CHANGED
|
@@ -622,14 +622,15 @@ const RadioGroup = React__namespace.forwardRef(function RadioGroup(props, ref) {
|
|
|
622
622
|
})));
|
|
623
623
|
});
|
|
624
624
|
|
|
625
|
-
const _excluded$2 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "
|
|
625
|
+
const _excluded$2 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
|
|
626
626
|
const defaultErrorMessage$1 = "This field is required.";
|
|
627
627
|
const StyledInput = wonderBlocksCore.addStyle("input");
|
|
628
628
|
class TextField extends React__namespace.Component {
|
|
629
629
|
constructor(props) {
|
|
630
630
|
super(props);
|
|
631
631
|
this.state = {
|
|
632
|
-
error: null
|
|
632
|
+
error: null,
|
|
633
|
+
focused: false
|
|
633
634
|
};
|
|
634
635
|
this.maybeValidate = newValue => {
|
|
635
636
|
const {
|
|
@@ -670,30 +671,25 @@ class TextField extends React__namespace.Component {
|
|
|
670
671
|
const {
|
|
671
672
|
onFocus
|
|
672
673
|
} = this.props;
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}
|
|
674
|
+
this.setState({
|
|
675
|
+
focused: true
|
|
676
|
+
}, () => {
|
|
677
|
+
if (onFocus) {
|
|
678
|
+
onFocus(event);
|
|
679
|
+
}
|
|
680
|
+
});
|
|
676
681
|
};
|
|
677
682
|
this.handleBlur = event => {
|
|
678
683
|
const {
|
|
679
684
|
onBlur
|
|
680
685
|
} = this.props;
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
light
|
|
689
|
-
} = this.props;
|
|
690
|
-
const {
|
|
691
|
-
error
|
|
692
|
-
} = this.state;
|
|
693
|
-
const baseStyles = [styles$2.input, wonderBlocksTypography.styles.LabelMedium];
|
|
694
|
-
const defaultStyles = [styles$2.default, !disabled && styles$2.defaultFocus, disabled && styles$2.disabled, !!error && styles$2.error];
|
|
695
|
-
const lightStyles = [styles$2.light, !disabled && styles$2.lightFocus, disabled && styles$2.lightDisabled, !!error && styles$2.lightError];
|
|
696
|
-
return [...baseStyles, ...(light ? lightStyles : defaultStyles)];
|
|
686
|
+
this.setState({
|
|
687
|
+
focused: false
|
|
688
|
+
}, () => {
|
|
689
|
+
if (onBlur) {
|
|
690
|
+
onBlur(event);
|
|
691
|
+
}
|
|
692
|
+
});
|
|
697
693
|
};
|
|
698
694
|
if (props.validate && props.value !== "") {
|
|
699
695
|
this.state.error = props.validate(props.value) || null;
|
|
@@ -714,6 +710,7 @@ class TextField extends React__namespace.Component {
|
|
|
714
710
|
disabled,
|
|
715
711
|
onKeyDown,
|
|
716
712
|
placeholder,
|
|
713
|
+
light,
|
|
717
714
|
style,
|
|
718
715
|
testId,
|
|
719
716
|
readOnly,
|
|
@@ -726,7 +723,7 @@ class TextField extends React__namespace.Component {
|
|
|
726
723
|
id: id,
|
|
727
724
|
scope: "text-field"
|
|
728
725
|
}, uniqueId => React__namespace.createElement(StyledInput, _extends__default["default"]({
|
|
729
|
-
style: [this.
|
|
726
|
+
style: [styles$2.input, wonderBlocksTypography.styles.LabelMedium, styles$2.default, disabled ? styles$2.disabled : this.state.focused ? [styles$2.focused, light && styles$2.defaultLight] : !!this.state.error && [styles$2.error, light && styles$2.errorLight], !!this.state.error && styles$2.error, style && style],
|
|
730
727
|
id: uniqueId,
|
|
731
728
|
type: type,
|
|
732
729
|
placeholder: placeholder,
|
|
@@ -756,10 +753,12 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
756
753
|
input: {
|
|
757
754
|
width: "100%",
|
|
758
755
|
height: 40,
|
|
759
|
-
borderRadius:
|
|
756
|
+
borderRadius: 4,
|
|
760
757
|
boxSizing: "border-box",
|
|
761
758
|
paddingLeft: wonderBlocksTokens.spacing.medium_16,
|
|
762
|
-
margin: 0
|
|
759
|
+
margin: 0,
|
|
760
|
+
outline: "none",
|
|
761
|
+
boxShadow: "none"
|
|
763
762
|
},
|
|
764
763
|
default: {
|
|
765
764
|
background: wonderBlocksTokens.color.white,
|
|
@@ -769,23 +768,12 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
769
768
|
color: wonderBlocksTokens.color.offBlack64
|
|
770
769
|
}
|
|
771
770
|
},
|
|
772
|
-
defaultFocus: {
|
|
773
|
-
":focus-visible": {
|
|
774
|
-
borderColor: wonderBlocksTokens.color.blue,
|
|
775
|
-
outline: `1px solid ${wonderBlocksTokens.color.blue}`,
|
|
776
|
-
outlineOffset: 0
|
|
777
|
-
}
|
|
778
|
-
},
|
|
779
771
|
error: {
|
|
780
772
|
background: wonderBlocksTokens.color.fadedRed8,
|
|
781
773
|
border: `1px solid ${wonderBlocksTokens.color.red}`,
|
|
782
774
|
color: wonderBlocksTokens.color.offBlack,
|
|
783
775
|
"::placeholder": {
|
|
784
776
|
color: wonderBlocksTokens.color.offBlack64
|
|
785
|
-
},
|
|
786
|
-
":focus-visible": {
|
|
787
|
-
outlineColor: wonderBlocksTokens.color.red,
|
|
788
|
-
borderColor: wonderBlocksTokens.color.red
|
|
789
777
|
}
|
|
790
778
|
},
|
|
791
779
|
disabled: {
|
|
@@ -793,57 +781,22 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
793
781
|
border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
794
782
|
color: wonderBlocksTokens.color.offBlack64,
|
|
795
783
|
"::placeholder": {
|
|
796
|
-
color: wonderBlocksTokens.color.
|
|
797
|
-
},
|
|
798
|
-
cursor: "not-allowed",
|
|
799
|
-
":focus-visible": {
|
|
800
|
-
outline: "none",
|
|
801
|
-
boxShadow: `0 0 0 1px ${wonderBlocksTokens.color.white}, 0 0 0 3px ${wonderBlocksTokens.color.offBlack32}`
|
|
784
|
+
color: wonderBlocksTokens.color.offBlack32
|
|
802
785
|
}
|
|
803
786
|
},
|
|
804
|
-
|
|
787
|
+
focused: {
|
|
805
788
|
background: wonderBlocksTokens.color.white,
|
|
806
|
-
border: `1px solid ${wonderBlocksTokens.color.
|
|
789
|
+
border: `1px solid ${wonderBlocksTokens.color.blue}`,
|
|
807
790
|
color: wonderBlocksTokens.color.offBlack,
|
|
808
791
|
"::placeholder": {
|
|
809
792
|
color: wonderBlocksTokens.color.offBlack64
|
|
810
793
|
}
|
|
811
794
|
},
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
outline: `1px solid ${wonderBlocksTokens.color.blue}`,
|
|
815
|
-
outlineOffset: 0,
|
|
816
|
-
borderColor: wonderBlocksTokens.color.blue,
|
|
817
|
-
boxShadow: `0px 0px 0px 2px ${wonderBlocksTokens.color.blue}, 0px 0px 0px 3px ${wonderBlocksTokens.color.white}`
|
|
818
|
-
}
|
|
819
|
-
},
|
|
820
|
-
lightDisabled: {
|
|
821
|
-
backgroundColor: "transparent",
|
|
822
|
-
border: `1px solid ${wonderBlocksTokens.color.white32}`,
|
|
823
|
-
color: wonderBlocksTokens.color.white64,
|
|
824
|
-
"::placeholder": {
|
|
825
|
-
color: wonderBlocksTokens.color.white64
|
|
826
|
-
},
|
|
827
|
-
cursor: "not-allowed",
|
|
828
|
-
":focus-visible": {
|
|
829
|
-
borderColor: wonderBlocksTokens.mix(wonderBlocksTokens.color.white32, wonderBlocksTokens.color.blue),
|
|
830
|
-
outline: "none",
|
|
831
|
-
boxShadow: `0 0 0 1px ${wonderBlocksTokens.color.offBlack32}, 0 0 0 3px ${wonderBlocksTokens.color.fadedBlue}`
|
|
832
|
-
}
|
|
795
|
+
defaultLight: {
|
|
796
|
+
boxShadow: `0px 0px 0px 1px ${wonderBlocksTokens.color.blue}, 0px 0px 0px 2px ${wonderBlocksTokens.color.white}`
|
|
833
797
|
},
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
border: `1px solid ${wonderBlocksTokens.color.red}`,
|
|
837
|
-
boxShadow: `0px 0px 0px 1px ${wonderBlocksTokens.color.red}, 0px 0px 0px 2px ${wonderBlocksTokens.color.white}`,
|
|
838
|
-
color: wonderBlocksTokens.color.offBlack,
|
|
839
|
-
"::placeholder": {
|
|
840
|
-
color: wonderBlocksTokens.color.offBlack64
|
|
841
|
-
},
|
|
842
|
-
":focus-visible": {
|
|
843
|
-
outlineColor: wonderBlocksTokens.color.red,
|
|
844
|
-
borderColor: wonderBlocksTokens.color.red,
|
|
845
|
-
boxShadow: `0px 0px 0px 2px ${wonderBlocksTokens.color.red}, 0px 0px 0px 3px ${wonderBlocksTokens.color.white}`
|
|
846
|
-
}
|
|
798
|
+
errorLight: {
|
|
799
|
+
boxShadow: `0px 0px 0px 1px ${wonderBlocksTokens.color.red}, 0px 0px 0px 2px ${wonderBlocksTokens.color.white}`
|
|
847
800
|
}
|
|
848
801
|
});
|
|
849
802
|
var TextField$1 = React__namespace.forwardRef((props, ref) => React__namespace.createElement(TextField, _extends__default["default"]({}, props, {
|
|
@@ -1139,7 +1092,7 @@ const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
|
|
|
1139
1092
|
"data-testid": testId,
|
|
1140
1093
|
ref: ref,
|
|
1141
1094
|
className: className,
|
|
1142
|
-
style: [getStyles(), style],
|
|
1095
|
+
style: [...getStyles(), style],
|
|
1143
1096
|
value: value,
|
|
1144
1097
|
onChange: handleChange,
|
|
1145
1098
|
placeholder: placeholder,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-form",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.3",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Form components for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-clickable": "^4.2.
|
|
20
|
-
"@khanacademy/wonder-blocks-core": "^7.0.
|
|
21
|
-
"@khanacademy/wonder-blocks-icon": "^4.1.
|
|
22
|
-
"@khanacademy/wonder-blocks-layout": "^2.2.
|
|
23
|
-
"@khanacademy/wonder-blocks-tokens": "^2.0.
|
|
24
|
-
"@khanacademy/wonder-blocks-typography": "^2.1.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^4.2.8",
|
|
20
|
+
"@khanacademy/wonder-blocks-core": "^7.0.1",
|
|
21
|
+
"@khanacademy/wonder-blocks-icon": "^4.1.5",
|
|
22
|
+
"@khanacademy/wonder-blocks-layout": "^2.2.1",
|
|
23
|
+
"@khanacademy/wonder-blocks-tokens": "^2.0.1",
|
|
24
|
+
"@khanacademy/wonder-blocks-typography": "^2.1.16"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"aphrodite": "^1.2.5",
|