fis-component 0.1.19 → 0.1.20
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/dist/cjs/index.js +12 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Collapse/Collapse.stories.d.ts +1 -0
- package/dist/esm/index.js +12 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Collapse/Collapse.stories.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -69867,10 +69867,10 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
|
|
|
69867
69867
|
});
|
|
69868
69868
|
}
|
|
69869
69869
|
};
|
|
69870
|
-
const renderHeader = (item, isActive) => {
|
|
69870
|
+
const renderHeader = (item, isActive, hasContent) => {
|
|
69871
69871
|
const { title, description, badge, leftIcon, customHeader } = item;
|
|
69872
69872
|
const handleClick = (e) => {
|
|
69873
|
-
if (collapsible === "disabled")
|
|
69873
|
+
if (!hasContent || collapsible === "disabled")
|
|
69874
69874
|
return;
|
|
69875
69875
|
e.stopPropagation();
|
|
69876
69876
|
handleToggle(item.key);
|
|
@@ -69878,9 +69878,13 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
|
|
|
69878
69878
|
const iconComponent = (jsxRuntime.jsx(DivIconWrapperSC, { "$collapseSize": collapseSize, className: isActive ? "open" : "", onClick: collapsible === "icon" ? handleClick : undefined, style: {
|
|
69879
69879
|
cursor: collapsible === "disabled" ? "not-allowed" : "pointer",
|
|
69880
69880
|
}, children: jsxRuntime.jsx(CaretIcon, {}) }));
|
|
69881
|
-
return (jsxRuntime.jsx("div", { onClick: collapsible === "header" ? handleClick : undefined, style: {
|
|
69882
|
-
cursor:
|
|
69883
|
-
|
|
69881
|
+
return (jsxRuntime.jsx("div", { onClick: hasContent && collapsible === "header" ? handleClick : undefined, style: {
|
|
69882
|
+
cursor: hasContent
|
|
69883
|
+
? collapsible === "disabled"
|
|
69884
|
+
? "not-allowed"
|
|
69885
|
+
: "pointer"
|
|
69886
|
+
: "default",
|
|
69887
|
+
}, children: customHeader ? (jsxRuntime.jsxs(DivCustomHeaderSC, { "$collapseSize": collapseSize, children: [hasContent && expandIconPosition === "start" && iconComponent, jsxRuntime.jsx(DivCustomSC, { children: customHeader }), hasContent && expandIconPosition === "end" && iconComponent] })) : (jsxRuntime.jsxs(DivHeaderSC, { "$collapseSize": collapseSize, children: [jsxRuntime.jsxs(DivLeftSC, { "$collapseSize": collapseSize, children: [hasContent && expandIconPosition === "start" && iconComponent, leftIcon && (jsxRuntime.jsx(DivLeftIconSC, { "$collapseSize": collapseSize, children: leftIcon })), jsxRuntime.jsxs(DivContentSC, { children: [jsxRuntime.jsx(PTitleSC, { "$collapseSize": collapseSize, children: title }), description && (jsxRuntime.jsx(SpanDescriptionSC, { children: description }))] })] }), badge && (jsxRuntime.jsx(FISBadge, { size: badgeSize, label: badge, color: "neutral-light", disabled: collapsible === "disabled" })), hasContent && expandIconPosition === "end" && iconComponent] })) }));
|
|
69884
69888
|
};
|
|
69885
69889
|
return (jsxRuntime.jsx(DivContainerSC$3, { className: className, children: jsxRuntime.jsx(StyledCollapse, { ...rest, "$collapseSize": collapseSize, ghost: true, bordered: false, activeKey: activeKeys, expandIcon: () => null, expandIconPosition: expandIconPosition, collapsible: collapsible, onChange: (keys) => {
|
|
69886
69890
|
if (collapsible === "disabled")
|
|
@@ -69893,8 +69897,9 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
|
|
|
69893
69897
|
setActiveKeys(Array.isArray(keys) ? keys : [keys]);
|
|
69894
69898
|
}
|
|
69895
69899
|
}, children: items.map((item) => {
|
|
69896
|
-
const
|
|
69897
|
-
|
|
69900
|
+
const hasContent = React.Children.count(item.children) > 0;
|
|
69901
|
+
const isActive = hasContent && isActiveKey(item.key);
|
|
69902
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(Collapse$1.Panel, { header: renderHeader(item, isActive, hasContent), showArrow: false, collapsible: hasContent ? collapsible : "icon", children: jsxRuntime.jsx(DivBodySC, { "$collapseSize": collapseSize, children: item.children }) }, item.key), jsxRuntime.jsx(FISDivider, {})] }, item.key));
|
|
69898
69903
|
}) }) }));
|
|
69899
69904
|
};
|
|
69900
69905
|
|