Skip to content

Commit

Permalink
Merge pull request #5005 from scavnickyj/jsc-f1-369-rich-text-2
Browse files Browse the repository at this point in the history
feat: extend bubble trigger

Reviewed-by: https://github.com/kandl
  • Loading branch information
gdgate authored Jun 4, 2024
2 parents c182b75 + 2938901 commit 6c309c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions libs/sdk-ui-kit/api/sdk-ui-kit.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,8 @@ export interface IBubbleTriggerProps {
// (undocumented)
onBubbleOpen?: () => void;
// (undocumented)
openOnInit?: boolean;
// (undocumented)
tagName?: React_2.ElementType;
}

Expand Down
6 changes: 4 additions & 2 deletions libs/sdk-ui-kit/src/Bubble/BubbleTrigger.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) 2007-2022 GoodData Corporation
// (C) 2007-2024 GoodData Corporation
import React from "react";
import cx from "classnames";
import { v4 as uuid } from "uuid";
Expand All @@ -14,6 +14,7 @@ export interface IBubbleTriggerProps {
tagName?: React.ElementType;
onBubbleOpen?: () => void;
onBubbleClose?: () => void;
openOnInit?: boolean;
}

/**
Expand All @@ -36,11 +37,12 @@ export class BubbleTrigger<P extends IBubbleTriggerProps> extends React.PureComp
children: false,
eventsOnBubble: false,
tagName: "span",
openOnInit: false,
};

public readonly state: Readonly<IBubbleTriggerState> = {
bubbleId: `bubble-${uuid()}`,
isBubbleVisible: false,
isBubbleVisible: this.props.openOnInit ?? false,
};

private onClose = (): void => {
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-ui-kit/src/RichText/RichTextWithTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const RichTextWithTooltipCore: React.FC<IRichTextWithTooltipProps> = ({
}

return (
<BubbleHoverTrigger showDelay={0} hideDelay={0}>
<BubbleHoverTrigger showDelay={0} hideDelay={0} openOnInit={true}>
{Component}
{showTooltip ? (
<Bubble alignPoints={tooltipAlignPoints} className="bubble-primary bubble-small">
Expand Down

0 comments on commit 6c309c8

Please sign in to comment.