@khanacademy/wonder-blocks-labeled-field 0.0.0-PR2466-20250207212603 → 2.0.0

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,349 +1,300 @@
1
1
  # @khanacademy/wonder-blocks-labeled-field
2
2
 
3
- ## 0.0.0-PR2466-20250207212603
4
-
5
- ### Patch Changes
6
-
7
- - efc1911: Rollback rollup version from v4 to v2 to prevent an issue with CJS builds in unit tests
8
- - Updated dependencies [efc1911]
9
- - @khanacademy/wonder-blocks-core@0.0.0-PR2466-20250207212603
10
- - @khanacademy/wonder-blocks-layout@0.0.0-PR2466-20250207212603
11
- - @khanacademy/wonder-blocks-tokens@0.0.0-PR2466-20250207212603
12
- - @khanacademy/wonder-blocks-typography@0.0.0-PR2466-20250207212603
13
-
14
- ## 2.1.0
15
-
16
- ### Minor Changes
17
-
18
- - f03298f: Tooling:
19
-
20
- - Switching to `pnpm`.
21
- - Upgrading `rollup` to v4 and `@babel/runtime` to match the current webapp version.
22
-
23
- ### Patch Changes
24
-
25
- - bb2a026: pnpm: Switch to workspace protocol to handle dependency versions with changesets on monorepo setup"
26
- - Updated dependencies [969864b]
27
- - Updated dependencies [bb2a026]
28
- - Updated dependencies [f03298f]
29
- - @khanacademy/wonder-blocks-core@12.1.0
30
- - @khanacademy/wonder-blocks-typography@3.1.0
31
- - @khanacademy/wonder-blocks-layout@3.1.0
32
- - @khanacademy/wonder-blocks-tokens@4.2.0
33
-
34
- ## 2.0.2
35
-
36
- ### Patch Changes
37
-
38
- - Updated dependencies [0199324d]
39
- - @khanacademy/wonder-blocks-core@12.0.0
40
- - @khanacademy/wonder-blocks-layout@3.0.8
41
- - @khanacademy/wonder-blocks-typography@3.0.6
42
-
43
- ## 2.0.1
44
-
45
- ### Patch Changes
46
-
47
- - Updated dependencies [8cfaeab0]
48
- - Updated dependencies [c162abb4]
49
- - @khanacademy/wonder-blocks-tokens@4.1.0
50
- - @khanacademy/wonder-blocks-layout@3.0.7
51
-
52
3
  ## 2.0.0
53
4
 
54
5
  ### Major Changes
55
6
 
56
- - 8d26588f: Remove `light` variant/prop from `LabeledField` as it is no longer needed/recommended.
7
+ - 8d26588f: Remove `light` variant/prop from `LabeledField` as it is no longer needed/recommended.
57
8
 
58
9
  ### Patch Changes
59
10
 
60
- - Updated dependencies [0de25cd8]
61
- - @khanacademy/wonder-blocks-tokens@4.0.0
62
- - @khanacademy/wonder-blocks-layout@3.0.6
11
+ - Updated dependencies [0de25cd8]
12
+ - @khanacademy/wonder-blocks-tokens@4.0.0
13
+ - @khanacademy/wonder-blocks-layout@3.0.6
63
14
 
64
15
  ## 1.1.1
65
16
 
66
17
  ### Patch Changes
67
18
 
68
- - dce7d780: Make labeled-field package public
19
+ - dce7d780: Make labeled-field package public
69
20
 
70
21
  ## 1.1.0
71
22
 
72
23
  ### Minor Changes
73
24
 
74
- - 0869c5ee: - Update `LabeledField` styling to use semantic tokens to match Figma specs
75
- - Add error icon to the error message. This addresses accessibility issues related to color being the only way to communicate information
76
- - Add a labels prop so that a translated label for the error icon can be passed in
77
- - Handle long text overflow with and without word breaks
78
- - dea7c71e: LabeledField: Wire up attributes for elements and apply attributes to the field element
25
+ - 0869c5ee: - Update `LabeledField` styling to use semantic tokens to match Figma specs
26
+ - Add error icon to the error message. This addresses accessibility issues related to color being the only way to communicate information
27
+ - Add a labels prop so that a translated label for the error icon can be passed in
28
+ - Handle long text overflow with and without word breaks
29
+ - dea7c71e: LabeledField: Wire up attributes for elements and apply attributes to the field element
79
30
 
80
31
  ### Patch Changes
81
32
 
82
- - fd29f864: LabeledField: Refactor from class component to function component
83
- - ed8fb7bd: Makes sure custom required messages passed into `LabeledField` or the `field` prop are displayed
84
- - d9bc865b: Set required, error and light props for LabeledField and field component if it is set on either LabeledField or field component
85
- - d9bc865b: Use `errorMessage` prop instead of `error` prop for consistency (`error` prop is used for boolean props in form field components).
86
- - d9bc865b: LabeledField: Let `required` prop be a boolean or string so it can be passed down to the field prop
87
- - daf459a1: Sets up the initial implementation for LabeledField based on the internal FieldHeading component in the form package
33
+ - fd29f864: LabeledField: Refactor from class component to function component
34
+ - ed8fb7bd: Makes sure custom required messages passed into `LabeledField` or the `field` prop are displayed
35
+ - d9bc865b: Set required, error and light props for LabeledField and field component if it is set on either LabeledField or field component
36
+ - d9bc865b: Use `errorMessage` prop instead of `error` prop for consistency (`error` prop is used for boolean props in form field components).
37
+ - d9bc865b: LabeledField: Let `required` prop be a boolean or string so it can be passed down to the field prop
38
+ - daf459a1: Sets up the initial implementation for LabeledField based on the internal FieldHeading component in the form package
88
39
 
89
40
  ## 1.0.5
90
41
 
91
42
  ### Patch Changes
92
43
 
93
- - Updated dependencies [7516b239]
94
- - @khanacademy/wonder-blocks-core@11.1.0
95
- - @khanacademy/wonder-blocks-layout@3.0.5
96
- - @khanacademy/wonder-blocks-typography@3.0.5
44
+ - Updated dependencies [7516b239]
45
+ - @khanacademy/wonder-blocks-core@11.1.0
46
+ - @khanacademy/wonder-blocks-layout@3.0.5
47
+ - @khanacademy/wonder-blocks-typography@3.0.5
97
48
 
98
49
  ## 1.0.4
99
50
 
100
51
  ### Patch Changes
101
52
 
102
- - 11a0f5c6: No functional changes. Adding prepublishOnly script.
103
- - Updated dependencies [11a0f5c6]
104
- - @khanacademy/wonder-blocks-typography@3.0.4
105
- - @khanacademy/wonder-blocks-layout@3.0.4
106
- - @khanacademy/wonder-blocks-tokens@3.0.1
107
- - @khanacademy/wonder-blocks-core@11.0.1
53
+ - 11a0f5c6: No functional changes. Adding prepublishOnly script.
54
+ - Updated dependencies [11a0f5c6]
55
+ - @khanacademy/wonder-blocks-typography@3.0.4
56
+ - @khanacademy/wonder-blocks-layout@3.0.4
57
+ - @khanacademy/wonder-blocks-tokens@3.0.1
58
+ - @khanacademy/wonder-blocks-core@11.0.1
108
59
 
109
60
  ## 1.0.3
110
61
 
111
62
  ### Patch Changes
112
63
 
113
- - Updated dependencies [d23c9c5f]
114
- - @khanacademy/wonder-blocks-core@11.0.0
115
- - @khanacademy/wonder-blocks-layout@3.0.3
116
- - @khanacademy/wonder-blocks-typography@3.0.3
64
+ - Updated dependencies [d23c9c5f]
65
+ - @khanacademy/wonder-blocks-core@11.0.0
66
+ - @khanacademy/wonder-blocks-layout@3.0.3
67
+ - @khanacademy/wonder-blocks-typography@3.0.3
117
68
 
118
69
  ## 1.0.2
119
70
 
120
71
  ### Patch Changes
121
72
 
122
- - Updated dependencies [b6009b77]
123
- - Updated dependencies [897686bc]
124
- - Updated dependencies [56d961f1]
125
- - @khanacademy/wonder-blocks-core@10.0.0
126
- - @khanacademy/wonder-blocks-layout@3.0.2
127
- - @khanacademy/wonder-blocks-typography@3.0.2
73
+ - Updated dependencies [b6009b77]
74
+ - Updated dependencies [897686bc]
75
+ - Updated dependencies [56d961f1]
76
+ - @khanacademy/wonder-blocks-core@10.0.0
77
+ - @khanacademy/wonder-blocks-layout@3.0.2
78
+ - @khanacademy/wonder-blocks-typography@3.0.2
128
79
 
129
80
  ## 1.0.1
130
81
 
131
82
  ### Patch Changes
132
83
 
133
- - Updated dependencies [f4abd572]
134
- - @khanacademy/wonder-blocks-core@9.0.0
135
- - @khanacademy/wonder-blocks-layout@3.0.1
136
- - @khanacademy/wonder-blocks-typography@3.0.1
84
+ - Updated dependencies [f4abd572]
85
+ - @khanacademy/wonder-blocks-core@9.0.0
86
+ - @khanacademy/wonder-blocks-layout@3.0.1
87
+ - @khanacademy/wonder-blocks-typography@3.0.1
137
88
 
138
89
  ## 1.0.0
139
90
 
140
91
  ### Major Changes
141
92
 
142
- - e6abdd17: Upgrade to React 18
93
+ - e6abdd17: Upgrade to React 18
143
94
 
144
95
  ### Patch Changes
145
96
 
146
- - Updated dependencies [e6abdd17]
147
- - @khanacademy/wonder-blocks-core@8.0.0
148
- - @khanacademy/wonder-blocks-layout@3.0.0
149
- - @khanacademy/wonder-blocks-tokens@3.0.0
150
- - @khanacademy/wonder-blocks-typography@3.0.0
97
+ - Updated dependencies [e6abdd17]
98
+ - @khanacademy/wonder-blocks-core@8.0.0
99
+ - @khanacademy/wonder-blocks-layout@3.0.0
100
+ - @khanacademy/wonder-blocks-tokens@3.0.0
101
+ - @khanacademy/wonder-blocks-typography@3.0.0
151
102
 
152
103
  ## 0.1.21
153
104
 
154
105
  ### Patch Changes
155
106
 
156
- - Updated dependencies [6999fd39]
157
- - @khanacademy/wonder-blocks-tokens@2.1.0
158
- - @khanacademy/wonder-blocks-layout@2.2.2
107
+ - Updated dependencies [6999fd39]
108
+ - @khanacademy/wonder-blocks-tokens@2.1.0
109
+ - @khanacademy/wonder-blocks-layout@2.2.2
159
110
 
160
111
  ## 0.1.20
161
112
 
162
113
  ### Patch Changes
163
114
 
164
- - 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
165
- - Updated dependencies [02a1b298]
166
- - @khanacademy/wonder-blocks-core@7.0.1
167
- - @khanacademy/wonder-blocks-layout@2.2.1
168
- - @khanacademy/wonder-blocks-tokens@2.0.1
169
- - @khanacademy/wonder-blocks-typography@2.1.16
115
+ - 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
116
+ - Updated dependencies [02a1b298]
117
+ - @khanacademy/wonder-blocks-core@7.0.1
118
+ - @khanacademy/wonder-blocks-layout@2.2.1
119
+ - @khanacademy/wonder-blocks-tokens@2.0.1
120
+ - @khanacademy/wonder-blocks-typography@2.1.16
170
121
 
171
122
  ## 0.1.19
172
123
 
173
124
  ### Patch Changes
174
125
 
175
- - Updated dependencies [07f7f407]
176
- - @khanacademy/wonder-blocks-core@7.0.0
177
- - @khanacademy/wonder-blocks-layout@2.2.0
178
- - @khanacademy/wonder-blocks-typography@2.1.15
126
+ - Updated dependencies [07f7f407]
127
+ - @khanacademy/wonder-blocks-core@7.0.0
128
+ - @khanacademy/wonder-blocks-layout@2.2.0
129
+ - @khanacademy/wonder-blocks-typography@2.1.15
179
130
 
180
131
  ## 0.1.18
181
132
 
182
133
  ### Patch Changes
183
134
 
184
- - Updated dependencies [f17dc1ee]
185
- - Updated dependencies [991eb43f]
186
- - @khanacademy/wonder-blocks-tokens@2.0.0
187
- - @khanacademy/wonder-blocks-layout@2.1.3
135
+ - Updated dependencies [f17dc1ee]
136
+ - Updated dependencies [991eb43f]
137
+ - @khanacademy/wonder-blocks-tokens@2.0.0
138
+ - @khanacademy/wonder-blocks-layout@2.1.3
188
139
 
189
140
  ## 0.1.17
190
141
 
191
142
  ### Patch Changes
192
143
 
193
- - 559e82d5: Update to build tooling, generating smaller output
194
- - Updated dependencies [559e82d5]
195
- - @khanacademy/wonder-blocks-core@6.4.3
196
- - @khanacademy/wonder-blocks-layout@2.1.2
197
- - @khanacademy/wonder-blocks-tokens@1.3.1
198
- - @khanacademy/wonder-blocks-typography@2.1.14
144
+ - 559e82d5: Update to build tooling, generating smaller output
145
+ - Updated dependencies [559e82d5]
146
+ - @khanacademy/wonder-blocks-core@6.4.3
147
+ - @khanacademy/wonder-blocks-layout@2.1.2
148
+ - @khanacademy/wonder-blocks-tokens@1.3.1
149
+ - @khanacademy/wonder-blocks-typography@2.1.14
199
150
 
200
151
  ## 0.1.16
201
152
 
202
153
  ### Patch Changes
203
154
 
204
- - Updated dependencies [eab37b8b]
205
- - @khanacademy/wonder-blocks-core@6.4.2
206
- - @khanacademy/wonder-blocks-layout@2.1.1
207
- - @khanacademy/wonder-blocks-typography@2.1.13
155
+ - Updated dependencies [eab37b8b]
156
+ - @khanacademy/wonder-blocks-core@6.4.2
157
+ - @khanacademy/wonder-blocks-layout@2.1.1
158
+ - @khanacademy/wonder-blocks-typography@2.1.13
208
159
 
209
160
  ## 0.1.15
210
161
 
211
162
  ### Patch Changes
212
163
 
213
- - Updated dependencies [47a758b6]
214
- - @khanacademy/wonder-blocks-layout@2.1.0
164
+ - Updated dependencies [47a758b6]
165
+ - @khanacademy/wonder-blocks-layout@2.1.0
215
166
 
216
167
  ## 0.1.14
217
168
 
218
169
  ### Patch Changes
219
170
 
220
- - Updated dependencies [5dfac06e]
221
- - @khanacademy/wonder-blocks-core@6.4.1
222
- - @khanacademy/wonder-blocks-layout@2.0.33
223
- - @khanacademy/wonder-blocks-typography@2.1.12
171
+ - Updated dependencies [5dfac06e]
172
+ - @khanacademy/wonder-blocks-core@6.4.1
173
+ - @khanacademy/wonder-blocks-layout@2.0.33
174
+ - @khanacademy/wonder-blocks-typography@2.1.12
224
175
 
225
176
  ## 0.1.13
226
177
 
227
178
  ### Patch Changes
228
179
 
229
- - Updated dependencies [9bfeead9]
230
- - @khanacademy/wonder-blocks-tokens@1.3.0
231
- - @khanacademy/wonder-blocks-layout@2.0.32
180
+ - Updated dependencies [9bfeead9]
181
+ - @khanacademy/wonder-blocks-tokens@1.3.0
182
+ - @khanacademy/wonder-blocks-layout@2.0.32
232
183
 
233
184
  ## 0.1.12
234
185
 
235
186
  ### Patch Changes
236
187
 
237
- - Updated dependencies [58075352]
238
- - @khanacademy/wonder-blocks-core@6.4.0
239
- - @khanacademy/wonder-blocks-layout@2.0.31
240
- - @khanacademy/wonder-blocks-typography@2.1.11
188
+ - Updated dependencies [58075352]
189
+ - @khanacademy/wonder-blocks-core@6.4.0
190
+ - @khanacademy/wonder-blocks-layout@2.0.31
191
+ - @khanacademy/wonder-blocks-typography@2.1.11
241
192
 
242
193
  ## 0.1.11
243
194
 
244
195
  ### Patch Changes
245
196
 
246
- - Updated dependencies [874081aa]
247
- - Updated dependencies [874081aa]
248
- - Updated dependencies [a9bf603a]
249
- - @khanacademy/wonder-blocks-tokens@1.2.0
250
- - @khanacademy/wonder-blocks-layout@2.0.30
197
+ - Updated dependencies [874081aa]
198
+ - Updated dependencies [874081aa]
199
+ - Updated dependencies [a9bf603a]
200
+ - @khanacademy/wonder-blocks-tokens@1.2.0
201
+ - @khanacademy/wonder-blocks-layout@2.0.30
251
202
 
252
203
  ## 0.1.10
253
204
 
254
205
  ### Patch Changes
255
206
 
256
- - Updated dependencies [c39bfd29]
257
- - @khanacademy/wonder-blocks-layout@2.0.29
207
+ - Updated dependencies [c39bfd29]
208
+ - @khanacademy/wonder-blocks-layout@2.0.29
258
209
 
259
210
  ## 0.1.9
260
211
 
261
212
  ### Patch Changes
262
213
 
263
- - Updated dependencies [4cfb4977]
264
- - @khanacademy/wonder-blocks-tokens@1.1.0
265
- - @khanacademy/wonder-blocks-layout@2.0.28
214
+ - Updated dependencies [4cfb4977]
215
+ - @khanacademy/wonder-blocks-tokens@1.1.0
216
+ - @khanacademy/wonder-blocks-layout@2.0.28
266
217
 
267
218
  ## 0.1.8
268
219
 
269
220
  ### Patch Changes
270
221
 
271
- - Updated dependencies [e83f8991]
272
- - @khanacademy/wonder-blocks-tokens@1.0.0
273
- - @khanacademy/wonder-blocks-layout@2.0.27
222
+ - Updated dependencies [e83f8991]
223
+ - @khanacademy/wonder-blocks-tokens@1.0.0
224
+ - @khanacademy/wonder-blocks-layout@2.0.27
274
225
 
275
226
  ## 0.1.7
276
227
 
277
228
  ### Patch Changes
278
229
 
279
- - 60aba5b8: Update internal spacing references (from wb-spacing to wb-tokens)
280
- - 7c51f377: Migrate wb-color imports to use tokens.color
281
- - Updated dependencies [60aba5b8]
282
- - Updated dependencies [7cd7f6cc]
283
- - Updated dependencies [7c51f377]
284
- - @khanacademy/wonder-blocks-layout@2.0.26
285
- - @khanacademy/wonder-blocks-tokens@0.2.0
230
+ - 60aba5b8: Update internal spacing references (from wb-spacing to wb-tokens)
231
+ - 7c51f377: Migrate wb-color imports to use tokens.color
232
+ - Updated dependencies [60aba5b8]
233
+ - Updated dependencies [7cd7f6cc]
234
+ - Updated dependencies [7c51f377]
235
+ - @khanacademy/wonder-blocks-layout@2.0.26
236
+ - @khanacademy/wonder-blocks-tokens@0.2.0
286
237
 
287
238
  ## 0.1.6
288
239
 
289
240
  ### Patch Changes
290
241
 
291
- - Updated dependencies [6df21f71]
292
- - @khanacademy/wonder-blocks-core@6.3.1
293
- - @khanacademy/wonder-blocks-layout@2.0.25
294
- - @khanacademy/wonder-blocks-typography@2.1.10
242
+ - Updated dependencies [6df21f71]
243
+ - @khanacademy/wonder-blocks-core@6.3.1
244
+ - @khanacademy/wonder-blocks-layout@2.0.25
245
+ - @khanacademy/wonder-blocks-typography@2.1.10
295
246
 
296
247
  ## 0.1.5
297
248
 
298
249
  ### Patch Changes
299
250
 
300
- - Updated dependencies [7055ca94]
301
- - @khanacademy/wonder-blocks-core@6.3.0
302
- - @khanacademy/wonder-blocks-layout@2.0.24
303
- - @khanacademy/wonder-blocks-typography@2.1.9
251
+ - Updated dependencies [7055ca94]
252
+ - @khanacademy/wonder-blocks-core@6.3.0
253
+ - @khanacademy/wonder-blocks-layout@2.0.24
254
+ - @khanacademy/wonder-blocks-typography@2.1.9
304
255
 
305
256
  ## 0.1.4
306
257
 
307
258
  ### Patch Changes
308
259
 
309
- - Updated dependencies [b6fbd635]
310
- - @khanacademy/wonder-blocks-layout@2.0.23
260
+ - Updated dependencies [b6fbd635]
261
+ - @khanacademy/wonder-blocks-layout@2.0.23
311
262
 
312
263
  ## 0.1.3
313
264
 
314
265
  ### Patch Changes
315
266
 
316
- - Updated dependencies [48d3c7e9]
317
- - @khanacademy/wonder-blocks-color@3.0.0
267
+ - Updated dependencies [48d3c7e9]
268
+ - @khanacademy/wonder-blocks-color@3.0.0
318
269
 
319
270
  ## 0.1.2
320
271
 
321
272
  ### Patch Changes
322
273
 
323
- - Updated dependencies [4b97b9a2]
324
- - @khanacademy/wonder-blocks-core@6.2.0
325
- - @khanacademy/wonder-blocks-layout@2.0.22
326
- - @khanacademy/wonder-blocks-typography@2.1.8
274
+ - Updated dependencies [4b97b9a2]
275
+ - @khanacademy/wonder-blocks-core@6.2.0
276
+ - @khanacademy/wonder-blocks-layout@2.0.22
277
+ - @khanacademy/wonder-blocks-typography@2.1.8
327
278
 
328
279
  ## 0.1.1
329
280
 
330
281
  ### Patch Changes
331
282
 
332
- - Updated dependencies [2871f0a9]
333
- - @khanacademy/wonder-blocks-core@6.1.1
334
- - @khanacademy/wonder-blocks-layout@2.0.21
335
- - @khanacademy/wonder-blocks-typography@2.1.7
283
+ - Updated dependencies [2871f0a9]
284
+ - @khanacademy/wonder-blocks-core@6.1.1
285
+ - @khanacademy/wonder-blocks-layout@2.0.21
286
+ - @khanacademy/wonder-blocks-typography@2.1.7
336
287
 
337
288
  ## 0.1.0
338
289
 
339
290
  ### Minor Changes
340
291
 
341
- - db74f86f: Add skeleton for new labeled field package
292
+ - db74f86f: Add skeleton for new labeled field package
342
293
 
343
294
  ### Patch Changes
344
295
 
345
- - Updated dependencies [efb59c29]
346
- - Updated dependencies [8bc40ed2]
347
- - @khanacademy/wonder-blocks-core@6.1.0
348
- - @khanacademy/wonder-blocks-layout@2.0.20
349
- - @khanacademy/wonder-blocks-typography@2.1.6
296
+ - Updated dependencies [efb59c29]
297
+ - Updated dependencies [8bc40ed2]
298
+ - @khanacademy/wonder-blocks-core@6.1.0
299
+ - @khanacademy/wonder-blocks-layout@2.0.20
300
+ - @khanacademy/wonder-blocks-typography@2.1.6
package/dist/es/index.js CHANGED
@@ -5,7 +5,69 @@ import { addStyle, View } from '@khanacademy/wonder-blocks-core';
5
5
  import { Strut } from '@khanacademy/wonder-blocks-layout';
6
6
  import { semanticColor, spacing } from '@khanacademy/wonder-blocks-tokens';
7
7
  import { LabelMedium, LabelSmall } from '@khanacademy/wonder-blocks-typography';
8
- import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
8
+ import _extends from '@babel/runtime/helpers/extends';
9
+ import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
10
+
11
+ const viewportPixelsForSize = size => ({
12
+ small: 16,
13
+ medium: 24,
14
+ large: 48,
15
+ xlarge: 96
16
+ })[size];
17
+ const _excluded = ["color", "icon", "size", "style", "testId", "className", "role"];
18
+ const StyledIcon = addStyle("span");
19
+ const PhosphorIcon = React.forwardRef(function PhosphorIcon(props, ref) {
20
+ const {
21
+ color = "currentColor",
22
+ icon,
23
+ size = "small",
24
+ style,
25
+ testId,
26
+ className,
27
+ role
28
+ } = props,
29
+ sharedProps = _objectWithoutPropertiesLoose(props, _excluded);
30
+ const pixelSize = viewportPixelsForSize(size);
31
+ const classNames = `${className != null ? className : ""}`;
32
+ const iconStyles = _generateStyles(color, pixelSize);
33
+ return React.createElement(StyledIcon, _extends({}, sharedProps, {
34
+ className: classNames,
35
+ style: [styles$1.svg, iconStyles.icon, {
36
+ maskImage: `url(${icon})`
37
+ }, style],
38
+ "data-testid": testId,
39
+ ref: ref,
40
+ role: (role != null ? role : sharedProps["aria-label"]) ? "img" : undefined
41
+ }));
42
+ });
43
+ const dynamicStyles = {};
44
+ const _generateStyles = (color, size) => {
45
+ const iconStyle = `${color}-${size}`;
46
+ if (styles$1[iconStyle]) {
47
+ return styles$1[iconStyle];
48
+ }
49
+ const newStyles = {
50
+ icon: {
51
+ backgroundColor: color,
52
+ width: size,
53
+ height: size
54
+ }
55
+ };
56
+ dynamicStyles[iconStyle] = StyleSheet.create(newStyles);
57
+ return dynamicStyles[iconStyle];
58
+ };
59
+ const styles$1 = StyleSheet.create({
60
+ svg: {
61
+ display: "inline-block",
62
+ verticalAlign: "text-bottom",
63
+ flexShrink: 0,
64
+ flexGrow: 0,
65
+ maskSize: "100%",
66
+ maskRepeat: "no-repeat",
67
+ maskPosition: "center"
68
+ }
69
+ });
70
+ PhosphorIcon.displayName = "PhosphorIcon";
9
71
 
10
72
  const defaultLabeledFieldLabels = {
11
73
  errorIconAriaLabel: "Error:"
package/dist/index.js CHANGED
@@ -9,30 +9,94 @@ var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
9
9
  var wonderBlocksLayout = require('@khanacademy/wonder-blocks-layout');
10
10
  var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
11
11
  var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
12
- var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
12
+ var _extends = require('@babel/runtime/helpers/extends');
13
+ var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
13
14
 
14
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
16
 
16
17
  function _interopNamespace(e) {
17
- if (e && e.__esModule) return e;
18
- var n = Object.create(null);
19
- if (e) {
20
- Object.keys(e).forEach(function (k) {
21
- if (k !== 'default') {
22
- var d = Object.getOwnPropertyDescriptor(e, k);
23
- Object.defineProperty(n, k, d.get ? d : {
24
- enumerable: true,
25
- get: function () { return e[k]; }
26
- });
27
- }
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
28
27
  });
29
- }
30
- n["default"] = e;
31
- return Object.freeze(n);
28
+ }
29
+ });
30
+ }
31
+ n["default"] = e;
32
+ return Object.freeze(n);
32
33
  }
33
34
 
34
35
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
35
36
  var WarningCircle__default = /*#__PURE__*/_interopDefaultLegacy(WarningCircle);
37
+ var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
38
+ var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
39
+
40
+ const viewportPixelsForSize = size => ({
41
+ small: 16,
42
+ medium: 24,
43
+ large: 48,
44
+ xlarge: 96
45
+ })[size];
46
+ const _excluded = ["color", "icon", "size", "style", "testId", "className", "role"];
47
+ const StyledIcon = wonderBlocksCore.addStyle("span");
48
+ const PhosphorIcon = React__namespace.forwardRef(function PhosphorIcon(props, ref) {
49
+ const {
50
+ color = "currentColor",
51
+ icon,
52
+ size = "small",
53
+ style,
54
+ testId,
55
+ className,
56
+ role
57
+ } = props,
58
+ sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
59
+ const pixelSize = viewportPixelsForSize(size);
60
+ const classNames = `${className != null ? className : ""}`;
61
+ const iconStyles = _generateStyles(color, pixelSize);
62
+ return React__namespace.createElement(StyledIcon, _extends__default["default"]({}, sharedProps, {
63
+ className: classNames,
64
+ style: [styles$1.svg, iconStyles.icon, {
65
+ maskImage: `url(${icon})`
66
+ }, style],
67
+ "data-testid": testId,
68
+ ref: ref,
69
+ role: (role != null ? role : sharedProps["aria-label"]) ? "img" : undefined
70
+ }));
71
+ });
72
+ const dynamicStyles = {};
73
+ const _generateStyles = (color, size) => {
74
+ const iconStyle = `${color}-${size}`;
75
+ if (styles$1[iconStyle]) {
76
+ return styles$1[iconStyle];
77
+ }
78
+ const newStyles = {
79
+ icon: {
80
+ backgroundColor: color,
81
+ width: size,
82
+ height: size
83
+ }
84
+ };
85
+ dynamicStyles[iconStyle] = aphrodite.StyleSheet.create(newStyles);
86
+ return dynamicStyles[iconStyle];
87
+ };
88
+ const styles$1 = aphrodite.StyleSheet.create({
89
+ svg: {
90
+ display: "inline-block",
91
+ verticalAlign: "text-bottom",
92
+ flexShrink: 0,
93
+ flexGrow: 0,
94
+ maskSize: "100%",
95
+ maskRepeat: "no-repeat",
96
+ maskPosition: "center"
97
+ }
98
+ });
99
+ PhosphorIcon.displayName = "PhosphorIcon";
36
100
 
37
101
  const defaultLabeledFieldLabels = {
38
102
  errorIconAriaLabel: "Error:"
@@ -92,7 +156,7 @@ function LabeledField(props) {
92
156
  testId: testId && `${testId}-error`,
93
157
  "aria-live": "assertive",
94
158
  "aria-atomic": "true"
95
- }, errorMessage && React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
159
+ }, errorMessage && React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(PhosphorIcon, {
96
160
  icon: WarningCircle__default["default"],
97
161
  style: [styles.errorIcon, styles.error],
98
162
  role: "img",
package/package.json CHANGED
@@ -1,22 +1,26 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-labeled-field",
3
- "version": "0.0.0-PR2466-20250207212603",
3
+ "version": "2.0.0",
4
4
  "design": "v1",
5
5
  "description": "LabeledField handles accessibility and layout for associating labels with form components.",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/es/index.js",
8
8
  "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
12
+ },
9
13
  "author": "",
10
14
  "license": "MIT",
11
15
  "publishConfig": {
12
16
  "access": "public"
13
17
  },
14
18
  "dependencies": {
15
- "@babel/runtime": "^7.24.5",
16
- "@khanacademy/wonder-blocks-core": "0.0.0-PR2466-20250207212603",
17
- "@khanacademy/wonder-blocks-layout": "0.0.0-PR2466-20250207212603",
18
- "@khanacademy/wonder-blocks-tokens": "0.0.0-PR2466-20250207212603",
19
- "@khanacademy/wonder-blocks-typography": "0.0.0-PR2466-20250207212603"
19
+ "@babel/runtime": "^7.18.6",
20
+ "@khanacademy/wonder-blocks-core": "^11.1.0",
21
+ "@khanacademy/wonder-blocks-layout": "^3.0.6",
22
+ "@khanacademy/wonder-blocks-tokens": "^4.0.0",
23
+ "@khanacademy/wonder-blocks-typography": "^3.0.5"
20
24
  },
21
25
  "peerDependencies": {
22
26
  "@phosphor-icons/core": "^2.0.2",
@@ -24,9 +28,6 @@
24
28
  "react": "18.2.0"
25
29
  },
26
30
  "devDependencies": {
27
- "@khanacademy/wb-dev-build-settings": "0.0.0-PR2466-20250207212603"
28
- },
29
- "scripts": {
30
- "test": "echo \"Error: no test specified\" && exit 1"
31
+ "@khanacademy/wb-dev-build-settings": "^2.0.0"
31
32
  }
32
33
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 Khan Academy
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.