@pega/cosmos-react-work 9.0.0-build.29.20 → 9.0.0-build.29.22

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.
Files changed (31) hide show
  1. package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
  2. package/lib/components/GenAICoach/GenAICoach.js +51 -2
  3. package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
  4. package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
  5. package/lib/components/GenAICoach/GenAICoach.styles.js +1 -1
  6. package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
  7. package/lib/components/Shortcuts/Shortcuts.d.ts +7 -0
  8. package/lib/components/Shortcuts/Shortcuts.d.ts.map +1 -0
  9. package/lib/components/Shortcuts/Shortcuts.js +55 -0
  10. package/lib/components/Shortcuts/Shortcuts.js.map +1 -0
  11. package/lib/components/Shortcuts/Shortcuts.styles.d.ts +39 -0
  12. package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -0
  13. package/lib/components/Shortcuts/Shortcuts.styles.js +241 -0
  14. package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -0
  15. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts +2 -0
  16. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts.map +1 -0
  17. package/lib/components/Shortcuts/Shortcuts.test-ids.js +8 -0
  18. package/lib/components/Shortcuts/Shortcuts.test-ids.js.map +1 -0
  19. package/lib/components/Shortcuts/Shortcuts.types.d.ts +69 -0
  20. package/lib/components/Shortcuts/Shortcuts.types.d.ts.map +1 -0
  21. package/lib/components/Shortcuts/Shortcuts.types.js +2 -0
  22. package/lib/components/Shortcuts/Shortcuts.types.js.map +1 -0
  23. package/lib/components/Shortcuts/index.d.ts +3 -0
  24. package/lib/components/Shortcuts/index.d.ts.map +1 -0
  25. package/lib/components/Shortcuts/index.js +2 -0
  26. package/lib/components/Shortcuts/index.js.map +1 -0
  27. package/lib/index.d.ts +2 -0
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/index.js +2 -0
  30. package/lib/index.js.map +1 -1
  31. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AAuGA,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAmBhF,eAAO,MAAM,SAAS,+CA2GrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAQ5B,CAAC;iCA+kDyB,eAAe;;;AAQ1C,wBAA6D"}
1
+ {"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AAuGA,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAmBhF,eAAO,MAAM,SAAS,+CA2GrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAQ5B,CAAC;iCAipDyB,eAAe;;;AAQ1C,wBAA6D"}
@@ -113,7 +113,9 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
113
113
  const observersRef = useRef({
114
114
  inputContainer: null,
115
115
  messageContainer: null,
116
- streamingMessage: null
116
+ streamingMessage: null,
117
+ tileSync: null,
118
+ tileMutation: null
117
119
  });
118
120
  const isSmallOrAbove = useBreakpoint('sm', {
119
121
  breakpointRef: genAICoachRef
@@ -311,6 +313,53 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
311
313
  lastMessage.focus();
312
314
  }
313
315
  }, [scrollToLatest]);
316
+ const suggestionCardsViewElRef = useRef(null);
317
+ const setSuggestionCardsViewRef = useCallback((el) => {
318
+ if (suggestionCardsViewElRef.current === el)
319
+ return;
320
+ observersRef.current.tileSync?.disconnect();
321
+ observersRef.current.tileSync = null;
322
+ observersRef.current.tileMutation?.disconnect();
323
+ observersRef.current.tileMutation = null;
324
+ suggestionCardsViewElRef.current = el;
325
+ if (!el)
326
+ return;
327
+ const tileSelector = '[data-tile-content]';
328
+ let scheduled = false;
329
+ const measure = () => {
330
+ const tileContents = Array.from(el.querySelectorAll(tileSelector));
331
+ if (tileContents.length === 0) {
332
+ el.style.removeProperty('--tile-col-track');
333
+ return;
334
+ }
335
+ tileContents.forEach(tileEl => {
336
+ tileEl.style.width = 'auto';
337
+ });
338
+ const maxWidth = Math.max(...tileContents.map(tileEl => Math.round(tileEl.getBoundingClientRect().width)));
339
+ tileContents.forEach(tileEl => {
340
+ tileEl.style.width = '';
341
+ });
342
+ const newTrack = `${maxWidth}px`;
343
+ if (el.style.getPropertyValue('--tile-col-track') !== newTrack) {
344
+ el.style.setProperty('--tile-col-track', newTrack);
345
+ }
346
+ };
347
+ const schedule = () => {
348
+ if (scheduled)
349
+ return;
350
+ scheduled = true;
351
+ requestAnimationFrame(() => {
352
+ scheduled = false;
353
+ measure();
354
+ });
355
+ };
356
+ const ro = new ResizeObserver(() => schedule());
357
+ ro.observe(el);
358
+ observersRef.current.tileSync = ro;
359
+ const mo = new MutationObserver(() => schedule());
360
+ mo.observe(el, { childList: true, subtree: true });
361
+ observersRef.current.tileMutation = mo;
362
+ }, []);
314
363
  const setInputContainerRef = useCallback((el) => {
315
364
  if (inputContainerRef.current === el)
316
365
  return;
@@ -878,7 +927,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
878
927
  }, ...(prevFullScreen !== fullScreen ? { animationInitialCursorPos } : {}) }));
879
928
  }) })) })) }), showScrollToBottom && (_jsx(StyledScrollButton, { ref: scrollButtonRef, icon: true, onClick: handleScrollToBottomClick, ariaLabel: t('scroll_to_latest_message'), onKeyDown: focusLastMessageLi, children: _jsx(Icon, { name: 'caret-down' }) })), !loading && messages.length === 0 && suggestionCardsView ? (_jsxs(_Fragment, { children: [((isInUtilities(variant) && variant.state !== 'minimized') ||
880
929
  !isInUtilities(variant)) &&
881
- !guidedMode && (_jsx(StyledStickyComposer, { children: _jsx(Flex, { container: { direction: 'column' }, as: StyledInputContainer, ref: setInputContainerRef, children: _jsx(StyledComposerSection, { children: genAIFooter }) }) })), _jsx(Flex, { container: { direction: 'column' }, as: StyledSuggestionCardsBottomHalf, children: _jsx(StyledSuggestionCardsView, { children: suggestionCardsView }) })] })) : (((isInUtilities(variant) && variant.state !== 'minimized') ||
930
+ !guidedMode && (_jsx(StyledStickyComposer, { children: _jsx(Flex, { container: { direction: 'column' }, as: StyledInputContainer, ref: setInputContainerRef, children: _jsx(StyledComposerSection, { children: genAIFooter }) }) })), _jsx(Flex, { container: { direction: 'column' }, as: StyledSuggestionCardsBottomHalf, children: _jsx(StyledSuggestionCardsView, { ref: setSuggestionCardsViewRef, children: suggestionCardsView }) })] })) : (((isInUtilities(variant) && variant.state !== 'minimized') ||
882
931
  !isInUtilities(variant)) &&
883
932
  !loading && (_jsx(Flex, { container: { direction: 'column' }, as: StyledInputContainer, ref: setInputContainerRef, children: _jsxs(StyledComposerSection, { children: [guidedMode &&
884
933
  questionnaireData &&