@pega/cosmos-react-work 9.0.0-build.9.9 → 9.0.1

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 (276) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +2 -1
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js +36 -21
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  5. package/lib/components/Article/ArticleRating.d.ts +1 -1
  6. package/lib/components/Article/ArticleRating.d.ts.map +1 -1
  7. package/lib/components/ArticleList/AIArticleSummary.d.ts +3 -1
  8. package/lib/components/ArticleList/AIArticleSummary.d.ts.map +1 -1
  9. package/lib/components/ArticleList/ArticleBuddy.d.ts +1 -1
  10. package/lib/components/ArticleList/ArticleBuddy.d.ts.map +1 -1
  11. package/lib/components/ArticleList/ArticleBuddy.js +5 -1
  12. package/lib/components/ArticleList/ArticleBuddy.js.map +1 -1
  13. package/lib/components/ArticleList/ArticleBuddyList.d.ts +1 -1
  14. package/lib/components/ArticleList/ArticleBuddyList.d.ts.map +1 -1
  15. package/lib/components/ArticleList/ArticleBuddyResponse.d.ts +189 -3
  16. package/lib/components/ArticleList/ArticleBuddyResponse.d.ts.map +1 -1
  17. package/lib/components/ArticleList/ArticleBuddyResponse.js +1 -1
  18. package/lib/components/ArticleList/ArticleBuddyResponse.js.map +1 -1
  19. package/lib/components/ArticleList/ArticleFeedback.d.ts +3 -1
  20. package/lib/components/ArticleList/ArticleFeedback.d.ts.map +1 -1
  21. package/lib/components/ArticleList/ArticleList.d.ts +2 -2
  22. package/lib/components/ArticleList/ArticleList.d.ts.map +1 -1
  23. package/lib/components/ArticleList/ArticleList.js +6 -0
  24. package/lib/components/ArticleList/ArticleList.js.map +1 -1
  25. package/lib/components/ArticleList/ArticleList.types.d.ts +17 -2
  26. package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -1
  27. package/lib/components/ArticleList/ArticleList.types.js.map +1 -1
  28. package/lib/components/ArticleList/ArticleListHeader.d.ts +183 -1
  29. package/lib/components/ArticleList/ArticleListHeader.d.ts.map +1 -1
  30. package/lib/components/ArticleList/ArticleSummary.styles.d.ts +2 -2
  31. package/lib/components/ArticleList/ArticleSummary.styles.d.ts.map +1 -1
  32. package/lib/components/ArticleList/ArticleSummaryHeader.d.ts.map +1 -1
  33. package/lib/components/ArticleList/ArticleSummaryHeader.js +3 -1
  34. package/lib/components/ArticleList/ArticleSummaryHeader.js.map +1 -1
  35. package/lib/components/ArticleList/QuestionList.d.ts +5 -3
  36. package/lib/components/ArticleList/QuestionList.d.ts.map +1 -1
  37. package/lib/components/ArticleList/RelatedQuestions.d.ts +4 -2
  38. package/lib/components/ArticleList/RelatedQuestions.d.ts.map +1 -1
  39. package/lib/components/Assignments/Assignments.d.ts +2 -2
  40. package/lib/components/Assignments/Assignments.d.ts.map +1 -1
  41. package/lib/components/Assignments/Assignments.js +1 -1
  42. package/lib/components/Assignments/Assignments.js.map +1 -1
  43. package/lib/components/Assignments/Assignments.styles.d.ts +7 -3
  44. package/lib/components/Assignments/Assignments.styles.d.ts.map +1 -1
  45. package/lib/components/CaseHierarchy/CaseHierarchy.d.ts +2 -2
  46. package/lib/components/CaseHierarchy/CaseHierarchy.d.ts.map +1 -1
  47. package/lib/components/CaseHierarchy/CaseHierarchy.js +4 -3
  48. package/lib/components/CaseHierarchy/CaseHierarchy.js.map +1 -1
  49. package/lib/components/CaseHierarchy/CaseHierarchy.styles.d.ts +7 -3
  50. package/lib/components/CaseHierarchy/CaseHierarchy.styles.d.ts.map +1 -1
  51. package/lib/components/CaseHierarchy/CaseHierarchy.styles.js +9 -7
  52. package/lib/components/CaseHierarchy/CaseHierarchy.styles.js.map +1 -1
  53. package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.d.ts +1 -1
  54. package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.d.ts.map +1 -1
  55. package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.js +2 -1
  56. package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.js.map +1 -1
  57. package/lib/components/CaseHierarchy/CaseHierarchy.types.d.ts +7 -1
  58. package/lib/components/CaseHierarchy/CaseHierarchy.types.d.ts.map +1 -1
  59. package/lib/components/CaseHierarchy/CaseHierarchy.types.js.map +1 -1
  60. package/lib/components/CasePreview/CasePreview.d.ts +1 -1
  61. package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
  62. package/lib/components/CasePreview/CasePreview.js +83 -115
  63. package/lib/components/CasePreview/CasePreview.js.map +1 -1
  64. package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
  65. package/lib/components/CaseView/CaseHeader/CaseHeader.js +97 -27
  66. package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
  67. package/lib/components/CaseView/CaseHeader/Summary.d.ts.map +1 -1
  68. package/lib/components/CaseView/CaseHeader/Summary.js +8 -1
  69. package/lib/components/CaseView/CaseHeader/Summary.js.map +1 -1
  70. package/lib/components/CaseView/CaseSummaryFields.js +1 -1
  71. package/lib/components/CaseView/CaseSummaryFields.js.map +1 -1
  72. package/lib/components/CaseView/CaseView.d.ts.map +1 -1
  73. package/lib/components/CaseView/CaseView.js +49 -20
  74. package/lib/components/CaseView/CaseView.js.map +1 -1
  75. package/lib/components/CaseView/CaseView.styles.d.ts +83 -47
  76. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
  77. package/lib/components/CaseView/CaseView.styles.js +329 -122
  78. package/lib/components/CaseView/CaseView.styles.js.map +1 -1
  79. package/lib/components/CaseView/CaseView.types.d.ts +24 -8
  80. package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
  81. package/lib/components/CaseView/CaseView.types.js.map +1 -1
  82. package/lib/components/CaseView/UtilitiesSummary.d.ts +1 -1
  83. package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
  84. package/lib/components/CaseView/UtilitiesSummary.js +14 -4
  85. package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
  86. package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts.map +1 -1
  87. package/lib/components/CaseView/UtilitySummaryItemDialog.js +10 -4
  88. package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -1
  89. package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -1
  90. package/lib/components/ConfigurableLayout/LayoutCell.js +25 -25
  91. package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -1
  92. package/lib/components/Confirmation/Confirmation.d.ts +10 -0
  93. package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
  94. package/lib/components/Confirmation/Confirmation.js +2 -2
  95. package/lib/components/Confirmation/Confirmation.js.map +1 -1
  96. package/lib/components/Confirmation/index.d.ts +1 -1
  97. package/lib/components/Confirmation/index.d.ts.map +1 -1
  98. package/lib/components/Confirmation/index.js.map +1 -1
  99. package/lib/components/Details/Details.d.ts +3 -2
  100. package/lib/components/Details/Details.d.ts.map +1 -1
  101. package/lib/components/Details/Details.js +6 -5
  102. package/lib/components/Details/Details.js.map +1 -1
  103. package/lib/components/Details/Details.styles.d.ts +17 -15
  104. package/lib/components/Details/Details.styles.d.ts.map +1 -1
  105. package/lib/components/Details/Details.styles.js +28 -15
  106. package/lib/components/Details/Details.styles.js.map +1 -1
  107. package/lib/components/Details/Details.test-ids.d.ts +1 -1
  108. package/lib/components/Details/Details.test-ids.d.ts.map +1 -1
  109. package/lib/components/Details/Details.test-ids.js +2 -1
  110. package/lib/components/Details/Details.test-ids.js.map +1 -1
  111. package/lib/components/Details/DetailsList.d.ts.map +1 -1
  112. package/lib/components/Details/DetailsList.js +1 -5
  113. package/lib/components/Details/DetailsList.js.map +1 -1
  114. package/lib/components/GenAICoach/ActiveCases.d.ts +5 -0
  115. package/lib/components/GenAICoach/ActiveCases.d.ts.map +1 -0
  116. package/lib/components/GenAICoach/ActiveCases.js +50 -0
  117. package/lib/components/GenAICoach/ActiveCases.js.map +1 -0
  118. package/lib/components/GenAICoach/CaseWorkflow.d.ts +5 -0
  119. package/lib/components/GenAICoach/CaseWorkflow.d.ts.map +1 -0
  120. package/lib/components/GenAICoach/CaseWorkflow.js +111 -0
  121. package/lib/components/GenAICoach/CaseWorkflow.js.map +1 -0
  122. package/lib/components/GenAICoach/ConversationHistory.d.ts.map +1 -1
  123. package/lib/components/GenAICoach/ConversationHistory.js +11 -13
  124. package/lib/components/GenAICoach/ConversationHistory.js.map +1 -1
  125. package/lib/components/GenAICoach/GenAICoach.d.ts +4 -3
  126. package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
  127. package/lib/components/GenAICoach/GenAICoach.js +721 -141
  128. package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
  129. package/lib/components/GenAICoach/GenAICoach.styles.d.ts +1639 -35
  130. package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
  131. package/lib/components/GenAICoach/GenAICoach.styles.js +867 -82
  132. package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
  133. package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +3 -2
  134. package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -1
  135. package/lib/components/GenAICoach/GenAICoach.test-ids.js +6 -1
  136. package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -1
  137. package/lib/components/GenAICoach/GenAICoach.types.d.ts +215 -9
  138. package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
  139. package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
  140. package/lib/components/GenAICoach/GenAIMessage.d.ts +6 -0
  141. package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
  142. package/lib/components/GenAICoach/GenAIMessage.js +101 -52
  143. package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
  144. package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts +4 -0
  145. package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts.map +1 -0
  146. package/lib/components/GenAICoach/GenAIMessageFeedback.js +95 -0
  147. package/lib/components/GenAICoach/GenAIMessageFeedback.js.map +1 -0
  148. package/lib/components/GenAICoach/GenAIMessageProgress.d.ts +4 -1
  149. package/lib/components/GenAICoach/GenAIMessageProgress.d.ts.map +1 -1
  150. package/lib/components/GenAICoach/GenAIMessageProgress.js +11 -35
  151. package/lib/components/GenAICoach/GenAIMessageProgress.js.map +1 -1
  152. package/lib/components/GenAICoach/InitialSuggestedMessage.d.ts.map +1 -1
  153. package/lib/components/GenAICoach/InitialSuggestedMessage.js +5 -6
  154. package/lib/components/GenAICoach/InitialSuggestedMessage.js.map +1 -1
  155. package/lib/components/GenAICoach/PortalAgentSplitView.d.ts +6 -0
  156. package/lib/components/GenAICoach/PortalAgentSplitView.d.ts.map +1 -0
  157. package/lib/components/GenAICoach/PortalAgentSplitView.js +75 -0
  158. package/lib/components/GenAICoach/PortalAgentSplitView.js.map +1 -0
  159. package/lib/components/GenAICoach/Questionnaire.d.ts +4 -0
  160. package/lib/components/GenAICoach/Questionnaire.d.ts.map +1 -0
  161. package/lib/components/GenAICoach/Questionnaire.js +155 -0
  162. package/lib/components/GenAICoach/Questionnaire.js.map +1 -0
  163. package/lib/components/GenAICoach/ToolCandidates.d.ts +4 -0
  164. package/lib/components/GenAICoach/ToolCandidates.d.ts.map +1 -0
  165. package/lib/components/GenAICoach/ToolCandidates.js +19 -0
  166. package/lib/components/GenAICoach/ToolCandidates.js.map +1 -0
  167. package/lib/components/GenAICoach/ToolConfirmationMessage.d.ts +4 -0
  168. package/lib/components/GenAICoach/ToolConfirmationMessage.d.ts.map +1 -0
  169. package/lib/components/GenAICoach/ToolConfirmationMessage.js +20 -0
  170. package/lib/components/GenAICoach/ToolConfirmationMessage.js.map +1 -0
  171. package/lib/components/GenAICoach/ToolDetails.d.ts +5 -0
  172. package/lib/components/GenAICoach/ToolDetails.d.ts.map +1 -0
  173. package/lib/components/GenAICoach/ToolDetails.js +99 -0
  174. package/lib/components/GenAICoach/ToolDetails.js.map +1 -0
  175. package/lib/components/GenAICoach/index.d.ts +5 -3
  176. package/lib/components/GenAICoach/index.d.ts.map +1 -1
  177. package/lib/components/GenAICoach/index.js +4 -2
  178. package/lib/components/GenAICoach/index.js.map +1 -1
  179. package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts +55 -34
  180. package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts.map +1 -1
  181. package/lib/components/HierarchicalAssignments/Assignments.styles.js +41 -11
  182. package/lib/components/HierarchicalAssignments/Assignments.styles.js.map +1 -1
  183. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts +2 -0
  184. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts.map +1 -1
  185. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.js.map +1 -1
  186. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts +1 -1
  187. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts.map +1 -1
  188. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js +7 -4
  189. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js.map +1 -1
  190. package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.d.ts.map +1 -1
  191. package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.js +2 -2
  192. package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.js.map +1 -1
  193. package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
  194. package/lib/components/IntelligentGuidance/IntelligentGuidance.js +1 -1
  195. package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
  196. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +9 -5
  197. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
  198. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +17 -3
  199. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
  200. package/lib/components/InteractionNotification/InteractionNotification.d.ts +31 -8
  201. package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
  202. package/lib/components/InteractionNotification/InteractionNotification.js +17 -10
  203. package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
  204. package/lib/components/Predictions/Predictions.d.ts.map +1 -1
  205. package/lib/components/Predictions/Predictions.js +11 -2
  206. package/lib/components/Predictions/Predictions.js.map +1 -1
  207. package/lib/components/SearchResults/ActiveFilter.d.ts +1 -1
  208. package/lib/components/SearchResults/ActiveFilter.d.ts.map +1 -1
  209. package/lib/components/SearchResults/Filter.d.ts.map +1 -1
  210. package/lib/components/SearchResults/Filter.js +1 -1
  211. package/lib/components/SearchResults/Filter.js.map +1 -1
  212. package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
  213. package/lib/components/SearchResults/SearchResult.js +14 -6
  214. package/lib/components/SearchResults/SearchResult.js.map +1 -1
  215. package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
  216. package/lib/components/SearchResults/SearchResults.js +18 -3
  217. package/lib/components/SearchResults/SearchResults.js.map +1 -1
  218. package/lib/components/SearchResults/SearchResults.styles.d.ts +12 -10
  219. package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
  220. package/lib/components/Shortcuts/Shortcuts.d.ts +7 -0
  221. package/lib/components/Shortcuts/Shortcuts.d.ts.map +1 -0
  222. package/lib/components/Shortcuts/Shortcuts.js +47 -0
  223. package/lib/components/Shortcuts/Shortcuts.js.map +1 -0
  224. package/lib/components/Shortcuts/Shortcuts.styles.d.ts +22 -0
  225. package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -0
  226. package/lib/components/Shortcuts/Shortcuts.styles.js +114 -0
  227. package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -0
  228. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts +2 -0
  229. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts.map +1 -0
  230. package/lib/components/Shortcuts/Shortcuts.test-ids.js +8 -0
  231. package/lib/components/Shortcuts/Shortcuts.test-ids.js.map +1 -0
  232. package/lib/components/Shortcuts/Shortcuts.types.d.ts +64 -0
  233. package/lib/components/Shortcuts/Shortcuts.types.d.ts.map +1 -0
  234. package/lib/components/Shortcuts/Shortcuts.types.js +2 -0
  235. package/lib/components/Shortcuts/Shortcuts.types.js.map +1 -0
  236. package/lib/components/Shortcuts/index.d.ts +3 -0
  237. package/lib/components/Shortcuts/index.d.ts.map +1 -0
  238. package/lib/components/Shortcuts/index.js +2 -0
  239. package/lib/components/Shortcuts/index.js.map +1 -0
  240. package/lib/components/Stages/Stages.d.ts.map +1 -1
  241. package/lib/components/Stages/Stages.js +37 -12
  242. package/lib/components/Stages/Stages.js.map +1 -1
  243. package/lib/components/Stages/Stages.styles.d.ts +22 -15
  244. package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
  245. package/lib/components/Stages/Stages.styles.js +285 -119
  246. package/lib/components/Stages/Stages.styles.js.map +1 -1
  247. package/lib/components/Stages/Stages.types.d.ts +5 -0
  248. package/lib/components/Stages/Stages.types.d.ts.map +1 -1
  249. package/lib/components/Stages/Stages.types.js.map +1 -1
  250. package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
  251. package/lib/components/Stakeholders/Stakeholders.js +109 -145
  252. package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
  253. package/lib/components/Tags/Tags.d.ts +2 -2
  254. package/lib/components/Tags/Tags.d.ts.map +1 -1
  255. package/lib/components/Tags/Tags.js +12 -2
  256. package/lib/components/Tags/Tags.js.map +1 -1
  257. package/lib/components/Tasks/TaskList.d.ts +10 -3
  258. package/lib/components/Tasks/TaskList.d.ts.map +1 -1
  259. package/lib/components/Tasks/TaskList.js +59 -5
  260. package/lib/components/Tasks/TaskList.js.map +1 -1
  261. package/lib/components/Tasks/Tasks.d.ts +10 -3
  262. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  263. package/lib/components/Tasks/Tasks.js +29 -5
  264. package/lib/components/Tasks/Tasks.js.map +1 -1
  265. package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts.map +1 -1
  266. package/lib/components/UtilitiesLayout/UtilitiesLayout.js +3 -2
  267. package/lib/components/UtilitiesLayout/UtilitiesLayout.js.map +1 -1
  268. package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts +2 -2
  269. package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts.map +1 -1
  270. package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js +3 -2
  271. package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js.map +1 -1
  272. package/lib/index.d.ts +2 -0
  273. package/lib/index.d.ts.map +1 -1
  274. package/lib/index.js +2 -0
  275. package/lib/index.js.map +1 -1
  276. package/package.json +6 -7
@@ -0,0 +1,114 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { mix } from 'polished';
3
+ import { Button, defaultThemeProp, Icon, Text, tryCatch } from '@pega/cosmos-react-core';
4
+ export const StyledShortcutsCardsContainer = styled.ul(({ theme: { base }, isSmallOrAbove, showHeader }) => {
5
+ return css `
6
+ display: grid;
7
+ grid-template-columns: minmax(0, 1fr);
8
+ gap: ${base.spacing};
9
+ list-style: none;
10
+ padding: ${base.spacing} 0;
11
+ margin: 0;
12
+
13
+ ${isSmallOrAbove &&
14
+ css `
15
+ grid-auto-rows: 1fr;
16
+ grid-template-columns: ${showHeader
17
+ ? 'repeat(auto-fill, minmax(14rem, 1fr))'
18
+ : 'repeat(auto-fit, minmax(14rem, 14rem))'};
19
+ justify-content: ${showHeader ? 'start' : 'center'};
20
+ align-items: stretch;
21
+ width: 100%;
22
+ `}
23
+ `;
24
+ });
25
+ StyledShortcutsCardsContainer.defaultProps = defaultThemeProp;
26
+ export const StyledShortcutsCategoriesContainer = styled.div(({ theme: { base }, isSmallOrAbove }) => {
27
+ return css `
28
+ display: grid;
29
+ grid-template-columns: minmax(0, 1fr);
30
+ gap: calc(${base.spacing} * 2);
31
+ width: 100%;
32
+
33
+ ${isSmallOrAbove &&
34
+ css `
35
+ grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
36
+ align-items: start;
37
+ `}
38
+
39
+ ${!isSmallOrAbove &&
40
+ css `
41
+ padding-inline: calc(${base.spacing} * 0.5);
42
+ padding-block: ${base.spacing};
43
+ `}
44
+ `;
45
+ });
46
+ StyledShortcutsCategoriesContainer.defaultProps = defaultThemeProp;
47
+ export const StyledShortcutsCategoryHeading = styled(Text)(({ theme: { base } }) => {
48
+ return css `
49
+ margin-block-end: ${base.spacing};
50
+ `;
51
+ });
52
+ StyledShortcutsCategoryHeading.defaultProps = defaultThemeProp;
53
+ export const StyledShortcutsCard = styled.li `
54
+ display: flex;
55
+ flex-direction: column;
56
+ `;
57
+ export const StyledShortcutsCardButton = styled(Button)(({ theme: { base, components }, layoutVariant }) => {
58
+ const hoverBackgroundColor = tryCatch(() => mix(0.9, base.palette['primary-background'], components.button['secondary-color']));
59
+ return css `
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: flex-start;
63
+ flex: 1;
64
+ width: 100%;
65
+ border: 0.0625rem solid ${base.palette['border-line']};
66
+ border-radius: ${base['border-radius']};
67
+ background: ${base.palette['primary-background']};
68
+ padding-inline: calc(${base.spacing} * 2);
69
+
70
+ &:hover {
71
+ background: ${hoverBackgroundColor};
72
+ }
73
+
74
+ ${layoutVariant === 'stacked' &&
75
+ css `
76
+ flex-direction: column;
77
+ gap: calc(${base.spacing} * 2);
78
+ padding-block-start: calc(${base.spacing} * 4);
79
+ padding-block-end: calc(${base.spacing} * 3);
80
+ text-align: center;
81
+ min-height: 8rem;
82
+ `}
83
+
84
+ ${layoutVariant === 'inline' &&
85
+ css `
86
+ flex-direction: row;
87
+ gap: calc(${base.spacing} * 1.5);
88
+ padding-block: calc(${base.spacing} * 1.5);
89
+ text-align: start;
90
+ `}
91
+ `;
92
+ });
93
+ StyledShortcutsCardButton.defaultProps = defaultThemeProp;
94
+ export const StyledShortcutsCardIcon = styled(Icon)(({ layoutVariant }) => css `
95
+ flex-shrink: 0;
96
+
97
+ ${layoutVariant === 'stacked' &&
98
+ css `
99
+ width: 3rem;
100
+ height: 3rem;
101
+ `}
102
+ `);
103
+ StyledShortcutsCardIcon.defaultProps = defaultThemeProp;
104
+ export const StyledLabelRow = styled.span(({ theme: { base } }) => css `
105
+ display: flex;
106
+ align-items: center;
107
+ gap: calc(${base.spacing} * 0.5);
108
+ `);
109
+ StyledLabelRow.defaultProps = defaultThemeProp;
110
+ export const StyledExternalIcon = styled(Icon) `
111
+ flex-shrink: 0;
112
+ `;
113
+ StyledExternalIcon.defaultProps = defaultThemeProp;
114
+ //# sourceMappingURL=Shortcuts.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shortcuts.styles.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEzF,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,EAAE,CAGnD,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE;IACrD,OAAO,GAAG,CAAA;;;WAGD,IAAI,CAAC,OAAO;;eAER,IAAI,CAAC,OAAO;;;MAGrB,cAAc;QAChB,GAAG,CAAA;;+BAEwB,UAAU;YACjC,CAAC,CAAC,uCAAuC;YACzC,CAAC,CAAC,wCAAwC;yBACzB,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;;;KAGnD;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,6BAA6B,CAAC,YAAY,GAAG,gBAAgB,CAAC;A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;2BACzB,IAAI,CAAC,OAAO;;;oBAGnB,oBAAoB;;;MAGlC,aAAa,KAAK,SAAS;QAC7B,GAAG,CAAA;;kBAEW,IAAI,CAAC,OAAO;kCACI,IAAI,CAAC,OAAO;gCACd,IAAI,CAAC,OAAO;;;KAGvC;;MAEC,aAAa,KAAK,QAAQ;QAC5B,GAAG,CAAA;;kBAEW,IAAI,CAAC,OAAO;4BACF,IAAI,CAAC,OAAO;;KAEnC;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAC,CACjD,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;MAGtB,aAAa,KAAK,SAAS;IAC7B,GAAG,CAAA;;;KAGF;GACF,CACF,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CACvC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;gBAGd,IAAI,CAAC,OAAO;GACzB,CACF,CAAC;AAEF,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAE7C,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { Button, defaultThemeProp, Icon, Text, tryCatch } from '@pega/cosmos-react-core';\n\nexport const StyledShortcutsCardsContainer = styled.ul<{\n isSmallOrAbove: boolean;\n showHeader: boolean;\n}>(({ theme: { base }, isSmallOrAbove, showHeader }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: ${base.spacing};\n list-style: none;\n padding: ${base.spacing} 0;\n margin: 0;\n\n ${isSmallOrAbove &&\n css`\n grid-auto-rows: 1fr;\n grid-template-columns: ${showHeader\n ? 'repeat(auto-fill, minmax(14rem, 1fr))'\n : 'repeat(auto-fit, minmax(14rem, 14rem))'};\n justify-content: ${showHeader ? 'start' : 'center'};\n align-items: stretch;\n width: 100%;\n `}\n `;\n});\n\nStyledShortcutsCardsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoriesContainer = styled.div<{ isSmallOrAbove: boolean }>(\n ({ theme: { base }, isSmallOrAbove }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: calc(${base.spacing} * 2);\n width: 100%;\n\n ${isSmallOrAbove &&\n css`\n grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));\n align-items: start;\n `}\n\n ${!isSmallOrAbove &&\n css`\n padding-inline: calc(${base.spacing} * 0.5);\n padding-block: ${base.spacing};\n `}\n `;\n }\n);\n\nStyledShortcutsCategoriesContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoryHeading = styled(Text)(({ theme: { base } }) => {\n return css`\n margin-block-end: ${base.spacing};\n `;\n});\n\nStyledShortcutsCategoryHeading.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCard = styled.li`\n display: flex;\n flex-direction: column;\n`;\n\nexport const StyledShortcutsCardButton = styled(Button)<{ layoutVariant: 'stacked' | 'inline' }>(({\n theme: { base, components },\n layoutVariant\n}) => {\n const hoverBackgroundColor = tryCatch(() =>\n mix(0.9, base.palette['primary-background'], components.button['secondary-color'])\n );\n\n return css`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n flex: 1;\n width: 100%;\n border: 0.0625rem solid ${base.palette['border-line']};\n border-radius: ${base['border-radius']};\n background: ${base.palette['primary-background']};\n padding-inline: calc(${base.spacing} * 2);\n\n &:hover {\n background: ${hoverBackgroundColor};\n }\n\n ${layoutVariant === 'stacked' &&\n css`\n flex-direction: column;\n gap: calc(${base.spacing} * 2);\n padding-block-start: calc(${base.spacing} * 4);\n padding-block-end: calc(${base.spacing} * 3);\n text-align: center;\n min-height: 8rem;\n `}\n\n ${layoutVariant === 'inline' &&\n css`\n flex-direction: row;\n gap: calc(${base.spacing} * 1.5);\n padding-block: calc(${base.spacing} * 1.5);\n text-align: start;\n `}\n `;\n});\n\nStyledShortcutsCardButton.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCardIcon = styled(Icon)<{ layoutVariant: 'stacked' | 'inline' }>(\n ({ layoutVariant }) => css`\n flex-shrink: 0;\n\n ${layoutVariant === 'stacked' &&\n css`\n width: 3rem;\n height: 3rem;\n `}\n `\n);\n\nStyledShortcutsCardIcon.defaultProps = defaultThemeProp;\n\nexport const StyledLabelRow = styled.span(\n ({ theme: { base } }) => css`\n display: flex;\n align-items: center;\n gap: calc(${base.spacing} * 0.5);\n `\n);\n\nStyledLabelRow.defaultProps = defaultThemeProp;\n\nexport const StyledExternalIcon = styled(Icon)`\n flex-shrink: 0;\n`;\n\nStyledExternalIcon.defaultProps = defaultThemeProp;\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const getShortcutsTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["list", "emptyState", "categorySection", "categoryHeading"]>;
2
+ //# sourceMappingURL=Shortcuts.test-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shortcuts.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,iMAKrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { createTestIds } from '@pega/cosmos-react-core';
2
+ export const getShortcutsTestIds = createTestIds('shortcuts', [
3
+ 'list',
4
+ 'emptyState',
5
+ 'categorySection',
6
+ 'categoryHeading'
7
+ ]);
8
+ //# sourceMappingURL=Shortcuts.test-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shortcuts.test-ids.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,WAAW,EAAE;IAC5D,MAAM;IACN,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;CACT,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getShortcutsTestIds = createTestIds('shortcuts', [\n 'list',\n 'emptyState',\n 'categorySection',\n 'categoryHeading'\n] as const);\n"]}
@@ -0,0 +1,64 @@
1
+ import type { Ref } from 'react';
2
+ import type { NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';
3
+ interface ShortcutItemBase {
4
+ /** Unique identifier for this shortcut. */
5
+ id: string;
6
+ /** Display label shown on the shortcut. */
7
+ label: string;
8
+ /** Icon name from the registered icon set. */
9
+ icon: string;
10
+ }
11
+ export interface ShortcutLinkItem extends ShortcutItemBase {
12
+ /** Discriminant — this item navigates to an external URL. */
13
+ type: 'external';
14
+ /** Absolute URL the link navigates to. Opens in a new tab. */
15
+ href: string;
16
+ }
17
+ export interface ShortcutNavItem extends ShortcutItemBase {
18
+ /** Discriminant — this item navigates to a portal landing page. */
19
+ type: 'page';
20
+ /** Callback invoked when the user activates this shortcut. */
21
+ onClick: () => void;
22
+ }
23
+ export type ShortcutItem = ShortcutLinkItem | ShortcutNavItem;
24
+ export interface ShortcutCategory {
25
+ /** Unique identifier for this category. */
26
+ id: string;
27
+ /** Display label shown as the category heading. */
28
+ label: string;
29
+ /** Shortcut items belonging to this category. */
30
+ items: ShortcutItem[];
31
+ }
32
+ interface ShortcutsWithItems {
33
+ /** Shortcut items to render as cards. */
34
+ items?: ShortcutItem[];
35
+ categories?: never;
36
+ /**
37
+ * Whether to render the outer card shell with a heading.
38
+ * When `false`, only the card grid is rendered, centered within its container.
39
+ * @default true
40
+ */
41
+ showHeader?: boolean;
42
+ }
43
+ interface ShortcutsWithCategories {
44
+ items?: never;
45
+ /** Grouped shortcut items, each rendered as cards under a category heading. */
46
+ categories: ShortcutCategory[];
47
+ showHeader?: never;
48
+ }
49
+ interface ShortcutsBaseProps extends NoChildrenProp, TestIdProp {
50
+ /** Heading displayed above the shortcuts. */
51
+ heading?: string;
52
+ /**
53
+ * Controls the layout variant of each shortcut card.
54
+ * - `stacked`: large icon above the label (default card style).
55
+ * - `inline`: small icon inline to the left of the label (list/link style).
56
+ * @default 'inline'
57
+ */
58
+ variant?: 'stacked' | 'inline';
59
+ /** Ref for the root card element. */
60
+ ref?: Ref<HTMLDivElement>;
61
+ }
62
+ export type ShortcutsProps = ShortcutsBaseProps & (ShortcutsWithItems | ShortcutsWithCategories);
63
+ export {};
64
+ //# sourceMappingURL=Shortcuts.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shortcuts.types.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1E,UAAU,gBAAgB;IACxB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,6DAA6D;IAC7D,IAAI,EAAE,UAAU,CAAC;IACjB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,UAAU,kBAAkB;IAC1B,yCAAyC;IACzC,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,+EAA+E;IAC/E,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,UAAU,kBAAmB,SAAQ,cAAc,EAAE,UAAU;IAC7D,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,qCAAqC;IACrC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,CAAC,kBAAkB,GAAG,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Shortcuts.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shortcuts.types.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Ref } from 'react';\n\nimport type { NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';\n\ninterface ShortcutItemBase {\n /** Unique identifier for this shortcut. */\n id: string;\n /** Display label shown on the shortcut. */\n label: string;\n /** Icon name from the registered icon set. */\n icon: string;\n}\n\nexport interface ShortcutLinkItem extends ShortcutItemBase {\n /** Discriminant — this item navigates to an external URL. */\n type: 'external';\n /** Absolute URL the link navigates to. Opens in a new tab. */\n href: string;\n}\n\nexport interface ShortcutNavItem extends ShortcutItemBase {\n /** Discriminant — this item navigates to a portal landing page. */\n type: 'page';\n /** Callback invoked when the user activates this shortcut. */\n onClick: () => void;\n}\n\nexport type ShortcutItem = ShortcutLinkItem | ShortcutNavItem;\n\nexport interface ShortcutCategory {\n /** Unique identifier for this category. */\n id: string;\n /** Display label shown as the category heading. */\n label: string;\n /** Shortcut items belonging to this category. */\n items: ShortcutItem[];\n}\n\ninterface ShortcutsWithItems {\n /** Shortcut items to render as cards. */\n items?: ShortcutItem[];\n categories?: never;\n /**\n * Whether to render the outer card shell with a heading.\n * When `false`, only the card grid is rendered, centered within its container.\n * @default true\n */\n showHeader?: boolean;\n}\n\ninterface ShortcutsWithCategories {\n items?: never;\n /** Grouped shortcut items, each rendered as cards under a category heading. */\n categories: ShortcutCategory[];\n showHeader?: never;\n}\n\ninterface ShortcutsBaseProps extends NoChildrenProp, TestIdProp {\n /** Heading displayed above the shortcuts. */\n heading?: string;\n /**\n * Controls the layout variant of each shortcut card.\n * - `stacked`: large icon above the label (default card style).\n * - `inline`: small icon inline to the left of the label (list/link style).\n * @default 'inline'\n */\n variant?: 'stacked' | 'inline';\n /** Ref for the root card element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport type ShortcutsProps = ShortcutsBaseProps & (ShortcutsWithItems | ShortcutsWithCategories);\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from './Shortcuts';
2
+ export type { ShortcutsProps, ShortcutItem, ShortcutLinkItem, ShortcutNavItem, ShortcutCategory } from './Shortcuts.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,YAAY,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './Shortcuts';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { default } from './Shortcuts';\nexport type {\n ShortcutsProps,\n ShortcutItem,\n ShortcutLinkItem,\n ShortcutNavItem,\n ShortcutCategory\n} from './Shortcuts.types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,+BAA+B,EAAgB,MAAM,yBAAyB,CAAC;AAG7F,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAe/D,QAAA,MAAM,MAAM,EAAE,+BAA+B,CAAC,WAAW,CA8MvD,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,+BAA+B,EAAgB,MAAM,yBAAyB,CAAC;AAG7F,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAe/D,QAAA,MAAM,MAAM,EAAE,+BAA+B,CAAC,WAAW,CAwOvD,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -1,26 +1,29 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';
3
3
  import { remToPx } from 'polished';
4
- import { Icon, registerIcon, Flex, useI18n, Button, Modal, useBreakpoint, debounce, useModalManager, useConsolidatedRef, useUID, InfoDialog, useArrows, useAfterInitialEffect, VisuallyHiddenText } from '@pega/cosmos-react-core';
4
+ import { Icon, registerIcon, Flex, useI18n, Button, Modal, useBreakpoint, debounce, useModalManager, useConsolidatedRef, useUID, InfoDialog, useArrows, useDirection, useAfterInitialEffect, VisuallyHiddenText, tryCatch } from '@pega/cosmos-react-core';
5
5
  import * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';
6
6
  import StageGlimpse from './StageGlimpse';
7
7
  import { StyledInnerStage, StyledStageCompleteIcon, StyledStage, StyledStageContainer, StyledStageGlimpse, StyledStages, StyledStagesDescription, StyledStageText } from './Stages.styles';
8
8
  registerIcon(checkIcon);
9
- const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadStage, ...restProps }, ref) {
9
+ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadStage, readOnly = false, ...restProps }, ref) {
10
10
  const t = useI18n();
11
11
  const stagesRef = useConsolidatedRef(ref);
12
- const stagesRefs = useRef([]);
12
+ const stagesRefs = useRef(new Map());
13
13
  const [target, setTarget] = useState(null);
14
+ const [targetStageId, setTargetStageId] = useState(null);
14
15
  const { create: createModal } = useModalManager();
15
16
  const modalMethods = useRef();
16
17
  const [showModal, setShowModal] = useState(false);
17
18
  const isSmallOrAbove = useBreakpoint('sm');
18
19
  const [compressedView, setCompressedView] = useState(false);
19
20
  const [minExpandedWidth, setMinExpandedWidth] = useState(0);
21
+ const { rtl } = useDirection();
20
22
  useArrows(stagesRef, {
23
+ cycle: false,
21
24
  selector: ':scope > li > button:not([aria-expanded])',
22
25
  dir: 'left-right',
23
- initialFocusElement: stagesRefs.current.find(stage => stage.ariaCurrent)
26
+ initialFocusElement: stagesRefs.current.get(current) ?? null
24
27
  });
25
28
  const dialogId = useUID();
26
29
  const descriptionId = useUID();
@@ -43,7 +46,7 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
43
46
  }
44
47
  }, {
45
48
  root: stagesRef.current,
46
- rootMargin: remToPx(0.0625),
49
+ rootMargin: tryCatch(() => remToPx(0.0625), () => '1px'),
47
50
  threshold: 1
48
51
  });
49
52
  if (stagesRef.current.lastElementChild) {
@@ -55,6 +58,7 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
55
58
  const stagesToLoad = onLoadStage
56
59
  ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)
57
60
  : [];
61
+ const renderModalStages = () => stages.map(stage => (_jsxs(Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'start', gap: 0.5 }, children: [stage.completed && _jsx(StyledStageCompleteIcon, { name: 'check' }), _jsxs(StyledStageText, { variant: 'h3', isCurrent: stage.id === current, children: [stage.name, stage.completed && _jsx(VisuallyHiddenText, { children: `- ${t('completed')}` })] })] }), _jsx(StageGlimpse, { stage: stage })] }, stage.id)));
58
62
  const openModal = () => {
59
63
  setShowModal(true);
60
64
  if (stagesToLoad.length > 0)
@@ -64,11 +68,12 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
64
68
  ? t('stages_case_lifecycle', [caseTitle])
65
69
  : t('stages_default_case_lifecycle'),
66
70
  progress: stagesToLoad.length > 0,
67
- children: stages.map(stage => (_jsxs(Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'start', gap: 0.5 }, children: [stage.completed && _jsx(StyledStageCompleteIcon, { name: 'check' }), _jsxs(StyledStageText, { variant: 'h2', isCurrent: stage.id === current, children: [stage.name, stage.completed && _jsx(VisuallyHiddenText, { children: `- ${t('completed')}` })] })] }), _jsx(StageGlimpse, { stage: stage })] }, stage.id))),
71
+ children: renderModalStages(),
68
72
  onBeforeClose: () => {
69
73
  setShowModal(false);
70
74
  target?.focus();
71
75
  setTarget(null);
76
+ setTargetStageId(null);
72
77
  modalMethods.current = undefined;
73
78
  }
74
79
  });
@@ -76,10 +81,10 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
76
81
  useAfterInitialEffect(() => {
77
82
  modalMethods.current?.update({
78
83
  progress: stagesToLoad.length > 0,
79
- children: stages.map(stage => (_jsxs(Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'start', gap: 0.5 }, children: [stage.completed && _jsx(StyledStageCompleteIcon, { name: 'check' }), _jsxs(StyledStageText, { variant: 'h2', isCurrent: stage.id === current, children: [stage.name, stage.completed && _jsx(VisuallyHiddenText, { children: `- ${t('completed')}` })] })] }), _jsx(StageGlimpse, { stage: stage })] }, stage.id)))
84
+ children: renderModalStages()
80
85
  });
81
86
  }, [stagesToLoad.length]);
82
- return (_jsxs(_Fragment, { children: [_jsx(Flex, { ...restProps, container: true, as: StyledStages, ref: stagesRef, "aria-label": t('stages_label'), "aria-describedby": descriptionId, children: stages.map((stage, index) => {
87
+ return (_jsxs(_Fragment, { children: [_jsx(Flex, { ...restProps, container: true, as: StyledStages, ref: stagesRef, dir: rtl ? 'rtl' : 'ltr', "aria-label": t('stages_label'), "aria-describedby": descriptionId, children: stages.map((stage, index) => {
83
88
  const isCurrent = stage.id === current;
84
89
  let stageStatusText = t(stage.completed ? 'completed' : 'not_started');
85
90
  if (isCurrent)
@@ -95,22 +100,42 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
95
100
  else {
96
101
  stageStatus = 'pending';
97
102
  }
98
- return (_jsxs(Fragment, { children: [_jsx(Flex, { as: StyledStageContainer, item: { grow: 1, shrink: 0 }, children: _jsxs(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledStage, item: {
103
+ return (_jsxs(Fragment, { children: [_jsx(Flex, { as: StyledStageContainer, item: { grow: 1, shrink: 0 }, readOnly: readOnly, children: _jsxs(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledStage, item: {
99
104
  grow: compressedView && !isCurrent ? 0 : 1,
100
105
  shrink: compressedView && isCurrent ? 1 : 0
101
- }, status: stageStatus, "aria-current": isCurrent ? 'step' : undefined, "aria-label": t('stages_stage_label', [stage.name, stageStatusText]), onClick: (e) => {
106
+ }, status: stageStatus, readOnly: readOnly, "aria-current": isCurrent ? 'step' : undefined, "aria-label": t('stages_stage_label', [stage.name, stageStatusText]), onClick: (e) => {
102
107
  if (isSmallOrAbove) {
103
108
  if (hasToLoad)
104
109
  onLoadStage?.([stage.id]);
105
110
  setTarget(e.currentTarget);
111
+ setTargetStageId(stage.id);
106
112
  }
107
113
  else {
108
114
  openModal();
109
115
  }
110
116
  }, ref: (el) => {
111
- stagesRefs.current[index] = el;
112
- }, "aria-expanded": target && isSmallOrAbove, "aria-controls": target ? dialogId : undefined, "aria-haspopup": true, children: [stage.completed && _jsx(Icon, { name: 'check' }), (!compressedView || isCurrent || !stage.completed) && (_jsx(StyledInnerStage, { ellipsis: isCurrent && compressedView, children: !isCurrent && compressedView ? index + 1 : stage.name }))] }) }), target && stagesRefs.current[index] === target && isSmallOrAbove && !showModal && (_jsx(InfoDialog, { heading: stage.name, target: target, progress: hasToLoad ? t('loading') : undefined, onDismiss: () => {
117
+ if (el) {
118
+ stagesRefs.current.set(stage.id, el);
119
+ }
120
+ else {
121
+ stagesRefs.current.delete(stage.id);
122
+ }
123
+ }, "aria-expanded": target && isSmallOrAbove, "aria-controls": target ? dialogId : undefined, ...(!readOnly && {
124
+ 'aria-haspopup': true,
125
+ onClick: (e) => {
126
+ if (isSmallOrAbove) {
127
+ if (hasToLoad)
128
+ onLoadStage?.([stage.id]);
129
+ setTarget(e.currentTarget);
130
+ setTargetStageId(stage.id);
131
+ }
132
+ else {
133
+ openModal();
134
+ }
135
+ }
136
+ }), children: [stage.completed && _jsx(Icon, { name: 'check' }), (!compressedView || isCurrent || !stage.completed) && (_jsx(StyledInnerStage, { ellipsis: isCurrent && compressedView, children: !isCurrent && compressedView ? index + 1 : stage.name }))] }) }), target && targetStageId === stage.id && isSmallOrAbove && !showModal && (_jsx(InfoDialog, { heading: stage.name, target: target, progress: hasToLoad ? t('loading') : undefined, onDismiss: () => {
113
137
  setTarget(null);
138
+ setTargetStageId(null);
114
139
  }, placement: 'bottom-start', children: !hasToLoad && (_jsxs(StyledStageGlimpse, { children: [_jsx(StageGlimpse, { stage: stage }), _jsx(Button, { variant: 'secondary', onClick: openModal, children: t('stages_see_full_lifecycle') })] })) }))] }, stage.id));
115
140
  }) }), _jsx(StyledStagesDescription, { id: descriptionId, children: t('stages_description') })] }));
116
141
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Stages.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,aAAa,EACb,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACvB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,CAAC,SAAS,CAAC,CAAC;AAExB,MAAM,MAAM,GAAiD,UAAU,CAAC,SAAS,MAAM,CACrF,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,EAAgC,EACvF,GAAuB;IAEvB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAM,CAAsB,EAAE,C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, PropsWithoutRef } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n useI18n,\n Button,\n Modal,\n useBreakpoint,\n debounce,\n useModalManager,\n useConsolidatedRef,\n useUID,\n InfoDialog,\n useArrows,\n useAfterInitialEffect,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ModalMethods } from '@pega/cosmos-react-core';\nimport * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';\n\nimport type { StagesProps, StageStatus } from './Stages.types';\nimport StageGlimpse from './StageGlimpse';\nimport {\n StyledInnerStage,\n StyledStageCompleteIcon,\n StyledStage,\n StyledStageContainer,\n StyledStageGlimpse,\n StyledStages,\n StyledStagesDescription,\n StyledStageText\n} from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nconst Stages: ForwardRefForwardPropsComponent<StagesProps> = forwardRef(function Stages(\n { current, stages, caseTitle, onLoadStage, ...restProps }: PropsWithoutRef<StagesProps>,\n ref: StagesProps['ref']\n) {\n const t = useI18n();\n\n const stagesRef = useConsolidatedRef(ref);\n const stagesRefs = useRef<HTMLButtonElement[]>([]);\n\n const [target, setTarget] = useState<HTMLButtonElement | null>(null);\n\n const { create: createModal } = useModalManager();\n const modalMethods = useRef<ModalMethods>();\n const [showModal, setShowModal] = useState(false);\n\n const isSmallOrAbove = useBreakpoint('sm');\n const [compressedView, setCompressedView] = useState(false);\n const [minExpandedWidth, setMinExpandedWidth] = useState(0);\n\n useArrows(stagesRef, {\n selector: ':scope > li > button:not([aria-expanded])',\n dir: 'left-right',\n initialFocusElement: stagesRefs.current.find(stage => stage.ariaCurrent)\n });\n\n const dialogId = useUID();\n const descriptionId = useUID();\n\n useEffect(() => {\n if (stagesRef.current) {\n if (compressedView) {\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minExpandedWidth) {\n setCompressedView(false);\n }\n }, 100)\n );\n resizeObserver.observe(stagesRef.current);\n return () => resizeObserver.disconnect();\n }\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (!entries[0].isIntersecting) {\n setCompressedView(true);\n if (entries[0].rootBounds) setMinExpandedWidth(entries[0].rootBounds.width);\n }\n },\n {\n root: stagesRef.current,\n rootMargin: remToPx(0.0625),\n threshold: 1\n }\n );\n\n if (stagesRef.current.lastElementChild) {\n intersectionObserver.observe(stagesRef.current.lastElementChild);\n return () => intersectionObserver.disconnect();\n }\n }\n }, [minExpandedWidth, compressedView, stages.length]);\n\n const stagesToLoad = onLoadStage\n ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)\n : [];\n\n const openModal = () => {\n setShowModal(true);\n if (stagesToLoad.length > 0) onLoadStage?.(stagesToLoad);\n modalMethods.current = createModal(Modal, {\n heading: caseTitle\n ? t('stages_case_lifecycle', [caseTitle])\n : t('stages_default_case_lifecycle'),\n progress: stagesToLoad.length > 0,\n children: stages.map(stage => (\n <Fragment key={stage.id}>\n <Flex container={{ alignItems: 'start', gap: 0.5 }}>\n {stage.completed && <StyledStageCompleteIcon name='check' />}\n <StyledStageText variant='h2' isCurrent={stage.id === current}>\n {stage.name}\n {stage.completed && <VisuallyHiddenText>{`- ${t('completed')}`}</VisuallyHiddenText>}\n </StyledStageText>\n </Flex>\n <StageGlimpse stage={stage} />\n </Fragment>\n )),\n onBeforeClose: () => {\n setShowModal(false);\n target?.focus();\n setTarget(null);\n modalMethods.current = undefined;\n }\n });\n };\n\n useAfterInitialEffect(() => {\n modalMethods.current?.update({\n progress: stagesToLoad.length > 0,\n children: stages.map(stage => (\n <Fragment key={stage.id}>\n <Flex container={{ alignItems: 'start', gap: 0.5 }}>\n {stage.completed && <StyledStageCompleteIcon name='check' />}\n <StyledStageText variant='h2' isCurrent={stage.id === current}>\n {stage.name}\n {stage.completed && <VisuallyHiddenText>{`- ${t('completed')}`}</VisuallyHiddenText>}\n </StyledStageText>\n </Flex>\n <StageGlimpse stage={stage} />\n </Fragment>\n ))\n });\n }, [stagesToLoad.length]);\n\n return (\n <>\n <Flex\n {...restProps}\n container\n as={StyledStages}\n ref={stagesRef}\n aria-label={t('stages_label')}\n aria-describedby={descriptionId}\n >\n {stages.map((stage, index) => {\n const isCurrent = stage.id === current;\n let stageStatusText = t(stage.completed ? 'completed' : 'not_started');\n if (isCurrent) stageStatusText = t('current');\n\n const hasToLoad = stagesToLoad.includes(stage.id);\n\n let stageStatus: StageStatus;\n\n if (stage.completed) {\n stageStatus = 'completed';\n } else if (isCurrent) {\n stageStatus = 'current';\n } else {\n stageStatus = 'pending';\n }\n\n return (\n <Fragment key={stage.id}>\n <Flex as={StyledStageContainer} item={{ grow: 1, shrink: 0 }}>\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledStage}\n item={{\n grow: compressedView && !isCurrent ? 0 : 1,\n shrink: compressedView && isCurrent ? 1 : 0\n }}\n status={stageStatus}\n aria-current={isCurrent ? 'step' : undefined}\n aria-label={t('stages_stage_label', [stage.name, stageStatusText])}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n setTarget(e.currentTarget);\n } else {\n openModal();\n }\n }}\n ref={(el: HTMLButtonElement) => {\n stagesRefs.current[index] = el;\n }}\n aria-expanded={target && isSmallOrAbove}\n aria-controls={target ? dialogId : undefined}\n aria-haspopup\n >\n {stage.completed && <Icon name='check' />}\n {(!compressedView || isCurrent || !stage.completed) && (\n <StyledInnerStage ellipsis={isCurrent && compressedView}>\n {!isCurrent && compressedView ? index + 1 : stage.name}\n </StyledInnerStage>\n )}\n </Flex>\n </Flex>\n {target && stagesRefs.current[index] === target && isSmallOrAbove && !showModal && (\n <InfoDialog\n heading={stage.name}\n target={target}\n progress={hasToLoad ? t('loading') : undefined}\n onDismiss={() => {\n setTarget(null);\n }}\n placement='bottom-start'\n >\n {!hasToLoad && (\n <StyledStageGlimpse>\n <StageGlimpse stage={stage} />\n <Button variant='secondary' onClick={openModal}>\n {t('stages_see_full_lifecycle')}\n </Button>\n </StyledStageGlimpse>\n )}\n </InfoDialog>\n )}\n </Fragment>\n );\n })}\n </Flex>\n <StyledStagesDescription id={descriptionId}>\n {t('stages_description')}\n </StyledStagesDescription>\n </>\n );\n});\n\nexport default Stages;\n"]}
1
+ {"version":3,"file":"Stages.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,aAAa,EACb,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACvB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,CAAC,SAAS,CAAC,CAAC;AAExB,MAAM,MAAM,GAAiD,UAAU,CAAC,SAAS,MAAM,CACrF,EACE,OAAO,EACP,MAAM,EACN,SAAS,EACT,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,GAAG,SAAS,EACiB,EAC/B,GAAuB;IAEvB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAM,C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C,CAAC;oCAChB,gBAAgB,CAAC,IAAI,CAAC,CAAC;gCACzB,CAAC,EACD,SAAS,EAAC,cAAc,YAEvB,CAAC,SAAS,IAAI,CACb,MAAC,kBAAkB,eACjB,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,EAC9B,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,SAAS,YAC3C,CAAC,CAAC,2BAA2B,CAAC,GACxB,IACU,CACtB,GACU,CACd,KAxEY,KAAK,CAAC,EAAE,CAyEZ,CACZ,CAAC;gBACJ,CAAC,CAAC,GACG,EACP,KAAC,uBAAuB,IAAC,EAAE,EAAE,aAAa,YACvC,CAAC,CAAC,oBAAoB,CAAC,GACA,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC","sourcesContent":["import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n useI18n,\n Button,\n Modal,\n useBreakpoint,\n debounce,\n useModalManager,\n useConsolidatedRef,\n useUID,\n InfoDialog,\n useArrows,\n useDirection,\n useAfterInitialEffect,\n VisuallyHiddenText,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ModalMethods } from '@pega/cosmos-react-core';\nimport * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';\n\nimport type { StagesProps, StageStatus } from './Stages.types';\nimport StageGlimpse from './StageGlimpse';\nimport {\n StyledInnerStage,\n StyledStageCompleteIcon,\n StyledStage,\n StyledStageContainer,\n StyledStageGlimpse,\n StyledStages,\n StyledStagesDescription,\n StyledStageText\n} from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nconst Stages: ForwardRefForwardPropsComponent<StagesProps> = forwardRef(function Stages(\n {\n current,\n stages,\n caseTitle,\n onLoadStage,\n readOnly = false,\n ...restProps\n }: PropsWithoutRef<StagesProps>,\n ref: StagesProps['ref']\n) {\n const t = useI18n();\n\n const stagesRef = useConsolidatedRef(ref);\n const stagesRefs = useRef<Map<string, HTMLButtonElement>>(new Map());\n\n const [target, setTarget] = useState<HTMLButtonElement | null>(null);\n const [targetStageId, setTargetStageId] = useState<string | null>(null);\n\n const { create: createModal } = useModalManager();\n const modalMethods = useRef<ModalMethods>();\n const [showModal, setShowModal] = useState(false);\n\n const isSmallOrAbove = useBreakpoint('sm');\n const [compressedView, setCompressedView] = useState(false);\n const [minExpandedWidth, setMinExpandedWidth] = useState(0);\n\n const { rtl } = useDirection();\n\n useArrows(stagesRef, {\n cycle: false,\n selector: ':scope > li > button:not([aria-expanded])',\n dir: 'left-right',\n initialFocusElement: stagesRefs.current.get(current) ?? null\n });\n\n const dialogId = useUID();\n const descriptionId = useUID();\n\n useEffect(() => {\n if (stagesRef.current) {\n if (compressedView) {\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minExpandedWidth) {\n setCompressedView(false);\n }\n }, 100)\n );\n resizeObserver.observe(stagesRef.current);\n return () => resizeObserver.disconnect();\n }\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (!entries[0].isIntersecting) {\n setCompressedView(true);\n if (entries[0].rootBounds) setMinExpandedWidth(entries[0].rootBounds.width);\n }\n },\n {\n root: stagesRef.current,\n rootMargin: tryCatch(\n () => remToPx(0.0625),\n () => '1px'\n ),\n threshold: 1\n }\n );\n\n if (stagesRef.current.lastElementChild) {\n intersectionObserver.observe(stagesRef.current.lastElementChild);\n return () => intersectionObserver.disconnect();\n }\n }\n }, [minExpandedWidth, compressedView, stages.length]);\n\n const stagesToLoad = onLoadStage\n ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)\n : [];\n\n const renderModalStages = () =>\n stages.map(stage => (\n <Fragment key={stage.id}>\n <Flex container={{ alignItems: 'start', gap: 0.5 }}>\n {stage.completed && <StyledStageCompleteIcon name='check' />}\n <StyledStageText variant='h3' isCurrent={stage.id === current}>\n {stage.name}\n {stage.completed && <VisuallyHiddenText>{`- ${t('completed')}`}</VisuallyHiddenText>}\n </StyledStageText>\n </Flex>\n <StageGlimpse stage={stage} />\n </Fragment>\n ));\n\n const openModal = () => {\n setShowModal(true);\n if (stagesToLoad.length > 0) onLoadStage?.(stagesToLoad);\n modalMethods.current = createModal(Modal, {\n heading: caseTitle\n ? t('stages_case_lifecycle', [caseTitle])\n : t('stages_default_case_lifecycle'),\n progress: stagesToLoad.length > 0,\n children: renderModalStages(),\n onBeforeClose: () => {\n setShowModal(false);\n target?.focus();\n setTarget(null);\n setTargetStageId(null);\n modalMethods.current = undefined;\n }\n });\n };\n\n useAfterInitialEffect(() => {\n modalMethods.current?.update({\n progress: stagesToLoad.length > 0,\n children: renderModalStages()\n });\n }, [stagesToLoad.length]);\n\n return (\n <>\n <Flex\n {...restProps}\n container\n as={StyledStages}\n ref={stagesRef}\n dir={rtl ? 'rtl' : 'ltr'}\n aria-label={t('stages_label')}\n aria-describedby={descriptionId}\n >\n {stages.map((stage, index) => {\n const isCurrent = stage.id === current;\n let stageStatusText = t(stage.completed ? 'completed' : 'not_started');\n if (isCurrent) stageStatusText = t('current');\n\n const hasToLoad = stagesToLoad.includes(stage.id);\n\n let stageStatus: StageStatus;\n\n if (stage.completed) {\n stageStatus = 'completed';\n } else if (isCurrent) {\n stageStatus = 'current';\n } else {\n stageStatus = 'pending';\n }\n\n return (\n <Fragment key={stage.id}>\n <Flex as={StyledStageContainer} item={{ grow: 1, shrink: 0 }} readOnly={readOnly}>\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledStage}\n item={{\n grow: compressedView && !isCurrent ? 0 : 1,\n shrink: compressedView && isCurrent ? 1 : 0\n }}\n status={stageStatus}\n readOnly={readOnly}\n aria-current={isCurrent ? 'step' : undefined}\n aria-label={t('stages_stage_label', [stage.name, stageStatusText])}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n setTarget(e.currentTarget);\n setTargetStageId(stage.id);\n } else {\n openModal();\n }\n }}\n ref={(el: HTMLButtonElement | null) => {\n if (el) {\n stagesRefs.current.set(stage.id, el);\n } else {\n stagesRefs.current.delete(stage.id);\n }\n }}\n aria-expanded={target && isSmallOrAbove}\n aria-controls={target ? dialogId : undefined}\n {...(!readOnly && {\n 'aria-haspopup': true,\n onClick: (e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n setTarget(e.currentTarget);\n setTargetStageId(stage.id);\n } else {\n openModal();\n }\n }\n })}\n >\n {stage.completed && <Icon name='check' />}\n {(!compressedView || isCurrent || !stage.completed) && (\n <StyledInnerStage ellipsis={isCurrent && compressedView}>\n {!isCurrent && compressedView ? index + 1 : stage.name}\n </StyledInnerStage>\n )}\n </Flex>\n </Flex>\n {target && targetStageId === stage.id && isSmallOrAbove && !showModal && (\n <InfoDialog\n heading={stage.name}\n target={target}\n progress={hasToLoad ? t('loading') : undefined}\n onDismiss={() => {\n setTarget(null);\n setTargetStageId(null);\n }}\n placement='bottom-start'\n >\n {!hasToLoad && (\n <StyledStageGlimpse>\n <StageGlimpse stage={stage} />\n <Button variant='secondary' onClick={openModal}>\n {t('stages_see_full_lifecycle')}\n </Button>\n </StyledStageGlimpse>\n )}\n </InfoDialog>\n )}\n </Fragment>\n );\n })}\n </Flex>\n <StyledStagesDescription id={descriptionId}>\n {t('stages_description')}\n </StyledStagesDescription>\n </>\n );\n});\n\nexport default Stages;\n"]}
@@ -1,20 +1,27 @@
1
- export declare const StyledStages: import("styled-components").StyledComponent<"ol", import("styled-components").DefaultTheme, {}, never>;
2
- export declare const StyledInnerStage: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
1
+ export declare const StyledStages: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>> & string;
2
+ export declare const StyledInnerStage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
3
3
  ellipsis?: boolean;
4
- }, never>;
5
- export declare const StyledStage: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
4
+ }>> & string;
5
+ export declare const StyledStage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
6
6
  status: "completed" | "current" | "pending";
7
- }, never>;
8
- export declare const StyledStageCompleteIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, import("styled-components").DefaultTheme, {}, never>;
9
- export declare const StyledStageText: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, import("styled-components").DefaultTheme, {
7
+ readOnly?: boolean;
8
+ }>> & string;
9
+ export declare const StyledStageCompleteIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("@pega/cosmos-react-core").IconProps & import("styled-components/dist/types").BaseObject, import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, keyof import("react").Component<any, {}, any>>;
10
+ export declare const StyledStageText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("@pega/cosmos-react-core").TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
11
+ ref?: ((instance: HTMLHeadingElement | HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLHeadingElement | HTMLSpanElement> | null | undefined;
12
+ }, {
10
13
  isCurrent?: boolean;
11
- }, never>;
12
- export declare const StyledStageContainer: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
13
- export declare const StyledStepsContainer: import("styled-components").StyledComponent<"ol", import("styled-components").DefaultTheme, {}, never>;
14
- export declare const StyledStep: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {
14
+ }>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, keyof import("react").Component<any, {}, any>>;
15
+ export declare const StyledStageContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
16
+ readOnly?: boolean;
17
+ }>> & string;
18
+ export declare const StyledStepsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>> & string;
19
+ export declare const StyledStep: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
15
20
  completed: boolean;
16
- }, never>;
17
- export declare const StyledDateTimeDisplay: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").DateTimeDisplayProps>, import("styled-components").DefaultTheme, {}, never>;
18
- export declare const StyledStageGlimpse: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
19
- export declare const StyledStagesDescription: import("styled-components").StyledComponent<"p", import("styled-components").DefaultTheme, {}, never>;
21
+ }>> & string;
22
+ export declare const StyledDateTimeDisplay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@pega/cosmos-react-core").DateTimeDisplayProps, "ref"> & import("react").RefAttributes<HTMLSpanElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
23
+ ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
24
+ }, never>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").DateTimeDisplayProps>, keyof import("react").Component<any, {}, any>>;
25
+ export declare const StyledStageGlimpse: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
26
+ export declare const StyledStagesDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
20
27
  //# sourceMappingURL=Stages.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stages.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,wGAYvB,CAAC;AAIH,eAAO,MAAM,gBAAgB;eAA4B,OAAO;SAW9D,CAAC;AAEH,eAAO,MAAM,WAAW;YAA2B,WAAW,GAAG,SAAS,GAAG,SAAS;SAoJrF,CAAC;AAIF,eAAO,MAAM,uBAAuB,0LAQlC,CAAC;AAEH,eAAO,MAAM,eAAe;gBAA8B,OAAO;SAIhE,CAAC;AAMF,eAAO,MAAM,oBAAoB,wGAuDhC,CAAC;AAIF,eAAO,MAAM,oBAAoB,wGAS/B,CAAC;AAIH,eAAO,MAAM,UAAU;eAA0B,OAAO;SAyBtD,CAAC;AAIH,eAAO,MAAM,qBAAqB,6NAMhC,CAAC;AAIH,eAAO,MAAM,kBAAkB,yGAI7B,CAAC;AAIH,eAAO,MAAM,uBAAuB,uGAEnC,CAAC"}
1
+ {"version":3,"file":"Stages.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"AAqHA,eAAO,MAAM,YAAY,mOAgBvB,CAAC;AAIH,eAAO,MAAM,gBAAgB;eAA4B,OAAO;YAW9D,CAAC;AAIH,eAAO,MAAM,WAAW;YACd,WAAW,GAAG,SAAS,GAAG,SAAS;eAChC,OAAO;YAwGnB,CAAC;AAIF,eAAO,MAAM,uBAAuB,kaAiBlC,CAAC;AAGH,eAAO,MAAM,eAAe;;;gBAA8B,OAAO;kLAIhE,CAAC;AAIF,eAAO,MAAM,oBAAoB;eACpB,OAAO;YAqLnB,CAAC;AAIF,eAAO,MAAM,oBAAoB,mOAS/B,CAAC;AAIH,eAAO,MAAM,UAAU;eAA0B,OAAO;YAoBtD,CAAC;AAIH,eAAO,MAAM,qBAAqB;;oMAMhC,CAAC;AAIH,eAAO,MAAM,kBAAkB,6NAI7B,CAAC;AAIH,eAAO,MAAM,uBAAuB,yOAEnC,CAAC"}