@sb1/ffe-accordion-react 12.0.2 → 12.0.3
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/es/AccordionItem.js +1 -19
- package/lib/AccordionItem.js +1 -19
- package/package.json +2 -2
package/es/AccordionItem.js
CHANGED
|
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React, { useEffect, useRef, useState, useContext } from 'react';
|
|
24
|
-
import { bool, func, node, string } from 'prop-types';
|
|
25
24
|
import { v4 as uuid } from 'uuid';
|
|
26
25
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
27
26
|
import { Collapse } from '@sb1/ffe-collapse-react';
|
|
@@ -50,7 +49,6 @@ export var AccordionItem = function (_a) {
|
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
51
|
var collapseHidden = !isExpanded && !isAnimating;
|
|
53
|
-
var H = "h".concat(headingLevel);
|
|
54
52
|
return (React.createElement("div", __assign({ className: classNames(className, 'ffe-accordion-item', {
|
|
55
53
|
'ffe-accordion-item--open': isExpanded,
|
|
56
54
|
'ffe-accordion-item--focus': isFocused,
|
|
@@ -62,21 +60,5 @@ export var AccordionItem = function (_a) {
|
|
|
62
60
|
heading,
|
|
63
61
|
React.createElement("span", { className: "ffe-accordion-item__heading-icon-wrapper" },
|
|
64
62
|
React.createElement(Icon, { className: "ffe-accordion-item__heading-icon", fileUrl: expandMoreIcon, size: "sm" }))))),
|
|
65
|
-
React.createElement(Collapse, { isOpen: !!isExpanded, onRest: function () { return setIsAnimating(false); }, id: contentId.current, "aria-labelledby": buttonId.current,
|
|
66
|
-
};
|
|
67
|
-
AccordionItem.propTypes = {
|
|
68
|
-
/** The heading */
|
|
69
|
-
heading: node.isRequired,
|
|
70
|
-
/** The content to appear when expanded */
|
|
71
|
-
children: node.isRequired,
|
|
72
|
-
/** Should it be open by default */
|
|
73
|
-
defaultOpen: bool,
|
|
74
|
-
/** Is the item open or collapsed? Used for overriding default behaviour */
|
|
75
|
-
isOpen: bool,
|
|
76
|
-
/** Class assigned the container */
|
|
77
|
-
className: string,
|
|
78
|
-
/** Callback when the item is open/closed */
|
|
79
|
-
onToggleOpen: func,
|
|
80
|
-
/** aria-label for the button */
|
|
81
|
-
ariaLabel: string,
|
|
63
|
+
React.createElement(Collapse, { isOpen: !!isExpanded, onRest: function () { return setIsAnimating(false); }, id: contentId.current, "aria-labelledby": buttonId.current, role: "region" }, !collapseHidden && (React.createElement("div", { className: "ffe-accordion-item__body" }, children)))));
|
|
82
64
|
};
|
package/lib/AccordionItem.js
CHANGED
|
@@ -50,7 +50,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
exports.AccordionItem = void 0;
|
|
52
52
|
var react_1 = __importStar(require("react"));
|
|
53
|
-
var prop_types_1 = require("prop-types");
|
|
54
53
|
var uuid_1 = require("uuid");
|
|
55
54
|
var ffe_icons_react_1 = require("@sb1/ffe-icons-react");
|
|
56
55
|
var ffe_collapse_react_1 = require("@sb1/ffe-collapse-react");
|
|
@@ -79,7 +78,6 @@ var AccordionItem = function (_a) {
|
|
|
79
78
|
}
|
|
80
79
|
};
|
|
81
80
|
var collapseHidden = !isExpanded && !isAnimating;
|
|
82
|
-
var H = "h".concat(headingLevel);
|
|
83
81
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)(className, 'ffe-accordion-item', {
|
|
84
82
|
'ffe-accordion-item--open': isExpanded,
|
|
85
83
|
'ffe-accordion-item--focus': isFocused,
|
|
@@ -91,22 +89,6 @@ var AccordionItem = function (_a) {
|
|
|
91
89
|
heading,
|
|
92
90
|
react_1.default.createElement("span", { className: "ffe-accordion-item__heading-icon-wrapper" },
|
|
93
91
|
react_1.default.createElement(ffe_icons_react_1.Icon, { className: "ffe-accordion-item__heading-icon", fileUrl: expandMoreIcon, size: "sm" }))))),
|
|
94
|
-
react_1.default.createElement(ffe_collapse_react_1.Collapse, { isOpen: !!isExpanded, onRest: function () { return setIsAnimating(false); }, id: contentId.current, "aria-labelledby": buttonId.current,
|
|
92
|
+
react_1.default.createElement(ffe_collapse_react_1.Collapse, { isOpen: !!isExpanded, onRest: function () { return setIsAnimating(false); }, id: contentId.current, "aria-labelledby": buttonId.current, role: "region" }, !collapseHidden && (react_1.default.createElement("div", { className: "ffe-accordion-item__body" }, children)))));
|
|
95
93
|
};
|
|
96
94
|
exports.AccordionItem = AccordionItem;
|
|
97
|
-
exports.AccordionItem.propTypes = {
|
|
98
|
-
/** The heading */
|
|
99
|
-
heading: prop_types_1.node.isRequired,
|
|
100
|
-
/** The content to appear when expanded */
|
|
101
|
-
children: prop_types_1.node.isRequired,
|
|
102
|
-
/** Should it be open by default */
|
|
103
|
-
defaultOpen: prop_types_1.bool,
|
|
104
|
-
/** Is the item open or collapsed? Used for overriding default behaviour */
|
|
105
|
-
isOpen: prop_types_1.bool,
|
|
106
|
-
/** Class assigned the container */
|
|
107
|
-
className: prop_types_1.string,
|
|
108
|
-
/** Callback when the item is open/closed */
|
|
109
|
-
onToggleOpen: prop_types_1.func,
|
|
110
|
-
/** aria-label for the button */
|
|
111
|
-
ariaLabel: prop_types_1.string,
|
|
112
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-accordion-react",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank 1",
|
|
6
6
|
"files": [
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "e6f4b9a7a405d9fb2c09b11138a9e9ed99b1e43b"
|
|
47
47
|
}
|