@dreamcommerce/aurora 2.3.8-1 → 2.3.9
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/build/cjs/packages/aurora/src/components/accordion/index.js +8 -3
- package/build/cjs/packages/aurora/src/components/accordion/index.js.map +1 -1
- package/build/esm/packages/aurora/src/components/accordion/index.js +9 -4
- package/build/esm/packages/aurora/src/components/accordion/index.js.map +1 -1
- package/build/esm/packages/aurora/src/components/accordion/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -11,17 +11,22 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
|
|
12
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
13
|
|
|
14
|
-
const Accordion = ({ id, title, isOpened = false, secondary, negativeIndentValue, children }) => {
|
|
14
|
+
const Accordion = ({ id, title, isOpened = false, isStatic = false, secondary, negativeIndentValue, children }) => {
|
|
15
15
|
const [isOpen, setIsOpen] = React.useState(isOpened);
|
|
16
16
|
const handleOnClick = () => {
|
|
17
17
|
setIsOpen(!isOpen);
|
|
18
18
|
};
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (isStatic) {
|
|
21
|
+
setIsOpen(true);
|
|
22
|
+
}
|
|
23
|
+
}, [isStatic]);
|
|
19
24
|
const wrapperIndentStyles = { marginLeft: `-${negativeIndentValue}px`, marginRight: `-${negativeIndentValue}px` };
|
|
20
25
|
const contentIndentStyles = { paddingLeft: `${negativeIndentValue}px`, paddingRight: `${negativeIndentValue}px` };
|
|
21
26
|
return (React__default['default'].createElement("div", { className: `${main_module['default'][css_classes['default'].accordion]} ${secondary ? main_module['default'][css_classes['default'].accordionSecondary] : ''}`, style: negativeIndentValue ? wrapperIndentStyles : undefined },
|
|
22
|
-
React__default['default'].createElement("div", { className: main_module['default'][css_classes['default'].accordionHeader], onClick: handleOnClick, "aria-expanded": isOpen, "aria-controls": id, style: negativeIndentValue ? contentIndentStyles : undefined },
|
|
27
|
+
React__default['default'].createElement("div", { className: main_module['default'][css_classes['default'].accordionHeader], onClick: !isStatic ? handleOnClick : undefined, "aria-expanded": isOpen, "aria-controls": id, style: negativeIndentValue ? contentIndentStyles : undefined },
|
|
23
28
|
React__default['default'].createElement("div", { className: main_module['default'][css_classes['default'].accordionTitle] }, title),
|
|
24
|
-
React__default['default'].createElement(icon_arrow_down['default'], { size: "m", className: `${isOpen ? main_module['default'][css_classes['default'].accordionIconRotate180] : ''}` })),
|
|
29
|
+
!isStatic && React__default['default'].createElement(icon_arrow_down['default'], { size: "m", className: `${isOpen ? main_module['default'][css_classes['default'].accordionIconRotate180] : ''}` })),
|
|
25
30
|
isOpen && (React__default['default'].createElement("div", { id: id, className: main_module['default'][css_classes['default'].accordionContent], style: negativeIndentValue ? contentIndentStyles : undefined }, children))));
|
|
26
31
|
};
|
|
27
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import CSS_CLASSES from './css_classes.js';
|
|
3
3
|
import IconArrowDown from '../../assets/icon_arrow_down.js';
|
|
4
4
|
import cssClasses from '../../css/accordion/main.module.less.js';
|
|
5
5
|
|
|
6
|
-
const Accordion = ({ id, title, isOpened = false, secondary, negativeIndentValue, children }) => {
|
|
6
|
+
const Accordion = ({ id, title, isOpened = false, isStatic = false, secondary, negativeIndentValue, children }) => {
|
|
7
7
|
const [isOpen, setIsOpen] = useState(isOpened);
|
|
8
8
|
const handleOnClick = () => {
|
|
9
9
|
setIsOpen(!isOpen);
|
|
10
10
|
};
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (isStatic) {
|
|
13
|
+
setIsOpen(true);
|
|
14
|
+
}
|
|
15
|
+
}, [isStatic]);
|
|
11
16
|
const wrapperIndentStyles = { marginLeft: `-${negativeIndentValue}px`, marginRight: `-${negativeIndentValue}px` };
|
|
12
17
|
const contentIndentStyles = { paddingLeft: `${negativeIndentValue}px`, paddingRight: `${negativeIndentValue}px` };
|
|
13
18
|
return (React.createElement("div", { className: `${cssClasses[CSS_CLASSES.accordion]} ${secondary ? cssClasses[CSS_CLASSES.accordionSecondary] : ''}`, style: negativeIndentValue ? wrapperIndentStyles : undefined },
|
|
14
|
-
React.createElement("div", { className: cssClasses[CSS_CLASSES.accordionHeader], onClick: handleOnClick, "aria-expanded": isOpen, "aria-controls": id, style: negativeIndentValue ? contentIndentStyles : undefined },
|
|
19
|
+
React.createElement("div", { className: cssClasses[CSS_CLASSES.accordionHeader], onClick: !isStatic ? handleOnClick : undefined, "aria-expanded": isOpen, "aria-controls": id, style: negativeIndentValue ? contentIndentStyles : undefined },
|
|
15
20
|
React.createElement("div", { className: cssClasses[CSS_CLASSES.accordionTitle] }, title),
|
|
16
|
-
React.createElement(IconArrowDown, { size: "m", className: `${isOpen ? cssClasses[CSS_CLASSES.accordionIconRotate180] : ''}` })),
|
|
21
|
+
!isStatic && React.createElement(IconArrowDown, { size: "m", className: `${isOpen ? cssClasses[CSS_CLASSES.accordionIconRotate180] : ''}` })),
|
|
17
22
|
isOpen && (React.createElement("div", { id: id, className: cssClasses[CSS_CLASSES.accordionContent], style: negativeIndentValue ? contentIndentStyles : undefined }, children))));
|
|
18
23
|
};
|
|
19
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|