@indico-data/design-system 3.6.1 → 3.6.3

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/lib/index.js CHANGED
@@ -43117,12 +43117,17 @@ const h="react-tooltip-core-styles",w="react-tooltip-base-styles",b={core:!1,bas
43117
43117
  .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"});}));
43118
43118
 
43119
43119
  const Tooltip = (_a) => {
43120
- var { id, clickToShow, delayShow, delayHide, children, zIndex = 1000, place = 'top' } = _a, rest = __rest(_a, ["id", "clickToShow", "delayShow", "delayHide", "children", "zIndex", "place"]);
43120
+ var { id, clickToShow, delayShow, delayHide, children, place = 'top', width = 'max-content', maxWidth, opacity = 1, positionStrategy = 'absolute' } = _a, rest = __rest(_a, ["id", "clickToShow", "delayShow", "delayHide", "children", "place", "width", "maxWidth", "opacity", "positionStrategy"]);
43121
43121
  return (jsxRuntime.jsx(M, Object.assign({ style: {
43122
43122
  backgroundColor: 'var(--pf-semantic-background-inverted)',
43123
43123
  color: 'var(--pf-semantic-font-inverted)',
43124
- zIndex,
43125
- }, id: id, place: place, openOnClick: clickToShow, delayShow: delayShow, delayHide: delayHide }, rest, { children: children })));
43124
+ width,
43125
+ maxWidth,
43126
+ boxSizing: 'border-box',
43127
+ textWrap: 'wrap',
43128
+ wordWrap: 'break-word',
43129
+ zIndex: 1000,
43130
+ }, className: "tooltip", id: id, place: place, openOnClick: clickToShow, delayShow: delayShow, delayHide: delayHide, opacity: opacity, positionStrategy: positionStrategy }, rest, { children: children })));
43126
43131
  };
43127
43132
 
43128
43133
  function BarSpinner(_a) {
@@ -43258,29 +43263,33 @@ function v4(options, buf, offset) {
43258
43263
  }
43259
43264
 
43260
43265
  const Truncate = (_a) => {
43261
- var { lineClamp = 0, truncateString, hasTooltip = true, tooltipId } = _a, rest = __rest(_a, ["lineClamp", "truncateString", "hasTooltip", "tooltipId"]);
43266
+ var { numLines = 1, truncateString, tooltipOptions = {} } = _a, rest = __rest(_a, ["numLines", "truncateString", "tooltipOptions"]);
43262
43267
  const [isTruncated, setIsTruncated] = React.useState(false);
43263
- const id = (tooltipId !== null && tooltipId !== void 0 ? tooltipId : v4()).replace(/[^a-zA-Z0-9-_]/g, '_');
43268
+ const id = React.useMemo(() => v4().replace(/[^a-zA-Z0-9-_]/g, '_'), []);
43269
+ const ref = React.useRef(null);
43264
43270
  React.useEffect(() => {
43265
43271
  const checkTruncation = () => {
43266
- const element = document.querySelector(`[data-tooltip-id="${id}"]`);
43267
- if (element) {
43268
- if (lineClamp === 0) {
43269
- setIsTruncated(element.scrollWidth > element.clientWidth);
43270
- }
43271
- else {
43272
- setIsTruncated(element.scrollHeight > element.clientHeight);
43273
- }
43272
+ const element = ref.current;
43273
+ if (!element)
43274
+ return;
43275
+ if (numLines === 1) {
43276
+ setIsTruncated(element.scrollWidth > element.clientWidth);
43277
+ }
43278
+ else {
43279
+ setIsTruncated(element.scrollHeight > element.clientHeight);
43274
43280
  }
43275
43281
  };
43276
43282
  checkTruncation();
43277
43283
  window.addEventListener('resize', checkTruncation);
43278
43284
  return () => window.removeEventListener('resize', checkTruncation);
43279
- }, [id, lineClamp]);
43285
+ }, [id, numLines]);
43280
43286
  const truncateStyle = {
43281
- '--line-clamp': lineClamp,
43287
+ '--line-clamp': numLines,
43282
43288
  };
43283
- return (jsxRuntime.jsxs("div", { className: "truncate-wrapper", style: truncateStyle, children: [jsxRuntime.jsx("span", Object.assign({ "data-testid": `truncate-${id}-${isTruncated ? 'truncated' : 'not-truncated'}`, "data-tooltip-id": id, "data-tooltip-content": isTruncated ? truncateString : undefined, className: lineClamp > 0 ? 'truncate-clip' : 'truncate' }, rest, { children: truncateString })), isTruncated && truncateString && hasTooltip && (jsxRuntime.jsx(Tooltip, { "data-tooltip-delay-hide": 0, id: id, children: truncateString }))] }));
43289
+ return (jsxRuntime.jsxs("div", { className: "truncate-wrapper", style: truncateStyle, children: [jsxRuntime.jsx("span", Object.assign({ ref: ref, "data-testid": `truncate-${id}-${isTruncated ? 'truncated' : 'not-truncated'}`, "data-tooltip-id": id, className: classNames('truncate', {
43290
+ 'truncate--multi-line': numLines > 1,
43291
+ 'truncate--single-line': numLines === 1,
43292
+ }) }, rest, { children: truncateString })), isTruncated && truncateString && !tooltipOptions.disabled && (jsxRuntime.jsx(Tooltip, Object.assign({}, tooltipOptions, { id: id, children: truncateString })))] }));
43284
43293
  };
43285
43294
 
43286
43295
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}