@khanacademy/wonder-blocks-form 5.0.1 → 6.0.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/CHANGELOG.md +24 -0
- package/dist/es/index.js +12 -15
- package/dist/index.js +10 -14
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-form
|
|
2
2
|
|
|
3
|
+
## 6.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 56d961f1: - Migrate Wonder Blocks components off old id providers and onto new `Id` component
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- b6009b77: Deprecate the ID provider and unique ID utilities
|
|
12
|
+
- Updated dependencies [b6009b77]
|
|
13
|
+
- Updated dependencies [897686bc]
|
|
14
|
+
- Updated dependencies [56d961f1]
|
|
15
|
+
- @khanacademy/wonder-blocks-core@10.0.0
|
|
16
|
+
- @khanacademy/wonder-blocks-clickable@5.0.2
|
|
17
|
+
- @khanacademy/wonder-blocks-icon@5.0.2
|
|
18
|
+
- @khanacademy/wonder-blocks-layout@3.0.2
|
|
19
|
+
- @khanacademy/wonder-blocks-typography@3.0.2
|
|
20
|
+
|
|
21
|
+
## 5.0.2
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 2a9c2fa8: Remove i18n reference from unit tests
|
|
26
|
+
|
|
3
27
|
## 5.0.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/es/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { useId } from 'react';
|
|
3
4
|
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
4
5
|
import { StyleSheet } from 'aphrodite';
|
|
5
|
-
import { addStyle,
|
|
6
|
+
import { addStyle, Id, View, useOnMountEffect } from '@khanacademy/wonder-blocks-core';
|
|
6
7
|
import { Strut } from '@khanacademy/wonder-blocks-layout';
|
|
7
8
|
import { spacing, mix, color, border, font } from '@khanacademy/wonder-blocks-tokens';
|
|
8
9
|
import { LabelMedium, LabelSmall, styles as styles$7 } from '@khanacademy/wonder-blocks-typography';
|
|
@@ -368,12 +369,10 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
|
|
|
368
369
|
}, description);
|
|
369
370
|
};
|
|
370
371
|
const ChoiceCore = getChoiceCoreComponent();
|
|
371
|
-
return React.createElement(
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
const uniqueId = id || ids.get("main");
|
|
376
|
-
const descriptionId = description ? ids.get("description") : undefined;
|
|
372
|
+
return React.createElement(Id, {
|
|
373
|
+
id: id
|
|
374
|
+
}, uniqueId => {
|
|
375
|
+
const descriptionId = description ? `${uniqueId}-description` : undefined;
|
|
377
376
|
return React.createElement(View, {
|
|
378
377
|
style: style,
|
|
379
378
|
className: className
|
|
@@ -713,9 +712,8 @@ const TextField = props => {
|
|
|
713
712
|
const lightStyles = [styles$2.light, !disabled && styles$2.lightFocus, disabled && styles$2.lightDisabled, hasError && styles$2.lightError];
|
|
714
713
|
return [...baseStyles, ...(light ? lightStyles : defaultStyles)];
|
|
715
714
|
};
|
|
716
|
-
return React.createElement(
|
|
717
|
-
id: id
|
|
718
|
-
scope: "text-field"
|
|
715
|
+
return React.createElement(Id, {
|
|
716
|
+
id: id
|
|
719
717
|
}, uniqueId => React.createElement(StyledInput, _extends({
|
|
720
718
|
style: [getStyles(), style],
|
|
721
719
|
id: uniqueId,
|
|
@@ -999,9 +997,8 @@ class LabeledTextField extends React.Component {
|
|
|
999
997
|
name
|
|
1000
998
|
} = _this$props,
|
|
1001
999
|
otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
|
|
1002
|
-
return React.createElement(
|
|
1003
|
-
id: id
|
|
1004
|
-
scope: "labeled-text-field"
|
|
1000
|
+
return React.createElement(Id, {
|
|
1001
|
+
id: id
|
|
1005
1002
|
}, uniqueId => React.createElement(FieldHeading, {
|
|
1006
1003
|
id: uniqueId,
|
|
1007
1004
|
testId: testId,
|
|
@@ -1094,8 +1091,8 @@ const TextArea = React.forwardRef(function TextArea(props, ref) {
|
|
|
1094
1091
|
instantValidation
|
|
1095
1092
|
});
|
|
1096
1093
|
const hasError = error || !!errorMessage;
|
|
1097
|
-
const
|
|
1098
|
-
const uniqueId = id != null ? id :
|
|
1094
|
+
const generatedUniqueId = useId();
|
|
1095
|
+
const uniqueId = id != null ? id : generatedUniqueId;
|
|
1099
1096
|
const handleChange = event => {
|
|
1100
1097
|
const newValue = event.target.value;
|
|
1101
1098
|
onChangeValidation(newValue);
|
package/dist/index.js
CHANGED
|
@@ -398,12 +398,10 @@ const ChoiceInternal = React__namespace.forwardRef(function ChoiceInternal(props
|
|
|
398
398
|
}, description);
|
|
399
399
|
};
|
|
400
400
|
const ChoiceCore = getChoiceCoreComponent();
|
|
401
|
-
return React__namespace.createElement(wonderBlocksCore.
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
const uniqueId = id || ids.get("main");
|
|
406
|
-
const descriptionId = description ? ids.get("description") : undefined;
|
|
401
|
+
return React__namespace.createElement(wonderBlocksCore.Id, {
|
|
402
|
+
id: id
|
|
403
|
+
}, uniqueId => {
|
|
404
|
+
const descriptionId = description ? `${uniqueId}-description` : undefined;
|
|
407
405
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
408
406
|
style: style,
|
|
409
407
|
className: className
|
|
@@ -743,9 +741,8 @@ const TextField = props => {
|
|
|
743
741
|
const lightStyles = [styles$2.light, !disabled && styles$2.lightFocus, disabled && styles$2.lightDisabled, hasError && styles$2.lightError];
|
|
744
742
|
return [...baseStyles, ...(light ? lightStyles : defaultStyles)];
|
|
745
743
|
};
|
|
746
|
-
return React__namespace.createElement(wonderBlocksCore.
|
|
747
|
-
id: id
|
|
748
|
-
scope: "text-field"
|
|
744
|
+
return React__namespace.createElement(wonderBlocksCore.Id, {
|
|
745
|
+
id: id
|
|
749
746
|
}, uniqueId => React__namespace.createElement(StyledInput, _extends__default["default"]({
|
|
750
747
|
style: [getStyles(), style],
|
|
751
748
|
id: uniqueId,
|
|
@@ -1029,9 +1026,8 @@ class LabeledTextField extends React__namespace.Component {
|
|
|
1029
1026
|
name
|
|
1030
1027
|
} = _this$props,
|
|
1031
1028
|
otherProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$1);
|
|
1032
|
-
return React__namespace.createElement(wonderBlocksCore.
|
|
1033
|
-
id: id
|
|
1034
|
-
scope: "labeled-text-field"
|
|
1029
|
+
return React__namespace.createElement(wonderBlocksCore.Id, {
|
|
1030
|
+
id: id
|
|
1035
1031
|
}, uniqueId => React__namespace.createElement(FieldHeading, {
|
|
1036
1032
|
id: uniqueId,
|
|
1037
1033
|
testId: testId,
|
|
@@ -1124,8 +1120,8 @@ const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
|
|
|
1124
1120
|
instantValidation
|
|
1125
1121
|
});
|
|
1126
1122
|
const hasError = error || !!errorMessage;
|
|
1127
|
-
const
|
|
1128
|
-
const uniqueId = id != null ? id :
|
|
1123
|
+
const generatedUniqueId = React.useId();
|
|
1124
|
+
const uniqueId = id != null ? id : generatedUniqueId;
|
|
1129
1125
|
const handleChange = event => {
|
|
1130
1126
|
const newValue = event.target.value;
|
|
1131
1127
|
onChangeValidation(newValue);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-form",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
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": "^5.0.
|
|
20
|
-
"@khanacademy/wonder-blocks-core": "^
|
|
21
|
-
"@khanacademy/wonder-blocks-icon": "^5.0.
|
|
22
|
-
"@khanacademy/wonder-blocks-layout": "^3.0.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^5.0.2",
|
|
20
|
+
"@khanacademy/wonder-blocks-core": "^10.0.0",
|
|
21
|
+
"@khanacademy/wonder-blocks-icon": "^5.0.2",
|
|
22
|
+
"@khanacademy/wonder-blocks-layout": "^3.0.2",
|
|
23
23
|
"@khanacademy/wonder-blocks-tokens": "^3.0.0",
|
|
24
|
-
"@khanacademy/wonder-blocks-typography": "^3.0.
|
|
24
|
+
"@khanacademy/wonder-blocks-typography": "^3.0.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"aphrodite": "^1.2.5",
|