fis-component 0.1.18 → 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.
@@ -3,6 +3,7 @@ import FISCollapse from ".";
3
3
  declare const _default: Meta<typeof FISCollapse>;
4
4
  export default _default;
5
5
  export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
6
+ export declare const TitleOnly: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
6
7
  export declare const MultiplePanels: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
7
8
  export declare const StartIconPosition: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
8
9
  export declare const LargeSize: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import(".").CustomCollapseProps>;
package/dist/esm/index.js CHANGED
@@ -65765,7 +65765,11 @@ const DivContainerSC$5 = styled.div `
65765
65765
  display: flex;
65766
65766
  flex-direction: column;
65767
65767
  gap: ${getTheme("com/input/vertical-gap")};
65768
- width: 100%;
65768
+
65769
+ /* Keep the default full width while letting consumer utility classes win. */
65770
+ :where(&) {
65771
+ width: 100%;
65772
+ }
65769
65773
  `;
65770
65774
  const SpanCountSC = styled.span `
65771
65775
  ${getTheme("Subheading/XS")}
@@ -66681,7 +66685,11 @@ const DicContainerSC = styled.div `
66681
66685
  display: flex;
66682
66686
  flex-direction: column;
66683
66687
  gap: ${getTheme("sem/dimension/gap/xs")};
66684
- width: 100%;
66688
+
66689
+ /* Keep the default full width while letting consumer utility classes win. */
66690
+ :where(&) {
66691
+ width: 100%;
66692
+ }
66685
66693
  `;
66686
66694
  const DivResizeSC = styled.div `
66687
66695
  position: absolute;
@@ -69839,10 +69847,10 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
69839
69847
  });
69840
69848
  }
69841
69849
  };
69842
- const renderHeader = (item, isActive) => {
69850
+ const renderHeader = (item, isActive, hasContent) => {
69843
69851
  const { title, description, badge, leftIcon, customHeader } = item;
69844
69852
  const handleClick = (e) => {
69845
- if (collapsible === "disabled")
69853
+ if (!hasContent || collapsible === "disabled")
69846
69854
  return;
69847
69855
  e.stopPropagation();
69848
69856
  handleToggle(item.key);
@@ -69850,9 +69858,13 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
69850
69858
  const iconComponent = (jsx(DivIconWrapperSC, { "$collapseSize": collapseSize, className: isActive ? "open" : "", onClick: collapsible === "icon" ? handleClick : undefined, style: {
69851
69859
  cursor: collapsible === "disabled" ? "not-allowed" : "pointer",
69852
69860
  }, children: jsx(CaretIcon, {}) }));
69853
- return (jsx("div", { onClick: collapsible === "header" ? handleClick : undefined, style: {
69854
- cursor: collapsible === "disabled" ? "not-allowed" : "pointer",
69855
- }, children: customHeader ? (jsxs(DivCustomHeaderSC, { "$collapseSize": collapseSize, children: [expandIconPosition === "start" && iconComponent, jsx(DivCustomSC, { children: customHeader }), expandIconPosition === "end" && iconComponent] })) : (jsxs(DivHeaderSC, { "$collapseSize": collapseSize, children: [jsxs(DivLeftSC, { "$collapseSize": collapseSize, children: [expandIconPosition === "start" && iconComponent, jsx(DivLeftIconSC, { "$collapseSize": collapseSize, children: leftIcon ?? jsx(CategoryIcon, {}) }), jsxs(DivContentSC, { children: [jsx(PTitleSC, { "$collapseSize": collapseSize, children: title }), description && (jsx(SpanDescriptionSC, { children: description }))] })] }), badge && (jsx(FISBadge, { size: badgeSize, label: badge, color: "neutral-light", disabled: collapsible === "disabled" })), expandIconPosition === "end" && iconComponent] })) }));
69861
+ return (jsx("div", { onClick: hasContent && collapsible === "header" ? handleClick : undefined, style: {
69862
+ cursor: hasContent
69863
+ ? collapsible === "disabled"
69864
+ ? "not-allowed"
69865
+ : "pointer"
69866
+ : "default",
69867
+ }, children: customHeader ? (jsxs(DivCustomHeaderSC, { "$collapseSize": collapseSize, children: [hasContent && expandIconPosition === "start" && iconComponent, jsx(DivCustomSC, { children: customHeader }), hasContent && expandIconPosition === "end" && iconComponent] })) : (jsxs(DivHeaderSC, { "$collapseSize": collapseSize, children: [jsxs(DivLeftSC, { "$collapseSize": collapseSize, children: [hasContent && expandIconPosition === "start" && iconComponent, leftIcon && (jsx(DivLeftIconSC, { "$collapseSize": collapseSize, children: leftIcon })), jsxs(DivContentSC, { children: [jsx(PTitleSC, { "$collapseSize": collapseSize, children: title }), description && (jsx(SpanDescriptionSC, { children: description }))] })] }), badge && (jsx(FISBadge, { size: badgeSize, label: badge, color: "neutral-light", disabled: collapsible === "disabled" })), hasContent && expandIconPosition === "end" && iconComponent] })) }));
69856
69868
  };
69857
69869
  return (jsx(DivContainerSC$3, { className: className, children: jsx(StyledCollapse, { ...rest, "$collapseSize": collapseSize, ghost: true, bordered: false, activeKey: activeKeys, expandIcon: () => null, expandIconPosition: expandIconPosition, collapsible: collapsible, onChange: (keys) => {
69858
69870
  if (collapsible === "disabled")
@@ -69865,8 +69877,9 @@ const FISCollapse = ({ className, collapseSize = "sm", expandIconPosition = "sta
69865
69877
  setActiveKeys(Array.isArray(keys) ? keys : [keys]);
69866
69878
  }
69867
69879
  }, children: items.map((item) => {
69868
- const isActive = isActiveKey(item.key);
69869
- return (jsxs(Fragment$1, { children: [jsx(Collapse.Panel, { header: renderHeader(item, isActive), showArrow: false, children: jsx(DivBodySC, { "$collapseSize": collapseSize, children: item.children }) }, item.key), jsx(FISDivider, {})] }, item.key));
69880
+ const hasContent = Children.count(item.children) > 0;
69881
+ const isActive = hasContent && isActiveKey(item.key);
69882
+ return (jsxs(Fragment$1, { children: [jsx(Collapse.Panel, { header: renderHeader(item, isActive, hasContent), showArrow: false, collapsible: hasContent ? collapsible : "icon", children: jsx(DivBodySC, { "$collapseSize": collapseSize, children: item.children }) }, item.key), jsx(FISDivider, {})] }, item.key));
69870
69883
  }) }) }));
69871
69884
  };
69872
69885
 
@@ -71953,7 +71966,11 @@ const DivTagSC = styled.div `
71953
71966
  visibility: ${(props) => (props.$isVisible ? "visible" : "hidden")};
71954
71967
  `;
71955
71968
  const DivWrapperSC$3 = styled.div `
71956
- width: 100%;
71969
+ /* Keep the default full width while letting consumer utility classes win. */
71970
+ :where(&) {
71971
+ width: 100%;
71972
+ }
71973
+
71957
71974
  display: flex;
71958
71975
  flex-direction: column;
71959
71976
  gap: ${getTheme("com/input/vertical-gap")};
@@ -72907,7 +72924,11 @@ const DivContainerSC$2 = styled.div `
72907
72924
  display: flex;
72908
72925
  flex-direction: column;
72909
72926
  gap: ${getTheme("com/input/vertical-gap")};
72910
- width: 100%;
72927
+
72928
+ /* Keep the default full width while letting consumer utility classes win. */
72929
+ :where(&) {
72930
+ width: 100%;
72931
+ }
72911
72932
  `;
72912
72933
  const DivHintWrapperSC = styled.div `
72913
72934
  display: flex;
@@ -75491,7 +75512,11 @@ const FISSelectItem = forwardRef((props, ref) => {
75491
75512
  FISSelectItem.displayName = "FISSelectItem";
75492
75513
 
75493
75514
  const DivWrapperSC = styled.div `
75494
- width: 100%;
75515
+ /* Keep the default full width while letting consumer utility classes win. */
75516
+ :where(&) {
75517
+ width: 100%;
75518
+ }
75519
+
75495
75520
  display: flex;
75496
75521
  flex-direction: column;
75497
75522
  gap: ${getTheme("com/input/vertical-gap")};