@khanacademy/wonder-blocks-form 4.4.0 → 4.4.2
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 +23 -0
- package/dist/es/index.js +57 -59
- package/dist/index.js +57 -61
- package/package.json +4 -4
- package/src/components/__tests__/labeled-text-field.test.tsx +2 -2
- 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 +21 -21
- package/tsconfig-build.json +1 -1
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-form
|
|
2
2
|
|
|
3
|
+
## 4.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e83f8991]
|
|
8
|
+
- @khanacademy/wonder-blocks-tokens@1.0.0
|
|
9
|
+
- @khanacademy/wonder-blocks-clickable@4.0.14
|
|
10
|
+
- @khanacademy/wonder-blocks-layout@2.0.27
|
|
11
|
+
|
|
12
|
+
## 4.4.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 60aba5b8: Update internal spacing references (from wb-spacing to wb-tokens)
|
|
17
|
+
- 7c51f377: Migrate wb-color imports to use tokens.color
|
|
18
|
+
- Updated dependencies [60aba5b8]
|
|
19
|
+
- Updated dependencies [7cd7f6cc]
|
|
20
|
+
- Updated dependencies [7c51f377]
|
|
21
|
+
- Updated dependencies [7c51f377]
|
|
22
|
+
- @khanacademy/wonder-blocks-layout@2.0.26
|
|
23
|
+
- @khanacademy/wonder-blocks-tokens@0.2.0
|
|
24
|
+
- @khanacademy/wonder-blocks-clickable@4.0.13
|
|
25
|
+
|
|
3
26
|
## 4.4.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
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,
|
|
@@ -749,48 +747,48 @@ const styles$1 = StyleSheet.create({
|
|
|
749
747
|
height: 40,
|
|
750
748
|
borderRadius: 4,
|
|
751
749
|
boxSizing: "border-box",
|
|
752
|
-
paddingLeft:
|
|
750
|
+
paddingLeft: spacing.medium_16,
|
|
753
751
|
margin: 0,
|
|
754
752
|
outline: "none",
|
|
755
753
|
boxShadow: "none"
|
|
756
754
|
},
|
|
757
755
|
default: {
|
|
758
|
-
background:
|
|
759
|
-
border: `1px solid ${
|
|
760
|
-
color:
|
|
756
|
+
background: color.white,
|
|
757
|
+
border: `1px solid ${color.offBlack16}`,
|
|
758
|
+
color: color.offBlack,
|
|
761
759
|
"::placeholder": {
|
|
762
|
-
color:
|
|
760
|
+
color: color.offBlack64
|
|
763
761
|
}
|
|
764
762
|
},
|
|
765
763
|
error: {
|
|
766
|
-
background: `${mix(
|
|
767
|
-
border: `1px solid ${
|
|
768
|
-
color:
|
|
764
|
+
background: `${mix(color.fadedRed8, color.white)}`,
|
|
765
|
+
border: `1px solid ${color.red}`,
|
|
766
|
+
color: color.offBlack,
|
|
769
767
|
"::placeholder": {
|
|
770
|
-
color:
|
|
768
|
+
color: color.offBlack64
|
|
771
769
|
}
|
|
772
770
|
},
|
|
773
771
|
disabled: {
|
|
774
|
-
background:
|
|
775
|
-
border: `1px solid ${
|
|
776
|
-
color:
|
|
772
|
+
background: color.offWhite,
|
|
773
|
+
border: `1px solid ${color.offBlack16}`,
|
|
774
|
+
color: color.offBlack64,
|
|
777
775
|
"::placeholder": {
|
|
778
|
-
color:
|
|
776
|
+
color: color.offBlack32
|
|
779
777
|
}
|
|
780
778
|
},
|
|
781
779
|
focused: {
|
|
782
|
-
background:
|
|
783
|
-
border: `1px solid ${
|
|
784
|
-
color:
|
|
780
|
+
background: color.white,
|
|
781
|
+
border: `1px solid ${color.blue}`,
|
|
782
|
+
color: color.offBlack,
|
|
785
783
|
"::placeholder": {
|
|
786
|
-
color:
|
|
784
|
+
color: color.offBlack64
|
|
787
785
|
}
|
|
788
786
|
},
|
|
789
787
|
defaultLight: {
|
|
790
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
788
|
+
boxShadow: `0px 0px 0px 1px ${color.blue}, 0px 0px 0px 2px ${color.white}`
|
|
791
789
|
},
|
|
792
790
|
errorLight: {
|
|
793
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
791
|
+
boxShadow: `0px 0px 0px 1px ${color.red}, 0px 0px 0px 2px ${color.white}`
|
|
794
792
|
}
|
|
795
793
|
});
|
|
796
794
|
var TextField$1 = React.forwardRef((props, ref) => React.createElement(TextField, _extends({}, props, {
|
|
@@ -816,7 +814,7 @@ class FieldHeading extends React.Component {
|
|
|
816
814
|
htmlFor: id && `${id}-field`,
|
|
817
815
|
testId: testId && `${testId}-label`
|
|
818
816
|
}, label, required && requiredIcon), React.createElement(Strut, {
|
|
819
|
-
size:
|
|
817
|
+
size: spacing.xxxSmall_4
|
|
820
818
|
}));
|
|
821
819
|
}
|
|
822
820
|
maybeRenderDescription() {
|
|
@@ -831,7 +829,7 @@ class FieldHeading extends React.Component {
|
|
|
831
829
|
style: styles.description,
|
|
832
830
|
testId: testId && `${testId}-description`
|
|
833
831
|
}, description), React.createElement(Strut, {
|
|
834
|
-
size:
|
|
832
|
+
size: spacing.xxxSmall_4
|
|
835
833
|
}));
|
|
836
834
|
}
|
|
837
835
|
maybeRenderError() {
|
|
@@ -844,7 +842,7 @@ class FieldHeading extends React.Component {
|
|
|
844
842
|
return null;
|
|
845
843
|
}
|
|
846
844
|
return React.createElement(React.Fragment, null, React.createElement(Strut, {
|
|
847
|
-
size:
|
|
845
|
+
size: spacing.small_12
|
|
848
846
|
}), React.createElement(LabelSmall, {
|
|
849
847
|
style: styles.error,
|
|
850
848
|
role: "alert",
|
|
@@ -860,22 +858,22 @@ class FieldHeading extends React.Component {
|
|
|
860
858
|
return React.createElement(View, {
|
|
861
859
|
style: style
|
|
862
860
|
}, this.renderLabel(), this.maybeRenderDescription(), React.createElement(Strut, {
|
|
863
|
-
size:
|
|
861
|
+
size: spacing.xSmall_8
|
|
864
862
|
}), field, this.maybeRenderError());
|
|
865
863
|
}
|
|
866
864
|
}
|
|
867
865
|
const styles = StyleSheet.create({
|
|
868
866
|
label: {
|
|
869
|
-
color:
|
|
867
|
+
color: color.offBlack
|
|
870
868
|
},
|
|
871
869
|
description: {
|
|
872
|
-
color:
|
|
870
|
+
color: color.offBlack64
|
|
873
871
|
},
|
|
874
872
|
error: {
|
|
875
|
-
color:
|
|
873
|
+
color: color.red
|
|
876
874
|
},
|
|
877
875
|
required: {
|
|
878
|
-
color:
|
|
876
|
+
color: color.red
|
|
879
877
|
}
|
|
880
878
|
});
|
|
881
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,
|
|
@@ -779,48 +775,48 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
779
775
|
height: 40,
|
|
780
776
|
borderRadius: 4,
|
|
781
777
|
boxSizing: "border-box",
|
|
782
|
-
paddingLeft:
|
|
778
|
+
paddingLeft: wonderBlocksTokens.spacing.medium_16,
|
|
783
779
|
margin: 0,
|
|
784
780
|
outline: "none",
|
|
785
781
|
boxShadow: "none"
|
|
786
782
|
},
|
|
787
783
|
default: {
|
|
788
|
-
background:
|
|
789
|
-
border: `1px solid ${
|
|
790
|
-
color:
|
|
784
|
+
background: wonderBlocksTokens.color.white,
|
|
785
|
+
border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
786
|
+
color: wonderBlocksTokens.color.offBlack,
|
|
791
787
|
"::placeholder": {
|
|
792
|
-
color:
|
|
788
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
793
789
|
}
|
|
794
790
|
},
|
|
795
791
|
error: {
|
|
796
|
-
background: `${
|
|
797
|
-
border: `1px solid ${
|
|
798
|
-
color:
|
|
792
|
+
background: `${wonderBlocksColor.mix(wonderBlocksTokens.color.fadedRed8, wonderBlocksTokens.color.white)}`,
|
|
793
|
+
border: `1px solid ${wonderBlocksTokens.color.red}`,
|
|
794
|
+
color: wonderBlocksTokens.color.offBlack,
|
|
799
795
|
"::placeholder": {
|
|
800
|
-
color:
|
|
796
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
801
797
|
}
|
|
802
798
|
},
|
|
803
799
|
disabled: {
|
|
804
|
-
background:
|
|
805
|
-
border: `1px solid ${
|
|
806
|
-
color:
|
|
800
|
+
background: wonderBlocksTokens.color.offWhite,
|
|
801
|
+
border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
802
|
+
color: wonderBlocksTokens.color.offBlack64,
|
|
807
803
|
"::placeholder": {
|
|
808
|
-
color:
|
|
804
|
+
color: wonderBlocksTokens.color.offBlack32
|
|
809
805
|
}
|
|
810
806
|
},
|
|
811
807
|
focused: {
|
|
812
|
-
background:
|
|
813
|
-
border: `1px solid ${
|
|
814
|
-
color:
|
|
808
|
+
background: wonderBlocksTokens.color.white,
|
|
809
|
+
border: `1px solid ${wonderBlocksTokens.color.blue}`,
|
|
810
|
+
color: wonderBlocksTokens.color.offBlack,
|
|
815
811
|
"::placeholder": {
|
|
816
|
-
color:
|
|
812
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
817
813
|
}
|
|
818
814
|
},
|
|
819
815
|
defaultLight: {
|
|
820
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
816
|
+
boxShadow: `0px 0px 0px 1px ${wonderBlocksTokens.color.blue}, 0px 0px 0px 2px ${wonderBlocksTokens.color.white}`
|
|
821
817
|
},
|
|
822
818
|
errorLight: {
|
|
823
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
819
|
+
boxShadow: `0px 0px 0px 1px ${wonderBlocksTokens.color.red}, 0px 0px 0px 2px ${wonderBlocksTokens.color.white}`
|
|
824
820
|
}
|
|
825
821
|
});
|
|
826
822
|
var TextField$1 = React__namespace.forwardRef((props, ref) => React__namespace.createElement(TextField, _extends({}, props, {
|
|
@@ -846,7 +842,7 @@ class FieldHeading extends React__namespace.Component {
|
|
|
846
842
|
htmlFor: id && `${id}-field`,
|
|
847
843
|
testId: testId && `${testId}-label`
|
|
848
844
|
}, label, required && requiredIcon), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
849
|
-
size:
|
|
845
|
+
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
850
846
|
}));
|
|
851
847
|
}
|
|
852
848
|
maybeRenderDescription() {
|
|
@@ -861,7 +857,7 @@ class FieldHeading extends React__namespace.Component {
|
|
|
861
857
|
style: styles.description,
|
|
862
858
|
testId: testId && `${testId}-description`
|
|
863
859
|
}, description), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
864
|
-
size:
|
|
860
|
+
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
865
861
|
}));
|
|
866
862
|
}
|
|
867
863
|
maybeRenderError() {
|
|
@@ -874,7 +870,7 @@ class FieldHeading extends React__namespace.Component {
|
|
|
874
870
|
return null;
|
|
875
871
|
}
|
|
876
872
|
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
877
|
-
size:
|
|
873
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
878
874
|
}), React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
879
875
|
style: styles.error,
|
|
880
876
|
role: "alert",
|
|
@@ -890,22 +886,22 @@ class FieldHeading extends React__namespace.Component {
|
|
|
890
886
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
891
887
|
style: style
|
|
892
888
|
}, this.renderLabel(), this.maybeRenderDescription(), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
893
|
-
size:
|
|
889
|
+
size: wonderBlocksTokens.spacing.xSmall_8
|
|
894
890
|
}), field, this.maybeRenderError());
|
|
895
891
|
}
|
|
896
892
|
}
|
|
897
893
|
const styles = aphrodite.StyleSheet.create({
|
|
898
894
|
label: {
|
|
899
|
-
color:
|
|
895
|
+
color: wonderBlocksTokens.color.offBlack
|
|
900
896
|
},
|
|
901
897
|
description: {
|
|
902
|
-
color:
|
|
898
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
903
899
|
},
|
|
904
900
|
error: {
|
|
905
|
-
color:
|
|
901
|
+
color: wonderBlocksTokens.color.red
|
|
906
902
|
},
|
|
907
903
|
required: {
|
|
908
|
-
color:
|
|
904
|
+
color: wonderBlocksTokens.color.red
|
|
909
905
|
}
|
|
910
906
|
});
|
|
911
907
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-form",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2",
|
|
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": "^4.0.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^4.0.14",
|
|
20
20
|
"@khanacademy/wonder-blocks-color": "^3.0.0",
|
|
21
21
|
"@khanacademy/wonder-blocks-core": "^6.3.1",
|
|
22
22
|
"@khanacademy/wonder-blocks-icon": "^4.0.1",
|
|
23
|
-
"@khanacademy/wonder-blocks-layout": "^2.0.
|
|
24
|
-
"@khanacademy/wonder-blocks-
|
|
23
|
+
"@khanacademy/wonder-blocks-layout": "^2.0.27",
|
|
24
|
+
"@khanacademy/wonder-blocks-tokens": "^1.0.0",
|
|
25
25
|
"@khanacademy/wonder-blocks-typography": "^2.1.10"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
@@ -3,7 +3,7 @@ import {render, screen, fireEvent} from "@testing-library/react";
|
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
4
|
|
|
5
5
|
import {StyleSheet} from "aphrodite";
|
|
6
|
-
import
|
|
6
|
+
import {color} from "@khanacademy/wonder-blocks-tokens";
|
|
7
7
|
import LabeledTextField from "../labeled-text-field";
|
|
8
8
|
|
|
9
9
|
describe("LabeledTextField", () => {
|
|
@@ -394,7 +394,7 @@ describe("LabeledTextField", () => {
|
|
|
394
394
|
|
|
395
395
|
// Assert
|
|
396
396
|
expect(textField).toHaveStyle({
|
|
397
|
-
boxShadow: `0px 0px 0px 1px ${
|
|
397
|
+
boxShadow: `0px 0px 0px 1px ${color.blue}, 0px 0px 0px 2px ${color.white}`,
|
|
398
398
|
});
|
|
399
399
|
});
|
|
400
400
|
|