@khanacademy/wonder-blocks-form 4.7.4 → 4.7.5
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 +13 -0
- package/dist/es/index.js +2 -28
- package/dist/index.js +35 -59
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-form
|
|
2
2
|
|
|
3
|
+
## 4.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 559e82d5: Update to build tooling, generating smaller output
|
|
8
|
+
- Updated dependencies [559e82d5]
|
|
9
|
+
- @khanacademy/wonder-blocks-clickable@4.2.5
|
|
10
|
+
- @khanacademy/wonder-blocks-core@6.4.3
|
|
11
|
+
- @khanacademy/wonder-blocks-icon@4.1.3
|
|
12
|
+
- @khanacademy/wonder-blocks-layout@2.1.2
|
|
13
|
+
- @khanacademy/wonder-blocks-tokens@1.3.1
|
|
14
|
+
- @khanacademy/wonder-blocks-typography@2.1.14
|
|
15
|
+
|
|
3
16
|
## 4.7.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/es/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
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
5
|
import { addStyle, UniqueIDProvider, View, IDProvider } from '@khanacademy/wonder-blocks-core';
|
|
4
6
|
import { Strut } from '@khanacademy/wonder-blocks-layout';
|
|
@@ -8,34 +10,6 @@ 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
13
|
const _excluded$6 = ["checked", "disabled", "error", "groupName", "id", "testId"];
|
|
40
14
|
function mapCheckedToAriaChecked(value) {
|
|
41
15
|
switch (value) {
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
6
|
var React = require('react');
|
|
7
|
+
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
6
8
|
var aphrodite = require('aphrodite');
|
|
7
9
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
8
10
|
var wonderBlocksLayout = require('@khanacademy/wonder-blocks-layout');
|
|
@@ -15,55 +17,29 @@ var minusIcon = require('@phosphor-icons/core/bold/minus-bold.svg');
|
|
|
15
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
18
|
|
|
17
19
|
function _interopNamespace(e) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
if (e && e.__esModule) return e;
|
|
21
|
+
var n = Object.create(null);
|
|
22
|
+
if (e) {
|
|
23
|
+
Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default') {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
27
31
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
n["default"] = e;
|
|
32
|
-
return Object.freeze(n);
|
|
32
|
+
}
|
|
33
|
+
n["default"] = e;
|
|
34
|
+
return Object.freeze(n);
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
35
38
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
39
|
+
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
36
40
|
var checkIcon__default = /*#__PURE__*/_interopDefaultLegacy(checkIcon);
|
|
37
41
|
var minusIcon__default = /*#__PURE__*/_interopDefaultLegacy(minusIcon);
|
|
38
42
|
|
|
39
|
-
function _extends() {
|
|
40
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
41
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
42
|
-
var source = arguments[i];
|
|
43
|
-
for (var key in source) {
|
|
44
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
45
|
-
target[key] = source[key];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return target;
|
|
50
|
-
};
|
|
51
|
-
return _extends.apply(this, arguments);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
55
|
-
if (source == null) return {};
|
|
56
|
-
var target = {};
|
|
57
|
-
var sourceKeys = Object.keys(source);
|
|
58
|
-
var key, i;
|
|
59
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
60
|
-
key = sourceKeys[i];
|
|
61
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
62
|
-
target[key] = source[key];
|
|
63
|
-
}
|
|
64
|
-
return target;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
43
|
const _excluded$6 = ["checked", "disabled", "error", "groupName", "id", "testId"];
|
|
68
44
|
function mapCheckedToAriaChecked(value) {
|
|
69
45
|
switch (value) {
|
|
@@ -96,7 +72,7 @@ const CheckboxCore = React__namespace.forwardRef(function CheckboxCore(props, re
|
|
|
96
72
|
id,
|
|
97
73
|
testId
|
|
98
74
|
} = props,
|
|
99
|
-
sharedProps =
|
|
75
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$6);
|
|
100
76
|
const innerRef = React__namespace.useRef(null);
|
|
101
77
|
React__namespace.useEffect(() => {
|
|
102
78
|
if (innerRef.current != null) {
|
|
@@ -118,7 +94,7 @@ const CheckboxCore = React__namespace.forwardRef(function CheckboxCore(props, re
|
|
|
118
94
|
}]
|
|
119
95
|
});
|
|
120
96
|
const ariaChecked = mapCheckedToAriaChecked(checked);
|
|
121
|
-
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(StyledInput$2,
|
|
97
|
+
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(StyledInput$2, _extends__default["default"]({}, sharedProps, {
|
|
122
98
|
ref: node => {
|
|
123
99
|
innerRef.current = node;
|
|
124
100
|
if (typeof ref === "function") {
|
|
@@ -260,10 +236,10 @@ const RadioCore = React__namespace.forwardRef(function RadioCore(props, ref) {
|
|
|
260
236
|
id,
|
|
261
237
|
testId
|
|
262
238
|
} = props,
|
|
263
|
-
sharedProps =
|
|
239
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$5);
|
|
264
240
|
const stateStyles = _generateStyles(checked, error);
|
|
265
241
|
const defaultStyle = [sharedStyles.inputReset, sharedStyles.default, !disabled && stateStyles.default, disabled && sharedStyles.disabled];
|
|
266
|
-
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(StyledInput$1,
|
|
242
|
+
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(StyledInput$1, _extends__default["default"]({}, sharedProps, {
|
|
267
243
|
type: "radio",
|
|
268
244
|
"aria-invalid": error,
|
|
269
245
|
checked: checked != null ? checked : undefined,
|
|
@@ -394,7 +370,7 @@ const ChoiceInternal = React__namespace.forwardRef(function ChoiceInternal(props
|
|
|
394
370
|
className,
|
|
395
371
|
variant
|
|
396
372
|
} = props,
|
|
397
|
-
coreProps =
|
|
373
|
+
coreProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$4);
|
|
398
374
|
const handleClick = () => {
|
|
399
375
|
if (variant === "radio" && checked) {
|
|
400
376
|
return;
|
|
@@ -434,7 +410,7 @@ const ChoiceInternal = React__namespace.forwardRef(function ChoiceInternal(props
|
|
|
434
410
|
}, React__namespace.createElement(wonderBlocksCore.View, {
|
|
435
411
|
style: styles$3.wrapper,
|
|
436
412
|
tabIndex: -1
|
|
437
|
-
}, React__namespace.createElement(ChoiceCore,
|
|
413
|
+
}, React__namespace.createElement(ChoiceCore, _extends__default["default"]({}, coreProps, {
|
|
438
414
|
id: uniqueId,
|
|
439
415
|
checked: checked,
|
|
440
416
|
"aria-describedby": descriptionId,
|
|
@@ -471,7 +447,7 @@ const Checkbox = React__namespace.forwardRef(function Checkbox(props, ref) {
|
|
|
471
447
|
disabled = false,
|
|
472
448
|
error = false
|
|
473
449
|
} = props;
|
|
474
|
-
return React__namespace.createElement(ChoiceInternal,
|
|
450
|
+
return React__namespace.createElement(ChoiceInternal, _extends__default["default"]({}, props, {
|
|
475
451
|
variant: "checkbox",
|
|
476
452
|
disabled: disabled,
|
|
477
453
|
error: error,
|
|
@@ -485,8 +461,8 @@ const Radio = React__namespace.forwardRef(function Radio(props, ref) {
|
|
|
485
461
|
disabled = false,
|
|
486
462
|
error = false
|
|
487
463
|
} = props,
|
|
488
|
-
otherProps =
|
|
489
|
-
return React__namespace.createElement(ChoiceInternal,
|
|
464
|
+
otherProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$3);
|
|
465
|
+
return React__namespace.createElement(ChoiceInternal, _extends__default["default"]({}, otherProps, {
|
|
490
466
|
variant: "radio",
|
|
491
467
|
disabled: disabled,
|
|
492
468
|
error: error,
|
|
@@ -502,7 +478,7 @@ const Choice = React__namespace.forwardRef(function Choice(props, ref) {
|
|
|
502
478
|
onChange = () => {},
|
|
503
479
|
variant
|
|
504
480
|
} = props,
|
|
505
|
-
remainingProps =
|
|
481
|
+
remainingProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$2);
|
|
506
482
|
const getChoiceComponent = variant => {
|
|
507
483
|
if (variant === "checkbox") {
|
|
508
484
|
return Checkbox;
|
|
@@ -511,7 +487,7 @@ const Choice = React__namespace.forwardRef(function Choice(props, ref) {
|
|
|
511
487
|
}
|
|
512
488
|
};
|
|
513
489
|
const ChoiceComponent = getChoiceComponent(variant);
|
|
514
|
-
return React__namespace.createElement(ChoiceComponent,
|
|
490
|
+
return React__namespace.createElement(ChoiceComponent, _extends__default["default"]({}, remainingProps, {
|
|
515
491
|
checked: checked,
|
|
516
492
|
disabled: disabled,
|
|
517
493
|
onChange: onChange,
|
|
@@ -742,11 +718,11 @@ class TextField extends React__namespace.Component {
|
|
|
742
718
|
autoComplete,
|
|
743
719
|
forwardedRef
|
|
744
720
|
} = _this$props,
|
|
745
|
-
otherProps =
|
|
721
|
+
otherProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$1);
|
|
746
722
|
return React__namespace.createElement(wonderBlocksCore.IDProvider, {
|
|
747
723
|
id: id,
|
|
748
724
|
scope: "text-field"
|
|
749
|
-
}, uniqueId => React__namespace.createElement(StyledInput,
|
|
725
|
+
}, uniqueId => React__namespace.createElement(StyledInput, _extends__default["default"]({
|
|
750
726
|
style: [styles$1.input, wonderBlocksTypography.styles.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],
|
|
751
727
|
id: uniqueId,
|
|
752
728
|
type: type,
|
|
@@ -823,7 +799,7 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
823
799
|
boxShadow: `0px 0px 0px 1px ${wonderBlocksTokens.color.red}, 0px 0px 0px 2px ${wonderBlocksTokens.color.white}`
|
|
824
800
|
}
|
|
825
801
|
});
|
|
826
|
-
var TextField$1 = React__namespace.forwardRef((props, ref) => React__namespace.createElement(TextField,
|
|
802
|
+
var TextField$1 = React__namespace.forwardRef((props, ref) => React__namespace.createElement(TextField, _extends__default["default"]({}, props, {
|
|
827
803
|
forwardedRef: ref
|
|
828
804
|
})));
|
|
829
805
|
|
|
@@ -976,7 +952,7 @@ class LabeledTextField extends React__namespace.Component {
|
|
|
976
952
|
forwardedRef,
|
|
977
953
|
ariaDescribedby
|
|
978
954
|
} = _this$props,
|
|
979
|
-
otherProps =
|
|
955
|
+
otherProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded);
|
|
980
956
|
return React__namespace.createElement(wonderBlocksCore.IDProvider, {
|
|
981
957
|
id: id,
|
|
982
958
|
scope: "labeled-text-field"
|
|
@@ -984,7 +960,7 @@ class LabeledTextField extends React__namespace.Component {
|
|
|
984
960
|
id: uniqueId,
|
|
985
961
|
testId: testId,
|
|
986
962
|
style: style,
|
|
987
|
-
field: React__namespace.createElement(TextField$1,
|
|
963
|
+
field: React__namespace.createElement(TextField$1, _extends__default["default"]({
|
|
988
964
|
id: `${uniqueId}-field`,
|
|
989
965
|
"aria-describedby": ariaDescribedby ? ariaDescribedby : `${uniqueId}-error`,
|
|
990
966
|
"aria-required": required ? "true" : "false",
|
|
@@ -1017,7 +993,7 @@ LabeledTextField.defaultProps = {
|
|
|
1017
993
|
disabled: false,
|
|
1018
994
|
light: false
|
|
1019
995
|
};
|
|
1020
|
-
var labeledTextField = React__namespace.forwardRef((props, ref) => React__namespace.createElement(LabeledTextField,
|
|
996
|
+
var labeledTextField = React__namespace.forwardRef((props, ref) => React__namespace.createElement(LabeledTextField, _extends__default["default"]({}, props, {
|
|
1021
997
|
forwardedRef: ref
|
|
1022
998
|
})));
|
|
1023
999
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-form",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.5",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Form components for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-clickable": "^4.2.
|
|
20
|
-
"@khanacademy/wonder-blocks-core": "^6.4.
|
|
21
|
-
"@khanacademy/wonder-blocks-icon": "^4.1.
|
|
22
|
-
"@khanacademy/wonder-blocks-layout": "^2.1.
|
|
23
|
-
"@khanacademy/wonder-blocks-tokens": "^1.3.
|
|
24
|
-
"@khanacademy/wonder-blocks-typography": "^2.1.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^4.2.5",
|
|
20
|
+
"@khanacademy/wonder-blocks-core": "^6.4.3",
|
|
21
|
+
"@khanacademy/wonder-blocks-icon": "^4.1.3",
|
|
22
|
+
"@khanacademy/wonder-blocks-layout": "^2.1.2",
|
|
23
|
+
"@khanacademy/wonder-blocks-tokens": "^1.3.1",
|
|
24
|
+
"@khanacademy/wonder-blocks-typography": "^2.1.14"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"aphrodite": "^1.2.5",
|
|
28
28
|
"react": "16.14.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@khanacademy/wb-dev-build-settings": "^1.0.
|
|
31
|
+
"@khanacademy/wb-dev-build-settings": "^1.0.1"
|
|
32
32
|
}
|
|
33
33
|
}
|