@khanacademy/wonder-blocks-core 11.1.0 → 12.1.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,120 +1,140 @@
1
1
  # @khanacademy/wonder-blocks-core
2
2
 
3
+ ## 12.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f03298f: Tooling:
8
+
9
+ - Switching to `pnpm`.
10
+ - Upgrading `rollup` to v4 and `@babel/runtime` to match the current webapp version.
11
+
12
+ ### Patch Changes
13
+
14
+ - 969864b: Update internal addStyle variable name to address aphrodite-add-style-variable-name linting rule
15
+ - bb2a026: pnpm: Switch to workspace protocol to handle dependency versions with changesets on monorepo setup"
16
+
17
+ ## 12.0.0
18
+
19
+ ### Major Changes
20
+
21
+ - 0199324d: Fixes keyboard tests in Dropdown and Clickable with specific key events. We now check `event.key` instead of `event.which` or `event.keyCode` to remove deprecated event properties and match the keys returned from Testing Library/userEvent.
22
+
3
23
  ## 11.1.0
4
24
 
5
25
  ### Minor Changes
6
26
 
7
- - 7516b239: Update useOnMountEffect to pass isMountedRef to callback
27
+ - 7516b239: Update useOnMountEffect to pass isMountedRef to callback
8
28
 
9
29
  ## 11.0.1
10
30
 
11
31
  ### Patch Changes
12
32
 
13
- - 11a0f5c6: No functional changes. Adding prepublishOnly script.
33
+ - 11a0f5c6: No functional changes. Adding prepublishOnly script.
14
34
 
15
35
  ## 11.0.0
16
36
 
17
37
  ### Major Changes
18
38
 
19
- - d23c9c5f: Delete the custom identifier generation API
39
+ - d23c9c5f: Delete the custom identifier generation API
20
40
 
21
41
  ## 10.0.0
22
42
 
23
43
  ### Major Changes
24
44
 
25
- - b6009b77: Deprecate the ID provider and unique ID utilities
45
+ - b6009b77: Deprecate the ID provider and unique ID utilities
26
46
 
27
47
  ### Minor Changes
28
48
 
29
- - 897686bc: - Add the `Id` component for cases where `useId` cannot be used directly
49
+ - 897686bc: - Add the `Id` component for cases where `useId` cannot be used directly
30
50
 
31
51
  ### Patch Changes
32
52
 
33
- - 56d961f1: - Migrate Wonder Blocks components off old id providers and onto new `Id` component
53
+ - 56d961f1: - Migrate Wonder Blocks components off old id providers and onto new `Id` component
34
54
 
35
55
  ## 9.0.0
36
56
 
37
57
  ### Major Changes
38
58
 
39
- - f4abd572: - Remove `RenderState.Root` from exported enum
40
- - Change `useRenderState` to only return `RenderState.Initial` or `RenderState.Standard`
59
+ - f4abd572: - Remove `RenderState.Root` from exported enum
60
+ - Change `useRenderState` to only return `RenderState.Initial` or `RenderState.Standard`
41
61
 
42
62
  ## 8.0.0
43
63
 
44
64
  ### Major Changes
45
65
 
46
- - e6abdd17: Upgrade to React 18
66
+ - e6abdd17: Upgrade to React 18
47
67
 
48
68
  ## 7.0.1
49
69
 
50
70
  ### Patch Changes
51
71
 
52
- - 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
72
+ - 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
53
73
 
54
74
  ## 7.0.0
55
75
 
56
76
  ### Major Changes
57
77
 
58
- - 07f7f407: Renamed `WithSSRPlaceholder` to `InitialFallback`. This includes changing the `placeholder` prop to `fallback` so it's closer to `Suspense` usage.
78
+ - 07f7f407: Renamed `WithSSRPlaceholder` to `InitialFallback`. This includes changing the `placeholder` prop to `fallback` so it's closer to `Suspense` usage.
59
79
 
60
80
  ## 6.4.3
61
81
 
62
82
  ### Patch Changes
63
83
 
64
- - 559e82d5: Update to build tooling, generating smaller output
84
+ - 559e82d5: Update to build tooling, generating smaller output
65
85
 
66
86
  ## 6.4.2
67
87
 
68
88
  ### Patch Changes
69
89
 
70
- - eab37b8b: Test file changes only. No external changes at all.
90
+ - eab37b8b: Test file changes only. No external changes at all.
71
91
 
72
92
  ## 6.4.1
73
93
 
74
94
  ### Patch Changes
75
95
 
76
- - 5dfac06e: Allow all special characters in IDs, except whitespace.
96
+ - 5dfac06e: Allow all special characters in IDs, except whitespace.
77
97
 
78
98
  ## 6.4.0
79
99
 
80
100
  ### Minor Changes
81
101
 
82
- - 58075352: Change testId to render the default Testing Library HTML attribute: data-testid (was data-test-id)
102
+ - 58075352: Change testId to render the default Testing Library HTML attribute: data-testid (was data-test-id)
83
103
 
84
104
  ## 6.3.1
85
105
 
86
106
  ### Patch Changes
87
107
 
88
- - 6df21f71: Append className if set via props
108
+ - 6df21f71: Append className if set via props
89
109
 
90
110
  ## 6.3.0
91
111
 
92
112
  ### Minor Changes
93
113
 
94
- - 7055ca94: Make useOnMountEffect accept functions with void return types
114
+ - 7055ca94: Make useOnMountEffect accept functions with void return types
95
115
 
96
116
  ## 6.2.0
97
117
 
98
118
  ### Minor Changes
99
119
 
100
- - 4b97b9a2: Remove deps argument from `usePreHydrationEffect`
120
+ - 4b97b9a2: Remove deps argument from `usePreHydrationEffect`
101
121
 
102
122
  ## 6.1.1
103
123
 
104
124
  ### Patch Changes
105
125
 
106
- - 2871f0a9: Add new usePreHydrationEffect hook to module exports
126
+ - 2871f0a9: Add new usePreHydrationEffect hook to module exports
107
127
 
108
128
  ## 6.1.0
109
129
 
110
130
  ### Minor Changes
111
131
 
112
- - efb59c29: Add `usePreHydrationEffect`
132
+ - efb59c29: Add `usePreHydrationEffect`
113
133
 
114
134
  ### Patch Changes
115
135
 
116
- - 8bc40ed2: Change the return type of `useLatestRef` from `RefObject<T>` to
117
- `{readonly current: T}`, so the `current` property is not nullable.
136
+ - 8bc40ed2: Change the return type of `useLatestRef` from `RefObject<T>` to
137
+ `{readonly current: T}`, so the `current` property is not nullable.
118
138
 
119
139
  This fixes a bug introduced by the migration to TypeScript.
120
140
 
@@ -122,158 +142,158 @@
122
142
 
123
143
  ### Patch Changes
124
144
 
125
- - f19da46e: Allow 'title' on View and typography components
145
+ - f19da46e: Allow 'title' on View and typography components
126
146
 
127
147
  ## 6.0.1
128
148
 
129
149
  ### Patch Changes
130
150
 
131
- - 1920feb8: `RenderStateRoot` now wraps children in a React fragment
151
+ - 1920feb8: `RenderStateRoot` now wraps children in a React fragment
132
152
 
133
153
  ## 6.0.0
134
154
 
135
155
  ### Major Changes
136
156
 
137
- - 674a1e5c: POJOs have been replace with TS enums
157
+ - 674a1e5c: POJOs have been replace with TS enums
138
158
 
139
159
  ### Patch Changes
140
160
 
141
- - 674a1e5c: We're no longer building flow types
161
+ - 674a1e5c: We're no longer building flow types
142
162
 
143
163
  ## 5.4.0
144
164
 
145
165
  ### Minor Changes
146
166
 
147
- - 1344436f: Add `PropsFor` type to simplify `JSX.LibraryManagedAttributes` usage
167
+ - 1344436f: Add `PropsFor` type to simplify `JSX.LibraryManagedAttributes` usage
148
168
 
149
169
  ## 5.3.1
150
170
 
151
171
  ### Patch Changes
152
172
 
153
- - 9f3752d4: Used named functions in componenets with forwarded refs
173
+ - 9f3752d4: Used named functions in componenets with forwarded refs
154
174
 
155
175
  ## 5.3.0
156
176
 
157
177
  ### Minor Changes
158
178
 
159
- - c37b99aa: Forward refs for Text and Title
160
- - c4cef3e6: Added ref forwarding to View
179
+ - c37b99aa: Forward refs for Text and Title
180
+ - c4cef3e6: Added ref forwarding to View
161
181
 
162
182
  ## 5.2.3
163
183
 
164
184
  ### Patch Changes
165
185
 
166
- - d4c412b5: Update useForceUpdate to ensure consuming hooks properly refresh
186
+ - d4c412b5: Update useForceUpdate to ensure consuming hooks properly refresh
167
187
 
168
188
  ## 5.2.2
169
189
 
170
190
  ### Patch Changes
171
191
 
172
- - 64a188e3: Fix useForceUpdate so that regardless of how many times it is called before a new render, it will always cause a new render
192
+ - 64a188e3: Fix useForceUpdate so that regardless of how many times it is called before a new render, it will always cause a new render
173
193
 
174
194
  ## 5.2.1
175
195
 
176
196
  ### Patch Changes
177
197
 
178
- - 5a1ea891: Make sure that React contexts are named
179
- - df9a10aa: Update state and props to be readonly in components using getDerivedStateFromProps()
198
+ - 5a1ea891: Make sure that React contexts are named
199
+ - df9a10aa: Update state and props to be readonly in components using getDerivedStateFromProps()
180
200
 
181
201
  ## 5.2.0
182
202
 
183
203
  ### Minor Changes
184
204
 
185
- - fa70c895: Add 'lang', 'className' and 'htmlFor' properties to Text and View
205
+ - fa70c895: Add 'lang', 'className' and 'htmlFor' properties to Text and View
186
206
 
187
207
  ### Patch Changes
188
208
 
189
- - 19ab0408: Update flowgen to convert React.ForwardRefExoticComponent<> and React.FowardedRef<> properly
190
- - fa70c895: Remove all TypeScript error suppressions on JSX attributes
209
+ - 19ab0408: Update flowgen to convert React.ForwardRefExoticComponent<> and React.FowardedRef<> properly
210
+ - fa70c895: Remove all TypeScript error suppressions on JSX attributes
191
211
 
192
212
  ## 5.1.0
193
213
 
194
214
  ### Minor Changes
195
215
 
196
- - 3c400719: Add useLatestRef hook to wonder-blocks-core
216
+ - 3c400719: Add useLatestRef hook to wonder-blocks-core
197
217
 
198
218
  ### Patch Changes
199
219
 
200
- - a6164ed0: Don't use React.FC<> for functional components
220
+ - a6164ed0: Don't use React.FC<> for functional components
201
221
 
202
222
  ## 5.0.4
203
223
 
204
224
  ### Patch Changes
205
225
 
206
- - c20f48f3: Don't transpile classes when building bundles
226
+ - c20f48f3: Don't transpile classes when building bundles
207
227
 
208
228
  ## 5.0.3
209
229
 
210
230
  ### Patch Changes
211
231
 
212
- - b281e2eb: Fix generate Flow types for real
232
+ - b281e2eb: Fix generate Flow types for real
213
233
 
214
234
  ## 5.0.2
215
235
 
216
236
  ### Patch Changes
217
237
 
218
- - 21ce20c7: Fix issues with generate flow types in wonder-blocks-core
238
+ - 21ce20c7: Fix issues with generate flow types in wonder-blocks-core
219
239
 
220
240
  ## 5.0.1
221
241
 
222
242
  ### Patch Changes
223
243
 
224
- - ccb6fe00: Miscellaneous TS type fixes
225
- - d4c2b18c: Fix a variety of issues with Flow types generated by flowgen
244
+ - ccb6fe00: Miscellaneous TS type fixes
245
+ - d4c2b18c: Fix a variety of issues with Flow types generated by flowgen
226
246
 
227
247
  ## 5.0.0
228
248
 
229
249
  ### Major Changes
230
250
 
231
- - 1ca4d7e3: Fix minor issue with generate Flow types (this is a major bump b/c I forgot to do one after doing the TS conversion)
251
+ - 1ca4d7e3: Fix minor issue with generate Flow types (this is a major bump b/c I forgot to do one after doing the TS conversion)
232
252
 
233
253
  ## 4.9.1
234
254
 
235
255
  ### Patch Changes
236
256
 
237
- - b5ba5568: Ensure that flow lib defs use React.ElementConfig<> isntead of JSX.LibraryManagedAttributes<>
257
+ - b5ba5568: Ensure that flow lib defs use React.ElementConfig<> isntead of JSX.LibraryManagedAttributes<>
238
258
 
239
259
  ## 4.9.0
240
260
 
241
261
  ### Minor Changes
242
262
 
243
- - 779b031d: Update AriaProps to use React's AriaAttributes and AriaRole types
263
+ - 779b031d: Update AriaProps to use React's AriaAttributes and AriaRole types
244
264
 
245
265
  ## 4.8.0
246
266
 
247
267
  ### Minor Changes
248
268
 
249
- - 873f4a14: Update aphrodite lib def and StyleType
269
+ - 873f4a14: Update aphrodite lib def and StyleType
250
270
 
251
271
  ### Patch Changes
252
272
 
253
- - d816af08: Update build and test configs use TypeScript
254
- - 3891f544: Update babel config to include plugins that Storybook needed
255
- - 0d28bb1c: Configured TypeScript
256
- - 3d05f764: Fix HOCs and other type errors
257
- - c2ec4902: Update eslint configuration, fix lint
258
- - 2983c05b: Include 'types' field in package.json
259
- - 77ff6a66: Generate Flow types from TypeScript types
260
- - ec8d4b7f: Fix miscellaneous TypeScript errors
273
+ - d816af08: Update build and test configs use TypeScript
274
+ - 3891f544: Update babel config to include plugins that Storybook needed
275
+ - 0d28bb1c: Configured TypeScript
276
+ - 3d05f764: Fix HOCs and other type errors
277
+ - c2ec4902: Update eslint configuration, fix lint
278
+ - 2983c05b: Include 'types' field in package.json
279
+ - 77ff6a66: Generate Flow types from TypeScript types
280
+ - ec8d4b7f: Fix miscellaneous TypeScript errors
261
281
 
262
282
  ## 4.7.0
263
283
 
264
284
  ### Minor Changes
265
285
 
266
- - 91cb727c: Convert enums to POJOs
286
+ - 91cb727c: Convert enums to POJOs
267
287
 
268
288
  ### Patch Changes
269
289
 
270
- - 91cb727c: Remove file extensions from imports
290
+ - 91cb727c: Remove file extensions from imports
271
291
 
272
292
  ## 4.6.2
273
293
 
274
294
  ### Patch Changes
275
295
 
276
- - 496119f2: Cleanup WB interdependencies
296
+ - 496119f2: Cleanup WB interdependencies
277
297
 
278
298
  ## 4.6.1
279
299
 
@@ -281,28 +301,28 @@
281
301
 
282
302
  ### Minor Changes
283
303
 
284
- - b561425a: Add useIsMounted() hook
285
- - a566e232: Add useOnMountEffect hook
286
- - d2b21a6e: Export useOnMountEffect hook
304
+ - b561425a: Add useIsMounted() hook
305
+ - a566e232: Add useOnMountEffect hook
306
+ - d2b21a6e: Export useOnMountEffect hook
287
307
 
288
308
  ## 4.5.0
289
309
 
290
310
  ### Minor Changes
291
311
 
292
- - 175a2dd2: Add 'useRenderState' hook
312
+ - 175a2dd2: Add 'useRenderState' hook
293
313
 
294
314
  ## 4.4.0
295
315
 
296
316
  ### Minor Changes
297
317
 
298
- - 6ee20af9: Add `useOnline` hook to encapsulate navigator.onLine and the offline/online events
318
+ - 6ee20af9: Add `useOnline` hook to encapsulate navigator.onLine and the offline/online events
299
319
 
300
320
  ## 4.3.2
301
321
 
302
322
  ### Patch Changes
303
323
 
304
- - 5f4a4297: Make dependency on `flow-enums-runtime` explicit
305
- - 2b96fd59: Change flow-enums-runtime to be peer dependencies
324
+ - 5f4a4297: Make dependency on `flow-enums-runtime` explicit
325
+ - 2b96fd59: Change flow-enums-runtime to be peer dependencies
306
326
 
307
327
  ## 4.3.1
308
328
 
@@ -310,7 +330,7 @@
310
330
 
311
331
  ### Minor Changes
312
332
 
313
- - 246a921d: NEW: `useForceUpdate` hook. This should rarely be used and likely only ever from other hooks.
333
+ - 246a921d: NEW: `useForceUpdate` hook. This should rarely be used and likely only ever from other hooks.
314
334
 
315
335
  ## 4.2.1
316
336
 
@@ -318,15 +338,15 @@
318
338
 
319
339
  ### Minor Changes
320
340
 
321
- - 0aed8723: Adds `throwIfNested` required prop to `RenderStateRoot`.
341
+ - 0aed8723: Adds `throwIfNested` required prop to `RenderStateRoot`.
322
342
 
323
343
  ## 4.1.0
324
344
 
325
345
  ### Minor Changes
326
346
 
327
- - 45588e5f: Fix an issue with `useUniqueIdWithMock`/`useUniqueIdWithoutMock`
328
- rerender more than was needed. The fix introduces `<RenderStateRoot>`
329
- which must be an ancestor to all components uses these hooks.
330
- - 875b7893: Nesting of `RenderStateRoot`s inside each other can result in extra renders
331
- and potentially incorrect behavior. `RenderStateRoot` now throws if it
332
- appears as a descendent of another `RenderStateRoot`.
347
+ - 45588e5f: Fix an issue with `useUniqueIdWithMock`/`useUniqueIdWithoutMock`
348
+ rerender more than was needed. The fix introduces `<RenderStateRoot>`
349
+ which must be an ancestor to all components uses these hooks.
350
+ - 875b7893: Nesting of `RenderStateRoot`s inside each other can result in extra renders
351
+ and potentially incorrect behavior. `RenderStateRoot` now throws if it
352
+ appears as a descendent of another `RenderStateRoot`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
@@ -13,54 +13,54 @@ import * as React from "react";
13
13
  */
14
14
  declare const Text: React.ForwardRefExoticComponent<{
15
15
  children?: React.ReactNode;
16
- style?: import("../util/types").StyleType;
17
- testId?: string | undefined;
18
- lang?: string | undefined;
19
- className?: string | undefined;
20
- htmlFor?: string | undefined;
21
- tabIndex?: number | undefined;
22
- id?: string | undefined;
23
- title?: string | undefined;
24
- "data-modal-launcher-portal"?: boolean | undefined;
25
- "data-placement"?: string | undefined;
16
+ style?: import("..").StyleType;
17
+ testId?: string;
18
+ lang?: string;
19
+ className?: string;
20
+ htmlFor?: string;
21
+ tabIndex?: number;
22
+ id?: string;
23
+ title?: string;
24
+ "data-modal-launcher-portal"?: boolean;
25
+ "data-placement"?: string;
26
26
  } & Readonly<import("..").AriaAttributes> & Readonly<{
27
- role?: import("..").AriaRole | undefined;
27
+ role?: import("..").AriaRole;
28
28
  }> & {
29
- onMouseDown?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
30
- onMouseUp?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
31
- onMouseMove?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
32
- onClick?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
33
- onDoubleClick?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
34
- onMouseEnter?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
35
- onMouseLeave?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
36
- onMouseOut?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
37
- onMouseOver?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
38
- onDrag?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
39
- onDragEnd?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
40
- onDragEnter?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
41
- onDragExit?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
42
- onDragLeave?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
43
- onDragOver?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
44
- onDragStart?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
45
- onDrop?: ((e: React.MouseEvent<Element, MouseEvent>) => unknown) | undefined;
29
+ onMouseDown?: (e: React.MouseEvent) => unknown;
30
+ onMouseUp?: (e: React.MouseEvent) => unknown;
31
+ onMouseMove?: (e: React.MouseEvent) => unknown;
32
+ onClick?: (e: React.MouseEvent) => unknown;
33
+ onDoubleClick?: (e: React.MouseEvent) => unknown;
34
+ onMouseEnter?: (e: React.MouseEvent) => unknown;
35
+ onMouseLeave?: (e: React.MouseEvent) => unknown;
36
+ onMouseOut?: (e: React.MouseEvent) => unknown;
37
+ onMouseOver?: (e: React.MouseEvent) => unknown;
38
+ onDrag?: (e: React.MouseEvent) => unknown;
39
+ onDragEnd?: (e: React.MouseEvent) => unknown;
40
+ onDragEnter?: (e: React.MouseEvent) => unknown;
41
+ onDragExit?: (e: React.MouseEvent) => unknown;
42
+ onDragLeave?: (e: React.MouseEvent) => unknown;
43
+ onDragOver?: (e: React.MouseEvent) => unknown;
44
+ onDragStart?: (e: React.MouseEvent) => unknown;
45
+ onDrop?: (e: React.MouseEvent) => unknown;
46
46
  } & {
47
- onKeyDown?: ((e: React.KeyboardEvent<Element>) => unknown) | undefined;
48
- onKeyPress?: ((e: React.KeyboardEvent<Element>) => unknown) | undefined;
49
- onKeyUp?: ((e: React.KeyboardEvent<Element>) => unknown) | undefined;
47
+ onKeyDown?: (e: React.KeyboardEvent) => unknown;
48
+ onKeyPress?: (e: React.KeyboardEvent) => unknown;
49
+ onKeyUp?: (e: React.KeyboardEvent) => unknown;
50
50
  } & {
51
- onChange?: ((e: React.ChangeEvent<HTMLInputElement>) => unknown) | undefined;
52
- onInput?: ((e: React.ChangeEvent<HTMLInputElement>) => unknown) | undefined;
53
- onInvalid?: ((e: React.ChangeEvent<HTMLInputElement>) => unknown) | undefined;
54
- onSubmit?: ((e: React.ChangeEvent<HTMLInputElement>) => unknown) | undefined;
51
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => unknown;
52
+ onInput?: (e: React.ChangeEvent<HTMLInputElement>) => unknown;
53
+ onInvalid?: (e: React.ChangeEvent<HTMLInputElement>) => unknown;
54
+ onSubmit?: (e: React.ChangeEvent<HTMLInputElement>) => unknown;
55
55
  } & {
56
- onTouchCancel?: ((e: React.TouchEvent<Element>) => unknown) | undefined;
57
- onTouchEnd?: ((e: React.TouchEvent<Element>) => unknown) | undefined;
58
- onTouchMove?: ((e: React.TouchEvent<Element>) => unknown) | undefined;
59
- onTouchStart?: ((e: React.TouchEvent<Element>) => unknown) | undefined;
56
+ onTouchCancel?: (e: React.TouchEvent) => unknown;
57
+ onTouchEnd?: (e: React.TouchEvent) => unknown;
58
+ onTouchMove?: (e: React.TouchEvent) => unknown;
59
+ onTouchStart?: (e: React.TouchEvent) => unknown;
60
60
  } & {
61
- onFocus?: ((e: React.FocusEvent<Element, Element>) => unknown) | undefined;
62
- onBlur?: ((e: React.FocusEvent<Element, Element>) => unknown) | undefined;
61
+ onFocus?: (e: React.FocusEvent) => unknown;
62
+ onBlur?: (e: React.FocusEvent) => unknown;
63
63
  } & {
64
- tag?: string | undefined;
64
+ tag?: string;
65
65
  } & React.RefAttributes<unknown>>;
66
66
  export default Text;
package/dist/es/index.js CHANGED
@@ -79,12 +79,13 @@ const Text = React.forwardRef(function Text(_ref, ref) {
79
79
  const isHeader = isHeaderRegex.test(Tag);
80
80
  const styleAttributes = processStyleList([styles$1.text, isHeader && styles$1.header, style]);
81
81
  const classNames = otherProps.className ? [otherProps.className, styleAttributes.className].join(" ") : styleAttributes.className;
82
- return React.createElement(Tag, _extends({}, otherProps, {
83
- style: styleAttributes.style,
84
- className: classNames,
85
- "data-testid": testId,
86
- ref: ref
87
- }), children);
82
+ return (React.createElement(Tag, _extends({}, otherProps, {
83
+ style: styleAttributes.style,
84
+ className: classNames,
85
+ "data-testid": testId,
86
+ ref: ref
87
+ }), children)
88
+ );
88
89
  });
89
90
 
90
91
  const _excluded$1 = ["className", "style"];
@@ -295,7 +296,7 @@ const useOnMountEffect = callback => {
295
296
  React.useEffect(() => {
296
297
  const cleanup = callback(isMountedRef);
297
298
  return () => {
298
- cleanup == null ? void 0 : cleanup();
299
+ cleanup == null || cleanup();
299
300
  isMountedRef.current = false;
300
301
  };
301
302
  }, []);
@@ -355,4 +356,13 @@ const RenderStateRoot = ({
355
356
  }, children);
356
357
  };
357
358
 
358
- export { Id, InitialFallback, RenderState, RenderStateRoot, Server, Text, View, addStyle, useForceUpdate, useIsMounted, useLatestRef, useOnMountEffect, useOnline, usePreHydrationEffect, useRenderState };
359
+ const keys = {
360
+ enter: "Enter",
361
+ escape: "Escape",
362
+ tab: "Tab",
363
+ space: " ",
364
+ up: "ArrowUp",
365
+ down: "ArrowDown"
366
+ };
367
+
368
+ export { Id, InitialFallback, RenderState, RenderStateRoot, Server, Text, View, addStyle, keys, useForceUpdate, useIsMounted, useLatestRef, useOnMountEffect, useOnline, usePreHydrationEffect, useRenderState };
package/dist/index.d.ts CHANGED
@@ -15,3 +15,4 @@ export { RenderStateRoot } from "./components/render-state-root";
15
15
  export { RenderState } from "./components/render-state-context";
16
16
  export type { AriaRole, AriaAttributes } from "./util/aria-types";
17
17
  export type { AriaProps, StyleType, PropsFor } from "./util/types";
18
+ export { keys } from "./util/keys";
package/dist/index.js CHANGED
@@ -1,16 +1,11 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var _extends = require('@babel/runtime/helpers/extends');
6
4
  var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
7
5
  var React = require('react');
8
6
  var aphrodite = require('aphrodite');
9
7
 
10
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
-
12
- function _interopNamespace(e) {
13
- if (e && e.__esModule) return e;
8
+ function _interopNamespaceDefault(e) {
14
9
  var n = Object.create(null);
15
10
  if (e) {
16
11
  Object.keys(e).forEach(function (k) {
@@ -23,13 +18,11 @@ function _interopNamespace(e) {
23
18
  }
24
19
  });
25
20
  }
26
- n["default"] = e;
21
+ n.default = e;
27
22
  return Object.freeze(n);
28
23
  }
29
24
 
30
- var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
31
- var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
32
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
25
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
33
26
 
34
27
  function flatten(list) {
35
28
  const result = [];
@@ -102,16 +95,17 @@ const Text = React__namespace.forwardRef(function Text(_ref, ref) {
102
95
  tag: Tag = "span",
103
96
  testId
104
97
  } = _ref,
105
- otherProps = _objectWithoutPropertiesLoose__default["default"](_ref, _excluded$2);
98
+ otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$2);
106
99
  const isHeader = isHeaderRegex.test(Tag);
107
100
  const styleAttributes = processStyleList([styles$1.text, isHeader && styles$1.header, style]);
108
101
  const classNames = otherProps.className ? [otherProps.className, styleAttributes.className].join(" ") : styleAttributes.className;
109
- return React__namespace.createElement(Tag, _extends__default["default"]({}, otherProps, {
110
- style: styleAttributes.style,
111
- className: classNames,
112
- "data-testid": testId,
113
- ref: ref
114
- }), children);
102
+ return (React__namespace.createElement(Tag, _extends({}, otherProps, {
103
+ style: styleAttributes.style,
104
+ className: classNames,
105
+ "data-testid": testId,
106
+ ref: ref
107
+ }), children)
108
+ );
115
109
  });
116
110
 
117
111
  const _excluded$1 = ["className", "style"];
@@ -122,13 +116,13 @@ function addStyle(Component, defaultStyle) {
122
116
  className,
123
117
  style
124
118
  } = _ref,
125
- otherProps = _objectWithoutPropertiesLoose__default["default"](_ref, _excluded$1);
119
+ otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
126
120
  const reset = typeof Component === "string" ? overrides[Component] : null;
127
121
  const {
128
122
  className: aphroditeClassName,
129
123
  style: inlineStyles
130
124
  } = processStyleList([reset, defaultStyle, style]);
131
- return React__namespace.createElement(Component, _extends__default["default"]({}, otherProps, {
125
+ return React__namespace.createElement(Component, _extends({}, otherProps, {
132
126
  ref: ref,
133
127
  className: [aphroditeClassName, className].filter(Boolean).join(" "),
134
128
  style: inlineStyles
@@ -171,29 +165,29 @@ const View = React__namespace.forwardRef(function View(props, ref) {
171
165
  testId,
172
166
  tag = "div"
173
167
  } = props,
174
- restProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
175
- const commonProps = _extends__default["default"]({}, restProps, {
168
+ restProps = _objectWithoutPropertiesLoose(props, _excluded);
169
+ const commonProps = _extends({}, restProps, {
176
170
  "data-testid": testId
177
171
  });
178
172
  switch (tag) {
179
173
  case "article":
180
- return React__namespace.createElement(StyledArticle, _extends__default["default"]({}, commonProps, {
174
+ return React__namespace.createElement(StyledArticle, _extends({}, commonProps, {
181
175
  ref: ref
182
176
  }));
183
177
  case "aside":
184
- return React__namespace.createElement(StyledAside, _extends__default["default"]({}, commonProps, {
178
+ return React__namespace.createElement(StyledAside, _extends({}, commonProps, {
185
179
  ref: ref
186
180
  }));
187
181
  case "nav":
188
- return React__namespace.createElement(StyledNav, _extends__default["default"]({}, commonProps, {
182
+ return React__namespace.createElement(StyledNav, _extends({}, commonProps, {
189
183
  ref: ref
190
184
  }));
191
185
  case "section":
192
- return React__namespace.createElement(StyledSection, _extends__default["default"]({}, commonProps, {
186
+ return React__namespace.createElement(StyledSection, _extends({}, commonProps, {
193
187
  ref: ref
194
188
  }));
195
189
  case "div":
196
- return React__namespace.createElement(StyledDiv, _extends__default["default"]({}, commonProps, {
190
+ return React__namespace.createElement(StyledDiv, _extends({}, commonProps, {
197
191
  ref: ref
198
192
  }));
199
193
  default:
@@ -322,7 +316,7 @@ const useOnMountEffect = callback => {
322
316
  React__namespace.useEffect(() => {
323
317
  const cleanup = callback(isMountedRef);
324
318
  return () => {
325
- cleanup == null ? void 0 : cleanup();
319
+ cleanup == null || cleanup();
326
320
  isMountedRef.current = false;
327
321
  };
328
322
  }, []);
@@ -382,6 +376,15 @@ const RenderStateRoot = ({
382
376
  }, children);
383
377
  };
384
378
 
379
+ const keys = {
380
+ enter: "Enter",
381
+ escape: "Escape",
382
+ tab: "Tab",
383
+ space: " ",
384
+ up: "ArrowUp",
385
+ down: "ArrowDown"
386
+ };
387
+
385
388
  exports.Id = Id;
386
389
  exports.InitialFallback = InitialFallback;
387
390
  exports.RenderState = RenderState;
@@ -390,6 +393,7 @@ exports.Server = Server;
390
393
  exports.Text = Text;
391
394
  exports.View = View;
392
395
  exports.addStyle = addStyle;
396
+ exports.keys = keys;
393
397
  exports.useForceUpdate = useForceUpdate;
394
398
  exports.useIsMounted = useIsMounted;
395
399
  exports.useLatestRef = useLatestRef;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Key value mapping reference:
3
+ * https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
4
+ */
5
+ export declare const keys: {
6
+ readonly enter: "Enter";
7
+ readonly escape: "Escape";
8
+ readonly tab: "Tab";
9
+ readonly space: " ";
10
+ readonly up: "ArrowUp";
11
+ readonly down: "ArrowDown";
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-core",
3
- "version": "11.1.0",
3
+ "version": "12.1.0",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,12 +9,8 @@
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/es/index.js",
11
11
  "types": "dist/index.d.ts",
12
- "scripts": {
13
- "test": "echo \"Error: no test specified\" && exit 1",
14
- "prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
15
- },
16
12
  "dependencies": {
17
- "@babel/runtime": "^7.18.6"
13
+ "@babel/runtime": "^7.24.5"
18
14
  },
19
15
  "peerDependencies": {
20
16
  "aphrodite": "^1.2.5",
@@ -24,9 +20,12 @@
24
20
  "react-router-dom": "5.3.4"
25
21
  },
26
22
  "devDependencies": {
27
- "@khanacademy/wb-dev-build-settings": "^2.0.0",
28
- "@khanacademy/wonder-blocks-testing-core": "^2.0.1"
23
+ "@khanacademy/wb-dev-build-settings": "2.1.0",
24
+ "@khanacademy/wonder-blocks-testing-core": "2.1.0"
29
25
  },
30
26
  "author": "",
31
- "license": "MIT"
27
+ "license": "MIT",
28
+ "scripts": {
29
+ "test": "echo \"Error: no test specified\" && exit 1"
30
+ }
32
31
  }