@khanacademy/wonder-blocks-core 12.0.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 +89 -75
- package/LICENSE +21 -0
- package/dist/es/index.js +8 -7
- package/dist/index.js +21 -27
- package/package.json +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,126 +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
|
+
|
|
3
17
|
## 12.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
|
6
20
|
|
|
7
|
-
-
|
|
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.
|
|
8
22
|
|
|
9
23
|
## 11.1.0
|
|
10
24
|
|
|
11
25
|
### Minor Changes
|
|
12
26
|
|
|
13
|
-
-
|
|
27
|
+
- 7516b239: Update useOnMountEffect to pass isMountedRef to callback
|
|
14
28
|
|
|
15
29
|
## 11.0.1
|
|
16
30
|
|
|
17
31
|
### Patch Changes
|
|
18
32
|
|
|
19
|
-
-
|
|
33
|
+
- 11a0f5c6: No functional changes. Adding prepublishOnly script.
|
|
20
34
|
|
|
21
35
|
## 11.0.0
|
|
22
36
|
|
|
23
37
|
### Major Changes
|
|
24
38
|
|
|
25
|
-
-
|
|
39
|
+
- d23c9c5f: Delete the custom identifier generation API
|
|
26
40
|
|
|
27
41
|
## 10.0.0
|
|
28
42
|
|
|
29
43
|
### Major Changes
|
|
30
44
|
|
|
31
|
-
-
|
|
45
|
+
- b6009b77: Deprecate the ID provider and unique ID utilities
|
|
32
46
|
|
|
33
47
|
### Minor Changes
|
|
34
48
|
|
|
35
|
-
-
|
|
49
|
+
- 897686bc: - Add the `Id` component for cases where `useId` cannot be used directly
|
|
36
50
|
|
|
37
51
|
### Patch Changes
|
|
38
52
|
|
|
39
|
-
-
|
|
53
|
+
- 56d961f1: - Migrate Wonder Blocks components off old id providers and onto new `Id` component
|
|
40
54
|
|
|
41
55
|
## 9.0.0
|
|
42
56
|
|
|
43
57
|
### Major Changes
|
|
44
58
|
|
|
45
|
-
-
|
|
46
|
-
-
|
|
59
|
+
- f4abd572: - Remove `RenderState.Root` from exported enum
|
|
60
|
+
- Change `useRenderState` to only return `RenderState.Initial` or `RenderState.Standard`
|
|
47
61
|
|
|
48
62
|
## 8.0.0
|
|
49
63
|
|
|
50
64
|
### Major Changes
|
|
51
65
|
|
|
52
|
-
-
|
|
66
|
+
- e6abdd17: Upgrade to React 18
|
|
53
67
|
|
|
54
68
|
## 7.0.1
|
|
55
69
|
|
|
56
70
|
### Patch Changes
|
|
57
71
|
|
|
58
|
-
-
|
|
72
|
+
- 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
|
|
59
73
|
|
|
60
74
|
## 7.0.0
|
|
61
75
|
|
|
62
76
|
### Major Changes
|
|
63
77
|
|
|
64
|
-
-
|
|
78
|
+
- 07f7f407: Renamed `WithSSRPlaceholder` to `InitialFallback`. This includes changing the `placeholder` prop to `fallback` so it's closer to `Suspense` usage.
|
|
65
79
|
|
|
66
80
|
## 6.4.3
|
|
67
81
|
|
|
68
82
|
### Patch Changes
|
|
69
83
|
|
|
70
|
-
-
|
|
84
|
+
- 559e82d5: Update to build tooling, generating smaller output
|
|
71
85
|
|
|
72
86
|
## 6.4.2
|
|
73
87
|
|
|
74
88
|
### Patch Changes
|
|
75
89
|
|
|
76
|
-
-
|
|
90
|
+
- eab37b8b: Test file changes only. No external changes at all.
|
|
77
91
|
|
|
78
92
|
## 6.4.1
|
|
79
93
|
|
|
80
94
|
### Patch Changes
|
|
81
95
|
|
|
82
|
-
-
|
|
96
|
+
- 5dfac06e: Allow all special characters in IDs, except whitespace.
|
|
83
97
|
|
|
84
98
|
## 6.4.0
|
|
85
99
|
|
|
86
100
|
### Minor Changes
|
|
87
101
|
|
|
88
|
-
-
|
|
102
|
+
- 58075352: Change testId to render the default Testing Library HTML attribute: data-testid (was data-test-id)
|
|
89
103
|
|
|
90
104
|
## 6.3.1
|
|
91
105
|
|
|
92
106
|
### Patch Changes
|
|
93
107
|
|
|
94
|
-
-
|
|
108
|
+
- 6df21f71: Append className if set via props
|
|
95
109
|
|
|
96
110
|
## 6.3.0
|
|
97
111
|
|
|
98
112
|
### Minor Changes
|
|
99
113
|
|
|
100
|
-
-
|
|
114
|
+
- 7055ca94: Make useOnMountEffect accept functions with void return types
|
|
101
115
|
|
|
102
116
|
## 6.2.0
|
|
103
117
|
|
|
104
118
|
### Minor Changes
|
|
105
119
|
|
|
106
|
-
-
|
|
120
|
+
- 4b97b9a2: Remove deps argument from `usePreHydrationEffect`
|
|
107
121
|
|
|
108
122
|
## 6.1.1
|
|
109
123
|
|
|
110
124
|
### Patch Changes
|
|
111
125
|
|
|
112
|
-
-
|
|
126
|
+
- 2871f0a9: Add new usePreHydrationEffect hook to module exports
|
|
113
127
|
|
|
114
128
|
## 6.1.0
|
|
115
129
|
|
|
116
130
|
### Minor Changes
|
|
117
131
|
|
|
118
|
-
-
|
|
132
|
+
- efb59c29: Add `usePreHydrationEffect`
|
|
119
133
|
|
|
120
134
|
### Patch Changes
|
|
121
135
|
|
|
122
|
-
-
|
|
123
|
-
|
|
136
|
+
- 8bc40ed2: Change the return type of `useLatestRef` from `RefObject<T>` to
|
|
137
|
+
`{readonly current: T}`, so the `current` property is not nullable.
|
|
124
138
|
|
|
125
139
|
This fixes a bug introduced by the migration to TypeScript.
|
|
126
140
|
|
|
@@ -128,158 +142,158 @@
|
|
|
128
142
|
|
|
129
143
|
### Patch Changes
|
|
130
144
|
|
|
131
|
-
-
|
|
145
|
+
- f19da46e: Allow 'title' on View and typography components
|
|
132
146
|
|
|
133
147
|
## 6.0.1
|
|
134
148
|
|
|
135
149
|
### Patch Changes
|
|
136
150
|
|
|
137
|
-
-
|
|
151
|
+
- 1920feb8: `RenderStateRoot` now wraps children in a React fragment
|
|
138
152
|
|
|
139
153
|
## 6.0.0
|
|
140
154
|
|
|
141
155
|
### Major Changes
|
|
142
156
|
|
|
143
|
-
-
|
|
157
|
+
- 674a1e5c: POJOs have been replace with TS enums
|
|
144
158
|
|
|
145
159
|
### Patch Changes
|
|
146
160
|
|
|
147
|
-
-
|
|
161
|
+
- 674a1e5c: We're no longer building flow types
|
|
148
162
|
|
|
149
163
|
## 5.4.0
|
|
150
164
|
|
|
151
165
|
### Minor Changes
|
|
152
166
|
|
|
153
|
-
-
|
|
167
|
+
- 1344436f: Add `PropsFor` type to simplify `JSX.LibraryManagedAttributes` usage
|
|
154
168
|
|
|
155
169
|
## 5.3.1
|
|
156
170
|
|
|
157
171
|
### Patch Changes
|
|
158
172
|
|
|
159
|
-
-
|
|
173
|
+
- 9f3752d4: Used named functions in componenets with forwarded refs
|
|
160
174
|
|
|
161
175
|
## 5.3.0
|
|
162
176
|
|
|
163
177
|
### Minor Changes
|
|
164
178
|
|
|
165
|
-
-
|
|
166
|
-
-
|
|
179
|
+
- c37b99aa: Forward refs for Text and Title
|
|
180
|
+
- c4cef3e6: Added ref forwarding to View
|
|
167
181
|
|
|
168
182
|
## 5.2.3
|
|
169
183
|
|
|
170
184
|
### Patch Changes
|
|
171
185
|
|
|
172
|
-
-
|
|
186
|
+
- d4c412b5: Update useForceUpdate to ensure consuming hooks properly refresh
|
|
173
187
|
|
|
174
188
|
## 5.2.2
|
|
175
189
|
|
|
176
190
|
### Patch Changes
|
|
177
191
|
|
|
178
|
-
-
|
|
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
|
|
179
193
|
|
|
180
194
|
## 5.2.1
|
|
181
195
|
|
|
182
196
|
### Patch Changes
|
|
183
197
|
|
|
184
|
-
-
|
|
185
|
-
-
|
|
198
|
+
- 5a1ea891: Make sure that React contexts are named
|
|
199
|
+
- df9a10aa: Update state and props to be readonly in components using getDerivedStateFromProps()
|
|
186
200
|
|
|
187
201
|
## 5.2.0
|
|
188
202
|
|
|
189
203
|
### Minor Changes
|
|
190
204
|
|
|
191
|
-
-
|
|
205
|
+
- fa70c895: Add 'lang', 'className' and 'htmlFor' properties to Text and View
|
|
192
206
|
|
|
193
207
|
### Patch Changes
|
|
194
208
|
|
|
195
|
-
-
|
|
196
|
-
-
|
|
209
|
+
- 19ab0408: Update flowgen to convert React.ForwardRefExoticComponent<> and React.FowardedRef<> properly
|
|
210
|
+
- fa70c895: Remove all TypeScript error suppressions on JSX attributes
|
|
197
211
|
|
|
198
212
|
## 5.1.0
|
|
199
213
|
|
|
200
214
|
### Minor Changes
|
|
201
215
|
|
|
202
|
-
-
|
|
216
|
+
- 3c400719: Add useLatestRef hook to wonder-blocks-core
|
|
203
217
|
|
|
204
218
|
### Patch Changes
|
|
205
219
|
|
|
206
|
-
-
|
|
220
|
+
- a6164ed0: Don't use React.FC<> for functional components
|
|
207
221
|
|
|
208
222
|
## 5.0.4
|
|
209
223
|
|
|
210
224
|
### Patch Changes
|
|
211
225
|
|
|
212
|
-
-
|
|
226
|
+
- c20f48f3: Don't transpile classes when building bundles
|
|
213
227
|
|
|
214
228
|
## 5.0.3
|
|
215
229
|
|
|
216
230
|
### Patch Changes
|
|
217
231
|
|
|
218
|
-
-
|
|
232
|
+
- b281e2eb: Fix generate Flow types for real
|
|
219
233
|
|
|
220
234
|
## 5.0.2
|
|
221
235
|
|
|
222
236
|
### Patch Changes
|
|
223
237
|
|
|
224
|
-
-
|
|
238
|
+
- 21ce20c7: Fix issues with generate flow types in wonder-blocks-core
|
|
225
239
|
|
|
226
240
|
## 5.0.1
|
|
227
241
|
|
|
228
242
|
### Patch Changes
|
|
229
243
|
|
|
230
|
-
-
|
|
231
|
-
-
|
|
244
|
+
- ccb6fe00: Miscellaneous TS type fixes
|
|
245
|
+
- d4c2b18c: Fix a variety of issues with Flow types generated by flowgen
|
|
232
246
|
|
|
233
247
|
## 5.0.0
|
|
234
248
|
|
|
235
249
|
### Major Changes
|
|
236
250
|
|
|
237
|
-
-
|
|
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)
|
|
238
252
|
|
|
239
253
|
## 4.9.1
|
|
240
254
|
|
|
241
255
|
### Patch Changes
|
|
242
256
|
|
|
243
|
-
-
|
|
257
|
+
- b5ba5568: Ensure that flow lib defs use React.ElementConfig<> isntead of JSX.LibraryManagedAttributes<>
|
|
244
258
|
|
|
245
259
|
## 4.9.0
|
|
246
260
|
|
|
247
261
|
### Minor Changes
|
|
248
262
|
|
|
249
|
-
-
|
|
263
|
+
- 779b031d: Update AriaProps to use React's AriaAttributes and AriaRole types
|
|
250
264
|
|
|
251
265
|
## 4.8.0
|
|
252
266
|
|
|
253
267
|
### Minor Changes
|
|
254
268
|
|
|
255
|
-
-
|
|
269
|
+
- 873f4a14: Update aphrodite lib def and StyleType
|
|
256
270
|
|
|
257
271
|
### Patch Changes
|
|
258
272
|
|
|
259
|
-
-
|
|
260
|
-
-
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
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
|
|
267
281
|
|
|
268
282
|
## 4.7.0
|
|
269
283
|
|
|
270
284
|
### Minor Changes
|
|
271
285
|
|
|
272
|
-
-
|
|
286
|
+
- 91cb727c: Convert enums to POJOs
|
|
273
287
|
|
|
274
288
|
### Patch Changes
|
|
275
289
|
|
|
276
|
-
-
|
|
290
|
+
- 91cb727c: Remove file extensions from imports
|
|
277
291
|
|
|
278
292
|
## 4.6.2
|
|
279
293
|
|
|
280
294
|
### Patch Changes
|
|
281
295
|
|
|
282
|
-
-
|
|
296
|
+
- 496119f2: Cleanup WB interdependencies
|
|
283
297
|
|
|
284
298
|
## 4.6.1
|
|
285
299
|
|
|
@@ -287,28 +301,28 @@
|
|
|
287
301
|
|
|
288
302
|
### Minor Changes
|
|
289
303
|
|
|
290
|
-
-
|
|
291
|
-
-
|
|
292
|
-
-
|
|
304
|
+
- b561425a: Add useIsMounted() hook
|
|
305
|
+
- a566e232: Add useOnMountEffect hook
|
|
306
|
+
- d2b21a6e: Export useOnMountEffect hook
|
|
293
307
|
|
|
294
308
|
## 4.5.0
|
|
295
309
|
|
|
296
310
|
### Minor Changes
|
|
297
311
|
|
|
298
|
-
-
|
|
312
|
+
- 175a2dd2: Add 'useRenderState' hook
|
|
299
313
|
|
|
300
314
|
## 4.4.0
|
|
301
315
|
|
|
302
316
|
### Minor Changes
|
|
303
317
|
|
|
304
|
-
-
|
|
318
|
+
- 6ee20af9: Add `useOnline` hook to encapsulate navigator.onLine and the offline/online events
|
|
305
319
|
|
|
306
320
|
## 4.3.2
|
|
307
321
|
|
|
308
322
|
### Patch Changes
|
|
309
323
|
|
|
310
|
-
-
|
|
311
|
-
-
|
|
324
|
+
- 5f4a4297: Make dependency on `flow-enums-runtime` explicit
|
|
325
|
+
- 2b96fd59: Change flow-enums-runtime to be peer dependencies
|
|
312
326
|
|
|
313
327
|
## 4.3.1
|
|
314
328
|
|
|
@@ -316,7 +330,7 @@
|
|
|
316
330
|
|
|
317
331
|
### Minor Changes
|
|
318
332
|
|
|
319
|
-
-
|
|
333
|
+
- 246a921d: NEW: `useForceUpdate` hook. This should rarely be used and likely only ever from other hooks.
|
|
320
334
|
|
|
321
335
|
## 4.2.1
|
|
322
336
|
|
|
@@ -324,15 +338,15 @@
|
|
|
324
338
|
|
|
325
339
|
### Minor Changes
|
|
326
340
|
|
|
327
|
-
-
|
|
341
|
+
- 0aed8723: Adds `throwIfNested` required prop to `RenderStateRoot`.
|
|
328
342
|
|
|
329
343
|
## 4.1.0
|
|
330
344
|
|
|
331
345
|
### Minor Changes
|
|
332
346
|
|
|
333
|
-
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
-
|
|
337
|
-
|
|
338
|
-
|
|
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.
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
|
299
|
+
cleanup == null || cleanup();
|
|
299
300
|
isMountedRef.current = false;
|
|
300
301
|
};
|
|
301
302
|
}, []);
|
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
|
|
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
|
|
21
|
+
n.default = e;
|
|
27
22
|
return Object.freeze(n);
|
|
28
23
|
}
|
|
29
24
|
|
|
30
|
-
var
|
|
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 =
|
|
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,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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 =
|
|
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,
|
|
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 =
|
|
175
|
-
const commonProps =
|
|
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,
|
|
174
|
+
return React__namespace.createElement(StyledArticle, _extends({}, commonProps, {
|
|
181
175
|
ref: ref
|
|
182
176
|
}));
|
|
183
177
|
case "aside":
|
|
184
|
-
return React__namespace.createElement(StyledAside,
|
|
178
|
+
return React__namespace.createElement(StyledAside, _extends({}, commonProps, {
|
|
185
179
|
ref: ref
|
|
186
180
|
}));
|
|
187
181
|
case "nav":
|
|
188
|
-
return React__namespace.createElement(StyledNav,
|
|
182
|
+
return React__namespace.createElement(StyledNav, _extends({}, commonProps, {
|
|
189
183
|
ref: ref
|
|
190
184
|
}));
|
|
191
185
|
case "section":
|
|
192
|
-
return React__namespace.createElement(StyledSection,
|
|
186
|
+
return React__namespace.createElement(StyledSection, _extends({}, commonProps, {
|
|
193
187
|
ref: ref
|
|
194
188
|
}));
|
|
195
189
|
case "div":
|
|
196
|
-
return React__namespace.createElement(StyledDiv,
|
|
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
|
|
319
|
+
cleanup == null || cleanup();
|
|
326
320
|
isMountedRef.current = false;
|
|
327
321
|
};
|
|
328
322
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-core",
|
|
3
|
-
"version": "12.
|
|
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.
|
|
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": "
|
|
28
|
-
"@khanacademy/wonder-blocks-testing-core": "
|
|
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
|
}
|