@khanacademy/wonder-blocks-form 6.0.6 → 7.0.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/dist/index.js CHANGED
@@ -51,15 +51,6 @@ function mapCheckedToAriaChecked(value) {
51
51
  return "mixed";
52
52
  }
53
53
  }
54
- const {
55
- blue: blue$1,
56
- red: red$1,
57
- white: white$1,
58
- offWhite: offWhite$1,
59
- offBlack16: offBlack16$1,
60
- offBlack32: offBlack32$1,
61
- offBlack50: offBlack50$1
62
- } = wonderBlocksTokens.color;
63
54
  const size$1 = wonderBlocksTokens.spacing.medium_16;
64
55
  const checkSize = wonderBlocksTokens.spacing.small_12;
65
56
  const StyledInput$2 = wonderBlocksCore.addStyle("input");
@@ -85,7 +76,7 @@ const CheckboxCore = React__namespace.forwardRef(function CheckboxCore(props, re
85
76
  const stateStyles = _generateStyles$1(checked, error);
86
77
  const defaultStyle = [sharedStyles$1.inputReset, sharedStyles$1.default, !disabled && stateStyles.default, disabled && sharedStyles$1.disabled];
87
78
  const checkboxIcon = React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
88
- color: disabled ? offBlack32$1 : white$1,
79
+ color: disabled ? wonderBlocksTokens.semanticColor.icon.disabled : wonderBlocksTokens.semanticColor.icon.inverse,
89
80
  icon: checked ? checkIcon__default["default"] : minusIcon__default["default"],
90
81
  size: "small",
91
82
  style: [sharedStyles$1.checkboxIcon, {
@@ -115,6 +106,10 @@ const CheckboxCore = React__namespace.forwardRef(function CheckboxCore(props, re
115
106
  "data-testid": testId
116
107
  })), checked || checked == null ? checkboxIcon : React__namespace.createElement(React__namespace.Fragment, null));
117
108
  });
109
+ const disabledState$1 = {
110
+ border: wonderBlocksTokens.semanticColor.border.primary,
111
+ background: wonderBlocksTokens.semanticColor.action.disabled.secondary
112
+ };
118
113
  const sharedStyles$1 = aphrodite.StyleSheet.create({
119
114
  inputReset: {
120
115
  appearance: "none",
@@ -130,14 +125,14 @@ const sharedStyles$1 = aphrodite.StyleSheet.create({
130
125
  outline: "none",
131
126
  boxSizing: "border-box",
132
127
  borderStyle: "solid",
133
- borderWidth: 1,
134
- borderRadius: 3
128
+ borderWidth: wonderBlocksTokens.border.width.hairline,
129
+ borderRadius: wonderBlocksTokens.border.radius.small_3
135
130
  },
136
131
  disabled: {
137
132
  cursor: "auto",
138
- backgroundColor: offWhite$1,
139
- borderColor: offBlack16$1,
140
- borderWidth: 1
133
+ backgroundColor: disabledState$1.background,
134
+ borderColor: disabledState$1.border,
135
+ borderWidth: wonderBlocksTokens.border.width.hairline
141
136
  },
142
137
  checkboxIcon: {
143
138
  position: "absolute",
@@ -145,66 +140,67 @@ const sharedStyles$1 = aphrodite.StyleSheet.create({
145
140
  margin: (size$1 - checkSize) / 2
146
141
  }
147
142
  });
148
- const fadedBlue$1 = wonderBlocksTokens.mix(wonderBlocksTokens.color.fadedBlue16, white$1);
149
- const activeBlue = wonderBlocksTokens.color.activeBlue;
150
- const fadedRed$1 = wonderBlocksTokens.mix(wonderBlocksTokens.color.fadedRed8, white$1);
151
- const activeRed = wonderBlocksTokens.color.activeRed;
152
- const colors$1 = {
153
- default: {
154
- faded: fadedBlue$1,
155
- base: blue$1,
156
- active: activeBlue
157
- },
158
- error: {
159
- faded: fadedRed$1,
160
- base: red$1,
161
- active: activeRed
162
- }
163
- };
164
143
  const styles$6 = {};
165
144
  const _generateStyles$1 = (checked, error) => {
166
145
  const styleKey = `${String(checked)}-${String(error)}`;
167
146
  if (styles$6[styleKey]) {
168
147
  return styles$6[styleKey];
169
148
  }
170
- const palette = error ? colors$1.error : colors$1.default;
149
+ const isCheckedOrIndeterminate = checked || checked == null;
150
+ const actionType = error ? "destructive" : "progressive";
151
+ const styleType = isCheckedOrIndeterminate ? "filled" : "outlined";
152
+ const colorAction = wonderBlocksTokens.semanticColor.action[styleType][actionType];
153
+ const states = {
154
+ default: {
155
+ border: colorAction.default.border,
156
+ background: colorAction.default.background
157
+ },
158
+ error: {
159
+ border: wonderBlocksTokens.semanticColor.status.critical.foreground,
160
+ background: wonderBlocksTokens.semanticColor.status.critical.background
161
+ }
162
+ };
171
163
  let newStyles = {};
172
- if (checked || checked == null) {
164
+ if (isCheckedOrIndeterminate) {
173
165
  newStyles = {
174
166
  default: {
175
- backgroundColor: palette.base,
176
- borderWidth: 0,
167
+ backgroundColor: states.default.background,
168
+ borderColor: states.default.border,
177
169
  ":focus-visible": {
178
- boxShadow: `0 0 0 1px ${white$1}, 0 0 0 3px ${palette.base}`
170
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
171
+ outlineOffset: 1
179
172
  },
180
173
  ":hover": {
181
- boxShadow: `0 0 0 1px ${white$1}, 0 0 0 3px ${palette.base}`
174
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
175
+ outlineOffset: 1
182
176
  },
183
177
  ":active": {
184
- boxShadow: `0 0 0 1px ${white$1}, 0 0 0 3px ${palette.active}`,
185
- background: palette.active
178
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.press.border}`,
179
+ outlineOffset: 1,
180
+ background: colorAction.press.background
186
181
  }
187
182
  }
188
183
  };
189
184
  } else {
185
+ const currentState = error ? states.error : states.default;
190
186
  newStyles = {
191
187
  default: {
192
- backgroundColor: error ? fadedRed$1 : white$1,
193
- borderColor: error ? red$1 : offBlack50$1,
188
+ backgroundColor: currentState.background,
189
+ borderColor: currentState.border,
194
190
  ":focus-visible": {
195
- backgroundColor: error ? fadedRed$1 : white$1,
196
- borderColor: palette.base,
197
- borderWidth: 2
191
+ backgroundColor: error ? states.error.background : colorAction.hover.background,
192
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
193
+ outlineOffset: -1
198
194
  },
199
195
  ":hover": {
200
- backgroundColor: error ? fadedRed$1 : white$1,
201
- borderColor: palette.base,
202
- borderWidth: 2
196
+ backgroundColor: error ? states.error.background : colorAction.hover.background,
197
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
198
+ outlineOffset: -1
203
199
  },
204
200
  ":active": {
205
- backgroundColor: palette.faded,
206
- borderColor: error ? activeRed : blue$1,
207
- borderWidth: 2
201
+ backgroundColor: colorAction.press.background,
202
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.press.border}`,
203
+ outlineOffset: -1
208
204
  }
209
205
  }
210
206
  };
@@ -214,15 +210,6 @@ const _generateStyles$1 = (checked, error) => {
214
210
  };
215
211
 
216
212
  const _excluded$6 = ["checked", "disabled", "error", "groupName", "id", "testId"];
217
- const {
218
- blue,
219
- red,
220
- white,
221
- offWhite,
222
- offBlack16,
223
- offBlack32,
224
- offBlack50
225
- } = wonderBlocksTokens.color;
226
213
  const StyledInput$1 = wonderBlocksCore.addStyle("input");
227
214
  const RadioCore = React__namespace.forwardRef(function RadioCore(props, ref) {
228
215
  const handleChange = () => {
@@ -254,6 +241,10 @@ const RadioCore = React__namespace.forwardRef(function RadioCore(props, ref) {
254
241
  style: disabledChecked
255
242
  }));
256
243
  });
244
+ const disabledState = {
245
+ border: wonderBlocksTokens.semanticColor.border.primary,
246
+ background: wonderBlocksTokens.semanticColor.action.disabled.secondary
247
+ };
257
248
  const size = 16;
258
249
  const disabledChecked = {
259
250
  position: "absolute",
@@ -262,7 +253,7 @@ const disabledChecked = {
262
253
  height: size / 2,
263
254
  width: size / 2,
264
255
  borderRadius: "50%",
265
- backgroundColor: offBlack32
256
+ backgroundColor: wonderBlocksTokens.semanticColor.action.disabled.default
266
257
  };
267
258
  const sharedStyles = aphrodite.StyleSheet.create({
268
259
  inputReset: {
@@ -279,75 +270,80 @@ const sharedStyles = aphrodite.StyleSheet.create({
279
270
  outline: "none",
280
271
  boxSizing: "border-box",
281
272
  borderStyle: "solid",
282
- borderWidth: 1,
273
+ borderWidth: wonderBlocksTokens.border.width.hairline,
283
274
  borderRadius: "50%"
284
275
  },
285
276
  disabled: {
286
277
  cursor: "auto",
287
- backgroundColor: offWhite,
288
- borderColor: offBlack16,
289
- borderWidth: 1
278
+ backgroundColor: disabledState.background,
279
+ borderColor: disabledState.border,
280
+ borderWidth: wonderBlocksTokens.border.width.hairline
290
281
  }
291
282
  });
292
- const fadedBlue = wonderBlocksTokens.mix(wonderBlocksTokens.color.fadedBlue16, white);
293
- const fadedRed = wonderBlocksTokens.mix(wonderBlocksTokens.color.fadedRed8, white);
294
- const colors = {
295
- default: {
296
- faded: fadedBlue,
297
- base: blue,
298
- active: wonderBlocksTokens.color.activeBlue
299
- },
300
- error: {
301
- faded: fadedRed,
302
- base: red,
303
- active: wonderBlocksTokens.color.activeRed
304
- }
305
- };
306
283
  const styles$5 = {};
307
284
  const _generateStyles = (checked, error) => {
308
285
  const styleKey = `${String(checked)}-${String(error)}`;
309
286
  if (styles$5[styleKey]) {
310
287
  return styles$5[styleKey];
311
288
  }
312
- const palette = error ? colors.error : colors.default;
289
+ const actionType = error ? "destructive" : "progressive";
290
+ const colorAction = wonderBlocksTokens.semanticColor.action.outlined[actionType];
291
+ const states = {
292
+ unchecked: {
293
+ border: wonderBlocksTokens.semanticColor.border.strong,
294
+ background: colorAction.default.background
295
+ },
296
+ checked: {
297
+ border: colorAction.default.foreground,
298
+ background: colorAction.default.background
299
+ },
300
+ error: {
301
+ border: wonderBlocksTokens.semanticColor.status.critical.foreground,
302
+ background: wonderBlocksTokens.semanticColor.status.critical.background
303
+ }
304
+ };
313
305
  let newStyles = {};
314
306
  if (checked) {
315
307
  newStyles = {
316
308
  default: {
317
- backgroundColor: white,
318
- borderColor: palette.base,
309
+ backgroundColor: states.checked.background,
310
+ borderColor: states.checked.border,
319
311
  borderWidth: size / 4,
320
312
  ":focus-visible": {
321
- boxShadow: `0 0 0 1px ${white}, 0 0 0 3px ${palette.base}`
313
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
314
+ outlineOffset: 1
322
315
  },
323
316
  ":hover": {
324
- boxShadow: `0 0 0 1px ${white}, 0 0 0 3px ${palette.base}`
317
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
318
+ outlineOffset: 1
325
319
  },
326
320
  ":active": {
327
- boxShadow: `0 0 0 1px ${white}, 0 0 0 3px ${palette.active}`,
328
- borderColor: palette.active
321
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.press.border}`,
322
+ outlineOffset: 1,
323
+ borderColor: colorAction.press.border
329
324
  }
330
325
  }
331
326
  };
332
327
  } else {
328
+ const currentState = error ? states.error : states.unchecked;
333
329
  newStyles = {
334
330
  default: {
335
- backgroundColor: error ? fadedRed : white,
336
- borderColor: error ? red : offBlack50,
331
+ backgroundColor: currentState.background,
332
+ borderColor: currentState.border,
337
333
  ":focus-visible": {
338
- backgroundColor: error ? fadedRed : white,
339
- borderColor: palette.base,
340
- borderWidth: 2
334
+ backgroundColor: error ? states.error.background : colorAction.hover.background,
335
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
336
+ outlineOffset: -1
341
337
  },
342
338
  ":hover": {
343
- backgroundColor: error ? fadedRed : white,
344
- borderColor: palette.base,
345
- borderWidth: 2
339
+ backgroundColor: error ? states.error.background : colorAction.hover.background,
340
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
341
+ outlineOffset: -1
346
342
  },
347
343
  ":active": {
348
- backgroundColor: palette.faded,
349
- borderColor: error ? wonderBlocksTokens.color.activeRed : blue,
350
- borderWidth: 2
344
+ backgroundColor: colorAction.press.background,
345
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.press.border}`,
346
+ outlineOffset: -1
351
347
  }
352
348
  }
353
349
  };
@@ -431,12 +427,12 @@ const styles$4 = aphrodite.StyleSheet.create({
431
427
  marginTop: -2
432
428
  },
433
429
  disabledLabel: {
434
- color: wonderBlocksTokens.color.offBlack32
430
+ color: wonderBlocksTokens.semanticColor.text.disabled
435
431
  },
436
432
  description: {
437
433
  marginLeft: wonderBlocksTokens.spacing.medium_16 + wonderBlocksTokens.spacing.xSmall_8,
438
434
  marginTop: wonderBlocksTokens.spacing.xxxSmall_4,
439
- color: wonderBlocksTokens.color.offBlack64
435
+ color: wonderBlocksTokens.semanticColor.text.secondary
440
436
  }
441
437
  });
442
438
 
@@ -507,11 +503,11 @@ const styles$3 = aphrodite.StyleSheet.create({
507
503
  },
508
504
  description: {
509
505
  marginTop: wonderBlocksTokens.spacing.xxxSmall_4,
510
- color: wonderBlocksTokens.color.offBlack64
506
+ color: wonderBlocksTokens.semanticColor.text.secondary
511
507
  },
512
508
  error: {
513
509
  marginTop: wonderBlocksTokens.spacing.xxxSmall_4,
514
- color: wonderBlocksTokens.color.red
510
+ color: wonderBlocksTokens.semanticColor.status.critical.foreground
515
511
  },
516
512
  defaultLineGap: {
517
513
  marginTop: wonderBlocksTokens.spacing.xSmall_8
@@ -677,7 +673,7 @@ const useFieldValidation = ({
677
673
  };
678
674
  };
679
675
 
680
- const _excluded$2 = ["id", "type", "value", "name", "disabled", "light", "error", "validate", "onValidate", "required", "placeholder", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "instantValidation", "onKeyDown", "onChange", "onFocus", "onBlur"];
676
+ const _excluded$2 = ["id", "type", "value", "name", "disabled", "error", "validate", "onValidate", "required", "placeholder", "style", "testId", "readOnly", "autoFocus", "autoComplete", "forwardedRef", "instantValidation", "onKeyDown", "onChange", "onFocus", "onBlur"];
681
677
  const StyledInput = wonderBlocksCore.addStyle("input");
682
678
  const TextField = props => {
683
679
  const {
@@ -686,7 +682,6 @@ const TextField = props => {
686
682
  value,
687
683
  name,
688
684
  disabled = false,
689
- light = false,
690
685
  error,
691
686
  validate,
692
687
  onValidate,
@@ -734,16 +729,10 @@ const TextField = props => {
734
729
  onBlur(event);
735
730
  }
736
731
  };
737
- const getStyles = () => {
738
- const baseStyles = [styles$2.input, wonderBlocksTypography.styles.LabelMedium];
739
- const defaultStyles = [styles$2.default, !disabled && styles$2.defaultFocus, disabled && styles$2.disabled, hasError && styles$2.error];
740
- const lightStyles = [styles$2.light, !disabled && styles$2.lightFocus, disabled && styles$2.lightDisabled, hasError && styles$2.lightError];
741
- return [...baseStyles, ...(light ? lightStyles : defaultStyles)];
742
- };
743
732
  return React__namespace.createElement(wonderBlocksCore.Id, {
744
733
  id: id
745
734
  }, uniqueId => React__namespace.createElement(StyledInput, _extends__default["default"]({
746
- style: [getStyles(), style],
735
+ style: [styles$2.input, wonderBlocksTypography.styles.LabelMedium, styles$2.default, !disabled && styles$2.defaultFocus, disabled && styles$2.disabled, hasError && styles$2.error, style],
747
736
  id: uniqueId,
748
737
  type: type,
749
738
  placeholder: placeholder,
@@ -763,6 +752,23 @@ const TextField = props => {
763
752
  "aria-invalid": hasError
764
753
  }, otherProps)));
765
754
  };
755
+ const states$1 = {
756
+ default: {
757
+ border: wonderBlocksTokens.semanticColor.border.strong,
758
+ background: wonderBlocksTokens.semanticColor.surface.primary,
759
+ foreground: wonderBlocksTokens.semanticColor.text.primary
760
+ },
761
+ disabled: {
762
+ border: wonderBlocksTokens.semanticColor.border.primary,
763
+ background: wonderBlocksTokens.semanticColor.action.disabled.secondary,
764
+ foreground: wonderBlocksTokens.semanticColor.text.secondary
765
+ },
766
+ error: {
767
+ border: wonderBlocksTokens.semanticColor.status.critical.foreground,
768
+ background: wonderBlocksTokens.semanticColor.status.critical.background,
769
+ foreground: wonderBlocksTokens.semanticColor.text.primary
770
+ }
771
+ };
766
772
  const styles$2 = aphrodite.StyleSheet.create({
767
773
  input: {
768
774
  width: "100%",
@@ -773,86 +779,43 @@ const styles$2 = aphrodite.StyleSheet.create({
773
779
  margin: 0
774
780
  },
775
781
  default: {
776
- background: wonderBlocksTokens.color.white,
777
- border: `1px solid ${wonderBlocksTokens.color.offBlack50}`,
778
- color: wonderBlocksTokens.color.offBlack,
782
+ background: states$1.default.background,
783
+ border: `${wonderBlocksTokens.border.width.hairline}px solid ${states$1.default.border}`,
784
+ color: states$1.default.foreground,
779
785
  "::placeholder": {
780
- color: wonderBlocksTokens.color.offBlack64
786
+ color: wonderBlocksTokens.semanticColor.text.secondary
781
787
  }
782
788
  },
783
789
  defaultFocus: {
784
790
  ":focus-visible": {
785
- borderColor: wonderBlocksTokens.color.blue,
786
- outline: `1px solid ${wonderBlocksTokens.color.blue}`,
787
- outlineOffset: "-2px"
791
+ borderColor: wonderBlocksTokens.semanticColor.border.focus,
792
+ outline: `${wonderBlocksTokens.border.width.hairline}px solid ${wonderBlocksTokens.semanticColor.border.focus}`,
793
+ outlineOffset: -2
788
794
  }
789
795
  },
790
796
  error: {
791
- background: wonderBlocksTokens.color.fadedRed8,
792
- border: `1px solid ${wonderBlocksTokens.color.red}`,
793
- color: wonderBlocksTokens.color.offBlack,
797
+ background: states$1.error.background,
798
+ border: `${wonderBlocksTokens.border.width.hairline}px solid ${states$1.error.border}`,
799
+ color: states$1.error.foreground,
794
800
  "::placeholder": {
795
- color: wonderBlocksTokens.color.offBlack64
801
+ color: wonderBlocksTokens.semanticColor.text.secondary
796
802
  },
797
803
  ":focus-visible": {
798
- outlineColor: wonderBlocksTokens.color.red,
799
- borderColor: wonderBlocksTokens.color.red
804
+ outlineColor: states$1.error.border,
805
+ borderColor: states$1.error.border
800
806
  }
801
807
  },
802
808
  disabled: {
803
- background: wonderBlocksTokens.color.offWhite,
804
- border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
805
- color: wonderBlocksTokens.color.offBlack64,
806
- "::placeholder": {
807
- color: wonderBlocksTokens.color.offBlack64
808
- },
809
- cursor: "not-allowed",
810
- ":focus-visible": {
811
- outline: `2px solid ${wonderBlocksTokens.color.offBlack32}`,
812
- outlineOffset: "-3px"
813
- }
814
- },
815
- light: {
816
- background: wonderBlocksTokens.color.white,
817
- border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
818
- color: wonderBlocksTokens.color.offBlack,
819
- "::placeholder": {
820
- color: wonderBlocksTokens.color.offBlack64
821
- }
822
- },
823
- lightFocus: {
824
- ":focus-visible": {
825
- outline: `3px solid ${wonderBlocksTokens.color.blue}`,
826
- outlineOffset: "-4px",
827
- borderColor: wonderBlocksTokens.color.white
828
- }
829
- },
830
- lightDisabled: {
831
- backgroundColor: "transparent",
832
- border: `1px solid ${wonderBlocksTokens.color.white32}`,
833
- color: wonderBlocksTokens.color.white64,
809
+ background: states$1.disabled.background,
810
+ border: `${wonderBlocksTokens.border.width.hairline}px solid ${states$1.disabled.border}`,
811
+ color: states$1.disabled.foreground,
834
812
  "::placeholder": {
835
- color: wonderBlocksTokens.color.white64
813
+ color: states$1.disabled.foreground
836
814
  },
837
815
  cursor: "not-allowed",
838
816
  ":focus-visible": {
839
- borderColor: wonderBlocksTokens.mix(wonderBlocksTokens.color.white32, wonderBlocksTokens.color.blue),
840
- outline: `3px solid ${wonderBlocksTokens.color.fadedBlue}`,
841
- outlineOffset: "-4px"
842
- }
843
- },
844
- lightError: {
845
- background: wonderBlocksTokens.color.fadedRed8,
846
- border: `1px solid ${wonderBlocksTokens.color.white}`,
847
- outline: `2px solid ${wonderBlocksTokens.color.red}`,
848
- outlineOffset: "-3px",
849
- color: wonderBlocksTokens.color.offBlack,
850
- "::placeholder": {
851
- color: wonderBlocksTokens.color.offBlack64
852
- },
853
- ":focus-visible": {
854
- outline: `3px solid ${wonderBlocksTokens.color.red}`,
855
- outlineOffset: "-4px"
817
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.action.disabled.default}`,
818
+ outlineOffset: -3
856
819
  }
857
820
  }
858
821
  });
@@ -867,15 +830,14 @@ class FieldHeading extends React__namespace.Component {
867
830
  label,
868
831
  id,
869
832
  required,
870
- testId,
871
- light
833
+ testId
872
834
  } = this.props;
873
835
  const requiredIcon = React__namespace.createElement(StyledSpan, {
874
- style: light ? styles$1.lightRequired : styles$1.required,
836
+ style: styles$1.required,
875
837
  "aria-hidden": true
876
838
  }, " ", "*");
877
839
  return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
878
- style: light ? styles$1.lightLabel : styles$1.label,
840
+ style: styles$1.label,
879
841
  tag: "label",
880
842
  htmlFor: id && `${id}-field`,
881
843
  testId: testId && `${testId}-label`
@@ -886,14 +848,13 @@ class FieldHeading extends React__namespace.Component {
886
848
  maybeRenderDescription() {
887
849
  const {
888
850
  description,
889
- testId,
890
- light
851
+ testId
891
852
  } = this.props;
892
853
  if (!description) {
893
854
  return null;
894
855
  }
895
856
  return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
896
- style: light ? styles$1.lightDescription : styles$1.description,
857
+ style: styles$1.description,
897
858
  testId: testId && `${testId}-description`
898
859
  }, description), React__namespace.createElement(wonderBlocksLayout.Strut, {
899
860
  size: wonderBlocksTokens.spacing.xxxSmall_4
@@ -903,8 +864,7 @@ class FieldHeading extends React__namespace.Component {
903
864
  const {
904
865
  error,
905
866
  id,
906
- testId,
907
- light
867
+ testId
908
868
  } = this.props;
909
869
  if (!error) {
910
870
  return null;
@@ -912,7 +872,7 @@ class FieldHeading extends React__namespace.Component {
912
872
  return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksLayout.Strut, {
913
873
  size: wonderBlocksTokens.spacing.small_12
914
874
  }), React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
915
- style: light ? styles$1.lightError : styles$1.error,
875
+ style: styles$1.error,
916
876
  role: "alert",
917
877
  id: id && `${id}-error`,
918
878
  testId: testId && `${testId}-error`
@@ -932,32 +892,20 @@ class FieldHeading extends React__namespace.Component {
932
892
  }
933
893
  const styles$1 = aphrodite.StyleSheet.create({
934
894
  label: {
935
- color: wonderBlocksTokens.color.offBlack
936
- },
937
- lightLabel: {
938
- color: wonderBlocksTokens.color.white
895
+ color: wonderBlocksTokens.semanticColor.text.primary
939
896
  },
940
897
  description: {
941
- color: wonderBlocksTokens.color.offBlack64
942
- },
943
- lightDescription: {
944
- color: wonderBlocksTokens.color.white64
898
+ color: wonderBlocksTokens.semanticColor.text.secondary
945
899
  },
946
900
  error: {
947
- color: wonderBlocksTokens.color.red
948
- },
949
- lightError: {
950
- color: wonderBlocksTokens.color.fadedRed
901
+ color: wonderBlocksTokens.semanticColor.status.critical.foreground
951
902
  },
952
903
  required: {
953
- color: wonderBlocksTokens.color.red
954
- },
955
- lightRequired: {
956
- color: wonderBlocksTokens.color.fadedRed
904
+ color: wonderBlocksTokens.semanticColor.status.critical.foreground
957
905
  }
958
906
  });
959
907
 
960
- 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"];
908
+ const _excluded$1 = ["id", "type", "label", "description", "value", "disabled", "required", "validate", "onChange", "onKeyDown", "placeholder", "style", "testId", "readOnly", "autoComplete", "forwardedRef", "ariaDescribedby", "name", "onValidate", "onFocus", "onBlur"];
961
909
  class LabeledTextField extends React__namespace.Component {
962
910
  constructor(props) {
963
911
  super(props);
@@ -1016,7 +964,6 @@ class LabeledTextField extends React__namespace.Component {
1016
964
  onChange,
1017
965
  onKeyDown,
1018
966
  placeholder,
1019
- light,
1020
967
  style,
1021
968
  testId,
1022
969
  readOnly,
@@ -1032,7 +979,6 @@ class LabeledTextField extends React__namespace.Component {
1032
979
  id: uniqueId,
1033
980
  testId: testId,
1034
981
  style: style,
1035
- light: light,
1036
982
  field: React__namespace.createElement(TextField$1, _extends__default["default"]({
1037
983
  id: `${uniqueId}-field`,
1038
984
  "aria-describedby": ariaDescribedby ? ariaDescribedby : `${uniqueId}-error`,
@@ -1049,7 +995,6 @@ class LabeledTextField extends React__namespace.Component {
1049
995
  onKeyDown: onKeyDown,
1050
996
  onFocus: this.handleFocus,
1051
997
  onBlur: this.handleBlur,
1052
- light: light,
1053
998
  readOnly: readOnly,
1054
999
  autoComplete: autoComplete,
1055
1000
  ref: forwardedRef,
@@ -1064,14 +1009,13 @@ class LabeledTextField extends React__namespace.Component {
1064
1009
  }
1065
1010
  LabeledTextField.defaultProps = {
1066
1011
  type: "text",
1067
- disabled: false,
1068
- light: false
1012
+ disabled: false
1069
1013
  };
1070
1014
  var labeledTextField = React__namespace.forwardRef((props, ref) => React__namespace.createElement(LabeledTextField, _extends__default["default"]({}, props, {
1071
1015
  forwardedRef: ref
1072
1016
  })));
1073
1017
 
1074
- const _excluded = ["onChange", "value", "placeholder", "disabled", "id", "testId", "style", "readOnly", "autoComplete", "name", "className", "autoFocus", "rows", "spellCheck", "wrap", "minLength", "maxLength", "onClick", "onKeyDown", "onKeyUp", "onFocus", "onBlur", "validate", "onValidate", "required", "resizeType", "light", "rootStyle", "error", "instantValidation"];
1018
+ const _excluded = ["onChange", "value", "placeholder", "disabled", "id", "testId", "style", "readOnly", "autoComplete", "name", "className", "autoFocus", "rows", "spellCheck", "wrap", "minLength", "maxLength", "onClick", "onKeyDown", "onKeyUp", "onFocus", "onBlur", "validate", "onValidate", "required", "resizeType", "rootStyle", "error", "instantValidation"];
1075
1019
  const StyledTextArea = wonderBlocksCore.addStyle("textarea");
1076
1020
  const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
1077
1021
  const {
@@ -1101,7 +1045,6 @@ const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
1101
1045
  onValidate,
1102
1046
  required,
1103
1047
  resizeType,
1104
- light,
1105
1048
  rootStyle,
1106
1049
  error,
1107
1050
  instantValidation = true
@@ -1133,12 +1076,6 @@ const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
1133
1076
  onBlur(event);
1134
1077
  }
1135
1078
  };
1136
- const getStyles = () => {
1137
- const baseStyles = [styles.textarea, wonderBlocksTypography.styles.LabelMedium, resizeType && resizeStyles[resizeType]];
1138
- const defaultStyles = [styles.default, !disabled && styles.defaultFocus, disabled && styles.disabled, hasError && styles.error];
1139
- const lightStyles = [styles.light, !disabled && styles.lightFocus, disabled && styles.lightDisabled, hasError && styles.lightError];
1140
- return [...baseStyles, ...(light ? lightStyles : defaultStyles)];
1141
- };
1142
1079
  return React__namespace.createElement(wonderBlocksCore.View, {
1143
1080
  style: [{
1144
1081
  width: "100%"
@@ -1148,7 +1085,7 @@ const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
1148
1085
  "data-testid": testId,
1149
1086
  ref: ref,
1150
1087
  className: className,
1151
- style: [getStyles(), style],
1088
+ style: [styles.textarea, wonderBlocksTypography.styles.LabelMedium, resizeType && resizeStyles[resizeType], styles.default, !disabled && styles.defaultFocus, disabled && styles.disabled, hasError && styles.error, style],
1152
1089
  value: value,
1153
1090
  onChange: handleChange,
1154
1091
  placeholder: placeholder,
@@ -1174,6 +1111,23 @@ const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
1174
1111
  })));
1175
1112
  });
1176
1113
  const VERTICAL_SPACING_PX = 10;
1114
+ const states = {
1115
+ default: {
1116
+ border: wonderBlocksTokens.semanticColor.border.strong,
1117
+ background: wonderBlocksTokens.semanticColor.surface.primary,
1118
+ foreground: wonderBlocksTokens.semanticColor.text.primary
1119
+ },
1120
+ disabled: {
1121
+ border: wonderBlocksTokens.semanticColor.border.primary,
1122
+ background: wonderBlocksTokens.semanticColor.action.disabled.secondary,
1123
+ foreground: wonderBlocksTokens.semanticColor.text.secondary
1124
+ },
1125
+ error: {
1126
+ border: wonderBlocksTokens.semanticColor.status.critical.foreground,
1127
+ background: wonderBlocksTokens.semanticColor.status.critical.background,
1128
+ foreground: wonderBlocksTokens.semanticColor.text.primary
1129
+ }
1130
+ };
1177
1131
  const styles = aphrodite.StyleSheet.create({
1178
1132
  textarea: {
1179
1133
  borderRadius: wonderBlocksTokens.border.radius.medium_4,
@@ -1182,86 +1136,43 @@ const styles = aphrodite.StyleSheet.create({
1182
1136
  minHeight: `${VERTICAL_SPACING_PX * 2 + wonderBlocksTokens.font.lineHeight.medium + 2 * wonderBlocksTokens.border.width.hairline}px`
1183
1137
  },
1184
1138
  default: {
1185
- background: wonderBlocksTokens.color.white,
1186
- border: `1px solid ${wonderBlocksTokens.color.offBlack50}`,
1187
- color: wonderBlocksTokens.color.offBlack,
1139
+ background: states.default.background,
1140
+ border: `${wonderBlocksTokens.border.width.hairline}px solid ${states.default.border}`,
1141
+ color: states.default.foreground,
1188
1142
  "::placeholder": {
1189
- color: wonderBlocksTokens.color.offBlack64
1143
+ color: wonderBlocksTokens.semanticColor.text.secondary
1190
1144
  }
1191
1145
  },
1192
1146
  defaultFocus: {
1193
1147
  ":focus-visible": {
1194
- borderColor: wonderBlocksTokens.color.blue,
1195
- outline: `1px solid ${wonderBlocksTokens.color.blue}`,
1196
- outlineOffset: "-2px"
1148
+ borderColor: wonderBlocksTokens.semanticColor.border.focus,
1149
+ outline: `${wonderBlocksTokens.border.width.hairline}px solid ${wonderBlocksTokens.semanticColor.border.focus}`,
1150
+ outlineOffset: -2
1197
1151
  }
1198
1152
  },
1199
1153
  disabled: {
1200
- background: wonderBlocksTokens.color.offWhite,
1201
- border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
1202
- color: wonderBlocksTokens.color.offBlack64,
1154
+ background: states.disabled.background,
1155
+ border: `${wonderBlocksTokens.border.width.hairline}px solid ${states.disabled.border}`,
1156
+ color: states.disabled.foreground,
1203
1157
  "::placeholder": {
1204
- color: wonderBlocksTokens.color.offBlack64
1158
+ color: states.disabled.foreground
1205
1159
  },
1206
1160
  cursor: "not-allowed",
1207
1161
  ":focus-visible": {
1208
- outline: `2px solid ${wonderBlocksTokens.color.offBlack32}`,
1209
- outlineOffset: "-3px"
1162
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.action.disabled.default}`,
1163
+ outlineOffset: -3
1210
1164
  }
1211
1165
  },
1212
1166
  error: {
1213
- background: wonderBlocksTokens.color.fadedRed8,
1214
- border: `1px solid ${wonderBlocksTokens.color.red}`,
1215
- color: wonderBlocksTokens.color.offBlack,
1216
- "::placeholder": {
1217
- color: wonderBlocksTokens.color.offBlack64
1218
- },
1219
- ":focus-visible": {
1220
- outlineColor: wonderBlocksTokens.color.red,
1221
- borderColor: wonderBlocksTokens.color.red
1222
- }
1223
- },
1224
- light: {
1225
- background: wonderBlocksTokens.color.white,
1226
- border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
1227
- color: wonderBlocksTokens.color.offBlack,
1228
- "::placeholder": {
1229
- color: wonderBlocksTokens.color.offBlack64
1230
- }
1231
- },
1232
- lightFocus: {
1233
- ":focus-visible": {
1234
- outline: `3px solid ${wonderBlocksTokens.color.blue}`,
1235
- outlineOffset: "-4px",
1236
- borderColor: wonderBlocksTokens.color.white
1237
- }
1238
- },
1239
- lightDisabled: {
1240
- backgroundColor: "transparent",
1241
- border: `1px solid ${wonderBlocksTokens.color.white32}`,
1242
- color: wonderBlocksTokens.color.white64,
1243
- "::placeholder": {
1244
- color: wonderBlocksTokens.color.white64
1245
- },
1246
- cursor: "not-allowed",
1247
- ":focus-visible": {
1248
- borderColor: wonderBlocksTokens.mix(wonderBlocksTokens.color.white32, wonderBlocksTokens.color.blue),
1249
- outline: `3px solid ${wonderBlocksTokens.color.fadedBlue}`,
1250
- outlineOffset: "-4px"
1251
- }
1252
- },
1253
- lightError: {
1254
- background: wonderBlocksTokens.color.fadedRed8,
1255
- border: `1px solid ${wonderBlocksTokens.color.white}`,
1256
- outline: `2px solid ${wonderBlocksTokens.color.red}`,
1257
- outlineOffset: "-3px",
1258
- color: wonderBlocksTokens.color.offBlack,
1167
+ background: states.error.background,
1168
+ border: `${wonderBlocksTokens.border.width.hairline}px solid ${states.error.border}`,
1169
+ color: states.error.foreground,
1259
1170
  "::placeholder": {
1260
- color: wonderBlocksTokens.color.offBlack64
1171
+ color: wonderBlocksTokens.semanticColor.text.secondary
1261
1172
  },
1262
1173
  ":focus-visible": {
1263
- outline: `3px solid ${wonderBlocksTokens.color.red}`,
1264
- outlineOffset: "-4px"
1174
+ outlineColor: states.error.border,
1175
+ borderColor: states.error.border
1265
1176
  }
1266
1177
  }
1267
1178
  });