@khanacademy/wonder-blocks-form 4.7.4 → 4.8.0

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
@@ -1,42 +1,16 @@
1
+ import _extends from '@babel/runtime/helpers/extends';
1
2
  import * as React from 'react';
3
+ import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
2
4
  import { StyleSheet } from 'aphrodite';
3
- import { addStyle, UniqueIDProvider, View, IDProvider } from '@khanacademy/wonder-blocks-core';
5
+ import { addStyle, UniqueIDProvider, View, IDProvider, useUniqueIdWithMock, useOnMountEffect } from '@khanacademy/wonder-blocks-core';
4
6
  import { Strut } from '@khanacademy/wonder-blocks-layout';
5
- import { spacing, mix, color } from '@khanacademy/wonder-blocks-tokens';
6
- 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';
7
9
  import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
8
10
  import checkIcon from '@phosphor-icons/core/bold/check-bold.svg';
9
11
  import minusIcon from '@phosphor-icons/core/bold/minus-bold.svg';
10
12
 
11
- function _extends() {
12
- _extends = Object.assign ? Object.assign.bind() : function (target) {
13
- for (var i = 1; i < arguments.length; i++) {
14
- var source = arguments[i];
15
- for (var key in source) {
16
- if (Object.prototype.hasOwnProperty.call(source, key)) {
17
- target[key] = source[key];
18
- }
19
- }
20
- }
21
- return target;
22
- };
23
- return _extends.apply(this, arguments);
24
- }
25
-
26
- function _objectWithoutPropertiesLoose(source, excluded) {
27
- if (source == null) return {};
28
- var target = {};
29
- var sourceKeys = Object.keys(source);
30
- var key, i;
31
- for (i = 0; i < sourceKeys.length; i++) {
32
- key = sourceKeys[i];
33
- if (excluded.indexOf(key) >= 0) continue;
34
- target[key] = source[key];
35
- }
36
- return target;
37
- }
38
-
39
- const _excluded$6 = ["checked", "disabled", "error", "groupName", "id", "testId"];
13
+ const _excluded$7 = ["checked", "disabled", "error", "groupName", "id", "testId"];
40
14
  function mapCheckedToAriaChecked(value) {
41
15
  switch (value) {
42
16
  case true:
@@ -68,7 +42,7 @@ const CheckboxCore = React.forwardRef(function CheckboxCore(props, ref) {
68
42
  id,
69
43
  testId
70
44
  } = props,
71
- sharedProps = _objectWithoutPropertiesLoose(props, _excluded$6);
45
+ sharedProps = _objectWithoutPropertiesLoose(props, _excluded$7);
72
46
  const innerRef = React.useRef(null);
73
47
  React.useEffect(() => {
74
48
  if (innerRef.current != null) {
@@ -157,11 +131,11 @@ const colors$1 = {
157
131
  active: activeRed
158
132
  }
159
133
  };
160
- const styles$5 = {};
134
+ const styles$6 = {};
161
135
  const _generateStyles$1 = (checked, error) => {
162
136
  const styleKey = `${String(checked)}-${String(error)}`;
163
- if (styles$5[styleKey]) {
164
- return styles$5[styleKey];
137
+ if (styles$6[styleKey]) {
138
+ return styles$6[styleKey];
165
139
  }
166
140
  const palette = error ? colors$1.error : colors$1.default;
167
141
  let newStyles = {};
@@ -205,11 +179,11 @@ const _generateStyles$1 = (checked, error) => {
205
179
  }
206
180
  };
207
181
  }
208
- styles$5[styleKey] = StyleSheet.create(newStyles);
209
- return styles$5[styleKey];
182
+ styles$6[styleKey] = StyleSheet.create(newStyles);
183
+ return styles$6[styleKey];
210
184
  };
211
185
 
212
- const _excluded$5 = ["checked", "disabled", "error", "groupName", "id", "testId"];
186
+ const _excluded$6 = ["checked", "disabled", "error", "groupName", "id", "testId"];
213
187
  const {
214
188
  blue,
215
189
  red,
@@ -232,7 +206,7 @@ const RadioCore = React.forwardRef(function RadioCore(props, ref) {
232
206
  id,
233
207
  testId
234
208
  } = props,
235
- sharedProps = _objectWithoutPropertiesLoose(props, _excluded$5);
209
+ sharedProps = _objectWithoutPropertiesLoose(props, _excluded$6);
236
210
  const stateStyles = _generateStyles(checked, error);
237
211
  const defaultStyle = [sharedStyles.inputReset, sharedStyles.default, !disabled && stateStyles.default, disabled && sharedStyles.disabled];
238
212
  return React.createElement(React.Fragment, null, React.createElement(StyledInput$1, _extends({}, sharedProps, {
@@ -299,11 +273,11 @@ const colors = {
299
273
  active: color.activeRed
300
274
  }
301
275
  };
302
- const styles$4 = {};
276
+ const styles$5 = {};
303
277
  const _generateStyles = (checked, error) => {
304
278
  const styleKey = `${String(checked)}-${String(error)}`;
305
- if (styles$4[styleKey]) {
306
- return styles$4[styleKey];
279
+ if (styles$5[styleKey]) {
280
+ return styles$5[styleKey];
307
281
  }
308
282
  const palette = error ? colors.error : colors.default;
309
283
  let newStyles = {};
@@ -348,11 +322,11 @@ const _generateStyles = (checked, error) => {
348
322
  }
349
323
  };
350
324
  }
351
- styles$4[styleKey] = StyleSheet.create(newStyles);
352
- return styles$4[styleKey];
325
+ styles$5[styleKey] = StyleSheet.create(newStyles);
326
+ return styles$5[styleKey];
353
327
  };
354
328
 
355
- 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"];
356
330
  const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
357
331
  const {
358
332
  checked,
@@ -366,7 +340,7 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
366
340
  className,
367
341
  variant
368
342
  } = props,
369
- coreProps = _objectWithoutPropertiesLoose(props, _excluded$4);
343
+ coreProps = _objectWithoutPropertiesLoose(props, _excluded$5);
370
344
  const handleClick = () => {
371
345
  if (variant === "radio" && checked) {
372
346
  return;
@@ -382,14 +356,14 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
382
356
  };
383
357
  const getLabel = id => {
384
358
  return React.createElement(LabelMedium, {
385
- style: [styles$3.label, disabled && styles$3.disabledLabel]
359
+ style: [styles$4.label, disabled && styles$4.disabledLabel]
386
360
  }, React.createElement("label", {
387
361
  htmlFor: id
388
362
  }, label));
389
363
  };
390
364
  const getDescription = id => {
391
365
  return React.createElement(LabelSmall, {
392
- style: styles$3.description,
366
+ style: styles$4.description,
393
367
  id: id
394
368
  }, description);
395
369
  };
@@ -404,7 +378,7 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
404
378
  style: style,
405
379
  className: className
406
380
  }, React.createElement(View, {
407
- style: styles$3.wrapper,
381
+ style: styles$4.wrapper,
408
382
  tabIndex: -1
409
383
  }, React.createElement(ChoiceCore, _extends({}, coreProps, {
410
384
  id: uniqueId,
@@ -419,7 +393,7 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
419
393
  }), label && getLabel(uniqueId)), description && getDescription(descriptionId));
420
394
  });
421
395
  });
422
- const styles$3 = StyleSheet.create({
396
+ const styles$4 = StyleSheet.create({
423
397
  wrapper: {
424
398
  flexDirection: "row",
425
399
  alignItems: "flex-start",
@@ -451,13 +425,13 @@ const Checkbox = React.forwardRef(function Checkbox(props, ref) {
451
425
  }));
452
426
  });
453
427
 
454
- const _excluded$3 = ["disabled", "error"];
428
+ const _excluded$4 = ["disabled", "error"];
455
429
  const Radio = React.forwardRef(function Radio(props, ref) {
456
430
  const {
457
431
  disabled = false,
458
432
  error = false
459
433
  } = props,
460
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
434
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$4);
461
435
  return React.createElement(ChoiceInternal, _extends({}, otherProps, {
462
436
  variant: "radio",
463
437
  disabled: disabled,
@@ -466,7 +440,7 @@ const Radio = React.forwardRef(function Radio(props, ref) {
466
440
  }));
467
441
  });
468
442
 
469
- const _excluded$2 = ["checked", "disabled", "onChange", "value", "variant"];
443
+ const _excluded$3 = ["checked", "disabled", "onChange", "value", "variant"];
470
444
  const Choice = React.forwardRef(function Choice(props, ref) {
471
445
  const {
472
446
  checked = false,
@@ -474,7 +448,7 @@ const Choice = React.forwardRef(function Choice(props, ref) {
474
448
  onChange = () => {},
475
449
  variant
476
450
  } = props,
477
- remainingProps = _objectWithoutPropertiesLoose(props, _excluded$2);
451
+ remainingProps = _objectWithoutPropertiesLoose(props, _excluded$3);
478
452
  const getChoiceComponent = variant => {
479
453
  if (variant === "checkbox") {
480
454
  return Checkbox;
@@ -491,7 +465,7 @@ const Choice = React.forwardRef(function Choice(props, ref) {
491
465
  }));
492
466
  });
493
467
 
494
- const styles$2 = StyleSheet.create({
468
+ const styles$3 = StyleSheet.create({
495
469
  fieldset: {
496
470
  border: "none",
497
471
  padding: 0,
@@ -539,16 +513,16 @@ const CheckboxGroup = React.forwardRef(function CheckboxGroup(props, ref) {
539
513
  const allChildren = React.Children.toArray(children).filter(Boolean);
540
514
  return React.createElement(StyledFieldset$1, {
541
515
  "data-testid": testId,
542
- style: styles$2.fieldset,
516
+ style: styles$3.fieldset,
543
517
  ref: ref
544
518
  }, React.createElement(View, {
545
519
  style: style
546
520
  }, label && React.createElement(StyledLegend$1, {
547
- style: styles$2.legend
521
+ style: styles$3.legend
548
522
  }, React.createElement(LabelMedium, null, label)), description && React.createElement(LabelSmall, {
549
- style: styles$2.description
523
+ style: styles$3.description
550
524
  }, description), errorMessage && React.createElement(LabelSmall, {
551
- style: styles$2.error
525
+ style: styles$3.error
552
526
  }, errorMessage), (label || description || errorMessage) && React.createElement(Strut, {
553
527
  size: spacing.small_12
554
528
  }), allChildren.map((child, index) => {
@@ -564,7 +538,7 @@ const CheckboxGroup = React.forwardRef(function CheckboxGroup(props, ref) {
564
538
  id: `${groupName}-${value}`,
565
539
  key: value,
566
540
  onChange: () => handleChange(value, checked),
567
- style: [index > 0 && styles$2.defaultLineGap, style],
541
+ style: [index > 0 && styles$3.defaultLineGap, style],
568
542
  variant: "checkbox"
569
543
  });
570
544
  })));
@@ -587,16 +561,16 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
587
561
  const allChildren = React.Children.toArray(children).filter(Boolean);
588
562
  return React.createElement(StyledFieldset, {
589
563
  "data-testid": testId,
590
- style: styles$2.fieldset,
564
+ style: styles$3.fieldset,
591
565
  ref: ref
592
566
  }, React.createElement(View, {
593
567
  style: style
594
568
  }, label && React.createElement(StyledLegend, {
595
- style: styles$2.legend
569
+ style: styles$3.legend
596
570
  }, React.createElement(LabelMedium, null, label)), description && React.createElement(LabelSmall, {
597
- style: styles$2.description
571
+ style: styles$3.description
598
572
  }, description), errorMessage && React.createElement(LabelSmall, {
599
- style: styles$2.error
573
+ style: styles$3.error
600
574
  }, errorMessage), (label || description || errorMessage) && React.createElement(Strut, {
601
575
  size: spacing.small_12
602
576
  }), allChildren.map((child, index) => {
@@ -612,14 +586,14 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
612
586
  id: `${groupName}-${value}`,
613
587
  key: value,
614
588
  onChange: () => onChange(value),
615
- style: [index > 0 && styles$2.defaultLineGap, style],
589
+ style: [index > 0 && styles$3.defaultLineGap, style],
616
590
  variant: "radio"
617
591
  });
618
592
  })));
619
593
  });
620
594
 
621
- const _excluded$1 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
622
- 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.";
623
597
  const StyledInput = addStyle("input");
624
598
  class TextField extends React.Component {
625
599
  constructor(props) {
@@ -644,7 +618,7 @@ class TextField extends React.Component {
644
618
  }
645
619
  });
646
620
  } else if (required) {
647
- const requiredString = typeof required === "string" ? required : defaultErrorMessage;
621
+ const requiredString = typeof required === "string" ? required : defaultErrorMessage$1;
648
622
  const maybeError = newValue ? null : requiredString;
649
623
  this.setState({
650
624
  error: maybeError
@@ -714,12 +688,12 @@ class TextField extends React.Component {
714
688
  autoComplete,
715
689
  forwardedRef
716
690
  } = _this$props,
717
- otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
691
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
718
692
  return React.createElement(IDProvider, {
719
693
  id: id,
720
694
  scope: "text-field"
721
695
  }, uniqueId => React.createElement(StyledInput, _extends({
722
- 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],
723
697
  id: uniqueId,
724
698
  type: type,
725
699
  placeholder: placeholder,
@@ -745,7 +719,7 @@ TextField.defaultProps = {
745
719
  disabled: false,
746
720
  light: false
747
721
  };
748
- const styles$1 = StyleSheet.create({
722
+ const styles$2 = StyleSheet.create({
749
723
  input: {
750
724
  width: "100%",
751
725
  height: 40,
@@ -809,11 +783,11 @@ class FieldHeading extends React.Component {
809
783
  testId
810
784
  } = this.props;
811
785
  const requiredIcon = React.createElement(StyledSpan, {
812
- style: styles.required,
786
+ style: styles$1.required,
813
787
  "aria-hidden": true
814
788
  }, " ", "*");
815
789
  return React.createElement(React.Fragment, null, React.createElement(LabelMedium, {
816
- style: styles.label,
790
+ style: styles$1.label,
817
791
  tag: "label",
818
792
  htmlFor: id && `${id}-field`,
819
793
  testId: testId && `${testId}-label`
@@ -830,7 +804,7 @@ class FieldHeading extends React.Component {
830
804
  return null;
831
805
  }
832
806
  return React.createElement(React.Fragment, null, React.createElement(LabelSmall, {
833
- style: styles.description,
807
+ style: styles$1.description,
834
808
  testId: testId && `${testId}-description`
835
809
  }, description), React.createElement(Strut, {
836
810
  size: spacing.xxxSmall_4
@@ -848,7 +822,7 @@ class FieldHeading extends React.Component {
848
822
  return React.createElement(React.Fragment, null, React.createElement(Strut, {
849
823
  size: spacing.small_12
850
824
  }), React.createElement(LabelSmall, {
851
- style: styles.error,
825
+ style: styles$1.error,
852
826
  role: "alert",
853
827
  id: id && `${id}-error`,
854
828
  testId: testId && `${testId}-error`
@@ -866,7 +840,7 @@ class FieldHeading extends React.Component {
866
840
  }), field, this.maybeRenderError());
867
841
  }
868
842
  }
869
- const styles = StyleSheet.create({
843
+ const styles$1 = StyleSheet.create({
870
844
  label: {
871
845
  color: color.offBlack
872
846
  },
@@ -881,7 +855,7 @@ const styles = StyleSheet.create({
881
855
  }
882
856
  });
883
857
 
884
- 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"];
885
859
  class LabeledTextField extends React.Component {
886
860
  constructor(props) {
887
861
  super(props);
@@ -948,7 +922,7 @@ class LabeledTextField extends React.Component {
948
922
  forwardedRef,
949
923
  ariaDescribedby
950
924
  } = _this$props,
951
- otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
925
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
952
926
  return React.createElement(IDProvider, {
953
927
  id: id,
954
928
  scope: "labeled-text-field"
@@ -993,4 +967,204 @@ var labeledTextField = React.forwardRef((props, ref) => React.createElement(Labe
993
967
  forwardedRef: ref
994
968
  })));
995
969
 
996
- 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
+ disabled: disabled,
1053
+ readOnly: readOnly,
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: onClick,
1063
+ onKeyDown: onKeyDown,
1064
+ onKeyUp: 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
+ },
1103
+ error: {
1104
+ background: color.fadedRed8,
1105
+ border: `1px solid ${color.red}`,
1106
+ color: color.offBlack,
1107
+ "::placeholder": {
1108
+ color: color.offBlack64
1109
+ },
1110
+ ":focus-visible": {
1111
+ outlineColor: color.red,
1112
+ borderColor: color.red
1113
+ }
1114
+ },
1115
+ light: {
1116
+ background: color.white,
1117
+ border: `1px solid ${color.offBlack16}`,
1118
+ color: color.offBlack,
1119
+ "::placeholder": {
1120
+ color: color.offBlack64
1121
+ }
1122
+ },
1123
+ lightFocus: {
1124
+ ":focus-visible": {
1125
+ outline: `1px solid ${color.blue}`,
1126
+ outlineOffset: 0,
1127
+ borderColor: color.blue,
1128
+ boxShadow: `0px 0px 0px 2px ${color.blue}, 0px 0px 0px 3px ${color.white}`
1129
+ }
1130
+ },
1131
+ lightDisabled: {
1132
+ backgroundColor: "transparent",
1133
+ border: `1px solid ${color.white32}`,
1134
+ color: color.white64,
1135
+ "::placeholder": {
1136
+ color: color.white64
1137
+ },
1138
+ cursor: "not-allowed"
1139
+ },
1140
+ lightError: {
1141
+ background: color.fadedRed8,
1142
+ border: `1px solid ${color.red}`,
1143
+ boxShadow: `0px 0px 0px 1px ${color.red}, 0px 0px 0px 2px ${color.white}`,
1144
+ color: color.offBlack,
1145
+ "::placeholder": {
1146
+ color: color.offBlack64
1147
+ },
1148
+ ":focus-visible": {
1149
+ outlineColor: color.red,
1150
+ borderColor: color.red,
1151
+ boxShadow: `0px 0px 0px 2px ${color.red}, 0px 0px 0px 3px ${color.white}`
1152
+ }
1153
+ }
1154
+ });
1155
+ const resizeStyles = StyleSheet.create({
1156
+ both: {
1157
+ resize: "both"
1158
+ },
1159
+ none: {
1160
+ resize: "none"
1161
+ },
1162
+ horizontal: {
1163
+ resize: "horizontal"
1164
+ },
1165
+ vertical: {
1166
+ resize: "vertical"
1167
+ }
1168
+ });
1169
+
1170
+ 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, };