@homebound/beam 2.271.0 → 2.272.0
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.
|
@@ -15,6 +15,8 @@ export interface AccordionProps {
|
|
|
15
15
|
*/
|
|
16
16
|
index?: number;
|
|
17
17
|
setExpandedIndex?: Dispatch<SetStateAction<number | undefined>>;
|
|
18
|
+
/** Used by Accordion list. Sets default padding to 0 for nested accordions */
|
|
19
|
+
omitPadding?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export declare function Accordion(props: AccordionProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
22
|
export type AccordionSize = "xs" | "sm" | "md" | "lg";
|
|
@@ -9,7 +9,7 @@ const Icon_1 = require("./Icon");
|
|
|
9
9
|
const Css_1 = require("../Css");
|
|
10
10
|
const utils_2 = require("../utils");
|
|
11
11
|
function Accordion(props) {
|
|
12
|
-
const { title, children, size, disabled = false, defaultExpanded = false, topBorder = true, bottomBorder = false, index, setExpandedIndex, } = props;
|
|
12
|
+
const { title, children, size, disabled = false, defaultExpanded = false, topBorder = true, bottomBorder = false, index, setExpandedIndex, omitPadding = false, } = props;
|
|
13
13
|
const testIds = (0, utils_2.useTestIds)(props, "accordion");
|
|
14
14
|
const id = (0, utils_1.useId)();
|
|
15
15
|
const [expanded, setExpanded] = (0, react_1.useState)(defaultExpanded && !disabled);
|
|
@@ -50,7 +50,7 @@ function Accordion(props) {
|
|
|
50
50
|
}, children: [(0, jsx_runtime_1.jsx)("span", { children: title }), (0, jsx_runtime_1.jsx)("span", { css: {
|
|
51
51
|
transition: "transform 250ms linear",
|
|
52
52
|
transform: expanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
53
|
-
}, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "chevronDown" }) })] }), (0, jsx_runtime_1.jsx)("div", { ...testIds.details, id: id, "aria-hidden": !expanded, css: Css_1.Css.overflowHidden.h(contentHeight).add("transition", "height 250ms ease-in-out").$, children: expanded && ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.px2.pb2.pt1.$, ref: contentRef, ...testIds.content, children: children })) })] }));
|
|
53
|
+
}, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { icon: "chevronDown" }) })] }), (0, jsx_runtime_1.jsx)("div", { ...testIds.details, id: id, "aria-hidden": !expanded, css: Css_1.Css.overflowHidden.h(contentHeight).add("transition", "height 250ms ease-in-out").$, children: expanded && ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.px2.pb2.pt1.if(omitPadding).p0.$, ref: contentRef, ...testIds.content, children: children })) })] }));
|
|
54
54
|
}
|
|
55
55
|
exports.Accordion = Accordion;
|
|
56
56
|
const accordionSizes = {
|
|
@@ -9,7 +9,7 @@ const Css_1 = require("../../../Css");
|
|
|
9
9
|
/** Renders our default cell element, i.e. if no row links and no custom renderCell are used. */
|
|
10
10
|
const defaultRenderFn = (as) => (key, css, content, row, rowStyle, classNames, onClick, tooltip) => {
|
|
11
11
|
const Cell = as === "table" ? "td" : "div";
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(Cell, { css: { ...css, ...(0, TableStyles_1.tableRowStyles)(as) }, className: classNames, onClick: onClick, children: content }, key));
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(Cell, { css: { ...css, ...(0, TableStyles_1.tableRowStyles)(as), ...Css_1.Css.cursor("default").$ }, className: classNames, onClick: onClick, children: content }, key));
|
|
13
13
|
};
|
|
14
14
|
exports.defaultRenderFn = defaultRenderFn;
|
|
15
15
|
/**
|