@trafilea/afrodita-components 5.0.0-beta.177 → 5.0.0-beta.178

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/index.d.ts CHANGED
@@ -1120,14 +1120,21 @@ interface TooltipProps {
1120
1120
  children: React.ReactNode;
1121
1121
  position: ComponentPosition;
1122
1122
  align?: 'start' | 'center' | 'end';
1123
- text: string;
1123
+ content?: {
1124
+ text: string;
1125
+ color?: string;
1126
+ };
1127
+ backgroundColor?: string;
1128
+ maxWidth?: string;
1124
1129
  header?: {
1125
1130
  title: string;
1126
- Icon: IconType;
1131
+ titleColor?: string;
1132
+ Icon?: IconType;
1133
+ iconFill?: string;
1127
1134
  };
1128
1135
  onClick?: () => void;
1129
1136
  }
1130
- declare const Tooltip: ({ children, position, text, align, onClick, header, }: TooltipProps) => JSX.Element;
1137
+ declare const Tooltip: ({ children, position, content, backgroundColor, align, maxWidth, onClick, header, }: TooltipProps) => JSX.Element;
1131
1138
 
1132
1139
  interface AccordionProps {
1133
1140
  defaultOpen?: boolean;
@@ -11616,7 +11616,7 @@ var Wrapper$5 = newStyled.div(templateObject_1$11 || (templateObject_1$11 = __ma
11616
11616
  return getWrapperFlexDirection(position);
11617
11617
  });
11618
11618
  var TooltipContainer = newStyled.div(function (_a) {
11619
- var position = _a.position, childrenWidth = _a.childrenWidth, tooltipHeight = _a.tooltipHeight, align = _a.align;
11619
+ var position = _a.position, childrenWidth = _a.childrenWidth, tooltipHeight = _a.tooltipHeight, align = _a.align, maxWidth = _a.maxWidth;
11620
11620
  return ({
11621
11621
  position: 'absolute',
11622
11622
  display: 'flex',
@@ -11626,6 +11626,7 @@ var TooltipContainer = newStyled.div(function (_a) {
11626
11626
  marginRight: getTooltipMargin(position, ComponentPosition.Left, "".concat(childrenWidth, "px")),
11627
11627
  marginTop: getTooltipMargin(position, ComponentPosition.Top, "-".concat(tooltipHeight, "px")),
11628
11628
  marginBottom: getTooltipMargin(position, ComponentPosition.Bottom, "-".concat(tooltipHeight, "px")),
11629
+ maxWidth: maxWidth ? "".concat(maxWidth) : 'none',
11629
11630
  transition: 'opacity 0.2s ease',
11630
11631
  userSelect: 'none',
11631
11632
  opacity: 0,
@@ -11635,9 +11636,12 @@ var TooltipContainer = newStyled.div(function (_a) {
11635
11636
  var getTooltipMargin = function (actual, expected, margin) {
11636
11637
  return actual === expected ? margin : '0';
11637
11638
  };
11638
- var ContentWrapper = newStyled.div(templateObject_2$J || (templateObject_2$J = __makeTemplateObject(["\n border: 0.063rem solid ", ";\n padding: 0.563rem 0.75rem;\n border-radius: 0.5rem;\n background-color: #fff;\n"], ["\n border: 0.063rem solid ", ";\n padding: 0.563rem 0.75rem;\n border-radius: 0.5rem;\n background-color: #fff;\n"])), function (_a) {
11639
+ var ContentWrapper = newStyled.div(templateObject_2$J || (templateObject_2$J = __makeTemplateObject(["\n border: 0.063rem solid ", ";\n padding: 0.563rem 0.75rem;\n border-radius: 0.5rem;\n background-color: ", ";\n z-index: 999;\n"], ["\n border: 0.063rem solid ", ";\n padding: 0.563rem 0.75rem;\n border-radius: 0.5rem;\n background-color: ", ";\n z-index: 999;\n"])), function (_a) {
11639
11640
  var borderColor = _a.borderColor;
11640
11641
  return borderColor;
11642
+ }, function (_a) {
11643
+ var backgroundColor = _a.backgroundColor;
11644
+ return backgroundColor;
11641
11645
  });
11642
11646
  var TooltipArrowContainer = newStyled.div(templateObject_3$A || (templateObject_3$A = __makeTemplateObject(["\n width: 1.25rem;\n height: 0.75rem;\n display: flex;\n transform: rotate(", ");\n padding: ", ";\n margin: ", ";\n"], ["\n width: 1.25rem;\n height: 0.75rem;\n display: flex;\n transform: rotate(", ");\n padding: ", ";\n margin: ", ";\n"])), function (_a) {
11643
11647
  var position = _a.position;
@@ -11662,7 +11666,7 @@ var IconContainer$5 = newStyled.div(templateObject_7$7 || (templateObject_7$7 =
11662
11666
  var templateObject_1$11, templateObject_2$J, templateObject_3$A, templateObject_4$p, templateObject_5$f, templateObject_6$c, templateObject_7$7;
11663
11667
 
11664
11668
  var Tooltip = function (_a) {
11665
- var children = _a.children, position = _a.position, text = _a.text, _b = _a.align, align = _b === void 0 ? 'center' : _b, onClick = _a.onClick, header = _a.header;
11669
+ var children = _a.children, position = _a.position, content = _a.content, backgroundColor = _a.backgroundColor, _b = _a.align, align = _b === void 0 ? 'center' : _b, maxWidth = _a.maxWidth, onClick = _a.onClick, header = _a.header;
11666
11670
  var theme = useTheme();
11667
11671
  var _c = useState(0), childrenWidth = _c[0], setChildrenWidth = _c[1];
11668
11672
  var childrenRef = createRef();
@@ -11676,7 +11680,11 @@ var Tooltip = function (_a) {
11676
11680
  var ref = tooltipRef.current;
11677
11681
  setTooltipHeight((ref === null || ref === void 0 ? void 0 : ref.offsetHeight) || 0);
11678
11682
  }, [tooltipRef]);
11679
- return (jsxs$1(Wrapper$5, __assign$1({ position: position, "data-testid": "TooltipWrapper" }, { children: [jsx$1("div", __assign$1({ ref: childrenRef }, { children: children }), void 0), jsxs$1(TooltipContainer, __assign$1({ position: position, align: align, childrenWidth: childrenWidth, tooltipHeight: tooltipHeight, ref: tooltipRef, onClick: onClick, "data-testid": "TooltipContainer", className: "tooltip-container" }, { children: [jsxs$1(ContentWrapper, __assign$1({ borderColor: theme.colors.shades['200'].color }, { children: [header && (jsxs$1(TopSection, __assign$1({ "data-testid": "TooltipHeader" }, { children: [jsx$1(IconContainer$5, { children: React__default.createElement(header.Icon, { fill: theme.colors.pallete.secondary.color }) }, void 0), jsx$1(Title$6, __assign$1({ color: theme.colors.pallete.secondary.color }, { children: header.title }), void 0)] }), void 0)), jsx$1(TooltipText, __assign$1({ color: theme.colors.pallete.secondary.color, "data-testid": "TooltipText" }, { children: text }), void 0)] }), void 0), jsx$1(TooltipArrowContainer, __assign$1({ position: position, "data-testid": "TooltipArrow" }, { children: jsx$1(TooltipArrow, { width: 1.25, height: 0.75, fill: "#ffffff", stroke: theme.colors.shades['10'].color }, void 0) }), void 0)] }), void 0)] }), void 0));
11683
+ return (jsxs$1(Wrapper$5, __assign$1({ position: position, "data-testid": "TooltipWrapper" }, { children: [jsx$1("div", __assign$1({ ref: childrenRef }, { children: children }), void 0), jsxs$1(TooltipContainer, __assign$1({ position: position, align: align, maxWidth: maxWidth, childrenWidth: childrenWidth, tooltipHeight: tooltipHeight, ref: tooltipRef, onClick: onClick, "data-testid": "TooltipContainer", className: "tooltip-container" }, { children: [jsxs$1(ContentWrapper, __assign$1({ className: "tooltip-wrapper", borderColor: theme.colors.shades['200'].color, backgroundColor: backgroundColor ? backgroundColor : theme.colors.shades.white.color }, { children: [header && (jsxs$1(TopSection, __assign$1({ "data-testid": "TooltipHeader" }, { children: [(header === null || header === void 0 ? void 0 : header.Icon) && (jsx$1(IconContainer$5, { children: React__default.createElement(header.Icon, {
11684
+ fill: (header === null || header === void 0 ? void 0 : header.iconFill)
11685
+ ? header === null || header === void 0 ? void 0 : header.iconFill
11686
+ : theme.colors.pallete.secondary.color,
11687
+ }) }, void 0)), jsx$1(Title$6, __assign$1({ color: (header === null || header === void 0 ? void 0 : header.titleColor) ? header === null || header === void 0 ? void 0 : header.titleColor : theme.colors.pallete.secondary.color }, { children: header.title }), void 0)] }), void 0)), content && (content === null || content === void 0 ? void 0 : content.text) && (jsx$1(TooltipText, __assign$1({ color: (content === null || content === void 0 ? void 0 : content.color) ? content === null || content === void 0 ? void 0 : content.color : theme.colors.pallete.secondary.color, "data-testid": "TooltipText" }, { children: content.text }), void 0))] }), void 0), jsx$1(TooltipArrowContainer, __assign$1({ position: position, "data-testid": "TooltipArrow" }, { children: jsx$1(TooltipArrow, { width: 1.25, height: 0.75, fill: theme.colors.shades.white.color, stroke: theme.colors.shades['10'].color }, void 0) }), void 0)] }), void 0)] }), void 0));
11680
11688
  };
11681
11689
 
11682
11690
  /* base styles & variants */