krl-alfred 1.72.16 → 1.72.17
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.
|
@@ -3,30 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AccordionContext = void 0;
|
|
7
6
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
7
|
var react_1 = require("react");
|
|
9
8
|
var Accordion_styled_1 = require("./Accordion.styled");
|
|
10
9
|
var AccordionItem_1 = __importDefault(require("./AccordionItem"));
|
|
11
10
|
var TextLink_1 = __importDefault(require("./../TextLink"));
|
|
12
|
-
exports.AccordionContext = (0, react_1.createContext)({
|
|
13
|
-
active: 0,
|
|
14
|
-
setActive: function (index) { }
|
|
15
|
-
});
|
|
16
11
|
var Accordion = function (props) {
|
|
17
12
|
var title = props.title, data = props.data, activeIndex = props.activeIndex, showLink = props.showLink, linkText = props.linkText, linkOnClick = props.linkOnClick, collapseAll = props.collapseAll, size = props.size;
|
|
18
13
|
var _a = (0, react_1.useState)(0), active = _a[0], setActive = _a[1];
|
|
19
14
|
(0, react_1.useEffect)(function () {
|
|
20
15
|
setActive(activeIndex);
|
|
21
16
|
}, [activeIndex]);
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)(Accordion_styled_1.AccordionStyled, { children: [title && (0, jsx_runtime_1.jsx)(Accordion_styled_1.AccordionTitle, { size: size, children: title }), (0, jsx_runtime_1.jsx)(Accordion_styled_1.Wrapper, { children: (0, jsx_runtime_1.jsx)(
|
|
23
|
-
active: active,
|
|
24
|
-
setActive: setActive
|
|
25
|
-
}, children: data === null || data === void 0 ? void 0 : data.map(function (item, key) { return ((0, jsx_runtime_1.jsx)(AccordionItem_1.default, { size: size, collapseAll: collapseAll, index: key, title: item.question, content: item.answer }, key)); }) }) }), showLink && ((0, jsx_runtime_1.jsx)(Accordion_styled_1.Footer, { className: "body-bold-14-17", children: (0, jsx_runtime_1.jsx)(TextLink_1.default, { onClick: linkOnClick, children: linkText }) }))] }));
|
|
26
|
-
};
|
|
27
|
-
Accordion.defaultProps = {
|
|
28
|
-
activeIndex: 0,
|
|
29
|
-
linkText: 'Daha Fazla Soru Göster',
|
|
30
|
-
showLink: false,
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(Accordion_styled_1.AccordionStyled, { children: [title && (0, jsx_runtime_1.jsx)(Accordion_styled_1.AccordionTitle, { size: size, children: title }), (0, jsx_runtime_1.jsx)(Accordion_styled_1.Wrapper, { children: data === null || data === void 0 ? void 0 : data.map(function (item, key) { return ((0, jsx_runtime_1.jsx)(AccordionItem_1.default, { active: active, setActive: setActive, size: size, collapseAll: collapseAll, index: key, title: item.question, content: item.answer }, key)); }) }), showLink && ((0, jsx_runtime_1.jsx)(Accordion_styled_1.Footer, { className: "body-bold-14-17", children: (0, jsx_runtime_1.jsx)(TextLink_1.default, { onClick: linkOnClick, children: linkText }) }))] }));
|
|
31
18
|
};
|
|
19
|
+
Accordion.defaultProps = {};
|
|
32
20
|
exports.default = Accordion;
|
|
@@ -6,18 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
var react_1 = require("react");
|
|
8
8
|
var Accordion_styled_1 = require("./Accordion.styled");
|
|
9
|
-
var Accordion_1 = require("./Accordion");
|
|
10
9
|
var Icon_1 = __importDefault(require("../Icon/Icon"));
|
|
11
10
|
var AccordionItem = function (props) {
|
|
12
|
-
var title = props.title, content = props.content, index = props.index, collapseAll = props.collapseAll, size = props.size;
|
|
13
|
-
var _a = (0, react_1.
|
|
14
|
-
var _b = (0, react_1.useState)(0), height = _b[0], setHeight = _b[1];
|
|
11
|
+
var title = props.title, content = props.content, index = props.index, collapseAll = props.collapseAll, size = props.size, active = props.active, setActive = props.setActive;
|
|
12
|
+
var _a = (0, react_1.useState)(0), height = _a[0], setHeight = _a[1];
|
|
15
13
|
var itemRef = (0, react_1.useRef)();
|
|
16
14
|
(0, react_1.useEffect)(function () {
|
|
17
15
|
var _a, _b;
|
|
18
16
|
setHeight((active === index || activeItem) ? (_b = (_a = itemRef === null || itemRef === void 0 ? void 0 : itemRef.current) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.clientHeight : 0);
|
|
19
17
|
});
|
|
20
|
-
var
|
|
18
|
+
var _b = (0, react_1.useState)(collapseAll ? true : false), activeItem = _b[0], setActiveItem = _b[1];
|
|
21
19
|
var handleCollapse = function () {
|
|
22
20
|
if (collapseAll) {
|
|
23
21
|
setActiveItem(!activeItem);
|