@khanacademy/wonder-blocks-accordion 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +19 -10
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-accordion
|
|
2
2
|
|
|
3
|
+
## 3.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ee8d95a: Rollback rollup version from v4 to v2 to prevent an issue with CJS builds in unit tests
|
|
8
|
+
- Updated dependencies [ee8d95a]
|
|
9
|
+
- @khanacademy/wonder-blocks-clickable@6.1.1
|
|
10
|
+
- @khanacademy/wonder-blocks-core@12.1.1
|
|
11
|
+
- @khanacademy/wonder-blocks-icon@5.1.1
|
|
12
|
+
- @khanacademy/wonder-blocks-tokens@4.2.1
|
|
13
|
+
- @khanacademy/wonder-blocks-typography@3.1.1
|
|
14
|
+
|
|
3
15
|
## 3.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
4
6
|
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
5
7
|
var React = require('react');
|
|
@@ -11,7 +13,10 @@ var caretDown = require('@phosphor-icons/core/bold/caret-down-bold.svg');
|
|
|
11
13
|
var Clickable = require('@khanacademy/wonder-blocks-clickable');
|
|
12
14
|
var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
13
15
|
|
|
14
|
-
function
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
function _interopNamespace(e) {
|
|
19
|
+
if (e && e.__esModule) return e;
|
|
15
20
|
var n = Object.create(null);
|
|
16
21
|
if (e) {
|
|
17
22
|
Object.keys(e).forEach(function (k) {
|
|
@@ -24,11 +29,15 @@ function _interopNamespaceDefault(e) {
|
|
|
24
29
|
}
|
|
25
30
|
});
|
|
26
31
|
}
|
|
27
|
-
n
|
|
32
|
+
n["default"] = e;
|
|
28
33
|
return Object.freeze(n);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
var
|
|
36
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
37
|
+
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
38
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
39
|
+
var caretDown__default = /*#__PURE__*/_interopDefaultLegacy(caretDown);
|
|
40
|
+
var Clickable__default = /*#__PURE__*/_interopDefaultLegacy(Clickable);
|
|
32
41
|
|
|
33
42
|
const _excluded$1 = ["children", "id", "initialExpandedIndex", "allowMultipleExpanded", "caretPosition", "cornerKind", "animated", "style"];
|
|
34
43
|
const StyledUl = wonderBlocksCore.addStyle("ul");
|
|
@@ -44,7 +53,7 @@ const Accordion = React__namespace.forwardRef(function Accordion(props, ref) {
|
|
|
44
53
|
animated,
|
|
45
54
|
style
|
|
46
55
|
} = props,
|
|
47
|
-
ariaProps =
|
|
56
|
+
ariaProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
|
|
48
57
|
const startingArray = Array(children.length).fill(false);
|
|
49
58
|
if (initialExpandedIndex !== undefined) {
|
|
50
59
|
startingArray[initialExpandedIndex] = true;
|
|
@@ -92,7 +101,7 @@ const Accordion = React__namespace.forwardRef(function Accordion(props, ref) {
|
|
|
92
101
|
break;
|
|
93
102
|
}
|
|
94
103
|
};
|
|
95
|
-
return React__namespace.createElement(StyledUl,
|
|
104
|
+
return React__namespace.createElement(StyledUl, _extends__default["default"]({
|
|
96
105
|
style: [styles$2.wrapper, style],
|
|
97
106
|
onKeyDown: handleKeyDown
|
|
98
107
|
}, ariaProps, {
|
|
@@ -179,7 +188,7 @@ const AccordionSectionHeader = React__namespace.forwardRef(function AccordionSec
|
|
|
179
188
|
return React__namespace.createElement(wonderBlocksTypography.HeadingSmall, {
|
|
180
189
|
tag: tag,
|
|
181
190
|
style: styles$1.heading
|
|
182
|
-
}, React__namespace.createElement(
|
|
191
|
+
}, React__namespace.createElement(Clickable__default["default"], {
|
|
183
192
|
id: id,
|
|
184
193
|
"aria-expanded": expanded,
|
|
185
194
|
"aria-controls": sectionContentUniqueId,
|
|
@@ -193,7 +202,7 @@ const AccordionSectionHeader = React__namespace.forwardRef(function AccordionSec
|
|
|
193
202
|
}, headerIsString ? React__namespace.createElement(wonderBlocksCore.View, {
|
|
194
203
|
style: [caretPosition === "end" ? styles$1.headerStringCaretEnd : styles$1.headerStringCaretStart]
|
|
195
204
|
}, header) : header), collapsible && React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
196
|
-
icon:
|
|
205
|
+
icon: caretDown__default["default"],
|
|
197
206
|
color: wonderBlocksTokens.semanticColor.icon.primary,
|
|
198
207
|
size: "small",
|
|
199
208
|
style: [animated && styles$1.iconWithAnimation, caretPosition === "start" ? styles$1.iconStart : styles$1.iconEnd, expanded && styles$1.iconExpanded],
|
|
@@ -297,7 +306,7 @@ const AccordionSection = React__namespace.forwardRef(function AccordionSection(p
|
|
|
297
306
|
isLastSection = true,
|
|
298
307
|
isRegion = true
|
|
299
308
|
} = props,
|
|
300
|
-
ariaProps =
|
|
309
|
+
ariaProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
|
|
301
310
|
const [internalExpanded, setInternalExpanded] = React__namespace.useState(expanded != null ? expanded : false);
|
|
302
311
|
const controlledMode = expanded !== undefined && onToggle;
|
|
303
312
|
const uniqueSectionId = React.useId();
|
|
@@ -322,7 +331,7 @@ const AccordionSection = React__namespace.forwardRef(function AccordionSection(p
|
|
|
322
331
|
} else {
|
|
323
332
|
expandedState = controlledMode ? expanded : internalExpanded;
|
|
324
333
|
}
|
|
325
|
-
return React__namespace.createElement(wonderBlocksCore.View,
|
|
334
|
+
return React__namespace.createElement(wonderBlocksCore.View, _extends__default["default"]({
|
|
326
335
|
id: sectionId,
|
|
327
336
|
style: [styles.wrapper, animated && styles.wrapperWithAnimation, sectionStyles.wrapper, expandedState ? styles.wrapperExpanded : styles.wrapperCollapsed, style],
|
|
328
337
|
testId: testId
|
|
@@ -439,7 +448,7 @@ const _generateStyles = (cornerKind, isFirstSection, isLastSection) => {
|
|
|
439
448
|
};
|
|
440
449
|
}
|
|
441
450
|
const newStyles = {
|
|
442
|
-
wrapper:
|
|
451
|
+
wrapper: _extends__default["default"]({}, wrapperStyle, firstSectionStyle, lastSectionStyle),
|
|
443
452
|
contentWrapper: contentWrapperStyle
|
|
444
453
|
};
|
|
445
454
|
cornerStyles[sectionType] = aphrodite.StyleSheet.create(newStyles);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-accordion",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Accordion components for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.24.5",
|
|
17
|
-
"@khanacademy/wonder-blocks-clickable": "6.1.
|
|
18
|
-
"@khanacademy/wonder-blocks-core": "12.1.
|
|
19
|
-
"@khanacademy/wonder-blocks-icon": "5.1.
|
|
20
|
-
"@khanacademy/wonder-blocks-tokens": "4.2.
|
|
21
|
-
"@khanacademy/wonder-blocks-typography": "3.1.
|
|
17
|
+
"@khanacademy/wonder-blocks-clickable": "6.1.1",
|
|
18
|
+
"@khanacademy/wonder-blocks-core": "12.1.1",
|
|
19
|
+
"@khanacademy/wonder-blocks-icon": "5.1.1",
|
|
20
|
+
"@khanacademy/wonder-blocks-tokens": "4.2.1",
|
|
21
|
+
"@khanacademy/wonder-blocks-typography": "3.1.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@phosphor-icons/core": "^2.0.2",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react": "18.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@khanacademy/wb-dev-build-settings": "2.1.
|
|
29
|
+
"@khanacademy/wb-dev-build-settings": "2.1.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"test": "echo \"Error: no test specified\" && exit 1"
|