@khanacademy/wonder-blocks-form 4.3.19 → 4.4.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 +20 -0
- package/dist/components/text-field.d.ts +5 -0
- package/dist/es/index.js +60 -60
- package/dist/index.js +60 -62
- package/package.json +4 -4
- package/src/components/__tests__/labeled-text-field.test.tsx +2 -2
- package/src/components/__tests__/text-field.test.tsx +14 -0
- package/src/components/checkbox-core.tsx +9 -9
- package/src/components/checkbox-group.tsx +2 -2
- package/src/components/choice-internal.tsx +6 -7
- package/src/components/field-heading.tsx +9 -10
- package/src/components/group-styles.ts +6 -7
- package/src/components/radio-core.tsx +8 -9
- package/src/components/radio-group.tsx +2 -2
- package/src/components/text-field.tsx +28 -21
- package/tsconfig-build.json +1 -1
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-form
|
|
2
2
|
|
|
3
|
+
## 4.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 60aba5b8: Update internal spacing references (from wb-spacing to wb-tokens)
|
|
8
|
+
- 7c51f377: Migrate wb-color imports to use tokens.color
|
|
9
|
+
- Updated dependencies [60aba5b8]
|
|
10
|
+
- Updated dependencies [7cd7f6cc]
|
|
11
|
+
- Updated dependencies [7c51f377]
|
|
12
|
+
- Updated dependencies [7c51f377]
|
|
13
|
+
- @khanacademy/wonder-blocks-layout@2.0.26
|
|
14
|
+
- @khanacademy/wonder-blocks-tokens@0.2.0
|
|
15
|
+
- @khanacademy/wonder-blocks-clickable@4.0.13
|
|
16
|
+
|
|
17
|
+
## 4.4.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 0c329565: `name` prop has been added to SearchField and TextField
|
|
22
|
+
|
|
3
23
|
## 4.3.19
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -17,6 +17,11 @@ type Props = AriaProps & {
|
|
|
17
17
|
* The input value.
|
|
18
18
|
*/
|
|
19
19
|
value: string;
|
|
20
|
+
/**
|
|
21
|
+
* The name for the input control. This is submitted along with
|
|
22
|
+
* the form data.
|
|
23
|
+
*/
|
|
24
|
+
name?: string;
|
|
20
25
|
/**
|
|
21
26
|
* Makes a read-only input field that cannot be focused. Defaults to false.
|
|
22
27
|
*/
|
package/dist/es/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { StyleSheet } from 'aphrodite';
|
|
3
|
-
import Color, { mix, fade } from '@khanacademy/wonder-blocks-color';
|
|
4
3
|
import { addStyle, UniqueIDProvider, View, IDProvider } from '@khanacademy/wonder-blocks-core';
|
|
5
4
|
import { Strut } from '@khanacademy/wonder-blocks-layout';
|
|
6
|
-
import
|
|
5
|
+
import { spacing, color } from '@khanacademy/wonder-blocks-tokens';
|
|
7
6
|
import { LabelMedium, LabelSmall, styles as styles$6 } from '@khanacademy/wonder-blocks-typography';
|
|
7
|
+
import { mix } from '@khanacademy/wonder-blocks-color';
|
|
8
8
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
9
9
|
import checkIcon from '@phosphor-icons/core/bold/check-bold.svg';
|
|
10
10
|
import minusIcon from '@phosphor-icons/core/bold/minus-bold.svg';
|
|
@@ -56,9 +56,9 @@ const {
|
|
|
56
56
|
offBlack16: offBlack16$1,
|
|
57
57
|
offBlack32: offBlack32$1,
|
|
58
58
|
offBlack50: offBlack50$1
|
|
59
|
-
} =
|
|
60
|
-
const size$1 =
|
|
61
|
-
const checkSize =
|
|
59
|
+
} = color;
|
|
60
|
+
const size$1 = spacing.medium_16;
|
|
61
|
+
const checkSize = spacing.small_12;
|
|
62
62
|
const StyledInput$2 = addStyle("input");
|
|
63
63
|
const CheckboxCore = React.forwardRef(function CheckboxCore(props, ref) {
|
|
64
64
|
const {
|
|
@@ -142,20 +142,20 @@ const sharedStyles$1 = StyleSheet.create({
|
|
|
142
142
|
margin: (size$1 - checkSize) / 2
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
const fadedBlue$1 = mix(
|
|
146
|
-
const activeBlue
|
|
147
|
-
const fadedRed$1 = mix(
|
|
148
|
-
const activeRed
|
|
145
|
+
const fadedBlue$1 = mix(color.fadedBlue16, white$1);
|
|
146
|
+
const activeBlue = color.activeBlue;
|
|
147
|
+
const fadedRed$1 = mix(color.fadedRed8, white$1);
|
|
148
|
+
const activeRed = color.activeRed;
|
|
149
149
|
const colors$1 = {
|
|
150
150
|
default: {
|
|
151
151
|
faded: fadedBlue$1,
|
|
152
152
|
base: blue$1,
|
|
153
|
-
active: activeBlue
|
|
153
|
+
active: activeBlue
|
|
154
154
|
},
|
|
155
155
|
error: {
|
|
156
156
|
faded: fadedRed$1,
|
|
157
157
|
base: red$1,
|
|
158
|
-
active: activeRed
|
|
158
|
+
active: activeRed
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
const styles$5 = {};
|
|
@@ -200,7 +200,7 @@ const _generateStyles$1 = (checked, error) => {
|
|
|
200
200
|
},
|
|
201
201
|
":active": {
|
|
202
202
|
backgroundColor: palette.faded,
|
|
203
|
-
borderColor: error ? activeRed
|
|
203
|
+
borderColor: error ? activeRed : blue$1,
|
|
204
204
|
borderWidth: 2
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -219,7 +219,7 @@ const {
|
|
|
219
219
|
offBlack16,
|
|
220
220
|
offBlack32,
|
|
221
221
|
offBlack50
|
|
222
|
-
} =
|
|
222
|
+
} = color;
|
|
223
223
|
const StyledInput$1 = addStyle("input");
|
|
224
224
|
const RadioCore = React.forwardRef(function RadioCore(props, ref) {
|
|
225
225
|
const handleChange = () => {
|
|
@@ -286,20 +286,18 @@ const sharedStyles = StyleSheet.create({
|
|
|
286
286
|
borderWidth: 1
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
|
-
const fadedBlue = mix(
|
|
290
|
-
const
|
|
291
|
-
const fadedRed = mix(fade(red, 0.08), white);
|
|
292
|
-
const activeRed = mix(offBlack32, red);
|
|
289
|
+
const fadedBlue = mix(color.fadedBlue16, white);
|
|
290
|
+
const fadedRed = mix(color.fadedRed8, white);
|
|
293
291
|
const colors = {
|
|
294
292
|
default: {
|
|
295
293
|
faded: fadedBlue,
|
|
296
294
|
base: blue,
|
|
297
|
-
active: activeBlue
|
|
295
|
+
active: color.activeBlue
|
|
298
296
|
},
|
|
299
297
|
error: {
|
|
300
298
|
faded: fadedRed,
|
|
301
299
|
base: red,
|
|
302
|
-
active: activeRed
|
|
300
|
+
active: color.activeRed
|
|
303
301
|
}
|
|
304
302
|
};
|
|
305
303
|
const styles$4 = {};
|
|
@@ -345,7 +343,7 @@ const _generateStyles = (checked, error) => {
|
|
|
345
343
|
},
|
|
346
344
|
":active": {
|
|
347
345
|
backgroundColor: palette.faded,
|
|
348
|
-
borderColor: error ? activeRed : blue,
|
|
346
|
+
borderColor: error ? color.activeRed : blue,
|
|
349
347
|
borderWidth: 2
|
|
350
348
|
}
|
|
351
349
|
}
|
|
@@ -418,7 +416,7 @@ const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
|
|
|
418
416
|
error: error,
|
|
419
417
|
ref: ref
|
|
420
418
|
})), React.createElement(Strut, {
|
|
421
|
-
size:
|
|
419
|
+
size: spacing.xSmall_8
|
|
422
420
|
}), label && getLabel(uniqueId)), description && getDescription(descriptionId));
|
|
423
421
|
});
|
|
424
422
|
});
|
|
@@ -432,12 +430,12 @@ const styles$3 = StyleSheet.create({
|
|
|
432
430
|
marginTop: -2
|
|
433
431
|
},
|
|
434
432
|
disabledLabel: {
|
|
435
|
-
color:
|
|
433
|
+
color: color.offBlack32
|
|
436
434
|
},
|
|
437
435
|
description: {
|
|
438
|
-
marginLeft:
|
|
439
|
-
marginTop:
|
|
440
|
-
color:
|
|
436
|
+
marginLeft: spacing.medium_16 + spacing.xSmall_8,
|
|
437
|
+
marginTop: spacing.xxxSmall_4,
|
|
438
|
+
color: color.offBlack64
|
|
441
439
|
}
|
|
442
440
|
});
|
|
443
441
|
|
|
@@ -504,15 +502,15 @@ const styles$2 = StyleSheet.create({
|
|
|
504
502
|
padding: 0
|
|
505
503
|
},
|
|
506
504
|
description: {
|
|
507
|
-
marginTop:
|
|
508
|
-
color:
|
|
505
|
+
marginTop: spacing.xxxSmall_4,
|
|
506
|
+
color: color.offBlack64
|
|
509
507
|
},
|
|
510
508
|
error: {
|
|
511
|
-
marginTop:
|
|
512
|
-
color:
|
|
509
|
+
marginTop: spacing.xxxSmall_4,
|
|
510
|
+
color: color.red
|
|
513
511
|
},
|
|
514
512
|
defaultLineGap: {
|
|
515
|
-
marginTop:
|
|
513
|
+
marginTop: spacing.xSmall_8
|
|
516
514
|
}
|
|
517
515
|
});
|
|
518
516
|
|
|
@@ -553,7 +551,7 @@ const CheckboxGroup = React.forwardRef(function CheckboxGroup(props, ref) {
|
|
|
553
551
|
}, description), errorMessage && React.createElement(LabelSmall, {
|
|
554
552
|
style: styles$2.error
|
|
555
553
|
}, errorMessage), (label || description || errorMessage) && React.createElement(Strut, {
|
|
556
|
-
size:
|
|
554
|
+
size: spacing.small_12
|
|
557
555
|
}), allChildren.map((child, index) => {
|
|
558
556
|
const {
|
|
559
557
|
style,
|
|
@@ -601,7 +599,7 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
|
|
|
601
599
|
}, description), errorMessage && React.createElement(LabelSmall, {
|
|
602
600
|
style: styles$2.error
|
|
603
601
|
}, errorMessage), (label || description || errorMessage) && React.createElement(Strut, {
|
|
604
|
-
size:
|
|
602
|
+
size: spacing.small_12
|
|
605
603
|
}), allChildren.map((child, index) => {
|
|
606
604
|
const {
|
|
607
605
|
style,
|
|
@@ -621,7 +619,7 @@ const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
|
|
|
621
619
|
})));
|
|
622
620
|
});
|
|
623
621
|
|
|
624
|
-
const _excluded = ["id", "type", "value", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
|
|
622
|
+
const _excluded = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
|
|
625
623
|
const defaultErrorMessage = "This field is required.";
|
|
626
624
|
const StyledInput = addStyle("input");
|
|
627
625
|
class TextField extends React.Component {
|
|
@@ -705,6 +703,7 @@ class TextField extends React.Component {
|
|
|
705
703
|
id,
|
|
706
704
|
type,
|
|
707
705
|
value,
|
|
706
|
+
name,
|
|
708
707
|
disabled,
|
|
709
708
|
onKeyDown,
|
|
710
709
|
placeholder,
|
|
@@ -723,6 +722,7 @@ class TextField extends React.Component {
|
|
|
723
722
|
type: type,
|
|
724
723
|
placeholder: placeholder,
|
|
725
724
|
value: value,
|
|
725
|
+
name: name,
|
|
726
726
|
disabled: disabled,
|
|
727
727
|
onChange: this.handleChange,
|
|
728
728
|
onKeyDown: onKeyDown,
|
|
@@ -747,48 +747,48 @@ const styles$1 = StyleSheet.create({
|
|
|
747
747
|
height: 40,
|
|
748
748
|
borderRadius: 4,
|
|
749
749
|
boxSizing: "border-box",
|
|
750
|
-
paddingLeft:
|
|
750
|
+
paddingLeft: spacing.medium_16,
|
|
751
751
|
margin: 0,
|
|
752
752
|
outline: "none",
|
|
753
753
|
boxShadow: "none"
|
|
754
754
|
},
|
|
755
755
|
default: {
|
|
756
|
-
background:
|
|
757
|
-
border: `1px solid ${
|
|
758
|
-
color:
|
|
756
|
+
background: color.white,
|
|
757
|
+
border: `1px solid ${color.offBlack16}`,
|
|
758
|
+
color: color.offBlack,
|
|
759
759
|
"::placeholder": {
|
|
760
|
-
color:
|
|
760
|
+
color: color.offBlack64
|
|
761
761
|
}
|
|
762
762
|
},
|
|
763
763
|
error: {
|
|
764
|
-
background: `${mix(
|
|
765
|
-
border: `1px solid ${
|
|
766
|
-
color:
|
|
764
|
+
background: `${mix(color.fadedRed8, color.white)}`,
|
|
765
|
+
border: `1px solid ${color.red}`,
|
|
766
|
+
color: color.offBlack,
|
|
767
767
|
"::placeholder": {
|
|
768
|
-
color:
|
|
768
|
+
color: color.offBlack64
|
|
769
769
|
}
|
|
770
770
|
},
|
|
771
771
|
disabled: {
|
|
772
|
-
background:
|
|
773
|
-
border: `1px solid ${
|
|
774
|
-
color:
|
|
772
|
+
background: color.offWhite,
|
|
773
|
+
border: `1px solid ${color.offBlack16}`,
|
|
774
|
+
color: color.offBlack64,
|
|
775
775
|
"::placeholder": {
|
|
776
|
-
color:
|
|
776
|
+
color: color.offBlack32
|
|
777
777
|
}
|
|
778
778
|
},
|
|
779
779
|
focused: {
|
|
780
|
-
background:
|
|
781
|
-
border: `1px solid ${
|
|
782
|
-
color:
|
|
780
|
+
background: color.white,
|
|
781
|
+
border: `1px solid ${color.blue}`,
|
|
782
|
+
color: color.offBlack,
|
|
783
783
|
"::placeholder": {
|
|
784
|
-
color:
|
|
784
|
+
color: color.offBlack64
|
|
785
785
|
}
|
|
786
786
|
},
|
|
787
787
|
defaultLight: {
|
|
788
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
788
|
+
boxShadow: `0px 0px 0px 1px ${color.blue}, 0px 0px 0px 2px ${color.white}`
|
|
789
789
|
},
|
|
790
790
|
errorLight: {
|
|
791
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
791
|
+
boxShadow: `0px 0px 0px 1px ${color.red}, 0px 0px 0px 2px ${color.white}`
|
|
792
792
|
}
|
|
793
793
|
});
|
|
794
794
|
var TextField$1 = React.forwardRef((props, ref) => React.createElement(TextField, _extends({}, props, {
|
|
@@ -814,7 +814,7 @@ class FieldHeading extends React.Component {
|
|
|
814
814
|
htmlFor: id && `${id}-field`,
|
|
815
815
|
testId: testId && `${testId}-label`
|
|
816
816
|
}, label, required && requiredIcon), React.createElement(Strut, {
|
|
817
|
-
size:
|
|
817
|
+
size: spacing.xxxSmall_4
|
|
818
818
|
}));
|
|
819
819
|
}
|
|
820
820
|
maybeRenderDescription() {
|
|
@@ -829,7 +829,7 @@ class FieldHeading extends React.Component {
|
|
|
829
829
|
style: styles.description,
|
|
830
830
|
testId: testId && `${testId}-description`
|
|
831
831
|
}, description), React.createElement(Strut, {
|
|
832
|
-
size:
|
|
832
|
+
size: spacing.xxxSmall_4
|
|
833
833
|
}));
|
|
834
834
|
}
|
|
835
835
|
maybeRenderError() {
|
|
@@ -842,7 +842,7 @@ class FieldHeading extends React.Component {
|
|
|
842
842
|
return null;
|
|
843
843
|
}
|
|
844
844
|
return React.createElement(React.Fragment, null, React.createElement(Strut, {
|
|
845
|
-
size:
|
|
845
|
+
size: spacing.small_12
|
|
846
846
|
}), React.createElement(LabelSmall, {
|
|
847
847
|
style: styles.error,
|
|
848
848
|
role: "alert",
|
|
@@ -858,22 +858,22 @@ class FieldHeading extends React.Component {
|
|
|
858
858
|
return React.createElement(View, {
|
|
859
859
|
style: style
|
|
860
860
|
}, this.renderLabel(), this.maybeRenderDescription(), React.createElement(Strut, {
|
|
861
|
-
size:
|
|
861
|
+
size: spacing.xSmall_8
|
|
862
862
|
}), field, this.maybeRenderError());
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
const styles = StyleSheet.create({
|
|
866
866
|
label: {
|
|
867
|
-
color:
|
|
867
|
+
color: color.offBlack
|
|
868
868
|
},
|
|
869
869
|
description: {
|
|
870
|
-
color:
|
|
870
|
+
color: color.offBlack64
|
|
871
871
|
},
|
|
872
872
|
error: {
|
|
873
|
-
color:
|
|
873
|
+
color: color.red
|
|
874
874
|
},
|
|
875
875
|
required: {
|
|
876
|
-
color:
|
|
876
|
+
color: color.red
|
|
877
877
|
}
|
|
878
878
|
});
|
|
879
879
|
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var aphrodite = require('aphrodite');
|
|
7
|
-
var Color = require('@khanacademy/wonder-blocks-color');
|
|
8
7
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
9
8
|
var wonderBlocksLayout = require('@khanacademy/wonder-blocks-layout');
|
|
10
|
-
var
|
|
9
|
+
var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
|
|
11
10
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
11
|
+
var wonderBlocksColor = require('@khanacademy/wonder-blocks-color');
|
|
12
12
|
var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
13
13
|
var checkIcon = require('@phosphor-icons/core/bold/check-bold.svg');
|
|
14
14
|
var minusIcon = require('@phosphor-icons/core/bold/minus-bold.svg');
|
|
@@ -34,8 +34,6 @@ function _interopNamespace(e) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
37
|
-
var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
|
|
38
|
-
var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
|
|
39
37
|
var checkIcon__default = /*#__PURE__*/_interopDefaultLegacy(checkIcon);
|
|
40
38
|
var minusIcon__default = /*#__PURE__*/_interopDefaultLegacy(minusIcon);
|
|
41
39
|
|
|
@@ -86,9 +84,9 @@ const {
|
|
|
86
84
|
offBlack16: offBlack16$1,
|
|
87
85
|
offBlack32: offBlack32$1,
|
|
88
86
|
offBlack50: offBlack50$1
|
|
89
|
-
} =
|
|
90
|
-
const size$1 =
|
|
91
|
-
const checkSize =
|
|
87
|
+
} = wonderBlocksTokens.color;
|
|
88
|
+
const size$1 = wonderBlocksTokens.spacing.medium_16;
|
|
89
|
+
const checkSize = wonderBlocksTokens.spacing.small_12;
|
|
92
90
|
const StyledInput$2 = wonderBlocksCore.addStyle("input");
|
|
93
91
|
const CheckboxCore = React__namespace.forwardRef(function CheckboxCore(props, ref) {
|
|
94
92
|
const {
|
|
@@ -172,20 +170,20 @@ const sharedStyles$1 = aphrodite.StyleSheet.create({
|
|
|
172
170
|
margin: (size$1 - checkSize) / 2
|
|
173
171
|
}
|
|
174
172
|
});
|
|
175
|
-
const fadedBlue$1 =
|
|
176
|
-
const activeBlue
|
|
177
|
-
const fadedRed$1 =
|
|
178
|
-
const activeRed
|
|
173
|
+
const fadedBlue$1 = wonderBlocksColor.mix(wonderBlocksTokens.color.fadedBlue16, white$1);
|
|
174
|
+
const activeBlue = wonderBlocksTokens.color.activeBlue;
|
|
175
|
+
const fadedRed$1 = wonderBlocksColor.mix(wonderBlocksTokens.color.fadedRed8, white$1);
|
|
176
|
+
const activeRed = wonderBlocksTokens.color.activeRed;
|
|
179
177
|
const colors$1 = {
|
|
180
178
|
default: {
|
|
181
179
|
faded: fadedBlue$1,
|
|
182
180
|
base: blue$1,
|
|
183
|
-
active: activeBlue
|
|
181
|
+
active: activeBlue
|
|
184
182
|
},
|
|
185
183
|
error: {
|
|
186
184
|
faded: fadedRed$1,
|
|
187
185
|
base: red$1,
|
|
188
|
-
active: activeRed
|
|
186
|
+
active: activeRed
|
|
189
187
|
}
|
|
190
188
|
};
|
|
191
189
|
const styles$5 = {};
|
|
@@ -230,7 +228,7 @@ const _generateStyles$1 = (checked, error) => {
|
|
|
230
228
|
},
|
|
231
229
|
":active": {
|
|
232
230
|
backgroundColor: palette.faded,
|
|
233
|
-
borderColor: error ? activeRed
|
|
231
|
+
borderColor: error ? activeRed : blue$1,
|
|
234
232
|
borderWidth: 2
|
|
235
233
|
}
|
|
236
234
|
}
|
|
@@ -249,7 +247,7 @@ const {
|
|
|
249
247
|
offBlack16,
|
|
250
248
|
offBlack32,
|
|
251
249
|
offBlack50
|
|
252
|
-
} =
|
|
250
|
+
} = wonderBlocksTokens.color;
|
|
253
251
|
const StyledInput$1 = wonderBlocksCore.addStyle("input");
|
|
254
252
|
const RadioCore = React__namespace.forwardRef(function RadioCore(props, ref) {
|
|
255
253
|
const handleChange = () => {
|
|
@@ -316,20 +314,18 @@ const sharedStyles = aphrodite.StyleSheet.create({
|
|
|
316
314
|
borderWidth: 1
|
|
317
315
|
}
|
|
318
316
|
});
|
|
319
|
-
const fadedBlue =
|
|
320
|
-
const
|
|
321
|
-
const fadedRed = Color.mix(Color.fade(red, 0.08), white);
|
|
322
|
-
const activeRed = Color.mix(offBlack32, red);
|
|
317
|
+
const fadedBlue = wonderBlocksColor.mix(wonderBlocksTokens.color.fadedBlue16, white);
|
|
318
|
+
const fadedRed = wonderBlocksColor.mix(wonderBlocksTokens.color.fadedRed8, white);
|
|
323
319
|
const colors = {
|
|
324
320
|
default: {
|
|
325
321
|
faded: fadedBlue,
|
|
326
322
|
base: blue,
|
|
327
|
-
active: activeBlue
|
|
323
|
+
active: wonderBlocksTokens.color.activeBlue
|
|
328
324
|
},
|
|
329
325
|
error: {
|
|
330
326
|
faded: fadedRed,
|
|
331
327
|
base: red,
|
|
332
|
-
active: activeRed
|
|
328
|
+
active: wonderBlocksTokens.color.activeRed
|
|
333
329
|
}
|
|
334
330
|
};
|
|
335
331
|
const styles$4 = {};
|
|
@@ -375,7 +371,7 @@ const _generateStyles = (checked, error) => {
|
|
|
375
371
|
},
|
|
376
372
|
":active": {
|
|
377
373
|
backgroundColor: palette.faded,
|
|
378
|
-
borderColor: error ? activeRed : blue,
|
|
374
|
+
borderColor: error ? wonderBlocksTokens.color.activeRed : blue,
|
|
379
375
|
borderWidth: 2
|
|
380
376
|
}
|
|
381
377
|
}
|
|
@@ -448,7 +444,7 @@ const ChoiceInternal = React__namespace.forwardRef(function ChoiceInternal(props
|
|
|
448
444
|
error: error,
|
|
449
445
|
ref: ref
|
|
450
446
|
})), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
451
|
-
size:
|
|
447
|
+
size: wonderBlocksTokens.spacing.xSmall_8
|
|
452
448
|
}), label && getLabel(uniqueId)), description && getDescription(descriptionId));
|
|
453
449
|
});
|
|
454
450
|
});
|
|
@@ -462,12 +458,12 @@ const styles$3 = aphrodite.StyleSheet.create({
|
|
|
462
458
|
marginTop: -2
|
|
463
459
|
},
|
|
464
460
|
disabledLabel: {
|
|
465
|
-
color:
|
|
461
|
+
color: wonderBlocksTokens.color.offBlack32
|
|
466
462
|
},
|
|
467
463
|
description: {
|
|
468
|
-
marginLeft:
|
|
469
|
-
marginTop:
|
|
470
|
-
color:
|
|
464
|
+
marginLeft: wonderBlocksTokens.spacing.medium_16 + wonderBlocksTokens.spacing.xSmall_8,
|
|
465
|
+
marginTop: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
466
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
471
467
|
}
|
|
472
468
|
});
|
|
473
469
|
|
|
@@ -534,15 +530,15 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
534
530
|
padding: 0
|
|
535
531
|
},
|
|
536
532
|
description: {
|
|
537
|
-
marginTop:
|
|
538
|
-
color:
|
|
533
|
+
marginTop: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
534
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
539
535
|
},
|
|
540
536
|
error: {
|
|
541
|
-
marginTop:
|
|
542
|
-
color:
|
|
537
|
+
marginTop: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
538
|
+
color: wonderBlocksTokens.color.red
|
|
543
539
|
},
|
|
544
540
|
defaultLineGap: {
|
|
545
|
-
marginTop:
|
|
541
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8
|
|
546
542
|
}
|
|
547
543
|
});
|
|
548
544
|
|
|
@@ -583,7 +579,7 @@ const CheckboxGroup = React__namespace.forwardRef(function CheckboxGroup(props,
|
|
|
583
579
|
}, description), errorMessage && React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
584
580
|
style: styles$2.error
|
|
585
581
|
}, errorMessage), (label || description || errorMessage) && React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
586
|
-
size:
|
|
582
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
587
583
|
}), allChildren.map((child, index) => {
|
|
588
584
|
const {
|
|
589
585
|
style,
|
|
@@ -631,7 +627,7 @@ const RadioGroup = React__namespace.forwardRef(function RadioGroup(props, ref) {
|
|
|
631
627
|
}, description), errorMessage && React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
632
628
|
style: styles$2.error
|
|
633
629
|
}, errorMessage), (label || description || errorMessage) && React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
634
|
-
size:
|
|
630
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
635
631
|
}), allChildren.map((child, index) => {
|
|
636
632
|
const {
|
|
637
633
|
style,
|
|
@@ -651,7 +647,7 @@ const RadioGroup = React__namespace.forwardRef(function RadioGroup(props, ref) {
|
|
|
651
647
|
})));
|
|
652
648
|
});
|
|
653
649
|
|
|
654
|
-
const _excluded = ["id", "type", "value", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
|
|
650
|
+
const _excluded = ["id", "type", "value", "name", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
|
|
655
651
|
const defaultErrorMessage = "This field is required.";
|
|
656
652
|
const StyledInput = wonderBlocksCore.addStyle("input");
|
|
657
653
|
class TextField extends React__namespace.Component {
|
|
@@ -735,6 +731,7 @@ class TextField extends React__namespace.Component {
|
|
|
735
731
|
id,
|
|
736
732
|
type,
|
|
737
733
|
value,
|
|
734
|
+
name,
|
|
738
735
|
disabled,
|
|
739
736
|
onKeyDown,
|
|
740
737
|
placeholder,
|
|
@@ -753,6 +750,7 @@ class TextField extends React__namespace.Component {
|
|
|
753
750
|
type: type,
|
|
754
751
|
placeholder: placeholder,
|
|
755
752
|
value: value,
|
|
753
|
+
name: name,
|
|
756
754
|
disabled: disabled,
|
|
757
755
|
onChange: this.handleChange,
|
|
758
756
|
onKeyDown: onKeyDown,
|
|
@@ -777,48 +775,48 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
777
775
|
height: 40,
|
|
778
776
|
borderRadius: 4,
|
|
779
777
|
boxSizing: "border-box",
|
|
780
|
-
paddingLeft:
|
|
778
|
+
paddingLeft: wonderBlocksTokens.spacing.medium_16,
|
|
781
779
|
margin: 0,
|
|
782
780
|
outline: "none",
|
|
783
781
|
boxShadow: "none"
|
|
784
782
|
},
|
|
785
783
|
default: {
|
|
786
|
-
background:
|
|
787
|
-
border: `1px solid ${
|
|
788
|
-
color:
|
|
784
|
+
background: wonderBlocksTokens.color.white,
|
|
785
|
+
border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
786
|
+
color: wonderBlocksTokens.color.offBlack,
|
|
789
787
|
"::placeholder": {
|
|
790
|
-
color:
|
|
788
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
791
789
|
}
|
|
792
790
|
},
|
|
793
791
|
error: {
|
|
794
|
-
background: `${
|
|
795
|
-
border: `1px solid ${
|
|
796
|
-
color:
|
|
792
|
+
background: `${wonderBlocksColor.mix(wonderBlocksTokens.color.fadedRed8, wonderBlocksTokens.color.white)}`,
|
|
793
|
+
border: `1px solid ${wonderBlocksTokens.color.red}`,
|
|
794
|
+
color: wonderBlocksTokens.color.offBlack,
|
|
797
795
|
"::placeholder": {
|
|
798
|
-
color:
|
|
796
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
799
797
|
}
|
|
800
798
|
},
|
|
801
799
|
disabled: {
|
|
802
|
-
background:
|
|
803
|
-
border: `1px solid ${
|
|
804
|
-
color:
|
|
800
|
+
background: wonderBlocksTokens.color.offWhite,
|
|
801
|
+
border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
802
|
+
color: wonderBlocksTokens.color.offBlack64,
|
|
805
803
|
"::placeholder": {
|
|
806
|
-
color:
|
|
804
|
+
color: wonderBlocksTokens.color.offBlack32
|
|
807
805
|
}
|
|
808
806
|
},
|
|
809
807
|
focused: {
|
|
810
|
-
background:
|
|
811
|
-
border: `1px solid ${
|
|
812
|
-
color:
|
|
808
|
+
background: wonderBlocksTokens.color.white,
|
|
809
|
+
border: `1px solid ${wonderBlocksTokens.color.blue}`,
|
|
810
|
+
color: wonderBlocksTokens.color.offBlack,
|
|
813
811
|
"::placeholder": {
|
|
814
|
-
color:
|
|
812
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
815
813
|
}
|
|
816
814
|
},
|
|
817
815
|
defaultLight: {
|
|
818
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
816
|
+
boxShadow: `0px 0px 0px 1px ${wonderBlocksTokens.color.blue}, 0px 0px 0px 2px ${wonderBlocksTokens.color.white}`
|
|
819
817
|
},
|
|
820
818
|
errorLight: {
|
|
821
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
819
|
+
boxShadow: `0px 0px 0px 1px ${wonderBlocksTokens.color.red}, 0px 0px 0px 2px ${wonderBlocksTokens.color.white}`
|
|
822
820
|
}
|
|
823
821
|
});
|
|
824
822
|
var TextField$1 = React__namespace.forwardRef((props, ref) => React__namespace.createElement(TextField, _extends({}, props, {
|
|
@@ -844,7 +842,7 @@ class FieldHeading extends React__namespace.Component {
|
|
|
844
842
|
htmlFor: id && `${id}-field`,
|
|
845
843
|
testId: testId && `${testId}-label`
|
|
846
844
|
}, label, required && requiredIcon), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
847
|
-
size:
|
|
845
|
+
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
848
846
|
}));
|
|
849
847
|
}
|
|
850
848
|
maybeRenderDescription() {
|
|
@@ -859,7 +857,7 @@ class FieldHeading extends React__namespace.Component {
|
|
|
859
857
|
style: styles.description,
|
|
860
858
|
testId: testId && `${testId}-description`
|
|
861
859
|
}, description), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
862
|
-
size:
|
|
860
|
+
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
863
861
|
}));
|
|
864
862
|
}
|
|
865
863
|
maybeRenderError() {
|
|
@@ -872,7 +870,7 @@ class FieldHeading extends React__namespace.Component {
|
|
|
872
870
|
return null;
|
|
873
871
|
}
|
|
874
872
|
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
875
|
-
size:
|
|
873
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
876
874
|
}), React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
877
875
|
style: styles.error,
|
|
878
876
|
role: "alert",
|
|
@@ -888,22 +886,22 @@ class FieldHeading extends React__namespace.Component {
|
|
|
888
886
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
889
887
|
style: style
|
|
890
888
|
}, this.renderLabel(), this.maybeRenderDescription(), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
891
|
-
size:
|
|
889
|
+
size: wonderBlocksTokens.spacing.xSmall_8
|
|
892
890
|
}), field, this.maybeRenderError());
|
|
893
891
|
}
|
|
894
892
|
}
|
|
895
893
|
const styles = aphrodite.StyleSheet.create({
|
|
896
894
|
label: {
|
|
897
|
-
color:
|
|
895
|
+
color: wonderBlocksTokens.color.offBlack
|
|
898
896
|
},
|
|
899
897
|
description: {
|
|
900
|
-
color:
|
|
898
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
901
899
|
},
|
|
902
900
|
error: {
|
|
903
|
-
color:
|
|
901
|
+
color: wonderBlocksTokens.color.red
|
|
904
902
|
},
|
|
905
903
|
required: {
|
|
906
|
-
color:
|
|
904
|
+
color: wonderBlocksTokens.color.red
|
|
907
905
|
}
|
|
908
906
|
});
|
|
909
907
|
|