@khanacademy/wonder-blocks-form 4.9.3 → 4.9.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.
- package/CHANGELOG.md +8 -0
- package/dist/components/labeled-text-field.d.ts +9 -1
- package/dist/components/text-field.d.ts +10 -5
- package/dist/es/index.js +93 -48
- package/dist/index.js +93 -48
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-form
|
|
2
2
|
|
|
3
|
+
## 4.9.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 61dc4448: Allow `TextField` 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
|
+
- 2dfd5eb6: - Update `TextField` state styling so that it is consistent with other components like `TextArea`, `SingleSelect`, `MultiSelect` (especially the focus styling). The styling also now uses CSS pseudo-classes for easier testing in Chromatic and debugging in browsers.
|
|
9
|
+
- `TextField` and `TextArea` state styling has also been updated so that any outline styles outside of the component are now applied within the component to prevent cropped focus outlines in places where an ancestor element has `overflow: hidden`.
|
|
10
|
+
|
|
3
11
|
## 4.9.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -24,7 +24,15 @@ type CommonProps = {
|
|
|
24
24
|
*/
|
|
25
25
|
value: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Whether the input should be disabled. Defaults to false.
|
|
28
|
+
* If the disabled prop is set to `true`, LabeledTextField will have disabled
|
|
29
|
+
* styling and will not be interactable.
|
|
30
|
+
*
|
|
31
|
+
* Note: The `disabled` prop sets the `aria-disabled` attribute to `true`
|
|
32
|
+
* instead of setting the `disabled` attribute. This is so that the component
|
|
33
|
+
* remains focusable while communicating to screen readers that it is disabled.
|
|
34
|
+
* This `disabled` prop will also set the `readonly` attribute to prevent
|
|
35
|
+
* typing in the field.
|
|
28
36
|
*/
|
|
29
37
|
disabled: boolean;
|
|
30
38
|
/**
|
|
@@ -21,7 +21,15 @@ type CommonProps = AriaProps & {
|
|
|
21
21
|
*/
|
|
22
22
|
name?: string;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Whether the input should be disabled. Defaults to false.
|
|
25
|
+
* If the disabled prop is set to `true`, TextField will have disabled
|
|
26
|
+
* styling and will not be interactable.
|
|
27
|
+
*
|
|
28
|
+
* Note: The `disabled` prop sets the `aria-disabled` attribute to `true`
|
|
29
|
+
* instead of setting the `disabled` attribute. This is so that the component
|
|
30
|
+
* remains focusable while communicating to screen readers that it is disabled.
|
|
31
|
+
* This `disabled` prop will also set the `readonly` attribute to prevent
|
|
32
|
+
* typing in the field.
|
|
25
33
|
*/
|
|
26
34
|
disabled: boolean;
|
|
27
35
|
/**
|
|
@@ -133,10 +141,6 @@ type State = {
|
|
|
133
141
|
* Displayed when the validation fails.
|
|
134
142
|
*/
|
|
135
143
|
error: string | null | undefined;
|
|
136
|
-
/**
|
|
137
|
-
* The user focuses on this field.
|
|
138
|
-
*/
|
|
139
|
-
focused: boolean;
|
|
140
144
|
};
|
|
141
145
|
/**
|
|
142
146
|
* A TextField is an element used to accept a single line of text from the user.
|
|
@@ -150,6 +154,7 @@ declare class TextField extends React.Component<PropsWithForwardRef, State> {
|
|
|
150
154
|
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => unknown;
|
|
151
155
|
handleFocus: (event: React.FocusEvent<HTMLInputElement>) => unknown;
|
|
152
156
|
handleBlur: (event: React.FocusEvent<HTMLInputElement>) => unknown;
|
|
157
|
+
getStyles: () => StyleType;
|
|
153
158
|
render(): React.ReactNode;
|
|
154
159
|
}
|
|
155
160
|
type ExportProps = OmitConstrained<JSX.LibraryManagedAttributes<typeof TextField, React.ComponentProps<typeof TextField>>, "forwardedRef">;
|
package/dist/es/index.js
CHANGED
|
@@ -592,15 +592,14 @@ 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", "
|
|
595
|
+
const _excluded$2 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "light", "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
|
|
603
|
-
focused: false
|
|
602
|
+
error: null
|
|
604
603
|
};
|
|
605
604
|
this.maybeValidate = newValue => {
|
|
606
605
|
const {
|
|
@@ -641,25 +640,30 @@ class TextField extends React.Component {
|
|
|
641
640
|
const {
|
|
642
641
|
onFocus
|
|
643
642
|
} = this.props;
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
}
|
|
647
|
-
if (onFocus) {
|
|
648
|
-
onFocus(event);
|
|
649
|
-
}
|
|
650
|
-
});
|
|
643
|
+
if (onFocus) {
|
|
644
|
+
onFocus(event);
|
|
645
|
+
}
|
|
651
646
|
};
|
|
652
647
|
this.handleBlur = event => {
|
|
653
648
|
const {
|
|
654
649
|
onBlur
|
|
655
650
|
} = this.props;
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
651
|
+
if (onBlur) {
|
|
652
|
+
onBlur(event);
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
this.getStyles = () => {
|
|
656
|
+
const {
|
|
657
|
+
disabled,
|
|
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)];
|
|
663
667
|
};
|
|
664
668
|
if (props.validate && props.value !== "") {
|
|
665
669
|
this.state.error = props.validate(props.value) || null;
|
|
@@ -680,7 +684,6 @@ class TextField extends React.Component {
|
|
|
680
684
|
disabled,
|
|
681
685
|
onKeyDown,
|
|
682
686
|
placeholder,
|
|
683
|
-
light,
|
|
684
687
|
style,
|
|
685
688
|
testId,
|
|
686
689
|
readOnly,
|
|
@@ -693,19 +696,19 @@ class TextField extends React.Component {
|
|
|
693
696
|
id: id,
|
|
694
697
|
scope: "text-field"
|
|
695
698
|
}, uniqueId => React.createElement(StyledInput, _extends({
|
|
696
|
-
style: [
|
|
699
|
+
style: [this.getStyles(), style],
|
|
697
700
|
id: uniqueId,
|
|
698
701
|
type: type,
|
|
699
702
|
placeholder: placeholder,
|
|
700
703
|
value: value,
|
|
701
704
|
name: name,
|
|
702
|
-
disabled: disabled,
|
|
705
|
+
"aria-disabled": disabled,
|
|
703
706
|
onChange: this.handleChange,
|
|
704
|
-
onKeyDown: onKeyDown,
|
|
707
|
+
onKeyDown: disabled ? undefined : onKeyDown,
|
|
705
708
|
onFocus: this.handleFocus,
|
|
706
709
|
onBlur: this.handleBlur,
|
|
707
710
|
"data-testid": testId,
|
|
708
|
-
readOnly: readOnly,
|
|
711
|
+
readOnly: readOnly || disabled,
|
|
709
712
|
autoFocus: autoFocus,
|
|
710
713
|
autoComplete: autoComplete,
|
|
711
714
|
ref: forwardedRef
|
|
@@ -723,12 +726,10 @@ const styles$2 = StyleSheet.create({
|
|
|
723
726
|
input: {
|
|
724
727
|
width: "100%",
|
|
725
728
|
height: 40,
|
|
726
|
-
borderRadius:
|
|
729
|
+
borderRadius: border.radius.medium_4,
|
|
727
730
|
boxSizing: "border-box",
|
|
728
731
|
paddingLeft: spacing.medium_16,
|
|
729
|
-
margin: 0
|
|
730
|
-
outline: "none",
|
|
731
|
-
boxShadow: "none"
|
|
732
|
+
margin: 0
|
|
732
733
|
},
|
|
733
734
|
default: {
|
|
734
735
|
background: color.white,
|
|
@@ -738,12 +739,23 @@ const styles$2 = StyleSheet.create({
|
|
|
738
739
|
color: color.offBlack64
|
|
739
740
|
}
|
|
740
741
|
},
|
|
742
|
+
defaultFocus: {
|
|
743
|
+
":focus-visible": {
|
|
744
|
+
borderColor: color.blue,
|
|
745
|
+
outline: `1px solid ${color.blue}`,
|
|
746
|
+
outlineOffset: "-2px"
|
|
747
|
+
}
|
|
748
|
+
},
|
|
741
749
|
error: {
|
|
742
750
|
background: color.fadedRed8,
|
|
743
751
|
border: `1px solid ${color.red}`,
|
|
744
752
|
color: color.offBlack,
|
|
745
753
|
"::placeholder": {
|
|
746
754
|
color: color.offBlack64
|
|
755
|
+
},
|
|
756
|
+
":focus-visible": {
|
|
757
|
+
outlineColor: color.red,
|
|
758
|
+
borderColor: color.red
|
|
747
759
|
}
|
|
748
760
|
},
|
|
749
761
|
disabled: {
|
|
@@ -751,22 +763,56 @@ const styles$2 = StyleSheet.create({
|
|
|
751
763
|
border: `1px solid ${color.offBlack16}`,
|
|
752
764
|
color: color.offBlack64,
|
|
753
765
|
"::placeholder": {
|
|
754
|
-
color: color.
|
|
766
|
+
color: color.offBlack64
|
|
767
|
+
},
|
|
768
|
+
cursor: "not-allowed",
|
|
769
|
+
":focus-visible": {
|
|
770
|
+
outline: `2px solid ${color.offBlack32}`,
|
|
771
|
+
outlineOffset: "-3px"
|
|
755
772
|
}
|
|
756
773
|
},
|
|
757
|
-
|
|
774
|
+
light: {
|
|
758
775
|
background: color.white,
|
|
759
|
-
border: `1px solid ${color.
|
|
776
|
+
border: `1px solid ${color.offBlack16}`,
|
|
760
777
|
color: color.offBlack,
|
|
761
778
|
"::placeholder": {
|
|
762
779
|
color: color.offBlack64
|
|
763
780
|
}
|
|
764
781
|
},
|
|
765
|
-
|
|
766
|
-
|
|
782
|
+
lightFocus: {
|
|
783
|
+
":focus-visible": {
|
|
784
|
+
outline: `3px solid ${color.blue}`,
|
|
785
|
+
outlineOffset: "-4px",
|
|
786
|
+
borderColor: color.white
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
lightDisabled: {
|
|
790
|
+
backgroundColor: "transparent",
|
|
791
|
+
border: `1px solid ${color.white32}`,
|
|
792
|
+
color: color.white64,
|
|
793
|
+
"::placeholder": {
|
|
794
|
+
color: color.white64
|
|
795
|
+
},
|
|
796
|
+
cursor: "not-allowed",
|
|
797
|
+
":focus-visible": {
|
|
798
|
+
borderColor: mix(color.white32, color.blue),
|
|
799
|
+
outline: `3px solid ${color.fadedBlue}`,
|
|
800
|
+
outlineOffset: "-4px"
|
|
801
|
+
}
|
|
767
802
|
},
|
|
768
|
-
|
|
769
|
-
|
|
803
|
+
lightError: {
|
|
804
|
+
background: color.fadedRed8,
|
|
805
|
+
border: `1px solid ${color.white}`,
|
|
806
|
+
outline: `2px solid ${color.red}`,
|
|
807
|
+
outlineOffset: "-3px",
|
|
808
|
+
color: color.offBlack,
|
|
809
|
+
"::placeholder": {
|
|
810
|
+
color: color.offBlack64
|
|
811
|
+
},
|
|
812
|
+
":focus-visible": {
|
|
813
|
+
outline: `3px solid ${color.red}`,
|
|
814
|
+
outlineOffset: "-4px"
|
|
815
|
+
}
|
|
770
816
|
}
|
|
771
817
|
});
|
|
772
818
|
var TextField$1 = React.forwardRef((props, ref) => React.createElement(TextField, _extends({}, props, {
|
|
@@ -1062,7 +1108,7 @@ const TextArea = React.forwardRef(function TextArea(props, ref) {
|
|
|
1062
1108
|
"data-testid": testId,
|
|
1063
1109
|
ref: ref,
|
|
1064
1110
|
className: className,
|
|
1065
|
-
style: [
|
|
1111
|
+
style: [getStyles(), style],
|
|
1066
1112
|
value: value,
|
|
1067
1113
|
onChange: handleChange,
|
|
1068
1114
|
placeholder: placeholder,
|
|
@@ -1106,7 +1152,7 @@ const styles = StyleSheet.create({
|
|
|
1106
1152
|
":focus-visible": {
|
|
1107
1153
|
borderColor: color.blue,
|
|
1108
1154
|
outline: `1px solid ${color.blue}`,
|
|
1109
|
-
outlineOffset:
|
|
1155
|
+
outlineOffset: "-2px"
|
|
1110
1156
|
}
|
|
1111
1157
|
},
|
|
1112
1158
|
disabled: {
|
|
@@ -1118,8 +1164,8 @@ const styles = StyleSheet.create({
|
|
|
1118
1164
|
},
|
|
1119
1165
|
cursor: "not-allowed",
|
|
1120
1166
|
":focus-visible": {
|
|
1121
|
-
outline:
|
|
1122
|
-
|
|
1167
|
+
outline: `2px solid ${color.offBlack32}`,
|
|
1168
|
+
outlineOffset: "-3px"
|
|
1123
1169
|
}
|
|
1124
1170
|
},
|
|
1125
1171
|
error: {
|
|
@@ -1144,10 +1190,9 @@ const styles = StyleSheet.create({
|
|
|
1144
1190
|
},
|
|
1145
1191
|
lightFocus: {
|
|
1146
1192
|
":focus-visible": {
|
|
1147
|
-
outline: `
|
|
1148
|
-
outlineOffset:
|
|
1149
|
-
borderColor: color.
|
|
1150
|
-
boxShadow: `0px 0px 0px 2px ${color.blue}, 0px 0px 0px 3px ${color.white}`
|
|
1193
|
+
outline: `3px solid ${color.blue}`,
|
|
1194
|
+
outlineOffset: "-4px",
|
|
1195
|
+
borderColor: color.white
|
|
1151
1196
|
}
|
|
1152
1197
|
},
|
|
1153
1198
|
lightDisabled: {
|
|
@@ -1160,22 +1205,22 @@ const styles = StyleSheet.create({
|
|
|
1160
1205
|
cursor: "not-allowed",
|
|
1161
1206
|
":focus-visible": {
|
|
1162
1207
|
borderColor: mix(color.white32, color.blue),
|
|
1163
|
-
outline:
|
|
1164
|
-
|
|
1208
|
+
outline: `3px solid ${color.fadedBlue}`,
|
|
1209
|
+
outlineOffset: "-4px"
|
|
1165
1210
|
}
|
|
1166
1211
|
},
|
|
1167
1212
|
lightError: {
|
|
1168
1213
|
background: color.fadedRed8,
|
|
1169
|
-
border: `1px solid ${color.
|
|
1170
|
-
|
|
1214
|
+
border: `1px solid ${color.white}`,
|
|
1215
|
+
outline: `2px solid ${color.red}`,
|
|
1216
|
+
outlineOffset: "-3px",
|
|
1171
1217
|
color: color.offBlack,
|
|
1172
1218
|
"::placeholder": {
|
|
1173
1219
|
color: color.offBlack64
|
|
1174
1220
|
},
|
|
1175
1221
|
":focus-visible": {
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
boxShadow: `0px 0px 0px 2px ${color.red}, 0px 0px 0px 3px ${color.white}`
|
|
1222
|
+
outline: `3px solid ${color.red}`,
|
|
1223
|
+
outlineOffset: "-4px"
|
|
1179
1224
|
}
|
|
1180
1225
|
}
|
|
1181
1226
|
});
|
package/dist/index.js
CHANGED
|
@@ -622,15 +622,14 @@ 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", "
|
|
625
|
+
const _excluded$2 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "light", "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
|
|
633
|
-
focused: false
|
|
632
|
+
error: null
|
|
634
633
|
};
|
|
635
634
|
this.maybeValidate = newValue => {
|
|
636
635
|
const {
|
|
@@ -671,25 +670,30 @@ class TextField extends React__namespace.Component {
|
|
|
671
670
|
const {
|
|
672
671
|
onFocus
|
|
673
672
|
} = this.props;
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
}
|
|
677
|
-
if (onFocus) {
|
|
678
|
-
onFocus(event);
|
|
679
|
-
}
|
|
680
|
-
});
|
|
673
|
+
if (onFocus) {
|
|
674
|
+
onFocus(event);
|
|
675
|
+
}
|
|
681
676
|
};
|
|
682
677
|
this.handleBlur = event => {
|
|
683
678
|
const {
|
|
684
679
|
onBlur
|
|
685
680
|
} = this.props;
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
681
|
+
if (onBlur) {
|
|
682
|
+
onBlur(event);
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
this.getStyles = () => {
|
|
686
|
+
const {
|
|
687
|
+
disabled,
|
|
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)];
|
|
693
697
|
};
|
|
694
698
|
if (props.validate && props.value !== "") {
|
|
695
699
|
this.state.error = props.validate(props.value) || null;
|
|
@@ -710,7 +714,6 @@ class TextField extends React__namespace.Component {
|
|
|
710
714
|
disabled,
|
|
711
715
|
onKeyDown,
|
|
712
716
|
placeholder,
|
|
713
|
-
light,
|
|
714
717
|
style,
|
|
715
718
|
testId,
|
|
716
719
|
readOnly,
|
|
@@ -723,19 +726,19 @@ class TextField extends React__namespace.Component {
|
|
|
723
726
|
id: id,
|
|
724
727
|
scope: "text-field"
|
|
725
728
|
}, uniqueId => React__namespace.createElement(StyledInput, _extends__default["default"]({
|
|
726
|
-
style: [
|
|
729
|
+
style: [this.getStyles(), style],
|
|
727
730
|
id: uniqueId,
|
|
728
731
|
type: type,
|
|
729
732
|
placeholder: placeholder,
|
|
730
733
|
value: value,
|
|
731
734
|
name: name,
|
|
732
|
-
disabled: disabled,
|
|
735
|
+
"aria-disabled": disabled,
|
|
733
736
|
onChange: this.handleChange,
|
|
734
|
-
onKeyDown: onKeyDown,
|
|
737
|
+
onKeyDown: disabled ? undefined : onKeyDown,
|
|
735
738
|
onFocus: this.handleFocus,
|
|
736
739
|
onBlur: this.handleBlur,
|
|
737
740
|
"data-testid": testId,
|
|
738
|
-
readOnly: readOnly,
|
|
741
|
+
readOnly: readOnly || disabled,
|
|
739
742
|
autoFocus: autoFocus,
|
|
740
743
|
autoComplete: autoComplete,
|
|
741
744
|
ref: forwardedRef
|
|
@@ -753,12 +756,10 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
753
756
|
input: {
|
|
754
757
|
width: "100%",
|
|
755
758
|
height: 40,
|
|
756
|
-
borderRadius:
|
|
759
|
+
borderRadius: wonderBlocksTokens.border.radius.medium_4,
|
|
757
760
|
boxSizing: "border-box",
|
|
758
761
|
paddingLeft: wonderBlocksTokens.spacing.medium_16,
|
|
759
|
-
margin: 0
|
|
760
|
-
outline: "none",
|
|
761
|
-
boxShadow: "none"
|
|
762
|
+
margin: 0
|
|
762
763
|
},
|
|
763
764
|
default: {
|
|
764
765
|
background: wonderBlocksTokens.color.white,
|
|
@@ -768,12 +769,23 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
768
769
|
color: wonderBlocksTokens.color.offBlack64
|
|
769
770
|
}
|
|
770
771
|
},
|
|
772
|
+
defaultFocus: {
|
|
773
|
+
":focus-visible": {
|
|
774
|
+
borderColor: wonderBlocksTokens.color.blue,
|
|
775
|
+
outline: `1px solid ${wonderBlocksTokens.color.blue}`,
|
|
776
|
+
outlineOffset: "-2px"
|
|
777
|
+
}
|
|
778
|
+
},
|
|
771
779
|
error: {
|
|
772
780
|
background: wonderBlocksTokens.color.fadedRed8,
|
|
773
781
|
border: `1px solid ${wonderBlocksTokens.color.red}`,
|
|
774
782
|
color: wonderBlocksTokens.color.offBlack,
|
|
775
783
|
"::placeholder": {
|
|
776
784
|
color: wonderBlocksTokens.color.offBlack64
|
|
785
|
+
},
|
|
786
|
+
":focus-visible": {
|
|
787
|
+
outlineColor: wonderBlocksTokens.color.red,
|
|
788
|
+
borderColor: wonderBlocksTokens.color.red
|
|
777
789
|
}
|
|
778
790
|
},
|
|
779
791
|
disabled: {
|
|
@@ -781,22 +793,56 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
781
793
|
border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
782
794
|
color: wonderBlocksTokens.color.offBlack64,
|
|
783
795
|
"::placeholder": {
|
|
784
|
-
color: wonderBlocksTokens.color.
|
|
796
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
797
|
+
},
|
|
798
|
+
cursor: "not-allowed",
|
|
799
|
+
":focus-visible": {
|
|
800
|
+
outline: `2px solid ${wonderBlocksTokens.color.offBlack32}`,
|
|
801
|
+
outlineOffset: "-3px"
|
|
785
802
|
}
|
|
786
803
|
},
|
|
787
|
-
|
|
804
|
+
light: {
|
|
788
805
|
background: wonderBlocksTokens.color.white,
|
|
789
|
-
border: `1px solid ${wonderBlocksTokens.color.
|
|
806
|
+
border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
790
807
|
color: wonderBlocksTokens.color.offBlack,
|
|
791
808
|
"::placeholder": {
|
|
792
809
|
color: wonderBlocksTokens.color.offBlack64
|
|
793
810
|
}
|
|
794
811
|
},
|
|
795
|
-
|
|
796
|
-
|
|
812
|
+
lightFocus: {
|
|
813
|
+
":focus-visible": {
|
|
814
|
+
outline: `3px solid ${wonderBlocksTokens.color.blue}`,
|
|
815
|
+
outlineOffset: "-4px",
|
|
816
|
+
borderColor: wonderBlocksTokens.color.white
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
lightDisabled: {
|
|
820
|
+
backgroundColor: "transparent",
|
|
821
|
+
border: `1px solid ${wonderBlocksTokens.color.white32}`,
|
|
822
|
+
color: wonderBlocksTokens.color.white64,
|
|
823
|
+
"::placeholder": {
|
|
824
|
+
color: wonderBlocksTokens.color.white64
|
|
825
|
+
},
|
|
826
|
+
cursor: "not-allowed",
|
|
827
|
+
":focus-visible": {
|
|
828
|
+
borderColor: wonderBlocksTokens.mix(wonderBlocksTokens.color.white32, wonderBlocksTokens.color.blue),
|
|
829
|
+
outline: `3px solid ${wonderBlocksTokens.color.fadedBlue}`,
|
|
830
|
+
outlineOffset: "-4px"
|
|
831
|
+
}
|
|
797
832
|
},
|
|
798
|
-
|
|
799
|
-
|
|
833
|
+
lightError: {
|
|
834
|
+
background: wonderBlocksTokens.color.fadedRed8,
|
|
835
|
+
border: `1px solid ${wonderBlocksTokens.color.white}`,
|
|
836
|
+
outline: `2px solid ${wonderBlocksTokens.color.red}`,
|
|
837
|
+
outlineOffset: "-3px",
|
|
838
|
+
color: wonderBlocksTokens.color.offBlack,
|
|
839
|
+
"::placeholder": {
|
|
840
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
841
|
+
},
|
|
842
|
+
":focus-visible": {
|
|
843
|
+
outline: `3px solid ${wonderBlocksTokens.color.red}`,
|
|
844
|
+
outlineOffset: "-4px"
|
|
845
|
+
}
|
|
800
846
|
}
|
|
801
847
|
});
|
|
802
848
|
var TextField$1 = React__namespace.forwardRef((props, ref) => React__namespace.createElement(TextField, _extends__default["default"]({}, props, {
|
|
@@ -1092,7 +1138,7 @@ const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
|
|
|
1092
1138
|
"data-testid": testId,
|
|
1093
1139
|
ref: ref,
|
|
1094
1140
|
className: className,
|
|
1095
|
-
style: [
|
|
1141
|
+
style: [getStyles(), style],
|
|
1096
1142
|
value: value,
|
|
1097
1143
|
onChange: handleChange,
|
|
1098
1144
|
placeholder: placeholder,
|
|
@@ -1136,7 +1182,7 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
1136
1182
|
":focus-visible": {
|
|
1137
1183
|
borderColor: wonderBlocksTokens.color.blue,
|
|
1138
1184
|
outline: `1px solid ${wonderBlocksTokens.color.blue}`,
|
|
1139
|
-
outlineOffset:
|
|
1185
|
+
outlineOffset: "-2px"
|
|
1140
1186
|
}
|
|
1141
1187
|
},
|
|
1142
1188
|
disabled: {
|
|
@@ -1148,8 +1194,8 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
1148
1194
|
},
|
|
1149
1195
|
cursor: "not-allowed",
|
|
1150
1196
|
":focus-visible": {
|
|
1151
|
-
outline:
|
|
1152
|
-
|
|
1197
|
+
outline: `2px solid ${wonderBlocksTokens.color.offBlack32}`,
|
|
1198
|
+
outlineOffset: "-3px"
|
|
1153
1199
|
}
|
|
1154
1200
|
},
|
|
1155
1201
|
error: {
|
|
@@ -1174,10 +1220,9 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
1174
1220
|
},
|
|
1175
1221
|
lightFocus: {
|
|
1176
1222
|
":focus-visible": {
|
|
1177
|
-
outline: `
|
|
1178
|
-
outlineOffset:
|
|
1179
|
-
borderColor: wonderBlocksTokens.color.
|
|
1180
|
-
boxShadow: `0px 0px 0px 2px ${wonderBlocksTokens.color.blue}, 0px 0px 0px 3px ${wonderBlocksTokens.color.white}`
|
|
1223
|
+
outline: `3px solid ${wonderBlocksTokens.color.blue}`,
|
|
1224
|
+
outlineOffset: "-4px",
|
|
1225
|
+
borderColor: wonderBlocksTokens.color.white
|
|
1181
1226
|
}
|
|
1182
1227
|
},
|
|
1183
1228
|
lightDisabled: {
|
|
@@ -1190,22 +1235,22 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
1190
1235
|
cursor: "not-allowed",
|
|
1191
1236
|
":focus-visible": {
|
|
1192
1237
|
borderColor: wonderBlocksTokens.mix(wonderBlocksTokens.color.white32, wonderBlocksTokens.color.blue),
|
|
1193
|
-
outline:
|
|
1194
|
-
|
|
1238
|
+
outline: `3px solid ${wonderBlocksTokens.color.fadedBlue}`,
|
|
1239
|
+
outlineOffset: "-4px"
|
|
1195
1240
|
}
|
|
1196
1241
|
},
|
|
1197
1242
|
lightError: {
|
|
1198
1243
|
background: wonderBlocksTokens.color.fadedRed8,
|
|
1199
|
-
border: `1px solid ${wonderBlocksTokens.color.
|
|
1200
|
-
|
|
1244
|
+
border: `1px solid ${wonderBlocksTokens.color.white}`,
|
|
1245
|
+
outline: `2px solid ${wonderBlocksTokens.color.red}`,
|
|
1246
|
+
outlineOffset: "-3px",
|
|
1201
1247
|
color: wonderBlocksTokens.color.offBlack,
|
|
1202
1248
|
"::placeholder": {
|
|
1203
1249
|
color: wonderBlocksTokens.color.offBlack64
|
|
1204
1250
|
},
|
|
1205
1251
|
":focus-visible": {
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
boxShadow: `0px 0px 0px 2px ${wonderBlocksTokens.color.red}, 0px 0px 0px 3px ${wonderBlocksTokens.color.white}`
|
|
1252
|
+
outline: `3px solid ${wonderBlocksTokens.color.red}`,
|
|
1253
|
+
outlineOffset: "-4px"
|
|
1209
1254
|
}
|
|
1210
1255
|
}
|
|
1211
1256
|
});
|