@khanacademy/wonder-blocks-form 4.9.4 → 4.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @khanacademy/wonder-blocks-form
2
2
 
3
+ ## 4.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8c861955: Modify `RadioGroup` and `CheckboxGroup` to append `legend` as the first child in `fieldset`, so the accessibility tree can associate the legend contents with the fieldset group and announce its label correctly
8
+ - 0b3a28a7: - Combobox: Add error prop to support aria-invalid and styling changes.
9
+ - TextField: Modify aria-invalid order to be overriden by the caller.
10
+
11
+ ## 4.10.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 7a98815b: LabeledTextField: Adds `name` prop for the `TextField` component
16
+
3
17
  ## 4.9.4
4
18
 
5
19
  ### Patch Changes
@@ -120,6 +120,10 @@ type CommonProps = {
120
120
  * Specifies if the TextField allows autocomplete.
121
121
  */
122
122
  autoComplete?: string;
123
+ /**
124
+ * Provide a name for the TextField.
125
+ */
126
+ name?: string;
123
127
  };
124
128
  type OtherInputProps = CommonProps & {
125
129
  /**
package/dist/es/index.js CHANGED
@@ -467,6 +467,8 @@ const Choice = React.forwardRef(function Choice(props, ref) {
467
467
 
468
468
  const styles$3 = StyleSheet.create({
469
469
  fieldset: {
470
+ display: "flex",
471
+ flexDirection: "column",
470
472
  border: "none",
471
473
  padding: 0,
472
474
  margin: 0
@@ -513,10 +515,8 @@ const CheckboxGroup = React.forwardRef(function CheckboxGroup(props, ref) {
513
515
  const allChildren = React.Children.toArray(children).filter(Boolean);
514
516
  return React.createElement(StyledFieldset$1, {
515
517
  "data-testid": testId,
516
- style: styles$3.fieldset,
518
+ style: [styles$3.fieldset, style],
517
519
  ref: ref
518
- }, React.createElement(View, {
519
- style: style
520
520
  }, label && React.createElement(StyledLegend$1, {
521
521
  style: styles$3.legend
522
522
  }, React.createElement(LabelMedium, null, label)), description && React.createElement(LabelSmall, {
@@ -541,7 +541,7 @@ const CheckboxGroup = React.forwardRef(function CheckboxGroup(props, ref) {
541
541
  style: [index > 0 && styles$3.defaultLineGap, style],
542
542
  variant: "checkbox"
543
543
  });
544
- })));
544
+ }));
545
545
  });
546
546
 
547
547
  const StyledFieldset = addStyle("fieldset");
@@ -561,10 +561,8 @@ 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$3.fieldset,
564
+ style: [styles$3.fieldset, style],
565
565
  ref: ref
566
- }, React.createElement(View, {
567
- style: style
568
566
  }, label && React.createElement(StyledLegend, {
569
567
  style: styles$3.legend
570
568
  }, React.createElement(LabelMedium, null, label)), description && React.createElement(LabelSmall, {
@@ -589,7 +587,7 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
589
587
  style: [index > 0 && styles$3.defaultLineGap, style],
590
588
  variant: "radio"
591
589
  });
592
- })));
590
+ }));
593
591
  });
594
592
 
595
593
  const _excluded$2 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "light", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
@@ -711,10 +709,9 @@ class TextField extends React.Component {
711
709
  readOnly: readOnly || disabled,
712
710
  autoFocus: autoFocus,
713
711
  autoComplete: autoComplete,
714
- ref: forwardedRef
715
- }, otherProps, {
712
+ ref: forwardedRef,
716
713
  "aria-invalid": this.state.error ? "true" : "false"
717
- })));
714
+ }, otherProps)));
718
715
  }
719
716
  }
720
717
  TextField.defaultProps = {
@@ -916,7 +913,7 @@ const styles$1 = StyleSheet.create({
916
913
  }
917
914
  });
918
915
 
919
- const _excluded$1 = ["id", "type", "label", "description", "value", "disabled", "required", "validate", "onChange", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoComplete", "forwardedRef", "ariaDescribedby", "onValidate", "onFocus", "onBlur"];
916
+ const _excluded$1 = ["id", "type", "label", "description", "value", "disabled", "required", "validate", "onChange", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoComplete", "forwardedRef", "ariaDescribedby", "name", "onValidate", "onFocus", "onBlur"];
920
917
  class LabeledTextField extends React.Component {
921
918
  constructor(props) {
922
919
  super(props);
@@ -981,7 +978,8 @@ class LabeledTextField extends React.Component {
981
978
  readOnly,
982
979
  autoComplete,
983
980
  forwardedRef,
984
- ariaDescribedby
981
+ ariaDescribedby,
982
+ name
985
983
  } = _this$props,
986
984
  otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
987
985
  return React.createElement(IDProvider, {
@@ -1011,7 +1009,8 @@ class LabeledTextField extends React.Component {
1011
1009
  light: light,
1012
1010
  readOnly: readOnly,
1013
1011
  autoComplete: autoComplete,
1014
- ref: forwardedRef
1012
+ ref: forwardedRef,
1013
+ name: name
1015
1014
  }, otherProps)),
1016
1015
  label: label,
1017
1016
  description: description,
package/dist/index.js CHANGED
@@ -497,6 +497,8 @@ const Choice = React__namespace.forwardRef(function Choice(props, ref) {
497
497
 
498
498
  const styles$3 = aphrodite.StyleSheet.create({
499
499
  fieldset: {
500
+ display: "flex",
501
+ flexDirection: "column",
500
502
  border: "none",
501
503
  padding: 0,
502
504
  margin: 0
@@ -543,10 +545,8 @@ const CheckboxGroup = React__namespace.forwardRef(function CheckboxGroup(props,
543
545
  const allChildren = React__namespace.Children.toArray(children).filter(Boolean);
544
546
  return React__namespace.createElement(StyledFieldset$1, {
545
547
  "data-testid": testId,
546
- style: styles$3.fieldset,
548
+ style: [styles$3.fieldset, style],
547
549
  ref: ref
548
- }, React__namespace.createElement(wonderBlocksCore.View, {
549
- style: style
550
550
  }, label && React__namespace.createElement(StyledLegend$1, {
551
551
  style: styles$3.legend
552
552
  }, React__namespace.createElement(wonderBlocksTypography.LabelMedium, null, label)), description && React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
@@ -571,7 +571,7 @@ const CheckboxGroup = React__namespace.forwardRef(function CheckboxGroup(props,
571
571
  style: [index > 0 && styles$3.defaultLineGap, style],
572
572
  variant: "checkbox"
573
573
  });
574
- })));
574
+ }));
575
575
  });
576
576
 
577
577
  const StyledFieldset = wonderBlocksCore.addStyle("fieldset");
@@ -591,10 +591,8 @@ const RadioGroup = React__namespace.forwardRef(function RadioGroup(props, ref) {
591
591
  const allChildren = React__namespace.Children.toArray(children).filter(Boolean);
592
592
  return React__namespace.createElement(StyledFieldset, {
593
593
  "data-testid": testId,
594
- style: styles$3.fieldset,
594
+ style: [styles$3.fieldset, style],
595
595
  ref: ref
596
- }, React__namespace.createElement(wonderBlocksCore.View, {
597
- style: style
598
596
  }, label && React__namespace.createElement(StyledLegend, {
599
597
  style: styles$3.legend
600
598
  }, React__namespace.createElement(wonderBlocksTypography.LabelMedium, null, label)), description && React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
@@ -619,7 +617,7 @@ const RadioGroup = React__namespace.forwardRef(function RadioGroup(props, ref) {
619
617
  style: [index > 0 && styles$3.defaultLineGap, style],
620
618
  variant: "radio"
621
619
  });
622
- })));
620
+ }));
623
621
  });
624
622
 
625
623
  const _excluded$2 = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "light", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
@@ -741,10 +739,9 @@ class TextField extends React__namespace.Component {
741
739
  readOnly: readOnly || disabled,
742
740
  autoFocus: autoFocus,
743
741
  autoComplete: autoComplete,
744
- ref: forwardedRef
745
- }, otherProps, {
742
+ ref: forwardedRef,
746
743
  "aria-invalid": this.state.error ? "true" : "false"
747
- })));
744
+ }, otherProps)));
748
745
  }
749
746
  }
750
747
  TextField.defaultProps = {
@@ -946,7 +943,7 @@ const styles$1 = aphrodite.StyleSheet.create({
946
943
  }
947
944
  });
948
945
 
949
- const _excluded$1 = ["id", "type", "label", "description", "value", "disabled", "required", "validate", "onChange", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoComplete", "forwardedRef", "ariaDescribedby", "onValidate", "onFocus", "onBlur"];
946
+ const _excluded$1 = ["id", "type", "label", "description", "value", "disabled", "required", "validate", "onChange", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoComplete", "forwardedRef", "ariaDescribedby", "name", "onValidate", "onFocus", "onBlur"];
950
947
  class LabeledTextField extends React__namespace.Component {
951
948
  constructor(props) {
952
949
  super(props);
@@ -1011,7 +1008,8 @@ class LabeledTextField extends React__namespace.Component {
1011
1008
  readOnly,
1012
1009
  autoComplete,
1013
1010
  forwardedRef,
1014
- ariaDescribedby
1011
+ ariaDescribedby,
1012
+ name
1015
1013
  } = _this$props,
1016
1014
  otherProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$1);
1017
1015
  return React__namespace.createElement(wonderBlocksCore.IDProvider, {
@@ -1041,7 +1039,8 @@ class LabeledTextField extends React__namespace.Component {
1041
1039
  light: light,
1042
1040
  readOnly: readOnly,
1043
1041
  autoComplete: autoComplete,
1044
- ref: forwardedRef
1042
+ ref: forwardedRef,
1043
+ name: name
1045
1044
  }, otherProps)),
1046
1045
  label: label,
1047
1046
  description: description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-form",
3
- "version": "4.9.4",
3
+ "version": "4.10.1",
4
4
  "design": "v1",
5
5
  "description": "Form components for Wonder Blocks.",
6
6
  "main": "dist/index.js",