@khanacademy/wonder-blocks-labeled-field 1.1.1 → 2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @khanacademy/wonder-blocks-labeled-field
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8cfaeab0]
8
+ - Updated dependencies [c162abb4]
9
+ - @khanacademy/wonder-blocks-tokens@4.1.0
10
+ - @khanacademy/wonder-blocks-layout@3.0.7
11
+
12
+ ## 2.0.0
13
+
14
+ ### Major Changes
15
+
16
+ - 8d26588f: Remove `light` variant/prop from `LabeledField` as it is no longer needed/recommended.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [0de25cd8]
21
+ - @khanacademy/wonder-blocks-tokens@4.0.0
22
+ - @khanacademy/wonder-blocks-layout@3.0.6
23
+
3
24
  ## 1.1.1
4
25
 
5
26
  ### Patch Changes
@@ -75,10 +75,6 @@ type Props = {
75
75
  * - The error will have a testId formatted as `${testId}-error`
76
76
  */
77
77
  testId?: string;
78
- /**
79
- * Change the field’s sub-components to fit a dark background.
80
- */
81
- light?: boolean;
82
78
  /**
83
79
  * The object containing the custom labels used inside this component.
84
80
  *
package/dist/es/index.js CHANGED
@@ -3,7 +3,7 @@ import { StyleSheet } from 'aphrodite';
3
3
  import WarningCircle from '@phosphor-icons/core/bold/warning-circle-bold.svg';
4
4
  import { addStyle, View } from '@khanacademy/wonder-blocks-core';
5
5
  import { Strut } from '@khanacademy/wonder-blocks-layout';
6
- import { semanticColor, color, spacing } from '@khanacademy/wonder-blocks-tokens';
6
+ import { semanticColor, spacing } from '@khanacademy/wonder-blocks-tokens';
7
7
  import { LabelMedium, LabelSmall } from '@khanacademy/wonder-blocks-typography';
8
8
  import _extends from '@babel/runtime/helpers/extends';
9
9
  import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
@@ -81,7 +81,6 @@ function LabeledField(props) {
81
81
  id,
82
82
  required,
83
83
  testId,
84
- light,
85
84
  description,
86
85
  errorMessage,
87
86
  labels = defaultLabeledFieldLabels
@@ -94,14 +93,13 @@ function LabeledField(props) {
94
93
  const errorId = `${uniqueId}-error`;
95
94
  const isRequired = !!required || !!field.props.required;
96
95
  const hasError = !!errorMessage || !!field.props.error;
97
- const isLight = light || field.props.light;
98
96
  function renderLabel() {
99
97
  const requiredIcon = React.createElement(StyledSpan, {
100
- style: [styles.textWordBreak, isLight ? styles.lightRequired : styles.required],
98
+ style: [styles.textWordBreak, styles.required],
101
99
  "aria-hidden": true
102
100
  }, " ", "*");
103
101
  return React.createElement(React.Fragment, null, React.createElement(LabelMedium, {
104
- style: [styles.textWordBreak, isLight ? styles.lightLabel : styles.label],
102
+ style: [styles.textWordBreak, styles.label],
105
103
  tag: "label",
106
104
  htmlFor: fieldId,
107
105
  testId: testId && `${testId}-label`,
@@ -115,7 +113,7 @@ function LabeledField(props) {
115
113
  return null;
116
114
  }
117
115
  return React.createElement(React.Fragment, null, React.createElement(LabelSmall, {
118
- style: [styles.textWordBreak, isLight ? styles.lightDescription : styles.description],
116
+ style: [styles.textWordBreak, styles.description],
119
117
  testId: testId && `${testId}-description`,
120
118
  id: descriptionId
121
119
  }, description), React.createElement(Strut, {
@@ -131,11 +129,11 @@ function LabeledField(props) {
131
129
  "aria-atomic": "true"
132
130
  }, errorMessage && React.createElement(React.Fragment, null, React.createElement(PhosphorIcon, {
133
131
  icon: WarningCircle,
134
- style: [styles.errorIcon, isLight ? styles.lightError : styles.error],
132
+ style: [styles.errorIcon, styles.error],
135
133
  role: "img",
136
134
  "aria-label": labels.errorIconAriaLabel
137
135
  }), React.createElement(LabelSmall, {
138
- style: [styles.textWordBreak, styles.errorMessage, isLight ? styles.lightError : styles.error]
136
+ style: [styles.textWordBreak, styles.errorMessage, styles.error]
139
137
  }, errorMessage))));
140
138
  }
141
139
  function renderField() {
@@ -144,8 +142,7 @@ function LabeledField(props) {
144
142
  "aria-describedby": [errorMessage && errorId, description && descriptionId].filter(Boolean).join(" "),
145
143
  required: required || field.props.required,
146
144
  error: hasError,
147
- testId: testId ? `${testId}-field` : undefined,
148
- light: isLight
145
+ testId: testId ? `${testId}-field` : undefined
149
146
  });
150
147
  }
151
148
  return React.createElement(View, {
@@ -158,15 +155,9 @@ const styles = StyleSheet.create({
158
155
  label: {
159
156
  color: semanticColor.text.primary
160
157
  },
161
- lightLabel: {
162
- color: semanticColor.text.inverse
163
- },
164
158
  description: {
165
159
  color: semanticColor.text.secondary
166
160
  },
167
- lightDescription: {
168
- color: color.white64
169
- },
170
161
  errorSection: {
171
162
  flexDirection: "row",
172
163
  gap: spacing.xSmall_8
@@ -177,9 +168,6 @@ const styles = StyleSheet.create({
177
168
  error: {
178
169
  color: semanticColor.status.critical.foreground
179
170
  },
180
- lightError: {
181
- color: color.fadedRed
182
- },
183
171
  errorIcon: {
184
172
  marginTop: "1px"
185
173
  },
@@ -189,9 +177,6 @@ const styles = StyleSheet.create({
189
177
  required: {
190
178
  color: semanticColor.status.critical.foreground
191
179
  },
192
- lightRequired: {
193
- color: color.fadedRed
194
- },
195
180
  textWordBreak: {
196
181
  overflowWrap: "break-word"
197
182
  }
package/dist/index.js CHANGED
@@ -110,7 +110,6 @@ function LabeledField(props) {
110
110
  id,
111
111
  required,
112
112
  testId,
113
- light,
114
113
  description,
115
114
  errorMessage,
116
115
  labels = defaultLabeledFieldLabels
@@ -123,14 +122,13 @@ function LabeledField(props) {
123
122
  const errorId = `${uniqueId}-error`;
124
123
  const isRequired = !!required || !!field.props.required;
125
124
  const hasError = !!errorMessage || !!field.props.error;
126
- const isLight = light || field.props.light;
127
125
  function renderLabel() {
128
126
  const requiredIcon = React__namespace.createElement(StyledSpan, {
129
- style: [styles.textWordBreak, isLight ? styles.lightRequired : styles.required],
127
+ style: [styles.textWordBreak, styles.required],
130
128
  "aria-hidden": true
131
129
  }, " ", "*");
132
130
  return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
133
- style: [styles.textWordBreak, isLight ? styles.lightLabel : styles.label],
131
+ style: [styles.textWordBreak, styles.label],
134
132
  tag: "label",
135
133
  htmlFor: fieldId,
136
134
  testId: testId && `${testId}-label`,
@@ -144,7 +142,7 @@ function LabeledField(props) {
144
142
  return null;
145
143
  }
146
144
  return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
147
- style: [styles.textWordBreak, isLight ? styles.lightDescription : styles.description],
145
+ style: [styles.textWordBreak, styles.description],
148
146
  testId: testId && `${testId}-description`,
149
147
  id: descriptionId
150
148
  }, description), React__namespace.createElement(wonderBlocksLayout.Strut, {
@@ -160,11 +158,11 @@ function LabeledField(props) {
160
158
  "aria-atomic": "true"
161
159
  }, errorMessage && React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(PhosphorIcon, {
162
160
  icon: WarningCircle__default["default"],
163
- style: [styles.errorIcon, isLight ? styles.lightError : styles.error],
161
+ style: [styles.errorIcon, styles.error],
164
162
  role: "img",
165
163
  "aria-label": labels.errorIconAriaLabel
166
164
  }), React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
167
- style: [styles.textWordBreak, styles.errorMessage, isLight ? styles.lightError : styles.error]
165
+ style: [styles.textWordBreak, styles.errorMessage, styles.error]
168
166
  }, errorMessage))));
169
167
  }
170
168
  function renderField() {
@@ -173,8 +171,7 @@ function LabeledField(props) {
173
171
  "aria-describedby": [errorMessage && errorId, description && descriptionId].filter(Boolean).join(" "),
174
172
  required: required || field.props.required,
175
173
  error: hasError,
176
- testId: testId ? `${testId}-field` : undefined,
177
- light: isLight
174
+ testId: testId ? `${testId}-field` : undefined
178
175
  });
179
176
  }
180
177
  return React__namespace.createElement(wonderBlocksCore.View, {
@@ -187,15 +184,9 @@ const styles = aphrodite.StyleSheet.create({
187
184
  label: {
188
185
  color: wonderBlocksTokens.semanticColor.text.primary
189
186
  },
190
- lightLabel: {
191
- color: wonderBlocksTokens.semanticColor.text.inverse
192
- },
193
187
  description: {
194
188
  color: wonderBlocksTokens.semanticColor.text.secondary
195
189
  },
196
- lightDescription: {
197
- color: wonderBlocksTokens.color.white64
198
- },
199
190
  errorSection: {
200
191
  flexDirection: "row",
201
192
  gap: wonderBlocksTokens.spacing.xSmall_8
@@ -206,9 +197,6 @@ const styles = aphrodite.StyleSheet.create({
206
197
  error: {
207
198
  color: wonderBlocksTokens.semanticColor.status.critical.foreground
208
199
  },
209
- lightError: {
210
- color: wonderBlocksTokens.color.fadedRed
211
- },
212
200
  errorIcon: {
213
201
  marginTop: "1px"
214
202
  },
@@ -218,9 +206,6 @@ const styles = aphrodite.StyleSheet.create({
218
206
  required: {
219
207
  color: wonderBlocksTokens.semanticColor.status.critical.foreground
220
208
  },
221
- lightRequired: {
222
- color: wonderBlocksTokens.color.fadedRed
223
- },
224
209
  textWordBreak: {
225
210
  overflowWrap: "break-word"
226
211
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-labeled-field",
3
- "version": "1.1.1",
3
+ "version": "2.0.1",
4
4
  "design": "v1",
5
5
  "description": "LabeledField handles accessibility and layout for associating labels with form components.",
6
6
  "main": "dist/index.js",
@@ -18,8 +18,8 @@
18
18
  "dependencies": {
19
19
  "@babel/runtime": "^7.18.6",
20
20
  "@khanacademy/wonder-blocks-core": "^11.1.0",
21
- "@khanacademy/wonder-blocks-layout": "^3.0.5",
22
- "@khanacademy/wonder-blocks-tokens": "^3.0.1",
21
+ "@khanacademy/wonder-blocks-layout": "^3.0.7",
22
+ "@khanacademy/wonder-blocks-tokens": "^4.1.0",
23
23
  "@khanacademy/wonder-blocks-typography": "^3.0.5"
24
24
  },
25
25
  "peerDependencies": {