@chayns-components/core 5.0.0-beta.1106 → 5.0.0-beta.1109

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.
@@ -18,6 +18,7 @@ const Tooltip = ({
18
18
  container,
19
19
  isDisabled,
20
20
  shouldHideOnChildrenLeave,
21
+ maxWidth,
21
22
  yOffset,
22
23
  itemWidth,
23
24
  shouldUseFullWidth = false,
@@ -30,12 +31,13 @@ const Tooltip = ({
30
31
  }
31
32
  return /*#__PURE__*/_react.default.createElement(_TooltipItem.default, {
32
33
  width: itemWidth,
34
+ maxWidth: maxWidth,
33
35
  text: item.text,
34
36
  headline: item.headline,
35
37
  imageUrl: item.imageUrl,
36
38
  button: item.button
37
39
  });
38
- }, [item, itemWidth]);
40
+ }, [item, itemWidth, maxWidth]);
39
41
  return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_Tooltip.StyledTooltip, {
40
42
  className: "beta-chayns-tooltip"
41
43
  }, isDisabled ? /*#__PURE__*/_react.default.createElement(_Tooltip.StyledTooltipChildren, {
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","names":["_react","_interopRequireWildcard","require","_tooltip","_Popup","_interopRequireDefault","_TooltipItem","_Tooltip","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Tooltip","alignment","item","children","container","isDisabled","shouldHideOnChildrenLeave","yOffset","itemWidth","shouldUseFullWidth","shouldUseChildrenWidth","tooltipRef","useRef","content","useMemo","isValidElement","createElement","width","text","headline","imageUrl","button","StyledTooltip","className","StyledTooltipChildren","$isOnlyText","isTextOnlyElement","$shouldUseChildrenWidth","$shouldUseFullWidth","shouldShowOnHover","ref","displayName","_default","exports"],"sources":["../../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import React, { FC, isValidElement, ReactNode, useMemo, useRef, type CSSProperties } from 'react';\nimport type { PopupAlignment, PopupRef } from '../../types/popup';\nimport type { ITooltipItem } from '../../types/tooltip';\nimport { isTextOnlyElement } from '../../utils/tooltip';\nimport Popup from '../popup/Popup';\nimport TooltipItem from './tooltip-item/TooltipItem';\nimport { StyledTooltip, StyledTooltipChildren } from './Tooltip.styles';\n\nexport type TooltipProps = {\n /**\n * The alignment of the tooltip. By default, the tooltip will calculate the best alignment.\n */\n alignment?: PopupAlignment;\n /**\n * The elements that the tooltip should surround.\n */\n children: ReactNode;\n /**\n * The element where the content of the `Tooltip` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The content that should be displayed.\n */\n item: ITooltipItem | ReactNode;\n /**\n * The width of an item.\n */\n itemWidth?: CSSProperties['width'];\n /**\n * whether the tooltip should be shown.\n */\n isDisabled?: boolean;\n /**\n * Whether the tooltip should be hidden after the children is not hovered.\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Whether the width of the children should be used.\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Whether the tooltip children should use the full width.\n */\n shouldUseFullWidth?: boolean;\n /**\n * The Y offset of the tooltip to the children.\n */\n yOffset?: number;\n};\n\nconst Tooltip: FC<TooltipProps> = ({\n alignment,\n item,\n children,\n container,\n isDisabled,\n shouldHideOnChildrenLeave,\n yOffset,\n itemWidth,\n shouldUseFullWidth = false,\n shouldUseChildrenWidth = !shouldUseFullWidth,\n}) => {\n const tooltipRef = useRef<PopupRef>(null);\n\n const content = useMemo(() => {\n if (isValidElement(item)) {\n return item;\n }\n\n return (\n <TooltipItem\n width={itemWidth}\n text={(item as ITooltipItem).text}\n headline={(item as ITooltipItem).headline}\n imageUrl={(item as ITooltipItem).imageUrl}\n button={(item as ITooltipItem).button}\n />\n );\n }, [item, itemWidth]);\n\n return useMemo(\n () => (\n <StyledTooltip className=\"beta-chayns-tooltip\">\n {isDisabled ? (\n <StyledTooltipChildren\n $isOnlyText={isTextOnlyElement(children)}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledTooltipChildren>\n ) : (\n <Popup\n alignment={alignment}\n shouldShowOnHover\n shouldHideOnChildrenLeave={shouldHideOnChildrenLeave}\n content={content}\n ref={tooltipRef}\n container={container}\n yOffset={yOffset}\n shouldUseChildrenWidth={shouldUseChildrenWidth}\n shouldUseFullWidth={shouldUseFullWidth}\n >\n <StyledTooltipChildren\n $isOnlyText={isTextOnlyElement(children)}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledTooltipChildren>\n </Popup>\n )}\n </StyledTooltip>\n ),\n [\n isDisabled,\n children,\n shouldUseChildrenWidth,\n shouldUseFullWidth,\n alignment,\n shouldHideOnChildrenLeave,\n content,\n container,\n yOffset,\n ],\n );\n};\n\nTooltip.displayName = 'Tooltip';\n\nexport default Tooltip;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,YAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAAwE,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAA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AAO","ignoreList":[]}
1
+ {"version":3,"file":"Tooltip.js","names":["_react","_interopRequireWildcard","require","_tooltip","_Popup","_interopRequireDefault","_TooltipItem","_Tooltip","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Tooltip","alignment","item","children","container","isDisabled","shouldHideOnChildrenLeave","maxWidth","yOffset","itemWidth","shouldUseFullWidth","shouldUseChildrenWidth","tooltipRef","useRef","content","useMemo","isValidElement","createElement","width","text","headline","imageUrl","button","StyledTooltip","className","StyledTooltipChildren","$isOnlyText","isTextOnlyElement","$shouldUseChildrenWidth","$shouldUseFullWidth","shouldShowOnHover","ref","displayName","_default","exports"],"sources":["../../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import React, { FC, isValidElement, ReactNode, useMemo, useRef, type CSSProperties } from 'react';\nimport type { PopupAlignment, PopupRef } from '../../types/popup';\nimport type { ITooltipItem } from '../../types/tooltip';\nimport { isTextOnlyElement } from '../../utils/tooltip';\nimport Popup from '../popup/Popup';\nimport TooltipItem from './tooltip-item/TooltipItem';\nimport { StyledTooltip, StyledTooltipChildren } from './Tooltip.styles';\n\nexport type TooltipProps = {\n /**\n * The alignment of the tooltip. By default, the tooltip will calculate the best alignment.\n */\n alignment?: PopupAlignment;\n /**\n * The elements that the tooltip should surround.\n */\n children: ReactNode;\n /**\n * The element where the content of the `Tooltip` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The content that should be displayed.\n */\n item: ITooltipItem | ReactNode;\n /**\n * The width of an item.\n */\n itemWidth?: CSSProperties['width'];\n /**\n * whether the tooltip should be shown.\n */\n isDisabled?: boolean;\n /**\n * The max width of the Tooltip.\n */\n maxWidth?: number;\n /**\n * Whether the tooltip should be hidden after the children is not hovered.\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Whether the width of the children should be used.\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Whether the tooltip children should use the full width.\n */\n shouldUseFullWidth?: boolean;\n /**\n * The Y offset of the tooltip to the children.\n */\n yOffset?: number;\n};\n\nconst Tooltip: FC<TooltipProps> = ({\n alignment,\n item,\n children,\n container,\n isDisabled,\n shouldHideOnChildrenLeave,\n maxWidth,\n yOffset,\n itemWidth,\n shouldUseFullWidth = false,\n shouldUseChildrenWidth = !shouldUseFullWidth,\n}) => {\n const tooltipRef = useRef<PopupRef>(null);\n\n const content = useMemo(() => {\n if (isValidElement(item)) {\n return item;\n }\n\n return (\n <TooltipItem\n width={itemWidth}\n maxWidth={maxWidth}\n text={(item as ITooltipItem).text}\n headline={(item as ITooltipItem).headline}\n imageUrl={(item as ITooltipItem).imageUrl}\n button={(item as ITooltipItem).button}\n />\n );\n }, [item, itemWidth, maxWidth]);\n\n return useMemo(\n () => (\n <StyledTooltip className=\"beta-chayns-tooltip\">\n {isDisabled ? (\n <StyledTooltipChildren\n $isOnlyText={isTextOnlyElement(children)}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledTooltipChildren>\n ) : (\n <Popup\n alignment={alignment}\n shouldShowOnHover\n shouldHideOnChildrenLeave={shouldHideOnChildrenLeave}\n content={content}\n ref={tooltipRef}\n container={container}\n yOffset={yOffset}\n shouldUseChildrenWidth={shouldUseChildrenWidth}\n shouldUseFullWidth={shouldUseFullWidth}\n >\n <StyledTooltipChildren\n $isOnlyText={isTextOnlyElement(children)}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledTooltipChildren>\n </Popup>\n )}\n </StyledTooltip>\n ),\n [\n isDisabled,\n children,\n shouldUseChildrenWidth,\n shouldUseFullWidth,\n alignment,\n shouldHideOnChildrenLeave,\n content,\n container,\n yOffset,\n ],\n );\n};\n\nTooltip.displayName = 'Tooltip';\n\nexport default Tooltip;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,O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SAAU;IACrB6B,iBAAiB;IACjBxB,yBAAyB,EAAEA,yBAA0B;IACrDQ,OAAO,EAAEA,OAAQ;IACjBiB,GAAG,EAAEnB,UAAW;IAChBR,SAAS,EAAEA,SAAU;IACrBI,OAAO,EAAEA,OAAQ;IACjBG,sBAAsB,EAAEA,sBAAuB;IAC/CD,kBAAkB,EAAEA;EAAmB,gBAEvCrC,MAAA,CAAAU,OAAA,CAAAkC,aAAA,CAACrC,QAAA,CAAA6C,qBAAqB;IAClBC,WAAW,EAAE,IAAAC,0BAAiB,EAACxB,QAAQ,CAAE;IACzCyB,uBAAuB,EAAEjB,sBAAuB;IAChDkB,mBAAmB,EAAEnB;EAAmB,GAEvCP,QACkB,CACpB,CAEA,CAClB,EACD,CACIE,UAAU,EACVF,QAAQ,EACRQ,sBAAsB,EACtBD,kBAAkB,EAClBT,SAAS,EACTK,yBAAyB,EACzBQ,OAAO,EACPV,SAAS,EACTI,OAAO,CAEf,CAAC;AACL,CAAC;AAEDR,OAAO,CAACgC,WAAW,GAAG,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAEjBiB,OAAO","ignoreList":[]}
@@ -14,14 +14,16 @@ const TooltipItem = ({
14
14
  text,
15
15
  button,
16
16
  imageUrl,
17
- width
17
+ width,
18
+ maxWidth
18
19
  }) => (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_TooltipItem.StyledTooltipItem, {
19
- $width: width
20
+ $width: width,
21
+ $maxWidth: maxWidth
20
22
  }, headline && /*#__PURE__*/_react.default.createElement(_TooltipItem.StyledTooltipItemHeadline, null, headline), imageUrl && /*#__PURE__*/_react.default.createElement(_TooltipItem.StyledTooltipItemImage, {
21
23
  src: imageUrl
22
24
  }), /*#__PURE__*/_react.default.createElement(_TooltipItem.StyledTooltipItemText, null, text), button && /*#__PURE__*/_react.default.createElement(_TooltipItem.StyledTooltipItemButtonWrapper, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
23
25
  onClick: button.onClick
24
- }, button.text))), [button, headline, imageUrl, text, width]);
26
+ }, button.text))), [button, headline, imageUrl, text, width, maxWidth]);
25
27
  TooltipItem.displayName = 'TooltipItem';
26
28
  var _default = exports.default = TooltipItem;
27
29
  //# sourceMappingURL=TooltipItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipItem.js","names":["_react","_interopRequireWildcard","require","_Button","_interopRequireDefault","_TooltipItem","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TooltipItem","headline","text","button","imageUrl","width","useMemo","createElement","StyledTooltipItem","$width","StyledTooltipItemHeadline","StyledTooltipItemImage","src","StyledTooltipItemText","StyledTooltipItemButtonWrapper","onClick","displayName","_default","exports"],"sources":["../../../../../src/components/tooltip/tooltip-item/TooltipItem.tsx"],"sourcesContent":["import React, { FC, useMemo, type CSSProperties } from 'react';\nimport Button from '../../button/Button';\nimport {\n StyledTooltipItem,\n StyledTooltipItemButtonWrapper,\n StyledTooltipItemHeadline,\n StyledTooltipItemImage,\n StyledTooltipItemText,\n} from './TooltipItem.styles';\n\nexport type TooltipProps = {\n headline?: string;\n text: string;\n imageUrl?: string;\n button?: { text: string; onClick: () => void };\n width?: CSSProperties['width'];\n};\n\nconst TooltipItem: FC<TooltipProps> = ({ headline, text, button, imageUrl, width }) =>\n useMemo(\n () => (\n <StyledTooltipItem $width={width}>\n {headline && <StyledTooltipItemHeadline>{headline}</StyledTooltipItemHeadline>}\n {imageUrl && <StyledTooltipItemImage src={imageUrl} />}\n <StyledTooltipItemText>{text}</StyledTooltipItemText>\n {button && (\n <StyledTooltipItemButtonWrapper>\n <Button onClick={button.onClick}>{button.text}</Button>\n </StyledTooltipItemButtonWrapper>\n )}\n </StyledTooltipItem>\n ),\n [button, headline, imageUrl, text, width],\n );\n\nTooltipItem.displayName = 'TooltipItem';\n\nexport default TooltipItem;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC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;EAAEC,QAAQ;EAAEC;AAAM,CAAC,KAC9E,IAAAC,cAAO,EACH,mBACI/B,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC3B,YAAA,CAAA4B,iBAAiB;EAACC,MAAM,EAAEJ;AAAM,GAC5BJ,QAAQ,iBAAI1B,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC3B,YAAA,CAAA8B,yBAAyB,QAAET,QAAoC,CAAC,EAC7EG,QAAQ,iBAAI7B,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC3B,YAAA,CAAA+B,sBAAsB;EAACC,GAAG,EAAER;AAAS,CAAE,CAAC,eACtD7B,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC3B,YAAA,CAAAiC,qBAAqB,QAAEX,IAA4B,CAAC,EACpDC,MAAM,iBACH5B,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC3B,YAAA,CAAAkC,8BAA8B,qBAC3BvC,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC7B,OAAA,CAAAK,OAAM;EAACgC,OAAO,EAAEZ,MAAM,CAACY;AAAQ,GAAEZ,MAAM,CAACD,IAAa,CAC1B,CAErB,CACtB,EACD,CAACC,MAAM,EAAEF,QAAQ,EAAEG,QAAQ,EAAEF,IAAI,EAAEG,KAAK,CAC5C,CAAC;AAELL,WAAW,CAACgB,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnC,OAAA,GAEzBiB,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"TooltipItem.js","names":["_react","_interopRequireWildcard","require","_Button","_interopRequireDefault","_TooltipItem","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TooltipItem","headline","text","button","imageUrl","width","maxWidth","useMemo","createElement","StyledTooltipItem","$width","$maxWidth","StyledTooltipItemHeadline","StyledTooltipItemImage","src","StyledTooltipItemText","StyledTooltipItemButtonWrapper","onClick","displayName","_default","exports"],"sources":["../../../../../src/components/tooltip/tooltip-item/TooltipItem.tsx"],"sourcesContent":["import React, { FC, useMemo, type CSSProperties } from 'react';\nimport Button from '../../button/Button';\nimport {\n StyledTooltipItem,\n StyledTooltipItemButtonWrapper,\n StyledTooltipItemHeadline,\n StyledTooltipItemImage,\n StyledTooltipItemText,\n} from './TooltipItem.styles';\n\nexport type TooltipProps = {\n headline?: string;\n text: string;\n imageUrl?: string;\n button?: { text: string; onClick: () => void };\n width?: CSSProperties['width'];\n maxWidth?: number;\n};\n\nconst TooltipItem: FC<TooltipProps> = ({ headline, text, button, imageUrl, width, maxWidth }) =>\n useMemo(\n () => (\n <StyledTooltipItem $width={width} $maxWidth={maxWidth}>\n {headline && <StyledTooltipItemHeadline>{headline}</StyledTooltipItemHeadline>}\n {imageUrl && <StyledTooltipItemImage src={imageUrl} />}\n <StyledTooltipItemText>{text}</StyledTooltipItemText>\n {button && (\n <StyledTooltipItemButtonWrapper>\n <Button onClick={button.onClick}>{button.text}</Button>\n </StyledTooltipItemButtonWrapper>\n )}\n </StyledTooltipItem>\n ),\n [button, headline, imageUrl, text, width, maxWidth],\n );\n\nTooltipItem.displayName = 'TooltipItem';\n\nexport default TooltipItem;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAM8B,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAK,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,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V;AAAS,CAAE,CAAC,eACtD7B,MAAA,CAAAQ,OAAA,CAAAyB,aAAA,CAAC5B,YAAA,CAAAmC,qBAAqB,QAAEb,IAA4B,CAAC,EACpDC,MAAM,iBACH5B,MAAA,CAAAQ,OAAA,CAAAyB,aAAA,CAAC5B,YAAA,CAAAoC,8BAA8B,qBAC3BzC,MAAA,CAAAQ,OAAA,CAAAyB,aAAA,CAAC9B,OAAA,CAAAK,OAAM;EAACkC,OAAO,EAAEd,MAAM,CAACc;AAAQ,GAAEd,MAAM,CAACD,IAAa,CAC1B,CAErB,CACtB,EACD,CAACC,MAAM,EAAEF,QAAQ,EAAEG,QAAQ,EAAEF,IAAI,EAAEG,KAAK,EAAEC,QAAQ,CACtD,CAAC;AAELN,WAAW,CAACkB,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArC,OAAA,GAEzBiB,WAAW","ignoreList":[]}
@@ -13,6 +13,12 @@ const StyledTooltipItem = exports.StyledTooltipItem = _styledComponents.default.
13
13
  $width
14
14
  }) => $width ? `${$width}px` : '100%'};
15
15
 
16
+ ${({
17
+ $maxWidth
18
+ }) => $maxWidth && (0, _styledComponents.css)`
19
+ max-width: ${$maxWidth}px;
20
+ `}
21
+
16
22
  ${({
17
23
  $width
18
24
  }) => $width && (0, _styledComponents.css)`
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipItem.styles.js","names":["_styledComponents","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledTooltipItem","exports","styled","div","$width","css","StyledTooltipItemHeadline","h5","theme","headline","StyledTooltipItemImage","img","StyledTooltipItemButtonWrapper","StyledTooltipItemText","p","text"],"sources":["../../../../../src/components/tooltip/tooltip-item/TooltipItem.styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledTooltipItemProps = WithTheme<{ $width?: CSSProperties['width'] }>;\n\nexport const StyledTooltipItem = styled.div<StyledTooltipItemProps>`\n padding: 5px;\n\n width: ${({ $width }) => ($width ? `${$width}px` : '100%')};\n\n ${({ $width }) =>\n $width &&\n css`\n width: ${$width};\n `}\n`;\n\ntype StyledTooltipItemHeadlineProps = WithTheme<unknown>;\n\nexport const StyledTooltipItemHeadline = styled.h5<StyledTooltipItemHeadlineProps>`\n color: ${({ theme }: StyledTooltipItemHeadlineProps) => theme.headline};\n margin: 0;\n`;\n\nexport const StyledTooltipItemImage = styled.img``;\n\nexport const StyledTooltipItemButtonWrapper = styled.div`\n display: flex;\n justify-content: center;\n`;\n\ntype StyledTooltipItemTextProps = WithTheme<unknown>;\n\nexport const StyledTooltipItemText = styled.p<StyledTooltipItemTextProps>`\n color: ${({ theme }: StyledTooltipItemTextProps) => theme.text};\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAKzC,MAAMkB,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAGE,yBAAM,CAACC,GAA2B;AACnE;AACA;AACA,aAAa,CAAC;EAAEC;AAAO,CAAC,KAAMA,MAAM,GAAG,GAAGA,MAAM,IAAI,GAAG,MAAO;AAC9D;AACA,MAAM,CAAC;EAAEA;AAAO,CAAC,KACTA,MAAM,IACN,IAAAC,qBAAG;AACX,qBAAqBD,MAAM;AAC3B,SAAS;AACT,CAAC;AAIM,MAAME,yBAAyB,GAAAL,OAAA,CAAAK,yBAAA,GAAGJ,yBAAM,CAACK,EAAkC;AAClF,aAAa,CAAC;EAAEC;AAAsC,CAAC,KAAKA,KAAK,CAACC,QAAQ;AAC1E;AACA,CAAC;AAEM,MAAMC,sBAAsB,GAAAT,OAAA,CAAAS,sBAAA,GAAGR,yBAAM,CAACS,GAAG,EAAE;AAE3C,MAAMC,8BAA8B,GAAAX,OAAA,CAAAW,8BAAA,GAAGV,yBAAM,CAACC,GAAG;AACxD;AACA;AACA,CAAC;AAIM,MAAMU,qBAAqB,GAAAZ,OAAA,CAAAY,qBAAA,GAAGX,yBAAM,CAACY,CAA6B;AACzE,aAAa,CAAC;EAAEN;AAAkC,CAAC,KAAKA,KAAK,CAACO,IAAI;AAClE,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"TooltipItem.styles.js","names":["_styledComponents","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledTooltipItem","exports","styled","div","$width","$maxWidth","css","StyledTooltipItemHeadline","h5","theme","headline","StyledTooltipItemImage","img","StyledTooltipItemButtonWrapper","StyledTooltipItemText","p","text"],"sources":["../../../../../src/components/tooltip/tooltip-item/TooltipItem.styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledTooltipItemProps = WithTheme<{ $width?: CSSProperties['width']; $maxWidth?: number }>;\n\nexport const StyledTooltipItem = styled.div<StyledTooltipItemProps>`\n padding: 5px;\n\n width: ${({ $width }) => ($width ? `${$width}px` : '100%')};\n\n ${({ $maxWidth }) =>\n $maxWidth &&\n css`\n max-width: ${$maxWidth}px;\n `}\n\n ${({ $width }) =>\n $width &&\n css`\n width: ${$width};\n `}\n`;\n\ntype StyledTooltipItemHeadlineProps = WithTheme<unknown>;\n\nexport const StyledTooltipItemHeadline = styled.h5<StyledTooltipItemHeadlineProps>`\n color: ${({ theme }: StyledTooltipItemHeadlineProps) => theme.headline};\n margin: 0;\n`;\n\nexport const StyledTooltipItemImage = styled.img``;\n\nexport const StyledTooltipItemButtonWrapper = styled.div`\n display: flex;\n justify-content: center;\n`;\n\ntype StyledTooltipItemTextProps = WithTheme<unknown>;\n\nexport const StyledTooltipItemText = styled.p<StyledTooltipItemTextProps>`\n color: ${({ theme }: StyledTooltipItemTextProps) => theme.text};\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAA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aAAa,CAAC;EAAEC;AAAsC,CAAC,KAAKA,KAAK,CAACC,QAAQ;AAC1E;AACA,CAAC;AAEM,MAAMC,sBAAsB,GAAAV,OAAA,CAAAU,sBAAA,GAAGT,yBAAM,CAACU,GAAG,EAAE;AAE3C,MAAMC,8BAA8B,GAAAZ,OAAA,CAAAY,8BAAA,GAAGX,yBAAM,CAACC,GAAG;AACxD;AACA;AACA,CAAC;AAIM,MAAMW,qBAAqB,GAAAb,OAAA,CAAAa,qBAAA,GAAGZ,yBAAM,CAACa,CAA6B;AACzE,aAAa,CAAC;EAAEN;AAAkC,CAAC,KAAKA,KAAK,CAACO,IAAI;AAClE,CAAC","ignoreList":[]}
@@ -11,6 +11,7 @@ const Tooltip = _ref => {
11
11
  container,
12
12
  isDisabled,
13
13
  shouldHideOnChildrenLeave,
14
+ maxWidth,
14
15
  yOffset,
15
16
  itemWidth,
16
17
  shouldUseFullWidth = false,
@@ -23,12 +24,13 @@ const Tooltip = _ref => {
23
24
  }
24
25
  return /*#__PURE__*/React.createElement(TooltipItem, {
25
26
  width: itemWidth,
27
+ maxWidth: maxWidth,
26
28
  text: item.text,
27
29
  headline: item.headline,
28
30
  imageUrl: item.imageUrl,
29
31
  button: item.button
30
32
  });
31
- }, [item, itemWidth]);
33
+ }, [item, itemWidth, maxWidth]);
32
34
  return useMemo(() => /*#__PURE__*/React.createElement(StyledTooltip, {
33
35
  className: "beta-chayns-tooltip"
34
36
  }, isDisabled ? /*#__PURE__*/React.createElement(StyledTooltipChildren, {
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","names":["React","isValidElement","useMemo","useRef","isTextOnlyElement","Popup","TooltipItem","StyledTooltip","StyledTooltipChildren","Tooltip","_ref","alignment","item","children","container","isDisabled","shouldHideOnChildrenLeave","yOffset","itemWidth","shouldUseFullWidth","shouldUseChildrenWidth","tooltipRef","content","createElement","width","text","headline","imageUrl","button","className","$isOnlyText","$shouldUseChildrenWidth","$shouldUseFullWidth","shouldShowOnHover","ref","displayName"],"sources":["../../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import React, { FC, isValidElement, ReactNode, useMemo, useRef, type CSSProperties } from 'react';\nimport type { PopupAlignment, PopupRef } from '../../types/popup';\nimport type { ITooltipItem } from '../../types/tooltip';\nimport { isTextOnlyElement } from '../../utils/tooltip';\nimport Popup from '../popup/Popup';\nimport TooltipItem from './tooltip-item/TooltipItem';\nimport { StyledTooltip, StyledTooltipChildren } from './Tooltip.styles';\n\nexport type TooltipProps = {\n /**\n * The alignment of the tooltip. By default, the tooltip will calculate the best alignment.\n */\n alignment?: PopupAlignment;\n /**\n * The elements that the tooltip should surround.\n */\n children: ReactNode;\n /**\n * The element where the content of the `Tooltip` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The content that should be displayed.\n */\n item: ITooltipItem | ReactNode;\n /**\n * The width of an item.\n */\n itemWidth?: CSSProperties['width'];\n /**\n * whether the tooltip should be shown.\n */\n isDisabled?: boolean;\n /**\n * Whether the tooltip should be hidden after the children is not hovered.\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Whether the width of the children should be used.\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Whether the tooltip children should use the full width.\n */\n shouldUseFullWidth?: boolean;\n /**\n * The Y offset of the tooltip to the children.\n */\n yOffset?: number;\n};\n\nconst Tooltip: FC<TooltipProps> = ({\n alignment,\n item,\n children,\n container,\n isDisabled,\n shouldHideOnChildrenLeave,\n yOffset,\n itemWidth,\n shouldUseFullWidth = false,\n shouldUseChildrenWidth = !shouldUseFullWidth,\n}) => {\n const tooltipRef = useRef<PopupRef>(null);\n\n const content = useMemo(() => {\n if (isValidElement(item)) {\n return item;\n }\n\n return (\n <TooltipItem\n width={itemWidth}\n text={(item as ITooltipItem).text}\n headline={(item as ITooltipItem).headline}\n imageUrl={(item as ITooltipItem).imageUrl}\n button={(item as ITooltipItem).button}\n />\n );\n }, [item, itemWidth]);\n\n return useMemo(\n () => (\n <StyledTooltip className=\"beta-chayns-tooltip\">\n {isDisabled ? (\n <StyledTooltipChildren\n $isOnlyText={isTextOnlyElement(children)}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledTooltipChildren>\n ) : (\n <Popup\n alignment={alignment}\n shouldShowOnHover\n shouldHideOnChildrenLeave={shouldHideOnChildrenLeave}\n content={content}\n ref={tooltipRef}\n container={container}\n yOffset={yOffset}\n shouldUseChildrenWidth={shouldUseChildrenWidth}\n shouldUseFullWidth={shouldUseFullWidth}\n >\n <StyledTooltipChildren\n $isOnlyText={isTextOnlyElement(children)}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledTooltipChildren>\n </Popup>\n )}\n </StyledTooltip>\n ),\n [\n isDisabled,\n children,\n shouldUseChildrenWidth,\n shouldUseFullWidth,\n alignment,\n shouldHideOnChildrenLeave,\n content,\n container,\n yOffset,\n ],\n );\n};\n\nTooltip.displayName = 'Tooltip';\n\nexport default Tooltip;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,cAAc,EAAaC,OAAO,EAAEC,MAAM,QAA4B,OAAO;AAGjG,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,OAAOC,KAAK,MAAM,gBAAgB;AAClC,OAAOC,WAAW,MAAM,4BAA4B;AACpD,SAASC,aAAa,EAAEC,qBAAqB,QAAQ,kBAAkB;AA6CvE,MAAMC,OAAyB,GAAGC,IAAA,IAW5B;EAAA,IAX6B;IAC/BC,SAAS;IACTC,IAAI;IACJC,QAAQ;IACRC,SAAS;IACTC,UAAU;IACVC,yBAAyB;IACzBC,OAAO;IACPC,SAAS;IACTC,kBAAkB,GAAG,KAAK;IAC1BC,sBAAsB,GAAG,CAACD;EAC9B,CAAC,GAAAT,IAAA;EACG,MAAMW,UAAU,GAAGlB,MAAM,CAAW,IAAI,CAAC;EAEzC,MAAMmB,OAAO,GAAGpB,OAAO,CAAC,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AyB,EACzBM,OAAO,EACPR,SAAS,EACTG,OAAO,CAEf,CAAC;AACL,CAAC;AAEDR,OAAO,CAAC0B,WAAW,GAAG,SAAS;AAE/B,eAAe1B,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"Tooltip.js","names":["React","isValidElement","useMemo","useRef","isTextOnlyElement","Popup","TooltipItem","StyledTooltip","StyledTooltipChildren","Tooltip","_ref","alignment","item","children","container","isDisabled","shouldHideOnChildrenLeave","maxWidth","yOffset","itemWidth","shouldUseFullWidth","shouldUseChildrenWidth","tooltipRef","content","createElement","width","text","headline","imageUrl","button","className","$isOnlyText","$shouldUseChildrenWidth","$shouldUseFullWidth","shouldShowOnHover","ref","displayName"],"sources":["../../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import React, { FC, isValidElement, ReactNode, useMemo, useRef, type CSSProperties } from 'react';\nimport type { PopupAlignment, PopupRef } from '../../types/popup';\nimport type { ITooltipItem } from '../../types/tooltip';\nimport { isTextOnlyElement } from '../../utils/tooltip';\nimport Popup from '../popup/Popup';\nimport TooltipItem from './tooltip-item/TooltipItem';\nimport { StyledTooltip, StyledTooltipChildren } from './Tooltip.styles';\n\nexport type TooltipProps = {\n /**\n * The alignment of the tooltip. By default, the tooltip will calculate the best alignment.\n */\n alignment?: PopupAlignment;\n /**\n * The elements that the tooltip should surround.\n */\n children: ReactNode;\n /**\n * The element where the content of the `Tooltip` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The content that should be displayed.\n */\n item: ITooltipItem | ReactNode;\n /**\n * The width of an item.\n */\n itemWidth?: CSSProperties['width'];\n /**\n * whether the tooltip should be shown.\n */\n isDisabled?: boolean;\n /**\n * The max width of the Tooltip.\n */\n maxWidth?: number;\n /**\n * Whether the tooltip should be hidden after the children is not hovered.\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Whether the width of the children should be used.\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Whether the tooltip children should use the full width.\n */\n shouldUseFullWidth?: boolean;\n /**\n * The Y offset of the tooltip to the children.\n */\n yOffset?: number;\n};\n\nconst Tooltip: FC<TooltipProps> = ({\n alignment,\n item,\n children,\n container,\n isDisabled,\n shouldHideOnChildrenLeave,\n maxWidth,\n yOffset,\n itemWidth,\n shouldUseFullWidth = false,\n shouldUseChildrenWidth = !shouldUseFullWidth,\n}) => {\n const tooltipRef = useRef<PopupRef>(null);\n\n const content = useMemo(() => {\n if (isValidElement(item)) {\n return item;\n }\n\n return (\n <TooltipItem\n width={itemWidth}\n maxWidth={maxWidth}\n text={(item as ITooltipItem).text}\n headline={(item as ITooltipItem).headline}\n imageUrl={(item as ITooltipItem).imageUrl}\n button={(item as ITooltipItem).button}\n />\n );\n }, [item, itemWidth, maxWidth]);\n\n return useMemo(\n () => (\n <StyledTooltip className=\"beta-chayns-tooltip\">\n {isDisabled ? (\n <StyledTooltipChildren\n $isOnlyText={isTextOnlyElement(children)}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledTooltipChildren>\n ) : (\n <Popup\n alignment={alignment}\n shouldShowOnHover\n shouldHideOnChildrenLeave={shouldHideOnChildrenLeave}\n content={content}\n ref={tooltipRef}\n container={container}\n yOffset={yOffset}\n shouldUseChildrenWidth={shouldUseChildrenWidth}\n shouldUseFullWidth={shouldUseFullWidth}\n >\n <StyledTooltipChildren\n $isOnlyText={isTextOnlyElement(children)}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledTooltipChildren>\n </Popup>\n )}\n </StyledTooltip>\n ),\n [\n isDisabled,\n children,\n shouldUseChildrenWidth,\n shouldUseFullWidth,\n alignment,\n shouldHideOnChildrenLeave,\n content,\n container,\n yOffset,\n ],\n );\n};\n\nTooltip.displayName = 'Tooltip';\n\nexport default Tooltip;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,cAAc,EAAaC,OAAO,EAAEC,MAAM,QAA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ExBb,KAAA,CAAAwB,aAAA,CAACnB,KAAK;IACFM,SAAS,EAAEA,SAAU;IACrBuB,iBAAiB;IACjBlB,yBAAyB,EAAEA,yBAA0B;IACrDO,OAAO,EAAEA,OAAQ;IACjBY,GAAG,EAAEb,UAAW;IAChBR,SAAS,EAAEA,SAAU;IACrBI,OAAO,EAAEA,OAAQ;IACjBG,sBAAsB,EAAEA,sBAAuB;IAC/CD,kBAAkB,EAAEA;EAAmB,gBAEvCpB,KAAA,CAAAwB,aAAA,CAAChB,qBAAqB;IAClBuB,WAAW,EAAE3B,iBAAiB,CAACS,QAAQ,CAAE;IACzCmB,uBAAuB,EAAEX,sBAAuB;IAChDY,mBAAmB,EAAEb;EAAmB,GAEvCP,QACkB,CACpB,CAEA,CAClB,EACD,CACIE,UAAU,EACVF,QAAQ,EACRQ,sBAAsB,EACtBD,kBAAkB,EAClBT,SAAS,EACTK,yBAAyB,EACzBO,OAAO,EACPT,SAAS,EACTI,OAAO,CAEf,CAAC;AACL,CAAC;AAEDT,OAAO,CAAC2B,WAAW,GAAG,SAAS;AAE/B,eAAe3B,OAAO","ignoreList":[]}
@@ -7,15 +7,17 @@ const TooltipItem = _ref => {
7
7
  text,
8
8
  button,
9
9
  imageUrl,
10
- width
10
+ width,
11
+ maxWidth
11
12
  } = _ref;
12
13
  return useMemo(() => /*#__PURE__*/React.createElement(StyledTooltipItem, {
13
- $width: width
14
+ $width: width,
15
+ $maxWidth: maxWidth
14
16
  }, headline && /*#__PURE__*/React.createElement(StyledTooltipItemHeadline, null, headline), imageUrl && /*#__PURE__*/React.createElement(StyledTooltipItemImage, {
15
17
  src: imageUrl
16
18
  }), /*#__PURE__*/React.createElement(StyledTooltipItemText, null, text), button && /*#__PURE__*/React.createElement(StyledTooltipItemButtonWrapper, null, /*#__PURE__*/React.createElement(Button, {
17
19
  onClick: button.onClick
18
- }, button.text))), [button, headline, imageUrl, text, width]);
20
+ }, button.text))), [button, headline, imageUrl, text, width, maxWidth]);
19
21
  };
20
22
  TooltipItem.displayName = 'TooltipItem';
21
23
  export default TooltipItem;
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipItem.js","names":["React","useMemo","Button","StyledTooltipItem","StyledTooltipItemButtonWrapper","StyledTooltipItemHeadline","StyledTooltipItemImage","StyledTooltipItemText","TooltipItem","_ref","headline","text","button","imageUrl","width","createElement","$width","src","onClick","displayName"],"sources":["../../../../../src/components/tooltip/tooltip-item/TooltipItem.tsx"],"sourcesContent":["import React, { FC, useMemo, type CSSProperties } from 'react';\nimport Button from '../../button/Button';\nimport {\n StyledTooltipItem,\n StyledTooltipItemButtonWrapper,\n StyledTooltipItemHeadline,\n StyledTooltipItemImage,\n StyledTooltipItemText,\n} from './TooltipItem.styles';\n\nexport type TooltipProps = {\n headline?: string;\n text: string;\n imageUrl?: string;\n button?: { text: string; onClick: () => void };\n width?: CSSProperties['width'];\n};\n\nconst TooltipItem: FC<TooltipProps> = ({ headline, text, button, imageUrl, width }) =>\n useMemo(\n () => (\n <StyledTooltipItem $width={width}>\n {headline && <StyledTooltipItemHeadline>{headline}</StyledTooltipItemHeadline>}\n {imageUrl && <StyledTooltipItemImage src={imageUrl} />}\n <StyledTooltipItemText>{text}</StyledTooltipItemText>\n {button && (\n <StyledTooltipItemButtonWrapper>\n <Button onClick={button.onClick}>{button.text}</Button>\n </StyledTooltipItemButtonWrapper>\n )}\n </StyledTooltipItem>\n ),\n [button, headline, imageUrl, text, width],\n );\n\nTooltipItem.displayName = 'TooltipItem';\n\nexport default TooltipItem;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,OAAO,QAA4B,OAAO;AAC9D,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SACIC,iBAAiB,EACjBC,8BAA8B,EAC9BC,yBAAyB,EACzBC,sBAAsB,EACtBC,qBAAqB,QAClB,sBAAsB;AAU7B,MAAMC,WAA6B,GAAGC,IAAA;EAAA,IAAC;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,MAAM;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAAL,IAAA;EAAA,OAC9ER,OAAO,CACH,mBACID,KAAA,CAAAe,aAAA,CAACZ,iBAAiB;IAACa,MAAM,EAAEF;EAAM,GAC5BJ,QAAQ,iBAAIV,KAAA,CAAAe,aAAA,CAACV,yBAAyB,QAAEK,QAAoC,CAAC,EAC7EG,QAAQ,iBAAIb,KAAA,CAAAe,aAAA,CAACT,sBAAsB;IAACW,GAAG,EAAEJ;EAAS,CAAE,CAAC,eACtDb,KAAA,CAAAe,aAAA,CAACR,qBAAqB,QAAEI,IAA4B,CAAC,EACpDC,MAAM,iBACHZ,KAAA,CAAAe,aAAA,CAACX,8BAA8B,qBAC3BJ,KAAA,CAAAe,aAAA,CAACb,MAAM;IAACgB,OAAO,EAAEN,MAAM,CAACM;EAAQ,GAAEN,MAAM,CAACD,IAAa,CAC1B,CAErB,CACtB,EACD,CAACC,MAAM,EAAEF,QAAQ,EAAEG,QAAQ,EAAEF,IAAI,EAAEG,KAAK,CAC5C,CAAC;AAAA;AAELN,WAAW,CAACW,WAAW,GAAG,aAAa;AAEvC,eAAeX,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"TooltipItem.js","names":["React","useMemo","Button","StyledTooltipItem","StyledTooltipItemButtonWrapper","StyledTooltipItemHeadline","StyledTooltipItemImage","StyledTooltipItemText","TooltipItem","_ref","headline","text","button","imageUrl","width","maxWidth","createElement","$width","$maxWidth","src","onClick","displayName"],"sources":["../../../../../src/components/tooltip/tooltip-item/TooltipItem.tsx"],"sourcesContent":["import React, { FC, useMemo, type CSSProperties } from 'react';\nimport Button from '../../button/Button';\nimport {\n StyledTooltipItem,\n StyledTooltipItemButtonWrapper,\n StyledTooltipItemHeadline,\n StyledTooltipItemImage,\n StyledTooltipItemText,\n} from './TooltipItem.styles';\n\nexport type TooltipProps = {\n headline?: string;\n text: string;\n imageUrl?: string;\n button?: { text: string; onClick: () => void };\n width?: CSSProperties['width'];\n maxWidth?: number;\n};\n\nconst TooltipItem: FC<TooltipProps> = ({ headline, text, button, imageUrl, width, maxWidth }) =>\n useMemo(\n () => (\n <StyledTooltipItem $width={width} $maxWidth={maxWidth}>\n {headline && <StyledTooltipItemHeadline>{headline}</StyledTooltipItemHeadline>}\n {imageUrl && <StyledTooltipItemImage src={imageUrl} />}\n <StyledTooltipItemText>{text}</StyledTooltipItemText>\n {button && (\n <StyledTooltipItemButtonWrapper>\n <Button onClick={button.onClick}>{button.text}</Button>\n </StyledTooltipItemButtonWrapper>\n )}\n </StyledTooltipItem>\n ),\n [button, headline, imageUrl, text, width, maxWidth],\n );\n\nTooltipItem.displayName = 'TooltipItem';\n\nexport default TooltipItem;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,OAAO,QAA4B,OAAO;AAC9D,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SACIC,iBAAiB,EACjBC,8BAA8B,EAC9BC,yBAAyB,EACzBC,sBAAsB,EACtBC,qBAAqB,QAClB,sBAAsB;AAW7B,MAAMC,WAA6B,GAAGC,IAAA;EAAA,IAAC;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAAN,IAAA;EAAA,OACxFR,OAAO,CACH,mBACID,KAAA,CAAAgB,aAAA,CAACb,iBAAiB;IAACc,MAAM,EAAEH,KAAM;IAACI,SAAS,EAAEH;EAAS,GACjDL,QAAQ,iBAAIV,KAAA,CAAAgB,aAAA,CAACX,yBAAyB,QAAEK,QAAoC,CAAC,EAC7EG,QAAQ,iBAAIb,KAAA,CAAAgB,aAAA,CAACV,sBAAsB;IAACa,GAAG,EAAEN;EAAS,CAAE,CAAC,eACtDb,KAAA,CAAAgB,aAAA,CAACT,qBAAqB,QAAEI,IAA4B,CAAC,EACpDC,MAAM,iBACHZ,KAAA,CAAAgB,aAAA,CAACZ,8BAA8B,qBAC3BJ,KAAA,CAAAgB,aAAA,CAACd,MAAM;IAACkB,OAAO,EAAER,MAAM,CAACQ;EAAQ,GAAER,MAAM,CAACD,IAAa,CAC1B,CAErB,CACtB,EACD,CAACC,MAAM,EAAEF,QAAQ,EAAEG,QAAQ,EAAEF,IAAI,EAAEG,KAAK,EAAEC,QAAQ,CACtD,CAAC;AAAA;AAELP,WAAW,CAACa,WAAW,GAAG,aAAa;AAEvC,eAAeb,WAAW","ignoreList":[]}
@@ -11,18 +11,27 @@ export const StyledTooltipItem = styled.div`
11
11
 
12
12
  ${_ref2 => {
13
13
  let {
14
- $width
14
+ $maxWidth
15
15
  } = _ref2;
16
+ return $maxWidth && css`
17
+ max-width: ${$maxWidth}px;
18
+ `;
19
+ }}
20
+
21
+ ${_ref3 => {
22
+ let {
23
+ $width
24
+ } = _ref3;
16
25
  return $width && css`
17
26
  width: ${$width};
18
27
  `;
19
28
  }}
20
29
  `;
21
30
  export const StyledTooltipItemHeadline = styled.h5`
22
- color: ${_ref3 => {
31
+ color: ${_ref4 => {
23
32
  let {
24
33
  theme
25
- } = _ref3;
34
+ } = _ref4;
26
35
  return theme.headline;
27
36
  }};
28
37
  margin: 0;
@@ -33,10 +42,10 @@ export const StyledTooltipItemButtonWrapper = styled.div`
33
42
  justify-content: center;
34
43
  `;
35
44
  export const StyledTooltipItemText = styled.p`
36
- color: ${_ref4 => {
45
+ color: ${_ref5 => {
37
46
  let {
38
47
  theme
39
- } = _ref4;
48
+ } = _ref5;
40
49
  return theme.text;
41
50
  }};
42
51
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipItem.styles.js","names":["styled","css","StyledTooltipItem","div","_ref","$width","_ref2","StyledTooltipItemHeadline","h5","_ref3","theme","headline","StyledTooltipItemImage","img","StyledTooltipItemButtonWrapper","StyledTooltipItemText","p","_ref4","text"],"sources":["../../../../../src/components/tooltip/tooltip-item/TooltipItem.styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledTooltipItemProps = WithTheme<{ $width?: CSSProperties['width'] }>;\n\nexport const StyledTooltipItem = styled.div<StyledTooltipItemProps>`\n padding: 5px;\n\n width: ${({ $width }) => ($width ? `${$width}px` : '100%')};\n\n ${({ $width }) =>\n $width &&\n css`\n width: ${$width};\n `}\n`;\n\ntype StyledTooltipItemHeadlineProps = WithTheme<unknown>;\n\nexport const StyledTooltipItemHeadline = styled.h5<StyledTooltipItemHeadlineProps>`\n color: ${({ theme }: StyledTooltipItemHeadlineProps) => theme.headline};\n margin: 0;\n`;\n\nexport const StyledTooltipItemImage = styled.img``;\n\nexport const StyledTooltipItemButtonWrapper = styled.div`\n display: flex;\n justify-content: center;\n`;\n\ntype StyledTooltipItemTextProps = WithTheme<unknown>;\n\nexport const StyledTooltipItemText = styled.p<StyledTooltipItemTextProps>`\n color: ${({ theme }: StyledTooltipItemTextProps) => theme.text};\n`;\n"],"mappings":"AACA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAK/C,OAAO,MAAMC,iBAAiB,GAAGF,MAAM,CAACG,GAA2B;AACnE;AACA;AACA,aAAaC,IAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAAA,OAAMC,MAAM,GAAG,GAAGA,MAAM,IAAI,GAAG,MAAM;AAAA,CAAC;AAC9D;AACA,MAAMC,KAAA;EAAA,IAAC;IAAED;EAAO,CAAC,GAAAC,KAAA;EAAA,OACTD,MAAM,IACNJ,GAAG;AACX,qBAAqBI,MAAM;AAC3B,SAAS;AAAA;AACT,CAAC;AAID,OAAO,MAAME,yBAAyB,GAAGP,MAAM,CAACQ,EAAkC;AAClF,aAAaC,KAAA;EAAA,IAAC;IAAEC;EAAsC,CAAC,GAAAD,KAAA;EAAA,OAAKC,KAAK,CAACC,QAAQ;AAAA;AAC1E;AACA,CAAC;AAED,OAAO,MAAMC,sBAAsB,GAAGZ,MAAM,CAACa,GAAG,EAAE;AAElD,OAAO,MAAMC,8BAA8B,GAAGd,MAAM,CAACG,GAAG;AACxD;AACA;AACA,CAAC;AAID,OAAO,MAAMY,qBAAqB,GAAGf,MAAM,CAACgB,CAA6B;AACzE,aAAaC,KAAA;EAAA,IAAC;IAAEP;EAAkC,CAAC,GAAAO,KAAA;EAAA,OAAKP,KAAK,CAACQ,IAAI;AAAA;AAClE,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"TooltipItem.styles.js","names":["styled","css","StyledTooltipItem","div","_ref","$width","_ref2","$maxWidth","_ref3","StyledTooltipItemHeadline","h5","_ref4","theme","headline","StyledTooltipItemImage","img","StyledTooltipItemButtonWrapper","StyledTooltipItemText","p","_ref5","text"],"sources":["../../../../../src/components/tooltip/tooltip-item/TooltipItem.styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledTooltipItemProps = WithTheme<{ $width?: CSSProperties['width']; $maxWidth?: number }>;\n\nexport const StyledTooltipItem = styled.div<StyledTooltipItemProps>`\n padding: 5px;\n\n width: ${({ $width }) => ($width ? `${$width}px` : '100%')};\n\n ${({ $maxWidth }) =>\n $maxWidth &&\n css`\n max-width: ${$maxWidth}px;\n `}\n\n ${({ $width }) =>\n $width &&\n css`\n width: ${$width};\n `}\n`;\n\ntype StyledTooltipItemHeadlineProps = WithTheme<unknown>;\n\nexport const StyledTooltipItemHeadline = styled.h5<StyledTooltipItemHeadlineProps>`\n color: ${({ theme }: StyledTooltipItemHeadlineProps) => theme.headline};\n margin: 0;\n`;\n\nexport const StyledTooltipItemImage = styled.img``;\n\nexport const StyledTooltipItemButtonWrapper = styled.div`\n display: flex;\n justify-content: center;\n`;\n\ntype StyledTooltipItemTextProps = WithTheme<unknown>;\n\nexport const StyledTooltipItemText = styled.p<StyledTooltipItemTextProps>`\n color: ${({ theme }: StyledTooltipItemTextProps) => theme.text};\n`;\n"],"mappings":"AACA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAK/C,OAAO,MAAMC,iBAAiB,GAAGF,MAAM,CAACG,GAA2B;AACnE;AACA;AACA,aAAaC,IAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAAA,OAAMC,MAAM,GAAG,GAAGA,MAAM,IAAI,GAAG,MAAM;AAAA,CAAC;AAC9D;AACA,MAAMC,KAAA;EAAA,IAAC;IAAEC;EAAU,CAAC,GAAAD,KAAA;EAAA,OACZC,SAAS,IACTN,GAAG;AACX,yBAAyBM,SAAS;AAClC,SAAS;AAAA;AACT;AACA,MAAMC,KAAA;EAAA,IAAC;IAAEH;EAAO,CAAC,GAAAG,KAAA;EAAA,OACTH,MAAM,IACNJ,GAAG;AACX,qBAAqBI,MAAM;AAC3B,SAAS;AAAA;AACT,CAAC;AAID,OAAO,MAAMI,yBAAyB,GAAGT,MAAM,CAACU,EAAkC;AAClF,aAAaC,KAAA;EAAA,IAAC;IAAEC;EAAsC,CAAC,GAAAD,KAAA;EAAA,OAAKC,KAAK,CAACC,QAAQ;AAAA;AAC1E;AACA,CAAC;AAED,OAAO,MAAMC,sBAAsB,GAAGd,MAAM,CAACe,GAAG,EAAE;AAElD,OAAO,MAAMC,8BAA8B,GAAGhB,MAAM,CAACG,GAAG;AACxD;AACA;AACA,CAAC;AAID,OAAO,MAAMc,qBAAqB,GAAGjB,MAAM,CAACkB,CAA6B;AACzE,aAAaC,KAAA;EAAA,IAAC;IAAEP;EAAkC,CAAC,GAAAO,KAAA;EAAA,OAAKP,KAAK,CAACQ,IAAI;AAAA;AAClE,CAAC","ignoreList":[]}
@@ -26,6 +26,10 @@ export type TooltipProps = {
26
26
  * whether the tooltip should be shown.
27
27
  */
28
28
  isDisabled?: boolean;
29
+ /**
30
+ * The max width of the Tooltip.
31
+ */
32
+ maxWidth?: number;
29
33
  /**
30
34
  * Whether the tooltip should be hidden after the children is not hovered.
31
35
  */
@@ -8,6 +8,7 @@ export type TooltipProps = {
8
8
  onClick: () => void;
9
9
  };
10
10
  width?: CSSProperties['width'];
11
+ maxWidth?: number;
11
12
  };
12
13
  declare const TooltipItem: FC<TooltipProps>;
13
14
  export default TooltipItem;
@@ -2,6 +2,7 @@ import type { CSSProperties } from 'react';
2
2
  import type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';
3
3
  type StyledTooltipItemProps = WithTheme<{
4
4
  $width?: CSSProperties['width'];
5
+ $maxWidth?: number;
5
6
  }>;
6
7
  export declare const StyledTooltipItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledTooltipItemProps>> & string;
7
8
  export declare const StyledTooltipItemHeadline: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.0-beta.1106",
3
+ "version": "5.0.0-beta.1109",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "f40b0bde6dc9c79d636d5254565a6ce781a6dbbe"
89
+ "gitHead": "091ec62865e13216a959a5b3ac0782180d9eda03"
90
90
  }