@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/dist/es/index.js CHANGED
@@ -2,15 +2,15 @@ import _extends from '@babel/runtime/helpers/extends';
2
2
  import * as React from 'react';
3
3
  import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
4
4
  import { StyleSheet } from 'aphrodite';
5
- import { addStyle, UniqueIDProvider, View, IDProvider } from '@khanacademy/wonder-blocks-core';
5
+ import { addStyle, UniqueIDProvider, View, IDProvider, useUniqueIdWithMock, useOnMountEffect } from '@khanacademy/wonder-blocks-core';
6
6
  import { Strut } from '@khanacademy/wonder-blocks-layout';
7
- import { spacing, mix, color } from '@khanacademy/wonder-blocks-tokens';
8
- import { LabelMedium, LabelSmall, styles as styles$6 } from '@khanacademy/wonder-blocks-typography';
7
+ import { spacing, mix, color, border } from '@khanacademy/wonder-blocks-tokens';
8
+ import { LabelMedium, LabelSmall, styles as styles$7 } from '@khanacademy/wonder-blocks-typography';
9
9
  import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
10
10
  import checkIcon from '@phosphor-icons/core/bold/check-bold.svg';
11
11
  import minusIcon from '@phosphor-icons/core/bold/minus-bold.svg';
12
12
 
13
- const _excluded$6 = ["checked", "disabled", "error", "groupName", "id", "testId"];
13
+ const _excluded$7 = ["checked", "disabled", "error", "groupName", "id", "testId"];
14
14
  function mapCheckedToAriaChecked(value) {
15
15
  switch (value) {
16
16
  case true:
@@ -42,7 +42,7 @@ const CheckboxCore = React.forwardRef(function CheckboxCore(props, ref) {
42
42
  id,
43
43
  testId
44
44
  } = props,
45
- sharedProps = _objectWithoutPropertiesLoose(props, _excluded$6);
45
+ sharedProps = _objectWithoutPropertiesLoose(props, _excluded$7);
46
46
  const innerRef = React.useRef(null);
47
47
  React.useEffect(() => {
48
48
  if (innerRef.current != null) {
@@ -131,11 +131,11 @@ const colors$1 = {
131
131
  active: activeRed
132
132
  }
133
133
  };
134
- const styles$5 = {};
134
+ const styles$6 = {};
135
135
  const _generateStyles$1 = (checked, error) => {
136
136
  const styleKey = `${String(checked)}-${String(error)}`;
137
- if (styles$5[styleKey]) {
138
- return styles$5[styleKey];
137
+ if (styles$6[styleKey]) {
138
+ return styles$6[styleKey];
139
139
  }
140
140
  const palette = error ? colors$1.error : colors$1.default;
141
141
  let newStyles = {};
@@ -179,11 +179,11 @@ const _generateStyles$1 = (checked, error) => {
179
179
  }
180
180
  };
181
181
  }
182
- styles$5[styleKey] = StyleSheet.create(newStyles);
183
- return styles$5[styleKey];
182
+ styles$6[styleKey] = StyleSheet.create(newStyles);
183
+ return styles$6[styleKey];
184
184
  };
185
185
 
186
- const _excluded$5 = ["checked", "disabled", "error", "groupName", "id", "testId"];
186
+ const _excluded$6 = ["checked", "disabled", "error", "groupName", "id", "testId"];
187
187
  const {
188
188
  blue,
189
189
  red,
@@ -206,7 +206,7 @@ const RadioCore = React.forwardRef(function RadioCore(props, ref) {
206
206
  id,
207
207
  testId
208
208
  } = props,
209
- sharedProps = _objectWithoutPropertiesLoose(props, _excluded$5);
209
+ sharedProps = _objectWithoutPropertiesLoose(props, _excluded$6);
210
210
  const stateStyles = _generateStyles(checked, error);
211
211
  const defaultStyle = [sharedStyles.inputReset, sharedStyles.default, !disabled && stateStyles.default, disabled && sharedStyles.disabled];
212
212
  return React.createElement(React.Fragment, null, React.createElement(StyledInput$1, _extends({}, sharedProps, {
@@ -273,11 +273,11 @@ const colors = {
273
273
  active: color.activeRed
274
274
  }
275
275
  };
276
- const styles$4 = {};
276
+ const styles$5 = {};
277
277
  const _generateStyles = (checked, error) => {
278
278
  const styleKey = `${String(checked)}-${String(error)}`;
279
- if (styles$4[styleKey]) {
280
- return styles$4[styleKey];
279
+ if (styles$5[styleKey]) {
280
+ return styles$5[styleKey];
281
281
  }
282
282
  const palette = error ? colors.error : colors.default;
283
283
  let newStyles = {};
@@ -322,11 +322,11 @@ const _generateStyles = (checked, error) => {
322
322
  }
323
323
  };
324
324
  }
325
- styles$4[styleKey] = StyleSheet.create(newStyles);
326
- return styles$4[styleKey];
325
+ styles$5[styleKey] = StyleSheet.create(newStyles);
326
+ return styles$5[styleKey];
327
327
  };
328
328
 
329
- const _excluded$4 = ["checked", "description", "disabled", "error", "id", "label", "onChange", "style", "className", "variant"];
329
+ const _excluded$5 = ["checked", "description", "disabled", "error", "id", "label", "onChange", "style", "className", "variant"];
330
330
  const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
331
331
  const {
332
332
  checked,
@@ -340,7 +340,7 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
340
340
  className,
341
341
  variant
342
342
  } = props,
343
- coreProps = _objectWithoutPropertiesLoose(props, _excluded$4);
343
+ coreProps = _objectWithoutPropertiesLoose(props, _excluded$5);
344
344
  const handleClick = () => {
345
345
  if (variant === "radio" && checked) {
346
346
  return;
@@ -356,14 +356,14 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
356
356
  };
357
357
  const getLabel = id => {
358
358
  return React.createElement(LabelMedium, {
359
- style: [styles$3.label, disabled && styles$3.disabledLabel]
359
+ style: [styles$4.label, disabled && styles$4.disabledLabel]
360
360
  }, React.createElement("label", {
361
361
  htmlFor: id
362
362
  }, label));
363
363
  };
364
364
  const getDescription = id => {
365
365
  return React.createElement(LabelSmall, {
366
- style: styles$3.description,
366
+ style: styles$4.description,
367
367
  id: id
368
368
  }, description);
369
369
  };
@@ -378,7 +378,7 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
378
378
  style: style,
379
379
  className: className
380
380
  }, React.createElement(View, {
381
- style: styles$3.wrapper,
381
+ style: styles$4.wrapper,
382
382
  tabIndex: -1
383
383
  }, React.createElement(ChoiceCore, _extends({}, coreProps, {
384
384
  id: uniqueId,
@@ -393,7 +393,7 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
393
393
  }), label && getLabel(uniqueId)), description && getDescription(descriptionId));
394
394
  });
395
395
  });
396
- const styles$3 = StyleSheet.create({
396
+ const styles$4 = StyleSheet.create({
397
397
  wrapper: {
398
398
  flexDirection: "row",
399
399
  alignItems: "flex-start",
@@ -425,13 +425,13 @@ const Checkbox = React.forwardRef(function Checkbox(props, ref) {
425
425
  }));
426
426
  });
427
427
 
428
- const _excluded$3 = ["disabled", "error"];
428
+ const _excluded$4 = ["disabled", "error"];
429
429
  const Radio = React.forwardRef(function Radio(props, ref) {
430
430
  const {
431
431
  disabled = false,
432
432
  error = false
433
433
  } = props,
434
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
434
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$4);
435
435
  return React.createElement(ChoiceInternal, _extends({}, otherProps, {
436
436
  variant: "radio",
437
437
  disabled: disabled,
@@ -440,7 +440,7 @@ const Radio = React.forwardRef(function Radio(props, ref) {
440
440
  }));
441
441
  });
442
442
 
443
- const _excluded$2 = ["checked", "disabled", "onChange", "value", "variant"];
443
+ const _excluded$3 = ["checked", "disabled", "onChange", "value", "variant"];
444
444
  const Choice = React.forwardRef(function Choice(props, ref) {
445
445
  const {
446
446
  checked = false,
@@ -448,7 +448,7 @@ const Choice = React.forwardRef(function Choice(props, ref) {
448
448
  onChange = () => {},
449
449
  variant
450
450
  } = props,
451
- remainingProps = _objectWithoutPropertiesLoose(props, _excluded$2);
451
+ remainingProps = _objectWithoutPropertiesLoose(props, _excluded$3);
452
452
  const getChoiceComponent = variant => {
453
453
  if (variant === "checkbox") {
454
454
  return Checkbox;
@@ -465,7 +465,7 @@ const Choice = React.forwardRef(function Choice(props, ref) {
465
465
  }));
466
466
  });
467
467
 
468
- const styles$2 = StyleSheet.create({
468
+ const styles$3 = StyleSheet.create({
469
469
  fieldset: {
470
470
  border: "none",
471
471
  padding: 0,
@@ -513,16 +513,16 @@ const CheckboxGroup = React.forwardRef(function CheckboxGroup(props, ref) {
513
513
  const allChildren = React.Children.toArray(children).filter(Boolean);
514
514
  return React.createElement(StyledFieldset$1, {
515
515
  "data-testid": testId,
516
- style: styles$2.fieldset,
516
+ style: styles$3.fieldset,
517
517
  ref: ref
518
518
  }, React.createElement(View, {
519
519
  style: style
520
520
  }, label && React.createElement(StyledLegend$1, {
521
- style: styles$2.legend
521
+ style: styles$3.legend
522
522
  }, React.createElement(LabelMedium, null, label)), description && React.createElement(LabelSmall, {
523
- style: styles$2.description
523
+ style: styles$3.description
524
524
  }, description), errorMessage && React.createElement(LabelSmall, {
525
- style: styles$2.error
525
+ style: styles$3.error
526
526
  }, errorMessage), (label || description || errorMessage) && React.createElement(Strut, {
527
527
  size: spacing.small_12
528
528
  }), allChildren.map((child, index) => {
@@ -538,7 +538,7 @@ const CheckboxGroup = React.forwardRef(function CheckboxGroup(props, ref) {
538
538
  id: `${groupName}-${value}`,
539
539
  key: value,
540
540
  onChange: () => handleChange(value, checked),
541
- style: [index > 0 && styles$2.defaultLineGap, style],
541
+ style: [index > 0 && styles$3.defaultLineGap, style],
542
542
  variant: "checkbox"
543
543
  });
544
544
  })));
@@ -561,16 +561,16 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
561
561
  const allChildren = React.Children.toArray(children).filter(Boolean);
562
562
  return React.createElement(StyledFieldset, {
563
563
  "data-testid": testId,
564
- style: styles$2.fieldset,
564
+ style: styles$3.fieldset,
565
565
  ref: ref
566
566
  }, React.createElement(View, {
567
567
  style: style
568
568
  }, label && React.createElement(StyledLegend, {
569
- style: styles$2.legend
569
+ style: styles$3.legend
570
570
  }, React.createElement(LabelMedium, null, label)), description && React.createElement(LabelSmall, {
571
- style: styles$2.description
571
+ style: styles$3.description
572
572
  }, description), errorMessage && React.createElement(LabelSmall, {
573
- style: styles$2.error
573
+ style: styles$3.error
574
574
  }, errorMessage), (label || description || errorMessage) && React.createElement(Strut, {
575
575
  size: spacing.small_12
576
576
  }), allChildren.map((child, index) => {
@@ -586,14 +586,14 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
586
586
  id: `${groupName}-${value}`,
587
587
  key: value,
588
588
  onChange: () => onChange(value),
589
- style: [index > 0 && styles$2.defaultLineGap, style],
589
+ style: [index > 0 && styles$3.defaultLineGap, style],
590
590
  variant: "radio"
591
591
  });
592
592
  })));
593
593
  });
594
594
 
595
- const _excluded$1 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
596
- const defaultErrorMessage = "This field is required.";
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
+ const defaultErrorMessage$1 = "This field is required.";
597
597
  const StyledInput = addStyle("input");
598
598
  class TextField extends React.Component {
599
599
  constructor(props) {
@@ -618,7 +618,7 @@ class TextField extends React.Component {
618
618
  }
619
619
  });
620
620
  } else if (required) {
621
- const requiredString = typeof required === "string" ? required : defaultErrorMessage;
621
+ const requiredString = typeof required === "string" ? required : defaultErrorMessage$1;
622
622
  const maybeError = newValue ? null : requiredString;
623
623
  this.setState({
624
624
  error: maybeError
@@ -688,12 +688,12 @@ class TextField extends React.Component {
688
688
  autoComplete,
689
689
  forwardedRef
690
690
  } = _this$props,
691
- otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
691
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
692
692
  return React.createElement(IDProvider, {
693
693
  id: id,
694
694
  scope: "text-field"
695
695
  }, uniqueId => React.createElement(StyledInput, _extends({
696
- style: [styles$1.input, styles$6.LabelMedium, styles$1.default, disabled ? styles$1.disabled : this.state.focused ? [styles$1.focused, light && styles$1.defaultLight] : !!this.state.error && [styles$1.error, light && styles$1.errorLight], !!this.state.error && styles$1.error, style && style],
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],
697
697
  id: uniqueId,
698
698
  type: type,
699
699
  placeholder: placeholder,
@@ -719,7 +719,7 @@ TextField.defaultProps = {
719
719
  disabled: false,
720
720
  light: false
721
721
  };
722
- const styles$1 = StyleSheet.create({
722
+ const styles$2 = StyleSheet.create({
723
723
  input: {
724
724
  width: "100%",
725
725
  height: 40,
@@ -783,11 +783,11 @@ class FieldHeading extends React.Component {
783
783
  testId
784
784
  } = this.props;
785
785
  const requiredIcon = React.createElement(StyledSpan, {
786
- style: styles.required,
786
+ style: styles$1.required,
787
787
  "aria-hidden": true
788
788
  }, " ", "*");
789
789
  return React.createElement(React.Fragment, null, React.createElement(LabelMedium, {
790
- style: styles.label,
790
+ style: styles$1.label,
791
791
  tag: "label",
792
792
  htmlFor: id && `${id}-field`,
793
793
  testId: testId && `${testId}-label`
@@ -804,7 +804,7 @@ class FieldHeading extends React.Component {
804
804
  return null;
805
805
  }
806
806
  return React.createElement(React.Fragment, null, React.createElement(LabelSmall, {
807
- style: styles.description,
807
+ style: styles$1.description,
808
808
  testId: testId && `${testId}-description`
809
809
  }, description), React.createElement(Strut, {
810
810
  size: spacing.xxxSmall_4
@@ -822,7 +822,7 @@ class FieldHeading extends React.Component {
822
822
  return React.createElement(React.Fragment, null, React.createElement(Strut, {
823
823
  size: spacing.small_12
824
824
  }), React.createElement(LabelSmall, {
825
- style: styles.error,
825
+ style: styles$1.error,
826
826
  role: "alert",
827
827
  id: id && `${id}-error`,
828
828
  testId: testId && `${testId}-error`
@@ -840,7 +840,7 @@ class FieldHeading extends React.Component {
840
840
  }), field, this.maybeRenderError());
841
841
  }
842
842
  }
843
- const styles = StyleSheet.create({
843
+ const styles$1 = StyleSheet.create({
844
844
  label: {
845
845
  color: color.offBlack
846
846
  },
@@ -855,7 +855,7 @@ const styles = StyleSheet.create({
855
855
  }
856
856
  });
857
857
 
858
- const _excluded = ["id", "type", "label", "description", "value", "disabled", "required", "validate", "onChange", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoComplete", "forwardedRef", "ariaDescribedby", "onValidate", "onFocus", "onBlur"];
858
+ const _excluded$1 = ["id", "type", "label", "description", "value", "disabled", "required", "validate", "onChange", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoComplete", "forwardedRef", "ariaDescribedby", "onValidate", "onFocus", "onBlur"];
859
859
  class LabeledTextField extends React.Component {
860
860
  constructor(props) {
861
861
  super(props);
@@ -922,7 +922,7 @@ class LabeledTextField extends React.Component {
922
922
  forwardedRef,
923
923
  ariaDescribedby
924
924
  } = _this$props,
925
- otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
925
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
926
926
  return React.createElement(IDProvider, {
927
927
  id: id,
928
928
  scope: "labeled-text-field"
@@ -967,4 +967,213 @@ var labeledTextField = React.forwardRef((props, ref) => React.createElement(Labe
967
967
  forwardedRef: ref
968
968
  })));
969
969
 
970
- export { Checkbox, CheckboxGroup, Choice, labeledTextField as LabeledTextField, RadioGroup, TextField$1 as TextField };
970
+ const _excluded = ["onChange", "value", "placeholder", "disabled", "id", "testId", "style", "readOnly", "autoComplete", "name", "className", "autoFocus", "rows", "spellCheck", "wrap", "minLength", "maxLength", "onClick", "onKeyDown", "onKeyUp", "onFocus", "onBlur", "validate", "onValidate", "required", "resizeType", "light"];
971
+ const defaultErrorMessage = "This field is required.";
972
+ const StyledTextArea = addStyle("textarea");
973
+ const TextArea = React.forwardRef(function TextArea(props, ref) {
974
+ const {
975
+ onChange,
976
+ value,
977
+ placeholder,
978
+ disabled,
979
+ id,
980
+ testId,
981
+ style,
982
+ readOnly,
983
+ autoComplete,
984
+ name,
985
+ className,
986
+ autoFocus,
987
+ rows,
988
+ spellCheck,
989
+ wrap,
990
+ minLength,
991
+ maxLength,
992
+ onClick,
993
+ onKeyDown,
994
+ onKeyUp,
995
+ onFocus,
996
+ onBlur,
997
+ validate,
998
+ onValidate,
999
+ required,
1000
+ resizeType,
1001
+ light
1002
+ } = props,
1003
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
1004
+ const [error, setError] = React.useState(null);
1005
+ const ids = useUniqueIdWithMock("text-area");
1006
+ const uniqueId = id != null ? id : ids.get("id");
1007
+ const handleChange = event => {
1008
+ const newValue = event.target.value;
1009
+ onChange(newValue);
1010
+ handleValidation(newValue);
1011
+ };
1012
+ const handleValidation = newValue => {
1013
+ if (validate) {
1014
+ const error = validate(newValue) || null;
1015
+ setError(error);
1016
+ if (onValidate) {
1017
+ onValidate(error);
1018
+ }
1019
+ } else if (required) {
1020
+ const requiredString = typeof required === "string" ? required : defaultErrorMessage;
1021
+ const error = newValue ? null : requiredString;
1022
+ setError(error);
1023
+ if (onValidate) {
1024
+ onValidate(error);
1025
+ }
1026
+ }
1027
+ };
1028
+ useOnMountEffect(() => {
1029
+ if (value !== "") {
1030
+ handleValidation(value);
1031
+ }
1032
+ });
1033
+ const getStyles = () => {
1034
+ const baseStyles = [styles.textarea, styles$7.LabelMedium, resizeType && resizeStyles[resizeType]];
1035
+ const defaultStyles = [styles.default, !disabled && styles.defaultFocus, disabled && styles.disabled, !!error && styles.error];
1036
+ const lightStyles = [styles.light, !disabled && styles.lightFocus, disabled && styles.lightDisabled, !!error && styles.lightError];
1037
+ return [...baseStyles, ...(light ? lightStyles : defaultStyles)];
1038
+ };
1039
+ return React.createElement(View, {
1040
+ style: {
1041
+ width: "100%"
1042
+ }
1043
+ }, React.createElement(StyledTextArea, _extends({
1044
+ id: uniqueId,
1045
+ "data-testid": testId,
1046
+ ref: ref,
1047
+ className: className,
1048
+ style: [...getStyles(), style],
1049
+ value: value,
1050
+ onChange: handleChange,
1051
+ placeholder: placeholder,
1052
+ "aria-disabled": disabled,
1053
+ readOnly: readOnly || disabled,
1054
+ autoComplete: autoComplete,
1055
+ name: name,
1056
+ autoFocus: autoFocus,
1057
+ rows: rows,
1058
+ spellCheck: spellCheck,
1059
+ wrap: wrap,
1060
+ minLength: minLength,
1061
+ maxLength: maxLength,
1062
+ onClick: disabled ? undefined : onClick,
1063
+ onKeyDown: disabled ? undefined : onKeyDown,
1064
+ onKeyUp: disabled ? undefined : onKeyUp,
1065
+ onFocus: onFocus,
1066
+ onBlur: onBlur,
1067
+ required: !!required
1068
+ }, otherProps, {
1069
+ "aria-invalid": !!error
1070
+ })));
1071
+ });
1072
+ const styles = StyleSheet.create({
1073
+ textarea: {
1074
+ borderRadius: border.radius.medium_4,
1075
+ boxSizing: "border-box",
1076
+ padding: `10px ${spacing.medium_16}px`,
1077
+ minHeight: "1em"
1078
+ },
1079
+ default: {
1080
+ background: color.white,
1081
+ border: `1px solid ${color.offBlack50}`,
1082
+ color: color.offBlack,
1083
+ "::placeholder": {
1084
+ color: color.offBlack64
1085
+ }
1086
+ },
1087
+ defaultFocus: {
1088
+ ":focus-visible": {
1089
+ borderColor: color.blue,
1090
+ outline: `1px solid ${color.blue}`,
1091
+ outlineOffset: 0
1092
+ }
1093
+ },
1094
+ disabled: {
1095
+ background: color.offWhite,
1096
+ border: `1px solid ${color.offBlack16}`,
1097
+ color: color.offBlack64,
1098
+ "::placeholder": {
1099
+ color: color.offBlack64
1100
+ },
1101
+ cursor: "not-allowed",
1102
+ ":focus-visible": {
1103
+ outline: "none",
1104
+ boxShadow: `0 0 0 1px ${color.white}, 0 0 0 3px ${color.offBlack32}`
1105
+ }
1106
+ },
1107
+ error: {
1108
+ background: color.fadedRed8,
1109
+ border: `1px solid ${color.red}`,
1110
+ color: color.offBlack,
1111
+ "::placeholder": {
1112
+ color: color.offBlack64
1113
+ },
1114
+ ":focus-visible": {
1115
+ outlineColor: color.red,
1116
+ borderColor: color.red
1117
+ }
1118
+ },
1119
+ light: {
1120
+ background: color.white,
1121
+ border: `1px solid ${color.offBlack16}`,
1122
+ color: color.offBlack,
1123
+ "::placeholder": {
1124
+ color: color.offBlack64
1125
+ }
1126
+ },
1127
+ lightFocus: {
1128
+ ":focus-visible": {
1129
+ outline: `1px solid ${color.blue}`,
1130
+ outlineOffset: 0,
1131
+ borderColor: color.blue,
1132
+ boxShadow: `0px 0px 0px 2px ${color.blue}, 0px 0px 0px 3px ${color.white}`
1133
+ }
1134
+ },
1135
+ lightDisabled: {
1136
+ backgroundColor: "transparent",
1137
+ border: `1px solid ${color.white32}`,
1138
+ color: color.white64,
1139
+ "::placeholder": {
1140
+ color: color.white64
1141
+ },
1142
+ cursor: "not-allowed",
1143
+ ":focus-visible": {
1144
+ borderColor: mix(color.white32, color.blue),
1145
+ outline: "none",
1146
+ boxShadow: `0 0 0 1px ${color.offBlack32}, 0 0 0 3px ${color.fadedBlue}`
1147
+ }
1148
+ },
1149
+ lightError: {
1150
+ background: color.fadedRed8,
1151
+ border: `1px solid ${color.red}`,
1152
+ boxShadow: `0px 0px 0px 1px ${color.red}, 0px 0px 0px 2px ${color.white}`,
1153
+ color: color.offBlack,
1154
+ "::placeholder": {
1155
+ color: color.offBlack64
1156
+ },
1157
+ ":focus-visible": {
1158
+ outlineColor: color.red,
1159
+ borderColor: color.red,
1160
+ boxShadow: `0px 0px 0px 2px ${color.red}, 0px 0px 0px 3px ${color.white}`
1161
+ }
1162
+ }
1163
+ });
1164
+ const resizeStyles = StyleSheet.create({
1165
+ both: {
1166
+ resize: "both"
1167
+ },
1168
+ none: {
1169
+ resize: "none"
1170
+ },
1171
+ horizontal: {
1172
+ resize: "horizontal"
1173
+ },
1174
+ vertical: {
1175
+ resize: "vertical"
1176
+ }
1177
+ });
1178
+
1179
+ export { Checkbox, CheckboxGroup, Choice, labeledTextField as LabeledTextField, RadioGroup, TextArea, TextField$1 as TextField };
package/dist/index.d.ts CHANGED
@@ -4,4 +4,5 @@ import CheckboxGroup from "./components/checkbox-group";
4
4
  import RadioGroup from "./components/radio-group";
5
5
  import TextField from "./components/text-field";
6
6
  import LabeledTextField from "./components/labeled-text-field";
7
- export { Checkbox, Choice, CheckboxGroup, RadioGroup, TextField, LabeledTextField, };
7
+ import TextArea from "./components/text-area";
8
+ export { Checkbox, Choice, CheckboxGroup, RadioGroup, TextField, LabeledTextField, TextArea, };