@khanacademy/wonder-blocks-accordion 3.0.5 → 3.0.7
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 +16 -0
- package/dist/es/index.js +33 -44
- package/dist/index.js +33 -45
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-accordion
|
|
2
2
|
|
|
3
|
+
## 3.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [0199324d]
|
|
8
|
+
- @khanacademy/wonder-blocks-clickable@6.0.0
|
|
9
|
+
- @khanacademy/wonder-blocks-core@12.0.0
|
|
10
|
+
- @khanacademy/wonder-blocks-icon@5.0.6
|
|
11
|
+
- @khanacademy/wonder-blocks-typography@3.0.6
|
|
12
|
+
|
|
13
|
+
## 3.0.6
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 7057fa7c: Replace `color` with `semanticColor` tokens
|
|
18
|
+
|
|
3
19
|
## 3.0.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useId } from 'react';
|
|
3
3
|
import { StyleSheet } from 'aphrodite';
|
|
4
4
|
import { addStyle, View } from '@khanacademy/wonder-blocks-core';
|
|
5
|
-
import
|
|
5
|
+
import { semanticColor, spacing } from '@khanacademy/wonder-blocks-tokens';
|
|
6
6
|
import { HeadingSmall, Body } from '@khanacademy/wonder-blocks-typography';
|
|
7
7
|
import caretDown from '@phosphor-icons/core/bold/caret-down-bold.svg';
|
|
8
8
|
import Clickable from '@khanacademy/wonder-blocks-clickable';
|
|
@@ -199,13 +199,13 @@ const AccordionSectionHeader = React.forwardRef(function AccordionSectionHeader(
|
|
|
199
199
|
style: [caretPosition === "end" ? styles$1.headerStringCaretEnd : styles$1.headerStringCaretStart]
|
|
200
200
|
}, header) : header), collapsible && React.createElement(PhosphorIcon, {
|
|
201
201
|
icon: caretDown,
|
|
202
|
-
color:
|
|
202
|
+
color: semanticColor.icon.primary,
|
|
203
203
|
size: "small",
|
|
204
204
|
style: [animated && styles$1.iconWithAnimation, caretPosition === "start" ? styles$1.iconStart : styles$1.iconEnd, expanded && styles$1.iconExpanded],
|
|
205
205
|
testId: testId ? `${testId}-caret-icon` : undefined
|
|
206
206
|
}))));
|
|
207
207
|
});
|
|
208
|
-
const INNER_BORDER_RADIUS =
|
|
208
|
+
const INNER_BORDER_RADIUS = spacing.small_12 - 1;
|
|
209
209
|
const ANIMATION_LENGTH = "300ms";
|
|
210
210
|
const styles$1 = StyleSheet.create({
|
|
211
211
|
heading: {
|
|
@@ -222,19 +222,13 @@ const styles$1 = StyleSheet.create({
|
|
|
222
222
|
position: "relative",
|
|
223
223
|
zIndex: 1,
|
|
224
224
|
":active": {
|
|
225
|
-
outline: `2px solid ${
|
|
225
|
+
outline: `2px solid ${semanticColor.action.outlined.progressive.press.border}`
|
|
226
226
|
},
|
|
227
227
|
":hover": {
|
|
228
|
-
outline: `2px solid ${
|
|
229
|
-
},
|
|
230
|
-
":focus": {
|
|
231
|
-
boxShadow: `0 0 0 2px ${tokens.color.blue}`
|
|
232
|
-
},
|
|
233
|
-
":focus:not(:focus-visible)": {
|
|
234
|
-
boxShadow: "none"
|
|
228
|
+
outline: `2px solid ${semanticColor.border.focus}`
|
|
235
229
|
},
|
|
236
230
|
":focus-visible": {
|
|
237
|
-
outline: `2px solid ${
|
|
231
|
+
outline: `2px solid ${semanticColor.border.focus}`
|
|
238
232
|
}
|
|
239
233
|
},
|
|
240
234
|
headerWrapperWithAnimation: {
|
|
@@ -256,16 +250,16 @@ const styles$1 = StyleSheet.create({
|
|
|
256
250
|
textAlign: "start"
|
|
257
251
|
},
|
|
258
252
|
headerString: {
|
|
259
|
-
paddingTop:
|
|
260
|
-
paddingBottom:
|
|
253
|
+
paddingTop: spacing.medium_16,
|
|
254
|
+
paddingBottom: spacing.medium_16
|
|
261
255
|
},
|
|
262
256
|
headerStringCaretEnd: {
|
|
263
|
-
paddingInlineEnd:
|
|
264
|
-
paddingInlineStart:
|
|
257
|
+
paddingInlineEnd: spacing.small_12,
|
|
258
|
+
paddingInlineStart: spacing.medium_16
|
|
265
259
|
},
|
|
266
260
|
headerStringCaretStart: {
|
|
267
|
-
paddingInlineEnd:
|
|
268
|
-
paddingInlineStart:
|
|
261
|
+
paddingInlineEnd: spacing.medium_16,
|
|
262
|
+
paddingInlineStart: spacing.small_12
|
|
269
263
|
},
|
|
270
264
|
iconWithAnimation: {
|
|
271
265
|
transition: `transform ${ANIMATION_LENGTH}`
|
|
@@ -274,22 +268,16 @@ const styles$1 = StyleSheet.create({
|
|
|
274
268
|
transform: "rotate(180deg)"
|
|
275
269
|
},
|
|
276
270
|
iconStart: {
|
|
277
|
-
marginInlineStart:
|
|
271
|
+
marginInlineStart: spacing.medium_16
|
|
278
272
|
},
|
|
279
273
|
iconEnd: {
|
|
280
|
-
marginInlineEnd:
|
|
274
|
+
marginInlineEnd: spacing.medium_16
|
|
281
275
|
},
|
|
282
276
|
disabled: {
|
|
283
277
|
pointerEvents: "none",
|
|
284
278
|
color: "inherit",
|
|
285
|
-
":focus": {
|
|
286
|
-
boxShadow: `0 0 0 2px ${tokens.color.offBlack32}`
|
|
287
|
-
},
|
|
288
|
-
":focus:not(:focus-visible)": {
|
|
289
|
-
boxShadow: "none"
|
|
290
|
-
},
|
|
291
279
|
":focus-visible": {
|
|
292
|
-
outline: `2px solid ${
|
|
280
|
+
outline: `2px solid ${semanticColor.action.disabled.default}`
|
|
293
281
|
}
|
|
294
282
|
}
|
|
295
283
|
});
|
|
@@ -374,7 +362,7 @@ const styles = StyleSheet.create({
|
|
|
374
362
|
display: "grid",
|
|
375
363
|
position: "static",
|
|
376
364
|
boxSizing: "border-box",
|
|
377
|
-
backgroundColor:
|
|
365
|
+
backgroundColor: semanticColor.surface.primary
|
|
378
366
|
},
|
|
379
367
|
wrapperWithAnimation: {
|
|
380
368
|
transition: "grid-template-rows 300ms"
|
|
@@ -395,7 +383,7 @@ const styles = StyleSheet.create({
|
|
|
395
383
|
visibility: "visible"
|
|
396
384
|
},
|
|
397
385
|
stringContent: {
|
|
398
|
-
padding:
|
|
386
|
+
padding: spacing.medium_16
|
|
399
387
|
}
|
|
400
388
|
});
|
|
401
389
|
const cornerStyles = {};
|
|
@@ -408,50 +396,51 @@ const _generateStyles = (cornerKind, isFirstSection, isLastSection) => {
|
|
|
408
396
|
let contentWrapperStyle = Object.freeze({});
|
|
409
397
|
let firstSectionStyle = Object.freeze({});
|
|
410
398
|
let lastSectionStyle = Object.freeze({});
|
|
399
|
+
const borderStyle = `1px solid ${semanticColor.border.primary}`;
|
|
411
400
|
if (cornerKind === "square") {
|
|
412
401
|
wrapperStyle = {
|
|
413
|
-
border:
|
|
402
|
+
border: borderStyle,
|
|
414
403
|
borderBottom: "none",
|
|
415
404
|
borderRadius: 0
|
|
416
405
|
};
|
|
417
406
|
if (isLastSection) {
|
|
418
407
|
lastSectionStyle = {
|
|
419
|
-
borderBottom:
|
|
408
|
+
borderBottom: borderStyle
|
|
420
409
|
};
|
|
421
410
|
}
|
|
422
411
|
}
|
|
423
412
|
if (cornerKind === "rounded") {
|
|
424
413
|
wrapperStyle = {
|
|
425
|
-
border:
|
|
414
|
+
border: borderStyle,
|
|
426
415
|
borderBottom: "none"
|
|
427
416
|
};
|
|
428
417
|
if (isFirstSection) {
|
|
429
418
|
firstSectionStyle = {
|
|
430
|
-
borderStartStartRadius:
|
|
431
|
-
borderStartEndRadius:
|
|
419
|
+
borderStartStartRadius: spacing.small_12,
|
|
420
|
+
borderStartEndRadius: spacing.small_12
|
|
432
421
|
};
|
|
433
422
|
}
|
|
434
423
|
if (isLastSection) {
|
|
435
424
|
lastSectionStyle = {
|
|
436
|
-
borderBottom:
|
|
437
|
-
borderEndStartRadius:
|
|
438
|
-
borderEndEndRadius:
|
|
425
|
+
borderBottom: borderStyle,
|
|
426
|
+
borderEndStartRadius: spacing.small_12,
|
|
427
|
+
borderEndEndRadius: spacing.small_12
|
|
439
428
|
};
|
|
440
429
|
contentWrapperStyle = {
|
|
441
|
-
borderEndEndRadius:
|
|
442
|
-
borderEndStartRadius:
|
|
430
|
+
borderEndEndRadius: spacing.small_12,
|
|
431
|
+
borderEndStartRadius: spacing.small_12
|
|
443
432
|
};
|
|
444
433
|
}
|
|
445
434
|
}
|
|
446
435
|
if (cornerKind === "rounded-per-section") {
|
|
447
436
|
wrapperStyle = {
|
|
448
|
-
border:
|
|
449
|
-
borderRadius:
|
|
450
|
-
marginBottom:
|
|
437
|
+
border: borderStyle,
|
|
438
|
+
borderRadius: spacing.small_12,
|
|
439
|
+
marginBottom: spacing.medium_16
|
|
451
440
|
};
|
|
452
441
|
contentWrapperStyle = {
|
|
453
|
-
borderEndEndRadius:
|
|
454
|
-
borderEndStartRadius:
|
|
442
|
+
borderEndEndRadius: spacing.small_12,
|
|
443
|
+
borderEndStartRadius: spacing.small_12
|
|
455
444
|
};
|
|
456
445
|
}
|
|
457
446
|
const newStyles = {
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var aphrodite = require('aphrodite');
|
|
7
7
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
8
|
-
var
|
|
8
|
+
var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
|
|
9
9
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
10
10
|
var caretDown = require('@phosphor-icons/core/bold/caret-down-bold.svg');
|
|
11
11
|
var Clickable = require('@khanacademy/wonder-blocks-clickable');
|
|
@@ -32,7 +32,6 @@ function _interopNamespace(e) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
35
|
-
var tokens__namespace = /*#__PURE__*/_interopNamespace(tokens);
|
|
36
35
|
var caretDown__default = /*#__PURE__*/_interopDefaultLegacy(caretDown);
|
|
37
36
|
var Clickable__default = /*#__PURE__*/_interopDefaultLegacy(Clickable);
|
|
38
37
|
|
|
@@ -227,13 +226,13 @@ const AccordionSectionHeader = React__namespace.forwardRef(function AccordionSec
|
|
|
227
226
|
style: [caretPosition === "end" ? styles$1.headerStringCaretEnd : styles$1.headerStringCaretStart]
|
|
228
227
|
}, header) : header), collapsible && React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
229
228
|
icon: caretDown__default["default"],
|
|
230
|
-
color:
|
|
229
|
+
color: wonderBlocksTokens.semanticColor.icon.primary,
|
|
231
230
|
size: "small",
|
|
232
231
|
style: [animated && styles$1.iconWithAnimation, caretPosition === "start" ? styles$1.iconStart : styles$1.iconEnd, expanded && styles$1.iconExpanded],
|
|
233
232
|
testId: testId ? `${testId}-caret-icon` : undefined
|
|
234
233
|
}))));
|
|
235
234
|
});
|
|
236
|
-
const INNER_BORDER_RADIUS =
|
|
235
|
+
const INNER_BORDER_RADIUS = wonderBlocksTokens.spacing.small_12 - 1;
|
|
237
236
|
const ANIMATION_LENGTH = "300ms";
|
|
238
237
|
const styles$1 = aphrodite.StyleSheet.create({
|
|
239
238
|
heading: {
|
|
@@ -250,19 +249,13 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
250
249
|
position: "relative",
|
|
251
250
|
zIndex: 1,
|
|
252
251
|
":active": {
|
|
253
|
-
outline: `2px solid ${
|
|
252
|
+
outline: `2px solid ${wonderBlocksTokens.semanticColor.action.outlined.progressive.press.border}`
|
|
254
253
|
},
|
|
255
254
|
":hover": {
|
|
256
|
-
outline: `2px solid ${
|
|
257
|
-
},
|
|
258
|
-
":focus": {
|
|
259
|
-
boxShadow: `0 0 0 2px ${tokens__namespace.color.blue}`
|
|
260
|
-
},
|
|
261
|
-
":focus:not(:focus-visible)": {
|
|
262
|
-
boxShadow: "none"
|
|
255
|
+
outline: `2px solid ${wonderBlocksTokens.semanticColor.border.focus}`
|
|
263
256
|
},
|
|
264
257
|
":focus-visible": {
|
|
265
|
-
outline: `2px solid ${
|
|
258
|
+
outline: `2px solid ${wonderBlocksTokens.semanticColor.border.focus}`
|
|
266
259
|
}
|
|
267
260
|
},
|
|
268
261
|
headerWrapperWithAnimation: {
|
|
@@ -284,16 +277,16 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
284
277
|
textAlign: "start"
|
|
285
278
|
},
|
|
286
279
|
headerString: {
|
|
287
|
-
paddingTop:
|
|
288
|
-
paddingBottom:
|
|
280
|
+
paddingTop: wonderBlocksTokens.spacing.medium_16,
|
|
281
|
+
paddingBottom: wonderBlocksTokens.spacing.medium_16
|
|
289
282
|
},
|
|
290
283
|
headerStringCaretEnd: {
|
|
291
|
-
paddingInlineEnd:
|
|
292
|
-
paddingInlineStart:
|
|
284
|
+
paddingInlineEnd: wonderBlocksTokens.spacing.small_12,
|
|
285
|
+
paddingInlineStart: wonderBlocksTokens.spacing.medium_16
|
|
293
286
|
},
|
|
294
287
|
headerStringCaretStart: {
|
|
295
|
-
paddingInlineEnd:
|
|
296
|
-
paddingInlineStart:
|
|
288
|
+
paddingInlineEnd: wonderBlocksTokens.spacing.medium_16,
|
|
289
|
+
paddingInlineStart: wonderBlocksTokens.spacing.small_12
|
|
297
290
|
},
|
|
298
291
|
iconWithAnimation: {
|
|
299
292
|
transition: `transform ${ANIMATION_LENGTH}`
|
|
@@ -302,22 +295,16 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
302
295
|
transform: "rotate(180deg)"
|
|
303
296
|
},
|
|
304
297
|
iconStart: {
|
|
305
|
-
marginInlineStart:
|
|
298
|
+
marginInlineStart: wonderBlocksTokens.spacing.medium_16
|
|
306
299
|
},
|
|
307
300
|
iconEnd: {
|
|
308
|
-
marginInlineEnd:
|
|
301
|
+
marginInlineEnd: wonderBlocksTokens.spacing.medium_16
|
|
309
302
|
},
|
|
310
303
|
disabled: {
|
|
311
304
|
pointerEvents: "none",
|
|
312
305
|
color: "inherit",
|
|
313
|
-
":focus": {
|
|
314
|
-
boxShadow: `0 0 0 2px ${tokens__namespace.color.offBlack32}`
|
|
315
|
-
},
|
|
316
|
-
":focus:not(:focus-visible)": {
|
|
317
|
-
boxShadow: "none"
|
|
318
|
-
},
|
|
319
306
|
":focus-visible": {
|
|
320
|
-
outline: `2px solid ${
|
|
307
|
+
outline: `2px solid ${wonderBlocksTokens.semanticColor.action.disabled.default}`
|
|
321
308
|
}
|
|
322
309
|
}
|
|
323
310
|
});
|
|
@@ -402,7 +389,7 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
402
389
|
display: "grid",
|
|
403
390
|
position: "static",
|
|
404
391
|
boxSizing: "border-box",
|
|
405
|
-
backgroundColor:
|
|
392
|
+
backgroundColor: wonderBlocksTokens.semanticColor.surface.primary
|
|
406
393
|
},
|
|
407
394
|
wrapperWithAnimation: {
|
|
408
395
|
transition: "grid-template-rows 300ms"
|
|
@@ -423,7 +410,7 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
423
410
|
visibility: "visible"
|
|
424
411
|
},
|
|
425
412
|
stringContent: {
|
|
426
|
-
padding:
|
|
413
|
+
padding: wonderBlocksTokens.spacing.medium_16
|
|
427
414
|
}
|
|
428
415
|
});
|
|
429
416
|
const cornerStyles = {};
|
|
@@ -436,50 +423,51 @@ const _generateStyles = (cornerKind, isFirstSection, isLastSection) => {
|
|
|
436
423
|
let contentWrapperStyle = Object.freeze({});
|
|
437
424
|
let firstSectionStyle = Object.freeze({});
|
|
438
425
|
let lastSectionStyle = Object.freeze({});
|
|
426
|
+
const borderStyle = `1px solid ${wonderBlocksTokens.semanticColor.border.primary}`;
|
|
439
427
|
if (cornerKind === "square") {
|
|
440
428
|
wrapperStyle = {
|
|
441
|
-
border:
|
|
429
|
+
border: borderStyle,
|
|
442
430
|
borderBottom: "none",
|
|
443
431
|
borderRadius: 0
|
|
444
432
|
};
|
|
445
433
|
if (isLastSection) {
|
|
446
434
|
lastSectionStyle = {
|
|
447
|
-
borderBottom:
|
|
435
|
+
borderBottom: borderStyle
|
|
448
436
|
};
|
|
449
437
|
}
|
|
450
438
|
}
|
|
451
439
|
if (cornerKind === "rounded") {
|
|
452
440
|
wrapperStyle = {
|
|
453
|
-
border:
|
|
441
|
+
border: borderStyle,
|
|
454
442
|
borderBottom: "none"
|
|
455
443
|
};
|
|
456
444
|
if (isFirstSection) {
|
|
457
445
|
firstSectionStyle = {
|
|
458
|
-
borderStartStartRadius:
|
|
459
|
-
borderStartEndRadius:
|
|
446
|
+
borderStartStartRadius: wonderBlocksTokens.spacing.small_12,
|
|
447
|
+
borderStartEndRadius: wonderBlocksTokens.spacing.small_12
|
|
460
448
|
};
|
|
461
449
|
}
|
|
462
450
|
if (isLastSection) {
|
|
463
451
|
lastSectionStyle = {
|
|
464
|
-
borderBottom:
|
|
465
|
-
borderEndStartRadius:
|
|
466
|
-
borderEndEndRadius:
|
|
452
|
+
borderBottom: borderStyle,
|
|
453
|
+
borderEndStartRadius: wonderBlocksTokens.spacing.small_12,
|
|
454
|
+
borderEndEndRadius: wonderBlocksTokens.spacing.small_12
|
|
467
455
|
};
|
|
468
456
|
contentWrapperStyle = {
|
|
469
|
-
borderEndEndRadius:
|
|
470
|
-
borderEndStartRadius:
|
|
457
|
+
borderEndEndRadius: wonderBlocksTokens.spacing.small_12,
|
|
458
|
+
borderEndStartRadius: wonderBlocksTokens.spacing.small_12
|
|
471
459
|
};
|
|
472
460
|
}
|
|
473
461
|
}
|
|
474
462
|
if (cornerKind === "rounded-per-section") {
|
|
475
463
|
wrapperStyle = {
|
|
476
|
-
border:
|
|
477
|
-
borderRadius:
|
|
478
|
-
marginBottom:
|
|
464
|
+
border: borderStyle,
|
|
465
|
+
borderRadius: wonderBlocksTokens.spacing.small_12,
|
|
466
|
+
marginBottom: wonderBlocksTokens.spacing.medium_16
|
|
479
467
|
};
|
|
480
468
|
contentWrapperStyle = {
|
|
481
|
-
borderEndEndRadius:
|
|
482
|
-
borderEndStartRadius:
|
|
469
|
+
borderEndEndRadius: wonderBlocksTokens.spacing.small_12,
|
|
470
|
+
borderEndStartRadius: wonderBlocksTokens.spacing.small_12
|
|
483
471
|
};
|
|
484
472
|
}
|
|
485
473
|
const newStyles = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-accordion",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Accordion components for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@khanacademy/wonder-blocks-clickable": "^
|
|
21
|
-
"@khanacademy/wonder-blocks-core": "^
|
|
22
|
-
"@khanacademy/wonder-blocks-icon": "^5.0.
|
|
20
|
+
"@khanacademy/wonder-blocks-clickable": "^6.0.0",
|
|
21
|
+
"@khanacademy/wonder-blocks-core": "^12.0.0",
|
|
22
|
+
"@khanacademy/wonder-blocks-icon": "^5.0.6",
|
|
23
23
|
"@khanacademy/wonder-blocks-tokens": "^4.1.0",
|
|
24
|
-
"@khanacademy/wonder-blocks-typography": "^3.0.
|
|
24
|
+
"@khanacademy/wonder-blocks-typography": "^3.0.6"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@phosphor-icons/core": "^2.0.2",
|