@khanacademy/wonder-blocks-form 7.1.1 → 7.1.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @khanacademy/wonder-blocks-form
2
2
 
3
+ ## 7.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 5655b9f: Switch to use `focus.outer` semanticColor token
8
+ - 7bb37a2: Update component docs to include labelling guidelines
9
+ - 8f53293: Rename action tokens: `filled` -> `primary`, `outlined` -> `secondary`.
10
+ - 051f0f8: Rework action.disabled tokens to include properties per kind (border, background, foreground).
11
+ - 7bb37a2: Marking LabeledTextField with `@deprecated` in favour of LabeledField + TextField
12
+ - Updated dependencies [ed26d66]
13
+ - Updated dependencies [5655b9f]
14
+ - Updated dependencies [5655b9f]
15
+ - Updated dependencies [8f53293]
16
+ - Updated dependencies [051f0f8]
17
+ - Updated dependencies [8fc65a9]
18
+ - Updated dependencies [e1b78db]
19
+ - Updated dependencies [051f0f8]
20
+ - @khanacademy/wonder-blocks-core@12.2.0
21
+ - @khanacademy/wonder-blocks-tokens@5.0.0
22
+ - @khanacademy/wonder-blocks-clickable@6.1.2
23
+ - @khanacademy/wonder-blocks-icon@5.1.2
24
+ - @khanacademy/wonder-blocks-layout@3.1.2
25
+ - @khanacademy/wonder-blocks-typography@3.1.2
26
+
3
27
  ## 7.1.1
4
28
 
5
29
  ### Patch Changes
@@ -158,9 +158,13 @@ declare class LabeledTextField extends React.Component<PropsWithForwardRef, Stat
158
158
  }
159
159
  type ExportProps = OmitConstrained<JSX.LibraryManagedAttributes<typeof LabeledTextField, React.ComponentProps<typeof LabeledTextField>>, "forwardedRef">;
160
160
  /**
161
+ * **DEPRECATED**: Please use `LabeledField` with `TextField` instead.
162
+ *
161
163
  * A LabeledTextField is an element used to accept a single line of text
162
164
  * from the user paired with a label, description, and error field elements.
163
165
  *
166
+ * @deprecated
167
+ *
164
168
  * ### Usage
165
169
  *
166
170
  * ```jsx
@@ -1,5 +1,16 @@
1
1
  import * as React from "react";
2
2
  import { StyleType } from "@khanacademy/wonder-blocks-core";
3
+ /**
4
+ * A TextArea is an element used to accept text from the user.
5
+ *
6
+ * Make sure to provide a label for the field. This can be done by either:
7
+ * - (recommended) Using the **LabeledField** component to provide a label,
8
+ * description, and/or error message for the field
9
+ * - Using a `label` html tag with the `htmlFor` prop set to the unique id of
10
+ * the field
11
+ * - Using an `aria-label` attribute on the field
12
+ * - Using an `aria-labelledby` attribute on the field
13
+ */
3
14
  declare const TextArea: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
4
15
  role?: import("@khanacademy/wonder-blocks-core").AriaRole;
5
16
  }> & {
@@ -152,6 +152,13 @@ type ExportProps = OmitConstrained<JSX.LibraryManagedAttributes<typeof TextField
152
152
  /**
153
153
  * A TextField is an element used to accept a single line of text from the user.
154
154
  *
155
+ * Make sure to provide a label for the field. This can be done by either:
156
+ * - (recommended) Using the **LabeledField** component to provide a label,
157
+ * description, and/or error message for the field
158
+ * - Using a `label` html tag with the `htmlFor` prop set to the unique id of
159
+ * the field
160
+ * - Using an `aria-label` attribute on the field
161
+ * - Using an `aria-labelledby` attribute on the field
155
162
  * ### Usage
156
163
  *
157
164
  * ```jsx
package/dist/es/index.js CHANGED
@@ -78,8 +78,8 @@ const CheckboxCore = React.forwardRef(function CheckboxCore(props, ref) {
78
78
  })), checked || checked == null ? checkboxIcon : React.createElement(React.Fragment, null));
79
79
  });
80
80
  const disabledState$1 = {
81
- border: semanticColor.border.primary,
82
- background: semanticColor.action.disabled.secondary
81
+ border: semanticColor.action.secondary.disabled.border,
82
+ background: semanticColor.action.secondary.disabled.background
83
83
  };
84
84
  const sharedStyles$1 = StyleSheet.create({
85
85
  inputReset: {
@@ -119,7 +119,7 @@ const _generateStyles$1 = (checked, error) => {
119
119
  }
120
120
  const isCheckedOrIndeterminate = checked || checked == null;
121
121
  const actionType = error ? "destructive" : "progressive";
122
- const styleType = isCheckedOrIndeterminate ? "filled" : "outlined";
122
+ const styleType = isCheckedOrIndeterminate ? "primary" : "secondary";
123
123
  const colorAction = semanticColor.action[styleType][actionType];
124
124
  const states = {
125
125
  default: {
@@ -138,7 +138,7 @@ const _generateStyles$1 = (checked, error) => {
138
138
  backgroundColor: states.default.background,
139
139
  borderColor: states.default.border,
140
140
  ":focus-visible": {
141
- outline: `${border.width.thin}px solid ${colorAction.hover.border}`,
141
+ outline: `${border.width.thin}px solid ${semanticColor.focus.outer}`,
142
142
  outlineOffset: 1
143
143
  },
144
144
  ":hover": {
@@ -160,7 +160,7 @@ const _generateStyles$1 = (checked, error) => {
160
160
  borderColor: currentState.border,
161
161
  ":focus-visible": {
162
162
  backgroundColor: error ? states.error.background : colorAction.hover.background,
163
- outline: `${border.width.thin}px solid ${colorAction.hover.border}`,
163
+ outline: `${border.width.thin}px solid ${semanticColor.focus.outer}`,
164
164
  outlineOffset: -1
165
165
  },
166
166
  ":hover": {
@@ -213,8 +213,8 @@ const RadioCore = React.forwardRef(function RadioCore(props, ref) {
213
213
  }));
214
214
  });
215
215
  const disabledState = {
216
- border: semanticColor.border.primary,
217
- background: semanticColor.action.disabled.secondary
216
+ border: semanticColor.action.secondary.disabled.border,
217
+ background: semanticColor.action.secondary.disabled.background
218
218
  };
219
219
  const size = 16;
220
220
  const disabledChecked = {
@@ -224,7 +224,7 @@ const disabledChecked = {
224
224
  height: size / 2,
225
225
  width: size / 2,
226
226
  borderRadius: "50%",
227
- backgroundColor: semanticColor.action.disabled.default
227
+ backgroundColor: semanticColor.action.primary.disabled.background
228
228
  };
229
229
  const sharedStyles = StyleSheet.create({
230
230
  inputReset: {
@@ -258,7 +258,7 @@ const _generateStyles = (checked, error) => {
258
258
  return styles$5[styleKey];
259
259
  }
260
260
  const actionType = error ? "destructive" : "progressive";
261
- const colorAction = semanticColor.action.outlined[actionType];
261
+ const colorAction = semanticColor.action.secondary[actionType];
262
262
  const states = {
263
263
  unchecked: {
264
264
  border: semanticColor.border.strong,
@@ -281,7 +281,7 @@ const _generateStyles = (checked, error) => {
281
281
  borderColor: states.checked.border,
282
282
  borderWidth: size / 4,
283
283
  ":focus-visible": {
284
- outline: `${border.width.thin}px solid ${colorAction.hover.border}`,
284
+ outline: `${border.width.thin}px solid ${semanticColor.focus.outer}`,
285
285
  outlineOffset: 1
286
286
  },
287
287
  ":hover": {
@@ -303,7 +303,7 @@ const _generateStyles = (checked, error) => {
303
303
  borderColor: currentState.border,
304
304
  ":focus-visible": {
305
305
  backgroundColor: error ? states.error.background : colorAction.hover.background,
306
- outline: `${border.width.thin}px solid ${colorAction.hover.border}`,
306
+ outline: `${border.width.thin}px solid ${semanticColor.focus.outer}`,
307
307
  outlineOffset: -1
308
308
  },
309
309
  ":hover": {
@@ -399,7 +399,7 @@ const styles$4 = StyleSheet.create({
399
399
  marginTop: -2
400
400
  },
401
401
  disabledLabel: {
402
- color: semanticColor.text.disabled
402
+ color: semanticColor.action.secondary.disabled.foreground
403
403
  },
404
404
  description: {
405
405
  marginLeft: spacing.medium_16 + spacing.xSmall_8,
@@ -731,8 +731,8 @@ const states$1 = {
731
731
  foreground: semanticColor.text.primary
732
732
  },
733
733
  disabled: {
734
- border: semanticColor.border.primary,
735
- background: semanticColor.action.disabled.secondary,
734
+ border: semanticColor.action.secondary.disabled.border,
735
+ background: semanticColor.action.secondary.disabled.background,
736
736
  foreground: semanticColor.text.secondary
737
737
  },
738
738
  error: {
@@ -760,8 +760,8 @@ const styles$2 = StyleSheet.create({
760
760
  },
761
761
  defaultFocus: {
762
762
  ":focus-visible": {
763
- borderColor: semanticColor.border.focus,
764
- outline: `${border.width.hairline}px solid ${semanticColor.border.focus}`,
763
+ borderColor: semanticColor.focus.outer,
764
+ outline: `${border.width.hairline}px solid ${semanticColor.focus.outer}`,
765
765
  outlineOffset: -2
766
766
  }
767
767
  },
@@ -773,8 +773,8 @@ const styles$2 = StyleSheet.create({
773
773
  color: semanticColor.text.secondary
774
774
  },
775
775
  ":focus-visible": {
776
- outlineColor: states$1.error.border,
777
- borderColor: states$1.error.border
776
+ outlineColor: semanticColor.focus.outer,
777
+ outline: `${border.width.thin}px solid ${semanticColor.focus.outer}`
778
778
  }
779
779
  },
780
780
  disabled: {
@@ -786,7 +786,7 @@ const styles$2 = StyleSheet.create({
786
786
  },
787
787
  cursor: "not-allowed",
788
788
  ":focus-visible": {
789
- outline: `${border.width.thin}px solid ${semanticColor.action.disabled.default}`,
789
+ outline: `${border.width.thin}px solid ${semanticColor.focus.outer}`,
790
790
  outlineOffset: -3
791
791
  }
792
792
  }
@@ -1090,8 +1090,8 @@ const states = {
1090
1090
  foreground: semanticColor.text.primary
1091
1091
  },
1092
1092
  disabled: {
1093
- border: semanticColor.border.primary,
1094
- background: semanticColor.action.disabled.secondary,
1093
+ border: semanticColor.action.secondary.disabled.border,
1094
+ background: semanticColor.action.secondary.disabled.background,
1095
1095
  foreground: semanticColor.text.secondary
1096
1096
  },
1097
1097
  error: {
@@ -1117,8 +1117,8 @@ const styles = StyleSheet.create({
1117
1117
  },
1118
1118
  defaultFocus: {
1119
1119
  ":focus-visible": {
1120
- borderColor: semanticColor.border.focus,
1121
- outline: `${border.width.hairline}px solid ${semanticColor.border.focus}`,
1120
+ borderColor: semanticColor.focus.outer,
1121
+ outline: `${border.width.hairline}px solid ${semanticColor.focus.outer}`,
1122
1122
  outlineOffset: -2
1123
1123
  }
1124
1124
  },
@@ -1131,7 +1131,7 @@ const styles = StyleSheet.create({
1131
1131
  },
1132
1132
  cursor: "not-allowed",
1133
1133
  ":focus-visible": {
1134
- outline: `${border.width.thin}px solid ${semanticColor.action.disabled.default}`,
1134
+ outline: `${border.width.thin}px solid ${semanticColor.focus.outer}`,
1135
1135
  outlineOffset: -3
1136
1136
  }
1137
1137
  },
@@ -1143,7 +1143,7 @@ const styles = StyleSheet.create({
1143
1143
  color: semanticColor.text.secondary
1144
1144
  },
1145
1145
  ":focus-visible": {
1146
- outlineColor: states.error.border,
1146
+ outline: `${border.width.thin}px solid ${semanticColor.focus.outer}`,
1147
1147
  borderColor: states.error.border
1148
1148
  }
1149
1149
  }
package/dist/index.js CHANGED
@@ -107,8 +107,8 @@ const CheckboxCore = React__namespace.forwardRef(function CheckboxCore(props, re
107
107
  })), checked || checked == null ? checkboxIcon : React__namespace.createElement(React__namespace.Fragment, null));
108
108
  });
109
109
  const disabledState$1 = {
110
- border: wonderBlocksTokens.semanticColor.border.primary,
111
- background: wonderBlocksTokens.semanticColor.action.disabled.secondary
110
+ border: wonderBlocksTokens.semanticColor.action.secondary.disabled.border,
111
+ background: wonderBlocksTokens.semanticColor.action.secondary.disabled.background
112
112
  };
113
113
  const sharedStyles$1 = aphrodite.StyleSheet.create({
114
114
  inputReset: {
@@ -148,7 +148,7 @@ const _generateStyles$1 = (checked, error) => {
148
148
  }
149
149
  const isCheckedOrIndeterminate = checked || checked == null;
150
150
  const actionType = error ? "destructive" : "progressive";
151
- const styleType = isCheckedOrIndeterminate ? "filled" : "outlined";
151
+ const styleType = isCheckedOrIndeterminate ? "primary" : "secondary";
152
152
  const colorAction = wonderBlocksTokens.semanticColor.action[styleType][actionType];
153
153
  const states = {
154
154
  default: {
@@ -167,7 +167,7 @@ const _generateStyles$1 = (checked, error) => {
167
167
  backgroundColor: states.default.background,
168
168
  borderColor: states.default.border,
169
169
  ":focus-visible": {
170
- outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
170
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
171
171
  outlineOffset: 1
172
172
  },
173
173
  ":hover": {
@@ -189,7 +189,7 @@ const _generateStyles$1 = (checked, error) => {
189
189
  borderColor: currentState.border,
190
190
  ":focus-visible": {
191
191
  backgroundColor: error ? states.error.background : colorAction.hover.background,
192
- outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
192
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
193
193
  outlineOffset: -1
194
194
  },
195
195
  ":hover": {
@@ -242,8 +242,8 @@ const RadioCore = React__namespace.forwardRef(function RadioCore(props, ref) {
242
242
  }));
243
243
  });
244
244
  const disabledState = {
245
- border: wonderBlocksTokens.semanticColor.border.primary,
246
- background: wonderBlocksTokens.semanticColor.action.disabled.secondary
245
+ border: wonderBlocksTokens.semanticColor.action.secondary.disabled.border,
246
+ background: wonderBlocksTokens.semanticColor.action.secondary.disabled.background
247
247
  };
248
248
  const size = 16;
249
249
  const disabledChecked = {
@@ -253,7 +253,7 @@ const disabledChecked = {
253
253
  height: size / 2,
254
254
  width: size / 2,
255
255
  borderRadius: "50%",
256
- backgroundColor: wonderBlocksTokens.semanticColor.action.disabled.default
256
+ backgroundColor: wonderBlocksTokens.semanticColor.action.primary.disabled.background
257
257
  };
258
258
  const sharedStyles = aphrodite.StyleSheet.create({
259
259
  inputReset: {
@@ -287,7 +287,7 @@ const _generateStyles = (checked, error) => {
287
287
  return styles$5[styleKey];
288
288
  }
289
289
  const actionType = error ? "destructive" : "progressive";
290
- const colorAction = wonderBlocksTokens.semanticColor.action.outlined[actionType];
290
+ const colorAction = wonderBlocksTokens.semanticColor.action.secondary[actionType];
291
291
  const states = {
292
292
  unchecked: {
293
293
  border: wonderBlocksTokens.semanticColor.border.strong,
@@ -310,7 +310,7 @@ const _generateStyles = (checked, error) => {
310
310
  borderColor: states.checked.border,
311
311
  borderWidth: size / 4,
312
312
  ":focus-visible": {
313
- outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
313
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
314
314
  outlineOffset: 1
315
315
  },
316
316
  ":hover": {
@@ -332,7 +332,7 @@ const _generateStyles = (checked, error) => {
332
332
  borderColor: currentState.border,
333
333
  ":focus-visible": {
334
334
  backgroundColor: error ? states.error.background : colorAction.hover.background,
335
- outline: `${wonderBlocksTokens.border.width.thin}px solid ${colorAction.hover.border}`,
335
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
336
336
  outlineOffset: -1
337
337
  },
338
338
  ":hover": {
@@ -428,7 +428,7 @@ const styles$4 = aphrodite.StyleSheet.create({
428
428
  marginTop: -2
429
429
  },
430
430
  disabledLabel: {
431
- color: wonderBlocksTokens.semanticColor.text.disabled
431
+ color: wonderBlocksTokens.semanticColor.action.secondary.disabled.foreground
432
432
  },
433
433
  description: {
434
434
  marginLeft: wonderBlocksTokens.spacing.medium_16 + wonderBlocksTokens.spacing.xSmall_8,
@@ -760,8 +760,8 @@ const states$1 = {
760
760
  foreground: wonderBlocksTokens.semanticColor.text.primary
761
761
  },
762
762
  disabled: {
763
- border: wonderBlocksTokens.semanticColor.border.primary,
764
- background: wonderBlocksTokens.semanticColor.action.disabled.secondary,
763
+ border: wonderBlocksTokens.semanticColor.action.secondary.disabled.border,
764
+ background: wonderBlocksTokens.semanticColor.action.secondary.disabled.background,
765
765
  foreground: wonderBlocksTokens.semanticColor.text.secondary
766
766
  },
767
767
  error: {
@@ -789,8 +789,8 @@ const styles$2 = aphrodite.StyleSheet.create({
789
789
  },
790
790
  defaultFocus: {
791
791
  ":focus-visible": {
792
- borderColor: wonderBlocksTokens.semanticColor.border.focus,
793
- outline: `${wonderBlocksTokens.border.width.hairline}px solid ${wonderBlocksTokens.semanticColor.border.focus}`,
792
+ borderColor: wonderBlocksTokens.semanticColor.focus.outer,
793
+ outline: `${wonderBlocksTokens.border.width.hairline}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
794
794
  outlineOffset: -2
795
795
  }
796
796
  },
@@ -802,8 +802,8 @@ const styles$2 = aphrodite.StyleSheet.create({
802
802
  color: wonderBlocksTokens.semanticColor.text.secondary
803
803
  },
804
804
  ":focus-visible": {
805
- outlineColor: states$1.error.border,
806
- borderColor: states$1.error.border
805
+ outlineColor: wonderBlocksTokens.semanticColor.focus.outer,
806
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`
807
807
  }
808
808
  },
809
809
  disabled: {
@@ -815,7 +815,7 @@ const styles$2 = aphrodite.StyleSheet.create({
815
815
  },
816
816
  cursor: "not-allowed",
817
817
  ":focus-visible": {
818
- outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.action.disabled.default}`,
818
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
819
819
  outlineOffset: -3
820
820
  }
821
821
  }
@@ -1119,8 +1119,8 @@ const states = {
1119
1119
  foreground: wonderBlocksTokens.semanticColor.text.primary
1120
1120
  },
1121
1121
  disabled: {
1122
- border: wonderBlocksTokens.semanticColor.border.primary,
1123
- background: wonderBlocksTokens.semanticColor.action.disabled.secondary,
1122
+ border: wonderBlocksTokens.semanticColor.action.secondary.disabled.border,
1123
+ background: wonderBlocksTokens.semanticColor.action.secondary.disabled.background,
1124
1124
  foreground: wonderBlocksTokens.semanticColor.text.secondary
1125
1125
  },
1126
1126
  error: {
@@ -1146,8 +1146,8 @@ const styles = aphrodite.StyleSheet.create({
1146
1146
  },
1147
1147
  defaultFocus: {
1148
1148
  ":focus-visible": {
1149
- borderColor: wonderBlocksTokens.semanticColor.border.focus,
1150
- outline: `${wonderBlocksTokens.border.width.hairline}px solid ${wonderBlocksTokens.semanticColor.border.focus}`,
1149
+ borderColor: wonderBlocksTokens.semanticColor.focus.outer,
1150
+ outline: `${wonderBlocksTokens.border.width.hairline}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
1151
1151
  outlineOffset: -2
1152
1152
  }
1153
1153
  },
@@ -1160,7 +1160,7 @@ const styles = aphrodite.StyleSheet.create({
1160
1160
  },
1161
1161
  cursor: "not-allowed",
1162
1162
  ":focus-visible": {
1163
- outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.action.disabled.default}`,
1163
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
1164
1164
  outlineOffset: -3
1165
1165
  }
1166
1166
  },
@@ -1172,7 +1172,7 @@ const styles = aphrodite.StyleSheet.create({
1172
1172
  color: wonderBlocksTokens.semanticColor.text.secondary
1173
1173
  },
1174
1174
  ":focus-visible": {
1175
- outlineColor: states.error.border,
1175
+ outline: `${wonderBlocksTokens.border.width.thin}px solid ${wonderBlocksTokens.semanticColor.focus.outer}`,
1176
1176
  borderColor: states.error.border
1177
1177
  }
1178
1178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-form",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
4
4
  "design": "v1",
5
5
  "description": "Form components for Wonder Blocks.",
6
6
  "main": "dist/index.js",
@@ -13,12 +13,12 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@babel/runtime": "^7.24.5",
16
- "@khanacademy/wonder-blocks-clickable": "6.1.1",
17
- "@khanacademy/wonder-blocks-core": "12.1.1",
18
- "@khanacademy/wonder-blocks-icon": "5.1.1",
19
- "@khanacademy/wonder-blocks-layout": "3.1.1",
20
- "@khanacademy/wonder-blocks-tokens": "4.2.1",
21
- "@khanacademy/wonder-blocks-typography": "3.1.1"
16
+ "@khanacademy/wonder-blocks-clickable": "6.1.2",
17
+ "@khanacademy/wonder-blocks-core": "12.2.0",
18
+ "@khanacademy/wonder-blocks-icon": "5.1.2",
19
+ "@khanacademy/wonder-blocks-layout": "3.1.2",
20
+ "@khanacademy/wonder-blocks-tokens": "5.0.0",
21
+ "@khanacademy/wonder-blocks-typography": "3.1.2"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@phosphor-icons/core": "^2.0.2",